@qwen-code/qwen-code 0.21.11-preview.0 → 0.21.12-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 (381) hide show
  1. package/bundled/coordinate/SKILL.md +52 -0
  2. package/bundled/qc-helper/docs/configuration/model-providers.md +10 -8
  3. package/bundled/qc-helper/docs/features/_meta.ts +1 -0
  4. package/bundled/qc-helper/docs/features/arena.md +4 -3
  5. package/bundled/qc-helper/docs/features/commands.md +7 -6
  6. package/bundled/qc-helper/docs/features/dual-output.md +5 -0
  7. package/bundled/qc-helper/docs/features/headless.md +8 -0
  8. package/bundled/qc-helper/docs/features/multi-agent-coordination.md +30 -0
  9. package/bundled/qc-helper/docs/qwen-serve.md +7 -7
  10. package/bundled/review/SKILL.md +17 -7
  11. package/chunks/{MaxSizedBox-FVSXOMKP.js → MaxSizedBox-VSAJNP52.js} +49 -48
  12. package/chunks/{StandaloneSessionPicker-Q27UAQ3X.js → StandaloneSessionPicker-N5MC42M2.js} +73 -70
  13. package/chunks/{acp-startup-profiler-VNTFWYAC.js → acp-startup-profiler-JMJBZDVO.js} +2 -2
  14. package/chunks/{acpAgent-C6TV2BIU.js → acpAgent-GUV7LTDH.js} +1143 -317
  15. package/chunks/{agent-IPODFZTU.js → agent-WJT3BALC.js} +45 -44
  16. package/chunks/agent-headless-JRRUUVP3.js +87 -0
  17. package/chunks/{anthropicContentGenerator-D3Y4RFT4.js → anthropicContentGenerator-4JSC3ZFL.js} +27 -27
  18. package/chunks/{artifact-tool-N652YE4L.js → artifact-tool-FRMBPDPB.js} +5 -5
  19. package/chunks/{askUserQuestion-ONW74PKJ.js → askUserQuestion-7G3LI3IZ.js} +2 -2
  20. package/chunks/{bridge-YX2R6VVM.js → bridge-VB3BPG7G.js} +50 -49
  21. package/chunks/{build-GDBLPA24.js → build-RZS65IIX.js} +1 -1
  22. package/chunks/{ca-ZLKAB4K3.js → ca-4CQ6MYNQ.js} +2 -1
  23. package/chunks/{channel-management-service-PHELKOW2.js → channel-management-service-SKAN6NOB.js} +6 -6
  24. package/chunks/channel-settings-store-UM7JZEW7.js +102 -0
  25. package/chunks/{channel-worker-group-WQP4RCDO.js → channel-worker-group-YPTB5ASD.js} +8 -7
  26. package/chunks/{channel-worker-manager-MRDFAKIM.js → channel-worker-manager-4EHJSPRH.js} +8 -7
  27. package/chunks/{channel-worker-supervisor-IVSDIMI4.js → channel-worker-supervisor-DZKHYFHV.js} +6 -5
  28. package/chunks/{chunk-J6SZID63.js → chunk-2AZMF6G5.js} +2 -2
  29. package/chunks/{chunk-2IIJTXYF.js → chunk-2SB4SLKC.js} +3 -1
  30. package/chunks/{chunk-VKJ4KTPJ.js → chunk-3GCU5O2E.js} +1 -1
  31. package/chunks/{chunk-PDUIXSYP.js → chunk-3SIXC6QC.js} +7 -7
  32. package/chunks/{chunk-Q3JQ7OSU.js → chunk-3XZYK76R.js} +2 -2
  33. package/chunks/{chunk-SVY7G3WS.js → chunk-3ZLUA4GV.js} +9 -9
  34. package/chunks/{chunk-6CONQTS2.js → chunk-45TYWBCB.js} +1 -1
  35. package/chunks/{chunk-OWMAZHIX.js → chunk-47FQVRCO.js} +1 -1
  36. package/chunks/{chunk-VNNWAZSI.js → chunk-4W25XH7F.js} +7 -7
  37. package/chunks/{chunk-VVSMEI6C.js → chunk-5AWARYOK.js} +22 -101
  38. package/chunks/{chunk-I7XTOGIS.js → chunk-5DDUYIY6.js} +7 -7
  39. package/chunks/{chunk-HV76SFIA.js → chunk-5HBFERG5.js} +3 -3
  40. package/chunks/{chunk-IIJEYBNH.js → chunk-5PWLQ7SK.js} +191 -61
  41. package/chunks/{chunk-BSI645OU.js → chunk-5TXOGH4I.js} +3 -3
  42. package/chunks/{chunk-BO2VRKY2.js → chunk-67LXZ6LV.js} +7 -7
  43. package/chunks/{chunk-KHLBIO6M.js → chunk-6LK2QPIA.js} +11 -11
  44. package/chunks/{chunk-WAUGQKUU.js → chunk-6LYDH7VT.js} +9 -5
  45. package/chunks/{chunk-S6HYI3MF.js → chunk-6S52N6PG.js} +2 -2
  46. package/chunks/{chunk-DZUO626D.js → chunk-6XZERB6P.js} +5 -5
  47. package/chunks/{chunk-FVKHVJZQ.js → chunk-732MOPEM.js} +1 -1
  48. package/chunks/{chunk-5C7FDVHB.js → chunk-7L64FSYQ.js} +55 -477
  49. package/chunks/{chunk-V3KCCRKA.js → chunk-7N6WK2W6.js} +3 -3
  50. package/chunks/chunk-7P32M35F.js +51 -0
  51. package/chunks/{chunk-T3FNRMFJ.js → chunk-7PBUQKMT.js} +1 -1
  52. package/chunks/{chunk-WCG5O7IP.js → chunk-7SUQZ7QH.js} +2 -2
  53. package/chunks/{chunk-LU7RJB2W.js → chunk-A7M57KOL.js} +8 -8
  54. package/chunks/{chunk-6WIKTX4C.js → chunk-ABGS4FDQ.js} +1 -1
  55. package/chunks/{chunk-DVQECPGW.js → chunk-AJL3SAZG.js} +12 -12
  56. package/chunks/{chunk-NV3F44FL.js → chunk-AMXMM7DH.js} +2 -2
  57. package/chunks/{chunk-UVX4Y6IN.js → chunk-AQHNAA7E.js} +1 -1
  58. package/chunks/{chunk-TG3IUQ6M.js → chunk-C2VGLLNA.js} +4 -4
  59. package/chunks/{chunk-H6XPXXMH.js → chunk-CQ35AJ4Z.js} +252 -254
  60. package/chunks/{chunk-COBO5EBO.js → chunk-CTQE2NB2.js} +1 -1
  61. package/chunks/{chunk-PWYEWOZM.js → chunk-CX2MARRJ.js} +1 -1
  62. package/chunks/{chunk-E2FPSSKP.js → chunk-DEG7R6Z6.js} +57 -13
  63. package/chunks/{chunk-A6PSUNCY.js → chunk-DEVFUPC5.js} +8 -8
  64. package/chunks/{chunk-RKCPPZV6.js → chunk-DGM2XA3R.js} +1 -1
  65. package/chunks/{chunk-4P66JPNV.js → chunk-DNRV2US3.js} +5 -5
  66. package/chunks/{chunk-TYAMGABM.js → chunk-E3GLDLYB.js} +6 -0
  67. package/chunks/{chunk-L2AFWWJE.js → chunk-E5BWLU5J.js} +50 -5
  68. package/chunks/{chunk-7C7RTJPC.js → chunk-EAJESCBT.js} +7 -9
  69. package/chunks/{chunk-KKBPOU75.js → chunk-EFIMD5VA.js} +1 -1
  70. package/chunks/{chunk-CTJLZLB5.js → chunk-EN2J77G7.js} +1 -1
  71. package/chunks/{chunk-67EWJE77.js → chunk-ENEEQMGM.js} +1 -1
  72. package/chunks/{chunk-CPG6P4GG.js → chunk-EYS3GGM3.js} +1 -1
  73. package/chunks/{chunk-4PYCZH2V.js → chunk-EYW54TBD.js} +3 -3
  74. package/chunks/{chunk-FOGU3LJX.js → chunk-F6AOBFUN.js} +1 -1
  75. package/chunks/{chunk-F32C6V5B.js → chunk-FLUYVAQZ.js} +3 -3
  76. package/chunks/{chunk-7WUUNAJP.js → chunk-FMLUVVQ6.js} +3 -3
  77. package/chunks/{chunk-ZBVS26BY.js → chunk-FPGTNKCP.js} +7 -5
  78. package/chunks/{chunk-HOUK5CR2.js → chunk-FWJRWCKU.js} +6 -6
  79. package/chunks/{chunk-HGBUHVFO.js → chunk-G4C5RLX6.js} +3 -3
  80. package/chunks/{chunk-EI3HZX6C.js → chunk-GJJQV4PY.js} +1 -1
  81. package/chunks/{chunk-CKASRHZI.js → chunk-GLWWPFTW.js} +1 -1
  82. package/chunks/{chunk-2Z6PYTOK.js → chunk-GQW6P73F.js} +1 -1
  83. package/chunks/{chunk-GM463R2B.js → chunk-GZGDJ4E6.js} +1 -1
  84. package/chunks/{chunk-YGT2AUJ7.js → chunk-HB6QW4LM.js} +37 -20
  85. package/chunks/{chunk-W5UC37EE.js → chunk-HHGQGTJQ.js} +2 -0
  86. package/chunks/chunk-HHJLM3WQ.js +41 -0
  87. package/chunks/{chunk-6ZRFAKXK.js → chunk-IEP44U2R.js} +1 -1
  88. package/chunks/{chunk-O3VWAZLP.js → chunk-INQN4KIA.js} +871 -1033
  89. package/chunks/{chunk-AOHJKPKL.js → chunk-IQFYO5BF.js} +1 -1
  90. package/chunks/{chunk-UDXSXLER.js → chunk-IW6RQPQB.js} +14 -4
  91. package/chunks/{chunk-XCWO3SMQ.js → chunk-IX7CFQGA.js} +3 -3
  92. package/chunks/{chunk-6S4NCX23.js → chunk-JO45C3OY.js} +3 -3
  93. package/chunks/{chunk-HDHLWOG5.js → chunk-JRRZFO4A.js} +2 -2
  94. package/chunks/{chunk-OQTXYMKW.js → chunk-JS4Q5NG5.js} +3 -3
  95. package/chunks/{chunk-UMEB4DHF.js → chunk-JWXBLIQL.js} +4 -4
  96. package/chunks/{chunk-PBRVUF5B.js → chunk-K7JW6V5O.js} +1 -1
  97. package/chunks/{chunk-ZZCWJWTF.js → chunk-KNQZXSLW.js} +9 -3
  98. package/chunks/{chunk-M6HMMKVG.js → chunk-KPVVWKF3.js} +1 -1
  99. package/chunks/{chunk-MVUQRLOH.js → chunk-KT4OWAAZ.js} +3 -3
  100. package/chunks/{chunk-W4RQUHY3.js → chunk-L2GTEEEU.js} +142 -23
  101. package/chunks/{chunk-X7XXP7CN.js → chunk-L2O7DJIE.js} +2 -2
  102. package/chunks/{chunk-BCZ2TTSH.js → chunk-LCWRQA5U.js} +1 -1
  103. package/chunks/{chunk-22C7BQ6D.js → chunk-LHOG4E6Y.js} +3 -3
  104. package/chunks/{chunk-3WOZVMGJ.js → chunk-LOJO2RPW.js} +7 -7
  105. package/chunks/{chunk-DX3RGJMS.js → chunk-LT532KF4.js} +71 -12
  106. package/chunks/{chunk-JT7XS4YW.js → chunk-M2NMFAFR.js} +1 -1
  107. package/chunks/{chunk-P6RBCBBE.js → chunk-M2S67TPJ.js} +3 -3
  108. package/chunks/{chunk-AJ6LQ5A6.js → chunk-M3QYOPGN.js} +1 -1
  109. package/chunks/{chunk-AZQ3DT76.js → chunk-M4NWDIFU.js} +1 -1
  110. package/chunks/{chunk-YTFDX4PR.js → chunk-M6NDLY2T.js} +1 -1
  111. package/chunks/{chunk-X76PVMPQ.js → chunk-MJ5FMYVQ.js} +3 -3
  112. package/chunks/{chunk-EKPKKXY2.js → chunk-MLZCPGDX.js} +1 -1
  113. package/chunks/{chunk-CQGGDOR5.js → chunk-MM4XBXF7.js} +1 -1
  114. package/chunks/{chunk-UHJ5S7DF.js → chunk-MMH3GO4Z.js} +11 -11
  115. package/chunks/{chunk-OIVKILPI.js → chunk-MPBRV3UU.js} +3 -0
  116. package/chunks/{chunk-VFMASYQA.js → chunk-MS7GNABG.js} +3 -0
  117. package/chunks/{chunk-2FRY5CRX.js → chunk-MWZYNOCG.js} +3 -3
  118. package/chunks/chunk-N2TNM3QB.js +9 -0
  119. package/chunks/{chunk-7MH4J33A.js → chunk-N7NBMAMW.js} +2 -2
  120. package/chunks/{chunk-EUNWC2VS.js → chunk-NC4O6UE6.js} +2 -2
  121. package/chunks/{chunk-HUWENAHO.js → chunk-NWPO6I7V.js} +1 -1
  122. package/chunks/{chunk-SR7RZ4MS.js → chunk-O4BBDP2G.js} +2 -2
  123. package/chunks/{chunk-4TRQPFDP.js → chunk-O5AZPHYZ.js} +6 -8
  124. package/chunks/{chunk-XGLVQQ6F.js → chunk-OH5UKBLL.js} +4 -4
  125. package/chunks/{chunk-PIA35YOG.js → chunk-OLU7GIF4.js} +14 -45
  126. package/chunks/{chunk-DA4HRSBW.js → chunk-OPBATTFQ.js} +1 -1
  127. package/chunks/{chunk-7S4DYMFG.js → chunk-OSPIZEAM.js} +34 -23
  128. package/chunks/{chunk-K4QON4BH.js → chunk-OYLNJPY3.js} +61 -364
  129. package/chunks/{chunk-DREZZAZM.js → chunk-P2UCMHDT.js} +14 -6
  130. package/chunks/chunk-PDKLO2DN.js +526 -0
  131. package/chunks/{chunk-TZ3FN4B2.js → chunk-PRWGIKKU.js} +5 -5
  132. package/chunks/{chunk-FYTHSJDQ.js → chunk-Q6FGSG6B.js} +2 -2
  133. package/chunks/{chunk-VBU76UYP.js → chunk-QIN5P5BP.js} +315 -1081
  134. package/chunks/{chunk-2UUMVNYT.js → chunk-QTI7SRXI.js} +3 -3
  135. package/chunks/{chunk-B2GJNDTV.js → chunk-QUESTNOP.js} +1 -1
  136. package/chunks/{chunk-6Q5ABMTU.js → chunk-QZ5G26ZE.js} +36 -32
  137. package/chunks/{chunk-7OFX3YZW.js → chunk-RE6JD2BH.js} +1 -1
  138. package/chunks/{chunk-QUI267ZP.js → chunk-SAQHDAUJ.js} +42 -8
  139. package/chunks/{chunk-UXV3DYVT.js → chunk-SZ36WFVK.js} +1 -1
  140. package/chunks/{chunk-FTO3P6PZ.js → chunk-T2VEHZH3.js} +3 -3
  141. package/chunks/{chunk-TZEZYNYD.js → chunk-T4FTABSW.js} +1 -1
  142. package/chunks/chunk-T5ZFG4CI.js +830 -0
  143. package/chunks/{chunk-SEZ556DZ.js → chunk-T6W4KACQ.js} +1 -1
  144. package/chunks/{chunk-3P2LV43B.js → chunk-TBVNYG5B.js} +5 -5
  145. package/chunks/{chunk-EV3LZGGK.js → chunk-TKAEODJR.js} +572 -42
  146. package/chunks/{chunk-TCRQD7F6.js → chunk-U6LT3QBF.js} +1 -1
  147. package/chunks/{chunk-EQL65XGA.js → chunk-V3LXMASR.js} +47 -21
  148. package/chunks/{chunk-MTE6R5HF.js → chunk-VESDV72K.js} +3 -3
  149. package/chunks/{chunk-SKSOLRPK.js → chunk-VO52SIZW.js} +3 -3
  150. package/chunks/{chunk-ZUIOLZ4V.js → chunk-VUFEW3SF.js} +8471 -2375
  151. package/chunks/{chunk-E2XBEWAK.js → chunk-VUTOKX6F.js} +650 -129
  152. package/chunks/{chunk-5BRSWOSC.js → chunk-WFBG4MF5.js} +4 -4
  153. package/chunks/chunk-WLML6VIA.js +18 -0
  154. package/chunks/{chunk-ONSZH6VM.js → chunk-WQOE4IYF.js} +3 -3
  155. package/chunks/{chunk-PFWPBYL2.js → chunk-XAAL4IFG.js} +3 -3
  156. package/chunks/{chunk-UO2N5QWP.js → chunk-XDN6SMAQ.js} +27 -4
  157. package/chunks/{chunk-GNPNYXJB.js → chunk-XLQS3VI6.js} +2 -2
  158. package/chunks/{chunk-PYQADEFD.js → chunk-XTH2OMDS.js} +1 -1
  159. package/chunks/chunk-XYVBANG5.js +336 -0
  160. package/chunks/{chunk-Y3NNBNGM.js → chunk-YQB3HSQ7.js} +6 -6
  161. package/chunks/{chunk-WOJZWRAZ.js → chunk-YRLW2MSX.js} +1 -1
  162. package/chunks/{chunk-LHEC5V6G.js → chunk-YTYPRVIZ.js} +2 -2
  163. package/chunks/chunk-Z7B6SRPM.js +32 -0
  164. package/chunks/chunk-ZBBVBZBR.js +137 -0
  165. package/chunks/{chunk-MFDYOYZZ.js → chunk-ZGWY4YUB.js} +27 -4
  166. package/chunks/{chunk-B7SQOICP.js → chunk-ZIS5I56G.js} +4 -4
  167. package/chunks/{chunk-IA7TGCN2.js → chunk-ZV4XVYL3.js} +4 -4
  168. package/chunks/{chunk-PJRW65JO.js → chunk-ZWPWQEF5.js} +1 -1
  169. package/chunks/{chunk-DCGYLIYO.js → chunk-ZXUMPZRT.js} +5 -5
  170. package/chunks/chunk-bdqvmfwv-OHYAFAAO.js +17446 -0
  171. package/chunks/{computer-use-5LGM2YO5.js → computer-use-YOYLKIHT.js} +48 -47
  172. package/chunks/{config-utils-ULCSRMWD.js → config-utils-TXVKR27S.js} +6 -6
  173. package/chunks/{contextCommand-JT44ADUD.js → contextCommand-KZMV5EOI.js} +47 -46
  174. package/chunks/{core-runtime-XHEJM2VB.js → core-runtime-VFUL2R7U.js} +45 -44
  175. package/chunks/{create-sub-session-UQBDJF5G.js → create-sub-session-EZW2NP4Z.js} +45 -44
  176. package/chunks/{create-sub-session-QIDZUOPU.js → create-sub-session-Y4WYDZGC.js} +2 -2
  177. package/chunks/{cron-create-VONA5JYY.js → cron-create-ZOVA3CC2.js} +4 -4
  178. package/chunks/{cron-delete-5JXSP2MI.js → cron-delete-7Z3H4LJY.js} +4 -4
  179. package/chunks/{cron-list-KE4F2CIR.js → cron-list-UHGX3IQG.js} +4 -4
  180. package/chunks/{daemon-GWD7BT6E.js → daemon-PXIC4ZDK.js} +186 -7
  181. package/chunks/daemon-status-provider-6L3ZKVVR.js +103 -0
  182. package/chunks/daemon-trust-policy-SZ3V4JEY.js +99 -0
  183. package/chunks/{daemon-trust-policy-monitor-LUMB46CL.js → daemon-trust-policy-monitor-HN34EJQ5.js} +52 -51
  184. package/chunks/{de-LIW4XVLN.js → de-UBEBKG6V.js} +2 -1
  185. package/chunks/{deferred-core-runtime-BFB6YRTZ.js → deferred-core-runtime-Z462KPKI.js} +47 -46
  186. package/chunks/{devtools-4QFYJT6U.js → devtools-X6ROTKHE.js} +1 -1
  187. package/chunks/dispatch-B53LNEO4.js +37 -0
  188. package/chunks/{display-image-NQRSIBXM.js → display-image-ZE3GZNIK.js} +4 -4
  189. package/chunks/{dist-Z3CS4OVP.js → dist-AVUYBK7L.js} +11 -5
  190. package/chunks/{dist-6BMOAE3Z.js → dist-BNWP6IZL.js} +4 -4
  191. package/chunks/{dist-EZE3V3Q7.js → dist-BW2LDPV3.js} +4 -4
  192. package/chunks/{dist-3NTTUAHT.js → dist-EFJILGIS.js} +3 -3
  193. package/chunks/{dist-OTUO3AS2.js → dist-KTYDJNYM.js} +14 -6
  194. package/chunks/{dist-B2CGTW6T.js → dist-NPS52B2V.js} +3 -3
  195. package/chunks/{dist-J47AXBZC.js → dist-PKSRQAR2.js} +3 -3
  196. package/chunks/{dist-EWW3J4HQ.js → dist-ZWDH5HLS.js} +3 -3
  197. package/chunks/{earlyInputCapture-GPULMO2H.js → earlyInputCapture-GSE6MMC7.js} +46 -45
  198. package/chunks/{edit-XYMQNMWU.js → edit-YJX2HMSA.js} +51 -50
  199. package/chunks/{en-SY5GTIGX.js → en-X6YV7GME.js} +2 -1
  200. package/chunks/{enter-worktree-TIASENJP.js → enter-worktree-H3GV4KQ7.js} +50 -49
  201. package/chunks/{enterPlanMode-K6LTIGWM.js → enterPlanMode-6LPSFIN2.js} +51 -50
  202. package/chunks/{environment-3XX7LUMG.js → environment-IVCQ3H7T.js} +48 -47
  203. package/chunks/{errors-VTFZ6M4W.js → errors-2K5VJQVK.js} +47 -46
  204. package/chunks/{exit-worktree-IBKPEHUJ.js → exit-worktree-QZC6DXGO.js} +50 -49
  205. package/chunks/exitPlanMode-UHGM7I4A.js +85 -0
  206. package/chunks/{fast-path-QOBSDLA6.js → fast-path-BDDOO4H6.js} +3 -3
  207. package/chunks/{fast-path-settings-RPAVBD7P.js → fast-path-settings-LNOFM2YP.js} +2 -2
  208. package/chunks/{fr-RQFO7U4P.js → fr-VENTC2BS.js} +2 -1
  209. package/chunks/{gemini-OCRXJUWF.js → gemini-VDUDROF7.js} +105 -104
  210. package/chunks/{geminiContentGenerator-VHSPCS6F.js → geminiContentGenerator-O4HYJOR7.js} +11 -11
  211. package/chunks/{glob-BVX4L3CM.js → glob-Z7VZDN7C.js} +52 -51
  212. package/chunks/{goal-tools-SWNB6GP4.js → goal-tools-JDK2SNMV.js} +4 -4
  213. package/chunks/{grep-CJSUX5NJ.js → grep-JQ6AGN62.js} +51 -50
  214. package/chunks/handleAutoUpdate-XZCLKEMR.js +94 -0
  215. package/chunks/{i18n-BPEDXABF.js → i18n-G2BMPGAS.js} +46 -45
  216. package/chunks/{image-gen-DEEXNNA2.js → image-gen-NMKTIERQ.js} +11 -11
  217. package/chunks/initializer-JEYFVIIG.js +100 -0
  218. package/chunks/{installationInfo-JCUKPGDB.js → installationInfo-GY2OCLIS.js} +46 -45
  219. package/chunks/{ja-KOZKHJHZ.js → ja-QHT4EQTO.js} +2 -1
  220. package/chunks/{keychain-token-storage-TVAMTNP7.js → keychain-token-storage-JTWUYFU7.js} +2 -2
  221. package/chunks/list-ZJ4GEKM4.js +103 -0
  222. package/chunks/{list-agents-Z4WABFDZ.js → list-agents-4GQ2XNEU.js} +2 -2
  223. package/chunks/loadedSettingsAdapter-5BO2PZLD.js +97 -0
  224. package/chunks/{loggingContentGenerator-MOOIBKKR.js → loggingContentGenerator-ER2Z5L3L.js} +59 -40
  225. package/chunks/{loop-wakeup-UZ5RL5Y2.js → loop-wakeup-HOQI3K5D.js} +5 -5
  226. package/chunks/{ls-TVHDGIES.js → ls-FSHISLLA.js} +6 -6
  227. package/chunks/{lsp-CVN6OQPI.js → lsp-APQJ5ZEZ.js} +2 -2
  228. package/chunks/{managed-npm-update-7K2LDL7V.js → managed-npm-update-X66EZDQD.js} +46 -45
  229. package/chunks/mcp-BDWPEXJF.js +97 -0
  230. package/chunks/{monitor-EXI73A5P.js → monitor-7J3DCMBL.js} +50 -49
  231. package/chunks/{node-UUDY34IG.js → node-YSOU44FX.js} +3 -3
  232. package/chunks/nonInteractiveCli-THJJIXKG.js +166 -0
  233. package/chunks/{notebook-edit-GKKQJQQU.js → notebook-edit-IX7GCTIL.js} +51 -50
  234. package/chunks/{openaiContentGenerator-NSPCP4FY.js → openaiContentGenerator-K65IDMQ6.js} +35 -35
  235. package/chunks/opentui-entry-L76XJNPE.js +47945 -0
  236. package/chunks/{pidfile-IU4ETBRE.js → pidfile-NNWTPHX2.js} +46 -45
  237. package/chunks/{processUtils-GZOVMFK4.js → processUtils-ILOXESNR.js} +2 -2
  238. package/chunks/{pt-U6AOCTMF.js → pt-VL3I5RNY.js} +2 -1
  239. package/chunks/{qwenContentGenerator-BBTNTOMB.js → qwenContentGenerator-YIKX3NHW.js} +54 -54
  240. package/chunks/{qwenOAuth2-D6L2W25Z.js → qwenOAuth2-BLYU65Y4.js} +10 -10
  241. package/chunks/read-file-GLBZFPNV.js +32 -0
  242. package/chunks/{read-mcp-resource-PZ4ZF6YL.js → read-mcp-resource-TJSJRH4F.js} +2 -2
  243. package/chunks/{record-artifact-P4HFMS7X.js → record-artifact-FXF5LHPE.js} +3 -3
  244. package/chunks/{resumeHistoryUtils-VUY4B6BO.js → resumeHistoryUtils-UMC4Y3E2.js} +54 -52
  245. package/chunks/ripGrep-53XOGSZ4.js +85 -0
  246. package/chunks/{ru-CMX4UMYP.js → ru-4RCKL4PY.js} +2 -1
  247. package/chunks/{run-qwen-serve-7BDTKCFP.js → run-qwen-serve-BTZ46CLW.js} +67 -60
  248. package/chunks/{runtime-VMWGIAX7.js → runtime-RQ3ACQKH.js} +58 -57
  249. package/chunks/runtime-gate-T4ICWGQJ.js +89 -0
  250. package/chunks/{scheduler-MUKPARY5.js → scheduler-WEIFVKQH.js} +47 -46
  251. package/chunks/{sdk-exporters-grpc-54L4LS5L.js → sdk-exporters-grpc-4QKV6MCX.js} +2 -2
  252. package/chunks/{sdk-exporters-http-XVTZQRCE.js → sdk-exporters-http-2VPMAPFI.js} +13 -13
  253. package/chunks/{sdk-impl-7W7AKCS4.js → sdk-impl-5W3JUCWF.js} +12 -12
  254. package/chunks/{send-message-CAMSLG2L.js → send-message-RBYLV5NY.js} +6 -6
  255. package/chunks/{serve-7G5R52HX.js → serve-RJUR5OJH.js} +52 -51
  256. package/chunks/{server-FTSWAHXF.js → server-WQ2ID4U7.js} +961 -322
  257. package/chunks/{session-FLUDUMZJ.js → session-O4OXRVNI.js} +124 -101
  258. package/chunks/{settings-CJVTBEW7.js → settings-4BVJ36YG.js} +51 -50
  259. package/chunks/{shell-2DOQIYEE.js → shell-DCQZWM5T.js} +45 -44
  260. package/chunks/{skill-2GOEKN34.js → skill-4KWZ4J7U.js} +24 -24
  261. package/chunks/{skill-settings-5FEOMZQS.js → skill-settings-TEMNXCLU.js} +51 -50
  262. package/chunks/{spawnChannel-VJRIO75F.js → spawnChannel-ROYEZK57.js} +48 -46
  263. package/chunks/{standalone-update-OC5IKJGY.js → standalone-update-G4BETY4B.js} +47 -46
  264. package/chunks/{startInteractiveUI-HFHFI2ZR.js → startInteractiveUI-PDFQ7N7A.js} +2665 -2827
  265. package/chunks/{syntheticOutput-PEBJQYJV.js → syntheticOutput-D3Z64LJC.js} +3 -3
  266. package/chunks/{task-create-5NWCQSJF.js → task-create-URFZ5EUX.js} +11 -11
  267. package/chunks/{task-list-53265TRZ.js → task-list-6JDFMPUW.js} +5 -5
  268. package/chunks/{task-stop-FPCOIRYX.js → task-stop-HHUGCD25.js} +2 -2
  269. package/chunks/{task-update-5HN577LS.js → task-update-DVV6CUGI.js} +12 -12
  270. package/chunks/{team-create-ZWAXZR75.js → team-create-KW4LOVHD.js} +52 -51
  271. package/chunks/{team-delete-MMQB4OSC.js → team-delete-PZGGBQLM.js} +5 -5
  272. package/chunks/{team-plan-approval-LH23GCUV.js → team-plan-approval-XHFK2RTF.js} +51 -50
  273. package/chunks/{terminal-image-renderer-7L3GCHD5.js → terminal-image-renderer-46R2LHGR.js} +47 -46
  274. package/chunks/theme-manager-E56XY2JG.js +89 -0
  275. package/chunks/{todoWrite-JGV6VLOX.js → todoWrite-WINAZSZI.js} +4 -4
  276. package/chunks/{tool-search-BZOZHGKI.js → tool-search-EVVFQUMJ.js} +21 -21
  277. package/chunks/{total-session-admission-KP4CJTSB.js → total-session-admission-CULMHRTA.js} +50 -49
  278. package/chunks/{trustedFolders-57QEHV67.js → trustedFolders-BKLVSCXW.js} +46 -45
  279. package/chunks/{update-relaunch-53MODFE4.js → update-relaunch-46H4Q4VL.js} +5 -5
  280. package/chunks/{updateCheck-4QDI7CUZ.js → updateCheck-3BQA7KNI.js} +49 -48
  281. package/chunks/{useAutoAcceptIndicator-VVQUPTM5.js → useAutoAcceptIndicator-3QJ7QV5R.js} +57 -56
  282. package/chunks/{validateNonInterActiveAuth-KKVD5E43.js → validateNonInterActiveAuth-QVFJVBSY.js} +90 -87
  283. package/chunks/{version-IB5ASN63.js → version-6JJA54HH.js} +1 -1
  284. package/chunks/{web-fetch-APSFQMIH.js → web-fetch-75JBSDA3.js} +24 -24
  285. package/chunks/{web-search-EWEHMFIW.js → web-search-PKBISWS3.js} +17 -17
  286. package/chunks/{workflow-LA4ACRO4.js → workflow-KEZDQISR.js} +58 -57
  287. package/chunks/workspace-providers-status-YQW4VNIV.js +100 -0
  288. package/chunks/{workspace-registration-store-WSLHN7HA.js → workspace-registration-store-GQ42PR72.js} +1 -1
  289. package/chunks/{workspace-registry-5HXRV7L4.js → workspace-registry-ZR6DVZQ6.js} +50 -49
  290. package/chunks/{workspace-service-SSP4PLBC.js → workspace-service-BCMK3NLA.js} +58 -57
  291. package/chunks/workspace-skills-status-ZHBYM2X7.js +100 -0
  292. package/chunks/{workspace-trust-reconciler-PASUNEKQ.js → workspace-trust-reconciler-TWRB3TW2.js} +59 -58
  293. package/chunks/wrapper-46Z24CTM.js +35 -0
  294. package/chunks/write-file-CQBI7HXO.js +87 -0
  295. package/chunks/{zh-AGL2FVBI.js → zh-LMSTK4WD.js} +2 -1
  296. package/chunks/{zh-TW-KI66MHQY.js → zh-TW-SQ4HTSCW.js} +2 -1
  297. package/chunks/{zoom-image-NAVVM4R2.js → zoom-image-36I4WZIL.js} +15 -15
  298. package/cli.js +13 -13
  299. package/locales/ca.js +1 -0
  300. package/locales/de.js +1 -0
  301. package/locales/en.js +1 -0
  302. package/locales/fr.js +1 -0
  303. package/locales/ja.js +1 -0
  304. package/locales/pt.js +1 -0
  305. package/locales/ru.js +1 -0
  306. package/locales/zh-TW.js +1 -0
  307. package/locales/zh.js +1 -0
  308. package/package.json +3 -3
  309. package/web-shell/assets/{arc-BGiARkbG.js → arc-CgGUyHWd.js} +1 -1
  310. package/web-shell/assets/{architectureDiagram-3BPJPVTR-3QBZDeqg.js → architectureDiagram-3BPJPVTR-BR0Qv-1Y.js} +1 -1
  311. package/web-shell/assets/{blockDiagram-GPEHLZMM-CbJI0j0o.js → blockDiagram-GPEHLZMM-DIoaceaI.js} +1 -1
  312. package/web-shell/assets/{c4Diagram-AAUBKEIU-pita1IYy.js → c4Diagram-AAUBKEIU-Bc5k6BbI.js} +1 -1
  313. package/web-shell/assets/channel-D2b9IYpS.js +1 -0
  314. package/web-shell/assets/{chunk-2J33WTMH-WzTFww1i.js → chunk-2J33WTMH-DtPEz2WX.js} +1 -1
  315. package/web-shell/assets/{chunk-4BX2VUAB-8TIRo9bL.js → chunk-4BX2VUAB-Dydo6ydE.js} +1 -1
  316. package/web-shell/assets/{chunk-55IACEB6-CuCr34qf.js → chunk-55IACEB6-DD9_VWXm.js} +1 -1
  317. package/web-shell/assets/{chunk-727SXJPM-Bb_xWEAx.js → chunk-727SXJPM-DVI2m59k.js} +1 -1
  318. package/web-shell/assets/{chunk-AQP2D5EJ-C8T1b2Qw.js → chunk-AQP2D5EJ-luatmaTN.js} +1 -1
  319. package/web-shell/assets/{chunk-FMBD7UC4-kjpyMkNM.js → chunk-FMBD7UC4-Duy8NTIi.js} +1 -1
  320. package/web-shell/assets/{chunk-ND2GUHAM-Dm35jDmi.js → chunk-ND2GUHAM-CrL1yhms.js} +1 -1
  321. package/web-shell/assets/{chunk-QZHKN3VN-BPVKwuby.js → chunk-QZHKN3VN-C7BX6bu1.js} +1 -1
  322. package/web-shell/assets/classDiagram-4FO5ZUOK-DHatTCmD.js +1 -0
  323. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-DHatTCmD.js +1 -0
  324. package/web-shell/assets/{cose-bilkent-S5V4N54A-M-7J9Xyz.js → cose-bilkent-S5V4N54A-BTzs7mIi.js} +1 -1
  325. package/web-shell/assets/{dagre-BM42HDAG-u6rmS689.js → dagre-BM42HDAG-3VTUmWts.js} +1 -1
  326. package/web-shell/assets/{diagram-2AECGRRQ-nAisfOUB.js → diagram-2AECGRRQ-Ehdp75GN.js} +1 -1
  327. package/web-shell/assets/{diagram-5GNKFQAL-CpobRd3l.js → diagram-5GNKFQAL-B3wu3teE.js} +1 -1
  328. package/web-shell/assets/{diagram-KO2AKTUF-B82W_wPq.js → diagram-KO2AKTUF-DjgTSf2S.js} +1 -1
  329. package/web-shell/assets/{diagram-LMA3HP47-ClTkmPW6.js → diagram-LMA3HP47-Br9mwjY3.js} +1 -1
  330. package/web-shell/assets/{diagram-OG6HWLK6-42fbxGPW.js → diagram-OG6HWLK6-D4xz5M-z.js} +1 -1
  331. package/web-shell/assets/{erDiagram-TEJ5UH35-8_zQfzlQ.js → erDiagram-TEJ5UH35-CXayWlG_.js} +1 -1
  332. package/web-shell/assets/{flowDiagram-I6XJVG4X-DQDoN_oV.js → flowDiagram-I6XJVG4X-CLonjQTi.js} +1 -1
  333. package/web-shell/assets/{ganttDiagram-6RSMTGT7-Cqd646fB.js → ganttDiagram-6RSMTGT7-BTySFT-1.js} +1 -1
  334. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-B6qWs_tS.js → gitGraphDiagram-PVQCEYII--2WcUjOe.js} +1 -1
  335. package/web-shell/assets/{index-eYjX7fQg.css → index-CIFO52Wx.css} +1 -1
  336. package/web-shell/assets/{index-BCeQB_tk.js → index-DPJHkFOG.js} +1 -1
  337. package/web-shell/assets/index-bhq3CUUF.js +1789 -0
  338. package/web-shell/assets/{infoDiagram-5YYISTIA-BVyDAHuu.js → infoDiagram-5YYISTIA-9vpgAf1m.js} +1 -1
  339. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-BBHM904I.js → ishikawaDiagram-YF4QCWOH-DcRpHnAW.js} +1 -1
  340. package/web-shell/assets/{journeyDiagram-JHISSGLW-B5Bv5Z_0.js → journeyDiagram-JHISSGLW-C2TKorRm.js} +1 -1
  341. package/web-shell/assets/{kanban-definition-UN3LZRKU-BwSTb0YF.js → kanban-definition-UN3LZRKU-DdsFwB8b.js} +1 -1
  342. package/web-shell/assets/{linear-CHtTm36c.js → linear-7PjRvJrf.js} +1 -1
  343. package/web-shell/assets/{mermaid.core-vBCuAUkf.js → mermaid.core-raDXa11C.js} +5 -5
  344. package/web-shell/assets/{mindmap-definition-RKZ34NQL-CNfKHJrA.js → mindmap-definition-RKZ34NQL-DLHc-PRN.js} +1 -1
  345. package/web-shell/assets/{pieDiagram-4H26LBE5-DT6QMLhc.js → pieDiagram-4H26LBE5-BftYpeTW.js} +1 -1
  346. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-Rb2Dar4i.js → quadrantDiagram-W4KKPZXB-O-6ygOYn.js} +1 -1
  347. package/web-shell/assets/{requirementDiagram-4Y6WPE33-CA9YzPUY.js → requirementDiagram-4Y6WPE33-BmZWVufJ.js} +1 -1
  348. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-CJ5SkhJw.js → sankeyDiagram-5OEKKPKP-2x5beiWt.js} +1 -1
  349. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-T31AiuVM.js → sequenceDiagram-3UESZ5HK-BH8uKokQ.js} +1 -1
  350. package/web-shell/assets/{stateDiagram-AJRCARHV-f7Xpd_Xh.js → stateDiagram-AJRCARHV-Dq1MFgX_.js} +1 -1
  351. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-spuAYji6.js +1 -0
  352. package/web-shell/assets/{timeline-definition-PNZ67QCA-dCwsTscr.js → timeline-definition-PNZ67QCA-Cl2WKbv9.js} +1 -1
  353. package/web-shell/assets/{vennDiagram-CIIHVFJN-SQtBFYkQ.js → vennDiagram-CIIHVFJN-BqoRo_Q-.js} +1 -1
  354. package/web-shell/assets/{wardley-L42UT6IY-Dfh4eW0B.js → wardley-L42UT6IY-BTxp-Yot.js} +1 -1
  355. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-BWBKXBsC.js → wardleyDiagram-YWT4CUSO-DFXVCSH2.js} +1 -1
  356. package/web-shell/assets/{xychartDiagram-2RQKCTM6-DVqzcaxh.js → xychartDiagram-2RQKCTM6-qQhWx0aE.js} +1 -1
  357. package/web-shell/index.html +2 -2
  358. package/chunks/agent-headless-JOL3STCJ.js +0 -86
  359. package/chunks/channel-settings-store-CDUEUDYS.js +0 -101
  360. package/chunks/chunk-PDPFQ2FO.js +0 -156
  361. package/chunks/daemon-status-provider-67M3LFIJ.js +0 -102
  362. package/chunks/daemon-trust-policy-3XCIBLLT.js +0 -98
  363. package/chunks/exitPlanMode-2U23CG2U.js +0 -84
  364. package/chunks/handleAutoUpdate-2F3RWBIT.js +0 -93
  365. package/chunks/initializer-QRD7X25L.js +0 -99
  366. package/chunks/list-G6SHYRHQ.js +0 -102
  367. package/chunks/loadedSettingsAdapter-S4EPYP35.js +0 -96
  368. package/chunks/mcp-R2Z6IKPN.js +0 -96
  369. package/chunks/nonInteractiveCli-E6CEE6IG.js +0 -162
  370. package/chunks/read-file-S2BROE4F.js +0 -32
  371. package/chunks/ripGrep-V4EX6SLA.js +0 -84
  372. package/chunks/theme-manager-7WO6DXIT.js +0 -88
  373. package/chunks/workspace-providers-status-5C3HGWHF.js +0 -99
  374. package/chunks/workspace-skills-status-DX7CA34S.js +0 -99
  375. package/chunks/write-file-3N2WAE3F.js +0 -86
  376. package/web-shell/assets/channel-3vYOf77E.js +0 -1
  377. package/web-shell/assets/classDiagram-4FO5ZUOK-Dr2aqxvr.js +0 -1
  378. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-Dr2aqxvr.js +0 -1
  379. package/web-shell/assets/index-Dv9zBWC9.js +0 -1775
  380. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-wucbNzkr.js +0 -1
  381. /package/chunks/{chunk-NWNEANAT.js → chunk-44CTCCLY.js} +0 -0
@@ -1,5 +1,8 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
+ import {
4
+ recomputeMcpGating
5
+ } from "./chunk-ZXUMPZRT.js";
3
6
  import {
4
7
  classifyApiError,
5
8
  fireSessionDeleteHook
@@ -13,17 +16,17 @@ import {
13
16
  matchMcpServerByRef,
14
17
  parseExtensionRef,
15
18
  parseMcpServerRef
16
- } from "./chunk-7C7RTJPC.js";
19
+ } from "./chunk-EAJESCBT.js";
20
+ import "./chunk-WLML6VIA.js";
17
21
  import {
18
22
  getAvailableCommands,
19
23
  handleSlashCommand,
20
24
  insertAfterFunctionResponses,
21
- isSlashCommand,
22
25
  normalizePartList
23
- } from "./chunk-VBU76UYP.js";
26
+ } from "./chunk-T5ZFG4CI.js";
24
27
  import {
25
- recomputeMcpGating
26
- } from "./chunk-DCGYLIYO.js";
28
+ isSlashCommand
29
+ } from "./chunk-QIN5P5BP.js";
27
30
  import {
28
31
  SessionIdConflictError,
29
32
  appEvents,
@@ -31,40 +34,43 @@ import {
31
34
  cleanupReviewWorktreeLeases,
32
35
  loadCliConfig,
33
36
  normalizeDisabledToolList
34
- } from "./chunk-ZUIOLZ4V.js";
37
+ } from "./chunk-VUFEW3SF.js";
35
38
  import {
36
39
  getCommandSubcommandNames
37
- } from "./chunk-CQGGDOR5.js";
40
+ } from "./chunk-MM4XBXF7.js";
38
41
  import {
39
42
  getEffectiveSupportedModes
40
- } from "./chunk-HDHLWOG5.js";
43
+ } from "./chunk-JRRZFO4A.js";
41
44
  import "./chunk-NYX53SV4.js";
42
- import "./chunk-NV3F44FL.js";
45
+ import "./chunk-AMXMM7DH.js";
43
46
  import {
44
47
  collectContextData,
45
48
  formatContextUsageText
46
- } from "./chunk-A6PSUNCY.js";
49
+ } from "./chunk-DEVFUPC5.js";
47
50
  import "./chunk-4WGODMVR.js";
51
+ import {
52
+ isGoalStatusKind
53
+ } from "./chunk-EKTCKZV5.js";
54
+ import "./chunk-EN2J77G7.js";
48
55
  import {
49
56
  startNonInteractiveOpenAILogHousekeeping
50
- } from "./chunk-XGLVQQ6F.js";
57
+ } from "./chunk-OH5UKBLL.js";
51
58
  import "./chunk-KW7NOTN6.js";
52
- import "./chunk-CTJLZLB5.js";
53
- import "./chunk-UMEB4DHF.js";
54
- import "./chunk-SKSOLRPK.js";
59
+ import "./chunk-JWXBLIQL.js";
60
+ import "./chunk-T2VEHZH3.js";
61
+ import "./chunk-VO52SIZW.js";
55
62
  import "./chunk-YAF2MQZ6.js";
56
63
  import {
57
64
  computeCpuPercent
58
65
  } from "./chunk-LBOVL47Y.js";
59
- import "./chunk-BO2VRKY2.js";
66
+ import "./chunk-67LXZ6LV.js";
60
67
  import "./chunk-6H67XLET.js";
61
68
  import {
62
69
  beginAcpBootstrapConfigProfiling,
63
70
  buildAndFreezeAcpStartupProfile,
64
71
  endAcpBootstrapConfigProfiling,
65
72
  markAcpStartup
66
- } from "./chunk-JT7XS4YW.js";
67
- import "./chunk-FTO3P6PZ.js";
73
+ } from "./chunk-M2NMFAFR.js";
68
74
  import {
69
75
  GENERATION_MAX_PROMPT_BYTES,
70
76
  GENERATION_TIMEOUT_MS,
@@ -86,25 +92,22 @@ import {
86
92
  shouldSuppressRememberErrorDetails,
87
93
  workspaceMemoryFailureCode,
88
94
  workspaceMemoryFailureDiagnostics
89
- } from "./chunk-VVSMEI6C.js";
95
+ } from "./chunk-5AWARYOK.js";
96
+ import "./chunk-ZBBVBZBR.js";
90
97
  import {
98
+ BaseEmitter,
91
99
  HistoryReplayer,
92
- MessageEmitter,
93
100
  PlanEmitter,
94
101
  ToolCallEmitter,
95
- collectGoalStatusItemsFromRecords,
96
- goalTerminalEventToHistoryItem,
97
- recordGoalStatusItem,
98
- restoreGoalFromHistory
99
- } from "./chunk-5C7FDVHB.js";
100
- import "./chunk-OWMAZHIX.js";
101
- import "./chunk-2Z6PYTOK.js";
102
+ createTranscriptMessageUpdate,
103
+ createTranscriptUsageUpdate,
104
+ hasFullSessionContext
105
+ } from "./chunk-7L64FSYQ.js";
106
+ import "./chunk-47FQVRCO.js";
102
107
  import "./chunk-4NFY2S7N.js";
108
+ import "./chunk-GQW6P73F.js";
103
109
  import "./chunk-2MIN6GRR.js";
104
110
  import "./chunk-QHTIBUWB.js";
105
- import {
106
- isTerminalGoalStatusKind
107
- } from "./chunk-EKTCKZV5.js";
108
111
  import "./chunk-3Z43GZUQ.js";
109
112
  import {
110
113
  buildToolWriteOriginMeta
@@ -120,19 +123,26 @@ import {
120
123
  buildPermissionSettings,
121
124
  normalizePermissionRules,
122
125
  readPermissionRuleSet
123
- } from "./chunk-BCZ2TTSH.js";
126
+ } from "./chunk-LCWRQA5U.js";
124
127
  import {
125
128
  MAX_AUDIO_BYTES,
126
129
  sanitizeVoiceErrorMessage,
127
130
  transcribeVoiceAudio
128
- } from "./chunk-F32C6V5B.js";
131
+ } from "./chunk-FLUYVAQZ.js";
129
132
  import {
130
133
  readVoiceModel
131
- } from "./chunk-UXV3DYVT.js";
132
- import "./chunk-AOHJKPKL.js";
134
+ } from "./chunk-SZ36WFVK.js";
135
+ import "./chunk-IQFYO5BF.js";
133
136
  import "./chunk-NTTBXH7U.js";
134
- import "./chunk-B7SQOICP.js";
137
+ import "./chunk-ZIS5I56G.js";
135
138
  import "./chunk-3SH53ANB.js";
139
+ import {
140
+ SESSION_SOURCE_META_KEY,
141
+ parseSessionSource
142
+ } from "./chunk-VUTOKX6F.js";
143
+ import "./chunk-MZSJ43WV.js";
144
+ import "./chunk-XCGIMOLN.js";
145
+ import "./chunk-OCPBI7J5.js";
136
146
  import {
137
147
  ACP_ROUTE_ID_PREFIX,
138
148
  buildAcpModelOptions,
@@ -141,32 +151,26 @@ import {
141
151
  parseAcpModelOption,
142
152
  resolveAcpModelOption,
143
153
  sanitizeProviderBaseUrl
144
- } from "./chunk-I7XTOGIS.js";
154
+ } from "./chunk-5DDUYIY6.js";
145
155
  import {
146
156
  mapSkillConfigToStatus
147
157
  } from "./chunk-BGXZBI5B.js";
148
158
  import {
149
159
  resolveSkillSettings
150
160
  } from "./chunk-Z4X5MTRT.js";
151
- import "./chunk-PDUIXSYP.js";
152
- import "./chunk-TG3IUQ6M.js";
161
+ import "./chunk-3SIXC6QC.js";
162
+ import "./chunk-C2VGLLNA.js";
153
163
  import "./chunk-57OAHC2Y.js";
154
- import "./chunk-LHEC5V6G.js";
155
- import "./chunk-67EWJE77.js";
156
- import "./chunk-E2FPSSKP.js";
164
+ import "./chunk-YTYPRVIZ.js";
165
+ import "./chunk-ENEEQMGM.js";
166
+ import "./chunk-DEG7R6Z6.js";
167
+ import "./chunk-V6WHFGST.js";
157
168
  import {
158
169
  createLoadedSettingsAdapter
159
- } from "./chunk-T3FNRMFJ.js";
160
- import {
161
- SESSION_SOURCE_META_KEY,
162
- parseSessionSource
163
- } from "./chunk-E2XBEWAK.js";
164
- import "./chunk-MZSJ43WV.js";
165
- import "./chunk-XCGIMOLN.js";
166
- import "./chunk-OCPBI7J5.js";
170
+ } from "./chunk-7PBUQKMT.js";
167
171
  import {
168
172
  ndJsonStream
169
- } from "./chunk-EV3LZGGK.js";
173
+ } from "./chunk-TKAEODJR.js";
170
174
  import {
171
175
  ACP_PREFLIGHT_KINDS,
172
176
  IDLE_HOOK_EVENTS,
@@ -174,9 +178,9 @@ import {
174
178
  SERVE_STATUS_EXT_METHODS,
175
179
  STATUS_SCHEMA_VERSION,
176
180
  mapDomainErrorToErrorKind
177
- } from "./chunk-DA4HRSBW.js";
178
- import "./chunk-VKJ4KTPJ.js";
179
- import "./chunk-V6WHFGST.js";
181
+ } from "./chunk-OPBATTFQ.js";
182
+ import "./chunk-3GCU5O2E.js";
183
+ import "./chunk-L2O7DJIE.js";
180
184
  import {
181
185
  ACTIVE_WORK_CLOSE_IF_UNHELD_PARAM,
182
186
  ACTIVE_WORK_HEARTBEAT_META_KEY,
@@ -188,6 +192,7 @@ import {
188
192
  CLIENT_MCP_OVER_WS_CONFIG_FLAG,
189
193
  DAEMON_CHANNEL_DELIVERY_META_KEY,
190
194
  DAEMON_MODEL_PROMPT_META_KEY,
195
+ DAEMON_PROMPT_DISPLAY_TEXT_META_KEY,
191
196
  LOAD_REPLAY_BULK_MODE,
192
197
  LOAD_REPLAY_HIDE_INHERITED_META_KEY,
193
198
  LOAD_REPLAY_META_KEY,
@@ -202,7 +207,7 @@ import {
202
207
  WORKTREE_MCP_DEFER_META_KEY,
203
208
  clampActiveWorkIntervalMs,
204
209
  isValidTrustedModelPrompt
205
- } from "./chunk-W5UC37EE.js";
210
+ } from "./chunk-HHGQGTJQ.js";
206
211
  import {
207
212
  NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE,
208
213
  isNotCurrentlyGeneratingCancelError
@@ -210,7 +215,7 @@ import {
210
215
  import "./chunk-6PLDPT2C.js";
211
216
  import "./chunk-FYJ7W2PI.js";
212
217
  import "./chunk-YP5KH5Y7.js";
213
- import "./chunk-PBRVUF5B.js";
218
+ import "./chunk-K7JW6V5O.js";
214
219
  import "./chunk-ALMR3E6Q.js";
215
220
  import "./chunk-HIBNSEJE.js";
216
221
  import "./chunk-M5GB774H.js";
@@ -221,20 +226,20 @@ import {
221
226
  PRIVATE_EXTERNAL_TOOL_GUARD_ENV,
222
227
  isValidExternalToolGuardDenialReason
223
228
  } from "./chunk-BKHCW2BI.js";
224
- import "./chunk-UVX4Y6IN.js";
225
229
  import {
226
230
  ACP_EVENT_LOOP_STALL_RESTART_MS,
227
231
  CHANNEL_PROMPT_META_KEY
228
- } from "./chunk-DX3RGJMS.js";
232
+ } from "./chunk-LT532KF4.js";
229
233
  import {
230
234
  AgentSideConnection,
231
235
  PROTOCOL_VERSION,
232
236
  RequestError
233
- } from "./chunk-UDXSXLER.js";
237
+ } from "./chunk-IW6RQPQB.js";
238
+ import "./chunk-AQHNAA7E.js";
234
239
  import {
235
240
  assembleMcpServers,
236
241
  loadMcpApprovals
237
- } from "./chunk-HOUK5CR2.js";
242
+ } from "./chunk-FWJRWCKU.js";
238
243
  import {
239
244
  getOutputLanguageFilePath,
240
245
  getPersistScopeForModelSelection,
@@ -243,9 +248,9 @@ import {
243
248
  resolveOutputLanguageOrPreserveAuto,
244
249
  updateOutputLanguageFile,
245
250
  writeOutputLanguageAndRegisterPath
246
- } from "./chunk-SVY7G3WS.js";
247
- import "./chunk-HGBUHVFO.js";
251
+ } from "./chunk-3ZLUA4GV.js";
248
252
  import "./chunk-RKUWKYED.js";
253
+ import "./chunk-G4C5RLX6.js";
249
254
  import "./chunk-GOXKNSDZ.js";
250
255
  import {
251
256
  getSystemDefaultsPath,
@@ -254,7 +259,7 @@ import {
254
259
  import {
255
260
  getCurrentLanguage,
256
261
  setLanguageAsync
257
- } from "./chunk-KHLBIO6M.js";
262
+ } from "./chunk-6LK2QPIA.js";
258
263
  import {
259
264
  SUPPORTED_LANGUAGES
260
265
  } from "./chunk-5EJZE3FP.js";
@@ -262,18 +267,17 @@ import {
262
267
  findEnvFiles,
263
268
  preResolveHomeEnvOverrides,
264
269
  reloadEnvironment
265
- } from "./chunk-V3KCCRKA.js";
270
+ } from "./chunk-7N6WK2W6.js";
266
271
  import {
267
272
  ENV_ACP_REPEATED_TOOL_FAILURE_GUARD
268
- } from "./chunk-VFMASYQA.js";
269
- import "./chunk-X7XXP7CN.js";
270
- import "./chunk-RKCPPZV6.js";
273
+ } from "./chunk-MS7GNABG.js";
274
+ import "./chunk-DGM2XA3R.js";
271
275
  import "./chunk-VJNBRRZG.js";
272
276
  import {
273
277
  isFolderTrustEnabled,
274
278
  isWorkspaceTrusted,
275
279
  loadTrustedFolders
276
- } from "./chunk-P6RBCBBE.js";
280
+ } from "./chunk-M2S67TPJ.js";
277
281
  import "./chunk-NPQ5ZKRP.js";
278
282
  import "./chunk-MR3PXB6E.js";
279
283
  import "./chunk-XFSFZCM5.js";
@@ -326,7 +330,6 @@ import {
326
330
  buildPermissionCheckContext,
327
331
  buildSessionRecoveryPlanFromApiHistory,
328
332
  clampInlineMediaPart,
329
- clearGoalTerminalObserver,
330
333
  computeUniqueBranchTitle,
331
334
  convertToFunctionErrorResponse,
332
335
  convertToFunctionResponse,
@@ -384,6 +387,7 @@ import {
384
387
  normalizeEventPayload,
385
388
  normalizeSnapshotPayload,
386
389
  persistPermissionOutcome,
390
+ projectGoalStateToLegacy,
387
391
  readManyFiles,
388
392
  recordAllow,
389
393
  recordFallbackApprove,
@@ -396,7 +400,6 @@ import {
396
400
  runManagedAutoMemoryDream,
397
401
  runManagedRememberByAgent,
398
402
  sessionIdContext,
399
- setGoalTerminalObserver,
400
403
  shouldClassifyAllShellForAutoMode,
401
404
  shouldFallback,
402
405
  shouldFirePermissionDeniedForAutoMode,
@@ -404,29 +407,29 @@ import {
404
407
  shouldHaltOnTurnToolCallCap,
405
408
  shouldRunAutoModeForCall,
406
409
  subagentGenerator,
407
- unregisterGoalHook,
410
+ truncateNotificationLabel,
408
411
  updateSetting,
409
412
  validatePlanModeShellApproval,
410
413
  validatePlanModeShellContext
411
- } from "./chunk-O3VWAZLP.js";
414
+ } from "./chunk-INQN4KIA.js";
412
415
  import "./chunk-GOFAQQZA.js";
413
416
  import "./chunk-5M6IDOMF.js";
414
417
  import "./chunk-TWPJO254.js";
415
418
  import {
416
419
  external_exports
417
- } from "./chunk-H6XPXXMH.js";
418
- import "./chunk-2UUMVNYT.js";
419
- import "./chunk-MVUQRLOH.js";
420
- import "./chunk-XCWO3SMQ.js";
421
- import "./chunk-7MH4J33A.js";
420
+ } from "./chunk-CQ35AJ4Z.js";
421
+ import "./chunk-QTI7SRXI.js";
422
+ import "./chunk-KT4OWAAZ.js";
423
+ import "./chunk-IX7CFQGA.js";
424
+ import "./chunk-N7NBMAMW.js";
422
425
  import {
423
426
  parsePositiveIntegerEnv
424
427
  } from "./chunk-6PVPNMXU.js";
425
- import "./chunk-TCRQD7F6.js";
428
+ import "./chunk-U6LT3QBF.js";
426
429
  import "./chunk-IRH27ZC2.js";
427
430
  import "./chunk-QHWCP53L.js";
428
- import "./chunk-GNPNYXJB.js";
429
- import "./chunk-HUWENAHO.js";
431
+ import "./chunk-XLQS3VI6.js";
432
+ import "./chunk-NWPO6I7V.js";
430
433
  import {
431
434
  promptIdContext,
432
435
  todoWorkChainContext
@@ -434,21 +437,24 @@ import {
434
437
  import "./chunk-T26EAKDL.js";
435
438
  import "./chunk-ZPJWUGCS.js";
436
439
  import "./chunk-CPBF7KYF.js";
437
- import "./chunk-J6SZID63.js";
440
+ import {
441
+ APPROVAL_MODES
442
+ } from "./chunk-6LYDH7VT.js";
443
+ import "./chunk-2AZMF6G5.js";
438
444
  import "./chunk-KRXPRVGL.js";
439
445
  import {
440
446
  HookEventName,
441
447
  createHookOutput
442
- } from "./chunk-GM463R2B.js";
443
- import "./chunk-SEZ556DZ.js";
444
- import "./chunk-2FRY5CRX.js";
448
+ } from "./chunk-GZGDJ4E6.js";
449
+ import "./chunk-T6W4KACQ.js";
450
+ import "./chunk-MWZYNOCG.js";
445
451
  import {
452
+ GoalPersistenceUnavailableError,
453
+ emptyGoalSnapshot,
454
+ goalTurnContext,
446
455
  wrapUserPromptSubmitContext
447
- } from "./chunk-QUI267ZP.js";
448
- import {
449
- APPROVAL_MODES
450
- } from "./chunk-WAUGQKUU.js";
451
- import "./chunk-DZUO626D.js";
456
+ } from "./chunk-SAQHDAUJ.js";
457
+ import "./chunk-6XZERB6P.js";
452
458
  import {
453
459
  addToolArgumentsAttributes,
454
460
  addToolCallResultAttributes,
@@ -456,42 +462,14 @@ import {
456
462
  registerAcpEventLoopLagGauge,
457
463
  startEventLoopLagMonitor,
458
464
  withDaemonSpan
459
- } from "./chunk-4TRQPFDP.js";
465
+ } from "./chunk-O5AZPHYZ.js";
460
466
  import "./chunk-SAH4BD2J.js";
467
+ import "./chunk-5PWLQ7SK.js";
461
468
  import {
462
469
  runWithRuntimeContentGenerator
463
- } from "./chunk-CPG6P4GG.js";
470
+ } from "./chunk-EYS3GGM3.js";
464
471
  import "./chunk-S6LOFUVP.js";
465
472
  import "./chunk-2J3OJGTL.js";
466
- import {
467
- FORK_SUBAGENT_TYPE,
468
- getStartupContextLength,
469
- isSystemReminderContent
470
- } from "./chunk-IA7TGCN2.js";
471
- import "./chunk-K623ENWT.js";
472
- import "./chunk-AQ37AY7B.js";
473
- import "./chunk-EQL65XGA.js";
474
- import {
475
- clearCachedCredentialFile,
476
- qwenOAuth2Events
477
- } from "./chunk-3P2LV43B.js";
478
- import "./chunk-NAVJD2PQ.js";
479
- import "./chunk-HV76SFIA.js";
480
- import "./chunk-4PYCZH2V.js";
481
- import "./chunk-P3QQPMQA.js";
482
- import "./chunk-SR7RZ4MS.js";
483
- import "./chunk-M6HMMKVG.js";
484
- import {
485
- REASONING_EFFORT_TIERS,
486
- applyReasoningEffort
487
- } from "./chunk-KM73TBQ4.js";
488
- import "./chunk-MPHPFVKK.js";
489
- import "./chunk-AXMWHKXA.js";
490
- import {
491
- getToolCallPreparations
492
- } from "./chunk-GLCZKT5V.js";
493
- import "./chunk-DJ2GSRLV.js";
494
- import "./chunk-EI3HZX6C.js";
495
473
  import {
496
474
  ConversationFinishedEvent,
497
475
  DiscoveredMCPTool,
@@ -502,6 +480,7 @@ import {
502
480
  PromptSuggestionEvent,
503
481
  RepeatedToolFailureGuardEvent,
504
482
  UserPromptEvent,
483
+ apiActivityTracker,
505
484
  formatFullTurnVisionNotice,
506
485
  formatVisionBridgeNotice,
507
486
  getAllGeminiMdFilenames,
@@ -523,17 +502,26 @@ import {
523
502
  shouldRunVisionBridge,
524
503
  splitImageParts,
525
504
  uiTelemetryService
526
- } from "./chunk-YGT2AUJ7.js";
527
- import "./chunk-WOJZWRAZ.js";
505
+ } from "./chunk-HB6QW4LM.js";
506
+ import "./chunk-YRLW2MSX.js";
528
507
  import "./chunk-VGC4I5JJ.js";
529
508
  import {
530
509
  getAutoMemoryRoot,
531
510
  getUserAutoMemoryRoot
532
- } from "./chunk-FVKHVJZQ.js";
511
+ } from "./chunk-732MOPEM.js";
533
512
  import {
534
513
  runSideQuery
535
- } from "./chunk-COBO5EBO.js";
536
- import "./chunk-6ZRFAKXK.js";
514
+ } from "./chunk-CTQE2NB2.js";
515
+ import "./chunk-NC4O6UE6.js";
516
+ import "./chunk-IEP44U2R.js";
517
+ import {
518
+ FORK_SUBAGENT_TYPE,
519
+ getStartupContextLength,
520
+ isSystemReminderContent
521
+ } from "./chunk-ZV4XVYL3.js";
522
+ import "./chunk-K623ENWT.js";
523
+ import "./chunk-AQ37AY7B.js";
524
+ import "./chunk-V3LXMASR.js";
537
525
  import {
538
526
  BaseDeclarativeTool,
539
527
  BaseToolInvocation,
@@ -541,20 +529,40 @@ import {
541
529
  ToolNames,
542
530
  canonicalToolName,
543
531
  isShellProgressData
544
- } from "./chunk-PYQADEFD.js";
532
+ } from "./chunk-XTH2OMDS.js";
533
+ import {
534
+ clearCachedCredentialFile,
535
+ qwenOAuth2Events
536
+ } from "./chunk-TBVNYG5B.js";
537
+ import "./chunk-NAVJD2PQ.js";
538
+ import "./chunk-5HBFERG5.js";
539
+ import "./chunk-EYW54TBD.js";
540
+ import "./chunk-P3QQPMQA.js";
541
+ import "./chunk-O4BBDP2G.js";
542
+ import "./chunk-KPVVWKF3.js";
545
543
  import {
546
544
  AuthType,
547
545
  preloadContentGenerator
548
- } from "./chunk-3WOZVMGJ.js";
546
+ } from "./chunk-LOJO2RPW.js";
549
547
  import "./chunk-F6WFNA7U.js";
548
+ import "./chunk-F6AOBFUN.js";
549
+ import {
550
+ REASONING_EFFORT_TIERS,
551
+ applyReasoningEffort
552
+ } from "./chunk-KM73TBQ4.js";
553
+ import "./chunk-MPHPFVKK.js";
554
+ import "./chunk-AXMWHKXA.js";
555
+ import {
556
+ getToolCallPreparations
557
+ } from "./chunk-GLCZKT5V.js";
558
+ import "./chunk-GJJQV4PY.js";
550
559
  import "./chunk-46UV252V.js";
551
560
  import {
552
561
  DEFAULT_TOKEN_LIMIT,
553
562
  tokenLimit
554
- } from "./chunk-ZBVS26BY.js";
555
- import "./chunk-KKBPOU75.js";
556
- import "./chunk-EUNWC2VS.js";
557
- import "./chunk-FOGU3LJX.js";
563
+ } from "./chunk-FPGTNKCP.js";
564
+ import "./chunk-DJ2GSRLV.js";
565
+ import "./chunk-EFIMD5VA.js";
558
566
  import {
559
567
  endToolExecutionSpan,
560
568
  endToolSpan,
@@ -563,21 +571,21 @@ import {
563
571
  startToolExecutionSpan,
564
572
  startToolSpan,
565
573
  withInteractionSpan
566
- } from "./chunk-L2AFWWJE.js";
567
- import "./chunk-W4RQUHY3.js";
568
- import "./chunk-PDPFQ2FO.js";
574
+ } from "./chunk-E5BWLU5J.js";
575
+ import "./chunk-HHJLM3WQ.js";
576
+ import "./chunk-L2GTEEEU.js";
569
577
  import {
570
578
  Storage,
571
579
  createDebugLogger,
572
580
  getErrorMessage,
573
581
  getErrorStatus,
574
582
  isSubpath
575
- } from "./chunk-OIVKILPI.js";
583
+ } from "./chunk-MPBRV3UU.js";
576
584
  import "./chunk-VOQXFAY5.js";
577
- import "./chunk-AJ6LQ5A6.js";
585
+ import "./chunk-M3QYOPGN.js";
578
586
  import {
579
587
  runExitCleanup
580
- } from "./chunk-6WIKTX4C.js";
588
+ } from "./chunk-ABGS4FDQ.js";
581
589
  import {
582
590
  writeStderrLine,
583
591
  writeStderrLineSafe
@@ -1424,6 +1432,86 @@ function prefixMidTurnUserMessageParts(parts, displayText) {
1424
1432
  }
1425
1433
  __name(prefixMidTurnUserMessageParts, "prefixMidTurnUserMessageParts");
1426
1434
 
1435
+ // packages/cli/src/ui/utils/restoreGoal.ts
1436
+ init_esbuild_shims();
1437
+ function findGoalToRestore(history) {
1438
+ for (let i = history.length - 1; i >= 0; i--) {
1439
+ const item = history[i];
1440
+ if (item?.type !== "goal_status" /* GOAL_STATUS */) continue;
1441
+ const goal = item;
1442
+ if (goal.kind !== "set" && goal.kind !== "checking") return null;
1443
+ const setAt = goal.setAt ?? findSetAtOfRun(history, i);
1444
+ return {
1445
+ condition: goal.condition,
1446
+ iterations: goal.iterations ?? 0,
1447
+ ...setAt !== void 0 ? { setAt } : {}
1448
+ };
1449
+ }
1450
+ return null;
1451
+ }
1452
+ __name(findGoalToRestore, "findGoalToRestore");
1453
+ function findSetAtOfRun(history, startIndex) {
1454
+ const start = history[startIndex];
1455
+ const condition = start?.condition;
1456
+ for (let i = startIndex - 1; i >= 0; i--) {
1457
+ const item = history[i];
1458
+ if (item?.type !== "goal_status" /* GOAL_STATUS */) continue;
1459
+ const goal = item;
1460
+ if (goal.kind !== "set" && goal.kind !== "checking") return void 0;
1461
+ if (goal.condition !== condition) return void 0;
1462
+ if (goal.setAt !== void 0) return goal.setAt;
1463
+ }
1464
+ return void 0;
1465
+ }
1466
+ __name(findSetAtOfRun, "findSetAtOfRun");
1467
+ function finiteNumber(value) {
1468
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
1469
+ }
1470
+ __name(finiteNumber, "finiteNumber");
1471
+ function isTranscriptItemRecord(item) {
1472
+ return typeof item === "object" && item !== null && !Array.isArray(item);
1473
+ }
1474
+ __name(isTranscriptItemRecord, "isTranscriptItemRecord");
1475
+ function parseGoalStatusItem(item) {
1476
+ if (!isTranscriptItemRecord(item)) return null;
1477
+ if (item["type"] !== "goal_status" /* GOAL_STATUS */) return null;
1478
+ const kind = item["kind"];
1479
+ const condition = item["condition"];
1480
+ if (!isGoalStatusKind(kind) || typeof condition !== "string") return null;
1481
+ const iterations = finiteNumber(item["iterations"]);
1482
+ const setAt = finiteNumber(item["setAt"]);
1483
+ const durationMs = finiteNumber(item["durationMs"]);
1484
+ const lastReason = typeof item["lastReason"] === "string" ? item["lastReason"] : void 0;
1485
+ return {
1486
+ type: "goal_status" /* GOAL_STATUS */,
1487
+ kind,
1488
+ condition,
1489
+ ...iterations !== void 0 ? { iterations } : {},
1490
+ ...setAt !== void 0 ? { setAt } : {},
1491
+ ...durationMs !== void 0 ? { durationMs } : {},
1492
+ ...lastReason !== void 0 ? { lastReason } : {}
1493
+ };
1494
+ }
1495
+ __name(parseGoalStatusItem, "parseGoalStatusItem");
1496
+ function collectGoalStatusItemsFromRecords(records) {
1497
+ const items = [];
1498
+ for (const record of records) {
1499
+ if (record.type !== "system" || record.subtype !== "slash_command") {
1500
+ continue;
1501
+ }
1502
+ const payload = record.systemPayload;
1503
+ if (payload?.phase !== "result") continue;
1504
+ const raws = payload.outputHistoryItems;
1505
+ if (!Array.isArray(raws)) continue;
1506
+ for (const raw of raws) {
1507
+ const item = parseGoalStatusItem(raw);
1508
+ if (item) items.push(item);
1509
+ }
1510
+ }
1511
+ return items;
1512
+ }
1513
+ __name(collectGoalStatusItemsFromRecords, "collectGoalStatusItemsFromRecords");
1514
+
1427
1515
  // packages/cli/src/acp-integration/session/tool-call-preparation-tracker.ts
1428
1516
  init_esbuild_shims();
1429
1517
  var ToolCallPreparationTracker = class {
@@ -1497,6 +1585,205 @@ var ToolCallPreparationTracker = class {
1497
1585
  }
1498
1586
  };
1499
1587
 
1588
+ // packages/cli/src/acp-integration/session/emitters/MessageEmitter.ts
1589
+ init_esbuild_shims();
1590
+ function buildGoalStatusUpdate(status) {
1591
+ return {
1592
+ sessionUpdate: "agent_message_chunk",
1593
+ content: { type: "text", text: "" },
1594
+ _meta: {
1595
+ goalStatus: status
1596
+ }
1597
+ };
1598
+ }
1599
+ __name(buildGoalStatusUpdate, "buildGoalStatusUpdate");
1600
+ function buildGoalStateUpdate(snapshot, cause, previousGoal = null) {
1601
+ const projection = cause ? projectGoalStateToLegacy({ v: 2, cause, snapshot }, previousGoal) : void 0;
1602
+ const goalStatus = projection ? (() => {
1603
+ const { type: _type, ...status } = projection.goalStatus;
1604
+ return status;
1605
+ })() : void 0;
1606
+ return {
1607
+ sessionUpdate: "agent_message_chunk",
1608
+ content: { type: "text", text: "" },
1609
+ _meta: {
1610
+ goalState: snapshot,
1611
+ ...goalStatus ? { goalStatus } : {},
1612
+ ...projection?.goalTerminal ? { goalTerminal: projection.goalTerminal } : {}
1613
+ }
1614
+ };
1615
+ }
1616
+ __name(buildGoalStateUpdate, "buildGoalStateUpdate");
1617
+ var MessageEmitter = class extends BaseEmitter {
1618
+ static {
1619
+ __name(this, "MessageEmitter");
1620
+ }
1621
+ /**
1622
+ * Emits a StopHookLoop event when Stop hooks create a loop.
1623
+ * This informs the client that Stop hooks have been executed multiple times.
1624
+ *
1625
+ * @param iterationCount - The current iteration count
1626
+ * @param reasons - Array of reasons from each Stop hook execution
1627
+ * @param stopHookCount - Number of Stop hooks that were executed
1628
+ */
1629
+ async emitStopHookLoop(iterationCount, reasons, stopHookCount) {
1630
+ const activeGoal = getActiveGoal(this.sessionId);
1631
+ await this.sendUpdate({
1632
+ sessionUpdate: "agent_message_chunk",
1633
+ content: { type: "text", text: "" },
1634
+ _meta: {
1635
+ stopHookLoop: {
1636
+ iterationCount,
1637
+ reasons,
1638
+ stopHookCount,
1639
+ ...activeGoal ? {
1640
+ goal: {
1641
+ condition: activeGoal.condition,
1642
+ iterations: activeGoal.iterations,
1643
+ setAt: activeGoal.setAt,
1644
+ lastReason: activeGoal.lastReason
1645
+ }
1646
+ } : {}
1647
+ }
1648
+ }
1649
+ });
1650
+ }
1651
+ async emitGoalStatus(status) {
1652
+ await this.sendUpdate(buildGoalStatusUpdate(status));
1653
+ }
1654
+ async emitGoalState(snapshot, cause, previousGoal = null) {
1655
+ await this.sendUpdate(buildGoalStateUpdate(snapshot, cause, previousGoal));
1656
+ }
1657
+ /**
1658
+ * Emits a user message chunk.
1659
+ *
1660
+ * @param text - The user message text content
1661
+ * @param timestamp - Optional server-side timestamp (ISO string or ms) for message ordering
1662
+ */
1663
+ async emitUserMessage(text, timestamp, options = {}) {
1664
+ await this.sendUpdate(
1665
+ createTranscriptMessageUpdate({
1666
+ role: "user",
1667
+ text,
1668
+ timestamp,
1669
+ ...options.source ? { extra: { source: options.source } } : {}
1670
+ })
1671
+ );
1672
+ }
1673
+ /**
1674
+ * Emits an agent thought chunk.
1675
+ *
1676
+ * @param text - The thought text content
1677
+ * @param timestamp - Optional server-side timestamp (ISO string or ms) for message ordering
1678
+ */
1679
+ async emitAgentThought(text, timestamp, subagentMeta) {
1680
+ await this.sendUpdate(
1681
+ createTranscriptMessageUpdate({
1682
+ role: "assistant",
1683
+ thought: true,
1684
+ text,
1685
+ timestamp,
1686
+ ...subagentMeta ? { extra: { ...subagentMeta } } : {}
1687
+ })
1688
+ );
1689
+ }
1690
+ /**
1691
+ * Emits an agent message chunk.
1692
+ *
1693
+ * @param text - The agent message text content
1694
+ * @param timestamp - Optional server-side timestamp (ISO string or ms) for message ordering
1695
+ */
1696
+ async emitAgentMessage(text, timestamp, subagentMeta) {
1697
+ await this.sendUpdate(
1698
+ createTranscriptMessageUpdate({
1699
+ role: "assistant",
1700
+ text,
1701
+ timestamp,
1702
+ ...subagentMeta ? { extra: { ...subagentMeta } } : {}
1703
+ })
1704
+ );
1705
+ }
1706
+ async emitSlashCommandOutput(text, timestamp) {
1707
+ const epochMs = BaseEmitter.toEpochMs(timestamp);
1708
+ await this.sendUpdate({
1709
+ sessionUpdate: "agent_message_chunk",
1710
+ content: { type: "text", text },
1711
+ _meta: {
1712
+ source: "slash_command",
1713
+ ...epochMs != null ? { timestamp: epochMs } : {}
1714
+ }
1715
+ });
1716
+ }
1717
+ /**
1718
+ * Emits usage metadata.
1719
+ */
1720
+ async emitUsageMetadata(usageMetadata, text = "", durationMs, subagentMeta) {
1721
+ const cumulative = this.ctx.cumulativeUsage;
1722
+ if (cumulative) {
1723
+ const addFinite = /* @__PURE__ */ __name((total, value) => typeof value === "number" && Number.isFinite(value) ? total + value : total, "addFinite");
1724
+ cumulative.promptTokens = addFinite(
1725
+ cumulative.promptTokens,
1726
+ usageMetadata.promptTokenCount
1727
+ );
1728
+ cumulative.candidateTokens = addFinite(
1729
+ cumulative.candidateTokens,
1730
+ usageMetadata.candidatesTokenCount
1731
+ );
1732
+ cumulative.cachedTokens = addFinite(
1733
+ cumulative.cachedTokens,
1734
+ usageMetadata.cachedContentTokenCount
1735
+ );
1736
+ cumulative.apiTimeMs = addFinite(cumulative.apiTimeMs, durationMs);
1737
+ }
1738
+ let activityMeta = {};
1739
+ if (typeof durationMs === "number") {
1740
+ const activity = apiActivityTracker.drain();
1741
+ activityMeta = {
1742
+ ...activity.errors > 0 ? { apiErrors: activity.errors } : {},
1743
+ ...activity.retries > 0 ? { apiRetries: activity.retries } : {}
1744
+ };
1745
+ }
1746
+ await this.sendUpdate(
1747
+ createTranscriptUsageUpdate(usageMetadata, {
1748
+ text,
1749
+ extra: {
1750
+ ...typeof durationMs === "number" ? { durationMs } : {},
1751
+ ...activityMeta,
1752
+ ...subagentMeta
1753
+ }
1754
+ })
1755
+ );
1756
+ if (!Number.isFinite(durationMs) || subagentMeta || !hasFullSessionContext(this.ctx)) {
1757
+ return;
1758
+ }
1759
+ const used = usageMetadata.promptTokenCount ?? usageMetadata.totalTokenCount;
1760
+ const size = this.ctx.config.getContentGeneratorConfig()?.contextWindowSize;
1761
+ if (typeof used !== "number" || !Number.isSafeInteger(used) || used < 0 || typeof size !== "number" || !Number.isSafeInteger(size) || size <= 0) {
1762
+ return;
1763
+ }
1764
+ await this.sendUpdate({
1765
+ sessionUpdate: "usage_update",
1766
+ used,
1767
+ size
1768
+ });
1769
+ }
1770
+ /**
1771
+ * Emits a message chunk based on role and thought flag.
1772
+ * This is the unified method that handles all message types.
1773
+ *
1774
+ * @param text - The message text content
1775
+ * @param role - Whether this is a user or assistant message
1776
+ * @param isThought - Whether this is an assistant thought (only applies to assistant role)
1777
+ * @param timestamp - Optional server-side timestamp (ISO string or ms) for message ordering
1778
+ */
1779
+ async emitMessage(text, role, isThought = false, timestamp, subagentMeta) {
1780
+ if (role === "user") {
1781
+ return this.emitUserMessage(text, timestamp);
1782
+ }
1783
+ return isThought ? this.emitAgentThought(text, timestamp, subagentMeta) : this.emitAgentMessage(text, timestamp, subagentMeta);
1784
+ }
1785
+ };
1786
+
1500
1787
  // packages/cli/src/acp-integration/session/SubAgentTracker.ts
1501
1788
  init_esbuild_shims();
1502
1789
 
@@ -2678,6 +2965,7 @@ __name(reduceRepeatedToolFailureGuard, "reduceRepeatedToolFailureGuard");
2678
2965
  var debugLogger6 = createDebugLogger("SESSION");
2679
2966
  var permissionRequestTails = /* @__PURE__ */ new WeakMap();
2680
2967
  var USER_CANCEL_ABORT_REASON = "qwen:user-cancel";
2968
+ var NEW_PROMPT_ABORT_REASON = "qwen:new-prompt";
2681
2969
  var SESSION_DISPOSE_ABORT_REASON = "qwen:session-dispose";
2682
2970
  var DAEMON_RETRY_META_KEY = "qwen.daemon.retry";
2683
2971
  var DAEMON_CONTINUE_META_KEY = "qwen.daemon.continueLastTurn";
@@ -2725,6 +3013,61 @@ function getAbortAwareEndTurnStopReason(signal) {
2725
3013
  return signal.aborted ? "cancelled" : "end_turn";
2726
3014
  }
2727
3015
  __name(getAbortAwareEndTurnStopReason, "getAbortAwareEndTurnStopReason");
3016
+ function sameGoalPermit(left, right) {
3017
+ return left?.goalId === right.goalId && left.revision === right.revision && left.turnId === right.turnId;
3018
+ }
3019
+ __name(sameGoalPermit, "sameGoalPermit");
3020
+ function buildGoalContinuationParts(turn) {
3021
+ return [
3022
+ {
3023
+ text: [
3024
+ "Continue working on the active Goal.",
3025
+ "Use get_goal for the authoritative objective and evidence state.",
3026
+ "Follow the objective's requested output format exactly. Do not add progress, status, or completion commentary unless the objective asks for it.",
3027
+ "If completion depends on content delivered in this turn, deliver only that content and call get_goal in the same response before update_goal.",
3028
+ `Runtime continuation context: ${turn.continuationContext}`,
3029
+ ...turn.verifierFeedback ? [`Verifier feedback: ${turn.verifierFeedback}`] : []
3030
+ ].join("\n")
3031
+ }
3032
+ ];
3033
+ }
3034
+ __name(buildGoalContinuationParts, "buildGoalContinuationParts");
3035
+ async function claimGoalTurn(runtime, turnKey, signal) {
3036
+ if (signal.aborted) return void 0;
3037
+ const immediate = runtime.permitForTurn(turnKey) ?? runtime.beginTurn(turnKey);
3038
+ if (immediate || runtime.getSnapshot().goal?.status !== "active") {
3039
+ return immediate;
3040
+ }
3041
+ return new Promise((resolve6, reject) => {
3042
+ let settled = false;
3043
+ let unsubscribe = /* @__PURE__ */ __name(() => {
3044
+ }, "unsubscribe");
3045
+ const finish = /* @__PURE__ */ __name((permit, error) => {
3046
+ if (settled) return;
3047
+ settled = true;
3048
+ unsubscribe();
3049
+ signal.removeEventListener("abort", onAbort);
3050
+ if (error !== void 0) reject(error);
3051
+ else resolve6(permit);
3052
+ }, "finish");
3053
+ const inspect = /* @__PURE__ */ __name(() => {
3054
+ try {
3055
+ const permit = runtime.permitForTurn(turnKey);
3056
+ if (permit || runtime.getSnapshot().goal?.status !== "active") {
3057
+ finish(permit);
3058
+ }
3059
+ } catch (error) {
3060
+ finish(void 0, error);
3061
+ }
3062
+ }, "inspect");
3063
+ const onAbort = /* @__PURE__ */ __name(() => finish(void 0), "onAbort");
3064
+ unsubscribe = runtime.subscribe(inspect);
3065
+ signal.addEventListener("abort", onAbort, { once: true });
3066
+ if (signal.aborted) onAbort();
3067
+ else inspect();
3068
+ });
3069
+ }
3070
+ __name(claimGoalTurn, "claimGoalTurn");
2728
3071
  var DAEMON_INVALID_TOOL_PARAMS_THRESHOLD = 3;
2729
3072
  var PERMISSION_CANCEL_SKIP_MESSAGE = "Skipped because a permission request was cancelled before the user answered; user input is required before continuing.";
2730
3073
  var LOOP_DETECTED_SKIP_MESSAGE = "Skipped because loop detection stopped the current turn before this tool call could run.";
@@ -3346,11 +3689,9 @@ var Session = class {
3346
3689
  this.todoStopGuardBackgroundBaseline = this.#captureTodoStopGuardBackgroundBaseline();
3347
3690
  this.toolCallEmitter = new ToolCallEmitter(this);
3348
3691
  this.planEmitter = new PlanEmitter(this);
3349
- this.historyReplayer = new HistoryReplayer(this, {
3350
- supersedeUnrestorableGoal: true
3351
- });
3692
+ this.historyReplayer = new HistoryReplayer(this);
3352
3693
  this.messageEmitter = new MessageEmitter(this);
3353
- this.installGoalTerminalObserver();
3694
+ this.#bindGoalRuntime();
3354
3695
  this.#registerBackgroundNotificationCallbacks();
3355
3696
  this.#registerSubSessionSpawner();
3356
3697
  this.config.getWorkflowRunRegistry?.().setApprovalRequestCallback(
@@ -3438,6 +3779,14 @@ var Session = class {
3438
3779
  persistedBackgroundNotificationTaskIds = /* @__PURE__ */ new Set();
3439
3780
  backgroundNotificationAcceptances = /* @__PURE__ */ new Map();
3440
3781
  activeAgentNotificationAcceptances = /* @__PURE__ */ new Set();
3782
+ goalQueue = [];
3783
+ goalProcessing = false;
3784
+ activeGoalTurn;
3785
+ goalHostUnbind;
3786
+ goalRuntimeUnsubscribe;
3787
+ lastGoalSnapshot;
3788
+ lastGoalPublicationKey;
3789
+ goalPublicationTail = Promise.resolve();
3441
3790
  // Set true in dispose(). Guards #drainCronQueue and #drainNotificationQueue
3442
3791
  // against the race where #drainNotificationQueue's finally block kicks off
3443
3792
  // #drainCronQueue after the session has already been disposed (e.g. /clear
@@ -3483,6 +3832,311 @@ var Session = class {
3483
3832
  pendingRecoveredAgentsNotice = null;
3484
3833
  // Implement SessionContext interface
3485
3834
  sessionId;
3835
+ #bindGoalRuntime() {
3836
+ try {
3837
+ const runtime = this.config.getGoalRuntime();
3838
+ this.lastGoalSnapshot = runtime.getSnapshot();
3839
+ this.goalRuntimeUnsubscribe = runtime.subscribe((snapshot, cause) => {
3840
+ const previousGoal = this.lastGoalSnapshot?.goal ?? null;
3841
+ this.lastGoalSnapshot = snapshot;
3842
+ void this.#queueGoalState(snapshot, cause, previousGoal).catch(
3843
+ (error) => debugLogger6.warn(
3844
+ `Failed to emit ACP Goal state: ${error instanceof Error ? error.message : String(error)}`
3845
+ )
3846
+ );
3847
+ });
3848
+ const host = {
3849
+ startGoalTurn: /* @__PURE__ */ __name(async (input) => {
3850
+ if (this.goalQueue.some(
3851
+ ({ permit }) => permit.turnId === input.permit.turnId
3852
+ ) || this.activeGoalTurn?.permit.turnId === input.permit.turnId) {
3853
+ return;
3854
+ }
3855
+ this.goalQueue.push({
3856
+ permit: { ...input.permit },
3857
+ turnKey: `goal-runtime:${input.permit.turnId}`,
3858
+ controller: new AbortController(),
3859
+ origin: "runtime",
3860
+ continuationContext: input.continuationContext,
3861
+ ...input.verifierFeedback ? { verifierFeedback: input.verifierFeedback } : {},
3862
+ modelStarted: false
3863
+ });
3864
+ void this.#drainGoalQueue();
3865
+ }, "startGoalTurn"),
3866
+ preemptGoalTurn: /* @__PURE__ */ __name((reason) => {
3867
+ for (const turn of this.goalQueue.splice(0)) {
3868
+ turn.controller.abort(reason);
3869
+ }
3870
+ this.activeGoalTurn?.controller.abort(reason);
3871
+ }, "preemptGoalTurn")
3872
+ };
3873
+ this.goalHostUnbind = this.config.bindGoalTurnHost(host);
3874
+ } catch (error) {
3875
+ if (!(error instanceof GoalPersistenceUnavailableError)) {
3876
+ throw error;
3877
+ }
3878
+ debugLogger6.debug("Canonical Goal runtime is unavailable for ACP");
3879
+ }
3880
+ }
3881
+ /**
3882
+ * Re-attach this session to the Goal runtime after `/clear`.
3883
+ *
3884
+ * `Config.startNewSession()` disposes the old runtime and builds a fresh
3885
+ * one, so the `subscribe` callback installed by `#bindGoalRuntime` — the
3886
+ * only path that reaches `MessageEmitter.emitGoalState` — would stay
3887
+ * registered on the abandoned instance and the client would never receive
3888
+ * another `_meta.goalState` update. The retained turn host survives the
3889
+ * switch, but the subscription and the publication de-duplication state
3890
+ * belong to the old runtime and have to be rebuilt.
3891
+ */
3892
+ rebindGoalRuntimeForNewSession() {
3893
+ if (this.disposed || this.closing) return;
3894
+ this.goalRuntimeUnsubscribe?.();
3895
+ this.goalRuntimeUnsubscribe = void 0;
3896
+ this.goalHostUnbind?.();
3897
+ this.goalHostUnbind = void 0;
3898
+ this.lastGoalSnapshot = void 0;
3899
+ this.lastGoalPublicationKey = void 0;
3900
+ this.#bindGoalRuntime();
3901
+ }
3902
+ /**
3903
+ * Publish the recovered Goal state once, after history replay.
3904
+ *
3905
+ * Goal recovery runs from the `Config` constructor, long before this
3906
+ * Session exists, so `restore()`'s correction broadcast reaches zero
3907
+ * listeners — and replay streams the pre-migration records, emitting the
3908
+ * legacy `set` card. Clients that derive the live goal from goal cards
3909
+ * (both web-shell and the daemon provider do) are therefore left showing a
3910
+ * goal as running when the migrated goal is `paused` and nothing drives
3911
+ * it; only a second reload self-corrected. Republishing here puts the
3912
+ * authoritative state *after* the replayed card, which is the ordering
3913
+ * that matters. `#publishGoalState` de-duplicates on `(cause, snapshot)`,
3914
+ * so this is a no-op when the subscription already delivered it.
3915
+ *
3916
+ * When recovery failed outright — a malformed or future-schema
3917
+ * `goal_state` record makes `recoverGoalFromRecords` return `unsupported`
3918
+ * — there is no state to publish and no in-session command can correct the
3919
+ * stream, because a degraded `/goal` answers without a cause. That case
3920
+ * gets the same trailing `cleared` card the replay-time
3921
+ * `supersedeUnrestorableGoal` used to emit.
3922
+ */
3923
+ async publishRecoveredGoalState(replayedRecords) {
3924
+ if (this.disposed || this.closing) return;
3925
+ let runtime;
3926
+ try {
3927
+ runtime = await this.config.getGoalRuntimeReady();
3928
+ } catch (error) {
3929
+ if (!(error instanceof GoalPersistenceUnavailableError)) throw error;
3930
+ await this.#supersedeUnrestorableGoal(replayedRecords);
3931
+ return;
3932
+ }
3933
+ const cause = runtime.getRecoveryCause?.();
3934
+ if (!cause) return;
3935
+ await this.#queueGoalState(runtime.getSnapshot(), cause);
3936
+ }
3937
+ /**
3938
+ * Render the recovered-Goal cards instead of streaming them.
3939
+ *
3940
+ * The bulk load-replay path (`historyReplay: 'response'`) does not stream
3941
+ * its replay: `loadSession` collects the page into the `LOAD_REPLAY`
3942
+ * envelope and the bridge seeds those updates onto the session's event bus
3943
+ * *after* the ACP `session/load` call returns. A card streamed from inside
3944
+ * that call therefore lands on the bus **before** the replayed
3945
+ * pre-migration `set` card — the reverse of the ordering
3946
+ * {@link publishRecoveredGoalState} exists to produce, leaving the phantom
3947
+ * running goal exactly as it was. Returning the cards lets the caller
3948
+ * append them to the envelope, after the replay page.
3949
+ *
3950
+ * Appending after a truncated page (`hasMore`) is still correct: paging
3951
+ * drops the oldest records, so the authoritative state belongs last either
3952
+ * way.
3953
+ *
3954
+ * Marks the publication as delivered, so the runtime subscription cannot
3955
+ * emit a duplicate card for the same `(cause, snapshot)` once the session
3956
+ * goes live.
3957
+ */
3958
+ async renderRecoveredGoalUpdates(replayedRecords) {
3959
+ if (this.disposed || this.closing) return [];
3960
+ let runtime;
3961
+ try {
3962
+ runtime = await this.config.getGoalRuntimeReady();
3963
+ } catch (error) {
3964
+ if (!(error instanceof GoalPersistenceUnavailableError)) throw error;
3965
+ const status = this.#unrestorableGoalStatus(replayedRecords);
3966
+ return status ? [buildGoalStatusUpdate(status)] : [];
3967
+ }
3968
+ const cause = runtime.getRecoveryCause?.();
3969
+ if (!cause) return [];
3970
+ const snapshot = runtime.getSnapshot();
3971
+ const publicationKey = this.#goalPublicationKey(snapshot, cause);
3972
+ if (publicationKey === this.lastGoalPublicationKey) return [];
3973
+ this.lastGoalPublicationKey = publicationKey;
3974
+ return [
3975
+ buildGoalStateUpdate(
3976
+ snapshot,
3977
+ cause,
3978
+ this.lastGoalSnapshot?.goal ?? null
3979
+ )
3980
+ ];
3981
+ }
3982
+ /**
3983
+ * Emit a trailing `cleared` card for an active legacy goal the runtime
3984
+ * refused to recover.
3985
+ *
3986
+ * Emitted, not recorded: the transcript keeps its `set` card, so a later
3987
+ * resume that can recover the goal still finds it.
3988
+ */
3989
+ async #supersedeUnrestorableGoal(replayedRecords) {
3990
+ const status = this.#unrestorableGoalStatus(replayedRecords);
3991
+ if (!status) return;
3992
+ await this.messageEmitter.emitGoalStatus(status);
3993
+ }
3994
+ /**
3995
+ * The `cleared` card for an active legacy goal the runtime refused to
3996
+ * recover, or `undefined` when there is nothing to supersede. Shared by the
3997
+ * streaming and rendering recovery paths so they cannot drift.
3998
+ */
3999
+ #unrestorableGoalStatus(replayedRecords) {
4000
+ if (!replayedRecords?.length) return void 0;
4001
+ const active = findGoalToRestore(
4002
+ collectGoalStatusItemsFromRecords(replayedRecords)
4003
+ );
4004
+ if (!active) return void 0;
4005
+ return {
4006
+ kind: "cleared",
4007
+ condition: active.condition,
4008
+ iterations: active.iterations,
4009
+ ...active.setAt !== void 0 ? { setAt: active.setAt } : {},
4010
+ lastReason: "Goal not restored: its saved state could not be read, so this session is not driving it."
4011
+ };
4012
+ }
4013
+ #goalPublicationKey(snapshot, cause) {
4014
+ return cause ? `${cause}:${JSON.stringify(snapshot)}` : void 0;
4015
+ }
4016
+ async #publishGoalState(snapshot, cause, previousGoal = this.lastGoalSnapshot?.goal ?? null) {
4017
+ const publicationKey = this.#goalPublicationKey(snapshot, cause);
4018
+ if (publicationKey && publicationKey === this.lastGoalPublicationKey) {
4019
+ return;
4020
+ }
4021
+ if (publicationKey) this.lastGoalPublicationKey = publicationKey;
4022
+ await this.messageEmitter.emitGoalState(snapshot, cause, previousGoal);
4023
+ }
4024
+ #queueGoalState(snapshot, cause, previousGoal = this.lastGoalSnapshot?.goal ?? null) {
4025
+ const publication = this.goalPublicationTail.then(
4026
+ () => this.#publishGoalState(snapshot, cause, previousGoal)
4027
+ );
4028
+ this.goalPublicationTail = publication.catch(() => void 0);
4029
+ return publication;
4030
+ }
4031
+ async #drainGoalQueue() {
4032
+ if (this.disposed || this.closing || this.goalProcessing || this.pendingPrompt || this.pendingPromptCompletion || this.cronProcessing || this.cronAbortController || this.notificationProcessing || this.notificationAbortController) {
4033
+ return;
4034
+ }
4035
+ const turn = this.goalQueue.shift();
4036
+ if (!turn) return;
4037
+ this.goalProcessing = true;
4038
+ this.activeGoalTurn = turn;
4039
+ const parts = buildGoalContinuationParts(turn);
4040
+ try {
4041
+ await this.prompt(
4042
+ {
4043
+ sessionId: this.sessionId,
4044
+ prompt: parts.map((part) => ({
4045
+ type: "text",
4046
+ text: part.text ?? ""
4047
+ }))
4048
+ },
4049
+ void 0,
4050
+ void 0,
4051
+ void 0,
4052
+ turn
4053
+ );
4054
+ } catch (error) {
4055
+ await this.#settleGoalTurn(turn, void 0, true);
4056
+ debugLogger6.warn(
4057
+ `ACP Goal turn failed: ${error instanceof Error ? error.message : String(error)}`
4058
+ );
4059
+ } finally {
4060
+ if (this.activeGoalTurn === turn) this.activeGoalTurn = void 0;
4061
+ this.goalProcessing = false;
4062
+ void this.#drainCronQueue();
4063
+ void this.#drainNotificationQueue();
4064
+ void this.#drainGoalQueue();
4065
+ }
4066
+ }
4067
+ async #settleGoalTurn(turn, result, failed) {
4068
+ try {
4069
+ const runtime = await this.config.getGoalRuntimeReady();
4070
+ if (!sameGoalPermit(runtime.permitForTurn(turn.turnKey), turn.permit)) {
4071
+ return;
4072
+ }
4073
+ if (!turn.modelStarted) {
4074
+ if (turn.controller.signal.reason === USER_CANCEL_ABORT_REASON && runtime.getSnapshot().goal?.status === "active") {
4075
+ await runtime.dispatch({
4076
+ action: "pause",
4077
+ expectedGoalId: turn.permit.goalId,
4078
+ expectedRevision: turn.permit.revision
4079
+ });
4080
+ } else {
4081
+ await runtime.releaseTurn(turn.turnKey);
4082
+ }
4083
+ return;
4084
+ }
4085
+ try {
4086
+ await this.config.getChatRecordingService()?.flush();
4087
+ } catch (error) {
4088
+ debugLogger6.warn(
4089
+ `Failed to flush ACP Goal turn: ${error instanceof Error ? error.message : String(error)}`
4090
+ );
4091
+ }
4092
+ const cancelledByUser = result?.stopReason === "cancelled" && turn.controller.signal.reason === USER_CANCEL_ABORT_REASON;
4093
+ const supersededByNewPrompt = turn.controller.signal.reason === NEW_PROMPT_ABORT_REASON;
4094
+ const shouldPause = !supersededByNewPrompt && (failed || result?.stopReason === "max_tokens" || cancelledByUser || turn.controller.signal.reason === SESSION_DISPOSE_ABORT_REASON);
4095
+ try {
4096
+ if (shouldPause && runtime.getSnapshot().goal?.status === "active") {
4097
+ await runtime.dispatch({
4098
+ action: "pause",
4099
+ expectedGoalId: turn.permit.goalId,
4100
+ expectedRevision: turn.permit.revision
4101
+ });
4102
+ return;
4103
+ }
4104
+ await runtime.finishTurn(turn.permit);
4105
+ } catch (error) {
4106
+ debugLogger6.warn(
4107
+ `Failed to record ACP Goal turn settlement: ${error instanceof Error ? error.message : String(error)}`
4108
+ );
4109
+ await runtime.releaseTurn(turn.turnKey);
4110
+ }
4111
+ } catch (error) {
4112
+ debugLogger6.warn(
4113
+ `Failed to settle ACP Goal turn: ${error instanceof Error ? error.message : String(error)}`
4114
+ );
4115
+ }
4116
+ }
4117
+ /**
4118
+ * Stops an autonomous Goal loop when the Stop-hook blocking cap fires.
4119
+ *
4120
+ * `abortGoalForStopHookCap` only knows about the legacy `activeGoalStore`,
4121
+ * which no longer has a writer for daemon sessions, so ACP needs the
4122
+ * canonical runtime acted on directly.
4123
+ */
4124
+ async #pauseGoalForStopHookCap() {
4125
+ try {
4126
+ const runtime = await this.config.getGoalRuntimeReady();
4127
+ const goal = runtime.getSnapshot().goal;
4128
+ if (goal?.status !== "active") return;
4129
+ await runtime.dispatch({
4130
+ action: "pause",
4131
+ expectedGoalId: goal.goalId,
4132
+ expectedRevision: goal.revision
4133
+ });
4134
+ } catch (error) {
4135
+ debugLogger6.warn(
4136
+ `Failed to pause the Goal after the Stop hook cap: ${error instanceof Error ? error.message : String(error)}`
4137
+ );
4138
+ }
4139
+ }
3486
4140
  async #requestWorkflowApproval(runId, approval, rawArgs, approvalSignal) {
3487
4141
  const registry = this.config.getWorkflowRunRegistry();
3488
4142
  const externalToolCallId = `workflow:${this.sessionId}:${runId}:${approval.approvalId}`;
@@ -4136,7 +4790,7 @@ var Session = class {
4136
4790
  }
4137
4791
  #hasActiveTurn() {
4138
4792
  return Boolean(
4139
- this.pendingPrompt || this.pendingPromptCompletion || this.cronProcessing || this.cronAbortController || this.cronCompletion || this.notificationProcessing || this.notificationAbortController || this.notificationCompletion
4793
+ this.pendingPrompt || this.pendingPromptCompletion || this.goalProcessing || this.cronProcessing || this.cronAbortController || this.cronCompletion || this.notificationProcessing || this.notificationAbortController || this.notificationCompletion
4140
4794
  );
4141
4795
  }
4142
4796
  beginClose() {
@@ -4164,6 +4818,7 @@ var Session = class {
4164
4818
  resolveGate();
4165
4819
  if (this.disposed) return;
4166
4820
  this.closing = false;
4821
+ void this.#drainGoalQueue();
4167
4822
  void this.#drainCronQueue();
4168
4823
  void this.#drainNotificationQueue();
4169
4824
  };
@@ -4227,6 +4882,14 @@ var Session = class {
4227
4882
  this.hardSuspendTodoStopGuard();
4228
4883
  this.notificationQueue = [];
4229
4884
  this.cronQueue = [];
4885
+ for (const turn of this.goalQueue.splice(0)) {
4886
+ turn.controller.abort(SESSION_DISPOSE_ABORT_REASON);
4887
+ }
4888
+ this.activeGoalTurn?.controller.abort(SESSION_DISPOSE_ABORT_REASON);
4889
+ this.goalHostUnbind?.();
4890
+ this.goalHostUnbind = void 0;
4891
+ this.goalRuntimeUnsubscribe?.();
4892
+ this.goalRuntimeUnsubscribe = void 0;
4230
4893
  this.notificationAbortController?.abort();
4231
4894
  this.notificationAbortController = null;
4232
4895
  this.notificationProcessing = false;
@@ -4254,7 +4917,6 @@ var Session = class {
4254
4917
  this.config.setSubSessionSpawner(void 0);
4255
4918
  this.config.getWorkflowRunRegistry?.().setApprovalRequestCallback(void 0);
4256
4919
  this.workflowApprovalAbortController.abort(SESSION_DISPOSE_ABORT_REASON);
4257
- clearGoalTerminalObserver(this.sessionId);
4258
4920
  }
4259
4921
  /**
4260
4922
  * Install the message rewrite middleware if configured.
@@ -4271,43 +4933,6 @@ var Session = class {
4271
4933
  );
4272
4934
  }
4273
4935
  }
4274
- /**
4275
- * Installs (or replaces) this session's goal-terminal observer.
4276
- *
4277
- * Public because it does not stay installed: `registerGoalHook` and
4278
- * `unregisterGoalHook` both clear the observer table for the session, so any
4279
- * caller that (re-)registers a goal outside `#processSlashCommandResult` —
4280
- * notably goal restore on resume — has to put it back. Idempotent.
4281
- */
4282
- installGoalTerminalObserver() {
4283
- setGoalTerminalObserver(this.sessionId, (event) => {
4284
- void this.messageEmitter.emitGoalTerminal(event).catch((error) => {
4285
- debugLogger6.warn(
4286
- `Failed to emit goal terminal update: ${this.#formatError(error)}`
4287
- );
4288
- });
4289
- recordGoalStatusItem(this.config, goalTerminalEventToHistoryItem(event));
4290
- });
4291
- }
4292
- /**
4293
- * Emits a goal card and persists it to the transcript. Both `set` and
4294
- * `cleared` reach the client this way — from `#emitGoalStatusItems` for a
4295
- * `/goal` prompt, and from the `sessionGoalClear` ext method — so recording
4296
- * here (rather than at each call site) keeps the transcript in step with the
4297
- * hook. Replay goes through `messageEmitter.emitGoalStatus` directly and so
4298
- * does not re-record.
4299
- */
4300
- emitGoalStatus(status) {
4301
- void this.messageEmitter.emitGoalStatus(status).catch((error) => {
4302
- debugLogger6.warn(
4303
- `Failed to emit goal status update: ${this.#formatError(error)}`
4304
- );
4305
- });
4306
- recordGoalStatusItem(this.config, {
4307
- type: "goal_status" /* GOAL_STATUS */,
4308
- ...status
4309
- });
4310
- }
4311
4936
  /**
4312
4937
  * Replays conversation history to the client using modular components.
4313
4938
  * Delegates to HistoryReplayer for consistent event emission.
@@ -4446,11 +5071,13 @@ var Session = class {
4446
5071
  const hadPrompt = !!this.pendingPrompt;
4447
5072
  const hadCron = !!this.cronAbortController;
4448
5073
  const hadNotification = !!this.notificationAbortController || this.notificationProcessing;
5074
+ const queuedGoalTurns = this.goalQueue.splice(0);
5075
+ const hadQueuedGoalTurn = queuedGoalTurns.length > 0;
4449
5076
  if (this.followupAbort) {
4450
5077
  this.followupAbort.abort();
4451
5078
  this.followupAbort = null;
4452
5079
  }
4453
- if (!hadPrompt && !hadCron && !hadNotification) {
5080
+ if (!hadPrompt && !hadCron && !hadNotification && !hadQueuedGoalTurn) {
4454
5081
  throw new Error(NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE);
4455
5082
  }
4456
5083
  this.todoStopGuard.suspend();
@@ -4458,6 +5085,9 @@ var Session = class {
4458
5085
  this.pendingPrompt.abort(USER_CANCEL_ABORT_REASON);
4459
5086
  this.pendingPrompt = null;
4460
5087
  }
5088
+ for (const turn of queuedGoalTurns) {
5089
+ turn.controller.abort(USER_CANCEL_ABORT_REASON);
5090
+ }
4461
5091
  if (this.cronAbortController) {
4462
5092
  this.cronAbortController.abort();
4463
5093
  this.cronAbortController = null;
@@ -4470,6 +5100,26 @@ var Session = class {
4470
5100
  }
4471
5101
  this.notificationQueue = [];
4472
5102
  this.notificationProcessing = false;
5103
+ const queuedGoalTurn = queuedGoalTurns[0];
5104
+ if (queuedGoalTurn) {
5105
+ try {
5106
+ const runtime = this.config.getGoalRuntime();
5107
+ if (sameGoalPermit(
5108
+ runtime.permitForTurn(queuedGoalTurn.turnKey),
5109
+ queuedGoalTurn.permit
5110
+ ) && runtime.getSnapshot().goal?.status === "active") {
5111
+ await runtime.dispatch({
5112
+ action: "pause",
5113
+ expectedGoalId: queuedGoalTurn.permit.goalId,
5114
+ expectedRevision: queuedGoalTurn.permit.revision
5115
+ });
5116
+ }
5117
+ } catch (error) {
5118
+ debugLogger6.warn(
5119
+ `Failed to pause queued ACP Goal turn: ${error instanceof Error ? error.message : String(error)}`
5120
+ );
5121
+ }
5122
+ }
4473
5123
  this.#activeWorkChanged();
4474
5124
  const scheduler = this.config.isCronEnabled() ? this.config.getCronScheduler() : null;
4475
5125
  if (scheduler) {
@@ -4480,7 +5130,7 @@ var Session = class {
4480
5130
  }
4481
5131
  }
4482
5132
  }
4483
- async prompt(params, invocationContext, admissionCancellation, modelPrompt) {
5133
+ async prompt(params, invocationContext, admissionCancellation, modelPrompt, scheduledGoalTurn) {
4484
5134
  if (this.closing) {
4485
5135
  throw RequestError.invalidParams(void 0, "Session is closing");
4486
5136
  }
@@ -4507,8 +5157,27 @@ var Session = class {
4507
5157
  return { stopReason: "cancelled" };
4508
5158
  }
4509
5159
  const todoStopGuardPreparation = this.#prepareTodoStopGuardForPrompt(params);
4510
- this.pendingPrompt?.abort();
4511
- const pendingSend = new AbortController();
5160
+ let goalTurn = scheduledGoalTurn;
5161
+ let reservedGoalRuntime;
5162
+ let reservedGoalTurnKey;
5163
+ if (!goalTurn) {
5164
+ try {
5165
+ const runtime = this.config.getGoalRuntime();
5166
+ if (runtime.getSnapshot().goal?.status === "active") {
5167
+ reservedGoalRuntime = runtime;
5168
+ reservedGoalTurnKey = `goal-user:${randomUUID()}`;
5169
+ runtime.beginTurn(reservedGoalTurnKey);
5170
+ for (const queued of this.goalQueue.splice(0)) {
5171
+ queued.controller.abort(NEW_PROMPT_ABORT_REASON);
5172
+ await runtime.releaseTurn(queued.turnKey);
5173
+ }
5174
+ }
5175
+ } catch (error) {
5176
+ if (!(error instanceof GoalPersistenceUnavailableError)) throw error;
5177
+ }
5178
+ }
5179
+ this.pendingPrompt?.abort(NEW_PROMPT_ABORT_REASON);
5180
+ const pendingSend = goalTurn?.controller ?? new AbortController();
4512
5181
  const cancelPendingSend = /* @__PURE__ */ __name(() => pendingSend.abort(USER_CANCEL_ABORT_REASON), "cancelPendingSend");
4513
5182
  if (admissionCancellation) {
4514
5183
  admissionCancellation.addEventListener("abort", cancelPendingSend, {
@@ -4558,7 +5227,46 @@ var Session = class {
4558
5227
  } catch {
4559
5228
  }
4560
5229
  }
5230
+ if (reservedGoalRuntime && reservedGoalTurnKey) {
5231
+ try {
5232
+ const permit = await claimGoalTurn(
5233
+ reservedGoalRuntime,
5234
+ reservedGoalTurnKey,
5235
+ pendingSend.signal
5236
+ );
5237
+ if (permit) {
5238
+ const goal = reservedGoalRuntime.getSnapshot().goal;
5239
+ if (goal) {
5240
+ const verifierFeedback = reservedGoalRuntime.getVerifierFeedback(permit);
5241
+ goalTurn = {
5242
+ permit,
5243
+ turnKey: reservedGoalTurnKey,
5244
+ controller: pendingSend,
5245
+ origin: "user",
5246
+ continuationContext: goal.objective,
5247
+ ...verifierFeedback ? { verifierFeedback } : {},
5248
+ modelStarted: false
5249
+ };
5250
+ }
5251
+ }
5252
+ } catch (error) {
5253
+ try {
5254
+ await reservedGoalRuntime.releaseTurn(reservedGoalTurnKey);
5255
+ } catch (releaseError) {
5256
+ debugLogger6.warn(
5257
+ `Failed to release Goal reservation after admission failure: ${releaseError instanceof Error ? releaseError.message : String(releaseError)}`
5258
+ );
5259
+ } finally {
5260
+ releasePendingSend();
5261
+ this.todoStopGuard.suspend();
5262
+ }
5263
+ throw error;
5264
+ }
5265
+ }
4561
5266
  if (pendingSend.signal.aborted) {
5267
+ if (reservedGoalRuntime && reservedGoalTurnKey) {
5268
+ await reservedGoalRuntime.releaseTurn(reservedGoalTurnKey);
5269
+ }
4562
5270
  releasePendingSend();
4563
5271
  this.todoStopGuard.suspend();
4564
5272
  return { stopReason: "cancelled" };
@@ -4575,14 +5283,18 @@ var Session = class {
4575
5283
  this.pendingPromptCompletion = new Promise((resolve6) => {
4576
5284
  resolveCompletion = resolve6;
4577
5285
  });
5286
+ let promptResult;
5287
+ let promptFailed = false;
4578
5288
  try {
4579
5289
  const result = await this.#executePrompt(
4580
5290
  params,
4581
5291
  pendingSend,
4582
5292
  channelDeliveryCapture,
4583
5293
  invocationContext,
4584
- modelPrompt
5294
+ modelPrompt,
5295
+ goalTurn
4585
5296
  );
5297
+ promptResult = result;
4586
5298
  releasePendingSend();
4587
5299
  void this.#drainCronQueue();
4588
5300
  void this.#drainNotificationQueue();
@@ -4601,6 +5313,7 @@ var Session = class {
4601
5313
  }
4602
5314
  return result;
4603
5315
  } catch (error) {
5316
+ promptFailed = true;
4604
5317
  if (error instanceof SessionWriterError) {
4605
5318
  throw new RequestError(error.rpcCode, error.message, {
4606
5319
  errorKind: error.errorKind
@@ -4618,9 +5331,15 @@ var Session = class {
4618
5331
  void this.#drainCronQueue();
4619
5332
  void this.#drainNotificationQueue();
4620
5333
  }
5334
+ if (goalTurn) {
5335
+ await this.#settleGoalTurn(goalTurn, promptResult, promptFailed);
5336
+ } else if (reservedGoalRuntime && reservedGoalTurnKey) {
5337
+ await reservedGoalRuntime.releaseTurn(reservedGoalTurnKey);
5338
+ }
4621
5339
  void this.#startCronSchedulerInRuntime();
4622
5340
  resolveCompletion();
4623
5341
  this.pendingPromptCompletion = null;
5342
+ void this.#drainGoalQueue();
4624
5343
  await this.#consumeLiveEndInstruction();
4625
5344
  }
4626
5345
  }
@@ -4742,7 +5461,7 @@ var Session = class {
4742
5461
  }
4743
5462
  })();
4744
5463
  }
4745
- async #executePrompt(params, pendingSend, channelDeliveryCapture, invocationContext, modelPrompt) {
5464
+ async #executePrompt(params, pendingSend, channelDeliveryCapture, invocationContext, modelPrompt, goalTurn) {
4746
5465
  const sessionId = this.config.getSessionId();
4747
5466
  if (invocationContext !== void 0 && invocationContext.sessionId !== sessionId) {
4748
5467
  throw RequestError.invalidParams(
@@ -4750,7 +5469,7 @@ var Session = class {
4750
5469
  "Invocation context session does not match the active session"
4751
5470
  );
4752
5471
  }
4753
- return runWithInvocationContext(
5472
+ const execute = /* @__PURE__ */ __name(() => runWithInvocationContext(
4754
5473
  invocationContext,
4755
5474
  () => sessionIdContext.run(
4756
5475
  sessionId,
@@ -4758,12 +5477,14 @@ var Session = class {
4758
5477
  params,
4759
5478
  pendingSend,
4760
5479
  channelDeliveryCapture,
4761
- modelPrompt
5480
+ modelPrompt,
5481
+ goalTurn
4762
5482
  )
4763
5483
  )
4764
- );
5484
+ ), "execute");
5485
+ return goalTurn ? goalTurnContext.run(goalTurn.permit, execute) : goalTurnContext.exit(execute);
4765
5486
  }
4766
- async #executePromptInner(params, pendingSend, channelDeliveryCapture, modelPrompt) {
5487
+ async #executePromptInner(params, pendingSend, channelDeliveryCapture, modelPrompt, goalTurn) {
4767
5488
  return Storage.runWithRuntimeBaseDir(
4768
5489
  this.runtimeBaseDir,
4769
5490
  this.config.getWorkingDir(),
@@ -4788,6 +5509,7 @@ var Session = class {
4788
5509
  },
4789
5510
  async () => {
4790
5511
  const promptText = params.prompt.filter((block) => block.type === "text").map((block) => block.type === "text" ? block.text : "").join(" ");
5512
+ const promptDisplayText = typeof promptMetadata?.[DAEMON_PROMPT_DISPLAY_TEXT_META_KEY] === "string" ? promptMetadata[DAEMON_PROMPT_DISPLAY_TEXT_META_KEY] : void 0;
4791
5513
  const modelPromptBlocks = modelPrompt === void 0 ? params.prompt : [{ type: "text", text: modelPrompt }];
4792
5514
  logUserPrompt(
4793
5515
  this.config,
@@ -4803,7 +5525,12 @@ var Session = class {
4803
5525
  let continuationParts = null;
4804
5526
  let strippedOrphanEntries = null;
4805
5527
  let orphanPushCountSnapshot = 0;
4806
- if (isContinue) {
5528
+ if (goalTurn?.origin === "runtime") {
5529
+ this.config.getChatRecordingService()?.recordGoalRuntimeMessage(
5530
+ modelPromptBlocks.filter((block) => block.type === "text").map((block) => ({ text: block.text })),
5531
+ goalTurn.permit
5532
+ );
5533
+ } else if (isContinue) {
4807
5534
  const recoveryPlan = buildSessionRecoveryPlanFromApiHistory({
4808
5535
  sessionId: this.sessionId,
4809
5536
  apiHistory: this.#getCurrentChat().getHistory()
@@ -4829,11 +5556,22 @@ var Session = class {
4829
5556
  continuationParts = recoveryPlan.continuation.parts;
4830
5557
  }
4831
5558
  }
4832
- if (isContinue) {
5559
+ if (goalTurn?.origin === "runtime") {
5560
+ } else if (isContinue) {
4833
5561
  } else if (isRetry) {
4834
5562
  this.#getCurrentChat().stripOrphanedUserEntriesFromHistory();
4835
5563
  } else {
4836
- this.config.getChatRecordingService()?.recordUserMessage(promptText);
5564
+ const recorder = this.config.getChatRecordingService();
5565
+ if (promptDisplayText !== void 0) {
5566
+ recorder?.recordUserMessage(promptText, goalTurn?.permit, {
5567
+ displayText: promptDisplayText,
5568
+ hookContext: ""
5569
+ });
5570
+ } else if (goalTurn) {
5571
+ recorder?.recordUserMessage(promptText, goalTurn.permit);
5572
+ } else {
5573
+ recorder?.recordUserMessage(promptText);
5574
+ }
4837
5575
  }
4838
5576
  const firstTextBlock = modelPromptBlocks.find(
4839
5577
  (block) => block.type === "text"
@@ -4862,7 +5600,13 @@ var Session = class {
4862
5600
  inputText,
4863
5601
  pendingSend,
4864
5602
  this.config,
4865
- this.settings
5603
+ this.settings,
5604
+ {
5605
+ // `/clear` swaps in a new Goal runtime under this
5606
+ // long-lived Session; without this the goal-state
5607
+ // subscription stays on the disposed instance.
5608
+ startNewSession: /* @__PURE__ */ __name(() => this.rebindGoalRuntimeForNewSession(), "startNewSession")
5609
+ }
4866
5610
  );
4867
5611
  parts = await this.#processSlashCommandResult(
4868
5612
  slashCommandResult,
@@ -4882,7 +5626,8 @@ var Session = class {
4882
5626
  }
4883
5627
  const hooksEnabled = !this.config.getDisableAllHooks?.();
4884
5628
  const messageBus = this.config.getMessageBus?.();
4885
- if (!isContinue && hooksEnabled && messageBus && this.config.hasHooksForEvent?.("UserPromptSubmit")) {
5629
+ const isRuntimeContinuation = goalTurn?.origin === "runtime";
5630
+ if (!isContinue && !isRuntimeContinuation && hooksEnabled && messageBus && this.config.hasHooksForEvent?.("UserPromptSubmit")) {
4886
5631
  const response = await messageBus.request(
4887
5632
  {
4888
5633
  type: "hook-execution-request" /* HOOK_EXECUTION_REQUEST */,
@@ -4996,6 +5741,7 @@ ${this.pendingRecoveredAgentsNotice}
4996
5741
  );
4997
5742
  let channelDeliveryResponseBlock;
4998
5743
  try {
5744
+ if (goalTurn) goalTurn.modelStarted = true;
4999
5745
  const sendResult = await this.#sendMessageStreamWithAutoCompression(
5000
5746
  promptId,
5001
5747
  nextMessage?.parts ?? [],
@@ -5404,11 +6150,13 @@ ${this.pendingRecoveredAgentsNotice}
5404
6150
  "Stop",
5405
6151
  stopHookBlockingCap
5406
6152
  );
5407
- abortGoalForStopHookCap(
6153
+ if (!abortGoalForStopHookCap(
5408
6154
  this.config,
5409
6155
  this.config.getSessionId(),
5410
6156
  warning
5411
- );
6157
+ )) {
6158
+ await this.#pauseGoalForStopHookCap();
6159
+ }
5412
6160
  this.todoStopGuard.suspend();
5413
6161
  await this.messageEmitter.emitAgentMessage(warning);
5414
6162
  debugLogger6.warn(warning);
@@ -6149,16 +6897,16 @@ ${this.pendingRecoveredAgentsNotice}
6149
6897
  );
6150
6898
  return { responseStream: null, stopReason: "cancelled" };
6151
6899
  }
6152
- const responseStream = await this.#getCurrentChat().sendMessageStream(
6153
- options.getModelOverride?.() ?? options.modelOverride ?? this.config.getModel(),
6154
- {
6155
- message,
6156
- config: {
6157
- abortSignal
6158
- }
6159
- },
6160
- promptId
6161
- );
6900
+ const chat = this.#getCurrentChat();
6901
+ const model = options.getModelOverride?.() ?? options.modelOverride ?? this.config.getModel();
6902
+ const request = {
6903
+ message,
6904
+ config: {
6905
+ abortSignal
6906
+ }
6907
+ };
6908
+ const goalPermit = goalTurnContext.getStore();
6909
+ const responseStream = goalPermit ? await chat.sendMessageStream(model, request, promptId, goalPermit) : await chat.sendMessageStream(model, request, promptId);
6162
6910
  return { responseStream };
6163
6911
  }
6164
6912
  #preserveUnsentMessageHistory(message, preserveFullMessage) {
@@ -6638,6 +7386,7 @@ ${this.pendingRecoveredAgentsNotice}
6638
7386
  if (this.closing) return;
6639
7387
  if (this.cronProcessing) return;
6640
7388
  if (this.pendingPrompt) return;
7389
+ if (this.goalProcessing) return;
6641
7390
  if (this.notificationProcessing) return;
6642
7391
  if (this.#deferAutomaticQueueDrainUntilTurnsSettle()) return;
6643
7392
  if (this.#nextCronQueueIndex() < 0) return;
@@ -6649,7 +7398,7 @@ ${this.pendingRecoveredAgentsNotice}
6649
7398
  );
6650
7399
  return;
6651
7400
  }
6652
- if (this.disposed || this.closing || this.cronProcessing || this.pendingPrompt || this.notificationProcessing || this.#nextCronQueueIndex() < 0) {
7401
+ if (this.disposed || this.closing || this.cronProcessing || this.pendingPrompt || this.goalProcessing || this.notificationProcessing || this.#nextCronQueueIndex() < 0) {
6653
7402
  return;
6654
7403
  }
6655
7404
  if (this.#deferAutomaticQueueDrainUntilTurnsSettle()) return;
@@ -6670,6 +7419,7 @@ ${this.pendingRecoveredAgentsNotice}
6670
7419
  this.cronProcessing = false;
6671
7420
  resolveCompletion();
6672
7421
  this.cronCompletion = null;
7422
+ void this.#drainGoalQueue();
6673
7423
  void this.#drainNotificationQueue();
6674
7424
  if (this.config.isCronEnabled()) {
6675
7425
  const scheduler = this.config.getCronScheduler();
@@ -7039,6 +7789,7 @@ ${this.pendingRecoveredAgentsNotice}
7039
7789
  backgroundRegistry.setStatusChangeCallback(this.#statusChangeCallback);
7040
7790
  backgroundRegistry.setNotificationCallback(
7041
7791
  (displayText, modelText, meta) => {
7792
+ const entry = backgroundRegistry.get(meta.agentId);
7042
7793
  this.#enqueueBackgroundNotification({
7043
7794
  displayText,
7044
7795
  modelText,
@@ -7047,7 +7798,12 @@ ${this.pendingRecoveredAgentsNotice}
7047
7798
  kind: "agent",
7048
7799
  continuesTodoStopGuardWorkChain: this.#agentContinuesTodoStopGuardWorkChain(meta.agentId),
7049
7800
  toolUseId: meta.toolUseId,
7050
- todoWorkChainId: meta.todoWorkChainId
7801
+ todoWorkChainId: meta.todoWorkChainId,
7802
+ structured: entry ? {
7803
+ description: truncateNotificationLabel(
7804
+ buildBackgroundEntryLabel(entry)
7805
+ )
7806
+ } : void 0
7051
7807
  });
7052
7808
  }
7053
7809
  );
@@ -7056,6 +7812,7 @@ ${this.pendingRecoveredAgentsNotice}
7056
7812
  if (meta.status === "running") {
7057
7813
  return;
7058
7814
  }
7815
+ const entry = monitorRegistry.get(meta.monitorId);
7059
7816
  this.#enqueueBackgroundNotification({
7060
7817
  displayText,
7061
7818
  modelText,
@@ -7067,11 +7824,17 @@ ${this.pendingRecoveredAgentsNotice}
7067
7824
  meta.ownerAgentId
7068
7825
  ),
7069
7826
  toolUseId: meta.toolUseId,
7070
- todoWorkChainId: meta.todoWorkChainId
7827
+ todoWorkChainId: meta.todoWorkChainId,
7828
+ structured: entry ? {
7829
+ description: truncateNotificationLabel(entry.description),
7830
+ eventCount: meta.eventCount,
7831
+ droppedLines: entry.droppedLines || void 0
7832
+ } : void 0
7071
7833
  });
7072
7834
  });
7073
7835
  const shellRegistry = this.config.getBackgroundShellRegistry();
7074
7836
  shellRegistry.setNotificationCallback((displayText, modelText, meta) => {
7837
+ const entry = shellRegistry.get(meta.shellId);
7075
7838
  this.#enqueueBackgroundNotification({
7076
7839
  displayText,
7077
7840
  modelText,
@@ -7079,7 +7842,8 @@ ${this.pendingRecoveredAgentsNotice}
7079
7842
  status: meta.status,
7080
7843
  kind: "shell",
7081
7844
  continuesTodoStopGuardWorkChain: !this.todoStopGuardBackgroundBaseline.shells.has(meta.shellId),
7082
- todoWorkChainId: meta.todoWorkChainId
7845
+ todoWorkChainId: meta.todoWorkChainId,
7846
+ structured: entry ? { commandLabel: truncateNotificationLabel(entry.description) } : void 0
7083
7847
  });
7084
7848
  });
7085
7849
  this.config.getChatRecordingService()?.setTitleRecordedCallback((customTitle, titleSource, sessionId) => {
@@ -7170,7 +7934,8 @@ ${this.pendingRecoveredAgentsNotice}
7170
7934
  taskId: item.taskId,
7171
7935
  status: item.status,
7172
7936
  kind: item.kind,
7173
- toolUseId: item.toolUseId
7937
+ toolUseId: item.toolUseId,
7938
+ ...item.structured
7174
7939
  }
7175
7940
  );
7176
7941
  } catch (error) {
@@ -7193,7 +7958,7 @@ ${this.pendingRecoveredAgentsNotice}
7193
7958
  if (this.disposed) return;
7194
7959
  if (this.closing) return;
7195
7960
  if (this.notificationProcessing) return;
7196
- if (this.pendingPrompt || this.cronProcessing || this.cronAbortController) {
7961
+ if (this.pendingPrompt || this.goalProcessing || this.cronProcessing || this.cronAbortController) {
7197
7962
  return;
7198
7963
  }
7199
7964
  if (this.#deferAutomaticQueueDrainUntilTurnsSettle()) return;
@@ -7207,7 +7972,7 @@ ${this.pendingRecoveredAgentsNotice}
7207
7972
  );
7208
7973
  return;
7209
7974
  }
7210
- if (this.disposed || this.closing || this.notificationProcessing || this.pendingPrompt || this.cronProcessing || this.cronAbortController || this.#nextNotificationQueueIndex() < 0) {
7975
+ if (this.disposed || this.closing || this.notificationProcessing || this.pendingPrompt || this.goalProcessing || this.cronProcessing || this.cronAbortController || this.#nextNotificationQueueIndex() < 0) {
7211
7976
  return;
7212
7977
  }
7213
7978
  if (this.#deferAutomaticQueueDrainUntilTurnsSettle()) return;
@@ -7218,7 +7983,7 @@ ${this.pendingRecoveredAgentsNotice}
7218
7983
  });
7219
7984
  try {
7220
7985
  while (this.notificationQueue.length > 0) {
7221
- if (this.pendingPrompt || this.cronProcessing || this.cronAbortController) {
7986
+ if (this.pendingPrompt || this.goalProcessing || this.cronProcessing || this.cronAbortController) {
7222
7987
  break;
7223
7988
  }
7224
7989
  const nextIndex = this.#nextNotificationQueueIndex();
@@ -7245,8 +8010,9 @@ ${this.pendingRecoveredAgentsNotice}
7245
8010
  resolveCompletion();
7246
8011
  this.notificationCompletion = null;
7247
8012
  this.#activeWorkChanged();
8013
+ void this.#drainGoalQueue();
7248
8014
  void this.#drainCronQueue();
7249
- if (this.notificationQueue.length > 0 && !this.pendingPrompt && !this.cronProcessing && !this.cronAbortController) {
8015
+ if (this.notificationQueue.length > 0 && !this.pendingPrompt && !this.goalProcessing && !this.cronProcessing && !this.cronAbortController) {
7250
8016
  void this.#drainNotificationQueue();
7251
8017
  }
7252
8018
  }
@@ -7283,7 +8049,8 @@ ${this.pendingRecoveredAgentsNotice}
7283
8049
  taskId: item.taskId,
7284
8050
  status: item.status,
7285
8051
  kind: item.kind,
7286
- toolUseId: item.toolUseId
8052
+ toolUseId: item.toolUseId,
8053
+ ...item.structured
7287
8054
  });
7288
8055
  }
7289
8056
  const notificationReminders = await this.#buildInitialSystemReminders();
@@ -7499,7 +8266,8 @@ ${this.pendingRecoveredAgentsNotice}
7499
8266
  taskId: item.taskId,
7500
8267
  status: item.status,
7501
8268
  kind: item.kind,
7502
- toolUseId: item.toolUseId
8269
+ toolUseId: item.toolUseId,
8270
+ ...item.structured
7503
8271
  }
7504
8272
  }
7505
8273
  });
@@ -9721,30 +10489,6 @@ ${this.pendingRecoveredAgentsNotice}
9721
10489
  }
9722
10490
  }
9723
10491
  }
9724
- #emitGoalStatusItems(result) {
9725
- if (!("outputHistoryItems" in result)) {
9726
- return;
9727
- }
9728
- let hasActiveGoalStatus = false;
9729
- for (const item of result.outputHistoryItems ?? []) {
9730
- if (item.type === "goal_status" /* GOAL_STATUS */) {
9731
- this.emitGoalStatus({
9732
- kind: item.kind,
9733
- condition: item.condition,
9734
- ...item.iterations !== void 0 ? { iterations: item.iterations } : {},
9735
- ...item.setAt !== void 0 ? { setAt: item.setAt } : {},
9736
- ...item.durationMs !== void 0 ? { durationMs: item.durationMs } : {},
9737
- ...item.lastReason !== void 0 ? { lastReason: item.lastReason } : {}
9738
- });
9739
- if (!isTerminalGoalStatusKind(item.kind)) {
9740
- hasActiveGoalStatus = true;
9741
- }
9742
- }
9743
- }
9744
- if (hasActiveGoalStatus) {
9745
- this.installGoalTerminalObserver();
9746
- }
9747
- }
9748
10492
  /**
9749
10493
  * Processes the result of a slash command execution.
9750
10494
  *
@@ -9762,7 +10506,6 @@ ${this.pendingRecoveredAgentsNotice}
9762
10506
  * @returns Parts to use for the prompt, or null if command was handled without needing model interaction
9763
10507
  */
9764
10508
  async #processSlashCommandResult(result, originalPrompt, abortSignal, onFullTurnModel) {
9765
- this.#emitGoalStatusItems(result);
9766
10509
  this.refreshContextFilesOnWrite = result.type === "submit_prompt" && Boolean(result.refreshContextFilesOnWrite);
9767
10510
  switch (result.type) {
9768
10511
  case "submit_prompt":
@@ -9813,9 +10556,15 @@ ${this.pendingRecoveredAgentsNotice}
9813
10556
  throw new Error(unsupportedError);
9814
10557
  }
9815
10558
  case "goal_control":
9816
- throw new Error(
9817
- "Canonical Goal control is not available in ACP integration yet."
9818
- );
10559
+ if (!result.cause) {
10560
+ await this.#queueGoalState(
10561
+ result.response.snapshot,
10562
+ void 0,
10563
+ this.lastGoalSnapshot?.goal ?? null
10564
+ );
10565
+ this.lastGoalSnapshot = result.response.snapshot;
10566
+ }
10567
+ return null;
9819
10568
  case "no_command":
9820
10569
  return this.#resolvePrompt(originalPrompt, abortSignal, {
9821
10570
  promptLast: true,
@@ -10362,6 +11111,22 @@ var ActiveWorkReporter = class {
10362
11111
  }
10363
11112
  };
10364
11113
 
11114
+ // packages/cli/src/acp-integration/model-configuration.ts
11115
+ init_esbuild_shims();
11116
+ var MODEL_CONFIGURATIONS = {
11117
+ "qwen3.8-max": {
11118
+ reasoning: {
11119
+ thinking: true,
11120
+ efforts: ["low", "medium", "xhigh"],
11121
+ defaultEffort: "xhigh"
11122
+ }
11123
+ }
11124
+ };
11125
+ function getModelConfiguration(modelId) {
11126
+ return modelId === "qwen3.8-max" ? MODEL_CONFIGURATIONS[modelId] : void 0;
11127
+ }
11128
+ __name(getModelConfiguration, "getModelConfiguration");
11129
+
10365
11130
  // packages/cli/src/acp-integration/session/tasksSnapshot.ts
10366
11131
  init_esbuild_shims();
10367
11132
  function runtimeMs(entry, now) {
@@ -10499,6 +11264,7 @@ var BTW_CHILD_TIMEOUT_MS = 55e3;
10499
11264
  var MCP_OAUTH_START_TIMEOUT_MS = 3e4;
10500
11265
  var SESSION_DRAIN_TIMEOUT_MS = 3e4;
10501
11266
  var ACP_REASONING_EFFORT_DEFAULT = "default";
11267
+ var ACP_REASONING_EFFORT_NONE = "none";
10502
11268
  var ACP_REASONING_EFFORT_NAMES = {
10503
11269
  low: "Low",
10504
11270
  medium: "Medium",
@@ -13274,11 +14040,6 @@ var QwenAgent = class {
13274
14040
  cleanupErrors.push(error);
13275
14041
  }
13276
14042
  }
13277
- try {
13278
- unregisterGoalHook(session.getConfig(), sessionId);
13279
- } catch (error) {
13280
- cleanupErrors.push(error);
13281
- }
13282
14043
  try {
13283
14044
  this.mcpPool?.releaseSession(sessionId);
13284
14045
  } catch (error) {
@@ -13550,7 +14311,7 @@ var QwenAgent = class {
13550
14311
  }
13551
14312
  this.clientCapabilities = args.clientCapabilities;
13552
14313
  const authMethods = buildAuthMethods();
13553
- const version = "0.21.11-preview.0";
14314
+ const version = "0.21.12-preview.1";
13554
14315
  const response = {
13555
14316
  protocolVersion: PROTOCOL_VERSION,
13556
14317
  agentInfo: {
@@ -13899,7 +14660,6 @@ var QwenAgent = class {
13899
14660
  records: replayPage.records,
13900
14661
  gaps: sessionData?.historyGaps,
13901
14662
  cumulativeUsage: replayUsage,
13902
- supersedeUnrestorableGoal: true,
13903
14663
  logger: debugLogger8
13904
14664
  });
13905
14665
  replayUpdates = replay.updates;
@@ -13907,6 +14667,15 @@ var QwenAgent = class {
13907
14667
  createdSession.cumulativeUsage,
13908
14668
  replayUsage
13909
14669
  );
14670
+ try {
14671
+ replayUpdates = replayUpdates.concat(
14672
+ await createdSession.renderRecoveredGoalUpdates(records)
14673
+ );
14674
+ } catch (error) {
14675
+ debugLogger8.debug(
14676
+ `Failed to render recovered Goal state: ${error instanceof Error ? error.message : String(error)}`
14677
+ );
14678
+ }
13910
14679
  if (replay.replayError !== void 0) {
13911
14680
  replayEnvelope = {
13912
14681
  v: LOAD_REPLAY_VERSION,
@@ -13932,7 +14701,6 @@ var QwenAgent = class {
13932
14701
  config,
13933
14702
  createdSession
13934
14703
  );
13935
- this.#restoreGoalOnResume(config, createdSession);
13936
14704
  }, "beforeStartPostReplayServices")
13937
14705
  })
13938
14706
  );
@@ -14059,12 +14827,20 @@ var QwenAgent = class {
14059
14827
  ),
14060
14828
  replayHistory: false,
14061
14829
  beforeStartPostReplayServices: /* @__PURE__ */ __name(async (createdSession) => {
14830
+ try {
14831
+ await createdSession.publishRecoveredGoalState(
14832
+ config.getResumedSessionData()?.conversation.messages
14833
+ );
14834
+ } catch (error) {
14835
+ debugLogger8.debug(
14836
+ `Failed to publish recovered Goal state: ${error instanceof Error ? error.message : String(error)}`
14837
+ );
14838
+ }
14062
14839
  await this.#restoreWorktreeOnResume(config, createdSession);
14063
14840
  await this.#restoreBackgroundAgentsOnResume(
14064
14841
  config,
14065
14842
  createdSession
14066
14843
  );
14067
- this.#restoreGoalOnResume(config, createdSession);
14068
14844
  }, "beforeStartPostReplayServices")
14069
14845
  }
14070
14846
  )
@@ -14111,48 +14887,6 @@ var QwenAgent = class {
14111
14887
  await config.loadPausedBackgroundAgents(config.getSessionId());
14112
14888
  session.pendingRecoveredAgentsNotice = config.consumePendingRecoveredAgentsNotice();
14113
14889
  }
14114
- /**
14115
- * Re-registers the `/goal` Stop hook when a resumed transcript ends on an
14116
- * unsatisfied goal — the daemon counterpart of the TUI's resume restore.
14117
- * Without this the goal loop silently dies whenever a session is reloaded or
14118
- * `qwen serve` restarts, even though the transcript still shows it as active.
14119
- *
14120
- * The `addItem` bridge that `restoreGoalFromHistory` takes in the TUI is not
14121
- * used here — the daemon's terminal card goes out over the wire, not into an
14122
- * Ink history. But restore reaches `unregisterGoalHook` on every path,
14123
- * including the one where there was nothing to restore, and that clears the
14124
- * observer the `Session` constructor installed. So it is put back afterwards,
14125
- * unconditionally: without it a restored goal that later achieves or fails
14126
- * emits no terminal update and persists no terminal card, and the next reload
14127
- * revives a goal that already finished.
14128
- *
14129
- * Best-effort: a failed restore must not block session load.
14130
- */
14131
- #restoreGoalOnResume(config, session) {
14132
- try {
14133
- const records = config.getResumedSessionData()?.conversation.messages;
14134
- if (!records?.length) return;
14135
- const restored = restoreGoalFromHistory(
14136
- collectGoalStatusItemsFromRecords(records),
14137
- config
14138
- );
14139
- if (restored.restored) {
14140
- debugLogger8.info(
14141
- `ACP goal restored sessionId=${config.getSessionId()} condition=${restored.condition}`
14142
- );
14143
- } else if (restored.blockedBy && restored.blockedBy !== "condition-invalid") {
14144
- writeStderrLineSafe(
14145
- `qwen: not restoring the active goal for session ${config.getSessionId()} (${restored.blockedBy}).`
14146
- );
14147
- }
14148
- } catch (error) {
14149
- writeStderrLineSafe(
14150
- `qwen: goal restore failed for session ${config.getSessionId()}: ${error}`
14151
- );
14152
- } finally {
14153
- session.installGoalTerminalObserver();
14154
- }
14155
- }
14156
14890
  async unstable_listSessions(params) {
14157
14891
  const cwd = params.cwd || process.cwd();
14158
14892
  const numericCursor = parseAcpSessionListCursor(params.cursor);
@@ -14233,6 +14967,29 @@ var QwenAgent = class {
14233
14967
  break;
14234
14968
  }
14235
14969
  case "reasoning_effort": {
14970
+ const modelReasoning = this.getModelReasoningConfiguration(
14971
+ session.getConfig()
14972
+ );
14973
+ if (modelReasoning) {
14974
+ const selected = value === ACP_REASONING_EFFORT_NONE ? ACP_REASONING_EFFORT_NONE : modelReasoning.efforts.find((effort2) => effort2 === value);
14975
+ if (!selected) {
14976
+ throw RequestError.invalidParams(
14977
+ void 0,
14978
+ `Unknown reasoning effort: ${value}. Choose one of: ${ACP_REASONING_EFFORT_NONE}, ${modelReasoning.efforts.join(", ")}`
14979
+ );
14980
+ }
14981
+ const generation = session.getConfig().getContentGeneratorConfig();
14982
+ if (selected === ACP_REASONING_EFFORT_NONE) {
14983
+ generation.reasoning = false;
14984
+ } else {
14985
+ const current = generation.reasoning;
14986
+ generation.reasoning = {
14987
+ ...current || {},
14988
+ effort: selected
14989
+ };
14990
+ }
14991
+ break;
14992
+ }
14236
14993
  const effort = value === ACP_REASONING_EFFORT_DEFAULT ? void 0 : REASONING_EFFORT_TIERS.find((tier) => tier === value);
14237
14994
  if (value !== ACP_REASONING_EFFORT_DEFAULT && effort === void 0) {
14238
14995
  throw RequestError.invalidParams(
@@ -14268,9 +15025,14 @@ var QwenAgent = class {
14268
15025
  const meta = params._meta && typeof params._meta === "object" ? { ...params._meta } : {};
14269
15026
  const suppliedContext = meta[INVOCATION_CONTEXT_META_KEY];
14270
15027
  const suppliedModelPrompt = meta[DAEMON_MODEL_PROMPT_META_KEY];
15028
+ const suppliedPromptDisplayText = meta[DAEMON_PROMPT_DISPLAY_TEXT_META_KEY];
14271
15029
  delete meta[INVOCATION_CONTEXT_META_KEY];
14272
15030
  delete meta[DAEMON_MODEL_PROMPT_META_KEY];
14273
15031
  delete meta[PRIVATE_PARENT_CAPABILITY_META_KEY];
15032
+ delete meta[DAEMON_PROMPT_DISPLAY_TEXT_META_KEY];
15033
+ if (this.privateParentState === "trusted" && typeof suppliedPromptDisplayText === "string") {
15034
+ meta[DAEMON_PROMPT_DISPLAY_TEXT_META_KEY] = suppliedPromptDisplayText;
15035
+ }
14274
15036
  if (Object.keys(meta).length > 0) {
14275
15037
  sanitizedParams._meta = meta;
14276
15038
  } else {
@@ -18390,21 +19152,34 @@ ${outputText}
18390
19152
  }
18391
19153
  const session = this.sessionOrThrow(sessionId);
18392
19154
  const config = session.getConfig();
18393
- const cleared = unregisterGoalHook(config, sessionId);
18394
- if (cleared) {
18395
- session.emitGoalStatus({
18396
- kind: "cleared",
18397
- condition: cleared.condition,
18398
- iterations: cleared.iterations,
18399
- durationMs: Date.now() - cleared.setAt
18400
- });
19155
+ let runtime;
19156
+ try {
19157
+ runtime = await config.getGoalRuntimeReady();
19158
+ } catch (error) {
19159
+ if (!(error instanceof GoalPersistenceUnavailableError)) throw error;
19160
+ debugLogger8.info(
19161
+ `sessionGoalClear sessionId=${sessionId} cleared=false (goal persistence unavailable)`
19162
+ );
19163
+ return {
19164
+ cleared: false,
19165
+ condition: void 0,
19166
+ snapshot: emptyGoalSnapshot()
19167
+ };
18401
19168
  }
19169
+ const before = runtime.getSnapshot();
19170
+ const goal = before.goal;
19171
+ const response = goal ? await runtime.dispatch({
19172
+ action: "clear",
19173
+ expectedGoalId: goal.goalId,
19174
+ expectedRevision: goal.revision
19175
+ }) : { snapshot: before };
18402
19176
  debugLogger8.info(
18403
- `sessionGoalClear sessionId=${sessionId} cleared=${!!cleared} condition=${cleared?.condition ?? "(none)"}`
19177
+ `sessionGoalClear sessionId=${sessionId} cleared=${!!goal} objective=${goal?.objective ?? "(none)"}`
18404
19178
  );
18405
19179
  return {
18406
- cleared: !!cleared,
18407
- condition: cleared?.condition
19180
+ cleared: !!goal,
19181
+ condition: goal?.objective,
19182
+ snapshot: response.snapshot
18408
19183
  };
18409
19184
  }
18410
19185
  case SERVE_CONTROL_EXT_METHODS.sessionGoalGet: {
@@ -18415,16 +19190,22 @@ ${outputText}
18415
19190
  "Invalid or missing sessionId"
18416
19191
  );
18417
19192
  }
18418
- this.sessionOrThrow(sessionId);
18419
- const active = getActiveGoal(sessionId);
19193
+ const session = this.sessionOrThrow(sessionId);
19194
+ let snapshot;
19195
+ try {
19196
+ snapshot = (await session.getConfig().getGoalRuntimeReady()).getSnapshot();
19197
+ } catch (error) {
19198
+ if (!(error instanceof GoalPersistenceUnavailableError)) throw error;
19199
+ snapshot = emptyGoalSnapshot();
19200
+ }
19201
+ const activeGoal = snapshot.goal?.status === "active" ? snapshot.goal : null;
18420
19202
  return {
18421
- // Projected field by field: `ActiveGoal` also carries `hookId` and
18422
- // `tokensAtStart`, which are this process's business.
18423
- active: active ? {
18424
- condition: active.condition,
18425
- iterations: active.iterations,
18426
- setAt: active.setAt,
18427
- ...active.lastReason !== void 0 ? { lastReason: active.lastReason } : {}
19203
+ snapshot,
19204
+ active: activeGoal ? {
19205
+ condition: activeGoal.objective,
19206
+ iterations: activeGoal.turnCount,
19207
+ setAt: activeGoal.createdAt,
19208
+ ...activeGoal.lastReason !== void 0 ? { lastReason: activeGoal.lastReason } : {}
18428
19209
  } : null
18429
19210
  };
18430
19211
  }
@@ -19707,6 +20488,15 @@ ${outputText}
19707
20488
  sessionData.conversation.messages,
19708
20489
  sessionData.historyGaps
19709
20490
  );
20491
+ try {
20492
+ await session.publishRecoveredGoalState(
20493
+ sessionData.conversation.messages
20494
+ );
20495
+ } catch (error) {
20496
+ debugLogger8.debug(
20497
+ `Failed to publish recovered Goal state: ${error instanceof Error ? error.message : String(error)}`
20498
+ );
20499
+ }
19710
20500
  }
19711
20501
  await options.beforeStartPostReplayServices?.(session);
19712
20502
  session.installRewriter();
@@ -19807,13 +20597,41 @@ ${outputText}
19807
20597
  currentValue: currentModelId,
19808
20598
  options: configModelOptions
19809
20599
  };
19810
- const reasoningEffortConfigOption = {
20600
+ const modelReasoning = this.getModelReasoningConfiguration(config);
20601
+ const currentModelEffort = config.getReasoningEffort?.();
20602
+ const reasoningEffortConfigOption = modelReasoning ? {
20603
+ id: "reasoning_effort",
20604
+ name: "Reasoning effort",
20605
+ description: `Thinking and reasoning effort for ${rawCurrentModelId}`,
20606
+ category: "thought_level",
20607
+ type: "select",
20608
+ currentValue: config.getContentGeneratorConfig().reasoning === false ? ACP_REASONING_EFFORT_NONE : modelReasoning.efforts.find(
20609
+ (effort) => effort === currentModelEffort
20610
+ ) ?? modelReasoning.defaultEffort,
20611
+ options: [
20612
+ {
20613
+ value: ACP_REASONING_EFFORT_NONE,
20614
+ name: "Thinking off",
20615
+ description: "Disable thinking for this session"
20616
+ },
20617
+ ...modelReasoning.efforts.map((effort) => ({
20618
+ value: effort,
20619
+ name: ACP_REASONING_EFFORT_NAMES[effort],
20620
+ description: "Apply this effort to the next request"
20621
+ }))
20622
+ ],
20623
+ _meta: {
20624
+ "qwenCode/reasoning": {
20625
+ defaultEffort: modelReasoning.defaultEffort
20626
+ }
20627
+ }
20628
+ } : {
19811
20629
  id: "reasoning_effort",
19812
20630
  name: "Reasoning effort",
19813
20631
  description: "How hard reasoning-capable models should think",
19814
20632
  category: "thought_level",
19815
20633
  type: "select",
19816
- currentValue: config.getReasoningEffort?.() ?? ACP_REASONING_EFFORT_DEFAULT,
20634
+ currentValue: currentModelEffort ?? ACP_REASONING_EFFORT_DEFAULT,
19817
20635
  options: [
19818
20636
  {
19819
20637
  value: ACP_REASONING_EFFORT_DEFAULT,
@@ -19829,6 +20647,14 @@ ${outputText}
19829
20647
  };
19830
20648
  return [modeConfigOption, modelConfigOption, reasoningEffortConfigOption];
19831
20649
  }
20650
+ getModelReasoningConfiguration(config) {
20651
+ if (config.getActiveRuntimeModelSnapshot?.() || config.getReasoningEffortOverride?.() || config.getContentGeneratorConfig().thinkingMandatory === true) {
20652
+ return void 0;
20653
+ }
20654
+ const reasoning = getModelConfiguration(config.getModel())?.reasoning;
20655
+ const currentEffort = config.getReasoningEffort?.();
20656
+ return reasoning?.thinking && (!currentEffort || reasoning.efforts.includes(currentEffort)) ? reasoning : void 0;
20657
+ }
19832
20658
  buildSelectableModelOptions(config) {
19833
20659
  const currentAuthType = config.getAuthType();
19834
20660
  return buildAcpModelOptions(