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

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 (348) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +10 -0
  2. package/bundled/qc-helper/docs/features/channels/overview.md +1 -1
  3. package/bundled/qc-helper/docs/features/channels/plugins.md +11 -11
  4. package/bundled/qc-helper/docs/features/code-review.md +1 -1
  5. package/bundled/qc-helper/docs/qwen-serve.md +99 -34
  6. package/bundled/review/SKILL.md +55 -36
  7. package/chunks/{MaxSizedBox-EIK4BHBQ.js → MaxSizedBox-ZSJJ2D5S.js} +46 -46
  8. package/chunks/{StandaloneSessionPicker-NHVJDRYD.js → StandaloneSessionPicker-WHUHQXSA.js} +65 -66
  9. package/chunks/{acp-startup-profiler-JMJBZDVO.js → acp-startup-profiler-SVPUHLXV.js} +2 -2
  10. package/chunks/{acpAgent-37UDZP64.js → acpAgent-7JOAESF5.js} +960 -539
  11. package/chunks/{agent-FAWBG7PP.js → agent-E6V3VXQR.js} +42 -42
  12. package/chunks/{agent-headless-SHK4PCCH.js → agent-headless-OEQNFOMH.js} +42 -42
  13. package/chunks/{anthropicContentGenerator-4JSC3ZFL.js → anthropicContentGenerator-YDT4EOKO.js} +25 -25
  14. package/chunks/{artifact-tool-FRMBPDPB.js → artifact-tool-4GCQQDZI.js} +5 -5
  15. package/chunks/{askUserQuestion-7G3LI3IZ.js → askUserQuestion-HZJJLR3Z.js} +2 -2
  16. package/chunks/{bridge-DEAYNDCI.js → bridge-NPBV53UA.js} +49 -49
  17. package/chunks/{build-RZS65IIX.js → build-GDBLPA24.js} +1 -1
  18. package/chunks/{channel-management-service-SKAN6NOB.js → channel-management-service-OADNGQM3.js} +4 -4
  19. package/chunks/{channel-settings-store-UIGYER6R.js → channel-settings-store-4ODLJ4X2.js} +49 -49
  20. package/chunks/{channel-worker-group-YPTB5ASD.js → channel-worker-group-IHBIHQ45.js} +7 -7
  21. package/chunks/{channel-worker-manager-4EHJSPRH.js → channel-worker-manager-GEHYJ5AE.js} +7 -7
  22. package/chunks/{channel-worker-supervisor-DZKHYFHV.js → channel-worker-supervisor-ZJIIWM4I.js} +5 -5
  23. package/chunks/{chunk-LHOG4E6Y.js → chunk-22C7BQ6D.js} +3 -3
  24. package/chunks/{chunk-DP3IHZGG.js → chunk-2AUM35J5.js} +59 -7
  25. package/chunks/{chunk-2SB4SLKC.js → chunk-2IIJTXYF.js} +1 -3
  26. package/chunks/{chunk-DYVCDQW2.js → chunk-2IVYL3IF.js} +1 -1
  27. package/chunks/{chunk-EYW54TBD.js → chunk-2ZWH53I4.js} +3 -3
  28. package/chunks/{chunk-5I5NMQCU.js → chunk-36XKGB7E.js} +3 -3
  29. package/chunks/{chunk-AQHNAA7E.js → chunk-3AEKDXKT.js} +1 -1
  30. package/chunks/{chunk-M6SXIXBV.js → chunk-3GDBZJD6.js} +6 -6
  31. package/chunks/{chunk-6XZERB6P.js → chunk-3GM5DLBI.js} +5 -5
  32. package/chunks/{chunk-4M2F7OG7.js → chunk-3LDGOQXZ.js} +6 -6
  33. package/chunks/{chunk-BKHCW2BI.js → chunk-3VUENPWF.js} +10 -0
  34. package/chunks/{chunk-ENEEQMGM.js → chunk-45NQKMYB.js} +1 -1
  35. package/chunks/{chunk-MDFUBQAQ.js → chunk-47BGDLJG.js} +119 -27
  36. package/chunks/{chunk-EFIMD5VA.js → chunk-4AOVQPJU.js} +1 -1
  37. package/chunks/{chunk-HB6QW4LM.js → chunk-4KM2SYK5.js} +19 -16
  38. package/chunks/{chunk-UNCIELQJ.js → chunk-4XA4QIUA.js} +1 -1
  39. package/chunks/{chunk-2J53A6MV.js → chunk-56HVDG3M.js} +4 -4
  40. package/chunks/{chunk-N3FJOQX7.js → chunk-5AFGJNY6.js} +4 -4
  41. package/chunks/{chunk-2AZMF6G5.js → chunk-5RUCD4ED.js} +2 -2
  42. package/chunks/{chunk-32VOOMEF.js → chunk-62X3CM7Q.js} +7 -7
  43. package/chunks/{chunk-6LYDH7VT.js → chunk-63FNZTWG.js} +2 -2
  44. package/chunks/{chunk-P64FPV3G.js → chunk-6JEIRPLN.js} +47 -4
  45. package/chunks/{chunk-O5G7IQGM.js → chunk-6P5EXEBL.js} +499 -112
  46. package/chunks/{chunk-3ZYX7AUR.js → chunk-6SPD4Z7F.js} +1 -1
  47. package/chunks/{chunk-YZJVVQD3.js → chunk-6ZKSO6K7.js} +7 -7
  48. package/chunks/{chunk-N5ULBHP3.js → chunk-7KJPO7YH.js} +2 -2
  49. package/chunks/{chunk-MZSJ43WV.js → chunk-7U5G6JXI.js} +24 -2
  50. package/chunks/{chunk-K7JW6V5O.js → chunk-A6NRNRKE.js} +1 -1
  51. package/chunks/{chunk-XLQS3VI6.js → chunk-AKBFSOC5.js} +2 -2
  52. package/chunks/{chunk-LT532KF4.js → chunk-AW27A43Y.js} +10 -12
  53. package/chunks/{chunk-M4NWDIFU.js → chunk-AZQ3DT76.js} +1 -1
  54. package/chunks/{chunk-4GLFFNP3.js → chunk-B4VN3VDH.js} +5 -5
  55. package/chunks/{chunk-YTYPRVIZ.js → chunk-BSR5AXZR.js} +4 -3
  56. package/chunks/{chunk-AJX4ITUG.js → chunk-BSSLSQEW.js} +3 -3
  57. package/chunks/{chunk-EYY4IBPV.js → chunk-CGM3E75C.js} +3 -3
  58. package/chunks/{chunk-V4MJ56RS.js → chunk-CIDQISGM.js} +5 -5
  59. package/chunks/{chunk-T6W4KACQ.js → chunk-CPFFU46D.js} +1 -1
  60. package/chunks/{chunk-TYCXSMZU.js → chunk-CQ6IPDQW.js} +3 -3
  61. package/chunks/{chunk-KIFRFCCB.js → chunk-CZ4OWGQQ.js} +67 -22
  62. package/chunks/{chunk-N7NBMAMW.js → chunk-D2RNVVH6.js} +2 -2
  63. package/chunks/{chunk-KPVVWKF3.js → chunk-D7QGE3RT.js} +1 -1
  64. package/chunks/{chunk-TYGKUOEG.js → chunk-DAV4QFD5.js} +3 -11
  65. package/chunks/{chunk-QUESTNOP.js → chunk-DD6O3ZRD.js} +1 -1
  66. package/chunks/{chunk-NWPO6I7V.js → chunk-DEDESZDL.js} +1 -1
  67. package/chunks/{chunk-7LZ7DK4D.js → chunk-DFVXU5YM.js} +1 -1
  68. package/chunks/{chunk-TBVNYG5B.js → chunk-DG4IQ6JG.js} +5 -5
  69. package/chunks/{chunk-SAQHDAUJ.js → chunk-DPTMKFIH.js} +452 -57
  70. package/chunks/{chunk-M6HXP2SG.js → chunk-EBPLKY6U.js} +2192 -849
  71. package/chunks/{chunk-3XZYK76R.js → chunk-EJOGLSNJ.js} +2 -2
  72. package/chunks/{chunk-L7T742G2.js → chunk-FA5K6YI2.js} +47 -3
  73. package/chunks/{chunk-M2NMFAFR.js → chunk-FMIH5KMQ.js} +1 -1
  74. package/chunks/{chunk-HHGQGTJQ.js → chunk-FQDCO3CJ.js} +10 -1
  75. package/chunks/{chunk-V3LXMASR.js → chunk-FRHQQC2Z.js} +1 -1
  76. package/chunks/{chunk-732MOPEM.js → chunk-G6MUFRNI.js} +1 -1
  77. package/chunks/{chunk-KNXA5XXK.js → chunk-GXTMEATA.js} +15 -34
  78. package/chunks/{chunk-7SUQZ7QH.js → chunk-GZDWTBT3.js} +2 -2
  79. package/chunks/{chunk-IQFYO5BF.js → chunk-H7TMVHKE.js} +1 -1
  80. package/chunks/{chunk-KNQZXSLW.js → chunk-HG3UBTJ4.js} +23 -9
  81. package/chunks/{chunk-MPBRV3UU.js → chunk-HOSVOUDK.js} +71 -0
  82. package/chunks/{chunk-OPBATTFQ.js → chunk-HTYND72J.js} +1 -1
  83. package/chunks/{chunk-I4XSOFH2.js → chunk-I7BT2MME.js} +1 -1
  84. package/chunks/{chunk-LHY6HBRA.js → chunk-IH4Z54RJ.js} +7 -5
  85. package/chunks/{chunk-GYBDYWMV.js → chunk-IRSLAS4M.js} +2 -2
  86. package/chunks/{chunk-UZPWH6SP.js → chunk-IX4PWUDU.js} +401 -173
  87. package/chunks/{chunk-KT4OWAAZ.js → chunk-JRIVMPD2.js} +3 -3
  88. package/chunks/{chunk-Q7YDKOGY.js → chunk-JVEGA3MM.js} +1 -1
  89. package/chunks/{chunk-O5AZPHYZ.js → chunk-K34GJQOZ.js} +138 -16
  90. package/chunks/{chunk-L2GTEEEU.js → chunk-K5IDV3PC.js} +44 -1
  91. package/chunks/{chunk-5HBFERG5.js → chunk-KEC5FHLM.js} +3 -3
  92. package/chunks/{chunk-5PWLQ7SK.js → chunk-KLOMACIR.js} +15 -8
  93. package/chunks/{chunk-XWUQ4IH5.js → chunk-KWX56CHZ.js} +7 -7
  94. package/chunks/{chunk-VQZXRLEX.js → chunk-LCX5B364.js} +3 -3
  95. package/chunks/{chunk-CTQE2NB2.js → chunk-LSRI3ND3.js} +1 -1
  96. package/chunks/{chunk-5TXOGH4I.js → chunk-LUISTZXI.js} +3 -3
  97. package/chunks/{chunk-6AECVSVX.js → chunk-MAKIANMX.js} +3 -3
  98. package/chunks/{chunk-M4OYAR6J.js → chunk-MDNUCDKZ.js} +2 -2
  99. package/chunks/{chunk-CZXQ4UZA.js → chunk-MELQSJOU.js} +1 -1
  100. package/chunks/{chunk-6ZIIHBNV.js → chunk-MUNA4QDC.js} +4 -4
  101. package/chunks/{chunk-E5BWLU5J.js → chunk-N4SVADAV.js} +305 -143
  102. package/chunks/{chunk-URK542T4.js → chunk-NF5J2WFA.js} +15 -2
  103. package/chunks/{chunk-GJJQV4PY.js → chunk-NLFLYSS4.js} +1 -1
  104. package/chunks/{chunk-FRH4SSGX.js → chunk-NW2GIPG3.js} +2 -4
  105. package/chunks/{chunk-JS4Q5NG5.js → chunk-NX4A23LY.js} +3 -3
  106. package/chunks/{chunk-DEG7R6Z6.js → chunk-OK47XBYH.js} +79 -36
  107. package/chunks/{chunk-7D4KEFOT.js → chunk-OPVF453Q.js} +3 -3
  108. package/chunks/{chunk-J7DNMZFO.js → chunk-OR64CU46.js} +1 -1
  109. package/chunks/{chunk-DAX3G67A.js → chunk-OWGRUU7F.js} +1 -1
  110. package/chunks/{chunk-M2PY7CNK.js → chunk-OWXFBIB6.js} +2 -2
  111. package/chunks/{chunk-NELCY6JT.js → chunk-OYWVIXHT.js} +1 -3
  112. package/chunks/{chunk-V7RNNPGC.js → chunk-P5Y23G2L.js} +18 -1
  113. package/chunks/{chunk-QZ5G26ZE.js → chunk-PTSEETCO.js} +27 -27
  114. package/chunks/{chunk-IEP44U2R.js → chunk-PVXEJB66.js} +1 -1
  115. package/chunks/{chunk-NC4O6UE6.js → chunk-PZW46OTB.js} +2 -2
  116. package/chunks/{chunk-RQVVXDHS.js → chunk-Q4ZPYNIZ.js} +4 -4
  117. package/chunks/{chunk-QSWDGAIC.js → chunk-QILD6R27.js} +1 -1
  118. package/chunks/{chunk-GLWWPFTW.js → chunk-QLTATTPS.js} +1 -1
  119. package/chunks/{chunk-QTI7SRXI.js → chunk-QPBFRWCP.js} +3 -3
  120. package/chunks/{chunk-3TT6MZHJ.js → chunk-QSD4UH74.js} +842 -62
  121. package/chunks/{chunk-TEKFBSMY.js → chunk-RDVNSJQU.js} +3 -3
  122. package/chunks/{chunk-NPE3STIW.js → chunk-ROIJYS5K.js} +6 -6
  123. package/chunks/{chunk-JEMR2FTD.js → chunk-RQJA2YYO.js} +4 -4
  124. package/chunks/{chunk-YI6UGZF5.js → chunk-S6TCTH4Z.js} +13 -13
  125. package/chunks/{chunk-ZGWY4YUB.js → chunk-SYHXR6WM.js} +5 -5
  126. package/chunks/{chunk-O4BBDP2G.js → chunk-TB4YFWXG.js} +2 -2
  127. package/chunks/{chunk-ILVATFYJ.js → chunk-TDESMS7M.js} +22 -18
  128. package/chunks/{chunk-47FQVRCO.js → chunk-TMFWI4RC.js} +1 -1
  129. package/chunks/{chunk-T4FTABSW.js → chunk-TQDFSQQF.js} +1 -1
  130. package/chunks/{chunk-ZV4XVYL3.js → chunk-TTRH3RTQ.js} +4 -4
  131. package/chunks/{chunk-ZWPWQEF5.js → chunk-TXP5NGG3.js} +1 -1
  132. package/chunks/{chunk-E3GLDLYB.js → chunk-TYAMGABM.js} +0 -6
  133. package/chunks/{chunk-VWD7SNNN.js → chunk-UI5UGEF4.js} +1082 -926
  134. package/chunks/{chunk-MWZYNOCG.js → chunk-ULNWG62W.js} +3 -3
  135. package/chunks/{chunk-HGCQ5SE7.js → chunk-UXEO7E3V.js} +21 -0
  136. package/chunks/{chunk-U6PTKAOW.js → chunk-V6OBVAST.js} +1 -1
  137. package/chunks/{chunk-5UPJ774B.js → chunk-VIFA5VJD.js} +1 -1
  138. package/chunks/{chunk-Y66OOMKS.js → chunk-VLHR7F4E.js} +595 -58
  139. package/chunks/{chunk-EYS3GGM3.js → chunk-VPV7WBVT.js} +1 -1
  140. package/chunks/{chunk-XCGIMOLN.js → chunk-WCCLLK7X.js} +14 -1
  141. package/chunks/{chunk-JL3LC3CQ.js → chunk-WCEI6J56.js} +1 -1
  142. package/chunks/{chunk-JXK3WAP7.js → chunk-WDVDVWJ3.js} +6 -6
  143. package/chunks/{chunk-ZQSNP4TG.js → chunk-WI6GIM2M.js} +2 -2
  144. package/chunks/{chunk-TRYJ3BVE.js → chunk-WM3LUQLO.js} +7 -7
  145. package/chunks/{chunk-VJNBRRZG.js → chunk-WZMH7II3.js} +1 -1
  146. package/chunks/{chunk-HBZUU4AE.js → chunk-X5SLJOMF.js} +9 -7
  147. package/chunks/{chunk-FDWH6CBK.js → chunk-XAFIL4BD.js} +7 -7
  148. package/chunks/{chunk-P2UCMHDT.js → chunk-XDRXOSAD.js} +3 -3
  149. package/chunks/{chunk-RRQJPCRQ.js → chunk-XH3KAV2G.js} +2 -2
  150. package/chunks/{chunk-F6AOBFUN.js → chunk-YBHUXEC6.js} +1 -1
  151. package/chunks/{chunk-GZGDJ4E6.js → chunk-YBVVOSOH.js} +1 -1
  152. package/chunks/{chunk-EXG2R5UR.js → chunk-YCHNAKC5.js} +16 -14
  153. package/chunks/{chunk-XTH2OMDS.js → chunk-YIGGWOJE.js} +1 -1
  154. package/chunks/{chunk-IX7CFQGA.js → chunk-YILJKX2T.js} +3 -3
  155. package/chunks/{chunk-SSAOTDK7.js → chunk-YX2RDGAL.js} +1 -1
  156. package/chunks/{chunk-6S52N6PG.js → chunk-ZBB5EZZV.js} +2 -2
  157. package/chunks/{chunk-3GCU5O2E.js → chunk-ZLCT4C5A.js} +1 -1
  158. package/chunks/{chunk-4ETA3KRC.js → chunk-ZMY2P4L3.js} +3 -3
  159. package/chunks/{chunk-575MI5K3.js → chunk-ZQUY3ZJU.js} +4 -4
  160. package/chunks/{computer-use-S4JEU5P7.js → computer-use-F4URV4TU.js} +45 -45
  161. package/chunks/{config-utils-TXVKR27S.js → config-utils-Z3OW3IQG.js} +4 -4
  162. package/chunks/{contextCommand-2H5OH2HW.js → contextCommand-IGSS2U5J.js} +44 -44
  163. package/chunks/{core-runtime-IAQ4DD4Y.js → core-runtime-H5CZDN3A.js} +42 -42
  164. package/chunks/{create-sub-session-EKHKXJAA.js → create-sub-session-PA7MFTHK.js} +42 -42
  165. package/chunks/{create-sub-session-Y4WYDZGC.js → create-sub-session-XT6DLYOE.js} +2 -2
  166. package/chunks/{cron-create-ZOVA3CC2.js → cron-create-2JZ2TWTF.js} +4 -4
  167. package/chunks/{cron-delete-7Z3H4LJY.js → cron-delete-CTPD2P26.js} +4 -4
  168. package/chunks/{cron-list-UHGX3IQG.js → cron-list-V44KHAF6.js} +4 -4
  169. package/chunks/{daemon-PXIC4ZDK.js → daemon-GED37WOX.js} +30 -2
  170. package/chunks/daemon-git-worktree-guard-LZDCNJGV.js +2062 -0
  171. package/chunks/daemon-status-provider-QYM57Z44.js +102 -0
  172. package/chunks/{daemon-trust-policy-7JOBVFH3.js → daemon-trust-policy-TSRVEYZR.js} +48 -48
  173. package/chunks/{daemon-trust-policy-monitor-OU3NRHAR.js → daemon-trust-policy-monitor-2K2YETMT.js} +48 -48
  174. package/chunks/{deferred-core-runtime-SFT3KI2C.js → deferred-core-runtime-FKJ3OYE7.js} +44 -44
  175. package/chunks/{devtools-X6ROTKHE.js → devtools-4QFYJT6U.js} +1 -1
  176. package/chunks/{display-image-ZE3GZNIK.js → display-image-M2ELAVN4.js} +4 -4
  177. package/chunks/{dist-KTYDJNYM.js → dist-4ZPG4BY6.js} +2 -2
  178. package/chunks/{dist-NPS52B2V.js → dist-BROOP2EG.js} +1 -1
  179. package/chunks/{dist-BW2LDPV3.js → dist-IYYN3RUT.js} +2 -2
  180. package/chunks/{dist-EFJILGIS.js → dist-JWMKPWT5.js} +3 -1
  181. package/chunks/{dist-AVUYBK7L.js → dist-K7IQB53U.js} +1 -1
  182. package/chunks/{dist-PKSRQAR2.js → dist-MAQXAQ2Y.js} +1 -1
  183. package/chunks/{dist-BNWP6IZL.js → dist-WJ4BHIEW.js} +2 -2
  184. package/chunks/{dist-ZWDH5HLS.js → dist-YEPL4RAW.js} +1 -1
  185. package/chunks/{earlyInputCapture-27RPWE2D.js → earlyInputCapture-WJBSJQUF.js} +43 -43
  186. package/chunks/{edit-WXVZ7FHS.js → edit-X73LA4YO.js} +50 -49
  187. package/chunks/{enter-worktree-TYMVXFLA.js → enter-worktree-CLRQTIVN.js} +47 -47
  188. package/chunks/{enterPlanMode-FT4MRU5N.js → enterPlanMode-6BDYUQ5T.js} +48 -48
  189. package/chunks/{environment-Z6OMA34I.js → environment-WOAJXJDJ.js} +44 -44
  190. package/chunks/{errors-YMXK2GG3.js → errors-7OY5MXYY.js} +44 -44
  191. package/chunks/{exit-worktree-ODZUQLGJ.js → exit-worktree-TFFJXCRT.js} +47 -47
  192. package/chunks/{exitPlanMode-MBPAPBBV.js → exitPlanMode-WDURQMIU.js} +42 -42
  193. package/chunks/{external-tool-guard-provider-5HTGOPGU.js → external-tool-guard-provider-TE4DRY36.js} +1 -1
  194. package/chunks/{fast-path-ZU5T6XSN.js → fast-path-QQLGC37M.js} +5 -5
  195. package/chunks/{gemini-OZK6AIMC.js → gemini-VHE62IJL.js} +110 -105
  196. package/chunks/{geminiContentGenerator-MC6ZKWZG.js → geminiContentGenerator-VSHIEGAQ.js} +11 -11
  197. package/chunks/{glob-KJ4A4ZOM.js → glob-VMEEDDLO.js} +49 -49
  198. package/chunks/{goal-tools-JDK2SNMV.js → goal-tools-M4UDAZXP.js} +4 -4
  199. package/chunks/{grep-QWBLG564.js → grep-F4UAR7KX.js} +47 -47
  200. package/chunks/{handleAutoUpdate-M3ACKDKF.js → handleAutoUpdate-GN7Z6QAC.js} +46 -46
  201. package/chunks/{i18n-FPW7XZL5.js → i18n-ETW24DHW.js} +43 -43
  202. package/chunks/{image-gen-OTFC2S7L.js → image-gen-YPK2AZT4.js} +11 -11
  203. package/chunks/{initializer-5HKUXXBT.js → initializer-UA6KQ7MS.js} +49 -49
  204. package/chunks/{installationInfo-4OA6UW7V.js → installationInfo-P7OTIR4P.js} +43 -43
  205. package/chunks/{keychain-token-storage-JTWUYFU7.js → keychain-token-storage-NKKCUHI2.js} +2 -2
  206. package/chunks/{list-3TKZ264A.js → list-GRAMIQOT.js} +51 -51
  207. package/chunks/{list-agents-4GQ2XNEU.js → list-agents-O6WSY4CT.js} +2 -2
  208. package/chunks/{loadedSettingsAdapter-IRUANLS2.js → loadedSettingsAdapter-5O2TDS3I.js} +48 -48
  209. package/chunks/{loggingContentGenerator-D4URLH2A.js → loggingContentGenerator-J2J2AANS.js} +151 -120
  210. package/chunks/{loop-wakeup-HOQI3K5D.js → loop-wakeup-GVQRMUKS.js} +5 -5
  211. package/chunks/{ls-FSHISLLA.js → ls-6W2D7TKU.js} +6 -6
  212. package/chunks/{lsp-APQJ5ZEZ.js → lsp-NJ4KFBI2.js} +2 -2
  213. package/chunks/{managed-npm-update-2O7XSAWJ.js → managed-npm-update-WMV5ITKU.js} +45 -45
  214. package/chunks/{mcp-AFVHCHKT.js → mcp-XLP33CAI.js} +48 -48
  215. package/chunks/{monitor-PY4WDSX3.js → monitor-2MM23VDV.js} +47 -47
  216. package/chunks/{node-YSOU44FX.js → node-UUDY34IG.js} +3 -3
  217. package/chunks/nonInteractiveCli-KTA5K6FS.js +163 -0
  218. package/chunks/{notebook-edit-GEPL33NO.js → notebook-edit-QD4TRKLY.js} +47 -47
  219. package/chunks/{openaiContentGenerator-ACYSXQ6R.js → openaiContentGenerator-KLHSPVN2.js} +31 -31
  220. package/chunks/{pidfile-SUNYCAA4.js → pidfile-RQGZBNXT.js} +43 -43
  221. package/chunks/{processUtils-F7LP7YUV.js → processUtils-HZZDA2VV.js} +2 -2
  222. package/chunks/{qwenContentGenerator-BB6IPELF.js → qwenContentGenerator-T75M2Z3B.js} +50 -50
  223. package/chunks/{qwenOAuth2-OU3WGDOI.js → qwenOAuth2-5QZU444W.js} +10 -10
  224. package/chunks/{read-file-GORBXJTS.js → read-file-LOVUSBJC.js} +12 -12
  225. package/chunks/{read-mcp-resource-TJSJRH4F.js → read-mcp-resource-GWCP23WG.js} +2 -2
  226. package/chunks/{read-package-up-TCM6I7S2.js → read-package-up-K6RKTL5D.js} +1 -1
  227. package/chunks/{record-artifact-FXF5LHPE.js → record-artifact-IYQDEYMV.js} +3 -3
  228. package/chunks/{resumeHistoryUtils-FOAJJJWK.js → resumeHistoryUtils-LVKSSQII.js} +50 -50
  229. package/chunks/{ripGrep-RNLIZGCY.js → ripGrep-ZJSHKB6H.js} +42 -42
  230. package/chunks/{run-qwen-serve-GVMMX3IU.js → run-qwen-serve-GZW7B4WK.js} +186 -90
  231. package/chunks/{runtime-RNBZ5FDD.js → runtime-MYRXEO2E.js} +53 -53
  232. package/chunks/{scheduler-NTRFSPIP.js → scheduler-DPTPI6FW.js} +44 -44
  233. package/chunks/{sdk-exporters-grpc-4QKV6MCX.js → sdk-exporters-grpc-54L4LS5L.js} +2 -2
  234. package/chunks/{sdk-exporters-http-2VPMAPFI.js → sdk-exporters-http-NHBYB5FZ.js} +21 -17
  235. package/chunks/{sdk-impl-5W3JUCWF.js → sdk-impl-SK4P5WON.js} +17 -14
  236. package/chunks/{send-message-RBYLV5NY.js → send-message-O7FO63UK.js} +6 -6
  237. package/chunks/{serve-H3PGA26U.js → serve-XCG4XCDA.js} +52 -52
  238. package/chunks/{server-SUXD2F3C.js → server-AWQHKXLG.js} +310 -200
  239. package/chunks/{session-MTFVUWWM.js → session-P5FKNCNR.js} +94 -97
  240. package/chunks/{settings-GUJ3TN2J.js → settings-CSYVIP2R.js} +47 -47
  241. package/chunks/{shell-C2UP5FF2.js → shell-EGTSUO2P.js} +42 -42
  242. package/chunks/{skill-4XCNK55E.js → skill-IFUD72GF.js} +22 -22
  243. package/chunks/{skill-settings-Y2BU27XM.js → skill-settings-YOE7LBHE.js} +47 -47
  244. package/chunks/{spawnChannel-UUUUK734.js → spawnChannel-PQSZIOLY.js} +45 -47
  245. package/chunks/{standalone-update-MJ722XZ4.js → standalone-update-RB2EGUSF.js} +44 -44
  246. package/chunks/{startInteractiveUI-TCPIPNGN.js → startInteractiveUI-KMYUJ2MU.js} +3040 -2399
  247. package/chunks/{syntheticOutput-D3Z64LJC.js → syntheticOutput-DVHJMUGV.js} +3 -3
  248. package/chunks/{task-create-URFZ5EUX.js → task-create-4NC7PDI4.js} +11 -11
  249. package/chunks/{task-list-6JDFMPUW.js → task-list-LBSRMOC7.js} +5 -5
  250. package/chunks/{task-stop-HHUGCD25.js → task-stop-YFNATTIM.js} +2 -2
  251. package/chunks/{task-update-DVV6CUGI.js → task-update-BPLM52GD.js} +12 -12
  252. package/chunks/{team-create-WZWH2NJI.js → team-create-B6A6MJBT.js} +47 -47
  253. package/chunks/{team-delete-PZGGBQLM.js → team-delete-MKYMYBFM.js} +5 -5
  254. package/chunks/{team-plan-approval-SUZQJCWJ.js → team-plan-approval-5WO3CXXU.js} +48 -48
  255. package/chunks/{terminal-image-renderer-BCUN3Z3W.js → terminal-image-renderer-BTRE2GEU.js} +44 -44
  256. package/chunks/{theme-manager-UGMFDREN.js → theme-manager-XL2N5SBY.js} +43 -43
  257. package/chunks/{todoWrite-WINAZSZI.js → todoWrite-K5K7NRE5.js} +4 -4
  258. package/chunks/{tool-search-B6F3MPUZ.js → tool-search-QNBLXUGR.js} +18 -18
  259. package/chunks/{total-session-admission-MQLBJ5WL.js → total-session-admission-N4E5SFBO.js} +49 -49
  260. package/chunks/{trustedFolders-2XST7U5C.js → trustedFolders-MQS46LIU.js} +43 -43
  261. package/chunks/{update-relaunch-OVC7YNGD.js → update-relaunch-536KRL33.js} +5 -5
  262. package/chunks/{updateCheck-YAKM36WQ.js → updateCheck-QJI2SYWF.js} +48 -48
  263. package/chunks/{useAutoAcceptIndicator-RF6FVX3S.js → useAutoAcceptIndicator-7QASHD46.js} +51 -51
  264. package/chunks/{validateNonInterActiveAuth-IPPXFNQH.js → validateNonInterActiveAuth-ZNRGWBLV.js} +86 -88
  265. package/chunks/{version-4IDFEXOU.js → version-DBEQAFRW.js} +2 -2
  266. package/chunks/{web-fetch-NUOLHXPN.js → web-fetch-MBIVXKPE.js} +21 -21
  267. package/chunks/{web-search-LVOOV4XZ.js → web-search-4LBIN6VF.js} +16 -16
  268. package/chunks/{workflow-JSTYTG3K.js → workflow-LNMA55HY.js} +127 -61
  269. package/chunks/{workspace-providers-status-U4EYXA4K.js → workspace-providers-status-PDDMI6ST.js} +51 -51
  270. package/chunks/{workspace-registration-store-OG66U3CB.js → workspace-registration-store-BGRKKIYR.js} +1 -1
  271. package/chunks/{workspace-registry-WSHWQRQQ.js → workspace-registry-L4NCJ34K.js} +49 -49
  272. package/chunks/{workspace-service-QZXQHX2F.js → workspace-service-LOXYKYTR.js} +54 -54
  273. package/chunks/{workspace-skills-status-VRBHEX5O.js → workspace-skills-status-IJ5FOQI6.js} +49 -49
  274. package/chunks/{workspace-trust-reconciler-FCRIUIOF.js → workspace-trust-reconciler-H36TCR2S.js} +57 -57
  275. package/chunks/{write-file-PYL3JCCD.js → write-file-JJAY7JSP.js} +42 -42
  276. package/chunks/{zoom-image-RS6MU26F.js → zoom-image-4MVVVM7E.js} +12 -12
  277. package/cli.js +18 -17
  278. package/package.json +4 -4
  279. package/web-shell/assets/{arc-CgGUyHWd.js → arc-B-89zHN4.js} +1 -1
  280. package/web-shell/assets/{architectureDiagram-3BPJPVTR-BR0Qv-1Y.js → architectureDiagram-3BPJPVTR-BkcOncHk.js} +1 -1
  281. package/web-shell/assets/{blockDiagram-GPEHLZMM-DIoaceaI.js → blockDiagram-GPEHLZMM-DQ4yboaF.js} +1 -1
  282. package/web-shell/assets/{c4Diagram-AAUBKEIU-Bc5k6BbI.js → c4Diagram-AAUBKEIU-C_8ZjPDI.js} +1 -1
  283. package/web-shell/assets/channel-Du2WFns8.js +1 -0
  284. package/web-shell/assets/{chunk-2J33WTMH-DtPEz2WX.js → chunk-2J33WTMH-naKVe1Bm.js} +1 -1
  285. package/web-shell/assets/{chunk-4BX2VUAB-Dydo6ydE.js → chunk-4BX2VUAB-DdoViKT2.js} +1 -1
  286. package/web-shell/assets/{chunk-55IACEB6-DD9_VWXm.js → chunk-55IACEB6-DUDQZEwU.js} +1 -1
  287. package/web-shell/assets/{chunk-727SXJPM-DVI2m59k.js → chunk-727SXJPM-BqpDTR5s.js} +1 -1
  288. package/web-shell/assets/{chunk-AQP2D5EJ-luatmaTN.js → chunk-AQP2D5EJ-CdmEknkT.js} +1 -1
  289. package/web-shell/assets/{chunk-FMBD7UC4-Duy8NTIi.js → chunk-FMBD7UC4-CH7fFTLB.js} +1 -1
  290. package/web-shell/assets/{chunk-ND2GUHAM-CrL1yhms.js → chunk-ND2GUHAM-ObgSuFKF.js} +1 -1
  291. package/web-shell/assets/{chunk-QZHKN3VN-C7BX6bu1.js → chunk-QZHKN3VN-D9fKdv_s.js} +1 -1
  292. package/web-shell/assets/classDiagram-4FO5ZUOK-Zw0HafH6.js +1 -0
  293. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-Zw0HafH6.js +1 -0
  294. package/web-shell/assets/{cose-bilkent-S5V4N54A-BTzs7mIi.js → cose-bilkent-S5V4N54A-CvzATMx9.js} +1 -1
  295. package/web-shell/assets/{dagre-BM42HDAG-3VTUmWts.js → dagre-BM42HDAG-M_xU21QW.js} +1 -1
  296. package/web-shell/assets/{diagram-2AECGRRQ-Ehdp75GN.js → diagram-2AECGRRQ-CNrl9sW1.js} +1 -1
  297. package/web-shell/assets/{diagram-5GNKFQAL-B3wu3teE.js → diagram-5GNKFQAL-CUweVT6T.js} +1 -1
  298. package/web-shell/assets/{diagram-KO2AKTUF-DjgTSf2S.js → diagram-KO2AKTUF-D3n6Lxjo.js} +1 -1
  299. package/web-shell/assets/{diagram-LMA3HP47-Br9mwjY3.js → diagram-LMA3HP47-0SeFPK4t.js} +1 -1
  300. package/web-shell/assets/{diagram-OG6HWLK6-D4xz5M-z.js → diagram-OG6HWLK6-DAgyEwge.js} +1 -1
  301. package/web-shell/assets/{erDiagram-TEJ5UH35-CXayWlG_.js → erDiagram-TEJ5UH35-CzxBBDIK.js} +1 -1
  302. package/web-shell/assets/{flowDiagram-I6XJVG4X-CLonjQTi.js → flowDiagram-I6XJVG4X-B0uj0jyo.js} +1 -1
  303. package/web-shell/assets/{ganttDiagram-6RSMTGT7-BTySFT-1.js → ganttDiagram-6RSMTGT7-DFzcj5km.js} +1 -1
  304. package/web-shell/assets/{gitGraphDiagram-PVQCEYII--2WcUjOe.js → gitGraphDiagram-PVQCEYII-DylJ_Fc9.js} +1 -1
  305. package/web-shell/assets/index-BIGQygTL.css +5 -0
  306. package/web-shell/assets/{index-DPJHkFOG.js → index-BKSAnXU9.js} +1 -1
  307. package/web-shell/assets/index-J7OMTqAN.js +1789 -0
  308. package/web-shell/assets/{infoDiagram-5YYISTIA-9vpgAf1m.js → infoDiagram-5YYISTIA-BYMcJVMI.js} +1 -1
  309. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-DcRpHnAW.js → ishikawaDiagram-YF4QCWOH-t1quI1S3.js} +1 -1
  310. package/web-shell/assets/{journeyDiagram-JHISSGLW-C2TKorRm.js → journeyDiagram-JHISSGLW-YM_QVUJm.js} +1 -1
  311. package/web-shell/assets/{kanban-definition-UN3LZRKU-DdsFwB8b.js → kanban-definition-UN3LZRKU-jw8OddK1.js} +1 -1
  312. package/web-shell/assets/{linear-7PjRvJrf.js → linear-Dlr3RVuP.js} +1 -1
  313. package/web-shell/assets/{mermaid.core-raDXa11C.js → mermaid.core-CqGKzNzd.js} +5 -5
  314. package/web-shell/assets/{mindmap-definition-RKZ34NQL-DLHc-PRN.js → mindmap-definition-RKZ34NQL-BqureoOS.js} +1 -1
  315. package/web-shell/assets/{pieDiagram-4H26LBE5-BftYpeTW.js → pieDiagram-4H26LBE5-Da20HkK1.js} +1 -1
  316. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-O-6ygOYn.js → quadrantDiagram-W4KKPZXB-BsNlMvJy.js} +1 -1
  317. package/web-shell/assets/{requirementDiagram-4Y6WPE33-BmZWVufJ.js → requirementDiagram-4Y6WPE33-DzVCQCse.js} +1 -1
  318. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-2x5beiWt.js → sankeyDiagram-5OEKKPKP-BMo16voT.js} +1 -1
  319. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-BH8uKokQ.js → sequenceDiagram-3UESZ5HK-Bgi-pdHk.js} +1 -1
  320. package/web-shell/assets/{stateDiagram-AJRCARHV-Dq1MFgX_.js → stateDiagram-AJRCARHV-xaPQXwGk.js} +1 -1
  321. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-D5RqimXD.js +1 -0
  322. package/web-shell/assets/{timeline-definition-PNZ67QCA-Cl2WKbv9.js → timeline-definition-PNZ67QCA-C_9RuvKG.js} +1 -1
  323. package/web-shell/assets/{vennDiagram-CIIHVFJN-BqoRo_Q-.js → vennDiagram-CIIHVFJN-Bgu6vdla.js} +1 -1
  324. package/web-shell/assets/{wardley-L42UT6IY-BTxp-Yot.js → wardley-L42UT6IY-CFTZ8IrX.js} +1 -1
  325. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-DFXVCSH2.js → wardleyDiagram-YWT4CUSO-BASW9Vmt.js} +1 -1
  326. package/web-shell/assets/{xychartDiagram-2RQKCTM6-qQhWx0aE.js → xychartDiagram-2RQKCTM6--Nh-CD3F.js} +1 -1
  327. package/web-shell/index.html +2 -2
  328. package/chunks/chunk-CG3OQDNY.js +0 -649
  329. package/chunks/chunk-L34XSHIZ.js +0 -28
  330. package/chunks/chunk-N2TNM3QB.js +0 -9
  331. package/chunks/chunk-UOMZKPI5.js +0 -830
  332. package/chunks/chunk-WFRHWDBT.js +0 -622
  333. package/chunks/chunk-WLML6VIA.js +0 -18
  334. package/chunks/chunk-ZBBVBZBR.js +0 -137
  335. package/chunks/chunk-bdqvmfwv-OHYAFAAO.js +0 -17446
  336. package/chunks/daemon-status-provider-LPYR2GXY.js +0 -103
  337. package/chunks/dispatch-B53LNEO4.js +0 -37
  338. package/chunks/nonInteractiveCli-ZHW6F76F.js +0 -166
  339. package/chunks/opentui-entry-SBAOWW7M.js +0 -52325
  340. package/chunks/runtime-gate-T4ICWGQJ.js +0 -89
  341. package/chunks/wrapper-46Z24CTM.js +0 -35
  342. package/web-shell/assets/channel-D2b9IYpS.js +0 -1
  343. package/web-shell/assets/classDiagram-4FO5ZUOK-DHatTCmD.js +0 -1
  344. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-DHatTCmD.js +0 -1
  345. package/web-shell/assets/index-CIFO52Wx.css +0 -5
  346. package/web-shell/assets/index-bhq3CUUF.js +0 -1789
  347. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-spuAYji6.js +0 -1
  348. /package/chunks/{chunk-44CTCCLY.js → chunk-NWNEANAT.js} +0 -0
@@ -6,18 +6,20 @@ import {
6
6
  EventBus,
7
7
  logEventSizingFailed,
8
8
  serializedBridgeEventByteLength
9
- } from "./chunk-MZSJ43WV.js";
9
+ } from "./chunk-7U5G6JXI.js";
10
10
  import {
11
+ JOURNAL_GROWTH_HARD_CAP_BYTES,
11
12
  normalizeCompactedReplayMaxBytes,
13
+ normalizeJournalGrowthPoolBytes,
12
14
  normalizeMaxJournalBytes,
13
15
  normalizeMaxJournalEvents
14
- } from "./chunk-XCGIMOLN.js";
16
+ } from "./chunk-WCCLLK7X.js";
15
17
  import {
16
18
  MCP_RESTART_SERVER_DEADLINE_MS
17
19
  } from "./chunk-OCPBI7J5.js";
18
20
  import {
19
21
  defaultSpawnChannelFactory
20
- } from "./chunk-TYGKUOEG.js";
22
+ } from "./chunk-DAV4QFD5.js";
21
23
  import {
22
24
  BridgeChannelClosedError,
23
25
  BridgeTimeoutError,
@@ -27,7 +29,7 @@ import {
27
29
  SessionRestoreTimeoutError,
28
30
  createIdleWorkspaceExtensionsStatus,
29
31
  createIdleWorkspaceHooksStatus
30
- } from "./chunk-OPBATTFQ.js";
32
+ } from "./chunk-HTYND72J.js";
31
33
  import {
32
34
  ACTIVE_WORK_CLOSE_IF_UNHELD_PARAM,
33
35
  ACTIVE_WORK_CLOSE_TIMEOUT_MS,
@@ -39,6 +41,7 @@ import {
39
41
  ACTIVE_WORK_MAX_SNAPSHOT_SESSIONS,
40
42
  ACTIVE_WORK_NOTIFICATION_METHOD,
41
43
  ACTIVE_WORK_STALE_INTERVALS,
44
+ CHANNEL_PROMPT_META_KEY,
42
45
  CHANNEL_STARTUP_PROFILE_META_KEY,
43
46
  CHANNEL_STARTUP_PROFILE_VERSION,
44
47
  DAEMON_CHANNEL_DELIVERY_META_KEY,
@@ -46,6 +49,7 @@ import {
46
49
  DAEMON_PROMPT_DISPLAY_TEXT_META_KEY,
47
50
  LOAD_REPLAY_BULK_MODE,
48
51
  LOAD_REPLAY_HIDE_INHERITED_META_KEY,
52
+ LOAD_REPLAY_MAX_UPDATES,
49
53
  LOAD_REPLAY_META_KEY,
50
54
  LOAD_REPLAY_MODE_META_KEY,
51
55
  LOAD_REPLAY_PAGE_SIZE_META_KEY,
@@ -59,7 +63,7 @@ import {
59
63
  WORKTREE_MCP_DEFER_META_KEY,
60
64
  clampActiveWorkIntervalMs,
61
65
  isValidTrustedModelPrompt
62
- } from "./chunk-HHGQGTJQ.js";
66
+ } from "./chunk-FQDCO3CJ.js";
63
67
  import {
64
68
  BranchWhilePromptActiveError,
65
69
  BridgeChannelQuarantinedError,
@@ -98,7 +102,7 @@ import {
98
102
  EXTERNAL_TOOL_GUARD_READY_META_KEY,
99
103
  EXTERNAL_TOOL_GUARD_REQUIRED_VALUE,
100
104
  isValidExternalToolGuardDenialReason
101
- } from "./chunk-BKHCW2BI.js";
105
+ } from "./chunk-3VUENPWF.js";
102
106
  import {
103
107
  ClientSideConnection,
104
108
  PROTOCOL_VERSION,
@@ -116,16 +120,16 @@ import {
116
120
  metadataBudgetBytes,
117
121
  normalizeSnapshotPayload,
118
122
  stableSessionArtifactId
119
- } from "./chunk-M6HXP2SG.js";
123
+ } from "./chunk-EBPLKY6U.js";
120
124
  import {
121
125
  DAEMON_TRACEPARENT_META_KEY,
122
126
  DAEMON_TRACESTATE_META_KEY
123
- } from "./chunk-O5AZPHYZ.js";
127
+ } from "./chunk-K34GJQOZ.js";
124
128
  import {
125
129
  INVOCATION_CONTEXT_META_KEY,
126
130
  PRIVATE_ACP_CAPABILITY_ENV,
127
131
  PRIVATE_PARENT_CAPABILITY_META_KEY
128
- } from "./chunk-HB6QW4LM.js";
132
+ } from "./chunk-4KM2SYK5.js";
129
133
  import {
130
134
  init_esbuild_shims
131
135
  } from "./chunk-5O2XNYP6.js";
@@ -155,6 +159,17 @@ var LATEST_WINS_UPDATES = /* @__PURE__ */ new Set([
155
159
  ]);
156
160
  var REPLAY_SEGMENT_COMPACT_THRESHOLD = 64;
157
161
  var LIVE_JOURNAL_TEXT_CHUNKS_PER_EVENT = 256;
162
+ function createLiveJournalState() {
163
+ return {
164
+ entries: [],
165
+ entryBytes: [],
166
+ entryEvents: [],
167
+ totalBytes: 0,
168
+ totalEvents: 0,
169
+ truncatedEvents: 0
170
+ };
171
+ }
172
+ __name(createLiveJournalState, "createLiveJournalState");
158
173
  function replayRecordId(event) {
159
174
  if (event.type !== "session_update") return void 0;
160
175
  const data = event.data;
@@ -180,26 +195,35 @@ function lastRecordIdIn(events) {
180
195
  return void 0;
181
196
  }
182
197
  __name(lastRecordIdIn, "lastRecordIdIn");
198
+ function lastSummaryRecordIdIn(events) {
199
+ for (let i = events.length - 1; i >= 0; i--) {
200
+ if (!isSummaryLiveJournalEvent(events[i])) continue;
201
+ const id = replayRecordId(events[i]);
202
+ if (id !== void 0) return id;
203
+ }
204
+ return void 0;
205
+ }
206
+ __name(lastSummaryRecordIdIn, "lastSummaryRecordIdIn");
207
+ var JOURNAL_GROWTH_REASK_INTERVAL_MS = 1e4;
208
+ var JOURNAL_GROWTH_MAX_GRANTS_PER_BREACH = 64;
183
209
  var TurnBoundaryCompactionEngine = class {
184
210
  static {
185
211
  __name(this, "TurnBoundaryCompactionEngine");
186
212
  }
187
213
  maxReplayBytes;
214
+ // Mutable: adaptive growth (see `maybeGrowJournalLimits`) raises these
215
+ // in place when the advisor grants headroom.
188
216
  maxJournalEvents;
189
217
  maxJournalBytes;
218
+ onJournalGrowth;
219
+ now;
220
+ journalGrowthDeniedAt;
190
221
  onReplayWindowEviction;
191
222
  replaySegments = [];
192
223
  replaySegmentStart = 0;
193
224
  replayBytes = 0;
194
- liveJournal = [];
195
- /** Serialized source-event size of each `liveJournal` entry, index-parallel. */
196
- journalEntryBytes = [];
197
- /** Raw event count represented by each `liveJournal` entry. */
198
- journalEntryEvents = [];
199
- journalTotalBytes = 0;
200
- journalTotalEvents = 0;
201
- journalTruncatedEvents = 0;
202
- liveJournalTextSegment;
225
+ fullJournal = createLiveJournalState();
226
+ summaryJournal = createLiveJournalState();
203
227
  lastEventId = 0;
204
228
  closed = false;
205
229
  truncatedEvents = 0;
@@ -212,6 +236,7 @@ var TurnBoundaryCompactionEngine = class {
212
236
  // pagination. Undefined until at least one recordId has been observed;
213
237
  // omitted from the marker in that case.
214
238
  activeRecordId;
239
+ summaryRecordId;
215
240
  // Pagination anchor for the replay-path `history_truncated` marker,
216
241
  // frozen at the first replay-window eviction. Prefers the first
217
242
  // retained recordId (the eviction boundary, so `beforeRecordId`
@@ -232,19 +257,30 @@ var TurnBoundaryCompactionEngine = class {
232
257
  this.maxReplayBytes = normalizeCompactedReplayMaxBytes(opts.maxReplayBytes);
233
258
  this.maxJournalEvents = normalizeMaxJournalEvents(opts.maxJournalEvents);
234
259
  this.maxJournalBytes = normalizeMaxJournalBytes(opts.maxJournalBytes);
260
+ this.onJournalGrowth = opts.onJournalGrowth;
261
+ this.now = opts.now ?? (() => performance.now());
235
262
  this.onReplayWindowEviction = opts.onReplayWindowEviction;
236
263
  }
264
+ /** Current journal caps — may have grown past the configured baseline. */
265
+ journalLimits() {
266
+ return { maxEvents: this.maxJournalEvents, maxBytes: this.maxJournalBytes };
267
+ }
237
268
  ingest(event, byteLength) {
238
269
  if (this.closed) return;
239
270
  if (event.id !== void 0) {
240
271
  this.lastEventId = event.id;
241
272
  }
242
273
  if (TRANSIENT_TYPES.has(event.type)) return;
274
+ const summaryEvent = isSummaryLiveJournalEvent(event);
243
275
  const seenRecordId = replayRecordId(event);
244
276
  if (seenRecordId !== void 0) {
245
277
  this.activeRecordId = seenRecordId;
278
+ if (summaryEvent) this.summaryRecordId = seenRecordId;
279
+ }
280
+ this.appendLiveJournal(this.fullJournal, event, byteLength);
281
+ if (summaryEvent) {
282
+ this.appendLiveJournal(this.summaryJournal, event, byteLength);
246
283
  }
247
- this.appendLiveJournal(event, byteLength);
248
284
  if (TURN_BOUNDARY_TYPES.has(event.type)) {
249
285
  this.compactCurrentTurn(event);
250
286
  return;
@@ -255,49 +291,62 @@ var TurnBoundaryCompactionEngine = class {
255
291
  }
256
292
  this.slots.push({ kind: "misc", event });
257
293
  }
258
- snapshot() {
294
+ snapshot(liveReplayMode = "full") {
259
295
  const compactedTurns = this.flattenReplaySegments();
260
296
  if (this.truncatedEvents > 0) {
261
297
  compactedTurns.unshift(
262
298
  this.makeHistoryTruncatedEvent(compactedTurns.length)
263
299
  );
264
300
  }
265
- const liveJournal = this.liveJournal.map(
301
+ return {
302
+ compactedTurns,
303
+ liveJournal: this.liveJournalSnapshot(liveReplayMode),
304
+ lastEventId: this.lastEventId
305
+ };
306
+ }
307
+ /**
308
+ * Snapshot of only the in-flight live journal — the events ingested
309
+ * since the last turn boundary (a boundary folds its turn into the
310
+ * replay window and resets the journal). Cheaper than `snapshot()`:
311
+ * no replay-window flatten.
312
+ */
313
+ liveJournalSnapshot(liveReplayMode = "full") {
314
+ const journal = liveReplayMode === "summary" ? this.summaryJournal : this.fullJournal;
315
+ const journalRecordId = liveReplayMode === "summary" ? this.summaryRecordId : this.activeRecordId;
316
+ const liveJournal = journal.entries.map(
266
317
  (entry) => isLiveJournalTextSegment(entry) ? mergeLiveJournalTextEvent(
267
318
  entry.firstEvent,
268
319
  entry.lastEvent,
269
320
  entry.chunks
270
321
  ) : entry
271
322
  );
272
- if (this.journalTruncatedEvents > 0) {
323
+ if (journal.truncatedEvents > 0) {
273
324
  liveJournal.unshift({
274
325
  v: EVENT_SCHEMA_VERSION,
275
326
  type: "history_truncated",
276
327
  data: {
277
328
  reason: "replay_window_exceeded",
278
329
  scope: "live_journal",
279
- truncatedEvents: this.journalTruncatedEvents,
280
- retainedEvents: this.journalTotalEvents,
330
+ truncatedEvents: journal.truncatedEvents,
331
+ retainedEvents: journal.totalEvents,
281
332
  maxBytes: this.maxJournalBytes,
282
333
  maxEvents: this.maxJournalEvents,
283
334
  // Pagination anchor — see makeHistoryTruncatedEvent.
284
- ...this.activeRecordId !== void 0 ? { recordId: this.activeRecordId } : {},
335
+ ...journalRecordId !== void 0 ? { recordId: journalRecordId } : {},
285
336
  fullTranscriptAvailable: true
286
337
  }
287
338
  });
288
339
  }
289
- return {
290
- compactedTurns,
291
- liveJournal,
292
- lastEventId: this.lastEventId
293
- };
340
+ return liveJournal;
294
341
  }
295
342
  seed(snapshot) {
296
343
  if (this.closed) return;
297
344
  this.resetReplayWindow();
298
345
  this.lastEventId = snapshot.lastEventId;
299
346
  this.activeRecordId = void 0;
347
+ this.summaryRecordId = void 0;
300
348
  this.activeRecordId = lastRecordIdIn(snapshot.compactedTurns);
349
+ this.summaryRecordId = lastSummaryRecordIdIn(snapshot.compactedTurns);
301
350
  for (const event of snapshot.compactedTurns) {
302
351
  if (TRANSIENT_TYPES.has(event.type)) continue;
303
352
  this.addReplaySegment([event], 0);
@@ -311,7 +360,9 @@ var TurnBoundaryCompactionEngine = class {
311
360
  if (this.closed) return;
312
361
  this.resetReplayWindow();
313
362
  this.activeRecordId = void 0;
363
+ this.summaryRecordId = void 0;
314
364
  this.activeRecordId = lastRecordIdIn(events);
365
+ this.summaryRecordId = lastSummaryRecordIdIn(events);
315
366
  let recordEvents = [];
316
367
  let recordId;
317
368
  const flushRecord = /* @__PURE__ */ __name(() => {
@@ -346,22 +397,23 @@ var TurnBoundaryCompactionEngine = class {
346
397
  this.resetReplayWindow();
347
398
  this.resetJournal();
348
399
  this.activeRecordId = void 0;
400
+ this.summaryRecordId = void 0;
349
401
  this.slots = [];
350
402
  this.toolSlotIndex.clear();
351
403
  this.clearTextSlotIndex();
352
404
  }
353
- appendLiveJournal(event, byteLength) {
405
+ appendLiveJournal(journal, event, byteLength) {
354
406
  const bytes = byteLength ?? serializedBridgeEventByteLength(event) ?? 0;
355
407
  const textChunk = liveJournalTextChunk(event);
356
- const current = this.liveJournalTextSegment;
357
- const currentIndex = this.liveJournal.length - 1;
358
- if (textChunk && current && this.liveJournal[currentIndex] === current && current.chunks.length < LIVE_JOURNAL_TEXT_CHUNKS_PER_EVENT && this.journalEntryBytes[currentIndex] + bytes <= this.maxJournalBytes && current.sessionUpdate === textChunk.sessionUpdate && current.parentToolCallId === textChunk.parentToolCallId && stringArraysEqual(current.sourceRecordIds, textChunk.sourceRecordIds) && current.promptId === event.promptId && current.originatorClientId === event.originatorClientId && current.sessionId === captureSessionId(event) && hasOnlyTimestampEnvelopeMeta(current.lastEvent._meta) && hasOnlyTimestampEnvelopeMeta(event._meta)) {
408
+ const current = journal.textSegment;
409
+ const currentIndex = journal.entries.length - 1;
410
+ if (textChunk && current && journal.entries[currentIndex] === current && current.chunks.length < LIVE_JOURNAL_TEXT_CHUNKS_PER_EVENT && journal.entryBytes[currentIndex] + bytes <= this.maxJournalBytes && current.sessionUpdate === textChunk.sessionUpdate && current.parentToolCallId === textChunk.parentToolCallId && stringArraysEqual(current.sourceRecordIds, textChunk.sourceRecordIds) && current.promptId === event.promptId && current.originatorClientId === event.originatorClientId && current.sessionId === captureSessionId(event) && hasOnlyTimestampEnvelopeMeta(current.lastEvent._meta) && hasOnlyTimestampEnvelopeMeta(event._meta)) {
359
411
  current.chunks.push(textChunk.text);
360
412
  current.lastEvent = event;
361
- this.journalEntryBytes[currentIndex] += bytes;
362
- this.journalEntryEvents[currentIndex] += 1;
363
- this.journalTotalBytes += bytes;
364
- this.journalTotalEvents += 1;
413
+ journal.entryBytes[currentIndex] += bytes;
414
+ journal.entryEvents[currentIndex] += 1;
415
+ journal.totalBytes += bytes;
416
+ journal.totalEvents += 1;
365
417
  } else {
366
418
  let entry = event;
367
419
  if (textChunk) {
@@ -377,26 +429,96 @@ var TurnBoundaryCompactionEngine = class {
377
429
  lastEvent: event
378
430
  };
379
431
  entry = segment;
380
- this.liveJournalTextSegment = segment;
432
+ journal.textSegment = segment;
381
433
  } else {
382
- this.liveJournalTextSegment = void 0;
434
+ journal.textSegment = void 0;
435
+ }
436
+ journal.entries.push(entry);
437
+ journal.entryBytes.push(bytes);
438
+ journal.entryEvents.push(1);
439
+ journal.totalBytes += bytes;
440
+ journal.totalEvents += 1;
441
+ }
442
+ if (!TURN_BOUNDARY_TYPES.has(event.type) && (journal.entries.length > this.maxJournalEvents || journal.totalBytes > this.maxJournalBytes && journal.entries.length > 1)) {
443
+ this.maybeGrowJournalLimits(journal);
444
+ }
445
+ while (journal.entries.length > this.maxJournalEvents || journal.totalBytes > this.maxJournalBytes && journal.entries.length > 1) {
446
+ const dropped = journal.entries.shift();
447
+ journal.totalBytes -= journal.entryBytes.shift() ?? 0;
448
+ const droppedEvents = journal.entryEvents.shift() ?? 0;
449
+ journal.totalEvents -= droppedEvents;
450
+ journal.truncatedEvents += droppedEvents;
451
+ if (dropped === journal.textSegment) {
452
+ journal.textSegment = void 0;
453
+ }
454
+ }
455
+ }
456
+ /**
457
+ * Consults the growth advisor once the journal breaches its caps and
458
+ * applies a grant in place, so the eviction loop below only drops what
459
+ * still exceeds the (possibly raised) caps. An intermediate grant that
460
+ * does not yet retain an extra entry is still applied tentatively —
461
+ * each applied cap is what the next ask reports and is charged for —
462
+ * and the walk continues until a grant retains strictly more than the
463
+ * pre-breach caps, the advisor refuses, or the step budget runs out. A
464
+ * walk that never improves retention rolls back to the original caps
465
+ * and counts as a refusal, so the pool is never charged for growth that
466
+ * preserves no replay. Never throws: a misbehaving advisor degrades to
467
+ * plain eviction, matching the engine's best-effort contract.
468
+ */
469
+ maybeGrowJournalLimits(journal) {
470
+ const advisor = this.onJournalGrowth;
471
+ if (!advisor || this.closed) return;
472
+ const now = this.now();
473
+ if (this.journalGrowthDeniedAt !== void 0) {
474
+ const sinceDenialMs = now - this.journalGrowthDeniedAt;
475
+ if (sinceDenialMs >= 0 && sinceDenialMs < JOURNAL_GROWTH_REASK_INTERVAL_MS) {
476
+ return;
383
477
  }
384
- this.liveJournal.push(entry);
385
- this.journalEntryBytes.push(bytes);
386
- this.journalEntryEvents.push(1);
387
- this.journalTotalBytes += bytes;
388
- this.journalTotalEvents += 1;
389
478
  }
390
- while (this.liveJournal.length > this.maxJournalEvents || this.journalTotalBytes > this.maxJournalBytes && this.liveJournal.length > 1) {
391
- const dropped = this.liveJournal.shift();
392
- this.journalTotalBytes -= this.journalEntryBytes.shift() ?? 0;
393
- const droppedEvents = this.journalEntryEvents.shift() ?? 0;
394
- this.journalTotalEvents -= droppedEvents;
395
- this.journalTruncatedEvents += droppedEvents;
396
- if (dropped === this.liveJournalTextSegment) {
397
- this.liveJournalTextSegment = void 0;
479
+ const originalEvents = this.maxJournalEvents;
480
+ const originalBytes = this.maxJournalBytes;
481
+ const originalRetained = this.retainedTailCount(
482
+ journal,
483
+ originalEvents,
484
+ originalBytes
485
+ );
486
+ for (let step = 0; step < JOURNAL_GROWTH_MAX_GRANTS_PER_BREACH; step++) {
487
+ let grant;
488
+ try {
489
+ grant = advisor({
490
+ maxEvents: this.maxJournalEvents,
491
+ maxBytes: this.maxJournalBytes
492
+ });
493
+ } catch {
494
+ grant = void 0;
495
+ }
496
+ if (!grant || !Number.isSafeInteger(grant.maxBytes) || !Number.isSafeInteger(grant.maxEvents) || grant.maxBytes <= this.maxJournalBytes || grant.maxEvents < this.maxJournalEvents) {
497
+ break;
498
+ }
499
+ this.maxJournalBytes = grant.maxBytes;
500
+ this.maxJournalEvents = grant.maxEvents;
501
+ if (this.retainedTailCount(journal, grant.maxEvents, grant.maxBytes) > originalRetained) {
502
+ this.journalGrowthDeniedAt = void 0;
503
+ return;
398
504
  }
399
505
  }
506
+ this.maxJournalEvents = originalEvents;
507
+ this.maxJournalBytes = originalBytes;
508
+ this.journalGrowthDeniedAt = now;
509
+ }
510
+ /** Entries of the newest-first tail the eviction loop would retain. */
511
+ retainedTailCount(journal, maxEvents, maxBytes) {
512
+ let count = 0;
513
+ let bytes = 0;
514
+ for (let i = journal.entries.length - 1; i >= 0; i--) {
515
+ const entryBytes = journal.entryBytes[i] ?? 0;
516
+ if (count + 1 > maxEvents) break;
517
+ if (count >= 1 && bytes + entryBytes > maxBytes) break;
518
+ count += 1;
519
+ bytes += entryBytes;
520
+ }
521
+ return count;
400
522
  }
401
523
  classifySessionUpdate(event) {
402
524
  const data = event.data;
@@ -565,13 +687,9 @@ var TurnBoundaryCompactionEngine = class {
565
687
  }
566
688
  }
567
689
  resetJournal() {
568
- this.liveJournal = [];
569
- this.journalEntryBytes = [];
570
- this.journalEntryEvents = [];
571
- this.journalTotalBytes = 0;
572
- this.journalTotalEvents = 0;
573
- this.journalTruncatedEvents = 0;
574
- this.liveJournalTextSegment = void 0;
690
+ this.fullJournal = createLiveJournalState();
691
+ this.summaryJournal = createLiveJournalState();
692
+ this.journalGrowthDeniedAt = void 0;
575
693
  }
576
694
  addReplaySegment(events, turnCount) {
577
695
  if (events.length === 0) return;
@@ -806,6 +924,21 @@ function extractParentToolCallIdFromMeta(meta) {
806
924
  return void 0;
807
925
  }
808
926
  __name(extractParentToolCallIdFromMeta, "extractParentToolCallIdFromMeta");
927
+ function isSummaryLiveJournalEvent(event) {
928
+ if (event.type !== "session_update") return true;
929
+ const data = event.data;
930
+ const meta = data?.update?._meta;
931
+ const parentToolCallId = extractParentToolCallIdFromMeta(meta);
932
+ if (parentToolCallId === void 0) return true;
933
+ if (parentToolCallId === data?.update?.toolCallId) return true;
934
+ if (data?.update?.sessionUpdate !== "agent_message_chunk") return false;
935
+ if (typeof meta !== "object" || meta === null) return false;
936
+ const usage = meta["usage"];
937
+ if (typeof usage !== "object" || usage === null) return false;
938
+ const fields = usage;
939
+ return typeof fields["inputTokens"] === "number" || typeof fields["outputTokens"] === "number";
940
+ }
941
+ __name(isSummaryLiveJournalEvent, "isSummaryLiveJournalEvent");
809
942
  function extractSourceRecordIdsFromMeta(meta) {
810
943
  if (typeof meta !== "object" || meta === null) return void 0;
811
944
  const transcript = meta["qwenTranscript"];
@@ -928,6 +1061,44 @@ function mergeTranscriptUpdateMeta(existing, incoming) {
928
1061
  }
929
1062
  __name(mergeTranscriptUpdateMeta, "mergeTranscriptUpdateMeta");
930
1063
 
1064
+ // packages/acp-bridge/src/journalGrowthPolicy.ts
1065
+ init_esbuild_shims();
1066
+ function createJournalGrowthPolicy(opts) {
1067
+ const hardCapEvents = Math.min(
1068
+ Number.MAX_SAFE_INTEGER,
1069
+ Math.max(
1070
+ opts.baselineEvents,
1071
+ Math.ceil(opts.hardCapBytes / opts.baselineBytes * opts.baselineEvents)
1072
+ )
1073
+ );
1074
+ return {
1075
+ grant(request) {
1076
+ if (request.currentMaxBytes >= opts.hardCapBytes) return void 0;
1077
+ const extraGranted = request.allSessionLimits.reduce(
1078
+ (sum, session) => sum + Math.max(0, session.limitBytes - session.baselineBytes),
1079
+ 0
1080
+ );
1081
+ const available = opts.poolBytes - extraGranted;
1082
+ if (available <= 0) return void 0;
1083
+ const maxBytes = Math.min(
1084
+ request.currentMaxBytes * 2,
1085
+ request.currentMaxBytes + available,
1086
+ opts.hardCapBytes
1087
+ );
1088
+ if (maxBytes <= request.currentMaxBytes) return void 0;
1089
+ const maxEvents = Math.min(
1090
+ Math.max(
1091
+ request.currentMaxEvents,
1092
+ Math.ceil(maxBytes / opts.baselineBytes * opts.baselineEvents)
1093
+ ),
1094
+ hardCapEvents
1095
+ );
1096
+ return { maxBytes, maxEvents };
1097
+ }
1098
+ };
1099
+ }
1100
+ __name(createJournalGrowthPolicy, "createJournalGrowthPolicy");
1101
+
931
1102
  // packages/acp-bridge/src/session-restore-timeout.ts
932
1103
  init_esbuild_shims();
933
1104
  var DEFAULT_SESSION_RESTORE_TIMEOUT_MS = 6e4;
@@ -2461,12 +2632,13 @@ var BridgeClient = class {
2461
2632
  const toolCallId = params["toolCallId"];
2462
2633
  const toolName = params["toolName"];
2463
2634
  const args = params["arguments"];
2464
- if (typeof sessionId !== "string" || sessionId.length === 0 || typeof promptId !== "string" || promptId.length === 0 || typeof toolCallId !== "string" || toolCallId.length === 0 || typeof toolName !== "string" || toolName.length === 0 || !isRecord2(args)) {
2635
+ if (typeof sessionId !== "string" || sessionId.length === 0 || promptId !== void 0 && (typeof promptId !== "string" || promptId.length === 0) || typeof toolCallId !== "string" || toolCallId.length === 0 || typeof toolName !== "string" || toolName.length === 0 || !isRecord2(args)) {
2465
2636
  throw RequestError.invalidParams(
2466
2637
  void 0,
2467
2638
  "Invalid external tool guard request"
2468
2639
  );
2469
2640
  }
2641
+ const promptScoped = promptId !== void 0;
2470
2642
  if (!this.ownsSession(sessionId)) {
2471
2643
  throw RequestError.invalidParams(
2472
2644
  void 0,
@@ -2474,21 +2646,26 @@ var BridgeClient = class {
2474
2646
  );
2475
2647
  }
2476
2648
  const entry = this.resolveEntry(sessionId);
2477
- if (!entry || !entry.promptActive || entry.activePromptId !== promptId) {
2649
+ if (!entry || promptScoped && (!entry.promptActive || entry.activePromptId !== promptId)) {
2478
2650
  throw RequestError.invalidParams(
2479
2651
  void 0,
2480
2652
  "External tool guard prompt is not the active prompt"
2481
2653
  );
2482
2654
  }
2655
+ const invocationCwd = params["invocationCwd"];
2483
2656
  const decision = await this.externalToolGuard({
2484
2657
  sessionId: entry.sessionId,
2485
- promptId: entry.activePromptId,
2658
+ ...promptScoped ? { promptId } : {},
2486
2659
  toolCallId,
2487
2660
  toolName,
2488
- arguments: args
2661
+ arguments: args,
2662
+ effectiveCwd: entry.effectiveCwd,
2663
+ // Forwarded verbatim and explicitly untrusted: the host policy decides
2664
+ // whether it can establish this scope from state it owns.
2665
+ ...typeof invocationCwd === "string" && invocationCwd.length > 0 ? { invocationCwd } : {}
2489
2666
  });
2490
2667
  const currentEntry = this.resolveEntry(sessionId);
2491
- if (!this.ownsSession(sessionId) || currentEntry !== entry || !currentEntry.promptActive || currentEntry.activePromptId !== promptId) {
2668
+ if (!this.ownsSession(sessionId) || currentEntry !== entry || promptScoped && (!currentEntry.promptActive || currentEntry.activePromptId !== promptId)) {
2492
2669
  throw RequestError.invalidParams(
2493
2670
  void 0,
2494
2671
  "External tool guard prompt is no longer active"
@@ -5911,7 +6088,6 @@ var KNOWN_SESSION_UPDATE_TYPES = /* @__PURE__ */ new Set([
5911
6088
  "session_info_update",
5912
6089
  "usage_update"
5913
6090
  ]);
5914
- var MAX_BULK_REPLAY_UPDATES = 1e4;
5915
6091
  function isRecord3(value) {
5916
6092
  return typeof value === "object" && value !== null && !Array.isArray(value);
5917
6093
  }
@@ -6241,9 +6417,9 @@ function extractLoadReplayResponse(state) {
6241
6417
  `Invalid qwen.session.loadReplay updates (version=${LOAD_REPLAY_VERSION}, count=not-array)`
6242
6418
  );
6243
6419
  }
6244
- if (rawUpdates.length > MAX_BULK_REPLAY_UPDATES) {
6420
+ if (rawUpdates.length > LOAD_REPLAY_MAX_UPDATES) {
6245
6421
  throw new Error(
6246
- `qwen.session.loadReplay updates exceed limit (${rawUpdates.length} > ${MAX_BULK_REPLAY_UPDATES})`
6422
+ `qwen.session.loadReplay updates exceed limit (${rawUpdates.length} > ${LOAD_REPLAY_MAX_UPDATES})`
6247
6423
  );
6248
6424
  }
6249
6425
  const partial = replay["partial"];
@@ -6264,6 +6440,12 @@ function extractLoadReplayResponse(state) {
6264
6440
  `Invalid qwen.session.loadReplay hasMore (version=${LOAD_REPLAY_VERSION}, hasMore=${describeLoadReplayValue(hasMore)})`
6265
6441
  );
6266
6442
  }
6443
+ const anchorRecordId = replay["anchorRecordId"];
6444
+ if (anchorRecordId !== void 0 && typeof anchorRecordId !== "string") {
6445
+ throw new Error(
6446
+ `Invalid qwen.session.loadReplay anchorRecordId (version=${LOAD_REPLAY_VERSION}, anchorRecordId=${describeLoadReplayValue(anchorRecordId)})`
6447
+ );
6448
+ }
6267
6449
  const invalidUpdateIndex = rawUpdates.findIndex(
6268
6450
  (update) => !isBulkReplayUpdate(update)
6269
6451
  );
@@ -6285,6 +6467,7 @@ function extractLoadReplayResponse(state) {
6285
6467
  return {
6286
6468
  state: cleanState,
6287
6469
  updates: rawUpdates,
6470
+ ...typeof anchorRecordId === "string" ? { anchorRecordId } : {},
6288
6471
  ...partial === true ? { partial: true } : {},
6289
6472
  ...typeof replayError === "string" ? { replayError } : {},
6290
6473
  ...hasMore === true ? { hasMore: true } : {}
@@ -6493,9 +6676,9 @@ function broadcastPromptCancelledOnce(entry, sessionId, promptId, originatorClie
6493
6676
  );
6494
6677
  }
6495
6678
  __name(broadcastPromptCancelledOnce, "broadcastPromptCancelledOnce");
6496
- function broadcastTurnComplete(entry, sessionId, promptResult, promptId, originatorClientId) {
6679
+ function broadcastTurnComplete(entry, sessionId, promptResult, promptId, originatorClientId, mutateTurnState) {
6497
6680
  try {
6498
- entry.events.publish({
6681
+ const published = entry.events.publish({
6499
6682
  type: "turn_complete",
6500
6683
  ...promptId ? { promptId } : {},
6501
6684
  data: {
@@ -6505,6 +6688,8 @@ function broadcastTurnComplete(entry, sessionId, promptResult, promptId, origina
6505
6688
  },
6506
6689
  ...originatorClientId ? { originatorClientId } : {}
6507
6690
  });
6691
+ if (mutateTurnState && published !== void 0)
6692
+ entry.turnErrorEvent = void 0;
6508
6693
  } catch {
6509
6694
  }
6510
6695
  }
@@ -6536,6 +6721,14 @@ function extractJsonRpcErrorDetail(data) {
6536
6721
  return void 0;
6537
6722
  }
6538
6723
  __name(extractJsonRpcErrorDetail, "extractJsonRpcErrorDetail");
6724
+ function extractJsonRpcErrorField(err, field) {
6725
+ if (typeof err !== "object" || err === null) return void 0;
6726
+ const data = err.data;
6727
+ if (typeof data !== "object" || data === null) return void 0;
6728
+ const value = data[field];
6729
+ return typeof value === "string" && value.length > 0 ? value : void 0;
6730
+ }
6731
+ __name(extractJsonRpcErrorField, "extractJsonRpcErrorField");
6539
6732
  function extractErrorCode(err) {
6540
6733
  if (typeof err !== "object" || err === null || !("code" in err))
6541
6734
  return void 0;
@@ -6545,14 +6738,79 @@ function extractErrorCode(err) {
6545
6738
  return void 0;
6546
6739
  }
6547
6740
  __name(extractErrorCode, "extractErrorCode");
6741
+ var REFRESH_APPEND_BOOKKEEPING_EVENT_TYPES = /* @__PURE__ */ new Set([
6742
+ "pending_prompt_added",
6743
+ "pending_prompt_completed",
6744
+ "prompt_cancelled",
6745
+ "model_switched",
6746
+ "model_switch_failed",
6747
+ "approval_mode_changed",
6748
+ "language_changed",
6749
+ "session_metadata_updated",
6750
+ "session_cwd_changed",
6751
+ "artifact_changed",
6752
+ "settings_changed",
6753
+ "extensions_changed",
6754
+ "mcp_server_changed",
6755
+ "mcp_server_added",
6756
+ "mcp_server_removed",
6757
+ "user_shell_command",
6758
+ "user_shell_result",
6759
+ // Workspace-level fan-out (workspace service, git watcher, memory /
6760
+ // agent CRUD, device-flow registry) reaches every session bus via
6761
+ // `publishWorkspaceEvent` while idle. The `auth_device_flow_*` members
6762
+ // mirror the closed `DeviceFlowEventEmission` union — audit that union
6763
+ // when it grows.
6764
+ "tool_toggled",
6765
+ "workspace_initialized",
6766
+ "mcp_server_restarted",
6767
+ "mcp_server_restart_refused",
6768
+ "settings_reloaded",
6769
+ "trust_change_requested",
6770
+ "memory_changed",
6771
+ "agent_changed",
6772
+ "git_status_changed",
6773
+ "git_branch_changed",
6774
+ "github_setup_completed",
6775
+ "auth_device_flow_started",
6776
+ "auth_device_flow_throttled",
6777
+ "auth_device_flow_authorized",
6778
+ "auth_device_flow_failed",
6779
+ "auth_device_flow_cancelled"
6780
+ ]);
6781
+ function isIdleBookkeepingSessionUpdate(event) {
6782
+ if (event.type !== "session_update") return false;
6783
+ const data = event.data;
6784
+ if (!data || typeof data !== "object" || Array.isArray(data)) return false;
6785
+ const update = data["update"];
6786
+ if (!update || typeof update !== "object" || Array.isArray(update))
6787
+ return false;
6788
+ const updateRecord = update;
6789
+ const subtype = updateRecord["sessionUpdate"];
6790
+ if (subtype === "available_commands_update" || subtype === "current_mode_update") {
6791
+ return true;
6792
+ }
6793
+ const meta = updateRecord["_meta"];
6794
+ if (!meta || typeof meta !== "object" || Array.isArray(meta)) return false;
6795
+ return meta["source"] === "user-shell";
6796
+ }
6797
+ __name(isIdleBookkeepingSessionUpdate, "isIdleBookkeepingSessionUpdate");
6798
+ function isRefreshAppendTurnContent(event) {
6799
+ if (event.type === "history_truncated") return false;
6800
+ if (REFRESH_APPEND_BOOKKEEPING_EVENT_TYPES.has(event.type)) return false;
6801
+ return !isIdleBookkeepingSessionUpdate(event);
6802
+ }
6803
+ __name(isRefreshAppendTurnContent, "isRefreshAppendTurnContent");
6548
6804
  function classifyTurnErrorKind(message) {
6549
6805
  return message.trim().toLowerCase() === "terminated" ? "model_stream_interrupted" : void 0;
6550
6806
  }
6551
6807
  __name(classifyTurnErrorKind, "classifyTurnErrorKind");
6552
6808
  function broadcastTurnError(entry, sessionId, err, promptId, originatorClientId, mutateTurnState) {
6553
6809
  const message = extractErrorMessage(err);
6554
- const code = extractErrorCode(err);
6555
- const errorKind = classifyTurnErrorKind(message);
6810
+ const structuredErrorKind = extractJsonRpcErrorField(err, "errorKind");
6811
+ const errorKind = structuredErrorKind ?? classifyTurnErrorKind(message);
6812
+ const code = structuredErrorKind !== void 0 ? extractJsonRpcErrorField(err, "code") ?? extractErrorCode(err) : extractErrorCode(err);
6813
+ const loopType = extractJsonRpcErrorField(err, "loopType");
6556
6814
  if (errorKind) {
6557
6815
  writeServeDebugLine(
6558
6816
  `turn_error classified session=${JSON.stringify(sessionId)} message=${JSON.stringify(message)} errorKind=${JSON.stringify(errorKind)}` + (code ? ` code=${JSON.stringify(code)}` : "") + (promptId ? ` promptId=${JSON.stringify(promptId)}` : "")
@@ -6567,7 +6825,7 @@ function broadcastTurnError(entry, sessionId, err, promptId, originatorClientId,
6567
6825
  };
6568
6826
  }
6569
6827
  try {
6570
- entry.events.publish({
6828
+ const published = entry.events.publish({
6571
6829
  type: "turn_error",
6572
6830
  ...promptId ? { promptId } : {},
6573
6831
  data: {
@@ -6575,10 +6833,14 @@ function broadcastTurnError(entry, sessionId, err, promptId, originatorClientId,
6575
6833
  message,
6576
6834
  ...code ? { code } : {},
6577
6835
  ...errorKind ? { errorKind } : {},
6836
+ ...loopType ? { loopType } : {},
6578
6837
  ...promptId ? { promptId } : {}
6579
6838
  },
6580
6839
  ...originatorClientId ? { originatorClientId } : {}
6581
6840
  });
6841
+ if (mutateTurnState) {
6842
+ entry.turnErrorEvent = published;
6843
+ }
6582
6844
  } catch {
6583
6845
  }
6584
6846
  }
@@ -6592,13 +6854,21 @@ function publishPromptTerminal(entry, pendingEntry, terminal) {
6592
6854
  }
6593
6855
  pendingEntry.terminalPublished = true;
6594
6856
  const originatorClientId = pendingEntry.originatorClientId;
6857
+ const mutateTurnState = pendingEntry.state === "running";
6858
+ if (!mutateTurnState && entry.turnErrorEvent) {
6859
+ const journal = entry.events.liveJournalSnapshot() ?? [];
6860
+ if (journal.some(isRefreshAppendTurnContent)) {
6861
+ entry.turnErrorEvent = void 0;
6862
+ }
6863
+ }
6595
6864
  if (terminal.kind === "complete") {
6596
6865
  broadcastTurnComplete(
6597
6866
  entry,
6598
6867
  entry.sessionId,
6599
6868
  terminal.result,
6600
6869
  pendingEntry.promptId,
6601
- originatorClientId
6870
+ originatorClientId,
6871
+ mutateTurnState
6602
6872
  );
6603
6873
  } else if (terminal.kind === "cancelled") {
6604
6874
  broadcastTurnComplete(
@@ -6606,7 +6876,8 @@ function publishPromptTerminal(entry, pendingEntry, terminal) {
6606
6876
  entry.sessionId,
6607
6877
  { stopReason: "cancelled" },
6608
6878
  pendingEntry.promptId,
6609
- originatorClientId
6879
+ originatorClientId,
6880
+ mutateTurnState
6610
6881
  );
6611
6882
  } else {
6612
6883
  broadcastTurnError(
@@ -6615,13 +6886,7 @@ function publishPromptTerminal(entry, pendingEntry, terminal) {
6615
6886
  terminal.err,
6616
6887
  pendingEntry.promptId,
6617
6888
  originatorClientId,
6618
- // Only a running prompt's failure is the active turn's failure. The
6619
- // `state === 'running'` gate (not `activePromptId`) is deliberate:
6620
- // on the normal settle path `settleActivePromptState` runs in
6621
- // `promptPromise.finally` BEFORE the terminal is published, so
6622
- // `activePromptId` is already cleared when a genuine active failure
6623
- // lands here.
6624
- pendingEntry.state === "running"
6889
+ mutateTurnState
6625
6890
  );
6626
6891
  }
6627
6892
  }
@@ -6772,6 +7037,16 @@ function createAcpSessionBridge(opts) {
6772
7037
  );
6773
7038
  const maxJournalEvents = normalizeMaxJournalEvents(opts.maxJournalEvents);
6774
7039
  const maxJournalBytes = normalizeMaxJournalBytes(opts.maxJournalBytes);
7040
+ const journalGrowthPoolBytes = normalizeJournalGrowthPoolBytes(
7041
+ opts.journalGrowthPoolBytes
7042
+ );
7043
+ const journalGrowthPolicy = journalGrowthPoolBytes !== void 0 ? createJournalGrowthPolicy({
7044
+ baselineEvents: maxJournalEvents,
7045
+ baselineBytes: maxJournalBytes,
7046
+ poolBytes: journalGrowthPoolBytes,
7047
+ hardCapBytes: JOURNAL_GROWTH_HARD_CAP_BYTES
7048
+ }) : void 0;
7049
+ const journalGrowthSessionLimits = opts.journalGrowthSessionLimits;
6775
7050
  const channelFactory = opts.channelFactory ?? defaultSpawnChannelFactory;
6776
7051
  const childEnvOverrides = opts.childEnvOverrides ? Object.freeze({ ...opts.childEnvOverrides }) : Object.freeze({});
6777
7052
  const initTimeoutMs = opts.initializeTimeoutMs ?? DEFAULT_INIT_TIMEOUT_MS;
@@ -6869,6 +7144,12 @@ function createAcpSessionBridge(opts) {
6869
7144
  if (entryHasLocalWork(entry)) return false;
6870
7145
  const owner = channelInfoForEntry(entry);
6871
7146
  if (owner?.pendingRestoreIds.has(entry.sessionId)) return false;
7147
+ const capability = owner?.activeWork;
7148
+ if (capability && !owner.isQuarantined && !owner.restoreSettlementOverdue && ACTIVE_WORK_HOLD_CATEGORIES.some(
7149
+ (category) => !capability.categories.includes(category)
7150
+ )) {
7151
+ return false;
7152
+ }
6872
7153
  return !childReportsHeldWork(entry);
6873
7154
  }
6874
7155
  __name(entryIsAutoCloseCandidate, "entryIsAutoCloseCandidate");
@@ -7295,6 +7576,22 @@ function createAcpSessionBridge(opts) {
7295
7576
  const inFlightRequestedSessionSpawns = /* @__PURE__ */ new Map();
7296
7577
  const inFlightRestores = /* @__PURE__ */ new Map();
7297
7578
  const pendingRestoreEvents = /* @__PURE__ */ new Map();
7579
+ const journalSessionLimits = /* @__PURE__ */ __name(() => {
7580
+ const limits = [...byId.values()].map((entry) => ({
7581
+ limitBytes: entry.events.journalLimitBytes() ?? maxJournalBytes,
7582
+ baselineBytes: maxJournalBytes
7583
+ }));
7584
+ for (const [restoreId, bus] of pendingRestoreEvents) {
7585
+ if (!byId.has(restoreId)) {
7586
+ limits.push({
7587
+ limitBytes: bus.journalLimitBytes() ?? maxJournalBytes,
7588
+ baselineBytes: maxJournalBytes
7589
+ });
7590
+ }
7591
+ }
7592
+ return limits;
7593
+ }, "journalSessionLimits");
7594
+ const unregisterJournalGrowthSessionLimits = journalGrowthPolicy !== void 0 && opts.registerJournalGrowthSessionLimits !== void 0 ? opts.registerJournalGrowthSessionLimits(journalSessionLimits) : void 0;
7298
7595
  const createClientId = /* @__PURE__ */ __name(() => `client_${randomUUID2()}`, "createClientId");
7299
7596
  const registerClient = /* @__PURE__ */ __name((entry, requestedClientId) => {
7300
7597
  if (requestedClientId && entry.clientIds.has(requestedClientId)) {
@@ -7640,7 +7937,8 @@ function createAcpSessionBridge(opts) {
7640
7937
  _meta: {
7641
7938
  [ACTIVE_WORK_HEARTBEAT_META_KEY]: {
7642
7939
  v: ACTIVE_WORK_HEARTBEAT_VERSION,
7643
- intervalMs: ACTIVE_WORK_HEARTBEAT_INTERVAL_MS
7940
+ intervalMs: ACTIVE_WORK_HEARTBEAT_INTERVAL_MS,
7941
+ categories: [...ACTIVE_WORK_HOLD_CATEGORIES]
7644
7942
  },
7645
7943
  [CHANNEL_STARTUP_PROFILE_META_KEY]: {
7646
7944
  v: CHANNEL_STARTUP_PROFILE_VERSION
@@ -8506,7 +8804,34 @@ function createAcpSessionBridge(opts) {
8506
8804
  teeServeDebugLine(
8507
8805
  `replay window evicted ${JSON.stringify(eviction)}`
8508
8806
  );
8509
- }, "onReplayWindowEviction")
8807
+ }, "onReplayWindowEviction"),
8808
+ // Adaptive growth: the engine asks before evicting past its caps.
8809
+ // The policy accounts growth across this bridge's live sessions
8810
+ // from every session's CURRENT journal cap (stateless — no ledger
8811
+ // to reconcile when a session is reaped), so granted headroom dies
8812
+ // with its session.
8813
+ ...journalGrowthPolicy ? {
8814
+ onJournalGrowth: /* @__PURE__ */ __name((current) => {
8815
+ const allSessionLimits = journalGrowthSessionLimits ? [...journalGrowthSessionLimits()] : journalSessionLimits();
8816
+ if (!byId.has(sessionId) && !pendingRestoreEvents.has(sessionId)) {
8817
+ allSessionLimits.push({
8818
+ limitBytes: current.maxBytes,
8819
+ baselineBytes: maxJournalBytes
8820
+ });
8821
+ }
8822
+ const grant = journalGrowthPolicy.grant({
8823
+ currentMaxEvents: current.maxEvents,
8824
+ currentMaxBytes: current.maxBytes,
8825
+ allSessionLimits
8826
+ });
8827
+ if (grant) {
8828
+ teeServeDebugLine(
8829
+ `live journal growth session=${JSON.stringify(sessionId)}: ${current.maxBytes} -> ${grant.maxBytes} bytes, ${current.maxEvents} -> ${grant.maxEvents} entries`
8830
+ );
8831
+ }
8832
+ return grant;
8833
+ }, "onJournalGrowth")
8834
+ } : {}
8510
8835
  }),
8511
8836
  {
8512
8837
  // Fired once, on the FIRST ingest/seed failure (the bus keeps the
@@ -8782,18 +9107,19 @@ function createAcpSessionBridge(opts) {
8782
9107
  }
8783
9108
  return typeof maybe.message === "string" && maybe.message === `Resource not found: ${expectedUri}`;
8784
9109
  }, "isAcpSessionResourceNotFound");
8785
- const replayFieldsFor = /* @__PURE__ */ __name((entry, action) => {
9110
+ const replayFieldsFor = /* @__PURE__ */ __name((entry, action, liveReplayMode = "full") => {
8786
9111
  const replayStatus = action === "load" && entry.restoreReplayPartial === true ? {
8787
9112
  partial: true,
8788
9113
  ...typeof entry.restoreReplayError === "string" ? { replayError: entry.restoreReplayError } : {}
8789
9114
  } : {};
8790
9115
  const eventEpoch = entry.events.epoch;
8791
- const snapshot = entry.events.snapshotReplay();
9116
+ const snapshot = entry.events.snapshotReplay(liveReplayMode);
8792
9117
  if (!snapshot) {
8793
9118
  return {
8794
9119
  lastEventId: entry.events.lastEventId,
8795
9120
  eventEpoch,
8796
- ...replayStatus
9121
+ ...replayStatus,
9122
+ ...action === "load" && entry.restoreHistoryAnchorRecordId !== void 0 ? { historyAnchorRecordId: entry.restoreHistoryAnchorRecordId } : {}
8797
9123
  };
8798
9124
  }
8799
9125
  if (action === "load") {
@@ -8810,7 +9136,8 @@ function createAcpSessionBridge(opts) {
8810
9136
  eventEpoch,
8811
9137
  ...replayStatus,
8812
9138
  ...snapshot.degraded ? { replayDegraded: true } : {},
8813
- ...entry.restoreHistoryHasMore === true ? { historyHasMore: true } : {}
9139
+ ...entry.restoreHistoryHasMore === true ? { historyHasMore: true } : {},
9140
+ ...entry.restoreHistoryAnchorRecordId !== void 0 ? { historyAnchorRecordId: entry.restoreHistoryAnchorRecordId } : {}
8814
9141
  };
8815
9142
  }
8816
9143
  return { lastEventId: snapshot.lastEventId, eventEpoch, ...replayStatus };
@@ -8876,7 +9203,7 @@ function createAcpSessionBridge(opts) {
8876
9203
  }
8877
9204
  }
8878
9205
  __name(requestSessionTranscriptPage, "requestSessionTranscriptPage");
8879
- async function refreshedReplayFieldsFor(entry, historyPageSize) {
9206
+ async function refreshedReplayFieldsFor(entry, historyPageSize, liveReplayMode) {
8880
9207
  for (let attempt = 0; attempt < 2; attempt++) {
8881
9208
  try {
8882
9209
  const lastEventId = entry.events.lastEventId;
@@ -8902,8 +9229,19 @@ function createAcpSessionBridge(opts) {
8902
9229
  if (cursor !== void 0) seenCursors.add(cursor);
8903
9230
  } while (page.events.length === 0 && page.hasMore && cursor !== void 0 && page.partial !== true && page.replayError === void 0);
8904
9231
  if (byId.get(entry.sessionId) === entry && !entry.promptActive && entry.events.epoch === eventEpoch && entry.events.lastEventId === lastEventId) {
9232
+ let compactedReplay = page.events;
9233
+ const turnErrorEvent = entry.turnErrorEvent;
9234
+ if (turnErrorEvent) {
9235
+ const journal = entry.events.liveJournalSnapshot() ?? [];
9236
+ const hasNewerTurnContent = journal.some(
9237
+ isRefreshAppendTurnContent
9238
+ );
9239
+ if (!hasNewerTurnContent) {
9240
+ compactedReplay = [...page.events, turnErrorEvent];
9241
+ }
9242
+ }
8905
9243
  return {
8906
- compactedReplay: page.events,
9244
+ compactedReplay,
8907
9245
  liveJournal: [],
8908
9246
  lastEventId,
8909
9247
  eventEpoch,
@@ -8916,7 +9254,7 @@ function createAcpSessionBridge(opts) {
8916
9254
  break;
8917
9255
  }
8918
9256
  }
8919
- return replayFieldsFor(entry, "load");
9257
+ return replayFieldsFor(entry, "load", liveReplayMode);
8920
9258
  }
8921
9259
  __name(refreshedReplayFieldsFor, "refreshedReplayFieldsFor");
8922
9260
  function transcriptEventRecordId(event) {
@@ -8971,6 +9309,13 @@ function createAcpSessionBridge(opts) {
8971
9309
  }
8972
9310
  const historyReplay = action === "load" ? req.historyReplay ?? "stream" : "stream";
8973
9311
  const historyPageSize = action === "load" && historyReplay === "response" ? req.historyPageSize : void 0;
9312
+ const requestedLiveReplayMode = req.liveReplayMode;
9313
+ if (requestedLiveReplayMode !== void 0 && requestedLiveReplayMode !== "full" && requestedLiveReplayMode !== "summary") {
9314
+ throw new Error(
9315
+ `Invalid liveReplayMode: ${JSON.stringify(requestedLiveReplayMode)}`
9316
+ );
9317
+ }
9318
+ const liveReplayMode = action === "load" ? requestedLiveReplayMode ?? "full" : "full";
8974
9319
  if (historyPageSize !== void 0 && (!Number.isSafeInteger(historyPageSize) || historyPageSize < 1 || historyPageSize > SESSION_TRANSCRIPT_MAX_LIMIT)) {
8975
9320
  throw new Error(
8976
9321
  `Invalid historyPageSize; expected 1..${SESSION_TRANSCRIPT_MAX_LIMIT}`
@@ -8980,7 +9325,11 @@ function createAcpSessionBridge(opts) {
8980
9325
  const existing = byId.get(req.sessionId);
8981
9326
  if (existing) {
8982
9327
  assertAttachableSessionEntry(req.sessionId, existing);
8983
- const replayFields = historyPageSize !== void 0 ? await refreshedReplayFieldsFor(existing, historyPageSize) : replayFieldsFor(existing, action);
9328
+ const replayFields = historyPageSize !== void 0 ? await refreshedReplayFieldsFor(
9329
+ existing,
9330
+ historyPageSize,
9331
+ liveReplayMode
9332
+ ) : replayFieldsFor(existing, action, liveReplayMode);
8984
9333
  const historyAnchorRecordId = action === "load" ? await resolveHistoryAnchorRecordId(existing, replayFields) : void 0;
8985
9334
  assertAttachableSessionEntry(req.sessionId, existing);
8986
9335
  existing.attachCount++;
@@ -9026,7 +9375,7 @@ function createAcpSessionBridge(opts) {
9026
9375
  }
9027
9376
  const inFlight = inFlightRestores.get(req.sessionId);
9028
9377
  if (inFlight) {
9029
- if (inFlight.lifecycle.phase === "abandoned" || action !== inFlight.action || historyReplay !== inFlight.historyReplay || historyPageSize !== inFlight.historyPageSize || hideInheritedHistory !== inFlight.hideInheritedHistory) {
9378
+ if (inFlight.lifecycle.phase === "abandoned" || action !== inFlight.action || historyReplay !== inFlight.historyReplay || historyPageSize !== inFlight.historyPageSize || inFlight.liveReplayMode === "summary" && liveReplayMode === "full" || hideInheritedHistory !== inFlight.hideInheritedHistory) {
9030
9379
  const abandoned = inFlight.lifecycle.phase === "abandoned";
9031
9380
  throw new RestoreInProgressError(
9032
9381
  req.sessionId,
@@ -9061,6 +9410,18 @@ function createAcpSessionBridge(opts) {
9061
9410
  entry.attachCount = Math.max(0, entry.attachCount - 1);
9062
9411
  throw error;
9063
9412
  }
9413
+ const waiterReplayFields = liveReplayMode !== inFlight.liveReplayMode ? historyPageSize !== void 0 ? await refreshedReplayFieldsFor(
9414
+ entry,
9415
+ historyPageSize,
9416
+ liveReplayMode
9417
+ ) : replayFieldsFor(entry, action, liveReplayMode) : void 0;
9418
+ try {
9419
+ assertAttachableSessionEntry(restored.sessionId, entry);
9420
+ } catch (error) {
9421
+ inFlight.coalesceState.count--;
9422
+ entry.attachCount = Math.max(0, entry.attachCount - 1);
9423
+ throw error;
9424
+ }
9064
9425
  const clientId = registerClient(entry, req.clientId);
9065
9426
  recordAttachRef(entry, clientId);
9066
9427
  if (req.approvalMode) {
@@ -9086,7 +9447,8 @@ function createAcpSessionBridge(opts) {
9086
9447
  attached: true,
9087
9448
  clientId,
9088
9449
  createdAt: entry.createdAt,
9089
- hasActivePrompt: entry.promptActive
9450
+ hasActivePrompt: entry.promptActive,
9451
+ ...waiterReplayFields ?? {}
9090
9452
  };
9091
9453
  }
9092
9454
  assertFreshSessionsAvailable();
@@ -9260,6 +9622,7 @@ function createAcpSessionBridge(opts) {
9260
9622
  let replayPartial;
9261
9623
  let replayError;
9262
9624
  let replayHasMore;
9625
+ let replayAnchorRecordId;
9263
9626
  try {
9264
9627
  const rawRestore = telemetry.withSpan(
9265
9628
  "session.restore",
@@ -9370,6 +9733,7 @@ function createAcpSessionBridge(opts) {
9370
9733
  replayPartial = extracted.partial;
9371
9734
  replayError = extracted.replayError;
9372
9735
  replayHasMore = extracted.hasMore === true ? true : void 0;
9736
+ replayAnchorRecordId = extracted.anchorRecordId;
9373
9737
  }
9374
9738
  } catch (err) {
9375
9739
  if (err instanceof SessionRestoreTimeoutError) throw err;
@@ -9447,7 +9811,7 @@ function createAcpSessionBridge(opts) {
9447
9811
  ...racedEntry.sourceId !== void 0 ? { sourceId: racedEntry.sourceId } : {},
9448
9812
  state: racedEntry.restoreState ?? {},
9449
9813
  hasActivePrompt: racedEntry.promptActive,
9450
- ...replayFieldsFor(racedEntry, action)
9814
+ ...replayFieldsFor(racedEntry, action, liveReplayMode)
9451
9815
  };
9452
9816
  }
9453
9817
  const entry = createSessionEntry(
@@ -9478,6 +9842,9 @@ function createAcpSessionBridge(opts) {
9478
9842
  if (replayHasMore === true) {
9479
9843
  entry.restoreHistoryHasMore = true;
9480
9844
  }
9845
+ if (replayAnchorRecordId !== void 0) {
9846
+ entry.restoreHistoryAnchorRecordId = replayAnchorRecordId;
9847
+ }
9481
9848
  seedSnapshotCaches(entry, publicState);
9482
9849
  const artifactRestoreWarnings = await entry.artifacts.restore(
9483
9850
  restoredArtifactSnapshot
@@ -9520,7 +9887,7 @@ function createAcpSessionBridge(opts) {
9520
9887
  state: publicState,
9521
9888
  ...artifactRestoreWarnings.length > 0 ? { artifactWarnings: artifactRestoreWarnings } : {},
9522
9889
  hasActivePrompt: entry.promptActive,
9523
- ...replayFieldsFor(entry, action)
9890
+ ...replayFieldsFor(entry, action, liveReplayMode)
9524
9891
  };
9525
9892
  })().finally(async () => {
9526
9893
  if (restoreLifecycle.phase === "abandoned") return;
@@ -9583,6 +9950,7 @@ function createAcpSessionBridge(opts) {
9583
9950
  action,
9584
9951
  historyReplay,
9585
9952
  ...historyPageSize !== void 0 ? { historyPageSize } : {},
9953
+ liveReplayMode,
9586
9954
  hideInheritedHistory,
9587
9955
  publicPromise: promise,
9588
9956
  settlementPromise,
@@ -9767,6 +10135,10 @@ function createAcpSessionBridge(opts) {
9767
10135
  compactedReplayMaxBytes,
9768
10136
  maxJournalEvents,
9769
10137
  maxJournalBytes,
10138
+ journalGrowth: journalGrowthPoolBytes !== void 0 ? {
10139
+ poolBytes: journalGrowthPoolBytes,
10140
+ hardCapBytes: JOURNAL_GROWTH_HARD_CAP_BYTES
10141
+ } : null,
9770
10142
  channelIdleTimeoutMs: resolvedChannelIdleTimeoutMs(),
9771
10143
  sessionIdleTimeoutMs
9772
10144
  },
@@ -9774,22 +10146,27 @@ function createAcpSessionBridge(opts) {
9774
10146
  pendingPermissionCount: permissionMediator.pendingCount,
9775
10147
  channelLive: !!liveChannelInfo(),
9776
10148
  permissionPolicy: permissionMediator.policy,
9777
- sessions: [...byId.values()].map((entry) => ({
9778
- sessionId: entry.sessionId,
9779
- workspaceCwd: entry.workspaceCwd,
9780
- createdAt: entry.createdAt,
9781
- ...entry.displayName ? { displayName: entry.displayName } : {},
9782
- clientCount: entry.clientIds.size,
9783
- subscriberCount: entry.events.subscriberCount,
9784
- attachCount: entry.attachCount,
9785
- pendingPromptCount: entry.pendingPromptCount,
9786
- pendingPermissionCount: entry.pendingPermissionIds.size,
9787
- hasActivePrompt: entry.promptActive,
9788
- lastEventId: entry.events.lastEventId,
9789
- ...entry.sessionLastSeenAt !== void 0 ? { lastSeenAt: entry.sessionLastSeenAt } : {},
9790
- ...entry.currentModelId ? { currentModelId: entry.currentModelId } : {},
9791
- ...entry.currentApprovalMode ? { currentApprovalMode: entry.currentApprovalMode } : {}
9792
- }))
10149
+ sessions: [...byId.values()].map((entry) => {
10150
+ const journalLimits = entry.events.journalLimits();
10151
+ return {
10152
+ sessionId: entry.sessionId,
10153
+ workspaceCwd: entry.workspaceCwd,
10154
+ createdAt: entry.createdAt,
10155
+ ...entry.displayName ? { displayName: entry.displayName } : {},
10156
+ clientCount: entry.clientIds.size,
10157
+ subscriberCount: entry.events.subscriberCount,
10158
+ attachCount: entry.attachCount,
10159
+ pendingPromptCount: entry.pendingPromptCount,
10160
+ pendingPermissionCount: entry.pendingPermissionIds.size,
10161
+ hasActivePrompt: entry.promptActive,
10162
+ lastEventId: entry.events.lastEventId,
10163
+ ...entry.sessionLastSeenAt !== void 0 ? { lastSeenAt: entry.sessionLastSeenAt } : {},
10164
+ ...entry.currentModelId ? { currentModelId: entry.currentModelId } : {},
10165
+ ...entry.currentApprovalMode ? { currentApprovalMode: entry.currentApprovalMode } : {},
10166
+ maxJournalEvents: journalLimits?.maxEvents ?? maxJournalEvents,
10167
+ maxJournalBytes: journalLimits?.maxBytes ?? maxJournalBytes
10168
+ };
10169
+ })
9793
10170
  };
9794
10171
  },
9795
10172
  get sessionCount() {
@@ -10287,6 +10664,7 @@ function createAcpSessionBridge(opts) {
10287
10664
  delete meta[DAEMON_CHANNEL_DELIVERY_META_KEY];
10288
10665
  delete meta[DAEMON_PROMPT_DISPLAY_TEXT_META_KEY];
10289
10666
  delete meta[DAEMON_MODEL_PROMPT_META_KEY];
10667
+ delete meta[CHANNEL_PROMPT_META_KEY];
10290
10668
  if (isRetry) {
10291
10669
  meta[DAEMON_RETRY_META_KEY] = true;
10292
10670
  }
@@ -10302,6 +10680,9 @@ function createAcpSessionBridge(opts) {
10302
10680
  if (modelPrompt !== void 0) {
10303
10681
  meta[DAEMON_MODEL_PROMPT_META_KEY] = modelPrompt;
10304
10682
  }
10683
+ if (context?.channelPrompt === true) {
10684
+ meta[CHANNEL_PROMPT_META_KEY] = true;
10685
+ }
10305
10686
  meta[INVOCATION_CONTEXT_META_KEY] = invocationContext;
10306
10687
  if (Object.keys(meta).length > 0) {
10307
10688
  copy._meta = meta;
@@ -10314,6 +10695,7 @@ function createAcpSessionBridge(opts) {
10314
10695
  entry.activePromptId = pendingEntry.promptId;
10315
10696
  delete entry.cancelBroadcastWithoutPrompt;
10316
10697
  delete entry.turnError;
10698
+ delete entry.turnErrorEvent;
10317
10699
  activePromptCounter++;
10318
10700
  entry.sessionLastSeenAt = Date.now();
10319
10701
  touchActivity();
@@ -10361,6 +10743,10 @@ function createAcpSessionBridge(opts) {
10361
10743
  );
10362
10744
  return;
10363
10745
  }
10746
+ if (extractJsonRpcErrorField(err, "errorKind")) {
10747
+ cancelPendingForSession(sessionId);
10748
+ return;
10749
+ }
10364
10750
  writeStderrLine(
10365
10751
  `sendPrompt: forward failed for session ${sessionId}: ${extractErrorMessage(err)}`
10366
10752
  );
@@ -12765,6 +13151,7 @@ function createAcpSessionBridge(opts) {
12765
13151
  });
12766
13152
  void (async () => {
12767
13153
  shuttingDown = true;
13154
+ unregisterJournalGrowthSessionLimits?.();
12768
13155
  cancelIdleTimer();
12769
13156
  stopSessionReaper();
12770
13157
  const entries = Array.from(byId.values());