@qwen-code/qwen-code 0.22.2 → 0.22.3-nightly.20260831.3a0c4c6108

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 (480) hide show
  1. package/bundled/computer-use/SKILL.md +3 -3
  2. package/bundled/qc-helper/docs/common-workflow.md +32 -0
  3. package/bundled/qc-helper/docs/configuration/auth.md +6 -6
  4. package/bundled/qc-helper/docs/configuration/model-providers.md +4 -2
  5. package/bundled/qc-helper/docs/configuration/settings.md +47 -44
  6. package/bundled/qc-helper/docs/extension/introduction.md +1 -1
  7. package/bundled/qc-helper/docs/features/approval-mode.md +3 -0
  8. package/bundled/qc-helper/docs/features/auto-mode.md +34 -17
  9. package/bundled/qc-helper/docs/features/channels/dws.md +2 -0
  10. package/bundled/qc-helper/docs/features/channels/overview.md +36 -3
  11. package/bundled/qc-helper/docs/features/code-review.md +5 -5
  12. package/bundled/qc-helper/docs/features/commands.md +41 -0
  13. package/bundled/qc-helper/docs/features/computer-use.md +2 -2
  14. package/bundled/qc-helper/docs/features/hooks.md +6 -2
  15. package/bundled/qc-helper/docs/features/memory.md +1 -0
  16. package/bundled/qc-helper/docs/features/tool-use-summaries.md +1 -1
  17. package/bundled/qc-helper/docs/qwen-serve-deploy-local.md +17 -7
  18. package/bundled/qc-helper/docs/qwen-serve.md +59 -55
  19. package/bundled/review/SKILL.md +90 -31
  20. package/bundled/review/references/persistence.md +7 -3
  21. package/bundled/review/references/posting.md +11 -5
  22. package/chunks/MaxSizedBox-IHRTWGSY.js +115 -0
  23. package/chunks/{StandaloneSessionPicker-AVLI6VJP.js → StandaloneSessionPicker-TLVWVTJ7.js} +88 -85
  24. package/chunks/{acp-startup-profiler-GNYAL6LI.js → acp-startup-profiler-M4X5F3VK.js} +2 -2
  25. package/chunks/{acpAgent-MXEAN54C.js → acpAgent-7I5LLPP3.js} +1563 -407
  26. package/chunks/agent-4Z4NTJXD.js +99 -0
  27. package/chunks/agent-headless-TVUJXQWU.js +89 -0
  28. package/chunks/{anthropicContentGenerator-HGMBACVE.js → anthropicContentGenerator-VSSPG7XV.js} +84 -55
  29. package/chunks/{artifact-tool-5YT4QF7Y.js → artifact-tool-TEYW6I4A.js} +11 -3
  30. package/chunks/{askUserQuestion-4SWJY65V.js → askUserQuestion-PYNBWV63.js} +45 -7
  31. package/chunks/bridge-EVURP4NO.js +122 -0
  32. package/chunks/{ca-7HPYOYSZ.js → ca-BNU7YNDE.js} +3 -0
  33. package/chunks/{channel-management-service-X4AZ6IXX.js → channel-management-service-IDBNYSFW.js} +6 -6
  34. package/chunks/channel-settings-store-MZNXRKVI.js +125 -0
  35. package/chunks/{channel-worker-group-27HMGD5S.js → channel-worker-group-ZLP5SJHT.js} +7 -7
  36. package/chunks/{channel-worker-manager-QEGX646Z.js → channel-worker-manager-FG5377T2.js} +7 -7
  37. package/chunks/{channel-worker-supervisor-UEW2WWCC.js → channel-worker-supervisor-HDVE4ADS.js} +4 -4
  38. package/chunks/{chunk-PPKZ7JOE.js → chunk-22UH7VTP.js} +1 -1
  39. package/chunks/chunk-24FVUD5P.js +49 -0
  40. package/chunks/{chunk-CMHFCLBU.js → chunk-26SIKQIC.js} +1 -1
  41. package/chunks/{chunk-5PA6UEYA.js → chunk-3452WXOK.js} +4 -1
  42. package/chunks/{chunk-SFPGAQUL.js → chunk-373DQUVA.js} +72 -31
  43. package/chunks/{chunk-H2WDGQ6D.js → chunk-3AKCBZVW.js} +3 -3
  44. package/chunks/{chunk-LXIBMVRN.js → chunk-3CZGSTZX.js} +15 -9
  45. package/chunks/{chunk-JVPFTDBK.js → chunk-3EGEBDTW.js} +1 -1
  46. package/chunks/{chunk-K2NQPH5D.js → chunk-3NQCZMUB.js} +79 -5
  47. package/chunks/{chunk-E7REAOTN.js → chunk-47ECGEJC.js} +4 -0
  48. package/chunks/{chunk-WKK5BQNP.js → chunk-4P7PPAHN.js} +45 -421
  49. package/chunks/chunk-4VQBQLIZ.js +293 -0
  50. package/chunks/{chunk-4JWNNLPT.js → chunk-5FGWVPCM.js} +4 -4
  51. package/chunks/{chunk-ZFKOCECU.js → chunk-5ICKESC3.js} +2 -2
  52. package/chunks/{chunk-3I6UTTDX.js → chunk-67AY5D3M.js} +20 -20
  53. package/chunks/chunk-6HUXPLB5.js +110 -0
  54. package/chunks/{chunk-BRVWYMKV.js → chunk-6MBXY6WM.js} +1 -1
  55. package/chunks/{chunk-6LFTG244.js → chunk-6NWPR2EB.js} +19 -9
  56. package/chunks/chunk-6OO7QEWV.js +2581 -0
  57. package/chunks/{chunk-TWSKM647.js → chunk-6VHIWUJP.js} +1 -1
  58. package/chunks/{chunk-RJC5EIKY.js → chunk-6YXNJXQW.js} +7 -5
  59. package/chunks/{chunk-TPI7O7HR.js → chunk-7DDTI7Q3.js} +1 -1
  60. package/chunks/{chunk-KGJGEEVR.js → chunk-7FA2II6K.js} +10 -1
  61. package/chunks/chunk-7J6OTNGO.js +424 -0
  62. package/chunks/{chunk-NIFYWDYN.js → chunk-7TBU7PU2.js} +1 -1
  63. package/chunks/{chunk-3FDFA4MZ.js → chunk-7XICSE62.js} +3 -3
  64. package/chunks/{chunk-V2NDP3I4.js → chunk-7XL4WRXM.js} +2 -2
  65. package/chunks/{chunk-F7TNAPZ4.js → chunk-AAX236AR.js} +45 -11
  66. package/chunks/{chunk-T32W2JHI.js → chunk-ACZ4YRYK.js} +6 -6
  67. package/chunks/chunk-ADJD4LZF.js +210 -0
  68. package/chunks/{chunk-JWALNCLT.js → chunk-AF3QB6OL.js} +1 -1
  69. package/chunks/{chunk-P2SU6ZTI.js → chunk-AI35S34R.js} +3 -3
  70. package/chunks/{chunk-OIP7C4FE.js → chunk-AKNQMSL2.js} +5 -5
  71. package/chunks/{chunk-6CGL7E7G.js → chunk-AN3KFCNH.js} +2 -2
  72. package/chunks/{chunk-ABS25QER.js → chunk-ANVG3BVV.js} +1 -1
  73. package/chunks/chunk-AYYKUUKP.js +972 -0
  74. package/chunks/chunk-B2RIIK3K.js +346 -0
  75. package/chunks/{chunk-F5SZP77N.js → chunk-BBYTY46C.js} +153 -112
  76. package/chunks/{chunk-XRSOI3DL.js → chunk-BE5FGT5Z.js} +1 -1
  77. package/chunks/{chunk-BGXZBI5B.js → chunk-BHTYRHJF.js} +3 -2
  78. package/chunks/{chunk-CSMI4FP5.js → chunk-BSJOBW4U.js} +1 -1
  79. package/chunks/{chunk-Z7TGYN5F.js → chunk-BXNKREX7.js} +3 -3
  80. package/chunks/{chunk-4MQEPP3Y.js → chunk-BY24DZ4J.js} +5 -119
  81. package/chunks/{chunk-5XBFCMWD.js → chunk-CAZADEU7.js} +17 -9
  82. package/chunks/chunk-CHEIIBT3.js +40 -0
  83. package/chunks/{chunk-BBWV7ONL.js → chunk-CM4F4JBB.js} +6 -6
  84. package/chunks/{chunk-CAJTKR6W.js → chunk-D7D3HSYQ.js} +6 -5
  85. package/chunks/{chunk-3DXFGHAJ.js → chunk-DBTMP3P4.js} +213 -185
  86. package/chunks/chunk-DJBQCO2E.js +842 -0
  87. package/chunks/{chunk-RXFQM6FQ.js → chunk-DMEUXLSS.js} +16 -1
  88. package/chunks/{chunk-3AFMQUTI.js → chunk-E4JNFXNI.js} +3 -3
  89. package/chunks/{chunk-UHQFIS7N.js → chunk-EAHOJF6V.js} +28 -4
  90. package/chunks/{chunk-OIVXBW3W.js → chunk-ED7DD7MV.js} +3 -3
  91. package/chunks/{chunk-6DIGWMGT.js → chunk-EIJT2PQ6.js} +2 -2
  92. package/chunks/{chunk-XQFT3QUF.js → chunk-ENYUKMFK.js} +1 -1
  93. package/chunks/{chunk-CQH5KTKC.js → chunk-ERHAMGAA.js} +1 -1
  94. package/chunks/{chunk-IOPCFOTF.js → chunk-ERRJA23L.js} +3 -3
  95. package/chunks/{chunk-LDP5OD6N.js → chunk-EU2B4P3D.js} +12 -12
  96. package/chunks/{chunk-W5MJJ2V7.js → chunk-FHPYRXRH.js} +1 -1
  97. package/chunks/{chunk-IZIVM7LZ.js → chunk-FIWZOMBF.js} +3 -3
  98. package/chunks/{chunk-4HV6HH33.js → chunk-FPMQT2YY.js} +9 -9
  99. package/chunks/{chunk-Z7VOMGDC.js → chunk-FTJMWDND.js} +0 -24
  100. package/chunks/{chunk-L2M46FP5.js → chunk-FXUSWLBF.js} +225 -12
  101. package/chunks/{chunk-VVW4ZNFY.js → chunk-GB4UKWY5.js} +16 -8
  102. package/chunks/{chunk-PKAYJDB3.js → chunk-GCUR24KK.js} +22 -4
  103. package/chunks/{chunk-DIMEPKCW.js → chunk-GDXSXL3H.js} +11 -1
  104. package/chunks/{chunk-7JPW6IYH.js → chunk-GN422P4J.js} +1 -1
  105. package/chunks/{chunk-66KDY3LV.js → chunk-GS7XT345.js} +3 -3
  106. package/chunks/{chunk-PFCQ62V4.js → chunk-H2A2GJGL.js} +6 -6
  107. package/chunks/{chunk-Z7FLBQPR.js → chunk-H5GPPDGY.js} +8 -8
  108. package/chunks/{chunk-CPGJJJLU.js → chunk-HDMKCJHI.js} +1 -1
  109. package/chunks/{chunk-6PJOTWAN.js → chunk-HT5S5TRQ.js} +1 -1
  110. package/chunks/{chunk-Z4X5MTRT.js → chunk-HWVUSYSN.js} +5 -12
  111. package/chunks/{chunk-V4QXXQJ2.js → chunk-I75VKFCJ.js} +4 -4
  112. package/chunks/{chunk-NU7RKEZR.js → chunk-IBMUI5EV.js} +3 -3
  113. package/chunks/{chunk-4J657AJR.js → chunk-ID33ZRWH.js} +42 -42
  114. package/chunks/{chunk-R4PMVSR5.js → chunk-IIFL7QDN.js} +30 -192
  115. package/chunks/{chunk-MQM5PJML.js → chunk-IVUWTA2D.js} +1 -1
  116. package/chunks/{chunk-E55H6BZ7.js → chunk-IXEZHTDR.js} +1616 -151
  117. package/chunks/{chunk-XF63PKEN.js → chunk-IXHV5MIC.js} +1 -1
  118. package/chunks/{chunk-JHS74YAB.js → chunk-J4Y3QJHF.js} +3 -1
  119. package/chunks/{chunk-MIIVI25Q.js → chunk-JDIO45X7.js} +3 -3
  120. package/chunks/{chunk-QFCDF5PL.js → chunk-JHN7UIDW.js} +1 -1
  121. package/chunks/{chunk-FDY5RMGH.js → chunk-JLSZT354.js} +2 -2
  122. package/chunks/chunk-JMRE4WJQ.js +1849 -0
  123. package/chunks/{chunk-FY76G3G5.js → chunk-JOTYTYYW.js} +6 -6
  124. package/chunks/{chunk-TRZTNIQ6.js → chunk-JOWQD4LO.js} +3 -3
  125. package/chunks/{chunk-KEKZFOL6.js → chunk-JPKTAQS3.js} +1 -1
  126. package/chunks/chunk-JS73NNWF.js +30 -0
  127. package/chunks/chunk-JX6XHPTX.js +26 -0
  128. package/chunks/{chunk-5JTIYALA.js → chunk-JZWOCUZ3.js} +1 -1
  129. package/chunks/{chunk-3JGZSIDA.js → chunk-KFN2IZYR.js} +3 -3
  130. package/chunks/{chunk-23RFD54N.js → chunk-KHP66DFN.js} +1 -1
  131. package/chunks/{chunk-AGR5UROZ.js → chunk-KUDI54QQ.js} +23 -33
  132. package/chunks/{chunk-3SGB2UHX.js → chunk-L2OKAIUK.js} +28 -16
  133. package/chunks/{chunk-BXDAPVQU.js → chunk-L6CUJZDG.js} +28 -4
  134. package/chunks/chunk-LAUEEBDL.js +277 -0
  135. package/chunks/{chunk-BNMF3K5X.js → chunk-LFAR7CPW.js} +55 -39
  136. package/chunks/{chunk-Y3QL45LS.js → chunk-LKODFJRD.js} +9 -9
  137. package/chunks/{chunk-BWORX6FA.js → chunk-LMMHS3RS.js} +1 -1
  138. package/chunks/{chunk-UTLCH2FK.js → chunk-LYSZVCCD.js} +10 -7
  139. package/chunks/{chunk-F6FV3C5K.js → chunk-MBZ5ORJB.js} +264 -283
  140. package/chunks/{chunk-L6YT5H34.js → chunk-MJBHSZEJ.js} +5 -5
  141. package/chunks/{chunk-B7CDU2SL.js → chunk-MOF6VZN2.js} +18 -21
  142. package/chunks/{chunk-6LFJEACX.js → chunk-MZ5A5PQW.js} +7 -7
  143. package/chunks/chunk-MZYWNU66.js +149 -0
  144. package/chunks/{chunk-2TNL5KPM.js → chunk-N4QWUPDM.js} +7 -0
  145. package/chunks/{chunk-5O72BNDD.js → chunk-ND7TQQPE.js} +9 -9
  146. package/chunks/{chunk-QP4C6WCE.js → chunk-NGKLMNWN.js} +3 -3
  147. package/chunks/{chunk-JSC3H3TD.js → chunk-NT5XIL5H.js} +46 -18
  148. package/chunks/{chunk-KUX5D6DK.js → chunk-NT7LXVV5.js} +11010 -11138
  149. package/chunks/{chunk-PDQGMSZK.js → chunk-ODZF64DM.js} +1 -1
  150. package/chunks/{chunk-FBSSIAAQ.js → chunk-OE5AQVNB.js} +8 -8
  151. package/chunks/chunk-OHU2H5CS.js +130 -0
  152. package/chunks/{chunk-2K6ORIHJ.js → chunk-OKMDOATP.js} +13 -13
  153. package/chunks/{chunk-JB4JIVTJ.js → chunk-OKTNXDVO.js} +1 -1
  154. package/chunks/{chunk-XDLEZ5HX.js → chunk-OQYXJK2V.js} +1 -1
  155. package/chunks/{chunk-EFUM7RVY.js → chunk-OSTQZIOY.js} +944 -18
  156. package/chunks/{chunk-VQUGEVGR.js → chunk-OTTNXUT5.js} +1 -1
  157. package/chunks/{chunk-T3WXYEZ4.js → chunk-PB7JBAHF.js} +53 -54
  158. package/chunks/{chunk-WAOIHTJS.js → chunk-PDAKFU7M.js} +1 -1
  159. package/chunks/{chunk-43GGFFLY.js → chunk-PDXYZBBQ.js} +3 -3
  160. package/chunks/{chunk-4CMJKUND.js → chunk-PNIGAVY6.js} +67 -2
  161. package/chunks/{chunk-SAH4BD2J.js → chunk-PQEISIKS.js} +67 -0
  162. package/chunks/{chunk-4CDSK5AZ.js → chunk-PWR2NQBS.js} +6 -6
  163. package/chunks/{chunk-YTDVNSUQ.js → chunk-QAK5475D.js} +1 -1
  164. package/chunks/{chunk-IJKTMLBE.js → chunk-QE7DTCLX.js} +1 -1
  165. package/chunks/{chunk-SMPR7SPO.js → chunk-QJNDUTOL.js} +45 -239
  166. package/chunks/{chunk-C6K43ZDE.js → chunk-QTMPM6RC.js} +16 -10
  167. package/chunks/{chunk-P5GGM4KS.js → chunk-RAEEQEC5.js} +5 -5
  168. package/chunks/{chunk-XDFHY4R3.js → chunk-RGEV5AUD.js} +242 -14
  169. package/chunks/{chunk-M6FOJXW3.js → chunk-RKW36UWC.js} +1 -1
  170. package/chunks/{chunk-RIEFGNTP.js → chunk-RLSPPTWH.js} +5119 -683
  171. package/chunks/{chunk-PDMJ3KGS.js → chunk-RT4QNQ5P.js} +3 -3
  172. package/chunks/{chunk-SJ3ZUWFK.js → chunk-RVCGAHC7.js} +4 -26
  173. package/chunks/{chunk-77RG5SFQ.js → chunk-RY7DL5IF.js} +11 -6
  174. package/chunks/{chunk-4FTKQNWJ.js → chunk-S2T7H5MI.js} +182 -3
  175. package/chunks/{chunk-EOGELB3H.js → chunk-SDCHI64N.js} +4 -4
  176. package/chunks/{chunk-EKSCLBBF.js → chunk-SMJYTKTB.js} +23 -5
  177. package/chunks/{chunk-MZS7GEC7.js → chunk-SMRDCANI.js} +1 -1
  178. package/chunks/{chunk-43UYNAWX.js → chunk-T3TL6S3B.js} +4 -4
  179. package/chunks/{chunk-4K7NQDCG.js → chunk-T4EFG2P5.js} +18 -9
  180. package/chunks/{chunk-IK5BW3CS.js → chunk-T4RMUTTT.js} +16 -5
  181. package/chunks/{chunk-L6BZRIUL.js → chunk-TBJ3SNS3.js} +183 -5
  182. package/chunks/{chunk-CCBZDVUA.js → chunk-TNMOFNT4.js} +133 -122
  183. package/chunks/{chunk-Y6LSMB6J.js → chunk-TV7BJ7TX.js} +1 -1
  184. package/chunks/{chunk-G34IR3D6.js → chunk-U5RTYI7D.js} +102 -146
  185. package/chunks/{chunk-TTX2JUE6.js → chunk-U6D2PPMN.js} +1 -1
  186. package/chunks/{chunk-D5LUXLUH.js → chunk-UJ4DUYIH.js} +18 -4
  187. package/chunks/{chunk-A7YP63XN.js → chunk-UKB2TZAO.js} +5 -5
  188. package/chunks/{chunk-VTHREBQM.js → chunk-UKYXYWI2.js} +2 -2
  189. package/chunks/{chunk-2NYCN6F2.js → chunk-UVYKCRJZ.js} +46 -29
  190. package/chunks/{chunk-HVEYF6VT.js → chunk-UXEW7TQS.js} +2 -2
  191. package/chunks/{chunk-HVQ3B7FF.js → chunk-V4HN35IF.js} +44 -7
  192. package/chunks/chunk-VGHZT6JR.js +51 -0
  193. package/chunks/{chunk-V5J4J5TP.js → chunk-VYSZUQGU.js} +2 -20
  194. package/chunks/{chunk-6IUNAPLR.js → chunk-W4BDHLRT.js} +3 -3
  195. package/chunks/{chunk-Q26AYA62.js → chunk-W7KWB6AH.js} +7 -4
  196. package/chunks/chunk-WLEYH7CD.js +332 -0
  197. package/chunks/{chunk-RU7BK6B3.js → chunk-X7C7KFWA.js} +2 -2
  198. package/chunks/{chunk-YRLW2MSX.js → chunk-XBVNNDPK.js} +11 -4
  199. package/chunks/{chunk-BFPESSTR.js → chunk-XEAAO654.js} +1 -1
  200. package/chunks/{chunk-JU4EEXC7.js → chunk-XLENZQXH.js} +2 -2
  201. package/chunks/{chunk-JSHHYW6T.js → chunk-XPDKSOVW.js} +69 -64
  202. package/chunks/chunk-YDQ4OCDK.js +1222 -0
  203. package/chunks/{chunk-ZU4UDIWX.js → chunk-YKADANK6.js} +6 -7
  204. package/chunks/{chunk-JCQD3INC.js → chunk-YNG7XAJU.js} +3 -3
  205. package/chunks/{chunk-O2UN57NX.js → chunk-YOFULAHO.js} +19 -2
  206. package/chunks/{chunk-BAJKAAOY.js → chunk-YOMKOM7E.js} +4892 -1504
  207. package/chunks/{chunk-ERFDKH32.js → chunk-YPISTYEI.js} +8 -7
  208. package/chunks/{chunk-TGWAQ5RB.js → chunk-ZBDYI7VM.js} +6900 -6882
  209. package/chunks/{chunk-OZ6KS6KW.js → chunk-ZGCKTAL5.js} +6 -1
  210. package/chunks/chunk-ZHO2CW6D.js +205 -0
  211. package/chunks/{chunk-DZWPESIF.js → chunk-ZQ3FKEWA.js} +3 -3
  212. package/chunks/{chunk-7EQQR46F.js → chunk-ZVP4PWBU.js} +1 -1
  213. package/chunks/{chunk-7UYV53BC.js → chunk-ZYPJ7HVZ.js} +1 -1
  214. package/chunks/config-utils-NNUPVGEC.js +118 -0
  215. package/chunks/contextCommand-S3TPCDM5.js +111 -0
  216. package/chunks/{core-runtime-677KFX6Q.js → core-runtime-NASPCSQX.js} +66 -63
  217. package/chunks/{create-sub-session-23ITIELI.js → create-sub-session-36TNCHCP.js} +3 -3
  218. package/chunks/{create-sub-session-JKZAYZX7.js → create-sub-session-DS4BJLYZ.js} +97 -68
  219. package/chunks/{cron-create-KJ4IY6PP.js → cron-create-QXHTYUTO.js} +4 -4
  220. package/chunks/{cron-delete-MBLQCAYY.js → cron-delete-WV2BM42M.js} +4 -4
  221. package/chunks/{cron-list-DWH2PQ47.js → cron-list-7KVNBLZ7.js} +4 -4
  222. package/chunks/{daemon-MJQUO7RA.js → daemon-UCVUHPJD.js} +723 -90
  223. package/chunks/{daemon-git-worktree-guard-6MVAAZZZ.js → daemon-git-worktree-guard-ATXVQPS3.js} +63 -60
  224. package/chunks/daemon-status-provider-UI3GBTMO.js +121 -0
  225. package/chunks/daemon-trust-policy-SUCBJ2CA.js +117 -0
  226. package/chunks/{daemon-trust-policy-monitor-B5U6TQX5.js → daemon-trust-policy-monitor-3LM5RQNS.js} +71 -68
  227. package/chunks/{de-X6HLSIFE.js → de-T4BLOKEC.js} +3 -0
  228. package/chunks/deferred-core-runtime-SCOJLVYG.js +119 -0
  229. package/chunks/{display-image-BE7I6ZB6.js → display-image-Z4VBQDEJ.js} +5 -5
  230. package/chunks/{dist-TJUDJTCB.js → dist-5423MG3D.js} +411 -91
  231. package/chunks/{dist-ILDBUWDB.js → dist-7WDZYMWV.js} +43 -25
  232. package/chunks/{dist-ZBVOXSKF.js → dist-FLJLHASF.js} +219 -121
  233. package/chunks/{dist-QODVOVWI.js → dist-GPSRNVVP.js} +43 -35
  234. package/chunks/{dist-DJBNNPLN.js → dist-LY66XNUL.js} +10 -3
  235. package/chunks/{dist-7CKN54NL.js → dist-S3BKCTWF.js} +205 -89
  236. package/chunks/{dist-UQUFZDIY.js → dist-SDKHGH5O.js} +41 -20
  237. package/chunks/{dist-4Q7NTUNB.js → dist-WAUO5OMN.js} +46 -22
  238. package/chunks/{dist-SATKXKUR.js → dist-WIVVPE7M.js} +28 -14
  239. package/chunks/earlyInputCapture-INWJ2STR.js +112 -0
  240. package/chunks/{edit-BSV6YRVW.js → edit-B7ZRRGAE.js} +51 -49
  241. package/chunks/{en-YLXBXM4Z.js → en-E4AYTX6H.js} +3 -0
  242. package/chunks/{enter-worktree-MQXFFPKM.js → enter-worktree-SPZHEETQ.js} +7 -7
  243. package/chunks/{enterPlanMode-PKNF35FE.js → enterPlanMode-S554IKJ2.js} +55 -53
  244. package/chunks/environment-25ADH4Y6.js +134 -0
  245. package/chunks/errors-G2I6LFTW.js +118 -0
  246. package/chunks/{exit-worktree-L344UY7K.js → exit-worktree-AWUXAMAM.js} +7 -7
  247. package/chunks/exitPlanMode-ZFH4OYPM.js +87 -0
  248. package/chunks/{fast-path-773PV7PU.js → fast-path-WZHVZ2ER.js} +8 -7
  249. package/chunks/{fast-path-settings-XMFBYFUH.js → fast-path-settings-NILM6QZL.js} +3 -3
  250. package/chunks/{fr-FTZWF462.js → fr-BGHGYX6A.js} +3 -0
  251. package/chunks/{glob-CZHOWUEA.js → glob-UOVDMBUP.js} +50 -48
  252. package/chunks/{goal-tools-YZQJXTGH.js → goal-tools-7TNK5ZHC.js} +5 -4
  253. package/chunks/{grep-5GPICQBU.js → grep-LHYJ5V2N.js} +9 -7
  254. package/chunks/handleAutoUpdate-4MZ45DZY.js +114 -0
  255. package/chunks/i18n-KWUEI4DS.js +129 -0
  256. package/chunks/{image-gen-HAYOEQ4O.js → image-gen-YZDVO5YS.js} +8 -10
  257. package/chunks/initializer-2NBROGMG.js +118 -0
  258. package/chunks/installationInfo-YKUSY3ZB.js +112 -0
  259. package/chunks/{ja-2GL5FKYJ.js → ja-G3FTD5XE.js} +3 -0
  260. package/chunks/{keychain-token-storage-37XPR34V.js → keychain-token-storage-REZVMJA6.js} +2 -2
  261. package/chunks/list-W2WV3COM.js +121 -0
  262. package/chunks/list-agents-PMVMHNY7.js +128 -0
  263. package/chunks/{gemini-IP4FJAP5.js → llm-NPPHLIJI.js} +162 -133
  264. package/chunks/{geminiContentGenerator-PUNEBWJW.js → llm-content-generator-YK3WN6XW.js} +29 -29
  265. package/chunks/loadedSettingsAdapter-2P7DFWUR.js +115 -0
  266. package/chunks/{loggingContentGenerator-2GGZNGLG.js → loggingContentGenerator-QYYYGU6V.js} +318 -35
  267. package/chunks/{loop-wakeup-XJFONSQ7.js → loop-wakeup-EBM4F5MZ.js} +5 -5
  268. package/chunks/{ls-3VAT2J7A.js → ls-F6TRX3DD.js} +4 -4
  269. package/chunks/{lsp-5W7IRUBH.js → lsp-QYTOS2FI.js} +2 -2
  270. package/chunks/{managed-npm-update-5TEV2E3J.js → managed-npm-update-UMC4NBWW.js} +64 -61
  271. package/chunks/mcp-OFI6XDP2.js +115 -0
  272. package/chunks/{monitor-FI7PY36Z.js → monitor-QX3BM3JY.js} +50 -48
  273. package/chunks/nonInteractiveCli-NVRMD5MN.js +193 -0
  274. package/chunks/{notebook-edit-TPGMGBST.js → notebook-edit-AAILDPSV.js} +51 -49
  275. package/chunks/{open-with-auth-4UI3KHUR.js → open-with-auth-D6JD6LDS.js} +4 -4
  276. package/chunks/{openaiContentGenerator-SUCYANUZ.js → openaiContentGenerator-53PB3CMN.js} +27 -29
  277. package/chunks/pidfile-5ACKG2LI.js +116 -0
  278. package/chunks/process-registry-OAEG6WGC.js +662 -0
  279. package/chunks/{processUtils-IQZBYWSB.js → processUtils-2BCDO3DZ.js} +2 -2
  280. package/chunks/prompt-terminal-ledger-3RKW73A2.js +110 -0
  281. package/chunks/{pt-XN2YWJVM.js → pt-D73IFYT7.js} +3 -0
  282. package/chunks/{qwenContentGenerator-J4TXFGJT.js → qwenContentGenerator-N4LLWDPH.js} +56 -54
  283. package/chunks/{qwenOAuth2-RF33DNZW.js → qwenOAuth2-7AOCKSOQ.js} +7 -9
  284. package/chunks/{read-file-QE2B5FTX.js → read-file-DPAKXHYE.js} +13 -13
  285. package/chunks/{read-mcp-resource-XD257PGJ.js → read-mcp-resource-R4NO75DW.js} +2 -2
  286. package/chunks/{record-artifact-RZGZBENU.js → record-artifact-2EAYLAL5.js} +4 -4
  287. package/chunks/{report-findings-Q3SYKKW5.js → report-findings-Y4MSHDS3.js} +9 -5
  288. package/chunks/{request-shutdown-BCLA3JV2.js → request-shutdown-DWRMGTMB.js} +8 -7
  289. package/chunks/resumeHistoryUtils-3JQORXAK.js +123 -0
  290. package/chunks/ripGrep-AHF5QCI7.js +39 -0
  291. package/chunks/{ru-OLTMFJEW.js → ru-QMISLKRH.js} +3 -0
  292. package/chunks/{run-qwen-serve-TPHZMSXJ.js → run-qwen-serve-3LKV7KDC.js} +728 -256
  293. package/chunks/runtime-66F4W3IA.js +153 -0
  294. package/chunks/scheduled-tasks-2NVKS5Q2.js +132 -0
  295. package/chunks/scheduler-JNV7T3ZO.js +127 -0
  296. package/chunks/{sdk-exporters-http-KCJ4ZFG7.js → sdk-exporters-http-MFIWD23D.js} +2 -2
  297. package/chunks/{sdk-impl-HLSEDAEP.js → sdk-impl-2RXJ4Q6X.js} +11 -5
  298. package/chunks/send-message-WPZRCJOB.js +442 -0
  299. package/chunks/serve-GP2UNRP7.js +123 -0
  300. package/chunks/{server-DFUSSSHI.js → server-7W6C3SOW.js} +5233 -3623
  301. package/chunks/{session-3TEHNENZ.js → session-PZLBAQGG.js} +125 -118
  302. package/chunks/session-pr-refresh-OIVL3U3Z.js +367 -0
  303. package/chunks/{settings-VOZYKLTT.js → settings-ZOHIQWYK.js} +70 -67
  304. package/chunks/shell-FWZT6IUR.js +97 -0
  305. package/chunks/{skill-FEOKFX26.js → skill-RTQC2YGA.js} +121 -65
  306. package/chunks/skill-settings-AKMIXFSJ.js +123 -0
  307. package/chunks/spawnChannel-ZP23JL6O.js +116 -0
  308. package/chunks/standalone-update-P2Q5H4ZU.js +123 -0
  309. package/chunks/{startInteractiveUI-WHJPFOGH.js → startInteractiveUI-NSA6QPQZ.js} +2018 -1526
  310. package/chunks/{stdioHelpers-7A2EE64Z.js → stdioHelpers-AY6XCDY2.js} +3 -1
  311. package/chunks/{syntheticOutput-ML43GEFN.js → syntheticOutput-5URSQLIS.js} +3 -3
  312. package/chunks/{task-create-TMSV7RD5.js → task-create-3EXVDG3G.js} +12 -12
  313. package/chunks/{task-list-W55RBFRX.js → task-list-PIBYNSE7.js} +5 -6
  314. package/chunks/{task-stop-CXEH5L2D.js → task-stop-IV3BYWJC.js} +2 -2
  315. package/chunks/{task-update-N536I4GQ.js → task-update-H5BPDS5Y.js} +13 -14
  316. package/chunks/{team-create-QYSWCYCL.js → team-create-53T42W37.js} +56 -55
  317. package/chunks/{team-delete-FJRFX33M.js → team-delete-X3WPELS6.js} +25 -8
  318. package/chunks/{team-plan-approval-P7DAD644.js → team-plan-approval-D45ZC5OE.js} +50 -48
  319. package/chunks/terminal-image-renderer-FCRUWT6C.js +121 -0
  320. package/chunks/theme-manager-MHNPEDP7.js +107 -0
  321. package/chunks/{todoWrite-WDJNQEMW.js → todoWrite-A5IOZZ3P.js} +4 -4
  322. package/chunks/{tool-search-F2EMIAPV.js → tool-search-6RPBGGUX.js} +27 -23
  323. package/chunks/total-session-admission-MGV56XDK.js +117 -0
  324. package/chunks/trustedFolders-QJYEFMTU.js +127 -0
  325. package/chunks/{types-WYCFCEHR.js → types-HKLPXZB3.js} +1 -3
  326. package/chunks/{update-relaunch-4GF3OXMB.js → update-relaunch-ZDMQX63C.js} +6 -6
  327. package/chunks/updateCheck-4QZWCGP6.js +123 -0
  328. package/chunks/useAutoAcceptIndicator-DLIQN256.js +125 -0
  329. package/chunks/{validateNonInterActiveAuth-BPPA563H.js → validateNonInterActiveAuth-HGTG7AEK.js} +114 -107
  330. package/chunks/{version-ANP4TS6O.js → version-CPAZMC4B.js} +1 -1
  331. package/chunks/{web-fetch-QJADSAH3.js → web-fetch-N4K5M3M4.js} +16 -18
  332. package/chunks/{web-search-7TTQKEKM.js → web-search-4VZKM5SF.js} +9 -11
  333. package/chunks/{web-shell-static-A6QMUNNV.js → web-shell-static-PW7OEDQO.js} +3 -2
  334. package/chunks/{workflow-5XN6XSOT.js → workflow-2ALQKTHG.js} +229 -146
  335. package/chunks/workspace-providers-status-5JM4CB6R.js +119 -0
  336. package/chunks/{workspace-registration-store-XKVW2YVH.js → workspace-registration-store-RNMFVCH7.js} +2 -1
  337. package/chunks/workspace-registry-6EULAPZC.js +126 -0
  338. package/chunks/workspace-runtime-coordinator-IRI2DRCJ.js +127 -0
  339. package/chunks/workspace-service-SETHN4WE.js +131 -0
  340. package/chunks/workspace-skills-status-4D4EUEQU.js +118 -0
  341. package/chunks/{workspace-trust-reconciler-KLGOB53D.js → workspace-trust-reconciler-4LR3CDL4.js} +77 -76
  342. package/chunks/write-file-45GWPSOI.js +92 -0
  343. package/chunks/{zh-UNY63FR3.js → zh-2BQ7P6OD.js} +3 -0
  344. package/chunks/{zh-TW-RPTMRTHG.js → zh-TW-UFXRZTXX.js} +3 -0
  345. package/chunks/{zoom-image-6ASG6J4C.js → zoom-image-K6IQUKRC.js} +13 -13
  346. package/cli.js +129 -92
  347. package/locales/ca.js +6 -0
  348. package/locales/de.js +6 -0
  349. package/locales/en.js +6 -0
  350. package/locales/fr.js +6 -0
  351. package/locales/ja.js +6 -0
  352. package/locales/pt.js +6 -0
  353. package/locales/ru.js +6 -0
  354. package/locales/zh-TW.js +6 -0
  355. package/locales/zh.js +6 -0
  356. package/package.json +3 -3
  357. package/web-shell/assets/{abnfDiagram-VCTEODGH-uS-vtfs3.js → abnfDiagram-VCTEODGH-C80OZcPP.js} +1 -1
  358. package/web-shell/assets/{arc-BSTnk5pu.js → arc-AUqStYgf.js} +1 -1
  359. package/web-shell/assets/{architectureDiagram-5GKGNRK7-DCMyiqzy.js → architectureDiagram-5GKGNRK7-CQYOdYla.js} +1 -1
  360. package/web-shell/assets/{blockDiagram-NRAW4CY4-C7_gt0r1.js → blockDiagram-NRAW4CY4-lYKlFysy.js} +1 -1
  361. package/web-shell/assets/{c4Diagram-UCG6FXSJ-BeQg2L8B.js → c4Diagram-UCG6FXSJ-BoS23iIp.js} +1 -1
  362. package/web-shell/assets/channel-B0ovOJeK.js +1 -0
  363. package/web-shell/assets/{chunk-2Q5K7J3B-DnV9bKBe.js → chunk-2Q5K7J3B-DLLooL1E.js} +1 -1
  364. package/web-shell/assets/{chunk-5VM5RSS4-rT1GAcT7.js → chunk-5VM5RSS4-kPfJxScY.js} +1 -1
  365. package/web-shell/assets/{chunk-F27PBJKO-BcgSxqGA.js → chunk-F27PBJKO-CVGFBqkD.js} +1 -1
  366. package/web-shell/assets/{chunk-G27WJ6UU-Bw1ZhyZq.js → chunk-G27WJ6UU-CnM_kOVV.js} +1 -1
  367. package/web-shell/assets/{chunk-JWPE2WC7-D4iDw-96.js → chunk-JWPE2WC7-Cj-ajOkT.js} +1 -1
  368. package/web-shell/assets/{chunk-LCL6LL3I-D3MB3GTZ.js → chunk-LCL6LL3I-8L5c-wFo.js} +1 -1
  369. package/web-shell/assets/{chunk-POPQ4Y6H-Cep2ndrS.js → chunk-POPQ4Y6H-DsXTxpvL.js} +1 -1
  370. package/web-shell/assets/{chunk-SVP7TREG-BuahMHJc.js → chunk-SVP7TREG-DU5GE1_z.js} +1 -1
  371. package/web-shell/assets/{chunk-XXDRQBXY-BdujIvJY.js → chunk-XXDRQBXY-D2IIWZKt.js} +1 -1
  372. package/web-shell/assets/classDiagram-DTDB5LWJ-DMll2-6_.js +1 -0
  373. package/web-shell/assets/classDiagram-v2-JRS7N3AN-DMll2-6_.js +1 -0
  374. package/web-shell/assets/{cose-bilkent-JH36ORCC-CGLLUbF8.js → cose-bilkent-JH36ORCC-CF_txUJr.js} +1 -1
  375. package/web-shell/assets/{cynefin-OW5HDTMX-D6kDsRSh.js → cynefin-OW5HDTMX-DEZ-My-Z.js} +1 -1
  376. package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-CCy78qZx.js → cynefinDiagram-5FMLGOSQ-BV7EKUS6.js} +1 -1
  377. package/web-shell/assets/{dagre-3AP2YEHR-D5gJuJsf.js → dagre-3AP2YEHR-JGIX0G4H.js} +1 -1
  378. package/web-shell/assets/{diagram-S7CK7UJ4-ZwEZ5W__.js → diagram-S7CK7UJ4-DdUY7q6A.js} +1 -1
  379. package/web-shell/assets/{diagram-UQ7AKVKN-B036APjv.js → diagram-UQ7AKVKN-fhzRZ19v.js} +1 -1
  380. package/web-shell/assets/{diagram-VSXAHHWV-BfDJ57Fq.js → diagram-VSXAHHWV-BOgOex6q.js} +1 -1
  381. package/web-shell/assets/{diagram-VX7I27RA-Wha0p5rT.js → diagram-VX7I27RA-C0NknIz6.js} +1 -1
  382. package/web-shell/assets/{diagram-Z3DM3KII-L20bz2K1.js → diagram-Z3DM3KII-C__3mUBX.js} +1 -1
  383. package/web-shell/assets/{ebnfDiagram-PWID7BFC-D1ZM0Cp7.js → ebnfDiagram-PWID7BFC-BvPhqycH.js} +1 -1
  384. package/web-shell/assets/{erDiagram-SSCWMZ5O-CMtA19v8.js → erDiagram-SSCWMZ5O-BqzoNoL9.js} +1 -1
  385. package/web-shell/assets/{flowDiagram-A5DVABFB-D96m326S.js → flowDiagram-A5DVABFB-CJKOre47.js} +1 -1
  386. package/web-shell/assets/{ganttDiagram-EL5Y4UJY-BuHiYG2o.js → ganttDiagram-EL5Y4UJY-C5xZjrp0.js} +1 -1
  387. package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-Ck3NmkSw.js → gitGraphDiagram-WWUBYQGX-C0EjwuPK.js} +1 -1
  388. package/web-shell/assets/index-B_IPzA0h.js +2020 -0
  389. package/web-shell/assets/{index-CBGz4Qjl.js → index-C5M93syE.js} +1 -1
  390. package/web-shell/assets/index-D1OKGQlM.css +36 -0
  391. package/web-shell/assets/{infoDiagram-RXCK75RN-B6DAOyXe.js → infoDiagram-RXCK75RN-BUwzsYOs.js} +1 -1
  392. package/web-shell/assets/{ishikawaDiagram-5VMMS53U-Bpg-joFo.js → ishikawaDiagram-5VMMS53U-EDJ_DH3V.js} +1 -1
  393. package/web-shell/assets/{journeyDiagram-EYS64GPL-BclrHzGa.js → journeyDiagram-EYS64GPL-BnfcOsS0.js} +1 -1
  394. package/web-shell/assets/{kanban-definition-3QL26DDD-5gJzNTYG.js → kanban-definition-3QL26DDD-D_ofTVGu.js} +1 -1
  395. package/web-shell/assets/{layout-CEz_1L8z.js → layout-CBuQFdfZ.js} +1 -1
  396. package/web-shell/assets/{linear-CBjTq9Hc.js → linear-DRIHtmGv.js} +1 -1
  397. package/web-shell/assets/{mermaid.core-Dzhbxx_I.js → mermaid.core-CmR5wZH6.js} +6 -6
  398. package/web-shell/assets/{mindmap-definition-FBJOCRG2-DQdVqlBF.js → mindmap-definition-FBJOCRG2-BV374olC.js} +1 -1
  399. package/web-shell/assets/{pegDiagram-XKGWAZYB-D1JZlYXL.js → pegDiagram-XKGWAZYB-Bpy1SplK.js} +1 -1
  400. package/web-shell/assets/{pieDiagram-E7YTZNPT-BmkpYL0w.js → pieDiagram-E7YTZNPT-CeZx4hR2.js} +1 -1
  401. package/web-shell/assets/{quadrantDiagram-AXDQQJYC-DRvD6co5.js → quadrantDiagram-AXDQQJYC-COYKs14h.js} +1 -1
  402. package/web-shell/assets/{railroadDiagram-O6MQD6OU-CEdjDuoo.js → railroadDiagram-O6MQD6OU-5g2pOeTs.js} +1 -1
  403. package/web-shell/assets/{requirementDiagram-EFPCY7ZU-BCHG-ie8.js → requirementDiagram-EFPCY7ZU-Yn8uPGtF.js} +1 -1
  404. package/web-shell/assets/{sankeyDiagram-P5KCCOFB-C9cZMnye.js → sankeyDiagram-P5KCCOFB-CTayAGq6.js} +1 -1
  405. package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-DYHRV4zL.js → sequenceDiagram-WJ2MYXX4-BFWDKzUU.js} +1 -1
  406. package/web-shell/assets/{sizeCapture-X5ZJPWSS-DlK21aye.js → sizeCapture-X5ZJPWSS-CtErUbj4.js} +1 -1
  407. package/web-shell/assets/{stateDiagram-HBIQ2CUA-BrmZssvk.js → stateDiagram-HBIQ2CUA-Co3HFzOd.js} +1 -1
  408. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-C3gdRjPm.js +1 -0
  409. package/web-shell/assets/{swimlanes-XN3QIQJK-D9xfcayR.js → swimlanes-XN3QIQJK-CDZuxzOj.js} +1 -1
  410. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-C34TGCPZ.js +8 -0
  411. package/web-shell/assets/{timeline-definition-24CTP7MA-D4gdDL_d.js → timeline-definition-24CTP7MA-UcNHj8At.js} +1 -1
  412. package/web-shell/assets/{vennDiagram-4TSXK5OY-DdhIExjI.js → vennDiagram-4TSXK5OY-JKR9pVFG.js} +1 -1
  413. package/web-shell/assets/{wardleyDiagram-VM6X3IG4-C9RS_Zof.js → wardleyDiagram-VM6X3IG4-C4SU-yIW.js} +1 -1
  414. package/web-shell/assets/{xychartDiagram-S5SC5T6Z-orRgmxWk.js → xychartDiagram-S5SC5T6Z-D_yoWGZ4.js} +1 -1
  415. package/web-shell/index.html +197 -3
  416. package/chunks/MaxSizedBox-X5FZSNAJ.js +0 -112
  417. package/chunks/agent-PJIPDWHB.js +0 -97
  418. package/chunks/agent-headless-B4JVD7UK.js +0 -87
  419. package/chunks/bridge-FKZTVIS3.js +0 -121
  420. package/chunks/channel-settings-store-4UFCLBBG.js +0 -117
  421. package/chunks/chunk-7DJCPZE3.js +0 -945
  422. package/chunks/chunk-CPBF7KYF.js +0 -51
  423. package/chunks/chunk-H72BQNM3.js +0 -645
  424. package/chunks/chunk-J2OSJFP3.js +0 -202
  425. package/chunks/chunk-K2OJUPOE.js +0 -78
  426. package/chunks/chunk-P3QQPMQA.js +0 -19
  427. package/chunks/chunk-RUGNCYNO.js +0 -699
  428. package/chunks/chunk-T26EAKDL.js +0 -13
  429. package/chunks/chunk-ZGXYO7DY.js +0 -3416
  430. package/chunks/chunk-ZYNTSXWK.js +0 -32
  431. package/chunks/config-utils-BBOCOGZW.js +0 -113
  432. package/chunks/contextCommand-EET67MQ2.js +0 -108
  433. package/chunks/daemon-status-provider-RFKZOK3S.js +0 -119
  434. package/chunks/daemon-trust-policy-DRZPFB4Q.js +0 -114
  435. package/chunks/deferred-core-runtime-BBVIOP24.js +0 -116
  436. package/chunks/earlyInputCapture-2JOMMNQ4.js +0 -109
  437. package/chunks/environment-MOZMPUHR.js +0 -131
  438. package/chunks/errors-DMPQVYJL.js +0 -115
  439. package/chunks/exitPlanMode-UE4FGCY4.js +0 -85
  440. package/chunks/handleAutoUpdate-SGXKTQM6.js +0 -111
  441. package/chunks/i18n-B42HKHKH.js +0 -126
  442. package/chunks/initializer-FB66WYR3.js +0 -115
  443. package/chunks/installationInfo-Y7AULNMX.js +0 -109
  444. package/chunks/list-2HWGSVRA.js +0 -118
  445. package/chunks/list-agents-DI3YFTDT.js +0 -80
  446. package/chunks/loadedSettingsAdapter-7Y7IEI6T.js +0 -112
  447. package/chunks/mcp-QGG5NMJJ.js +0 -112
  448. package/chunks/nonInteractiveCli-4LO2TL72.js +0 -186
  449. package/chunks/pidfile-JMF2CLMY.js +0 -113
  450. package/chunks/process-registry-PMJOA5CO.js +0 -172
  451. package/chunks/prompt-terminal-ledger-DCZO6S7C.js +0 -107
  452. package/chunks/resumeHistoryUtils-CZ4JRDVW.js +0 -120
  453. package/chunks/ripGrep-R6B6HWPX.js +0 -39
  454. package/chunks/runtime-TTIGSBM4.js +0 -150
  455. package/chunks/scheduled-tasks-QB4ZVUQS.js +0 -129
  456. package/chunks/scheduler-YRUG22M7.js +0 -124
  457. package/chunks/send-message-Y5I6NYAM.js +0 -295
  458. package/chunks/serve-MXXCDAQN.js +0 -120
  459. package/chunks/shell-6RTKZVMI.js +0 -95
  460. package/chunks/skill-settings-VA4XVYVL.js +0 -120
  461. package/chunks/spawnChannel-F6WVP723.js +0 -114
  462. package/chunks/standalone-update-RGILUQVK.js +0 -120
  463. package/chunks/terminal-image-renderer-SMQE46UJ.js +0 -116
  464. package/chunks/theme-manager-RFO5WWFF.js +0 -104
  465. package/chunks/total-session-admission-HTVTP4BS.js +0 -116
  466. package/chunks/trustedFolders-7OCNMUQE.js +0 -124
  467. package/chunks/updateCheck-7QBDXZRT.js +0 -120
  468. package/chunks/useAutoAcceptIndicator-UI4SNL2O.js +0 -122
  469. package/chunks/workspace-providers-status-PDFZWL5Q.js +0 -116
  470. package/chunks/workspace-registry-23R7XRB5.js +0 -125
  471. package/chunks/workspace-service-MUYO2QIC.js +0 -131
  472. package/chunks/workspace-skills-status-IKECTOOQ.js +0 -115
  473. package/chunks/write-file-GGRBB5TZ.js +0 -90
  474. package/web-shell/assets/channel-CENAhErJ.js +0 -1
  475. package/web-shell/assets/classDiagram-DTDB5LWJ-CM6FArGH.js +0 -1
  476. package/web-shell/assets/classDiagram-v2-JRS7N3AN-CM6FArGH.js +0 -1
  477. package/web-shell/assets/index-8hXIpvo4.js +0 -1865
  478. package/web-shell/assets/index-DclEv91i.css +0 -5
  479. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-B2Q7XDaE.js +0 -1
  480. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-DpZPOSbX.js +0 -8
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  recomputeMcpGating
5
- } from "./chunk-P5GGM4KS.js";
5
+ } from "./chunk-RAEEQEC5.js";
6
6
  import {
7
7
  classifyApiError,
8
8
  fireSessionDeleteHook
@@ -17,7 +17,10 @@ import {
17
17
  normalizePartList,
18
18
  parseExtensionRef,
19
19
  parseMcpServerRef
20
- } from "./chunk-OIP7C4FE.js";
20
+ } from "./chunk-AKNQMSL2.js";
21
+ import {
22
+ getCommandSubcommandNames
23
+ } from "./chunk-QE7DTCLX.js";
21
24
  import {
22
25
  getAvailableCommands,
23
26
  getSlashCommandFirstToken,
@@ -26,53 +29,52 @@ import {
26
29
  isSlashCommand,
27
30
  recordDaemonSessionModel,
28
31
  restoreSessionModelThenAuthenticate
29
- } from "./chunk-F5SZP77N.js";
32
+ } from "./chunk-BBYTY46C.js";
30
33
  import {
31
34
  SessionIdConflictError,
32
35
  appEvents,
33
36
  buildDisabledSkillNamesProvider,
37
+ buildEnabledSkillNamesProvider,
34
38
  cleanupReviewWorktreeLeases,
35
39
  loadCliConfig,
36
40
  normalizeDisabledToolList
37
- } from "./chunk-BAJKAAOY.js";
41
+ } from "./chunk-YOMKOM7E.js";
42
+ import {
43
+ getEffectiveSupportedModes
44
+ } from "./chunk-3NQCZMUB.js";
38
45
  import "./chunk-NYX53SV4.js";
46
+ import "./chunk-JLSZT354.js";
39
47
  import {
40
48
  collectContextData,
41
49
  formatContextUsageText
42
- } from "./chunk-AGR5UROZ.js";
43
- import {
44
- getCommandSubcommandNames
45
- } from "./chunk-IJKTMLBE.js";
46
- import {
47
- getEffectiveSupportedModes
48
- } from "./chunk-K2NQPH5D.js";
49
- import "./chunk-FDY5RMGH.js";
50
+ } from "./chunk-KUDI54QQ.js";
50
51
  import "./chunk-4WGODMVR.js";
52
+ import {
53
+ startNonInteractiveOpenAILogHousekeeping
54
+ } from "./chunk-XPDKSOVW.js";
55
+ import "./chunk-KW7NOTN6.js";
51
56
  import "./chunk-3SH53ANB.js";
57
+ import "./chunk-BSJOBW4U.js";
52
58
  import {
53
59
  isGoalStatusKind
54
60
  } from "./chunk-EKTCKZV5.js";
55
- import "./chunk-QP4C6WCE.js";
61
+ import "./chunk-NGKLMNWN.js";
56
62
  import "./chunk-YAF2MQZ6.js";
57
- import "./chunk-QFCDF5PL.js";
63
+ import "./chunk-JHN7UIDW.js";
58
64
  import {
59
- startNonInteractiveOpenAILogHousekeeping
60
- } from "./chunk-JSHHYW6T.js";
61
- import "./chunk-KW7NOTN6.js";
62
- import "./chunk-C6K43ZDE.js";
65
+ computeCpuPercent
66
+ } from "./chunk-LBOVL47Y.js";
67
+ import "./chunk-24FVUD5P.js";
68
+ import "./chunk-QTMPM6RC.js";
63
69
  import "./chunk-6H67XLET.js";
64
70
  import {
65
71
  beginAcpBootstrapConfigProfiling,
66
72
  buildAndFreezeAcpStartupProfile,
67
73
  endAcpBootstrapConfigProfiling,
68
74
  markAcpStartup
69
- } from "./chunk-5JTIYALA.js";
70
- import "./chunk-A7YP63XN.js";
71
- import "./chunk-L6YT5H34.js";
72
- import "./chunk-CSMI4FP5.js";
73
- import {
74
- computeCpuPercent
75
- } from "./chunk-LBOVL47Y.js";
75
+ } from "./chunk-JZWOCUZ3.js";
76
+ import "./chunk-UKB2TZAO.js";
77
+ import "./chunk-MJBHSZEJ.js";
76
78
  import {
77
79
  GENERATION_MAX_PROMPT_BYTES,
78
80
  GENERATION_TIMEOUT_MS,
@@ -85,7 +87,6 @@ import {
85
87
  createWorkspaceMemoryExtractionErrorLogger,
86
88
  executeGeneration,
87
89
  formatWorkspaceMemoryForgetSummary,
88
- isCompatibleLiveSessionSource,
89
90
  isValidServerName,
90
91
  projectAcpToolResultUpdate,
91
92
  redactMcpServerSecrets,
@@ -94,7 +95,7 @@ import {
94
95
  shouldSuppressRememberErrorDetails,
95
96
  workspaceMemoryFailureCode,
96
97
  workspaceMemoryFailureDiagnostics
97
- } from "./chunk-4MQEPP3Y.js";
98
+ } from "./chunk-BY24DZ4J.js";
98
99
  import {
99
100
  BaseEmitter,
100
101
  HistoryReplayer,
@@ -105,29 +106,39 @@ import {
105
106
  hasFullSessionContext,
106
107
  observeAcpToolResultProjection,
107
108
  observeAcpToolResultWire
108
- } from "./chunk-3SGB2UHX.js";
109
- import "./chunk-BFPESSTR.js";
110
- import "./chunk-E7REAOTN.js";
111
- import "./chunk-XDLEZ5HX.js";
109
+ } from "./chunk-L2OKAIUK.js";
110
+ import "./chunk-XEAAO654.js";
111
+ import "./chunk-47ECGEJC.js";
112
+ import "./chunk-OQYXJK2V.js";
112
113
  import "./chunk-2MIN6GRR.js";
113
114
  import "./chunk-QHTIBUWB.js";
114
115
  import "./chunk-TXASDT2M.js";
116
+ import {
117
+ buildToolWriteOriginMeta
118
+ } from "./chunk-VGHZT6JR.js";
119
+ import {
120
+ getConversationDirectoryName,
121
+ hasVerifiableInode,
122
+ isSameConversationPath,
123
+ isSameDirectoryIdentity
124
+ } from "./chunk-PB7JBAHF.js";
125
+ import "./chunk-UXEO7E3V.js";
126
+ import {
127
+ isCompatibleLiveSessionSource
128
+ } from "./chunk-OHU2H5CS.js";
129
+ import "./chunk-4VQBQLIZ.js";
115
130
  import {
116
131
  DAEMON_OWNED_STANDALONE_CREATION_KEY,
117
132
  SESSION_SOURCE_META_KEY,
118
133
  isReservedStandaloneSessionSourceType,
119
134
  parseSessionSource
120
- } from "./chunk-2TNL5KPM.js";
121
- import {
122
- buildToolWriteOriginMeta,
123
- getConversationDirectoryName,
124
- isSameConversationPath
125
- } from "./chunk-T3WXYEZ4.js";
126
- import "./chunk-UXEO7E3V.js";
127
- import "./chunk-RXFQM6FQ.js";
135
+ } from "./chunk-N4QWUPDM.js";
128
136
  import {
129
- normalizeChannelDeliveryText
130
- } from "./chunk-4CMJKUND.js";
137
+ buildScheduledTaskRunPrompt,
138
+ normalizeChannelDeliveryText,
139
+ scheduledTaskRunSessionName,
140
+ scheduledTaskRunSourceId
141
+ } from "./chunk-PNIGAVY6.js";
131
142
  import {
132
143
  normalizeSessionIdForLookup,
133
144
  parseCallerSuppliedSessionId
@@ -138,21 +149,25 @@ import {
138
149
  buildPermissionSettings,
139
150
  normalizePermissionRules,
140
151
  readPermissionRuleSet
141
- } from "./chunk-KEKZFOL6.js";
152
+ } from "./chunk-JPKTAQS3.js";
142
153
  import {
143
154
  MAX_AUDIO_BYTES,
144
155
  sanitizeVoiceErrorMessage,
145
156
  transcribeVoiceAudio
146
- } from "./chunk-JCQD3INC.js";
157
+ } from "./chunk-YNG7XAJU.js";
147
158
  import {
148
159
  readVoiceModel
149
- } from "./chunk-XRSOI3DL.js";
150
- import "./chunk-YTDVNSUQ.js";
151
- import "./chunk-RJC5EIKY.js";
152
- import "./chunk-6CGL7E7G.js";
153
- import "./chunk-ZGXYO7DY.js";
160
+ } from "./chunk-BE5FGT5Z.js";
161
+ import "./chunk-QAK5475D.js";
162
+ import "./chunk-6YXNJXQW.js";
163
+ import "./chunk-AN3KFCNH.js";
164
+ import "./chunk-JS73NNWF.js";
165
+ import {
166
+ SCHEDULED_TASK_RUN_SOURCE_TYPE
167
+ } from "./chunk-RLSPPTWH.js";
154
168
  import "./chunk-7U5G6JXI.js";
155
169
  import "./chunk-WCCLLK7X.js";
170
+ import "./chunk-OCPBI7J5.js";
156
171
  import {
157
172
  REASONING_EFFORT_DEFAULT,
158
173
  REASONING_EFFORT_NAMES,
@@ -160,7 +175,7 @@ import {
160
175
  buildModelReasoningConfigOption,
161
176
  buildModelReasoningConfigPreview,
162
177
  getModelConfiguration
163
- } from "./chunk-4K7NQDCG.js";
178
+ } from "./chunk-T4EFG2P5.js";
164
179
  import {
165
180
  ACP_ROUTE_ID_PREFIX,
166
181
  buildAcpModelOptions,
@@ -169,26 +184,27 @@ import {
169
184
  parseAcpModelOption,
170
185
  resolveAcpModelOption,
171
186
  sanitizeProviderBaseUrl
172
- } from "./chunk-Q26AYA62.js";
187
+ } from "./chunk-W7KWB6AH.js";
173
188
  import {
174
189
  mapSkillConfigToStatus
175
- } from "./chunk-BGXZBI5B.js";
190
+ } from "./chunk-BHTYRHJF.js";
176
191
  import {
177
192
  resolveSkillSettings
178
- } from "./chunk-Z4X5MTRT.js";
179
- import "./chunk-FBSSIAAQ.js";
180
- import "./chunk-PFCQ62V4.js";
193
+ } from "./chunk-HWVUSYSN.js";
194
+ import "./chunk-DMEUXLSS.js";
195
+ import "./chunk-OE5AQVNB.js";
196
+ import "./chunk-H2A2GJGL.js";
181
197
  import "./chunk-57OAHC2Y.js";
182
- import "./chunk-HVQ3B7FF.js";
183
- import "./chunk-7JPW6IYH.js";
184
- import "./chunk-5XBFCMWD.js";
198
+ import "./chunk-V4HN35IF.js";
199
+ import "./chunk-CAZADEU7.js";
200
+ import "./chunk-GN422P4J.js";
185
201
  import "./chunk-V6WHFGST.js";
186
202
  import {
187
203
  createLoadedSettingsAdapter
188
- } from "./chunk-CPGJJJLU.js";
204
+ } from "./chunk-HDMKCJHI.js";
189
205
  import {
190
206
  ndJsonStream
191
- } from "./chunk-H72BQNM3.js";
207
+ } from "./chunk-JMRE4WJQ.js";
192
208
  import {
193
209
  ACP_PREFLIGHT_KINDS,
194
210
  IDLE_HOOK_EVENTS,
@@ -196,8 +212,8 @@ import {
196
212
  SERVE_STATUS_EXT_METHODS,
197
213
  STATUS_SCHEMA_VERSION,
198
214
  mapDomainErrorToErrorKind
199
- } from "./chunk-JHS74YAB.js";
200
- import "./chunk-MZS7GEC7.js";
215
+ } from "./chunk-J4Y3QJHF.js";
216
+ import "./chunk-SMRDCANI.js";
201
217
  import {
202
218
  ACTIVE_WORK_CLOSE_IF_UNHELD_PARAM,
203
219
  ACTIVE_WORK_HEARTBEAT_META_KEY,
@@ -228,22 +244,24 @@ import {
228
244
  MID_TURN_QUEUE_DRAIN_METHOD,
229
245
  PROMPT_CANCEL_METHOD,
230
246
  REQUESTED_SESSION_ID_META_KEY,
247
+ SESSION_INITIALIZATION_DEADLINE_META_KEY,
248
+ SESSION_INITIALIZATION_TIMEOUT_ERROR_KIND,
231
249
  TODO_STOP_GUARD_CONTINUATION_CLAIM_METHOD,
232
250
  TODO_STOP_GUARD_QUEUE_RELEASE_METHOD,
233
251
  WORKTREE_MCP_DEFER_META_KEY,
234
252
  clampActiveWorkIntervalMs,
235
253
  isValidTrustedModelPrompt
236
- } from "./chunk-OZ6KS6KW.js";
254
+ } from "./chunk-ZGCKTAL5.js";
237
255
  import {
238
256
  NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE,
239
257
  isNotCurrentlyGeneratingCancelError
240
- } from "./chunk-ERFDKH32.js";
258
+ } from "./chunk-YPISTYEI.js";
241
259
  import "./chunk-6PLDPT2C.js";
242
260
  import "./chunk-FYJ7W2PI.js";
243
261
  import "./chunk-STUJ7IMZ.js";
244
- import "./chunk-JVPFTDBK.js";
245
- import "./chunk-ALMR3E6Q.js";
246
262
  import "./chunk-GYTKQYDB.js";
263
+ import "./chunk-3EGEBDTW.js";
264
+ import "./chunk-ALMR3E6Q.js";
247
265
  import "./chunk-RKFGE7JH.js";
248
266
  import "./chunk-UDG5EZJI.js";
249
267
  import {
@@ -256,11 +274,11 @@ import {
256
274
  isValidExternalToolGuardDenialReason
257
275
  } from "./chunk-3VUENPWF.js";
258
276
  import "./chunk-M5GB774H.js";
259
- import "./chunk-7EQQR46F.js";
277
+ import "./chunk-ZVP4PWBU.js";
260
278
  import {
261
279
  ACP_EVENT_LOOP_STALL_RESTART_MS,
262
280
  CHANNEL_PROMPT_META_KEY
263
- } from "./chunk-E55H6BZ7.js";
281
+ } from "./chunk-IXEZHTDR.js";
264
282
  import {
265
283
  AgentSideConnection,
266
284
  PROTOCOL_VERSION,
@@ -269,7 +287,7 @@ import {
269
287
  import {
270
288
  assembleMcpServers,
271
289
  loadMcpApprovals
272
- } from "./chunk-5O72BNDD.js";
290
+ } from "./chunk-ND7TQQPE.js";
273
291
  import {
274
292
  getOutputLanguageFilePath,
275
293
  getPersistScopeForModelSelection,
@@ -278,9 +296,9 @@ import {
278
296
  resolveOutputLanguageOrPreserveAuto,
279
297
  updateOutputLanguageFile,
280
298
  writeOutputLanguageAndRegisterPath
281
- } from "./chunk-F7TNAPZ4.js";
299
+ } from "./chunk-AAX236AR.js";
300
+ import "./chunk-NT5XIL5H.js";
282
301
  import "./chunk-RKUWKYED.js";
283
- import "./chunk-JSC3H3TD.js";
284
302
  import "./chunk-GOXKNSDZ.js";
285
303
  import {
286
304
  getSystemDefaultsPath,
@@ -289,7 +307,7 @@ import {
289
307
  import {
290
308
  getCurrentLanguage,
291
309
  setLanguageAsync
292
- } from "./chunk-LDP5OD6N.js";
310
+ } from "./chunk-EU2B4P3D.js";
293
311
  import {
294
312
  SUPPORTED_LANGUAGES
295
313
  } from "./chunk-5EJZE3FP.js";
@@ -297,19 +315,19 @@ import {
297
315
  findEnvFiles,
298
316
  preResolveHomeEnvOverrides,
299
317
  reloadEnvironment
300
- } from "./chunk-IK5BW3CS.js";
318
+ } from "./chunk-T4RMUTTT.js";
301
319
  import {
302
320
  ENV_ACP_REPEATED_TOOL_FAILURE_GUARD,
303
321
  QWEN_CODE_SERVE_ENV
304
- } from "./chunk-5PA6UEYA.js";
305
- import "./chunk-V2NDP3I4.js";
306
- import "./chunk-7UYV53BC.js";
322
+ } from "./chunk-3452WXOK.js";
323
+ import "./chunk-7XL4WRXM.js";
324
+ import "./chunk-ZYPJ7HVZ.js";
307
325
  import "./chunk-W3N5XAZ6.js";
308
326
  import {
309
327
  isFolderTrustEnabled,
310
328
  isWorkspaceTrusted,
311
329
  loadTrustedFolders
312
- } from "./chunk-V4QXXQJ2.js";
330
+ } from "./chunk-I75VKFCJ.js";
313
331
  import "./chunk-NPQ5ZKRP.js";
314
332
  import "./chunk-MR3PXB6E.js";
315
333
  import {
@@ -339,30 +357,37 @@ import {
339
357
  resolveBaseUrl,
340
358
  runManagedRememberByAgent,
341
359
  subagentGenerator
342
- } from "./chunk-KUX5D6DK.js";
343
- import "./chunk-3DXFGHAJ.js";
360
+ } from "./chunk-NT7LXVV5.js";
361
+ import {
362
+ MAX_RETAINED_SNAPSHOTS,
363
+ deleteWorkflowSnapshot,
364
+ listSavedWorkflows,
365
+ listWorkflowSnapshots,
366
+ toSnapshot
367
+ } from "./chunk-DBTMP3P4.js";
344
368
  import "./chunk-XFSFZCM5.js";
345
369
  import "./chunk-2EAZ43JQ.js";
346
370
  import "./chunk-NF5J2WFA.js";
347
371
  import {
348
372
  CreateSubSessionTool
349
- } from "./chunk-CQH5KTKC.js";
373
+ } from "./chunk-ERHAMGAA.js";
350
374
  import "./chunk-LJZSMWOH.js";
351
- import "./chunk-6LFTG244.js";
352
- import "./chunk-PKAYJDB3.js";
353
- import "./chunk-6IUNAPLR.js";
375
+ import "./chunk-6NWPR2EB.js";
376
+ import "./chunk-GCUR24KK.js";
377
+ import "./chunk-W4BDHLRT.js";
354
378
  import {
355
379
  restoreWorktreeContext
356
- } from "./chunk-OIVXBW3W.js";
357
- import "./chunk-4CDSK5AZ.js";
358
- import "./chunk-XQFT3QUF.js";
359
- import "./chunk-VTHREBQM.js";
380
+ } from "./chunk-ED7DD7MV.js";
381
+ import "./chunk-AYYKUUKP.js";
382
+ import "./chunk-PWR2NQBS.js";
383
+ import "./chunk-ENYUKMFK.js";
384
+ import "./chunk-UKYXYWI2.js";
360
385
  import "./chunk-ZPJWUGCS.js";
361
386
  import {
362
387
  clearCachedCredentialFile,
363
388
  qwenOAuth2Events
364
- } from "./chunk-H2WDGQ6D.js";
365
- import "./chunk-MIIVI25Q.js";
389
+ } from "./chunk-3AKCBZVW.js";
390
+ import "./chunk-JDIO45X7.js";
366
391
  import {
367
392
  APPROVAL_MODE_INFO,
368
393
  BranchPointInvalidError,
@@ -380,7 +405,6 @@ import {
380
405
  MessageDisplayDispatcher,
381
406
  PLAN_MODE_ENTRY_SIBLING_SKIP_MESSAGE,
382
407
  POOLED_TRANSPORTS_DEFAULT,
383
- SESSION_ARTIFACT_PERSISTENCE_VERSION,
384
408
  SESSION_TITLE_MAX_LENGTH,
385
409
  SESSION_TRANSCRIPT_MAX_LIMIT,
386
410
  SESSION_TRANSCRIPT_MAX_PAGE_BYTES,
@@ -397,6 +421,7 @@ import {
397
421
  TURN_RESULT_TEXT_MAX_CHARS,
398
422
  abortGoalForStopHookCap,
399
423
  acquireSleepInhibitor,
424
+ ambientGoalToolResultProvenance,
400
425
  applyAutoModeDecision,
401
426
  approxBase64Bytes,
402
427
  bridgeToolResultImages,
@@ -431,31 +456,30 @@ import {
431
456
  formatStopHookBlockingCapWarning,
432
457
  generateToolUseId,
433
458
  getActiveGoal,
434
- getArenaSystemReminder,
435
459
  getAutoModePermissionDeniedReason,
436
460
  getEffectivePermissionForConfirmation,
437
461
  getFunctionCallFingerprint,
438
462
  getMCPDiscoveryState,
439
- getPlanModeSystemReminder,
440
463
  getProviderToolCallId,
441
464
  getScopedEnvContents,
442
465
  getStopHookContinuationReason,
443
466
  getToolCallRepeatKey,
467
+ getWorkflowTaskMutationKey,
444
468
  ideContextStore,
445
469
  injectPermissionRulesIfMissing,
446
470
  isApproveOutcome,
471
+ isCompressionFailureStatus,
447
472
  isDenialFallbackReason,
448
473
  isGatedMcpScope,
449
474
  isPlanModeBlocked,
450
475
  isReplayOfHandledToolCall,
476
+ isTerminalWorkflowStatus,
451
477
  isTurnResultRecordPayload,
452
478
  markDuplicateProviderToolCallResponseSent,
453
479
  matchesAnyServerPattern,
454
480
  mcpServerRequiresOAuth,
455
481
  needsConfirmation,
456
482
  normalizeDerivedBranchTitle,
457
- normalizeEventPayload,
458
- normalizeSnapshotPayload,
459
483
  normalizeTurnResultError,
460
484
  observeToolResultBoundary,
461
485
  persistPermissionOutcome,
@@ -476,46 +500,66 @@ import {
476
500
  toolResultBoundaryArtifact,
477
501
  toolResultPartDiagnosticValues,
478
502
  truncateNotificationLabel,
503
+ tryWithWorkflowTaskMutation,
479
504
  updateSetting,
480
505
  validatePlanModeShellApproval,
481
506
  validatePlanModeShellContext
482
- } from "./chunk-TGWAQ5RB.js";
507
+ } from "./chunk-ZBDYI7VM.js";
483
508
  import "./chunk-GOFAQQZA.js";
484
509
  import "./chunk-5M6IDOMF.js";
510
+ import "./chunk-6HUXPLB5.js";
485
511
  import "./chunk-TWPJO254.js";
486
512
  import {
487
513
  external_exports
488
514
  } from "./chunk-CQ35AJ4Z.js";
489
- import "./chunk-EKSCLBBF.js";
490
- import "./chunk-P2SU6ZTI.js";
491
- import "./chunk-IZIVM7LZ.js";
492
- import "./chunk-SFPGAQUL.js";
515
+ import "./chunk-SMJYTKTB.js";
516
+ import "./chunk-AI35S34R.js";
517
+ import "./chunk-FIWZOMBF.js";
493
518
  import {
494
519
  parsePositiveIntegerEnv
495
520
  } from "./chunk-6PVPNMXU.js";
496
521
  import {
497
522
  RUNTIME_SNAPSHOT_PREFIX
498
- } from "./chunk-JB4JIVTJ.js";
523
+ } from "./chunk-OKTNXDVO.js";
524
+ import {
525
+ SESSION_ARTIFACT_PERSISTENCE_VERSION,
526
+ normalizeEventPayload,
527
+ normalizeSnapshotPayload
528
+ } from "./chunk-DJBQCO2E.js";
499
529
  import "./chunk-IRH27ZC2.js";
500
530
  import "./chunk-QHWCP53L.js";
501
- import "./chunk-D5LUXLUH.js";
531
+ import "./chunk-UJ4DUYIH.js";
502
532
  import {
503
533
  promptIdContext,
504
534
  todoWorkChainContext
505
535
  } from "./chunk-O6GEWCJA.js";
506
- import "./chunk-T26EAKDL.js";
507
- import "./chunk-EOGELB3H.js";
508
- import "./chunk-CPBF7KYF.js";
509
- import "./chunk-EFUM7RVY.js";
536
+ import {
537
+ getArenaSystemReminder,
538
+ getOutputStyleTurnReminder,
539
+ getPlanModeSystemReminder,
540
+ resolveMainSessionOutputStyle
541
+ } from "./chunk-YDQ4OCDK.js";
542
+ import "./chunk-SDCHI64N.js";
543
+ import "./chunk-B2RIIK3K.js";
544
+ import "./chunk-373DQUVA.js";
545
+ import {
546
+ AgentOutputMessageCapture,
547
+ addAgentInputMessageAttributes,
548
+ addToolArgumentsAttributes,
549
+ addToolCallResultAttributes,
550
+ registerAcpEventLoopLagGauge,
551
+ startEventLoopLagMonitor
552
+ } from "./chunk-OSTQZIOY.js";
510
553
  import {
511
554
  HookEventName,
512
555
  createHookOutput
513
- } from "./chunk-TTX2JUE6.js";
514
- import "./chunk-43GGFFLY.js";
515
- import "./chunk-SMPR7SPO.js";
516
- import "./chunk-JWALNCLT.js";
517
- import "./chunk-NIFYWDYN.js";
518
- import "./chunk-3AFMQUTI.js";
556
+ } from "./chunk-U6D2PPMN.js";
557
+ import "./chunk-PDXYZBBQ.js";
558
+ import "./chunk-QJNDUTOL.js";
559
+ import "./chunk-ZHO2CW6D.js";
560
+ import "./chunk-AF3QB6OL.js";
561
+ import "./chunk-7TBU7PU2.js";
562
+ import "./chunk-E4JNFXNI.js";
519
563
  import {
520
564
  GoalConflictError,
521
565
  GoalInvalidTransitionError,
@@ -524,50 +568,45 @@ import {
524
568
  goalTurnContext,
525
569
  parseGoalControlRequest,
526
570
  parseGoalSnapshotV2,
527
- parseGoalStateCause,
571
+ parseGoalStateCause
572
+ } from "./chunk-4P7PPAHN.js";
573
+ import {
528
574
  wrapUserPromptSubmitContext
529
- } from "./chunk-WKK5BQNP.js";
575
+ } from "./chunk-7J6OTNGO.js";
576
+ import {
577
+ escapeJsonTagCharacters
578
+ } from "./chunk-CHEIIBT3.js";
579
+ import "./chunk-VYSZUQGU.js";
530
580
  import {
531
581
  APPROVAL_MODES
532
- } from "./chunk-V5J4J5TP.js";
582
+ } from "./chunk-JX6XHPTX.js";
533
583
  import "./chunk-MLXTMF7H.js";
534
584
  import "./chunk-NAVJD2PQ.js";
535
- import "./chunk-3JGZSIDA.js";
536
- import "./chunk-VVW4ZNFY.js";
585
+ import "./chunk-KFN2IZYR.js";
586
+ import "./chunk-GB4UKWY5.js";
537
587
  import "./chunk-QHMLYMMS.js";
538
- import {
539
- AgentOutputMessageCapture,
540
- addAgentInputMessageAttributes,
541
- addToolArgumentsAttributes,
542
- addToolCallResultAttributes,
543
- registerAcpEventLoopLagGauge,
544
- startEventLoopLagMonitor
545
- } from "./chunk-7DJCPZE3.js";
546
- import "./chunk-P3QQPMQA.js";
547
588
  import {
548
589
  addDaemonRequestAttribute,
549
590
  extractDaemonTraceContext,
550
591
  withDaemonSpan
551
- } from "./chunk-HVEYF6VT.js";
592
+ } from "./chunk-UXEW7TQS.js";
552
593
  import "./chunk-VNOVK4I7.js";
553
- import "./chunk-SAH4BD2J.js";
554
- import "./chunk-PDMJ3KGS.js";
594
+ import "./chunk-PQEISIKS.js";
595
+ import "./chunk-RT4QNQ5P.js";
555
596
  import {
556
597
  runWithRuntimeContentGenerator
557
- } from "./chunk-CMHFCLBU.js";
598
+ } from "./chunk-26SIKQIC.js";
558
599
  import "./chunk-S6LOFUVP.js";
600
+ import {
601
+ getToolCallPreparations
602
+ } from "./chunk-CFKIH3D3.js";
559
603
  import {
560
604
  REASONING_EFFORT_TIERS,
561
605
  applyReasoningEffort
562
606
  } from "./chunk-2LD5U7Q3.js";
563
607
  import "./chunk-DJ2GSRLV.js";
564
- import "./chunk-J2OSJFP3.js";
565
- import "./chunk-K2OJUPOE.js";
566
- import {
567
- getToolCallPreparations
568
- } from "./chunk-CFKIH3D3.js";
569
- import "./chunk-4FTKQNWJ.js";
570
- import "./chunk-Y3QL45LS.js";
608
+ import "./chunk-S2T7H5MI.js";
609
+ import "./chunk-LKODFJRD.js";
571
610
  import {
572
611
  ConversationFinishedEvent,
573
612
  DiscoveredMCPTool,
@@ -598,35 +637,35 @@ import {
598
637
  shouldRunVisionBridge,
599
638
  splitImageParts,
600
639
  uiTelemetryService
601
- } from "./chunk-L2M46FP5.js";
602
- import "./chunk-YRLW2MSX.js";
640
+ } from "./chunk-FXUSWLBF.js";
641
+ import "./chunk-XBVNNDPK.js";
603
642
  import "./chunk-VGC4I5JJ.js";
604
643
  import {
605
- getAllGeminiMdFilenames,
644
+ getAllMemoryFilenames,
606
645
  getSpecificMimeType
607
- } from "./chunk-3I6UTTDX.js";
646
+ } from "./chunk-67AY5D3M.js";
608
647
  import {
609
648
  getAutoMemoryRoot,
610
649
  getUserAutoMemoryRoot
611
- } from "./chunk-6PJOTWAN.js";
650
+ } from "./chunk-HT5S5TRQ.js";
612
651
  import {
613
652
  runSideQuery
614
- } from "./chunk-BWORX6FA.js";
653
+ } from "./chunk-LMMHS3RS.js";
615
654
  import "./chunk-WZAD4ZNJ.js";
616
655
  import {
617
656
  DEFAULT_TOKEN_LIMIT,
618
657
  tokenLimit
619
658
  } from "./chunk-FPGTNKCP.js";
620
- import "./chunk-6DIGWMGT.js";
659
+ import "./chunk-EIJT2PQ6.js";
621
660
  import {
622
661
  hasVertexProjectConfigured,
623
662
  preloadContentGenerator
624
- } from "./chunk-Z7FLBQPR.js";
663
+ } from "./chunk-H5GPPDGY.js";
625
664
  import "./chunk-XZA32HII.js";
626
- import "./chunk-23RFD54N.js";
665
+ import "./chunk-KHP66DFN.js";
627
666
  import {
628
667
  AuthType
629
- } from "./chunk-PPKZ7JOE.js";
668
+ } from "./chunk-22UH7VTP.js";
630
669
  import "./chunk-HHJLM3WQ.js";
631
670
  import {
632
671
  endToolExecutionSpan,
@@ -638,17 +677,18 @@ import {
638
677
  startToolExecutionSpan,
639
678
  startToolSpan,
640
679
  withInteractionSpan
641
- } from "./chunk-L6BZRIUL.js";
680
+ } from "./chunk-TBJ3SNS3.js";
642
681
  import "./chunk-74TONY4F.js";
643
- import "./chunk-XF63PKEN.js";
682
+ import "./chunk-IXHV5MIC.js";
644
683
  import {
645
684
  FORK_SUBAGENT_TYPE,
646
685
  getStartupContextLength,
647
- isSystemReminderContent
648
- } from "./chunk-CAJTKR6W.js";
649
- import "./chunk-ZU4UDIWX.js";
686
+ isSystemReminderContent,
687
+ wrapSystemReminder
688
+ } from "./chunk-D7D3HSYQ.js";
689
+ import "./chunk-YKADANK6.js";
650
690
  import "./chunk-AQ37AY7B.js";
651
- import "./chunk-PDQGMSZK.js";
691
+ import "./chunk-ODZF64DM.js";
652
692
  import {
653
693
  BaseDeclarativeTool,
654
694
  BaseToolInvocation,
@@ -656,7 +696,7 @@ import {
656
696
  ToolNames,
657
697
  canonicalToolName,
658
698
  isShellProgressData
659
- } from "./chunk-UTLCH2FK.js";
699
+ } from "./chunk-LYSZVCCD.js";
660
700
  import {
661
701
  Storage,
662
702
  createDebugLogger,
@@ -664,15 +704,16 @@ import {
664
704
  getErrorStatus,
665
705
  isSubpath,
666
706
  sessionIdContext
667
- } from "./chunk-UHQFIS7N.js";
668
- import "./chunk-W5MJJ2V7.js";
707
+ } from "./chunk-EAHOJF6V.js";
708
+ import "./chunk-FHPYRXRH.js";
709
+ import "./chunk-WLEYH7CD.js";
669
710
  import {
670
711
  runExitCleanup
671
- } from "./chunk-Y6LSMB6J.js";
712
+ } from "./chunk-TV7BJ7TX.js";
672
713
  import {
673
714
  writeStderrLine,
674
715
  writeStderrLineSafe
675
- } from "./chunk-KGJGEEVR.js";
716
+ } from "./chunk-7FA2II6K.js";
676
717
  import "./chunk-75DOP5OR.js";
677
718
  import "./chunk-DMTGGOSA.js";
678
719
  import "./chunk-YQ3U5MUC.js";
@@ -689,6 +730,7 @@ import {
689
730
  init_esbuild_shims();
690
731
  import { randomUUID as randomUUID2, timingSafeEqual } from "node:crypto";
691
732
  import { performance } from "node:perf_hooks";
733
+ import { isDeepStrictEqual } from "node:util";
692
734
 
693
735
  // packages/cli/src/acp-integration/authMethods.ts
694
736
  init_esbuild_shims();
@@ -1050,9 +1092,6 @@ function inactiveExtensionSkillRefs(config) {
1050
1092
  if (extension.isActive) continue;
1051
1093
  for (const skill of extension.skills ?? []) {
1052
1094
  refs.add(extensionSkillRef(extension.name, skill.name));
1053
- if (extension.displayName) {
1054
- refs.add(extensionSkillRef(extension.displayName, skill.name));
1055
- }
1056
1095
  }
1057
1096
  }
1058
1097
  return refs;
@@ -1074,7 +1113,7 @@ import * as path3 from "node:path";
1074
1113
  // packages/cli/src/acp-integration/live/capture-screen-context.ts
1075
1114
  init_esbuild_shims();
1076
1115
  import { constants } from "node:fs";
1077
- import { open, unlink } from "node:fs/promises";
1116
+ import { lstat, open, unlink } from "node:fs/promises";
1078
1117
  import { tmpdir } from "node:os";
1079
1118
  import { dirname, join, resolve as resolve2 } from "node:path";
1080
1119
  var MAX_SCREENSHOT_BYTES = 8 * 1024 * 1024;
@@ -1099,6 +1138,9 @@ function resolvePrivatePngPath(path7, captureDirectory) {
1099
1138
  }
1100
1139
  __name(resolvePrivatePngPath, "resolvePrivatePngPath");
1101
1140
  async function readPrivatePng(path7) {
1141
+ if ((await lstat(path7)).isSymbolicLink()) {
1142
+ throw new Error("Host returned a symbolic link screenshot path.");
1143
+ }
1102
1144
  const handle = await open(path7, constants.O_RDONLY | constants.O_NOFOLLOW);
1103
1145
  try {
1104
1146
  const stat2 = await handle.stat();
@@ -1151,11 +1193,13 @@ var CaptureScreenContextInvocation = class extends BaseToolInvocation {
1151
1193
  signal.throwIfAborted();
1152
1194
  const screenshot = await readPrivatePng(screenshotPath);
1153
1195
  signal.throwIfAborted();
1154
- const serializedContext = JSON.stringify({
1155
- appName: result.appName,
1156
- ...result.windowTitle ? { windowTitle: result.windowTitle } : {},
1157
- accessibilityText: result.accessibilityText
1158
- }).replace(/</gu, "\\u003c");
1196
+ const serializedContext = escapeJsonTagCharacters(
1197
+ JSON.stringify({
1198
+ appName: result.appName,
1199
+ ...result.windowTitle ? { windowTitle: result.windowTitle } : {},
1200
+ accessibilityText: result.accessibilityText
1201
+ })
1202
+ );
1159
1203
  return {
1160
1204
  llmContent: [
1161
1205
  {
@@ -3157,6 +3201,7 @@ __name(reduceRepeatedToolFailureGuard, "reduceRepeatedToolFailureGuard");
3157
3201
  // packages/cli/src/acp-integration/session/Session.ts
3158
3202
  var debugLogger6 = createDebugLogger("SESSION");
3159
3203
  var permissionRequestTails = /* @__PURE__ */ new WeakMap();
3204
+ var MAX_RETAINED_SESSION_ROUTE_COUNTS = 8;
3160
3205
  var USER_CANCEL_ABORT_REASON = "qwen:user-cancel";
3161
3206
  var NEW_PROMPT_ABORT_REASON = "qwen:new-prompt";
3162
3207
  var SESSION_DISPOSE_ABORT_REASON = "qwen:session-dispose";
@@ -3204,10 +3249,6 @@ function isTodoStopGuardPromptText(text) {
3204
3249
  return remainder === body || remainder === body + TODO_STOP_GUARD_FINAL_PROMPT_SUFFIX;
3205
3250
  }
3206
3251
  __name(isTodoStopGuardPromptText, "isTodoStopGuardPromptText");
3207
- function isCompressionFailureStatus(status) {
3208
- 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 */;
3209
- }
3210
- __name(isCompressionFailureStatus, "isCompressionFailureStatus");
3211
3252
  async function finalizeToolCallPreparations(tracker, includeResolved, streamName) {
3212
3253
  try {
3213
3254
  await tracker.discard(includeResolved);
@@ -3871,13 +3912,13 @@ async function registerCreateSubSessionTool(config) {
3871
3912
  ToolNames.CREATE_SUB_SESSION,
3872
3913
  async () => new CreateSubSessionTool(config)
3873
3914
  );
3874
- await config.getGeminiClient().setTools();
3915
+ await config.getLlmClient().setTools();
3875
3916
  return;
3876
3917
  }
3877
3918
  toolRegistry.registerTool(new CreateSubSessionTool(config));
3878
3919
  toolRegistry.revealDeferredTool(ToolNames.CREATE_SUB_SESSION);
3879
3920
  toolRegistry.pinDeferredToolReveal(ToolNames.CREATE_SUB_SESSION);
3880
- await config.getGeminiClient().setTools();
3921
+ await config.getLlmClient().setTools();
3881
3922
  }
3882
3923
  __name(registerCreateSubSessionTool, "registerCreateSubSessionTool");
3883
3924
  var STANDALONE_SLASH_COMMAND_POLICY = Object.freeze({
@@ -3909,11 +3950,9 @@ async function buildAvailableCommandsSnapshot(config, abortSignal = AbortSignal.
3909
3950
  settings,
3910
3951
  executionPolicy
3911
3952
  );
3912
- const disabledSkillNames = config.getDisabledSkillNames();
3913
3953
  const inactiveSkillRefs = inactiveExtensionSkillRefs(config);
3914
3954
  const visibleSlashCommands = slashCommands.filter((cmd) => {
3915
3955
  if (cmd.kind !== "skill" /* SKILL */ || !cmd.skillDetail) return true;
3916
- const skillName = cmd.skillDetail.name.toLowerCase();
3917
3956
  const isInactiveExtensionCommand = cmd.skillDetail.level === "extension" && isInactiveExtensionSkill(
3918
3957
  {
3919
3958
  name: cmd.skillDetail.name,
@@ -3922,7 +3961,7 @@ async function buildAvailableCommandsSnapshot(config, abortSignal = AbortSignal.
3922
3961
  },
3923
3962
  inactiveSkillRefs
3924
3963
  );
3925
- return !disabledSkillNames.has(skillName) && !isInactiveExtensionCommand;
3964
+ return config.isSkillEnabled(cmd.skillDetail) && !isInactiveExtensionCommand;
3926
3965
  });
3927
3966
  const availableCommands = visibleSlashCommands.map(
3928
3967
  (cmd) => {
@@ -3953,7 +3992,7 @@ async function buildAvailableCommandsSnapshot(config, abortSignal = AbortSignal.
3953
3992
  const skillManager = config.getSkillManager();
3954
3993
  if (skillManager) {
3955
3994
  const skills = (await skillManager.listSkills()).filter(
3956
- (skill) => !disabledSkillNames.has(skill.name.toLowerCase()) && !isInactiveExtensionSkill(skill, inactiveSkillRefs)
3995
+ (skill) => config.isSkillEnabled(skill) && !isInactiveExtensionSkill(skill, inactiveSkillRefs)
3957
3996
  );
3958
3997
  availableSkills = skills.map((skill) => skill.name);
3959
3998
  for (const skill of skills) {
@@ -3994,13 +4033,15 @@ async function buildAvailableCommandsSnapshot(config, abortSignal = AbortSignal.
3994
4033
  }
3995
4034
  __name(buildAvailableCommandsSnapshot, "buildAvailableCommandsSnapshot");
3996
4035
  var Session = class {
3997
- constructor(id, config, client, settings, runExclusiveAutomaticHistoryMutation = (operation) => operation(), onActiveWorkChanged) {
4036
+ constructor(id, config, client, settings, runExclusiveAutomaticHistoryMutation = (operation) => operation(), onActiveWorkChanged, workflowHistory = [], isWorkflowRunLiveInSiblingSession = () => false) {
3998
4037
  this.config = config;
3999
4038
  this.client = client;
4000
4039
  this.settings = settings;
4001
4040
  this.runExclusiveAutomaticHistoryMutation = runExclusiveAutomaticHistoryMutation;
4002
4041
  this.onActiveWorkChanged = onActiveWorkChanged;
4042
+ this.isWorkflowRunLiveInSiblingSession = isWorkflowRunLiveInSiblingSession;
4003
4043
  this.sessionId = id;
4044
+ this.workflowHistory = [...workflowHistory];
4004
4045
  this.requiresManagedConversationBinding = isReservedStandaloneSessionSourceType(
4005
4046
  this.config.getSessionSourceType?.()
4006
4047
  );
@@ -4080,6 +4121,14 @@ var Session = class {
4080
4121
  cronDisabledByTokenLimit = false;
4081
4122
  lastPromptTokenCount = 0;
4082
4123
  lastPromptTokenCountChat = null;
4124
+ // Private ACP fallback cache, bounded like LlmChat without exposing a
4125
+ // cross-package route resolver just for this closeout.
4126
+ lastPromptTokenCountsByRouteKey = /* @__PURE__ */ new Map();
4127
+ // The model route that produced `lastPromptTokenCount` (Config
4128
+ // .getModelRouteIdentity). ACP model switches keep the same LlmChat, so
4129
+ // the chat-instance check alone never invalidates the count on a route
4130
+ // change (#9529, follow-up to #9454/#9506).
4131
+ lastPromptTokenCountRouteKey = void 0;
4083
4132
  midTurnDrainUnavailable = false;
4084
4133
  midTurnDrainTimeoutStrikes = 0;
4085
4134
  // ACP can continue one logical conversation through prompt, cron, and
@@ -4108,10 +4157,11 @@ var Session = class {
4108
4157
  notificationAbortController = null;
4109
4158
  notificationCompletion = null;
4110
4159
  currentAgentNotificationTaskId = null;
4160
+ currentWorkflowNotificationTaskId = null;
4111
4161
  currentShellNotificationActive = false;
4112
4162
  persistedBackgroundNotificationTaskIds = /* @__PURE__ */ new Set();
4113
4163
  backgroundNotificationAcceptances = /* @__PURE__ */ new Map();
4114
- activeAgentNotificationAcceptances = /* @__PURE__ */ new Set();
4164
+ activeNotificationAcceptances = /* @__PURE__ */ new Set();
4115
4165
  goalQueue = [];
4116
4166
  goalProcessing = false;
4117
4167
  activeGoalTurn;
@@ -4137,6 +4187,33 @@ var Session = class {
4137
4187
  /** The exact status-change callback this Session installed, so dispose can
4138
4188
  * retract its own and nobody else's. */
4139
4189
  #statusChangeCallback;
4190
+ #workflowStatusChangeCallback;
4191
+ workflowHistory;
4192
+ /**
4193
+ * R7-5: runIds whose snapshot write this session has observed. Latches
4194
+ * `#rememberWorkflowHistory` off so a post-persistence status emission
4195
+ * cannot resurrect a sibling-deleted run. See that method.
4196
+ */
4197
+ persistedWorkflowRunIds = /* @__PURE__ */ new Set();
4198
+ /**
4199
+ * R7-4: every runId the last `refreshWorkflowHistory` merged, BEFORE the
4200
+ * MAX_RETAINED_SNAPSHOTS cap. `workflowHistory` is the display window;
4201
+ * this is what deletion tests membership against.
4202
+ */
4203
+ mergedWorkflowRunIds = /* @__PURE__ */ new Set();
4204
+ unpersistedWorkflowHistory = /* @__PURE__ */ new Map();
4205
+ /**
4206
+ * Deletion order, so a refresh can tell which runs were deleted AFTER
4207
+ * its disk read began. `refreshWorkflowHistory` reads the directory
4208
+ * and then merges without holding a claim, while deletion holds one —
4209
+ * a delete that lands between the read and the merge would otherwise
4210
+ * be overwritten by the stale listing and the run would reappear
4211
+ * until the next refresh. Keyed by runId so a later re-run of the same
4212
+ * id (a retry reuses it) is not suppressed: its sequence predates that
4213
+ * refresh's mark.
4214
+ */
4215
+ workflowDeletionSeq = 0;
4216
+ workflowDeletionSeqByRunId = /* @__PURE__ */ new Map();
4140
4217
  #shellStatusChangeCallback;
4141
4218
  workflowApprovalAbortController = new AbortController();
4142
4219
  activeTodoPlanRevision;
@@ -4211,6 +4288,7 @@ var Session = class {
4211
4288
  controller: new AbortController(),
4212
4289
  origin: "runtime",
4213
4290
  continuationContext: input.continuationContext,
4291
+ ...input.objectiveUpdated ? { objectiveUpdated: input.objectiveUpdated } : {},
4214
4292
  ...input.windDown ? { windDown: true } : {},
4215
4293
  ...input.verifierFeedback ? { verifierFeedback: input.verifierFeedback } : {},
4216
4294
  modelStarted: false
@@ -4413,6 +4491,24 @@ var Session = class {
4413
4491
  void this.#drainGoalQueue();
4414
4492
  }
4415
4493
  }
4494
+ /**
4495
+ * Confirms the continuation's prompt reached the model.
4496
+ *
4497
+ * `startGoalTurn` resolves at enqueue time, so the runtime cannot tell a
4498
+ * delivered turn from a queued one when it settles; `#settleGoalTurn`'s
4499
+ * degraded-persistence fallback settles a model-started turn through
4500
+ * `releaseTurn`, and only this confirmation keeps that turn's objective
4501
+ * announcement from rolling back and re-firing on the next continuation.
4502
+ */
4503
+ #markGoalTurnDelivered(turnKey) {
4504
+ try {
4505
+ this.config.getGoalRuntime().markTurnDelivered(turnKey);
4506
+ } catch (error) {
4507
+ debugLogger6.debug(
4508
+ `Failed to confirm ACP Goal turn delivery: ${error instanceof Error ? error.message : String(error)}`
4509
+ );
4510
+ }
4511
+ }
4416
4512
  async #settleGoalTurn(turn, result, failed) {
4417
4513
  try {
4418
4514
  const runtime = await this.config.getGoalRuntimeReady();
@@ -4777,6 +4873,7 @@ var Session = class {
4777
4873
  const agents = this.config.getBackgroundTaskRegistry?.()?.getAll?.() ?? [];
4778
4874
  const shells = this.config.getBackgroundShellRegistry?.()?.getAll?.() ?? [];
4779
4875
  const monitors = this.config.getMonitorRegistry?.()?.getAll?.() ?? [];
4876
+ const workflows = this.config.getWorkflowRunRegistry?.()?.list?.() ?? [];
4780
4877
  const wakeups = this.config.isCronEnabled?.() ? (this.config.getCronScheduler?.()?.list?.() ?? []).filter(
4781
4878
  (job) => job.cronExpr === "@wakeup"
4782
4879
  ) : [];
@@ -4793,6 +4890,7 @@ var Session = class {
4793
4890
  ...monitors.map((task) => task.id),
4794
4891
  ...this.notificationQueue.filter((item) => item.kind === "monitor").map((item) => item.taskId)
4795
4892
  ]),
4893
+ workflows: new Set(workflows),
4796
4894
  wakeups: /* @__PURE__ */ new Set([
4797
4895
  ...wakeups.map((job) => job.id),
4798
4896
  ...this.cronQueue.flatMap(
@@ -4862,6 +4960,12 @@ var Session = class {
4862
4960
  )) {
4863
4961
  return true;
4864
4962
  }
4963
+ const workflows = this.config.getWorkflowRunRegistry?.()?.list?.() ?? [];
4964
+ if (workflows.some(
4965
+ (task) => !baseline.workflows.has(task) && !isTerminalWorkflowStatus(task.status)
4966
+ )) {
4967
+ return true;
4968
+ }
4865
4969
  if (!this.config.isCronEnabled?.()) return false;
4866
4970
  const wakeups = this.config.getCronScheduler?.()?.list?.() ?? [];
4867
4971
  return wakeups.some(
@@ -5044,11 +5148,11 @@ var Session = class {
5044
5148
  await this.#syncLiveToolDeclarations();
5045
5149
  }
5046
5150
  async #syncLiveToolDeclarations() {
5047
- const geminiClient = this.config.getGeminiClient();
5048
- if (!geminiClient) {
5151
+ const llmClient = this.config.getLlmClient();
5152
+ if (!llmClient) {
5049
5153
  throw new Error("The Live backend model client is unavailable.");
5050
5154
  }
5051
- await geminiClient.setTools();
5155
+ await llmClient.setTools();
5052
5156
  }
5053
5157
  async setLiveConversationActive(active) {
5054
5158
  if (this.liveConversationActive === active) return;
@@ -5065,7 +5169,7 @@ var Session = class {
5065
5169
  this.liveEndInstructionPending = true;
5066
5170
  this.config.setLiveAppendSystemPrompt(LIVE_BACKEND_END_INSTRUCTIONS);
5067
5171
  }
5068
- await this.config.getGeminiClient()?.refreshSystemInstruction();
5172
+ await this.config.getLlmClient()?.refreshSystemInstruction();
5069
5173
  }
5070
5174
  async appendLiveConversationTranscript(entries, model) {
5071
5175
  if (this.liveConversationActive !== true) {
@@ -5103,7 +5207,7 @@ var Session = class {
5103
5207
  if (this.liveConversationActive || !this.liveEndInstructionPending) return;
5104
5208
  this.liveEndInstructionPending = false;
5105
5209
  this.config.setLiveAppendSystemPrompt(void 0);
5106
- await this.config.getGeminiClient()?.refreshSystemInstruction();
5210
+ await this.config.getLlmClient()?.refreshSystemInstruction();
5107
5211
  }
5108
5212
  getId() {
5109
5213
  return this.sessionId;
@@ -5127,6 +5231,131 @@ var Session = class {
5127
5231
  getConfig() {
5128
5232
  return this.config;
5129
5233
  }
5234
+ getWorkflowHistory() {
5235
+ return this.workflowHistory;
5236
+ }
5237
+ async refreshWorkflowHistory() {
5238
+ const deletionMark = this.workflowDeletionSeq;
5239
+ const persisted = await listWorkflowSnapshots(this.config);
5240
+ const byRunId = new Map(
5241
+ persisted.map((snapshot) => [snapshot.runId, snapshot])
5242
+ );
5243
+ for (const [runId, seq] of this.workflowDeletionSeqByRunId) {
5244
+ if (seq > deletionMark) byRunId.delete(runId);
5245
+ }
5246
+ for (const [runId, snapshot] of this.unpersistedWorkflowHistory) {
5247
+ const stored = byRunId.get(runId);
5248
+ if (stored === void 0) {
5249
+ byRunId.set(runId, snapshot);
5250
+ } else {
5251
+ this.unpersistedWorkflowHistory.delete(runId);
5252
+ }
5253
+ }
5254
+ this.mergedWorkflowRunIds = new Set(byRunId.keys());
5255
+ this.workflowHistory = [...byRunId.values()].sort((a, b) => b.startTime - a.startTime).slice(0, MAX_RETAINED_SNAPSHOTS);
5256
+ this.#pruneUnpersistedWorkflowHistory();
5257
+ return this.workflowHistory;
5258
+ }
5259
+ async deleteWorkflowHistory(runId) {
5260
+ const attempt = await tryWithWorkflowTaskMutation(
5261
+ getWorkflowTaskMutationKey(this.config, runId),
5262
+ () => this.#deleteWorkflowHistoryClaimed(runId)
5263
+ );
5264
+ return attempt.acquired ? attempt.value : false;
5265
+ }
5266
+ async #deleteWorkflowHistoryClaimed(runId) {
5267
+ const registry = this.config.getWorkflowRunRegistry();
5268
+ const isDeletable = /* @__PURE__ */ __name(() => {
5269
+ if (this.isWorkflowRunLiveInSiblingSession(runId)) return false;
5270
+ if (registry.isStarting?.(runId)) return false;
5271
+ const current = registry.get(runId);
5272
+ return !current || isTerminalWorkflowStatus(current.status);
5273
+ }, "isDeletable");
5274
+ if (!isDeletable()) return false;
5275
+ const handle = registry.getHandle(runId);
5276
+ if (handle) {
5277
+ await handle.completion;
5278
+ if (!isDeletable()) return false;
5279
+ }
5280
+ await this.refreshWorkflowHistory();
5281
+ if (!isDeletable()) return false;
5282
+ if (!this.mergedWorkflowRunIds.has(runId) && registry.get(runId) === void 0 && !this.unpersistedWorkflowHistory.has(runId)) {
5283
+ return false;
5284
+ }
5285
+ if (registry.get(runId) !== void 0 && !registry.removeTerminal(runId)) {
5286
+ return false;
5287
+ }
5288
+ if (!await deleteWorkflowSnapshot(this.config, runId)) return false;
5289
+ this.workflowDeletionSeqByRunId.set(runId, ++this.workflowDeletionSeq);
5290
+ this.unpersistedWorkflowHistory.delete(runId);
5291
+ this.mergedWorkflowRunIds.delete(runId);
5292
+ this.persistedWorkflowRunIds.delete(runId);
5293
+ this.workflowHistory = this.workflowHistory.filter(
5294
+ (item) => item.runId !== runId
5295
+ );
5296
+ this.#activeWorkChanged();
5297
+ return true;
5298
+ }
5299
+ /**
5300
+ * A sibling session deleted `runId` from the shared store. The
5301
+ * deletion-sequence marker is per-Session — it records deletions THIS
5302
+ * session issued — while the store and the delete entrance are
5303
+ * process-wide, so without this a refresh of ours that began reading
5304
+ * the directory before the sibling's delete landed would merge the
5305
+ * stale listing and republish the run the sibling's client was just
5306
+ * told was gone. Called under the sibling's task-mutation claim,
5307
+ * symmetric to the registry `removeTerminal` sweep.
5308
+ *
5309
+ * The R7-5 persisted latch is deliberately kept: a late terminal
5310
+ * emission for the deleted run must still not re-insert it.
5311
+ */
5312
+ noteExternalWorkflowDeletion(runId) {
5313
+ this.workflowDeletionSeqByRunId.set(runId, ++this.workflowDeletionSeq);
5314
+ this.unpersistedWorkflowHistory.delete(runId);
5315
+ this.mergedWorkflowRunIds.delete(runId);
5316
+ const retained = this.workflowHistory.filter(
5317
+ (item) => item.runId !== runId
5318
+ );
5319
+ if (retained.length === this.workflowHistory.length) return;
5320
+ this.workflowHistory = retained;
5321
+ this.#activeWorkChanged();
5322
+ }
5323
+ #rememberWorkflowHistory(entry) {
5324
+ if (!isTerminalWorkflowStatus(entry.status)) {
5325
+ this.persistedWorkflowRunIds.delete(entry.runId);
5326
+ return;
5327
+ }
5328
+ if (this.persistedWorkflowRunIds.has(entry.runId)) return;
5329
+ const snapshot = toSnapshot(entry);
5330
+ this.unpersistedWorkflowHistory.set(snapshot.runId, snapshot);
5331
+ this.workflowHistory = [
5332
+ snapshot,
5333
+ ...this.workflowHistory.filter((item) => item.runId !== entry.runId)
5334
+ ].sort((a, b) => b.startTime - a.startTime).slice(0, MAX_RETAINED_SNAPSHOTS);
5335
+ this.#pruneUnpersistedWorkflowHistory();
5336
+ }
5337
+ #pruneUnpersistedWorkflowHistory() {
5338
+ const retainedRunIds = new Set(
5339
+ this.workflowHistory.map((item) => item.runId)
5340
+ );
5341
+ for (const runId of this.unpersistedWorkflowHistory.keys()) {
5342
+ if (!retainedRunIds.has(runId)) {
5343
+ this.unpersistedWorkflowHistory.delete(runId);
5344
+ }
5345
+ }
5346
+ }
5347
+ reloadModelProvidersFromDisk() {
5348
+ if (!this.settings.reloadScopesFromDiskAtomically([
5349
+ "User" /* User */,
5350
+ "Workspace" /* Workspace */
5351
+ ])) {
5352
+ throw new Error("Unable to reload model-provider settings from disk.");
5353
+ }
5354
+ this.config.reloadModelProvidersConfig(
5355
+ this.settings.merged.modelProviders,
5356
+ this.settings.merged.providerProtocol ?? {}
5357
+ );
5358
+ }
5130
5359
  installPendingManagedConversationBinding(expectation, assertIdentity) {
5131
5360
  if (!this.requiresManagedConversationBinding || expectation.canonicalSessionId !== this.sessionId) {
5132
5361
  throw managedConversationBindingError();
@@ -5311,14 +5540,19 @@ var Session = class {
5311
5540
  }
5312
5541
  const notificationIds = /* @__PURE__ */ new Set();
5313
5542
  for (const item of this.notificationQueue) {
5314
- if (item.kind === "agent") notificationIds.add(item.taskId);
5543
+ if (item.kind === "agent" || item.kind === "workflow") {
5544
+ notificationIds.add(item.taskId);
5545
+ }
5315
5546
  }
5316
- for (const taskId of this.activeAgentNotificationAcceptances) {
5547
+ for (const taskId of this.activeNotificationAcceptances) {
5317
5548
  notificationIds.add(taskId);
5318
5549
  }
5319
5550
  if (this.currentAgentNotificationTaskId !== null) {
5320
5551
  notificationIds.add(this.currentAgentNotificationTaskId);
5321
5552
  }
5553
+ if (this.currentWorkflowNotificationTaskId !== null) {
5554
+ notificationIds.add(this.currentWorkflowNotificationTaskId);
5555
+ }
5322
5556
  for (const taskId of notificationIds) {
5323
5557
  holds.push({ category: "notification", id: taskId });
5324
5558
  }
@@ -5326,6 +5560,15 @@ var Session = class {
5326
5560
  if (shellActive) {
5327
5561
  holds.push({ category: "shell", id: "background-shells" });
5328
5562
  }
5563
+ const workflowRegistry = this.config.getWorkflowRunRegistry();
5564
+ for (const runId of workflowRegistry.listStartingRunIds?.() ?? []) {
5565
+ holds.push({ category: "workflow", id: runId });
5566
+ }
5567
+ for (const task of workflowRegistry.list()) {
5568
+ if (task.status === "running" || task.status === "pausing") {
5569
+ holds.push({ category: "workflow", id: task.runId });
5570
+ }
5571
+ }
5329
5572
  return holds;
5330
5573
  }
5331
5574
  hasStandaloneRelocationBlockers() {
@@ -5482,6 +5725,13 @@ var Session = class {
5482
5725
  shellRegistry.clearStatusChangeCallback(this.#shellStatusChangeCallback);
5483
5726
  this.#shellStatusChangeCallback = void 0;
5484
5727
  }
5728
+ this.config.getWorkflowRunRegistry().abortAll();
5729
+ this.config.getWorkflowRunRegistry().setCompletionCallback(void 0);
5730
+ this.config.getWorkflowRunRegistry().setSnapshotPersistedCallback(void 0);
5731
+ if (this.#workflowStatusChangeCallback) {
5732
+ this.config.getWorkflowRunRegistry().clearStatusChangeCallback(this.#workflowStatusChangeCallback);
5733
+ this.#workflowStatusChangeCallback = void 0;
5734
+ }
5485
5735
  this.config.getChatRecordingService()?.setTitleRecordedCallback(void 0);
5486
5736
  this.unsubscribeChatRecordingFailure?.();
5487
5737
  this.unsubscribeChatRecordingFailure = void 0;
@@ -5555,7 +5805,7 @@ var Session = class {
5555
5805
  "Cannot rewind while a prompt is running"
5556
5806
  );
5557
5807
  }
5558
- const chat = this.config.getGeminiClient().getChat();
5808
+ const chat = this.config.getLlmClient().getChat();
5559
5809
  const apiHistory = chat.getHistoryShallow();
5560
5810
  const apiTruncateIndex = this.#computeApiTruncationIndexForUserTurn(
5561
5811
  apiHistory,
@@ -5591,7 +5841,7 @@ var Session = class {
5591
5841
  return { targetTurnIndex, apiTruncateIndex };
5592
5842
  }
5593
5843
  captureHistorySnapshot() {
5594
- return this.config.getGeminiClient().getChat().getHistoryShallow();
5844
+ return this.config.getLlmClient().getChat().getHistoryShallow();
5595
5845
  }
5596
5846
  getRewindableUserTurnCount() {
5597
5847
  const apiHistory = this.captureHistorySnapshot();
@@ -5613,7 +5863,7 @@ var Session = class {
5613
5863
  "Cannot restore history while a prompt is running"
5614
5864
  );
5615
5865
  }
5616
- this.config.getGeminiClient().getChat().setHistory(structuredClone(history));
5866
+ this.config.getLlmClient().getChat().setHistory(structuredClone(history));
5617
5867
  this.activeTodoPlanRevision = void 0;
5618
5868
  this.#clearTodoStopGuardTrustAndDrainAutomaticQueues();
5619
5869
  }
@@ -6040,8 +6290,8 @@ var Session = class {
6040
6290
  * authoritatively. Powers `qwen/control/session/continue`.
6041
6291
  */
6042
6292
  async continueLastTurn() {
6043
- const geminiClient = this.config.getGeminiClient();
6044
- if (!geminiClient || !geminiClient.isInitialized()) {
6293
+ const llmClient = this.config.getLlmClient();
6294
+ if (!llmClient || !llmClient.isInitialized()) {
6045
6295
  return { accepted: false, interruption: "none" };
6046
6296
  }
6047
6297
  const chat = this.#getCurrentChat();
@@ -6090,7 +6340,7 @@ var Session = class {
6090
6340
  }
6091
6341
  if (this.settings.merged.ui?.enableFollowupSuggestions === false) return;
6092
6342
  if (this.config.getApprovalMode() === "plan" /* PLAN */) return;
6093
- const chat = this.config.getGeminiClient()?.getChat();
6343
+ const chat = this.config.getLlmClient()?.getChat();
6094
6344
  if (!chat) return;
6095
6345
  const ac = new AbortController();
6096
6346
  this.followupAbort = ac;
@@ -6421,7 +6671,7 @@ var Session = class {
6421
6671
  }
6422
6672
  if (isFreshUserTurn) {
6423
6673
  managedMemoryRecallStarted = true;
6424
- this.config.getGeminiClient().beginManagedAutoMemoryRecall(promptText, pendingSend.signal);
6674
+ this.config.getLlmClient().beginManagedAutoMemoryRecall(promptText, pendingSend.signal);
6425
6675
  }
6426
6676
  if (!continuesCurrentWorkChain && !this.todoStopGuard.enabled) {
6427
6677
  this.#resetTodoStopGuardBackgroundLineage();
@@ -6449,7 +6699,7 @@ var Session = class {
6449
6699
  }
6450
6700
  const systemReminders = await this.#buildInitialSystemReminders();
6451
6701
  if (isFreshUserTurn) {
6452
- const memory = await this.config.getGeminiClient().consumeManagedAutoMemoryRecall("initial");
6702
+ const memory = await this.config.getLlmClient().consumeManagedAutoMemoryRecall("initial");
6453
6703
  if (memory?.prompt) {
6454
6704
  systemReminders.unshift({ text: memory.prompt });
6455
6705
  }
@@ -6629,8 +6879,14 @@ ${this.pendingRecoveredAgentsNotice}
6629
6879
  );
6630
6880
  let channelDeliveryResponseBlock;
6631
6881
  let channelDeliveryCheckpoint = 0;
6882
+ let requestRouteKey = "";
6632
6883
  try {
6633
- if (goalTurn) goalTurn.modelStarted = true;
6884
+ if (goalTurn) {
6885
+ goalTurn.modelStarted = true;
6886
+ if (goalTurn.origin === "runtime") {
6887
+ this.#markGoalTurnDelivered(goalTurn.turnKey);
6888
+ }
6889
+ }
6634
6890
  const sendResult = await this.#sendMessageStreamWithAutoCompression(
6635
6891
  promptId,
6636
6892
  nextMessage?.parts ?? [],
@@ -6652,6 +6908,7 @@ ${this.pendingRecoveredAgentsNotice}
6652
6908
  if (restorePostAnswerNoticesAttached) {
6653
6909
  this.#clearPendingRestoreNotices();
6654
6910
  }
6911
+ requestRouteKey = sendResult.requestRouteKey;
6655
6912
  const responseStream = sendResult.responseStream;
6656
6913
  nextMessage = null;
6657
6914
  channelDeliveryResponseBlock = beginChannelDeliveryResponseBlock(responseCapture);
@@ -6714,6 +6971,12 @@ ${this.pendingRecoveredAgentsNotice}
6714
6971
  );
6715
6972
  functionCalls.length = 0;
6716
6973
  }
6974
+ if (resp.type === "compressed" /* COMPRESSED */) {
6975
+ this.#recordCompressionTokenCount(
6976
+ resp.info,
6977
+ requestRouteKey
6978
+ );
6979
+ }
6717
6980
  }
6718
6981
  } catch (error) {
6719
6982
  streamFailed = true;
@@ -6767,7 +7030,7 @@ ${this.pendingRecoveredAgentsNotice}
6767
7030
  functionCalls.length > 0
6768
7031
  );
6769
7032
  if (usageMetadata) {
6770
- this.#recordPromptTokenCount(usageMetadata);
7033
+ this.#recordPromptTokenCount(usageMetadata, requestRouteKey);
6771
7034
  if (this.messageRewriter) {
6772
7035
  this.messageRewriter.flushTurn(pendingSend.signal);
6773
7036
  }
@@ -6897,7 +7160,7 @@ ${this.pendingRecoveredAgentsNotice}
6897
7160
  }
6898
7161
  ).finally(() => {
6899
7162
  if (managedMemoryRecallStarted) {
6900
- this.config.getGeminiClient().finishManagedAutoMemoryRecall();
7163
+ this.config.getLlmClient().finishManagedAutoMemoryRecall();
6901
7164
  }
6902
7165
  });
6903
7166
  }
@@ -7217,6 +7480,7 @@ ${this.pendingRecoveredAgentsNotice}
7217
7480
  let channelDeliveryCheckpoint = 0;
7218
7481
  let providerSendChat;
7219
7482
  let userContentPushCountBeforeSend = 0;
7483
+ let requestRouteKey = "";
7220
7484
  try {
7221
7485
  const sendResult = await this.#sendMessageStreamWithAutoCompression(
7222
7486
  promptIdForSend,
@@ -7442,6 +7706,7 @@ ${this.pendingRecoveredAgentsNotice}
7442
7706
  ...supersededAutomaticContinuation ? { supersededAutomaticContinuation: true } : {}
7443
7707
  };
7444
7708
  }
7709
+ requestRouteKey = sendResult.requestRouteKey;
7445
7710
  const responseStream = sendResult.responseStream;
7446
7711
  nextMessage = null;
7447
7712
  channelDeliveryResponseBlock = beginChannelDeliveryResponseBlock(
@@ -7518,6 +7783,9 @@ ${this.pendingRecoveredAgentsNotice}
7518
7783
  );
7519
7784
  functionCalls.length = 0;
7520
7785
  }
7786
+ if (response.type === "compressed" /* COMPRESSED */) {
7787
+ this.#recordCompressionTokenCount(response.info, requestRouteKey);
7788
+ }
7521
7789
  }
7522
7790
  } catch (error) {
7523
7791
  streamFailed = true;
@@ -7573,7 +7841,7 @@ ${this.pendingRecoveredAgentsNotice}
7573
7841
  functionCalls.length > 0
7574
7842
  );
7575
7843
  if (usageMetadata) {
7576
- this.#recordPromptTokenCount(usageMetadata);
7844
+ this.#recordPromptTokenCount(usageMetadata, requestRouteKey);
7577
7845
  const durationMs = Date.now() - streamStartTime;
7578
7846
  await this.messageEmitter.emitUsageMetadata(
7579
7847
  usageMetadata,
@@ -7792,7 +8060,7 @@ ${this.pendingRecoveredAgentsNotice}
7792
8060
  }
7793
8061
  }
7794
8062
  #getCurrentChat() {
7795
- return this.config.getGeminiClient().getChat();
8063
+ return this.config.getLlmClient().getChat();
7796
8064
  }
7797
8065
  async #runWithFullTurnModel(modelOverride, fn) {
7798
8066
  if (!modelOverride?.endsWith("\0")) {
@@ -7804,9 +8072,9 @@ ${this.pendingRecoveredAgentsNotice}
7804
8072
  /**
7805
8073
  * Create the MessageDisplay hook dispatcher for one model call's streamed
7806
8074
  * reply, or null when the hook isn't registered (the common case — keeps
7807
- * the streaming loops zero-cost). The ACP surface consumes GeminiChat's
8075
+ * the streaming loops zero-cost). The ACP surface consumes LlmChat's
7808
8076
  * raw stream directly rather than going through
7809
- * GeminiClient.sendMessageStream, so it has to fire this hook itself —
8077
+ * LlmClient.sendMessageStream, so it has to fire this hook itself —
7810
8078
  * with the same contract as the terminal UI path in client.ts: debounced
7811
8079
  * cumulative text, one message_id per model call, and an is_final firing
7812
8080
  * on every non-aborted exit (delivered by awaiting `finish()` in a
@@ -7832,7 +8100,7 @@ ${this.pendingRecoveredAgentsNotice}
7832
8100
  * was cancelled or the session token limit was exceeded.
7833
8101
  */
7834
8102
  async #sendMessageStreamWithAutoCompression(promptId, message, abortSignal, options = {}) {
7835
- const geminiClient = this.config.getGeminiClient();
8103
+ const llmClient = this.config.getLlmClient();
7836
8104
  if (options.prepareBeforeCompression) {
7837
8105
  const decision = await options.prepareBeforeCompression();
7838
8106
  if (decision.kind === "stop") {
@@ -7851,13 +8119,12 @@ ${this.pendingRecoveredAgentsNotice}
7851
8119
  let compressionFailed = false;
7852
8120
  if (!options.skipCompression && !(options.getModelOverride?.() ?? options.modelOverride)) {
7853
8121
  try {
7854
- const compressed = await geminiClient.tryCompressChat(
8122
+ const compressed = await llmClient.tryCompressChat(
7855
8123
  promptId,
7856
8124
  false,
7857
8125
  abortSignal
7858
8126
  );
7859
8127
  compressionInfo = compressed;
7860
- this.#recordCompressionTokenCount(compressed);
7861
8128
  compressionFailed = isCompressionFailureStatus(
7862
8129
  compressed.compressionStatus
7863
8130
  );
@@ -7887,15 +8154,28 @@ ${this.pendingRecoveredAgentsNotice}
7887
8154
  debugLogger6.debug(`Auto-compression aborted for prompt ${promptId}`);
7888
8155
  return { responseStream: null, stopReason: "cancelled" };
7889
8156
  }
7890
- if (!compressionInfo) {
7891
- this.#syncPromptTokenCountWithCurrentChat();
8157
+ const model = options.getModelOverride?.() ?? options.modelOverride ?? this.config.getModel();
8158
+ const requestRouteKey = await this.#requestRouteKeyForModel(model);
8159
+ if (abortSignal.aborted) {
8160
+ debugLogger6.debug(
8161
+ `Send aborted after request route key resolution for prompt ${promptId}`
8162
+ );
8163
+ return { responseStream: null, stopReason: "cancelled" };
8164
+ }
8165
+ if (compressionInfo) {
8166
+ this.#recordCompressionTokenCount(compressionInfo, requestRouteKey);
8167
+ } else {
8168
+ this.#syncPromptTokenCountWithCurrentChat(requestRouteKey);
7892
8169
  }
7893
8170
  const sessionTokenLimit = this.config.getSessionTokenLimit();
7894
8171
  if (sessionTokenLimit > 0) {
7895
- const lastPromptTokenCount = this.#getPostCompressionTokenCount(compressionInfo);
8172
+ const lastPromptTokenCount = this.#getPostCompressionTokenCount(
8173
+ compressionInfo,
8174
+ requestRouteKey
8175
+ );
7896
8176
  if (lastPromptTokenCount > sessionTokenLimit) {
7897
8177
  debugLogger6.warn(
7898
- `Session token limit exceeded for prompt ${promptId}: ${lastPromptTokenCount} > ${sessionTokenLimit}. Send dropped.`
8178
+ `Session token limit exceeded for prompt ${promptId}: ${lastPromptTokenCount} > ${sessionTokenLimit}. requestRoute=${requestRouteKey}, activeModel=${this.config.getModel()}. Send dropped.`
7899
8179
  );
7900
8180
  await this.#emitAgentDiagnosticMessageSafely(
7901
8181
  `Session token limit exceeded: ${lastPromptTokenCount} tokens > ${sessionTokenLimit} limit. Please start a new session or increase the sessionTokenLimit in your settings.json.`,
@@ -7930,7 +8210,7 @@ ${this.pendingRecoveredAgentsNotice}
7930
8210
  return { responseStream: null, stopReason: "cancelled" };
7931
8211
  }
7932
8212
  if (message[0]?.functionResponse) {
7933
- const memory = await geminiClient.consumeManagedAutoMemoryRecall("tool_result");
8213
+ const memory = await llmClient.consumeManagedAutoMemoryRecall("tool_result");
7934
8214
  if (memory?.prompt) {
7935
8215
  message = insertAfterFunctionResponses(message, [
7936
8216
  { text: memory.prompt }
@@ -7938,7 +8218,6 @@ ${this.pendingRecoveredAgentsNotice}
7938
8218
  }
7939
8219
  }
7940
8220
  const chat = this.#getCurrentChat();
7941
- const model = options.getModelOverride?.() ?? options.modelOverride ?? this.config.getModel();
7942
8221
  const request = {
7943
8222
  message,
7944
8223
  config: {
@@ -7947,7 +8226,7 @@ ${this.pendingRecoveredAgentsNotice}
7947
8226
  };
7948
8227
  const goalPermit = goalTurnContext.getStore();
7949
8228
  const responseStream = goalPermit ? await chat.sendMessageStream(model, request, promptId, goalPermit) : await chat.sendMessageStream(model, request, promptId);
7950
- return { responseStream };
8229
+ return { responseStream, requestRouteKey };
7951
8230
  }
7952
8231
  #clearPendingRestoreNotices() {
7953
8232
  this.pendingWorktreeNotice = null;
@@ -8105,25 +8384,58 @@ ${this.pendingRecoveredAgentsNotice}
8105
8384
  hadMidTurnUserInput
8106
8385
  };
8107
8386
  }
8108
- #recordCompressionTokenCount(info) {
8109
- this.#syncPromptTokenCountWithCurrentChat();
8387
+ #recordCompressionTokenCount(info, requestRouteKey) {
8388
+ if (info.compressionStatus === 1 /* COMPRESSED */) {
8389
+ this.#invalidateRouteTokenCountsForCompression(info, requestRouteKey);
8390
+ return;
8391
+ }
8392
+ this.#syncPromptTokenCountWithCurrentChat(requestRouteKey);
8393
+ const tokenCount = this.#extractCompressionTokenCount(info);
8394
+ if (tokenCount !== null && tokenCount > 0) {
8395
+ this.#setLastPromptTokenCount(requestRouteKey, tokenCount);
8396
+ }
8397
+ }
8398
+ /**
8399
+ * Compression rewrote the shared history, so EVERY retained route-keyed
8400
+ * count is stale — not just the request route's. Drop them all and
8401
+ * re-record the fresh post-compression count under the request route,
8402
+ * retaining it under the active route too when the two differ (the
8403
+ * compressed history is shared, so the count anchors both routes' next
8404
+ * gate reads). Mirrors LlmChat clearing its keyed counts in the
8405
+ * COMPRESSED branch of tryCompress; without this, in-send compressions
8406
+ * (LlmChat.sendMessageStream's hard-tier rescue and reactive-overflow
8407
+ * paths, surfaced as StreamEventType.COMPRESSED) would leave this cache
8408
+ * holding pre-compression sizes and the gate would drop a returning
8409
+ * route's send that fits the compressed history (#9529).
8410
+ */
8411
+ #invalidateRouteTokenCountsForCompression(info, requestRouteKey) {
8412
+ this.lastPromptTokenCountsByRouteKey.clear();
8110
8413
  const tokenCount = this.#extractCompressionTokenCount(info);
8111
8414
  if (tokenCount !== null && tokenCount > 0) {
8112
- this.lastPromptTokenCount = tokenCount;
8415
+ this.#setLastPromptTokenCount(requestRouteKey, tokenCount);
8416
+ const activeRouteKey = this.#currentRouteKey();
8417
+ if (activeRouteKey !== requestRouteKey) {
8418
+ this.lastPromptTokenCountsByRouteKey.set(activeRouteKey, tokenCount);
8419
+ }
8420
+ } else {
8421
+ this.lastPromptTokenCount = 0;
8422
+ this.lastPromptTokenCountRouteKey = requestRouteKey;
8113
8423
  }
8424
+ this.lastPromptTokenCountChat = this.#getCurrentChat();
8114
8425
  }
8115
- #recordPromptTokenCount(usageMetadata) {
8116
- this.#syncPromptTokenCountWithCurrentChat();
8426
+ #recordPromptTokenCount(usageMetadata, routeKey = this.#currentRouteKey()) {
8427
+ this.#syncPromptTokenCountWithCurrentChat(routeKey);
8117
8428
  const tokenCount = usageMetadata.promptTokenCount ?? usageMetadata.totalTokenCount;
8118
8429
  if (tokenCount !== void 0 && tokenCount > 0) {
8119
- this.lastPromptTokenCount = tokenCount;
8430
+ this.#setLastPromptTokenCount(routeKey, tokenCount);
8120
8431
  }
8121
8432
  }
8122
- #getPostCompressionTokenCount(info) {
8433
+ #getPostCompressionTokenCount(info, routeKey = this.#currentRouteKey()) {
8123
8434
  const tokenCount = this.#extractCompressionTokenCount(info);
8124
8435
  if (tokenCount !== null) {
8125
8436
  return tokenCount;
8126
8437
  }
8438
+ this.#syncPromptTokenCountWithCurrentChat(routeKey);
8127
8439
  return this.lastPromptTokenCount;
8128
8440
  }
8129
8441
  #extractCompressionTokenCount(info) {
@@ -8139,12 +8451,50 @@ ${this.pendingRecoveredAgentsNotice}
8139
8451
  }
8140
8452
  return tokenCount;
8141
8453
  }
8142
- #syncPromptTokenCountWithCurrentChat() {
8454
+ #currentRouteKey() {
8455
+ return this.config.getModelRouteIdentity?.() ?? "";
8456
+ }
8457
+ async #requestRouteKeyForModel(model) {
8458
+ if (!this.config.getModelRouteIdentity) {
8459
+ return "";
8460
+ }
8461
+ if (!model.endsWith("\0")) {
8462
+ return this.config.getModelRouteIdentity(model);
8463
+ }
8464
+ const runtimeView = await this.config.getBaseLlmClient().resolveForModel(model.slice(0, -1), { failClosed: true });
8465
+ return this.config.getModelRouteIdentity(
8466
+ runtimeView.model,
8467
+ runtimeView.contentGeneratorConfig
8468
+ );
8469
+ }
8470
+ #setLastPromptTokenCount(routeKey, tokenCount) {
8471
+ this.lastPromptTokenCount = tokenCount;
8472
+ this.lastPromptTokenCountRouteKey = routeKey;
8473
+ if (!this.lastPromptTokenCountsByRouteKey.has(routeKey) && this.lastPromptTokenCountsByRouteKey.size >= MAX_RETAINED_SESSION_ROUTE_COUNTS) {
8474
+ const oldestKey = this.lastPromptTokenCountsByRouteKey.keys().next().value;
8475
+ if (oldestKey !== void 0) {
8476
+ this.lastPromptTokenCountsByRouteKey.delete(oldestKey);
8477
+ }
8478
+ }
8479
+ this.lastPromptTokenCountsByRouteKey.set(routeKey, tokenCount);
8480
+ }
8481
+ #syncPromptTokenCountWithCurrentChat(routeKey = this.#currentRouteKey()) {
8143
8482
  const chat = this.#getCurrentChat();
8144
- if (this.lastPromptTokenCountChat && this.lastPromptTokenCountChat !== chat) {
8483
+ const chatChanged = this.lastPromptTokenCountChat && this.lastPromptTokenCountChat !== chat;
8484
+ if (chatChanged) {
8485
+ this.lastPromptTokenCountsByRouteKey.clear();
8145
8486
  this.lastPromptTokenCount = 0;
8487
+ } else if (this.lastPromptTokenCountRouteKey !== routeKey) {
8488
+ if (this.lastPromptTokenCountRouteKey !== void 0 && this.lastPromptTokenCount > 0) {
8489
+ this.lastPromptTokenCountsByRouteKey.set(
8490
+ this.lastPromptTokenCountRouteKey,
8491
+ this.lastPromptTokenCount
8492
+ );
8493
+ }
8494
+ this.lastPromptTokenCount = this.lastPromptTokenCountsByRouteKey.get(routeKey) ?? 0;
8146
8495
  }
8147
8496
  this.lastPromptTokenCountChat = chat;
8497
+ this.lastPromptTokenCountRouteKey = routeKey;
8148
8498
  }
8149
8499
  #isAbortError(error) {
8150
8500
  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";
@@ -8390,6 +8740,10 @@ ${this.pendingRecoveredAgentsNotice}
8390
8740
  scheduler.start((job) => {
8391
8741
  if (this.cronDisabledByTokenLimit) return;
8392
8742
  if (job.missed && detectAutonomousSentinel(job.prompt)) return;
8743
+ if (!job.missed && job.sessionMode === "per_run" && job.cronExpr !== "@wakeup" && !job.delivery && !detectAutonomousSentinel(job.prompt)) {
8744
+ void this.#dispatchCronToFreshSession(job);
8745
+ return;
8746
+ }
8393
8747
  this.#enqueueCronPrompt({
8394
8748
  prompt: job.prompt,
8395
8749
  source: job.cronExpr === "@wakeup" ? "loop" : "cron",
@@ -8401,6 +8755,77 @@ ${this.pendingRecoveredAgentsNotice}
8401
8755
  void this.#drainCronQueue();
8402
8756
  });
8403
8757
  }
8758
+ /**
8759
+ * Runs a per-run scheduled fire in a fresh child session created through the
8760
+ * daemon. The scheduler has already booked the run; this attributes it to the
8761
+ * child that accepted it. If the daemon cannot create the child, the fire
8762
+ * falls back to this (persistent) session so it is not lost — a consumed
8763
+ * one-shot has no scheduled retry — and the run record keeps the failure
8764
+ * marker alongside the session it actually ran in.
8765
+ */
8766
+ async #dispatchCronToFreshSession(job) {
8767
+ const scheduler = this.config.getCronScheduler();
8768
+ const taskId = job.id ?? "unknown";
8769
+ const firedAt = job.lastFiredAt;
8770
+ const triggeredAt = firedAt ?? Date.now();
8771
+ const record = /* @__PURE__ */ __name(async (outcome) => {
8772
+ if (!job.id || firedAt === void 0) return;
8773
+ await scheduler.annotateRunSession(job.id, firedAt, outcome).catch((error) => {
8774
+ debugLogger6.warn(
8775
+ `Scheduled task ${taskId} could not record its run session: ${error instanceof Error ? error.message : String(error)}`
8776
+ );
8777
+ });
8778
+ }, "record");
8779
+ let sessionId;
8780
+ try {
8781
+ const response = await this.client.extMethod(
8782
+ SERVE_CONTROL_EXT_METHODS.createSubSession,
8783
+ {
8784
+ prompt: buildScheduledTaskRunPrompt({
8785
+ id: taskId,
8786
+ name: job.name,
8787
+ cron: job.cronExpr ?? "",
8788
+ prompt: job.prompt,
8789
+ triggeredAt,
8790
+ trigger: "scheduled"
8791
+ }),
8792
+ completion: "sent",
8793
+ // Title the child from the task and its trigger time — never from
8794
+ // the built prompt, whose first line is the execution-context
8795
+ // header. Same shape the manual-run route gives its children.
8796
+ name: scheduledTaskRunSessionName(
8797
+ job.name ?? job.prompt,
8798
+ triggeredAt
8799
+ ),
8800
+ ...job.id ? {
8801
+ sourceType: SCHEDULED_TASK_RUN_SOURCE_TYPE,
8802
+ sourceId: scheduledTaskRunSourceId(job.id)
8803
+ } : {},
8804
+ callerSessionId: this.sessionId
8805
+ }
8806
+ );
8807
+ const responseSessionId = response["sessionId"];
8808
+ if (typeof responseSessionId !== "string" || responseSessionId.length === 0) {
8809
+ throw new Error("bridge returned a missing session id");
8810
+ }
8811
+ sessionId = responseSessionId;
8812
+ } catch (error) {
8813
+ debugLogger6.warn(
8814
+ `Scheduled task ${taskId} could not create a fresh session, running it in the task session instead: ${error instanceof Error ? error.message : String(error)}`
8815
+ );
8816
+ await record({ sessionId: this.sessionId, dispatchFailed: true });
8817
+ this.#enqueueCronPrompt({
8818
+ prompt: job.prompt,
8819
+ source: "cron",
8820
+ ...job.id ? { taskId: job.id } : {},
8821
+ ...job.lastFiredAt !== void 0 ? { firedAt: job.lastFiredAt } : {}
8822
+ });
8823
+ void this.#drainCronQueue();
8824
+ return;
8825
+ }
8826
+ this.relatedAgentIds.add(sessionId);
8827
+ await record({ sessionId });
8828
+ }
8404
8829
  #startCronSchedulerInRuntime() {
8405
8830
  return Storage.runWithRuntimeBaseDir(
8406
8831
  this.runtimeBaseDir,
@@ -8549,11 +8974,13 @@ ${this.pendingRecoveredAgentsNotice}
8549
8974
  * `_meta.source='cron'`, streams the model response, and handles tool calls.
8550
8975
  */
8551
8976
  async #executeCronPrompt(item) {
8552
- return runWithInvocationContext(
8553
- void 0,
8554
- () => sessionIdContext.run(
8555
- this.config.getSessionId(),
8556
- () => this.#executeCronPromptInner(item)
8977
+ return goalTurnContext.exit(
8978
+ () => runWithInvocationContext(
8979
+ void 0,
8980
+ () => sessionIdContext.run(
8981
+ this.config.getSessionId(),
8982
+ () => this.#executeCronPromptInner(item)
8983
+ )
8557
8984
  )
8558
8985
  );
8559
8986
  }
@@ -8686,6 +9113,7 @@ ${this.pendingRecoveredAgentsNotice}
8686
9113
  return;
8687
9114
  }
8688
9115
  const responseStream = sendResult.responseStream;
9116
+ const requestRouteKey = sendResult.requestRouteKey;
8689
9117
  const channelDeliveryResponseBlock = beginChannelDeliveryResponseBlock(responseCapture);
8690
9118
  const channelDeliveryCheckpoint = channelDeliveryResponseBlock?.parts.length ?? 0;
8691
9119
  if (loopTick && turnCount === 1) {
@@ -8751,6 +9179,12 @@ ${this.pendingRecoveredAgentsNotice}
8751
9179
  );
8752
9180
  functionCalls.length = 0;
8753
9181
  }
9182
+ if (resp.type === "compressed" /* COMPRESSED */) {
9183
+ this.#recordCompressionTokenCount(
9184
+ resp.info,
9185
+ requestRouteKey
9186
+ );
9187
+ }
8754
9188
  }
8755
9189
  } catch (error) {
8756
9190
  streamFailed = true;
@@ -8772,7 +9206,7 @@ ${this.pendingRecoveredAgentsNotice}
8772
9206
  functionCalls.length > 0
8773
9207
  );
8774
9208
  if (usageMetadata) {
8775
- this.#recordPromptTokenCount(usageMetadata);
9209
+ this.#recordPromptTokenCount(usageMetadata, requestRouteKey);
8776
9210
  if (this.messageRewriter) {
8777
9211
  this.messageRewriter.flushTurn(ac.signal);
8778
9212
  }
@@ -8955,6 +9389,30 @@ ${this.pendingRecoveredAgentsNotice}
8955
9389
  structured: entry ? { commandLabel: truncateNotificationLabel(entry.description) } : void 0
8956
9390
  });
8957
9391
  });
9392
+ const workflowRegistry = this.config.getWorkflowRunRegistry();
9393
+ this.#workflowStatusChangeCallback = (entry) => {
9394
+ this.#activeWorkChanged();
9395
+ if (entry) this.#rememberWorkflowHistory(entry);
9396
+ };
9397
+ workflowRegistry.setStatusChangeCallback(
9398
+ this.#workflowStatusChangeCallback
9399
+ );
9400
+ workflowRegistry.setSnapshotPersistedCallback((runId) => {
9401
+ this.persistedWorkflowRunIds.add(runId);
9402
+ this.unpersistedWorkflowHistory.delete(runId);
9403
+ });
9404
+ workflowRegistry.setCompletionCallback((displayText, modelText, meta) => {
9405
+ const entry = workflowRegistry.get(meta.runId);
9406
+ this.#enqueueBackgroundNotification({
9407
+ displayText,
9408
+ modelText,
9409
+ taskId: meta.runId,
9410
+ status: meta.status,
9411
+ kind: "workflow",
9412
+ continuesTodoStopGuardWorkChain: !entry || !this.todoStopGuardBackgroundBaseline.workflows.has(entry),
9413
+ todoWorkChainId: meta.todoWorkChainId
9414
+ });
9415
+ });
8958
9416
  this.config.getChatRecordingService()?.setTitleRecordedCallback((customTitle, titleSource, sessionId) => {
8959
9417
  void this.client.extNotification("qwen/notify/session/title-update", {
8960
9418
  v: 1,
@@ -9015,8 +9473,8 @@ ${this.pendingRecoveredAgentsNotice}
9015
9473
  if (existing) return { accepted: await existing };
9016
9474
  const acceptance = this.#persistDaemonBackgroundNotification(item);
9017
9475
  this.backgroundNotificationAcceptances.set(item.taskId, acceptance);
9018
- if (item.kind === "agent") {
9019
- this.activeAgentNotificationAcceptances.add(item.taskId);
9476
+ if (item.kind === "agent" || item.kind === "workflow") {
9477
+ this.activeNotificationAcceptances.add(item.taskId);
9020
9478
  this.#activeWorkChanged();
9021
9479
  }
9022
9480
  try {
@@ -9024,8 +9482,8 @@ ${this.pendingRecoveredAgentsNotice}
9024
9482
  } finally {
9025
9483
  if (this.backgroundNotificationAcceptances.get(item.taskId) === acceptance) {
9026
9484
  this.backgroundNotificationAcceptances.delete(item.taskId);
9027
- if (item.kind === "agent") {
9028
- this.activeAgentNotificationAcceptances.delete(item.taskId);
9485
+ if (item.kind === "agent" || item.kind === "workflow") {
9486
+ this.activeNotificationAcceptances.delete(item.taskId);
9029
9487
  this.#activeWorkChanged();
9030
9488
  }
9031
9489
  }
@@ -9114,18 +9572,22 @@ ${this.pendingRecoveredAgentsNotice}
9114
9572
  const [item] = this.notificationQueue.splice(nextIndex, 1);
9115
9573
  if (!item) break;
9116
9574
  this.currentAgentNotificationTaskId = item.kind === "agent" ? item.taskId : null;
9575
+ this.currentWorkflowNotificationTaskId = item.kind === "workflow" ? item.taskId : null;
9117
9576
  this.currentShellNotificationActive = item.kind === "shell";
9118
9577
  this.#activeWorkChanged();
9119
9578
  try {
9120
- await runWithInvocationContext(
9121
- void 0,
9122
- () => sessionIdContext.run(
9123
- this.config.getSessionId(),
9124
- () => this.#executeBackgroundNotificationPromptInner(item)
9579
+ await goalTurnContext.exit(
9580
+ () => runWithInvocationContext(
9581
+ void 0,
9582
+ () => sessionIdContext.run(
9583
+ this.config.getSessionId(),
9584
+ () => this.#executeBackgroundNotificationPromptInner(item)
9585
+ )
9125
9586
  )
9126
9587
  );
9127
9588
  } finally {
9128
9589
  this.currentAgentNotificationTaskId = null;
9590
+ this.currentWorkflowNotificationTaskId = null;
9129
9591
  this.currentShellNotificationActive = false;
9130
9592
  this.#activeWorkChanged();
9131
9593
  }
@@ -9222,6 +9684,7 @@ ${this.pendingRecoveredAgentsNotice}
9222
9684
  return;
9223
9685
  }
9224
9686
  const responseStream = sendResult.responseStream;
9687
+ const requestRouteKey = sendResult.requestRouteKey;
9225
9688
  nextMessage = null;
9226
9689
  const messageDisplay = this.#createMessageDisplayDispatcher(
9227
9690
  ac.signal
@@ -9268,6 +9731,9 @@ ${this.pendingRecoveredAgentsNotice}
9268
9731
  );
9269
9732
  functionCalls.length = 0;
9270
9733
  }
9734
+ if (resp.type === "compressed" /* COMPRESSED */) {
9735
+ this.#recordCompressionTokenCount(resp.info, requestRouteKey);
9736
+ }
9271
9737
  }
9272
9738
  } catch (error) {
9273
9739
  streamFailed = true;
@@ -9294,7 +9760,7 @@ ${this.pendingRecoveredAgentsNotice}
9294
9760
  await this.messageRewriter.flushTurn(ac.signal);
9295
9761
  }
9296
9762
  if (usageMetadata) {
9297
- this.#recordPromptTokenCount(usageMetadata);
9763
+ this.#recordPromptTokenCount(usageMetadata, requestRouteKey);
9298
9764
  const durationMs = Date.now() - streamStartTime;
9299
9765
  await this.messageEmitter.emitUsageMetadata(
9300
9766
  usageMetadata,
@@ -9778,11 +10244,16 @@ ${this.pendingRecoveredAgentsNotice}
9778
10244
  if (record.skipPersistence === true || this.#shouldSkipRestoredAskUserQuestionPersistence(record.callId)) {
9779
10245
  return;
9780
10246
  }
9781
- this.config.getChatRecordingService()?.recordToolResult(finalized[index].responseParts, {
9782
- ...record.metadata,
9783
- persistedOutputFiles: finalized[index].persistedOutputFiles,
9784
- artifacts: finalized[index].artifacts
9785
- });
10247
+ const goalProvenance = ambientGoalToolResultProvenance(record.toolName);
10248
+ this.config.getChatRecordingService()?.recordToolResult(
10249
+ finalized[index].responseParts,
10250
+ {
10251
+ ...record.metadata,
10252
+ persistedOutputFiles: finalized[index].persistedOutputFiles,
10253
+ artifacts: finalized[index].artifacts
10254
+ },
10255
+ ...goalProvenance ? [goalProvenance] : []
10256
+ );
9786
10257
  });
9787
10258
  return {
9788
10259
  ...result,
@@ -10266,9 +10737,14 @@ ${this.pendingRecoveredAgentsNotice}
10266
10737
  /**
10267
10738
  * Assemble the per-turn system reminders the model needs to see at the
10268
10739
  * start of a user query or cron fire. Mirrors the subagent/plan/arena
10269
- * branches in `GeminiClient.sendMessageStream` (`client.ts:848-878`) —
10740
+ * branches in `LlmClient.sendMessageStream` (`client.ts:848-878`) —
10270
10741
  * the ACP path bypasses that code, so without this helper plan mode is
10271
10742
  * silently inert and subagent/arena sessions lose context.
10743
+ *
10744
+ * Scope note: the `relevantAutoMemory` reminder is intentionally NOT
10745
+ * included here. Managed auto-memory requires a prefetch pipeline that
10746
+ * lives in `LlmClient`, and porting it into the ACP path is tracked
10747
+ * separately as part of the broader middleware-alignment work.
10272
10748
  */
10273
10749
  async #buildInitialSystemReminders() {
10274
10750
  const reminders = [];
@@ -10286,6 +10762,14 @@ ${this.pendingRecoveredAgentsNotice}
10286
10762
  } catch {
10287
10763
  }
10288
10764
  }
10765
+ if (this.config.getOutputStyle?.()) {
10766
+ const outputStyle = resolveMainSessionOutputStyle(this.config);
10767
+ if (outputStyle) {
10768
+ reminders.push({
10769
+ text: wrapSystemReminder(getOutputStyleTurnReminder(outputStyle))
10770
+ });
10771
+ }
10772
+ }
10289
10773
  return reminders;
10290
10774
  }
10291
10775
  async runTool(abortSignal, promptId, fc, onStopAfterPermissionCancel, toolLoopState, recordSkippedToolCall, queueToolResultRecord, generatedCallId, onFullTurnModel) {
@@ -10729,7 +11213,7 @@ ${this.pendingRecoveredAgentsNotice}
10729
11213
  if (!autoModeAllowed && !requiresUserInteraction && shouldRunAutoModeForCall(approvalMode, policyToolName)) {
10730
11214
  const denialState = this.config.getAutoModeDenialState();
10731
11215
  const fallback = shouldFallback(denialState);
10732
- const messages = this.config.getGeminiClient?.()?.getHistoryTail(MAX_TRANSCRIPT_MESSAGES, false) ?? [];
11216
+ const messages = this.config.getLlmClient?.()?.getHistoryTail(MAX_TRANSCRIPT_MESSAGES, false) ?? [];
10733
11217
  const decision = await evaluateAutoMode({
10734
11218
  ctx: pmCtx,
10735
11219
  pmForcedAsk,
@@ -11812,7 +12296,7 @@ ${this.pendingRecoveredAgentsNotice}
11812
12296
  });
11813
12297
  } finally {
11814
12298
  if (terminalStatus && terminalStatus !== "cancelled") {
11815
- this.config.getGeminiClient().recordCompletedToolCall(toolName, args);
12299
+ this.config.getLlmClient().recordCompletedToolCall(toolName, args);
11816
12300
  }
11817
12301
  if (terminalStatus === "cancelled") {
11818
12302
  endToolSpan(toolSpan, { success: false, cancelled: true });
@@ -13076,11 +13560,21 @@ function validateSkillSlug(slug) {
13076
13560
  }
13077
13561
  }
13078
13562
  __name(validateSkillSlug, "validateSkillSlug");
13563
+ function rejectInstallArtifactSlug(slug) {
13564
+ if (/\.(backup|installing)-\d+-\d+$/.test(slug)) {
13565
+ throw RequestError.invalidParams(
13566
+ void 0,
13567
+ "Invalid skill.slug: name ends with a reserved install-artifact suffix"
13568
+ );
13569
+ }
13570
+ }
13571
+ __name(rejectInstallArtifactSlug, "rejectInstallArtifactSlug");
13079
13572
  function readSkillInstallRequest(params) {
13080
13573
  const skillParams = toRecord2(params["skill"]);
13081
13574
  const input = Object.keys(skillParams).length > 0 ? skillParams : params;
13082
13575
  const slug = readRequiredString2(input["slug"], "skill.slug");
13083
13576
  validateSkillSlug(slug);
13577
+ rejectInstallArtifactSlug(slug);
13084
13578
  const scope = readOptionalString2(input["scope"], "skill.scope") ?? "global";
13085
13579
  if (scope !== "global") {
13086
13580
  throw RequestError.invalidParams(
@@ -13247,8 +13741,29 @@ async function installSkillFromUrl(config, request) {
13247
13741
  await fs2.mkdir(path5.dirname(targetPath), { recursive: true });
13248
13742
  await fs2.writeFile(targetPath, file.content);
13249
13743
  }
13250
- await fs2.rm(skillDir, { recursive: true, force: true });
13251
- await fs2.rename(stagingDir, skillDir);
13744
+ const backupDir = `${skillDir}.backup-${process.pid}-${Date.now()}`;
13745
+ let backedUp = false;
13746
+ try {
13747
+ try {
13748
+ await fs2.rename(skillDir, backupDir);
13749
+ backedUp = true;
13750
+ } catch (err) {
13751
+ if (err.code !== "ENOENT") throw err;
13752
+ }
13753
+ await fs2.rename(stagingDir, skillDir);
13754
+ } catch (error) {
13755
+ if (backedUp) {
13756
+ await fs2.rename(backupDir, skillDir).catch(() => {
13757
+ });
13758
+ }
13759
+ await fs2.rm(stagingDir, { recursive: true, force: true }).catch(() => {
13760
+ });
13761
+ throw error;
13762
+ }
13763
+ if (backedUp) {
13764
+ await fs2.rm(backupDir, { recursive: true, force: true }).catch(() => {
13765
+ });
13766
+ }
13252
13767
  } catch (error) {
13253
13768
  await fs2.rm(stagingDir, { recursive: true, force: true }).catch(() => {
13254
13769
  });
@@ -13497,11 +14012,91 @@ function serializeMonitorTask(entry, now) {
13497
14012
  };
13498
14013
  }
13499
14014
  __name(serializeMonitorTask, "serializeMonitorTask");
13500
- function buildSessionTasksStatus(sessionId, config, now = Date.now()) {
14015
+ function serializeWorkflowTask(entry, now) {
14016
+ return {
14017
+ kind: "workflow",
14018
+ id: entry.runId,
14019
+ ...optionalField("toolUseId", entry.toolUseId),
14020
+ ...optionalField("sourceRunId", entry.sourceRunId),
14021
+ ...optionalField("startMode", entry.startMode),
14022
+ label: entry.meta?.name ?? entry.description ?? entry.runId,
14023
+ description: entry.meta?.description ?? entry.description,
14024
+ status: entry.status,
14025
+ startTime: entry.startTime,
14026
+ runtimeMs: runtimeMs(entry, now),
14027
+ outputFile: entry.outputFile,
14028
+ ...optionalField("endTime", entry.endTime),
14029
+ isBackgrounded: entry.isBackgrounded === true,
14030
+ currentPhase: entry.currentPhase,
14031
+ phaseVisits: entry.phaseVisits.map((visit) => ({ ...visit })),
14032
+ dispatches: entry.dispatches.map((dispatch) => ({
14033
+ ...dispatch,
14034
+ dependsOn: [...dispatch.dependsOn]
14035
+ })),
14036
+ agentsDispatched: entry.agentsDispatched,
14037
+ agentsCompleted: entry.agentsCompleted,
14038
+ tokensSpent: entry.tokensSpent,
14039
+ tokenBudgetTotal: entry.tokenBudgetTotal,
14040
+ recentLogs: [...entry.recentLogs],
14041
+ events: entry.events.map((event) => ({ ...event })),
14042
+ pendingApprovalCount: entry.pendingApprovals.length,
14043
+ pendingApprovals: entry.pendingApprovals.map((approval) => ({
14044
+ approvalId: approval.approvalId,
14045
+ subagentId: approval.subagentId,
14046
+ name: approval.name,
14047
+ description: approval.description,
14048
+ at: approval.at
14049
+ })),
14050
+ ...optionalField("error", entry.error)
14051
+ };
14052
+ }
14053
+ __name(serializeWorkflowTask, "serializeWorkflowTask");
14054
+ function serializeWorkflowSnapshot(snapshot) {
14055
+ return {
14056
+ kind: "workflow",
14057
+ id: snapshot.runId,
14058
+ isHistorical: true,
14059
+ ...optionalField("sourceRunId", snapshot.sourceRunId),
14060
+ ...optionalField("startMode", snapshot.startMode),
14061
+ label: snapshot.meta?.name ?? snapshot.description ?? snapshot.runId,
14062
+ description: snapshot.meta?.description ?? snapshot.description ?? snapshot.runId,
14063
+ status: snapshot.status,
14064
+ startTime: snapshot.startTime,
14065
+ ...optionalField("endTime", snapshot.endTime),
14066
+ runtimeMs: runtimeMs(snapshot, snapshot.endTime ?? snapshot.startTime),
14067
+ isBackgrounded: false,
14068
+ currentPhase: snapshot.phases.at(-1) ?? null,
14069
+ phaseVisits: (snapshot.phaseVisits ?? []).map((visit) => ({ ...visit })),
14070
+ dispatches: (snapshot.dispatches ?? []).map((dispatch) => ({
14071
+ ...dispatch,
14072
+ dependsOn: [...dispatch.dependsOn]
14073
+ })),
14074
+ agentsDispatched: snapshot.agentsDispatched,
14075
+ agentsCompleted: snapshot.agentsCompleted,
14076
+ tokensSpent: snapshot.tokensSpent,
14077
+ tokenBudgetTotal: snapshot.tokenBudgetTotal,
14078
+ recentLogs: [...snapshot.recentLogs],
14079
+ ...optionalField(
14080
+ "events",
14081
+ snapshot.events?.map((event) => ({ ...event }))
14082
+ ),
14083
+ pendingApprovalCount: 0,
14084
+ ...optionalField("error", snapshot.error)
14085
+ };
14086
+ }
14087
+ __name(serializeWorkflowSnapshot, "serializeWorkflowSnapshot");
14088
+ function buildSessionTasksStatus(sessionId, config, now = Date.now(), workflowHistory = [], options = {}) {
14089
+ const includeWorkflows = options.includeWorkflows === true;
14090
+ const workflowTasks = includeWorkflows ? config.getWorkflowRunRegistry().list() : [];
14091
+ const inMemoryWorkflowIds = new Set(
14092
+ workflowTasks.map((entry) => entry.runId)
14093
+ );
13501
14094
  const tasks = [
13502
14095
  ...config.getBackgroundTaskRegistry().getAll().map((entry) => serializeAgentTask(entry, now)),
13503
14096
  ...config.getBackgroundShellRegistry().getAll().map((entry) => serializeShellTask(entry, now)),
13504
- ...config.getMonitorRegistry().getAll().map((entry) => serializeMonitorTask(entry, now))
14097
+ ...config.getMonitorRegistry().getAll().map((entry) => serializeMonitorTask(entry, now)),
14098
+ ...includeWorkflows ? workflowTasks.map((entry) => serializeWorkflowTask(entry, now)) : [],
14099
+ ...includeWorkflows ? workflowHistory.filter((snapshot) => !inMemoryWorkflowIds.has(snapshot.runId)).map(serializeWorkflowSnapshot) : []
13505
14100
  ].sort((a, b) => a.startTime - b.startTime);
13506
14101
  return {
13507
14102
  v: STATUS_SCHEMA_VERSION,
@@ -13543,12 +14138,17 @@ var ACP_ERROR_CODES = {
13543
14138
  };
13544
14139
 
13545
14140
  // packages/cli/src/acp-integration/acpAgent.ts
14141
+ function isSessionOwnedWorkflowTool(value) {
14142
+ return typeof value === "object" && value !== null && "buildSessionOwnedBackground" in value && typeof value.buildSessionOwnedBackground === "function";
14143
+ }
14144
+ __name(isSessionOwnedWorkflowTool, "isSessionOwnedWorkflowTool");
13546
14145
  var debugLogger9 = createDebugLogger("ACP_AGENT");
13547
14146
  var QWEN_ACP_LOCAL_READ_ROOTS_ENV = "QWEN_ACP_LOCAL_READ_ROOTS";
13548
14147
  var POSIX_TMP_LOCAL_READ_ROOT = "/tmp";
13549
14148
  var BTW_CHILD_TIMEOUT_MS = 55e3;
13550
14149
  var MCP_OAUTH_START_TIMEOUT_MS = 3e4;
13551
14150
  var SESSION_DRAIN_TIMEOUT_MS = 3e4;
14151
+ var SESSION_ID_RE = /^[0-9a-fA-F-]{32,36}$/;
13552
14152
  var WORKSPACE_MEMORY_REMEMBER_CHILD_TIMEOUT_MS = 295e3;
13553
14153
  function currentGoalSnapshot(config, runtime) {
13554
14154
  try {
@@ -14867,7 +15467,7 @@ function readScopeSettings(settings, scope) {
14867
15467
  }
14868
15468
  __name(readScopeSettings, "readScopeSettings");
14869
15469
  async function resolvePreferredMemoryFile(dir, fallbackFilename) {
14870
- for (const filename of getAllGeminiMdFilenames()) {
15470
+ for (const filename of getAllMemoryFilenames()) {
14871
15471
  const filePath = path6.join(dir, filename);
14872
15472
  try {
14873
15473
  await fs3.access(filePath);
@@ -14879,7 +15479,7 @@ async function resolvePreferredMemoryFile(dir, fallbackFilename) {
14879
15479
  }
14880
15480
  __name(resolvePreferredMemoryFile, "resolvePreferredMemoryFile");
14881
15481
  async function resolveQwenMemoryPaths(params) {
14882
- const fallbackFilename = getAllGeminiMdFilenames()[0] ?? "QWEN.md";
15482
+ const fallbackFilename = getAllMemoryFilenames()[0] ?? "QWEN.md";
14883
15483
  const userMemoryFile = await resolvePreferredMemoryFile(
14884
15484
  Storage.getGlobalQwenDir(),
14885
15485
  fallbackFilename
@@ -15103,7 +15703,7 @@ async function runAcpAgent(config, settings, argv, options) {
15103
15703
  beginAcpBootstrapConfigProfiling();
15104
15704
  try {
15105
15705
  await config.initialize({
15106
- skipGeminiInitialization: true,
15706
+ skipLlmInitialization: true,
15107
15707
  // Bootstrap skips MCP discovery — each session runs its own
15108
15708
  // pool-routed discovery, so bootstrap-level spawns would be
15109
15709
  // redundant subprocess leaks (W119).
@@ -15495,6 +16095,11 @@ function isOwnerOnlyDirectory(stats) {
15495
16095
  return (stats.mode & 63) === 0;
15496
16096
  }
15497
16097
  __name(isOwnerOnlyDirectory, "isOwnerOnlyDirectory");
16098
+ function hasExpectedManagedDirectoryIdentity(stats, expected) {
16099
+ const inodeVerifiable = hasVerifiableInode(stats.ino);
16100
+ return stats.dev === expected.device && inodeVerifiable === (expected.inode !== 0) && (!inodeVerifiable || stats.ino === expected.inode);
16101
+ }
16102
+ __name(hasExpectedManagedDirectoryIdentity, "hasExpectedManagedDirectoryIdentity");
15498
16103
  function hasOnlyKeys(value, keys) {
15499
16104
  const actual = Object.keys(value).sort();
15500
16105
  const expected = [...keys].sort();
@@ -15569,7 +16174,7 @@ async function assertManagedConversationDirectoryIdentity(expectation) {
15569
16174
  error.code === "ENOENT"
15570
16175
  );
15571
16176
  }
15572
- 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) {
16177
+ if (!isOwnerOnlyDirectory(rootBefore) || !isOwnerOnlyDirectory(rootAfter) || !isSameConversationPath(canonicalRoot, expectation.root.canonicalPath) || !hasExpectedManagedDirectoryIdentity(rootBefore, expectation.root) || !hasExpectedManagedDirectoryIdentity(rootAfter, expectation.root)) {
15573
16178
  throw managedConversationDirectoryError(false);
15574
16179
  }
15575
16180
  let childBefore;
@@ -15584,12 +16189,12 @@ async function assertManagedConversationDirectoryIdentity(expectation) {
15584
16189
  error.code === "ENOENT"
15585
16190
  );
15586
16191
  }
15587
- 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) {
16192
+ if (!isOwnerOnlyDirectory(childBefore) || !isOwnerOnlyDirectory(childAfter) || !isSameConversationPath(canonicalChild, expectation.child.canonicalPath) || !hasExpectedManagedDirectoryIdentity(childBefore, expectation.child) || !hasExpectedManagedDirectoryIdentity(childAfter, expectation.child)) {
15588
16193
  throw managedConversationDirectoryError(false);
15589
16194
  }
15590
16195
  }
15591
16196
  __name(assertManagedConversationDirectoryIdentity, "assertManagedConversationDirectoryIdentity");
15592
- var QwenAgent = class {
16197
+ var QwenAgent = class _QwenAgent {
15593
16198
  constructor(config, settings, argv, connection, expectedPrivateParentCapability, sessionWriterLeaseEnabledAtStartup = false, managedToolInvocationGuard, externalToolGuardProviderAttached = false) {
15594
16199
  this.config = config;
15595
16200
  this.settings = settings;
@@ -15629,13 +16234,21 @@ var QwenAgent = class {
15629
16234
  __name(this, "QwenAgent");
15630
16235
  }
15631
16236
  sessions = /* @__PURE__ */ new Map();
16237
+ modelProviderReloadRevision = 0;
15632
16238
  historyMutationTails = /* @__PURE__ */ new Map();
15633
16239
  startingSessionIds = /* @__PURE__ */ new Set();
16240
+ /**
16241
+ * R7-10: workflow registries of sessions already removed from
16242
+ * `this.sessions` whose runs have not finished settling. Consulted by
16243
+ * `isWorkflowRunLiveOutsideSession` so a delete-history cannot delete
16244
+ * an orphaned live run out from under itself. Pruned as they drain.
16245
+ */
16246
+ detachedWorkflowRegistries = /* @__PURE__ */ new Set();
15634
16247
  activePromptCalls = /* @__PURE__ */ new Map();
15635
16248
  workspaceMcpDiscoveryConfig;
15636
16249
  workspaceMcpDiscoveryPromise;
15637
16250
  workspaceMcpDiscoveryError;
15638
- workspaceExtensionStatusRefreshPromise;
16251
+ workspaceExtensionStatusRefreshes = /* @__PURE__ */ new Map();
15639
16252
  pendingMcpAuthentications = /* @__PURE__ */ new Map();
15640
16253
  mcpAuthenticationResults = /* @__PURE__ */ new Map();
15641
16254
  generationControllers = /* @__PURE__ */ new Map();
@@ -15835,19 +16448,25 @@ var QwenAgent = class {
15835
16448
  }
15836
16449
  return this.workspaceMcpDiscoveryConfig ?? this.config;
15837
16450
  }
15838
- refreshBootstrapExtensionStatus() {
15839
- if (this.workspaceExtensionStatusRefreshPromise) {
15840
- return this.workspaceExtensionStatusRefreshPromise;
15841
- }
16451
+ refreshBootstrapExtensionStatus(skillsOnly = false) {
16452
+ const inFlight = this.workspaceExtensionStatusRefreshes.get(skillsOnly);
16453
+ if (inFlight) return inFlight;
15842
16454
  const promise = (async () => {
15843
16455
  const errors = [];
15844
- try {
15845
- await this.config.getExtensionManager().refreshCache();
16456
+ if (skillsOnly) {
16457
+ try {
16458
+ this.settings.reloadScopeFromDisk("Workspace" /* Workspace */);
16459
+ } catch (error) {
16460
+ errors.push(error);
16461
+ }
16462
+ }
16463
+ try {
16464
+ await this.config.getExtensionManager().refreshCache();
15846
16465
  } catch (error) {
15847
16466
  errors.push(error);
15848
16467
  }
15849
16468
  try {
15850
- await this.config.getSkillManager()?.refreshCache();
16469
+ await this.config.getSkillManager()?.refreshCache(skillsOnly ? { throwOnError: true } : void 0);
15851
16470
  } catch (error) {
15852
16471
  errors.push(error);
15853
16472
  }
@@ -15859,10 +16478,10 @@ var QwenAgent = class {
15859
16478
  );
15860
16479
  }
15861
16480
  })();
15862
- this.workspaceExtensionStatusRefreshPromise = promise;
16481
+ this.workspaceExtensionStatusRefreshes.set(skillsOnly, promise);
15863
16482
  const clear = /* @__PURE__ */ __name(() => {
15864
- if (this.workspaceExtensionStatusRefreshPromise === promise) {
15865
- this.workspaceExtensionStatusRefreshPromise = void 0;
16483
+ if (this.workspaceExtensionStatusRefreshes.get(skillsOnly) === promise) {
16484
+ this.workspaceExtensionStatusRefreshes.delete(skillsOnly);
15866
16485
  }
15867
16486
  }, "clear");
15868
16487
  void promise.then(clear, clear);
@@ -15884,9 +16503,9 @@ var QwenAgent = class {
15884
16503
  const registry = config.getToolRegistry();
15885
16504
  if (operation === "discover") {
15886
16505
  await registry?.discoverToolsForServer(serverName);
15887
- const geminiClient = config.getGeminiClient?.();
15888
- if (geminiClient?.isInitialized?.()) {
15889
- await geminiClient.setTools?.();
16506
+ const llmClient = config.getLlmClient?.();
16507
+ if (llmClient?.isInitialized?.()) {
16508
+ await llmClient.setTools?.();
15890
16509
  }
15891
16510
  } else if (operation === "disable") {
15892
16511
  await registry?.disableMcpServer(serverName);
@@ -15931,56 +16550,63 @@ var QwenAgent = class {
15931
16550
  }
15932
16551
  async createWorkspaceMcpDiscoveryConfig(settings) {
15933
16552
  if (this.workspaceMcpDiscoveryConfig) return;
15934
- const cwd = this.config.getTargetDir();
15935
- const config = await this.runWithPinnedRuntimeBaseDir(
15936
- settings,
15937
- cwd,
15938
- () => loadCliConfig(
15939
- settings.merged,
15940
- {
15941
- ...this.argv,
15942
- sessionId: "workspace-mcp-discovery",
15943
- resume: void 0,
15944
- continue: false,
15945
- chatRecording: false
15946
- },
16553
+ return sessionIdContext.run("workspace-mcp-discovery", async () => {
16554
+ const cwd = this.config.getTargetDir();
16555
+ const config = await this.runWithPinnedRuntimeBaseDir(
16556
+ settings,
15947
16557
  cwd,
15948
- void 0,
15949
- {
15950
- userHooks: settings.getUserHooks(),
15951
- projectHooks: settings.getProjectHooks()
15952
- },
15953
- buildDisabledSkillNamesProvider(settings)
15954
- )
15955
- );
15956
- config.setMcpTransportPool(this.mcpPool);
15957
- try {
15958
- await config.initialize({
15959
- skipGeminiInitialization: true,
15960
- skipFileCheckpointing: true,
15961
- skipHooks: true,
15962
- skipSkillManager: true,
15963
- skipMcpDiscovery: true,
15964
- lenientToolWarmup: true
15965
- });
15966
- const manager = config.getToolRegistry()?.getMcpClientManager();
15967
- if (!manager) {
15968
- throw new Error("MCP client manager is unavailable");
15969
- }
15970
- await manager.discoverAllMcpToolsIncremental(config);
15971
- if (manager.getDiscoveryState() === "not_started" /* NOT_STARTED */) {
15972
- throw new Error(
15973
- "MCP discovery did not start. The workspace may not be trusted."
15974
- );
15975
- }
15976
- this.workspaceMcpDiscoveryConfig = config;
15977
- } catch (error) {
16558
+ () => loadCliConfig(
16559
+ settings.merged,
16560
+ {
16561
+ ...this.argv,
16562
+ sessionId: "workspace-mcp-discovery",
16563
+ resume: void 0,
16564
+ continue: false,
16565
+ chatRecording: false
16566
+ },
16567
+ cwd,
16568
+ void 0,
16569
+ {
16570
+ userHooks: settings.getUserHooks(),
16571
+ projectHooks: settings.getProjectHooks()
16572
+ },
16573
+ buildDisabledSkillNamesProvider(settings),
16574
+ void 0,
16575
+ void 0,
16576
+ void 0,
16577
+ void 0,
16578
+ buildEnabledSkillNamesProvider(settings)
16579
+ )
16580
+ );
16581
+ config.setMcpTransportPool(this.mcpPool);
15978
16582
  try {
15979
- await config.getToolRegistry()?.stop();
15980
- } catch {
16583
+ await config.initialize({
16584
+ skipLlmInitialization: true,
16585
+ skipFileCheckpointing: true,
16586
+ skipHooks: true,
16587
+ skipSkillManager: true,
16588
+ skipMcpDiscovery: true,
16589
+ lenientToolWarmup: true
16590
+ });
16591
+ const manager = config.getToolRegistry()?.getMcpClientManager();
16592
+ if (!manager) {
16593
+ throw new Error("MCP client manager is unavailable");
16594
+ }
16595
+ await manager.discoverAllMcpToolsIncremental(config);
16596
+ if (manager.getDiscoveryState() === "not_started" /* NOT_STARTED */) {
16597
+ throw new Error(
16598
+ "MCP discovery did not start. The workspace may not be trusted."
16599
+ );
16600
+ }
16601
+ this.workspaceMcpDiscoveryConfig = config;
16602
+ } catch (error) {
16603
+ try {
16604
+ await config.getToolRegistry()?.stop();
16605
+ } catch {
16606
+ }
16607
+ throw error;
15981
16608
  }
15982
- throw error;
15983
- }
16609
+ });
15984
16610
  }
15985
16611
  initializeWorkspaceMcpDiscovery() {
15986
16612
  if (this.workspaceMcpDiscoveryConfig || this.workspaceMcpDiscoveryPromise) {
@@ -16072,9 +16698,9 @@ var QwenAgent = class {
16072
16698
  }
16073
16699
  await Promise.all(
16074
16700
  this.getLiveMcpConfigs(serverName).map(async (config) => {
16075
- const geminiClient = config.getGeminiClient?.();
16076
- if (geminiClient?.isInitialized?.()) {
16077
- await geminiClient.setTools?.();
16701
+ const llmClient = config.getLlmClient?.();
16702
+ if (llmClient?.isInitialized?.()) {
16703
+ await llmClient.setTools?.();
16078
16704
  }
16079
16705
  })
16080
16706
  );
@@ -16144,6 +16770,18 @@ var QwenAgent = class {
16144
16770
  cleanupErrors.push(error);
16145
16771
  }
16146
16772
  this.sessions.delete(sessionId);
16773
+ try {
16774
+ this.pruneDrainedWorkflowRegistries();
16775
+ const registry = session.getConfig().getWorkflowRunRegistry?.();
16776
+ if (registry && _QwenAgent.isWorkflowRegistryDraining(registry)) {
16777
+ this.detachedWorkflowRegistries.add(registry);
16778
+ }
16779
+ } catch (error) {
16780
+ debugLogger9.warn(
16781
+ `Session ${sessionId}: could not retain its workflow registry for liveness checks:`,
16782
+ error
16783
+ );
16784
+ }
16147
16785
  this.activeWorkReporter?.notifyChanged();
16148
16786
  if (cleanupErrors.length > 0) {
16149
16787
  debugLogger9.warn(
@@ -16483,7 +17121,7 @@ var QwenAgent = class {
16483
17121
  }
16484
17122
  this.clientCapabilities = args.clientCapabilities;
16485
17123
  const authMethods = buildAuthMethods();
16486
- const version = "0.22.2";
17124
+ const version = "0.22.3-nightly.20260831.3a0c4c6108";
16487
17125
  const response = {
16488
17126
  protocolVersion: PROTOCOL_VERSION,
16489
17127
  agentInfo: {
@@ -16604,6 +17242,41 @@ var QwenAgent = class {
16604
17242
  this.startingSessionIds.delete(sessionId);
16605
17243
  };
16606
17244
  }
17245
+ createSessionInitializationDeadline(raw) {
17246
+ if (raw === void 0 || !this.isTrustedManagedParent()) return void 0;
17247
+ if (typeof raw !== "number" || !Number.isSafeInteger(raw) || raw <= 0) {
17248
+ throw RequestError.invalidParams(
17249
+ { errorKind: "invalid_session_initialization_deadline" },
17250
+ `\`_meta["${SESSION_INITIALIZATION_DEADLINE_META_KEY}"]\` must be a positive safe integer`
17251
+ );
17252
+ }
17253
+ const remainingMs = raw - Date.now();
17254
+ if (remainingMs > 2147483647) {
17255
+ throw RequestError.invalidParams(
17256
+ { errorKind: "invalid_session_initialization_deadline" },
17257
+ `\`_meta["${SESSION_INITIALIZATION_DEADLINE_META_KEY}"]\` exceeds the supported timer range`
17258
+ );
17259
+ }
17260
+ const controller = new AbortController();
17261
+ const timeoutError = new RequestError(
17262
+ ACP_ERROR_CODES.INTERNAL_ERROR,
17263
+ "Session initialization deadline exceeded",
17264
+ { errorKind: SESSION_INITIALIZATION_TIMEOUT_ERROR_KIND }
17265
+ );
17266
+ let timer;
17267
+ if (remainingMs <= 0) {
17268
+ controller.abort(timeoutError);
17269
+ } else {
17270
+ timer = setTimeout(() => controller.abort(timeoutError), remainingMs);
17271
+ timer.unref();
17272
+ }
17273
+ return {
17274
+ signal: controller.signal,
17275
+ dispose: /* @__PURE__ */ __name(() => {
17276
+ if (timer) clearTimeout(timer);
17277
+ }, "dispose")
17278
+ };
17279
+ }
16607
17280
  async newSession(params) {
16608
17281
  const { cwd, mcpServers } = params;
16609
17282
  const parsedSessionId = parseCallerSuppliedSessionId(
@@ -16618,7 +17291,12 @@ var QwenAgent = class {
16618
17291
  }
16619
17292
  const requestedSessionId = parsedSessionId.kind === "valid" ? parsedSessionId.sessionId : void 0;
16620
17293
  const releaseStartingSessionId = requestedSessionId ? this.reserveStartingSessionId(requestedSessionId) : void 0;
17294
+ let initializationDeadline;
16621
17295
  try {
17296
+ initializationDeadline = this.createSessionInitializationDeadline(
17297
+ params._meta?.[SESSION_INITIALIZATION_DEADLINE_META_KEY]
17298
+ );
17299
+ initializationDeadline?.signal.throwIfAborted();
16622
17300
  const sessionSource = getSessionSource(params);
16623
17301
  const provisionalStandalone = isReservedStandaloneSessionSourceType(
16624
17302
  sessionSource?.sourceType
@@ -16640,6 +17318,8 @@ var QwenAgent = class {
16640
17318
  () => loadSettingsCached(cwd)
16641
17319
  );
16642
17320
  this.settings = settings;
17321
+ const deferMcpDiscovery = shouldDeferMcpDiscovery(params);
17322
+ const configProviderRevision = this.modelProviderReloadRevision;
16643
17323
  const config = await profiler.time(
16644
17324
  "config_setup",
16645
17325
  () => this.newSessionConfig(
@@ -16649,16 +17329,21 @@ var QwenAgent = class {
16649
17329
  sessionSource,
16650
17330
  requestedSessionId,
16651
17331
  void 0,
16652
- shouldDeferMcpDiscovery(params) ? { skipMcpDiscovery: true } : void 0
17332
+ initializationDeadline || deferMcpDiscovery ? {
17333
+ ...initializationDeadline ? { signal: initializationDeadline.signal } : {},
17334
+ ...deferMcpDiscovery ? { skipMcpDiscovery: true } : {}
17335
+ } : void 0
16653
17336
  )
16654
17337
  );
16655
17338
  let session;
16656
17339
  try {
17340
+ initializationDeadline?.signal.throwIfAborted();
16657
17341
  if (!provisionalStandalone) {
16658
17342
  await profiler.time(
16659
17343
  "auth",
16660
17344
  () => this.ensureAuthenticated(config)
16661
17345
  );
17346
+ initializationDeadline?.signal.throwIfAborted();
16662
17347
  profiler.timeSync(
16663
17348
  "file_system_setup",
16664
17349
  () => this.setupFileSystem(config)
@@ -16667,7 +17352,9 @@ var QwenAgent = class {
16667
17352
  session = await profiler.time(
16668
17353
  "session_register",
16669
17354
  () => this.createAndStoreSession(config, settings, void 0, {
16670
- deferWorkspaceActivation: provisionalStandalone
17355
+ deferWorkspaceActivation: provisionalStandalone,
17356
+ ...initializationDeadline ? { signal: initializationDeadline.signal } : {},
17357
+ configProviderRevision
16671
17358
  })
16672
17359
  );
16673
17360
  } catch (error) {
@@ -16688,6 +17375,7 @@ var QwenAgent = class {
16688
17375
  parentContext ? { parentContext } : {}
16689
17376
  );
16690
17377
  } finally {
17378
+ initializationDeadline?.dispose();
16691
17379
  releaseStartingSessionId?.();
16692
17380
  }
16693
17381
  }
@@ -16841,6 +17529,7 @@ var QwenAgent = class {
16841
17529
  sessionId = persistedSessionId;
16842
17530
  profiler.setSessionId(sessionId);
16843
17531
  this.settings = settings;
17532
+ const configProviderRevision = this.modelProviderReloadRevision;
16844
17533
  const config = await profiler.time(
16845
17534
  "config_setup",
16846
17535
  () => this.newSessionConfig(
@@ -16901,6 +17590,7 @@ var QwenAgent = class {
16901
17590
  "session_register",
16902
17591
  () => this.createAndStoreSession(config, settings, void 0, {
16903
17592
  deferWorkspaceActivation: provisionalStandalone,
17593
+ configProviderRevision,
16904
17594
  ...provisionalStandalone ? {
16905
17595
  beforeDeferredWorkspaceActivation: /* @__PURE__ */ __name(() => profiler.time(
16906
17596
  "restore_session_model",
@@ -16999,9 +17689,9 @@ var QwenAgent = class {
16999
17689
  );
17000
17690
  }
17001
17691
  }, "prepareBeforeSessionCreate"),
17002
- beforeSessionCreate: /* @__PURE__ */ __name(() => {
17692
+ beforeSessionPublish: /* @__PURE__ */ __name(() => {
17003
17693
  response = buildResponse();
17004
- }, "beforeSessionCreate"),
17694
+ }, "beforeSessionPublish"),
17005
17695
  primeSession: /* @__PURE__ */ __name((createdSession) => {
17006
17696
  profiler.timeSync("runtime_initialize", () => {
17007
17697
  if (!projection) return;
@@ -17169,6 +17859,7 @@ var QwenAgent = class {
17169
17859
  sessionId = persistedSessionId;
17170
17860
  profiler.setSessionId(sessionId);
17171
17861
  this.settings = settings;
17862
+ const configProviderRevision = this.modelProviderReloadRevision;
17172
17863
  const config = await profiler.time(
17173
17864
  "config_setup",
17174
17865
  () => this.newSessionConfig(
@@ -17207,6 +17898,7 @@ var QwenAgent = class {
17207
17898
  "session_register",
17208
17899
  () => this.createAndStoreSession(config, settings, void 0, {
17209
17900
  deferWorkspaceActivation: provisionalStandalone,
17901
+ configProviderRevision,
17210
17902
  ...provisionalStandalone ? {
17211
17903
  beforeDeferredWorkspaceActivation: /* @__PURE__ */ __name(() => profiler.time(
17212
17904
  "restore_session_model",
@@ -17224,14 +17916,14 @@ var QwenAgent = class {
17224
17916
  sessionSource ?? {}
17225
17917
  ),
17226
17918
  replayHistory: false,
17227
- beforeSessionCreate: /* @__PURE__ */ __name(() => {
17919
+ beforeSessionPublish: /* @__PURE__ */ __name(() => {
17228
17920
  response = profiler.timeSync("response_build", () => ({
17229
17921
  modes: this.buildModesData(config),
17230
17922
  models: this.buildAvailableModels(config),
17231
17923
  configOptions: this.buildConfigOptions(config),
17232
17924
  ...projection?.runtime.artifactSnapshot ? { artifactSnapshot: projection.runtime.artifactSnapshot } : {}
17233
17925
  }));
17234
- }, "beforeSessionCreate"),
17926
+ }, "beforeSessionPublish"),
17235
17927
  primeSession: /* @__PURE__ */ __name((createdSession) => {
17236
17928
  profiler.timeSync("runtime_initialize", () => {
17237
17929
  if (!projection) return;
@@ -17381,15 +18073,17 @@ var QwenAgent = class {
17381
18073
  break;
17382
18074
  }
17383
18075
  case "reasoning_effort": {
18076
+ const generation = session.getConfig().getContentGeneratorConfig();
18077
+ const thinkingMandatory = generation.thinkingMandatory === true;
17384
18078
  const modelReasoning = this.getModelReasoningConfiguration(
17385
18079
  session.getConfig()
17386
18080
  );
17387
18081
  if (modelReasoning) {
17388
18082
  const effortValues = modelReasoning.toggleOnly ? void 0 : modelReasoning.efforts;
17389
- const selected = value === REASONING_EFFORT_NONE ? REASONING_EFFORT_NONE : modelReasoning.toggleOnly ? value === REASONING_EFFORT_DEFAULT ? REASONING_EFFORT_DEFAULT : void 0 : effortValues?.find((effort2) => effort2 === value);
18083
+ 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);
17390
18084
  if (!selected) {
17391
18085
  const choices = [
17392
- REASONING_EFFORT_NONE,
18086
+ ...thinkingMandatory ? [] : [REASONING_EFFORT_NONE],
17393
18087
  ...effortValues ?? [REASONING_EFFORT_DEFAULT]
17394
18088
  ];
17395
18089
  throw RequestError.invalidParams(
@@ -17397,7 +18091,17 @@ var QwenAgent = class {
17397
18091
  `Unknown reasoning effort: ${value}. Choose one of: ${choices.join(", ")}`
17398
18092
  );
17399
18093
  }
17400
- const generation = session.getConfig().getContentGeneratorConfig();
18094
+ if (!modelReasoning.toggleOnly) {
18095
+ for (const source of ["extra_body", "samplingParams"]) {
18096
+ const layer = generation[source];
18097
+ if (!layer) continue;
18098
+ const next = { ...layer };
18099
+ delete next["enable_thinking"];
18100
+ delete next["reasoning_effort"];
18101
+ delete next["thinking_budget"];
18102
+ generation[source] = next;
18103
+ }
18104
+ }
17401
18105
  if (selected === REASONING_EFFORT_NONE) {
17402
18106
  generation.reasoning = false;
17403
18107
  } else if (selected === REASONING_EFFORT_DEFAULT) {
@@ -18274,25 +18978,25 @@ var QwenAgent = class {
18274
18978
  skills.map((skill) => [
18275
18979
  `${skill.level}:${skill.extensionName ?? ""}:${skill.name}`,
18276
18980
  mapSkillConfigToStatus(skill, disablements, {
18277
- disabled: isInactiveExtensionSkill(skill, inactiveSkillRefs)
18981
+ disabled: isInactiveExtensionSkill(skill, inactiveSkillRefs),
18982
+ enabled: config.isSkillEnabled(skill)
18278
18983
  })
18279
18984
  ])
18280
18985
  );
18281
18986
  for (const extension of config.getExtensions()) {
18282
18987
  if (extension.isActive) continue;
18283
18988
  for (const skill of extension.skills ?? []) {
18284
- const extensionName = extension.displayName ?? extension.name;
18989
+ const extensionName = extension.name;
18285
18990
  const key = `extension:${extensionName}:${skill.name}`;
18286
- if (skillsByKey.has(`extension:${extension.name}:${skill.name}`) || skillsByKey.has(key)) {
18287
- continue;
18288
- }
18991
+ if (skillsByKey.has(key)) continue;
18289
18992
  skillsByKey.set(
18290
18993
  key,
18291
18994
  mapSkillConfigToStatus(
18292
18995
  {
18293
18996
  ...skill,
18294
18997
  level: "extension",
18295
- extensionName
18998
+ extensionName,
18999
+ extensionDisplayName: extension.displayName
18296
19000
  },
18297
19001
  disablements,
18298
19002
  { disabled: true }
@@ -18351,7 +19055,13 @@ var QwenAgent = class {
18351
19055
  providers.set(authType, provider);
18352
19056
  }
18353
19057
  const isCurrent = currentAuth === model.authType && currentAcpModelId === modelId;
18354
- const configOptions = model.isRuntimeModel || modelId.startsWith(ACP_ROUTE_ID_PREFIX) ? void 0 : buildModelReasoningConfigPreview(model.id);
19058
+ const configOptions = model.isRuntimeModel || modelId.startsWith(ACP_ROUTE_ID_PREFIX) ? void 0 : buildModelReasoningConfigPreview(model.id, {
19059
+ thinkingMandatory: config.getResolvedModelConfig?.(
19060
+ model.authType,
19061
+ model.id,
19062
+ model.registryBaseUrl ?? model.baseUrl
19063
+ )?.generationConfig.thinkingMandatory === true
19064
+ });
18355
19065
  const providerModel = {
18356
19066
  modelId,
18357
19067
  baseModelId: parseAcpBaseModelId(effectiveModelId),
@@ -18806,17 +19516,34 @@ var QwenAgent = class {
18806
19516
  }
18807
19517
  async buildSessionSupportedCommandsStatus(sessionId) {
18808
19518
  const session = this.sessionOrThrow(sessionId);
19519
+ const config = session.getConfig();
18809
19520
  const { availableCommands, availableSkills } = await session.buildAvailableCommandsSnapshot();
19521
+ const workflowsEnabled = this.canUseWorkflowControls(config);
19522
+ const savedWorkflows = workflowsEnabled ? (await listSavedWorkflows(config)).map(({ name, source }) => ({
19523
+ name,
19524
+ source
19525
+ })) : [];
18810
19526
  return {
18811
19527
  v: STATUS_SCHEMA_VERSION,
18812
19528
  sessionId,
18813
- availableCommands,
18814
- availableSkills: availableSkills ?? []
19529
+ availableCommands: workflowsEnabled || !config.isWorkflowsEnabled() ? availableCommands : availableCommands.filter((command) => command.name !== "workflows"),
19530
+ availableSkills: availableSkills ?? [],
19531
+ workflowsEnabled,
19532
+ savedWorkflows
18815
19533
  };
18816
19534
  }
18817
- buildSessionTasksStatus(sessionId) {
19535
+ canUseWorkflowControls(config) {
19536
+ return config.isWorkflowsEnabled() && !config.getBareMode() && (!config.getFolderTrustFeature() || config.getFolderTrust());
19537
+ }
19538
+ async buildSessionTasksStatus(sessionId, includeWorkflows = false) {
18818
19539
  const session = this.sessionOrThrow(sessionId);
18819
- return buildSessionTasksStatus(sessionId, session.getConfig());
19540
+ return buildSessionTasksStatus(
19541
+ sessionId,
19542
+ session.getConfig(),
19543
+ Date.now(),
19544
+ includeWorkflows ? await session.refreshWorkflowHistory() : [],
19545
+ { includeWorkflows }
19546
+ );
18820
19547
  }
18821
19548
  buildSessionLspStatus(sessionId) {
18822
19549
  const session = this.sessionOrThrow(sessionId);
@@ -19172,9 +19899,9 @@ var QwenAgent = class {
19172
19899
  }
19173
19900
  const sessionId = normalizedParams["sessionId"];
19174
19901
  const session = typeof sessionId === "string" && sessionId.length > 0 ? this.sessions.get(sessionId) : void 0;
19175
- if (session && this.isSessionScopedExtMethod(method)) {
19176
- return await this.runInSessionContext(
19177
- session,
19902
+ if (typeof sessionId === "string" && sessionId.length > 0 && this.isSessionScopedExtMethod(method) && (session !== void 0 || SESSION_ID_RE.test(sessionId))) {
19903
+ return await sessionIdContext.run(
19904
+ session?.getConfig().getSessionId() ?? sessionId,
19178
19905
  () => this.extMethodInternal(method, normalizedParams)
19179
19906
  );
19180
19907
  }
@@ -19192,7 +19919,6 @@ var QwenAgent = class {
19192
19919
  async extMethodInternal(method, params) {
19193
19920
  const requestedCwd = typeof params["cwd"] === "string" ? params["cwd"] : void 0;
19194
19921
  const cwd = requestedCwd || process.cwd();
19195
- const SESSION_ID_RE = /^[0-9a-fA-F-]{32,36}$/;
19196
19922
  switch (method) {
19197
19923
  case SERVE_STATUS_EXT_METHODS.channelPing: {
19198
19924
  const nonce = params["nonce"];
@@ -19464,7 +20190,11 @@ var QwenAgent = class {
19464
20190
  "Invalid or missing sessionId"
19465
20191
  );
19466
20192
  }
19467
- return this.buildSessionTasksStatus(sessionId);
20193
+ const session = this.sessionOrThrow(sessionId);
20194
+ return await this.buildSessionTasksStatus(
20195
+ sessionId,
20196
+ params["includeWorkflows"] === true && this.canUseWorkflowControls(session.getConfig())
20197
+ );
19468
20198
  }
19469
20199
  case SERVE_STATUS_EXT_METHODS.sessionLspStatus: {
19470
20200
  const sessionId = params["sessionId"];
@@ -19707,6 +20437,10 @@ var QwenAgent = class {
19707
20437
  throw RequestError.invalidParams(void 0, "Invalid contextMode");
19708
20438
  }
19709
20439
  const contextMode = rawContextMode;
20440
+ const rawScope = params["scope"];
20441
+ if (rawScope !== void 0 && rawScope !== "project" && rawScope !== "user") {
20442
+ throw RequestError.invalidParams(void 0, "Invalid scope");
20443
+ }
19710
20444
  if (!this.config.isManagedMemoryAvailable()) {
19711
20445
  throw new RequestError(
19712
20446
  -32009,
@@ -19725,6 +20459,7 @@ var QwenAgent = class {
19725
20459
  projectRoot,
19726
20460
  content: content.trim(),
19727
20461
  contextMode,
20462
+ ...rawScope ? { scope: rawScope } : {},
19728
20463
  abortSignal: childSignal
19729
20464
  });
19730
20465
  if (result.filesTouched.length > 0) {
@@ -19795,6 +20530,10 @@ var QwenAgent = class {
19795
20530
  "Query exceeds maximum size"
19796
20531
  );
19797
20532
  }
20533
+ const rawScope = params["scope"];
20534
+ if (rawScope !== void 0 && rawScope !== "project" && rawScope !== "user") {
20535
+ throw RequestError.invalidParams(void 0, "Invalid scope");
20536
+ }
19798
20537
  if (!this.config.isManagedMemoryAvailable()) {
19799
20538
  throw new RequestError(
19800
20539
  -32009,
@@ -19811,7 +20550,8 @@ var QwenAgent = class {
19811
20550
  const hiddenConfig = createHiddenWorkspaceMemoryConfig(this.config);
19812
20551
  const result = await this.config.getMemoryManager().forget(projectRoot, trimmedQuery, {
19813
20552
  config: hiddenConfig,
19814
- abortSignal: childSignal
20553
+ abortSignal: childSignal,
20554
+ ...rawScope ? { scope: rawScope } : {}
19815
20555
  });
19816
20556
  return {
19817
20557
  summary: result.systemMessage ?? formatWorkspaceMemoryForgetSummary(result.removedEntries.length),
@@ -20049,9 +20789,9 @@ var QwenAgent = class {
20049
20789
  });
20050
20790
  await Promise.all(
20051
20791
  this.getLiveMcpConfigs(serverName).map(async (liveConfig) => {
20052
- const geminiClient = liveConfig.getGeminiClient?.();
20053
- if (geminiClient?.isInitialized?.()) {
20054
- await geminiClient.setTools?.();
20792
+ const llmClient = liveConfig.getLlmClient?.();
20793
+ if (llmClient?.isInitialized?.()) {
20794
+ await llmClient.setTools?.();
20055
20795
  }
20056
20796
  })
20057
20797
  );
@@ -20901,10 +21641,13 @@ var QwenAgent = class {
20901
21641
  { errorKind: "containment_violation", path: rootPath }
20902
21642
  );
20903
21643
  }
20904
- if (!isOwnerOnlyDirectory(rootBefore) || !isOwnerOnlyDirectory(rootAfter) || rootBefore.dev !== rootAfter.dev || rootBefore.ino !== rootAfter.ino || conversationDirectoryExpectation !== void 0 && (!isSameConversationPath(
21644
+ if (!isOwnerOnlyDirectory(rootBefore) || !isOwnerOnlyDirectory(rootAfter) || !isSameDirectoryIdentity(rootBefore, rootAfter) || conversationDirectoryExpectation !== void 0 && (!isSameConversationPath(
20905
21645
  canonicalRoot,
20906
21646
  conversationDirectoryExpectation.root.canonicalPath
20907
- ) || rootAfter.dev !== conversationDirectoryExpectation.root.device || rootAfter.ino !== conversationDirectoryExpectation.root.inode)) {
21647
+ ) || !hasExpectedManagedDirectoryIdentity(
21648
+ rootAfter,
21649
+ conversationDirectoryExpectation.root
21650
+ ))) {
20908
21651
  if (conversationDirectoryExpectation !== void 0) {
20909
21652
  throw managedConversationDirectoryError(false);
20910
21653
  }
@@ -20932,10 +21675,13 @@ var QwenAgent = class {
20932
21675
  );
20933
21676
  }
20934
21677
  const relativeTarget = path6.relative(canonicalRoot, canonicalPath);
20935
- if (!isOwnerOnlyDirectory(targetBefore) || !isOwnerOnlyDirectory(targetAfter) || targetBefore.dev !== targetAfter.dev || targetBefore.ino !== targetAfter.ino || conversationDirectoryExpectation !== void 0 && (!isSameConversationPath(
21678
+ if (!isOwnerOnlyDirectory(targetBefore) || !isOwnerOnlyDirectory(targetAfter) || !isSameDirectoryIdentity(targetBefore, targetAfter) || conversationDirectoryExpectation !== void 0 && (!isSameConversationPath(
20936
21679
  canonicalPath,
20937
21680
  conversationDirectoryExpectation.child.canonicalPath
20938
- ) || targetAfter.dev !== conversationDirectoryExpectation.child.device || targetAfter.ino !== conversationDirectoryExpectation.child.inode) || relativeTarget.length === 0 || relativeTarget.startsWith("..") || path6.isAbsolute(relativeTarget) || relativeTarget.includes(path6.sep)) {
21681
+ ) || !hasExpectedManagedDirectoryIdentity(
21682
+ targetAfter,
21683
+ conversationDirectoryExpectation.child
21684
+ )) || relativeTarget.length === 0 || relativeTarget.startsWith("..") || path6.isAbsolute(relativeTarget) || relativeTarget.includes(path6.sep)) {
20939
21685
  if (conversationDirectoryExpectation !== void 0) {
20940
21686
  throw managedConversationDirectoryError(false);
20941
21687
  }
@@ -20958,7 +21704,10 @@ var QwenAgent = class {
20958
21704
  { errorKind: "containment_violation", path: canonicalRoot }
20959
21705
  );
20960
21706
  }
20961
- if (!isOwnerOnlyDirectory(rootFinal) || rootFinal.dev !== rootAfter.dev || rootFinal.ino !== rootAfter.ino || conversationDirectoryExpectation !== void 0 && (rootFinal.dev !== conversationDirectoryExpectation.root.device || rootFinal.ino !== conversationDirectoryExpectation.root.inode)) {
21707
+ if (!isOwnerOnlyDirectory(rootFinal) || !isSameDirectoryIdentity(rootFinal, rootAfter) || conversationDirectoryExpectation !== void 0 && !hasExpectedManagedDirectoryIdentity(
21708
+ rootFinal,
21709
+ conversationDirectoryExpectation.root
21710
+ )) {
20962
21711
  if (conversationDirectoryExpectation !== void 0) {
20963
21712
  throw managedConversationDirectoryError(false);
20964
21713
  }
@@ -21065,7 +21814,7 @@ var QwenAgent = class {
21065
21814
  );
21066
21815
  }
21067
21816
  try {
21068
- await config.getGeminiClient()?.addWorkingDirectoryChangedContext(
21817
+ await config.getLlmClient()?.addWorkingDirectoryChangedContext(
21069
21818
  settledPreviousCwd,
21070
21819
  canonicalPath
21071
21820
  );
@@ -21243,7 +21992,7 @@ var QwenAgent = class {
21243
21992
  );
21244
21993
  }
21245
21994
  await cfg.refreshHierarchicalMemory();
21246
- await cfg.getGeminiClient()?.refreshSystemInstruction();
21995
+ await cfg.getLlmClient()?.refreshSystemInstruction();
21247
21996
  })
21248
21997
  );
21249
21998
  const failedCount = results.filter(
@@ -21409,7 +22158,7 @@ var QwenAgent = class {
21409
22158
  }
21410
22159
  let hasHistory = false;
21411
22160
  try {
21412
- hasHistory = (config.getGeminiClient().getHistoryShallow() ?? []).length > 0;
22161
+ hasHistory = (config.getLlmClient().getHistoryShallow() ?? []).length > 0;
21413
22162
  } catch (error) {
21414
22163
  debugLogger9.debug("Failed to read history before /fork:", error);
21415
22164
  }
@@ -21442,7 +22191,7 @@ var QwenAgent = class {
21442
22191
  );
21443
22192
  }
21444
22193
  try {
21445
- config.getGeminiClient().addHistory({
22194
+ config.getLlmClient().addHistory({
21446
22195
  role: "user",
21447
22196
  parts: [
21448
22197
  {
@@ -21474,9 +22223,9 @@ var QwenAgent = class {
21474
22223
  }
21475
22224
  const session = this.sessionOrThrow(sessionId);
21476
22225
  const config = session.getConfig();
21477
- const geminiClient = config.getGeminiClient();
22226
+ const llmClient = config.getLlmClient();
21478
22227
  const outputText = typeof params["output"] === "string" ? params["output"] : "";
21479
- geminiClient.addHistory({
22228
+ llmClient.addHistory({
21480
22229
  role: "user",
21481
22230
  parts: [
21482
22231
  {
@@ -21510,10 +22259,10 @@ ${outputText}
21510
22259
  );
21511
22260
  }
21512
22261
  const taskKind = params["taskKind"];
21513
- if (taskKind !== "agent" && taskKind !== "shell" && taskKind !== "monitor") {
22262
+ if (taskKind !== "agent" && taskKind !== "shell" && taskKind !== "monitor" && taskKind !== "workflow") {
21514
22263
  throw RequestError.invalidParams(
21515
22264
  void 0,
21516
- 'taskKind must be "agent", "shell", or "monitor"'
22265
+ 'taskKind must be "agent", "shell", "monitor", or "workflow"'
21517
22266
  );
21518
22267
  }
21519
22268
  debugLogger9.info(
@@ -21571,12 +22320,169 @@ ${outputText}
21571
22320
  );
21572
22321
  return { cancelled: true, status: task.status };
21573
22322
  }
22323
+ case "workflow": {
22324
+ if (!this.canUseWorkflowControls(config)) {
22325
+ return { cancelled: false, reason: "disabled" };
22326
+ }
22327
+ const registry = config.getWorkflowRunRegistry();
22328
+ const task = registry.get(taskId);
22329
+ if ((!task || isTerminalWorkflowStatus(task.status)) && registry.isStarting?.(taskId)) {
22330
+ registry.cancelStarting(taskId);
22331
+ debugLogger9.info(
22332
+ `sessionTaskCancel completed sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} status=starting`
22333
+ );
22334
+ return { cancelled: true, status: "cancelled" };
22335
+ }
22336
+ if (!task || task.status !== "running" && task.status !== "pausing" && task.status !== "paused") {
22337
+ const reason = task ? "not_running" : "not_found";
22338
+ debugLogger9.info(
22339
+ `sessionTaskCancel skipped sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} reason=${reason} status=${task?.status ?? "missing"}`
22340
+ );
22341
+ return { cancelled: false, reason, status: task?.status };
22342
+ }
22343
+ const handle = registry.getHandle(taskId);
22344
+ registry.cancel(taskId, Date.now());
22345
+ if (handle) await handle.completion;
22346
+ debugLogger9.info(
22347
+ `sessionTaskCancel completed sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} status=${task.status}`
22348
+ );
22349
+ return { cancelled: true, status: task.status };
22350
+ }
21574
22351
  default: {
21575
22352
  const exhaustive = taskKind;
21576
22353
  throw new Error(`Unhandled task kind: ${exhaustive}`);
21577
22354
  }
21578
22355
  }
21579
22356
  }
22357
+ case SERVE_CONTROL_EXT_METHODS.sessionWorkflowTaskAction: {
22358
+ const sessionId = params["sessionId"];
22359
+ if (typeof sessionId !== "string" || sessionId.length === 0) {
22360
+ throw RequestError.invalidParams(
22361
+ void 0,
22362
+ "Invalid or missing sessionId"
22363
+ );
22364
+ }
22365
+ const taskId = params["taskId"];
22366
+ if (typeof taskId !== "string" || taskId.length === 0) {
22367
+ throw RequestError.invalidParams(
22368
+ void 0,
22369
+ "Invalid or missing taskId"
22370
+ );
22371
+ }
22372
+ const action = params["action"];
22373
+ if (action !== "pause" && action !== "resume" && action !== "retry" && action !== "rerun" && action !== "delete-history" && action !== "run-saved") {
22374
+ throw RequestError.invalidParams(
22375
+ void 0,
22376
+ 'action must be "pause", "resume", "retry", "rerun", "delete-history", or "run-saved"'
22377
+ );
22378
+ }
22379
+ const session = this.sessionOrThrow(sessionId);
22380
+ const config = session.getConfig();
22381
+ if (!this.canUseWorkflowControls(config)) {
22382
+ return { changed: false };
22383
+ }
22384
+ const mutationClaim = action === "run-saved" ? getWorkflowTaskMutationKey(config, taskId, "saved") : getWorkflowTaskMutationKey(config, taskId);
22385
+ if (action === "delete-history") {
22386
+ const attempt = await tryWithWorkflowTaskMutation(
22387
+ mutationClaim,
22388
+ async () => {
22389
+ const changed2 = await session.deleteWorkflowHistory(taskId);
22390
+ if (changed2) {
22391
+ for (const [siblingId, sibling] of this.sessions) {
22392
+ if (siblingId === sessionId) continue;
22393
+ sibling.getConfig().getWorkflowRunRegistry().removeTerminal(taskId);
22394
+ sibling.noteExternalWorkflowDeletion(taskId);
22395
+ }
22396
+ }
22397
+ return { changed: changed2 };
22398
+ }
22399
+ );
22400
+ if (!attempt.acquired) {
22401
+ return { changed: false };
22402
+ }
22403
+ return attempt.value;
22404
+ }
22405
+ const registry = config.getWorkflowRunRegistry();
22406
+ if (action === "run-saved") {
22407
+ const attempt = await tryWithWorkflowTaskMutation(
22408
+ mutationClaim,
22409
+ async () => {
22410
+ const savedWorkflow = (await listSavedWorkflows(config)).find(
22411
+ (entry) => entry.name === taskId
22412
+ );
22413
+ if (!savedWorkflow) return { changed: false };
22414
+ const workflowTool = config.getToolRegistry().getTool(ToolNames.WORKFLOW);
22415
+ if (!isSessionOwnedWorkflowTool(workflowTool)) {
22416
+ throw RequestError.invalidParams(
22417
+ void 0,
22418
+ "The workflow tool is unavailable; cannot run this saved workflow."
22419
+ );
22420
+ }
22421
+ const result = await workflowTool.buildSessionOwnedBackground({
22422
+ scriptPath: savedWorkflow.scriptPath
22423
+ }).execute(new AbortController().signal);
22424
+ const startedTask = result.workflowRunId ? registry.get(result.workflowRunId) : void 0;
22425
+ return startedTask ? {
22426
+ changed: true,
22427
+ status: startedTask.status,
22428
+ taskId: startedTask.runId
22429
+ } : { changed: false };
22430
+ }
22431
+ );
22432
+ if (!attempt.acquired) {
22433
+ return { changed: false };
22434
+ }
22435
+ return attempt.value;
22436
+ }
22437
+ const task = registry.get(taskId);
22438
+ if (!task) return { changed: false };
22439
+ if (action === "retry" || action === "rerun") {
22440
+ const liveElsewhere = action === "retry" && (registry.isStarting?.(taskId) === true || this.isWorkflowRunLiveOutsideSession(sessionId, taskId));
22441
+ const canStart = action === "retry" ? task.status === "failed" && !registry.getHandle(taskId) && !liveElsewhere : task.status === "completed" || task.status === "failed" || task.status === "cancelled";
22442
+ if (!canStart || !task.script) {
22443
+ return { changed: false, status: task.status };
22444
+ }
22445
+ const attempt = await tryWithWorkflowTaskMutation(
22446
+ mutationClaim,
22447
+ async () => {
22448
+ const workflowTool = config.getToolRegistry().getTool(ToolNames.WORKFLOW);
22449
+ if (!isSessionOwnedWorkflowTool(workflowTool)) {
22450
+ throw RequestError.invalidParams(
22451
+ void 0,
22452
+ `The workflow tool is unavailable; cannot ${action} this run.`
22453
+ );
22454
+ }
22455
+ const startParams = {
22456
+ script: task.script,
22457
+ args: task.args,
22458
+ ...action === "retry" ? { resumeFromRunId: task.runId } : {}
22459
+ };
22460
+ const result = await workflowTool.buildSessionOwnedBackground(startParams).execute(new AbortController().signal);
22461
+ if (action === "rerun") {
22462
+ const rerunTask = result.workflowRunId ? registry.get(result.workflowRunId) : void 0;
22463
+ if (rerunTask) {
22464
+ registry.setLineage(rerunTask.runId, task.runId, "rerun");
22465
+ }
22466
+ return rerunTask ? {
22467
+ changed: true,
22468
+ status: rerunTask.status,
22469
+ taskId: rerunTask.runId
22470
+ } : { changed: false, status: task.status };
22471
+ }
22472
+ return result.workflowRunId ? {
22473
+ changed: true,
22474
+ status: registry.get(result.workflowRunId)?.status
22475
+ } : { changed: false, status: task.status };
22476
+ }
22477
+ );
22478
+ if (!attempt.acquired) {
22479
+ return { changed: false, status: task.status };
22480
+ }
22481
+ return attempt.value;
22482
+ }
22483
+ const changed = action === "pause" ? registry.pause(taskId) : registry.resume(taskId);
22484
+ return { changed, status: task.status };
22485
+ }
21580
22486
  case SERVE_CONTROL_EXT_METHODS.sessionGoalClear: {
21581
22487
  const sessionId = params["sessionId"];
21582
22488
  if (typeof sessionId !== "string" || sessionId.length === 0) {
@@ -21846,6 +22752,14 @@ ${outputText}
21846
22752
  case SERVE_CONTROL_EXT_METHODS.workspaceExtensionsRefresh: {
21847
22753
  const sessionId = params["sessionId"];
21848
22754
  const rawRefreshBootstrap = params["refreshBootstrap"];
22755
+ const rawSkillsOnly = params["skillsOnly"];
22756
+ if (rawSkillsOnly !== void 0 && typeof rawSkillsOnly !== "boolean") {
22757
+ throw RequestError.invalidParams(
22758
+ void 0,
22759
+ "skillsOnly must be a boolean"
22760
+ );
22761
+ }
22762
+ const skillsOnly = rawSkillsOnly === true;
21849
22763
  if (rawRefreshBootstrap !== void 0 && typeof rawRefreshBootstrap !== "boolean") {
21850
22764
  throw RequestError.invalidParams(
21851
22765
  void 0,
@@ -21863,16 +22777,25 @@ ${outputText}
21863
22777
  errors.push(error);
21864
22778
  }
21865
22779
  }, "runRefresh");
22780
+ if (skillsOnly) {
22781
+ await runRefresh(async () => session.reloadSkillSettings());
22782
+ }
21866
22783
  await runRefresh(async () => await extensionManager.refreshCache());
21867
- await runRefresh(async () => await extensionManager.refreshTools());
22784
+ if (skillsOnly) {
22785
+ await runRefresh(
22786
+ async () => await config.getSkillManager()?.refreshCache({ throwOnError: true })
22787
+ );
22788
+ } else {
22789
+ await runRefresh(async () => await extensionManager.refreshTools());
22790
+ }
21868
22791
  const bootstrapConfig = this.config;
21869
22792
  if (rawRefreshBootstrap !== false && bootstrapConfig !== config) {
21870
22793
  await runRefresh(
21871
- async () => await this.refreshBootstrapExtensionStatus()
22794
+ async () => await this.refreshBootstrapExtensionStatus(skillsOnly)
21872
22795
  );
21873
22796
  }
21874
22797
  const discoveryConfig = this.workspaceMcpDiscoveryConfig;
21875
- if (discoveryConfig && discoveryConfig !== config) {
22798
+ if (!skillsOnly && discoveryConfig && discoveryConfig !== config) {
21876
22799
  const discoveryExtensionManager = discoveryConfig.getExtensionManager();
21877
22800
  await runRefresh(
21878
22801
  async () => await discoveryExtensionManager.refreshCache()
@@ -21882,10 +22805,13 @@ ${outputText}
21882
22805
  );
21883
22806
  }
21884
22807
  await runRefresh(
21885
- async () => await config.getGeminiClient()?.refreshSystemInstruction()
22808
+ async () => await config.getLlmClient()?.refreshSystemInstruction()
21886
22809
  );
21887
22810
  await runRefresh(
21888
- async () => await session.sendAvailableCommandsUpdate()
22811
+ async () => skillsOnly ? await session.refreshSkillsFromSettings({
22812
+ reloadSettings: false,
22813
+ notifyConfigChanged: false
22814
+ }) : await session.sendAvailableCommandsUpdate()
21889
22815
  );
21890
22816
  if (errors.length > 0) {
21891
22817
  const details = errors.map(
@@ -22527,6 +23453,52 @@ ${outputText}
22527
23453
  this.syncLivePermissionManagers(before, after);
22528
23454
  return buildPermissionSettings(settings);
22529
23455
  }
23456
+ case SERVE_CONTROL_EXT_METHODS.workspaceModelProvidersReload: {
23457
+ if (!this.settings.reloadScopesFromDiskAtomically([
23458
+ "User" /* User */,
23459
+ "Workspace" /* Workspace */
23460
+ ])) {
23461
+ debugLogger9.warn("Model-provider settings reload failed");
23462
+ return { configsRefreshed: 0, configsFailed: 1 };
23463
+ }
23464
+ this.modelProviderReloadRevision += 1;
23465
+ const merged = this.settings.merged;
23466
+ reloadEnvironment(merged, cwd);
23467
+ const providerProtocol = merged.providerProtocol ?? {};
23468
+ let configsRefreshed = 0;
23469
+ let configsFailed = 0;
23470
+ const reloadConfig = /* @__PURE__ */ __name((config, id) => {
23471
+ try {
23472
+ config.reloadModelProvidersConfig(
23473
+ merged.modelProviders,
23474
+ providerProtocol
23475
+ );
23476
+ configsRefreshed += 1;
23477
+ } catch {
23478
+ configsFailed += 1;
23479
+ debugLogger9.warn(`Model-provider reload failed for ${id}`);
23480
+ }
23481
+ }, "reloadConfig");
23482
+ reloadConfig(this.config, "bootstrap");
23483
+ for (const config of this.initializingConfigs) {
23484
+ if (config !== this.config) {
23485
+ reloadConfig(config, `initializing:${config.getSessionId()}`);
23486
+ }
23487
+ }
23488
+ for (const [id, session] of this.sessions) {
23489
+ try {
23490
+ session.reloadModelProvidersFromDisk();
23491
+ configsRefreshed += 1;
23492
+ } catch {
23493
+ configsFailed += 1;
23494
+ debugLogger9.warn(`Model-provider reload failed for session ${id}`);
23495
+ }
23496
+ }
23497
+ return {
23498
+ configsRefreshed,
23499
+ configsFailed
23500
+ };
23501
+ }
22530
23502
  case SERVE_CONTROL_EXT_METHODS.workspaceReload: {
22531
23503
  const oldMerged = structuredClone(this.settings.merged);
22532
23504
  this.settings.reloadScopeFromDisk("User" /* User */);
@@ -22535,6 +23507,10 @@ ${outputText}
22535
23507
  const envResult = reloadEnvironment(newMerged, cwd);
22536
23508
  const changed = diffSettingsKeys(oldMerged, newMerged);
22537
23509
  const envChanged = envResult.updatedKeys.length > 0 || envResult.removedKeys.length > 0;
23510
+ const providersChanged = changed.has("modelProviders") || changed.has("providerProtocol");
23511
+ if (providersChanged) {
23512
+ this.modelProviderReloadRevision += 1;
23513
+ }
22538
23514
  const sessions = [...this.sessions.entries()];
22539
23515
  const refreshed = [];
22540
23516
  const skipped = [];
@@ -22546,7 +23522,6 @@ ${outputText}
22546
23522
  }
22547
23523
  const config = session.getConfig();
22548
23524
  const authType = config.getAuthType();
22549
- const providersChanged = changed.has("modelProviders") || changed.has("providerProtocol");
22550
23525
  if (providersChanged) {
22551
23526
  try {
22552
23527
  config.reloadModelProvidersConfig(
@@ -22582,6 +23557,19 @@ ${outputText}
22582
23557
  newMerged.tools?.disabled
22583
23558
  );
22584
23559
  config.setDisabledTools(new Set(disabled));
23560
+ const workflowsWereEnabled = config.isWorkflowsEnabled();
23561
+ config.setWorkflowsEnabled(
23562
+ newMerged.tools?.workflowsEnabled === true
23563
+ );
23564
+ if (config.isWorkflowsEnabled() !== workflowsWereEnabled) {
23565
+ try {
23566
+ await session.sendAvailableCommandsUpdate();
23567
+ } catch (err) {
23568
+ debugLogger9.warn(
23569
+ `reload: sendAvailableCommandsUpdate failed for session ${id}: ${err}`
23570
+ );
23571
+ }
23572
+ }
22585
23573
  const newMode = newMerged.tools?.approvalMode;
22586
23574
  if (newMode && APPROVAL_MODES.includes(newMode) && newMode !== config.getApprovalMode()) {
22587
23575
  try {
@@ -22605,7 +23593,7 @@ ${outputText}
22605
23593
  );
22606
23594
  }
22607
23595
  try {
22608
- await config.getGeminiClient()?.refreshSystemInstruction();
23596
+ await config.getLlmClient()?.refreshSystemInstruction();
22609
23597
  } catch (err) {
22610
23598
  debugLogger9.warn(
22611
23599
  `reload: refreshSystemInstruction failed for session ${id}: ${err}`
@@ -22805,25 +23793,34 @@ ${outputText}
22805
23793
  }
22806
23794
  }
22807
23795
  async newSessionConfig(cwd, mcpServers, settings, sessionSource, sessionId, resume, initializeOptions = {}, chatRecording, restoreOptions) {
23796
+ const preserveIdlessSession = sessionId === void 0 && chatRecording === false;
23797
+ const inheritedSessionId = preserveIdlessSession ? sessionIdContext.getStore() : void 0;
23798
+ const sessionIdGenerated = sessionId === void 0 && !preserveIdlessSession;
23799
+ const effectiveSessionId = sessionId ?? (sessionIdGenerated ? randomUUID2() : void 0);
23800
+ const debugSessionId = effectiveSessionId ?? inheritedSessionId ?? "transcript-replay";
22808
23801
  try {
22809
23802
  this.assertManagedSessionAdmission();
22810
- return await this.runWithPinnedRuntimeBaseDir(settings, cwd, async () => {
22811
- await this.retryPendingConfigCleanup(
22812
- Storage.getRuntimeBaseDir(),
22813
- sessionId
22814
- );
22815
- return this.newSessionConfigInRuntimeContext(
22816
- cwd,
22817
- mcpServers,
22818
- settings,
22819
- sessionSource,
22820
- sessionId,
22821
- resume,
22822
- initializeOptions,
22823
- chatRecording,
22824
- restoreOptions
22825
- );
22826
- });
23803
+ return await sessionIdContext.run(
23804
+ debugSessionId,
23805
+ () => this.runWithPinnedRuntimeBaseDir(settings, cwd, async () => {
23806
+ await this.retryPendingConfigCleanup(
23807
+ Storage.getRuntimeBaseDir(),
23808
+ effectiveSessionId
23809
+ );
23810
+ return this.newSessionConfigInRuntimeContext(
23811
+ cwd,
23812
+ mcpServers,
23813
+ settings,
23814
+ sessionSource,
23815
+ effectiveSessionId,
23816
+ resume,
23817
+ initializeOptions,
23818
+ chatRecording,
23819
+ restoreOptions,
23820
+ sessionIdGenerated
23821
+ );
23822
+ })
23823
+ );
22827
23824
  } catch (error) {
22828
23825
  if (error instanceof SessionIdConflictError) {
22829
23826
  throw new RequestError(ACP_ERROR_CODES.INVALID_PARAMS, error.message, {
@@ -22840,7 +23837,7 @@ ${outputText}
22840
23837
  throw sessionId && restoreOptions ? mapSessionRestoreRequestError(error, sessionId) : error;
22841
23838
  }
22842
23839
  }
22843
- async newSessionConfigInRuntimeContext(cwd, mcpServers, settings, sessionSource, sessionId, resume, initializeOptions = {}, chatRecording, restoreOptions) {
23840
+ async newSessionConfigInRuntimeContext(cwd, mcpServers, settings, sessionSource, sessionId, resume, initializeOptions = {}, chatRecording, restoreOptions, sessionIdGenerated) {
22844
23841
  const provisionalWorkspace = isReservedStandaloneSessionSourceType(
22845
23842
  sessionSource?.sourceType
22846
23843
  );
@@ -22902,7 +23899,11 @@ ${outputText}
22902
23899
  ...sessionSource?.sourceType === "channel" ? { cron: false } : {}
22903
23900
  }
22904
23901
  };
22905
- const sessionArg = resume === true ? { resume: sessionId, sessionId: void 0 } : { sessionId, resume: void 0 };
23902
+ const sessionArg = resume === true ? { resume: sessionId, sessionId: void 0 } : {
23903
+ sessionId,
23904
+ sessionIdGenerated: sessionIdGenerated === true || void 0,
23905
+ resume: void 0
23906
+ };
22906
23907
  const argvForSession = {
22907
23908
  ...this.argv,
22908
23909
  ...provisionalWorkspace ? { experimentalLsp: false } : {},
@@ -22955,7 +23956,8 @@ ${outputText}
22955
23956
  ), "projectionSource")
22956
23957
  }
22957
23958
  } : {}
22958
- } : void 0
23959
+ } : void 0,
23960
+ buildEnabledSkillNamesProvider(settings)
22959
23961
  );
22960
23962
  if (sessionSource) {
22961
23963
  config.setSessionSource(sessionSource.sourceType, sessionSource.sourceId);
@@ -22992,16 +23994,18 @@ ${outputText}
22992
23994
  const wiredSessionId = typeof config.getSessionId === "function" ? config.getSessionId() : void 0;
22993
23995
  const skipPerSessionBudgetCallback = this.workspaceMcpBudget !== void 0;
22994
23996
  if (!skipPerSessionBudgetCallback && typeof config.setMcpBudgetEventCallback === "function" && wiredSessionId !== void 0) {
22995
- const sid = wiredSessionId;
23997
+ const acpSessionId = wiredSessionId;
22996
23998
  config.setMcpBudgetEventCallback((event) => {
22997
- void this.connection.extNotification("qwen/notify/session/mcp-budget-event", {
22998
- v: 1,
22999
- sessionId: sid,
23000
- ...event
23001
- }).catch((err) => {
23002
- debugLogger9.debug(
23003
- `MCP budget extNotification dropped (session=${sid}, kind=${event.kind}): ${err instanceof Error ? err.message : String(err)}`
23004
- );
23999
+ sessionIdContext.run(config.getSessionId(), () => {
24000
+ void this.connection.extNotification("qwen/notify/session/mcp-budget-event", {
24001
+ v: 1,
24002
+ sessionId: acpSessionId,
24003
+ ...event
24004
+ }).catch((err) => {
24005
+ debugLogger9.debug(
24006
+ `MCP budget extNotification dropped (session=${acpSessionId}, kind=${event.kind}): ${err instanceof Error ? err.message : String(err)}`
24007
+ );
24008
+ });
23005
24009
  });
23006
24010
  });
23007
24011
  }
@@ -23080,14 +24084,82 @@ ${outputText}
23080
24084
  );
23081
24085
  config.setFileSystemService(acpFileSystemService);
23082
24086
  }
24087
+ /**
24088
+ * All sessions in this child share one workflow snapshot store but each
24089
+ * keeps a private run registry, so one session's history deletion must
24090
+ * see every sibling registry — or it can delete a run another session
24091
+ * is still executing or settling. A handle outlives the terminal
24092
+ * transition until the snapshot write lands, so it blocks too.
24093
+ *
24094
+ * R7-10: iterating `this.sessions` alone left a blind spot the width of
24095
+ * a whole run. A workflow can outlive its owning session's removal —
24096
+ * explicit close/kill/shutdown use force semantics, and a background
24097
+ * run owns a detached controller — so once `removeStoredSessionEntry`
24098
+ * deleted the session, a still-settling run became invisible here and
24099
+ * unreachable by the delete handler's sibling `removeTerminal` loop. A
24100
+ * sibling `delete-history` then passed every check, removed the LIVE
24101
+ * run's journal directory and snapshot, and answered `{changed: true}`;
24102
+ * the orphan kept going and its settlement `writeWorkflowSnapshot`
24103
+ * recreated the file — resurrection, plus a run whose journal was rm'd
24104
+ * under it.
24105
+ *
24106
+ * The repair has two halves. `Session.dispose()` now aborts its
24107
+ * workflow registry the way it already aborts the agent registry, so an
24108
+ * orphan settles instead of running on; and the registry of a removed
24109
+ * session stays reachable here until its runs drain, so the gate keeps
24110
+ * answering for the settlement window that abort cannot compress to
24111
+ * zero (the handle is released only after the snapshot write lands).
24112
+ */
24113
+ isWorkflowRunLiveOutsideSession(excludeSessionId, runId) {
24114
+ for (const [sessionId, session] of this.sessions) {
24115
+ if (sessionId === excludeSessionId) continue;
24116
+ if (_QwenAgent.isWorkflowRunLiveInRegistry(
24117
+ session.getConfig().getWorkflowRunRegistry(),
24118
+ runId
24119
+ )) {
24120
+ return true;
24121
+ }
24122
+ }
24123
+ this.pruneDrainedWorkflowRegistries();
24124
+ for (const registry of this.detachedWorkflowRegistries) {
24125
+ if (_QwenAgent.isWorkflowRunLiveInRegistry(registry, runId)) return true;
24126
+ }
24127
+ return false;
24128
+ }
24129
+ static isWorkflowRunLiveInRegistry(registry, runId) {
24130
+ if (registry.isStarting?.(runId)) return true;
24131
+ const entry = registry.get(runId);
24132
+ if (entry && !isTerminalWorkflowStatus(entry.status)) return true;
24133
+ return registry.getHandle(runId) !== void 0;
24134
+ }
24135
+ /**
24136
+ * Registries of removed sessions are retained only while they still
24137
+ * hold work — an aborted run keeps its handle until settlement releases
24138
+ * it. Dropping drained ones keeps this from becoming a leak that grows
24139
+ * with every closed session.
24140
+ */
24141
+ pruneDrainedWorkflowRegistries() {
24142
+ for (const registry of this.detachedWorkflowRegistries) {
24143
+ if (!_QwenAgent.isWorkflowRegistryDraining(registry)) {
24144
+ this.detachedWorkflowRegistries.delete(registry);
24145
+ }
24146
+ }
24147
+ }
24148
+ /** Still holding work: an active entry, or a handle awaiting settlement. */
24149
+ static isWorkflowRegistryDraining(registry) {
24150
+ if (registry.hasRunningEntries?.()) return true;
24151
+ return registry.list?.().some((entry) => registry.getHandle(entry.runId)) ?? false;
24152
+ }
23083
24153
  async createAndStoreSession(config, settings, sessionData, options = {}) {
24154
+ options.signal?.throwIfAborted();
23084
24155
  this.assertManagedSessionAdmission();
23085
24156
  const sessionId = normalizeSessionIdForLookup(config.getSessionId());
23086
- const geminiClient = config.getGeminiClient();
23087
- const needsInitialize = !geminiClient.isInitialized();
24157
+ const llmClient = config.getLlmClient();
24158
+ const needsInitialize = !llmClient.isInitialized();
23088
24159
  if (needsInitialize && options.deferWorkspaceActivation !== true) {
23089
- await geminiClient.initialize();
24160
+ await llmClient.initialize(void 0, options.signal);
23090
24161
  }
24162
+ options.signal?.throwIfAborted();
23091
24163
  this.assertManagedSessionAdmission();
23092
24164
  if (this.sessions.has(sessionId)) {
23093
24165
  throw new RequestError(
@@ -23097,6 +24169,7 @@ ${outputText}
23097
24169
  );
23098
24170
  }
23099
24171
  await options.prepareBeforeSessionCreate?.();
24172
+ options.signal?.throwIfAborted();
23100
24173
  this.assertManagedSessionAdmission();
23101
24174
  if (this.sessions.has(sessionId)) {
23102
24175
  throw new RequestError(
@@ -23105,14 +24178,16 @@ ${outputText}
23105
24178
  { errorKind: "session_id_conflict", sessionId }
23106
24179
  );
23107
24180
  }
23108
- options.beforeSessionCreate?.();
24181
+ const workflowHistory = await listWorkflowSnapshots(config);
23109
24182
  const session = new Session(
23110
24183
  sessionId,
23111
24184
  config,
23112
24185
  this.connection,
23113
24186
  settings,
23114
24187
  (operation) => this.runExclusiveHistoryMutation(sessionId, operation),
23115
- () => this.activeWorkReporter?.notifyChanged()
24188
+ () => this.activeWorkReporter?.notifyChanged(),
24189
+ workflowHistory,
24190
+ (runId) => this.isWorkflowRunLiveOutsideSession(sessionId, runId)
23116
24191
  );
23117
24192
  const replaySessionHistory = /* @__PURE__ */ __name(async () => {
23118
24193
  if (options.replayHistory === false || !sessionData?.conversation.messages) {
@@ -23136,6 +24211,17 @@ ${outputText}
23136
24211
  session.installManagedConversationActivation(
23137
24212
  async () => {
23138
24213
  this.assertManagedSessionAdmission();
24214
+ const settingsReloaded = settings.reloadScopesFromDiskAtomically?.([
24215
+ "User" /* User */,
24216
+ "Workspace" /* Workspace */
24217
+ ]) !== false;
24218
+ if (settingsReloaded) {
24219
+ reloadEnvironment(settings.merged, config.getTargetDir());
24220
+ } else {
24221
+ debugLogger9.warn(
24222
+ "Deferred session settings reload failed; keeping current environment"
24223
+ );
24224
+ }
23139
24225
  if (options.beforeDeferredWorkspaceActivation) {
23140
24226
  await options.beforeDeferredWorkspaceActivation();
23141
24227
  } else {
@@ -23163,6 +24249,50 @@ ${outputText}
23163
24249
  let published = false;
23164
24250
  try {
23165
24251
  await registerCreateSubSessionTool(config);
24252
+ options.signal?.throwIfAborted();
24253
+ let forceAuthenticationRefresh = options.deferWorkspaceActivation !== true && options.configProviderRevision !== this.modelProviderReloadRevision;
24254
+ while (true) {
24255
+ const providerReloadRevision = this.modelProviderReloadRevision;
24256
+ const previousModelProviders = settings.merged.modelProviders;
24257
+ const previousProviderProtocol = settings.merged.providerProtocol;
24258
+ const settingsReloaded = settings.reloadScopesFromDiskAtomically?.([
24259
+ "User" /* User */,
24260
+ "Workspace" /* Workspace */
24261
+ ]) !== false;
24262
+ if (!settingsReloaded) {
24263
+ if (providerReloadRevision !== options.configProviderRevision) {
24264
+ throw new Error(
24265
+ "Unable to reload model-provider settings from disk."
24266
+ );
24267
+ }
24268
+ debugLogger9.warn(
24269
+ "Final model-provider settings reload failed; keeping current settings"
24270
+ );
24271
+ }
24272
+ config.reloadModelProvidersConfig?.(
24273
+ settings.merged.modelProviders,
24274
+ settings.merged.providerProtocol ?? {}
24275
+ );
24276
+ if (options.deferWorkspaceActivation !== true) {
24277
+ const envReload = reloadEnvironment(
24278
+ settings.merged,
24279
+ config.getTargetDir()
24280
+ );
24281
+ const providerSettingsChanged = !isDeepStrictEqual(
24282
+ previousModelProviders,
24283
+ settings.merged.modelProviders
24284
+ ) || !isDeepStrictEqual(
24285
+ previousProviderProtocol,
24286
+ settings.merged.providerProtocol
24287
+ );
24288
+ if (forceAuthenticationRefresh || providerSettingsChanged || envReload.updatedKeys.length > 0 || envReload.removedKeys.length > 0) {
24289
+ await this.ensureAuthenticated(config);
24290
+ }
24291
+ }
24292
+ if (providerReloadRevision === this.modelProviderReloadRevision) break;
24293
+ forceAuthenticationRefresh = true;
24294
+ }
24295
+ options.beforeSessionPublish?.();
23166
24296
  options.primeSession?.(session);
23167
24297
  if (options.deferWorkspaceActivation !== true) {
23168
24298
  config.hydrateSessionRestoreFileHistory?.();
@@ -23299,11 +24429,29 @@ ${outputText}
23299
24429
  currentValue: currentModelId,
23300
24430
  options: configModelOptions
23301
24431
  };
23302
- const modelReasoning = this.getModelReasoningConfiguration(config);
24432
+ const generation = config.getContentGeneratorConfig();
24433
+ const modelReasoning = this.getModelReasoningConfiguration(
24434
+ config,
24435
+ currentModelId
24436
+ );
23303
24437
  const currentModelEffort = config.getReasoningEffort?.();
24438
+ const reasoningOverride = config.getReasoningEffortOverride?.();
24439
+ const reasoningOverrideValue = reasoningOverride ? generation[reasoningOverride.source]?.[reasoningOverride.field] : void 0;
24440
+ const normalizedEffortOverride = reasoningOverride?.field === "reasoning_effort" && typeof reasoningOverrideValue === "string" ? reasoningOverrideValue === "minimal" ? "low" : REASONING_EFFORT_TIERS.find(
24441
+ (effort) => effort === reasoningOverrideValue
24442
+ ) : void 0;
24443
+ const normalizedBudgetOverride = reasoningOverride?.field === "thinking_budget" && typeof reasoningOverrideValue === "number" && Number.isFinite(reasoningOverrideValue) && reasoningOverrideValue >= 0 && reasoningOverrideValue <= 262144 ? reasoningOverrideValue <= 4096 ? "low" : reasoningOverrideValue <= 16384 ? "medium" : "xhigh" : void 0;
24444
+ const normalizedOverrideEffort = normalizedEffortOverride ?? normalizedBudgetOverride;
24445
+ const overrideDisablesReasoning = reasoningOverride?.field === "enable_thinking" && reasoningOverrideValue === false || reasoningOverride?.field === "reasoning_effort" && reasoningOverrideValue === REASONING_EFFORT_NONE;
24446
+ const mandatoryUsesDefaultEffort = generation.thinkingMandatory === true && (overrideDisablesReasoning || generation.reasoning === false && reasoningOverride?.field === "reasoning_effort");
24447
+ const effectiveModelEffort = modelReasoning && !modelReasoning.toggleOnly ? mandatoryUsesDefaultEffort ? modelReasoning.defaultEffort : normalizedOverrideEffort ? modelReasoning.efforts.find(
24448
+ (effort) => effort === normalizedOverrideEffort
24449
+ ) ?? modelReasoning.defaultEffort : currentModelEffort : currentModelEffort;
24450
+ const reasoningEnabled = generation.reasoning !== false && (!reasoningOverride || !overrideDisablesReasoning);
23304
24451
  const reasoningEffortConfigOption = (modelReasoning ? buildModelReasoningConfigOption(rawCurrentModelId, {
23305
- enabled: config.getContentGeneratorConfig().reasoning !== false,
23306
- effort: currentModelEffort
24452
+ enabled: reasoningEnabled,
24453
+ effort: effectiveModelEffort,
24454
+ thinkingMandatory: generation.thinkingMandatory === true
23307
24455
  }) : void 0) ?? {
23308
24456
  id: "reasoning_effort",
23309
24457
  name: "Reasoning effort",
@@ -23326,13 +24474,21 @@ ${outputText}
23326
24474
  };
23327
24475
  return [modeConfigOption, modelConfigOption, reasoningEffortConfigOption];
23328
24476
  }
23329
- getModelReasoningConfiguration(config) {
23330
- if (config.getActiveRuntimeModelSnapshot?.() || config.getReasoningEffortOverride?.() || config.getContentGeneratorConfig().thinkingMandatory === true) {
24477
+ getModelReasoningConfiguration(config, currentAcpModelId) {
24478
+ if (config.getActiveRuntimeModelSnapshot?.()) {
24479
+ return void 0;
24480
+ }
24481
+ const completeModelId = currentAcpModelId ?? getCurrentAcpModelId(
24482
+ this.buildSelectableModelOptions(config),
24483
+ (config.getModel() || "").trim(),
24484
+ config.getAuthType?.(),
24485
+ config.getCurrentModelRegistryBaseUrl?.()
24486
+ );
24487
+ if (completeModelId.startsWith(ACP_ROUTE_ID_PREFIX)) {
23331
24488
  return void 0;
23332
24489
  }
23333
24490
  const reasoning = getModelConfiguration(config.getModel())?.reasoning;
23334
- const currentEffort = config.getReasoningEffort?.();
23335
- return reasoning?.thinking && (reasoning.toggleOnly || !currentEffort || reasoning.efforts.includes(currentEffort)) ? reasoning : void 0;
24491
+ return reasoning?.thinking ? reasoning : void 0;
23336
24492
  }
23337
24493
  buildSelectableModelOptions(config) {
23338
24494
  const currentAuthType = config.getAuthType();