@qwen-code/qwen-code 0.21.12-preview.3 → 0.21.12-preview.4

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 (323) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +10 -0
  2. package/bundled/qc-helper/docs/features/code-review.md +1 -1
  3. package/bundled/qc-helper/docs/qwen-serve.md +34 -34
  4. package/bundled/review/SKILL.md +55 -36
  5. package/chunks/{MaxSizedBox-EIK4BHBQ.js → MaxSizedBox-GFI5RYXH.js} +41 -41
  6. package/chunks/{StandaloneSessionPicker-NHVJDRYD.js → StandaloneSessionPicker-JFWRY4V2.js} +60 -60
  7. package/chunks/{acp-startup-profiler-JMJBZDVO.js → acp-startup-profiler-TVI2OVUN.js} +2 -2
  8. package/chunks/{acpAgent-37UDZP64.js → acpAgent-7YC6SNIS.js} +672 -428
  9. package/chunks/{agent-FAWBG7PP.js → agent-43KVQSB5.js} +38 -38
  10. package/chunks/{agent-headless-SHK4PCCH.js → agent-headless-P2N7PDGQ.js} +38 -38
  11. package/chunks/{anthropicContentGenerator-4JSC3ZFL.js → anthropicContentGenerator-ZBBX5VMY.js} +6 -6
  12. package/chunks/{artifact-tool-FRMBPDPB.js → artifact-tool-RWJAKYBZ.js} +2 -2
  13. package/chunks/{askUserQuestion-7G3LI3IZ.js → askUserQuestion-IQCA2SOX.js} +2 -2
  14. package/chunks/{bridge-DEAYNDCI.js → bridge-ZBMNALLA.js} +44 -44
  15. package/chunks/{channel-management-service-SKAN6NOB.js → channel-management-service-5ZYX4ROW.js} +4 -4
  16. package/chunks/{channel-settings-store-UIGYER6R.js → channel-settings-store-ZJWM7EDP.js} +45 -45
  17. package/chunks/{channel-worker-group-YPTB5ASD.js → channel-worker-group-QFJKXO7R.js} +5 -5
  18. package/chunks/{channel-worker-manager-4EHJSPRH.js → channel-worker-manager-PWD2UURZ.js} +5 -5
  19. package/chunks/{channel-worker-supervisor-DZKHYFHV.js → channel-worker-supervisor-XQJBGFCM.js} +3 -3
  20. package/chunks/{chunk-GZGDJ4E6.js → chunk-2ASWIM4A.js} +1 -1
  21. package/chunks/{chunk-DP3IHZGG.js → chunk-2AUM35J5.js} +59 -7
  22. package/chunks/{chunk-T4FTABSW.js → chunk-2N6CV4PW.js} +1 -1
  23. package/chunks/{chunk-5PWLQ7SK.js → chunk-2RTRFLWH.js} +11 -4
  24. package/chunks/{chunk-TYGKUOEG.js → chunk-2U3UCXZ3.js} +2 -1
  25. package/chunks/{chunk-QZ5G26ZE.js → chunk-32SNBMNP.js} +12 -12
  26. package/chunks/{chunk-NPE3STIW.js → chunk-3JI5D6RU.js} +3 -3
  27. package/chunks/{chunk-E5BWLU5J.js → chunk-3MJ44LNC.js} +59 -23
  28. package/chunks/{chunk-QUESTNOP.js → chunk-4JS2QK7P.js} +1 -1
  29. package/chunks/{chunk-L7T742G2.js → chunk-4X5J3V2I.js} +47 -3
  30. package/chunks/{chunk-IQFYO5BF.js → chunk-5KZNWF2M.js} +1 -1
  31. package/chunks/{chunk-EXG2R5UR.js → chunk-62TIEFNN.js} +8 -8
  32. package/chunks/{chunk-T6W4KACQ.js → chunk-67F2BEYW.js} +1 -1
  33. package/chunks/{chunk-NELCY6JT.js → chunk-6LDLDK6E.js} +1 -1
  34. package/chunks/{chunk-5I5NMQCU.js → chunk-6NQWER7D.js} +3 -3
  35. package/chunks/{chunk-732MOPEM.js → chunk-6OJDN5ZT.js} +1 -1
  36. package/chunks/{chunk-GLWWPFTW.js → chunk-6SU6OW5Z.js} +1 -1
  37. package/chunks/{chunk-TEKFBSMY.js → chunk-6T5HCY34.js} +3 -3
  38. package/chunks/{chunk-AQHNAA7E.js → chunk-7JL5YBSA.js} +1 -1
  39. package/chunks/{chunk-NWPO6I7V.js → chunk-7WUMS2UA.js} +1 -1
  40. package/chunks/{chunk-O5G7IQGM.js → chunk-A2QIWDFO.js} +347 -85
  41. package/chunks/{chunk-KT4OWAAZ.js → chunk-A4BAHMJF.js} +3 -3
  42. package/chunks/{chunk-N7NBMAMW.js → chunk-A6GQUQ7I.js} +2 -2
  43. package/chunks/{chunk-XLQS3VI6.js → chunk-AAZWJAPQ.js} +2 -2
  44. package/chunks/{chunk-LT532KF4.js → chunk-ADJDLEVO.js} +1 -1
  45. package/chunks/{chunk-VWD7SNNN.js → chunk-APQTLUZ3.js} +2120 -2085
  46. package/chunks/{chunk-AJX4ITUG.js → chunk-ARL4UGRW.js} +3 -3
  47. package/chunks/{chunk-ZQSNP4TG.js → chunk-B2BKFWJK.js} +2 -2
  48. package/chunks/{chunk-SAQHDAUJ.js → chunk-B66LYK4B.js} +452 -57
  49. package/chunks/{chunk-6ZIIHBNV.js → chunk-B7IBCWDW.js} +3 -3
  50. package/chunks/{chunk-5UPJ774B.js → chunk-BGIKUE5J.js} +1 -1
  51. package/chunks/{chunk-2J53A6MV.js → chunk-BNRIQWXW.js} +3 -3
  52. package/chunks/{chunk-CZXQ4UZA.js → chunk-BXAGPCYH.js} +1 -1
  53. package/chunks/{chunk-IEP44U2R.js → chunk-C2DR57L6.js} +1 -1
  54. package/chunks/{chunk-TBVNYG5B.js → chunk-CDDLHCC2.js} +3 -3
  55. package/chunks/{chunk-CG3OQDNY.js → chunk-CJNKGZLC.js} +6 -6
  56. package/chunks/{chunk-UZPWH6SP.js → chunk-CTEGMF77.js} +285 -125
  57. package/chunks/{chunk-3TT6MZHJ.js → chunk-DUFZ3OW6.js} +35 -35
  58. package/chunks/{chunk-ZWPWQEF5.js → chunk-E74YSVIN.js} +1 -1
  59. package/chunks/{chunk-RQVVXDHS.js → chunk-ECDXUCEO.js} +4 -4
  60. package/chunks/{chunk-47FQVRCO.js → chunk-EGB2PIYM.js} +1 -1
  61. package/chunks/{chunk-JL3LC3CQ.js → chunk-FB5CQZMK.js} +1 -1
  62. package/chunks/{chunk-U6PTKAOW.js → chunk-FNVF5RR4.js} +1 -1
  63. package/chunks/{chunk-O4BBDP2G.js → chunk-FTGU6G45.js} +2 -2
  64. package/chunks/{chunk-ZGWY4YUB.js → chunk-FVHLDSQS.js} +2 -2
  65. package/chunks/{chunk-RRQJPCRQ.js → chunk-FXWGMPAP.js} +2 -2
  66. package/chunks/{chunk-P64FPV3G.js → chunk-GDNDZJSG.js} +2 -2
  67. package/chunks/{chunk-M6HXP2SG.js → chunk-GHOUZ5X4.js} +1892 -622
  68. package/chunks/{chunk-M6SXIXBV.js → chunk-H2U4FK62.js} +6 -6
  69. package/chunks/{chunk-EFIMD5VA.js → chunk-H6BFLALJ.js} +1 -1
  70. package/chunks/{chunk-TYCXSMZU.js → chunk-HOJZ2QQA.js} +3 -3
  71. package/chunks/{chunk-Y66OOMKS.js → chunk-HWCHDINS.js} +21 -21
  72. package/chunks/{chunk-4GLFFNP3.js → chunk-HY5OHJEC.js} +5 -5
  73. package/chunks/{chunk-P2UCMHDT.js → chunk-IJCZP2MA.js} +2 -2
  74. package/chunks/{chunk-I4XSOFH2.js → chunk-JBZYGFIB.js} +1 -1
  75. package/chunks/{chunk-HBZUU4AE.js → chunk-JGD35ZSJ.js} +4 -4
  76. package/chunks/{chunk-DAX3G67A.js → chunk-JOVJCXN4.js} +1 -1
  77. package/chunks/{chunk-YI6UGZF5.js → chunk-JRMUA53D.js} +12 -12
  78. package/chunks/{chunk-CTQE2NB2.js → chunk-JRTJEGSP.js} +1 -1
  79. package/chunks/{chunk-MZSJ43WV.js → chunk-JVY7FHUZ.js} +15 -2
  80. package/chunks/{chunk-K7JW6V5O.js → chunk-JW5UEE3V.js} +1 -1
  81. package/chunks/{chunk-GYBDYWMV.js → chunk-JXS2JNMZ.js} +2 -2
  82. package/chunks/{chunk-L2GTEEEU.js → chunk-K5IDV3PC.js} +44 -1
  83. package/chunks/{chunk-N3FJOQX7.js → chunk-KB4ISUT3.js} +4 -4
  84. package/chunks/{chunk-GJJQV4PY.js → chunk-KK3FEHPJ.js} +1 -1
  85. package/chunks/{chunk-2AZMF6G5.js → chunk-KTWUFHS4.js} +2 -2
  86. package/chunks/{chunk-7D4KEFOT.js → chunk-L3YACXS2.js} +3 -3
  87. package/chunks/{chunk-575MI5K3.js → chunk-LIBTBTHP.js} +4 -4
  88. package/chunks/{chunk-JS4Q5NG5.js → chunk-LSMCI42W.js} +3 -3
  89. package/chunks/{chunk-YZJVVQD3.js → chunk-MTV5W6WN.js} +7 -7
  90. package/chunks/{chunk-UOMZKPI5.js → chunk-MUN34TTF.js} +7 -7
  91. package/chunks/{chunk-LHY6HBRA.js → chunk-N3J3CO35.js} +4 -4
  92. package/chunks/{chunk-TRYJ3BVE.js → chunk-N56NYJWY.js} +7 -7
  93. package/chunks/{chunk-3ZYX7AUR.js → chunk-NAOHSM56.js} +1 -1
  94. package/chunks/{chunk-URK542T4.js → chunk-NF5J2WFA.js} +15 -2
  95. package/chunks/{chunk-OPBATTFQ.js → chunk-NHZF4VCD.js} +1 -1
  96. package/chunks/{chunk-QTI7SRXI.js → chunk-NM33GGOM.js} +3 -3
  97. package/chunks/{chunk-F6AOBFUN.js → chunk-NW7SPXVG.js} +1 -1
  98. package/chunks/{chunk-J7DNMZFO.js → chunk-NX5QZVRS.js} +1 -1
  99. package/chunks/{chunk-WFRHWDBT.js → chunk-O4MVJKSX.js} +5 -5
  100. package/chunks/{chunk-NC4O6UE6.js → chunk-O6SLWH4X.js} +2 -2
  101. package/chunks/{chunk-V4MJ56RS.js → chunk-OIZWCOYC.js} +5 -5
  102. package/chunks/{chunk-JXK3WAP7.js → chunk-ORR5EFCL.js} +4 -4
  103. package/chunks/{chunk-EYY4IBPV.js → chunk-OSA2TFDI.js} +2 -2
  104. package/chunks/{chunk-KPVVWKF3.js → chunk-PSTHNTHF.js} +1 -1
  105. package/chunks/{chunk-4M2F7OG7.js → chunk-PYLVQ6RT.js} +6 -6
  106. package/chunks/{chunk-6AECVSVX.js → chunk-Q7ALOKK7.js} +3 -3
  107. package/chunks/{chunk-EYW54TBD.js → chunk-QEWAHAW2.js} +3 -3
  108. package/chunks/{chunk-N5ULBHP3.js → chunk-QSDPJROT.js} +2 -2
  109. package/chunks/{chunk-DYVCDQW2.js → chunk-QSMZHJ62.js} +1 -1
  110. package/chunks/{chunk-MDFUBQAQ.js → chunk-QWAI7FNT.js} +17 -17
  111. package/chunks/{chunk-M4OYAR6J.js → chunk-QXFAQDBV.js} +2 -2
  112. package/chunks/{chunk-ILVATFYJ.js → chunk-SFBRH5RY.js} +19 -15
  113. package/chunks/{chunk-EYS3GGM3.js → chunk-SKRHR6N2.js} +1 -1
  114. package/chunks/{chunk-6LYDH7VT.js → chunk-SNHBRO4C.js} +2 -2
  115. package/chunks/{chunk-5TXOGH4I.js → chunk-T4G33L3W.js} +3 -3
  116. package/chunks/{chunk-32VOOMEF.js → chunk-TB6DPBE4.js} +4 -4
  117. package/chunks/{chunk-DEG7R6Z6.js → chunk-TN3REXN4.js} +8 -8
  118. package/chunks/{chunk-MWZYNOCG.js → chunk-TNETSI2A.js} +3 -3
  119. package/chunks/{chunk-ZV4XVYL3.js → chunk-TROB4PZY.js} +4 -4
  120. package/chunks/{chunk-O5AZPHYZ.js → chunk-U5C2GIN2.js} +24 -16
  121. package/chunks/{chunk-3GCU5O2E.js → chunk-U7ROFHSH.js} +1 -1
  122. package/chunks/{chunk-HB6QW4LM.js → chunk-UAAWNTOC.js} +15 -12
  123. package/chunks/{chunk-HHGQGTJQ.js → chunk-UFHPAMAV.js} +4 -0
  124. package/chunks/{chunk-V3LXMASR.js → chunk-UHF5VBKO.js} +1 -1
  125. package/chunks/{chunk-FRH4SSGX.js → chunk-UPUAGRKY.js} +2 -2
  126. package/chunks/{chunk-6S52N6PG.js → chunk-UQPLUR4A.js} +2 -2
  127. package/chunks/{chunk-KIFRFCCB.js → chunk-UWIJU22K.js} +66 -19
  128. package/chunks/{chunk-HGCQ5SE7.js → chunk-UXEO7E3V.js} +21 -0
  129. package/chunks/{chunk-M2PY7CNK.js → chunk-V2U6FOJB.js} +2 -2
  130. package/chunks/{chunk-7SUQZ7QH.js → chunk-V3NMFQD2.js} +2 -2
  131. package/chunks/{chunk-6XZERB6P.js → chunk-VPZMLGD3.js} +3 -3
  132. package/chunks/{chunk-UNCIELQJ.js → chunk-VRQD5D7R.js} +1 -1
  133. package/chunks/{chunk-YTYPRVIZ.js → chunk-VUTOV2HG.js} +2 -2
  134. package/chunks/{chunk-7LZ7DK4D.js → chunk-VYDQD5J4.js} +1 -1
  135. package/chunks/{chunk-XCGIMOLN.js → chunk-WCCLLK7X.js} +14 -1
  136. package/chunks/{chunk-JEMR2FTD.js → chunk-WIHSDI6U.js} +4 -4
  137. package/chunks/{chunk-VJNBRRZG.js → chunk-WZMH7II3.js} +1 -1
  138. package/chunks/{chunk-XWUQ4IH5.js → chunk-XJ6IMYUS.js} +7 -7
  139. package/chunks/{chunk-3XZYK76R.js → chunk-XL6GYJL2.js} +1 -1
  140. package/chunks/{chunk-KNXA5XXK.js → chunk-XUBM2A4F.js} +7 -7
  141. package/chunks/{chunk-ENEEQMGM.js → chunk-XY7DGTIC.js} +1 -1
  142. package/chunks/{chunk-SSAOTDK7.js → chunk-Y2EOB7WZ.js} +1 -1
  143. package/chunks/{chunk-VQZXRLEX.js → chunk-Y2HK3ELT.js} +3 -3
  144. package/chunks/{chunk-FDWH6CBK.js → chunk-Y5C24BUY.js} +5 -5
  145. package/chunks/{chunk-5HBFERG5.js → chunk-YI5G32RU.js} +3 -3
  146. package/chunks/{chunk-MPBRV3UU.js → chunk-YMB77M76.js} +15 -0
  147. package/chunks/{chunk-KNQZXSLW.js → chunk-YY23TR4M.js} +23 -9
  148. package/chunks/{chunk-4ETA3KRC.js → chunk-ZA2JN5IZ.js} +3 -3
  149. package/chunks/{chunk-IX7CFQGA.js → chunk-ZPZANKVP.js} +3 -3
  150. package/chunks/{chunk-XTH2OMDS.js → chunk-ZRT36RSF.js} +1 -1
  151. package/chunks/{chunk-M2NMFAFR.js → chunk-ZZ7RUTJ4.js} +1 -1
  152. package/chunks/{computer-use-S4JEU5P7.js → computer-use-J5VUY257.js} +38 -38
  153. package/chunks/{config-utils-TXVKR27S.js → config-utils-7JZQN6L2.js} +4 -4
  154. package/chunks/{contextCommand-2H5OH2HW.js → contextCommand-RCTGC36R.js} +40 -40
  155. package/chunks/{core-runtime-IAQ4DD4Y.js → core-runtime-REBZ5ZYE.js} +38 -38
  156. package/chunks/{create-sub-session-Y4WYDZGC.js → create-sub-session-23ULO5PO.js} +2 -2
  157. package/chunks/{create-sub-session-EKHKXJAA.js → create-sub-session-TEEUROAZ.js} +38 -38
  158. package/chunks/{cron-create-ZOVA3CC2.js → cron-create-5WUTNKNF.js} +4 -4
  159. package/chunks/{cron-delete-7Z3H4LJY.js → cron-delete-JEQ27YPS.js} +4 -4
  160. package/chunks/{cron-list-UHGX3IQG.js → cron-list-IXGCA7UR.js} +4 -4
  161. package/chunks/{daemon-PXIC4ZDK.js → daemon-UBVOQMWY.js} +2 -1
  162. package/chunks/{daemon-status-provider-LPYR2GXY.js → daemon-status-provider-SV7KRLJ4.js} +49 -49
  163. package/chunks/{daemon-trust-policy-7JOBVFH3.js → daemon-trust-policy-LFUJ4NGF.js} +44 -44
  164. package/chunks/{daemon-trust-policy-monitor-OU3NRHAR.js → daemon-trust-policy-monitor-BQZ77NDD.js} +44 -44
  165. package/chunks/{deferred-core-runtime-SFT3KI2C.js → deferred-core-runtime-F4XOQJQL.js} +38 -38
  166. package/chunks/{dispatch-B53LNEO4.js → dispatch-FW7DX2CR.js} +7 -1
  167. package/chunks/{display-image-ZE3GZNIK.js → display-image-CAD7RAUM.js} +4 -4
  168. package/chunks/{dist-BNWP6IZL.js → dist-362MN6CP.js} +2 -2
  169. package/chunks/{dist-EFJILGIS.js → dist-5VDE7U3A.js} +1 -1
  170. package/chunks/{dist-AVUYBK7L.js → dist-6RK4U6VU.js} +1 -1
  171. package/chunks/{dist-KTYDJNYM.js → dist-B3ODKYEB.js} +1 -1
  172. package/chunks/{dist-NPS52B2V.js → dist-CCUH2Z4C.js} +1 -1
  173. package/chunks/{dist-BW2LDPV3.js → dist-DANKRAB3.js} +1 -1
  174. package/chunks/{dist-PKSRQAR2.js → dist-EZHCZSW6.js} +1 -1
  175. package/chunks/{dist-ZWDH5HLS.js → dist-M3XMEIP2.js} +1 -1
  176. package/chunks/{earlyInputCapture-27RPWE2D.js → earlyInputCapture-JAJXDT2N.js} +39 -39
  177. package/chunks/{edit-WXVZ7FHS.js → edit-OXBMFY5B.js} +38 -38
  178. package/chunks/{enter-worktree-TYMVXFLA.js → enter-worktree-XS4JX4PO.js} +38 -38
  179. package/chunks/{enterPlanMode-FT4MRU5N.js → enterPlanMode-J6PDPFFT.js} +38 -38
  180. package/chunks/{environment-Z6OMA34I.js → environment-BQW6FAZL.js} +40 -40
  181. package/chunks/{errors-YMXK2GG3.js → errors-TMSN7AZN.js} +40 -40
  182. package/chunks/{exit-worktree-ODZUQLGJ.js → exit-worktree-2RIE6DAO.js} +38 -38
  183. package/chunks/{exitPlanMode-MBPAPBBV.js → exitPlanMode-QQL27HU4.js} +38 -38
  184. package/chunks/{fast-path-ZU5T6XSN.js → fast-path-TSGUVE5K.js} +4 -4
  185. package/chunks/{gemini-OZK6AIMC.js → gemini-RLTFENFV.js} +86 -86
  186. package/chunks/{geminiContentGenerator-MC6ZKWZG.js → geminiContentGenerator-B6W6PSO7.js} +6 -6
  187. package/chunks/{glob-KJ4A4ZOM.js → glob-JKVAHWL5.js} +38 -38
  188. package/chunks/{goal-tools-JDK2SNMV.js → goal-tools-LQFO4BRY.js} +4 -4
  189. package/chunks/{grep-QWBLG564.js → grep-6CN23ZPS.js} +38 -38
  190. package/chunks/{handleAutoUpdate-M3ACKDKF.js → handleAutoUpdate-Y6BUNMBG.js} +42 -42
  191. package/chunks/{i18n-FPW7XZL5.js → i18n-Y5PM6L5V.js} +39 -39
  192. package/chunks/{image-gen-OTFC2S7L.js → image-gen-DC2IQZ73.js} +10 -10
  193. package/chunks/{initializer-5HKUXXBT.js → initializer-OYKKBNHO.js} +45 -45
  194. package/chunks/{installationInfo-4OA6UW7V.js → installationInfo-63AFHLWA.js} +39 -39
  195. package/chunks/{keychain-token-storage-JTWUYFU7.js → keychain-token-storage-GU75J2T2.js} +2 -2
  196. package/chunks/{list-3TKZ264A.js → list-KA63R3R6.js} +47 -47
  197. package/chunks/{list-agents-4GQ2XNEU.js → list-agents-5PNMK2AM.js} +2 -2
  198. package/chunks/{loadedSettingsAdapter-IRUANLS2.js → loadedSettingsAdapter-IGBJN7C5.js} +44 -44
  199. package/chunks/{loggingContentGenerator-D4URLH2A.js → loggingContentGenerator-Z3NADCTQ.js} +115 -93
  200. package/chunks/{loop-wakeup-HOQI3K5D.js → loop-wakeup-OV65FEGR.js} +5 -5
  201. package/chunks/{ls-FSHISLLA.js → ls-RPRSX26R.js} +4 -4
  202. package/chunks/{lsp-APQJ5ZEZ.js → lsp-IWTJWFLT.js} +2 -2
  203. package/chunks/{managed-npm-update-2O7XSAWJ.js → managed-npm-update-HA262PFM.js} +41 -41
  204. package/chunks/{mcp-AFVHCHKT.js → mcp-T5ZUOKT3.js} +44 -44
  205. package/chunks/{monitor-PY4WDSX3.js → monitor-SLGY7CYB.js} +38 -38
  206. package/chunks/nonInteractiveCli-R5PK5B5G.js +166 -0
  207. package/chunks/{notebook-edit-GEPL33NO.js → notebook-edit-STSSB5KQ.js} +38 -38
  208. package/chunks/{openaiContentGenerator-ACYSXQ6R.js → openaiContentGenerator-OQED57JE.js} +24 -24
  209. package/chunks/{opentui-entry-SBAOWW7M.js → opentui-entry-UTJ6MHDI.js} +116 -97
  210. package/chunks/{pidfile-SUNYCAA4.js → pidfile-GES3MIHH.js} +39 -39
  211. package/chunks/{processUtils-F7LP7YUV.js → processUtils-FU6VMUOL.js} +2 -2
  212. package/chunks/{qwenContentGenerator-BB6IPELF.js → qwenContentGenerator-HWJSEGUL.js} +43 -43
  213. package/chunks/{qwenOAuth2-OU3WGDOI.js → qwenOAuth2-PAIR7XEW.js} +9 -9
  214. package/chunks/{read-file-GORBXJTS.js → read-file-IYEBTQT5.js} +12 -12
  215. package/chunks/{read-mcp-resource-TJSJRH4F.js → read-mcp-resource-THCSZHXO.js} +2 -2
  216. package/chunks/{read-package-up-TCM6I7S2.js → read-package-up-K6RKTL5D.js} +1 -1
  217. package/chunks/{record-artifact-FXF5LHPE.js → record-artifact-76YYQA5F.js} +3 -3
  218. package/chunks/{resumeHistoryUtils-FOAJJJWK.js → resumeHistoryUtils-WP446RP5.js} +44 -44
  219. package/chunks/{ripGrep-RNLIZGCY.js → ripGrep-VV2CRCL2.js} +38 -38
  220. package/chunks/{run-qwen-serve-GVMMX3IU.js → run-qwen-serve-AHQCTALV.js} +160 -71
  221. package/chunks/{runtime-RNBZ5FDD.js → runtime-AUUZGDK6.js} +49 -49
  222. package/chunks/{scheduler-NTRFSPIP.js → scheduler-Y4UPEURR.js} +40 -40
  223. package/chunks/{sdk-exporters-http-2VPMAPFI.js → sdk-exporters-http-A7XLKZO7.js} +11 -7
  224. package/chunks/{sdk-impl-5W3JUCWF.js → sdk-impl-XO4UF6PR.js} +11 -8
  225. package/chunks/{send-message-RBYLV5NY.js → send-message-P5SLP57G.js} +6 -6
  226. package/chunks/{serve-H3PGA26U.js → serve-WI3SE4MY.js} +47 -47
  227. package/chunks/{server-SUXD2F3C.js → server-G6JU6UWL.js} +264 -159
  228. package/chunks/{session-MTFVUWWM.js → session-2AO2UACB.js} +85 -85
  229. package/chunks/{settings-GUJ3TN2J.js → settings-3HRWSH66.js} +43 -43
  230. package/chunks/{shell-C2UP5FF2.js → shell-AR7XFLHA.js} +38 -38
  231. package/chunks/{skill-4XCNK55E.js → skill-K6NOUUYM.js} +16 -16
  232. package/chunks/{skill-settings-Y2BU27XM.js → skill-settings-IOXQYS6X.js} +43 -43
  233. package/chunks/{spawnChannel-UUUUK734.js → spawnChannel-V6P6HF4V.js} +40 -40
  234. package/chunks/{standalone-update-MJ722XZ4.js → standalone-update-K5G3L2OJ.js} +40 -40
  235. package/chunks/{startInteractiveUI-TCPIPNGN.js → startInteractiveUI-TRRP52QX.js} +125 -115
  236. package/chunks/{syntheticOutput-D3Z64LJC.js → syntheticOutput-SEW4NA47.js} +3 -3
  237. package/chunks/{task-create-URFZ5EUX.js → task-create-247EAVF7.js} +10 -10
  238. package/chunks/{task-list-6JDFMPUW.js → task-list-ZJN4QHLK.js} +5 -5
  239. package/chunks/{task-stop-HHUGCD25.js → task-stop-MAYQJ42I.js} +2 -2
  240. package/chunks/{task-update-DVV6CUGI.js → task-update-SU5TMZGG.js} +10 -10
  241. package/chunks/{team-create-WZWH2NJI.js → team-create-IEEEBLE2.js} +38 -38
  242. package/chunks/{team-delete-PZGGBQLM.js → team-delete-3XVRPQBP.js} +5 -5
  243. package/chunks/{team-plan-approval-SUZQJCWJ.js → team-plan-approval-SJGNS5JL.js} +38 -38
  244. package/chunks/{terminal-image-renderer-BCUN3Z3W.js → terminal-image-renderer-C4RQMC67.js} +40 -40
  245. package/chunks/{theme-manager-UGMFDREN.js → theme-manager-IKZQJQ6C.js} +39 -39
  246. package/chunks/{todoWrite-WINAZSZI.js → todoWrite-IE2YTCK7.js} +4 -4
  247. package/chunks/{tool-search-B6F3MPUZ.js → tool-search-4UVNFYWU.js} +16 -16
  248. package/chunks/{total-session-admission-MQLBJ5WL.js → total-session-admission-DIN6FTZP.js} +44 -44
  249. package/chunks/{trustedFolders-2XST7U5C.js → trustedFolders-IAHOLV6A.js} +39 -39
  250. package/chunks/{update-relaunch-OVC7YNGD.js → update-relaunch-5QSJ5CWP.js} +5 -5
  251. package/chunks/{updateCheck-YAKM36WQ.js → updateCheck-N4RT7HOZ.js} +44 -44
  252. package/chunks/{useAutoAcceptIndicator-RF6FVX3S.js → useAutoAcceptIndicator-25T26VZS.js} +46 -46
  253. package/chunks/{validateNonInterActiveAuth-IPPXFNQH.js → validateNonInterActiveAuth-MCTVPLFE.js} +81 -81
  254. package/chunks/{version-4IDFEXOU.js → version-6PLZ7PCV.js} +2 -2
  255. package/chunks/{web-fetch-NUOLHXPN.js → web-fetch-5ANX6FSM.js} +16 -16
  256. package/chunks/{web-search-LVOOV4XZ.js → web-search-KQJWWRHW.js} +9 -9
  257. package/chunks/{workflow-JSTYTG3K.js → workflow-C57ZKFUF.js} +111 -46
  258. package/chunks/{workspace-providers-status-U4EYXA4K.js → workspace-providers-status-3QAE4G4Y.js} +47 -47
  259. package/chunks/{workspace-registration-store-OG66U3CB.js → workspace-registration-store-Q3J5LV6T.js} +1 -1
  260. package/chunks/{workspace-registry-WSHWQRQQ.js → workspace-registry-DSJ5NAII.js} +44 -44
  261. package/chunks/{workspace-service-QZXQHX2F.js → workspace-service-QW5LH7FA.js} +49 -49
  262. package/chunks/{workspace-skills-status-VRBHEX5O.js → workspace-skills-status-N34ALJPZ.js} +45 -45
  263. package/chunks/{workspace-trust-reconciler-FCRIUIOF.js → workspace-trust-reconciler-YTOL7QEV.js} +50 -50
  264. package/chunks/{write-file-PYL3JCCD.js → write-file-MSFRVUZB.js} +38 -38
  265. package/chunks/{zoom-image-RS6MU26F.js → zoom-image-4TQA5GHG.js} +12 -12
  266. package/cli.js +13 -13
  267. package/package.json +4 -4
  268. package/web-shell/assets/{arc-CgGUyHWd.js → arc-lZ04kynw.js} +1 -1
  269. package/web-shell/assets/{architectureDiagram-3BPJPVTR-BR0Qv-1Y.js → architectureDiagram-3BPJPVTR-B1wZVhzD.js} +1 -1
  270. package/web-shell/assets/{blockDiagram-GPEHLZMM-DIoaceaI.js → blockDiagram-GPEHLZMM-CO0e0yJt.js} +1 -1
  271. package/web-shell/assets/{c4Diagram-AAUBKEIU-Bc5k6BbI.js → c4Diagram-AAUBKEIU-Dfpo6Qie.js} +1 -1
  272. package/web-shell/assets/channel-BxvRq3pV.js +1 -0
  273. package/web-shell/assets/{chunk-2J33WTMH-DtPEz2WX.js → chunk-2J33WTMH-BvxArftT.js} +1 -1
  274. package/web-shell/assets/{chunk-4BX2VUAB-Dydo6ydE.js → chunk-4BX2VUAB-BS2XXjGY.js} +1 -1
  275. package/web-shell/assets/{chunk-55IACEB6-DD9_VWXm.js → chunk-55IACEB6-CYL6h3Ph.js} +1 -1
  276. package/web-shell/assets/{chunk-727SXJPM-DVI2m59k.js → chunk-727SXJPM-C-cWPX30.js} +1 -1
  277. package/web-shell/assets/{chunk-AQP2D5EJ-luatmaTN.js → chunk-AQP2D5EJ-CJLxNbVV.js} +1 -1
  278. package/web-shell/assets/{chunk-FMBD7UC4-Duy8NTIi.js → chunk-FMBD7UC4-DwfzKywA.js} +1 -1
  279. package/web-shell/assets/{chunk-ND2GUHAM-CrL1yhms.js → chunk-ND2GUHAM-BI5raYHQ.js} +1 -1
  280. package/web-shell/assets/{chunk-QZHKN3VN-C7BX6bu1.js → chunk-QZHKN3VN-_GkNI90J.js} +1 -1
  281. package/web-shell/assets/classDiagram-4FO5ZUOK-tL8nAxYf.js +1 -0
  282. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-tL8nAxYf.js +1 -0
  283. package/web-shell/assets/{cose-bilkent-S5V4N54A-BTzs7mIi.js → cose-bilkent-S5V4N54A-BAVLNxh9.js} +1 -1
  284. package/web-shell/assets/{dagre-BM42HDAG-3VTUmWts.js → dagre-BM42HDAG-BD4XNLqp.js} +1 -1
  285. package/web-shell/assets/{diagram-2AECGRRQ-Ehdp75GN.js → diagram-2AECGRRQ-WO567p8w.js} +1 -1
  286. package/web-shell/assets/{diagram-5GNKFQAL-B3wu3teE.js → diagram-5GNKFQAL-mAk23VWO.js} +1 -1
  287. package/web-shell/assets/{diagram-KO2AKTUF-DjgTSf2S.js → diagram-KO2AKTUF-YQEeHKze.js} +1 -1
  288. package/web-shell/assets/{diagram-LMA3HP47-Br9mwjY3.js → diagram-LMA3HP47-CMVjxAjv.js} +1 -1
  289. package/web-shell/assets/{diagram-OG6HWLK6-D4xz5M-z.js → diagram-OG6HWLK6-42hPvbM-.js} +1 -1
  290. package/web-shell/assets/{erDiagram-TEJ5UH35-CXayWlG_.js → erDiagram-TEJ5UH35-CXU_cPfu.js} +1 -1
  291. package/web-shell/assets/{flowDiagram-I6XJVG4X-CLonjQTi.js → flowDiagram-I6XJVG4X-D-3TdhMT.js} +1 -1
  292. package/web-shell/assets/{ganttDiagram-6RSMTGT7-BTySFT-1.js → ganttDiagram-6RSMTGT7-CsgkXolz.js} +1 -1
  293. package/web-shell/assets/{gitGraphDiagram-PVQCEYII--2WcUjOe.js → gitGraphDiagram-PVQCEYII-B6Q3PBLD.js} +1 -1
  294. package/web-shell/assets/{index-DPJHkFOG.js → index-BFrkGj2B.js} +1 -1
  295. package/web-shell/assets/index-BgjULKyF.css +5 -0
  296. package/web-shell/assets/index-CxXlPYfl.js +1789 -0
  297. package/web-shell/assets/{infoDiagram-5YYISTIA-9vpgAf1m.js → infoDiagram-5YYISTIA-jiAfSXp8.js} +1 -1
  298. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-DcRpHnAW.js → ishikawaDiagram-YF4QCWOH-BWif5KeJ.js} +1 -1
  299. package/web-shell/assets/{journeyDiagram-JHISSGLW-C2TKorRm.js → journeyDiagram-JHISSGLW-B-GAZthS.js} +1 -1
  300. package/web-shell/assets/{kanban-definition-UN3LZRKU-DdsFwB8b.js → kanban-definition-UN3LZRKU-9TEuATdL.js} +1 -1
  301. package/web-shell/assets/{linear-7PjRvJrf.js → linear-dy_QPfyE.js} +1 -1
  302. package/web-shell/assets/{mermaid.core-raDXa11C.js → mermaid.core-DB2uLAnq.js} +5 -5
  303. package/web-shell/assets/{mindmap-definition-RKZ34NQL-DLHc-PRN.js → mindmap-definition-RKZ34NQL-ey_dyxi-.js} +1 -1
  304. package/web-shell/assets/{pieDiagram-4H26LBE5-BftYpeTW.js → pieDiagram-4H26LBE5-_6BuMdDj.js} +1 -1
  305. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-O-6ygOYn.js → quadrantDiagram-W4KKPZXB-B2rM19W2.js} +1 -1
  306. package/web-shell/assets/{requirementDiagram-4Y6WPE33-BmZWVufJ.js → requirementDiagram-4Y6WPE33-DWj8b7vW.js} +1 -1
  307. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-2x5beiWt.js → sankeyDiagram-5OEKKPKP-D5dtYh0N.js} +1 -1
  308. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-BH8uKokQ.js → sequenceDiagram-3UESZ5HK-DVkdn_qW.js} +1 -1
  309. package/web-shell/assets/{stateDiagram-AJRCARHV-Dq1MFgX_.js → stateDiagram-AJRCARHV-DgwD_fi6.js} +1 -1
  310. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BWGkVGVB.js +1 -0
  311. package/web-shell/assets/{timeline-definition-PNZ67QCA-Cl2WKbv9.js → timeline-definition-PNZ67QCA-vNr_1UNX.js} +1 -1
  312. package/web-shell/assets/{vennDiagram-CIIHVFJN-BqoRo_Q-.js → vennDiagram-CIIHVFJN-ChFcGAcu.js} +1 -1
  313. package/web-shell/assets/{wardley-L42UT6IY-BTxp-Yot.js → wardley-L42UT6IY-C8PXoSWk.js} +1 -1
  314. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-DFXVCSH2.js → wardleyDiagram-YWT4CUSO-C2nqOV6i.js} +1 -1
  315. package/web-shell/assets/{xychartDiagram-2RQKCTM6-qQhWx0aE.js → xychartDiagram-2RQKCTM6-BntaqhSB.js} +1 -1
  316. package/web-shell/index.html +2 -2
  317. package/chunks/nonInteractiveCli-ZHW6F76F.js +0 -166
  318. package/web-shell/assets/channel-D2b9IYpS.js +0 -1
  319. package/web-shell/assets/classDiagram-4FO5ZUOK-DHatTCmD.js +0 -1
  320. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-DHatTCmD.js +0 -1
  321. package/web-shell/assets/index-CIFO52Wx.css +0 -5
  322. package/web-shell/assets/index-bhq3CUUF.js +0 -1789
  323. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-spuAYji6.js +0 -1
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  recomputeMcpGating
5
- } from "./chunk-V4MJ56RS.js";
5
+ } from "./chunk-OIZWCOYC.js";
6
6
  import {
7
7
  classifyApiError
8
8
  } from "./chunk-V7RNNPGC.js";
@@ -18,17 +18,17 @@ import {
18
18
  matchMcpServerByRef,
19
19
  parseExtensionRef,
20
20
  parseMcpServerRef
21
- } from "./chunk-HBZUU4AE.js";
21
+ } from "./chunk-JGD35ZSJ.js";
22
22
  import "./chunk-WLML6VIA.js";
23
23
  import {
24
24
  getAvailableCommands,
25
25
  handleSlashCommand,
26
26
  insertAfterFunctionResponses,
27
27
  normalizePartList
28
- } from "./chunk-UOMZKPI5.js";
28
+ } from "./chunk-MUN34TTF.js";
29
29
  import {
30
30
  isSlashCommand
31
- } from "./chunk-3TT6MZHJ.js";
31
+ } from "./chunk-DUFZ3OW6.js";
32
32
  import {
33
33
  SessionIdConflictError,
34
34
  appEvents,
@@ -36,46 +36,47 @@ import {
36
36
  cleanupReviewWorktreeLeases,
37
37
  loadCliConfig,
38
38
  normalizeDisabledToolList
39
- } from "./chunk-UZPWH6SP.js";
39
+ } from "./chunk-CTEGMF77.js";
40
40
  import {
41
41
  getCommandSubcommandNames
42
- } from "./chunk-UNCIELQJ.js";
42
+ } from "./chunk-VRQD5D7R.js";
43
43
  import {
44
44
  getEffectiveSupportedModes
45
- } from "./chunk-M4OYAR6J.js";
45
+ } from "./chunk-QXFAQDBV.js";
46
46
  import "./chunk-NYX53SV4.js";
47
- import "./chunk-FRH4SSGX.js";
47
+ import "./chunk-UPUAGRKY.js";
48
48
  import {
49
49
  collectContextData,
50
50
  formatContextUsageText
51
- } from "./chunk-32VOOMEF.js";
51
+ } from "./chunk-TB6DPBE4.js";
52
52
  import "./chunk-4WGODMVR.js";
53
53
  import {
54
54
  isGoalStatusKind
55
55
  } from "./chunk-EKTCKZV5.js";
56
- import "./chunk-NELCY6JT.js";
56
+ import "./chunk-6LDLDK6E.js";
57
57
  import {
58
58
  startNonInteractiveOpenAILogHousekeeping
59
- } from "./chunk-N3FJOQX7.js";
59
+ } from "./chunk-KB4ISUT3.js";
60
60
  import "./chunk-KW7NOTN6.js";
61
- import "./chunk-575MI5K3.js";
62
- import "./chunk-TEKFBSMY.js";
63
- import "./chunk-7D4KEFOT.js";
61
+ import "./chunk-LIBTBTHP.js";
62
+ import "./chunk-6T5HCY34.js";
63
+ import "./chunk-L3YACXS2.js";
64
64
  import "./chunk-YAF2MQZ6.js";
65
65
  import {
66
66
  computeCpuPercent
67
67
  } from "./chunk-LBOVL47Y.js";
68
- import "./chunk-ILVATFYJ.js";
68
+ import "./chunk-SFBRH5RY.js";
69
69
  import "./chunk-6H67XLET.js";
70
70
  import {
71
71
  beginAcpBootstrapConfigProfiling,
72
72
  buildAndFreezeAcpStartupProfile,
73
73
  endAcpBootstrapConfigProfiling,
74
74
  markAcpStartup
75
- } from "./chunk-M2NMFAFR.js";
75
+ } from "./chunk-ZZ7RUTJ4.js";
76
76
  import {
77
77
  GENERATION_MAX_PROMPT_BYTES,
78
78
  GENERATION_TIMEOUT_MS,
79
+ HistoryReplayLimitError,
79
80
  MAX_REMEMBER_CONTENT_BYTES,
80
81
  REDACTED_MCP_SECRET,
81
82
  collectHistoryReplayUpdates,
@@ -94,7 +95,7 @@ import {
94
95
  shouldSuppressRememberErrorDetails,
95
96
  workspaceMemoryFailureCode,
96
97
  workspaceMemoryFailureDiagnostics
97
- } from "./chunk-KIFRFCCB.js";
98
+ } from "./chunk-UWIJU22K.js";
98
99
  import "./chunk-ZBBVBZBR.js";
99
100
  import {
100
101
  BaseEmitter,
@@ -104,10 +105,10 @@ import {
104
105
  createTranscriptMessageUpdate,
105
106
  createTranscriptUsageUpdate,
106
107
  hasFullSessionContext
107
- } from "./chunk-VWD7SNNN.js";
108
- import "./chunk-47FQVRCO.js";
108
+ } from "./chunk-APQTLUZ3.js";
109
+ import "./chunk-EGB2PIYM.js";
109
110
  import "./chunk-4NFY2S7N.js";
110
- import "./chunk-U6PTKAOW.js";
111
+ import "./chunk-FNVF5RR4.js";
111
112
  import "./chunk-2MIN6GRR.js";
112
113
  import "./chunk-QHTIBUWB.js";
113
114
  import "./chunk-3Z43GZUQ.js";
@@ -118,32 +119,32 @@ import {
118
119
  normalizeSessionIdForLookup,
119
120
  parseCallerSuppliedSessionId
120
121
  } from "./chunk-TQOF5KBL.js";
121
- import "./chunk-HGCQ5SE7.js";
122
+ import "./chunk-UXEO7E3V.js";
122
123
  import {
123
124
  PERMISSION_RULE_TYPES,
124
125
  PermissionRulesValidationError,
125
126
  buildPermissionSettings,
126
127
  normalizePermissionRules,
127
128
  readPermissionRuleSet
128
- } from "./chunk-SSAOTDK7.js";
129
+ } from "./chunk-Y2EOB7WZ.js";
129
130
  import {
130
131
  MAX_AUDIO_BYTES,
131
132
  sanitizeVoiceErrorMessage,
132
133
  transcribeVoiceAudio
133
- } from "./chunk-VQZXRLEX.js";
134
+ } from "./chunk-Y2HK3ELT.js";
134
135
  import {
135
136
  readVoiceModel
136
- } from "./chunk-5UPJ774B.js";
137
- import "./chunk-IQFYO5BF.js";
137
+ } from "./chunk-BGIKUE5J.js";
138
+ import "./chunk-5KZNWF2M.js";
138
139
  import "./chunk-NTTBXH7U.js";
139
- import "./chunk-JEMR2FTD.js";
140
+ import "./chunk-WIHSDI6U.js";
140
141
  import "./chunk-3SH53ANB.js";
141
142
  import {
142
143
  SESSION_SOURCE_META_KEY,
143
144
  parseSessionSource
144
- } from "./chunk-O5G7IQGM.js";
145
- import "./chunk-MZSJ43WV.js";
146
- import "./chunk-XCGIMOLN.js";
145
+ } from "./chunk-A2QIWDFO.js";
146
+ import "./chunk-JVY7FHUZ.js";
147
+ import "./chunk-WCCLLK7X.js";
147
148
  import "./chunk-OCPBI7J5.js";
148
149
  import {
149
150
  ACP_ROUTE_ID_PREFIX,
@@ -153,26 +154,26 @@ import {
153
154
  parseAcpModelOption,
154
155
  resolveAcpModelOption,
155
156
  sanitizeProviderBaseUrl
156
- } from "./chunk-NPE3STIW.js";
157
+ } from "./chunk-3JI5D6RU.js";
157
158
  import {
158
159
  mapSkillConfigToStatus
159
160
  } from "./chunk-BGXZBI5B.js";
160
161
  import {
161
162
  resolveSkillSettings
162
163
  } from "./chunk-Z4X5MTRT.js";
163
- import "./chunk-TRYJ3BVE.js";
164
- import "./chunk-LHY6HBRA.js";
164
+ import "./chunk-N56NYJWY.js";
165
+ import "./chunk-N3J3CO35.js";
165
166
  import "./chunk-57OAHC2Y.js";
166
- import "./chunk-YTYPRVIZ.js";
167
- import "./chunk-ENEEQMGM.js";
168
- import "./chunk-DEG7R6Z6.js";
167
+ import "./chunk-VUTOV2HG.js";
168
+ import "./chunk-XY7DGTIC.js";
169
+ import "./chunk-TN3REXN4.js";
169
170
  import "./chunk-V6WHFGST.js";
170
171
  import {
171
172
  createLoadedSettingsAdapter
172
- } from "./chunk-DYVCDQW2.js";
173
+ } from "./chunk-QSMZHJ62.js";
173
174
  import {
174
175
  ndJsonStream
175
- } from "./chunk-TYGKUOEG.js";
176
+ } from "./chunk-2U3UCXZ3.js";
176
177
  import {
177
178
  ACP_PREFLIGHT_KINDS,
178
179
  IDLE_HOOK_EVENTS,
@@ -180,9 +181,9 @@ import {
180
181
  SERVE_STATUS_EXT_METHODS,
181
182
  STATUS_SCHEMA_VERSION,
182
183
  mapDomainErrorToErrorKind
183
- } from "./chunk-OPBATTFQ.js";
184
- import "./chunk-3GCU5O2E.js";
185
- import "./chunk-N5ULBHP3.js";
184
+ } from "./chunk-NHZF4VCD.js";
185
+ import "./chunk-U7ROFHSH.js";
186
+ import "./chunk-QSDPJROT.js";
186
187
  import {
187
188
  ACTIVE_WORK_CLOSE_IF_UNHELD_PARAM,
188
189
  ACTIVE_WORK_HEARTBEAT_META_KEY,
@@ -197,6 +198,8 @@ import {
197
198
  DAEMON_PROMPT_DISPLAY_TEXT_META_KEY,
198
199
  LOAD_REPLAY_BULK_MODE,
199
200
  LOAD_REPLAY_HIDE_INHERITED_META_KEY,
201
+ LOAD_REPLAY_MAX_BYTES,
202
+ LOAD_REPLAY_MAX_UPDATES,
200
203
  LOAD_REPLAY_META_KEY,
201
204
  LOAD_REPLAY_MODE_META_KEY,
202
205
  LOAD_REPLAY_PAGE_SIZE_META_KEY,
@@ -209,7 +212,7 @@ import {
209
212
  WORKTREE_MCP_DEFER_META_KEY,
210
213
  clampActiveWorkIntervalMs,
211
214
  isValidTrustedModelPrompt
212
- } from "./chunk-HHGQGTJQ.js";
215
+ } from "./chunk-UFHPAMAV.js";
213
216
  import {
214
217
  NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE,
215
218
  isNotCurrentlyGeneratingCancelError
@@ -217,7 +220,7 @@ import {
217
220
  import "./chunk-6PLDPT2C.js";
218
221
  import "./chunk-FYJ7W2PI.js";
219
222
  import "./chunk-YP5KH5Y7.js";
220
- import "./chunk-K7JW6V5O.js";
223
+ import "./chunk-JW5UEE3V.js";
221
224
  import "./chunk-ALMR3E6Q.js";
222
225
  import "./chunk-HIBNSEJE.js";
223
226
  import "./chunk-M5GB774H.js";
@@ -231,17 +234,17 @@ import {
231
234
  import {
232
235
  ACP_EVENT_LOOP_STALL_RESTART_MS,
233
236
  CHANNEL_PROMPT_META_KEY
234
- } from "./chunk-LT532KF4.js";
237
+ } from "./chunk-ADJDLEVO.js";
235
238
  import {
236
239
  AgentSideConnection,
237
240
  PROTOCOL_VERSION,
238
241
  RequestError
239
242
  } from "./chunk-IW6RQPQB.js";
240
- import "./chunk-AQHNAA7E.js";
243
+ import "./chunk-7JL5YBSA.js";
241
244
  import {
242
245
  assembleMcpServers,
243
246
  loadMcpApprovals
244
- } from "./chunk-4M2F7OG7.js";
247
+ } from "./chunk-PYLVQ6RT.js";
245
248
  import {
246
249
  getOutputLanguageFilePath,
247
250
  getPersistScopeForModelSelection,
@@ -250,9 +253,9 @@ import {
250
253
  resolveOutputLanguageOrPreserveAuto,
251
254
  updateOutputLanguageFile,
252
255
  writeOutputLanguageAndRegisterPath
253
- } from "./chunk-M6SXIXBV.js";
256
+ } from "./chunk-H2U4FK62.js";
254
257
  import "./chunk-RKUWKYED.js";
255
- import "./chunk-L7T742G2.js";
258
+ import "./chunk-4X5J3V2I.js";
256
259
  import "./chunk-GOXKNSDZ.js";
257
260
  import {
258
261
  getSystemDefaultsPath,
@@ -261,7 +264,7 @@ import {
261
264
  import {
262
265
  getCurrentLanguage,
263
266
  setLanguageAsync
264
- } from "./chunk-GYBDYWMV.js";
267
+ } from "./chunk-JXS2JNMZ.js";
265
268
  import {
266
269
  SUPPORTED_LANGUAGES
267
270
  } from "./chunk-5EJZE3FP.js";
@@ -269,17 +272,17 @@ import {
269
272
  findEnvFiles,
270
273
  preResolveHomeEnvOverrides,
271
274
  reloadEnvironment
272
- } from "./chunk-RRQJPCRQ.js";
275
+ } from "./chunk-FXWGMPAP.js";
273
276
  import {
274
277
  ENV_ACP_REPEATED_TOOL_FAILURE_GUARD
275
278
  } from "./chunk-MS7GNABG.js";
276
- import "./chunk-M2PY7CNK.js";
277
- import "./chunk-VJNBRRZG.js";
279
+ import "./chunk-V2U6FOJB.js";
280
+ import "./chunk-WZMH7II3.js";
278
281
  import {
279
282
  isFolderTrustEnabled,
280
283
  isWorkspaceTrusted,
281
284
  loadTrustedFolders
282
- } from "./chunk-4ETA3KRC.js";
285
+ } from "./chunk-ZA2JN5IZ.js";
283
286
  import "./chunk-NPQ5ZKRP.js";
284
287
  import "./chunk-MR3PXB6E.js";
285
288
  import "./chunk-XFSFZCM5.js";
@@ -332,6 +335,7 @@ import {
332
335
  buildPermissionCheckContext,
333
336
  buildSessionRecoveryPlanFromApiHistory,
334
337
  clampInlineMediaPart,
338
+ collectSessionTurnState,
335
339
  computeUniqueBranchTitle,
336
340
  convertToFunctionErrorResponse,
337
341
  convertToFunctionResponse,
@@ -348,7 +352,6 @@ import {
348
352
  evaluatePlanModeShellPolicy,
349
353
  evaluateToolInvocationGuard,
350
354
  finalizeToolResponses,
351
- findBoundaryAtOrBefore,
352
355
  findExistingProviderModels,
353
356
  findPlanModeEntryBatchBoundaryIndex,
354
357
  findProviderById,
@@ -381,7 +384,6 @@ import {
381
384
  isDenialFallbackReason,
382
385
  isGatedMcpScope,
383
386
  isPlanModeBlocked,
384
- isReplayTurnStartType,
385
387
  markDuplicateProviderToolCallResponseSent,
386
388
  matchesAnyServerPattern,
387
389
  mcpServerRequiresOAuth,
@@ -401,7 +403,6 @@ import {
401
403
  runForkedAgent,
402
404
  runManagedAutoMemoryDream,
403
405
  runManagedRememberByAgent,
404
- sessionIdContext,
405
406
  shouldClassifyAllShellForAutoMode,
406
407
  shouldFallback,
407
408
  shouldFirePermissionDeniedForAutoMode,
@@ -413,25 +414,25 @@ import {
413
414
  updateSetting,
414
415
  validatePlanModeShellApproval,
415
416
  validatePlanModeShellContext
416
- } from "./chunk-M6HXP2SG.js";
417
+ } from "./chunk-GHOUZ5X4.js";
417
418
  import "./chunk-GOFAQQZA.js";
418
419
  import "./chunk-5M6IDOMF.js";
419
420
  import "./chunk-TWPJO254.js";
420
421
  import {
421
422
  external_exports
422
423
  } from "./chunk-CQ35AJ4Z.js";
423
- import "./chunk-QTI7SRXI.js";
424
- import "./chunk-KT4OWAAZ.js";
425
- import "./chunk-IX7CFQGA.js";
426
- import "./chunk-N7NBMAMW.js";
424
+ import "./chunk-NM33GGOM.js";
425
+ import "./chunk-A4BAHMJF.js";
426
+ import "./chunk-ZPZANKVP.js";
427
+ import "./chunk-A6GQUQ7I.js";
427
428
  import {
428
429
  parsePositiveIntegerEnv
429
430
  } from "./chunk-6PVPNMXU.js";
430
- import "./chunk-I4XSOFH2.js";
431
+ import "./chunk-JBZYGFIB.js";
431
432
  import "./chunk-IRH27ZC2.js";
432
433
  import "./chunk-QHWCP53L.js";
433
- import "./chunk-XLQS3VI6.js";
434
- import "./chunk-NWPO6I7V.js";
434
+ import "./chunk-AAZWJAPQ.js";
435
+ import "./chunk-7WUMS2UA.js";
435
436
  import {
436
437
  promptIdContext,
437
438
  todoWorkChainContext
@@ -441,35 +442,38 @@ import "./chunk-ZPJWUGCS.js";
441
442
  import "./chunk-CPBF7KYF.js";
442
443
  import {
443
444
  APPROVAL_MODES
444
- } from "./chunk-6LYDH7VT.js";
445
- import "./chunk-2AZMF6G5.js";
445
+ } from "./chunk-SNHBRO4C.js";
446
+ import "./chunk-KTWUFHS4.js";
446
447
  import "./chunk-KRXPRVGL.js";
447
448
  import {
448
449
  HookEventName,
449
450
  createHookOutput
450
- } from "./chunk-GZGDJ4E6.js";
451
- import "./chunk-T6W4KACQ.js";
452
- import "./chunk-MWZYNOCG.js";
451
+ } from "./chunk-2ASWIM4A.js";
452
+ import "./chunk-67F2BEYW.js";
453
+ import "./chunk-TNETSI2A.js";
453
454
  import {
454
455
  GoalPersistenceUnavailableError,
455
456
  emptyGoalSnapshot,
456
457
  goalTurnContext,
458
+ parseGoalSnapshotV2,
459
+ parseGoalStateCause,
457
460
  wrapUserPromptSubmitContext
458
- } from "./chunk-SAQHDAUJ.js";
459
- import "./chunk-6XZERB6P.js";
461
+ } from "./chunk-B66LYK4B.js";
462
+ import "./chunk-VPZMLGD3.js";
460
463
  import {
464
+ addDaemonRequestAttribute,
461
465
  addToolArgumentsAttributes,
462
466
  addToolCallResultAttributes,
463
467
  extractDaemonTraceContext,
464
468
  registerAcpEventLoopLagGauge,
465
469
  startEventLoopLagMonitor,
466
470
  withDaemonSpan
467
- } from "./chunk-O5AZPHYZ.js";
471
+ } from "./chunk-U5C2GIN2.js";
468
472
  import "./chunk-SAH4BD2J.js";
469
- import "./chunk-5PWLQ7SK.js";
473
+ import "./chunk-2RTRFLWH.js";
470
474
  import {
471
475
  runWithRuntimeContentGenerator
472
- } from "./chunk-EYS3GGM3.js";
476
+ } from "./chunk-SKRHR6N2.js";
473
477
  import "./chunk-S6LOFUVP.js";
474
478
  import "./chunk-2J3OJGTL.js";
475
479
  import {
@@ -504,26 +508,26 @@ import {
504
508
  shouldRunVisionBridge,
505
509
  splitImageParts,
506
510
  uiTelemetryService
507
- } from "./chunk-HB6QW4LM.js";
511
+ } from "./chunk-UAAWNTOC.js";
508
512
  import "./chunk-YRLW2MSX.js";
509
513
  import "./chunk-VGC4I5JJ.js";
510
514
  import {
511
515
  getAutoMemoryRoot,
512
516
  getUserAutoMemoryRoot
513
- } from "./chunk-732MOPEM.js";
517
+ } from "./chunk-6OJDN5ZT.js";
514
518
  import {
515
519
  runSideQuery
516
- } from "./chunk-CTQE2NB2.js";
517
- import "./chunk-NC4O6UE6.js";
518
- import "./chunk-IEP44U2R.js";
520
+ } from "./chunk-JRTJEGSP.js";
521
+ import "./chunk-O6SLWH4X.js";
522
+ import "./chunk-C2DR57L6.js";
519
523
  import {
520
524
  FORK_SUBAGENT_TYPE,
521
525
  getStartupContextLength,
522
526
  isSystemReminderContent
523
- } from "./chunk-ZV4XVYL3.js";
527
+ } from "./chunk-TROB4PZY.js";
524
528
  import "./chunk-K623ENWT.js";
525
529
  import "./chunk-AQ37AY7B.js";
526
- import "./chunk-V3LXMASR.js";
530
+ import "./chunk-UHF5VBKO.js";
527
531
  import {
528
532
  BaseDeclarativeTool,
529
533
  BaseToolInvocation,
@@ -531,23 +535,23 @@ import {
531
535
  ToolNames,
532
536
  canonicalToolName,
533
537
  isShellProgressData
534
- } from "./chunk-XTH2OMDS.js";
538
+ } from "./chunk-ZRT36RSF.js";
535
539
  import {
536
540
  clearCachedCredentialFile,
537
541
  qwenOAuth2Events
538
- } from "./chunk-TBVNYG5B.js";
542
+ } from "./chunk-CDDLHCC2.js";
539
543
  import "./chunk-NAVJD2PQ.js";
540
- import "./chunk-5HBFERG5.js";
541
- import "./chunk-EYW54TBD.js";
544
+ import "./chunk-YI5G32RU.js";
545
+ import "./chunk-QEWAHAW2.js";
542
546
  import "./chunk-P3QQPMQA.js";
543
- import "./chunk-O4BBDP2G.js";
544
- import "./chunk-KPVVWKF3.js";
547
+ import "./chunk-FTGU6G45.js";
548
+ import "./chunk-PSTHNTHF.js";
545
549
  import {
546
550
  AuthType,
547
551
  preloadContentGenerator
548
- } from "./chunk-XWUQ4IH5.js";
552
+ } from "./chunk-XJ6IMYUS.js";
549
553
  import "./chunk-F6WFNA7U.js";
550
- import "./chunk-F6AOBFUN.js";
554
+ import "./chunk-NW7SPXVG.js";
551
555
  import {
552
556
  REASONING_EFFORT_TIERS,
553
557
  applyReasoningEffort
@@ -557,14 +561,14 @@ import "./chunk-AXMWHKXA.js";
557
561
  import {
558
562
  getToolCallPreparations
559
563
  } from "./chunk-GLCZKT5V.js";
560
- import "./chunk-GJJQV4PY.js";
564
+ import "./chunk-KK3FEHPJ.js";
561
565
  import "./chunk-46UV252V.js";
562
566
  import {
563
567
  DEFAULT_TOKEN_LIMIT,
564
568
  tokenLimit
565
569
  } from "./chunk-FPGTNKCP.js";
566
570
  import "./chunk-DJ2GSRLV.js";
567
- import "./chunk-EFIMD5VA.js";
571
+ import "./chunk-H6BFLALJ.js";
568
572
  import {
569
573
  endToolExecutionSpan,
570
574
  endToolSpan,
@@ -573,21 +577,23 @@ import {
573
577
  startToolExecutionSpan,
574
578
  startToolSpan,
575
579
  withInteractionSpan
576
- } from "./chunk-E5BWLU5J.js";
580
+ } from "./chunk-3MJ44LNC.js";
577
581
  import "./chunk-HHJLM3WQ.js";
578
- import "./chunk-L2GTEEEU.js";
582
+ import {
583
+ sessionIdContext
584
+ } from "./chunk-K5IDV3PC.js";
579
585
  import {
580
586
  Storage,
581
587
  createDebugLogger,
582
588
  getErrorMessage,
583
589
  getErrorStatus,
584
590
  isSubpath
585
- } from "./chunk-MPBRV3UU.js";
591
+ } from "./chunk-YMB77M76.js";
586
592
  import "./chunk-VOQXFAY5.js";
587
- import "./chunk-CZXQ4UZA.js";
593
+ import "./chunk-BXAGPCYH.js";
588
594
  import {
589
595
  runExitCleanup
590
- } from "./chunk-J7DNMZFO.js";
596
+ } from "./chunk-NX5QZVRS.js";
591
597
  import {
592
598
  writeStderrLine,
593
599
  writeStderrLineSafe
@@ -1650,8 +1656,12 @@ var MessageEmitter = class extends BaseEmitter {
1650
1656
  }
1651
1657
  });
1652
1658
  }
1653
- async emitGoalStatus(status) {
1654
- await this.sendUpdate(buildGoalStatusUpdate(status));
1659
+ async emitGoalStatus(status, goalState) {
1660
+ const update = buildGoalStatusUpdate(status);
1661
+ if (goalState) {
1662
+ update._meta = { ...update._meta, goalState };
1663
+ }
1664
+ await this.sendUpdate(update);
1655
1665
  }
1656
1666
  async emitGoalState(snapshot, cause, previousGoal = null) {
1657
1667
  await this.sendUpdate(buildGoalStateUpdate(snapshot, cause, previousGoal));
@@ -1786,6 +1796,58 @@ var MessageEmitter = class extends BaseEmitter {
1786
1796
  }
1787
1797
  };
1788
1798
 
1799
+ // packages/cli/src/acp-integration/session/recovered-goal-update.ts
1800
+ init_esbuild_shims();
1801
+ async function renderPreparedGoalUpdate(getRuntime, options = {}) {
1802
+ let runtime;
1803
+ try {
1804
+ runtime = await getRuntime();
1805
+ } catch (error) {
1806
+ if (!(error instanceof GoalPersistenceUnavailableError)) throw error;
1807
+ const status = unrestorableGoalStatus(
1808
+ options.replayedRecords,
1809
+ options.bootstrap
1810
+ );
1811
+ return { updates: status ? [buildGoalStatusUpdate(status)] : [] };
1812
+ }
1813
+ const cause = runtime.getRecoveryCause?.();
1814
+ if (!cause) return { updates: [] };
1815
+ const snapshot = runtime.getSnapshot();
1816
+ const publicationKey = goalPublicationKey(snapshot, cause);
1817
+ if (options.hideRuntimeGoal) {
1818
+ return {
1819
+ publicationKey,
1820
+ ...snapshot.goal ? {
1821
+ suppressedGoalId: snapshot.goal.goalId
1822
+ } : {},
1823
+ updates: []
1824
+ };
1825
+ }
1826
+ const bootstrapGoal = options.bootstrap?.goalState?.goal;
1827
+ const bootstrapMatchesRuntime = bootstrapGoal != null && snapshot.goal?.goalId === bootstrapGoal.goalId && snapshot.goal?.revision === bootstrapGoal.revision;
1828
+ return {
1829
+ publicationKey,
1830
+ updates: options.bootstrap && bootstrapMatchesRuntime ? [] : [buildGoalStateUpdate(snapshot, cause, options.previousGoal ?? null)]
1831
+ };
1832
+ }
1833
+ __name(renderPreparedGoalUpdate, "renderPreparedGoalUpdate");
1834
+ function unrestorableGoalStatus(replayedRecords, bootstrap) {
1835
+ const active = (replayedRecords?.length ? findGoalToRestore(collectGoalStatusItemsFromRecords(replayedRecords)) : void 0) ?? bootstrap?.goalStatus;
1836
+ if (!active) return void 0;
1837
+ return {
1838
+ kind: "cleared",
1839
+ condition: active.condition,
1840
+ iterations: active.iterations,
1841
+ ...active.setAt !== void 0 ? { setAt: active.setAt } : {},
1842
+ lastReason: "Goal not restored: its saved state could not be read, so this session is not driving it."
1843
+ };
1844
+ }
1845
+ __name(unrestorableGoalStatus, "unrestorableGoalStatus");
1846
+ function goalPublicationKey(snapshot, cause) {
1847
+ return cause ? `${cause}:${JSON.stringify(snapshot)}` : void 0;
1848
+ }
1849
+ __name(goalPublicationKey, "goalPublicationKey");
1850
+
1789
1851
  // packages/cli/src/acp-integration/session/SubAgentTracker.ts
1790
1852
  init_esbuild_shims();
1791
1853
 
@@ -3481,28 +3543,6 @@ function resolveHomeLoopResolverRoots({
3481
3543
  };
3482
3544
  }
3483
3545
  __name(resolveHomeLoopResolverRoots, "resolveHomeLoopResolverRoots");
3484
- function computeInitialTurnFromHistory(records, sessionId) {
3485
- let maxPromptTurn = 0;
3486
- let userMessageCount = 0;
3487
- const promptIdPrefix = `${sessionId}########`;
3488
- for (const record of records) {
3489
- if (record.sessionId === sessionId && isUserPromptRecord(record)) {
3490
- userMessageCount += 1;
3491
- }
3492
- for (const promptId of getRecordPromptIds(record)) {
3493
- if (!promptId.startsWith(promptIdPrefix)) {
3494
- continue;
3495
- }
3496
- const suffix = promptId.slice(promptIdPrefix.length);
3497
- if (!/^\d+$/.test(suffix)) {
3498
- continue;
3499
- }
3500
- maxPromptTurn = Math.max(maxPromptTurn, Number(suffix));
3501
- }
3502
- }
3503
- return maxPromptTurn > 0 ? maxPromptTurn : userMessageCount;
3504
- }
3505
- __name(computeInitialTurnFromHistory, "computeInitialTurnFromHistory");
3506
3546
  async function fireSessionPermissionDeniedForAutoMode(config, decision, outcome, toolName, toolParams, callId, signal) {
3507
3547
  if (!config.getDisableAllHooks?.() && shouldFirePermissionDeniedForAutoMode(decision, outcome)) {
3508
3548
  try {
@@ -3522,40 +3562,6 @@ async function fireSessionPermissionDeniedForAutoMode(config, decision, outcome,
3522
3562
  }
3523
3563
  }
3524
3564
  __name(fireSessionPermissionDeniedForAutoMode, "fireSessionPermissionDeniedForAutoMode");
3525
- function getRecordPromptIds(record) {
3526
- const promptIds = [];
3527
- const recordPromptId = record.promptId;
3528
- if (typeof recordPromptId === "string") {
3529
- promptIds.push(recordPromptId);
3530
- }
3531
- const telemetryPromptId = readTelemetryPromptId(record.systemPayload);
3532
- if (telemetryPromptId) {
3533
- promptIds.push(telemetryPromptId);
3534
- }
3535
- return promptIds;
3536
- }
3537
- __name(getRecordPromptIds, "getRecordPromptIds");
3538
- function readTelemetryPromptId(payload) {
3539
- if (!payload || typeof payload !== "object" || !("uiEvent" in payload)) {
3540
- return void 0;
3541
- }
3542
- const uiEvent = payload.uiEvent;
3543
- if (!uiEvent || typeof uiEvent !== "object" || !("prompt_id" in uiEvent)) {
3544
- return void 0;
3545
- }
3546
- const promptId = uiEvent.prompt_id;
3547
- return typeof promptId === "string" ? promptId : void 0;
3548
- }
3549
- __name(readTelemetryPromptId, "readTelemetryPromptId");
3550
- function isUserPromptRecord(record) {
3551
- if (record.type !== "user" || record.subtype === "realtime_message") {
3552
- return false;
3553
- }
3554
- return record.message?.parts?.some(
3555
- (part) => typeof part.text === "string" && part.text.trim().length > 0
3556
- ) ?? false;
3557
- }
3558
- __name(isUserPromptRecord, "isUserPromptRecord");
3559
3565
  var AT_TOKEN_RE = /@([^\s,;!?()[\]{}]+)/g;
3560
3566
  function collectExtensionMentionRefs(text, mentions) {
3561
3567
  for (const match of text.matchAll(AT_TOKEN_RE)) {
@@ -3788,6 +3794,9 @@ var Session = class {
3788
3794
  goalRuntimeUnsubscribe;
3789
3795
  lastGoalSnapshot;
3790
3796
  lastGoalPublicationKey;
3797
+ // Set only when runtime recovery selected a Goal that initial replay hid.
3798
+ // Keep that Goal private through activation and later progress updates.
3799
+ suppressedRecoveredGoalId;
3791
3800
  goalPublicationTail = Promise.resolve();
3792
3801
  // Set true in dispose(). Guards #drainCronQueue and #drainNotificationQueue
3793
3802
  // against the race where #drainNotificationQueue's finally block kicks off
@@ -3899,6 +3908,7 @@ var Session = class {
3899
3908
  this.goalHostUnbind = void 0;
3900
3909
  this.lastGoalSnapshot = void 0;
3901
3910
  this.lastGoalPublicationKey = void 0;
3911
+ this.suppressedRecoveredGoalId = void 0;
3902
3912
  this.#bindGoalRuntime();
3903
3913
  }
3904
3914
  /**
@@ -3936,50 +3946,36 @@ var Session = class {
3936
3946
  if (!cause) return;
3937
3947
  await this.#queueGoalState(runtime.getSnapshot(), cause);
3938
3948
  }
3939
- /**
3940
- * Render the recovered-Goal cards instead of streaming them.
3941
- *
3942
- * The bulk load-replay path (`historyReplay: 'response'`) does not stream
3943
- * its replay: `loadSession` collects the page into the `LOAD_REPLAY`
3944
- * envelope and the bridge seeds those updates onto the session's event bus
3945
- * *after* the ACP `session/load` call returns. A card streamed from inside
3946
- * that call therefore lands on the bus **before** the replayed
3947
- * pre-migration `set` card — the reverse of the ordering
3948
- * {@link publishRecoveredGoalState} exists to produce, leaving the phantom
3949
- * running goal exactly as it was. Returning the cards lets the caller
3950
- * append them to the envelope, after the replay page.
3951
- *
3952
- * Appending after a truncated page (`hasMore`) is still correct: paging
3953
- * drops the oldest records, so the authoritative state belongs last either
3954
- * way.
3955
- *
3956
- * Marks the publication as delivered, so the runtime subscription cannot
3957
- * emit a duplicate card for the same `(cause, snapshot)` once the session
3958
- * goes live.
3959
- */
3960
3949
  async renderRecoveredGoalUpdates(replayedRecords) {
3961
3950
  if (this.disposed || this.closing) return [];
3962
- let runtime;
3963
- try {
3964
- runtime = await this.config.getGoalRuntimeReady();
3965
- } catch (error) {
3966
- if (!(error instanceof GoalPersistenceUnavailableError)) throw error;
3967
- const status = this.#unrestorableGoalStatus(replayedRecords);
3968
- return status ? [buildGoalStatusUpdate(status)] : [];
3951
+ const rendered = await renderPreparedGoalUpdate(
3952
+ () => this.config.getGoalRuntimeReady(),
3953
+ {
3954
+ ...replayedRecords ? { replayedRecords } : {},
3955
+ previousGoal: this.lastGoalSnapshot?.goal ?? null
3956
+ }
3957
+ );
3958
+ if (rendered.publicationKey && rendered.publicationKey === this.lastGoalPublicationKey) {
3959
+ return [];
3969
3960
  }
3970
- const cause = runtime.getRecoveryCause?.();
3971
- if (!cause) return [];
3972
- const snapshot = runtime.getSnapshot();
3973
- const publicationKey = this.#goalPublicationKey(snapshot, cause);
3974
- if (publicationKey === this.lastGoalPublicationKey) return [];
3975
- this.lastGoalPublicationKey = publicationKey;
3976
- return [
3977
- buildGoalStateUpdate(
3978
- snapshot,
3979
- cause,
3980
- this.lastGoalSnapshot?.goal ?? null
3981
- )
3982
- ];
3961
+ this.primeRecoveredGoalPublication(rendered.publicationKey);
3962
+ return rendered.updates;
3963
+ }
3964
+ primeRecoveredGoalPublication(publicationKey, suppressedGoalId) {
3965
+ if (publicationKey) this.lastGoalPublicationKey = publicationKey;
3966
+ this.suppressedRecoveredGoalId = suppressedGoalId;
3967
+ }
3968
+ #suppressRecoveredGoalUpdate(snapshot) {
3969
+ const suppressedGoalId = this.suppressedRecoveredGoalId;
3970
+ if (!suppressedGoalId) return false;
3971
+ const goal = snapshot.goal;
3972
+ if (goal?.goalId === suppressedGoalId) return true;
3973
+ if (goal === null) {
3974
+ this.suppressedRecoveredGoalId = void 0;
3975
+ return true;
3976
+ }
3977
+ this.suppressedRecoveredGoalId = void 0;
3978
+ return false;
3983
3979
  }
3984
3980
  /**
3985
3981
  * Emit a trailing `cleared` card for an active legacy goal the runtime
@@ -4012,11 +4008,9 @@ var Session = class {
4012
4008
  lastReason: "Goal not restored: its saved state could not be read, so this session is not driving it."
4013
4009
  };
4014
4010
  }
4015
- #goalPublicationKey(snapshot, cause) {
4016
- return cause ? `${cause}:${JSON.stringify(snapshot)}` : void 0;
4017
- }
4018
4011
  async #publishGoalState(snapshot, cause, previousGoal = this.lastGoalSnapshot?.goal ?? null) {
4019
- const publicationKey = this.#goalPublicationKey(snapshot, cause);
4012
+ if (this.#suppressRecoveredGoalUpdate(snapshot)) return;
4013
+ const publicationKey = goalPublicationKey(snapshot, cause);
4020
4014
  if (publicationKey && publicationKey === this.lastGoalPublicationKey) {
4021
4015
  return;
4022
4016
  }
@@ -4940,22 +4934,25 @@ var Session = class {
4940
4934
  * Delegates to HistoryReplayer for consistent event emission.
4941
4935
  */
4942
4936
  primeTurnFromHistory(records) {
4943
- for (const record of records) {
4944
- if (record.subtype !== "notification") continue;
4945
- const backgroundTask = record.systemPayload?.backgroundTask;
4946
- if (typeof backgroundTask?.taskId === "string") {
4947
- this.persistedBackgroundNotificationTaskIds.add(backgroundTask.taskId);
4948
- }
4949
- }
4950
- this.turn = Math.max(
4951
- this.turn,
4952
- computeInitialTurnFromHistory(records, this.config.getSessionId())
4937
+ const turnState = collectSessionTurnState(
4938
+ records,
4939
+ this.config.getSessionId()
4940
+ );
4941
+ this.primeTurnState(
4942
+ turnState.initialTurn,
4943
+ turnState.backgroundNotificationTaskIds
4953
4944
  );
4954
4945
  }
4955
- async replayHistory(records, gaps) {
4946
+ primeTurnState(initialTurn, backgroundNotificationTaskIds) {
4947
+ for (const taskId of backgroundNotificationTaskIds) {
4948
+ this.persistedBackgroundNotificationTaskIds.add(taskId);
4949
+ }
4950
+ this.turn = Math.max(this.turn, initialTurn);
4951
+ }
4952
+ async replayHistory(records, gaps, options) {
4956
4953
  this.primeTurnFromHistory(records);
4957
4954
  try {
4958
- await this.historyReplayer.replay(records, gaps);
4955
+ await this.historyReplayer.replay(records, gaps, options);
4959
4956
  } finally {
4960
4957
  this.activeTodoPlanRevision = void 0;
4961
4958
  }
@@ -11498,6 +11495,162 @@ function shouldHideInheritedHistory(params) {
11498
11495
  return meta?.[LOAD_REPLAY_HIDE_INHERITED_META_KEY] === true;
11499
11496
  }
11500
11497
  __name(shouldHideInheritedHistory, "shouldHideInheritedHistory");
11498
+ function loadRestoreOptions(params) {
11499
+ const hideInheritedHistory = shouldHideInheritedHistory(params);
11500
+ if (!isBulkLoadReplayRequest(params)) {
11501
+ return { replay: { kind: "all", hideInheritedHistory } };
11502
+ }
11503
+ const limit = getLoadReplayPageSize(params);
11504
+ return limit === void 0 ? { replay: { kind: "all", hideInheritedHistory } } : { replay: { kind: "recent", limit, hideInheritedHistory } };
11505
+ }
11506
+ __name(loadRestoreOptions, "loadRestoreOptions");
11507
+ var RESUME_RESTORE_OPTIONS = {
11508
+ replay: { kind: "none" }
11509
+ };
11510
+ function mapSessionRestoreRequestError(error, sessionId) {
11511
+ const mappedWriterError = mapSessionWriterRequestError(error);
11512
+ if (mappedWriterError !== error) return mappedWriterError;
11513
+ if (error instanceof SessionTranscriptSnapshotUnavailableError) {
11514
+ return new RequestError(-32010, error.message, {
11515
+ errorKind: "transcript_snapshot_unavailable",
11516
+ sessionId
11517
+ });
11518
+ }
11519
+ if (error instanceof SessionTranscriptTooLargeError) {
11520
+ return new RequestError(-32011, error.message, {
11521
+ errorKind: "transcript_too_large",
11522
+ sessionId,
11523
+ snapshotSize: error.snapshotSize,
11524
+ maxBytes: error.maxBytes
11525
+ });
11526
+ }
11527
+ if (error instanceof SessionTranscriptPageTooLargeError) {
11528
+ addDaemonRequestAttribute(
11529
+ "qwen-code.daemon.session_restore.envelope_limit_reason",
11530
+ "bytes"
11531
+ );
11532
+ return new RequestError(-32012, error.message, {
11533
+ errorKind: "transcript_page_too_large",
11534
+ sessionId,
11535
+ pageBytes: error.pageBytes,
11536
+ maxBytes: error.maxBytes
11537
+ });
11538
+ }
11539
+ if (error instanceof HistoryReplayLimitError) {
11540
+ addDaemonRequestAttribute(
11541
+ "qwen-code.daemon.session_restore.envelope_limit_reason",
11542
+ error.reason
11543
+ );
11544
+ return new RequestError(-32012, error.message, {
11545
+ errorKind: "transcript_page_too_large",
11546
+ sessionId,
11547
+ reason: error.reason,
11548
+ observed: error.observed,
11549
+ limit: error.limit
11550
+ });
11551
+ }
11552
+ return error;
11553
+ }
11554
+ __name(mapSessionRestoreRequestError, "mapSessionRestoreRequestError");
11555
+ function validateLoadReplayEnvelope(sessionId, envelope, enforceLimits) {
11556
+ if (!enforceLimits) return;
11557
+ if (envelope.updates.length > LOAD_REPLAY_MAX_UPDATES) {
11558
+ throw new HistoryReplayLimitError(
11559
+ sessionId,
11560
+ "updates",
11561
+ envelope.updates.length,
11562
+ LOAD_REPLAY_MAX_UPDATES
11563
+ );
11564
+ }
11565
+ const pageBytes = Buffer.byteLength(JSON.stringify(envelope), "utf8");
11566
+ if (pageBytes > LOAD_REPLAY_MAX_BYTES) {
11567
+ throw new HistoryReplayLimitError(
11568
+ sessionId,
11569
+ "bytes",
11570
+ pageBytes,
11571
+ LOAD_REPLAY_MAX_BYTES
11572
+ );
11573
+ }
11574
+ }
11575
+ __name(validateLoadReplayEnvelope, "validateLoadReplayEnvelope");
11576
+ function replayGoalBootstrap(projection) {
11577
+ if (projection && !("runtime" in projection)) {
11578
+ const sourceUuid2 = projection.goalRecoverySourceUuid;
11579
+ if (!sourceUuid2) return void 0;
11580
+ if (projection.replay?.records.some((record) => record.uuid === sourceUuid2)) {
11581
+ return void 0;
11582
+ }
11583
+ const replay = projection.replay?.replay;
11584
+ if (isObjectRecord(replay)) {
11585
+ const bootstrap = HistoryReplayer.v2GoalBootstrap(
11586
+ replay["goalState"],
11587
+ replay["goalCause"]
11588
+ );
11589
+ if (bootstrap) return bootstrap;
11590
+ }
11591
+ const sourceRecord2 = projection.goalRecords?.find(
11592
+ (record) => record.uuid === sourceUuid2
11593
+ );
11594
+ if (sourceRecord2?.subtype === "goal_state") {
11595
+ const payload = isObjectRecord(sourceRecord2.systemPayload) ? sourceRecord2.systemPayload : void 0;
11596
+ return HistoryReplayer.v2GoalBootstrap(
11597
+ payload?.["snapshot"],
11598
+ payload?.["cause"]
11599
+ );
11600
+ }
11601
+ const active2 = findGoalToRestore(
11602
+ collectGoalStatusItemsFromRecords(projection.goalRecords ?? [])
11603
+ );
11604
+ return active2 ? {
11605
+ goalStatus: {
11606
+ kind: active2.iterations > 0 ? "checking" : "set",
11607
+ condition: active2.condition,
11608
+ iterations: active2.iterations,
11609
+ ...active2.setAt !== void 0 ? { setAt: active2.setAt } : {}
11610
+ }
11611
+ } : void 0;
11612
+ }
11613
+ const sourceUuid = projection?.replay?.goalRecoverySourceUuid;
11614
+ if (!projection?.replay || !sourceUuid) return void 0;
11615
+ if (projection.replay.records.some((record) => record.uuid === sourceUuid)) {
11616
+ return void 0;
11617
+ }
11618
+ const goalBootstrapRecords = projection.replay.goalBootstrapRecords ?? [];
11619
+ const sourceRecord = goalBootstrapRecords.find(
11620
+ (record) => record.uuid === sourceUuid
11621
+ );
11622
+ if (sourceRecord?.subtype === "goal_state") {
11623
+ const payload = isObjectRecord(sourceRecord.systemPayload) ? sourceRecord.systemPayload : void 0;
11624
+ return HistoryReplayer.v2GoalBootstrap(
11625
+ payload?.["snapshot"],
11626
+ payload?.["cause"]
11627
+ );
11628
+ }
11629
+ const active = findGoalToRestore(
11630
+ collectGoalStatusItemsFromRecords(goalBootstrapRecords)
11631
+ );
11632
+ if (!active) return void 0;
11633
+ return {
11634
+ goalStatus: {
11635
+ kind: active.iterations > 0 ? "checking" : "set",
11636
+ condition: active.condition,
11637
+ iterations: active.iterations,
11638
+ ...active.setAt !== void 0 ? { setAt: active.setAt } : {}
11639
+ }
11640
+ };
11641
+ }
11642
+ __name(replayGoalBootstrap, "replayGoalBootstrap");
11643
+ function replayInitialGoalState(projection) {
11644
+ const replay = projection?.replay?.replay;
11645
+ if (!isObjectRecord(replay)) return {};
11646
+ const initialGoalState = parseGoalSnapshotV2(replay["goalState"]);
11647
+ const initialGoalCause = parseGoalStateCause(replay["goalCause"]);
11648
+ return {
11649
+ ...initialGoalState ? { initialGoalState } : {},
11650
+ ...initialGoalCause ? { initialGoalCause } : {}
11651
+ };
11652
+ }
11653
+ __name(replayInitialGoalState, "replayInitialGoalState");
11501
11654
  function selectVisibleHistoryRecords(records, hideInheritedHistory) {
11502
11655
  const sourceBoundary = records.findIndex(
11503
11656
  (record) => record.type === "system" && record.subtype === "session_source" && isObjectRecord(record.systemPayload) && record.systemPayload["sourceType"] === "side_task"
@@ -11538,61 +11691,6 @@ function getLoadReplayPageSize(params) {
11538
11691
  return value;
11539
11692
  }
11540
11693
  __name(getLoadReplayPageSize, "getLoadReplayPageSize");
11541
- function isHistoryTurnStart(record) {
11542
- return isReplayTurnStartType(record.type, record.subtype);
11543
- }
11544
- __name(isHistoryTurnStart, "isHistoryTurnStart");
11545
- function isHistoryPageStart(record) {
11546
- return record.subtype !== "realtime_message" && (record.type === "assistant" || isHistoryTurnStart(record));
11547
- }
11548
- __name(isHistoryPageStart, "isHistoryPageStart");
11549
- function historyOrphansToolResult(records, start, end) {
11550
- for (let i = start; i < end; i++) {
11551
- if (records[i].type !== "tool_result") continue;
11552
- for (let owner = i - 1; owner >= start; owner--) {
11553
- if (isHistoryPageStart(records[owner])) return false;
11554
- }
11555
- return true;
11556
- }
11557
- return false;
11558
- }
11559
- __name(historyOrphansToolResult, "historyOrphansToolResult");
11560
- function selectRecentHistoryRecords(records, pageSize) {
11561
- if (pageSize === void 0 || records.length <= pageSize) {
11562
- return { records, hasMore: false };
11563
- }
11564
- let start = records.length - pageSize;
11565
- for (let i = start; i < records.length; i++) {
11566
- if (isHistoryTurnStart(records[i])) {
11567
- start = i;
11568
- break;
11569
- }
11570
- }
11571
- const expansionFloor = Math.max(0, records.length - 2 * pageSize);
11572
- const aligned = findBoundaryAtOrBefore(
11573
- records,
11574
- start,
11575
- expansionFloor,
11576
- isHistoryTurnStart
11577
- );
11578
- if (isHistoryTurnStart(records[aligned])) {
11579
- start = aligned;
11580
- }
11581
- if (start > 0 && historyOrphansToolResult(records, start, records.length)) {
11582
- const pairFloor = Math.max(0, start - pageSize);
11583
- const owner = findBoundaryAtOrBefore(
11584
- records,
11585
- start,
11586
- pairFloor,
11587
- isHistoryPageStart
11588
- );
11589
- if (isHistoryPageStart(records[owner])) {
11590
- start = owner;
11591
- }
11592
- }
11593
- return { records: records.slice(start), hasMore: start > 0 };
11594
- }
11595
- __name(selectRecentHistoryRecords, "selectRecentHistoryRecords");
11596
11694
  function createHiddenWorkspaceMemoryConfig(config) {
11597
11695
  return new Proxy(config, {
11598
11696
  get(target, prop) {
@@ -14062,7 +14160,7 @@ var QwenAgent = class {
14062
14160
  );
14063
14161
  }
14064
14162
  }
14065
- async withLiveSessionRestore(sessionId, session, operation) {
14163
+ async withLiveSessionRestore(sessionId, session, options, operation) {
14066
14164
  await session.assertCanStartTurn();
14067
14165
  const config = session.getConfig();
14068
14166
  const releaseGate = session.beginClose();
@@ -14073,12 +14171,12 @@ var QwenAgent = class {
14073
14171
  "restore"
14074
14172
  );
14075
14173
  const recorder = config.getChatRecordingService();
14076
- const loadAuthoritative = /* @__PURE__ */ __name(() => config.getSessionService().loadSession(sessionId), "loadAuthoritative");
14077
- const data = recorder ? await recorder.runWithWriteBarrier(loadAuthoritative) : await loadAuthoritative();
14078
- if (!data) throw new SessionWriterUnavailableError();
14079
- return await operation(config, data);
14174
+ const readProjection = /* @__PURE__ */ __name(() => config.getSessionService().readLiveRestoreProjection(sessionId, options), "readProjection");
14175
+ const projection = recorder ? await recorder.runWithWriteBarrier(readProjection) : await readProjection();
14176
+ if (!projection) throw new SessionWriterUnavailableError();
14177
+ return await operation(config, projection);
14080
14178
  } catch (error) {
14081
- throw mapSessionWriterRequestError(error);
14179
+ throw mapSessionRestoreRequestError(error, sessionId);
14082
14180
  } finally {
14083
14181
  releaseGate();
14084
14182
  }
@@ -14105,7 +14203,7 @@ var QwenAgent = class {
14105
14203
  this.pendingConfigCleanup.delete(cleanupKey);
14106
14204
  }
14107
14205
  }
14108
- async cleanupAfterRequestFailure(error, cleanup) {
14206
+ async cleanupAfterRequestFailure(error, cleanup, sessionId) {
14109
14207
  try {
14110
14208
  await cleanup();
14111
14209
  } catch (cleanupError) {
@@ -14113,7 +14211,7 @@ var QwenAgent = class {
14113
14211
  `Session cleanup failed while preserving the original request error: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`
14114
14212
  );
14115
14213
  }
14116
- throw mapSessionWriterRequestError(error);
14214
+ throw sessionId ? mapSessionRestoreRequestError(error, sessionId) : mapSessionWriterRequestError(error);
14117
14215
  }
14118
14216
  pendingConfigCleanupKey(runtimeBaseDir, sessionId) {
14119
14217
  return `${path4.resolve(runtimeBaseDir)}\0${sessionId}`;
@@ -14313,7 +14411,7 @@ var QwenAgent = class {
14313
14411
  }
14314
14412
  this.clientCapabilities = args.clientCapabilities;
14315
14413
  const authMethods = buildAuthMethods();
14316
- const version = "0.21.12-preview.3";
14414
+ const version = "0.21.12-preview.4";
14317
14415
  const response = {
14318
14416
  protocolVersion: PROTOCOL_VERSION,
14319
14417
  agentInfo: {
@@ -14514,6 +14612,7 @@ var QwenAgent = class {
14514
14612
  async loadSessionWithProfiler(params, initialSessionId, profiler) {
14515
14613
  let sessionId = initialSessionId;
14516
14614
  const sessionSource = getSessionSource(params);
14615
+ const restoreOptions = loadRestoreOptions(params);
14517
14616
  const liveSession = this.sessions.get(sessionId);
14518
14617
  if (liveSession) {
14519
14618
  const settings = profiler.timeSync(
@@ -14526,35 +14625,43 @@ var QwenAgent = class {
14526
14625
  return this.withLiveSessionRestore(
14527
14626
  sessionId,
14528
14627
  liveSession,
14529
- async (config, sessionData) => {
14628
+ restoreOptions,
14629
+ async (config, projection) => {
14530
14630
  const response = profiler.timeSync(
14531
14631
  "response_build",
14532
14632
  () => ({
14533
14633
  modes: this.buildModesData(config),
14534
14634
  models: this.buildAvailableModels(config),
14535
14635
  configOptions: this.buildConfigOptions(config),
14536
- ...sessionData.artifactSnapshot ? { artifactSnapshot: sessionData.artifactSnapshot } : {}
14636
+ ...projection?.artifactSnapshot ? { artifactSnapshot: projection.artifactSnapshot } : {}
14537
14637
  })
14538
14638
  );
14539
- const records = sessionData.conversation.messages;
14540
- const visibleRecords = selectVisibleHistoryRecords(
14541
- records,
14542
- shouldHideInheritedHistory(params)
14543
- );
14544
- if (visibleRecords.length === 0) return response;
14639
+ const replayPage = projection?.replay;
14640
+ if (!replayPage || replayPage.records.length === 0) return response;
14545
14641
  const bulkReplay = isBulkLoadReplayRequest(params);
14546
- const replayPage = bulkReplay ? selectRecentHistoryRecords(
14547
- visibleRecords,
14548
- getLoadReplayPageSize(params)
14549
- ) : { records: visibleRecords, hasMore: false };
14550
- const replay = await collectHistoryReplayUpdates({
14551
- sessionId,
14552
- config,
14553
- records: replayPage.records,
14554
- gaps: sessionData.historyGaps,
14555
- cumulativeUsage: createReplayCumulativeUsage(),
14556
- logger: debugLogger8
14557
- });
14642
+ const replay = await profiler.time(
14643
+ "history_replay",
14644
+ () => collectHistoryReplayUpdates({
14645
+ sessionId,
14646
+ config,
14647
+ records: replayPage.records,
14648
+ gaps: replayPage.gaps,
14649
+ cumulativeUsage: createReplayCumulativeUsage(),
14650
+ replayState: replayPage.replay,
14651
+ goalBootstrap: replayGoalBootstrap(projection),
14652
+ ...restoreOptions.replay.kind === "recent" ? {
14653
+ limits: {
14654
+ maxBytes: LOAD_REPLAY_MAX_BYTES,
14655
+ maxUpdates: LOAD_REPLAY_MAX_UPDATES
14656
+ }
14657
+ } : {},
14658
+ logger: debugLogger8
14659
+ })
14660
+ );
14661
+ addDaemonRequestAttribute(
14662
+ "qwen-code.daemon.session_restore.partial_replay",
14663
+ replay.replayError !== void 0
14664
+ );
14558
14665
  if (!bulkReplay) {
14559
14666
  try {
14560
14667
  for (const update of replay.updates) {
@@ -14568,18 +14675,25 @@ var QwenAgent = class {
14568
14675
  }
14569
14676
  return response;
14570
14677
  }
14678
+ const envelope = {
14679
+ v: LOAD_REPLAY_VERSION,
14680
+ updates: replay.updates,
14681
+ ...replayPage.anchorRecordId ? { anchorRecordId: replayPage.anchorRecordId } : {},
14682
+ ...replay.replayError !== void 0 ? {
14683
+ partial: true,
14684
+ replayError: replay.replayError
14685
+ } : {},
14686
+ ...replayPage.hasMore ? { hasMore: true } : {}
14687
+ };
14688
+ validateLoadReplayEnvelope(
14689
+ sessionId,
14690
+ envelope,
14691
+ restoreOptions.replay.kind === "recent"
14692
+ );
14571
14693
  return {
14572
14694
  ...response,
14573
14695
  _meta: {
14574
- [LOAD_REPLAY_META_KEY]: {
14575
- v: LOAD_REPLAY_VERSION,
14576
- updates: replay.updates,
14577
- ...replay.replayError !== void 0 ? {
14578
- partial: true,
14579
- replayError: replay.replayError
14580
- } : {},
14581
- ...replayPage.hasMore ? { hasMore: true } : {}
14582
- }
14696
+ [LOAD_REPLAY_META_KEY]: envelope
14583
14697
  }
14584
14698
  };
14585
14699
  }
@@ -14621,13 +14735,32 @@ var QwenAgent = class {
14621
14735
  settings,
14622
14736
  sessionSource,
14623
14737
  sessionId,
14624
- true
14738
+ true,
14739
+ {},
14740
+ void 0,
14741
+ restoreOptions
14625
14742
  )
14626
14743
  );
14627
- const sessionData = config.getResumedSessionData();
14744
+ const projection = config.consumeSessionRestoreProjection?.();
14745
+ const suppressRecoveredGoalPresentation = projection?.runtime.goalRecoverySourceUuid !== void 0 && projection.runtime.goalRecoverySourceUuid !== projection.replay?.goalRecoverySourceUuid;
14628
14746
  const bulkReplay = isBulkLoadReplayRequest(params);
14629
- const replayPageSize = bulkReplay ? getLoadReplayPageSize(params) : void 0;
14630
14747
  let replayEnvelope;
14748
+ const replayUsage = createReplayCumulativeUsage();
14749
+ let recoveredGoalPublicationKey;
14750
+ let suppressedRecoveredGoalId;
14751
+ let streamGoalUpdates = [];
14752
+ let response;
14753
+ const buildResponse = /* @__PURE__ */ __name(() => profiler.timeSync("response_build", () => ({
14754
+ modes: this.buildModesData(config),
14755
+ models: this.buildAvailableModels(config),
14756
+ configOptions: this.buildConfigOptions(config),
14757
+ ...projection?.runtime.artifactSnapshot ? { artifactSnapshot: projection.runtime.artifactSnapshot } : {},
14758
+ ...replayEnvelope ? {
14759
+ _meta: {
14760
+ [LOAD_REPLAY_META_KEY]: replayEnvelope
14761
+ }
14762
+ } : {}
14763
+ })), "buildResponse");
14631
14764
  try {
14632
14765
  await profiler.time("auth", () => this.ensureAuthenticated(config));
14633
14766
  profiler.timeSync(
@@ -14636,98 +14769,165 @@ var QwenAgent = class {
14636
14769
  );
14637
14770
  await profiler.time(
14638
14771
  "session_register",
14639
- () => this.createAndStoreSession(config, settings, sessionData, {
14772
+ () => this.createAndStoreSession(config, settings, void 0, {
14640
14773
  enableLiveScreenContext: isCompatibleLiveSessionSource(
14641
14774
  sessionSource ?? {}
14642
14775
  ),
14643
- ...bulkReplay ? { replayHistory: false } : {},
14644
- beforeStartPostReplayServices: /* @__PURE__ */ __name(async (createdSession) => {
14645
- if (bulkReplay) {
14646
- const records = sessionData?.conversation.messages;
14647
- let replayUpdates = [];
14648
- if (records) {
14649
- createdSession.primeTurnFromHistory(records);
14650
- const visibleRecords = selectVisibleHistoryRecords(
14651
- records,
14652
- shouldHideInheritedHistory(params)
14653
- );
14654
- const replayPage = selectRecentHistoryRecords(
14655
- visibleRecords,
14656
- replayPageSize
14657
- );
14658
- const replayUsage = createReplayCumulativeUsage();
14659
- const replay = await collectHistoryReplayUpdates({
14776
+ replayHistory: false,
14777
+ prepareBeforeSessionCreate: /* @__PURE__ */ __name(async () => {
14778
+ if (bulkReplay && projection?.replay) {
14779
+ const replay = await profiler.time(
14780
+ "history_replay",
14781
+ () => collectHistoryReplayUpdates({
14660
14782
  sessionId,
14661
14783
  config,
14662
- records: replayPage.records,
14663
- gaps: sessionData?.historyGaps,
14784
+ records: projection.replay.records,
14785
+ gaps: projection.replay.gaps,
14664
14786
  cumulativeUsage: replayUsage,
14787
+ replayState: projection.replay.replay,
14788
+ goalBootstrap: replayGoalBootstrap(projection),
14789
+ ...restoreOptions.replay.kind === "recent" ? {
14790
+ limits: {
14791
+ maxBytes: LOAD_REPLAY_MAX_BYTES,
14792
+ maxUpdates: LOAD_REPLAY_MAX_UPDATES
14793
+ }
14794
+ } : {},
14665
14795
  logger: debugLogger8
14666
- });
14667
- replayUpdates = replay.updates;
14668
- copyCumulativeUsage(
14669
- createdSession.cumulativeUsage,
14670
- replayUsage
14671
- );
14672
- try {
14673
- replayUpdates = replayUpdates.concat(
14674
- await createdSession.renderRecoveredGoalUpdates(records)
14796
+ })
14797
+ );
14798
+ addDaemonRequestAttribute(
14799
+ "qwen-code.daemon.session_restore.partial_replay",
14800
+ replay.replayError !== void 0
14801
+ );
14802
+ replayEnvelope = {
14803
+ v: LOAD_REPLAY_VERSION,
14804
+ updates: replay.updates,
14805
+ ...projection.replay.anchorRecordId ? { anchorRecordId: projection.replay.anchorRecordId } : {},
14806
+ ...replay.replayError !== void 0 ? {
14807
+ partial: true,
14808
+ replayError: replay.replayError
14809
+ } : {},
14810
+ ...projection.replay.hasMore ? { hasMore: true } : {}
14811
+ };
14812
+ validateLoadReplayEnvelope(
14813
+ sessionId,
14814
+ replayEnvelope,
14815
+ restoreOptions.replay.kind === "recent"
14816
+ );
14817
+ }
14818
+ const goalBootstrap = replayGoalBootstrap(projection);
14819
+ const rendered = await renderPreparedGoalUpdate(
14820
+ () => config.getGoalRuntimePrepared(),
14821
+ {
14822
+ ...projection?.replay?.records ? { replayedRecords: projection.replay.records } : {},
14823
+ ...suppressRecoveredGoalPresentation ? { hideRuntimeGoal: true } : {},
14824
+ ...goalBootstrap ? { bootstrap: goalBootstrap } : {}
14825
+ }
14826
+ ).catch((error) => {
14827
+ if (suppressRecoveredGoalPresentation) throw error;
14828
+ debugLogger8.debug(
14829
+ `Failed to render recovered Goal state: ${error instanceof Error ? error.message : String(error)}`
14830
+ );
14831
+ return {
14832
+ publicationKey: void 0,
14833
+ suppressedGoalId: void 0,
14834
+ updates: []
14835
+ };
14836
+ });
14837
+ recoveredGoalPublicationKey = rendered.publicationKey;
14838
+ suppressedRecoveredGoalId = rendered.suppressedGoalId;
14839
+ if (!bulkReplay) {
14840
+ streamGoalUpdates = rendered.updates;
14841
+ return;
14842
+ }
14843
+ const goalUpdates = rendered.updates;
14844
+ if (goalUpdates.length > 0) {
14845
+ replayEnvelope ??= {
14846
+ v: LOAD_REPLAY_VERSION,
14847
+ updates: []
14848
+ };
14849
+ replayEnvelope.updates.push(...goalUpdates);
14850
+ validateLoadReplayEnvelope(
14851
+ sessionId,
14852
+ replayEnvelope,
14853
+ restoreOptions.replay.kind === "recent"
14854
+ );
14855
+ }
14856
+ }, "prepareBeforeSessionCreate"),
14857
+ beforeSessionCreate: /* @__PURE__ */ __name(() => {
14858
+ response = buildResponse();
14859
+ }, "beforeSessionCreate"),
14860
+ primeSession: /* @__PURE__ */ __name((createdSession) => {
14861
+ profiler.timeSync("runtime_initialize", () => {
14862
+ if (!projection) return;
14863
+ createdSession.primeTurnState(
14864
+ projection.runtime.initialTurn,
14865
+ projection.runtime.backgroundNotificationTaskIds
14866
+ );
14867
+ copyCumulativeUsage(
14868
+ createdSession.cumulativeUsage,
14869
+ replayUsage
14870
+ );
14871
+ createdSession.primeRecoveredGoalPublication(
14872
+ recoveredGoalPublicationKey,
14873
+ suppressedRecoveredGoalId
14874
+ );
14875
+ });
14876
+ }, "primeSession"),
14877
+ beforeStartPostReplayServices: /* @__PURE__ */ __name(async (createdSession) => {
14878
+ if (!bulkReplay && projection?.replay) {
14879
+ await profiler.time("history_replay", async () => {
14880
+ const goalBootstrap = replayGoalBootstrap(projection);
14881
+ const initialGoalState = replayInitialGoalState(projection);
14882
+ const hasGoalReplayState = goalBootstrap !== void 0 || initialGoalState.initialGoalState !== void 0 || initialGoalState.initialGoalCause !== void 0;
14883
+ if (hasGoalReplayState) {
14884
+ await createdSession.replayHistory(
14885
+ projection.replay.records,
14886
+ projection.replay.gaps,
14887
+ {
14888
+ ...goalBootstrap ? { goalBootstrap } : {},
14889
+ ...initialGoalState
14890
+ }
14675
14891
  );
14676
- } catch (error) {
14677
- debugLogger8.debug(
14678
- `Failed to render recovered Goal state: ${error instanceof Error ? error.message : String(error)}`
14892
+ } else {
14893
+ await createdSession.replayHistory(
14894
+ projection.replay.records,
14895
+ projection.replay.gaps
14679
14896
  );
14680
14897
  }
14681
- if (replay.replayError !== void 0) {
14682
- replayEnvelope = {
14683
- v: LOAD_REPLAY_VERSION,
14684
- updates: replayUpdates,
14685
- partial: true,
14686
- replayError: replay.replayError,
14687
- ...replayPage.hasMore ? { hasMore: true } : {}
14688
- };
14898
+ });
14899
+ try {
14900
+ for (const update of streamGoalUpdates) {
14901
+ await createdSession.sendUpdate(update);
14689
14902
  }
14690
- replayEnvelope ??= {
14691
- v: LOAD_REPLAY_VERSION,
14692
- updates: replayUpdates,
14693
- ...replayPage.hasMore ? { hasMore: true } : {}
14694
- };
14903
+ } catch (error) {
14904
+ debugLogger8.debug(
14905
+ `Failed to publish recovered Goal state: ${error instanceof Error ? error.message : String(error)}`
14906
+ );
14695
14907
  }
14696
- replayEnvelope ??= {
14697
- v: LOAD_REPLAY_VERSION,
14698
- updates: replayUpdates
14699
- };
14700
14908
  }
14701
- await this.#restoreWorktreeOnResume(config, createdSession);
14702
- await this.#restoreBackgroundAgentsOnResume(
14703
- config,
14704
- createdSession
14705
- );
14909
+ await profiler.time("post_replay_services", async () => {
14910
+ await this.#restoreWorktreeOnResume(config, createdSession);
14911
+ await this.#restoreBackgroundAgentsOnResume(
14912
+ config,
14913
+ createdSession
14914
+ );
14915
+ });
14706
14916
  }, "beforeStartPostReplayServices")
14707
14917
  })
14708
14918
  );
14709
14919
  } catch (error) {
14710
- return this.cleanupAfterRequestFailure(error, async () => {
14711
- if (this.sessions.get(config.getSessionId())?.getConfig() !== config) {
14712
- await this.cleanupUnstoredConfig(config);
14713
- }
14714
- });
14920
+ return this.cleanupAfterRequestFailure(
14921
+ error,
14922
+ async () => {
14923
+ if (this.sessions.get(config.getSessionId())?.getConfig() !== config) {
14924
+ await this.cleanupUnstoredConfig(config);
14925
+ }
14926
+ },
14927
+ sessionId
14928
+ );
14715
14929
  }
14716
- return profiler.timeSync("response_build", () => {
14717
- const response = {
14718
- modes: this.buildModesData(config),
14719
- models: this.buildAvailableModels(config),
14720
- configOptions: this.buildConfigOptions(config),
14721
- ...sessionData?.artifactSnapshot ? { artifactSnapshot: sessionData.artifactSnapshot } : {}
14722
- };
14723
- if (!replayEnvelope) return response;
14724
- return {
14725
- ...response,
14726
- _meta: {
14727
- [LOAD_REPLAY_META_KEY]: replayEnvelope
14728
- }
14729
- };
14730
- });
14930
+ return response;
14731
14931
  } finally {
14732
14932
  releaseStartingSessionId();
14733
14933
  }
@@ -14765,13 +14965,14 @@ var QwenAgent = class {
14765
14965
  return this.withLiveSessionRestore(
14766
14966
  sessionId,
14767
14967
  liveSession,
14768
- async (config, sessionData) => profiler.timeSync(
14968
+ RESUME_RESTORE_OPTIONS,
14969
+ async (config, projection) => profiler.timeSync(
14769
14970
  "response_build",
14770
14971
  () => ({
14771
14972
  modes: this.buildModesData(config),
14772
14973
  models: this.buildAvailableModels(config),
14773
14974
  configOptions: this.buildConfigOptions(config),
14774
- ...sessionData.artifactSnapshot ? { artifactSnapshot: sessionData.artifactSnapshot } : {}
14975
+ ...projection?.artifactSnapshot ? { artifactSnapshot: projection.artifactSnapshot } : {}
14775
14976
  })
14776
14977
  )
14777
14978
  );
@@ -14808,9 +15009,14 @@ var QwenAgent = class {
14808
15009
  settings,
14809
15010
  sessionSource,
14810
15011
  sessionId,
14811
- true
15012
+ true,
15013
+ {},
15014
+ void 0,
15015
+ RESUME_RESTORE_OPTIONS
14812
15016
  )
14813
15017
  );
15018
+ const projection = config.consumeSessionRestoreProjection?.();
15019
+ let response;
14814
15020
  try {
14815
15021
  await profiler.time("auth", () => this.ensureAuthenticated(config));
14816
15022
  profiler.timeSync(
@@ -14819,51 +15025,51 @@ var QwenAgent = class {
14819
15025
  );
14820
15026
  await profiler.time(
14821
15027
  "session_register",
14822
- () => this.createAndStoreSession(
14823
- config,
14824
- settings,
14825
- config.getResumedSessionData(),
14826
- {
14827
- enableLiveScreenContext: isCompatibleLiveSessionSource(
14828
- sessionSource ?? {}
14829
- ),
14830
- replayHistory: false,
14831
- beforeStartPostReplayServices: /* @__PURE__ */ __name(async (createdSession) => {
14832
- try {
14833
- await createdSession.publishRecoveredGoalState(
14834
- config.getResumedSessionData()?.conversation.messages
14835
- );
14836
- } catch (error) {
14837
- debugLogger8.debug(
14838
- `Failed to publish recovered Goal state: ${error instanceof Error ? error.message : String(error)}`
14839
- );
14840
- }
15028
+ () => this.createAndStoreSession(config, settings, void 0, {
15029
+ enableLiveScreenContext: isCompatibleLiveSessionSource(
15030
+ sessionSource ?? {}
15031
+ ),
15032
+ replayHistory: false,
15033
+ beforeSessionCreate: /* @__PURE__ */ __name(() => {
15034
+ response = profiler.timeSync("response_build", () => ({
15035
+ modes: this.buildModesData(config),
15036
+ models: this.buildAvailableModels(config),
15037
+ configOptions: this.buildConfigOptions(config),
15038
+ ...projection?.runtime.artifactSnapshot ? { artifactSnapshot: projection.runtime.artifactSnapshot } : {}
15039
+ }));
15040
+ }, "beforeSessionCreate"),
15041
+ primeSession: /* @__PURE__ */ __name((createdSession) => {
15042
+ profiler.timeSync("runtime_initialize", () => {
15043
+ if (!projection) return;
15044
+ createdSession.primeTurnState(
15045
+ projection.runtime.initialTurn,
15046
+ projection.runtime.backgroundNotificationTaskIds
15047
+ );
15048
+ });
15049
+ }, "primeSession"),
15050
+ beforeStartPostReplayServices: /* @__PURE__ */ __name(async (createdSession) => {
15051
+ await profiler.time("post_replay_services", async () => {
14841
15052
  await this.#restoreWorktreeOnResume(config, createdSession);
14842
15053
  await this.#restoreBackgroundAgentsOnResume(
14843
15054
  config,
14844
15055
  createdSession
14845
15056
  );
14846
- }, "beforeStartPostReplayServices")
14847
- }
14848
- )
15057
+ });
15058
+ }, "beforeStartPostReplayServices")
15059
+ })
14849
15060
  );
14850
15061
  } catch (error) {
14851
- return this.cleanupAfterRequestFailure(error, async () => {
14852
- if (this.sessions.get(config.getSessionId())?.getConfig() !== config) {
14853
- await this.cleanupUnstoredConfig(config);
14854
- }
14855
- });
15062
+ return this.cleanupAfterRequestFailure(
15063
+ error,
15064
+ async () => {
15065
+ if (this.sessions.get(config.getSessionId())?.getConfig() !== config) {
15066
+ await this.cleanupUnstoredConfig(config);
15067
+ }
15068
+ },
15069
+ sessionId
15070
+ );
14856
15071
  }
14857
- const sessionData = config.getResumedSessionData();
14858
- return profiler.timeSync(
14859
- "response_build",
14860
- () => ({
14861
- modes: this.buildModesData(config),
14862
- models: this.buildAvailableModels(config),
14863
- configOptions: this.buildConfigOptions(config),
14864
- ...sessionData?.artifactSnapshot ? { artifactSnapshot: sessionData.artifactSnapshot } : {}
14865
- })
14866
- );
15072
+ return response;
14867
15073
  } finally {
14868
15074
  releaseStartingSessionId();
14869
15075
  }
@@ -20195,7 +20401,7 @@ ${outputText}
20195
20401
  throw error;
20196
20402
  }
20197
20403
  }
20198
- async newSessionConfig(cwd, mcpServers, settings, sessionSource, sessionId, resume, initializeOptions = {}, chatRecording) {
20404
+ async newSessionConfig(cwd, mcpServers, settings, sessionSource, sessionId, resume, initializeOptions = {}, chatRecording, restoreOptions) {
20199
20405
  try {
20200
20406
  this.assertManagedSessionAdmission();
20201
20407
  return await this.runWithPinnedRuntimeBaseDir(settings, cwd, async () => {
@@ -20211,7 +20417,8 @@ ${outputText}
20211
20417
  sessionId,
20212
20418
  resume,
20213
20419
  initializeOptions,
20214
- chatRecording
20420
+ chatRecording,
20421
+ restoreOptions
20215
20422
  );
20216
20423
  });
20217
20424
  } catch (error) {
@@ -20227,10 +20434,10 @@ ${outputText}
20227
20434
  errorKind: writerError.errorKind
20228
20435
  });
20229
20436
  }
20230
- throw error;
20437
+ throw sessionId && restoreOptions ? mapSessionRestoreRequestError(error, sessionId) : error;
20231
20438
  }
20232
20439
  }
20233
- async newSessionConfigInRuntimeContext(cwd, mcpServers, settings, sessionSource, sessionId, resume, initializeOptions = {}, chatRecording) {
20440
+ async newSessionConfigInRuntimeContext(cwd, mcpServers, settings, sessionSource, sessionId, resume, initializeOptions = {}, chatRecording, restoreOptions) {
20234
20441
  const sessionMcpServers = {};
20235
20442
  for (const server of mcpServers) {
20236
20443
  const stdioServer = toStdioServer(server);
@@ -20328,7 +20535,19 @@ ${outputText}
20328
20535
  // not process.exit(1) the shared ACP child and every session on its
20329
20536
  // channel. newSessionConfig maps the throw to a RequestError.
20330
20537
  true,
20331
- this.managedToolInvocationGuard ? { toolInvocationGuard: this.managedToolInvocationGuard } : void 0
20538
+ this.managedToolInvocationGuard || restoreOptions ? {
20539
+ ...this.managedToolInvocationGuard ? { toolInvocationGuard: this.managedToolInvocationGuard } : {},
20540
+ ...restoreOptions && sessionId ? {
20541
+ sessionRestore: {
20542
+ projectionSource: /* @__PURE__ */ __name((restoreSessionId) => new SessionService(cwd, {
20543
+ runtimeBaseDir: Storage.getRuntimeBaseDir()
20544
+ }).readRestoreProjection(
20545
+ restoreSessionId,
20546
+ restoreOptions
20547
+ ), "projectionSource")
20548
+ }
20549
+ } : {}
20550
+ } : void 0
20332
20551
  );
20333
20552
  if (sessionSource) {
20334
20553
  config.setSessionSource(sessionSource.sourceType, sessionSource.sourceId);
@@ -20465,6 +20684,16 @@ ${outputText}
20465
20684
  { errorKind: "session_id_conflict", sessionId }
20466
20685
  );
20467
20686
  }
20687
+ await options.prepareBeforeSessionCreate?.();
20688
+ this.assertManagedSessionAdmission();
20689
+ if (this.sessions.has(sessionId)) {
20690
+ throw new RequestError(
20691
+ ACP_ERROR_CODES.INVALID_PARAMS,
20692
+ `Session ${sessionId} is already active.`,
20693
+ { errorKind: "session_id_conflict", sessionId }
20694
+ );
20695
+ }
20696
+ options.beforeSessionCreate?.();
20468
20697
  const session = new Session(
20469
20698
  sessionId,
20470
20699
  config,
@@ -20472,10 +20701,14 @@ ${outputText}
20472
20701
  settings,
20473
20702
  () => this.activeWorkReporter?.notifyChanged()
20474
20703
  );
20475
- this.sessions.set(sessionId, session);
20476
- this.activeWorkReporter?.notifyChanged();
20477
- this.initializingConfigs.delete(config);
20704
+ let published = false;
20478
20705
  try {
20706
+ options.primeSession?.(session);
20707
+ config.hydrateSessionRestoreFileHistory?.();
20708
+ this.sessions.set(sessionId, session);
20709
+ published = true;
20710
+ this.activeWorkReporter?.notifyChanged();
20711
+ this.initializingConfigs.delete(config);
20479
20712
  if (options.enableLiveScreenContext) {
20480
20713
  await session.enableLiveScreenContext();
20481
20714
  }
@@ -20502,12 +20735,23 @@ ${outputText}
20502
20735
  }
20503
20736
  await options.beforeStartPostReplayServices?.(session);
20504
20737
  session.installRewriter();
20738
+ config.finalizeSessionRestore?.();
20505
20739
  session.startCronScheduler();
20506
20740
  setTimeout(() => {
20507
20741
  void session.sendAvailableCommandsUpdate();
20508
20742
  }, 0);
20509
20743
  return session;
20510
20744
  } catch (error) {
20745
+ if (!published) {
20746
+ try {
20747
+ session.dispose();
20748
+ } catch (disposeError) {
20749
+ debugLogger8.warn(
20750
+ `Failed to dispose unpublished session ${sessionId}: ${disposeError instanceof Error ? disposeError.message : String(disposeError)}`
20751
+ );
20752
+ }
20753
+ throw error;
20754
+ }
20511
20755
  try {
20512
20756
  await this.discardStoredSessionIfCurrent(sessionId, session, {
20513
20757
  shutdownConfig: false