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

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 (422) hide show
  1. package/bundled/qc-helper/docs/configuration/model-providers.md +2 -0
  2. package/bundled/qc-helper/docs/configuration/settings.md +39 -28
  3. package/bundled/qc-helper/docs/features/channels/_meta.ts +2 -0
  4. package/bundled/qc-helper/docs/features/channels/github.md +139 -0
  5. package/bundled/qc-helper/docs/features/channels/gitlab.md +171 -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/hooks.md +72 -15
  9. package/bundled/qc-helper/docs/features/mcp.md +9 -1
  10. package/bundled/qc-helper/docs/features/scheduled-tasks.md +3 -1
  11. package/bundled/qc-helper/docs/features/sub-agents.md +42 -8
  12. package/bundled/qc-helper/docs/qwen-serve.md +11 -7
  13. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +2 -2
  14. package/bundled/qc-helper/docs/support/troubleshooting.md +2 -1
  15. package/bundled/review/DESIGN.md +19 -0
  16. package/bundled/review/SKILL.md +120 -61
  17. package/chunks/MaxSizedBox-TQBQ247P.js +88 -0
  18. package/chunks/{StandaloneSessionPicker-O6RKBPU4.js → StandaloneSessionPicker-2HPTKCLX.js} +71 -69
  19. package/chunks/{acp-startup-profiler-RV3IV562.js → acp-startup-profiler-2C4A5ZTJ.js} +2 -2
  20. package/chunks/{acpAgent-HYFVXVDR.js → acpAgent-PS6EDGH3.js} +1628 -590
  21. package/chunks/agent-VDOUB35F.js +84 -0
  22. package/chunks/agent-headless-EO53EFS2.js +78 -0
  23. package/chunks/{anthropicContentGenerator-LXUXMOE7.js → anthropicContentGenerator-OFHSZJBF.js} +61 -20
  24. package/chunks/{artifact-tool-Y5T7GG7F.js → artifact-tool-RDN2W7ND.js} +4 -4
  25. package/chunks/{askUserQuestion-2H6747FR.js → askUserQuestion-OZERWH5R.js} +4 -4
  26. package/chunks/bridge-W7AZSRZQ.js +94 -0
  27. package/chunks/{build-RV63TIRH.js → build-GDBLPA24.js} +1 -1
  28. package/chunks/{ca-25EDXPFZ.js → ca-6W3SK7OQ.js} +6 -1
  29. package/chunks/{channel-management-service-G74LFADV.js → channel-management-service-5S7YCWX5.js} +20 -5
  30. package/chunks/channel-settings-store-JFVRSNER.js +91 -0
  31. package/chunks/{channel-worker-group-PTJIJSKC.js → channel-worker-group-OVWGYMZS.js} +9 -5
  32. package/chunks/{channel-worker-manager-WIMGM2FD.js → channel-worker-manager-H55GKOQA.js} +9 -5
  33. package/chunks/{channel-worker-supervisor-KUFTR6P5.js → channel-worker-supervisor-CABBXYHK.js} +5 -4
  34. package/chunks/{chunk-6GMVPFB2.js → chunk-2IIJTXYF.js} +45 -16
  35. package/chunks/{chunk-BPJSQIJX.js → chunk-2J3OJGTL.js} +0 -2
  36. package/chunks/{chunk-I7XZ3RY5.js → chunk-2KKCCLPT.js} +1 -1
  37. package/chunks/{chunk-MSLKI6C2.js → chunk-2LEOZTBT.js} +49 -26
  38. package/chunks/{chunk-3QMGYBFN.js → chunk-3APUUXRF.js} +1 -80
  39. package/chunks/{chunk-VV6XU5L7.js → chunk-3F2WDAV6.js} +16 -11
  40. package/chunks/{chunk-MUP3T3AD.js → chunk-3I6DUGQD.js} +1 -35
  41. package/chunks/{chunk-66RMLJHC.js → chunk-44F4LBWZ.js} +577 -208
  42. package/chunks/{chunk-VAK25FTU.js → chunk-45IOTAUS.js} +1 -1
  43. package/chunks/{chunk-JZA3JUDJ.js → chunk-4KP2F2TE.js} +1 -1
  44. package/chunks/{chunk-DM4Q4JJH.js → chunk-54YCNSK5.js} +36562 -45062
  45. package/chunks/{chunk-2Q3OT4OV.js → chunk-56Z7QEAQ.js} +200 -77
  46. package/chunks/{chunk-ZOIFNCKL.js → chunk-5NNHICSA.js} +3 -23
  47. package/chunks/{chunk-A4UCTEB5.js → chunk-5WV5S2GT.js} +0 -1
  48. package/chunks/{chunk-RHLZR4E5.js → chunk-675H6PLP.js} +1 -1
  49. package/chunks/{chunk-YAF5VNU7.js → chunk-6CQWRWUC.js} +4 -5
  50. package/chunks/chunk-6FMJLI5M.js +1591 -0
  51. package/chunks/{chunk-HV3G62R6.js → chunk-6MPDY6ZG.js} +1 -1
  52. package/chunks/{chunk-32MVHM4T.js → chunk-6PQPKTXP.js} +1 -1
  53. package/chunks/{chunk-LG4GZIVV.js → chunk-6TAASXWL.js} +4 -4
  54. package/chunks/{chunk-OJGCZBB7.js → chunk-77V3VIKL.js} +41 -36
  55. package/chunks/{chunk-2OM7GEXO.js → chunk-7KAXXBER.js} +3 -3
  56. package/chunks/{chunk-2JM6GZ5D.js → chunk-7SJN2IWT.js} +8 -13
  57. package/chunks/{chunk-UUUTRMI2.js → chunk-7ULQIS27.js} +1 -1
  58. package/chunks/{chunk-2YZJCM5T.js → chunk-A7Y5H4TX.js} +4 -4
  59. package/chunks/{chunk-TOFQCPDC.js → chunk-AOHY3QJ3.js} +14 -8
  60. package/chunks/chunk-AQ37AY7B.js +93 -0
  61. package/chunks/{chunk-B6ZJ7SI6.js → chunk-AUOULH6Q.js} +383 -320
  62. package/chunks/{chunk-PJIZUQVC.js → chunk-AZQ3DT76.js} +2 -2
  63. package/chunks/{chunk-UH3WSE5L.js → chunk-B4AJNNOL.js} +1 -6
  64. package/chunks/{chunk-7FZEBPKS.js → chunk-BBIQAX4V.js} +23 -18
  65. package/chunks/{chunk-L26JL52R.js → chunk-CBBP4BMC.js} +64 -67
  66. package/chunks/{chunk-ZD6UTE4A.js → chunk-CNTR4GR6.js} +1 -1
  67. package/chunks/{chunk-4M377AZG.js → chunk-CO2U743O.js} +6 -6
  68. package/chunks/{chunk-3SJ43L4W.js → chunk-CPZAH673.js} +6 -0
  69. package/chunks/{chunk-VFSJ5VRH.js → chunk-CU47KXB5.js} +3 -3
  70. package/chunks/{chunk-EPDRMGT4.js → chunk-D4HTUMGX.js} +4 -28
  71. package/chunks/{chunk-XHRTVPG2.js → chunk-D6MDRSZ6.js} +7 -7
  72. package/chunks/{chunk-BYFNTGKI.js → chunk-DEEABGH2.js} +3111 -989
  73. package/chunks/{chunk-XVNQMZ2I.js → chunk-DGEIYUC3.js} +0 -1
  74. package/chunks/{chunk-BPZALHVR.js → chunk-DI35ZN7T.js} +1 -1
  75. package/chunks/{chunk-B4UMZKMU.js → chunk-DQ2O5QOJ.js} +1 -1
  76. package/chunks/{chunk-DLWL3Z7A.js → chunk-DSFHVTWD.js} +3 -3
  77. package/chunks/{chunk-RWS5VYWC.js → chunk-DUNI4EBW.js} +950 -446
  78. package/chunks/{chunk-NL7LTRLR.js → chunk-E2BHWIDT.js} +48 -72
  79. package/chunks/{chunk-3MSHSCSN.js → chunk-E2FN6SM7.js} +93 -3
  80. package/chunks/{chunk-USTWD7QV.js → chunk-E6CJ2SMM.js} +26 -16
  81. package/chunks/{chunk-TF2X2WCT.js → chunk-EQNUDTL6.js} +2 -2
  82. package/chunks/{chunk-PANH4R3B.js → chunk-EU5TBFJI.js} +18 -12
  83. package/chunks/{chunk-W4CQXHT6.js → chunk-FANRZEAJ.js} +1 -1
  84. package/chunks/{chunk-WBL3FJEU.js → chunk-FC4KQFCS.js} +1 -1
  85. package/chunks/{chunk-N3FAY5CM.js → chunk-FCYYAB4S.js} +157 -4
  86. package/chunks/{chunk-OKY7HXPG.js → chunk-FJ5WUMUQ.js} +2 -2
  87. package/chunks/{chunk-M4UKFCZ2.js → chunk-FNDXMN7I.js} +231 -171
  88. package/chunks/{chunk-FQK6JAFG.js → chunk-FS674JW4.js} +4 -4
  89. package/chunks/chunk-FYJ7W2PI.js +194 -0
  90. package/chunks/{chunk-INADJJGW.js → chunk-G7XXKQYS.js} +2 -2
  91. package/chunks/{chunk-LNARWLZQ.js → chunk-GJ2GBPBD.js} +2 -2
  92. package/chunks/{chunk-E5WH5O3C.js → chunk-GL4JOZXU.js} +4 -4
  93. package/chunks/{chunk-LS77BEZP.js → chunk-GLCZKT5V.js} +1 -5
  94. package/chunks/{chunk-KU5XMLDK.js → chunk-GURGAJTX.js} +4 -1
  95. package/chunks/{chunk-5THCYPLO.js → chunk-H6I4PGRV.js} +15 -8
  96. package/chunks/{chunk-A5L3JMUA.js → chunk-HC45LTEN.js} +18 -4
  97. package/chunks/{chunk-U7TXFVUN.js → chunk-HIVKI6O6.js} +118 -95
  98. package/chunks/{chunk-QY5MMZ6O.js → chunk-HX6RLYUO.js} +3 -3
  99. package/chunks/{chunk-GZXCZHCT.js → chunk-I3G5JWBV.js} +1 -1
  100. package/chunks/{chunk-ER5LWJR6.js → chunk-I5BT7ADR.js} +3 -3
  101. package/chunks/{chunk-L5UHQJTJ.js → chunk-IGTHU3T4.js} +1 -1
  102. package/chunks/{chunk-BIQWWWJN.js → chunk-IIUGIWWY.js} +1 -1
  103. package/chunks/{chunk-ML52PL6O.js → chunk-JCJ7LKNA.js} +5856 -5334
  104. package/chunks/{chunk-B7QDM6Z7.js → chunk-JE2CEOBO.js} +2 -2
  105. package/chunks/{chunk-S3TWXGKA.js → chunk-JE7KQ2UP.js} +4 -2
  106. package/chunks/{chunk-P5V4T7NK.js → chunk-JJPKFJBT.js} +11 -3
  107. package/chunks/{chunk-J6D3VXCC.js → chunk-JLZ3RBQG.js} +18 -5
  108. package/chunks/{chunk-PWTZEM3C.js → chunk-JXVC2PL3.js} +3 -37
  109. package/chunks/chunk-JYBU6YUE.js +378 -0
  110. package/chunks/{chunk-JCW2R7WC.js → chunk-K623ENWT.js} +3 -79
  111. package/chunks/{chunk-T2NCM2ET.js → chunk-K6KS3LTN.js} +2 -749
  112. package/chunks/{chunk-Z5BLYMZM.js → chunk-KR32NIAN.js} +6 -6
  113. package/chunks/{chunk-MK7VQDN3.js → chunk-KWHKHSIS.js} +8 -6
  114. package/chunks/{chunk-5U4IPFBR.js → chunk-KXDONCPU.js} +4 -4
  115. package/chunks/{chunk-DHHOYAPR.js → chunk-L2E5GFAG.js} +7 -7
  116. package/chunks/{chunk-V6VRAM7B.js → chunk-L32VV3ZJ.js} +12 -12
  117. package/chunks/{chunk-2W3OOD4W.js → chunk-L55JWS76.js} +6 -3
  118. package/chunks/{chunk-E5TUC6CA.js → chunk-LHKCY7DY.js} +3 -3
  119. package/chunks/{chunk-NH6KE4JX.js → chunk-LOY7RWQG.js} +3 -3
  120. package/chunks/{chunk-CC4N4M36.js → chunk-LYI2PZDK.js} +1 -1
  121. package/chunks/{chunk-3JAQDSXN.js → chunk-MB32MS4U.js} +80 -9
  122. package/chunks/{chunk-PR75REBZ.js → chunk-MM7TH7ZM.js} +12 -82
  123. package/chunks/{chunk-FODK6UMO.js → chunk-MPHPFVKK.js} +0 -2
  124. package/chunks/{chunk-M5JM7OSF.js → chunk-N4ACHWNH.js} +2 -3
  125. package/chunks/{chunk-JESCGQM3.js → chunk-NAVJD2PQ.js} +8 -7
  126. package/chunks/{chunk-J56UI34H.js → chunk-NBD76HUW.js} +4 -2
  127. package/chunks/{chunk-C3NS4F2Q.js → chunk-NHFEMWAZ.js} +1 -1
  128. package/chunks/{chunk-6PSLCFQ2.js → chunk-NTDH4IML.js} +18 -9
  129. package/chunks/{chunk-6OUGMXDC.js → chunk-NWNEANAT.js} +7 -7
  130. package/chunks/chunk-O6GEWCJA.js +21 -0
  131. package/chunks/chunk-OCPBI7J5.js +18 -0
  132. package/chunks/{chunk-ZE5WPL4I.js → chunk-OFZKFPYG.js} +3 -3
  133. package/chunks/{chunk-KIUFNBHR.js → chunk-P5VC5USY.js} +1 -1
  134. package/chunks/chunk-P755N4CS.js +2196 -0
  135. package/chunks/{chunk-BRRAJXPA.js → chunk-PCK4B6LR.js} +1 -1
  136. package/chunks/{chunk-TQCBGUHN.js → chunk-PJOHNFIY.js} +5 -5
  137. package/chunks/{chunk-G4WFQUYQ.js → chunk-PVNQRENX.js} +1 -1
  138. package/chunks/{chunk-DM22XS4K.js → chunk-PZEXDV3H.js} +357 -13
  139. package/chunks/{chunk-2JZBVYTU.js → chunk-Q3T5KA2V.js} +1 -8
  140. package/chunks/{chunk-SASBXAQL.js → chunk-Q5WZTTWE.js} +4 -4
  141. package/chunks/{chunk-SRZ6DXVG.js → chunk-QARJNL2V.js} +44 -136
  142. package/chunks/{chunk-YH6G52F2.js → chunk-QCXGC7QB.js} +4 -4
  143. package/chunks/{chunk-SQBYH7PX.js → chunk-QDK4F2N5.js} +1 -1
  144. package/chunks/{chunk-VDDGDZMA.js → chunk-QHWCP53L.js} +14 -7
  145. package/chunks/{chunk-H5FFA6TH.js → chunk-QTHQ6Z5X.js} +16 -3
  146. package/chunks/{chunk-5I2IWRSH.js → chunk-R2XWGR75.js} +2 -2
  147. package/chunks/{chunk-PHVR5UUY.js → chunk-RDJOB6S3.js} +1 -1
  148. package/chunks/{chunk-GDIPH4JY.js → chunk-RG64CDT2.js} +6 -6
  149. package/chunks/{chunk-3HBZKBMQ.js → chunk-RSVPYAGK.js} +5 -5
  150. package/chunks/{chunk-6AM5D4ME.js → chunk-S6LOFUVP.js} +0 -12
  151. package/chunks/{chunk-K4XWPEWB.js → chunk-SHN4KHDK.js} +4 -33
  152. package/chunks/{chunk-VYPFXUCB.js → chunk-SZ3KHTDR.js} +1 -1
  153. package/chunks/chunk-T26EAKDL.js +13 -0
  154. package/chunks/chunk-T3CHYWJZ.js +758 -0
  155. package/chunks/{chunk-FNQ6T3CV.js → chunk-TEGJSJDF.js} +10 -7
  156. package/chunks/{chunk-OHNBB4XR.js → chunk-THVU3RNH.js} +1 -1
  157. package/chunks/{record-artifact-RQKFYO5B.js → chunk-TIRRPCFS.js} +22 -7
  158. package/chunks/chunk-TTJZAIFP.js +319 -0
  159. package/chunks/{chunk-63P4EL5V.js → chunk-TZTAV5RH.js} +1 -1
  160. package/chunks/{chunk-52O2CIUL.js → chunk-UV6KF7T3.js} +130 -5
  161. package/chunks/{chunk-QPDRAXDJ.js → chunk-V25K5ID7.js} +1 -1
  162. package/chunks/{chunk-3IXOIAKE.js → chunk-V4XNUDPE.js} +18 -6
  163. package/chunks/{chunk-WDSWXQU3.js → chunk-VEMNQMHA.js} +2 -2
  164. package/chunks/{chunk-LNURQEMZ.js → chunk-VMX5RZQH.js} +12 -10
  165. package/chunks/{chunk-JALU3ZDU.js → chunk-W3UKBMSI.js} +154 -16
  166. package/chunks/{chunk-DN6ZX5AY.js → chunk-WWCMSZII.js} +61 -14
  167. package/chunks/{chunk-COH43MRJ.js → chunk-XCGIMOLN.js} +27 -1
  168. package/chunks/{chunk-FY3M44RD.js → chunk-XP4L6KS3.js} +3 -3
  169. package/chunks/{chunk-6FGBXPWM.js → chunk-XQK4XXTN.js} +38 -44
  170. package/chunks/{chunk-A6UO2C7C.js → chunk-XUGZYLDH.js} +167 -81
  171. package/chunks/{chunk-LZEMEFKY.js → chunk-YANIWTRZ.js} +1 -1
  172. package/chunks/{chunk-IPUUTYMV.js → chunk-YDLJGZHL.js} +1 -1
  173. package/chunks/{chunk-HIJQF5B5.js → chunk-YGE3IXJP.js} +1 -1
  174. package/chunks/{chunk-BJX6ZSUK.js → chunk-YUFIEIWC.js} +2 -2
  175. package/chunks/{chunk-BO4XCS7P.js → chunk-Z3S5EMOW.js} +20 -85
  176. package/chunks/chunk-Z4X5MTRT.js +133 -0
  177. package/chunks/{chunk-UW5EOVUN.js → chunk-ZBVS26BY.js} +4 -4
  178. package/chunks/{chunk-PSWQZHEA.js → chunk-ZMOJ7ISP.js} +1 -1
  179. package/chunks/{chunk-HTO4JFDZ.js → chunk-ZPJWUGCS.js} +0 -1
  180. package/chunks/{chunk-MVS3NS2N.js → chunk-ZPZ7ZJEE.js} +28 -5
  181. package/chunks/{computer-use-DOFAHZAB.js → computer-use-5QWCFNKD.js} +52 -50
  182. package/chunks/{config-utils-VFQXVGNR.js → config-utils-WADIDWGG.js} +4 -4
  183. package/chunks/contextCommand-4Z7T7TUM.js +83 -0
  184. package/chunks/core-runtime-6N4EFC2Q.js +137 -0
  185. package/chunks/{create-sub-session-IWW2IZ2T.js → create-sub-session-62YZWVAY.js} +3 -3
  186. package/chunks/{create-sub-session-7543K2QA.js → create-sub-session-AEREHZBQ.js} +49 -47
  187. package/chunks/{cron-create-YIID5XAW.js → cron-create-6E7GIQTG.js} +6 -6
  188. package/chunks/{cron-delete-ZVHYCEP2.js → cron-delete-JD26XY3W.js} +5 -5
  189. package/chunks/{cron-list-XEGS463Q.js → cron-list-CUWFB44G.js} +6 -6
  190. package/chunks/{daemon-VOMQW7KZ.js → daemon-PCNCI5YU.js} +239 -18
  191. package/chunks/daemon-status-provider-DDF7C5M7.js +93 -0
  192. package/chunks/daemon-trust-policy-Q4KSOJTR.js +88 -0
  193. package/chunks/daemon-trust-policy-monitor-V6FTE3IY.js +175 -0
  194. package/chunks/{de-HGRCYDEJ.js → de-SY6O76BF.js} +6 -1
  195. package/chunks/deferred-core-runtime-GHJ5GQHK.js +92 -0
  196. package/chunks/dist-26BIMQT6.js +4487 -0
  197. package/chunks/{dist-KTYYJ2C5.js → dist-2PERFI23.js} +12 -9
  198. package/chunks/{dist-NNVBBOGU.js → dist-OAOC5OV4.js} +2 -2
  199. package/chunks/{dist-K6Y4E7FX.js → dist-PVEAFLHY.js} +5 -4
  200. package/chunks/{dist-RTJFMNEZ.js → dist-SL2LUMML.js} +1449 -14
  201. package/chunks/dist-ULIG4M5H.js +13415 -0
  202. package/chunks/{dist-ANLAT3GS.js → dist-WGMNT3JQ.js} +2 -1
  203. package/chunks/{dist-BRB6EXK4.js → dist-ZHXOBXDN.js} +3 -3
  204. package/chunks/earlyInputCapture-TQXLLISD.js +85 -0
  205. package/chunks/{edit-RIEOJWKB.js → edit-FJEUV6KZ.js} +51 -49
  206. package/chunks/{en-MTWBNGDO.js → en-NBK3JKCE.js} +9 -1
  207. package/chunks/{enter-worktree-OGK5FQ3R.js → enter-worktree-7GE3TZ4P.js} +51 -49
  208. package/chunks/{enterPlanMode-IWZYALIB.js → enterPlanMode-KR5TMPCJ.js} +51 -49
  209. package/chunks/environment-SWL3CMB3.js +105 -0
  210. package/chunks/errors-XQE7BGZV.js +91 -0
  211. package/chunks/esm-K5FARBNI.js +5548 -0
  212. package/chunks/{exit-worktree-4TEYVIVP.js → exit-worktree-CHKTYNCV.js} +51 -49
  213. package/chunks/exitPlanMode-QYAG6LWX.js +76 -0
  214. package/chunks/{fast-path-HYE7IFEV.js → fast-path-Z2K7W6DC.js} +13 -3
  215. package/chunks/{fr-45RLL55O.js → fr-4KG5V7UT.js} +6 -1
  216. package/chunks/{gemini-NGRQX3YJ.js → gemini-YU4XKEDG.js} +107 -103
  217. package/chunks/{geminiContentGenerator-FQHPFZSR.js → geminiContentGenerator-ZZX6NBO4.js} +7 -7
  218. package/chunks/{getMachineId-bsd-V7W3GODC.js → getMachineId-bsd-FG7IUY6U.js} +1 -1
  219. package/chunks/{getMachineId-darwin-TDO75DQP.js → getMachineId-darwin-GLCJI2RA.js} +1 -1
  220. package/chunks/{getMachineId-linux-TF43WQT2.js → getMachineId-linux-O6OPPAKO.js} +1 -1
  221. package/chunks/{getMachineId-unsupported-ZGUO3TXT.js → getMachineId-unsupported-S6CKYVGC.js} +1 -1
  222. package/chunks/{getMachineId-win-ECFYZZFQ.js → getMachineId-win-X5SRNEH7.js} +1 -1
  223. package/chunks/{glob-FRTM3X2E.js → glob-VYF5CXSX.js} +51 -49
  224. package/chunks/goal-tools-HGO6VXPB.js +335 -0
  225. package/chunks/{grep-RKWVROCW.js → grep-5DP5ZUTW.js} +53 -50
  226. package/chunks/handleAutoUpdate-UVBJ56DL.js +84 -0
  227. package/chunks/i18n-UQNYHEUD.js +100 -0
  228. package/chunks/{image-gen-WIEM7KZA.js → image-gen-WHPIZNWF.js} +12 -12
  229. package/chunks/initializer-GMIICF4W.js +89 -0
  230. package/chunks/installationInfo-4MGG4WVI.js +83 -0
  231. package/chunks/{ja-B7DF7DFG.js → ja-F3GSQXMF.js} +6 -1
  232. package/chunks/{keychain-token-storage-MDTG3WRM.js → keychain-token-storage-IKO4G53C.js} +3 -3
  233. package/chunks/lib-RUF3WZA6.js +9 -0
  234. package/chunks/list-CPN2W334.js +92 -0
  235. package/chunks/{list-agents-5KJJHR6I.js → list-agents-PXJ7ZUFB.js} +3 -3
  236. package/chunks/loadedSettingsAdapter-ZQAV5NDO.js +86 -0
  237. package/chunks/{loggingContentGenerator-WGM27QAW.js → loggingContentGenerator-5E7W4IEP.js} +31 -30
  238. package/chunks/{loop-wakeup-FXKNNYSY.js → loop-wakeup-Y26NQZ5I.js} +15 -8
  239. package/chunks/{ls-NTK6VOQJ.js → ls-ONQTTMQR.js} +5 -5
  240. package/chunks/{lsp-2JI24STP.js → lsp-YGHHRGMD.js} +3 -3
  241. package/chunks/{managed-npm-update-JQ2CG3RH.js → managed-npm-update-MKKAXYXA.js} +50 -48
  242. package/chunks/mcp-V5NTJF6X.js +86 -0
  243. package/chunks/{monitor-7FEWXX5F.js → monitor-CO3ASY6E.js} +51 -49
  244. package/chunks/nonInteractiveCli-ZJYEOO7U.js +148 -0
  245. package/chunks/{notebook-edit-JGJV2K6J.js → notebook-edit-Z7AEE6FM.js} +51 -49
  246. package/chunks/{openaiContentGenerator-JPVXDTAO.js → openaiContentGenerator-CA3MQOP3.js} +25 -27
  247. package/chunks/pidfile-NL7MKDRU.js +89 -0
  248. package/chunks/process-registry-2CHQBXH5.js +157 -0
  249. package/chunks/{processUtils-V2LCK6T6.js → processUtils-PB5K2DYH.js} +2 -2
  250. package/chunks/{pt-22Q3FP73.js → pt-EQ33KWEN.js} +6 -1
  251. package/chunks/{qwenContentGenerator-TICV2W2Z.js → qwenContentGenerator-JYFNDCOS.js} +55 -53
  252. package/chunks/{qwenOAuth2-XGFI5XJG.js → qwenOAuth2-W2ALKQDD.js} +10 -10
  253. package/chunks/read-file-IEOR5H5W.js +29 -0
  254. package/chunks/{read-mcp-resource-4DKQWGHD.js → read-mcp-resource-U2IJN5HM.js} +4 -4
  255. package/chunks/record-artifact-MGPJ7EG4.js +21 -0
  256. package/chunks/resumeHistoryUtils-BNBTP5AS.js +94 -0
  257. package/chunks/ripGrep-UMQODKEB.js +76 -0
  258. package/chunks/{ru-FZCNZHDC.js → ru-7OZAUKGG.js} +6 -1
  259. package/chunks/{run-qwen-serve-3VCV4I7E.js → run-qwen-serve-RN2R6QQW.js} +982 -263
  260. package/chunks/runtime-QFJ2MJF5.js +122 -0
  261. package/chunks/{scheduler-RS2I6RU5.js → scheduler-AMYUFOZI.js} +49 -47
  262. package/chunks/{sdk-exporters-grpc-AK3LGHNO.js → sdk-exporters-grpc-54L4LS5L.js} +4 -4
  263. package/chunks/{sdk-exporters-http-FS6ZV7MF.js → sdk-exporters-http-4BQANSJ6.js} +7 -7
  264. package/chunks/{sdk-impl-7FZSCSXB.js → sdk-impl-Z4VXWVFX.js} +10 -10
  265. package/chunks/{send-message-Q6OOR6BR.js → send-message-PMP4ATVM.js} +8 -13
  266. package/chunks/serve-EIIYJVX3.js +92 -0
  267. package/chunks/{server-HRZ23U7M.js → server-EP2LLAPD.js} +4816 -1298
  268. package/chunks/{session-7XHZKTVV.js → session-GMPZBLOW.js} +101 -97
  269. package/chunks/{settings-7ZGZDXAS.js → settings-LN7RNKBS.js} +53 -51
  270. package/chunks/shell-EM2OWU5X.js +86 -0
  271. package/chunks/{skill-LIWXNLDW.js → skill-T5VPSK73.js} +22 -23
  272. package/chunks/skill-settings-GMR3GMNY.js +94 -0
  273. package/chunks/spawnChannel-YPCU62DI.js +85 -0
  274. package/chunks/standalone-update-JAKIM2NF.js +95 -0
  275. package/chunks/{startInteractiveUI-IW3CSKHA.js → startInteractiveUI-YETQWGYF.js} +1240 -903
  276. package/chunks/{syntheticOutput-I3757IWH.js → syntheticOutput-D7E6ZFKR.js} +4 -4
  277. package/chunks/task-create-NFCYD43L.js +26 -0
  278. package/chunks/{task-list-FOPULZEP.js → task-list-TAVMGEVD.js} +7 -7
  279. package/chunks/{task-stop-H6RHXFVQ.js → task-stop-ZDF2UJRM.js} +3 -3
  280. package/chunks/{task-update-M57TFZJT.js → task-update-6L7LHGEX.js} +12 -11
  281. package/chunks/{team-create-O2FROQ4R.js → team-create-LFJ6HGNY.js} +53 -51
  282. package/chunks/{team-delete-QE2UXJL7.js → team-delete-DPGGRQBU.js} +7 -7
  283. package/chunks/{team-plan-approval-Q6WDBXTQ.js → team-plan-approval-C2KLSDGO.js} +51 -49
  284. package/chunks/theme-manager-JQ3ZGBP5.js +80 -0
  285. package/chunks/{todoWrite-VQ7FKOHL.js → todoWrite-2UO5G6G6.js} +34 -6
  286. package/chunks/{tool-search-APECNQ3Z.js → tool-search-FAZBFRJZ.js} +21 -22
  287. package/chunks/total-session-admission-5CALIVYO.js +88 -0
  288. package/chunks/{tree-sitter-FS4VPMZA.js → tree-sitter-4D7QS7F6.js} +1 -1
  289. package/chunks/{tree-sitter-bash-6B46JJCV.js → tree-sitter-bash-VEJGF5XF.js} +1 -1
  290. package/chunks/trustedFolders-KOPSP44S.js +98 -0
  291. package/chunks/{update-relaunch-ON5MDJQG.js → update-relaunch-6QL2TICS.js} +5 -5
  292. package/chunks/updateCheck-4Q6RIKFW.js +95 -0
  293. package/chunks/useAutoAcceptIndicator-Q5BMKZV3.js +96 -0
  294. package/chunks/{validateNonInterActiveAuth-JBLKBKRD.js → validateNonInterActiveAuth-GKOC5F6Z.js} +95 -91
  295. package/chunks/{version-LTNUBQJY.js → version-VSATY2LD.js} +1 -1
  296. package/chunks/{web-fetch-L5UTI53V.js → web-fetch-JCLKL6NL.js} +19 -21
  297. package/chunks/{web-search-KM33JOS3.js → web-search-DSQTFUBX.js} +13 -13
  298. package/chunks/{workflow-K7FAWV77.js → workflow-M6QAVKVJ.js} +52 -50
  299. package/chunks/workspace-providers-status-YKLTLMJA.js +89 -0
  300. package/chunks/{workspace-registration-store-6TGVDJV5.js → workspace-registration-store-5DMGKU64.js} +1 -1
  301. package/chunks/workspace-registry-PTYUSYXX.js +96 -0
  302. package/chunks/workspace-service-25ML3T47.js +103 -0
  303. package/chunks/workspace-skills-status-YKZWOYRX.js +89 -0
  304. package/chunks/workspace-trust-reconciler-5FI2S3OS.js +349 -0
  305. package/chunks/write-file-AY7VLP5X.js +78 -0
  306. package/chunks/xterm-headless-NTYVIBT3.js +3475 -0
  307. package/chunks/{zh-LUIGBD55.js → zh-H3YDK5QW.js} +9 -1
  308. package/chunks/{zh-TW-F5KG2IYD.js → zh-TW-JYCP7XUA.js} +9 -1
  309. package/chunks/zoom-image-S4LJZMD5.js +224 -0
  310. package/cli.js +50 -16
  311. package/locales/ca.js +7 -2
  312. package/locales/de.js +7 -2
  313. package/locales/en.js +10 -2
  314. package/locales/fr.js +7 -2
  315. package/locales/ja.js +7 -2
  316. package/locales/pt.js +7 -2
  317. package/locales/ru.js +7 -2
  318. package/locales/zh-TW.js +10 -2
  319. package/locales/zh.js +10 -2
  320. package/package.json +5 -4
  321. package/web-shell/assets/{arc-BbHijhiN.js → arc-xjArKHU2.js} +1 -1
  322. package/web-shell/assets/{architectureDiagram-3BPJPVTR-Cb4B_JD0.js → architectureDiagram-3BPJPVTR-BgrQDNYG.js} +1 -1
  323. package/web-shell/assets/{blockDiagram-GPEHLZMM-Dsjlh3H-.js → blockDiagram-GPEHLZMM-CXxWC-1_.js} +1 -1
  324. package/web-shell/assets/{c4Diagram-AAUBKEIU-Cp5AeR4U.js → c4Diagram-AAUBKEIU-Dx1tLm3v.js} +1 -1
  325. package/web-shell/assets/channel-B1cyk94G.js +1 -0
  326. package/web-shell/assets/{chunk-2J33WTMH-CLcY7W2e.js → chunk-2J33WTMH-CBxjogVR.js} +1 -1
  327. package/web-shell/assets/{chunk-4BX2VUAB-BUhvY2LR.js → chunk-4BX2VUAB-izb-rY5W.js} +1 -1
  328. package/web-shell/assets/{chunk-55IACEB6-kDIFC_71.js → chunk-55IACEB6-NzLyvSb8.js} +1 -1
  329. package/web-shell/assets/{chunk-727SXJPM-CIBO15f2.js → chunk-727SXJPM-DVyKb0dl.js} +1 -1
  330. package/web-shell/assets/{chunk-AQP2D5EJ-BJ_T_slV.js → chunk-AQP2D5EJ-BtqL7NzB.js} +1 -1
  331. package/web-shell/assets/{chunk-FMBD7UC4-BEkW35J8.js → chunk-FMBD7UC4-iNpdKIO0.js} +1 -1
  332. package/web-shell/assets/{chunk-ND2GUHAM-GGPxofay.js → chunk-ND2GUHAM-DI7cbFmX.js} +1 -1
  333. package/web-shell/assets/{chunk-QZHKN3VN-Bifllrb6.js → chunk-QZHKN3VN-3Y_-xFYs.js} +1 -1
  334. package/web-shell/assets/classDiagram-4FO5ZUOK-BpBYZoRE.js +1 -0
  335. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-BpBYZoRE.js +1 -0
  336. package/web-shell/assets/{cose-bilkent-S5V4N54A-C-Add_Dp.js → cose-bilkent-S5V4N54A--raRatZn.js} +1 -1
  337. package/web-shell/assets/{dagre-BM42HDAG-B7MfwNq2.js → dagre-BM42HDAG-B8SU70mO.js} +1 -1
  338. package/web-shell/assets/{diagram-2AECGRRQ-CY_0zuDz.js → diagram-2AECGRRQ-ewgoakXo.js} +1 -1
  339. package/web-shell/assets/{diagram-5GNKFQAL-VyYSbCgA.js → diagram-5GNKFQAL-Bm_JLTnS.js} +1 -1
  340. package/web-shell/assets/{diagram-KO2AKTUF-CBiIZ2PL.js → diagram-KO2AKTUF-DEIUjUy9.js} +1 -1
  341. package/web-shell/assets/{diagram-LMA3HP47-BL3CrVOx.js → diagram-LMA3HP47-C2Wmrpj-.js} +1 -1
  342. package/web-shell/assets/{diagram-OG6HWLK6-CZUPx96P.js → diagram-OG6HWLK6-CtYe6bFx.js} +1 -1
  343. package/web-shell/assets/{erDiagram-TEJ5UH35-B81xHr1-.js → erDiagram-TEJ5UH35-DfpHcWLV.js} +1 -1
  344. package/web-shell/assets/{flowDiagram-I6XJVG4X-EZWhir-J.js → flowDiagram-I6XJVG4X-CAiUhio5.js} +1 -1
  345. package/web-shell/assets/{ganttDiagram-6RSMTGT7-CVFSuIAg.js → ganttDiagram-6RSMTGT7-CYc7ezr4.js} +1 -1
  346. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-C1H2uQDv.js → gitGraphDiagram-PVQCEYII-70lbkcRS.js} +1 -1
  347. package/web-shell/assets/index-C1k3PDuU.css +5 -0
  348. package/web-shell/assets/index-C2GE3DAF.js +74 -0
  349. package/web-shell/assets/index-DZLIXILO.js +1750 -0
  350. package/web-shell/assets/{index-BYo99NBH.js → index-Ww86nT9f.js} +1 -1
  351. package/web-shell/assets/{infoDiagram-5YYISTIA-BwyFMlF8.js → infoDiagram-5YYISTIA-C7e8DWPa.js} +1 -1
  352. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-CQ7Yhn2Y.js → ishikawaDiagram-YF4QCWOH-BYLr2op-.js} +1 -1
  353. package/web-shell/assets/{journeyDiagram-JHISSGLW-CJn2sf0l.js → journeyDiagram-JHISSGLW-hEibAHKX.js} +1 -1
  354. package/web-shell/assets/{kanban-definition-UN3LZRKU-DaNRqwVN.js → kanban-definition-UN3LZRKU-F2rt8Uhp.js} +1 -1
  355. package/web-shell/assets/{linear-DCKODZe2.js → linear-DPhyNezd.js} +1 -1
  356. package/web-shell/assets/{mermaid.core-CTGJOk27.js → mermaid.core-ZUtnug0n.js} +5 -5
  357. package/web-shell/assets/{mindmap-definition-RKZ34NQL-BKU3_3rg.js → mindmap-definition-RKZ34NQL-DDWcMoi8.js} +1 -1
  358. package/web-shell/assets/{pieDiagram-4H26LBE5-COcwBJ82.js → pieDiagram-4H26LBE5-CTRKzw1_.js} +1 -1
  359. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-CQnQ443x.js → quadrantDiagram-W4KKPZXB-CAEwYG_z.js} +1 -1
  360. package/web-shell/assets/{requirementDiagram-4Y6WPE33-CZ2oj5cD.js → requirementDiagram-4Y6WPE33-CRjnH9D9.js} +1 -1
  361. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-BxAv5mNu.js → sankeyDiagram-5OEKKPKP-LPQT_sOd.js} +1 -1
  362. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-CztaySPs.js → sequenceDiagram-3UESZ5HK-Ht2Iqvb0.js} +1 -1
  363. package/web-shell/assets/{stateDiagram-AJRCARHV-CTQT1oGD.js → stateDiagram-AJRCARHV-CIUdqOXu.js} +1 -1
  364. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BmqqQZ6w.js +1 -0
  365. package/web-shell/assets/{timeline-definition-PNZ67QCA-K9Mkex5A.js → timeline-definition-PNZ67QCA-BcilneZF.js} +1 -1
  366. package/web-shell/assets/{vennDiagram-CIIHVFJN-B2rVIw76.js → vennDiagram-CIIHVFJN-BljwiiH1.js} +1 -1
  367. package/web-shell/assets/{wardley-L42UT6IY-Z1w2JR4M.js → wardley-L42UT6IY-DeKjkYjq.js} +1 -1
  368. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-CIX9aKXf.js → wardleyDiagram-YWT4CUSO-L3U1H7KG.js} +1 -1
  369. package/web-shell/assets/{xychartDiagram-2RQKCTM6-CI9DLIKB.js → xychartDiagram-2RQKCTM6-IJnWsgMT.js} +1 -1
  370. package/web-shell/index.html +2 -2
  371. package/chunks/MaxSizedBox-INHRH72H.js +0 -86
  372. package/chunks/agent-VXDAN5JK.js +0 -82
  373. package/chunks/agent-headless-K4ZMMNBD.js +0 -76
  374. package/chunks/bridge-LGPZCFHO.js +0 -91
  375. package/chunks/channel-settings-store-CHCDRTPY.js +0 -89
  376. package/chunks/chunk-SZRN75WQ.js +0 -29
  377. package/chunks/chunk-UGYMA4EI.js +0 -219
  378. package/chunks/chunk-VCBZUOSI.js +0 -8575
  379. package/chunks/contextCommand-QIZYHDR5.js +0 -81
  380. package/chunks/daemon-status-provider-OS5UWBHV.js +0 -90
  381. package/chunks/earlyInputCapture-WQT24RWD.js +0 -83
  382. package/chunks/environment-VZ7BRI4Q.js +0 -103
  383. package/chunks/errors-PCX25DVP.js +0 -89
  384. package/chunks/exitPlanMode-GHPUHBZJ.js +0 -423
  385. package/chunks/handleAutoUpdate-2CZQRJ66.js +0 -82
  386. package/chunks/i18n-XEQVMRKN.js +0 -98
  387. package/chunks/initializer-OVGZ4FLY.js +0 -87
  388. package/chunks/installationInfo-5UUQJI6Y.js +0 -81
  389. package/chunks/list-HODU6RXD.js +0 -90
  390. package/chunks/loadedSettingsAdapter-TYNLBALY.js +0 -84
  391. package/chunks/mcp-J3DFWX4A.js +0 -84
  392. package/chunks/nonInteractiveCli-F4GYSMHT.js +0 -144
  393. package/chunks/pidfile-4VNAR3EP.js +0 -87
  394. package/chunks/read-file-LZXUR4TO.js +0 -31
  395. package/chunks/resumeHistoryUtils-65OX3SGJ.js +0 -92
  396. package/chunks/ripGrep-2U2FRGMV.js +0 -74
  397. package/chunks/runtime-AXJWIEDU.js +0 -120
  398. package/chunks/serve-W2GC47CM.js +0 -90
  399. package/chunks/shell-45IPBDP5.js +0 -84
  400. package/chunks/spawnChannel-PVXQ5AGV.js +0 -83
  401. package/chunks/src-AY65BYR7.js +0 -3166
  402. package/chunks/standalone-update-ZMFNKAEY.js +0 -93
  403. package/chunks/task-create-N7WQSGYA.js +0 -25
  404. package/chunks/theme-manager-YYPZFBAH.js +0 -78
  405. package/chunks/total-session-admission-JXES723M.js +0 -85
  406. package/chunks/trustedFolders-HVI7IXUH.js +0 -94
  407. package/chunks/updateCheck-WUJGHWZZ.js +0 -93
  408. package/chunks/useAutoAcceptIndicator-CHSTZLZD.js +0 -94
  409. package/chunks/workspace-providers-status-GAKSF4LL.js +0 -87
  410. package/chunks/workspace-registry-A7NQUONG.js +0 -89
  411. package/chunks/workspace-service-STGVSO4N.js +0 -99
  412. package/chunks/workspace-skills-status-66AK3DUA.js +0 -86
  413. package/chunks/write-file-HUUCEG4P.js +0 -74
  414. package/web-shell/assets/channel-Bzdx6E8P.js +0 -1
  415. package/web-shell/assets/classDiagram-4FO5ZUOK-Cd6wbiuK.js +0 -1
  416. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-Cd6wbiuK.js +0 -1
  417. package/web-shell/assets/index-B2bXx96W.js +0 -1249
  418. package/web-shell/assets/index-_8mKjx8q.css +0 -5
  419. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BjMdT6E_.js +0 -1
  420. package/chunks/{chunk-TARRHLLG.js → chunk-QUGAUQGJ.js} +25 -25
  421. package/chunks/{chunk-U7ZFW55U.js → chunk-VOQXFAY5.js} +977 -977
  422. /package/chunks/{chunk-LXXMOYPL.js → chunk-VXZBKKQR.js} +0 -0
@@ -8,21 +8,41 @@ 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-XUGZYLDH.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-GURGAJTX.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
+ TODO_STOP_GUARD_CONTINUATION_CLAIM_METHOD,
43
+ TODO_STOP_GUARD_QUEUE_RELEASE_METHOD,
44
+ WORKTREE_MCP_DEFER_META_KEY
45
+ } from "./chunk-CPZAH673.js";
26
46
  import {
27
47
  BranchWhilePromptActiveError,
28
48
  CancelSentinelCollisionError,
@@ -32,7 +52,6 @@ import {
32
52
  InvalidRewindTargetError,
33
53
  InvalidSessionMetadataError,
34
54
  InvalidSessionScopeError,
35
- MCP_RESTART_SERVER_DEADLINE_MS,
36
55
  PermissionForbiddenError,
37
56
  PromptDeadlineExceededError,
38
57
  PromptQueueFullError,
@@ -44,19 +63,7 @@ import {
44
63
  SessionShellDisabledError,
45
64
  WorkspaceMismatchError,
46
65
  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";
66
+ } from "./chunk-B4AJNNOL.js";
60
67
  import {
61
68
  canonicalizeWorkspace,
62
69
  translateAndCheckAbsoluteWorkspacePath
@@ -82,16 +89,16 @@ import {
82
89
  metadataBudgetBytes,
83
90
  normalizeSnapshotPayload,
84
91
  stableSessionArtifactId
85
- } from "./chunk-DM4Q4JJH.js";
92
+ } from "./chunk-54YCNSK5.js";
86
93
  import {
87
94
  DAEMON_TRACEPARENT_META_KEY,
88
95
  DAEMON_TRACESTATE_META_KEY
89
- } from "./chunk-BO4XCS7P.js";
96
+ } from "./chunk-Z3S5EMOW.js";
90
97
  import {
91
98
  INVOCATION_CONTEXT_META_KEY,
92
99
  PRIVATE_ACP_CAPABILITY_ENV,
93
100
  PRIVATE_PARENT_CAPABILITY_META_KEY
94
- } from "./chunk-RWS5VYWC.js";
101
+ } from "./chunk-DUNI4EBW.js";
95
102
  import {
96
103
  init_esbuild_shims
97
104
  } from "./chunk-5O2XNYP6.js";
@@ -136,16 +143,14 @@ function replayRecordId(event) {
136
143
  return typeof recordId === "string" ? recordId : void 0;
137
144
  }
138
145
  __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`);
146
+ function lastRecordIdIn(events) {
147
+ for (let i = events.length - 1; i >= 0; i--) {
148
+ const id = replayRecordId(events[i]);
149
+ if (id !== void 0) return id;
145
150
  }
146
- return value;
151
+ return void 0;
147
152
  }
148
- __name(normalizeJournalCap, "normalizeJournalCap");
153
+ __name(lastRecordIdIn, "lastRecordIdIn");
149
154
  var TurnBoundaryCompactionEngine = class {
150
155
  static {
151
156
  __name(this, "TurnBoundaryCompactionEngine");
@@ -166,6 +171,24 @@ var TurnBoundaryCompactionEngine = class {
166
171
  closed = false;
167
172
  truncatedEvents = 0;
168
173
  truncatedTurns = 0;
174
+ // Most recent `qwen.session.recordId` observed on an ingested or seeded
175
+ // `session_update`. Surfaced on the `history_truncated` marker emitted by
176
+ // `snapshot()` so clients that lost every turn-boundary event from their
177
+ // retained window (e.g. a live-journal truncation during a single long
178
+ // in-flight turn) still have an anchor for `beforeRecordId` transcript
179
+ // pagination. Undefined until at least one recordId has been observed;
180
+ // omitted from the marker in that case.
181
+ activeRecordId;
182
+ // Pagination anchor for the replay-path `history_truncated` marker,
183
+ // frozen at the first replay-window eviction. Prefers the first
184
+ // retained recordId (the eviction boundary, so `beforeRecordId`
185
+ // fetches exactly the dropped records with no overlap); falls back to
186
+ // the last dropped recordId when the retained window carries no
187
+ // recordId. Deliberately NOT `activeRecordId` — that one is advanced
188
+ // by `ingest()` on every turn boundary and, when a retained segment
189
+ // carries the last seed recordId, would place the anchor inside the
190
+ // retained window and re-fetch records the client already displays.
191
+ replayAnchorRecordId;
169
192
  slots = [];
170
193
  toolSlotIndex = /* @__PURE__ */ new Map();
171
194
  textSlotIndex = {
@@ -174,16 +197,8 @@ var TurnBoundaryCompactionEngine = class {
174
197
  };
175
198
  constructor(opts = {}) {
176
199
  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
- );
200
+ this.maxJournalEvents = normalizeMaxJournalEvents(opts.maxJournalEvents);
201
+ this.maxJournalBytes = normalizeMaxJournalBytes(opts.maxJournalBytes);
187
202
  this.onReplayWindowEviction = opts.onReplayWindowEviction;
188
203
  }
189
204
  ingest(event, byteLength) {
@@ -192,6 +207,10 @@ var TurnBoundaryCompactionEngine = class {
192
207
  this.lastEventId = event.id;
193
208
  }
194
209
  if (TRANSIENT_TYPES.has(event.type)) return;
210
+ const seenRecordId = replayRecordId(event);
211
+ if (seenRecordId !== void 0) {
212
+ this.activeRecordId = seenRecordId;
213
+ }
195
214
  this.liveJournal.push(event);
196
215
  const bytes = byteLength ?? serializedBridgeEventByteLength(event) ?? 0;
197
216
  this.journalEntryBytes.push(bytes);
@@ -230,6 +249,8 @@ var TurnBoundaryCompactionEngine = class {
230
249
  retainedEvents: this.liveJournal.length,
231
250
  maxBytes: this.maxJournalBytes,
232
251
  maxEvents: this.maxJournalEvents,
252
+ // Pagination anchor — see makeHistoryTruncatedEvent.
253
+ ...this.activeRecordId !== void 0 ? { recordId: this.activeRecordId } : {},
233
254
  fullTranscriptAvailable: true
234
255
  }
235
256
  });
@@ -244,6 +265,8 @@ var TurnBoundaryCompactionEngine = class {
244
265
  if (this.closed) return;
245
266
  this.resetReplayWindow();
246
267
  this.lastEventId = snapshot.lastEventId;
268
+ this.activeRecordId = void 0;
269
+ this.activeRecordId = lastRecordIdIn(snapshot.compactedTurns);
247
270
  for (const event of snapshot.compactedTurns) {
248
271
  if (TRANSIENT_TYPES.has(event.type)) continue;
249
272
  this.addReplaySegment([event], 0);
@@ -256,6 +279,8 @@ var TurnBoundaryCompactionEngine = class {
256
279
  seedReplayEvents(events) {
257
280
  if (this.closed) return;
258
281
  this.resetReplayWindow();
282
+ this.activeRecordId = void 0;
283
+ this.activeRecordId = lastRecordIdIn(events);
259
284
  let recordEvents = [];
260
285
  let recordId;
261
286
  const flushRecord = /* @__PURE__ */ __name(() => {
@@ -289,6 +314,7 @@ var TurnBoundaryCompactionEngine = class {
289
314
  this.closed = true;
290
315
  this.resetReplayWindow();
291
316
  this.resetJournal();
317
+ this.activeRecordId = void 0;
292
318
  this.slots = [];
293
319
  this.toolSlotIndex.clear();
294
320
  this.clearTextSlotIndex();
@@ -487,6 +513,7 @@ var TurnBoundaryCompactionEngine = class {
487
513
  let droppedBytes = 0;
488
514
  let droppedEvents = 0;
489
515
  let droppedTurns = 0;
516
+ let lastDroppedRecordId;
490
517
  while (this.replayBytes > this.maxReplayBytes && this.activeReplaySegmentCount() > 1) {
491
518
  const dropped = this.replaySegments[this.replaySegmentStart];
492
519
  this.replaySegmentStart += 1;
@@ -497,8 +524,13 @@ var TurnBoundaryCompactionEngine = class {
497
524
  this.replayBytes -= dropped.bytes;
498
525
  this.truncatedEvents += dropped.events.length;
499
526
  this.truncatedTurns += dropped.turnCount;
527
+ const droppedRecordId = lastRecordIdIn(dropped.events);
528
+ if (droppedRecordId !== void 0) {
529
+ lastDroppedRecordId = droppedRecordId;
530
+ }
500
531
  }
501
532
  if (droppedSegmentCount > 0) {
533
+ this.replayAnchorRecordId ??= this.firstRetainedReplayRecordId() ?? lastDroppedRecordId;
502
534
  this.compactReplaySegmentQueueIfNeeded();
503
535
  this.notifyReplayWindowEviction({
504
536
  droppedBytes,
@@ -511,6 +543,13 @@ var TurnBoundaryCompactionEngine = class {
511
543
  });
512
544
  }
513
545
  }
546
+ firstRetainedReplayRecordId() {
547
+ for (let i = this.replaySegmentStart; i < this.replaySegments.length; i++) {
548
+ const recordId = lastRecordIdIn(this.replaySegments[i].events);
549
+ if (recordId !== void 0) return recordId;
550
+ }
551
+ return void 0;
552
+ }
514
553
  flattenReplaySegments() {
515
554
  return this.replaySegments.slice(this.replaySegmentStart).flatMap((segment) => segment.events);
516
555
  }
@@ -538,6 +577,15 @@ var TurnBoundaryCompactionEngine = class {
538
577
  retainedEvents,
539
578
  maxBytes: this.maxReplayBytes,
540
579
  ...this.truncatedTurns > 0 ? { truncatedTurns: this.truncatedTurns } : {},
580
+ // Pagination anchor for clients whose retained window lost every
581
+ // turn-boundary event (e.g. live-journal truncation during one
582
+ // long in-flight turn). Uses the eviction-time anchor, not
583
+ // `activeRecordId`, so a post-seed `ingest()` can't push it past
584
+ // records the client already displays. Undefined when no recordId
585
+ // was observed before the first eviction — the field is
586
+ // intentionally omitted in that case so old clients continue to
587
+ // validate the marker shape.
588
+ ...this.replayAnchorRecordId !== void 0 ? { recordId: this.replayAnchorRecordId } : {},
541
589
  fullTranscriptAvailable: true
542
590
  }
543
591
  };
@@ -548,6 +596,7 @@ var TurnBoundaryCompactionEngine = class {
548
596
  this.replayBytes = 0;
549
597
  this.truncatedEvents = 0;
550
598
  this.truncatedTurns = 0;
599
+ this.replayAnchorRecordId = void 0;
551
600
  }
552
601
  clearTextSlotIndex() {
553
602
  this.textSlotIndex.text.clear();
@@ -693,6 +742,7 @@ __name(mergeTranscriptUpdateMeta, "mergeTranscriptUpdateMeta");
693
742
 
694
743
  // packages/acp-bridge/src/session-source.ts
695
744
  init_esbuild_shims();
745
+ var SESSION_SOURCE_META_KEY = "qwen.session.source";
696
746
  var SESSION_SOURCE_TYPE_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;
697
747
  var MAX_SESSION_SOURCE_ID_LENGTH = 256;
698
748
  function parseSessionSource(sourceType, sourceId) {
@@ -1760,7 +1810,7 @@ function sliceLineRange(content, startLine, endLine) {
1760
1810
  }
1761
1811
  __name(sliceLineRange, "sliceLineRange");
1762
1812
  var BridgeClient = class {
1763
- constructor(resolveEntry, resolvePendingRestoreEvents, mediator, permissionTimeoutMs, maxPendingPerSession, fileSystem, onModelPromoted, onModePromoted, clientMcpSender, ownsSession = () => true, onTokenUsage, onCreateSubSession, onGenerationEvent, onWorkspaceGenerationEvent, onChannelDelivery) {
1813
+ constructor(resolveEntry, resolvePendingRestoreEvents, mediator, permissionTimeoutMs, maxPendingPerSession, fileSystem, onModelPromoted, onModePromoted, clientMcpSender, ownsSession = () => true, onTokenUsage, onCreateSubSession, onGenerationEvent, onWorkspaceGenerationEvent, onChannelDelivery, hasSessionSpawnInFlight = () => false) {
1764
1814
  this.resolveEntry = resolveEntry;
1765
1815
  this.resolvePendingRestoreEvents = resolvePendingRestoreEvents;
1766
1816
  this.mediator = mediator;
@@ -1776,6 +1826,7 @@ var BridgeClient = class {
1776
1826
  this.onGenerationEvent = onGenerationEvent;
1777
1827
  this.onWorkspaceGenerationEvent = onWorkspaceGenerationEvent;
1778
1828
  this.onChannelDelivery = onChannelDelivery;
1829
+ this.hasSessionSpawnInFlight = hasSessionSpawnInFlight;
1779
1830
  }
1780
1831
  static {
1781
1832
  __name(this, "BridgeClient");
@@ -2056,6 +2107,9 @@ var BridgeClient = class {
2056
2107
  if (method === SERVE_CONTROL_EXT_METHODS.channelDelivery) {
2057
2108
  return this.handleChannelDelivery(params);
2058
2109
  }
2110
+ if (method === TODO_STOP_GUARD_CONTINUATION_CLAIM_METHOD) {
2111
+ return this.handleTodoStopGuardContinuationClaim(params);
2112
+ }
2059
2113
  if (method !== MID_TURN_QUEUE_DRAIN_METHOD) {
2060
2114
  throw RequestError.methodNotFound(method);
2061
2115
  }
@@ -2068,9 +2122,6 @@ var BridgeClient = class {
2068
2122
  const hasQueuedPrompt = entry.pendingPromptList.some(
2069
2123
  (prompt) => prompt.state === "queued" && !prompt.abortController.signal.aborted
2070
2124
  );
2071
- if (params["todoStopGuardWatchQueuedPrompt"] === true) {
2072
- entry.todoStopGuardAwaitingQueuedPrompt = hasQueuedPrompt;
2073
- }
2074
2125
  if (drained.length > 0) {
2075
2126
  const byOriginator = /* @__PURE__ */ new Map();
2076
2127
  for (const item of drained) {
@@ -2092,6 +2143,45 @@ var BridgeClient = class {
2092
2143
  }
2093
2144
  return { messages, hasQueuedPrompt };
2094
2145
  }
2146
+ handleTodoStopGuardContinuationClaim(params) {
2147
+ const sessionId = typeof params["sessionId"] === "string" && params["sessionId"].length > 0 ? params["sessionId"] : void 0;
2148
+ if (!sessionId) return { claimed: false, hasQueuedPrompt: false };
2149
+ if (!this.ownsSession(sessionId)) {
2150
+ return { claimed: false, hasQueuedPrompt: false };
2151
+ }
2152
+ const entry = this.resolveEntry(sessionId);
2153
+ if (!entry) return { claimed: false, hasQueuedPrompt: false };
2154
+ const livePrompts = entry.pendingPromptList.filter(
2155
+ (prompt) => !prompt.abortController.signal.aborted
2156
+ );
2157
+ const promptId = typeof params["promptId"] === "string" && params["promptId"].length > 0 ? params["promptId"] : void 0;
2158
+ if (promptId) {
2159
+ const ownsRunningPrompt = entry.activePromptId === promptId && livePrompts.some(
2160
+ (prompt) => prompt.promptId === promptId && prompt.state === "running"
2161
+ );
2162
+ const hasCompetingRunningPrompt = livePrompts.some(
2163
+ (prompt) => prompt.promptId !== promptId && prompt.state === "running"
2164
+ );
2165
+ if (!ownsRunningPrompt || hasCompetingRunningPrompt) {
2166
+ return { claimed: false, hasQueuedPrompt: false };
2167
+ }
2168
+ const hasQueuedPrompt = livePrompts.some(
2169
+ (prompt) => prompt.state === "queued"
2170
+ );
2171
+ if (hasQueuedPrompt) {
2172
+ entry.todoStopGuardAwaitingQueuedPromptOwnerPromptId = promptId;
2173
+ return { claimed: false, hasQueuedPrompt: true };
2174
+ }
2175
+ if (entry.todoStopGuardAwaitingQueuedPromptOwnerPromptId === promptId) {
2176
+ delete entry.todoStopGuardAwaitingQueuedPromptOwnerPromptId;
2177
+ }
2178
+ return { claimed: true, hasQueuedPrompt: false };
2179
+ }
2180
+ if (entry.promptActive || livePrompts.length > 0) {
2181
+ return { claimed: false, hasQueuedPrompt: false };
2182
+ }
2183
+ return { claimed: true, hasQueuedPrompt: false };
2184
+ }
2095
2185
  async handleChannelDelivery(params) {
2096
2186
  if (!this.onChannelDelivery) {
2097
2187
  throw RequestError.methodNotFound(
@@ -2227,7 +2317,29 @@ var BridgeClient = class {
2227
2317
  `client-hosted MCP server '${server}' is not currently connected`
2228
2318
  );
2229
2319
  }
2230
- const response = await send(payload);
2320
+ const sessionId = params["sessionId"];
2321
+ if (sessionId !== void 0 && (typeof sessionId !== "string" || sessionId.length === 0)) {
2322
+ throw RequestError.invalidParams(
2323
+ void 0,
2324
+ "`sessionId` must be a non-empty string when provided"
2325
+ );
2326
+ }
2327
+ const ownsSession = typeof sessionId === "string" && this.ownsSession(sessionId);
2328
+ if (typeof sessionId === "string" && !ownsSession && !this.hasSessionSpawnInFlight()) {
2329
+ throw RequestError.invalidParams(
2330
+ void 0,
2331
+ `Session not owned by this channel: ${sessionId}`
2332
+ );
2333
+ }
2334
+ if (typeof sessionId === "string" && !ownsSession) {
2335
+ writeStderrLine(
2336
+ `[demux] session=${sessionId} type=client_mcp_message action=forwarded_without_session reason=session_registration_pending`
2337
+ );
2338
+ }
2339
+ const response = await send(
2340
+ payload,
2341
+ typeof sessionId === "string" && ownsSession ? { sessionId } : void 0
2342
+ );
2231
2343
  return { payload: response };
2232
2344
  }
2233
2345
  /**
@@ -5315,6 +5427,15 @@ function isRecord3(value) {
5315
5427
  return typeof value === "object" && value !== null && !Array.isArray(value);
5316
5428
  }
5317
5429
  __name(isRecord3, "isRecord");
5430
+ function sessionSourceRequestMeta(sourceType, sourceId) {
5431
+ return sourceType ? {
5432
+ [SESSION_SOURCE_META_KEY]: {
5433
+ sourceType,
5434
+ ...sourceId !== void 0 ? { sourceId } : {}
5435
+ }
5436
+ } : {};
5437
+ }
5438
+ __name(sessionSourceRequestMeta, "sessionSourceRequestMeta");
5318
5439
  function isDefinitiveAcpRequestError(error) {
5319
5440
  if (error instanceof RequestError) return true;
5320
5441
  if (!isRecord3(error)) return false;
@@ -5844,6 +5965,8 @@ function createAcpSessionBridge(opts) {
5844
5965
  const compactedReplayMaxBytes = normalizeCompactedReplayMaxBytes(
5845
5966
  opts.compactedReplayMaxBytes
5846
5967
  );
5968
+ const maxJournalEvents = normalizeMaxJournalEvents(opts.maxJournalEvents);
5969
+ const maxJournalBytes = normalizeMaxJournalBytes(opts.maxJournalBytes);
5847
5970
  const channelFactory = opts.channelFactory ?? defaultSpawnChannelFactory;
5848
5971
  const childEnvOverrides = opts.childEnvOverrides ? Object.freeze({ ...opts.childEnvOverrides }) : Object.freeze({});
5849
5972
  const initTimeoutMs = opts.initializeTimeoutMs ?? DEFAULT_INIT_TIMEOUT_MS;
@@ -6259,98 +6382,124 @@ function createAcpSessionBridge(opts) {
6259
6382
  })
6260
6383
  );
6261
6384
  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
6385
+ let client;
6386
+ let connection;
6387
+ try {
6388
+ client = new BridgeClient(
6389
+ // BfFut: ACP today carries a sessionId on every per-session
6390
+ // notification / request, so the no-sessionId branch is
6391
+ // technically unreachable. But the channel is multi-session
6392
+ // (Stage 1.5 multiplex), so if ACP ever grows a no-sessionId
6393
+ // call we'd silently drop it on a multi-session channel
6394
+ // instead of throwing. Surface that ambiguity loudly.
6395
+ (sessionId) => {
6396
+ if (sessionId) return byId.get(sessionId);
6397
+ if (channelInfo && channelInfo.sessionIds.size > 1) {
6398
+ throw new Error(
6399
+ "BridgeClient: ACP call without sessionId on a multi-session channel cannot be routed \u2014 workspace=" + boundWorkspace
6400
+ );
6401
+ }
6402
+ return void 0;
6403
+ },
6404
+ (sessionId) => sessionId ? pendingRestoreEvents.get(sessionId) : void 0,
6405
+ permissionMediator,
6406
+ permissionTimeoutMs,
6407
+ maxPendingPerSession,
6408
+ // Forward the optional `BridgeFileSystem` injection so
6409
+ // production `qwen serve` can wire the `WorkspaceFileSystem`
6410
+ // adapter into BridgeClient's fs proxy methods. Tests + Mode A
6411
+ // consumers + channels / IDE companion omit it; BridgeClient
6412
+ // falls back to its inline fs proxy.
6413
+ opts.fileSystem,
6414
+ // §2.3: centralised model_switched publish — keeps cache + generation
6415
+ // update atomic. BridgeClient calls this instead of inlining publish.
6416
+ (entry, modelId, originator) => publishModelSwitched(entry, modelId, originator),
6417
+ // A2: centralised approval_mode_changed publish on in-session mode
6418
+ // promotion. `previous` is read from the bridge state cache.
6419
+ (entry, modeId, originator) => {
6420
+ const se = entry;
6421
+ publishApprovalModeChanged(
6422
+ se,
6423
+ {
6424
+ previous: se.currentApprovalMode ?? "default",
6425
+ next: modeId,
6426
+ persisted: false
6427
+ },
6428
+ originator
6274
6429
  );
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
6430
+ },
6431
+ // Reverse tool channel (issue #5626, Phase 2): forward the optional
6432
+ // client-hosted-MCP sender lookup so `BridgeClient.extMethod` can
6433
+ // answer `qwen/control/client_mcp/message` from the child by reaching
6434
+ // the per-WS-connection `ClientMcpRegistrar`. Omitted callers (tests,
6435
+ // Mode A) never host a client MCP server, so the method stays
6436
+ // unreachable.
6437
+ opts.clientMcpSender,
6438
+ (sessionId) => sessionIds.has(sessionId),
6439
+ // Daemon token-burn accounting: forward per-round token usage observed
6440
+ // at the session/update fan-in to the daemon host's metrics ring via
6441
+ // the telemetry seam. Optional-chained so non-daemon callers (tests,
6442
+ // Mode A) that wire no `tokenUsage` metric are a silent no-op.
6443
+ (inputTokens, outputTokens, durationMs, apiErrors, apiRetries) => telemetry.metrics?.tokenUsage?.(
6444
+ inputTokens,
6445
+ outputTokens,
6446
+ durationMs,
6447
+ apiErrors,
6448
+ apiRetries
6449
+ ),
6450
+ // `create_sub_session` tool: forward the request/response hook so a child
6451
+ // tool can ask the daemon to spawn a sub-session and (for 'first-turn')
6452
+ // return its result. Omitted → the method reports daemon-only.
6453
+ opts.onCreateSubSession,
6454
+ (sessionId, event) => {
6455
+ const request = generationRequests.get(event.requestId);
6456
+ if (!request || request.sessionId !== sessionId) return;
6457
+ if (request.queue.push(event)) return;
6458
+ request.settled = true;
6459
+ generationRequests.delete(event.requestId);
6460
+ request.queue.fail(
6461
+ new Error("Generation stream consumer too slow")
6462
+ );
6463
+ void request.connection.extMethod(SERVE_CONTROL_EXT_METHODS.sessionGenerationCancel, {
6464
+ sessionId,
6465
+ requestId: event.requestId
6466
+ }).catch(() => void 0);
6467
+ },
6468
+ (event) => {
6469
+ const request = workspaceGenerationRequests.get(event.requestId);
6470
+ if (!request) return;
6471
+ if (request.queue.push(event)) return;
6472
+ request.settled = true;
6473
+ workspaceGenerationRequests.delete(event.requestId);
6474
+ request.queue.fail(
6475
+ new Error("Generation stream consumer too slow")
6476
+ );
6477
+ void request.connection?.extMethod(SERVE_CONTROL_EXT_METHODS.workspaceGenerationCancel, {
6478
+ requestId: event.requestId
6479
+ }).catch(() => void 0);
6480
+ },
6481
+ opts.onChannelDelivery,
6482
+ () => channelInfo?.sessionIds === sessionIds && channelInfo.sessionSpawnsInFlight > 0
6483
+ );
6484
+ connection = new ClientSideConnection(() => client, channel.stream);
6485
+ } catch (error) {
6486
+ try {
6487
+ channel.killSync();
6488
+ } catch {
6489
+ }
6490
+ try {
6491
+ await Promise.race([
6492
+ channel.exited.then(() => void 0),
6493
+ channel.kill()
6494
+ ]);
6495
+ } catch (teardownError) {
6496
+ throw new AggregateError(
6497
+ [error, teardownError],
6498
+ "ACP channel construction and teardown failed"
6303
6499
  );
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);
6500
+ }
6501
+ throw error;
6502
+ }
6354
6503
  const info = {
6355
6504
  id: acpChannelId,
6356
6505
  channel,
@@ -6533,12 +6682,20 @@ function createAcpSessionBridge(opts) {
6533
6682
  "qwen-code.daemon.acp_channel.id": ci.id
6534
6683
  },
6535
6684
  async () => {
6685
+ const request = telemetry.injectPromptContext({
6686
+ cwd: boundWorkspace,
6687
+ mcpServers: [],
6688
+ ...sourceType ? { _meta: sessionSourceRequestMeta(sourceType, sourceId) } : {}
6689
+ });
6536
6690
  const response = await withTimeout(
6537
6691
  ci.connection.newSession(
6538
- telemetry.injectPromptContext({
6539
- cwd: boundWorkspace,
6540
- mcpServers: []
6541
- })
6692
+ worktree ? {
6693
+ ...request,
6694
+ _meta: {
6695
+ ...isRecord3(request._meta) ? request._meta : {},
6696
+ [WORKTREE_MCP_DEFER_META_KEY]: true
6697
+ }
6698
+ } : request
6542
6699
  ),
6543
6700
  initTimeoutMs,
6544
6701
  "newSession"
@@ -7109,7 +7266,7 @@ function createAcpSessionBridge(opts) {
7109
7266
  cpuPercent: info.childCpuPercent ?? 0
7110
7267
  };
7111
7268
  }, "getChildResourceSnapshot");
7112
- const requestSessionStatus = /* @__PURE__ */ __name(async (sessionId, method, params = {}) => {
7269
+ const requestSessionStatus = /* @__PURE__ */ __name(async (sessionId, method, params = {}, timeoutMs = initTimeoutMs) => {
7113
7270
  const entry = byId.get(sessionId);
7114
7271
  if (!entry) throw new SessionNotFoundError(sessionId);
7115
7272
  const info = channelInfoForEntry(entry);
@@ -7117,7 +7274,7 @@ function createAcpSessionBridge(opts) {
7117
7274
  const response = await Promise.race([
7118
7275
  withTimeout(
7119
7276
  entry.connection.extMethod(method, { ...params, sessionId }),
7120
- initTimeoutMs,
7277
+ timeoutMs,
7121
7278
  method
7122
7279
  ),
7123
7280
  getTransportClosedReject(entry)
@@ -7207,6 +7364,8 @@ function createAcpSessionBridge(opts) {
7207
7364
  void 0,
7208
7365
  new TurnBoundaryCompactionEngine({
7209
7366
  maxReplayBytes: compactedReplayMaxBytes,
7367
+ maxJournalEvents,
7368
+ maxJournalBytes,
7210
7369
  onReplayWindowEviction: /* @__PURE__ */ __name((eviction) => {
7211
7370
  teeServeDebugLine(
7212
7371
  `replay window evicted ${JSON.stringify(eviction)}`
@@ -7310,6 +7469,7 @@ function createAcpSessionBridge(opts) {
7310
7469
  const entry = {
7311
7470
  sessionId,
7312
7471
  workspaceCwd,
7472
+ effectiveCwd: workspaceCwd,
7313
7473
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
7314
7474
  ...options.parentSessionId ? { parentSessionId: options.parentSessionId } : {},
7315
7475
  ...options.sourceType ? { sourceType: options.sourceType } : {},
@@ -7326,6 +7486,7 @@ function createAcpSessionBridge(opts) {
7326
7486
  }),
7327
7487
  recordingDegraded: false,
7328
7488
  closing: false,
7489
+ cwdChangeQueue: Promise.resolve(),
7329
7490
  promptQueue: Promise.resolve(),
7330
7491
  pendingPromptCount: 0,
7331
7492
  pendingPromptList: [],
@@ -7592,6 +7753,46 @@ function createAcpSessionBridge(opts) {
7592
7753
  return replayFieldsFor(entry, "load");
7593
7754
  }
7594
7755
  __name(refreshedReplayFieldsFor, "refreshedReplayFieldsFor");
7756
+ function transcriptEventRecordId(event) {
7757
+ if (event.type !== "session_update") return void 0;
7758
+ const data = event.data;
7759
+ if (!data || typeof data !== "object" || Array.isArray(data))
7760
+ return void 0;
7761
+ const rec = data;
7762
+ const update = rec["update"];
7763
+ const meta = update && typeof update === "object" && !Array.isArray(update) ? update["_meta"] : rec["_meta"];
7764
+ if (!meta || typeof meta !== "object" || Array.isArray(meta))
7765
+ return void 0;
7766
+ const recordId = meta["qwen.session.recordId"];
7767
+ return typeof recordId === "string" ? recordId : void 0;
7768
+ }
7769
+ __name(transcriptEventRecordId, "transcriptEventRecordId");
7770
+ async function resolveHistoryAnchorRecordId(entry, replayFields) {
7771
+ const events = [
7772
+ ...replayFields.compactedReplay ?? [],
7773
+ ...replayFields.liveJournal ?? []
7774
+ ];
7775
+ const hasMarker = events.some((e) => e.type === "history_truncated");
7776
+ if (!hasMarker) return void 0;
7777
+ const hasRecordId = events.some(
7778
+ (e) => transcriptEventRecordId(e) !== void 0 || e.type === "history_truncated" && isRecord3(e.data) && typeof e.data["recordId"] === "string"
7779
+ );
7780
+ if (hasRecordId) return void 0;
7781
+ try {
7782
+ const page = await requestSessionTranscriptPage({
7783
+ sessionId: entry.sessionId,
7784
+ direction: "backward",
7785
+ limit: 50
7786
+ });
7787
+ for (const event of page.events) {
7788
+ const recordId = transcriptEventRecordId(event);
7789
+ if (recordId !== void 0) return recordId;
7790
+ }
7791
+ } catch {
7792
+ }
7793
+ return void 0;
7794
+ }
7795
+ __name(resolveHistoryAnchorRecordId, "resolveHistoryAnchorRecordId");
7595
7796
  async function restoreSession(action, req, options = {}) {
7596
7797
  if (shuttingDown) {
7597
7798
  throw new Error("AcpSessionBridge is shutting down");
@@ -7603,6 +7804,7 @@ function createAcpSessionBridge(opts) {
7603
7804
  );
7604
7805
  }
7605
7806
  const historyReplay = action === "load" ? req.historyReplay ?? "stream" : "stream";
7807
+ const hideInheritedHistory = action === "load" && req.hideInheritedHistory === true;
7606
7808
  const existing = byId.get(req.sessionId);
7607
7809
  if (existing) {
7608
7810
  if (existing.closing) {
@@ -7612,6 +7814,7 @@ function createAcpSessionBridge(opts) {
7612
7814
  );
7613
7815
  }
7614
7816
  const replayFields = action === "load" && req.historyPageSize !== void 0 ? await refreshedReplayFieldsFor(existing, req.historyPageSize) : replayFieldsFor(existing, action);
7817
+ const historyAnchorRecordId = action === "load" ? await resolveHistoryAnchorRecordId(existing, replayFields) : void 0;
7615
7818
  if (byId.get(req.sessionId) !== existing || existing.closing) {
7616
7819
  throw new SessionNotFoundError(req.sessionId);
7617
7820
  }
@@ -7633,12 +7836,13 @@ function createAcpSessionBridge(opts) {
7633
7836
  // caller saw; spawn-only sessions don't carry a state payload.
7634
7837
  state: existing.restoreState ?? {},
7635
7838
  hasActivePrompt: existing.promptActive,
7636
- ...replayFields
7839
+ ...replayFields,
7840
+ ...historyAnchorRecordId !== void 0 ? { historyAnchorRecordId } : {}
7637
7841
  };
7638
7842
  }
7639
7843
  const inFlight = inFlightRestores.get(req.sessionId);
7640
7844
  if (inFlight) {
7641
- if (action !== inFlight.action || historyReplay !== inFlight.historyReplay) {
7845
+ if (action !== inFlight.action || historyReplay !== inFlight.historyReplay || hideInheritedHistory !== inFlight.hideInheritedHistory) {
7642
7846
  throw new RestoreInProgressError(
7643
7847
  req.sessionId,
7644
7848
  inFlight.action,
@@ -7720,11 +7924,20 @@ function createAcpSessionBridge(opts) {
7720
7924
  // intentionally has no `mcpServers` field for the
7721
7925
  // same reason.
7722
7926
  mcpServers: [],
7723
- ...historyReplay === "response" ? {
7927
+ ...historyReplay === "response" || hideInheritedHistory || req.sourceType ? {
7724
7928
  _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
7929
+ ...sessionSourceRequestMeta(
7930
+ req.sourceType,
7931
+ req.sourceId
7932
+ ),
7933
+ ...historyReplay === "response" ? {
7934
+ [LOAD_REPLAY_MODE_META_KEY]: LOAD_REPLAY_BULK_MODE,
7935
+ ...req.historyPageSize !== void 0 ? {
7936
+ [LOAD_REPLAY_PAGE_SIZE_META_KEY]: req.historyPageSize
7937
+ } : {}
7938
+ } : {},
7939
+ ...hideInheritedHistory ? {
7940
+ [LOAD_REPLAY_HIDE_INHERITED_META_KEY]: true
7728
7941
  } : {}
7729
7942
  }
7730
7943
  } : {}
@@ -7740,7 +7953,13 @@ function createAcpSessionBridge(opts) {
7740
7953
  ci.connection.unstable_resumeSession({
7741
7954
  sessionId: req.sessionId,
7742
7955
  cwd: workspaceKey,
7743
- mcpServers: []
7956
+ mcpServers: [],
7957
+ ...req.sourceType ? {
7958
+ _meta: sessionSourceRequestMeta(
7959
+ req.sourceType,
7960
+ req.sourceId
7961
+ )
7962
+ } : {}
7744
7963
  }),
7745
7964
  initTimeoutMs,
7746
7965
  "resumeSession"
@@ -7918,6 +8137,7 @@ function createAcpSessionBridge(opts) {
7918
8137
  inFlightRestores.set(req.sessionId, {
7919
8138
  action,
7920
8139
  historyReplay,
8140
+ hideInheritedHistory,
7921
8141
  promise,
7922
8142
  coalesceState
7923
8143
  });
@@ -8046,6 +8266,8 @@ function createAcpSessionBridge(opts) {
8046
8266
  maxPendingPromptsPerSession: maxPendingPromptsPerSession === Infinity ? null : maxPendingPromptsPerSession,
8047
8267
  eventRingSize,
8048
8268
  compactedReplayMaxBytes,
8269
+ maxJournalEvents,
8270
+ maxJournalBytes,
8049
8271
  channelIdleTimeoutMs: resolvedChannelIdleTimeoutMs(),
8050
8272
  sessionIdleTimeoutMs
8051
8273
  },
@@ -8348,13 +8570,17 @@ function createAcpSessionBridge(opts) {
8348
8570
  "abort",
8349
8571
  () => {
8350
8572
  if (pendingEntry.state !== "queued") return;
8351
- if (!entry.todoStopGuardAwaitingQueuedPrompt) return;
8573
+ const waitingOwnerPromptId = entry.todoStopGuardAwaitingQueuedPromptOwnerPromptId;
8574
+ if (!waitingOwnerPromptId) return;
8352
8575
  const hasAnotherQueuedPrompt = entry.pendingPromptList.some(
8353
8576
  (candidate) => candidate !== pendingEntry && candidate.state === "queued" && !candidate.abortController.signal.aborted
8354
8577
  );
8355
8578
  if (hasAnotherQueuedPrompt) return;
8356
- entry.todoStopGuardAwaitingQueuedPrompt = false;
8357
- void entry.connection.extMethod(TODO_STOP_GUARD_QUEUE_RELEASE_METHOD, { sessionId }).catch((error) => {
8579
+ delete entry.todoStopGuardAwaitingQueuedPromptOwnerPromptId;
8580
+ void entry.connection.extMethod(TODO_STOP_GUARD_QUEUE_RELEASE_METHOD, {
8581
+ sessionId,
8582
+ promptId: waitingOwnerPromptId
8583
+ }).catch((error) => {
8358
8584
  writeStderrLine(
8359
8585
  `qwen serve: Todo Stop Guard queued-prompt release failed for ${JSON.stringify(sessionId)}: ${error instanceof Error ? error.message : String(error)}`
8360
8586
  );
@@ -8385,7 +8611,7 @@ function createAcpSessionBridge(opts) {
8385
8611
  throw new DOMException("Prompt aborted", "AbortError");
8386
8612
  }
8387
8613
  if (pendingEntry.state === "queued") {
8388
- entry.todoStopGuardAwaitingQueuedPrompt = false;
8614
+ delete entry.todoStopGuardAwaitingQueuedPromptOwnerPromptId;
8389
8615
  pendingEntry.state = "running";
8390
8616
  entry.events.publish({
8391
8617
  type: "pending_prompt_started",
@@ -8790,12 +9016,18 @@ function createAcpSessionBridge(opts) {
8790
9016
  if (shuttingDown) throw new Error("AcpSessionBridge is shutting down");
8791
9017
  const entry = byId.get(sessionId);
8792
9018
  if (!entry) throw new SessionNotFoundError(sessionId);
9019
+ const source = parseSessionSource(req.sourceType, req.sourceId);
9020
+ if ("error" in source) {
9021
+ throw new InvalidSessionMetadataError("sourceType", source.error);
9022
+ }
9023
+ const isSideTask = source.sourceType === "side_task";
8793
9024
  let originatorClientId;
8794
9025
  if (context?.clientId !== void 0) {
8795
9026
  originatorClientId = resolveTrustedClientId(entry, context.clientId);
8796
9027
  }
8797
- const branchResult = entry.promptQueue.then(async () => {
8798
- if (entry.promptActive) {
9028
+ const concurrentSideTask = isSideTask && entry.promptActive;
9029
+ const branchResult = (concurrentSideTask ? Promise.resolve() : entry.promptQueue).then(async () => {
9030
+ if (entry.promptActive && !isSideTask) {
8799
9031
  throw new BranchWhilePromptActiveError(sessionId);
8800
9032
  }
8801
9033
  if (byId.size + inFlightSpawns.size + inFlightRestores.size >= maxSessions) {
@@ -8815,13 +9047,16 @@ function createAcpSessionBridge(opts) {
8815
9047
  try {
8816
9048
  const ci = await ensureChannel();
8817
9049
  const result = await withTimeout(
8818
- ci.connection.extMethod(SERVE_CONTROL_EXT_METHODS.sessionBranch, {
8819
- sessionId,
8820
- cwd: boundWorkspace,
8821
- name: req.name
8822
- }),
9050
+ ci.connection.extMethod(
9051
+ isSideTask ? SERVE_CONTROL_EXT_METHODS.sessionSideTask : SERVE_CONTROL_EXT_METHODS.sessionBranch,
9052
+ {
9053
+ sessionId,
9054
+ cwd: boundWorkspace,
9055
+ name: req.name
9056
+ }
9057
+ ),
8823
9058
  initTimeoutMs,
8824
- "branchSession"
9059
+ isSideTask ? "createSideTaskSession" : "branchSession"
8825
9060
  );
8826
9061
  if (!result || typeof result.newSessionId !== "string") {
8827
9062
  throw new Error(
@@ -8832,12 +9067,18 @@ function createAcpSessionBridge(opts) {
8832
9067
  const branchDisplayName = typeof rawBranchName === "string" ? rawBranchName : result.newSessionId.slice(0, 8);
8833
9068
  let restored;
8834
9069
  try {
9070
+ const hideInheritedHistory = req.replayInheritedHistory === false;
8835
9071
  restored = await restoreSession(
8836
9072
  "load",
8837
9073
  {
8838
9074
  sessionId: result.newSessionId,
8839
9075
  workspaceCwd: boundWorkspace,
8840
- clientId: context?.clientId
9076
+ clientId: context?.clientId,
9077
+ ...hideInheritedHistory ? {
9078
+ historyReplay: "response",
9079
+ hideInheritedHistory: true
9080
+ } : {},
9081
+ ...source
8841
9082
  },
8842
9083
  {
8843
9084
  skipFreshSessionAdmission: true
@@ -8862,35 +9103,80 @@ function createAcpSessionBridge(opts) {
8862
9103
  }
8863
9104
  const newEntry = byId.get(result.newSessionId);
8864
9105
  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);
9106
+ let sourcePersisted;
9107
+ if (newEntry?.sourceType) {
9108
+ try {
9109
+ const sourceResult = await withTimeout(
9110
+ newEntry.connection.extMethod(
9111
+ SERVE_CONTROL_EXT_METHODS.sessionSource,
9112
+ {
9113
+ sessionId: newEntry.sessionId,
9114
+ sourceType: newEntry.sourceType,
9115
+ ...newEntry.sourceId !== void 0 ? { sourceId: newEntry.sourceId } : {}
9116
+ }
9117
+ ),
9118
+ initTimeoutMs,
9119
+ "sessionSource"
9120
+ );
9121
+ sourcePersisted = sourceResult?.persisted === true;
9122
+ } catch (error) {
9123
+ sourcePersisted = false;
9124
+ writeStderrLine(
9125
+ `qwen serve: source metadata for branched session ${result.newSessionId} was not persisted: ${error instanceof Error ? error.message : String(error)}`
9126
+ );
9127
+ }
9128
+ }
9129
+ if (!isSideTask) {
9130
+ const eventData = {
9131
+ sourceSessionId: sessionId,
9132
+ newSessionId: result.newSessionId,
9133
+ displayName: branchDisplayName
9134
+ };
9135
+ const branchEnvelope = {
9136
+ type: "session_branched",
9137
+ data: eventData,
9138
+ ...originatorClientId ? { originatorClientId } : {}
9139
+ };
9140
+ newEntry?.events.publish(branchEnvelope);
9141
+ }
8876
9142
  return {
8877
9143
  ...restored,
8878
9144
  displayName: branchDisplayName,
8879
9145
  forkedFrom: {
8880
9146
  sessionId,
8881
9147
  displayName: entry.displayName ?? sessionId.slice(0, 8)
8882
- }
9148
+ },
9149
+ ...sourcePersisted !== void 0 ? { sourcePersisted } : {}
8883
9150
  };
8884
9151
  } finally {
8885
9152
  releaseAdmissionOnce();
8886
9153
  }
8887
9154
  });
8888
- entry.promptQueue = branchResult.then(
8889
- () => void 0,
8890
- () => void 0
8891
- );
9155
+ if (!concurrentSideTask) {
9156
+ entry.promptQueue = branchResult.then(
9157
+ () => void 0,
9158
+ () => void 0
9159
+ );
9160
+ }
8892
9161
  return branchResult;
8893
9162
  },
9163
+ async createSideTaskSession(sessionId, req, context) {
9164
+ const result = await this.branchSession(
9165
+ sessionId,
9166
+ {
9167
+ name: req.name,
9168
+ sourceType: "side_task",
9169
+ sourceId: sessionId,
9170
+ replayInheritedHistory: false
9171
+ },
9172
+ context
9173
+ );
9174
+ const { forkedFrom: _forkedFrom, ...sideTask } = result;
9175
+ return {
9176
+ ...sideTask,
9177
+ parentSessionId: sessionId
9178
+ };
9179
+ },
8894
9180
  async changeSessionCwd(sessionId, req, context) {
8895
9181
  if (shuttingDown) throw new Error("AcpSessionBridge is shutting down");
8896
9182
  const entry = byId.get(sessionId);
@@ -8918,6 +9204,7 @@ function createAcpSessionBridge(opts) {
8918
9204
  `changeSessionCwd: unexpected response shape from agent: ${JSON.stringify(raw)}`
8919
9205
  );
8920
9206
  }
9207
+ entry.effectiveCwd = extResult.newCwd;
8921
9208
  if (extResult.previousCwd !== extResult.newCwd) {
8922
9209
  entry.events.publish({
8923
9210
  type: "session_cwd_changed",
@@ -8935,6 +9222,10 @@ function createAcpSessionBridge(opts) {
8935
9222
  () => void 0,
8936
9223
  () => void 0
8937
9224
  );
9225
+ entry.cwdChangeQueue = cdPromise.then(
9226
+ () => void 0,
9227
+ () => void 0
9228
+ );
8938
9229
  const result = await withTimeout(
8939
9230
  cdPromise,
8940
9231
  Math.max(initTimeoutMs, 3e4),
@@ -9436,44 +9727,79 @@ function createAcpSessionBridge(opts) {
9436
9727
  },
9437
9728
  async refreshExtensionsForAllSessions(data) {
9438
9729
  const sessions = Array.from(byId.values());
9730
+ const bootstrapRefreshConnections = /* @__PURE__ */ new Set();
9731
+ const refreshSession = /* @__PURE__ */ __name(async (entry, refreshBootstrap) => {
9732
+ let inFlight = inFlightExtensionRefreshes.get(entry.sessionId);
9733
+ if (!inFlight || inFlight.connection !== entry.connection || refreshBootstrap && !inFlight.refreshBootstrap) {
9734
+ const promise = (async () => {
9735
+ await entry.connection.extMethod(
9736
+ SERVE_CONTROL_EXT_METHODS.workspaceExtensionsRefresh,
9737
+ {
9738
+ sessionId: entry.sessionId,
9739
+ ...refreshBootstrap ? {} : { refreshBootstrap: false }
9740
+ }
9741
+ );
9742
+ })();
9743
+ inFlight = {
9744
+ connection: entry.connection,
9745
+ promise,
9746
+ refreshBootstrap
9747
+ };
9748
+ inFlightExtensionRefreshes.set(entry.sessionId, inFlight);
9749
+ const clear = /* @__PURE__ */ __name(() => {
9750
+ if (inFlightExtensionRefreshes.get(entry.sessionId) === inFlight) {
9751
+ inFlightExtensionRefreshes.delete(entry.sessionId);
9752
+ }
9753
+ }, "clear");
9754
+ void promise.then(clear, clear);
9755
+ }
9756
+ await Promise.race([
9757
+ withTimeout(
9758
+ inFlight.promise,
9759
+ 3e4,
9760
+ SERVE_CONTROL_EXT_METHODS.workspaceExtensionsRefresh
9761
+ ),
9762
+ getTransportClosedReject(entry)
9763
+ ]);
9764
+ }, "refreshSession");
9439
9765
  const results = await Promise.all(
9440
9766
  sessions.map(async (entry) => {
9441
9767
  const info = channelInfoForEntry(entry);
9442
9768
  if (!info || info.isDying) {
9443
- return { refreshed: 0, failed: 0 };
9769
+ return {
9770
+ refreshed: 0,
9771
+ failed: 0,
9772
+ entry,
9773
+ refreshBootstrap: false
9774
+ };
9444
9775
  }
9776
+ const refreshBootstrap = !bootstrapRefreshConnections.has(
9777
+ entry.connection
9778
+ );
9779
+ bootstrapRefreshConnections.add(entry.connection);
9445
9780
  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 };
9781
+ await refreshSession(entry, refreshBootstrap);
9782
+ return { refreshed: 1, failed: 0, entry, refreshBootstrap };
9472
9783
  } catch (err) {
9473
9784
  writeServeDebugLine(
9474
9785
  `refreshExtensions: session ${entry.sessionId} failed: ${err instanceof Error ? err.message : String(err)}`
9475
9786
  );
9476
- return { refreshed: 0, failed: 1 };
9787
+ return { refreshed: 0, failed: 1, entry, refreshBootstrap };
9788
+ }
9789
+ })
9790
+ );
9791
+ await Promise.all(
9792
+ results.filter((result) => result.failed > 0 && result.refreshBootstrap).map(async (failedBootstrap) => {
9793
+ const retry = results.find(
9794
+ (result) => result.refreshed > 0 && result.entry.connection === failedBootstrap.entry.connection
9795
+ );
9796
+ if (!retry) return;
9797
+ try {
9798
+ await refreshSession(retry.entry, true);
9799
+ } catch (err) {
9800
+ writeServeDebugLine(
9801
+ `refreshExtensions: bootstrap retry via session ${retry.entry.sessionId} failed: ${err instanceof Error ? err.message : String(err)}`
9802
+ );
9477
9803
  }
9478
9804
  })
9479
9805
  );
@@ -9910,7 +10236,24 @@ function createAcpSessionBridge(opts) {
9910
10236
  if (signal?.aborted) {
9911
10237
  return { exitCode: null, output: "", aborted: true };
9912
10238
  }
9913
- const cwd = entry.workspaceCwd;
10239
+ let abortResolve;
10240
+ const onAbort = /* @__PURE__ */ __name(() => abortResolve?.(), "onAbort");
10241
+ try {
10242
+ await Promise.race([
10243
+ entry.cwdChangeQueue,
10244
+ new Promise((resolve2) => {
10245
+ abortResolve = resolve2;
10246
+ if (signal?.aborted) return resolve2();
10247
+ signal?.addEventListener("abort", onAbort, { once: true });
10248
+ })
10249
+ ]);
10250
+ } finally {
10251
+ signal?.removeEventListener("abort", onAbort);
10252
+ }
10253
+ if (signal?.aborted) {
10254
+ return { exitCode: null, output: "", aborted: true };
10255
+ }
10256
+ const cwd = entry.effectiveCwd;
9914
10257
  entry.events.publish({
9915
10258
  type: "user_shell_command",
9916
10259
  data: { sessionId, command, cwd },
@@ -10398,6 +10741,22 @@ function createAcpSessionBridge(opts) {
10398
10741
  }
10399
10742
  return response;
10400
10743
  },
10744
+ async addSessionRuntimeMcpServer(sessionId, name, config, originatorClientId) {
10745
+ return requestSessionStatus(
10746
+ sessionId,
10747
+ SERVE_CONTROL_EXT_METHODS.sessionMcpRuntimeAdd,
10748
+ { name, config, originatorClientId },
10749
+ MCP_RESTART_SERVER_DEADLINE_MS
10750
+ );
10751
+ },
10752
+ async removeSessionRuntimeMcpServer(sessionId, name, originatorClientId) {
10753
+ return requestSessionStatus(
10754
+ sessionId,
10755
+ SERVE_CONTROL_EXT_METHODS.sessionMcpRuntimeRemove,
10756
+ { name, originatorClientId },
10757
+ MCP_RESTART_SERVER_DEADLINE_MS
10758
+ );
10759
+ },
10401
10760
  async killSession(sessionId, opts2) {
10402
10761
  const entry = byId.get(sessionId);
10403
10762
  if (!entry) return false;
@@ -10583,13 +10942,22 @@ function createAcpSessionBridge(opts) {
10583
10942
  () => void 0,
10584
10943
  () => void 0
10585
10944
  ) : Promise.resolve();
10586
- await Promise.all([
10587
- ...channels.map((ci) => ci.channel.kill().catch(() => {
10588
- })),
10945
+ const teardownResults = await Promise.allSettled([
10946
+ ...channels.map((ci) => ci.channel.kill()),
10589
10947
  ...inFlightSessionAwaits,
10590
10948
  ...inFlightRestoreAwaits,
10591
10949
  inFlightChannelAwait
10592
10950
  ]);
10951
+ const teardownFailures = teardownResults.flatMap(
10952
+ (result) => result.status === "rejected" ? [result.reason] : []
10953
+ );
10954
+ if (teardownFailures.length === 1) throw teardownFailures[0];
10955
+ if (teardownFailures.length > 1) {
10956
+ throw new AggregateError(
10957
+ teardownFailures,
10958
+ "ACP bridge shutdown failed"
10959
+ );
10960
+ }
10593
10961
  })().then(resolveShutdown, rejectShutdown);
10594
10962
  return shutdownPromise;
10595
10963
  },
@@ -10628,6 +10996,7 @@ var createHttpAcpBridge = createAcpSessionBridge;
10628
10996
  export {
10629
10997
  SessionArtifactValidationError,
10630
10998
  SessionArtifactAuthorizationError,
10999
+ SESSION_SOURCE_META_KEY,
10631
11000
  parseSessionSource,
10632
11001
  extractErrorMessage,
10633
11002
  extractErrorCode,