@qwen-code/qwen-code 0.19.7 → 0.19.8-nightly.20260711.0ef3a76bd

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 (434) hide show
  1. package/bundled/qc-helper/SKILL.md +1 -0
  2. package/bundled/qc-helper/docs/configuration/auth.md +40 -55
  3. package/bundled/qc-helper/docs/configuration/model-providers.md +224 -218
  4. package/bundled/qc-helper/docs/configuration/settings.md +60 -51
  5. package/bundled/qc-helper/docs/features/_meta.ts +1 -0
  6. package/bundled/qc-helper/docs/features/channels/dingtalk.md +12 -2
  7. package/bundled/qc-helper/docs/features/channels/overview.md +86 -12
  8. package/bundled/qc-helper/docs/features/channels/plugins.md +1 -0
  9. package/bundled/qc-helper/docs/features/channels/wecom.md +6 -0
  10. package/bundled/qc-helper/docs/features/code-review.md +29 -5
  11. package/bundled/qc-helper/docs/features/commands.md +39 -38
  12. package/bundled/qc-helper/docs/features/computer-use.md +77 -0
  13. package/bundled/qc-helper/docs/features/hooks.md +36 -34
  14. package/bundled/qc-helper/docs/features/memory.md +1 -1
  15. package/bundled/qc-helper/docs/features/tool-use-summaries.md +19 -23
  16. package/bundled/qc-helper/docs/integration-vscode.md +2 -2
  17. package/bundled/qc-helper/docs/qwen-serve.md +40 -16
  18. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +1 -1
  19. package/bundled/review/DESIGN.md +93 -22
  20. package/bundled/review/SKILL.md +300 -87
  21. package/chunks/MaxSizedBox-4CX4IQWE.js +70 -0
  22. package/chunks/{StandaloneSessionPicker-APISIRJZ.js → StandaloneSessionPicker-TYUSSNJ6.js} +79 -77
  23. package/chunks/{acpAgent-MMOSC2YA.js → acpAgent-5HJEXOPR.js} +978 -205
  24. package/chunks/agent-PZF5IUUB.js +68 -0
  25. package/chunks/agent-headless-L4N7V2SG.js +62 -0
  26. package/chunks/{anthropicContentGenerator-AKYPSZIV.js → anthropicContentGenerator-L73TO3DB.js} +214 -31
  27. package/chunks/{artifact-tool-D233YJFH.js → artifact-tool-U7IRTLIV.js} +5 -5
  28. package/chunks/{askUserQuestion-MKL5ZTMC.js → askUserQuestion-2DLUUZZG.js} +6 -6
  29. package/chunks/bridge-OJL6LD42.js +78 -0
  30. package/chunks/{ca-HCMB2I54.js → ca-WTQOU43B.js} +91 -6
  31. package/chunks/{channel-worker-supervisor-CRCVYQIE.js → channel-worker-supervisor-LF66HCVT.js} +137 -13
  32. package/chunks/{chunk-QQDPRDVW.js → chunk-2HRYPZT5.js} +1 -1
  33. package/chunks/{chunk-JD33UY7E.js → chunk-2K56LTWA.js} +18 -12
  34. package/chunks/{chunk-XISQIIT7.js → chunk-2LV4JUNO.js} +4 -4
  35. package/chunks/chunk-2UU6DW5P.js +296 -0
  36. package/chunks/{chunk-2PSWA5ID.js → chunk-2X56YUSZ.js} +1 -1
  37. package/chunks/chunk-2ZQOQZIS.js +71 -0
  38. package/chunks/{chunk-Q6OEPOOC.js → chunk-3AMVHPEQ.js} +2 -2
  39. package/chunks/{chunk-4RQIB5UZ.js → chunk-3BTRNWWD.js} +1 -35
  40. package/chunks/{chunk-SD4N3QJ2.js → chunk-3QZ6GY6A.js} +66 -22
  41. package/chunks/{chunk-DNV4FSN5.js → chunk-3SJSQXNS.js} +24 -7
  42. package/chunks/{chunk-VQWAZSXN.js → chunk-3XATDZNP.js} +64 -42
  43. package/chunks/{chunk-LEIJKM7Q.js → chunk-3ZAIGBCP.js} +2 -2
  44. package/chunks/{chunk-2NPS2UDH.js → chunk-43JB7OF4.js} +905 -139
  45. package/chunks/chunk-43XJTCHT.js +444 -0
  46. package/chunks/{chunk-CNSF3WO5.js → chunk-47HXCVGG.js} +6 -6
  47. package/chunks/{chunk-VEB3NYSO.js → chunk-4GORAUCN.js} +8 -3
  48. package/chunks/{chunk-55ZMG67I.js → chunk-4LD5APFL.js} +4 -4
  49. package/chunks/{chunk-TLWA7TPR.js → chunk-4QLQE5WJ.js} +2 -2
  50. package/chunks/{chunk-UIDXQNMV.js → chunk-4WGODMVR.js} +1 -1
  51. package/chunks/{chunk-E6US47KI.js → chunk-4WKAA4KS.js} +1 -1
  52. package/chunks/{chunk-H6EMK6QK.js → chunk-4ZVWQHEQ.js} +11913 -5207
  53. package/chunks/{chunk-HW4N45EE.js → chunk-524RQP4Q.js} +29 -8
  54. package/chunks/{chunk-3GONHQOA.js → chunk-57OAHC2Y.js} +1 -1
  55. package/chunks/{chunk-B4U2M63D.js → chunk-5DOUQHL3.js} +2104 -14
  56. package/chunks/{chunk-JZSY4WP3.js → chunk-5DTTYNB7.js} +1 -1
  57. package/chunks/{chunk-A4BMJM77.js → chunk-5O2XNYP6.js} +1 -0
  58. package/chunks/{chunk-P7I3D7FM.js → chunk-5OIXALQ5.js} +2 -2
  59. package/chunks/chunk-5SFOMFG4.js +61 -0
  60. package/chunks/{chunk-QYNNN7BK.js → chunk-5XUCZNSY.js} +2 -2
  61. package/chunks/{chunk-FRFFNYUY.js → chunk-65F3I3PM.js} +5 -5
  62. package/chunks/{chunk-GO6LNQXT.js → chunk-6AM5D4ME.js} +1 -1
  63. package/chunks/{chunk-BWVQN2HV.js → chunk-6CR73ZIK.js} +7 -7
  64. package/chunks/{chunk-BJBWRCSK.js → chunk-6H67XLET.js} +1 -1
  65. package/chunks/{chunk-G7ZG7CA6.js → chunk-6RLROE6G.js} +9 -8
  66. package/chunks/{chunk-TBAZMRW3.js → chunk-6WH2WCSW.js} +2 -2
  67. package/chunks/{chunk-ZERZSAZL.js → chunk-75DOP5OR.js} +2 -2
  68. package/chunks/{chunk-FTFXDZYI.js → chunk-7KZNLIAI.js} +47 -31
  69. package/chunks/{chunk-HJ3GX3Y3.js → chunk-7PW5CTVR.js} +32 -18
  70. package/chunks/{chunk-NQKLOAVJ.js → chunk-7R3CZA3Q.js} +2 -2
  71. package/chunks/{chunk-SAIILPQ3.js → chunk-7X7TEQNX.js} +5 -3
  72. package/chunks/{chunk-IRJWHZWU.js → chunk-A4UCTEB5.js} +2 -2
  73. package/chunks/{chunk-XSAFNANZ.js → chunk-AHUEU3BP.js} +14 -14
  74. package/chunks/{chunk-X3YGAX7V.js → chunk-B5ORX3FG.js} +4 -2
  75. package/chunks/{chunk-ZN5T4BHI.js → chunk-BPZALHVR.js} +2 -2
  76. package/chunks/{chunk-IJRL2S3D.js → chunk-BZIFY5TF.js} +6 -6
  77. package/chunks/{chunk-AJBEAUIS.js → chunk-BZP7HZTK.js} +7 -6
  78. package/chunks/{chunk-OFEVLU4C.js → chunk-CARU2RR2.js} +1 -1
  79. package/chunks/{chunk-MIG5SQNL.js → chunk-CBKR4Q5K.js} +8 -8
  80. package/chunks/chunk-CC2ITGCF.js +176 -0
  81. package/chunks/{chunk-FV7425LN.js → chunk-CEA3E3JB.js} +18 -5
  82. package/chunks/{chunk-GD236YPV.js → chunk-CNOF2IZT.js} +3 -3
  83. package/chunks/chunk-COH43MRJ.js +34 -0
  84. package/chunks/{chunk-E5A7LHNN.js → chunk-CPBF7KYF.js} +1 -1
  85. package/chunks/{chunk-UWCTAVOD.js → chunk-CR3C7WXL.js} +1 -1
  86. package/chunks/{chunk-5P5XGNYH.js → chunk-CU3L64TP.js} +1 -1
  87. package/chunks/{chunk-IWKSG2AR.js → chunk-CXAOG665.js} +1 -1
  88. package/chunks/{chunk-MZ7BABX3.js → chunk-DC5Z3DU6.js} +2 -2
  89. package/chunks/{chunk-64WXLC72.js → chunk-DJ2GSRLV.js} +1 -1
  90. package/chunks/{chunk-4ZJIPVPB.js → chunk-DMN532MJ.js} +11 -11
  91. package/chunks/{chunk-QN5NZ3UQ.js → chunk-DMTGGOSA.js} +2 -2
  92. package/chunks/{chunk-KHDZHZMH.js → chunk-E5Z2AVNV.js} +1 -1
  93. package/chunks/chunk-F4PFZ7WP.js +239 -0
  94. package/chunks/{chunk-ME3YSROJ.js → chunk-FBSBT7JS.js} +25 -13
  95. package/chunks/{chunk-5IFG2VC4.js → chunk-FCMNKVXT.js} +1 -1
  96. package/chunks/{chunk-YDSYD7UI.js → chunk-FD3DA3B4.js} +3 -3
  97. package/chunks/{chunk-GL5TV7B5.js → chunk-GL22M2DU.js} +23 -7
  98. package/chunks/{chunk-AFOLR6YL.js → chunk-GQ4ZEYMI.js} +102 -16
  99. package/chunks/chunk-GRC5HGPI.js +13 -0
  100. package/chunks/{chunk-WMPVYQ4P.js → chunk-GWHYEOV2.js} +2 -2
  101. package/chunks/chunk-GZRTYZ2R.js +292 -0
  102. package/chunks/{chunk-A2X3KLC3.js → chunk-GZXCZHCT.js} +3 -3
  103. package/chunks/{chunk-K5PGHDBN.js → chunk-H6XPXXMH.js} +1 -1
  104. package/chunks/{chunk-24XYI5EI.js → chunk-HACY3IUM.js} +6 -6
  105. package/chunks/{chunk-DGHJTO2K.js → chunk-HIHQ3TWC.js} +38 -9
  106. package/chunks/{chunk-KYMBIKIW.js → chunk-HTHUX2T5.js} +1 -1
  107. package/chunks/{chunk-LQ7TMOCE.js → chunk-HTO4JFDZ.js} +1 -1
  108. package/chunks/{chunk-B34OV7K2.js → chunk-IAVB3HM3.js} +15 -2
  109. package/chunks/{chunk-4UCTWSTP.js → chunk-IDJEZU7C.js} +2 -2
  110. package/chunks/chunk-IEBIKN6A.js +38 -0
  111. package/chunks/{chunk-PRDFOIZF.js → chunk-IJEO2QSK.js} +73 -30
  112. package/chunks/{chunk-MJI36HER.js → chunk-IT6LIIVK.js} +2 -2
  113. package/chunks/{chunk-FEJ2FZ3U.js → chunk-J3JA76CF.js} +2 -2
  114. package/chunks/{chunk-4CGOWHKM.js → chunk-J4MOFEOK.js} +2 -2
  115. package/chunks/{chunk-22MNNNXE.js → chunk-J4TSQ5EQ.js} +3 -2
  116. package/chunks/{chunk-22IFUCVR.js → chunk-JESCGQM3.js} +1 -1
  117. package/chunks/{chunk-CCGOFQV3.js → chunk-JSG7ZSBC.js} +8 -7
  118. package/chunks/{chunk-X265R5C6.js → chunk-K434OPES.js} +5 -5
  119. package/chunks/{chunk-RFIL6REB.js → chunk-KHUQZZJ6.js} +185 -45
  120. package/chunks/{chunk-X2XNQQJI.js → chunk-KKNMOEZH.js} +4 -4
  121. package/chunks/{chunk-6BN7NZ5Z.js → chunk-KL23O5Z5.js} +7 -9
  122. package/chunks/{chunk-MRO43B25.js → chunk-KW7NOTN6.js} +1 -1
  123. package/chunks/{chunk-6IAWPIQ6.js → chunk-L36P3NBD.js} +3 -3
  124. package/chunks/{chunk-54YZOP7P.js → chunk-L573Z2QZ.js} +11894 -5190
  125. package/chunks/{chunk-STAZRKOT.js → chunk-L6GPKRH7.js} +132 -464
  126. package/chunks/{chunk-QAKFYMJI.js → chunk-LD5OWZ5E.js} +155 -19
  127. package/chunks/{chunk-E7KNELIZ.js → chunk-LK7KUE55.js} +2 -2
  128. package/chunks/{chunk-W7EEOR7D.js → chunk-LUODI7WD.js} +5 -5
  129. package/chunks/{chunk-CSOTA7KX.js → chunk-LXNEJD34.js} +2 -2
  130. package/chunks/{chunk-HLKG6CZN.js → chunk-M5GB774H.js} +1 -1
  131. package/chunks/{chunk-3B26UVCX.js → chunk-MC23XKFE.js} +39 -10
  132. package/chunks/{chunk-XPJH4PKR.js → chunk-MPEMTBUZ.js} +2 -2
  133. package/chunks/{chunk-GMOWQOQQ.js → chunk-MUCWGT7O.js} +248 -55
  134. package/chunks/{chunk-PC4ZXHU2.js → chunk-MXL5UP4X.js} +3 -3
  135. package/chunks/{chunk-PUQLHSQ2.js → chunk-N2FGNKOE.js} +10 -12
  136. package/chunks/{chunk-332PWN27.js → chunk-NHDKSOEY.js} +1 -1
  137. package/chunks/{chunk-65CFHNSE.js → chunk-NKHV3OHY.js} +62 -62
  138. package/chunks/{chunk-P7M4GA57.js → chunk-OCPBI7J5.js} +1 -1
  139. package/chunks/{chunk-42XGFRJS.js → chunk-ORBGV7NJ.js} +5 -5
  140. package/chunks/{chunk-ALZ75L2X.js → chunk-OZJLTZKP.js} +415 -379
  141. package/chunks/chunk-P3X7RYUQ.js +468 -0
  142. package/chunks/{chunk-AGHU5VRK.js → chunk-PZL23GTM.js} +1 -1
  143. package/chunks/{chunk-FXGLL2HL.js → chunk-Q7YDKOGY.js} +1 -1
  144. package/chunks/{chunk-LGFAYIKX.js → chunk-QHTIBUWB.js} +1 -1
  145. package/chunks/{chunk-AIY5UTFI.js → chunk-QK2JET6S.js} +934 -2881
  146. package/chunks/{chunk-P3MYAZBY.js → chunk-QMGX2KO2.js} +1 -1
  147. package/chunks/{chunk-QZF5U5KA.js → chunk-QNTUV3PP.js} +11 -11
  148. package/chunks/chunk-QRUIS3DN.js +47 -0
  149. package/chunks/{chunk-ITOGNELQ.js → chunk-QSWDGAIC.js} +2 -2
  150. package/chunks/{chunk-7JGISHHZ.js → chunk-QUJIDGIW.js} +15 -157
  151. package/chunks/{chunk-GHOTR7HL.js → chunk-QUPXZXLV.js} +1 -1
  152. package/chunks/{chunk-TDGF35EN.js → chunk-QYMQSECS.js} +3 -3
  153. package/chunks/{chunk-QYUE6W3T.js → chunk-RDJSGHZE.js} +1 -1
  154. package/chunks/{chunk-TLRYABYP.js → chunk-RKUWKYED.js} +1 -1
  155. package/chunks/{chunk-ADZG46HR.js → chunk-RRNR5U2U.js} +2 -2
  156. package/chunks/{chunk-4O344UEE.js → chunk-RW7CXRUM.js} +39 -19
  157. package/chunks/{chunk-RNBYOUGV.js → chunk-RXFQM6FQ.js} +1 -1
  158. package/chunks/{chunk-QXPI7FEC.js → chunk-S3TWXGKA.js} +4 -4
  159. package/chunks/{chunk-44NROQYV.js → chunk-SJHDYNHF.js} +4 -4
  160. package/chunks/{chunk-MLZQVCF3.js → chunk-SZRN75WQ.js} +1 -1
  161. package/chunks/{chunk-7RYW5LQV.js → chunk-T2NCM2ET.js} +2 -2
  162. package/chunks/{chunk-Z2Z3GUXZ.js → chunk-TB6UDU4T.js} +1 -1
  163. package/chunks/{chunk-SUAKHHK7.js → chunk-TDEXZKMT.js} +3 -3
  164. package/chunks/{chunk-EXPMGZZV.js → chunk-TEGEBB2I.js} +1 -1
  165. package/chunks/{chunk-JF7DFPQ5.js → chunk-TJCEUA3S.js} +15 -3
  166. package/chunks/{chunk-MX2YXRER.js → chunk-TJTKSVIV.js} +1 -1
  167. package/chunks/{chunk-H6BD2ELD.js → chunk-TYAMGABM.js} +2 -2
  168. package/chunks/{chunk-CISB3IQF.js → chunk-U3VSCGEJ.js} +100 -15
  169. package/chunks/{chunk-VRDMOSQS.js → chunk-UDXSXLER.js} +2 -2
  170. package/chunks/{chunk-AHNJGLFV.js → chunk-UOZWKTQG.js} +3 -3
  171. package/chunks/{chunk-CJCKDMWO.js → chunk-URK542T4.js} +1 -1
  172. package/chunks/{chunk-YEGT55NW.js → chunk-UUVCHN62.js} +5697 -2983
  173. package/chunks/{chunk-AHNXYU4O.js → chunk-V6WHFGST.js} +1 -1
  174. package/chunks/{chunk-U4FRHCLA.js → chunk-VAUPLGDZ.js} +2370 -364
  175. package/chunks/{chunk-ZTQ26VBE.js → chunk-VDDGDZMA.js} +1 -1
  176. package/chunks/{chunk-OMX7CUOE.js → chunk-VGC4I5JJ.js} +1 -1
  177. package/chunks/{chunk-IUE7YWC3.js → chunk-VIUKEWUL.js} +8 -8
  178. package/chunks/{chunk-43W4YSO6.js → chunk-VJNBRRZG.js} +2 -2
  179. package/chunks/{chunk-I4A4K72C.js → chunk-VL7GBUQA.js} +1309 -703
  180. package/chunks/{chunk-VZ7HY3YU.js → chunk-W2UIXQDL.js} +3 -3
  181. package/chunks/{chunk-ER3BKOLB.js → chunk-W7FJ3N32.js} +1 -1
  182. package/chunks/{chunk-3HX5LZ6R.js → chunk-WBL3FJEU.js} +2 -2
  183. package/chunks/{chunk-RYFZCUJO.js → chunk-WCUK2QXK.js} +17 -9
  184. package/chunks/{chunk-OWVIH4HY.js → chunk-WFHJDT4S.js} +421 -114
  185. package/chunks/{chunk-BMFMJINR.js → chunk-WL4L7EZH.js} +1 -1
  186. package/chunks/{chunk-NZEGNV4V.js → chunk-WPHYXKFL.js} +8 -51
  187. package/chunks/chunk-X4NKFGFJ.js +81 -0
  188. package/chunks/{chunk-3RW4AZJV.js → chunk-XFSFZCM5.js} +1 -1
  189. package/chunks/{chunk-2MPVVENX.js → chunk-XU457J4V.js} +2 -2
  190. package/chunks/{chunk-SIUQ3YYX.js → chunk-XVNQMZ2I.js} +1 -1
  191. package/chunks/{chunk-SYCJMSIJ.js → chunk-XWRJCPHC.js} +1 -1
  192. package/chunks/chunk-YAF2MQZ6.js +19 -0
  193. package/chunks/chunk-YF4RZPJP.js +168 -0
  194. package/chunks/{chunk-4KJ2BPIT.js → chunk-YLV3XXFB.js} +4 -40
  195. package/chunks/{chunk-BR4QREVK.js → chunk-YQ3U5MUC.js} +1 -1
  196. package/chunks/{chunk-Y6Z2O3WR.js → chunk-YUZI3WAC.js} +1 -1
  197. package/chunks/{chunk-II73RK2S.js → chunk-YVEDCAUE.js} +1 -1
  198. package/chunks/{chunk-SKAZWEV5.js → chunk-ZJE7NSL3.js} +1 -1
  199. package/chunks/{chunk-7LTB54MK.js → chunk-ZLXQN2QS.js} +2 -2
  200. package/chunks/cli-entry-path-4VJ3Y6T2.js +10 -0
  201. package/chunks/{computer-use-X4KUU3NM.js → computer-use-2ZTYDNN4.js} +50 -50
  202. package/chunks/config-utils-ZITWCFBY.js +23 -0
  203. package/chunks/contextCommand-6L4XCZZT.js +68 -0
  204. package/chunks/create-sub-session-INX7TXJI.js +207 -0
  205. package/chunks/create-sub-session-VZIOFS6N.js +375 -0
  206. package/chunks/{cron-create-JSXEIPVS.js → cron-create-AMBKGZX6.js} +9 -9
  207. package/chunks/{cron-delete-OIFVEPGU.js → cron-delete-LRU4OJYG.js} +7 -7
  208. package/chunks/{cron-list-D4ZX4IOE.js → cron-list-WVP2JXER.js} +14 -10
  209. package/chunks/{daemon-F3I2RXP6.js → daemon-QEDXW7ER.js} +554 -4
  210. package/chunks/daemon-status-provider-7XJZ3HPS.js +76 -0
  211. package/chunks/{de-PLLFDERI.js → de-XHBEYUMG.js} +91 -6
  212. package/chunks/{devtools-FM6GJPYG.js → devtools-4QFYJT6U.js} +3 -3
  213. package/chunks/{dist-573HNSVO.js → dist-EFXT7A3G.js} +12 -11
  214. package/chunks/{dist-PKFTNUHO.js → dist-KCRX7TGL.js} +529 -79
  215. package/chunks/{dist-OT7G2WNM.js → dist-MFEAEUV4.js} +1011 -197
  216. package/chunks/{dist-63IS3ZMI.js → dist-PZV5RKM6.js} +4 -4
  217. package/chunks/{dist-FQ5WRJPL.js → dist-QY3THJM5.js} +5 -5
  218. package/chunks/{dist-IMFFBMAT.js → dist-UJOR6KEQ.js} +32 -15
  219. package/chunks/{dist-YTRKAVUB.js → dist-ZWZB4CCN.js} +10 -10
  220. package/chunks/earlyInputCapture-TTWXFIWO.js +69 -0
  221. package/chunks/{edit-WZTZDGCI.js → edit-6UWFRZKY.js} +51 -51
  222. package/chunks/{en-GA2RMXY5.js → en-TKHUFIK7.js} +100 -6
  223. package/chunks/{enter-worktree-DEPXBJEL.js → enter-worktree-LS7SGAII.js} +50 -50
  224. package/chunks/{enterPlanMode-JFGXZHHJ.js → enterPlanMode-TSZYLEEP.js} +66 -51
  225. package/chunks/environment-XCVLHOXG.js +88 -0
  226. package/chunks/errors-KIANLUTC.js +75 -0
  227. package/chunks/{exit-worktree-Y7XBK3VV.js → exit-worktree-2QV6UJSW.js} +50 -50
  228. package/chunks/{exitPlanMode-WQQER65F.js → exitPlanMode-GVZG3F6S.js} +51 -51
  229. package/chunks/{fast-path-W2U6XDNO.js → fast-path-GNFZAMQK.js} +16 -7
  230. package/chunks/{fast-path-settings-RCRXH2JG.js → fast-path-settings-5QZE64HR.js} +6 -5
  231. package/chunks/{fileFromPath-IBEHA3CO.js → fileFromPath-UDALK7FM.js} +3 -3
  232. package/chunks/{fr-GWNQG4XH.js → fr-TBF6JZNE.js} +91 -6
  233. package/chunks/{gemini-T4WX6SRW.js → gemini-N3H6OLHR.js} +501 -197
  234. package/chunks/{geminiContentGenerator-MKQACXEJ.js → geminiContentGenerator-4C257R2N.js} +9 -9
  235. package/chunks/{getMachineId-bsd-4CASPIU4.js → getMachineId-bsd-EXV7SWPA.js} +3 -3
  236. package/chunks/{getMachineId-darwin-HPQPEMZR.js → getMachineId-darwin-IUOMFXU3.js} +3 -3
  237. package/chunks/{getMachineId-linux-AUARKYHL.js → getMachineId-linux-K7XJYFHL.js} +2 -2
  238. package/chunks/{getMachineId-unsupported-S32ZDA2T.js → getMachineId-unsupported-EA5FDRJ6.js} +2 -2
  239. package/chunks/{getMachineId-win-4EFLHYIJ.js → getMachineId-win-KBA6RAI5.js} +3 -3
  240. package/chunks/{glob-4KKSHZDF.js → glob-QTUI5I3Y.js} +95 -74
  241. package/chunks/{grep-GHRYXSLZ.js → grep-Z5MGLRCG.js} +50 -50
  242. package/chunks/handleAutoUpdate-FFF3CZGP.js +69 -0
  243. package/chunks/i18n-QQAJT7A2.js +84 -0
  244. package/chunks/initializer-LGQGC7ZT.js +71 -0
  245. package/chunks/installationInfo-4FEZGXIN.js +65 -0
  246. package/chunks/{ja-2HOTA47X.js → ja-CDXUA2H3.js} +92 -7
  247. package/chunks/{keychain-token-storage-UJV5XP4Z.js → keychain-token-storage-VKUBNCP4.js} +4 -4
  248. package/chunks/{kittyProtocolDetector-OJRCJLIU.js → kittyProtocolDetector-HCNNKJTI.js} +2 -2
  249. package/chunks/list-KIVFF3BB.js +74 -0
  250. package/chunks/loadedSettingsAdapter-EOD3RVZS.js +68 -0
  251. package/chunks/{loop-wakeup-OHWEMFP5.js → loop-wakeup-WX7BLWWP.js} +10 -10
  252. package/chunks/{lowlight-FYAAUU5J.js → lowlight-J2OZNPCA.js} +1 -1
  253. package/chunks/{ls-L654WOAT.js → ls-ZB2BDP6T.js} +6 -6
  254. package/chunks/{lsp-M35KE54Y.js → lsp-V5DN4YUJ.js} +6 -8
  255. package/chunks/mcp-D2P46DB4.js +68 -0
  256. package/chunks/{monitor-464OY2UE.js → monitor-4ZWVOL6J.js} +50 -50
  257. package/chunks/{multipart-parser-AJ4WASWR.js → multipart-parser-AWZKXSQN.js} +3 -3
  258. package/chunks/nonInteractiveCli-NAHUR2X6.js +124 -0
  259. package/chunks/{notebook-edit-BLJYCNDO.js → notebook-edit-RCQ2D2IE.js} +51 -51
  260. package/chunks/openaiContentGenerator-U655T5QC.js +56 -0
  261. package/chunks/pidfile-O3OO2TCP.js +73 -0
  262. package/chunks/{pt-2THT3YHA.js → pt-6IR2VRQY.js} +91 -6
  263. package/chunks/{qwenContentGenerator-SUUHZ6CR.js → qwenContentGenerator-ABGWCRS6.js} +52 -52
  264. package/chunks/{qwenOAuth2-ZV7YLMND.js → qwenOAuth2-PJQ27GSO.js} +9 -9
  265. package/chunks/read-file-X7M4GUPY.js +30 -0
  266. package/chunks/{read-mcp-resource-CNQHBSJM.js → read-mcp-resource-SM5DA4RG.js} +5 -5
  267. package/chunks/{read-package-up-ER5OJUGP.js → read-package-up-TCM6I7S2.js} +2 -2
  268. package/chunks/{record-artifact-PP3LKHTS.js → record-artifact-4XKZX3UW.js} +7 -7
  269. package/chunks/ripGrep-KMPJJK5J.js +60 -0
  270. package/chunks/{ru-Z67YJHBG.js → ru-DBTHQA3F.js} +91 -6
  271. package/chunks/{run-qwen-serve-5OKADVLE.js → run-qwen-serve-O6CMPURG.js} +958 -184
  272. package/chunks/runtime-THE2YO27.js +94 -0
  273. package/chunks/{scheduler-ZRW3AIDU.js → scheduler-XXEA6EFC.js} +51 -51
  274. package/chunks/{send-message-OA6MV4EU.js → send-message-F36YD6KQ.js} +7 -7
  275. package/chunks/serve-W6F44JQQ.js +74 -0
  276. package/chunks/{server-M372UENX.js → server-SAEKMY52.js} +4340 -829
  277. package/chunks/{session-F5KSNP2N.js → session-4GGYGOWY.js} +162 -117
  278. package/chunks/settings-PYEU5HVD.js +118 -0
  279. package/chunks/shell-JGQECKTH.js +68 -0
  280. package/chunks/{skill-A2TL2NPC.js → skill-XPP3C2DS.js} +24 -24
  281. package/chunks/spawnChannel-62QKQBQN.js +70 -0
  282. package/chunks/{src-XKZMNHXS.js → src-2656Q6SN.js} +126 -52
  283. package/chunks/{src-7XL4G4DC.js → src-VLI3TKEY.js} +4 -4
  284. package/chunks/standalone-update-X7AZVG5R.js +79 -0
  285. package/chunks/{startInteractiveUI-REKSTOHU.js → startInteractiveUI-DXR4K6T5.js} +2277 -1834
  286. package/chunks/stdioHelpers-UMY72QRP.js +14 -0
  287. package/chunks/{syntheticOutput-F7LSDCAR.js → syntheticOutput-34H7LGA7.js} +5 -5
  288. package/chunks/task-create-FRGOEIKY.js +22 -0
  289. package/chunks/{task-list-TGGJX7EA.js → task-list-OW766BXZ.js} +10 -10
  290. package/chunks/{task-stop-W7NGTMYQ.js → task-stop-SIR5SNBN.js} +4 -4
  291. package/chunks/{task-update-5WUG5MVQ.js → task-update-YRA532MT.js} +12 -12
  292. package/chunks/{team-create-TBQVWAG7.js → team-create-3EHCUCKA.js} +50 -50
  293. package/chunks/{team-delete-UHQQ2QQX.js → team-delete-6OSECUZC.js} +10 -10
  294. package/chunks/{team-plan-approval-FZPGUSHJ.js → team-plan-approval-KZ7NZIMX.js} +50 -50
  295. package/chunks/theme-manager-J7ANV4JR.js +64 -0
  296. package/chunks/{todoWrite-C4ZAMSR3.js → todoWrite-YDMFEV4G.js} +6 -6
  297. package/chunks/{tool-search-FDQ3SLNJ.js → tool-search-2XLGWG4H.js} +24 -24
  298. package/chunks/total-session-admission-EQIHUOL6.js +72 -0
  299. package/chunks/trustedFolders-BEX5334Z.js +79 -0
  300. package/chunks/{types-QX5C3CHJ.js → types-JNKGKUJT.js} +2 -2
  301. package/chunks/updateCheck-NKPJGJCR.js +69 -0
  302. package/chunks/updateEventEmitter-5MKC7BLQ.js +10 -0
  303. package/chunks/validateNonInterActiveAuth-6DGGGE4A.js +190 -0
  304. package/chunks/{version-CEDD6ZZR.js → version-FRVWU5ZU.js} +3 -3
  305. package/chunks/{web-fetch-UYGMOHW4.js → web-fetch-PAAEQKBW.js} +8 -8
  306. package/chunks/{workflow-CQQ4J4I6.js → workflow-LWFMECLD.js} +51 -51
  307. package/chunks/workspace-providers-status-NE7QWEYS.js +71 -0
  308. package/chunks/workspace-registry-RCWAP57G.js +76 -0
  309. package/chunks/workspace-service-4QUMVGBX.js +80 -0
  310. package/chunks/workspace-skills-status-L34BYRSY.js +70 -0
  311. package/chunks/{write-file-VWGY7AJP.js → write-file-WXO4M5FN.js} +51 -51
  312. package/chunks/{yargs-B64EYTCF.js → yargs-6H2AUULL.js} +2 -2
  313. package/chunks/{zh-7XVVRTDH.js → zh-LJP47LX7.js} +101 -7
  314. package/chunks/{zh-TW-DPH554OG.js → zh-TW-5ISMO3VJ.js} +101 -7
  315. package/cli.js +18 -17
  316. package/locales/ca.js +117 -7
  317. package/locales/de.js +116 -7
  318. package/locales/en.js +133 -7
  319. package/locales/fr.js +117 -7
  320. package/locales/ja.js +119 -7
  321. package/locales/pt.js +116 -7
  322. package/locales/ru.js +116 -7
  323. package/locales/zh-TW.js +130 -7
  324. package/locales/zh.js +130 -7
  325. package/package.json +3 -6
  326. package/web-shell/assets/{arc-C7hjaa7g.js → arc-BRDEF7h6.js} +1 -1
  327. package/web-shell/assets/{architectureDiagram-3BPJPVTR-pm9KtMZY.js → architectureDiagram-3BPJPVTR-Cxnk4Ygq.js} +1 -1
  328. package/web-shell/assets/{blockDiagram-GPEHLZMM-CApElKsU.js → blockDiagram-GPEHLZMM-BZrtayqw.js} +1 -1
  329. package/web-shell/assets/{c4Diagram-AAUBKEIU-BeDe0-9N.js → c4Diagram-AAUBKEIU-Djmbi1yB.js} +1 -1
  330. package/web-shell/assets/channel-C9zfQCn-.js +1 -0
  331. package/web-shell/assets/{chunk-2J33WTMH-DJEkmLdl.js → chunk-2J33WTMH-Cdokj-0U.js} +1 -1
  332. package/web-shell/assets/{chunk-4BX2VUAB-DXX8gdpe.js → chunk-4BX2VUAB-BI9Hx57o.js} +1 -1
  333. package/web-shell/assets/{chunk-55IACEB6-DORmk1kQ.js → chunk-55IACEB6-Cb17cEzj.js} +1 -1
  334. package/web-shell/assets/{chunk-727SXJPM-DWmO4mCZ.js → chunk-727SXJPM-DY1Fc0h_.js} +1 -1
  335. package/web-shell/assets/{chunk-AQP2D5EJ-C7LRaYw2.js → chunk-AQP2D5EJ-B10G71Hd.js} +1 -1
  336. package/web-shell/assets/{chunk-FMBD7UC4-CCdXgyC5.js → chunk-FMBD7UC4-BP6OoB6Z.js} +1 -1
  337. package/web-shell/assets/{chunk-ND2GUHAM-SyL_xvWc.js → chunk-ND2GUHAM-CWIIwUFC.js} +1 -1
  338. package/web-shell/assets/{chunk-QZHKN3VN-BzOuCKxa.js → chunk-QZHKN3VN-DMrqCfGO.js} +1 -1
  339. package/web-shell/assets/classDiagram-4FO5ZUOK-BVNaf5JM.js +1 -0
  340. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-BVNaf5JM.js +1 -0
  341. package/web-shell/assets/{cose-bilkent-S5V4N54A-BMPWyDKc.js → cose-bilkent-S5V4N54A-CF-mpkgI.js} +1 -1
  342. package/web-shell/assets/{dagre-BM42HDAG-B_GnPWik.js → dagre-BM42HDAG-DfsRFsg7.js} +1 -1
  343. package/web-shell/assets/{diagram-2AECGRRQ-fJqMc3S_.js → diagram-2AECGRRQ-DBNwf6Dy.js} +1 -1
  344. package/web-shell/assets/{diagram-5GNKFQAL-ximV3O9D.js → diagram-5GNKFQAL-CD1TqV1j.js} +1 -1
  345. package/web-shell/assets/{diagram-KO2AKTUF-2vVyjzqw.js → diagram-KO2AKTUF-DkWlaLI2.js} +1 -1
  346. package/web-shell/assets/{diagram-LMA3HP47-Dckcx1sT.js → diagram-LMA3HP47-ClrAcxwF.js} +1 -1
  347. package/web-shell/assets/{diagram-OG6HWLK6-BAVv47ga.js → diagram-OG6HWLK6-Dr6dnPLw.js} +1 -1
  348. package/web-shell/assets/{erDiagram-TEJ5UH35-Bn3nf5J0.js → erDiagram-TEJ5UH35-Dm_vj18R.js} +1 -1
  349. package/web-shell/assets/{flowDiagram-I6XJVG4X-BIbGF9JT.js → flowDiagram-I6XJVG4X-lp3cMdZu.js} +1 -1
  350. package/web-shell/assets/{ganttDiagram-6RSMTGT7-CDbhb3AH.js → ganttDiagram-6RSMTGT7-AtdCWZya.js} +3 -3
  351. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-CbKG1a_w.js → gitGraphDiagram-PVQCEYII-BARTJafF.js} +1 -1
  352. package/web-shell/assets/index-BkNgyfu7.js +3 -0
  353. package/web-shell/assets/index-CihmnZZR.js +784 -0
  354. package/web-shell/assets/index-zfdXhnwH.css +5 -0
  355. package/web-shell/assets/{infoDiagram-5YYISTIA-DUFxTy8m.js → infoDiagram-5YYISTIA-CxbJ54_f.js} +1 -1
  356. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-D69hrBG8.js → ishikawaDiagram-YF4QCWOH-hFoO0HQA.js} +1 -1
  357. package/web-shell/assets/{journeyDiagram-JHISSGLW-DsvEw51Y.js → journeyDiagram-JHISSGLW-Bo6cKnLe.js} +1 -1
  358. package/web-shell/assets/{kanban-definition-UN3LZRKU-lFFjZEYd.js → kanban-definition-UN3LZRKU-DIFrH-XL.js} +1 -1
  359. package/web-shell/assets/{linear-Bo5bWzvo.js → linear-Bjv_GjDd.js} +1 -1
  360. package/web-shell/assets/{mermaid.core-C_HKMJx5.js → mermaid.core-C_OiqQEP.js} +5 -5
  361. package/web-shell/assets/{mindmap-definition-RKZ34NQL-DlV-NUTs.js → mindmap-definition-RKZ34NQL-B79Gk8aB.js} +1 -1
  362. package/web-shell/assets/{pieDiagram-4H26LBE5-B2e6FH2a.js → pieDiagram-4H26LBE5-B_P0gIHr.js} +1 -1
  363. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-D75kSk-b.js → quadrantDiagram-W4KKPZXB-BC7F0ohb.js} +1 -1
  364. package/web-shell/assets/{requirementDiagram-4Y6WPE33-CQ6xakhM.js → requirementDiagram-4Y6WPE33-BrA5_NSW.js} +1 -1
  365. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-J_XTKrcY.js → sankeyDiagram-5OEKKPKP-Q2iqrNI_.js} +1 -1
  366. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-D7jTcBtf.js → sequenceDiagram-3UESZ5HK-6vdIWz4H.js} +1 -1
  367. package/web-shell/assets/{stateDiagram-AJRCARHV-CrlM_OT3.js → stateDiagram-AJRCARHV-DMzXNKcB.js} +1 -1
  368. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BWFH0OCO.js +1 -0
  369. package/web-shell/assets/{timeline-definition-PNZ67QCA-5oZi76Ef.js → timeline-definition-PNZ67QCA-BykEawmS.js} +1 -1
  370. package/web-shell/assets/{vennDiagram-CIIHVFJN-DO5YptPK.js → vennDiagram-CIIHVFJN-B24KD2X1.js} +1 -1
  371. package/web-shell/assets/{wardley-L42UT6IY-4t1eJDvM.js → wardley-L42UT6IY-C761G_tA.js} +1 -1
  372. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-DKZc661S.js → wardleyDiagram-YWT4CUSO-CfwGJYqw.js} +1 -1
  373. package/web-shell/assets/{xychartDiagram-2RQKCTM6-su9hp08G.js → xychartDiagram-2RQKCTM6-BDu5AZ2D.js} +1 -1
  374. package/web-shell/index.html +16 -4
  375. package/chunks/MaxSizedBox-XY5LIO5O.js +0 -71
  376. package/chunks/agent-TKIBLLQT.js +0 -68
  377. package/chunks/agent-headless-VLX4C7KX.js +0 -62
  378. package/chunks/bridge-BCU73DZO.js +0 -77
  379. package/chunks/chunk-6SHO7WFF.js +0 -79
  380. package/chunks/chunk-IFEWJXFS.js +0 -37
  381. package/chunks/chunk-S6RLAIUR.js +0 -23
  382. package/chunks/contextCommand-LAYJZF7H.js +0 -68
  383. package/chunks/daemon-status-provider-XSAFKVDS.js +0 -74
  384. package/chunks/earlyInputCapture-AERYYGXE.js +0 -69
  385. package/chunks/errors-GMZL4QV7.js +0 -75
  386. package/chunks/handleAutoUpdate-HN7ZOSXY.js +0 -65
  387. package/chunks/initializer-SRN3IM42.js +0 -69
  388. package/chunks/list-INTVXUPA.js +0 -71
  389. package/chunks/loadedSettingsAdapter-QVHHQPGM.js +0 -66
  390. package/chunks/mcp-7V4T46RG.js +0 -66
  391. package/chunks/nonInteractiveCli-LJEEODU2.js +0 -116
  392. package/chunks/openaiContentGenerator-PFF6HYB2.js +0 -56
  393. package/chunks/pidfile-LIBUENIV.js +0 -73
  394. package/chunks/read-file-L7TBQVX7.js +0 -30
  395. package/chunks/ripGrep-CKKX3GRB.js +0 -60
  396. package/chunks/serve-36WS32W6.js +0 -71
  397. package/chunks/settings-WFLNS3WT.js +0 -114
  398. package/chunks/shell-DEDSWN56.js +0 -68
  399. package/chunks/spawnChannel-RQHUWTCL.js +0 -70
  400. package/chunks/task-create-RPFZNB4B.js +0 -22
  401. package/chunks/theme-manager-DQZVNSOC.js +0 -64
  402. package/chunks/trustedFolders-Z475EIHL.js +0 -79
  403. package/chunks/updateCheck-E2ZX7RL7.js +0 -65
  404. package/chunks/validateNonInterActiveAuth-O4ECBHQL.js +0 -181
  405. package/chunks/workspace-providers-status-MVYXMYDG.js +0 -68
  406. package/chunks/workspace-service-OMBR6ZLG.js +0 -78
  407. package/chunks/workspace-skills-status-IMMQ7CAY.js +0 -68
  408. package/node_modules/@qwen-code/audio-capture/dist/index.d.ts +0 -35
  409. package/node_modules/@qwen-code/audio-capture/dist/index.js +0 -48
  410. package/node_modules/@qwen-code/audio-capture/dist/index.js.map +0 -1
  411. package/node_modules/@qwen-code/audio-capture/dist/platform.d.ts +0 -7
  412. package/node_modules/@qwen-code/audio-capture/dist/platform.js +0 -18
  413. package/node_modules/@qwen-code/audio-capture/dist/platform.js.map +0 -1
  414. package/node_modules/@qwen-code/audio-capture/node_modules/node-gyp-build/LICENSE +0 -21
  415. package/node_modules/@qwen-code/audio-capture/node_modules/node-gyp-build/README.md +0 -58
  416. package/node_modules/@qwen-code/audio-capture/node_modules/node-gyp-build/SECURITY.md +0 -5
  417. package/node_modules/@qwen-code/audio-capture/node_modules/node-gyp-build/bin.js +0 -84
  418. package/node_modules/@qwen-code/audio-capture/node_modules/node-gyp-build/build-test.js +0 -19
  419. package/node_modules/@qwen-code/audio-capture/node_modules/node-gyp-build/index.js +0 -6
  420. package/node_modules/@qwen-code/audio-capture/node_modules/node-gyp-build/node-gyp-build.js +0 -207
  421. package/node_modules/@qwen-code/audio-capture/node_modules/node-gyp-build/optional.js +0 -7
  422. package/node_modules/@qwen-code/audio-capture/node_modules/node-gyp-build/package.json +0 -43
  423. package/node_modules/@qwen-code/audio-capture/package.json +0 -30
  424. package/node_modules/@qwen-code/audio-capture/prebuilds/darwin-arm64/@qwen-code+audio-capture.node +0 -0
  425. package/node_modules/@qwen-code/audio-capture/prebuilds/darwin-x64/@qwen-code+audio-capture.node +0 -0
  426. package/node_modules/@qwen-code/audio-capture/prebuilds/linux-arm64/@qwen-code+audio-capture.node +0 -0
  427. package/node_modules/@qwen-code/audio-capture/prebuilds/linux-x64/@qwen-code+audio-capture.node +0 -0
  428. package/node_modules/@qwen-code/audio-capture/prebuilds/win32-x64/@qwen-code+audio-capture.node +0 -0
  429. package/web-shell/assets/channel-BNf1dW-j.js +0 -1
  430. package/web-shell/assets/classDiagram-4FO5ZUOK-uOIGlzgi.js +0 -1
  431. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-uOIGlzgi.js +0 -1
  432. package/web-shell/assets/index-CnE2ur2L.js +0 -779
  433. package/web-shell/assets/index-hSKXrlSE.css +0 -5
  434. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-Bs4TK_84.js +0 -1
@@ -3,13 +3,10 @@
3
3
  import {
4
4
  DaemonMetricsRing,
5
5
  computeCpuPercent
6
- } from "./chunk-II73RK2S.js";
7
- import {
8
- findCliEntryPath
9
- } from "./chunk-AHNXYU4O.js";
6
+ } from "./chunk-YVEDCAUE.js";
10
7
  import {
11
8
  RUNTIME_STARTUP_CANCELLED_MESSAGE
12
- } from "./chunk-GHOTR7HL.js";
9
+ } from "./chunk-QUPXZXLV.js";
13
10
  import {
14
11
  CAPABILITIES_SCHEMA_VERSION,
15
12
  ClientMcpSenderRegistry,
@@ -25,63 +22,75 @@ import {
25
22
  getRateLimiter,
26
23
  getServeProtocolVersions,
27
24
  hostAllowlist,
25
+ isBrowserAutomationMcpAvailable,
28
26
  listenerMaxConnections,
29
27
  parseAllowOriginPatterns,
30
28
  parseDaemonStatusDetail,
31
29
  positiveFiniteOrNull,
32
30
  require_express,
33
31
  resolveWebShellDir
34
- } from "./chunk-RFIL6REB.js";
32
+ } from "./chunk-KHUQZZJ6.js";
35
33
  import {
36
34
  isLoopbackBind
37
- } from "./chunk-RNBYOUGV.js";
38
- import "./chunk-3HX5LZ6R.js";
39
- import "./chunk-7RYW5LQV.js";
35
+ } from "./chunk-RXFQM6FQ.js";
36
+ import {
37
+ LOAD_REPLAY_META_KEY
38
+ } from "./chunk-PZL23GTM.js";
39
+ import {
40
+ canonicalizeWorkspace
41
+ } from "./chunk-W7FJ3N32.js";
42
+ import {
43
+ DEFAULT_COMPACTED_REPLAY_MAX_BYTES,
44
+ normalizeCompactedReplayMaxBytes
45
+ } from "./chunk-COH43MRJ.js";
46
+ import "./chunk-WBL3FJEU.js";
47
+ import "./chunk-T2NCM2ET.js";
40
48
  import {
41
49
  loadServeFastPathSettings,
42
50
  preResolveServeFastPathHomeEnvOverrides
43
- } from "./chunk-DNV4FSN5.js";
51
+ } from "./chunk-3SJSQXNS.js";
52
+ import {
53
+ getGlobalQwenDirLite,
54
+ resolveConfigPathLite
55
+ } from "./chunk-3BTRNWWD.js";
56
+ import "./chunk-QRUIS3DN.js";
44
57
  import {
58
+ ChannelWebhookEnqueueError,
45
59
  QWEN_SERVER_TOKEN_ENV
46
- } from "./chunk-S6RLAIUR.js";
60
+ } from "./chunk-X4NKFGFJ.js";
47
61
  import {
48
62
  channelSelectionNames
49
- } from "./chunk-MX2YXRER.js";
50
- import {
51
- getGlobalQwenDirLite,
52
- resolveConfigPathLite
53
- } from "./chunk-4RQIB5UZ.js";
63
+ } from "./chunk-TJTKSVIV.js";
54
64
  import {
55
- LOAD_REPLAY_META_KEY
56
- } from "./chunk-AGHU5VRK.js";
65
+ sanitizeLogText
66
+ } from "./chunk-43JB7OF4.js";
67
+ import "./chunk-UDXSXLER.js";
57
68
  import {
58
- canonicalizeWorkspace
59
- } from "./chunk-ER3BKOLB.js";
69
+ isWithinRoot
70
+ } from "./chunk-RDJSGHZE.js";
60
71
  import {
61
72
  getCliVersion
62
- } from "./chunk-GD236YPV.js";
63
- import "./chunk-43W4YSO6.js";
73
+ } from "./chunk-CNOF2IZT.js";
74
+ import "./chunk-VJNBRRZG.js";
64
75
  import {
65
76
  writeStderrLine,
66
77
  writeStdoutLine
67
- } from "./chunk-Y6Z2O3WR.js";
68
- import {
69
- isWithinRoot
70
- } from "./chunk-QYUE6W3T.js";
71
- import "./chunk-5P5XGNYH.js";
72
- import "./chunk-SKAZWEV5.js";
73
- import "./chunk-UWCTAVOD.js";
74
- import "./chunk-SYCJMSIJ.js";
78
+ } from "./chunk-YUZI3WAC.js";
79
+ import "./chunk-CU3L64TP.js";
80
+ import "./chunk-ZJE7NSL3.js";
81
+ import "./chunk-H6XPXXMH.js";
82
+ import "./chunk-CR3C7WXL.js";
83
+ import "./chunk-XWRJCPHC.js";
75
84
  import {
76
85
  finalizeStartupProfile,
77
86
  profileCheckpoint
78
- } from "./chunk-ITOGNELQ.js";
79
- import "./chunk-FXGLL2HL.js";
80
- import "./chunk-QN5NZ3UQ.js";
81
- import "./chunk-BR4QREVK.js";
87
+ } from "./chunk-QSWDGAIC.js";
88
+ import "./chunk-Q7YDKOGY.js";
89
+ import "./chunk-DMTGGOSA.js";
90
+ import "./chunk-YQ3U5MUC.js";
82
91
  import {
83
92
  init_esbuild_shims
84
- } from "./chunk-A4BMJM77.js";
93
+ } from "./chunk-5O2XNYP6.js";
85
94
  import {
86
95
  __name,
87
96
  __toESM
@@ -90,7 +99,7 @@ import {
90
99
  // packages/cli/src/serve/run-qwen-serve.ts
91
100
  init_esbuild_shims();
92
101
  var import_express = __toESM(require_express(), 1);
93
- import { X509Certificate } from "node:crypto";
102
+ import { X509Certificate, createHash as createHash2, timingSafeEqual } from "node:crypto";
94
103
  import * as fs from "node:fs";
95
104
  import * as https from "node:https";
96
105
  import * as path from "node:path";
@@ -105,7 +114,7 @@ var DuplicateWorkspaceInputError = class extends Error {
105
114
  }
106
115
  constructor(workspace) {
107
116
  super(
108
- `Duplicate --workspace value resolves to ${JSON.stringify(workspace)}. Multi-workspace serve is not enabled; pass one --workspace.`
117
+ `Duplicate --workspace value resolves to ${JSON.stringify(workspace)}. Pass distinct --workspace values.`
109
118
  );
110
119
  this.name = "DuplicateWorkspaceInputError";
111
120
  }
@@ -116,22 +125,11 @@ var NestedWorkspaceInputError = class extends Error {
116
125
  }
117
126
  constructor(parent, child) {
118
127
  super(
119
- `Nested --workspace values are not supported yet: ${JSON.stringify(child)} is inside ${JSON.stringify(parent)}. Multi-workspace serve is not enabled; pass one --workspace.`
128
+ `Nested --workspace values are not supported yet: ${JSON.stringify(child)} is inside ${JSON.stringify(parent)}. Pass non-nested --workspace values.`
120
129
  );
121
130
  this.name = "NestedWorkspaceInputError";
122
131
  }
123
132
  };
124
- var MultipleWorkspaceInputError = class extends Error {
125
- static {
126
- __name(this, "MultipleWorkspaceInputError");
127
- }
128
- constructor() {
129
- super(
130
- "Multiple --workspace values are not supported yet. Multi-workspace serve is not enabled; pass one --workspace."
131
- );
132
- this.name = "MultipleWorkspaceInputError";
133
- }
134
- };
135
133
  var MissingWorkspaceInputError = class extends Error {
136
134
  static {
137
135
  __name(this, "MissingWorkspaceInputError");
@@ -156,7 +154,7 @@ function isNestedWorkspace(parent, child) {
156
154
  return parent !== child && isWithinRoot(child, parent);
157
155
  }
158
156
  __name(isNestedWorkspace, "isNestedWorkspace");
159
- function rejectUnsupportedMultiWorkspaceInputs(workspaces) {
157
+ function rejectDuplicateOrNestedWorkspaceInputs(workspaces) {
160
158
  if (workspaces.length <= 1) return;
161
159
  let canonicalWorkspaces;
162
160
  try {
@@ -164,7 +162,7 @@ function rejectUnsupportedMultiWorkspaceInputs(workspaces) {
164
162
  (workspace) => canonicalizeWorkspace(workspace)
165
163
  );
166
164
  } catch {
167
- throw new MultipleWorkspaceInputError();
165
+ return;
168
166
  }
169
167
  const seen = /* @__PURE__ */ new Set();
170
168
  for (const workspace of canonicalWorkspaces) {
@@ -185,15 +183,14 @@ function rejectUnsupportedMultiWorkspaceInputs(workspaces) {
185
183
  }
186
184
  }
187
185
  }
188
- throw new MultipleWorkspaceInputError();
189
186
  }
190
- __name(rejectUnsupportedMultiWorkspaceInputs, "rejectUnsupportedMultiWorkspaceInputs");
191
- function resolveSingleWorkspaceInput(workspace) {
187
+ __name(rejectDuplicateOrNestedWorkspaceInputs, "rejectDuplicateOrNestedWorkspaceInputs");
188
+ function resolveWorkspaceInputs(workspace) {
192
189
  const workspaces = normalizeWorkspaceInputs(workspace);
193
- rejectUnsupportedMultiWorkspaceInputs(workspaces);
194
- return workspaces[0];
190
+ rejectDuplicateOrNestedWorkspaceInputs(workspaces);
191
+ return workspaces;
195
192
  }
196
- __name(resolveSingleWorkspaceInput, "resolveSingleWorkspaceInput");
193
+ __name(resolveWorkspaceInputs, "resolveWorkspaceInputs");
197
194
 
198
195
  // packages/cli/src/serve/permission-audit.ts
199
196
  init_esbuild_shims();
@@ -939,11 +936,21 @@ function isNonNegativeIntegerOrInfinity(value) {
939
936
  return value === Number.POSITIVE_INFINITY || Number.isFinite(value) && Number.isInteger(value) && value >= 0;
940
937
  }
941
938
  __name(isNonNegativeIntegerOrInfinity, "isNonNegativeIntegerOrInfinity");
939
+ function deriveDefaultMaxTotalSessions(maxSessionsPerWorkspace, workspaceCount) {
940
+ if (workspaceCount <= 1) return void 0;
941
+ const perWorkspace = maxSessionsPerWorkspace ?? DEFAULT_MAX_SESSIONS;
942
+ if (perWorkspace === 0 || perWorkspace === Number.POSITIVE_INFINITY) {
943
+ return void 0;
944
+ }
945
+ return perWorkspace * workspaceCount;
946
+ }
947
+ __name(deriveDefaultMaxTotalSessions, "deriveDefaultMaxTotalSessions");
942
948
  function isNonNegativeIntegerMs(value) {
943
949
  return Number.isFinite(value) && Number.isInteger(value) && value >= 0;
944
950
  }
945
951
  __name(isNonNegativeIntegerMs, "isNonNegativeIntegerMs");
946
952
  var MAX_TIMEOUT_MS = 2147483647;
953
+ var MAX_PORT_ATTEMPTS = 10;
947
954
  function assertTimerDelayInRange(name, value) {
948
955
  if (value > MAX_TIMEOUT_MS) {
949
956
  throw new TypeError(
@@ -1071,6 +1078,10 @@ function extractContextFilename(value) {
1071
1078
  return void 0;
1072
1079
  }
1073
1080
  __name(extractContextFilename, "extractContextFilename");
1081
+ function sessionArtifactsPersistenceAvailableFromSettings(settings) {
1082
+ return settings?.general?.chatRecording !== false;
1083
+ }
1084
+ __name(sessionArtifactsPersistenceAvailableFromSettings, "sessionArtifactsPersistenceAvailableFromSettings");
1074
1085
  var settingsWriteLocks = /* @__PURE__ */ new Map();
1075
1086
  function withSettingsLock(workspace, fn) {
1076
1087
  const prev = settingsWriteLocks.get(workspace) ?? Promise.resolve();
@@ -1082,11 +1093,13 @@ __name(withSettingsLock, "withSettingsLock");
1082
1093
  var channelWorkerRuntimePromise;
1083
1094
  async function loadChannelWorkerRuntime() {
1084
1095
  channelWorkerRuntimePromise ??= Promise.all([
1085
- import("./channel-worker-supervisor-CRCVYQIE.js"),
1086
- import("./pidfile-LIBUENIV.js")
1087
- ]).then(([supervisor, pidfile]) => ({
1096
+ import("./channel-worker-supervisor-LF66HCVT.js"),
1097
+ import("./pidfile-O3OO2TCP.js"),
1098
+ import("./cli-entry-path-4VJ3Y6T2.js")
1099
+ ]).then(([supervisor, pidfile, cliEntryPath]) => ({
1088
1100
  createChannelWorkerSupervisor: supervisor.createChannelWorkerSupervisor,
1089
- channelServicePidfile: pidfile
1101
+ channelServicePidfile: pidfile,
1102
+ findCliEntryPath: cliEntryPath.findCliEntryPath
1090
1103
  })).catch((err) => {
1091
1104
  channelWorkerRuntimePromise = void 0;
1092
1105
  throw err;
@@ -1105,9 +1118,18 @@ function createDisabledChannelWorkerSupervisor() {
1105
1118
  },
1106
1119
  async stop() {
1107
1120
  },
1121
+ async restart() {
1122
+ return { ...snapshot, channels: [] };
1123
+ },
1108
1124
  killAllSync() {
1109
1125
  },
1110
- snapshot: /* @__PURE__ */ __name(() => ({ ...snapshot, channels: [] }), "snapshot")
1126
+ snapshot: /* @__PURE__ */ __name(() => ({ ...snapshot, channels: [] }), "snapshot"),
1127
+ async enqueueWebhookTask() {
1128
+ throw new ChannelWebhookEnqueueError(
1129
+ "channel_worker_unavailable",
1130
+ "Channel worker is not running."
1131
+ );
1132
+ }
1111
1133
  };
1112
1134
  }
1113
1135
  __name(createDisabledChannelWorkerSupervisor, "createDisabledChannelWorkerSupervisor");
@@ -1154,7 +1176,7 @@ function shouldPreheatBridge(deps) {
1154
1176
  __name(shouldPreheatBridge, "shouldPreheatBridge");
1155
1177
  var coreRuntimePromise;
1156
1178
  function loadCoreRuntime() {
1157
- coreRuntimePromise ??= import("./src-XKZMNHXS.js");
1179
+ coreRuntimePromise ??= import("./src-2656Q6SN.js");
1158
1180
  return coreRuntimePromise;
1159
1181
  }
1160
1182
  __name(loadCoreRuntime, "loadCoreRuntime");
@@ -1184,17 +1206,34 @@ __name(resolveDaemonLogBaseDirForRun, "resolveDaemonLogBaseDirForRun");
1184
1206
  var settingsRuntimePromise;
1185
1207
  function loadSettingsRuntimeModules() {
1186
1208
  settingsRuntimePromise ??= Promise.all([
1187
- import("./settings-WFLNS3WT.js"),
1188
- import("./loadedSettingsAdapter-QVHHQPGM.js"),
1189
- import("./trustedFolders-Z475EIHL.js")
1190
- ]).then(([settings, loadedSettingsAdapter, trustedFolders]) => ({
1209
+ import("./settings-PYEU5HVD.js"),
1210
+ import("./environment-XCVLHOXG.js"),
1211
+ import("./loadedSettingsAdapter-EOD3RVZS.js"),
1212
+ import("./trustedFolders-BEX5334Z.js")
1213
+ ]).then(([settings, environment, loadedSettingsAdapter, trustedFolders]) => ({
1191
1214
  settings,
1215
+ environment,
1192
1216
  loadedSettingsAdapter,
1193
1217
  trustedFolders
1194
1218
  }));
1195
1219
  return settingsRuntimePromise;
1196
1220
  }
1197
1221
  __name(loadSettingsRuntimeModules, "loadSettingsRuntimeModules");
1222
+ var channelWebhookConfigRuntimePromise;
1223
+ function loadChannelWebhookConfigRuntime() {
1224
+ channelWebhookConfigRuntimePromise ??= Promise.all([
1225
+ import("./runtime-THE2YO27.js"),
1226
+ import("./config-utils-ZITWCFBY.js")
1227
+ ]).then(([channelRuntime, configUtils]) => ({
1228
+ loadChannelsConfig: channelRuntime.loadChannelsConfig,
1229
+ parseChannelWebhookConfig: configUtils.parseChannelWebhookConfig
1230
+ })).catch((err) => {
1231
+ channelWebhookConfigRuntimePromise = void 0;
1232
+ throw err;
1233
+ });
1234
+ return channelWebhookConfigRuntimePromise;
1235
+ }
1236
+ __name(loadChannelWebhookConfigRuntime, "loadChannelWebhookConfigRuntime");
1198
1237
  async function loadServeRuntimeModules() {
1199
1238
  const [
1200
1239
  serverModule,
@@ -1204,16 +1243,20 @@ async function loadServeRuntimeModules() {
1204
1243
  workspaceTypesModule,
1205
1244
  daemonStatusProviderModule,
1206
1245
  workspaceProvidersStatusModule,
1207
- workspaceSkillsStatusModule
1246
+ workspaceSkillsStatusModule,
1247
+ totalSessionAdmissionModule,
1248
+ workspaceRegistryModule
1208
1249
  ] = await Promise.all([
1209
- import("./server-M372UENX.js"),
1210
- import("./bridge-BCU73DZO.js"),
1211
- import("./spawnChannel-RQHUWTCL.js"),
1212
- import("./workspace-service-OMBR6ZLG.js"),
1213
- import("./types-QX5C3CHJ.js"),
1214
- import("./daemon-status-provider-XSAFKVDS.js"),
1215
- import("./workspace-providers-status-MVYXMYDG.js"),
1216
- import("./workspace-skills-status-IMMQ7CAY.js")
1250
+ import("./server-SAEKMY52.js"),
1251
+ import("./bridge-OJL6LD42.js"),
1252
+ import("./spawnChannel-62QKQBQN.js"),
1253
+ import("./workspace-service-4QUMVGBX.js"),
1254
+ import("./types-JNKGKUJT.js"),
1255
+ import("./daemon-status-provider-7XJZ3HPS.js"),
1256
+ import("./workspace-providers-status-NE7QWEYS.js"),
1257
+ import("./workspace-skills-status-L34BYRSY.js"),
1258
+ import("./total-session-admission-EQIHUOL6.js"),
1259
+ import("./workspace-registry-RCWAP57G.js")
1217
1260
  ]);
1218
1261
  return {
1219
1262
  createServeApp: serverModule.createServeApp,
@@ -1226,7 +1269,10 @@ async function loadServeRuntimeModules() {
1226
1269
  WorkspaceSettingsPartialPersistError: workspaceTypesModule.WorkspaceSettingsPartialPersistError,
1227
1270
  createDaemonStatusProvider: daemonStatusProviderModule.createDaemonStatusProvider,
1228
1271
  createWorkspaceProvidersStatusProvider: workspaceProvidersStatusModule.createWorkspaceProvidersStatusProvider,
1229
- createWorkspaceSkillsStatusProvider: workspaceSkillsStatusModule.createWorkspaceSkillsStatusProvider
1272
+ createWorkspaceSkillsStatusProvider: workspaceSkillsStatusModule.createWorkspaceSkillsStatusProvider,
1273
+ createTotalSessionAdmissionController: totalSessionAdmissionModule.createTotalSessionAdmissionController,
1274
+ createWorkspaceRegistry: workspaceRegistryModule.createWorkspaceRegistry,
1275
+ createWorkspaceSessionOwnerIndex: workspaceRegistryModule.createWorkspaceSessionOwnerIndex
1230
1276
  };
1231
1277
  }
1232
1278
  __name(loadServeRuntimeModules, "loadServeRuntimeModules");
@@ -1250,7 +1296,7 @@ function sessionIdleTimeoutMs(value) {
1250
1296
  return value !== void 0 ? channelIdleTimeoutMs(value) : DEFAULT_SESSION_IDLE_TIMEOUT_MS;
1251
1297
  }
1252
1298
  __name(sessionIdleTimeoutMs, "sessionIdleTimeoutMs");
1253
- function currentServeFeaturesForRunQwenServe(opts, sessionShellCommandEnabled) {
1299
+ function currentServeFeaturesForRunQwenServe(opts, sessionShellCommandEnabled, sessionArtifactsPersistenceAvailable, env) {
1254
1300
  return getAdvertisedServeFeatures(void 0, {
1255
1301
  requireAuth: opts.requireAuth === true,
1256
1302
  mcpPoolActive: opts.mcpPoolActive !== false,
@@ -1259,12 +1305,15 @@ function currentServeFeaturesForRunQwenServe(opts, sessionShellCommandEnabled) {
1259
1305
  ...opts.writerIdleTimeoutMs !== void 0 ? { writerIdleTimeoutMs: opts.writerIdleTimeoutMs } : {},
1260
1306
  persistSettingAvailable: true,
1261
1307
  sessionShellCommandEnabled,
1308
+ sessionArtifactsPersistenceAvailable,
1262
1309
  rateLimit: opts.rateLimit === true,
1263
1310
  reloadAvailable: true,
1311
+ channelReloadAvailable: opts.channelSelection !== void 0,
1264
1312
  // Advertise the same WS feature flags as the runtime path (serve-features.ts)
1265
1313
  // so the bootstrap `/capabilities` window doesn't briefly under-report them.
1266
1314
  clientMcpOverWsEnabled: opts.clientMcpOverWs === true,
1267
- cdpTunnelOverWsEnabled: opts.cdpTunnelOverWs === true
1315
+ cdpTunnelOverWsEnabled: opts.cdpTunnelOverWs === true,
1316
+ browserAutomationMcpAvailable: isBrowserAutomationMcpAvailable(opts, env)
1268
1317
  });
1269
1318
  }
1270
1319
  __name(currentServeFeaturesForRunQwenServe, "currentServeFeaturesForRunQwenServe");
@@ -1276,7 +1325,9 @@ function createBootstrapCapabilities(input) {
1276
1325
  mode: input.opts.mode,
1277
1326
  features: currentServeFeaturesForRunQwenServe(
1278
1327
  input.opts,
1279
- input.sessionShellCommandEnabled
1328
+ input.sessionShellCommandEnabled,
1329
+ input.sessionArtifactsPersistenceAvailable,
1330
+ input.env
1280
1331
  ),
1281
1332
  modelServices: [],
1282
1333
  workspaceCwd: input.boundWorkspace,
@@ -1421,7 +1472,9 @@ function createBootstrapServeApp(input) {
1421
1472
  daemonLog,
1422
1473
  qwenCodeVersion,
1423
1474
  sessionShellCommandEnabled,
1475
+ sessionArtifactsPersistenceAvailable,
1424
1476
  permissionPolicy,
1477
+ multiWorkspaceCapabilitiesRequireRuntime,
1425
1478
  getRuntimeError,
1426
1479
  getChannelWorkerSnapshot,
1427
1480
  onHealthServed
@@ -1458,13 +1511,26 @@ function createBootstrapServeApp(input) {
1458
1511
  app.get(BOOTSTRAP_HEALTH_PATH, healthHandler);
1459
1512
  }
1460
1513
  app.get(BOOTSTRAP_CAPABILITIES_PATH, (_req, res) => {
1514
+ if (multiWorkspaceCapabilitiesRequireRuntime) {
1515
+ const runtimeError = getRuntimeError();
1516
+ if (runtimeError === void 0) {
1517
+ res.setHeader("Retry-After", "1");
1518
+ }
1519
+ res.status(503).json({
1520
+ error: runtimeError ? "Daemon runtime failed to start" : "Daemon runtime is still starting",
1521
+ code: runtimeError ? "daemon_runtime_failed" : "daemon_runtime_starting"
1522
+ });
1523
+ return;
1524
+ }
1461
1525
  res.status(200).json(
1462
1526
  createBootstrapCapabilities({
1463
1527
  opts,
1464
1528
  boundWorkspace,
1465
1529
  qwenCodeVersion,
1466
1530
  sessionShellCommandEnabled,
1467
- permissionPolicy
1531
+ sessionArtifactsPersistenceAvailable,
1532
+ permissionPolicy,
1533
+ env: process.env
1468
1534
  })
1469
1535
  );
1470
1536
  });
@@ -1518,11 +1584,13 @@ function createBootstrapServeApp(input) {
1518
1584
  },
1519
1585
  limits: {
1520
1586
  maxSessions: advertisedMaxSessions(opts.maxSessions),
1587
+ maxTotalSessions: positiveFiniteOrNull(opts.maxTotalSessions),
1521
1588
  maxPendingPromptsPerSession: advertisedMaxPendingPromptsPerSession(
1522
1589
  opts.maxPendingPromptsPerSession
1523
1590
  ),
1524
1591
  listenerMaxConnections: listenerMaxConnections(opts.maxConnections),
1525
1592
  eventRingSize: opts.eventRingSize ?? DEFAULT_EVENT_RING_SIZE,
1593
+ compactedReplayMaxBytes: opts.compactedReplayMaxBytes ?? DEFAULT_COMPACTED_REPLAY_MAX_BYTES,
1526
1594
  promptDeadlineMs: positiveFiniteOrNull(opts.promptDeadlineMs),
1527
1595
  writerIdleTimeoutMs: positiveFiniteOrNull(opts.writerIdleTimeoutMs),
1528
1596
  channelIdleTimeoutMs: channelIdleTimeoutMs(opts.channelIdleTimeoutMs),
@@ -1533,7 +1601,9 @@ function createBootstrapServeApp(input) {
1533
1601
  protocolVersions: getServeProtocolVersions(),
1534
1602
  features: currentServeFeaturesForRunQwenServe(
1535
1603
  opts,
1536
- sessionShellCommandEnabled
1604
+ sessionShellCommandEnabled,
1605
+ sessionArtifactsPersistenceAvailable,
1606
+ process.env
1537
1607
  )
1538
1608
  },
1539
1609
  runtime: {
@@ -1605,13 +1675,12 @@ function createDelegatingServeApp(bootstrapApp, getRuntimeApp, options = {}) {
1605
1675
  const dispatch = /* @__PURE__ */ __name(async () => {
1606
1676
  let target = getRuntimeApp();
1607
1677
  if (!target && options.waitForDeferredRuntimeRoutes === true && !isBootstrapServeRoute(req) && !isCorsPreflightRequest(req) && options.startRuntime && options.runtimeReady) {
1608
- if (options.authenticateDeferredRuntimeRequest && !runSynchronousRequestGate(
1609
- options.authenticateDeferredRuntimeRequest,
1610
- req,
1611
- res,
1612
- next
1613
- )) {
1614
- return;
1678
+ const webhookRequest = isChannelWebhookRequest(req);
1679
+ const authGate = webhookRequest ? options.authenticateDeferredChannelWebhookRequest ?? options.authenticateDeferredRuntimeRequest : options.authenticateDeferredRuntimeRequest;
1680
+ if (authGate) {
1681
+ if (!runSynchronousRequestGate(authGate, req, res, next)) {
1682
+ return;
1683
+ }
1615
1684
  }
1616
1685
  options.startRuntime();
1617
1686
  try {
@@ -1633,6 +1702,80 @@ function isBootstrapServeRoute(req) {
1633
1702
  return BOOTSTRAP_SERVE_PATHS.has(path2);
1634
1703
  }
1635
1704
  __name(isBootstrapServeRoute, "isBootstrapServeRoute");
1705
+ function isChannelWebhookRequest(req) {
1706
+ return req.method === "POST" && /^\/channels\/[^/]+\/webhooks\/[^/]+\/?$/u.test(req.path);
1707
+ }
1708
+ __name(isChannelWebhookRequest, "isChannelWebhookRequest");
1709
+ function createDeferredChannelWebhookAuth(workspace, runtime, daemonLog) {
1710
+ return (req, res, next) => {
1711
+ const match = /^\/channels\/([^/]+)\/webhooks\/([^/]+)\/?$/u.exec(req.path);
1712
+ const channelName = decodeDeferredWebhookPathSegment(match?.[1]);
1713
+ const source = decodeDeferredWebhookPathSegment(match?.[2]);
1714
+ if (!channelName || !source) {
1715
+ daemonLog.warn("deferred webhook auth failed", {
1716
+ channelName: channelName ?? "unknown",
1717
+ source: source ?? "unknown",
1718
+ reason: "invalid webhook path"
1719
+ });
1720
+ res.status(401).json({ error: "Invalid webhook secret" });
1721
+ return;
1722
+ }
1723
+ const secret = readDeferredWebhookSecret(
1724
+ runtime,
1725
+ workspace,
1726
+ channelName,
1727
+ source
1728
+ );
1729
+ if (!matchesWebhookSecret(req.get("x-qwen-webhook-secret"), secret)) {
1730
+ daemonLog.warn("deferred webhook auth failed", {
1731
+ channelName,
1732
+ source,
1733
+ reason: secret ? "secret mismatch" : "source not configured"
1734
+ });
1735
+ res.status(401).json({ error: "Invalid webhook secret" });
1736
+ return;
1737
+ }
1738
+ next();
1739
+ };
1740
+ }
1741
+ __name(createDeferredChannelWebhookAuth, "createDeferredChannelWebhookAuth");
1742
+ function decodeDeferredWebhookPathSegment(segment) {
1743
+ if (segment === void 0) return void 0;
1744
+ try {
1745
+ return decodeURIComponent(segment);
1746
+ } catch {
1747
+ return void 0;
1748
+ }
1749
+ }
1750
+ __name(decodeDeferredWebhookPathSegment, "decodeDeferredWebhookPathSegment");
1751
+ function readDeferredWebhookSecret(runtime, workspace, channelName, source) {
1752
+ try {
1753
+ const rawConfig = runtime.loadChannelsConfig(workspace)[channelName];
1754
+ if (typeof rawConfig !== "object" || rawConfig === null) {
1755
+ return void 0;
1756
+ }
1757
+ return runtime.parseChannelWebhookConfig(
1758
+ channelName,
1759
+ rawConfig
1760
+ )?.sources[source]?.secret;
1761
+ } catch (err) {
1762
+ const reason = err instanceof Error ? err.message : String(err);
1763
+ writeStderrLine(
1764
+ `[webhook-secret] failed to read deferred webhook secret for ${sanitizeLogText(channelName, 128)}/${sanitizeLogText(source, 128)}: ${sanitizeLogText(reason, 512)}`
1765
+ );
1766
+ return void 0;
1767
+ }
1768
+ }
1769
+ __name(readDeferredWebhookSecret, "readDeferredWebhookSecret");
1770
+ function matchesWebhookSecret(candidate, expected) {
1771
+ if (typeof candidate !== "string" || typeof expected !== "string" || expected.length === 0) {
1772
+ return false;
1773
+ }
1774
+ const expectedDigest = createHash2("sha256").update(expected).digest();
1775
+ const candidateDigest = createHash2("sha256").update(candidate).digest();
1776
+ return timingSafeEqual(expectedDigest, candidateDigest);
1777
+ }
1778
+ __name(matchesWebhookSecret, "matchesWebhookSecret");
1636
1779
  function isCorsPreflightRequest(req) {
1637
1780
  return req.method === "OPTIONS" && Boolean(req.headers.origin) && Boolean(
1638
1781
  req.headers["access-control-request-method"] || req.headers["access-control-request-headers"]
@@ -1663,6 +1806,9 @@ async function runQwenServe(optsIn, deps = {}) {
1663
1806
  }
1664
1807
  };
1665
1808
  preResolveServeFastPathHomeEnvOverrides();
1809
+ const daemonRuntimeBaseEnv = Object.freeze({
1810
+ ...process.env
1811
+ });
1666
1812
  const rawToken = optsIn.token ?? process.env[QWEN_SERVER_TOKEN_ENV];
1667
1813
  const token = typeof rawToken === "string" && rawToken.trim().length > 0 ? rawToken.trim() : void 0;
1668
1814
  const sessionShellCommandEnabled = optsIn.enableSessionShell === true && token !== void 0;
@@ -1684,7 +1830,8 @@ async function runQwenServe(optsIn, deps = {}) {
1684
1830
  const chromeExtensionOriginAllowed = hasChromeExtensionOrigin(
1685
1831
  optsIn.allowOrigins
1686
1832
  );
1687
- const rawWorkspace = resolveSingleWorkspaceInput(optsIn.workspace);
1833
+ const rawWorkspaces = resolveWorkspaceInputs(optsIn.workspace);
1834
+ const rawWorkspace = rawWorkspaces[0];
1688
1835
  const opts = {
1689
1836
  ...optsIn,
1690
1837
  token,
@@ -1830,41 +1977,84 @@ async function runQwenServe(optsIn, deps = {}) {
1830
1977
  "qwen serve: --allow-private-auth-base-url enabled; /workspace/auth/provider may install localhost/private-network model endpoints. Use only for local development with trusted clients."
1831
1978
  );
1832
1979
  }
1833
- if (!path.isAbsolute(rawWorkspace)) {
1834
- throw new Error(
1835
- `Invalid --workspace "${rawWorkspace}": must be an absolute path.`
1836
- );
1837
- }
1838
- try {
1839
- const stats = fs.statSync(rawWorkspace);
1840
- if (!stats.isDirectory()) {
1980
+ const validateAndCanonicalizeWorkspace = /* @__PURE__ */ __name((workspace) => {
1981
+ if (!path.isAbsolute(workspace)) {
1841
1982
  throw new Error(
1842
- `Invalid --workspace "${rawWorkspace}": exists but is not a directory.`
1983
+ `Invalid --workspace "${workspace}": must be an absolute path.`
1843
1984
  );
1844
1985
  }
1845
- } catch (err) {
1846
- if (err && typeof err === "object" && "code" in err) {
1847
- const code = err.code;
1848
- if (code === "ENOENT") {
1986
+ try {
1987
+ const stats = fs.statSync(workspace);
1988
+ if (!stats.isDirectory()) {
1849
1989
  throw new Error(
1850
- `Invalid --workspace "${rawWorkspace}": directory does not exist.`
1990
+ `Invalid --workspace "${workspace}": exists but is not a directory.`
1851
1991
  );
1852
1992
  }
1853
- if (code === "EACCES" || code === "EPERM") {
1993
+ } catch (err) {
1994
+ if (err && typeof err === "object" && "code" in err) {
1995
+ const code = err.code;
1996
+ if (code === "ENOENT") {
1997
+ throw new Error(
1998
+ `Invalid --workspace "${workspace}": directory does not exist.`
1999
+ );
2000
+ }
2001
+ if (code === "EACCES" || code === "EPERM") {
2002
+ throw new Error(
2003
+ `Invalid --workspace "${workspace}": permission denied (${String(code)}). The path exists but cannot be stat'd by the current user.`
2004
+ );
2005
+ }
2006
+ }
2007
+ throw err;
2008
+ }
2009
+ return canonicalizeWorkspace(workspace);
2010
+ }, "validateAndCanonicalizeWorkspace");
2011
+ const workspaceInputs = rawWorkspaces.map((workspace) => ({
2012
+ raw: workspace,
2013
+ cwd: validateAndCanonicalizeWorkspace(workspace)
2014
+ }));
2015
+ const boundWorkspace = workspaceInputs[0].cwd;
2016
+ const seenCanonicalWorkspaces = /* @__PURE__ */ new Set();
2017
+ for (const workspace of workspaceInputs) {
2018
+ if (seenCanonicalWorkspaces.has(workspace.cwd)) {
2019
+ throw new Error(
2020
+ `Duplicate --workspace value resolves to ${JSON.stringify(
2021
+ workspace.cwd
2022
+ )}.`
2023
+ );
2024
+ }
2025
+ seenCanonicalWorkspaces.add(workspace.cwd);
2026
+ }
2027
+ for (let i = 0; i < workspaceInputs.length; i++) {
2028
+ for (let j = i + 1; j < workspaceInputs.length; j++) {
2029
+ const first = workspaceInputs[i].cwd;
2030
+ const second = workspaceInputs[j].cwd;
2031
+ const firstRel = path.relative(first, second);
2032
+ const secondRel = path.relative(second, first);
2033
+ if (firstRel && !firstRel.startsWith("..") && !path.isAbsolute(firstRel)) {
1854
2034
  throw new Error(
1855
- `Invalid --workspace "${rawWorkspace}": permission denied (${String(code)}). The path exists but cannot be stat'd by the current user.`
2035
+ `Nested --workspace values are not supported: ${JSON.stringify(second)} is inside ${JSON.stringify(first)}.`
2036
+ );
2037
+ }
2038
+ if (secondRel && !secondRel.startsWith("..") && !path.isAbsolute(secondRel)) {
2039
+ throw new Error(
2040
+ `Nested --workspace values are not supported: ${JSON.stringify(first)} is inside ${JSON.stringify(second)}.`
1856
2041
  );
1857
2042
  }
1858
2043
  }
1859
- throw err;
1860
2044
  }
1861
- const boundWorkspace = canonicalizeWorkspace(rawWorkspace);
2045
+ if (workspaceInputs.length > 1 && deps.bridge) {
2046
+ throw new Error(
2047
+ "Injected bridge dependencies are only supported with a single workspace; multiple --workspace values require runQwenServe to construct one bridge per workspace."
2048
+ );
2049
+ }
1862
2050
  let contextFilenameForInit;
1863
2051
  let permissionPolicy;
1864
2052
  let permissionConsensusQuorum;
1865
2053
  let bootSettings;
2054
+ let sessionArtifactsPersistenceAvailable = true;
1866
2055
  try {
1867
2056
  bootSettings = deps.bootSettings ?? loadServeFastPathSettings(boundWorkspace);
2057
+ sessionArtifactsPersistenceAvailable = sessionArtifactsPersistenceAvailableFromSettings(bootSettings);
1868
2058
  contextFilenameForInit = extractContextFilename(
1869
2059
  bootSettings.context?.fileName
1870
2060
  );
@@ -1919,6 +2109,13 @@ async function runQwenServe(optsIn, deps = {}) {
1919
2109
  );
1920
2110
  }
1921
2111
  }
2112
+ if (opts.maxTotalSessions !== void 0) {
2113
+ if (!isNonNegativeIntegerOrInfinity(opts.maxTotalSessions)) {
2114
+ throw new TypeError(
2115
+ `Invalid maxTotalSessions: ${opts.maxTotalSessions}. Must be a non-negative integer (0 / Infinity = unlimited).`
2116
+ );
2117
+ }
2118
+ }
1922
2119
  if (opts.maxPendingPromptsPerSession !== void 0) {
1923
2120
  if (!isNonNegativeIntegerOrInfinity(opts.maxPendingPromptsPerSession)) {
1924
2121
  throw new TypeError(
@@ -1933,6 +2130,9 @@ async function runQwenServe(optsIn, deps = {}) {
1933
2130
  );
1934
2131
  }
1935
2132
  }
2133
+ if (opts.compactedReplayMaxBytes !== void 0) {
2134
+ normalizeCompactedReplayMaxBytes(opts.compactedReplayMaxBytes);
2135
+ }
1936
2136
  if (opts.writerIdleTimeoutMs !== void 0) {
1937
2137
  if (!isPositiveIntegerMs(opts.writerIdleTimeoutMs)) {
1938
2138
  throw new TypeError(
@@ -1968,6 +2168,10 @@ async function runQwenServe(optsIn, deps = {}) {
1968
2168
  );
1969
2169
  }
1970
2170
  }
2171
+ opts.maxTotalSessions ??= deriveDefaultMaxTotalSessions(
2172
+ opts.maxSessions,
2173
+ workspaceInputs.length
2174
+ );
1971
2175
  const inheritedNoPool = process.env["QWEN_SERVE_NO_MCP_POOL"] === "1";
1972
2176
  if (opts.mcpPoolActive === void 0 && inheritedNoPool) {
1973
2177
  opts.mcpPoolActive = false;
@@ -2005,6 +2209,7 @@ async function runQwenServe(optsIn, deps = {}) {
2005
2209
  let runtimeApp;
2006
2210
  let runtimeAppForCleanup;
2007
2211
  let bridgeRef = deps.bridge;
2212
+ const internalRuntimeBridgesForCleanup = [];
2008
2213
  let daemonEventLoopMonitor;
2009
2214
  let daemonMetricsSampler;
2010
2215
  let runtimeStartupError;
@@ -2029,6 +2234,7 @@ async function runQwenServe(optsIn, deps = {}) {
2029
2234
  }, "disposeDaemonEventLoopMonitor");
2030
2235
  let channelWorker = createDisabledChannelWorkerSupervisor();
2031
2236
  const getChannelWorkerSnapshot = /* @__PURE__ */ __name(() => channelWorker.snapshot(), "getChannelWorkerSnapshot");
2237
+ const reloadChannelWorker = /* @__PURE__ */ __name(() => channelWorker.restart(), "reloadChannelWorker");
2032
2238
  const writeChannelWorkerPidfile = /* @__PURE__ */ __name((snapshot = channelWorker.snapshot(), options = {}) => {
2033
2239
  if (!opts.channelSelection || !channelServicePidfile) return;
2034
2240
  try {
@@ -2047,6 +2253,17 @@ async function runQwenServe(optsIn, deps = {}) {
2047
2253
  () => bridgeRef,
2048
2254
  () => runtimeStartupError
2049
2255
  );
2256
+ const shutdownBridges = /* @__PURE__ */ new WeakSet();
2257
+ const getRuntimeBridgesForCleanup = /* @__PURE__ */ __name(() => {
2258
+ const appForCleanup = runtimeApp ?? runtimeAppForCleanup;
2259
+ const registry = appForCleanup?.locals?.["workspaceRegistry"];
2260
+ const bridges = [
2261
+ ...registry ? registry.list().map((runtime) => runtime.bridge) : [],
2262
+ ...bridgeRef ? [bridgeRef] : [],
2263
+ ...internalRuntimeBridgesForCleanup
2264
+ ];
2265
+ return [...new Set(bridges)];
2266
+ }, "getRuntimeBridgesForCleanup");
2050
2267
  const buildRuntime = /* @__PURE__ */ __name(async () => {
2051
2268
  const [runtime, core, settingsRuntime, resolvedCliVersion] = await Promise.all([
2052
2269
  loadServeRuntimeModules(),
@@ -2073,6 +2290,43 @@ async function runQwenServe(optsIn, deps = {}) {
2073
2290
  { workspace: boundWorkspace }
2074
2291
  );
2075
2292
  }
2293
+ const runtimeEnvSnapshot = runtimeBootSettings ? settingsRuntime.environment.buildRuntimeEnvironment(
2294
+ runtimeBootSettings.merged,
2295
+ boundWorkspace,
2296
+ daemonRuntimeBaseEnv
2297
+ ) : {
2298
+ effectiveEnv: { ...daemonRuntimeBaseEnv },
2299
+ overlayKeys: Object.freeze([]),
2300
+ envFilePaths: Object.freeze([]),
2301
+ envFileReadFailed: false,
2302
+ envFileReadFailures: Object.freeze([])
2303
+ };
2304
+ const logRuntimeEnvFileReadFailures = /* @__PURE__ */ __name((workspace, snapshot) => {
2305
+ if (!snapshot.envFileReadFailed) return;
2306
+ const failedFiles = snapshot.envFileReadFailures ?? [];
2307
+ daemonLog.warn("one or more runtime env files could not be read", {
2308
+ workspace,
2309
+ ...failedFiles.length > 0 ? { failedFiles } : {}
2310
+ });
2311
+ }, "logRuntimeEnvFileReadFailures");
2312
+ logRuntimeEnvFileReadFailures(boundWorkspace, runtimeEnvSnapshot);
2313
+ const runtimeEffectiveEnv = {
2314
+ ...runtimeEnvSnapshot.effectiveEnv
2315
+ };
2316
+ const replaceRuntimeEffectiveEnv = /* @__PURE__ */ __name((nextEnv) => {
2317
+ for (const key of Object.keys(runtimeEffectiveEnv)) {
2318
+ delete runtimeEffectiveEnv[key];
2319
+ }
2320
+ Object.assign(runtimeEffectiveEnv, nextEnv);
2321
+ }, "replaceRuntimeEffectiveEnv");
2322
+ const primaryRuntimeEnv = {
2323
+ mode: "runtime-overlay",
2324
+ overlayKeys: [...runtimeEnvSnapshot.overlayKeys],
2325
+ effectiveEnv: runtimeEffectiveEnv,
2326
+ envFilePaths: [...runtimeEnvSnapshot.envFilePaths],
2327
+ envFileReadFailed: runtimeEnvSnapshot.envFileReadFailed,
2328
+ envFileReadFailures: [...runtimeEnvSnapshot.envFileReadFailures]
2329
+ };
2076
2330
  const daemonWorkspaceHash = core.hashDaemonWorkspace(boundWorkspace);
2077
2331
  let daemonTelemetrySettings;
2078
2332
  try {
@@ -2145,54 +2399,58 @@ async function runQwenServe(optsIn, deps = {}) {
2145
2399
  promptQueueWaitStats.lastMs = durationMs;
2146
2400
  core.recordDaemonPromptQueueWait(durationMs);
2147
2401
  }, "recordPromptQueueWait");
2148
- const daemonTelemetry = core.createDaemonBridgeTelemetry();
2149
- daemonTelemetry.metrics = {
2150
- sessionLifecycle(action) {
2151
- core.recordDaemonSessionLifecycle(action);
2152
- core.emitDaemonLog(
2153
- `Session ${action}.`,
2154
- {
2155
- "qwen-code.workspace.hash": daemonWorkspaceHash
2156
- },
2157
- {
2158
- eventName: `qwen-code.daemon.session.${action}`
2159
- }
2160
- );
2161
- },
2162
- channelLifecycle(action, expected) {
2163
- core.recordDaemonChannelLifecycle(action, expected);
2164
- core.emitDaemonLog(
2165
- action === "spawn" ? "ACP channel spawned." : `ACP channel exited (expected=${expected ?? true}).`,
2166
- {
2167
- ...action === "exit" ? { "qwen-code.daemon.channel.expected": expected ?? true } : {}
2168
- },
2169
- {
2170
- eventName: `qwen-code.daemon.channel.${action}`,
2171
- ...expected === false && action === "exit" ? { severityNumber: 13 } : {}
2402
+ const createRuntimeBridgeTelemetry = /* @__PURE__ */ __name((workspaceHash) => {
2403
+ const telemetry = core.createDaemonBridgeTelemetry();
2404
+ telemetry.metrics = {
2405
+ sessionLifecycle(action) {
2406
+ core.recordDaemonSessionLifecycle(action);
2407
+ core.emitDaemonLog(
2408
+ `Session ${action}.`,
2409
+ {
2410
+ "qwen-code.workspace.hash": workspaceHash
2411
+ },
2412
+ {
2413
+ eventName: `qwen-code.daemon.session.${action}`
2414
+ }
2415
+ );
2416
+ },
2417
+ channelLifecycle(action, expected) {
2418
+ core.recordDaemonChannelLifecycle(action, expected);
2419
+ core.emitDaemonLog(
2420
+ action === "spawn" ? "ACP channel spawned." : `ACP channel exited (expected=${expected ?? true}).`,
2421
+ {
2422
+ ...action === "exit" ? { "qwen-code.daemon.channel.expected": expected ?? true } : {}
2423
+ },
2424
+ {
2425
+ eventName: `qwen-code.daemon.channel.${action}`,
2426
+ ...expected === false && action === "exit" ? { severityNumber: 13 } : {}
2427
+ }
2428
+ );
2429
+ },
2430
+ promptQueueWait(durationMs) {
2431
+ recordPromptQueueWait(durationMs);
2432
+ metricsRing.recordPromptQueueWait(durationMs);
2433
+ },
2434
+ promptDuration(durationMs) {
2435
+ core.recordDaemonPromptDuration(durationMs);
2436
+ metricsRing.recordPromptDuration(durationMs);
2437
+ },
2438
+ cancelled: core.recordDaemonCancel,
2439
+ // Per-round model token usage + LLM round-trip time sniffed off
2440
+ // `agent_message_chunk._meta` (`usage` + `durationMs`) at the bridge's
2441
+ // single session/update fan-in. Increments (not cumulative), so the ring
2442
+ // sums tokens per window (token-burn chart) and pools the round-trip times
2443
+ // for the LLM-latency percentiles.
2444
+ tokenUsage(inputTokens, outputTokens, durationMs) {
2445
+ metricsRing.recordTokens(inputTokens, outputTokens);
2446
+ if (typeof durationMs === "number") {
2447
+ metricsRing.recordLlmDuration(durationMs);
2172
2448
  }
2173
- );
2174
- },
2175
- promptQueueWait(durationMs) {
2176
- recordPromptQueueWait(durationMs);
2177
- metricsRing.recordPromptQueueWait(durationMs);
2178
- },
2179
- promptDuration(durationMs) {
2180
- core.recordDaemonPromptDuration(durationMs);
2181
- metricsRing.recordPromptDuration(durationMs);
2182
- },
2183
- cancelled: core.recordDaemonCancel,
2184
- // Per-round model token usage + LLM round-trip time sniffed off
2185
- // `agent_message_chunk._meta` (`usage` + `durationMs`) at the bridge's
2186
- // single session/update fan-in. Increments (not cumulative), so the ring
2187
- // sums tokens per window (token-burn chart) and pools the round-trip times
2188
- // for the LLM-latency percentiles.
2189
- tokenUsage(inputTokens, outputTokens, durationMs) {
2190
- metricsRing.recordTokens(inputTokens, outputTokens);
2191
- if (typeof durationMs === "number") {
2192
- metricsRing.recordLlmDuration(durationMs);
2193
2449
  }
2194
- }
2195
- };
2450
+ };
2451
+ return telemetry;
2452
+ }, "createRuntimeBridgeTelemetry");
2453
+ const daemonTelemetry = createRuntimeBridgeTelemetry(daemonWorkspaceHash);
2196
2454
  const permissionAuditRing = new PermissionAuditRing();
2197
2455
  const permissionAuditPublisher = createPermissionAuditPublisher({
2198
2456
  ring: permissionAuditRing
@@ -2239,7 +2497,17 @@ async function runQwenServe(optsIn, deps = {}) {
2239
2497
  pathLocks: sharedPathLocks,
2240
2498
  ...customIgnoreFiles !== void 0 ? { customIgnoreFiles } : {}
2241
2499
  });
2500
+ const routeFsFactory = runtime.resolveBridgeFsFactory({
2501
+ // REST routes still return primary-relative paths, so keep their
2502
+ // filesystem boundary primary-only until responses carry root IDs.
2503
+ boundWorkspaces: [boundWorkspace],
2504
+ trusted: trustedWorkspace,
2505
+ emit: deps.fsAuditEmit,
2506
+ pathLocks: sharedPathLocks,
2507
+ ...customIgnoreFiles !== void 0 ? { customIgnoreFiles } : {}
2508
+ });
2242
2509
  const channelFactory = runtime.createSpawnChannelFactory({
2510
+ sourceEnv: runtimeEffectiveEnv,
2243
2511
  onDiagnosticLine: diagnosticSink,
2244
2512
  pipeHooks: {
2245
2513
  onMessageSent: /* @__PURE__ */ __name((bytes) => recordPipeMessage("outbound", bytes), "onMessageSent"),
@@ -2252,10 +2520,22 @@ async function runQwenServe(optsIn, deps = {}) {
2252
2520
  },
2253
2521
  ...opts.experimentalLsp === true ? { extraArgs: ["--experimental-lsp"] } : {}
2254
2522
  });
2255
- const statusProvider = runtime.createDaemonStatusProvider();
2256
- const workspaceProvidersStatusProvider = runtime.createWorkspaceProvidersStatusProvider();
2523
+ const statusProvider = runtime.createDaemonStatusProvider({
2524
+ env: runtimeEffectiveEnv
2525
+ });
2526
+ const workspaceProvidersStatusProvider = runtime.createWorkspaceProvidersStatusProvider({
2527
+ env: runtimeEffectiveEnv
2528
+ });
2257
2529
  const workspaceSkillsStatusProvider = runtime.createWorkspaceSkillsStatusProvider();
2258
2530
  const clientMcpSenderRegistry = new ClientMcpSenderRegistry();
2531
+ const runtimeBridges = [];
2532
+ const totalSessionAdmission = runtime.createTotalSessionAdmissionController(
2533
+ {
2534
+ maxTotalSessions: opts.maxTotalSessions,
2535
+ getBridges: /* @__PURE__ */ __name(() => runtimeBridges.length > 0 ? runtimeBridges : bridgeRef ? [bridgeRef] : [], "getBridges")
2536
+ }
2537
+ );
2538
+ const sessionOwnerIndex = runtime.createWorkspaceSessionOwnerIndex();
2259
2539
  const persistDisabledToolsFn = /* @__PURE__ */ __name((workspace, toolName, enabled) => withSettingsLock(workspace, async () => {
2260
2540
  const fresh = settingsRuntime.settings.loadSettings(workspace);
2261
2541
  const wsScope = fresh.forScope(WORKSPACE_SETTING_SCOPE).settings;
@@ -2302,13 +2582,22 @@ async function runQwenServe(optsIn, deps = {}) {
2302
2582
  );
2303
2583
  }
2304
2584
  }), "persistSettingsFn");
2585
+ const { createSubSessionLauncher } = await import("./create-sub-session-VZIOFS6N.js");
2586
+ const subSessionLauncher = createSubSessionLauncher({
2587
+ getBridge: /* @__PURE__ */ __name(() => bridgeRef, "getBridge"),
2588
+ boundWorkspace
2589
+ });
2305
2590
  const bridge = deps.bridge ?? runtime.createAcpSessionBridge({
2306
2591
  // Reverse tool channel: let `BridgeClient.extMethod` reach the WS
2307
2592
  // connection that hosts a named client MCP server (#5626).
2308
2593
  clientMcpSender: clientMcpSenderRegistry.lookup,
2594
+ onCreateSubSession: subSessionLauncher.launch,
2309
2595
  maxSessions: opts.maxSessions,
2596
+ freshSessionAdmission: totalSessionAdmission.admit,
2597
+ sessionLifecycle: sessionOwnerIndex.handleBridgeSessionLifecycle,
2310
2598
  ...opts.maxPendingPromptsPerSession !== void 0 ? { maxPendingPromptsPerSession: opts.maxPendingPromptsPerSession } : {},
2311
2599
  ...opts.eventRingSize !== void 0 ? { eventRingSize: opts.eventRingSize } : {},
2600
+ ...opts.compactedReplayMaxBytes !== void 0 ? { compactedReplayMaxBytes: opts.compactedReplayMaxBytes } : {},
2312
2601
  ...opts.channelIdleTimeoutMs !== void 0 ? { channelIdleTimeoutMs: opts.channelIdleTimeoutMs } : {},
2313
2602
  ...opts.sessionReapIntervalMs !== void 0 ? { sessionReapIntervalMs: opts.sessionReapIntervalMs } : {},
2314
2603
  ...opts.sessionIdleTimeoutMs !== void 0 ? { sessionIdleTimeoutMs: opts.sessionIdleTimeoutMs } : {},
@@ -2331,7 +2620,9 @@ async function runQwenServe(optsIn, deps = {}) {
2331
2620
  });
2332
2621
  if (!deps.bridge) {
2333
2622
  bridgeRef = bridge;
2623
+ internalRuntimeBridgesForCleanup.push(bridge);
2334
2624
  }
2625
+ runtimeBridges.push(bridge);
2335
2626
  const workspaceService = runtime.createDaemonWorkspaceService({
2336
2627
  boundWorkspace,
2337
2628
  contextFilename: contextFilenameForInit ?? "QWEN.md",
@@ -2342,22 +2633,291 @@ async function runQwenServe(optsIn, deps = {}) {
2342
2633
  persistDisabledTools: persistDisabledToolsFn,
2343
2634
  persistSetting: persistSettingFn,
2344
2635
  persistSettings: persistSettingsFn,
2636
+ preheatAcpChild: /* @__PURE__ */ __name(() => bridge.preheat(), "preheatAcpChild"),
2345
2637
  reloadDaemonEnv: /* @__PURE__ */ __name((workspace) => withSettingsLock(workspace, async () => {
2346
2638
  const fresh = settingsRuntime.settings.loadSettings(workspace, {
2347
2639
  skipLoadEnvironment: true
2348
2640
  });
2349
- return settingsRuntime.settings.reloadEnvironment(
2641
+ const result = settingsRuntime.settings.reloadEnvironment(
2350
2642
  fresh.merged,
2351
2643
  workspace
2352
2644
  );
2645
+ let refreshedRuntimeEnv;
2646
+ let fallbackReason;
2647
+ try {
2648
+ refreshedRuntimeEnv = settingsRuntime.environment.buildRuntimeEnvironment(
2649
+ fresh.merged,
2650
+ workspace,
2651
+ daemonRuntimeBaseEnv
2652
+ );
2653
+ } catch (err) {
2654
+ fallbackReason = err instanceof Error ? err.message : String(err);
2655
+ daemonLog.warn(
2656
+ "failed to rebuild runtime env snapshot after daemon env reload; preserving previous runtime env",
2657
+ {
2658
+ error: fallbackReason
2659
+ }
2660
+ );
2661
+ refreshedRuntimeEnv = {
2662
+ effectiveEnv: { ...runtimeEffectiveEnv },
2663
+ overlayKeys: [...primaryRuntimeEnv.overlayKeys],
2664
+ envFilePaths: [...primaryRuntimeEnv.envFilePaths],
2665
+ envFileReadFailed: primaryRuntimeEnv.envFileReadFailed ?? false,
2666
+ envFileReadFailures: [
2667
+ ...primaryRuntimeEnv.envFileReadFailures ?? []
2668
+ ]
2669
+ };
2670
+ }
2671
+ logRuntimeEnvFileReadFailures(workspace, refreshedRuntimeEnv);
2672
+ replaceRuntimeEffectiveEnv(refreshedRuntimeEnv.effectiveEnv);
2673
+ if (fallbackReason) {
2674
+ primaryRuntimeEnv.fallbackReason = fallbackReason;
2675
+ } else {
2676
+ delete primaryRuntimeEnv.fallbackReason;
2677
+ }
2678
+ primaryRuntimeEnv.envFileReadFailed = refreshedRuntimeEnv.envFileReadFailed;
2679
+ primaryRuntimeEnv.envFileReadFailures.splice(
2680
+ 0,
2681
+ primaryRuntimeEnv.envFileReadFailures.length,
2682
+ ...refreshedRuntimeEnv.envFileReadFailures
2683
+ );
2684
+ primaryRuntimeEnv.overlayKeys.splice(
2685
+ 0,
2686
+ primaryRuntimeEnv.overlayKeys.length,
2687
+ ...refreshedRuntimeEnv.overlayKeys
2688
+ );
2689
+ primaryRuntimeEnv.envFilePaths.splice(
2690
+ 0,
2691
+ primaryRuntimeEnv.envFilePaths.length,
2692
+ ...refreshedRuntimeEnv.envFilePaths
2693
+ );
2694
+ return result;
2353
2695
  }), "reloadDaemonEnv"),
2354
2696
  queryWorkspaceStatus: /* @__PURE__ */ __name((method, idle) => bridge.queryWorkspaceStatus(method, idle), "queryWorkspaceStatus"),
2355
2697
  invokeWorkspaceCommand: /* @__PURE__ */ __name((method, params, invokeOpts) => bridge.invokeWorkspaceCommand(method, params, invokeOpts), "invokeWorkspaceCommand"),
2356
2698
  refreshExtensionsForAllSessions: /* @__PURE__ */ __name(() => bridge.refreshExtensionsForAllSessions(), "refreshExtensionsForAllSessions"),
2357
2699
  publishWorkspaceEvent: /* @__PURE__ */ __name((event) => bridge.publishWorkspaceEvent(event), "publishWorkspaceEvent")
2358
2700
  });
2701
+ const workspaceRuntimes = [
2702
+ {
2703
+ workspaceId: daemonWorkspaceHash,
2704
+ workspaceCwd: boundWorkspace,
2705
+ primary: true,
2706
+ trusted: trustedWorkspace,
2707
+ env: primaryRuntimeEnv,
2708
+ bridge,
2709
+ workspaceService,
2710
+ routeFileSystemFactory: routeFsFactory,
2711
+ clientMcpSenderRegistry
2712
+ }
2713
+ ];
2714
+ const createRuntimeEnvMetadata = /* @__PURE__ */ __name((workspace, settings) => {
2715
+ const snapshot = settings ? settingsRuntime.environment.buildRuntimeEnvironment(
2716
+ settings.merged,
2717
+ workspace,
2718
+ daemonRuntimeBaseEnv
2719
+ ) : {
2720
+ effectiveEnv: { ...daemonRuntimeBaseEnv },
2721
+ overlayKeys: Object.freeze([]),
2722
+ envFilePaths: Object.freeze([]),
2723
+ envFileReadFailed: false,
2724
+ envFileReadFailures: Object.freeze([])
2725
+ };
2726
+ logRuntimeEnvFileReadFailures(workspace, snapshot);
2727
+ const effectiveEnv = { ...snapshot.effectiveEnv };
2728
+ const metadata = {
2729
+ mode: "runtime-overlay",
2730
+ overlayKeys: [...snapshot.overlayKeys],
2731
+ effectiveEnv,
2732
+ envFilePaths: [...snapshot.envFilePaths],
2733
+ envFileReadFailed: snapshot.envFileReadFailed,
2734
+ envFileReadFailures: [...snapshot.envFileReadFailures]
2735
+ };
2736
+ return {
2737
+ metadata,
2738
+ effectiveEnv,
2739
+ replace(nextEnv) {
2740
+ for (const key of Object.keys(effectiveEnv)) {
2741
+ delete effectiveEnv[key];
2742
+ }
2743
+ Object.assign(effectiveEnv, nextEnv);
2744
+ }
2745
+ };
2746
+ }, "createRuntimeEnvMetadata");
2747
+ const subSessionStoppers = [];
2748
+ for (const workspaceInput of workspaceInputs.slice(1)) {
2749
+ let secondarySettings;
2750
+ try {
2751
+ secondarySettings = settingsRuntime.settings.loadSettings(
2752
+ workspaceInput.cwd
2753
+ );
2754
+ } catch (err) {
2755
+ writeStderrLine(
2756
+ `qwen serve: could not read full settings for secondary workspace ${workspaceInput.cwd} (${err instanceof Error ? err.message : String(err)}); falling back to defaults.`
2757
+ );
2758
+ }
2759
+ const secondaryTrusted = secondarySettings ? settingsRuntime.trustedFolders.getWorkspaceTrustStatus(
2760
+ secondarySettings.merged,
2761
+ workspaceInput.cwd
2762
+ ).effective.state === "trusted" : false;
2763
+ if (!secondaryTrusted) {
2764
+ daemonLog.warn("secondary workspace is not trusted", {
2765
+ workspace: workspaceInput.cwd,
2766
+ trustSettingsAvailable: secondarySettings !== void 0
2767
+ });
2768
+ }
2769
+ const secondaryEnv = createRuntimeEnvMetadata(
2770
+ workspaceInput.cwd,
2771
+ secondarySettings
2772
+ );
2773
+ const secondaryWorkspaceHash = core.hashDaemonWorkspace(
2774
+ workspaceInput.cwd
2775
+ );
2776
+ const secondaryStatusProvider = runtime.createDaemonStatusProvider({
2777
+ env: secondaryEnv.effectiveEnv
2778
+ });
2779
+ const secondaryBridgeFsFactory = runtime.resolveBridgeFsFactory({
2780
+ boundWorkspaces: [workspaceInput.cwd],
2781
+ trusted: secondaryTrusted,
2782
+ emit: deps.fsAuditEmit,
2783
+ pathLocks: sharedPathLocks,
2784
+ ...customIgnoreFiles !== void 0 ? { customIgnoreFiles } : {}
2785
+ });
2786
+ const secondaryChannelFactory = runtime.createSpawnChannelFactory({
2787
+ sourceEnv: secondaryEnv.effectiveEnv,
2788
+ onDiagnosticLine: diagnosticSink,
2789
+ pipeHooks: {
2790
+ onMessageSent: /* @__PURE__ */ __name((bytes) => recordPipeMessage("outbound", bytes), "onMessageSent"),
2791
+ onMessageReceived: /* @__PURE__ */ __name((bytes) => recordPipeMessage("inbound", bytes), "onMessageReceived"),
2792
+ onMessageObserved: /* @__PURE__ */ __name(({ direction, bytes, message }) => observeLargePipeFrame({
2793
+ direction: daemonPipeDirection(direction),
2794
+ bytes,
2795
+ message
2796
+ }), "onMessageObserved")
2797
+ },
2798
+ ...opts.experimentalLsp === true ? { extraArgs: ["--experimental-lsp"] } : {}
2799
+ });
2800
+ const secondaryClientMcpSenderRegistry = new ClientMcpSenderRegistry();
2801
+ let secondaryBridgeRef;
2802
+ const secondarySubSessionLauncher = createSubSessionLauncher({
2803
+ getBridge: /* @__PURE__ */ __name(() => secondaryBridgeRef, "getBridge"),
2804
+ boundWorkspace: workspaceInput.cwd
2805
+ });
2806
+ const secondaryBridge = runtime.createAcpSessionBridge({
2807
+ clientMcpSender: secondaryClientMcpSenderRegistry.lookup,
2808
+ onCreateSubSession: secondarySubSessionLauncher.launch,
2809
+ maxSessions: opts.maxSessions,
2810
+ freshSessionAdmission: totalSessionAdmission.admit,
2811
+ sessionLifecycle: sessionOwnerIndex.handleBridgeSessionLifecycle,
2812
+ ...opts.maxPendingPromptsPerSession !== void 0 ? { maxPendingPromptsPerSession: opts.maxPendingPromptsPerSession } : {},
2813
+ ...opts.eventRingSize !== void 0 ? { eventRingSize: opts.eventRingSize } : {},
2814
+ ...opts.compactedReplayMaxBytes !== void 0 ? { compactedReplayMaxBytes: opts.compactedReplayMaxBytes } : {},
2815
+ ...opts.channelIdleTimeoutMs !== void 0 ? { channelIdleTimeoutMs: opts.channelIdleTimeoutMs } : {},
2816
+ ...opts.sessionReapIntervalMs !== void 0 ? { sessionReapIntervalMs: opts.sessionReapIntervalMs } : {},
2817
+ ...opts.sessionIdleTimeoutMs !== void 0 ? { sessionIdleTimeoutMs: opts.sessionIdleTimeoutMs } : {},
2818
+ ...opts.permissionResponseTimeoutMs !== void 0 ? { permissionResponseTimeoutMs: opts.permissionResponseTimeoutMs } : {},
2819
+ boundWorkspace: workspaceInput.cwd,
2820
+ sessionShellCommandEnabled,
2821
+ childEnvOverrides,
2822
+ channelFactory: secondaryChannelFactory,
2823
+ onDiagnosticLine: diagnosticSink,
2824
+ telemetry: createRuntimeBridgeTelemetry(secondaryWorkspaceHash),
2825
+ ...permissionPolicy !== void 0 ? { permissionPolicy } : {},
2826
+ ...permissionConsensusQuorum !== void 0 ? {
2827
+ permissionConsensusQuorum
2828
+ } : {},
2829
+ permissionAudit: permissionAuditPublisher,
2830
+ statusProvider: secondaryStatusProvider,
2831
+ fileSystem: createBridgeFileSystemAdapter(secondaryBridgeFsFactory),
2832
+ persistApprovalMode: /* @__PURE__ */ __name((workspace, mode) => withSettingsLock(workspace, async () => {
2833
+ const fresh = settingsRuntime.settings.loadSettings(workspace);
2834
+ fresh.setValue(WORKSPACE_SETTING_SCOPE, "tools.approvalMode", mode);
2835
+ }), "persistApprovalMode")
2836
+ });
2837
+ secondaryBridgeRef = secondaryBridge;
2838
+ runtimeBridges.push(secondaryBridge);
2839
+ internalRuntimeBridgesForCleanup.push(secondaryBridge);
2840
+ subSessionStoppers.push(secondarySubSessionLauncher.stop);
2841
+ const secondaryWorkspaceService = runtime.createDaemonWorkspaceService({
2842
+ boundWorkspace: workspaceInput.cwd,
2843
+ contextFilename: contextFilenameForInit ?? "QWEN.md",
2844
+ statusProvider: secondaryStatusProvider,
2845
+ workspaceProvidersStatusProvider: runtime.createWorkspaceProvidersStatusProvider({
2846
+ env: secondaryEnv.effectiveEnv
2847
+ }),
2848
+ workspaceSkillsStatusProvider: runtime.createWorkspaceSkillsStatusProvider(),
2849
+ isChannelLive: /* @__PURE__ */ __name(() => secondaryBridge.isChannelLive(), "isChannelLive"),
2850
+ preheatAcpChild: /* @__PURE__ */ __name(() => secondaryBridge.preheat(), "preheatAcpChild"),
2851
+ persistDisabledTools: persistDisabledToolsFn,
2852
+ persistSetting: persistSettingFn,
2853
+ persistSettings: persistSettingsFn,
2854
+ reloadDaemonEnv: /* @__PURE__ */ __name((workspace) => withSettingsLock(workspace, async () => {
2855
+ const fresh = settingsRuntime.settings.loadSettings(workspace, {
2856
+ skipLoadEnvironment: true
2857
+ });
2858
+ const result = settingsRuntime.settings.reloadEnvironment(
2859
+ fresh.merged,
2860
+ workspace
2861
+ );
2862
+ try {
2863
+ const refreshedRuntimeEnv = settingsRuntime.environment.buildRuntimeEnvironment(
2864
+ fresh.merged,
2865
+ workspace,
2866
+ daemonRuntimeBaseEnv
2867
+ );
2868
+ logRuntimeEnvFileReadFailures(workspace, refreshedRuntimeEnv);
2869
+ secondaryEnv.replace(refreshedRuntimeEnv.effectiveEnv);
2870
+ secondaryEnv.metadata.envFileReadFailed = refreshedRuntimeEnv.envFileReadFailed;
2871
+ secondaryEnv.metadata.envFileReadFailures.splice(
2872
+ 0,
2873
+ secondaryEnv.metadata.envFileReadFailures.length,
2874
+ ...refreshedRuntimeEnv.envFileReadFailures
2875
+ );
2876
+ secondaryEnv.metadata.overlayKeys.splice(
2877
+ 0,
2878
+ secondaryEnv.metadata.overlayKeys.length,
2879
+ ...refreshedRuntimeEnv.overlayKeys
2880
+ );
2881
+ secondaryEnv.metadata.envFilePaths.splice(
2882
+ 0,
2883
+ secondaryEnv.metadata.envFilePaths.length,
2884
+ ...refreshedRuntimeEnv.envFilePaths
2885
+ );
2886
+ delete secondaryEnv.metadata.fallbackReason;
2887
+ } catch (err) {
2888
+ secondaryEnv.metadata.fallbackReason = err instanceof Error ? err.message : String(err);
2889
+ daemonLog.warn(
2890
+ "failed to rebuild secondary runtime env snapshot after daemon env reload; preserving previous runtime env",
2891
+ {
2892
+ workspace,
2893
+ error: secondaryEnv.metadata.fallbackReason
2894
+ }
2895
+ );
2896
+ }
2897
+ return result;
2898
+ }), "reloadDaemonEnv"),
2899
+ queryWorkspaceStatus: /* @__PURE__ */ __name((method, idle) => secondaryBridge.queryWorkspaceStatus(method, idle), "queryWorkspaceStatus"),
2900
+ invokeWorkspaceCommand: /* @__PURE__ */ __name((method, params, invokeOpts) => secondaryBridge.invokeWorkspaceCommand(method, params, invokeOpts), "invokeWorkspaceCommand"),
2901
+ refreshExtensionsForAllSessions: /* @__PURE__ */ __name(() => secondaryBridge.refreshExtensionsForAllSessions(), "refreshExtensionsForAllSessions"),
2902
+ publishWorkspaceEvent: /* @__PURE__ */ __name((event) => secondaryBridge.publishWorkspaceEvent(event), "publishWorkspaceEvent")
2903
+ });
2904
+ workspaceRuntimes.push({
2905
+ workspaceId: secondaryWorkspaceHash,
2906
+ workspaceCwd: workspaceInput.cwd,
2907
+ primary: false,
2908
+ trusted: secondaryTrusted,
2909
+ env: secondaryEnv.metadata,
2910
+ bridge: secondaryBridge,
2911
+ workspaceService: secondaryWorkspaceService,
2912
+ routeFileSystemFactory: secondaryBridgeFsFactory,
2913
+ clientMcpSenderRegistry: secondaryClientMcpSenderRegistry
2914
+ });
2915
+ }
2916
+ const workspaceRegistry = runtime.createWorkspaceRegistry(workspaceRuntimes, {
2917
+ sessionOwnerIndex
2918
+ });
2359
2919
  core.registerDaemonGaugeCallbacks({
2360
- sessionCount: /* @__PURE__ */ __name(() => bridge.sessionCount, "sessionCount"),
2920
+ sessionCount: /* @__PURE__ */ __name(() => workspaceRegistry.list().reduce((sum, item) => sum + item.bridge.sessionCount, 0), "sessionCount"),
2361
2921
  sseCount: /* @__PURE__ */ __name(() => runtime.getActiveSseCount(), "sseCount"),
2362
2922
  heapUsed: /* @__PURE__ */ __name(() => process.memoryUsage().heapUsed, "heapUsed")
2363
2923
  });
@@ -2397,9 +2957,15 @@ async function runQwenServe(optsIn, deps = {}) {
2397
2957
  cpuPercent,
2398
2958
  rssBytes: mem.rss,
2399
2959
  heapUsedBytes: mem.heapUsed,
2400
- activeSessions: bridge.sessionCount,
2401
- activePrompts: bridge.activePromptCount,
2402
- queuedPrompts: bridge.pendingPromptTotal ?? 0,
2960
+ activeSessions: workspaceRegistry.list().reduce((sum, item) => sum + item.bridge.sessionCount, 0),
2961
+ activePrompts: workspaceRegistry.list().reduce(
2962
+ (sum, item) => sum + (item.bridge.activePromptCount ?? 0),
2963
+ 0
2964
+ ),
2965
+ queuedPrompts: workspaceRegistry.list().reduce(
2966
+ (sum, item) => sum + (item.bridge.pendingPromptTotal ?? 0),
2967
+ 0
2968
+ ),
2403
2969
  eventLoopLagP99Ms,
2404
2970
  sseConnections: runtime.getActiveSseCount(),
2405
2971
  wsConnections: acp?.wsStreams ?? 0,
@@ -2441,7 +3007,163 @@ async function runQwenServe(optsIn, deps = {}) {
2441
3007
  metricsLoopDelay.disable();
2442
3008
  }
2443
3009
  };
3010
+ const createDynamicWorkspaceRuntime = /* @__PURE__ */ __name(async (cwd) => {
3011
+ let wsSettings;
3012
+ try {
3013
+ wsSettings = settingsRuntime.settings.loadSettings(cwd);
3014
+ } catch (err) {
3015
+ writeStderrLine(
3016
+ `qwen serve: could not read full settings for dynamic workspace ${cwd} (${err instanceof Error ? err.message : String(err)}); falling back to defaults.`
3017
+ );
3018
+ }
3019
+ const trusted = wsSettings ? settingsRuntime.trustedFolders.getWorkspaceTrustStatus(
3020
+ wsSettings.merged,
3021
+ cwd
3022
+ ).effective.state === "trusted" : false;
3023
+ const wsEnv = createRuntimeEnvMetadata(cwd, wsSettings);
3024
+ const wsHash = core.hashDaemonWorkspace(cwd);
3025
+ const wsFsFactory = runtime.resolveBridgeFsFactory({
3026
+ boundWorkspaces: [cwd],
3027
+ trusted,
3028
+ emit: deps.fsAuditEmit,
3029
+ pathLocks: sharedPathLocks,
3030
+ ...customIgnoreFiles !== void 0 ? { customIgnoreFiles } : {}
3031
+ });
3032
+ const wsChannelFactory = runtime.createSpawnChannelFactory({
3033
+ sourceEnv: wsEnv.effectiveEnv,
3034
+ onDiagnosticLine: diagnosticSink,
3035
+ pipeHooks: {
3036
+ onMessageSent: /* @__PURE__ */ __name((bytes) => recordPipeMessage("outbound", bytes), "onMessageSent"),
3037
+ onMessageReceived: /* @__PURE__ */ __name((bytes) => recordPipeMessage("inbound", bytes), "onMessageReceived"),
3038
+ onMessageObserved: /* @__PURE__ */ __name(({ direction, bytes, message }) => observeLargePipeFrame({
3039
+ direction: daemonPipeDirection(direction),
3040
+ bytes,
3041
+ message
3042
+ }), "onMessageObserved")
3043
+ },
3044
+ ...opts.experimentalLsp === true ? { extraArgs: ["--experimental-lsp"] } : {}
3045
+ });
3046
+ const wsClientMcpRegistry = new ClientMcpSenderRegistry();
3047
+ let wsBridgeRef;
3048
+ const wsSubSessionLauncher = createSubSessionLauncher({
3049
+ getBridge: /* @__PURE__ */ __name(() => wsBridgeRef, "getBridge"),
3050
+ boundWorkspace: cwd
3051
+ });
3052
+ const wsBridge = runtime.createAcpSessionBridge({
3053
+ clientMcpSender: wsClientMcpRegistry.lookup,
3054
+ onCreateSubSession: wsSubSessionLauncher.launch,
3055
+ maxSessions: opts.maxSessions,
3056
+ freshSessionAdmission: totalSessionAdmission.admit,
3057
+ sessionLifecycle: sessionOwnerIndex.handleBridgeSessionLifecycle,
3058
+ ...opts.maxPendingPromptsPerSession !== void 0 ? { maxPendingPromptsPerSession: opts.maxPendingPromptsPerSession } : {},
3059
+ ...opts.eventRingSize !== void 0 ? { eventRingSize: opts.eventRingSize } : {},
3060
+ ...opts.compactedReplayMaxBytes !== void 0 ? { compactedReplayMaxBytes: opts.compactedReplayMaxBytes } : {},
3061
+ ...opts.channelIdleTimeoutMs !== void 0 ? { channelIdleTimeoutMs: opts.channelIdleTimeoutMs } : {},
3062
+ ...opts.sessionReapIntervalMs !== void 0 ? { sessionReapIntervalMs: opts.sessionReapIntervalMs } : {},
3063
+ ...opts.sessionIdleTimeoutMs !== void 0 ? { sessionIdleTimeoutMs: opts.sessionIdleTimeoutMs } : {},
3064
+ ...opts.permissionResponseTimeoutMs !== void 0 ? { permissionResponseTimeoutMs: opts.permissionResponseTimeoutMs } : {},
3065
+ boundWorkspace: cwd,
3066
+ sessionShellCommandEnabled,
3067
+ childEnvOverrides,
3068
+ channelFactory: wsChannelFactory,
3069
+ onDiagnosticLine: diagnosticSink,
3070
+ telemetry: createRuntimeBridgeTelemetry(wsHash),
3071
+ ...permissionPolicy !== void 0 ? { permissionPolicy } : {},
3072
+ ...permissionConsensusQuorum !== void 0 ? { permissionConsensusQuorum } : {},
3073
+ permissionAudit: permissionAuditPublisher,
3074
+ statusProvider: runtime.createDaemonStatusProvider({
3075
+ env: wsEnv.effectiveEnv
3076
+ }),
3077
+ fileSystem: createBridgeFileSystemAdapter(wsFsFactory),
3078
+ persistApprovalMode: /* @__PURE__ */ __name((workspace, mode) => withSettingsLock(workspace, async () => {
3079
+ const fresh = settingsRuntime.settings.loadSettings(workspace);
3080
+ fresh.setValue(WORKSPACE_SETTING_SCOPE, "tools.approvalMode", mode);
3081
+ }), "persistApprovalMode")
3082
+ });
3083
+ wsBridgeRef = wsBridge;
3084
+ const wsService = runtime.createDaemonWorkspaceService({
3085
+ boundWorkspace: cwd,
3086
+ contextFilename: contextFilenameForInit ?? "QWEN.md",
3087
+ statusProvider: runtime.createDaemonStatusProvider({
3088
+ env: wsEnv.effectiveEnv
3089
+ }),
3090
+ workspaceProvidersStatusProvider: runtime.createWorkspaceProvidersStatusProvider({
3091
+ env: wsEnv.effectiveEnv
3092
+ }),
3093
+ workspaceSkillsStatusProvider: runtime.createWorkspaceSkillsStatusProvider(),
3094
+ isChannelLive: /* @__PURE__ */ __name(() => wsBridge.isChannelLive(), "isChannelLive"),
3095
+ preheatAcpChild: /* @__PURE__ */ __name(() => wsBridge.preheat(), "preheatAcpChild"),
3096
+ persistDisabledTools: persistDisabledToolsFn,
3097
+ persistSetting: persistSettingFn,
3098
+ persistSettings: persistSettingsFn,
3099
+ reloadDaemonEnv: /* @__PURE__ */ __name((workspace) => withSettingsLock(workspace, async () => {
3100
+ const fresh = settingsRuntime.settings.loadSettings(workspace, {
3101
+ skipLoadEnvironment: true
3102
+ });
3103
+ const result = settingsRuntime.settings.reloadEnvironment(
3104
+ fresh.merged,
3105
+ workspace
3106
+ );
3107
+ try {
3108
+ const refreshedRuntimeEnv = settingsRuntime.environment.buildRuntimeEnvironment(
3109
+ fresh.merged,
3110
+ workspace,
3111
+ daemonRuntimeBaseEnv
3112
+ );
3113
+ logRuntimeEnvFileReadFailures(workspace, refreshedRuntimeEnv);
3114
+ wsEnv.replace(refreshedRuntimeEnv.effectiveEnv);
3115
+ wsEnv.metadata.envFileReadFailed = refreshedRuntimeEnv.envFileReadFailed;
3116
+ wsEnv.metadata.envFileReadFailures.splice(
3117
+ 0,
3118
+ wsEnv.metadata.envFileReadFailures.length,
3119
+ ...refreshedRuntimeEnv.envFileReadFailures
3120
+ );
3121
+ wsEnv.metadata.overlayKeys.splice(
3122
+ 0,
3123
+ wsEnv.metadata.overlayKeys.length,
3124
+ ...refreshedRuntimeEnv.overlayKeys
3125
+ );
3126
+ wsEnv.metadata.envFilePaths.splice(
3127
+ 0,
3128
+ wsEnv.metadata.envFilePaths.length,
3129
+ ...refreshedRuntimeEnv.envFilePaths
3130
+ );
3131
+ delete wsEnv.metadata.fallbackReason;
3132
+ } catch (err) {
3133
+ wsEnv.metadata.fallbackReason = err instanceof Error ? err.message : String(err);
3134
+ daemonLog.warn(
3135
+ "failed to rebuild dynamic runtime env snapshot after daemon env reload; preserving previous runtime env",
3136
+ {
3137
+ workspace,
3138
+ error: wsEnv.metadata.fallbackReason
3139
+ }
3140
+ );
3141
+ }
3142
+ return result;
3143
+ }), "reloadDaemonEnv"),
3144
+ queryWorkspaceStatus: /* @__PURE__ */ __name((method, idle) => wsBridge.queryWorkspaceStatus(method, idle), "queryWorkspaceStatus"),
3145
+ invokeWorkspaceCommand: /* @__PURE__ */ __name((method, params, invokeOpts) => wsBridge.invokeWorkspaceCommand(method, params, invokeOpts), "invokeWorkspaceCommand"),
3146
+ refreshExtensionsForAllSessions: /* @__PURE__ */ __name(() => wsBridge.refreshExtensionsForAllSessions(), "refreshExtensionsForAllSessions"),
3147
+ publishWorkspaceEvent: /* @__PURE__ */ __name((event) => wsBridge.publishWorkspaceEvent(event), "publishWorkspaceEvent")
3148
+ });
3149
+ runtimeBridges.push(wsBridge);
3150
+ internalRuntimeBridgesForCleanup.push(wsBridge);
3151
+ subSessionStoppers.push(wsSubSessionLauncher.stop);
3152
+ return {
3153
+ workspaceId: wsHash,
3154
+ workspaceCwd: cwd,
3155
+ primary: false,
3156
+ trusted,
3157
+ env: wsEnv.metadata,
3158
+ bridge: wsBridge,
3159
+ workspaceService: wsService,
3160
+ routeFileSystemFactory: wsFsFactory,
3161
+ clientMcpSenderRegistry: wsClientMcpRegistry
3162
+ };
3163
+ }, "createDynamicWorkspaceRuntime");
2444
3164
  const app2 = runtime.createServeApp(opts, () => actualPort, {
3165
+ workspaceRegistry,
3166
+ createWorkspaceRuntime: createDynamicWorkspaceRuntime,
2445
3167
  bridge,
2446
3168
  webShellDir,
2447
3169
  boundWorkspace,
@@ -2451,18 +3173,16 @@ async function runQwenServe(optsIn, deps = {}) {
2451
3173
  // (keepalive) and reloads them on boot (rehydration). Off by default so
2452
3174
  // direct createServeApp embeds/tests don't spawn sessions.
2453
3175
  manageScheduledTaskSessions: true,
2454
- fsFactory: runtime.resolveBridgeFsFactory({
2455
- // REST routes still return primary-relative paths, so keep their
2456
- // filesystem boundary primary-only until responses carry root IDs.
2457
- boundWorkspaces: [boundWorkspace],
2458
- trusted: trustedWorkspace,
2459
- emit: deps.fsAuditEmit,
2460
- pathLocks: sharedPathLocks,
2461
- ...customIgnoreFiles !== void 0 ? { customIgnoreFiles } : {}
2462
- }),
3176
+ fsFactory: routeFsFactory,
2463
3177
  primaryWorkspaceTrusted: trustedWorkspace,
3178
+ primaryRuntimeEnv,
2464
3179
  daemonLog,
2465
3180
  getChannelWorkerSnapshot,
3181
+ enqueueChannelWebhookTask: /* @__PURE__ */ __name((task) => channelWorker.enqueueWebhookTask(task), "enqueueChannelWebhookTask"),
3182
+ // Gate both the `channel_reload` capability and the reload route on the
3183
+ // presence of this dep, so it is advertised only when a channel worker
3184
+ // exists to reload.
3185
+ ...opts.channelSelection ? { reloadChannelWorker } : {},
2466
3186
  getPerfSnapshot: /* @__PURE__ */ __name(() => ({
2467
3187
  eventLoop: currentDaemonEventLoopMonitor.snapshot(),
2468
3188
  promptQueueWait: {
@@ -2477,6 +3197,7 @@ async function runQwenServe(optsIn, deps = {}) {
2477
3197
  }
2478
3198
  }), "getPerfSnapshot"),
2479
3199
  getMetricsSeries: /* @__PURE__ */ __name(() => metricsRing.snapshot(), "getMetricsSeries"),
3200
+ getTotalSessionAdmissionSnapshot: totalSessionAdmission.snapshot,
2480
3201
  recordDaemonRequest: /* @__PURE__ */ __name((durationMs, statusCode) => metricsRing.recordRequest(durationMs, statusCode), "recordDaemonRequest"),
2481
3202
  workspace: workspaceService,
2482
3203
  // Reverse tool channel (#5626): the SAME registry wired into `bridge` above,
@@ -2485,6 +3206,9 @@ async function runQwenServe(optsIn, deps = {}) {
2485
3206
  persistDisabledTools: persistDisabledToolsFn,
2486
3207
  persistSetting: persistSettingFn,
2487
3208
  persistSettings: persistSettingsFn,
3209
+ sessionArtifactsPersistenceAvailable: sessionArtifactsPersistenceAvailableFromSettings(
3210
+ runtimeBootSettings?.merged
3211
+ ),
2488
3212
  installAuthProvider: /* @__PURE__ */ __name((req) => withSettingsLock(
2489
3213
  boundWorkspace,
2490
3214
  async () => {
@@ -2523,6 +3247,8 @@ async function runQwenServe(optsIn, deps = {}) {
2523
3247
  }
2524
3248
  ), "installAuthProvider")
2525
3249
  });
3250
+ app2.locals.subSessionStoppers = subSessionStoppers;
3251
+ subSessionStoppers.push(subSessionLauncher.stop);
2526
3252
  return { app: app2, bridge };
2527
3253
  }, "buildRuntime");
2528
3254
  if (deps.bridge) {
@@ -2544,16 +3270,24 @@ async function runQwenServe(optsIn, deps = {}) {
2544
3270
  daemonLog,
2545
3271
  qwenCodeVersion: cliVersion,
2546
3272
  sessionShellCommandEnabled,
3273
+ sessionArtifactsPersistenceAvailable,
2547
3274
  permissionPolicy,
3275
+ multiWorkspaceCapabilitiesRequireRuntime: workspaceInputs.length > 1,
2548
3276
  getRuntimeError: /* @__PURE__ */ __name(() => runtimeStartupError, "getRuntimeError"),
2549
3277
  getChannelWorkerSnapshot,
2550
3278
  onHealthServed: deferRuntimeUntilFirstHealth ? () => startRuntimeAfterHealth?.() : void 0
2551
3279
  });
3280
+ const deferredChannelWebhookAuth = deferRuntimeUntilFirstHealth ? createDeferredChannelWebhookAuth(
3281
+ boundWorkspace,
3282
+ await loadChannelWebhookConfigRuntime(),
3283
+ daemonLog
3284
+ ) : void 0;
2552
3285
  const app = runtimeApp ?? createDelegatingServeApp(bootstrapApp, () => runtimeApp, {
2553
3286
  waitForDeferredRuntimeRoutes: deferRuntimeUntilFirstHealth,
2554
3287
  startRuntime: /* @__PURE__ */ __name(() => startRuntimeForRequest?.(), "startRuntime"),
2555
3288
  runtimeReady,
2556
- authenticateDeferredRuntimeRequest: bearerAuth(opts.token)
3289
+ authenticateDeferredRuntimeRequest: bearerAuth(opts.token),
3290
+ authenticateDeferredChannelWebhookRequest: deferredChannelWebhookAuth
2557
3291
  });
2558
3292
  let listenHostname = opts.hostname;
2559
3293
  if (opts.hostname.startsWith("[")) {
@@ -2591,7 +3325,8 @@ async function runQwenServe(optsIn, deps = {}) {
2591
3325
  try {
2592
3326
  if (opts.channelSelection) {
2593
3327
  const createSupervisor = deps.channelWorkerSupervisorFactory ?? channelRuntime?.createChannelWorkerSupervisor;
2594
- if (!createSupervisor) {
3328
+ const findCliEntryPath = channelRuntime?.findCliEntryPath;
3329
+ if (!createSupervisor || !findCliEntryPath) {
2595
3330
  throw new Error(
2596
3331
  "Channel worker supervisor runtime is not available."
2597
3332
  );
@@ -2694,6 +3429,8 @@ async function runQwenServe(optsIn, deps = {}) {
2694
3429
  }, "cancelDeferredRuntimeStartup");
2695
3430
  const shutdownBridgeAfterFailedStartup = /* @__PURE__ */ __name(async (bridge) => {
2696
3431
  if (!bridge || deps.bridge) return;
3432
+ if (shutdownBridges.has(bridge)) return;
3433
+ shutdownBridges.add(bridge);
2697
3434
  try {
2698
3435
  await bridge.shutdown();
2699
3436
  } catch (shutdownErr) {
@@ -2734,7 +3471,10 @@ async function runQwenServe(optsIn, deps = {}) {
2734
3471
  await stopChannelWorkerAfterFailedStartup();
2735
3472
  disposeDaemonEventLoopMonitor();
2736
3473
  removeCurrentServePidfile();
2737
- await shutdownBridgeAfterFailedStartup(bridgeForCleanup ?? bridgeRef);
3474
+ const bridgesForCleanup = bridgeForCleanup ? [bridgeForCleanup, ...getRuntimeBridgesForCleanup()] : getRuntimeBridgesForCleanup();
3475
+ for (const bridge of [...new Set(bridgesForCleanup)]) {
3476
+ await shutdownBridgeAfterFailedStartup(bridge);
3477
+ }
2738
3478
  markRuntimeFailed(error);
2739
3479
  }, "failRuntimeStartup");
2740
3480
  const armRuntimeStartupTimer = /* @__PURE__ */ __name(() => {
@@ -2843,7 +3583,9 @@ async function runQwenServe(optsIn, deps = {}) {
2843
3583
  daemonLog.warn(`received ${signal} during drain \u2014 forcing exit`);
2844
3584
  try {
2845
3585
  channelWorker.killAllSync();
2846
- bridgeRef?.killAllSync();
3586
+ for (const runtimeBridge of getRuntimeBridgesForCleanup()) {
3587
+ runtimeBridge.killAllSync();
3588
+ }
2847
3589
  removeCurrentServePidfile();
2848
3590
  } catch (err) {
2849
3591
  daemonLog.error(
@@ -2885,6 +3627,10 @@ async function runQwenServe(optsIn, deps = {}) {
2885
3627
  closePromise = new Promise((res, rej) => {
2886
3628
  shuttingDown = true;
2887
3629
  app.locals.stopScheduledTaskKeepalive?.();
3630
+ const stoppers = app.locals.subSessionStoppers;
3631
+ if (stoppers) {
3632
+ for (const stop of stoppers) stop();
3633
+ }
2888
3634
  clearRuntimeStartAfterHealthTimer();
2889
3635
  clearRuntimeStartFallbackTimer();
2890
3636
  cancelDeferredRuntimeStartup();
@@ -2954,8 +3700,9 @@ async function runQwenServe(optsIn, deps = {}) {
2954
3700
  );
2955
3701
  });
2956
3702
  removeCurrentServePidfile();
2957
- const bridgeForShutdown = bridgeRef;
2958
- if (bridgeForShutdown) {
3703
+ for (const bridgeForShutdown of getRuntimeBridgesForCleanup()) {
3704
+ if (shutdownBridges.has(bridgeForShutdown)) continue;
3705
+ shutdownBridges.add(bridgeForShutdown);
2959
3706
  await bridgeForShutdown.shutdown().catch((err) => {
2960
3707
  daemonLog.error(
2961
3708
  "bridge shutdown error",
@@ -3034,8 +3781,8 @@ async function runQwenServe(optsIn, deps = {}) {
3034
3781
  }
3035
3782
  }, "onListening");
3036
3783
  let server;
3784
+ let httpsServer;
3037
3785
  if (tlsOptions) {
3038
- let httpsServer;
3039
3786
  try {
3040
3787
  httpsServer = https.createServer(tlsOptions, app);
3041
3788
  } catch (err) {
@@ -3046,19 +3793,46 @@ async function runQwenServe(optsIn, deps = {}) {
3046
3793
  );
3047
3794
  return;
3048
3795
  }
3049
- server = httpsServer.listen(opts.port, listenHostname, onListening);
3050
- } else {
3051
- server = app.listen(opts.port, listenHostname, onListening);
3052
3796
  }
3053
- server.once("error", (err) => {
3054
- removeCurrentServePidfile();
3055
- reject(err);
3056
- });
3797
+ const tryListen = /* @__PURE__ */ __name((attemptPort, attempt) => {
3798
+ try {
3799
+ if (httpsServer) {
3800
+ httpsServer.removeAllListeners("listening");
3801
+ server = httpsServer.listen(attemptPort, listenHostname, onListening);
3802
+ } else {
3803
+ server = app.listen(attemptPort, listenHostname, onListening);
3804
+ }
3805
+ } catch (err) {
3806
+ removeCurrentServePidfile();
3807
+ reject(err instanceof Error ? err : new Error(String(err)));
3808
+ return;
3809
+ }
3810
+ server.once("error", (err) => {
3811
+ server.close();
3812
+ const nextPort = attemptPort + 1;
3813
+ if (err.code === "EADDRINUSE" && opts.port !== 0 && nextPort <= 65535 && attempt < MAX_PORT_ATTEMPTS - 1) {
3814
+ writeStderrLine(
3815
+ `qwen serve: port ${attemptPort} is in use, trying ${nextPort}...`
3816
+ );
3817
+ tryListen(nextPort, attempt + 1);
3818
+ } else {
3819
+ if (err.code === "EADDRINUSE" && attempt > 0) {
3820
+ writeStderrLine(
3821
+ `qwen serve: all ports ${opts.port}\u2013${attemptPort} are in use`
3822
+ );
3823
+ }
3824
+ removeCurrentServePidfile();
3825
+ reject(err);
3826
+ }
3827
+ });
3828
+ }, "tryListen");
3829
+ tryListen(opts.port, 0);
3057
3830
  });
3058
3831
  }
3059
3832
  __name(runQwenServe, "runQwenServe");
3060
3833
  export {
3061
3834
  InvalidPolicyConfigError,
3835
+ createDisabledChannelWorkerSupervisor,
3062
3836
  createLazyBridgeProxy,
3063
3837
  extractContextFilename,
3064
3838
  formatChannelWorkerDaemonUrl,