@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
@@ -16,9 +16,6 @@ import {
16
16
  import {
17
17
  normalizeCompactedReplayMaxBytes
18
18
  } from "./chunk-COH43MRJ.js";
19
- import {
20
- MCP_RESTART_SERVER_DEADLINE_MS
21
- } from "./chunk-OCPBI7J5.js";
22
19
  import {
23
20
  BranchWhilePromptActiveError,
24
21
  CancelSentinelCollisionError,
@@ -28,6 +25,7 @@ import {
28
25
  InvalidRewindTargetError,
29
26
  InvalidSessionMetadataError,
30
27
  InvalidSessionScopeError,
28
+ MCP_RESTART_SERVER_DEADLINE_MS,
31
29
  PermissionForbiddenError,
32
30
  PromptQueueFullError,
33
31
  RestoreInProgressError,
@@ -38,10 +36,10 @@ import {
38
36
  SessionShellDisabledError,
39
37
  WorkspaceMismatchError,
40
38
  isNotCurrentlyGeneratingCancelError
41
- } from "./chunk-KSO42X3Z.js";
39
+ } from "./chunk-X6YQWCIJ.js";
42
40
  import {
43
41
  defaultSpawnChannelFactory
44
- } from "./chunk-UFOKA4PR.js";
42
+ } from "./chunk-VHCSIMTF.js";
45
43
  import {
46
44
  BridgeChannelClosedError,
47
45
  BridgeTimeoutError,
@@ -50,7 +48,7 @@ import {
50
48
  STATUS_SCHEMA_VERSION,
51
49
  createIdleWorkspaceExtensionsStatus,
52
50
  createIdleWorkspaceHooksStatus
53
- } from "./chunk-CUUXANEQ.js";
51
+ } from "./chunk-W6J7RSCK.js";
54
52
  import {
55
53
  canonicalizeWorkspace
56
54
  } from "./chunk-W7FJ3N32.js";
@@ -70,11 +68,11 @@ import {
70
68
  metadataBudgetBytes,
71
69
  normalizeSnapshotPayload,
72
70
  stableSessionArtifactId
73
- } from "./chunk-K7CRWKOE.js";
71
+ } from "./chunk-R6AO7HBQ.js";
74
72
  import {
75
73
  DAEMON_TRACEPARENT_META_KEY,
76
74
  DAEMON_TRACESTATE_META_KEY
77
- } from "./chunk-P6LART6G.js";
75
+ } from "./chunk-BTSE2DUP.js";
78
76
  import {
79
77
  init_esbuild_shims
80
78
  } from "./chunk-5O2XNYP6.js";
@@ -473,6 +471,30 @@ function mergeToolCallEvent(existing, incoming) {
473
471
  }
474
472
  __name(mergeToolCallEvent, "mergeToolCallEvent");
475
473
 
474
+ // packages/acp-bridge/src/session-source.ts
475
+ init_esbuild_shims();
476
+ var SESSION_SOURCE_TYPE_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;
477
+ var MAX_SESSION_SOURCE_ID_LENGTH = 256;
478
+ function parseSessionSource(sourceType, sourceId) {
479
+ if (sourceType === void 0 && sourceId === void 0) return {};
480
+ if (typeof sourceType !== "string" || !SESSION_SOURCE_TYPE_PATTERN.test(sourceType)) {
481
+ return {
482
+ error: "`sourceType` must match [a-z][a-z0-9_-]{0,63} when provided"
483
+ };
484
+ }
485
+ if (sourceId === void 0) return { sourceType };
486
+ if (typeof sourceId !== "string" || sourceId.length === 0 || sourceId.length > MAX_SESSION_SOURCE_ID_LENGTH || [...sourceId].some((character) => {
487
+ const code = character.charCodeAt(0);
488
+ return code <= 31 || code === 127;
489
+ })) {
490
+ return {
491
+ error: `\`sourceId\` must be a non-empty string of at most ${MAX_SESSION_SOURCE_ID_LENGTH} characters without control characters`
492
+ };
493
+ }
494
+ return { sourceType, sourceId };
495
+ }
496
+ __name(parseSessionSource, "parseSessionSource");
497
+
476
498
  // packages/acp-bridge/src/internal/stderrLine.ts
477
499
  init_esbuild_shims();
478
500
  function writeStderrLine(message) {
@@ -545,8 +567,8 @@ var MultiClientPermissionMediator = class {
545
567
  * an identical line (the unanimity condition is the NORMAL
546
568
  * operating mode for M=2, not a rare edge); a busy session with
547
569
  * many tool calls would produce dozens of duplicate stderr lines
548
- * within seconds. One emit per mediator (= per daemon lifetime
549
- * since the bridge constructs one) is enough to make the
570
+ * within seconds. One emit per mediator (= per bridge/runtime lifetime
571
+ * since each bridge constructs one) is enough to make the
550
572
  * configuration visible without spam.
551
573
  */
552
574
  unanimityBreadcrumbEmitted = false;
@@ -1392,7 +1414,7 @@ function sliceLineRange(content, startLine, endLine) {
1392
1414
  }
1393
1415
  __name(sliceLineRange, "sliceLineRange");
1394
1416
  var BridgeClient = class {
1395
- constructor(resolveEntry, resolvePendingRestoreEvents, mediator, permissionTimeoutMs, maxPendingPerSession, fileSystem, onModelPromoted, onModePromoted, clientMcpSender, ownsSession = () => true, onTokenUsage, onCreateSubSession) {
1417
+ constructor(resolveEntry, resolvePendingRestoreEvents, mediator, permissionTimeoutMs, maxPendingPerSession, fileSystem, onModelPromoted, onModePromoted, clientMcpSender, ownsSession = () => true, onTokenUsage, onCreateSubSession, onGenerationEvent) {
1396
1418
  this.resolveEntry = resolveEntry;
1397
1419
  this.resolvePendingRestoreEvents = resolvePendingRestoreEvents;
1398
1420
  this.mediator = mediator;
@@ -1405,6 +1427,7 @@ var BridgeClient = class {
1405
1427
  this.ownsSession = ownsSession;
1406
1428
  this.onTokenUsage = onTokenUsage;
1407
1429
  this.onCreateSubSession = onCreateSubSession;
1430
+ this.onGenerationEvent = onGenerationEvent;
1408
1431
  }
1409
1432
  static {
1410
1433
  __name(this, "BridgeClient");
@@ -1816,6 +1839,51 @@ var BridgeClient = class {
1816
1839
  * forward-compat.
1817
1840
  */
1818
1841
  async extNotification(method, params) {
1842
+ if (method === "qwen/notify/session/generation/event") {
1843
+ const sessionId2 = params["sessionId"];
1844
+ const requestId = params["requestId"];
1845
+ const event = params["event"];
1846
+ if (params["v"] !== 1 || typeof sessionId2 !== "string" || typeof requestId !== "string" || !event || typeof event !== "object" || Array.isArray(event)) {
1847
+ return;
1848
+ }
1849
+ const record = event;
1850
+ if (record["type"] === "started") {
1851
+ const model = record["model"];
1852
+ const modelSource = record["modelSource"];
1853
+ if (typeof model !== "string" || modelSource !== "fast" && modelSource !== "main") {
1854
+ return;
1855
+ }
1856
+ this.onGenerationEvent?.(sessionId2, {
1857
+ type: "started",
1858
+ requestId,
1859
+ model,
1860
+ modelSource
1861
+ });
1862
+ return;
1863
+ }
1864
+ if (record["type"] === "thinking") {
1865
+ this.onGenerationEvent?.(sessionId2, {
1866
+ type: "thinking",
1867
+ requestId
1868
+ });
1869
+ return;
1870
+ }
1871
+ if (record["type"] === "delta") {
1872
+ const seq = record["seq"];
1873
+ const text = record["text"];
1874
+ if (typeof seq !== "number" || !Number.isSafeInteger(seq) || seq < 0 || typeof text !== "string" || text.length === 0) {
1875
+ return;
1876
+ }
1877
+ this.onGenerationEvent?.(sessionId2, {
1878
+ type: "delta",
1879
+ requestId,
1880
+ seq,
1881
+ text
1882
+ });
1883
+ return;
1884
+ }
1885
+ return;
1886
+ }
1819
1887
  if (method === "qwen/notify/session/model-update") {
1820
1888
  this.handleInSessionModelUpdate(params);
1821
1889
  return;
@@ -2432,6 +2500,77 @@ function extractA2uiToolUpdate(params) {
2432
2500
  }
2433
2501
  __name(extractA2uiToolUpdate, "extractA2uiToolUpdate");
2434
2502
 
2503
+ // packages/acp-bridge/src/generation-stream.ts
2504
+ init_esbuild_shims();
2505
+ var GenerationStreamQueue = class {
2506
+ constructor(capacity) {
2507
+ this.capacity = capacity;
2508
+ }
2509
+ static {
2510
+ __name(this, "GenerationStreamQueue");
2511
+ }
2512
+ values = [];
2513
+ waiter;
2514
+ closed = false;
2515
+ failure;
2516
+ push(value) {
2517
+ if (this.closed) return false;
2518
+ if (this.waiter) {
2519
+ const waiter = this.waiter;
2520
+ this.waiter = void 0;
2521
+ waiter.resolve({ value, done: false });
2522
+ return true;
2523
+ }
2524
+ if (this.values.length >= this.capacity) return false;
2525
+ this.values.push(value);
2526
+ return true;
2527
+ }
2528
+ close() {
2529
+ if (this.closed) return;
2530
+ this.closed = true;
2531
+ this.settleWaiter();
2532
+ }
2533
+ fail(error) {
2534
+ if (this.closed) return;
2535
+ this.failure = error;
2536
+ this.closed = true;
2537
+ this.settleWaiter();
2538
+ }
2539
+ settleWaiter() {
2540
+ if (!this.waiter) return;
2541
+ const waiter = this.waiter;
2542
+ this.waiter = void 0;
2543
+ if (this.failure !== void 0) waiter.reject(this.failure);
2544
+ else waiter.resolve({ value: void 0, done: true });
2545
+ }
2546
+ next() {
2547
+ if (this.values.length > 0) {
2548
+ return Promise.resolve({ value: this.values.shift(), done: false });
2549
+ }
2550
+ if (this.failure !== void 0) return Promise.reject(this.failure);
2551
+ if (this.closed) {
2552
+ return Promise.resolve({ value: void 0, done: true });
2553
+ }
2554
+ if (this.waiter) {
2555
+ return Promise.reject(
2556
+ new Error("GenerationStreamQueue supports only one pending reader")
2557
+ );
2558
+ }
2559
+ return new Promise((resolve2, reject) => {
2560
+ this.waiter = { resolve: resolve2, reject };
2561
+ });
2562
+ }
2563
+ [Symbol.asyncIterator]() {
2564
+ return {
2565
+ next: /* @__PURE__ */ __name(() => this.next(), "next"),
2566
+ return: /* @__PURE__ */ __name(async () => {
2567
+ this.close();
2568
+ return { value: void 0, done: true };
2569
+ }, "return")
2570
+ };
2571
+ }
2572
+ };
2573
+
2435
2574
  // packages/acp-bridge/src/sessionArtifacts.ts
2436
2575
  init_esbuild_shims();
2437
2576
  import { createHash } from "node:crypto";
@@ -4660,6 +4799,14 @@ function isRecord2(value) {
4660
4799
  return typeof value === "object" && value !== null && !Array.isArray(value);
4661
4800
  }
4662
4801
  __name(isRecord2, "isRecord");
4802
+ function getCanonicalModelId(response, fallback) {
4803
+ if (!isRecord2(response) || !isRecord2(response["_meta"])) return fallback;
4804
+ const modelSwitch = response["_meta"]["qwenModelSwitch"];
4805
+ if (!isRecord2(modelSwitch)) return fallback;
4806
+ const modelId = modelSwitch["modelId"];
4807
+ return typeof modelId === "string" ? modelId : fallback;
4808
+ }
4809
+ __name(getCanonicalModelId, "getCanonicalModelId");
4663
4810
  function isBulkReplayUpdate(value) {
4664
4811
  if (!isRecord2(value)) return false;
4665
4812
  const updateType = value["sessionUpdate"];
@@ -5027,6 +5174,8 @@ var MCP_OAUTH_TIMEOUT_MS = 6e5;
5027
5174
  var DAEMON_RETRY_META_KEY = "qwen.daemon.retry";
5028
5175
  var DAEMON_CONTINUE_META_KEY = "qwen.daemon.continueLastTurn";
5029
5176
  var SESSION_RECAP_TIMEOUT_MS = 6e4;
5177
+ var SESSION_GENERATION_TIMEOUT_MS = 65e3;
5178
+ var GENERATION_STREAM_QUEUE_CAPACITY = 128;
5030
5179
  var SESSION_BTW_TIMEOUT_MS = 6e4;
5031
5180
  var SESSION_TRANSCRIPT_TIMEOUT_MS = 6e4;
5032
5181
  var SHELL_COMMAND_TIMEOUT_MS = 12e4;
@@ -5132,6 +5281,9 @@ function createAcpSessionBridge(opts) {
5132
5281
  const telemetry = opts.telemetry ?? NOOP_BRIDGE_TELEMETRY;
5133
5282
  let defaultEntry;
5134
5283
  let channelInfo;
5284
+ let workspaceMcpStatusCache;
5285
+ const workspaceMcpToolsCache = /* @__PURE__ */ new Map();
5286
+ const workspaceMcpResourcesCache = /* @__PURE__ */ new Map();
5135
5287
  let idleTimer;
5136
5288
  const sessionReapIntervalMs = resolvePositiveFiniteMs(
5137
5289
  opts.sessionReapIntervalMs,
@@ -5196,9 +5348,41 @@ function createAcpSessionBridge(opts) {
5196
5348
  function hasNoChannelWork(ci, opts2) {
5197
5349
  const inFlightSpawnCount = ci.sessionSpawnsInFlight - (opts2?.ignoreCurrentSessionSpawn === true ? 1 : 0);
5198
5350
  const pendingRestoreCount = ci.pendingRestoreIds.size - (opts2?.ignoreRestoreId !== void 0 && ci.pendingRestoreIds.has(opts2.ignoreRestoreId) ? 1 : 0);
5199
- return ci.sessionIds.size === 0 && pendingRestoreCount === 0 && ci.workspaceControlInFlight === 0 && inFlightSpawnCount === 0;
5351
+ return ci.sessionIds.size === 0 && pendingRestoreCount === 0 && ci.workspaceControlInFlight === 0 && !ci.workspaceMcpDiscoveryInFlight && ci.workspaceMcpAuthenticationServerNames.size === 0 && inFlightSpawnCount === 0;
5200
5352
  }
5201
5353
  __name(hasNoChannelWork, "hasNoChannelWork");
5354
+ function beginWorkspaceMcpDiscovery(ci) {
5355
+ workspaceMcpStatusCache = void 0;
5356
+ workspaceMcpToolsCache.clear();
5357
+ workspaceMcpResourcesCache.clear();
5358
+ ci.workspaceMcpDiscoveryInFlight = true;
5359
+ if (ci.workspaceMcpDiscoveryTimer) {
5360
+ clearTimeout(ci.workspaceMcpDiscoveryTimer);
5361
+ }
5362
+ ci.workspaceMcpDiscoveryTimer = setTimeout(() => {
5363
+ ci.workspaceMcpDiscoveryTimer = void 0;
5364
+ ci.workspaceMcpDiscoveryInFlight = false;
5365
+ ci.workspaceMcpDiscoveryRequested = false;
5366
+ if (hasNoChannelWork(ci)) {
5367
+ void startIdleTimer(ci, "workspace MCP discovery timeout");
5368
+ }
5369
+ }, MCP_RESTART_TIMEOUT_MS);
5370
+ ci.workspaceMcpDiscoveryTimer.unref();
5371
+ }
5372
+ __name(beginWorkspaceMcpDiscovery, "beginWorkspaceMcpDiscovery");
5373
+ function finishWorkspaceMcpDiscovery(ci) {
5374
+ ci.workspaceMcpDiscoveryInFlight = false;
5375
+ if (ci.workspaceMcpDiscoveryTimer) {
5376
+ clearTimeout(ci.workspaceMcpDiscoveryTimer);
5377
+ ci.workspaceMcpDiscoveryTimer = void 0;
5378
+ }
5379
+ }
5380
+ __name(finishWorkspaceMcpDiscovery, "finishWorkspaceMcpDiscovery");
5381
+ function invalidateWorkspaceMcpDetailCache(serverName) {
5382
+ workspaceMcpToolsCache.delete(serverName);
5383
+ workspaceMcpResourcesCache.delete(serverName);
5384
+ }
5385
+ __name(invalidateWorkspaceMcpDetailCache, "invalidateWorkspaceMcpDetailCache");
5202
5386
  async function reapPendingEmptyChannel(ci) {
5203
5387
  if (!ci.emptyReapPending || !hasNoChannelWork(ci)) return;
5204
5388
  ci.emptyReapPending = false;
@@ -5262,6 +5446,7 @@ function createAcpSessionBridge(opts) {
5262
5446
  const aliveChannels = /* @__PURE__ */ new Set();
5263
5447
  let inFlightChannelSpawn;
5264
5448
  const byId = /* @__PURE__ */ new Map();
5449
+ const generationRequests = /* @__PURE__ */ new Map();
5265
5450
  const inFlightExtensionRefreshes = /* @__PURE__ */ new Map();
5266
5451
  const toSessionSummary = /* @__PURE__ */ __name((entry) => {
5267
5452
  let isWaitingForPermission = false;
@@ -5279,6 +5464,8 @@ function createAcpSessionBridge(opts) {
5279
5464
  createdAt: entry.createdAt,
5280
5465
  displayName: entry.displayName,
5281
5466
  ...entry.parentSessionId ? { parentSessionId: entry.parentSessionId } : {},
5467
+ ...entry.sourceType ? { sourceType: entry.sourceType } : {},
5468
+ ...entry.sourceId !== void 0 ? { sourceId: entry.sourceId } : {},
5282
5469
  clientCount: entry.clientIds.size,
5283
5470
  hasActivePrompt: entry.promptActive,
5284
5471
  isWaitingForPermission,
@@ -5376,11 +5563,13 @@ function createAcpSessionBridge(opts) {
5376
5563
  if (channelInfo && !channelInfo.isDying) return channelInfo;
5377
5564
  if (inFlightChannelSpawn) return await inFlightChannelSpawn;
5378
5565
  const promise = (async () => {
5566
+ const acpChannelId = randomUUID2();
5379
5567
  const channel = await telemetry.withSpan(
5380
5568
  "channel.spawn",
5381
5569
  {
5382
5570
  "qwen-code.daemon.bridge.operation": "channel.spawn",
5383
- "qwen-code.daemon.channel.reused": false
5571
+ "qwen-code.daemon.channel.reused": false,
5572
+ "qwen-code.daemon.acp_channel.id": acpChannelId
5384
5573
  },
5385
5574
  async () => await channelFactory(boundWorkspace, childEnvOverrides)
5386
5575
  );
@@ -5450,10 +5639,23 @@ function createAcpSessionBridge(opts) {
5450
5639
  // `create_sub_session` tool: forward the request/response hook so a child
5451
5640
  // tool can ask the daemon to spawn a sub-session and (for 'first-turn')
5452
5641
  // return its result. Omitted → the method reports daemon-only.
5453
- opts.onCreateSubSession
5642
+ opts.onCreateSubSession,
5643
+ (sessionId, event) => {
5644
+ const request = generationRequests.get(event.requestId);
5645
+ if (!request || request.sessionId !== sessionId) return;
5646
+ if (request.queue.push(event)) return;
5647
+ request.settled = true;
5648
+ generationRequests.delete(event.requestId);
5649
+ request.queue.fail(new Error("Generation stream consumer too slow"));
5650
+ void request.connection.extMethod(SERVE_CONTROL_EXT_METHODS.sessionGenerationCancel, {
5651
+ sessionId,
5652
+ requestId: event.requestId
5653
+ }).catch(() => void 0);
5654
+ }
5454
5655
  );
5455
5656
  const connection = new ClientSideConnection(() => client, channel.stream);
5456
5657
  const info = {
5658
+ id: acpChannelId,
5457
5659
  channel,
5458
5660
  connection,
5459
5661
  client,
@@ -5461,6 +5663,10 @@ function createAcpSessionBridge(opts) {
5461
5663
  pendingRestoreIds: /* @__PURE__ */ new Set(),
5462
5664
  sessionSpawnsInFlight: 0,
5463
5665
  workspaceControlInFlight: 0,
5666
+ workspaceMcpDiscoveryInFlight: false,
5667
+ workspaceMcpDiscoveryRequested: false,
5668
+ workspaceMcpAuthenticationServerNames: /* @__PURE__ */ new Set(),
5669
+ workspaceMcpAuthenticationTimers: /* @__PURE__ */ new Map(),
5464
5670
  emptyReapPending: false,
5465
5671
  isDying: false,
5466
5672
  handshakeComplete: false
@@ -5473,6 +5679,15 @@ function createAcpSessionBridge(opts) {
5473
5679
  }
5474
5680
  void channel.exited.then((exitInfo) => {
5475
5681
  if (channelInfo === info) cancelIdleTimer();
5682
+ if (info.workspaceMcpDiscoveryTimer) {
5683
+ clearTimeout(info.workspaceMcpDiscoveryTimer);
5684
+ info.workspaceMcpDiscoveryTimer = void 0;
5685
+ }
5686
+ for (const timer of info.workspaceMcpAuthenticationTimers.values()) {
5687
+ clearTimeout(timer);
5688
+ }
5689
+ info.workspaceMcpAuthenticationTimers.clear();
5690
+ info.workspaceMcpAuthenticationServerNames.clear();
5476
5691
  aliveChannels.delete(info);
5477
5692
  if (channelInfo === info) channelInfo = void 0;
5478
5693
  const sessions = Array.from(info.sessionIds);
@@ -5530,7 +5745,8 @@ function createAcpSessionBridge(opts) {
5530
5745
  await telemetry.withSpan(
5531
5746
  "channel.initialize",
5532
5747
  {
5533
- "qwen-code.daemon.bridge.operation": "channel.initialize"
5748
+ "qwen-code.daemon.bridge.operation": "channel.initialize",
5749
+ "qwen-code.daemon.acp_channel.id": acpChannelId
5534
5750
  },
5535
5751
  async () => await withTimeout(
5536
5752
  connection.initialize({
@@ -5569,8 +5785,16 @@ function createAcpSessionBridge(opts) {
5569
5785
  }
5570
5786
  }
5571
5787
  __name(ensureChannel, "ensureChannel");
5572
- async function doSpawn(modelServiceId, effectiveScope, approvalMode, requestedClientId, onSessionRegistered, parentSessionId) {
5573
- const ci = await ensureChannel();
5788
+ async function doSpawn(modelServiceId, effectiveScope, approvalMode, requestedClientId, onSessionRegistered, parentSessionId, sourceType, sourceId) {
5789
+ const channelPath = channelInfo && !channelInfo.isDying ? "reused" : inFlightChannelSpawn ? "joined" : "spawned_on_request";
5790
+ const ci = await telemetry.withSpan(
5791
+ "channel.wait",
5792
+ {
5793
+ "qwen-code.daemon.bridge.operation": "channel.wait",
5794
+ "qwen-code.daemon.channel.path": channelPath
5795
+ },
5796
+ ensureChannel
5797
+ );
5574
5798
  ci.sessionSpawnsInFlight++;
5575
5799
  let sessionRegistered = false;
5576
5800
  let sessionRemovedDuringInitialization = false;
@@ -5582,16 +5806,27 @@ function createAcpSessionBridge(opts) {
5582
5806
  "session.new",
5583
5807
  {
5584
5808
  "qwen-code.daemon.bridge.operation": "session.new",
5585
- "qwen-code.daemon.session_scope": effectiveScope
5809
+ "qwen-code.daemon.session_scope": effectiveScope,
5810
+ "qwen-code.daemon.channel.path": channelPath,
5811
+ "qwen-code.daemon.acp_channel.id": ci.id
5586
5812
  },
5587
- async () => await withTimeout(
5588
- ci.connection.newSession({
5589
- cwd: boundWorkspace,
5590
- mcpServers: []
5591
- }),
5592
- initTimeoutMs,
5593
- "newSession"
5594
- )
5813
+ async () => {
5814
+ const response = await withTimeout(
5815
+ ci.connection.newSession(
5816
+ telemetry.injectPromptContext({
5817
+ cwd: boundWorkspace,
5818
+ mcpServers: []
5819
+ })
5820
+ ),
5821
+ initTimeoutMs,
5822
+ "newSession"
5823
+ );
5824
+ telemetry.event("session.new.completed", {
5825
+ "session.id": response.sessionId,
5826
+ "qwen-code.daemon.acp_channel.id": ci.id
5827
+ });
5828
+ return response;
5829
+ }
5595
5830
  );
5596
5831
  } catch (err) {
5597
5832
  if (hasNoChannelWork(ci, { ignoreCurrentSessionSpawn: true })) {
@@ -5611,7 +5846,7 @@ function createAcpSessionBridge(opts) {
5611
5846
  newSessionResp.sessionId,
5612
5847
  boundWorkspace,
5613
5848
  void 0,
5614
- { parentSessionId }
5849
+ { parentSessionId, sourceType, sourceId }
5615
5850
  );
5616
5851
  initializedSessionId = entry.sessionId;
5617
5852
  sessionRegistered = true;
@@ -5661,6 +5896,32 @@ function createAcpSessionBridge(opts) {
5661
5896
  );
5662
5897
  }
5663
5898
  }
5899
+ let sourcePersisted;
5900
+ if (entry.sourceType) {
5901
+ try {
5902
+ const sourceResult = await Promise.race([
5903
+ withTimeout(
5904
+ entry.connection.extMethod(
5905
+ SERVE_CONTROL_EXT_METHODS.sessionSource,
5906
+ {
5907
+ sessionId: entry.sessionId,
5908
+ sourceType: entry.sourceType,
5909
+ ...entry.sourceId !== void 0 ? { sourceId: entry.sourceId } : {}
5910
+ }
5911
+ ),
5912
+ initTimeoutMs,
5913
+ "sessionSource"
5914
+ ),
5915
+ getTransportClosedReject(entry)
5916
+ ]);
5917
+ sourcePersisted = sourceResult?.persisted === true;
5918
+ } catch (err) {
5919
+ sourcePersisted = false;
5920
+ writeStderrLine(
5921
+ `qwen serve: source metadata for ${entry.sessionId} was not persisted (${err instanceof Error ? err.message : String(err)}) \u2014 the source is live-only until restart (reported to the caller via sourcePersisted=false)`
5922
+ );
5923
+ }
5924
+ }
5664
5925
  if (modelServiceId) {
5665
5926
  await applyModelServiceId(
5666
5927
  entry,
@@ -5696,6 +5957,9 @@ function createAcpSessionBridge(opts) {
5696
5957
  attached: false,
5697
5958
  clientId,
5698
5959
  createdAt: entry.createdAt,
5960
+ ...entry.sourceType ? { sourceType: entry.sourceType } : {},
5961
+ ...entry.sourceId !== void 0 ? { sourceId: entry.sourceId } : {},
5962
+ ...entry.sourceType ? { sourcePersisted: sourcePersisted === true } : {},
5699
5963
  ...entry.parentSessionId ? { parentSessionPersisted: parentSessionPersisted === true } : {}
5700
5964
  };
5701
5965
  } finally {
@@ -5726,7 +5990,7 @@ function createAcpSessionBridge(opts) {
5726
5990
  entry.modelRoundtripInFlight = true;
5727
5991
  let succeeded = false;
5728
5992
  try {
5729
- await Promise.race([
5993
+ const result = await Promise.race([
5730
5994
  withTimeout(
5731
5995
  conn.unstable_setSessionModel({
5732
5996
  sessionId: entry.sessionId,
@@ -5742,7 +6006,7 @@ function createAcpSessionBridge(opts) {
5742
6006
  type: "settings_changed",
5743
6007
  data: {
5744
6008
  key: "model.name",
5745
- value: modelId
6009
+ value: getCanonicalModelId(result, modelId)
5746
6010
  },
5747
6011
  ...originatorClientId ? { originatorClientId } : {}
5748
6012
  });
@@ -5943,10 +6207,77 @@ function createAcpSessionBridge(opts) {
5943
6207
  }
5944
6208
  return info.statusClosedReject;
5945
6209
  }, "getChannelClosedReject");
5946
- const requestWorkspaceStatus = /* @__PURE__ */ __name(async (method, idle, params = {}) => {
6210
+ const cacheWorkspaceMcpDetails = /* @__PURE__ */ __name(async (info, status) => {
6211
+ if (!Array.isArray(status.servers)) return;
6212
+ const serverNames = status.servers.flatMap(
6213
+ (server) => isRecord2(server) && typeof server["name"] === "string" && server["mcpStatus"] === "connected" ? [server["name"]] : []
6214
+ );
6215
+ const cacheDetail = /* @__PURE__ */ __name(async (serverName, method, cache) => {
6216
+ try {
6217
+ const result = await withTimeout(
6218
+ Promise.race([
6219
+ info.connection.extMethod(method, {
6220
+ serverName,
6221
+ cwd: boundWorkspace
6222
+ }),
6223
+ getChannelClosedReject(info)
6224
+ ]),
6225
+ initTimeoutMs,
6226
+ method
6227
+ );
6228
+ cache.set(serverName, result);
6229
+ } catch {
6230
+ }
6231
+ }, "cacheDetail");
6232
+ await Promise.all(
6233
+ serverNames.flatMap((serverName) => [
6234
+ cacheDetail(
6235
+ serverName,
6236
+ SERVE_STATUS_EXT_METHODS.workspaceMcpTools,
6237
+ workspaceMcpToolsCache
6238
+ ),
6239
+ cacheDetail(
6240
+ serverName,
6241
+ SERVE_STATUS_EXT_METHODS.workspaceMcpResources,
6242
+ workspaceMcpResourcesCache
6243
+ )
6244
+ ])
6245
+ );
6246
+ }, "cacheWorkspaceMcpDetails");
6247
+ const mergeManagedWorkspaceMcpStatus = /* @__PURE__ */ __name((serverNames, previous, current) => {
6248
+ if (Array.isArray(current.servers) && previous?.discoveryState === "completed" && current.discoveryState === "not_started") {
6249
+ if (current.servers.length === 0) return previous;
6250
+ const currentServers = new Map(
6251
+ current.servers.map((server) => [server.name, server])
6252
+ );
6253
+ const previousNames = new Set(
6254
+ previous.servers.map((server) => server.name)
6255
+ );
6256
+ const servers = previous.servers.map(
6257
+ (server) => serverNames.has(server.name) ? currentServers.get(server.name) ?? server : server
6258
+ );
6259
+ for (const server of current.servers) {
6260
+ if (serverNames.has(server.name) && !previousNames.has(server.name)) {
6261
+ servers.push(server);
6262
+ }
6263
+ }
6264
+ return {
6265
+ ...previous,
6266
+ discoveryState: "completed",
6267
+ servers
6268
+ };
6269
+ }
6270
+ return current;
6271
+ }, "mergeManagedWorkspaceMcpStatus");
6272
+ const requestWorkspaceStatus = /* @__PURE__ */ __name(async (method, idle, params = {}, managedServerNames) => {
5947
6273
  const info = liveChannelInfo();
5948
- if (!info) return idle();
5949
- const response = await withTimeout(
6274
+ if (!info) {
6275
+ if (method === SERVE_STATUS_EXT_METHODS.workspaceMcp && workspaceMcpStatusCache) {
6276
+ return workspaceMcpStatusCache;
6277
+ }
6278
+ return idle();
6279
+ }
6280
+ let response = await withTimeout(
5950
6281
  Promise.race([
5951
6282
  info.connection.extMethod(method, { ...params, cwd: boundWorkspace }),
5952
6283
  getChannelClosedReject(info)
@@ -5954,6 +6285,67 @@ function createAcpSessionBridge(opts) {
5954
6285
  initTimeoutMs,
5955
6286
  method
5956
6287
  );
6288
+ if (method === SERVE_STATUS_EXT_METHODS.workspaceMcp) {
6289
+ const rawStatus = response;
6290
+ if (!Array.isArray(rawStatus.servers)) {
6291
+ return response;
6292
+ }
6293
+ const rawServers = rawStatus.servers;
6294
+ const effectiveManagedServerNames = /* @__PURE__ */ new Set([
6295
+ ...info.workspaceMcpAuthenticationServerNames,
6296
+ ...managedServerNames ?? []
6297
+ ]);
6298
+ if (effectiveManagedServerNames.size > 0 || workspaceMcpStatusCache?.discoveryState === "completed" && rawStatus.discoveryState === "not_started" && rawServers.length === 0) {
6299
+ response = mergeManagedWorkspaceMcpStatus(
6300
+ effectiveManagedServerNames,
6301
+ workspaceMcpStatusCache,
6302
+ rawStatus
6303
+ );
6304
+ }
6305
+ const status = response;
6306
+ if (status.discoveryState === "completed") {
6307
+ await cacheWorkspaceMcpDetails(
6308
+ info,
6309
+ effectiveManagedServerNames.size > 0 ? {
6310
+ servers: rawServers.filter(
6311
+ (server) => effectiveManagedServerNames.has(server.name)
6312
+ )
6313
+ } : status
6314
+ );
6315
+ }
6316
+ if (info.workspaceMcpDiscoveryInFlight && (status.discoveryState === "completed" || Array.isArray(status.errors) && status.errors.length > 0)) {
6317
+ finishWorkspaceMcpDiscovery(info);
6318
+ if (hasNoChannelWork(info)) {
6319
+ await startIdleTimer(info, "workspace MCP discovery complete");
6320
+ }
6321
+ }
6322
+ if (status.discoveryState === "completed") {
6323
+ info.workspaceMcpDiscoveryRequested = true;
6324
+ } else if (status.discoveryState === "in_progress") {
6325
+ info.workspaceMcpDiscoveryRequested = true;
6326
+ } else if (Array.isArray(status.errors) && status.errors.length > 0) {
6327
+ info.workspaceMcpDiscoveryRequested = false;
6328
+ }
6329
+ let authenticationCompleted = false;
6330
+ for (const serverName of info.workspaceMcpAuthenticationServerNames) {
6331
+ const server = rawServers.find(
6332
+ (candidate) => candidate.name === serverName
6333
+ );
6334
+ if (server?.authenticationState !== "pending" && (server !== void 0 || rawStatus.discoveryState === "completed")) {
6335
+ info.workspaceMcpAuthenticationServerNames.delete(serverName);
6336
+ const timer = info.workspaceMcpAuthenticationTimers.get(serverName);
6337
+ if (timer) clearTimeout(timer);
6338
+ info.workspaceMcpAuthenticationTimers.delete(serverName);
6339
+ authenticationCompleted = true;
6340
+ }
6341
+ }
6342
+ if (authenticationCompleted) {
6343
+ if (hasNoChannelWork(info)) {
6344
+ await startIdleTimer(info, "workspace MCP authentication complete");
6345
+ }
6346
+ }
6347
+ workspaceMcpStatusCache = response;
6348
+ }
5957
6349
  return response;
5958
6350
  }, "requestWorkspaceStatus");
5959
6351
  const STALE_CHILD_RESOURCE_MS = 3e4;
@@ -6177,6 +6569,8 @@ function createAcpSessionBridge(opts) {
6177
6569
  workspaceCwd,
6178
6570
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
6179
6571
  ...options.parentSessionId ? { parentSessionId: options.parentSessionId } : {},
6572
+ ...options.sourceType ? { sourceType: options.sourceType } : {},
6573
+ ...options.sourceId !== void 0 ? { sourceId: options.sourceId } : {},
6180
6574
  channel: ci.channel,
6181
6575
  connection: ci.connection,
6182
6576
  events,
@@ -6411,6 +6805,8 @@ function createAcpSessionBridge(opts) {
6411
6805
  attached: true,
6412
6806
  clientId,
6413
6807
  createdAt: existing.createdAt,
6808
+ ...existing.sourceType ? { sourceType: existing.sourceType } : {},
6809
+ ...existing.sourceId !== void 0 ? { sourceId: existing.sourceId } : {},
6414
6810
  // Late attachers get the same ACP state the original restore
6415
6811
  // caller saw; spawn-only sessions don't carry a state payload.
6416
6812
  state: existing.restoreState ?? {},
@@ -6583,6 +6979,8 @@ function createAcpSessionBridge(opts) {
6583
6979
  attached: true,
6584
6980
  clientId: clientId2,
6585
6981
  createdAt: racedEntry.createdAt,
6982
+ ...racedEntry.sourceType ? { sourceType: racedEntry.sourceType } : {},
6983
+ ...racedEntry.sourceId !== void 0 ? { sourceId: racedEntry.sourceId } : {},
6586
6984
  state: racedEntry.restoreState ?? {},
6587
6985
  hasActivePrompt: racedEntry.promptActive,
6588
6986
  ...replayFieldsFor(racedEntry, action)
@@ -6598,7 +6996,9 @@ function createAcpSessionBridge(opts) {
6598
6996
  lifecycleReason: action,
6599
6997
  // Re-seed the persisted parent lineage the caller recovered from the
6600
6998
  // transcript, so a restored sub-session's status reports its parent.
6601
- ...req.parentSessionId ? { parentSessionId: req.parentSessionId } : {}
6999
+ ...req.parentSessionId ? { parentSessionId: req.parentSessionId } : {},
7000
+ ...req.sourceType ? { sourceType: req.sourceType } : {},
7001
+ ...req.sourceId !== void 0 ? { sourceId: req.sourceId } : {}
6602
7002
  }
6603
7003
  );
6604
7004
  releaseAdmissionOnce();
@@ -6643,6 +7043,8 @@ function createAcpSessionBridge(opts) {
6643
7043
  attached: false,
6644
7044
  clientId,
6645
7045
  createdAt: entry.createdAt,
7046
+ ...entry.sourceType ? { sourceType: entry.sourceType } : {},
7047
+ ...entry.sourceId !== void 0 ? { sourceId: entry.sourceId } : {},
6646
7048
  state: publicState,
6647
7049
  ...artifactRestoreWarnings.length > 0 ? { artifactWarnings: artifactRestoreWarnings } : {},
6648
7050
  hasActivePrompt: entry.promptActive,
@@ -6863,6 +7265,10 @@ function createAcpSessionBridge(opts) {
6863
7265
  throw new InvalidSessionScopeError(req.sessionScope);
6864
7266
  }
6865
7267
  const effectiveScope = req.sessionScope ?? defaultSessionScope;
7268
+ const source = parseSessionSource(req.sourceType, req.sourceId);
7269
+ if ("error" in source) {
7270
+ throw new InvalidSessionMetadataError("sourceType", source.error);
7271
+ }
6866
7272
  if (req.approvalMode !== void 0 && !KNOWN_APPROVAL_MODES.has(req.approvalMode)) {
6867
7273
  throw new Error(
6868
7274
  `Invalid approvalMode: ${JSON.stringify(req.approvalMode)}`
@@ -6895,6 +7301,8 @@ function createAcpSessionBridge(opts) {
6895
7301
  attached: true,
6896
7302
  clientId,
6897
7303
  createdAt: existing.createdAt,
7304
+ ...existing.sourceType ? { sourceType: existing.sourceType } : {},
7305
+ ...existing.sourceId !== void 0 ? { sourceId: existing.sourceId } : {},
6898
7306
  hasActivePrompt: existing.promptActive
6899
7307
  };
6900
7308
  }
@@ -6953,7 +7361,9 @@ function createAcpSessionBridge(opts) {
6953
7361
  req.approvalMode,
6954
7362
  req.clientId,
6955
7363
  releaseAdmissionOnce,
6956
- req.parentSessionId
7364
+ req.parentSessionId,
7365
+ source.sourceType,
7366
+ source.sourceId
6957
7367
  );
6958
7368
  const tracker = effectiveScope === "single" ? workspaceKey : `${workspaceKey}#${randomUUID2()}`;
6959
7369
  inFlightSpawns.set(tracker, promise);
@@ -7728,18 +8138,39 @@ function createAcpSessionBridge(opts) {
7728
8138
  return requestWorkspaceStatus(method, idle);
7729
8139
  },
7730
8140
  async invokeWorkspaceCommand(method, params, invokeOpts) {
7731
- const info = liveChannelInfo();
8141
+ const startsWorkspaceChannel = method === SERVE_CONTROL_EXT_METHODS.workspaceMcpRestart;
8142
+ const info = startsWorkspaceChannel ? await ensureChannel() : liveChannelInfo();
7732
8143
  if (!info) throw new SessionNotFoundError(`workspace-command:${method}`);
7733
- const timeout = invokeOpts?.timeoutMs ?? initTimeoutMs;
7734
- const response = await withTimeout(
7735
- Promise.race([
7736
- info.connection.extMethod(method, params ?? {}),
7737
- getChannelClosedReject(info)
7738
- ]),
7739
- timeout,
7740
- method
7741
- );
7742
- return response;
8144
+ try {
8145
+ const timeout = invokeOpts?.timeoutMs ?? initTimeoutMs;
8146
+ const invoke = /* @__PURE__ */ __name(() => withTimeout(
8147
+ Promise.race([
8148
+ info.connection.extMethod(method, params ?? {}),
8149
+ getChannelClosedReject(info)
8150
+ ]),
8151
+ timeout,
8152
+ method
8153
+ ), "invoke");
8154
+ const response = startsWorkspaceChannel ? await withWorkspaceControl(info, invoke) : await invoke();
8155
+ if (method === SERVE_CONTROL_EXT_METHODS.workspaceMcpRestart && typeof params?.["serverName"] === "string") {
8156
+ invalidateWorkspaceMcpDetailCache(params["serverName"]);
8157
+ await requestWorkspaceStatus(
8158
+ SERVE_STATUS_EXT_METHODS.workspaceMcp,
8159
+ () => {
8160
+ throw new BridgeChannelClosedError(
8161
+ "workspace MCP restart status refresh"
8162
+ );
8163
+ },
8164
+ {},
8165
+ /* @__PURE__ */ new Set([params["serverName"]])
8166
+ );
8167
+ }
8168
+ return response;
8169
+ } finally {
8170
+ if (startsWorkspaceChannel && hasNoChannelWork(info)) {
8171
+ await startIdleTimer(info, "workspace MCP restart");
8172
+ }
8173
+ }
7743
8174
  },
7744
8175
  async isWorkspaceMemoryRememberAvailable() {
7745
8176
  const info = await ensureChannel();
@@ -7838,46 +8269,60 @@ function createAcpSessionBridge(opts) {
7838
8269
  }
7839
8270
  },
7840
8271
  async getWorkspaceMcpToolsStatus(serverName) {
7841
- return requestWorkspaceStatus(
8272
+ const result = await requestWorkspaceStatus(
7842
8273
  SERVE_STATUS_EXT_METHODS.workspaceMcpTools,
7843
- () => ({
7844
- v: STATUS_SCHEMA_VERSION,
7845
- workspaceCwd: boundWorkspace,
7846
- serverName,
7847
- initialized: false,
7848
- acpChannelLive: false,
7849
- tools: [],
7850
- errors: [
7851
- {
7852
- kind: "mcp_tools",
7853
- status: "not_started",
7854
- hint: "spawn a session to populate"
7855
- }
7856
- ]
7857
- }),
8274
+ () => {
8275
+ const cached = workspaceMcpToolsCache.get(serverName);
8276
+ return cached ? { ...cached, acpChannelLive: false } : {
8277
+ v: STATUS_SCHEMA_VERSION,
8278
+ workspaceCwd: boundWorkspace,
8279
+ serverName,
8280
+ initialized: false,
8281
+ acpChannelLive: false,
8282
+ tools: [],
8283
+ errors: [
8284
+ {
8285
+ kind: "mcp_tools",
8286
+ status: "not_started",
8287
+ hint: "initialize MCP discovery to populate"
8288
+ }
8289
+ ]
8290
+ };
8291
+ },
7858
8292
  { serverName }
7859
8293
  );
8294
+ if (result.acpChannelLive) {
8295
+ workspaceMcpToolsCache.set(serverName, result);
8296
+ }
8297
+ return result;
7860
8298
  },
7861
8299
  async getWorkspaceMcpResourcesStatus(serverName) {
7862
- return requestWorkspaceStatus(
8300
+ const result = await requestWorkspaceStatus(
7863
8301
  SERVE_STATUS_EXT_METHODS.workspaceMcpResources,
7864
- () => ({
7865
- v: STATUS_SCHEMA_VERSION,
7866
- workspaceCwd: boundWorkspace,
7867
- serverName,
7868
- initialized: false,
7869
- acpChannelLive: false,
7870
- resources: [],
7871
- errors: [
7872
- {
7873
- kind: "mcp_resources",
7874
- status: "not_started",
7875
- hint: "spawn a session to populate"
7876
- }
7877
- ]
7878
- }),
8302
+ () => {
8303
+ const cached = workspaceMcpResourcesCache.get(serverName);
8304
+ return cached ? { ...cached, acpChannelLive: false } : {
8305
+ v: STATUS_SCHEMA_VERSION,
8306
+ workspaceCwd: boundWorkspace,
8307
+ serverName,
8308
+ initialized: false,
8309
+ acpChannelLive: false,
8310
+ resources: [],
8311
+ errors: [
8312
+ {
8313
+ kind: "mcp_resources",
8314
+ status: "not_started",
8315
+ hint: "initialize MCP discovery to populate"
8316
+ }
8317
+ ]
8318
+ };
8319
+ },
7879
8320
  { serverName }
7880
8321
  );
8322
+ if (result.acpChannelLive) {
8323
+ workspaceMcpResourcesCache.set(serverName, result);
8324
+ }
8325
+ return result;
7881
8326
  },
7882
8327
  async getWorkspaceToolsStatus() {
7883
8328
  return requestWorkspaceStatus(
@@ -8117,7 +8562,7 @@ function createAcpSessionBridge(opts) {
8117
8562
  type: "settings_changed",
8118
8563
  data: {
8119
8564
  key: "model.name",
8120
- value: req.modelId
8565
+ value: getCanonicalModelId(result, req.modelId)
8121
8566
  },
8122
8567
  ...originatorClientId ? { originatorClientId } : {}
8123
8568
  });
@@ -8245,6 +8690,75 @@ function createAcpSessionBridge(opts) {
8245
8690
  recap: response.recap ?? null
8246
8691
  };
8247
8692
  },
8693
+ generateSessionContent(sessionId, prompt, signal, context) {
8694
+ const entry = byId.get(sessionId);
8695
+ if (!entry) throw new SessionNotFoundError(sessionId);
8696
+ const info = channelInfoForEntry(entry);
8697
+ if (!info || info.isDying) throw new SessionNotFoundError(sessionId);
8698
+ resolveTrustedClientId(entry, context?.clientId);
8699
+ const requestId = randomUUID2();
8700
+ const queue = new GenerationStreamQueue(
8701
+ GENERATION_STREAM_QUEUE_CAPACITY
8702
+ );
8703
+ const request = {
8704
+ sessionId,
8705
+ connection: entry.connection,
8706
+ queue,
8707
+ settled: false
8708
+ };
8709
+ generationRequests.set(requestId, request);
8710
+ const cancel = /* @__PURE__ */ __name(() => {
8711
+ if (request.settled) return;
8712
+ request.settled = true;
8713
+ generationRequests.delete(requestId);
8714
+ queue.close();
8715
+ void entry.connection.extMethod(SERVE_CONTROL_EXT_METHODS.sessionGenerationCancel, {
8716
+ sessionId,
8717
+ requestId
8718
+ }).catch(() => void 0);
8719
+ }, "cancel");
8720
+ signal.addEventListener("abort", cancel, { once: true });
8721
+ if (signal.aborted) {
8722
+ cancel();
8723
+ return queue;
8724
+ }
8725
+ void Promise.race([
8726
+ withTimeout(
8727
+ entry.connection.extMethod(
8728
+ SERVE_CONTROL_EXT_METHODS.sessionGenerationStart,
8729
+ { sessionId, requestId, prompt }
8730
+ ),
8731
+ SESSION_GENERATION_TIMEOUT_MS,
8732
+ SERVE_CONTROL_EXT_METHODS.sessionGenerationStart
8733
+ ),
8734
+ getTransportClosedReject(entry)
8735
+ ]).then((raw) => {
8736
+ if (request.settled) return;
8737
+ const response = raw;
8738
+ const model = response["model"];
8739
+ const modelSource = response["modelSource"];
8740
+ if (typeof model !== "string" || modelSource !== "fast" && modelSource !== "main") {
8741
+ throw new Error("Malformed generation completion");
8742
+ }
8743
+ const accepted = queue.push({
8744
+ type: "done",
8745
+ requestId,
8746
+ model,
8747
+ modelSource,
8748
+ ...typeof response["inputTokens"] === "number" ? { inputTokens: response["inputTokens"] } : {},
8749
+ ...typeof response["outputTokens"] === "number" ? { outputTokens: response["outputTokens"] } : {}
8750
+ });
8751
+ if (accepted) queue.close();
8752
+ else queue.fail(new Error("Generation stream consumer too slow"));
8753
+ }).catch((error) => {
8754
+ if (!request.settled) queue.fail(error);
8755
+ }).finally(() => {
8756
+ request.settled = true;
8757
+ signal.removeEventListener("abort", cancel);
8758
+ generationRequests.delete(requestId);
8759
+ });
8760
+ return queue;
8761
+ },
8248
8762
  getPendingPrompts(sessionId, context) {
8249
8763
  const entry = byId.get(sessionId);
8250
8764
  if (!entry) throw new SessionNotFoundError(sessionId);
@@ -8634,32 +9148,115 @@ function createAcpSessionBridge(opts) {
8634
9148
  };
8635
9149
  },
8636
9150
  async manageMcpServer(serverName, action, originatorClientId) {
8637
- const info = liveChannelInfo();
8638
- if (!info) {
8639
- throw new SessionNotFoundError(`mcp:${serverName}`);
9151
+ const info = await ensureChannel();
9152
+ try {
9153
+ return await withWorkspaceControl(info, async () => {
9154
+ const timeout = action === "authenticate" ? MCP_OAUTH_TIMEOUT_MS : MCP_RESTART_TIMEOUT_MS;
9155
+ const response = await Promise.race([
9156
+ withTimeout(
9157
+ info.connection.extMethod(
9158
+ SERVE_CONTROL_EXT_METHODS.workspaceMcpManage,
9159
+ { serverName, action, originatorClientId }
9160
+ ),
9161
+ timeout,
9162
+ SERVE_CONTROL_EXT_METHODS.workspaceMcpManage
9163
+ ),
9164
+ getChannelClosedReject(info)
9165
+ ]);
9166
+ if (action === "authenticate" && response.pending) {
9167
+ info.workspaceMcpAuthenticationServerNames.add(serverName);
9168
+ const previousTimer = info.workspaceMcpAuthenticationTimers.get(serverName);
9169
+ if (previousTimer) clearTimeout(previousTimer);
9170
+ const timer = setTimeout(() => {
9171
+ info.workspaceMcpAuthenticationServerNames.delete(serverName);
9172
+ info.workspaceMcpAuthenticationTimers.delete(serverName);
9173
+ if (hasNoChannelWork(info)) {
9174
+ void startIdleTimer(
9175
+ info,
9176
+ "workspace MCP authentication timeout"
9177
+ );
9178
+ }
9179
+ }, MCP_OAUTH_TIMEOUT_MS);
9180
+ timer.unref();
9181
+ info.workspaceMcpAuthenticationTimers.set(serverName, timer);
9182
+ }
9183
+ invalidateWorkspaceMcpDetailCache(serverName);
9184
+ await requestWorkspaceStatus(
9185
+ SERVE_STATUS_EXT_METHODS.workspaceMcp,
9186
+ () => {
9187
+ throw new BridgeChannelClosedError(
9188
+ "workspace MCP management status refresh"
9189
+ );
9190
+ },
9191
+ {},
9192
+ /* @__PURE__ */ new Set([serverName])
9193
+ );
9194
+ broadcastWorkspaceEvent({
9195
+ type: "mcp_server_changed",
9196
+ data: {
9197
+ serverName: response.serverName,
9198
+ action: response.action,
9199
+ originatorClientId
9200
+ },
9201
+ ...originatorClientId ? { originatorClientId } : {}
9202
+ });
9203
+ return response;
9204
+ });
9205
+ } finally {
9206
+ if (hasNoChannelWork(info)) {
9207
+ await startIdleTimer(info, "workspace MCP management");
9208
+ }
8640
9209
  }
8641
- const timeout = action === "authenticate" ? MCP_OAUTH_TIMEOUT_MS : MCP_RESTART_TIMEOUT_MS;
8642
- const response = await Promise.race([
8643
- withTimeout(
8644
- info.connection.extMethod(
8645
- SERVE_CONTROL_EXT_METHODS.workspaceMcpManage,
8646
- { serverName, action, originatorClientId }
9210
+ },
9211
+ async initializeWorkspaceMcp() {
9212
+ const info = await ensureChannel();
9213
+ info.workspaceMcpDiscoveryRequested = true;
9214
+ try {
9215
+ const result = await Promise.race([
9216
+ withTimeout(
9217
+ info.connection.extMethod(
9218
+ SERVE_CONTROL_EXT_METHODS.workspaceMcpInitialize,
9219
+ { cwd: boundWorkspace }
9220
+ ),
9221
+ initTimeoutMs,
9222
+ SERVE_CONTROL_EXT_METHODS.workspaceMcpInitialize
8647
9223
  ),
8648
- timeout,
8649
- SERVE_CONTROL_EXT_METHODS.workspaceMcpManage
8650
- ),
8651
- getChannelClosedReject(info)
8652
- ]);
8653
- broadcastWorkspaceEvent({
8654
- type: "mcp_server_changed",
8655
- data: {
8656
- serverName: response.serverName,
8657
- action: response.action,
8658
- originatorClientId
8659
- },
8660
- ...originatorClientId ? { originatorClientId } : {}
8661
- });
8662
- return response;
9224
+ getChannelClosedReject(info)
9225
+ ]);
9226
+ if (result.accepted) {
9227
+ beginWorkspaceMcpDiscovery(info);
9228
+ }
9229
+ return result;
9230
+ } finally {
9231
+ if (hasNoChannelWork(info)) {
9232
+ await startIdleTimer(info, "workspace MCP initialization");
9233
+ }
9234
+ }
9235
+ },
9236
+ async reloadWorkspaceMcp() {
9237
+ const info = await ensureChannel();
9238
+ info.workspaceMcpDiscoveryRequested = true;
9239
+ try {
9240
+ const result = await Promise.race([
9241
+ withTimeout(
9242
+ info.connection.extMethod(
9243
+ SERVE_CONTROL_EXT_METHODS.workspaceMcpReload,
9244
+ { cwd: boundWorkspace }
9245
+ ),
9246
+ initTimeoutMs,
9247
+ SERVE_CONTROL_EXT_METHODS.workspaceMcpReload
9248
+ ),
9249
+ getChannelClosedReject(info)
9250
+ ]);
9251
+ if (result.accepted) {
9252
+ beginWorkspaceMcpDiscovery(info);
9253
+ }
9254
+ return result;
9255
+ } finally {
9256
+ if (hasNoChannelWork(info)) {
9257
+ await startIdleTimer(info, "workspace MCP reload");
9258
+ }
9259
+ }
8663
9260
  },
8664
9261
  async generateWorkspaceAgent(description, _originatorClientId) {
8665
9262
  const info = liveChannelInfo();
@@ -8751,10 +9348,10 @@ function createAcpSessionBridge(opts) {
8751
9348
  },
8752
9349
  async killSession(sessionId, opts2) {
8753
9350
  const entry = byId.get(sessionId);
8754
- if (!entry) return;
9351
+ if (!entry) return false;
8755
9352
  if (opts2?.requireZeroAttaches && entry.attachCount > 0) {
8756
9353
  entry.spawnOwnerWantedKill = true;
8757
- return;
9354
+ return false;
8758
9355
  }
8759
9356
  permissionMediator.forgetSession(sessionId);
8760
9357
  entry.pendingPermissionIds.clear();
@@ -8798,6 +9395,7 @@ function createAcpSessionBridge(opts) {
8798
9395
  await startIdleTimer(ci, `killSession "${sessionId}"`);
8799
9396
  }
8800
9397
  }
9398
+ return true;
8801
9399
  },
8802
9400
  async detachClient(sessionId, clientId) {
8803
9401
  const entry = byId.get(sessionId);
@@ -8908,11 +9506,17 @@ function createAcpSessionBridge(opts) {
8908
9506
  },
8909
9507
  async preheat() {
8910
9508
  if (shuttingDown) return;
8911
- const ci = await ensureChannel();
8912
- const idleMs = resolvedChannelIdleTimeoutMs();
8913
- if (idleMs > 0 && hasNoChannelWork(ci)) {
8914
- await startIdleTimer(ci);
8915
- }
9509
+ await telemetry.withSpan(
9510
+ "channel.preheat",
9511
+ { "qwen-code.daemon.bridge.operation": "channel.preheat" },
9512
+ async () => {
9513
+ const ci = await ensureChannel();
9514
+ const idleMs = resolvedChannelIdleTimeoutMs();
9515
+ if (idleMs > 0 && hasNoChannelWork(ci)) {
9516
+ await startIdleTimer(ci);
9517
+ }
9518
+ }
9519
+ );
8916
9520
  }
8917
9521
  };
8918
9522
  return bridgeApi;
@@ -8935,6 +9539,7 @@ var createHttpAcpBridge = createAcpSessionBridge;
8935
9539
  export {
8936
9540
  SessionArtifactValidationError,
8937
9541
  SessionArtifactAuthorizationError,
9542
+ parseSessionSource,
8938
9543
  extractErrorMessage,
8939
9544
  extractErrorCode,
8940
9545
  classifyTurnErrorKind,