@qwen-code/qwen-code 0.21.10 → 0.21.11-nightly.20260815.c396fe3d12

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 (386) hide show
  1. package/bundled/coordinate/SKILL.md +52 -0
  2. package/bundled/qc-helper/docs/configuration/model-providers.md +10 -8
  3. package/bundled/qc-helper/docs/configuration/settings.md +10 -0
  4. package/bundled/qc-helper/docs/extension/_meta.ts +1 -0
  5. package/bundled/qc-helper/docs/extension/agent-plugins.md +50 -0
  6. package/bundled/qc-helper/docs/extension/extension-releasing.md +3 -3
  7. package/bundled/qc-helper/docs/extension/introduction.md +17 -3
  8. package/bundled/qc-helper/docs/features/_meta.ts +1 -0
  9. package/bundled/qc-helper/docs/features/arena.md +4 -3
  10. package/bundled/qc-helper/docs/features/channels/overview.md +1 -1
  11. package/bundled/qc-helper/docs/features/channels/plugins.md +11 -11
  12. package/bundled/qc-helper/docs/features/code-review.md +1 -1
  13. package/bundled/qc-helper/docs/features/commands.md +7 -6
  14. package/bundled/qc-helper/docs/features/dual-output.md +5 -0
  15. package/bundled/qc-helper/docs/features/headless.md +8 -0
  16. package/bundled/qc-helper/docs/features/multi-agent-coordination.md +30 -0
  17. package/bundled/qc-helper/docs/qwen-serve.md +105 -40
  18. package/bundled/review/SKILL.md +72 -43
  19. package/chunks/{MaxSizedBox-FKXYULMW.js → MaxSizedBox-RRYY7LE5.js} +45 -44
  20. package/chunks/{StandaloneSessionPicker-OQS3M7AY.js → StandaloneSessionPicker-CK3O3N7F.js} +68 -67
  21. package/chunks/{acp-startup-profiler-VNTFWYAC.js → acp-startup-profiler-SVPUHLXV.js} +2 -2
  22. package/chunks/{acpAgent-AGS6HLQQ.js → acpAgent-DXUWYWDM.js} +1889 -640
  23. package/chunks/{agent-4NCVO27U.js → agent-DEPG4BP7.js} +42 -41
  24. package/chunks/agent-headless-VLBUWGPP.js +87 -0
  25. package/chunks/{anthropicContentGenerator-D3Y4RFT4.js → anthropicContentGenerator-YDT4EOKO.js} +8 -8
  26. package/chunks/{artifact-tool-N652YE4L.js → artifact-tool-4GCQQDZI.js} +2 -2
  27. package/chunks/{askUserQuestion-ONW74PKJ.js → askUserQuestion-HZJJLR3Z.js} +2 -2
  28. package/chunks/bridge-U7LETTTF.js +104 -0
  29. package/chunks/{ca-ZLKAB4K3.js → ca-4CQ6MYNQ.js} +2 -1
  30. package/chunks/{channel-management-service-PHELKOW2.js → channel-management-service-OADNGQM3.js} +6 -6
  31. package/chunks/channel-settings-store-B2GRIZ2D.js +102 -0
  32. package/chunks/{channel-worker-group-WQP4RCDO.js → channel-worker-group-IHBIHQ45.js} +9 -8
  33. package/chunks/{channel-worker-manager-MRDFAKIM.js → channel-worker-manager-GEHYJ5AE.js} +9 -8
  34. package/chunks/{channel-worker-supervisor-IVSDIMI4.js → channel-worker-supervisor-ZJIIWM4I.js} +7 -6
  35. package/chunks/{chunk-26CXSA6V.js → chunk-25VWCPYE.js} +2 -2
  36. package/chunks/{chunk-DP3IHZGG.js → chunk-2AUM35J5.js} +59 -7
  37. package/chunks/{chunk-URKIBIFC.js → chunk-2QHWLRQ2.js} +3 -3
  38. package/chunks/{chunk-4PYCZH2V.js → chunk-2ZWH53I4.js} +3 -3
  39. package/chunks/{chunk-UVX4Y6IN.js → chunk-3AEKDXKT.js} +1 -1
  40. package/chunks/{chunk-ABVRJU3D.js → chunk-3ER3FWZM.js} +9 -9
  41. package/chunks/{chunk-DZUO626D.js → chunk-3GM5DLBI.js} +3 -3
  42. package/chunks/{chunk-VSFKIRRW.js → chunk-3NBTNFNC.js} +4 -4
  43. package/chunks/{chunk-NEOXOWYH.js → chunk-3QZY3JSR.js} +7 -7
  44. package/chunks/{chunk-BKHCW2BI.js → chunk-3VUENPWF.js} +10 -0
  45. package/chunks/{chunk-67EWJE77.js → chunk-45NQKMYB.js} +1 -1
  46. package/chunks/{chunk-KKBPOU75.js → chunk-4AOVQPJU.js} +1 -1
  47. package/chunks/{chunk-OONWZLFK.js → chunk-4EB5GRRC.js} +4 -4
  48. package/chunks/{chunk-YGT2AUJ7.js → chunk-4KM2SYK5.js} +39 -19
  49. package/chunks/{chunk-Y3OVRWRY.js → chunk-4N4JVRZA.js} +1 -1
  50. package/chunks/{chunk-VNNWAZSI.js → chunk-56HVDG3M.js} +6 -6
  51. package/chunks/{chunk-TRRF5BSP.js → chunk-5C42HXEX.js} +1 -1
  52. package/chunks/{chunk-J6SZID63.js → chunk-5RUCD4ED.js} +2 -2
  53. package/chunks/{chunk-WAUGQKUU.js → chunk-63FNZTWG.js} +9 -5
  54. package/chunks/{chunk-F6WDTQ3M.js → chunk-655DWW7X.js} +5 -5
  55. package/chunks/{chunk-AAE6SR4Q.js → chunk-7P5NK5EI.js} +1 -1
  56. package/chunks/{chunk-MZSJ43WV.js → chunk-7U5G6JXI.js} +24 -2
  57. package/chunks/{chunk-GWVUR3QZ.js → chunk-7WROZ3E6.js} +3 -3
  58. package/chunks/{chunk-PBRVUF5B.js → chunk-A6NRNRKE.js} +1 -1
  59. package/chunks/{chunk-IBUGFUXC.js → chunk-A6TJ7QUA.js} +13 -13
  60. package/chunks/{chunk-DCZEPFB4.js → chunk-ADM4C4TX.js} +3 -3
  61. package/chunks/{chunk-UBX6NL47.js → chunk-AGWK35OJ.js} +47 -3
  62. package/chunks/{chunk-4MKXUHXY.js → chunk-AGWZRQJJ.js} +5 -5
  63. package/chunks/{chunk-GNPNYXJB.js → chunk-AKBFSOC5.js} +2 -2
  64. package/chunks/{chunk-YWPSGJFI.js → chunk-ARSQPRYL.js} +2 -2
  65. package/chunks/{chunk-IWTMYQ32.js → chunk-AVKPDOQZ.js} +12 -11
  66. package/chunks/{chunk-DX3RGJMS.js → chunk-AW27A43Y.js} +76 -19
  67. package/chunks/{chunk-MIKXJYZB.js → chunk-AZPFLLFR.js} +315 -299
  68. package/chunks/{chunk-2PLNY5TN.js → chunk-BBCGHZ4S.js} +4 -4
  69. package/chunks/{chunk-KID7K6H2.js → chunk-BP5VZBVK.js} +6 -6
  70. package/chunks/{chunk-LLCWZQCU.js → chunk-BRQR2FJ5.js} +3 -3
  71. package/chunks/{chunk-LHEC5V6G.js → chunk-BSR5AXZR.js} +4 -3
  72. package/chunks/{chunk-ONSZH6VM.js → chunk-CGM3E75C.js} +2 -2
  73. package/chunks/{chunk-SEZ556DZ.js → chunk-CPFFU46D.js} +1 -1
  74. package/chunks/{chunk-H6XPXXMH.js → chunk-CQ35AJ4Z.js} +252 -254
  75. package/chunks/{chunk-7MH4J33A.js → chunk-D2RNVVH6.js} +2 -2
  76. package/chunks/{chunk-M6HMMKVG.js → chunk-D7QGE3RT.js} +1 -1
  77. package/chunks/{chunk-UMD7WQTR.js → chunk-D7VALEOK.js} +13 -9
  78. package/chunks/chunk-DAV4QFD5.js +1280 -0
  79. package/chunks/{chunk-B2GJNDTV.js → chunk-DD6O3ZRD.js} +1 -1
  80. package/chunks/{chunk-HUWENAHO.js → chunk-DEDESZDL.js} +1 -1
  81. package/chunks/{chunk-3P2LV43B.js → chunk-DG4IQ6JG.js} +3 -3
  82. package/chunks/{chunk-QUI267ZP.js → chunk-DPTMKFIH.js} +492 -63
  83. package/chunks/{chunk-Q3JQ7OSU.js → chunk-EJOGLSNJ.js} +1 -1
  84. package/chunks/{chunk-NRLFZWCT.js → chunk-EQHCHTHC.js} +48 -5
  85. package/chunks/{chunk-P3BJLFSZ.js → chunk-EQR7YDXY.js} +3 -3
  86. package/chunks/{chunk-4WL6SY4F.js → chunk-EQUXHAFW.js} +1 -1
  87. package/chunks/{chunk-Q3AL4JQ3.js → chunk-F5BD3RNA.js} +2 -2
  88. package/chunks/{chunk-A7XMDZRI.js → chunk-FJYUSD2N.js} +5 -5
  89. package/chunks/{chunk-JT7XS4YW.js → chunk-FMIH5KMQ.js} +1 -1
  90. package/chunks/{chunk-ZBVS26BY.js → chunk-FPGTNKCP.js} +7 -5
  91. package/chunks/{chunk-W5UC37EE.js → chunk-FQDCO3CJ.js} +12 -1
  92. package/chunks/{chunk-EQL65XGA.js → chunk-FRHQQC2Z.js} +47 -21
  93. package/chunks/{chunk-FVKHVJZQ.js → chunk-G6MUFRNI.js} +1 -1
  94. package/chunks/{chunk-D27I6YJT.js → chunk-GB245X4Z.js} +129 -26
  95. package/chunks/{chunk-WCG5O7IP.js → chunk-GZDWTBT3.js} +2 -2
  96. package/chunks/{chunk-AOHJKPKL.js → chunk-H7TMVHKE.js} +1 -1
  97. package/chunks/{chunk-ZJ4W6SUY.js → chunk-HDRTQ5DH.js} +3 -3
  98. package/chunks/{chunk-ZZCWJWTF.js → chunk-HG3UBTJ4.js} +31 -11
  99. package/chunks/chunk-HHJLM3WQ.js +41 -0
  100. package/chunks/{chunk-6LP743KE.js → chunk-HHZU6ZZM.js} +79 -113
  101. package/chunks/{chunk-OIVKILPI.js → chunk-HOSVOUDK.js} +74 -0
  102. package/chunks/{chunk-DA4HRSBW.js → chunk-HTYND72J.js} +1 -1
  103. package/chunks/{chunk-ZRBMO3C7.js → chunk-IKFHTAQW.js} +1 -1
  104. package/chunks/{chunk-KZ22NXBY.js → chunk-IVROQYG5.js} +4 -4
  105. package/chunks/{chunk-UDXSXLER.js → chunk-IW6RQPQB.js} +14 -4
  106. package/chunks/{chunk-F24A2JBM.js → chunk-J6JVP7ZZ.js} +1180 -254
  107. package/chunks/{chunk-ECWR5LQR.js → chunk-JB6IM2TJ.js} +3 -3
  108. package/chunks/{chunk-MVUQRLOH.js → chunk-JRIVMPD2.js} +3 -3
  109. package/chunks/{chunk-Q7YDKOGY.js → chunk-JVEGA3MM.js} +1 -1
  110. package/chunks/{chunk-4TRQPFDP.js → chunk-K34GJQOZ.js} +140 -20
  111. package/chunks/{chunk-W4RQUHY3.js → chunk-K5IDV3PC.js} +184 -22
  112. package/chunks/{chunk-NDU63YLI.js → chunk-KD6FGI2Q.js} +4 -4
  113. package/chunks/{chunk-HV76SFIA.js → chunk-KEC5FHLM.js} +3 -3
  114. package/chunks/{chunk-IIJEYBNH.js → chunk-KLOMACIR.js} +197 -60
  115. package/chunks/{chunk-Z4JX4NSH.js → chunk-KSPRBJJ3.js} +50 -50
  116. package/chunks/{chunk-KONVMRK7.js → chunk-KX5TNFCJ.js} +1 -1
  117. package/chunks/{chunk-QGNOFE5E.js → chunk-KX7PC5QG.js} +1 -1
  118. package/chunks/{chunk-OJUQF2PL.js → chunk-LEKKQEQW.js} +5 -5
  119. package/chunks/{chunk-COBO5EBO.js → chunk-LSRI3ND3.js} +1 -1
  120. package/chunks/{chunk-BSI645OU.js → chunk-LUISTZXI.js} +3 -3
  121. package/chunks/{chunk-YTFDX4PR.js → chunk-M6NDLY2T.js} +1 -1
  122. package/chunks/{chunk-EBZ6BJTF.js → chunk-MNUKNVYQ.js} +1 -1
  123. package/chunks/{chunk-VFMASYQA.js → chunk-MS7GNABG.js} +3 -0
  124. package/chunks/{chunk-EI3NWELG.js → chunk-MSSNVG2G.js} +6430 -4463
  125. package/chunks/{chunk-L2AFWWJE.js → chunk-N4SVADAV.js} +351 -144
  126. package/chunks/{chunk-URK542T4.js → chunk-NF5J2WFA.js} +15 -2
  127. package/chunks/{chunk-EI3HZX6C.js → chunk-NLFLYSS4.js} +1 -1
  128. package/chunks/{chunk-NV3F44FL.js → chunk-NW2GIPG3.js} +2 -2
  129. package/chunks/{chunk-OQTXYMKW.js → chunk-NX4A23LY.js} +3 -3
  130. package/chunks/{chunk-E2FPSSKP.js → chunk-OK47XBYH.js} +97 -10
  131. package/chunks/{chunk-EKPKKXY2.js → chunk-OWGRUU7F.js} +1 -1
  132. package/chunks/{chunk-CTJLZLB5.js → chunk-OYWVIXHT.js} +1 -1
  133. package/chunks/{chunk-47PEPJO7.js → chunk-P7PSGVWP.js} +3 -3
  134. package/chunks/{chunk-6Q5ABMTU.js → chunk-PTSEETCO.js} +23 -19
  135. package/chunks/{chunk-6ZRFAKXK.js → chunk-PVXEJB66.js} +1 -1
  136. package/chunks/{chunk-EUNWC2VS.js → chunk-PZW46OTB.js} +2 -2
  137. package/chunks/{chunk-QSWDGAIC.js → chunk-QILD6R27.js} +1 -1
  138. package/chunks/{chunk-CKASRHZI.js → chunk-QLTATTPS.js} +1 -1
  139. package/chunks/{chunk-2UUMVNYT.js → chunk-QPBFRWCP.js} +3 -3
  140. package/chunks/{chunk-QJMOAMXT.js → chunk-QQSXM3FE.js} +8 -8
  141. package/chunks/{chunk-AEL7KN2O.js → chunk-RN7GFREP.js} +2 -2
  142. package/chunks/{chunk-AQAJJMRR.js → chunk-RYSBWLLV.js} +1 -1
  143. package/chunks/{chunk-MFDYOYZZ.js → chunk-SYHXR6WM.js} +26 -3
  144. package/chunks/{chunk-SR7RZ4MS.js → chunk-TB4YFWXG.js} +2 -2
  145. package/chunks/{chunk-IRZ2ZH72.js → chunk-TCMU4ZUE.js} +4 -4
  146. package/chunks/{chunk-OWMAZHIX.js → chunk-TMFWI4RC.js} +1 -1
  147. package/chunks/{chunk-TZEZYNYD.js → chunk-TQDFSQQF.js} +1 -1
  148. package/chunks/{chunk-IA7TGCN2.js → chunk-TTRH3RTQ.js} +4 -4
  149. package/chunks/{chunk-PJRW65JO.js → chunk-TXP5NGG3.js} +1 -1
  150. package/chunks/{chunk-VWKER4ZH.js → chunk-ULJGMSG5.js} +3 -3
  151. package/chunks/{chunk-2FRY5CRX.js → chunk-ULNWG62W.js} +3 -3
  152. package/chunks/{chunk-XVHYA33G.js → chunk-URYJYT5W.js} +4 -4
  153. package/chunks/{chunk-7GTMV7UE.js → chunk-US7J7LJT.js} +10786 -4462
  154. package/chunks/{chunk-HGCQ5SE7.js → chunk-UXEO7E3V.js} +21 -0
  155. package/chunks/{chunk-NV65ZUVM.js → chunk-VKT2R3NB.js} +1 -1
  156. package/chunks/{chunk-CPG6P4GG.js → chunk-VPV7WBVT.js} +1 -1
  157. package/chunks/{chunk-QG3FFJYU.js → chunk-VXSD4AGT.js} +1 -1
  158. package/chunks/{chunk-XCGIMOLN.js → chunk-WCCLLK7X.js} +14 -1
  159. package/chunks/{chunk-VJNBRRZG.js → chunk-WZMH7II3.js} +1 -1
  160. package/chunks/{chunk-5MZCSWI4.js → chunk-WZRLXVLJ.js} +1185 -1451
  161. package/chunks/{chunk-YF5MALI4.js → chunk-X5QJFMLY.js} +21 -17
  162. package/chunks/{chunk-DREZZAZM.js → chunk-XDRXOSAD.js} +13 -5
  163. package/chunks/{chunk-FOGU3LJX.js → chunk-YBHUXEC6.js} +1 -1
  164. package/chunks/{chunk-GM463R2B.js → chunk-YBVVOSOH.js} +1 -1
  165. package/chunks/{chunk-PYQADEFD.js → chunk-YIGGWOJE.js} +1 -1
  166. package/chunks/{chunk-XCWO3SMQ.js → chunk-YILJKX2T.js} +3 -3
  167. package/chunks/{chunk-Y4R47ZUH.js → chunk-YM3I6VW5.js} +7 -7
  168. package/chunks/{chunk-OCSFNUU4.js → chunk-YMALTWIZ.js} +13 -11
  169. package/chunks/{chunk-WOJZWRAZ.js → chunk-YRLW2MSX.js} +1 -1
  170. package/chunks/{chunk-UEOKWYGY.js → chunk-YYIOFWVH.js} +11 -11
  171. package/chunks/chunk-Z7B6SRPM.js +32 -0
  172. package/chunks/{chunk-S6HYI3MF.js → chunk-ZBB5EZZV.js} +2 -2
  173. package/chunks/{chunk-VKJ4KTPJ.js → chunk-ZLCT4C5A.js} +1 -1
  174. package/chunks/{chunk-O3EU6GMH.js → chunk-ZO37CAQH.js} +27 -4
  175. package/chunks/{computer-use-WQFK33Z3.js → computer-use-TMDO6TEC.js} +42 -41
  176. package/chunks/{config-utils-ULCSRMWD.js → config-utils-Z3OW3IQG.js} +6 -6
  177. package/chunks/{contextCommand-7EOZND7C.js → contextCommand-IUQ6G5ES.js} +44 -43
  178. package/chunks/{core-runtime-FGMQRM6E.js → core-runtime-HAZLPQXI.js} +42 -41
  179. package/chunks/{create-sub-session-QM2K5HLZ.js → create-sub-session-GREIOIZU.js} +42 -41
  180. package/chunks/{create-sub-session-QIDZUOPU.js → create-sub-session-XT6DLYOE.js} +2 -2
  181. package/chunks/{cron-create-VONA5JYY.js → cron-create-2JZ2TWTF.js} +4 -4
  182. package/chunks/{cron-delete-5JXSP2MI.js → cron-delete-CTPD2P26.js} +4 -4
  183. package/chunks/{cron-list-KE4F2CIR.js → cron-list-V44KHAF6.js} +4 -4
  184. package/chunks/{daemon-GWD7BT6E.js → daemon-GED37WOX.js} +216 -9
  185. package/chunks/daemon-git-worktree-guard-BSKVBYPM.js +2062 -0
  186. package/chunks/daemon-status-provider-7UK2DVVN.js +102 -0
  187. package/chunks/daemon-trust-policy-BZEALQSM.js +99 -0
  188. package/chunks/{daemon-trust-policy-monitor-6UKEABN5.js → daemon-trust-policy-monitor-P7OM342T.js} +49 -48
  189. package/chunks/{de-LIW4XVLN.js → de-UBEBKG6V.js} +2 -1
  190. package/chunks/{deferred-core-runtime-67GJXHXS.js → deferred-core-runtime-MTDXZT6B.js} +42 -41
  191. package/chunks/{display-image-NQRSIBXM.js → display-image-M2ELAVN4.js} +4 -4
  192. package/chunks/{dist-OTUO3AS2.js → dist-4ZPG4BY6.js} +13 -5
  193. package/chunks/{dist-B2CGTW6T.js → dist-BROOP2EG.js} +3 -3
  194. package/chunks/{dist-EZE3V3Q7.js → dist-IYYN3RUT.js} +3 -3
  195. package/chunks/{dist-3NTTUAHT.js → dist-JWMKPWT5.js} +5 -3
  196. package/chunks/{dist-Z3CS4OVP.js → dist-K7IQB53U.js} +11 -5
  197. package/chunks/{dist-J47AXBZC.js → dist-MAQXAQ2Y.js} +3 -3
  198. package/chunks/{dist-6BMOAE3Z.js → dist-WJ4BHIEW.js} +4 -4
  199. package/chunks/{dist-EWW3J4HQ.js → dist-YEPL4RAW.js} +3 -3
  200. package/chunks/{earlyInputCapture-IWMYR6OB.js → earlyInputCapture-BGZYFN2F.js} +43 -42
  201. package/chunks/{edit-ZFGROCAF.js → edit-ASQVJARF.js} +45 -43
  202. package/chunks/{en-SY5GTIGX.js → en-X6YV7GME.js} +2 -1
  203. package/chunks/{enter-worktree-TZZZCDM5.js → enter-worktree-WIUNMC64.js} +42 -41
  204. package/chunks/{enterPlanMode-U77BI3R6.js → enterPlanMode-TUBB2L7O.js} +42 -41
  205. package/chunks/{environment-HC37DS2I.js → environment-RWSNEY4T.js} +45 -44
  206. package/chunks/{errors-6AG54JPD.js → errors-44QVVNGT.js} +44 -43
  207. package/chunks/{exit-worktree-UYYWFPNK.js → exit-worktree-WPBRPIRR.js} +42 -41
  208. package/chunks/exitPlanMode-AP7J626M.js +85 -0
  209. package/chunks/{external-tool-guard-provider-5HTGOPGU.js → external-tool-guard-provider-TE4DRY36.js} +1 -1
  210. package/chunks/{fast-path-F5FSZ3O7.js → fast-path-XG5KXXLS.js} +6 -6
  211. package/chunks/{fast-path-settings-RPAVBD7P.js → fast-path-settings-LNOFM2YP.js} +2 -2
  212. package/chunks/{fr-RQFO7U4P.js → fr-VENTC2BS.js} +2 -1
  213. package/chunks/{gemini-NKQHYM36.js → gemini-PGXORAFF.js} +112 -103
  214. package/chunks/{geminiContentGenerator-HCWZOUX3.js → geminiContentGenerator-ZQVVD4J4.js} +6 -6
  215. package/chunks/{glob-3PDXKBAO.js → glob-Q6LWKMBU.js} +42 -41
  216. package/chunks/{goal-tools-SWNB6GP4.js → goal-tools-M4UDAZXP.js} +4 -4
  217. package/chunks/{grep-5HZKZYVD.js → grep-C67Z35I4.js} +42 -41
  218. package/chunks/handleAutoUpdate-75L74MB4.js +94 -0
  219. package/chunks/{i18n-Q27KKNDL.js → i18n-GYUC23UJ.js} +43 -42
  220. package/chunks/{image-gen-2Z2RJ6W7.js → image-gen-XE56S4MG.js} +10 -10
  221. package/chunks/initializer-V7XZVY35.js +100 -0
  222. package/chunks/{installationInfo-XXB75T7O.js → installationInfo-S5PPSD7T.js} +43 -42
  223. package/chunks/{ja-KOZKHJHZ.js → ja-QHT4EQTO.js} +2 -1
  224. package/chunks/{keychain-token-storage-TVAMTNP7.js → keychain-token-storage-NKKCUHI2.js} +2 -2
  225. package/chunks/list-JJ2FB7SP.js +103 -0
  226. package/chunks/{list-agents-Z4WABFDZ.js → list-agents-O6WSY4CT.js} +2 -2
  227. package/chunks/loadedSettingsAdapter-LNUDRGW5.js +97 -0
  228. package/chunks/{loggingContentGenerator-6NTFBM7Q.js → loggingContentGenerator-HCJ2DX2S.js} +162 -112
  229. package/chunks/{loop-wakeup-UZ5RL5Y2.js → loop-wakeup-GVQRMUKS.js} +5 -5
  230. package/chunks/{ls-TVHDGIES.js → ls-6W2D7TKU.js} +4 -4
  231. package/chunks/{lsp-CVN6OQPI.js → lsp-NJ4KFBI2.js} +2 -2
  232. package/chunks/{managed-npm-update-SPHYQUWZ.js → managed-npm-update-MDF2JDTH.js} +45 -44
  233. package/chunks/mcp-M5OML5FI.js +97 -0
  234. package/chunks/{monitor-ZBBPAA54.js → monitor-U5NM5ONC.js} +42 -41
  235. package/chunks/nonInteractiveCli-TX3QP7JT.js +163 -0
  236. package/chunks/{notebook-edit-5W3FW7Z2.js → notebook-edit-Q7SUR44R.js} +42 -41
  237. package/chunks/{openaiContentGenerator-TQANPEVZ.js → openaiContentGenerator-2H5CYLXP.js} +29 -29
  238. package/chunks/{pidfile-EQOBLH4E.js → pidfile-SHSMSAZR.js} +43 -42
  239. package/chunks/{processUtils-7XQG7EHS.js → processUtils-GZAP6EYW.js} +2 -2
  240. package/chunks/{pt-U6AOCTMF.js → pt-VL3I5RNY.js} +2 -1
  241. package/chunks/{qwenContentGenerator-BKCPHHXU.js → qwenContentGenerator-2624VVZH.js} +48 -48
  242. package/chunks/{qwenOAuth2-BJ6PQKE6.js → qwenOAuth2-AAWH3C7N.js} +9 -9
  243. package/chunks/read-file-ZWGQE2TE.js +32 -0
  244. package/chunks/{read-mcp-resource-PZ4ZF6YL.js → read-mcp-resource-GWCP23WG.js} +2 -2
  245. package/chunks/{read-package-up-TCM6I7S2.js → read-package-up-K6RKTL5D.js} +1 -1
  246. package/chunks/{record-artifact-P4HFMS7X.js → record-artifact-IYQDEYMV.js} +3 -3
  247. package/chunks/{resumeHistoryUtils-6N6XGJJW.js → resumeHistoryUtils-7N2H4QCU.js} +50 -49
  248. package/chunks/ripGrep-6JGJDWYB.js +85 -0
  249. package/chunks/{ru-CMX4UMYP.js → ru-4RCKL4PY.js} +2 -1
  250. package/chunks/{run-qwen-serve-BCKBCAMX.js → run-qwen-serve-2A6RHHI7.js} +197 -90
  251. package/chunks/{runtime-E2437YKL.js → runtime-NPYVZVRI.js} +55 -54
  252. package/chunks/{scheduler-K3D5Z655.js → scheduler-UMKTEQAM.js} +44 -43
  253. package/chunks/{sdk-exporters-http-XVTZQRCE.js → sdk-exporters-http-NHBYB5FZ.js} +11 -7
  254. package/chunks/{sdk-impl-7W7AKCS4.js → sdk-impl-SK4P5WON.js} +13 -10
  255. package/chunks/{send-message-CAMSLG2L.js → send-message-O7FO63UK.js} +6 -6
  256. package/chunks/serve-LYADPWRV.js +107 -0
  257. package/chunks/{server-UD6INW7J.js → server-WMVPH4G4.js} +1137 -382
  258. package/chunks/{session-GR4ZEVW4.js → session-LE6O62ZE.js} +122 -102
  259. package/chunks/{settings-5O24D3OJ.js → settings-2IPZYYGS.js} +48 -47
  260. package/chunks/{shell-UTLWLG5G.js → shell-VOBAZFFI.js} +42 -41
  261. package/chunks/{skill-QQAZL4VO.js → skill-6LKOWJV4.js} +19 -19
  262. package/chunks/{skill-settings-P3YHJVBZ.js → skill-settings-J5IHQA7L.js} +48 -47
  263. package/chunks/spawnChannel-TLW7N3SM.js +98 -0
  264. package/chunks/{standalone-update-QP742MGP.js → standalone-update-6OFPUBEM.js} +44 -43
  265. package/chunks/{startInteractiveUI-YCS6AEPN.js → startInteractiveUI-KVHNCR2L.js} +836 -444
  266. package/chunks/{syntheticOutput-PEBJQYJV.js → syntheticOutput-DVHJMUGV.js} +3 -3
  267. package/chunks/{task-create-5NWCQSJF.js → task-create-4NC7PDI4.js} +10 -10
  268. package/chunks/{task-list-53265TRZ.js → task-list-LBSRMOC7.js} +5 -5
  269. package/chunks/{task-stop-FPCOIRYX.js → task-stop-YFNATTIM.js} +2 -2
  270. package/chunks/{task-update-5HN577LS.js → task-update-BPLM52GD.js} +10 -10
  271. package/chunks/{team-create-WFH7OCDQ.js → team-create-INCC7G74.js} +44 -43
  272. package/chunks/{team-delete-MMQB4OSC.js → team-delete-MKYMYBFM.js} +5 -5
  273. package/chunks/{team-plan-approval-EGTT53MV.js → team-plan-approval-6DCWGZQ4.js} +42 -41
  274. package/chunks/{terminal-image-renderer-BWRESAQ7.js → terminal-image-renderer-O5EDW64G.js} +44 -43
  275. package/chunks/theme-manager-NZZO4SWE.js +89 -0
  276. package/chunks/{todoWrite-JGV6VLOX.js → todoWrite-K5K7NRE5.js} +4 -4
  277. package/chunks/{tool-search-TI5PTIBF.js → tool-search-JB2PXD5P.js} +19 -19
  278. package/chunks/total-session-admission-NWNMU6AW.js +99 -0
  279. package/chunks/{trustedFolders-4KYHA4IG.js → trustedFolders-A5ZWRRSP.js} +43 -42
  280. package/chunks/{update-relaunch-WB6LGIF2.js → update-relaunch-GG7EDBEA.js} +5 -5
  281. package/chunks/{updateCheck-LOS5GYFC.js → updateCheck-P6JJ4MBU.js} +48 -47
  282. package/chunks/{useAutoAcceptIndicator-MHAPY52L.js → useAutoAcceptIndicator-KV2AANVG.js} +53 -52
  283. package/chunks/{validateNonInterActiveAuth-QV22HNQU.js → validateNonInterActiveAuth-HXRCYXY7.js} +89 -88
  284. package/chunks/{version-DALWZHKQ.js → version-HH5V762G.js} +2 -2
  285. package/chunks/{web-fetch-JMJVMYFE.js → web-fetch-LVXPFB5O.js} +19 -19
  286. package/chunks/{web-search-DNDUIPU5.js → web-search-4E234FSM.js} +11 -11
  287. package/chunks/{workflow-JGNN64PM.js → workflow-GUE6WIMP.js} +117 -50
  288. package/chunks/workspace-providers-status-TUWLGJOF.js +100 -0
  289. package/chunks/{workspace-registration-store-LRJG7QA4.js → workspace-registration-store-22XXHPKR.js} +1 -1
  290. package/chunks/{workspace-registry-KVXIFM36.js → workspace-registry-HUFJF5W5.js} +50 -49
  291. package/chunks/{workspace-service-PO4AAKKT.js → workspace-service-NAGTBJXJ.js} +54 -53
  292. package/chunks/workspace-skills-status-LWDBXAQI.js +100 -0
  293. package/chunks/{workspace-trust-reconciler-DOZPCVHG.js → workspace-trust-reconciler-DLWV2ZO6.js} +57 -56
  294. package/chunks/write-file-QVHVOKKR.js +87 -0
  295. package/chunks/{zh-AGL2FVBI.js → zh-LMSTK4WD.js} +2 -1
  296. package/chunks/{zh-TW-KI66MHQY.js → zh-TW-SQ4HTSCW.js} +2 -1
  297. package/chunks/{zoom-image-CNC77ZMA.js → zoom-image-CJDXYWJH.js} +15 -15
  298. package/cli.js +18 -17
  299. package/locales/ca.js +1 -0
  300. package/locales/de.js +1 -0
  301. package/locales/en.js +1 -0
  302. package/locales/fr.js +1 -0
  303. package/locales/ja.js +1 -0
  304. package/locales/pt.js +1 -0
  305. package/locales/ru.js +1 -0
  306. package/locales/zh-TW.js +1 -0
  307. package/locales/zh.js +1 -0
  308. package/package.json +4 -4
  309. package/web-shell/assets/{arc-CDk0d60K.js → arc-DagtOPoO.js} +1 -1
  310. package/web-shell/assets/{architectureDiagram-3BPJPVTR-h-W3I2lP.js → architectureDiagram-3BPJPVTR-Dc3kGCBm.js} +1 -1
  311. package/web-shell/assets/{blockDiagram-GPEHLZMM-D1pvSmZg.js → blockDiagram-GPEHLZMM-BUZvQLL_.js} +1 -1
  312. package/web-shell/assets/{c4Diagram-AAUBKEIU-ByAm5ZNf.js → c4Diagram-AAUBKEIU-BbBgCu9K.js} +1 -1
  313. package/web-shell/assets/channel-aMHKHCQ2.js +1 -0
  314. package/web-shell/assets/{chunk-2J33WTMH-VrGPPOGV.js → chunk-2J33WTMH-CZ4miMNB.js} +1 -1
  315. package/web-shell/assets/{chunk-4BX2VUAB-B7hTowgG.js → chunk-4BX2VUAB-B2_qQSGx.js} +1 -1
  316. package/web-shell/assets/{chunk-55IACEB6-j1Fq8DpE.js → chunk-55IACEB6-EdmTwZW7.js} +1 -1
  317. package/web-shell/assets/{chunk-727SXJPM-UjABYpF2.js → chunk-727SXJPM-l2EpyrLV.js} +1 -1
  318. package/web-shell/assets/{chunk-AQP2D5EJ-D4uBItrs.js → chunk-AQP2D5EJ-0q9sx5lV.js} +1 -1
  319. package/web-shell/assets/{chunk-FMBD7UC4-DeFbKlb8.js → chunk-FMBD7UC4-CbGnA4Dp.js} +1 -1
  320. package/web-shell/assets/{chunk-ND2GUHAM-rQJ8TIgT.js → chunk-ND2GUHAM-D8JBELgZ.js} +1 -1
  321. package/web-shell/assets/{chunk-QZHKN3VN-DAGcRxvq.js → chunk-QZHKN3VN-DQMpGGOO.js} +1 -1
  322. package/web-shell/assets/classDiagram-4FO5ZUOK-zASpLzDx.js +1 -0
  323. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-zASpLzDx.js +1 -0
  324. package/web-shell/assets/{cose-bilkent-S5V4N54A-MaE7MJSt.js → cose-bilkent-S5V4N54A-DzM-ZRsM.js} +1 -1
  325. package/web-shell/assets/{dagre-BM42HDAG-DzijYGSb.js → dagre-BM42HDAG-uxLS-TtN.js} +1 -1
  326. package/web-shell/assets/{diagram-2AECGRRQ-WdbG7WnX.js → diagram-2AECGRRQ-DH7Gnqzr.js} +1 -1
  327. package/web-shell/assets/{diagram-5GNKFQAL-NYutsBnw.js → diagram-5GNKFQAL-B2TngKRK.js} +1 -1
  328. package/web-shell/assets/{diagram-KO2AKTUF-Dqg0eBY0.js → diagram-KO2AKTUF-DQ61-HiV.js} +1 -1
  329. package/web-shell/assets/{diagram-LMA3HP47-C7vRP2Lb.js → diagram-LMA3HP47-By6qvgAT.js} +1 -1
  330. package/web-shell/assets/{diagram-OG6HWLK6-B2sEPpPt.js → diagram-OG6HWLK6-ClVSEz-3.js} +1 -1
  331. package/web-shell/assets/{erDiagram-TEJ5UH35-a4zIbzm8.js → erDiagram-TEJ5UH35-C9gFc5Fg.js} +1 -1
  332. package/web-shell/assets/{flowDiagram-I6XJVG4X-BK9y89ya.js → flowDiagram-I6XJVG4X-BWPLLJ5-.js} +1 -1
  333. package/web-shell/assets/{ganttDiagram-6RSMTGT7-wUQTSNvV.js → ganttDiagram-6RSMTGT7-C6RMacQQ.js} +1 -1
  334. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-Dnzt4SAi.js → gitGraphDiagram-PVQCEYII-LnqiWuka.js} +1 -1
  335. package/web-shell/assets/index---fOcMdS.js +1789 -0
  336. package/web-shell/assets/{index-BA3wUcKL.js → index-B9iqcrv0.js} +1 -1
  337. package/web-shell/assets/index-BIGQygTL.css +5 -0
  338. package/web-shell/assets/{infoDiagram-5YYISTIA-DcaoToij.js → infoDiagram-5YYISTIA-Bc4iS8YB.js} +1 -1
  339. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-DzduqhP2.js → ishikawaDiagram-YF4QCWOH-9pH4Dpnd.js} +1 -1
  340. package/web-shell/assets/{journeyDiagram-JHISSGLW-BvviZR_O.js → journeyDiagram-JHISSGLW-C-YMnw2W.js} +1 -1
  341. package/web-shell/assets/{kanban-definition-UN3LZRKU-Efm2JxY3.js → kanban-definition-UN3LZRKU-D-PaAIp-.js} +1 -1
  342. package/web-shell/assets/{linear-DtY3IbOs.js → linear-DpLgI2kt.js} +1 -1
  343. package/web-shell/assets/{mermaid.core-PzpFqoMe.js → mermaid.core-nZbOHGxx.js} +5 -5
  344. package/web-shell/assets/{mindmap-definition-RKZ34NQL-BLlTkHS0.js → mindmap-definition-RKZ34NQL-Dq0xxnET.js} +1 -1
  345. package/web-shell/assets/{pieDiagram-4H26LBE5-D-mKF-jE.js → pieDiagram-4H26LBE5-ctqG2eeF.js} +1 -1
  346. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-DYCzslGm.js → quadrantDiagram-W4KKPZXB-MivToddn.js} +1 -1
  347. package/web-shell/assets/{requirementDiagram-4Y6WPE33-Dfpxlk7R.js → requirementDiagram-4Y6WPE33-DrLLnkpQ.js} +1 -1
  348. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-D5cRaaxh.js → sankeyDiagram-5OEKKPKP-sYdYhdpV.js} +1 -1
  349. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-s04DReiS.js → sequenceDiagram-3UESZ5HK-CuvhxDOs.js} +1 -1
  350. package/web-shell/assets/{stateDiagram-AJRCARHV-01UNFgnb.js → stateDiagram-AJRCARHV-BLZgbV7Q.js} +1 -1
  351. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DR_gXrIC.js +1 -0
  352. package/web-shell/assets/{timeline-definition-PNZ67QCA-DX8_wZBC.js → timeline-definition-PNZ67QCA-lNr2Uz_Q.js} +1 -1
  353. package/web-shell/assets/{vennDiagram-CIIHVFJN-BK0FlBme.js → vennDiagram-CIIHVFJN-CoaexGVO.js} +1 -1
  354. package/web-shell/assets/{wardley-L42UT6IY-DkPc9UlD.js → wardley-L42UT6IY-DG1vhGKA.js} +1 -1
  355. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-DNKkpDAo.js → wardleyDiagram-YWT4CUSO-CqNjF5xC.js} +1 -1
  356. package/web-shell/assets/{xychartDiagram-2RQKCTM6-CiPwg8QG.js → xychartDiagram-2RQKCTM6-BXg1gx3C.js} +1 -1
  357. package/web-shell/index.html +2 -2
  358. package/chunks/agent-headless-HYEHZFH6.js +0 -86
  359. package/chunks/bridge-FHINXZMN.js +0 -103
  360. package/chunks/channel-settings-store-OXYG5S5X.js +0 -101
  361. package/chunks/chunk-I5VM3SKY.js +0 -451
  362. package/chunks/chunk-PDPFQ2FO.js +0 -156
  363. package/chunks/daemon-status-provider-L3J6GKCT.js +0 -102
  364. package/chunks/daemon-trust-policy-4PHPY23S.js +0 -98
  365. package/chunks/exitPlanMode-RWJR2KGB.js +0 -84
  366. package/chunks/handleAutoUpdate-NHFSGYTF.js +0 -93
  367. package/chunks/initializer-Y5DJLT43.js +0 -99
  368. package/chunks/list-YHNQ32CS.js +0 -102
  369. package/chunks/loadedSettingsAdapter-GHUQK7H4.js +0 -96
  370. package/chunks/mcp-EA3KO6FS.js +0 -96
  371. package/chunks/nonInteractiveCli-NNOR56HU.js +0 -162
  372. package/chunks/read-file-KKTXGIZD.js +0 -32
  373. package/chunks/ripGrep-SJVAAYDV.js +0 -84
  374. package/chunks/serve-IH4XR5IL.js +0 -106
  375. package/chunks/spawnChannel-UAQMH6Y6.js +0 -94
  376. package/chunks/theme-manager-ZNDGAHJN.js +0 -88
  377. package/chunks/total-session-admission-66UDSOHO.js +0 -98
  378. package/chunks/workspace-providers-status-K22B3Z6B.js +0 -99
  379. package/chunks/workspace-skills-status-DDYCBVSH.js +0 -99
  380. package/chunks/write-file-TT6MWIKC.js +0 -86
  381. package/web-shell/assets/channel-DPFUV4oi.js +0 -1
  382. package/web-shell/assets/classDiagram-4FO5ZUOK-CLm0hVvw.js +0 -1
  383. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CLm0hVvw.js +0 -1
  384. package/web-shell/assets/index-BjC3yjjL.css +0 -5
  385. package/web-shell/assets/index-QzFq6w7o.js +0 -1775
  386. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DXb5olqv.js +0 -1
@@ -1,11 +1,5 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import {
4
- deriveWebSocketBase,
5
- openQwenAsrRealtimeStream,
6
- openVoiceStream,
7
- openVoiceStreamWithRetry
8
- } from "./chunk-Q3JQ7OSU.js";
9
3
  import {
10
4
  GENERATION_MAX_PROMPT_BYTES,
11
5
  LIVE_SESSION_SOURCE_PREFIX,
@@ -26,7 +20,13 @@ import {
26
20
  shouldSuppressRememberErrorDetails,
27
21
  workspaceMemoryFailureCode,
28
22
  workspaceMemoryFailureDiagnostics
29
- } from "./chunk-6LP743KE.js";
23
+ } from "./chunk-HHZU6ZZM.js";
24
+ import {
25
+ deriveWebSocketBase,
26
+ openQwenAsrRealtimeStream,
27
+ openVoiceStream,
28
+ openVoiceStreamWithRetry
29
+ } from "./chunk-EJOGLSNJ.js";
30
30
  import {
31
31
  SetupGithubError,
32
32
  collectSessionData,
@@ -38,18 +38,17 @@ import {
38
38
  toJson,
39
39
  toJsonl,
40
40
  toMarkdown
41
- } from "./chunk-5MZCSWI4.js";
41
+ } from "./chunk-WZRLXVLJ.js";
42
42
  import {
43
43
  OBSERVED_CONTACT_MAX_FRESH_WITHIN_SECONDS,
44
44
  ObservedChannelContactStore
45
- } from "./chunk-OWMAZHIX.js";
46
- import "./chunk-ZRBMO3C7.js";
45
+ } from "./chunk-TMFWI4RC.js";
47
46
  import {
48
47
  escapeAnsiCtrlCodes
49
48
  } from "./chunk-4NFY2S7N.js";
49
+ import "./chunk-IKFHTAQW.js";
50
50
  import "./chunk-2MIN6GRR.js";
51
51
  import "./chunk-QHTIBUWB.js";
52
- import "./chunk-EKTCKZV5.js";
53
52
  import "./chunk-3Z43GZUQ.js";
54
53
  import {
55
54
  CAPABILITIES_SCHEMA_VERSION,
@@ -107,14 +106,14 @@ import {
107
106
  setRateLimiter,
108
107
  unsafeRevealSecret,
109
108
  validateMcpRuntimeServerName
110
- } from "./chunk-ZZCWJWTF.js";
109
+ } from "./chunk-HG3UBTJ4.js";
111
110
  import "./chunk-VGHZT6JR.js";
112
111
  import {
113
112
  isLoopbackBind,
114
113
  normalizeSessionIdForLookup,
115
114
  parseCallerSuppliedSessionId
116
115
  } from "./chunk-TQOF5KBL.js";
117
- import "./chunk-HGCQ5SE7.js";
116
+ import "./chunk-UXEO7E3V.js";
118
117
  import {
119
118
  EMPTY_WORKSPACE_VOICE_UPDATE_ERROR,
120
119
  MAX_WORKSPACE_SKILL_NAME_LENGTH,
@@ -128,14 +127,14 @@ import {
128
127
  validateWorkspaceSkillName,
129
128
  validateWorkspaceVoiceState,
130
129
  voiceSettingsScopeToWire
131
- } from "./chunk-OCSFNUU4.js";
130
+ } from "./chunk-YMALTWIZ.js";
132
131
  import {
133
132
  PermissionRulesValidationError,
134
133
  buildPermissionSettings,
135
134
  isPermissionRuleType,
136
135
  normalizePermissionRules,
137
136
  readPermissionRuleSet
138
- } from "./chunk-Y3OVRWRY.js";
137
+ } from "./chunk-4N4JVRZA.js";
139
138
  import {
140
139
  assertVoiceBaseUrlNetworkAllowed,
141
140
  isStreamingVoiceModel,
@@ -143,13 +142,13 @@ import {
143
142
  resolveVoiceTranscriptionConfig,
144
143
  sanitizeVoiceErrorMessage,
145
144
  transcribeVoiceAudio
146
- } from "./chunk-LLCWZQCU.js";
145
+ } from "./chunk-BRQR2FJ5.js";
147
146
  import {
148
147
  isVoiceEnabled,
149
148
  isVoiceMode,
150
149
  readVoiceModel
151
- } from "./chunk-EBZ6BJTF.js";
152
- import "./chunk-AOHJKPKL.js";
150
+ } from "./chunk-MNUKNVYQ.js";
151
+ import "./chunk-H7TMVHKE.js";
153
152
  import {
154
153
  createTotalSessionAdmissionController
155
154
  } from "./chunk-X2UOOG5V.js";
@@ -166,26 +165,25 @@ import {
166
165
  } from "./chunk-4JRM2BSM.js";
167
166
  import {
168
167
  assertValidChannelSecretUpdates
169
- } from "./chunk-NRLFZWCT.js";
168
+ } from "./chunk-EQHCHTHC.js";
170
169
  import {
171
170
  createDaemonStatusProvider
172
- } from "./chunk-OONWZLFK.js";
171
+ } from "./chunk-4EB5GRRC.js";
173
172
  import "./chunk-NTTBXH7U.js";
174
- import "./chunk-VSFKIRRW.js";
175
- import "./chunk-3SH53ANB.js";
173
+ import "./chunk-3NBTNFNC.js";
176
174
  import {
177
175
  createWorkspaceProvidersStatusProvider
178
- } from "./chunk-QJMOAMXT.js";
176
+ } from "./chunk-QQSXM3FE.js";
179
177
  import {
180
178
  getAuthTypeFromEnv,
181
179
  resolveCliGenerationConfig
182
- } from "./chunk-2PLNY5TN.js";
180
+ } from "./chunk-BBCGHZ4S.js";
183
181
  import {
184
182
  snapshotProcessEnv
185
- } from "./chunk-P3BJLFSZ.js";
183
+ } from "./chunk-EQR7YDXY.js";
186
184
  import {
187
185
  createWorkspaceSkillsStatusProvider
188
- } from "./chunk-VWKER4ZH.js";
186
+ } from "./chunk-ULJGMSG5.js";
189
187
  import "./chunk-BGXZBI5B.js";
190
188
  import "./chunk-Z4X5MTRT.js";
191
189
  import {
@@ -204,20 +202,20 @@ import {
204
202
  import {
205
203
  evaluateDaemonWorkspaceTrust,
206
204
  readDaemonTrustPolicySnapshot
207
- } from "./chunk-47PEPJO7.js";
205
+ } from "./chunk-P7PSGVWP.js";
208
206
  import {
209
207
  daemonObservedContactsPath,
210
208
  loadChannelsConfig
211
- } from "./chunk-NEOXOWYH.js";
212
- import "./chunk-UMD7WQTR.js";
209
+ } from "./chunk-3QZY3JSR.js";
210
+ import "./chunk-D7VALEOK.js";
213
211
  import "./chunk-57OAHC2Y.js";
214
212
  import {
215
213
  parseChannelWebhookConfigLenient
216
- } from "./chunk-LHEC5V6G.js";
217
- import "./chunk-67EWJE77.js";
214
+ } from "./chunk-BSR5AXZR.js";
215
+ import "./chunk-45NQKMYB.js";
218
216
  import {
219
217
  supportedChannelCatalog
220
- } from "./chunk-E2FPSSKP.js";
218
+ } from "./chunk-OK47XBYH.js";
221
219
  import {
222
220
  LIVE_HOST_BUNDLE_ID,
223
221
  LIVE_HOST_PROTOCOL_VERSION,
@@ -228,21 +226,21 @@ import {
228
226
  SessionArtifactValidationError,
229
227
  createAcpSessionBridge,
230
228
  parseSessionSource
231
- } from "./chunk-F24A2JBM.js";
229
+ } from "./chunk-J6JVP7ZZ.js";
232
230
  import {
233
231
  EVENT_SCHEMA_VERSION,
234
232
  EventBus,
235
233
  SubscriberLimitExceededError
236
- } from "./chunk-MZSJ43WV.js";
237
- import "./chunk-XCGIMOLN.js";
234
+ } from "./chunk-7U5G6JXI.js";
235
+ import "./chunk-WCCLLK7X.js";
238
236
  import "./chunk-OCPBI7J5.js";
239
- import "./chunk-I5VM3SKY.js";
237
+ import "./chunk-DAV4QFD5.js";
240
238
  import {
241
239
  STATUS_SCHEMA_VERSION,
242
240
  SessionRestoreTimeoutError,
243
241
  createIdleWorkspaceMemoryStatus,
244
242
  mapDomainErrorToErrorKind
245
- } from "./chunk-DA4HRSBW.js";
243
+ } from "./chunk-HTYND72J.js";
246
244
  import "./chunk-K6KS3LTN.js";
247
245
  import "./chunk-FC4KQFCS.js";
248
246
  import "./chunk-T3CHYWJZ.js";
@@ -254,11 +252,13 @@ import {
254
252
  WorkspaceRegistrationStoreLimitError,
255
253
  normalizeWorkspaceDisplayName,
256
254
  workspaceRegistrationId
257
- } from "./chunk-QGNOFE5E.js";
255
+ } from "./chunk-KX7PC5QG.js";
258
256
  import {
257
+ CHANNEL_PROMPT_META_KEY,
258
+ DAEMON_PROMPT_DISPLAY_TEXT_META_KEY,
259
259
  REQUESTED_SESSION_ID_META_KEY,
260
260
  gradeActiveWorkCoverage
261
- } from "./chunk-W5UC37EE.js";
261
+ } from "./chunk-FQDCO3CJ.js";
262
262
  import {
263
263
  BranchWhilePromptActiveError,
264
264
  BridgeChannelQuarantinedError,
@@ -299,6 +299,10 @@ import {
299
299
  canonicalizeWorkspaces,
300
300
  translateAndCheckAbsoluteWorkspacePath
301
301
  } from "./chunk-6PLDPT2C.js";
302
+ import {
303
+ CHANNEL_WORKER_PROMPT_AUTHORIZATION_META_KEY,
304
+ isChannelWorkerPromptAuthorized
305
+ } from "./chunk-Z7B6SRPM.js";
302
306
  import {
303
307
  ChannelDeliveryError,
304
308
  MAX_CHANNEL_STARTUP_FAILURES,
@@ -311,7 +315,7 @@ import {
311
315
  } from "./chunk-YP5KH5Y7.js";
312
316
  import {
313
317
  normalizeWorkerDiagnostic
314
- } from "./chunk-PBRVUF5B.js";
318
+ } from "./chunk-A6NRNRKE.js";
315
319
  import {
316
320
  normalizeServeChannelSelection
317
321
  } from "./chunk-ALMR3E6Q.js";
@@ -319,12 +323,12 @@ import "./chunk-HIBNSEJE.js";
319
323
  import {
320
324
  redactLogCredentials
321
325
  } from "./chunk-M5GB774H.js";
322
- import "./chunk-BKHCW2BI.js";
326
+ import "./chunk-3VUENPWF.js";
323
327
  import "./chunk-5HBA2Z7V.js";
324
328
  import {
325
329
  sanitizeLogText
326
- } from "./chunk-DX3RGJMS.js";
327
- import "./chunk-UDXSXLER.js";
330
+ } from "./chunk-AW27A43Y.js";
331
+ import "./chunk-IW6RQPQB.js";
328
332
  import {
329
333
  getDialogSettingKeys,
330
334
  getModelProvidersOwnerScope,
@@ -334,26 +338,26 @@ import {
334
338
  getWritableScopes,
335
339
  loadSettings,
336
340
  validateSettingValue
337
- } from "./chunk-ABVRJU3D.js";
338
- import "./chunk-UBX6NL47.js";
341
+ } from "./chunk-3ER3FWZM.js";
339
342
  import "./chunk-RKUWKYED.js";
343
+ import "./chunk-AGWK35OJ.js";
340
344
  import "./chunk-GOXKNSDZ.js";
341
345
  import "./chunk-IDS7MSUP.js";
342
346
  import {
343
347
  detectSystemLanguage,
344
348
  resolveLanguageSetting
345
- } from "./chunk-UEOKWYGY.js";
349
+ } from "./chunk-YYIOFWVH.js";
346
350
  import {
347
351
  SUPPORTED_LANGUAGES,
348
352
  resolveSupportedLanguage
349
353
  } from "./chunk-5EJZE3FP.js";
350
- import "./chunk-ZJ4W6SUY.js";
351
- import "./chunk-VFMASYQA.js";
352
- import "./chunk-AEL7KN2O.js";
353
- import "./chunk-VJNBRRZG.js";
354
+ import "./chunk-HDRTQ5DH.js";
355
+ import "./chunk-MS7GNABG.js";
356
+ import "./chunk-RN7GFREP.js";
357
+ import "./chunk-WZMH7II3.js";
354
358
  import {
355
359
  getWorkspaceTrustStatus
356
- } from "./chunk-GWVUR3QZ.js";
360
+ } from "./chunk-7WROZ3E6.js";
357
361
  import "./chunk-NPQ5ZKRP.js";
358
362
  import {
359
363
  isWithinRoot as isWithinRoot2
@@ -423,30 +427,28 @@ import {
423
427
  partToString,
424
428
  readAgentMeta,
425
429
  readWorktreeSession,
426
- redactUrlCredentials,
427
430
  resolveBranchName,
428
431
  resolveProviderProtocol,
429
432
  shouldShowStep,
430
- stripAnsiAndControl,
431
433
  stripTerminalControlSequences,
432
434
  watchRepoBranch,
433
435
  writeWorkspaceContextFile,
434
436
  writeWorktreeSession,
435
437
  writeWorktreeSessionMarker
436
- } from "./chunk-EI3NWELG.js";
438
+ } from "./chunk-MSSNVG2G.js";
437
439
  import "./chunk-GOFAQQZA.js";
438
440
  import "./chunk-5M6IDOMF.js";
439
441
  import "./chunk-TWPJO254.js";
440
- import "./chunk-H6XPXXMH.js";
442
+ import "./chunk-CQ35AJ4Z.js";
441
443
  import {
442
444
  MAX_JOBS,
443
445
  nextDurableFireMs
444
- } from "./chunk-2UUMVNYT.js";
445
- import "./chunk-MVUQRLOH.js";
446
- import "./chunk-XCWO3SMQ.js";
447
- import "./chunk-7MH4J33A.js";
446
+ } from "./chunk-QPBFRWCP.js";
447
+ import "./chunk-JRIVMPD2.js";
448
+ import "./chunk-YILJKX2T.js";
449
+ import "./chunk-D2RNVVH6.js";
448
450
  import "./chunk-6PVPNMXU.js";
449
- import "./chunk-TRRF5BSP.js";
451
+ import "./chunk-5C42HXEX.js";
450
452
  import {
451
453
  nextFireTime,
452
454
  parseCron
@@ -459,22 +461,22 @@ import {
459
461
  readCronTasks,
460
462
  taskHasLegacyCondition,
461
463
  updateCronTasks
462
- } from "./chunk-GNPNYXJB.js";
463
- import "./chunk-HUWENAHO.js";
464
+ } from "./chunk-AKBFSOC5.js";
465
+ import "./chunk-DEDESZDL.js";
464
466
  import "./chunk-O6GEWCJA.js";
465
467
  import "./chunk-T26EAKDL.js";
466
468
  import "./chunk-ZPJWUGCS.js";
467
469
  import "./chunk-CPBF7KYF.js";
468
- import "./chunk-J6SZID63.js";
470
+ import "./chunk-5RUCD4ED.js";
469
471
  import "./chunk-KRXPRVGL.js";
470
- import "./chunk-GM463R2B.js";
471
- import "./chunk-SEZ556DZ.js";
472
- import "./chunk-2FRY5CRX.js";
473
- import "./chunk-QUI267ZP.js";
472
+ import "./chunk-YBVVOSOH.js";
473
+ import "./chunk-CPFFU46D.js";
474
+ import "./chunk-ULNWG62W.js";
475
+ import "./chunk-DPTMKFIH.js";
474
476
  import {
475
477
  APPROVAL_MODES
476
- } from "./chunk-WAUGQKUU.js";
477
- import "./chunk-DZUO626D.js";
478
+ } from "./chunk-63FNZTWG.js";
479
+ import "./chunk-3GM5DLBI.js";
478
480
  import {
479
481
  addDaemonRequestAttribute,
480
482
  captureDaemonTelemetryContext,
@@ -486,20 +488,21 @@ import {
486
488
  recordDaemonHttpResponse,
487
489
  runWithDaemonTelemetryContext,
488
490
  withDaemonRequestSpan
489
- } from "./chunk-4TRQPFDP.js";
491
+ } from "./chunk-K34GJQOZ.js";
490
492
  import "./chunk-SAH4BD2J.js";
491
- import "./chunk-CPG6P4GG.js";
493
+ import "./chunk-KLOMACIR.js";
494
+ import "./chunk-VPV7WBVT.js";
492
495
  import "./chunk-S6LOFUVP.js";
493
496
  import "./chunk-2J3OJGTL.js";
494
497
  import {
495
498
  SubagentError,
496
499
  SubagentErrorCode
497
- } from "./chunk-IA7TGCN2.js";
500
+ } from "./chunk-TTRH3RTQ.js";
498
501
  import "./chunk-K623ENWT.js";
499
502
  import {
500
503
  escapeXml
501
504
  } from "./chunk-AQ37AY7B.js";
502
- import "./chunk-EQL65XGA.js";
505
+ import "./chunk-FRHQQC2Z.js";
503
506
  import {
504
507
  QwenOAuth2Client,
505
508
  QwenOAuthPollError,
@@ -508,19 +511,19 @@ import {
508
511
  isDeviceAuthorizationSuccess,
509
512
  isDeviceTokenPending,
510
513
  isDeviceTokenSuccess
511
- } from "./chunk-3P2LV43B.js";
514
+ } from "./chunk-DG4IQ6JG.js";
512
515
  import "./chunk-NAVJD2PQ.js";
513
- import "./chunk-HV76SFIA.js";
514
- import "./chunk-4PYCZH2V.js";
516
+ import "./chunk-KEC5FHLM.js";
517
+ import "./chunk-2ZWH53I4.js";
515
518
  import "./chunk-P3QQPMQA.js";
516
- import "./chunk-SR7RZ4MS.js";
517
- import "./chunk-M6HMMKVG.js";
519
+ import "./chunk-TB4YFWXG.js";
520
+ import "./chunk-D7QGE3RT.js";
518
521
  import "./chunk-KM73TBQ4.js";
519
522
  import "./chunk-MPHPFVKK.js";
520
523
  import "./chunk-AXMWHKXA.js";
521
524
  import "./chunk-GLCZKT5V.js";
522
525
  import "./chunk-DJ2GSRLV.js";
523
- import "./chunk-EI3HZX6C.js";
526
+ import "./chunk-NLFLYSS4.js";
524
527
  import "./chunk-CR3C7WXL.js";
525
528
  import "./chunk-XWRJCPHC.js";
526
529
  import {
@@ -533,30 +536,33 @@ import {
533
536
  isWithinRoot,
534
537
  parseLineTolerant,
535
538
  read
536
- } from "./chunk-YGT2AUJ7.js";
537
- import "./chunk-WOJZWRAZ.js";
539
+ } from "./chunk-4KM2SYK5.js";
540
+ import "./chunk-YRLW2MSX.js";
538
541
  import "./chunk-VGC4I5JJ.js";
539
- import "./chunk-FVKHVJZQ.js";
540
- import "./chunk-COBO5EBO.js";
541
- import "./chunk-6ZRFAKXK.js";
542
- import "./chunk-PYQADEFD.js";
543
- import "./chunk-Y4R47ZUH.js";
542
+ import "./chunk-G6MUFRNI.js";
543
+ import "./chunk-LSRI3ND3.js";
544
+ import "./chunk-PVXEJB66.js";
545
+ import "./chunk-YIGGWOJE.js";
546
+ import "./chunk-YM3I6VW5.js";
544
547
  import "./chunk-F6WFNA7U.js";
545
548
  import "./chunk-46UV252V.js";
546
- import "./chunk-ZBVS26BY.js";
547
- import "./chunk-KKBPOU75.js";
548
- import "./chunk-EUNWC2VS.js";
549
- import "./chunk-FOGU3LJX.js";
550
- import "./chunk-L2AFWWJE.js";
551
- import "./chunk-W4RQUHY3.js";
552
- import "./chunk-PDPFQ2FO.js";
549
+ import "./chunk-FPGTNKCP.js";
550
+ import "./chunk-4AOVQPJU.js";
551
+ import "./chunk-PZW46OTB.js";
552
+ import "./chunk-YBHUXEC6.js";
553
+ import {
554
+ redactUrlCredentials,
555
+ stripAnsiAndControl
556
+ } from "./chunk-N4SVADAV.js";
557
+ import "./chunk-HHJLM3WQ.js";
558
+ import "./chunk-K5IDV3PC.js";
553
559
  import {
554
560
  FatalConfigError,
555
561
  Storage,
556
562
  createDebugLogger,
557
563
  getErrorMessage,
558
564
  runWithoutDebugLogSession
559
- } from "./chunk-OIVKILPI.js";
565
+ } from "./chunk-HOSVOUDK.js";
560
566
  import "./chunk-VOQXFAY5.js";
561
567
  import {
562
568
  writeStderrLine,
@@ -583,7 +589,7 @@ import {
583
589
 
584
590
  // packages/cli/src/serve/server.ts
585
591
  init_esbuild_shims();
586
- var import_express5 = __toESM(require_express(), 1);
592
+ var import_express6 = __toESM(require_express(), 1);
587
593
 
588
594
  // packages/cli/src/serve/acp-http/index.ts
589
595
  init_esbuild_shims();
@@ -1001,6 +1007,7 @@ import * as path2 from "node:path";
1001
1007
  var MAX_READ_BYTES = 256 * 1024;
1002
1008
  var MAX_TEXT_SCAN_BYTES = 8 * 1024 * 1024;
1003
1009
  var MAX_WRITE_BYTES = 5 * 1024 * 1024;
1010
+ var MAX_UPLOAD_BYTES = 50 * 1024 * 1024;
1004
1011
  var BINARY_PROBE_BYTES = 4096;
1005
1012
  function shouldIgnore(absolute, boundWorkspace, ignore, kind = "file") {
1006
1013
  const rel = path2.relative(boundWorkspace, absolute);
@@ -1200,11 +1207,11 @@ function decodeTextCursor(cursor) {
1200
1207
  return { off, size, dev, ino };
1201
1208
  }
1202
1209
  __name(decodeTextCursor, "decodeTextCursor");
1203
- function assertCursorMatchesFile(cursor, stats, path16) {
1210
+ function assertCursorMatchesFile(cursor, stats, path17) {
1204
1211
  if (String(stats.dev) !== cursor.dev || String(stats.ino) !== cursor.ino || stats.size < cursor.size) {
1205
1212
  throw new FsError(
1206
1213
  "hash_mismatch",
1207
- `cursor no longer matches the file it was issued for: ${path16}`,
1214
+ `cursor no longer matches the file it was issued for: ${path17}`,
1208
1215
  { hint: "re-read the file from the beginning to get a fresh cursor" }
1209
1216
  );
1210
1217
  }
@@ -2088,6 +2095,41 @@ var WorkspaceFileSystemImpl = class {
2088
2095
  throw this.recordAndWrap(err, "edit", p);
2089
2096
  }
2090
2097
  }
2098
+ async writeBytesAtomic(p, data) {
2099
+ const start = performance.now();
2100
+ try {
2101
+ this.deps.generationGuard?.assertOpen();
2102
+ assertTrustedForIntent(this.deps.trusted, "write");
2103
+ enforceWriteSize(data.length, MAX_UPLOAD_BYTES);
2104
+ const out = await this.deps.pathLocks.runExclusive(
2105
+ p,
2106
+ async () => {
2107
+ await assertCreateTargetAbsent(p);
2108
+ this.deps.generationGuard?.assertOpen();
2109
+ const result = await atomicPublishResolvedFile({
2110
+ target: p,
2111
+ buf: data,
2112
+ mode: "create",
2113
+ assertGenerationOpen: /* @__PURE__ */ __name(() => this.deps.generationGuard?.assertOpen(), "assertGenerationOpen")
2114
+ });
2115
+ const verdict = this.ignoreVerdict(p, "file");
2116
+ this.deps.audit.recordAccess(this.deps.ctx, {
2117
+ intent: "write",
2118
+ absolute: p,
2119
+ durationMs: performance.now() - start,
2120
+ sizeBytes: result.sizeBytes,
2121
+ matchedIgnore: verdict.ignored ? verdict.category : void 0
2122
+ });
2123
+ return { sizeBytes: result.sizeBytes, hash: result.hash };
2124
+ }
2125
+ );
2126
+ return out;
2127
+ } catch (err) {
2128
+ throw this.recordAndWrap(err, "write", p, {
2129
+ audit: !(isFsError(err) && err.kind === "file_already_exists")
2130
+ });
2131
+ }
2132
+ }
2091
2133
  /**
2092
2134
  * Coerce an arbitrary thrown value into an `FsError`, emit the
2093
2135
  * matching `fs.denied` audit event, and return the typed error
@@ -2101,11 +2143,14 @@ var WorkspaceFileSystemImpl = class {
2101
2143
  * - routes can still rely on `instanceof FsError`
2102
2144
  * for their `sendFsError` serializer.
2103
2145
  */
2104
- recordAndWrap(err, intent, input) {
2146
+ recordAndWrap(err, intent, input, opts) {
2105
2147
  if (err instanceof Error && "code" in err && err.code === "workspace_generation_closed") {
2106
2148
  return err;
2107
2149
  }
2108
2150
  const fs8 = wrapAsFsError(err);
2151
+ if (opts?.audit === false) {
2152
+ return fs8;
2153
+ }
2109
2154
  this.deps.audit.recordDenied(this.deps.ctx, {
2110
2155
  intent,
2111
2156
  input,
@@ -2557,6 +2602,22 @@ function mergeWriteMeta(existing, opts) {
2557
2602
  }
2558
2603
  __name(mergeWriteMeta, "mergeWriteMeta");
2559
2604
  async function atomicWriteTextResolvedFile(input) {
2605
+ const buf = await encodeTextFileContentAsync(
2606
+ input.target,
2607
+ input.content,
2608
+ buildWriteMeta(input.meta)
2609
+ );
2610
+ enforceWriteSize(buf.length);
2611
+ return atomicPublishResolvedFile({
2612
+ target: input.target,
2613
+ buf,
2614
+ mode: input.mode,
2615
+ expectedHash: input.expectedHash,
2616
+ assertGenerationOpen: input.assertGenerationOpen
2617
+ });
2618
+ }
2619
+ __name(atomicWriteTextResolvedFile, "atomicWriteTextResolvedFile");
2620
+ async function atomicPublishResolvedFile(input) {
2560
2621
  const target = input.target;
2561
2622
  const parent = path4.dirname(target);
2562
2623
  const parentStat = await fsp2.lstat(parent);
@@ -2571,24 +2632,29 @@ async function atomicWriteTextResolvedFile(input) {
2571
2632
  `parent path is not a directory: ${parent}`
2572
2633
  );
2573
2634
  }
2574
- const tmpPath = path4.join(
2575
- parent,
2576
- `.${path4.basename(target)}.${process.pid}.${randomBytes(6).toString("hex")}.tmp`
2577
- );
2635
+ const tmpSuffix = `.${process.pid}.${randomBytes(6).toString("hex")}.tmp`;
2636
+ const tmpNameMaxBytes = 255;
2637
+ const tmpBaseMaxBytes = tmpNameMaxBytes - 1 - Buffer.byteLength(tmpSuffix, "utf-8");
2638
+ let tmpBase = path4.basename(target);
2639
+ if (Buffer.byteLength(tmpBase, "utf-8") > tmpBaseMaxBytes) {
2640
+ tmpBase = safeUtf8Truncate(
2641
+ Buffer.from(tmpBase, "utf-8"),
2642
+ tmpBaseMaxBytes
2643
+ ).toString("utf-8");
2644
+ }
2645
+ const tmpPath = path4.join(parent, `.${tmpBase}${tmpSuffix}`);
2578
2646
  let tempLive = false;
2579
2647
  let tempHandle;
2580
2648
  let tempStat;
2581
2649
  try {
2582
2650
  tempHandle = await reserveTempFile(tmpPath);
2583
2651
  tempLive = true;
2584
- const encoded = await writeEncodedTextTemp({
2585
- targetPath: target,
2652
+ const written = await writeBufferToTemp({
2586
2653
  tmpPath,
2587
- content: input.content,
2588
- meta: input.meta,
2654
+ buf: input.buf,
2589
2655
  handle: tempHandle
2590
2656
  });
2591
- tempStat = encoded.stat;
2657
+ tempStat = written.stat;
2592
2658
  const targetState = await assertAtomicTargetPrecondition({
2593
2659
  target,
2594
2660
  mode: input.mode,
@@ -2607,7 +2673,7 @@ async function atomicWriteTextResolvedFile(input) {
2607
2673
  }
2608
2674
  tempLive = false;
2609
2675
  await fsyncParentDirBestEffort(parent);
2610
- return encoded;
2676
+ return written;
2611
2677
  } catch (err) {
2612
2678
  await tempHandle?.close().catch(() => void 0);
2613
2679
  if (tempLive) {
@@ -2619,19 +2685,13 @@ async function atomicWriteTextResolvedFile(input) {
2619
2685
  throw err;
2620
2686
  }
2621
2687
  }
2622
- __name(atomicWriteTextResolvedFile, "atomicWriteTextResolvedFile");
2688
+ __name(atomicPublishResolvedFile, "atomicPublishResolvedFile");
2623
2689
  async function reserveTempFile(tmpPath) {
2624
2690
  return fsp2.open(tmpPath, "wx", 384);
2625
2691
  }
2626
2692
  __name(reserveTempFile, "reserveTempFile");
2627
- async function writeEncodedTextTemp(input) {
2628
- const buf = await encodeTextFileContentAsync(
2629
- input.targetPath,
2630
- input.content,
2631
- buildWriteMeta(input.meta)
2632
- );
2633
- enforceWriteSize(buf.length);
2634
- await input.handle.writeFile(buf);
2693
+ async function writeBufferToTemp(input) {
2694
+ await input.handle.writeFile(input.buf);
2635
2695
  await syncHandleBestEffort(input.handle);
2636
2696
  const st = await fsp2.lstat(input.tmpPath);
2637
2697
  const opened = await input.handle.stat();
@@ -2649,9 +2709,9 @@ async function writeEncodedTextTemp(input) {
2649
2709
  `temporary path is not a regular file: ${input.tmpPath}`
2650
2710
  );
2651
2711
  }
2652
- return { sizeBytes: buf.length, hash: hashBuffer(buf), stat: st };
2712
+ return { sizeBytes: input.buf.length, hash: hashBuffer(input.buf), stat: st };
2653
2713
  }
2654
- __name(writeEncodedTextTemp, "writeEncodedTextTemp");
2714
+ __name(writeBufferToTemp, "writeBufferToTemp");
2655
2715
  async function assertCreateTargetAbsent(target) {
2656
2716
  try {
2657
2717
  const st = await fsp2.lstat(target);
@@ -9839,20 +9899,31 @@ var AcpDispatcher = class {
9839
9899
  if ("error" in parsedSource) {
9840
9900
  throw new AcpParamError(parsedSource.error);
9841
9901
  }
9842
- const result = await listWorkspaceSessionsForResponse(
9843
- this.bridge,
9844
- workspaceCwd,
9845
- {
9846
- cursor,
9847
- size: metaSize,
9848
- archiveState,
9849
- view,
9850
- group,
9851
- parentSessionId,
9852
- ...parsedSource
9853
- },
9854
- { runtimeBaseDir: this.sessionRuntimeBaseDir }
9855
- );
9902
+ let result;
9903
+ try {
9904
+ conn.abortSignal.throwIfAborted();
9905
+ result = await listWorkspaceSessionsForResponse(
9906
+ this.bridge,
9907
+ workspaceCwd,
9908
+ {
9909
+ cursor,
9910
+ size: metaSize,
9911
+ archiveState,
9912
+ view,
9913
+ group,
9914
+ parentSessionId,
9915
+ ...parsedSource
9916
+ },
9917
+ {
9918
+ runtimeBaseDir: this.sessionRuntimeBaseDir,
9919
+ signal: conn.abortSignal
9920
+ }
9921
+ );
9922
+ conn.abortSignal.throwIfAborted();
9923
+ } catch (error2) {
9924
+ if (conn.abortSignal.aborted) return;
9925
+ throw error2;
9926
+ }
9856
9927
  this.replyConn(conn, id, {
9857
9928
  sessions: result.sessions.map((s) => ({
9858
9929
  sessionId: s.sessionId,
@@ -14570,7 +14641,7 @@ function mountAcpHttp(app, bridge, opts) {
14570
14641
  const archiveCoordinator = opts.archiveCoordinator ?? new SessionArchiveCoordinator();
14571
14642
  const requestedSessionIdAdmission = opts.requestedSessionIdAdmission;
14572
14643
  const getPrimaryEnv = /* @__PURE__ */ __name(() => opts.workspaceRegistry ? runtimeEffectiveEnv(opts.workspaceRegistry.primary, daemonEnv) : daemonEnv, "getPrimaryEnv");
14573
- const path16 = opts.path ?? "/acp";
14644
+ const path17 = opts.path ?? "/acp";
14574
14645
  const dispatcherRef = {};
14575
14646
  let disposed = false;
14576
14647
  const rejectIfDisposed = /* @__PURE__ */ __name((res) => {
@@ -14754,7 +14825,7 @@ function mountAcpHttp(app, bridge, opts) {
14754
14825
  const primaryMount = {
14755
14826
  primary: true,
14756
14827
  workspaceCwd: opts.boundWorkspace,
14757
- routeLabel: logSafe(path16),
14828
+ routeLabel: logSafe(path17),
14758
14829
  rateLimitScope: opts.workspaceRegistry?.primary.workspaceId ?? "primary",
14759
14830
  registry,
14760
14831
  dispatcher,
@@ -14908,7 +14979,7 @@ function mountAcpHttp(app, bridge, opts) {
14908
14979
  });
14909
14980
  }, "handleAcpPost");
14910
14981
  app.post(
14911
- path16,
14982
+ path17,
14912
14983
  (req, res) => handleAcpPost(primaryMount, req, res)
14913
14984
  );
14914
14985
  const handleAcpGet = /* @__PURE__ */ __name((mount, req, res) => {
@@ -15007,10 +15078,10 @@ function mountAcpHttp(app, bridge, opts) {
15007
15078
  onPumpSettled();
15008
15079
  });
15009
15080
  }, "handleAcpGet");
15010
- app.get(path16, (req, res) => {
15081
+ app.get(path17, (req, res) => {
15011
15082
  handleAcpGet(primaryMount, req, res);
15012
15083
  });
15013
- app.delete(path16, (req, res) => {
15084
+ app.delete(path17, (req, res) => {
15014
15085
  handleAcpDelete(primaryMount, req, res);
15015
15086
  });
15016
15087
  const createSecondaryAcpMount = /* @__PURE__ */ __name((rt) => {
@@ -15219,7 +15290,7 @@ function mountAcpHttp(app, bridge, opts) {
15219
15290
  const isPluralAcpShape = pluralRawSelector !== null;
15220
15291
  const pluralVoiceRawSelector = opts.workspaceVoiceConnection ? pluralWorkspaceRawSelector(rawPath, PLURAL_VOICE_WS_SUFFIX) : null;
15221
15292
  const isPluralVoiceShape = pluralVoiceRawSelector !== null;
15222
- if (rawPath !== path16 && !isCdpPath && !extraRoute && !isPluralAcpShape && !isPluralVoiceShape) {
15293
+ if (rawPath !== path17 && !isCdpPath && !extraRoute && !isPluralAcpShape && !isPluralVoiceShape) {
15223
15294
  logReject(`unknown-path ${logSafe(rawPath)}`);
15224
15295
  socket.destroy();
15225
15296
  return;
@@ -15757,7 +15828,7 @@ function mountAcpHttp(app, bridge, opts) {
15757
15828
  });
15758
15829
  }, "upgradeListener");
15759
15830
  httpServer.on("upgrade", upgradeListener);
15760
- writeStderrLine(`qwen serve: /acp WebSocket transport enabled on ${path16}`);
15831
+ writeStderrLine(`qwen serve: /acp WebSocket transport enabled on ${path17}`);
15761
15832
  }
15762
15833
  __name(setupWebSocket, "setupWebSocket");
15763
15834
  return {
@@ -19657,6 +19728,8 @@ __name(registerWorkspaceExtensionRoutes, "registerWorkspaceExtensionRoutes");
19657
19728
 
19658
19729
  // packages/cli/src/serve/routes/workspace-file-write.ts
19659
19730
  init_esbuild_shims();
19731
+ var import_express3 = __toESM(require_express(), 1);
19732
+ import * as path10 from "node:path";
19660
19733
  function getFsFactory3(req, res) {
19661
19734
  const context = getWorkspaceRouteContext(req);
19662
19735
  if (context) return context.runtime.routeFileSystemFactory;
@@ -19934,6 +20007,351 @@ function registerWorkspaceQualifiedFileWriteRoutes(app, deps) {
19934
20007
  );
19935
20008
  }
19936
20009
  __name(registerWorkspaceQualifiedFileWriteRoutes, "registerWorkspaceQualifiedFileWriteRoutes");
20010
+ var MAX_CONCURRENT_UPLOADS = 4;
20011
+ var MAX_UPLOAD_FILENAME_BYTES = 255;
20012
+ var NUMBERED_CANDIDATE_CAP = 1e3;
20013
+ var uploadGateLeases = /* @__PURE__ */ new WeakMap();
20014
+ function createUploadConcurrencyGate(max = MAX_CONCURRENT_UPLOADS) {
20015
+ let active = 0;
20016
+ return {
20017
+ tryAcquire() {
20018
+ if (active >= max) return false;
20019
+ active += 1;
20020
+ return true;
20021
+ },
20022
+ release() {
20023
+ if (active > 0) active -= 1;
20024
+ }
20025
+ };
20026
+ }
20027
+ __name(createUploadConcurrencyGate, "createUploadConcurrencyGate");
20028
+ var uploadAdmissions = /* @__PURE__ */ new WeakMap();
20029
+ function splitStemExtension(basename7) {
20030
+ const lastDot = basename7.lastIndexOf(".");
20031
+ if (lastDot <= 0) return { stem: basename7, ext: "" };
20032
+ return { stem: basename7.slice(0, lastDot), ext: basename7.slice(lastDot) };
20033
+ }
20034
+ __name(splitStemExtension, "splitStemExtension");
20035
+ function fitFilenameToByteCap(stem, suffix, ext, capBytes) {
20036
+ if (Buffer.byteLength(suffix + ext, "utf-8") > capBytes) return null;
20037
+ let chars = Array.from(stem);
20038
+ while (Buffer.byteLength(chars.join("") + suffix + ext, "utf-8") > capBytes) {
20039
+ if (chars.length === 0) return null;
20040
+ chars = chars.slice(0, -1);
20041
+ }
20042
+ return chars.join("") + suffix + ext;
20043
+ }
20044
+ __name(fitFilenameToByteCap, "fitFilenameToByteCap");
20045
+ function sendUploadTooLarge(res) {
20046
+ applyReadHeaders(res);
20047
+ res.status(413).json({
20048
+ errorKind: "file_too_large",
20049
+ error: `Request body too large (max ${MAX_UPLOAD_BYTES / (1024 * 1024)} MiB)`,
20050
+ status: 413,
20051
+ maxBytes: MAX_UPLOAD_BYTES
20052
+ });
20053
+ }
20054
+ __name(sendUploadTooLarge, "sendUploadTooLarge");
20055
+ function fileUploadConcurrencyGate(gate) {
20056
+ return (req, res, next) => {
20057
+ if (!gate.tryAcquire()) {
20058
+ applyReadHeaders(res);
20059
+ res.status(429).set("Retry-After", "1").json({
20060
+ errorKind: "upload_busy",
20061
+ error: "Too many uploads in progress",
20062
+ status: 429,
20063
+ retryAfterSeconds: 1
20064
+ });
20065
+ return;
20066
+ }
20067
+ let released = false;
20068
+ const release = /* @__PURE__ */ __name(() => {
20069
+ if (released) return;
20070
+ released = true;
20071
+ gate.release();
20072
+ res.off("finish", releaseBeforeHandler);
20073
+ res.off("close", releaseBeforeHandler);
20074
+ uploadGateLeases.delete(req);
20075
+ }, "release");
20076
+ const releaseBeforeHandler = /* @__PURE__ */ __name(() => {
20077
+ if (!lease.handlerStarted) release();
20078
+ }, "releaseBeforeHandler");
20079
+ const lease = { handlerStarted: false, release };
20080
+ uploadGateLeases.set(req, lease);
20081
+ res.once("finish", releaseBeforeHandler);
20082
+ res.once("close", releaseBeforeHandler);
20083
+ next();
20084
+ };
20085
+ }
20086
+ __name(fileUploadConcurrencyGate, "fileUploadConcurrencyGate");
20087
+ function fileUploadBodyParser() {
20088
+ const raw = import_express3.default.raw({
20089
+ type: "application/octet-stream",
20090
+ limit: MAX_UPLOAD_BYTES,
20091
+ // The endpoint contract is raw octets: decoding a Content-Encoding would
20092
+ // publish bytes the client never sent (and hash/size of the decoded form).
20093
+ inflate: false
20094
+ });
20095
+ return (req, res, next) => {
20096
+ raw(req, res, (err) => {
20097
+ if (err) {
20098
+ const status = err.status;
20099
+ if (status === 413) {
20100
+ sendUploadTooLarge(res);
20101
+ return;
20102
+ }
20103
+ if (status === 415) {
20104
+ applyReadHeaders(res);
20105
+ res.status(415).json({
20106
+ errorKind: "unsupported_media_type",
20107
+ error: "File uploads do not support encoded request bodies",
20108
+ status: 415
20109
+ });
20110
+ return;
20111
+ }
20112
+ if (err.code === "ECONNABORTED" || req.aborted) {
20113
+ return;
20114
+ }
20115
+ next(err);
20116
+ return;
20117
+ }
20118
+ next();
20119
+ });
20120
+ };
20121
+ }
20122
+ __name(fileUploadBodyParser, "fileUploadBodyParser");
20123
+ function fileUploadAdmission(deps, opts) {
20124
+ return (req, res, next) => {
20125
+ void (async () => {
20126
+ const ROUTE2 = opts.qualified ? "POST /workspaces/:workspace/file/upload" : "POST /file/upload";
20127
+ try {
20128
+ if (opts.qualified) {
20129
+ const registry = deps.workspaceRegistry;
20130
+ if (!registry) {
20131
+ throw new Error("workspace registry is not configured");
20132
+ }
20133
+ const runtime = resolveWorkspaceRuntimeFromParam(registry, req, res);
20134
+ if (!runtime) return;
20135
+ if (!requireTrustedWorkspaceRuntime(runtime, res)) return;
20136
+ setWorkspaceRouteContext(req, {
20137
+ runtime,
20138
+ routePrefix: "POST /workspaces/:workspace"
20139
+ });
20140
+ } else if (opts.isWorkspaceTrusted?.() === false) {
20141
+ applyReadHeaders(res);
20142
+ res.status(403).json({
20143
+ errorKind: "untrusted_workspace",
20144
+ error: "workspace is not trusted; write operations are forbidden",
20145
+ status: 403
20146
+ });
20147
+ return;
20148
+ }
20149
+ const contentType = (req.headers["content-type"] ?? "").split(";")[0].trim().toLowerCase();
20150
+ if (contentType !== "application/octet-stream") {
20151
+ applyReadHeaders(res);
20152
+ res.status(415).json({
20153
+ errorKind: "unsupported_media_type",
20154
+ error: "File uploads require application/octet-stream",
20155
+ status: 415
20156
+ });
20157
+ return;
20158
+ }
20159
+ const queryPath = req.query["path"];
20160
+ if (typeof queryPath !== "string" || queryPath.length === 0) {
20161
+ sendParseError(res, ROUTE2, "`path` query parameter is required");
20162
+ return;
20163
+ }
20164
+ const dir = path10.dirname(queryPath);
20165
+ const basename7 = path10.basename(queryPath);
20166
+ if (queryPath.endsWith("/") || basename7.length === 0 || basename7 === "." || basename7 === "..") {
20167
+ sendParseError(res, ROUTE2, "`path` must name a file");
20168
+ return;
20169
+ }
20170
+ if (queryPath.includes("\0")) {
20171
+ sendParseError(res, ROUTE2, "path must not contain null bytes");
20172
+ return;
20173
+ }
20174
+ if (hasSuspiciousPathPattern(basename7)) {
20175
+ sendParseError(res, ROUTE2, "filename contains a suspicious pattern");
20176
+ return;
20177
+ }
20178
+ if (Buffer.byteLength(basename7, "utf-8") > MAX_UPLOAD_FILENAME_BYTES) {
20179
+ sendParseError(
20180
+ res,
20181
+ ROUTE2,
20182
+ `filename exceeds ${MAX_UPLOAD_FILENAME_BYTES} bytes`
20183
+ );
20184
+ return;
20185
+ }
20186
+ const contentLength = req.headers["content-length"];
20187
+ if (contentLength !== void 0) {
20188
+ const declared = Number(contentLength);
20189
+ if (Number.isFinite(declared) && declared > MAX_UPLOAD_BYTES) {
20190
+ sendUploadTooLarge(res);
20191
+ return;
20192
+ }
20193
+ }
20194
+ const clientId = deps.parseClientId(req, res);
20195
+ if (clientId === null) return;
20196
+ const originatorClientId = resolveOriginatorClientId2(
20197
+ clientId,
20198
+ deps,
20199
+ res,
20200
+ req
20201
+ );
20202
+ if (originatorClientId === null) return;
20203
+ const factory = getFsFactory3(req, res);
20204
+ if (!factory) return;
20205
+ const fs8 = factory.forRequest({
20206
+ originatorClientId,
20207
+ route: ROUTE2
20208
+ });
20209
+ const resolvedDir = await fs8.resolve(dir, "write");
20210
+ let dirStat;
20211
+ try {
20212
+ dirStat = await fs8.stat(resolvedDir);
20213
+ } catch (err) {
20214
+ if (isFsError(err) && err.kind === "path_not_found") {
20215
+ sendParseError(res, ROUTE2, "parent directory does not exist");
20216
+ return;
20217
+ }
20218
+ throw err;
20219
+ }
20220
+ if (dirStat.kind !== "directory") {
20221
+ sendParseError(res, ROUTE2, "parent path is not a directory");
20222
+ return;
20223
+ }
20224
+ uploadAdmissions.set(req, {
20225
+ route: ROUTE2,
20226
+ fs: fs8,
20227
+ basename: basename7,
20228
+ resolvedDir,
20229
+ queryDir: dir
20230
+ });
20231
+ next();
20232
+ } catch (err) {
20233
+ sendFsError(
20234
+ res,
20235
+ err,
20236
+ opts.qualified ? "POST /workspaces/:workspace/file/upload" : "POST /file/upload"
20237
+ );
20238
+ }
20239
+ })();
20240
+ };
20241
+ }
20242
+ __name(fileUploadAdmission, "fileUploadAdmission");
20243
+ async function handlePostFileUpload(req, res) {
20244
+ const admission = uploadAdmissions.get(req);
20245
+ if (!admission) {
20246
+ applyReadHeaders(res);
20247
+ res.status(500).json({
20248
+ errorKind: "internal_error",
20249
+ error: "upload admission context is missing",
20250
+ status: 500
20251
+ });
20252
+ return;
20253
+ }
20254
+ const { route, fs: fs8, basename: basename7, resolvedDir, queryDir } = admission;
20255
+ const { stem, ext } = splitStemExtension(basename7);
20256
+ const lease = uploadGateLeases.get(req);
20257
+ if (lease) lease.handlerStarted = true;
20258
+ try {
20259
+ if (req.aborted || res.closed) return;
20260
+ const body = req.body;
20261
+ const data = body === void 0 || body === null ? Buffer.alloc(0) : body;
20262
+ for (let n = 0; n < NUMBERED_CANDIDATE_CAP; n++) {
20263
+ const candidateBasename = n === 0 ? basename7 : fitFilenameToByteCap(
20264
+ stem,
20265
+ ` (${n})`,
20266
+ ext,
20267
+ MAX_UPLOAD_FILENAME_BYTES
20268
+ );
20269
+ if (candidateBasename === null) {
20270
+ sendParseError(
20271
+ res,
20272
+ route,
20273
+ `filename cannot fit within ${MAX_UPLOAD_FILENAME_BYTES} bytes`
20274
+ );
20275
+ return;
20276
+ }
20277
+ const candidateAbs = path10.join(resolvedDir, candidateBasename);
20278
+ let resolved;
20279
+ try {
20280
+ resolved = await fs8.resolve(
20281
+ path10.join(queryDir, candidateBasename),
20282
+ "write"
20283
+ );
20284
+ } catch (err) {
20285
+ if (isFsError(err) && err.kind === "symlink_escape" && err.cause?.code === "ELOOP") {
20286
+ continue;
20287
+ }
20288
+ sendFsError(res, err, route);
20289
+ return;
20290
+ }
20291
+ if (resolved !== candidateAbs) {
20292
+ continue;
20293
+ }
20294
+ try {
20295
+ const out = await fs8.writeBytesAtomic(resolved, data);
20296
+ applyReadHeaders(res);
20297
+ res.status(201).json({
20298
+ kind: "file_upload",
20299
+ path: workspaceRelative(req, resolved),
20300
+ sizeBytes: out.sizeBytes,
20301
+ hash: out.hash
20302
+ });
20303
+ return;
20304
+ } catch (err) {
20305
+ if (isFsError(err) && err.kind === "file_already_exists") {
20306
+ continue;
20307
+ }
20308
+ sendFsError(res, err, route);
20309
+ return;
20310
+ }
20311
+ }
20312
+ applyReadHeaders(res);
20313
+ res.status(409).json({
20314
+ errorKind: "file_already_exists",
20315
+ error: `could not allocate a free filename for "${basename7}"`,
20316
+ status: 409
20317
+ });
20318
+ } catch (err) {
20319
+ sendFsError(res, err, route);
20320
+ } finally {
20321
+ uploadAdmissions.delete(req);
20322
+ lease?.release();
20323
+ }
20324
+ }
20325
+ __name(handlePostFileUpload, "handlePostFileUpload");
20326
+ function registerWorkspaceFileUploadRoutes(app, deps) {
20327
+ app.post(
20328
+ "/file/upload",
20329
+ deps.mutate({ strict: true }),
20330
+ fileUploadAdmission(deps, {
20331
+ qualified: false,
20332
+ isWorkspaceTrusted: deps.isWorkspaceTrusted
20333
+ }),
20334
+ fileUploadConcurrencyGate(deps.uploadGate),
20335
+ fileUploadBodyParser(),
20336
+ (req, res) => {
20337
+ void handlePostFileUpload(req, res);
20338
+ }
20339
+ );
20340
+ }
20341
+ __name(registerWorkspaceFileUploadRoutes, "registerWorkspaceFileUploadRoutes");
20342
+ function registerWorkspaceQualifiedFileUploadRoutes(app, deps) {
20343
+ app.post(
20344
+ "/workspaces/:workspace/file/upload",
20345
+ deps.mutate({ strict: true }),
20346
+ fileUploadAdmission(deps, { qualified: true }),
20347
+ fileUploadConcurrencyGate(deps.uploadGate),
20348
+ fileUploadBodyParser(),
20349
+ (req, res) => {
20350
+ void handlePostFileUpload(req, res);
20351
+ }
20352
+ );
20353
+ }
20354
+ __name(registerWorkspaceQualifiedFileUploadRoutes, "registerWorkspaceQualifiedFileUploadRoutes");
19937
20355
 
19938
20356
  // packages/cli/src/serve/routes/workspace-trust.ts
19939
20357
  init_esbuild_shims();
@@ -20288,15 +20706,15 @@ var legacySessionTelemetryRoutes = [
20288
20706
  },
20289
20707
  {
20290
20708
  method: "GET",
20291
- path: "/session/:id/subagents/:toolCallId",
20709
+ path: "/session/:id/subagents/:subagentRef",
20292
20710
  attribution: "handler_resolved",
20293
- route: "GET /session/:id/subagents/:toolCallId"
20711
+ route: "GET /session/:id/subagents/:subagentRef"
20294
20712
  },
20295
20713
  {
20296
20714
  method: "POST",
20297
- path: "/session/:id/subagents/:toolCallId/cancel",
20715
+ path: "/session/:id/subagents/:subagentRef/cancel",
20298
20716
  attribution: "handler_resolved",
20299
- route: "POST /session/:id/subagents/:toolCallId/cancel"
20717
+ route: "POST /session/:id/subagents/:subagentRef/cancel"
20300
20718
  },
20301
20719
  {
20302
20720
  method: "GET",
@@ -20418,6 +20836,12 @@ var legacySessionTelemetryRoutes = [
20418
20836
  attribution: "handler_resolved",
20419
20837
  route: "POST /session/:id/model"
20420
20838
  },
20839
+ {
20840
+ method: "POST",
20841
+ path: "/session/:id/config-option",
20842
+ attribution: "handler_resolved",
20843
+ route: "POST /session/:id/config-option"
20844
+ },
20421
20845
  {
20422
20846
  method: "POST",
20423
20847
  path: "/session/:id/recap",
@@ -20525,8 +20949,8 @@ function decodePathSegment(value) {
20525
20949
  }
20526
20950
  __name(decodePathSegment, "decodePathSegment");
20527
20951
  function matchLegacySessionTelemetryRoute(method, requestPath) {
20528
- const path16 = requestPath.length > 1 && requestPath.endsWith("/") ? requestPath.slice(0, -1) : requestPath;
20529
- const requestSegments = path16.split("/").slice(1);
20952
+ const path17 = requestPath.length > 1 && requestPath.endsWith("/") ? requestPath.slice(0, -1) : requestPath;
20953
+ const requestSegments = path17.split("/").slice(1);
20530
20954
  const prefix = requestSegments[0]?.toLowerCase();
20531
20955
  if (prefix !== "session" && prefix !== "sessions" && prefix !== "permission") {
20532
20956
  return void 0;
@@ -20578,23 +21002,23 @@ __name(setDaemonTelemetryWorkspace, "setDaemonTelemetryWorkspace");
20578
21002
  function resolveDaemonTelemetryRoute(req) {
20579
21003
  const legacyRoute = matchLegacySessionTelemetryRoute(req.method, req.path);
20580
21004
  if (legacyRoute) return legacyRoute;
20581
- const path16 = req.path.replace(/\/$/, "") || "/";
20582
- if (req.method === "GET" && path16 === "/daemon/status") {
21005
+ const path17 = req.path.replace(/\/$/, "") || "/";
21006
+ if (req.method === "GET" && path17 === "/daemon/status") {
20583
21007
  return { route: "GET /daemon/status" };
20584
21008
  }
20585
- if (req.method === "GET" && /^\/workspace\/[^/]+\/sessions$/.test(path16)) {
21009
+ if (req.method === "GET" && /^\/workspace\/[^/]+\/sessions$/.test(path17)) {
20586
21010
  return { route: "GET /workspace/:id/sessions" };
20587
21011
  }
20588
- if (req.method === "GET" && /^\/workspaces\/[^/]+\/sessions$/.test(path16)) {
21012
+ if (req.method === "GET" && /^\/workspaces\/[^/]+\/sessions$/.test(path17)) {
20589
21013
  return { route: "GET /workspace/:id/sessions" };
20590
21014
  }
20591
- if (req.method === "GET" && /^\/workspace\/[^/]+\/session-info$/.test(path16)) {
21015
+ if (req.method === "GET" && /^\/workspace\/[^/]+\/session-info$/.test(path17)) {
20592
21016
  return { route: "GET /workspace/:id/session-info" };
20593
21017
  }
20594
- if (req.method === "GET" && /^\/workspaces\/[^/]+\/session-info$/.test(path16)) {
21018
+ if (req.method === "GET" && /^\/workspaces\/[^/]+\/session-info$/.test(path17)) {
20595
21019
  return { route: "GET /workspace/:id/session-info" };
20596
21020
  }
20597
- const workspaceTranscript = path16.match(
21021
+ const workspaceTranscript = path17.match(
20598
21022
  /^\/workspaces\/[^/]+\/session\/([^/]+)\/transcript$/
20599
21023
  );
20600
21024
  if (workspaceTranscript?.[1] && req.method === "GET") {
@@ -20603,7 +21027,7 @@ function resolveDaemonTelemetryRoute(req) {
20603
21027
  sessionId: decodePathSegment(workspaceTranscript[1])
20604
21028
  };
20605
21029
  }
20606
- const workspaceExport = path16.match(
21030
+ const workspaceExport = path17.match(
20607
21031
  /^\/workspaces\/[^/]+\/session\/([^/]+)\/export$/
20608
21032
  );
20609
21033
  if (workspaceExport?.[1] && req.method === "GET") {
@@ -20612,7 +21036,7 @@ function resolveDaemonTelemetryRoute(req) {
20612
21036
  sessionId: decodePathSegment(workspaceExport[1])
20613
21037
  };
20614
21038
  }
20615
- const workspaceArchivedExport = path16.match(
21039
+ const workspaceArchivedExport = path17.match(
20616
21040
  /^\/workspaces\/[^/]+\/session\/([^/]+)\/archive\/export$/
20617
21041
  );
20618
21042
  if (workspaceArchivedExport?.[1] && req.method === "GET") {
@@ -20622,8 +21046,8 @@ function resolveDaemonTelemetryRoute(req) {
20622
21046
  };
20623
21047
  }
20624
21048
  const pluralWorkspacePrefix = /^\/workspaces\/[^/]+/;
20625
- if (pluralWorkspacePrefix.test(path16)) {
20626
- const suffix = path16.replace(pluralWorkspacePrefix, "/workspace");
21049
+ if (pluralWorkspacePrefix.test(path17)) {
21050
+ const suffix = path17.replace(pluralWorkspacePrefix, "/workspace");
20627
21051
  if (req.method === "GET") {
20628
21052
  if (suffix === "/workspace/mcp" || suffix === "/workspace/skills" || suffix === "/workspace/tools" || suffix === "/workspace/providers" || suffix === "/workspace/env" || suffix === "/workspace/preflight" || suffix === "/workspace/hooks" || suffix === "/workspace/settings" || suffix === "/workspace/voice" || suffix === "/workspace/permissions" || suffix === "/workspace/trust" || suffix === "/workspace/memory" || suffix === "/workspace/agents") {
20629
21053
  return { route: `GET ${suffix}` };
@@ -20646,7 +21070,7 @@ function resolveDaemonTelemetryRoute(req) {
20646
21070
  }
20647
21071
  }
20648
21072
  if (req.method === "POST") {
20649
- if (suffix === "/workspace/settings" || suffix === "/workspace/voice" || suffix === "/workspace/voice/transcribe" || suffix === "/workspace/permissions" || suffix === "/workspace/trust/request" || suffix === "/workspace/init" || suffix === "/workspace/reload" || suffix === "/workspace/file/write" || suffix === "/workspace/file/edit" || suffix === "/workspace/mcp/servers" || suffix === "/workspace/memory" || suffix === "/workspace/agents" || suffix === "/workspace/sessions/delete" || suffix === "/workspace/sessions/archive" || suffix === "/workspace/sessions/unarchive" || suffix === "/workspace/session-groups") {
21073
+ if (suffix === "/workspace/settings" || suffix === "/workspace/voice" || suffix === "/workspace/voice/transcribe" || suffix === "/workspace/permissions" || suffix === "/workspace/trust/request" || suffix === "/workspace/init" || suffix === "/workspace/reload" || suffix === "/workspace/file/write" || suffix === "/workspace/file/edit" || suffix === "/workspace/file/upload" || suffix === "/workspace/mcp/servers" || suffix === "/workspace/memory" || suffix === "/workspace/agents" || suffix === "/workspace/sessions/delete" || suffix === "/workspace/sessions/archive" || suffix === "/workspace/sessions/unarchive" || suffix === "/workspace/session-groups") {
20650
21074
  return { route: `POST ${suffix}` };
20651
21075
  }
20652
21076
  if (/^\/workspace\/tools\/[^/]+\/enable$/.test(suffix)) {
@@ -20682,58 +21106,58 @@ function resolveDaemonTelemetryRoute(req) {
20682
21106
  return { route: "DELETE /workspace/session-groups/:groupId" };
20683
21107
  }
20684
21108
  }
20685
- if (req.method === "POST" && path16 === "/workspace/init") {
21109
+ if (req.method === "POST" && path17 === "/workspace/init") {
20686
21110
  return { route: "POST /workspace/init" };
20687
21111
  }
20688
- if (req.method === "POST" && path16 === "/workspace/setup-github") {
21112
+ if (req.method === "POST" && path17 === "/workspace/setup-github") {
20689
21113
  return { route: "POST /workspace/setup-github" };
20690
21114
  }
20691
- if (req.method === "POST" && path16 === "/workspace/reload") {
21115
+ if (req.method === "POST" && path17 === "/workspace/reload") {
20692
21116
  return { route: "POST /workspace/reload" };
20693
21117
  }
20694
- const mcpRestart = path16.match(/^\/workspace\/mcp\/([^/]+)\/restart$/);
21118
+ const mcpRestart = path17.match(/^\/workspace\/mcp\/([^/]+)\/restart$/);
20695
21119
  if (mcpRestart?.[1] && req.method === "POST") {
20696
21120
  return { route: "POST /workspace/mcp/:server/restart" };
20697
21121
  }
20698
- if (req.method === "POST" && path16 === "/workspace/mcp/servers") {
21122
+ if (req.method === "POST" && path17 === "/workspace/mcp/servers") {
20699
21123
  return { route: "POST /workspace/mcp/servers" };
20700
21124
  }
20701
- const mcpDelete = path16.match(/^\/workspace\/mcp\/servers\/([^/]+)$/);
21125
+ const mcpDelete = path17.match(/^\/workspace\/mcp\/servers\/([^/]+)$/);
20702
21126
  if (mcpDelete?.[1] && req.method === "DELETE") {
20703
21127
  return { route: "DELETE /workspace/mcp/servers/:name" };
20704
21128
  }
20705
- if (req.method === "POST" && path16 === "/workspace/auth/device-flow") {
21129
+ if (req.method === "POST" && path17 === "/workspace/auth/device-flow") {
20706
21130
  return { route: "POST /workspace/auth/device-flow" };
20707
21131
  }
20708
- const deviceFlowDelete = path16.match(
21132
+ const deviceFlowDelete = path17.match(
20709
21133
  /^\/workspace\/auth\/device-flow\/([^/]+)$/
20710
21134
  );
20711
21135
  if (deviceFlowDelete?.[1] && req.method === "DELETE") {
20712
21136
  return { route: "DELETE /workspace/auth/device-flow/:id" };
20713
21137
  }
20714
- const toolEnable = path16.match(/^\/workspace\/tools\/([^/]+)\/enable$/);
21138
+ const toolEnable = path17.match(/^\/workspace\/tools\/([^/]+)\/enable$/);
20715
21139
  if (toolEnable?.[1] && req.method === "POST") {
20716
21140
  return { route: "POST /workspace/tools/:name/enable" };
20717
21141
  }
20718
- if (path16 === "/workspace/settings") {
21142
+ if (path17 === "/workspace/settings") {
20719
21143
  if (req.method === "GET") return { route: "GET /workspace/settings" };
20720
21144
  if (req.method === "POST") return { route: "POST /workspace/settings" };
20721
21145
  }
20722
- if (path16 === "/workspace/permissions") {
21146
+ if (path17 === "/workspace/permissions") {
20723
21147
  if (req.method === "GET") return { route: "GET /workspace/permissions" };
20724
21148
  if (req.method === "POST") return { route: "POST /workspace/permissions" };
20725
21149
  }
20726
- if (path16 === "/workspace/trust") {
21150
+ if (path17 === "/workspace/trust") {
20727
21151
  if (req.method === "GET") return { route: "GET /workspace/trust" };
20728
21152
  }
20729
- if (req.method === "POST" && path16 === "/workspace/trust/request") {
21153
+ if (req.method === "POST" && path17 === "/workspace/trust/request") {
20730
21154
  return { route: "POST /workspace/trust/request" };
20731
21155
  }
20732
- if (path16 === "/workspace/voice") {
21156
+ if (path17 === "/workspace/voice") {
20733
21157
  if (req.method === "GET") return { route: "GET /workspace/voice" };
20734
21158
  if (req.method === "POST") return { route: "POST /workspace/voice" };
20735
21159
  }
20736
- if (req.method === "POST" && path16 === "/workspace/voice/transcribe") {
21160
+ if (req.method === "POST" && path17 === "/workspace/voice/transcribe") {
20737
21161
  return { route: "POST /workspace/voice/transcribe" };
20738
21162
  }
20739
21163
  return void 0;
@@ -21002,7 +21426,7 @@ __name(registerPermissionRoutes, "registerPermissionRoutes");
21002
21426
  init_esbuild_shims();
21003
21427
  import * as crypto3 from "node:crypto";
21004
21428
  import * as fs6 from "node:fs";
21005
- import * as path11 from "node:path";
21429
+ import * as path12 from "node:path";
21006
21430
 
21007
21431
  // packages/cli/src/serve/server/prompt-deadline.ts
21008
21432
  init_esbuild_shims();
@@ -21022,7 +21446,7 @@ init_esbuild_shims();
21022
21446
 
21023
21447
  // packages/cli/src/serve/server/persisted-session-list-cache.ts
21024
21448
  init_esbuild_shims();
21025
- import path10 from "node:path";
21449
+ import path11 from "node:path";
21026
21450
  var PersistedSessionListCache = class {
21027
21451
  constructor(ttlMs, maxRetainedSummaries) {
21028
21452
  this.ttlMs = ttlMs;
@@ -21033,7 +21457,8 @@ var PersistedSessionListCache = class {
21033
21457
  }
21034
21458
  slots = /* @__PURE__ */ new Map();
21035
21459
  retainedSummaries = 0;
21036
- lookup(scope, loader) {
21460
+ lookup(scope, loader, options = {}) {
21461
+ options.signal?.throwIfAborted();
21037
21462
  const key = this.key(scope);
21038
21463
  let slot = this.slots.get(key);
21039
21464
  if (!slot) {
@@ -21044,27 +21469,43 @@ var PersistedSessionListCache = class {
21044
21469
  if (slot.value) {
21045
21470
  const cacheAgeMs = Math.max(0, now - slot.value.completedAt);
21046
21471
  if (cacheAgeMs < this.ttlMs) {
21472
+ const snapshot = slot.value.snapshot;
21047
21473
  return {
21048
21474
  status: "cache_hit",
21049
- promise: Promise.resolve(slot.value.snapshot),
21475
+ promise: Promise.resolve().then(() => {
21476
+ options.signal?.throwIfAborted();
21477
+ return snapshot;
21478
+ }),
21050
21479
  cacheAgeMs
21051
21480
  };
21052
21481
  }
21053
21482
  this.removeValue(slot);
21054
21483
  }
21055
- if (slot.inFlight !== void 0 && slot.inFlight.generation === slot.generation) {
21484
+ if (slot.inFlight !== void 0 && slot.inFlight.generation === slot.generation && !slot.inFlight.controller.signal.aborted) {
21056
21485
  return {
21057
21486
  status: "single_flight",
21058
- promise: slot.inFlight.promise
21487
+ promise: this.attachWaiter(key, slot, slot.inFlight, options.signal)
21059
21488
  };
21060
21489
  }
21061
21490
  const generation = slot.generation;
21062
- const managed = Promise.resolve().then(loader).then(
21491
+ const controller = new AbortController();
21492
+ const load = {
21493
+ generation,
21494
+ controller,
21495
+ promise: void 0,
21496
+ waiterCount: 0,
21497
+ settled: false
21498
+ };
21499
+ const managed = Promise.resolve().then(() => {
21500
+ controller.signal.throwIfAborted();
21501
+ return loader(controller.signal);
21502
+ }).then(
21063
21503
  (snapshot) => {
21504
+ load.settled = true;
21064
21505
  const current = this.slots.get(key);
21065
- if (current === slot && current.inFlight?.promise === managed) {
21506
+ if (current === slot && current.inFlight === load) {
21066
21507
  current.inFlight = void 0;
21067
- if (current.generation === generation && snapshot.sessions.length <= this.maxRetainedSummaries) {
21508
+ if (current.generation === generation && !controller.signal.aborted && snapshot.sessions.length <= this.maxRetainedSummaries) {
21068
21509
  this.installValue(key, current, snapshot);
21069
21510
  } else if (current.value === void 0) {
21070
21511
  this.slots.delete(key);
@@ -21073,16 +21514,21 @@ var PersistedSessionListCache = class {
21073
21514
  return snapshot;
21074
21515
  },
21075
21516
  (error2) => {
21517
+ load.settled = true;
21076
21518
  const current = this.slots.get(key);
21077
- if (current === slot && current.inFlight?.promise === managed) {
21519
+ if (current === slot && current.inFlight === load) {
21078
21520
  current.inFlight = void 0;
21079
21521
  if (current.value === void 0) this.slots.delete(key);
21080
21522
  }
21081
21523
  throw error2;
21082
21524
  }
21083
21525
  );
21084
- slot.inFlight = { generation, promise: managed };
21085
- return { status: "scan", promise: managed };
21526
+ load.promise = managed;
21527
+ slot.inFlight = load;
21528
+ return {
21529
+ status: "scan",
21530
+ promise: this.attachWaiter(key, slot, load, options.signal)
21531
+ };
21086
21532
  }
21087
21533
  invalidate(scope) {
21088
21534
  const key = this.key(scope);
@@ -21136,9 +21582,42 @@ var PersistedSessionListCache = class {
21136
21582
  this.retainedSummaries -= value.snapshot.sessions.length;
21137
21583
  slot.value = void 0;
21138
21584
  }
21585
+ attachWaiter(key, slot, load, signal) {
21586
+ load.waiterCount += 1;
21587
+ return new Promise((resolve5, reject) => {
21588
+ let settled = false;
21589
+ const settle = /* @__PURE__ */ __name((finish) => {
21590
+ if (settled) return;
21591
+ settled = true;
21592
+ signal?.removeEventListener("abort", onAbort);
21593
+ load.waiterCount -= 1;
21594
+ if (load.waiterCount === 0 && !load.settled) {
21595
+ load.controller.abort(
21596
+ new DOMException("No active session list waiters", "AbortError")
21597
+ );
21598
+ const current = this.slots.get(key);
21599
+ if (current === slot && current.inFlight === load) {
21600
+ current.inFlight = void 0;
21601
+ if (current.value === void 0) this.slots.delete(key);
21602
+ }
21603
+ }
21604
+ finish();
21605
+ }, "settle");
21606
+ const onAbort = /* @__PURE__ */ __name(() => {
21607
+ if (load.settled) return;
21608
+ settle(() => reject(signal?.reason));
21609
+ }, "onAbort");
21610
+ signal?.addEventListener("abort", onAbort, { once: true });
21611
+ if (signal?.aborted) onAbort();
21612
+ void load.promise.then(
21613
+ (snapshot) => settle(() => resolve5(snapshot)),
21614
+ (error2) => settle(() => reject(error2))
21615
+ );
21616
+ });
21617
+ }
21139
21618
  key(scope) {
21140
21619
  return JSON.stringify([
21141
- path10.resolve(scope.runtimeBaseDir),
21620
+ path11.resolve(scope.runtimeBaseDir),
21142
21621
  scope.workspaceCwd,
21143
21622
  scope.archiveState
21144
21623
  ]);
@@ -21257,15 +21736,21 @@ function encodeMetadataSessionCursor(last, filter, archiveState) {
21257
21736
  ).toString("base64url");
21258
21737
  }
21259
21738
  __name(encodeMetadataSessionCursor, "encodeMetadataSessionCursor");
21260
- async function enrichWorktreeSidecars(bySessionId, sessionService, archiveState = "active") {
21739
+ async function enrichWorktreeSidecars(bySessionId, sessionService, archiveState = "active", signal) {
21261
21740
  for (const [sessionId, summary] of bySessionId) {
21741
+ signal?.throwIfAborted();
21262
21742
  if (summary.worktree) continue;
21263
- const sidecar = await readWorktreeSession(
21264
- sessionService.getWorktreeSessionPathForArchiveState(
21743
+ let sidecar;
21744
+ try {
21745
+ const sidecarPath = sessionService.getWorktreeSessionPathForArchiveState(
21265
21746
  sessionId,
21266
21747
  archiveState
21267
- )
21268
- ).catch(() => null);
21748
+ );
21749
+ sidecar = signal ? await readWorktreeSession(sidecarPath, { signal }) : await readWorktreeSession(sidecarPath);
21750
+ } catch {
21751
+ signal?.throwIfAborted();
21752
+ sidecar = null;
21753
+ }
21269
21754
  if (sidecar) {
21270
21755
  bySessionId.set(sessionId, {
21271
21756
  ...summary,
@@ -21320,8 +21805,9 @@ function clonePersistedSummary(session) {
21320
21805
  };
21321
21806
  }
21322
21807
  __name(clonePersistedSummary, "clonePersistedSummary");
21323
- async function loadAllPersistedSummaries(sessionService, archiveState) {
21808
+ async function loadAllPersistedSummaries(sessionService, archiveState, signal) {
21324
21809
  const scanStartedAt = performance.now();
21810
+ signal.throwIfAborted();
21325
21811
  const sessions = [];
21326
21812
  let truncated = false;
21327
21813
  let scanPages = 0;
@@ -21331,8 +21817,10 @@ async function loadAllPersistedSummaries(sessionService, archiveState) {
21331
21817
  const page = await sessionService.listSessions({
21332
21818
  cursor,
21333
21819
  size: 1e4,
21334
- archiveState
21820
+ archiveState,
21821
+ signal
21335
21822
  });
21823
+ signal.throwIfAborted();
21336
21824
  const remaining = MAX_ORGANIZED_SESSIONS - sessions.length;
21337
21825
  sessions.push(...page.items.slice(0, remaining).map(toSummary2));
21338
21826
  cursor = page.nextCursor;
@@ -21350,7 +21838,13 @@ async function loadAllPersistedSummaries(sessionService, archiveState) {
21350
21838
  const bySessionId = new Map(
21351
21839
  sessions.map((session) => [session.sessionId, session])
21352
21840
  );
21353
- await enrichWorktreeSidecars(bySessionId, sessionService, archiveState);
21841
+ await enrichWorktreeSidecars(
21842
+ bySessionId,
21843
+ sessionService,
21844
+ archiveState,
21845
+ signal
21846
+ );
21847
+ signal.throwIfAborted();
21354
21848
  return {
21355
21849
  sessions: [...bySessionId.values()],
21356
21850
  truncated,
@@ -21359,10 +21853,11 @@ async function loadAllPersistedSummaries(sessionService, archiveState) {
21359
21853
  };
21360
21854
  }
21361
21855
  __name(loadAllPersistedSummaries, "loadAllPersistedSummaries");
21362
- async function listAllPersistedSummaries(sessionService, workspaceCwd, archiveState, runtimeBaseDir, queryKind) {
21856
+ async function listAllPersistedSummaries(sessionService, workspaceCwd, archiveState, runtimeBaseDir, queryKind, signal) {
21363
21857
  const lookup = persistedSessionListCache.lookup(
21364
21858
  { runtimeBaseDir, workspaceCwd, archiveState },
21365
- () => loadAllPersistedSummaries(sessionService, archiveState)
21859
+ (loadSignal) => loadAllPersistedSummaries(sessionService, archiveState, loadSignal),
21860
+ { signal }
21366
21861
  );
21367
21862
  addDaemonRequestAttribute(
21368
21863
  "qwen-code.daemon.session_list.cache_status",
@@ -21383,6 +21878,7 @@ async function listAllPersistedSummaries(sessionService, workspaceCwd, archiveSt
21383
21878
  );
21384
21879
  }
21385
21880
  const snapshot = await lookup.promise;
21881
+ signal?.throwIfAborted();
21386
21882
  addDaemonRequestAttribute(
21387
21883
  "qwen-code.daemon.session_list.persisted_sessions",
21388
21884
  snapshot.sessions.length
@@ -21395,7 +21891,7 @@ async function listAllPersistedSummaries(sessionService, workspaceCwd, archiveSt
21395
21891
  "qwen-code.daemon.session_list.truncated",
21396
21892
  snapshot.truncated
21397
21893
  );
21398
- if (lookup.status === "scan") {
21894
+ if (lookup.status !== "cache_hit") {
21399
21895
  addDaemonRequestAttribute(
21400
21896
  "qwen-code.daemon.session_list.scan_duration_ms",
21401
21897
  snapshot.scanDurationMs
@@ -21459,7 +21955,9 @@ async function listOrganizedWorkspaceSessionsForResponse(bridge, workspaceCwd, o
21459
21955
  const archiveState = options.archiveState ?? "active";
21460
21956
  const sessionService = new SessionService(workspaceCwd);
21461
21957
  const organizationService = createSessionOrganizationService(workspaceCwd);
21958
+ readOptions.signal?.throwIfAborted();
21462
21959
  const snapshot = await organizationService.readSnapshot();
21960
+ readOptions.signal?.throwIfAborted();
21463
21961
  const knownGroupIds = new Set(snapshot.groups.map((group2) => group2.id));
21464
21962
  const group = options.group ?? "all";
21465
21963
  if (group !== "all" && group !== "pinned" && group !== "ungrouped" && !knownGroupIds.has(group)) {
@@ -21483,8 +21981,10 @@ async function listOrganizedWorkspaceSessionsForResponse(bridge, workspaceCwd, o
21483
21981
  workspaceCwd,
21484
21982
  archiveState,
21485
21983
  readOptions.runtimeBaseDir,
21486
- "organized"
21984
+ "organized",
21985
+ readOptions.signal
21487
21986
  );
21987
+ readOptions.signal?.throwIfAborted();
21488
21988
  for (const session of persisted.sessions) {
21489
21989
  bySessionId.set(
21490
21990
  session.sessionId,
@@ -21517,7 +22017,9 @@ async function listOrganizedWorkspaceSessionsForResponse(bridge, workspaceCwd, o
21517
22017
  // above and this point: `existing` stayed undefined but
21518
22018
  // `sessionExists` flipped to true, silently dropping the live
21519
22019
  // session from the response instead of merging it.
21520
- !persisted.truncated || !await sessionService.sessionExists(live.sessionId)
22020
+ !persisted.truncated || !await (readOptions.signal ? sessionService.sessionExists(live.sessionId, {
22021
+ signal: readOptions.signal
22022
+ }) : sessionService.sessionExists(live.sessionId))
21521
22023
  ) {
21522
22024
  bySessionId.set(
21523
22025
  live.sessionId,
@@ -21535,6 +22037,7 @@ async function listOrganizedWorkspaceSessionsForResponse(bridge, workspaceCwd, o
21535
22037
  }
21536
22038
  }
21537
22039
  } catch (error2) {
22040
+ readOptions.signal?.throwIfAborted();
21538
22041
  liveMergeFailed = true;
21539
22042
  writeStderrLine(
21540
22043
  `qwen serve: organized session list live merge failed; using persisted sessions only: ${error2 instanceof Error ? error2.message : String(error2)}`
@@ -21549,6 +22052,7 @@ async function listOrganizedWorkspaceSessionsForResponse(bridge, workspaceCwd, o
21549
22052
  return session.groupId == null && session.color == null;
21550
22053
  return session.color == null && session.groupId === group;
21551
22054
  });
22055
+ readOptions.signal?.throwIfAborted();
21552
22056
  const activityTimeById = new Map(
21553
22057
  filtered.map((session) => [
21554
22058
  session.sessionId,
@@ -21556,6 +22060,7 @@ async function listOrganizedWorkspaceSessionsForResponse(bridge, workspaceCwd, o
21556
22060
  ])
21557
22061
  );
21558
22062
  filtered.sort((a, b) => compareOrganizedSessions(activityTimeById, a, b));
22063
+ readOptions.signal?.throwIfAborted();
21559
22064
  const afterCursor = cursorKey === void 0 ? filtered : filtered.filter(
21560
22065
  (session) => compareOrganizedCursorKeys(
21561
22066
  cursorKey,
@@ -21587,8 +22092,10 @@ async function listWorkspaceSessionsByMetadataForResponse(bridge, workspaceCwd,
21587
22092
  workspaceCwd,
21588
22093
  archiveState,
21589
22094
  readOptions.runtimeBaseDir,
21590
- "metadata"
22095
+ "metadata",
22096
+ readOptions.signal
21591
22097
  );
22098
+ readOptions.signal?.throwIfAborted();
21592
22099
  for (const session of persisted.sessions) {
21593
22100
  bySessionId.set(session.sessionId, clonePersistedSummary(session));
21594
22101
  }
@@ -21607,7 +22114,9 @@ async function listWorkspaceSessionsByMetadataForResponse(bridge, workspaceCwd,
21607
22114
  // `listOrganizedWorkspaceSessionsForResponse`: an untruncated scan
21608
22115
  // already covers every persisted session, so skip the racy
21609
22116
  // re-check when nothing was truncated.
21610
- !persisted.truncated || !await sessionService.sessionExists(live.sessionId)
22117
+ !persisted.truncated || !await (readOptions.signal ? sessionService.sessionExists(live.sessionId, {
22118
+ signal: readOptions.signal
22119
+ }) : sessionService.sessionExists(live.sessionId))
21611
22120
  ) {
21612
22121
  bySessionId.set(live.sessionId, {
21613
22122
  ...live,
@@ -21619,6 +22128,7 @@ async function listWorkspaceSessionsByMetadataForResponse(bridge, workspaceCwd,
21619
22128
  }
21620
22129
  }
21621
22130
  } catch (error2) {
22131
+ readOptions.signal?.throwIfAborted();
21622
22132
  liveMergeFailed = true;
21623
22133
  writeStderrLine(
21624
22134
  `qwen serve: session metadata filter live merge failed; using persisted sessions only: ${error2 instanceof Error ? error2.message : String(error2)}`
@@ -21633,6 +22143,7 @@ async function listWorkspaceSessionsByMetadataForResponse(bridge, workspaceCwd,
21633
22143
  getLiveSessionCursorKey(b)
21634
22144
  )
21635
22145
  );
22146
+ readOptions.signal?.throwIfAborted();
21636
22147
  const cursorKey = options.cursor !== void 0 && options.cursor !== "" ? parseMetadataSessionCursor(options.cursor, {
21637
22148
  ...filter,
21638
22149
  archiveState
@@ -21658,20 +22169,25 @@ async function listWorkspaceSessionsByMetadataForResponse(bridge, workspaceCwd,
21658
22169
  }
21659
22170
  __name(listWorkspaceSessionsByMetadataForResponse, "listWorkspaceSessionsByMetadataForResponse");
21660
22171
  async function listWorkspaceSessionsForResponse(bridge, workspaceCwd, options, readOptions = {}) {
22172
+ readOptions.signal?.throwIfAborted();
21661
22173
  const runtimeBaseDir = new Storage(
21662
22174
  workspaceCwd,
21663
22175
  readOptions.runtimeBaseDir
21664
22176
  ).getRuntimeBaseDir();
21665
- return Storage.runWithResolvedRuntimeBaseDir(
22177
+ const result = await Storage.runWithResolvedRuntimeBaseDir(
21666
22178
  runtimeBaseDir,
21667
22179
  () => listWorkspaceSessionsForResponseInRuntime(bridge, workspaceCwd, options, {
21668
22180
  ...readOptions.mergeLive !== void 0 ? { mergeLive: readOptions.mergeLive } : {},
22181
+ ...readOptions.signal !== void 0 ? { signal: readOptions.signal } : {},
21669
22182
  runtimeBaseDir
21670
22183
  })
21671
22184
  );
22185
+ readOptions.signal?.throwIfAborted();
22186
+ return result;
21672
22187
  }
21673
22188
  __name(listWorkspaceSessionsForResponse, "listWorkspaceSessionsForResponse");
21674
22189
  async function listWorkspaceSessionsForResponseInRuntime(bridge, workspaceCwd, options, readOptions) {
22190
+ readOptions.signal?.throwIfAborted();
21675
22191
  const rawSize = options?.size;
21676
22192
  const requestedSize = typeof rawSize === "number" && Number.isSafeInteger(rawSize) ? rawSize : DEFAULT_SESSION_PAGE_SIZE;
21677
22193
  const pageSize = Math.min(Math.max(requestedSize, 1), MAX_SESSION_PAGE_SIZE);
@@ -21708,13 +22224,21 @@ async function listWorkspaceSessionsForResponseInRuntime(bridge, workspaceCwd, o
21708
22224
  const persisted = await sessionService.listSessions({
21709
22225
  cursor: numericCursor,
21710
22226
  size: pageSize,
21711
- archiveState
22227
+ archiveState,
22228
+ ...readOptions.signal ? { signal: readOptions.signal } : {}
21712
22229
  });
22230
+ readOptions.signal?.throwIfAborted();
21713
22231
  const bySessionId = /* @__PURE__ */ new Map();
21714
22232
  for (const item of persisted.items) {
21715
22233
  bySessionId.set(item.sessionId, toSummary2(item));
21716
22234
  }
21717
- await enrichWorktreeSidecars(bySessionId, sessionService, archiveState);
22235
+ await enrichWorktreeSidecars(
22236
+ bySessionId,
22237
+ sessionService,
22238
+ archiveState,
22239
+ readOptions.signal
22240
+ );
22241
+ readOptions.signal?.throwIfAborted();
21718
22242
  if (archiveState === "archived" || readOptions.mergeLive === false) {
21719
22243
  const sessions2 = [...bySessionId.values()];
21720
22244
  const nextCursor2 = persisted.nextCursor != null ? String(persisted.nextCursor) : void 0;
@@ -21732,7 +22256,9 @@ async function listWorkspaceSessionsForResponseInRuntime(bridge, workspaceCwd, o
21732
22256
  // `existing` stayed undefined but `sessionExists` flipped to true,
21733
22257
  // silently dropping the live session from the response instead of
21734
22258
  // merging it.
21735
- (persisted.nextCursor == null || !await sessionService.sessionExists(live.sessionId))) {
22259
+ (persisted.nextCursor == null || !await (readOptions.signal ? sessionService.sessionExists(live.sessionId, {
22260
+ signal: readOptions.signal
22261
+ }) : sessionService.sessionExists(live.sessionId)))) {
21736
22262
  bySessionId.set(live.sessionId, {
21737
22263
  ...live,
21738
22264
  createdAt: live.createdAt,
@@ -21747,6 +22273,7 @@ async function listWorkspaceSessionsForResponseInRuntime(bridge, workspaceCwd, o
21747
22273
  const bTime = Date.parse(b.updatedAt ?? b.createdAt);
21748
22274
  return bTime - aTime;
21749
22275
  });
22276
+ readOptions.signal?.throwIfAborted();
21750
22277
  const nextCursor = persisted.nextCursor != null ? String(persisted.nextCursor) : void 0;
21751
22278
  return { sessions, nextCursor };
21752
22279
  }
@@ -21927,6 +22454,8 @@ import * as fs5 from "node:fs/promises";
21927
22454
  import { createReadStream } from "node:fs";
21928
22455
  import readline from "node:readline";
21929
22456
  var PREFIX = "subagent.";
22457
+ var MAX_VIRTUAL_SESSION_ID_PART_LENGTH = 500;
22458
+ var MAX_VIRTUAL_SESSION_ID_LENGTH = 2e3;
21930
22459
  var POLL_INTERVAL_MS = 250;
21931
22460
  var TARGET_RETENTION_MS = 6e4;
21932
22461
  async function readFirstUserText(filePath) {
@@ -22015,26 +22544,40 @@ function decodePart(value) {
22015
22544
  }
22016
22545
  }
22017
22546
  __name(decodePart, "decodePart");
22018
- function isValidVirtualSessionPart(value) {
22019
- return /^[a-zA-Z0-9_-]{1,500}$/.test(value);
22547
+ function isValidVirtualParentSessionId(value) {
22548
+ return value.length > 0 && value.length <= MAX_VIRTUAL_SESSION_ID_PART_LENGTH && /^[a-zA-Z0-9_-]+$/.test(value);
22549
+ }
22550
+ __name(isValidVirtualParentSessionId, "isValidVirtualParentSessionId");
22551
+ function isValidVirtualAgentId(value) {
22552
+ return value.length > 0 && value.length <= MAX_VIRTUAL_SESSION_ID_PART_LENGTH && // Round-trip rejects lone surrogates: UTF-8 maps them to U+FFFD, so two
22553
+ // distinct agent ids would otherwise encode to the same session id.
22554
+ decodePart(encodePart(value)) === value;
22020
22555
  }
22021
- __name(isValidVirtualSessionPart, "isValidVirtualSessionPart");
22556
+ __name(isValidVirtualAgentId, "isValidVirtualAgentId");
22022
22557
  function createVirtualSubagentSessionId(parentSessionId, agentId) {
22023
- if (!isValidVirtualSessionPart(parentSessionId) || !isValidVirtualSessionPart(agentId)) {
22558
+ if (!isValidVirtualParentSessionId(parentSessionId) || !isValidVirtualAgentId(agentId)) {
22024
22559
  throw new Error("Virtual subagent session ids require valid id parts");
22025
22560
  }
22026
- return `${PREFIX}${encodePart(parentSessionId)}.${encodePart(agentId)}`;
22561
+ const sessionId = `${PREFIX}${encodePart(parentSessionId)}.${encodePart(agentId)}`;
22562
+ if (sessionId.length > MAX_VIRTUAL_SESSION_ID_LENGTH) {
22563
+ throw new Error(
22564
+ `Virtual subagent session id exceeds ${MAX_VIRTUAL_SESSION_ID_LENGTH} characters`
22565
+ );
22566
+ }
22567
+ return sessionId;
22027
22568
  }
22028
22569
  __name(createVirtualSubagentSessionId, "createVirtualSubagentSessionId");
22029
22570
  function parseVirtualSubagentSessionId(sessionId) {
22030
- if (!sessionId.startsWith(PREFIX) || sessionId.length > 2e3) {
22571
+ if (!sessionId.startsWith(PREFIX) || sessionId.length > MAX_VIRTUAL_SESSION_ID_LENGTH) {
22031
22572
  return void 0;
22032
22573
  }
22033
22574
  const parts = sessionId.slice(PREFIX.length).split(".");
22034
22575
  if (parts.length !== 2) return void 0;
22035
- const parentSessionId = decodePart(parts[0]);
22036
- const agentId = decodePart(parts[1]);
22037
- if (!parentSessionId || !agentId || !isValidVirtualSessionPart(parentSessionId) || !isValidVirtualSessionPart(agentId)) {
22576
+ const parentPart = parts[0];
22577
+ const agentPart = parts[1];
22578
+ const parentSessionId = decodePart(parentPart);
22579
+ const agentId = decodePart(agentPart);
22580
+ if (!parentSessionId || !agentId || !isValidVirtualParentSessionId(parentSessionId) || !isValidVirtualAgentId(agentId) || encodePart(parentSessionId) !== parentPart || encodePart(agentId) !== agentPart) {
22038
22581
  return void 0;
22039
22582
  }
22040
22583
  return { parentSessionId, agentId };
@@ -22785,6 +23328,19 @@ function parseHistoryPageSize(body, res) {
22785
23328
  return value;
22786
23329
  }
22787
23330
  __name(parseHistoryPageSize, "parseHistoryPageSize");
23331
+ function parseLiveReplayMode(body, res) {
23332
+ const value = body["liveReplayMode"];
23333
+ if (value === void 0) return void 0;
23334
+ if (value !== "full" && value !== "summary") {
23335
+ res.status(400).json({
23336
+ error: "`liveReplayMode` must be `full` or `summary`",
23337
+ code: "invalid_live_replay_mode"
23338
+ });
23339
+ return null;
23340
+ }
23341
+ return value;
23342
+ }
23343
+ __name(parseLiveReplayMode, "parseLiveReplayMode");
22788
23344
  function workspaceTranscriptCursorExceedsLimit(cursor, maxBytes = WORKSPACE_TRANSCRIPT_CURSOR_MAX_BYTES) {
22789
23345
  return Buffer.byteLength(cursor) > maxBytes;
22790
23346
  }
@@ -23033,7 +23589,7 @@ function registerSessionRoutes(app, deps) {
23033
23589
  const workspaceParam = req.params[paramName] ?? "";
23034
23590
  const byId = workspaceRegistry.getByWorkspaceId(workspaceParam);
23035
23591
  if (byId) return byId;
23036
- if (!path11.isAbsolute(workspaceParam)) {
23592
+ if (!path12.isAbsolute(workspaceParam)) {
23037
23593
  res.status(400).json({
23038
23594
  error: `\`:${paramName}\` must decode to a workspace id or absolute path`
23039
23595
  });
@@ -23090,16 +23646,19 @@ function registerSessionRoutes(app, deps) {
23090
23646
  }
23091
23647
  return runtime;
23092
23648
  }, "resolveLegacyPrimaryRuntimeFromParam");
23093
- const hasActivePersistedSessions = /* @__PURE__ */ __name(async (runtime) => {
23649
+ const hasActivePersistedSessions = /* @__PURE__ */ __name(async (runtime, signal) => {
23094
23650
  try {
23095
23651
  const page = await createWorkspaceRuntimeSessionService(
23096
23652
  runtime
23097
23653
  ).listSessions({
23098
23654
  archiveState: "active",
23099
- size: 1
23655
+ size: 1,
23656
+ signal
23100
23657
  });
23658
+ signal.throwIfAborted();
23101
23659
  return page.items.length > 0;
23102
23660
  } catch {
23661
+ signal.throwIfAborted();
23103
23662
  return false;
23104
23663
  }
23105
23664
  }, "hasActivePersistedSessions");
@@ -23890,7 +24449,7 @@ function registerSessionRoutes(app, deps) {
23890
24449
  if (worktreeMeta) {
23891
24450
  try {
23892
24451
  const createAllowedRoots = [
23893
- path11.join(workspaceCwd, ".qwen", "worktrees")
24452
+ path12.join(workspaceCwd, ".qwen", "worktrees")
23894
24453
  ];
23895
24454
  let createRepoTop = null;
23896
24455
  try {
@@ -23901,7 +24460,7 @@ function registerSessionRoutes(app, deps) {
23901
24460
  }
23902
24461
  if (createRepoTop && createRepoTop !== workspaceCwd) {
23903
24462
  createAllowedRoots.push(
23904
- path11.join(createRepoTop, ".qwen", "worktrees")
24463
+ path12.join(createRepoTop, ".qwen", "worktrees")
23905
24464
  );
23906
24465
  }
23907
24466
  await runtime.bridge.changeSessionCwd(session.sessionId, {
@@ -24048,6 +24607,8 @@ function registerSessionRoutes(app, deps) {
24048
24607
  if (approvalMode === null) return;
24049
24608
  const historyPageSize = action === "load" ? parseHistoryPageSize(body ?? {}, res) : void 0;
24050
24609
  if (historyPageSize === null) return;
24610
+ const liveReplayMode = parseLiveReplayMode(body ?? {}, res);
24611
+ if (liveReplayMode === null) return;
24051
24612
  const clientId = parseClientIdHeader(req, res);
24052
24613
  if (clientId === null) return;
24053
24614
  let sessionIdReservation;
@@ -24098,6 +24659,7 @@ function registerSessionRoutes(app, deps) {
24098
24659
  workspaceCwd,
24099
24660
  historyReplay: "response",
24100
24661
  ...historyPageSize !== void 0 ? { historyPageSize } : {},
24662
+ ...liveReplayMode !== void 0 ? { liveReplayMode } : {},
24101
24663
  ...clientId !== void 0 ? { clientId } : {},
24102
24664
  ...approvalMode !== void 0 ? { approvalMode } : {},
24103
24665
  ...metadata
@@ -24200,7 +24762,7 @@ function registerSessionRoutes(app, deps) {
24200
24762
  if (sidecar) {
24201
24763
  let realTarget;
24202
24764
  const candidateRoots = [
24203
- path11.join(workspaceCwd, ".qwen", "worktrees")
24765
+ path12.join(workspaceCwd, ".qwen", "worktrees")
24204
24766
  ];
24205
24767
  try {
24206
24768
  realTarget = fs6.realpathSync(sidecar.worktreePath);
@@ -24212,13 +24774,13 @@ function registerSessionRoutes(app, deps) {
24212
24774
  } catch {
24213
24775
  }
24214
24776
  if (repoTop && repoTop !== workspaceCwd) {
24215
- candidateRoots.push(path11.join(repoTop, ".qwen", "worktrees"));
24777
+ candidateRoots.push(path12.join(repoTop, ".qwen", "worktrees"));
24216
24778
  }
24217
24779
  const contained = candidateRoots.some((root) => {
24218
24780
  try {
24219
24781
  const realRoot = fs6.realpathSync(root);
24220
- const rel = path11.relative(realRoot, realTarget);
24221
- return !rel.startsWith("..") && !path11.isAbsolute(rel);
24782
+ const rel = path12.relative(realRoot, realTarget);
24783
+ return !rel.startsWith("..") && !path12.isAbsolute(rel);
24222
24784
  } catch {
24223
24785
  return false;
24224
24786
  }
@@ -24271,8 +24833,8 @@ function registerSessionRoutes(app, deps) {
24271
24833
  }, "restoreSessionHandler");
24272
24834
  app.post("/session/:id/load", mutate(), restoreSessionHandler("load"));
24273
24835
  app.post("/session/:id/resume", mutate(), restoreSessionHandler("resume"));
24274
- app.get("/session/:id/subagents/:toolCallId", async (req, res) => {
24275
- const route = "GET /session/:id/subagents/:toolCallId";
24836
+ app.get("/session/:id/subagents/:subagentRef", async (req, res) => {
24837
+ const route = "GET /session/:id/subagents/:subagentRef";
24276
24838
  const sessionId = requireSessionId(req, res);
24277
24839
  if (!sessionId) return;
24278
24840
  if (!virtualSubagentSessions) {
@@ -24283,11 +24845,11 @@ function registerSessionRoutes(app, deps) {
24283
24845
  });
24284
24846
  return;
24285
24847
  }
24286
- const toolCallId = req.params["toolCallId"];
24287
- if (!toolCallId || toolCallId.length > 500) {
24848
+ const subagentRef = req.params["subagentRef"];
24849
+ if (!subagentRef || subagentRef.length > MAX_VIRTUAL_SESSION_ID_PART_LENGTH) {
24288
24850
  res.status(400).json({
24289
- error: "`toolCallId` must be a non-empty tool call id",
24290
- code: "invalid_tool_call_id"
24851
+ error: "`subagentRef` must be a non-empty subagent reference",
24852
+ code: "invalid_subagent_ref"
24291
24853
  });
24292
24854
  return;
24293
24855
  }
@@ -24303,14 +24865,14 @@ function registerSessionRoutes(app, deps) {
24303
24865
  const resolved = await virtualSubagentSessions.resolve(
24304
24866
  runtime,
24305
24867
  sessionId,
24306
- toolCallId
24868
+ subagentRef
24307
24869
  );
24308
24870
  if (!resolved) {
24309
24871
  res.status(404).json({
24310
24872
  error: "Subagent session not found",
24311
24873
  code: "session_not_found",
24312
24874
  sessionId,
24313
- toolCallId
24875
+ subagentRef
24314
24876
  });
24315
24877
  return;
24316
24878
  }
@@ -24320,10 +24882,10 @@ function registerSessionRoutes(app, deps) {
24320
24882
  }
24321
24883
  });
24322
24884
  app.post(
24323
- "/session/:id/subagents/:toolCallId/cancel",
24885
+ "/session/:id/subagents/:subagentRef/cancel",
24324
24886
  mutate(),
24325
24887
  async (req, res) => {
24326
- const route = "POST /session/:id/subagents/:toolCallId/cancel";
24888
+ const route = "POST /session/:id/subagents/:subagentRef/cancel";
24327
24889
  const sessionId = requireSessionId(req, res);
24328
24890
  if (!sessionId) return;
24329
24891
  if (!virtualSubagentSessions) {
@@ -24334,11 +24896,11 @@ function registerSessionRoutes(app, deps) {
24334
24896
  });
24335
24897
  return;
24336
24898
  }
24337
- const toolCallId = req.params["toolCallId"];
24338
- if (!toolCallId || toolCallId.length > 500) {
24899
+ const subagentRef = req.params["subagentRef"];
24900
+ if (!subagentRef || subagentRef.length > MAX_VIRTUAL_SESSION_ID_PART_LENGTH) {
24339
24901
  res.status(400).json({
24340
- error: "`toolCallId` must be a non-empty tool call id",
24341
- code: "invalid_tool_call_id"
24902
+ error: "`subagentRef` must be a non-empty subagent reference",
24903
+ code: "invalid_subagent_ref"
24342
24904
  });
24343
24905
  return;
24344
24906
  }
@@ -24354,14 +24916,14 @@ function registerSessionRoutes(app, deps) {
24354
24916
  const resolved = await virtualSubagentSessions.resolve(
24355
24917
  runtime,
24356
24918
  sessionId,
24357
- toolCallId
24919
+ subagentRef
24358
24920
  );
24359
24921
  if (!resolved) {
24360
24922
  res.status(404).json({
24361
24923
  error: "Subagent session not found",
24362
24924
  code: "session_not_found",
24363
24925
  sessionId,
24364
- toolCallId
24926
+ subagentRef
24365
24927
  });
24366
24928
  return;
24367
24929
  }
@@ -24534,7 +25096,7 @@ function registerSessionRoutes(app, deps) {
24534
25096
  async (req, res, sessionId, runtime) => {
24535
25097
  const body = safeBody(req);
24536
25098
  const targetPath = body["path"];
24537
- if (typeof targetPath !== "string" || targetPath.length === 0 || !path11.isAbsolute(targetPath)) {
25099
+ if (typeof targetPath !== "string" || targetPath.length === 0 || !path12.isAbsolute(targetPath)) {
24538
25100
  res.status(400).json({
24539
25101
  error: "`path` is required and must be an absolute path",
24540
25102
  code: "invalid_path"
@@ -25034,12 +25596,18 @@ function registerSessionRoutes(app, deps) {
25034
25596
  const clientId = parseClientIdHeader(req, res);
25035
25597
  if (clientId === null) return;
25036
25598
  const promptId = crypto3.randomUUID();
25037
- res.status(200).json(
25038
- await runtime.bridge.continueSession(sessionId, {
25039
- ...clientId !== void 0 ? { clientId } : {},
25040
- promptId
25041
- })
25042
- );
25599
+ const result = await runtime.bridge.continueSession(sessionId, {
25600
+ ...clientId !== void 0 ? { clientId } : {},
25601
+ promptId
25602
+ });
25603
+ if (daemonLog && result.accepted) {
25604
+ daemonLog.info("continuation enqueued", {
25605
+ sessionId,
25606
+ promptId,
25607
+ clientId
25608
+ });
25609
+ }
25610
+ res.status(200).json(result);
25043
25611
  }
25044
25612
  )
25045
25613
  );
@@ -25104,6 +25672,26 @@ function registerSessionRoutes(app, deps) {
25104
25672
  const forwardedBody = { ...body };
25105
25673
  delete forwardedBody["deadlineMs"];
25106
25674
  delete forwardedBody["delivery"];
25675
+ const forwardedMeta = typeof forwardedBody["_meta"] === "object" && forwardedBody["_meta"] !== null && !Array.isArray(forwardedBody["_meta"]) ? { ...forwardedBody["_meta"] } : void 0;
25676
+ const promptAuthorization = forwardedMeta?.[CHANNEL_WORKER_PROMPT_AUTHORIZATION_META_KEY];
25677
+ const promptDisplayText = forwardedMeta?.[DAEMON_PROMPT_DISPLAY_TEXT_META_KEY];
25678
+ const channelPrompt = forwardedMeta?.[CHANNEL_PROMPT_META_KEY];
25679
+ if (forwardedMeta) {
25680
+ delete forwardedMeta[CHANNEL_WORKER_PROMPT_AUTHORIZATION_META_KEY];
25681
+ delete forwardedMeta[DAEMON_PROMPT_DISPLAY_TEXT_META_KEY];
25682
+ delete forwardedMeta[CHANNEL_PROMPT_META_KEY];
25683
+ if (Object.keys(forwardedMeta).length > 0) {
25684
+ forwardedBody["_meta"] = forwardedMeta;
25685
+ } else {
25686
+ delete forwardedBody["_meta"];
25687
+ }
25688
+ }
25689
+ const channelWorkerAuthorized = isChannelWorkerPromptAuthorized(
25690
+ promptAuthorization,
25691
+ runtime.workspaceCwd
25692
+ );
25693
+ const trustedPromptDisplayText = typeof promptDisplayText === "string" && channelWorkerAuthorized ? promptDisplayText : void 0;
25694
+ const trustedChannelPrompt = channelWorkerAuthorized && channelPrompt === true;
25107
25695
  const lastEventId = ownerBridge.getSessionLastEventId(sessionId);
25108
25696
  const eventEpoch = ownerBridge.getSessionEventEpoch(sessionId);
25109
25697
  addDaemonRequestAttribute("qwen-code.prompt_id", promptId);
@@ -25136,6 +25724,8 @@ function registerSessionRoutes(app, deps) {
25136
25724
  ...clientId !== void 0 ? { clientId } : {},
25137
25725
  promptId,
25138
25726
  ...effectiveDeadlineMs !== void 0 ? { deadlineMs: effectiveDeadlineMs } : {},
25727
+ ...trustedPromptDisplayText !== void 0 ? { promptDisplayText: trustedPromptDisplayText } : {},
25728
+ ...trustedChannelPrompt ? { channelPrompt: true } : {},
25139
25729
  ...delivery !== void 0 ? {
25140
25730
  channelDelivery: {
25141
25731
  deliveryId: promptId,
@@ -26014,25 +26604,54 @@ function registerSessionRoutes(app, deps) {
26014
26604
  ...parentSessionId !== void 0 ? { parentSessionId } : {},
26015
26605
  ...parsedSource
26016
26606
  };
26017
- const usePersisted = readOnlySecondary || runtime.primary || view === "organized" || archiveState === "archived" || parentSessionId !== void 0 || parsedSource.sourceType !== void 0 || (cursor !== void 0 && cursor !== "" ? isNumericSessionCursor(cursor) : await hasActivePersistedSessions(runtime));
26018
- if (!usePersisted && (view !== void 0 || archiveState === "archived" || parentSessionId !== void 0 || parsedSource.sourceType !== void 0)) {
26019
- throw new Error(
26020
- "session list live path received persisted-only options"
26607
+ const controller = new AbortController();
26608
+ const onRequestAborted = /* @__PURE__ */ __name(() => {
26609
+ controller.abort(new DOMException("Request aborted", "AbortError"));
26610
+ }, "onRequestAborted");
26611
+ const onResponseClosed = /* @__PURE__ */ __name(() => {
26612
+ if (!res.writableEnded) {
26613
+ controller.abort(new DOMException("Response closed", "AbortError"));
26614
+ }
26615
+ }, "onResponseClosed");
26616
+ req.once("aborted", onRequestAborted);
26617
+ res.once("close", onResponseClosed);
26618
+ if (req.aborted || res.destroyed) onRequestAborted();
26619
+ try {
26620
+ const usePersisted = readOnlySecondary || runtime.primary || view === "organized" || archiveState === "archived" || parentSessionId !== void 0 || parsedSource.sourceType !== void 0 || (cursor !== void 0 && cursor !== "" ? isNumericSessionCursor(cursor) : await hasActivePersistedSessions(runtime, controller.signal));
26621
+ if (!usePersisted && (view !== void 0 || archiveState === "archived" || parentSessionId !== void 0 || parsedSource.sourceType !== void 0)) {
26622
+ throw new Error(
26623
+ "session list live path received persisted-only options"
26624
+ );
26625
+ }
26626
+ const result = usePersisted ? await runWorkspaceInspectionWithLogPolicy(
26627
+ runtime,
26628
+ () => listWorkspaceSessionsForResponse(runtime.bridge, key, options, {
26629
+ mergeLive: !readOnlySecondary,
26630
+ runtimeBaseDir: runtime.sessionRuntimeBaseDir,
26631
+ signal: controller.signal
26632
+ })
26633
+ ) : listLiveWorkspaceSessionsForResponse(
26634
+ runtime.bridge,
26635
+ key,
26636
+ options
26021
26637
  );
26638
+ controller.signal.throwIfAborted();
26639
+ if (res.destroyed) return;
26640
+ res.status(200).json({
26641
+ sessions: result.sessions,
26642
+ ...result.nextCursor != null ? { nextCursor: result.nextCursor } : {},
26643
+ ...result.liveMergeFailed ? { liveMergeFailed: true } : {},
26644
+ ...result.truncated ? { truncated: true } : {}
26645
+ });
26646
+ } catch (err) {
26647
+ if (controller.signal.aborted || res.destroyed) {
26648
+ return;
26649
+ }
26650
+ throw err;
26651
+ } finally {
26652
+ req.off("aborted", onRequestAborted);
26653
+ res.off("close", onResponseClosed);
26022
26654
  }
26023
- const result = usePersisted ? await runWorkspaceInspectionWithLogPolicy(
26024
- runtime,
26025
- () => listWorkspaceSessionsForResponse(runtime.bridge, key, options, {
26026
- mergeLive: !readOnlySecondary,
26027
- runtimeBaseDir: runtime.sessionRuntimeBaseDir
26028
- })
26029
- ) : listLiveWorkspaceSessionsForResponse(runtime.bridge, key, options);
26030
- res.status(200).json({
26031
- sessions: result.sessions,
26032
- ...result.nextCursor != null ? { nextCursor: result.nextCursor } : {},
26033
- ...result.liveMergeFailed ? { liveMergeFailed: true } : {},
26034
- ...result.truncated ? { truncated: true } : {}
26035
- });
26036
26655
  } catch (err) {
26037
26656
  if (err instanceof InvalidCursorError) {
26038
26657
  res.status(400).json({
@@ -26125,6 +26744,35 @@ function registerSessionRoutes(app, deps) {
26125
26744
  }
26126
26745
  )
26127
26746
  );
26747
+ app.post(
26748
+ "/session/:id/config-option",
26749
+ mutate(),
26750
+ withOwnerMutableSession(
26751
+ "POST /session/:id/config-option",
26752
+ async (req, res, sessionId, runtime) => {
26753
+ const body = safeBody(req);
26754
+ const configId = body["configId"];
26755
+ const value = body["value"];
26756
+ if (configId !== "reasoning_effort") {
26757
+ res.status(400).json({
26758
+ error: "`configId` must be reasoning_effort"
26759
+ });
26760
+ return;
26761
+ }
26762
+ if (typeof value !== "string" || !value) {
26763
+ res.status(400).json({
26764
+ error: "`value` is required and must be a non-empty string"
26765
+ });
26766
+ return;
26767
+ }
26768
+ const response = await runtime.bridge.setSessionConfigOption(
26769
+ sessionId,
26770
+ { sessionId, configId, value }
26771
+ );
26772
+ res.status(200).json(response);
26773
+ }
26774
+ )
26775
+ );
26128
26776
  app.post(
26129
26777
  "/session/:id/recap",
26130
26778
  mutate(),
@@ -27628,7 +28276,7 @@ __name(registerUsageStatsRoutes, "registerUsageStatsRoutes");
27628
28276
  // packages/cli/src/serve/scheduled-task-keepalive.ts
27629
28277
  init_esbuild_shims();
27630
28278
  import * as fsSync from "node:fs";
27631
- import * as path12 from "node:path";
28279
+ import * as path13 from "node:path";
27632
28280
  var log = createDebugLogger("SCHED_KEEPALIVE");
27633
28281
  function collectBoundSessionIds(tasks) {
27634
28282
  const seen = /* @__PURE__ */ new Set();
@@ -27784,18 +28432,21 @@ function startScheduledTaskKeepalive(opts) {
27784
28432
  const metadata = await new SessionService(
27785
28433
  boundWorkspace
27786
28434
  ).readCreationMetadata(sessionId);
27787
- const load = bridge.loadSession({
28435
+ const resume = bridge.resumeSession({
27788
28436
  sessionId,
27789
28437
  workspaceCwd: boundWorkspace,
27790
- historyReplay: "response",
27791
28438
  ...metadata
27792
28439
  });
27793
- void load.catch(() => {
28440
+ void resume.catch(() => {
27794
28441
  }).finally(() => {
27795
28442
  reviving.delete(sessionId);
27796
28443
  });
27797
28444
  try {
27798
- await withTimeout(load, reviveTimeoutMs, `loadSession(${sessionId})`);
28445
+ await withTimeout(
28446
+ resume,
28447
+ reviveTimeoutMs,
28448
+ `resumeSession(${sessionId})`
28449
+ );
27799
28450
  log.debug("keepalive: revived non-resident session", sessionId);
27800
28451
  reviveState.delete(sessionId);
27801
28452
  } catch (loadErr) {
@@ -27854,8 +28505,8 @@ function startScheduledTaskKeepalive(opts) {
27854
28505
  opts.runtimeBaseDir,
27855
28506
  () => getCronFilePath(boundWorkspace)
27856
28507
  );
27857
- const cronDir = path12.dirname(cronFilePath);
27858
- const cronFileName = path12.basename(cronFilePath);
28508
+ const cronDir = path13.dirname(cronFilePath);
28509
+ const cronFileName = path13.basename(cronFilePath);
27859
28510
  let fileWatcher;
27860
28511
  try {
27861
28512
  fsSync.mkdirSync(cronDir, { recursive: true });
@@ -27892,11 +28543,11 @@ function startScheduledTaskKeepalive(opts) {
27892
28543
  };
27893
28544
  }
27894
28545
  __name(startScheduledTaskKeepalive, "startScheduledTaskKeepalive");
27895
- var REHYDRATE_LOAD_TIMEOUT_MS = 7e4;
28546
+ var REHYDRATE_RESUME_TIMEOUT_MS = 7e4;
27896
28547
  var REHYDRATE_MAX_CONCURRENCY = 4;
27897
28548
  async function rehydrateScheduledTaskSessions(deps) {
27898
28549
  const { bridge, boundWorkspace } = deps;
27899
- const timeoutMs = deps.loadTimeoutMs ?? REHYDRATE_LOAD_TIMEOUT_MS;
28550
+ const timeoutMs = deps.loadTimeoutMs ?? REHYDRATE_RESUME_TIMEOUT_MS;
27900
28551
  let tasks;
27901
28552
  try {
27902
28553
  tasks = await readCronTasks(boundWorkspace);
@@ -27916,16 +28567,15 @@ async function rehydrateScheduledTaskSessions(deps) {
27916
28567
  const metadata = await new SessionService(
27917
28568
  boundWorkspace
27918
28569
  ).readCreationMetadata(sessionId);
27919
- const load = bridge.loadSession({
28570
+ const resume = bridge.resumeSession({
27920
28571
  sessionId,
27921
28572
  workspaceCwd: boundWorkspace,
27922
- historyReplay: "response",
27923
28573
  ...metadata
27924
28574
  });
27925
- void load.catch(() => {
28575
+ void resume.catch(() => {
27926
28576
  });
27927
28577
  try {
27928
- await withTimeout(load, timeoutMs, `loadSession(${sessionId})`);
28578
+ await withTimeout(resume, timeoutMs, `resumeSession(${sessionId})`);
27929
28579
  loaded.push(sessionId);
27930
28580
  } catch (err) {
27931
28581
  failed.push(sessionId);
@@ -28519,6 +29169,7 @@ function registerCapabilitiesRoutes(app, deps) {
28519
29169
  deps.maxPendingPromptsPerSession
28520
29170
  ),
28521
29171
  sessionRestoreTimeoutMs: deps.sessionRestoreTimeoutMs,
29172
+ ...features.includes("workspace_file_upload") ? { maxWorkspaceFileUploadBytes: MAX_UPLOAD_BYTES } : {},
28522
29173
  ...multiWorkspace ? {
28523
29174
  maxSessionsPerWorkspace: advertisedMaxSessions(
28524
29175
  deps.maxSessionsPerWorkspace
@@ -30837,7 +31488,7 @@ __name(registerWorkspaceModelsRoutes, "registerWorkspaceModelsRoutes");
30837
31488
  // packages/cli/src/serve/routes/a2ui-action.ts
30838
31489
  init_esbuild_shims();
30839
31490
  import * as fsp4 from "node:fs/promises";
30840
- import * as path13 from "node:path";
31491
+ import * as path14 from "node:path";
30841
31492
  var A2UI_MIME = "application/a2ui+json";
30842
31493
  var ACTION_TOOL = "action";
30843
31494
  var CALL_TIMEOUT_MS = 15e3;
@@ -30860,7 +31511,7 @@ __name(usableServerConfig, "usableServerConfig");
30860
31511
  async function findFromSettingsFile(workspaceCwd) {
30861
31512
  try {
30862
31513
  const raw = await fsp4.readFile(
30863
- path13.join(workspaceCwd, ".qwen", "settings.json"),
31514
+ path14.join(workspaceCwd, ".qwen", "settings.json"),
30864
31515
  "utf8"
30865
31516
  );
30866
31517
  const settings = JSON.parse(raw);
@@ -31021,7 +31672,7 @@ __name(registerA2uiActionRoutes, "registerA2uiActionRoutes");
31021
31672
 
31022
31673
  // packages/cli/src/serve/server/fs-factory.ts
31023
31674
  init_esbuild_shims();
31024
- import * as path14 from "node:path";
31675
+ import * as path15 from "node:path";
31025
31676
  var IDE_WORKSPACE_PATH_ENV_VAR = "QWEN_CODE_IDE_WORKSPACE_PATH";
31026
31677
  function createDefaultFsAuditEmit() {
31027
31678
  const WARN_EVERY = 100;
@@ -31096,14 +31747,14 @@ function parseIdeWorkspacePathEnv(value) {
31096
31747
  const parsed = JSON.parse(value);
31097
31748
  if (Array.isArray(parsed) && parsed.every((item) => typeof item === "string")) {
31098
31749
  return parsed.filter(
31099
- (workspace) => workspace.length > 0 && path14.isAbsolute(workspace)
31750
+ (workspace) => workspace.length > 0 && path15.isAbsolute(workspace)
31100
31751
  );
31101
31752
  }
31102
31753
  throw new Error("IDE workspace path JSON must be a string array");
31103
31754
  } catch {
31104
31755
  }
31105
31756
  }
31106
- return value.split(path14.delimiter).filter((workspace) => workspace.length > 0 && path14.isAbsolute(workspace));
31757
+ return value.split(path15.delimiter).filter((workspace) => workspace.length > 0 && path15.isAbsolute(workspace));
31107
31758
  }
31108
31759
  __name(parseIdeWorkspacePathEnv, "parseIdeWorkspacePathEnv");
31109
31760
  function dropNestedWorkspacesPreservingPrimary(workspaces) {
@@ -31372,9 +32023,9 @@ __name(setupDeviceFlowRegistry, "setupDeviceFlowRegistry");
31372
32023
 
31373
32024
  // packages/cli/src/serve/server/error-handlers.ts
31374
32025
  init_esbuild_shims();
31375
- var import_express3 = __toESM(require_express(), 1);
32026
+ var import_express4 = __toESM(require_express(), 1);
31376
32027
  function installJsonBodyParser(app) {
31377
- app.use(import_express3.default.json({ limit: "10mb" }));
32028
+ app.use(import_express4.default.json({ limit: "10mb" }));
31378
32029
  app.use((err, _req, res, next) => {
31379
32030
  if (sendJsonBodyParserError(res, err)) return;
31380
32031
  next(err);
@@ -31428,10 +32079,10 @@ function installRateLimiter(app, opts, daemonLog, options = {}) {
31428
32079
  { tier, key: key.slice(0, 64) }
31429
32080
  );
31430
32081
  } : void 0,
31431
- onError: daemonLog ? (err, path16) => {
32082
+ onError: daemonLog ? (err, path17) => {
31432
32083
  daemonLog.warn(
31433
32084
  `rate limiter error (fail-open): ${err instanceof Error ? err.message : String(err)}`,
31434
- { path: path16 }
32085
+ { path: path17 }
31435
32086
  );
31436
32087
  } : void 0
31437
32088
  });
@@ -31627,7 +32278,7 @@ __name(registerWorkspaceQualifiedLifecycleRoutes, "registerWorkspaceQualifiedLif
31627
32278
  init_esbuild_shims();
31628
32279
  import { readdir as readdir2, stat as stat2 } from "node:fs/promises";
31629
32280
  import { realpathSync as realpathSync3 } from "node:fs";
31630
- import { basename as basename4, dirname as dirname4, isAbsolute as isAbsolute7, join as join8, resolve as resolve4, sep as sep3 } from "node:path";
32281
+ import { basename as basename5, dirname as dirname5, isAbsolute as isAbsolute7, join as join9, resolve as resolve4, sep as sep3 } from "node:path";
31631
32282
 
31632
32283
  // packages/cli/src/serve/native-directory-picker.ts
31633
32284
  init_esbuild_shims();
@@ -31806,7 +32457,7 @@ function registerWorkspaceManagementRoutes(app, deps) {
31806
32457
  throw new Error("Workspace registration limit reached");
31807
32458
  }
31808
32459
  }, "assertOwnedRuntimeAdmission");
31809
- const publishOwnedRuntime = /* @__PURE__ */ __name(async (canonicalCwd, provenance, validate) => {
32460
+ const publishOwnedRuntime = /* @__PURE__ */ __name(async (canonicalCwd, provenance, validateBeforePublication) => {
31810
32461
  if (!createWorkspaceRuntime || !runtimeRemoval) {
31811
32462
  throw new Error("Managed workspace runtime publication is unavailable");
31812
32463
  }
@@ -31817,7 +32468,10 @@ function registerWorkspaceManagementRoutes(app, deps) {
31817
32468
  let registered = false;
31818
32469
  try {
31819
32470
  runtime = await createWorkspaceRuntime(canonicalCwd, { provenance });
31820
- await validate(runtime);
32471
+ if (runtime.primary) {
32472
+ throw new Error("Daemon-owned workspace runtime must not be primary");
32473
+ }
32474
+ await validateBeforePublication(runtime);
31821
32475
  const publish = /* @__PURE__ */ __name(async () => {
31822
32476
  if (sealed) throw new Error("Daemon is shutting down");
31823
32477
  if (workspaceRegistry.getManagedByWorkspaceCwd(canonicalCwd)) {
@@ -32013,8 +32667,8 @@ function registerWorkspaceManagementRoutes(app, deps) {
32013
32667
  return;
32014
32668
  }
32015
32669
  const endsWithSep = prefix.endsWith("/") || process.platform === "win32" && prefix.endsWith("\\");
32016
- const dir = endsWithSep ? join8(prefix, ".") : dirname4(prefix);
32017
- const filter = endsWithSep ? "" : basename4(prefix);
32670
+ const dir = endsWithSep ? join9(prefix, ".") : dirname5(prefix);
32671
+ const filter = endsWithSep ? "" : basename5(prefix);
32018
32672
  const filterLower = filter.toLowerCase();
32019
32673
  const suggestions = [];
32020
32674
  let truncated = false;
@@ -32029,7 +32683,7 @@ function registerWorkspaceManagementRoutes(app, deps) {
32029
32683
  let isDir = entry.isDirectory();
32030
32684
  if (!isDir && entry.isSymbolicLink()) {
32031
32685
  try {
32032
- isDir = (await stat2(join8(dir, entry.name))).isDirectory();
32686
+ isDir = (await stat2(join9(dir, entry.name))).isDirectory();
32033
32687
  } catch {
32034
32688
  continue;
32035
32689
  }
@@ -32039,7 +32693,7 @@ function registerWorkspaceManagementRoutes(app, deps) {
32039
32693
  truncated = true;
32040
32694
  break;
32041
32695
  }
32042
- suggestions.push({ name: entry.name, path: join8(dir, entry.name) });
32696
+ suggestions.push({ name: entry.name, path: join9(dir, entry.name) });
32043
32697
  }
32044
32698
  } catch {
32045
32699
  }
@@ -32059,11 +32713,11 @@ function registerWorkspaceManagementRoutes(app, deps) {
32059
32713
  const controller = new AbortController();
32060
32714
  res.on("close", () => controller.abort());
32061
32715
  try {
32062
- const path16 = await pickWorkspaceDirectory(controller.signal);
32716
+ const path17 = await pickWorkspaceDirectory(controller.signal);
32063
32717
  res.status(200).json({
32064
32718
  kind: "workspace-directory-picker",
32065
- selected: path16 !== void 0,
32066
- ...path16 === void 0 ? {} : { path: path16 }
32719
+ selected: path17 !== void 0,
32720
+ ...path17 === void 0 ? {} : { path: path17 }
32067
32721
  });
32068
32722
  } catch (error2) {
32069
32723
  const detail = error2 instanceof Error ? error2.message : String(error2);
@@ -33120,8 +33774,8 @@ function buildDiffList(workspaceCwd, result) {
33120
33774
  hiddenCount: 0
33121
33775
  };
33122
33776
  }
33123
- const files = [...result.perFileStats.entries()].map(([path16, s]) => ({
33124
- path: path16,
33777
+ const files = [...result.perFileStats.entries()].map(([path17, s]) => ({
33778
+ path: path17,
33125
33779
  oldPath: s.oldPath,
33126
33780
  added: s.added,
33127
33781
  removed: s.removed,
@@ -36113,7 +36767,7 @@ __name(registerWorkspaceQualifiedSkillsRoutes, "registerWorkspaceQualifiedSkills
36113
36767
 
36114
36768
  // packages/cli/src/serve/routes/channel-webhooks.ts
36115
36769
  init_esbuild_shims();
36116
- var import_express4 = __toESM(require_express(), 1);
36770
+ var import_express5 = __toESM(require_express(), 1);
36117
36771
  import { createHash as createHash4, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
36118
36772
  var PROTOTYPE_POLLUTION_KEYS = /* @__PURE__ */ new Set([
36119
36773
  "__proto__",
@@ -36162,7 +36816,7 @@ function registerChannelWebhookRoutes(app, deps) {
36162
36816
  locals.channelWebhook = { channelName, source, sourceConfig };
36163
36817
  next();
36164
36818
  },
36165
- import_express4.default.json({ limit: "1mb" }),
36819
+ import_express5.default.json({ limit: "1mb" }),
36166
36820
  async (req, res) => {
36167
36821
  const locals = res.locals;
36168
36822
  const webhook = locals.channelWebhook;
@@ -39664,7 +40318,7 @@ import { createHash as createHash5, randomUUID as randomUUID11 } from "node:cryp
39664
40318
  import * as fs7 from "node:fs";
39665
40319
  import * as fsp5 from "node:fs/promises";
39666
40320
  import * as os2 from "node:os";
39667
- import * as path15 from "node:path";
40321
+ import * as path16 from "node:path";
39668
40322
  import { Readable, Transform } from "node:stream";
39669
40323
  import { pipeline } from "node:stream/promises";
39670
40324
  import { promisify as promisify3 } from "node:util";
@@ -39744,7 +40398,7 @@ async function readBundleValue(appPath, key) {
39744
40398
  "raw",
39745
40399
  "-o",
39746
40400
  "-",
39747
- path15.join(appPath, "Contents", "Info.plist")
40401
+ path16.join(appPath, "Contents", "Info.plist")
39748
40402
  ]);
39749
40403
  }
39750
40404
  __name(readBundleValue, "readBundleValue");
@@ -39886,11 +40540,11 @@ async function downloadLiveHostRelease(currentArchitecture, destination, onProgr
39886
40540
  __name(downloadLiveHostRelease, "downloadLiveHostRelease");
39887
40541
  async function installLatestHost(currentArchitecture, onStatus) {
39888
40542
  const temporaryDirectory = await fsp5.mkdtemp(
39889
- path15.join(os2.tmpdir(), "qwen-live-host-")
40543
+ path16.join(os2.tmpdir(), "qwen-live-host-")
39890
40544
  );
39891
- const archivePath = path15.join(temporaryDirectory, "Qwen-Live-Host.zip");
39892
- const extractedPath = path15.join(temporaryDirectory, "extracted");
39893
- const candidatePath = path15.join(extractedPath, LIVE_HOST_APP_NAME);
40545
+ const archivePath = path16.join(temporaryDirectory, "Qwen-Live-Host.zip");
40546
+ const extractedPath = path16.join(temporaryDirectory, "extracted");
40547
+ const candidatePath = path16.join(extractedPath, LIVE_HOST_APP_NAME);
39894
40548
  const stagingPath = `/Applications/.Qwen Live Host.install-${randomUUID11()}.app`;
39895
40549
  const backupPath = `/Applications/.Qwen Live Host.backup-${randomUUID11()}.app`;
39896
40550
  let movedExisting = false;
@@ -40042,13 +40696,13 @@ var LiveHostInstaller = class {
40042
40696
  init_esbuild_shims();
40043
40697
  import { createHash as createHash6, randomUUID as randomUUID12 } from "node:crypto";
40044
40698
  import { createWriteStream as createWriteStream2, mkdirSync as mkdirSync2 } from "node:fs";
40045
- import { join as join11 } from "node:path";
40699
+ import { join as join12 } from "node:path";
40046
40700
 
40047
40701
  // packages/cli/src/serve/live/realtime-startup-context.ts
40048
40702
  init_esbuild_shims();
40049
40703
  import { readdirSync } from "node:fs";
40050
40704
  import { homedir } from "node:os";
40051
- import { basename as basename5, join as join10 } from "node:path";
40705
+ import { basename as basename6, join as join11 } from "node:path";
40052
40706
  var STARTUP_CONTEXT_HEADER = "Startup context from Qwen Code.\nThis is background context about recent work and machine/workspace layout. It may be incomplete or stale. Use it to inform responses, and do not repeat it back unless relevant.";
40053
40707
  var CURRENT_THREAD_SECTION_TOKEN_BUDGET = 1200;
40054
40708
  var RECENT_WORK_SECTION_TOKEN_BUDGET = 2200;
@@ -40290,7 +40944,7 @@ function collectTreeLines(directory, depth, lines) {
40290
40944
  const indent = " ".repeat(depth);
40291
40945
  lines.push(`${indent}- ${entry.name}${entry.isDirectory() ? "/" : ""}`);
40292
40946
  if (entry.isDirectory()) {
40293
- collectTreeLines(join10(directory, entry.name), depth + 1, lines);
40947
+ collectTreeLines(join11(directory, entry.name), depth + 1, lines);
40294
40948
  }
40295
40949
  }
40296
40950
  if (entries.length > DIR_ENTRY_LIMIT) {
@@ -40314,11 +40968,11 @@ function buildWorkspaceSection(currentCwd, userRoot) {
40314
40968
  if (!cwdTree && !gitRoot && !userRootTree) return void 0;
40315
40969
  const lines = [
40316
40970
  `Current working directory: ${currentCwd}`,
40317
- `Working directory name: ${basename5(currentCwd) || currentCwd}`
40971
+ `Working directory name: ${basename6(currentCwd) || currentCwd}`
40318
40972
  ];
40319
40973
  if (gitRoot) {
40320
40974
  lines.push(`Git root: ${gitRoot}`);
40321
- lines.push(`Git project: ${basename5(gitRoot) || gitRoot}`);
40975
+ lines.push(`Git project: ${basename6(gitRoot) || gitRoot}`);
40322
40976
  }
40323
40977
  if (userRoot) lines.push(`User root: ${userRoot}`);
40324
40978
  if (cwdTree) lines.push("", "Working directory tree:", ...cwdTree);
@@ -40409,13 +41063,13 @@ function openLiveAudioCapture(source, identifier) {
40409
41063
  try {
40410
41064
  mkdirSync2(directory, { recursive: true, mode: 448 });
40411
41065
  const safeIdentifier = identifier.replace(/[^A-Za-z0-9_-]/g, "_");
40412
- const path16 = join11(
41066
+ const path17 = join12(
40413
41067
  directory,
40414
41068
  `${source}-${Date.now()}-${safeIdentifier}.pcm`
40415
41069
  );
40416
- const stream = createWriteStream2(path16, { flags: "wx", mode: 384 });
41070
+ const stream = createWriteStream2(path17, { flags: "wx", mode: 384 });
40417
41071
  stream.on("error", () => void 0);
40418
- return { source, path: path16, stream, hash: createHash6("sha256"), bytes: 0 };
41072
+ return { source, path: path17, stream, hash: createHash6("sha256"), bytes: 0 };
40419
41073
  } catch {
40420
41074
  return void 0;
40421
41075
  }
@@ -42698,6 +43352,91 @@ var LiveTaskService = class {
42698
43352
  }
42699
43353
  };
42700
43354
 
43355
+ // packages/cli/src/serve/conversations/conversation-runtime-manager.ts
43356
+ init_esbuild_shims();
43357
+ var ConversationRuntimeManager = class {
43358
+ constructor(options) {
43359
+ this.options = options;
43360
+ }
43361
+ static {
43362
+ __name(this, "ConversationRuntimeManager");
43363
+ }
43364
+ runtime;
43365
+ pending;
43366
+ ensure() {
43367
+ if (this.pending) return this.pending;
43368
+ const pending = this.ensureOnce().finally(() => {
43369
+ if (this.pending === pending) this.pending = void 0;
43370
+ });
43371
+ this.pending = pending;
43372
+ return pending;
43373
+ }
43374
+ async ensureOnce() {
43375
+ const root = await this.options.workspace.revalidate();
43376
+ if (this.runtime) {
43377
+ await this.options.workspace.assertExactRoot(this.runtime.workspaceCwd);
43378
+ this.assertActiveRuntime(
43379
+ root.canonicalRoot,
43380
+ this.runtime,
43381
+ "Live conversation runtime is no longer an active owned runtime."
43382
+ );
43383
+ return this.runtime;
43384
+ }
43385
+ const entry = this.options.registry.getEntryByWorkspaceCwd(
43386
+ root.canonicalRoot
43387
+ );
43388
+ if (entry) {
43389
+ const existing = entry.current?.runtime;
43390
+ if (entry.state !== "active" || !existing) {
43391
+ throw new Error(
43392
+ "Live conversation runtime is no longer an active owned runtime."
43393
+ );
43394
+ }
43395
+ this.assertOwnedRuntime(
43396
+ existing,
43397
+ "Live conversation root is already registered without Live provenance."
43398
+ );
43399
+ await this.options.workspace.assertExactRoot(existing.workspaceCwd);
43400
+ this.assertActiveRuntime(
43401
+ root.canonicalRoot,
43402
+ existing,
43403
+ "Live conversation runtime is no longer an active owned runtime."
43404
+ );
43405
+ this.runtime = existing;
43406
+ return existing;
43407
+ }
43408
+ const created = await this.options.publishRuntime(
43409
+ root.canonicalRoot,
43410
+ async (candidate) => {
43411
+ await this.options.workspace.assertExactRoot(candidate.workspaceCwd);
43412
+ this.assertOwnedRuntime(
43413
+ candidate,
43414
+ "Live conversation runtime failed its ownership gate."
43415
+ );
43416
+ }
43417
+ );
43418
+ this.assertActiveRuntime(
43419
+ root.canonicalRoot,
43420
+ created,
43421
+ "Live conversation runtime is no longer an active owned runtime."
43422
+ );
43423
+ this.runtime = created;
43424
+ return created;
43425
+ }
43426
+ assertActiveRuntime(canonicalRoot, runtime, message) {
43427
+ this.assertOwnedRuntime(runtime, message);
43428
+ const entry = this.options.registry.getEntryByWorkspaceCwd(canonicalRoot);
43429
+ if (entry?.state !== "active" || entry.current?.runtime !== runtime) {
43430
+ throw new Error(message);
43431
+ }
43432
+ }
43433
+ assertOwnedRuntime(runtime, message) {
43434
+ if (runtime.primary || runtime.provenance !== "live-conversation" || !runtime.trusted || runtime.removable !== false) {
43435
+ throw new Error(message);
43436
+ }
43437
+ }
43438
+ };
43439
+
42701
43440
  // packages/cli/src/serve/server.ts
42702
43441
  var warnedDefaultTrust = false;
42703
43442
  function loadServeChannelWebhookConfigs(sources) {
@@ -42811,7 +43550,7 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
42811
43550
  "createServeApp: runtime replacement/removal requires deps.getSessionBridges so session-id admission can inspect draining generations."
42812
43551
  );
42813
43552
  }
42814
- const app = (0, import_express5.default)();
43553
+ const app = (0, import_express6.default)();
42815
43554
  const injectedWorkspaceRegistry = deps.workspaceRegistry;
42816
43555
  const boundWorkspace = injectedWorkspaceRegistry?.primary.workspaceCwd ?? deps.boundWorkspace ?? canonicalizeWorkspace(opts.workspace ?? process.cwd());
42817
43556
  if (injectedWorkspaceRegistry) {
@@ -43184,94 +43923,95 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
43184
43923
  message: "The Live Appshot channel is unavailable."
43185
43924
  }
43186
43925
  );
43187
- let liveRuntime;
43188
- let liveRuntimePromise;
43926
+ const conversationRuntimeManager = deps.liveConversationWorkspace ? new ConversationRuntimeManager({
43927
+ workspace: deps.liveConversationWorkspace,
43928
+ registry: workspaceRegistry,
43929
+ publishRuntime: /* @__PURE__ */ __name(async (canonicalRoot, validate) => {
43930
+ const runtime = await workspaceManagementHandle.publishOwnedRuntime(
43931
+ canonicalRoot,
43932
+ "live-conversation",
43933
+ async (candidate) => {
43934
+ await validate(candidate);
43935
+ await deps.liveConversationWorkspace.revalidate();
43936
+ }
43937
+ );
43938
+ invalidateServeFeaturesCache();
43939
+ return runtime;
43940
+ }, "publishRuntime")
43941
+ }) : void 0;
43942
+ let liveBoundRuntime;
43943
+ let liveBindingPromise;
43189
43944
  let liveRuntimeBootPromise;
43190
43945
  let liveAppshotChannelPromise;
43191
43946
  let liveCoordinatorSealed = false;
43192
- const bindLiveAppshotHandler = /* @__PURE__ */ __name((runtime) => {
43947
+ const clearLiveRuntimeHandlers = /* @__PURE__ */ __name((runtime) => {
43948
+ const handlers = [
43949
+ runtime.bridge.setLiveScreenContextCaptureHandler,
43950
+ runtime.bridge.setLiveTaskToolRequestHandler,
43951
+ runtime.bridge.setLiveSpeakToUserHandler
43952
+ ];
43953
+ for (const clear of handlers) {
43954
+ try {
43955
+ clear?.call(runtime.bridge, void 0);
43956
+ } catch {
43957
+ continue;
43958
+ }
43959
+ }
43960
+ }, "clearLiveRuntimeHandlers");
43961
+ const bindLiveRuntimeHandlers = /* @__PURE__ */ __name((runtime) => {
43193
43962
  if (liveCoordinatorSealed) {
43194
43963
  throw new Error("Live Voice is shutting down.");
43195
43964
  }
43196
- const setHandler = runtime.bridge.setLiveScreenContextCaptureHandler;
43197
- if (!setHandler) {
43965
+ const setScreenHandler = runtime.bridge.setLiveScreenContextCaptureHandler;
43966
+ const setTaskHandler = runtime.bridge.setLiveTaskToolRequestHandler;
43967
+ const setSpeakHandler = runtime.bridge.setLiveSpeakToUserHandler;
43968
+ if (!setScreenHandler) {
43198
43969
  throw new Error("Live conversation runtime has no Appshot channel.");
43199
43970
  }
43200
- setHandler.call(
43201
- runtime.bridge,
43202
- ({ callerSessionId }) => liveCoordinator.captureScreenContext(callerSessionId)
43203
- );
43204
- const setTaskHandler = runtime.bridge.setLiveTaskToolRequestHandler;
43205
43971
  if (!setTaskHandler) {
43206
43972
  throw new Error("Live conversation runtime has no task-tool channel.");
43207
43973
  }
43208
- setTaskHandler.call(runtime.bridge, (info) => liveTaskService.handle(info));
43209
- const setSpeakHandler = runtime.bridge.setLiveSpeakToUserHandler;
43210
43974
  if (!setSpeakHandler) {
43211
43975
  throw new Error("Live conversation runtime has no speech channel.");
43212
43976
  }
43213
- setSpeakHandler.call(
43214
- runtime.bridge,
43215
- ({ callerSessionId, message }) => liveSessionCoordinator.speakToUser(callerSessionId, message)
43216
- );
43217
- }, "bindLiveAppshotHandler");
43977
+ liveBoundRuntime = runtime;
43978
+ try {
43979
+ setScreenHandler.call(
43980
+ runtime.bridge,
43981
+ ({ callerSessionId }) => liveCoordinator.captureScreenContext(callerSessionId)
43982
+ );
43983
+ setTaskHandler.call(
43984
+ runtime.bridge,
43985
+ (info) => liveTaskService.handle(info)
43986
+ );
43987
+ setSpeakHandler.call(
43988
+ runtime.bridge,
43989
+ ({ callerSessionId, message }) => liveSessionCoordinator.speakToUser(callerSessionId, message)
43990
+ );
43991
+ } catch (error2) {
43992
+ clearLiveRuntimeHandlers(runtime);
43993
+ throw error2;
43994
+ }
43995
+ }, "bindLiveRuntimeHandlers");
43218
43996
  const ensureLiveConversationRuntime = /* @__PURE__ */ __name(() => {
43219
43997
  if (liveCoordinatorSealed) {
43220
43998
  return Promise.reject(new Error("Live Voice is shutting down."));
43221
43999
  }
43222
- if (liveRuntimePromise) return liveRuntimePromise;
44000
+ if (liveBindingPromise) return liveBindingPromise;
43223
44001
  const pending = (async () => {
43224
- const conversationWorkspace = deps.liveConversationWorkspace;
43225
- const runtimePublisher = workspaceManagementHandle;
43226
- if (!conversationWorkspace || !runtimePublisher) {
44002
+ if (!conversationRuntimeManager) {
43227
44003
  throw new Error("Live conversation runtime is unavailable.");
43228
44004
  }
43229
- const root = await conversationWorkspace.revalidate();
43230
- if (liveRuntime) {
43231
- await conversationWorkspace.assertExactRoot(liveRuntime.workspaceCwd);
43232
- const entry = workspaceRegistry.getEntryByWorkspaceCwd(
43233
- root.canonicalRoot
43234
- );
43235
- if (entry?.state !== "active" || entry.current?.runtime !== liveRuntime || liveRuntime.provenance !== "live-conversation" || !liveRuntime.trusted || liveRuntime.removable !== false) {
43236
- throw new Error(
43237
- "Live conversation runtime is no longer an active owned runtime."
43238
- );
43239
- }
43240
- bindLiveAppshotHandler(liveRuntime);
43241
- return liveRuntime;
43242
- }
43243
- const existing = workspaceRegistry.getByWorkspaceCwd(root.canonicalRoot);
43244
- if (existing) {
43245
- if (existing.provenance !== "live-conversation" || !existing.trusted || existing.removable !== false) {
43246
- throw new Error(
43247
- "Live conversation root is already registered without Live provenance."
43248
- );
43249
- }
43250
- await conversationWorkspace.assertExactRoot(existing.workspaceCwd);
43251
- liveRuntime = existing;
43252
- bindLiveAppshotHandler(existing);
43253
- return existing;
44005
+ const runtime = await conversationRuntimeManager.ensure();
44006
+ if (liveCoordinatorSealed) {
44007
+ throw new Error("Live Voice is shutting down.");
43254
44008
  }
43255
- const created = await runtimePublisher.publishOwnedRuntime(
43256
- root.canonicalRoot,
43257
- "live-conversation",
43258
- async (candidate) => {
43259
- await conversationWorkspace.assertExactRoot(candidate.workspaceCwd);
43260
- if (candidate.provenance !== "live-conversation" || !candidate.trusted || candidate.removable !== false) {
43261
- throw new Error(
43262
- "Live conversation runtime failed its ownership gate."
43263
- );
43264
- }
43265
- }
43266
- );
43267
- liveRuntime = created;
43268
- bindLiveAppshotHandler(created);
43269
- invalidateServeFeaturesCache();
43270
- return created;
44009
+ bindLiveRuntimeHandlers(runtime);
44010
+ return runtime;
43271
44011
  })().finally(() => {
43272
- if (liveRuntimePromise === pending) liveRuntimePromise = void 0;
44012
+ if (liveBindingPromise === pending) liveBindingPromise = void 0;
43273
44013
  });
43274
- liveRuntimePromise = pending;
44014
+ liveBindingPromise = pending;
43275
44015
  return pending;
43276
44016
  }, "ensureLiveConversationRuntime");
43277
44017
  const verifyLiveAppshotChannel = /* @__PURE__ */ __name(() => {
@@ -43395,9 +44135,7 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
43395
44135
  liveCoordinatorSealed = true;
43396
44136
  if (liveCoordinatorStopped) return;
43397
44137
  liveCoordinatorStopped = true;
43398
- liveRuntime?.bridge.setLiveScreenContextCaptureHandler?.(void 0);
43399
- liveRuntime?.bridge.setLiveTaskToolRequestHandler?.(void 0);
43400
- liveRuntime?.bridge.setLiveSpeakToUserHandler?.(void 0);
44138
+ if (liveBoundRuntime) clearLiveRuntimeHandlers(liveBoundRuntime);
43401
44139
  liveSessionCoordinator.dispose();
43402
44140
  liveCoordinator.dispose();
43403
44141
  }, "stopLiveCoordinator");
@@ -43405,7 +44143,7 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
43405
44143
  app.locals.sealAndWaitLiveCoordinator = async () => {
43406
44144
  stopLiveCoordinator();
43407
44145
  await Promise.all([
43408
- liveRuntimePromise?.catch(() => void 0),
44146
+ liveBindingPromise?.catch(() => void 0),
43409
44147
  liveAppshotChannelPromise?.catch(() => void 0)
43410
44148
  ]);
43411
44149
  };
@@ -43810,6 +44548,23 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
43810
44548
  safeBody,
43811
44549
  workspaceRegistry
43812
44550
  });
44551
+ const uploadGate = createUploadConcurrencyGate();
44552
+ registerWorkspaceFileUploadRoutes(app, {
44553
+ bridge: primaryBridge,
44554
+ mutate,
44555
+ parseClientId: parseClientIdHeader,
44556
+ safeBody,
44557
+ uploadGate,
44558
+ ...primaryRuntimeTrustAuthoritative ? { isWorkspaceTrusted: isPrimaryWorkspaceTrusted } : {}
44559
+ });
44560
+ registerWorkspaceQualifiedFileUploadRoutes(app, {
44561
+ bridge: primaryBridge,
44562
+ mutate,
44563
+ parseClientId: parseClientIdHeader,
44564
+ safeBody,
44565
+ uploadGate,
44566
+ workspaceRegistry
44567
+ });
43813
44568
  registerWorkspaceSetupGithubRoutes(app, {
43814
44569
  boundWorkspace: primaryBoundWorkspace,
43815
44570
  bridge: primaryBridge,