@qwen-code/qwen-code 0.21.1-simplify-system-prompt.0 → 0.21.2-nightly.20260801.bc382c3ff

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 (437) hide show
  1. package/bundled/qc-helper/docs/configuration/model-providers.md +2 -0
  2. package/bundled/qc-helper/docs/configuration/settings.md +42 -30
  3. package/bundled/qc-helper/docs/features/channels/_meta.ts +2 -0
  4. package/bundled/qc-helper/docs/features/channels/github.md +146 -0
  5. package/bundled/qc-helper/docs/features/channels/gitlab.md +177 -0
  6. package/bundled/qc-helper/docs/features/channels/overview.md +61 -6
  7. package/bundled/qc-helper/docs/features/code-review.md +21 -1
  8. package/bundled/qc-helper/docs/features/commands.md +1 -0
  9. package/bundled/qc-helper/docs/features/hooks.md +186 -32
  10. package/bundled/qc-helper/docs/features/mcp.md +9 -1
  11. package/bundled/qc-helper/docs/features/memory.md +27 -0
  12. package/bundled/qc-helper/docs/features/scheduled-tasks.md +3 -1
  13. package/bundled/qc-helper/docs/features/skills.md +14 -0
  14. package/bundled/qc-helper/docs/features/sub-agents.md +75 -8
  15. package/bundled/qc-helper/docs/features/tool-use-summaries.md +7 -7
  16. package/bundled/qc-helper/docs/qwen-serve.md +32 -8
  17. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +4 -4
  18. package/bundled/qc-helper/docs/support/troubleshooting.md +2 -1
  19. package/bundled/review/DESIGN.md +19 -0
  20. package/bundled/review/SKILL.md +120 -61
  21. package/chunks/MaxSizedBox-CDHTDITS.js +89 -0
  22. package/chunks/{StandaloneSessionPicker-O6RKBPU4.js → StandaloneSessionPicker-L63HUAHP.js} +76 -73
  23. package/chunks/{acp-startup-profiler-RV3IV562.js → acp-startup-profiler-3RICG2YW.js} +2 -2
  24. package/chunks/{acpAgent-HYFVXVDR.js → acpAgent-6WVVT2P3.js} +2147 -1009
  25. package/chunks/agent-KDM4CBOU.js +85 -0
  26. package/chunks/agent-headless-AS7K2K57.js +79 -0
  27. package/chunks/{anthropicContentGenerator-LXUXMOE7.js → anthropicContentGenerator-WCBYB6JG.js} +388 -37
  28. package/chunks/{artifact-tool-Y5T7GG7F.js → artifact-tool-ANV4CFCR.js} +4 -4
  29. package/chunks/{askUserQuestion-2H6747FR.js → askUserQuestion-MALEB47H.js} +4 -4
  30. package/chunks/bridge-JNEW6FES.js +95 -0
  31. package/chunks/{build-RV63TIRH.js → build-GDBLPA24.js} +1 -1
  32. package/chunks/{ca-25EDXPFZ.js → ca-4OJN75WT.js} +52 -6
  33. package/chunks/{channel-management-service-G74LFADV.js → channel-management-service-QOO7TD3T.js} +21 -6
  34. package/chunks/channel-settings-store-4CSMTR4L.js +92 -0
  35. package/chunks/{channel-worker-group-PTJIJSKC.js → channel-worker-group-ERSUOPIR.js} +10 -6
  36. package/chunks/{channel-worker-manager-WIMGM2FD.js → channel-worker-manager-X247YDQ7.js} +10 -6
  37. package/chunks/{channel-worker-supervisor-KUFTR6P5.js → channel-worker-supervisor-ORJIEEPP.js} +6 -5
  38. package/chunks/{chunk-LNARWLZQ.js → chunk-25QQVOCG.js} +5 -5
  39. package/chunks/{chunk-2OM7GEXO.js → chunk-2A6MHYIA.js} +3 -3
  40. package/chunks/{chunk-ER5LWJR6.js → chunk-2CTKGIFR.js} +3 -3
  41. package/chunks/{chunk-SQBYH7PX.js → chunk-2DNKEBXY.js} +1 -1
  42. package/chunks/{chunk-6GMVPFB2.js → chunk-2IIJTXYF.js} +45 -16
  43. package/chunks/{chunk-BPJSQIJX.js → chunk-2J3OJGTL.js} +0 -2
  44. package/chunks/chunk-2M5N3DHY.js +378 -0
  45. package/chunks/{chunk-CC4N4M36.js → chunk-2PNQQ4UR.js} +2 -2
  46. package/chunks/{chunk-E5TUC6CA.js → chunk-2UISUFHQ.js} +3 -3
  47. package/chunks/{chunk-PWTZEM3C.js → chunk-33FNCQSY.js} +3 -37
  48. package/chunks/{chunk-J56UI34H.js → chunk-3LGZEYOF.js} +4 -2
  49. package/chunks/{chunk-66RMLJHC.js → chunk-3MHPWQ2M.js} +590 -212
  50. package/chunks/{chunk-NL7LTRLR.js → chunk-3RXUYQJI.js} +54 -74
  51. package/chunks/{chunk-E5Z2AVNV.js → chunk-3SH53ANB.js} +0 -11
  52. package/chunks/{chunk-XHRTVPG2.js → chunk-3WXMXT7C.js} +22 -11
  53. package/chunks/{chunk-C3NS4F2Q.js → chunk-42IKVPST.js} +1 -1
  54. package/chunks/{chunk-M5JM7OSF.js → chunk-432XCUHF.js} +2 -3
  55. package/chunks/{chunk-5U4IPFBR.js → chunk-433VD3HX.js} +4 -4
  56. package/chunks/chunk-434YCHSV.js +2196 -0
  57. package/chunks/{chunk-DHHOYAPR.js → chunk-4LKVQFHM.js} +7 -7
  58. package/chunks/{chunk-IPUUTYMV.js → chunk-4NFY2S7N.js} +0 -33
  59. package/chunks/{chunk-J6D3VXCC.js → chunk-5UJ6A3CH.js} +158 -12
  60. package/chunks/{chunk-N3FAY5CM.js → chunk-5UZITEHA.js} +158 -5
  61. package/chunks/{chunk-A4UCTEB5.js → chunk-5WV5S2GT.js} +0 -1
  62. package/chunks/chunk-6FMJLI5M.js +1591 -0
  63. package/chunks/{chunk-6FGBXPWM.js → chunk-6O5DVH27.js} +38 -44
  64. package/chunks/{chunk-2RFKHEXL.js → chunk-6PLDPT2C.js} +1 -1
  65. package/chunks/{chunk-52O2CIUL.js → chunk-7IYLHTTM.js} +130 -5
  66. package/chunks/{chunk-5THCYPLO.js → chunk-7K2WTPQO.js} +15 -8
  67. package/chunks/{chunk-2Q3OT4OV.js → chunk-7MY2AR5A.js} +204 -81
  68. package/chunks/{chunk-YH6G52F2.js → chunk-A2A34TSB.js} +4 -4
  69. package/chunks/{chunk-3QMGYBFN.js → chunk-A5YZ3FA2.js} +2 -80
  70. package/chunks/{chunk-K4XWPEWB.js → chunk-A6SX5TAH.js} +4 -33
  71. package/chunks/{chunk-VYPFXUCB.js → chunk-AKA24BGO.js} +1 -1
  72. package/chunks/chunk-AQ37AY7B.js +93 -0
  73. package/chunks/{chunk-PANH4R3B.js → chunk-AQEWCKX4.js} +18 -12
  74. package/chunks/{chunk-LG4GZIVV.js → chunk-AYB4HSBI.js} +4 -4
  75. package/chunks/{chunk-PJIZUQVC.js → chunk-AZQ3DT76.js} +2 -2
  76. package/chunks/{chunk-2JZBVYTU.js → chunk-BFHXDAR7.js} +1 -8
  77. package/chunks/{chunk-2W3OOD4W.js → chunk-BGXZBI5B.js} +7 -4
  78. package/chunks/{chunk-2YZJCM5T.js → chunk-BKUN5QHP.js} +7 -7
  79. package/chunks/{chunk-UUUTRMI2.js → chunk-BV4QX43X.js} +1 -1
  80. package/chunks/{chunk-4M377AZG.js → chunk-C4L2MEIT.js} +6 -6
  81. package/chunks/{chunk-VV6XU5L7.js → chunk-CHCLO3M7.js} +19 -14
  82. package/chunks/{chunk-TOFQCPDC.js → chunk-CWEIMFFW.js} +14 -8
  83. package/chunks/{chunk-XVNQMZ2I.js → chunk-DGEIYUC3.js} +0 -1
  84. package/chunks/{chunk-BPZALHVR.js → chunk-DI35ZN7T.js} +1 -1
  85. package/chunks/{chunk-WDSWXQU3.js → chunk-DUIJ2IXG.js} +5 -13
  86. package/chunks/{chunk-3MSHSCSN.js → chunk-DVGTU5TC.js} +94 -4
  87. package/chunks/{chunk-RHLZR4E5.js → chunk-DYA25Y7U.js} +1 -1
  88. package/chunks/{chunk-MUP3T3AD.js → chunk-E4WHKETF.js} +32 -38
  89. package/chunks/{chunk-WBL3FJEU.js → chunk-FC4KQFCS.js} +1 -1
  90. package/chunks/{chunk-V6VRAM7B.js → chunk-FJHA23GM.js} +12 -12
  91. package/chunks/chunk-FYJ7W2PI.js +194 -0
  92. package/chunks/{chunk-INADJJGW.js → chunk-G7XXKQYS.js} +2 -2
  93. package/chunks/{chunk-LZEMEFKY.js → chunk-GALUTA2C.js} +1 -1
  94. package/chunks/{chunk-ML52PL6O.js → chunk-GB3AB7TR.js} +4374 -3779
  95. package/chunks/{chunk-SASBXAQL.js → chunk-GHJM2C2T.js} +6 -8
  96. package/chunks/{chunk-LS77BEZP.js → chunk-GLCZKT5V.js} +1 -5
  97. package/chunks/chunk-GOFAQQZA.js +132 -0
  98. package/chunks/{chunk-BJX6ZSUK.js → chunk-GTM6IHBB.js} +2 -2
  99. package/chunks/{chunk-TF2X2WCT.js → chunk-GVISB2OH.js} +2 -2
  100. package/chunks/{chunk-OKY7HXPG.js → chunk-H36SETQS.js} +2 -2
  101. package/chunks/{chunk-7FZEBPKS.js → chunk-H4346YW5.js} +39 -22
  102. package/chunks/{chunk-LNURQEMZ.js → chunk-H4DSRWAS.js} +24 -13
  103. package/chunks/{chunk-3JAQDSXN.js → chunk-H6MC6VQX.js} +290 -179
  104. package/chunks/{chunk-GZXCZHCT.js → chunk-I3G5JWBV.js} +1 -1
  105. package/chunks/{chunk-PR75REBZ.js → chunk-I5GNT6ZS.js} +18 -82
  106. package/chunks/{chunk-MVS3NS2N.js → chunk-I6FAHB4N.js} +28 -5
  107. package/chunks/{chunk-ZOIFNCKL.js → chunk-I7JDGNG6.js} +3 -23
  108. package/chunks/{chunk-OJGCZBB7.js → chunk-II6WPWHY.js} +41 -36
  109. package/chunks/{chunk-UH3WSE5L.js → chunk-J26HHFI5.js} +2 -7
  110. package/chunks/{chunk-S3TWXGKA.js → chunk-JE7KQ2UP.js} +4 -2
  111. package/chunks/{chunk-ZD6UTE4A.js → chunk-JELIWHXD.js} +1 -1
  112. package/chunks/{chunk-6PSLCFQ2.js → chunk-JRIDA5HF.js} +18 -9
  113. package/chunks/{chunk-W4CQXHT6.js → chunk-K4CGQN4Q.js} +1 -1
  114. package/chunks/{chunk-G4WFQUYQ.js → chunk-K5Q62CGR.js} +1 -1
  115. package/chunks/{chunk-JCW2R7WC.js → chunk-K623ENWT.js} +3 -79
  116. package/chunks/{chunk-T2NCM2ET.js → chunk-K6KS3LTN.js} +2 -749
  117. package/chunks/{chunk-DN6ZX5AY.js → chunk-KG22G46Y.js} +62 -15
  118. package/chunks/{chunk-L5UHQJTJ.js → chunk-KKN2IE7Q.js} +1 -1
  119. package/chunks/{chunk-63P4EL5V.js → chunk-KVUBYJDM.js} +2 -2
  120. package/chunks/{chunk-E5WH5O3C.js → chunk-KXSYDCP2.js} +4 -4
  121. package/chunks/{chunk-JALU3ZDU.js → chunk-LAPK3GLC.js} +212 -16
  122. package/chunks/chunk-LBOVL47Y.js +29 -0
  123. package/chunks/{chunk-FQK6JAFG.js → chunk-LBWNSLJK.js} +4 -4
  124. package/chunks/{chunk-3IXOIAKE.js → chunk-LL4U3BSH.js} +30 -10
  125. package/chunks/{chunk-B7QDM6Z7.js → chunk-LRJWFR6L.js} +4 -4
  126. package/chunks/{chunk-RWS5VYWC.js → chunk-M2F5PLOW.js} +1018 -484
  127. package/chunks/{chunk-HIJQF5B5.js → chunk-M744OFVE.js} +1 -1
  128. package/chunks/{chunk-I7XZ3RY5.js → chunk-MBKPUM5Y.js} +1 -1
  129. package/chunks/chunk-MISUEWB4.js +8749 -0
  130. package/chunks/{chunk-FNQ6T3CV.js → chunk-MOHAWIAW.js} +10 -7
  131. package/chunks/{chunk-FODK6UMO.js → chunk-MPHPFVKK.js} +0 -2
  132. package/chunks/{chunk-QY5MMZ6O.js → chunk-MSIVKDRC.js} +4 -4
  133. package/chunks/{record-artifact-RQKFYO5B.js → chunk-MYT7N6QH.js} +22 -7
  134. package/chunks/{chunk-JESCGQM3.js → chunk-NAVJD2PQ.js} +8 -7
  135. package/chunks/{chunk-DM4Q4JJH.js → chunk-NGWYUZZO.js} +68794 -83526
  136. package/chunks/{chunk-6OUGMXDC.js → chunk-NWNEANAT.js} +7 -7
  137. package/chunks/{chunk-PQNHRFJC.js → chunk-NYX53SV4.js} +0 -2
  138. package/chunks/{chunk-Z5BLYMZM.js → chunk-NZB4NDJL.js} +10 -10
  139. package/chunks/{chunk-SRZ6DXVG.js → chunk-O2ZYHG33.js} +47 -138
  140. package/chunks/chunk-O6GEWCJA.js +21 -0
  141. package/chunks/{chunk-PHVR5UUY.js → chunk-OBAIHYFT.js} +1 -1
  142. package/chunks/chunk-OCPBI7J5.js +18 -0
  143. package/chunks/{chunk-P5V4T7NK.js → chunk-OCRM53TT.js} +11 -3
  144. package/chunks/{chunk-V7RNNPGC.js → chunk-P5Y23G2L.js} +18 -1
  145. package/chunks/{chunk-KU5XMLDK.js → chunk-PDDYAXL2.js} +7 -1
  146. package/chunks/{chunk-L26JL52R.js → chunk-PGEGUNH5.js} +108 -68
  147. package/chunks/{chunk-2JM6GZ5D.js → chunk-PGP7Y3RQ.js} +8 -13
  148. package/chunks/{chunk-VFSJ5VRH.js → chunk-PHODQP2V.js} +6 -6
  149. package/chunks/{chunk-PSWQZHEA.js → chunk-PXA5AWHY.js} +1 -1
  150. package/chunks/{chunk-VDDGDZMA.js → chunk-QHWCP53L.js} +14 -7
  151. package/chunks/chunk-QL4TN4HS.js +59 -0
  152. package/chunks/{chunk-USTWD7QV.js → chunk-QMBEW7EW.js} +26 -16
  153. package/chunks/{chunk-U4VTUMMK.js → chunk-QONSRAEV.js} +1 -1
  154. package/chunks/{chunk-NH6KE4JX.js → chunk-QYPT3QUD.js} +3 -3
  155. package/chunks/{chunk-GDIPH4JY.js → chunk-RGJ4JWSU.js} +133 -50
  156. package/chunks/{chunk-BO4XCS7P.js → chunk-RPYYTL7E.js} +77 -94
  157. package/chunks/{chunk-6AM5D4ME.js → chunk-S6LOFUVP.js} +0 -12
  158. package/chunks/{chunk-B4UMZKMU.js → chunk-SK2UKB45.js} +1 -1
  159. package/chunks/{chunk-QPDRAXDJ.js → chunk-SWEBEXPI.js} +1 -1
  160. package/chunks/chunk-T26EAKDL.js +13 -0
  161. package/chunks/chunk-T3CHYWJZ.js +758 -0
  162. package/chunks/{chunk-U7TXFVUN.js → chunk-TFFMATHX.js} +120 -95
  163. package/chunks/{chunk-M4UKFCZ2.js → chunk-TNVKFQXQ.js} +616 -217
  164. package/chunks/{chunk-5I2IWRSH.js → chunk-TYERNYH4.js} +2 -2
  165. package/chunks/{chunk-VAK25FTU.js → chunk-U25CMJYY.js} +1 -1
  166. package/chunks/{chunk-A5L3JMUA.js → chunk-UH7Z7Y45.js} +18 -4
  167. package/chunks/{chunk-BRRAJXPA.js → chunk-UHQ3L6GC.js} +1 -1
  168. package/chunks/{chunk-HV3G62R6.js → chunk-UHTJC7O3.js} +1 -1
  169. package/chunks/{chunk-3SJ43L4W.js → chunk-UKZEXS6K.js} +8 -0
  170. package/chunks/{chunk-DM22XS4K.js → chunk-UOFFZNXV.js} +361 -17
  171. package/chunks/{chunk-FY3M44RD.js → chunk-URN76TKR.js} +3 -3
  172. package/chunks/{chunk-MSLKI6C2.js → chunk-UWLG4UCE.js} +139 -31
  173. package/chunks/{chunk-A6UO2C7C.js → chunk-UWSXFI6E.js} +167 -81
  174. package/chunks/{chunk-BYFNTGKI.js → chunk-VS3GXRNZ.js} +3703 -1399
  175. package/chunks/{chunk-TQCBGUHN.js → chunk-VWF42XC6.js} +5 -5
  176. package/chunks/{chunk-32MVHM4T.js → chunk-W7XZ3KP5.js} +1 -1
  177. package/chunks/{chunk-B6ZJ7SI6.js → chunk-WISQLM4Q.js} +1526 -1420
  178. package/chunks/{chunk-H5FFA6TH.js → chunk-WK4TJUEA.js} +16 -3
  179. package/chunks/{chunk-3HBZKBMQ.js → chunk-WP4HGHFG.js} +5 -5
  180. package/chunks/{chunk-BIQWWWJN.js → chunk-XC2VAFVZ.js} +1 -1
  181. package/chunks/{chunk-EPDRMGT4.js → chunk-XC656O42.js} +4 -28
  182. package/chunks/{chunk-COH43MRJ.js → chunk-XCGIMOLN.js} +27 -1
  183. package/chunks/{chunk-YAF5VNU7.js → chunk-XCLLRKY5.js} +4 -5
  184. package/chunks/chunk-XFDPIC4P.js +319 -0
  185. package/chunks/{chunk-KIUFNBHR.js → chunk-XSA5EKTJ.js} +1 -1
  186. package/chunks/{chunk-OHNBB4XR.js → chunk-YAVY33G4.js} +1 -1
  187. package/chunks/{chunk-DLWL3Z7A.js → chunk-YXEVDA66.js} +3 -3
  188. package/chunks/chunk-Z4X5MTRT.js +133 -0
  189. package/chunks/{chunk-UW5EOVUN.js → chunk-ZBVS26BY.js} +4 -4
  190. package/chunks/{chunk-HTO4JFDZ.js → chunk-ZPJWUGCS.js} +0 -1
  191. package/chunks/{chunk-ZE5WPL4I.js → chunk-ZRFJ75D7.js} +3 -3
  192. package/chunks/{chunk-MK7VQDN3.js → chunk-ZTN6OA5J.js} +8 -6
  193. package/chunks/{computer-use-DOFAHZAB.js → computer-use-Z4NCIIJN.js} +54 -51
  194. package/chunks/{config-utils-VFQXVGNR.js → config-utils-64LM6OEQ.js} +4 -4
  195. package/chunks/contextCommand-HVM7XFCB.js +84 -0
  196. package/chunks/core-runtime-NL3ZBHBU.js +138 -0
  197. package/chunks/{create-sub-session-IWW2IZ2T.js → create-sub-session-AM32K2HD.js} +3 -3
  198. package/chunks/{create-sub-session-7543K2QA.js → create-sub-session-XHSCDYFU.js} +54 -51
  199. package/chunks/{cron-create-YIID5XAW.js → cron-create-HPXYE6C5.js} +6 -6
  200. package/chunks/{cron-delete-ZVHYCEP2.js → cron-delete-FPVNTKPK.js} +5 -5
  201. package/chunks/{cron-list-XEGS463Q.js → cron-list-ZEI6PAAV.js} +6 -6
  202. package/chunks/{daemon-VOMQW7KZ.js → daemon-PCNCI5YU.js} +239 -18
  203. package/chunks/daemon-status-provider-XD23SNAM.js +94 -0
  204. package/chunks/daemon-trust-policy-NOHK7IW5.js +89 -0
  205. package/chunks/daemon-trust-policy-monitor-ZBTSR333.js +176 -0
  206. package/chunks/{de-HGRCYDEJ.js → de-A6TI4LBB.js} +52 -6
  207. package/chunks/deferred-core-runtime-JJBHKM2C.js +93 -0
  208. package/chunks/{dist-RTJFMNEZ.js → dist-4LAMY2SK.js} +1449 -14
  209. package/chunks/{dist-NNVBBOGU.js → dist-4T4NCJFL.js} +2 -2
  210. package/chunks/dist-7KOL6OMD.js +13467 -0
  211. package/chunks/{dist-BRB6EXK4.js → dist-BH76AT7N.js} +3 -3
  212. package/chunks/dist-BXA3JXVQ.js +4749 -0
  213. package/chunks/{dist-KTYYJ2C5.js → dist-OEEFI6UU.js} +12 -9
  214. package/chunks/{dist-K6Y4E7FX.js → dist-SMLVOWKV.js} +5 -4
  215. package/chunks/{dist-ANLAT3GS.js → dist-V2RK6S6Q.js} +2 -1
  216. package/chunks/earlyInputCapture-KLAZDAIP.js +86 -0
  217. package/chunks/{edit-RIEOJWKB.js → edit-YQZWCISX.js} +53 -50
  218. package/chunks/{en-MTWBNGDO.js → en-RESOFG55.js} +55 -6
  219. package/chunks/{enter-worktree-OGK5FQ3R.js → enter-worktree-WLVWI3FP.js} +53 -50
  220. package/chunks/{enterPlanMode-IWZYALIB.js → enterPlanMode-6RYXFQUD.js} +53 -50
  221. package/chunks/environment-DXJTXSVT.js +106 -0
  222. package/chunks/errors-XGAGG2S2.js +92 -0
  223. package/chunks/esm-K5FARBNI.js +5548 -0
  224. package/chunks/{exit-worktree-4TEYVIVP.js → exit-worktree-C4276VPP.js} +53 -50
  225. package/chunks/exitPlanMode-MM5HIRUF.js +77 -0
  226. package/chunks/{fast-path-HYE7IFEV.js → fast-path-PIXYOHCH.js} +17 -3
  227. package/chunks/{fr-45RLL55O.js → fr-QF7RI5ZE.js} +52 -6
  228. package/chunks/{gemini-NGRQX3YJ.js → gemini-43RLVUNP.js} +171 -109
  229. package/chunks/{geminiContentGenerator-FQHPFZSR.js → geminiContentGenerator-PNQ4TSID.js} +7 -7
  230. package/chunks/{getMachineId-bsd-V7W3GODC.js → getMachineId-bsd-FG7IUY6U.js} +1 -1
  231. package/chunks/{getMachineId-darwin-TDO75DQP.js → getMachineId-darwin-GLCJI2RA.js} +1 -1
  232. package/chunks/{getMachineId-linux-TF43WQT2.js → getMachineId-linux-O6OPPAKO.js} +1 -1
  233. package/chunks/{getMachineId-unsupported-ZGUO3TXT.js → getMachineId-unsupported-S6CKYVGC.js} +1 -1
  234. package/chunks/{getMachineId-win-ECFYZZFQ.js → getMachineId-win-X5SRNEH7.js} +1 -1
  235. package/chunks/{glob-FRTM3X2E.js → glob-ZMBQKAU5.js} +53 -50
  236. package/chunks/goal-tools-Y767F7LZ.js +335 -0
  237. package/chunks/{grep-RKWVROCW.js → grep-HSV37W2Q.js} +55 -51
  238. package/chunks/handleAutoUpdate-QDHZPBAY.js +85 -0
  239. package/chunks/i18n-ME22A6RN.js +101 -0
  240. package/chunks/{image-gen-WIEM7KZA.js → image-gen-IFC7ZWSB.js} +12 -12
  241. package/chunks/initializer-J7H2CHVB.js +90 -0
  242. package/chunks/installationInfo-R7FXPQN5.js +84 -0
  243. package/chunks/{ja-B7DF7DFG.js → ja-URQESVGW.js} +52 -6
  244. package/chunks/{keychain-token-storage-MDTG3WRM.js → keychain-token-storage-7BT4TQ2A.js} +3 -3
  245. package/chunks/{kittyProtocolDetector-MBRTDRBK.js → kittyProtocolDetector-BFLAKYXH.js} +1 -1
  246. package/chunks/lib-RUF3WZA6.js +9 -0
  247. package/chunks/list-OYDIBA4N.js +93 -0
  248. package/chunks/{list-agents-5KJJHR6I.js → list-agents-GATIBBQQ.js} +3 -3
  249. package/chunks/loadedSettingsAdapter-OK6GK2GE.js +87 -0
  250. package/chunks/{loggingContentGenerator-WGM27QAW.js → loggingContentGenerator-U4ZEG4GL.js} +66 -50
  251. package/chunks/{loop-wakeup-FXKNNYSY.js → loop-wakeup-3DZMQQQQ.js} +15 -8
  252. package/chunks/{ls-NTK6VOQJ.js → ls-7F4GHXIH.js} +5 -5
  253. package/chunks/{lsp-2JI24STP.js → lsp-6FEHVBWI.js} +3 -3
  254. package/chunks/{managed-npm-update-JQ2CG3RH.js → managed-npm-update-PGKAJLLO.js} +52 -49
  255. package/chunks/mcp-S4DXJD2G.js +87 -0
  256. package/chunks/{monitor-7FEWXX5F.js → monitor-E5ZFMT74.js} +53 -50
  257. package/chunks/nonInteractiveCli-HNOHKEPE.js +149 -0
  258. package/chunks/{notebook-edit-JGJV2K6J.js → notebook-edit-6QDN6VZJ.js} +53 -50
  259. package/chunks/{openaiContentGenerator-JPVXDTAO.js → openaiContentGenerator-3NLB2C5O.js} +25 -27
  260. package/chunks/pidfile-ZMOIUGG6.js +90 -0
  261. package/chunks/process-registry-2CHQBXH5.js +157 -0
  262. package/chunks/{processUtils-V2LCK6T6.js → processUtils-E4QGQVWW.js} +2 -2
  263. package/chunks/{pt-22Q3FP73.js → pt-EEEQXRUI.js} +52 -6
  264. package/chunks/{qwenContentGenerator-TICV2W2Z.js → qwenContentGenerator-2LFRWJTM.js} +57 -54
  265. package/chunks/{qwenOAuth2-XGFI5XJG.js → qwenOAuth2-N32BUQDC.js} +10 -10
  266. package/chunks/read-file-GLDCWZBG.js +29 -0
  267. package/chunks/{read-mcp-resource-4DKQWGHD.js → read-mcp-resource-AFS3UKZO.js} +4 -4
  268. package/chunks/record-artifact-ECZSCEG5.js +21 -0
  269. package/chunks/resumeHistoryUtils-F5BE5QDW.js +95 -0
  270. package/chunks/ripGrep-T23Y4AGY.js +77 -0
  271. package/chunks/{ru-FZCNZHDC.js → ru-WGZDYQAB.js} +52 -6
  272. package/chunks/{run-qwen-serve-3VCV4I7E.js → run-qwen-serve-TI2HGLLU.js} +1155 -272
  273. package/chunks/runtime-WCWM3DO7.js +125 -0
  274. package/chunks/{scheduler-RS2I6RU5.js → scheduler-2QZO5AV5.js} +51 -48
  275. package/chunks/{sdk-exporters-grpc-AK3LGHNO.js → sdk-exporters-grpc-54L4LS5L.js} +4 -4
  276. package/chunks/{sdk-exporters-http-FS6ZV7MF.js → sdk-exporters-http-IKNWQJNV.js} +7 -7
  277. package/chunks/{sdk-impl-7FZSCSXB.js → sdk-impl-7CUUMQDB.js} +10 -10
  278. package/chunks/{send-message-Q6OOR6BR.js → send-message-X7G2JSII.js} +8 -13
  279. package/chunks/serve-DZOMYUFU.js +93 -0
  280. package/chunks/{server-HRZ23U7M.js → server-N4AJRKIQ.js} +5299 -1584
  281. package/chunks/{session-7XHZKTVV.js → session-GS6AKMN7.js} +167 -102
  282. package/chunks/{settings-7ZGZDXAS.js → settings-CUN3SELH.js} +56 -53
  283. package/chunks/shell-NGBFVXC5.js +87 -0
  284. package/chunks/{skill-LIWXNLDW.js → skill-SC2BSO75.js} +35 -23
  285. package/chunks/skill-settings-XVPCPW5K.js +95 -0
  286. package/chunks/spawnChannel-RILO4YY3.js +86 -0
  287. package/chunks/standalone-update-TMLT6LVJ.js +96 -0
  288. package/chunks/{startInteractiveUI-IW3CSKHA.js → startInteractiveUI-J45WOEOU.js} +1343 -1230
  289. package/chunks/{syntheticOutput-I3757IWH.js → syntheticOutput-FHRY3BPQ.js} +4 -4
  290. package/chunks/task-create-LAQXBIHC.js +26 -0
  291. package/chunks/{task-list-FOPULZEP.js → task-list-V6K5DRDH.js} +8 -8
  292. package/chunks/{task-stop-H6RHXFVQ.js → task-stop-LQXE52L6.js} +3 -3
  293. package/chunks/{task-update-M57TFZJT.js → task-update-NXRCXSPB.js} +13 -12
  294. package/chunks/{team-create-O2FROQ4R.js → team-create-W3EVWCTA.js} +55 -52
  295. package/chunks/{team-delete-QE2UXJL7.js → team-delete-Z4KGO7RC.js} +8 -8
  296. package/chunks/{team-plan-approval-Q6WDBXTQ.js → team-plan-approval-URYVKJF4.js} +53 -50
  297. package/chunks/theme-manager-CUAMS2NI.js +81 -0
  298. package/chunks/{todoWrite-VQ7FKOHL.js → todoWrite-OFIZDI7P.js} +34 -6
  299. package/chunks/{tool-search-APECNQ3Z.js → tool-search-DCICFL32.js} +21 -22
  300. package/chunks/total-session-admission-3ZTAXVUK.js +89 -0
  301. package/chunks/{tree-sitter-FS4VPMZA.js → tree-sitter-4D7QS7F6.js} +1 -1
  302. package/chunks/{tree-sitter-bash-6B46JJCV.js → tree-sitter-bash-VEJGF5XF.js} +1 -1
  303. package/chunks/trustedFolders-EVCN36O5.js +99 -0
  304. package/chunks/{update-relaunch-ON5MDJQG.js → update-relaunch-XLW46RHQ.js} +5 -5
  305. package/chunks/updateCheck-ZHVXDAIH.js +96 -0
  306. package/chunks/useAutoAcceptIndicator-ZGD6BJSP.js +97 -0
  307. package/chunks/{validateNonInterActiveAuth-JBLKBKRD.js → validateNonInterActiveAuth-R3BAQFDY.js} +102 -97
  308. package/chunks/{version-LTNUBQJY.js → version-PMWREGCG.js} +1 -1
  309. package/chunks/{web-fetch-L5UTI53V.js → web-fetch-PGN27SGF.js} +19 -21
  310. package/chunks/{web-search-KM33JOS3.js → web-search-KW4UNMRE.js} +13 -13
  311. package/chunks/{workflow-K7FAWV77.js → workflow-SN3TJBTJ.js} +374 -323
  312. package/chunks/workspace-providers-status-O3HUZGGR.js +90 -0
  313. package/chunks/{workspace-registration-store-6TGVDJV5.js → workspace-registration-store-M3FJ74RS.js} +2 -2
  314. package/chunks/workspace-registry-U7ISW23N.js +97 -0
  315. package/chunks/workspace-service-VH6IWADT.js +104 -0
  316. package/chunks/workspace-skills-status-XANARSZS.js +90 -0
  317. package/chunks/workspace-trust-reconciler-35EFR4GC.js +350 -0
  318. package/chunks/write-file-NCRSGUDT.js +79 -0
  319. package/chunks/xterm-headless-NTYVIBT3.js +3475 -0
  320. package/chunks/{zh-LUIGBD55.js → zh-OHX23Q44.js} +52 -6
  321. package/chunks/{zh-TW-F5KG2IYD.js → zh-TW-4G7YKDAQ.js} +52 -6
  322. package/chunks/zoom-image-X7CIADYC.js +224 -0
  323. package/cli.js +55 -48
  324. package/locales/ca.js +67 -6
  325. package/locales/de.js +69 -6
  326. package/locales/en.js +69 -6
  327. package/locales/fr.js +71 -6
  328. package/locales/ja.js +68 -6
  329. package/locales/pt.js +67 -6
  330. package/locales/ru.js +70 -6
  331. package/locales/zh-TW.js +62 -6
  332. package/locales/zh.js +62 -6
  333. package/package.json +5 -4
  334. package/web-shell/assets/{arc-BbHijhiN.js → arc-CaMTqKio.js} +1 -1
  335. package/web-shell/assets/{architectureDiagram-3BPJPVTR-Cb4B_JD0.js → architectureDiagram-3BPJPVTR-Bjxztij2.js} +1 -1
  336. package/web-shell/assets/{blockDiagram-GPEHLZMM-Dsjlh3H-.js → blockDiagram-GPEHLZMM-BYJzeHi9.js} +1 -1
  337. package/web-shell/assets/{c4Diagram-AAUBKEIU-Cp5AeR4U.js → c4Diagram-AAUBKEIU-fYAa-Eil.js} +1 -1
  338. package/web-shell/assets/channel-LEZei0-5.js +1 -0
  339. package/web-shell/assets/{chunk-2J33WTMH-CLcY7W2e.js → chunk-2J33WTMH-B1OTlTml.js} +1 -1
  340. package/web-shell/assets/{chunk-4BX2VUAB-BUhvY2LR.js → chunk-4BX2VUAB-DNj4uy6k.js} +1 -1
  341. package/web-shell/assets/{chunk-55IACEB6-kDIFC_71.js → chunk-55IACEB6-DAqNmg3c.js} +1 -1
  342. package/web-shell/assets/{chunk-727SXJPM-CIBO15f2.js → chunk-727SXJPM-BwB4ddxE.js} +1 -1
  343. package/web-shell/assets/{chunk-AQP2D5EJ-BJ_T_slV.js → chunk-AQP2D5EJ-DmHR_UZs.js} +1 -1
  344. package/web-shell/assets/{chunk-FMBD7UC4-BEkW35J8.js → chunk-FMBD7UC4-BlfOXumo.js} +1 -1
  345. package/web-shell/assets/{chunk-ND2GUHAM-GGPxofay.js → chunk-ND2GUHAM-BKogiSy7.js} +1 -1
  346. package/web-shell/assets/{chunk-QZHKN3VN-Bifllrb6.js → chunk-QZHKN3VN-DEclVrOF.js} +1 -1
  347. package/web-shell/assets/classDiagram-4FO5ZUOK-BiaRhfvf.js +1 -0
  348. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-BiaRhfvf.js +1 -0
  349. package/web-shell/assets/{cose-bilkent-S5V4N54A-C-Add_Dp.js → cose-bilkent-S5V4N54A-CwtS21WT.js} +1 -1
  350. package/web-shell/assets/{dagre-BM42HDAG-B7MfwNq2.js → dagre-BM42HDAG-BAAIlB4p.js} +1 -1
  351. package/web-shell/assets/{diagram-2AECGRRQ-CY_0zuDz.js → diagram-2AECGRRQ-ChljtF_V.js} +1 -1
  352. package/web-shell/assets/{diagram-5GNKFQAL-VyYSbCgA.js → diagram-5GNKFQAL-BIXVd31-.js} +1 -1
  353. package/web-shell/assets/{diagram-KO2AKTUF-CBiIZ2PL.js → diagram-KO2AKTUF-BEiBaS15.js} +1 -1
  354. package/web-shell/assets/{diagram-LMA3HP47-BL3CrVOx.js → diagram-LMA3HP47-C-g4tWKM.js} +1 -1
  355. package/web-shell/assets/{diagram-OG6HWLK6-CZUPx96P.js → diagram-OG6HWLK6-CNCCbNQG.js} +1 -1
  356. package/web-shell/assets/{erDiagram-TEJ5UH35-B81xHr1-.js → erDiagram-TEJ5UH35-v8ysnsdI.js} +1 -1
  357. package/web-shell/assets/{flowDiagram-I6XJVG4X-EZWhir-J.js → flowDiagram-I6XJVG4X-LKVlLjwA.js} +1 -1
  358. package/web-shell/assets/{ganttDiagram-6RSMTGT7-CVFSuIAg.js → ganttDiagram-6RSMTGT7-DA5MrKYG.js} +1 -1
  359. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-C1H2uQDv.js → gitGraphDiagram-PVQCEYII-Cyg5fe6d.js} +1 -1
  360. package/web-shell/assets/index-BgOcEaVt.js +1756 -0
  361. package/web-shell/assets/index-C2GE3DAF.js +74 -0
  362. package/web-shell/assets/{index-BYo99NBH.js → index-CKdUkVVS.js} +1 -1
  363. package/web-shell/assets/index-DA5Lvscv.css +5 -0
  364. package/web-shell/assets/{infoDiagram-5YYISTIA-BwyFMlF8.js → infoDiagram-5YYISTIA-SLsfu3Qd.js} +1 -1
  365. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-CQ7Yhn2Y.js → ishikawaDiagram-YF4QCWOH-CmHOmTNx.js} +1 -1
  366. package/web-shell/assets/{journeyDiagram-JHISSGLW-CJn2sf0l.js → journeyDiagram-JHISSGLW-C3gM_HFQ.js} +1 -1
  367. package/web-shell/assets/{kanban-definition-UN3LZRKU-DaNRqwVN.js → kanban-definition-UN3LZRKU-BbHD7duM.js} +1 -1
  368. package/web-shell/assets/{linear-DCKODZe2.js → linear-CSBvm435.js} +1 -1
  369. package/web-shell/assets/{mermaid.core-CTGJOk27.js → mermaid.core-CPMw15lU.js} +5 -5
  370. package/web-shell/assets/{mindmap-definition-RKZ34NQL-BKU3_3rg.js → mindmap-definition-RKZ34NQL-C_tNqXQW.js} +1 -1
  371. package/web-shell/assets/{pieDiagram-4H26LBE5-COcwBJ82.js → pieDiagram-4H26LBE5-DH_N-8yY.js} +1 -1
  372. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-CQnQ443x.js → quadrantDiagram-W4KKPZXB-CRbS8UkN.js} +1 -1
  373. package/web-shell/assets/{requirementDiagram-4Y6WPE33-CZ2oj5cD.js → requirementDiagram-4Y6WPE33-DJgdZPZn.js} +1 -1
  374. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-BxAv5mNu.js → sankeyDiagram-5OEKKPKP-vhL1y5zx.js} +1 -1
  375. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-CztaySPs.js → sequenceDiagram-3UESZ5HK-UQthhFwd.js} +1 -1
  376. package/web-shell/assets/{stateDiagram-AJRCARHV-CTQT1oGD.js → stateDiagram-AJRCARHV-CAywEm20.js} +1 -1
  377. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-lfJQHw-7.js +1 -0
  378. package/web-shell/assets/{timeline-definition-PNZ67QCA-K9Mkex5A.js → timeline-definition-PNZ67QCA-CLO8b3FD.js} +1 -1
  379. package/web-shell/assets/{vennDiagram-CIIHVFJN-B2rVIw76.js → vennDiagram-CIIHVFJN-BNAAh0Mu.js} +1 -1
  380. package/web-shell/assets/{wardley-L42UT6IY-Z1w2JR4M.js → wardley-L42UT6IY-CUY7bLpN.js} +1 -1
  381. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-CIX9aKXf.js → wardleyDiagram-YWT4CUSO-CSg_ORdW.js} +1 -1
  382. package/web-shell/assets/{xychartDiagram-2RQKCTM6-CI9DLIKB.js → xychartDiagram-2RQKCTM6-BjffV208.js} +1 -1
  383. package/web-shell/index.html +2 -2
  384. package/chunks/MaxSizedBox-INHRH72H.js +0 -86
  385. package/chunks/agent-VXDAN5JK.js +0 -82
  386. package/chunks/agent-headless-K4ZMMNBD.js +0 -76
  387. package/chunks/bridge-LGPZCFHO.js +0 -91
  388. package/chunks/channel-settings-store-CHCDRTPY.js +0 -89
  389. package/chunks/chunk-HGT6JR3U.js +0 -177
  390. package/chunks/chunk-JZA3JUDJ.js +0 -82
  391. package/chunks/chunk-SZRN75WQ.js +0 -29
  392. package/chunks/chunk-UGYMA4EI.js +0 -219
  393. package/chunks/chunk-VCBZUOSI.js +0 -8575
  394. package/chunks/contextCommand-QIZYHDR5.js +0 -81
  395. package/chunks/daemon-status-provider-OS5UWBHV.js +0 -90
  396. package/chunks/earlyInputCapture-WQT24RWD.js +0 -83
  397. package/chunks/environment-VZ7BRI4Q.js +0 -103
  398. package/chunks/errors-PCX25DVP.js +0 -89
  399. package/chunks/exitPlanMode-GHPUHBZJ.js +0 -423
  400. package/chunks/handleAutoUpdate-2CZQRJ66.js +0 -82
  401. package/chunks/i18n-XEQVMRKN.js +0 -98
  402. package/chunks/initializer-OVGZ4FLY.js +0 -87
  403. package/chunks/installationInfo-5UUQJI6Y.js +0 -81
  404. package/chunks/list-HODU6RXD.js +0 -90
  405. package/chunks/loadedSettingsAdapter-TYNLBALY.js +0 -84
  406. package/chunks/mcp-J3DFWX4A.js +0 -84
  407. package/chunks/nonInteractiveCli-F4GYSMHT.js +0 -144
  408. package/chunks/pidfile-4VNAR3EP.js +0 -87
  409. package/chunks/read-file-LZXUR4TO.js +0 -31
  410. package/chunks/resumeHistoryUtils-65OX3SGJ.js +0 -92
  411. package/chunks/ripGrep-2U2FRGMV.js +0 -74
  412. package/chunks/runtime-AXJWIEDU.js +0 -120
  413. package/chunks/serve-W2GC47CM.js +0 -90
  414. package/chunks/shell-45IPBDP5.js +0 -84
  415. package/chunks/spawnChannel-PVXQ5AGV.js +0 -83
  416. package/chunks/src-AY65BYR7.js +0 -3166
  417. package/chunks/standalone-update-ZMFNKAEY.js +0 -93
  418. package/chunks/task-create-N7WQSGYA.js +0 -25
  419. package/chunks/theme-manager-YYPZFBAH.js +0 -78
  420. package/chunks/total-session-admission-JXES723M.js +0 -85
  421. package/chunks/trustedFolders-HVI7IXUH.js +0 -94
  422. package/chunks/updateCheck-WUJGHWZZ.js +0 -93
  423. package/chunks/useAutoAcceptIndicator-CHSTZLZD.js +0 -94
  424. package/chunks/workspace-providers-status-GAKSF4LL.js +0 -87
  425. package/chunks/workspace-registry-A7NQUONG.js +0 -89
  426. package/chunks/workspace-service-STGVSO4N.js +0 -99
  427. package/chunks/workspace-skills-status-66AK3DUA.js +0 -86
  428. package/chunks/write-file-HUUCEG4P.js +0 -74
  429. package/web-shell/assets/channel-Bzdx6E8P.js +0 -1
  430. package/web-shell/assets/classDiagram-4FO5ZUOK-Cd6wbiuK.js +0 -1
  431. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-Cd6wbiuK.js +0 -1
  432. package/web-shell/assets/index-B2bXx96W.js +0 -1249
  433. package/web-shell/assets/index-_8mKjx8q.css +0 -5
  434. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BjMdT6E_.js +0 -1
  435. package/chunks/{chunk-TARRHLLG.js → chunk-QUGAUQGJ.js} +25 -25
  436. package/chunks/{chunk-U7ZFW55U.js → chunk-VOQXFAY5.js} +977 -977
  437. /package/chunks/{chunk-LXXMOYPL.js → chunk-VXZBKKQR.js} +0 -0
@@ -8,21 +8,42 @@ import {
8
8
  serializedBridgeEventByteLength
9
9
  } from "./chunk-GLWP3FDB.js";
10
10
  import {
11
- normalizeCompactedReplayMaxBytes
12
- } from "./chunk-COH43MRJ.js";
11
+ normalizeCompactedReplayMaxBytes,
12
+ normalizeMaxJournalBytes,
13
+ normalizeMaxJournalEvents
14
+ } from "./chunk-XCGIMOLN.js";
15
+ import {
16
+ MCP_RESTART_SERVER_DEADLINE_MS
17
+ } from "./chunk-OCPBI7J5.js";
18
+ import {
19
+ defaultSpawnChannelFactory
20
+ } from "./chunk-UWSXFI6E.js";
21
+ import {
22
+ BridgeChannelClosedError,
23
+ BridgeTimeoutError,
24
+ SERVE_CONTROL_EXT_METHODS,
25
+ SERVE_STATUS_EXT_METHODS,
26
+ STATUS_SCHEMA_VERSION,
27
+ createIdleWorkspaceExtensionsStatus,
28
+ createIdleWorkspaceHooksStatus
29
+ } from "./chunk-PDDYAXL2.js";
13
30
  import {
14
31
  CHANNEL_STARTUP_PROFILE_META_KEY,
15
32
  CHANNEL_STARTUP_PROFILE_VERSION,
16
33
  DAEMON_CHANNEL_DELIVERY_META_KEY,
17
34
  LOAD_REPLAY_BULK_MODE,
35
+ LOAD_REPLAY_HIDE_INHERITED_META_KEY,
18
36
  LOAD_REPLAY_META_KEY,
19
37
  LOAD_REPLAY_MODE_META_KEY,
20
38
  LOAD_REPLAY_PAGE_SIZE_META_KEY,
21
39
  LOAD_REPLAY_VERSION,
22
40
  MID_TURN_QUEUE_DRAIN_METHOD,
23
41
  PROMPT_CANCEL_METHOD,
24
- TODO_STOP_GUARD_QUEUE_RELEASE_METHOD
25
- } from "./chunk-3SJ43L4W.js";
42
+ REQUESTED_SESSION_ID_META_KEY,
43
+ TODO_STOP_GUARD_CONTINUATION_CLAIM_METHOD,
44
+ TODO_STOP_GUARD_QUEUE_RELEASE_METHOD,
45
+ WORKTREE_MCP_DEFER_META_KEY
46
+ } from "./chunk-UKZEXS6K.js";
26
47
  import {
27
48
  BranchWhilePromptActiveError,
28
49
  CancelSentinelCollisionError,
@@ -32,7 +53,6 @@ import {
32
53
  InvalidRewindTargetError,
33
54
  InvalidSessionMetadataError,
34
55
  InvalidSessionScopeError,
35
- MCP_RESTART_SERVER_DEADLINE_MS,
36
56
  PermissionForbiddenError,
37
57
  PromptDeadlineExceededError,
38
58
  PromptQueueFullError,
@@ -44,23 +64,11 @@ import {
44
64
  SessionShellDisabledError,
45
65
  WorkspaceMismatchError,
46
66
  isNotCurrentlyGeneratingCancelError
47
- } from "./chunk-UH3WSE5L.js";
48
- import {
49
- defaultSpawnChannelFactory
50
- } from "./chunk-A6UO2C7C.js";
51
- import {
52
- BridgeChannelClosedError,
53
- BridgeTimeoutError,
54
- SERVE_CONTROL_EXT_METHODS,
55
- SERVE_STATUS_EXT_METHODS,
56
- STATUS_SCHEMA_VERSION,
57
- createIdleWorkspaceExtensionsStatus,
58
- createIdleWorkspaceHooksStatus
59
- } from "./chunk-KU5XMLDK.js";
67
+ } from "./chunk-J26HHFI5.js";
60
68
  import {
61
69
  canonicalizeWorkspace,
62
70
  translateAndCheckAbsoluteWorkspacePath
63
- } from "./chunk-2RFKHEXL.js";
71
+ } from "./chunk-6PLDPT2C.js";
64
72
  import {
65
73
  CHANNEL_DELIVERY_ERROR_CODES,
66
74
  MAX_SUB_SESSION_NAME_CHARS,
@@ -82,16 +90,16 @@ import {
82
90
  metadataBudgetBytes,
83
91
  normalizeSnapshotPayload,
84
92
  stableSessionArtifactId
85
- } from "./chunk-DM4Q4JJH.js";
93
+ } from "./chunk-NGWYUZZO.js";
86
94
  import {
87
95
  DAEMON_TRACEPARENT_META_KEY,
88
96
  DAEMON_TRACESTATE_META_KEY
89
- } from "./chunk-BO4XCS7P.js";
97
+ } from "./chunk-RPYYTL7E.js";
90
98
  import {
91
99
  INVOCATION_CONTEXT_META_KEY,
92
100
  PRIVATE_ACP_CAPABILITY_ENV,
93
101
  PRIVATE_PARENT_CAPABILITY_META_KEY
94
- } from "./chunk-RWS5VYWC.js";
102
+ } from "./chunk-M2F5PLOW.js";
95
103
  import {
96
104
  init_esbuild_shims
97
105
  } from "./chunk-5O2XNYP6.js";
@@ -136,16 +144,14 @@ function replayRecordId(event) {
136
144
  return typeof recordId === "string" ? recordId : void 0;
137
145
  }
138
146
  __name(replayRecordId, "replayRecordId");
139
- var DEFAULT_MAX_JOURNAL_EVENTS = 2e3;
140
- var DEFAULT_MAX_JOURNAL_BYTES = 2 * 1024 * 1024;
141
- function normalizeJournalCap(value, fallback, name) {
142
- if (value === void 0) return fallback;
143
- if (!Number.isSafeInteger(value) || value < 1) {
144
- throw new TypeError(`${name} must be a positive safe integer`);
147
+ function lastRecordIdIn(events) {
148
+ for (let i = events.length - 1; i >= 0; i--) {
149
+ const id = replayRecordId(events[i]);
150
+ if (id !== void 0) return id;
145
151
  }
146
- return value;
152
+ return void 0;
147
153
  }
148
- __name(normalizeJournalCap, "normalizeJournalCap");
154
+ __name(lastRecordIdIn, "lastRecordIdIn");
149
155
  var TurnBoundaryCompactionEngine = class {
150
156
  static {
151
157
  __name(this, "TurnBoundaryCompactionEngine");
@@ -166,6 +172,24 @@ var TurnBoundaryCompactionEngine = class {
166
172
  closed = false;
167
173
  truncatedEvents = 0;
168
174
  truncatedTurns = 0;
175
+ // Most recent `qwen.session.recordId` observed on an ingested or seeded
176
+ // `session_update`. Surfaced on the `history_truncated` marker emitted by
177
+ // `snapshot()` so clients that lost every turn-boundary event from their
178
+ // retained window (e.g. a live-journal truncation during a single long
179
+ // in-flight turn) still have an anchor for `beforeRecordId` transcript
180
+ // pagination. Undefined until at least one recordId has been observed;
181
+ // omitted from the marker in that case.
182
+ activeRecordId;
183
+ // Pagination anchor for the replay-path `history_truncated` marker,
184
+ // frozen at the first replay-window eviction. Prefers the first
185
+ // retained recordId (the eviction boundary, so `beforeRecordId`
186
+ // fetches exactly the dropped records with no overlap); falls back to
187
+ // the last dropped recordId when the retained window carries no
188
+ // recordId. Deliberately NOT `activeRecordId` — that one is advanced
189
+ // by `ingest()` on every turn boundary and, when a retained segment
190
+ // carries the last seed recordId, would place the anchor inside the
191
+ // retained window and re-fetch records the client already displays.
192
+ replayAnchorRecordId;
169
193
  slots = [];
170
194
  toolSlotIndex = /* @__PURE__ */ new Map();
171
195
  textSlotIndex = {
@@ -174,16 +198,8 @@ var TurnBoundaryCompactionEngine = class {
174
198
  };
175
199
  constructor(opts = {}) {
176
200
  this.maxReplayBytes = normalizeCompactedReplayMaxBytes(opts.maxReplayBytes);
177
- this.maxJournalEvents = normalizeJournalCap(
178
- opts.maxJournalEvents,
179
- DEFAULT_MAX_JOURNAL_EVENTS,
180
- "maxJournalEvents"
181
- );
182
- this.maxJournalBytes = normalizeJournalCap(
183
- opts.maxJournalBytes,
184
- DEFAULT_MAX_JOURNAL_BYTES,
185
- "maxJournalBytes"
186
- );
201
+ this.maxJournalEvents = normalizeMaxJournalEvents(opts.maxJournalEvents);
202
+ this.maxJournalBytes = normalizeMaxJournalBytes(opts.maxJournalBytes);
187
203
  this.onReplayWindowEviction = opts.onReplayWindowEviction;
188
204
  }
189
205
  ingest(event, byteLength) {
@@ -192,6 +208,10 @@ var TurnBoundaryCompactionEngine = class {
192
208
  this.lastEventId = event.id;
193
209
  }
194
210
  if (TRANSIENT_TYPES.has(event.type)) return;
211
+ const seenRecordId = replayRecordId(event);
212
+ if (seenRecordId !== void 0) {
213
+ this.activeRecordId = seenRecordId;
214
+ }
195
215
  this.liveJournal.push(event);
196
216
  const bytes = byteLength ?? serializedBridgeEventByteLength(event) ?? 0;
197
217
  this.journalEntryBytes.push(bytes);
@@ -230,6 +250,8 @@ var TurnBoundaryCompactionEngine = class {
230
250
  retainedEvents: this.liveJournal.length,
231
251
  maxBytes: this.maxJournalBytes,
232
252
  maxEvents: this.maxJournalEvents,
253
+ // Pagination anchor — see makeHistoryTruncatedEvent.
254
+ ...this.activeRecordId !== void 0 ? { recordId: this.activeRecordId } : {},
233
255
  fullTranscriptAvailable: true
234
256
  }
235
257
  });
@@ -244,6 +266,8 @@ var TurnBoundaryCompactionEngine = class {
244
266
  if (this.closed) return;
245
267
  this.resetReplayWindow();
246
268
  this.lastEventId = snapshot.lastEventId;
269
+ this.activeRecordId = void 0;
270
+ this.activeRecordId = lastRecordIdIn(snapshot.compactedTurns);
247
271
  for (const event of snapshot.compactedTurns) {
248
272
  if (TRANSIENT_TYPES.has(event.type)) continue;
249
273
  this.addReplaySegment([event], 0);
@@ -256,6 +280,8 @@ var TurnBoundaryCompactionEngine = class {
256
280
  seedReplayEvents(events) {
257
281
  if (this.closed) return;
258
282
  this.resetReplayWindow();
283
+ this.activeRecordId = void 0;
284
+ this.activeRecordId = lastRecordIdIn(events);
259
285
  let recordEvents = [];
260
286
  let recordId;
261
287
  const flushRecord = /* @__PURE__ */ __name(() => {
@@ -289,6 +315,7 @@ var TurnBoundaryCompactionEngine = class {
289
315
  this.closed = true;
290
316
  this.resetReplayWindow();
291
317
  this.resetJournal();
318
+ this.activeRecordId = void 0;
292
319
  this.slots = [];
293
320
  this.toolSlotIndex.clear();
294
321
  this.clearTextSlotIndex();
@@ -487,6 +514,7 @@ var TurnBoundaryCompactionEngine = class {
487
514
  let droppedBytes = 0;
488
515
  let droppedEvents = 0;
489
516
  let droppedTurns = 0;
517
+ let lastDroppedRecordId;
490
518
  while (this.replayBytes > this.maxReplayBytes && this.activeReplaySegmentCount() > 1) {
491
519
  const dropped = this.replaySegments[this.replaySegmentStart];
492
520
  this.replaySegmentStart += 1;
@@ -497,8 +525,13 @@ var TurnBoundaryCompactionEngine = class {
497
525
  this.replayBytes -= dropped.bytes;
498
526
  this.truncatedEvents += dropped.events.length;
499
527
  this.truncatedTurns += dropped.turnCount;
528
+ const droppedRecordId = lastRecordIdIn(dropped.events);
529
+ if (droppedRecordId !== void 0) {
530
+ lastDroppedRecordId = droppedRecordId;
531
+ }
500
532
  }
501
533
  if (droppedSegmentCount > 0) {
534
+ this.replayAnchorRecordId ??= this.firstRetainedReplayRecordId() ?? lastDroppedRecordId;
502
535
  this.compactReplaySegmentQueueIfNeeded();
503
536
  this.notifyReplayWindowEviction({
504
537
  droppedBytes,
@@ -511,6 +544,13 @@ var TurnBoundaryCompactionEngine = class {
511
544
  });
512
545
  }
513
546
  }
547
+ firstRetainedReplayRecordId() {
548
+ for (let i = this.replaySegmentStart; i < this.replaySegments.length; i++) {
549
+ const recordId = lastRecordIdIn(this.replaySegments[i].events);
550
+ if (recordId !== void 0) return recordId;
551
+ }
552
+ return void 0;
553
+ }
514
554
  flattenReplaySegments() {
515
555
  return this.replaySegments.slice(this.replaySegmentStart).flatMap((segment) => segment.events);
516
556
  }
@@ -538,6 +578,15 @@ var TurnBoundaryCompactionEngine = class {
538
578
  retainedEvents,
539
579
  maxBytes: this.maxReplayBytes,
540
580
  ...this.truncatedTurns > 0 ? { truncatedTurns: this.truncatedTurns } : {},
581
+ // Pagination anchor for clients whose retained window lost every
582
+ // turn-boundary event (e.g. live-journal truncation during one
583
+ // long in-flight turn). Uses the eviction-time anchor, not
584
+ // `activeRecordId`, so a post-seed `ingest()` can't push it past
585
+ // records the client already displays. Undefined when no recordId
586
+ // was observed before the first eviction — the field is
587
+ // intentionally omitted in that case so old clients continue to
588
+ // validate the marker shape.
589
+ ...this.replayAnchorRecordId !== void 0 ? { recordId: this.replayAnchorRecordId } : {},
541
590
  fullTranscriptAvailable: true
542
591
  }
543
592
  };
@@ -548,6 +597,7 @@ var TurnBoundaryCompactionEngine = class {
548
597
  this.replayBytes = 0;
549
598
  this.truncatedEvents = 0;
550
599
  this.truncatedTurns = 0;
600
+ this.replayAnchorRecordId = void 0;
551
601
  }
552
602
  clearTextSlotIndex() {
553
603
  this.textSlotIndex.text.clear();
@@ -693,6 +743,7 @@ __name(mergeTranscriptUpdateMeta, "mergeTranscriptUpdateMeta");
693
743
 
694
744
  // packages/acp-bridge/src/session-source.ts
695
745
  init_esbuild_shims();
746
+ var SESSION_SOURCE_META_KEY = "qwen.session.source";
696
747
  var SESSION_SOURCE_TYPE_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;
697
748
  var MAX_SESSION_SOURCE_ID_LENGTH = 256;
698
749
  function parseSessionSource(sourceType, sourceId) {
@@ -1760,7 +1811,7 @@ function sliceLineRange(content, startLine, endLine) {
1760
1811
  }
1761
1812
  __name(sliceLineRange, "sliceLineRange");
1762
1813
  var BridgeClient = class {
1763
- constructor(resolveEntry, resolvePendingRestoreEvents, mediator, permissionTimeoutMs, maxPendingPerSession, fileSystem, onModelPromoted, onModePromoted, clientMcpSender, ownsSession = () => true, onTokenUsage, onCreateSubSession, onGenerationEvent, onWorkspaceGenerationEvent, onChannelDelivery) {
1814
+ constructor(resolveEntry, resolvePendingRestoreEvents, mediator, permissionTimeoutMs, maxPendingPerSession, fileSystem, onModelPromoted, onModePromoted, clientMcpSender, ownsSession = () => true, onTokenUsage, onCreateSubSession, onGenerationEvent, onWorkspaceGenerationEvent, onChannelDelivery, hasSessionSpawnInFlight = () => false) {
1764
1815
  this.resolveEntry = resolveEntry;
1765
1816
  this.resolvePendingRestoreEvents = resolvePendingRestoreEvents;
1766
1817
  this.mediator = mediator;
@@ -1776,6 +1827,7 @@ var BridgeClient = class {
1776
1827
  this.onGenerationEvent = onGenerationEvent;
1777
1828
  this.onWorkspaceGenerationEvent = onWorkspaceGenerationEvent;
1778
1829
  this.onChannelDelivery = onChannelDelivery;
1830
+ this.hasSessionSpawnInFlight = hasSessionSpawnInFlight;
1779
1831
  }
1780
1832
  static {
1781
1833
  __name(this, "BridgeClient");
@@ -2056,6 +2108,9 @@ var BridgeClient = class {
2056
2108
  if (method === SERVE_CONTROL_EXT_METHODS.channelDelivery) {
2057
2109
  return this.handleChannelDelivery(params);
2058
2110
  }
2111
+ if (method === TODO_STOP_GUARD_CONTINUATION_CLAIM_METHOD) {
2112
+ return this.handleTodoStopGuardContinuationClaim(params);
2113
+ }
2059
2114
  if (method !== MID_TURN_QUEUE_DRAIN_METHOD) {
2060
2115
  throw RequestError.methodNotFound(method);
2061
2116
  }
@@ -2068,9 +2123,6 @@ var BridgeClient = class {
2068
2123
  const hasQueuedPrompt = entry.pendingPromptList.some(
2069
2124
  (prompt) => prompt.state === "queued" && !prompt.abortController.signal.aborted
2070
2125
  );
2071
- if (params["todoStopGuardWatchQueuedPrompt"] === true) {
2072
- entry.todoStopGuardAwaitingQueuedPrompt = hasQueuedPrompt;
2073
- }
2074
2126
  if (drained.length > 0) {
2075
2127
  const byOriginator = /* @__PURE__ */ new Map();
2076
2128
  for (const item of drained) {
@@ -2092,6 +2144,45 @@ var BridgeClient = class {
2092
2144
  }
2093
2145
  return { messages, hasQueuedPrompt };
2094
2146
  }
2147
+ handleTodoStopGuardContinuationClaim(params) {
2148
+ const sessionId = typeof params["sessionId"] === "string" && params["sessionId"].length > 0 ? params["sessionId"] : void 0;
2149
+ if (!sessionId) return { claimed: false, hasQueuedPrompt: false };
2150
+ if (!this.ownsSession(sessionId)) {
2151
+ return { claimed: false, hasQueuedPrompt: false };
2152
+ }
2153
+ const entry = this.resolveEntry(sessionId);
2154
+ if (!entry) return { claimed: false, hasQueuedPrompt: false };
2155
+ const livePrompts = entry.pendingPromptList.filter(
2156
+ (prompt) => !prompt.abortController.signal.aborted
2157
+ );
2158
+ const promptId = typeof params["promptId"] === "string" && params["promptId"].length > 0 ? params["promptId"] : void 0;
2159
+ if (promptId) {
2160
+ const ownsRunningPrompt = entry.activePromptId === promptId && livePrompts.some(
2161
+ (prompt) => prompt.promptId === promptId && prompt.state === "running"
2162
+ );
2163
+ const hasCompetingRunningPrompt = livePrompts.some(
2164
+ (prompt) => prompt.promptId !== promptId && prompt.state === "running"
2165
+ );
2166
+ if (!ownsRunningPrompt || hasCompetingRunningPrompt) {
2167
+ return { claimed: false, hasQueuedPrompt: false };
2168
+ }
2169
+ const hasQueuedPrompt = livePrompts.some(
2170
+ (prompt) => prompt.state === "queued"
2171
+ );
2172
+ if (hasQueuedPrompt) {
2173
+ entry.todoStopGuardAwaitingQueuedPromptOwnerPromptId = promptId;
2174
+ return { claimed: false, hasQueuedPrompt: true };
2175
+ }
2176
+ if (entry.todoStopGuardAwaitingQueuedPromptOwnerPromptId === promptId) {
2177
+ delete entry.todoStopGuardAwaitingQueuedPromptOwnerPromptId;
2178
+ }
2179
+ return { claimed: true, hasQueuedPrompt: false };
2180
+ }
2181
+ if (entry.promptActive || livePrompts.length > 0) {
2182
+ return { claimed: false, hasQueuedPrompt: false };
2183
+ }
2184
+ return { claimed: true, hasQueuedPrompt: false };
2185
+ }
2095
2186
  async handleChannelDelivery(params) {
2096
2187
  if (!this.onChannelDelivery) {
2097
2188
  throw RequestError.methodNotFound(
@@ -2227,7 +2318,29 @@ var BridgeClient = class {
2227
2318
  `client-hosted MCP server '${server}' is not currently connected`
2228
2319
  );
2229
2320
  }
2230
- const response = await send(payload);
2321
+ const sessionId = params["sessionId"];
2322
+ if (sessionId !== void 0 && (typeof sessionId !== "string" || sessionId.length === 0)) {
2323
+ throw RequestError.invalidParams(
2324
+ void 0,
2325
+ "`sessionId` must be a non-empty string when provided"
2326
+ );
2327
+ }
2328
+ const ownsSession = typeof sessionId === "string" && this.ownsSession(sessionId);
2329
+ if (typeof sessionId === "string" && !ownsSession && !this.hasSessionSpawnInFlight()) {
2330
+ throw RequestError.invalidParams(
2331
+ void 0,
2332
+ `Session not owned by this channel: ${sessionId}`
2333
+ );
2334
+ }
2335
+ if (typeof sessionId === "string" && !ownsSession) {
2336
+ writeStderrLine(
2337
+ `[demux] session=${sessionId} type=client_mcp_message action=forwarded_without_session reason=session_registration_pending`
2338
+ );
2339
+ }
2340
+ const response = await send(
2341
+ payload,
2342
+ typeof sessionId === "string" && ownsSession ? { sessionId } : void 0
2343
+ );
2231
2344
  return { payload: response };
2232
2345
  }
2233
2346
  /**
@@ -5315,6 +5428,15 @@ function isRecord3(value) {
5315
5428
  return typeof value === "object" && value !== null && !Array.isArray(value);
5316
5429
  }
5317
5430
  __name(isRecord3, "isRecord");
5431
+ function sessionSourceRequestMeta(sourceType, sourceId) {
5432
+ return sourceType ? {
5433
+ [SESSION_SOURCE_META_KEY]: {
5434
+ sourceType,
5435
+ ...sourceId !== void 0 ? { sourceId } : {}
5436
+ }
5437
+ } : {};
5438
+ }
5439
+ __name(sessionSourceRequestMeta, "sessionSourceRequestMeta");
5318
5440
  function isDefinitiveAcpRequestError(error) {
5319
5441
  if (error instanceof RequestError) return true;
5320
5442
  if (!isRecord3(error)) return false;
@@ -5784,7 +5906,7 @@ var SESSION_TRANSCRIPT_TIMEOUT_MS = 6e4;
5784
5906
  var SHELL_COMMAND_TIMEOUT_MS = 12e4;
5785
5907
  var MAX_SHELL_OUTPUT_FOR_HISTORY = 1e4;
5786
5908
  var MAX_MID_TURN_QUEUE_DEPTH = 20;
5787
- var DEFAULT_MAX_SESSIONS = 20;
5909
+ var DEFAULT_MAX_SESSIONS = 32;
5788
5910
  var DEFAULT_MAX_PENDING_PROMPTS_PER_SESSION = 5;
5789
5911
  var MAX_EVENT_RING_SIZE = 1e6;
5790
5912
  var DEFAULT_PERMISSION_TIMEOUT_MS = 5 * 60 * 1e3;
@@ -5844,6 +5966,8 @@ function createAcpSessionBridge(opts) {
5844
5966
  const compactedReplayMaxBytes = normalizeCompactedReplayMaxBytes(
5845
5967
  opts.compactedReplayMaxBytes
5846
5968
  );
5969
+ const maxJournalEvents = normalizeMaxJournalEvents(opts.maxJournalEvents);
5970
+ const maxJournalBytes = normalizeMaxJournalBytes(opts.maxJournalBytes);
5847
5971
  const channelFactory = opts.channelFactory ?? defaultSpawnChannelFactory;
5848
5972
  const childEnvOverrides = opts.childEnvOverrides ? Object.freeze({ ...opts.childEnvOverrides }) : Object.freeze({});
5849
5973
  const initTimeoutMs = opts.initializeTimeoutMs ?? DEFAULT_INIT_TIMEOUT_MS;
@@ -6259,98 +6383,124 @@ function createAcpSessionBridge(opts) {
6259
6383
  })
6260
6384
  );
6261
6385
  const sessionIds = /* @__PURE__ */ new Set();
6262
- const client = new BridgeClient(
6263
- // BfFut: ACP today carries a sessionId on every per-session
6264
- // notification / request, so the no-sessionId branch is
6265
- // technically unreachable. But the channel is multi-session
6266
- // (Stage 1.5 multiplex), so if ACP ever grows a no-sessionId
6267
- // call we'd silently drop it on a multi-session channel
6268
- // instead of throwing. Surface that ambiguity loudly.
6269
- (sessionId) => {
6270
- if (sessionId) return byId.get(sessionId);
6271
- if (channelInfo && channelInfo.sessionIds.size > 1) {
6272
- throw new Error(
6273
- "BridgeClient: ACP call without sessionId on a multi-session channel cannot be routed \u2014 workspace=" + boundWorkspace
6386
+ let client;
6387
+ let connection;
6388
+ try {
6389
+ client = new BridgeClient(
6390
+ // BfFut: ACP today carries a sessionId on every per-session
6391
+ // notification / request, so the no-sessionId branch is
6392
+ // technically unreachable. But the channel is multi-session
6393
+ // (Stage 1.5 multiplex), so if ACP ever grows a no-sessionId
6394
+ // call we'd silently drop it on a multi-session channel
6395
+ // instead of throwing. Surface that ambiguity loudly.
6396
+ (sessionId) => {
6397
+ if (sessionId) return byId.get(sessionId);
6398
+ if (channelInfo && channelInfo.sessionIds.size > 1) {
6399
+ throw new Error(
6400
+ "BridgeClient: ACP call without sessionId on a multi-session channel cannot be routed \u2014 workspace=" + boundWorkspace
6401
+ );
6402
+ }
6403
+ return void 0;
6404
+ },
6405
+ (sessionId) => sessionId ? pendingRestoreEvents.get(sessionId) : void 0,
6406
+ permissionMediator,
6407
+ permissionTimeoutMs,
6408
+ maxPendingPerSession,
6409
+ // Forward the optional `BridgeFileSystem` injection so
6410
+ // production `qwen serve` can wire the `WorkspaceFileSystem`
6411
+ // adapter into BridgeClient's fs proxy methods. Tests + Mode A
6412
+ // consumers + channels / IDE companion omit it; BridgeClient
6413
+ // falls back to its inline fs proxy.
6414
+ opts.fileSystem,
6415
+ // §2.3: centralised model_switched publish — keeps cache + generation
6416
+ // update atomic. BridgeClient calls this instead of inlining publish.
6417
+ (entry, modelId, originator) => publishModelSwitched(entry, modelId, originator),
6418
+ // A2: centralised approval_mode_changed publish on in-session mode
6419
+ // promotion. `previous` is read from the bridge state cache.
6420
+ (entry, modeId, originator) => {
6421
+ const se = entry;
6422
+ publishApprovalModeChanged(
6423
+ se,
6424
+ {
6425
+ previous: se.currentApprovalMode ?? "default",
6426
+ next: modeId,
6427
+ persisted: false
6428
+ },
6429
+ originator
6274
6430
  );
6275
- }
6276
- return void 0;
6277
- },
6278
- (sessionId) => sessionId ? pendingRestoreEvents.get(sessionId) : void 0,
6279
- permissionMediator,
6280
- permissionTimeoutMs,
6281
- maxPendingPerSession,
6282
- // Forward the optional `BridgeFileSystem` injection so
6283
- // production `qwen serve` can wire the `WorkspaceFileSystem`
6284
- // adapter into BridgeClient's fs proxy methods. Tests + Mode A
6285
- // consumers + channels / IDE companion omit it; BridgeClient
6286
- // falls back to its inline fs proxy.
6287
- opts.fileSystem,
6288
- // §2.3: centralised model_switched publish — keeps cache + generation
6289
- // update atomic. BridgeClient calls this instead of inlining publish.
6290
- (entry, modelId, originator) => publishModelSwitched(entry, modelId, originator),
6291
- // A2: centralised approval_mode_changed publish on in-session mode
6292
- // promotion. `previous` is read from the bridge state cache.
6293
- (entry, modeId, originator) => {
6294
- const se = entry;
6295
- publishApprovalModeChanged(
6296
- se,
6297
- {
6298
- previous: se.currentApprovalMode ?? "default",
6299
- next: modeId,
6300
- persisted: false
6301
- },
6302
- originator
6431
+ },
6432
+ // Reverse tool channel (issue #5626, Phase 2): forward the optional
6433
+ // client-hosted-MCP sender lookup so `BridgeClient.extMethod` can
6434
+ // answer `qwen/control/client_mcp/message` from the child by reaching
6435
+ // the per-WS-connection `ClientMcpRegistrar`. Omitted callers (tests,
6436
+ // Mode A) never host a client MCP server, so the method stays
6437
+ // unreachable.
6438
+ opts.clientMcpSender,
6439
+ (sessionId) => sessionIds.has(sessionId),
6440
+ // Daemon token-burn accounting: forward per-round token usage observed
6441
+ // at the session/update fan-in to the daemon host's metrics ring via
6442
+ // the telemetry seam. Optional-chained so non-daemon callers (tests,
6443
+ // Mode A) that wire no `tokenUsage` metric are a silent no-op.
6444
+ (inputTokens, outputTokens, durationMs, apiErrors, apiRetries) => telemetry.metrics?.tokenUsage?.(
6445
+ inputTokens,
6446
+ outputTokens,
6447
+ durationMs,
6448
+ apiErrors,
6449
+ apiRetries
6450
+ ),
6451
+ // `create_sub_session` tool: forward the request/response hook so a child
6452
+ // tool can ask the daemon to spawn a sub-session and (for 'first-turn')
6453
+ // return its result. Omitted → the method reports daemon-only.
6454
+ opts.onCreateSubSession,
6455
+ (sessionId, event) => {
6456
+ const request = generationRequests.get(event.requestId);
6457
+ if (!request || request.sessionId !== sessionId) return;
6458
+ if (request.queue.push(event)) return;
6459
+ request.settled = true;
6460
+ generationRequests.delete(event.requestId);
6461
+ request.queue.fail(
6462
+ new Error("Generation stream consumer too slow")
6463
+ );
6464
+ void request.connection.extMethod(SERVE_CONTROL_EXT_METHODS.sessionGenerationCancel, {
6465
+ sessionId,
6466
+ requestId: event.requestId
6467
+ }).catch(() => void 0);
6468
+ },
6469
+ (event) => {
6470
+ const request = workspaceGenerationRequests.get(event.requestId);
6471
+ if (!request) return;
6472
+ if (request.queue.push(event)) return;
6473
+ request.settled = true;
6474
+ workspaceGenerationRequests.delete(event.requestId);
6475
+ request.queue.fail(
6476
+ new Error("Generation stream consumer too slow")
6477
+ );
6478
+ void request.connection?.extMethod(SERVE_CONTROL_EXT_METHODS.workspaceGenerationCancel, {
6479
+ requestId: event.requestId
6480
+ }).catch(() => void 0);
6481
+ },
6482
+ opts.onChannelDelivery,
6483
+ () => channelInfo?.sessionIds === sessionIds && channelInfo.sessionSpawnsInFlight > 0
6484
+ );
6485
+ connection = new ClientSideConnection(() => client, channel.stream);
6486
+ } catch (error) {
6487
+ try {
6488
+ channel.killSync();
6489
+ } catch {
6490
+ }
6491
+ try {
6492
+ await Promise.race([
6493
+ channel.exited.then(() => void 0),
6494
+ channel.kill()
6495
+ ]);
6496
+ } catch (teardownError) {
6497
+ throw new AggregateError(
6498
+ [error, teardownError],
6499
+ "ACP channel construction and teardown failed"
6303
6500
  );
6304
- },
6305
- // Reverse tool channel (issue #5626, Phase 2): forward the optional
6306
- // client-hosted-MCP sender lookup so `BridgeClient.extMethod` can
6307
- // answer `qwen/control/client_mcp/message` from the child by reaching
6308
- // the per-WS-connection `ClientMcpRegistrar`. Omitted callers (tests,
6309
- // Mode A) never host a client MCP server, so the method stays
6310
- // unreachable.
6311
- opts.clientMcpSender,
6312
- (sessionId) => sessionIds.has(sessionId),
6313
- // Daemon token-burn accounting: forward per-round token usage observed
6314
- // at the session/update fan-in to the daemon host's metrics ring via
6315
- // the telemetry seam. Optional-chained so non-daemon callers (tests,
6316
- // Mode A) that wire no `tokenUsage` metric are a silent no-op.
6317
- (inputTokens, outputTokens, durationMs, apiErrors, apiRetries) => telemetry.metrics?.tokenUsage?.(
6318
- inputTokens,
6319
- outputTokens,
6320
- durationMs,
6321
- apiErrors,
6322
- apiRetries
6323
- ),
6324
- // `create_sub_session` tool: forward the request/response hook so a child
6325
- // tool can ask the daemon to spawn a sub-session and (for 'first-turn')
6326
- // return its result. Omitted → the method reports daemon-only.
6327
- opts.onCreateSubSession,
6328
- (sessionId, event) => {
6329
- const request = generationRequests.get(event.requestId);
6330
- if (!request || request.sessionId !== sessionId) return;
6331
- if (request.queue.push(event)) return;
6332
- request.settled = true;
6333
- generationRequests.delete(event.requestId);
6334
- request.queue.fail(new Error("Generation stream consumer too slow"));
6335
- void request.connection.extMethod(SERVE_CONTROL_EXT_METHODS.sessionGenerationCancel, {
6336
- sessionId,
6337
- requestId: event.requestId
6338
- }).catch(() => void 0);
6339
- },
6340
- (event) => {
6341
- const request = workspaceGenerationRequests.get(event.requestId);
6342
- if (!request) return;
6343
- if (request.queue.push(event)) return;
6344
- request.settled = true;
6345
- workspaceGenerationRequests.delete(event.requestId);
6346
- request.queue.fail(new Error("Generation stream consumer too slow"));
6347
- void request.connection?.extMethod(SERVE_CONTROL_EXT_METHODS.workspaceGenerationCancel, {
6348
- requestId: event.requestId
6349
- }).catch(() => void 0);
6350
- },
6351
- opts.onChannelDelivery
6352
- );
6353
- const connection = new ClientSideConnection(() => client, channel.stream);
6501
+ }
6502
+ throw error;
6503
+ }
6354
6504
  const info = {
6355
6505
  id: acpChannelId,
6356
6506
  channel,
@@ -6507,7 +6657,7 @@ function createAcpSessionBridge(opts) {
6507
6657
  }
6508
6658
  }
6509
6659
  __name(ensureChannel, "ensureChannel");
6510
- async function doSpawn(modelServiceId, effectiveScope, approvalMode, requestedClientId, onSessionRegistered, parentSessionId, sourceType, sourceId, worktree, branch) {
6660
+ async function doSpawn(modelServiceId, effectiveScope, approvalMode, requestedClientId, onSessionRegistered, parentSessionId, sourceType, sourceId, worktree, branch, requestedSessionId) {
6511
6661
  const channelPath = channelInfo && !channelInfo.isDying ? "reused" : inFlightChannelSpawn ? "joined" : "spawned_on_request";
6512
6662
  const ci = await telemetry.withSpan(
6513
6663
  "channel.wait",
@@ -6533,12 +6683,27 @@ function createAcpSessionBridge(opts) {
6533
6683
  "qwen-code.daemon.acp_channel.id": ci.id
6534
6684
  },
6535
6685
  async () => {
6686
+ const request = telemetry.injectPromptContext({
6687
+ cwd: boundWorkspace,
6688
+ mcpServers: [],
6689
+ ...requestedSessionId || sourceType ? {
6690
+ _meta: {
6691
+ ...sessionSourceRequestMeta(sourceType, sourceId),
6692
+ ...requestedSessionId ? {
6693
+ [REQUESTED_SESSION_ID_META_KEY]: requestedSessionId
6694
+ } : {}
6695
+ }
6696
+ } : {}
6697
+ });
6536
6698
  const response = await withTimeout(
6537
6699
  ci.connection.newSession(
6538
- telemetry.injectPromptContext({
6539
- cwd: boundWorkspace,
6540
- mcpServers: []
6541
- })
6700
+ worktree ? {
6701
+ ...request,
6702
+ _meta: {
6703
+ ...isRecord3(request._meta) ? request._meta : {},
6704
+ [WORKTREE_MCP_DEFER_META_KEY]: true
6705
+ }
6706
+ } : request
6542
6707
  ),
6543
6708
  initTimeoutMs,
6544
6709
  "newSession"
@@ -7109,7 +7274,7 @@ function createAcpSessionBridge(opts) {
7109
7274
  cpuPercent: info.childCpuPercent ?? 0
7110
7275
  };
7111
7276
  }, "getChildResourceSnapshot");
7112
- const requestSessionStatus = /* @__PURE__ */ __name(async (sessionId, method, params = {}) => {
7277
+ const requestSessionStatus = /* @__PURE__ */ __name(async (sessionId, method, params = {}, timeoutMs = initTimeoutMs) => {
7113
7278
  const entry = byId.get(sessionId);
7114
7279
  if (!entry) throw new SessionNotFoundError(sessionId);
7115
7280
  const info = channelInfoForEntry(entry);
@@ -7117,7 +7282,7 @@ function createAcpSessionBridge(opts) {
7117
7282
  const response = await Promise.race([
7118
7283
  withTimeout(
7119
7284
  entry.connection.extMethod(method, { ...params, sessionId }),
7120
- initTimeoutMs,
7285
+ timeoutMs,
7121
7286
  method
7122
7287
  ),
7123
7288
  getTransportClosedReject(entry)
@@ -7207,6 +7372,8 @@ function createAcpSessionBridge(opts) {
7207
7372
  void 0,
7208
7373
  new TurnBoundaryCompactionEngine({
7209
7374
  maxReplayBytes: compactedReplayMaxBytes,
7375
+ maxJournalEvents,
7376
+ maxJournalBytes,
7210
7377
  onReplayWindowEviction: /* @__PURE__ */ __name((eviction) => {
7211
7378
  teeServeDebugLine(
7212
7379
  `replay window evicted ${JSON.stringify(eviction)}`
@@ -7310,6 +7477,7 @@ function createAcpSessionBridge(opts) {
7310
7477
  const entry = {
7311
7478
  sessionId,
7312
7479
  workspaceCwd,
7480
+ effectiveCwd: workspaceCwd,
7313
7481
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
7314
7482
  ...options.parentSessionId ? { parentSessionId: options.parentSessionId } : {},
7315
7483
  ...options.sourceType ? { sourceType: options.sourceType } : {},
@@ -7326,6 +7494,7 @@ function createAcpSessionBridge(opts) {
7326
7494
  }),
7327
7495
  recordingDegraded: false,
7328
7496
  closing: false,
7497
+ cwdChangeQueue: Promise.resolve(),
7329
7498
  promptQueue: Promise.resolve(),
7330
7499
  pendingPromptCount: 0,
7331
7500
  pendingPromptList: [],
@@ -7592,6 +7761,46 @@ function createAcpSessionBridge(opts) {
7592
7761
  return replayFieldsFor(entry, "load");
7593
7762
  }
7594
7763
  __name(refreshedReplayFieldsFor, "refreshedReplayFieldsFor");
7764
+ function transcriptEventRecordId(event) {
7765
+ if (event.type !== "session_update") return void 0;
7766
+ const data = event.data;
7767
+ if (!data || typeof data !== "object" || Array.isArray(data))
7768
+ return void 0;
7769
+ const rec = data;
7770
+ const update = rec["update"];
7771
+ const meta = update && typeof update === "object" && !Array.isArray(update) ? update["_meta"] : rec["_meta"];
7772
+ if (!meta || typeof meta !== "object" || Array.isArray(meta))
7773
+ return void 0;
7774
+ const recordId = meta["qwen.session.recordId"];
7775
+ return typeof recordId === "string" ? recordId : void 0;
7776
+ }
7777
+ __name(transcriptEventRecordId, "transcriptEventRecordId");
7778
+ async function resolveHistoryAnchorRecordId(entry, replayFields) {
7779
+ const events = [
7780
+ ...replayFields.compactedReplay ?? [],
7781
+ ...replayFields.liveJournal ?? []
7782
+ ];
7783
+ const hasMarker = events.some((e) => e.type === "history_truncated");
7784
+ if (!hasMarker) return void 0;
7785
+ const hasRecordId = events.some(
7786
+ (e) => transcriptEventRecordId(e) !== void 0 || e.type === "history_truncated" && isRecord3(e.data) && typeof e.data["recordId"] === "string"
7787
+ );
7788
+ if (hasRecordId) return void 0;
7789
+ try {
7790
+ const page = await requestSessionTranscriptPage({
7791
+ sessionId: entry.sessionId,
7792
+ direction: "backward",
7793
+ limit: 50
7794
+ });
7795
+ for (const event of page.events) {
7796
+ const recordId = transcriptEventRecordId(event);
7797
+ if (recordId !== void 0) return recordId;
7798
+ }
7799
+ } catch {
7800
+ }
7801
+ return void 0;
7802
+ }
7803
+ __name(resolveHistoryAnchorRecordId, "resolveHistoryAnchorRecordId");
7595
7804
  async function restoreSession(action, req, options = {}) {
7596
7805
  if (shuttingDown) {
7597
7806
  throw new Error("AcpSessionBridge is shutting down");
@@ -7603,6 +7812,7 @@ function createAcpSessionBridge(opts) {
7603
7812
  );
7604
7813
  }
7605
7814
  const historyReplay = action === "load" ? req.historyReplay ?? "stream" : "stream";
7815
+ const hideInheritedHistory = action === "load" && req.hideInheritedHistory === true;
7606
7816
  const existing = byId.get(req.sessionId);
7607
7817
  if (existing) {
7608
7818
  if (existing.closing) {
@@ -7612,6 +7822,7 @@ function createAcpSessionBridge(opts) {
7612
7822
  );
7613
7823
  }
7614
7824
  const replayFields = action === "load" && req.historyPageSize !== void 0 ? await refreshedReplayFieldsFor(existing, req.historyPageSize) : replayFieldsFor(existing, action);
7825
+ const historyAnchorRecordId = action === "load" ? await resolveHistoryAnchorRecordId(existing, replayFields) : void 0;
7615
7826
  if (byId.get(req.sessionId) !== existing || existing.closing) {
7616
7827
  throw new SessionNotFoundError(req.sessionId);
7617
7828
  }
@@ -7633,12 +7844,13 @@ function createAcpSessionBridge(opts) {
7633
7844
  // caller saw; spawn-only sessions don't carry a state payload.
7634
7845
  state: existing.restoreState ?? {},
7635
7846
  hasActivePrompt: existing.promptActive,
7636
- ...replayFields
7847
+ ...replayFields,
7848
+ ...historyAnchorRecordId !== void 0 ? { historyAnchorRecordId } : {}
7637
7849
  };
7638
7850
  }
7639
7851
  const inFlight = inFlightRestores.get(req.sessionId);
7640
7852
  if (inFlight) {
7641
- if (action !== inFlight.action || historyReplay !== inFlight.historyReplay) {
7853
+ if (action !== inFlight.action || historyReplay !== inFlight.historyReplay || hideInheritedHistory !== inFlight.hideInheritedHistory) {
7642
7854
  throw new RestoreInProgressError(
7643
7855
  req.sessionId,
7644
7856
  inFlight.action,
@@ -7720,11 +7932,20 @@ function createAcpSessionBridge(opts) {
7720
7932
  // intentionally has no `mcpServers` field for the
7721
7933
  // same reason.
7722
7934
  mcpServers: [],
7723
- ...historyReplay === "response" ? {
7935
+ ...historyReplay === "response" || hideInheritedHistory || req.sourceType ? {
7724
7936
  _meta: {
7725
- [LOAD_REPLAY_MODE_META_KEY]: LOAD_REPLAY_BULK_MODE,
7726
- ...req.historyPageSize !== void 0 ? {
7727
- [LOAD_REPLAY_PAGE_SIZE_META_KEY]: req.historyPageSize
7937
+ ...sessionSourceRequestMeta(
7938
+ req.sourceType,
7939
+ req.sourceId
7940
+ ),
7941
+ ...historyReplay === "response" ? {
7942
+ [LOAD_REPLAY_MODE_META_KEY]: LOAD_REPLAY_BULK_MODE,
7943
+ ...req.historyPageSize !== void 0 ? {
7944
+ [LOAD_REPLAY_PAGE_SIZE_META_KEY]: req.historyPageSize
7945
+ } : {}
7946
+ } : {},
7947
+ ...hideInheritedHistory ? {
7948
+ [LOAD_REPLAY_HIDE_INHERITED_META_KEY]: true
7728
7949
  } : {}
7729
7950
  }
7730
7951
  } : {}
@@ -7740,7 +7961,13 @@ function createAcpSessionBridge(opts) {
7740
7961
  ci.connection.unstable_resumeSession({
7741
7962
  sessionId: req.sessionId,
7742
7963
  cwd: workspaceKey,
7743
- mcpServers: []
7964
+ mcpServers: [],
7965
+ ...req.sourceType ? {
7966
+ _meta: sessionSourceRequestMeta(
7967
+ req.sourceType,
7968
+ req.sourceId
7969
+ )
7970
+ } : {}
7744
7971
  }),
7745
7972
  initTimeoutMs,
7746
7973
  "resumeSession"
@@ -7918,6 +8145,7 @@ function createAcpSessionBridge(opts) {
7918
8145
  inFlightRestores.set(req.sessionId, {
7919
8146
  action,
7920
8147
  historyReplay,
8148
+ hideInheritedHistory,
7921
8149
  promise,
7922
8150
  coalesceState
7923
8151
  });
@@ -8046,6 +8274,8 @@ function createAcpSessionBridge(opts) {
8046
8274
  maxPendingPromptsPerSession: maxPendingPromptsPerSession === Infinity ? null : maxPendingPromptsPerSession,
8047
8275
  eventRingSize,
8048
8276
  compactedReplayMaxBytes,
8277
+ maxJournalEvents,
8278
+ maxJournalBytes,
8049
8279
  channelIdleTimeoutMs: resolvedChannelIdleTimeoutMs(),
8050
8280
  sessionIdleTimeoutMs
8051
8281
  },
@@ -8228,7 +8458,8 @@ function createAcpSessionBridge(opts) {
8228
8458
  source.sourceType,
8229
8459
  source.sourceId,
8230
8460
  req.worktree,
8231
- req.branch
8461
+ req.branch,
8462
+ req.sessionId
8232
8463
  );
8233
8464
  const tracker = effectiveScope === "single" ? workspaceKey : `${workspaceKey}#${randomUUID2()}`;
8234
8465
  inFlightSpawns.set(tracker, promise);
@@ -8348,13 +8579,17 @@ function createAcpSessionBridge(opts) {
8348
8579
  "abort",
8349
8580
  () => {
8350
8581
  if (pendingEntry.state !== "queued") return;
8351
- if (!entry.todoStopGuardAwaitingQueuedPrompt) return;
8582
+ const waitingOwnerPromptId = entry.todoStopGuardAwaitingQueuedPromptOwnerPromptId;
8583
+ if (!waitingOwnerPromptId) return;
8352
8584
  const hasAnotherQueuedPrompt = entry.pendingPromptList.some(
8353
8585
  (candidate) => candidate !== pendingEntry && candidate.state === "queued" && !candidate.abortController.signal.aborted
8354
8586
  );
8355
8587
  if (hasAnotherQueuedPrompt) return;
8356
- entry.todoStopGuardAwaitingQueuedPrompt = false;
8357
- void entry.connection.extMethod(TODO_STOP_GUARD_QUEUE_RELEASE_METHOD, { sessionId }).catch((error) => {
8588
+ delete entry.todoStopGuardAwaitingQueuedPromptOwnerPromptId;
8589
+ void entry.connection.extMethod(TODO_STOP_GUARD_QUEUE_RELEASE_METHOD, {
8590
+ sessionId,
8591
+ promptId: waitingOwnerPromptId
8592
+ }).catch((error) => {
8358
8593
  writeStderrLine(
8359
8594
  `qwen serve: Todo Stop Guard queued-prompt release failed for ${JSON.stringify(sessionId)}: ${error instanceof Error ? error.message : String(error)}`
8360
8595
  );
@@ -8385,7 +8620,7 @@ function createAcpSessionBridge(opts) {
8385
8620
  throw new DOMException("Prompt aborted", "AbortError");
8386
8621
  }
8387
8622
  if (pendingEntry.state === "queued") {
8388
- entry.todoStopGuardAwaitingQueuedPrompt = false;
8623
+ delete entry.todoStopGuardAwaitingQueuedPromptOwnerPromptId;
8389
8624
  pendingEntry.state = "running";
8390
8625
  entry.events.publish({
8391
8626
  type: "pending_prompt_started",
@@ -8790,12 +9025,18 @@ function createAcpSessionBridge(opts) {
8790
9025
  if (shuttingDown) throw new Error("AcpSessionBridge is shutting down");
8791
9026
  const entry = byId.get(sessionId);
8792
9027
  if (!entry) throw new SessionNotFoundError(sessionId);
9028
+ const source = parseSessionSource(req.sourceType, req.sourceId);
9029
+ if ("error" in source) {
9030
+ throw new InvalidSessionMetadataError("sourceType", source.error);
9031
+ }
9032
+ const isSideTask = source.sourceType === "side_task";
8793
9033
  let originatorClientId;
8794
9034
  if (context?.clientId !== void 0) {
8795
9035
  originatorClientId = resolveTrustedClientId(entry, context.clientId);
8796
9036
  }
8797
- const branchResult = entry.promptQueue.then(async () => {
8798
- if (entry.promptActive) {
9037
+ const concurrentSideTask = isSideTask && entry.promptActive;
9038
+ const branchResult = (concurrentSideTask ? Promise.resolve() : entry.promptQueue).then(async () => {
9039
+ if (entry.promptActive && !isSideTask) {
8799
9040
  throw new BranchWhilePromptActiveError(sessionId);
8800
9041
  }
8801
9042
  if (byId.size + inFlightSpawns.size + inFlightRestores.size >= maxSessions) {
@@ -8815,13 +9056,16 @@ function createAcpSessionBridge(opts) {
8815
9056
  try {
8816
9057
  const ci = await ensureChannel();
8817
9058
  const result = await withTimeout(
8818
- ci.connection.extMethod(SERVE_CONTROL_EXT_METHODS.sessionBranch, {
8819
- sessionId,
8820
- cwd: boundWorkspace,
8821
- name: req.name
8822
- }),
9059
+ ci.connection.extMethod(
9060
+ isSideTask ? SERVE_CONTROL_EXT_METHODS.sessionSideTask : SERVE_CONTROL_EXT_METHODS.sessionBranch,
9061
+ {
9062
+ sessionId,
9063
+ cwd: boundWorkspace,
9064
+ name: req.name
9065
+ }
9066
+ ),
8823
9067
  initTimeoutMs,
8824
- "branchSession"
9068
+ isSideTask ? "createSideTaskSession" : "branchSession"
8825
9069
  );
8826
9070
  if (!result || typeof result.newSessionId !== "string") {
8827
9071
  throw new Error(
@@ -8832,12 +9076,18 @@ function createAcpSessionBridge(opts) {
8832
9076
  const branchDisplayName = typeof rawBranchName === "string" ? rawBranchName : result.newSessionId.slice(0, 8);
8833
9077
  let restored;
8834
9078
  try {
9079
+ const hideInheritedHistory = req.replayInheritedHistory === false;
8835
9080
  restored = await restoreSession(
8836
9081
  "load",
8837
9082
  {
8838
9083
  sessionId: result.newSessionId,
8839
9084
  workspaceCwd: boundWorkspace,
8840
- clientId: context?.clientId
9085
+ clientId: context?.clientId,
9086
+ ...hideInheritedHistory ? {
9087
+ historyReplay: "response",
9088
+ hideInheritedHistory: true
9089
+ } : {},
9090
+ ...source
8841
9091
  },
8842
9092
  {
8843
9093
  skipFreshSessionAdmission: true
@@ -8862,35 +9112,80 @@ function createAcpSessionBridge(opts) {
8862
9112
  }
8863
9113
  const newEntry = byId.get(result.newSessionId);
8864
9114
  if (newEntry) newEntry.displayName = branchDisplayName;
8865
- const eventData = {
8866
- sourceSessionId: sessionId,
8867
- newSessionId: result.newSessionId,
8868
- displayName: branchDisplayName
8869
- };
8870
- const branchEnvelope = {
8871
- type: "session_branched",
8872
- data: eventData,
8873
- ...originatorClientId ? { originatorClientId } : {}
8874
- };
8875
- newEntry?.events.publish(branchEnvelope);
9115
+ let sourcePersisted;
9116
+ if (newEntry?.sourceType) {
9117
+ try {
9118
+ const sourceResult = await withTimeout(
9119
+ newEntry.connection.extMethod(
9120
+ SERVE_CONTROL_EXT_METHODS.sessionSource,
9121
+ {
9122
+ sessionId: newEntry.sessionId,
9123
+ sourceType: newEntry.sourceType,
9124
+ ...newEntry.sourceId !== void 0 ? { sourceId: newEntry.sourceId } : {}
9125
+ }
9126
+ ),
9127
+ initTimeoutMs,
9128
+ "sessionSource"
9129
+ );
9130
+ sourcePersisted = sourceResult?.persisted === true;
9131
+ } catch (error) {
9132
+ sourcePersisted = false;
9133
+ writeStderrLine(
9134
+ `qwen serve: source metadata for branched session ${result.newSessionId} was not persisted: ${error instanceof Error ? error.message : String(error)}`
9135
+ );
9136
+ }
9137
+ }
9138
+ if (!isSideTask) {
9139
+ const eventData = {
9140
+ sourceSessionId: sessionId,
9141
+ newSessionId: result.newSessionId,
9142
+ displayName: branchDisplayName
9143
+ };
9144
+ const branchEnvelope = {
9145
+ type: "session_branched",
9146
+ data: eventData,
9147
+ ...originatorClientId ? { originatorClientId } : {}
9148
+ };
9149
+ newEntry?.events.publish(branchEnvelope);
9150
+ }
8876
9151
  return {
8877
9152
  ...restored,
8878
9153
  displayName: branchDisplayName,
8879
9154
  forkedFrom: {
8880
9155
  sessionId,
8881
9156
  displayName: entry.displayName ?? sessionId.slice(0, 8)
8882
- }
9157
+ },
9158
+ ...sourcePersisted !== void 0 ? { sourcePersisted } : {}
8883
9159
  };
8884
9160
  } finally {
8885
9161
  releaseAdmissionOnce();
8886
9162
  }
8887
9163
  });
8888
- entry.promptQueue = branchResult.then(
8889
- () => void 0,
8890
- () => void 0
8891
- );
9164
+ if (!concurrentSideTask) {
9165
+ entry.promptQueue = branchResult.then(
9166
+ () => void 0,
9167
+ () => void 0
9168
+ );
9169
+ }
8892
9170
  return branchResult;
8893
9171
  },
9172
+ async createSideTaskSession(sessionId, req, context) {
9173
+ const result = await this.branchSession(
9174
+ sessionId,
9175
+ {
9176
+ name: req.name,
9177
+ sourceType: "side_task",
9178
+ sourceId: sessionId,
9179
+ replayInheritedHistory: false
9180
+ },
9181
+ context
9182
+ );
9183
+ const { forkedFrom: _forkedFrom, ...sideTask } = result;
9184
+ return {
9185
+ ...sideTask,
9186
+ parentSessionId: sessionId
9187
+ };
9188
+ },
8894
9189
  async changeSessionCwd(sessionId, req, context) {
8895
9190
  if (shuttingDown) throw new Error("AcpSessionBridge is shutting down");
8896
9191
  const entry = byId.get(sessionId);
@@ -8918,6 +9213,7 @@ function createAcpSessionBridge(opts) {
8918
9213
  `changeSessionCwd: unexpected response shape from agent: ${JSON.stringify(raw)}`
8919
9214
  );
8920
9215
  }
9216
+ entry.effectiveCwd = extResult.newCwd;
8921
9217
  if (extResult.previousCwd !== extResult.newCwd) {
8922
9218
  entry.events.publish({
8923
9219
  type: "session_cwd_changed",
@@ -8935,6 +9231,10 @@ function createAcpSessionBridge(opts) {
8935
9231
  () => void 0,
8936
9232
  () => void 0
8937
9233
  );
9234
+ entry.cwdChangeQueue = cdPromise.then(
9235
+ () => void 0,
9236
+ () => void 0
9237
+ );
8938
9238
  const result = await withTimeout(
8939
9239
  cdPromise,
8940
9240
  Math.max(initTimeoutMs, 3e4),
@@ -9436,44 +9736,79 @@ function createAcpSessionBridge(opts) {
9436
9736
  },
9437
9737
  async refreshExtensionsForAllSessions(data) {
9438
9738
  const sessions = Array.from(byId.values());
9739
+ const bootstrapRefreshConnections = /* @__PURE__ */ new Set();
9740
+ const refreshSession = /* @__PURE__ */ __name(async (entry, refreshBootstrap) => {
9741
+ let inFlight = inFlightExtensionRefreshes.get(entry.sessionId);
9742
+ if (!inFlight || inFlight.connection !== entry.connection || refreshBootstrap && !inFlight.refreshBootstrap) {
9743
+ const promise = (async () => {
9744
+ await entry.connection.extMethod(
9745
+ SERVE_CONTROL_EXT_METHODS.workspaceExtensionsRefresh,
9746
+ {
9747
+ sessionId: entry.sessionId,
9748
+ ...refreshBootstrap ? {} : { refreshBootstrap: false }
9749
+ }
9750
+ );
9751
+ })();
9752
+ inFlight = {
9753
+ connection: entry.connection,
9754
+ promise,
9755
+ refreshBootstrap
9756
+ };
9757
+ inFlightExtensionRefreshes.set(entry.sessionId, inFlight);
9758
+ const clear = /* @__PURE__ */ __name(() => {
9759
+ if (inFlightExtensionRefreshes.get(entry.sessionId) === inFlight) {
9760
+ inFlightExtensionRefreshes.delete(entry.sessionId);
9761
+ }
9762
+ }, "clear");
9763
+ void promise.then(clear, clear);
9764
+ }
9765
+ await Promise.race([
9766
+ withTimeout(
9767
+ inFlight.promise,
9768
+ 3e4,
9769
+ SERVE_CONTROL_EXT_METHODS.workspaceExtensionsRefresh
9770
+ ),
9771
+ getTransportClosedReject(entry)
9772
+ ]);
9773
+ }, "refreshSession");
9439
9774
  const results = await Promise.all(
9440
9775
  sessions.map(async (entry) => {
9441
9776
  const info = channelInfoForEntry(entry);
9442
9777
  if (!info || info.isDying) {
9443
- return { refreshed: 0, failed: 0 };
9778
+ return {
9779
+ refreshed: 0,
9780
+ failed: 0,
9781
+ entry,
9782
+ refreshBootstrap: false
9783
+ };
9444
9784
  }
9785
+ const refreshBootstrap = !bootstrapRefreshConnections.has(
9786
+ entry.connection
9787
+ );
9788
+ bootstrapRefreshConnections.add(entry.connection);
9445
9789
  try {
9446
- let inFlight = inFlightExtensionRefreshes.get(entry.sessionId);
9447
- if (!inFlight || inFlight.connection !== entry.connection) {
9448
- const promise = (async () => {
9449
- await entry.connection.extMethod(
9450
- SERVE_CONTROL_EXT_METHODS.workspaceExtensionsRefresh,
9451
- { sessionId: entry.sessionId }
9452
- );
9453
- })();
9454
- inFlight = { connection: entry.connection, promise };
9455
- inFlightExtensionRefreshes.set(entry.sessionId, inFlight);
9456
- const clear = /* @__PURE__ */ __name(() => {
9457
- if (inFlightExtensionRefreshes.get(entry.sessionId) === inFlight) {
9458
- inFlightExtensionRefreshes.delete(entry.sessionId);
9459
- }
9460
- }, "clear");
9461
- void promise.then(clear, clear);
9462
- }
9463
- await Promise.race([
9464
- withTimeout(
9465
- inFlight.promise,
9466
- 3e4,
9467
- SERVE_CONTROL_EXT_METHODS.workspaceExtensionsRefresh
9468
- ),
9469
- getTransportClosedReject(entry)
9470
- ]);
9471
- return { refreshed: 1, failed: 0 };
9790
+ await refreshSession(entry, refreshBootstrap);
9791
+ return { refreshed: 1, failed: 0, entry, refreshBootstrap };
9472
9792
  } catch (err) {
9473
9793
  writeServeDebugLine(
9474
9794
  `refreshExtensions: session ${entry.sessionId} failed: ${err instanceof Error ? err.message : String(err)}`
9475
9795
  );
9476
- return { refreshed: 0, failed: 1 };
9796
+ return { refreshed: 0, failed: 1, entry, refreshBootstrap };
9797
+ }
9798
+ })
9799
+ );
9800
+ await Promise.all(
9801
+ results.filter((result) => result.failed > 0 && result.refreshBootstrap).map(async (failedBootstrap) => {
9802
+ const retry = results.find(
9803
+ (result) => result.refreshed > 0 && result.entry.connection === failedBootstrap.entry.connection
9804
+ );
9805
+ if (!retry) return;
9806
+ try {
9807
+ await refreshSession(retry.entry, true);
9808
+ } catch (err) {
9809
+ writeServeDebugLine(
9810
+ `refreshExtensions: bootstrap retry via session ${retry.entry.sessionId} failed: ${err instanceof Error ? err.message : String(err)}`
9811
+ );
9477
9812
  }
9478
9813
  })
9479
9814
  );
@@ -9910,7 +10245,24 @@ function createAcpSessionBridge(opts) {
9910
10245
  if (signal?.aborted) {
9911
10246
  return { exitCode: null, output: "", aborted: true };
9912
10247
  }
9913
- const cwd = entry.workspaceCwd;
10248
+ let abortResolve;
10249
+ const onAbort = /* @__PURE__ */ __name(() => abortResolve?.(), "onAbort");
10250
+ try {
10251
+ await Promise.race([
10252
+ entry.cwdChangeQueue,
10253
+ new Promise((resolve2) => {
10254
+ abortResolve = resolve2;
10255
+ if (signal?.aborted) return resolve2();
10256
+ signal?.addEventListener("abort", onAbort, { once: true });
10257
+ })
10258
+ ]);
10259
+ } finally {
10260
+ signal?.removeEventListener("abort", onAbort);
10261
+ }
10262
+ if (signal?.aborted) {
10263
+ return { exitCode: null, output: "", aborted: true };
10264
+ }
10265
+ const cwd = entry.effectiveCwd;
9914
10266
  entry.events.publish({
9915
10267
  type: "user_shell_command",
9916
10268
  data: { sessionId, command, cwd },
@@ -10398,6 +10750,22 @@ function createAcpSessionBridge(opts) {
10398
10750
  }
10399
10751
  return response;
10400
10752
  },
10753
+ async addSessionRuntimeMcpServer(sessionId, name, config, originatorClientId) {
10754
+ return requestSessionStatus(
10755
+ sessionId,
10756
+ SERVE_CONTROL_EXT_METHODS.sessionMcpRuntimeAdd,
10757
+ { name, config, originatorClientId },
10758
+ MCP_RESTART_SERVER_DEADLINE_MS
10759
+ );
10760
+ },
10761
+ async removeSessionRuntimeMcpServer(sessionId, name, originatorClientId) {
10762
+ return requestSessionStatus(
10763
+ sessionId,
10764
+ SERVE_CONTROL_EXT_METHODS.sessionMcpRuntimeRemove,
10765
+ { name, originatorClientId },
10766
+ MCP_RESTART_SERVER_DEADLINE_MS
10767
+ );
10768
+ },
10401
10769
  async killSession(sessionId, opts2) {
10402
10770
  const entry = byId.get(sessionId);
10403
10771
  if (!entry) return false;
@@ -10583,13 +10951,22 @@ function createAcpSessionBridge(opts) {
10583
10951
  () => void 0,
10584
10952
  () => void 0
10585
10953
  ) : Promise.resolve();
10586
- await Promise.all([
10587
- ...channels.map((ci) => ci.channel.kill().catch(() => {
10588
- })),
10954
+ const teardownResults = await Promise.allSettled([
10955
+ ...channels.map((ci) => ci.channel.kill()),
10589
10956
  ...inFlightSessionAwaits,
10590
10957
  ...inFlightRestoreAwaits,
10591
10958
  inFlightChannelAwait
10592
10959
  ]);
10960
+ const teardownFailures = teardownResults.flatMap(
10961
+ (result) => result.status === "rejected" ? [result.reason] : []
10962
+ );
10963
+ if (teardownFailures.length === 1) throw teardownFailures[0];
10964
+ if (teardownFailures.length > 1) {
10965
+ throw new AggregateError(
10966
+ teardownFailures,
10967
+ "ACP bridge shutdown failed"
10968
+ );
10969
+ }
10593
10970
  })().then(resolveShutdown, rejectShutdown);
10594
10971
  return shutdownPromise;
10595
10972
  },
@@ -10628,6 +11005,7 @@ var createHttpAcpBridge = createAcpSessionBridge;
10628
11005
  export {
10629
11006
  SessionArtifactValidationError,
10630
11007
  SessionArtifactAuthorizationError,
11008
+ SESSION_SOURCE_META_KEY,
10631
11009
  parseSessionSource,
10632
11010
  extractErrorMessage,
10633
11011
  extractErrorCode,