@qwen-code/qwen-code 0.22.3 → 0.23.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 (497) hide show
  1. package/README.md +30 -0
  2. package/bundled/computer-use/SKILL.md +116 -180
  3. package/bundled/goal-draft/SKILL.md +5 -1
  4. package/bundled/qc-helper/docs/common-workflow.md +32 -0
  5. package/bundled/qc-helper/docs/configuration/auth.md +6 -6
  6. package/bundled/qc-helper/docs/configuration/model-providers.md +8 -2
  7. package/bundled/qc-helper/docs/configuration/settings.md +63 -58
  8. package/bundled/qc-helper/docs/extension/introduction.md +1 -1
  9. package/bundled/qc-helper/docs/features/_meta.ts +1 -0
  10. package/bundled/qc-helper/docs/features/approval-mode.md +3 -0
  11. package/bundled/qc-helper/docs/features/auto-mode.md +34 -17
  12. package/bundled/qc-helper/docs/features/channels/dingtalk.md +4 -2
  13. package/bundled/qc-helper/docs/features/channels/dws.md +6 -2
  14. package/bundled/qc-helper/docs/features/channels/overview.md +5 -2
  15. package/bundled/qc-helper/docs/features/code-review.md +2 -2
  16. package/bundled/qc-helper/docs/features/commands.md +79 -1
  17. package/bundled/qc-helper/docs/features/computer-use.md +2 -2
  18. package/bundled/qc-helper/docs/features/goals.md +9 -3
  19. package/bundled/qc-helper/docs/features/headless.md +16 -1
  20. package/bundled/qc-helper/docs/features/hooks.md +8 -3
  21. package/bundled/qc-helper/docs/features/memory.md +1 -0
  22. package/bundled/qc-helper/docs/features/output-styles.md +38 -0
  23. package/bundled/qc-helper/docs/qwen-serve-deploy-local.md +17 -7
  24. package/bundled/qc-helper/docs/qwen-serve.md +74 -55
  25. package/bundled/review/SKILL.md +16 -7
  26. package/bundled/review/references/posting.md +3 -3
  27. package/chunks/MaxSizedBox-B3D7545A.js +111 -0
  28. package/chunks/{StandaloneSessionPicker-2FJAOLGG.js → StandaloneSessionPicker-QUMO4LLQ.js} +88 -86
  29. package/chunks/{acp-startup-profiler-GNYAL6LI.js → acp-startup-profiler-M4X5F3VK.js} +2 -2
  30. package/chunks/{acpAgent-2ZMIJAFV.js → acpAgent-2GTFCIEP.js} +2041 -444
  31. package/chunks/{agent-X5WX3L2I.js → agent-XKF5SZWU.js} +46 -46
  32. package/chunks/agent-headless-OC2IB55D.js +85 -0
  33. package/chunks/{anthropicContentGenerator-YVTB6QX7.js → anthropicContentGenerator-L76MR5OR.js} +53 -20
  34. package/chunks/{artifact-tool-XSMPHZBT.js → artifact-tool-MYCL2QCS.js} +3 -4
  35. package/chunks/{askUserQuestion-4SWJY65V.js → askUserQuestion-THQZMG44.js} +45 -7
  36. package/chunks/bridge-IHSBI2YJ.js +118 -0
  37. package/chunks/{build-INBK7IXX.js → build-63BIOYWK.js} +1 -1
  38. package/chunks/{ca-7HPYOYSZ.js → ca-BNU7YNDE.js} +3 -0
  39. package/chunks/{channel-management-service-HQ6KDS7C.js → channel-management-service-4MTCEGJB.js} +4 -4
  40. package/chunks/channel-settings-store-BVKWAI2T.js +121 -0
  41. package/chunks/{channel-worker-group-6NA6BBZV.js → channel-worker-group-47F4ISUZ.js} +7 -7
  42. package/chunks/{channel-worker-manager-NEZ2J6RK.js → channel-worker-manager-I5Y44GYR.js} +51 -10
  43. package/chunks/{channel-worker-supervisor-FKU7DIHJ.js → channel-worker-supervisor-6VCLUXFE.js} +4 -4
  44. package/chunks/{chunk-PPKZ7JOE.js → chunk-22UH7VTP.js} +1 -1
  45. package/chunks/chunk-24FVUD5P.js +49 -0
  46. package/chunks/{chunk-MZCJWS5Y.js → chunk-2M3EWQNG.js} +20 -0
  47. package/chunks/{chunk-7T52W4SW.js → chunk-32LU3APX.js} +1 -1
  48. package/chunks/{chunk-42IDLQWS.js → chunk-373DQUVA.js} +48 -13
  49. package/chunks/{chunk-MSBO7X2W.js → chunk-37JFWFCD.js} +1 -1
  50. package/chunks/{chunk-3JXM2CVW.js → chunk-3AKCBZVW.js} +3 -3
  51. package/chunks/{chunk-TVC6HQ2U.js → chunk-3JQZVCBI.js} +2 -2
  52. package/chunks/{chunk-2LNNVAUV.js → chunk-3L724BJ5.js} +246 -15
  53. package/chunks/{chunk-E7REAOTN.js → chunk-47ECGEJC.js} +4 -0
  54. package/chunks/{chunk-WNPDGUJO.js → chunk-47RYEQW5.js} +2 -3
  55. package/chunks/{chunk-TZBSGJ6C.js → chunk-4BGDFKQE.js} +7 -7
  56. package/chunks/{chunk-PZ66FRIC.js → chunk-4F7GQGXB.js} +11772 -4773
  57. package/chunks/{chunk-DMLVSW7L.js → chunk-4HVH57J3.js} +713 -9
  58. package/chunks/{chunk-CMHFCLBU.js → chunk-4LIFGNI4.js} +1 -1
  59. package/chunks/{chunk-3SZC4VP4.js → chunk-4M24B5J5.js} +88 -49
  60. package/chunks/{chunk-BOWFGCEU.js → chunk-4PSDSCW3.js} +3 -3
  61. package/chunks/chunk-4UANMABT.js +1026 -0
  62. package/chunks/{chunk-M3QRM3DE.js → chunk-54C6PIGT.js} +5 -5
  63. package/chunks/{chunk-HP5LR5HL.js → chunk-5EIOJGCR.js} +4 -4
  64. package/chunks/{chunk-64REQJJ2.js → chunk-5H5S4UY5.js} +3 -3
  65. package/chunks/chunk-5IENVM7Z.js +35 -0
  66. package/chunks/{chunk-I6LYRJPB.js → chunk-5Q5RC2WE.js} +2 -2
  67. package/chunks/{chunk-WGY3AVGM.js → chunk-5RTTI4GE.js} +79 -5
  68. package/chunks/{chunk-KID24ZFN.js → chunk-64QH2UC6.js} +13 -1
  69. package/chunks/{chunk-MF7HCQWZ.js → chunk-65HWLGA7.js} +3 -3
  70. package/chunks/{chunk-OU5APVWO.js → chunk-6A2D4QSO.js} +13 -7
  71. package/chunks/chunk-6HUXPLB5.js +110 -0
  72. package/chunks/{chunk-VQUGEVGR.js → chunk-7IKXTGZT.js} +1 -1
  73. package/chunks/{chunk-UTLCH2FK.js → chunk-7JMGTOH7.js} +437 -136
  74. package/chunks/{chunk-7LOELM2I.js → chunk-7RB56BRJ.js} +3 -3
  75. package/chunks/{chunk-NIFYWDYN.js → chunk-7TBU7PU2.js} +1 -1
  76. package/chunks/{chunk-V2NDP3I4.js → chunk-7XL4WRXM.js} +2 -2
  77. package/chunks/chunk-ADJD4LZF.js +210 -0
  78. package/chunks/{chunk-T7KMERIX.js → chunk-ADYN7P2Y.js} +2 -2
  79. package/chunks/{chunk-TPI7O7HR.js → chunk-AHYTURFB.js} +1 -1
  80. package/chunks/{chunk-LUEHOUHM.js → chunk-AI35S34R.js} +3 -3
  81. package/chunks/{chunk-CIZCL2MW.js → chunk-ALUYNJPM.js} +1486 -2172
  82. package/chunks/{chunk-ABS25QER.js → chunk-ANVG3BVV.js} +1 -1
  83. package/chunks/{chunk-6ZPDLGHN.js → chunk-AZJLY2XZ.js} +5 -5
  84. package/chunks/{chunk-A3LWD5MK.js → chunk-BA4WJC4L.js} +1 -1
  85. package/chunks/{chunk-W3JH33JE.js → chunk-BFY33IB4.js} +18 -10
  86. package/chunks/{chunk-N4X7G4J2.js → chunk-BHTYRHJF.js} +1 -1
  87. package/chunks/{chunk-TEBDFQBZ.js → chunk-BJXCYUGM.js} +11 -6
  88. package/chunks/{chunk-7VMIMAVB.js → chunk-C2VWOXHS.js} +8 -8
  89. package/chunks/{chunk-XHF7WQ6B.js → chunk-C4TIXFDZ.js} +16 -5
  90. package/chunks/chunk-CHEIIBT3.js +40 -0
  91. package/chunks/chunk-CVX63TFJ.js +348 -0
  92. package/chunks/{chunk-RXFQM6FQ.js → chunk-DMEUXLSS.js} +16 -1
  93. package/chunks/{chunk-EKSCLBBF.js → chunk-DQCKVAF5.js} +23 -5
  94. package/chunks/{chunk-734C6JGI.js → chunk-DSX7KQPM.js} +5195 -666
  95. package/chunks/{chunk-4CMJKUND.js → chunk-DTVQSSNM.js} +67 -2
  96. package/chunks/{chunk-BKWNKLZB.js → chunk-DYTW3QVG.js} +24 -9
  97. package/chunks/{chunk-C2X7KY45.js → chunk-E4JNFXNI.js} +3 -3
  98. package/chunks/{chunk-UHQFIS7N.js → chunk-EAHOJF6V.js} +28 -4
  99. package/chunks/{chunk-YLSQLSH7.js → chunk-EBDGRBZX.js} +24 -16
  100. package/chunks/{chunk-DJBQCO2E.js → chunk-EFTPIZIC.js} +412 -3
  101. package/chunks/{chunk-6DIGWMGT.js → chunk-EIJT2PQ6.js} +2 -2
  102. package/chunks/{chunk-4TT3IVGA.js → chunk-EIY7SUPZ.js} +1 -1
  103. package/chunks/{chunk-XQFT3QUF.js → chunk-ENYUKMFK.js} +1 -1
  104. package/chunks/{chunk-ZWJDJ6RU.js → chunk-EVFDRBUM.js} +157 -153
  105. package/chunks/{chunk-4VPCTGH6.js → chunk-EWRW2WQC.js} +15 -9
  106. package/chunks/{chunk-VBCPNIQD.js → chunk-F33GFWPR.js} +47 -184
  107. package/chunks/{chunk-ERFDKH32.js → chunk-F47DITLZ.js} +19 -8
  108. package/chunks/{chunk-73RM4POK.js → chunk-F7NF2IOE.js} +7 -7
  109. package/chunks/{chunk-EB6QRGHM.js → chunk-FD5SJOWT.js} +10 -7
  110. package/chunks/{chunk-SS5SDCD3.js → chunk-FRICLXCZ.js} +7 -7
  111. package/chunks/{chunk-NU7RKEZR.js → chunk-FUO5V5KI.js} +14 -7
  112. package/chunks/{chunk-G6FECKTJ.js → chunk-G5PBOQWI.js} +9 -6
  113. package/chunks/{chunk-CAJTKR6W.js → chunk-G7HBEEX7.js} +15 -9
  114. package/chunks/{chunk-4QHPPXK2.js → chunk-GB4UKWY5.js} +2 -2
  115. package/chunks/{chunk-QYMAKPY5.js → chunk-GH2S4GD5.js} +350 -12
  116. package/chunks/{chunk-LHBUKJG2.js → chunk-GXUTFQXK.js} +28 -25
  117. package/chunks/{chunk-KJO2LBUK.js → chunk-H43PSPYS.js} +5 -5
  118. package/chunks/{chunk-XSG6G3G6.js → chunk-HJBHMANB.js} +12 -14
  119. package/chunks/chunk-HRPFBHW7.js +336 -0
  120. package/chunks/{chunk-6PJOTWAN.js → chunk-HT5S5TRQ.js} +1 -1
  121. package/chunks/{chunk-HCOBAG2L.js → chunk-HWVUSYSN.js} +3 -8
  122. package/chunks/{chunk-2OUD5T67.js → chunk-I2TMJPCV.js} +213 -185
  123. package/chunks/{chunk-CLWO3B77.js → chunk-I4NRYS6A.js} +11 -11
  124. package/chunks/{chunk-V7EESTJV.js → chunk-I5N4EAS6.js} +1 -1
  125. package/chunks/{chunk-K5KXUXWC.js → chunk-IG4W5SJR.js} +3 -3
  126. package/chunks/{chunk-FROAFEFB.js → chunk-IPATA3T2.js} +3 -3
  127. package/chunks/{chunk-NKLP3DCK.js → chunk-IQAFKVXS.js} +1 -1
  128. package/chunks/{chunk-AYHQZBJ4.js → chunk-IRKQ4YYX.js} +3 -3
  129. package/chunks/{chunk-J3NNHTV6.js → chunk-J5TTWBZK.js} +6 -0
  130. package/chunks/{chunk-QFCDF5PL.js → chunk-JHN7UIDW.js} +1 -1
  131. package/chunks/{chunk-AVNATYLY.js → chunk-JJKNYRFY.js} +1 -1
  132. package/chunks/{chunk-CQH5KTKC.js → chunk-JR42V4UY.js} +1 -1
  133. package/chunks/chunk-JS73NNWF.js +30 -0
  134. package/chunks/{chunk-NV55WWD6.js → chunk-JUARRUMA.js} +802 -2011
  135. package/chunks/chunk-JX6XHPTX.js +26 -0
  136. package/chunks/{chunk-5JTIYALA.js → chunk-JZWOCUZ3.js} +1 -1
  137. package/chunks/{chunk-P2G476QN.js → chunk-KEVYJSI4.js} +13 -13
  138. package/chunks/{chunk-B466ZSHZ.js → chunk-KFN2IZYR.js} +3 -3
  139. package/chunks/{chunk-JWALNCLT.js → chunk-KGV55H53.js} +1 -1
  140. package/chunks/{chunk-23RFD54N.js → chunk-KHP66DFN.js} +1 -1
  141. package/chunks/{chunk-2SXSLSQE.js → chunk-KM3XVTMO.js} +12 -6
  142. package/chunks/{chunk-GPGU4S2N.js → chunk-KMU3ZHH4.js} +3 -3
  143. package/chunks/chunk-KOGW3YWJ.js +2054 -0
  144. package/chunks/{chunk-NMOD2FXQ.js → chunk-L26ONV2Y.js} +8 -8
  145. package/chunks/chunk-L34XSHIZ.js +28 -0
  146. package/chunks/{chunk-SEONHUS3.js → chunk-LAUEEBDL.js} +2 -0
  147. package/chunks/{chunk-3WK3QDNV.js → chunk-LB3WQQJK.js} +2 -2
  148. package/chunks/{chunk-URE3QBBB.js → chunk-LEPCWS5A.js} +3 -3
  149. package/chunks/{chunk-36GSQ3MM.js → chunk-LHBNR6EU.js} +2 -2
  150. package/chunks/{chunk-V4264FEG.js → chunk-LKODFJRD.js} +1 -1
  151. package/chunks/{chunk-PADPMMYM.js → chunk-LOBDDFYK.js} +5 -29
  152. package/chunks/{chunk-BXDAPVQU.js → chunk-LU77UT4D.js} +28 -4
  153. package/chunks/{chunk-RFIDDFAL.js → chunk-M4KFODIP.js} +1 -1
  154. package/chunks/{chunk-CFJY4DGX.js → chunk-M4LBBSVP.js} +4 -2
  155. package/chunks/{chunk-KYWTPLBJ.js → chunk-MOF6VZN2.js} +2 -2
  156. package/chunks/{chunk-DJPASAUV.js → chunk-MP6YZ4RK.js} +4829 -3638
  157. package/chunks/{chunk-T26EAKDL.js → chunk-N2TNM3QB.js} +2 -6
  158. package/chunks/{chunk-2TNL5KPM.js → chunk-N4QWUPDM.js} +7 -0
  159. package/chunks/{chunk-7S226YTK.js → chunk-NFIDVZND.js} +11 -1
  160. package/chunks/{chunk-ZEYFMJQA.js → chunk-NQ4L2CMD.js} +83 -18
  161. package/chunks/{chunk-ZZUKP7HV.js → chunk-NRL5CUZT.js} +1 -1
  162. package/chunks/{chunk-WXEA74YB.js → chunk-NSUKQ4DN.js} +9 -3
  163. package/chunks/chunk-NUHOLAQ6.js +59 -0
  164. package/chunks/{chunk-DJEZ55D4.js → chunk-NVVJTUSL.js} +336 -140
  165. package/chunks/{chunk-3XKLXHGK.js → chunk-NXKOVOM5.js} +9 -9
  166. package/chunks/{chunk-5Q372OFJ.js → chunk-O4KNCAX4.js} +57 -10
  167. package/chunks/{chunk-GOXKNSDZ.js → chunk-O5CD7T4T.js} +40 -9
  168. package/chunks/{chunk-XIQ5HQ2F.js → chunk-OBTWL6ZW.js} +1 -1
  169. package/chunks/{chunk-PDQGMSZK.js → chunk-ODZF64DM.js} +1 -1
  170. package/chunks/{chunk-5MK45KZ3.js → chunk-OHOO527W.js} +1 -1
  171. package/chunks/{chunk-36LGBEM6.js → chunk-OHU2H5CS.js} +1 -1
  172. package/chunks/{chunk-JB4JIVTJ.js → chunk-OKTNXDVO.js} +1 -1
  173. package/chunks/{chunk-CETB5XY4.js → chunk-ORFIYTI2.js} +1 -1
  174. package/chunks/{chunk-7E7UCJHS.js → chunk-OSHQMOBS.js} +18 -17
  175. package/chunks/chunk-OSSTATJF.js +1310 -0
  176. package/chunks/chunk-P6UIF2OW.js +400 -0
  177. package/chunks/{chunk-U54AYGEC.js → chunk-PB7JBAHF.js} +15 -49
  178. package/chunks/{chunk-Y5S7LBOZ.js → chunk-PCRBLMIN.js} +17 -3
  179. package/chunks/{chunk-WAOIHTJS.js → chunk-PDAKFU7M.js} +1 -1
  180. package/chunks/{chunk-YTDVNSUQ.js → chunk-QAK5475D.js} +1 -1
  181. package/chunks/{chunk-ST5MDGH3.js → chunk-QI27MKNQ.js} +27 -19
  182. package/chunks/{chunk-MK2GIB46.js → chunk-QJGYU5PG.js} +1 -1
  183. package/chunks/{chunk-SMPR7SPO.js → chunk-QJNDUTOL.js} +45 -239
  184. package/chunks/{chunk-MQM5PJML.js → chunk-QJVZLILI.js} +1 -1
  185. package/chunks/{chunk-B5PHIJGI.js → chunk-QKDNS6FU.js} +2 -2
  186. package/chunks/{chunk-ZU4UDIWX.js → chunk-QQD2GART.js} +15 -9
  187. package/chunks/{chunk-62GQFYID.js → chunk-RAFQIHN2.js} +3 -3
  188. package/chunks/{chunk-MO3FC2WT.js → chunk-RJUVTJEZ.js} +1 -1
  189. package/chunks/{chunk-M6FOJXW3.js → chunk-RKW36UWC.js} +1 -1
  190. package/chunks/{chunk-GBJBJ4HX.js → chunk-RM4WT2XB.js} +4 -26
  191. package/chunks/{chunk-VGIFXISB.js → chunk-RN3YGDCA.js} +7 -5
  192. package/chunks/{chunk-DYXFD5RO.js → chunk-S2T7H5MI.js} +1 -1
  193. package/chunks/{chunk-FTF2YIZ5.js → chunk-S6H3ELPG.js} +1 -1
  194. package/chunks/{chunk-4NDLQAY2.js → chunk-SI7WDR3U.js} +524 -16
  195. package/chunks/{chunk-2YOHKHYR.js → chunk-SRF4KTAG.js} +6 -6
  196. package/chunks/{chunk-ZZMSC3RG.js → chunk-STCVJXQB.js} +24 -24
  197. package/chunks/{chunk-ST5V3ZOC.js → chunk-SULZPKTA.js} +3 -3
  198. package/chunks/{chunk-6X7EU5TI.js → chunk-SX2QIMJV.js} +9 -7
  199. package/chunks/{chunk-V5J4J5TP.js → chunk-TJYRTS4S.js} +2 -20
  200. package/chunks/{chunk-C3PEFRKD.js → chunk-TMKTOTMQ.js} +5 -5
  201. package/chunks/{chunk-ISKH4QX3.js → chunk-TQHPVKO6.js} +4 -4
  202. package/chunks/{chunk-HVC3PNVC.js → chunk-TSZSGQ3N.js} +1 -1
  203. package/chunks/{chunk-ICURCKIU.js → chunk-U4DJ5XB3.js} +594 -91
  204. package/chunks/{chunk-TTX2JUE6.js → chunk-U6D2PPMN.js} +1 -1
  205. package/chunks/{chunk-GVIVASYK.js → chunk-UAKRDON5.js} +4 -4
  206. package/chunks/{chunk-D5LUXLUH.js → chunk-UJ4DUYIH.js} +18 -4
  207. package/chunks/{chunk-VTHREBQM.js → chunk-UKYXYWI2.js} +2 -2
  208. package/chunks/{chunk-ZYMLPEZQ.js → chunk-UM2FFKXN.js} +3 -3
  209. package/chunks/{chunk-2OBKDPZZ.js → chunk-UPFRILIL.js} +2 -2
  210. package/chunks/{chunk-2HYKTO7V.js → chunk-UUASLXHW.js} +55 -6
  211. package/chunks/chunk-V5U2NZNJ.js +29 -0
  212. package/chunks/{chunk-P5Y23G2L.js → chunk-V7RNNPGC.js} +1 -18
  213. package/chunks/{chunk-Q2MSPKIJ.js → chunk-VBWD6C27.js} +1 -1
  214. package/chunks/chunk-VGHZT6JR.js +51 -0
  215. package/chunks/{chunk-MPNBVAEU.js → chunk-VNAYZAFX.js} +4 -4
  216. package/chunks/chunk-VPSIC437.js +780 -0
  217. package/chunks/{chunk-AIAOIFY4.js → chunk-VWTSRH6C.js} +92 -17
  218. package/chunks/{chunk-4K7KNVWH.js → chunk-VYIUNFEA.js} +3 -3
  219. package/chunks/{chunk-EQSBPBZ3.js → chunk-WP4AX3XD.js} +5 -7
  220. package/chunks/{chunk-BFPESSTR.js → chunk-XEAAO654.js} +1 -1
  221. package/chunks/{chunk-RU7BK6B3.js → chunk-XLXAZLDR.js} +3 -3
  222. package/chunks/{chunk-EFWRMA2I.js → chunk-YPWZTR7F.js} +3 -3
  223. package/chunks/{chunk-XF63PKEN.js → chunk-ZDFQGHZH.js} +1 -1
  224. package/chunks/{chunk-OZ6KS6KW.js → chunk-ZGCKTAL5.js} +6 -1
  225. package/chunks/chunk-ZHO2CW6D.js +205 -0
  226. package/chunks/chunk-ZJ2LM2SI.js +198 -0
  227. package/chunks/{chunk-AYFA7MZV.js → chunk-ZKFTS3OV.js} +6 -6
  228. package/chunks/{chunk-HMJ2P3SV.js → chunk-ZL4HFSL6.js} +91 -29
  229. package/chunks/{chunk-DJECZIJX.js → chunk-ZTPGUFQV.js} +30 -8
  230. package/chunks/{chunk-7EQQR46F.js → chunk-ZVP4PWBU.js} +1 -1
  231. package/chunks/chunk-bdqvmfwv-ZTSOWAFE.js +17446 -0
  232. package/chunks/config-utils-LVSYDLHZ.js +114 -0
  233. package/chunks/contextCommand-TZD7UAJK.js +107 -0
  234. package/chunks/{core-runtime-AXB6SK5D.js → core-runtime-B4UKKIAQ.js} +63 -62
  235. package/chunks/{create-sub-session-23ITIELI.js → create-sub-session-LUPWEUHR.js} +3 -3
  236. package/chunks/{create-sub-session-4QNE64MR.js → create-sub-session-NJ24B4US.js} +94 -66
  237. package/chunks/{cron-create-KJ4IY6PP.js → cron-create-CRSPET3H.js} +4 -4
  238. package/chunks/{cron-delete-MBLQCAYY.js → cron-delete-DB77SZTU.js} +4 -4
  239. package/chunks/{cron-list-DWH2PQ47.js → cron-list-U2JNYWV6.js} +4 -4
  240. package/chunks/{daemon-3GNHB3M2.js → daemon-RKDGBFLK.js} +613 -102
  241. package/chunks/{daemon-git-worktree-guard-IVAJJWYK.js → daemon-git-worktree-guard-O2HPOBAB.js} +62 -61
  242. package/chunks/daemon-status-provider-GRRVCJFW.js +117 -0
  243. package/chunks/daemon-trust-policy-YJL442BK.js +113 -0
  244. package/chunks/{daemon-trust-policy-monitor-KGGROSIV.js → daemon-trust-policy-monitor-JL7F4Y4Q.js} +68 -67
  245. package/chunks/{de-X6HLSIFE.js → de-T4BLOKEC.js} +3 -0
  246. package/chunks/deferred-core-runtime-S32AYVZI.js +115 -0
  247. package/chunks/{devtools-JCG4K2NZ.js → devtools-VDRJYPZF.js} +1 -1
  248. package/chunks/{discovery-X2NV535U.js → discovery-TUM3ZQ6U.js} +2 -2
  249. package/chunks/{display-image-BE7I6ZB6.js → display-image-73C7XNRK.js} +5 -5
  250. package/chunks/{dist-LVZCXVPF.js → dist-62OZ7QXB.js} +44 -26
  251. package/chunks/{dist-GFN5DCBX.js → dist-EDHQIBYD.js} +152 -63
  252. package/chunks/{dist-N6W6E753.js → dist-GT64AAUR.js} +135 -26
  253. package/chunks/{dist-6BPYWHVD.js → dist-JVXT4VUJ.js} +14 -7
  254. package/chunks/{dist-4WXLCBDR.js → dist-L6URO6CK.js} +12 -5
  255. package/chunks/{dist-5VXFRTWU.js → dist-LXFYIJNG.js} +866 -172
  256. package/chunks/{dist-SWQMYP2Q.js → dist-PDGNRVPY.js} +27 -8
  257. package/chunks/{dist-NSV4NBPK.js → dist-QAF5DO3Y.js} +380 -83
  258. package/chunks/{dist-HZNT6GQS.js → dist-ZCJLKQSP.js} +28 -14
  259. package/chunks/earlyInputCapture-BBPCIVZG.js +108 -0
  260. package/chunks/{edit-LEQLAGPZ.js → edit-SUGXY63Y.js} +47 -47
  261. package/chunks/{en-YLXBXM4Z.js → en-2RATMNX7.js} +5 -0
  262. package/chunks/{enter-worktree-35QCAAFP.js → enter-worktree-B6USKSIK.js} +7 -7
  263. package/chunks/{enterPlanMode-ONQN3WHE.js → enterPlanMode-MDX4RVVL.js} +48 -48
  264. package/chunks/{environment-UANTR7A4.js → environment-VN6RXDVN.js} +63 -62
  265. package/chunks/errors-UEY36PIT.js +114 -0
  266. package/chunks/{exit-worktree-XQD6D543.js → exit-worktree-DLQ73SJH.js} +10 -8
  267. package/chunks/exitPlanMode-EPHIEDAA.js +83 -0
  268. package/chunks/{fast-path-WUL7UZ6H.js → fast-path-Y73R42LV.js} +8 -7
  269. package/chunks/{fast-path-settings-XH426LUU.js → fast-path-settings-MFUR3IWK.js} +3 -3
  270. package/chunks/{fr-FTZWF462.js → fr-BGHGYX6A.js} +3 -0
  271. package/chunks/{glob-Y54QUWDY.js → glob-DMGH7EZN.js} +47 -47
  272. package/chunks/goal-tools-3RF3PXCL.js +99 -0
  273. package/chunks/{grep-5GPICQBU.js → grep-AJVLCVXC.js} +9 -7
  274. package/chunks/handleAutoUpdate-HVWQT2AU.js +110 -0
  275. package/chunks/i18n-5OR7NTRZ.js +125 -0
  276. package/chunks/{image-gen-J6FDGUZP.js → image-gen-VOIDOHOB.js} +8 -8
  277. package/chunks/initializer-JE5RQSOE.js +114 -0
  278. package/chunks/installationInfo-KO3CCSCK.js +108 -0
  279. package/chunks/{ja-2GL5FKYJ.js → ja-G3FTD5XE.js} +3 -0
  280. package/chunks/{keychain-token-storage-37XPR34V.js → keychain-token-storage-REZVMJA6.js} +2 -2
  281. package/chunks/list-3IORSFIY.js +117 -0
  282. package/chunks/list-agents-SBMONIUK.js +128 -0
  283. package/chunks/{llm-NSAVK5V3.js → llm-K26SUDVK.js} +223 -140
  284. package/chunks/{llm-content-generator-AY2QKXHE.js → llm-content-generator-TT6EAUD4.js} +11 -12
  285. package/chunks/loadedSettingsAdapter-KLLFZF3M.js +111 -0
  286. package/chunks/{loggingContentGenerator-DSFQHXIF.js → loggingContentGenerator-EYQBA4M4.js} +66 -65
  287. package/chunks/{loop-wakeup-XJFONSQ7.js → loop-wakeup-QA6SHCZT.js} +5 -5
  288. package/chunks/{ls-3VAT2J7A.js → ls-HEJNCEYO.js} +4 -4
  289. package/chunks/{lsp-5W7IRUBH.js → lsp-WOQKNZP6.js} +2 -2
  290. package/chunks/{managed-npm-update-TSWENTK5.js → managed-npm-update-HIJTODQT.js} +61 -60
  291. package/chunks/mcp-A2UEHETW.js +111 -0
  292. package/chunks/{monitor-RW4GWJHB.js → monitor-DKNZQAB2.js} +46 -46
  293. package/chunks/{node-QKLNSZMX.js → node-UETAYMMO.js} +3 -3
  294. package/chunks/nonInteractiveCli-YA47F2F4.js +190 -0
  295. package/chunks/{notebook-edit-CQNYS5OR.js → notebook-edit-MGHTRL2D.js} +47 -47
  296. package/chunks/{open-with-auth-YN3QZHVM.js → open-with-auth-D6JD6LDS.js} +3 -3
  297. package/chunks/{openaiContentGenerator-J6QIF7EX.js → openaiContentGenerator-ZJIEQ3ZJ.js} +26 -28
  298. package/chunks/pidfile-ETHAZNMY.js +112 -0
  299. package/chunks/{processUtils-GPHNANKZ.js → processUtils-UY3SAJJZ.js} +2 -2
  300. package/chunks/prompt-terminal-ledger-GZ747VYE.js +106 -0
  301. package/chunks/{pt-XN2YWJVM.js → pt-D73IFYT7.js} +3 -0
  302. package/chunks/{qwenContentGenerator-WWDXPYQI.js → qwenContentGenerator-VI4KATRY.js} +58 -58
  303. package/chunks/{qwenOAuth2-OF5WRBQT.js → qwenOAuth2-7AOCKSOQ.js} +7 -7
  304. package/chunks/{read-file-FQUQHC6N.js → read-file-P7F4P7LV.js} +11 -13
  305. package/chunks/{read-mcp-resource-XD257PGJ.js → read-mcp-resource-GLAGB6R7.js} +2 -2
  306. package/chunks/{record-artifact-VW23GS4F.js → record-artifact-SWVR7NSU.js} +4 -4
  307. package/chunks/renderer-selection-M4UN63VJ.js +99 -0
  308. package/chunks/{report-findings-AO5VYFLR.js → report-findings-AL5YW3KI.js} +5 -5
  309. package/chunks/{request-shutdown-BCLA3JV2.js → request-shutdown-5YK4IZ54.js} +8 -7
  310. package/chunks/resumeHistoryUtils-DPZKFW24.js +119 -0
  311. package/chunks/ripGrep-C7LJKUPZ.js +37 -0
  312. package/chunks/{ru-OLTMFJEW.js → ru-QMISLKRH.js} +3 -0
  313. package/chunks/{run-qwen-serve-5X6IDZER.js → run-qwen-serve-OGTEEUR2.js} +589 -251
  314. package/chunks/{runtime-HK27GMPF.js → runtime-LNBLEMZS.js} +73 -72
  315. package/chunks/scheduled-tasks-FLDYZQOF.js +128 -0
  316. package/chunks/{scheduler-WD4MHMO5.js → scheduler-73YXGUGW.js} +62 -61
  317. package/chunks/{sdk-exporters-grpc-G5IT4XS4.js → sdk-exporters-grpc-MXTVSE3C.js} +2 -2
  318. package/chunks/{sdk-exporters-http-TTU2CHBU.js → sdk-exporters-http-3JO5TJNU.js} +4 -4
  319. package/chunks/{sdk-impl-UUMVYMAL.js → sdk-impl-HZAUUTHJ.js} +6 -6
  320. package/chunks/{send-message-AJ4OCUBV.js → send-message-JC7NJTY6.js} +166 -35
  321. package/chunks/serve-3UR2H4CV.js +119 -0
  322. package/chunks/{server-GO2N5DH7.js → server-AOYZVVOM.js} +2904 -860
  323. package/chunks/{session-IFNHTUBT.js → session-UAWFNFGI.js} +119 -114
  324. package/chunks/session-attachments-root-ZCGXQQTR.js +104 -0
  325. package/chunks/{session-pr-refresh-I3UBWMVP.js → session-pr-refresh-CT2INROL.js} +157 -88
  326. package/chunks/{settings-L6N54CU6.js → settings-BHRGDASJ.js} +67 -66
  327. package/chunks/{shell-4Y5LLW6N.js → shell-YHOGC7TO.js} +46 -46
  328. package/chunks/{skill-YOWTRAKQ.js → skill-ZGBKNCHQ.js} +131 -97
  329. package/chunks/skill-settings-AKSP665O.js +119 -0
  330. package/chunks/spawnChannel-N25MBB6F.js +112 -0
  331. package/chunks/standalone-update-XGPWJDRN.js +119 -0
  332. package/chunks/start-opentui-ui-FZ4USOU7.js +55342 -0
  333. package/chunks/{startInteractiveUI-XDFSHBZD.js → startInteractiveUI-E2WQJUOA.js} +3509 -4706
  334. package/chunks/{syntheticOutput-ML43GEFN.js → syntheticOutput-HJNZSEHN.js} +3 -3
  335. package/chunks/{task-create-QN4LYRSE.js → task-create-6RSD54S5.js} +12 -12
  336. package/chunks/{task-list-JPLGK45U.js → task-list-IQSACPOM.js} +34 -11
  337. package/chunks/{task-stop-CXEH5L2D.js → task-stop-HE2LRQNW.js} +2 -2
  338. package/chunks/{task-update-IWEOJFV2.js → task-update-XAJ2NYOA.js} +13 -14
  339. package/chunks/{team-create-OOPXCDBA.js → team-create-SOKMYSQU.js} +54 -55
  340. package/chunks/{team-delete-RZVVSGCY.js → team-delete-NGNNKGMG.js} +25 -8
  341. package/chunks/{team-plan-approval-DSX5EWAT.js → team-plan-approval-U7ZWXYAY.js} +46 -46
  342. package/chunks/terminal-image-renderer-KKM4OBLO.js +117 -0
  343. package/chunks/theme-manager-GQHF3A7T.js +103 -0
  344. package/chunks/{todoWrite-WDJNQEMW.js → todoWrite-5UTVUXHA.js} +39 -9
  345. package/chunks/{tool-search-J5Q6U7DN.js → tool-search-IAI2RVWT.js} +21 -19
  346. package/chunks/total-session-admission-G4CGCSTG.js +113 -0
  347. package/chunks/trustedFolders-D2I3FDPB.js +123 -0
  348. package/chunks/{update-relaunch-SIKHLHVR.js → update-relaunch-5RWKZAL3.js} +5 -5
  349. package/chunks/updateCheck-ZXOQDFEI.js +119 -0
  350. package/chunks/useAutoAcceptIndicator-6EK4QGAH.js +121 -0
  351. package/chunks/{validateNonInterActiveAuth-JUDQP6V4.js → validateNonInterActiveAuth-QPFEKATS.js} +113 -109
  352. package/chunks/{version-C63GDDWN.js → version-JKNG7YDH.js} +1 -1
  353. package/chunks/{web-fetch-FOQZMNSC.js → web-fetch-X3AHIIHW.js} +16 -19
  354. package/chunks/{web-search-PUJTBFUC.js → web-search-K2FMOGS5.js} +10 -11
  355. package/chunks/{web-shell-static-HNB4FDOE.js → web-shell-static-POZHGGXE.js} +5 -4
  356. package/chunks/{workflow-Y5IPINVH.js → workflow-TOLPAK5G.js} +213 -119
  357. package/chunks/workspace-providers-status-PCJK3RC7.js +115 -0
  358. package/chunks/{workspace-registration-store-SMJWI2AI.js → workspace-registration-store-KQWVVW4Y.js} +2 -1
  359. package/chunks/workspace-registry-YNIOB6HJ.js +122 -0
  360. package/chunks/workspace-runtime-coordinator-WG2RNEN7.js +123 -0
  361. package/chunks/workspace-service-G4ZNBOFH.js +127 -0
  362. package/chunks/workspace-skills-status-FMTPPMWC.js +114 -0
  363. package/chunks/{workspace-trust-reconciler-PLIDLJZX.js → workspace-trust-reconciler-IBDFQBQS.js} +76 -77
  364. package/chunks/wrapper-JH3IFHT2.js +35 -0
  365. package/chunks/write-file-YTLFY2S5.js +88 -0
  366. package/chunks/{zh-UNY63FR3.js → zh-25DF7OGK.js} +5 -0
  367. package/chunks/{zh-TW-RPTMRTHG.js → zh-TW-5EDMZVGK.js} +5 -0
  368. package/chunks/{zoom-image-LYQD7BQA.js → zoom-image-IFXSN74N.js} +11 -13
  369. package/cli.js +131 -90
  370. package/locales/ca.js +6 -0
  371. package/locales/de.js +6 -0
  372. package/locales/en.js +9 -0
  373. package/locales/fr.js +6 -0
  374. package/locales/ja.js +6 -0
  375. package/locales/pt.js +6 -0
  376. package/locales/ru.js +6 -0
  377. package/locales/zh-TW.js +9 -0
  378. package/locales/zh.js +9 -0
  379. package/package.json +3 -3
  380. package/web-shell/assets/{abnfDiagram-VCTEODGH-TRCMSA_6.js → abnfDiagram-VCTEODGH-Cxf7xE_Z.js} +1 -1
  381. package/web-shell/assets/{arc-D9Uls5b3.js → arc-ESi1eNkE.js} +1 -1
  382. package/web-shell/assets/{architectureDiagram-5GKGNRK7-Bwb8jPXg.js → architectureDiagram-5GKGNRK7-D9l7-bDo.js} +1 -1
  383. package/web-shell/assets/{blockDiagram-NRAW4CY4-DHj71TSX.js → blockDiagram-NRAW4CY4-Bc8DEasw.js} +1 -1
  384. package/web-shell/assets/{c4Diagram-UCG6FXSJ-uKBBdbyr.js → c4Diagram-UCG6FXSJ-Dimb2Hmh.js} +1 -1
  385. package/web-shell/assets/channel-B7ohGDil.js +1 -0
  386. package/web-shell/assets/{chunk-2Q5K7J3B-BZd0Phrl.js → chunk-2Q5K7J3B-jVDmOpAQ.js} +1 -1
  387. package/web-shell/assets/{chunk-5VM5RSS4-7KNeNBqN.js → chunk-5VM5RSS4-DbG_SwdB.js} +1 -1
  388. package/web-shell/assets/{chunk-F27PBJKO-BeboS7Fi.js → chunk-F27PBJKO-QEc4cY1v.js} +1 -1
  389. package/web-shell/assets/{chunk-G27WJ6UU-RV3JONoj.js → chunk-G27WJ6UU-iJ36lQ3X.js} +1 -1
  390. package/web-shell/assets/{chunk-JWPE2WC7-Yw9FCFsP.js → chunk-JWPE2WC7-DuArnVtF.js} +1 -1
  391. package/web-shell/assets/{chunk-LCL6LL3I-GIMnydDe.js → chunk-LCL6LL3I-DxOf1zwL.js} +1 -1
  392. package/web-shell/assets/{chunk-POPQ4Y6H-Cfrux7bL.js → chunk-POPQ4Y6H-lVLu9Ild.js} +1 -1
  393. package/web-shell/assets/{chunk-SVP7TREG-BlvIN0CO.js → chunk-SVP7TREG-C6XYlIer.js} +1 -1
  394. package/web-shell/assets/{chunk-XXDRQBXY-DMs7Rr4t.js → chunk-XXDRQBXY-CiG2j2Ji.js} +1 -1
  395. package/web-shell/assets/classDiagram-DTDB5LWJ-DdFpqpfD.js +1 -0
  396. package/web-shell/assets/classDiagram-v2-JRS7N3AN-DdFpqpfD.js +1 -0
  397. package/web-shell/assets/{cose-bilkent-JH36ORCC-DNGqTNwI.js → cose-bilkent-JH36ORCC-DGVHMMVm.js} +1 -1
  398. package/web-shell/assets/{cynefin-OW5HDTMX-CojMpaoH.js → cynefin-OW5HDTMX-D6cgpCnH.js} +1 -1
  399. package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-DF07YXGo.js → cynefinDiagram-5FMLGOSQ-BKv4Z-UX.js} +1 -1
  400. package/web-shell/assets/{dagre-3AP2YEHR-17-4WtCH.js → dagre-3AP2YEHR-B4ABMIG-.js} +1 -1
  401. package/web-shell/assets/{diagram-S7CK7UJ4-G3Wuyz9m.js → diagram-S7CK7UJ4-DgCkp_Lm.js} +1 -1
  402. package/web-shell/assets/{diagram-UQ7AKVKN-nyWIKZ8P.js → diagram-UQ7AKVKN-FG0FNokz.js} +1 -1
  403. package/web-shell/assets/{diagram-VSXAHHWV-tKHhmYSC.js → diagram-VSXAHHWV-JgkP9qg-.js} +1 -1
  404. package/web-shell/assets/{diagram-VX7I27RA-CpDf1hYk.js → diagram-VX7I27RA-ADh2x83l.js} +1 -1
  405. package/web-shell/assets/{diagram-Z3DM3KII-Cah2IFXG.js → diagram-Z3DM3KII-yXqoYF1J.js} +1 -1
  406. package/web-shell/assets/{ebnfDiagram-PWID7BFC-DNaCkgxy.js → ebnfDiagram-PWID7BFC-Duk83Ek_.js} +1 -1
  407. package/web-shell/assets/{erDiagram-SSCWMZ5O-CAdRgcf1.js → erDiagram-SSCWMZ5O-DMdvxySG.js} +1 -1
  408. package/web-shell/assets/{flowDiagram-A5DVABFB-CMUJAShL.js → flowDiagram-A5DVABFB-DHjVgSji.js} +1 -1
  409. package/web-shell/assets/{ganttDiagram-EL5Y4UJY-o-_MUNey.js → ganttDiagram-EL5Y4UJY-DMM9DkCE.js} +1 -1
  410. package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-_aG-2Z7O.js → gitGraphDiagram-WWUBYQGX-t_ug9vO8.js} +1 -1
  411. package/web-shell/assets/index-BGZRqbRo.css +36 -0
  412. package/web-shell/assets/index-DRri_6_x.js +2067 -0
  413. package/web-shell/assets/{index-BK_NKxiJ.js → index-zqvnpGHv.js} +1 -1
  414. package/web-shell/assets/{infoDiagram-RXCK75RN-qJPeZbGP.js → infoDiagram-RXCK75RN-eT1fANNm.js} +1 -1
  415. package/web-shell/assets/{ishikawaDiagram-5VMMS53U-7Om4vNo1.js → ishikawaDiagram-5VMMS53U-k3evzZNn.js} +1 -1
  416. package/web-shell/assets/{journeyDiagram-EYS64GPL-BNtXqmBW.js → journeyDiagram-EYS64GPL-CGim3EAi.js} +1 -1
  417. package/web-shell/assets/{kanban-definition-3QL26DDD-COgFec8P.js → kanban-definition-3QL26DDD-WHfJo-22.js} +1 -1
  418. package/web-shell/assets/{layout-B9n81PC9.js → layout-DkqIaFlJ.js} +1 -1
  419. package/web-shell/assets/{linear-Bb6nXZQq.js → linear-Bdkd3mCz.js} +1 -1
  420. package/web-shell/assets/{mermaid.core-Cgrm3JVT.js → mermaid.core-CGw0LkT_.js} +6 -6
  421. package/web-shell/assets/{mindmap-definition-FBJOCRG2-TKwLTjnG.js → mindmap-definition-FBJOCRG2-C9V4rBvo.js} +1 -1
  422. package/web-shell/assets/{pegDiagram-XKGWAZYB-BJPuvlpi.js → pegDiagram-XKGWAZYB-CwoI2T5G.js} +1 -1
  423. package/web-shell/assets/{pieDiagram-E7YTZNPT-D01VkNsW.js → pieDiagram-E7YTZNPT-DaTmBmPG.js} +1 -1
  424. package/web-shell/assets/{quadrantDiagram-AXDQQJYC-C4hHsiv-.js → quadrantDiagram-AXDQQJYC-plh6MyGI.js} +1 -1
  425. package/web-shell/assets/{railroadDiagram-O6MQD6OU-CuEO4xK2.js → railroadDiagram-O6MQD6OU-D_b-S0iK.js} +1 -1
  426. package/web-shell/assets/{requirementDiagram-EFPCY7ZU-D5J_vIo5.js → requirementDiagram-EFPCY7ZU-zUzTN7VE.js} +1 -1
  427. package/web-shell/assets/{sankeyDiagram-P5KCCOFB-DQKY223V.js → sankeyDiagram-P5KCCOFB-m6AhoD0l.js} +1 -1
  428. package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-D27YV_cm.js → sequenceDiagram-WJ2MYXX4-Cwhzsine.js} +1 -1
  429. package/web-shell/assets/{sizeCapture-X5ZJPWSS-TJg8UcwV.js → sizeCapture-X5ZJPWSS-CcZuKIae.js} +1 -1
  430. package/web-shell/assets/{stateDiagram-HBIQ2CUA-CmnPzUIx.js → stateDiagram-HBIQ2CUA-CFoiJwD_.js} +1 -1
  431. package/web-shell/assets/stateDiagram-v2-4QOOHH4V--H8HdEmk.js +1 -0
  432. package/web-shell/assets/{swimlanes-XN3QIQJK-ByeP3_Nu.js → swimlanes-XN3QIQJK-CgS9hcaV.js} +1 -1
  433. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-ShE9OIgf.js +8 -0
  434. package/web-shell/assets/{timeline-definition-24CTP7MA-BsFA5juR.js → timeline-definition-24CTP7MA-Dzzc05t9.js} +1 -1
  435. package/web-shell/assets/{vennDiagram-4TSXK5OY-DREP2ECo.js → vennDiagram-4TSXK5OY-DemK0f7Y.js} +1 -1
  436. package/web-shell/assets/{wardleyDiagram-VM6X3IG4-iyd9lKi2.js → wardleyDiagram-VM6X3IG4-CquLxtMr.js} +1 -1
  437. package/web-shell/assets/{xychartDiagram-S5SC5T6Z-CVr1_j9q.js → xychartDiagram-S5SC5T6Z-BTBKTM5g.js} +1 -1
  438. package/web-shell/index.html +196 -2
  439. package/chunks/MaxSizedBox-X42SXBJH.js +0 -110
  440. package/chunks/agent-headless-IZM25LJA.js +0 -85
  441. package/chunks/bridge-ME6QXZNA.js +0 -119
  442. package/chunks/channel-settings-store-PEOI7XCG.js +0 -120
  443. package/chunks/chunk-7J6OTNGO.js +0 -424
  444. package/chunks/chunk-BWORX6FA.js +0 -135
  445. package/chunks/chunk-CPBF7KYF.js +0 -51
  446. package/chunks/chunk-H72BQNM3.js +0 -645
  447. package/chunks/chunk-JHYH6PYQ.js +0 -3096
  448. package/chunks/chunk-SS4MRMKE.js +0 -3525
  449. package/chunks/chunk-T4EFG2P5.js +0 -113
  450. package/chunks/chunk-XZA32HII.js +0 -19
  451. package/chunks/chunk-ZYNTSXWK.js +0 -32
  452. package/chunks/config-utils-R6M3TA34.js +0 -113
  453. package/chunks/contextCommand-ZCAP23J6.js +0 -106
  454. package/chunks/daemon-status-provider-K3SJ5C2U.js +0 -117
  455. package/chunks/daemon-trust-policy-DOR3YG62.js +0 -112
  456. package/chunks/deferred-core-runtime-WOYLUQQ7.js +0 -114
  457. package/chunks/earlyInputCapture-OHBEVO4K.js +0 -107
  458. package/chunks/errors-WAK6KFBC.js +0 -113
  459. package/chunks/exitPlanMode-UEYBG6P5.js +0 -83
  460. package/chunks/goal-tools-PTD3MBA7.js +0 -411
  461. package/chunks/handleAutoUpdate-FP3NWNSG.js +0 -109
  462. package/chunks/i18n-INIU5X7A.js +0 -124
  463. package/chunks/initializer-TYODV6GE.js +0 -113
  464. package/chunks/installationInfo-AAPKYDSZ.js +0 -107
  465. package/chunks/list-TUODDN6J.js +0 -116
  466. package/chunks/list-agents-DI3YFTDT.js +0 -80
  467. package/chunks/loadedSettingsAdapter-KJCLZ3C4.js +0 -110
  468. package/chunks/mcp-MWSAPFOL.js +0 -110
  469. package/chunks/nonInteractiveCli-JXKL343Q.js +0 -185
  470. package/chunks/pidfile-QOIQZFT2.js +0 -111
  471. package/chunks/prompt-terminal-ledger-FOMFTYOM.js +0 -105
  472. package/chunks/resumeHistoryUtils-NSGF3UCB.js +0 -118
  473. package/chunks/ripGrep-4CAT6SKV.js +0 -39
  474. package/chunks/scheduled-tasks-MN2ZZ5P6.js +0 -127
  475. package/chunks/serve-2XCHPPGG.js +0 -118
  476. package/chunks/skill-settings-ZL4JY5UE.js +0 -118
  477. package/chunks/spawnChannel-ZST6XJVJ.js +0 -112
  478. package/chunks/standalone-update-THVU3OKY.js +0 -118
  479. package/chunks/terminal-image-renderer-KS25G33E.js +0 -114
  480. package/chunks/theme-manager-YMZNG45F.js +0 -102
  481. package/chunks/total-session-admission-PVN64JVV.js +0 -114
  482. package/chunks/trustedFolders-FATSC4YI.js +0 -122
  483. package/chunks/updateCheck-D3YG2WCD.js +0 -118
  484. package/chunks/useAutoAcceptIndicator-ILINOSAS.js +0 -120
  485. package/chunks/workspace-providers-status-IJ4VHFMB.js +0 -114
  486. package/chunks/workspace-registry-BTGZIMPK.js +0 -123
  487. package/chunks/workspace-service-SIN67ITC.js +0 -126
  488. package/chunks/workspace-skills-status-F3RKCUIX.js +0 -113
  489. package/chunks/write-file-PAIGB33C.js +0 -88
  490. package/web-shell/assets/channel-CXjVLaBa.js +0 -1
  491. package/web-shell/assets/classDiagram-DTDB5LWJ-DANEijO3.js +0 -1
  492. package/web-shell/assets/classDiagram-v2-JRS7N3AN-DANEijO3.js +0 -1
  493. package/web-shell/assets/index-Ci-z4zWY.js +0 -1913
  494. package/web-shell/assets/index-LDlXZRHA.css +0 -36
  495. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-DNKPyrDc.js +0 -1
  496. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-ZL1HPC6w.js +0 -8
  497. /package/chunks/{chunk-FOGQO4FG.js → chunk-JA5CBKRP.js} +0 -0
@@ -1,12 +1,14 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
3
  import {
4
- recomputeMcpGating
5
- } from "./chunk-2HYKTO7V.js";
4
+ classifyApiError
5
+ } from "./chunk-V7RNNPGC.js";
6
6
  import {
7
- classifyApiError,
8
7
  fireSessionDeleteHook
9
- } from "./chunk-P5Y23G2L.js";
8
+ } from "./chunk-L34XSHIZ.js";
9
+ import {
10
+ normalizePartList
11
+ } from "./chunk-5IENVM7Z.js";
10
12
  import {
11
13
  EXTENSION_CONTEXT_BUDGET,
12
14
  buildExtensionMentionContext,
@@ -14,10 +16,9 @@ import {
14
16
  extractAtPathCommands,
15
17
  matchExtensionByRef,
16
18
  matchMcpServerByRef,
17
- normalizePartList,
18
19
  parseExtensionRef,
19
20
  parseMcpServerRef
20
- } from "./chunk-PADPMMYM.js";
21
+ } from "./chunk-LOBDDFYK.js";
21
22
  import {
22
23
  getAvailableCommands,
23
24
  getSlashCommandFirstToken,
@@ -26,53 +27,59 @@ import {
26
27
  isSlashCommand,
27
28
  recordDaemonSessionModel,
28
29
  restoreSessionModelThenAuthenticate
29
- } from "./chunk-DJEZ55D4.js";
30
+ } from "./chunk-NVVJTUSL.js";
31
+ import {
32
+ recomputeMcpGating
33
+ } from "./chunk-UUASLXHW.js";
30
34
  import {
31
35
  SessionIdConflictError,
32
36
  appEvents,
33
37
  buildDisabledSkillNamesProvider,
38
+ buildEnabledSkillNamesProvider,
34
39
  cleanupReviewWorktreeLeases,
35
40
  loadCliConfig,
36
- normalizeDisabledToolList
37
- } from "./chunk-DJPASAUV.js";
38
- import "./chunk-NYX53SV4.js";
39
- import {
40
- collectContextData,
41
- formatContextUsageText
42
- } from "./chunk-6X7EU5TI.js";
41
+ normalizeDisabledToolList,
42
+ parseApprovalModeValue
43
+ } from "./chunk-MP6YZ4RK.js";
43
44
  import {
44
45
  getCommandSubcommandNames
45
- } from "./chunk-4TT3IVGA.js";
46
+ } from "./chunk-EIY7SUPZ.js";
46
47
  import {
47
48
  getEffectiveSupportedModes
48
- } from "./chunk-WGY3AVGM.js";
49
- import "./chunk-CFJY4DGX.js";
50
- import "./chunk-4WGODMVR.js";
49
+ } from "./chunk-5RTTI4GE.js";
51
50
  import "./chunk-3SH53ANB.js";
51
+ import "./chunk-NYX53SV4.js";
52
+ import "./chunk-M4LBBSVP.js";
53
+ import {
54
+ collectContextData,
55
+ formatContextUsageText
56
+ } from "./chunk-SX2QIMJV.js";
57
+ import "./chunk-4WGODMVR.js";
58
+ import {
59
+ startNonInteractiveOpenAILogHousekeeping
60
+ } from "./chunk-GXUTFQXK.js";
61
+ import "./chunk-KW7NOTN6.js";
62
+ import "./chunk-JHN7UIDW.js";
63
+ import "./chunk-5EIOJGCR.js";
64
+ import "./chunk-37JFWFCD.js";
52
65
  import {
53
66
  isGoalStatusKind
54
67
  } from "./chunk-EKTCKZV5.js";
55
- import "./chunk-ZYMLPEZQ.js";
68
+ import "./chunk-UM2FFKXN.js";
56
69
  import "./chunk-YAF2MQZ6.js";
57
- import "./chunk-QFCDF5PL.js";
58
70
  import {
59
- startNonInteractiveOpenAILogHousekeeping
60
- } from "./chunk-LHBUKJG2.js";
61
- import "./chunk-KW7NOTN6.js";
62
- import "./chunk-4VPCTGH6.js";
71
+ computeCpuPercent
72
+ } from "./chunk-LBOVL47Y.js";
73
+ import "./chunk-24FVUD5P.js";
74
+ import "./chunk-EWRW2WQC.js";
63
75
  import "./chunk-6H67XLET.js";
64
76
  import {
65
77
  beginAcpBootstrapConfigProfiling,
66
78
  buildAndFreezeAcpStartupProfile,
67
79
  endAcpBootstrapConfigProfiling,
68
80
  markAcpStartup
69
- } from "./chunk-5JTIYALA.js";
70
- import "./chunk-HP5LR5HL.js";
71
- import "./chunk-MPNBVAEU.js";
72
- import "./chunk-MSBO7X2W.js";
73
- import {
74
- computeCpuPercent
75
- } from "./chunk-LBOVL47Y.js";
81
+ } from "./chunk-JZWOCUZ3.js";
82
+ import "./chunk-VNAYZAFX.js";
76
83
  import {
77
84
  GENERATION_MAX_PROMPT_BYTES,
78
85
  GENERATION_TIMEOUT_MS,
@@ -93,7 +100,7 @@ import {
93
100
  shouldSuppressRememberErrorDetails,
94
101
  workspaceMemoryFailureCode,
95
102
  workspaceMemoryFailureDiagnostics
96
- } from "./chunk-EQSBPBZ3.js";
103
+ } from "./chunk-WP4AX3XD.js";
97
104
  import {
98
105
  BaseEmitter,
99
106
  HistoryReplayer,
@@ -104,33 +111,39 @@ import {
104
111
  hasFullSessionContext,
105
112
  observeAcpToolResultProjection,
106
113
  observeAcpToolResultWire
107
- } from "./chunk-ST5MDGH3.js";
108
- import "./chunk-BFPESSTR.js";
109
- import "./chunk-E7REAOTN.js";
110
- import "./chunk-ZZUKP7HV.js";
114
+ } from "./chunk-QI27MKNQ.js";
115
+ import "./chunk-XEAAO654.js";
116
+ import "./chunk-NRL5CUZT.js";
117
+ import "./chunk-47ECGEJC.js";
111
118
  import "./chunk-2MIN6GRR.js";
112
119
  import "./chunk-QHTIBUWB.js";
113
120
  import "./chunk-TXASDT2M.js";
121
+ import {
122
+ buildToolWriteOriginMeta
123
+ } from "./chunk-VGHZT6JR.js";
124
+ import {
125
+ getConversationDirectoryName,
126
+ hasVerifiableInode,
127
+ isSameConversationPath,
128
+ isSameDirectoryIdentity
129
+ } from "./chunk-PB7JBAHF.js";
130
+ import "./chunk-UXEO7E3V.js";
114
131
  import {
115
132
  isCompatibleLiveSessionSource
116
- } from "./chunk-36LGBEM6.js";
133
+ } from "./chunk-OHU2H5CS.js";
117
134
  import "./chunk-4VQBQLIZ.js";
118
135
  import {
119
136
  DAEMON_OWNED_STANDALONE_CREATION_KEY,
120
137
  SESSION_SOURCE_META_KEY,
121
138
  isReservedStandaloneSessionSourceType,
122
139
  parseSessionSource
123
- } from "./chunk-2TNL5KPM.js";
140
+ } from "./chunk-N4QWUPDM.js";
124
141
  import {
125
- buildToolWriteOriginMeta,
126
- getConversationDirectoryName,
127
- isSameConversationPath
128
- } from "./chunk-U54AYGEC.js";
129
- import "./chunk-RXFQM6FQ.js";
130
- import "./chunk-UXEO7E3V.js";
131
- import {
132
- normalizeChannelDeliveryText
133
- } from "./chunk-4CMJKUND.js";
142
+ buildScheduledTaskRunPrompt,
143
+ normalizeChannelDeliveryText,
144
+ scheduledTaskRunSessionName,
145
+ scheduledTaskRunSourceId
146
+ } from "./chunk-DTVQSSNM.js";
134
147
  import {
135
148
  normalizeSessionIdForLookup,
136
149
  parseCallerSuppliedSessionId
@@ -141,29 +154,43 @@ import {
141
154
  buildPermissionSettings,
142
155
  normalizePermissionRules,
143
156
  readPermissionRuleSet
144
- } from "./chunk-V7EESTJV.js";
157
+ } from "./chunk-I5N4EAS6.js";
145
158
  import {
146
159
  MAX_AUDIO_BYTES,
147
160
  sanitizeVoiceErrorMessage,
148
161
  transcribeVoiceAudio
149
- } from "./chunk-URE3QBBB.js";
162
+ } from "./chunk-LEPCWS5A.js";
150
163
  import {
151
164
  readVoiceModel
152
- } from "./chunk-A3LWD5MK.js";
153
- import "./chunk-YTDVNSUQ.js";
154
- import "./chunk-VGIFXISB.js";
155
- import "./chunk-TVC6HQ2U.js";
156
- import "./chunk-SS4MRMKE.js";
165
+ } from "./chunk-BA4WJC4L.js";
166
+ import "./chunk-QAK5475D.js";
167
+ import "./chunk-RN3YGDCA.js";
168
+ import "./chunk-3JQZVCBI.js";
169
+ import "./chunk-JS73NNWF.js";
170
+ import {
171
+ SCHEDULED_TASK_RUN_SOURCE_TYPE
172
+ } from "./chunk-DSX7KQPM.js";
157
173
  import "./chunk-7U5G6JXI.js";
158
174
  import "./chunk-WCCLLK7X.js";
175
+ import "./chunk-OCPBI7J5.js";
159
176
  import {
177
+ ndJsonStream
178
+ } from "./chunk-4HVH57J3.js";
179
+ import {
180
+ PERSIST_REASONING_SELECTION_META_KEY,
160
181
  REASONING_EFFORT_DEFAULT,
161
182
  REASONING_EFFORT_NAMES,
162
183
  REASONING_EFFORT_NONE,
184
+ REASONING_SELECTION_PERSISTED_META_KEY,
185
+ applyReasoningSelection,
163
186
  buildModelReasoningConfigOption,
164
187
  buildModelReasoningConfigPreview,
165
- getModelConfiguration
166
- } from "./chunk-T4EFG2P5.js";
188
+ clearReasoningRequestOverrides,
189
+ getModelConfiguration,
190
+ isReasoningSelectionSupported,
191
+ parseReasoningSelection,
192
+ resolvePersistedReasoningConfigState
193
+ } from "./chunk-ZJ2LM2SI.js";
167
194
  import {
168
195
  ACP_ROUTE_ID_PREFIX,
169
196
  buildAcpModelOptions,
@@ -172,26 +199,10 @@ import {
172
199
  parseAcpModelOption,
173
200
  resolveAcpModelOption,
174
201
  sanitizeProviderBaseUrl
175
- } from "./chunk-OU5APVWO.js";
202
+ } from "./chunk-6A2D4QSO.js";
176
203
  import {
177
204
  mapSkillConfigToStatus
178
- } from "./chunk-N4X7G4J2.js";
179
- import {
180
- resolveSkillSettings
181
- } from "./chunk-HCOBAG2L.js";
182
- import "./chunk-73RM4POK.js";
183
- import "./chunk-6ZPDLGHN.js";
184
- import "./chunk-57OAHC2Y.js";
185
- import "./chunk-Y5S7LBOZ.js";
186
- import "./chunk-3XKLXHGK.js";
187
- import "./chunk-HVC3PNVC.js";
188
- import "./chunk-V6WHFGST.js";
189
- import {
190
- createLoadedSettingsAdapter
191
- } from "./chunk-7T52W4SW.js";
192
- import {
193
- ndJsonStream
194
- } from "./chunk-H72BQNM3.js";
205
+ } from "./chunk-BHTYRHJF.js";
195
206
  import {
196
207
  ACP_PREFLIGHT_KINDS,
197
208
  IDLE_HOOK_EVENTS,
@@ -199,8 +210,23 @@ import {
199
210
  SERVE_STATUS_EXT_METHODS,
200
211
  STATUS_SCHEMA_VERSION,
201
212
  mapDomainErrorToErrorKind
202
- } from "./chunk-KID24ZFN.js";
203
- import "./chunk-FTF2YIZ5.js";
213
+ } from "./chunk-64QH2UC6.js";
214
+ import {
215
+ resolveSkillSettings
216
+ } from "./chunk-HWVUSYSN.js";
217
+ import "./chunk-DMEUXLSS.js";
218
+ import "./chunk-F7NF2IOE.js";
219
+ import "./chunk-AZJLY2XZ.js";
220
+ import "./chunk-57OAHC2Y.js";
221
+ import "./chunk-PCRBLMIN.js";
222
+ import "./chunk-NXKOVOM5.js";
223
+ import "./chunk-TSZSGQ3N.js";
224
+ import "./chunk-V6WHFGST.js";
225
+ import {
226
+ createLoadedSettingsAdapter
227
+ } from "./chunk-32LU3APX.js";
228
+ import "./chunk-S6H3ELPG.js";
229
+ import "./chunk-7XL4WRXM.js";
204
230
  import {
205
231
  ACTIVE_WORK_CLOSE_IF_UNHELD_PARAM,
206
232
  ACTIVE_WORK_HEARTBEAT_META_KEY,
@@ -231,21 +257,23 @@ import {
231
257
  MID_TURN_QUEUE_DRAIN_METHOD,
232
258
  PROMPT_CANCEL_METHOD,
233
259
  REQUESTED_SESSION_ID_META_KEY,
260
+ SESSION_INITIALIZATION_DEADLINE_META_KEY,
261
+ SESSION_INITIALIZATION_TIMEOUT_ERROR_KIND,
234
262
  TODO_STOP_GUARD_CONTINUATION_CLAIM_METHOD,
235
263
  TODO_STOP_GUARD_QUEUE_RELEASE_METHOD,
236
264
  WORKTREE_MCP_DEFER_META_KEY,
237
265
  clampActiveWorkIntervalMs,
238
266
  isValidTrustedModelPrompt
239
- } from "./chunk-OZ6KS6KW.js";
267
+ } from "./chunk-ZGCKTAL5.js";
240
268
  import {
241
269
  NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE,
242
270
  isNotCurrentlyGeneratingCancelError
243
- } from "./chunk-ERFDKH32.js";
271
+ } from "./chunk-F47DITLZ.js";
244
272
  import "./chunk-6PLDPT2C.js";
245
273
  import "./chunk-FYJ7W2PI.js";
246
274
  import "./chunk-STUJ7IMZ.js";
247
275
  import "./chunk-GYTKQYDB.js";
248
- import "./chunk-RFIDDFAL.js";
276
+ import "./chunk-M4KFODIP.js";
249
277
  import "./chunk-ALMR3E6Q.js";
250
278
  import "./chunk-RKFGE7JH.js";
251
279
  import "./chunk-UDG5EZJI.js";
@@ -259,32 +287,35 @@ import {
259
287
  isValidExternalToolGuardDenialReason
260
288
  } from "./chunk-3VUENPWF.js";
261
289
  import "./chunk-M5GB774H.js";
262
- import "./chunk-7EQQR46F.js";
263
290
  import {
264
291
  ACP_EVENT_LOOP_STALL_RESTART_MS,
265
292
  CHANNEL_PROMPT_META_KEY
266
- } from "./chunk-ICURCKIU.js";
293
+ } from "./chunk-U4DJ5XB3.js";
267
294
  import {
268
295
  AgentSideConnection,
269
296
  PROTOCOL_VERSION,
270
297
  RequestError
271
298
  } from "./chunk-IW6RQPQB.js";
299
+ import "./chunk-ZVP4PWBU.js";
272
300
  import {
273
301
  assembleMcpServers,
274
302
  loadMcpApprovals
275
- } from "./chunk-7VMIMAVB.js";
303
+ } from "./chunk-C2VWOXHS.js";
276
304
  import {
305
+ deleteNestedPropertySafe,
277
306
  getOutputLanguageFilePath,
278
307
  getPersistScopeForModelSelection,
279
308
  getUserSettingsPath,
309
+ getWritableScopes,
280
310
  loadSettings,
281
311
  resolveOutputLanguageOrPreserveAuto,
312
+ settingExistsInScope,
282
313
  updateOutputLanguageFile,
283
314
  writeOutputLanguageAndRegisterPath
284
- } from "./chunk-AIAOIFY4.js";
315
+ } from "./chunk-VWTSRH6C.js";
316
+ import "./chunk-NQ4L2CMD.js";
285
317
  import "./chunk-RKUWKYED.js";
286
- import "./chunk-ZEYFMJQA.js";
287
- import "./chunk-GOXKNSDZ.js";
318
+ import "./chunk-O5CD7T4T.js";
288
319
  import {
289
320
  getSystemDefaultsPath,
290
321
  getSystemSettingsPath
@@ -292,7 +323,7 @@ import {
292
323
  import {
293
324
  getCurrentLanguage,
294
325
  setLanguageAsync
295
- } from "./chunk-CLWO3B77.js";
326
+ } from "./chunk-I4NRYS6A.js";
296
327
  import {
297
328
  SUPPORTED_LANGUAGES
298
329
  } from "./chunk-5EJZE3FP.js";
@@ -300,19 +331,19 @@ import {
300
331
  findEnvFiles,
301
332
  preResolveHomeEnvOverrides,
302
333
  reloadEnvironment
303
- } from "./chunk-XHF7WQ6B.js";
334
+ } from "./chunk-C4TIXFDZ.js";
304
335
  import {
305
336
  ENV_ACP_REPEATED_TOOL_FAILURE_GUARD,
306
337
  QWEN_CODE_SERVE_ENV
307
- } from "./chunk-MZCJWS5Y.js";
308
- import "./chunk-V2NDP3I4.js";
309
- import "./chunk-Q2MSPKIJ.js";
338
+ } from "./chunk-2M3EWQNG.js";
339
+ import "./chunk-2EAZ43JQ.js";
340
+ import "./chunk-NF5J2WFA.js";
341
+ import "./chunk-VBWD6C27.js";
310
342
  import "./chunk-W3N5XAZ6.js";
311
343
  import {
312
- isFolderTrustEnabled,
313
344
  isWorkspaceTrusted,
314
345
  loadTrustedFolders
315
- } from "./chunk-MF7HCQWZ.js";
346
+ } from "./chunk-65HWLGA7.js";
316
347
  import "./chunk-NPQ5ZKRP.js";
317
348
  import "./chunk-MR3PXB6E.js";
318
349
  import {
@@ -342,35 +373,44 @@ import {
342
373
  resolveBaseUrl,
343
374
  runManagedRememberByAgent,
344
375
  subagentGenerator
345
- } from "./chunk-NV55WWD6.js";
346
- import "./chunk-2OUD5T67.js";
376
+ } from "./chunk-JUARRUMA.js";
377
+ import {
378
+ MAX_RETAINED_SNAPSHOTS,
379
+ deleteWorkflowSnapshot,
380
+ listSavedWorkflows,
381
+ listWorkflowSnapshots,
382
+ toSnapshot
383
+ } from "./chunk-I2TMJPCV.js";
347
384
  import "./chunk-XFSFZCM5.js";
348
- import "./chunk-2EAZ43JQ.js";
349
- import "./chunk-NF5J2WFA.js";
350
385
  import {
351
386
  CreateSubSessionTool
352
- } from "./chunk-CQH5KTKC.js";
387
+ } from "./chunk-JR42V4UY.js";
353
388
  import "./chunk-LJZSMWOH.js";
354
- import "./chunk-NMOD2FXQ.js";
355
- import "./chunk-WNPDGUJO.js";
356
- import "./chunk-K5KXUXWC.js";
357
389
  import {
358
390
  restoreWorktreeContext
359
- } from "./chunk-62GQFYID.js";
360
- import "./chunk-AYFA7MZV.js";
361
- import "./chunk-XQFT3QUF.js";
362
- import "./chunk-VTHREBQM.js";
391
+ } from "./chunk-RAFQIHN2.js";
392
+ import "./chunk-L26ONV2Y.js";
393
+ import "./chunk-47RYEQW5.js";
394
+ import "./chunk-IG4W5SJR.js";
363
395
  import "./chunk-ZPJWUGCS.js";
396
+ import "./chunk-4UANMABT.js";
397
+ import "./chunk-ZKFTS3OV.js";
398
+ import "./chunk-ENYUKMFK.js";
399
+ import "./chunk-UKYXYWI2.js";
364
400
  import {
365
401
  clearCachedCredentialFile,
366
402
  qwenOAuth2Events
367
- } from "./chunk-3JXM2CVW.js";
368
- import "./chunk-ST5V3ZOC.js";
403
+ } from "./chunk-3AKCBZVW.js";
404
+ import "./chunk-SULZPKTA.js";
405
+ import "./chunk-VNOVK4I7.js";
369
406
  import {
370
407
  APPROVAL_MODE_INFO,
371
408
  BranchPointInvalidError,
372
409
  ExtensionManager,
373
410
  GLOBAL_DUPLICATE_THRESHOLD,
411
+ GoalConflictError,
412
+ GoalInvalidTransitionError,
413
+ GoalPersistenceUnavailableError,
374
414
  InvalidMcpConfigError,
375
415
  InvalidSessionTranscriptCursorError,
376
416
  MAX_TRANSCRIPT_MESSAGES,
@@ -416,6 +456,7 @@ import {
416
456
  decoratePlanModeShellConfirmation,
417
457
  dedupeToolCallsById,
418
458
  didWriteProjectContextFile,
459
+ emptyGoalSnapshot,
419
460
  encodeSessionTranscriptCursor,
420
461
  evaluateAutoMode,
421
462
  evaluatePermissionFlow,
@@ -434,23 +475,25 @@ import {
434
475
  formatStopHookBlockingCapWarning,
435
476
  generateToolUseId,
436
477
  getActiveGoal,
437
- getArenaSystemReminder,
438
478
  getAutoModePermissionDeniedReason,
439
479
  getEffectivePermissionForConfirmation,
440
480
  getFunctionCallFingerprint,
441
481
  getMCPDiscoveryState,
442
- getPlanModeSystemReminder,
443
482
  getProviderToolCallId,
444
483
  getScopedEnvContents,
445
484
  getStopHookContinuationReason,
446
485
  getToolCallRepeatKey,
486
+ getWorkflowTaskMutationKey,
487
+ goalTurnContext,
447
488
  ideContextStore,
448
489
  injectPermissionRulesIfMissing,
449
490
  isApproveOutcome,
491
+ isCompressionFailureStatus,
450
492
  isDenialFallbackReason,
451
493
  isGatedMcpScope,
452
494
  isPlanModeBlocked,
453
495
  isReplayOfHandledToolCall,
496
+ isTerminalWorkflowStatus,
454
497
  isTurnResultRecordPayload,
455
498
  markDuplicateProviderToolCallResponseSent,
456
499
  matchesAnyServerPattern,
@@ -459,6 +502,9 @@ import {
459
502
  normalizeDerivedBranchTitle,
460
503
  normalizeTurnResultError,
461
504
  observeToolResultBoundary,
505
+ parseGoalControlRequest,
506
+ parseGoalSnapshotV2,
507
+ parseGoalStateCause,
462
508
  persistPermissionOutcome,
463
509
  recordAllow,
464
510
  recordFallbackApprove,
@@ -477,41 +523,51 @@ import {
477
523
  toolResultBoundaryArtifact,
478
524
  toolResultPartDiagnosticValues,
479
525
  truncateNotificationLabel,
526
+ tryWithWorkflowTaskMutation,
480
527
  updateSetting,
481
528
  validatePlanModeShellApproval,
482
529
  validatePlanModeShellContext
483
- } from "./chunk-PZ66FRIC.js";
530
+ } from "./chunk-4F7GQGXB.js";
484
531
  import "./chunk-GOFAQQZA.js";
485
532
  import "./chunk-5M6IDOMF.js";
533
+ import "./chunk-6HUXPLB5.js";
486
534
  import "./chunk-TWPJO254.js";
487
535
  import {
488
536
  external_exports
489
537
  } from "./chunk-CQ35AJ4Z.js";
490
- import "./chunk-EKSCLBBF.js";
491
- import "./chunk-LUEHOUHM.js";
492
- import "./chunk-WXEA74YB.js";
493
- import "./chunk-42IDLQWS.js";
538
+ import "./chunk-NSUKQ4DN.js";
539
+ import "./chunk-DQCKVAF5.js";
540
+ import "./chunk-AI35S34R.js";
541
+ import "./chunk-KM3XVTMO.js";
494
542
  import {
495
543
  parsePositiveIntegerEnv
496
544
  } from "./chunk-6PVPNMXU.js";
497
545
  import {
498
546
  RUNTIME_SNAPSHOT_PREFIX
499
- } from "./chunk-JB4JIVTJ.js";
547
+ } from "./chunk-OKTNXDVO.js";
500
548
  import {
501
549
  SESSION_ARTIFACT_PERSISTENCE_VERSION,
502
550
  normalizeEventPayload,
503
- normalizeSnapshotPayload
504
- } from "./chunk-DJBQCO2E.js";
551
+ normalizeSnapshotPayload,
552
+ wrapUserPromptSubmitContext
553
+ } from "./chunk-EFTPIZIC.js";
505
554
  import "./chunk-IRH27ZC2.js";
506
555
  import "./chunk-QHWCP53L.js";
507
- import "./chunk-D5LUXLUH.js";
556
+ import "./chunk-UJ4DUYIH.js";
557
+ import "./chunk-QJNDUTOL.js";
508
558
  import {
509
559
  promptIdContext,
510
560
  todoWorkChainContext
511
561
  } from "./chunk-O6GEWCJA.js";
512
- import "./chunk-T26EAKDL.js";
513
- import "./chunk-2SXSLSQE.js";
514
- import "./chunk-CPBF7KYF.js";
562
+ import {
563
+ getArenaSystemReminder,
564
+ getOutputStyleTurnReminder,
565
+ getPlanModeSystemReminder,
566
+ resolveMainSessionOutputStyle
567
+ } from "./chunk-OSSTATJF.js";
568
+ import "./chunk-ZHO2CW6D.js";
569
+ import "./chunk-CVX63TFJ.js";
570
+ import "./chunk-373DQUVA.js";
515
571
  import {
516
572
  AgentOutputMessageCapture,
517
573
  addAgentInputMessageAttributes,
@@ -519,59 +575,47 @@ import {
519
575
  addToolCallResultAttributes,
520
576
  registerAcpEventLoopLagGauge,
521
577
  startEventLoopLagMonitor
522
- } from "./chunk-KJO2LBUK.js";
578
+ } from "./chunk-H43PSPYS.js";
523
579
  import {
524
580
  HookEventName,
525
581
  createHookOutput
526
- } from "./chunk-TTX2JUE6.js";
527
- import "./chunk-4K7KNVWH.js";
528
- import "./chunk-SMPR7SPO.js";
529
- import "./chunk-JWALNCLT.js";
530
- import "./chunk-NIFYWDYN.js";
531
- import "./chunk-C2X7KY45.js";
532
- import {
533
- GoalConflictError,
534
- GoalInvalidTransitionError,
535
- GoalPersistenceUnavailableError,
536
- emptyGoalSnapshot,
537
- goalTurnContext,
538
- parseGoalControlRequest,
539
- parseGoalSnapshotV2,
540
- parseGoalStateCause
541
- } from "./chunk-JHYH6PYQ.js";
582
+ } from "./chunk-U6D2PPMN.js";
583
+ import "./chunk-VYIUNFEA.js";
584
+ import "./chunk-KGV55H53.js";
585
+ import "./chunk-7TBU7PU2.js";
586
+ import "./chunk-E4JNFXNI.js";
542
587
  import {
543
- wrapUserPromptSubmitContext
544
- } from "./chunk-7J6OTNGO.js";
588
+ escapeJsonTagCharacters
589
+ } from "./chunk-CHEIIBT3.js";
590
+ import "./chunk-TJYRTS4S.js";
545
591
  import {
546
592
  APPROVAL_MODES
547
- } from "./chunk-V5J4J5TP.js";
593
+ } from "./chunk-JX6XHPTX.js";
548
594
  import "./chunk-MLXTMF7H.js";
549
- import "./chunk-NAVJD2PQ.js";
550
- import "./chunk-B466ZSHZ.js";
551
- import "./chunk-4QHPPXK2.js";
552
- import "./chunk-QHMLYMMS.js";
553
- import {
554
- addDaemonRequestAttribute,
555
- extractDaemonTraceContext,
556
- withDaemonSpan
557
- } from "./chunk-3WK3QDNV.js";
558
- import "./chunk-VNOVK4I7.js";
559
595
  import "./chunk-PQEISIKS.js";
560
- import "./chunk-EB6QRGHM.js";
596
+ import "./chunk-FD5SJOWT.js";
561
597
  import {
562
598
  runWithRuntimeContentGenerator
563
- } from "./chunk-CMHFCLBU.js";
599
+ } from "./chunk-4LIFGNI4.js";
564
600
  import "./chunk-S6LOFUVP.js";
601
+ import "./chunk-NAVJD2PQ.js";
602
+ import "./chunk-KFN2IZYR.js";
603
+ import "./chunk-GB4UKWY5.js";
604
+ import "./chunk-QHMLYMMS.js";
565
605
  import {
566
606
  getToolCallPreparations
567
607
  } from "./chunk-CFKIH3D3.js";
568
608
  import {
569
- REASONING_EFFORT_TIERS,
570
- applyReasoningEffort
609
+ REASONING_EFFORT_TIERS
571
610
  } from "./chunk-2LD5U7Q3.js";
572
611
  import "./chunk-DJ2GSRLV.js";
573
- import "./chunk-DYXFD5RO.js";
574
- import "./chunk-V4264FEG.js";
612
+ import "./chunk-S2T7H5MI.js";
613
+ import "./chunk-LKODFJRD.js";
614
+ import {
615
+ addDaemonRequestAttribute,
616
+ extractDaemonTraceContext,
617
+ withDaemonSpan
618
+ } from "./chunk-LB3WQQJK.js";
575
619
  import {
576
620
  ConversationFinishedEvent,
577
621
  DiscoveredMCPTool,
@@ -597,40 +641,37 @@ import {
597
641
  logUserPrompt,
598
642
  normalizeParts,
599
643
  parseInvocationContext,
644
+ runSideQuery,
600
645
  runVisionBridge,
601
646
  runWithInvocationContext,
602
647
  shouldRunVisionBridge,
603
648
  splitImageParts,
604
649
  uiTelemetryService
605
- } from "./chunk-QYMAKPY5.js";
650
+ } from "./chunk-GH2S4GD5.js";
606
651
  import "./chunk-XBVNNDPK.js";
607
652
  import "./chunk-VGC4I5JJ.js";
608
653
  import {
609
654
  getAllMemoryFilenames,
610
655
  getSpecificMimeType
611
- } from "./chunk-BKWNKLZB.js";
656
+ } from "./chunk-DYTW3QVG.js";
612
657
  import {
613
658
  getAutoMemoryRoot,
614
659
  getUserAutoMemoryRoot
615
- } from "./chunk-6PJOTWAN.js";
616
- import {
617
- runSideQuery
618
- } from "./chunk-BWORX6FA.js";
660
+ } from "./chunk-HT5S5TRQ.js";
619
661
  import "./chunk-WZAD4ZNJ.js";
620
662
  import {
621
663
  DEFAULT_TOKEN_LIMIT,
622
664
  tokenLimit
623
665
  } from "./chunk-FPGTNKCP.js";
624
- import "./chunk-6DIGWMGT.js";
666
+ import "./chunk-EIJT2PQ6.js";
625
667
  import {
626
668
  hasVertexProjectConfigured,
627
669
  preloadContentGenerator
628
- } from "./chunk-W3JH33JE.js";
629
- import "./chunk-XZA32HII.js";
630
- import "./chunk-23RFD54N.js";
670
+ } from "./chunk-BFY33IB4.js";
671
+ import "./chunk-KHP66DFN.js";
631
672
  import {
632
673
  AuthType
633
- } from "./chunk-PPKZ7JOE.js";
674
+ } from "./chunk-22UH7VTP.js";
634
675
  import "./chunk-HHJLM3WQ.js";
635
676
  import {
636
677
  endToolExecutionSpan,
@@ -642,17 +683,18 @@ import {
642
683
  startToolExecutionSpan,
643
684
  startToolSpan,
644
685
  withInteractionSpan
645
- } from "./chunk-B5PHIJGI.js";
686
+ } from "./chunk-QKDNS6FU.js";
646
687
  import "./chunk-74TONY4F.js";
647
- import "./chunk-XF63PKEN.js";
688
+ import "./chunk-ZDFQGHZH.js";
648
689
  import {
649
690
  FORK_SUBAGENT_TYPE,
650
691
  getStartupContextLength,
651
- isSystemReminderContent
652
- } from "./chunk-CAJTKR6W.js";
653
- import "./chunk-ZU4UDIWX.js";
692
+ isSystemReminderContent,
693
+ wrapSystemReminder
694
+ } from "./chunk-G7HBEEX7.js";
695
+ import "./chunk-QQD2GART.js";
654
696
  import "./chunk-AQ37AY7B.js";
655
- import "./chunk-PDQGMSZK.js";
697
+ import "./chunk-ODZF64DM.js";
656
698
  import {
657
699
  BaseDeclarativeTool,
658
700
  BaseToolInvocation,
@@ -660,7 +702,7 @@ import {
660
702
  ToolNames,
661
703
  canonicalToolName,
662
704
  isShellProgressData
663
- } from "./chunk-UTLCH2FK.js";
705
+ } from "./chunk-7JMGTOH7.js";
664
706
  import {
665
707
  Storage,
666
708
  createDebugLogger,
@@ -668,11 +710,12 @@ import {
668
710
  getErrorStatus,
669
711
  isSubpath,
670
712
  sessionIdContext
671
- } from "./chunk-UHQFIS7N.js";
672
- import "./chunk-MK2GIB46.js";
713
+ } from "./chunk-EAHOJF6V.js";
714
+ import "./chunk-QJGYU5PG.js";
715
+ import "./chunk-HRPFBHW7.js";
673
716
  import {
674
717
  runExitCleanup
675
- } from "./chunk-MO3FC2WT.js";
718
+ } from "./chunk-RJUVTJEZ.js";
676
719
  import {
677
720
  writeStderrLine,
678
721
  writeStderrLineSafe
@@ -693,6 +736,7 @@ import {
693
736
  init_esbuild_shims();
694
737
  import { randomUUID as randomUUID2, timingSafeEqual } from "node:crypto";
695
738
  import { performance } from "node:perf_hooks";
739
+ import { isDeepStrictEqual } from "node:util";
696
740
 
697
741
  // packages/cli/src/acp-integration/authMethods.ts
698
742
  init_esbuild_shims();
@@ -1075,7 +1119,7 @@ import * as path3 from "node:path";
1075
1119
  // packages/cli/src/acp-integration/live/capture-screen-context.ts
1076
1120
  init_esbuild_shims();
1077
1121
  import { constants } from "node:fs";
1078
- import { open, unlink } from "node:fs/promises";
1122
+ import { lstat, open, unlink } from "node:fs/promises";
1079
1123
  import { tmpdir } from "node:os";
1080
1124
  import { dirname, join, resolve as resolve2 } from "node:path";
1081
1125
  var MAX_SCREENSHOT_BYTES = 8 * 1024 * 1024;
@@ -1100,6 +1144,9 @@ function resolvePrivatePngPath(path7, captureDirectory) {
1100
1144
  }
1101
1145
  __name(resolvePrivatePngPath, "resolvePrivatePngPath");
1102
1146
  async function readPrivatePng(path7) {
1147
+ if ((await lstat(path7)).isSymbolicLink()) {
1148
+ throw new Error("Host returned a symbolic link screenshot path.");
1149
+ }
1103
1150
  const handle = await open(path7, constants.O_RDONLY | constants.O_NOFOLLOW);
1104
1151
  try {
1105
1152
  const stat2 = await handle.stat();
@@ -1152,11 +1199,13 @@ var CaptureScreenContextInvocation = class extends BaseToolInvocation {
1152
1199
  signal.throwIfAborted();
1153
1200
  const screenshot = await readPrivatePng(screenshotPath);
1154
1201
  signal.throwIfAborted();
1155
- const serializedContext = JSON.stringify({
1156
- appName: result.appName,
1157
- ...result.windowTitle ? { windowTitle: result.windowTitle } : {},
1158
- accessibilityText: result.accessibilityText
1159
- }).replace(/</gu, "\\u003c");
1202
+ const serializedContext = escapeJsonTagCharacters(
1203
+ JSON.stringify({
1204
+ appName: result.appName,
1205
+ ...result.windowTitle ? { windowTitle: result.windowTitle } : {},
1206
+ accessibilityText: result.accessibilityText
1207
+ })
1208
+ );
1160
1209
  return {
1161
1210
  llmContent: [
1162
1211
  {
@@ -3158,6 +3207,7 @@ __name(reduceRepeatedToolFailureGuard, "reduceRepeatedToolFailureGuard");
3158
3207
  // packages/cli/src/acp-integration/session/Session.ts
3159
3208
  var debugLogger6 = createDebugLogger("SESSION");
3160
3209
  var permissionRequestTails = /* @__PURE__ */ new WeakMap();
3210
+ var MAX_RETAINED_SESSION_ROUTE_COUNTS = 8;
3161
3211
  var USER_CANCEL_ABORT_REASON = "qwen:user-cancel";
3162
3212
  var NEW_PROMPT_ABORT_REASON = "qwen:new-prompt";
3163
3213
  var SESSION_DISPOSE_ABORT_REASON = "qwen:session-dispose";
@@ -3205,10 +3255,6 @@ function isTodoStopGuardPromptText(text) {
3205
3255
  return remainder === body || remainder === body + TODO_STOP_GUARD_FINAL_PROMPT_SUFFIX;
3206
3256
  }
3207
3257
  __name(isTodoStopGuardPromptText, "isTodoStopGuardPromptText");
3208
- function isCompressionFailureStatus(status) {
3209
- return status === 2 /* COMPRESSION_FAILED_INFLATED_TOKEN_COUNT */ || status === 3 /* COMPRESSION_FAILED_TOKEN_COUNT_ERROR */ || status === 4 /* COMPRESSION_FAILED_EMPTY_SUMMARY */ || status === 6 /* COMPRESSION_FAILED_OUTPUT_TRUNCATED */;
3210
- }
3211
- __name(isCompressionFailureStatus, "isCompressionFailureStatus");
3212
3258
  async function finalizeToolCallPreparations(tracker, includeResolved, streamName) {
3213
3259
  try {
3214
3260
  await tracker.discard(includeResolved);
@@ -3910,11 +3956,9 @@ async function buildAvailableCommandsSnapshot(config, abortSignal = AbortSignal.
3910
3956
  settings,
3911
3957
  executionPolicy
3912
3958
  );
3913
- const disabledSkillNames = config.getDisabledSkillNames();
3914
3959
  const inactiveSkillRefs = inactiveExtensionSkillRefs(config);
3915
3960
  const visibleSlashCommands = slashCommands.filter((cmd) => {
3916
3961
  if (cmd.kind !== "skill" /* SKILL */ || !cmd.skillDetail) return true;
3917
- const skillName = cmd.skillDetail.name.toLowerCase();
3918
3962
  const isInactiveExtensionCommand = cmd.skillDetail.level === "extension" && isInactiveExtensionSkill(
3919
3963
  {
3920
3964
  name: cmd.skillDetail.name,
@@ -3923,7 +3967,7 @@ async function buildAvailableCommandsSnapshot(config, abortSignal = AbortSignal.
3923
3967
  },
3924
3968
  inactiveSkillRefs
3925
3969
  );
3926
- return !disabledSkillNames.has(skillName) && !isInactiveExtensionCommand;
3970
+ return config.isSkillEnabled(cmd.skillDetail) && !isInactiveExtensionCommand;
3927
3971
  });
3928
3972
  const availableCommands = visibleSlashCommands.map(
3929
3973
  (cmd) => {
@@ -3954,7 +3998,7 @@ async function buildAvailableCommandsSnapshot(config, abortSignal = AbortSignal.
3954
3998
  const skillManager = config.getSkillManager();
3955
3999
  if (skillManager) {
3956
4000
  const skills = (await skillManager.listSkills()).filter(
3957
- (skill) => !disabledSkillNames.has(skill.name.toLowerCase()) && !isInactiveExtensionSkill(skill, inactiveSkillRefs)
4001
+ (skill) => config.isSkillEnabled(skill) && !isInactiveExtensionSkill(skill, inactiveSkillRefs)
3958
4002
  );
3959
4003
  availableSkills = skills.map((skill) => skill.name);
3960
4004
  for (const skill of skills) {
@@ -3995,13 +4039,15 @@ async function buildAvailableCommandsSnapshot(config, abortSignal = AbortSignal.
3995
4039
  }
3996
4040
  __name(buildAvailableCommandsSnapshot, "buildAvailableCommandsSnapshot");
3997
4041
  var Session = class {
3998
- constructor(id, config, client, settings, runExclusiveAutomaticHistoryMutation = (operation) => operation(), onActiveWorkChanged) {
4042
+ constructor(id, config, client, settings, runExclusiveAutomaticHistoryMutation = (operation) => operation(), onActiveWorkChanged, workflowHistory = [], isWorkflowRunLiveInSiblingSession = () => false) {
3999
4043
  this.config = config;
4000
4044
  this.client = client;
4001
4045
  this.settings = settings;
4002
4046
  this.runExclusiveAutomaticHistoryMutation = runExclusiveAutomaticHistoryMutation;
4003
4047
  this.onActiveWorkChanged = onActiveWorkChanged;
4048
+ this.isWorkflowRunLiveInSiblingSession = isWorkflowRunLiveInSiblingSession;
4004
4049
  this.sessionId = id;
4050
+ this.workflowHistory = [...workflowHistory];
4005
4051
  this.requiresManagedConversationBinding = isReservedStandaloneSessionSourceType(
4006
4052
  this.config.getSessionSourceType?.()
4007
4053
  );
@@ -4009,6 +4055,10 @@ var Session = class {
4009
4055
  this.slashCommandPolicy = this.requiresManagedConversationBinding ? STANDALONE_SLASH_COMMAND_POLICY : void 0;
4010
4056
  this.runtimeBaseDir = config.storage.getRuntimeBaseDir();
4011
4057
  const todoStopGuardEnabled = this.settings.merged.experimental?.todoStopGuard === true && !this.config.getBareMode() && !this.config.isSafeMode();
4058
+ const sessionWorkflowEnabledFromSettings = this.settings.merged.experimental?.sessionWorkflow === true;
4059
+ this.config.setSessionWorkflowEnabledProvider?.(
4060
+ () => sessionWorkflowEnabledFromSettings
4061
+ );
4012
4062
  this.todoStopGuard = new DaemonTodoStopGuard(todoStopGuardEnabled);
4013
4063
  const configuredGuardMode = process.env[ENV_ACP_REPEATED_TOOL_FAILURE_GUARD];
4014
4064
  const parsedGuardMode = parseRepeatedToolFailureGuardMode(configuredGuardMode);
@@ -4081,6 +4131,14 @@ var Session = class {
4081
4131
  cronDisabledByTokenLimit = false;
4082
4132
  lastPromptTokenCount = 0;
4083
4133
  lastPromptTokenCountChat = null;
4134
+ // Private ACP fallback cache, bounded like LlmChat without exposing a
4135
+ // cross-package route resolver just for this closeout.
4136
+ lastPromptTokenCountsByRouteKey = /* @__PURE__ */ new Map();
4137
+ // The model route that produced `lastPromptTokenCount` (Config
4138
+ // .getModelRouteIdentity). ACP model switches keep the same LlmChat, so
4139
+ // the chat-instance check alone never invalidates the count on a route
4140
+ // change (#9529, follow-up to #9454/#9506).
4141
+ lastPromptTokenCountRouteKey = void 0;
4084
4142
  midTurnDrainUnavailable = false;
4085
4143
  midTurnDrainTimeoutStrikes = 0;
4086
4144
  // ACP can continue one logical conversation through prompt, cron, and
@@ -4109,10 +4167,11 @@ var Session = class {
4109
4167
  notificationAbortController = null;
4110
4168
  notificationCompletion = null;
4111
4169
  currentAgentNotificationTaskId = null;
4170
+ currentWorkflowNotificationTaskId = null;
4112
4171
  currentShellNotificationActive = false;
4113
4172
  persistedBackgroundNotificationTaskIds = /* @__PURE__ */ new Set();
4114
4173
  backgroundNotificationAcceptances = /* @__PURE__ */ new Map();
4115
- activeAgentNotificationAcceptances = /* @__PURE__ */ new Set();
4174
+ activeNotificationAcceptances = /* @__PURE__ */ new Set();
4116
4175
  goalQueue = [];
4117
4176
  goalProcessing = false;
4118
4177
  activeGoalTurn;
@@ -4138,9 +4197,38 @@ var Session = class {
4138
4197
  /** The exact status-change callback this Session installed, so dispose can
4139
4198
  * retract its own and nobody else's. */
4140
4199
  #statusChangeCallback;
4200
+ #workflowStatusChangeCallback;
4201
+ workflowHistory;
4202
+ /**
4203
+ * R7-5: runIds whose snapshot write this session has observed. Latches
4204
+ * `#rememberWorkflowHistory` off so a post-persistence status emission
4205
+ * cannot resurrect a sibling-deleted run. See that method.
4206
+ */
4207
+ persistedWorkflowRunIds = /* @__PURE__ */ new Set();
4208
+ /**
4209
+ * R7-4: every runId the last `refreshWorkflowHistory` merged, BEFORE the
4210
+ * MAX_RETAINED_SNAPSHOTS cap. `workflowHistory` is the display window;
4211
+ * this is what deletion tests membership against.
4212
+ */
4213
+ mergedWorkflowRunIds = /* @__PURE__ */ new Set();
4214
+ unpersistedWorkflowHistory = /* @__PURE__ */ new Map();
4215
+ /**
4216
+ * Deletion order, so a refresh can tell which runs were deleted AFTER
4217
+ * its disk read began. `refreshWorkflowHistory` reads the directory
4218
+ * and then merges without holding a claim, while deletion holds one —
4219
+ * a delete that lands between the read and the merge would otherwise
4220
+ * be overwritten by the stale listing and the run would reappear
4221
+ * until the next refresh. Keyed by runId so a later re-run of the same
4222
+ * id (a retry reuses it) is not suppressed: its sequence predates that
4223
+ * refresh's mark.
4224
+ */
4225
+ workflowDeletionSeq = 0;
4226
+ workflowDeletionSeqByRunId = /* @__PURE__ */ new Map();
4141
4227
  #shellStatusChangeCallback;
4142
4228
  workflowApprovalAbortController = new AbortController();
4143
4229
  activeTodoPlanRevision;
4230
+ activeTodoPlanStructure;
4231
+ todoPlanRevisionGeneration = 0;
4144
4232
  // Modular components
4145
4233
  historyReplayer;
4146
4234
  toolCallEmitter;
@@ -4186,6 +4274,7 @@ var Session = class {
4186
4274
  restoredAskUserQuestionSkipPersistence = false;
4187
4275
  // Implement SessionContext interface
4188
4276
  sessionId;
4277
+ sessionReasoningSelection;
4189
4278
  #bindGoalRuntime() {
4190
4279
  try {
4191
4280
  const runtime = this.config.getGoalRuntime();
@@ -4705,7 +4794,10 @@ var Session = class {
4705
4794
  this.#clearTodoStopGuardTrustAndDrainAutomaticQueues();
4706
4795
  }
4707
4796
  clearActiveTodoPlanRevision() {
4797
+ this.todoPlanRevisionGeneration++;
4708
4798
  this.activeTodoPlanRevision = void 0;
4799
+ this.activeTodoPlanStructure = void 0;
4800
+ this.config.clearSessionWorkflowPlanRevision?.();
4709
4801
  }
4710
4802
  hardSuspendTodoStopGuard() {
4711
4803
  this.#clearTodoStopGuardQueuedPromptWait();
@@ -4797,6 +4889,7 @@ var Session = class {
4797
4889
  const agents = this.config.getBackgroundTaskRegistry?.()?.getAll?.() ?? [];
4798
4890
  const shells = this.config.getBackgroundShellRegistry?.()?.getAll?.() ?? [];
4799
4891
  const monitors = this.config.getMonitorRegistry?.()?.getAll?.() ?? [];
4892
+ const workflows = this.config.getWorkflowRunRegistry?.()?.list?.() ?? [];
4800
4893
  const wakeups = this.config.isCronEnabled?.() ? (this.config.getCronScheduler?.()?.list?.() ?? []).filter(
4801
4894
  (job) => job.cronExpr === "@wakeup"
4802
4895
  ) : [];
@@ -4813,6 +4906,7 @@ var Session = class {
4813
4906
  ...monitors.map((task) => task.id),
4814
4907
  ...this.notificationQueue.filter((item) => item.kind === "monitor").map((item) => item.taskId)
4815
4908
  ]),
4909
+ workflows: new Set(workflows),
4816
4910
  wakeups: /* @__PURE__ */ new Set([
4817
4911
  ...wakeups.map((job) => job.id),
4818
4912
  ...this.cronQueue.flatMap(
@@ -4882,6 +4976,12 @@ var Session = class {
4882
4976
  )) {
4883
4977
  return true;
4884
4978
  }
4979
+ const workflows = this.config.getWorkflowRunRegistry?.()?.list?.() ?? [];
4980
+ if (workflows.some(
4981
+ (task) => !baseline.workflows.has(task) && !isTerminalWorkflowStatus(task.status)
4982
+ )) {
4983
+ return true;
4984
+ }
4885
4985
  if (!this.config.isCronEnabled?.()) return false;
4886
4986
  const wakeups = this.config.getCronScheduler?.()?.list?.() ?? [];
4887
4987
  return wakeups.some(
@@ -5147,6 +5247,131 @@ var Session = class {
5147
5247
  getConfig() {
5148
5248
  return this.config;
5149
5249
  }
5250
+ getWorkflowHistory() {
5251
+ return this.workflowHistory;
5252
+ }
5253
+ async refreshWorkflowHistory() {
5254
+ const deletionMark = this.workflowDeletionSeq;
5255
+ const persisted = await listWorkflowSnapshots(this.config);
5256
+ const byRunId = new Map(
5257
+ persisted.map((snapshot) => [snapshot.runId, snapshot])
5258
+ );
5259
+ for (const [runId, seq] of this.workflowDeletionSeqByRunId) {
5260
+ if (seq > deletionMark) byRunId.delete(runId);
5261
+ }
5262
+ for (const [runId, snapshot] of this.unpersistedWorkflowHistory) {
5263
+ const stored = byRunId.get(runId);
5264
+ if (stored === void 0) {
5265
+ byRunId.set(runId, snapshot);
5266
+ } else {
5267
+ this.unpersistedWorkflowHistory.delete(runId);
5268
+ }
5269
+ }
5270
+ this.mergedWorkflowRunIds = new Set(byRunId.keys());
5271
+ this.workflowHistory = [...byRunId.values()].sort((a, b) => b.startTime - a.startTime).slice(0, MAX_RETAINED_SNAPSHOTS);
5272
+ this.#pruneUnpersistedWorkflowHistory();
5273
+ return this.workflowHistory;
5274
+ }
5275
+ async deleteWorkflowHistory(runId) {
5276
+ const attempt = await tryWithWorkflowTaskMutation(
5277
+ getWorkflowTaskMutationKey(this.config, runId),
5278
+ () => this.#deleteWorkflowHistoryClaimed(runId)
5279
+ );
5280
+ return attempt.acquired ? attempt.value : false;
5281
+ }
5282
+ async #deleteWorkflowHistoryClaimed(runId) {
5283
+ const registry = this.config.getWorkflowRunRegistry();
5284
+ const isDeletable = /* @__PURE__ */ __name(() => {
5285
+ if (this.isWorkflowRunLiveInSiblingSession(runId)) return false;
5286
+ if (registry.isStarting?.(runId)) return false;
5287
+ const current = registry.get(runId);
5288
+ return !current || isTerminalWorkflowStatus(current.status);
5289
+ }, "isDeletable");
5290
+ if (!isDeletable()) return false;
5291
+ const handle = registry.getHandle(runId);
5292
+ if (handle) {
5293
+ await handle.completion;
5294
+ if (!isDeletable()) return false;
5295
+ }
5296
+ await this.refreshWorkflowHistory();
5297
+ if (!isDeletable()) return false;
5298
+ if (!this.mergedWorkflowRunIds.has(runId) && registry.get(runId) === void 0 && !this.unpersistedWorkflowHistory.has(runId)) {
5299
+ return false;
5300
+ }
5301
+ if (registry.get(runId) !== void 0 && !registry.removeTerminal(runId)) {
5302
+ return false;
5303
+ }
5304
+ if (!await deleteWorkflowSnapshot(this.config, runId)) return false;
5305
+ this.workflowDeletionSeqByRunId.set(runId, ++this.workflowDeletionSeq);
5306
+ this.unpersistedWorkflowHistory.delete(runId);
5307
+ this.mergedWorkflowRunIds.delete(runId);
5308
+ this.persistedWorkflowRunIds.delete(runId);
5309
+ this.workflowHistory = this.workflowHistory.filter(
5310
+ (item) => item.runId !== runId
5311
+ );
5312
+ this.#activeWorkChanged();
5313
+ return true;
5314
+ }
5315
+ /**
5316
+ * A sibling session deleted `runId` from the shared store. The
5317
+ * deletion-sequence marker is per-Session — it records deletions THIS
5318
+ * session issued — while the store and the delete entrance are
5319
+ * process-wide, so without this a refresh of ours that began reading
5320
+ * the directory before the sibling's delete landed would merge the
5321
+ * stale listing and republish the run the sibling's client was just
5322
+ * told was gone. Called under the sibling's task-mutation claim,
5323
+ * symmetric to the registry `removeTerminal` sweep.
5324
+ *
5325
+ * The R7-5 persisted latch is deliberately kept: a late terminal
5326
+ * emission for the deleted run must still not re-insert it.
5327
+ */
5328
+ noteExternalWorkflowDeletion(runId) {
5329
+ this.workflowDeletionSeqByRunId.set(runId, ++this.workflowDeletionSeq);
5330
+ this.unpersistedWorkflowHistory.delete(runId);
5331
+ this.mergedWorkflowRunIds.delete(runId);
5332
+ const retained = this.workflowHistory.filter(
5333
+ (item) => item.runId !== runId
5334
+ );
5335
+ if (retained.length === this.workflowHistory.length) return;
5336
+ this.workflowHistory = retained;
5337
+ this.#activeWorkChanged();
5338
+ }
5339
+ #rememberWorkflowHistory(entry) {
5340
+ if (!isTerminalWorkflowStatus(entry.status)) {
5341
+ this.persistedWorkflowRunIds.delete(entry.runId);
5342
+ return;
5343
+ }
5344
+ if (this.persistedWorkflowRunIds.has(entry.runId)) return;
5345
+ const snapshot = toSnapshot(entry);
5346
+ this.unpersistedWorkflowHistory.set(snapshot.runId, snapshot);
5347
+ this.workflowHistory = [
5348
+ snapshot,
5349
+ ...this.workflowHistory.filter((item) => item.runId !== entry.runId)
5350
+ ].sort((a, b) => b.startTime - a.startTime).slice(0, MAX_RETAINED_SNAPSHOTS);
5351
+ this.#pruneUnpersistedWorkflowHistory();
5352
+ }
5353
+ #pruneUnpersistedWorkflowHistory() {
5354
+ const retainedRunIds = new Set(
5355
+ this.workflowHistory.map((item) => item.runId)
5356
+ );
5357
+ for (const runId of this.unpersistedWorkflowHistory.keys()) {
5358
+ if (!retainedRunIds.has(runId)) {
5359
+ this.unpersistedWorkflowHistory.delete(runId);
5360
+ }
5361
+ }
5362
+ }
5363
+ reloadModelProvidersFromDisk() {
5364
+ if (!this.settings.reloadScopesFromDiskAtomically([
5365
+ "User" /* User */,
5366
+ "Workspace" /* Workspace */
5367
+ ])) {
5368
+ throw new Error("Unable to reload model-provider settings from disk.");
5369
+ }
5370
+ this.config.reloadModelProvidersConfig(
5371
+ this.settings.merged.modelProviders,
5372
+ this.settings.merged.providerProtocol ?? {}
5373
+ );
5374
+ }
5150
5375
  installPendingManagedConversationBinding(expectation, assertIdentity) {
5151
5376
  if (!this.requiresManagedConversationBinding || expectation.canonicalSessionId !== this.sessionId) {
5152
5377
  throw managedConversationBindingError();
@@ -5331,14 +5556,19 @@ var Session = class {
5331
5556
  }
5332
5557
  const notificationIds = /* @__PURE__ */ new Set();
5333
5558
  for (const item of this.notificationQueue) {
5334
- if (item.kind === "agent") notificationIds.add(item.taskId);
5559
+ if (item.kind === "agent" || item.kind === "workflow") {
5560
+ notificationIds.add(item.taskId);
5561
+ }
5335
5562
  }
5336
- for (const taskId of this.activeAgentNotificationAcceptances) {
5563
+ for (const taskId of this.activeNotificationAcceptances) {
5337
5564
  notificationIds.add(taskId);
5338
5565
  }
5339
5566
  if (this.currentAgentNotificationTaskId !== null) {
5340
5567
  notificationIds.add(this.currentAgentNotificationTaskId);
5341
5568
  }
5569
+ if (this.currentWorkflowNotificationTaskId !== null) {
5570
+ notificationIds.add(this.currentWorkflowNotificationTaskId);
5571
+ }
5342
5572
  for (const taskId of notificationIds) {
5343
5573
  holds.push({ category: "notification", id: taskId });
5344
5574
  }
@@ -5346,6 +5576,15 @@ var Session = class {
5346
5576
  if (shellActive) {
5347
5577
  holds.push({ category: "shell", id: "background-shells" });
5348
5578
  }
5579
+ const workflowRegistry = this.config.getWorkflowRunRegistry();
5580
+ for (const runId of workflowRegistry.listStartingRunIds?.() ?? []) {
5581
+ holds.push({ category: "workflow", id: runId });
5582
+ }
5583
+ for (const task of workflowRegistry.list()) {
5584
+ if (task.status === "running" || task.status === "pausing") {
5585
+ holds.push({ category: "workflow", id: task.runId });
5586
+ }
5587
+ }
5349
5588
  return holds;
5350
5589
  }
5351
5590
  hasStandaloneRelocationBlockers() {
@@ -5460,6 +5699,7 @@ var Session = class {
5460
5699
  dispose() {
5461
5700
  this.disposed = true;
5462
5701
  this.closing = true;
5702
+ this.clearActiveTodoPlanRevision();
5463
5703
  this.pendingPrompt?.abort(SESSION_DISPOSE_ABORT_REASON);
5464
5704
  this.pendingPrompt = null;
5465
5705
  this.resolveCloseGate?.();
@@ -5502,7 +5742,15 @@ var Session = class {
5502
5742
  shellRegistry.clearStatusChangeCallback(this.#shellStatusChangeCallback);
5503
5743
  this.#shellStatusChangeCallback = void 0;
5504
5744
  }
5745
+ this.config.getWorkflowRunRegistry().abortAll();
5746
+ this.config.getWorkflowRunRegistry().setCompletionCallback(void 0);
5747
+ this.config.getWorkflowRunRegistry().setSnapshotPersistedCallback(void 0);
5748
+ if (this.#workflowStatusChangeCallback) {
5749
+ this.config.getWorkflowRunRegistry().clearStatusChangeCallback(this.#workflowStatusChangeCallback);
5750
+ this.#workflowStatusChangeCallback = void 0;
5751
+ }
5505
5752
  this.config.getChatRecordingService()?.setTitleRecordedCallback(void 0);
5753
+ this.config.getSessionService().setSessionPrBoundCallback(void 0);
5506
5754
  this.unsubscribeChatRecordingFailure?.();
5507
5755
  this.unsubscribeChatRecordingFailure = void 0;
5508
5756
  this.config.setSubSessionSpawner(void 0);
@@ -5559,7 +5807,7 @@ var Session = class {
5559
5807
  ...options
5560
5808
  });
5561
5809
  } finally {
5562
- this.activeTodoPlanRevision = void 0;
5810
+ this.clearActiveTodoPlanRevision();
5563
5811
  }
5564
5812
  }
5565
5813
  rewindToTurn(targetTurnIndex, opts) {
@@ -5589,7 +5837,7 @@ var Session = class {
5589
5837
  }
5590
5838
  chat.truncateHistory(apiTruncateIndex);
5591
5839
  chat.stripThoughtsFromHistory();
5592
- this.activeTodoPlanRevision = void 0;
5840
+ this.clearActiveTodoPlanRevision();
5593
5841
  const preserveQueuedPromptPriority = this.todoStopGuardQueuedPromptPriority;
5594
5842
  const shouldDrainAutomaticQueues = (this.todoStopGuard.blocksUnrelatedAutomaticTurns || this.todoStopGuard.hasCommittedContinuation) && !preserveQueuedPromptPriority;
5595
5843
  this.todoStopGuard.blockUntilOrdinaryPromptStarts();
@@ -5634,7 +5882,7 @@ var Session = class {
5634
5882
  );
5635
5883
  }
5636
5884
  this.config.getLlmClient().getChat().setHistory(structuredClone(history));
5637
- this.activeTodoPlanRevision = void 0;
5885
+ this.clearActiveTodoPlanRevision();
5638
5886
  this.#clearTodoStopGuardTrustAndDrainAutomaticQueues();
5639
5887
  }
5640
5888
  #computeApiTruncationIndexForUserTurn(apiHistory, targetTurnIndex) {
@@ -6649,6 +6897,7 @@ ${this.pendingRecoveredAgentsNotice}
6649
6897
  );
6650
6898
  let channelDeliveryResponseBlock;
6651
6899
  let channelDeliveryCheckpoint = 0;
6900
+ let requestRouteKey = "";
6652
6901
  try {
6653
6902
  if (goalTurn) {
6654
6903
  goalTurn.modelStarted = true;
@@ -6677,6 +6926,7 @@ ${this.pendingRecoveredAgentsNotice}
6677
6926
  if (restorePostAnswerNoticesAttached) {
6678
6927
  this.#clearPendingRestoreNotices();
6679
6928
  }
6929
+ requestRouteKey = sendResult.requestRouteKey;
6680
6930
  const responseStream = sendResult.responseStream;
6681
6931
  nextMessage = null;
6682
6932
  channelDeliveryResponseBlock = beginChannelDeliveryResponseBlock(responseCapture);
@@ -6739,6 +6989,12 @@ ${this.pendingRecoveredAgentsNotice}
6739
6989
  );
6740
6990
  functionCalls.length = 0;
6741
6991
  }
6992
+ if (resp.type === "compressed" /* COMPRESSED */) {
6993
+ this.#recordCompressionTokenCount(
6994
+ resp.info,
6995
+ requestRouteKey
6996
+ );
6997
+ }
6742
6998
  }
6743
6999
  } catch (error) {
6744
7000
  streamFailed = true;
@@ -6792,7 +7048,7 @@ ${this.pendingRecoveredAgentsNotice}
6792
7048
  functionCalls.length > 0
6793
7049
  );
6794
7050
  if (usageMetadata) {
6795
- this.#recordPromptTokenCount(usageMetadata);
7051
+ this.#recordPromptTokenCount(usageMetadata, requestRouteKey);
6796
7052
  if (this.messageRewriter) {
6797
7053
  this.messageRewriter.flushTurn(pendingSend.signal);
6798
7054
  }
@@ -7242,6 +7498,7 @@ ${this.pendingRecoveredAgentsNotice}
7242
7498
  let channelDeliveryCheckpoint = 0;
7243
7499
  let providerSendChat;
7244
7500
  let userContentPushCountBeforeSend = 0;
7501
+ let requestRouteKey = "";
7245
7502
  try {
7246
7503
  const sendResult = await this.#sendMessageStreamWithAutoCompression(
7247
7504
  promptIdForSend,
@@ -7467,6 +7724,7 @@ ${this.pendingRecoveredAgentsNotice}
7467
7724
  ...supersededAutomaticContinuation ? { supersededAutomaticContinuation: true } : {}
7468
7725
  };
7469
7726
  }
7727
+ requestRouteKey = sendResult.requestRouteKey;
7470
7728
  const responseStream = sendResult.responseStream;
7471
7729
  nextMessage = null;
7472
7730
  channelDeliveryResponseBlock = beginChannelDeliveryResponseBlock(
@@ -7543,6 +7801,9 @@ ${this.pendingRecoveredAgentsNotice}
7543
7801
  );
7544
7802
  functionCalls.length = 0;
7545
7803
  }
7804
+ if (response.type === "compressed" /* COMPRESSED */) {
7805
+ this.#recordCompressionTokenCount(response.info, requestRouteKey);
7806
+ }
7546
7807
  }
7547
7808
  } catch (error) {
7548
7809
  streamFailed = true;
@@ -7598,7 +7859,7 @@ ${this.pendingRecoveredAgentsNotice}
7598
7859
  functionCalls.length > 0
7599
7860
  );
7600
7861
  if (usageMetadata) {
7601
- this.#recordPromptTokenCount(usageMetadata);
7862
+ this.#recordPromptTokenCount(usageMetadata, requestRouteKey);
7602
7863
  const durationMs = Date.now() - streamStartTime;
7603
7864
  await this.messageEmitter.emitUsageMetadata(
7604
7865
  usageMetadata,
@@ -7741,21 +8002,80 @@ ${this.pendingRecoveredAgentsNotice}
7741
8002
  sessionId: this.sessionId,
7742
8003
  update: projectedUpdate
7743
8004
  };
7744
- if (update.sessionUpdate === "plan") {
7745
- this.activeTodoPlanRevision = void 0;
8005
+ const canUpdateTodoPlanRevision = update.sessionUpdate === "plan" && this.config.getApprovalMode() === "plan" /* PLAN */;
8006
+ const todoPlanRevision = canUpdateTodoPlanRevision ? this.#readTodoPlanRevision(update) : void 0;
8007
+ const preservesPendingRevision = todoPlanRevision !== void 0 && todoPlanRevision.structure === this.activeTodoPlanStructure;
8008
+ const previousActiveTodoPlanRevision = this.activeTodoPlanRevision;
8009
+ const previousActiveTodoPlanStructure = this.activeTodoPlanStructure;
8010
+ const previousWorkflowRevision = this.config.getSessionWorkflowPlanRevision?.();
8011
+ if (canUpdateTodoPlanRevision && !preservesPendingRevision) {
8012
+ this.clearActiveTodoPlanRevision();
8013
+ }
8014
+ try {
8015
+ await this.client.sessionUpdate(params);
8016
+ } catch (error) {
8017
+ if (canUpdateTodoPlanRevision && !preservesPendingRevision && this.config.getApprovalMode() === "plan" /* PLAN */) {
8018
+ this.activeTodoPlanRevision = previousActiveTodoPlanRevision;
8019
+ this.activeTodoPlanStructure = previousActiveTodoPlanStructure;
8020
+ this.config.setSessionWorkflowPlanRevision?.(previousWorkflowRevision);
8021
+ }
8022
+ throw error;
7746
8023
  }
7747
- await this.client.sessionUpdate(params);
7748
- if (update.sessionUpdate === "plan") {
7749
- this.#captureTodoPlanRevision(update);
8024
+ if (canUpdateTodoPlanRevision && this.config.getApprovalMode() === "plan" /* PLAN */ && todoPlanRevision?.allPending) {
8025
+ if (this.activeTodoPlanRevision?.planId !== todoPlanRevision.planId || this.activeTodoPlanRevision?.sourceCallId !== todoPlanRevision.sourceCallId) {
8026
+ this.todoPlanRevisionGeneration++;
8027
+ }
8028
+ this.activeTodoPlanRevision = {
8029
+ planId: todoPlanRevision.planId,
8030
+ sourceCallId: todoPlanRevision.sourceCallId
8031
+ };
8032
+ this.activeTodoPlanStructure = todoPlanRevision.structure;
8033
+ this.config.setSessionWorkflowPlanRevision?.({
8034
+ planId: todoPlanRevision.planId,
8035
+ sourceCallId: todoPlanRevision.sourceCallId,
8036
+ todoIds: todoPlanRevision.todoIds
8037
+ });
7750
8038
  }
7751
8039
  }
7752
- #captureTodoPlanRevision(update) {
8040
+ #readTodoPlanRevision(update) {
7753
8041
  const meta = isRecord2(update["_meta"]) ? update["_meta"] : void 0;
7754
8042
  const plan = isRecord2(meta?.["qwenTodoPlan"]) ? meta["qwenTodoPlan"] : void 0;
7755
8043
  const transcript = isRecord2(meta?.["qwenTranscript"]) ? meta["qwenTranscript"] : void 0;
7756
8044
  const planId = plan?.["id"];
7757
8045
  const sourceCallId = transcript?.["planToolCallId"];
7758
- this.activeTodoPlanRevision = typeof planId === "string" && typeof sourceCallId === "string" && update.entries.length > 0 ? { planId, sourceCallId } : void 0;
8046
+ const workflowPlan = meta?.["qwenSessionWorkflow"] === true;
8047
+ const hasValidIdentity = typeof planId === "string" && planId.trim() !== "" && typeof sourceCallId === "string" && sourceCallId.trim() !== "" && update.entries.length > 0;
8048
+ const workflowEnabled = this.config.isSessionWorkflowEnabled?.() === true;
8049
+ if (!workflowEnabled || !workflowPlan || !hasValidIdentity)
8050
+ return void 0;
8051
+ const todos = update.entries.flatMap((entry) => {
8052
+ const entryRecord = entry;
8053
+ const entryMeta = isRecord2(entryRecord["_meta"]) ? entryRecord["_meta"] : void 0;
8054
+ const todo = isRecord2(entryMeta?.["qwenTodo"]) ? entryMeta["qwenTodo"] : void 0;
8055
+ const todoId = todo?.["id"];
8056
+ const blockedBy = todo?.["blockedBy"];
8057
+ if (typeof todoId !== "string" || todoId.trim() === "" || blockedBy !== void 0 && (!Array.isArray(blockedBy) || !blockedBy.every((dependency) => typeof dependency === "string"))) {
8058
+ return [];
8059
+ }
8060
+ return [
8061
+ {
8062
+ id: todoId,
8063
+ content: entry.content,
8064
+ priority: entry.priority,
8065
+ blockedBy: blockedBy ?? []
8066
+ }
8067
+ ];
8068
+ });
8069
+ const todoIds = todos.map((todo) => todo.id);
8070
+ if (todos.length !== update.entries.length || new Set(todoIds).size !== todoIds.length)
8071
+ return void 0;
8072
+ return {
8073
+ planId,
8074
+ sourceCallId,
8075
+ todoIds,
8076
+ structure: JSON.stringify([planId, todos]),
8077
+ allPending: update.entries.every((entry) => entry.status === "pending")
8078
+ };
7759
8079
  }
7760
8080
  #scheduleChannelDelivery(params) {
7761
8081
  const timer = setTimeout(() => {
@@ -7882,7 +8202,6 @@ ${this.pendingRecoveredAgentsNotice}
7882
8202
  abortSignal
7883
8203
  );
7884
8204
  compressionInfo = compressed;
7885
- this.#recordCompressionTokenCount(compressed);
7886
8205
  compressionFailed = isCompressionFailureStatus(
7887
8206
  compressed.compressionStatus
7888
8207
  );
@@ -7912,15 +8231,28 @@ ${this.pendingRecoveredAgentsNotice}
7912
8231
  debugLogger6.debug(`Auto-compression aborted for prompt ${promptId}`);
7913
8232
  return { responseStream: null, stopReason: "cancelled" };
7914
8233
  }
7915
- if (!compressionInfo) {
7916
- this.#syncPromptTokenCountWithCurrentChat();
8234
+ const model = options.getModelOverride?.() ?? options.modelOverride ?? this.config.getModel();
8235
+ const requestRouteKey = await this.#requestRouteKeyForModel(model);
8236
+ if (abortSignal.aborted) {
8237
+ debugLogger6.debug(
8238
+ `Send aborted after request route key resolution for prompt ${promptId}`
8239
+ );
8240
+ return { responseStream: null, stopReason: "cancelled" };
8241
+ }
8242
+ if (compressionInfo) {
8243
+ this.#recordCompressionTokenCount(compressionInfo, requestRouteKey);
8244
+ } else {
8245
+ this.#syncPromptTokenCountWithCurrentChat(requestRouteKey);
7917
8246
  }
7918
8247
  const sessionTokenLimit = this.config.getSessionTokenLimit();
7919
8248
  if (sessionTokenLimit > 0) {
7920
- const lastPromptTokenCount = this.#getPostCompressionTokenCount(compressionInfo);
8249
+ const lastPromptTokenCount = this.#getPostCompressionTokenCount(
8250
+ compressionInfo,
8251
+ requestRouteKey
8252
+ );
7921
8253
  if (lastPromptTokenCount > sessionTokenLimit) {
7922
8254
  debugLogger6.warn(
7923
- `Session token limit exceeded for prompt ${promptId}: ${lastPromptTokenCount} > ${sessionTokenLimit}. Send dropped.`
8255
+ `Session token limit exceeded for prompt ${promptId}: ${lastPromptTokenCount} > ${sessionTokenLimit}. requestRoute=${requestRouteKey}, activeModel=${this.config.getModel()}. Send dropped.`
7924
8256
  );
7925
8257
  await this.#emitAgentDiagnosticMessageSafely(
7926
8258
  `Session token limit exceeded: ${lastPromptTokenCount} tokens > ${sessionTokenLimit} limit. Please start a new session or increase the sessionTokenLimit in your settings.json.`,
@@ -7963,7 +8295,6 @@ ${this.pendingRecoveredAgentsNotice}
7963
8295
  }
7964
8296
  }
7965
8297
  const chat = this.#getCurrentChat();
7966
- const model = options.getModelOverride?.() ?? options.modelOverride ?? this.config.getModel();
7967
8298
  const request = {
7968
8299
  message,
7969
8300
  config: {
@@ -7972,7 +8303,7 @@ ${this.pendingRecoveredAgentsNotice}
7972
8303
  };
7973
8304
  const goalPermit = goalTurnContext.getStore();
7974
8305
  const responseStream = goalPermit ? await chat.sendMessageStream(model, request, promptId, goalPermit) : await chat.sendMessageStream(model, request, promptId);
7975
- return { responseStream };
8306
+ return { responseStream, requestRouteKey };
7976
8307
  }
7977
8308
  #clearPendingRestoreNotices() {
7978
8309
  this.pendingWorktreeNotice = null;
@@ -8130,25 +8461,58 @@ ${this.pendingRecoveredAgentsNotice}
8130
8461
  hadMidTurnUserInput
8131
8462
  };
8132
8463
  }
8133
- #recordCompressionTokenCount(info) {
8134
- this.#syncPromptTokenCountWithCurrentChat();
8464
+ #recordCompressionTokenCount(info, requestRouteKey) {
8465
+ if (info.compressionStatus === 1 /* COMPRESSED */) {
8466
+ this.#invalidateRouteTokenCountsForCompression(info, requestRouteKey);
8467
+ return;
8468
+ }
8469
+ this.#syncPromptTokenCountWithCurrentChat(requestRouteKey);
8470
+ const tokenCount = this.#extractCompressionTokenCount(info);
8471
+ if (tokenCount !== null && tokenCount > 0) {
8472
+ this.#setLastPromptTokenCount(requestRouteKey, tokenCount);
8473
+ }
8474
+ }
8475
+ /**
8476
+ * Compression rewrote the shared history, so EVERY retained route-keyed
8477
+ * count is stale — not just the request route's. Drop them all and
8478
+ * re-record the fresh post-compression count under the request route,
8479
+ * retaining it under the active route too when the two differ (the
8480
+ * compressed history is shared, so the count anchors both routes' next
8481
+ * gate reads). Mirrors LlmChat clearing its keyed counts in the
8482
+ * COMPRESSED branch of tryCompress; without this, in-send compressions
8483
+ * (LlmChat.sendMessageStream's hard-tier rescue and reactive-overflow
8484
+ * paths, surfaced as StreamEventType.COMPRESSED) would leave this cache
8485
+ * holding pre-compression sizes and the gate would drop a returning
8486
+ * route's send that fits the compressed history (#9529).
8487
+ */
8488
+ #invalidateRouteTokenCountsForCompression(info, requestRouteKey) {
8489
+ this.lastPromptTokenCountsByRouteKey.clear();
8135
8490
  const tokenCount = this.#extractCompressionTokenCount(info);
8136
8491
  if (tokenCount !== null && tokenCount > 0) {
8137
- this.lastPromptTokenCount = tokenCount;
8492
+ this.#setLastPromptTokenCount(requestRouteKey, tokenCount);
8493
+ const activeRouteKey = this.#currentRouteKey();
8494
+ if (activeRouteKey !== requestRouteKey) {
8495
+ this.lastPromptTokenCountsByRouteKey.set(activeRouteKey, tokenCount);
8496
+ }
8497
+ } else {
8498
+ this.lastPromptTokenCount = 0;
8499
+ this.lastPromptTokenCountRouteKey = requestRouteKey;
8138
8500
  }
8501
+ this.lastPromptTokenCountChat = this.#getCurrentChat();
8139
8502
  }
8140
- #recordPromptTokenCount(usageMetadata) {
8141
- this.#syncPromptTokenCountWithCurrentChat();
8503
+ #recordPromptTokenCount(usageMetadata, routeKey = this.#currentRouteKey()) {
8504
+ this.#syncPromptTokenCountWithCurrentChat(routeKey);
8142
8505
  const tokenCount = usageMetadata.promptTokenCount ?? usageMetadata.totalTokenCount;
8143
8506
  if (tokenCount !== void 0 && tokenCount > 0) {
8144
- this.lastPromptTokenCount = tokenCount;
8507
+ this.#setLastPromptTokenCount(routeKey, tokenCount);
8145
8508
  }
8146
8509
  }
8147
- #getPostCompressionTokenCount(info) {
8510
+ #getPostCompressionTokenCount(info, routeKey = this.#currentRouteKey()) {
8148
8511
  const tokenCount = this.#extractCompressionTokenCount(info);
8149
8512
  if (tokenCount !== null) {
8150
8513
  return tokenCount;
8151
8514
  }
8515
+ this.#syncPromptTokenCountWithCurrentChat(routeKey);
8152
8516
  return this.lastPromptTokenCount;
8153
8517
  }
8154
8518
  #extractCompressionTokenCount(info) {
@@ -8164,12 +8528,50 @@ ${this.pendingRecoveredAgentsNotice}
8164
8528
  }
8165
8529
  return tokenCount;
8166
8530
  }
8167
- #syncPromptTokenCountWithCurrentChat() {
8531
+ #currentRouteKey() {
8532
+ return this.config.getModelRouteIdentity?.() ?? "";
8533
+ }
8534
+ async #requestRouteKeyForModel(model) {
8535
+ if (!this.config.getModelRouteIdentity) {
8536
+ return "";
8537
+ }
8538
+ if (!model.endsWith("\0")) {
8539
+ return this.config.getModelRouteIdentity(model);
8540
+ }
8541
+ const runtimeView = await this.config.getBaseLlmClient().resolveForModel(model.slice(0, -1), { failClosed: true });
8542
+ return this.config.getModelRouteIdentity(
8543
+ runtimeView.model,
8544
+ runtimeView.contentGeneratorConfig
8545
+ );
8546
+ }
8547
+ #setLastPromptTokenCount(routeKey, tokenCount) {
8548
+ this.lastPromptTokenCount = tokenCount;
8549
+ this.lastPromptTokenCountRouteKey = routeKey;
8550
+ if (!this.lastPromptTokenCountsByRouteKey.has(routeKey) && this.lastPromptTokenCountsByRouteKey.size >= MAX_RETAINED_SESSION_ROUTE_COUNTS) {
8551
+ const oldestKey = this.lastPromptTokenCountsByRouteKey.keys().next().value;
8552
+ if (oldestKey !== void 0) {
8553
+ this.lastPromptTokenCountsByRouteKey.delete(oldestKey);
8554
+ }
8555
+ }
8556
+ this.lastPromptTokenCountsByRouteKey.set(routeKey, tokenCount);
8557
+ }
8558
+ #syncPromptTokenCountWithCurrentChat(routeKey = this.#currentRouteKey()) {
8168
8559
  const chat = this.#getCurrentChat();
8169
- if (this.lastPromptTokenCountChat && this.lastPromptTokenCountChat !== chat) {
8560
+ const chatChanged = this.lastPromptTokenCountChat && this.lastPromptTokenCountChat !== chat;
8561
+ if (chatChanged) {
8562
+ this.lastPromptTokenCountsByRouteKey.clear();
8170
8563
  this.lastPromptTokenCount = 0;
8564
+ } else if (this.lastPromptTokenCountRouteKey !== routeKey) {
8565
+ if (this.lastPromptTokenCountRouteKey !== void 0 && this.lastPromptTokenCount > 0) {
8566
+ this.lastPromptTokenCountsByRouteKey.set(
8567
+ this.lastPromptTokenCountRouteKey,
8568
+ this.lastPromptTokenCount
8569
+ );
8570
+ }
8571
+ this.lastPromptTokenCount = this.lastPromptTokenCountsByRouteKey.get(routeKey) ?? 0;
8171
8572
  }
8172
8573
  this.lastPromptTokenCountChat = chat;
8574
+ this.lastPromptTokenCountRouteKey = routeKey;
8173
8575
  }
8174
8576
  #isAbortError(error) {
8175
8577
  return error instanceof Error && error.name === "AbortError" || typeof DOMException !== "undefined" && error instanceof DOMException && error.name === "AbortError" || typeof error === "object" && error !== null && "name" in error && error.name === "AbortError";
@@ -8258,7 +8660,10 @@ ${this.pendingRecoveredAgentsNotice}
8258
8660
  const isTimeout = error instanceof MidTurnDrainTimeoutError;
8259
8661
  if (isTimeout) {
8260
8662
  this.midTurnDrainTimeoutStrikes += 1;
8261
- if (drainPromise) void this.#recoverLateDrain(drainPromise);
8663
+ if (drainPromise) {
8664
+ void this.#recoverLateDrain(drainPromise).catch(() => {
8665
+ });
8666
+ }
8262
8667
  }
8263
8668
  const isPermanentError = errorCode === -32601 || /method not found/i.test(errorMessage) || isTimeout && this.midTurnDrainTimeoutStrikes >= MID_TURN_QUEUE_DRAIN_MAX_TIMEOUT_STRIKES;
8264
8669
  if (isPermanentError) {
@@ -8415,6 +8820,10 @@ ${this.pendingRecoveredAgentsNotice}
8415
8820
  scheduler.start((job) => {
8416
8821
  if (this.cronDisabledByTokenLimit) return;
8417
8822
  if (job.missed && detectAutonomousSentinel(job.prompt)) return;
8823
+ if (!job.missed && job.sessionMode === "per_run" && job.cronExpr !== "@wakeup" && !job.delivery && !detectAutonomousSentinel(job.prompt)) {
8824
+ void this.#dispatchCronToFreshSession(job);
8825
+ return;
8826
+ }
8418
8827
  this.#enqueueCronPrompt({
8419
8828
  prompt: job.prompt,
8420
8829
  source: job.cronExpr === "@wakeup" ? "loop" : "cron",
@@ -8426,6 +8835,77 @@ ${this.pendingRecoveredAgentsNotice}
8426
8835
  void this.#drainCronQueue();
8427
8836
  });
8428
8837
  }
8838
+ /**
8839
+ * Runs a per-run scheduled fire in a fresh child session created through the
8840
+ * daemon. The scheduler has already booked the run; this attributes it to the
8841
+ * child that accepted it. If the daemon cannot create the child, the fire
8842
+ * falls back to this (persistent) session so it is not lost — a consumed
8843
+ * one-shot has no scheduled retry — and the run record keeps the failure
8844
+ * marker alongside the session it actually ran in.
8845
+ */
8846
+ async #dispatchCronToFreshSession(job) {
8847
+ const scheduler = this.config.getCronScheduler();
8848
+ const taskId = job.id ?? "unknown";
8849
+ const firedAt = job.lastFiredAt;
8850
+ const triggeredAt = firedAt ?? Date.now();
8851
+ const record = /* @__PURE__ */ __name(async (outcome) => {
8852
+ if (!job.id || firedAt === void 0) return;
8853
+ await scheduler.annotateRunSession(job.id, firedAt, outcome).catch((error) => {
8854
+ debugLogger6.warn(
8855
+ `Scheduled task ${taskId} could not record its run session: ${error instanceof Error ? error.message : String(error)}`
8856
+ );
8857
+ });
8858
+ }, "record");
8859
+ let sessionId;
8860
+ try {
8861
+ const response = await this.client.extMethod(
8862
+ SERVE_CONTROL_EXT_METHODS.createSubSession,
8863
+ {
8864
+ prompt: buildScheduledTaskRunPrompt({
8865
+ id: taskId,
8866
+ name: job.name,
8867
+ cron: job.cronExpr ?? "",
8868
+ prompt: job.prompt,
8869
+ triggeredAt,
8870
+ trigger: "scheduled"
8871
+ }),
8872
+ completion: "sent",
8873
+ // Title the child from the task and its trigger time — never from
8874
+ // the built prompt, whose first line is the execution-context
8875
+ // header. Same shape the manual-run route gives its children.
8876
+ name: scheduledTaskRunSessionName(
8877
+ job.name ?? job.prompt,
8878
+ triggeredAt
8879
+ ),
8880
+ ...job.id ? {
8881
+ sourceType: SCHEDULED_TASK_RUN_SOURCE_TYPE,
8882
+ sourceId: scheduledTaskRunSourceId(job.id)
8883
+ } : {},
8884
+ callerSessionId: this.sessionId
8885
+ }
8886
+ );
8887
+ const responseSessionId = response["sessionId"];
8888
+ if (typeof responseSessionId !== "string" || responseSessionId.length === 0) {
8889
+ throw new Error("bridge returned a missing session id");
8890
+ }
8891
+ sessionId = responseSessionId;
8892
+ } catch (error) {
8893
+ debugLogger6.warn(
8894
+ `Scheduled task ${taskId} could not create a fresh session, running it in the task session instead: ${error instanceof Error ? error.message : String(error)}`
8895
+ );
8896
+ await record({ sessionId: this.sessionId, dispatchFailed: true });
8897
+ this.#enqueueCronPrompt({
8898
+ prompt: job.prompt,
8899
+ source: "cron",
8900
+ ...job.id ? { taskId: job.id } : {},
8901
+ ...job.lastFiredAt !== void 0 ? { firedAt: job.lastFiredAt } : {}
8902
+ });
8903
+ void this.#drainCronQueue();
8904
+ return;
8905
+ }
8906
+ this.relatedAgentIds.add(sessionId);
8907
+ await record({ sessionId });
8908
+ }
8429
8909
  #startCronSchedulerInRuntime() {
8430
8910
  return Storage.runWithRuntimeBaseDir(
8431
8911
  this.runtimeBaseDir,
@@ -8713,6 +9193,7 @@ ${this.pendingRecoveredAgentsNotice}
8713
9193
  return;
8714
9194
  }
8715
9195
  const responseStream = sendResult.responseStream;
9196
+ const requestRouteKey = sendResult.requestRouteKey;
8716
9197
  const channelDeliveryResponseBlock = beginChannelDeliveryResponseBlock(responseCapture);
8717
9198
  const channelDeliveryCheckpoint = channelDeliveryResponseBlock?.parts.length ?? 0;
8718
9199
  if (loopTick && turnCount === 1) {
@@ -8778,6 +9259,12 @@ ${this.pendingRecoveredAgentsNotice}
8778
9259
  );
8779
9260
  functionCalls.length = 0;
8780
9261
  }
9262
+ if (resp.type === "compressed" /* COMPRESSED */) {
9263
+ this.#recordCompressionTokenCount(
9264
+ resp.info,
9265
+ requestRouteKey
9266
+ );
9267
+ }
8781
9268
  }
8782
9269
  } catch (error) {
8783
9270
  streamFailed = true;
@@ -8799,7 +9286,7 @@ ${this.pendingRecoveredAgentsNotice}
8799
9286
  functionCalls.length > 0
8800
9287
  );
8801
9288
  if (usageMetadata) {
8802
- this.#recordPromptTokenCount(usageMetadata);
9289
+ this.#recordPromptTokenCount(usageMetadata, requestRouteKey);
8803
9290
  if (this.messageRewriter) {
8804
9291
  this.messageRewriter.flushTurn(ac.signal);
8805
9292
  }
@@ -8982,6 +9469,30 @@ ${this.pendingRecoveredAgentsNotice}
8982
9469
  structured: entry ? { commandLabel: truncateNotificationLabel(entry.description) } : void 0
8983
9470
  });
8984
9471
  });
9472
+ const workflowRegistry = this.config.getWorkflowRunRegistry();
9473
+ this.#workflowStatusChangeCallback = (entry) => {
9474
+ this.#activeWorkChanged();
9475
+ if (entry) this.#rememberWorkflowHistory(entry);
9476
+ };
9477
+ workflowRegistry.setStatusChangeCallback(
9478
+ this.#workflowStatusChangeCallback
9479
+ );
9480
+ workflowRegistry.setSnapshotPersistedCallback((runId) => {
9481
+ this.persistedWorkflowRunIds.add(runId);
9482
+ this.unpersistedWorkflowHistory.delete(runId);
9483
+ });
9484
+ workflowRegistry.setCompletionCallback((displayText, modelText, meta) => {
9485
+ const entry = workflowRegistry.get(meta.runId);
9486
+ this.#enqueueBackgroundNotification({
9487
+ displayText,
9488
+ modelText,
9489
+ taskId: meta.runId,
9490
+ status: meta.status,
9491
+ kind: "workflow",
9492
+ continuesTodoStopGuardWorkChain: !entry || !this.todoStopGuardBackgroundBaseline.workflows.has(entry),
9493
+ todoWorkChainId: meta.todoWorkChainId
9494
+ });
9495
+ });
8985
9496
  this.config.getChatRecordingService()?.setTitleRecordedCallback((customTitle, titleSource, sessionId) => {
8986
9497
  void this.client.extNotification("qwen/notify/session/title-update", {
8987
9498
  v: 1,
@@ -8991,6 +9502,14 @@ ${this.pendingRecoveredAgentsNotice}
8991
9502
  }).catch(() => {
8992
9503
  });
8993
9504
  });
9505
+ this.config.getSessionService().setSessionPrBoundCallback((sessionId, pr) => {
9506
+ void this.client.extNotification("qwen/notify/session/pr-binding", {
9507
+ v: 1,
9508
+ sessionId,
9509
+ pr: { number: pr.number, url: pr.url }
9510
+ }).catch(() => {
9511
+ });
9512
+ });
8994
9513
  if (typeof this.config.onChatRecordingFailure === "function") {
8995
9514
  this.unsubscribeChatRecordingFailure = this.config.onChatRecordingFailure(
8996
9515
  (event) => this.client.extNotification(
@@ -9042,8 +9561,8 @@ ${this.pendingRecoveredAgentsNotice}
9042
9561
  if (existing) return { accepted: await existing };
9043
9562
  const acceptance = this.#persistDaemonBackgroundNotification(item);
9044
9563
  this.backgroundNotificationAcceptances.set(item.taskId, acceptance);
9045
- if (item.kind === "agent") {
9046
- this.activeAgentNotificationAcceptances.add(item.taskId);
9564
+ if (item.kind === "agent" || item.kind === "workflow") {
9565
+ this.activeNotificationAcceptances.add(item.taskId);
9047
9566
  this.#activeWorkChanged();
9048
9567
  }
9049
9568
  try {
@@ -9051,8 +9570,8 @@ ${this.pendingRecoveredAgentsNotice}
9051
9570
  } finally {
9052
9571
  if (this.backgroundNotificationAcceptances.get(item.taskId) === acceptance) {
9053
9572
  this.backgroundNotificationAcceptances.delete(item.taskId);
9054
- if (item.kind === "agent") {
9055
- this.activeAgentNotificationAcceptances.delete(item.taskId);
9573
+ if (item.kind === "agent" || item.kind === "workflow") {
9574
+ this.activeNotificationAcceptances.delete(item.taskId);
9056
9575
  this.#activeWorkChanged();
9057
9576
  }
9058
9577
  }
@@ -9141,6 +9660,7 @@ ${this.pendingRecoveredAgentsNotice}
9141
9660
  const [item] = this.notificationQueue.splice(nextIndex, 1);
9142
9661
  if (!item) break;
9143
9662
  this.currentAgentNotificationTaskId = item.kind === "agent" ? item.taskId : null;
9663
+ this.currentWorkflowNotificationTaskId = item.kind === "workflow" ? item.taskId : null;
9144
9664
  this.currentShellNotificationActive = item.kind === "shell";
9145
9665
  this.#activeWorkChanged();
9146
9666
  try {
@@ -9155,6 +9675,7 @@ ${this.pendingRecoveredAgentsNotice}
9155
9675
  );
9156
9676
  } finally {
9157
9677
  this.currentAgentNotificationTaskId = null;
9678
+ this.currentWorkflowNotificationTaskId = null;
9158
9679
  this.currentShellNotificationActive = false;
9159
9680
  this.#activeWorkChanged();
9160
9681
  }
@@ -9251,6 +9772,7 @@ ${this.pendingRecoveredAgentsNotice}
9251
9772
  return;
9252
9773
  }
9253
9774
  const responseStream = sendResult.responseStream;
9775
+ const requestRouteKey = sendResult.requestRouteKey;
9254
9776
  nextMessage = null;
9255
9777
  const messageDisplay = this.#createMessageDisplayDispatcher(
9256
9778
  ac.signal
@@ -9297,6 +9819,9 @@ ${this.pendingRecoveredAgentsNotice}
9297
9819
  );
9298
9820
  functionCalls.length = 0;
9299
9821
  }
9822
+ if (resp.type === "compressed" /* COMPRESSED */) {
9823
+ this.#recordCompressionTokenCount(resp.info, requestRouteKey);
9824
+ }
9300
9825
  }
9301
9826
  } catch (error) {
9302
9827
  streamFailed = true;
@@ -9323,7 +9848,7 @@ ${this.pendingRecoveredAgentsNotice}
9323
9848
  await this.messageRewriter.flushTurn(ac.signal);
9324
9849
  }
9325
9850
  if (usageMetadata) {
9326
- this.#recordPromptTokenCount(usageMetadata);
9851
+ this.#recordPromptTokenCount(usageMetadata, requestRouteKey);
9327
9852
  const durationMs = Date.now() - streamStartTime;
9328
9853
  await this.messageEmitter.emitUsageMetadata(
9329
9854
  usageMetadata,
@@ -9606,10 +10131,10 @@ ${this.pendingRecoveredAgentsNotice}
9606
10131
  }
9607
10132
  const previousApprovalMode = this.config.getApprovalMode();
9608
10133
  this.config.setApprovalMode(approvalMode);
10134
+ if (previousApprovalMode !== approvalMode && (previousApprovalMode === "plan" /* PLAN */ || approvalMode === "plan" /* PLAN */)) {
10135
+ this.clearActiveTodoPlanRevision();
10136
+ }
9609
10137
  if (approvalMode === "plan" /* PLAN */) {
9610
- if (previousApprovalMode !== "plan" /* PLAN */) {
9611
- this.activeTodoPlanRevision = void 0;
9612
- }
9613
10138
  this.clearTodoStopGuardTrust();
9614
10139
  }
9615
10140
  void this.client.extNotification("qwen/notify/session/mode-update", {
@@ -9662,6 +10187,10 @@ ${this.pendingRecoveredAgentsNotice}
9662
10187
  const effectiveAuthType = after?.authType ?? selectedAuthType;
9663
10188
  const effectiveModelId = after?.model ?? parsed.modelId;
9664
10189
  const isRuntime = resolvedRoute?.isRuntime ?? rawModelId.startsWith(RUNTIME_SNAPSHOT_PREFIX);
10190
+ const persistDefault = !this.requiresManagedConversationBinding && (options.persistDefault ?? true);
10191
+ this.reconcileReasoningSelection(effectiveModelId, {
10192
+ persist: persistDefault
10193
+ });
9665
10194
  void recordDaemonSessionModel(this.config, {
9666
10195
  modelId: isRuntime ? resolvedRoute?.modelId ?? parsed.modelId : effectiveModelId,
9667
10196
  authType: effectiveAuthType,
@@ -9682,7 +10211,6 @@ ${this.pendingRecoveredAgentsNotice}
9682
10211
  }).catch((error) => {
9683
10212
  debugLogger6.debug("model-update extNotification failed", error);
9684
10213
  });
9685
- const persistDefault = !this.requiresManagedConversationBinding && (options.persistDefault ?? true);
9686
10214
  if (persistDefault) {
9687
10215
  const persistScope = getPersistScopeForModelSelection(this.settings);
9688
10216
  this.settings.setValue(
@@ -9713,10 +10241,119 @@ ${this.pendingRecoveredAgentsNotice}
9713
10241
  }
9714
10242
  };
9715
10243
  }
9716
- /**
9717
- * Sends a current_mode_update notification to the client.
9718
- * Called after the agent switches modes (e.g., from exit_plan_mode tool).
9719
- */
10244
+ getDefaultReasoningConfig() {
10245
+ const authType = this.config.getAuthType?.();
10246
+ const model = authType && !this.config.getActiveRuntimeModelSnapshot?.() ? this.config.getResolvedModelConfig?.(
10247
+ authType,
10248
+ this.config.getModel(),
10249
+ this.config.getCurrentModelRegistryBaseUrl?.() ?? void 0
10250
+ ) : void 0;
10251
+ if (model) return model.generationConfig.reasoning;
10252
+ return this.settings.merged.model?.generationConfig?.reasoning;
10253
+ }
10254
+ reloadReasoningSelection() {
10255
+ this.settings.reloadScopeFromDisk("User" /* User */);
10256
+ this.settings.reloadScopeFromDisk("Workspace" /* Workspace */);
10257
+ this.reconcileReasoningSelection(this.config.getModel(), {
10258
+ persist: !this.requiresManagedConversationBinding
10259
+ });
10260
+ }
10261
+ setSessionReasoningSelection(selection) {
10262
+ this.sessionReasoningSelection = selection;
10263
+ }
10264
+ getSessionReasoningSelection() {
10265
+ return this.sessionReasoningSelection;
10266
+ }
10267
+ persistReasoningSelection(selection) {
10268
+ if (this.requiresManagedConversationBinding) {
10269
+ throw RequestError.invalidParams(
10270
+ void 0,
10271
+ "Reasoning selection cannot be persisted for this session"
10272
+ );
10273
+ }
10274
+ const key = "model.reasoningEffort";
10275
+ const persistScope = getPersistScopeForModelSelection(this.settings);
10276
+ const clears = getWritableScopes(this.settings).filter(
10277
+ (scope) => (selection === REASONING_EFFORT_DEFAULT || scope !== persistScope) && settingExistsInScope(key, this.settings.forScope(scope).settings)
10278
+ ).map((scope) => ({ scope, value: void 0 }));
10279
+ const writes = selection === REASONING_EFFORT_DEFAULT ? clears : [{ scope: persistScope, value: selection }, ...clears];
10280
+ const committed = [];
10281
+ for (const write of writes) {
10282
+ const previous = this.settings.forScope(write.scope).settings.model?.reasoningEffort;
10283
+ try {
10284
+ this.writeReasoningSelection(write.scope, write.value);
10285
+ } catch (error) {
10286
+ this.settings.reloadScopeFromDisk(write.scope);
10287
+ for (const previousWrite of committed.reverse()) {
10288
+ try {
10289
+ this.writeReasoningSelection(
10290
+ previousWrite.scope,
10291
+ previousWrite.value
10292
+ );
10293
+ } catch (rollbackError) {
10294
+ this.settings.reloadScopeFromDisk(previousWrite.scope);
10295
+ debugLogger6.warn(
10296
+ `Failed to roll back reasoning preference: ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}`
10297
+ );
10298
+ }
10299
+ }
10300
+ throw error;
10301
+ }
10302
+ committed.push({ scope: write.scope, value: previous });
10303
+ }
10304
+ }
10305
+ reconcileReasoningSelection(modelId, options) {
10306
+ const rawSelection = this.settings.merged.model?.reasoningEffort;
10307
+ let hasSessionSelection = this.sessionReasoningSelection !== void 0;
10308
+ if (!hasSessionSelection && rawSelection === void 0) return;
10309
+ let selection = hasSessionSelection ? this.sessionReasoningSelection : parseReasoningSelection(rawSelection);
10310
+ const generation = this.config.getContentGeneratorConfig?.();
10311
+ const thinkingMandatory = generation?.thinkingMandatory === true;
10312
+ let supported = selection !== void 0 && selection !== REASONING_EFFORT_DEFAULT && isReasoningSelectionSupported(modelId, selection, thinkingMandatory);
10313
+ const appliesSessionDefault = hasSessionSelection && selection === REASONING_EFFORT_DEFAULT;
10314
+ if (hasSessionSelection && !supported && !appliesSessionDefault) {
10315
+ this.sessionReasoningSelection = void 0;
10316
+ hasSessionSelection = false;
10317
+ selection = parseReasoningSelection(rawSelection);
10318
+ supported = selection !== void 0 && selection !== REASONING_EFFORT_DEFAULT && isReasoningSelectionSupported(modelId, selection, thinkingMandatory);
10319
+ }
10320
+ if (!hasSessionSelection && rawSelection !== void 0 && !supported && options.persist) {
10321
+ try {
10322
+ this.persistReasoningSelection(REASONING_EFFORT_DEFAULT);
10323
+ } catch (error) {
10324
+ debugLogger6.warn(
10325
+ `Failed to clear incompatible reasoning preference: ${error instanceof Error ? error.message : String(error)}`
10326
+ );
10327
+ }
10328
+ }
10329
+ const modelReasoning = getModelConfiguration(modelId)?.reasoning;
10330
+ if (supported && generation && modelReasoning && !modelReasoning.toggleOnly) {
10331
+ clearReasoningRequestOverrides(generation);
10332
+ }
10333
+ const effectiveSelection = (supported || appliesSessionDefault) && selection !== void 0 ? selection : REASONING_EFFORT_DEFAULT;
10334
+ applyReasoningSelection(
10335
+ this.config,
10336
+ effectiveSelection,
10337
+ this.getDefaultReasoningConfig()
10338
+ );
10339
+ }
10340
+ writeReasoningSelection(scope, value) {
10341
+ const key = "model.reasoningEffort";
10342
+ this.settings.setValue(scope, key, value, void 0, {
10343
+ throwOnWriteFailure: true
10344
+ });
10345
+ if (value !== void 0) return;
10346
+ const file = this.settings.forScope(scope);
10347
+ for (const settings of [file.settings, file.originalSettings]) {
10348
+ if (settings)
10349
+ deleteNestedPropertySafe(settings, key);
10350
+ }
10351
+ this.settings.recomputeMerged();
10352
+ }
10353
+ /**
10354
+ * Sends a current_mode_update notification to the client.
10355
+ * Called after the agent switches modes (e.g., from exit_plan_mode tool).
10356
+ */
9720
10357
  async sendCurrentModeUpdateNotification() {
9721
10358
  const newModeId = this.config.getApprovalMode();
9722
10359
  const update = {
@@ -10325,6 +10962,14 @@ ${this.pendingRecoveredAgentsNotice}
10325
10962
  } catch {
10326
10963
  }
10327
10964
  }
10965
+ if (this.config.getOutputStyle?.()) {
10966
+ const outputStyle = resolveMainSessionOutputStyle(this.config);
10967
+ if (outputStyle) {
10968
+ reminders.push({
10969
+ text: wrapSystemReminder(getOutputStyleTurnReminder(outputStyle))
10970
+ });
10971
+ }
10972
+ }
10328
10973
  return reminders;
10329
10974
  }
10330
10975
  async runTool(abortSignal, promptId, fc, onStopAfterPermissionCancel, toolLoopState, recordSkippedToolCall, queueToolResultRecord, generatedCallId, onFullTurnModel) {
@@ -10365,6 +11010,8 @@ ${this.pendingRecoveredAgentsNotice}
10365
11010
  let nestedPermissionCancelled = false;
10366
11011
  let agentToolAbortController;
10367
11012
  let removeAgentToolAbortPropagation;
11013
+ let todoPlanApprovalGeneration;
11014
+ let todoPlanApprovalRevision;
10368
11015
  let subAgentCleanupFunctions = [];
10369
11016
  const cleanupAgentToolResources = /* @__PURE__ */ __name(() => {
10370
11017
  subAgentCleanupFunctions.forEach((cleanup) => cleanup());
@@ -10816,8 +11463,10 @@ ${this.pendingRecoveredAgentsNotice}
10816
11463
  }
10817
11464
  );
10818
11465
  case "fallback":
10819
- wasAutoModeManualFallback = isDenialFallbackReason(outcome.reason) || outcome.reason === "classifier_unavailable";
10820
- autoModeFallbackMessage = outcome.message;
11466
+ wasAutoModeManualFallback = isDenialFallbackReason(outcome.reason) || outcome.reason === "classifier_unavailable" || outcome.reason === "external_write";
11467
+ if (outcome.reason === "classifier_unavailable" || outcome.reason === "external_write") {
11468
+ autoModeFallbackMessage = outcome.message;
11469
+ }
10821
11470
  if (wasAutoModeManualFallback) {
10822
11471
  debugLogger6.warn(
10823
11472
  `Auto mode fallback to manual approval (${outcome.reason}): ` + formatDenialStateLog(denialState)
@@ -10832,6 +11481,34 @@ ${this.pendingRecoveredAgentsNotice}
10832
11481
  }
10833
11482
  let didRequestPermission = false;
10834
11483
  let confirmationDetails;
11484
+ const cancelStaleTodoPlanApproval = /* @__PURE__ */ __name(async () => {
11485
+ const configRevision = this.config.getSessionWorkflowPlanRevision?.();
11486
+ if (todoPlanApprovalGeneration === void 0 || !todoPlanApprovalRevision || todoPlanApprovalGeneration === this.todoPlanRevisionGeneration && this.activeTodoPlanRevision?.planId === todoPlanApprovalRevision.planId && this.activeTodoPlanRevision?.sourceCallId === todoPlanApprovalRevision.sourceCallId && configRevision?.planId === todoPlanApprovalRevision.planId && configRevision?.sourceCallId === todoPlanApprovalRevision.sourceCallId) {
11487
+ return void 0;
11488
+ }
11489
+ try {
11490
+ await confirmationDetails?.onConfirm(
11491
+ "cancel" /* Cancel */
11492
+ );
11493
+ } catch (error) {
11494
+ debugLogger6.warn(
11495
+ `Failed to cancel stale plan approval: ${this.#formatError(error)}`
11496
+ );
11497
+ }
11498
+ onStopAfterPermissionCancel?.();
11499
+ return earlyErrorResponse(
11500
+ new Error(
11501
+ "Plan approval is stale because its Session Workflow revision changed. No action was taken."
11502
+ ),
11503
+ toolName,
11504
+ {
11505
+ status: "cancelled",
11506
+ errorType: void 0,
11507
+ executionStatus: "not_started",
11508
+ stopAfterPermissionCancel: true
11509
+ }
11510
+ );
11511
+ }, "cancelStaleTodoPlanApproval");
10835
11512
  const recordAutoModeFallbackResolution = /* @__PURE__ */ __name((outcome) => {
10836
11513
  if (approvalMode === "auto" /* AUTO */ && wasAutoModeManualFallback && isApproveOutcome(outcome)) {
10837
11514
  const before = this.config.getAutoModeDenialState();
@@ -11064,6 +11741,12 @@ ${this.pendingRecoveredAgentsNotice}
11064
11741
  const offeredPermissionOptions = permissionOptions.map(
11065
11742
  (option) => ({ ...option })
11066
11743
  );
11744
+ const workflowPlanRevision = isExitPlanModeTool ? this.config.getSessionWorkflowPlanRevision?.() : void 0;
11745
+ const qwenTodoApproval = isExitPlanModeTool && this.activeTodoPlanRevision && workflowPlanRevision?.planId === this.activeTodoPlanRevision.planId && workflowPlanRevision.sourceCallId === this.activeTodoPlanRevision.sourceCallId ? this.activeTodoPlanRevision : void 0;
11746
+ if (qwenTodoApproval) {
11747
+ todoPlanApprovalGeneration = this.todoPlanRevisionGeneration;
11748
+ todoPlanApprovalRevision = qwenTodoApproval;
11749
+ }
11067
11750
  const params = {
11068
11751
  sessionId: this.sessionId,
11069
11752
  options: permissionOptions,
@@ -11082,9 +11765,7 @@ ${this.pendingRecoveredAgentsNotice}
11082
11765
  _meta: {
11083
11766
  toolName,
11084
11767
  ...interactionMetaFields(confirmationDetails),
11085
- ...isExitPlanModeTool && this.activeTodoPlanRevision ? {
11086
- qwenTodoApproval: this.activeTodoPlanRevision
11087
- } : {}
11768
+ ...qwenTodoApproval ? { qwenTodoApproval } : {}
11088
11769
  }
11089
11770
  }
11090
11771
  };
@@ -11115,6 +11796,8 @@ ${this.pendingRecoveredAgentsNotice}
11115
11796
  if (permissionRequestCancellation) {
11116
11797
  return permissionRequestCancellation;
11117
11798
  }
11799
+ const staleTodoPlanApproval2 = await cancelStaleTodoPlanApproval();
11800
+ if (staleTodoPlanApproval2) return staleTodoPlanApproval2;
11118
11801
  outcome = resolvePermissionOutcome(
11119
11802
  output,
11120
11803
  offeredPermissionOptions
@@ -11371,6 +12054,8 @@ ${this.pendingRecoveredAgentsNotice}
11371
12054
  if (executionBoundaryCancellation) {
11372
12055
  return executionBoundaryCancellation;
11373
12056
  }
12057
+ const staleTodoPlanApproval = await cancelStaleTodoPlanApproval();
12058
+ if (staleTodoPlanApproval) return staleTodoPlanApproval;
11374
12059
  const continuedAgentId = toolName === ToolNames.SEND_MESSAGE && typeof args["task_id"] === "string" && args["task_id"].length > 0 ? args["task_id"] : void 0;
11375
12060
  const provisionalRelatedAgent = continuedAgentId !== void 0 && !this.relatedAgentIds.has(continuedAgentId);
11376
12061
  if (provisionalRelatedAgent) {
@@ -11532,7 +12217,7 @@ ${this.pendingRecoveredAgentsNotice}
11532
12217
  if ((isEnterPlanModeTool || isExitPlanModeTool) && !toolResult.error && this.config.getApprovalMode() !== approvalMode) {
11533
12218
  await this.sendCurrentModeUpdateNotification();
11534
12219
  if (this.config.getApprovalMode() === "plan" /* PLAN */) {
11535
- this.activeTodoPlanRevision = void 0;
12220
+ this.clearActiveTodoPlanRevision();
11536
12221
  this.#clearTodoStopGuardTrustAndDrainAutomaticQueues();
11537
12222
  }
11538
12223
  }
@@ -11881,12 +12566,18 @@ ${this.pendingRecoveredAgentsNotice}
11881
12566
  this.refreshContextFilesOnWrite = result.type === "submit_prompt" && Boolean(result.refreshContextFilesOnWrite);
11882
12567
  const recorder = shouldRecordResult ? this.config.getChatRecordingService() : void 0;
11883
12568
  switch (result.type) {
11884
- case "submit_prompt":
12569
+ case "submit_prompt": {
12570
+ const expandedPrompt = normalizePartList(result.content);
12571
+ const attachmentBlocks = result.resolvedCommand?.kind === "built-in" /* BUILT_IN */ ? [] : originalPrompt.filter((block) => block.type !== "text");
12572
+ const attachmentParts = attachmentBlocks.length === 0 ? [] : await this.#resolvePrompt(attachmentBlocks, abortSignal, {
12573
+ deferBridgeConversions: true
12574
+ });
11885
12575
  return this.#applyBridgeConversionsIfNeeded(
11886
- normalizePartList(result.content),
12576
+ [...attachmentParts, ...expandedPrompt],
11887
12577
  abortSignal,
11888
12578
  onFullTurnModel
11889
12579
  );
12580
+ }
11890
12581
  case "message": {
11891
12582
  if (result.messageType === "error") {
11892
12583
  throw new Error(result.content || "Slash command failed.");
@@ -13115,11 +13806,21 @@ function validateSkillSlug(slug) {
13115
13806
  }
13116
13807
  }
13117
13808
  __name(validateSkillSlug, "validateSkillSlug");
13809
+ function rejectInstallArtifactSlug(slug) {
13810
+ if (/\.(backup|installing)-\d+-\d+$/.test(slug)) {
13811
+ throw RequestError.invalidParams(
13812
+ void 0,
13813
+ "Invalid skill.slug: name ends with a reserved install-artifact suffix"
13814
+ );
13815
+ }
13816
+ }
13817
+ __name(rejectInstallArtifactSlug, "rejectInstallArtifactSlug");
13118
13818
  function readSkillInstallRequest(params) {
13119
13819
  const skillParams = toRecord2(params["skill"]);
13120
13820
  const input = Object.keys(skillParams).length > 0 ? skillParams : params;
13121
13821
  const slug = readRequiredString2(input["slug"], "skill.slug");
13122
13822
  validateSkillSlug(slug);
13823
+ rejectInstallArtifactSlug(slug);
13123
13824
  const scope = readOptionalString2(input["scope"], "skill.scope") ?? "global";
13124
13825
  if (scope !== "global") {
13125
13826
  throw RequestError.invalidParams(
@@ -13286,8 +13987,29 @@ async function installSkillFromUrl(config, request) {
13286
13987
  await fs2.mkdir(path5.dirname(targetPath), { recursive: true });
13287
13988
  await fs2.writeFile(targetPath, file.content);
13288
13989
  }
13289
- await fs2.rm(skillDir, { recursive: true, force: true });
13290
- await fs2.rename(stagingDir, skillDir);
13990
+ const backupDir = `${skillDir}.backup-${process.pid}-${Date.now()}`;
13991
+ let backedUp = false;
13992
+ try {
13993
+ try {
13994
+ await fs2.rename(skillDir, backupDir);
13995
+ backedUp = true;
13996
+ } catch (err) {
13997
+ if (err.code !== "ENOENT") throw err;
13998
+ }
13999
+ await fs2.rename(stagingDir, skillDir);
14000
+ } catch (error) {
14001
+ if (backedUp) {
14002
+ await fs2.rename(backupDir, skillDir).catch(() => {
14003
+ });
14004
+ }
14005
+ await fs2.rm(stagingDir, { recursive: true, force: true }).catch(() => {
14006
+ });
14007
+ throw error;
14008
+ }
14009
+ if (backedUp) {
14010
+ await fs2.rm(backupDir, { recursive: true, force: true }).catch(() => {
14011
+ });
14012
+ }
13291
14013
  } catch (error) {
13292
14014
  await fs2.rm(stagingDir, { recursive: true, force: true }).catch(() => {
13293
14015
  });
@@ -13536,11 +14258,91 @@ function serializeMonitorTask(entry, now) {
13536
14258
  };
13537
14259
  }
13538
14260
  __name(serializeMonitorTask, "serializeMonitorTask");
13539
- function buildSessionTasksStatus(sessionId, config, now = Date.now()) {
14261
+ function serializeWorkflowTask(entry, now) {
14262
+ return {
14263
+ kind: "workflow",
14264
+ id: entry.runId,
14265
+ ...optionalField("toolUseId", entry.toolUseId),
14266
+ ...optionalField("sourceRunId", entry.sourceRunId),
14267
+ ...optionalField("startMode", entry.startMode),
14268
+ label: entry.meta?.name ?? entry.description ?? entry.runId,
14269
+ description: entry.meta?.description ?? entry.description,
14270
+ status: entry.status,
14271
+ startTime: entry.startTime,
14272
+ runtimeMs: runtimeMs(entry, now),
14273
+ outputFile: entry.outputFile,
14274
+ ...optionalField("endTime", entry.endTime),
14275
+ isBackgrounded: entry.isBackgrounded === true,
14276
+ currentPhase: entry.currentPhase,
14277
+ phaseVisits: entry.phaseVisits.map((visit) => ({ ...visit })),
14278
+ dispatches: entry.dispatches.map((dispatch) => ({
14279
+ ...dispatch,
14280
+ dependsOn: [...dispatch.dependsOn]
14281
+ })),
14282
+ agentsDispatched: entry.agentsDispatched,
14283
+ agentsCompleted: entry.agentsCompleted,
14284
+ tokensSpent: entry.tokensSpent,
14285
+ tokenBudgetTotal: entry.tokenBudgetTotal,
14286
+ recentLogs: [...entry.recentLogs],
14287
+ events: entry.events.map((event) => ({ ...event })),
14288
+ pendingApprovalCount: entry.pendingApprovals.length,
14289
+ pendingApprovals: entry.pendingApprovals.map((approval) => ({
14290
+ approvalId: approval.approvalId,
14291
+ subagentId: approval.subagentId,
14292
+ name: approval.name,
14293
+ description: approval.description,
14294
+ at: approval.at
14295
+ })),
14296
+ ...optionalField("error", entry.error)
14297
+ };
14298
+ }
14299
+ __name(serializeWorkflowTask, "serializeWorkflowTask");
14300
+ function serializeWorkflowSnapshot(snapshot) {
14301
+ return {
14302
+ kind: "workflow",
14303
+ id: snapshot.runId,
14304
+ isHistorical: true,
14305
+ ...optionalField("sourceRunId", snapshot.sourceRunId),
14306
+ ...optionalField("startMode", snapshot.startMode),
14307
+ label: snapshot.meta?.name ?? snapshot.description ?? snapshot.runId,
14308
+ description: snapshot.meta?.description ?? snapshot.description ?? snapshot.runId,
14309
+ status: snapshot.status,
14310
+ startTime: snapshot.startTime,
14311
+ ...optionalField("endTime", snapshot.endTime),
14312
+ runtimeMs: runtimeMs(snapshot, snapshot.endTime ?? snapshot.startTime),
14313
+ isBackgrounded: false,
14314
+ currentPhase: snapshot.phases.at(-1) ?? null,
14315
+ phaseVisits: (snapshot.phaseVisits ?? []).map((visit) => ({ ...visit })),
14316
+ dispatches: (snapshot.dispatches ?? []).map((dispatch) => ({
14317
+ ...dispatch,
14318
+ dependsOn: [...dispatch.dependsOn]
14319
+ })),
14320
+ agentsDispatched: snapshot.agentsDispatched,
14321
+ agentsCompleted: snapshot.agentsCompleted,
14322
+ tokensSpent: snapshot.tokensSpent,
14323
+ tokenBudgetTotal: snapshot.tokenBudgetTotal,
14324
+ recentLogs: [...snapshot.recentLogs],
14325
+ ...optionalField(
14326
+ "events",
14327
+ snapshot.events?.map((event) => ({ ...event }))
14328
+ ),
14329
+ pendingApprovalCount: 0,
14330
+ ...optionalField("error", snapshot.error)
14331
+ };
14332
+ }
14333
+ __name(serializeWorkflowSnapshot, "serializeWorkflowSnapshot");
14334
+ function buildSessionTasksStatus(sessionId, config, now = Date.now(), workflowHistory = [], options = {}) {
14335
+ const includeWorkflows = options.includeWorkflows === true;
14336
+ const workflowTasks = includeWorkflows ? config.getWorkflowRunRegistry().list() : [];
14337
+ const inMemoryWorkflowIds = new Set(
14338
+ workflowTasks.map((entry) => entry.runId)
14339
+ );
13540
14340
  const tasks = [
13541
14341
  ...config.getBackgroundTaskRegistry().getAll().map((entry) => serializeAgentTask(entry, now)),
13542
14342
  ...config.getBackgroundShellRegistry().getAll().map((entry) => serializeShellTask(entry, now)),
13543
- ...config.getMonitorRegistry().getAll().map((entry) => serializeMonitorTask(entry, now))
14343
+ ...config.getMonitorRegistry().getAll().map((entry) => serializeMonitorTask(entry, now)),
14344
+ ...includeWorkflows ? workflowTasks.map((entry) => serializeWorkflowTask(entry, now)) : [],
14345
+ ...includeWorkflows ? workflowHistory.filter((snapshot) => !inMemoryWorkflowIds.has(snapshot.runId)).map(serializeWorkflowSnapshot) : []
13544
14346
  ].sort((a, b) => a.startTime - b.startTime);
13545
14347
  return {
13546
14348
  v: STATUS_SCHEMA_VERSION,
@@ -13582,12 +14384,17 @@ var ACP_ERROR_CODES = {
13582
14384
  };
13583
14385
 
13584
14386
  // packages/cli/src/acp-integration/acpAgent.ts
14387
+ function isSessionOwnedWorkflowTool(value) {
14388
+ return typeof value === "object" && value !== null && "buildSessionOwnedBackground" in value && typeof value.buildSessionOwnedBackground === "function";
14389
+ }
14390
+ __name(isSessionOwnedWorkflowTool, "isSessionOwnedWorkflowTool");
13585
14391
  var debugLogger9 = createDebugLogger("ACP_AGENT");
13586
14392
  var QWEN_ACP_LOCAL_READ_ROOTS_ENV = "QWEN_ACP_LOCAL_READ_ROOTS";
13587
14393
  var POSIX_TMP_LOCAL_READ_ROOT = "/tmp";
13588
14394
  var BTW_CHILD_TIMEOUT_MS = 55e3;
13589
14395
  var MCP_OAUTH_START_TIMEOUT_MS = 3e4;
13590
14396
  var SESSION_DRAIN_TIMEOUT_MS = 3e4;
14397
+ var SESSION_ID_RE = /^[0-9a-fA-F-]{32,36}$/;
13591
14398
  var WORKSPACE_MEMORY_REMEMBER_CHILD_TIMEOUT_MS = 295e3;
13592
14399
  function currentGoalSnapshot(config, runtime) {
13593
14400
  try {
@@ -14506,6 +15313,23 @@ function readCoreSettingValues(source) {
14506
15313
  return values;
14507
15314
  }
14508
15315
  __name(readCoreSettingValues, "readCoreSettingValues");
15316
+ function foldReloadApprovalMode(raw) {
15317
+ if (!raw) {
15318
+ return "auto" /* AUTO */;
15319
+ }
15320
+ if (typeof raw === "string") {
15321
+ try {
15322
+ return parseApprovalModeValue(raw);
15323
+ } catch {
15324
+ }
15325
+ }
15326
+ return void 0;
15327
+ }
15328
+ __name(foldReloadApprovalMode, "foldReloadApprovalMode");
15329
+ function isRestrictedApprovalModeConfig(config) {
15330
+ return config.isSafeMode?.() === true || config.getBareMode?.() === true;
15331
+ }
15332
+ __name(isRestrictedApprovalModeConfig, "isRestrictedApprovalModeConfig");
14509
15333
  function normalizeCoreSettingValue(key, value) {
14510
15334
  const definition = QWEN_CORE_SETTING_DEFINITIONS[key];
14511
15335
  switch (definition.type) {
@@ -15534,6 +16358,11 @@ function isOwnerOnlyDirectory(stats) {
15534
16358
  return (stats.mode & 63) === 0;
15535
16359
  }
15536
16360
  __name(isOwnerOnlyDirectory, "isOwnerOnlyDirectory");
16361
+ function hasExpectedManagedDirectoryIdentity(stats, expected) {
16362
+ const inodeVerifiable = hasVerifiableInode(stats.ino);
16363
+ return stats.dev === expected.device && inodeVerifiable === (expected.inode !== 0) && (!inodeVerifiable || stats.ino === expected.inode);
16364
+ }
16365
+ __name(hasExpectedManagedDirectoryIdentity, "hasExpectedManagedDirectoryIdentity");
15537
16366
  function hasOnlyKeys(value, keys) {
15538
16367
  const actual = Object.keys(value).sort();
15539
16368
  const expected = [...keys].sort();
@@ -15608,7 +16437,7 @@ async function assertManagedConversationDirectoryIdentity(expectation) {
15608
16437
  error.code === "ENOENT"
15609
16438
  );
15610
16439
  }
15611
- if (!isOwnerOnlyDirectory(rootBefore) || !isOwnerOnlyDirectory(rootAfter) || !isSameConversationPath(canonicalRoot, expectation.root.canonicalPath) || rootBefore.dev !== expectation.root.device || rootBefore.ino !== expectation.root.inode || rootAfter.dev !== expectation.root.device || rootAfter.ino !== expectation.root.inode) {
16440
+ if (!isOwnerOnlyDirectory(rootBefore) || !isOwnerOnlyDirectory(rootAfter) || !isSameConversationPath(canonicalRoot, expectation.root.canonicalPath) || !hasExpectedManagedDirectoryIdentity(rootBefore, expectation.root) || !hasExpectedManagedDirectoryIdentity(rootAfter, expectation.root)) {
15612
16441
  throw managedConversationDirectoryError(false);
15613
16442
  }
15614
16443
  let childBefore;
@@ -15623,12 +16452,12 @@ async function assertManagedConversationDirectoryIdentity(expectation) {
15623
16452
  error.code === "ENOENT"
15624
16453
  );
15625
16454
  }
15626
- if (!isOwnerOnlyDirectory(childBefore) || !isOwnerOnlyDirectory(childAfter) || !isSameConversationPath(canonicalChild, expectation.child.canonicalPath) || childBefore.dev !== expectation.child.device || childBefore.ino !== expectation.child.inode || childAfter.dev !== expectation.child.device || childAfter.ino !== expectation.child.inode) {
16455
+ if (!isOwnerOnlyDirectory(childBefore) || !isOwnerOnlyDirectory(childAfter) || !isSameConversationPath(canonicalChild, expectation.child.canonicalPath) || !hasExpectedManagedDirectoryIdentity(childBefore, expectation.child) || !hasExpectedManagedDirectoryIdentity(childAfter, expectation.child)) {
15627
16456
  throw managedConversationDirectoryError(false);
15628
16457
  }
15629
16458
  }
15630
16459
  __name(assertManagedConversationDirectoryIdentity, "assertManagedConversationDirectoryIdentity");
15631
- var QwenAgent = class {
16460
+ var QwenAgent = class _QwenAgent {
15632
16461
  constructor(config, settings, argv, connection, expectedPrivateParentCapability, sessionWriterLeaseEnabledAtStartup = false, managedToolInvocationGuard, externalToolGuardProviderAttached = false) {
15633
16462
  this.config = config;
15634
16463
  this.settings = settings;
@@ -15668,13 +16497,21 @@ var QwenAgent = class {
15668
16497
  __name(this, "QwenAgent");
15669
16498
  }
15670
16499
  sessions = /* @__PURE__ */ new Map();
16500
+ modelProviderReloadRevision = 0;
15671
16501
  historyMutationTails = /* @__PURE__ */ new Map();
15672
16502
  startingSessionIds = /* @__PURE__ */ new Set();
16503
+ /**
16504
+ * R7-10: workflow registries of sessions already removed from
16505
+ * `this.sessions` whose runs have not finished settling. Consulted by
16506
+ * `isWorkflowRunLiveOutsideSession` so a delete-history cannot delete
16507
+ * an orphaned live run out from under itself. Pruned as they drain.
16508
+ */
16509
+ detachedWorkflowRegistries = /* @__PURE__ */ new Set();
15673
16510
  activePromptCalls = /* @__PURE__ */ new Map();
15674
16511
  workspaceMcpDiscoveryConfig;
15675
16512
  workspaceMcpDiscoveryPromise;
15676
16513
  workspaceMcpDiscoveryError;
15677
- workspaceExtensionStatusRefreshPromise;
16514
+ workspaceExtensionStatusRefreshes = /* @__PURE__ */ new Map();
15678
16515
  pendingMcpAuthentications = /* @__PURE__ */ new Map();
15679
16516
  mcpAuthenticationResults = /* @__PURE__ */ new Map();
15680
16517
  generationControllers = /* @__PURE__ */ new Map();
@@ -15682,6 +16519,26 @@ var QwenAgent = class {
15682
16519
  transcriptReplayConfigCache = /* @__PURE__ */ new Map();
15683
16520
  pendingConfigCleanup = /* @__PURE__ */ new Map();
15684
16521
  initializingConfigs = /* @__PURE__ */ new Set();
16522
+ sessionWorkflowEnabledOverride;
16523
+ /**
16524
+ * The last file-derived approval mode each live session actually
16525
+ * converged on, seeded with the session's boot-derived mode at
16526
+ * publication. `workspaceReload` compares the reloaded disk value against
16527
+ * this — not against each session's live mode — because approval mode has
16528
+ * runtime-only writers (`ExitPlanModeTool` approved plan exits, ACP
16529
+ * `session/set_mode`, the `sessionApprovalMode` ext) that never persist,
16530
+ * so a live session legitimately diverges from the file mid-workflow and
16531
+ * an unchanged file must not clobber those transitions. The record lives
16532
+ * on the daemon so it survives a `this.settings` cache swap, and per
16533
+ * session because one daemon-wide baseline cannot represent a partially
16534
+ * applied convergence: while a session skipped mid-flip still waits for
16535
+ * its value, the file can round-trip back to the old baseline and strand
16536
+ * the already-flipped sessions on the intermediate mode. An entry advances
16537
+ * only when that session successfully converges, so skipped sessions and
16538
+ * failed applies retry on the next reload, and an unparseable file value
16539
+ * (undefined fold) is never recorded.
16540
+ */
16541
+ sessionApprovalModeConverged = /* @__PURE__ */ new Map();
15685
16542
  managedShuttingDown = false;
15686
16543
  clientCapabilities;
15687
16544
  /** Set once the daemon negotiates active-work reporting; one per channel. */
@@ -15874,19 +16731,25 @@ var QwenAgent = class {
15874
16731
  }
15875
16732
  return this.workspaceMcpDiscoveryConfig ?? this.config;
15876
16733
  }
15877
- refreshBootstrapExtensionStatus() {
15878
- if (this.workspaceExtensionStatusRefreshPromise) {
15879
- return this.workspaceExtensionStatusRefreshPromise;
15880
- }
16734
+ refreshBootstrapExtensionStatus(skillsOnly = false) {
16735
+ const inFlight = this.workspaceExtensionStatusRefreshes.get(skillsOnly);
16736
+ if (inFlight) return inFlight;
15881
16737
  const promise = (async () => {
15882
16738
  const errors = [];
16739
+ if (skillsOnly) {
16740
+ try {
16741
+ this.settings.reloadScopeFromDisk("Workspace" /* Workspace */);
16742
+ } catch (error) {
16743
+ errors.push(error);
16744
+ }
16745
+ }
15883
16746
  try {
15884
16747
  await this.config.getExtensionManager().refreshCache();
15885
16748
  } catch (error) {
15886
16749
  errors.push(error);
15887
16750
  }
15888
16751
  try {
15889
- await this.config.getSkillManager()?.refreshCache();
16752
+ await this.config.getSkillManager()?.refreshCache(skillsOnly ? { throwOnError: true } : void 0);
15890
16753
  } catch (error) {
15891
16754
  errors.push(error);
15892
16755
  }
@@ -15898,10 +16761,10 @@ var QwenAgent = class {
15898
16761
  );
15899
16762
  }
15900
16763
  })();
15901
- this.workspaceExtensionStatusRefreshPromise = promise;
16764
+ this.workspaceExtensionStatusRefreshes.set(skillsOnly, promise);
15902
16765
  const clear = /* @__PURE__ */ __name(() => {
15903
- if (this.workspaceExtensionStatusRefreshPromise === promise) {
15904
- this.workspaceExtensionStatusRefreshPromise = void 0;
16766
+ if (this.workspaceExtensionStatusRefreshes.get(skillsOnly) === promise) {
16767
+ this.workspaceExtensionStatusRefreshes.delete(skillsOnly);
15905
16768
  }
15906
16769
  }, "clear");
15907
16770
  void promise.then(clear, clear);
@@ -15970,56 +16833,63 @@ var QwenAgent = class {
15970
16833
  }
15971
16834
  async createWorkspaceMcpDiscoveryConfig(settings) {
15972
16835
  if (this.workspaceMcpDiscoveryConfig) return;
15973
- const cwd = this.config.getTargetDir();
15974
- const config = await this.runWithPinnedRuntimeBaseDir(
15975
- settings,
15976
- cwd,
15977
- () => loadCliConfig(
15978
- settings.merged,
15979
- {
15980
- ...this.argv,
15981
- sessionId: "workspace-mcp-discovery",
15982
- resume: void 0,
15983
- continue: false,
15984
- chatRecording: false
15985
- },
16836
+ return sessionIdContext.run("workspace-mcp-discovery", async () => {
16837
+ const cwd = this.config.getTargetDir();
16838
+ const config = await this.runWithPinnedRuntimeBaseDir(
16839
+ settings,
15986
16840
  cwd,
15987
- void 0,
15988
- {
15989
- userHooks: settings.getUserHooks(),
15990
- projectHooks: settings.getProjectHooks()
15991
- },
15992
- buildDisabledSkillNamesProvider(settings)
15993
- )
15994
- );
15995
- config.setMcpTransportPool(this.mcpPool);
15996
- try {
15997
- await config.initialize({
15998
- skipLlmInitialization: true,
15999
- skipFileCheckpointing: true,
16000
- skipHooks: true,
16001
- skipSkillManager: true,
16002
- skipMcpDiscovery: true,
16003
- lenientToolWarmup: true
16004
- });
16005
- const manager = config.getToolRegistry()?.getMcpClientManager();
16006
- if (!manager) {
16007
- throw new Error("MCP client manager is unavailable");
16008
- }
16009
- await manager.discoverAllMcpToolsIncremental(config);
16010
- if (manager.getDiscoveryState() === "not_started" /* NOT_STARTED */) {
16011
- throw new Error(
16012
- "MCP discovery did not start. The workspace may not be trusted."
16013
- );
16014
- }
16015
- this.workspaceMcpDiscoveryConfig = config;
16016
- } catch (error) {
16841
+ () => loadCliConfig(
16842
+ settings.merged,
16843
+ {
16844
+ ...this.argv,
16845
+ sessionId: "workspace-mcp-discovery",
16846
+ resume: void 0,
16847
+ continue: false,
16848
+ chatRecording: false
16849
+ },
16850
+ cwd,
16851
+ void 0,
16852
+ {
16853
+ userHooks: settings.getUserHooks(),
16854
+ projectHooks: settings.getProjectHooks()
16855
+ },
16856
+ buildDisabledSkillNamesProvider(settings),
16857
+ void 0,
16858
+ void 0,
16859
+ void 0,
16860
+ void 0,
16861
+ buildEnabledSkillNamesProvider(settings)
16862
+ )
16863
+ );
16864
+ config.setMcpTransportPool(this.mcpPool);
16017
16865
  try {
16018
- await config.getToolRegistry()?.stop();
16019
- } catch {
16866
+ await config.initialize({
16867
+ skipLlmInitialization: true,
16868
+ skipFileCheckpointing: true,
16869
+ skipHooks: true,
16870
+ skipSkillManager: true,
16871
+ skipMcpDiscovery: true,
16872
+ lenientToolWarmup: true
16873
+ });
16874
+ const manager = config.getToolRegistry()?.getMcpClientManager();
16875
+ if (!manager) {
16876
+ throw new Error("MCP client manager is unavailable");
16877
+ }
16878
+ await manager.discoverAllMcpToolsIncremental(config);
16879
+ if (manager.getDiscoveryState() === "not_started" /* NOT_STARTED */) {
16880
+ throw new Error(
16881
+ "MCP discovery did not start. The workspace may not be trusted."
16882
+ );
16883
+ }
16884
+ this.workspaceMcpDiscoveryConfig = config;
16885
+ } catch (error) {
16886
+ try {
16887
+ await config.getToolRegistry()?.stop();
16888
+ } catch {
16889
+ }
16890
+ throw error;
16020
16891
  }
16021
- throw error;
16022
- }
16892
+ });
16023
16893
  }
16024
16894
  initializeWorkspaceMcpDiscovery() {
16025
16895
  if (this.workspaceMcpDiscoveryConfig || this.workspaceMcpDiscoveryPromise) {
@@ -16061,6 +16931,10 @@ var QwenAgent = class {
16061
16931
  config.setAllowedMcpServers(gating.allowed);
16062
16932
  config.setPendingMcpServers(gating.pending);
16063
16933
  await config.reinitializeMcpServers(mcpServers);
16934
+ const llmClient = config.getLlmClient?.();
16935
+ if (llmClient?.isInitialized?.()) {
16936
+ await llmClient.setTools?.();
16937
+ }
16064
16938
  } catch (error) {
16065
16939
  syncErrors.push(error);
16066
16940
  }
@@ -16183,6 +17057,19 @@ var QwenAgent = class {
16183
17057
  cleanupErrors.push(error);
16184
17058
  }
16185
17059
  this.sessions.delete(sessionId);
17060
+ this.sessionApprovalModeConverged.delete(sessionId);
17061
+ try {
17062
+ this.pruneDrainedWorkflowRegistries();
17063
+ const registry = session.getConfig().getWorkflowRunRegistry?.();
17064
+ if (registry && _QwenAgent.isWorkflowRegistryDraining(registry)) {
17065
+ this.detachedWorkflowRegistries.add(registry);
17066
+ }
17067
+ } catch (error) {
17068
+ debugLogger9.warn(
17069
+ `Session ${sessionId}: could not retain its workflow registry for liveness checks:`,
17070
+ error
17071
+ );
17072
+ }
16186
17073
  this.activeWorkReporter?.notifyChanged();
16187
17074
  if (cleanupErrors.length > 0) {
16188
17075
  debugLogger9.warn(
@@ -16522,7 +17409,7 @@ var QwenAgent = class {
16522
17409
  }
16523
17410
  this.clientCapabilities = args.clientCapabilities;
16524
17411
  const authMethods = buildAuthMethods();
16525
- const version = "0.22.3";
17412
+ const version = "0.23.0";
16526
17413
  const response = {
16527
17414
  protocolVersion: PROTOCOL_VERSION,
16528
17415
  agentInfo: {
@@ -16615,7 +17502,11 @@ var QwenAgent = class {
16615
17502
  }
16616
17503
  await clearCachedCredentialFile();
16617
17504
  try {
16618
- await this.config.refreshAuth(method);
17505
+ await this.refreshAuthWithPersistedReasoning(
17506
+ this.config,
17507
+ this.settings,
17508
+ method
17509
+ );
16619
17510
  this.settings.setValue(
16620
17511
  "User" /* User */,
16621
17512
  "security.auth.selectedType",
@@ -16643,6 +17534,41 @@ var QwenAgent = class {
16643
17534
  this.startingSessionIds.delete(sessionId);
16644
17535
  };
16645
17536
  }
17537
+ createSessionInitializationDeadline(raw) {
17538
+ if (raw === void 0 || !this.isTrustedManagedParent()) return void 0;
17539
+ if (typeof raw !== "number" || !Number.isSafeInteger(raw) || raw <= 0) {
17540
+ throw RequestError.invalidParams(
17541
+ { errorKind: "invalid_session_initialization_deadline" },
17542
+ `\`_meta["${SESSION_INITIALIZATION_DEADLINE_META_KEY}"]\` must be a positive safe integer`
17543
+ );
17544
+ }
17545
+ const remainingMs = raw - Date.now();
17546
+ if (remainingMs > 2147483647) {
17547
+ throw RequestError.invalidParams(
17548
+ { errorKind: "invalid_session_initialization_deadline" },
17549
+ `\`_meta["${SESSION_INITIALIZATION_DEADLINE_META_KEY}"]\` exceeds the supported timer range`
17550
+ );
17551
+ }
17552
+ const controller = new AbortController();
17553
+ const timeoutError = new RequestError(
17554
+ ACP_ERROR_CODES.INTERNAL_ERROR,
17555
+ "Session initialization deadline exceeded",
17556
+ { errorKind: SESSION_INITIALIZATION_TIMEOUT_ERROR_KIND }
17557
+ );
17558
+ let timer;
17559
+ if (remainingMs <= 0) {
17560
+ controller.abort(timeoutError);
17561
+ } else {
17562
+ timer = setTimeout(() => controller.abort(timeoutError), remainingMs);
17563
+ timer.unref();
17564
+ }
17565
+ return {
17566
+ signal: controller.signal,
17567
+ dispose: /* @__PURE__ */ __name(() => {
17568
+ if (timer) clearTimeout(timer);
17569
+ }, "dispose")
17570
+ };
17571
+ }
16646
17572
  async newSession(params) {
16647
17573
  const { cwd, mcpServers } = params;
16648
17574
  const parsedSessionId = parseCallerSuppliedSessionId(
@@ -16657,7 +17583,12 @@ var QwenAgent = class {
16657
17583
  }
16658
17584
  const requestedSessionId = parsedSessionId.kind === "valid" ? parsedSessionId.sessionId : void 0;
16659
17585
  const releaseStartingSessionId = requestedSessionId ? this.reserveStartingSessionId(requestedSessionId) : void 0;
17586
+ let initializationDeadline;
16660
17587
  try {
17588
+ initializationDeadline = this.createSessionInitializationDeadline(
17589
+ params._meta?.[SESSION_INITIALIZATION_DEADLINE_META_KEY]
17590
+ );
17591
+ initializationDeadline?.signal.throwIfAborted();
16661
17592
  const sessionSource = getSessionSource(params);
16662
17593
  const provisionalStandalone = isReservedStandaloneSessionSourceType(
16663
17594
  sessionSource?.sourceType
@@ -16679,6 +17610,8 @@ var QwenAgent = class {
16679
17610
  () => loadSettingsCached(cwd)
16680
17611
  );
16681
17612
  this.settings = settings;
17613
+ const deferMcpDiscovery = shouldDeferMcpDiscovery(params);
17614
+ const configProviderRevision = this.modelProviderReloadRevision;
16682
17615
  const config = await profiler.time(
16683
17616
  "config_setup",
16684
17617
  () => this.newSessionConfig(
@@ -16688,16 +17621,21 @@ var QwenAgent = class {
16688
17621
  sessionSource,
16689
17622
  requestedSessionId,
16690
17623
  void 0,
16691
- shouldDeferMcpDiscovery(params) ? { skipMcpDiscovery: true } : void 0
17624
+ initializationDeadline || deferMcpDiscovery ? {
17625
+ ...initializationDeadline ? { signal: initializationDeadline.signal } : {},
17626
+ ...deferMcpDiscovery ? { skipMcpDiscovery: true } : {}
17627
+ } : void 0
16692
17628
  )
16693
17629
  );
16694
17630
  let session;
16695
17631
  try {
17632
+ initializationDeadline?.signal.throwIfAborted();
16696
17633
  if (!provisionalStandalone) {
16697
17634
  await profiler.time(
16698
17635
  "auth",
16699
- () => this.ensureAuthenticated(config)
17636
+ () => this.ensureAuthenticated(config, settings)
16700
17637
  );
17638
+ initializationDeadline?.signal.throwIfAborted();
16701
17639
  profiler.timeSync(
16702
17640
  "file_system_setup",
16703
17641
  () => this.setupFileSystem(config)
@@ -16706,7 +17644,9 @@ var QwenAgent = class {
16706
17644
  session = await profiler.time(
16707
17645
  "session_register",
16708
17646
  () => this.createAndStoreSession(config, settings, void 0, {
16709
- deferWorkspaceActivation: provisionalStandalone
17647
+ deferWorkspaceActivation: provisionalStandalone,
17648
+ ...initializationDeadline ? { signal: initializationDeadline.signal } : {},
17649
+ configProviderRevision
16710
17650
  })
16711
17651
  );
16712
17652
  } catch (error) {
@@ -16727,6 +17667,7 @@ var QwenAgent = class {
16727
17667
  parentContext ? { parentContext } : {}
16728
17668
  );
16729
17669
  } finally {
17670
+ initializationDeadline?.dispose();
16730
17671
  releaseStartingSessionId?.();
16731
17672
  }
16732
17673
  }
@@ -16880,6 +17821,7 @@ var QwenAgent = class {
16880
17821
  sessionId = persistedSessionId;
16881
17822
  profiler.setSessionId(sessionId);
16882
17823
  this.settings = settings;
17824
+ const configProviderRevision = this.modelProviderReloadRevision;
16883
17825
  const config = await profiler.time(
16884
17826
  "config_setup",
16885
17827
  () => this.newSessionConfig(
@@ -16928,7 +17870,10 @@ var QwenAgent = class {
16928
17870
  () => restoreSessionModelThenAuthenticate(
16929
17871
  config,
16930
17872
  projection,
16931
- () => profiler.time("auth", () => this.ensureAuthenticated(config))
17873
+ () => profiler.time(
17874
+ "auth",
17875
+ () => this.ensureAuthenticated(config, settings)
17876
+ )
16932
17877
  )
16933
17878
  );
16934
17879
  profiler.timeSync(
@@ -16940,6 +17885,7 @@ var QwenAgent = class {
16940
17885
  "session_register",
16941
17886
  () => this.createAndStoreSession(config, settings, void 0, {
16942
17887
  deferWorkspaceActivation: provisionalStandalone,
17888
+ configProviderRevision,
16943
17889
  ...provisionalStandalone ? {
16944
17890
  beforeDeferredWorkspaceActivation: /* @__PURE__ */ __name(() => profiler.time(
16945
17891
  "restore_session_model",
@@ -16948,7 +17894,7 @@ var QwenAgent = class {
16948
17894
  projection,
16949
17895
  () => profiler.time(
16950
17896
  "auth",
16951
- () => this.ensureAuthenticated(config)
17897
+ () => this.ensureAuthenticated(config, settings)
16952
17898
  )
16953
17899
  )
16954
17900
  ), "beforeDeferredWorkspaceActivation")
@@ -17038,9 +17984,9 @@ var QwenAgent = class {
17038
17984
  );
17039
17985
  }
17040
17986
  }, "prepareBeforeSessionCreate"),
17041
- beforeSessionCreate: /* @__PURE__ */ __name(() => {
17987
+ beforeSessionPublish: /* @__PURE__ */ __name(() => {
17042
17988
  response = buildResponse();
17043
- }, "beforeSessionCreate"),
17989
+ }, "beforeSessionPublish"),
17044
17990
  primeSession: /* @__PURE__ */ __name((createdSession) => {
17045
17991
  profiler.timeSync("runtime_initialize", () => {
17046
17992
  if (!projection) return;
@@ -17208,6 +18154,7 @@ var QwenAgent = class {
17208
18154
  sessionId = persistedSessionId;
17209
18155
  profiler.setSessionId(sessionId);
17210
18156
  this.settings = settings;
18157
+ const configProviderRevision = this.modelProviderReloadRevision;
17211
18158
  const config = await profiler.time(
17212
18159
  "config_setup",
17213
18160
  () => this.newSessionConfig(
@@ -17234,7 +18181,10 @@ var QwenAgent = class {
17234
18181
  () => restoreSessionModelThenAuthenticate(
17235
18182
  config,
17236
18183
  projection,
17237
- () => profiler.time("auth", () => this.ensureAuthenticated(config))
18184
+ () => profiler.time(
18185
+ "auth",
18186
+ () => this.ensureAuthenticated(config, settings)
18187
+ )
17238
18188
  )
17239
18189
  );
17240
18190
  profiler.timeSync(
@@ -17246,6 +18196,7 @@ var QwenAgent = class {
17246
18196
  "session_register",
17247
18197
  () => this.createAndStoreSession(config, settings, void 0, {
17248
18198
  deferWorkspaceActivation: provisionalStandalone,
18199
+ configProviderRevision,
17249
18200
  ...provisionalStandalone ? {
17250
18201
  beforeDeferredWorkspaceActivation: /* @__PURE__ */ __name(() => profiler.time(
17251
18202
  "restore_session_model",
@@ -17254,7 +18205,7 @@ var QwenAgent = class {
17254
18205
  projection,
17255
18206
  () => profiler.time(
17256
18207
  "auth",
17257
- () => this.ensureAuthenticated(config)
18208
+ () => this.ensureAuthenticated(config, settings)
17258
18209
  )
17259
18210
  )
17260
18211
  ), "beforeDeferredWorkspaceActivation")
@@ -17263,14 +18214,14 @@ var QwenAgent = class {
17263
18214
  sessionSource ?? {}
17264
18215
  ),
17265
18216
  replayHistory: false,
17266
- beforeSessionCreate: /* @__PURE__ */ __name(() => {
18217
+ beforeSessionPublish: /* @__PURE__ */ __name(() => {
17267
18218
  response = profiler.timeSync("response_build", () => ({
17268
18219
  modes: this.buildModesData(config),
17269
18220
  models: this.buildAvailableModels(config),
17270
18221
  configOptions: this.buildConfigOptions(config),
17271
18222
  ...projection?.runtime.artifactSnapshot ? { artifactSnapshot: projection.runtime.artifactSnapshot } : {}
17272
18223
  }));
17273
- }, "beforeSessionCreate"),
18224
+ }, "beforeSessionPublish"),
17274
18225
  primeSession: /* @__PURE__ */ __name((createdSession) => {
17275
18226
  profiler.timeSync("runtime_initialize", () => {
17276
18227
  if (!projection) return;
@@ -17420,62 +18371,81 @@ var QwenAgent = class {
17420
18371
  break;
17421
18372
  }
17422
18373
  case "reasoning_effort": {
17423
- const generation = session.getConfig().getContentGeneratorConfig();
17424
- const thinkingMandatory = generation.thinkingMandatory === true;
17425
- const modelReasoning = this.getModelReasoningConfiguration(
17426
- session.getConfig()
17427
- );
17428
- if (modelReasoning) {
17429
- const effortValues = modelReasoning.toggleOnly ? void 0 : modelReasoning.efforts;
17430
- const selected = value === REASONING_EFFORT_NONE && !thinkingMandatory ? REASONING_EFFORT_NONE : modelReasoning.toggleOnly ? value === REASONING_EFFORT_DEFAULT ? REASONING_EFFORT_DEFAULT : void 0 : effortValues?.find((effort2) => effort2 === value);
17431
- if (!selected) {
17432
- const choices = [
17433
- ...thinkingMandatory ? [] : [REASONING_EFFORT_NONE],
17434
- ...effortValues ?? [REASONING_EFFORT_DEFAULT]
17435
- ];
17436
- throw RequestError.invalidParams(
17437
- void 0,
17438
- `Unknown reasoning effort: ${value}. Choose one of: ${choices.join(", ")}`
17439
- );
17440
- }
17441
- if (!modelReasoning.toggleOnly) {
17442
- for (const source of ["extra_body", "samplingParams"]) {
17443
- const layer = generation[source];
17444
- if (!layer) continue;
17445
- const next = { ...layer };
17446
- delete next["enable_thinking"];
17447
- delete next["reasoning_effort"];
17448
- delete next["thinking_budget"];
17449
- generation[source] = next;
17450
- }
17451
- }
17452
- if (selected === REASONING_EFFORT_NONE) {
17453
- generation.reasoning = false;
17454
- } else if (selected === REASONING_EFFORT_DEFAULT) {
17455
- generation.reasoning = void 0;
17456
- } else {
17457
- const current = generation.reasoning;
17458
- generation.reasoning = {
17459
- ...current || {},
17460
- effort: selected
17461
- };
17462
- }
17463
- break;
17464
- }
17465
- const effort = value === REASONING_EFFORT_DEFAULT ? void 0 : REASONING_EFFORT_TIERS.find((tier) => tier === value);
17466
- if (value !== REASONING_EFFORT_DEFAULT && effort === void 0) {
18374
+ const config = session.getConfig();
18375
+ const generation = config.getContentGeneratorConfig();
18376
+ const option = this.buildConfigOptions(config).find(
18377
+ (candidate) => candidate.id === "reasoning_effort"
18378
+ );
18379
+ const modelReasoning = this.getModelReasoningConfiguration(config);
18380
+ const selected = parseReasoningSelection(value);
18381
+ const choices = option?.options.flatMap(
18382
+ (choice) => "value" in choice ? [choice.value] : choice.options.map((nested) => nested.value)
18383
+ ) ?? [];
18384
+ if (!option || !selected || selected !== REASONING_EFFORT_DEFAULT && !choices.includes(selected)) {
18385
+ const allowedChoices = modelReasoning ? choices : [
18386
+ REASONING_EFFORT_DEFAULT,
18387
+ ...choices.filter(
18388
+ (choice) => choice !== REASONING_EFFORT_DEFAULT
18389
+ )
18390
+ ];
17467
18391
  throw RequestError.invalidParams(
17468
18392
  void 0,
17469
- `Unknown reasoning effort: ${value}. Choose one of: ${REASONING_EFFORT_DEFAULT}, ${REASONING_EFFORT_TIERS.join(", ")}`
18393
+ option ? `Unknown reasoning effort: ${String(value)}. Choose one of: ${allowedChoices.join(", ")}` : "Reasoning is not supported by the current model"
17470
18394
  );
17471
18395
  }
17472
- if (!applyReasoningEffort(session.getConfig(), effort)) {
18396
+ const persist = params._meta?.[PERSIST_REASONING_SELECTION_META_KEY] === true;
18397
+ const tierSelected = selected !== REASONING_EFFORT_NONE && selected !== REASONING_EFFORT_DEFAULT;
18398
+ if (!modelReasoning && tierSelected && generation.reasoning === false) {
17473
18399
  throw RequestError.invalidParams(
17474
18400
  void 0,
17475
18401
  "Reasoning effort cannot be applied while thinking is disabled"
17476
18402
  );
17477
18403
  }
17478
- break;
18404
+ const defaultReasoning = session.getDefaultReasoningConfig();
18405
+ const previous = {
18406
+ reasoning: generation.reasoning,
18407
+ extra_body: generation.extra_body,
18408
+ samplingParams: generation.samplingParams
18409
+ };
18410
+ const rebuildable = config.getModelsConfig?.()?.getGenerationConfig?.();
18411
+ const previousRebuildableReasoning = rebuildable?.reasoning;
18412
+ try {
18413
+ if (modelReasoning && !modelReasoning.toggleOnly) {
18414
+ clearReasoningRequestOverrides(generation);
18415
+ }
18416
+ applyReasoningSelection(config, selected, defaultReasoning);
18417
+ if (!modelReasoning && selected !== REASONING_EFFORT_NONE) {
18418
+ config.setReasoningEffort?.(
18419
+ selected === REASONING_EFFORT_DEFAULT ? defaultReasoning ? defaultReasoning.effort : void 0 : selected
18420
+ );
18421
+ }
18422
+ const configOptions = this.buildConfigOptions(config);
18423
+ const confirmedValue = configOptions.find(
18424
+ (candidate) => candidate.id === "reasoning_effort"
18425
+ )?.currentValue;
18426
+ const confirmed = selected === REASONING_EFFORT_DEFAULT ? confirmedValue !== void 0 : confirmedValue === selected;
18427
+ if (!confirmed) {
18428
+ throw RequestError.invalidParams(
18429
+ void 0,
18430
+ modelReasoning ? `Reasoning selection was not applied: ${selected}` : "Reasoning effort cannot be applied while thinking is disabled"
18431
+ );
18432
+ }
18433
+ if (persist) {
18434
+ session.persistReasoningSelection(selected);
18435
+ }
18436
+ session.setSessionReasoningSelection(
18437
+ persist ? void 0 : selected
18438
+ );
18439
+ return {
18440
+ configOptions,
18441
+ ...persist ? { _meta: { [REASONING_SELECTION_PERSISTED_META_KEY]: true } } : {}
18442
+ };
18443
+ } catch (error) {
18444
+ Object.assign(generation, previous);
18445
+ if (rebuildable)
18446
+ rebuildable.reasoning = previousRebuildableReasoning;
18447
+ throw error;
18448
+ }
17479
18449
  }
17480
18450
  default:
17481
18451
  throw RequestError.invalidParams(
@@ -17859,7 +18829,12 @@ var QwenAgent = class {
17859
18829
  hasOAuthTokens = credentials !== null;
17860
18830
  } catch {
17861
18831
  }
17862
- const rawStatus = this.getMcpServerStatus(config, name);
18832
+ const poolRow = poolByName[name];
18833
+ const rawStatus = poolRow ? poolRow.entrySummary.some(
18834
+ (entry) => entry.status === "connected" /* CONNECTED */
18835
+ ) ? "connected" /* CONNECTED */ : poolRow.entrySummary.some(
18836
+ (entry) => entry.status === "connecting" /* CONNECTING */
18837
+ ) ? "connecting" /* CONNECTING */ : "disconnected" /* DISCONNECTED */ : this.getMcpServerStatus(config, name);
17863
18838
  const requiresAuth = rawStatus !== "connected" /* CONNECTED */ && (mcpServerRequiresOAuth.get(name) === true || server.oauth?.enabled === true && !hasOAuthTokens);
17864
18839
  const refusedByBudget = refusedSet.has(name);
17865
18840
  const effectivelyRefused = refusedByBudget && !disabled;
@@ -17949,7 +18924,6 @@ var QwenAgent = class {
17949
18924
  out.config = serverConfig;
17950
18925
  }
17951
18926
  }
17952
- const poolRow = poolByName[name];
17953
18927
  if (poolRow) {
17954
18928
  out.entryCount = poolRow.entryCount;
17955
18929
  out.entrySummary = poolRow.entrySummary.map((e) => ({
@@ -18325,7 +19299,8 @@ var QwenAgent = class {
18325
19299
  skills.map((skill) => [
18326
19300
  `${skill.level}:${skill.extensionName ?? ""}:${skill.name}`,
18327
19301
  mapSkillConfigToStatus(skill, disablements, {
18328
- disabled: isInactiveExtensionSkill(skill, inactiveSkillRefs)
19302
+ disabled: isInactiveExtensionSkill(skill, inactiveSkillRefs),
19303
+ enabled: config.isSkillEnabled(skill)
18329
19304
  })
18330
19305
  ])
18331
19306
  );
@@ -18401,13 +19376,18 @@ var QwenAgent = class {
18401
19376
  providers.set(authType, provider);
18402
19377
  }
18403
19378
  const isCurrent = currentAuth === model.authType && currentAcpModelId === modelId;
18404
- const configOptions = model.isRuntimeModel || modelId.startsWith(ACP_ROUTE_ID_PREFIX) ? void 0 : buildModelReasoningConfigPreview(model.id, {
18405
- thinkingMandatory: config.getResolvedModelConfig?.(
18406
- model.authType,
19379
+ const configOptions = model.isRuntimeModel || modelId.startsWith(ACP_ROUTE_ID_PREFIX) ? void 0 : buildModelReasoningConfigPreview(
19380
+ model.id,
19381
+ resolvePersistedReasoningConfigState(
18407
19382
  model.id,
18408
- model.registryBaseUrl ?? model.baseUrl
18409
- )?.generationConfig.thinkingMandatory === true
18410
- });
19383
+ this.settings.merged.model?.reasoningEffort,
19384
+ config.getResolvedModelConfig?.(
19385
+ model.authType,
19386
+ model.id,
19387
+ model.registryBaseUrl ?? model.baseUrl
19388
+ )?.generationConfig.thinkingMandatory === true
19389
+ )
19390
+ );
18411
19391
  const providerModel = {
18412
19392
  modelId,
18413
19393
  baseModelId: parseAcpBaseModelId(effectiveModelId),
@@ -18862,17 +19842,34 @@ var QwenAgent = class {
18862
19842
  }
18863
19843
  async buildSessionSupportedCommandsStatus(sessionId) {
18864
19844
  const session = this.sessionOrThrow(sessionId);
19845
+ const config = session.getConfig();
18865
19846
  const { availableCommands, availableSkills } = await session.buildAvailableCommandsSnapshot();
19847
+ const workflowsEnabled = this.canUseWorkflowControls(config);
19848
+ const savedWorkflows = workflowsEnabled ? (await listSavedWorkflows(config)).map(({ name, source }) => ({
19849
+ name,
19850
+ source
19851
+ })) : [];
18866
19852
  return {
18867
19853
  v: STATUS_SCHEMA_VERSION,
18868
19854
  sessionId,
18869
- availableCommands,
18870
- availableSkills: availableSkills ?? []
19855
+ availableCommands: workflowsEnabled || !config.isWorkflowsEnabled() ? availableCommands : availableCommands.filter((command) => command.name !== "workflows"),
19856
+ availableSkills: availableSkills ?? [],
19857
+ workflowsEnabled,
19858
+ savedWorkflows
18871
19859
  };
18872
19860
  }
18873
- buildSessionTasksStatus(sessionId) {
19861
+ canUseWorkflowControls(config) {
19862
+ return config.isWorkflowsEnabled() && !config.getBareMode() && (!config.getFolderTrustFeature() || config.getFolderTrust());
19863
+ }
19864
+ async buildSessionTasksStatus(sessionId, includeWorkflows = false) {
18874
19865
  const session = this.sessionOrThrow(sessionId);
18875
- return buildSessionTasksStatus(sessionId, session.getConfig());
19866
+ return buildSessionTasksStatus(
19867
+ sessionId,
19868
+ session.getConfig(),
19869
+ Date.now(),
19870
+ includeWorkflows ? await session.refreshWorkflowHistory() : [],
19871
+ { includeWorkflows }
19872
+ );
18876
19873
  }
18877
19874
  buildSessionLspStatus(sessionId) {
18878
19875
  const session = this.sessionOrThrow(sessionId);
@@ -19228,9 +20225,9 @@ var QwenAgent = class {
19228
20225
  }
19229
20226
  const sessionId = normalizedParams["sessionId"];
19230
20227
  const session = typeof sessionId === "string" && sessionId.length > 0 ? this.sessions.get(sessionId) : void 0;
19231
- if (session && this.isSessionScopedExtMethod(method)) {
19232
- return await this.runInSessionContext(
19233
- session,
20228
+ if (typeof sessionId === "string" && sessionId.length > 0 && this.isSessionScopedExtMethod(method) && (session !== void 0 || SESSION_ID_RE.test(sessionId))) {
20229
+ return await sessionIdContext.run(
20230
+ session?.getConfig().getSessionId() ?? sessionId,
19234
20231
  () => this.extMethodInternal(method, normalizedParams)
19235
20232
  );
19236
20233
  }
@@ -19248,7 +20245,6 @@ var QwenAgent = class {
19248
20245
  async extMethodInternal(method, params) {
19249
20246
  const requestedCwd = typeof params["cwd"] === "string" ? params["cwd"] : void 0;
19250
20247
  const cwd = requestedCwd || process.cwd();
19251
- const SESSION_ID_RE = /^[0-9a-fA-F-]{32,36}$/;
19252
20248
  switch (method) {
19253
20249
  case SERVE_STATUS_EXT_METHODS.channelPing: {
19254
20250
  const nonce = params["nonce"];
@@ -19350,7 +20346,11 @@ var QwenAgent = class {
19350
20346
  settings: adapter,
19351
20347
  reloadModelProviders: /* @__PURE__ */ __name((modelProviders) => this.config.reloadModelProvidersConfig(modelProviders), "reloadModelProviders"),
19352
20348
  syncAuthState: /* @__PURE__ */ __name((authType, modelId, baseUrl) => this.config.getModelsConfig().syncAfterAuthRefresh(authType, modelId, baseUrl), "syncAuthState"),
19353
- refreshAuth: /* @__PURE__ */ __name((authType) => this.config.refreshAuth(authType), "refreshAuth")
20349
+ refreshAuth: /* @__PURE__ */ __name((authType) => this.refreshAuthWithPersistedReasoning(
20350
+ this.config,
20351
+ this.settings,
20352
+ authType
20353
+ ), "refreshAuth")
19354
20354
  });
19355
20355
  const effectiveModelId = adapter.getValue("model.name") ?? plan.modelSelection?.modelId;
19356
20356
  const effectiveBaseUrl = adapter.getValue("model.baseUrl") ?? plan.modelSelection?.baseUrl;
@@ -19520,7 +20520,11 @@ var QwenAgent = class {
19520
20520
  "Invalid or missing sessionId"
19521
20521
  );
19522
20522
  }
19523
- return this.buildSessionTasksStatus(sessionId);
20523
+ const session = this.sessionOrThrow(sessionId);
20524
+ return await this.buildSessionTasksStatus(
20525
+ sessionId,
20526
+ params["includeWorkflows"] === true && this.canUseWorkflowControls(session.getConfig())
20527
+ );
19524
20528
  }
19525
20529
  case SERVE_STATUS_EXT_METHODS.sessionLspStatus: {
19526
20530
  const sessionId = params["sessionId"];
@@ -19763,6 +20767,10 @@ var QwenAgent = class {
19763
20767
  throw RequestError.invalidParams(void 0, "Invalid contextMode");
19764
20768
  }
19765
20769
  const contextMode = rawContextMode;
20770
+ const rawScope = params["scope"];
20771
+ if (rawScope !== void 0 && rawScope !== "project" && rawScope !== "user") {
20772
+ throw RequestError.invalidParams(void 0, "Invalid scope");
20773
+ }
19766
20774
  if (!this.config.isManagedMemoryAvailable()) {
19767
20775
  throw new RequestError(
19768
20776
  -32009,
@@ -19781,6 +20789,7 @@ var QwenAgent = class {
19781
20789
  projectRoot,
19782
20790
  content: content.trim(),
19783
20791
  contextMode,
20792
+ ...rawScope ? { scope: rawScope } : {},
19784
20793
  abortSignal: childSignal
19785
20794
  });
19786
20795
  if (result.filesTouched.length > 0) {
@@ -19851,6 +20860,10 @@ var QwenAgent = class {
19851
20860
  "Query exceeds maximum size"
19852
20861
  );
19853
20862
  }
20863
+ const rawScope = params["scope"];
20864
+ if (rawScope !== void 0 && rawScope !== "project" && rawScope !== "user") {
20865
+ throw RequestError.invalidParams(void 0, "Invalid scope");
20866
+ }
19854
20867
  if (!this.config.isManagedMemoryAvailable()) {
19855
20868
  throw new RequestError(
19856
20869
  -32009,
@@ -19867,7 +20880,8 @@ var QwenAgent = class {
19867
20880
  const hiddenConfig = createHiddenWorkspaceMemoryConfig(this.config);
19868
20881
  const result = await this.config.getMemoryManager().forget(projectRoot, trimmedQuery, {
19869
20882
  config: hiddenConfig,
19870
- abortSignal: childSignal
20883
+ abortSignal: childSignal,
20884
+ ...rawScope ? { scope: rawScope } : {}
19871
20885
  });
19872
20886
  return {
19873
20887
  summary: result.systemMessage ?? formatWorkspaceMemoryForgetSummary(result.removedEntries.length),
@@ -20957,10 +21971,13 @@ var QwenAgent = class {
20957
21971
  { errorKind: "containment_violation", path: rootPath }
20958
21972
  );
20959
21973
  }
20960
- if (!isOwnerOnlyDirectory(rootBefore) || !isOwnerOnlyDirectory(rootAfter) || rootBefore.dev !== rootAfter.dev || rootBefore.ino !== rootAfter.ino || conversationDirectoryExpectation !== void 0 && (!isSameConversationPath(
21974
+ if (!isOwnerOnlyDirectory(rootBefore) || !isOwnerOnlyDirectory(rootAfter) || !isSameDirectoryIdentity(rootBefore, rootAfter) || conversationDirectoryExpectation !== void 0 && (!isSameConversationPath(
20961
21975
  canonicalRoot,
20962
21976
  conversationDirectoryExpectation.root.canonicalPath
20963
- ) || rootAfter.dev !== conversationDirectoryExpectation.root.device || rootAfter.ino !== conversationDirectoryExpectation.root.inode)) {
21977
+ ) || !hasExpectedManagedDirectoryIdentity(
21978
+ rootAfter,
21979
+ conversationDirectoryExpectation.root
21980
+ ))) {
20964
21981
  if (conversationDirectoryExpectation !== void 0) {
20965
21982
  throw managedConversationDirectoryError(false);
20966
21983
  }
@@ -20988,10 +22005,13 @@ var QwenAgent = class {
20988
22005
  );
20989
22006
  }
20990
22007
  const relativeTarget = path6.relative(canonicalRoot, canonicalPath);
20991
- if (!isOwnerOnlyDirectory(targetBefore) || !isOwnerOnlyDirectory(targetAfter) || targetBefore.dev !== targetAfter.dev || targetBefore.ino !== targetAfter.ino || conversationDirectoryExpectation !== void 0 && (!isSameConversationPath(
22008
+ if (!isOwnerOnlyDirectory(targetBefore) || !isOwnerOnlyDirectory(targetAfter) || !isSameDirectoryIdentity(targetBefore, targetAfter) || conversationDirectoryExpectation !== void 0 && (!isSameConversationPath(
20992
22009
  canonicalPath,
20993
22010
  conversationDirectoryExpectation.child.canonicalPath
20994
- ) || targetAfter.dev !== conversationDirectoryExpectation.child.device || targetAfter.ino !== conversationDirectoryExpectation.child.inode) || relativeTarget.length === 0 || relativeTarget.startsWith("..") || path6.isAbsolute(relativeTarget) || relativeTarget.includes(path6.sep)) {
22011
+ ) || !hasExpectedManagedDirectoryIdentity(
22012
+ targetAfter,
22013
+ conversationDirectoryExpectation.child
22014
+ )) || relativeTarget.length === 0 || relativeTarget.startsWith("..") || path6.isAbsolute(relativeTarget) || relativeTarget.includes(path6.sep)) {
20995
22015
  if (conversationDirectoryExpectation !== void 0) {
20996
22016
  throw managedConversationDirectoryError(false);
20997
22017
  }
@@ -21014,7 +22034,10 @@ var QwenAgent = class {
21014
22034
  { errorKind: "containment_violation", path: canonicalRoot }
21015
22035
  );
21016
22036
  }
21017
- if (!isOwnerOnlyDirectory(rootFinal) || rootFinal.dev !== rootAfter.dev || rootFinal.ino !== rootAfter.ino || conversationDirectoryExpectation !== void 0 && (rootFinal.dev !== conversationDirectoryExpectation.root.device || rootFinal.ino !== conversationDirectoryExpectation.root.inode)) {
22037
+ if (!isOwnerOnlyDirectory(rootFinal) || !isSameDirectoryIdentity(rootFinal, rootAfter) || conversationDirectoryExpectation !== void 0 && !hasExpectedManagedDirectoryIdentity(
22038
+ rootFinal,
22039
+ conversationDirectoryExpectation.root
22040
+ )) {
21018
22041
  if (conversationDirectoryExpectation !== void 0) {
21019
22042
  throw managedConversationDirectoryError(false);
21020
22043
  }
@@ -21047,7 +22070,19 @@ var QwenAgent = class {
21047
22070
  const previousCwd = config.getTargetDir();
21048
22071
  let trustValidated = false;
21049
22072
  const validateTrust = /* @__PURE__ */ __name(() => {
21050
- if (managedTrustAllowed || !isFolderTrustEnabled(this.settings.merged)) {
22073
+ if (managedTrustAllowed || // Folder-trust enablement is bound to the workspace this session
22074
+ // was admitted under: `config.getFolderTrust()` is
22075
+ // `security.folderTrust.enabled` from that workspace, set once at
22076
+ // construction and never moved by `relocateWorkingDirectory`.
22077
+ // Deliberately NOT the process-wide `this.settings` cache (holds
22078
+ // another workspace's value in a multi-workspace daemon — the bug
22079
+ // this fixes), and deliberately NOT a live re-read keyed on the
22080
+ // current cwd: a cd moves `targetDir` into a subdirectory that
22081
+ // carries no `.qwen/settings.json`, so a cwd-keyed read resolves
22082
+ // disabled after the first cd and disarms the gate for the rest of
22083
+ // the session. `security.folderTrust.enabled` is `requiresRestart`,
22084
+ // so binding it at admission matches its declared semantics.
22085
+ !config.getFolderTrust()) {
21051
22086
  trustValidated = true;
21052
22087
  return;
21053
22088
  }
@@ -21208,9 +22243,25 @@ var QwenAgent = class {
21208
22243
  session.clearActiveTodoPlanRevision();
21209
22244
  }
21210
22245
  session.clearTodoStopGuardTrust();
22246
+ } else if (previous === "plan") {
22247
+ session.clearActiveTodoPlanRevision();
21211
22248
  }
21212
22249
  return { previous, current };
21213
22250
  }
22251
+ case SERVE_CONTROL_EXT_METHODS.workspaceSessionWorkflow: {
22252
+ const enabled = params["enabled"];
22253
+ if (typeof enabled !== "boolean") {
22254
+ throw RequestError.invalidParams(
22255
+ void 0,
22256
+ "Invalid or missing Session Workflow setting"
22257
+ );
22258
+ }
22259
+ if (this.sessionWorkflowEnabledOverride === enabled) {
22260
+ return { enabled, sessionsUpdated: 0 };
22261
+ }
22262
+ const sessionsUpdated = this.applySessionWorkflowOverrideToLiveSessions(enabled);
22263
+ return { enabled, sessionsUpdated };
22264
+ }
21214
22265
  case SERVE_CONTROL_EXT_METHODS.sessionLanguage: {
21215
22266
  const sessionId = params["sessionId"];
21216
22267
  const language = params["language"];
@@ -21316,6 +22367,51 @@ var QwenAgent = class {
21316
22367
  }
21317
22368
  return { language: resolvedLanguage, outputLanguage, refreshed };
21318
22369
  }
22370
+ case SERVE_CONTROL_EXT_METHODS.userLanguage: {
22371
+ const language = params["language"];
22372
+ const syncOutputLanguage = params["syncOutputLanguage"] === true;
22373
+ const allowedLanguages = [
22374
+ ...SUPPORTED_LANGUAGES.map((l) => l.code),
22375
+ "auto"
22376
+ ];
22377
+ if (typeof language !== "string" || !allowedLanguages.includes(language)) {
22378
+ throw RequestError.invalidParams(
22379
+ void 0,
22380
+ `Invalid language; must be one of: ${allowedLanguages.join(", ")}`
22381
+ );
22382
+ }
22383
+ try {
22384
+ await setLanguageAsync(language);
22385
+ } catch (err) {
22386
+ debugLogger9.warn("setLanguageAsync failed:", err);
22387
+ throw new RequestError(
22388
+ -32603,
22389
+ `Failed to switch UI language: ${err instanceof Error ? err.message : String(err)}`
22390
+ );
22391
+ }
22392
+ const resolvedLanguage = getCurrentLanguage();
22393
+ this.settings.reloadScopeFromDisk("User" /* User */);
22394
+ let sessions = 0;
22395
+ let failed = 0;
22396
+ if (syncOutputLanguage) {
22397
+ const allSessions = [...this.sessions.values()];
22398
+ const results = await Promise.allSettled(
22399
+ allSessions.map(async (s) => {
22400
+ const cfg = s.getConfig();
22401
+ await cfg.refreshHierarchicalMemory();
22402
+ await cfg.getLlmClient()?.refreshSystemInstruction();
22403
+ })
22404
+ );
22405
+ sessions = results.length;
22406
+ failed = results.filter((r) => r.status === "rejected").length;
22407
+ if (failed > 0) {
22408
+ debugLogger9.warn(
22409
+ `User language refresh failed for ${failed}/${results.length} session(s)`
22410
+ );
22411
+ }
22412
+ }
22413
+ return { language: resolvedLanguage, sessions, failed };
22414
+ }
21319
22415
  case SERVE_CONTROL_EXT_METHODS.sessionRecap: {
21320
22416
  const sessionId = params["sessionId"];
21321
22417
  if (typeof sessionId !== "string" || sessionId.length === 0) {
@@ -21566,10 +22662,10 @@ ${outputText}
21566
22662
  );
21567
22663
  }
21568
22664
  const taskKind = params["taskKind"];
21569
- if (taskKind !== "agent" && taskKind !== "shell" && taskKind !== "monitor") {
22665
+ if (taskKind !== "agent" && taskKind !== "shell" && taskKind !== "monitor" && taskKind !== "workflow") {
21570
22666
  throw RequestError.invalidParams(
21571
22667
  void 0,
21572
- 'taskKind must be "agent", "shell", or "monitor"'
22668
+ 'taskKind must be "agent", "shell", "monitor", or "workflow"'
21573
22669
  );
21574
22670
  }
21575
22671
  debugLogger9.info(
@@ -21627,12 +22723,169 @@ ${outputText}
21627
22723
  );
21628
22724
  return { cancelled: true, status: task.status };
21629
22725
  }
22726
+ case "workflow": {
22727
+ if (!this.canUseWorkflowControls(config)) {
22728
+ return { cancelled: false, reason: "disabled" };
22729
+ }
22730
+ const registry = config.getWorkflowRunRegistry();
22731
+ const task = registry.get(taskId);
22732
+ if ((!task || isTerminalWorkflowStatus(task.status)) && registry.isStarting?.(taskId)) {
22733
+ registry.cancelStarting(taskId);
22734
+ debugLogger9.info(
22735
+ `sessionTaskCancel completed sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} status=starting`
22736
+ );
22737
+ return { cancelled: true, status: "cancelled" };
22738
+ }
22739
+ if (!task || task.status !== "running" && task.status !== "pausing" && task.status !== "paused") {
22740
+ const reason = task ? "not_running" : "not_found";
22741
+ debugLogger9.info(
22742
+ `sessionTaskCancel skipped sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} reason=${reason} status=${task?.status ?? "missing"}`
22743
+ );
22744
+ return { cancelled: false, reason, status: task?.status };
22745
+ }
22746
+ const handle = registry.getHandle(taskId);
22747
+ registry.cancel(taskId, Date.now());
22748
+ if (handle) await handle.completion;
22749
+ debugLogger9.info(
22750
+ `sessionTaskCancel completed sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} status=${task.status}`
22751
+ );
22752
+ return { cancelled: true, status: task.status };
22753
+ }
21630
22754
  default: {
21631
22755
  const exhaustive = taskKind;
21632
22756
  throw new Error(`Unhandled task kind: ${exhaustive}`);
21633
22757
  }
21634
22758
  }
21635
22759
  }
22760
+ case SERVE_CONTROL_EXT_METHODS.sessionWorkflowTaskAction: {
22761
+ const sessionId = params["sessionId"];
22762
+ if (typeof sessionId !== "string" || sessionId.length === 0) {
22763
+ throw RequestError.invalidParams(
22764
+ void 0,
22765
+ "Invalid or missing sessionId"
22766
+ );
22767
+ }
22768
+ const taskId = params["taskId"];
22769
+ if (typeof taskId !== "string" || taskId.length === 0) {
22770
+ throw RequestError.invalidParams(
22771
+ void 0,
22772
+ "Invalid or missing taskId"
22773
+ );
22774
+ }
22775
+ const action = params["action"];
22776
+ if (action !== "pause" && action !== "resume" && action !== "retry" && action !== "rerun" && action !== "delete-history" && action !== "run-saved") {
22777
+ throw RequestError.invalidParams(
22778
+ void 0,
22779
+ 'action must be "pause", "resume", "retry", "rerun", "delete-history", or "run-saved"'
22780
+ );
22781
+ }
22782
+ const session = this.sessionOrThrow(sessionId);
22783
+ const config = session.getConfig();
22784
+ if (!this.canUseWorkflowControls(config)) {
22785
+ return { changed: false };
22786
+ }
22787
+ const mutationClaim = action === "run-saved" ? getWorkflowTaskMutationKey(config, taskId, "saved") : getWorkflowTaskMutationKey(config, taskId);
22788
+ if (action === "delete-history") {
22789
+ const attempt = await tryWithWorkflowTaskMutation(
22790
+ mutationClaim,
22791
+ async () => {
22792
+ const changed2 = await session.deleteWorkflowHistory(taskId);
22793
+ if (changed2) {
22794
+ for (const [siblingId, sibling] of this.sessions) {
22795
+ if (siblingId === sessionId) continue;
22796
+ sibling.getConfig().getWorkflowRunRegistry().removeTerminal(taskId);
22797
+ sibling.noteExternalWorkflowDeletion(taskId);
22798
+ }
22799
+ }
22800
+ return { changed: changed2 };
22801
+ }
22802
+ );
22803
+ if (!attempt.acquired) {
22804
+ return { changed: false };
22805
+ }
22806
+ return attempt.value;
22807
+ }
22808
+ const registry = config.getWorkflowRunRegistry();
22809
+ if (action === "run-saved") {
22810
+ const attempt = await tryWithWorkflowTaskMutation(
22811
+ mutationClaim,
22812
+ async () => {
22813
+ const savedWorkflow = (await listSavedWorkflows(config)).find(
22814
+ (entry) => entry.name === taskId
22815
+ );
22816
+ if (!savedWorkflow) return { changed: false };
22817
+ const workflowTool = config.getToolRegistry().getTool(ToolNames.WORKFLOW);
22818
+ if (!isSessionOwnedWorkflowTool(workflowTool)) {
22819
+ throw RequestError.invalidParams(
22820
+ void 0,
22821
+ "The workflow tool is unavailable; cannot run this saved workflow."
22822
+ );
22823
+ }
22824
+ const result = await workflowTool.buildSessionOwnedBackground({
22825
+ scriptPath: savedWorkflow.scriptPath
22826
+ }).execute(new AbortController().signal);
22827
+ const startedTask = result.workflowRunId ? registry.get(result.workflowRunId) : void 0;
22828
+ return startedTask ? {
22829
+ changed: true,
22830
+ status: startedTask.status,
22831
+ taskId: startedTask.runId
22832
+ } : { changed: false };
22833
+ }
22834
+ );
22835
+ if (!attempt.acquired) {
22836
+ return { changed: false };
22837
+ }
22838
+ return attempt.value;
22839
+ }
22840
+ const task = registry.get(taskId);
22841
+ if (!task) return { changed: false };
22842
+ if (action === "retry" || action === "rerun") {
22843
+ const liveElsewhere = action === "retry" && (registry.isStarting?.(taskId) === true || this.isWorkflowRunLiveOutsideSession(sessionId, taskId));
22844
+ const canStart = action === "retry" ? task.status === "failed" && !registry.getHandle(taskId) && !liveElsewhere : task.status === "completed" || task.status === "failed" || task.status === "cancelled";
22845
+ if (!canStart || !task.script) {
22846
+ return { changed: false, status: task.status };
22847
+ }
22848
+ const attempt = await tryWithWorkflowTaskMutation(
22849
+ mutationClaim,
22850
+ async () => {
22851
+ const workflowTool = config.getToolRegistry().getTool(ToolNames.WORKFLOW);
22852
+ if (!isSessionOwnedWorkflowTool(workflowTool)) {
22853
+ throw RequestError.invalidParams(
22854
+ void 0,
22855
+ `The workflow tool is unavailable; cannot ${action} this run.`
22856
+ );
22857
+ }
22858
+ const startParams = {
22859
+ script: task.script,
22860
+ args: task.args,
22861
+ ...action === "retry" ? { resumeFromRunId: task.runId } : {}
22862
+ };
22863
+ const result = await workflowTool.buildSessionOwnedBackground(startParams).execute(new AbortController().signal);
22864
+ if (action === "rerun") {
22865
+ const rerunTask = result.workflowRunId ? registry.get(result.workflowRunId) : void 0;
22866
+ if (rerunTask) {
22867
+ registry.setLineage(rerunTask.runId, task.runId, "rerun");
22868
+ }
22869
+ return rerunTask ? {
22870
+ changed: true,
22871
+ status: rerunTask.status,
22872
+ taskId: rerunTask.runId
22873
+ } : { changed: false, status: task.status };
22874
+ }
22875
+ return result.workflowRunId ? {
22876
+ changed: true,
22877
+ status: registry.get(result.workflowRunId)?.status
22878
+ } : { changed: false, status: task.status };
22879
+ }
22880
+ );
22881
+ if (!attempt.acquired) {
22882
+ return { changed: false, status: task.status };
22883
+ }
22884
+ return attempt.value;
22885
+ }
22886
+ const changed = action === "pause" ? registry.pause(taskId) : registry.resume(taskId);
22887
+ return { changed, status: task.status };
22888
+ }
21636
22889
  case SERVE_CONTROL_EXT_METHODS.sessionGoalClear: {
21637
22890
  const sessionId = params["sessionId"];
21638
22891
  if (typeof sessionId !== "string" || sessionId.length === 0) {
@@ -21902,6 +23155,14 @@ ${outputText}
21902
23155
  case SERVE_CONTROL_EXT_METHODS.workspaceExtensionsRefresh: {
21903
23156
  const sessionId = params["sessionId"];
21904
23157
  const rawRefreshBootstrap = params["refreshBootstrap"];
23158
+ const rawSkillsOnly = params["skillsOnly"];
23159
+ if (rawSkillsOnly !== void 0 && typeof rawSkillsOnly !== "boolean") {
23160
+ throw RequestError.invalidParams(
23161
+ void 0,
23162
+ "skillsOnly must be a boolean"
23163
+ );
23164
+ }
23165
+ const skillsOnly = rawSkillsOnly === true;
21905
23166
  if (rawRefreshBootstrap !== void 0 && typeof rawRefreshBootstrap !== "boolean") {
21906
23167
  throw RequestError.invalidParams(
21907
23168
  void 0,
@@ -21919,16 +23180,25 @@ ${outputText}
21919
23180
  errors.push(error);
21920
23181
  }
21921
23182
  }, "runRefresh");
23183
+ if (skillsOnly) {
23184
+ await runRefresh(async () => session.reloadSkillSettings());
23185
+ }
21922
23186
  await runRefresh(async () => await extensionManager.refreshCache());
21923
- await runRefresh(async () => await extensionManager.refreshTools());
23187
+ if (skillsOnly) {
23188
+ await runRefresh(
23189
+ async () => await config.getSkillManager()?.refreshCache({ throwOnError: true })
23190
+ );
23191
+ } else {
23192
+ await runRefresh(async () => await extensionManager.refreshTools());
23193
+ }
21924
23194
  const bootstrapConfig = this.config;
21925
23195
  if (rawRefreshBootstrap !== false && bootstrapConfig !== config) {
21926
23196
  await runRefresh(
21927
- async () => await this.refreshBootstrapExtensionStatus()
23197
+ async () => await this.refreshBootstrapExtensionStatus(skillsOnly)
21928
23198
  );
21929
23199
  }
21930
23200
  const discoveryConfig = this.workspaceMcpDiscoveryConfig;
21931
- if (discoveryConfig && discoveryConfig !== config) {
23201
+ if (!skillsOnly && discoveryConfig && discoveryConfig !== config) {
21932
23202
  const discoveryExtensionManager = discoveryConfig.getExtensionManager();
21933
23203
  await runRefresh(
21934
23204
  async () => await discoveryExtensionManager.refreshCache()
@@ -21941,7 +23211,10 @@ ${outputText}
21941
23211
  async () => await config.getLlmClient()?.refreshSystemInstruction()
21942
23212
  );
21943
23213
  await runRefresh(
21944
- async () => await session.sendAvailableCommandsUpdate()
23214
+ async () => skillsOnly ? await session.refreshSkillsFromSettings({
23215
+ reloadSettings: false,
23216
+ notifyConfigChanged: false
23217
+ }) : await session.sendAvailableCommandsUpdate()
21945
23218
  );
21946
23219
  if (errors.length > 0) {
21947
23220
  const details = errors.map(
@@ -22583,6 +23856,52 @@ ${outputText}
22583
23856
  this.syncLivePermissionManagers(before, after);
22584
23857
  return buildPermissionSettings(settings);
22585
23858
  }
23859
+ case SERVE_CONTROL_EXT_METHODS.workspaceModelProvidersReload: {
23860
+ if (!this.settings.reloadScopesFromDiskAtomically([
23861
+ "User" /* User */,
23862
+ "Workspace" /* Workspace */
23863
+ ])) {
23864
+ debugLogger9.warn("Model-provider settings reload failed");
23865
+ return { configsRefreshed: 0, configsFailed: 1 };
23866
+ }
23867
+ this.modelProviderReloadRevision += 1;
23868
+ const merged = this.settings.merged;
23869
+ reloadEnvironment(merged, cwd);
23870
+ const providerProtocol = merged.providerProtocol ?? {};
23871
+ let configsRefreshed = 0;
23872
+ let configsFailed = 0;
23873
+ const reloadConfig = /* @__PURE__ */ __name((config, id) => {
23874
+ try {
23875
+ config.reloadModelProvidersConfig(
23876
+ merged.modelProviders,
23877
+ providerProtocol
23878
+ );
23879
+ configsRefreshed += 1;
23880
+ } catch {
23881
+ configsFailed += 1;
23882
+ debugLogger9.warn(`Model-provider reload failed for ${id}`);
23883
+ }
23884
+ }, "reloadConfig");
23885
+ reloadConfig(this.config, "bootstrap");
23886
+ for (const config of this.initializingConfigs) {
23887
+ if (config !== this.config) {
23888
+ reloadConfig(config, `initializing:${config.getSessionId()}`);
23889
+ }
23890
+ }
23891
+ for (const [id, session] of this.sessions) {
23892
+ try {
23893
+ session.reloadModelProvidersFromDisk();
23894
+ configsRefreshed += 1;
23895
+ } catch {
23896
+ configsFailed += 1;
23897
+ debugLogger9.warn(`Model-provider reload failed for session ${id}`);
23898
+ }
23899
+ }
23900
+ return {
23901
+ configsRefreshed,
23902
+ configsFailed
23903
+ };
23904
+ }
22586
23905
  case SERVE_CONTROL_EXT_METHODS.workspaceReload: {
22587
23906
  const oldMerged = structuredClone(this.settings.merged);
22588
23907
  this.settings.reloadScopeFromDisk("User" /* User */);
@@ -22591,6 +23910,23 @@ ${outputText}
22591
23910
  const envResult = reloadEnvironment(newMerged, cwd);
22592
23911
  const changed = diffSettingsKeys(oldMerged, newMerged);
22593
23912
  const envChanged = envResult.updatedKeys.length > 0 || envResult.removedKeys.length > 0;
23913
+ const providersChanged = changed.has("modelProviders") || changed.has("providerProtocol");
23914
+ if (providersChanged) {
23915
+ this.modelProviderReloadRevision += 1;
23916
+ }
23917
+ const readSessionWorkflow = /* @__PURE__ */ __name((merged) => merged.experimental?.sessionWorkflow === true, "readSessionWorkflow");
23918
+ const reloadedSessionWorkflow = readSessionWorkflow(newMerged);
23919
+ this.applySessionWorkflowOverrideToLiveSessions(
23920
+ reloadedSessionWorkflow
23921
+ );
23922
+ const reloadedApprovalMode = foldReloadApprovalMode(
23923
+ newMerged.tools?.approvalMode
23924
+ );
23925
+ if (reloadedApprovalMode === void 0) {
23926
+ debugLogger9.warn(
23927
+ "reload: tools.approvalMode holds a value boot would reject; live sessions keep their current modes until the file is corrected"
23928
+ );
23929
+ }
22594
23930
  const sessions = [...this.sessions.entries()];
22595
23931
  const refreshed = [];
22596
23932
  const skipped = [];
@@ -22602,7 +23938,6 @@ ${outputText}
22602
23938
  }
22603
23939
  const config = session.getConfig();
22604
23940
  const authType = config.getAuthType();
22605
- const providersChanged = changed.has("modelProviders") || changed.has("providerProtocol");
22606
23941
  if (providersChanged) {
22607
23942
  try {
22608
23943
  config.reloadModelProvidersConfig(
@@ -22619,6 +23954,7 @@ ${outputText}
22619
23954
  if (changed.has("model") && newModelName && newModelName !== config.getModel() && authType) {
22620
23955
  try {
22621
23956
  await config.switchModel(authType, newModelName);
23957
+ session.reloadReasoningSelection();
22622
23958
  } catch (err) {
22623
23959
  debugLogger9.warn(
22624
23960
  `reload: switchModel failed for session ${id}: ${err}`
@@ -22626,31 +23962,65 @@ ${outputText}
22626
23962
  }
22627
23963
  } else if ((providersChanged || envChanged) && authType) {
22628
23964
  try {
22629
- await config.refreshAuth(authType);
23965
+ await this.refreshAuthWithPersistedReasoning(
23966
+ config,
23967
+ this.settings,
23968
+ authType,
23969
+ void 0,
23970
+ session.getSessionReasoningSelection()
23971
+ );
23972
+ session.reloadReasoningSelection();
22630
23973
  } catch (err) {
22631
23974
  debugLogger9.warn(
22632
23975
  `reload: refreshAuth failed for session ${id}: ${err}`
22633
23976
  );
22634
23977
  }
23978
+ } else if (changed.has("model")) {
23979
+ session.reloadReasoningSelection();
22635
23980
  }
22636
23981
  if (changed.has("tools")) {
22637
23982
  const disabled = normalizeDisabledToolList(
22638
23983
  newMerged.tools?.disabled
22639
23984
  );
22640
23985
  config.setDisabledTools(new Set(disabled));
22641
- const newMode = newMerged.tools?.approvalMode;
22642
- if (newMode && APPROVAL_MODES.includes(newMode) && newMode !== config.getApprovalMode()) {
23986
+ }
23987
+ const workflowsWereEnabled = config.isWorkflowsEnabled();
23988
+ config.setWorkflowsEnabled(
23989
+ newMerged.tools?.workflowsEnabled === true
23990
+ );
23991
+ if (config.isWorkflowsEnabled() !== workflowsWereEnabled) {
23992
+ try {
23993
+ await session.sendAvailableCommandsUpdate();
23994
+ } catch (err) {
23995
+ debugLogger9.warn(
23996
+ `reload: sendAvailableCommandsUpdate failed for session ${id}: ${err}`
23997
+ );
23998
+ }
23999
+ }
24000
+ const reloadedSessionMode = isRestrictedApprovalModeConfig(config) ? "default" /* DEFAULT */ : reloadedApprovalMode;
24001
+ const previousMode = config.getApprovalMode();
24002
+ const convergedMode = this.sessionApprovalModeConverged.get(id);
24003
+ if (reloadedSessionMode !== void 0 && reloadedSessionMode !== convergedMode) {
24004
+ if (reloadedSessionMode !== previousMode) {
22643
24005
  try {
22644
- config.setApprovalMode(newMode);
22645
- if (newMode === "plan") {
24006
+ config.setApprovalMode(reloadedSessionMode);
24007
+ if (reloadedSessionMode === "plan") {
22646
24008
  session.clearActiveTodoPlanRevision();
22647
24009
  session.clearTodoStopGuardTrust();
24010
+ } else if (previousMode === "plan") {
24011
+ session.clearActiveTodoPlanRevision();
22648
24012
  }
24013
+ this.sessionApprovalModeConverged.set(
24014
+ id,
24015
+ reloadedSessionMode
24016
+ );
22649
24017
  } catch (err) {
22650
24018
  debugLogger9.warn(
22651
24019
  `reload: setApprovalMode failed for session ${id}: ${err}`
22652
24020
  );
22653
24021
  }
24022
+ } else {
24023
+ this.sessionApprovalModeConverged.set(id, reloadedSessionMode);
22654
24024
  }
22655
24025
  }
22656
24026
  try {
@@ -22861,25 +24231,34 @@ ${outputText}
22861
24231
  }
22862
24232
  }
22863
24233
  async newSessionConfig(cwd, mcpServers, settings, sessionSource, sessionId, resume, initializeOptions = {}, chatRecording, restoreOptions) {
24234
+ const preserveIdlessSession = sessionId === void 0 && chatRecording === false;
24235
+ const inheritedSessionId = preserveIdlessSession ? sessionIdContext.getStore() : void 0;
24236
+ const sessionIdGenerated = sessionId === void 0 && !preserveIdlessSession;
24237
+ const effectiveSessionId = sessionId ?? (sessionIdGenerated ? randomUUID2() : void 0);
24238
+ const debugSessionId = effectiveSessionId ?? inheritedSessionId ?? "transcript-replay";
22864
24239
  try {
22865
24240
  this.assertManagedSessionAdmission();
22866
- return await this.runWithPinnedRuntimeBaseDir(settings, cwd, async () => {
22867
- await this.retryPendingConfigCleanup(
22868
- Storage.getRuntimeBaseDir(),
22869
- sessionId
22870
- );
22871
- return this.newSessionConfigInRuntimeContext(
22872
- cwd,
22873
- mcpServers,
22874
- settings,
22875
- sessionSource,
22876
- sessionId,
22877
- resume,
22878
- initializeOptions,
22879
- chatRecording,
22880
- restoreOptions
22881
- );
22882
- });
24241
+ return await sessionIdContext.run(
24242
+ debugSessionId,
24243
+ () => this.runWithPinnedRuntimeBaseDir(settings, cwd, async () => {
24244
+ await this.retryPendingConfigCleanup(
24245
+ Storage.getRuntimeBaseDir(),
24246
+ effectiveSessionId
24247
+ );
24248
+ return this.newSessionConfigInRuntimeContext(
24249
+ cwd,
24250
+ mcpServers,
24251
+ settings,
24252
+ sessionSource,
24253
+ effectiveSessionId,
24254
+ resume,
24255
+ initializeOptions,
24256
+ chatRecording,
24257
+ restoreOptions,
24258
+ sessionIdGenerated
24259
+ );
24260
+ })
24261
+ );
22883
24262
  } catch (error) {
22884
24263
  if (error instanceof SessionIdConflictError) {
22885
24264
  throw new RequestError(ACP_ERROR_CODES.INVALID_PARAMS, error.message, {
@@ -22896,7 +24275,7 @@ ${outputText}
22896
24275
  throw sessionId && restoreOptions ? mapSessionRestoreRequestError(error, sessionId) : error;
22897
24276
  }
22898
24277
  }
22899
- async newSessionConfigInRuntimeContext(cwd, mcpServers, settings, sessionSource, sessionId, resume, initializeOptions = {}, chatRecording, restoreOptions) {
24278
+ async newSessionConfigInRuntimeContext(cwd, mcpServers, settings, sessionSource, sessionId, resume, initializeOptions = {}, chatRecording, restoreOptions, sessionIdGenerated) {
22900
24279
  const provisionalWorkspace = isReservedStandaloneSessionSourceType(
22901
24280
  sessionSource?.sourceType
22902
24281
  );
@@ -22958,7 +24337,11 @@ ${outputText}
22958
24337
  ...sessionSource?.sourceType === "channel" ? { cron: false } : {}
22959
24338
  }
22960
24339
  };
22961
- const sessionArg = resume === true ? { resume: sessionId, sessionId: void 0 } : { sessionId, resume: void 0 };
24340
+ const sessionArg = resume === true ? { resume: sessionId, sessionId: void 0 } : {
24341
+ sessionId,
24342
+ sessionIdGenerated: sessionIdGenerated === true || void 0,
24343
+ resume: void 0
24344
+ };
22962
24345
  const argvForSession = {
22963
24346
  ...this.argv,
22964
24347
  ...provisionalWorkspace ? { experimentalLsp: false } : {},
@@ -23011,7 +24394,8 @@ ${outputText}
23011
24394
  ), "projectionSource")
23012
24395
  }
23013
24396
  } : {}
23014
- } : void 0
24397
+ } : void 0,
24398
+ buildEnabledSkillNamesProvider(settings)
23015
24399
  );
23016
24400
  if (sessionSource) {
23017
24401
  config.setSessionSource(sessionSource.sourceType, sessionSource.sourceId);
@@ -23048,16 +24432,18 @@ ${outputText}
23048
24432
  const wiredSessionId = typeof config.getSessionId === "function" ? config.getSessionId() : void 0;
23049
24433
  const skipPerSessionBudgetCallback = this.workspaceMcpBudget !== void 0;
23050
24434
  if (!skipPerSessionBudgetCallback && typeof config.setMcpBudgetEventCallback === "function" && wiredSessionId !== void 0) {
23051
- const sid = wiredSessionId;
24435
+ const acpSessionId = wiredSessionId;
23052
24436
  config.setMcpBudgetEventCallback((event) => {
23053
- void this.connection.extNotification("qwen/notify/session/mcp-budget-event", {
23054
- v: 1,
23055
- sessionId: sid,
23056
- ...event
23057
- }).catch((err) => {
23058
- debugLogger9.debug(
23059
- `MCP budget extNotification dropped (session=${sid}, kind=${event.kind}): ${err instanceof Error ? err.message : String(err)}`
23060
- );
24437
+ sessionIdContext.run(config.getSessionId(), () => {
24438
+ void this.connection.extNotification("qwen/notify/session/mcp-budget-event", {
24439
+ v: 1,
24440
+ sessionId: acpSessionId,
24441
+ ...event
24442
+ }).catch((err) => {
24443
+ debugLogger9.debug(
24444
+ `MCP budget extNotification dropped (session=${acpSessionId}, kind=${event.kind}): ${err instanceof Error ? err.message : String(err)}`
24445
+ );
24446
+ });
23061
24447
  });
23062
24448
  });
23063
24449
  }
@@ -23103,7 +24489,30 @@ ${outputText}
23103
24489
  );
23104
24490
  }
23105
24491
  }
23106
- async ensureAuthenticated(config) {
24492
+ async refreshAuthWithPersistedReasoning(config, settings, authType, isInitialAuth, sessionSelection) {
24493
+ await config.refreshAuth(authType, isInitialAuth);
24494
+ const selection = sessionSelection ?? parseReasoningSelection(settings.merged.model?.reasoningEffort);
24495
+ if (!selection || selection === REASONING_EFFORT_DEFAULT) {
24496
+ return;
24497
+ }
24498
+ const generation = config.getContentGeneratorConfig?.();
24499
+ const modelId = generation?.model ?? config.getModel();
24500
+ if (!isReasoningSelectionSupported(
24501
+ modelId,
24502
+ selection,
24503
+ generation?.thinkingMandatory === true
24504
+ )) {
24505
+ return;
24506
+ }
24507
+ const modelReasoning = this.getModelReasoningConfiguration(config);
24508
+ if (generation && modelReasoning && !modelReasoning.toggleOnly) {
24509
+ clearReasoningRequestOverrides(generation);
24510
+ }
24511
+ if (selection === REASONING_EFFORT_NONE) {
24512
+ applyReasoningSelection(config, REASONING_EFFORT_NONE);
24513
+ }
24514
+ }
24515
+ async ensureAuthenticated(config, settings) {
23107
24516
  const selectedType = config.getModelsConfig().getCurrentAuthType();
23108
24517
  if (!selectedType) {
23109
24518
  throw RequestError.authRequired(
@@ -23112,7 +24521,12 @@ ${outputText}
23112
24521
  );
23113
24522
  }
23114
24523
  try {
23115
- await config.refreshAuth(selectedType, true);
24524
+ await this.refreshAuthWithPersistedReasoning(
24525
+ config,
24526
+ settings,
24527
+ selectedType,
24528
+ true
24529
+ );
23116
24530
  } catch (e) {
23117
24531
  debugLogger9.error(`Authentication failed: ${e}`);
23118
24532
  throw RequestError.authRequired(
@@ -23123,6 +24537,37 @@ ${outputText}
23123
24537
  );
23124
24538
  }
23125
24539
  }
24540
+ /**
24541
+ * Pins the workflow gate of every live Session whose effective gate
24542
+ * actually changes to `enabled`, dropping the bound plan revision on those
24543
+ * sessions, then records `enabled` as the daemon-held override. The no-op
24544
+ * decision is per-session because neither caller's own state can answer it:
24545
+ * on a first UI write the override is still `undefined` although sessions
24546
+ * already derive the pushed value from settings (a shadowed workspace
24547
+ * write), and a reload diff can fire against a stale settings view that the
24548
+ * UI write path never updated. Each session's live value is read BEFORE the
24549
+ * field reassignment below so a pinned provider cannot report the new value
24550
+ * as its "before" state. The provider reads the field rather than capturing
24551
+ * a value so a later re-derivation (a settings-file reload) reaches
24552
+ * sessions that were pinned earlier. Returns the number of sessions whose
24553
+ * gate changed.
24554
+ */
24555
+ applySessionWorkflowOverrideToLiveSessions(enabled) {
24556
+ let sessionsUpdated = 0;
24557
+ for (const session of this.sessions.values()) {
24558
+ const config = session.getConfig();
24559
+ if (config.isSessionWorkflowEnabled?.() === enabled) {
24560
+ continue;
24561
+ }
24562
+ config.setSessionWorkflowEnabledProvider?.(
24563
+ () => this.sessionWorkflowEnabledOverride === true
24564
+ );
24565
+ session.clearActiveTodoPlanRevision();
24566
+ sessionsUpdated++;
24567
+ }
24568
+ this.sessionWorkflowEnabledOverride = enabled;
24569
+ return sessionsUpdated;
24570
+ }
23126
24571
  setupFileSystem(config) {
23127
24572
  if (!this.clientCapabilities?.fs) return;
23128
24573
  const acpFileSystemService = new AcpFileSystemService(
@@ -23136,14 +24581,82 @@ ${outputText}
23136
24581
  );
23137
24582
  config.setFileSystemService(acpFileSystemService);
23138
24583
  }
24584
+ /**
24585
+ * All sessions in this child share one workflow snapshot store but each
24586
+ * keeps a private run registry, so one session's history deletion must
24587
+ * see every sibling registry — or it can delete a run another session
24588
+ * is still executing or settling. A handle outlives the terminal
24589
+ * transition until the snapshot write lands, so it blocks too.
24590
+ *
24591
+ * R7-10: iterating `this.sessions` alone left a blind spot the width of
24592
+ * a whole run. A workflow can outlive its owning session's removal —
24593
+ * explicit close/kill/shutdown use force semantics, and a background
24594
+ * run owns a detached controller — so once `removeStoredSessionEntry`
24595
+ * deleted the session, a still-settling run became invisible here and
24596
+ * unreachable by the delete handler's sibling `removeTerminal` loop. A
24597
+ * sibling `delete-history` then passed every check, removed the LIVE
24598
+ * run's journal directory and snapshot, and answered `{changed: true}`;
24599
+ * the orphan kept going and its settlement `writeWorkflowSnapshot`
24600
+ * recreated the file — resurrection, plus a run whose journal was rm'd
24601
+ * under it.
24602
+ *
24603
+ * The repair has two halves. `Session.dispose()` now aborts its
24604
+ * workflow registry the way it already aborts the agent registry, so an
24605
+ * orphan settles instead of running on; and the registry of a removed
24606
+ * session stays reachable here until its runs drain, so the gate keeps
24607
+ * answering for the settlement window that abort cannot compress to
24608
+ * zero (the handle is released only after the snapshot write lands).
24609
+ */
24610
+ isWorkflowRunLiveOutsideSession(excludeSessionId, runId) {
24611
+ for (const [sessionId, session] of this.sessions) {
24612
+ if (sessionId === excludeSessionId) continue;
24613
+ if (_QwenAgent.isWorkflowRunLiveInRegistry(
24614
+ session.getConfig().getWorkflowRunRegistry(),
24615
+ runId
24616
+ )) {
24617
+ return true;
24618
+ }
24619
+ }
24620
+ this.pruneDrainedWorkflowRegistries();
24621
+ for (const registry of this.detachedWorkflowRegistries) {
24622
+ if (_QwenAgent.isWorkflowRunLiveInRegistry(registry, runId)) return true;
24623
+ }
24624
+ return false;
24625
+ }
24626
+ static isWorkflowRunLiveInRegistry(registry, runId) {
24627
+ if (registry.isStarting?.(runId)) return true;
24628
+ const entry = registry.get(runId);
24629
+ if (entry && !isTerminalWorkflowStatus(entry.status)) return true;
24630
+ return registry.getHandle(runId) !== void 0;
24631
+ }
24632
+ /**
24633
+ * Registries of removed sessions are retained only while they still
24634
+ * hold work — an aborted run keeps its handle until settlement releases
24635
+ * it. Dropping drained ones keeps this from becoming a leak that grows
24636
+ * with every closed session.
24637
+ */
24638
+ pruneDrainedWorkflowRegistries() {
24639
+ for (const registry of this.detachedWorkflowRegistries) {
24640
+ if (!_QwenAgent.isWorkflowRegistryDraining(registry)) {
24641
+ this.detachedWorkflowRegistries.delete(registry);
24642
+ }
24643
+ }
24644
+ }
24645
+ /** Still holding work: an active entry, or a handle awaiting settlement. */
24646
+ static isWorkflowRegistryDraining(registry) {
24647
+ if (registry.hasRunningEntries?.()) return true;
24648
+ return registry.list?.().some((entry) => registry.getHandle(entry.runId)) ?? false;
24649
+ }
23139
24650
  async createAndStoreSession(config, settings, sessionData, options = {}) {
24651
+ options.signal?.throwIfAborted();
23140
24652
  this.assertManagedSessionAdmission();
23141
24653
  const sessionId = normalizeSessionIdForLookup(config.getSessionId());
23142
24654
  const llmClient = config.getLlmClient();
23143
24655
  const needsInitialize = !llmClient.isInitialized();
23144
24656
  if (needsInitialize && options.deferWorkspaceActivation !== true) {
23145
- await llmClient.initialize();
24657
+ await llmClient.initialize(void 0, options.signal);
23146
24658
  }
24659
+ options.signal?.throwIfAborted();
23147
24660
  this.assertManagedSessionAdmission();
23148
24661
  if (this.sessions.has(sessionId)) {
23149
24662
  throw new RequestError(
@@ -23153,6 +24666,7 @@ ${outputText}
23153
24666
  );
23154
24667
  }
23155
24668
  await options.prepareBeforeSessionCreate?.();
24669
+ options.signal?.throwIfAborted();
23156
24670
  this.assertManagedSessionAdmission();
23157
24671
  if (this.sessions.has(sessionId)) {
23158
24672
  throw new RequestError(
@@ -23161,14 +24675,16 @@ ${outputText}
23161
24675
  { errorKind: "session_id_conflict", sessionId }
23162
24676
  );
23163
24677
  }
23164
- options.beforeSessionCreate?.();
24678
+ const workflowHistory = await listWorkflowSnapshots(config);
23165
24679
  const session = new Session(
23166
24680
  sessionId,
23167
24681
  config,
23168
24682
  this.connection,
23169
24683
  settings,
23170
24684
  (operation) => this.runExclusiveHistoryMutation(sessionId, operation),
23171
- () => this.activeWorkReporter?.notifyChanged()
24685
+ () => this.activeWorkReporter?.notifyChanged(),
24686
+ workflowHistory,
24687
+ (runId) => this.isWorkflowRunLiveOutsideSession(sessionId, runId)
23172
24688
  );
23173
24689
  const replaySessionHistory = /* @__PURE__ */ __name(async () => {
23174
24690
  if (options.replayHistory === false || !sessionData?.conversation.messages) {
@@ -23192,10 +24708,21 @@ ${outputText}
23192
24708
  session.installManagedConversationActivation(
23193
24709
  async () => {
23194
24710
  this.assertManagedSessionAdmission();
24711
+ const settingsReloaded = settings.reloadScopesFromDiskAtomically?.([
24712
+ "User" /* User */,
24713
+ "Workspace" /* Workspace */
24714
+ ]) !== false;
24715
+ if (settingsReloaded) {
24716
+ reloadEnvironment(settings.merged, config.getTargetDir());
24717
+ } else {
24718
+ debugLogger9.warn(
24719
+ "Deferred session settings reload failed; keeping current environment"
24720
+ );
24721
+ }
23195
24722
  if (options.beforeDeferredWorkspaceActivation) {
23196
24723
  await options.beforeDeferredWorkspaceActivation();
23197
24724
  } else {
23198
- await this.ensureAuthenticated(config);
24725
+ await this.ensureAuthenticated(config, settings);
23199
24726
  }
23200
24727
  this.assertManagedSessionAdmission();
23201
24728
  await config.activateProvisionalWorkspace();
@@ -23219,11 +24746,64 @@ ${outputText}
23219
24746
  let published = false;
23220
24747
  try {
23221
24748
  await registerCreateSubSessionTool(config);
24749
+ options.signal?.throwIfAborted();
24750
+ let forceAuthenticationRefresh = options.deferWorkspaceActivation !== true && options.configProviderRevision !== this.modelProviderReloadRevision;
24751
+ while (true) {
24752
+ const providerReloadRevision = this.modelProviderReloadRevision;
24753
+ const previousModelProviders = settings.merged.modelProviders;
24754
+ const previousProviderProtocol = settings.merged.providerProtocol;
24755
+ const settingsReloaded = settings.reloadScopesFromDiskAtomically?.([
24756
+ "User" /* User */,
24757
+ "Workspace" /* Workspace */
24758
+ ]) !== false;
24759
+ if (!settingsReloaded) {
24760
+ if (providerReloadRevision !== options.configProviderRevision) {
24761
+ throw new Error(
24762
+ "Unable to reload model-provider settings from disk."
24763
+ );
24764
+ }
24765
+ debugLogger9.warn(
24766
+ "Final model-provider settings reload failed; keeping current settings"
24767
+ );
24768
+ }
24769
+ config.reloadModelProvidersConfig?.(
24770
+ settings.merged.modelProviders,
24771
+ settings.merged.providerProtocol ?? {}
24772
+ );
24773
+ if (options.deferWorkspaceActivation !== true) {
24774
+ const envReload = reloadEnvironment(
24775
+ settings.merged,
24776
+ config.getTargetDir()
24777
+ );
24778
+ const providerSettingsChanged = !isDeepStrictEqual(
24779
+ previousModelProviders,
24780
+ settings.merged.modelProviders
24781
+ ) || !isDeepStrictEqual(
24782
+ previousProviderProtocol,
24783
+ settings.merged.providerProtocol
24784
+ );
24785
+ if (forceAuthenticationRefresh || providerSettingsChanged || envReload.updatedKeys.length > 0 || envReload.removedKeys.length > 0) {
24786
+ await this.ensureAuthenticated(config, settings);
24787
+ }
24788
+ }
24789
+ if (providerReloadRevision === this.modelProviderReloadRevision) break;
24790
+ forceAuthenticationRefresh = true;
24791
+ }
24792
+ options.beforeSessionPublish?.();
23222
24793
  options.primeSession?.(session);
23223
24794
  if (options.deferWorkspaceActivation !== true) {
23224
24795
  config.hydrateSessionRestoreFileHistory?.();
23225
24796
  }
24797
+ if (this.sessionWorkflowEnabledOverride !== void 0) {
24798
+ config.setSessionWorkflowEnabledProvider?.(
24799
+ () => this.sessionWorkflowEnabledOverride === true
24800
+ );
24801
+ }
23226
24802
  this.sessions.set(sessionId, session);
24803
+ this.sessionApprovalModeConverged.set(
24804
+ sessionId,
24805
+ config.getApprovalMode()
24806
+ );
23227
24807
  published = true;
23228
24808
  this.activeWorkReporter?.notifyChanged();
23229
24809
  this.initializingConfigs.delete(config);
@@ -23355,7 +24935,16 @@ ${outputText}
23355
24935
  currentValue: currentModelId,
23356
24936
  options: configModelOptions
23357
24937
  };
23358
- const generation = config.getContentGeneratorConfig();
24938
+ if (activeRuntimeSnapshot || currentModelId.startsWith(ACP_ROUTE_ID_PREFIX) || !isReasoningSelectionSupported(
24939
+ rawCurrentModelId,
24940
+ REASONING_EFFORT_DEFAULT
24941
+ )) {
24942
+ return [modeConfigOption, modelConfigOption];
24943
+ }
24944
+ const generation = config.getContentGeneratorConfig?.();
24945
+ if (!generation) {
24946
+ return [modeConfigOption, modelConfigOption];
24947
+ }
23359
24948
  const modelReasoning = this.getModelReasoningConfiguration(
23360
24949
  config,
23361
24950
  currentModelId
@@ -23374,6 +24963,7 @@ ${outputText}
23374
24963
  (effort) => effort === normalizedOverrideEffort
23375
24964
  ) ?? modelReasoning.defaultEffort : currentModelEffort : currentModelEffort;
23376
24965
  const reasoningEnabled = generation.reasoning !== false && (!reasoningOverride || !overrideDisablesReasoning);
24966
+ const canDisableReasoning = generation.thinkingMandatory !== true;
23377
24967
  const reasoningEffortConfigOption = (modelReasoning ? buildModelReasoningConfigOption(rawCurrentModelId, {
23378
24968
  enabled: reasoningEnabled,
23379
24969
  effort: effectiveModelEffort,
@@ -23384,8 +24974,15 @@ ${outputText}
23384
24974
  description: "How hard reasoning-capable models should think",
23385
24975
  category: "thought_level",
23386
24976
  type: "select",
23387
- currentValue: currentModelEffort ?? REASONING_EFFORT_DEFAULT,
24977
+ currentValue: generation.reasoning === false && canDisableReasoning ? REASONING_EFFORT_NONE : currentModelEffort ?? REASONING_EFFORT_DEFAULT,
23388
24978
  options: [
24979
+ ...canDisableReasoning ? [
24980
+ {
24981
+ value: REASONING_EFFORT_NONE,
24982
+ name: "Thinking off",
24983
+ description: "Disable thinking for this session"
24984
+ }
24985
+ ] : [],
23389
24986
  {
23390
24987
  value: REASONING_EFFORT_DEFAULT,
23391
24988
  name: "Default",