@qwen-code/qwen-code 0.19.10 → 0.19.11-nightly.20260717.f8e6e8931

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 (275) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +7 -6
  2. package/bundled/qc-helper/docs/features/approval-mode.md +2 -2
  3. package/bundled/qc-helper/docs/features/channels/dingtalk.md +30 -0
  4. package/bundled/qc-helper/docs/features/channels/overview.md +53 -17
  5. package/bundled/qc-helper/docs/features/channels/wecom.md +8 -7
  6. package/bundled/qc-helper/docs/features/sandbox.md +2 -0
  7. package/bundled/qc-helper/docs/qwen-serve-deploy-local.md +42 -7
  8. package/bundled/qc-helper/docs/qwen-serve.md +53 -46
  9. package/bundled/review/SKILL.md +163 -403
  10. package/chunks/{MaxSizedBox-67ODZ4SZ.js → MaxSizedBox-JGTP7YJQ.js} +13 -13
  11. package/chunks/{StandaloneSessionPicker-SIPBQT5Z.js → StandaloneSessionPicker-2XQDOYZ5.js} +27 -27
  12. package/chunks/{acpAgent-VPZJXLFX.js → acpAgent-RXRJA7GD.js} +1135 -373
  13. package/chunks/{agent-Z7NWL6XL.js → agent-UQP53UWQ.js} +10 -10
  14. package/chunks/{agent-headless-73HZ6ROQ.js → agent-headless-I52OXDCK.js} +10 -10
  15. package/chunks/{anthropicContentGenerator-56U3YCP2.js → anthropicContentGenerator-HBRXJSP4.js} +76 -14
  16. package/chunks/{artifact-tool-BWZZJ42H.js → artifact-tool-MIZLXBLF.js} +1 -1
  17. package/chunks/{askUserQuestion-WU3S5A5T.js → askUserQuestion-XMJVPNWM.js} +1 -1
  18. package/chunks/{bridge-XFKW6S7Q.js → bridge-3DVRNBSF.js} +14 -16
  19. package/chunks/{ca-C2JTT2N5.js → ca-CODEN7TD.js} +5 -0
  20. package/chunks/channel-worker-group-SOUWTFHC.js +21 -0
  21. package/chunks/{channel-worker-manager-5RWKSGEU.js → channel-worker-manager-LOVSV3WW.js} +34 -10
  22. package/chunks/{channel-worker-supervisor-PCDAZN4D.js → channel-worker-supervisor-XW6MHJBQ.js} +6 -4
  23. package/chunks/{chunk-BBNVFRGD.js → chunk-3DWIFU7L.js} +1 -1
  24. package/chunks/{chunk-ZQTZXVHP.js → chunk-3KSHYS4T.js} +4 -18
  25. package/chunks/{chunk-ZKMGAFYV.js → chunk-3LS57JZI.js} +1 -1
  26. package/chunks/{chunk-B5I2IIWY.js → chunk-46Y6SSQ7.js} +5 -5
  27. package/chunks/{chunk-GDQQRV43.js → chunk-4BJVSIS3.js} +2 -2
  28. package/chunks/{chunk-L37RC7MQ.js → chunk-4HTHLSIH.js} +1 -1
  29. package/chunks/{chunk-DPFBNG72.js → chunk-4UBEB74N.js} +1 -1
  30. package/chunks/{chunk-AAR5SGMD.js → chunk-4YR7FSAM.js} +7 -5
  31. package/chunks/{chunk-OATTJGPJ.js → chunk-5CNYZ7TN.js} +7 -7
  32. package/chunks/{chunk-JSJFKYWT.js → chunk-5VWYKIMW.js} +1 -1
  33. package/chunks/{chunk-6GETGQWP.js → chunk-5WWYHNAH.js} +39 -10
  34. package/chunks/{chunk-65N2J6V2.js → chunk-6ANLV27M.js} +2 -2
  35. package/chunks/{chunk-L62SEJWY.js → chunk-6RV42SFP.js} +4 -4
  36. package/chunks/{chunk-XXJKGHZV.js → chunk-6VMOP2Z7.js} +4 -4
  37. package/chunks/{chunk-URU5UEK6.js → chunk-6WGZDD67.js} +135 -68
  38. package/chunks/{chunk-7NAWTFVY.js → chunk-6WPJRYLZ.js} +2 -2
  39. package/chunks/chunk-6WVLHULT.js +59 -0
  40. package/chunks/{chunk-N6FXRR6P.js → chunk-7ZFXHKKZ.js} +1 -1
  41. package/chunks/{chunk-E67NFMF4.js → chunk-A2HWMJVO.js} +35 -1
  42. package/chunks/{chunk-4FMG7EDJ.js → chunk-AEKHQ3E5.js} +77 -11
  43. package/chunks/{chunk-WIASPMLX.js → chunk-AH3YAJU6.js} +22 -33
  44. package/chunks/{chunk-6GKMJPOC.js → chunk-AHAH5H6D.js} +3 -3
  45. package/chunks/{chunk-3XJFUTNM.js → chunk-AVAU67KP.js} +57 -10
  46. package/chunks/{chunk-LNUXFLLJ.js → chunk-BDHYJ2MM.js} +53 -5
  47. package/chunks/{chunk-P6LART6G.js → chunk-BTSE2DUP.js} +957 -122
  48. package/chunks/{chunk-7MJAZMXK.js → chunk-BZ5D7OVV.js} +28 -77
  49. package/chunks/{chunk-WDWJ4OQJ.js → chunk-CC2UASQ4.js} +3 -3
  50. package/chunks/{chunk-WLXYAKV7.js → chunk-D7KYA6EY.js} +3 -3
  51. package/chunks/{chunk-5LROA5W4.js → chunk-DD45XVOQ.js} +3 -3
  52. package/chunks/{chunk-H3FQOPPS.js → chunk-DOPUYNXO.js} +2 -2
  53. package/chunks/{chunk-SPUYQB4T.js → chunk-DPXB3XRN.js} +1 -1
  54. package/chunks/{chunk-XLIRF7IK.js → chunk-E7ECGLZW.js} +1 -1
  55. package/chunks/{chunk-RDRVMDWV.js → chunk-EMJJBXS7.js} +10 -10
  56. package/chunks/{chunk-TXY2C3D2.js → chunk-F333XEAU.js} +1 -1
  57. package/chunks/chunk-FEOZBUMT.js +77 -0
  58. package/chunks/{chunk-YYPXHMWO.js → chunk-FEYHXPZG.js} +4 -4
  59. package/chunks/{chunk-ZRKBI3DP.js → chunk-FNX3LGAK.js} +1 -1
  60. package/chunks/chunk-FXK3QMRD.js +140 -0
  61. package/chunks/{chunk-422XAKCK.js → chunk-G5ZKRK2E.js} +2 -2
  62. package/chunks/{chunk-DK33QJ3V.js → chunk-GCRFH57X.js} +732 -13
  63. package/chunks/{chunk-EQY6POVO.js → chunk-GLEJW7T2.js} +1 -1
  64. package/chunks/{chunk-FXMC7SL2.js → chunk-I6NOSIVF.js} +1 -1
  65. package/chunks/{chunk-VBRRNQB7.js → chunk-IHJRUIWN.js} +109 -22
  66. package/chunks/{chunk-F7NXQH4Y.js → chunk-IIXEI2VE.js} +1 -1
  67. package/chunks/{chunk-2UUAIFQO.js → chunk-JGUT3LWZ.js} +5 -0
  68. package/chunks/{chunk-5EBKKSBX.js → chunk-JY74T7PW.js} +1 -1
  69. package/chunks/chunk-KSZKSE23.js +226 -0
  70. package/chunks/{chunk-MO7O5722.js → chunk-KW46DBFM.js} +35 -2
  71. package/chunks/{chunk-TISZXPAX.js → chunk-L263ROM6.js} +1 -1
  72. package/chunks/chunk-LXXMOYPL.js +22 -0
  73. package/chunks/{chunk-YX4LLZ3D.js → chunk-NABT4VOY.js} +109 -35
  74. package/chunks/{chunk-W34A5MJH.js → chunk-NROLDLP4.js} +1 -1
  75. package/chunks/{chunk-V7EQTZYR.js → chunk-O3WCEZEN.js} +191 -44
  76. package/chunks/{chunk-K4PZ5F5T.js → chunk-OWT2CAEQ.js} +1 -1
  77. package/chunks/{chunk-4YWLED2A.js → chunk-PNCWEDF6.js} +7 -4
  78. package/chunks/{chunk-WDW64OW3.js → chunk-PSDTLRAV.js} +5 -5
  79. package/chunks/{chunk-7R4DPSRA.js → chunk-R3VWUU2E.js} +1 -1
  80. package/chunks/{chunk-K7CRWKOE.js → chunk-R6AO7HBQ.js} +4617 -4012
  81. package/chunks/{chunk-6OATMEYN.js → chunk-RTV5TUYB.js} +12 -4
  82. package/chunks/{chunk-6W6DI34P.js → chunk-SE6GSFAO.js} +159 -2
  83. package/chunks/{chunk-WTSXKLG5.js → chunk-SUARMD4Q.js} +1 -1
  84. package/chunks/chunk-T4TZQJ7W.js +48 -0
  85. package/chunks/{chunk-LTNI523B.js → chunk-T7CZYIAU.js} +28 -5
  86. package/chunks/{chunk-3MX7D6QN.js → chunk-TIOE2OPE.js} +32 -4
  87. package/chunks/{chunk-TTUO4DNG.js → chunk-UF6ZTWU5.js} +75 -710
  88. package/chunks/{chunk-Q5GLXH5Q.js → chunk-UJG4VV2O.js} +5 -5
  89. package/chunks/{chunk-CJFNEBYB.js → chunk-VFEZWI6F.js} +1 -1
  90. package/chunks/{chunk-UFOKA4PR.js → chunk-VHCSIMTF.js} +114 -4
  91. package/chunks/{chunk-TQBODCFD.js → chunk-VRR65QYW.js} +250 -2
  92. package/chunks/{chunk-CUUXANEQ.js → chunk-W6J7RSCK.js} +6 -1
  93. package/chunks/{chunk-YHN5SUIJ.js → chunk-W7H223ZZ.js} +1 -1
  94. package/chunks/{chunk-WX6SD4IQ.js → chunk-WTNZ6DXB.js} +1 -1
  95. package/chunks/{chunk-GGJII3FM.js → chunk-WZJELXEU.js} +92 -3
  96. package/chunks/{chunk-OFEVHGVU.js → chunk-X5HZX4EP.js} +9 -11
  97. package/chunks/{chunk-KSO42X3Z.js → chunk-X6YQWCIJ.js} +21 -2
  98. package/chunks/{chunk-7L4XBYVW.js → chunk-XK42MWWO.js} +9 -2
  99. package/chunks/{chunk-X362TMXZ.js → chunk-XQDPCQ3A.js} +7 -5
  100. package/chunks/{chunk-YU56QGXX.js → chunk-Y3TNSHKF.js} +1 -1
  101. package/chunks/{chunk-HHEFI4RP.js → chunk-YOJGIRTD.js} +714 -109
  102. package/chunks/{chunk-CEW4HDPK.js → chunk-ZK4AMPKI.js} +2459 -350
  103. package/chunks/{chunk-SXU3KKNI.js → chunk-ZQIYGQCG.js} +251 -54
  104. package/chunks/{computer-use-IYTX45WA.js → computer-use-LTW3VB6L.js} +10 -10
  105. package/chunks/{config-utils-CFT33LTP.js → config-utils-IQQT3GCI.js} +3 -3
  106. package/chunks/{contextCommand-272V77WU.js → contextCommand-GLMC6CTP.js} +12 -12
  107. package/chunks/{create-sub-session-WNX2OQVX.js → create-sub-session-EAB2U5XW.js} +1 -1
  108. package/chunks/{create-sub-session-CBJMQLYP.js → create-sub-session-YMWQAWSN.js} +10 -10
  109. package/chunks/{cron-create-36TIFKRT.js → cron-create-GMVKSXZT.js} +1 -1
  110. package/chunks/{cron-delete-OQD3WULU.js → cron-delete-VDZKUAVK.js} +1 -1
  111. package/chunks/{cron-list-4533T2FH.js → cron-list-UG7C7RAR.js} +1 -1
  112. package/chunks/{daemon-RNGFPMAB.js → daemon-PRB64RP5.js} +303 -71
  113. package/chunks/{daemon-status-provider-L4STG5VO.js → daemon-status-provider-5OMM5JHF.js} +19 -20
  114. package/chunks/{de-2VCDRDGU.js → de-NOXPCSYN.js} +5 -0
  115. package/chunks/{dist-ERCPDVA6.js → dist-4WCQEZIN.js} +4 -51
  116. package/chunks/{dist-MOEC47TR.js → dist-DOPL5LSQ.js} +1 -1
  117. package/chunks/{dist-JZE7F6YR.js → dist-GXJVCOS7.js} +1 -1
  118. package/chunks/{dist-PHEPJLXD.js → dist-PX2ERZ6I.js} +2 -2
  119. package/chunks/{dist-HNN7DR2L.js → dist-V2YVLYOW.js} +58 -30
  120. package/chunks/{dist-3V3ZV6ML.js → dist-VYWUKURL.js} +1 -1
  121. package/chunks/{earlyInputCapture-EN4BRREQ.js → earlyInputCapture-A3WSRN4T.js} +10 -10
  122. package/chunks/{edit-OMAF2QDR.js → edit-7PG4AH27.js} +10 -10
  123. package/chunks/{en-NJCA3TAA.js → en-JFVULHTB.js} +6 -0
  124. package/chunks/{enter-worktree-BBZX52HG.js → enter-worktree-QUSB44RE.js} +10 -10
  125. package/chunks/{enterPlanMode-5NNFMBUY.js → enterPlanMode-NVSIEL7X.js} +10 -10
  126. package/chunks/{environment-7TEWMJYN.js → environment-AHHXHQTI.js} +12 -12
  127. package/chunks/{errors-I4VKVX3F.js → errors-NSWSRXC7.js} +12 -12
  128. package/chunks/{exit-worktree-FUWRJI33.js → exit-worktree-FXYEYHPL.js} +10 -10
  129. package/chunks/{exitPlanMode-IHCJ5EEI.js → exitPlanMode-JI5GK3F6.js} +10 -10
  130. package/chunks/{fast-path-ZA57TOH4.js → fast-path-X7EVDLKZ.js} +2 -2
  131. package/chunks/{fr-5F3E7WKD.js → fr-HVFNU42H.js} +5 -0
  132. package/chunks/{gemini-UOAKVXBG.js → gemini-YRLHY5KS.js} +162 -206
  133. package/chunks/{geminiContentGenerator-G6UCE6MW.js → geminiContentGenerator-SPLFPV5E.js} +1 -1
  134. package/chunks/{glob-4GJQ2UFF.js → glob-WASUBCSA.js} +10 -10
  135. package/chunks/{grep-5QSYXF2E.js → grep-DUVG3NGA.js} +10 -10
  136. package/chunks/{handleAutoUpdate-ULHNWL6R.js → handleAutoUpdate-NGE5AQ2N.js} +14 -14
  137. package/chunks/{i18n-CYDUTF6F.js → i18n-QNVR36NB.js} +11 -11
  138. package/chunks/{initializer-NRFKUGIO.js → initializer-ZY7ORPMH.js} +15 -15
  139. package/chunks/{installationInfo-WELKRHHE.js → installationInfo-4R75MFTB.js} +11 -11
  140. package/chunks/{ja-66J6B53L.js → ja-PY5AF544.js} +5 -0
  141. package/chunks/{list-JVDXEG2E.js → list-36JCMZRS.js} +18 -18
  142. package/chunks/{loadedSettingsAdapter-WAM4VUTG.js → loadedSettingsAdapter-PQIOJUSJ.js} +15 -15
  143. package/chunks/{loop-wakeup-MVUKDVCP.js → loop-wakeup-QXWZSCYM.js} +2 -2
  144. package/chunks/{ls-RXNIAQDE.js → ls-2OUTG3IZ.js} +1 -1
  145. package/chunks/{lsp-HB5LM5IL.js → lsp-4VMNXZW6.js} +1 -1
  146. package/chunks/{mcp-YHOZN3ZM.js → mcp-QXY6XA6H.js} +15 -15
  147. package/chunks/{monitor-R7XZPJHQ.js → monitor-AVEKRSY3.js} +12 -11
  148. package/chunks/{nonInteractiveCli-NSOB6D74.js → nonInteractiveCli-YWIBKX4M.js} +50 -50
  149. package/chunks/{notebook-edit-6RNKE2L2.js → notebook-edit-4SBTJX72.js} +10 -10
  150. package/chunks/{openaiContentGenerator-XNS5S64I.js → openaiContentGenerator-4EBAO7LR.js} +8 -8
  151. package/chunks/{pidfile-XE4RRR2P.js → pidfile-JMIUPXSU.js} +10 -10
  152. package/chunks/processUtils-EOINMEIH.js +29 -0
  153. package/chunks/{pt-TFZO5Y6T.js → pt-A3PRQXMU.js} +5 -0
  154. package/chunks/{qwenContentGenerator-APDPJ3VN.js → qwenContentGenerator-M7UBL3JS.js} +12 -12
  155. package/chunks/{read-file-XSUWXSR7.js → read-file-DXSEFHCV.js} +5 -5
  156. package/chunks/{read-mcp-resource-6LRTZKXI.js → read-mcp-resource-JUFHCKSC.js} +1 -1
  157. package/chunks/{record-artifact-PMDTY4OS.js → record-artifact-DWSMBXYY.js} +1 -1
  158. package/chunks/{ripGrep-APB3CDMU.js → ripGrep-VTRVFMDJ.js} +10 -10
  159. package/chunks/{ru-4L4LFHIT.js → ru-IBCWUTOC.js} +5 -0
  160. package/chunks/{run-qwen-serve-NWTGPERT.js → run-qwen-serve-P7WQDZAS.js} +59 -38
  161. package/chunks/{runtime-EIO3NQKR.js → runtime-UHYO6JGN.js} +19 -19
  162. package/chunks/{scheduler-JJDZBDRN.js → scheduler-WTK7ZLV5.js} +10 -10
  163. package/chunks/{send-message-SR4WSXP2.js → send-message-JZ752NWD.js} +2 -2
  164. package/chunks/{serve-WTIPB3EI.js → serve-AG2AOG56.js} +15 -15
  165. package/chunks/{server-NJPHQHLH.js → server-G5MM2BRI.js} +1157 -225
  166. package/chunks/{session-O4AO7FTS.js → session-NUAGEMVS.js} +51 -51
  167. package/chunks/{settings-HQNDK7TG.js → settings-VQA5PR2M.js} +14 -14
  168. package/chunks/{shell-UIXM6PWG.js → shell-X33RWGLP.js} +12 -10
  169. package/chunks/{skill-3XMB4ULV.js → skill-PHSU2OPP.js} +5 -5
  170. package/chunks/{spawnChannel-3R632QRM.js → spawnChannel-D6TZN4W7.js} +12 -13
  171. package/chunks/{src-USZKPUOC.js → src-6OJFUPTL.js} +95 -34
  172. package/chunks/{standalone-update-L5XW3D7K.js → standalone-update-ZARRW44Y.js} +12 -12
  173. package/chunks/{startInteractiveUI-CPZOL2WB.js → startInteractiveUI-C6IZRTF3.js} +176 -158
  174. package/chunks/{syntheticOutput-YKFNUQZD.js → syntheticOutput-LELY6HAI.js} +2 -2
  175. package/chunks/{task-create-NUFOHU53.js → task-create-QY3BIMNM.js} +3 -3
  176. package/chunks/{task-list-Z2IKQY3S.js → task-list-D2U47WBJ.js} +1 -1
  177. package/chunks/{task-stop-KQFIVQTJ.js → task-stop-N6E5IYLH.js} +1 -1
  178. package/chunks/{task-update-HKADXSTD.js → task-update-HJCQILLB.js} +3 -3
  179. package/chunks/{team-create-XXPRF3IQ.js → team-create-H434NQP2.js} +10 -10
  180. package/chunks/{team-delete-SDNTGZLG.js → team-delete-RCWYDRF4.js} +1 -1
  181. package/chunks/{team-plan-approval-EOTTKHDW.js → team-plan-approval-IIOHXZU6.js} +10 -10
  182. package/chunks/{theme-manager-P6UITO2L.js → theme-manager-IEOPHMX6.js} +10 -10
  183. package/chunks/{todoWrite-YNXB27GB.js → todoWrite-FKCGATPJ.js} +1 -1
  184. package/chunks/{tool-search-DDNGK2LR.js → tool-search-WIIEDALL.js} +6 -6
  185. package/chunks/{total-session-admission-PL5N7DNY.js → total-session-admission-WU3DORRW.js} +15 -17
  186. package/chunks/{trustedFolders-C5LMF3UR.js → trustedFolders-JVUTUAJ3.js} +11 -11
  187. package/chunks/update-relaunch-X5EQKCH5.js +87 -0
  188. package/chunks/{updateCheck-QTVVISH7.js → updateCheck-TGO2X735.js} +14 -12
  189. package/chunks/{validateNonInterActiveAuth-RY4RKBQG.js → validateNonInterActiveAuth-2MEUL2ME.js} +46 -46
  190. package/chunks/{version-U45RYOSD.js → version-KBGQKZWV.js} +1 -1
  191. package/chunks/{web-fetch-ZSPR3PRR.js → web-fetch-CFCWTCAP.js} +2 -3
  192. package/chunks/{workflow-TCIAQYOA.js → workflow-PAOSF4CG.js} +11 -11
  193. package/chunks/{workspace-providers-status-I3G2HYLY.js → workspace-providers-status-AYHJYSVO.js} +18 -18
  194. package/chunks/{workspace-registration-store-IH5GLZ6Y.js → workspace-registration-store-GZMR53QL.js} +1 -1
  195. package/chunks/{workspace-registry-QEKBELIX.js → workspace-registry-C2IXZWPF.js} +15 -17
  196. package/chunks/{workspace-service-ORKHGLP3.js → workspace-service-KDDAW33F.js} +20 -21
  197. package/chunks/{workspace-skills-status-D7QCNDYY.js → workspace-skills-status-WWEZBZXY.js} +16 -16
  198. package/chunks/{write-file-JGRQR5VM.js → write-file-ACN3TAIX.js} +10 -10
  199. package/chunks/{zh-FSAH32JB.js → zh-PAUNIMHQ.js} +6 -0
  200. package/chunks/{zh-TW-D2YIE2LO.js → zh-TW-GNEUIUFF.js} +6 -0
  201. package/cli-entry.js +92 -8
  202. package/cli.js +11 -11
  203. package/locales/ca.js +10 -0
  204. package/locales/de.js +10 -0
  205. package/locales/en.js +11 -0
  206. package/locales/fr.js +10 -0
  207. package/locales/ja.js +10 -0
  208. package/locales/pt.js +10 -0
  209. package/locales/ru.js +10 -0
  210. package/locales/zh-TW.js +11 -0
  211. package/locales/zh.js +11 -0
  212. package/package.json +3 -3
  213. package/web-shell/assets/{arc-CUeDlxvE.js → arc-Blc5_CnD.js} +1 -1
  214. package/web-shell/assets/{architectureDiagram-3BPJPVTR-PiUszkQA.js → architectureDiagram-3BPJPVTR-Dyv1BvGP.js} +1 -1
  215. package/web-shell/assets/{blockDiagram-GPEHLZMM-s2wYSO7e.js → blockDiagram-GPEHLZMM-CVAb8DyB.js} +1 -1
  216. package/web-shell/assets/{c4Diagram-AAUBKEIU-DyLxZoz9.js → c4Diagram-AAUBKEIU-ClHPb_6S.js} +1 -1
  217. package/web-shell/assets/channel-DkPTtnGS.js +1 -0
  218. package/web-shell/assets/{chunk-2J33WTMH-Dsdai7Tk.js → chunk-2J33WTMH-Dad9g3ZA.js} +1 -1
  219. package/web-shell/assets/{chunk-4BX2VUAB-DEosOjV7.js → chunk-4BX2VUAB-IJJSSdDs.js} +1 -1
  220. package/web-shell/assets/{chunk-55IACEB6-sNsRLTXf.js → chunk-55IACEB6-DRcc-Hl9.js} +1 -1
  221. package/web-shell/assets/{chunk-727SXJPM-DkRNZzmh.js → chunk-727SXJPM-DOCFB-6a.js} +1 -1
  222. package/web-shell/assets/{chunk-AQP2D5EJ-BrsRNpzd.js → chunk-AQP2D5EJ-CRZnSjHp.js} +1 -1
  223. package/web-shell/assets/{chunk-FMBD7UC4-CI039lpl.js → chunk-FMBD7UC4-BwUI4Yes.js} +1 -1
  224. package/web-shell/assets/{chunk-ND2GUHAM-M-pkeIfu.js → chunk-ND2GUHAM-DLy8doxd.js} +1 -1
  225. package/web-shell/assets/{chunk-QZHKN3VN-C4ckGNbH.js → chunk-QZHKN3VN-Bhz7iysj.js} +1 -1
  226. package/web-shell/assets/classDiagram-4FO5ZUOK-DBdPU8ix.js +1 -0
  227. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-DBdPU8ix.js +1 -0
  228. package/web-shell/assets/{cose-bilkent-S5V4N54A-BciKUAFq.js → cose-bilkent-S5V4N54A-jT1e8KzN.js} +1 -1
  229. package/web-shell/assets/{dagre-BM42HDAG-C1nTSgU6.js → dagre-BM42HDAG-C1veApQk.js} +1 -1
  230. package/web-shell/assets/{diagram-2AECGRRQ-BDPNWr1m.js → diagram-2AECGRRQ-C_NOwKeT.js} +1 -1
  231. package/web-shell/assets/{diagram-5GNKFQAL-CNFhTszL.js → diagram-5GNKFQAL-Bigfuz1r.js} +1 -1
  232. package/web-shell/assets/{diagram-KO2AKTUF-CjPa4p5a.js → diagram-KO2AKTUF-CpXltPpU.js} +1 -1
  233. package/web-shell/assets/{diagram-LMA3HP47-ZzPykSyG.js → diagram-LMA3HP47-DYawbYbH.js} +1 -1
  234. package/web-shell/assets/{diagram-OG6HWLK6-0UVtZ9A4.js → diagram-OG6HWLK6-D2t-ttd1.js} +1 -1
  235. package/web-shell/assets/{erDiagram-TEJ5UH35-CajDZCat.js → erDiagram-TEJ5UH35-Buc53PB5.js} +1 -1
  236. package/web-shell/assets/{flowDiagram-I6XJVG4X-BRuFBIvL.js → flowDiagram-I6XJVG4X-DwdFsCN7.js} +1 -1
  237. package/web-shell/assets/{ganttDiagram-6RSMTGT7-BevGmJqG.js → ganttDiagram-6RSMTGT7-XhiEKGoP.js} +1 -1
  238. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-DvPMpBMb.js → gitGraphDiagram-PVQCEYII-D6We014a.js} +1 -1
  239. package/web-shell/assets/index-BctAmeF3.js +1143 -0
  240. package/web-shell/assets/{index-DzHwQkQq.js → index-CAWqS-bZ.js} +1 -1
  241. package/web-shell/assets/index-DLyhlZZO.css +5 -0
  242. package/web-shell/assets/{infoDiagram-5YYISTIA-Oixn7tA9.js → infoDiagram-5YYISTIA-C_iugRHQ.js} +1 -1
  243. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-BgKpeg-j.js → ishikawaDiagram-YF4QCWOH-CAn9Kaix.js} +1 -1
  244. package/web-shell/assets/{journeyDiagram-JHISSGLW-74mwxIaA.js → journeyDiagram-JHISSGLW-BjDYOkEB.js} +1 -1
  245. package/web-shell/assets/{kanban-definition-UN3LZRKU-D4D6cEqA.js → kanban-definition-UN3LZRKU-Br_oI3Ob.js} +1 -1
  246. package/web-shell/assets/{linear-atZRE_L2.js → linear-BqnWHE9E.js} +1 -1
  247. package/web-shell/assets/{mermaid.core-KKudX-JC.js → mermaid.core-CT-sofSb.js} +5 -5
  248. package/web-shell/assets/{mindmap-definition-RKZ34NQL-CMCej9yG.js → mindmap-definition-RKZ34NQL-BbvrZR4B.js} +1 -1
  249. package/web-shell/assets/{pieDiagram-4H26LBE5-nhx40X7q.js → pieDiagram-4H26LBE5-gAwi3h_Q.js} +1 -1
  250. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-CUmVcN3M.js → quadrantDiagram-W4KKPZXB-CONvBIuO.js} +1 -1
  251. package/web-shell/assets/{requirementDiagram-4Y6WPE33-C_vyEwyy.js → requirementDiagram-4Y6WPE33-lpkrcy1e.js} +1 -1
  252. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-DU6G4VWR.js → sankeyDiagram-5OEKKPKP-Bk6FJHqb.js} +1 -1
  253. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-DdeRR_KJ.js → sequenceDiagram-3UESZ5HK-B9b9bBzt.js} +1 -1
  254. package/web-shell/assets/{stateDiagram-AJRCARHV-C6iCI8ps.js → stateDiagram-AJRCARHV-JqBGC-S3.js} +1 -1
  255. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-B_w4fDnm.js +1 -0
  256. package/web-shell/assets/{timeline-definition-PNZ67QCA-B_Ea8Cb7.js → timeline-definition-PNZ67QCA-CCCceXDP.js} +1 -1
  257. package/web-shell/assets/{vennDiagram-CIIHVFJN-BPUVZEJA.js → vennDiagram-CIIHVFJN-EHRnmZ09.js} +1 -1
  258. package/web-shell/assets/{wardley-L42UT6IY-BWEj0lKY.js → wardley-L42UT6IY-CYIcHx3_.js} +1 -1
  259. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-BvDsdIQw.js → wardleyDiagram-YWT4CUSO-B81AuYRl.js} +1 -1
  260. package/web-shell/assets/{xychartDiagram-2RQKCTM6-crz0QhF_.js → xychartDiagram-2RQKCTM6-DOQ6E3z7.js} +1 -1
  261. package/web-shell/index.html +2 -2
  262. package/chunks/channel-worker-group-K7QKH6IG.js +0 -13
  263. package/chunks/chunk-B7NUUEXC.js +0 -311
  264. package/chunks/chunk-CARU2RR2.js +0 -24
  265. package/chunks/chunk-GYTKQYDB.js +0 -23
  266. package/chunks/chunk-LQU7EVFA.js +0 -30
  267. package/chunks/chunk-OCPBI7J5.js +0 -18
  268. package/chunks/chunk-OJAMDVF5.js +0 -66
  269. package/chunks/chunk-TEGEBB2I.js +0 -122
  270. package/web-shell/assets/channel-DkuJJ0qd.js +0 -1
  271. package/web-shell/assets/classDiagram-4FO5ZUOK-CwqHc0TB.js +0 -1
  272. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CwqHc0TB.js +0 -1
  273. package/web-shell/assets/index-Cnvv4VcI.css +0 -5
  274. package/web-shell/assets/index-D1Uyklxa.js +0 -1088
  275. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-C0_6nR6C.js +0 -1
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  classifyApiError,
5
5
  prefixMidTurnUserMessageParts
6
- } from "./chunk-WIASPMLX.js";
6
+ } from "./chunk-AH3YAJU6.js";
7
7
  import {
8
8
  EXTENSION_CONTEXT_BUDGET,
9
9
  buildExtensionMentionContext,
@@ -12,83 +12,96 @@ import {
12
12
  matchMcpServerByRef,
13
13
  parseExtensionRef,
14
14
  parseMcpServerRef
15
- } from "./chunk-X362TMXZ.js";
15
+ } from "./chunk-XQDPCQ3A.js";
16
16
  import {
17
17
  getAvailableCommands,
18
18
  handleSlashCommand,
19
19
  insertAfterFunctionResponses,
20
20
  isSlashCommand,
21
21
  normalizePartList
22
- } from "./chunk-YX4LLZ3D.js";
22
+ } from "./chunk-NABT4VOY.js";
23
+ import {
24
+ collectContextData,
25
+ formatContextUsageText
26
+ } from "./chunk-46Y6SSQ7.js";
27
+ import {
28
+ recomputeMcpGating
29
+ } from "./chunk-FXK3QMRD.js";
23
30
  import {
24
31
  appEvents,
25
32
  buildDisabledSkillNamesProvider,
26
33
  loadCliConfig,
27
34
  normalizeDisabledToolList
28
- } from "./chunk-CEW4HDPK.js";
35
+ } from "./chunk-ZK4AMPKI.js";
29
36
  import {
30
37
  getCommandSubcommandNames
31
- } from "./chunk-XXJKGHZV.js";
32
- import "./chunk-422XAKCK.js";
38
+ } from "./chunk-6VMOP2Z7.js";
39
+ import "./chunk-G5ZKRK2E.js";
33
40
  import {
34
41
  getEffectiveSupportedModes
35
- } from "./chunk-DK33QJ3V.js";
36
- import "./chunk-K4PZ5F5T.js";
37
- import "./chunk-5DTTYNB7.js";
38
- import {
39
- collectContextData,
40
- formatContextUsageText
41
- } from "./chunk-B5I2IIWY.js";
42
+ } from "./chunk-GCRFH57X.js";
42
43
  import "./chunk-4WGODMVR.js";
44
+ import "./chunk-KW7NOTN6.js";
45
+ import "./chunk-OWT2CAEQ.js";
46
+ import "./chunk-5DTTYNB7.js";
43
47
  import "./chunk-NHDKSOEY.js";
44
48
  import {
45
49
  isTerminalGoalStatusKind
46
50
  } from "./chunk-7X7TEQNX.js";
47
51
  import "./chunk-HTHUX2T5.js";
48
- import "./chunk-EQY6POVO.js";
49
- import "./chunk-7L4XBYVW.js";
52
+ import "./chunk-GLEJW7T2.js";
53
+ import "./chunk-XK42MWWO.js";
50
54
  import "./chunk-YAF2MQZ6.js";
51
55
  import "./chunk-Q6TUALBE.js";
52
- import "./chunk-KW7NOTN6.js";
53
56
  import {
57
+ GENERATION_MAX_PROMPT_BYTES,
58
+ GENERATION_TIMEOUT_MS,
54
59
  MAX_REMEMBER_CONTENT_BYTES,
60
+ REDACTED_MCP_SECRET,
55
61
  collectHistoryReplayUpdates,
56
62
  copyCumulativeUsage,
57
63
  createReplayCumulativeUsage,
58
64
  createWorkspaceMemoryExtractionErrorLogger,
65
+ executeGeneration,
59
66
  formatWorkspaceMemoryForgetSummary,
60
67
  isValidServerName,
68
+ redactMcpServerSecrets,
61
69
  replayTranscriptRecordPage,
70
+ restoreRedactedMcpSecrets,
62
71
  shouldSuppressRememberErrorDetails,
63
72
  workspaceMemoryFailureCode,
64
73
  workspaceMemoryFailureDiagnostics
65
- } from "./chunk-6W6DI34P.js";
74
+ } from "./chunk-SE6GSFAO.js";
66
75
  import {
67
76
  HistoryReplayer,
68
77
  MessageEmitter,
69
78
  PlanEmitter,
70
79
  ToolCallEmitter
71
- } from "./chunk-4FMG7EDJ.js";
72
- import "./chunk-SPUYQB4T.js";
73
- import "./chunk-WTSXKLG5.js";
80
+ } from "./chunk-AEKHQ3E5.js";
81
+ import "./chunk-DPXB3XRN.js";
82
+ import "./chunk-SUARMD4Q.js";
74
83
  import "./chunk-QHTIBUWB.js";
75
84
  import "./chunk-L573Z2QZ.js";
76
85
  import {
77
86
  computeCpuPercent
78
87
  } from "./chunk-HGT6JR3U.js";
79
88
  import "./chunk-RXFQM6FQ.js";
80
- import "./chunk-WDW64OW3.js";
89
+ import "./chunk-PSDTLRAV.js";
81
90
  import "./chunk-6H67XLET.js";
82
- import "./chunk-L62SEJWY.js";
83
- import "./chunk-65N2J6V2.js";
84
- import "./chunk-WDWJ4OQJ.js";
91
+ import "./chunk-6RV42SFP.js";
92
+ import "./chunk-6ANLV27M.js";
93
+ import "./chunk-LXXMOYPL.js";
94
+ import "./chunk-CC2UASQ4.js";
85
95
  import "./chunk-E5Z2AVNV.js";
86
96
  import {
87
- formatAcpModelId,
97
+ ACP_ROUTE_ID_PREFIX,
98
+ buildAcpModelOptions,
99
+ getCurrentAcpModelId,
88
100
  parseAcpBaseModelId,
89
101
  parseAcpModelOption,
102
+ resolveAcpModelOption,
90
103
  sanitizeProviderBaseUrl
91
- } from "./chunk-GGJII3FM.js";
104
+ } from "./chunk-WZJELXEU.js";
92
105
  import {
93
106
  mapSkillConfigToStatus
94
107
  } from "./chunk-2W3OOD4W.js";
@@ -98,16 +111,19 @@ import {
98
111
  buildPermissionSettings,
99
112
  normalizePermissionRules,
100
113
  readPermissionRuleSet
101
- } from "./chunk-N6FXRR6P.js";
114
+ } from "./chunk-7ZFXHKKZ.js";
102
115
  import {
103
116
  MAX_AUDIO_BYTES,
104
117
  sanitizeVoiceErrorMessage,
105
118
  transcribeVoiceAudio
106
- } from "./chunk-FXMC7SL2.js";
119
+ } from "./chunk-I6NOSIVF.js";
107
120
  import {
108
121
  readVoiceModel
109
- } from "./chunk-DPFBNG72.js";
122
+ } from "./chunk-4UBEB74N.js";
110
123
  import "./chunk-FSA7ERJ2.js";
124
+ import {
125
+ parseSessionSource
126
+ } from "./chunk-YOJGIRTD.js";
111
127
  import {
112
128
  CLIENT_MCP_OVER_WS_CONFIG_FLAG,
113
129
  LOAD_REPLAY_BULK_MODE,
@@ -120,19 +136,19 @@ import "./chunk-6RLROE6G.js";
120
136
  import "./chunk-COH43MRJ.js";
121
137
  import {
122
138
  NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE
123
- } from "./chunk-KSO42X3Z.js";
124
- import "./chunk-Q5GLXH5Q.js";
125
- import "./chunk-AAR5SGMD.js";
139
+ } from "./chunk-X6YQWCIJ.js";
140
+ import "./chunk-UJG4VV2O.js";
141
+ import "./chunk-4YR7FSAM.js";
126
142
  import "./chunk-57OAHC2Y.js";
127
- import "./chunk-OATTJGPJ.js";
128
- import "./chunk-ZRKBI3DP.js";
143
+ import "./chunk-5CNYZ7TN.js";
144
+ import "./chunk-FNX3LGAK.js";
129
145
  import "./chunk-V6WHFGST.js";
130
146
  import {
131
147
  createLoadedSettingsAdapter
132
- } from "./chunk-W34A5MJH.js";
148
+ } from "./chunk-NROLDLP4.js";
133
149
  import {
134
150
  ndJsonStream
135
- } from "./chunk-TEGEBB2I.js";
151
+ } from "./chunk-VHCSIMTF.js";
136
152
  import {
137
153
  ACP_PREFLIGHT_KINDS,
138
154
  IDLE_HOOK_EVENTS,
@@ -140,21 +156,23 @@ import {
140
156
  SERVE_STATUS_EXT_METHODS,
141
157
  STATUS_SCHEMA_VERSION,
142
158
  mapDomainErrorToErrorKind
143
- } from "./chunk-CUUXANEQ.js";
159
+ } from "./chunk-W6J7RSCK.js";
144
160
  import "./chunk-W7FJ3N32.js";
145
- import "./chunk-GYTKQYDB.js";
161
+ import "./chunk-KSZKSE23.js";
146
162
  import "./chunk-TJTKSVIV.js";
147
163
  import "./chunk-M5GB774H.js";
148
- import "./chunk-OJAMDVF5.js";
149
164
  import "./chunk-LXLTBIDP.js";
150
- import "./chunk-BBNVFRGD.js";
151
- import "./chunk-SXU3KKNI.js";
165
+ import "./chunk-3DWIFU7L.js";
166
+ import "./chunk-ZQIYGQCG.js";
152
167
  import {
153
168
  AgentSideConnection,
154
169
  PROTOCOL_VERSION,
155
170
  RequestError
156
171
  } from "./chunk-UDXSXLER.js";
157
- import "./chunk-YYPXHMWO.js";
172
+ import {
173
+ assembleMcpServers,
174
+ loadMcpApprovals
175
+ } from "./chunk-FEYHXPZG.js";
158
176
  import {
159
177
  OUTPUT_LANGUAGE_AUTO,
160
178
  getOutputLanguageFilePath,
@@ -165,18 +183,18 @@ import {
165
183
  resolveOutputLanguage,
166
184
  updateOutputLanguageFile,
167
185
  writeOutputLanguageAndRegisterPath
168
- } from "./chunk-6GETGQWP.js";
186
+ } from "./chunk-5WWYHNAH.js";
169
187
  import "./chunk-RKUWKYED.js";
170
188
  import {
171
189
  SUPPORTED_LANGUAGES,
172
190
  getCurrentLanguage,
173
191
  setLanguageAsync
174
- } from "./chunk-RDRVMDWV.js";
192
+ } from "./chunk-EMJJBXS7.js";
175
193
  import {
176
194
  findEnvFiles,
177
195
  preResolveHomeEnvOverrides,
178
196
  reloadEnvironment
179
- } from "./chunk-5EBKKSBX.js";
197
+ } from "./chunk-JY74T7PW.js";
180
198
  import "./chunk-GOXKNSDZ.js";
181
199
  import {
182
200
  getSystemDefaultsPath,
@@ -187,14 +205,14 @@ import {
187
205
  isFolderTrustEnabled,
188
206
  isWorkspaceTrusted,
189
207
  loadTrustedFolders
190
- } from "./chunk-4YWLED2A.js";
208
+ } from "./chunk-PNCWEDF6.js";
191
209
  import "./chunk-ALGGS7UH.js";
192
210
  import "./chunk-MR3PXB6E.js";
193
211
  import {
194
212
  writeStderrLine
195
213
  } from "./chunk-YUZI3WAC.js";
196
214
  import "./chunk-XFSFZCM5.js";
197
- import "./chunk-YU56QGXX.js";
215
+ import "./chunk-Y3TNSHKF.js";
198
216
  import "./chunk-VJNBRRZG.js";
199
217
  import {
200
218
  ALL_PROVIDERS,
@@ -238,6 +256,7 @@ import {
238
256
  clampInlineMediaPart,
239
257
  clearGoalTerminalObserver,
240
258
  computeUniqueBranchTitle,
259
+ convertToFunctionErrorResponse,
241
260
  convertToFunctionResponse,
242
261
  createDuplicateProviderToolCallResponse,
243
262
  dedupeToolCallsById,
@@ -269,18 +288,18 @@ import {
269
288
  getProviderToolCallId,
270
289
  getScopedEnvContents,
271
290
  getStartupContextLength,
272
- hasImageParts,
273
291
  ideContextStore,
274
292
  injectPermissionRulesIfMissing,
275
293
  isApproveOutcome,
276
294
  isDenialFallbackReason,
295
+ isGatedMcpScope,
277
296
  isPlanModeBlocked,
278
297
  isSystemReminderContent,
279
298
  markDuplicateProviderToolCallResponseSent,
280
299
  matchesAnyServerPattern,
300
+ mcpServerRequiresOAuth,
281
301
  needsConfirmation,
282
302
  normalizeEventPayload,
283
- normalizeParts,
284
303
  normalizeSnapshotPayload,
285
304
  parsePositiveIntegerEnv,
286
305
  persistPermissionOutcome,
@@ -295,7 +314,6 @@ import {
295
314
  runForkedAgent,
296
315
  runManagedAutoMemoryDream,
297
316
  runManagedRememberByAgent,
298
- runVisionBridge,
299
317
  sessionIdContext,
300
318
  setGoalTerminalObserver,
301
319
  shouldClassifyAllShellForAutoMode,
@@ -303,24 +321,20 @@ import {
303
321
  shouldFirePermissionDeniedForAutoMode,
304
322
  shouldForceAutoModeReviewForAllow,
305
323
  shouldRunAutoModeForCall,
306
- shouldRunVisionBridge,
307
- splitImageParts,
308
324
  subagentGenerator,
309
325
  unregisterGoalHook,
310
326
  updateSetting
311
- } from "./chunk-K7CRWKOE.js";
327
+ } from "./chunk-R6AO7HBQ.js";
328
+ import "./chunk-T4TZQJ7W.js";
312
329
  import {
313
330
  external_exports
314
331
  } from "./chunk-H6XPXXMH.js";
315
332
  import "./chunk-5M6IDOMF.js";
316
- import "./chunk-E67NFMF4.js";
333
+ import "./chunk-A2HWMJVO.js";
317
334
  import "./chunk-RCEEXIOO.js";
318
335
  import "./chunk-KKRTYONM.js";
319
336
  import "./chunk-TV6K2FB4.js";
320
337
  import "./chunk-E2UVIFI2.js";
321
- import {
322
- runSideQuery
323
- } from "./chunk-6OATMEYN.js";
324
338
  import "./chunk-XU457J4V.js";
325
339
  import "./chunk-VDDGDZMA.js";
326
340
  import "./chunk-SPJQO2CE.js";
@@ -330,7 +344,7 @@ import "./chunk-CPBF7KYF.js";
330
344
  import {
331
345
  APPROVAL_MODES,
332
346
  FORK_SUBAGENT_TYPE
333
- } from "./chunk-TXY2C3D2.js";
347
+ } from "./chunk-F333XEAU.js";
334
348
  import "./chunk-6AM5D4ME.js";
335
349
  import "./chunk-2Z5UX4KI.js";
336
350
  import {
@@ -349,35 +363,45 @@ import {
349
363
  endToolExecutionSpan,
350
364
  endToolSpan,
351
365
  extractDaemonTraceContext,
366
+ formatVisionBridgeNotice,
352
367
  getAllGeminiMdFilenames,
353
368
  getMCPServerStatus,
369
+ hasImageParts,
354
370
  logConversationFinishedEvent,
355
371
  logLoopDetected,
356
372
  logPromptSuggestion,
357
373
  logToolCall,
358
374
  logUserPrompt,
375
+ normalizeParts,
359
376
  registerAcpEventLoopLagGauge,
360
377
  runInToolSpanContext,
378
+ runVisionBridge,
379
+ shouldRunVisionBridge,
380
+ splitImageParts,
361
381
  startEventLoopLagMonitor,
362
382
  startToolExecutionSpan,
363
383
  startToolSpan,
364
384
  uiTelemetryService,
385
+ withDaemonSpan,
365
386
  withInteractionSpan
366
- } from "./chunk-P6LART6G.js";
387
+ } from "./chunk-BTSE2DUP.js";
367
388
  import "./chunk-4WKAA4KS.js";
368
389
  import "./chunk-CR3C7WXL.js";
369
- import "./chunk-CARU2RR2.js";
390
+ import {
391
+ runSideQuery
392
+ } from "./chunk-RTV5TUYB.js";
370
393
  import "./chunk-VGC4I5JJ.js";
371
394
  import {
372
395
  getAutoMemoryRoot,
373
396
  getUserAutoMemoryRoot
374
397
  } from "./chunk-FBU7WRZI.js";
375
398
  import "./chunk-Y66VOBRP.js";
376
- import "./chunk-WX6SD4IQ.js";
399
+ import "./chunk-WTNZ6DXB.js";
377
400
  import {
378
401
  ToolConfirmationOutcome,
379
- ToolNames
380
- } from "./chunk-2UUAIFQO.js";
402
+ ToolNames,
403
+ isShellProgressData
404
+ } from "./chunk-JGUT3LWZ.js";
381
405
  import {
382
406
  clearCachedCredentialFile,
383
407
  qwenOAuth2Events
@@ -386,11 +410,12 @@ import "./chunk-ZPAHLFZU.js";
386
410
  import "./chunk-JESCGQM3.js";
387
411
  import "./chunk-WIEO4CWB.js";
388
412
  import "./chunk-XVNQMZ2I.js";
413
+ import "./chunk-FEOZBUMT.js";
389
414
  import {
390
415
  DEFAULT_TOKEN_LIMIT,
416
+ getToolCallPreparations,
391
417
  tokenLimit
392
- } from "./chunk-B7NUUEXC.js";
393
- import "./chunk-TQBODCFD.js";
418
+ } from "./chunk-VRR65QYW.js";
394
419
  import "./chunk-A4UCTEB5.js";
395
420
  import "./chunk-XWRJCPHC.js";
396
421
  import "./chunk-4LD5APFL.js";
@@ -405,10 +430,10 @@ import {
405
430
  getErrorStatus,
406
431
  isSubpath
407
432
  } from "./chunk-7NFB7LBQ.js";
408
- import "./chunk-XLIRF7IK.js";
433
+ import "./chunk-E7ECGLZW.js";
409
434
  import {
410
435
  runExitCleanup
411
- } from "./chunk-TISZXPAX.js";
436
+ } from "./chunk-L263ROM6.js";
412
437
  import "./chunk-75DOP5OR.js";
413
438
  import "./chunk-DMTGGOSA.js";
414
439
  import "./chunk-YQ3U5MUC.js";
@@ -423,6 +448,7 @@ import {
423
448
  // packages/cli/src/acp-integration/acpAgent.ts
424
449
  init_esbuild_shims();
425
450
  import { randomUUID } from "node:crypto";
451
+ import { performance } from "node:perf_hooks";
426
452
 
427
453
  // packages/cli/src/acp-integration/authMethods.ts
428
454
  init_esbuild_shims();
@@ -802,6 +828,79 @@ import { Buffer as Buffer2 } from "node:buffer";
802
828
  import * as os2 from "node:os";
803
829
  import * as path3 from "node:path";
804
830
 
831
+ // packages/cli/src/acp-integration/session/tool-call-preparation-tracker.ts
832
+ init_esbuild_shims();
833
+ var ToolCallPreparationTracker = class {
834
+ constructor(emitter) {
835
+ this.emitter = emitter;
836
+ }
837
+ static {
838
+ __name(this, "ToolCallPreparationTracker");
839
+ }
840
+ /** Contains only calls whose start frame was emitted successfully. */
841
+ pending = /* @__PURE__ */ new Map();
842
+ /** Contains calls whose start frame was intentionally suppressed. */
843
+ suppressed = /* @__PURE__ */ new Set();
844
+ /** Calls parsed completely but not yet handed to tool execution. */
845
+ resolved = /* @__PURE__ */ new Set();
846
+ /**
847
+ * Emits at most one preparing frame per call ID before the full call arrives.
848
+ */
849
+ async observe(response) {
850
+ for (const preparation of getToolCallPreparations(response)) {
851
+ if (this.pending.has(preparation.callId) || this.suppressed.has(preparation.callId)) {
852
+ continue;
853
+ }
854
+ const emitted = await this.emitter.emitStart({
855
+ callId: preparation.callId,
856
+ toolName: preparation.toolName,
857
+ args: {},
858
+ status: "pending",
859
+ phase: "preparing"
860
+ });
861
+ if (emitted) {
862
+ this.pending.set(preparation.callId, preparation.toolName);
863
+ } else {
864
+ this.suppressed.add(preparation.callId);
865
+ }
866
+ }
867
+ }
868
+ /** Resolves preparations once their complete function calls arrive. */
869
+ resolve(functionCalls) {
870
+ for (const functionCall of functionCalls) {
871
+ if (functionCall.id && this.pending.has(functionCall.id)) {
872
+ this.resolved.add(functionCall.id);
873
+ }
874
+ }
875
+ }
876
+ /**
877
+ * Terminates unresolved preparations. The map is cleared first so repeated
878
+ * cleanup, including re-entry after an emission failure, cannot emit twice.
879
+ */
880
+ async discard(includeResolved = false) {
881
+ const pending = [...this.pending.entries()];
882
+ this.pending.clear();
883
+ const resolved = new Set(this.resolved);
884
+ this.resolved.clear();
885
+ let firstError;
886
+ let hasError = false;
887
+ for (const [callId, toolName] of pending) {
888
+ if (!includeResolved && resolved.has(callId)) continue;
889
+ try {
890
+ await this.emitter.emitPreparationDiscarded(callId, toolName);
891
+ } catch (error) {
892
+ if (!hasError) {
893
+ firstError = error;
894
+ hasError = true;
895
+ }
896
+ }
897
+ }
898
+ if (hasError) {
899
+ throw firstError;
900
+ }
901
+ }
902
+ };
903
+
805
904
  // packages/cli/src/acp-integration/session/SubAgentTracker.ts
806
905
  init_esbuild_shims();
807
906
 
@@ -1512,6 +1611,17 @@ var debugLogger6 = createDebugLogger("SESSION");
1512
1611
  var USER_CANCEL_ABORT_REASON = "qwen:user-cancel";
1513
1612
  var DAEMON_RETRY_META_KEY = "qwen.daemon.retry";
1514
1613
  var DAEMON_CONTINUE_META_KEY = "qwen.daemon.continueLastTurn";
1614
+ async function finalizeToolCallPreparations(tracker, includeResolved, streamName) {
1615
+ try {
1616
+ await tracker.discard(includeResolved);
1617
+ } catch (error) {
1618
+ const message = error instanceof Error ? error.message : String(error);
1619
+ debugLogger6.warn(
1620
+ `Failed to discard tool preparations for ${streamName}; continuing stream: ${message}`
1621
+ );
1622
+ }
1623
+ }
1624
+ __name(finalizeToolCallPreparations, "finalizeToolCallPreparations");
1515
1625
  function maskApiKeyForDisplay(apiKey) {
1516
1626
  const trimmed = apiKey?.trim() ?? "";
1517
1627
  if (trimmed.length === 0) return "(not set)";
@@ -2676,6 +2786,9 @@ ${this.pendingWorktreeNotice}
2676
2786
  return { stopReason: "cancelled" };
2677
2787
  }
2678
2788
  const functionCalls = [];
2789
+ const preparationTracker = new ToolCallPreparationTracker(
2790
+ this.toolCallEmitter
2791
+ );
2679
2792
  let usageMetadata = null;
2680
2793
  const streamStartTime = Date.now();
2681
2794
  const messageDisplay = this.#createMessageDisplayDispatcher(
@@ -2696,35 +2809,56 @@ ${this.pendingWorktreeNotice}
2696
2809
  }
2697
2810
  const responseStream = sendResult.responseStream;
2698
2811
  nextMessage = null;
2699
- for await (const resp of responseStream) {
2700
- if (pendingSend.signal.aborted) {
2701
- return { stopReason: "cancelled" };
2702
- }
2703
- if (resp.type === "chunk" /* CHUNK */ && resp.value.candidates && resp.value.candidates.length > 0) {
2704
- const candidate = resp.value.candidates[0];
2705
- for (const part of candidate.content?.parts ?? []) {
2706
- if (!part.text) {
2707
- continue;
2812
+ let streamFailed = false;
2813
+ try {
2814
+ for await (const resp of responseStream) {
2815
+ if (pendingSend.signal.aborted) {
2816
+ return { stopReason: "cancelled" };
2817
+ }
2818
+ if (resp.type === "chunk" /* CHUNK */ && resp.value.candidates && resp.value.candidates.length > 0) {
2819
+ const candidate = resp.value.candidates[0];
2820
+ for (const part of candidate.content?.parts ?? []) {
2821
+ if (!part.text) {
2822
+ continue;
2823
+ }
2824
+ this.messageEmitter.emitMessage(
2825
+ part.text,
2826
+ "assistant",
2827
+ part.thought
2828
+ );
2829
+ if (!part.thought) {
2830
+ messageDisplay?.addChunk(part.text);
2831
+ }
2708
2832
  }
2709
- this.messageEmitter.emitMessage(
2710
- part.text,
2711
- "assistant",
2712
- part.thought
2713
- );
2714
- if (!part.thought) {
2715
- messageDisplay?.addChunk(part.text);
2833
+ }
2834
+ if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
2835
+ usageMetadata = resp.value.usageMetadata;
2836
+ }
2837
+ if (resp.type === "chunk" /* CHUNK */) {
2838
+ await preparationTracker.observe(resp.value);
2839
+ if (resp.value.functionCalls) {
2840
+ preparationTracker.resolve(resp.value.functionCalls);
2841
+ functionCalls.push(...resp.value.functionCalls);
2716
2842
  }
2717
2843
  }
2844
+ if (resp.type === "retry" /* RETRY */ || resp.type === "model_fallback" /* MODEL_FALLBACK */) {
2845
+ await finalizeToolCallPreparations(
2846
+ preparationTracker,
2847
+ true,
2848
+ `main prompt ${resp.type}`
2849
+ );
2850
+ functionCalls.length = 0;
2851
+ }
2718
2852
  }
2719
- if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
2720
- usageMetadata = resp.value.usageMetadata;
2721
- }
2722
- if (resp.type === "chunk" /* CHUNK */ && resp.value.functionCalls) {
2723
- functionCalls.push(...resp.value.functionCalls);
2724
- }
2725
- if (resp.type === "model_fallback" /* MODEL_FALLBACK */) {
2726
- functionCalls.length = 0;
2727
- }
2853
+ } catch (error) {
2854
+ streamFailed = true;
2855
+ throw error;
2856
+ } finally {
2857
+ await finalizeToolCallPreparations(
2858
+ preparationTracker,
2859
+ streamFailed || pendingSend.signal.aborted,
2860
+ "main prompt"
2861
+ );
2728
2862
  }
2729
2863
  } catch (error) {
2730
2864
  if (strippedOrphanEntries && (this.#getCurrentChat().getUserContentPushCount?.() ?? 0) <= orphanPushCountSnapshot) {
@@ -2904,6 +3038,9 @@ ${this.pendingWorktreeNotice}
2904
3038
  return { stopReason: "cancelled" };
2905
3039
  }
2906
3040
  const functionCalls = [];
3041
+ const preparationTracker = new ToolCallPreparationTracker(
3042
+ this.toolCallEmitter
3043
+ );
2907
3044
  let usageMetadata = null;
2908
3045
  const streamStartTime = Date.now();
2909
3046
  const messageDisplay = this.#createMessageDisplayDispatcher(
@@ -2925,33 +3062,54 @@ ${this.pendingWorktreeNotice}
2925
3062
  }
2926
3063
  const continueResponseStream = continueSendResult.responseStream;
2927
3064
  nextMessage = null;
2928
- for await (const resp of continueResponseStream) {
2929
- if (pendingSend.signal.aborted) {
2930
- return { stopReason: "cancelled" };
2931
- }
2932
- if (resp.type === "chunk" /* CHUNK */ && resp.value.candidates && resp.value.candidates.length > 0) {
2933
- const candidate = resp.value.candidates[0];
2934
- for (const part of candidate.content?.parts ?? []) {
2935
- if (!part.text) continue;
2936
- this.messageEmitter.emitMessage(
2937
- part.text,
2938
- "assistant",
2939
- part.thought
2940
- );
2941
- if (!part.thought) {
2942
- messageDisplay?.addChunk(part.text);
3065
+ let streamFailed = false;
3066
+ try {
3067
+ for await (const resp of continueResponseStream) {
3068
+ if (pendingSend.signal.aborted) {
3069
+ return { stopReason: "cancelled" };
3070
+ }
3071
+ if (resp.type === "chunk" /* CHUNK */ && resp.value.candidates && resp.value.candidates.length > 0) {
3072
+ const candidate = resp.value.candidates[0];
3073
+ for (const part of candidate.content?.parts ?? []) {
3074
+ if (!part.text) continue;
3075
+ this.messageEmitter.emitMessage(
3076
+ part.text,
3077
+ "assistant",
3078
+ part.thought
3079
+ );
3080
+ if (!part.thought) {
3081
+ messageDisplay?.addChunk(part.text);
3082
+ }
2943
3083
  }
2944
3084
  }
3085
+ if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
3086
+ usageMetadata = resp.value.usageMetadata;
3087
+ }
3088
+ if (resp.type === "chunk" /* CHUNK */) {
3089
+ await preparationTracker.observe(resp.value);
3090
+ if (resp.value.functionCalls) {
3091
+ preparationTracker.resolve(resp.value.functionCalls);
3092
+ functionCalls.push(...resp.value.functionCalls);
3093
+ }
3094
+ }
3095
+ if (resp.type === "retry" /* RETRY */ || resp.type === "model_fallback" /* MODEL_FALLBACK */) {
3096
+ await finalizeToolCallPreparations(
3097
+ preparationTracker,
3098
+ true,
3099
+ `Stop Hook continuation ${resp.type}`
3100
+ );
3101
+ functionCalls.length = 0;
3102
+ }
2945
3103
  }
2946
- if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
2947
- usageMetadata = resp.value.usageMetadata;
2948
- }
2949
- if (resp.type === "chunk" /* CHUNK */ && resp.value.functionCalls) {
2950
- functionCalls.push(...resp.value.functionCalls);
2951
- }
2952
- if (resp.type === "model_fallback" /* MODEL_FALLBACK */) {
2953
- functionCalls.length = 0;
2954
- }
3104
+ } catch (error) {
3105
+ streamFailed = true;
3106
+ throw error;
3107
+ } finally {
3108
+ await finalizeToolCallPreparations(
3109
+ preparationTracker,
3110
+ streamFailed || pendingSend.signal.aborted,
3111
+ "Stop Hook continuation"
3112
+ );
2955
3113
  }
2956
3114
  } catch (error) {
2957
3115
  const errorStatus = getErrorStatus(error);
@@ -3557,6 +3715,9 @@ ${this.pendingWorktreeNotice}
3557
3715
  turnCount++;
3558
3716
  if (ac.signal.aborted) return;
3559
3717
  const functionCalls = [];
3718
+ const preparationTracker = new ToolCallPreparationTracker(
3719
+ this.toolCallEmitter
3720
+ );
3560
3721
  let usageMetadata = null;
3561
3722
  const streamStartTime = Date.now();
3562
3723
  const sendResult = await this.#sendMessageStreamWithAutoCompression(
@@ -3582,6 +3743,7 @@ ${this.pendingWorktreeNotice}
3582
3743
  const messageDisplay = this.#createMessageDisplayDispatcher(
3583
3744
  ac.signal
3584
3745
  );
3746
+ let streamFailed = false;
3585
3747
  try {
3586
3748
  for await (const resp of responseStream) {
3587
3749
  if (ac.signal.aborted) return;
@@ -3602,15 +3764,35 @@ ${this.pendingWorktreeNotice}
3602
3764
  if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
3603
3765
  usageMetadata = resp.value.usageMetadata;
3604
3766
  }
3605
- if (resp.type === "chunk" /* CHUNK */ && resp.value.functionCalls) {
3606
- functionCalls.push(...resp.value.functionCalls);
3767
+ if (resp.type === "chunk" /* CHUNK */) {
3768
+ await preparationTracker.observe(resp.value);
3769
+ if (resp.value.functionCalls) {
3770
+ preparationTracker.resolve(resp.value.functionCalls);
3771
+ functionCalls.push(...resp.value.functionCalls);
3772
+ }
3607
3773
  }
3608
- if (resp.type === "model_fallback" /* MODEL_FALLBACK */) {
3774
+ if (resp.type === "retry" /* RETRY */ || resp.type === "model_fallback" /* MODEL_FALLBACK */) {
3775
+ await finalizeToolCallPreparations(
3776
+ preparationTracker,
3777
+ true,
3778
+ `cron/loop tick ${resp.type}`
3779
+ );
3609
3780
  functionCalls.length = 0;
3610
3781
  }
3611
3782
  }
3783
+ } catch (error) {
3784
+ streamFailed = true;
3785
+ throw error;
3612
3786
  } finally {
3613
- await messageDisplay?.finish();
3787
+ try {
3788
+ await finalizeToolCallPreparations(
3789
+ preparationTracker,
3790
+ streamFailed || ac.signal.aborted,
3791
+ "cron/loop tick"
3792
+ );
3793
+ } finally {
3794
+ await messageDisplay?.finish();
3795
+ }
3614
3796
  }
3615
3797
  if (usageMetadata) {
3616
3798
  this.#recordPromptTokenCount(usageMetadata);
@@ -3808,6 +3990,9 @@ ${this.pendingWorktreeNotice}
3808
3990
  return;
3809
3991
  }
3810
3992
  const functionCalls = [];
3993
+ const preparationTracker = new ToolCallPreparationTracker(
3994
+ this.toolCallEmitter
3995
+ );
3811
3996
  let usageMetadata = null;
3812
3997
  let responseText = "";
3813
3998
  const streamStartTime = Date.now();
@@ -3831,6 +4016,7 @@ ${this.pendingWorktreeNotice}
3831
4016
  const messageDisplay = this.#createMessageDisplayDispatcher(
3832
4017
  ac.signal
3833
4018
  );
4019
+ let streamFailed = false;
3834
4020
  try {
3835
4021
  for await (const resp of responseStream) {
3836
4022
  if (ac.signal.aborted) {
@@ -3856,15 +4042,35 @@ ${this.pendingWorktreeNotice}
3856
4042
  if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
3857
4043
  usageMetadata = resp.value.usageMetadata;
3858
4044
  }
3859
- if (resp.type === "chunk" /* CHUNK */ && resp.value.functionCalls) {
3860
- functionCalls.push(...resp.value.functionCalls);
4045
+ if (resp.type === "chunk" /* CHUNK */) {
4046
+ await preparationTracker.observe(resp.value);
4047
+ if (resp.value.functionCalls) {
4048
+ preparationTracker.resolve(resp.value.functionCalls);
4049
+ functionCalls.push(...resp.value.functionCalls);
4050
+ }
3861
4051
  }
3862
- if (resp.type === "model_fallback" /* MODEL_FALLBACK */) {
4052
+ if (resp.type === "retry" /* RETRY */ || resp.type === "model_fallback" /* MODEL_FALLBACK */) {
4053
+ await finalizeToolCallPreparations(
4054
+ preparationTracker,
4055
+ true,
4056
+ `background notification ${resp.type}`
4057
+ );
3863
4058
  functionCalls.length = 0;
3864
4059
  }
3865
4060
  }
4061
+ } catch (error) {
4062
+ streamFailed = true;
4063
+ throw error;
3866
4064
  } finally {
3867
- await messageDisplay?.finish();
4065
+ try {
4066
+ await finalizeToolCallPreparations(
4067
+ preparationTracker,
4068
+ streamFailed || ac.signal.aborted,
4069
+ "background notification"
4070
+ );
4071
+ } finally {
4072
+ await messageDisplay?.finish();
4073
+ }
3868
4074
  }
3869
4075
  if (responseText.length > 0) {
3870
4076
  await this.#emitBackgroundNotificationResponse(
@@ -4083,7 +4289,17 @@ ${this.pendingWorktreeNotice}
4083
4289
  if (!rawModelId) {
4084
4290
  throw RequestError.invalidParams(void 0, "modelId cannot be empty");
4085
4291
  }
4086
- const parsed = parseAcpModelOption(rawModelId);
4292
+ const resolvedRoute = resolveAcpModelOption(
4293
+ rawModelId,
4294
+ this.config.getAllConfiguredModels()
4295
+ );
4296
+ if (!resolvedRoute && rawModelId.startsWith(ACP_ROUTE_ID_PREFIX)) {
4297
+ throw RequestError.invalidParams(
4298
+ void 0,
4299
+ `Unknown or stale model route: "${rawModelId}"`
4300
+ );
4301
+ }
4302
+ const parsed = resolvedRoute ?? parseAcpModelOption(rawModelId);
4087
4303
  const previousAuthType = this.config.getAuthType?.();
4088
4304
  const selectedAuthType = parsed.authType ?? previousAuthType;
4089
4305
  if (!selectedAuthType) {
@@ -4092,29 +4308,49 @@ ${this.pendingWorktreeNotice}
4092
4308
  `authType cannot be determined for modelId "${parsed.modelId}"`
4093
4309
  );
4094
4310
  }
4311
+ const requireCachedCredentials = selectedAuthType !== previousAuthType && selectedAuthType === "qwen-oauth" /* QWEN_OAUTH */;
4312
+ const switchOptions = resolvedRoute?.baseUrl !== void 0 || requireCachedCredentials ? {
4313
+ ...resolvedRoute?.baseUrl !== void 0 ? { baseUrl: resolvedRoute.baseUrl } : {},
4314
+ ...requireCachedCredentials ? { requireCachedCredentials: true } : {}
4315
+ } : void 0;
4095
4316
  await this.config.switchModel(
4096
4317
  selectedAuthType,
4097
4318
  parsed.modelId,
4098
- selectedAuthType !== previousAuthType && selectedAuthType === "qwen-oauth" /* QWEN_OAUTH */ ? { requireCachedCredentials: true } : void 0
4319
+ switchOptions
4099
4320
  );
4100
4321
  const after = this.config.getContentGeneratorConfig?.();
4101
4322
  const effectiveAuthType = after?.authType ?? selectedAuthType;
4102
4323
  const effectiveModelId = after?.model ?? parsed.modelId;
4324
+ const activeRuntimeSnapshot = this.config.getActiveRuntimeModelSnapshot?.();
4325
+ const currentAcpModelId = getCurrentAcpModelId(
4326
+ buildAcpModelOptions(this.config.getAllConfiguredModels()),
4327
+ activeRuntimeSnapshot?.id ?? effectiveModelId,
4328
+ activeRuntimeSnapshot?.authType ?? effectiveAuthType,
4329
+ activeRuntimeSnapshot ? void 0 : resolvedRoute ? resolvedRoute.registryBaseUrl : this.config.getCurrentModelRegistryBaseUrl?.()
4330
+ );
4103
4331
  void this.client.extNotification("qwen/notify/session/model-update", {
4104
4332
  v: 1,
4105
4333
  sessionId: this.sessionId,
4106
- currentModelId: effectiveModelId
4334
+ currentModelId: currentAcpModelId
4107
4335
  }).catch((error) => {
4108
4336
  debugLogger6.debug("model-update extNotification failed", error);
4109
4337
  });
4110
4338
  if (options.persistDefault ?? true) {
4111
4339
  const persistScope = getPersistScopeForModelSelection(this.settings);
4112
- this.settings.setValue(persistScope, "model.name", parsed.modelId);
4113
- this.settings.setValue(persistScope, "model.baseUrl", "");
4340
+ this.settings.setValue(
4341
+ persistScope,
4342
+ "model.name",
4343
+ resolvedRoute?.isRuntime ? resolvedRoute.modelId : effectiveModelId
4344
+ );
4345
+ this.settings.setValue(
4346
+ persistScope,
4347
+ "model.baseUrl",
4348
+ resolvedRoute && !resolvedRoute.isRuntime ? resolvedRoute.baseUrl ?? "" : ""
4349
+ );
4114
4350
  this.settings.setValue(
4115
4351
  persistScope,
4116
4352
  "security.auth.selectedType",
4117
- selectedAuthType
4353
+ effectiveAuthType
4118
4354
  );
4119
4355
  }
4120
4356
  return {
@@ -4124,7 +4360,7 @@ ${this.pendingWorktreeNotice}
4124
4360
  modelId: effectiveModelId,
4125
4361
  baseUrl: after?.baseUrl ?? "(default)",
4126
4362
  apiKey: maskApiKeyForDisplay(after?.apiKey),
4127
- isRuntime: rawModelId.startsWith("$runtime|")
4363
+ isRuntime: resolvedRoute?.isRuntime ?? rawModelId.startsWith("$runtime|")
4128
4364
  }
4129
4365
  }
4130
4366
  };
@@ -5079,27 +5315,64 @@ ${this.pendingWorktreeNotice}
5079
5315
  }
5080
5316
  const execSpan = startToolExecutionSpan();
5081
5317
  let toolResult;
5318
+ let isExecutionTimeout = false;
5319
+ let aborted = false;
5320
+ let toolSettled = false;
5321
+ let heartbeatCount = 0;
5322
+ let lastHeartbeat;
5323
+ const onToolProgress = /* @__PURE__ */ __name((chunk) => {
5324
+ if (toolSettled || !isShellProgressData(chunk)) {
5325
+ return;
5326
+ }
5327
+ heartbeatCount++;
5328
+ lastHeartbeat = chunk;
5329
+ void this.sendUpdate({
5330
+ sessionUpdate: "tool_call_update",
5331
+ toolCallId: callId,
5332
+ status: "in_progress",
5333
+ _meta: { toolName, shellProgress: chunk }
5334
+ }).catch((err) => {
5335
+ debugLogger6.debug(
5336
+ `[Session.runTool] heartbeat update failed for ${callId}: ${err}`
5337
+ );
5338
+ });
5339
+ }, "onToolProgress");
5340
+ const heartbeatSpanAttributes = /* @__PURE__ */ __name(() => heartbeatCount > 0 ? {
5341
+ attributes: {
5342
+ "shell.heartbeat_count": heartbeatCount,
5343
+ ...lastHeartbeat?.lastOutputAgeMs !== void 0 && {
5344
+ "shell.last_output_age_ms": lastHeartbeat.lastOutputAgeMs
5345
+ }
5346
+ }
5347
+ } : void 0, "heartbeatSpanAttributes");
5082
5348
  try {
5083
5349
  const sleepInhibitorHandle = acquireSleepInhibitor(
5084
5350
  this.config,
5085
5351
  `Qwen Code is executing tool ${toolName}`
5086
5352
  );
5087
5353
  try {
5088
- toolResult = await invocation.execute(activeToolAbortSignal);
5354
+ toolResult = await invocation.execute(
5355
+ activeToolAbortSignal,
5356
+ onToolProgress
5357
+ );
5089
5358
  } finally {
5359
+ toolSettled = true;
5090
5360
  sleepInhibitorHandle.release();
5091
5361
  }
5092
- const aborted2 = activeToolAbortSignal.aborted;
5362
+ isExecutionTimeout = toolResult.error?.type === "execution_timeout" /* EXECUTION_TIMEOUT */;
5363
+ aborted = activeToolAbortSignal.aborted && !isExecutionTimeout;
5093
5364
  endToolExecutionSpan(execSpan, {
5094
- success: !toolResult.error && !aborted2,
5095
- error: aborted2 ? "tool_cancelled" : toolResult.error ? "tool_error" : void 0,
5096
- cancelled: aborted2
5365
+ success: !toolResult.error && !aborted,
5366
+ error: aborted ? "tool_cancelled" : isExecutionTimeout ? "tool_timeout" : toolResult.error ? "tool_error" : void 0,
5367
+ cancelled: aborted,
5368
+ ...heartbeatSpanAttributes()
5097
5369
  });
5098
5370
  } catch (execError) {
5099
5371
  endToolExecutionSpan(execSpan, {
5100
5372
  success: false,
5101
5373
  error: activeToolAbortSignal.aborted ? "tool_cancelled" : "tool_exception",
5102
- cancelled: activeToolAbortSignal.aborted
5374
+ cancelled: activeToolAbortSignal.aborted,
5375
+ ...heartbeatSpanAttributes()
5103
5376
  });
5104
5377
  throw execError;
5105
5378
  }
@@ -5110,12 +5383,16 @@ ${this.pendingWorktreeNotice}
5110
5383
  currentModeId: this.config.getApprovalMode()
5111
5384
  });
5112
5385
  }
5113
- const responseParts = convertToFunctionResponse(
5386
+ const responseParts = toolResult.error ? convertToFunctionErrorResponse(
5387
+ toolName,
5388
+ callId,
5389
+ toolResult.llmContent,
5390
+ toolResult.error.message
5391
+ ) : convertToFunctionResponse(
5114
5392
  toolName,
5115
5393
  callId,
5116
5394
  toolResult.llmContent
5117
5395
  );
5118
- const aborted = activeToolAbortSignal.aborted;
5119
5396
  const status = aborted ? "cancelled" : toolResult.error ? "error" : "success";
5120
5397
  const succeeded = status === "success";
5121
5398
  const responseError = toolResult.error ? new Error(toolResult.error.message) : aborted ? new Error("Tool execution was cancelled") : void 0;
@@ -5565,7 +5842,7 @@ ${contextPart.text}`
5565
5842
  if (bridgeResult.status !== "skipped" || bridgeResult.egressOccurred) {
5566
5843
  try {
5567
5844
  await this.messageEmitter.emitAgentMessage(
5568
- this.#formatVisionBridgeNotice(bridgeResult)
5845
+ formatVisionBridgeNotice(bridgeResult)
5569
5846
  );
5570
5847
  } catch (error) {
5571
5848
  debugLogger6.debug(
@@ -5674,20 +5951,6 @@ ${contextPart.text}`
5674
5951
  #formatVoiceBridgeEgressNotice(modelId, audioCount) {
5675
5952
  return `Sent ${audioCount} audio file(s) to ${modelId} for transcription, but no transcript was produced.`;
5676
5953
  }
5677
- #formatVisionBridgeNotice(result) {
5678
- const modelName = result.modelId ?? "vision model";
5679
- const target = result.modelEndpoint ? `${modelName} (${result.modelEndpoint})` : modelName;
5680
- const egressNote = result.egressOccurred ? ` Your image and prompt/context were sent to ${target}.` : "";
5681
- if (result.status === "failed") {
5682
- const reason = result.egressOccurred ? "the vision model request failed" : "the vision bridge could not run";
5683
- return `Vision bridge (${modelName}) failed: ${reason}.${egressNote} The image was not interpreted.`;
5684
- }
5685
- if (result.status === "skipped") {
5686
- return `Vision bridge cancelled.${egressNote}`;
5687
- }
5688
- const omitted = result.omittedCount > 0 ? ` (${result.omittedCount} image(s) omitted)` : "";
5689
- return `Converted ${result.convertedCount} image(s)${omitted} to text via ${target}. Your image and prompt/context were sent to that model.`;
5690
- }
5691
5954
  async #resolveExtensionMentionParts(extensionMentions, abortSignal) {
5692
5955
  if (extensionMentions.size === 0) return [];
5693
5956
  const activeExtensions = this.config.getActiveExtensions?.() ?? [];
@@ -5896,7 +6159,58 @@ var debugLogger7 = createDebugLogger("ACP_AGENT");
5896
6159
  var QWEN_ACP_LOCAL_READ_ROOTS_ENV = "QWEN_ACP_LOCAL_READ_ROOTS";
5897
6160
  var POSIX_TMP_LOCAL_READ_ROOT = "/tmp";
5898
6161
  var BTW_CHILD_TIMEOUT_MS = 55e3;
6162
+ var MCP_OAUTH_START_TIMEOUT_MS = 3e4;
5899
6163
  var WORKSPACE_MEMORY_REMEMBER_CHILD_TIMEOUT_MS = 295e3;
6164
+ function createAcpSessionStartProfiler(span) {
6165
+ let failedStage;
6166
+ const setAttribute = /* @__PURE__ */ __name((name, value) => {
6167
+ try {
6168
+ span?.setAttribute(name, value);
6169
+ } catch {
6170
+ }
6171
+ }, "setAttribute");
6172
+ const recordStage = /* @__PURE__ */ __name((stage, start) => {
6173
+ const durationMs = Math.round((performance.now() - start) * 100) / 100;
6174
+ if (Number.isFinite(durationMs) && durationMs >= 0) {
6175
+ setAttribute(`qwen-code.daemon.session_start.${stage}_ms`, durationMs);
6176
+ }
6177
+ }, "recordStage");
6178
+ const recordFailure = /* @__PURE__ */ __name((stage) => {
6179
+ if (failedStage !== void 0) return;
6180
+ failedStage = stage;
6181
+ setAttribute("qwen-code.daemon.session_start.failed_stage", stage);
6182
+ }, "recordFailure");
6183
+ return {
6184
+ async time(stage, fn) {
6185
+ if (!span) return await fn();
6186
+ const start = performance.now();
6187
+ try {
6188
+ return await fn();
6189
+ } catch (error) {
6190
+ recordFailure(stage);
6191
+ throw error;
6192
+ } finally {
6193
+ recordStage(stage, start);
6194
+ }
6195
+ },
6196
+ timeSync(stage, fn) {
6197
+ if (!span) return fn();
6198
+ const start = performance.now();
6199
+ try {
6200
+ return fn();
6201
+ } catch (error) {
6202
+ recordFailure(stage);
6203
+ throw error;
6204
+ } finally {
6205
+ recordStage(stage, start);
6206
+ }
6207
+ },
6208
+ setSessionId(sessionId) {
6209
+ setAttribute("session.id", sessionId);
6210
+ }
6211
+ };
6212
+ }
6213
+ __name(createAcpSessionStartProfiler, "createAcpSessionStartProfiler");
5900
6214
  function workspaceMemoryErrorData(code, diagnostics) {
5901
6215
  return {
5902
6216
  errorKind: code,
@@ -6034,6 +6348,10 @@ var QWEN_CORE_SETTING_DEFINITIONS = {
6034
6348
  "general.showSessionRecap": { type: "boolean" },
6035
6349
  "general.sessionRecapAwayThresholdMinutes": { type: "number", min: 1 },
6036
6350
  "general.terminalBell": { type: "boolean" },
6351
+ "general.notificationMode": {
6352
+ type: "enum",
6353
+ values: ["all", "task-complete"]
6354
+ },
6037
6355
  "general.gitCoAuthor.commit": { type: "boolean" },
6038
6356
  "general.gitCoAuthor.pr": { type: "boolean" },
6039
6357
  "general.defaultFileEncoding": {
@@ -6058,7 +6376,7 @@ var QWEN_HOOK_EVENTS = Object.values(HookEventName);
6058
6376
  var DEFAULT_QWEN_MEMORY_SETTINGS = {
6059
6377
  enableManagedAutoMemory: true,
6060
6378
  enableManagedAutoDream: true,
6061
- enableAutoSkill: true,
6379
+ enableAutoSkill: false,
6062
6380
  autoSkillConfirm: true,
6063
6381
  enableTeamMemory: false,
6064
6382
  enableTeamMemorySync: false
@@ -7137,42 +7455,6 @@ function toMcpServerConfig(value) {
7137
7455
  return void 0;
7138
7456
  }
7139
7457
  __name(toMcpServerConfig, "toMcpServerConfig");
7140
- var REDACTED_MCP_SECRET = "__redacted__";
7141
- function redactMcpServerSecrets(server) {
7142
- const redactValues = /* @__PURE__ */ __name((record) => record ? Object.fromEntries(
7143
- Object.keys(record).map((key) => [key, REDACTED_MCP_SECRET])
7144
- ) : record, "redactValues");
7145
- return {
7146
- ...server,
7147
- env: redactValues(server.env),
7148
- headers: redactValues(server.headers)
7149
- };
7150
- }
7151
- __name(redactMcpServerSecrets, "redactMcpServerSecrets");
7152
- function restoreRedactedMcpSecrets(server, existing) {
7153
- const restore = /* @__PURE__ */ __name((incoming, prior) => {
7154
- if (!incoming) return incoming;
7155
- const priorRecord = toRecord(prior);
7156
- const result = {};
7157
- for (const [key, value] of Object.entries(incoming)) {
7158
- if (value !== REDACTED_MCP_SECRET) {
7159
- result[key] = value;
7160
- continue;
7161
- }
7162
- const priorValue = priorRecord[key];
7163
- if (typeof priorValue === "string") {
7164
- result[key] = priorValue;
7165
- }
7166
- }
7167
- return result;
7168
- }, "restore");
7169
- return {
7170
- ...server,
7171
- env: restore(server.env, existing["env"]),
7172
- headers: restore(server.headers, existing["headers"])
7173
- };
7174
- }
7175
- __name(restoreRedactedMcpSecrets, "restoreRedactedMcpSecrets");
7176
7458
  function redactSecretRecord(record) {
7177
7459
  return record ? Object.fromEntries(
7178
7460
  Object.keys(record).map((key) => [key, REDACTED_MCP_SECRET])
@@ -7664,6 +7946,12 @@ var QwenAgent = class {
7664
7946
  __name(this, "QwenAgent");
7665
7947
  }
7666
7948
  sessions = /* @__PURE__ */ new Map();
7949
+ workspaceMcpDiscoveryConfig;
7950
+ workspaceMcpDiscoveryPromise;
7951
+ workspaceMcpDiscoveryError;
7952
+ pendingMcpAuthentications = /* @__PURE__ */ new Map();
7953
+ mcpAuthenticationResults = /* @__PURE__ */ new Map();
7954
+ generationControllers = /* @__PURE__ */ new Map();
7667
7955
  transcriptReplayConfigCache = /* @__PURE__ */ new Map();
7668
7956
  clientCapabilities;
7669
7957
  // CPU-usage delta baseline for the daemon's `workspaceResource` extMethod
@@ -7697,6 +7985,178 @@ var QwenAgent = class {
7697
7985
  getActiveSessions() {
7698
7986
  return [...this.sessions.values()];
7699
7987
  }
7988
+ getWorkspaceMcpConfig(serverName) {
7989
+ if (serverName && this.config.getRuntimeMcpServers?.()[serverName] !== void 0) {
7990
+ return this.config;
7991
+ }
7992
+ return this.workspaceMcpDiscoveryConfig ?? this.config;
7993
+ }
7994
+ getLiveMcpConfigs(serverName) {
7995
+ return [
7996
+ .../* @__PURE__ */ new Set([
7997
+ this.getWorkspaceMcpConfig(serverName),
7998
+ this.config,
7999
+ ...this.getActiveSessions().map((session) => session.getConfig())
8000
+ ])
8001
+ ].filter((config) => Boolean(config.getMcpServers()?.[serverName]));
8002
+ }
8003
+ async reconcileMcpServerAcrossLiveConfigs(serverName, operation) {
8004
+ const errors = [];
8005
+ for (const config of this.getLiveMcpConfigs(serverName)) {
8006
+ try {
8007
+ const registry = config.getToolRegistry();
8008
+ if (operation === "discover") {
8009
+ await registry?.discoverToolsForServer(serverName);
8010
+ const geminiClient = config.getGeminiClient?.();
8011
+ if (geminiClient?.isInitialized?.()) {
8012
+ await geminiClient.setTools?.();
8013
+ }
8014
+ } else if (operation === "disable") {
8015
+ await registry?.disableMcpServer(serverName);
8016
+ } else {
8017
+ await registry?.disconnectServer(serverName);
8018
+ }
8019
+ } catch (error) {
8020
+ errors.push(error);
8021
+ }
8022
+ }
8023
+ if (errors.length > 0) {
8024
+ const details = errors.map(
8025
+ (error) => error instanceof Error ? error.message : String(error)
8026
+ ).join("; ");
8027
+ throw new AggregateError(
8028
+ errors,
8029
+ `Failed to synchronize MCP server ${JSON.stringify(serverName)}: ${details}`
8030
+ );
8031
+ }
8032
+ }
8033
+ getMcpServerStatus(config, serverName) {
8034
+ const manager = config.getToolRegistry()?.getMcpClientManager();
8035
+ return manager?.getServerStatus?.(serverName) ?? getMCPServerStatus(serverName);
8036
+ }
8037
+ enqueueWorkspaceMcpDiscovery(label, run) {
8038
+ const previous = this.workspaceMcpDiscoveryPromise ?? Promise.resolve();
8039
+ const tracked = previous.then(async () => {
8040
+ this.workspaceMcpDiscoveryError = void 0;
8041
+ await run();
8042
+ }).catch((err) => {
8043
+ this.workspaceMcpDiscoveryError = err instanceof Error ? err.message : String(err);
8044
+ debugLogger7.error(
8045
+ `Workspace MCP ${label} failed: ${err instanceof Error ? err.message : String(err)}`
8046
+ );
8047
+ }).finally(() => {
8048
+ if (this.workspaceMcpDiscoveryPromise === tracked) {
8049
+ this.workspaceMcpDiscoveryPromise = void 0;
8050
+ }
8051
+ });
8052
+ this.workspaceMcpDiscoveryPromise = tracked;
8053
+ return { accepted: true };
8054
+ }
8055
+ async createWorkspaceMcpDiscoveryConfig(settings) {
8056
+ if (this.workspaceMcpDiscoveryConfig) return;
8057
+ const cwd = this.config.getTargetDir();
8058
+ const config = await loadCliConfig(
8059
+ settings.merged,
8060
+ {
8061
+ ...this.argv,
8062
+ sessionId: "workspace-mcp-discovery",
8063
+ resume: void 0,
8064
+ continue: false
8065
+ },
8066
+ cwd,
8067
+ void 0,
8068
+ {
8069
+ userHooks: settings.getUserHooks(),
8070
+ projectHooks: settings.getProjectHooks()
8071
+ },
8072
+ buildDisabledSkillNamesProvider(settings)
8073
+ );
8074
+ config.setMcpTransportPool(this.mcpPool);
8075
+ try {
8076
+ await config.initialize({
8077
+ skipGeminiInitialization: true,
8078
+ skipFileCheckpointing: true,
8079
+ skipHooks: true,
8080
+ skipSkillManager: true,
8081
+ skipMcpDiscovery: true,
8082
+ lenientToolWarmup: true
8083
+ });
8084
+ const manager = config.getToolRegistry()?.getMcpClientManager();
8085
+ if (!manager) {
8086
+ throw new Error("MCP client manager is unavailable");
8087
+ }
8088
+ await manager.discoverAllMcpToolsIncremental(config);
8089
+ if (manager.getDiscoveryState() === "not_started" /* NOT_STARTED */) {
8090
+ throw new Error(
8091
+ "MCP discovery did not start. The workspace may not be trusted."
8092
+ );
8093
+ }
8094
+ this.workspaceMcpDiscoveryConfig = config;
8095
+ } catch (error) {
8096
+ try {
8097
+ await config.getToolRegistry()?.stop();
8098
+ } catch {
8099
+ }
8100
+ throw error;
8101
+ }
8102
+ }
8103
+ initializeWorkspaceMcpDiscovery() {
8104
+ if (this.workspaceMcpDiscoveryConfig || this.workspaceMcpDiscoveryPromise) {
8105
+ return { accepted: false };
8106
+ }
8107
+ return this.enqueueWorkspaceMcpDiscovery("initialization", async () => {
8108
+ const settings = loadSettings(this.config.getTargetDir());
8109
+ await this.createWorkspaceMcpDiscoveryConfig(settings);
8110
+ });
8111
+ }
8112
+ reloadWorkspaceMcpDiscovery() {
8113
+ return this.enqueueWorkspaceMcpDiscovery("reload", async () => {
8114
+ const settings = loadSettings(this.config.getTargetDir());
8115
+ const discoveryConfig = this.workspaceMcpDiscoveryConfig;
8116
+ const liveConfigs = /* @__PURE__ */ new Set([
8117
+ this.config,
8118
+ ...this.getActiveSessions().map((session) => session.getConfig()),
8119
+ ...discoveryConfig ? [discoveryConfig] : []
8120
+ ]);
8121
+ const syncErrors = [];
8122
+ for (const config of liveConfigs) {
8123
+ try {
8124
+ const cwd = config.getTargetDir();
8125
+ const mcpServers = assembleMcpServers(
8126
+ settings.merged.mcpServers,
8127
+ cwd,
8128
+ config.getTopTierMcpServers()
8129
+ );
8130
+ const gating = recomputeMcpGating(
8131
+ settings,
8132
+ mcpServers,
8133
+ cwd,
8134
+ config.getCliAllowedMcpServerNames(),
8135
+ config.getApprovalMode() === "yolo" /* YOLO */
8136
+ );
8137
+ config.setExcludedMcpServers(gating.excluded ?? []);
8138
+ config.setAllowedMcpServers(gating.allowed);
8139
+ config.setPendingMcpServers(gating.pending);
8140
+ await config.reinitializeMcpServers(mcpServers);
8141
+ } catch (error) {
8142
+ syncErrors.push(error);
8143
+ }
8144
+ }
8145
+ if (!discoveryConfig) {
8146
+ try {
8147
+ await this.createWorkspaceMcpDiscoveryConfig(settings);
8148
+ } catch (error) {
8149
+ syncErrors.push(error);
8150
+ }
8151
+ }
8152
+ if (syncErrors.length > 0) {
8153
+ throw new AggregateError(
8154
+ syncErrors,
8155
+ "Failed to synchronize MCP settings with live sessions"
8156
+ );
8157
+ }
8158
+ });
8159
+ }
7700
8160
  /**
7701
8161
  * Drain the workspace MCP transport pool. Called on shutdown so all
7702
8162
  * pool entries get a coordinated SIGTERM before process.exit. No-op
@@ -7718,6 +8178,11 @@ var QwenAgent = class {
7718
8178
  }
7719
8179
  }
7720
8180
  async closeStoredSession(sessionId, opts) {
8181
+ for (const [requestId, generation] of this.generationControllers) {
8182
+ if (generation.sessionId !== sessionId) continue;
8183
+ generation.controller.abort();
8184
+ this.generationControllers.delete(requestId);
8185
+ }
7721
8186
  const session = this.sessions.get(sessionId);
7722
8187
  if (!session) {
7723
8188
  this.mcpPool?.releaseSession(sessionId);
@@ -7796,6 +8261,10 @@ var QwenAgent = class {
7796
8261
  this.sessions.delete(sessionId);
7797
8262
  }
7798
8263
  disposeSessions() {
8264
+ for (const generation of this.generationControllers.values()) {
8265
+ generation.controller.abort();
8266
+ }
8267
+ this.generationControllers.clear();
7799
8268
  for (const session of this.sessions.values()) {
7800
8269
  session.dispose();
7801
8270
  }
@@ -7830,7 +8299,7 @@ var QwenAgent = class {
7830
8299
  async initialize(args) {
7831
8300
  this.clientCapabilities = args.clientCapabilities;
7832
8301
  const authMethods = buildAuthMethods();
7833
- const version = "0.19.10";
8302
+ const version = "0.19.11-nightly.20260717.f8e6e8931";
7834
8303
  return {
7835
8304
  protocolVersion: PROTOCOL_VERSION,
7836
8305
  agentInfo: {
@@ -7886,25 +8355,42 @@ var QwenAgent = class {
7886
8355
  }
7887
8356
  }
7888
8357
  }
7889
- async newSession({
7890
- cwd,
7891
- mcpServers
7892
- }) {
7893
- const settings = loadSettingsCached(cwd);
7894
- this.settings = settings;
7895
- const config = await this.newSessionConfig(cwd, mcpServers, settings);
7896
- await this.ensureAuthenticated(config);
7897
- this.setupFileSystem(config);
7898
- const session = await this.createAndStoreSession(config, settings);
7899
- const availableModels = this.buildAvailableModels(config);
7900
- const modesData = this.buildModesData(config);
7901
- const configOptions = this.buildConfigOptions(config);
7902
- return {
7903
- sessionId: session.getId(),
7904
- models: availableModels,
7905
- modes: modesData,
7906
- configOptions
7907
- };
8358
+ async newSession(params) {
8359
+ const { cwd, mcpServers } = params;
8360
+ const parentContext = extractDaemonTraceContext(params);
8361
+ return await withDaemonSpan(
8362
+ "qwen-code.daemon.session_start",
8363
+ { "qwen-code.daemon.operation": "acp_session_new" },
8364
+ async (span) => {
8365
+ const profiler = createAcpSessionStartProfiler(span);
8366
+ const settings = profiler.timeSync(
8367
+ "settings_load",
8368
+ () => loadSettingsCached(cwd)
8369
+ );
8370
+ this.settings = settings;
8371
+ const config = await profiler.time(
8372
+ "config_setup",
8373
+ () => this.newSessionConfig(cwd, mcpServers, settings)
8374
+ );
8375
+ await profiler.time("auth", () => this.ensureAuthenticated(config));
8376
+ profiler.timeSync(
8377
+ "file_system_setup",
8378
+ () => this.setupFileSystem(config)
8379
+ );
8380
+ const session = await profiler.time(
8381
+ "session_register",
8382
+ () => this.createAndStoreSession(config, settings)
8383
+ );
8384
+ profiler.setSessionId(session.getId());
8385
+ return profiler.timeSync("response_build", () => ({
8386
+ sessionId: session.getId(),
8387
+ models: this.buildAvailableModels(config),
8388
+ modes: this.buildModesData(config),
8389
+ configOptions: this.buildConfigOptions(config)
8390
+ }));
8391
+ },
8392
+ parentContext ? { parentContext } : {}
8393
+ );
7908
8394
  }
7909
8395
  async loadSession(params) {
7910
8396
  const settings = loadSettingsCached(params.cwd);
@@ -8351,8 +8837,15 @@ var QwenAgent = class {
8351
8837
  return "error";
8352
8838
  }
8353
8839
  }
8354
- discoveryState() {
8355
- const state = getMCPDiscoveryState();
8840
+ discoveryState(config) {
8841
+ if (this.workspaceMcpDiscoveryPromise && (config === this.config || config === this.workspaceMcpDiscoveryConfig)) {
8842
+ return "in_progress";
8843
+ }
8844
+ let state = getMCPDiscoveryState();
8845
+ try {
8846
+ state = config?.getToolRegistry()?.getMcpClientManager().getDiscoveryState() ?? state;
8847
+ } catch {
8848
+ }
8356
8849
  switch (state) {
8357
8850
  case "in_progress" /* IN_PROGRESS */:
8358
8851
  return "in_progress";
@@ -8367,10 +8860,10 @@ var QwenAgent = class {
8367
8860
  try {
8368
8861
  const workspaceCwd = this.workspaceCwd(config);
8369
8862
  const settings = loadSettings(config.getTargetDir());
8370
- const workspaceSettings = settings.forScope(
8371
- "Workspace" /* Workspace */
8372
- ).settings;
8863
+ const userServers = settings.user?.settings.mcpServers ?? {};
8864
+ const systemDefaultServers = settings.systemDefaults?.settings.mcpServers ?? {};
8373
8865
  const servers = config.getMcpServers() ?? {};
8866
+ const approvals = loadMcpApprovals();
8374
8867
  let poolByName = {};
8375
8868
  try {
8376
8869
  const snap = this.mcpPool?.getSnapshot();
@@ -8415,7 +8908,7 @@ var QwenAgent = class {
8415
8908
  v: STATUS_SCHEMA_VERSION,
8416
8909
  workspaceCwd,
8417
8910
  initialized: true,
8418
- discoveryState: this.discoveryState(),
8911
+ discoveryState: this.discoveryState(config),
8419
8912
  servers: await Promise.all(
8420
8913
  Object.entries(servers).map(async ([name, server]) => {
8421
8914
  const disabled = config.isMcpServerDisabled(name);
@@ -8425,7 +8918,8 @@ var QwenAgent = class {
8425
8918
  hasOAuthTokens = credentials !== null;
8426
8919
  } catch {
8427
8920
  }
8428
- const rawStatus = getMCPServerStatus(name);
8921
+ const rawStatus = this.getMcpServerStatus(config, name);
8922
+ const requiresAuth = rawStatus !== "connected" /* CONNECTED */ && (mcpServerRequiresOAuth.get(name) === true || server.oauth?.enabled === true && !hasOAuthTokens);
8429
8923
  const refusedByBudget = refusedSet.has(name);
8430
8924
  const effectivelyRefused = refusedByBudget && !disabled;
8431
8925
  const out = {
@@ -8439,8 +8933,34 @@ var QwenAgent = class {
8439
8933
  mcpStatus: this.mcpStatus(rawStatus),
8440
8934
  transport: this.mcpTransport(server),
8441
8935
  disabled,
8442
- hasOAuthTokens
8936
+ hasOAuthTokens,
8937
+ ...requiresAuth ? { requiresAuth: true } : {}
8443
8938
  };
8939
+ if (isGatedMcpScope(server.scope)) {
8940
+ const approvalState = approvals.getState(
8941
+ config.getWorkingDir(),
8942
+ name,
8943
+ server
8944
+ );
8945
+ if (approvalState !== "approved") {
8946
+ out.approvalState = approvalState;
8947
+ if (!disabled) {
8948
+ out.status = "warning";
8949
+ out.mcpStatus = "disconnected";
8950
+ }
8951
+ }
8952
+ }
8953
+ if (this.pendingMcpAuthentications.has(name)) {
8954
+ out.authenticationState = "pending";
8955
+ } else {
8956
+ const authentication = this.mcpAuthenticationResults.get(name);
8957
+ if (authentication) {
8958
+ out.authenticationState = authentication.state;
8959
+ if (authentication.error) {
8960
+ out.authenticationError = authentication.error;
8961
+ }
8962
+ }
8963
+ }
8444
8964
  if (effectivelyRefused) {
8445
8965
  out.errorKind = "budget_exhausted";
8446
8966
  out.disabledReason = "budget";
@@ -8456,7 +8976,11 @@ var QwenAgent = class {
8456
8976
  if (typeof extensionName === "string") {
8457
8977
  out.extensionName = extensionName;
8458
8978
  }
8459
- out.source = out.extensionName ? "extension" : workspaceSettings.mcpServers?.[name] ? "project" : "user";
8979
+ const transient = config.getTopTierMcpServers?.()?.[name] !== void 0 || config.getRuntimeMcpServers?.()[name] !== void 0;
8980
+ const configOrigin = out.extensionName ? "extension" : transient ? "runtime" : server.scope === "workspace" ? "workspace_settings" : server.scope === "project" ? "project_mcp_json" : server.scope === "system" ? "system_settings" : userServers[name] !== void 0 ? "user_settings" : systemDefaultServers[name] !== void 0 ? "system_settings" : "user_settings";
8981
+ out.configOrigin = configOrigin;
8982
+ out.source = out.extensionName ? "extension" : configOrigin === "workspace_settings" ? "project" : "user";
8983
+ out.removable = configOrigin === "user_settings" || configOrigin === "workspace_settings";
8460
8984
  if (server && typeof server === "object") {
8461
8985
  const candidate = server;
8462
8986
  const serverConfig = {};
@@ -8521,6 +9045,14 @@ var QwenAgent = class {
8521
9045
  ).length,
8522
9046
  budgetCellScope
8523
9047
  )
9048
+ } : {},
9049
+ ...this.workspaceMcpDiscoveryError ? {
9050
+ errors: [
9051
+ this.errorCell(
9052
+ "mcp",
9053
+ new Error(this.workspaceMcpDiscoveryError)
9054
+ )
9055
+ ]
8524
9056
  } : {}
8525
9057
  };
8526
9058
  } catch (error) {
@@ -8533,6 +9065,34 @@ var QwenAgent = class {
8533
9065
  };
8534
9066
  }
8535
9067
  }
9068
+ async buildManagedWorkspaceMcpStatus() {
9069
+ const config = this.getWorkspaceMcpConfig();
9070
+ const status = await this.buildWorkspaceMcpStatus(config);
9071
+ if (config === this.config) return status;
9072
+ const runtimeNames = new Set(
9073
+ Object.keys(this.config.getRuntimeMcpServers?.() ?? {})
9074
+ );
9075
+ if (runtimeNames.size === 0) return status;
9076
+ const runtimeStatus = await this.buildWorkspaceMcpStatus(this.config);
9077
+ const errors = [
9078
+ ...status.errors ?? [],
9079
+ ...(runtimeStatus.errors ?? []).filter(
9080
+ (candidate) => !status.errors?.some(
9081
+ (existing) => existing.kind === candidate.kind && existing.status === candidate.status && existing.error === candidate.error
9082
+ )
9083
+ )
9084
+ ];
9085
+ return {
9086
+ ...status,
9087
+ servers: [
9088
+ ...status.servers.filter((server) => !runtimeNames.has(server.name)),
9089
+ ...runtimeStatus.servers.filter(
9090
+ (server) => runtimeNames.has(server.name)
9091
+ )
9092
+ ],
9093
+ ...errors.length > 0 ? { errors } : {}
9094
+ };
9095
+ }
8536
9096
  buildWorkspaceMcpToolsStatus(config, serverName) {
8537
9097
  const workspaceCwd = this.safeWorkspaceCwd(config);
8538
9098
  try {
@@ -8840,9 +9400,18 @@ var QwenAgent = class {
8840
9400
  const currentModelId = activeRuntimeSnapshot ? activeRuntimeSnapshot.id : (config.getModel() || "").trim();
8841
9401
  const hasCurrentModel = currentModelId.length > 0;
8842
9402
  const currentAuth = activeRuntimeSnapshot?.authType ?? currentAuthType;
8843
- const currentAcpModelId = hasCurrentModel && currentAuth ? formatAcpModelId(currentModelId, currentAuth) : currentModelId || void 0;
9403
+ const modelOptions = buildAcpModelOptions(
9404
+ config.getAllConfiguredModels()
9405
+ );
9406
+ const currentAcpModelId = hasCurrentModel ? getCurrentAcpModelId(
9407
+ modelOptions,
9408
+ currentModelId,
9409
+ currentAuth,
9410
+ activeRuntimeSnapshot ? void 0 : config.getCurrentModelRegistryBaseUrl?.()
9411
+ ) : void 0;
8844
9412
  const providers = /* @__PURE__ */ new Map();
8845
- for (const model of config.getAllConfiguredModels().filter(isMainSelectableModel)) {
9413
+ for (const option of modelOptions) {
9414
+ const { model, effectiveModelId, modelId } = option;
8846
9415
  const authType = String(model.authType);
8847
9416
  let provider = providers.get(authType);
8848
9417
  if (!provider) {
@@ -8855,9 +9424,7 @@ var QwenAgent = class {
8855
9424
  };
8856
9425
  providers.set(authType, provider);
8857
9426
  }
8858
- const effectiveModelId = model.isRuntimeModel && model.runtimeSnapshotId ? model.runtimeSnapshotId : model.id;
8859
- const modelId = formatAcpModelId(effectiveModelId, model.authType);
8860
- const isCurrent = currentAuth === model.authType && hasCurrentModel && (currentModelId === effectiveModelId || currentModelId === model.id || currentAcpModelId === modelId);
9427
+ const isCurrent = currentAuth === model.authType && currentAcpModelId === modelId;
8861
9428
  const providerModel = {
8862
9429
  modelId,
8863
9430
  baseModelId: parseAcpBaseModelId(effectiveModelId),
@@ -8997,7 +9564,7 @@ var QwenAgent = class {
8997
9564
  }
8998
9565
  buildMcpDiscoveryPreflightCell(config) {
8999
9566
  try {
9000
- const discovery = this.discoveryState();
9567
+ const discovery = this.discoveryState(config);
9001
9568
  const servers = config.getMcpServers() ?? {};
9002
9569
  const total = Object.keys(servers).length;
9003
9570
  const counts = {
@@ -9920,9 +10487,7 @@ var QwenAgent = class {
9920
10487
  };
9921
10488
  }
9922
10489
  case SERVE_STATUS_EXT_METHODS.workspaceMcp:
9923
- return await this.buildWorkspaceMcpStatus(
9924
- this.config
9925
- );
10490
+ return await this.buildManagedWorkspaceMcpStatus();
9926
10491
  case SERVE_STATUS_EXT_METHODS.workspaceMcpTools: {
9927
10492
  const serverName = params["serverName"];
9928
10493
  if (typeof serverName !== "string" || serverName.length === 0) {
@@ -9932,7 +10497,7 @@ var QwenAgent = class {
9932
10497
  );
9933
10498
  }
9934
10499
  return this.buildWorkspaceMcpToolsStatus(
9935
- this.config,
10500
+ this.getWorkspaceMcpConfig(serverName),
9936
10501
  serverName
9937
10502
  );
9938
10503
  }
@@ -9945,7 +10510,7 @@ var QwenAgent = class {
9945
10510
  );
9946
10511
  }
9947
10512
  return this.buildWorkspaceMcpResourcesStatus(
9948
- this.config,
10513
+ this.getWorkspaceMcpConfig(serverName),
9949
10514
  serverName
9950
10515
  );
9951
10516
  }
@@ -10469,6 +11034,7 @@ var QwenAgent = class {
10469
11034
  "Invalid or missing serverName"
10470
11035
  );
10471
11036
  }
11037
+ const config = this.getWorkspaceMcpConfig(serverName);
10472
11038
  let entryIndex;
10473
11039
  const rawEntryIndex = params["entryIndex"];
10474
11040
  if (rawEntryIndex !== void 0 && rawEntryIndex !== "*") {
@@ -10480,7 +11046,7 @@ var QwenAgent = class {
10480
11046
  }
10481
11047
  entryIndex = rawEntryIndex;
10482
11048
  }
10483
- const servers = this.config.getMcpServers() ?? {};
11049
+ const servers = config.getMcpServers() ?? {};
10484
11050
  if (!Object.prototype.hasOwnProperty.call(servers, serverName)) {
10485
11051
  throw new RequestError(
10486
11052
  -32004,
@@ -10488,7 +11054,7 @@ var QwenAgent = class {
10488
11054
  { errorKind: "mcp_server_not_found", serverName }
10489
11055
  );
10490
11056
  }
10491
- if (this.config.isMcpServerDisabled(serverName)) {
11057
+ if (config.isMcpServerDisabled(serverName)) {
10492
11058
  return {
10493
11059
  serverName,
10494
11060
  restarted: false,
@@ -10496,7 +11062,23 @@ var QwenAgent = class {
10496
11062
  reason: "disabled"
10497
11063
  };
10498
11064
  }
10499
- const manager = this.config.getToolRegistry()?.getMcpClientManager();
11065
+ const server = servers[serverName];
11066
+ let requiresAuth = mcpServerRequiresOAuth.get(serverName) === true;
11067
+ if (!requiresAuth && server.oauth?.enabled === true) {
11068
+ try {
11069
+ requiresAuth = await new MCPOAuthTokenStorage().getCredentials(serverName) === null;
11070
+ } catch {
11071
+ }
11072
+ }
11073
+ if (requiresAuth && this.getMcpServerStatus(config, serverName) !== "connected" /* CONNECTED */) {
11074
+ return {
11075
+ serverName,
11076
+ restarted: false,
11077
+ skipped: true,
11078
+ reason: "authentication_required"
11079
+ };
11080
+ }
11081
+ const manager = config.getToolRegistry()?.getMcpClientManager();
10500
11082
  if (!manager) {
10501
11083
  throw RequestError.internalError(
10502
11084
  void 0,
@@ -10523,7 +11105,7 @@ var QwenAgent = class {
10523
11105
  };
10524
11106
  }
10525
11107
  try {
10526
- const fresh = loadSettings(this.config.getTargetDir());
11108
+ const fresh = loadSettings(config.getTargetDir());
10527
11109
  const mergedDisabled = fresh.merged.tools?.disabled;
10528
11110
  if (mergedDisabled !== void 0 && !Array.isArray(mergedDisabled)) {
10529
11111
  process.stderr.write(
@@ -10532,7 +11114,7 @@ var QwenAgent = class {
10532
11114
  );
10533
11115
  }
10534
11116
  const disabledList = normalizeDisabledToolList(mergedDisabled);
10535
- this.config.setDisabledTools(new Set(disabledList));
11117
+ config.setDisabledTools(new Set(disabledList));
10536
11118
  } catch (err) {
10537
11119
  process.stderr.write(
10538
11120
  `qwen serve: MCP restart for ${JSON.stringify(serverName)} could not refresh disabledTools from merged settings (${err instanceof Error ? err.message : String(err)}); proceeding with the bootstrap snapshot \u2014 recently toggled tools may not take effect until daemon restart.
@@ -10545,6 +11127,14 @@ var QwenAgent = class {
10545
11127
  const restartResults = await this.mcpPool.restartByName(serverName, {
10546
11128
  ...entryIndex !== void 0 ? { entryIndex } : {}
10547
11129
  });
11130
+ await Promise.all(
11131
+ this.getLiveMcpConfigs(serverName).map(async (liveConfig) => {
11132
+ const geminiClient = liveConfig.getGeminiClient?.();
11133
+ if (geminiClient?.isInitialized?.()) {
11134
+ await geminiClient.setTools?.();
11135
+ }
11136
+ })
11137
+ );
10548
11138
  return {
10549
11139
  serverName,
10550
11140
  entries: restartResults
@@ -10557,19 +11147,18 @@ var QwenAgent = class {
10557
11147
  );
10558
11148
  }
10559
11149
  const start = Date.now();
10560
- const toolRegistry = this.config.getToolRegistry();
10561
- if (!toolRegistry) {
10562
- throw RequestError.internalError(
10563
- void 0,
10564
- "ToolRegistry unavailable on this Config"
11150
+ await this.reconcileMcpServerAcrossLiveConfigs(serverName, "discover");
11151
+ const disconnectedRuntime = this.getLiveMcpConfigs(serverName).find(
11152
+ (liveConfig) => this.getMcpServerStatus(liveConfig, serverName) !== "connected" /* CONNECTED */
11153
+ );
11154
+ if (disconnectedRuntime) {
11155
+ const postStatus = this.getMcpServerStatus(
11156
+ disconnectedRuntime,
11157
+ serverName
10565
11158
  );
10566
- }
10567
- await toolRegistry.discoverToolsForServer(serverName);
10568
- const postStatus = getMCPServerStatus(serverName);
10569
- if (postStatus !== "connected" /* CONNECTED */) {
10570
11159
  throw new RequestError(
10571
11160
  -32099,
10572
- `MCP server ${JSON.stringify(serverName)} did not reach a connected state after restart (status: ${postStatus}).`,
11161
+ `MCP server ${JSON.stringify(serverName)} did not reach a connected state in every live runtime after restart (status: ${postStatus}).`,
10573
11162
  {
10574
11163
  errorKind: "mcp_restart_failed",
10575
11164
  serverName,
@@ -10583,6 +11172,10 @@ var QwenAgent = class {
10583
11172
  durationMs: Date.now() - start
10584
11173
  };
10585
11174
  }
11175
+ case SERVE_CONTROL_EXT_METHODS.workspaceMcpInitialize:
11176
+ return this.initializeWorkspaceMcpDiscovery();
11177
+ case SERVE_CONTROL_EXT_METHODS.workspaceMcpReload:
11178
+ return this.reloadWorkspaceMcpDiscovery();
10586
11179
  case SERVE_CONTROL_EXT_METHODS.workspaceMcpManage: {
10587
11180
  const serverName = params["serverName"];
10588
11181
  const action = params["action"];
@@ -10592,13 +11185,14 @@ var QwenAgent = class {
10592
11185
  "Invalid or missing serverName"
10593
11186
  );
10594
11187
  }
10595
- if (action !== "enable" && action !== "disable" && action !== "authenticate" && action !== "clear-auth") {
11188
+ if (action !== "approve" && action !== "enable" && action !== "disable" && action !== "authenticate" && action !== "clear-auth") {
10596
11189
  throw RequestError.invalidParams(
10597
11190
  void 0,
10598
11191
  "Invalid or missing MCP manage action"
10599
11192
  );
10600
11193
  }
10601
- const servers = this.config.getMcpServers() ?? {};
11194
+ const config = this.getWorkspaceMcpConfig(serverName);
11195
+ const servers = config.getMcpServers() ?? {};
10602
11196
  const server = servers[serverName];
10603
11197
  if (!server) {
10604
11198
  throw new RequestError(
@@ -10607,37 +11201,65 @@ var QwenAgent = class {
10607
11201
  { errorKind: "mcp_server_not_found", serverName }
10608
11202
  );
10609
11203
  }
10610
- const toolRegistry = this.config.getToolRegistry();
11204
+ const toolRegistry = config.getToolRegistry();
10611
11205
  if (!toolRegistry) {
10612
11206
  throw RequestError.internalError(
10613
11207
  void 0,
10614
11208
  "ToolRegistry unavailable on this Config"
10615
11209
  );
10616
11210
  }
11211
+ if (action === "approve") {
11212
+ if (!isGatedMcpScope(server.scope)) {
11213
+ throw RequestError.invalidParams(
11214
+ void 0,
11215
+ `MCP server is not approval-gated: ${serverName}`
11216
+ );
11217
+ }
11218
+ const approvals = loadMcpApprovals();
11219
+ await approvals.setState(
11220
+ config.getWorkingDir(),
11221
+ serverName,
11222
+ server,
11223
+ "approved"
11224
+ );
11225
+ for (const liveConfig of this.getLiveMcpConfigs(serverName)) {
11226
+ liveConfig.approveMcpServerForSession(serverName);
11227
+ }
11228
+ await this.reconcileMcpServerAcrossLiveConfigs(
11229
+ serverName,
11230
+ "discover"
11231
+ );
11232
+ return { serverName, action, ok: true, changed: true };
11233
+ }
10617
11234
  if (action === "enable") {
10618
- const settings = loadSettings(this.config.getTargetDir());
11235
+ const settings = loadSettings(config.getTargetDir());
10619
11236
  let settingsChanged = false;
10620
11237
  for (const scope of ["User" /* User */, "Workspace" /* Workspace */]) {
10621
11238
  const scopeSettings = settings.forScope(scope).settings;
10622
- const currentExcluded2 = scopeSettings.mcp?.excluded || [];
10623
- const filtered = currentExcluded2.filter(
11239
+ const currentExcluded = scopeSettings.mcp?.excluded || [];
11240
+ const filtered = currentExcluded.filter(
10624
11241
  (pattern) => pattern !== serverName
10625
11242
  );
10626
- if (filtered.length !== currentExcluded2.length) {
11243
+ if (filtered.length !== currentExcluded.length) {
10627
11244
  settings.setValue(scope, "mcp.excluded", filtered);
10628
11245
  settingsChanged = true;
10629
11246
  }
10630
11247
  }
10631
- const currentExcluded = this.config.getExcludedMcpServers() || [];
10632
- const runtimeFiltered = currentExcluded.filter(
10633
- (pattern) => pattern !== serverName
10634
- );
10635
11248
  let runtimeChanged = false;
10636
- if (runtimeFiltered.length !== currentExcluded.length) {
10637
- this.config.setExcludedMcpServers(runtimeFiltered);
10638
- runtimeChanged = true;
11249
+ for (const liveConfig of this.getLiveMcpConfigs(serverName)) {
11250
+ const currentExcluded = liveConfig.getExcludedMcpServers() || [];
11251
+ const runtimeFiltered = currentExcluded.filter(
11252
+ (pattern) => pattern !== serverName
11253
+ );
11254
+ if (runtimeFiltered.length !== currentExcluded.length) {
11255
+ liveConfig.setExcludedMcpServers(runtimeFiltered);
11256
+ runtimeChanged = true;
11257
+ }
10639
11258
  }
10640
- await toolRegistry.discoverToolsForServer(serverName);
11259
+ await this.reconcileMcpServerAcrossLiveConfigs(
11260
+ serverName,
11261
+ "discover"
11262
+ );
10641
11263
  return {
10642
11264
  serverName,
10643
11265
  action,
@@ -10646,7 +11268,7 @@ var QwenAgent = class {
10646
11268
  };
10647
11269
  }
10648
11270
  if (action === "disable") {
10649
- const settings = loadSettings(this.config.getTargetDir());
11271
+ const settings = loadSettings(config.getTargetDir());
10650
11272
  const userSettings = settings.forScope("User" /* User */).settings;
10651
11273
  const workspaceSettings = settings.forScope(
10652
11274
  "Workspace" /* Workspace */
@@ -10658,7 +11280,7 @@ var QwenAgent = class {
10658
11280
  `Cannot disable extension MCP server: ${serverName}`
10659
11281
  );
10660
11282
  }
10661
- if (workspaceSettings.mcpServers?.[serverName]) {
11283
+ if (server.scope === "project" || server.scope === "workspace" || workspaceSettings.mcpServers?.[serverName]) {
10662
11284
  targetScope = "Workspace" /* Workspace */;
10663
11285
  } else if (userSettings.mcpServers?.[serverName]) {
10664
11286
  targetScope = "User" /* User */;
@@ -10673,13 +11295,19 @@ var QwenAgent = class {
10673
11295
  ]);
10674
11296
  settingsChanged = true;
10675
11297
  }
10676
- const runtimeExcluded = this.config.getExcludedMcpServers() || [];
10677
11298
  let runtimeChanged = false;
10678
- if (!matchesAnyServerPattern(serverName, runtimeExcluded)) {
10679
- this.config.setExcludedMcpServers([...runtimeExcluded, serverName]);
10680
- runtimeChanged = true;
11299
+ const liveConfigs = this.getLiveMcpConfigs(serverName);
11300
+ for (const liveConfig of liveConfigs) {
11301
+ const runtimeExcluded = liveConfig.getExcludedMcpServers() || [];
11302
+ if (!matchesAnyServerPattern(serverName, runtimeExcluded)) {
11303
+ liveConfig.setExcludedMcpServers([
11304
+ ...runtimeExcluded,
11305
+ serverName
11306
+ ]);
11307
+ runtimeChanged = true;
11308
+ }
10681
11309
  }
10682
- await toolRegistry.disableMcpServer(serverName);
11310
+ await this.reconcileMcpServerAcrossLiveConfigs(serverName, "disable");
10683
11311
  return {
10684
11312
  serverName,
10685
11313
  action,
@@ -10690,61 +11318,114 @@ var QwenAgent = class {
10690
11318
  if (action === "clear-auth") {
10691
11319
  const tokenStorage = new MCPOAuthTokenStorage();
10692
11320
  await tokenStorage.deleteCredentials(serverName);
10693
- await toolRegistry.disconnectServer(serverName);
11321
+ await this.reconcileMcpServerAcrossLiveConfigs(
11322
+ serverName,
11323
+ "disconnect"
11324
+ );
10694
11325
  return { serverName, action, ok: true, changed: true };
10695
11326
  }
10696
- const messages = [];
10697
- let authUrl;
10698
- const displayListener = /* @__PURE__ */ __name((message) => {
10699
- if (typeof message === "string") {
10700
- messages.push(message);
10701
- } else if (message && typeof message === "object") {
10702
- const key = message.key;
10703
- if (typeof key === "string") {
10704
- messages.push(key);
11327
+ let pending = this.pendingMcpAuthentications.get(serverName);
11328
+ if (!pending) {
11329
+ this.mcpAuthenticationResults.delete(serverName);
11330
+ const messages2 = [];
11331
+ let resolveStarted;
11332
+ let rejectStarted;
11333
+ let startedTimer;
11334
+ const started = new Promise((resolve4, reject) => {
11335
+ resolveStarted = /* @__PURE__ */ __name((value) => {
11336
+ clearTimeout(startedTimer);
11337
+ resolve4(value);
11338
+ }, "resolveStarted");
11339
+ rejectStarted = /* @__PURE__ */ __name((reason) => {
11340
+ clearTimeout(startedTimer);
11341
+ reject(reason);
11342
+ }, "rejectStarted");
11343
+ startedTimer = setTimeout(
11344
+ () => rejectStarted(
11345
+ new Error(
11346
+ `MCP OAuth authentication did not provide a URL within ${MCP_OAUTH_START_TIMEOUT_MS / 1e3} seconds`
11347
+ )
11348
+ ),
11349
+ MCP_OAUTH_START_TIMEOUT_MS
11350
+ );
11351
+ startedTimer.unref();
11352
+ });
11353
+ pending = { started };
11354
+ this.pendingMcpAuthentications.set(serverName, pending);
11355
+ const displayListener = /* @__PURE__ */ __name((message) => {
11356
+ if (typeof message === "string") {
11357
+ messages2.push(message);
11358
+ } else if (message && typeof message === "object") {
11359
+ const key = message.key;
11360
+ if (typeof key === "string") messages2.push(key);
10705
11361
  }
10706
- }
10707
- }, "displayListener");
10708
- const authUrlListener = /* @__PURE__ */ __name((url) => {
10709
- if (typeof url === "string") {
10710
- authUrl = url;
10711
- }
10712
- }, "authUrlListener");
10713
- appEvents.on("oauth-display-message" /* OauthDisplayMessage */, displayListener);
10714
- appEvents.on("oauth-auth-url" /* OauthAuthUrl */, authUrlListener);
10715
- try {
10716
- const oauthConfig = server.oauth ?? { enabled: false };
10717
- const mcpServerUrl = server.httpUrl || server.url;
10718
- const authProvider = new MCPOAuthProvider(new MCPOAuthTokenStorage());
10719
- await authProvider.authenticate(
10720
- serverName,
10721
- oauthConfig,
10722
- mcpServerUrl,
10723
- appEvents
10724
- );
10725
- messages.push(
10726
- `Successfully authenticated and refreshed tools for '${serverName}'.`
10727
- );
10728
- await toolRegistry.discoverToolsForServer(serverName);
10729
- const geminiClient = this.config.getGeminiClient();
10730
- if (geminiClient) {
10731
- await geminiClient.setTools();
10732
- }
10733
- return {
10734
- serverName,
10735
- action,
10736
- ok: true,
10737
- changed: true,
10738
- messages,
10739
- ...authUrl ? { authUrl } : {}
10740
- };
10741
- } finally {
10742
- appEvents.removeListener(
10743
- "oauth-display-message" /* OauthDisplayMessage */,
10744
- displayListener
10745
- );
10746
- appEvents.removeListener("oauth-auth-url" /* OauthAuthUrl */, authUrlListener);
11362
+ }, "displayListener");
11363
+ const authUrlListener = /* @__PURE__ */ __name((url) => {
11364
+ if (typeof url === "string") {
11365
+ resolveStarted({ authUrl: url, messages: [...messages2] });
11366
+ }
11367
+ }, "authUrlListener");
11368
+ appEvents.on("oauth-display-message" /* OauthDisplayMessage */, displayListener);
11369
+ appEvents.on("oauth-auth-url" /* OauthAuthUrl */, authUrlListener);
11370
+ void (async () => {
11371
+ try {
11372
+ try {
11373
+ const oauthConfig = server.oauth ?? { enabled: false };
11374
+ const mcpServerUrl = server.httpUrl || server.url;
11375
+ const authProvider = new MCPOAuthProvider(
11376
+ new MCPOAuthTokenStorage()
11377
+ );
11378
+ await authProvider.authenticate(
11379
+ serverName,
11380
+ oauthConfig,
11381
+ mcpServerUrl,
11382
+ appEvents
11383
+ );
11384
+ this.mcpAuthenticationResults.set(serverName, {
11385
+ state: "succeeded"
11386
+ });
11387
+ } catch (error) {
11388
+ this.mcpAuthenticationResults.set(serverName, {
11389
+ state: "failed",
11390
+ error: error instanceof Error ? error.message : String(error)
11391
+ });
11392
+ rejectStarted(error);
11393
+ debugLogger7.warn(
11394
+ `MCP OAuth authentication failed for ${serverName}:`,
11395
+ error
11396
+ );
11397
+ return;
11398
+ }
11399
+ try {
11400
+ await this.reconcileMcpServerAcrossLiveConfigs(
11401
+ serverName,
11402
+ "discover"
11403
+ );
11404
+ } catch (error) {
11405
+ debugLogger7.warn(
11406
+ `MCP OAuth authenticated for ${serverName}, but tool synchronization failed:`,
11407
+ error
11408
+ );
11409
+ }
11410
+ } finally {
11411
+ appEvents.removeListener(
11412
+ "oauth-display-message" /* OauthDisplayMessage */,
11413
+ displayListener
11414
+ );
11415
+ appEvents.removeListener("oauth-auth-url" /* OauthAuthUrl */, authUrlListener);
11416
+ this.pendingMcpAuthentications.delete(serverName);
11417
+ }
11418
+ })();
10747
11419
  }
11420
+ const { authUrl, messages } = await pending.started;
11421
+ return {
11422
+ serverName,
11423
+ action,
11424
+ ok: true,
11425
+ pending: true,
11426
+ messages,
11427
+ authUrl
11428
+ };
10748
11429
  }
10749
11430
  case SERVE_CONTROL_EXT_METHODS.workspaceAgentGenerate: {
10750
11431
  const description = params["description"];
@@ -10855,6 +11536,39 @@ var QwenAgent = class {
10855
11536
  }
10856
11537
  return { sessionId, parentSessionId, persisted: ok };
10857
11538
  }
11539
+ case SERVE_CONTROL_EXT_METHODS.sessionSource: {
11540
+ const sessionId = params["sessionId"];
11541
+ const sourceType = params["sourceType"];
11542
+ const sourceId = params["sourceId"];
11543
+ if (typeof sessionId !== "string" || sessionId.length === 0) {
11544
+ throw RequestError.invalidParams(
11545
+ void 0,
11546
+ "Invalid or missing sessionId"
11547
+ );
11548
+ }
11549
+ const source = parseSessionSource(sourceType, sourceId);
11550
+ if ("error" in source || source.sourceType === void 0) {
11551
+ throw RequestError.invalidParams(
11552
+ void 0,
11553
+ "error" in source ? source.error : "Invalid or missing sourceType"
11554
+ );
11555
+ }
11556
+ const session = this.sessionOrThrow(sessionId);
11557
+ const recording = session.getConfig().getChatRecordingService();
11558
+ let ok = false;
11559
+ if (recording) {
11560
+ ok = await recording.recordSessionSource(
11561
+ source.sourceType,
11562
+ source.sourceId
11563
+ );
11564
+ }
11565
+ return {
11566
+ sessionId,
11567
+ sourceType: source.sourceType,
11568
+ ...source.sourceId !== void 0 ? { sourceId: source.sourceId } : {},
11569
+ persisted: ok
11570
+ };
11571
+ }
10858
11572
  case SERVE_CONTROL_EXT_METHODS.sessionClose: {
10859
11573
  const sessionId = params["sessionId"];
10860
11574
  if (typeof sessionId !== "string" || sessionId.length === 0) {
@@ -11097,6 +11811,64 @@ var QwenAgent = class {
11097
11811
  );
11098
11812
  return { sessionId, recap };
11099
11813
  }
11814
+ case SERVE_CONTROL_EXT_METHODS.sessionGenerationStart: {
11815
+ const sessionId = params["sessionId"];
11816
+ const requestId = params["requestId"];
11817
+ const prompt = params["prompt"];
11818
+ if (typeof sessionId !== "string" || typeof requestId !== "string" || typeof prompt !== "string" || prompt.trim().length === 0 || Buffer.byteLength(prompt, "utf8") > GENERATION_MAX_PROMPT_BYTES) {
11819
+ throw RequestError.invalidParams(
11820
+ void 0,
11821
+ "Invalid generation request"
11822
+ );
11823
+ }
11824
+ if (this.generationControllers.has(requestId)) {
11825
+ throw RequestError.invalidParams(
11826
+ void 0,
11827
+ "Duplicate generation requestId"
11828
+ );
11829
+ }
11830
+ const session = this.sessionOrThrow(sessionId);
11831
+ const controller = new AbortController();
11832
+ this.generationControllers.set(requestId, { sessionId, controller });
11833
+ const signal = AbortSignal.any([
11834
+ controller.signal,
11835
+ AbortSignal.timeout(GENERATION_TIMEOUT_MS)
11836
+ ]);
11837
+ try {
11838
+ const result = await executeGeneration(
11839
+ session.getConfig(),
11840
+ requestId,
11841
+ prompt,
11842
+ signal,
11843
+ async (event) => {
11844
+ await this.connection.extNotification(
11845
+ "qwen/notify/session/generation/event",
11846
+ { v: 1, sessionId, requestId, event }
11847
+ );
11848
+ }
11849
+ );
11850
+ return { sessionId, requestId, ...result };
11851
+ } finally {
11852
+ this.generationControllers.delete(requestId);
11853
+ }
11854
+ }
11855
+ case SERVE_CONTROL_EXT_METHODS.sessionGenerationCancel: {
11856
+ const sessionId = params["sessionId"];
11857
+ const requestId = params["requestId"];
11858
+ if (typeof sessionId !== "string" || typeof requestId !== "string") {
11859
+ throw RequestError.invalidParams(
11860
+ void 0,
11861
+ "Invalid generation cancellation request"
11862
+ );
11863
+ }
11864
+ const generation = this.generationControllers.get(requestId);
11865
+ const cancelled = generation?.sessionId === sessionId;
11866
+ if (cancelled) {
11867
+ generation.controller.abort();
11868
+ this.generationControllers.delete(requestId);
11869
+ }
11870
+ return { sessionId, requestId, cancelled };
11871
+ }
11100
11872
  case SERVE_CONTROL_EXT_METHODS.sessionBtw: {
11101
11873
  const sessionId = params["sessionId"];
11102
11874
  if (typeof sessionId !== "string" || sessionId.length === 0) {
@@ -11394,12 +12166,7 @@ ${outputText}
11394
12166
  "Invalid or missing config"
11395
12167
  );
11396
12168
  }
11397
- if (typeof originatorClientId !== "string" || originatorClientId.length === 0) {
11398
- throw RequestError.invalidParams(
11399
- void 0,
11400
- "Invalid or missing originatorClientId"
11401
- );
11402
- }
12169
+ const runtimeClientId = typeof originatorClientId === "string" && originatorClientId.length > 0 ? originatorClientId : "daemon";
11403
12170
  const manager = this.config.getToolRegistry()?.getMcpClientManager();
11404
12171
  if (!manager) {
11405
12172
  throw RequestError.internalError(
@@ -11430,7 +12197,7 @@ ${outputText}
11430
12197
  const result = await manager.addRuntimeMcpServer(
11431
12198
  name,
11432
12199
  safeConfig,
11433
- originatorClientId
12200
+ runtimeClientId
11434
12201
  );
11435
12202
  await Promise.all(
11436
12203
  this.getActiveSessions().map(async (session) => {
@@ -11440,7 +12207,7 @@ ${outputText}
11440
12207
  await sessionManager.addRuntimeMcpServer(
11441
12208
  name,
11442
12209
  safeConfig,
11443
- originatorClientId
12210
+ runtimeClientId
11444
12211
  );
11445
12212
  } catch (sessionErr) {
11446
12213
  debugLogger7.warn(
@@ -11489,12 +12256,7 @@ ${outputText}
11489
12256
  "Server name must be \u2264256 chars, alphanumeric + underscore/hyphen, and not a reserved JS property name"
11490
12257
  );
11491
12258
  }
11492
- if (typeof originatorClientId !== "string" || originatorClientId.length === 0) {
11493
- throw RequestError.invalidParams(
11494
- void 0,
11495
- "Invalid or missing originatorClientId"
11496
- );
11497
- }
12259
+ const runtimeClientId = typeof originatorClientId === "string" && originatorClientId.length > 0 ? originatorClientId : "daemon";
11498
12260
  const manager = this.config.getToolRegistry()?.getMcpClientManager();
11499
12261
  if (!manager) {
11500
12262
  throw RequestError.internalError(
@@ -11504,7 +12266,7 @@ ${outputText}
11504
12266
  }
11505
12267
  const result = await manager.removeRuntimeMcpServer(
11506
12268
  name,
11507
- originatorClientId
12269
+ runtimeClientId
11508
12270
  );
11509
12271
  await Promise.all(
11510
12272
  this.getActiveSessions().map(async (session) => {
@@ -11513,7 +12275,7 @@ ${outputText}
11513
12275
  try {
11514
12276
  await sessionManager.removeRuntimeMcpServer(
11515
12277
  name,
11516
- originatorClientId
12278
+ runtimeClientId
11517
12279
  );
11518
12280
  } catch (sessionErr) {
11519
12281
  debugLogger7.warn(
@@ -11539,6 +12301,16 @@ ${outputText}
11539
12301
  }, "runRefresh");
11540
12302
  await runRefresh(async () => await extensionManager.refreshCache());
11541
12303
  await runRefresh(async () => await extensionManager.refreshTools());
12304
+ const discoveryConfig = this.workspaceMcpDiscoveryConfig;
12305
+ if (discoveryConfig && discoveryConfig !== config) {
12306
+ const discoveryExtensionManager = discoveryConfig.getExtensionManager();
12307
+ await runRefresh(
12308
+ async () => await discoveryExtensionManager.refreshCache()
12309
+ );
12310
+ await runRefresh(
12311
+ async () => await discoveryExtensionManager.refreshTools()
12312
+ );
12313
+ }
11542
12314
  await runRefresh(
11543
12315
  async () => await config.getGeminiClient()?.refreshSystemInstruction()
11544
12316
  );
@@ -12516,23 +13288,22 @@ ${outputText}
12516
13288
  buildAvailableModels(config) {
12517
13289
  const rawCurrentModelId = (config.getModel() || this.config.getModel() || "").trim();
12518
13290
  const currentAuthType = config.getAuthType();
12519
- const allConfiguredModels = config.getAllConfiguredModels().filter(isMainSelectableModel);
13291
+ const modelOptions = buildAcpModelOptions(config.getAllConfiguredModels());
12520
13292
  const activeRuntimeSnapshot = config.getActiveRuntimeModelSnapshot?.();
12521
- const currentModelId = activeRuntimeSnapshot ? formatAcpModelId(
12522
- activeRuntimeSnapshot.id,
12523
- activeRuntimeSnapshot.authType
12524
- ) : this.formatCurrentModelId(rawCurrentModelId, currentAuthType);
12525
- const mappedAvailableModels = allConfiguredModels.map((model) => {
12526
- const effectiveModelId = model.isRuntimeModel && model.runtimeSnapshotId ? model.runtimeSnapshotId : model.id;
12527
- return {
12528
- modelId: formatAcpModelId(effectiveModelId, model.authType),
12529
- name: model.label,
12530
- description: model.description ?? null,
12531
- _meta: {
12532
- contextLimit: model.contextWindowSize ?? tokenLimit(model.id)
12533
- }
12534
- };
12535
- });
13293
+ const currentModelId = getCurrentAcpModelId(
13294
+ modelOptions,
13295
+ activeRuntimeSnapshot?.id ?? rawCurrentModelId,
13296
+ activeRuntimeSnapshot?.authType ?? currentAuthType,
13297
+ activeRuntimeSnapshot ? void 0 : config.getCurrentModelRegistryBaseUrl?.()
13298
+ );
13299
+ const mappedAvailableModels = modelOptions.map(({ model, modelId }) => ({
13300
+ modelId,
13301
+ name: model.label,
13302
+ description: model.description ?? null,
13303
+ _meta: {
13304
+ contextLimit: model.contextWindowSize ?? tokenLimit(model.id)
13305
+ }
13306
+ }));
12536
13307
  return {
12537
13308
  currentModelId,
12538
13309
  availableModels: mappedAvailableModels
@@ -12552,14 +13323,16 @@ ${outputText}
12552
13323
  }
12553
13324
  buildConfigOptions(config) {
12554
13325
  const currentApprovalMode = config.getApprovalMode();
12555
- const allConfiguredModels = config.getAllConfiguredModels().filter(isMainSelectableModel);
13326
+ const modelOptions = buildAcpModelOptions(config.getAllConfiguredModels());
12556
13327
  const rawCurrentModelId = (config.getModel() || "").trim();
12557
13328
  const currentAuthType = config.getAuthType?.();
12558
13329
  const activeRuntimeSnapshot = config.getActiveRuntimeModelSnapshot?.();
12559
- const currentModelId = activeRuntimeSnapshot ? formatAcpModelId(
12560
- activeRuntimeSnapshot.id,
12561
- activeRuntimeSnapshot.authType
12562
- ) : this.formatCurrentModelId(rawCurrentModelId, currentAuthType);
13330
+ const currentModelId = getCurrentAcpModelId(
13331
+ modelOptions,
13332
+ activeRuntimeSnapshot?.id ?? rawCurrentModelId,
13333
+ activeRuntimeSnapshot?.authType ?? currentAuthType,
13334
+ activeRuntimeSnapshot ? void 0 : config.getCurrentModelRegistryBaseUrl?.()
13335
+ );
12563
13336
  const modeOptions = APPROVAL_MODES.map((mode) => ({
12564
13337
  value: mode,
12565
13338
  name: APPROVAL_MODE_INFO[mode].name,
@@ -12574,14 +13347,11 @@ ${outputText}
12574
13347
  currentValue: currentApprovalMode,
12575
13348
  options: modeOptions
12576
13349
  };
12577
- const modelOptions = allConfiguredModels.map((model) => {
12578
- const effectiveModelId = model.isRuntimeModel && model.runtimeSnapshotId ? model.runtimeSnapshotId : model.id;
12579
- return {
12580
- value: formatAcpModelId(effectiveModelId, model.authType),
12581
- name: model.label,
12582
- description: model.description ?? ""
12583
- };
12584
- });
13350
+ const configModelOptions = modelOptions.map(({ model, modelId }) => ({
13351
+ value: modelId,
13352
+ name: model.label,
13353
+ description: model.description ?? ""
13354
+ }));
12585
13355
  const modelConfigOption = {
12586
13356
  id: "model",
12587
13357
  name: "Model",
@@ -12589,19 +13359,11 @@ ${outputText}
12589
13359
  category: "model",
12590
13360
  type: "select",
12591
13361
  currentValue: currentModelId,
12592
- options: modelOptions
13362
+ options: configModelOptions
12593
13363
  };
12594
13364
  return [modeConfigOption, modelConfigOption];
12595
13365
  }
12596
- formatCurrentModelId(baseModelId, authType) {
12597
- if (!baseModelId) return baseModelId;
12598
- return authType ? formatAcpModelId(baseModelId, authType) : baseModelId;
12599
- }
12600
13366
  };
12601
- function isMainSelectableModel(model) {
12602
- return model.fastOnly !== true && model.voiceOnly !== true;
12603
- }
12604
- __name(isMainSelectableModel, "isMainSelectableModel");
12605
13367
  function diffSettingsKeys(oldMerged, newMerged) {
12606
13368
  const changed = /* @__PURE__ */ new Set();
12607
13369
  const allKeys = /* @__PURE__ */ new Set([