@qwen-code/qwen-code 0.21.12 → 0.21.13

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 (303) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +7 -5
  2. package/bundled/qc-helper/docs/features/code-review.md +13 -12
  3. package/bundled/review/SKILL.md +96 -68
  4. package/chunks/{MaxSizedBox-ZSJJ2D5S.js → MaxSizedBox-UQALOVVT.js} +41 -41
  5. package/chunks/{StandaloneSessionPicker-WHUHQXSA.js → StandaloneSessionPicker-KEGXNUG6.js} +62 -62
  6. package/chunks/{acp-startup-profiler-SVPUHLXV.js → acp-startup-profiler-NMDXYGDN.js} +2 -2
  7. package/chunks/{acpAgent-7JOAESF5.js → acpAgent-XPES32S7.js} +533 -286
  8. package/chunks/{agent-E6V3VXQR.js → agent-DPTOZFEM.js} +38 -38
  9. package/chunks/{agent-headless-OEQNFOMH.js → agent-headless-GJCQMURW.js} +38 -38
  10. package/chunks/{anthropicContentGenerator-YDT4EOKO.js → anthropicContentGenerator-G7BVXTKN.js} +6 -6
  11. package/chunks/{artifact-tool-4GCQQDZI.js → artifact-tool-GEXTOPVO.js} +2 -2
  12. package/chunks/{askUserQuestion-HZJJLR3Z.js → askUserQuestion-B33XRSB7.js} +2 -2
  13. package/chunks/{bridge-NPBV53UA.js → bridge-YNQBAA4Z.js} +42 -42
  14. package/chunks/{channel-management-service-OADNGQM3.js → channel-management-service-GWY2GAIC.js} +1 -1
  15. package/chunks/{channel-settings-store-4ODLJ4X2.js → channel-settings-store-WNWYFHG7.js} +45 -45
  16. package/chunks/{channel-worker-group-IHBIHQ45.js → channel-worker-group-7LXCMZ77.js} +4 -4
  17. package/chunks/{channel-worker-manager-GEHYJ5AE.js → channel-worker-manager-RYEME4ZZ.js} +4 -4
  18. package/chunks/{channel-worker-supervisor-ZJIIWM4I.js → channel-worker-supervisor-OEVWBHGT.js} +2 -2
  19. package/chunks/{chunk-5RUCD4ED.js → chunk-25EYDK42.js} +3 -3
  20. package/chunks/{chunk-2ZWH53I4.js → chunk-2B2BF7P7.js} +3 -3
  21. package/chunks/{chunk-OYWVIXHT.js → chunk-2M55OBEB.js} +1 -1
  22. package/chunks/{chunk-GZDWTBT3.js → chunk-3EZLLVDF.js} +2 -2
  23. package/chunks/{chunk-V6OBVAST.js → chunk-3U3VAL47.js} +1 -1
  24. package/chunks/{chunk-KWX56CHZ.js → chunk-4PKCUT7F.js} +7 -7
  25. package/chunks/{chunk-EBPLKY6U.js → chunk-4S5337WV.js} +1229 -522
  26. package/chunks/{chunk-QLTATTPS.js → chunk-5CVO7YES.js} +1 -1
  27. package/chunks/{chunk-I7BT2MME.js → chunk-5EYKMUUY.js} +1 -1
  28. package/chunks/{chunk-YIGGWOJE.js → chunk-6HY6IF3Z.js} +1 -1
  29. package/chunks/{chunk-LCX5B364.js → chunk-6ORZ2EDC.js} +3 -3
  30. package/chunks/{chunk-OWGRUU7F.js → chunk-6QFDQMQX.js} +1 -1
  31. package/chunks/{chunk-5AFGJNY6.js → chunk-6YKYPVDV.js} +4 -4
  32. package/chunks/{chunk-X5SLJOMF.js → chunk-76J3IJ3M.js} +4 -4
  33. package/chunks/{chunk-YX2RDGAL.js → chunk-7UXUJ5T3.js} +1 -1
  34. package/chunks/{chunk-3GDBZJD6.js → chunk-A267JX7H.js} +6 -6
  35. package/chunks/{chunk-DD6O3ZRD.js → chunk-A4MFR4C5.js} +1 -1
  36. package/chunks/{chunk-LUISTZXI.js → chunk-AA2BEKV3.js} +2 -2
  37. package/chunks/{chunk-4XA4QIUA.js → chunk-AFSG32D5.js} +1 -1
  38. package/chunks/{chunk-B4VN3VDH.js → chunk-AS5IN4GK.js} +5 -5
  39. package/chunks/{chunk-MELQSJOU.js → chunk-AW4TRXOC.js} +1 -1
  40. package/chunks/{chunk-EJOGLSNJ.js → chunk-AXN7UPYQ.js} +1 -1
  41. package/chunks/{chunk-CGM3E75C.js → chunk-BHILXOC3.js} +2 -2
  42. package/chunks/{chunk-7KJPO7YH.js → chunk-BKPPWD33.js} +2 -2
  43. package/chunks/{chunk-HOSVOUDK.js → chunk-BUQDLC2G.js} +3 -0
  44. package/chunks/{chunk-2IVYL3IF.js → chunk-BVJS5BSP.js} +1 -1
  45. package/chunks/{chunk-TMFWI4RC.js → chunk-BZ263IKX.js} +1 -1
  46. package/chunks/{chunk-G6MUFRNI.js → chunk-CHHABXPE.js} +1 -1
  47. package/chunks/{chunk-YILJKX2T.js → chunk-CKSJECTU.js} +4 -4
  48. package/chunks/{chunk-4AOVQPJU.js → chunk-CPHEPGAO.js} +1 -1
  49. package/chunks/{chunk-OWXFBIB6.js → chunk-CU6GJD55.js} +1 -1
  50. package/chunks/{chunk-FMIH5KMQ.js → chunk-CZBYX5MY.js} +1 -1
  51. package/chunks/{chunk-S6TCTH4Z.js → chunk-DGK6P3BQ.js} +12 -12
  52. package/chunks/{chunk-QPBFRWCP.js → chunk-DGZEMW5R.js} +3 -3
  53. package/chunks/{chunk-NW2GIPG3.js → chunk-DXIBNLBZ.js} +2 -2
  54. package/chunks/{chunk-FA5K6YI2.js → chunk-E23IPNGS.js} +25 -2
  55. package/chunks/{chunk-ULNWG62W.js → chunk-E3DYKPYZ.js} +3 -3
  56. package/chunks/{chunk-N4SVADAV.js → chunk-EL5SXY3T.js} +4 -3
  57. package/chunks/{chunk-YCHNAKC5.js → chunk-EZ5RP345.js} +11 -11
  58. package/chunks/{chunk-D7QGE3RT.js → chunk-FAAUPSY2.js} +1 -1
  59. package/chunks/{chunk-YBHUXEC6.js → chunk-FDGGZIYW.js} +1 -1
  60. package/chunks/{chunk-CIDQISGM.js → chunk-GGDBMYGZ.js} +5 -5
  61. package/chunks/{chunk-DG4IQ6JG.js → chunk-GMIEIY3Y.js} +3 -3
  62. package/chunks/{chunk-ZQUY3ZJU.js → chunk-GO7STP6N.js} +4 -4
  63. package/chunks/{chunk-3AEKDXKT.js → chunk-H4A72DE5.js} +1 -1
  64. package/chunks/{chunk-IRSLAS4M.js → chunk-HUTNYWBG.js} +2 -2
  65. package/chunks/{chunk-ZBB5EZZV.js → chunk-IA2K2HJE.js} +2 -2
  66. package/chunks/{chunk-IX4PWUDU.js → chunk-IGGGG5CX.js} +4329 -1586
  67. package/chunks/{chunk-ZMY2P4L3.js → chunk-IWPYVAO2.js} +4 -4
  68. package/chunks/{chunk-WCEI6J56.js → chunk-JNDY2MDR.js} +2 -2
  69. package/chunks/{chunk-3LDGOQXZ.js → chunk-JOOFMXGF.js} +6 -6
  70. package/chunks/{chunk-RDVNSJQU.js → chunk-JUEPY766.js} +3 -3
  71. package/chunks/{chunk-QBJYSIQ4.js → chunk-K3LPAED5.js} +53 -12
  72. package/chunks/{chunk-FRHQQC2Z.js → chunk-KBXKR5R2.js} +1 -1
  73. package/chunks/{chunk-PTSEETCO.js → chunk-KD5BOPLP.js} +12 -12
  74. package/chunks/{chunk-CPFFU46D.js → chunk-KV27IEHM.js} +1 -1
  75. package/chunks/{chunk-6P5EXEBL.js → chunk-LJQAUZMR.js} +207 -146
  76. package/chunks/{chunk-56HVDG3M.js → chunk-M732YJPW.js} +6 -6
  77. package/chunks/{chunk-LSRI3ND3.js → chunk-MA2HEDVP.js} +1 -1
  78. package/chunks/{chunk-XH3KAV2G.js → chunk-MC4TLKEI.js} +2 -2
  79. package/chunks/{chunk-YBVVOSOH.js → chunk-MIPFDQAF.js} +1 -1
  80. package/chunks/{chunk-47BGDLJG.js → chunk-MLPXSYXR.js} +31 -18
  81. package/chunks/{chunk-KRXPRVGL.js → chunk-MLXTMF7H.js} +0 -1
  82. package/chunks/{chunk-CQ6IPDQW.js → chunk-MRMJCLIY.js} +3 -3
  83. package/chunks/{chunk-62X3CM7Q.js → chunk-N5YPT6PH.js} +4 -4
  84. package/chunks/{chunk-OPVF453Q.js → chunk-NEFOOD54.js} +3 -3
  85. package/chunks/{chunk-DAV4QFD5.js → chunk-NHDR76JX.js} +44 -3
  86. package/chunks/{chunk-36XKGB7E.js → chunk-NM5V5OVW.js} +3 -3
  87. package/chunks/{chunk-QSD4UH74.js → chunk-NNHNLJ2X.js} +42 -42
  88. package/chunks/chunk-NYWWQ437.js +24 -0
  89. package/chunks/{chunk-MDNUCDKZ.js → chunk-O4D7SPJN.js} +2 -2
  90. package/chunks/{chunk-HG3UBTJ4.js → chunk-O565M6A4.js} +411 -10
  91. package/chunks/{chunk-BSR5AXZR.js → chunk-OD2WU5QY.js} +1 -1
  92. package/chunks/{chunk-DPTMKFIH.js → chunk-OMLJNPBE.js} +42 -12
  93. package/chunks/{chunk-Q4ZPYNIZ.js → chunk-OOQUVWIG.js} +4 -4
  94. package/chunks/{chunk-D2RNVVH6.js → chunk-OVZPVYZB.js} +2 -2
  95. package/chunks/{chunk-3GM5DLBI.js → chunk-OXCMMLED.js} +3 -3
  96. package/chunks/{chunk-BSSLSQEW.js → chunk-OY5RNSV4.js} +3 -3
  97. package/chunks/{chunk-PZW46OTB.js → chunk-P7MPQI75.js} +2 -2
  98. package/chunks/{chunk-6JEIRPLN.js → chunk-PP4FUZNV.js} +2 -2
  99. package/chunks/{chunk-DFVXU5YM.js → chunk-PQ36L4F5.js} +1 -1
  100. package/chunks/{chunk-VPV7WBVT.js → chunk-PT4I7NBA.js} +1 -1
  101. package/chunks/{chunk-VLHR7F4E.js → chunk-QF2NHSPB.js} +28 -28
  102. package/chunks/{chunk-NLFLYSS4.js → chunk-QFJ5JHQR.js} +1 -1
  103. package/chunks/{chunk-VIFA5VJD.js → chunk-QIH2HAEN.js} +1 -1
  104. package/chunks/{chunk-HTYND72J.js → chunk-QNQAPSN2.js} +1 -1
  105. package/chunks/{chunk-TDESMS7M.js → chunk-QRCNA3SR.js} +4 -4
  106. package/chunks/{chunk-IH4Z54RJ.js → chunk-QV5YN5YD.js} +5 -5
  107. package/chunks/{chunk-WI6GIM2M.js → chunk-RIAABG2K.js} +2 -2
  108. package/chunks/{chunk-UI5UGEF4.js → chunk-RLKC46YT.js} +16 -10
  109. package/chunks/{chunk-KEC5FHLM.js → chunk-ROIYNTHJ.js} +3 -3
  110. package/chunks/{chunk-4KM2SYK5.js → chunk-RVOJ2FBP.js} +8 -8
  111. package/chunks/{chunk-63FNZTWG.js → chunk-RWDNJBWN.js} +2 -2
  112. package/chunks/{chunk-FQDCO3CJ.js → chunk-S5DWMTHO.js} +5 -0
  113. package/chunks/{chunk-TTRH3RTQ.js → chunk-SG7ZP5PG.js} +4 -4
  114. package/chunks/{chunk-TXP5NGG3.js → chunk-SXCOEJO4.js} +1 -1
  115. package/chunks/{chunk-K34GJQOZ.js → chunk-TIGA2IVL.js} +3 -3
  116. package/chunks/chunk-TS6625XH.js +488 -0
  117. package/chunks/{chunk-WM3LUQLO.js → chunk-TUGSVUJB.js} +6 -6
  118. package/chunks/{chunk-XAFIL4BD.js → chunk-U3VNBPUO.js} +5 -5
  119. package/chunks/{chunk-WDVDVWJ3.js → chunk-UKMR3CKV.js} +6 -6
  120. package/chunks/{chunk-DEDESZDL.js → chunk-UPDOZBWO.js} +1 -1
  121. package/chunks/{chunk-MUNA4QDC.js → chunk-UZPM4XHR.js} +4 -4
  122. package/chunks/{chunk-6SPD4Z7F.js → chunk-V26NVGAU.js} +1 -1
  123. package/chunks/{chunk-XDRXOSAD.js → chunk-V57QC6WW.js} +2 -2
  124. package/chunks/{chunk-NX4A23LY.js → chunk-WFSTRPRO.js} +3 -3
  125. package/chunks/{chunk-H7TMVHKE.js → chunk-WGHHA7ZH.js} +1 -1
  126. package/chunks/{chunk-JRIVMPD2.js → chunk-WSH6GRKG.js} +4 -4
  127. package/chunks/{chunk-OR64CU46.js → chunk-X26JYGTD.js} +1 -1
  128. package/chunks/{chunk-RQJA2YYO.js → chunk-XHRY7BXD.js} +4 -4
  129. package/chunks/{chunk-MAKIANMX.js → chunk-XIT3GURH.js} +3 -3
  130. package/chunks/{chunk-KLOMACIR.js → chunk-XLLKYULU.js} +2 -2
  131. package/chunks/{chunk-PVXEJB66.js → chunk-XUJNK7Y6.js} +1 -1
  132. package/chunks/{chunk-AKBFSOC5.js → chunk-Y3YCSWG5.js} +2 -2
  133. package/chunks/{chunk-6ZKSO6K7.js → chunk-YEYY7TEP.js} +7 -7
  134. package/chunks/{chunk-TB4YFWXG.js → chunk-YZHRN3CF.js} +2 -2
  135. package/chunks/{chunk-TQDFSQQF.js → chunk-YZOSNW4R.js} +1 -1
  136. package/chunks/{chunk-GXTMEATA.js → chunk-ZYBBISBY.js} +7 -7
  137. package/chunks/{chunk-ROIJYS5K.js → chunk-ZYYTZUI2.js} +3 -3
  138. package/chunks/{chunk-CZ4OWGQQ.js → chunk-ZZO74WKW.js} +43 -5
  139. package/chunks/{computer-use-F4URV4TU.js → computer-use-77C5FHMW.js} +38 -38
  140. package/chunks/{config-utils-Z3OW3IQG.js → config-utils-IVHRSXWI.js} +2 -2
  141. package/chunks/{contextCommand-IGSS2U5J.js → contextCommand-PJ77GBWL.js} +40 -40
  142. package/chunks/{core-runtime-H5CZDN3A.js → core-runtime-7VMIKUTG.js} +38 -38
  143. package/chunks/{create-sub-session-PA7MFTHK.js → create-sub-session-2L5MQRN4.js} +38 -38
  144. package/chunks/{create-sub-session-XT6DLYOE.js → create-sub-session-KRQULJE6.js} +2 -2
  145. package/chunks/{cron-create-2JZ2TWTF.js → cron-create-H7UEPDSN.js} +4 -4
  146. package/chunks/{cron-delete-CTPD2P26.js → cron-delete-6SZK7YFM.js} +4 -4
  147. package/chunks/{cron-list-V44KHAF6.js → cron-list-H25JIHEZ.js} +4 -4
  148. package/chunks/{daemon-GED37WOX.js → daemon-2KTG7ZBN.js} +80 -8
  149. package/chunks/{daemon-git-worktree-guard-LZDCNJGV.js → daemon-git-worktree-guard-DXYIMWFT.js} +38 -38
  150. package/chunks/{daemon-status-provider-QYM57Z44.js → daemon-status-provider-ZDOYJCU6.js} +46 -46
  151. package/chunks/{daemon-trust-policy-TSRVEYZR.js → daemon-trust-policy-E67OYUK2.js} +44 -44
  152. package/chunks/{daemon-trust-policy-monitor-2K2YETMT.js → daemon-trust-policy-monitor-RYYGCQ3J.js} +44 -44
  153. package/chunks/{deferred-core-runtime-FKJ3OYE7.js → deferred-core-runtime-3SGXFXEQ.js} +38 -38
  154. package/chunks/discovery-ORA5J7YP.js +27 -0
  155. package/chunks/{display-image-M2ELAVN4.js → display-image-ON3EYFRD.js} +4 -4
  156. package/chunks/{earlyInputCapture-WJBSJQUF.js → earlyInputCapture-KJMLFVQV.js} +39 -39
  157. package/chunks/{edit-X73LA4YO.js → edit-I4LQFAEC.js} +38 -38
  158. package/chunks/{enter-worktree-CLRQTIVN.js → enter-worktree-YNPOJSRH.js} +38 -38
  159. package/chunks/{enterPlanMode-6BDYUQ5T.js → enterPlanMode-XCPK62ER.js} +38 -38
  160. package/chunks/{environment-WOAJXJDJ.js → environment-S7CTIHMX.js} +40 -40
  161. package/chunks/{errors-7OY5MXYY.js → errors-7HB2AIDS.js} +40 -40
  162. package/chunks/{exit-worktree-TFFJXCRT.js → exit-worktree-AIIY7SR6.js} +38 -38
  163. package/chunks/{exitPlanMode-WDURQMIU.js → exitPlanMode-R4JY7V2O.js} +38 -38
  164. package/chunks/{fast-path-QQLGC37M.js → fast-path-NDJV3ZFJ.js} +2 -2
  165. package/chunks/{gemini-VHE62IJL.js → gemini-RSUFP5OE.js} +86 -86
  166. package/chunks/{geminiContentGenerator-VSHIEGAQ.js → geminiContentGenerator-SQ5XBPZ7.js} +6 -6
  167. package/chunks/{glob-VMEEDDLO.js → glob-J4RUJAHX.js} +38 -38
  168. package/chunks/{goal-tools-M4UDAZXP.js → goal-tools-VHTNVOKK.js} +56 -12
  169. package/chunks/{grep-F4UAR7KX.js → grep-VJWPLFOT.js} +38 -38
  170. package/chunks/{handleAutoUpdate-GN7Z6QAC.js → handleAutoUpdate-POCX2MNB.js} +42 -42
  171. package/chunks/{i18n-ETW24DHW.js → i18n-RM5YOICI.js} +39 -39
  172. package/chunks/{image-gen-YPK2AZT4.js → image-gen-EXECB5XM.js} +10 -10
  173. package/chunks/{initializer-UA6KQ7MS.js → initializer-Z2AFGBNR.js} +45 -45
  174. package/chunks/{installationInfo-P7OTIR4P.js → installationInfo-4I5FXNMH.js} +39 -39
  175. package/chunks/{keychain-token-storage-NKKCUHI2.js → keychain-token-storage-3XFJ5ZB2.js} +2 -2
  176. package/chunks/{list-GRAMIQOT.js → list-ZMBFIGZA.js} +47 -47
  177. package/chunks/{list-agents-O6WSY4CT.js → list-agents-OSVDFI6S.js} +2 -2
  178. package/chunks/{loadedSettingsAdapter-5O2TDS3I.js → loadedSettingsAdapter-T6TV4YJ7.js} +44 -44
  179. package/chunks/{loggingContentGenerator-J2J2AANS.js → loggingContentGenerator-WF4ZOJEZ.js} +63 -39
  180. package/chunks/{loop-wakeup-GVQRMUKS.js → loop-wakeup-WQS6JYAG.js} +5 -5
  181. package/chunks/{ls-6W2D7TKU.js → ls-D3HUFHDP.js} +4 -4
  182. package/chunks/{lsp-NJ4KFBI2.js → lsp-3QDDJTCS.js} +2 -2
  183. package/chunks/{managed-npm-update-WMV5ITKU.js → managed-npm-update-E7IW6N7V.js} +39 -39
  184. package/chunks/{mcp-XLP33CAI.js → mcp-6UNYX4HG.js} +44 -44
  185. package/chunks/{monitor-2MM23VDV.js → monitor-EE2UYMGE.js} +38 -38
  186. package/chunks/{nonInteractiveCli-KTA5K6FS.js → nonInteractiveCli-WAY237O4.js} +79 -79
  187. package/chunks/{notebook-edit-QD4TRKLY.js → notebook-edit-NTDY4QDU.js} +38 -38
  188. package/chunks/{openaiContentGenerator-KLHSPVN2.js → openaiContentGenerator-YNFVJMRJ.js} +23 -23
  189. package/chunks/{pidfile-RQGZBNXT.js → pidfile-4XSFLYBZ.js} +39 -39
  190. package/chunks/{processUtils-HZZDA2VV.js → processUtils-WDA2MJFD.js} +2 -2
  191. package/chunks/proper-lockfile-3LHWIM44.js +8 -0
  192. package/chunks/{qwenContentGenerator-T75M2Z3B.js → qwenContentGenerator-434M7QKY.js} +43 -43
  193. package/chunks/{qwenOAuth2-5QZU444W.js → qwenOAuth2-GMYZOO6A.js} +9 -9
  194. package/chunks/{read-file-LOVUSBJC.js → read-file-TAFBKMNI.js} +11 -11
  195. package/chunks/{read-mcp-resource-GWCP23WG.js → read-mcp-resource-XD54ZQMC.js} +2 -2
  196. package/chunks/{record-artifact-IYQDEYMV.js → record-artifact-SEYFJEJF.js} +3 -3
  197. package/chunks/{resumeHistoryUtils-LVKSSQII.js → resumeHistoryUtils-EVG3WYK2.js} +45 -45
  198. package/chunks/{ripGrep-ZJSHKB6H.js → ripGrep-WOEK2PXS.js} +38 -38
  199. package/chunks/{run-qwen-serve-GZW7B4WK.js → run-qwen-serve-3QSGRXAN.js} +411 -209
  200. package/chunks/{runtime-MYRXEO2E.js → runtime-5MLLZ7DC.js} +47 -47
  201. package/chunks/{scheduler-DPTPI6FW.js → scheduler-RPBJ63CH.js} +40 -40
  202. package/chunks/{sdk-exporters-http-NHBYB5FZ.js → sdk-exporters-http-XUVP63H6.js} +2 -2
  203. package/chunks/{sdk-impl-SK4P5WON.js → sdk-impl-YXUEN2Z2.js} +2 -2
  204. package/chunks/{send-message-O7FO63UK.js → send-message-VZENRWRH.js} +6 -6
  205. package/chunks/{serve-XCG4XCDA.js → serve-HS3XLPXU.js} +44 -44
  206. package/chunks/{server-AWQHKXLG.js → server-TC4A7AAZ.js} +3833 -1618
  207. package/chunks/{session-P5FKNCNR.js → session-UBOFXVMN.js} +80 -80
  208. package/chunks/{settings-CSYVIP2R.js → settings-D5644OM5.js} +43 -43
  209. package/chunks/{shell-EGTSUO2P.js → shell-3PZULQQV.js} +38 -38
  210. package/chunks/{skill-IFUD72GF.js → skill-PEVVXQ3L.js} +16 -16
  211. package/chunks/{skill-settings-YOE7LBHE.js → skill-settings-J65JKKES.js} +43 -43
  212. package/chunks/{spawnChannel-PQSZIOLY.js → spawnChannel-IYGXRHSQ.js} +40 -40
  213. package/chunks/{standalone-update-RB2EGUSF.js → standalone-update-IFM53PE7.js} +40 -40
  214. package/chunks/{startInteractiveUI-KMYUJ2MU.js → startInteractiveUI-3AVH7L6H.js} +417 -168
  215. package/chunks/{syntheticOutput-DVHJMUGV.js → syntheticOutput-7GWFIDXT.js} +3 -3
  216. package/chunks/{task-create-4NC7PDI4.js → task-create-FCBDX7UH.js} +11 -11
  217. package/chunks/{task-list-LBSRMOC7.js → task-list-YIYIUFUA.js} +6 -6
  218. package/chunks/{task-stop-YFNATTIM.js → task-stop-X37KYTKB.js} +2 -2
  219. package/chunks/{task-update-BPLM52GD.js → task-update-MYPFVOVM.js} +11 -11
  220. package/chunks/{team-create-B6A6MJBT.js → team-create-ZAIA7KAV.js} +38 -38
  221. package/chunks/{team-delete-MKYMYBFM.js → team-delete-6UMU4XLS.js} +6 -6
  222. package/chunks/{team-plan-approval-5WO3CXXU.js → team-plan-approval-UNIUS7OD.js} +38 -38
  223. package/chunks/{terminal-image-renderer-BTRE2GEU.js → terminal-image-renderer-G343P2RV.js} +40 -40
  224. package/chunks/{theme-manager-XL2N5SBY.js → theme-manager-Z3RIT7DB.js} +39 -39
  225. package/chunks/{todoWrite-K5K7NRE5.js → todoWrite-U2R4NVF4.js} +4 -4
  226. package/chunks/{tool-search-QNBLXUGR.js → tool-search-5R2OE4C7.js} +15 -15
  227. package/chunks/{total-session-admission-N4E5SFBO.js → total-session-admission-4KBHMQQ2.js} +42 -42
  228. package/chunks/{trustedFolders-MQS46LIU.js → trustedFolders-LK6T4XC7.js} +39 -39
  229. package/chunks/{update-relaunch-536KRL33.js → update-relaunch-UBKROIC6.js} +5 -5
  230. package/chunks/{updateCheck-QJI2SYWF.js → updateCheck-W4Y2GFSD.js} +42 -42
  231. package/chunks/{useAutoAcceptIndicator-7QASHD46.js → useAutoAcceptIndicator-C7BEICBF.js} +47 -47
  232. package/chunks/{validateNonInterActiveAuth-ZNRGWBLV.js → validateNonInterActiveAuth-LTEI2TB6.js} +76 -76
  233. package/chunks/{version-DBEQAFRW.js → version-G5A5DGVS.js} +1 -1
  234. package/chunks/{web-fetch-MBIVXKPE.js → web-fetch-RTEQTR5Z.js} +15 -15
  235. package/chunks/{web-search-4LBIN6VF.js → web-search-5OXHEZPV.js} +9 -9
  236. package/chunks/{workflow-LNMA55HY.js → workflow-ISQJHPG2.js} +39 -39
  237. package/chunks/{workspace-providers-status-PDDMI6ST.js → workspace-providers-status-2ZPZPUPZ.js} +47 -47
  238. package/chunks/{workspace-registration-store-BGRKKIYR.js → workspace-registration-store-CYNY6IP6.js} +2 -2
  239. package/chunks/{workspace-registry-L4NCJ34K.js → workspace-registry-34GTUUHB.js} +44 -43
  240. package/chunks/{workspace-service-LOXYKYTR.js → workspace-service-XCDQLE2Y.js} +50 -50
  241. package/chunks/{workspace-skills-status-IJ5FOQI6.js → workspace-skills-status-RS4O7AIJ.js} +45 -45
  242. package/chunks/{workspace-trust-reconciler-H36TCR2S.js → workspace-trust-reconciler-AYGXC7A3.js} +53 -52
  243. package/chunks/{write-file-JJAY7JSP.js → write-file-EWXKVVXF.js} +38 -38
  244. package/chunks/{zoom-image-4MVVVM7E.js → zoom-image-4BFYJ3HG.js} +11 -11
  245. package/cli.js +13 -13
  246. package/package.json +3 -3
  247. package/web-shell/assets/{arc-B-89zHN4.js → arc-CgOpDKvm.js} +1 -1
  248. package/web-shell/assets/{architectureDiagram-3BPJPVTR-BkcOncHk.js → architectureDiagram-3BPJPVTR-0Ag_m34F.js} +1 -1
  249. package/web-shell/assets/{blockDiagram-GPEHLZMM-DQ4yboaF.js → blockDiagram-GPEHLZMM-IwTwFau0.js} +1 -1
  250. package/web-shell/assets/{c4Diagram-AAUBKEIU-C_8ZjPDI.js → c4Diagram-AAUBKEIU-DLa5GUv8.js} +1 -1
  251. package/web-shell/assets/channel-BrGVBa2L.js +1 -0
  252. package/web-shell/assets/{chunk-2J33WTMH-naKVe1Bm.js → chunk-2J33WTMH-DcYP-WFG.js} +1 -1
  253. package/web-shell/assets/{chunk-4BX2VUAB-DdoViKT2.js → chunk-4BX2VUAB-C8MVPMiQ.js} +1 -1
  254. package/web-shell/assets/{chunk-55IACEB6-DUDQZEwU.js → chunk-55IACEB6-BUi4Yfv3.js} +1 -1
  255. package/web-shell/assets/{chunk-727SXJPM-BqpDTR5s.js → chunk-727SXJPM-Cy3Su2YY.js} +1 -1
  256. package/web-shell/assets/{chunk-AQP2D5EJ-CdmEknkT.js → chunk-AQP2D5EJ-Dp8Teqv6.js} +1 -1
  257. package/web-shell/assets/{chunk-FMBD7UC4-CH7fFTLB.js → chunk-FMBD7UC4-BDTDM-4j.js} +1 -1
  258. package/web-shell/assets/{chunk-ND2GUHAM-ObgSuFKF.js → chunk-ND2GUHAM-7HfDt0r2.js} +1 -1
  259. package/web-shell/assets/{chunk-QZHKN3VN-D9fKdv_s.js → chunk-QZHKN3VN-BIBU0uCF.js} +1 -1
  260. package/web-shell/assets/classDiagram-4FO5ZUOK-B5TUzJzI.js +1 -0
  261. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-B5TUzJzI.js +1 -0
  262. package/web-shell/assets/{cose-bilkent-S5V4N54A-CvzATMx9.js → cose-bilkent-S5V4N54A-DRLdcg9p.js} +1 -1
  263. package/web-shell/assets/{dagre-BM42HDAG-M_xU21QW.js → dagre-BM42HDAG-DCCgDwqW.js} +1 -1
  264. package/web-shell/assets/{diagram-2AECGRRQ-CNrl9sW1.js → diagram-2AECGRRQ-CsBTBmk3.js} +1 -1
  265. package/web-shell/assets/{diagram-5GNKFQAL-CUweVT6T.js → diagram-5GNKFQAL-C9qjH8Lt.js} +1 -1
  266. package/web-shell/assets/{diagram-KO2AKTUF-D3n6Lxjo.js → diagram-KO2AKTUF-Brjs_lj2.js} +1 -1
  267. package/web-shell/assets/{diagram-LMA3HP47-0SeFPK4t.js → diagram-LMA3HP47-DtiWCl_F.js} +1 -1
  268. package/web-shell/assets/{diagram-OG6HWLK6-DAgyEwge.js → diagram-OG6HWLK6-DmfKLkBT.js} +1 -1
  269. package/web-shell/assets/{erDiagram-TEJ5UH35-CzxBBDIK.js → erDiagram-TEJ5UH35-Bve_4deH.js} +1 -1
  270. package/web-shell/assets/{flowDiagram-I6XJVG4X-B0uj0jyo.js → flowDiagram-I6XJVG4X-C2_kXCcV.js} +1 -1
  271. package/web-shell/assets/{ganttDiagram-6RSMTGT7-DFzcj5km.js → ganttDiagram-6RSMTGT7-BSBIjiTF.js} +1 -1
  272. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-DylJ_Fc9.js → gitGraphDiagram-PVQCEYII-CyebwI55.js} +1 -1
  273. package/web-shell/assets/index-CIDsgxTe.js +1792 -0
  274. package/web-shell/assets/{index-BIGQygTL.css → index-DiQnWi_E.css} +1 -1
  275. package/web-shell/assets/{index-BKSAnXU9.js → index-d0yfnV1M.js} +1 -1
  276. package/web-shell/assets/{infoDiagram-5YYISTIA-BYMcJVMI.js → infoDiagram-5YYISTIA-CSDGnWxU.js} +1 -1
  277. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-t1quI1S3.js → ishikawaDiagram-YF4QCWOH-BK4jU13p.js} +1 -1
  278. package/web-shell/assets/{journeyDiagram-JHISSGLW-YM_QVUJm.js → journeyDiagram-JHISSGLW-D_W6j-oF.js} +1 -1
  279. package/web-shell/assets/{kanban-definition-UN3LZRKU-jw8OddK1.js → kanban-definition-UN3LZRKU-C7xf-SdC.js} +1 -1
  280. package/web-shell/assets/{linear-Dlr3RVuP.js → linear-DQmzxpxd.js} +1 -1
  281. package/web-shell/assets/{mermaid.core-CqGKzNzd.js → mermaid.core-9P7AGOLG.js} +5 -5
  282. package/web-shell/assets/{mindmap-definition-RKZ34NQL-BqureoOS.js → mindmap-definition-RKZ34NQL-DgcgMyPk.js} +1 -1
  283. package/web-shell/assets/{pieDiagram-4H26LBE5-Da20HkK1.js → pieDiagram-4H26LBE5-3wWGb9eG.js} +1 -1
  284. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-BsNlMvJy.js → quadrantDiagram-W4KKPZXB-BeCXnQw9.js} +1 -1
  285. package/web-shell/assets/{requirementDiagram-4Y6WPE33-DzVCQCse.js → requirementDiagram-4Y6WPE33-Bi1UOHDz.js} +1 -1
  286. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-BMo16voT.js → sankeyDiagram-5OEKKPKP-lrLUjjbb.js} +1 -1
  287. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-Bgi-pdHk.js → sequenceDiagram-3UESZ5HK-BFuqKz6Q.js} +1 -1
  288. package/web-shell/assets/{stateDiagram-AJRCARHV-xaPQXwGk.js → stateDiagram-AJRCARHV-8DemQLhu.js} +1 -1
  289. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DhM5ixYd.js +1 -0
  290. package/web-shell/assets/{timeline-definition-PNZ67QCA-C_9RuvKG.js → timeline-definition-PNZ67QCA-uzEuVQXg.js} +1 -1
  291. package/web-shell/assets/{vennDiagram-CIIHVFJN-Bgu6vdla.js → vennDiagram-CIIHVFJN-BQTeZ_-o.js} +1 -1
  292. package/web-shell/assets/{wardley-L42UT6IY-CFTZ8IrX.js → wardley-L42UT6IY-B6yM5Im7.js} +1 -1
  293. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-BASW9Vmt.js → wardleyDiagram-YWT4CUSO-ChM8bmgn.js} +1 -1
  294. package/web-shell/assets/{xychartDiagram-2RQKCTM6--Nh-CD3F.js → xychartDiagram-2RQKCTM6-oNG6HyB1.js} +1 -1
  295. package/web-shell/index.html +2 -2
  296. package/chunks/discovery-XLHITE74.js +0 -220
  297. package/web-shell/assets/channel-Du2WFns8.js +0 -1
  298. package/web-shell/assets/classDiagram-4FO5ZUOK-Zw0HafH6.js +0 -1
  299. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-Zw0HafH6.js +0 -1
  300. package/web-shell/assets/index-J7OMTqAN.js +0 -1789
  301. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-D5RqimXD.js +0 -1
  302. package/chunks/{chunk-SYHXR6WM.js → chunk-4W5U2TUT.js} +3 -3
  303. /package/chunks/{chunk-OK47XBYH.js → chunk-A4QRWUDE.js} +0 -0
@@ -40,7 +40,7 @@ import {
40
40
  CronScheduler,
41
41
  DEFAULT_RECURRING_MAX_AGE_DAYS,
42
42
  normalizeRecurringMaxAge
43
- } from "./chunk-QPBFRWCP.js";
43
+ } from "./chunk-DGZEMW5R.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-JRIVMPD2.js";
52
+ } from "./chunk-WSH6GRKG.js";
53
53
  import {
54
54
  claimTask,
55
55
  listTasks,
56
56
  onTasksUpdated,
57
57
  unassignTeammateTasks
58
- } from "./chunk-YILJKX2T.js";
58
+ } from "./chunk-CKSJECTU.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-D2RNVVH6.js";
66
+ } from "./chunk-OVZPVYZB.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-I7BT2MME.js";
74
+ } from "./chunk-5EYKMUUY.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-DEDESZDL.js";
80
+ } from "./chunk-UPDOZBWO.js";
81
81
  import {
82
82
  promptIdContext,
83
83
  todoWorkChainContext
@@ -86,6 +86,22 @@ import {
86
86
  LEADER_NAME,
87
87
  MAX_TEAMMATES
88
88
  } from "./chunk-CPBF7KYF.js";
89
+ import {
90
+ APPROVAL_MODES,
91
+ READ_ONLY_INSPECTION_TOOLS,
92
+ SUBAGENT_PLAN_LIFECYCLE_TOOLS,
93
+ buildSubagentPlanToolBlockedResult,
94
+ getLeaderOnlyToolUnavailableMessage,
95
+ getPlanRequiredTeammatePreApprovalMessage,
96
+ getSubagentPlanToolUnavailableMessage,
97
+ isLeaderOnlyToolUnavailableInSubagent,
98
+ isPlanLifecycleToolUnavailableInSubagent,
99
+ isPlanRequiredTeammateAwaitingApproval,
100
+ isPlanRequiredTeammateContext,
101
+ isPlanRequiredTeammatePreApprovalAllowedTool,
102
+ isSubagentLikeExecutionContext,
103
+ shouldUsePlanOnlyReminderInSubagentContext
104
+ } from "./chunk-RWDNJBWN.js";
89
105
  import {
90
106
  SKILL_FILE_NAME,
91
107
  SKILL_NAME_PATTERN,
@@ -105,10 +121,7 @@ import {
105
121
  require_dist as require_dist2,
106
122
  stringify,
107
123
  validateSkillName
108
- } from "./chunk-5RUCD4ED.js";
109
- import {
110
- require_proper_lockfile
111
- } from "./chunk-KRXPRVGL.js";
124
+ } from "./chunk-25EYDK42.js";
112
125
  import {
113
126
  DefaultHookOutput,
114
127
  HOOKS_CONFIG_FIELDS,
@@ -123,15 +136,18 @@ import {
123
136
  createHookOutput,
124
137
  getHookKey,
125
138
  isToolArtifactLike
126
- } from "./chunk-YBVVOSOH.js";
139
+ } from "./chunk-MIPFDQAF.js";
140
+ import {
141
+ require_proper_lockfile
142
+ } from "./chunk-MLXTMF7H.js";
127
143
  import {
128
144
  BaseTokenStorage,
129
145
  KeychainTokenStorage
130
- } from "./chunk-CPFFU46D.js";
146
+ } from "./chunk-KV27IEHM.js";
131
147
  import {
132
148
  normalizeImageGenerationBaseUrl,
133
149
  resolveNetworkTarget
134
- } from "./chunk-ULNWG62W.js";
150
+ } from "./chunk-E3DYKPYZ.js";
135
151
  import {
136
152
  EvidenceSourceUnavailableError,
137
153
  GoalEvidenceCheckpointAccumulator,
@@ -157,23 +173,7 @@ import {
157
173
  validateTranscriptRecord,
158
174
  walkTranscriptUuidChain,
159
175
  wrapUserPromptSubmitContext
160
- } from "./chunk-DPTMKFIH.js";
161
- import {
162
- APPROVAL_MODES,
163
- READ_ONLY_INSPECTION_TOOLS,
164
- SUBAGENT_PLAN_LIFECYCLE_TOOLS,
165
- buildSubagentPlanToolBlockedResult,
166
- getLeaderOnlyToolUnavailableMessage,
167
- getPlanRequiredTeammatePreApprovalMessage,
168
- getSubagentPlanToolUnavailableMessage,
169
- isLeaderOnlyToolUnavailableInSubagent,
170
- isPlanLifecycleToolUnavailableInSubagent,
171
- isPlanRequiredTeammateAwaitingApproval,
172
- isPlanRequiredTeammateContext,
173
- isPlanRequiredTeammatePreApprovalAllowedTool,
174
- isSubagentLikeExecutionContext,
175
- shouldUsePlanOnlyReminderInSubagentContext
176
- } from "./chunk-63FNZTWG.js";
176
+ } from "./chunk-OMLJNPBE.js";
177
177
  import {
178
178
  AgentOutputMessageCapture,
179
179
  DEFAULT_OTLP_ENDPOINT,
@@ -183,14 +183,14 @@ import {
183
183
  addToolArgumentsAttributes,
184
184
  addToolCallResultAttributes,
185
185
  addUserPromptAttributes
186
- } from "./chunk-K34GJQOZ.js";
186
+ } from "./chunk-TIGA2IVL.js";
187
187
  import {
188
188
  supportsOpenAIPrefixCaching
189
189
  } from "./chunk-SAH4BD2J.js";
190
190
  import {
191
191
  DashScopeOpenAICompatibleProvider,
192
192
  selectDashScopeThinkingKnob
193
- } from "./chunk-KLOMACIR.js";
193
+ } from "./chunk-XLLKYULU.js";
194
194
  import {
195
195
  childLaunchDepth,
196
196
  getCurrentAgentDepth,
@@ -201,7 +201,7 @@ import {
201
201
  runWithAgentContext,
202
202
  runWithRuntimeContentGenerator,
203
203
  spawnBlockReason
204
- } from "./chunk-VPV7WBVT.js";
204
+ } from "./chunk-PT4I7NBA.js";
205
205
  import {
206
206
  getTeammateContext,
207
207
  isTeammate,
@@ -244,7 +244,7 @@ import {
244
244
  selectForkHistory,
245
245
  stripSystemReminderBlocks,
246
246
  validateForkToolList
247
- } from "./chunk-TTRH3RTQ.js";
247
+ } from "./chunk-SG7ZP5PG.js";
248
248
  import {
249
249
  collectAvailableSkillEntries,
250
250
  renderAvailableSkillsBlock
@@ -262,7 +262,7 @@ import {
262
262
  getQwenIgnoreFileNames,
263
263
  isPathWithinRoot,
264
264
  require_ignore
265
- } from "./chunk-FRHQQC2Z.js";
265
+ } from "./chunk-KBXKR5R2.js";
266
266
  import {
267
267
  openBrowserSecurely,
268
268
  shouldAttemptBrowserLaunch
@@ -270,11 +270,11 @@ import {
270
270
  import {
271
271
  isUnattendedMode,
272
272
  retryWithBackoff
273
- } from "./chunk-2ZWH53I4.js";
273
+ } from "./chunk-2B2BF7P7.js";
274
274
  import {
275
275
  classifyRetryError,
276
276
  isFallbackEligible
277
- } from "./chunk-TB4YFWXG.js";
277
+ } from "./chunk-YZHRN3CF.js";
278
278
  import {
279
279
  QUOTA_EXHAUSTED_PREFIX,
280
280
  formatQuotaExhaustedMessage,
@@ -284,7 +284,7 @@ import {
284
284
  isQuotaExhaustedError,
285
285
  isRateLimitError,
286
286
  isStructuredError
287
- } from "./chunk-D7QGE3RT.js";
287
+ } from "./chunk-FAAUPSY2.js";
288
288
  import {
289
289
  DEFAULT_OPENAI_BASE_URL
290
290
  } from "./chunk-AXMWHKXA.js";
@@ -414,7 +414,7 @@ import {
414
414
  updateMCPServerStatus,
415
415
  writeLine,
416
416
  writeLineSync
417
- } from "./chunk-4KM2SYK5.js";
417
+ } from "./chunk-RVOJ2FBP.js";
418
418
  import {
419
419
  defaultModalities,
420
420
  isTieredEffortWireModel
@@ -443,13 +443,13 @@ import {
443
443
  isManagedMemoryPath,
444
444
  isTeamAutoMemPath,
445
445
  isUserAutoMemPath
446
- } from "./chunk-G6MUFRNI.js";
446
+ } from "./chunk-CHHABXPE.js";
447
447
  import {
448
448
  runSideQuery
449
- } from "./chunk-LSRI3ND3.js";
449
+ } from "./chunk-MA2HEDVP.js";
450
450
  import {
451
451
  STRUCTURED_OUTPUT_REDACTED_ARGS
452
- } from "./chunk-PVXEJB66.js";
452
+ } from "./chunk-XUJNK7Y6.js";
453
453
  import {
454
454
  AgentStatistics,
455
455
  BaseDeclarativeTool,
@@ -468,7 +468,7 @@ import {
468
468
  require_dist,
469
469
  require_fast_deep_equal,
470
470
  require_fast_uri
471
- } from "./chunk-YIGGWOJE.js";
471
+ } from "./chunk-6HY6IF3Z.js";
472
472
  import {
473
473
  AUTH_ENV_MAPPINGS,
474
474
  AuthType,
@@ -480,7 +480,7 @@ import {
480
480
  createContentGenerator,
481
481
  resetPreloadedContentGenerator,
482
482
  resolveContentGeneratorConfigWithSources
483
- } from "./chunk-KWX56CHZ.js";
483
+ } from "./chunk-4PKCUT7F.js";
484
484
  import {
485
485
  DEFAULT_QWEN_EMBEDDING_MODEL,
486
486
  DEFAULT_QWEN_MODEL
@@ -504,13 +504,13 @@ import {
504
504
  preloadRuntimeFetchModule,
505
505
  redactProxyError,
506
506
  setResolvedProxyUrlForRuntimeFetch
507
- } from "./chunk-4AOVQPJU.js";
507
+ } from "./chunk-CPHEPGAO.js";
508
508
  import {
509
509
  atomicWriteFile,
510
510
  atomicWriteFileSync,
511
511
  atomicWriteJSON,
512
512
  renameWithRetry
513
- } from "./chunk-YBHUXEC6.js";
513
+ } from "./chunk-FDGGZIYW.js";
514
514
  import {
515
515
  endHookSpan,
516
516
  endInteractionSpan,
@@ -541,7 +541,7 @@ import {
541
541
  startToolSpan,
542
542
  stripAnsiAndControl,
543
543
  truncateSpanError
544
- } from "./chunk-N4SVADAV.js";
544
+ } from "./chunk-EL5SXY3T.js";
545
545
  import {
546
546
  safeJsonStringify
547
547
  } from "./chunk-HHJLM3WQ.js";
@@ -599,7 +599,7 @@ import {
599
599
  tildeifyPath,
600
600
  toFriendlyError,
601
601
  unescapePath
602
- } from "./chunk-HOSVOUDK.js";
602
+ } from "./chunk-BUQDLC2G.js";
603
603
  import {
604
604
  require_src
605
605
  } from "./chunk-AMDSOFFV.js";
@@ -939,7 +939,7 @@ var require_scan = __commonJS({
939
939
  const scanToEnd = opts.parts === true || opts.scanToEnd === true;
940
940
  const slashes = [];
941
941
  const tokens = [];
942
- const parts = [];
942
+ const parts2 = [];
943
943
  let str = input;
944
944
  let index = -1;
945
945
  let start = 0;
@@ -1196,13 +1196,13 @@ var require_scan = __commonJS({
1196
1196
  state.maxDepth += tokens[idx].depth;
1197
1197
  }
1198
1198
  if (idx !== 0 || value !== "") {
1199
- parts.push(value);
1199
+ parts2.push(value);
1200
1200
  }
1201
1201
  prevIndex = i;
1202
1202
  }
1203
1203
  if (prevIndex && prevIndex + 1 < input.length) {
1204
1204
  const value = input.slice(prevIndex + 1);
1205
- parts.push(value);
1205
+ parts2.push(value);
1206
1206
  if (opts.tokens) {
1207
1207
  tokens[tokens.length - 1].value = value;
1208
1208
  depth(tokens[tokens.length - 1]);
@@ -1210,7 +1210,7 @@ var require_scan = __commonJS({
1210
1210
  }
1211
1211
  }
1212
1212
  state.slashes = slashes;
1213
- state.parts = parts;
1213
+ state.parts = parts2;
1214
1214
  }
1215
1215
  return state;
1216
1216
  }, "scan");
@@ -1249,7 +1249,7 @@ var require_parse = __commonJS({
1249
1249
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
1250
1250
  }, "syntaxError");
1251
1251
  var splitTopLevel = /* @__PURE__ */ __name((input) => {
1252
- const parts = [];
1252
+ const parts2 = [];
1253
1253
  let bracket = 0;
1254
1254
  let paren = 0;
1255
1255
  let quote2 = 0;
@@ -1282,7 +1282,7 @@ var require_parse = __commonJS({
1282
1282
  } else if (ch === ")" && paren > 0) {
1283
1283
  paren--;
1284
1284
  } else if (ch === "|" && paren === 0) {
1285
- parts.push(value);
1285
+ parts2.push(value);
1286
1286
  value = "";
1287
1287
  continue;
1288
1288
  }
@@ -1290,8 +1290,8 @@ var require_parse = __commonJS({
1290
1290
  }
1291
1291
  value += ch;
1292
1292
  }
1293
- parts.push(value);
1294
- return parts;
1293
+ parts2.push(value);
1294
+ return parts2;
1295
1295
  }, "splitTopLevel");
1296
1296
  var isPlainBranch = /* @__PURE__ */ __name((branch) => {
1297
1297
  let escaped = false;
@@ -9451,7 +9451,7 @@ var require_brace_expansion = __commonJS({
9451
9451
  function parseCommaParts(str) {
9452
9452
  if (!str)
9453
9453
  return [""];
9454
- var parts = [];
9454
+ var parts2 = [];
9455
9455
  var m2 = balanced("{", "}", str);
9456
9456
  if (!m2)
9457
9457
  return str.split(",");
@@ -9465,8 +9465,8 @@ var require_brace_expansion = __commonJS({
9465
9465
  p2[p2.length - 1] += postParts.shift();
9466
9466
  p2.push.apply(p2, postParts);
9467
9467
  }
9468
- parts.push.apply(parts, p2);
9469
- return parts;
9468
+ parts2.push.apply(parts2, p2);
9469
+ return parts2;
9470
9470
  }
9471
9471
  __name(parseCommaParts, "parseCommaParts");
9472
9472
  function expandTop(str, options2) {
@@ -13972,12 +13972,12 @@ var require_datepart = __commonJS({
13972
13972
  constructor({
13973
13973
  token,
13974
13974
  date,
13975
- parts,
13975
+ parts: parts2,
13976
13976
  locales
13977
13977
  }) {
13978
13978
  this.token = token;
13979
13979
  this.date = date || /* @__PURE__ */ new Date();
13980
- this.parts = parts || [this];
13980
+ this.parts = parts2 || [this];
13981
13981
  this.locales = locales || {};
13982
13982
  }
13983
13983
  up() {
@@ -13991,9 +13991,9 @@ var require_datepart = __commonJS({
13991
13991
  setTo(val) {
13992
13992
  }
13993
13993
  prev() {
13994
- let parts = [].concat(this.parts).reverse();
13995
- const currentIdx = parts.indexOf(this);
13996
- return parts.find((part, idx) => idx > currentIdx && part instanceof _DatePart);
13994
+ let parts2 = [].concat(this.parts).reverse();
13995
+ const currentIdx = parts2.indexOf(this);
13996
+ return parts2.find((part, idx) => idx > currentIdx && part instanceof _DatePart);
13997
13997
  }
13998
13998
  toString() {
13999
13999
  return String(this.date);
@@ -14398,13 +14398,13 @@ var require_date = __commonJS({
14398
14398
  locales: this.locales
14399
14399
  }) : result[idx] || match2);
14400
14400
  }
14401
- let parts = this.parts.reduce((arr, i) => {
14401
+ let parts2 = this.parts.reduce((arr, i) => {
14402
14402
  if (typeof i === "string" && typeof arr[arr.length - 1] === "string") arr[arr.length - 1] += i;
14403
14403
  else arr.push(i);
14404
14404
  return arr;
14405
14405
  }, []);
14406
14406
  this.parts.splice(0);
14407
- this.parts.push(...parts);
14407
+ this.parts.push(...parts2);
14408
14408
  this.reset();
14409
14409
  }
14410
14410
  moveCursor(n) {
@@ -16507,10 +16507,10 @@ var require_datepart2 = __commonJS({
16507
16507
  static {
16508
16508
  __name(this, "DatePart");
16509
16509
  }
16510
- constructor({ token, date, parts, locales }) {
16510
+ constructor({ token, date, parts: parts2, locales }) {
16511
16511
  this.token = token;
16512
16512
  this.date = date || /* @__PURE__ */ new Date();
16513
- this.parts = parts || [this];
16513
+ this.parts = parts2 || [this];
16514
16514
  this.locales = locales || {};
16515
16515
  }
16516
16516
  up() {
@@ -16524,9 +16524,9 @@ var require_datepart2 = __commonJS({
16524
16524
  setTo(val) {
16525
16525
  }
16526
16526
  prev() {
16527
- let parts = [].concat(this.parts).reverse();
16528
- const currentIdx = parts.indexOf(this);
16529
- return parts.find((part, idx) => idx > currentIdx && part instanceof _DatePart);
16527
+ let parts2 = [].concat(this.parts).reverse();
16528
+ const currentIdx = parts2.indexOf(this);
16529
+ return parts2.find((part, idx) => idx > currentIdx && part instanceof _DatePart);
16530
16530
  }
16531
16531
  toString() {
16532
16532
  return String(this.date);
@@ -16878,14 +16878,14 @@ var require_date2 = __commonJS({
16878
16878
  let idx = result.findIndex((gr2) => gr2 != null);
16879
16879
  this.parts.push(idx in regexGroups ? regexGroups[idx]({ token: result[idx] || match2, date: this.date, parts: this.parts, locales: this.locales }) : result[idx] || match2);
16880
16880
  }
16881
- let parts = this.parts.reduce((arr, i) => {
16881
+ let parts2 = this.parts.reduce((arr, i) => {
16882
16882
  if (typeof i === "string" && typeof arr[arr.length - 1] === "string")
16883
16883
  arr[arr.length - 1] += i;
16884
16884
  else arr.push(i);
16885
16885
  return arr;
16886
16886
  }, []);
16887
16887
  this.parts.splice(0);
16888
- this.parts.push(...parts);
16888
+ this.parts.push(...parts2);
16889
16889
  this.reset();
16890
16890
  }
16891
16891
  moveCursor(n) {
@@ -19446,9 +19446,9 @@ function getResponseText(response) {
19446
19446
  return null;
19447
19447
  }
19448
19448
  __name(getResponseText, "getResponseText");
19449
- async function flatMapTextParts(parts, transform) {
19449
+ async function flatMapTextParts(parts2, transform) {
19450
19450
  const result = [];
19451
- const partArray = Array.isArray(parts) ? parts : typeof parts === "string" ? [{ text: parts }] : [parts];
19451
+ const partArray = Array.isArray(parts2) ? parts2 : typeof parts2 === "string" ? [{ text: parts2 }] : [parts2];
19452
19452
  for (const part of partArray) {
19453
19453
  let textToProcess;
19454
19454
  if (typeof part === "string") {
@@ -19516,11 +19516,11 @@ function prependToFirstTextPart(prompt, textToPrepend, separator = "\n\n") {
19516
19516
  __name(prependToFirstTextPart, "prependToFirstTextPart");
19517
19517
 
19518
19518
  // packages/core/src/utils/generateContentResponseUtilities.ts
19519
- function getResponseTextFromParts(parts) {
19520
- if (!parts) {
19519
+ function getResponseTextFromParts(parts2) {
19520
+ if (!parts2) {
19521
19521
  return void 0;
19522
19522
  }
19523
- const textSegments = parts.map((part) => part.text).filter((text) => typeof text === "string");
19523
+ const textSegments = parts2.map((part) => part.text).filter((text) => typeof text === "string");
19524
19524
  if (textSegments.length === 0) {
19525
19525
  return void 0;
19526
19526
  }
@@ -19536,12 +19536,12 @@ function sanitizeMediaLabel(value) {
19536
19536
  return cleaned.length > 0 ? cleaned : void 0;
19537
19537
  }
19538
19538
  __name(sanitizeMediaLabel, "sanitizeMediaLabel");
19539
- function getToolResponseDisplayText(parts) {
19540
- if (!parts || parts.length === 0) {
19539
+ function getToolResponseDisplayText(parts2) {
19540
+ if (!parts2 || parts2.length === 0) {
19541
19541
  return void 0;
19542
19542
  }
19543
19543
  const segments = [];
19544
- for (const part of parts) {
19544
+ for (const part of parts2) {
19545
19545
  const fr2 = part.functionResponse;
19546
19546
  if (!fr2) {
19547
19547
  if (typeof part.text === "string" && part.text.length > 0) {
@@ -19576,11 +19576,11 @@ function getToolResponseDisplayText(parts) {
19576
19576
  }
19577
19577
  __name(getToolResponseDisplayText, "getToolResponseDisplayText");
19578
19578
  function getFunctionCalls(response) {
19579
- const parts = response.candidates?.[0]?.content?.parts;
19580
- if (!parts) {
19579
+ const parts2 = response.candidates?.[0]?.content?.parts;
19580
+ if (!parts2) {
19581
19581
  return void 0;
19582
19582
  }
19583
- const functionCallParts = parts.filter((part) => !!part.functionCall).map((part) => part.functionCall);
19583
+ const functionCallParts = parts2.filter((part) => !!part.functionCall).map((part) => part.functionCall);
19584
19584
  if (functionCallParts.length === 2) {
19585
19585
  const [first, second] = functionCallParts;
19586
19586
  const firstHasNameOnly = first.name && (!first.args || Object.keys(first.args).length === 0);
@@ -19951,9 +19951,9 @@ var BaseLlmClient = class {
19951
19951
  );
19952
19952
  }, "onRetry")
19953
19953
  });
19954
- const functionCalls = getFunctionCalls(result);
19955
- if (functionCalls && functionCalls.length > 0) {
19956
- const functionCall = functionCalls.find(
19954
+ const functionCalls2 = getFunctionCalls(result);
19955
+ if (functionCalls2 && functionCalls2.length > 0) {
19956
+ const functionCall = functionCalls2.find(
19957
19957
  (call) => call.name === "respond_in_schema"
19958
19958
  );
19959
19959
  if (functionCall && functionCall.args) {
@@ -20599,12 +20599,12 @@ __name(buildKeepRefs, "buildKeepRefs");
20599
20599
  function buildClearMap(clearRefs) {
20600
20600
  const clearMap = /* @__PURE__ */ new Map();
20601
20601
  for (const ref of clearRefs) {
20602
- let parts = clearMap.get(ref.contentIndex);
20603
- if (!parts) {
20604
- parts = /* @__PURE__ */ new Map();
20605
- clearMap.set(ref.contentIndex, parts);
20602
+ let parts2 = clearMap.get(ref.contentIndex);
20603
+ if (!parts2) {
20604
+ parts2 = /* @__PURE__ */ new Map();
20605
+ clearMap.set(ref.contentIndex, parts2);
20606
20606
  }
20607
- parts.set(ref.partIndex, ref.kind);
20607
+ parts2.set(ref.partIndex, ref.kind);
20608
20608
  }
20609
20609
  return clearMap;
20610
20610
  }
@@ -22585,9 +22585,9 @@ function collectTextSlots(entries, includeTopLevelText = true, excludeBudgetExem
22585
22585
  const slots = [];
22586
22586
  for (let entryIndex = 0; entryIndex < entries.length; entryIndex++) {
22587
22587
  const entry = entries[entryIndex];
22588
- const parts = entry.responseParts;
22589
- for (let partIndex = 0; partIndex < parts.length; partIndex++) {
22590
- const part = parts[partIndex];
22588
+ const parts2 = entry.responseParts;
22589
+ for (let partIndex = 0; partIndex < parts2.length; partIndex++) {
22590
+ const part = parts2[partIndex];
22591
22591
  if (includeTopLevelText && typeof part.text === "string") {
22592
22592
  slots.push({
22593
22593
  entryIndex,
@@ -22739,9 +22739,9 @@ function replaceTextSlots(entries, slots, allocations) {
22739
22739
  return result;
22740
22740
  }
22741
22741
  __name(replaceTextSlots, "replaceTextSlots");
22742
- function toolResponseTextLength(parts) {
22742
+ function toolResponseTextLength(parts2) {
22743
22743
  return collectTextSlots(
22744
- [{ callId: "", toolName: "", responseParts: parts }],
22744
+ [{ callId: "", toolName: "", responseParts: parts2 }],
22745
22745
  true,
22746
22746
  false
22747
22747
  ).reduce((total, slot) => total + slot.text.length, 0);
@@ -23451,15 +23451,15 @@ init_esbuild_shims();
23451
23451
 
23452
23452
  // packages/core/src/hooks/user-prompt-submit-context.ts
23453
23453
  init_esbuild_shims();
23454
- function stripTrailingUserPromptSubmitContextPart(parts) {
23455
- if (parts.length <= 1) {
23456
- return parts;
23454
+ function stripTrailingUserPromptSubmitContextPart(parts2) {
23455
+ if (parts2.length <= 1) {
23456
+ return parts2;
23457
23457
  }
23458
- const last = parts[parts.length - 1];
23458
+ const last = parts2[parts2.length - 1];
23459
23459
  if (!last || typeof last.text !== "string" || !isUserPromptSubmitContextPartText(last.text)) {
23460
- return parts;
23460
+ return parts2;
23461
23461
  }
23462
- return parts.slice(0, -1);
23462
+ return parts2.slice(0, -1);
23463
23463
  }
23464
23464
  __name(stripTrailingUserPromptSubmitContextPart, "stripTrailingUserPromptSubmitContextPart");
23465
23465
 
@@ -24260,20 +24260,20 @@ wordDiff.equals = function(left, right, options2) {
24260
24260
  };
24261
24261
  wordDiff.tokenize = function(value) {
24262
24262
  var options2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
24263
- var parts;
24263
+ var parts2;
24264
24264
  if (options2.intlSegmenter) {
24265
24265
  if (options2.intlSegmenter.resolvedOptions().granularity != "word") {
24266
24266
  throw new Error('The segmenter passed must have a granularity of "word"');
24267
24267
  }
24268
- parts = Array.from(options2.intlSegmenter.segment(value), function(segment) {
24268
+ parts2 = Array.from(options2.intlSegmenter.segment(value), function(segment) {
24269
24269
  return segment.segment;
24270
24270
  });
24271
24271
  } else {
24272
- parts = value.match(tokenizeIncludingWhitespace) || [];
24272
+ parts2 = value.match(tokenizeIncludingWhitespace) || [];
24273
24273
  }
24274
24274
  var tokens = [];
24275
24275
  var prevPart = null;
24276
- parts.forEach(function(part) {
24276
+ parts2.forEach(function(part) {
24277
24277
  if (/\s/.test(part)) {
24278
24278
  if (prevPart == null) {
24279
24279
  tokens.push(part);
@@ -25590,17 +25590,17 @@ var MAX_LOG_LIMIT = 200;
25590
25590
  var DEFAULT_LOG_LIMIT = 50;
25591
25591
  var LOG_FORMAT = "%H%x00%h%x00%an%x00%ae%x00%at%x00%s%x00%D%x00%P";
25592
25592
  var LOG_DETAIL_FORMAT = "%H%x00%h%x00%an%x00%ae%x00%at%x00%s%x00%D%x00%P%x00%b";
25593
- function parseLogFields(parts) {
25594
- if (parts.length !== 8) return null;
25593
+ function parseLogFields(parts2) {
25594
+ if (parts2.length !== 8) return null;
25595
25595
  return {
25596
- sha: parts[0],
25597
- shortSha: parts[1],
25598
- authorName: parts[2],
25599
- authorEmail: parts[3],
25600
- authorDate: parseInt(parts[4], 10) || 0,
25601
- subject: parts[5],
25602
- refs: parts[6],
25603
- parents: parts[7] ? parts[7].split(" ").filter(Boolean) : []
25596
+ sha: parts2[0],
25597
+ shortSha: parts2[1],
25598
+ authorName: parts2[2],
25599
+ authorEmail: parts2[3],
25600
+ authorDate: parseInt(parts2[4], 10) || 0,
25601
+ subject: parts2[5],
25602
+ refs: parts2[6],
25603
+ parents: parts2[7] ? parts2[7].split(" ").filter(Boolean) : []
25604
25604
  };
25605
25605
  }
25606
25606
  __name(parseLogFields, "parseLogFields");
@@ -25658,10 +25658,10 @@ async function fetchGitCommitDetail(cwd, sha) {
25658
25658
  gitRoot
25659
25659
  );
25660
25660
  if (metaRaw === null) return null;
25661
- const parts = metaRaw.split("\0");
25662
- if (parts.at(-1) === "") parts.pop();
25663
- if (parts.length !== 9) return null;
25664
- const parents = parts[7] ? parts[7].split(" ").filter(Boolean) : [];
25661
+ const parts2 = metaRaw.split("\0");
25662
+ if (parts2.at(-1) === "") parts2.pop();
25663
+ if (parts2.length !== 9) return null;
25664
+ const parents = parts2[7] ? parts2[7].split(" ").filter(Boolean) : [];
25665
25665
  const diffTreeArgs = parents.length > 1 ? [
25666
25666
  "--no-optional-locks",
25667
25667
  "diff-tree",
@@ -25714,15 +25714,15 @@ async function fetchGitCommitDetail(cwd, sha) {
25714
25714
  });
25715
25715
  }
25716
25716
  return {
25717
- sha: parts[0],
25718
- shortSha: parts[1],
25719
- authorName: parts[2],
25720
- authorEmail: parts[3],
25721
- authorDate: parseInt(parts[4], 10) || 0,
25722
- subject: parts[5],
25723
- refs: parts[6],
25717
+ sha: parts2[0],
25718
+ shortSha: parts2[1],
25719
+ authorName: parts2[2],
25720
+ authorEmail: parts2[3],
25721
+ authorDate: parseInt(parts2[4], 10) || 0,
25722
+ subject: parts2[5],
25723
+ refs: parts2[6],
25724
25724
  parents,
25725
- body: parts[8].replace(/\n$/, ""),
25725
+ body: parts2[8].replace(/\n$/, ""),
25726
25726
  files,
25727
25727
  filesCount,
25728
25728
  linesAdded,
@@ -28573,6 +28573,245 @@ function isUserPromptRecord(record2) {
28573
28573
  }
28574
28574
  __name(isUserPromptRecord, "isUserPromptRecord");
28575
28575
 
28576
+ // packages/core/src/services/branch-points.ts
28577
+ init_esbuild_shims();
28578
+ function nonEmptyString(value) {
28579
+ return typeof value === "string" && value.length > 0 ? value : void 0;
28580
+ }
28581
+ __name(nonEmptyString, "nonEmptyString");
28582
+ function parts(record2) {
28583
+ return (record2.message?.parts ?? []).filter(
28584
+ (part) => part !== null && typeof part === "object"
28585
+ );
28586
+ }
28587
+ __name(parts, "parts");
28588
+ function functionCalls(record2) {
28589
+ return parts(record2).flatMap((part) => {
28590
+ const call = part.functionCall;
28591
+ if (!call) return [];
28592
+ return [
28593
+ {
28594
+ ...nonEmptyString(call.id) ? { id: call.id } : {},
28595
+ ...nonEmptyString(call.name) ? { name: call.name } : {}
28596
+ }
28597
+ ];
28598
+ });
28599
+ }
28600
+ __name(functionCalls, "functionCalls");
28601
+ function functionResponses(record2) {
28602
+ return parts(record2).flatMap((part) => {
28603
+ const response = part.functionResponse;
28604
+ if (!response) return [];
28605
+ return [
28606
+ {
28607
+ ...nonEmptyString(response.id) ? { id: response.id } : {},
28608
+ ...nonEmptyString(response.name) ? { name: response.name } : {}
28609
+ }
28610
+ ];
28611
+ });
28612
+ }
28613
+ __name(functionResponses, "functionResponses");
28614
+ function hasVisibleText(record2) {
28615
+ return parts(record2).some(
28616
+ (part) => part.thought !== true && typeof part.text === "string" && part.text.trim().length > 0
28617
+ );
28618
+ }
28619
+ __name(hasVisibleText, "hasVisibleText");
28620
+ function uniqueNameMatch(pending, matchingIndexes) {
28621
+ if (matchingIndexes.length === 1) return matchingIndexes[0];
28622
+ const freshIndexes = matchingIndexes.filter(
28623
+ (candidateIndex) => pending[candidateIndex]?.carriedFromPrefix !== true
28624
+ );
28625
+ return freshIndexes.length === 1 ? freshIndexes[0] : -1;
28626
+ }
28627
+ __name(uniqueNameMatch, "uniqueNameMatch");
28628
+ function closeToolCall(pending, response) {
28629
+ let index = -1;
28630
+ if (response.id !== void 0) {
28631
+ index = pending.findIndex((call) => call.id === response.id);
28632
+ if (index < 0 && response.name !== void 0) {
28633
+ const matchingIndexes = pending.flatMap(
28634
+ (call, candidateIndex) => call.id === void 0 && call.name === response.name ? [candidateIndex] : []
28635
+ );
28636
+ index = uniqueNameMatch(pending, matchingIndexes);
28637
+ }
28638
+ } else if (response.name !== void 0) {
28639
+ const matchingIndexes = pending.flatMap(
28640
+ (call, candidateIndex) => call.name === response.name ? [candidateIndex] : []
28641
+ );
28642
+ index = uniqueNameMatch(pending, matchingIndexes);
28643
+ }
28644
+ if (index < 0) return false;
28645
+ pending.splice(index, 1);
28646
+ return true;
28647
+ }
28648
+ __name(closeToolCall, "closeToolCall");
28649
+ function resolveCompletedTurnBranchCandidateInRange(input) {
28650
+ const {
28651
+ activeChain,
28652
+ startIndex,
28653
+ endIndex,
28654
+ startExclusiveRecordUuid,
28655
+ pendingCallsAtStart
28656
+ } = input;
28657
+ const pendingCalls = pendingCallsAtStart.map((call) => ({
28658
+ ...call,
28659
+ carriedFromPrefix: true
28660
+ }));
28661
+ let lastToolResultIndex = startIndex;
28662
+ for (let index = startIndex + 1; index <= endIndex; index++) {
28663
+ const record2 = activeChain[index];
28664
+ pendingCalls.push(...functionCalls(record2));
28665
+ const responses = functionResponses(record2);
28666
+ if (record2.type === "tool_result" || responses.length > 0) {
28667
+ lastToolResultIndex = index;
28668
+ }
28669
+ for (const response of responses) {
28670
+ if (!closeToolCall(pendingCalls, response)) return void 0;
28671
+ }
28672
+ }
28673
+ if (pendingCalls.some((call) => !call.carriedFromPrefix)) return void 0;
28674
+ let assistantRecordUuid;
28675
+ for (let index = lastToolResultIndex + 1; index <= endIndex; index++) {
28676
+ const record2 = activeChain[index];
28677
+ if (record2.type !== "assistant" || functionCalls(record2).length > 0 || !hasVisibleText(record2)) {
28678
+ continue;
28679
+ }
28680
+ if (assistantRecordUuid !== void 0) return void 0;
28681
+ assistantRecordUuid = record2.uuid;
28682
+ }
28683
+ if (assistantRecordUuid === void 0) return void 0;
28684
+ return {
28685
+ startExclusiveRecordUuid,
28686
+ endInclusiveRecordUuid: activeChain[endIndex].uuid,
28687
+ assistantRecordUuid
28688
+ };
28689
+ }
28690
+ __name(resolveCompletedTurnBranchCandidateInRange, "resolveCompletedTurnBranchCandidateInRange");
28691
+ function updatePendingBranchToolCalls(pendingCalls, record2) {
28692
+ pendingCalls.push(...functionCalls(record2));
28693
+ for (const response of functionResponses(record2)) {
28694
+ closeToolCall(pendingCalls, response);
28695
+ }
28696
+ }
28697
+ __name(updatePendingBranchToolCalls, "updatePendingBranchToolCalls");
28698
+ function collectPendingBranchToolCalls(records) {
28699
+ const pendingCalls = [];
28700
+ for (const record2 of records) {
28701
+ updatePendingBranchToolCalls(pendingCalls, record2);
28702
+ }
28703
+ return pendingCalls;
28704
+ }
28705
+ __name(collectPendingBranchToolCalls, "collectPendingBranchToolCalls");
28706
+ function resolveCompletedTurnBranchCandidateFromRecords(input) {
28707
+ if (input.records.length === 0) return void 0;
28708
+ return resolveCompletedTurnBranchCandidateInRange({
28709
+ activeChain: input.records,
28710
+ startIndex: -1,
28711
+ endIndex: input.records.length - 1,
28712
+ startExclusiveRecordUuid: input.startExclusiveRecordUuid,
28713
+ pendingCallsAtStart: input.pendingCallsAtStart
28714
+ });
28715
+ }
28716
+ __name(resolveCompletedTurnBranchCandidateFromRecords, "resolveCompletedTurnBranchCandidateFromRecords");
28717
+ function parseBranchCheckpointPayload(value) {
28718
+ if (!value || typeof value !== "object") return void 0;
28719
+ const payload = value;
28720
+ const start = payload["startExclusiveRecordUuid"];
28721
+ const assistantRecordUuid = payload["assistantRecordUuid"];
28722
+ if (payload["v"] !== 1 || start !== null && (typeof start !== "string" || start.length === 0) || typeof assistantRecordUuid !== "string" || assistantRecordUuid.length === 0) {
28723
+ return void 0;
28724
+ }
28725
+ return {
28726
+ v: 1,
28727
+ startExclusiveRecordUuid: start,
28728
+ assistantRecordUuid
28729
+ };
28730
+ }
28731
+ __name(parseBranchCheckpointPayload, "parseBranchCheckpointPayload");
28732
+ function resolveBranchPoints(activeChain) {
28733
+ const points = /* @__PURE__ */ new Map();
28734
+ const recordIndexes = /* @__PURE__ */ new Map();
28735
+ for (let index = 0; index < activeChain.length; index++) {
28736
+ const record2 = activeChain[index];
28737
+ if (typeof record2.uuid !== "string" || record2.uuid.length === 0 || recordIndexes.has(record2.uuid)) {
28738
+ return points;
28739
+ }
28740
+ recordIndexes.set(record2.uuid, index);
28741
+ }
28742
+ const checkpoints = [];
28743
+ const boundaryIndexes = /* @__PURE__ */ new Set();
28744
+ for (let index = 0; index < activeChain.length; index++) {
28745
+ const checkpoint = activeChain[index];
28746
+ if (checkpoint.type !== "system" || checkpoint.subtype !== "branch_checkpoint" || checkpoint.parentUuid === null || activeChain[index - 1]?.uuid !== checkpoint.parentUuid) {
28747
+ continue;
28748
+ }
28749
+ const payload = parseBranchCheckpointPayload(checkpoint.systemPayload);
28750
+ if (!payload) continue;
28751
+ const startIndex = payload.startExclusiveRecordUuid === null ? -1 : recordIndexes.get(payload.startExclusiveRecordUuid) ?? -1;
28752
+ if (payload.startExclusiveRecordUuid !== null && (startIndex < 0 || startIndex >= index - 1)) {
28753
+ continue;
28754
+ }
28755
+ checkpoints.push({
28756
+ checkpoint,
28757
+ checkpointIndex: index,
28758
+ startIndex,
28759
+ payload
28760
+ });
28761
+ if (startIndex >= 0) boundaryIndexes.add(startIndex);
28762
+ }
28763
+ const pendingCallsAtBoundary = /* @__PURE__ */ new Map();
28764
+ const pendingCalls = [];
28765
+ for (let index = 0; index < activeChain.length; index++) {
28766
+ const record2 = activeChain[index];
28767
+ pendingCalls.push(...functionCalls(record2));
28768
+ for (const response of functionResponses(record2)) {
28769
+ closeToolCall(pendingCalls, response);
28770
+ }
28771
+ if (boundaryIndexes.has(index)) {
28772
+ pendingCallsAtBoundary.set(
28773
+ index,
28774
+ pendingCalls.map((call) => ({ ...call }))
28775
+ );
28776
+ }
28777
+ }
28778
+ const checkpointByAssistantUuid = /* @__PURE__ */ new Map();
28779
+ for (const {
28780
+ checkpoint,
28781
+ checkpointIndex,
28782
+ startIndex,
28783
+ payload
28784
+ } of checkpoints) {
28785
+ const candidate = resolveCompletedTurnBranchCandidateInRange({
28786
+ activeChain,
28787
+ startIndex,
28788
+ endIndex: checkpointIndex - 1,
28789
+ startExclusiveRecordUuid: payload.startExclusiveRecordUuid,
28790
+ pendingCallsAtStart: startIndex < 0 ? [] : pendingCallsAtBoundary.get(startIndex) ?? []
28791
+ });
28792
+ if (!candidate || candidate.assistantRecordUuid !== payload.assistantRecordUuid) {
28793
+ continue;
28794
+ }
28795
+ const previousCheckpoint = checkpointByAssistantUuid.get(
28796
+ candidate.assistantRecordUuid
28797
+ );
28798
+ if (previousCheckpoint !== void 0) {
28799
+ points.delete(previousCheckpoint);
28800
+ continue;
28801
+ }
28802
+ points.set(checkpoint.uuid, {
28803
+ ...candidate,
28804
+ checkpointUuid: checkpoint.uuid
28805
+ });
28806
+ checkpointByAssistantUuid.set(
28807
+ candidate.assistantRecordUuid,
28808
+ checkpoint.uuid
28809
+ );
28810
+ }
28811
+ return points;
28812
+ }
28813
+ __name(resolveBranchPoints, "resolveBranchPoints");
28814
+
28576
28815
  // packages/core/src/services/session-transcript-reader.ts
28577
28816
  var SESSION_TRANSCRIPT_DEFAULT_LIMIT = 100;
28578
28817
  var SESSION_TRANSCRIPT_MAX_LIMIT = 500;
@@ -28739,6 +28978,63 @@ function getExpandedPageBytes() {
28739
28978
  return expandedPageBytesForTest ?? SESSION_TRANSCRIPT_MAX_EXPANDED_PAGE_BYTES;
28740
28979
  }
28741
28980
  __name(getExpandedPageBytes, "getExpandedPageBytes");
28981
+ function projectBranchPointParts(record2) {
28982
+ return (record2.message?.parts ?? []).flatMap((rawPart) => {
28983
+ const projected = [];
28984
+ if (rawPart === null || typeof rawPart !== "object") return projected;
28985
+ const part = rawPart;
28986
+ if (part.functionCall) {
28987
+ projected.push({
28988
+ functionCall: {
28989
+ ...part.functionCall.id !== void 0 ? { id: part.functionCall.id } : {},
28990
+ ...part.functionCall.name !== void 0 ? { name: part.functionCall.name } : {}
28991
+ }
28992
+ });
28993
+ }
28994
+ if (part.functionResponse) {
28995
+ projected.push({
28996
+ functionResponse: {
28997
+ ...part.functionResponse.id !== void 0 ? { id: part.functionResponse.id } : {},
28998
+ ...part.functionResponse.name !== void 0 ? { name: part.functionResponse.name } : {}
28999
+ }
29000
+ });
29001
+ }
29002
+ if (record2.type === "assistant" && part.thought !== true && typeof part.text === "string" && part.text.trim().length > 0) {
29003
+ projected.push({ text: "visible" });
29004
+ }
29005
+ return projected;
29006
+ });
29007
+ }
29008
+ __name(projectBranchPointParts, "projectBranchPointParts");
29009
+ function projectBranchPointRecord(record2) {
29010
+ const parts2 = projectBranchPointParts(record2);
29011
+ return {
29012
+ uuid: record2.uuid,
29013
+ parentUuid: record2.parentUuid,
29014
+ type: record2.type,
29015
+ ...record2.subtype !== void 0 ? { subtype: record2.subtype } : {},
29016
+ ...parts2.length > 0 ? { message: { parts: parts2 } } : {},
29017
+ ...record2.subtype === "branch_checkpoint" ? { systemPayload: record2.systemPayload } : {}
29018
+ };
29019
+ }
29020
+ __name(projectBranchPointRecord, "projectBranchPointRecord");
29021
+ function appendBranchPointRecord(records, record2) {
29022
+ const projected = projectBranchPointRecord(record2);
29023
+ const existing = records.get(record2.uuid);
29024
+ if (!existing) {
29025
+ records.set(record2.uuid, projected);
29026
+ return;
29027
+ }
29028
+ const parts2 = [
29029
+ ...existing.message?.parts ?? [],
29030
+ ...projected.message?.parts ?? []
29031
+ ];
29032
+ records.set(record2.uuid, {
29033
+ ...existing,
29034
+ ...parts2.length > 0 ? { message: { parts: parts2 } } : {}
29035
+ });
29036
+ }
29037
+ __name(appendBranchPointRecord, "appendBranchPointRecord");
28742
29038
  function makeSessionTranscriptNotFoundError(sessionId) {
28743
29039
  const error = new Error(
28744
29040
  `ENOENT: no such file or directory, open '${sessionId}.jsonl'`
@@ -29188,6 +29484,12 @@ function estimateIndexCacheBytes(index) {
29188
29484
  for (const [uuid, entry] of index.byUuid) {
29189
29485
  total += INDEX_ENTRY_BASE_BYTES + INDEX_HINT_BASE_BYTES * 2 + (entry.goalEvidenceHint.parsedGoalContext ? INDEX_HINT_BASE_BYTES : 0) + INDEX_MAP_ENTRY_BYTES + INDEX_CONTAINER_BASE_BYTES + entry.segments.length * INDEX_CONTAINER_SLOT_BYTES + estimateStringBytes(uuid) + estimateStringBytes(entry.parentUuid) + estimateStringBytes(entry.type) + estimateStringBytes(entry.subtype) + estimateStringBytes(entry.turnHint.turnParentUuid) + estimateStringBytes(entry.turnHint.backgroundNotificationTaskId) + estimateStringBytes(entry.goalEvidenceHint.parsedGoalContext?.goalId) + estimateStringBytes(entry.goalEvidenceHint.parsedGoalContext?.turnId) + estimateStringBytes(entry.goalEvidenceHint.claimedGoalId) + estimateStringBytes(entry.goalEvidenceHint.provenance) + entry.segments.length * INDEX_SEGMENT_BYTES;
29190
29486
  }
29487
+ for (const [
29488
+ assistantUuid,
29489
+ checkpointUuid
29490
+ ] of index.branchPointsByAssistantUuid) {
29491
+ total += INDEX_ENTRY_BASE_BYTES + estimateStringBytes(assistantUuid) + estimateStringBytes(checkpointUuid);
29492
+ }
29191
29493
  return total;
29192
29494
  }
29193
29495
  __name(estimateIndexCacheBytes, "estimateIndexCacheBytes");
@@ -29424,6 +29726,7 @@ async function buildIndex(params) {
29424
29726
  `index build start session=${sessionId} snapshotSize=${snapshotSize}`
29425
29727
  );
29426
29728
  const byUuid = /* @__PURE__ */ new Map();
29729
+ const branchPointRecords = /* @__PURE__ */ new Map();
29427
29730
  const goalEvidenceAccumulators = /* @__PURE__ */ new Map();
29428
29731
  let sequence = 0;
29429
29732
  const physicalRecords = [];
@@ -29450,6 +29753,10 @@ async function buildIndex(params) {
29450
29753
  }
29451
29754
  const sideTaskSource = record2.type === "system" && record2.subtype === "session_source" && isObjectRecord(record2.systemPayload) && record2.systemPayload["sourceType"] === "side_task";
29452
29755
  if (isTranscriptConversationRecord(record2)) {
29756
+ appendBranchPointRecord(
29757
+ branchPointRecords,
29758
+ record2
29759
+ );
29453
29760
  if (record2.timestamp) startTime ??= record2.timestamp;
29454
29761
  leafUuid = record2.uuid;
29455
29762
  }
@@ -29565,8 +29872,18 @@ async function buildIndex(params) {
29565
29872
  `active chain terminated: cycle session=${sessionId} uuid=${chain.cycleUuid}`
29566
29873
  );
29567
29874
  }
29875
+ const branchPointsByAssistantUuid = new Map(
29876
+ [
29877
+ ...resolveBranchPoints(
29878
+ replayUuids.flatMap((uuid) => {
29879
+ const record2 = branchPointRecords.get(uuid);
29880
+ return record2 ? [record2] : [];
29881
+ })
29882
+ ).values()
29883
+ ].map((point) => [point.assistantRecordUuid, point.checkpointUuid])
29884
+ );
29568
29885
  debugLogger14.debug(
29569
- `index build complete session=${sessionId} records=${byUuid.size} runtime=${runtimeUuids.length} replay=${replayUuids.length} gaps=${gaps.length}`
29886
+ `index build complete session=${sessionId} records=${byUuid.size} runtime=${runtimeUuids.length} replay=${replayUuids.length} gaps=${gaps.length} branchPoints=${branchPointsByAssistantUuid.size}`
29570
29887
  );
29571
29888
  await indexBuildCompleteHookForTest?.(filePath);
29572
29889
  return {
@@ -29583,7 +29900,8 @@ async function buildIndex(params) {
29583
29900
  restoreStartTime,
29584
29901
  startTime,
29585
29902
  lastUpdated,
29586
- byUuid
29903
+ byUuid,
29904
+ branchPointsByAssistantUuid
29587
29905
  };
29588
29906
  }
29589
29907
  __name(buildIndex, "buildIndex");
@@ -30358,6 +30676,13 @@ var SessionTranscriptReader = class {
30358
30676
  const pageUuids = backwardPage?.uuids ?? selectPageUuids(index, position, limit, maxBytes);
30359
30677
  const nextPosition = backwardPage?.nextPosition ?? position + pageUuids.length;
30360
30678
  const records = await readAggregatedRecords(index, pageUuids);
30679
+ const pageBranchPoints = /* @__PURE__ */ Object.create(null);
30680
+ for (const record2 of records) {
30681
+ const checkpointUuid = index.branchPointsByAssistantUuid.get(record2.uuid);
30682
+ if (checkpointUuid !== void 0) {
30683
+ pageBranchPoints[record2.uuid] = checkpointUuid;
30684
+ }
30685
+ }
30361
30686
  const backwardGoalState = direction === "backward" ? await readGoalStatePayloadBeforePosition(index, nextPosition) : void 0;
30362
30687
  const hasMore = direction === "backward" ? nextPosition > 0 : nextPosition < index.replayUuids.length;
30363
30688
  const nextCursorState = hasMore ? {
@@ -30389,7 +30714,8 @@ var SessionTranscriptReader = class {
30389
30714
  }
30390
30715
  } : cursor?.replay !== void 0 ? { replay: cursor.replay } : {},
30391
30716
  startTime: index.startTime,
30392
- lastUpdated: index.lastUpdated
30717
+ lastUpdated: index.lastUpdated,
30718
+ ...Object.keys(pageBranchPoints).length > 0 ? { branchPointsByAssistantUuid: pageBranchPoints } : {}
30393
30719
  };
30394
30720
  }
30395
30721
  };
@@ -32320,58 +32646,150 @@ var SessionWriterLease = class _SessionWriterLease {
32320
32646
 
32321
32647
  // packages/core/src/services/sessionService.ts
32322
32648
  var debugLogger16 = createDebugLogger("SESSION");
32649
+ var BranchPointInvalidError = class extends Error {
32650
+ constructor(recordId) {
32651
+ super(`Invalid or inactive branch point: ${recordId}`);
32652
+ this.recordId = recordId;
32653
+ this.name = "BranchPointInvalidError";
32654
+ }
32655
+ static {
32656
+ __name(this, "BranchPointInvalidError");
32657
+ }
32658
+ };
32323
32659
  var MAX_FILES_TO_PROCESS = 1e4;
32324
32660
  var SESSION_LIST_CANCEL_YIELD_INTERVAL = 128;
32325
32661
  var SESSION_TITLE_MAX_LENGTH = 200;
32326
32662
  var SESSION_FILE_PATTERN = /^[0-9a-fA-F-]{32,36}\.jsonl$/;
32327
32663
  var MAX_PROMPT_SCAN_LINES = 10;
32328
32664
  var TAIL_READ_SIZE = 64 * 1024;
32329
- async function copyFileHistoryBackups(sourceSessionId, targetSessionId) {
32330
- const fsPromises7 = await import("node:fs/promises");
32665
+ async function pathExists2(filePath) {
32666
+ try {
32667
+ await fs12.promises.access(filePath);
32668
+ return true;
32669
+ } catch (error) {
32670
+ if (error.code === "ENOENT") return false;
32671
+ throw error;
32672
+ }
32673
+ }
32674
+ __name(pathExists2, "pathExists");
32675
+ async function fsyncPath(filePath) {
32676
+ const handle = await fs12.promises.open(filePath, "r");
32677
+ try {
32678
+ await handle.sync();
32679
+ } finally {
32680
+ await handle.close();
32681
+ }
32682
+ }
32683
+ __name(fsyncPath, "fsyncPath");
32684
+ async function fsyncDirectoryBestEffort(directory) {
32685
+ try {
32686
+ await fsyncPath(directory);
32687
+ } catch (error) {
32688
+ if (process.platform !== "win32") throw error;
32689
+ }
32690
+ }
32691
+ __name(fsyncDirectoryBestEffort, "fsyncDirectoryBestEffort");
32692
+ function validatedBackupPath(directory, name) {
32693
+ if (name.length === 0 || path12.basename(name) !== name) {
32694
+ throw new Error(`Invalid file-history backup name: ${name}`);
32695
+ }
32696
+ const resolvedDirectory = path12.resolve(directory);
32697
+ const resolved = path12.resolve(directory, name);
32698
+ if (path12.dirname(resolved) !== resolvedDirectory) {
32699
+ throw new Error(`File-history backup escapes its directory: ${name}`);
32700
+ }
32701
+ return resolved;
32702
+ }
32703
+ __name(validatedBackupPath, "validatedBackupPath");
32704
+ async function copyFileHistoryBackupsToStaging(sourceSessionId, targetDirectory, backupNames, onMissing) {
32705
+ const copiedNames = /* @__PURE__ */ new Set();
32706
+ if (backupNames.size === 0) return copiedNames;
32331
32707
  const sourceDir = path12.join(
32332
32708
  Storage.getGlobalQwenDir(),
32333
32709
  FILE_HISTORY_DIR,
32334
32710
  sourceSessionId
32335
32711
  );
32336
- const targetDir = path12.join(
32337
- Storage.getGlobalQwenDir(),
32338
- FILE_HISTORY_DIR,
32339
- targetSessionId
32340
- );
32341
- let entries;
32342
- try {
32343
- entries = await fsPromises7.readdir(sourceDir);
32344
- } catch (e) {
32345
- if (e.code === "ENOENT") return;
32346
- debugLogger16.warn(`copyFileHistoryBackups: readdir failed: ${e}`);
32347
- return;
32348
- }
32349
- if (entries.length === 0) return;
32350
- try {
32351
- await fsPromises7.mkdir(targetDir, { recursive: true });
32352
- } catch (e) {
32353
- debugLogger16.warn(`copyFileHistoryBackups: mkdir failed: ${e}`);
32354
- return;
32355
- }
32356
- await Promise.all(
32357
- entries.map(async (name) => {
32358
- const src = path12.join(sourceDir, name);
32359
- const dst = path12.join(targetDir, name);
32712
+ const copyBuffer = Buffer.alloc(64 * 1024);
32713
+ let stagingCreated = false;
32714
+ const ensureStaging = /* @__PURE__ */ __name(async () => {
32715
+ if (stagingCreated) return;
32716
+ await fs12.promises.mkdir(targetDirectory, {
32717
+ recursive: false,
32718
+ mode: 448
32719
+ });
32720
+ stagingCreated = true;
32721
+ }, "ensureStaging");
32722
+ for (const name of backupNames) {
32723
+ const source = validatedBackupPath(sourceDir, name);
32724
+ const target = validatedBackupPath(targetDirectory, name);
32725
+ let sourceHandle;
32726
+ try {
32727
+ sourceHandle = await fs12.promises.open(
32728
+ source,
32729
+ fs12.constants.O_RDONLY | (process.platform === "win32" ? 0 : fs12.constants.O_NOFOLLOW)
32730
+ );
32731
+ } catch (error) {
32732
+ const code = error.code;
32733
+ if (code === "ENOENT" || code === "ELOOP") {
32734
+ onMissing(name);
32735
+ continue;
32736
+ }
32737
+ throw error;
32738
+ }
32739
+ try {
32740
+ const sourceStat = await sourceHandle.stat();
32741
+ let pathStat;
32360
32742
  try {
32361
- await fsPromises7.link(src, dst);
32362
- } catch {
32363
- try {
32364
- await fsPromises7.copyFile(src, dst);
32365
- } catch (copyErr) {
32366
- debugLogger16.warn(
32367
- `copyFileHistoryBackups: failed to copy ${name}: ${copyErr}`
32743
+ pathStat = await fs12.promises.lstat(source);
32744
+ } catch (error) {
32745
+ if (error.code !== "ENOENT") throw error;
32746
+ onMissing(name);
32747
+ continue;
32748
+ }
32749
+ if (!sourceStat.isFile() || !pathStat.isFile() || sourceStat.dev !== pathStat.dev || sourceStat.ino !== pathStat.ino) {
32750
+ onMissing(name);
32751
+ continue;
32752
+ }
32753
+ await ensureStaging();
32754
+ const targetHandle = await fs12.promises.open(target, "wx", 384);
32755
+ try {
32756
+ let sourceOffset = 0;
32757
+ while (true) {
32758
+ const { bytesRead } = await sourceHandle.read(
32759
+ copyBuffer,
32760
+ 0,
32761
+ copyBuffer.length,
32762
+ sourceOffset
32368
32763
  );
32764
+ if (bytesRead === 0) break;
32765
+ let written = 0;
32766
+ while (written < bytesRead) {
32767
+ const result = await targetHandle.write(
32768
+ copyBuffer,
32769
+ written,
32770
+ bytesRead - written,
32771
+ null
32772
+ );
32773
+ if (result.bytesWritten === 0) {
32774
+ throw new Error(`Failed to copy file-history backup: ${name}`);
32775
+ }
32776
+ written += result.bytesWritten;
32777
+ }
32778
+ sourceOffset += bytesRead;
32369
32779
  }
32780
+ await targetHandle.chmod(sourceStat.mode & 4095);
32781
+ await targetHandle.sync();
32782
+ } finally {
32783
+ await targetHandle.close();
32370
32784
  }
32371
- })
32372
- );
32785
+ copiedNames.add(name);
32786
+ } finally {
32787
+ await sourceHandle.close();
32788
+ }
32789
+ }
32790
+ return copiedNames;
32373
32791
  }
32374
- __name(copyFileHistoryBackups, "copyFileHistoryBackups");
32792
+ __name(copyFileHistoryBackupsToStaging, "copyFileHistoryBackupsToStaging");
32375
32793
  var SessionService = class {
32376
32794
  static {
32377
32795
  __name(this, "SessionService");
@@ -33159,7 +33577,7 @@ var SessionService = class {
33159
33577
  );
33160
33578
  }
33161
33579
  const lastMessage = messages[messages.length - 1];
33162
- stats ??= fs12.statSync(filePath);
33580
+ stats ??= await fs12.promises.stat(filePath);
33163
33581
  const conversation = {
33164
33582
  sessionId: firstRecord.sessionId,
33165
33583
  projectHash: this.projectHash,
@@ -33506,11 +33924,33 @@ var SessionService = class {
33506
33924
  `Source session does not belong to current project: ${sourceSessionId}`
33507
33925
  );
33508
33926
  }
33509
- const { messages: activeMessages } = this.reconstructHistory(records);
33510
- const sourceRecords = includeActiveSideArtifactRecords(
33511
- records,
33927
+ const { messages: currentActiveMessages } = this.reconstructHistory(records);
33928
+ let boundedRecords = records;
33929
+ let activeMessages = currentActiveMessages;
33930
+ if (options2.atRecordId !== void 0) {
33931
+ const point = resolveBranchPoints(currentActiveMessages).get(
33932
+ options2.atRecordId
33933
+ );
33934
+ if (!point) throw new BranchPointInvalidError(options2.atRecordId);
33935
+ const matchingIndex = records.findIndex(
33936
+ (record2) => record2.uuid === options2.atRecordId
33937
+ );
33938
+ if (matchingIndex < 0) {
33939
+ throw new BranchPointInvalidError(options2.atRecordId);
33940
+ }
33941
+ boundedRecords = records.slice(0, matchingIndex + 1);
33942
+ activeMessages = this.reconstructHistory(boundedRecords, {
33943
+ leafUuid: options2.atRecordId
33944
+ }).messages;
33945
+ if (activeMessages.at(-1)?.uuid !== options2.atRecordId) {
33946
+ throw new BranchPointInvalidError(options2.atRecordId);
33947
+ }
33948
+ }
33949
+ const preFilterRecords = includeActiveSideArtifactRecords(
33950
+ boundedRecords,
33512
33951
  activeMessages
33513
- ).filter(
33952
+ );
33953
+ const sourceRecords = preFilterRecords.filter(
33514
33954
  // A fork is a fresh top-level session with its own creation metadata.
33515
33955
  // Inheriting either record would falsely attribute the fork to the
33516
33956
  // source session's parent or creator.
@@ -33535,22 +33975,47 @@ var SessionService = class {
33535
33975
  } : void 0;
33536
33976
  let prevUuid = sourceRecord?.uuid ?? null;
33537
33977
  const remappedArtifactIds = /* @__PURE__ */ new Map();
33978
+ const retainedUuids = new Set(sourceRecords.map((record2) => record2.uuid));
33979
+ const nearestRetainedPredecessor = /* @__PURE__ */ new Map();
33980
+ {
33981
+ let lastRetained = null;
33982
+ for (const record2 of preFilterRecords) {
33983
+ if (retainedUuids.has(record2.uuid) && !isSessionArtifactRecord(record2)) {
33984
+ lastRetained = record2.uuid;
33985
+ } else {
33986
+ nearestRetainedPredecessor.set(record2.uuid, lastRetained);
33987
+ }
33988
+ }
33989
+ }
33538
33990
  const forked = [
33539
33991
  ...sourceRecord ? [sourceRecord] : [],
33540
33992
  ...sourceRecords.map((record2) => {
33541
33993
  const isArtifactRecord = isSessionArtifactRecord(record2);
33542
- const systemPayload = remapSystemPayloadForFork(
33994
+ let systemPayload = remapSystemPayloadForFork(
33543
33995
  record2,
33544
33996
  sourceSessionId,
33545
33997
  newSessionId,
33546
33998
  remappedArtifactIds
33547
33999
  );
34000
+ if (record2.subtype === "branch_checkpoint") {
34001
+ const checkpoint = parseBranchCheckpointPayload(systemPayload);
34002
+ if (checkpoint) {
34003
+ let boundary = checkpoint.startExclusiveRecordUuid;
34004
+ if (boundary !== null && !retainedUuids.has(boundary)) {
34005
+ boundary = nearestRetainedPredecessor.get(boundary) ?? null;
34006
+ }
34007
+ systemPayload = {
34008
+ ...checkpoint,
34009
+ startExclusiveRecordUuid: boundary
34010
+ };
34011
+ }
34012
+ }
33548
34013
  const next = {
33549
34014
  ...record2,
33550
34015
  sessionId: newSessionId,
33551
34016
  cwd: this.projectRoot,
33552
34017
  systemPayload,
33553
- parentUuid: isArtifactRecord ? record2.parentUuid : prevUuid,
34018
+ parentUuid: isArtifactRecord && record2.parentUuid !== null && retainedUuids.has(record2.parentUuid) ? record2.parentUuid : prevUuid,
33554
34019
  forkedFrom: {
33555
34020
  sessionId: sourceSessionId,
33556
34021
  messageUuid: record2.uuid
@@ -33562,7 +34027,7 @@ var SessionService = class {
33562
34027
  return next;
33563
34028
  })
33564
34029
  ];
33565
- const sourceSession = await this.loadSession(sourceSessionId);
34030
+ const sourceSession = options2.atRecordId === void 0 ? await this.loadSession(sourceSessionId) : void 0;
33566
34031
  const existingSnapshotPromptIds = collectFileHistorySnapshotPromptIds(forked);
33567
34032
  const remappedSnapshots = sourceSession?.fileHistorySnapshots?.map(
33568
34033
  (snapshot) => remapSnapshotPromptId(snapshot, sourceSessionId, newSessionId)
@@ -33582,43 +34047,129 @@ var SessionService = class {
33582
34047
  }
33583
34048
  };
33584
34049
  forked.push(snapshotRecord);
34050
+ prevUuid = snapshotRecord.uuid;
33585
34051
  }
33586
- fs12.mkdirSync(chatsDir, { recursive: true });
34052
+ if (options2.title !== void 0) {
34053
+ const titleRecord = {
34054
+ uuid: randomUUID3(),
34055
+ parentUuid: prevUuid,
34056
+ sessionId: newSessionId,
34057
+ type: "system",
34058
+ subtype: "custom_title",
34059
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
34060
+ cwd: this.projectRoot,
34061
+ version: records[0].version,
34062
+ systemPayload: {
34063
+ customTitle: options2.title,
34064
+ titleSource: "manual"
34065
+ }
34066
+ };
34067
+ forked.push(titleRecord);
34068
+ prevUuid = titleRecord.uuid;
34069
+ }
34070
+ const validateTargetBranchPoint = /* @__PURE__ */ __name(() => {
34071
+ if (options2.atRecordId === void 0) return;
34072
+ const targetActive = this.reconstructHistory(forked).messages;
34073
+ if (!resolveBranchPoints(targetActive).has(options2.atRecordId)) {
34074
+ throw new BranchPointInvalidError(options2.atRecordId);
34075
+ }
34076
+ }, "validateTargetBranchPoint");
34077
+ validateTargetBranchPoint();
33587
34078
  const body = forked.map((r) => JSON.stringify(r)).join("\n") + "\n";
33588
- let fd;
34079
+ const operationId = randomUUID3();
34080
+ const stagedTranscriptPath = path12.join(
34081
+ chatsDir,
34082
+ `.${newSessionId}.${operationId}.tmp`
34083
+ );
34084
+ const backupRoot = path12.join(Storage.getGlobalQwenDir(), FILE_HISTORY_DIR);
34085
+ const stagedBackupPath = path12.join(
34086
+ backupRoot,
34087
+ `.${newSessionId}.${operationId}.tmp`
34088
+ );
34089
+ const targetBackupPath = path12.join(backupRoot, newSessionId);
34090
+ const backupNames = collectReferencedFileHistoryBackupNames(forked);
34091
+ await Promise.all([
34092
+ fs12.promises.mkdir(chatsDir, { recursive: true }),
34093
+ fs12.promises.mkdir(backupRoot, { recursive: true, mode: 448 })
34094
+ ]);
34095
+ let backupPublished = false;
34096
+ let committed = false;
33589
34097
  try {
33590
- fd = fs12.openSync(targetPath, "wx", 384);
33591
- } catch (err) {
33592
- if (err.code === "EEXIST") {
33593
- throw new Error(`Target session file already exists: ${newSessionId}`);
34098
+ if (await pathExists2(targetPath) || await pathExists2(targetBackupPath)) {
34099
+ throw new Error(`Target session already exists: ${newSessionId}`);
33594
34100
  }
33595
- throw err;
33596
- }
33597
- let targetComplete = false;
33598
- try {
34101
+ const stagedHandle = await fs12.promises.open(
34102
+ stagedTranscriptPath,
34103
+ "wx",
34104
+ 384
34105
+ );
33599
34106
  try {
33600
- fs12.writeFileSync(fd, body, { encoding: "utf8" });
34107
+ await stagedHandle.writeFile(body, { encoding: "utf8" });
34108
+ await stagedHandle.sync();
33601
34109
  } finally {
33602
- fs12.closeSync(fd);
34110
+ await stagedHandle.close();
33603
34111
  }
33604
- await copyFileHistoryBackups(sourceSessionId, newSessionId);
33605
- targetComplete = true;
33606
- } finally {
33607
- if (!targetComplete) {
33608
- try {
33609
- this.removeFileIfExists(targetPath);
33610
- } catch (cleanupError) {
33611
- this.warn(
33612
- `forkSession: failed to clean up incomplete target ${newSessionId}: ${cleanupError}`
33613
- );
34112
+ if (backupNames.size > 0) {
34113
+ const copiedBackupNames = await copyFileHistoryBackupsToStaging(
34114
+ sourceSessionId,
34115
+ stagedBackupPath,
34116
+ backupNames,
34117
+ (name) => {
34118
+ this.warn(
34119
+ `branch ${newSessionId} omitted missing file-history backup ${name}; rewind data for that snapshot is unavailable`
34120
+ );
34121
+ }
34122
+ );
34123
+ if (copiedBackupNames.size > 0) {
34124
+ if (await pathExists2(targetBackupPath)) {
34125
+ throw new Error(`Target session already exists: ${newSessionId}`);
34126
+ }
34127
+ await fs12.promises.rename(stagedBackupPath, targetBackupPath);
34128
+ backupPublished = true;
33614
34129
  }
33615
- try {
33616
- this.removeFileHistoryBackups(newSessionId);
33617
- } catch (cleanupError) {
33618
- this.warn(
33619
- `forkSession: failed to clean up file history for incomplete target ${newSessionId}: ${cleanupError}`
33620
- );
34130
+ }
34131
+ try {
34132
+ await fs12.promises.link(stagedTranscriptPath, targetPath);
34133
+ } catch (error) {
34134
+ const code = error.code;
34135
+ if (code === "EEXIST") {
34136
+ throw new Error(`Target session already exists: ${newSessionId}`);
34137
+ }
34138
+ if (await pathExists2(targetPath)) {
34139
+ throw new Error(`Target session already exists: ${newSessionId}`);
33621
34140
  }
34141
+ await fs12.promises.rename(stagedTranscriptPath, targetPath);
34142
+ }
34143
+ committed = true;
34144
+ try {
34145
+ await fsyncDirectoryBestEffort(chatsDir);
34146
+ } catch (error) {
34147
+ this.warn(
34148
+ `branch committed session=${newSessionId} but final durability confirmation failed: ${error instanceof Error ? error.message : String(error)}`
34149
+ );
34150
+ }
34151
+ } finally {
34152
+ const cleanupFailures = [];
34153
+ await fs12.promises.unlink(stagedTranscriptPath).catch((error) => {
34154
+ if (error.code !== "ENOENT") {
34155
+ cleanupFailures.push(`transcript staging: ${String(error)}`);
34156
+ }
34157
+ });
34158
+ await fs12.promises.rm(stagedBackupPath, { recursive: true, force: true }).catch((error) => {
34159
+ cleanupFailures.push(`backup staging: ${String(error)}`);
34160
+ });
34161
+ if (!committed && backupPublished) {
34162
+ await fs12.promises.rm(targetBackupPath, {
34163
+ recursive: true,
34164
+ force: true
34165
+ }).catch((error) => {
34166
+ cleanupFailures.push(`published backup: ${String(error)}`);
34167
+ });
34168
+ }
34169
+ if (cleanupFailures.length > 0) {
34170
+ this.warn(
34171
+ `branch cleanup incomplete session=${newSessionId}: ${cleanupFailures.join("; ")}`
34172
+ );
33622
34173
  }
33623
34174
  }
33624
34175
  return { filePath: targetPath, copiedCount: forked.length };
@@ -33744,8 +34295,9 @@ var SessionService = class {
33744
34295
  const filePath = path12.join(chatsDir, name);
33745
34296
  const titleInfo = this.readSessionTitleInfoFromFile(filePath);
33746
34297
  if (!titleInfo.title) continue;
33747
- const normalizedTitle = titleInfo.title.toLowerCase().trim();
33748
- if (!normalizedTitle.startsWith(normalizedPrefix)) continue;
34298
+ if (!titleInfo.title.toLowerCase().trim().startsWith(normalizedPrefix)) {
34299
+ continue;
34300
+ }
33749
34301
  try {
33750
34302
  const records = await readLines(filePath, 1);
33751
34303
  if (records.length === 0) continue;
@@ -33904,6 +34456,28 @@ function collectFileHistorySnapshotPromptIds(records) {
33904
34456
  return ids;
33905
34457
  }
33906
34458
  __name(collectFileHistorySnapshotPromptIds, "collectFileHistorySnapshotPromptIds");
34459
+ function collectReferencedFileHistoryBackupNames(records) {
34460
+ const names = /* @__PURE__ */ new Set();
34461
+ for (const record2 of records) {
34462
+ if (record2.type !== "system" || record2.subtype !== "file_history_snapshot" || !record2.systemPayload) {
34463
+ continue;
34464
+ }
34465
+ const payload = record2.systemPayload;
34466
+ if (!Array.isArray(payload.snapshots)) continue;
34467
+ for (const snapshot of payload.snapshots) {
34468
+ if (!snapshot || typeof snapshot !== "object" || !snapshot.trackedFileBackups || typeof snapshot.trackedFileBackups !== "object") {
34469
+ continue;
34470
+ }
34471
+ for (const backup of Object.values(snapshot.trackedFileBackups)) {
34472
+ if (backup && backup.failed !== true && typeof backup.backupFileName === "string" && backup.backupFileName.length > 0 && backup.backupFileName !== "." && backup.backupFileName !== ".." && path12.basename(backup.backupFileName) === backup.backupFileName) {
34473
+ names.add(backup.backupFileName);
34474
+ }
34475
+ }
34476
+ }
34477
+ }
34478
+ return names;
34479
+ }
34480
+ __name(collectReferencedFileHistoryBackupNames, "collectReferencedFileHistoryBackupNames");
33907
34481
  function replayUiTelemetryFromConversation(conversation, sessionId) {
33908
34482
  if (sessionId) {
33909
34483
  uiTelemetryService.resetSession(sessionId);
@@ -34073,8 +34647,8 @@ function filterToDialog(history) {
34073
34647
  for (const msg of history.slice(getStartupContextLength(history))) {
34074
34648
  if (msg.role !== "user" && msg.role !== "model") continue;
34075
34649
  const textParts = [];
34076
- const parts = stripTrailingUserPromptSubmitContextPart(msg.parts ?? []);
34077
- for (const part of parts) {
34650
+ const parts2 = stripTrailingUserPromptSubmitContextPart(msg.parts ?? []);
34651
+ for (const part of parts2) {
34078
34652
  if (typeof part?.text !== "string" || part.text.trim() === "" || part.thought || part.thoughtSignature) {
34079
34653
  continue;
34080
34654
  }
@@ -34264,6 +34838,12 @@ var ChatRecordingService = class {
34264
34838
  lastRecordUuid = null;
34265
34839
  /** UUID of the last active-tail record confirmed written to disk. */
34266
34840
  lastPersistedRecordUuid = null;
34841
+ /** Active chain mirrored in memory so end-of-turn validation is incremental. */
34842
+ activeBranchRecords = [];
34843
+ /** Parent of the first mirrored record, or the restored tail before appends. */
34844
+ activeBranchBaseUuid = null;
34845
+ /** Unclosed tool calls at the current active tail. */
34846
+ pendingBranchToolCalls = [];
34267
34847
  config;
34268
34848
  /**
34269
34849
  * Tracks the `lastRecordUuid` value just before each user turn was recorded.
@@ -34286,6 +34866,8 @@ var ChatRecordingService = class {
34286
34866
  acceptingWrites = false;
34287
34867
  closePromise;
34288
34868
  handoffRequested = false;
34869
+ /** Prevents asynchronous metadata writers from becoming checkpoint siblings. */
34870
+ topologyFence;
34289
34871
  /** First async JSONL write failure; permanently degrades this recorder. */
34290
34872
  writeFailure;
34291
34873
  integrityFailure;
@@ -34422,6 +35004,9 @@ var ChatRecordingService = class {
34422
35004
  this.currentParentSessionId = void 0;
34423
35005
  this.currentSourceType = void 0;
34424
35006
  this.currentSourceId = void 0;
35007
+ this.activeBranchRecords = [];
35008
+ this.activeBranchBaseUuid = null;
35009
+ this.pendingBranchToolCalls = [];
34425
35010
  this.userDisplayTextsForTitle.length = 0;
34426
35011
  if (!sessionData) return;
34427
35012
  this.rebuildTurnBoundaries(sessionData.conversation.messages);
@@ -34461,6 +35046,7 @@ var ChatRecordingService = class {
34461
35046
  restoreProjectedState(state) {
34462
35047
  this.lastRecordUuid = state.lastCompletedUuid;
34463
35048
  this.lastPersistedRecordUuid = state.lastCompletedUuid;
35049
+ this.activeBranchBaseUuid = state.lastCompletedUuid;
34464
35050
  this.turnParentUuids = [...state.turnParentUuids];
34465
35051
  this.currentCustomTitle = state.customTitle;
34466
35052
  this.currentTitleSource = state.titleSource;
@@ -34540,6 +35126,23 @@ var ChatRecordingService = class {
34540
35126
  }
34541
35127
  return this.integrityFailure ?? this.writeFailure;
34542
35128
  }
35129
+ updateActiveBranch(record2) {
35130
+ const currentTail = this.activeBranchRecords.at(-1)?.uuid ?? null;
35131
+ if (record2.parentUuid !== currentTail) {
35132
+ const parentIndex = record2.parentUuid === null ? -1 : this.activeBranchRecords.findIndex(
35133
+ (candidate) => candidate.uuid === record2.parentUuid
35134
+ );
35135
+ this.activeBranchRecords = parentIndex < 0 ? [] : this.activeBranchRecords.slice(0, parentIndex + 1);
35136
+ if (parentIndex < 0) {
35137
+ this.activeBranchBaseUuid = record2.parentUuid ?? null;
35138
+ }
35139
+ this.pendingBranchToolCalls = collectPendingBranchToolCalls(
35140
+ this.activeBranchRecords
35141
+ );
35142
+ }
35143
+ this.activeBranchRecords.push(record2);
35144
+ updatePendingBranchToolCalls(this.pendingBranchToolCalls, record2);
35145
+ }
34543
35146
  enqueueRecordWrite(record2, legacyConversationFile, updateActiveTail = true) {
34544
35147
  const pendingWrite = this.operationTail.then(async () => {
34545
35148
  if (this.writeFailure) throw this.writeFailure;
@@ -34571,26 +35174,41 @@ var ChatRecordingService = class {
34571
35174
  * descendants are skipped and later fire-and-forget calls become no-ops.
34572
35175
  */
34573
35176
  appendRecord(record2, options2) {
34574
- if (this.writeFailure || !this.acceptingWrites || this.state !== "active") {
35177
+ if (this.writeFailure || !this.acceptingWrites || this.state !== "active")
35178
+ return;
35179
+ if (this.topologyFence) {
35180
+ this.topologyFence.buffered.push({ record: record2, options: options2 });
34575
35181
  return;
34576
35182
  }
34577
35183
  const legacyConversationFile = this.writerLeaseRequired ? void 0 : this.ensureConversationFile();
34578
35184
  const updateActiveTail = options2?.updateActiveTail !== false;
34579
35185
  if (updateActiveTail) {
34580
35186
  this.lastRecordUuid = record2.uuid;
35187
+ this.updateActiveBranch(record2);
34581
35188
  }
34582
35189
  this.enqueueRecordWrite(record2, legacyConversationFile, updateActiveTail);
34583
35190
  this.updateTitleAnchorTracking(record2);
34584
35191
  }
34585
35192
  async appendRecordStrict(record2, options2) {
34586
35193
  if (this.writeFailure) throw this.writeFailure;
34587
- if (!this.acceptingWrites || this.state !== "active") {
35194
+ if (!this.acceptingWrites || this.state !== "active")
34588
35195
  throw new SessionWriterUnavailableError();
35196
+ if (this.topologyFence) {
35197
+ await new Promise((resolve41, reject) => {
35198
+ this.topologyFence.buffered.push({
35199
+ record: record2,
35200
+ options: options2,
35201
+ resolve: resolve41,
35202
+ reject
35203
+ });
35204
+ });
35205
+ return;
34589
35206
  }
34590
35207
  const updateActiveTail = options2?.updateActiveTail !== false;
34591
35208
  const legacyConversationFile = this.writerLeaseRequired ? void 0 : this.ensureConversationFile();
34592
35209
  if (updateActiveTail) {
34593
35210
  this.lastRecordUuid = record2.uuid;
35211
+ this.updateActiveBranch(record2);
34594
35212
  }
34595
35213
  const pendingWrite = this.enqueueRecordWrite(
34596
35214
  record2,
@@ -34600,6 +35218,21 @@ var ChatRecordingService = class {
34600
35218
  this.updateTitleAnchorTracking(record2);
34601
35219
  await pendingWrite;
34602
35220
  }
35221
+ releaseTopologyFence(fence) {
35222
+ if (this.topologyFence !== fence) return;
35223
+ this.topologyFence = void 0;
35224
+ for (const intent of fence.buffered) {
35225
+ intent.record.parentUuid = this.lastRecordUuid;
35226
+ if (intent.resolve && intent.reject) {
35227
+ void this.appendRecordStrict(intent.record, intent.options).then(
35228
+ intent.resolve,
35229
+ intent.reject
35230
+ );
35231
+ } else {
35232
+ this.appendRecord(intent.record, intent.options);
35233
+ }
35234
+ }
35235
+ }
34603
35236
  /**
34604
35237
  * Maintain the "title is always in the tail window" invariant by
34605
35238
  * counting bytes accepted since the last `custom_title` record and
@@ -34677,6 +35310,17 @@ var ChatRecordingService = class {
34677
35310
  await this.operationTail;
34678
35311
  if (this.writeFailure) throw this.writeFailure;
34679
35312
  }
35313
+ async readActiveTranscriptChain() {
35314
+ await this.flush();
35315
+ const sessionId = this.getSessionId();
35316
+ const session = await this.config.getSessionService().loadSession(sessionId);
35317
+ if (!session) {
35318
+ throw new Error(
35319
+ `Unable to load active transcript for session ${sessionId}`
35320
+ );
35321
+ }
35322
+ return session.conversation.messages;
35323
+ }
34680
35324
  async runWithWriteBarrier(operation) {
34681
35325
  if (this.writeFailure) throw this.writeFailure;
34682
35326
  if (!this.acceptingWrites || this.state !== "active") {
@@ -34776,20 +35420,63 @@ var ChatRecordingService = class {
34776
35420
  hasWriteOwnership() {
34777
35421
  return this.binding !== void 0;
34778
35422
  }
34779
- async readActiveTranscriptChain() {
34780
- await this.flush();
34781
- const sessionId = this.getSessionId();
34782
- const session = await this.config.getSessionService().loadSession(sessionId);
34783
- if (!session) {
34784
- throw new Error(
34785
- `Unable to load active transcript for session ${sessionId}`
34786
- );
34787
- }
34788
- return session.conversation.messages;
34789
- }
34790
35423
  getTranscriptCursor() {
34791
35424
  return { recordId: this.lastRecordUuid };
34792
35425
  }
35426
+ getBranchCheckpointCursor() {
35427
+ return {
35428
+ recordId: this.lastRecordUuid,
35429
+ activeRecordCount: this.activeBranchRecords.length,
35430
+ pendingToolCalls: this.pendingBranchToolCalls.map((call) => ({
35431
+ ...call
35432
+ }))
35433
+ };
35434
+ }
35435
+ async recordBranchCheckpointTransaction(input) {
35436
+ if (input.stopReason !== "end_turn") return void 0;
35437
+ if (this.writeFailure) throw this.writeFailure;
35438
+ if (this.state !== "active") throw new SessionWriterUnavailableError();
35439
+ if (this.topologyFence) {
35440
+ throw new Error("Transcript topology transaction already active");
35441
+ }
35442
+ const fence = { buffered: [] };
35443
+ this.topologyFence = fence;
35444
+ try {
35445
+ await this.flush();
35446
+ const endInclusiveRecordUuid = this.lastRecordUuid;
35447
+ if (endInclusiveRecordUuid === null) return void 0;
35448
+ const cursorRecordId = input.cursor.activeRecordCount === 0 ? this.activeBranchBaseUuid : this.activeBranchRecords[input.cursor.activeRecordCount - 1]?.uuid;
35449
+ if (cursorRecordId !== input.cursor.recordId || this.activeBranchRecords.at(-1)?.uuid !== endInclusiveRecordUuid) {
35450
+ throw new Error("Transcript changed while recording branch checkpoint");
35451
+ }
35452
+ const candidate = resolveCompletedTurnBranchCandidateFromRecords({
35453
+ records: this.activeBranchRecords.slice(input.cursor.activeRecordCount),
35454
+ startExclusiveRecordUuid: input.cursor.recordId,
35455
+ pendingCallsAtStart: input.cursor.pendingToolCalls
35456
+ });
35457
+ if (!candidate) return void 0;
35458
+ const checkpointUuid = randomUUID4();
35459
+ const checkpoint = {
35460
+ ...this.createBaseRecord("system"),
35461
+ uuid: checkpointUuid,
35462
+ parentUuid: endInclusiveRecordUuid,
35463
+ type: "system",
35464
+ subtype: "branch_checkpoint",
35465
+ systemPayload: {
35466
+ v: 1,
35467
+ startExclusiveRecordUuid: input.cursor.recordId,
35468
+ assistantRecordUuid: candidate.assistantRecordUuid
35469
+ }
35470
+ };
35471
+ this.topologyFence = void 0;
35472
+ const checkpointWrite = this.appendRecordStrict(checkpoint);
35473
+ this.topologyFence = fence;
35474
+ await checkpointWrite;
35475
+ return { ...candidate, checkpointUuid };
35476
+ } finally {
35477
+ this.releaseTopologyFence(fence);
35478
+ }
35479
+ }
34793
35480
  async recordGoalState(recordUuid, payload) {
34794
35481
  const record2 = {
34795
35482
  ...this.createBaseRecord("system"),
@@ -35192,6 +35879,9 @@ var ChatRecordingService = class {
35192
35879
  */
35193
35880
  rebuildTurnBoundaries(messages) {
35194
35881
  this.turnParentUuids = [];
35882
+ this.activeBranchRecords = [...messages];
35883
+ this.activeBranchBaseUuid = messages[0]?.parentUuid ?? null;
35884
+ this.pendingBranchToolCalls = collectPendingBranchToolCalls(messages);
35195
35885
  for (let i = 0; i < messages.length; i++) {
35196
35886
  const record2 = messages[i];
35197
35887
  if (record2.type === "user" && record2.subtype !== "goal_runtime" && record2.subtype !== "notification" && record2.subtype !== "cron" && record2.subtype !== "mid_turn_user_message" && record2.subtype !== "realtime_message") {
@@ -35537,9 +36227,9 @@ function collectToolCallIdsFromHistory(history) {
35537
36227
  return ids;
35538
36228
  }
35539
36229
  __name(collectToolCallIdsFromHistory, "collectToolCallIdsFromHistory");
35540
- function normalizeModelToolCallIds(parts, usedIds, rawIdsInCurrentTurn, reservedIds) {
36230
+ function normalizeModelToolCallIds(parts2, usedIds, rawIdsInCurrentTurn, reservedIds) {
35541
36231
  const normalized2 = [];
35542
- for (const part of parts) {
36232
+ for (const part of parts2) {
35543
36233
  const functionCall = part.functionCall;
35544
36234
  if (!functionCall) {
35545
36235
  normalized2.push(part);
@@ -35593,10 +36283,10 @@ function getProviderToolCallId(functionCall) {
35593
36283
  return functionCall[PROVIDER_TOOL_CALL_ID];
35594
36284
  }
35595
36285
  __name(getProviderToolCallId, "getProviderToolCallId");
35596
- function dedupeToolCallsById(functionCalls) {
36286
+ function dedupeToolCallsById(functionCalls2) {
35597
36287
  const seenIds = /* @__PURE__ */ new Set();
35598
36288
  const deduped = [];
35599
- for (const functionCall of functionCalls) {
36289
+ for (const functionCall of functionCalls2) {
35600
36290
  const id = functionCall.id;
35601
36291
  if (id) {
35602
36292
  if (seenIds.has(id)) {
@@ -35615,20 +36305,20 @@ __name(dedupeToolCallsById, "dedupeToolCallsById");
35615
36305
  var ERROR_REPORT_HISTORY_TAIL_COUNT = 8;
35616
36306
  var ERROR_REPORT_TEXT_PREVIEW_CHARS = 200;
35617
36307
  function normalizeRequestParts(req) {
35618
- const parts = Array.isArray(req) ? req : [req];
35619
- return parts.map(
36308
+ const parts2 = Array.isArray(req) ? req : [req];
36309
+ return parts2.map(
35620
36310
  (part) => typeof part === "string" ? { text: part } : part
35621
36311
  );
35622
36312
  }
35623
36313
  __name(normalizeRequestParts, "normalizeRequestParts");
35624
- function summarizeParts(parts) {
36314
+ function summarizeParts(parts2) {
35625
36315
  return {
35626
- partCount: parts.length,
35627
- functionCalls: parts.map((part) => part.functionCall?.name).filter((name) => typeof name === "string"),
35628
- functionResponses: parts.map((part) => part.functionResponse?.name).filter((name) => typeof name === "string"),
36316
+ partCount: parts2.length,
36317
+ functionCalls: parts2.map((part) => part.functionCall?.name).filter((name) => typeof name === "string"),
36318
+ functionResponses: parts2.map((part) => part.functionResponse?.name).filter((name) => typeof name === "string"),
35629
36319
  textPreview: (() => {
35630
36320
  let textPreview = "";
35631
- for (const part of parts) {
36321
+ for (const part of parts2) {
35632
36322
  if (typeof part.text !== "string" || part.thought) continue;
35633
36323
  const remaining = ERROR_REPORT_TEXT_PREVIEW_CHARS - textPreview.length;
35634
36324
  if (remaining <= 0) break;
@@ -35718,9 +36408,9 @@ var CompressionStatus = /* @__PURE__ */ ((CompressionStatus2) => {
35718
36408
  return CompressionStatus2;
35719
36409
  })(CompressionStatus || {});
35720
36410
  function getDisplayContentParts(response) {
35721
- const parts = response.candidates?.[0]?.content?.parts ?? [];
36411
+ const parts2 = response.candidates?.[0]?.content?.parts ?? [];
35722
36412
  const displayParts = [];
35723
- for (const part of parts) {
36413
+ for (const part of parts2) {
35724
36414
  if (part.thought) {
35725
36415
  continue;
35726
36416
  }
@@ -35828,8 +36518,8 @@ var Turn = class {
35828
36518
  ...hasImage ? { parts: displayParts } : {}
35829
36519
  };
35830
36520
  }
35831
- const functionCalls = resp.functionCalls ?? [];
35832
- for (const fnCall of functionCalls) {
36521
+ const functionCalls2 = resp.functionCalls ?? [];
36522
+ for (const fnCall of functionCalls2) {
35833
36523
  const event = this.handlePendingFunctionCall(fnCall);
35834
36524
  if (event) {
35835
36525
  yield event;
@@ -35868,6 +36558,7 @@ ${[...this.pendingCitations].sort().join("\n")}`
35868
36558
  yield { type: "user_cancelled" /* UserCancelled */ };
35869
36559
  return;
35870
36560
  }
36561
+ const originalStatus = getErrorStatus(e);
35871
36562
  const error = toFriendlyError(e);
35872
36563
  if (error instanceof UnauthorizedError) {
35873
36564
  throw error;
@@ -35891,10 +36582,9 @@ ${[...this.pendingCitations].sort().join("\n")}`
35891
36582
  "Turn.run-sendMessageStream",
35892
36583
  { contextAlreadySummarized: true }
35893
36584
  );
35894
- const status = typeof error === "object" && error !== null && "status" in error && typeof error.status === "number" ? error.status : void 0;
35895
36585
  const structuredError = {
35896
36586
  message: getErrorMessage(error),
35897
- status
36587
+ status: getErrorStatus(error) ?? originalStatus
35898
36588
  };
35899
36589
  await this.chat.maybeIncludeSchemaDepthContext(structuredError);
35900
36590
  yield { type: "error" /* Error */, value: { error: structuredError } };
@@ -35984,9 +36674,9 @@ function extractRecentFilePaths(history, maxFiles) {
35984
36674
  for (let i = history.length - 1; i >= 0; i--) {
35985
36675
  const content = history[i];
35986
36676
  if (content.role !== "model") continue;
35987
- const parts = content.parts ?? [];
35988
- for (let j2 = parts.length - 1; j2 >= 0; j2--) {
35989
- const part = parts[j2];
36677
+ const parts2 = content.parts ?? [];
36678
+ for (let j2 = parts2.length - 1; j2 >= 0; j2--) {
36679
+ const part = parts2[j2];
35990
36680
  const call = part.functionCall;
35991
36681
  if (!call || !FILE_TOUCHING_TOOLS.has(call.name ?? "")) continue;
35992
36682
  if (call.id && failedCallIds.has(call.id)) continue;
@@ -36002,9 +36692,9 @@ function extractRecentFilePaths(history, maxFiles) {
36002
36692
  __name(extractRecentFilePaths, "extractRecentFilePaths");
36003
36693
  function imagePartsInContentReverse(content) {
36004
36694
  const result = [];
36005
- const parts = content.parts ?? [];
36006
- for (let j2 = parts.length - 1; j2 >= 0; j2--) {
36007
- const part = parts[j2];
36695
+ const parts2 = content.parts ?? [];
36696
+ for (let j2 = parts2.length - 1; j2 >= 0; j2--) {
36697
+ const part = parts2[j2];
36008
36698
  if (part.inlineData?.mimeType?.startsWith("image/")) {
36009
36699
  result.push(part);
36010
36700
  continue;
@@ -36256,15 +36946,15 @@ function buildSubagentSnapshotPart(snaps) {
36256
36946
  }
36257
36947
  __name(buildSubagentSnapshotPart, "buildSubagentSnapshotPart");
36258
36948
  function buildStateReminderParts(options2) {
36259
- const parts = [];
36949
+ const parts2 = [];
36260
36950
  if (options2.planModeActive) {
36261
- parts.push(buildPlanModeReminderPart());
36951
+ parts2.push(buildPlanModeReminderPart());
36262
36952
  }
36263
36953
  if (options2.runningSubagents && options2.runningSubagents.length > 0) {
36264
36954
  const snap = buildSubagentSnapshotPart(options2.runningSubagents);
36265
- if (snap) parts.push(snap);
36955
+ if (snap) parts2.push(snap);
36266
36956
  }
36267
- return parts;
36957
+ return parts2;
36268
36958
  }
36269
36959
  __name(buildStateReminderParts, "buildStateReminderParts");
36270
36960
  async function composePostCompactHistory(history, summary, options2 = {}) {
@@ -36375,18 +37065,18 @@ function collectActiveSubagents(config) {
36375
37065
  __name(collectActiveSubagents, "collectActiveSubagents");
36376
37066
  function buildCompressionSystemPrompt(userInstructions, hookInstructions) {
36377
37067
  const base = getCompressionPrompt();
36378
- const parts = [];
37068
+ const parts2 = [];
36379
37069
  if (userInstructions && userInstructions.trim().length > 0) {
36380
- parts.push(userInstructions.trim());
37070
+ parts2.push(userInstructions.trim());
36381
37071
  }
36382
37072
  if (hookInstructions.length > 0) {
36383
- parts.push(hookInstructions);
37073
+ parts2.push(hookInstructions);
36384
37074
  }
36385
- if (parts.length === 0) return base;
37075
+ if (parts2.length === 0) return base;
36386
37076
  return `${base}
36387
37077
 
36388
37078
  Additional Instructions:
36389
- ${parts.join("\n\n")}`;
37079
+ ${parts2.join("\n\n")}`;
36390
37080
  }
36391
37081
  __name(buildCompressionSystemPrompt, "buildCompressionSystemPrompt");
36392
37082
  function supportsCompressionCacheSharing(config) {
@@ -37535,9 +38225,9 @@ function hasNonThoughtCandidateParts(response) {
37535
38225
  );
37536
38226
  }
37537
38227
  __name(hasNonThoughtCandidateParts, "hasNonThoughtCandidateParts");
37538
- function syncFunctionCallsField(response, parts) {
37539
- const functionCalls = parts.map((part) => part.functionCall).filter((call) => Boolean(call));
37540
- const value = functionCalls.length > 0 ? functionCalls : void 0;
38228
+ function syncFunctionCallsField(response, parts2) {
38229
+ const functionCalls2 = parts2.map((part) => part.functionCall).filter((call) => Boolean(call));
38230
+ const value = functionCalls2.length > 0 ? functionCalls2 : void 0;
37541
38231
  let owner = response;
37542
38232
  let descriptor2;
37543
38233
  while (owner && !descriptor2) {
@@ -37588,7 +38278,7 @@ function redactApprovedPlansInHistory(history, savedPlanContent, planPath) {
37588
38278
  const out = history.map((entry) => {
37589
38279
  if (entry?.role !== "model" || !entry.parts) return entry;
37590
38280
  let entryChanged = false;
37591
- const parts = entry.parts.map((part) => {
38281
+ const parts2 = entry.parts.map((part) => {
37592
38282
  const fc = part.functionCall;
37593
38283
  if (!fc?.id || canonicalPlanToolName(fc.name) !== ToolNames.EXIT_PLAN_MODE)
37594
38284
  return part;
@@ -37605,7 +38295,7 @@ function redactApprovedPlansInHistory(history, savedPlanContent, planPath) {
37605
38295
  });
37606
38296
  if (!entryChanged) return entry;
37607
38297
  changed = true;
37608
- return { ...entry, parts };
38298
+ return { ...entry, parts: parts2 };
37609
38299
  });
37610
38300
  return changed ? out : null;
37611
38301
  }
@@ -37784,8 +38474,8 @@ function isPlainTextPart(part) {
37784
38474
  return part !== void 0 && isValidNonThoughtTextPart(part);
37785
38475
  }
37786
38476
  __name(isPlainTextPart, "isPlainTextPart");
37787
- function getPlainTextFromParts(parts) {
37788
- return (parts ?? []).filter(isPlainTextPart).map((part) => part.text).join("");
38477
+ function getPlainTextFromParts(parts2) {
38478
+ return (parts2 ?? []).filter(isPlainTextPart).map((part) => part.text).join("");
37789
38479
  }
37790
38480
  __name(getPlainTextFromParts, "getPlainTextFromParts");
37791
38481
  function sanitizeRecoverySuffixTail(tail) {
@@ -37843,9 +38533,9 @@ function appendRecoveryContinuationParts(previousParts, continuationParts) {
37843
38533
  return [...mergedParts, ...nextParts];
37844
38534
  }
37845
38535
  __name(appendRecoveryContinuationParts, "appendRecoveryContinuationParts");
37846
- function findLastPlainTextPartIndex(parts) {
37847
- for (let i = parts.length - 1; i >= 0; i -= 1) {
37848
- if (isPlainTextPart(parts[i])) {
38536
+ function findLastPlainTextPartIndex(parts2) {
38537
+ for (let i = parts2.length - 1; i >= 0; i -= 1) {
38538
+ if (isPlainTextPart(parts2[i])) {
37849
38539
  return i;
37850
38540
  }
37851
38541
  }
@@ -37986,13 +38676,13 @@ function stripThoughtPartsFromContent(content) {
37986
38676
  if (!content.parts) {
37987
38677
  return content;
37988
38678
  }
37989
- const parts = content.parts.filter((part) => !part.thought);
37990
- if (parts.length === 0) {
38679
+ const parts2 = content.parts.filter((part) => !part.thought);
38680
+ if (parts2.length === 0) {
37991
38681
  return null;
37992
38682
  }
37993
38683
  return {
37994
38684
  ...content,
37995
- parts
38685
+ parts: parts2
37996
38686
  };
37997
38687
  }
37998
38688
  __name(stripThoughtPartsFromContent, "stripThoughtPartsFromContent");
@@ -38100,9 +38790,9 @@ function scanModelTurn(history, modelIdx) {
38100
38790
  const matched = /* @__PURE__ */ new Map();
38101
38791
  let scanIdx = modelIdx + 1;
38102
38792
  while (scanIdx < history.length && history[scanIdx]?.role === "user") {
38103
- const parts = history[scanIdx].parts ?? [];
38104
- for (let pIdx = 0; pIdx < parts.length; pIdx++) {
38105
- const part = parts[pIdx];
38793
+ const parts2 = history[scanIdx].parts ?? [];
38794
+ for (let pIdx = 0; pIdx < parts2.length; pIdx++) {
38795
+ const part = parts2[pIdx];
38106
38796
  const id = part.functionResponse?.id;
38107
38797
  if (id) {
38108
38798
  const list2 = matched.get(id);
@@ -40028,10 +40718,10 @@ This error was probably caused by cyclic schema references in one of the followi
40028
40718
  const protocolTagDetector = new LeadingProtocolTagLeakDetector();
40029
40719
  let pendingProtocolParts = [];
40030
40720
  const takePendingProtocolParts = /* @__PURE__ */ __name(() => {
40031
- const parts = pendingProtocolParts;
40721
+ const parts2 = pendingProtocolParts;
40032
40722
  pendingProtocolParts = [];
40033
40723
  const released = [];
40034
- for (const part of parts) {
40724
+ for (const part of parts2) {
40035
40725
  const previous = released.at(-1);
40036
40726
  if (previous && isValidNonThoughtTextPart(previous) && isValidNonThoughtTextPart(part)) {
40037
40727
  previous.text += part.text;
@@ -40071,12 +40761,12 @@ This error was probably caused by cyclic schema references in one of the followi
40071
40761
  if (protocolTagDetector.leaked) {
40072
40762
  pendingProtocolParts = [];
40073
40763
  } else {
40074
- const parts = takePendingProtocolParts();
40075
- if (parts.length > 0) {
40764
+ const parts2 = takePendingProtocolParts();
40765
+ if (parts2.length > 0) {
40076
40766
  content = {
40077
40767
  ...content,
40078
40768
  role: content?.role ?? "model",
40079
- parts
40769
+ parts: parts2
40080
40770
  };
40081
40771
  candidate.content = content;
40082
40772
  }
@@ -40201,18 +40891,18 @@ This error was probably caused by cyclic schema references in one of the followi
40201
40891
  if (protocolTagDetector.leaked) {
40202
40892
  pendingProtocolParts = [];
40203
40893
  } else {
40204
- const parts = normalizeModelToolCallIds(
40894
+ const parts2 = normalizeModelToolCallIds(
40205
40895
  takePendingProtocolParts(),
40206
40896
  usedToolCallIds,
40207
40897
  rawToolCallIdsInCurrentTurn,
40208
40898
  reservedToolCallIds
40209
40899
  );
40210
40900
  const chunk = {
40211
- candidates: [{ content: { role: "model", parts } }]
40901
+ candidates: [{ content: { role: "model", parts: parts2 } }]
40212
40902
  };
40213
- syncFunctionCallsField(chunk, parts);
40214
- hasToolCall ||= parts.some((part) => part.functionCall);
40215
- allModelParts.push(...parts);
40903
+ syncFunctionCallsField(chunk, parts2);
40904
+ hasToolCall ||= parts2.some((part) => part.functionCall);
40905
+ allModelParts.push(...parts2);
40216
40906
  yield chunk;
40217
40907
  }
40218
40908
  }
@@ -41207,9 +41897,9 @@ function isGeneratedFile(filePath) {
41207
41897
  if (EXCLUDED_EXTENSIONS.has(ext2)) {
41208
41898
  return true;
41209
41899
  }
41210
- const parts = fileName.split(".");
41211
- if (parts.length > 2) {
41212
- const compoundExt = "." + parts.slice(-2).join(".");
41900
+ const parts2 = fileName.split(".");
41901
+ if (parts2.length > 2) {
41902
+ const compoundExt = "." + parts2.slice(-2).join(".");
41213
41903
  if (EXCLUDED_EXTENSIONS.has(compoundExt)) {
41214
41904
  return true;
41215
41905
  }
@@ -42356,10 +43046,10 @@ function parseRule(raw) {
42356
43046
  let specifier = rawSpecifier;
42357
43047
  let toolParamMatchers;
42358
43048
  if (specifierKind === "literal" && !canonicalName.startsWith("mcp__") && rawSpecifier.includes(":")) {
42359
- const parts = rawSpecifier.split(",").map((p2) => p2.trim());
43049
+ const parts2 = rawSpecifier.split(",").map((p2) => p2.trim());
42360
43050
  const plainParts = [];
42361
43051
  const matchers = [];
42362
- for (const part of parts) {
43052
+ for (const part of parts2) {
42363
43053
  const colonIdx = part.indexOf(":");
42364
43054
  if (colonIdx > 0) {
42365
43055
  const key = part.substring(0, colonIdx).trim();
@@ -42476,19 +43166,19 @@ function buildPermissionRules(ctx) {
42476
43166
  if (canonicalName.startsWith("mcp__")) {
42477
43167
  return [displayName];
42478
43168
  }
42479
- const parts = [];
42480
- if (ctx.specifier) parts.push(ctx.specifier);
43169
+ const parts2 = [];
43170
+ if (ctx.specifier) parts2.push(ctx.specifier);
42481
43171
  const stableParamKeys = /* @__PURE__ */ new Set(["model", "subagent_type", "skill"]);
42482
43172
  if (ctx.toolParams) {
42483
43173
  for (const key of stableParamKeys) {
42484
43174
  const v2 = ctx.toolParams[key];
42485
43175
  if (typeof v2 === "string" || typeof v2 === "number") {
42486
43176
  if (ctx.specifier && String(v2) === ctx.specifier) continue;
42487
- parts.push(`${key}:${v2}`);
43177
+ parts2.push(`${key}:${v2}`);
42488
43178
  }
42489
43179
  }
42490
43180
  }
42491
- if (parts.length > 0) return [`${displayName}(${parts.join(",")})`];
43181
+ if (parts2.length > 0) return [`${displayName}(${parts2.join(",")})`];
42492
43182
  return [displayName];
42493
43183
  }
42494
43184
  }
@@ -42523,12 +43213,12 @@ function cleanPathSpecifier(specifier) {
42523
43213
  __name(cleanPathSpecifier, "cleanPathSpecifier");
42524
43214
  function buildHumanReadableRuleLabel(rules) {
42525
43215
  if (!rules.length) return "";
42526
- const parts = [];
43216
+ const parts2 = [];
42527
43217
  for (const rule of rules) {
42528
43218
  const parenIdx = rule.indexOf("(");
42529
43219
  if (parenIdx === -1) {
42530
43220
  const verb2 = DISPLAY_NAME_TO_VERB[rule] ?? rule.toLowerCase();
42531
- parts.push(verb2);
43221
+ parts2.push(verb2);
42532
43222
  continue;
42533
43223
  }
42534
43224
  const displayName = rule.substring(0, parenIdx);
@@ -42541,25 +43231,25 @@ function buildHumanReadableRuleLabel(rules) {
42541
43231
  switch (kind) {
42542
43232
  case "path": {
42543
43233
  const cleanPath = cleanPathSpecifier(specifier);
42544
- parts.push(`${verb} in ${cleanPath}`);
43234
+ parts2.push(`${verb} in ${cleanPath}`);
42545
43235
  break;
42546
43236
  }
42547
43237
  case "command": {
42548
43238
  const cmdVerb = DISPLAY_NAME_TO_VERB[displayName] ?? "run";
42549
43239
  const verbWord = cmdVerb.split(" ")[0];
42550
- parts.push(`${verbWord} '${specifier}' commands`);
43240
+ parts2.push(`${verbWord} '${specifier}' commands`);
42551
43241
  break;
42552
43242
  }
42553
43243
  case "domain":
42554
- parts.push(`${verb} ${specifier}`);
43244
+ parts2.push(`${verb} ${specifier}`);
42555
43245
  break;
42556
43246
  case "literal":
42557
43247
  default:
42558
- parts.push(`${verb} "${specifier}"`);
43248
+ parts2.push(`${verb} "${specifier}"`);
42559
43249
  break;
42560
43250
  }
42561
43251
  }
42562
- return parts.join(", ");
43252
+ return parts2.join(", ");
42563
43253
  }
42564
43254
  __name(buildHumanReadableRuleLabel, "buildHumanReadableRuleLabel");
42565
43255
  var SHELL_OPERATORS = ["&&", "||", ";;", "|&", "|", ";", "&", "\n"];
@@ -52899,14 +53589,14 @@ function detectTurnInterruption(history) {
52899
53589
  trailingUserEntries.unshift(entry);
52900
53590
  }
52901
53591
  const allParts = trailingUserEntries.flatMap((entry) => entry.parts ?? []);
52902
- const parts = [
53592
+ const parts2 = [
52903
53593
  ...allParts.filter((part) => part.functionResponse),
52904
53594
  ...allParts.filter((part) => !part.functionResponse)
52905
53595
  ];
52906
- if (parts.length === 0) {
53596
+ if (parts2.length === 0) {
52907
53597
  return { kind: "none" };
52908
53598
  }
52909
- return { kind: "interrupted_prompt", parts: structuredClone(parts) };
53599
+ return { kind: "interrupted_prompt", parts: structuredClone(parts2) };
52910
53600
  }
52911
53601
  if (last.role === "model") {
52912
53602
  const danglingCalls = [];
@@ -59646,13 +60336,13 @@ var FileTokenStorage = class extends BaseTokenStorage {
59646
60336
  return iv.toString("hex") + ":" + authTag.toString("hex") + ":" + encrypted;
59647
60337
  }
59648
60338
  decrypt(encryptedData) {
59649
- const parts = encryptedData.split(":");
59650
- if (parts.length !== 3) {
60339
+ const parts2 = encryptedData.split(":");
60340
+ if (parts2.length !== 3) {
59651
60341
  throw new Error("Invalid encrypted data format");
59652
60342
  }
59653
- const iv = Buffer.from(parts[0], "hex");
59654
- const authTag = Buffer.from(parts[1], "hex");
59655
- const encrypted = parts[2];
60343
+ const iv = Buffer.from(parts2[0], "hex");
60344
+ const authTag = Buffer.from(parts2[1], "hex");
60345
+ const encrypted = parts2[2];
59656
60346
  const decipher = crypto3.createDecipheriv(
59657
60347
  "aes-256-gcm",
59658
60348
  this.encryptionKey,
@@ -59842,7 +60532,7 @@ var HybridTokenStorage = class extends BaseTokenStorage {
59842
60532
  const forceFileStorage = process.env[FORCE_FILE_STORAGE_ENV_VAR] === "true";
59843
60533
  if (!forceFileStorage) {
59844
60534
  try {
59845
- const { KeychainTokenStorage: KeychainTokenStorage2 } = await import("./keychain-token-storage-NKKCUHI2.js");
60535
+ const { KeychainTokenStorage: KeychainTokenStorage2 } = await import("./keychain-token-storage-3XFJ5ZB2.js");
59846
60536
  const keychainStorage = new KeychainTokenStorage2(this.serviceName);
59847
60537
  const isAvailable = await keychainStorage.isAvailable();
59848
60538
  if (isAvailable) {
@@ -67879,26 +68569,26 @@ var GrepToolInvocation = class extends BaseToolInvocation {
67879
68569
  let includedLines = 0;
67880
68570
  const visibleLines = [];
67881
68571
  if (Number.isFinite(charLimit)) {
67882
- const parts = [];
68572
+ const parts2 = [];
67883
68573
  let currentLength = 0;
67884
68574
  for (const line of linesToInclude) {
67885
68575
  const sep24 = includedLines > 0 ? 1 : 0;
67886
68576
  const projectedLength = currentLength + line.rawLine.length + sep24;
67887
68577
  if (projectedLength <= charLimit) {
67888
- parts.push(line.rawLine);
68578
+ parts2.push(line.rawLine);
67889
68579
  visibleLines.push(line);
67890
68580
  includedLines++;
67891
68581
  currentLength = projectedLength;
67892
68582
  } else {
67893
68583
  const remaining = Math.max(charLimit - currentLength - sep24, 10);
67894
68584
  const partialLine = line.rawLine.slice(0, remaining);
67895
- parts.push(partialLine + "...");
68585
+ parts2.push(partialLine + "...");
67896
68586
  visibleLines.push(line);
67897
68587
  truncatedByCharLimit = true;
67898
68588
  break;
67899
68589
  }
67900
68590
  }
67901
- grepOutput = parts.join("\n");
68591
+ grepOutput = parts2.join("\n");
67902
68592
  } else {
67903
68593
  grepOutput = linesToInclude.map((line) => line.rawLine).join("\n");
67904
68594
  visibleLines.push(...linesToInclude);
@@ -69236,8 +69926,8 @@ var AST = class {
69236
69926
  }
69237
69927
  return this;
69238
69928
  }
69239
- push(...parts) {
69240
- for (const p2 of parts) {
69929
+ push(...parts2) {
69930
+ for (const p2 of parts2) {
69241
69931
  if (p2 === "")
69242
69932
  continue;
69243
69933
  if (typeof p2 !== "string" && !(p2 instanceof _a && p2.#parent === this)) {
@@ -69345,7 +70035,7 @@ var AST = class {
69345
70035
  }
69346
70036
  let i = pos + 1;
69347
70037
  let part = new _a(null, ast);
69348
- const parts = [];
70038
+ const parts2 = [];
69349
70039
  let acc = "";
69350
70040
  while (i < str.length) {
69351
70041
  const c = str.charAt(i++);
@@ -69385,7 +70075,7 @@ var AST = class {
69385
70075
  if (c === "|") {
69386
70076
  part.push(acc);
69387
70077
  acc = "";
69388
- parts.push(part);
70078
+ parts2.push(part);
69389
70079
  part = new _a(null, ast);
69390
70080
  continue;
69391
70081
  }
@@ -69395,7 +70085,7 @@ var AST = class {
69395
70085
  }
69396
70086
  part.push(acc);
69397
70087
  acc = "";
69398
- ast.push(...parts, part);
70088
+ ast.push(...parts2, part);
69399
70089
  return i;
69400
70090
  }
69401
70091
  acc += c;
@@ -70011,24 +70701,24 @@ var Minimatch = class {
70011
70701
  }
70012
70702
  // just get rid of adjascent ** portions
70013
70703
  adjascentGlobstarOptimize(globParts) {
70014
- return globParts.map((parts) => {
70704
+ return globParts.map((parts2) => {
70015
70705
  let gs2 = -1;
70016
- while (-1 !== (gs2 = parts.indexOf("**", gs2 + 1))) {
70706
+ while (-1 !== (gs2 = parts2.indexOf("**", gs2 + 1))) {
70017
70707
  let i = gs2;
70018
- while (parts[i + 1] === "**") {
70708
+ while (parts2[i + 1] === "**") {
70019
70709
  i++;
70020
70710
  }
70021
70711
  if (i !== gs2) {
70022
- parts.splice(gs2, i - gs2);
70712
+ parts2.splice(gs2, i - gs2);
70023
70713
  }
70024
70714
  }
70025
- return parts;
70715
+ return parts2;
70026
70716
  });
70027
70717
  }
70028
70718
  // get rid of adjascent ** and resolve .. portions
70029
70719
  levelOneOptimize(globParts) {
70030
- return globParts.map((parts) => {
70031
- parts = parts.reduce((set, part) => {
70720
+ return globParts.map((parts2) => {
70721
+ parts2 = parts2.reduce((set, part) => {
70032
70722
  const prev = set[set.length - 1];
70033
70723
  if (part === "**" && prev === "**") {
70034
70724
  return set;
@@ -70042,43 +70732,43 @@ var Minimatch = class {
70042
70732
  set.push(part);
70043
70733
  return set;
70044
70734
  }, []);
70045
- return parts.length === 0 ? [""] : parts;
70735
+ return parts2.length === 0 ? [""] : parts2;
70046
70736
  });
70047
70737
  }
70048
- levelTwoFileOptimize(parts) {
70049
- if (!Array.isArray(parts)) {
70050
- parts = this.slashSplit(parts);
70738
+ levelTwoFileOptimize(parts2) {
70739
+ if (!Array.isArray(parts2)) {
70740
+ parts2 = this.slashSplit(parts2);
70051
70741
  }
70052
70742
  let didSomething = false;
70053
70743
  do {
70054
70744
  didSomething = false;
70055
70745
  if (!this.preserveMultipleSlashes) {
70056
- for (let i = 1; i < parts.length - 1; i++) {
70057
- const p2 = parts[i];
70058
- if (i === 1 && p2 === "" && parts[0] === "")
70746
+ for (let i = 1; i < parts2.length - 1; i++) {
70747
+ const p2 = parts2[i];
70748
+ if (i === 1 && p2 === "" && parts2[0] === "")
70059
70749
  continue;
70060
70750
  if (p2 === "." || p2 === "") {
70061
70751
  didSomething = true;
70062
- parts.splice(i, 1);
70752
+ parts2.splice(i, 1);
70063
70753
  i--;
70064
70754
  }
70065
70755
  }
70066
- if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
70756
+ if (parts2[0] === "." && parts2.length === 2 && (parts2[1] === "." || parts2[1] === "")) {
70067
70757
  didSomething = true;
70068
- parts.pop();
70758
+ parts2.pop();
70069
70759
  }
70070
70760
  }
70071
70761
  let dd = 0;
70072
- while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
70073
- const p2 = parts[dd - 1];
70762
+ while (-1 !== (dd = parts2.indexOf("..", dd + 1))) {
70763
+ const p2 = parts2[dd - 1];
70074
70764
  if (p2 && p2 !== "." && p2 !== ".." && p2 !== "**") {
70075
70765
  didSomething = true;
70076
- parts.splice(dd - 1, 2);
70766
+ parts2.splice(dd - 1, 2);
70077
70767
  dd -= 2;
70078
70768
  }
70079
70769
  }
70080
70770
  } while (didSomething);
70081
- return parts.length === 0 ? [""] : parts;
70771
+ return parts2.length === 0 ? [""] : parts2;
70082
70772
  }
70083
70773
  // First phase: single-pattern processing
70084
70774
  // <pre> is 1 or more portions
@@ -70102,57 +70792,57 @@ var Minimatch = class {
70102
70792
  let didSomething = false;
70103
70793
  do {
70104
70794
  didSomething = false;
70105
- for (let parts of globParts) {
70795
+ for (let parts2 of globParts) {
70106
70796
  let gs2 = -1;
70107
- while (-1 !== (gs2 = parts.indexOf("**", gs2 + 1))) {
70797
+ while (-1 !== (gs2 = parts2.indexOf("**", gs2 + 1))) {
70108
70798
  let gss = gs2;
70109
- while (parts[gss + 1] === "**") {
70799
+ while (parts2[gss + 1] === "**") {
70110
70800
  gss++;
70111
70801
  }
70112
70802
  if (gss > gs2) {
70113
- parts.splice(gs2 + 1, gss - gs2);
70803
+ parts2.splice(gs2 + 1, gss - gs2);
70114
70804
  }
70115
- let next = parts[gs2 + 1];
70116
- const p2 = parts[gs2 + 2];
70117
- const p22 = parts[gs2 + 3];
70805
+ let next = parts2[gs2 + 1];
70806
+ const p2 = parts2[gs2 + 2];
70807
+ const p22 = parts2[gs2 + 3];
70118
70808
  if (next !== "..")
70119
70809
  continue;
70120
70810
  if (!p2 || p2 === "." || p2 === ".." || !p22 || p22 === "." || p22 === "..") {
70121
70811
  continue;
70122
70812
  }
70123
70813
  didSomething = true;
70124
- parts.splice(gs2, 1);
70125
- const other2 = parts.slice(0);
70814
+ parts2.splice(gs2, 1);
70815
+ const other2 = parts2.slice(0);
70126
70816
  other2[gs2] = "**";
70127
70817
  globParts.push(other2);
70128
70818
  gs2--;
70129
70819
  }
70130
70820
  if (!this.preserveMultipleSlashes) {
70131
- for (let i = 1; i < parts.length - 1; i++) {
70132
- const p2 = parts[i];
70133
- if (i === 1 && p2 === "" && parts[0] === "")
70821
+ for (let i = 1; i < parts2.length - 1; i++) {
70822
+ const p2 = parts2[i];
70823
+ if (i === 1 && p2 === "" && parts2[0] === "")
70134
70824
  continue;
70135
70825
  if (p2 === "." || p2 === "") {
70136
70826
  didSomething = true;
70137
- parts.splice(i, 1);
70827
+ parts2.splice(i, 1);
70138
70828
  i--;
70139
70829
  }
70140
70830
  }
70141
- if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
70831
+ if (parts2[0] === "." && parts2.length === 2 && (parts2[1] === "." || parts2[1] === "")) {
70142
70832
  didSomething = true;
70143
- parts.pop();
70833
+ parts2.pop();
70144
70834
  }
70145
70835
  }
70146
70836
  let dd = 0;
70147
- while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
70148
- const p2 = parts[dd - 1];
70837
+ while (-1 !== (dd = parts2.indexOf("..", dd + 1))) {
70838
+ const p2 = parts2[dd - 1];
70149
70839
  if (p2 && p2 !== "." && p2 !== ".." && p2 !== "**") {
70150
70840
  didSomething = true;
70151
- const needDot = dd === 1 && parts[dd + 1] === "**";
70841
+ const needDot = dd === 1 && parts2[dd + 1] === "**";
70152
70842
  const splin = needDot ? ["."] : [];
70153
- parts.splice(dd - 1, 2, ...splin);
70154
- if (parts.length === 0)
70155
- parts.push("");
70843
+ parts2.splice(dd - 1, 2, ...splin);
70844
+ if (parts2.length === 0)
70845
+ parts2.push("");
70156
70846
  dd -= 2;
70157
70847
  }
70158
70848
  }
@@ -76589,25 +77279,25 @@ function resolveOwnsModel(config) {
76589
77279
  }
76590
77280
  __name(resolveOwnsModel, "resolveOwnsModel");
76591
77281
  function buildGenerationConfig(spec) {
76592
- const parts = {};
77282
+ const parts2 = {};
76593
77283
  let hasAny = false;
76594
77284
  if (spec.enableThinking) {
76595
- parts.extra_body = { enable_thinking: true };
77285
+ parts2.extra_body = { enable_thinking: true };
76596
77286
  hasAny = true;
76597
77287
  }
76598
77288
  if (spec.thinkingMandatory) {
76599
- parts.thinkingMandatory = true;
77289
+ parts2.thinkingMandatory = true;
76600
77290
  hasAny = true;
76601
77291
  }
76602
77292
  if (spec.contextWindowSize) {
76603
- parts.contextWindowSize = spec.contextWindowSize;
77293
+ parts2.contextWindowSize = spec.contextWindowSize;
76604
77294
  hasAny = true;
76605
77295
  }
76606
77296
  if (spec.modalities && Object.values(spec.modalities).some(Boolean)) {
76607
- parts.modalities = spec.modalities;
77297
+ parts2.modalities = spec.modalities;
76608
77298
  hasAny = true;
76609
77299
  }
76610
- return hasAny ? parts : void 0;
77300
+ return hasAny ? parts2 : void 0;
76611
77301
  }
76612
77302
  __name(buildGenerationConfig, "buildGenerationConfig");
76613
77303
  function buildAdvancedGenerationConfig(advCfg) {
@@ -79757,8 +80447,8 @@ ${WORKTREES_DIR}/
79757
80447
  init_esbuild_shims();
79758
80448
  var debugLogger56 = createDebugLogger("TOOL_RESULT_VISION_BRIDGE");
79759
80449
  function getNestedParts(part) {
79760
- const parts = part.functionResponse?.parts;
79761
- return Array.isArray(parts) ? parts : void 0;
80450
+ const parts2 = part.functionResponse?.parts;
80451
+ return Array.isArray(parts2) ? parts2 : void 0;
79762
80452
  }
79763
80453
  __name(getNestedParts, "getNestedParts");
79764
80454
  function appendResponseText(response, text) {
@@ -80104,8 +80794,8 @@ ${body}`;
80104
80794
  }
80105
80795
  return this.visibleTextParts(projection.parts);
80106
80796
  }
80107
- visibleTextParts(parts) {
80108
- return parts.filter((p2) => !p2.thought && p2.text).map((p2) => p2.text).join("").trim();
80797
+ visibleTextParts(parts2) {
80798
+ return parts2.filter((p2) => !p2.thought && p2.text).map((p2) => p2.text).join("").trim();
80109
80799
  }
80110
80800
  static TITLE_MAX_LENGTH = 80;
80111
80801
  deriveTitle(records) {
@@ -82764,14 +83454,14 @@ function attachJsonlTranscriptWriter(emitter, jsonlPath, options2) {
82764
83454
  }
82765
83455
  }, "appendStreamText");
82766
83456
  const onRoundText = /* @__PURE__ */ __name((event) => {
82767
- const parts = [
83457
+ const parts2 = [
82768
83458
  ...event.thoughtText ? [{ text: event.thoughtText, thought: true }] : [],
82769
83459
  ...event.text ? [{ text: event.text }] : []
82770
83460
  ];
82771
- if (parts.length === 0 && !event.usageMetadata) return;
83461
+ if (parts2.length === 0 && !event.usageMetadata) return;
82772
83462
  append({
82773
83463
  ...baseFields("assistant"),
82774
- message: { role: "model", parts },
83464
+ message: { role: "model", parts: parts2 },
82775
83465
  usageMetadata: event.usageMetadata,
82776
83466
  agentRunId: event.runId ?? streamRunId,
82777
83467
  agentRound: event.round
@@ -88039,8 +88729,8 @@ async function getProcessInfo(pid) {
88039
88729
  if (!trimmedStdout) {
88040
88730
  return { parentPid: 0, name: "", command: "" };
88041
88731
  }
88042
- const parts = trimmedStdout.split(/\s+/);
88043
- const ppidString = parts[0];
88732
+ const parts2 = trimmedStdout.split(/\s+/);
88733
+ const ppidString = parts2[0];
88044
88734
  const parentPid = parseInt(ppidString, 10);
88045
88735
  const fullCommand = trimmedStdout.substring(ppidString.length).trim();
88046
88736
  const processName = path48.basename(fullCommand.split(" ")[0]);
@@ -90660,8 +91350,8 @@ var LspResponseNormalizer = class {
90660
91350
  return contents;
90661
91351
  }
90662
91352
  if (Array.isArray(contents)) {
90663
- const parts = contents.map((item) => this.normalizeHoverContents(item)).map((item) => item.trim()).filter((item) => item.length > 0);
90664
- return parts.join("\n");
91353
+ const parts2 = contents.map((item) => this.normalizeHoverContents(item)).map((item) => item.trim()).filter((item) => item.length > 0);
91354
+ return parts2.join("\n");
90665
91355
  }
90666
91356
  if (typeof contents === "object") {
90667
91357
  const contentsObj = contents;
@@ -98828,14 +99518,14 @@ async function cloneFromGit(installMetadata, destination, signal) {
98828
99518
  __name(cloneFromGit, "cloneFromGit");
98829
99519
  function parseGitHubRepoForReleases(source) {
98830
99520
  const parsedUrl = URL.parse(source, "https://github.com");
98831
- const parts = parsedUrl?.pathname.substring(1).split("/");
98832
- if (parts?.length !== 2 || parsedUrl?.host !== "github.com") {
99521
+ const parts2 = parsedUrl?.pathname.substring(1).split("/");
99522
+ if (parts2?.length !== 2 || parsedUrl?.host !== "github.com") {
98833
99523
  throw new Error(
98834
99524
  `Invalid GitHub repository source: ${redactUrlCredentials(source)}. Expected "owner/repo" or a github repo uri.`
98835
99525
  );
98836
99526
  }
98837
- const owner = parts[0];
98838
- const repo = parts[1].replace(/\.git$/, "");
99527
+ const owner = parts2[0];
99528
+ const repo = parts2[1].replace(/\.git$/, "");
98839
99529
  if (owner.startsWith("git@github.com")) {
98840
99530
  throw new Error(
98841
99531
  `GitHub release-based extensions are not supported for SSH. You must use an HTTPS URI with a personal access token to download releases from private repositories. You can set your personal access token in the GITHUB_TOKEN environment variable and install the extension via SSH.`
@@ -104955,7 +105645,7 @@ var ExtensionManager = class _ExtensionManager {
104955
105645
  } catch {
104956
105646
  return "dir:-";
104957
105647
  }
104958
- const parts = [];
105648
+ const parts2 = [];
104959
105649
  for (const entry of entries) {
104960
105650
  const extensionRoot = path72.join(this.configDir, entry);
104961
105651
  const installMetadata = this.loadInstallMetadata(extensionRoot);
@@ -104978,9 +105668,9 @@ var ExtensionManager = class _ExtensionManager {
104978
105668
  followManifestSymlink
104979
105669
  );
104980
105670
  if (stamp === "-") continue;
104981
- parts.push(`ext:${entry}:${stamp}`);
105671
+ parts2.push(`ext:${entry}:${stamp}`);
104982
105672
  }
104983
- return parts.sort().join("|");
105673
+ return parts2.sort().join("|");
104984
105674
  }
104985
105675
  /**
104986
105676
  * Fingerprints the enablement file and the store's activation state — where
@@ -107479,9 +108169,9 @@ var WatchHelper = class {
107479
108169
  this.watchPath = watchPath;
107480
108170
  this.fullWatchPath = sysPath2.resolve(watchPath);
107481
108171
  this.dirParts = [];
107482
- this.dirParts.forEach((parts) => {
107483
- if (parts.length > 1)
107484
- parts.pop();
108172
+ this.dirParts.forEach((parts2) => {
108173
+ if (parts2.length > 1)
108174
+ parts2.pop();
107485
108175
  });
107486
108176
  this.followSymlinks = follow;
107487
108177
  this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
@@ -112954,24 +113644,24 @@ ${_TeamManager.escapeEnvelopeTags(m2.text)}
112954
113644
  }
112955
113645
  }
112956
113646
  }
112957
- const parts = [
113647
+ const parts2 = [
112958
113648
  "<team_status>",
112959
113649
  `${active} active, ${completed} completed` + (stalled > 0 ? `, ${stalled} stalled.` : "."),
112960
113650
  ...lines
112961
113651
  ];
112962
113652
  if (stalled > 0 && active === 0) {
112963
- parts.push(
113653
+ parts2.push(
112964
113654
  "",
112965
113655
  "All remaining teammates are stalled. Proceed with the results you have \u2014 write your report now."
112966
113656
  );
112967
113657
  } else {
112968
- parts.push(
113658
+ parts2.push(
112969
113659
  "",
112970
113660
  "Do NOT call task_list to check on teammates. Their results will arrive as messages. Wait patiently or proceed with other work."
112971
113661
  );
112972
113662
  }
112973
- parts.push("</team_status>");
112974
- return parts.join("\n");
113663
+ parts2.push("</team_status>");
113664
+ return parts2.join("\n");
112975
113665
  }
112976
113666
  /**
112977
113667
  * Returns true if all non-terminal teammates are stalled
@@ -114768,9 +115458,9 @@ function reconstructHistory(records, leafUuid) {
114768
115458
  return uuids.map((uuid) => firstByUuid.get(uuid)).filter((record2) => !!record2);
114769
115459
  }
114770
115460
  __name(reconstructHistory, "reconstructHistory");
114771
- function extractText(parts) {
114772
- if (!parts?.length) return "";
114773
- return parts.map((part) => "text" in part && part.text ? part.text : "").join("\n").trim();
115461
+ function extractText(parts2) {
115462
+ if (!parts2?.length) return "";
115463
+ return parts2.map((part) => "text" in part && part.text ? part.text : "").join("\n").trim();
114774
115464
  }
114775
115465
  __name(extractText, "extractText");
114776
115466
  function coalesceAdjacentUserHistory(messages) {
@@ -116634,8 +117324,8 @@ async function runSpeculativeLoop(config, state, cacheSafe, modelOverride) {
116634
117324
  if (state.abortController?.signal.aborted) break;
116635
117325
  if (event.type !== "chunk" /* CHUNK */) continue;
116636
117326
  const response = event.value;
116637
- const parts = response.candidates?.[0]?.content?.parts ?? [];
116638
- for (const part of parts) {
117327
+ const parts2 = response.candidates?.[0]?.content?.parts ?? [];
117328
+ for (const part of parts2) {
116639
117329
  if (part.text && !part["thought"]) {
116640
117330
  modelParts.push({ text: part.text });
116641
117331
  }
@@ -116654,16 +117344,16 @@ async function runSpeculativeLoop(config, state, cacheSafe, modelOverride) {
116654
117344
  if (modelParts.length === 0) break;
116655
117345
  const modelMsg = { role: "model", parts: modelParts };
116656
117346
  messages.push(modelMsg);
116657
- const functionCalls = modelParts.filter(
117347
+ const functionCalls2 = modelParts.filter(
116658
117348
  (p2) => p2.functionCall !== void 0
116659
117349
  );
116660
- if (functionCalls.length === 0) {
117350
+ if (functionCalls2.length === 0) {
116661
117351
  break;
116662
117352
  }
116663
- let functionResponses = [];
117353
+ let functionResponses2 = [];
116664
117354
  const responseEntries = [];
116665
117355
  let hitBoundary = false;
116666
- for (const part of functionCalls) {
117356
+ for (const part of functionCalls2) {
116667
117357
  const fc = part.functionCall;
116668
117358
  const name = fc.name ?? "";
116669
117359
  const id = fc.id;
@@ -116699,7 +117389,7 @@ async function runSpeculativeLoop(config, state, cacheSafe, modelOverride) {
116699
117389
  response: { error: `Tool '${name}' not found` }
116700
117390
  }
116701
117391
  };
116702
- functionResponses.push(responsePart);
117392
+ functionResponses2.push(responsePart);
116703
117393
  responseEntries.push({
116704
117394
  callId: persistenceCallId,
116705
117395
  toolName: name,
@@ -116755,7 +117445,7 @@ async function runSpeculativeLoop(config, state, cacheSafe, modelOverride) {
116755
117445
  const { id: _id, ...functionResponse } = responsePart.functionResponse;
116756
117446
  return { ...responsePart, functionResponse };
116757
117447
  });
116758
- functionResponses.push(...responseParts);
117448
+ functionResponses2.push(...responseParts);
116759
117449
  responseEntries.push({
116760
117450
  callId: persistenceCallId,
116761
117451
  toolName: name,
@@ -116772,7 +117462,7 @@ async function runSpeculativeLoop(config, state, cacheSafe, modelOverride) {
116772
117462
  }
116773
117463
  }
116774
117464
  };
116775
- functionResponses.push(responsePart);
117465
+ functionResponses2.push(responsePart);
116776
117466
  responseEntries.push({
116777
117467
  callId: persistenceCallId,
116778
117468
  toolName: name,
@@ -116782,14 +117472,14 @@ async function runSpeculativeLoop(config, state, cacheSafe, modelOverride) {
116782
117472
  }
116783
117473
  if (responseEntries.length > 0) {
116784
117474
  const finalized = await finalizeToolResponses(config, responseEntries);
116785
- functionResponses = finalized.flatMap((entry) => entry.responseParts);
117475
+ functionResponses2 = finalized.flatMap((entry) => entry.responseParts);
116786
117476
  }
116787
117477
  if (hitBoundary) {
116788
- if (functionResponses.length > 0) {
117478
+ if (functionResponses2.length > 0) {
116789
117479
  let keptFunctionCalls = 0;
116790
117480
  const keptModelParts = modelParts.filter((p2) => {
116791
117481
  if (!p2.functionCall) return true;
116792
- if (keptFunctionCalls < functionResponses.length) {
117482
+ if (keptFunctionCalls < functionResponses2.length) {
116793
117483
  keptFunctionCalls++;
116794
117484
  return true;
116795
117485
  }
@@ -116800,7 +117490,7 @@ async function runSpeculativeLoop(config, state, cacheSafe, modelOverride) {
116800
117490
  role: "model",
116801
117491
  parts: keptModelParts
116802
117492
  };
116803
- messages.push({ role: "user", parts: functionResponses });
117493
+ messages.push({ role: "user", parts: functionResponses2 });
116804
117494
  } else {
116805
117495
  messages.pop();
116806
117496
  }
@@ -116826,8 +117516,8 @@ async function runSpeculativeLoop(config, state, cacheSafe, modelOverride) {
116826
117516
  }
116827
117517
  };
116828
117518
  }
116829
- if (functionResponses.length > 0) {
116830
- const resultMsg = { role: "user", parts: functionResponses };
117519
+ if (functionResponses2.length > 0) {
117520
+ const resultMsg = { role: "user", parts: functionResponses2 };
116831
117521
  messages.push(resultMsg);
116832
117522
  }
116833
117523
  }
@@ -117325,14 +118015,14 @@ function redactArgsForLog(args) {
117325
118015
  }
117326
118016
  __name(redactArgsForLog, "redactArgsForLog");
117327
118017
  function logCommandProblem(kind, command, args, detail) {
117328
- const parts = [`[crawler] ${kind}:`, command, redactArgsForLog(args)];
118018
+ const parts2 = [`[crawler] ${kind}:`, command, redactArgsForLog(args)];
117329
118019
  if (detail.code !== void 0 && detail.code !== null) {
117330
- parts.push(`exit=${String(detail.code)}`);
118020
+ parts2.push(`exit=${String(detail.code)}`);
117331
118021
  }
117332
118022
  if (detail.stderr && detail.stderr.length > 0) {
117333
- parts.push(truncateStderrSnippet(detail.stderr));
118023
+ parts2.push(truncateStderrSnippet(detail.stderr));
117334
118024
  }
117335
- console.warn(parts.join(" "));
118025
+ console.warn(parts2.join(" "));
117336
118026
  }
117337
118027
  __name(logCommandProblem, "logCommandProblem");
117338
118028
  function withSafeGitConfig(args) {
@@ -118147,10 +118837,10 @@ function buildResultsFromFileSet(files, extraDirectories = []) {
118147
118837
  dirSet.add(dir);
118148
118838
  }
118149
118839
  for (const file of files) {
118150
- const parts = file.split("/");
118840
+ const parts2 = file.split("/");
118151
118841
  let current = "";
118152
- for (let i = 0; i < parts.length - 1; i++) {
118153
- current = current ? current + "/" + parts[i] : parts[i];
118842
+ for (let i = 0; i < parts2.length - 1; i++) {
118843
+ current = current ? current + "/" + parts2[i] : parts2[i];
118154
118844
  dirSet.add(current + "/");
118155
118845
  }
118156
118846
  }
@@ -120040,16 +120730,16 @@ __name(fetchGitBranches, "fetchGitBranches");
120040
120730
  function parseBranchLines(raw) {
120041
120731
  if (!raw.trim()) return [];
120042
120732
  return raw.trim().split("\n").filter(Boolean).filter((line) => {
120043
- const parts = line.split(SEPARATOR);
120044
- return !(parts[6] ?? "");
120733
+ const parts2 = line.split(SEPARATOR);
120734
+ return !(parts2[6] ?? "");
120045
120735
  }).map((line) => {
120046
- const parts = line.split(SEPARATOR);
120047
- const name = parts[0] ?? "";
120048
- const isHead = parts[1] === "*";
120049
- const upstream = parts[2] || void 0;
120050
- const track = parts[3] ?? "";
120051
- const commitDate = parseInt(parts[4] ?? "0", 10) || 0;
120052
- const commitSubject = parts[5] ?? "";
120736
+ const parts2 = line.split(SEPARATOR);
120737
+ const name = parts2[0] ?? "";
120738
+ const isHead = parts2[1] === "*";
120739
+ const upstream = parts2[2] || void 0;
120740
+ const track = parts2[3] ?? "";
120741
+ const commitDate = parseInt(parts2[4] ?? "0", 10) || 0;
120742
+ const commitSubject = parts2[5] ?? "";
120053
120743
  let ahead = 0;
120054
120744
  let behind = 0;
120055
120745
  const aheadMatch = /ahead (\d+)/.exec(track);
@@ -120071,11 +120761,11 @@ __name(parseBranchLines, "parseBranchLines");
120071
120761
  function parseTagLines(raw) {
120072
120762
  if (!raw.trim()) return [];
120073
120763
  return raw.trim().split("\n").filter(Boolean).map((line) => {
120074
- const parts = line.split(SEPARATOR);
120764
+ const parts2 = line.split(SEPARATOR);
120075
120765
  return {
120076
- name: parts[0] ?? "",
120077
- date: parseInt(parts[1] ?? "0", 10) || 0,
120078
- subject: parts[2] ?? ""
120766
+ name: parts2[0] ?? "",
120767
+ date: parseInt(parts2[1] ?? "0", 10) || 0,
120768
+ subject: parts2[2] ?? ""
120079
120769
  };
120080
120770
  });
120081
120771
  }
@@ -125124,9 +125814,9 @@ function isMetadataAddress(address) {
125124
125814
  }
125125
125815
  __name(isMetadataAddress, "isMetadataAddress");
125126
125816
  function isBlockedV4(address) {
125127
- const parts = address.split(".").map(Number);
125128
- const [a, b2] = parts;
125129
- if (parts.length !== 4 || a === void 0 || b2 === void 0 || parts.some((n) => Number.isNaN(n))) {
125817
+ const parts2 = address.split(".").map(Number);
125818
+ const [a, b2] = parts2;
125819
+ if (parts2.length !== 4 || a === void 0 || b2 === void 0 || parts2.some((n) => Number.isNaN(n))) {
125130
125820
  return false;
125131
125821
  }
125132
125822
  if (a === 127) return false;
@@ -129737,8 +130427,8 @@ function applySedSubstitution(content, sedInfo) {
129737
130427
  const replaceAll = sedInfo.flags.includes("g");
129738
130428
  try {
129739
130429
  const globalRegex = new RegExp(jsPattern, "g");
129740
- const parts = content.split(/(\n)/);
129741
- const processableParts = content.endsWith("\n") ? parts.slice(0, -1) : parts;
130430
+ const parts2 = content.split(/(\n)/);
130431
+ const processableParts = content.endsWith("\n") ? parts2.slice(0, -1) : parts2;
129742
130432
  return processableParts.map((part, index) => {
129743
130433
  if (index % 2 === 1) {
129744
130434
  return part;
@@ -132382,10 +133072,10 @@ To inspect: /tasks (text) or the interactive Background tasks dialog (focus the
132382
133072
  deletedFiles.add(line.slice(2).trim());
132383
133073
  continue;
132384
133074
  }
132385
- const parts = line.split(" ");
132386
- const status = parts[0] ?? "";
132387
- if (status.startsWith("R") && parts.length >= 3) {
132388
- renamedFiles.set(parts[1].trim(), parts[2].trim());
133075
+ const parts2 = line.split(" ");
133076
+ const status = parts2[0] ?? "";
133077
+ if (status.startsWith("R") && parts2.length >= 3) {
133078
+ renamedFiles.set(parts2[1].trim(), parts2[2].trim());
132389
133079
  }
132390
133080
  }
132391
133081
  const diffSizes = parseNumstat(numstatOutput);
@@ -132845,8 +133535,8 @@ var GATE_EXEMPT_TOOLS = /* @__PURE__ */ new Set([
132845
133535
  function extractTextFromPartListUnion(c) {
132846
133536
  if (typeof c === "string") return c;
132847
133537
  if (Array.isArray(c)) {
132848
- const parts = toParts2(c);
132849
- return parts.map((p2) => p2.text ?? "").join("\n");
133538
+ const parts2 = toParts2(c);
133539
+ return parts2.map((p2) => p2.text ?? "").join("\n");
132850
133540
  }
132851
133541
  if (c && typeof c === "object") {
132852
133542
  if ("text" in c) {
@@ -133140,15 +133830,15 @@ function convertToFunctionErrorResponse(toolName, callId, llmContent, fallbackEr
133140
133830
  }
133141
133831
  __name(convertToFunctionErrorResponse, "convertToFunctionErrorResponse");
133142
133832
  function toParts2(input) {
133143
- const parts = [];
133833
+ const parts2 = [];
133144
133834
  for (const part of Array.isArray(input) ? input : [input]) {
133145
133835
  if (typeof part === "string") {
133146
- parts.push({ text: part });
133836
+ parts2.push({ text: part });
133147
133837
  } else if (part) {
133148
- parts.push(part);
133838
+ parts2.push(part);
133149
133839
  }
133150
133840
  }
133151
- return parts;
133841
+ return parts2;
133152
133842
  }
133153
133843
  __name(toParts2, "toParts");
133154
133844
  var VALIDATION_RETRY_LOOP_THRESHOLD = 3;
@@ -137437,7 +138127,7 @@ var AgentCore = class {
137437
138127
  promptId,
137438
138128
  timestamp: Date.now()
137439
138129
  });
137440
- const functionCalls = [];
138130
+ const functionCalls2 = [];
137441
138131
  let roundText = "";
137442
138132
  let roundThoughtText = "";
137443
138133
  let lastUsage = void 0;
@@ -137461,7 +138151,7 @@ var AgentCore = class {
137461
138151
  if (streamEvent.maxOutputTokensEscalated !== void 0) {
137462
138152
  stickyMaxOutputTokens = streamEvent.maxOutputTokensEscalated;
137463
138153
  }
137464
- functionCalls.length = 0;
138154
+ functionCalls2.length = 0;
137465
138155
  roundText = "";
137466
138156
  roundThoughtText = "";
137467
138157
  lastUsage = void 0;
@@ -137481,13 +138171,13 @@ var AgentCore = class {
137481
138171
  currentResponseId = resp.responseId;
137482
138172
  }
137483
138173
  const chunkFunctionCalls = resp.functionCalls ?? [];
137484
- functionCalls.push(...chunkFunctionCalls);
138174
+ functionCalls2.push(...chunkFunctionCalls);
137485
138175
  if (resp.candidates?.[0]?.finishReason === FinishReason.MAX_TOKENS) {
137486
138176
  wasOutputTruncated = true;
137487
138177
  }
137488
138178
  const content = resp.candidates?.[0]?.content;
137489
- const parts = content?.parts || [];
137490
- for (const p2 of parts) {
138179
+ const parts2 = content?.parts || [];
138180
+ for (const p2 of parts2) {
137491
138181
  const txt = p2.text;
137492
138182
  const isThought = p2.thought ?? false;
137493
138183
  if (txt && isThought) roundThoughtText += txt;
@@ -137583,9 +138273,9 @@ var AgentCore = class {
137583
138273
  if (lastUsage) {
137584
138274
  this.recordTokenUsage(lastUsage, turnCounter, roundStreamStart);
137585
138275
  }
137586
- if (functionCalls.length > 0) {
138276
+ if (functionCalls2.length > 0) {
137587
138277
  const toolCallResult = await this.processFunctionCalls(
137588
- functionCalls,
138278
+ functionCalls2,
137589
138279
  roundAbortController,
137590
138280
  promptId,
137591
138281
  turnCounter,
@@ -137870,9 +138560,9 @@ ${text}` : text;
137870
138560
  *
137871
138561
  * Validates each call, schedules authorized calls, collects results, and emits events.
137872
138562
  */
137873
- async processFunctionCalls(functionCalls, abortController, promptId, currentRound, toolsList, responseId, wasOutputTruncated = false, handledProviderToolCallIds = /* @__PURE__ */ new Set(), duplicateProviderToolCallResponseIds = /* @__PURE__ */ new Set()) {
138563
+ async processFunctionCalls(functionCalls2, abortController, promptId, currentRound, toolsList, responseId, wasOutputTruncated = false, handledProviderToolCallIds = /* @__PURE__ */ new Set(), duplicateProviderToolCallResponseIds = /* @__PURE__ */ new Set()) {
137874
138564
  const responseByCallId = /* @__PURE__ */ new Map();
137875
- const uniqueFunctionCalls = dedupeToolCallsById(functionCalls);
138565
+ const uniqueFunctionCalls = dedupeToolCallsById(functionCalls2);
137876
138566
  const generatedCallIdBase = randomUUID12();
137877
138567
  const callIdByFunctionCall = new Map(
137878
138568
  uniqueFunctionCalls.map((functionCall, index) => [
@@ -138205,7 +138895,7 @@ ${text}` : text;
138205
138895
  }
138206
138896
  ];
138207
138897
  });
138208
- if (functionCalls.length > 0 && orderedResponses.length === 0) {
138898
+ if (functionCalls2.length > 0 && orderedResponses.length === 0) {
138209
138899
  orderedResponses.push({
138210
138900
  callId: "tool-call-batch",
138211
138901
  toolName: "tool-call-batch",
@@ -141590,13 +142280,13 @@ async function runForkedAgent(params) {
141590
142280
  for await (const event of stream2) {
141591
142281
  if (event.type !== "chunk" /* CHUNK */) continue;
141592
142282
  const response = event.value;
141593
- const parts = response.candidates?.[0]?.content?.parts ?? [];
141594
- if (preserveTools && parts.some((p2) => p2["functionCall"])) {
142283
+ const parts2 = response.candidates?.[0]?.content?.parts ?? [];
142284
+ if (preserveTools && parts2.some((p2) => p2["functionCall"])) {
141595
142285
  debugLogger128.warn(
141596
142286
  "Cache-path forked query received functionCall with preserveTools; discarding."
141597
142287
  );
141598
142288
  }
141599
- const text = parts.filter((p2) => !p2["thought"]).filter((p2) => !p2["functionCall"]).map((p2) => p2.text ?? "").join("");
142289
+ const text = parts2.filter((p2) => !p2["thought"]).filter((p2) => !p2["functionCall"]).map((p2) => p2.text ?? "").join("");
141600
142290
  if (text) fullText += text;
141601
142291
  if (response.usageMetadata)
141602
142292
  usage = extractQueryUsage(response.usageMetadata);
@@ -142695,10 +143385,10 @@ function toolAliases(toolName) {
142695
143385
  aliases.push(normalized2.split("::").at(-1) ?? "");
142696
143386
  }
142697
143387
  if (normalized2.startsWith("mcp__")) {
142698
- const parts = normalized2.split("__");
142699
- if (parts.length >= 3) {
142700
- aliases.push(parts.slice(2).join("__"));
142701
- aliases.push(parts.at(-1) ?? "");
143388
+ const parts2 = normalized2.split("__");
143389
+ if (parts2.length >= 3) {
143390
+ aliases.push(parts2.slice(2).join("__"));
143391
+ aliases.push(parts2.at(-1) ?? "");
142702
143392
  }
142703
143393
  }
142704
143394
  return Array.from(
@@ -144129,6 +144819,7 @@ var GeminiClient = class _GeminiClient {
144129
144819
  surfacedRelevantAutoMemoryPaths = /* @__PURE__ */ new Set();
144130
144820
  shutdownRequested = false;
144131
144821
  settledSteerInputs = /* @__PURE__ */ new WeakSet();
144822
+ interactionStartTypeByOwner = /* @__PURE__ */ new WeakMap();
144132
144823
  loopDetector;
144133
144824
  lastPromptId = void 0;
144134
144825
  activeTodoWorkChainPromptId;
@@ -145522,7 +146213,9 @@ var GeminiClient = class _GeminiClient {
145522
146213
  if (!interactionOwner || getActiveInteractionSpan(prompt_id) !== interactionOwner) {
145523
146214
  return;
145524
146215
  }
145525
- if (status === "ok" && this.config.getJsonSchema?.()) {
146216
+ const interactionStartType = this.interactionStartTypeByOwner.get(interactionOwner);
146217
+ const ownsStructuredOutputContract = interactionStartType === "userQuery" /* UserQuery */ || interactionStartType === "retry" /* Retry */;
146218
+ if (status === "ok" && ownsStructuredOutputContract && this.config.getJsonSchema?.()) {
145526
146219
  endInteractionSpan("error", {
145527
146220
  promptId: prompt_id,
145528
146221
  errorMessage: "model did not produce structured output",
@@ -145705,6 +146398,9 @@ var GeminiClient = class _GeminiClient {
145705
146398
  messageType
145706
146399
  });
145707
146400
  interactionOwner = getActiveInteractionSpan(prompt_id);
146401
+ if (interactionOwner && !this.interactionStartTypeByOwner.has(interactionOwner)) {
146402
+ this.interactionStartTypeByOwner.set(interactionOwner, messageType);
146403
+ }
145708
146404
  if (interactionOwner && messageType === "userQuery" /* UserQuery */ && typeof options2?.submittedPrompt === "string") {
145709
146405
  addAgentInputMessageAttributes(
145710
146406
  this.config,
@@ -145716,6 +146412,7 @@ var GeminiClient = class _GeminiClient {
145716
146412
  let userPromptRecordPayload;
145717
146413
  let hooksEnabled;
145718
146414
  let messageBus;
146415
+ let userPromptSubmitFailureMessage = "UserPromptSubmit hook failed";
145719
146416
  try {
145720
146417
  hooksEnabled = !this.config.getDisableAllHooks();
145721
146418
  messageBus = this.config.getMessageBus();
@@ -145740,6 +146437,7 @@ var GeminiClient = class _GeminiClient {
145740
146437
  const hookOutput = response.output ? createHookOutput("UserPromptSubmit", response.output) : void 0;
145741
146438
  if (hookOutput?.isBlockingDecision() || hookOutput?.shouldStopExecution()) {
145742
146439
  if (goalPermit) {
146440
+ userPromptSubmitFailureMessage = "Goal turn finalization failed";
145743
146441
  const runtime = await loadGoalRuntime(true);
145744
146442
  if (!runtime || !goalTurnKey) {
145745
146443
  throw new Error("Goal turn admission is unavailable");
@@ -145788,7 +146486,7 @@ var GeminiClient = class _GeminiClient {
145788
146486
  } catch (error) {
145789
146487
  endCurrentInteraction(
145790
146488
  signal.aborted ? "cancelled" : "error",
145791
- signal.aborted ? void 0 : "UserPromptSubmit hook failed",
146489
+ signal.aborted ? void 0 : userPromptSubmitFailureMessage,
145792
146490
  signal.aborted ? void 0 : getErrorType(error)
145793
146491
  );
145794
146492
  for (const goalEvent of await finalizeInterruptedGoalTurn()) {
@@ -146342,16 +147040,16 @@ The current date is: ${today}. Note: This is the authoritative current date \u20
146342
147040
  if (event.type === "error" /* Error */) {
146343
147041
  this.forceFullIdeContext = true;
146344
147042
  if (arenaAgentClient) {
146345
- const errorMsg = event.value instanceof Error ? event.value.message : "Unknown error";
146346
- await arenaAgentClient.reportError(errorMsg);
147043
+ const status = event.value.error?.status;
147044
+ const arenaError = status === 401 || status === 403 ? "Authentication failed" : status === 429 ? "Rate limit exceeded" : status !== void 0 && status >= 500 ? "Provider service unavailable" : status !== void 0 ? `API request failed (${status})` : "Provider request failed";
147045
+ try {
147046
+ await arenaAgentClient.reportError(arenaError);
147047
+ } catch {
147048
+ this.config.getDebugLogger().warn("Failed to report Arena provider error");
147049
+ }
146347
147050
  }
146348
147051
  this.lastApiCompletionTimestamp = Date.now();
146349
- const errMsg = event.value instanceof Error ? "[API error]" : "unknown error";
146350
- endCurrentInteraction(
146351
- "error",
146352
- errMsg,
146353
- event.value instanceof Error ? getErrorType(event.value) : "api_error"
146354
- );
147052
+ endCurrentInteraction("error", "unknown error", "api_error");
146355
147053
  this.cancelPendingMemoryPrefetch("no_safe_delivery_point");
146356
147054
  return turn;
146357
147055
  }
@@ -146762,6 +147460,13 @@ The current date is: ${today}. Note: This is the authoritative current date \u20
146762
147460
  for (const goalEvent of await finalizeInterruptedGoalTurn()) {
146763
147461
  yield goalEvent;
146764
147462
  }
147463
+ if (error instanceof UnauthorizedError && messageType !== "hook" /* Hook */ && messageType !== "steer" /* Steer */) {
147464
+ try {
147465
+ await this.config.getArenaAgentClient()?.reportError("Authentication failed");
147466
+ } catch {
147467
+ this.config.getDebugLogger().warn("Failed to report Arena authentication error");
147468
+ }
147469
+ }
146765
147470
  throw error;
146766
147471
  } finally {
146767
147472
  if (this.activeAutomaticTodoWorkChainPromptIds.has(prompt_id) && (!normalCompletion || !hasToolCalls)) {
@@ -151125,10 +151830,10 @@ var Config = class _Config {
151125
151830
  return this.systemPrompt;
151126
151831
  }
151127
151832
  getAppendSystemPrompt() {
151128
- const parts = [this.appendSystemPrompt, this.liveAppendSystemPrompt].filter(
151833
+ const parts2 = [this.appendSystemPrompt, this.liveAppendSystemPrompt].filter(
151129
151834
  (part) => Boolean(part?.trim())
151130
151835
  );
151131
- return parts.length > 0 ? parts.join("\n\n") : void 0;
151836
+ return parts2.length > 0 ? parts2.join("\n\n") : void 0;
151132
151837
  }
151133
151838
  setLiveAppendSystemPrompt(prompt) {
151134
151839
  this.liveAppendSystemPrompt = prompt;
@@ -153450,7 +154155,7 @@ var Config = class _Config {
153450
154155
  }
153451
154156
  if (!enabled) return;
153452
154157
  registry.registerFactory(ToolNames.IMAGE_GEN, async () => {
153453
- const { ImageGenTool } = await import("./image-gen-YPK2AZT4.js");
154158
+ const { ImageGenTool } = await import("./image-gen-EXECB5XM.js");
153454
154159
  return new ImageGenTool(this);
153455
154160
  });
153456
154161
  }
@@ -153480,36 +154185,36 @@ var Config = class _Config {
153480
154185
  if (options2?.forSubAgent) return;
153481
154186
  const schema = this.jsonSchema;
153482
154187
  await registerLazy(ToolNames.STRUCTURED_OUTPUT, async () => {
153483
- const { SyntheticOutputTool } = await import("./syntheticOutput-DVHJMUGV.js");
154188
+ const { SyntheticOutputTool } = await import("./syntheticOutput-7GWFIDXT.js");
153484
154189
  return new SyntheticOutputTool(schema);
153485
154190
  });
153486
154191
  }, "registerStructuredOutputIfRequested");
153487
154192
  const registerGoalWorkerTools = /* @__PURE__ */ __name(async () => {
153488
154193
  if (options2?.forSubAgent) return;
153489
154194
  await registerLazy(ToolNames.GET_GOAL, async () => {
153490
- const { GetGoalTool } = await import("./goal-tools-M4UDAZXP.js");
154195
+ const { GetGoalTool } = await import("./goal-tools-VHTNVOKK.js");
153491
154196
  return new GetGoalTool(this);
153492
154197
  });
153493
154198
  await registerLazy(ToolNames.UPDATE_GOAL, async () => {
153494
- const { UpdateGoalTool } = await import("./goal-tools-M4UDAZXP.js");
154199
+ const { UpdateGoalTool } = await import("./goal-tools-VHTNVOKK.js");
153495
154200
  return new UpdateGoalTool(this);
153496
154201
  });
153497
154202
  }, "registerGoalWorkerTools");
153498
154203
  if (this.getBareMode()) {
153499
154204
  await registerLazy(ToolNames.READ_FILE, async () => {
153500
- const { ReadFileTool } = await import("./read-file-LOVUSBJC.js");
154205
+ const { ReadFileTool } = await import("./read-file-TAFBKMNI.js");
153501
154206
  return new ReadFileTool(this);
153502
154207
  });
153503
154208
  await registerLazy(ToolNames.EDIT, async () => {
153504
- const { EditTool } = await import("./edit-X73LA4YO.js");
154209
+ const { EditTool } = await import("./edit-I4LQFAEC.js");
153505
154210
  return new EditTool(this);
153506
154211
  });
153507
154212
  await registerLazy(ToolNames.NOTEBOOK_EDIT, async () => {
153508
- const { NotebookEditTool } = await import("./notebook-edit-QD4TRKLY.js");
154213
+ const { NotebookEditTool } = await import("./notebook-edit-NTDY4QDU.js");
153509
154214
  return new NotebookEditTool(this);
153510
154215
  });
153511
154216
  await registerLazy(ToolNames.SHELL, async () => {
153512
- const { ShellTool: ShellTool2 } = await import("./shell-EGTSUO2P.js");
154217
+ const { ShellTool: ShellTool2 } = await import("./shell-3PZULQQV.js");
153513
154218
  return new ShellTool2(this);
153514
154219
  });
153515
154220
  await registerGoalWorkerTools();
@@ -153521,43 +154226,43 @@ var Config = class _Config {
153521
154226
  }
153522
154227
  await registerGoalWorkerTools();
153523
154228
  await registerLazy(ToolNames.TOOL_SEARCH, async () => {
153524
- const { ToolSearchTool } = await import("./tool-search-QNBLXUGR.js");
154229
+ const { ToolSearchTool } = await import("./tool-search-5R2OE4C7.js");
153525
154230
  return new ToolSearchTool(this);
153526
154231
  });
153527
154232
  await registerLazy(ToolNames.READ_MCP_RESOURCE, async () => {
153528
- const { ReadMcpResourceTool } = await import("./read-mcp-resource-GWCP23WG.js");
154233
+ const { ReadMcpResourceTool } = await import("./read-mcp-resource-XD54ZQMC.js");
153529
154234
  return new ReadMcpResourceTool(this);
153530
154235
  });
153531
154236
  await registerLazy(ToolNames.AGENT, async () => {
153532
- const { AgentTool: AgentTool2 } = await import("./agent-E6V3VXQR.js");
154237
+ const { AgentTool: AgentTool2 } = await import("./agent-DPTOZFEM.js");
153533
154238
  return new AgentTool2(this);
153534
154239
  });
153535
154240
  await registerLazy(ToolNames.LIST_AGENTS, async () => {
153536
- const { ListAgentsTool } = await import("./list-agents-O6WSY4CT.js");
154241
+ const { ListAgentsTool } = await import("./list-agents-OSVDFI6S.js");
153537
154242
  return new ListAgentsTool(this);
153538
154243
  });
153539
154244
  await registerLazy(ToolNames.TASK_STOP, async () => {
153540
- const { TaskStopTool } = await import("./task-stop-YFNATTIM.js");
154245
+ const { TaskStopTool } = await import("./task-stop-X37KYTKB.js");
153541
154246
  return new TaskStopTool(this);
153542
154247
  });
153543
154248
  await registerLazy(ToolNames.SEND_MESSAGE, async () => {
153544
- const { SendMessageTool } = await import("./send-message-O7FO63UK.js");
154249
+ const { SendMessageTool } = await import("./send-message-VZENRWRH.js");
153545
154250
  return new SendMessageTool(this);
153546
154251
  });
153547
154252
  await registerLazy(ToolNames.SKILL, async () => {
153548
- const { SkillTool } = await import("./skill-IFUD72GF.js");
154253
+ const { SkillTool } = await import("./skill-PEVVXQ3L.js");
153549
154254
  return new SkillTool(this);
153550
154255
  });
153551
154256
  await registerLazy(ToolNames.LS, async () => {
153552
- const { LSTool } = await import("./ls-6W2D7TKU.js");
154257
+ const { LSTool } = await import("./ls-D3HUFHDP.js");
153553
154258
  return new LSTool(this);
153554
154259
  });
153555
154260
  await registerLazy(ToolNames.READ_FILE, async () => {
153556
- const { ReadFileTool } = await import("./read-file-LOVUSBJC.js");
154261
+ const { ReadFileTool } = await import("./read-file-TAFBKMNI.js");
153557
154262
  return new ReadFileTool(this);
153558
154263
  });
153559
154264
  await registerLazy(ToolNames.ZOOM_IMAGE, async () => {
153560
- const { ZoomImageTool } = await import("./zoom-image-4MVVVM7E.js");
154265
+ const { ZoomImageTool } = await import("./zoom-image-4BFYJ3HG.js");
153561
154266
  return new ZoomImageTool(this);
153562
154267
  });
153563
154268
  if (this.getUseRipgrep()) {
@@ -153572,7 +154277,7 @@ var Config = class _Config {
153572
154277
  recordStartupEvent("config_initialize_ripgrep_probe_end");
153573
154278
  if (useRipgrep) {
153574
154279
  await registerLazy(ToolNames.GREP, async () => {
153575
- const { RipGrepTool: RipGrepTool2 } = await import("./ripGrep-ZJSHKB6H.js");
154280
+ const { RipGrepTool: RipGrepTool2 } = await import("./ripGrep-WOEK2PXS.js");
153576
154281
  return new RipGrepTool2(this);
153577
154282
  });
153578
154283
  } else {
@@ -153585,7 +154290,7 @@ var Config = class _Config {
153585
154290
  )
153586
154291
  );
153587
154292
  await registerLazy(ToolNames.GREP, async () => {
153588
- const { GrepTool } = await import("./grep-F4UAR7KX.js");
154293
+ const { GrepTool } = await import("./grep-VJWPLFOT.js");
153589
154294
  return new GrepTool(this);
153590
154295
  });
153591
154296
  }
@@ -153593,77 +154298,77 @@ var Config = class _Config {
153593
154298
  recordStartupEvent("config_initialize_ripgrep_probe_start");
153594
154299
  recordStartupEvent("config_initialize_ripgrep_probe_end");
153595
154300
  await registerLazy(ToolNames.GREP, async () => {
153596
- const { GrepTool } = await import("./grep-F4UAR7KX.js");
154301
+ const { GrepTool } = await import("./grep-VJWPLFOT.js");
153597
154302
  return new GrepTool(this);
153598
154303
  });
153599
154304
  }
153600
154305
  await registerLazy(ToolNames.GLOB, async () => {
153601
- const { GlobTool } = await import("./glob-VMEEDDLO.js");
154306
+ const { GlobTool } = await import("./glob-J4RUJAHX.js");
153602
154307
  return new GlobTool(this);
153603
154308
  });
153604
154309
  await registerLazy(ToolNames.EDIT, async () => {
153605
- const { EditTool } = await import("./edit-X73LA4YO.js");
154310
+ const { EditTool } = await import("./edit-I4LQFAEC.js");
153606
154311
  return new EditTool(this);
153607
154312
  });
153608
154313
  await registerLazy(ToolNames.NOTEBOOK_EDIT, async () => {
153609
- const { NotebookEditTool } = await import("./notebook-edit-QD4TRKLY.js");
154314
+ const { NotebookEditTool } = await import("./notebook-edit-NTDY4QDU.js");
153610
154315
  return new NotebookEditTool(this);
153611
154316
  });
153612
154317
  await registerLazy(ToolNames.WRITE_FILE, async () => {
153613
- const { WriteFileTool: WriteFileTool2 } = await import("./write-file-JJAY7JSP.js");
154318
+ const { WriteFileTool: WriteFileTool2 } = await import("./write-file-EWXKVVXF.js");
153614
154319
  return new WriteFileTool2(this);
153615
154320
  });
153616
154321
  await registerLazy(ToolNames.SHELL, async () => {
153617
- const { ShellTool: ShellTool2 } = await import("./shell-EGTSUO2P.js");
154322
+ const { ShellTool: ShellTool2 } = await import("./shell-3PZULQQV.js");
153618
154323
  return new ShellTool2(this);
153619
154324
  });
153620
154325
  await registerLazy(ToolNames.TODO_WRITE, async () => {
153621
- const { TodoWriteTool } = await import("./todoWrite-K5K7NRE5.js");
154326
+ const { TodoWriteTool } = await import("./todoWrite-U2R4NVF4.js");
153622
154327
  return new TodoWriteTool(this);
153623
154328
  });
153624
154329
  const supportsUserInteraction = resolveInteractionMode(this) !== "headless";
153625
154330
  if (supportsUserInteraction) {
153626
154331
  await registerLazy(ToolNames.ASK_USER_QUESTION, async () => {
153627
- const { AskUserQuestionTool } = await import("./askUserQuestion-HZJJLR3Z.js");
154332
+ const { AskUserQuestionTool } = await import("./askUserQuestion-B33XRSB7.js");
153628
154333
  return new AskUserQuestionTool(this);
153629
154334
  });
153630
154335
  }
153631
154336
  if (!this.sdkMode && (supportsUserInteraction || options2?.forSubAgent)) {
153632
154337
  await registerLazy(ToolNames.EXIT_PLAN_MODE, async () => {
153633
- const { ExitPlanModeTool: ExitPlanModeTool2 } = await import("./exitPlanMode-WDURQMIU.js");
154338
+ const { ExitPlanModeTool: ExitPlanModeTool2 } = await import("./exitPlanMode-R4JY7V2O.js");
153634
154339
  return new ExitPlanModeTool2(this);
153635
154340
  });
153636
154341
  }
153637
154342
  if (!this.sdkMode && supportsUserInteraction) {
153638
154343
  await registerLazy(ToolNames.ENTER_PLAN_MODE, async () => {
153639
- const { EnterPlanModeTool } = await import("./enterPlanMode-6BDYUQ5T.js");
154344
+ const { EnterPlanModeTool } = await import("./enterPlanMode-XCPK62ER.js");
153640
154345
  return new EnterPlanModeTool(this);
153641
154346
  });
153642
154347
  }
153643
154348
  await registerLazy(ToolNames.ENTER_WORKTREE, async () => {
153644
- const { EnterWorktreeTool } = await import("./enter-worktree-CLRQTIVN.js");
154349
+ const { EnterWorktreeTool } = await import("./enter-worktree-YNPOJSRH.js");
153645
154350
  return new EnterWorktreeTool(this);
153646
154351
  });
153647
154352
  await registerLazy(ToolNames.EXIT_WORKTREE, async () => {
153648
- const { ExitWorktreeTool } = await import("./exit-worktree-TFFJXCRT.js");
154353
+ const { ExitWorktreeTool } = await import("./exit-worktree-AIIY7SR6.js");
153649
154354
  return new ExitWorktreeTool(this);
153650
154355
  });
153651
154356
  await registerLazy(ToolNames.WEB_FETCH, async () => {
153652
- const { WebFetchTool } = await import("./web-fetch-MBIVXKPE.js");
154357
+ const { WebFetchTool } = await import("./web-fetch-RTEQTR5Z.js");
153653
154358
  return new WebFetchTool(this);
153654
154359
  });
153655
154360
  if (resolveInteractionMode(this) === "interactive" && !this.sdkMode && !this.getScreenReader() && !options2?.forSubAgent) {
153656
154361
  await registerLazy(ToolNames.DISPLAY_IMAGE, async () => {
153657
- const { DisplayImageTool } = await import("./display-image-M2ELAVN4.js");
154362
+ const { DisplayImageTool } = await import("./display-image-ON3EYFRD.js");
153658
154363
  return new DisplayImageTool(this);
153659
154364
  });
153660
154365
  }
153661
154366
  if (this.webSearchSettings?.enabled) {
153662
- const { evaluateWebSearchGate } = await import("./web-search-4LBIN6VF.js");
154367
+ const { evaluateWebSearchGate } = await import("./web-search-5OXHEZPV.js");
153663
154368
  const gate = evaluateWebSearchGate(this);
153664
154369
  if (gate.ok) {
153665
154370
  await registerLazy(ToolNames.WEB_SEARCH, async () => {
153666
- const { WebSearchTool } = await import("./web-search-4LBIN6VF.js");
154371
+ const { WebSearchTool } = await import("./web-search-5OXHEZPV.js");
153667
154372
  return new WebSearchTool(this);
153668
154373
  });
153669
154374
  } else if (!this.webSearchNoticeEmitted && !options2?.forSubAgent) {
@@ -153674,83 +154379,83 @@ var Config = class _Config {
153674
154379
  await this.registerImageGenerationTool(registry);
153675
154380
  if (this.isArtifactEnabled()) {
153676
154381
  await registerLazy(ToolNames.ARTIFACT, async () => {
153677
- const { ArtifactTool } = await import("./artifact-tool-4GCQQDZI.js");
154382
+ const { ArtifactTool } = await import("./artifact-tool-GEXTOPVO.js");
153678
154383
  return new ArtifactTool(this);
153679
154384
  });
153680
154385
  }
153681
154386
  if (this.isRecordArtifactEnabled()) {
153682
154387
  await registerLazy(ToolNames.RECORD_ARTIFACT, async () => {
153683
- const { RecordArtifactTool } = await import("./record-artifact-IYQDEYMV.js");
154388
+ const { RecordArtifactTool } = await import("./record-artifact-SEYFJEJF.js");
153684
154389
  return new RecordArtifactTool();
153685
154390
  });
153686
154391
  }
153687
154392
  if (this.isLspEnabled() && this.getLspClient()) {
153688
154393
  await registerLazy(ToolNames.LSP, async () => {
153689
- const { LspTool } = await import("./lsp-NJ4KFBI2.js");
154394
+ const { LspTool } = await import("./lsp-3QDDJTCS.js");
153690
154395
  return new LspTool(this);
153691
154396
  });
153692
154397
  }
153693
154398
  await registerStructuredOutputIfRequested();
153694
154399
  if (this.isCronEnabled()) {
153695
154400
  await registerLazy(ToolNames.CRON_CREATE, async () => {
153696
- const { CronCreateTool } = await import("./cron-create-2JZ2TWTF.js");
154401
+ const { CronCreateTool } = await import("./cron-create-H7UEPDSN.js");
153697
154402
  return new CronCreateTool(this);
153698
154403
  });
153699
154404
  await registerLazy(ToolNames.CRON_LIST, async () => {
153700
- const { CronListTool } = await import("./cron-list-V44KHAF6.js");
154405
+ const { CronListTool } = await import("./cron-list-H25JIHEZ.js");
153701
154406
  return new CronListTool(this);
153702
154407
  });
153703
154408
  await registerLazy(ToolNames.CRON_DELETE, async () => {
153704
- const { CronDeleteTool } = await import("./cron-delete-CTPD2P26.js");
154409
+ const { CronDeleteTool } = await import("./cron-delete-6SZK7YFM.js");
153705
154410
  return new CronDeleteTool(this);
153706
154411
  });
153707
154412
  await registerLazy(ToolNames.LOOP_WAKEUP, async () => {
153708
- const { LoopWakeupTool } = await import("./loop-wakeup-GVQRMUKS.js");
154413
+ const { LoopWakeupTool } = await import("./loop-wakeup-WQS6JYAG.js");
153709
154414
  return new LoopWakeupTool(this);
153710
154415
  });
153711
154416
  }
153712
154417
  await registerLazy(ToolNames.CREATE_SUB_SESSION, async () => {
153713
- const { CreateSubSessionTool } = await import("./create-sub-session-XT6DLYOE.js");
154418
+ const { CreateSubSessionTool } = await import("./create-sub-session-KRQULJE6.js");
153714
154419
  return new CreateSubSessionTool(this);
153715
154420
  });
153716
154421
  if (this.isAgentTeamEnabled()) {
153717
154422
  await registerLazy(ToolNames.TEAM_CREATE, async () => {
153718
- const { TeamCreateTool } = await import("./team-create-B6A6MJBT.js");
154423
+ const { TeamCreateTool } = await import("./team-create-ZAIA7KAV.js");
153719
154424
  return new TeamCreateTool(this);
153720
154425
  });
153721
154426
  await registerLazy(ToolNames.TEAM_DELETE, async () => {
153722
- const { TeamDeleteTool } = await import("./team-delete-MKYMYBFM.js");
154427
+ const { TeamDeleteTool } = await import("./team-delete-6UMU4XLS.js");
153723
154428
  return new TeamDeleteTool(this);
153724
154429
  });
153725
154430
  await registerLazy(ToolNames.TEAM_PLAN_APPROVAL, async () => {
153726
- const { TeamPlanApprovalTool } = await import("./team-plan-approval-5WO3CXXU.js");
154431
+ const { TeamPlanApprovalTool } = await import("./team-plan-approval-UNIUS7OD.js");
153727
154432
  return new TeamPlanApprovalTool(this);
153728
154433
  });
153729
154434
  await registerLazy(ToolNames.TASK_CREATE, async () => {
153730
- const { TaskCreateTool } = await import("./task-create-4NC7PDI4.js");
154435
+ const { TaskCreateTool } = await import("./task-create-FCBDX7UH.js");
153731
154436
  return new TaskCreateTool(this);
153732
154437
  });
153733
154438
  await registerLazy(ToolNames.TASK_UPDATE, async () => {
153734
- const { TaskUpdateTool } = await import("./task-update-BPLM52GD.js");
154439
+ const { TaskUpdateTool } = await import("./task-update-MYPFVOVM.js");
153735
154440
  return new TaskUpdateTool(this);
153736
154441
  });
153737
154442
  await registerLazy(ToolNames.TASK_LIST, async () => {
153738
- const { TaskListTool } = await import("./task-list-LBSRMOC7.js");
154443
+ const { TaskListTool } = await import("./task-list-YIYIUFUA.js");
153739
154444
  return new TaskListTool(this);
153740
154445
  });
153741
154446
  }
153742
154447
  if (this.isWorkflowsEnabled()) {
153743
154448
  await registerLazy(ToolNames.WORKFLOW, async () => {
153744
- const { WorkflowTool } = await import("./workflow-LNMA55HY.js");
154449
+ const { WorkflowTool } = await import("./workflow-ISQJHPG2.js");
153745
154450
  return new WorkflowTool(this);
153746
154451
  });
153747
154452
  }
153748
154453
  if (this.isComputerUseEnabled()) {
153749
- const { registerComputerUseTools } = await import("./computer-use-F4URV4TU.js");
154454
+ const { registerComputerUseTools } = await import("./computer-use-77C5FHMW.js");
153750
154455
  await registerComputerUseTools(registerLazy, this);
153751
154456
  }
153752
154457
  await registerLazy(ToolNames.MONITOR, async () => {
153753
- const { MonitorTool } = await import("./monitor-2MM23VDV.js");
154458
+ const { MonitorTool } = await import("./monitor-EE2UYMGE.js");
153754
154459
  return new MonitorTool(this);
153755
154460
  });
153756
154461
  if (this.pendingMcpBudgetCallback) {
@@ -154236,6 +154941,7 @@ export {
154236
154941
  SessionWriterError,
154237
154942
  SESSION_WRITER_RPC_CODES,
154238
154943
  SessionWriterUnavailableError,
154944
+ BranchPointInvalidError,
154239
154945
  SESSION_TITLE_MAX_LENGTH,
154240
154946
  SessionService,
154241
154947
  computeUniqueBranchTitle,
@@ -154358,6 +155064,7 @@ export {
154358
155064
  DEFAULT_BUILTIN_SUBAGENT_TYPE,
154359
155065
  BuiltinAgentRegistry,
154360
155066
  toModelVisibleSubagentResult,
155067
+ sanitizeFilenameComponent,
154361
155068
  getSubagentsRootDir,
154362
155069
  getSubagentSessionDir,
154363
155070
  readAgentMeta,