@qwen-code/qwen-code 0.21.6 → 0.21.7-nightly.20260808.4ec0371e6

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 +50 -31
  2. package/bundled/qc-helper/docs/features/channels/dingtalk.md +41 -3
  3. package/bundled/qc-helper/docs/features/channels/feishu.md +13 -2
  4. package/bundled/qc-helper/docs/features/channels/github.md +13 -11
  5. package/bundled/qc-helper/docs/features/channels/gitlab.md +13 -11
  6. package/bundled/qc-helper/docs/features/channels/overview.md +49 -31
  7. package/bundled/qc-helper/docs/features/channels/plugins.md +2 -2
  8. package/bundled/qc-helper/docs/features/channels/qqbot.md +4 -2
  9. package/bundled/qc-helper/docs/features/channels/telegram.md +4 -2
  10. package/bundled/qc-helper/docs/features/channels/wecom.md +1 -1
  11. package/bundled/qc-helper/docs/features/code-review.md +31 -0
  12. package/bundled/qc-helper/docs/features/hooks.md +2 -0
  13. package/bundled/qc-helper/docs/qwen-serve.md +4 -1
  14. package/bundled/review/SKILL.md +52 -16
  15. package/chunks/{MaxSizedBox-2HFKP4LI.js → MaxSizedBox-COZBVNCI.js} +42 -41
  16. package/chunks/{StandaloneSessionPicker-RBV72M5N.js → StandaloneSessionPicker-3OF2FS6S.js} +59 -57
  17. package/chunks/{acpAgent-WO6JFCVQ.js → acpAgent-3JCJ6KWG.js} +236 -185
  18. package/chunks/{agent-AHGLYNZ4.js → agent-DBSC47CD.js} +39 -38
  19. package/chunks/{agent-headless-NTXKKGRO.js → agent-headless-ZJHZ7I3S.js} +39 -38
  20. package/chunks/{anthropicContentGenerator-3CAHEZBM.js → anthropicContentGenerator-SSFE2753.js} +15 -15
  21. package/chunks/{artifact-tool-RROCCJDA.js → artifact-tool-N652YE4L.js} +2 -2
  22. package/chunks/{askUserQuestion-2EPPBPUZ.js → askUserQuestion-ONW74PKJ.js} +2 -2
  23. package/chunks/{bridge-RPAU64CA.js → bridge-NFBYT4ZI.js} +43 -42
  24. package/chunks/{channel-management-service-IGEUOVRT.js → channel-management-service-LXSJXQGM.js} +19 -10
  25. package/chunks/{channel-settings-store-ON64MF7G.js → channel-settings-store-LABKDKSI.js} +46 -45
  26. package/chunks/{channel-worker-group-JWQK224X.js → channel-worker-group-MTW2AGT3.js} +4 -4
  27. package/chunks/{channel-worker-manager-77E3OXRQ.js → channel-worker-manager-UU6PTQSI.js} +4 -4
  28. package/chunks/{channel-worker-supervisor-62YWUGP2.js → channel-worker-supervisor-5SRD24FG.js} +3 -3
  29. package/chunks/{chunk-XC656O42.js → chunk-22NBYCPD.js} +3 -3
  30. package/chunks/{chunk-K2B3X3E7.js → chunk-26ISE5EG.js} +4 -4
  31. package/chunks/{chunk-Z7JILXGX.js → chunk-2UUMVNYT.js} +3 -3
  32. package/chunks/{chunk-ACZRB7AD.js → chunk-3ARO4N5G.js} +3 -3
  33. package/chunks/{chunk-CJ5WLD5Y.js → chunk-3HS6Y4UA.js} +96 -22
  34. package/chunks/{chunk-MBEMTXQT.js → chunk-3K7FH2KQ.js} +1 -32
  35. package/chunks/{chunk-QYPT3QUD.js → chunk-3ULCB3NE.js} +3 -3
  36. package/chunks/{chunk-IMOQO6YL.js → chunk-4Q6N3SNL.js} +1 -1
  37. package/chunks/{chunk-3UOLYNTF.js → chunk-4QJJHIZ5.js} +23 -14
  38. package/chunks/{chunk-VGFPFM4U.js → chunk-5PGKKSO6.js} +42 -16
  39. package/chunks/{chunk-NGJOAKJY.js → chunk-5YT3Y33M.js} +3 -3
  40. package/chunks/{chunk-T4JSA7KU.js → chunk-64YLXLMY.js} +3 -3
  41. package/chunks/{chunk-5L6CQ4ZU.js → chunk-6M26GBKX.js} +2 -2
  42. package/chunks/{chunk-ZPPP6VCL.js → chunk-6ZRFAKXK.js} +1 -1
  43. package/chunks/{chunk-OP2OHZ7K.js → chunk-764F335K.js} +18 -9
  44. package/chunks/{chunk-PPUOYL77.js → chunk-77WOUGCA.js} +53 -22
  45. package/chunks/{chunk-33FNCQSY.js → chunk-7MH4J33A.js} +2 -2
  46. package/chunks/{chunk-S7CV4KO6.js → chunk-AB4A73VL.js} +2 -2
  47. package/chunks/{chunk-O7V7N4G7.js → chunk-ACHMWGC5.js} +198 -35
  48. package/chunks/{chunk-NKSF7HYF.js → chunk-AG3P2RES.js} +1 -1
  49. package/chunks/{chunk-6PEXNQTX.js → chunk-ALFTV7GA.js} +26 -2
  50. package/chunks/{chunk-JELIWHXD.js → chunk-AOHJKPKL.js} +1 -1
  51. package/chunks/{chunk-XA4TMLFN.js → chunk-APMRLB2H.js} +580 -394
  52. package/chunks/{chunk-75QMRMO7.js → chunk-APNNM3JC.js} +3 -3
  53. package/chunks/{chunk-GLNBDYUX.js → chunk-AXMWHKXA.js} +6 -2
  54. package/chunks/{chunk-VNQCPBC2.js → chunk-B23P3YWE.js} +3 -3
  55. package/chunks/{chunk-H36SETQS.js → chunk-B2GJNDTV.js} +1 -1
  56. package/chunks/{chunk-Q5RM32DR.js → chunk-BCMJPTXV.js} +1 -1
  57. package/chunks/{chunk-A4VTILZT.js → chunk-BFSQBXHV.js} +714 -398
  58. package/chunks/{chunk-QMBEW7EW.js → chunk-BGG4MBYD.js} +2 -2
  59. package/chunks/{chunk-SLSWFHDF.js → chunk-BJKFFPX2.js} +4 -4
  60. package/chunks/{chunk-N2GJU6KI.js → chunk-BN3OROB3.js} +12 -12
  61. package/chunks/chunk-CE5UCTKO.js +3508 -0
  62. package/chunks/{chunk-2UISUFHQ.js → chunk-CJXIIILK.js} +3 -3
  63. package/chunks/{chunk-WK4TJUEA.js → chunk-CKASRHZI.js} +1 -1
  64. package/chunks/chunk-CPG6P4GG.js +82 -0
  65. package/chunks/{chunk-KKN2IE7Q.js → chunk-CTJLZLB5.js} +1 -1
  66. package/chunks/{chunk-DIEFUBV6.js → chunk-DIWZNWZT.js} +205 -35
  67. package/chunks/{chunk-CA4UIDFU.js → chunk-DPH3MUAP.js} +1 -1
  68. package/chunks/{chunk-4LKVQFHM.js → chunk-DREZZAZM.js} +2 -2
  69. package/chunks/{chunk-2DNKEBXY.js → chunk-EI3HZX6C.js} +1 -1
  70. package/chunks/{chunk-U25CMJYY.js → chunk-EKPKKXY2.js} +1 -1
  71. package/chunks/{chunk-432XCUHF.js → chunk-EQL65XGA.js} +1 -1
  72. package/chunks/{chunk-TYERNYH4.js → chunk-EUNWC2VS.js} +2 -2
  73. package/chunks/{chunk-4JH77A2U.js → chunk-EZ53KMUN.js} +1 -1
  74. package/chunks/{chunk-HY25ULVN.js → chunk-F3LPXDJP.js} +157 -56
  75. package/chunks/{chunk-D3UEZIQH.js → chunk-FJ6YHWHZ.js} +2 -2
  76. package/chunks/{chunk-UH7Z7Y45.js → chunk-FOGU3LJX.js} +1 -1
  77. package/chunks/{chunk-E4WHKETF.js → chunk-FVKHVJZQ.js} +2 -49
  78. package/chunks/{chunk-YZQTA3ID.js → chunk-GDXET5XU.js} +31 -3396
  79. package/chunks/{chunk-A5YZ3FA2.js → chunk-GM463R2B.js} +1 -1
  80. package/chunks/{chunk-MOHAWIAW.js → chunk-GNPNYXJB.js} +2 -2
  81. package/chunks/{chunk-SUKEUUAA.js → chunk-GUFY6D3E.js} +1 -1
  82. package/chunks/{chunk-FZFP7RZI.js → chunk-H2352CX2.js} +3 -3
  83. package/chunks/{chunk-GWRHVJY2.js → chunk-HKCYGZZ4.js} +22 -22
  84. package/chunks/{chunk-3PRJYMXC.js → chunk-HUWENAHO.js} +1 -1
  85. package/chunks/{chunk-G5NNWEYE.js → chunk-HY2INPTA.js} +4 -4
  86. package/chunks/{chunk-WVAESIM6.js → chunk-IA7TGCN2.js} +4 -4
  87. package/chunks/{chunk-HU5TUALO.js → chunk-IIJEYBNH.js} +3 -3
  88. package/chunks/{chunk-XM2O73NC.js → chunk-IMK3SJ43.js} +5703 -4343
  89. package/chunks/{chunk-4S4OEQ6U.js → chunk-J6SZID63.js} +2 -2
  90. package/chunks/{chunk-OWSW7EYP.js → chunk-JACAHYEN.js} +7 -7
  91. package/chunks/{chunk-R5RBXLNC.js → chunk-JRIJOZXO.js} +5 -5
  92. package/chunks/{chunk-SQOMTWQT.js → chunk-JSJTZ6GO.js} +4 -4
  93. package/chunks/{chunk-VWOVHOTT.js → chunk-KJZ26VBX.js} +1 -1
  94. package/chunks/{chunk-BFHXDAR7.js → chunk-KKBPOU75.js} +1 -1
  95. package/chunks/{chunk-TGGEZINK.js → chunk-KKRGVSHC.js} +7 -7
  96. package/chunks/{chunk-RK2EE3T7.js → chunk-KPMB4JEZ.js} +4 -4
  97. package/chunks/{chunk-MKVZE4ZJ.js → chunk-KTJFU7RT.js} +3 -2
  98. package/chunks/{chunk-MGSSJT27.js → chunk-L4N6TIP7.js} +5 -3
  99. package/chunks/{chunk-U4AF3QLU.js → chunk-L4OW63GW.js} +8 -8
  100. package/chunks/{chunk-C4CBJQKY.js → chunk-LDUGDB5H.js} +1 -1
  101. package/chunks/{chunk-W5DXUTXD.js → chunk-LDY4J4G6.js} +8 -8
  102. package/chunks/{chunk-GK2H5GRC.js → chunk-LMEIS6WW.js} +16 -6
  103. package/chunks/{chunk-6O5DVH27.js → chunk-M6HMMKVG.js} +1 -1
  104. package/chunks/{chunk-TOGZTG4X.js → chunk-MIA37QO3.js} +2 -2
  105. package/chunks/{chunk-536SWZTA.js → chunk-MV7VUCIG.js} +4 -4
  106. package/chunks/{chunk-T5U6IM4C.js → chunk-MVUQRLOH.js} +3 -3
  107. package/chunks/{chunk-GLWP3FDB.js → chunk-MZSJ43WV.js} +31 -2
  108. package/chunks/{chunk-UGTWD35F.js → chunk-NLREQJFK.js} +1 -1
  109. package/chunks/{chunk-RFUHDCNF.js → chunk-O7VQ3F22.js} +1 -1
  110. package/chunks/{chunk-3RXUYQJI.js → chunk-OIVKILPI.js} +49 -0
  111. package/chunks/{chunk-LBWNSLJK.js → chunk-ONSZH6VM.js} +2 -2
  112. package/chunks/{chunk-4WTAQEHV.js → chunk-OQTXYMKW.js} +3 -3
  113. package/chunks/{chunk-DYA25Y7U.js → chunk-OWMAZHIX.js} +1 -1
  114. package/chunks/{chunk-LAAFLUQV.js → chunk-P74TZRXD.js} +2 -2
  115. package/chunks/{chunk-BOGOR4HB.js → chunk-P7HUJDBZ.js} +7 -7
  116. package/chunks/chunk-PJRW65JO.js +107 -0
  117. package/chunks/{chunk-D7D7RXIJ.js → chunk-PYQADEFD.js} +6 -1
  118. package/chunks/{chunk-WO2B5E5B.js → chunk-Q3JQ7OSU.js} +1 -1
  119. package/chunks/{chunk-3LZKY4V4.js → chunk-QKJT5K4Q.js} +5 -5
  120. package/chunks/{chunk-OXX3FG2N.js → chunk-R2KZWK5Z.js} +3 -3
  121. package/chunks/{chunk-QZKYZCN3.js → chunk-REHWPCG2.js} +3 -3
  122. package/chunks/{chunk-2POQWYM6.js → chunk-RFA6VDCR.js} +3 -3
  123. package/chunks/{chunk-DIT4V3XH.js → chunk-RGTB44BO.js} +1 -1
  124. package/chunks/{chunk-SQC6K5HI.js → chunk-RPWVIXDB.js} +19 -2
  125. package/chunks/{chunk-ODPXHGLL.js → chunk-RZMGG3HP.js} +2 -2
  126. package/chunks/{chunk-2AGOQ7QO.js → chunk-S6HYI3MF.js} +118 -6
  127. package/chunks/chunk-SAH4BD2J.js +92 -0
  128. package/chunks/{chunk-JE44IPH6.js → chunk-SDUDZNF4.js} +2 -2
  129. package/chunks/{chunk-YAVY33G4.js → chunk-SEZ556DZ.js} +1 -1
  130. package/chunks/chunk-SOORFWKY.js +155 -0
  131. package/chunks/{chunk-KHUA3NQV.js → chunk-TAOSTUHI.js} +2 -2
  132. package/chunks/{chunk-VSALQLT7.js → chunk-TSYIQDG7.js} +1 -1
  133. package/chunks/{chunk-ULPQQSDN.js → chunk-TX3KSSDN.js} +3 -3
  134. package/chunks/{chunk-KVUBYJDM.js → chunk-TZEZYNYD.js} +1 -1
  135. package/chunks/{chunk-24ER7UV4.js → chunk-UFALT4LK.js} +1 -1
  136. package/chunks/{chunk-GESMMPAK.js → chunk-UKAYEQDU.js} +91 -63
  137. package/chunks/{chunk-XC2VAFVZ.js → chunk-UVX4Y6IN.js} +1 -1
  138. package/chunks/chunk-VDS2WYM5.js +244 -0
  139. package/chunks/{chunk-DVBEGGLG.js → chunk-VLFX3L3X.js} +10 -9
  140. package/chunks/{chunk-WNU7TZTO.js → chunk-VT3VNFVW.js} +3 -3
  141. package/chunks/{chunk-6WBWIPBF.js → chunk-WAUGQKUU.js} +4 -64
  142. package/chunks/{chunk-URN76TKR.js → chunk-WCG5O7IP.js} +2 -2
  143. package/chunks/{chunk-PX5DNLSA.js → chunk-XCG76UE6.js} +18 -10
  144. package/chunks/{chunk-TSERKWCX.js → chunk-XCWO3SMQ.js} +3 -3
  145. package/chunks/{chunk-5MJGUQU5.js → chunk-XIDHBXUI.js} +3 -3
  146. package/chunks/{chunk-3LGZEYOF.js → chunk-YHEEE624.js} +2 -2
  147. package/chunks/{chunk-SKNE3KQC.js → chunk-Z5ZAWED3.js} +19 -10
  148. package/chunks/{chunk-YMBOEAF4.js → chunk-Z6W3XDLN.js} +1 -1
  149. package/chunks/{chunk-EXCEQD22.js → chunk-ZKUJ4AO7.js} +4 -4
  150. package/chunks/{chunk-RHTTKJTP.js → chunk-ZQGHESAS.js} +1 -1
  151. package/chunks/{chunk-WUC6ZFXO.js → chunk-ZWBUH5UP.js} +1 -1
  152. package/chunks/{computer-use-5HXJ2P4X.js → computer-use-QLJ27OCZ.js} +39 -38
  153. package/chunks/{config-utils-VXD4SPVR.js → config-utils-KIEXWA4F.js} +4 -4
  154. package/chunks/{contextCommand-7BEHRX2H.js → contextCommand-JDTOJRBO.js} +41 -40
  155. package/chunks/{core-runtime-U4VJ5TIV.js → core-runtime-MZIAVYQC.js} +43 -42
  156. package/chunks/{create-sub-session-6EWLAZD5.js → create-sub-session-QIDZUOPU.js} +2 -2
  157. package/chunks/{create-sub-session-QZNQY332.js → create-sub-session-YBBCNSHE.js} +39 -38
  158. package/chunks/{cron-create-CCRIULJE.js → cron-create-VONA5JYY.js} +4 -4
  159. package/chunks/{cron-delete-FCFW6BGP.js → cron-delete-5JXSP2MI.js} +4 -4
  160. package/chunks/{cron-list-QDBVCHRF.js → cron-list-KE4F2CIR.js} +4 -4
  161. package/chunks/{daemon-YI5RY62O.js → daemon-SCTQMM7Z.js} +50 -2
  162. package/chunks/{daemon-status-provider-UJUGTDTL.js → daemon-status-provider-BZ7RD4ZJ.js} +47 -46
  163. package/chunks/{daemon-trust-policy-ZHDD5VYQ.js → daemon-trust-policy-2E4C3M7S.js} +45 -44
  164. package/chunks/{daemon-trust-policy-monitor-5SHYBDGA.js → daemon-trust-policy-monitor-UYLFH6RW.js} +45 -44
  165. package/chunks/{deferred-core-runtime-QWAEBTR5.js → deferred-core-runtime-6XZYMJZB.js} +39 -38
  166. package/chunks/{display-image-GUJA352B.js → display-image-NQRSIBXM.js} +4 -4
  167. package/chunks/{dist-SFQ34F4M.js → dist-26RK5XZO.js} +1 -1
  168. package/chunks/{dist-DPPHJAVL.js → dist-BATY7GI4.js} +187 -6
  169. package/chunks/{dist-A7H2KKUC.js → dist-HIACTZEK.js} +332 -113
  170. package/chunks/{dist-3BMEUGTG.js → dist-IRL7WA5Z.js} +1 -1
  171. package/chunks/{dist-HVBMEYWK.js → dist-KVISB2O2.js} +1 -1
  172. package/chunks/{dist-KS4O2NKE.js → dist-MBF3I5MX.js} +14 -8
  173. package/chunks/{dist-7JGAAQSC.js → dist-RCH3I7SS.js} +2 -2
  174. package/chunks/{dist-C5U4LJKW.js → dist-TUSWNE2I.js} +5 -4
  175. package/chunks/{earlyInputCapture-5BMSGKOI.js → earlyInputCapture-LATQCGDC.js} +40 -39
  176. package/chunks/{edit-IVQQVYYK.js → edit-72DP57CD.js} +39 -38
  177. package/chunks/{enter-worktree-P3DF2N6O.js → enter-worktree-B4FY2ZPP.js} +39 -38
  178. package/chunks/{enterPlanMode-KKTDVLAD.js → enterPlanMode-TQBWGCPL.js} +39 -38
  179. package/chunks/{environment-W5TRDM3G.js → environment-MOGZGZDS.js} +42 -41
  180. package/chunks/{errors-GJJB36IG.js → errors-PGON5GH7.js} +41 -40
  181. package/chunks/{exit-worktree-LV5RLOCU.js → exit-worktree-EYUD4YP2.js} +39 -38
  182. package/chunks/{exitPlanMode-TUGOB2LL.js → exitPlanMode-4Q7BSQXR.js} +39 -38
  183. package/chunks/{fast-path-2FU23PAQ.js → fast-path-WI7D5MER.js} +23 -3
  184. package/chunks/{fast-path-settings-WQJU2LAT.js → fast-path-settings-YBRL24DB.js} +2 -2
  185. package/chunks/{gemini-KDULDQPP.js → gemini-ZXURGM6Y.js} +87 -82
  186. package/chunks/{geminiContentGenerator-LOCFHNVA.js → geminiContentGenerator-EOODO75Y.js} +6 -6
  187. package/chunks/{glob-Z4NQFKWS.js → glob-QNRIUOS6.js} +39 -38
  188. package/chunks/{goal-tools-3AZKX5WQ.js → goal-tools-QSYW65HV.js} +3 -3
  189. package/chunks/{grep-Z67Z7EN6.js → grep-56MTW67B.js} +39 -38
  190. package/chunks/{handleAutoUpdate-DFUZE6I6.js → handleAutoUpdate-XGFIPVT4.js} +43 -42
  191. package/chunks/{i18n-R4FMZ7N2.js → i18n-RZB35L4B.js} +40 -39
  192. package/chunks/{image-gen-4CQJPQP5.js → image-gen-OE2EEKN3.js} +9 -9
  193. package/chunks/{initializer-DK672ZVE.js → initializer-YPVMTMKD.js} +46 -45
  194. package/chunks/{installationInfo-PO4Z3ES7.js → installationInfo-ZTMTMYNW.js} +40 -39
  195. package/chunks/{keychain-token-storage-7BT4TQ2A.js → keychain-token-storage-TVAMTNP7.js} +2 -2
  196. package/chunks/{list-QXQF6C53.js → list-NIW3WID5.js} +48 -47
  197. package/chunks/{list-agents-GC4BRET7.js → list-agents-Z4WABFDZ.js} +2 -2
  198. package/chunks/{loadedSettingsAdapter-4D7GUGW6.js → loadedSettingsAdapter-VSLILTOZ.js} +45 -44
  199. package/chunks/{loggingContentGenerator-2P3MNACM.js → loggingContentGenerator-KFZYVAGV.js} +17 -17
  200. package/chunks/{loop-wakeup-SQQSBMEY.js → loop-wakeup-UZ5RL5Y2.js} +5 -5
  201. package/chunks/{ls-63CC3NNX.js → ls-TVHDGIES.js} +4 -4
  202. package/chunks/{lsp-P6NVJVNT.js → lsp-CVN6OQPI.js} +2 -2
  203. package/chunks/{managed-npm-update-LWVJQTWO.js → managed-npm-update-WHTA2K5V.js} +40 -39
  204. package/chunks/{mcp-GHETAR6V.js → mcp-7KGK3CS3.js} +45 -44
  205. package/chunks/{monitor-4T7W4M6Q.js → monitor-FDWEJQWP.js} +39 -38
  206. package/chunks/nonInteractiveCli-2MVJ6TCS.js +155 -0
  207. package/chunks/{notebook-edit-OC2V7U5D.js → notebook-edit-ZUVK2XWE.js} +47 -38
  208. package/chunks/{openaiContentGenerator-RAJUFWQY.js → openaiContentGenerator-TNLWOPH5.js} +28 -21
  209. package/chunks/{pidfile-HVPYVRLS.js → pidfile-BB6SKPH2.js} +40 -39
  210. package/chunks/{process-registry-2CHQBXH5.js → process-registry-PMJOA5CO.js} +15 -0
  211. package/chunks/{processUtils-VIQ4JHVX.js → processUtils-WKHJOPDH.js} +2 -2
  212. package/chunks/{qwenContentGenerator-2QLCUFNZ.js → qwenContentGenerator-FZS2DYF7.js} +48 -46
  213. package/chunks/{qwenOAuth2-J2X3EN43.js → qwenOAuth2-UYMYRXBB.js} +9 -9
  214. package/chunks/{read-file-ZNAN2B26.js → read-file-FMTE6LPA.js} +10 -10
  215. package/chunks/{read-mcp-resource-RTSSEER5.js → read-mcp-resource-PZ4ZF6YL.js} +2 -2
  216. package/chunks/{record-artifact-E6AWQU2Z.js → record-artifact-P4HFMS7X.js} +3 -3
  217. package/chunks/{resumeHistoryUtils-RCY7AL5Y.js → resumeHistoryUtils-Z34RCZFF.js} +45 -43
  218. package/chunks/{ripGrep-C3KMLZM5.js → ripGrep-DUIYUZGM.js} +39 -38
  219. package/chunks/{run-qwen-serve-3JN75CIQ.js → run-qwen-serve-KOHHR3F4.js} +145 -62
  220. package/chunks/{runtime-VUA4WQYD.js → runtime-K4NTZSAU.js} +50 -49
  221. package/chunks/{scheduler-Z4IBXCOY.js → scheduler-6G6AMURS.js} +39 -38
  222. package/chunks/{sdk-exporters-http-IL2346MJ.js → sdk-exporters-http-KHAB5JSD.js} +2 -2
  223. package/chunks/{sdk-impl-SYKGVWOZ.js → sdk-impl-KD7FSTC3.js} +2 -2
  224. package/chunks/{send-message-TL6FIMMN.js → send-message-CAMSLG2L.js} +6 -5
  225. package/chunks/{serve-67T3P7XI.js → serve-NMG2TM5K.js} +46 -45
  226. package/chunks/{server-46ZO2CLV.js → server-FS7KDELS.js} +679 -360
  227. package/chunks/{session-B4IFAFC4.js → session-XZADUVKJ.js} +82 -81
  228. package/chunks/{settings-AI2BTBOZ.js → settings-G75R6FOA.js} +44 -43
  229. package/chunks/{shell-BKII3B6E.js → shell-3D3PMQHE.js} +39 -38
  230. package/chunks/{skill-6CFOWVGA.js → skill-TSEYMVQ2.js} +14 -14
  231. package/chunks/{skill-settings-6BFQWMW4.js → skill-settings-HJC2CPBJ.js} +44 -43
  232. package/chunks/{spawnChannel-FJXW35U7.js → spawnChannel-YWCN74G5.js} +41 -40
  233. package/chunks/{standalone-update-WVINHRNS.js → standalone-update-HLYOLX6V.js} +41 -40
  234. package/chunks/{startInteractiveUI-YE57CJ57.js → startInteractiveUI-ROUIQ5KU.js} +486 -187
  235. package/chunks/{syntheticOutput-BN7E626U.js → syntheticOutput-PEBJQYJV.js} +3 -3
  236. package/chunks/{task-create-Q727MXHJ.js → task-create-5NWCQSJF.js} +10 -9
  237. package/chunks/{task-list-G6KPQ5JT.js → task-list-53265TRZ.js} +5 -5
  238. package/chunks/{task-stop-TNXRNAL2.js → task-stop-FPCOIRYX.js} +2 -2
  239. package/chunks/{task-update-YB7PXO4R.js → task-update-5HN577LS.js} +10 -9
  240. package/chunks/{team-create-GNC7NFY6.js → team-create-OTP5SSB2.js} +39 -38
  241. package/chunks/{team-delete-GDO7H2T4.js → team-delete-MMQB4OSC.js} +5 -5
  242. package/chunks/{team-plan-approval-ECALJLIO.js → team-plan-approval-TQX5TMXU.js} +39 -38
  243. package/chunks/{terminal-image-renderer-II74TFVW.js → terminal-image-renderer-KF3GKNWW.js} +45 -39
  244. package/chunks/{theme-manager-2MGEDD22.js → theme-manager-XVWAAGAM.js} +40 -39
  245. package/chunks/{todoWrite-MHWHO5UO.js → todoWrite-JGV6VLOX.js} +4 -4
  246. package/chunks/{tool-search-S6LRRACA.js → tool-search-7N4D4O56.js} +14 -13
  247. package/chunks/{total-session-admission-7WVAWQPU.js → total-session-admission-ZQ4VKIRW.js} +43 -42
  248. package/chunks/{trustedFolders-NFS4KHO4.js → trustedFolders-4XYFPWVV.js} +40 -39
  249. package/chunks/{update-relaunch-Q5HLZ6UW.js → update-relaunch-L4GSBLUU.js} +5 -5
  250. package/chunks/{updateCheck-UOVZSTP7.js → updateCheck-PCUTVRFE.js} +42 -41
  251. package/chunks/{useAutoAcceptIndicator-PC6MOJCO.js → useAutoAcceptIndicator-WMXY7MND.js} +47 -46
  252. package/chunks/{validateNonInterActiveAuth-YMQP3ZM7.js → validateNonInterActiveAuth-5S3U2D56.js} +78 -77
  253. package/chunks/{version-T4AQFZJH.js → version-P57IQU2T.js} +1 -1
  254. package/chunks/{web-fetch-JQCJHEEX.js → web-fetch-5ZLLLCDD.js} +13 -13
  255. package/chunks/{web-search-QGZ2KY4G.js → web-search-NELKANTW.js} +10 -10
  256. package/chunks/web-shell-static-O73YPVVC.js +33 -0
  257. package/chunks/{workflow-YIT27YWZ.js → workflow-RXKBF3LO.js} +42 -40
  258. package/chunks/{workspace-providers-status-FIDZQ2PL.js → workspace-providers-status-HAEMNAWC.js} +48 -47
  259. package/chunks/{workspace-registration-store-RCSPE4DU.js → workspace-registration-store-U3U3YM6V.js} +1 -1
  260. package/chunks/{workspace-registry-5PEUCY6E.js → workspace-registry-ZFP33GVB.js} +43 -42
  261. package/chunks/{workspace-service-LANDVPL7.js → workspace-service-QMISJBMA.js} +50 -49
  262. package/chunks/{workspace-skills-status-2IQVJNIN.js → workspace-skills-status-K7EOUGXL.js} +46 -45
  263. package/chunks/{workspace-trust-reconciler-CZPZZCZC.js → workspace-trust-reconciler-BFPKULDZ.js} +50 -49
  264. package/chunks/{write-file-G5VNGCOG.js → write-file-2F76RRFE.js} +39 -38
  265. package/chunks/{zoom-image-6RBLD7X6.js → zoom-image-DPR22XWY.js} +10 -10
  266. package/cli.js +12 -12
  267. package/package.json +3 -3
  268. package/web-shell/assets/{arc-B-Vtkp1W.js → arc-CunFPPcQ.js} +1 -1
  269. package/web-shell/assets/{architectureDiagram-3BPJPVTR-qmTXIj64.js → architectureDiagram-3BPJPVTR-D3SqCgeM.js} +1 -1
  270. package/web-shell/assets/{blockDiagram-GPEHLZMM-ZlnXEtdP.js → blockDiagram-GPEHLZMM-CPRx90S_.js} +1 -1
  271. package/web-shell/assets/{c4Diagram-AAUBKEIU-Wyoirf6Z.js → c4Diagram-AAUBKEIU-CahP9Ue4.js} +1 -1
  272. package/web-shell/assets/channel-zbv7GWAw.js +1 -0
  273. package/web-shell/assets/{chunk-2J33WTMH-WQwbq9d8.js → chunk-2J33WTMH-DckIWZ12.js} +1 -1
  274. package/web-shell/assets/{chunk-4BX2VUAB-DQKnAXC4.js → chunk-4BX2VUAB-D2Kfctyn.js} +1 -1
  275. package/web-shell/assets/{chunk-55IACEB6-DIdgXNcO.js → chunk-55IACEB6-DkI11FTX.js} +1 -1
  276. package/web-shell/assets/{chunk-727SXJPM-CUwGOLEd.js → chunk-727SXJPM-rR-TSCIi.js} +1 -1
  277. package/web-shell/assets/{chunk-AQP2D5EJ-CCBGZFZ4.js → chunk-AQP2D5EJ-DFGKcGRO.js} +1 -1
  278. package/web-shell/assets/{chunk-FMBD7UC4-DMGXProk.js → chunk-FMBD7UC4-CjWqcTPE.js} +1 -1
  279. package/web-shell/assets/{chunk-ND2GUHAM-yejcFqsh.js → chunk-ND2GUHAM-RXe-87UV.js} +1 -1
  280. package/web-shell/assets/{chunk-QZHKN3VN-DxCyqTf7.js → chunk-QZHKN3VN-Dz0c_Yrn.js} +1 -1
  281. package/web-shell/assets/classDiagram-4FO5ZUOK-DSjLkJJZ.js +1 -0
  282. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-DSjLkJJZ.js +1 -0
  283. package/web-shell/assets/{cose-bilkent-S5V4N54A-DOrF3cg_.js → cose-bilkent-S5V4N54A-ZHF0-jvV.js} +1 -1
  284. package/web-shell/assets/{dagre-BM42HDAG-Be6CdYQ_.js → dagre-BM42HDAG-7Umz_ygJ.js} +1 -1
  285. package/web-shell/assets/{diagram-2AECGRRQ-B_Rjsft2.js → diagram-2AECGRRQ-DomN8nxq.js} +1 -1
  286. package/web-shell/assets/{diagram-5GNKFQAL-BvQbKSm1.js → diagram-5GNKFQAL-eebvj2OL.js} +1 -1
  287. package/web-shell/assets/{diagram-KO2AKTUF-BsdmMdpS.js → diagram-KO2AKTUF-IR1mmn9d.js} +1 -1
  288. package/web-shell/assets/{diagram-LMA3HP47-CrQlBaNr.js → diagram-LMA3HP47-CKysx5KF.js} +1 -1
  289. package/web-shell/assets/{diagram-OG6HWLK6-aB1MD_DL.js → diagram-OG6HWLK6-cBy5puHn.js} +1 -1
  290. package/web-shell/assets/{erDiagram-TEJ5UH35-F-eUUn9n.js → erDiagram-TEJ5UH35-B5RJagPG.js} +1 -1
  291. package/web-shell/assets/{flowDiagram-I6XJVG4X-DY_d8lUK.js → flowDiagram-I6XJVG4X-CfHgDmPg.js} +1 -1
  292. package/web-shell/assets/{ganttDiagram-6RSMTGT7-Dqu7KBPg.js → ganttDiagram-6RSMTGT7-DUfFF5nb.js} +1 -1
  293. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-2IkU_VEj.js → gitGraphDiagram-PVQCEYII-M9dt57k5.js} +1 -1
  294. package/web-shell/assets/{index-QQlUCJGg.css → index-B8e-CkuC.css} +2 -2
  295. package/web-shell/assets/{index-BuSbqggh.js → index-CKjO4myk.js} +1 -1
  296. package/web-shell/assets/index-Dc-fTO0V.js +1768 -0
  297. package/web-shell/assets/{infoDiagram-5YYISTIA-C4orwzPw.js → infoDiagram-5YYISTIA-CTKMmIro.js} +1 -1
  298. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-fXUEfef_.js → ishikawaDiagram-YF4QCWOH-DJIJDP4s.js} +1 -1
  299. package/web-shell/assets/{journeyDiagram-JHISSGLW-Bs0I1_J5.js → journeyDiagram-JHISSGLW-DgRnvn6S.js} +1 -1
  300. package/web-shell/assets/{kanban-definition-UN3LZRKU-BPRj1dw_.js → kanban-definition-UN3LZRKU-VUwO8yrg.js} +1 -1
  301. package/web-shell/assets/{linear-DFS6ZDpW.js → linear-BCvgV5I_.js} +1 -1
  302. package/web-shell/assets/{mermaid.core-CZxjWMaO.js → mermaid.core-mv_kVV6q.js} +5 -5
  303. package/web-shell/assets/{mindmap-definition-RKZ34NQL-Dsr3PmNs.js → mindmap-definition-RKZ34NQL-sfnjMlOd.js} +1 -1
  304. package/web-shell/assets/{pieDiagram-4H26LBE5-D5Ngpz5Y.js → pieDiagram-4H26LBE5-BlhICse4.js} +1 -1
  305. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-WJK9I25z.js → quadrantDiagram-W4KKPZXB-BgTQzwen.js} +1 -1
  306. package/web-shell/assets/{requirementDiagram-4Y6WPE33-CmrYcwOH.js → requirementDiagram-4Y6WPE33-CZ-FTrrN.js} +1 -1
  307. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-7SjCc4Mv.js → sankeyDiagram-5OEKKPKP-G5Wp_jn3.js} +1 -1
  308. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-Dl9E0IRM.js → sequenceDiagram-3UESZ5HK-C8MKZ3i1.js} +1 -1
  309. package/web-shell/assets/{stateDiagram-AJRCARHV-CRRio7yV.js → stateDiagram-AJRCARHV-Bo0ZDm7y.js} +1 -1
  310. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-31TSCPcH.js +1 -0
  311. package/web-shell/assets/{timeline-definition-PNZ67QCA-DVyXjjfq.js → timeline-definition-PNZ67QCA-M3L9E01f.js} +1 -1
  312. package/web-shell/assets/{vennDiagram-CIIHVFJN-Nb2Lckzq.js → vennDiagram-CIIHVFJN-DD4eHCrm.js} +1 -1
  313. package/web-shell/assets/{wardley-L42UT6IY-DuL_otIP.js → wardley-L42UT6IY-DNEL_3g4.js} +1 -1
  314. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-DVI9Q4Aa.js → wardleyDiagram-YWT4CUSO-q484OoqI.js} +1 -1
  315. package/web-shell/assets/{xychartDiagram-2RQKCTM6-BNjAm7KD.js → xychartDiagram-2RQKCTM6-4mcNt1Yg.js} +1 -1
  316. package/web-shell/index.html +2 -2
  317. package/chunks/chunk-EMYZIABH.js +0 -81
  318. package/chunks/nonInteractiveCli-P4UKCJFM.js +0 -154
  319. package/web-shell/assets/channel-DXaHnfjS.js +0 -1
  320. package/web-shell/assets/classDiagram-4FO5ZUOK-BigU82A0.js +0 -1
  321. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-BigU82A0.js +0 -1
  322. package/web-shell/assets/index-DrfC2e9s.js +0 -1768
  323. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-1atT7XaU.js +0 -1
@@ -40,7 +40,7 @@ import {
40
40
  CronScheduler,
41
41
  DEFAULT_RECURRING_MAX_AGE_DAYS,
42
42
  normalizeRecurringMaxAge
43
- } from "./chunk-Z7JILXGX.js";
43
+ } from "./chunk-2UUMVNYT.js";
44
44
  import {
45
45
  consumeUnread,
46
46
  forwardApproval,
@@ -49,13 +49,13 @@ import {
49
49
  sendStructuredMessage,
50
50
  wrapConfirmWithBadge,
51
51
  writeMessage
52
- } from "./chunk-T5U6IM4C.js";
52
+ } from "./chunk-MVUQRLOH.js";
53
53
  import {
54
54
  claimTask,
55
55
  listTasks,
56
56
  onTasksUpdated,
57
57
  unassignTeammateTasks
58
- } from "./chunk-TSERKWCX.js";
58
+ } from "./chunk-XCWO3SMQ.js";
59
59
  import {
60
60
  assignTeammateColor,
61
61
  classifyShutdownResponse,
@@ -63,7 +63,7 @@ import {
63
63
  formatAgentId,
64
64
  generateUniqueTeammateName,
65
65
  writeTeamFile
66
- } from "./chunk-33FNCQSY.js";
66
+ } from "./chunk-7MH4J33A.js";
67
67
  import {
68
68
  parsePositiveIntegerEnv
69
69
  } from "./chunk-6PVPNMXU.js";
@@ -71,13 +71,13 @@ import {
71
71
  RUNTIME_SNAPSHOT_PREFIX,
72
72
  buildModelIdContext,
73
73
  resolveModelId
74
- } from "./chunk-DIT4V3XH.js";
74
+ } from "./chunk-RGTB44BO.js";
75
75
  import {
76
76
  ARTIFACT_TITLE_MAX_LENGTH,
77
77
  ARTIFACT_WORKSPACE_PATH_MAX_LENGTH,
78
78
  hasControlCharacter,
79
79
  hasUnsafeDisplayPayload
80
- } from "./chunk-3PRJYMXC.js";
80
+ } from "./chunk-HUWENAHO.js";
81
81
  import {
82
82
  promptIdContext,
83
83
  todoWorkChainContext
@@ -105,7 +105,7 @@ import {
105
105
  require_dist as require_dist2,
106
106
  stringify,
107
107
  validateSkillName
108
- } from "./chunk-4S4OEQ6U.js";
108
+ } from "./chunk-J6SZID63.js";
109
109
  import {
110
110
  require_proper_lockfile
111
111
  } from "./chunk-KRXPRVGL.js";
@@ -123,15 +123,15 @@ import {
123
123
  createHookOutput,
124
124
  getHookKey,
125
125
  isToolArtifactLike
126
- } from "./chunk-A5YZ3FA2.js";
126
+ } from "./chunk-GM463R2B.js";
127
127
  import {
128
128
  BaseTokenStorage,
129
129
  KeychainTokenStorage
130
- } from "./chunk-YAVY33G4.js";
130
+ } from "./chunk-SEZ556DZ.js";
131
131
  import {
132
132
  normalizeImageGenerationBaseUrl,
133
133
  resolveNetworkTarget
134
- } from "./chunk-2UISUFHQ.js";
134
+ } from "./chunk-CJXIIILK.js";
135
135
  import {
136
136
  GoalPersistenceUnavailableError,
137
137
  PAUSED_GOAL_SYSTEM_REMINDER,
@@ -139,17 +139,13 @@ import {
139
139
  goalRequiresExactPermit,
140
140
  goalTurnContext,
141
141
  parseGoalStateRecordPayloadV2
142
- } from "./chunk-MBEMTXQT.js";
142
+ } from "./chunk-3K7FH2KQ.js";
143
143
  import {
144
144
  APPROVAL_MODES,
145
145
  SUBAGENT_PLAN_LIFECYCLE_TOOLS,
146
146
  buildSubagentPlanToolBlockedResult,
147
- childLaunchDepth,
148
- getCurrentAgentDepth,
149
- getCurrentAgentId,
150
147
  getLeaderOnlyToolUnavailableMessage,
151
148
  getPlanRequiredTeammatePreApprovalMessage,
152
- getRuntimeContentGenerator,
153
149
  getSubagentPlanToolUnavailableMessage,
154
150
  isLeaderOnlyToolUnavailableInSubagent,
155
151
  isPlanLifecycleToolUnavailableInSubagent,
@@ -157,18 +153,38 @@ import {
157
153
  isPlanRequiredTeammateContext,
158
154
  isPlanRequiredTeammatePreApprovalAllowedTool,
159
155
  isSubagentLikeExecutionContext,
156
+ shouldUsePlanOnlyReminderInSubagentContext
157
+ } from "./chunk-WAUGQKUU.js";
158
+ import {
159
+ DEFAULT_OTLP_ENDPOINT,
160
+ DEFAULT_TELEMETRY_TARGET,
161
+ addToolArgumentsAttributes,
162
+ addToolCallResultAttributes,
163
+ addUserPromptAttributes
164
+ } from "./chunk-L4N6TIP7.js";
165
+ import {
166
+ supportsOpenAIPrefixCaching
167
+ } from "./chunk-SAH4BD2J.js";
168
+ import {
169
+ childLaunchDepth,
170
+ getCurrentAgentDepth,
171
+ getCurrentAgentId,
172
+ getRuntimeContentGenerator,
160
173
  isTopLevelSession,
161
174
  runOutsideAgentContext,
162
175
  runWithAgentContext,
163
176
  runWithRuntimeContentGenerator,
164
- shouldUsePlanOnlyReminderInSubagentContext,
165
177
  spawnBlockReason
166
- } from "./chunk-6WBWIPBF.js";
178
+ } from "./chunk-CPG6P4GG.js";
167
179
  import {
168
180
  getTeammateContext,
169
181
  isTeammate,
170
182
  runWithTeammateIdentity
171
183
  } from "./chunk-S6LOFUVP.js";
184
+ import {
185
+ InvalidStreamError,
186
+ getThoughtSummary
187
+ } from "./chunk-2J3OJGTL.js";
172
188
  import {
173
189
  BUBBLE_APPROVAL_MODE,
174
190
  FORK_AGENT,
@@ -202,7 +218,7 @@ import {
202
218
  selectForkHistory,
203
219
  stripSystemReminderBlocks,
204
220
  validateForkToolList
205
- } from "./chunk-WVAESIM6.js";
221
+ } from "./chunk-IA7TGCN2.js";
206
222
  import {
207
223
  collectAvailableSkillEntries,
208
224
  renderAvailableSkillsBlock
@@ -220,10 +236,7 @@ import {
220
236
  getQwenIgnoreFileNames,
221
237
  isPathWithinRoot,
222
238
  require_ignore
223
- } from "./chunk-432XCUHF.js";
224
- import {
225
- DashScopeOpenAICompatibleProvider
226
- } from "./chunk-HU5TUALO.js";
239
+ } from "./chunk-EQL65XGA.js";
227
240
  import {
228
241
  openBrowserSecurely,
229
242
  shouldAttemptBrowserLaunch
@@ -233,26 +246,7 @@ import {
233
246
  isFallbackEligible,
234
247
  isUnattendedMode,
235
248
  retryWithBackoff
236
- } from "./chunk-QMBEW7EW.js";
237
- import {
238
- DEFAULT_OPENAI_BASE_URL
239
- } from "./chunk-GLNBDYUX.js";
240
- import {
241
- combineAbortSignals,
242
- createAbortController,
243
- createChildAbortController
244
- } from "./chunk-DJ2GSRLV.js";
245
- import {
246
- DEFAULT_OTLP_ENDPOINT,
247
- DEFAULT_TELEMETRY_TARGET,
248
- addToolArgumentsAttributes,
249
- addToolCallResultAttributes,
250
- addUserPromptAttributes
251
- } from "./chunk-MGSSJT27.js";
252
- import {
253
- InvalidStreamError,
254
- getThoughtSummary
255
- } from "./chunk-2J3OJGTL.js";
249
+ } from "./chunk-BGG4MBYD.js";
256
250
  import {
257
251
  QUOTA_EXHAUSTED_PREFIX,
258
252
  formatQuotaExhaustedMessage,
@@ -262,11 +256,19 @@ import {
262
256
  isQuotaExhaustedError,
263
257
  isRateLimitError,
264
258
  isStructuredError
265
- } from "./chunk-6O5DVH27.js";
259
+ } from "./chunk-M6HMMKVG.js";
260
+ import {
261
+ DEFAULT_OPENAI_BASE_URL
262
+ } from "./chunk-AXMWHKXA.js";
266
263
  import {
267
264
  getToolCallPreparations,
268
265
  setToolCallPreparations
269
266
  } from "./chunk-GLCZKT5V.js";
267
+ import {
268
+ combineAbortSignals,
269
+ createAbortController,
270
+ createChildAbortController
271
+ } from "./chunk-DJ2GSRLV.js";
270
272
  import {
271
273
  ApiRetryEvent,
272
274
  ContentRetryEvent,
@@ -382,7 +384,7 @@ import {
382
384
  updateMCPServerStatus,
383
385
  writeLine,
384
386
  writeLineSync
385
- } from "./chunk-PX5DNLSA.js";
387
+ } from "./chunk-XCG76UE6.js";
386
388
  import {
387
389
  defaultModalities
388
390
  } from "./chunk-WOJZWRAZ.js";
@@ -410,10 +412,10 @@ import {
410
412
  isManagedMemoryPath,
411
413
  isTeamAutoMemPath,
412
414
  isUserAutoMemPath
413
- } from "./chunk-E4WHKETF.js";
415
+ } from "./chunk-FVKHVJZQ.js";
414
416
  import {
415
417
  STRUCTURED_OUTPUT_REDACTED_ARGS
416
- } from "./chunk-ZPPP6VCL.js";
418
+ } from "./chunk-6ZRFAKXK.js";
417
419
  import {
418
420
  AgentStatistics,
419
421
  BaseDeclarativeTool,
@@ -425,13 +427,14 @@ import {
425
427
  ToolDisplayNamesMigration,
426
428
  ToolNames,
427
429
  ToolNamesMigration,
430
+ canonicalToolName,
428
431
  hasCycleInSchema,
429
432
  isShellProgressData,
430
433
  isTool,
431
434
  require_dist,
432
435
  require_fast_deep_equal,
433
436
  require_fast_uri
434
- } from "./chunk-D7D7RXIJ.js";
437
+ } from "./chunk-PYQADEFD.js";
435
438
  import {
436
439
  AUTH_ENV_MAPPINGS,
437
440
  AuthType,
@@ -445,7 +448,7 @@ import {
445
448
  createContentGenerator,
446
449
  resetPreloadedContentGenerator,
447
450
  resolveContentGeneratorConfigWithSources
448
- } from "./chunk-BOGOR4HB.js";
451
+ } from "./chunk-P7HUJDBZ.js";
449
452
  import {
450
453
  normalizeMcpToolName,
451
454
  sanitizeToolNameForProvider
@@ -465,13 +468,13 @@ import {
465
468
  preloadRuntimeFetchModule,
466
469
  redactProxyError,
467
470
  setResolvedProxyUrlForRuntimeFetch
468
- } from "./chunk-BFHXDAR7.js";
471
+ } from "./chunk-KKBPOU75.js";
469
472
  import {
470
473
  atomicWriteFile,
471
474
  atomicWriteFileSync,
472
475
  atomicWriteJSON,
473
476
  renameWithRetry
474
- } from "./chunk-UH7Z7Y45.js";
477
+ } from "./chunk-FOGU3LJX.js";
475
478
  import {
476
479
  endHookSpan,
477
480
  endInteractionSpan,
@@ -497,7 +500,7 @@ import {
497
500
  startToolExecutionSpan,
498
501
  startToolSpan,
499
502
  truncateSpanError
500
- } from "./chunk-5L6CQ4ZU.js";
503
+ } from "./chunk-6M26GBKX.js";
501
504
  import {
502
505
  safeJsonStringify
503
506
  } from "./chunk-W4RQUHY3.js";
@@ -547,7 +550,7 @@ import {
547
550
  tildeifyPath,
548
551
  toFriendlyError,
549
552
  unescapePath
550
- } from "./chunk-3RXUYQJI.js";
553
+ } from "./chunk-OIVKILPI.js";
551
554
  import {
552
555
  require_src
553
556
  } from "./chunk-AMDSOFFV.js";
@@ -8802,16 +8805,16 @@ var require_windows = __commonJS({
8802
8805
  return false;
8803
8806
  }
8804
8807
  __name(checkPathExt, "checkPathExt");
8805
- function checkStat(stat21, path98, options2) {
8806
- if (!stat21.isSymbolicLink() && !stat21.isFile()) {
8808
+ function checkStat(stat22, path98, options2) {
8809
+ if (!stat22.isSymbolicLink() && !stat22.isFile()) {
8807
8810
  return false;
8808
8811
  }
8809
8812
  return checkPathExt(path98, options2);
8810
8813
  }
8811
8814
  __name(checkStat, "checkStat");
8812
8815
  function isexe(path98, options2, cb) {
8813
- fs93.stat(path98, function(er2, stat21) {
8814
- cb(er2, er2 ? false : checkStat(stat21, path98, options2));
8816
+ fs93.stat(path98, function(er2, stat22) {
8817
+ cb(er2, er2 ? false : checkStat(stat22, path98, options2));
8815
8818
  });
8816
8819
  }
8817
8820
  __name(isexe, "isexe");
@@ -8830,8 +8833,8 @@ var require_mode = __commonJS({
8830
8833
  isexe.sync = sync2;
8831
8834
  var fs93 = __require("fs");
8832
8835
  function isexe(path98, options2, cb) {
8833
- fs93.stat(path98, function(er2, stat21) {
8834
- cb(er2, er2 ? false : checkStat(stat21, options2));
8836
+ fs93.stat(path98, function(er2, stat22) {
8837
+ cb(er2, er2 ? false : checkStat(stat22, options2));
8835
8838
  });
8836
8839
  }
8837
8840
  __name(isexe, "isexe");
@@ -8839,14 +8842,14 @@ var require_mode = __commonJS({
8839
8842
  return checkStat(fs93.statSync(path98), options2);
8840
8843
  }
8841
8844
  __name(sync2, "sync");
8842
- function checkStat(stat21, options2) {
8843
- return stat21.isFile() && checkMode(stat21, options2);
8845
+ function checkStat(stat22, options2) {
8846
+ return stat22.isFile() && checkMode(stat22, options2);
8844
8847
  }
8845
8848
  __name(checkStat, "checkStat");
8846
- function checkMode(stat21, options2) {
8847
- var mod = stat21.mode;
8848
- var uid = stat21.uid;
8849
- var gid = stat21.gid;
8849
+ function checkMode(stat22, options2) {
8850
+ var mod = stat22.mode;
8851
+ var uid = stat22.uid;
8852
+ var gid = stat22.gid;
8850
8853
  var myUid = options2.uid !== void 0 ? options2.uid : process.getuid && process.getuid();
8851
8854
  var myGid = options2.gid !== void 0 ? options2.gid : process.getgid && process.getgid();
8852
8855
  var u2 = parseInt("100", 8);
@@ -18227,12 +18230,12 @@ var require_resolve_symlink = __commonJS({
18227
18230
  fs_1.default.realpath(path98, (error, resolvedPath) => {
18228
18231
  if (error)
18229
18232
  return queue.dequeue(suppressErrors ? null : error, state);
18230
- fs_1.default.stat(resolvedPath, (error2, stat21) => {
18233
+ fs_1.default.stat(resolvedPath, (error2, stat22) => {
18231
18234
  if (error2)
18232
18235
  return queue.dequeue(suppressErrors ? null : error2, state);
18233
- if (stat21.isDirectory() && isRecursive(path98, resolvedPath, state))
18236
+ if (stat22.isDirectory() && isRecursive(path98, resolvedPath, state))
18234
18237
  return queue.dequeue(null, state);
18235
- callback(stat21, resolvedPath);
18238
+ callback(stat22, resolvedPath);
18236
18239
  queue.dequeue(null, state);
18237
18240
  });
18238
18241
  });
@@ -18242,10 +18245,10 @@ var require_resolve_symlink = __commonJS({
18242
18245
  queue.enqueue();
18243
18246
  try {
18244
18247
  const resolvedPath = fs_1.default.realpathSync(path98);
18245
- const stat21 = fs_1.default.statSync(resolvedPath);
18246
- if (stat21.isDirectory() && isRecursive(path98, resolvedPath, state))
18248
+ const stat22 = fs_1.default.statSync(resolvedPath);
18249
+ if (stat22.isDirectory() && isRecursive(path98, resolvedPath, state))
18247
18250
  return;
18248
- callback(stat21, resolvedPath);
18251
+ callback(stat22, resolvedPath);
18249
18252
  } catch (e) {
18250
18253
  if (!suppressErrors)
18251
18254
  throw e;
@@ -18564,8 +18567,8 @@ var require_walker = __commonJS({
18564
18567
  this.walkDirectory(this.state, path98, path98, depth - 1, this.walk);
18565
18568
  } else if (this.resolveSymlink && entry.isSymbolicLink()) {
18566
18569
  let path98 = joinPath.joinPathWithBasePath(entry.name, directoryPath);
18567
- this.resolveSymlink(path98, this.state, (stat21, resolvedPath) => {
18568
- if (stat21.isDirectory()) {
18570
+ this.resolveSymlink(path98, this.state, (stat22, resolvedPath) => {
18571
+ if (stat22.isDirectory()) {
18569
18572
  resolvedPath = (0, utils_1.normalizePath)(resolvedPath, this.state.options);
18570
18573
  if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path98 + pathSeparator))
18571
18574
  return;
@@ -19972,7 +19975,8 @@ var BaseLlmClient = class {
19972
19975
  const request = {
19973
19976
  model: requestModel,
19974
19977
  config: requestConfig,
19975
- contents: requestContents
19978
+ contents: requestContents,
19979
+ ...options2.promptCacheSharing && { promptCacheSharing: true }
19976
19980
  };
19977
19981
  const apiCall = stream2 ? async () => {
19978
19982
  const responseStream = await contentGenerator.generateContentStream(
@@ -20327,12 +20331,12 @@ async function cleanupLegacyOutputFiles(dir, now, maxAgeMs, result) {
20327
20331
  __name(cleanupLegacyOutputFiles, "cleanupLegacyOutputFiles");
20328
20332
  async function tryDeleteIfOld(filePath, now, maxAgeMs, result) {
20329
20333
  try {
20330
- const stat21 = await fs2.lstat(filePath);
20331
- if (!stat21.isFile()) return;
20332
- if (now - stat21.mtimeMs < maxAgeMs) return;
20334
+ const stat22 = await fs2.lstat(filePath);
20335
+ if (!stat22.isFile()) return;
20336
+ if (now - stat22.mtimeMs < maxAgeMs) return;
20333
20337
  await fs2.unlink(filePath);
20334
20338
  result.filesDeleted++;
20335
- result.bytesFreed += stat21.size;
20339
+ result.bytesFreed += stat22.size;
20336
20340
  } catch (error) {
20337
20341
  if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
20338
20342
  return;
@@ -29106,6 +29110,7 @@ var SESSION_TRANSCRIPT_MAX_LIMIT = 500;
29106
29110
  var SESSION_TRANSCRIPT_CURSOR_VERSION = 1;
29107
29111
  var SESSION_TRANSCRIPT_MAX_INDEX_BYTES = 256 * 1024 * 1024;
29108
29112
  var SESSION_TRANSCRIPT_MAX_PAGE_BYTES = 4 * 1024 * 1024;
29113
+ var SESSION_TRANSCRIPT_MAX_EXPANDED_PAGE_BYTES = 16 * 1024 * 1024;
29109
29114
  var InvalidSessionTranscriptCursorError = class extends Error {
29110
29115
  static {
29111
29116
  __name(this, "InvalidSessionTranscriptCursorError");
@@ -29166,6 +29171,11 @@ var debugLogger14 = createDebugLogger("SESSION_TRANSCRIPT");
29166
29171
  var indexCache = /* @__PURE__ */ new Map();
29167
29172
  var cursorHmacKeys = /* @__PURE__ */ new Map();
29168
29173
  var indexCacheMaxBytesForTest;
29174
+ var expandedPageBytesForTest;
29175
+ function getExpandedPageBytes() {
29176
+ return expandedPageBytesForTest ?? SESSION_TRANSCRIPT_MAX_EXPANDED_PAGE_BYTES;
29177
+ }
29178
+ __name(getExpandedPageBytes, "getExpandedPageBytes");
29169
29179
  function makeSessionTranscriptNotFoundError(sessionId) {
29170
29180
  const error = new Error(
29171
29181
  `ENOENT: no such file or directory, open '${sessionId}.jsonl'`
@@ -29404,12 +29414,68 @@ function selectPageUuids(index, position, limit, maxBytes) {
29404
29414
  return selected;
29405
29415
  }
29406
29416
  __name(selectPageUuids, "selectPageUuids");
29417
+ var REPLAY_MID_TURN_USER_SUBTYPES = /* @__PURE__ */ new Set([
29418
+ "goal_runtime",
29419
+ "notification",
29420
+ "cron",
29421
+ "mid_turn_user_message"
29422
+ ]);
29423
+ function isReplayTurnStartType(type, subtype) {
29424
+ return type === "user" && (subtype === void 0 || !REPLAY_MID_TURN_USER_SUBTYPES.has(subtype));
29425
+ }
29426
+ __name(isReplayTurnStartType, "isReplayTurnStartType");
29407
29427
  function isReplayTurnStart(index, uuid) {
29408
29428
  const entry = index.byUuid.get(uuid);
29409
- return entry?.type === "user" && entry.subtype !== "mid_turn_user_message";
29429
+ return isReplayTurnStartType(entry?.type, entry?.subtype);
29410
29430
  }
29411
29431
  __name(isReplayTurnStart, "isReplayTurnStart");
29412
- function selectBackwardPageUuids(index, position, limit, maxBytes) {
29432
+ function isReplayPageStart(index, uuid) {
29433
+ const entry = index.byUuid.get(uuid);
29434
+ return entry?.subtype !== "realtime_message" && (entry?.type === "assistant" || isReplayTurnStartType(entry?.type, entry?.subtype));
29435
+ }
29436
+ __name(isReplayPageStart, "isReplayPageStart");
29437
+ function findBoundaryAtOrBefore(items, from, floor, isBoundary) {
29438
+ let candidate = from;
29439
+ while (candidate > floor && !isBoundary(items[candidate])) {
29440
+ candidate--;
29441
+ }
29442
+ return candidate;
29443
+ }
29444
+ __name(findBoundaryAtOrBefore, "findBoundaryAtOrBefore");
29445
+ function findReplayBoundaryAtOrBefore(index, from, floor, isBoundary) {
29446
+ return findBoundaryAtOrBefore(
29447
+ index.activeUuids,
29448
+ from,
29449
+ floor,
29450
+ (uuid) => isBoundary(index, uuid)
29451
+ );
29452
+ }
29453
+ __name(findReplayBoundaryAtOrBefore, "findReplayBoundaryAtOrBefore");
29454
+ function backwardPageBytesFit(index, start, end, budget) {
29455
+ let total = 0;
29456
+ for (let i = start; i < end; i++) {
29457
+ total += recordSegmentBytes(index, index.activeUuids[i]);
29458
+ if (total > budget) return false;
29459
+ }
29460
+ return true;
29461
+ }
29462
+ __name(backwardPageBytesFit, "backwardPageBytesFit");
29463
+ function selectionOrphansToolResult(index, start, end) {
29464
+ for (let i = start; i < end; i++) {
29465
+ if (index.byUuid.get(index.activeUuids[i])?.type !== "tool_result") {
29466
+ continue;
29467
+ }
29468
+ for (let owner = i - 1; owner >= start; owner--) {
29469
+ if (isReplayPageStart(index, index.activeUuids[owner])) return false;
29470
+ }
29471
+ return true;
29472
+ }
29473
+ return false;
29474
+ }
29475
+ __name(selectionOrphansToolResult, "selectionOrphansToolResult");
29476
+ function selectBackwardPageUuids(index, sessionId, position, limit, maxBytes) {
29477
+ if (position === 0) return { uuids: [], nextPosition: 0 };
29478
+ const expansionByteBudget = maxBytes === void 0 ? getExpandedPageBytes() : Math.min(2 * maxBytes, getExpandedPageBytes());
29413
29479
  let start = Math.max(0, position - limit);
29414
29480
  for (let i = start; i < position; i++) {
29415
29481
  if (isReplayTurnStart(index, index.activeUuids[i])) {
@@ -29417,8 +29483,15 @@ function selectBackwardPageUuids(index, position, limit, maxBytes) {
29417
29483
  break;
29418
29484
  }
29419
29485
  }
29420
- while (start > 0 && !isReplayTurnStart(index, index.activeUuids[start])) {
29421
- start--;
29486
+ const expansionFloor = Math.max(0, position - 2 * limit);
29487
+ const expandedStart = findReplayBoundaryAtOrBefore(
29488
+ index,
29489
+ start,
29490
+ expansionFloor,
29491
+ isReplayTurnStart
29492
+ );
29493
+ if (isReplayTurnStart(index, index.activeUuids[expandedStart])) {
29494
+ start = expandedStart;
29422
29495
  }
29423
29496
  let selectedStart = position;
29424
29497
  let selectedBytes = 0;
@@ -29431,6 +29504,11 @@ function selectBackwardPageUuids(index, position, limit, maxBytes) {
29431
29504
  selectedStart = i;
29432
29505
  selectedBytes += bytes;
29433
29506
  }
29507
+ const logTurnExpansionSkipped = /* @__PURE__ */ __name((reason) => {
29508
+ debugLogger14.debug(
29509
+ `backward turn expansion skipped session=${sessionId} start=${index.activeUuids[selectedStart]} reason=${reason}`
29510
+ );
29511
+ }, "logTurnExpansionSkipped");
29434
29512
  let alignedToReplayBoundary = false;
29435
29513
  for (let i = selectedStart; i < position; i++) {
29436
29514
  if (isReplayTurnStart(index, index.activeUuids[i])) {
@@ -29440,16 +29518,59 @@ function selectBackwardPageUuids(index, position, limit, maxBytes) {
29440
29518
  }
29441
29519
  }
29442
29520
  if (alignedToReplayBoundary && selectedStart > 0) {
29443
- let previousTurnStart = selectedStart - 1;
29444
- while (previousTurnStart >= 0 && !isReplayTurnStart(index, index.activeUuids[previousTurnStart])) {
29445
- previousTurnStart--;
29446
- }
29521
+ const previousTurnStart = findReplayBoundaryAtOrBefore(
29522
+ index,
29523
+ selectedStart - 1,
29524
+ -1,
29525
+ isReplayTurnStart
29526
+ );
29447
29527
  if (previousTurnStart < 0) {
29448
- selectedStart = 0;
29528
+ if (expansionFloor === 0 && backwardPageBytesFit(index, 0, position, expansionByteBudget)) {
29529
+ selectedStart = 0;
29530
+ } else {
29531
+ logTurnExpansionSkipped(
29532
+ expansionFloor === 0 ? "byte-budget" : "record-budget"
29533
+ );
29534
+ }
29449
29535
  }
29450
29536
  } else if (!alignedToReplayBoundary) {
29451
- while (selectedStart > 0 && !isReplayTurnStart(index, index.activeUuids[selectedStart])) {
29452
- selectedStart--;
29537
+ const candidate = findReplayBoundaryAtOrBefore(
29538
+ index,
29539
+ selectedStart,
29540
+ expansionFloor,
29541
+ isReplayTurnStart
29542
+ );
29543
+ if (isReplayTurnStart(index, index.activeUuids[candidate])) {
29544
+ if (backwardPageBytesFit(index, candidate, position, expansionByteBudget)) {
29545
+ selectedStart = candidate;
29546
+ } else {
29547
+ logTurnExpansionSkipped("byte-budget");
29548
+ }
29549
+ }
29550
+ }
29551
+ if (selectedStart > 0 && selectionOrphansToolResult(index, selectedStart, position)) {
29552
+ const pairFloor = Math.max(0, selectedStart - limit);
29553
+ const pairStart = findReplayBoundaryAtOrBefore(
29554
+ index,
29555
+ selectedStart,
29556
+ pairFloor,
29557
+ isReplayPageStart
29558
+ );
29559
+ if (!isReplayPageStart(index, index.activeUuids[pairStart])) {
29560
+ debugLogger14.debug(
29561
+ `backward pair extension skipped session=${sessionId} start=${index.activeUuids[selectedStart]} reason=record-budget`
29562
+ );
29563
+ } else if (!backwardPageBytesFit(
29564
+ index,
29565
+ pairStart + 1,
29566
+ selectedStart,
29567
+ expansionByteBudget
29568
+ )) {
29569
+ debugLogger14.debug(
29570
+ `backward pair extension skipped session=${sessionId} start=${index.activeUuids[selectedStart]} reason=byte-budget`
29571
+ );
29572
+ } else {
29573
+ selectedStart = pairStart;
29453
29574
  }
29454
29575
  }
29455
29576
  return {
@@ -29880,7 +30001,7 @@ var SessionTranscriptReader = class {
29880
30001
  );
29881
30002
  throw new InvalidSessionTranscriptCursorError();
29882
30003
  }
29883
- const backwardPage = direction === "backward" ? selectBackwardPageUuids(index, position, limit, maxBytes) : void 0;
30004
+ const backwardPage = direction === "backward" ? selectBackwardPageUuids(index, sessionId, position, limit, maxBytes) : void 0;
29884
30005
  const pageUuids = backwardPage?.uuids ?? selectPageUuids(index, position, limit, maxBytes);
29885
30006
  const nextPosition = backwardPage?.nextPosition ?? position + pageUuids.length;
29886
30007
  const records = await readAggregatedRecords(index, pageUuids);
@@ -29923,6 +30044,15 @@ import { createHash as createHash3, randomUUID as randomUUID2 } from "node:crypt
29923
30044
  import * as fs11 from "node:fs/promises";
29924
30045
  import * as os3 from "node:os";
29925
30046
  import * as path11 from "node:path";
30047
+
30048
+ // packages/core/src/utils/file-identity.ts
30049
+ init_esbuild_shims();
30050
+ function hasVerifiableInode(ino) {
30051
+ return Number(ino) !== 0;
30052
+ }
30053
+ __name(hasVerifiableInode, "hasVerifiableInode");
30054
+
30055
+ // packages/core/src/services/session-writer-lease.ts
29926
30056
  var LEGACY_LOCK_SCHEMA_VERSION = 1;
29927
30057
  var LOCK_SCHEMA_VERSION = 2;
29928
30058
  var MALFORMED_RETRY_COUNT = 3;
@@ -30000,12 +30130,31 @@ var SessionWriterUnavailableError = class extends SessionWriterError {
30000
30130
  static {
30001
30131
  __name(this, "SessionWriterUnavailableError");
30002
30132
  }
30133
+ // Widened from the literal type so the subclass below can redeclare `name`.
30134
+ // Narrowing this back to a literal makes that subclass fail to compile.
30003
30135
  name = "SessionWriterUnavailableError";
30004
30136
  rpcCode = SESSION_WRITER_RPC_CODES.session_writer_unavailable;
30005
30137
  errorKind = "session_writer_unavailable";
30006
30138
  httpStatus = 503;
30007
30139
  constructor(options2) {
30008
- super("Session write ownership could not be verified.", options2);
30140
+ super(
30141
+ options2?.message ?? "Session write ownership could not be verified.",
30142
+ options2
30143
+ );
30144
+ }
30145
+ };
30146
+ var SessionTranscriptIdentityUnavailableError = class extends SessionWriterUnavailableError {
30147
+ static {
30148
+ __name(this, "SessionTranscriptIdentityUnavailableError");
30149
+ }
30150
+ name = "SessionTranscriptIdentityUnavailableError";
30151
+ constructor(cause) {
30152
+ super({
30153
+ message: "Session transcript identity could not be verified on this filesystem.",
30154
+ cause: cause ?? new Error(
30155
+ "The session transcript filesystem does not provide a verifiable inode identity (ino=0)."
30156
+ )
30157
+ });
30009
30158
  }
30010
30159
  };
30011
30160
  function isProcessAlive(pid) {
@@ -30043,11 +30192,11 @@ __name(execFileText, "execFileText");
30043
30192
  async function readProcessStartIdentity(pid) {
30044
30193
  if (process.platform === "linux") {
30045
30194
  try {
30046
- const [stat21, bootId] = await Promise.all([
30195
+ const [stat22, bootId] = await Promise.all([
30047
30196
  fs11.readFile(`/proc/${pid}/stat`, "utf8"),
30048
30197
  fs11.readFile("/proc/sys/kernel/random/boot_id", "utf8")
30049
30198
  ]);
30050
- const fields = stat21.slice(stat21.lastIndexOf(")") + 1).trim().split(/\s+/);
30199
+ const fields = stat22.slice(stat22.lastIndexOf(")") + 1).trim().split(/\s+/);
30051
30200
  const startTicks = fields[19];
30052
30201
  if (!startTicks || !/^\d+$/.test(startTicks) || !/^[0-9a-f-]+$/i.test(bootId.trim())) {
30053
30202
  return null;
@@ -30125,22 +30274,46 @@ async function delay(ms2) {
30125
30274
  await new Promise((resolve38) => setTimeout(resolve38, ms2));
30126
30275
  }
30127
30276
  __name(delay, "delay");
30128
- function transcriptFingerprint(stat21) {
30277
+ function transcriptFingerprint(stat22) {
30129
30278
  return {
30130
- dev: stat21.dev,
30131
- ino: stat21.ino,
30132
- mode: stat21.mode,
30133
- uid: stat21.uid,
30134
- gid: stat21.gid,
30135
- nlink: stat21.nlink,
30136
- birthtimeMs: stat21.birthtimeMs,
30137
- ctimeMs: stat21.ctimeMs,
30138
- mtimeMs: stat21.mtimeMs
30279
+ dev: stat22.dev,
30280
+ ino: stat22.ino,
30281
+ mode: stat22.mode,
30282
+ uid: stat22.uid,
30283
+ gid: stat22.gid,
30284
+ nlink: stat22.nlink,
30285
+ birthtimeMs: stat22.birthtimeMs,
30286
+ ctimeMs: stat22.ctimeMs,
30287
+ mtimeMs: stat22.mtimeMs
30139
30288
  };
30140
30289
  }
30141
30290
  __name(transcriptFingerprint, "transcriptFingerprint");
30291
+ function assertVerifiableTranscriptIdentity(fingerprint2) {
30292
+ if (!hasVerifiableInode(fingerprint2.ino)) {
30293
+ throw new SessionTranscriptIdentityUnavailableError();
30294
+ }
30295
+ }
30296
+ __name(assertVerifiableTranscriptIdentity, "assertVerifiableTranscriptIdentity");
30297
+ async function assertTranscriptFilesystemProvidesIdentity(transcriptPath) {
30298
+ let dir = path11.dirname(transcriptPath);
30299
+ for (; ; ) {
30300
+ try {
30301
+ const stat22 = await fs11.stat(dir);
30302
+ assertVerifiableTranscriptIdentity({ ino: stat22.ino });
30303
+ return;
30304
+ } catch (error) {
30305
+ if (error instanceof SessionWriterError) throw error;
30306
+ const code = error.code;
30307
+ if (code !== "ENOENT" && code !== "ENOTDIR") return;
30308
+ const parent = path11.dirname(dir);
30309
+ if (parent === dir) return;
30310
+ dir = parent;
30311
+ }
30312
+ }
30313
+ }
30314
+ __name(assertTranscriptFilesystemProvidesIdentity, "assertTranscriptFilesystemProvidesIdentity");
30142
30315
  function sameFileIdentity2(left, right) {
30143
- return left.dev === right.dev && left.ino === right.ino;
30316
+ return left.ino !== 0 && right.ino !== 0 && left.dev === right.dev && left.ino === right.ino;
30144
30317
  }
30145
30318
  __name(sameFileIdentity2, "sameFileIdentity");
30146
30319
  function sameFileSecurityMetadata(left, right) {
@@ -30159,11 +30332,13 @@ function sameTranscriptState(left, right) {
30159
30332
  return sameHardTranscriptState(left, right) && left.fingerprint.birthtimeMs === right.fingerprint.birthtimeMs && left.fingerprint.ctimeMs === right.fingerprint.ctimeMs && left.fingerprint.mtimeMs === right.fingerprint.mtimeMs;
30160
30333
  }
30161
30334
  __name(sameTranscriptState, "sameTranscriptState");
30162
- function transcriptStateFromStat(stat21) {
30335
+ function transcriptStateFromStat(stat22) {
30336
+ const fingerprint2 = transcriptFingerprint(stat22);
30337
+ assertVerifiableTranscriptIdentity(fingerprint2);
30163
30338
  return {
30164
30339
  exists: true,
30165
- byteLength: stat21.size,
30166
- fingerprint: transcriptFingerprint(stat21)
30340
+ byteLength: stat22.size,
30341
+ fingerprint: fingerprint2
30167
30342
  };
30168
30343
  }
30169
30344
  __name(transcriptStateFromStat, "transcriptStateFromStat");
@@ -30255,20 +30430,20 @@ async function getOpenTranscriptState(filePath, handle, invalidPathIsChange) {
30255
30430
  }
30256
30431
  __name(getOpenTranscriptState, "getOpenTranscriptState");
30257
30432
  async function inspectTranscriptPath(filePath, invalidPathIsChange) {
30258
- let stat21;
30433
+ let stat22;
30259
30434
  try {
30260
- stat21 = await fs11.lstat(filePath);
30435
+ stat22 = await fs11.lstat(filePath);
30261
30436
  } catch (error) {
30262
30437
  if (error.code === "ENOENT") {
30263
30438
  return { exists: false, byteLength: 0 };
30264
30439
  }
30265
30440
  throw error;
30266
30441
  }
30267
- if (!stat21.isFile() || stat21.isSymbolicLink()) {
30442
+ if (!stat22.isFile() || stat22.isSymbolicLink()) {
30268
30443
  if (invalidPathIsChange) throw new SessionTranscriptChangedError();
30269
30444
  throw new SessionWriterUnavailableError();
30270
30445
  }
30271
- return transcriptStateFromStat(stat21);
30446
+ return transcriptStateFromStat(stat22);
30272
30447
  }
30273
30448
  __name(inspectTranscriptPath, "inspectTranscriptPath");
30274
30449
  async function openTranscriptForRead(filePath, expectedState) {
@@ -30467,15 +30642,10 @@ async function openTranscriptProof(filePath) {
30467
30642
  if (!beforeStat.isFile() || !pathStat.isFile() || pathStat.isSymbolicLink()) {
30468
30643
  throw new SessionWriterUnavailableError();
30469
30644
  }
30470
- const beforeState = {
30471
- exists: true,
30472
- byteLength: beforeStat.size,
30473
- fingerprint: transcriptFingerprint(beforeStat)
30474
- };
30475
- if (!sameFileIdentity2(
30476
- beforeState.fingerprint,
30477
- transcriptFingerprint(pathStat)
30478
- )) {
30645
+ const beforeState = transcriptStateFromStat(beforeStat);
30646
+ const beforePathFingerprint = transcriptFingerprint(pathStat);
30647
+ assertVerifiableTranscriptIdentity(beforePathFingerprint);
30648
+ if (!sameFileIdentity2(beforeState.fingerprint, beforePathFingerprint)) {
30479
30649
  throw new SessionTranscriptChangedError();
30480
30650
  }
30481
30651
  if (beforeStat.size > 0) {
@@ -30508,15 +30678,10 @@ async function openTranscriptProof(filePath) {
30508
30678
  handle.stat(),
30509
30679
  fs11.lstat(filePath)
30510
30680
  ]);
30511
- const afterState = {
30512
- exists: true,
30513
- byteLength: afterStat.size,
30514
- fingerprint: transcriptFingerprint(afterStat)
30515
- };
30516
- if (!sameTranscriptState(beforeState, afterState) || !afterPathStat.isFile() || afterPathStat.isSymbolicLink() || !sameFileIdentity2(
30517
- afterState.fingerprint,
30518
- transcriptFingerprint(afterPathStat)
30519
- )) {
30681
+ const afterState = transcriptStateFromStat(afterStat);
30682
+ const afterPathFingerprint = transcriptFingerprint(afterPathStat);
30683
+ assertVerifiableTranscriptIdentity(afterPathFingerprint);
30684
+ if (!sameTranscriptState(beforeState, afterState) || !afterPathStat.isFile() || afterPathStat.isSymbolicLink() || !sameFileIdentity2(afterState.fingerprint, afterPathFingerprint)) {
30520
30685
  throw new SessionTranscriptChangedError();
30521
30686
  }
30522
30687
  const proof = {
@@ -30555,12 +30720,10 @@ async function validateOpenTranscriptProof(filePath, proof) {
30555
30720
  if (!handleStat.isFile() || !pathStat.isFile() || pathStat.isSymbolicLink()) {
30556
30721
  throw new SessionWriterUnavailableError();
30557
30722
  }
30558
- const current = {
30559
- exists: true,
30560
- byteLength: handleStat.size,
30561
- fingerprint: transcriptFingerprint(handleStat)
30562
- };
30563
- if (!sameTranscriptState(current, proof.state) || !sameFileIdentity2(current.fingerprint, transcriptFingerprint(pathStat))) {
30723
+ const current = transcriptStateFromStat(handleStat);
30724
+ const pathFingerprint = transcriptFingerprint(pathStat);
30725
+ assertVerifiableTranscriptIdentity(pathFingerprint);
30726
+ if (!sameTranscriptState(current, proof.state) || !sameFileIdentity2(current.fingerprint, pathFingerprint)) {
30564
30727
  throw new SessionTranscriptChangedError();
30565
30728
  }
30566
30729
  } catch (error) {
@@ -30697,8 +30860,8 @@ async function removeExactRecord(candidatePath, expectedRaw) {
30697
30860
  __name(removeExactRecord, "removeExactRecord");
30698
30861
  async function inspectExactRecord(candidatePath, expectedRaw) {
30699
30862
  try {
30700
- const stat21 = await fs11.lstat(candidatePath);
30701
- if (!stat21.isFile() || stat21.isSymbolicLink()) return { state: "other" };
30863
+ const stat22 = await fs11.lstat(candidatePath);
30864
+ if (!stat22.isFile() || stat22.isSymbolicLink()) return { state: "other" };
30702
30865
  const raw = await fs11.readFile(candidatePath, "utf8");
30703
30866
  return { state: raw === expectedRaw ? "exact" : "other" };
30704
30867
  } catch (error) {
@@ -30752,8 +30915,8 @@ async function releaseTransitionClaim(claimPath, claimRaw) {
30752
30915
  __name(releaseTransitionClaim, "releaseTransitionClaim");
30753
30916
  async function inspectClaimedPrimary(lockPath, sourceRaw, sessionId) {
30754
30917
  try {
30755
- const stat21 = await fs11.lstat(lockPath);
30756
- if (!stat21.isFile() || stat21.isSymbolicLink()) return { state: "other" };
30918
+ const stat22 = await fs11.lstat(lockPath);
30919
+ if (!stat22.isFile() || stat22.isSymbolicLink()) return { state: "other" };
30757
30920
  const raw = await fs11.readFile(lockPath, "utf8");
30758
30921
  if (raw === sourceRaw) return { state: "source" };
30759
30922
  const record2 = parseLockRecord(raw);
@@ -31273,6 +31436,11 @@ var SessionWriterLease = class _SessionWriterLease {
31273
31436
  void 0,
31274
31437
  () => lease.released
31275
31438
  );
31439
+ if (!snapshot.state.exists) {
31440
+ await assertTranscriptFilesystemProvidesIdentity(
31441
+ options2.transcriptPath
31442
+ );
31443
+ }
31276
31444
  await lease.readOwnedLock();
31277
31445
  lease.expectedTranscriptState = snapshot.state;
31278
31446
  lease.expectedTranscriptHasher = snapshot.hasher;
@@ -31299,9 +31467,9 @@ var SessionWriterLease = class _SessionWriterLease {
31299
31467
  }
31300
31468
  static async inspectExistingLock(lockPath, expectedSessionId) {
31301
31469
  for (let attempt = 0; attempt < MALFORMED_RETRY_COUNT; attempt++) {
31302
- let stat21;
31470
+ let stat22;
31303
31471
  try {
31304
- stat21 = await fs11.lstat(lockPath);
31472
+ stat22 = await fs11.lstat(lockPath);
31305
31473
  } catch (error) {
31306
31474
  if (error.code === "ENOENT") {
31307
31475
  return { kind: "missing" };
@@ -31310,7 +31478,7 @@ var SessionWriterLease = class _SessionWriterLease {
31310
31478
  cause: error instanceof Error ? error : void 0
31311
31479
  });
31312
31480
  }
31313
- if (!stat21.isFile() || stat21.isSymbolicLink()) {
31481
+ if (!stat22.isFile() || stat22.isSymbolicLink()) {
31314
31482
  throw new SessionWriterUnavailableError({
31315
31483
  cause: new Error("Session writer lock is not a regular file")
31316
31484
  });
@@ -31346,16 +31514,16 @@ var SessionWriterLease = class _SessionWriterLease {
31346
31514
  }
31347
31515
  async readOwnedLock() {
31348
31516
  if (this.released) throw new SessionWriterLostError();
31349
- let stat21;
31517
+ let stat22;
31350
31518
  try {
31351
- stat21 = await fs11.lstat(this.lockPath);
31519
+ stat22 = await fs11.lstat(this.lockPath);
31352
31520
  } catch (error) {
31353
31521
  if (error.code === "ENOENT") {
31354
31522
  throw new SessionWriterLostError();
31355
31523
  }
31356
31524
  throw new SessionWriterUnavailableError();
31357
31525
  }
31358
- if (!stat21.isFile() || stat21.isSymbolicLink()) {
31526
+ if (!stat22.isFile() || stat22.isSymbolicLink()) {
31359
31527
  throw new SessionWriterLostError();
31360
31528
  }
31361
31529
  let raw;
@@ -31454,6 +31622,7 @@ var SessionWriterLease = class _SessionWriterLease {
31454
31622
  candidateHasher.update(bytes);
31455
31623
  const nextByteLength = expectedBefore.byteLength + bytes.byteLength;
31456
31624
  await this.readOwnedLock();
31625
+ assertVerifiableTranscriptIdentity(beforeState.fingerprint);
31457
31626
  await handle.writeFile(bytes);
31458
31627
  await handle.sync();
31459
31628
  const afterStat = await handle.stat();
@@ -31781,8 +31950,8 @@ var SessionWriterLease = class _SessionWriterLease {
31781
31950
  }
31782
31951
  async inspectReleasePath(candidatePath) {
31783
31952
  try {
31784
- const stat21 = await fs11.lstat(candidatePath);
31785
- if (!stat21.isFile() || stat21.isSymbolicLink()) return "other";
31953
+ const stat22 = await fs11.lstat(candidatePath);
31954
+ if (!stat22.isFile() || stat22.isSymbolicLink()) return "other";
31786
31955
  const raw = await fs11.readFile(candidatePath, "utf8");
31787
31956
  return raw === this.lockRecordRaw ? "owned" : "other";
31788
31957
  } catch (error) {
@@ -33476,7 +33645,8 @@ function getResumeTokenCounts(conversation) {
33476
33645
  if (candidate) {
33477
33646
  return {
33478
33647
  promptTokenCount: candidate,
33479
- outputTokenCount: getUsageOutputTokenCountForPromptEstimate(usage)
33648
+ outputTokenCount: getUsageOutputTokenCountForPromptEstimate(usage),
33649
+ isEstimated: false
33480
33650
  };
33481
33651
  }
33482
33652
  }
@@ -33485,7 +33655,11 @@ function getResumeTokenCounts(conversation) {
33485
33655
  if (payload?.info) {
33486
33656
  return {
33487
33657
  promptTokenCount: payload.info.newTokenCount,
33488
- outputTokenCount: 0
33658
+ outputTokenCount: 0,
33659
+ // Checkpoints created before provenance was persisted are safest to
33660
+ // treat as estimates: this keeps the output clamp's overhead pad on
33661
+ // and prevents an optimistic resume from overflowing the window.
33662
+ isEstimated: payload.info.newTokenCountIsEstimated ?? true
33489
33663
  };
33490
33664
  }
33491
33665
  }
@@ -35226,6 +35400,30 @@ var CompressionStatus = /* @__PURE__ */ ((CompressionStatus2) => {
35226
35400
  CompressionStatus2[CompressionStatus2["COMPRESSION_FAILED_OUTPUT_TRUNCATED"] = 6] = "COMPRESSION_FAILED_OUTPUT_TRUNCATED";
35227
35401
  return CompressionStatus2;
35228
35402
  })(CompressionStatus || {});
35403
+ function getDisplayContentParts(response) {
35404
+ const parts = response.candidates?.[0]?.content?.parts ?? [];
35405
+ const displayParts = [];
35406
+ for (const part of parts) {
35407
+ if (part.thought) {
35408
+ continue;
35409
+ }
35410
+ if (typeof part.text === "string" && part.text.length > 0) {
35411
+ displayParts.push({ text: part.text });
35412
+ }
35413
+ const inlineData = part.inlineData;
35414
+ if (inlineData?.mimeType?.trim().toLowerCase().startsWith("image/") && typeof inlineData.data === "string" && inlineData.data.length > 0) {
35415
+ displayParts.push({
35416
+ inlineData: {
35417
+ data: inlineData.data,
35418
+ mimeType: inlineData.mimeType,
35419
+ ...typeof inlineData.displayName === "string" ? { displayName: inlineData.displayName } : {}
35420
+ }
35421
+ });
35422
+ }
35423
+ }
35424
+ return displayParts;
35425
+ }
35426
+ __name(getDisplayContentParts, "getDisplayContentParts");
35229
35427
  var Turn = class {
35230
35428
  constructor(chat, prompt_id, goalContext) {
35231
35429
  this.chat = chat;
@@ -35303,9 +35501,15 @@ var Turn = class {
35303
35501
  value: thoughtSummary
35304
35502
  };
35305
35503
  }
35306
- const text = getResponseText(resp);
35307
- if (text) {
35308
- yield { type: "content" /* Content */, value: text };
35504
+ const text = getResponseText(resp) ?? "";
35505
+ const displayParts = getDisplayContentParts(resp);
35506
+ const hasImage = displayParts.some((part) => "inlineData" in part);
35507
+ if (text || hasImage) {
35508
+ yield {
35509
+ type: "content" /* Content */,
35510
+ value: text,
35511
+ ...hasImage ? { parts: displayParts } : {}
35512
+ };
35309
35513
  }
35310
35514
  const functionCalls = resp.functionCalls ?? [];
35311
35515
  for (const fnCall of functionCalls) {
@@ -35409,18 +35613,9 @@ function getCitations(resp) {
35409
35613
  }
35410
35614
  __name(getCitations, "getCitations");
35411
35615
 
35412
- // packages/core/src/core/openaiContentGenerator/prefix-caching.ts
35413
- init_esbuild_shims();
35414
- function supportsOpenAIPrefixCaching(contentGeneratorConfig) {
35415
- return DashScopeOpenAICompatibleProvider.isDashScopeProvider(
35416
- contentGeneratorConfig
35417
- );
35418
- }
35419
- __name(supportsOpenAIPrefixCaching, "supportsOpenAIPrefixCaching");
35420
-
35421
35616
  // packages/core/src/services/postCompactAttachments.ts
35422
35617
  init_esbuild_shims();
35423
- import { readFile as readFile7, stat as stat4 } from "node:fs/promises";
35618
+ import { readFile as readFile7, stat as stat5 } from "node:fs/promises";
35424
35619
  import { realpathSync } from "node:fs";
35425
35620
  import { resolve as resolvePath2, sep as pathSep } from "node:path";
35426
35621
  var POST_COMPACT_MAX_FILES_TO_RESTORE = 5;
@@ -35555,7 +35750,7 @@ async function readFileSizeAdaptive(filePath, maxTokens, signal) {
35555
35750
  if (signal?.aborted) return { kind: "missing" };
35556
35751
  const maxChars = maxTokens * CHARS_PER_TOKEN;
35557
35752
  try {
35558
- const { size } = await stat4(filePath);
35753
+ const { size } = await stat5(filePath);
35559
35754
  if (size > maxChars * 4) return { kind: "reference" };
35560
35755
  } catch {
35561
35756
  return { kind: "missing" };
@@ -35879,9 +36074,12 @@ ${parts.join("\n\n")}`;
35879
36074
  __name(buildCompressionSystemPrompt, "buildCompressionSystemPrompt");
35880
36075
  function supportsCompressionCacheSharing(config) {
35881
36076
  const provider = config.getContentGeneratorConfig();
36077
+ if (provider.authType === "gemini" /* USE_GEMINI */ || provider.authType === "vertex-ai" /* USE_VERTEX_AI */) {
36078
+ return true;
36079
+ }
35882
36080
  if (provider.enableCacheControl === false) return false;
35883
36081
  if (provider.authType === "anthropic" /* USE_ANTHROPIC */) return true;
35884
- return (provider.authType === "qwen-oauth" /* QWEN_OAUTH */ || provider.authType === "openai" /* USE_OPENAI */) && supportsOpenAIPrefixCaching(provider);
36082
+ return supportsOpenAIPrefixCaching(provider);
35885
36083
  }
35886
36084
  __name(supportsCompressionCacheSharing, "supportsCompressionCacheSharing");
35887
36085
  function hasStateSnapshot(summary) {
@@ -36093,11 +36291,11 @@ Do not call tools; tool execution is disabled for this request. ` + COMPRESSION_
36093
36291
  );
36094
36292
  const usesMainModel = effectiveCompactionModel === config.getModel();
36095
36293
  const providerSupportsCacheSharing = supportsCompressionCacheSharing(config);
36096
- const hasProviderTokenCount = (chat.getLastPromptTokenCount?.() ?? 0) > 0;
36294
+ const hasProviderTokenCount = (chat.getLastPromptTokenCount?.() ?? 0) > 0 && chat.isLastPromptTokenCountEstimated?.() !== true;
36097
36295
  const sharedRequestFits = sharedPromptTokenCount + sharedDirectiveTokenCount + COMPACT_MAX_OUTPUT_TOKENS <= contextLimit;
36098
36296
  const canShareCache = usesMainModel && providerSupportsCacheSharing && hasProviderTokenCount && sharedRequestFits;
36099
36297
  if (!canShareCache) {
36100
- const reason = !usesMainModel ? "distinct compaction model" : !providerSupportsCacheSharing ? "provider does not support cache sharing" : !hasProviderTokenCount ? "no provider token-count anchor" : `shared request exceeds context window: prompt=${sharedPromptTokenCount}, directive=${sharedDirectiveTokenCount}, reserve=${COMPACT_MAX_OUTPUT_TOKENS}, window=${contextLimit}`;
36298
+ const reason = !usesMainModel ? "distinct compaction model" : !providerSupportsCacheSharing ? "provider does not support cache sharing" : !hasProviderTokenCount ? "no provider-reported token-count anchor" : `shared request exceeds context window: prompt=${sharedPromptTokenCount}, directive=${sharedDirectiveTokenCount}, reserve=${COMPACT_MAX_OUTPUT_TOKENS}, window=${contextLimit}`;
36101
36299
  debugLogger20.debug(`[compaction] skipping cache sharing: ${reason}`);
36102
36300
  }
36103
36301
  if (canShareCache) {
@@ -36109,6 +36307,7 @@ Do not call tools; tool execution is disabled for this request. ` + COMPRESSION_
36109
36307
  const mainSystemInstruction = generationConfig.systemInstruction;
36110
36308
  delete generationConfig.systemInstruction;
36111
36309
  delete generationConfig.abortSignal;
36310
+ const authType = config.getContentGeneratorConfig().authType;
36112
36311
  const sharedResult = await config.getBaseLlmClient().generateText({
36113
36312
  contents: [
36114
36313
  ...sideQueryHistory,
@@ -36125,7 +36324,7 @@ Do not call tools; tool execution is disabled for this request. ` + COMPRESSION_
36125
36324
  systemInstruction: mainSystemInstruction,
36126
36325
  config: {
36127
36326
  ...generationConfig,
36128
- ...contentGeneratorConfig.authType === "anthropic" /* USE_ANTHROPIC */ ? {
36327
+ ...authType === "anthropic" /* USE_ANTHROPIC */ ? {
36129
36328
  thinkingConfig: {
36130
36329
  ...generationConfig.thinkingConfig,
36131
36330
  // Manual Anthropic thinking requires budget_tokens to be
@@ -36133,13 +36332,19 @@ Do not call tools; tool execution is disabled for this request. ` + COMPRESSION_
36133
36332
  // compatibility while keeping this bounded request valid.
36134
36333
  thinkingBudget: COMPACT_MAX_OUTPUT_TOKENS - 1
36135
36334
  }
36335
+ } : authType === "gemini" /* USE_GEMINI */ || authType === "vertex-ai" /* USE_VERTEX_AI */ ? {
36336
+ thinkingConfig: {
36337
+ ...generationConfig.thinkingConfig,
36338
+ includeThoughts: false
36339
+ }
36136
36340
  } : {},
36137
36341
  maxOutputTokens: COMPACT_MAX_OUTPUT_TOKENS
36138
36342
  },
36139
36343
  abortSignal,
36140
36344
  promptId,
36141
36345
  stream: true,
36142
- maxAttempts: 1
36346
+ maxAttempts: 1,
36347
+ promptCacheSharing: true
36143
36348
  });
36144
36349
  if (!sharedResult.hadToolCall && hasStateSnapshot(sharedResult.text)) {
36145
36350
  summaryResult = sharedResult;
@@ -36337,6 +36542,7 @@ Do not call tools; tool execution is disabled for this request. ` + COMPRESSION_
36337
36542
  info: {
36338
36543
  originalTokenCount,
36339
36544
  newTokenCount,
36545
+ newTokenCountIsEstimated: true,
36340
36546
  compressionStatus: 1 /* COMPRESSED */,
36341
36547
  triggerReason,
36342
36548
  ...compactionWarning && { warning: compactionWarning }
@@ -37037,7 +37243,7 @@ function syncFunctionCallsField(response, parts) {
37037
37243
  __name(syncFunctionCallsField, "syncFunctionCallsField");
37038
37244
  function canonicalPlanToolName(toolName) {
37039
37245
  if (!toolName) return "";
37040
- return ToolNamesMigration[toolName] ?? toolName;
37246
+ return canonicalToolName(toolName);
37041
37247
  }
37042
37248
  __name(canonicalPlanToolName, "canonicalPlanToolName");
37043
37249
  function approvedPlanRedactionText(planPath) {
@@ -37149,7 +37355,7 @@ var TRANSPORT_STREAM_RETRY_CONFIG = {
37149
37355
  */
37150
37356
  maxContinuationRetries: 3
37151
37357
  };
37152
- var FIRST_SEND_CLAMP_OVERHEAD_PAD = 2e4;
37358
+ var ESTIMATE_CLAMP_OVERHEAD_PAD = 2e4;
37153
37359
  var MAX_OUTPUT_RECOVERY_ATTEMPTS = 3;
37154
37360
  var RECOVERY_RESUME_INSTRUCTION = "Resume directly \u2014 no apology, no recap of what you were doing. Pick up mid-thought if that is where the cut happened. Break remaining work into smaller pieces.";
37155
37361
  var OUTPUT_RECOVERY_MESSAGE = `Output token limit hit. ${RECOVERY_RESUME_INSTRUCTION}`;
@@ -37253,6 +37459,10 @@ ${suffix}`;
37253
37459
  return continuationText;
37254
37460
  }
37255
37461
  __name(getRecoveryContinuationSuffix, "getRecoveryContinuationSuffix");
37462
+ function mergeDeliveredPrefix(deliveredText, continuationText) {
37463
+ return deliveredText + getRecoveryContinuationSuffix(deliveredText, continuationText);
37464
+ }
37465
+ __name(mergeDeliveredPrefix, "mergeDeliveredPrefix");
37256
37466
  function isPlainTextPart(part) {
37257
37467
  return part !== void 0 && isValidNonThoughtTextPart(part);
37258
37468
  }
@@ -37754,6 +37964,7 @@ var GeminiChat = class {
37754
37964
  * still make compaction decisions based on their *own* context size.
37755
37965
  */
37756
37966
  lastPromptTokenCount = 0;
37967
+ lastPromptTokenCountIsEstimated = false;
37757
37968
  /**
37758
37969
  * Per-chat output-token count from the previous model response. The
37759
37970
  * previous response is appended to local history after `promptTokenCount`
@@ -37902,18 +38113,26 @@ var GeminiChat = class {
37902
38113
  * comes from a different chat instance and should not inherit this chat's
37903
38114
  * last response size.
37904
38115
  */
37905
- setLastPromptTokenCount(count) {
38116
+ setLastPromptTokenCount(count, isEstimated = false) {
37906
38117
  this.lastPromptTokenCount = count;
38118
+ this.lastPromptTokenCountIsEstimated = isEstimated;
37907
38119
  this.lastOutputTokenCount = 0;
37908
38120
  }
38121
+ isLastPromptTokenCountEstimated() {
38122
+ return this.lastPromptTokenCountIsEstimated;
38123
+ }
38124
+ promptCountIsEstimateDerived() {
38125
+ return this.lastPromptTokenCount === 0 || this.lastPromptTokenCountIsEstimated;
38126
+ }
37909
38127
  /**
37910
38128
  * Seed the restored prompt and previous-response output token counts in one
37911
- * step. Resume restores chat history plus both counters from the same
37912
- * assistant usage record, so callers must avoid the normal
38129
+ * step. Resume restores chat history plus both counters and their provenance
38130
+ * from the same checkpoint, so callers must avoid the normal
37913
38131
  * setLastPromptTokenCount() clearing behavior.
37914
38132
  */
37915
- seedResumeTokenCounts(promptTokenCount, outputTokenCount) {
38133
+ seedResumeTokenCounts(promptTokenCount, outputTokenCount, isEstimated = false) {
37916
38134
  this.lastPromptTokenCount = Number.isFinite(promptTokenCount) ? Math.max(0, promptTokenCount) : 0;
38135
+ this.lastPromptTokenCountIsEstimated = isEstimated;
37917
38136
  this.lastOutputTokenCount = Number.isFinite(outputTokenCount) ? Math.max(0, outputTokenCount) : 0;
37918
38137
  }
37919
38138
  /**
@@ -37928,13 +38147,21 @@ var GeminiChat = class {
37928
38147
  * post-compression guards pass.
37929
38148
  */
37930
38149
  async tryCompress(promptId, force = false, signal, options2) {
38150
+ const originalTokenCountIsEstimated = options2?.originalTokenCountOverride === void 0 && this.promptCountIsEstimateDerived();
38151
+ const originalTokenCount = originalTokenCountIsEstimated ? options2?.precomputedEffectiveTokens ?? estimateContentTokens(
38152
+ options2?.pendingUserMessage ? [...this.getHistoryShallow(true), options2.pendingUserMessage] : this.getHistoryShallow(true),
38153
+ resolveSlimmingConfig(this.config.getChatCompression()).imageTokenEstimate
38154
+ ) : options2?.originalTokenCountOverride ?? this.lastPromptTokenCount;
38155
+ debugLogger22.debug(
38156
+ `[compaction] token-count provenance: prompt_id=${promptId}, originalTokenCount=${originalTokenCount}, estimated=${originalTokenCountIsEstimated}`
38157
+ );
37931
38158
  const service = new ChatCompressionService();
37932
38159
  const { newHistory, info } = await service.compress(this, {
37933
38160
  promptId,
37934
38161
  force,
37935
38162
  config: this.config,
37936
38163
  consecutiveFailures: this.consecutiveFailures,
37937
- originalTokenCount: options2?.originalTokenCountOverride ?? this.lastPromptTokenCount,
38164
+ originalTokenCount,
37938
38165
  pendingUserMessage: options2?.pendingUserMessage,
37939
38166
  precomputedEffectiveTokens: options2?.precomputedEffectiveTokens,
37940
38167
  requestGenerationConfig: options2?.requestGenerationConfig,
@@ -37943,6 +38170,7 @@ var GeminiChat = class {
37943
38170
  signal
37944
38171
  });
37945
38172
  if (info.compressionStatus === 1 /* COMPRESSED */ && newHistory) {
38173
+ info.newTokenCountIsEstimated ??= true;
37946
38174
  if (!options2?.deferChatCompressionRecord) {
37947
38175
  this.chatRecordingService?.recordChatCompression({
37948
38176
  info,
@@ -37952,8 +38180,10 @@ var GeminiChat = class {
37952
38180
  this.setHistory(newHistory);
37953
38181
  debugLogger22.debug("[FILE_READ_CACHE] clear after auto tryCompress");
37954
38182
  this.config.getFileReadCache().clear();
37955
- this.lastPromptTokenCount = info.newTokenCount;
37956
- this.lastOutputTokenCount = 0;
38183
+ this.setLastPromptTokenCount(
38184
+ info.newTokenCount,
38185
+ info.newTokenCountIsEstimated
38186
+ );
37957
38187
  this.telemetryService?.setLastPromptTokenCount(info.newTokenCount);
37958
38188
  this.consecutiveFailures = 0;
37959
38189
  this.hardRescueFailureCount = 0;
@@ -38003,10 +38233,15 @@ var GeminiChat = class {
38003
38233
  }
38004
38234
  const reduction = beforeEstimate - afterEstimate;
38005
38235
  const apiBaseline = this.lastPromptTokenCount || beforeEstimate;
38236
+ const baselineIsEstimated = this.promptCountIsEstimateDerived();
38006
38237
  const adjustedTokenCount = Math.max(0, apiBaseline - reduction);
38238
+ debugLogger22.debug(
38239
+ `[compaction] fast token-count provenance: originalTokenCount=${apiBaseline}, estimated=${baselineIsEstimated}`
38240
+ );
38007
38241
  const info = {
38008
38242
  originalTokenCount: apiBaseline,
38009
38243
  newTokenCount: adjustedTokenCount,
38244
+ newTokenCountIsEstimated: true,
38010
38245
  compressionStatus: 1 /* COMPRESSED */,
38011
38246
  triggerReason: "manual"
38012
38247
  };
@@ -38023,6 +38258,7 @@ var GeminiChat = class {
38023
38258
  );
38024
38259
  this.setHistory(newHistory);
38025
38260
  this.lastPromptTokenCount = adjustedTokenCount;
38261
+ this.lastPromptTokenCountIsEstimated = true;
38026
38262
  this.telemetryService?.setLastPromptTokenCount(adjustedTokenCount);
38027
38263
  this.consecutiveFailures = 0;
38028
38264
  return { info, microcompactMeta: mcMeta };
@@ -38143,6 +38379,7 @@ var GeminiChat = class {
38143
38379
  const shouldForceFromHard = !exactRoute && isHardTier && this.hardRescueFailureCount < MAX_CONSECUTIVE_FAILURES;
38144
38380
  const historyBeforeHardRescue = shouldForceFromHard ? this.getHistoryShallow() : void 0;
38145
38381
  const lastPromptTokenCountBeforeHardRescue = this.lastPromptTokenCount;
38382
+ const lastPromptTokenCountWasEstimatedBeforeHardRescue = this.lastPromptTokenCountIsEstimated;
38146
38383
  const hardRescueFailureCountBeforeHardRescue = this.hardRescueFailureCount;
38147
38384
  if (shouldForceFromHard) {
38148
38385
  debugLogger22.warn(
@@ -38202,6 +38439,7 @@ var GeminiChat = class {
38202
38439
  if (compressionInfo.compressionStatus === 1 /* COMPRESSED */ && historyBeforeHardRescue) {
38203
38440
  this.setHistory(historyBeforeHardRescue);
38204
38441
  this.lastPromptTokenCount = lastPromptTokenCountBeforeHardRescue;
38442
+ this.lastPromptTokenCountIsEstimated = lastPromptTokenCountWasEstimatedBeforeHardRescue;
38205
38443
  this.telemetryService?.setLastPromptTokenCount(
38206
38444
  lastPromptTokenCountBeforeHardRescue
38207
38445
  );
@@ -38263,7 +38501,13 @@ var GeminiChat = class {
38263
38501
  imageTokenEstimate,
38264
38502
  /* conservative= */
38265
38503
  true
38266
- ) : effectiveTokens + FIRST_SEND_CLAMP_OVERHEAD_PAD;
38504
+ ) : effectiveTokens;
38505
+ if (this.promptCountIsEstimateDerived()) {
38506
+ promptTokensForClamp += ESTIMATE_CLAMP_OVERHEAD_PAD;
38507
+ debugLogger22.debug(
38508
+ `[clamp] estimate-derived prompt count; padded by ${ESTIMATE_CLAMP_OVERHEAD_PAD}: promptTokensForClamp=${promptTokensForClamp}, count=${this.lastPromptTokenCount}`
38509
+ );
38510
+ }
38267
38511
  const clampedMaxOutputTokens = clampOutputTokensToWindow(
38268
38512
  outputCeiling,
38269
38513
  contextWindowForClamp,
@@ -38384,7 +38628,11 @@ var GeminiChat = class {
38384
38628
  params,
38385
38629
  prompt_id,
38386
38630
  requestOverrides,
38387
- turnGoalContext
38631
+ turnGoalContext,
38632
+ // Captured by value, so the attempt records exactly the prefix
38633
+ // `buildAttemptContents()` just asked the model to resume from,
38634
+ // even if a later branch resets the continuation.
38635
+ transportContinuationPrefix.length > 0 ? transportContinuationPrefix : void 0
38388
38636
  );
38389
38637
  lastFinishReason = void 0;
38390
38638
  for await (const chunk of stream2) {
@@ -38405,10 +38653,7 @@ var GeminiChat = class {
38405
38653
  yield { type: "chunk" /* CHUNK */, value: chunk };
38406
38654
  }
38407
38655
  lastError = null;
38408
- if (transportContinuationPrefix.length > 0) {
38409
- self2.prependTextToLastModelTurn(transportContinuationPrefix);
38410
- transportContinuationPrefix = "";
38411
- }
38656
+ transportContinuationPrefix = "";
38412
38657
  break;
38413
38658
  } catch (error) {
38414
38659
  lastError = error;
@@ -38816,7 +39061,7 @@ var GeminiChat = class {
38816
39061
  const walkRecoveryEstimate = estimateContentTokens(
38817
39062
  recoveryContents,
38818
39063
  recoveryImageTokenEstimate
38819
- ) + FIRST_SEND_CLAMP_OVERHEAD_PAD;
39064
+ ) + ESTIMATE_CLAMP_OVERHEAD_PAD;
38820
39065
  const recoveryPromptEstimate = Math.max(
38821
39066
  countBasedRecoveryEstimate,
38822
39067
  walkRecoveryEstimate
@@ -39063,7 +39308,7 @@ var GeminiChat = class {
39063
39308
  * by the fallback chain to call alternative models without duplicating
39064
39309
  * the retry wiring.
39065
39310
  */
39066
- async makeApiCallAndProcessStream(model, requestContents, params, prompt_id, overrides, goalContext) {
39311
+ async makeApiCallAndProcessStream(model, requestContents, params, prompt_id, overrides, goalContext, transportContinuationPrefix) {
39067
39312
  const generator = overrides?.contentGenerator ?? this.config.getContentGenerator();
39068
39313
  const apiCall = /* @__PURE__ */ __name(() => generator.generateContentStream(
39069
39314
  {
@@ -39120,7 +39365,12 @@ var GeminiChat = class {
39120
39365
  );
39121
39366
  }, "onRetry")
39122
39367
  });
39123
- return this.processStreamResponse(model, streamResponse, goalContext);
39368
+ return this.processStreamResponse(
39369
+ model,
39370
+ streamResponse,
39371
+ goalContext,
39372
+ transportContinuationPrefix
39373
+ );
39124
39374
  }
39125
39375
  async *makeFallbackStream(model, requestContents, params, prompt_id, contentGenerator, retryAuthType, retryErrorCodes, goalContext) {
39126
39376
  const stream2 = await this.makeApiCallAndProcessStream(
@@ -39441,7 +39691,15 @@ This error was probably caused by cyclic schema references in one of the followi
39441
39691
  }
39442
39692
  }
39443
39693
  }
39444
- async *processStreamResponse(model, streamResponse, goalContext) {
39694
+ /**
39695
+ * @param transportContinuationPrefix - Text a previous attempt already
39696
+ * delivered before a socket cut, which this attempt was asked to resume
39697
+ * from (issue #7832). On success it is folded into the response parts
39698
+ * before either durable write, so the JSONL transcript and in-memory
39699
+ * history carry the same merged turn (issue #8094). Undefined on every
39700
+ * non-continuation send.
39701
+ */
39702
+ async *processStreamResponse(model, streamResponse, goalContext, transportContinuationPrefix) {
39445
39703
  const allModelParts = [];
39446
39704
  const usedToolCallIds = collectToolCallIdsFromHistory(this.history);
39447
39705
  const rawToolCallIdsInCurrentTurn = /* @__PURE__ */ new Set();
@@ -39589,6 +39847,7 @@ This error was probably caused by cyclic schema references in one of the followi
39589
39847
  const lastPromptTokenCount = hasUsablePromptTokenCount ? promptTokenCount : totalTokenCount;
39590
39848
  if (lastPromptTokenCount) {
39591
39849
  this.lastPromptTokenCount = lastPromptTokenCount;
39850
+ this.lastPromptTokenCountIsEstimated = false;
39592
39851
  this.lastOutputTokenCount = hasUsablePromptTokenCount ? getUsageOutputTokenCountForPromptEstimate({
39593
39852
  promptTokenCount,
39594
39853
  ...hasUsableTotalTokenCount ? { totalTokenCount } : {},
@@ -39738,6 +39997,22 @@ This error was probably caused by cyclic schema references in one of the followi
39738
39997
  yield recoveredChunk;
39739
39998
  }
39740
39999
  const willPersistToHistory = streamError === null || hasToolCall && (thoughtContentPart || consolidatedHistoryParts.length > 0);
40000
+ if (streamError === null && transportContinuationPrefix) {
40001
+ const textIndex = consolidatedHistoryParts.findIndex(isPlainTextPart);
40002
+ if (textIndex < 0) {
40003
+ consolidatedHistoryParts.unshift({ text: transportContinuationPrefix });
40004
+ } else {
40005
+ const remainderPart = consolidatedHistoryParts[textIndex];
40006
+ consolidatedHistoryParts[textIndex] = {
40007
+ ...remainderPart,
40008
+ text: mergeDeliveredPrefix(
40009
+ transportContinuationPrefix,
40010
+ remainderPart.text
40011
+ )
40012
+ };
40013
+ }
40014
+ contentText = consolidatedHistoryParts.filter((part) => part.text).map((part) => part.text).join("").trim();
40015
+ }
39741
40016
  if (willPersistToHistory && (thoughtContentPart || contentText || hasToolCall || usageMetadata)) {
39742
40017
  const contextWindowSize = this.config.getContentGeneratorConfig()?.contextWindowSize;
39743
40018
  const recordArgs = {
@@ -39789,49 +40064,6 @@ This error was probably caused by cyclic schema references in one of the followi
39789
40064
  };
39790
40065
  }
39791
40066
  }
39792
- /**
39793
- * Prepend already-delivered text to the trailing model turn.
39794
- *
39795
- * Used by the transport-continuation path (issue #7832): after a socket cut
39796
- * mid-response, the caller has seen text that `processStreamResponse`
39797
- * deliberately did not persist, and the continuation attempt's own turn
39798
- * carries only the resumed remainder. Without this, durable history would
39799
- * hold an answer that starts mid-sentence — visibly wrong on `/compress`,
39800
- * `--resume`, and every later turn's context.
39801
- *
39802
- * The delivered text is merged into the turn's first plain-text part (kept
39803
- * after any leading thought part, matching the
39804
- * `[thoughtPart?, ...text]` shape `processStreamResponse` produces), or
39805
- * inserted as a new part when the continuation returned no text of its own.
39806
- * Overlap is deduped by the same helper the output-recovery merge uses, so a
39807
- * model that replays part of its previous tail does not double it.
39808
- */
39809
- prependTextToLastModelTurn(deliveredText) {
39810
- if (deliveredText.length === 0) return;
39811
- const lastEntry = this.history.at(-1);
39812
- if (lastEntry?.role !== "model") {
39813
- debugLogger22.warn(
39814
- "[TRANSPORT_CONTINUATION] Trailing entry is not a model turn; dropping the delivered-text merge.",
39815
- { role: lastEntry?.role ?? "undefined" }
39816
- );
39817
- return;
39818
- }
39819
- const parts = [...lastEntry.parts ?? []];
39820
- const textIndex = parts.findIndex(isPlainTextPart);
39821
- if (textIndex < 0) {
39822
- const insertAt = parts.findIndex((part) => !part.thought);
39823
- parts.splice(insertAt < 0 ? parts.length : insertAt, 0, {
39824
- text: deliveredText
39825
- });
39826
- } else {
39827
- const continuationPart = parts[textIndex];
39828
- parts[textIndex] = {
39829
- ...continuationPart,
39830
- text: deliveredText + getRecoveryContinuationSuffix(deliveredText, continuationPart.text)
39831
- };
39832
- }
39833
- lastEntry.parts = parts;
39834
- }
39835
40067
  /**
39836
40068
  * Merge `pairCount` trailing (user_recovery, model_continuation) pairs back
39837
40069
  * into the model turn that precedes them. Used after the output-token
@@ -39903,6 +40135,19 @@ function canonicalizeForHash(value) {
39903
40135
  return value;
39904
40136
  }
39905
40137
  __name(canonicalizeForHash, "canonicalizeForHash");
40138
+ function getToolCallRepeatKey(toolName, args) {
40139
+ const argsString = JSON.stringify(canonicalizeForHash(args));
40140
+ const keyString = `${canonicalToolName(toolName)}:${argsString}`;
40141
+ return createHash5("sha256").update(keyString).digest("hex");
40142
+ }
40143
+ __name(getToolCallRepeatKey, "getToolCallRepeatKey");
40144
+ function shouldHaltOnTurnToolCallCap(totalCalls, maxKeyRepeat, cap, isExplicitCap) {
40145
+ if (totalCalls <= cap) return false;
40146
+ const hardCap = cap * ADAPTIVE_CAP_HARD_MULTIPLIER;
40147
+ const stuck = maxKeyRepeat >= GLOBAL_DUPLICATE_THRESHOLD;
40148
+ return isExplicitCap || totalCalls > hardCap || stuck;
40149
+ }
40150
+ __name(shouldHaltOnTurnToolCallCap, "shouldHaltOnTurnToolCallCap");
39906
40151
  var LoopDetectionService = class _LoopDetectionService {
39907
40152
  static {
39908
40153
  __name(this, "LoopDetectionService");
@@ -39994,9 +40239,7 @@ var LoopDetectionService = class _LoopDetectionService {
39994
40239
  );
39995
40240
  }
39996
40241
  getToolCallKey(toolCall) {
39997
- const argsString = JSON.stringify(canonicalizeForHash(toolCall.args));
39998
- const keyString = `${toolCall.name}:${argsString}`;
39999
- return createHash5("sha256").update(keyString).digest("hex");
40242
+ return getToolCallRepeatKey(toolCall.name, toolCall.args);
40000
40243
  }
40001
40244
  /**
40002
40245
  * Convenience aggregate that runs every tier in order: the always-on
@@ -40456,22 +40699,20 @@ var LoopDetectionService = class _LoopDetectionService {
40456
40699
  */
40457
40700
  checkTurnToolCallCap() {
40458
40701
  this.turnToolCallTotal++;
40459
- const cap = this.config.getMaxToolCallsPerTurn();
40460
- if (this.turnToolCallTotal <= cap) {
40702
+ if (!shouldHaltOnTurnToolCallCap(
40703
+ this.turnToolCallTotal,
40704
+ this.capMaxKeyRepeat,
40705
+ this.config.getMaxToolCallsPerTurn(),
40706
+ this.config.isMaxToolCallsPerTurnExplicit()
40707
+ )) {
40461
40708
  return false;
40462
40709
  }
40463
- const explicitHardCap = this.config.isMaxToolCallsPerTurnExplicit();
40464
- const hardCap = cap * ADAPTIVE_CAP_HARD_MULTIPLIER;
40465
- const stuck = this.capMaxKeyRepeat >= GLOBAL_DUPLICATE_THRESHOLD;
40466
- if (explicitHardCap || this.turnToolCallTotal > hardCap || stuck) {
40467
- this.lastLoopType = "turn_tool_call_cap" /* TURN_TOOL_CALL_CAP */;
40468
- logLoopDetected(
40469
- this.config,
40470
- new LoopDetectedEvent("turn_tool_call_cap" /* TURN_TOOL_CALL_CAP */, this.promptId)
40471
- );
40472
- return true;
40473
- }
40474
- return false;
40710
+ this.lastLoopType = "turn_tool_call_cap" /* TURN_TOOL_CALL_CAP */;
40711
+ logLoopDetected(
40712
+ this.config,
40713
+ new LoopDetectedEvent("turn_tool_call_cap" /* TURN_TOOL_CALL_CAP */, this.promptId)
40714
+ );
40715
+ return true;
40475
40716
  }
40476
40717
  /**
40477
40718
  * Non-consecutive global duplicate detection: the SAME (tool, args) pair
@@ -41747,14 +41988,14 @@ function resolveToolName(rawName) {
41747
41988
  return TOOL_NAME_ALIASES[rawName] ?? rawName;
41748
41989
  }
41749
41990
  __name(resolveToolName, "resolveToolName");
41750
- function getSpecifierKind(canonicalToolName3) {
41751
- if (SHELL_TOOL_NAMES.has(canonicalToolName3)) {
41991
+ function getSpecifierKind(canonicalToolName2) {
41992
+ if (SHELL_TOOL_NAMES.has(canonicalToolName2)) {
41752
41993
  return "command";
41753
41994
  }
41754
- if (READ_TOOLS.has(canonicalToolName3) || EDIT_TOOLS.has(canonicalToolName3)) {
41995
+ if (READ_TOOLS.has(canonicalToolName2) || EDIT_TOOLS.has(canonicalToolName2)) {
41755
41996
  return "path";
41756
41997
  }
41757
- if (WEBFETCH_TOOLS.has(canonicalToolName3)) {
41998
+ if (WEBFETCH_TOOLS.has(canonicalToolName2)) {
41758
41999
  return "domain";
41759
42000
  }
41760
42001
  return "literal";
@@ -41881,8 +42122,8 @@ var CANONICAL_TO_RULE_DISPLAY = {
41881
42122
  exit_plan_mode: "ExitPlanMode",
41882
42123
  enter_plan_mode: "EnterPlanMode"
41883
42124
  };
41884
- function getRuleDisplayName(canonicalToolName3) {
41885
- return CANONICAL_TO_RULE_DISPLAY[canonicalToolName3] ?? canonicalToolName3;
42125
+ function getRuleDisplayName(canonicalToolName2) {
42126
+ return CANONICAL_TO_RULE_DISPLAY[canonicalToolName2] ?? canonicalToolName2;
41886
42127
  }
41887
42128
  __name(getRuleDisplayName, "getRuleDisplayName");
41888
42129
  var FILE_TARGETED_TOOLS = /* @__PURE__ */ new Set([
@@ -58724,7 +58965,7 @@ var HybridTokenStorage = class extends BaseTokenStorage {
58724
58965
  const forceFileStorage = process.env[FORCE_FILE_STORAGE_ENV_VAR] === "true";
58725
58966
  if (!forceFileStorage) {
58726
58967
  try {
58727
- const { KeychainTokenStorage: KeychainTokenStorage2 } = await import("./keychain-token-storage-7BT4TQ2A.js");
58968
+ const { KeychainTokenStorage: KeychainTokenStorage2 } = await import("./keychain-token-storage-TVAMTNP7.js");
58728
58969
  const keychainStorage = new KeychainTokenStorage2(this.serviceName);
58729
58970
  const isAvailable = await keychainStorage.isAvailable();
58730
58971
  if (isAvailable) {
@@ -64086,16 +64327,6 @@ var ToolRegistry = class _ToolRegistry {
64086
64327
  }
64087
64328
  };
64088
64329
 
64089
- // packages/core/src/tools/mcp-transport-pool.ts
64090
- init_esbuild_shims();
64091
-
64092
- // packages/core/src/tools/mcp-pool-entry.ts
64093
- init_esbuild_shims();
64094
- import { EventEmitter } from "node:events";
64095
-
64096
- // packages/core/src/tools/mcp-pool-events.ts
64097
- init_esbuild_shims();
64098
-
64099
64330
  // packages/core/src/tools/mcp-discovery-timeout.ts
64100
64331
  init_esbuild_shims();
64101
64332
  var MIN_DISCOVERY_TIMEOUT_MS = 100;
@@ -64138,6 +64369,16 @@ function runWithTimeout(task, timeoutMs, label) {
64138
64369
  }
64139
64370
  __name(runWithTimeout, "runWithTimeout");
64140
64371
 
64372
+ // packages/core/src/tools/mcp-transport-pool.ts
64373
+ init_esbuild_shims();
64374
+
64375
+ // packages/core/src/tools/mcp-pool-entry.ts
64376
+ init_esbuild_shims();
64377
+ import { EventEmitter } from "node:events";
64378
+
64379
+ // packages/core/src/tools/mcp-pool-events.ts
64380
+ init_esbuild_shims();
64381
+
64141
64382
  // packages/core/src/tools/mcp-pool-entry.ts
64142
64383
  var debugLogger42 = createDebugLogger("McpPool:Entry");
64143
64384
  function defaultPoolEntryOptions(transport) {
@@ -74778,6 +75019,16 @@ async function checkPriorRead(cache, filePath, verb, options2 = {}) {
74778
75019
  displayMessage: `file changed since last read; re-run ${ToolNames.READ_FILE} first.`
74779
75020
  };
74780
75021
  }
75022
+ if (status.state === "unverifiable") {
75023
+ const verbBare2 = verb === "editing" ? "edit" : "overwrite";
75024
+ const raw2 = `File ${filePath} is on a filesystem that does not provide a verifiable inode identity (ino=0), so the ${verbBare2} tool cannot safely confirm a prior read. Use a different mechanism (for example, the shell tool) to ${verbBare2} this file.`;
75025
+ return {
75026
+ ok: false,
75027
+ type: "prior_read_verification_failed" /* PRIOR_READ_VERIFICATION_FAILED */,
75028
+ rawMessage: raw2,
75029
+ displayMessage: `cannot verify prior read of ${filePath}; use a different mechanism to ${verbBare2} it.`
75030
+ };
75031
+ }
74781
75032
  if (status.state === "fresh" && status.entry.lastReadAt !== void 0 && !status.entry.lastReadCacheable) {
74782
75033
  const verbBare2 = verb === "editing" ? "edit" : "overwrite";
74783
75034
  const raw2 = `File ${filePath} is a binary / image / audio / video / PDF / notebook payload that the ${ToolNames.READ_FILE} tool returns as a structured value rather than as plain text. The Edit / WriteFile tools cannot mutate that payload safely \u2014 re-reading it would not change this. If this is a Jupyter notebook (.ipynb), use the ${ToolNames.NOTEBOOK_EDIT} tool for cell-level edits after reading it. For other non-text files, use a different mechanism (e.g. shell tool with an appropriate writer) if you need to ${verbBare2} it.`;
@@ -76725,6 +76976,10 @@ var FileReadCache = class _FileReadCache {
76725
76976
  static inodeKey(stats) {
76726
76977
  return `${stats.dev}:${stats.ino}`;
76727
76978
  }
76979
+ /** See {@link hasVerifiableInode}. */
76980
+ static hasVerifiableIdentity(stats) {
76981
+ return hasVerifiableInode(stats.ino);
76982
+ }
76728
76983
  /**
76729
76984
  * Record a successful Read of `absPath`.
76730
76985
  *
@@ -76763,8 +77018,21 @@ var FileReadCache = class _FileReadCache {
76763
77018
  * The fast-path `file_unchanged` check still gates on the
76764
77019
  * incoming request's own `isFullRead` (in `read-file.ts`), so a
76765
77020
  * partial read does not get a placeholder it shouldn't.
77021
+ *
77022
+ * When `stats.ino` is `0` the read is not stored and the returned
77023
+ * entry is **detached**: it describes this read for the immediate
77024
+ * caller, but it is not in the map, so mutating it has no effect
77025
+ * and a later {@link check} still reports `unverifiable`.
76766
77026
  */
76767
77027
  recordRead(absPath, stats, opts) {
77028
+ if (!_FileReadCache.hasVerifiableIdentity(stats)) {
77029
+ const entry2 = _FileReadCache.createEntry(absPath, stats);
77030
+ entry2.lastReadAt = Date.now();
77031
+ entry2.readResidentInHistory = opts.full;
77032
+ entry2.lastReadWasFull = opts.full;
77033
+ entry2.lastReadCacheable = opts.cacheable;
77034
+ return entry2;
77035
+ }
76768
77036
  const key = _FileReadCache.inodeKey(stats);
76769
77037
  const existing = this.byInode.get(key);
76770
77038
  const sameFingerprint = existing !== void 0 && existing.mtimeMs === stats.mtimeMs && existing.sizeBytes === stats.size;
@@ -76800,9 +77068,12 @@ var FileReadCache = class _FileReadCache {
76800
77068
  * the default `cacheable: true`; structured writers such as notebook cell
76801
77069
  * editors can set `cacheable: false` so regular Edit / WriteFile still
76802
77070
  * reject the file as a non-text payload.
77071
+ *
77072
+ * As with {@link recordRead}, an `ino === 0` write returns a
77073
+ * **detached** entry that was never added to the map.
76803
77074
  */
76804
77075
  recordWrite(absPath, stats, opts = {}) {
76805
- const entry = this.upsert(absPath, stats);
77076
+ const entry = _FileReadCache.hasVerifiableIdentity(stats) ? this.upsert(absPath, stats) : _FileReadCache.createEntry(absPath, stats);
76806
77077
  const now = Date.now();
76807
77078
  entry.lastWriteAt = now;
76808
77079
  entry.lastReadAt = now;
@@ -76814,6 +77085,8 @@ var FileReadCache = class _FileReadCache {
76814
77085
  /**
76815
77086
  * Compare the cached fingerprint against `stats` for the same inode.
76816
77087
  *
77088
+ * - `unverifiable` — the filesystem reported `ino === 0`, so the
77089
+ * file identity cannot be safely compared or cached.
76817
77090
  * - `unknown` — no entry. The file has never been Read or written in
76818
77091
  * this session.
76819
77092
  * - `stale` — entry exists but mtime or size differs. The file has
@@ -76828,6 +77101,9 @@ var FileReadCache = class _FileReadCache {
76828
77101
  * `0 occurrences` failure mode, which prompts the model to re-read.
76829
77102
  */
76830
77103
  check(stats) {
77104
+ if (!_FileReadCache.hasVerifiableIdentity(stats)) {
77105
+ return { state: "unverifiable" };
77106
+ }
76831
77107
  const entry = this.byInode.get(_FileReadCache.inodeKey(stats));
76832
77108
  if (!entry) return { state: "unknown" };
76833
77109
  if (entry.mtimeMs !== stats.mtimeMs || entry.sizeBytes !== stats.size) {
@@ -76855,6 +77131,9 @@ var FileReadCache = class _FileReadCache {
76855
77131
  * fall back to {@link clear}.
76856
77132
  */
76857
77133
  markReadEvictedFromHistory(stats) {
77134
+ if (!_FileReadCache.hasVerifiableIdentity(stats)) {
77135
+ return false;
77136
+ }
76858
77137
  const entry = this.byInode.get(_FileReadCache.inodeKey(stats));
76859
77138
  if (entry) {
76860
77139
  entry.readResidentInHistory = false;
@@ -76864,6 +77143,9 @@ var FileReadCache = class _FileReadCache {
76864
77143
  }
76865
77144
  /** Remove the entry for the given Stats, if any. */
76866
77145
  invalidate(stats) {
77146
+ if (!_FileReadCache.hasVerifiableIdentity(stats)) {
77147
+ return;
77148
+ }
76867
77149
  this.byInode.delete(_FileReadCache.inodeKey(stats));
76868
77150
  }
76869
77151
  /**
@@ -76936,8 +77218,13 @@ var FileReadCache = class _FileReadCache {
76936
77218
  this.byInode.delete(oldestKey);
76937
77219
  }
76938
77220
  }
76939
- const entry = {
76940
- inodeKey: key,
77221
+ const entry = _FileReadCache.createEntry(absPath, stats);
77222
+ this.byInode.set(key, entry);
77223
+ return entry;
77224
+ }
77225
+ static createEntry(absPath, stats) {
77226
+ return {
77227
+ inodeKey: _FileReadCache.inodeKey(stats),
76941
77228
  realPath: absPath,
76942
77229
  mtimeMs: stats.mtimeMs,
76943
77230
  sizeBytes: stats.size,
@@ -76945,8 +77232,6 @@ var FileReadCache = class _FileReadCache {
76945
77232
  lastReadCacheable: false,
76946
77233
  readResidentInHistory: false
76947
77234
  };
76948
- this.byInode.set(key, entry);
76949
- return entry;
76950
77235
  }
76951
77236
  };
76952
77237
 
@@ -77776,8 +78061,8 @@ var GitWorktreeService = class _GitWorktreeService {
77776
78061
  async getRegisteredWorktreeBranch(worktreePath) {
77777
78062
  let resolvedWorktreePath;
77778
78063
  try {
77779
- const stat21 = await fs29.stat(worktreePath);
77780
- if (!stat21.isDirectory()) return null;
78064
+ const stat22 = await fs29.stat(worktreePath);
78065
+ if (!stat22.isDirectory()) return null;
77781
78066
  resolvedWorktreePath = await fs29.realpath(worktreePath);
77782
78067
  } catch {
77783
78068
  return null;
@@ -79156,8 +79441,8 @@ async function restoreWorktreeContext(sidecarPath, onWarn) {
79156
79441
  }
79157
79442
  let worktreeAlive = false;
79158
79443
  try {
79159
- const stat21 = await fs30.stat(session.worktreePath);
79160
- worktreeAlive = stat21.isDirectory();
79444
+ const stat22 = await fs30.stat(session.worktreePath);
79445
+ worktreeAlive = stat22.isDirectory();
79161
79446
  } catch {
79162
79447
  worktreeAlive = false;
79163
79448
  }
@@ -79866,6 +80151,10 @@ function applyUtf8Prefix(command, shell) {
79866
80151
  }
79867
80152
  }
79868
80153
  __name(applyUtf8Prefix, "applyUtf8Prefix");
80154
+ function isSignalTermination(signal) {
80155
+ return signal !== null && signal !== 0;
80156
+ }
80157
+ __name(isSignalTermination, "isSignalTermination");
79869
80158
  function createPreSpawnAbortedHandle() {
79870
80159
  return {
79871
80160
  pid: void 0,
@@ -80898,7 +81187,7 @@ var ShellExecutionService = class _ShellExecutionService {
80898
81187
  rawOutput: finalBuffer,
80899
81188
  output: fullOutput,
80900
81189
  exitCode,
80901
- signal: signal ?? null,
81190
+ signal: signal === 0 ? null : signal ?? null,
80902
81191
  error,
80903
81192
  aborted: abortSignal.aborted,
80904
81193
  pid: ptyProcess.pid,
@@ -81038,7 +81327,7 @@ var ShellExecutionService = class _ShellExecutionService {
81038
81327
  }) => {
81039
81328
  firePostSettle({
81040
81329
  exitCode,
81041
- signal: signal ?? null,
81330
+ signal: signal === 0 ? null : signal ?? null,
81042
81331
  endTime: Date.now()
81043
81332
  });
81044
81333
  }
@@ -82058,10 +82347,10 @@ function readOutputTail(outputFile) {
82058
82347
  let fd;
82059
82348
  try {
82060
82349
  fd = fs32.openSync(outputFile, getReadOutputOpenFlags());
82061
- const stat21 = fs32.fstatSync(fd);
82062
- if (!stat21.isFile() || stat21.size <= 0) return void 0;
82063
- const length = Math.min(stat21.size, MAX_NOTIFICATION_OUTPUT_TAIL_BYTES);
82064
- const start = stat21.size - length;
82350
+ const stat22 = fs32.fstatSync(fd);
82351
+ if (!stat22.isFile() || stat22.size <= 0) return void 0;
82352
+ const length = Math.min(stat22.size, MAX_NOTIFICATION_OUTPUT_TAIL_BYTES);
82353
+ const start = stat22.size - length;
82065
82354
  const buffer = Buffer.allocUnsafe(length);
82066
82355
  const bytesRead = fs32.readSync(fd, buffer, 0, length, start);
82067
82356
  let sliceOffset = 0;
@@ -83066,6 +83355,7 @@ function restrictWorkflowConfirmationDetails(details) {
83066
83355
  type: "info",
83067
83356
  title: details.title,
83068
83357
  prompt: details.prompt,
83358
+ renderPromptAsPlainText: details.renderPromptAsPlainText,
83069
83359
  urls: details.urls ? [...details.urls] : void 0,
83070
83360
  hideAlwaysAllow: true
83071
83361
  };
@@ -85500,10 +85790,6 @@ var WRITE_TOOL_NAMES = /* @__PURE__ */ new Set([
85500
85790
  ToolNames.WRITE_FILE,
85501
85791
  ToolNames.EDIT
85502
85792
  ]);
85503
- function canonicalToolName(toolName) {
85504
- return ToolNamesMigration[toolName] ?? toolName;
85505
- }
85506
- __name(canonicalToolName, "canonicalToolName");
85507
85793
  function candidateFilePath(args) {
85508
85794
  const value = args?.["file_path"] ?? args?.["path"] ?? args?.["target_file"];
85509
85795
  return typeof value === "string" && value.length > 0 ? value : void 0;
@@ -85547,6 +85833,19 @@ function didWriteManagedMemory(candidates, projectRoot) {
85547
85833
  );
85548
85834
  }
85549
85835
  __name(didWriteManagedMemory, "didWriteManagedMemory");
85836
+ function didWriteProjectContextFile(candidates, projectRoot) {
85837
+ const contextFilePaths = new Set(
85838
+ getAllGeminiMdFilenames().map((name) => name.trim()).filter((name) => name.length > 0).map((name) => path42.resolve(projectRoot, name))
85839
+ );
85840
+ return candidates.some((candidate) => {
85841
+ if (!isSuccessfulWrite(candidate)) {
85842
+ return false;
85843
+ }
85844
+ const filePath = candidateFilePath(candidate.args);
85845
+ return filePath !== void 0 && contextFilePaths.has(resolveCandidatePath(filePath, projectRoot));
85846
+ });
85847
+ }
85848
+ __name(didWriteProjectContextFile, "didWriteProjectContextFile");
85550
85849
  async function rebuildWrittenMemoryIndexes(candidates, projectRoot, options2) {
85551
85850
  let wroteProjectMemory = false;
85552
85851
  let wroteUserMemory = false;
@@ -86395,11 +86694,11 @@ var WorkspaceMemoryFileTooLargeError = class extends Error {
86395
86694
  async function composeAppendedContent(filePath, newContent) {
86396
86695
  let existing = "";
86397
86696
  try {
86398
- const stat21 = await fs41.stat(filePath);
86399
- if (stat21.size > MAX_EXISTING_FILE_BYTES) {
86697
+ const stat22 = await fs41.stat(filePath);
86698
+ if (stat22.size > MAX_EXISTING_FILE_BYTES) {
86400
86699
  throw new WorkspaceMemoryFileTooLargeError(
86401
86700
  filePath,
86402
- stat21.size,
86701
+ stat22.size,
86403
86702
  MAX_EXISTING_FILE_BYTES
86404
86703
  );
86405
86704
  }
@@ -87441,13 +87740,13 @@ var IdeClient = class _IdeClient {
87441
87740
  lockFiles.map(async (file) => {
87442
87741
  const fullPath = path47.join(ideDir, file);
87443
87742
  try {
87444
- const stat21 = await fs42.promises.stat(fullPath);
87743
+ const stat22 = await fs42.promises.stat(fullPath);
87445
87744
  const content = await fs42.promises.readFile(fullPath, "utf8");
87446
87745
  try {
87447
87746
  return {
87448
87747
  file,
87449
87748
  fullPath,
87450
- mtimeMs: stat21.mtimeMs,
87749
+ mtimeMs: stat22.mtimeMs,
87451
87750
  parsed: JSON.parse(content)
87452
87751
  };
87453
87752
  } catch (error) {
@@ -96596,8 +96895,8 @@ async function collectResources(resourcePaths, pluginRoot, destDir) {
96596
96895
  debugLogger79.warn(`Resource path not found: ${resolvedPath}`);
96597
96896
  continue;
96598
96897
  }
96599
- const stat21 = fs53.statSync(resolvedPath);
96600
- if (stat21.isDirectory()) {
96898
+ const stat22 = fs53.statSync(resolvedPath);
96899
+ if (stat22.isDirectory()) {
96601
96900
  const dirName = path56.basename(resolvedPath);
96602
96901
  const finalDestDir = dirName === destFolderName ? destDir : path56.join(destDir, dirName);
96603
96902
  const files = await glob("**/*", {
@@ -98174,7 +98473,7 @@ import * as path62 from "node:path";
98174
98473
  init_esbuild_shims();
98175
98474
  import * as fs59 from "node:fs";
98176
98475
  import * as path61 from "node:path";
98177
- import { stat as stat11 } from "node:fs/promises";
98476
+ import { stat as stat12 } from "node:fs/promises";
98178
98477
  var debugLogger83 = createDebugLogger("EXT_MARKETPLACE");
98179
98478
  function parseSourceAndPluginName(source) {
98180
98479
  const urlSchemes = ["http://", "https://", "git@", "sso://"];
@@ -98361,7 +98660,7 @@ async function loadMarketplaceConfigFromSource(source, networkPolicy) {
98361
98660
  const trimmed = source.trim();
98362
98661
  const lowerTrimmed = trimmed.toLowerCase();
98363
98662
  try {
98364
- const stats = await stat11(trimmed);
98663
+ const stats = await stat12(trimmed);
98365
98664
  if (stats.isDirectory()) {
98366
98665
  return await readLocalMarketplaceConfig(trimmed);
98367
98666
  }
@@ -98434,7 +98733,7 @@ async function parseInstallSource(source, options2 = {}) {
98434
98733
  let marketplaceConfig = null;
98435
98734
  let isLocalPath = false;
98436
98735
  try {
98437
- await stat11(repo);
98736
+ await stat12(repo);
98438
98737
  isLocalPath = true;
98439
98738
  } catch {
98440
98739
  }
@@ -104454,13 +104753,13 @@ import * as os21 from "os";
104454
104753
  // node_modules/chokidar/esm/index.js
104455
104754
  init_esbuild_shims();
104456
104755
  import { stat as statcb } from "fs";
104457
- import { stat as stat15, readdir as readdir10 } from "fs/promises";
104756
+ import { stat as stat16, readdir as readdir10 } from "fs/promises";
104458
104757
  import { EventEmitter as EventEmitter4 } from "events";
104459
104758
  import * as sysPath2 from "path";
104460
104759
 
104461
104760
  // node_modules/readdirp/esm/index.js
104462
104761
  init_esbuild_shims();
104463
- import { stat as stat13, lstat as lstat7, readdir as readdir9, realpath as realpath6 } from "node:fs/promises";
104762
+ import { stat as stat14, lstat as lstat7, readdir as readdir9, realpath as realpath6 } from "node:fs/promises";
104464
104763
  import { Readable } from "node:stream";
104465
104764
  import { resolve as presolve, relative as prelative, join as pjoin, sep as psep } from "node:path";
104466
104765
  var EntryTypes = {
@@ -104530,7 +104829,7 @@ var ReaddirpStream = class extends Readable {
104530
104829
  const { root, type } = opts;
104531
104830
  this._fileFilter = normalizeFilter(opts.fileFilter);
104532
104831
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
104533
- const statMethod = opts.lstat ? lstat7 : stat13;
104832
+ const statMethod = opts.lstat ? lstat7 : stat14;
104534
104833
  if (wantBigintFsStats) {
104535
104834
  this._stat = (path98) => statMethod(path98, { bigint: true });
104536
104835
  } else {
@@ -104685,7 +104984,7 @@ __name(readdirp, "readdirp");
104685
104984
  // node_modules/chokidar/esm/handler.js
104686
104985
  init_esbuild_shims();
104687
104986
  import { watchFile, unwatchFile, watch as fs_watch } from "fs";
104688
- import { open as open8, stat as stat14, lstat as lstat8, realpath as fsrealpath } from "fs/promises";
104987
+ import { open as open8, stat as stat15, lstat as lstat8, realpath as fsrealpath } from "fs/promises";
104689
104988
  import * as sysPath from "path";
104690
104989
  import { type as osType } from "os";
104691
104990
  var STR_DATA = "data";
@@ -104712,7 +105011,7 @@ var EVENTS = {
104712
105011
  };
104713
105012
  var EV = EVENTS;
104714
105013
  var THROTTLE_MODE_WATCH = "watch";
104715
- var statMethods = { lstat: lstat8, stat: stat14 };
105014
+ var statMethods = { lstat: lstat8, stat: stat15 };
104716
105015
  var KEY_LISTENERS = "listeners";
104717
105016
  var KEY_ERR = "errHandlers";
104718
105017
  var KEY_RAW = "rawEmitters";
@@ -105202,7 +105501,7 @@ var NodeFsHandler = class {
105202
105501
  return;
105203
105502
  if (!newStats || newStats.mtimeMs === 0) {
105204
105503
  try {
105205
- const newStats2 = await stat14(file);
105504
+ const newStats2 = await stat15(file);
105206
105505
  if (this.fsw.closed)
105207
105506
  return;
105208
105507
  const at2 = newStats2.atimeMs;
@@ -105915,7 +106214,7 @@ var FSWatcher = class extends EventEmitter4 {
105915
106214
  const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path98) : path98;
105916
106215
  let stats2;
105917
106216
  try {
105918
- stats2 = await stat15(fullPath);
106217
+ stats2 = await stat16(fullPath);
105919
106218
  } catch (err) {
105920
106219
  }
105921
106220
  if (!stats2 || this.closed)
@@ -106043,8 +106342,8 @@ var FSWatcher = class extends EventEmitter4 {
106043
106342
  }
106044
106343
  return this._userIgnored(path98, stats);
106045
106344
  }
106046
- _isntIgnored(path98, stat21) {
106047
- return !this._isIgnored(path98, stat21);
106345
+ _isntIgnored(path98, stat22) {
106346
+ return !this._isIgnored(path98, stat22);
106048
106347
  }
106049
106348
  /**
106050
106349
  * Provides a set of common helpers and properties relating to symlink handling.
@@ -107250,12 +107549,12 @@ __name(isWithin, "isWithin");
107250
107549
  async function readBoundedTaskFile(filePath) {
107251
107550
  const handle = await fs68.open(filePath, "r");
107252
107551
  try {
107253
- const stat21 = await handle.stat();
107254
- if (!stat21.isFile()) {
107552
+ const stat22 = await handle.stat();
107553
+ if (!stat22.isFile()) {
107255
107554
  return null;
107256
107555
  }
107257
107556
  const cap = LOOP_TASK_FILE_MAX_BYTES + 1;
107258
- const allocSize = Math.min(cap, stat21.size + 1);
107557
+ const allocSize = Math.min(cap, stat22.size + 1);
107259
107558
  const buffer = Buffer.alloc(allocSize);
107260
107559
  let total = 0;
107261
107560
  while (total < allocSize) {
@@ -114734,7 +115033,7 @@ async function runSpeculativeLoop(config, state, cacheSafe, modelOverride) {
114734
115033
  toolInvocationGuard,
114735
115034
  {
114736
115035
  callId: persistenceCallId,
114737
- toolName: canonicalToolName2(name),
115036
+ toolName: canonicalToolName(name),
114738
115037
  args: invocation.params,
114739
115038
  signal: state.abortController.signal,
114740
115039
  ...invocationContext ? { invocationContext } : {}
@@ -115412,12 +115711,12 @@ function resolveGitDir2(crawlDirectory) {
115412
115711
  while (current) {
115413
115712
  const gitPath = path76.join(current, ".git");
115414
115713
  try {
115415
- const stat21 = fs72.statSync(gitPath);
115416
- if (stat21.isDirectory()) {
115714
+ const stat22 = fs72.statSync(gitPath);
115715
+ if (stat22.isDirectory()) {
115417
115716
  pathCacheSet(resolveGitDirCache, cacheKey, gitPath);
115418
115717
  return gitPath;
115419
115718
  }
115420
- if (stat21.isFile()) {
115719
+ if (stat22.isFile()) {
115421
115720
  const contents = fs72.readFileSync(gitPath, "utf8").trim();
115422
115721
  const match2 = contents.match(/^gitdir:\s*(.+)$/i);
115423
115722
  if (!match2) {
@@ -116025,13 +116324,13 @@ async function crawlWithGitLsFiles(stateKey, crawlDirectory, cwd, options2, work
116025
116324
  if (deletedSet.has(normalizedFile)) {
116026
116325
  return true;
116027
116326
  }
116028
- let stat21;
116327
+ let stat22;
116029
116328
  try {
116030
- stat21 = fs72.lstatSync(path76.join(gitRoot, ...normalizedFile.split("/")));
116329
+ stat22 = fs72.lstatSync(path76.join(gitRoot, ...normalizedFile.split("/")));
116031
116330
  } catch {
116032
116331
  return true;
116033
116332
  }
116034
- if (stat21.isDirectory()) {
116333
+ if (stat22.isDirectory()) {
116035
116334
  return true;
116036
116335
  }
116037
116336
  if (relativeToGitRoot && relativeToGitRoot !== "." && normalizedFile === relativeToGitRoot) {
@@ -121910,8 +122209,8 @@ function getWelcomeBackStatePath() {
121910
122209
  return path85.join(process.cwd(), ".qwen", WELCOME_BACK_STATE_FILENAME);
121911
122210
  }
121912
122211
  __name(getWelcomeBackStatePath, "getWelcomeBackStatePath");
121913
- function buildSummaryFingerprint(stat21) {
121914
- return `${stat21.mtimeMs}:${stat21.size}`;
122212
+ function buildSummaryFingerprint(stat22) {
122213
+ return `${stat22.mtimeMs}:${stat22.size}`;
121915
122214
  }
121916
122215
  __name(buildSummaryFingerprint, "buildSummaryFingerprint");
121917
122216
  async function getWelcomeBackState() {
@@ -129393,7 +129692,7 @@ ${result.output}`;
129393
129692
  }
129394
129693
  const elapsedMs = performance.now() - executionStartTime;
129395
129694
  const longRunThreshold = effectiveTimeout === 0 ? null : longRunThresholdFor(effectiveTimeout);
129396
- const shouldAppendLongRunHint = longRunThreshold !== null && !result.aborted && result.signal === null && elapsedMs >= longRunThreshold;
129695
+ const shouldAppendLongRunHint = longRunThreshold !== null && !result.aborted && !isSignalTermination(result.signal) && elapsedMs >= longRunThreshold;
129397
129696
  debugLogger122.debug(
129398
129697
  `long-run hint: elapsed=${Math.round(elapsedMs)}ms threshold=${longRunThreshold === null ? "disabled" : `${longRunThreshold}ms`} aborted=${result.aborted} signal=${result.signal} \u2192 ${shouldAppendLongRunHint ? "fire" : "suppress"}`
129399
129698
  );
@@ -129407,7 +129706,7 @@ ${result.output}` : result.output;
129407
129706
  } else {
129408
129707
  if (result.aborted) {
129409
129708
  returnDisplayMessage = wasTimeout ? `${timeoutSummary} There was no output before it timed out.` : wasPromoteRefused ? "Command finished before background-promote could be honoured." : "Command cancelled by user.";
129410
- } else if (result.signal) {
129709
+ } else if (isSignalTermination(result.signal)) {
129411
129710
  returnDisplayMessage = `Command terminated by signal: ${result.signal}`;
129412
129711
  } else if (result.error) {
129413
129712
  returnDisplayMessage = `Command failed: ${getErrorMessage(
@@ -129479,7 +129778,7 @@ ${attributionWarning}`;
129479
129778
  ${longRunHint}` : ""),
129480
129779
  type: "shell_execute_error" /* SHELL_EXECUTE_ERROR */
129481
129780
  }
129482
- } : isShellExitError(this.params.command, result.exitCode) ? {
129781
+ } : !result.aborted && isSignalTermination(result.signal) || isShellExitError(this.params.command, result.exitCode) ? {
129483
129782
  error: {
129484
129783
  // Schedulers use error.message as the model-facing response.
129485
129784
  message: typeof llmContent === "string" ? llmContent : returnDisplayMessage,
@@ -129679,16 +129978,17 @@ ${longRunHint}` : ""),
129679
129978
  let postPromoteFinalStatus = null;
129680
129979
  const classifySettle = /* @__PURE__ */ __name((info) => {
129681
129980
  if (info.error) return { status: "failed", failMsg: info.error.message };
129682
- if (info.exitCode === 0) return { status: "completed", failMsg: null };
129683
- if (info.exitCode !== null)
129981
+ if (isSignalTermination(info.signal)) {
129684
129982
  return {
129685
129983
  status: "failed",
129686
- failMsg: `Exited with code ${info.exitCode}`
129984
+ failMsg: `Terminated by signal ${info.signal}`
129687
129985
  };
129688
- if (info.signal !== null)
129986
+ }
129987
+ if (info.exitCode === 0) return { status: "completed", failMsg: null };
129988
+ if (info.exitCode !== null)
129689
129989
  return {
129690
129990
  status: "failed",
129691
- failMsg: `Terminated by signal ${info.signal}`
129991
+ failMsg: `Exited with code ${info.exitCode}`
129692
129992
  };
129693
129993
  debugLogger122.warn(
129694
129994
  `promote: classifySettle all-null fallback hit for ${shellId} \u2014 exitCode=${info.exitCode}, signal=${info.signal}, error=undefined`
@@ -129699,6 +129999,10 @@ ${longRunHint}` : ""),
129699
129999
  };
129700
130000
  }, "classifySettle");
129701
130001
  const transitionRegistry = /* @__PURE__ */ __name((info) => {
130002
+ if (entryAc.signal.aborted) {
130003
+ registry.cancel(shellId, info.endTime);
130004
+ return;
130005
+ }
129702
130006
  const cls = classifySettle(info);
129703
130007
  if (cls.status === "completed") {
129704
130008
  registry.complete(shellId, info.exitCode, info.endTime);
@@ -129856,8 +130160,8 @@ ${longRunHint}` : ""),
129856
130160
  if (registry.get(shellId)?.status === "running") {
129857
130161
  registry.cancel(shellId, endTime);
129858
130162
  }
129859
- } else if (result.error || result.exitCode !== null && result.exitCode !== 0 || result.signal !== null) {
129860
- const reason = result.error ? result.error.message : result.signal !== null ? `terminated by signal ${result.signal}` : `exited with code ${result.exitCode}`;
130163
+ } else if (result.error || result.exitCode !== null && result.exitCode !== 0 || isSignalTermination(result.signal)) {
130164
+ const reason = result.error ? result.error.message : isSignalTermination(result.signal) ? `terminated by signal ${result.signal}` : `exited with code ${result.exitCode}`;
129861
130165
  registry.fail(shellId, reason, endTime);
129862
130166
  } else {
129863
130167
  registry.complete(shellId, result.exitCode ?? 0, endTime);
@@ -130827,12 +131131,8 @@ var FS_PATH_TOOL_NAMES = /* @__PURE__ */ new Set([
130827
131131
  ToolNames.NOTEBOOK_EDIT,
130828
131132
  ToolNames.DISPLAY_IMAGE
130829
131133
  ]);
130830
- function canonicalToolName2(toolName) {
130831
- return ToolNamesMigration[toolName] ?? toolName;
130832
- }
130833
- __name(canonicalToolName2, "canonicalToolName");
130834
131134
  function isFilesystemPathTool(toolName) {
130835
- return FS_PATH_TOOL_NAMES.has(canonicalToolName2(toolName));
131135
+ return FS_PATH_TOOL_NAMES.has(canonicalToolName(toolName));
130836
131136
  }
130837
131137
  __name(isFilesystemPathTool, "isFilesystemPathTool");
130838
131138
  function trimTrailingSlash(s3) {
@@ -130862,7 +131162,7 @@ function pushLspPathCandidate(out, v2) {
130862
131162
  }
130863
131163
  __name(pushLspPathCandidate, "pushLspPathCandidate");
130864
131164
  function extractToolFilePaths(toolName, toolInput) {
130865
- const canonical = canonicalToolName2(toolName);
131165
+ const canonical = canonicalToolName(toolName);
130866
131166
  if (!FS_PATH_TOOL_NAMES.has(canonical)) {
130867
131167
  if (toolInput && typeof toolInput === "object") {
130868
131168
  const obj2 = toolInput;
@@ -131243,7 +131543,7 @@ function withPostToolBatchStop(completedCalls, stopReason) {
131243
131543
  }
131244
131544
  __name(withPostToolBatchStop, "withPostToolBatchStop");
131245
131545
  function isToolCallConcurrencySafe(name, kind, args) {
131246
- if (canonicalToolName2(name) === ToolNames.AGENT) return true;
131546
+ if (canonicalToolName(name) === ToolNames.AGENT) return true;
131247
131547
  if (kind === "execute" /* Execute */) {
131248
131548
  const command = args?.command;
131249
131549
  if (typeof command !== "string") return false;
@@ -131976,7 +132276,7 @@ var CoreToolScheduler = class {
131976
132276
  Array.isArray(request) ? request : [request]
131977
132277
  );
131978
132278
  const planModeEntryBoundaryIndex = findPlanModeEntryBatchBoundaryIndex(
131979
- requestsToProcess.map((item) => canonicalToolName2(item.name))
132279
+ requestsToProcess.map((item) => canonicalToolName(item.name))
131980
132280
  );
131981
132281
  if (this.validationRetryCounts.size > 0) {
131982
132282
  const currentToolNames = new Set(requestsToProcess.map((r) => r.name));
@@ -132041,7 +132341,7 @@ var CoreToolScheduler = class {
132041
132341
  });
132042
132342
  continue;
132043
132343
  }
132044
- const canonicalName = canonicalToolName2(reqInfo.name);
132344
+ const canonicalName = canonicalToolName(reqInfo.name);
132045
132345
  const pm = this.config.getPermissionManager?.();
132046
132346
  const permissionEnabled = pm ? await pm.isToolEnabled(canonicalName) : true;
132047
132347
  if (recordPrevalidationCancellation()) continue;
@@ -132233,7 +132533,7 @@ var CoreToolScheduler = class {
132233
132533
  continue;
132234
132534
  }
132235
132535
  const { request: reqInfo, invocation } = toolCall;
132236
- const canonicalName = canonicalToolName2(reqInfo.name);
132536
+ const canonicalName = canonicalToolName(reqInfo.name);
132237
132537
  const toolSpan = startToolSpan(
132238
132538
  canonicalName,
132239
132539
  {
@@ -133328,7 +133628,7 @@ var CoreToolScheduler = class {
133328
133628
  }
133329
133629
  let toolSpan = this.toolSpans.get(callId);
133330
133630
  if (!toolSpan) {
133331
- const canonical = canonicalToolName2(toolName);
133631
+ const canonical = canonicalToolName(toolName);
133332
133632
  toolSpan = startToolSpan(
133333
133633
  canonical,
133334
133634
  {
@@ -133406,12 +133706,13 @@ var CoreToolScheduler = class {
133406
133706
  */
133407
133707
  bounceToAwaitingApprovalForAsk(scheduledCall, reason, toolSpan, signal) {
133408
133708
  const { callId, name: toolName } = scheduledCall.request;
133409
- const canonicalName = canonicalToolName2(toolName);
133709
+ const canonicalName = canonicalToolName(toolName);
133410
133710
  this.bouncedAwaitingApproval.add(callId);
133411
133711
  const confirmationDetails = {
133412
133712
  type: "info",
133413
133713
  title: `Hook requested confirmation to run ${toolName}`,
133414
133714
  prompt: reason || `A PreToolUse hook requested confirmation before running ${toolName}.`,
133715
+ renderPromptAsPlainText: true,
133415
133716
  hideAlwaysAllow: true,
133416
133717
  onConfirm: /* @__PURE__ */ __name((outcome, payload) => this.handleConfirmationResponse(
133417
133718
  callId,
@@ -133460,7 +133761,7 @@ var CoreToolScheduler = class {
133460
133761
  }
133461
133762
  async _executeToolCallBody(scheduledCall, signal, span) {
133462
133763
  const { callId, name: toolName } = scheduledCall.request;
133463
- const canonicalName = canonicalToolName2(toolName);
133764
+ const canonicalName = canonicalToolName(toolName);
133464
133765
  const invocation = scheduledCall.invocation;
133465
133766
  const toolInput = scheduledCall.request.args;
133466
133767
  const isPostAskReexecution = this.bouncedAwaitingApproval.delete(callId);
@@ -134540,7 +134841,7 @@ ${failureHookResult.additionalContext}`;
134540
134841
  }
134541
134842
  }
134542
134843
  async maybePersistLargeToolResult(callId, toolName, content) {
134543
- if (GATE_EXEMPT_TOOLS.has(canonicalToolName2(toolName))) return { content };
134844
+ if (GATE_EXEMPT_TOOLS.has(canonicalToolName(toolName))) return { content };
134544
134845
  const text = extractTextFromPartListUnion(content);
134545
134846
  if (!text || isAlreadyTruncated(text)) return { content };
134546
134847
  const gateThreshold = this.config.getTruncateToolOutputThreshold() + GATE_HEADROOM;
@@ -139872,6 +140173,9 @@ async function runAutoMemoryExtract(params) {
139872
140173
  );
139873
140174
  }) : Promise.resolve();
139874
140175
  await Promise.all([projectRebuild, userRebuild]);
140176
+ await refreshMemoryInstruction(params.config, {
140177
+ logContext: "managed auto-memory extraction"
140178
+ });
139875
140179
  }
139876
140180
  const madeGenuineProgress = agentResult.touchedTopics.length > 0 || agentResult.hasToolActivity;
139877
140181
  const cursor = {
@@ -142078,7 +142382,8 @@ var GeminiClient = class _GeminiClient {
142078
142382
  if (resumeTokenCounts) {
142079
142383
  chat.seedResumeTokenCounts(
142080
142384
  resumeTokenCounts.promptTokenCount,
142081
- resumeTokenCounts.outputTokenCount
142385
+ resumeTokenCounts.outputTokenCount,
142386
+ resumeTokenCounts.isEstimated
142082
142387
  );
142083
142388
  } else {
142084
142389
  chat.setLastPromptTokenCount(
@@ -144584,15 +144889,15 @@ The current date is: ${today}. Note: This is the authoritative current date \u20
144584
144889
  async tryCompressChat(prompt_id, force = false, signal, customInstructions) {
144585
144890
  const previousSessionStartContext = this.lastSessionStartContext;
144586
144891
  const previousSessionStartSource = this.lastSessionStartSource;
144587
- const info = await this.getChat().tryCompress(
144892
+ const previousChat = this.getChat();
144893
+ const info = await previousChat.tryCompress(
144588
144894
  prompt_id,
144589
144895
  force,
144590
144896
  signal,
144591
144897
  customInstructions ? { customInstructions } : void 0
144592
144898
  );
144593
144899
  if (info.compressionStatus === 1 /* COMPRESSED */) {
144594
- const chat = this.getChat();
144595
- const compressedHistory = chat.getHistoryShallow?.() ?? chat.getHistory();
144900
+ const compressedHistory = previousChat.getHistoryShallow?.() ?? previousChat.getHistory();
144596
144901
  await this.startChat(compressedHistory, "compact" /* Compact */);
144597
144902
  if (!this.lastSessionStartContext && previousSessionStartContext && previousSessionStartSource) {
144598
144903
  this.lastSessionStartContext = previousSessionStartContext;
@@ -144604,7 +144909,10 @@ The current date is: ${today}. Note: This is the authoritative current date \u20
144604
144909
  }
144605
144910
  debugLogger133.debug("[FILE_READ_CACHE] clear after tryCompressChat");
144606
144911
  this.config.getFileReadCache().clear();
144607
- this.getChat().setLastPromptTokenCount(info.newTokenCount);
144912
+ this.getChat().setLastPromptTokenCount(
144913
+ info.newTokenCount,
144914
+ info.newTokenCountIsEstimated ?? true
144915
+ );
144608
144916
  this.forceFullIdeContext = true;
144609
144917
  }
144610
144918
  return info;
@@ -150881,7 +151189,7 @@ var Config = class _Config {
150881
151189
  }
150882
151190
  if (!enabled) return;
150883
151191
  registry.registerFactory(ToolNames.IMAGE_GEN, async () => {
150884
- const { ImageGenTool } = await import("./image-gen-4CQJPQP5.js");
151192
+ const { ImageGenTool } = await import("./image-gen-OE2EEKN3.js");
150885
151193
  return new ImageGenTool(this);
150886
151194
  });
150887
151195
  }
@@ -150911,36 +151219,36 @@ var Config = class _Config {
150911
151219
  if (options2?.forSubAgent) return;
150912
151220
  const schema = this.jsonSchema;
150913
151221
  await registerLazy(ToolNames.STRUCTURED_OUTPUT, async () => {
150914
- const { SyntheticOutputTool } = await import("./syntheticOutput-BN7E626U.js");
151222
+ const { SyntheticOutputTool } = await import("./syntheticOutput-PEBJQYJV.js");
150915
151223
  return new SyntheticOutputTool(schema);
150916
151224
  });
150917
151225
  }, "registerStructuredOutputIfRequested");
150918
151226
  const registerGoalWorkerTools = /* @__PURE__ */ __name(async () => {
150919
151227
  if (options2?.forSubAgent) return;
150920
151228
  await registerLazy(ToolNames.GET_GOAL, async () => {
150921
- const { GetGoalTool } = await import("./goal-tools-3AZKX5WQ.js");
151229
+ const { GetGoalTool } = await import("./goal-tools-QSYW65HV.js");
150922
151230
  return new GetGoalTool(this);
150923
151231
  });
150924
151232
  await registerLazy(ToolNames.UPDATE_GOAL, async () => {
150925
- const { UpdateGoalTool } = await import("./goal-tools-3AZKX5WQ.js");
151233
+ const { UpdateGoalTool } = await import("./goal-tools-QSYW65HV.js");
150926
151234
  return new UpdateGoalTool(this);
150927
151235
  });
150928
151236
  }, "registerGoalWorkerTools");
150929
151237
  if (this.getBareMode()) {
150930
151238
  await registerLazy(ToolNames.READ_FILE, async () => {
150931
- const { ReadFileTool } = await import("./read-file-ZNAN2B26.js");
151239
+ const { ReadFileTool } = await import("./read-file-FMTE6LPA.js");
150932
151240
  return new ReadFileTool(this);
150933
151241
  });
150934
151242
  await registerLazy(ToolNames.EDIT, async () => {
150935
- const { EditTool } = await import("./edit-IVQQVYYK.js");
151243
+ const { EditTool } = await import("./edit-72DP57CD.js");
150936
151244
  return new EditTool(this);
150937
151245
  });
150938
151246
  await registerLazy(ToolNames.NOTEBOOK_EDIT, async () => {
150939
- const { NotebookEditTool } = await import("./notebook-edit-OC2V7U5D.js");
151247
+ const { NotebookEditTool } = await import("./notebook-edit-ZUVK2XWE.js");
150940
151248
  return new NotebookEditTool(this);
150941
151249
  });
150942
151250
  await registerLazy(ToolNames.SHELL, async () => {
150943
- const { ShellTool: ShellTool2 } = await import("./shell-BKII3B6E.js");
151251
+ const { ShellTool: ShellTool2 } = await import("./shell-3D3PMQHE.js");
150944
151252
  return new ShellTool2(this);
150945
151253
  });
150946
151254
  await registerGoalWorkerTools();
@@ -150952,43 +151260,43 @@ var Config = class _Config {
150952
151260
  }
150953
151261
  await registerGoalWorkerTools();
150954
151262
  await registerLazy(ToolNames.TOOL_SEARCH, async () => {
150955
- const { ToolSearchTool } = await import("./tool-search-S6LRRACA.js");
151263
+ const { ToolSearchTool } = await import("./tool-search-7N4D4O56.js");
150956
151264
  return new ToolSearchTool(this);
150957
151265
  });
150958
151266
  await registerLazy(ToolNames.READ_MCP_RESOURCE, async () => {
150959
- const { ReadMcpResourceTool } = await import("./read-mcp-resource-RTSSEER5.js");
151267
+ const { ReadMcpResourceTool } = await import("./read-mcp-resource-PZ4ZF6YL.js");
150960
151268
  return new ReadMcpResourceTool(this);
150961
151269
  });
150962
151270
  await registerLazy(ToolNames.AGENT, async () => {
150963
- const { AgentTool: AgentTool2 } = await import("./agent-AHGLYNZ4.js");
151271
+ const { AgentTool: AgentTool2 } = await import("./agent-DBSC47CD.js");
150964
151272
  return new AgentTool2(this);
150965
151273
  });
150966
151274
  await registerLazy(ToolNames.LIST_AGENTS, async () => {
150967
- const { ListAgentsTool } = await import("./list-agents-GC4BRET7.js");
151275
+ const { ListAgentsTool } = await import("./list-agents-Z4WABFDZ.js");
150968
151276
  return new ListAgentsTool(this);
150969
151277
  });
150970
151278
  await registerLazy(ToolNames.TASK_STOP, async () => {
150971
- const { TaskStopTool } = await import("./task-stop-TNXRNAL2.js");
151279
+ const { TaskStopTool } = await import("./task-stop-FPCOIRYX.js");
150972
151280
  return new TaskStopTool(this);
150973
151281
  });
150974
151282
  await registerLazy(ToolNames.SEND_MESSAGE, async () => {
150975
- const { SendMessageTool } = await import("./send-message-TL6FIMMN.js");
151283
+ const { SendMessageTool } = await import("./send-message-CAMSLG2L.js");
150976
151284
  return new SendMessageTool(this);
150977
151285
  });
150978
151286
  await registerLazy(ToolNames.SKILL, async () => {
150979
- const { SkillTool } = await import("./skill-6CFOWVGA.js");
151287
+ const { SkillTool } = await import("./skill-TSEYMVQ2.js");
150980
151288
  return new SkillTool(this);
150981
151289
  });
150982
151290
  await registerLazy(ToolNames.LS, async () => {
150983
- const { LSTool } = await import("./ls-63CC3NNX.js");
151291
+ const { LSTool } = await import("./ls-TVHDGIES.js");
150984
151292
  return new LSTool(this);
150985
151293
  });
150986
151294
  await registerLazy(ToolNames.READ_FILE, async () => {
150987
- const { ReadFileTool } = await import("./read-file-ZNAN2B26.js");
151295
+ const { ReadFileTool } = await import("./read-file-FMTE6LPA.js");
150988
151296
  return new ReadFileTool(this);
150989
151297
  });
150990
151298
  await registerLazy(ToolNames.ZOOM_IMAGE, async () => {
150991
- const { ZoomImageTool } = await import("./zoom-image-6RBLD7X6.js");
151299
+ const { ZoomImageTool } = await import("./zoom-image-DPR22XWY.js");
150992
151300
  return new ZoomImageTool(this);
150993
151301
  });
150994
151302
  if (this.getUseRipgrep()) {
@@ -151003,7 +151311,7 @@ var Config = class _Config {
151003
151311
  recordStartupEvent("config_initialize_ripgrep_probe_end");
151004
151312
  if (useRipgrep) {
151005
151313
  await registerLazy(ToolNames.GREP, async () => {
151006
- const { RipGrepTool: RipGrepTool2 } = await import("./ripGrep-C3KMLZM5.js");
151314
+ const { RipGrepTool: RipGrepTool2 } = await import("./ripGrep-DUIYUZGM.js");
151007
151315
  return new RipGrepTool2(this);
151008
151316
  });
151009
151317
  } else {
@@ -151016,7 +151324,7 @@ var Config = class _Config {
151016
151324
  )
151017
151325
  );
151018
151326
  await registerLazy(ToolNames.GREP, async () => {
151019
- const { GrepTool } = await import("./grep-Z67Z7EN6.js");
151327
+ const { GrepTool } = await import("./grep-56MTW67B.js");
151020
151328
  return new GrepTool(this);
151021
151329
  });
151022
151330
  }
@@ -151024,77 +151332,77 @@ var Config = class _Config {
151024
151332
  recordStartupEvent("config_initialize_ripgrep_probe_start");
151025
151333
  recordStartupEvent("config_initialize_ripgrep_probe_end");
151026
151334
  await registerLazy(ToolNames.GREP, async () => {
151027
- const { GrepTool } = await import("./grep-Z67Z7EN6.js");
151335
+ const { GrepTool } = await import("./grep-56MTW67B.js");
151028
151336
  return new GrepTool(this);
151029
151337
  });
151030
151338
  }
151031
151339
  await registerLazy(ToolNames.GLOB, async () => {
151032
- const { GlobTool } = await import("./glob-Z4NQFKWS.js");
151340
+ const { GlobTool } = await import("./glob-QNRIUOS6.js");
151033
151341
  return new GlobTool(this);
151034
151342
  });
151035
151343
  await registerLazy(ToolNames.EDIT, async () => {
151036
- const { EditTool } = await import("./edit-IVQQVYYK.js");
151344
+ const { EditTool } = await import("./edit-72DP57CD.js");
151037
151345
  return new EditTool(this);
151038
151346
  });
151039
151347
  await registerLazy(ToolNames.NOTEBOOK_EDIT, async () => {
151040
- const { NotebookEditTool } = await import("./notebook-edit-OC2V7U5D.js");
151348
+ const { NotebookEditTool } = await import("./notebook-edit-ZUVK2XWE.js");
151041
151349
  return new NotebookEditTool(this);
151042
151350
  });
151043
151351
  await registerLazy(ToolNames.WRITE_FILE, async () => {
151044
- const { WriteFileTool: WriteFileTool2 } = await import("./write-file-G5VNGCOG.js");
151352
+ const { WriteFileTool: WriteFileTool2 } = await import("./write-file-2F76RRFE.js");
151045
151353
  return new WriteFileTool2(this);
151046
151354
  });
151047
151355
  await registerLazy(ToolNames.SHELL, async () => {
151048
- const { ShellTool: ShellTool2 } = await import("./shell-BKII3B6E.js");
151356
+ const { ShellTool: ShellTool2 } = await import("./shell-3D3PMQHE.js");
151049
151357
  return new ShellTool2(this);
151050
151358
  });
151051
151359
  await registerLazy(ToolNames.TODO_WRITE, async () => {
151052
- const { TodoWriteTool } = await import("./todoWrite-MHWHO5UO.js");
151360
+ const { TodoWriteTool } = await import("./todoWrite-JGV6VLOX.js");
151053
151361
  return new TodoWriteTool(this);
151054
151362
  });
151055
151363
  const supportsUserInteraction = resolveInteractionMode(this) !== "headless";
151056
151364
  if (supportsUserInteraction) {
151057
151365
  await registerLazy(ToolNames.ASK_USER_QUESTION, async () => {
151058
- const { AskUserQuestionTool } = await import("./askUserQuestion-2EPPBPUZ.js");
151366
+ const { AskUserQuestionTool } = await import("./askUserQuestion-ONW74PKJ.js");
151059
151367
  return new AskUserQuestionTool(this);
151060
151368
  });
151061
151369
  }
151062
151370
  if (!this.sdkMode && (supportsUserInteraction || options2?.forSubAgent)) {
151063
151371
  await registerLazy(ToolNames.EXIT_PLAN_MODE, async () => {
151064
- const { ExitPlanModeTool: ExitPlanModeTool2 } = await import("./exitPlanMode-TUGOB2LL.js");
151372
+ const { ExitPlanModeTool: ExitPlanModeTool2 } = await import("./exitPlanMode-4Q7BSQXR.js");
151065
151373
  return new ExitPlanModeTool2(this);
151066
151374
  });
151067
151375
  }
151068
151376
  if (!this.sdkMode && supportsUserInteraction) {
151069
151377
  await registerLazy(ToolNames.ENTER_PLAN_MODE, async () => {
151070
- const { EnterPlanModeTool } = await import("./enterPlanMode-KKTDVLAD.js");
151378
+ const { EnterPlanModeTool } = await import("./enterPlanMode-TQBWGCPL.js");
151071
151379
  return new EnterPlanModeTool(this);
151072
151380
  });
151073
151381
  }
151074
151382
  await registerLazy(ToolNames.ENTER_WORKTREE, async () => {
151075
- const { EnterWorktreeTool } = await import("./enter-worktree-P3DF2N6O.js");
151383
+ const { EnterWorktreeTool } = await import("./enter-worktree-B4FY2ZPP.js");
151076
151384
  return new EnterWorktreeTool(this);
151077
151385
  });
151078
151386
  await registerLazy(ToolNames.EXIT_WORKTREE, async () => {
151079
- const { ExitWorktreeTool } = await import("./exit-worktree-LV5RLOCU.js");
151387
+ const { ExitWorktreeTool } = await import("./exit-worktree-EYUD4YP2.js");
151080
151388
  return new ExitWorktreeTool(this);
151081
151389
  });
151082
151390
  await registerLazy(ToolNames.WEB_FETCH, async () => {
151083
- const { WebFetchTool } = await import("./web-fetch-JQCJHEEX.js");
151391
+ const { WebFetchTool } = await import("./web-fetch-5ZLLLCDD.js");
151084
151392
  return new WebFetchTool(this);
151085
151393
  });
151086
151394
  if (resolveInteractionMode(this) === "interactive" && !this.sdkMode && !this.getScreenReader() && !options2?.forSubAgent) {
151087
151395
  await registerLazy(ToolNames.DISPLAY_IMAGE, async () => {
151088
- const { DisplayImageTool } = await import("./display-image-GUJA352B.js");
151396
+ const { DisplayImageTool } = await import("./display-image-NQRSIBXM.js");
151089
151397
  return new DisplayImageTool(this);
151090
151398
  });
151091
151399
  }
151092
151400
  if (this.webSearchSettings?.enabled) {
151093
- const { evaluateWebSearchGate } = await import("./web-search-QGZ2KY4G.js");
151401
+ const { evaluateWebSearchGate } = await import("./web-search-NELKANTW.js");
151094
151402
  const gate = evaluateWebSearchGate(this);
151095
151403
  if (gate.ok) {
151096
151404
  await registerLazy(ToolNames.WEB_SEARCH, async () => {
151097
- const { WebSearchTool } = await import("./web-search-QGZ2KY4G.js");
151405
+ const { WebSearchTool } = await import("./web-search-NELKANTW.js");
151098
151406
  return new WebSearchTool(this);
151099
151407
  });
151100
151408
  } else if (!this.webSearchNoticeEmitted && !options2?.forSubAgent) {
@@ -151105,83 +151413,83 @@ var Config = class _Config {
151105
151413
  await this.registerImageGenerationTool(registry);
151106
151414
  if (this.isArtifactEnabled()) {
151107
151415
  await registerLazy(ToolNames.ARTIFACT, async () => {
151108
- const { ArtifactTool } = await import("./artifact-tool-RROCCJDA.js");
151416
+ const { ArtifactTool } = await import("./artifact-tool-N652YE4L.js");
151109
151417
  return new ArtifactTool(this);
151110
151418
  });
151111
151419
  }
151112
151420
  if (this.isRecordArtifactEnabled()) {
151113
151421
  await registerLazy(ToolNames.RECORD_ARTIFACT, async () => {
151114
- const { RecordArtifactTool } = await import("./record-artifact-E6AWQU2Z.js");
151422
+ const { RecordArtifactTool } = await import("./record-artifact-P4HFMS7X.js");
151115
151423
  return new RecordArtifactTool();
151116
151424
  });
151117
151425
  }
151118
151426
  if (this.isLspEnabled() && this.getLspClient()) {
151119
151427
  await registerLazy(ToolNames.LSP, async () => {
151120
- const { LspTool } = await import("./lsp-P6NVJVNT.js");
151428
+ const { LspTool } = await import("./lsp-CVN6OQPI.js");
151121
151429
  return new LspTool(this);
151122
151430
  });
151123
151431
  }
151124
151432
  await registerStructuredOutputIfRequested();
151125
151433
  if (this.isCronEnabled()) {
151126
151434
  await registerLazy(ToolNames.CRON_CREATE, async () => {
151127
- const { CronCreateTool } = await import("./cron-create-CCRIULJE.js");
151435
+ const { CronCreateTool } = await import("./cron-create-VONA5JYY.js");
151128
151436
  return new CronCreateTool(this);
151129
151437
  });
151130
151438
  await registerLazy(ToolNames.CRON_LIST, async () => {
151131
- const { CronListTool } = await import("./cron-list-QDBVCHRF.js");
151439
+ const { CronListTool } = await import("./cron-list-KE4F2CIR.js");
151132
151440
  return new CronListTool(this);
151133
151441
  });
151134
151442
  await registerLazy(ToolNames.CRON_DELETE, async () => {
151135
- const { CronDeleteTool } = await import("./cron-delete-FCFW6BGP.js");
151443
+ const { CronDeleteTool } = await import("./cron-delete-5JXSP2MI.js");
151136
151444
  return new CronDeleteTool(this);
151137
151445
  });
151138
151446
  await registerLazy(ToolNames.LOOP_WAKEUP, async () => {
151139
- const { LoopWakeupTool } = await import("./loop-wakeup-SQQSBMEY.js");
151447
+ const { LoopWakeupTool } = await import("./loop-wakeup-UZ5RL5Y2.js");
151140
151448
  return new LoopWakeupTool(this);
151141
151449
  });
151142
151450
  }
151143
151451
  await registerLazy(ToolNames.CREATE_SUB_SESSION, async () => {
151144
- const { CreateSubSessionTool } = await import("./create-sub-session-6EWLAZD5.js");
151452
+ const { CreateSubSessionTool } = await import("./create-sub-session-QIDZUOPU.js");
151145
151453
  return new CreateSubSessionTool(this);
151146
151454
  });
151147
151455
  if (this.isAgentTeamEnabled()) {
151148
151456
  await registerLazy(ToolNames.TEAM_CREATE, async () => {
151149
- const { TeamCreateTool } = await import("./team-create-GNC7NFY6.js");
151457
+ const { TeamCreateTool } = await import("./team-create-OTP5SSB2.js");
151150
151458
  return new TeamCreateTool(this);
151151
151459
  });
151152
151460
  await registerLazy(ToolNames.TEAM_DELETE, async () => {
151153
- const { TeamDeleteTool } = await import("./team-delete-GDO7H2T4.js");
151461
+ const { TeamDeleteTool } = await import("./team-delete-MMQB4OSC.js");
151154
151462
  return new TeamDeleteTool(this);
151155
151463
  });
151156
151464
  await registerLazy(ToolNames.TEAM_PLAN_APPROVAL, async () => {
151157
- const { TeamPlanApprovalTool } = await import("./team-plan-approval-ECALJLIO.js");
151465
+ const { TeamPlanApprovalTool } = await import("./team-plan-approval-TQX5TMXU.js");
151158
151466
  return new TeamPlanApprovalTool(this);
151159
151467
  });
151160
151468
  await registerLazy(ToolNames.TASK_CREATE, async () => {
151161
- const { TaskCreateTool } = await import("./task-create-Q727MXHJ.js");
151469
+ const { TaskCreateTool } = await import("./task-create-5NWCQSJF.js");
151162
151470
  return new TaskCreateTool(this);
151163
151471
  });
151164
151472
  await registerLazy(ToolNames.TASK_UPDATE, async () => {
151165
- const { TaskUpdateTool } = await import("./task-update-YB7PXO4R.js");
151473
+ const { TaskUpdateTool } = await import("./task-update-5HN577LS.js");
151166
151474
  return new TaskUpdateTool(this);
151167
151475
  });
151168
151476
  await registerLazy(ToolNames.TASK_LIST, async () => {
151169
- const { TaskListTool } = await import("./task-list-G6KPQ5JT.js");
151477
+ const { TaskListTool } = await import("./task-list-53265TRZ.js");
151170
151478
  return new TaskListTool(this);
151171
151479
  });
151172
151480
  }
151173
151481
  if (this.isWorkflowsEnabled()) {
151174
151482
  await registerLazy(ToolNames.WORKFLOW, async () => {
151175
- const { WorkflowTool } = await import("./workflow-YIT27YWZ.js");
151483
+ const { WorkflowTool } = await import("./workflow-RXKBF3LO.js");
151176
151484
  return new WorkflowTool(this);
151177
151485
  });
151178
151486
  }
151179
151487
  if (this.isComputerUseEnabled()) {
151180
- const { registerComputerUseTools } = await import("./computer-use-5HXJ2P4X.js");
151488
+ const { registerComputerUseTools } = await import("./computer-use-QLJ27OCZ.js");
151181
151489
  await registerComputerUseTools(registerLazy, this);
151182
151490
  }
151183
151491
  await registerLazy(ToolNames.MONITOR, async () => {
151184
- const { MonitorTool } = await import("./monitor-4T7W4M6Q.js");
151492
+ const { MonitorTool } = await import("./monitor-FDWEJQWP.js");
151185
151493
  return new MonitorTool(this);
151186
151494
  });
151187
151495
  if (this.pendingMcpBudgetCallback) {
@@ -151661,12 +151969,15 @@ export {
151661
151969
  SESSION_TRANSCRIPT_MAX_LIMIT,
151662
151970
  SESSION_TRANSCRIPT_MAX_INDEX_BYTES,
151663
151971
  SESSION_TRANSCRIPT_MAX_PAGE_BYTES,
151972
+ SESSION_TRANSCRIPT_MAX_EXPANDED_PAGE_BYTES,
151664
151973
  InvalidSessionTranscriptCursorError,
151665
151974
  SessionTranscriptSnapshotUnavailableError,
151666
151975
  SessionTranscriptTooLargeError,
151667
151976
  SessionTranscriptPageTooLargeError,
151668
151977
  SessionTranscriptCursorCodec,
151669
151978
  encodeSessionTranscriptCursor,
151979
+ isReplayTurnStartType,
151980
+ findBoundaryAtOrBefore,
151670
151981
  SessionTranscriptReader,
151671
151982
  SessionWriterError,
151672
151983
  SESSION_WRITER_RPC_CODES,
@@ -151684,7 +151995,10 @@ export {
151684
151995
  acquireSleepInhibitor,
151685
151996
  approxBase64Bytes,
151686
151997
  clampInlineMediaPart,
151998
+ GLOBAL_DUPLICATE_THRESHOLD,
151687
151999
  DEFAULT_MAX_TOOL_CALLS_PER_TURN,
152000
+ getToolCallRepeatKey,
152001
+ shouldHaltOnTurnToolCallCap,
151688
152002
  CommitAttributionService,
151689
152003
  generateToolUseId,
151690
152004
  firePreToolUseHook,
@@ -151751,6 +152065,7 @@ export {
151751
152065
  sessionIdContext,
151752
152066
  getShellContextEnvVars,
151753
152067
  getShellPagerEnv,
152068
+ isSignalTermination,
151754
152069
  ShellExecutionService,
151755
152070
  escape,
151756
152071
  globStream,
@@ -151775,7 +152090,6 @@ export {
151775
152090
  IdeClient,
151776
152091
  bridgeToolResultImages,
151777
152092
  evaluateToolInvocationGuard,
151778
- canonicalToolName2 as canonicalToolName,
151779
152093
  convertToFunctionResponse,
151780
152094
  convertToFunctionErrorResponse,
151781
152095
  isToolCallConcurrencySafe,
@@ -151810,6 +152124,9 @@ export {
151810
152124
  MAX_RECENT_ACTIVITIES,
151811
152125
  buildBackgroundEntryLabel,
151812
152126
  runForkedAgent,
152127
+ didWriteProjectContextFile,
152128
+ refreshMemoryInstruction,
152129
+ refreshMemoryAfterManagedWrite,
151813
152130
  runManagedAutoMemoryDream,
151814
152131
  MessageDisplayDispatcher,
151815
152132
  collectMemoryDiagnostics,
@@ -151900,6 +152217,7 @@ export {
151900
152217
  TURN_INTERRUPTION_HISTORY_TAIL_COUNT,
151901
152218
  buildSessionRecoveryPlan,
151902
152219
  buildSessionRecoveryPlanFromApiHistory,
152220
+ runWithTimeout,
151903
152221
  McpTransportPool,
151904
152222
  WorkspaceMcpBudget,
151905
152223
  ClientMcpRegistrar,
@@ -151939,8 +152257,6 @@ export {
151939
152257
  buildManagedRememberPrompt,
151940
152258
  buildBareRememberPrompt,
151941
152259
  runManagedRememberByAgent,
151942
- refreshMemoryInstruction,
151943
- refreshMemoryAfterManagedWrite,
151944
152260
  parseLearnVideoInput,
151945
152261
  buildLearnSkillPrompt,
151946
152262
  buildLearnVideoSkillRequest,