@qwen-code/qwen-code 0.23.0 → 0.23.1-preview.1

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 (453) hide show
  1. package/bundled/new-app/SKILL.md +1 -1
  2. package/bundled/qc-helper/docs/configuration/auth.md +84 -12
  3. package/bundled/qc-helper/docs/configuration/settings.md +76 -74
  4. package/bundled/qc-helper/docs/features/arena.md +15 -20
  5. package/bundled/qc-helper/docs/features/channels/overview.md +7 -2
  6. package/bundled/qc-helper/docs/features/code-review.md +22 -19
  7. package/bundled/qc-helper/docs/features/commands.md +51 -10
  8. package/bundled/qc-helper/docs/features/followup-suggestions.md +1 -1
  9. package/bundled/qc-helper/docs/features/goals.md +8 -0
  10. package/bundled/qc-helper/docs/features/headless.md +2 -2
  11. package/bundled/qc-helper/docs/features/hooks.md +19 -19
  12. package/bundled/qc-helper/docs/features/output-styles.md +35 -2
  13. package/bundled/qc-helper/docs/qwen-serve.md +67 -52
  14. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +3 -1
  15. package/bundled/qc-helper/docs/support/troubleshooting.md +3 -3
  16. package/bundled/review/SKILL.md +45 -41
  17. package/bundled/review/references/aone.md +1 -1
  18. package/bundled/review/references/posting.md +1 -1
  19. package/bundled/workflow-creator/SKILL.md +48 -0
  20. package/bundled/zvec-grep-install/SKILL.md +57 -0
  21. package/chunks/MaxSizedBox-5ARLO5PR.js +116 -0
  22. package/chunks/{StandaloneSessionPicker-QUMO4LLQ.js → StandaloneSessionPicker-T6B322CB.js} +87 -82
  23. package/chunks/{acp-startup-profiler-M4X5F3VK.js → acp-startup-profiler-6ULXXQMS.js} +2 -2
  24. package/chunks/{acpAgent-2GTFCIEP.js → acpAgent-WTDEY5KD.js} +1041 -364
  25. package/chunks/{agent-XKF5SZWU.js → agent-NXPUXEVZ.js} +46 -43
  26. package/chunks/agent-headless-QQZTWOKO.js +88 -0
  27. package/chunks/{anthropicContentGenerator-L76MR5OR.js → anthropicContentGenerator-6XDHXIII.js} +16 -9
  28. package/chunks/{artifact-tool-MYCL2QCS.js → artifact-tool-DFVVJXL2.js} +3 -3
  29. package/chunks/askUserQuestion-GF7VQ44M.js +14 -0
  30. package/chunks/bridge-OHY5OGOZ.js +123 -0
  31. package/chunks/{ca-BNU7YNDE.js → ca-KC2AISNS.js} +1 -0
  32. package/chunks/{channel-management-service-4MTCEGJB.js → channel-management-service-ZDDG3G5S.js} +4 -4
  33. package/chunks/channel-settings-store-7BJAS2SU.js +126 -0
  34. package/chunks/{channel-worker-group-47F4ISUZ.js → channel-worker-group-2ISMRENV.js} +6 -6
  35. package/chunks/{channel-worker-manager-I5Y44GYR.js → channel-worker-manager-VSRPVPRH.js} +6 -6
  36. package/chunks/{channel-worker-supervisor-6VCLUXFE.js → channel-worker-supervisor-SRJBK72Z.js} +4 -4
  37. package/chunks/{chunk-5RTTI4GE.js → chunk-2RYWGYB3.js} +4 -3
  38. package/chunks/{chunk-FUO5V5KI.js → chunk-2UWQX4FP.js} +2 -2
  39. package/chunks/{chunk-L26ONV2Y.js → chunk-2WGJG2KW.js} +9 -8
  40. package/chunks/{chunk-JHN7UIDW.js → chunk-2XRE4KE4.js} +1 -1
  41. package/chunks/chunk-32CM56LO.js +20 -0
  42. package/chunks/{chunk-SI7WDR3U.js → chunk-32YDNYXP.js} +129 -14
  43. package/chunks/{chunk-ZHO2CW6D.js → chunk-3CZ2BQV6.js} +1 -1
  44. package/chunks/{chunk-FD5SJOWT.js → chunk-3K456UJF.js} +9 -4
  45. package/chunks/{chunk-5M6IDOMF.js → chunk-3K65MUKD.js} +105 -0
  46. package/chunks/chunk-3UMWOKJC.js +78 -0
  47. package/chunks/{chunk-UM2FFKXN.js → chunk-43JNQAHO.js} +3 -3
  48. package/chunks/{chunk-KM3XVTMO.js → chunk-43NOB5NM.js} +112 -12
  49. package/chunks/{chunk-G5PBOQWI.js → chunk-47BZVBTE.js} +3 -3
  50. package/chunks/{chunk-32LU3APX.js → chunk-4F2QRVW6.js} +1 -1
  51. package/chunks/{chunk-KMU3ZHH4.js → chunk-4HC4DYKN.js} +2 -2
  52. package/chunks/{chunk-22UH7VTP.js → chunk-4HOEU2OR.js} +1 -1
  53. package/chunks/{chunk-NXKOVOM5.js → chunk-4IQKBLTQ.js} +15 -9
  54. package/chunks/{chunk-M4KFODIP.js → chunk-4JAGXZR3.js} +1 -1
  55. package/chunks/{chunk-PDAKFU7M.js → chunk-4LIPOIXS.js} +1 -1
  56. package/chunks/{chunk-LEPCWS5A.js → chunk-4MCY33Y2.js} +3 -3
  57. package/chunks/{chunk-U6D2PPMN.js → chunk-4VUVBN3Y.js} +1 -1
  58. package/chunks/{chunk-37JFWFCD.js → chunk-4VZCORNT.js} +1 -1
  59. package/chunks/{daemon-RKDGBFLK.js → chunk-537SQ2AI.js} +2216 -1721
  60. package/chunks/{chunk-VNAYZAFX.js → chunk-54TF2ZIQ.js} +4 -4
  61. package/chunks/{chunk-OKTNXDVO.js → chunk-565U2ANU.js} +1 -1
  62. package/chunks/chunk-5ETULJLP.js +74 -0
  63. package/chunks/{chunk-ADYN7P2Y.js → chunk-5JLQWQK6.js} +8 -6
  64. package/chunks/{chunk-BFY33IB4.js → chunk-5MTARK4Y.js} +7 -7
  65. package/chunks/{chunk-BJXCYUGM.js → chunk-5YY5MZT6.js} +1 -1
  66. package/chunks/{chunk-4PSDSCW3.js → chunk-64MQTIX7.js} +3 -3
  67. package/chunks/{chunk-54C6PIGT.js → chunk-6UIACMGH.js} +3 -3
  68. package/chunks/{chunk-ALUYNJPM.js → chunk-7BZS4ZDV.js} +1362 -1140
  69. package/chunks/{chunk-LB3WQQJK.js → chunk-7OCIQNKX.js} +2 -2
  70. package/chunks/{chunk-QKDNS6FU.js → chunk-7VEYUF3N.js} +13 -2
  71. package/chunks/{chunk-AZJLY2XZ.js → chunk-AHBLRVD5.js} +5 -5
  72. package/chunks/{chunk-VWTSRH6C.js → chunk-AQ5NAGWI.js} +89 -17
  73. package/chunks/{chunk-MOF6VZN2.js → chunk-AXPOOQAW.js} +2 -2
  74. package/chunks/{chunk-CVX63TFJ.js → chunk-B44JBZBB.js} +3 -3
  75. package/chunks/{chunk-AI35S34R.js → chunk-B54PFQS5.js} +3 -3
  76. package/chunks/{chunk-373DQUVA.js → chunk-BF3RUIVP.js} +5 -4
  77. package/chunks/{chunk-RJUVTJEZ.js → chunk-BKNY7PDI.js} +1 -1
  78. package/chunks/{chunk-UKYXYWI2.js → chunk-BUQN5LTI.js} +2 -2
  79. package/chunks/{chunk-O5CD7T4T.js → chunk-BW4333PP.js} +0 -95
  80. package/chunks/{chunk-UPFRILIL.js → chunk-CWNC7M73.js} +2 -2
  81. package/chunks/{chunk-3L724BJ5.js → chunk-CZACBHAW.js} +6 -6
  82. package/chunks/{chunk-EBDGRBZX.js → chunk-D4CU6DKR.js} +6 -6
  83. package/chunks/{chunk-G7HBEEX7.js → chunk-D6PIMKY3.js} +9 -9
  84. package/chunks/{chunk-ENYUKMFK.js → chunk-DJXSOEFB.js} +1 -1
  85. package/chunks/{chunk-C2VWOXHS.js → chunk-DNPHKA72.js} +8 -8
  86. package/chunks/{chunk-UUASLXHW.js → chunk-E4L5BM2B.js} +5 -5
  87. package/chunks/{chunk-HT5S5TRQ.js → chunk-EDIDYZBT.js} +4 -11
  88. package/chunks/{chunk-5H5S4UY5.js → chunk-EFT7OMDN.js} +1 -1
  89. package/chunks/{chunk-GB4UKWY5.js → chunk-EJNYBDYC.js} +2 -2
  90. package/chunks/{chunk-NQ4L2CMD.js → chunk-ER273QE6.js} +53 -9
  91. package/chunks/{chunk-RKW36UWC.js → chunk-EWNKP4V4.js} +1 -1
  92. package/chunks/{chunk-UJ4DUYIH.js → chunk-F53KKZUD.js} +2 -2
  93. package/chunks/{chunk-EFTPIZIC.js → chunk-FDOGGKAA.js} +21 -0
  94. package/chunks/{chunk-AQ37AY7B.js → chunk-FKJM6JKY.js} +5 -0
  95. package/chunks/{chunk-KEVYJSI4.js → chunk-G34YLYCS.js} +13 -13
  96. package/chunks/{chunk-P6UIF2OW.js → chunk-GCFZ2LAX.js} +195 -10
  97. package/chunks/{chunk-VGHZT6JR.js → chunk-GELRJXE2.js} +1 -1
  98. package/chunks/{chunk-ZDFQGHZH.js → chunk-GMNLYQOS.js} +1 -1
  99. package/chunks/{chunk-KOGW3YWJ.js → chunk-GVVCLL2P.js} +12 -12
  100. package/chunks/{chunk-OSSTATJF.js → chunk-GXZHYPHZ.js} +428 -30
  101. package/chunks/{chunk-IPATA3T2.js → chunk-GZWW2QWR.js} +2 -2
  102. package/chunks/{chunk-C4TIXFDZ.js → chunk-H3UDNQLO.js} +6 -4
  103. package/chunks/chunk-HD7O6WLV.js +18 -0
  104. package/chunks/{chunk-4UANMABT.js → chunk-HFTB354P.js} +259 -49
  105. package/chunks/{chunk-LOBDDFYK.js → chunk-HJ34U5J4.js} +5 -5
  106. package/chunks/{chunk-M4LBBSVP.js → chunk-HY3DXYZK.js} +2 -2
  107. package/chunks/{chunk-4F7GQGXB.js → chunk-I72PHOKL.js} +1451 -415
  108. package/chunks/{chunk-YPWZTR7F.js → chunk-IFD3BTEA.js} +3 -3
  109. package/chunks/{chunk-EWRW2WQC.js → chunk-IKLFS6SC.js} +5 -5
  110. package/chunks/{chunk-VPSIC437.js → chunk-IQN2CCIE.js} +66 -6
  111. package/chunks/{chunk-F7NF2IOE.js → chunk-IXSGOSEG.js} +7 -7
  112. package/chunks/{chunk-ODZF64DM.js → chunk-IZ2U57NY.js} +1 -1
  113. package/chunks/{chunk-4BGDFKQE.js → chunk-J3O5I5ZD.js} +24 -7
  114. package/chunks/{chunk-DYTW3QVG.js → chunk-J6MB5ZHZ.js} +1 -1
  115. package/chunks/{chunk-HJBHMANB.js → chunk-JBTZUFR4.js} +11 -8
  116. package/chunks/{chunk-SRF4KTAG.js → chunk-JLWFGYXU.js} +4 -4
  117. package/chunks/{chunk-SX2QIMJV.js → chunk-JOPC3FND.js} +5 -5
  118. package/chunks/chunk-JPEAQJNS.js +2142 -0
  119. package/chunks/{chunk-ZTPGUFQV.js → chunk-JRYL3T2O.js} +24 -5
  120. package/chunks/{chunk-GXUTFQXK.js → chunk-KE3Q4JMY.js} +4 -4
  121. package/chunks/{chunk-LKODFJRD.js → chunk-KFFCDLKV.js} +1 -1
  122. package/chunks/{chunk-4M24B5J5.js → chunk-KJJPJYHI.js} +79 -30
  123. package/chunks/chunk-KK2GZGBK.js +21080 -0
  124. package/chunks/{chunk-64QH2UC6.js → chunk-KPXRFTT7.js} +12 -1
  125. package/chunks/{chunk-JZWOCUZ3.js → chunk-L4R7BCVV.js} +1 -1
  126. package/chunks/{chunk-IG4W5SJR.js → chunk-LDS57224.js} +3 -3
  127. package/chunks/{chunk-UAKRDON5.js → chunk-LK7S2D6V.js} +4 -4
  128. package/chunks/{chunk-4HVH57J3.js → chunk-LMJQSPWB.js} +21 -6
  129. package/chunks/{chunk-ANVG3BVV.js → chunk-LNYV4GXX.js} +13 -3
  130. package/chunks/{chunk-RM4WT2XB.js → chunk-LPBQODMR.js} +4 -4
  131. package/chunks/{chunk-XEAAO654.js → chunk-M3JGHRMQ.js} +1 -1
  132. package/chunks/{chunk-AMDSOFFV.js → chunk-MATEIJZF.js} +1 -0
  133. package/chunks/{chunk-LHBNR6EU.js → chunk-MNEYUNOE.js} +2 -2
  134. package/chunks/{chunk-I4NRYS6A.js → chunk-MUZCSTOO.js} +11 -11
  135. package/chunks/{chunk-I5N4EAS6.js → chunk-MWHY26G3.js} +1 -1
  136. package/chunks/{chunk-7XL4WRXM.js → chunk-N6VQ37ZZ.js} +2 -2
  137. package/chunks/{chunk-AHYTURFB.js → chunk-N7EYO2E7.js} +1 -1
  138. package/chunks/{chunk-LU77UT4D.js → chunk-N7VURC4O.js} +24 -26
  139. package/chunks/{chunk-DSX7KQPM.js → chunk-NAKALAL4.js} +227 -29
  140. package/chunks/{chunk-QQD2GART.js → chunk-NGX4NUNP.js} +3 -3
  141. package/chunks/{chunk-2M3EWQNG.js → chunk-NUQFUXOG.js} +17 -1
  142. package/chunks/{chunk-E4JNFXNI.js → chunk-NXWYCSPL.js} +3 -3
  143. package/chunks/{chunk-6A2D4QSO.js → chunk-O2GG7H4C.js} +4 -4
  144. package/chunks/{chunk-ZKFTS3OV.js → chunk-O45WBTNS.js} +6 -6
  145. package/chunks/{chunk-KGV55H53.js → chunk-OECNP26L.js} +1 -1
  146. package/chunks/{chunk-S6H3ELPG.js → chunk-P4RUUG64.js} +1 -1
  147. package/chunks/{chunk-GH2S4GD5.js → chunk-P5LDR7FI.js} +21 -68
  148. package/chunks/{chunk-RN3YGDCA.js → chunk-P6LATTDG.js} +4 -4
  149. package/chunks/{chunk-WP4AX3XD.js → chunk-PTFFWTTO.js} +3 -3
  150. package/chunks/{chunk-DTVQSSNM.js → chunk-PZUOHCWI.js} +3 -3
  151. package/chunks/{chunk-VYIUNFEA.js → chunk-PZV2FASB.js} +3 -3
  152. package/chunks/{chunk-XLXAZLDR.js → chunk-Q2SAQTEJ.js} +1 -1
  153. package/chunks/{chunk-47RYEQW5.js → chunk-QMFOYPGV.js} +2 -2
  154. package/chunks/{chunk-SULZPKTA.js → chunk-QSC5YOEC.js} +3 -3
  155. package/chunks/{chunk-F33GFWPR.js → chunk-QWZOOIR3.js} +58 -18
  156. package/chunks/{chunk-H43PSPYS.js → chunk-R355CUNQ.js} +4 -4
  157. package/chunks/{chunk-DQCKVAF5.js → chunk-RDKXZ2LS.js} +3 -3
  158. package/chunks/{chunk-7JMGTOH7.js → chunk-RPBMP6BN.js} +21 -1
  159. package/chunks/{chunk-5Q5RC2WE.js → chunk-RVNS7NWN.js} +2 -2
  160. package/chunks/{chunk-7RB56BRJ.js → chunk-SAZS4IWW.js} +6 -4
  161. package/chunks/{chunk-5EIOJGCR.js → chunk-SFMCYMVF.js} +4 -4
  162. package/chunks/{chunk-TMKTOTMQ.js → chunk-SN5FV4FY.js} +5 -5
  163. package/chunks/{chunk-QJGYU5PG.js → chunk-TDP7UULF.js} +1 -1
  164. package/chunks/{chunk-EIJT2PQ6.js → chunk-TIGXX4PA.js} +2 -2
  165. package/chunks/{chunk-PCRBLMIN.js → chunk-TMWB67LS.js} +21 -3
  166. package/chunks/{chunk-JUARRUMA.js → chunk-UEZOXZNI.js} +1358 -646
  167. package/chunks/{chunk-KFN2IZYR.js → chunk-UKADFFL2.js} +3 -3
  168. package/chunks/{chunk-TJYRTS4S.js → chunk-UKKYOIVT.js} +2 -2
  169. package/chunks/{chunk-EVFDRBUM.js → chunk-URSCX7S7.js} +12 -7
  170. package/chunks/{chunk-U4DJ5XB3.js → chunk-VDXYYVCD.js} +269 -70
  171. package/chunks/{chunk-4LIFGNI4.js → chunk-VEFRT7NX.js} +1 -1
  172. package/chunks/chunk-VFFQAOPR.js +18 -0
  173. package/chunks/{chunk-3AKCBZVW.js → chunk-VU7O7CGQ.js} +3 -3
  174. package/chunks/{chunk-RAFQIHN2.js → chunk-VUSSAGKI.js} +76 -5
  175. package/chunks/{chunk-TQHPVKO6.js → chunk-VY6UVU7G.js} +6 -6
  176. package/chunks/{chunk-S2T7H5MI.js → chunk-W4LL5RZO.js} +1 -1
  177. package/chunks/{chunk-ZGCKTAL5.js → chunk-WEXA2DNG.js} +2 -0
  178. package/chunks/{chunk-NVVJTUSL.js → chunk-WR3SH3EY.js} +136 -85
  179. package/chunks/{chunk-JR42V4UY.js → chunk-WTW36TJ3.js} +1 -1
  180. package/chunks/{chunk-TSZSGQ3N.js → chunk-WXC6OAWD.js} +1 -1
  181. package/chunks/{chunk-ZVP4PWBU.js → chunk-X35VIWWJ.js} +1 -1
  182. package/chunks/{chunk-KHP66DFN.js → chunk-XFFRI3WM.js} +1 -1
  183. package/chunks/{chunk-EIY7SUPZ.js → chunk-XHGGYCTA.js} +1 -1
  184. package/chunks/{chunk-BA4WJC4L.js → chunk-XOVVCGZX.js} +1 -1
  185. package/chunks/{chunk-VBWD6C27.js → chunk-XUSOYE2I.js} +1 -1
  186. package/chunks/{chunk-NUHOLAQ6.js → chunk-XWJFDJZK.js} +1 -1
  187. package/chunks/{chunk-65HWLGA7.js → chunk-XY3USGFE.js} +3 -3
  188. package/chunks/{chunk-STCVJXQB.js → chunk-Y3ZKI4RQ.js} +56 -26
  189. package/chunks/{chunk-QAK5475D.js → chunk-Y53DG2HA.js} +1 -1
  190. package/chunks/{chunk-3JQZVCBI.js → chunk-YCDL2SAS.js} +2 -2
  191. package/chunks/{chunk-NSUKQ4DN.js → chunk-YHDGABDC.js} +3 -3
  192. package/chunks/{chunk-FRICLXCZ.js → chunk-Z6WZPXQH.js} +3 -3
  193. package/chunks/{chunk-EAHOJF6V.js → chunk-ZAFYHRVY.js} +12 -0
  194. package/chunks/{chunk-MP6YZ4RK.js → chunk-ZAZ3NFL6.js} +852 -309
  195. package/chunks/{chunk-7TBU7PU2.js → chunk-ZSTCM3MX.js} +1 -1
  196. package/chunks/{chunk-NRL5CUZT.js → chunk-ZTAVGFKA.js} +1 -1
  197. package/chunks/config-utils-QXDOTXEQ.js +119 -0
  198. package/chunks/contextCommand-RN4KARWC.js +112 -0
  199. package/chunks/{core-runtime-B4UKKIAQ.js → core-runtime-NAZCOKHB.js} +63 -58
  200. package/chunks/{create-sub-session-NJ24B4US.js → create-sub-session-BCSM4WKB.js} +61 -56
  201. package/chunks/{create-sub-session-LUPWEUHR.js → create-sub-session-BQ3SE4TX.js} +3 -3
  202. package/chunks/{cron-create-CRSPET3H.js → cron-create-D6HQ7I7I.js} +4 -4
  203. package/chunks/{cron-delete-DB77SZTU.js → cron-delete-KK3D2SQV.js} +4 -4
  204. package/chunks/{cron-list-U2JNYWV6.js → cron-list-VBF3IZMF.js} +4 -4
  205. package/chunks/daemon-LCUELM6E.js +191 -0
  206. package/chunks/{daemon-git-worktree-guard-O2HPOBAB.js → daemon-git-worktree-guard-3K5CAU36.js} +62 -57
  207. package/chunks/daemon-status-provider-4X3ZZQTZ.js +122 -0
  208. package/chunks/daemon-trust-policy-R45CFUJA.js +118 -0
  209. package/chunks/{daemon-trust-policy-monitor-JL7F4Y4Q.js → daemon-trust-policy-monitor-DSSFCO3K.js} +69 -64
  210. package/chunks/{de-T4BLOKEC.js → de-UU2YTO37.js} +1 -0
  211. package/chunks/deferred-core-runtime-UO2M6WYI.js +120 -0
  212. package/chunks/{display-image-73C7XNRK.js → display-image-EVVTBVYE.js} +6 -6
  213. package/chunks/{dist-EDHQIBYD.js → dist-3T5MDUHP.js} +62 -20
  214. package/chunks/{dist-ZCJLKQSP.js → dist-AFH3BMZZ.js} +18 -10
  215. package/chunks/{dist-LXFYIJNG.js → dist-MK5PPBRF.js} +40 -9
  216. package/chunks/{dist-GT64AAUR.js → dist-PH5RSTEA.js} +56 -20
  217. package/chunks/{dist-62OZ7QXB.js → dist-QUU7TVE3.js} +35 -12
  218. package/chunks/{dist-JVXT4VUJ.js → dist-R5Y34V6T.js} +11 -2
  219. package/chunks/{dist-L6URO6CK.js → dist-SB2XRXZA.js} +5 -1
  220. package/chunks/{dist-QAF5DO3Y.js → dist-SIHF5MU2.js} +326 -131
  221. package/chunks/{dist-PDGNRVPY.js → dist-UVHW2U56.js} +20 -1
  222. package/chunks/earlyInputCapture-BXP7V2P3.js +22 -0
  223. package/chunks/{edit-SUGXY63Y.js → edit-VNBCTRWP.js} +48 -44
  224. package/chunks/{en-2RATMNX7.js → en-JMR535HP.js} +3 -1
  225. package/chunks/{enter-worktree-B6USKSIK.js → enter-worktree-CEVK7MQ2.js} +7 -7
  226. package/chunks/{enterPlanMode-MDX4RVVL.js → enterPlanMode-4KMZMUIA.js} +48 -45
  227. package/chunks/environment-S2HYQDON.js +135 -0
  228. package/chunks/errors-DAAN5TL7.js +119 -0
  229. package/chunks/{exit-worktree-DLQ73SJH.js → exit-worktree-D3YE6MUN.js} +7 -7
  230. package/chunks/exitPlanMode-HR36HG3D.js +86 -0
  231. package/chunks/{fast-path-Y73R42LV.js → fast-path-4IWSW3UV.js} +3 -3
  232. package/chunks/{fast-path-settings-MFUR3IWK.js → fast-path-settings-ISEJPRYE.js} +6 -4
  233. package/chunks/{fr-BGHGYX6A.js → fr-HKNWVXRJ.js} +1 -0
  234. package/chunks/{glob-DMGH7EZN.js → glob-IZYB2XH2.js} +46 -43
  235. package/chunks/{goal-tools-3RF3PXCL.js → goal-tools-VGUPKQDJ.js} +46 -43
  236. package/chunks/{grep-AJVLCVXC.js → grep-OUVLNXG7.js} +9 -8
  237. package/chunks/handleAutoUpdate-D56FMDTW.js +115 -0
  238. package/chunks/i18n-BKE5WO6T.js +130 -0
  239. package/chunks/{image-gen-VOIDOHOB.js → image-gen-SHVQ3XID.js} +8 -8
  240. package/chunks/initializer-MS4SGEHF.js +119 -0
  241. package/chunks/installationInfo-542MGC4S.js +113 -0
  242. package/chunks/{ja-G3FTD5XE.js → ja-GJS5RZGU.js} +1 -0
  243. package/chunks/{keychain-token-storage-REZVMJA6.js → keychain-token-storage-NQ5XWIPX.js} +2 -2
  244. package/chunks/list-H6XTKUWL.js +122 -0
  245. package/chunks/{list-agents-SBMONIUK.js → list-agents-ULYBGJXC.js} +6 -6
  246. package/chunks/{llm-K26SUDVK.js → llm-3NUC4EJY.js} +132 -113
  247. package/chunks/{llm-content-generator-TT6EAUD4.js → llm-content-generator-R4NL3OQN.js} +40 -13
  248. package/chunks/loadedSettingsAdapter-3XLKYDVT.js +116 -0
  249. package/chunks/{loggingContentGenerator-EYQBA4M4.js → loggingContentGenerator-ZYSWVNEO.js} +55 -52
  250. package/chunks/{loop-wakeup-QA6SHCZT.js → loop-wakeup-B27BEYRL.js} +5 -5
  251. package/chunks/{lowlight-J2OZNPCA.js → lowlight-BTE423KL.js} +3 -6
  252. package/chunks/{ls-HEJNCEYO.js → ls-3IIMMVKF.js} +5 -4
  253. package/chunks/{lsp-WOQKNZP6.js → lsp-VJAT7XKS.js} +2 -2
  254. package/chunks/{managed-npm-update-HIJTODQT.js → managed-npm-update-L2I53ZAI.js} +62 -57
  255. package/chunks/mcp-4PIXQASW.js +116 -0
  256. package/chunks/{monitor-DKNZQAB2.js → monitor-O2YQTOZZ.js} +50 -46
  257. package/chunks/{node-UETAYMMO.js → node-ISQAFKIS.js} +2 -2
  258. package/chunks/nonInteractiveCli-LV7CDBA2.js +198 -0
  259. package/chunks/{notebook-edit-MGHTRL2D.js → notebook-edit-4RE2ALH4.js} +48 -44
  260. package/chunks/{openaiContentGenerator-ZJIEQ3ZJ.js → openaiContentGenerator-7ND7K5CP.js} +30 -25
  261. package/chunks/pidfile-UFTLQ7NP.js +117 -0
  262. package/chunks/{processUtils-UY3SAJJZ.js → processUtils-3XBB4FYV.js} +2 -2
  263. package/chunks/prompt-terminal-ledger-2QASOGMM.js +111 -0
  264. package/chunks/{pt-D73IFYT7.js → pt-FXMYXEUV.js} +1 -0
  265. package/chunks/{qwenContentGenerator-VI4KATRY.js → qwenContentGenerator-AELTUTH6.js} +52 -49
  266. package/chunks/{qwenOAuth2-7AOCKSOQ.js → qwenOAuth2-BS5D2LYV.js} +7 -7
  267. package/chunks/{read-file-P7F4P7LV.js → read-file-PDWHZPHX.js} +13 -11
  268. package/chunks/{read-mcp-resource-GLAGB6R7.js → read-mcp-resource-YXJZ75UB.js} +2 -2
  269. package/chunks/{record-artifact-SWVR7NSU.js → record-artifact-WJDOV6XU.js} +4 -4
  270. package/chunks/{report-findings-AL5YW3KI.js → report-findings-Q4UACKWR.js} +5 -5
  271. package/chunks/{request-shutdown-5YK4IZ54.js → request-shutdown-2YZ3E3GH.js} +8 -8
  272. package/chunks/resumeHistoryUtils-QRXZEEBA.js +124 -0
  273. package/chunks/ripGrep-KSOOLE6H.js +39 -0
  274. package/chunks/{ru-QMISLKRH.js → ru-RMHURE5U.js} +1 -0
  275. package/chunks/{run-qwen-serve-OGTEEUR2.js → run-qwen-serve-RTAREPT6.js} +84 -70
  276. package/chunks/runtime-ESFSCJRZ.js +154 -0
  277. package/chunks/scheduled-tasks-6ZHRNBH6.js +133 -0
  278. package/chunks/{scheduler-73YXGUGW.js → scheduler-DQI6KV7T.js} +63 -58
  279. package/chunks/{sdk-exporters-http-3JO5TJNU.js → sdk-exporters-http-7R2ARBPV.js} +2 -2
  280. package/chunks/{sdk-impl-HZAUUTHJ.js → sdk-impl-YOLO7LV4.js} +4 -4
  281. package/chunks/{send-message-JC7NJTY6.js → send-message-PQCVSVMN.js} +24 -24
  282. package/chunks/serve-FY7ZEW52.js +124 -0
  283. package/chunks/{server-AOYZVVOM.js → server-KNDY6K5F.js} +1594 -273
  284. package/chunks/{session-UAWFNFGI.js → session-MCEPXAZP.js} +113 -105
  285. package/chunks/session-attachments-root-OLNAE6GF.js +109 -0
  286. package/chunks/{session-pr-refresh-CT2INROL.js → session-pr-refresh-HKJHQQQK.js} +67 -62
  287. package/chunks/{settings-BHRGDASJ.js → settings-VXO4WBMK.js} +68 -63
  288. package/chunks/shell-U263OTES.js +96 -0
  289. package/chunks/{skill-ZGBKNCHQ.js → skill-SDODGBKL.js} +19 -17
  290. package/chunks/skill-settings-YEIA22QJ.js +124 -0
  291. package/chunks/spawnChannel-4WJZVFPP.js +117 -0
  292. package/chunks/standalone-update-ZWVQUO64.js +124 -0
  293. package/chunks/{start-opentui-ui-FZ4USOU7.js → start-opentui-ui-BFYCJQRZ.js} +1199 -190
  294. package/chunks/{startInteractiveUI-E2WQJUOA.js → startInteractiveUI-JYAFCMHL.js} +2977 -2319
  295. package/chunks/{syntheticOutput-HJNZSEHN.js → syntheticOutput-AUAJBNXR.js} +3 -3
  296. package/chunks/{task-create-6RSD54S5.js → task-create-LD5ISM3E.js} +12 -12
  297. package/chunks/{task-list-IQSACPOM.js → task-list-YISJ4RJA.js} +5 -5
  298. package/chunks/{task-stop-HE2LRQNW.js → task-stop-65ZOVATJ.js} +2 -2
  299. package/chunks/{task-update-XAJ2NYOA.js → task-update-AAN4ZVEY.js} +15 -15
  300. package/chunks/{team-create-SOKMYSQU.js → team-create-KU7MABNO.js} +47 -44
  301. package/chunks/{team-delete-NGNNKGMG.js → team-delete-XFRRTJTT.js} +5 -5
  302. package/chunks/{team-plan-approval-U7ZWXYAY.js → team-plan-approval-DPB377A3.js} +46 -43
  303. package/chunks/terminal-image-renderer-WGWRENOF.js +124 -0
  304. package/chunks/theme-manager-GBUFULSO.js +108 -0
  305. package/chunks/{todoWrite-5UTVUXHA.js → todoWrite-G7NT4IFP.js} +5 -5
  306. package/chunks/{tool-search-IAI2RVWT.js → tool-search-6YUXHBPT.js} +19 -17
  307. package/chunks/total-session-admission-54R2JQ5L.js +118 -0
  308. package/chunks/trustedFolders-KAJIDJTH.js +128 -0
  309. package/chunks/{update-relaunch-5RWKZAL3.js → update-relaunch-XM4IWBFD.js} +5 -5
  310. package/chunks/updateCheck-W6UZFURI.js +124 -0
  311. package/chunks/useAutoAcceptIndicator-LAWYHY3U.js +126 -0
  312. package/chunks/{validateNonInterActiveAuth-QPFEKATS.js → validateNonInterActiveAuth-7WCKHRN2.js} +109 -101
  313. package/chunks/{version-JKNG7YDH.js → version-3ZU43RJ6.js} +1 -1
  314. package/chunks/{web-fetch-X3AHIIHW.js → web-fetch-QHI2SQL4.js} +16 -14
  315. package/chunks/{web-search-K2FMOGS5.js → web-search-3KZZKWNY.js} +9 -8
  316. package/chunks/{workflow-TOLPAK5G.js → workflow-HRW7Y2X4.js} +330 -1667
  317. package/chunks/workspace-providers-status-KTGCWCPC.js +120 -0
  318. package/chunks/{workspace-registration-store-KQWVVW4Y.js → workspace-registration-store-LHLPPWNE.js} +1 -1
  319. package/chunks/workspace-registry-X34MLN52.js +127 -0
  320. package/chunks/workspace-runtime-coordinator-U4PW4P7K.js +128 -0
  321. package/chunks/workspace-service-KD7BCGYL.js +132 -0
  322. package/chunks/workspace-skills-status-YJGO6Y3T.js +119 -0
  323. package/chunks/{workspace-trust-reconciler-IBDFQBQS.js → workspace-trust-reconciler-EUYHISCH.js} +74 -69
  324. package/chunks/write-file-EBSB34NJ.js +91 -0
  325. package/chunks/{zh-25DF7OGK.js → zh-DVFYHRK5.js} +3 -1
  326. package/chunks/{zh-TW-5EDMZVGK.js → zh-TW-W2GNP2IU.js} +3 -1
  327. package/chunks/{zoom-image-IFXSN74N.js → zoom-image-UJ5VKWKP.js} +13 -11
  328. package/cli.js +13 -13
  329. package/export-transcript-document.js +617 -0
  330. package/locales/ca.js +1 -0
  331. package/locales/de.js +1 -0
  332. package/locales/en.js +5 -2
  333. package/locales/fr.js +1 -0
  334. package/locales/ja.js +1 -0
  335. package/locales/pt.js +1 -0
  336. package/locales/ru.js +1 -0
  337. package/locales/zh-TW.js +5 -2
  338. package/locales/zh.js +5 -2
  339. package/package.json +5 -4
  340. package/web-shell/assets/{abnfDiagram-VCTEODGH-Cxf7xE_Z.js → abnfDiagram-VCTEODGH-Dur--luQ.js} +1 -1
  341. package/web-shell/assets/{arc-ESi1eNkE.js → arc-tYLobxFi.js} +1 -1
  342. package/web-shell/assets/{architectureDiagram-5GKGNRK7-D9l7-bDo.js → architectureDiagram-5GKGNRK7-IG6aXD03.js} +1 -1
  343. package/web-shell/assets/{blockDiagram-NRAW4CY4-Bc8DEasw.js → blockDiagram-NRAW4CY4-C6eBSkfA.js} +1 -1
  344. package/web-shell/assets/{c4Diagram-UCG6FXSJ-Dimb2Hmh.js → c4Diagram-UCG6FXSJ-BrX3HJqB.js} +1 -1
  345. package/web-shell/assets/channel-uEkvKckd.js +1 -0
  346. package/web-shell/assets/{chunk-2Q5K7J3B-jVDmOpAQ.js → chunk-2Q5K7J3B-B3fcJ8ee.js} +1 -1
  347. package/web-shell/assets/{chunk-5VM5RSS4-DbG_SwdB.js → chunk-5VM5RSS4-CeC90yKM.js} +1 -1
  348. package/web-shell/assets/{chunk-F27PBJKO-QEc4cY1v.js → chunk-F27PBJKO-CW44RVki.js} +1 -1
  349. package/web-shell/assets/{chunk-G27WJ6UU-iJ36lQ3X.js → chunk-G27WJ6UU-D1PAMukD.js} +1 -1
  350. package/web-shell/assets/{chunk-JWPE2WC7-DuArnVtF.js → chunk-JWPE2WC7-Dt3Y2Fvx.js} +1 -1
  351. package/web-shell/assets/{chunk-LCL6LL3I-DxOf1zwL.js → chunk-LCL6LL3I-CZHw2lLI.js} +1 -1
  352. package/web-shell/assets/{chunk-POPQ4Y6H-lVLu9Ild.js → chunk-POPQ4Y6H-ysNAdTGx.js} +1 -1
  353. package/web-shell/assets/{chunk-SVP7TREG-C6XYlIer.js → chunk-SVP7TREG-BdNXW6YQ.js} +1 -1
  354. package/web-shell/assets/{chunk-XXDRQBXY-CiG2j2Ji.js → chunk-XXDRQBXY-DgqQ9UA8.js} +1 -1
  355. package/web-shell/assets/classDiagram-DTDB5LWJ-DuPsnhWS.js +1 -0
  356. package/web-shell/assets/classDiagram-v2-JRS7N3AN-DuPsnhWS.js +1 -0
  357. package/web-shell/assets/{cose-bilkent-JH36ORCC-DGVHMMVm.js → cose-bilkent-JH36ORCC-BILImXzJ.js} +1 -1
  358. package/web-shell/assets/{cynefin-OW5HDTMX-D6cgpCnH.js → cynefin-OW5HDTMX-DR88Pund.js} +1 -1
  359. package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-BKv4Z-UX.js → cynefinDiagram-5FMLGOSQ-BYFbfkA6.js} +1 -1
  360. package/web-shell/assets/{dagre-3AP2YEHR-B4ABMIG-.js → dagre-3AP2YEHR-rfpyc6sX.js} +1 -1
  361. package/web-shell/assets/{diagram-S7CK7UJ4-DgCkp_Lm.js → diagram-S7CK7UJ4-BJxLmEwH.js} +1 -1
  362. package/web-shell/assets/{diagram-UQ7AKVKN-FG0FNokz.js → diagram-UQ7AKVKN-H34xm7k3.js} +1 -1
  363. package/web-shell/assets/{diagram-VSXAHHWV-JgkP9qg-.js → diagram-VSXAHHWV-HYxhwNLx.js} +1 -1
  364. package/web-shell/assets/{diagram-VX7I27RA-ADh2x83l.js → diagram-VX7I27RA-BJazso8F.js} +1 -1
  365. package/web-shell/assets/{diagram-Z3DM3KII-yXqoYF1J.js → diagram-Z3DM3KII-Clje1aNy.js} +1 -1
  366. package/web-shell/assets/{ebnfDiagram-PWID7BFC-Duk83Ek_.js → ebnfDiagram-PWID7BFC-M93YBkFh.js} +1 -1
  367. package/web-shell/assets/{erDiagram-SSCWMZ5O-DMdvxySG.js → erDiagram-SSCWMZ5O-DY8XzSHU.js} +1 -1
  368. package/web-shell/assets/{flowDiagram-A5DVABFB-DHjVgSji.js → flowDiagram-A5DVABFB-CE6Aylcq.js} +1 -1
  369. package/web-shell/assets/{ganttDiagram-EL5Y4UJY-DMM9DkCE.js → ganttDiagram-EL5Y4UJY-DI-5LL22.js} +1 -1
  370. package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-t_ug9vO8.js → gitGraphDiagram-WWUBYQGX-C7BZWElk.js} +1 -1
  371. package/web-shell/assets/index-CVyqwW7y.js +2142 -0
  372. package/web-shell/assets/{index-zqvnpGHv.js → index-DclFHns9.js} +1 -1
  373. package/web-shell/assets/index-FO7JXPnH.css +36 -0
  374. package/web-shell/assets/{infoDiagram-RXCK75RN-eT1fANNm.js → infoDiagram-RXCK75RN-CGUSy4Pc.js} +1 -1
  375. package/web-shell/assets/{ishikawaDiagram-5VMMS53U-k3evzZNn.js → ishikawaDiagram-5VMMS53U-B5BVks9q.js} +1 -1
  376. package/web-shell/assets/{journeyDiagram-EYS64GPL-CGim3EAi.js → journeyDiagram-EYS64GPL-CFh6Tf7h.js} +1 -1
  377. package/web-shell/assets/{kanban-definition-3QL26DDD-WHfJo-22.js → kanban-definition-3QL26DDD-B7TlxP7c.js} +1 -1
  378. package/web-shell/assets/{layout-DkqIaFlJ.js → layout-Br_pZq2Q.js} +1 -1
  379. package/web-shell/assets/{linear-Bdkd3mCz.js → linear-BVlP6fte.js} +1 -1
  380. package/web-shell/assets/{mermaid.core-CGw0LkT_.js → mermaid.core-TrcYWoiF.js} +6 -6
  381. package/web-shell/assets/{mindmap-definition-FBJOCRG2-C9V4rBvo.js → mindmap-definition-FBJOCRG2-BJ4LzqjZ.js} +1 -1
  382. package/web-shell/assets/{pegDiagram-XKGWAZYB-CwoI2T5G.js → pegDiagram-XKGWAZYB-1b_MxlOl.js} +1 -1
  383. package/web-shell/assets/{pieDiagram-E7YTZNPT-DaTmBmPG.js → pieDiagram-E7YTZNPT-B8zl0YhY.js} +1 -1
  384. package/web-shell/assets/{quadrantDiagram-AXDQQJYC-plh6MyGI.js → quadrantDiagram-AXDQQJYC-CIZO8ukl.js} +1 -1
  385. package/web-shell/assets/{railroadDiagram-O6MQD6OU-D_b-S0iK.js → railroadDiagram-O6MQD6OU-CepHSbCj.js} +1 -1
  386. package/web-shell/assets/{requirementDiagram-EFPCY7ZU-zUzTN7VE.js → requirementDiagram-EFPCY7ZU-BCgxkcSW.js} +1 -1
  387. package/web-shell/assets/{sankeyDiagram-P5KCCOFB-m6AhoD0l.js → sankeyDiagram-P5KCCOFB-CE5CcoMM.js} +1 -1
  388. package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-Cwhzsine.js → sequenceDiagram-WJ2MYXX4-DvgHi-d5.js} +1 -1
  389. package/web-shell/assets/{sizeCapture-X5ZJPWSS-CcZuKIae.js → sizeCapture-X5ZJPWSS-T-fAsCPX.js} +1 -1
  390. package/web-shell/assets/{stateDiagram-HBIQ2CUA-CFoiJwD_.js → stateDiagram-HBIQ2CUA-DYHaul-5.js} +1 -1
  391. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-BcYho9a4.js +1 -0
  392. package/web-shell/assets/{swimlanes-XN3QIQJK-CgS9hcaV.js → swimlanes-XN3QIQJK-Dbz3Qiej.js} +1 -1
  393. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-D6HsOIgX.js +8 -0
  394. package/web-shell/assets/{timeline-definition-24CTP7MA-Dzzc05t9.js → timeline-definition-24CTP7MA-9NVRts3N.js} +1 -1
  395. package/web-shell/assets/{vennDiagram-4TSXK5OY-DemK0f7Y.js → vennDiagram-4TSXK5OY-C7cb7vnH.js} +1 -1
  396. package/web-shell/assets/{wardleyDiagram-VM6X3IG4-CquLxtMr.js → wardleyDiagram-VM6X3IG4-CG-8Ddjm.js} +1 -1
  397. package/web-shell/assets/{xychartDiagram-S5SC5T6Z-BTBKTM5g.js → xychartDiagram-S5SC5T6Z-iGeYAcP4.js} +1 -1
  398. package/web-shell/index.html +2 -2
  399. package/chunks/MaxSizedBox-B3D7545A.js +0 -111
  400. package/chunks/agent-headless-OC2IB55D.js +0 -85
  401. package/chunks/askUserQuestion-THQZMG44.js +0 -322
  402. package/chunks/bridge-IHSBI2YJ.js +0 -118
  403. package/chunks/channel-settings-store-BVKWAI2T.js +0 -121
  404. package/chunks/chunk-I2TMJPCV.js +0 -448
  405. package/chunks/chunk-QI27MKNQ.js +0 -4008
  406. package/chunks/config-utils-LVSYDLHZ.js +0 -114
  407. package/chunks/contextCommand-TZD7UAJK.js +0 -107
  408. package/chunks/daemon-status-provider-GRRVCJFW.js +0 -117
  409. package/chunks/daemon-trust-policy-YJL442BK.js +0 -113
  410. package/chunks/deferred-core-runtime-S32AYVZI.js +0 -115
  411. package/chunks/earlyInputCapture-BBPCIVZG.js +0 -108
  412. package/chunks/environment-VN6RXDVN.js +0 -130
  413. package/chunks/errors-UEY36PIT.js +0 -114
  414. package/chunks/exitPlanMode-EPHIEDAA.js +0 -83
  415. package/chunks/handleAutoUpdate-HVWQT2AU.js +0 -110
  416. package/chunks/i18n-5OR7NTRZ.js +0 -125
  417. package/chunks/initializer-JE5RQSOE.js +0 -114
  418. package/chunks/installationInfo-KO3CCSCK.js +0 -108
  419. package/chunks/list-3IORSFIY.js +0 -117
  420. package/chunks/loadedSettingsAdapter-KLLFZF3M.js +0 -111
  421. package/chunks/mcp-A2UEHETW.js +0 -111
  422. package/chunks/nonInteractiveCli-YA47F2F4.js +0 -190
  423. package/chunks/pidfile-ETHAZNMY.js +0 -112
  424. package/chunks/prompt-terminal-ledger-GZ747VYE.js +0 -106
  425. package/chunks/resumeHistoryUtils-DPZKFW24.js +0 -119
  426. package/chunks/ripGrep-C7LJKUPZ.js +0 -37
  427. package/chunks/runtime-LNBLEMZS.js +0 -149
  428. package/chunks/scheduled-tasks-FLDYZQOF.js +0 -128
  429. package/chunks/serve-3UR2H4CV.js +0 -119
  430. package/chunks/session-attachments-root-ZCGXQQTR.js +0 -104
  431. package/chunks/shell-YHOGC7TO.js +0 -93
  432. package/chunks/skill-settings-AKSP665O.js +0 -119
  433. package/chunks/spawnChannel-N25MBB6F.js +0 -112
  434. package/chunks/standalone-update-XGPWJDRN.js +0 -119
  435. package/chunks/terminal-image-renderer-KKM4OBLO.js +0 -117
  436. package/chunks/theme-manager-GQHF3A7T.js +0 -103
  437. package/chunks/total-session-admission-G4CGCSTG.js +0 -113
  438. package/chunks/trustedFolders-D2I3FDPB.js +0 -123
  439. package/chunks/updateCheck-ZXOQDFEI.js +0 -119
  440. package/chunks/useAutoAcceptIndicator-6EK4QGAH.js +0 -121
  441. package/chunks/workspace-providers-status-PCJK3RC7.js +0 -115
  442. package/chunks/workspace-registry-YNIOB6HJ.js +0 -122
  443. package/chunks/workspace-runtime-coordinator-WG2RNEN7.js +0 -123
  444. package/chunks/workspace-service-G4ZNBOFH.js +0 -127
  445. package/chunks/workspace-skills-status-FMTPPMWC.js +0 -114
  446. package/chunks/write-file-YTLFY2S5.js +0 -88
  447. package/web-shell/assets/channel-B7ohGDil.js +0 -1
  448. package/web-shell/assets/classDiagram-DTDB5LWJ-DdFpqpfD.js +0 -1
  449. package/web-shell/assets/classDiagram-v2-JRS7N3AN-DdFpqpfD.js +0 -1
  450. package/web-shell/assets/index-BGZRqbRo.css +0 -36
  451. package/web-shell/assets/index-DRri_6_x.js +0 -2067
  452. package/web-shell/assets/stateDiagram-v2-4QOOHH4V--H8HdEmk.js +0 -1
  453. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-ShE9OIgf.js +0 -8
@@ -18,19 +18,20 @@ import {
18
18
  matchMcpServerByRef,
19
19
  parseExtensionRef,
20
20
  parseMcpServerRef
21
- } from "./chunk-LOBDDFYK.js";
21
+ } from "./chunk-HJ34U5J4.js";
22
22
  import {
23
23
  getAvailableCommands,
24
24
  getSlashCommandFirstToken,
25
25
  handleSlashCommand,
26
26
  insertAfterFunctionResponses,
27
27
  isSlashCommand,
28
+ pLimit,
28
29
  recordDaemonSessionModel,
29
30
  restoreSessionModelThenAuthenticate
30
- } from "./chunk-NVVJTUSL.js";
31
+ } from "./chunk-WR3SH3EY.js";
31
32
  import {
32
33
  recomputeMcpGating
33
- } from "./chunk-UUASLXHW.js";
34
+ } from "./chunk-E4L5BM2B.js";
34
35
  import {
35
36
  SessionIdConflictError,
36
37
  appEvents,
@@ -40,46 +41,46 @@ import {
40
41
  loadCliConfig,
41
42
  normalizeDisabledToolList,
42
43
  parseApprovalModeValue
43
- } from "./chunk-MP6YZ4RK.js";
44
+ } from "./chunk-ZAZ3NFL6.js";
44
45
  import {
45
46
  getCommandSubcommandNames
46
- } from "./chunk-EIY7SUPZ.js";
47
+ } from "./chunk-XHGGYCTA.js";
47
48
  import {
48
49
  getEffectiveSupportedModes
49
- } from "./chunk-5RTTI4GE.js";
50
+ } from "./chunk-2RYWGYB3.js";
50
51
  import "./chunk-3SH53ANB.js";
51
52
  import "./chunk-NYX53SV4.js";
52
- import "./chunk-M4LBBSVP.js";
53
+ import "./chunk-HY3DXYZK.js";
53
54
  import {
54
55
  collectContextData,
55
56
  formatContextUsageText
56
- } from "./chunk-SX2QIMJV.js";
57
+ } from "./chunk-JOPC3FND.js";
57
58
  import "./chunk-4WGODMVR.js";
58
59
  import {
59
60
  startNonInteractiveOpenAILogHousekeeping
60
- } from "./chunk-GXUTFQXK.js";
61
+ } from "./chunk-KE3Q4JMY.js";
61
62
  import "./chunk-KW7NOTN6.js";
62
- import "./chunk-JHN7UIDW.js";
63
- import "./chunk-5EIOJGCR.js";
64
- import "./chunk-37JFWFCD.js";
63
+ import "./chunk-2XRE4KE4.js";
64
+ import "./chunk-SFMCYMVF.js";
65
+ import "./chunk-54TF2ZIQ.js";
66
+ import "./chunk-4VZCORNT.js";
65
67
  import {
66
68
  isGoalStatusKind
67
69
  } from "./chunk-EKTCKZV5.js";
68
- import "./chunk-UM2FFKXN.js";
70
+ import "./chunk-43JNQAHO.js";
69
71
  import "./chunk-YAF2MQZ6.js";
70
72
  import {
71
73
  computeCpuPercent
72
74
  } from "./chunk-LBOVL47Y.js";
73
75
  import "./chunk-24FVUD5P.js";
74
- import "./chunk-EWRW2WQC.js";
76
+ import "./chunk-IKLFS6SC.js";
75
77
  import "./chunk-6H67XLET.js";
76
78
  import {
77
79
  beginAcpBootstrapConfigProfiling,
78
80
  buildAndFreezeAcpStartupProfile,
79
81
  endAcpBootstrapConfigProfiling,
80
82
  markAcpStartup
81
- } from "./chunk-JZWOCUZ3.js";
82
- import "./chunk-VNAYZAFX.js";
83
+ } from "./chunk-L4R7BCVV.js";
83
84
  import {
84
85
  GENERATION_MAX_PROMPT_BYTES,
85
86
  GENERATION_TIMEOUT_MS,
@@ -100,7 +101,7 @@ import {
100
101
  shouldSuppressRememberErrorDetails,
101
102
  workspaceMemoryFailureCode,
102
103
  workspaceMemoryFailureDiagnostics
103
- } from "./chunk-WP4AX3XD.js";
104
+ } from "./chunk-PTFFWTTO.js";
104
105
  import {
105
106
  BaseEmitter,
106
107
  HistoryReplayer,
@@ -111,16 +112,14 @@ import {
111
112
  hasFullSessionContext,
112
113
  observeAcpToolResultProjection,
113
114
  observeAcpToolResultWire
114
- } from "./chunk-QI27MKNQ.js";
115
- import "./chunk-XEAAO654.js";
116
- import "./chunk-NRL5CUZT.js";
115
+ } from "./chunk-KK2GZGBK.js";
116
+ import "./chunk-M3JGHRMQ.js";
117
+ import "./chunk-VFFQAOPR.js";
118
+ import "./chunk-ZTAVGFKA.js";
117
119
  import "./chunk-47ECGEJC.js";
118
120
  import "./chunk-2MIN6GRR.js";
119
121
  import "./chunk-QHTIBUWB.js";
120
122
  import "./chunk-TXASDT2M.js";
121
- import {
122
- buildToolWriteOriginMeta
123
- } from "./chunk-VGHZT6JR.js";
124
123
  import {
125
124
  getConversationDirectoryName,
126
125
  hasVerifiableInode,
@@ -138,12 +137,13 @@ import {
138
137
  isReservedStandaloneSessionSourceType,
139
138
  parseSessionSource
140
139
  } from "./chunk-N4QWUPDM.js";
140
+ import "./chunk-DMEUXLSS.js";
141
141
  import {
142
142
  buildScheduledTaskRunPrompt,
143
143
  normalizeChannelDeliveryText,
144
144
  scheduledTaskRunSessionName,
145
145
  scheduledTaskRunSourceId
146
- } from "./chunk-DTVQSSNM.js";
146
+ } from "./chunk-PZUOHCWI.js";
147
147
  import {
148
148
  normalizeSessionIdForLookup,
149
149
  parseCallerSuppliedSessionId
@@ -154,28 +154,28 @@ import {
154
154
  buildPermissionSettings,
155
155
  normalizePermissionRules,
156
156
  readPermissionRuleSet
157
- } from "./chunk-I5N4EAS6.js";
157
+ } from "./chunk-MWHY26G3.js";
158
158
  import {
159
159
  MAX_AUDIO_BYTES,
160
160
  sanitizeVoiceErrorMessage,
161
161
  transcribeVoiceAudio
162
- } from "./chunk-LEPCWS5A.js";
162
+ } from "./chunk-4MCY33Y2.js";
163
163
  import {
164
164
  readVoiceModel
165
- } from "./chunk-BA4WJC4L.js";
166
- import "./chunk-QAK5475D.js";
167
- import "./chunk-RN3YGDCA.js";
168
- import "./chunk-3JQZVCBI.js";
165
+ } from "./chunk-XOVVCGZX.js";
166
+ import "./chunk-Y53DG2HA.js";
167
+ import "./chunk-P6LATTDG.js";
168
+ import "./chunk-YCDL2SAS.js";
169
169
  import "./chunk-JS73NNWF.js";
170
170
  import {
171
171
  SCHEDULED_TASK_RUN_SOURCE_TYPE
172
- } from "./chunk-DSX7KQPM.js";
172
+ } from "./chunk-NAKALAL4.js";
173
173
  import "./chunk-7U5G6JXI.js";
174
174
  import "./chunk-WCCLLK7X.js";
175
175
  import "./chunk-OCPBI7J5.js";
176
176
  import {
177
177
  ndJsonStream
178
- } from "./chunk-4HVH57J3.js";
178
+ } from "./chunk-LMJQSPWB.js";
179
179
  import {
180
180
  PERSIST_REASONING_SELECTION_META_KEY,
181
181
  REASONING_EFFORT_DEFAULT,
@@ -199,7 +199,7 @@ import {
199
199
  parseAcpModelOption,
200
200
  resolveAcpModelOption,
201
201
  sanitizeProviderBaseUrl
202
- } from "./chunk-6A2D4QSO.js";
202
+ } from "./chunk-O2GG7H4C.js";
203
203
  import {
204
204
  mapSkillConfigToStatus
205
205
  } from "./chunk-BHTYRHJF.js";
@@ -210,23 +210,23 @@ import {
210
210
  SERVE_STATUS_EXT_METHODS,
211
211
  STATUS_SCHEMA_VERSION,
212
212
  mapDomainErrorToErrorKind
213
- } from "./chunk-64QH2UC6.js";
213
+ } from "./chunk-KPXRFTT7.js";
214
214
  import {
215
215
  resolveSkillSettings
216
216
  } from "./chunk-HWVUSYSN.js";
217
- import "./chunk-DMEUXLSS.js";
218
- import "./chunk-F7NF2IOE.js";
219
- import "./chunk-AZJLY2XZ.js";
217
+ import "./chunk-537SQ2AI.js";
218
+ import "./chunk-IXSGOSEG.js";
219
+ import "./chunk-AHBLRVD5.js";
220
220
  import "./chunk-57OAHC2Y.js";
221
- import "./chunk-PCRBLMIN.js";
222
- import "./chunk-NXKOVOM5.js";
223
- import "./chunk-TSZSGQ3N.js";
221
+ import "./chunk-TMWB67LS.js";
222
+ import "./chunk-4IQKBLTQ.js";
223
+ import "./chunk-WXC6OAWD.js";
224
224
  import "./chunk-V6WHFGST.js";
225
225
  import {
226
226
  createLoadedSettingsAdapter
227
- } from "./chunk-32LU3APX.js";
228
- import "./chunk-S6H3ELPG.js";
229
- import "./chunk-7XL4WRXM.js";
227
+ } from "./chunk-4F2QRVW6.js";
228
+ import "./chunk-P4RUUG64.js";
229
+ import "./chunk-N6VQ37ZZ.js";
230
230
  import {
231
231
  ACTIVE_WORK_CLOSE_IF_UNHELD_PARAM,
232
232
  ACTIVE_WORK_HEARTBEAT_META_KEY,
@@ -246,6 +246,7 @@ import {
246
246
  DAEMON_PROMPT_DISPLAY_TEXT_META_KEY,
247
247
  DAEMON_RESTORE_ASK_USER_QUESTION_META_KEY,
248
248
  DAEMON_SUPPRESS_RESTORE_ASK_USER_QUESTION_META_KEY,
249
+ DAEMON_SUPPRESS_WORKTREE_CONTEXT_RESTORE_META_KEY,
249
250
  LOAD_REPLAY_BULK_MODE,
250
251
  LOAD_REPLAY_HIDE_INHERITED_META_KEY,
251
252
  LOAD_REPLAY_MAX_BYTES,
@@ -264,7 +265,7 @@ import {
264
265
  WORKTREE_MCP_DEFER_META_KEY,
265
266
  clampActiveWorkIntervalMs,
266
267
  isValidTrustedModelPrompt
267
- } from "./chunk-ZGCKTAL5.js";
268
+ } from "./chunk-WEXA2DNG.js";
268
269
  import {
269
270
  NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE,
270
271
  isNotCurrentlyGeneratingCancelError
@@ -272,11 +273,12 @@ import {
272
273
  import "./chunk-6PLDPT2C.js";
273
274
  import "./chunk-FYJ7W2PI.js";
274
275
  import "./chunk-STUJ7IMZ.js";
276
+ import "./chunk-4JAGXZR3.js";
275
277
  import "./chunk-GYTKQYDB.js";
276
- import "./chunk-M4KFODIP.js";
277
278
  import "./chunk-ALMR3E6Q.js";
278
279
  import "./chunk-RKFGE7JH.js";
279
280
  import "./chunk-UDG5EZJI.js";
281
+ import "./chunk-M5GB774H.js";
280
282
  import {
281
283
  EXTERNAL_TOOL_GUARD_READY_META_KEY,
282
284
  EXTERNAL_TOOL_GUARD_REQUIRED_VALUE,
@@ -286,21 +288,21 @@ import {
286
288
  SHELL_EXECUTING_TOOL_NAMES,
287
289
  isValidExternalToolGuardDenialReason
288
290
  } from "./chunk-3VUENPWF.js";
289
- import "./chunk-M5GB774H.js";
290
291
  import {
291
292
  ACP_EVENT_LOOP_STALL_RESTART_MS,
292
293
  CHANNEL_PROMPT_META_KEY
293
- } from "./chunk-U4DJ5XB3.js";
294
+ } from "./chunk-VDXYYVCD.js";
294
295
  import {
295
296
  AgentSideConnection,
296
297
  PROTOCOL_VERSION,
297
298
  RequestError
298
299
  } from "./chunk-IW6RQPQB.js";
299
- import "./chunk-ZVP4PWBU.js";
300
+ import "./chunk-5HBA2Z7V.js";
301
+ import "./chunk-X35VIWWJ.js";
300
302
  import {
301
303
  assembleMcpServers,
302
304
  loadMcpApprovals
303
- } from "./chunk-C2VWOXHS.js";
305
+ } from "./chunk-DNPHKA72.js";
304
306
  import {
305
307
  deleteNestedPropertySafe,
306
308
  getOutputLanguageFilePath,
@@ -312,10 +314,10 @@ import {
312
314
  settingExistsInScope,
313
315
  updateOutputLanguageFile,
314
316
  writeOutputLanguageAndRegisterPath
315
- } from "./chunk-VWTSRH6C.js";
316
- import "./chunk-NQ4L2CMD.js";
317
+ } from "./chunk-AQ5NAGWI.js";
318
+ import "./chunk-ER273QE6.js";
317
319
  import "./chunk-RKUWKYED.js";
318
- import "./chunk-O5CD7T4T.js";
320
+ import "./chunk-BW4333PP.js";
319
321
  import {
320
322
  getSystemDefaultsPath,
321
323
  getSystemSettingsPath
@@ -323,7 +325,7 @@ import {
323
325
  import {
324
326
  getCurrentLanguage,
325
327
  setLanguageAsync
326
- } from "./chunk-I4NRYS6A.js";
328
+ } from "./chunk-MUZCSTOO.js";
327
329
  import {
328
330
  SUPPORTED_LANGUAGES
329
331
  } from "./chunk-5EJZE3FP.js";
@@ -331,19 +333,19 @@ import {
331
333
  findEnvFiles,
332
334
  preResolveHomeEnvOverrides,
333
335
  reloadEnvironment
334
- } from "./chunk-C4TIXFDZ.js";
336
+ } from "./chunk-H3UDNQLO.js";
335
337
  import {
336
338
  ENV_ACP_REPEATED_TOOL_FAILURE_GUARD,
337
339
  QWEN_CODE_SERVE_ENV
338
- } from "./chunk-2M3EWQNG.js";
340
+ } from "./chunk-NUQFUXOG.js";
339
341
  import "./chunk-2EAZ43JQ.js";
340
342
  import "./chunk-NF5J2WFA.js";
341
- import "./chunk-VBWD6C27.js";
343
+ import "./chunk-XUSOYE2I.js";
342
344
  import "./chunk-W3N5XAZ6.js";
343
345
  import {
344
346
  isWorkspaceTrusted,
345
347
  loadTrustedFolders
346
- } from "./chunk-65HWLGA7.js";
348
+ } from "./chunk-XY3USGFE.js";
347
349
  import "./chunk-NPQ5ZKRP.js";
348
350
  import "./chunk-MR3PXB6E.js";
349
351
  import {
@@ -360,8 +362,10 @@ import {
360
362
  buildGoalContinuationParts,
361
363
  buildInstallPlan,
362
364
  buildSessionRecoveryPlanFromApiHistory,
365
+ countApiUserPrompts,
363
366
  detectAutonomousSentinel,
364
367
  detectLoopSentinel,
368
+ findApiRewindCutPoint,
365
369
  findExistingProviderModels,
366
370
  findProviderById,
367
371
  generatePromptSuggestion,
@@ -373,46 +377,59 @@ import {
373
377
  resolveBaseUrl,
374
378
  runManagedRememberByAgent,
375
379
  subagentGenerator
376
- } from "./chunk-JUARRUMA.js";
380
+ } from "./chunk-UEZOXZNI.js";
381
+ import {
382
+ buildToolWriteOriginMeta
383
+ } from "./chunk-GELRJXE2.js";
384
+ import "./chunk-32CM56LO.js";
377
385
  import {
378
386
  MAX_RETAINED_SNAPSHOTS,
379
387
  deleteWorkflowSnapshot,
388
+ extractAndStripMeta,
380
389
  listSavedWorkflows,
381
390
  listWorkflowSnapshots,
391
+ resolveSavedWorkflowScript,
382
392
  toSnapshot
383
- } from "./chunk-I2TMJPCV.js";
393
+ } from "./chunk-JPEAQJNS.js";
384
394
  import "./chunk-XFSFZCM5.js";
385
395
  import {
386
396
  CreateSubSessionTool
387
- } from "./chunk-JR42V4UY.js";
397
+ } from "./chunk-WTW36TJ3.js";
388
398
  import "./chunk-LJZSMWOH.js";
389
399
  import {
390
400
  restoreWorktreeContext
391
- } from "./chunk-RAFQIHN2.js";
392
- import "./chunk-L26ONV2Y.js";
393
- import "./chunk-47RYEQW5.js";
394
- import "./chunk-IG4W5SJR.js";
401
+ } from "./chunk-VUSSAGKI.js";
402
+ import "./chunk-O45WBTNS.js";
403
+ import "./chunk-DJXSOEFB.js";
404
+ import "./chunk-2WGJG2KW.js";
405
+ import "./chunk-QMFOYPGV.js";
406
+ import "./chunk-LDS57224.js";
395
407
  import "./chunk-ZPJWUGCS.js";
396
- import "./chunk-4UANMABT.js";
397
- import "./chunk-ZKFTS3OV.js";
398
- import "./chunk-ENYUKMFK.js";
399
- import "./chunk-UKYXYWI2.js";
408
+ import "./chunk-HFTB354P.js";
409
+ import "./chunk-BUQN5LTI.js";
400
410
  import {
401
411
  clearCachedCredentialFile,
402
412
  qwenOAuth2Events
403
- } from "./chunk-3AKCBZVW.js";
404
- import "./chunk-SULZPKTA.js";
413
+ } from "./chunk-VU7O7CGQ.js";
414
+ import "./chunk-QSC5YOEC.js";
405
415
  import "./chunk-VNOVK4I7.js";
406
416
  import {
407
417
  APPROVAL_MODE_INFO,
408
418
  BranchPointInvalidError,
409
419
  ExtensionManager,
410
420
  GLOBAL_DUPLICATE_THRESHOLD,
421
+ GOAL_PAUSE_REASON_SESSION_DISPOSED,
422
+ GOAL_PAUSE_REASON_SESSION_TOKEN_LIMIT,
423
+ GOAL_PAUSE_REASON_STOP_HOOK_CAP,
424
+ GOAL_PAUSE_REASON_USER_INTERRUPT,
411
425
  GoalConflictError,
412
426
  GoalInvalidTransitionError,
413
427
  GoalPersistenceUnavailableError,
414
428
  InvalidMcpConfigError,
415
429
  InvalidSessionTranscriptCursorError,
430
+ InvalidSessionTranscriptTurnAnchorError,
431
+ MAX_AGENT_TRACE_NODES,
432
+ MAX_RETAINED_TERMINAL_AGENTS,
416
433
  MAX_TRANSCRIPT_MESSAGES,
417
434
  MCPOAuthProvider,
418
435
  MCPOAuthTokenStorage,
@@ -452,7 +469,7 @@ import {
452
469
  convertToFunctionErrorResponse,
453
470
  convertToFunctionResponse,
454
471
  createDuplicateProviderToolCallResponse,
455
- decorateClassifierUnavailableConfirmation,
472
+ decorateAutoModeFallbackConfirmation,
456
473
  decoratePlanModeShellConfirmation,
457
474
  dedupeToolCallsById,
458
475
  didWriteProjectContextFile,
@@ -475,15 +492,19 @@ import {
475
492
  formatStopHookBlockingCapWarning,
476
493
  generateToolUseId,
477
494
  getActiveGoal,
495
+ getAutoModeActionFingerprint,
478
496
  getAutoModePermissionDeniedReason,
479
497
  getEffectivePermissionForConfirmation,
480
498
  getFunctionCallFingerprint,
481
499
  getMCPDiscoveryState,
500
+ getOptInToolNotFoundMessage,
482
501
  getProviderToolCallId,
483
502
  getScopedEnvContents,
484
503
  getStopHookContinuationReason,
504
+ getSubagentSessionDir,
485
505
  getToolCallRepeatKey,
486
506
  getWorkflowTaskMutationKey,
507
+ goalPauseReasonForFailure,
487
508
  goalTurnContext,
488
509
  ideContextStore,
489
510
  injectPermissionRulesIfMissing,
@@ -506,6 +527,9 @@ import {
506
527
  parseGoalSnapshotV2,
507
528
  parseGoalStateCause,
508
529
  persistPermissionOutcome,
530
+ prepareAutoModeFallback,
531
+ readAgentMetaAsync,
532
+ readAgentTrace,
509
533
  recordAllow,
510
534
  recordFallbackApprove,
511
535
  recordHandledToolCall,
@@ -514,8 +538,8 @@ import {
514
538
  restorableAskUserQuestionCallIds,
515
539
  runForkedAgent,
516
540
  runManagedAutoMemoryDream,
541
+ sanitizeFilenameComponent,
517
542
  shouldClassifyAllShellForAutoMode,
518
- shouldFallback,
519
543
  shouldFirePermissionDeniedForAutoMode,
520
544
  shouldForceAutoModeReviewForAllow,
521
545
  shouldHaltOnTurnToolCallCap,
@@ -527,47 +551,49 @@ import {
527
551
  updateSetting,
528
552
  validatePlanModeShellApproval,
529
553
  validatePlanModeShellContext
530
- } from "./chunk-4F7GQGXB.js";
554
+ } from "./chunk-I72PHOKL.js";
531
555
  import "./chunk-GOFAQQZA.js";
532
- import "./chunk-5M6IDOMF.js";
556
+ import "./chunk-3K65MUKD.js";
533
557
  import "./chunk-6HUXPLB5.js";
534
558
  import "./chunk-TWPJO254.js";
535
559
  import {
536
560
  external_exports
537
561
  } from "./chunk-CQ35AJ4Z.js";
538
- import "./chunk-NSUKQ4DN.js";
539
- import "./chunk-DQCKVAF5.js";
540
- import "./chunk-AI35S34R.js";
541
- import "./chunk-KM3XVTMO.js";
562
+ import "./chunk-YHDGABDC.js";
563
+ import "./chunk-RDKXZ2LS.js";
564
+ import "./chunk-B54PFQS5.js";
565
+ import "./chunk-43NOB5NM.js";
542
566
  import {
543
567
  parsePositiveIntegerEnv
544
568
  } from "./chunk-6PVPNMXU.js";
545
569
  import {
546
570
  RUNTIME_SNAPSHOT_PREFIX
547
- } from "./chunk-OKTNXDVO.js";
571
+ } from "./chunk-565U2ANU.js";
548
572
  import {
549
573
  SESSION_ARTIFACT_PERSISTENCE_VERSION,
550
574
  normalizeEventPayload,
551
575
  normalizeSnapshotPayload,
552
576
  wrapUserPromptSubmitContext
553
- } from "./chunk-EFTPIZIC.js";
577
+ } from "./chunk-FDOGGKAA.js";
554
578
  import "./chunk-IRH27ZC2.js";
555
579
  import "./chunk-QHWCP53L.js";
556
- import "./chunk-UJ4DUYIH.js";
580
+ import "./chunk-F53KKZUD.js";
581
+ import "./chunk-PZV2FASB.js";
557
582
  import "./chunk-QJNDUTOL.js";
583
+ import "./chunk-OECNP26L.js";
558
584
  import {
559
585
  promptIdContext,
560
586
  todoWorkChainContext
561
587
  } from "./chunk-O6GEWCJA.js";
562
588
  import {
563
- getArenaSystemReminder,
564
- getOutputStyleTurnReminder,
565
- getPlanModeSystemReminder,
566
- resolveMainSessionOutputStyle
567
- } from "./chunk-OSSTATJF.js";
568
- import "./chunk-ZHO2CW6D.js";
569
- import "./chunk-CVX63TFJ.js";
570
- import "./chunk-373DQUVA.js";
589
+ escapeJsonTagCharacters
590
+ } from "./chunk-CHEIIBT3.js";
591
+ import "./chunk-UKKYOIVT.js";
592
+ import "./chunk-B44JBZBB.js";
593
+ import "./chunk-BF3RUIVP.js";
594
+ import {
595
+ APPROVAL_MODES
596
+ } from "./chunk-JX6XHPTX.js";
571
597
  import {
572
598
  AgentOutputMessageCapture,
573
599
  addAgentInputMessageAttributes,
@@ -575,32 +601,30 @@ import {
575
601
  addToolCallResultAttributes,
576
602
  registerAcpEventLoopLagGauge,
577
603
  startEventLoopLagMonitor
578
- } from "./chunk-H43PSPYS.js";
604
+ } from "./chunk-R355CUNQ.js";
579
605
  import {
580
606
  HookEventName,
581
607
  createHookOutput
582
- } from "./chunk-U6D2PPMN.js";
583
- import "./chunk-VYIUNFEA.js";
584
- import "./chunk-KGV55H53.js";
585
- import "./chunk-7TBU7PU2.js";
586
- import "./chunk-E4JNFXNI.js";
587
- import {
588
- escapeJsonTagCharacters
589
- } from "./chunk-CHEIIBT3.js";
590
- import "./chunk-TJYRTS4S.js";
591
- import {
592
- APPROVAL_MODES
593
- } from "./chunk-JX6XHPTX.js";
608
+ } from "./chunk-4VUVBN3Y.js";
609
+ import "./chunk-ZSTCM3MX.js";
610
+ import "./chunk-NXWYCSPL.js";
594
611
  import "./chunk-MLXTMF7H.js";
612
+ import {
613
+ getArenaSystemReminder,
614
+ getOutputStyleTurnReminder,
615
+ getPlanModeSystemReminder,
616
+ resolveMainSessionOutputStyle
617
+ } from "./chunk-GXZHYPHZ.js";
618
+ import "./chunk-3CZ2BQV6.js";
595
619
  import "./chunk-PQEISIKS.js";
596
- import "./chunk-FD5SJOWT.js";
620
+ import "./chunk-3K456UJF.js";
597
621
  import {
598
622
  runWithRuntimeContentGenerator
599
- } from "./chunk-4LIFGNI4.js";
623
+ } from "./chunk-VEFRT7NX.js";
600
624
  import "./chunk-S6LOFUVP.js";
601
625
  import "./chunk-NAVJD2PQ.js";
602
- import "./chunk-KFN2IZYR.js";
603
- import "./chunk-GB4UKWY5.js";
626
+ import "./chunk-UKADFFL2.js";
627
+ import "./chunk-EJNYBDYC.js";
604
628
  import "./chunk-QHMLYMMS.js";
605
629
  import {
606
630
  getToolCallPreparations
@@ -609,20 +633,18 @@ import {
609
633
  REASONING_EFFORT_TIERS
610
634
  } from "./chunk-2LD5U7Q3.js";
611
635
  import "./chunk-DJ2GSRLV.js";
612
- import "./chunk-S2T7H5MI.js";
613
- import "./chunk-LKODFJRD.js";
636
+ import "./chunk-W4LL5RZO.js";
637
+ import "./chunk-3UMWOKJC.js";
638
+ import "./chunk-KFFCDLKV.js";
614
639
  import {
615
640
  addDaemonRequestAttribute,
616
641
  extractDaemonTraceContext,
617
642
  withDaemonSpan
618
- } from "./chunk-LB3WQQJK.js";
643
+ } from "./chunk-7OCIQNKX.js";
619
644
  import {
620
645
  ConversationFinishedEvent,
621
646
  DiscoveredMCPTool,
622
- INVOCATION_CONTEXT_META_KEY,
623
647
  LoopDetectedEvent,
624
- PRIVATE_ACP_CAPABILITY_ENV,
625
- PRIVATE_PARENT_CAPABILITY_META_KEY,
626
648
  PromptSuggestionEvent,
627
649
  RepeatedToolFailureGuardEvent,
628
650
  UserPromptEvent,
@@ -630,7 +652,6 @@ import {
630
652
  formatFullTurnVisionNotice,
631
653
  formatVisionBridgeNotice,
632
654
  getFullTurnVisionModelSelector,
633
- getInvocationContext,
634
655
  getMCPServerStatus,
635
656
  hasImageParts,
636
657
  logConversationFinishedEvent,
@@ -640,38 +661,45 @@ import {
640
661
  logToolCall,
641
662
  logUserPrompt,
642
663
  normalizeParts,
643
- parseInvocationContext,
644
664
  runSideQuery,
645
665
  runVisionBridge,
646
- runWithInvocationContext,
647
666
  shouldRunVisionBridge,
648
667
  splitImageParts,
649
668
  uiTelemetryService
650
- } from "./chunk-GH2S4GD5.js";
669
+ } from "./chunk-P5LDR7FI.js";
670
+ import {
671
+ INVOCATION_CONTEXT_META_KEY,
672
+ PRIVATE_ACP_CAPABILITY_ENV,
673
+ PRIVATE_PARENT_CAPABILITY_META_KEY,
674
+ getInvocationContext,
675
+ parseInvocationContext,
676
+ runWithInvocationContext
677
+ } from "./chunk-5ETULJLP.js";
651
678
  import "./chunk-XBVNNDPK.js";
652
679
  import "./chunk-VGC4I5JJ.js";
653
680
  import {
654
681
  getAllMemoryFilenames,
655
682
  getSpecificMimeType
656
- } from "./chunk-DYTW3QVG.js";
683
+ } from "./chunk-J6MB5ZHZ.js";
657
684
  import {
658
685
  getAutoMemoryRoot,
659
686
  getUserAutoMemoryRoot
660
- } from "./chunk-HT5S5TRQ.js";
687
+ } from "./chunk-EDIDYZBT.js";
688
+ import "./chunk-HD7O6WLV.js";
661
689
  import "./chunk-WZAD4ZNJ.js";
662
690
  import {
663
691
  DEFAULT_TOKEN_LIMIT,
664
692
  tokenLimit
665
693
  } from "./chunk-FPGTNKCP.js";
666
- import "./chunk-EIJT2PQ6.js";
694
+ import "./chunk-TIGXX4PA.js";
667
695
  import {
668
696
  hasVertexProjectConfigured,
669
697
  preloadContentGenerator
670
- } from "./chunk-BFY33IB4.js";
671
- import "./chunk-KHP66DFN.js";
698
+ } from "./chunk-5MTARK4Y.js";
699
+ import "./chunk-XFFRI3WM.js";
672
700
  import {
673
701
  AuthType
674
- } from "./chunk-22UH7VTP.js";
702
+ } from "./chunk-4HOEU2OR.js";
675
703
  import "./chunk-HHJLM3WQ.js";
676
704
  import {
677
705
  endToolExecutionSpan,
@@ -683,18 +711,17 @@ import {
683
711
  startToolExecutionSpan,
684
712
  startToolSpan,
685
713
  withInteractionSpan
686
- } from "./chunk-QKDNS6FU.js";
714
+ } from "./chunk-7VEYUF3N.js";
687
715
  import "./chunk-74TONY4F.js";
688
- import "./chunk-ZDFQGHZH.js";
716
+ import "./chunk-GMNLYQOS.js";
689
717
  import {
690
718
  FORK_SUBAGENT_TYPE,
691
- getStartupContextLength,
692
719
  isSystemReminderContent,
693
720
  wrapSystemReminder
694
- } from "./chunk-G7HBEEX7.js";
695
- import "./chunk-QQD2GART.js";
696
- import "./chunk-AQ37AY7B.js";
697
- import "./chunk-ODZF64DM.js";
721
+ } from "./chunk-D6PIMKY3.js";
722
+ import "./chunk-NGX4NUNP.js";
723
+ import "./chunk-FKJM6JKY.js";
724
+ import "./chunk-IZ2U57NY.js";
698
725
  import {
699
726
  BaseDeclarativeTool,
700
727
  BaseToolInvocation,
@@ -702,7 +729,7 @@ import {
702
729
  ToolNames,
703
730
  canonicalToolName,
704
731
  isShellProgressData
705
- } from "./chunk-7JMGTOH7.js";
732
+ } from "./chunk-RPBMP6BN.js";
706
733
  import {
707
734
  Storage,
708
735
  createDebugLogger,
@@ -710,12 +737,12 @@ import {
710
737
  getErrorStatus,
711
738
  isSubpath,
712
739
  sessionIdContext
713
- } from "./chunk-EAHOJF6V.js";
714
- import "./chunk-QJGYU5PG.js";
740
+ } from "./chunk-ZAFYHRVY.js";
741
+ import "./chunk-TDP7UULF.js";
715
742
  import "./chunk-HRPFBHW7.js";
716
743
  import {
717
744
  runExitCleanup
718
- } from "./chunk-RJUVTJEZ.js";
745
+ } from "./chunk-BKNY7PDI.js";
719
746
  import {
720
747
  writeStderrLine,
721
748
  writeStderrLineSafe
@@ -723,7 +750,7 @@ import {
723
750
  import "./chunk-75DOP5OR.js";
724
751
  import "./chunk-DMTGGOSA.js";
725
752
  import "./chunk-YQ3U5MUC.js";
726
- import "./chunk-AMDSOFFV.js";
753
+ import "./chunk-MATEIJZF.js";
727
754
  import "./chunk-TBWQLLFO.js";
728
755
  import {
729
756
  init_esbuild_shims
@@ -967,9 +994,9 @@ var AcpFileSystemService = class {
967
994
 
968
995
  // packages/cli/src/acp-integration/acpAgent.ts
969
996
  import { Readable as Readable2, Writable as Writable2 } from "node:stream";
970
- import * as fs3 from "node:fs/promises";
997
+ import * as fs4 from "node:fs/promises";
971
998
  import * as os3 from "node:os";
972
- import * as path6 from "node:path";
999
+ import * as path7 from "node:path";
973
1000
 
974
1001
  // packages/cli/src/config/settings-cache.ts
975
1002
  init_esbuild_shims();
@@ -1133,8 +1160,8 @@ function failure(message) {
1133
1160
  };
1134
1161
  }
1135
1162
  __name(failure, "failure");
1136
- function resolvePrivatePngPath(path7, captureDirectory) {
1137
- const resolvedPath = resolve2(path7);
1163
+ function resolvePrivatePngPath(path8, captureDirectory) {
1164
+ const resolvedPath = resolve2(path8);
1138
1165
  if (dirname(resolvedPath) !== resolve2(captureDirectory)) {
1139
1166
  throw new Error(
1140
1167
  "Host returned a screenshot outside its private directory."
@@ -1143,11 +1170,11 @@ function resolvePrivatePngPath(path7, captureDirectory) {
1143
1170
  return resolvedPath;
1144
1171
  }
1145
1172
  __name(resolvePrivatePngPath, "resolvePrivatePngPath");
1146
- async function readPrivatePng(path7) {
1147
- if ((await lstat(path7)).isSymbolicLink()) {
1173
+ async function readPrivatePng(path8) {
1174
+ if ((await lstat(path8)).isSymbolicLink()) {
1148
1175
  throw new Error("Host returned a symbolic link screenshot path.");
1149
1176
  }
1150
- const handle = await open(path7, constants.O_RDONLY | constants.O_NOFOLLOW);
1177
+ const handle = await open(path8, constants.O_RDONLY | constants.O_NOFOLLOW);
1151
1178
  try {
1152
1179
  const stat2 = await handle.stat();
1153
1180
  if (!stat2.isFile() || stat2.size <= 0 || stat2.size > MAX_SCREENSHOT_BYTES) {
@@ -2028,7 +2055,9 @@ __name(supportsHideAlwaysAllow, "supportsHideAlwaysAllow");
2028
2055
  function filterAlwaysAllowOptions(confirmation, options, forceHideAlwaysAllow = false) {
2029
2056
  const hideAlwaysAllow = forceHideAlwaysAllow || confirmation.autoModeFallback !== void 0 || supportsHideAlwaysAllow(confirmation) && confirmation.hideAlwaysAllow === true;
2030
2057
  const visibleOptions = hideAlwaysAllow ? options.filter((option) => option.kind !== "allow_always") : options;
2031
- if (!confirmation.autoModeFallback) return visibleOptions;
2058
+ if (confirmation.autoModeFallback?.reason !== "classifier_unavailable" && confirmation.autoModeFallback?.reason !== "consecutive_unavailable") {
2059
+ return visibleOptions;
2060
+ }
2032
2061
  const switchOption = {
2033
2062
  optionId: "proceed_once_and_switch_to_default" /* ProceedOnceAndSwitchToDefault */,
2034
2063
  name: "Switch to Default Mode and allow once (recommended)",
@@ -2300,6 +2329,7 @@ var SubAgentTracker = class {
2300
2329
  messageEmitter;
2301
2330
  subagentMeta;
2302
2331
  toolStates = /* @__PURE__ */ new Map();
2332
+ approvalNotified = /* @__PURE__ */ new Set();
2303
2333
  /**
2304
2334
  * Sets up event listeners for a sub-agent's tool events.
2305
2335
  *
@@ -2351,6 +2381,18 @@ var SubAgentTracker = class {
2351
2381
  invocation,
2352
2382
  args: event.args
2353
2383
  });
2384
+ const progressMessage = event.description ? `${tool?.displayName ?? event.name}: ${event.description}` : `Running tool: ${tool?.displayName ?? event.name}`;
2385
+ void this.toolCallEmitter.emitProgressUpdate(
2386
+ this.subagentMeta.parentToolCallId,
2387
+ this.subagentMeta.subagentType,
2388
+ progressMessage,
2389
+ event.name
2390
+ ).catch((error) => {
2391
+ debugLogger3.debug(
2392
+ "Failed to emit subagent progress update for tool call:",
2393
+ error
2394
+ );
2395
+ });
2354
2396
  void this.toolCallEmitter.emitStart({
2355
2397
  toolName: event.name,
2356
2398
  callId: event.callId,
@@ -2398,6 +2440,20 @@ var SubAgentTracker = class {
2398
2440
  const event = args[0];
2399
2441
  if (abortSignal.aborted) return;
2400
2442
  const state = this.toolStates.get(event.callId);
2443
+ if (!this.approvalNotified.has(event.callId) && !abortSignal.aborted) {
2444
+ this.approvalNotified.add(event.callId);
2445
+ void this.toolCallEmitter.emitProgressUpdate(
2446
+ this.subagentMeta.parentToolCallId,
2447
+ this.subagentMeta.subagentType,
2448
+ `Waiting for permission: ${state?.tool?.displayName ?? event.name}`,
2449
+ event.name
2450
+ ).catch((error) => {
2451
+ debugLogger3.debug(
2452
+ "Failed to emit subagent progress update for approval:",
2453
+ error
2454
+ );
2455
+ });
2456
+ }
2401
2457
  const fullConfirmationDetails = {
2402
2458
  ...event.confirmationDetails,
2403
2459
  onConfirm: /* @__PURE__ */ __name(async () => {
@@ -3255,6 +3311,9 @@ function isTodoStopGuardPromptText(text) {
3255
3311
  return remainder === body || remainder === body + TODO_STOP_GUARD_FINAL_PROMPT_SUFFIX;
3256
3312
  }
3257
3313
  __name(isTodoStopGuardPromptText, "isTodoStopGuardPromptText");
3314
+ var ACP_API_USER_PROMPT_OPTIONS = {
3315
+ excludeTextPart: isTodoStopGuardPromptText
3316
+ };
3258
3317
  async function finalizeToolCallPreparations(tracker, includeResolved, streamName) {
3259
3318
  try {
3260
3319
  await tracker.discard(includeResolved);
@@ -4054,7 +4113,15 @@ var Session = class {
4054
4113
  this.requiresManagedConversationActivation = this.requiresManagedConversationBinding && this.config.isProvisionalWorkspace?.() === true;
4055
4114
  this.slashCommandPolicy = this.requiresManagedConversationBinding ? STANDALONE_SLASH_COMMAND_POLICY : void 0;
4056
4115
  this.runtimeBaseDir = config.storage.getRuntimeBaseDir();
4057
- const todoStopGuardEnabled = this.settings.merged.experimental?.todoStopGuard === true && !this.config.getBareMode() && !this.config.isSafeMode();
4116
+ const todoStopGuardConfigured = this.settings.merged.experimental?.todoStopGuard === true;
4117
+ const todoStopGuardModeAllowed = todoStopGuardConfigured && !this.config.getBareMode() && !this.config.isSafeMode();
4118
+ const todoWriteEnabled = this.settings.merged.tools?.todoWrite?.enabled === true;
4119
+ const todoStopGuardEnabled = todoStopGuardConfigured && todoStopGuardModeAllowed && todoWriteEnabled;
4120
+ if (todoStopGuardConfigured && todoStopGuardModeAllowed && !todoWriteEnabled) {
4121
+ debugLogger6.warn(
4122
+ "experimental.todoStopGuard requires tools.todoWrite.enabled; the Todo Stop Guard is disabled."
4123
+ );
4124
+ }
4058
4125
  const sessionWorkflowEnabledFromSettings = this.settings.merged.experimental?.sessionWorkflow === true;
4059
4126
  this.config.setSessionWorkflowEnabledProvider?.(
4060
4127
  () => sessionWorkflowEnabledFromSettings
@@ -4491,7 +4558,11 @@ var Session = class {
4491
4558
  turn
4492
4559
  );
4493
4560
  } catch (error) {
4494
- await this.#settleGoalTurn(turn, void 0, true);
4561
+ await this.#settleGoalTurn(
4562
+ turn,
4563
+ void 0,
4564
+ error instanceof Error ? error.message : String(error)
4565
+ );
4495
4566
  debugLogger6.warn(
4496
4567
  `ACP Goal turn failed: ${error instanceof Error ? error.message : String(error)}`
4497
4568
  );
@@ -4522,19 +4593,27 @@ var Session = class {
4522
4593
  );
4523
4594
  }
4524
4595
  }
4525
- async #settleGoalTurn(turn, result, failed) {
4596
+ async #settleGoalTurn(turn, result, failureMessage) {
4526
4597
  try {
4527
4598
  const runtime = await this.config.getGoalRuntimeReady();
4528
4599
  if (!sameGoalPermit(runtime.permitForTurn(turn.turnKey), turn.permit)) {
4529
4600
  return;
4530
4601
  }
4531
4602
  if (!turn.modelStarted) {
4532
- if (turn.controller.signal.reason === USER_CANCEL_ABORT_REASON && runtime.getSnapshot().goal?.status === "active") {
4533
- await runtime.dispatch({
4534
- action: "pause",
4535
- expectedGoalId: turn.permit.goalId,
4536
- expectedRevision: turn.permit.revision
4537
- });
4603
+ if ((turn.controller.signal.reason === USER_CANCEL_ABORT_REASON || turn.controller.signal.reason === SESSION_DISPOSE_ABORT_REASON) && runtime.getSnapshot().goal?.status === "active") {
4604
+ try {
4605
+ await runtime.dispatch({
4606
+ action: "pause",
4607
+ expectedGoalId: turn.permit.goalId,
4608
+ expectedRevision: turn.permit.revision,
4609
+ reason: turn.controller.signal.reason === SESSION_DISPOSE_ABORT_REASON ? GOAL_PAUSE_REASON_SESSION_DISPOSED : GOAL_PAUSE_REASON_USER_INTERRUPT
4610
+ });
4611
+ } catch (error) {
4612
+ debugLogger6.warn(
4613
+ `Failed to record pre-model ACP Goal turn settlement: ${error instanceof Error ? error.message : String(error)}`
4614
+ );
4615
+ await runtime.releaseTurn(turn.turnKey, { requeue: false });
4616
+ }
4538
4617
  } else {
4539
4618
  await runtime.releaseTurn(turn.turnKey);
4540
4619
  }
@@ -4549,13 +4628,14 @@ var Session = class {
4549
4628
  }
4550
4629
  const cancelledByUser = result?.stopReason === "cancelled" && turn.controller.signal.reason === USER_CANCEL_ABORT_REASON;
4551
4630
  const supersededByNewPrompt = turn.controller.signal.reason === NEW_PROMPT_ABORT_REASON;
4552
- const shouldPause = !supersededByNewPrompt && (failed || result?.stopReason === "max_tokens" || cancelledByUser || turn.controller.signal.reason === SESSION_DISPOSE_ABORT_REASON);
4631
+ const pauseReason = supersededByNewPrompt ? void 0 : cancelledByUser ? GOAL_PAUSE_REASON_USER_INTERRUPT : result?.stopReason === "max_tokens" ? GOAL_PAUSE_REASON_SESSION_TOKEN_LIMIT : turn.controller.signal.reason === SESSION_DISPOSE_ABORT_REASON ? GOAL_PAUSE_REASON_SESSION_DISPOSED : failureMessage !== void 0 ? goalPauseReasonForFailure(failureMessage) : void 0;
4553
4632
  try {
4554
- if (shouldPause && runtime.getSnapshot().goal?.status === "active") {
4633
+ if (pauseReason !== void 0 && runtime.getSnapshot().goal?.status === "active") {
4555
4634
  await runtime.dispatch({
4556
4635
  action: "pause",
4557
4636
  expectedGoalId: turn.permit.goalId,
4558
- expectedRevision: turn.permit.revision
4637
+ expectedRevision: turn.permit.revision,
4638
+ reason: pauseReason
4559
4639
  });
4560
4640
  return;
4561
4641
  }
@@ -4564,7 +4644,11 @@ var Session = class {
4564
4644
  debugLogger6.warn(
4565
4645
  `Failed to record ACP Goal turn settlement: ${error instanceof Error ? error.message : String(error)}`
4566
4646
  );
4567
- await runtime.releaseTurn(turn.turnKey);
4647
+ if (pauseReason !== void 0) {
4648
+ await runtime.releaseTurn(turn.turnKey, { requeue: false });
4649
+ } else {
4650
+ await runtime.releaseTurn(turn.turnKey);
4651
+ }
4568
4652
  }
4569
4653
  } catch (error) {
4570
4654
  debugLogger6.warn(
@@ -4587,7 +4671,8 @@ var Session = class {
4587
4671
  await runtime.dispatch({
4588
4672
  action: "pause",
4589
4673
  expectedGoalId: goal.goalId,
4590
- expectedRevision: goal.revision
4674
+ expectedRevision: goal.revision,
4675
+ reason: GOAL_PAUSE_REASON_STOP_HOOK_CAP
4591
4676
  });
4592
4677
  } catch (error) {
4593
4678
  debugLogger6.warn(
@@ -5247,6 +5332,9 @@ var Session = class {
5247
5332
  getConfig() {
5248
5333
  return this.config;
5249
5334
  }
5335
+ getSettings() {
5336
+ return this.settings;
5337
+ }
5250
5338
  getWorkflowHistory() {
5251
5339
  return this.workflowHistory;
5252
5340
  }
@@ -5823,7 +5911,8 @@ var Session = class {
5823
5911
  "Cannot rewind while a prompt is running"
5824
5912
  );
5825
5913
  }
5826
- const chat = this.config.getLlmClient().getChat();
5914
+ const llmClient = this.config.getLlmClient();
5915
+ const chat = llmClient.getChat();
5827
5916
  const apiHistory = chat.getHistoryShallow();
5828
5917
  const apiTruncateIndex = this.#computeApiTruncationIndexForUserTurn(
5829
5918
  apiHistory,
@@ -5835,7 +5924,7 @@ var Session = class {
5835
5924
  "Cannot rewind to the requested turn. It may have been compressed or does not exist."
5836
5925
  );
5837
5926
  }
5838
- chat.truncateHistory(apiTruncateIndex);
5927
+ llmClient.truncateHistory(apiTruncateIndex);
5839
5928
  chat.stripThoughtsFromHistory();
5840
5929
  this.clearActiveTodoPlanRevision();
5841
5930
  const preserveQueuedPromptPriority = this.todoStopGuardQueuedPromptPriority;
@@ -5862,17 +5951,10 @@ var Session = class {
5862
5951
  return this.config.getLlmClient().getChat().getHistoryShallow();
5863
5952
  }
5864
5953
  getRewindableUserTurnCount() {
5865
- const apiHistory = this.captureHistorySnapshot();
5866
- const startIndex = getStartupContextLength(apiHistory, {
5867
- includeCompressed: true
5868
- });
5869
- let count = 0;
5870
- for (let i = startIndex; i < apiHistory.length; i++) {
5871
- if (this.#isUserTextContent(apiHistory[i])) {
5872
- count += 1;
5873
- }
5874
- }
5875
- return count;
5954
+ return countApiUserPrompts(
5955
+ this.captureHistorySnapshot(),
5956
+ ACP_API_USER_PROMPT_OPTIONS
5957
+ );
5876
5958
  }
5877
5959
  restoreHistory(history) {
5878
5960
  if (this.closing || this.#hasActiveTurn()) {
@@ -5881,43 +5963,16 @@ var Session = class {
5881
5963
  "Cannot restore history while a prompt is running"
5882
5964
  );
5883
5965
  }
5884
- this.config.getLlmClient().getChat().setHistory(structuredClone(history));
5966
+ this.config.getLlmClient().setHistory(structuredClone(history));
5885
5967
  this.clearActiveTodoPlanRevision();
5886
5968
  this.#clearTodoStopGuardTrustAndDrainAutomaticQueues();
5887
5969
  }
5888
5970
  #computeApiTruncationIndexForUserTurn(apiHistory, targetTurnIndex) {
5889
- const startIndex = getStartupContextLength(apiHistory, {
5890
- includeCompressed: true
5891
- });
5892
- if (targetTurnIndex === 0) {
5893
- return startIndex;
5894
- }
5895
- let realUserPromptCount = 0;
5896
- for (let i = startIndex; i < apiHistory.length; i++) {
5897
- if (!this.#isUserTextContent(apiHistory[i])) {
5898
- continue;
5899
- }
5900
- if (realUserPromptCount === targetTurnIndex) {
5901
- return i;
5902
- }
5903
- realUserPromptCount += 1;
5904
- }
5905
- return -1;
5906
- }
5907
- #isUserTextContent(content) {
5908
- if (content.role !== "user") return false;
5909
- if (!content.parts || content.parts.length === 0) return false;
5910
- const hasFunctionResponse = content.parts.some(
5911
- (part) => "functionResponse" in part
5971
+ return findApiRewindCutPoint(
5972
+ apiHistory,
5973
+ targetTurnIndex,
5974
+ ACP_API_USER_PROMPT_OPTIONS
5912
5975
  );
5913
- if (hasFunctionResponse) return false;
5914
- if (isSystemReminderContent(content)) return false;
5915
- if (content.parts.some(
5916
- (part) => "text" in part && isTodoStopGuardPromptText(part.text)
5917
- )) {
5918
- return false;
5919
- }
5920
- return content.parts.some((part) => "text" in part && part.text);
5921
5976
  }
5922
5977
  async cancelPendingPrompt() {
5923
5978
  const hadPrompt = !!this.pendingPrompt;
@@ -5933,12 +5988,13 @@ var Session = class {
5933
5988
  throw new Error(NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE);
5934
5989
  }
5935
5990
  this.todoStopGuard.suspend();
5991
+ const abortReason = this.closing || this.disposed ? SESSION_DISPOSE_ABORT_REASON : USER_CANCEL_ABORT_REASON;
5936
5992
  if (this.pendingPrompt) {
5937
- this.pendingPrompt.abort(USER_CANCEL_ABORT_REASON);
5993
+ this.pendingPrompt.abort(abortReason);
5938
5994
  this.pendingPrompt = null;
5939
5995
  }
5940
5996
  for (const turn of queuedGoalTurns) {
5941
- turn.controller.abort(USER_CANCEL_ABORT_REASON);
5997
+ turn.controller.abort(abortReason);
5942
5998
  }
5943
5999
  if (this.cronAbortController) {
5944
6000
  this.cronAbortController.abort();
@@ -5963,7 +6019,8 @@ var Session = class {
5963
6019
  await runtime.dispatch({
5964
6020
  action: "pause",
5965
6021
  expectedGoalId: queuedGoalTurn.permit.goalId,
5966
- expectedRevision: queuedGoalTurn.permit.revision
6022
+ expectedRevision: queuedGoalTurn.permit.revision,
6023
+ reason: abortReason === SESSION_DISPOSE_ABORT_REASON ? GOAL_PAUSE_REASON_SESSION_DISPOSED : GOAL_PAUSE_REASON_USER_INTERRUPT
5967
6024
  });
5968
6025
  }
5969
6026
  } catch (error) {
@@ -6193,7 +6250,7 @@ var Session = class {
6193
6250
  });
6194
6251
  let rejectedByLoopProtection = false;
6195
6252
  let promptResult;
6196
- let promptFailed = false;
6253
+ let promptFailureMessage;
6197
6254
  if (turnRecording) turnRecording.startedAt = Date.now();
6198
6255
  try {
6199
6256
  const result = await this.#executePrompt(
@@ -6258,7 +6315,7 @@ var Session = class {
6258
6315
  }
6259
6316
  return completedResult;
6260
6317
  } catch (error) {
6261
- promptFailed = true;
6318
+ promptFailureMessage = error instanceof Error ? error.message : String(error);
6262
6319
  if (error instanceof SessionWriterError) {
6263
6320
  throw new RequestError(error.rpcCode, error.message, {
6264
6321
  errorKind: error.errorKind
@@ -6283,7 +6340,11 @@ var Session = class {
6283
6340
  void this.#drainNotificationQueue();
6284
6341
  }
6285
6342
  if (goalTurn) {
6286
- await this.#settleGoalTurn(goalTurn, promptResult, promptFailed);
6343
+ await this.#settleGoalTurn(
6344
+ goalTurn,
6345
+ promptResult,
6346
+ promptFailureMessage
6347
+ );
6287
6348
  } else if (reservedGoalRuntime && reservedGoalTurnKey) {
6288
6349
  await reservedGoalRuntime.releaseTurn(reservedGoalTurnKey);
6289
6350
  }
@@ -6533,7 +6594,7 @@ var Session = class {
6533
6594
  return { stopReason: "end_turn" };
6534
6595
  }
6535
6596
  if (recoveryPlan.continuation.mode === "retry_user_parts") {
6536
- strippedOrphanEntries = this.#getCurrentChat().stripOrphanedUserEntriesFromHistory() ?? null;
6597
+ strippedOrphanEntries = this.config.getLlmClient().stripOrphanedUserEntriesFromHistory() ?? null;
6537
6598
  orphanPushCountSnapshot = this.#getCurrentChat().getUserContentPushCount?.() ?? 0;
6538
6599
  continuationParts = recoveryPlan.continuation.parts;
6539
6600
  } else {
@@ -6543,7 +6604,7 @@ var Session = class {
6543
6604
  if (goalTurn?.origin === "runtime") {
6544
6605
  } else if (isContinue || isRestoreAskUserQuestion) {
6545
6606
  } else if (isRetry) {
6546
- this.#getCurrentChat().stripOrphanedUserEntriesFromHistory();
6607
+ this.config.getLlmClient().stripOrphanedUserEntriesFromHistory();
6547
6608
  } else if (!isSlashInput || slashCommandName !== "advisor") {
6548
6609
  const attachmentReferences = readDaemonAttachmentReferences(
6549
6610
  promptMetadata?.[DAEMON_ATTACHMENT_REFERENCES_META_KEY]
@@ -7082,6 +7143,24 @@ ${this.pendingRecoveredAgentsNotice}
7082
7143
  )
7083
7144
  };
7084
7145
  }
7146
+ if (await this.#endGoalTurnAfterToolRun(
7147
+ toolRun,
7148
+ goalTurn,
7149
+ channelTurn,
7150
+ responseCapture.channelDelivery !== void 0
7151
+ )) {
7152
+ const result2 = {
7153
+ stopReason: getAbortAwareEndTurnStopReason(
7154
+ pendingSend.signal
7155
+ )
7156
+ };
7157
+ this.#recordPromptCompletionEffects(
7158
+ result2,
7159
+ responseCapture,
7160
+ isFreshUserTurn
7161
+ );
7162
+ return result2;
7163
+ }
7085
7164
  const nextAfterTools = await this.#buildNextMessageAfterToolRun(
7086
7165
  toolRun,
7087
7166
  pendingSend.signal,
@@ -7125,38 +7204,15 @@ ${this.pendingRecoveredAgentsNotice}
7125
7204
  true,
7126
7205
  fullTurnModelOverride,
7127
7206
  responseCapture,
7128
- rejectOnLoopDetected
7207
+ rejectOnLoopDetected,
7208
+ goalTurn,
7209
+ channelTurn
7210
+ );
7211
+ this.#recordPromptCompletionEffects(
7212
+ result,
7213
+ responseCapture,
7214
+ isFreshUserTurn
7129
7215
  );
7130
- if (result.stopReason !== "cancelled") {
7131
- responseCapture.agentOutput.writeToSpan(
7132
- getActiveInteractionSpan()
7133
- );
7134
- }
7135
- if (isFreshUserTurn && result.stopReason === "end_turn" && !result.loopProtectionStopped && this.config.getManagedAutoMemoryEnabled()) {
7136
- const memoryManager = this.config.getMemoryManager();
7137
- const history = this.#getCurrentChat().getHistoryShallow();
7138
- void memoryManager.scheduleExtract({
7139
- projectRoot: this.config.getProjectRoot(),
7140
- sessionId: this.config.getSessionId(),
7141
- history,
7142
- config: this.config
7143
- }).catch((error) => {
7144
- debugLogger6.warn(
7145
- "Failed to schedule ACP managed auto-memory extraction.",
7146
- error
7147
- );
7148
- });
7149
- void memoryManager.scheduleDream({
7150
- projectRoot: this.config.getProjectRoot(),
7151
- sessionId: this.config.getSessionId(),
7152
- config: this.config
7153
- }).catch((error) => {
7154
- debugLogger6.warn(
7155
- "Failed to schedule ACP managed auto-memory dream.",
7156
- error
7157
- );
7158
- });
7159
- }
7160
7216
  return { stopReason: result.stopReason };
7161
7217
  } finally {
7162
7218
  logConversationFinishedEvent(
@@ -7182,7 +7238,7 @@ ${this.pendingRecoveredAgentsNotice}
7182
7238
  }
7183
7239
  });
7184
7240
  }
7185
- async #handleStopHookLoop(pendingSend, promptId, hooksEnabled, messageBus, allowExternalHooks = true, modelOverride, responseCapture, rejectOnLoopDetected = false) {
7241
+ async #handleStopHookLoop(pendingSend, promptId, hooksEnabled, messageBus, allowExternalHooks = true, modelOverride, responseCapture, rejectOnLoopDetected = false, goalTurn, channelTurn = false) {
7186
7242
  const stopHookBlockingCap = this.config.getStopHookBlockingCap();
7187
7243
  let stopHookIterationCount = 0;
7188
7244
  let stopHookReasons = [];
@@ -7243,7 +7299,9 @@ ${this.pendingRecoveredAgentsNotice}
7243
7299
  onFullTurnModel,
7244
7300
  getModelOverride: /* @__PURE__ */ __name(() => modelOverride, "getModelOverride"),
7245
7301
  responseCapture,
7246
- rejectOnLoopDetected
7302
+ rejectOnLoopDetected,
7303
+ ...goalTurn ? { goalTurn } : {},
7304
+ ...channelTurn ? { channelTurn: true } : {}
7247
7305
  }
7248
7306
  );
7249
7307
  if (continuation2.kind === "terminal") {
@@ -7328,7 +7386,9 @@ ${this.pendingRecoveredAgentsNotice}
7328
7386
  onFullTurnModel,
7329
7387
  getModelOverride: /* @__PURE__ */ __name(() => modelOverride, "getModelOverride"),
7330
7388
  responseCapture,
7331
- rejectOnLoopDetected
7389
+ rejectOnLoopDetected,
7390
+ ...goalTurn ? { goalTurn } : {},
7391
+ ...channelTurn ? { channelTurn: true } : {}
7332
7392
  }
7333
7393
  );
7334
7394
  if (continuation2.kind === "terminal") {
@@ -7428,7 +7488,9 @@ ${this.pendingRecoveredAgentsNotice}
7428
7488
  onFullTurnModel,
7429
7489
  getModelOverride: /* @__PURE__ */ __name(() => modelOverride, "getModelOverride"),
7430
7490
  responseCapture,
7431
- rejectOnLoopDetected
7491
+ rejectOnLoopDetected,
7492
+ ...goalTurn ? { goalTurn } : {},
7493
+ ...channelTurn ? { channelTurn: true } : {}
7432
7494
  }
7433
7495
  );
7434
7496
  if (continuation.supersededAutomaticContinuation && externalReason) {
@@ -7900,6 +7962,18 @@ ${this.pendingRecoveredAgentsNotice}
7900
7962
  ...supersededAutomaticContinuation ? { supersededAutomaticContinuation: true } : {}
7901
7963
  };
7902
7964
  }
7965
+ if (await this.#endGoalTurnAfterToolRun(
7966
+ toolRun,
7967
+ options.goalTurn,
7968
+ options.channelTurn ?? false,
7969
+ options.responseCapture?.channelDelivery !== void 0
7970
+ )) {
7971
+ return {
7972
+ kind: "terminal",
7973
+ stopReason: getAbortAwareEndTurnStopReason(pendingSend.signal),
7974
+ ...supersededAutomaticContinuation ? { supersededAutomaticContinuation: true } : {}
7975
+ };
7976
+ }
7903
7977
  const nextAfterTools = await this.#buildNextMessageAfterToolRun(
7904
7978
  toolRun,
7905
7979
  pendingSend.signal,
@@ -8356,6 +8430,74 @@ ${this.pendingRecoveredAgentsNotice}
8356
8430
  );
8357
8431
  await this.messageRewriter?.waitForPendingRewrites();
8358
8432
  }
8433
+ /**
8434
+ * Ends a Goal turn whose tool batch asked for it, mirroring the interactive
8435
+ * and headless paths.
8436
+ *
8437
+ * `update_goal` sets the flag when verification or evidence checkpointing
8438
+ * needs a turn boundary. Feeding a queued proposal back to the model leaves
8439
+ * it parked: the objective is already satisfied, so the model has nothing
8440
+ * left to do but call the Goal tools again, and the runtime rejects every
8441
+ * later proposal for the same turn. Observed runs looped between the two
8442
+ * Goal tools until a human cancelled them, with the turn count never leaving
8443
+ * zero.
8444
+ *
8445
+ * The batch's own responses are preserved so the transcript keeps a
8446
+ * response for every call, but mid-turn user input is deliberately left
8447
+ * queued for the next continuation rather than drained into a turn that is
8448
+ * already over.
8449
+ *
8450
+ * Channel turns and requested channel deliveries keep the loop alive for
8451
+ * their final tool-free response; ending on the tool batch would return or
8452
+ * submit an empty response because only a tool-free response is committed
8453
+ * as the channel final.
8454
+ *
8455
+ * Returns false outside a Goal turn, where nothing sets the flag today and
8456
+ * a turn has no verification boundary to reach.
8457
+ */
8458
+ async #endGoalTurnAfterToolRun(toolRun, goalTurn, channelTurn, hasChannelDelivery) {
8459
+ if (!goalTurn || toolRun.terminateTurn !== true || toolRun.loopDetected || channelTurn || hasChannelDelivery) {
8460
+ return false;
8461
+ }
8462
+ this.todoStopGuard.suspend();
8463
+ this.#preserveUnsentMessageHistory(
8464
+ { role: "user", parts: toolRun.parts },
8465
+ true
8466
+ );
8467
+ await this.messageRewriter?.waitForPendingRewrites();
8468
+ return true;
8469
+ }
8470
+ #recordPromptCompletionEffects(result, responseCapture, isFreshUserTurn) {
8471
+ if (result.stopReason !== "cancelled") {
8472
+ responseCapture.agentOutput.writeToSpan(getActiveInteractionSpan());
8473
+ }
8474
+ if (!isFreshUserTurn || result.stopReason !== "end_turn" || result.loopProtectionStopped || !this.config.getManagedAutoMemoryEnabled()) {
8475
+ return;
8476
+ }
8477
+ const memoryManager = this.config.getMemoryManager();
8478
+ const history = this.#getCurrentChat().getHistoryShallow();
8479
+ void memoryManager.scheduleExtract({
8480
+ projectRoot: this.config.getProjectRoot(),
8481
+ sessionId: this.config.getSessionId(),
8482
+ history,
8483
+ config: this.config
8484
+ }).catch((error) => {
8485
+ debugLogger6.warn(
8486
+ "Failed to schedule ACP managed auto-memory extraction.",
8487
+ error
8488
+ );
8489
+ });
8490
+ void memoryManager.scheduleDream({
8491
+ projectRoot: this.config.getProjectRoot(),
8492
+ sessionId: this.config.getSessionId(),
8493
+ config: this.config
8494
+ }).catch((error) => {
8495
+ debugLogger6.warn(
8496
+ "Failed to schedule ACP managed auto-memory dream.",
8497
+ error
8498
+ );
8499
+ });
8500
+ }
8359
8501
  async #buildNextMessageAfterToolRun(toolRun, abortSignal, promptId, toolLoopState, onFullTurnModel, rejectOnLoopDetected = false) {
8360
8502
  if (toolRun.loopDetected) {
8361
8503
  debugLogger6.debug("Stopping ACP turn after daemon loop detection.");
@@ -9494,6 +9636,14 @@ ${this.pendingRecoveredAgentsNotice}
9494
9636
  });
9495
9637
  });
9496
9638
  this.config.getChatRecordingService()?.setTitleRecordedCallback((customTitle, titleSource, sessionId) => {
9639
+ void this.client.sessionUpdate({
9640
+ sessionId,
9641
+ update: {
9642
+ sessionUpdate: "session_info_update",
9643
+ title: customTitle
9644
+ }
9645
+ }).catch(() => {
9646
+ });
9497
9647
  void this.client.extNotification("qwen/notify/session/title-update", {
9498
9648
  v: 1,
9499
9649
  sessionId,
@@ -10410,6 +10560,7 @@ ${this.pendingRecoveredAgentsNotice}
10410
10560
  sequence: toolResultRecordSequence++
10411
10561
  });
10412
10562
  }, "queueToolResultRecord");
10563
+ let batchTerminatesTurn = false;
10413
10564
  const finalizeRunToolResult = /* @__PURE__ */ __name(async (result) => {
10414
10565
  const orderedRecords = [...pendingToolResultRecords].sort(
10415
10566
  (left, right) => left.ordinal - right.ordinal || left.sequence - right.sequence
@@ -10427,7 +10578,11 @@ ${this.pendingRecoveredAgentsNotice}
10427
10578
  }))
10428
10579
  };
10429
10580
  if (orderedRecords.length === 0) {
10430
- return { ...result, repeatedToolFailureBatch };
10581
+ return {
10582
+ ...result,
10583
+ repeatedToolFailureBatch,
10584
+ ...batchTerminatesTurn ? { terminateTurn: true } : {}
10585
+ };
10431
10586
  }
10432
10587
  const finalized = await finalizeToolResponses(
10433
10588
  this.config,
@@ -10458,7 +10613,8 @@ ${this.pendingRecoveredAgentsNotice}
10458
10613
  return {
10459
10614
  ...result,
10460
10615
  parts: finalized.flatMap((entry) => entry.responseParts),
10461
- repeatedToolFailureBatch
10616
+ repeatedToolFailureBatch,
10617
+ ...batchTerminatesTurn ? { terminateTurn: true } : {}
10462
10618
  };
10463
10619
  }, "finalizeRunToolResult");
10464
10620
  let skippedToolCallCounter = 0;
@@ -10857,6 +11013,7 @@ ${this.pendingRecoveredAgentsNotice}
10857
11013
  for (const r of results) {
10858
11014
  parts.push(...r.parts);
10859
11015
  collectMemoryWriteCandidates(r);
11016
+ batchTerminatesTurn ||= r.terminateTurn === true;
10860
11017
  shouldStop ||= r.stopAfterPermissionCancel;
10861
11018
  shouldStopForLoop ||= r.loopDetected === true;
10862
11019
  }
@@ -10900,6 +11057,7 @@ ${this.pendingRecoveredAgentsNotice}
10900
11057
  );
10901
11058
  parts.push(...r.parts);
10902
11059
  collectMemoryWriteCandidates(r);
11060
+ batchTerminatesTurn ||= r.terminateTurn === true;
10903
11061
  if (r.loopDetected) {
10904
11062
  await appendSkippedAfter(
10905
11063
  parts,
@@ -11175,8 +11333,15 @@ ${this.pendingRecoveredAgentsNotice}
11175
11333
  const toolRegistry = this.config.getToolRegistry();
11176
11334
  const tool = toolRegistry.getTool(toolName);
11177
11335
  if (!tool) {
11336
+ const optInToolMessage = await getOptInToolNotFoundMessage(
11337
+ this.config,
11338
+ toolName,
11339
+ (canonicalName) => Boolean(toolRegistry.getTool(canonicalName))
11340
+ );
11178
11341
  return earlyErrorResponse(
11179
- new Error(`Tool "${toolName}" not found in registry.`),
11342
+ new Error(
11343
+ optInToolMessage ?? `Tool "${toolName}" not found in registry.`
11344
+ ),
11180
11345
  toolName,
11181
11346
  {
11182
11347
  status: "error",
@@ -11295,6 +11460,7 @@ ${this.pendingRecoveredAgentsNotice}
11295
11460
  );
11296
11461
  }
11297
11462
  const isAskUserQuestionTool = policyToolName === ToolNames.ASK_USER_QUESTION;
11463
+ const isTrustedAskUserQuestionTool = isAskUserQuestionTool && tool.kind === "think" /* Think */ && tool.constructor.name === "AskUserQuestionTool";
11298
11464
  let toolParams = invocation.params;
11299
11465
  const flowResult = isTrustedLiveScreenContextTool || isTrustedLiveTaskTool ? {
11300
11466
  defaultPermission: "allow",
@@ -11406,21 +11572,39 @@ ${this.pendingRecoveredAgentsNotice}
11406
11572
  }
11407
11573
  let autoModeAllowed = finalPermission === "allow" && !forceAutoReviewForAllow && !planShellRequiresConfirmation;
11408
11574
  if (autoModeAllowed && approvalMode === "auto" /* AUTO */) {
11575
+ const actionFingerprint = getAutoModeActionFingerprint(
11576
+ policyToolName,
11577
+ toolParams,
11578
+ this.config.getCwd()
11579
+ );
11409
11580
  this.config.setAutoModeDenialState(
11410
- recordAllow(this.config.getAutoModeDenialState())
11581
+ recordAllow(
11582
+ this.config.getAutoModeDenialState(),
11583
+ actionFingerprint
11584
+ )
11411
11585
  );
11412
11586
  }
11413
11587
  let wasAutoModeManualFallback = false;
11414
- let autoModeFallbackMessage;
11588
+ let autoModeFallback;
11415
11589
  if (!autoModeAllowed && !requiresUserInteraction && shouldRunAutoModeForCall(approvalMode, policyToolName)) {
11416
- const denialState = this.config.getAutoModeDenialState();
11417
- const fallback = shouldFallback(denialState);
11418
- const messages = this.config.getLlmClient?.()?.getHistoryTail(MAX_TRANSCRIPT_MESSAGES, false) ?? [];
11590
+ const actionFingerprint = getAutoModeActionFingerprint(
11591
+ policyToolName,
11592
+ toolParams,
11593
+ this.config.getCwd()
11594
+ );
11595
+ const { denialState, fallback } = prepareAutoModeFallback(
11596
+ this.config,
11597
+ actionFingerprint
11598
+ );
11599
+ const llmClient = this.config.getLlmClient?.();
11600
+ const messages = llmClient?.getHistoryTail(MAX_TRANSCRIPT_MESSAGES, false) ?? [];
11601
+ const trustedUserAnswers = llmClient?.getTrustedUserAnswers?.() ?? [];
11419
11602
  const decision = await evaluateAutoMode({
11420
11603
  ctx: pmCtx,
11421
11604
  pmForcedAsk,
11422
11605
  toolParams,
11423
11606
  messages,
11607
+ trustedUserAnswers,
11424
11608
  config: this.config,
11425
11609
  signal: abortSignal,
11426
11610
  skipClassifierReason: fallback.fallback ? fallback.reason : void 0
@@ -11430,7 +11614,8 @@ ${this.pendingRecoveredAgentsNotice}
11430
11614
  const outcome = applyAutoModeDecision(
11431
11615
  decision,
11432
11616
  this.config,
11433
- denialState
11617
+ denialState,
11618
+ actionFingerprint
11434
11619
  );
11435
11620
  await fireSessionPermissionDeniedForAutoMode(
11436
11621
  this.config,
@@ -11464,8 +11649,11 @@ ${this.pendingRecoveredAgentsNotice}
11464
11649
  );
11465
11650
  case "fallback":
11466
11651
  wasAutoModeManualFallback = isDenialFallbackReason(outcome.reason) || outcome.reason === "classifier_unavailable" || outcome.reason === "external_write";
11467
- if (outcome.reason === "classifier_unavailable" || outcome.reason === "external_write") {
11468
- autoModeFallbackMessage = outcome.message;
11652
+ if (outcome.message && (outcome.reason === "classifier_unavailable" || outcome.reason === "external_write" || isDenialFallbackReason(outcome.reason))) {
11653
+ autoModeFallback = {
11654
+ reason: outcome.reason,
11655
+ message: outcome.message
11656
+ };
11469
11657
  }
11470
11658
  if (wasAutoModeManualFallback) {
11471
11659
  debugLogger6.warn(
@@ -11538,10 +11726,11 @@ ${this.pendingRecoveredAgentsNotice}
11538
11726
  if (confirmationDetailsCancellation) {
11539
11727
  return confirmationDetailsCancellation;
11540
11728
  }
11541
- if (autoModeFallbackMessage) {
11542
- confirmationDetails = decorateClassifierUnavailableConfirmation(
11729
+ if (autoModeFallback && confirmationDetails) {
11730
+ confirmationDetails = decorateAutoModeFallbackConfirmation(
11543
11731
  confirmationDetails,
11544
- autoModeFallbackMessage
11732
+ autoModeFallback.reason,
11733
+ autoModeFallback.message
11545
11734
  );
11546
11735
  }
11547
11736
  if (planShellDecision.classification !== "not-applicable") {
@@ -11879,6 +12068,13 @@ ${this.pendingRecoveredAgentsNotice}
11879
12068
  if (confirmationCancellation) {
11880
12069
  return confirmationCancellation;
11881
12070
  }
12071
+ if (isTrustedAskUserQuestionTool && isApproveOutcome(outcome) && confirmationDetails.type === "ask_user_question") {
12072
+ this.config.getLlmClient?.()?.recordTrustedUserAnswers(
12073
+ callId,
12074
+ confirmationDetails.questions,
12075
+ output.answers
12076
+ );
12077
+ }
11882
12078
  } catch (error) {
11883
12079
  if (outcome !== "cancel" /* Cancel */) {
11884
12080
  throw error;
@@ -12466,6 +12662,7 @@ ${this.pendingRecoveredAgentsNotice}
12466
12662
  return {
12467
12663
  parts: responseParts,
12468
12664
  stopAfterPermissionCancel: nestedPermissionCancelled,
12665
+ ...toolResult.terminateTurn ? { terminateTurn: true } : {},
12469
12666
  memoryWriteCandidates: status === "success" ? [
12470
12667
  {
12471
12668
  toolName,
@@ -14176,6 +14373,11 @@ __name(setGlobalSkillEnabled, "setGlobalSkillEnabled");
14176
14373
 
14177
14374
  // packages/cli/src/acp-integration/session/tasksSnapshot.ts
14178
14375
  init_esbuild_shims();
14376
+ import * as fs3 from "node:fs";
14377
+ import * as path6 from "node:path";
14378
+ var MAX_AGENT_SIDECAR_CACHE_ENTRIES = 20;
14379
+ var MAX_AGENT_SIDECAR_READ_CONCURRENCY = 8;
14380
+ var agentSidecarCache = /* @__PURE__ */ new Map();
14179
14381
  function runtimeMs(entry, now) {
14180
14382
  return Math.max(0, (entry.endTime ?? now) - entry.startTime);
14181
14383
  }
@@ -14184,6 +14386,24 @@ function optionalField(key, value) {
14184
14386
  return value !== void 0 ? { [key]: value } : {};
14185
14387
  }
14186
14388
  __name(optionalField, "optionalField");
14389
+ function retainAgentTasks(tasks) {
14390
+ const pausedIds = new Set(
14391
+ tasks.filter((task) => task.status === "paused").sort(
14392
+ (a, b) => (b.endTime ?? b.startTime) - (a.endTime ?? a.startTime) || b.id.localeCompare(a.id)
14393
+ ).slice(0, MAX_RETAINED_TERMINAL_AGENTS).map((task) => task.id)
14394
+ );
14395
+ const terminalIds = new Set(
14396
+ tasks.filter(
14397
+ (task) => task.status === "completed" || task.status === "failed" || task.status === "cancelled"
14398
+ ).sort(
14399
+ (a, b) => (b.endTime ?? b.startTime) - (a.endTime ?? a.startTime) || b.startTime - a.startTime || b.id.localeCompare(a.id)
14400
+ ).slice(0, MAX_RETAINED_TERMINAL_AGENTS).map((task) => task.id)
14401
+ );
14402
+ return tasks.filter(
14403
+ (task) => task.status === "running" || pausedIds.has(task.id) || terminalIds.has(task.id)
14404
+ ).sort((a, b) => a.startTime - b.startTime || a.id.localeCompare(b.id));
14405
+ }
14406
+ __name(retainAgentTasks, "retainAgentTasks");
14187
14407
  function serializeAgentTask(entry, now) {
14188
14408
  return {
14189
14409
  kind: "agent",
@@ -14263,9 +14483,10 @@ function serializeWorkflowTask(entry, now) {
14263
14483
  kind: "workflow",
14264
14484
  id: entry.runId,
14265
14485
  ...optionalField("toolUseId", entry.toolUseId),
14486
+ ...optionalField("workflowName", entry.workflowName),
14266
14487
  ...optionalField("sourceRunId", entry.sourceRunId),
14267
14488
  ...optionalField("startMode", entry.startMode),
14268
- label: entry.meta?.name ?? entry.description ?? entry.runId,
14489
+ label: entry.meta?.name ?? entry.workflowName ?? entry.description ?? entry.runId,
14269
14490
  description: entry.meta?.description ?? entry.description,
14270
14491
  status: entry.status,
14271
14492
  startTime: entry.startTime,
@@ -14302,9 +14523,11 @@ function serializeWorkflowSnapshot(snapshot) {
14302
14523
  kind: "workflow",
14303
14524
  id: snapshot.runId,
14304
14525
  isHistorical: true,
14526
+ ...optionalField("toolUseId", snapshot.toolUseId),
14527
+ ...optionalField("workflowName", snapshot.workflowName),
14305
14528
  ...optionalField("sourceRunId", snapshot.sourceRunId),
14306
14529
  ...optionalField("startMode", snapshot.startMode),
14307
- label: snapshot.meta?.name ?? snapshot.description ?? snapshot.runId,
14530
+ label: snapshot.meta?.name ?? snapshot.workflowName ?? snapshot.description ?? snapshot.runId,
14308
14531
  description: snapshot.meta?.description ?? snapshot.description ?? snapshot.runId,
14309
14532
  status: snapshot.status,
14310
14533
  startTime: snapshot.startTime,
@@ -14352,6 +14575,123 @@ function buildSessionTasksStatus(sessionId, config, now = Date.now(), workflowHi
14352
14575
  };
14353
14576
  }
14354
14577
  __name(buildSessionTasksStatus, "buildSessionTasksStatus");
14578
+ async function buildSessionAgentsStatus(sessionId, config, now = Date.now()) {
14579
+ const projectDir = config.storage.getProjectDir();
14580
+ const dir = getSubagentSessionDir(projectDir, sessionId);
14581
+ const cacheKey = `${dir}\0${sessionId}`;
14582
+ const agents = /* @__PURE__ */ new Map();
14583
+ const metaSignatures = /* @__PURE__ */ new Map();
14584
+ let directoryMtimeNs;
14585
+ let files = [];
14586
+ try {
14587
+ directoryMtimeNs = (await fs3.promises.stat(dir, { bigint: true })).mtimeNs;
14588
+ const cached = agentSidecarCache.get(cacheKey);
14589
+ const cachedSidecarsUnchanged = cached?.directoryMtimeNs === directoryMtimeNs && (await Promise.all(
14590
+ [...cached.metaSignatures].map(async ([agentId, signature]) => {
14591
+ const meta = await readAgentMetaAsync(
14592
+ path6.join(
14593
+ dir,
14594
+ `agent-${sanitizeFilenameComponent(agentId)}.meta.json`
14595
+ )
14596
+ );
14597
+ return meta !== void 0 && JSON.stringify(meta) === signature;
14598
+ })
14599
+ )).every(Boolean);
14600
+ if (cached && cachedSidecarsUnchanged) {
14601
+ for (const task of cached.tasks) {
14602
+ agents.set(task.id, task);
14603
+ }
14604
+ } else {
14605
+ files = (await fs3.promises.readdir(dir)).filter((fileName) => fileName.endsWith(".meta.json")).sort().slice(0, MAX_AGENT_TRACE_NODES);
14606
+ }
14607
+ } catch (error) {
14608
+ if (error.code !== "ENOENT") throw error;
14609
+ }
14610
+ const limitAgentSidecarRead = pLimit(MAX_AGENT_SIDECAR_READ_CONCURRENCY);
14611
+ let sidecarScanIncomplete = false;
14612
+ await Promise.all(
14613
+ files.map(
14614
+ (fileName) => limitAgentSidecarRead(async () => {
14615
+ if (!fileName.endsWith(".meta.json")) return;
14616
+ let meta;
14617
+ try {
14618
+ meta = await readAgentMetaAsync(path6.join(dir, fileName), {
14619
+ throwOnReadError: true
14620
+ });
14621
+ } catch {
14622
+ sidecarScanIncomplete = true;
14623
+ return;
14624
+ }
14625
+ if (!meta || typeof meta.agentId !== "string" || meta.agentId.length === 0 || typeof meta.agentType !== "string" || typeof meta.description !== "string" || typeof meta.createdAt !== "string" || meta.parentSessionId !== sessionId || meta.subagentName !== void 0 && typeof meta.subagentName !== "string" || meta.lastUpdatedAt !== void 0 && typeof meta.lastUpdatedAt !== "string" || meta.lastError !== void 0 && typeof meta.lastError !== "string" || meta.toolUseId !== void 0 && typeof meta.toolUseId !== "string" || meta.parentAgentId !== null && typeof meta.parentAgentId !== "string" || meta.depth !== void 0 && !Number.isFinite(meta.depth) || meta.isBackgrounded !== void 0 && typeof meta.isBackgrounded !== "boolean" || fileName !== `agent-${sanitizeFilenameComponent(meta.agentId)}.meta.json` || meta.status !== void 0 && !["running", "paused", "completed", "failed", "cancelled"].includes(
14626
+ meta.status
14627
+ )) {
14628
+ sidecarScanIncomplete = true;
14629
+ return;
14630
+ }
14631
+ metaSignatures.set(meta.agentId, JSON.stringify(meta));
14632
+ const startTime = Date.parse(meta.createdAt);
14633
+ if (!Number.isFinite(startTime) || !meta.status) {
14634
+ sidecarScanIncomplete = true;
14635
+ return;
14636
+ }
14637
+ if (meta.status === "running" && meta.isBackgrounded !== true) return;
14638
+ const status = meta.status === "running" ? "paused" : meta.status;
14639
+ const endTime = Date.parse(meta.lastUpdatedAt ?? meta.createdAt);
14640
+ const subagentType = meta.subagentName ?? meta.agentType;
14641
+ agents.set(meta.agentId, {
14642
+ kind: "agent",
14643
+ id: meta.agentId,
14644
+ label: buildBackgroundEntryLabel({
14645
+ description: meta.description,
14646
+ subagentType
14647
+ }),
14648
+ description: meta.description,
14649
+ status,
14650
+ startTime,
14651
+ ...Number.isFinite(endTime) ? { endTime } : {},
14652
+ runtimeMs: Math.max(
14653
+ 0,
14654
+ (Number.isFinite(endTime) ? endTime : startTime) - startTime
14655
+ ),
14656
+ outputFile: path6.join(
14657
+ dir,
14658
+ `agent-${sanitizeFilenameComponent(meta.agentId)}.jsonl`
14659
+ ),
14660
+ subagentType,
14661
+ isBackgrounded: meta.isBackgrounded === true,
14662
+ ...optionalField("error", meta.lastError),
14663
+ ...optionalField("toolUseId", meta.toolUseId),
14664
+ ...optionalField("parentAgentId", meta.parentAgentId ?? void 0),
14665
+ ...optionalField("depth", meta.depth)
14666
+ });
14667
+ })
14668
+ )
14669
+ );
14670
+ if (directoryMtimeNs !== void 0 && files.length > 0 && !sidecarScanIncomplete) {
14671
+ const tasks = retainAgentTasks([...agents.values()]);
14672
+ agentSidecarCache.delete(cacheKey);
14673
+ agentSidecarCache.set(cacheKey, {
14674
+ directoryMtimeNs,
14675
+ tasks,
14676
+ metaSignatures
14677
+ });
14678
+ while (agentSidecarCache.size > MAX_AGENT_SIDECAR_CACHE_ENTRIES) {
14679
+ const oldest = agentSidecarCache.keys().next().value;
14680
+ if (!oldest) break;
14681
+ agentSidecarCache.delete(oldest);
14682
+ }
14683
+ }
14684
+ for (const entry of config.getBackgroundTaskRegistry().getAll()) {
14685
+ agents.set(entry.id, serializeAgentTask(entry, now));
14686
+ }
14687
+ return {
14688
+ v: STATUS_SCHEMA_VERSION,
14689
+ sessionId,
14690
+ now,
14691
+ tasks: retainAgentTasks([...agents.values()])
14692
+ };
14693
+ }
14694
+ __name(buildSessionAgentsStatus, "buildSessionAgentsStatus");
14355
14695
 
14356
14696
  // packages/cli/src/acp-integration/runtimeOutputDirContext.ts
14357
14697
  init_esbuild_shims();
@@ -14625,7 +14965,7 @@ __name(beginSessionCloseAfterCurrentGate, "beginSessionCloseAfterCurrentGate");
14625
14965
  var logWorkspaceMemoryExtractionError = createWorkspaceMemoryExtractionErrorLogger(debugLogger9);
14626
14966
  function parseAcpLocalReadRootsEnv(raw = process.env[QWEN_ACP_LOCAL_READ_ROOTS_ENV]) {
14627
14967
  if (!raw) return [];
14628
- return raw.split(path6.delimiter).map((entry) => entry.trim()).filter((entry) => entry.length > 0 && path6.isAbsolute(entry));
14968
+ return raw.split(path7.delimiter).map((entry) => entry.trim()).filter((entry) => entry.length > 0 && path7.isAbsolute(entry));
14629
14969
  }
14630
14970
  __name(parseAcpLocalReadRootsEnv, "parseAcpLocalReadRootsEnv");
14631
14971
  function defaultAcpOnlyLocalReadRoots() {
@@ -14638,8 +14978,8 @@ function buildAcpLocalReadRoots(config) {
14638
14978
  // including auto-memory roots. The ACP-only additions below expand only
14639
14979
  // local read fallback, not read_file's default permission.
14640
14980
  config.storage.getProjectTempDir(),
14641
- path6.join(config.storage.getProjectDir(), "subagents"),
14642
- path6.join(config.getSessionRuntimeBaseDir(), "tmp"),
14981
+ path7.join(config.storage.getProjectDir(), "subagents"),
14982
+ path7.join(config.getSessionRuntimeBaseDir(), "tmp"),
14643
14983
  getAutoMemoryRoot(config.getTargetDir()),
14644
14984
  getUserAutoMemoryRoot(),
14645
14985
  ...config.storage.getUserSkillsDirs(),
@@ -14647,6 +14987,10 @@ function buildAcpLocalReadRoots(config) {
14647
14987
  // Saved plan files (see ReadFileTool.getDefaultPermission for why the
14648
14988
  // plans dir must be readable without a confirmation prompt).
14649
14989
  config.getPlansDir(),
14990
+ Storage.getUserWorkflowsDir(),
14991
+ // Workflow run artifacts: resume journals, run snapshots, and persisted
14992
+ // inline scripts named by workflow results and notifications.
14993
+ config.storage.getWorkflowRunsDir(),
14650
14994
  ...defaultAcpOnlyLocalReadRoots(),
14651
14995
  ...parseAcpLocalReadRootsEnv()
14652
14996
  ];
@@ -15731,14 +16075,14 @@ function readScopeSettings(settings, scope) {
15731
16075
  __name(readScopeSettings, "readScopeSettings");
15732
16076
  async function resolvePreferredMemoryFile(dir, fallbackFilename) {
15733
16077
  for (const filename of getAllMemoryFilenames()) {
15734
- const filePath = path6.join(dir, filename);
16078
+ const filePath = path7.join(dir, filename);
15735
16079
  try {
15736
- await fs3.access(filePath);
16080
+ await fs4.access(filePath);
15737
16081
  return filePath;
15738
16082
  } catch {
15739
16083
  }
15740
16084
  }
15741
- return path6.join(dir, fallbackFilename);
16085
+ return path7.join(dir, fallbackFilename);
15742
16086
  }
15743
16087
  __name(resolvePreferredMemoryFile, "resolvePreferredMemoryFile");
15744
16088
  async function resolveQwenMemoryPaths(params) {
@@ -15948,7 +16292,8 @@ async function addRuntimeMcpServer(manager, request) {
15948
16292
  }
15949
16293
  __name(addRuntimeMcpServer, "addRuntimeMcpServer");
15950
16294
  async function runAcpAgent(config, settings, argv, options) {
15951
- const sessionWriterLeaseEnabledAtStartup = typeof config.isSessionWriterLeaseEnabled === "function" ? config.isSessionWriterLeaseEnabled() : settings.merged.experimental?.sessionWriterLease === true;
16295
+ const conversationsRuntimeProvenance = options?.conversationsRuntimeProvenance === true;
16296
+ const sessionWriterLeaseEnabledAtStartup = conversationsRuntimeProvenance || (typeof config.isSessionWriterLeaseEnabled === "function" ? config.isSessionWriterLeaseEnabled() : settings.merged.experimental?.sessionWriterLease === true);
15952
16297
  const privateParentCapability = options === void 0 ? process.env[PRIVATE_ACP_CAPABILITY_ENV] : options.privateParentCapability;
15953
16298
  delete process.env[PRIVATE_ACP_CAPABILITY_ENV];
15954
16299
  delete process.env[PRIVATE_EXTERNAL_TOOL_GUARD_ENV];
@@ -16051,7 +16396,8 @@ async function runAcpAgent(config, settings, argv, options) {
16051
16396
  privateParentCapability,
16052
16397
  sessionWriterLeaseEnabledAtStartup,
16053
16398
  managedToolInvocationGuard,
16054
- externalToolGuardProviderAttached
16399
+ externalToolGuardProviderAttached,
16400
+ conversationsRuntimeProvenance
16055
16401
  );
16056
16402
  return agentInstance;
16057
16403
  }, stream);
@@ -16128,7 +16474,7 @@ async function runAcpAgent(config, settings, argv, options) {
16128
16474
  return [];
16129
16475
  }
16130
16476
  return [
16131
- path6.join(
16477
+ path7.join(
16132
16478
  config2.getSessionRuntimeBaseDir(),
16133
16479
  "tmp",
16134
16480
  "session-writer-locks",
@@ -16370,7 +16716,7 @@ function hasOnlyKeys(value, keys) {
16370
16716
  }
16371
16717
  __name(hasOnlyKeys, "hasOnlyKeys");
16372
16718
  function isManagedConversationPath(value) {
16373
- return typeof value === "string" && value.length > 0 && !value.includes("\0") && path6.isAbsolute(value);
16719
+ return typeof value === "string" && value.length > 0 && !value.includes("\0") && path7.isAbsolute(value);
16374
16720
  }
16375
16721
  __name(isManagedConversationPath, "isManagedConversationPath");
16376
16722
  function isManagedConversationIdentityNumber(value) {
@@ -16390,9 +16736,9 @@ function parseConversationDirectoryExpectation(value) {
16390
16736
  const child = value["child"];
16391
16737
  const parsedSessionId = parseCallerSuppliedSessionId(canonicalSessionId);
16392
16738
  if (parsedSessionId.kind !== "valid" || parsedSessionId.sessionId !== canonicalSessionId || !isObjectRecord(root) || !hasOnlyKeys(root, ["canonicalPath", "device", "inode"]) || !isManagedConversationPath(root["canonicalPath"]) || !isManagedConversationIdentityNumber(root["device"]) || !isManagedConversationIdentityNumber(root["inode"]) || !isObjectRecord(child) || !hasOnlyKeys(child, ["name", "canonicalPath", "device", "inode"]) || typeof child["name"] !== "string" || child["name"] !== getConversationDirectoryName(canonicalSessionId) || !isManagedConversationPath(child["canonicalPath"]) || !isManagedConversationIdentityNumber(child["device"]) || !isManagedConversationIdentityNumber(child["inode"]) || !isSameConversationPath(
16393
- path6.dirname(child["canonicalPath"]),
16739
+ path7.dirname(child["canonicalPath"]),
16394
16740
  root["canonicalPath"]
16395
- ) || path6.basename(child["canonicalPath"]) !== child["name"]) {
16741
+ ) || path7.basename(child["canonicalPath"]) !== child["name"]) {
16396
16742
  throw RequestError.invalidParams(
16397
16743
  void 0,
16398
16744
  "Invalid managed conversation directory expectation"
@@ -16429,9 +16775,9 @@ async function assertManagedConversationDirectoryIdentity(expectation) {
16429
16775
  let canonicalRoot;
16430
16776
  let rootAfter;
16431
16777
  try {
16432
- rootBefore = await fs3.lstat(expectation.root.canonicalPath);
16433
- canonicalRoot = await fs3.realpath(expectation.root.canonicalPath);
16434
- rootAfter = await fs3.lstat(canonicalRoot);
16778
+ rootBefore = await fs4.lstat(expectation.root.canonicalPath);
16779
+ canonicalRoot = await fs4.realpath(expectation.root.canonicalPath);
16780
+ rootAfter = await fs4.lstat(canonicalRoot);
16435
16781
  } catch (error) {
16436
16782
  throw managedConversationDirectoryError(
16437
16783
  error.code === "ENOENT"
@@ -16444,9 +16790,9 @@ async function assertManagedConversationDirectoryIdentity(expectation) {
16444
16790
  let canonicalChild;
16445
16791
  let childAfter;
16446
16792
  try {
16447
- childBefore = await fs3.lstat(expectation.child.canonicalPath);
16448
- canonicalChild = await fs3.realpath(expectation.child.canonicalPath);
16449
- childAfter = await fs3.lstat(canonicalChild);
16793
+ childBefore = await fs4.lstat(expectation.child.canonicalPath);
16794
+ canonicalChild = await fs4.realpath(expectation.child.canonicalPath);
16795
+ childAfter = await fs4.lstat(canonicalChild);
16450
16796
  } catch (error) {
16451
16797
  throw managedConversationDirectoryError(
16452
16798
  error.code === "ENOENT"
@@ -16458,7 +16804,7 @@ async function assertManagedConversationDirectoryIdentity(expectation) {
16458
16804
  }
16459
16805
  __name(assertManagedConversationDirectoryIdentity, "assertManagedConversationDirectoryIdentity");
16460
16806
  var QwenAgent = class _QwenAgent {
16461
- constructor(config, settings, argv, connection, expectedPrivateParentCapability, sessionWriterLeaseEnabledAtStartup = false, managedToolInvocationGuard, externalToolGuardProviderAttached = false) {
16807
+ constructor(config, settings, argv, connection, expectedPrivateParentCapability, sessionWriterLeaseEnabledAtStartup = false, managedToolInvocationGuard, externalToolGuardProviderAttached = false, conversationsRuntimeProvenance = false) {
16462
16808
  this.config = config;
16463
16809
  this.settings = settings;
16464
16810
  this.argv = argv;
@@ -16467,6 +16813,7 @@ var QwenAgent = class _QwenAgent {
16467
16813
  this.sessionWriterLeaseEnabledAtStartup = sessionWriterLeaseEnabledAtStartup;
16468
16814
  this.managedToolInvocationGuard = managedToolInvocationGuard;
16469
16815
  this.externalToolGuardProviderAttached = externalToolGuardProviderAttached;
16816
+ this.conversationsRuntimeProvenance = conversationsRuntimeProvenance;
16470
16817
  if (process.env["QWEN_SERVE_NO_MCP_POOL"] === "1") {
16471
16818
  this.mcpPool = void 0;
16472
16819
  this.workspaceMcpBudget = void 0;
@@ -17133,7 +17480,7 @@ var QwenAgent = class _QwenAgent {
17133
17480
  throw sessionId ? mapSessionRestoreRequestError(error, sessionId) : mapSessionWriterRequestError(error);
17134
17481
  }
17135
17482
  pendingConfigCleanupKey(runtimeBaseDir, sessionId) {
17136
- return `${path6.resolve(runtimeBaseDir)}\0${sessionId}`;
17483
+ return `${path7.resolve(runtimeBaseDir)}\0${sessionId}`;
17137
17484
  }
17138
17485
  withAskUserQuestionRestoreHint(session, response) {
17139
17486
  if (this.argv.restoreAskUserQuestion !== true) {
@@ -17151,11 +17498,11 @@ var QwenAgent = class _QwenAgent {
17151
17498
  };
17152
17499
  }
17153
17500
  async retryPendingConfigCleanup(runtimeBaseDir, requiredSessionId) {
17154
- const resolvedRuntimeBaseDir = path6.resolve(runtimeBaseDir);
17501
+ const resolvedRuntimeBaseDir = path7.resolve(runtimeBaseDir);
17155
17502
  const configs = /* @__PURE__ */ new Set();
17156
17503
  for (const pending of this.pendingConfigCleanup.values()) {
17157
17504
  for (const config of pending) {
17158
- if (path6.resolve(config.getSessionRuntimeBaseDir()) === resolvedRuntimeBaseDir) {
17505
+ if (path7.resolve(config.getSessionRuntimeBaseDir()) === resolvedRuntimeBaseDir) {
17159
17506
  configs.add(config);
17160
17507
  }
17161
17508
  }
@@ -17315,9 +17662,43 @@ var QwenAgent = class _QwenAgent {
17315
17662
  );
17316
17663
  this.disposeTranscriptReplayConfigs();
17317
17664
  }
17665
+ /**
17666
+ * Single choke point for pinning the runtime root of an operation to a
17667
+ * settings object and a cwd. Every caller in this class goes through here
17668
+ * rather than calling `runWithAcpRuntimeOutputDir` directly, so the routing
17669
+ * is composed in exactly one place. Which settings to pin with is still the
17670
+ * caller's decision at this level: callers that already hold deliberately
17671
+ * scoped settings (workspace MCP discovery, live-session scope checks,
17672
+ * session creation) pass them in. Per-request session-management handlers
17673
+ * (list, delete, rename, transcript page, transcript turn index, settled
17674
+ * turn status, and the non-live branch of loadUpdates) must not make that
17675
+ * decision themselves — they use `runWithPinnedRuntimeBaseDirForRequest`
17676
+ * below. Session load and
17677
+ * resume resolve the request's settings at the call site deliberately,
17678
+ * under profiler instrumentation, because they adopt those settings for
17679
+ * the session afterwards.
17680
+ */
17318
17681
  runWithPinnedRuntimeBaseDir(settings, cwd, operation) {
17319
17682
  return runWithAcpRuntimeOutputDir(settings, cwd, operation);
17320
17683
  }
17684
+ /**
17685
+ * Per-request form of `runWithPinnedRuntimeBaseDir` for handlers that act
17686
+ * on a caller-supplied cwd. It resolves the settings for THAT cwd itself,
17687
+ * so the "which settings pin this operation" decision is made here, once,
17688
+ * and a handler cannot reach the pin with the process-wide `this.settings`
17689
+ * cache — the bug class fixed in #10095 (three handlers composed the
17690
+ * routing by hand and pinned another workspace's runtime root). The
17691
+ * operation receives the resolved settings for handlers that also need
17692
+ * them inside the pinned scope.
17693
+ */
17694
+ runWithPinnedRuntimeBaseDirForRequest(cwd, operation) {
17695
+ const settings = loadSettingsCached(cwd);
17696
+ return this.runWithPinnedRuntimeBaseDir(
17697
+ settings,
17698
+ cwd,
17699
+ () => operation(settings)
17700
+ );
17701
+ }
17321
17702
  /**
17322
17703
  * Whether an ungated restore replay (qwen/session/loadUpdates) may
17323
17704
  * finalize dangling tool calls. A session with an active turn — a client
@@ -17340,7 +17721,7 @@ var QwenAgent = class _QwenAgent {
17340
17721
  return finalize;
17341
17722
  }
17342
17723
  async assertLiveSessionScope(config, settings, cwd) {
17343
- if (path6.resolve(config.storage.getProjectRoot()) !== path6.resolve(cwd)) {
17724
+ if (path7.resolve(config.storage.getProjectRoot()) !== path7.resolve(cwd)) {
17344
17725
  throw RequestError.invalidParams(
17345
17726
  void 0,
17346
17727
  "The live session belongs to another workspace."
@@ -17351,7 +17732,7 @@ var QwenAgent = class _QwenAgent {
17351
17732
  cwd,
17352
17733
  () => Storage.getRuntimeBaseDir()
17353
17734
  );
17354
- if (path6.resolve(config.getSessionRuntimeBaseDir()) !== path6.resolve(requestedRuntimeBaseDir)) {
17735
+ if (path7.resolve(config.getSessionRuntimeBaseDir()) !== path7.resolve(requestedRuntimeBaseDir)) {
17355
17736
  throw mapSessionWriterRequestError(new SessionWriterUnavailableError());
17356
17737
  }
17357
17738
  }
@@ -17409,7 +17790,7 @@ var QwenAgent = class _QwenAgent {
17409
17790
  }
17410
17791
  this.clientCapabilities = args.clientCapabilities;
17411
17792
  const authMethods = buildAuthMethods();
17412
- const version = "0.23.0";
17793
+ const version = "0.23.1-preview.1";
17413
17794
  const response = {
17414
17795
  protocolVersion: PROTOCOL_VERSION,
17415
17796
  agentInfo: {
@@ -17703,6 +18084,7 @@ var QwenAgent = class _QwenAgent {
17703
18084
  }
17704
18085
  const restoreOptions = loadRestoreOptions(params);
17705
18086
  const suppressRestoreAskUserQuestion = params._meta?.[DAEMON_SUPPRESS_RESTORE_ASK_USER_QUESTION_META_KEY] === true;
18087
+ const suppressWorktreeContextRestore = params._meta?.[DAEMON_SUPPRESS_WORKTREE_CONTEXT_RESTORE_META_KEY] === true;
17706
18088
  const withRestoreHint = /* @__PURE__ */ __name((session, response) => suppressRestoreAskUserQuestion ? response : this.withAskUserQuestionRestoreHint(session, response), "withRestoreHint");
17707
18089
  const liveSession = this.sessions.get(sessionId);
17708
18090
  if (liveSession) {
@@ -18044,7 +18426,7 @@ var QwenAgent = class _QwenAgent {
18044
18426
  }
18045
18427
  }
18046
18428
  await profiler.time("post_replay_services", async () => {
18047
- if (!provisionalStandalone) {
18429
+ if (!provisionalStandalone && !suppressWorktreeContextRestore) {
18048
18430
  await this.#restoreWorktreeOnResume(config, createdSession);
18049
18431
  }
18050
18432
  await this.#restoreBackgroundAgentsOnResume(
@@ -18105,6 +18487,7 @@ var QwenAgent = class _QwenAgent {
18105
18487
  );
18106
18488
  }
18107
18489
  const suppressRestoreAskUserQuestion = params._meta?.[DAEMON_SUPPRESS_RESTORE_ASK_USER_QUESTION_META_KEY] === true;
18490
+ const suppressWorktreeContextRestore = params._meta?.[DAEMON_SUPPRESS_WORKTREE_CONTEXT_RESTORE_META_KEY] === true;
18108
18491
  const withRestoreHint = /* @__PURE__ */ __name((session, response) => suppressRestoreAskUserQuestion ? response : this.withAskUserQuestionRestoreHint(session, response), "withRestoreHint");
18109
18492
  const liveSession = this.sessions.get(sessionId);
18110
18493
  if (liveSession) {
@@ -18233,7 +18616,7 @@ var QwenAgent = class _QwenAgent {
18233
18616
  }, "primeSession"),
18234
18617
  beforeStartPostReplayServices: /* @__PURE__ */ __name(async (createdSession) => {
18235
18618
  await profiler.time("post_replay_services", async () => {
18236
- if (!provisionalStandalone) {
18619
+ if (!provisionalStandalone && !suppressWorktreeContextRestore) {
18237
18620
  await this.#restoreWorktreeOnResume(config, createdSession);
18238
18621
  }
18239
18622
  await this.#restoreBackgroundAgentsOnResume(
@@ -18288,7 +18671,7 @@ var QwenAgent = class _QwenAgent {
18288
18671
  const cwd = params.cwd || process.cwd();
18289
18672
  const numericCursor = parseAcpSessionListCursor(params.cursor);
18290
18673
  const size = normalizeAcpSessionListSize(params._meta?.["size"]);
18291
- const result = await runWithAcpRuntimeOutputDir(this.settings, cwd, () => {
18674
+ const result = await this.runWithPinnedRuntimeBaseDirForRequest(cwd, () => {
18292
18675
  const sessionService = new SessionService(cwd);
18293
18676
  return sessionService.listSessions({
18294
18677
  cursor: numericCursor,
@@ -18767,23 +19150,25 @@ var QwenAgent = class _QwenAgent {
18767
19150
  return "not_started";
18768
19151
  }
18769
19152
  }
18770
- async buildWorkspaceMcpStatus(config) {
19153
+ async buildWorkspaceMcpStatus(config, scope = "workspace", sessionSettings) {
18771
19154
  try {
18772
19155
  const workspaceCwd = this.workspaceCwd(config);
18773
- const settings = loadSettings(config.getTargetDir());
19156
+ const settings = sessionSettings ?? loadSettings(config.getTargetDir());
18774
19157
  const userServers = settings.user?.settings.mcpServers ?? {};
18775
19158
  const systemDefaultServers = settings.systemDefaults?.settings.mcpServers ?? {};
18776
19159
  const servers = config.getMcpServers() ?? {};
18777
19160
  const approvals = loadMcpApprovals();
18778
19161
  let poolByName = {};
18779
- try {
18780
- const snap = this.mcpPool?.getSnapshot();
18781
- if (snap) poolByName = snap.byName;
18782
- } catch (err) {
18783
- process.stderr.write(
18784
- `qwen serve: pool snapshot for workspace MCP status failed: ${err instanceof Error ? err.message : String(err)}
19162
+ if (scope === "workspace") {
19163
+ try {
19164
+ const snap = this.mcpPool?.getSnapshot();
19165
+ if (snap) poolByName = snap.byName;
19166
+ } catch (err) {
19167
+ process.stderr.write(
19168
+ `qwen serve: pool snapshot for workspace MCP status failed: ${err instanceof Error ? err.message : String(err)}
18785
19169
  `
18786
- );
19170
+ );
19171
+ }
18787
19172
  }
18788
19173
  let clientCount;
18789
19174
  let clientBudget;
@@ -18791,7 +19176,7 @@ var QwenAgent = class _QwenAgent {
18791
19176
  let refusedSet = /* @__PURE__ */ new Set();
18792
19177
  let budgetCellScope = "session";
18793
19178
  const wsBudget = this.workspaceMcpBudget;
18794
- if (wsBudget !== void 0) {
19179
+ if (scope === "workspace" && wsBudget !== void 0) {
18795
19180
  budgetCellScope = "workspace";
18796
19181
  clientCount = wsBudget.getReservedCount();
18797
19182
  clientBudget = wsBudget.getBudget();
@@ -18814,7 +19199,7 @@ var QwenAgent = class _QwenAgent {
18814
19199
  );
18815
19200
  }
18816
19201
  }
18817
- const sharedTokenStorage = new MCPOAuthTokenStorage();
19202
+ const sharedTokenStorage = scope === "workspace" ? new MCPOAuthTokenStorage() : void 0;
18818
19203
  return {
18819
19204
  v: STATUS_SCHEMA_VERSION,
18820
19205
  workspaceCwd,
@@ -18823,11 +19208,14 @@ var QwenAgent = class _QwenAgent {
18823
19208
  servers: await Promise.all(
18824
19209
  Object.entries(servers).map(async ([name, server]) => {
18825
19210
  const disabled = config.isMcpServerDisabled(name);
18826
- let hasOAuthTokens = false;
18827
- try {
18828
- const credentials = await sharedTokenStorage.getCredentials(name);
18829
- hasOAuthTokens = credentials !== null;
18830
- } catch {
19211
+ let hasOAuthTokens;
19212
+ if (sharedTokenStorage) {
19213
+ hasOAuthTokens = false;
19214
+ try {
19215
+ const credentials = await sharedTokenStorage.getCredentials(name);
19216
+ hasOAuthTokens = credentials !== null;
19217
+ } catch {
19218
+ }
18831
19219
  }
18832
19220
  const poolRow = poolByName[name];
18833
19221
  const rawStatus = poolRow ? poolRow.entrySummary.some(
@@ -18835,7 +19223,7 @@ var QwenAgent = class _QwenAgent {
18835
19223
  ) ? "connected" /* CONNECTED */ : poolRow.entrySummary.some(
18836
19224
  (entry) => entry.status === "connecting" /* CONNECTING */
18837
19225
  ) ? "connecting" /* CONNECTING */ : "disconnected" /* DISCONNECTED */ : this.getMcpServerStatus(config, name);
18838
- const requiresAuth = rawStatus !== "connected" /* CONNECTED */ && (mcpServerRequiresOAuth.get(name) === true || server.oauth?.enabled === true && !hasOAuthTokens);
19226
+ const requiresAuth = scope === "workspace" && rawStatus !== "connected" /* CONNECTED */ && (mcpServerRequiresOAuth.get(name) === true || server.oauth?.enabled === true && !hasOAuthTokens);
18839
19227
  const refusedByBudget = refusedSet.has(name);
18840
19228
  const effectivelyRefused = refusedByBudget && !disabled;
18841
19229
  const out = {
@@ -18849,7 +19237,7 @@ var QwenAgent = class _QwenAgent {
18849
19237
  mcpStatus: this.mcpStatus(rawStatus),
18850
19238
  transport: this.mcpTransport(server),
18851
19239
  disabled,
18852
- hasOAuthTokens,
19240
+ ...hasOAuthTokens !== void 0 ? { hasOAuthTokens } : {},
18853
19241
  ...requiresAuth ? { requiresAuth: true } : {}
18854
19242
  };
18855
19243
  if (isGatedMcpScope(server.scope)) {
@@ -18866,14 +19254,16 @@ var QwenAgent = class _QwenAgent {
18866
19254
  }
18867
19255
  }
18868
19256
  }
18869
- if (this.pendingMcpAuthentications.has(name)) {
18870
- out.authenticationState = "pending";
18871
- } else {
18872
- const authentication = this.mcpAuthenticationResults.get(name);
18873
- if (authentication) {
18874
- out.authenticationState = authentication.state;
18875
- if (authentication.error) {
18876
- out.authenticationError = authentication.error;
19257
+ if (scope === "workspace") {
19258
+ if (this.pendingMcpAuthentications.has(name)) {
19259
+ out.authenticationState = "pending";
19260
+ } else {
19261
+ const authentication = this.mcpAuthenticationResults.get(name);
19262
+ if (authentication) {
19263
+ out.authenticationState = authentication.state;
19264
+ if (authentication.error) {
19265
+ out.authenticationError = authentication.error;
19266
+ }
18877
19267
  }
18878
19268
  }
18879
19269
  }
@@ -18935,11 +19325,13 @@ var QwenAgent = class _QwenAgent {
18935
19325
  if (!disabled) {
18936
19326
  out.resourceCount = this.resolveServerMcpResources(
18937
19327
  config,
18938
- name
19328
+ name,
19329
+ scope === "workspace"
18939
19330
  ).length;
18940
19331
  out.promptCount = this.resolveServerMcpPrompts(
18941
19332
  config,
18942
- name
19333
+ name,
19334
+ scope === "workspace"
18943
19335
  ).length;
18944
19336
  }
18945
19337
  return out;
@@ -18961,7 +19353,7 @@ var QwenAgent = class _QwenAgent {
18961
19353
  budgetCellScope
18962
19354
  )
18963
19355
  } : {},
18964
- ...this.workspaceMcpDiscoveryError ? {
19356
+ ...scope === "workspace" && this.workspaceMcpDiscoveryError ? {
18965
19357
  errors: [
18966
19358
  this.errorCell(
18967
19359
  "mcp",
@@ -19090,14 +19482,18 @@ var QwenAgent = class _QwenAgent {
19090
19482
  * workspace `Config`'s `ResourceRegistry` is authoritative in
19091
19483
  * single-session mode, but in pool mode resources are registered into
19092
19484
  * per-session registries (`SessionMcpView.applyResources`), leaving the
19093
- * workspace registry empty. Fall back to the first active session that
19094
- * has this server's resources.
19485
+ * workspace registry empty. Workspace snapshots may fall back to the first
19486
+ * active session that has this server's resources; exact session snapshots
19487
+ * disable that fallback.
19095
19488
  */
19096
- resolveServerMcpResources(config, serverName) {
19489
+ resolveServerMcpResources(config, serverName, allowSessionFallback = true) {
19097
19490
  const resources = config.getResourceRegistry?.()?.getResourcesByServer(serverName) ?? [];
19098
19491
  if (resources.length > 0) {
19099
19492
  return resources;
19100
19493
  }
19494
+ if (!allowSessionFallback) {
19495
+ return resources;
19496
+ }
19101
19497
  for (const session of this.getActiveSessions()) {
19102
19498
  try {
19103
19499
  const sessionResources = session.getConfig().getResourceRegistry?.()?.getResourcesByServer(serverName) ?? [];
@@ -19115,11 +19511,14 @@ var QwenAgent = class _QwenAgent {
19115
19511
  * `promptCount` on the base status — prompts have no drill-down
19116
19512
  * endpoint (they surface as slash commands).
19117
19513
  */
19118
- resolveServerMcpPrompts(config, serverName) {
19514
+ resolveServerMcpPrompts(config, serverName, allowSessionFallback = true) {
19119
19515
  const prompts = config.getPromptRegistry?.()?.getPromptsByServer(serverName) ?? [];
19120
19516
  if (prompts.length > 0) {
19121
19517
  return prompts;
19122
19518
  }
19519
+ if (!allowSessionFallback) {
19520
+ return prompts;
19521
+ }
19123
19522
  for (const session of this.getActiveSessions()) {
19124
19523
  try {
19125
19524
  const sessionPrompts = session.getConfig().getPromptRegistry?.()?.getPromptsByServer(serverName) ?? [];
@@ -19263,7 +19662,7 @@ var QwenAgent = class _QwenAgent {
19263
19662
  debugLogger9.warn("Extension source revalidation failed:", error);
19264
19663
  }
19265
19664
  }
19266
- async buildWorkspaceSkillsStatus(config) {
19665
+ async buildWorkspaceSkillsStatus(config, settings = this.settings) {
19267
19666
  const skillManager = config.getSkillManager();
19268
19667
  if (!skillManager) {
19269
19668
  return {
@@ -19284,7 +19683,7 @@ var QwenAgent = class _QwenAgent {
19284
19683
  skills: []
19285
19684
  };
19286
19685
  }
19287
- const resolved = resolveSkillSettings(this.settings);
19686
+ const resolved = resolveSkillSettings(settings);
19288
19687
  const disablements = new Map(
19289
19688
  Array.from(config.getDisabledSkillNames(), (name) => {
19290
19689
  const normalizedName = name.trim().toLowerCase();
@@ -19343,6 +19742,22 @@ var QwenAgent = class _QwenAgent {
19343
19742
  };
19344
19743
  }
19345
19744
  }
19745
+ async buildSessionResourcesStatus(sessionId) {
19746
+ const session = this.sessionOrThrow(sessionId);
19747
+ const config = session.getConfig();
19748
+ const settings = session.getSettings();
19749
+ const [skills, mcp] = await Promise.all([
19750
+ this.buildWorkspaceSkillsStatus(config, settings),
19751
+ this.buildWorkspaceMcpStatus(config, "session", settings)
19752
+ ]);
19753
+ return {
19754
+ v: STATUS_SCHEMA_VERSION,
19755
+ sessionId,
19756
+ workspaceCwd: this.workspaceCwd(config),
19757
+ skills,
19758
+ mcp
19759
+ };
19760
+ }
19346
19761
  buildWorkspaceProvidersStatus(config) {
19347
19762
  try {
19348
19763
  const workspaceCwd = this.workspaceCwd(config);
@@ -19871,6 +20286,68 @@ var QwenAgent = class _QwenAgent {
19871
20286
  { includeWorkflows }
19872
20287
  );
19873
20288
  }
20289
+ async buildSessionAgentsStatus(sessionId) {
20290
+ const session = this.sessionOrThrow(sessionId);
20291
+ const status = await buildSessionAgentsStatus(
20292
+ session.getConfig().getSessionId(),
20293
+ session.getConfig()
20294
+ );
20295
+ return { ...status, sessionId };
20296
+ }
20297
+ async buildSessionAgentTrace(sessionId, rootAgentId) {
20298
+ const session = this.sessionOrThrow(sessionId);
20299
+ const persistedSessionId = session.getConfig().getSessionId();
20300
+ const trace = await readAgentTrace(
20301
+ session.getConfig().storage.getProjectDir(),
20302
+ persistedSessionId,
20303
+ rootAgentId
20304
+ );
20305
+ return { v: STATUS_SCHEMA_VERSION, sessionId, ...trace };
20306
+ }
20307
+ /**
20308
+ * Resolve one saved workflow for display. Fails closed to `workflow: null`
20309
+ * on every miss — unknown name, illegal name, unreadable file, or Workflow
20310
+ * controls unavailable — so the daemon never has to distinguish them and
20311
+ * cannot be used to probe the filesystem by name.
20312
+ */
20313
+ async buildSessionSavedWorkflowStatus(sessionId, name) {
20314
+ const session = this.sessionOrThrow(sessionId);
20315
+ const config = session.getConfig();
20316
+ const envelope = /* @__PURE__ */ __name((workflow) => ({
20317
+ v: STATUS_SCHEMA_VERSION,
20318
+ sessionId,
20319
+ name,
20320
+ workflow
20321
+ }), "envelope");
20322
+ if (!this.canUseWorkflowControls(config)) return envelope(null);
20323
+ const entry = (await listSavedWorkflows(config)).find(
20324
+ (candidate) => candidate.name === name
20325
+ );
20326
+ if (!entry) return envelope(null);
20327
+ let script;
20328
+ try {
20329
+ script = (await resolveSavedWorkflowScript(name, config)).script;
20330
+ } catch {
20331
+ return envelope(null);
20332
+ }
20333
+ let meta = null;
20334
+ let metaError;
20335
+ try {
20336
+ meta = extractAndStripMeta(script).meta;
20337
+ } catch (error) {
20338
+ metaError = error instanceof Error ? error.message : String(error);
20339
+ }
20340
+ return envelope({
20341
+ v: STATUS_SCHEMA_VERSION,
20342
+ sessionId,
20343
+ name: entry.name,
20344
+ source: entry.source,
20345
+ scriptPath: entry.scriptPath,
20346
+ script,
20347
+ meta,
20348
+ ...metaError !== void 0 ? { metaError } : {}
20349
+ });
20350
+ }
19874
20351
  buildSessionLspStatus(sessionId) {
19875
20352
  const session = this.sessionOrThrow(sessionId);
19876
20353
  const config = session.getConfig();
@@ -20526,6 +21003,32 @@ var QwenAgent = class _QwenAgent {
20526
21003
  params["includeWorkflows"] === true && this.canUseWorkflowControls(session.getConfig())
20527
21004
  );
20528
21005
  }
21006
+ case SERVE_STATUS_EXT_METHODS.sessionAgents: {
21007
+ const sessionId = params["sessionId"];
21008
+ if (typeof sessionId !== "string" || sessionId.length === 0) {
21009
+ throw RequestError.invalidParams(
21010
+ void 0,
21011
+ "Invalid or missing sessionId"
21012
+ );
21013
+ }
21014
+ return await this.buildSessionAgentsStatus(
21015
+ sessionId
21016
+ );
21017
+ }
21018
+ case SERVE_STATUS_EXT_METHODS.sessionAgentTrace: {
21019
+ const sessionId = params["sessionId"];
21020
+ const rootAgentId = params["rootAgentId"];
21021
+ if (typeof sessionId !== "string" || sessionId.length === 0 || rootAgentId !== void 0 && (typeof rootAgentId !== "string" || rootAgentId.length === 0 || rootAgentId.length > 500)) {
21022
+ throw RequestError.invalidParams(
21023
+ void 0,
21024
+ "Invalid sessionId or rootAgentId"
21025
+ );
21026
+ }
21027
+ return await this.buildSessionAgentTrace(
21028
+ sessionId,
21029
+ rootAgentId
21030
+ );
21031
+ }
20529
21032
  case SERVE_STATUS_EXT_METHODS.sessionLspStatus: {
20530
21033
  const sessionId = params["sessionId"];
20531
21034
  if (typeof sessionId !== "string" || sessionId.length === 0) {
@@ -20536,6 +21039,38 @@ var QwenAgent = class _QwenAgent {
20536
21039
  }
20537
21040
  return this.buildSessionLspStatus(sessionId);
20538
21041
  }
21042
+ case SERVE_STATUS_EXT_METHODS.sessionResources: {
21043
+ const sessionId = params["sessionId"];
21044
+ if (typeof sessionId !== "string" || sessionId.length === 0) {
21045
+ throw RequestError.invalidParams(
21046
+ void 0,
21047
+ "Invalid or missing sessionId"
21048
+ );
21049
+ }
21050
+ return await this.buildSessionResourcesStatus(
21051
+ sessionId
21052
+ );
21053
+ }
21054
+ case SERVE_STATUS_EXT_METHODS.sessionSavedWorkflow: {
21055
+ const sessionId = params["sessionId"];
21056
+ if (typeof sessionId !== "string" || sessionId.length === 0) {
21057
+ throw RequestError.invalidParams(
21058
+ void 0,
21059
+ "Invalid or missing sessionId"
21060
+ );
21061
+ }
21062
+ const name = params["name"];
21063
+ if (typeof name !== "string" || name.length === 0) {
21064
+ throw RequestError.invalidParams(
21065
+ void 0,
21066
+ "Invalid or missing name"
21067
+ );
21068
+ }
21069
+ return await this.buildSessionSavedWorkflowStatus(
21070
+ sessionId,
21071
+ name
21072
+ );
21073
+ }
20539
21074
  case SERVE_STATUS_EXT_METHODS.sessionTranscript: {
20540
21075
  const sessionId = params["sessionId"];
20541
21076
  if (typeof sessionId !== "string" || !SESSION_ID_RE.test(sessionId)) {
@@ -20551,6 +21086,20 @@ var QwenAgent = class _QwenAgent {
20551
21086
  "Invalid transcript cursor"
20552
21087
  );
20553
21088
  }
21089
+ const rawAtRecordId = params["atRecordId"];
21090
+ if (rawAtRecordId !== void 0 && (typeof rawAtRecordId !== "string" || rawAtRecordId.length === 0)) {
21091
+ throw RequestError.invalidParams(
21092
+ void 0,
21093
+ "Invalid transcript turn anchor"
21094
+ );
21095
+ }
21096
+ const rawSnapshot = params["snapshot"];
21097
+ if (rawSnapshot !== void 0 && (typeof rawSnapshot !== "string" || rawSnapshot.length === 0)) {
21098
+ throw RequestError.invalidParams(
21099
+ void 0,
21100
+ "Invalid transcript snapshot"
21101
+ );
21102
+ }
20554
21103
  const rawBeforeRecordId = params["beforeRecordId"];
20555
21104
  if (rawBeforeRecordId !== void 0 && (typeof rawBeforeRecordId !== "string" || rawBeforeRecordId.length === 0)) {
20556
21105
  throw RequestError.invalidParams(
@@ -20558,7 +21107,7 @@ var QwenAgent = class _QwenAgent {
20558
21107
  "Invalid transcript record boundary"
20559
21108
  );
20560
21109
  }
20561
- if (rawCursor !== void 0 && rawBeforeRecordId !== void 0) {
21110
+ if (rawCursor !== void 0 && (rawBeforeRecordId !== void 0 || rawAtRecordId !== void 0 || rawSnapshot !== void 0)) {
20562
21111
  throw RequestError.invalidParams(
20563
21112
  void 0,
20564
21113
  "Transcript cursor and record boundary are mutually exclusive"
@@ -20583,6 +21132,18 @@ var QwenAgent = class _QwenAgent {
20583
21132
  "Transcript record boundary and direction are mutually exclusive"
20584
21133
  );
20585
21134
  }
21135
+ if (rawAtRecordId !== void 0 && (rawBeforeRecordId !== void 0 || rawDirection !== void 0 || rawSnapshot === void 0)) {
21136
+ throw RequestError.invalidParams(
21137
+ void 0,
21138
+ "Transcript turn anchor requires its snapshot and no other anchor"
21139
+ );
21140
+ }
21141
+ if (rawSnapshot !== void 0 && rawAtRecordId === void 0 && rawBeforeRecordId === void 0) {
21142
+ throw RequestError.invalidParams(
21143
+ void 0,
21144
+ "Transcript snapshot requires a record anchor"
21145
+ );
21146
+ }
20586
21147
  const rawLimit = params["limit"];
20587
21148
  if (rawLimit !== void 0 && (!Number.isSafeInteger(rawLimit) || rawLimit < 1 || rawLimit > SESSION_TRANSCRIPT_MAX_LIMIT)) {
20588
21149
  throw RequestError.invalidParams(
@@ -20591,8 +21152,7 @@ var QwenAgent = class _QwenAgent {
20591
21152
  );
20592
21153
  }
20593
21154
  try {
20594
- const settings = loadSettingsCached(cwd);
20595
- return await runWithAcpRuntimeOutputDir(settings, cwd, async () => {
21155
+ const readTranscriptPage = /* @__PURE__ */ __name(async (settings) => {
20596
21156
  if (rawDirection === "backward") {
20597
21157
  await this.sessions.get(sessionId)?.getConfig().getChatRecordingService()?.flush();
20598
21158
  }
@@ -20601,6 +21161,8 @@ var QwenAgent = class _QwenAgent {
20601
21161
  const page = await reader.readPage(sessionId, {
20602
21162
  ...typeof rawCursor === "string" ? { cursor: rawCursor } : {},
20603
21163
  ...typeof rawBeforeRecordId === "string" ? { beforeRecordId: rawBeforeRecordId } : {},
21164
+ ...typeof rawAtRecordId === "string" ? { atRecordId: rawAtRecordId } : {},
21165
+ ...typeof rawSnapshot === "string" ? { snapshot: rawSnapshot } : {},
20604
21166
  ...rawDirection === "backward" ? { direction: rawDirection } : {},
20605
21167
  ...typeof rawLimit === "number" ? { limit: rawLimit } : {},
20606
21168
  maxBytes: SESSION_TRANSCRIPT_MAX_PAGE_BYTES
@@ -20626,16 +21188,22 @@ var QwenAgent = class _QwenAgent {
20626
21188
  hasMore: replay.hasMore,
20627
21189
  startTime: replay.startTime,
20628
21190
  lastUpdated: replay.lastUpdated,
20629
- ...replay.replayError !== void 0 ? { partial: true, replayError: replay.replayError } : {}
21191
+ ...replay.replayError !== void 0 ? { partial: true, replayError: replay.replayError } : {},
21192
+ ...page.targetRecordId ? { targetRecordId: page.targetRecordId } : {},
21193
+ ...page.hasOlder !== void 0 ? { hasOlder: page.hasOlder } : {}
20630
21194
  };
20631
- });
21195
+ }, "readTranscriptPage");
21196
+ return await this.runWithPinnedRuntimeBaseDirForRequest(
21197
+ cwd,
21198
+ readTranscriptPage
21199
+ );
20632
21200
  } catch (error) {
20633
- if (error instanceof InvalidSessionTranscriptCursorError || error instanceof RangeError) {
21201
+ if (error instanceof InvalidSessionTranscriptCursorError || error instanceof InvalidSessionTranscriptTurnAnchorError || error instanceof RangeError) {
20634
21202
  throw new RequestError(
20635
21203
  -32602,
20636
21204
  error instanceof Error ? error.message : "Invalid transcript",
20637
21205
  {
20638
- errorKind: error instanceof InvalidSessionTranscriptCursorError ? "invalid_transcript_cursor" : "invalid_transcript_limit"
21206
+ errorKind: error instanceof InvalidSessionTranscriptCursorError ? "invalid_transcript_cursor" : error instanceof InvalidSessionTranscriptTurnAnchorError ? "invalid_turn_anchor" : "invalid_transcript_limit"
20639
21207
  }
20640
21208
  );
20641
21209
  }
@@ -20662,7 +21230,90 @@ var QwenAgent = class _QwenAgent {
20662
21230
  });
20663
21231
  }
20664
21232
  if (error.code === "ENOENT") {
20665
- if (typeof rawCursor === "string") {
21233
+ if (typeof rawCursor === "string" || typeof rawSnapshot === "string") {
21234
+ throw new RequestError(
21235
+ -32010,
21236
+ `Transcript snapshot is unavailable for session ${sessionId}`,
21237
+ {
21238
+ errorKind: "transcript_snapshot_unavailable",
21239
+ sessionId
21240
+ }
21241
+ );
21242
+ }
21243
+ throw RequestError.resourceNotFound(`session:${sessionId}`);
21244
+ }
21245
+ throw error;
21246
+ }
21247
+ }
21248
+ case SERVE_STATUS_EXT_METHODS.sessionTurnIndex: {
21249
+ const sessionId = params["sessionId"];
21250
+ if (typeof sessionId !== "string" || !SESSION_ID_RE.test(sessionId)) {
21251
+ throw RequestError.invalidParams(
21252
+ void 0,
21253
+ "Invalid or missing sessionId"
21254
+ );
21255
+ }
21256
+ const rawSnapshot = params["snapshot"];
21257
+ if (rawSnapshot !== void 0 && (typeof rawSnapshot !== "string" || rawSnapshot.length === 0)) {
21258
+ throw RequestError.invalidParams(
21259
+ void 0,
21260
+ "Invalid transcript snapshot"
21261
+ );
21262
+ }
21263
+ const rawStart = params["start"];
21264
+ if (rawStart !== void 0 && (!Number.isSafeInteger(rawStart) || rawStart < 0 || rawSnapshot === void 0)) {
21265
+ throw RequestError.invalidParams(
21266
+ void 0,
21267
+ "Invalid transcript turn index start"
21268
+ );
21269
+ }
21270
+ const rawLimit = params["limit"];
21271
+ if (rawLimit !== void 0 && (!Number.isSafeInteger(rawLimit) || rawLimit < 1 || rawLimit > SESSION_TRANSCRIPT_MAX_LIMIT)) {
21272
+ throw RequestError.invalidParams(
21273
+ void 0,
21274
+ "Invalid transcript limit"
21275
+ );
21276
+ }
21277
+ try {
21278
+ const readTurnIndexPage = /* @__PURE__ */ __name(async () => {
21279
+ if (rawSnapshot === void 0) {
21280
+ await this.sessions.get(sessionId)?.getConfig().getChatRecordingService()?.flush();
21281
+ }
21282
+ return await new SessionTranscriptReader(cwd).readTurnIndexPage(
21283
+ sessionId,
21284
+ {
21285
+ ...typeof rawSnapshot === "string" ? { snapshot: rawSnapshot } : {},
21286
+ ...typeof rawStart === "number" ? { start: rawStart } : {},
21287
+ ...typeof rawLimit === "number" ? { limit: rawLimit } : {}
21288
+ }
21289
+ );
21290
+ }, "readTurnIndexPage");
21291
+ return await this.runWithPinnedRuntimeBaseDirForRequest(
21292
+ cwd,
21293
+ readTurnIndexPage
21294
+ );
21295
+ } catch (error) {
21296
+ if (error instanceof InvalidSessionTranscriptCursorError || error instanceof RangeError) {
21297
+ throw new RequestError(-32602, error.message, {
21298
+ errorKind: error instanceof InvalidSessionTranscriptCursorError ? "invalid_transcript_cursor" : "invalid_transcript_limit"
21299
+ });
21300
+ }
21301
+ if (error instanceof SessionTranscriptSnapshotUnavailableError) {
21302
+ throw new RequestError(-32010, error.message, {
21303
+ errorKind: "transcript_snapshot_unavailable",
21304
+ sessionId
21305
+ });
21306
+ }
21307
+ if (error instanceof SessionTranscriptTooLargeError) {
21308
+ throw new RequestError(-32011, error.message, {
21309
+ errorKind: "transcript_too_large",
21310
+ sessionId,
21311
+ snapshotSize: error.snapshotSize,
21312
+ maxBytes: error.maxBytes
21313
+ });
21314
+ }
21315
+ if (error.code === "ENOENT") {
21316
+ if (typeof rawSnapshot === "string") {
20666
21317
  throw new RequestError(
20667
21318
  -32010,
20668
21319
  `Transcript snapshot is unavailable for session ${sessionId}`,
@@ -21853,7 +22504,7 @@ var QwenAgent = class _QwenAgent {
21853
22504
  "Invalid or missing sessionId"
21854
22505
  );
21855
22506
  }
21856
- if (typeof targetPath !== "string" || targetPath.length === 0 || !path6.isAbsolute(targetPath) || targetPath.includes("\0")) {
22507
+ if (typeof targetPath !== "string" || targetPath.length === 0 || !path7.isAbsolute(targetPath) || targetPath.includes("\0")) {
21857
22508
  throw RequestError.invalidParams(
21858
22509
  void 0,
21859
22510
  "Invalid or missing path (must be an absolute path)"
@@ -21908,7 +22559,7 @@ var QwenAgent = class _QwenAgent {
21908
22559
  }
21909
22560
  let stats;
21910
22561
  try {
21911
- stats = await fs3.stat(targetPath);
22562
+ stats = await fs4.stat(targetPath);
21912
22563
  } catch {
21913
22564
  if (conversationDirectoryExpectation !== void 0) {
21914
22565
  throw managedConversationDirectoryError(true);
@@ -21929,7 +22580,7 @@ var QwenAgent = class _QwenAgent {
21929
22580
  }
21930
22581
  let canonicalPath;
21931
22582
  try {
21932
- canonicalPath = await fs3.realpath(targetPath);
22583
+ canonicalPath = await fs4.realpath(targetPath);
21933
22584
  } catch (error) {
21934
22585
  if (conversationDirectoryExpectation !== void 0) {
21935
22586
  throw managedConversationDirectoryError(
@@ -21947,7 +22598,7 @@ var QwenAgent = class _QwenAgent {
21947
22598
  "Live managed relocation requires a trusted private ACP parent"
21948
22599
  );
21949
22600
  }
21950
- if (!Array.isArray(allowedRoots) || allowedRoots.length !== 1 || typeof allowedRoots[0] !== "string" || !path6.isAbsolute(allowedRoots[0]) || allowedRoots[0].includes("\0")) {
22601
+ if (!Array.isArray(allowedRoots) || allowedRoots.length !== 1 || typeof allowedRoots[0] !== "string" || !path7.isAbsolute(allowedRoots[0]) || allowedRoots[0].includes("\0")) {
21951
22602
  throw RequestError.invalidParams(
21952
22603
  void 0,
21953
22604
  "Live managed relocation requires one absolute allowed root"
@@ -21958,9 +22609,9 @@ var QwenAgent = class _QwenAgent {
21958
22609
  let canonicalRoot;
21959
22610
  let rootAfter;
21960
22611
  try {
21961
- rootBefore = await fs3.lstat(rootPath);
21962
- canonicalRoot = await fs3.realpath(rootPath);
21963
- rootAfter = await fs3.lstat(canonicalRoot);
22612
+ rootBefore = await fs4.lstat(rootPath);
22613
+ canonicalRoot = await fs4.realpath(rootPath);
22614
+ rootAfter = await fs4.lstat(canonicalRoot);
21964
22615
  } catch {
21965
22616
  if (conversationDirectoryExpectation !== void 0) {
21966
22617
  throw managedConversationDirectoryError(false);
@@ -21990,8 +22641,8 @@ var QwenAgent = class _QwenAgent {
21990
22641
  let targetBefore;
21991
22642
  let targetAfter;
21992
22643
  try {
21993
- targetBefore = await fs3.lstat(targetPath);
21994
- targetAfter = await fs3.lstat(canonicalPath);
22644
+ targetBefore = await fs4.lstat(targetPath);
22645
+ targetAfter = await fs4.lstat(canonicalPath);
21995
22646
  } catch (error) {
21996
22647
  if (conversationDirectoryExpectation !== void 0) {
21997
22648
  throw managedConversationDirectoryError(
@@ -22004,14 +22655,14 @@ var QwenAgent = class _QwenAgent {
22004
22655
  { errorKind: "containment_violation", path: canonicalPath }
22005
22656
  );
22006
22657
  }
22007
- const relativeTarget = path6.relative(canonicalRoot, canonicalPath);
22658
+ const relativeTarget = path7.relative(canonicalRoot, canonicalPath);
22008
22659
  if (!isOwnerOnlyDirectory(targetBefore) || !isOwnerOnlyDirectory(targetAfter) || !isSameDirectoryIdentity(targetBefore, targetAfter) || conversationDirectoryExpectation !== void 0 && (!isSameConversationPath(
22009
22660
  canonicalPath,
22010
22661
  conversationDirectoryExpectation.child.canonicalPath
22011
22662
  ) || !hasExpectedManagedDirectoryIdentity(
22012
22663
  targetAfter,
22013
22664
  conversationDirectoryExpectation.child
22014
- )) || relativeTarget.length === 0 || relativeTarget.startsWith("..") || path6.isAbsolute(relativeTarget) || relativeTarget.includes(path6.sep)) {
22665
+ )) || relativeTarget.length === 0 || relativeTarget.startsWith("..") || path7.isAbsolute(relativeTarget) || relativeTarget.includes(path7.sep)) {
22015
22666
  if (conversationDirectoryExpectation !== void 0) {
22016
22667
  throw managedConversationDirectoryError(false);
22017
22668
  }
@@ -22023,7 +22674,7 @@ var QwenAgent = class _QwenAgent {
22023
22674
  }
22024
22675
  let rootFinal;
22025
22676
  try {
22026
- rootFinal = await fs3.lstat(canonicalRoot);
22677
+ rootFinal = await fs4.lstat(canonicalRoot);
22027
22678
  } catch {
22028
22679
  if (conversationDirectoryExpectation !== void 0) {
22029
22680
  throw managedConversationDirectoryError(false);
@@ -22053,8 +22704,8 @@ var QwenAgent = class _QwenAgent {
22053
22704
  if (Array.isArray(containmentRoots) && containmentRoots.length > 0) {
22054
22705
  const contained = containmentRoots.some((root) => {
22055
22706
  if (typeof root !== "string") return false;
22056
- const rel = path6.relative(root, canonicalPath);
22057
- return !rel.startsWith("..") && !path6.isAbsolute(rel);
22707
+ const rel = path7.relative(root, canonicalPath);
22708
+ return !rel.startsWith("..") && !path7.isAbsolute(rel);
22058
22709
  });
22059
22710
  if (!contained) {
22060
22711
  if (conversationDirectoryExpectation !== void 0) {
@@ -22821,9 +23472,12 @@ ${outputText}
22821
23472
  "The workflow tool is unavailable; cannot run this saved workflow."
22822
23473
  );
22823
23474
  }
22824
- const result = await workflowTool.buildSessionOwnedBackground({
22825
- scriptPath: savedWorkflow.scriptPath
22826
- }).execute(new AbortController().signal);
23475
+ const result = await workflowTool.buildSessionOwnedBackground(
23476
+ {
23477
+ scriptPath: savedWorkflow.scriptPath
23478
+ },
23479
+ savedWorkflow.name
23480
+ ).execute(new AbortController().signal);
22827
23481
  const startedTask = result.workflowRunId ? registry.get(result.workflowRunId) : void 0;
22828
23482
  return startedTask ? {
22829
23483
  changed: true,
@@ -22842,7 +23496,8 @@ ${outputText}
22842
23496
  if (action === "retry" || action === "rerun") {
22843
23497
  const liveElsewhere = action === "retry" && (registry.isStarting?.(taskId) === true || this.isWorkflowRunLiveOutsideSession(sessionId, taskId));
22844
23498
  const canStart = action === "retry" ? task.status === "failed" && !registry.getHandle(taskId) && !liveElsewhere : task.status === "completed" || task.status === "failed" || task.status === "cancelled";
22845
- if (!canStart || !task.script) {
23499
+ const savedScriptPath = task.scriptPath;
23500
+ if (!canStart || !task.script && !savedScriptPath) {
22846
23501
  return { changed: false, status: task.status };
22847
23502
  }
22848
23503
  const attempt = await tryWithWorkflowTaskMutation(
@@ -22855,12 +23510,30 @@ ${outputText}
22855
23510
  `The workflow tool is unavailable; cannot ${action} this run.`
22856
23511
  );
22857
23512
  }
23513
+ let readableScriptPath;
23514
+ if (savedScriptPath) {
23515
+ try {
23516
+ await resolveSavedWorkflowScript(
23517
+ { scriptPath: savedScriptPath },
23518
+ config
23519
+ );
23520
+ readableScriptPath = savedScriptPath;
23521
+ } catch {
23522
+ readableScriptPath = void 0;
23523
+ }
23524
+ }
23525
+ if (!readableScriptPath && !task.script) {
23526
+ return { changed: false, status: task.status };
23527
+ }
22858
23528
  const startParams = {
22859
- script: task.script,
23529
+ ...readableScriptPath ? { scriptPath: readableScriptPath } : { script: task.script },
22860
23530
  args: task.args,
22861
23531
  ...action === "retry" ? { resumeFromRunId: task.runId } : {}
22862
23532
  };
22863
- const result = await workflowTool.buildSessionOwnedBackground(startParams).execute(new AbortController().signal);
23533
+ const result = await workflowTool.buildSessionOwnedBackground(
23534
+ startParams,
23535
+ readableScriptPath ? task.workflowName : void 0
23536
+ ).execute(new AbortController().signal);
22864
23537
  if (action === "rerun") {
22865
23538
  const rerunTask = result.workflowRunId ? registry.get(result.workflowRunId) : void 0;
22866
23539
  if (rerunTask) {
@@ -22991,8 +23664,7 @@ ${outputText}
22991
23664
  );
22992
23665
  }
22993
23666
  const session = this.sessionOrThrow(sessionId);
22994
- const settings = loadSettingsCached(cwd);
22995
- return await runWithAcpRuntimeOutputDir(settings, cwd, async () => {
23667
+ const readSettledTurnResult = /* @__PURE__ */ __name(async () => {
22996
23668
  try {
22997
23669
  await session.getConfig().getChatRecordingService()?.flush();
22998
23670
  } catch {
@@ -23017,7 +23689,7 @@ ${outputText}
23017
23689
  }
23018
23690
  if (error instanceof SessionTranscriptSnapshotUnavailableError && reader) {
23019
23691
  try {
23020
- const transcript = await fs3.stat(
23692
+ const transcript = await fs4.stat(
23021
23693
  reader.getSessionFilePath(sessionId)
23022
23694
  );
23023
23695
  if (transcript.size === 0) {
@@ -23058,7 +23730,11 @@ ${outputText}
23058
23730
  }
23059
23731
  throw error;
23060
23732
  }
23061
- });
23733
+ }, "readSettledTurnResult");
23734
+ return await this.runWithPinnedRuntimeBaseDirForRequest(
23735
+ cwd,
23736
+ readSettledTurnResult
23737
+ );
23062
23738
  }
23063
23739
  case SERVE_CONTROL_EXT_METHODS.sessionContinue: {
23064
23740
  const sessionId = params["sessionId"];
@@ -23235,8 +23911,7 @@ ${outputText}
23235
23911
  "Invalid or missing sessionId"
23236
23912
  );
23237
23913
  }
23238
- const success = await runWithAcpRuntimeOutputDir(
23239
- this.settings,
23914
+ const success = await this.runWithPinnedRuntimeBaseDirForRequest(
23240
23915
  cwd,
23241
23916
  async () => {
23242
23917
  const sessionService = new SessionService(cwd);
@@ -23274,8 +23949,7 @@ ${outputText}
23274
23949
  const ok = await liveRecording.recordCustomTitle(title, "manual");
23275
23950
  return { success: ok };
23276
23951
  }
23277
- const success = await runWithAcpRuntimeOutputDir(
23278
- this.settings,
23952
+ const success = await this.runWithPinnedRuntimeBaseDirForRequest(
23279
23953
  cwd,
23280
23954
  async () => {
23281
23955
  const sessionService = new SessionService(cwd);
@@ -23465,9 +24139,7 @@ ${outputText}
23465
24139
  sessionData = recording ? await recording.runWithWriteBarrier(loadAuthoritative) : await loadAuthoritative();
23466
24140
  replayConfig = config;
23467
24141
  } else {
23468
- const settings = loadSettingsCached(cwd);
23469
- sessionData = await this.runWithPinnedRuntimeBaseDir(
23470
- settings,
24142
+ sessionData = await this.runWithPinnedRuntimeBaseDirForRequest(
23471
24143
  cwd,
23472
24144
  async () => {
23473
24145
  const sessionService = new SessionService(cwd);
@@ -24170,7 +24842,7 @@ ${outputText}
24170
24842
  this.transcriptReplayConfigCache.clear();
24171
24843
  }
24172
24844
  async getTranscriptReplayConfig(cwd, settings) {
24173
- const key = path6.resolve(cwd);
24845
+ const key = path7.resolve(cwd);
24174
24846
  const cached = this.transcriptReplayConfigCache.get(key);
24175
24847
  if (cached?.settings === settings) {
24176
24848
  if (cached.config) {
@@ -24406,7 +25078,9 @@ ${outputText}
24406
25078
  try {
24407
25079
  this.assertManagedSessionAdmission();
24408
25080
  if (this.isTrustedManagedParent()) {
24409
- config.setSessionWriterReclaimPolicy("never");
25081
+ config.setSessionWriterReclaimPolicy(
25082
+ this.conversationsRuntimeProvenance ? "local" : "never"
25083
+ );
24410
25084
  config.setSessionWriterTakeoverPolicy("certified");
24411
25085
  }
24412
25086
  } catch (error) {
@@ -24828,6 +25502,9 @@ ${outputText}
24828
25502
  if (options.deferWorkspaceActivation !== true) {
24829
25503
  config.finalizeSessionRestore?.();
24830
25504
  }
25505
+ if (this.conversationsRuntimeProvenance) {
25506
+ config.getCronScheduler().setSkipDurableFire((job) => job.boundSessionId === void 0);
25507
+ }
24831
25508
  session.startCronScheduler();
24832
25509
  setTimeout(() => {
24833
25510
  void session.sendAvailableCommandsUpdate();