@qwen-code/qwen-code 0.20.1-preview.7215 → 0.20.2-gdpval-vl-agent.0

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 (327) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +1 -1
  2. package/bundled/qc-helper/docs/features/auto-mode.md +19 -16
  3. package/bundled/qc-helper/docs/features/commands.md +54 -0
  4. package/bundled/qc-helper/docs/features/sub-agents.md +16 -7
  5. package/bundled/qc-helper/docs/integration-github-action.md +1 -1
  6. package/bundled/qc-helper/docs/qwen-serve.md +2 -1
  7. package/bundled/review/DESIGN.md +2 -2
  8. package/bundled/review/SKILL.md +4 -4
  9. package/chunks/{MaxSizedBox-EH6G5AEH.js → MaxSizedBox-KYNG7EN7.js} +38 -35
  10. package/chunks/{StandaloneSessionPicker-264A3TEA.js → StandaloneSessionPicker-7XN4WVVG.js} +55 -52
  11. package/chunks/{acpAgent-6RBIJFDI.js → acpAgent-FTFFYP5G.js} +1536 -512
  12. package/chunks/{agent-QURXGAA3.js → agent-Y76LTTOT.js} +34 -31
  13. package/chunks/{agent-headless-CRGX4ICQ.js → agent-headless-IVAEQPK6.js} +34 -31
  14. package/chunks/{anthropicContentGenerator-BWBAZGTW.js → anthropicContentGenerator-HGWAHO24.js} +11 -13
  15. package/chunks/{artifact-tool-IUJ7QWCX.js → artifact-tool-56T5IMBP.js} +3 -3
  16. package/chunks/{askUserQuestion-IUMUUTDQ.js → askUserQuestion-E25OBIC2.js} +3 -3
  17. package/chunks/{bridge-MNFVKPMI.js → bridge-4M77KUEV.js} +39 -36
  18. package/chunks/{build-SSCNEHZZ.js → build-GHIZ4MSZ.js} +1 -1
  19. package/chunks/{ca-2SL2BXTK.js → ca-N6VVUFVB.js} +611 -201
  20. package/chunks/{channel-worker-group-53CMOPFT.js → channel-worker-group-QZV2SP5U.js} +4 -4
  21. package/chunks/{channel-worker-manager-UTXILKC2.js → channel-worker-manager-3GMAU45H.js} +4 -4
  22. package/chunks/{channel-worker-supervisor-ZGO2W2MD.js → channel-worker-supervisor-QCXSXCRY.js} +3 -3
  23. package/chunks/{chunk-UQES76OO.js → chunk-2HGTVAOW.js} +6 -6
  24. package/chunks/{chunk-2HOVDT7W.js → chunk-2LI23QA6.js} +1 -1
  25. package/chunks/{chunk-ANHT55MR.js → chunk-2P6CNEHB.js} +1 -1
  26. package/chunks/chunk-2RFKHEXL.js +74 -0
  27. package/chunks/{chunk-BF32GYSY.js → chunk-3IABAQR6.js} +1 -1
  28. package/chunks/chunk-3Z43GZUQ.js +32 -0
  29. package/chunks/chunk-43T5WDQ7.js +127 -0
  30. package/chunks/{chunk-DA7OOKVN.js → chunk-4CTP6VR6.js} +29 -2
  31. package/chunks/{chunk-JD3MKVKL.js → chunk-4K56OJFJ.js} +1 -1
  32. package/chunks/{chunk-KTUQMDEP.js → chunk-4K7VDKAD.js} +1 -1
  33. package/chunks/{chunk-QKYTTBYW.js → chunk-4LVZNIDO.js} +1 -1
  34. package/chunks/{chunk-ZEOZL37W.js → chunk-57FIIFJN.js} +1 -1
  35. package/chunks/{chunk-7YBZGNEC.js → chunk-5G3ZVADU.js} +308 -199
  36. package/chunks/{chunk-X4CGDBKA.js → chunk-6GEJX3LE.js} +3 -3
  37. package/chunks/{chunk-6GUTHAN7.js → chunk-6HOCJNO5.js} +1 -1
  38. package/chunks/{chunk-GMGDLUC7.js → chunk-6IL7KRLE.js} +1 -1
  39. package/chunks/chunk-6PVPNMXU.js +29 -0
  40. package/chunks/{chunk-BDBMYST4.js → chunk-6X4GWOPW.js} +1 -1
  41. package/chunks/{chunk-4ODB7WIB.js → chunk-6ZBPS62S.js} +1 -1
  42. package/chunks/{chunk-AYCDXHZB.js → chunk-7Z6JQEL6.js} +1 -1
  43. package/chunks/{chunk-WAX3ITOA.js → chunk-A3TAEAHX.js} +1 -1
  44. package/chunks/{chunk-OLMETXLX.js → chunk-ACW3VNUE.js} +2 -2
  45. package/chunks/{chunk-IB35C3IL.js → chunk-AVQ6EX4J.js} +1 -1
  46. package/chunks/{chunk-TTSKHF43.js → chunk-BK6UOUJ2.js} +2 -2
  47. package/chunks/{chunk-6OH6A5EX.js → chunk-BLAEKN6K.js} +20603 -17709
  48. package/chunks/chunk-BULDBTYC.js +153 -0
  49. package/chunks/{chunk-XNP57UDV.js → chunk-C3EXYVFX.js} +2 -2
  50. package/chunks/{chunk-FVS747N7.js → chunk-C54UTDOC.js} +23 -19
  51. package/chunks/{chunk-MAQQGNQ5.js → chunk-CBOQ3HY7.js} +466 -10
  52. package/chunks/{chunk-VFAE4AGH.js → chunk-CGZ5SV23.js} +72 -67
  53. package/chunks/{chunk-WKRXIHD6.js → chunk-COAARUPK.js} +8 -8
  54. package/chunks/{chunk-GA7VRJVN.js → chunk-E2ZK5M4P.js} +5 -5
  55. package/chunks/{chunk-5SCI6E3E.js → chunk-E4IMU4Y5.js} +1 -1
  56. package/chunks/{chunk-E5GIFWE3.js → chunk-EEFRJ5CT.js} +54 -33
  57. package/chunks/{chunk-WXAXH7IJ.js → chunk-ESQHGKPJ.js} +1 -1
  58. package/chunks/{chunk-NEEB7UEN.js → chunk-FFFM6NJV.js} +1 -2
  59. package/chunks/{chunk-Z5R4JMOL.js → chunk-FJ2IUWNQ.js} +4 -4
  60. package/chunks/{chunk-JVTCARQ6.js → chunk-FQI7LT7T.js} +4 -4
  61. package/chunks/{chunk-BRXIO5WY.js → chunk-FTNI3D7D.js} +7 -7
  62. package/chunks/{chunk-OMH3276Y.js → chunk-GHRSKGHF.js} +7 -7
  63. package/chunks/{chunk-OONJNQ42.js → chunk-GPSKDNEE.js} +3 -3
  64. package/chunks/{chunk-KPZNOZPC.js → chunk-GWM4PDYK.js} +19 -19
  65. package/chunks/{chunk-NBMIC7DR.js → chunk-H24SOJIQ.js} +2 -2
  66. package/chunks/{chunk-FNGK2Z5B.js → chunk-H4AR2JQF.js} +3 -3
  67. package/chunks/{chunk-WOT64EP2.js → chunk-HCJQORKC.js} +2 -2
  68. package/chunks/{chunk-7KDI2IB2.js → chunk-HDATOR4J.js} +4 -4
  69. package/chunks/{chunk-IE4JSQ5L.js → chunk-HIYP7IR4.js} +39 -37
  70. package/chunks/{chunk-N6YTEVLV.js → chunk-HL6AKUGD.js} +10 -4
  71. package/chunks/{chunk-BAIEQKR5.js → chunk-HPQFGWOD.js} +5 -5
  72. package/chunks/chunk-HTR4WV6U.js +327 -0
  73. package/chunks/{chunk-SDXIH6OA.js → chunk-IFUNDCQ6.js} +137 -5
  74. package/chunks/{chunk-Z6UEAQTP.js → chunk-IFVECEIK.js} +178 -61
  75. package/chunks/{chunk-QOK6RMIP.js → chunk-IKP54WUL.js} +4 -4
  76. package/chunks/{chunk-IUSNI6IX.js → chunk-ISMD2AB3.js} +1 -1
  77. package/chunks/{chunk-G45X5TRN.js → chunk-JCW2R7WC.js} +1 -72
  78. package/chunks/{chunk-LZYWWWCZ.js → chunk-KF6CTNTJ.js} +8 -9
  79. package/chunks/{chunk-EIAK6Q2B.js → chunk-KHOVYUHX.js} +2 -2
  80. package/chunks/chunk-KWK7UE6L.js +6194 -0
  81. package/chunks/{chunk-WBTZGWQ6.js → chunk-L5F3T6TQ.js} +1 -1
  82. package/chunks/{chunk-RELYEO3R.js → chunk-L7ASZD66.js} +244 -1607
  83. package/chunks/{chunk-UJEZQ562.js → chunk-LESHKUWF.js} +3 -5
  84. package/chunks/{chunk-OOCI5VVU.js → chunk-LIZRAKPB.js} +1 -1
  85. package/chunks/{chunk-Q3ZBFXK4.js → chunk-LKB5YL5T.js} +143 -36
  86. package/chunks/{chunk-MKLKHZAK.js → chunk-LU3RXCM7.js} +1 -1
  87. package/chunks/{chunk-B453NMZJ.js → chunk-M3EQ3GZC.js} +3 -3
  88. package/chunks/{chunk-TCKTNY66.js → chunk-M4VFMLQK.js} +6 -6
  89. package/chunks/{chunk-26LLB6FM.js → chunk-MDZTPSXO.js} +2 -2
  90. package/chunks/{chunk-4SLLEAQP.js → chunk-MJPBB2GK.js} +591 -316
  91. package/chunks/chunk-NABLFI57.js +82 -0
  92. package/chunks/{chunk-T7DDD7CZ.js → chunk-NAXEEGJU.js} +4 -4
  93. package/chunks/{chunk-467G3SV5.js → chunk-NPQDJGKU.js} +1 -1
  94. package/chunks/{chunk-FLTN6NRU.js → chunk-O4OT3DM3.js} +5 -1
  95. package/chunks/{chunk-3EUZWNWA.js → chunk-OPDZT2VG.js} +1 -1
  96. package/chunks/chunk-OQ5SYCPE.js +10017 -0
  97. package/chunks/{chunk-C27BYUX6.js → chunk-OQB4EXO4.js} +14 -11
  98. package/chunks/{chunk-V25Z5UUB.js → chunk-P6PBZL3N.js} +7 -6
  99. package/chunks/{chunk-5NWV4NFB.js → chunk-PRAUGUNM.js} +3 -3
  100. package/chunks/{chunk-MC2DOZS7.js → chunk-PVT6E3ZI.js} +3 -3
  101. package/chunks/{chunk-KXEGCGUG.js → chunk-Q22WWVR6.js} +31 -6
  102. package/chunks/{chunk-JDI67JFB.js → chunk-Q2YKNMLS.js} +3 -3
  103. package/chunks/{chunk-PBATSWUQ.js → chunk-QBUDF33N.js} +1 -1
  104. package/chunks/{chunk-Y2ENGUD6.js → chunk-QKTHJXCS.js} +1 -1
  105. package/chunks/{chunk-BVLROR2T.js → chunk-QLJUC7TG.js} +1 -1
  106. package/chunks/{chunk-UEY4AYUL.js → chunk-QNLNLENL.js} +2 -2
  107. package/chunks/{chunk-OKWRU4NO.js → chunk-RC7A7SSL.js} +3 -3
  108. package/chunks/chunk-RCUEYZDE.js +2290 -0
  109. package/chunks/{chunk-EVSTCA7S.js → chunk-RMY5SX7S.js} +368 -113
  110. package/chunks/{chunk-4WUAQ2DO.js → chunk-RTQSXHS7.js} +2 -2
  111. package/chunks/{chunk-RFIAR4YL.js → chunk-RV4C2ZFG.js} +1 -1
  112. package/chunks/{chunk-NIJEXGV6.js → chunk-RVLZCXEE.js} +79 -10
  113. package/chunks/{chunk-Q4RBU7WX.js → chunk-S333CBIA.js} +6 -6
  114. package/chunks/{chunk-JNWZQ27S.js → chunk-SP5WRGVG.js} +3 -3
  115. package/chunks/{chunk-FSL5W5TI.js → chunk-T2L47JJK.js} +3 -3
  116. package/chunks/{chunk-PWVTCGBP.js → chunk-TA4S377U.js} +30 -20
  117. package/chunks/{chunk-TB6UDU4T.js → chunk-THJNPLI4.js} +16 -16
  118. package/chunks/chunk-U6TQGUNB.js +20687 -0
  119. package/chunks/chunk-U7ZFW55U.js +2098 -0
  120. package/chunks/{chunk-W7H223ZZ.js → chunk-UGYMA4EI.js} +1 -1
  121. package/chunks/{chunk-X6YQWCIJ.js → chunk-UH3WSE5L.js} +13 -1
  122. package/chunks/{chunk-P2YAOGJD.js → chunk-UKU3NGW6.js} +3 -3
  123. package/chunks/{chunk-NOWTNYC7.js → chunk-UVFCANV5.js} +8 -8
  124. package/chunks/{chunk-CVDW42JT.js → chunk-V4AKJQ26.js} +1 -1
  125. package/chunks/{chunk-Z5Q65RVH.js → chunk-VJPRLNLR.js} +1 -1
  126. package/chunks/{chunk-Y4CRUWFZ.js → chunk-VTXX72XS.js} +60 -35
  127. package/chunks/{chunk-R3VWUU2E.js → chunk-VYPFXUCB.js} +1 -1
  128. package/chunks/chunk-WHGVTP7Q.js +1049 -0
  129. package/chunks/{chunk-IKP5DXZY.js → chunk-WOWQQGGN.js} +5 -5
  130. package/chunks/{chunk-D2VIDMVM.js → chunk-X6N25LXS.js} +2 -2
  131. package/chunks/chunk-XHATNRQA.js +1500 -0
  132. package/chunks/{chunk-2DXOIVUI.js → chunk-YLSB23Y2.js} +11 -11
  133. package/chunks/{chunk-S35ZDXOS.js → chunk-YM3SZTH4.js} +2 -1
  134. package/chunks/{chunk-OF2BBLYQ.js → chunk-YNWJAOPL.js} +2 -2
  135. package/chunks/{chunk-GKY2OJ7R.js → chunk-ZHERRXZJ.js} +1 -1
  136. package/chunks/{chunk-AR27OPIU.js → chunk-ZKFJKN23.js} +2 -2
  137. package/chunks/{computer-use-R7KA6UJ6.js → computer-use-UKQBH7UM.js} +39 -36
  138. package/chunks/{config-utils-6FXFJUYB.js → config-utils-FYTBZLCJ.js} +3 -3
  139. package/chunks/{contextCommand-KAQQPHZ4.js → contextCommand-ESHGAVWX.js} +36 -33
  140. package/chunks/{create-sub-session-TDPDBU4K.js → create-sub-session-574EPZUU.js} +34 -31
  141. package/chunks/{create-sub-session-X5RVIHCK.js → create-sub-session-AZ77LBL3.js} +3 -3
  142. package/chunks/{cron-create-AC5FFLN7.js → cron-create-KTWJM7QT.js} +5 -5
  143. package/chunks/{cron-delete-JEB3FAHA.js → cron-delete-2P3I5ULL.js} +5 -5
  144. package/chunks/{cron-list-NBYPCNIB.js → cron-list-PXDPGEDQ.js} +5 -5
  145. package/chunks/{daemon-RG2MAI6T.js → daemon-GJRFILYS.js} +323 -99
  146. package/chunks/daemon-status-provider-GZXZP3NU.js +80 -0
  147. package/chunks/{de-I7ZIYXZC.js → de-4IBXM7CN.js} +5 -1
  148. package/chunks/{dist-AU7NQQRP.js → dist-OAV7LJGJ.js} +1 -1
  149. package/chunks/{dist-FUTEXY6A.js → dist-OMW6WDEO.js} +1 -1
  150. package/chunks/{dist-2MIU4UUH.js → dist-PJLG2XYX.js} +1 -1
  151. package/chunks/{dist-53PZYC5B.js → dist-UIFWIFRO.js} +2 -2
  152. package/chunks/{dist-2BHAYBKP.js → dist-XBJVSWS2.js} +1 -1
  153. package/chunks/{dist-WGTQO7F2.js → dist-XRYV6TJP.js} +65 -25
  154. package/chunks/{earlyInputCapture-WC7RI5HV.js → earlyInputCapture-GI3HGQIT.js} +35 -32
  155. package/chunks/{edit-6MHKCJCM.js → edit-EBJK74B3.js} +42 -41
  156. package/chunks/{en-XE34GKAA.js → en-USMCCJAJ.js} +5 -1
  157. package/chunks/{enter-worktree-O7VJ2E7A.js → enter-worktree-2ETY5CSV.js} +39 -36
  158. package/chunks/{enterPlanMode-5XYAALIO.js → enterPlanMode-NY4U2727.js} +45 -37
  159. package/chunks/{environment-LSKFNLBU.js → environment-33IR3NOU.js} +36 -33
  160. package/chunks/{errors-ZFVCY6HG.js → errors-2OCY23IC.js} +36 -33
  161. package/chunks/{exit-worktree-MYIK66T7.js → exit-worktree-Y4ULJ45U.js} +39 -36
  162. package/chunks/{exitPlanMode-7MBNU76O.js → exitPlanMode-SECI2EQ6.js} +39 -36
  163. package/chunks/{fast-path-RNLIB64C.js → fast-path-6Z7RW5J5.js} +3 -2
  164. package/chunks/{fr-X7KDVZIY.js → fr-WVHEBDDB.js} +5 -1
  165. package/chunks/{gemini-WK5ISEAQ.js → gemini-XLGLUGSU.js} +93 -89
  166. package/chunks/{geminiContentGenerator-NUJQBZBW.js → geminiContentGenerator-NNZZDH24.js} +5 -5
  167. package/chunks/{getMachineId-bsd-EXV7SWPA.js → getMachineId-bsd-QFVLPUPT.js} +1 -1
  168. package/chunks/{getMachineId-darwin-IUOMFXU3.js → getMachineId-darwin-DGMQQE2E.js} +1 -1
  169. package/chunks/{getMachineId-linux-K7XJYFHL.js → getMachineId-linux-R4Z6CSWC.js} +1 -1
  170. package/chunks/{getMachineId-unsupported-EA5FDRJ6.js → getMachineId-unsupported-Z3SBVBUV.js} +1 -1
  171. package/chunks/{getMachineId-win-KBA6RAI5.js → getMachineId-win-SCK5UFDT.js} +1 -1
  172. package/chunks/{glob-7P6RYY4L.js → glob-KZA64SSV.js} +41 -38
  173. package/chunks/{grep-V3QHNP2J.js → grep-ONHQMY3V.js} +41 -38
  174. package/chunks/handleAutoUpdate-PRTJISXQ.js +73 -0
  175. package/chunks/{i18n-B7IO7WQT.js → i18n-ZTKKG5R5.js} +35 -32
  176. package/chunks/{initializer-E5TIC3CW.js → initializer-FPPZGBYN.js} +40 -37
  177. package/chunks/{installationInfo-XLPNAISK.js → installationInfo-DV2C27HT.js} +37 -32
  178. package/chunks/{ja-2ICT3KXF.js → ja-KY4ROZTE.js} +5 -1
  179. package/chunks/{keychain-token-storage-DWRJMNH3.js → keychain-token-storage-6ACJDYIB.js} +3 -3
  180. package/chunks/{list-3CZR5I42.js → list-KEHCNUAK.js} +42 -39
  181. package/chunks/{loadedSettingsAdapter-X5BSC6CE.js → loadedSettingsAdapter-7RZ6M3WH.js} +39 -36
  182. package/chunks/{loop-wakeup-HMHCT5GU.js → loop-wakeup-RNMRVA66.js} +6 -6
  183. package/chunks/{ls-IW5HYDG4.js → ls-J2ZI5XYK.js} +5 -5
  184. package/chunks/{lsp-4RL52YIZ.js → lsp-UMS3NUB5.js} +3 -3
  185. package/chunks/managed-npm-update-EBKNOG37.js +332 -0
  186. package/chunks/{mcp-4C4HWXAR.js → mcp-NHXKZRRP.js} +39 -36
  187. package/chunks/{monitor-3CJDNZB2.js → monitor-FMUAIFFH.js} +39 -36
  188. package/chunks/nonInteractiveCli-I2GPZNTP.js +132 -0
  189. package/chunks/{notebook-edit-MX366HCT.js → notebook-edit-V7RNXKVL.js} +43 -42
  190. package/chunks/{openaiContentGenerator-KRPNNJGZ.js → openaiContentGenerator-IBVUUZDH.js} +19 -18
  191. package/chunks/{pidfile-K7T2JLUJ.js → pidfile-AMTGL2H2.js} +35 -32
  192. package/chunks/{processUtils-YXL3VIBR.js → processUtils-3ZT2JF6D.js} +2 -2
  193. package/chunks/{pt-JJ4XPIBP.js → pt-OK455PLH.js} +5 -1
  194. package/chunks/{qwenContentGenerator-GJVXFZ3U.js → qwenContentGenerator-E72VVWS3.js} +41 -38
  195. package/chunks/{qwenOAuth2-UZTIBQLY.js → qwenOAuth2-YCC3HP24.js} +17 -16
  196. package/chunks/{read-file-S5XQSYOW.js → read-file-5EWNGUXN.js} +13 -11
  197. package/chunks/{read-mcp-resource-OIBCNIX7.js → read-mcp-resource-F6HYMDUY.js} +3 -3
  198. package/chunks/{record-artifact-HDMK4LHG.js → record-artifact-7GCFLDD7.js} +3 -3
  199. package/chunks/{resumeHistoryUtils-IKR6XD2S.js → resumeHistoryUtils-IH4RNB76.js} +41 -38
  200. package/chunks/{ripGrep-H65GRSQX.js → ripGrep-B6A6N7GI.js} +34 -31
  201. package/chunks/{ru-STR4KTW7.js → ru-7SPDGMGD.js} +5 -1
  202. package/chunks/{run-qwen-serve-7SKAQOAA.js → run-qwen-serve-6PKSMF6Z.js} +115 -74
  203. package/chunks/{runtime-I2STBGPR.js → runtime-ASRANXO6.js} +45 -40
  204. package/chunks/{scheduler-6F7HETNO.js → scheduler-IABM76UZ.js} +34 -31
  205. package/chunks/sdk-exporters-grpc-ETLH47EP.js +23214 -0
  206. package/chunks/sdk-exporters-http-6MCQH335.js +563 -0
  207. package/chunks/sdk-impl-HOLWAXC6.js +9193 -0
  208. package/chunks/{send-message-WXVVK4DB.js → send-message-KBO6X4ZS.js} +7 -5
  209. package/chunks/{serve-4ATEWSEA.js → serve-A4DT5D32.js} +39 -36
  210. package/chunks/{server-YPUPFV2O.js → server-DZ5ZSVRE.js} +2317 -472
  211. package/chunks/{session-AZFIERIY.js → session-G2R3CYU6.js} +87 -172
  212. package/chunks/{settings-EFQHLTM3.js → settings-7TNSXUTO.js} +43 -40
  213. package/chunks/{shell-FWXWBJ4Q.js → shell-5BRFGEMK.js} +34 -31
  214. package/chunks/{skill-A634MNCD.js → skill-3SWYEK7M.js} +24 -20
  215. package/chunks/{spawnChannel-KKBGGR47.js → spawnChannel-GGN2WVWW.js} +36 -33
  216. package/chunks/{src-BVROLD6N.js → src-5BPBNQ5S.js} +314 -236
  217. package/chunks/{standalone-update-ERLA3BDC.js → standalone-update-AHOZ56LS.js} +37 -34
  218. package/chunks/{startInteractiveUI-3VZ23WAY.js → startInteractiveUI-TLGOQVV7.js} +1105 -906
  219. package/chunks/{syntheticOutput-HCUFXSIA.js → syntheticOutput-H7RTI5KL.js} +4 -4
  220. package/chunks/{task-create-RIY5JTFC.js → task-create-7474AJJD.js} +10 -8
  221. package/chunks/{task-list-XBUCV3CO.js → task-list-633HGOIB.js} +6 -6
  222. package/chunks/{task-stop-QDFCCYR5.js → task-stop-MNUGHPIA.js} +3 -3
  223. package/chunks/{task-update-7PXKJQOI.js → task-update-66GQB5LI.js} +10 -8
  224. package/chunks/{team-create-ZZO7QFQ7.js → team-create-XHDF7UKM.js} +42 -39
  225. package/chunks/{team-delete-TNSSE2S5.js → team-delete-BB3CG3QF.js} +6 -6
  226. package/chunks/{team-plan-approval-3BZBJ46K.js → team-plan-approval-XKSBXWMH.js} +39 -36
  227. package/chunks/{theme-manager-FSFWNXFJ.js → theme-manager-6ZKLBFAN.js} +35 -32
  228. package/chunks/{todoWrite-OMAIGB6V.js → todoWrite-KRAUN54W.js} +5 -5
  229. package/chunks/{tool-search-VYXAAIDW.js → tool-search-UDNJCXYS.js} +21 -17
  230. package/chunks/{total-session-admission-PSMLQICS.js → total-session-admission-VWRCCDYM.js} +40 -37
  231. package/chunks/{tree-sitter-4D7QS7F6.js → tree-sitter-L5BFT64K.js} +1 -1
  232. package/chunks/{tree-sitter-bash-VEJGF5XF.js → tree-sitter-bash-ZKDNQGID.js} +1 -1
  233. package/chunks/{trustedFolders-QA3RK2NV.js → trustedFolders-TJI6OLAN.js} +35 -32
  234. package/chunks/{chunk-6EFTQYW7.js → undici-3FJYTMOF.js} +24 -399
  235. package/chunks/{chunk-L573Z2QZ.js → undici-PYHBDDPN.js} +1 -5
  236. package/chunks/{update-relaunch-LNLZFX3J.js → update-relaunch-RS5GB74A.js} +17 -17
  237. package/chunks/updateCheck-T4EEA5YR.js +88 -0
  238. package/chunks/{useAutoAcceptIndicator-DIWN27LT.js → useAutoAcceptIndicator-LLWMXC7F.js} +44 -41
  239. package/chunks/{validateNonInterActiveAuth-LOEOFCAF.js → validateNonInterActiveAuth-OJ3KYXAR.js} +74 -71
  240. package/chunks/{version-HBF2VBLE.js → version-ZCEUV5DO.js} +1 -1
  241. package/chunks/{web-fetch-BWGSD2BD.js → web-fetch-KQF4YFCI.js} +99 -42
  242. package/chunks/{web-search-OOHTCVR3.js → web-search-QDDGFGKI.js} +113 -61
  243. package/chunks/{workflow-LJAJBOR4.js → workflow-GIRKCX4P.js} +47 -43
  244. package/chunks/{workspace-providers-status-FYV7TTHA.js → workspace-providers-status-UTMAVTNE.js} +42 -39
  245. package/chunks/{workspace-registration-store-4EHGQW4Y.js → workspace-registration-store-EYJMJFZU.js} +8 -2
  246. package/chunks/{workspace-registry-BKD7VC4Y.js → workspace-registry-4W4UW6MY.js} +40 -37
  247. package/chunks/{workspace-service-75RHX6KR.js → workspace-service-DJCPY6ZN.js} +46 -43
  248. package/chunks/{workspace-skills-status-WBZBZI6A.js → workspace-skills-status-VQ2LKXXX.js} +40 -37
  249. package/chunks/write-file-PLK6RQ7M.js +65 -0
  250. package/chunks/{zh-TW-4RR3YHNN.js → zh-TW-BM47YBFH.js} +5 -1
  251. package/chunks/{zh-6ANG2HTL.js → zh-WY5DWYZD.js} +5 -1
  252. package/cli-entry.js +164 -12
  253. package/cli.js +18 -11
  254. package/locales/ca.js +772 -203
  255. package/locales/de.js +8 -2
  256. package/locales/en.js +8 -2
  257. package/locales/fr.js +8 -2
  258. package/locales/ja.js +8 -2
  259. package/locales/pt.js +8 -2
  260. package/locales/ru.js +8 -2
  261. package/locales/zh-TW.js +8 -2
  262. package/locales/zh.js +8 -2
  263. package/package.json +3 -3
  264. package/web-shell/assets/{arc-Buk1besA.js → arc-DIQrcXXh.js} +1 -1
  265. package/web-shell/assets/{architectureDiagram-3BPJPVTR-B1aUKYDC.js → architectureDiagram-3BPJPVTR-CbPd-DSw.js} +1 -1
  266. package/web-shell/assets/{blockDiagram-GPEHLZMM-CRTdg3Zx.js → blockDiagram-GPEHLZMM-yzBIVhMX.js} +1 -1
  267. package/web-shell/assets/{c4Diagram-AAUBKEIU-DFdRMp5g.js → c4Diagram-AAUBKEIU-B88Swcsu.js} +1 -1
  268. package/web-shell/assets/channel-BaTMUesZ.js +1 -0
  269. package/web-shell/assets/{chunk-2J33WTMH-4rYQdkEI.js → chunk-2J33WTMH-BbOLo6NX.js} +1 -1
  270. package/web-shell/assets/{chunk-4BX2VUAB-Coi-pQJy.js → chunk-4BX2VUAB-Bg6in0r0.js} +1 -1
  271. package/web-shell/assets/{chunk-55IACEB6-BtBjz02t.js → chunk-55IACEB6-Bv9QRyLI.js} +1 -1
  272. package/web-shell/assets/{chunk-727SXJPM-CGYOWorl.js → chunk-727SXJPM-CFokiv61.js} +1 -1
  273. package/web-shell/assets/{chunk-AQP2D5EJ-CH5AKhqx.js → chunk-AQP2D5EJ-DS2Oxf6L.js} +1 -1
  274. package/web-shell/assets/{chunk-FMBD7UC4-Cd50-w85.js → chunk-FMBD7UC4-D2NkHD3B.js} +1 -1
  275. package/web-shell/assets/{chunk-ND2GUHAM-C2wF3KCK.js → chunk-ND2GUHAM-BsT_UC5B.js} +1 -1
  276. package/web-shell/assets/{chunk-QZHKN3VN-pCeRTaWi.js → chunk-QZHKN3VN-tnJo3zln.js} +1 -1
  277. package/web-shell/assets/classDiagram-4FO5ZUOK-CyBPzWud.js +1 -0
  278. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CyBPzWud.js +1 -0
  279. package/web-shell/assets/{cose-bilkent-S5V4N54A-B-_fAB6D.js → cose-bilkent-S5V4N54A-BTMa6DAZ.js} +1 -1
  280. package/web-shell/assets/{dagre-BM42HDAG-ChSPNHpL.js → dagre-BM42HDAG-ujGX7Owg.js} +1 -1
  281. package/web-shell/assets/{diagram-2AECGRRQ-BX7cFOF3.js → diagram-2AECGRRQ-fU4-dbPa.js} +1 -1
  282. package/web-shell/assets/{diagram-5GNKFQAL-BQUTW92n.js → diagram-5GNKFQAL-Bdm-TYSA.js} +1 -1
  283. package/web-shell/assets/{diagram-KO2AKTUF-BkYPh3e4.js → diagram-KO2AKTUF-Bkhz85Z9.js} +1 -1
  284. package/web-shell/assets/{diagram-LMA3HP47-Cl6jsNyx.js → diagram-LMA3HP47-Bzu3q26p.js} +1 -1
  285. package/web-shell/assets/{diagram-OG6HWLK6-DRWoHz8n.js → diagram-OG6HWLK6-CZrXbG5Q.js} +1 -1
  286. package/web-shell/assets/{erDiagram-TEJ5UH35-CGvFcZco.js → erDiagram-TEJ5UH35-BjozEAYu.js} +1 -1
  287. package/web-shell/assets/{flowDiagram-I6XJVG4X-vms6oVdv.js → flowDiagram-I6XJVG4X-B3a2I8c-.js} +1 -1
  288. package/web-shell/assets/{ganttDiagram-6RSMTGT7-ukT_sfmi.js → ganttDiagram-6RSMTGT7-CIMn9fNm.js} +1 -1
  289. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-Bn2ZE2Ut.js → gitGraphDiagram-PVQCEYII-DlFy9KRx.js} +1 -1
  290. package/web-shell/assets/{index-wFXp7W68.js → index-BODUAzQA.js} +1 -1
  291. package/web-shell/assets/index-C54DNMF7.js +1209 -0
  292. package/web-shell/assets/index-lWqBfc78.css +5 -0
  293. package/web-shell/assets/{infoDiagram-5YYISTIA-DHJdSi7x.js → infoDiagram-5YYISTIA-BmKjQgCy.js} +1 -1
  294. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-DOvd2Wph.js → ishikawaDiagram-YF4QCWOH-BrQEMZz2.js} +1 -1
  295. package/web-shell/assets/{journeyDiagram-JHISSGLW-CH_urMCT.js → journeyDiagram-JHISSGLW-D-2r7Xrt.js} +1 -1
  296. package/web-shell/assets/{kanban-definition-UN3LZRKU-FKiBdgbH.js → kanban-definition-UN3LZRKU-CndsFHCX.js} +1 -1
  297. package/web-shell/assets/{linear-0ZVQFVKf.js → linear-D-IwNnKx.js} +1 -1
  298. package/web-shell/assets/{mermaid.core-DJ05ZZIK.js → mermaid.core-4ll09sri.js} +5 -5
  299. package/web-shell/assets/{mindmap-definition-RKZ34NQL-BPuUhkUm.js → mindmap-definition-RKZ34NQL-maMRIxjo.js} +1 -1
  300. package/web-shell/assets/{pieDiagram-4H26LBE5-yLFKcXyG.js → pieDiagram-4H26LBE5-aunUDhrJ.js} +1 -1
  301. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-irWqc1pE.js → quadrantDiagram-W4KKPZXB-D3K0P1NZ.js} +1 -1
  302. package/web-shell/assets/{requirementDiagram-4Y6WPE33-B_4uMoIV.js → requirementDiagram-4Y6WPE33-CX2X9HRc.js} +1 -1
  303. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-ciA4GPwk.js → sankeyDiagram-5OEKKPKP-CDroWk7l.js} +1 -1
  304. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-CRdZvy0U.js → sequenceDiagram-3UESZ5HK-DTk-2b16.js} +1 -1
  305. package/web-shell/assets/{stateDiagram-AJRCARHV-DaYIkCCn.js → stateDiagram-AJRCARHV-Cud64hQr.js} +1 -1
  306. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-g-uUpecT.js +1 -0
  307. package/web-shell/assets/{timeline-definition-PNZ67QCA-oBUKv6iH.js → timeline-definition-PNZ67QCA-DfD5okf_.js} +1 -1
  308. package/web-shell/assets/{vennDiagram-CIIHVFJN-CGW9Sdmb.js → vennDiagram-CIIHVFJN-BYl8ay25.js} +1 -1
  309. package/web-shell/assets/{wardley-L42UT6IY-CvwKJOCm.js → wardley-L42UT6IY-BZFAt10J.js} +1 -1
  310. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-Ipc260sN.js → wardleyDiagram-YWT4CUSO-BIWn0GA7.js} +1 -1
  311. package/web-shell/assets/{xychartDiagram-2RQKCTM6-D6-CM7pK.js → xychartDiagram-2RQKCTM6-1_H4xblT.js} +1 -1
  312. package/web-shell/index.html +2 -2
  313. package/chunks/chunk-ETD6K42I.js +0 -358
  314. package/chunks/chunk-I5NLVPZJ.js +0 -45
  315. package/chunks/chunk-ONWW74X6.js +0 -74639
  316. package/chunks/chunk-W7FJ3N32.js +0 -49
  317. package/chunks/daemon-status-provider-LVTVJGAD.js +0 -77
  318. package/chunks/handleAutoUpdate-AAQ6PL3E.js +0 -70
  319. package/chunks/nonInteractiveCli-QTEHDDFH.js +0 -129
  320. package/chunks/updateCheck-JJEUQ54U.js +0 -73
  321. package/chunks/write-file-M2DTFILF.js +0 -599
  322. package/web-shell/assets/channel-04R0vLbG.js +0 -1
  323. package/web-shell/assets/classDiagram-4FO5ZUOK-Bw9SOwAV.js +0 -1
  324. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-Bw9SOwAV.js +0 -1
  325. package/web-shell/assets/index-DgkKrjw3.js +0 -1187
  326. package/web-shell/assets/index-Rv6mOAN9.css +0 -5
  327. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DWBoO4UY.js +0 -1
@@ -20,9 +20,6 @@ import {
20
20
  MID_TURN_QUEUE_DRAIN_METHOD,
21
21
  TODO_STOP_GUARD_QUEUE_RELEASE_METHOD
22
22
  } from "./chunk-QR6U5QPP.js";
23
- import {
24
- defaultSpawnChannelFactory
25
- } from "./chunk-6GUTHAN7.js";
26
23
  import {
27
24
  BranchWhilePromptActiveError,
28
25
  CancelSentinelCollisionError,
@@ -34,6 +31,7 @@ import {
34
31
  InvalidSessionScopeError,
35
32
  MCP_RESTART_SERVER_DEADLINE_MS,
36
33
  PermissionForbiddenError,
34
+ PromptDeadlineExceededError,
37
35
  PromptQueueFullError,
38
36
  RestoreInProgressError,
39
37
  SessionBusyError,
@@ -43,7 +41,10 @@ import {
43
41
  SessionShellDisabledError,
44
42
  WorkspaceMismatchError,
45
43
  isNotCurrentlyGeneratingCancelError
46
- } from "./chunk-X6YQWCIJ.js";
44
+ } from "./chunk-UH3WSE5L.js";
45
+ import {
46
+ defaultSpawnChannelFactory
47
+ } from "./chunk-6HOCJNO5.js";
47
48
  import {
48
49
  BridgeChannelClosedError,
49
50
  BridgeTimeoutError,
@@ -52,10 +53,11 @@ import {
52
53
  STATUS_SCHEMA_VERSION,
53
54
  createIdleWorkspaceExtensionsStatus,
54
55
  createIdleWorkspaceHooksStatus
55
- } from "./chunk-WXAXH7IJ.js";
56
+ } from "./chunk-ESQHGKPJ.js";
56
57
  import {
57
- canonicalizeWorkspace
58
- } from "./chunk-W7FJ3N32.js";
58
+ canonicalizeWorkspace,
59
+ translateAndCheckAbsoluteWorkspacePath
60
+ } from "./chunk-2RFKHEXL.js";
59
61
  import {
60
62
  ClientSideConnection,
61
63
  PROTOCOL_VERSION,
@@ -72,11 +74,11 @@ import {
72
74
  metadataBudgetBytes,
73
75
  normalizeSnapshotPayload,
74
76
  stableSessionArtifactId
75
- } from "./chunk-6OH6A5EX.js";
77
+ } from "./chunk-BLAEKN6K.js";
76
78
  import {
77
79
  DAEMON_TRACEPARENT_META_KEY,
78
80
  DAEMON_TRACESTATE_META_KEY
79
- } from "./chunk-ONWW74X6.js";
81
+ } from "./chunk-U6TQGUNB.js";
80
82
  import {
81
83
  init_esbuild_shims
82
84
  } from "./chunk-5O2XNYP6.js";
@@ -5040,6 +5042,12 @@ function isRecord3(value) {
5040
5042
  return typeof value === "object" && value !== null && !Array.isArray(value);
5041
5043
  }
5042
5044
  __name(isRecord3, "isRecord");
5045
+ function isDefinitiveAcpRequestError(error) {
5046
+ if (error instanceof RequestError) return true;
5047
+ if (!isRecord3(error)) return false;
5048
+ return typeof error["code"] === "number" && Number.isInteger(error["code"]) && typeof error["message"] === "string";
5049
+ }
5050
+ __name(isDefinitiveAcpRequestError, "isDefinitiveAcpRequestError");
5043
5051
  function getCanonicalModelId(response, fallback) {
5044
5052
  if (!isRecord3(response) || !isRecord3(response["_meta"])) return fallback;
5045
5053
  const modelSwitch = response["_meta"]["qwenModelSwitch"];
@@ -5399,6 +5407,57 @@ function broadcastTurnError(entry, sessionId, err, promptId, originatorClientId)
5399
5407
  }
5400
5408
  }
5401
5409
  __name(broadcastTurnError, "broadcastTurnError");
5410
+ function publishPromptTerminal(entry, pendingEntry, terminal) {
5411
+ if (pendingEntry.terminalPublished) {
5412
+ writeStderrLine(
5413
+ `publishPromptTerminal: suppressed duplicate ${terminal.kind} terminal for prompt ${pendingEntry.promptId} (session ${entry.sessionId})`
5414
+ );
5415
+ return;
5416
+ }
5417
+ pendingEntry.terminalPublished = true;
5418
+ const originatorClientId = pendingEntry.originatorClientId;
5419
+ if (terminal.kind === "complete") {
5420
+ broadcastTurnComplete(
5421
+ entry,
5422
+ entry.sessionId,
5423
+ terminal.result,
5424
+ pendingEntry.promptId,
5425
+ originatorClientId
5426
+ );
5427
+ } else if (terminal.kind === "cancelled") {
5428
+ broadcastTurnComplete(
5429
+ entry,
5430
+ entry.sessionId,
5431
+ { stopReason: "cancelled" },
5432
+ pendingEntry.promptId,
5433
+ originatorClientId
5434
+ );
5435
+ } else {
5436
+ broadcastTurnError(
5437
+ entry,
5438
+ entry.sessionId,
5439
+ terminal.err,
5440
+ pendingEntry.promptId,
5441
+ originatorClientId
5442
+ );
5443
+ }
5444
+ }
5445
+ __name(publishPromptTerminal, "publishPromptTerminal");
5446
+ function flushPromptTerminals(entry, code, message) {
5447
+ for (const pending of [...entry.pendingPromptList]) {
5448
+ publishPromptTerminal(entry, pending, {
5449
+ kind: "error",
5450
+ err: { code, message }
5451
+ });
5452
+ try {
5453
+ pending.abortController.abort(
5454
+ new DOMException("Prompt aborted", "AbortError")
5455
+ );
5456
+ } catch {
5457
+ }
5458
+ }
5459
+ }
5460
+ __name(flushPromptTerminals, "flushPromptTerminals");
5402
5461
  function hasControlCharacter2(value) {
5403
5462
  for (let i = 0; i < value.length; i += 1) {
5404
5463
  const code = value.charCodeAt(i);
@@ -5558,6 +5617,18 @@ function createAcpSessionBridge(opts) {
5558
5617
  lastActivityTimestamp = Date.now();
5559
5618
  }
5560
5619
  __name(touchActivity, "touchActivity");
5620
+ function settleActivePromptState(entry, promptId) {
5621
+ if (entry.activePromptId !== promptId) return;
5622
+ delete entry.activePromptId;
5623
+ delete entry.activePromptOriginatorClientId;
5624
+ if (entry.promptActive) {
5625
+ entry.promptActive = false;
5626
+ activePromptCounter--;
5627
+ entry.sessionLastSeenAt = Date.now();
5628
+ touchActivity();
5629
+ }
5630
+ }
5631
+ __name(settleActivePromptState, "settleActivePromptState");
5561
5632
  function resolvePositiveFiniteMs(raw, fallback) {
5562
5633
  if (raw === void 0) return fallback;
5563
5634
  return raw > 0 && Number.isFinite(raw) ? Math.min(raw, 2147483647) : 0;
@@ -5674,7 +5745,7 @@ function createAcpSessionBridge(opts) {
5674
5745
  if (shuttingDown) return;
5675
5746
  const now = Date.now();
5676
5747
  for (const [id, entry] of byId) {
5677
- if (entry.promptActive) continue;
5748
+ if (entry.pendingPromptCount > 0) continue;
5678
5749
  if (entry.events.subscriberCount > 0) continue;
5679
5750
  const lastActive = entry.sessionLastSeenAt ?? Date.parse(entry.createdAt);
5680
5751
  const idle = now - lastActive;
@@ -5731,7 +5802,8 @@ function createAcpSessionBridge(opts) {
5731
5802
  pendingInteractionCount: entry.pendingInteractions.size,
5732
5803
  hasTurnError: entry.turnError !== void 0,
5733
5804
  ...entry.turnError !== void 0 ? { turnError: entry.turnError } : {},
5734
- pendingInteractions: [...entry.pendingInteractions.values()]
5805
+ pendingInteractions: [...entry.pendingInteractions.values()],
5806
+ ...entry.worktree ? { worktree: entry.worktree } : {}
5735
5807
  };
5736
5808
  }, "toSessionSummary");
5737
5809
  const permissionConsensusQuorum = opts.permissionConsensusQuorum;
@@ -5793,13 +5865,30 @@ function createAcpSessionBridge(opts) {
5793
5865
  entry.clientIds.set(clientId, count - 1);
5794
5866
  }
5795
5867
  }, "unregisterClient");
5868
+ const recordAttachRef = /* @__PURE__ */ __name((entry, clientId) => {
5869
+ entry.attachRefs.set(clientId, (entry.attachRefs.get(clientId) ?? 0) + 1);
5870
+ }, "recordAttachRef");
5871
+ const releaseAttachRef = /* @__PURE__ */ __name((entry, clientId) => {
5872
+ const refs = entry.attachRefs.get(clientId);
5873
+ if (refs === void 0 || refs <= 0) return false;
5874
+ if (refs === 1) {
5875
+ entry.attachRefs.delete(clientId);
5876
+ } else {
5877
+ entry.attachRefs.set(clientId, refs - 1);
5878
+ }
5879
+ return true;
5880
+ }, "releaseAttachRef");
5796
5881
  const rollbackAttachRegistration = /* @__PURE__ */ __name(async (entry, clientId, attachCountDelta = 1) => {
5797
- entry.attachCount = Math.max(0, entry.attachCount - attachCountDelta);
5882
+ const released = releaseAttachRef(entry, clientId) ? 1 : 0;
5883
+ entry.attachCount = Math.max(
5884
+ 0,
5885
+ entry.attachCount - (released + (attachCountDelta - 1))
5886
+ );
5798
5887
  unregisterClient(entry, clientId);
5799
5888
  if (entry.spawnOwnerWantedKill && entry.attachCount === 0 && entry.events.subscriberCount === 0) {
5800
5889
  await bridgeApi.killSession(entry.sessionId).catch(() => {
5801
5890
  });
5802
- } else if (entry.clientIds.size === 0 && entry.events.subscriberCount === 0 && !entry.promptActive) {
5891
+ } else if (entry.clientIds.size === 0 && entry.events.subscriberCount === 0 && entry.pendingPromptCount === 0) {
5803
5892
  await closeSessionImpl(entry.sessionId, void 0, {
5804
5893
  reason: "last_client_detached"
5805
5894
  }).catch((err) => {
@@ -5968,6 +6057,11 @@ function createAcpSessionBridge(opts) {
5968
6057
  const sessEntry = byId.get(sid);
5969
6058
  if (!sessEntry) continue;
5970
6059
  cancelPendingForSession(sid);
6060
+ flushPromptTerminals(
6061
+ sessEntry,
6062
+ "channel_closed",
6063
+ "agent channel exited before the prompt completed"
6064
+ );
5971
6065
  try {
5972
6066
  sessEntry.events.publish({
5973
6067
  type: "session_died",
@@ -6062,7 +6156,7 @@ function createAcpSessionBridge(opts) {
6062
6156
  }
6063
6157
  }
6064
6158
  __name(ensureChannel, "ensureChannel");
6065
- async function doSpawn(modelServiceId, effectiveScope, approvalMode, requestedClientId, onSessionRegistered, parentSessionId, sourceType, sourceId) {
6159
+ async function doSpawn(modelServiceId, effectiveScope, approvalMode, requestedClientId, onSessionRegistered, parentSessionId, sourceType, sourceId, worktree) {
6066
6160
  const channelPath = channelInfo && !channelInfo.isDying ? "reused" : inFlightChannelSpawn ? "joined" : "spawned_on_request";
6067
6161
  const ci = await telemetry.withSpan(
6068
6162
  "channel.wait",
@@ -6123,7 +6217,7 @@ function createAcpSessionBridge(opts) {
6123
6217
  newSessionResp.sessionId,
6124
6218
  boundWorkspace,
6125
6219
  void 0,
6126
- { parentSessionId, sourceType, sourceId }
6220
+ { parentSessionId, sourceType, sourceId, worktree }
6127
6221
  );
6128
6222
  initializedSessionId = entry.sessionId;
6129
6223
  sessionRegistered = true;
@@ -6237,7 +6331,8 @@ function createAcpSessionBridge(opts) {
6237
6331
  ...entry.sourceType ? { sourceType: entry.sourceType } : {},
6238
6332
  ...entry.sourceId !== void 0 ? { sourceId: entry.sourceId } : {},
6239
6333
  ...entry.sourceType ? { sourcePersisted: sourcePersisted === true } : {},
6240
- ...entry.parentSessionId ? { parentSessionPersisted: parentSessionPersisted === true } : {}
6334
+ ...entry.parentSessionId ? { parentSessionPersisted: parentSessionPersisted === true } : {},
6335
+ ...entry.worktree ? { worktree: entry.worktree } : {}
6241
6336
  };
6242
6337
  } finally {
6243
6338
  ci.sessionSpawnsInFlight = Math.max(0, ci.sessionSpawnsInFlight - 1);
@@ -6447,10 +6542,11 @@ function createAcpSessionBridge(opts) {
6447
6542
  }
6448
6543
  return entry.transportClosedReject;
6449
6544
  }, "getTransportClosedReject");
6450
- const resolveWorkspaceKey = /* @__PURE__ */ __name((workspaceCwd) => {
6451
- if (!path3.isAbsolute(workspaceCwd)) {
6545
+ const resolveWorkspaceKey = /* @__PURE__ */ __name((rawWorkspaceCwd) => {
6546
+ const workspaceCwd = translateAndCheckAbsoluteWorkspacePath(rawWorkspaceCwd);
6547
+ if (workspaceCwd === null) {
6452
6548
  throw new Error(
6453
- `workspaceCwd must be an absolute path; got "${workspaceCwd}"`
6549
+ `workspaceCwd must be an absolute path; got "${rawWorkspaceCwd}"`
6454
6550
  );
6455
6551
  }
6456
6552
  const workspaceKey = workspaceCwd === boundWorkspace ? boundWorkspace : canonicalizeWorkspace(workspaceCwd);
@@ -6689,12 +6785,18 @@ function createAcpSessionBridge(opts) {
6689
6785
  return;
6690
6786
  }
6691
6787
  try {
6788
+ const closeRequest = entry.connection.extMethod(
6789
+ SERVE_CONTROL_EXT_METHODS.sessionClose,
6790
+ {
6791
+ sessionId: entry.sessionId,
6792
+ drainTimeoutMs: Math.max(1, Math.floor(initTimeoutMs * 0.8)),
6793
+ ...opts2?.requireFlush === true ? { requireFlush: true } : {}
6794
+ }
6795
+ );
6796
+ const observedCloseRequest = opts2?.timeoutMs ? withTimeout(closeRequest, opts2.timeoutMs, label) : closeRequest;
6692
6797
  await Promise.race([
6693
- withTimeout(
6694
- entry.connection.extMethod(SERVE_CONTROL_EXT_METHODS.sessionClose, {
6695
- sessionId: entry.sessionId,
6696
- ...opts2?.requireFlush === true ? { requireFlush: true } : {}
6697
- }),
6798
+ opts2?.throwOnFailure === true ? observedCloseRequest : withTimeout(
6799
+ observedCloseRequest,
6698
6800
  initTimeoutMs,
6699
6801
  SERVE_CONTROL_EXT_METHODS.sessionClose
6700
6802
  ),
@@ -6850,6 +6952,7 @@ function createAcpSessionBridge(opts) {
6850
6952
  ...options.parentSessionId ? { parentSessionId: options.parentSessionId } : {},
6851
6953
  ...options.sourceType ? { sourceType: options.sourceType } : {},
6852
6954
  ...options.sourceId !== void 0 ? { sourceId: options.sourceId } : {},
6955
+ ...options.worktree ? { worktree: options.worktree } : {},
6853
6956
  channel: ci.channel,
6854
6957
  connection: ci.connection,
6855
6958
  events,
@@ -6859,6 +6962,7 @@ function createAcpSessionBridge(opts) {
6859
6962
  persistence: createSessionArtifactPersistence(ci.connection, sessionId)
6860
6963
  }),
6861
6964
  recordingDegraded: false,
6965
+ closing: false,
6862
6966
  promptQueue: Promise.resolve(),
6863
6967
  pendingPromptCount: 0,
6864
6968
  pendingPromptList: [],
@@ -6872,6 +6976,7 @@ function createAcpSessionBridge(opts) {
6872
6976
  clientIds: /* @__PURE__ */ new Map(),
6873
6977
  clientLastSeenAt: /* @__PURE__ */ new Map(),
6874
6978
  attachCount: 0,
6979
+ attachRefs: /* @__PURE__ */ new Map(),
6875
6980
  spawnOwnerWantedKill: false,
6876
6981
  promptActive: false,
6877
6982
  retryAllowed: false
@@ -7061,6 +7166,62 @@ function createAcpSessionBridge(opts) {
7061
7166
  } = state;
7062
7167
  return publicState;
7063
7168
  }, "publicRestoreState");
7169
+ async function requestSessionTranscriptPage(req) {
7170
+ const info = await ensureChannel();
7171
+ try {
7172
+ const response = await withWorkspaceControl(
7173
+ info,
7174
+ () => withTimeout(
7175
+ Promise.race([
7176
+ info.connection.extMethod(
7177
+ SERVE_STATUS_EXT_METHODS.sessionTranscript,
7178
+ { ...req, cwd: boundWorkspace }
7179
+ ),
7180
+ getChannelClosedReject(info)
7181
+ ]),
7182
+ Math.max(initTimeoutMs, SESSION_TRANSCRIPT_TIMEOUT_MS),
7183
+ SERVE_STATUS_EXT_METHODS.sessionTranscript
7184
+ )
7185
+ );
7186
+ return response;
7187
+ } catch (err) {
7188
+ if (isAcpSessionResourceNotFound(err, req.sessionId)) {
7189
+ throw new SessionNotFoundError(req.sessionId);
7190
+ }
7191
+ throw err;
7192
+ } finally {
7193
+ if (hasNoChannelWork(info)) {
7194
+ await startIdleTimer(info, "session transcript");
7195
+ }
7196
+ }
7197
+ }
7198
+ __name(requestSessionTranscriptPage, "requestSessionTranscriptPage");
7199
+ async function refreshedReplayFieldsFor(entry, historyPageSize) {
7200
+ for (let attempt = 0; attempt < 2; attempt++) {
7201
+ try {
7202
+ const lastEventId = entry.events.lastEventId;
7203
+ const page = await requestSessionTranscriptPage({
7204
+ sessionId: entry.sessionId,
7205
+ direction: "backward",
7206
+ limit: historyPageSize
7207
+ });
7208
+ if (byId.get(entry.sessionId) === entry && !entry.promptActive && entry.events.lastEventId === lastEventId) {
7209
+ return {
7210
+ compactedReplay: page.events,
7211
+ liveJournal: [],
7212
+ lastEventId,
7213
+ ...page.partial === true ? { partial: true } : {},
7214
+ ...page.replayError !== void 0 ? { replayError: page.replayError } : {},
7215
+ ...page.hasMore ? { historyHasMore: true } : {}
7216
+ };
7217
+ }
7218
+ } catch {
7219
+ break;
7220
+ }
7221
+ }
7222
+ return replayFieldsFor(entry, "load");
7223
+ }
7224
+ __name(refreshedReplayFieldsFor, "refreshedReplayFieldsFor");
7064
7225
  async function restoreSession(action, req, options = {}) {
7065
7226
  if (shuttingDown) {
7066
7227
  throw new Error("AcpSessionBridge is shutting down");
@@ -7074,8 +7235,19 @@ function createAcpSessionBridge(opts) {
7074
7235
  const historyReplay = action === "load" ? req.historyReplay ?? "stream" : "stream";
7075
7236
  const existing = byId.get(req.sessionId);
7076
7237
  if (existing) {
7238
+ if (existing.closing) {
7239
+ throw new SessionNotFoundError(
7240
+ req.sessionId,
7241
+ "The session is closing; retry after close completes"
7242
+ );
7243
+ }
7244
+ const replayFields = action === "load" && req.historyPageSize !== void 0 ? await refreshedReplayFieldsFor(existing, req.historyPageSize) : replayFieldsFor(existing, action);
7245
+ if (byId.get(req.sessionId) !== existing || existing.closing) {
7246
+ throw new SessionNotFoundError(req.sessionId);
7247
+ }
7077
7248
  existing.attachCount++;
7078
7249
  const clientId = registerClient(existing, req.clientId);
7250
+ recordAttachRef(existing, clientId);
7079
7251
  if (req.approvalMode) {
7080
7252
  await applyApprovalModeForAttach(existing, req.approvalMode, clientId);
7081
7253
  }
@@ -7091,7 +7263,7 @@ function createAcpSessionBridge(opts) {
7091
7263
  // caller saw; spawn-only sessions don't carry a state payload.
7092
7264
  state: existing.restoreState ?? {},
7093
7265
  hasActivePrompt: existing.promptActive,
7094
- ...replayFieldsFor(existing, action)
7266
+ ...replayFields
7095
7267
  };
7096
7268
  }
7097
7269
  const inFlight = inFlightRestores.get(req.sessionId);
@@ -7120,6 +7292,7 @@ function createAcpSessionBridge(opts) {
7120
7292
  );
7121
7293
  }
7122
7294
  const clientId = registerClient(entry, req.clientId);
7295
+ recordAttachRef(entry, clientId);
7123
7296
  if (req.approvalMode) {
7124
7297
  await applyApprovalModeForAttach(entry, req.approvalMode, clientId);
7125
7298
  }
@@ -7241,6 +7414,7 @@ function createAcpSessionBridge(opts) {
7241
7414
  restoreEvents.close();
7242
7415
  racedEntry.attachCount += 1 + coalesceState.count;
7243
7416
  const clientId2 = registerClient(racedEntry, req.clientId);
7417
+ recordAttachRef(racedEntry, clientId2);
7244
7418
  if (req.approvalMode) {
7245
7419
  try {
7246
7420
  await applyApprovalMode(
@@ -7387,10 +7561,17 @@ function createAcpSessionBridge(opts) {
7387
7561
  async function closeSessionImpl(sessionId, context, closeOpts) {
7388
7562
  const entry = byId.get(sessionId);
7389
7563
  if (!entry) throw new SessionNotFoundError(sessionId);
7564
+ if (entry.closing) {
7565
+ throw new SessionNotFoundError(
7566
+ sessionId,
7567
+ "The session is already closing"
7568
+ );
7569
+ }
7390
7570
  let originatorClientId;
7391
7571
  if (context?.clientId !== void 0) {
7392
7572
  originatorClientId = resolveTrustedClientId(entry, context.clientId);
7393
7573
  }
7574
+ entry.closing = true;
7394
7575
  const reason = closeOpts?.reason ?? "client_close";
7395
7576
  writeStderrLine(
7396
7577
  `qwen serve: closing session ${JSON.stringify(sessionId)} (reason: ${reason})` + (originatorClientId ? ` by client ${JSON.stringify(originatorClientId)}` : "")
@@ -7400,26 +7581,37 @@ function createAcpSessionBridge(opts) {
7400
7581
  "session.id": sessionId,
7401
7582
  "session.close.reason": reason
7402
7583
  });
7403
- if (defaultEntry === entry) defaultEntry = void 0;
7404
7584
  const ci = channelInfoForEntry(entry);
7405
7585
  if (!ci) {
7406
7586
  writeStderrLine(
7407
7587
  `qwen serve: closeSession channelInfoForEntry returned undefined for session ${JSON.stringify(sessionId)} \u2014 channel cleanup skipped (entry's channel already torn down)`
7408
7588
  );
7409
7589
  }
7410
- const requireAgentClose = closeOpts?.requireAgentClose === true;
7411
- if (requireAgentClose) {
7590
+ try {
7591
+ permissionMediator.forgetSession(sessionId);
7592
+ entry.pendingPermissionIds.clear();
7593
+ entry.pendingInteractions.clear();
7412
7594
  await notifyAgentSessionClose(entry, ci, "closeSession", {
7413
7595
  throwOnFailure: true,
7414
- requireFlush: true
7596
+ requireFlush: closeOpts?.requireAgentClose === true
7415
7597
  });
7598
+ } catch (error) {
7599
+ if (isDefinitiveAcpRequestError(error)) {
7600
+ entry.closing = false;
7601
+ } else if (ci) {
7602
+ await killChannelWithLog(
7603
+ ci,
7604
+ `recover unknown close outcome for session ${JSON.stringify(sessionId)}`
7605
+ );
7606
+ } else {
7607
+ entry.closing = false;
7608
+ }
7609
+ throw error;
7416
7610
  }
7611
+ if (defaultEntry === entry) defaultEntry = void 0;
7417
7612
  if (ci && ci.channel === entry.channel) {
7418
7613
  ci.sessionIds.delete(sessionId);
7419
7614
  }
7420
- permissionMediator.forgetSession(sessionId);
7421
- entry.pendingPermissionIds.clear();
7422
- entry.pendingInteractions.clear();
7423
7615
  if (entry.promptActive) {
7424
7616
  entry.promptActive = false;
7425
7617
  activePromptCounter--;
@@ -7434,6 +7626,11 @@ function createAcpSessionBridge(opts) {
7434
7626
  reason
7435
7627
  });
7436
7628
  ci?.client.markSessionClosed(sessionId);
7629
+ flushPromptTerminals(
7630
+ entry,
7631
+ "session_closed",
7632
+ "session closed before the prompt completed"
7633
+ );
7437
7634
  try {
7438
7635
  entry.events.publish({
7439
7636
  type: "session_closed",
@@ -7451,9 +7648,6 @@ function createAcpSessionBridge(opts) {
7451
7648
  } catch {
7452
7649
  }
7453
7650
  entry.events.close();
7454
- if (!requireAgentClose) {
7455
- await notifyAgentSessionClose(entry, ci, "closeSession");
7456
- }
7457
7651
  try {
7458
7652
  await telemetry.withSpan(
7459
7653
  "session.close.cancel_active_prompt",
@@ -7568,8 +7762,15 @@ function createAcpSessionBridge(opts) {
7568
7762
  if (effectiveScope === "single") {
7569
7763
  const existing = defaultEntry;
7570
7764
  if (existing) {
7765
+ if (existing.closing) {
7766
+ throw new SessionNotFoundError(
7767
+ existing.sessionId,
7768
+ "The session is closing; retry after close completes"
7769
+ );
7770
+ }
7571
7771
  existing.attachCount++;
7572
7772
  const clientId = registerClient(existing, req.clientId);
7773
+ recordAttachRef(existing, clientId);
7573
7774
  if (req.modelServiceId) {
7574
7775
  await applyModelServiceId(
7575
7776
  existing,
@@ -7609,6 +7810,7 @@ function createAcpSessionBridge(opts) {
7609
7810
  );
7610
7811
  }
7611
7812
  const clientId = registerClient(attachedEntry, req.clientId);
7813
+ recordAttachRef(attachedEntry, clientId);
7612
7814
  if (req.modelServiceId) {
7613
7815
  await applyModelServiceId(
7614
7816
  attachedEntry,
@@ -7654,7 +7856,8 @@ function createAcpSessionBridge(opts) {
7654
7856
  releaseAdmissionOnce,
7655
7857
  req.parentSessionId,
7656
7858
  source.sourceType,
7657
- source.sourceId
7859
+ source.sourceId,
7860
+ req.worktree
7658
7861
  );
7659
7862
  const tracker = effectiveScope === "single" ? workspaceKey : `${workspaceKey}#${randomUUID2()}`;
7660
7863
  inFlightSpawns.set(tracker, promise);
@@ -7676,6 +7879,14 @@ function createAcpSessionBridge(opts) {
7676
7879
  const queuedAt = Date.now();
7677
7880
  const entry = byId.get(sessionId);
7678
7881
  if (!entry) return Promise.reject(new SessionNotFoundError(sessionId));
7882
+ if (entry.closing) {
7883
+ return Promise.reject(
7884
+ new SessionNotFoundError(
7885
+ sessionId,
7886
+ "The session is closing; retry after close completes"
7887
+ )
7888
+ );
7889
+ }
7679
7890
  const originatorClientId = resolveTrustedClientId(
7680
7891
  entry,
7681
7892
  context?.clientId
@@ -7720,6 +7931,37 @@ function createAcpSessionBridge(opts) {
7720
7931
  state: isQueued ? "queued" : "running"
7721
7932
  };
7722
7933
  entry.pendingPromptList.push(pendingEntry);
7934
+ const deadlineMs = context?.deadlineMs;
7935
+ const hasDeadline = typeof deadlineMs === "number" && Number.isFinite(deadlineMs) && deadlineMs > 0;
7936
+ let deadlineReject;
7937
+ let deadlinePromise;
7938
+ let deadlineTimer;
7939
+ if (hasDeadline) {
7940
+ deadlinePromise = new Promise((_resolve, reject) => {
7941
+ deadlineReject = reject;
7942
+ });
7943
+ deadlinePromise.catch(() => {
7944
+ });
7945
+ const onDeadline = /* @__PURE__ */ __name(() => {
7946
+ if (pendingEntry.terminalPublished) return;
7947
+ const deadlineErr = new PromptDeadlineExceededError(deadlineMs);
7948
+ writeStderrLine(
7949
+ `sendPrompt: prompt ${promptId} exceeded ${deadlineMs}ms deadline for session ${sessionId}; agent may still be executing`
7950
+ );
7951
+ publishPromptTerminal(entry, pendingEntry, {
7952
+ kind: "error",
7953
+ err: {
7954
+ code: "prompt_deadline_exceeded",
7955
+ message: deadlineErr.message
7956
+ }
7957
+ });
7958
+ settleActivePromptState(entry, pendingEntry.promptId);
7959
+ deadlineReject?.(deadlineErr);
7960
+ pendingAbort.abort(deadlineErr);
7961
+ }, "onDeadline");
7962
+ deadlineTimer = setTimeout(onDeadline, deadlineMs);
7963
+ deadlineTimer.unref();
7964
+ }
7723
7965
  if (isQueued) {
7724
7966
  pendingAbort.signal.addEventListener(
7725
7967
  "abort",
@@ -7837,35 +8079,17 @@ function createAcpSessionBridge(opts) {
7837
8079
  );
7838
8080
  }
7839
8081
  } catch (echoErr) {
7840
- delete entry.activePromptId;
7841
- delete entry.activePromptOriginatorClientId;
7842
- if (entry.promptActive) {
7843
- entry.promptActive = false;
7844
- activePromptCounter--;
7845
- touchActivity();
7846
- }
8082
+ settleActivePromptState(entry, pendingEntry.promptId);
7847
8083
  throw echoErr;
7848
8084
  }
7849
8085
  const promptPromise = entry.connection.prompt(promptRequest).finally(() => {
7850
- if (entry.promptActive) {
7851
- entry.promptActive = false;
7852
- activePromptCounter--;
7853
- entry.sessionLastSeenAt = Date.now();
7854
- touchActivity();
7855
- }
7856
- delete entry.activePromptId;
7857
- delete entry.activePromptOriginatorClientId;
7858
- if (entry.clientIds.size === 0 && entry.events.subscriberCount === 0 && byId.has(sessionId)) {
7859
- void closeSessionImpl(sessionId, void 0, {
7860
- reason: "last_client_detached"
7861
- }).catch((err) => {
7862
- writeStderrLine(
7863
- `qwen serve: deferred close-on-prompt-complete failed for ${JSON.stringify(sessionId)}: ${err instanceof Error ? err.stack ?? err.message : String(err)}`
7864
- );
7865
- });
7866
- }
8086
+ settleActivePromptState(entry, pendingEntry.promptId);
7867
8087
  });
7868
- const racedPromise = Promise.race([
8088
+ const racedPromise = deadlinePromise ? Promise.race([
8089
+ promptPromise,
8090
+ getTransportClosedReject(entry),
8091
+ deadlinePromise
8092
+ ]) : Promise.race([
7869
8093
  promptPromise,
7870
8094
  getTransportClosedReject(entry)
7871
8095
  ]);
@@ -7873,6 +8097,9 @@ function createAcpSessionBridge(opts) {
7873
8097
  () => {
7874
8098
  },
7875
8099
  (err) => {
8100
+ if (err instanceof PromptDeadlineExceededError) {
8101
+ return;
8102
+ }
7876
8103
  if (err instanceof DOMException && err.name === "AbortError" && pendingEntry.state === "queued") {
7877
8104
  writeStderrLine(
7878
8105
  `sendPrompt: queued prompt removed before agent forward for session ${sessionId}`
@@ -7935,23 +8162,17 @@ function createAcpSessionBridge(opts) {
7935
8162
  );
7936
8163
  result.then(
7937
8164
  (promptResult) => {
7938
- broadcastTurnComplete(
7939
- entry,
7940
- sessionId,
7941
- promptResult,
7942
- pendingEntry.promptId,
7943
- originatorClientId
7944
- );
8165
+ publishPromptTerminal(entry, pendingEntry, {
8166
+ kind: "complete",
8167
+ result: promptResult
8168
+ });
7945
8169
  },
7946
8170
  (err) => {
7947
- if (err instanceof DOMException && err.name === "AbortError") return;
7948
- broadcastTurnError(
7949
- entry,
7950
- sessionId,
7951
- err,
7952
- pendingEntry.promptId,
7953
- originatorClientId
7954
- );
8171
+ if (err instanceof DOMException && err.name === "AbortError") {
8172
+ publishPromptTerminal(entry, pendingEntry, { kind: "cancelled" });
8173
+ return;
8174
+ }
8175
+ publishPromptTerminal(entry, pendingEntry, { kind: "error", err });
7955
8176
  }
7956
8177
  );
7957
8178
  entry.promptQueue = result.then(
@@ -7959,6 +8180,7 @@ function createAcpSessionBridge(opts) {
7959
8180
  () => void 0
7960
8181
  );
7961
8182
  result.finally(() => {
8183
+ if (deadlineTimer !== void 0) clearTimeout(deadlineTimer);
7962
8184
  const listIdx = entry.pendingPromptList.indexOf(pendingEntry);
7963
8185
  if (listIdx !== -1) {
7964
8186
  entry.pendingPromptList.splice(listIdx, 1);
@@ -7985,6 +8207,15 @@ function createAcpSessionBridge(opts) {
7985
8207
  );
7986
8208
  entry.midTurnMessageQueue.length = 0;
7987
8209
  }
8210
+ if (entry.clientIds.size === 0 && entry.events.subscriberCount === 0 && entry.pendingPromptCount === 0 && byId.get(sessionId) === entry) {
8211
+ void closeSessionImpl(sessionId, void 0, {
8212
+ reason: "last_client_detached"
8213
+ }).catch((err) => {
8214
+ writeStderrLine(
8215
+ `qwen serve: deferred close-on-prompt-complete failed for ${JSON.stringify(sessionId)}: ${err instanceof Error ? err.stack ?? err.message : String(err)}`
8216
+ );
8217
+ });
8218
+ }
7988
8219
  }).catch(() => {
7989
8220
  });
7990
8221
  return result;
@@ -8260,7 +8491,8 @@ function createAcpSessionBridge(opts) {
8260
8491
  SERVE_CONTROL_EXT_METHODS.sessionCd,
8261
8492
  {
8262
8493
  sessionId,
8263
- path: req.path
8494
+ path: req.path,
8495
+ ...req.allowedRoots ? { allowedRoots: req.allowedRoots } : {}
8264
8496
  }
8265
8497
  );
8266
8498
  const extResult = raw;
@@ -8296,6 +8528,12 @@ function createAcpSessionBridge(opts) {
8296
8528
  );
8297
8529
  return { sessionId, ...result };
8298
8530
  },
8531
+ setSessionWorktree(sessionId, worktree) {
8532
+ const entry = byId.get(sessionId);
8533
+ if (entry) {
8534
+ entry.worktree = worktree;
8535
+ }
8536
+ },
8299
8537
  async closeSession(sessionId, context, closeOpts) {
8300
8538
  return closeSessionImpl(sessionId, context, closeOpts);
8301
8539
  },
@@ -8699,33 +8937,7 @@ function createAcpSessionBridge(opts) {
8699
8937
  );
8700
8938
  },
8701
8939
  async getSessionTranscriptPage(req) {
8702
- const info = await ensureChannel();
8703
- try {
8704
- const response = await withWorkspaceControl(
8705
- info,
8706
- () => withTimeout(
8707
- Promise.race([
8708
- info.connection.extMethod(
8709
- SERVE_STATUS_EXT_METHODS.sessionTranscript,
8710
- { ...req, cwd: boundWorkspace }
8711
- ),
8712
- getChannelClosedReject(info)
8713
- ]),
8714
- Math.max(initTimeoutMs, SESSION_TRANSCRIPT_TIMEOUT_MS),
8715
- SERVE_STATUS_EXT_METHODS.sessionTranscript
8716
- )
8717
- );
8718
- return response;
8719
- } catch (err) {
8720
- if (isAcpSessionResourceNotFound(err, req.sessionId)) {
8721
- throw new SessionNotFoundError(req.sessionId);
8722
- }
8723
- throw err;
8724
- } finally {
8725
- if (hasNoChannelWork(info)) {
8726
- await startIdleTimer(info, "session transcript");
8727
- }
8728
- }
8940
+ return requestSessionTranscriptPage(req);
8729
8941
  },
8730
8942
  async cancelSessionTask(sessionId, taskId, taskKind) {
8731
8943
  return requestSessionStatus(
@@ -9126,6 +9338,9 @@ function createAcpSessionBridge(opts) {
9126
9338
  });
9127
9339
  } catch {
9128
9340
  }
9341
+ if (target.state === "queued") {
9342
+ publishPromptTerminal(entry, target, { kind: "cancelled" });
9343
+ }
9129
9344
  return { removed: true };
9130
9345
  },
9131
9346
  enqueueMidTurnMessage(sessionId, message, context) {
@@ -9373,6 +9588,9 @@ function createAcpSessionBridge(opts) {
9373
9588
  async rewindSession(sessionId, req, context) {
9374
9589
  const entry = byId.get(sessionId);
9375
9590
  if (!entry) throw new SessionNotFoundError(sessionId);
9591
+ if (entry.closing) {
9592
+ throw new SessionNotFoundError(sessionId, "The session is closing");
9593
+ }
9376
9594
  const info = channelInfoForEntry(entry);
9377
9595
  if (!info || info.isDying) throw new SessionNotFoundError(sessionId);
9378
9596
  const originatorClientId = resolveTrustedClientId(
@@ -9684,9 +9902,41 @@ function createAcpSessionBridge(opts) {
9684
9902
  entry.spawnOwnerWantedKill = true;
9685
9903
  return false;
9686
9904
  }
9905
+ if (entry.closing) {
9906
+ const closingChannel = channelInfoForEntry(entry);
9907
+ if (!closingChannel) return false;
9908
+ await killChannelWithLog(
9909
+ closingChannel,
9910
+ `force kill closing session ${JSON.stringify(sessionId)}`
9911
+ );
9912
+ return true;
9913
+ }
9914
+ entry.closing = true;
9915
+ const ci = channelInfoForEntry(entry);
9916
+ if (!ci) {
9917
+ writeStderrLine(
9918
+ `qwen serve: killSession channelInfoForEntry returned undefined for session ${JSON.stringify(sessionId)} \u2014 channel cleanup skipped (entry's channel already torn down)`
9919
+ );
9920
+ }
9687
9921
  permissionMediator.forgetSession(sessionId);
9688
9922
  entry.pendingPermissionIds.clear();
9689
9923
  entry.pendingInteractions.clear();
9924
+ try {
9925
+ await notifyAgentSessionClose(entry, ci, "killSession", {
9926
+ throwOnFailure: true,
9927
+ timeoutMs: initTimeoutMs
9928
+ });
9929
+ } catch (error) {
9930
+ if (ci) {
9931
+ await killChannelWithLog(
9932
+ ci,
9933
+ `force kill session ${JSON.stringify(sessionId)}`
9934
+ );
9935
+ return true;
9936
+ }
9937
+ entry.closing = false;
9938
+ throw error;
9939
+ }
9690
9940
  if (entry.promptActive) {
9691
9941
  entry.promptActive = false;
9692
9942
  activePromptCounter--;
@@ -9701,17 +9951,15 @@ function createAcpSessionBridge(opts) {
9701
9951
  workspaceCwd: entry.workspaceCwd,
9702
9952
  reason: "killed"
9703
9953
  });
9704
- const ci = channelInfoForEntry(entry);
9705
- if (!ci) {
9706
- writeStderrLine(
9707
- `qwen serve: killSession channelInfoForEntry returned undefined for session ${JSON.stringify(sessionId)} \u2014 channel cleanup skipped (entry's channel already torn down)`
9708
- );
9709
- }
9710
9954
  if (ci && ci.channel === entry.channel) {
9711
9955
  ci.sessionIds.delete(sessionId);
9712
9956
  }
9713
- await notifyAgentSessionClose(entry, ci, "killSession");
9714
9957
  ci?.client.markSessionClosed(sessionId);
9958
+ flushPromptTerminals(
9959
+ entry,
9960
+ "session_killed",
9961
+ "session killed before the prompt completed"
9962
+ );
9715
9963
  try {
9716
9964
  entry.events.publish({
9717
9965
  type: "session_died",
@@ -9731,12 +9979,14 @@ function createAcpSessionBridge(opts) {
9731
9979
  async detachClient(sessionId, clientId) {
9732
9980
  const entry = byId.get(sessionId);
9733
9981
  if (!entry) return;
9734
- if (entry.attachCount > 0) entry.attachCount--;
9982
+ if (clientId !== void 0 && releaseAttachRef(entry, clientId)) {
9983
+ if (entry.attachCount > 0) entry.attachCount--;
9984
+ }
9735
9985
  unregisterClient(entry, clientId);
9736
9986
  if (entry.spawnOwnerWantedKill && entry.attachCount === 0 && entry.events.subscriberCount === 0) {
9737
9987
  await this.killSession(sessionId).catch(() => {
9738
9988
  });
9739
- } else if (entry.clientIds.size === 0 && entry.events.subscriberCount === 0 && !entry.promptActive) {
9989
+ } else if (entry.clientIds.size === 0 && entry.events.subscriberCount === 0 && entry.pendingPromptCount === 0) {
9740
9990
  await closeSessionImpl(sessionId, void 0, {
9741
9991
  reason: "last_client_detached"
9742
9992
  }).catch((err) => {
@@ -9800,6 +10050,11 @@ function createAcpSessionBridge(opts) {
9800
10050
  workspaceCwd: e.workspaceCwd,
9801
10051
  reason: shutdownReason
9802
10052
  });
10053
+ flushPromptTerminals(
10054
+ e,
10055
+ "daemon_shutdown",
10056
+ "daemon shut down before the prompt completed"
10057
+ );
9803
10058
  try {
9804
10059
  e.events.publish({
9805
10060
  type: "session_died",