@qwen-code/qwen-code 0.19.12 → 0.20.0-nightly.20260720.0c271659d

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 (276) hide show
  1. package/bundled/qc-helper/docs/integration-github-action.md +1 -1
  2. package/bundled/qc-helper/docs/qwen-serve.md +42 -5
  3. package/bundled/review/DESIGN.md +2 -2
  4. package/bundled/review/SKILL.md +13 -9
  5. package/chunks/{MaxSizedBox-QOXLJGAF.js → MaxSizedBox-ED3QND6V.js} +30 -27
  6. package/chunks/{StandaloneSessionPicker-FLV6CGYJ.js → StandaloneSessionPicker-NQVAOTKS.js} +50 -45
  7. package/chunks/{acpAgent-OB2CTF3P.js → acpAgent-HOBFF5B6.js} +353 -130
  8. package/chunks/{agent-CKSI7BTR.js → agent-J7EPFLA6.js} +22 -22
  9. package/chunks/{agent-headless-U36LIYTU.js → agent-headless-RRG3JU7Q.js} +22 -22
  10. package/chunks/{anthropicContentGenerator-ZZRGFEES.js → anthropicContentGenerator-HVKLXOOU.js} +6 -5
  11. package/chunks/{artifact-tool-PHO5XEGZ.js → artifact-tool-WBCAMD3O.js} +2 -2
  12. package/chunks/{askUserQuestion-CEPBT47X.js → askUserQuestion-6DZC4UV5.js} +2 -2
  13. package/chunks/{bridge-AIKTINJG.js → bridge-OW5FZ6BF.js} +25 -25
  14. package/chunks/build-SSCNEHZZ.js +62 -0
  15. package/chunks/{channel-worker-group-NEUVTPB2.js → channel-worker-group-53CMOPFT.js} +4 -4
  16. package/chunks/{channel-worker-manager-7CQVOVWV.js → channel-worker-manager-UTXILKC2.js} +4 -4
  17. package/chunks/{channel-worker-supervisor-3BU2KNCZ.js → channel-worker-supervisor-ZGO2W2MD.js} +3 -3
  18. package/chunks/chunk-27AJEU6G.js +442 -0
  19. package/chunks/{chunk-BABX5XRO.js → chunk-2HOVDT7W.js} +1 -1
  20. package/chunks/{chunk-GW7BONBU.js → chunk-2JOLZA6L.js} +5 -5
  21. package/chunks/{chunk-ZSDFNE6Y.js → chunk-2TDSM7I6.js} +3 -3
  22. package/chunks/{chunk-6IITZE7O.js → chunk-2YJLFCYI.js} +7 -7
  23. package/chunks/{chunk-VEFR4XJQ.js → chunk-37MGCVTS.js} +1 -1
  24. package/chunks/{chunk-3B6PSWHE.js → chunk-3ML52IFS.js} +4 -4
  25. package/chunks/{chunk-TKASNYDS.js → chunk-3QR5MOHP.js} +2 -2
  26. package/chunks/{chunk-KRMARA3A.js → chunk-3SNKL6L6.js} +29 -13
  27. package/chunks/{chunk-DJ4VHAFJ.js → chunk-3ZL6YMO2.js} +3 -3
  28. package/chunks/chunk-43T5WDQ7.js +127 -0
  29. package/chunks/{chunk-W6CQPLWM.js → chunk-4ODB7WIB.js} +1 -1
  30. package/chunks/{chunk-CHPQFLW6.js → chunk-4UH63YE5.js} +5 -5
  31. package/chunks/{chunk-2CCDMJM7.js → chunk-53OPIXUE.js} +3 -3
  32. package/chunks/{chunk-HTHUX2T5.js → chunk-5QWWOFGG.js} +0 -1
  33. package/chunks/{chunk-3DJY4IFO.js → chunk-5SCI6E3E.js} +1 -1
  34. package/chunks/{chunk-4CHDYDG3.js → chunk-6EFTQYW7.js} +1 -1
  35. package/chunks/{chunk-OBSLEYCD.js → chunk-6HQW55TM.js} +29 -2
  36. package/chunks/{chunk-N47VAEAJ.js → chunk-6MN6XJTR.js} +2379 -1291
  37. package/chunks/{chunk-UCTCDLDS.js → chunk-6VGRTGOG.js} +1 -1
  38. package/chunks/{chunk-KNGZ5EYL.js → chunk-7JQK6FXK.js} +198 -120
  39. package/chunks/{chunk-2476XGOU.js → chunk-A4TJMY65.js} +1 -1
  40. package/chunks/{chunk-67Q33DQY.js → chunk-AMRWCMX4.js} +4 -4
  41. package/chunks/{chunk-XAAEDML2.js → chunk-AYCDXHZB.js} +1 -1
  42. package/chunks/{chunk-VAJS2E2D.js → chunk-BDBMYST4.js} +1 -1
  43. package/chunks/{chunk-F2RR4HO2.js → chunk-BVLROR2T.js} +1 -1
  44. package/chunks/{chunk-UE5TZ55T.js → chunk-C27BYUX6.js} +29 -2
  45. package/chunks/{chunk-PK7COE5O.js → chunk-CL7IRYTA.js} +1 -1
  46. package/chunks/{chunk-KMJOMWHE.js → chunk-COWNNAWJ.js} +1 -1
  47. package/chunks/{chunk-UOA2IHRI.js → chunk-CPCVCKKF.js} +1 -1
  48. package/chunks/{chunk-4RPARQ5D.js → chunk-D2VIDMVM.js} +2 -2
  49. package/chunks/{chunk-4MPYGENG.js → chunk-DCCW7CRR.js} +6 -6
  50. package/chunks/chunk-DIKIJS6Z.js +114 -0
  51. package/chunks/{chunk-ETN2G32U.js → chunk-DR5AUNJ2.js} +4 -4
  52. package/chunks/{chunk-6ETOSWAO.js → chunk-DSBCU6JY.js} +3 -3
  53. package/chunks/{chunk-LKR7QQ63.js → chunk-EAUYY7SS.js} +3 -3
  54. package/chunks/{chunk-J2MKYJKZ.js → chunk-EIAK6Q2B.js} +2 -2
  55. package/chunks/{chunk-WEPXQKGP.js → chunk-EZVDJFZ7.js} +1 -1
  56. package/chunks/{chunk-WHQNBBWW.js → chunk-FLSVD6BS.js} +2 -2
  57. package/chunks/{chunk-3ESL7JXA.js → chunk-FODJ5Q5K.js} +3 -3
  58. package/chunks/{chunk-4XCVGEEX.js → chunk-FSL5W5TI.js} +3 -3
  59. package/chunks/{chunk-NE6HHLL3.js → chunk-FWT66O5E.js} +2 -2
  60. package/chunks/{chunk-OSSDHJDU.js → chunk-G45X5TRN.js} +1 -1
  61. package/chunks/{chunk-ZGT623SG.js → chunk-G6MDKXDP.js} +12 -12
  62. package/chunks/{chunk-KANTXY7B.js → chunk-GKY2OJ7R.js} +2 -2
  63. package/chunks/chunk-GMGDLUC7.js +37 -0
  64. package/chunks/{chunk-J6NT5YTN.js → chunk-H2XVO6NE.js} +1 -289
  65. package/chunks/{chunk-XSEWNUMZ.js → chunk-I4HZ4GOD.js} +8 -8
  66. package/chunks/{chunk-CPU6I5YV.js → chunk-I6JUVU7J.js} +34 -24
  67. package/chunks/{chunk-UZC5VPOJ.js → chunk-IDGTC5AS.js} +3 -3
  68. package/chunks/{chunk-QIFTJDBY.js → chunk-INL2RSLA.js} +1 -1
  69. package/chunks/{chunk-GSPWDTYY.js → chunk-INQQM52C.js} +18 -16
  70. package/chunks/{chunk-HVGJWOR6.js → chunk-JBCFW3IL.js} +2 -2
  71. package/chunks/{chunk-LPHGXXZX.js → chunk-JD3MKVKL.js} +1 -1
  72. package/chunks/{chunk-GCY7QTCE.js → chunk-JDPCOUZ3.js} +1602 -398
  73. package/chunks/{chunk-NUHSLBJZ.js → chunk-JNWZQ27S.js} +15 -9
  74. package/chunks/{chunk-KGWA7XYL.js → chunk-JRJ2LV6P.js} +6 -226
  75. package/chunks/{chunk-QSG4ZFG4.js → chunk-KTUQMDEP.js} +1 -1
  76. package/chunks/{chunk-RKUMFUFM.js → chunk-LTQ5C5AB.js} +4 -4
  77. package/chunks/{chunk-V4PCIS25.js → chunk-MAQQGNQ5.js} +44 -1
  78. package/chunks/{chunk-EISVEV45.js → chunk-NBMIC7DR.js} +2 -2
  79. package/chunks/{chunk-GEHSF7MS.js → chunk-NEEB7UEN.js} +2545 -1974
  80. package/chunks/{chunk-BKNPMEN6.js → chunk-NIJEXGV6.js} +93 -17
  81. package/chunks/{chunk-PR5XQ73G.js → chunk-NQVA6O7F.js} +2 -2
  82. package/chunks/{chunk-FUSMC3SZ.js → chunk-NT324EJ6.js} +13 -8
  83. package/chunks/{chunk-5N7M4XYN.js → chunk-O2SPEQFA.js} +5 -5
  84. package/chunks/{chunk-OEHCAWUA.js → chunk-OLMETXLX.js} +2 -2
  85. package/chunks/{chunk-JCJPZMJV.js → chunk-OOCI5VVU.js} +1 -1
  86. package/chunks/{chunk-XSPFQQRE.js → chunk-OONJNQ42.js} +3 -3
  87. package/chunks/{chunk-ANRANWVE.js → chunk-OP4MOGXF.js} +1 -1
  88. package/chunks/{chunk-SGPFJMRP.js → chunk-PBATSWUQ.js} +1 -1
  89. package/chunks/chunk-QKYTTBYW.js +624 -0
  90. package/chunks/{chunk-W4UN42YP.js → chunk-QOSKUG5P.js} +77 -20
  91. package/chunks/{chunk-76BFY7AF.js → chunk-QTERJVPZ.js} +1 -6
  92. package/chunks/{chunk-WIYV7CSF.js → chunk-RB7NXUP5.js} +3 -3
  93. package/chunks/{chunk-HCCR43AY.js → chunk-RFIAR4YL.js} +1 -1
  94. package/chunks/{chunk-GMUPIMHF.js → chunk-RS5JPH6Y.js} +3 -3
  95. package/chunks/chunk-RS7MT2QG.js +305 -0
  96. package/chunks/{chunk-GXFYV7MP.js → chunk-SG2PEESS.js} +1106 -592
  97. package/chunks/{chunk-PUKUUASO.js → chunk-SLLG5XXE.js} +1 -1
  98. package/chunks/{chunk-GLH2NTPB.js → chunk-SQMTULHJ.js} +1 -1
  99. package/chunks/{chunk-NPMVLWYL.js → chunk-STFP7PJR.js} +6 -6
  100. package/chunks/chunk-SV5PQVQE.js +71 -0
  101. package/chunks/{chunk-HZ4M2UQD.js → chunk-TFNZCC4B.js} +1 -1
  102. package/chunks/{chunk-5QSVANRT.js → chunk-THNJYTA6.js} +2 -2
  103. package/chunks/{chunk-MRE77ST5.js → chunk-TN2BYMNH.js} +69 -2216
  104. package/chunks/{chunk-64GC5EMF.js → chunk-TQBA6DVX.js} +1 -1
  105. package/chunks/{chunk-VLHQMOZK.js → chunk-U24E4R5U.js} +3 -3
  106. package/chunks/{chunk-4CA4WUMS.js → chunk-UEY4AYUL.js} +2 -2
  107. package/chunks/{chunk-42VIHAYT.js → chunk-UGRL5B5F.js} +1 -1
  108. package/chunks/chunk-V7RNNPGC.js +44 -0
  109. package/chunks/{chunk-R3EDIMYZ.js → chunk-VGFFYNBD.js} +1 -1
  110. package/chunks/chunk-VIOFKPPN.js +125 -0
  111. package/chunks/{chunk-BEZPRKD3.js → chunk-VLDBVLC4.js} +156 -2
  112. package/chunks/{chunk-HD6EGS5K.js → chunk-VWLLDHAY.js} +6 -6
  113. package/chunks/chunk-WCDH2CRI.js +1187 -0
  114. package/chunks/{chunk-7SX6WZNO.js → chunk-XVVH63JG.js} +3 -3
  115. package/chunks/{chunk-I7RRHHYG.js → chunk-Y2ENGUD6.js} +1 -1
  116. package/chunks/{chunk-NALRQ3SG.js → chunk-Y5534U4G.js} +332 -116
  117. package/chunks/{chunk-4SJJT466.js → chunk-YDZ6J2BY.js} +72 -159
  118. package/chunks/{chunk-APOFULHK.js → chunk-YNBP3YSU.js} +7 -6
  119. package/chunks/{chunk-EFAXBOQO.js → chunk-YWEW33JY.js} +7 -7
  120. package/chunks/{chunk-335ECZTA.js → chunk-ZEOZL37W.js} +1 -1
  121. package/chunks/{chunk-DUR7BZYK.js → chunk-ZGJ4LDD2.js} +53 -28
  122. package/chunks/{computer-use-4PUGCUQK.js → computer-use-ET5476VX.js} +22 -22
  123. package/chunks/{config-utils-6PJUXHLI.js → config-utils-AHQ6YZ66.js} +3 -3
  124. package/chunks/{contextCommand-C57KTWFV.js → contextCommand-QIULFDBF.js} +25 -26
  125. package/chunks/{create-sub-session-5Q42XR6I.js → create-sub-session-BVL2ZHTM.js} +22 -22
  126. package/chunks/{create-sub-session-DIJOV6HV.js → create-sub-session-P26FE5GG.js} +2 -2
  127. package/chunks/{cron-create-X462ERYA.js → cron-create-JWFHBDRQ.js} +4 -4
  128. package/chunks/{cron-delete-SL5UJUM3.js → cron-delete-GDX4E26G.js} +4 -4
  129. package/chunks/{cron-list-3MD6SVXI.js → cron-list-USMAIWPT.js} +4 -4
  130. package/chunks/{daemon-ZW6LHOXT.js → daemon-EE5T3KOW.js} +169 -84
  131. package/chunks/{daemon-status-provider-YPV3UXHT.js → daemon-status-provider-L5UW7TGV.js} +29 -29
  132. package/chunks/{dist-3DQNQJ6H.js → dist-2BHAYBKP.js} +1 -1
  133. package/chunks/{dist-J2H4KTLB.js → dist-2MIU4UUH.js} +1 -1
  134. package/chunks/{dist-IEQSDXS7.js → dist-53PZYC5B.js} +2 -2
  135. package/chunks/{dist-NUXRQHC5.js → dist-AU7NQQRP.js} +1 -1
  136. package/chunks/{dist-XLE6ODMB.js → dist-FUTEXY6A.js} +1 -1
  137. package/chunks/{dist-IGZMVS5R.js → dist-WGTQO7F2.js} +1 -1
  138. package/chunks/{earlyInputCapture-5VDWSYAM.js → earlyInputCapture-ZLAL5GTE.js} +23 -23
  139. package/chunks/{edit-GORZTX2U.js → edit-4ZOPT6OC.js} +23 -23
  140. package/chunks/{enter-worktree-LJB2AW4L.js → enter-worktree-DFP5CZYS.js} +22 -22
  141. package/chunks/{enterPlanMode-LIIPP37T.js → enterPlanMode-7VEJ7A2A.js} +22 -22
  142. package/chunks/{environment-HQ2UHJ35.js → environment-KHS35XJY.js} +24 -24
  143. package/chunks/{errors-6JD5VMVQ.js → errors-574WBU5R.js} +24 -24
  144. package/chunks/{exit-worktree-IEP2WHOV.js → exit-worktree-5Q7V6D4C.js} +22 -22
  145. package/chunks/{exitPlanMode-U5Z6XBLO.js → exitPlanMode-SX2F6PDJ.js} +22 -22
  146. package/chunks/{fast-path-HFKNMP23.js → fast-path-G7BLOZVF.js} +2 -2
  147. package/chunks/{gemini-C2SCJH3N.js → gemini-M4JWSTGU.js} +70 -68
  148. package/chunks/{geminiContentGenerator-ADZTXEKV.js → geminiContentGenerator-MKXLUFUH.js} +4 -4
  149. package/chunks/{glob-GOAPGD6G.js → glob-FPKZY5W6.js} +22 -22
  150. package/chunks/{grep-HZLSTX7D.js → grep-RS22OMZG.js} +22 -22
  151. package/chunks/{handleAutoUpdate-UF74WGFE.js → handleAutoUpdate-RFNQ36JC.js} +27 -28
  152. package/chunks/{i18n-FMXIYUOC.js → i18n-MAEWSKYF.js} +23 -23
  153. package/chunks/{initializer-ERDBM3DU.js → initializer-T2BFZJBP.js} +28 -28
  154. package/chunks/{installationInfo-LROMXYLX.js → installationInfo-3UETF773.js} +25 -23
  155. package/chunks/{keychain-token-storage-K23CFKGN.js → keychain-token-storage-DWRJMNH3.js} +2 -2
  156. package/chunks/{list-6JPJROU5.js → list-FWZUKWD2.js} +30 -30
  157. package/chunks/{loadedSettingsAdapter-QCWYUBBF.js → loadedSettingsAdapter-3DUNHAPX.js} +27 -27
  158. package/chunks/{loop-wakeup-6H7OENTB.js → loop-wakeup-5GLTUBHA.js} +5 -5
  159. package/chunks/{ls-APTSOOS5.js → ls-FHBY3Y7I.js} +4 -4
  160. package/chunks/{lsp-HPACPJAN.js → lsp-B6VMEW6Y.js} +2 -2
  161. package/chunks/{mcp-3P3KWYWO.js → mcp-POXS7QWD.js} +27 -27
  162. package/chunks/{monitor-LMYKCF6R.js → monitor-2ZZC2NKH.js} +22 -22
  163. package/chunks/nonInteractiveCli-WSJVCB2W.js +126 -0
  164. package/chunks/{notebook-edit-IBEOVZ6A.js → notebook-edit-BMQLME3Q.js} +23 -23
  165. package/chunks/{openaiContentGenerator-42PZKET5.js → openaiContentGenerator-GOREG72R.js} +11 -11
  166. package/chunks/{pidfile-VTBDIGOH.js → pidfile-MVZDE5TC.js} +23 -23
  167. package/chunks/{processUtils-L7ZKOGDG.js → processUtils-RH5KNLDH.js} +2 -2
  168. package/chunks/{qwenContentGenerator-VR2CNFGI.js → qwenContentGenerator-R55BCLRI.js} +24 -24
  169. package/chunks/{qwenOAuth2-6LS2T3Q6.js → qwenOAuth2-QZBI2SOZ.js} +11 -11
  170. package/chunks/react-SG7JAQSZ.js +8 -0
  171. package/chunks/{read-file-VSKOE22I.js → read-file-CPS2CYYG.js} +8 -8
  172. package/chunks/{read-mcp-resource-C6NT52T6.js → read-mcp-resource-AKCL7I43.js} +2 -2
  173. package/chunks/{record-artifact-ENCU7QCL.js → record-artifact-PEUB7727.js} +2 -2
  174. package/chunks/resumeHistoryUtils-YD6DSYHU.js +78 -0
  175. package/chunks/{ripGrep-5V5FLW2A.js → ripGrep-UKGJ7RHZ.js} +22 -22
  176. package/chunks/{run-qwen-serve-LSOPP4R2.js → run-qwen-serve-GFKSKLF6.js} +1442 -148
  177. package/chunks/{runtime-LT7R4CS5.js → runtime-4KGNL3TP.js} +31 -31
  178. package/chunks/{scheduler-YOWQ7KZP.js → scheduler-GJ3CELWI.js} +22 -22
  179. package/chunks/{send-message-5GZ4FX2V.js → send-message-3RHE7HSM.js} +3 -3
  180. package/chunks/{serve-VWLBXKGK.js → serve-UU6Z4C7W.js} +27 -27
  181. package/chunks/{server-3RW3FYOH.js → server-RTJUMN24.js} +393 -256
  182. package/chunks/{session-ZONXFOBQ.js → session-EYD3CEB5.js} +79 -163
  183. package/chunks/{settings-JC3VC53L.js → settings-H5O22TGQ.js} +26 -26
  184. package/chunks/{shell-2NGEMAVM.js → shell-KVNHDHMT.js} +22 -22
  185. package/chunks/{skill-3U2T6H3E.js → skill-32525KCE.js} +10 -10
  186. package/chunks/{spawnChannel-QEAUPARQ.js → spawnChannel-G7DUQKHL.js} +24 -24
  187. package/chunks/{src-75ZPXO7B.js → src-DUFUUEHE.js} +52 -22
  188. package/chunks/{standalone-update-UUJWJWYY.js → standalone-update-UC6CWBLH.js} +24 -24
  189. package/chunks/{startInteractiveUI-V7XISPQ6.js → startInteractiveUI-A5YYAWLF.js} +5451 -2045
  190. package/chunks/{syntheticOutput-ULOVVLY4.js → syntheticOutput-FG5PQKIR.js} +3 -3
  191. package/chunks/{task-create-DUE2PMNI.js → task-create-HX32YXO7.js} +7 -7
  192. package/chunks/{task-list-WVPNX7BZ.js → task-list-QWSY4ZIU.js} +5 -5
  193. package/chunks/{task-stop-CPEQWOT6.js → task-stop-GWC6UWAL.js} +2 -2
  194. package/chunks/{task-update-HY2LNFFB.js → task-update-NCTAB73Q.js} +7 -7
  195. package/chunks/{team-create-R6AXDYPG.js → team-create-LS2Q32Y4.js} +22 -22
  196. package/chunks/{team-delete-JJV6IUOA.js → team-delete-KK37HTOG.js} +5 -5
  197. package/chunks/{team-plan-approval-O2ZPPT64.js → team-plan-approval-DWCZABX6.js} +22 -22
  198. package/chunks/{theme-manager-YIX2IC2D.js → theme-manager-E22CNBIL.js} +23 -23
  199. package/chunks/{todoWrite-JHHIDOIV.js → todoWrite-ERCAMLFS.js} +4 -4
  200. package/chunks/{tool-search-5IE2VO7X.js → tool-search-MHXUDFD2.js} +9 -9
  201. package/chunks/{total-session-admission-K6APQYEF.js → total-session-admission-KOPTGDJZ.js} +25 -25
  202. package/chunks/{trustedFolders-GPSSPVBF.js → trustedFolders-ANQXYAQT.js} +23 -23
  203. package/chunks/{update-relaunch-4BVAPX6Y.js → update-relaunch-HFGRB7PE.js} +9 -9
  204. package/chunks/{updateCheck-AHTHWLAM.js → updateCheck-EKIPND4B.js} +33 -26
  205. package/chunks/useAutoAcceptIndicator-EE22V2F5.js +80 -0
  206. package/chunks/{validateNonInterActiveAuth-UKAPCWDM.js → validateNonInterActiveAuth-RUICXVPH.js} +61 -63
  207. package/chunks/{version-EXGWKKQE.js → version-QLT755OV.js} +1 -1
  208. package/chunks/{web-fetch-ZDNE6FF2.js → web-fetch-DINW4Z65.js} +10 -10
  209. package/chunks/{workflow-G7U6OQWS.js → workflow-GPMXRWKK.js} +23 -23
  210. package/chunks/{workspace-providers-status-W6CEA6YM.js → workspace-providers-status-XCQKBVSX.js} +30 -30
  211. package/chunks/{workspace-registration-store-OGBMWCLC.js → workspace-registration-store-4I4KL7TN.js} +1 -1
  212. package/chunks/{workspace-registry-ZUWQM44P.js → workspace-registry-N4J57SFQ.js} +25 -25
  213. package/chunks/{workspace-service-UXX5P7GU.js → workspace-service-JJNJWVH3.js} +32 -32
  214. package/chunks/{workspace-skills-status-635B5R7N.js → workspace-skills-status-CEHLAQ2Y.js} +28 -28
  215. package/chunks/{write-file-DR3HN7IH.js → write-file-XRGEJRCC.js} +23 -23
  216. package/cli.js +11 -11
  217. package/package.json +3 -3
  218. package/web-shell/assets/{arc-_dVIKMdB.js → arc-DwJhljn9.js} +1 -1
  219. package/web-shell/assets/{architectureDiagram-3BPJPVTR-MuN3nKpL.js → architectureDiagram-3BPJPVTR-qdxSRav-.js} +1 -1
  220. package/web-shell/assets/{blockDiagram-GPEHLZMM-BtmvJjzx.js → blockDiagram-GPEHLZMM-2-dKM5aM.js} +1 -1
  221. package/web-shell/assets/{c4Diagram-AAUBKEIU-Dvi58_BU.js → c4Diagram-AAUBKEIU-Dt_Nu2HD.js} +1 -1
  222. package/web-shell/assets/channel-C6uyh95L.js +1 -0
  223. package/web-shell/assets/{chunk-2J33WTMH-YqxOVhS1.js → chunk-2J33WTMH-CBCeeNfD.js} +1 -1
  224. package/web-shell/assets/{chunk-4BX2VUAB-DoBgbC9z.js → chunk-4BX2VUAB-DPAzjqNs.js} +1 -1
  225. package/web-shell/assets/{chunk-55IACEB6-3NEQrBAr.js → chunk-55IACEB6-yrqyxvIK.js} +1 -1
  226. package/web-shell/assets/{chunk-727SXJPM-DrCZQxp0.js → chunk-727SXJPM-DguD_BBT.js} +1 -1
  227. package/web-shell/assets/{chunk-AQP2D5EJ-m_g3zjgv.js → chunk-AQP2D5EJ-KRUOG9v0.js} +1 -1
  228. package/web-shell/assets/{chunk-FMBD7UC4-D1_crABJ.js → chunk-FMBD7UC4-C0lilT2U.js} +1 -1
  229. package/web-shell/assets/{chunk-ND2GUHAM-BdhgVtBx.js → chunk-ND2GUHAM-DG9epIWK.js} +1 -1
  230. package/web-shell/assets/{chunk-QZHKN3VN-BlmThhm-.js → chunk-QZHKN3VN-PdJDkYHw.js} +1 -1
  231. package/web-shell/assets/classDiagram-4FO5ZUOK-Cv8Ulf-B.js +1 -0
  232. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-Cv8Ulf-B.js +1 -0
  233. package/web-shell/assets/{cose-bilkent-S5V4N54A-Cbjm_00Z.js → cose-bilkent-S5V4N54A-BAOPPuJm.js} +1 -1
  234. package/web-shell/assets/{dagre-BM42HDAG-C39QNVgC.js → dagre-BM42HDAG-CDHJv82_.js} +1 -1
  235. package/web-shell/assets/{diagram-2AECGRRQ-DNXSAixC.js → diagram-2AECGRRQ-C_hkG5fN.js} +1 -1
  236. package/web-shell/assets/{diagram-5GNKFQAL-BCbGUPEA.js → diagram-5GNKFQAL-e9zo_eKt.js} +1 -1
  237. package/web-shell/assets/{diagram-KO2AKTUF-1eujKSDC.js → diagram-KO2AKTUF-BFN41SCb.js} +1 -1
  238. package/web-shell/assets/{diagram-LMA3HP47-DUMKXgql.js → diagram-LMA3HP47-DG72N0W0.js} +1 -1
  239. package/web-shell/assets/{diagram-OG6HWLK6-BFktU3_u.js → diagram-OG6HWLK6-Dkmp-tdv.js} +1 -1
  240. package/web-shell/assets/{erDiagram-TEJ5UH35-BvJC7DLk.js → erDiagram-TEJ5UH35-CyS0GnQV.js} +1 -1
  241. package/web-shell/assets/{flowDiagram-I6XJVG4X-Cgu3PlOt.js → flowDiagram-I6XJVG4X-Cg1SRmzV.js} +1 -1
  242. package/web-shell/assets/{ganttDiagram-6RSMTGT7-DLNXN5Xh.js → ganttDiagram-6RSMTGT7-CoNkSLs3.js} +1 -1
  243. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-BQFRDv6R.js → gitGraphDiagram-PVQCEYII-DEA6GWPa.js} +1 -1
  244. package/web-shell/assets/index-B49xd8_A.css +5 -0
  245. package/web-shell/assets/{index-CdC3pjP3.js → index-CMaZgs6B.js} +1 -1
  246. package/web-shell/assets/index-D-cDAZgO.js +1192 -0
  247. package/web-shell/assets/{infoDiagram-5YYISTIA-DT2mOSvp.js → infoDiagram-5YYISTIA-BZshyoGT.js} +1 -1
  248. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-9fy_K4bd.js → ishikawaDiagram-YF4QCWOH-CT2ssZqC.js} +1 -1
  249. package/web-shell/assets/{journeyDiagram-JHISSGLW-CoGSEuhE.js → journeyDiagram-JHISSGLW-BtMQ0rDG.js} +1 -1
  250. package/web-shell/assets/{kanban-definition-UN3LZRKU-BP9hHYIj.js → kanban-definition-UN3LZRKU-CoDbK5Db.js} +1 -1
  251. package/web-shell/assets/{linear-uIroDsmp.js → linear-CwhZ6u7u.js} +1 -1
  252. package/web-shell/assets/{mermaid.core-BUwoStsA.js → mermaid.core-C9nn0nrr.js} +5 -5
  253. package/web-shell/assets/{mindmap-definition-RKZ34NQL-DZB-FWim.js → mindmap-definition-RKZ34NQL-BXUbjTeL.js} +1 -1
  254. package/web-shell/assets/{pieDiagram-4H26LBE5-YPptloKl.js → pieDiagram-4H26LBE5-JddiYlWQ.js} +1 -1
  255. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-dgk3DSzm.js → quadrantDiagram-W4KKPZXB-DK5HKzXO.js} +1 -1
  256. package/web-shell/assets/{requirementDiagram-4Y6WPE33-BH2En2i9.js → requirementDiagram-4Y6WPE33-Y-uipa_6.js} +1 -1
  257. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-BB98feeI.js → sankeyDiagram-5OEKKPKP-BbWeqo8H.js} +1 -1
  258. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-CunAIGh8.js → sequenceDiagram-3UESZ5HK-tX2gOoo5.js} +1 -1
  259. package/web-shell/assets/{stateDiagram-AJRCARHV-DTJs_-I2.js → stateDiagram-AJRCARHV-CACN457G.js} +1 -1
  260. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DaUeO2zt.js +1 -0
  261. package/web-shell/assets/{timeline-definition-PNZ67QCA-Cd4AN7O0.js → timeline-definition-PNZ67QCA-DnHWKSOq.js} +1 -1
  262. package/web-shell/assets/{vennDiagram-CIIHVFJN-xIG-rUU9.js → vennDiagram-CIIHVFJN-BO8Yl2FG.js} +1 -1
  263. package/web-shell/assets/{wardley-L42UT6IY-D1UyjIcG.js → wardley-L42UT6IY-1NMqqrBi.js} +1 -1
  264. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-BVM0Mb99.js → wardleyDiagram-YWT4CUSO-C3eWgIvD.js} +1 -1
  265. package/web-shell/assets/{xychartDiagram-2RQKCTM6-BX31JDSz.js → xychartDiagram-2RQKCTM6-D0h8FgFX.js} +1 -1
  266. package/web-shell/index.html +2 -2
  267. package/chunks/chunk-EDFD7VOX.js +0 -368
  268. package/chunks/chunk-GFYFLDEG.js +0 -709
  269. package/chunks/chunk-LUJQUNKY.js +0 -3288
  270. package/chunks/nonInteractiveCli-YURFHZV5.js +0 -129
  271. package/web-shell/assets/channel-Bi5TehaT.js +0 -1
  272. package/web-shell/assets/classDiagram-4FO5ZUOK-BKhhRdd1.js +0 -1
  273. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-BKhhRdd1.js +0 -1
  274. package/web-shell/assets/index-C_ouplMQ.js +0 -1187
  275. package/web-shell/assets/index-XGDFJE-X.css +0 -5
  276. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DrfFMYta.js +0 -1
@@ -37,7 +37,7 @@ import {
37
37
  CronScheduler,
38
38
  DEFAULT_RECURRING_MAX_AGE_DAYS,
39
39
  normalizeRecurringMaxAge
40
- } from "./chunk-LKR7QQ63.js";
40
+ } from "./chunk-EAUYY7SS.js";
41
41
  import {
42
42
  consumeUnread,
43
43
  forwardApproval,
@@ -46,13 +46,13 @@ import {
46
46
  sendStructuredMessage,
47
47
  wrapConfirmWithBadge,
48
48
  writeMessage
49
- } from "./chunk-4XCVGEEX.js";
49
+ } from "./chunk-FSL5W5TI.js";
50
50
  import {
51
51
  claimTask,
52
52
  listTasks,
53
53
  onTasksUpdated,
54
54
  unassignTeammateTasks
55
- } from "./chunk-XSPFQQRE.js";
55
+ } from "./chunk-OONJNQ42.js";
56
56
  import {
57
57
  assignTeammateColor,
58
58
  classifyShutdownResponse,
@@ -60,7 +60,7 @@ import {
60
60
  formatAgentId,
61
61
  generateUniqueTeammateName,
62
62
  writeTeamFile
63
- } from "./chunk-4RPARQ5D.js";
63
+ } from "./chunk-D2VIDMVM.js";
64
64
  import {
65
65
  require_proper_lockfile
66
66
  } from "./chunk-E2UVIFI2.js";
@@ -103,7 +103,7 @@ import {
103
103
  runWithRuntimeContentGenerator,
104
104
  shouldUsePlanOnlyReminderInSubagentContext,
105
105
  spawnBlockReason
106
- } from "./chunk-UOA2IHRI.js";
106
+ } from "./chunk-CPCVCKKF.js";
107
107
  import {
108
108
  getTeammateContext,
109
109
  isTeammate,
@@ -114,7 +114,7 @@ import {
114
114
  escapeSystemReminderTags,
115
115
  escapeXml,
116
116
  renderAvailableSkillsBlock
117
- } from "./chunk-OSSDHJDU.js";
117
+ } from "./chunk-G45X5TRN.js";
118
118
  import {
119
119
  DefaultHookOutput,
120
120
  HOOKS_CONFIG_FIELDS,
@@ -129,7 +129,7 @@ import {
129
129
  createHookOutput,
130
130
  getHookKey,
131
131
  isToolArtifactLike
132
- } from "./chunk-SGPFJMRP.js";
132
+ } from "./chunk-PBATSWUQ.js";
133
133
  import {
134
134
  DEFAULT_FILE_FILTERING_OPTIONS,
135
135
  DEFAULT_QWEN_CUSTOM_IGNORE_FILE_NAMES,
@@ -139,17 +139,17 @@ import {
139
139
  getQwenIgnoreFileNames,
140
140
  isPathWithinRoot,
141
141
  require_ignore
142
- } from "./chunk-335ECZTA.js";
142
+ } from "./chunk-ZEOZL37W.js";
143
143
  import {
144
144
  BaseTokenStorage,
145
145
  KeychainTokenStorage
146
- } from "./chunk-JCJPZMJV.js";
146
+ } from "./chunk-OOCI5VVU.js";
147
147
  import {
148
148
  classifyRetryError,
149
149
  isFallbackEligible,
150
150
  isUnattendedMode,
151
151
  retryWithBackoff
152
- } from "./chunk-6ETOSWAO.js";
152
+ } from "./chunk-DSBCU6JY.js";
153
153
  import {
154
154
  openBrowserSecurely,
155
155
  shouldAttemptBrowserLaunch
@@ -300,7 +300,7 @@ import {
300
300
  updateMCPServerStatus,
301
301
  writeLine,
302
302
  writeLineSync
303
- } from "./chunk-CPU6I5YV.js";
303
+ } from "./chunk-I6JUVU7J.js";
304
304
  import {
305
305
  E_TIMEOUT,
306
306
  Mutex,
@@ -324,16 +324,16 @@ import {
324
324
  isManagedMemoryPath,
325
325
  isTeamAutoMemPath,
326
326
  isUserAutoMemPath
327
- } from "./chunk-LPHGXXZX.js";
327
+ } from "./chunk-JD3MKVKL.js";
328
328
  import {
329
329
  atomicWriteFile,
330
330
  atomicWriteFileSync,
331
331
  atomicWriteJSON,
332
332
  renameWithRetry
333
- } from "./chunk-VAJS2E2D.js";
333
+ } from "./chunk-BDBMYST4.js";
334
334
  import {
335
335
  STRUCTURED_OUTPUT_REDACTED_ARGS
336
- } from "./chunk-WEPXQKGP.js";
336
+ } from "./chunk-EZVDJFZ7.js";
337
337
  import {
338
338
  AgentStatistics,
339
339
  BaseDeclarativeTool,
@@ -350,7 +350,7 @@ import {
350
350
  require_dist,
351
351
  require_fast_deep_equal,
352
352
  require_fast_uri
353
- } from "./chunk-ANRANWVE.js";
353
+ } from "./chunk-OP4MOGXF.js";
354
354
  import {
355
355
  DEFAULT_OPENAI_BASE_URL
356
356
  } from "./chunk-FEOZBUMT.js";
@@ -361,7 +361,7 @@ import {
361
361
  } from "./chunk-DJ2GSRLV.js";
362
362
  import {
363
363
  require_undici
364
- } from "./chunk-4CHDYDG3.js";
364
+ } from "./chunk-6EFTQYW7.js";
365
365
  import {
366
366
  DEFAULT_TOKEN_LIMIT,
367
367
  OUTPUT_TOKEN_CEILING,
@@ -369,10 +369,12 @@ import {
369
369
  defaultOutputCeiling,
370
370
  getToolCallPreparations,
371
371
  knownTokenLimit,
372
+ normalizeMcpToolName,
372
373
  parsePositiveIntegerEnvValue,
374
+ sanitizeToolNameForProvider,
373
375
  setToolCallPreparations,
374
376
  tokenLimit
375
- } from "./chunk-V4PCIS25.js";
377
+ } from "./chunk-MAQQGNQ5.js";
376
378
  import {
377
379
  FinishReason,
378
380
  FunctionCallingConfigMode,
@@ -408,7 +410,7 @@ import {
408
410
  tildeifyPath,
409
411
  toFriendlyError,
410
412
  unescapePath
411
- } from "./chunk-UE5TZ55T.js";
413
+ } from "./chunk-C27BYUX6.js";
412
414
  import {
413
415
  require_src
414
416
  } from "./chunk-DMTGGOSA.js";
@@ -8664,16 +8666,16 @@ var require_windows = __commonJS({
8664
8666
  return false;
8665
8667
  }
8666
8668
  __name(checkPathExt, "checkPathExt");
8667
- function checkStat(stat19, path99, options2) {
8668
- if (!stat19.isSymbolicLink() && !stat19.isFile()) {
8669
+ function checkStat(stat20, path99, options2) {
8670
+ if (!stat20.isSymbolicLink() && !stat20.isFile()) {
8669
8671
  return false;
8670
8672
  }
8671
8673
  return checkPathExt(path99, options2);
8672
8674
  }
8673
8675
  __name(checkStat, "checkStat");
8674
8676
  function isexe(path99, options2, cb) {
8675
- fs93.stat(path99, function(er2, stat19) {
8676
- cb(er2, er2 ? false : checkStat(stat19, path99, options2));
8677
+ fs93.stat(path99, function(er2, stat20) {
8678
+ cb(er2, er2 ? false : checkStat(stat20, path99, options2));
8677
8679
  });
8678
8680
  }
8679
8681
  __name(isexe, "isexe");
@@ -8692,8 +8694,8 @@ var require_mode = __commonJS({
8692
8694
  isexe.sync = sync2;
8693
8695
  var fs93 = __require("fs");
8694
8696
  function isexe(path99, options2, cb) {
8695
- fs93.stat(path99, function(er2, stat19) {
8696
- cb(er2, er2 ? false : checkStat(stat19, options2));
8697
+ fs93.stat(path99, function(er2, stat20) {
8698
+ cb(er2, er2 ? false : checkStat(stat20, options2));
8697
8699
  });
8698
8700
  }
8699
8701
  __name(isexe, "isexe");
@@ -8701,14 +8703,14 @@ var require_mode = __commonJS({
8701
8703
  return checkStat(fs93.statSync(path99), options2);
8702
8704
  }
8703
8705
  __name(sync2, "sync");
8704
- function checkStat(stat19, options2) {
8705
- return stat19.isFile() && checkMode(stat19, options2);
8706
+ function checkStat(stat20, options2) {
8707
+ return stat20.isFile() && checkMode(stat20, options2);
8706
8708
  }
8707
8709
  __name(checkStat, "checkStat");
8708
- function checkMode(stat19, options2) {
8709
- var mod = stat19.mode;
8710
- var uid = stat19.uid;
8711
- var gid = stat19.gid;
8710
+ function checkMode(stat20, options2) {
8711
+ var mod = stat20.mode;
8712
+ var uid = stat20.uid;
8713
+ var gid = stat20.gid;
8712
8714
  var myUid = options2.uid !== void 0 ? options2.uid : process.getuid && process.getuid();
8713
8715
  var myGid = options2.gid !== void 0 ? options2.gid : process.getgid && process.getgid();
8714
8716
  var u2 = parseInt("100", 8);
@@ -9413,12 +9415,12 @@ var require_src3 = __commonJS({
9413
9415
  function check(path99, isFile, isDirectory) {
9414
9416
  log(`checking %s`, path99);
9415
9417
  try {
9416
- const stat19 = fs_1.statSync(path99);
9417
- if (stat19.isFile() && isFile) {
9418
+ const stat20 = fs_1.statSync(path99);
9419
+ if (stat20.isFile() && isFile) {
9418
9420
  log(`[OK] path represents a file`);
9419
9421
  return true;
9420
9422
  }
9421
- if (stat19.isDirectory() && isDirectory) {
9423
+ if (stat20.isDirectory() && isDirectory) {
9422
9424
  log(`[OK] path represents a directory`);
9423
9425
  return true;
9424
9426
  }
@@ -29231,12 +29233,12 @@ var require_resolve_symlink = __commonJS({
29231
29233
  fs_1.default.realpath(path99, (error, resolvedPath) => {
29232
29234
  if (error)
29233
29235
  return queue.dequeue(suppressErrors ? null : error, state);
29234
- fs_1.default.stat(resolvedPath, (error2, stat19) => {
29236
+ fs_1.default.stat(resolvedPath, (error2, stat20) => {
29235
29237
  if (error2)
29236
29238
  return queue.dequeue(suppressErrors ? null : error2, state);
29237
- if (stat19.isDirectory() && isRecursive(path99, resolvedPath, state))
29239
+ if (stat20.isDirectory() && isRecursive(path99, resolvedPath, state))
29238
29240
  return queue.dequeue(null, state);
29239
- callback(stat19, resolvedPath);
29241
+ callback(stat20, resolvedPath);
29240
29242
  queue.dequeue(null, state);
29241
29243
  });
29242
29244
  });
@@ -29246,10 +29248,10 @@ var require_resolve_symlink = __commonJS({
29246
29248
  queue.enqueue();
29247
29249
  try {
29248
29250
  const resolvedPath = fs_1.default.realpathSync(path99);
29249
- const stat19 = fs_1.default.statSync(resolvedPath);
29250
- if (stat19.isDirectory() && isRecursive(path99, resolvedPath, state))
29251
+ const stat20 = fs_1.default.statSync(resolvedPath);
29252
+ if (stat20.isDirectory() && isRecursive(path99, resolvedPath, state))
29251
29253
  return;
29252
- callback(stat19, resolvedPath);
29254
+ callback(stat20, resolvedPath);
29253
29255
  } catch (e) {
29254
29256
  if (!suppressErrors)
29255
29257
  throw e;
@@ -29568,8 +29570,8 @@ var require_walker = __commonJS({
29568
29570
  this.walkDirectory(this.state, path99, path99, depth - 1, this.walk);
29569
29571
  } else if (this.resolveSymlink && entry.isSymbolicLink()) {
29570
29572
  let path99 = joinPath.joinPathWithBasePath(entry.name, directoryPath);
29571
- this.resolveSymlink(path99, this.state, (stat19, resolvedPath) => {
29572
- if (stat19.isDirectory()) {
29573
+ this.resolveSymlink(path99, this.state, (stat20, resolvedPath) => {
29574
+ if (stat20.isDirectory()) {
29573
29575
  resolvedPath = (0, utils_1.normalizePath)(resolvedPath, this.state.options);
29574
29576
  if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path99 + pathSeparator))
29575
29577
  return;
@@ -31459,12 +31461,12 @@ async function cleanupLegacyOutputFiles(dir, now, maxAgeMs, result) {
31459
31461
  __name(cleanupLegacyOutputFiles, "cleanupLegacyOutputFiles");
31460
31462
  async function tryDeleteIfOld(filePath, now, maxAgeMs, result) {
31461
31463
  try {
31462
- const stat19 = await fs2.lstat(filePath);
31463
- if (!stat19.isFile()) return;
31464
- if (now - stat19.mtimeMs < maxAgeMs) return;
31464
+ const stat20 = await fs2.lstat(filePath);
31465
+ if (!stat20.isFile()) return;
31466
+ if (now - stat20.mtimeMs < maxAgeMs) return;
31465
31467
  await fs2.unlink(filePath);
31466
31468
  result.filesDeleted++;
31467
- result.bytesFreed += stat19.size;
31469
+ result.bytesFreed += stat20.size;
31468
31470
  } catch (error) {
31469
31471
  if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
31470
31472
  return;
@@ -32360,6 +32362,7 @@ var MAX_GOAL_ITERATIONS = 50;
32360
32362
  var GOAL_JUDGE_TIMEOUT_MS = 25e3;
32361
32363
  var GOAL_HOOK_TIMEOUT_SECONDS = 30;
32362
32364
  var GOAL_HOOK_TIMEOUT_MS = GOAL_HOOK_TIMEOUT_SECONDS * 1e3;
32365
+ var GOAL_HOOK_ID_OUTPUT_KEY = "qwenGoalHookId";
32363
32366
  var GOAL_ABORTED_REASON = "Goal max iterations reached; cleared. Re-set with `/goal <condition>` if you still need it.";
32364
32367
  var GOAL_JUDGE_TIMEOUT_MESSAGE = "Goal judge timed out; the automatic /goal loop paused. The goal remains active.";
32365
32368
  function continuationReasonForGoal(condition) {
@@ -32367,6 +32370,14 @@ function continuationReasonForGoal(condition) {
32367
32370
  Goal condition: ${condition}`;
32368
32371
  }
32369
32372
  __name(continuationReasonForGoal, "continuationReasonForGoal");
32373
+ function getStopHookContinuationReason(output) {
32374
+ const hasGoalOutput = typeof output.hookSpecificOutput?.[GOAL_HOOK_ID_OUTPUT_KEY] === "string";
32375
+ if (!hasGoalOutput) {
32376
+ return output.stopReason || output.reason || "No reason provided";
32377
+ }
32378
+ return [output.stopReason, output.reason].filter(Boolean).join("\n") || "No reason provided";
32379
+ }
32380
+ __name(getStopHookContinuationReason, "getStopHookContinuationReason");
32370
32381
  async function judgeGoalWithTimeout(config, args) {
32371
32382
  let timeoutId;
32372
32383
  const judgeController = new AbortController();
@@ -32510,7 +32521,10 @@ function createGoalStopHookCallback(args) {
32510
32521
  }
32511
32522
  return {
32512
32523
  decision: "block",
32513
- reason: continuationReasonForGoal(condition)
32524
+ reason: continuationReasonForGoal(condition),
32525
+ hookSpecificOutput: {
32526
+ [GOAL_HOOK_ID_OUTPUT_KEY]: evaluated.hookId
32527
+ }
32514
32528
  };
32515
32529
  };
32516
32530
  }
@@ -32848,7 +32862,8 @@ function parseAndFormatApiError(error, authType) {
32848
32862
  if (isAlreadyFormatted(error.message)) {
32849
32863
  return error.message;
32850
32864
  }
32851
- let text = `[API Error: ${error.message}]`;
32865
+ const message = error instanceof Error ? getErrorMessage(error) : error.message;
32866
+ let text = `[API Error: ${message}]`;
32852
32867
  if (error.status === 429) {
32853
32868
  text += getRateLimitMessage(authType);
32854
32869
  }
@@ -34080,42 +34095,353 @@ import fs10 from "node:fs";
34080
34095
  import { randomUUID as randomUUID2 } from "node:crypto";
34081
34096
  import readline from "node:readline";
34082
34097
 
34083
- // packages/core/src/utils/conversation-chain.ts
34098
+ // packages/core/src/utils/transcript-records.ts
34084
34099
  init_esbuild_shims();
34085
- function buildOrderedUuidChain(records, opts) {
34086
- if (records.length === 0) return { uuids: [], gaps: [] };
34087
- const detectGaps = opts?.detectGaps ?? false;
34088
- const firstByUuid = /* @__PURE__ */ new Map();
34089
- for (const r2 of records) {
34090
- if (!firstByUuid.has(r2.uuid)) firstByUuid.set(r2.uuid, r2);
34100
+ var TranscriptRecordPreparationError = class extends TypeError {
34101
+ constructor(code, message) {
34102
+ super(message);
34103
+ this.code = code;
34104
+ this.name = "TranscriptRecordPreparationError";
34105
+ }
34106
+ static {
34107
+ __name(this, "TranscriptRecordPreparationError");
34091
34108
  }
34109
+ };
34110
+ var RECORD_TYPES = /* @__PURE__ */ new Set([
34111
+ "user",
34112
+ "assistant",
34113
+ "tool_result",
34114
+ "system"
34115
+ ]);
34116
+ var ARTIFACT_RECORD_SUBTYPES = /* @__PURE__ */ new Set([
34117
+ "session_artifact_event",
34118
+ "session_artifact_snapshot"
34119
+ ]);
34120
+ var KNOWN_RECORD_SUBTYPES = /* @__PURE__ */ new Set([
34121
+ "chat_compression",
34122
+ "slash_command",
34123
+ "ui_telemetry",
34124
+ "at_command",
34125
+ "attribution_snapshot",
34126
+ "notification",
34127
+ "cron",
34128
+ "mid_turn_user_message",
34129
+ "custom_title",
34130
+ "parent_session",
34131
+ "rewind",
34132
+ "agent_bootstrap",
34133
+ "agent_launch_prompt",
34134
+ "file_history_snapshot",
34135
+ "session_source",
34136
+ ...ARTIFACT_RECORD_SUBTYPES
34137
+ ]);
34138
+ function isObjectRecord(value) {
34139
+ return typeof value === "object" && value !== null && !Array.isArray(value);
34140
+ }
34141
+ __name(isObjectRecord, "isObjectRecord");
34142
+ function diagnostic(code, message, affectsCompleteness, fields = {}, severity = affectsCompleteness ? "warning" : "info") {
34143
+ return {
34144
+ code,
34145
+ severity,
34146
+ message,
34147
+ affectsCompleteness,
34148
+ ...fields
34149
+ };
34150
+ }
34151
+ __name(diagnostic, "diagnostic");
34152
+ function isTranscriptConversationRecord(record2) {
34153
+ return !isTranscriptArtifactRecord(record2);
34154
+ }
34155
+ __name(isTranscriptConversationRecord, "isTranscriptConversationRecord");
34156
+ function isTranscriptArtifactRecord(record2) {
34157
+ return record2.type === "system" && typeof record2.subtype === "string" && ARTIFACT_RECORD_SUBTYPES.has(record2.subtype);
34158
+ }
34159
+ __name(isTranscriptArtifactRecord, "isTranscriptArtifactRecord");
34160
+ function validateTranscriptRecord(value, recordIndex) {
34161
+ const diagnostics = [];
34162
+ if (!isObjectRecord(value)) {
34163
+ diagnostics.push(
34164
+ diagnostic(
34165
+ "invalid_record",
34166
+ "Skipped a transcript record that is not an object.",
34167
+ true,
34168
+ { recordIndex }
34169
+ )
34170
+ );
34171
+ return { diagnostics };
34172
+ }
34173
+ const uuid = value["uuid"];
34174
+ const parentUuid = value["parentUuid"];
34175
+ const sessionId = value["sessionId"];
34176
+ const type = value["type"];
34177
+ const recordId = typeof uuid === "string" ? uuid : void 0;
34178
+ if (typeof uuid !== "string" || uuid.length === 0 || typeof parentUuid !== "string" && parentUuid !== null || typeof sessionId !== "string" || sessionId.length === 0) {
34179
+ diagnostics.push(
34180
+ diagnostic(
34181
+ "invalid_record",
34182
+ "Skipped a transcript record with invalid identity fields.",
34183
+ true,
34184
+ { recordIndex, recordId }
34185
+ )
34186
+ );
34187
+ return { diagnostics };
34188
+ }
34189
+ if (typeof type !== "string" || !RECORD_TYPES.has(type)) {
34190
+ diagnostics.push(
34191
+ diagnostic(
34192
+ "unknown_record_or_part",
34193
+ "Skipped a transcript record with an unknown record type.",
34194
+ true,
34195
+ { recordIndex, recordId }
34196
+ )
34197
+ );
34198
+ return { diagnostics };
34199
+ }
34200
+ const timestamp = value["timestamp"];
34201
+ if (timestamp !== void 0 && (typeof timestamp !== "string" || !Number.isFinite(new Date(timestamp).getTime()))) {
34202
+ diagnostics.push(
34203
+ diagnostic(
34204
+ "invalid_timestamp",
34205
+ "Ignored an invalid transcript record timestamp.",
34206
+ false,
34207
+ { recordIndex, recordId, path: "timestamp" }
34208
+ )
34209
+ );
34210
+ }
34211
+ const subtype = value["subtype"];
34212
+ if (subtype !== void 0 && (typeof subtype !== "string" || !KNOWN_RECORD_SUBTYPES.has(subtype))) {
34213
+ diagnostics.push(
34214
+ diagnostic(
34215
+ "unknown_record_or_part",
34216
+ "The transcript record has an unknown subtype.",
34217
+ true,
34218
+ { recordIndex, recordId, path: "subtype" }
34219
+ )
34220
+ );
34221
+ }
34222
+ let message;
34223
+ if (value["message"] !== void 0) {
34224
+ if (!isObjectRecord(value["message"])) {
34225
+ diagnostics.push(
34226
+ diagnostic(
34227
+ "malformed_part",
34228
+ "Ignored a malformed transcript message payload.",
34229
+ true,
34230
+ { recordIndex, recordId, path: "message" }
34231
+ )
34232
+ );
34233
+ } else {
34234
+ const parts = value["message"]["parts"];
34235
+ if (parts !== void 0 && !Array.isArray(parts)) {
34236
+ diagnostics.push(
34237
+ diagnostic(
34238
+ "malformed_part",
34239
+ "Ignored malformed transcript message parts.",
34240
+ true,
34241
+ { recordIndex, recordId, path: "message.parts" }
34242
+ )
34243
+ );
34244
+ }
34245
+ message = {
34246
+ ...typeof value["message"]["role"] === "string" ? { role: value["message"]["role"] } : {},
34247
+ ...Array.isArray(parts) ? { parts } : {}
34248
+ };
34249
+ }
34250
+ }
34251
+ return {
34252
+ record: {
34253
+ ...value,
34254
+ uuid,
34255
+ parentUuid,
34256
+ sessionId,
34257
+ type,
34258
+ ...typeof subtype === "string" ? { subtype } : { subtype: void 0 },
34259
+ ...typeof timestamp === "string" && Number.isFinite(new Date(timestamp).getTime()) ? { timestamp } : { timestamp: void 0 },
34260
+ ...message ? { message } : { message: void 0 }
34261
+ },
34262
+ diagnostics
34263
+ };
34264
+ }
34265
+ __name(validateTranscriptRecord, "validateTranscriptRecord");
34266
+ function selectTranscriptLeaf(records, leafUuid) {
34267
+ if (leafUuid !== void 0) {
34268
+ return records.some(
34269
+ (record2) => record2.uuid === leafUuid && isTranscriptConversationRecord(record2)
34270
+ ) ? leafUuid : void 0;
34271
+ }
34272
+ for (let index = records.length - 1; index >= 0; index -= 1) {
34273
+ const record2 = records[index];
34274
+ if (record2 && isTranscriptConversationRecord(record2)) return record2.uuid;
34275
+ }
34276
+ return void 0;
34277
+ }
34278
+ __name(selectTranscriptLeaf, "selectTranscriptLeaf");
34279
+ function walkTranscriptUuidChain(leafUuid, lookup2) {
34092
34280
  const uuids = [];
34093
34281
  const gaps = [];
34094
34282
  const visited = /* @__PURE__ */ new Set();
34095
- const startUuid = opts?.leafUuid ?? records[records.length - 1].uuid;
34096
- if (!firstByUuid.has(startUuid)) return { uuids: [], gaps: [] };
34097
- let currentUuid = startUuid;
34283
+ let currentUuid = leafUuid;
34284
+ let cycleUuid;
34098
34285
  while (currentUuid) {
34099
- if (visited.has(currentUuid)) break;
34286
+ if (visited.has(currentUuid)) {
34287
+ cycleUuid = currentUuid;
34288
+ break;
34289
+ }
34100
34290
  visited.add(currentUuid);
34291
+ const record2 = lookup2(currentUuid);
34292
+ if (!record2) break;
34101
34293
  uuids.push(currentUuid);
34102
- const rec = firstByUuid.get(currentUuid);
34103
- if (!rec) break;
34104
- const parent = rec.parentUuid;
34105
- if (!parent) break;
34106
- if (firstByUuid.has(parent)) {
34107
- currentUuid = parent;
34108
- continue;
34109
- }
34110
- if (detectGaps) {
34111
- gaps.push({ childUuid: currentUuid, missingParentUuid: parent });
34294
+ if (!record2.parentUuid) break;
34295
+ if (!lookup2(record2.parentUuid)) {
34296
+ gaps.push({
34297
+ childUuid: currentUuid,
34298
+ missingParentUuid: record2.parentUuid
34299
+ });
34300
+ break;
34112
34301
  }
34113
- break;
34302
+ currentUuid = record2.parentUuid;
34114
34303
  }
34115
34304
  uuids.reverse();
34116
- return { uuids, gaps };
34305
+ return { uuids, gaps, ...cycleUuid ? { cycleUuid } : {} };
34117
34306
  }
34118
- __name(buildOrderedUuidChain, "buildOrderedUuidChain");
34307
+ __name(walkTranscriptUuidChain, "walkTranscriptUuidChain");
34308
+ function aggregateTranscriptRecordFragments(records) {
34309
+ const first2 = records[0];
34310
+ if (!first2) {
34311
+ throw new Error("Cannot aggregate empty transcript record array");
34312
+ }
34313
+ const base = { ...first2 };
34314
+ let message = first2.message ? { ...first2.message, parts: [...first2.message.parts ?? []] } : void 0;
34315
+ for (let index = 1; index < records.length; index += 1) {
34316
+ const record2 = records[index];
34317
+ if (record2.message !== void 0) {
34318
+ message = message ? {
34319
+ role: message.role,
34320
+ parts: [...message.parts ?? [], ...record2.message.parts ?? []]
34321
+ } : { ...record2.message, parts: [...record2.message.parts ?? []] };
34322
+ }
34323
+ if (record2.usageMetadata) base["usageMetadata"] = record2.usageMetadata;
34324
+ if (record2.toolCallResult && !base["toolCallResult"]) {
34325
+ base["toolCallResult"] = record2.toolCallResult;
34326
+ }
34327
+ if (record2.model && !base["model"]) base["model"] = record2.model;
34328
+ if (record2.timestamp && (!base["timestamp"] || record2.timestamp > String(base["timestamp"]))) {
34329
+ base["timestamp"] = record2.timestamp;
34330
+ }
34331
+ }
34332
+ base["message"] = message;
34333
+ return base;
34334
+ }
34335
+ __name(aggregateTranscriptRecordFragments, "aggregateTranscriptRecordFragments");
34336
+ function prepareTranscriptRecords(values, options2 = {}) {
34337
+ if (!Array.isArray(values)) {
34338
+ throw new TranscriptRecordPreparationError(
34339
+ "invalid_records",
34340
+ "Transcript records must be an array."
34341
+ );
34342
+ }
34343
+ const diagnostics = [];
34344
+ const records = [];
34345
+ const sourceIndexByRecord = /* @__PURE__ */ new Map();
34346
+ for (let index = 0; index < values.length; index += 1) {
34347
+ const validated = validateTranscriptRecord(values[index], index);
34348
+ diagnostics.push(...validated.diagnostics);
34349
+ if (validated.record) {
34350
+ records.push(validated.record);
34351
+ sourceIndexByRecord.set(validated.record, index);
34352
+ }
34353
+ }
34354
+ const sessionIds = new Set(records.map((record2) => record2.sessionId));
34355
+ if (sessionIds.size > 1) {
34356
+ throw new TranscriptRecordPreparationError(
34357
+ "mixed_session_ids",
34358
+ "Transcript records contain multiple session ids."
34359
+ );
34360
+ }
34361
+ const leafUuid = selectTranscriptLeaf(records, options2.leafUuid);
34362
+ if (options2.leafUuid !== void 0 && leafUuid === void 0) {
34363
+ throw new TranscriptRecordPreparationError(
34364
+ "leaf_not_found",
34365
+ "The requested transcript leaf was not found."
34366
+ );
34367
+ }
34368
+ if (!leafUuid) {
34369
+ if (records.length > 0) {
34370
+ diagnostics.push(
34371
+ diagnostic(
34372
+ "artifact_only",
34373
+ "The input contains no conversation records.",
34374
+ false
34375
+ )
34376
+ );
34377
+ }
34378
+ return {
34379
+ ...sessionIds.size === 1 ? { sessionId: records[0].sessionId } : {},
34380
+ records: [],
34381
+ gaps: [],
34382
+ diagnostics
34383
+ };
34384
+ }
34385
+ const fragmentsByUuid = /* @__PURE__ */ new Map();
34386
+ const firstByUuid = /* @__PURE__ */ new Map();
34387
+ for (const record2 of records) {
34388
+ if (!isTranscriptConversationRecord(record2)) continue;
34389
+ const fragments = fragmentsByUuid.get(record2.uuid);
34390
+ if (fragments) {
34391
+ if (fragments[0].parentUuid !== record2.parentUuid) {
34392
+ diagnostics.push(
34393
+ diagnostic(
34394
+ "conflicting_parent_uuid",
34395
+ "Duplicate transcript record fragments disagree on parentUuid.",
34396
+ true,
34397
+ {
34398
+ recordIndex: sourceIndexByRecord.get(record2),
34399
+ recordId: record2.uuid,
34400
+ path: "parentUuid"
34401
+ }
34402
+ )
34403
+ );
34404
+ }
34405
+ fragments.push(record2);
34406
+ } else {
34407
+ fragmentsByUuid.set(record2.uuid, [record2]);
34408
+ firstByUuid.set(record2.uuid, record2);
34409
+ }
34410
+ }
34411
+ const chain = walkTranscriptUuidChain(
34412
+ leafUuid,
34413
+ (uuid) => firstByUuid.get(uuid)
34414
+ );
34415
+ for (const gap of chain.gaps) {
34416
+ diagnostics.push(
34417
+ diagnostic(
34418
+ "history_gap",
34419
+ "The active transcript chain is missing a parent record.",
34420
+ true,
34421
+ { recordId: gap.childUuid }
34422
+ )
34423
+ );
34424
+ }
34425
+ if (chain.cycleUuid) {
34426
+ diagnostics.push(
34427
+ diagnostic(
34428
+ "parent_cycle",
34429
+ "The active transcript chain contains a parent cycle.",
34430
+ true,
34431
+ { recordId: chain.cycleUuid }
34432
+ )
34433
+ );
34434
+ }
34435
+ return {
34436
+ ...sessionIds.size === 1 ? { sessionId: records[0].sessionId } : {},
34437
+ records: chain.uuids.map(
34438
+ (uuid) => aggregateTranscriptRecordFragments(fragmentsByUuid.get(uuid) ?? [])
34439
+ ),
34440
+ gaps: chain.gaps,
34441
+ diagnostics
34442
+ };
34443
+ }
34444
+ __name(prepareTranscriptRecords, "prepareTranscriptRecords");
34119
34445
 
34120
34446
  // packages/core/src/services/fileHistoryService.ts
34121
34447
  init_esbuild_shims();
@@ -37021,12 +37347,8 @@ var MAX_PERSISTED_MIME_CHARS = 120;
37021
37347
  var MAX_PERSISTED_FIELD_CHARS = 200;
37022
37348
  var MAX_PERSISTED_TIMESTAMP_CHARS = 64;
37023
37349
  var SECRET_TOKEN_VALUE_PATTERN = /(?:^|\s)(?:bearer\s+\S{8,}|sk-[A-Za-z0-9_-]{12,}|(?:gh[pousr]|github_pat)_[A-Za-z0-9_/-]{12,}|[a-f0-9]{40,}|[A-Za-z0-9+/]{48,}={0,2})(?:$|\s)/i;
37024
- var ARTIFACT_RECORD_SUBTYPES = /* @__PURE__ */ new Set([
37025
- "session_artifact_event",
37026
- "session_artifact_snapshot"
37027
- ]);
37028
37350
  function isSessionArtifactRecord(record2) {
37029
- return record2.type === "system" && typeof record2.subtype === "string" && ARTIFACT_RECORD_SUBTYPES.has(record2.subtype);
37351
+ return isTranscriptArtifactRecord(record2);
37030
37352
  }
37031
37353
  __name(isSessionArtifactRecord, "isSessionArtifactRecord");
37032
37354
  function stableSessionArtifactId(sessionId, identityKey) {
@@ -38310,10 +38632,10 @@ function makeSessionTranscriptNotFoundError(sessionId) {
38310
38632
  return error;
38311
38633
  }
38312
38634
  __name(makeSessionTranscriptNotFoundError, "makeSessionTranscriptNotFoundError");
38313
- function isObjectRecord(value) {
38635
+ function isObjectRecord2(value) {
38314
38636
  return typeof value === "object" && value !== null && !Array.isArray(value);
38315
38637
  }
38316
- __name(isObjectRecord, "isObjectRecord");
38638
+ __name(isObjectRecord2, "isObjectRecord");
38317
38639
  function isFiniteNonNegativeInteger(value) {
38318
38640
  return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
38319
38641
  }
@@ -38423,11 +38745,11 @@ function decodeCursorState(cursor, key) {
38423
38745
  try {
38424
38746
  const decoded = Buffer.from(cursor, "base64url").toString("utf8");
38425
38747
  const parsed = JSON.parse(decoded);
38426
- if (!isObjectRecord(parsed)) {
38748
+ if (!isObjectRecord2(parsed)) {
38427
38749
  throw new InvalidSessionTranscriptCursorError();
38428
38750
  }
38429
38751
  const fileIdentity = parsed["fileIdentity"];
38430
- if (parsed["v"] !== SESSION_TRANSCRIPT_CURSOR_VERSION || typeof parsed["sessionId"] !== "string" || !isObjectRecord(fileIdentity) || !isFiniteNonNegativeInteger(fileIdentity["dev"]) || !isFiniteNonNegativeInteger(fileIdentity["ino"]) || !isFiniteNonNegativeInteger(parsed["snapshotSize"]) || !isFiniteNonNegativeInteger(parsed["position"]) || parsed["direction"] !== void 0 && parsed["direction"] !== "backward" || typeof parsed["leafUuid"] !== "string" || typeof parsed["startTime"] !== "string" || typeof parsed["lastUpdated"] !== "string" || typeof parsed["mac"] !== "string") {
38752
+ if (parsed["v"] !== SESSION_TRANSCRIPT_CURSOR_VERSION || typeof parsed["sessionId"] !== "string" || !isObjectRecord2(fileIdentity) || !isFiniteNonNegativeInteger(fileIdentity["dev"]) || !isFiniteNonNegativeInteger(fileIdentity["ino"]) || !isFiniteNonNegativeInteger(parsed["snapshotSize"]) || !isFiniteNonNegativeInteger(parsed["position"]) || parsed["direction"] !== void 0 && parsed["direction"] !== "backward" || typeof parsed["leafUuid"] !== "string" || typeof parsed["startTime"] !== "string" || typeof parsed["lastUpdated"] !== "string" || typeof parsed["mac"] !== "string") {
38431
38753
  debugLogger13.debug("cursor decode failed: invalid payload shape");
38432
38754
  throw new InvalidSessionTranscriptCursorError();
38433
38755
  }
@@ -38662,12 +38984,6 @@ function pruneCache(now = Date.now()) {
38662
38984
  }
38663
38985
  }
38664
38986
  __name(pruneCache, "pruneCache");
38665
- function isChatRecord(value) {
38666
- if (!isObjectRecord(value)) return false;
38667
- const type = value["type"];
38668
- return typeof value["uuid"] === "string" && (typeof value["parentUuid"] === "string" || value["parentUuid"] === null) && typeof value["sessionId"] === "string" && typeof value["timestamp"] === "string" && (type === "user" || type === "assistant" || type === "tool_result" || type === "system");
38669
- }
38670
- __name(isChatRecord, "isChatRecord");
38671
38987
  async function forEachLineInSnapshot(filePath, snapshotSize, onLine) {
38672
38988
  if (snapshotSize === 0) return;
38673
38989
  let pending = [];
@@ -38721,7 +39037,10 @@ async function readSegmentRecords(handle, filePath, segment, uuid) {
38721
39037
  await handle.read(buffer, 0, segment.length, segment.offset);
38722
39038
  const line = buffer.toString("utf8").trim();
38723
39039
  if (line.length === 0) return [];
38724
- const records = parseLineTolerant(line, filePath).filter((record3) => isChatRecord(record3));
39040
+ const records = parseLineTolerant(line, filePath).flatMap((value) => {
39041
+ const record3 = validateTranscriptRecord(value).record;
39042
+ return record3 && isTranscriptConversationRecord(record3) ? [record3] : [];
39043
+ });
38725
39044
  const anomalySessionId = path9.basename(filePath, ".jsonl");
38726
39045
  const record2 = records[segment.fragmentIndex];
38727
39046
  if (!record2) {
@@ -38739,42 +39058,6 @@ async function readSegmentRecords(handle, filePath, segment, uuid) {
38739
39058
  return [record2];
38740
39059
  }
38741
39060
  __name(readSegmentRecords, "readSegmentRecords");
38742
- function aggregateRecords(records) {
38743
- if (records.length === 0) {
38744
- throw new Error("Cannot aggregate empty transcript record array");
38745
- }
38746
- const base = { ...records[0] };
38747
- for (let i2 = 1; i2 < records.length; i2++) {
38748
- const record2 = records[i2];
38749
- if (record2.message !== void 0) {
38750
- if (base.message === void 0) {
38751
- base.message = record2.message;
38752
- } else {
38753
- base.message = {
38754
- role: base.message.role,
38755
- parts: [
38756
- ...base.message.parts ?? [],
38757
- ...record2.message.parts ?? []
38758
- ]
38759
- };
38760
- }
38761
- }
38762
- if (record2.usageMetadata) {
38763
- base.usageMetadata = record2.usageMetadata;
38764
- }
38765
- if (record2.toolCallResult && !base.toolCallResult) {
38766
- base.toolCallResult = record2.toolCallResult;
38767
- }
38768
- if (record2.model && !base.model) {
38769
- base.model = record2.model;
38770
- }
38771
- if (record2.timestamp > base.timestamp) {
38772
- base.timestamp = record2.timestamp;
38773
- }
38774
- }
38775
- return base;
38776
- }
38777
- __name(aggregateRecords, "aggregateRecords");
38778
39061
  async function readAggregatedRecords(index, uuids) {
38779
39062
  const handle = await fsp.open(index.filePath, "r");
38780
39063
  try {
@@ -38789,7 +39072,7 @@ async function readAggregatedRecords(index, uuids) {
38789
39072
  );
38790
39073
  }
38791
39074
  if (physicalRecords.length > 0) {
38792
- records.push(aggregateRecords(physicalRecords));
39075
+ records.push(aggregateTranscriptRecordFragments(physicalRecords));
38793
39076
  }
38794
39077
  }
38795
39078
  return records;
@@ -38825,12 +39108,12 @@ async function buildIndex(params) {
38825
39108
  const text = line.toString("utf8").trim();
38826
39109
  if (text.length === 0) return;
38827
39110
  let fragmentIndex = 0;
38828
- for (const record2 of parseLineTolerant(
38829
- text,
38830
- filePath
38831
- )) {
38832
- if (!isChatRecord(record2)) continue;
38833
- startTime ??= record2.timestamp;
39111
+ for (const value of parseLineTolerant(text, filePath)) {
39112
+ const record2 = validateTranscriptRecord(value).record;
39113
+ if (!record2 || !isTranscriptConversationRecord(record2)) {
39114
+ continue;
39115
+ }
39116
+ if (record2.timestamp) startTime ??= record2.timestamp;
38834
39117
  leafUuid = record2.uuid;
38835
39118
  const existing = byUuid.get(record2.uuid);
38836
39119
  const segment = {
@@ -38853,43 +39136,30 @@ async function buildIndex(params) {
38853
39136
  }
38854
39137
  }
38855
39138
  );
38856
- if (!leafUuid || !startTime) {
39139
+ if (!leafUuid) {
38857
39140
  debugLogger13.warn(
38858
39141
  `index build failed: no transcript records session=${sessionId}`
38859
39142
  );
38860
39143
  throw new SessionTranscriptSnapshotUnavailableError(sessionId);
38861
39144
  }
38862
- const activeUuids = [];
38863
- const gaps = [];
38864
- const visited = /* @__PURE__ */ new Set();
38865
- let currentUuid = leafUuid;
38866
- while (currentUuid && !visited.has(currentUuid)) {
38867
- visited.add(currentUuid);
38868
- const entry = byUuid.get(currentUuid);
38869
- if (!entry) {
38870
- debugLogger13.debug(
38871
- `active chain terminated: missing uuid session=${sessionId} uuid=${currentUuid}`
38872
- );
38873
- break;
38874
- }
38875
- activeUuids.push(currentUuid);
38876
- const parentUuid = entry.parentUuid;
38877
- if (!parentUuid) break;
38878
- if (!byUuid.has(parentUuid)) {
38879
- gaps.push({ childUuid: currentUuid, missingParentUuid: parentUuid });
38880
- debugLogger13.debug(
38881
- `active chain gap session=${sessionId} child=${currentUuid} missingParent=${parentUuid}`
38882
- );
38883
- break;
38884
- }
38885
- currentUuid = parentUuid;
38886
- }
38887
- if (currentUuid && visited.has(currentUuid)) {
39145
+ startTime ??= lastUpdated;
39146
+ const chain = walkTranscriptUuidChain(leafUuid, (uuid) => {
39147
+ const entry = byUuid.get(uuid);
39148
+ return entry ? {
39149
+ uuid,
39150
+ parentUuid: entry.parentUuid,
39151
+ sessionId,
39152
+ timestamp: startTime,
39153
+ type: "system"
39154
+ } : void 0;
39155
+ });
39156
+ const activeUuids = [...chain.uuids];
39157
+ const gaps = [...chain.gaps];
39158
+ if (chain.cycleUuid) {
38888
39159
  debugLogger13.debug(
38889
- `active chain terminated: cycle session=${sessionId} uuid=${currentUuid}`
39160
+ `active chain terminated: cycle session=${sessionId} uuid=${chain.cycleUuid}`
38890
39161
  );
38891
39162
  }
38892
- activeUuids.reverse();
38893
39163
  debugLogger13.debug(
38894
39164
  `index build complete session=${sessionId} records=${byUuid.size} active=${activeUuids.length} gaps=${gaps.length}`
38895
39165
  );
@@ -39181,6 +39451,9 @@ var SessionService = class {
39181
39451
  getWorktreeSessionPath(sessionId) {
39182
39452
  return this.getWorktreeSessionPathForState(sessionId, "active");
39183
39453
  }
39454
+ getWorktreeSessionPathForArchiveState(sessionId, state) {
39455
+ return this.getWorktreeSessionPathForState(sessionId, state);
39456
+ }
39184
39457
  async readProjectSessionHead(sessionId, filePath) {
39185
39458
  try {
39186
39459
  const records = await readLines(filePath, 1);
@@ -39731,49 +40004,11 @@ var SessionService = class {
39731
40004
  return [];
39732
40005
  }
39733
40006
  }
39734
- /**
39735
- * Aggregates multiple records with the same uuid into a single ChatRecord.
39736
- * Merges content fields (message, tokens, model, toolCallResult).
39737
- */
39738
- aggregateRecords(records) {
39739
- if (records.length === 0) {
39740
- throw new Error("Cannot aggregate empty records array");
39741
- }
39742
- const base = { ...records[0] };
39743
- for (let i2 = 1; i2 < records.length; i2++) {
39744
- const record2 = records[i2];
39745
- if (record2.message !== void 0) {
39746
- if (base.message === void 0) {
39747
- base.message = record2.message;
39748
- } else {
39749
- base.message = {
39750
- role: base.message.role,
39751
- parts: [
39752
- ...base.message.parts || [],
39753
- ...record2.message.parts || []
39754
- ]
39755
- };
39756
- }
39757
- }
39758
- if (record2.usageMetadata) {
39759
- base.usageMetadata = record2.usageMetadata;
39760
- }
39761
- if (record2.toolCallResult && !base.toolCallResult) {
39762
- base.toolCallResult = record2.toolCallResult;
39763
- }
39764
- if (record2.model && !base.model) {
39765
- base.model = record2.model;
39766
- }
39767
- if (record2.timestamp > base.timestamp) {
39768
- base.timestamp = record2.timestamp;
39769
- }
39770
- }
39771
- return base;
39772
- }
39773
40007
  /**
39774
40008
  * Reconstructs a linear conversation from tree-structured records.
39775
40009
  *
39776
- * Delegates the parentUuid walk to {@link buildOrderedUuidChain}. With
40010
+ * Delegates validation, parentUuid walking, and fragment aggregation to the
40011
+ * shared transcript record preparation module. With
39777
40012
  * `detectGaps`, a walk that stops on a physically-missing parent records the
39778
40013
  * break in the returned `gaps` (see {@link HistoryGap}) so the surface can
39779
40014
  * mark it — the earlier records are NOT reconstructed (reconnecting them
@@ -39782,30 +40017,13 @@ var SessionService = class {
39782
40017
  */
39783
40018
  reconstructHistory(records, opts) {
39784
40019
  if (records.length === 0) return { messages: [], gaps: [] };
39785
- const recordsByUuid = /* @__PURE__ */ new Map();
39786
- for (const record2 of records) {
39787
- const existing = recordsByUuid.get(record2.uuid) || [];
39788
- existing.push(record2);
39789
- recordsByUuid.set(record2.uuid, existing);
39790
- }
39791
- const { uuids, gaps } = buildOrderedUuidChain(records, opts);
39792
- const messages = [];
39793
- for (const uuid of uuids) {
39794
- const recordsForUuid = recordsByUuid.get(uuid);
39795
- if (recordsForUuid && recordsForUuid.length > 0) {
39796
- messages.push(this.aggregateRecords(recordsForUuid));
39797
- }
39798
- }
39799
- return { messages, gaps };
39800
- }
39801
- lastConversationRecordUuid(records) {
39802
- for (let index = records.length - 1; index >= 0; index--) {
39803
- const record2 = records[index];
39804
- if (record2 && !isSessionArtifactRecord(record2)) {
39805
- return record2.uuid;
39806
- }
39807
- }
39808
- return null;
40020
+ const prepared = prepareTranscriptRecords(records, {
40021
+ ...opts?.leafUuid !== void 0 ? { leafUuid: opts.leafUuid } : {}
40022
+ });
40023
+ return {
40024
+ messages: prepared.records.map((record2) => record2),
40025
+ gaps: opts?.detectGaps ? [...prepared.gaps] : []
40026
+ };
39809
40027
  }
39810
40028
  /**
39811
40029
  * Loads a session by its session ID.
@@ -39862,12 +40080,7 @@ var SessionService = class {
39862
40080
  )) {
39863
40081
  return;
39864
40082
  }
39865
- const leafUuid = this.lastConversationRecordUuid(records);
39866
- if (!leafUuid) {
39867
- return;
39868
- }
39869
40083
  const { messages, gaps } = this.reconstructHistory(records, {
39870
- leafUuid,
39871
40084
  detectGaps: true
39872
40085
  });
39873
40086
  if (messages.length === 0) {
@@ -40226,13 +40439,7 @@ var SessionService = class {
40226
40439
  `Source session does not belong to current project: ${sourceSessionId}`
40227
40440
  );
40228
40441
  }
40229
- const leafUuid = this.lastConversationRecordUuid(records);
40230
- if (!leafUuid) {
40231
- throw new Error(`Source session not found or empty: ${sourceSessionId}`);
40232
- }
40233
- const { messages: activeMessages } = this.reconstructHistory(records, {
40234
- leafUuid
40235
- });
40442
+ const { messages: activeMessages } = this.reconstructHistory(records);
40236
40443
  const sourceRecords = includeActiveSideArtifactRecords(
40237
40444
  records,
40238
40445
  activeMessages
@@ -43149,6 +43356,81 @@ I found the following 'app.config' files:
43149
43356
  To help you check their settings, I can read their contents. Which one would you like to start with, or should I read all of them?
43150
43357
  </example>
43151
43358
  `.trim();
43359
+ var gemma4ToolCallExamples = `
43360
+ # Examples (Illustrating Tone and Workflow)
43361
+ <example>
43362
+ user: 1 + 2
43363
+ model: 3
43364
+ </example>
43365
+
43366
+ <example>
43367
+ user: is 13 a prime number?
43368
+ model: true
43369
+ </example>
43370
+
43371
+ <example>
43372
+ user: start the server implemented in server.js
43373
+ model: <|tool_call>call:${ToolNames.SHELL}{command:<|"|>node server.js<|"|>,is_background:true}<tool_call|>
43374
+ </example>
43375
+
43376
+ <example>
43377
+ user: Refactor the auth logic in src/auth.py to use the requests library instead of urllib.
43378
+ model: Okay, I can refactor 'src/auth.py'.
43379
+ First, I'll analyze the code and check for a test safety net before planning any changes.
43380
+ <|tool_call>call:${ToolNames.GLOB}{pattern:<|"|>tests/test_auth.py<|"|>}<tool_call|>
43381
+ <|tool_call>call:${ToolNames.READ_FILE}{file_path:<|"|>/path/to/tests/test_auth.py<|"|>,offset:0,limit:10}<tool_call|>
43382
+ (After analysis)
43383
+ Great, 'tests/test_auth.py' exists and covers the core authentication logic. With this safety net in place, I can safely plan the refactoring.
43384
+ I'll also confirm 'requests' is a dependency.
43385
+ <|tool_call>call:${ToolNames.READ_FILE}{file_path:<|"|>/path/to/requirements.txt<|"|>}<tool_call|>
43386
+ (After analysis)
43387
+ Looks good, 'requests' is available.
43388
+
43389
+ Here's the plan:
43390
+ 1. Replace the 'urllib' calls with 'requests'.
43391
+ 2. Add proper 'try...except' error handling for the new network calls.
43392
+ 3. Remove the old 'urllib' import.
43393
+ 4. Run the project's linter and tests to verify the changes.
43394
+
43395
+ <|tool_call>call:${ToolNames.EDIT}{file_path:<|"|>/path/to/src/auth.py<|"|>,old_string:<|"|>(old code content)<|"|>,new_string:<|"|>(new code content)<|"|>}<tool_call|>
43396
+ Refactoring complete. Running verification...
43397
+ <|tool_call>call:${ToolNames.SHELL}{command:<|"|>ruff check src/auth.py && pytest<|"|>}<tool_call|>
43398
+ (After verification passes)
43399
+ All checks passed. This is a stable checkpoint.
43400
+ Would you like me to write a commit message and commit these changes?
43401
+ </example>
43402
+
43403
+ <example>
43404
+ user: Delete the temp directory.
43405
+ model: I can run \`rm -rf /path/to/project/temp\`. This will permanently delete the directory and all its contents.
43406
+ </example>
43407
+
43408
+ <example>
43409
+ user: Write tests for someFile.ts
43410
+ model:
43411
+ Okay, I can write those tests. First, I'll read someFile.ts to understand its functionality.
43412
+ <|tool_call>call:${ToolNames.READ_FILE}{file_path:<|"|>/path/to/someFile.ts<|"|>}<tool_call|>
43413
+ Now I'll look for existing or related test files to understand current testing conventions and dependencies.
43414
+ <|tool_call>call:${ToolNames.READ_FILE}{file_path:<|"|>/path/to/existingTest.test.ts<|"|>}<tool_call|>
43415
+ (After reviewing existing tests and the file content)
43416
+ <|tool_call>call:${ToolNames.WRITE_FILE}{file_path:<|"|>/path/to/someFile.test.ts<|"|>,content:<|"|>(test code content)<|"|>}<tool_call|>
43417
+ I've written the tests. Now I'll run the project's test command to verify them.
43418
+ <|tool_call>call:${ToolNames.SHELL}{command:<|"|>npm run test<|"|>}<tool_call|>
43419
+ (After verification passes)
43420
+ All checks passed. This is a stable checkpoint.
43421
+ </example>
43422
+
43423
+ <example>
43424
+ user: Where are all the 'app.config' files in this project? I need to check their settings.
43425
+ model:
43426
+ <|tool_call>call:${ToolNames.GLOB}{pattern:<|"|>./**/app.config<|"|>}<tool_call|>
43427
+ (Assuming GlobTool returns a list of paths like ['/path/to/moduleA/app.config', '/path/to/moduleB/app.config'])
43428
+ I found the following 'app.config' files:
43429
+ - /path/to/moduleA/app.config
43430
+ - /path/to/moduleB/app.config
43431
+ To help you check their settings, I can read their contents. Which one would you like to start with, or should I read all of them?
43432
+ </example>
43433
+ `.trim();
43152
43434
  function getToolCallExamples(model) {
43153
43435
  const toolCallStyle = process2.env["QWEN_CODE_TOOL_CALL_STYLE"];
43154
43436
  if (toolCallStyle) {
@@ -43157,6 +43439,8 @@ function getToolCallExamples(model) {
43157
43439
  return qwenCoderToolCallExamples;
43158
43440
  case "qwen-vl":
43159
43441
  return qwenVlToolCallExamples;
43442
+ case "gemma4":
43443
+ return gemma4ToolCallExamples;
43160
43444
  case "general":
43161
43445
  return generalToolCallExamples;
43162
43446
  default:
@@ -43176,13 +43460,16 @@ function getToolCallExamples(model) {
43176
43460
  if (/coder-model/i.test(model)) {
43177
43461
  return qwenCoderToolCallExamples;
43178
43462
  }
43463
+ if (/gemma[-_]?4/i.test(model)) {
43464
+ return gemma4ToolCallExamples;
43465
+ }
43179
43466
  }
43180
43467
  return generalToolCallExamples;
43181
43468
  }
43182
43469
  __name(getToolCallExamples, "getToolCallExamples");
43183
43470
  function getPlanModeSystemReminder(planOnly = false) {
43184
43471
  return `<system-reminder>
43185
- Plan mode is active. The user indicated that they do not want you to execute yet -- you MUST NOT make any edits, run any non-readonly tools (including changing configs or making commits), or otherwise make any changes to the system. This supersedes any other instructions you have received (for example, to make edits).
43472
+ Plan mode is active. The user indicated that they do not want you to execute yet -- you MUST NOT make any edits, run tools classified as state-modifying (including changing configs or making commits), or otherwise make changes to the system. A shell command whose safety cannot be determined may run only after the user explicitly approves that exact invocation once, and only when it is necessary for the investigation. This supersedes any other instructions you have received (for example, to make edits).
43186
43473
 
43187
43474
  ## Iterative Planning Workflow
43188
43475
 
@@ -43218,10 +43505,13 @@ Start by quickly scanning a few key files to form an initial understanding of th
43218
43505
 
43219
43506
  If a non-read-only tool is blocked:
43220
43507
  - Do NOT retry the blocked tool or repeatedly attempt similar non-read-only tools
43508
+ - Do NOT use wrappers, quoting tricks, aliases, or obfuscation to make a blocked write look unknown
43221
43509
  - Do NOT immediately call exit_plan_mode just to unblock it \u2014 continue gathering context with read-only tools first
43222
43510
  - Pivot to read-only tools (read_file, grep_search, glob, list_directory, agents) to gather the information the blocked tool would have provided
43223
43511
  - Once you have enough context to form a complete plan, call exit_plan_mode
43224
43512
 
43513
+ An exact one-off approval for an unknown shell command approves only that invocation. It does not approve the plan, authorize related commands, or exit Plan mode.
43514
+
43225
43515
  ### When to Converge
43226
43516
 
43227
43517
  Your plan is ready when you have addressed all ambiguities and it covers: what to change, which files to modify, what existing code to reuse (with file paths), and how to verify the changes. Present your plan ${planOnly ? "directly" : `by calling the ${ToolNames.EXIT_PLAN_MODE} tool, which will prompt the user to confirm the plan`}. Do NOT make any file changes or run any tools that modify the system state in any way until the user has confirmed the plan.
@@ -49577,25 +49867,32 @@ function matchesMcpPattern(pattern, toolName) {
49577
49867
  if (pattern === toolName) {
49578
49868
  return true;
49579
49869
  }
49870
+ if (!pattern.endsWith("*") && pattern.split("__").length >= 3 && normalizeMcpToolName(pattern) === normalizeMcpToolName(toolName)) {
49871
+ return true;
49872
+ }
49580
49873
  if (pattern.endsWith("*")) {
49581
- const prefix = pattern.slice(0, -1);
49582
- return toolName.startsWith(prefix);
49874
+ const prefix = sanitizeToolNameForProvider(pattern.slice(0, -1));
49875
+ return sanitizeToolNameForProvider(toolName).startsWith(prefix);
49583
49876
  }
49584
49877
  const patternParts = pattern.split("__");
49585
49878
  const toolParts = toolName.split("__");
49586
- if (patternParts.length === 2 && toolParts.length >= 3 && patternParts[0] === toolParts[0] && patternParts[1] === toolParts[1]) {
49879
+ if (patternParts.length === 2 && toolParts.length >= 3 && patternParts[0] === toolParts[0] && sanitizeToolNameForProvider(patternParts[1]) === sanitizeToolNameForProvider(toolParts[1])) {
49587
49880
  return true;
49588
49881
  }
49589
49882
  return false;
49590
49883
  }
49591
49884
  __name(matchesMcpPattern, "matchesMcpPattern");
49592
- function matchesRule(rule, toolName, command, filePath, domain, pathContext, specifier, toolParams, pathMatchMode = "lexical") {
49885
+ function matchesRule(rule, toolName, command, filePath, domain, pathContext, specifier, toolParams, toolAliases2, pathMatchMode = "lexical") {
49593
49886
  const canonicalCtxToolName = resolveToolName(toolName);
49594
49887
  if (rule.invalid) {
49595
49888
  return false;
49596
49889
  }
49597
49890
  if (rule.toolName.startsWith("mcp__") || canonicalCtxToolName.startsWith("mcp__")) {
49598
- if (!matchesMcpPattern(rule.toolName, canonicalCtxToolName)) {
49891
+ const matchesLegacyExactName = !rule.toolName.endsWith("*") && rule.toolName.split("__").length >= 3 && (toolAliases2 ?? []).some(
49892
+ (alias) => rule.toolName === resolveToolName(alias)
49893
+ );
49894
+ const matchesMcpName = matchesMcpPattern(rule.toolName, canonicalCtxToolName) || matchesLegacyExactName;
49895
+ if (!matchesMcpName) {
49599
49896
  return false;
49600
49897
  }
49601
49898
  if (rule.specifier) {
@@ -54629,6 +54926,11 @@ async function classifyInternal(command) {
54629
54926
  }
54630
54927
  }
54631
54928
  __name(classifyInternal, "classifyInternal");
54929
+ async function classifyShellCommandSafety(command) {
54930
+ if (typeof command !== "string" || !command.trim()) return "unknown";
54931
+ return classifyInternal(command).catch(() => "unknown");
54932
+ }
54933
+ __name(classifyShellCommandSafety, "classifyShellCommandSafety");
54632
54934
  async function isShellCommandReadOnlyAST(command) {
54633
54935
  if (typeof command !== "string" || !command.trim()) return false;
54634
54936
  if (parserInitFailed) {
@@ -54981,7 +55283,16 @@ var PermissionManager = class _PermissionManager {
54981
55283
  * to match equivalent shell commands (e.g. `cat` → Read, `curl` → WebFetch).
54982
55284
  */
54983
55285
  evaluateSingle(ctx) {
54984
- const { toolName, command, cwd, filePath, domain, specifier, toolParams } = ctx;
55286
+ const {
55287
+ toolName,
55288
+ toolAliases: toolAliases2,
55289
+ command,
55290
+ cwd,
55291
+ filePath,
55292
+ domain,
55293
+ specifier,
55294
+ toolParams
55295
+ } = ctx;
54985
55296
  const pathCtx = this.config.getProjectRoot && this.config.getCwd ? {
54986
55297
  projectRoot: this.config.getProjectRoot(),
54987
55298
  cwd: cwd ?? this.config.getCwd()
@@ -54993,7 +55304,8 @@ var PermissionManager = class _PermissionManager {
54993
55304
  domain,
54994
55305
  pathCtx,
54995
55306
  specifier,
54996
- toolParams
55307
+ toolParams,
55308
+ toolAliases2
54997
55309
  ];
54998
55310
  const baseDecision = (() => {
54999
55311
  for (const rule of [
@@ -55224,7 +55536,16 @@ var PermissionManager = class _PermissionManager {
55224
55536
  */
55225
55537
  findMatchingDenyRule(ctx) {
55226
55538
  ctx = this.normalizePermissionContext(ctx);
55227
- const { toolName, command, cwd, filePath, domain, specifier, toolParams } = ctx;
55539
+ const {
55540
+ toolName,
55541
+ toolAliases: toolAliases2,
55542
+ command,
55543
+ cwd,
55544
+ filePath,
55545
+ domain,
55546
+ specifier,
55547
+ toolParams
55548
+ } = ctx;
55228
55549
  const pathCtx = this.config.getProjectRoot && this.config.getCwd ? {
55229
55550
  projectRoot: this.config.getProjectRoot(),
55230
55551
  cwd: cwd ?? this.config.getCwd()
@@ -55236,7 +55557,8 @@ var PermissionManager = class _PermissionManager {
55236
55557
  domain,
55237
55558
  pathCtx,
55238
55559
  specifier,
55239
- toolParams
55560
+ toolParams,
55561
+ toolAliases2
55240
55562
  ];
55241
55563
  for (const rule of [
55242
55564
  ...this.sessionRules.deny,
@@ -55290,7 +55612,16 @@ var PermissionManager = class _PermissionManager {
55290
55612
  */
55291
55613
  hasRelevantRules(ctx) {
55292
55614
  ctx = this.normalizePermissionContext(ctx);
55293
- const { toolName, command, cwd, filePath, domain, specifier, toolParams } = ctx;
55615
+ const {
55616
+ toolName,
55617
+ toolAliases: toolAliases2,
55618
+ command,
55619
+ cwd,
55620
+ filePath,
55621
+ domain,
55622
+ specifier,
55623
+ toolParams
55624
+ } = ctx;
55294
55625
  const pathCtx = this.config.getProjectRoot && this.config.getCwd ? {
55295
55626
  projectRoot: this.config.getProjectRoot(),
55296
55627
  cwd: cwd ?? this.config.getCwd()
@@ -55321,7 +55652,13 @@ var PermissionManager = class _PermissionManager {
55321
55652
  void 0
55322
55653
  ];
55323
55654
  return restrictiveRules.some(
55324
- (rule) => matchesRule(rule, ...opMatchArgs, void 0, "canonical")
55655
+ (rule) => matchesRule(
55656
+ rule,
55657
+ ...opMatchArgs,
55658
+ void 0,
55659
+ void 0,
55660
+ "canonical"
55661
+ )
55325
55662
  ) || allowRules.some(
55326
55663
  (rule) => matchesRule(rule, ...opMatchArgs, void 0)
55327
55664
  );
@@ -55344,7 +55681,8 @@ var PermissionManager = class _PermissionManager {
55344
55681
  domain,
55345
55682
  pathCtx,
55346
55683
  specifier,
55347
- toolParams
55684
+ toolParams,
55685
+ toolAliases2
55348
55686
  ];
55349
55687
  return restrictiveRules.some(
55350
55688
  (rule) => matchesRule(rule, ...matchArgs, "canonical")
@@ -55361,7 +55699,16 @@ var PermissionManager = class _PermissionManager {
55361
55699
  */
55362
55700
  hasMatchingAskRule(ctx) {
55363
55701
  ctx = this.normalizePermissionContext(ctx);
55364
- const { toolName, command, cwd, filePath, domain, specifier, toolParams } = ctx;
55702
+ const {
55703
+ toolName,
55704
+ toolAliases: toolAliases2,
55705
+ command,
55706
+ cwd,
55707
+ filePath,
55708
+ domain,
55709
+ specifier,
55710
+ toolParams
55711
+ } = ctx;
55365
55712
  const pathCtx = this.config.getProjectRoot && this.config.getCwd ? {
55366
55713
  projectRoot: this.config.getProjectRoot(),
55367
55714
  cwd: cwd ?? this.config.getCwd()
@@ -55383,7 +55730,13 @@ var PermissionManager = class _PermissionManager {
55383
55730
  void 0
55384
55731
  ];
55385
55732
  return askRules.some(
55386
- (rule) => matchesRule(rule, ...opMatchArgs, void 0, "canonical")
55733
+ (rule) => matchesRule(
55734
+ rule,
55735
+ ...opMatchArgs,
55736
+ void 0,
55737
+ void 0,
55738
+ "canonical"
55739
+ )
55387
55740
  );
55388
55741
  })) {
55389
55742
  return true;
@@ -55404,7 +55757,8 @@ var PermissionManager = class _PermissionManager {
55404
55757
  domain,
55405
55758
  pathCtx,
55406
55759
  specifier,
55407
- toolParams
55760
+ toolParams,
55761
+ toolAliases2
55408
55762
  ];
55409
55763
  return askRules.some(
55410
55764
  (rule) => matchesRule(rule, ...matchArgs, "canonical")
@@ -58253,7 +58607,7 @@ init_esbuild_shims();
58253
58607
  // packages/core/src/core/permission-helpers.ts
58254
58608
  init_esbuild_shims();
58255
58609
  import * as path18 from "node:path";
58256
- function buildPermissionCheckContext(toolName, toolParams, targetDir) {
58610
+ function buildPermissionCheckContext(toolName, toolParams, targetDir, toolAliases2) {
58257
58611
  const rawCommand = "command" in toolParams ? String(toolParams["command"]) : void 0;
58258
58612
  const command = rawCommand;
58259
58613
  const cwd = typeof toolParams["directory"] === "string" ? path18.isAbsolute(toolParams["directory"]) ? toolParams["directory"] : path18.resolve(targetDir, toolParams["directory"]) : void 0;
@@ -58272,7 +58626,16 @@ function buildPermissionCheckContext(toolName, toolParams, targetDir) {
58272
58626
  }
58273
58627
  }
58274
58628
  const specifier = typeof toolParams["skill"] === "string" ? toolParams["skill"] : typeof toolParams["subagent_type"] === "string" ? toolParams["subagent_type"] : typeof toolParams["server_name"] === "string" ? toolParams["server_name"] : void 0;
58275
- return { toolName, command, cwd, filePath, domain, specifier, toolParams };
58629
+ return {
58630
+ toolName,
58631
+ toolAliases: toolAliases2,
58632
+ command,
58633
+ cwd,
58634
+ filePath,
58635
+ domain,
58636
+ specifier,
58637
+ toolParams
58638
+ };
58276
58639
  }
58277
58640
  __name(buildPermissionCheckContext, "buildPermissionCheckContext");
58278
58641
  async function evaluatePermissionRules(pm, defaultPermission, pmCtx) {
@@ -58324,7 +58687,8 @@ async function evaluatePermissionFlow(config, invocation, toolName, toolParams)
58324
58687
  const pmCtx = buildPermissionCheckContext(
58325
58688
  toolName,
58326
58689
  toolParams,
58327
- config.getTargetDir?.() ?? ""
58690
+ config.getTargetDir?.() ?? "",
58691
+ invocation.permissionAliases
58328
58692
  );
58329
58693
  const { finalPermission, pmForcedAsk } = await evaluatePermissionRules(
58330
58694
  pm,
@@ -58382,6 +58746,190 @@ function isAutoEditApproved(approvalMode, confirmationDetails) {
58382
58746
  }
58383
58747
  __name(isAutoEditApproved, "isAutoEditApproved");
58384
58748
 
58749
+ // packages/core/src/core/plan-mode-shell-policy.ts
58750
+ init_esbuild_shims();
58751
+ import { isDeepStrictEqual } from "node:util";
58752
+ var UNKNOWN_WARNING = "Plan mode could not determine whether this shell command is read-only. Approval applies only to this exact invocation once; it may modify system state, and Plan mode will remain active.";
58753
+ var WRITE_BLOCK_MESSAGE = "Plan mode blocked this shell command because it was classified as state-modifying. Do not retry it through wrappers or obfuscation; continue read-only investigation and include the action in the plan.";
58754
+ var NO_APPROVAL_MESSAGE = "Plan mode could not determine whether this shell command is read-only, and no approval surface is available. The command was not run; Plan mode remains active.";
58755
+ var STALE_APPROVAL_MESSAGE = "Plan-mode shell approval is no longer valid because the mode, permission policy, or exact invocation changed. Submit a new tool call.";
58756
+ function isApplicable(decision) {
58757
+ return decision.classification !== "not-applicable";
58758
+ }
58759
+ __name(isApplicable, "isApplicable");
58760
+ function clone(value) {
58761
+ return structuredClone(value);
58762
+ }
58763
+ __name(clone, "clone");
58764
+ function abortError(signal) {
58765
+ return signal.reason instanceof Error ? signal.reason : new Error("Plan-mode shell policy evaluation was aborted.");
58766
+ }
58767
+ __name(abortError, "abortError");
58768
+ function raceWithAbort(operation, signal) {
58769
+ if (signal.aborted) {
58770
+ return Promise.reject(abortError(signal));
58771
+ }
58772
+ return new Promise((resolve38, reject) => {
58773
+ let settled = false;
58774
+ const finish = /* @__PURE__ */ __name((callback) => {
58775
+ if (settled) return;
58776
+ settled = true;
58777
+ signal.removeEventListener("abort", onAbort);
58778
+ callback();
58779
+ }, "finish");
58780
+ const onAbort = /* @__PURE__ */ __name(() => finish(() => reject(abortError(signal))), "onAbort");
58781
+ signal.addEventListener("abort", onAbort, { once: true });
58782
+ let pending;
58783
+ try {
58784
+ pending = operation();
58785
+ } catch (error) {
58786
+ finish(() => reject(error));
58787
+ return;
58788
+ }
58789
+ pending.then(
58790
+ (value) => finish(() => resolve38(value)),
58791
+ (error) => finish(() => reject(error))
58792
+ );
58793
+ });
58794
+ }
58795
+ __name(raceWithAbort, "raceWithAbort");
58796
+ function appendUnique(values, value) {
58797
+ return values?.includes(value) ? values : [...values ?? [], value];
58798
+ }
58799
+ __name(appendUnique, "appendUnique");
58800
+ function effectiveWorkingDirectory(config, invocationParams) {
58801
+ const directory = invocationParams["directory"];
58802
+ return typeof directory === "string" && directory.length > 0 ? directory : config.getTargetDir();
58803
+ }
58804
+ __name(effectiveWorkingDirectory, "effectiveWorkingDirectory");
58805
+ async function evaluatePlanModeShellPolicy(input) {
58806
+ if (input.toolName !== ToolNames.SHELL && input.toolName !== ToolNames.MONITOR) {
58807
+ return { classification: "not-applicable" };
58808
+ }
58809
+ if (input.config.getApprovalMode() !== "plan" /* PLAN */) {
58810
+ return { classification: "not-applicable" };
58811
+ }
58812
+ const rawCommand = typeof input.invocationParams["command"] === "string" ? input.invocationParams["command"] : "";
58813
+ const safetyCommand = input.toolName === ToolNames.MONITOR ? normalizeMonitorCommand(rawCommand).safetyCommand : rawCommand;
58814
+ const permissionContext = clone(input.permissionContext);
58815
+ permissionContext.cwd = effectiveWorkingDirectory(
58816
+ input.config,
58817
+ input.invocationParams
58818
+ );
58819
+ permissionContext.toolParams = clone(input.invocationParams);
58820
+ const invocationDirectory = input.invocationParams["directory"];
58821
+ const ambientWorkingDirectory = input.ambientWorkingDirectory ?? (typeof invocationDirectory !== "string" || invocationDirectory.length === 0 ? input.config.getTargetDir() : void 0);
58822
+ const snapshot = {
58823
+ requestArgs: clone(input.requestArgs),
58824
+ invocationParams: clone(input.invocationParams),
58825
+ approvalModeRevision: input.config.getApprovalModeRevision(),
58826
+ permissionContext,
58827
+ ambientWorkingDirectory
58828
+ };
58829
+ let classification;
58830
+ try {
58831
+ classification = await raceWithAbort(
58832
+ () => classifyShellCommandSafety(safetyCommand),
58833
+ input.signal
58834
+ );
58835
+ } catch (error) {
58836
+ if (input.signal.aborted) throw error;
58837
+ classification = "unknown";
58838
+ }
58839
+ return {
58840
+ classification,
58841
+ rawCommand,
58842
+ snapshot,
58843
+ writeBlockMessage: WRITE_BLOCK_MESSAGE,
58844
+ noApprovalMessage: NO_APPROVAL_MESSAGE
58845
+ };
58846
+ }
58847
+ __name(evaluatePlanModeShellPolicy, "evaluatePlanModeShellPolicy");
58848
+ async function validatePlanModeShellContext(input) {
58849
+ if (!isApplicable(input.decision)) return void 0;
58850
+ const decision = input.decision;
58851
+ if (input.signal.aborted) throw abortError(input.signal);
58852
+ const matchesSnapshot = /* @__PURE__ */ __name(() => !input.signal.aborted && input.config.getApprovalMode() === "plan" /* PLAN */ && input.config.getApprovalModeRevision() === decision.snapshot.approvalModeRevision && (decision.snapshot.ambientWorkingDirectory === void 0 || input.config.getTargetDir() === decision.snapshot.ambientWorkingDirectory) && effectiveWorkingDirectory(input.config, input.invocationParams) === decision.snapshot.permissionContext.cwd && isDeepStrictEqual(input.requestArgs, decision.snapshot.requestArgs) && isDeepStrictEqual(
58853
+ input.invocationParams,
58854
+ decision.snapshot.invocationParams
58855
+ ), "matchesSnapshot");
58856
+ if (!matchesSnapshot()) return STALE_APPROVAL_MESSAGE;
58857
+ const permissionManager = input.config.getPermissionManager?.();
58858
+ if (permissionManager) {
58859
+ try {
58860
+ const currentPermission = await raceWithAbort(
58861
+ () => permissionManager.evaluate(
58862
+ clone(decision.snapshot.permissionContext)
58863
+ ),
58864
+ input.signal
58865
+ );
58866
+ if (currentPermission === "deny") return STALE_APPROVAL_MESSAGE;
58867
+ } catch {
58868
+ if (input.signal.aborted) throw abortError(input.signal);
58869
+ return STALE_APPROVAL_MESSAGE;
58870
+ }
58871
+ }
58872
+ if (input.signal.aborted) throw abortError(input.signal);
58873
+ return matchesSnapshot() ? void 0 : STALE_APPROVAL_MESSAGE;
58874
+ }
58875
+ __name(validatePlanModeShellContext, "validatePlanModeShellContext");
58876
+ function decoratePlanModeShellConfirmation(decision, confirmation) {
58877
+ if (!isApplicable(decision)) return confirmation;
58878
+ if (confirmation.type === "ask_user_question") {
58879
+ throw new Error(decision.noApprovalMessage);
58880
+ }
58881
+ if (decision.classification !== "unknown") {
58882
+ return { ...confirmation, hideAlwaysAllow: true };
58883
+ }
58884
+ if (confirmation.type === "exec") {
58885
+ return {
58886
+ ...confirmation,
58887
+ hideAlwaysAllow: true,
58888
+ warnings: appendUnique(confirmation.warnings, UNKNOWN_WARNING)
58889
+ };
58890
+ }
58891
+ if (confirmation.type === "edit") {
58892
+ const warnings = appendUnique(confirmation.warnings, UNKNOWN_WARNING);
58893
+ return {
58894
+ ...confirmation,
58895
+ hideAlwaysAllow: true,
58896
+ hideModify: true,
58897
+ skipIdeDiff: true,
58898
+ warnings: appendUnique(
58899
+ warnings,
58900
+ `Exact shell command: \`${decision.rawCommand}\``
58901
+ )
58902
+ };
58903
+ }
58904
+ throw new Error(decision.noApprovalMessage);
58905
+ }
58906
+ __name(decoratePlanModeShellConfirmation, "decoratePlanModeShellConfirmation");
58907
+ async function validatePlanModeShellApproval(input) {
58908
+ if (!isApplicable(input.decision)) {
58909
+ return { outcome: input.outcome, payload: input.payload };
58910
+ }
58911
+ if (input.outcome === "cancel" /* Cancel */) {
58912
+ return {
58913
+ outcome: "cancel" /* Cancel */,
58914
+ ...input.payload?.cancelMessage ? { payload: { cancelMessage: input.payload.cancelMessage } } : {}
58915
+ };
58916
+ }
58917
+ const invalidContext = await validatePlanModeShellContext(input);
58918
+ const invalidOutcome = input.outcome !== "proceed_once" /* ProceedOnce */;
58919
+ const invalidPayload = input.payload?.newContent !== void 0 || input.payload?.updatedInput !== void 0 && !isDeepStrictEqual(
58920
+ input.payload.updatedInput,
58921
+ input.decision.snapshot.requestArgs
58922
+ );
58923
+ if (invalidContext || invalidOutcome || invalidPayload) {
58924
+ return {
58925
+ outcome: "cancel" /* Cancel */,
58926
+ payload: { cancelMessage: STALE_APPROVAL_MESSAGE }
58927
+ };
58928
+ }
58929
+ return { outcome: "proceed_once" /* ProceedOnce */ };
58930
+ }
58931
+ __name(validatePlanModeShellApproval, "validatePlanModeShellApproval");
58932
+
58385
58933
  // packages/core/src/core/geminiRequest.ts
58386
58934
  init_esbuild_shims();
58387
58935
  function partListUnionToString(value) {
@@ -65642,7 +66190,7 @@ var HybridTokenStorage = class extends BaseTokenStorage {
65642
66190
  const forceFileStorage = process.env[FORCE_FILE_STORAGE_ENV_VAR] === "true";
65643
66191
  if (!forceFileStorage) {
65644
66192
  try {
65645
- const { KeychainTokenStorage: KeychainTokenStorage2 } = await import("./keychain-token-storage-K23CFKGN.js");
66193
+ const { KeychainTokenStorage: KeychainTokenStorage2 } = await import("./keychain-token-storage-DWRJMNH3.js");
65646
66194
  const keychainStorage = new KeychainTokenStorage2(this.serviceName);
65647
66195
  const isAvailable = await keychainStorage.isAvailable();
65648
66196
  if (isAvailable) {
@@ -70842,15 +71390,28 @@ var ToolRegistry = class _ToolRegistry {
70842
71390
  * built-ins and MCP-discovered tools flow through `registerTool`, so
70843
71391
  * gating here covers every registration path.
70844
71392
  */
70845
- isToolDisabled(name) {
70846
- return this.config.getDisabledTools().has(name);
71393
+ isToolDisabled(name, aliases = []) {
71394
+ const disabledTools = this.config.getDisabledTools();
71395
+ const hasExactMatch = disabledTools.has(name) || aliases.some((alias) => disabledTools.has(alias));
71396
+ if (hasExactMatch || !name.startsWith("mcp__")) {
71397
+ return hasExactMatch;
71398
+ }
71399
+ for (const disabledName of disabledTools) {
71400
+ if (normalizeMcpToolName(disabledName) === name) {
71401
+ return true;
71402
+ }
71403
+ }
71404
+ return false;
70847
71405
  }
70848
71406
  /**
70849
71407
  * Registers a tool definition.
70850
71408
  * @param tool - The tool object containing schema and execution logic.
70851
71409
  */
70852
71410
  registerTool(tool) {
70853
- if (this.isToolDisabled(tool.name)) {
71411
+ if (this.isToolDisabled(
71412
+ tool.name,
71413
+ tool instanceof DiscoveredMCPTool ? tool.permissionAliases : []
71414
+ )) {
70854
71415
  debugLogger39.info(
70855
71416
  `Tool "${tool.name}" skipped: present in disabledTools set.`
70856
71417
  );
@@ -70867,7 +71428,10 @@ var ToolRegistry = class _ToolRegistry {
70867
71428
  );
70868
71429
  }
70869
71430
  }
70870
- if (this.isToolDisabled(tool.name)) {
71431
+ if (this.isToolDisabled(
71432
+ tool.name,
71433
+ tool instanceof DiscoveredMCPTool ? tool.permissionAliases : []
71434
+ )) {
70871
71435
  debugLogger39.info(
70872
71436
  `Tool "${tool.name}" skipped (post-rename): present in disabledTools set.`
70873
71437
  );
@@ -75064,6 +75628,12 @@ var TOKEN_PLAN_MODELS = [
75064
75628
  modalities: { image: true, video: true }
75065
75629
  },
75066
75630
  { id: "qwen3.7-max", contextWindowSize: 1e6, enableThinking: true },
75631
+ {
75632
+ id: "qwen3.8-max-preview",
75633
+ contextWindowSize: 1e6,
75634
+ enableThinking: true,
75635
+ modalities: { image: true, video: true }
75636
+ },
75067
75637
  {
75068
75638
  id: "qwen3.6-flash",
75069
75639
  contextWindowSize: 1e6,
@@ -89156,8 +89726,8 @@ var GitWorktreeService = class _GitWorktreeService {
89156
89726
  async getRegisteredWorktreeBranch(worktreePath) {
89157
89727
  let resolvedWorktreePath;
89158
89728
  try {
89159
- const stat19 = await fs25.stat(worktreePath);
89160
- if (!stat19.isDirectory()) return null;
89729
+ const stat20 = await fs25.stat(worktreePath);
89730
+ if (!stat20.isDirectory()) return null;
89161
89731
  resolvedWorktreePath = await fs25.realpath(worktreePath);
89162
89732
  } catch {
89163
89733
  return null;
@@ -89996,6 +90566,387 @@ function takeRecentDialog2(history, windowSize) {
89996
90566
  }
89997
90567
  __name(takeRecentDialog2, "takeRecentDialog");
89998
90568
 
90569
+ // packages/core/src/utils/conversation-chain.ts
90570
+ init_esbuild_shims();
90571
+ function buildOrderedUuidChain(records, opts) {
90572
+ if (records.length === 0) return { uuids: [], gaps: [] };
90573
+ const detectGaps = opts?.detectGaps ?? false;
90574
+ const transcriptRecords = records;
90575
+ const firstByUuid = /* @__PURE__ */ new Map();
90576
+ for (const r2 of records) {
90577
+ if (isTranscriptConversationRecord(r2) && !firstByUuid.has(r2.uuid)) {
90578
+ firstByUuid.set(r2.uuid, r2);
90579
+ }
90580
+ }
90581
+ const startUuid = selectTranscriptLeaf(transcriptRecords, opts?.leafUuid);
90582
+ if (!startUuid) return { uuids: [], gaps: [] };
90583
+ const chain = walkTranscriptUuidChain(
90584
+ startUuid,
90585
+ (uuid) => firstByUuid.get(uuid)
90586
+ );
90587
+ return {
90588
+ uuids: [...chain.uuids],
90589
+ gaps: detectGaps ? [...chain.gaps] : []
90590
+ };
90591
+ }
90592
+ __name(buildOrderedUuidChain, "buildOrderedUuidChain");
90593
+
90594
+ // packages/core/src/utils/conversation-branches.ts
90595
+ init_esbuild_shims();
90596
+ var SUMMARY_TEXT_LIMIT = 200;
90597
+ var SYNTHETIC_USER_SUBTYPES = /* @__PURE__ */ new Set([
90598
+ "notification",
90599
+ "cron",
90600
+ "mid_turn_user_message"
90601
+ ]);
90602
+ var NEUTRAL_TAIL_SUBTYPES = /* @__PURE__ */ new Set([
90603
+ "custom_title",
90604
+ "session_artifact_event",
90605
+ "session_artifact_snapshot"
90606
+ ]);
90607
+ function inspectConversationBranches(records) {
90608
+ if (records.length === 0) return { branches: [], diagnostics: [] };
90609
+ const index = buildConversationIndex(records);
90610
+ const semanticLeaves = findSemanticLeaves(index);
90611
+ const leafCountByAncestor = countLeafDescendants(
90612
+ semanticLeaves.map(({ leafUuid }) => leafUuid),
90613
+ index.firstByUuid
90614
+ );
90615
+ const rewindUuids = [...index.firstByUuid.values()].filter(isRewindRecord).map((record2) => record2.uuid);
90616
+ const forestPositions = indexForest(index);
90617
+ const branches = semanticLeaves.map(
90618
+ ({ leafUuid, physicalLeafUuid }) => summarizeBranch(
90619
+ leafUuid,
90620
+ physicalLeafUuid,
90621
+ leafCountByAncestor,
90622
+ rewindUuids,
90623
+ forestPositions,
90624
+ index
90625
+ )
90626
+ );
90627
+ return { branches, diagnostics: index.diagnostics };
90628
+ }
90629
+ __name(inspectConversationBranches, "inspectConversationBranches");
90630
+ function indexForest(index) {
90631
+ const positions = /* @__PURE__ */ new Map();
90632
+ let clock = 0;
90633
+ for (const [uuid, record2] of index.firstByUuid) {
90634
+ if (record2.parentUuid !== null && index.firstByUuid.has(record2.parentUuid)) {
90635
+ continue;
90636
+ }
90637
+ const stack = [
90638
+ { uuid, exiting: false }
90639
+ ];
90640
+ while (stack.length > 0) {
90641
+ const frame = stack.pop();
90642
+ if (frame.exiting) {
90643
+ const position = positions.get(frame.uuid);
90644
+ if (position) position.exitedAt = clock++;
90645
+ continue;
90646
+ }
90647
+ if (positions.has(frame.uuid)) continue;
90648
+ positions.set(frame.uuid, {
90649
+ rootUuid: uuid,
90650
+ enteredAt: clock++,
90651
+ exitedAt: -1
90652
+ });
90653
+ stack.push({ uuid: frame.uuid, exiting: true });
90654
+ const children = index.childrenByUuid.get(frame.uuid) ?? [];
90655
+ for (let childIndex = children.length - 1; childIndex >= 0; childIndex--) {
90656
+ stack.push({ uuid: children[childIndex], exiting: false });
90657
+ }
90658
+ }
90659
+ }
90660
+ return positions;
90661
+ }
90662
+ __name(indexForest, "indexForest");
90663
+ function buildConversationIndex(records) {
90664
+ const firstByUuid = /* @__PURE__ */ new Map();
90665
+ const recordsByUuid = /* @__PURE__ */ new Map();
90666
+ const physicalIndexByUuid = /* @__PURE__ */ new Map();
90667
+ for (const [physicalIndex, record2] of records.entries()) {
90668
+ const grouped = recordsByUuid.get(record2.uuid);
90669
+ if (grouped) {
90670
+ grouped.push(record2);
90671
+ } else {
90672
+ firstByUuid.set(record2.uuid, record2);
90673
+ recordsByUuid.set(record2.uuid, [record2]);
90674
+ physicalIndexByUuid.set(record2.uuid, physicalIndex);
90675
+ }
90676
+ }
90677
+ const diagnostics = [];
90678
+ const childrenByUuid = /* @__PURE__ */ new Map();
90679
+ for (const [uuid, grouped] of recordsByUuid) {
90680
+ const parentUuids = [
90681
+ ...new Set(grouped.map((record2) => record2.parentUuid))
90682
+ ];
90683
+ if (parentUuids.length > 1) {
90684
+ diagnostics.push({ kind: "conflicting-parent", uuid, parentUuids });
90685
+ }
90686
+ const parentUuid = firstByUuid.get(uuid)?.parentUuid;
90687
+ if (parentUuid === void 0 || parentUuid === null) continue;
90688
+ if (!firstByUuid.has(parentUuid)) {
90689
+ diagnostics.push({
90690
+ kind: "missing-parent",
90691
+ childUuid: uuid,
90692
+ missingParentUuid: parentUuid
90693
+ });
90694
+ continue;
90695
+ }
90696
+ const children = childrenByUuid.get(parentUuid);
90697
+ if (children) {
90698
+ children.push(uuid);
90699
+ } else {
90700
+ childrenByUuid.set(parentUuid, [uuid]);
90701
+ }
90702
+ }
90703
+ diagnostics.push(...findParentCycles(firstByUuid));
90704
+ return {
90705
+ firstByUuid,
90706
+ recordsByUuid,
90707
+ childrenByUuid,
90708
+ physicalIndexByUuid,
90709
+ diagnostics
90710
+ };
90711
+ }
90712
+ __name(buildConversationIndex, "buildConversationIndex");
90713
+ function findParentCycles(firstByUuid) {
90714
+ const complete = /* @__PURE__ */ new Set();
90715
+ const diagnostics = [];
90716
+ for (const startUuid of firstByUuid.keys()) {
90717
+ if (complete.has(startUuid)) continue;
90718
+ const path99 = [];
90719
+ const positionByUuid = /* @__PURE__ */ new Map();
90720
+ let currentUuid = startUuid;
90721
+ while (currentUuid !== null && firstByUuid.has(currentUuid)) {
90722
+ if (complete.has(currentUuid)) break;
90723
+ const existingPosition = positionByUuid.get(currentUuid);
90724
+ if (existingPosition !== void 0) {
90725
+ diagnostics.push({
90726
+ kind: "parent-cycle",
90727
+ uuids: path99.slice(existingPosition)
90728
+ });
90729
+ break;
90730
+ }
90731
+ positionByUuid.set(currentUuid, path99.length);
90732
+ path99.push(currentUuid);
90733
+ currentUuid = firstByUuid.get(currentUuid)?.parentUuid ?? null;
90734
+ }
90735
+ for (const uuid of path99) complete.add(uuid);
90736
+ }
90737
+ return diagnostics;
90738
+ }
90739
+ __name(findParentCycles, "findParentCycles");
90740
+ function findSemanticLeaves(index) {
90741
+ const candidates = /* @__PURE__ */ new Set();
90742
+ const physicalLeafBySemanticLeaf = /* @__PURE__ */ new Map();
90743
+ for (const uuid of index.firstByUuid.keys()) {
90744
+ if ((index.childrenByUuid.get(uuid)?.length ?? 0) > 0) continue;
90745
+ const leafUuid = collapseNeutralTail(uuid, index.firstByUuid);
90746
+ if (leafUuid === null) continue;
90747
+ candidates.add(leafUuid);
90748
+ physicalLeafBySemanticLeaf.set(leafUuid, uuid);
90749
+ }
90750
+ const superseded = /* @__PURE__ */ new Set();
90751
+ for (const candidate of candidates) {
90752
+ const visited = /* @__PURE__ */ new Set();
90753
+ let currentUuid = index.firstByUuid.get(candidate)?.parentUuid ?? null;
90754
+ while (currentUuid !== null && index.firstByUuid.has(currentUuid) && !visited.has(currentUuid)) {
90755
+ if (candidates.has(currentUuid)) superseded.add(currentUuid);
90756
+ visited.add(currentUuid);
90757
+ currentUuid = index.firstByUuid.get(currentUuid)?.parentUuid ?? null;
90758
+ }
90759
+ }
90760
+ const leaves = [...candidates].filter(
90761
+ (candidate) => !superseded.has(candidate)
90762
+ );
90763
+ return leaves.sort((left, right) => {
90764
+ const leftPhysicalLeaf = physicalLeafBySemanticLeaf.get(left);
90765
+ const rightPhysicalLeaf = physicalLeafBySemanticLeaf.get(right);
90766
+ return index.physicalIndexByUuid.get(leftPhysicalLeaf) - index.physicalIndexByUuid.get(rightPhysicalLeaf);
90767
+ }).map((leafUuid) => ({
90768
+ leafUuid,
90769
+ physicalLeafUuid: physicalLeafBySemanticLeaf.get(leafUuid)
90770
+ }));
90771
+ }
90772
+ __name(findSemanticLeaves, "findSemanticLeaves");
90773
+ function countLeafDescendants(semanticLeaves, firstByUuid) {
90774
+ const counts = /* @__PURE__ */ new Map();
90775
+ for (const leafUuid of semanticLeaves) {
90776
+ for (const uuid of buildChain(leafUuid, firstByUuid)) {
90777
+ counts.set(uuid, (counts.get(uuid) ?? 0) + 1);
90778
+ }
90779
+ }
90780
+ return counts;
90781
+ }
90782
+ __name(countLeafDescendants, "countLeafDescendants");
90783
+ function collapseNeutralTail(leafUuid, firstByUuid) {
90784
+ const visited = /* @__PURE__ */ new Set();
90785
+ let currentUuid = leafUuid;
90786
+ while (!visited.has(currentUuid)) {
90787
+ visited.add(currentUuid);
90788
+ const record2 = firstByUuid.get(currentUuid);
90789
+ if (!record2) return null;
90790
+ if (!isNeutralTailRecord(record2)) return currentUuid;
90791
+ const parentUuid = record2.parentUuid;
90792
+ if (parentUuid === null || !firstByUuid.has(parentUuid)) return null;
90793
+ currentUuid = parentUuid;
90794
+ }
90795
+ return null;
90796
+ }
90797
+ __name(collapseNeutralTail, "collapseNeutralTail");
90798
+ function summarizeBranch(leafUuid, physicalLeafUuid, leafCountByAncestor, rewindUuids, forestPositions, index) {
90799
+ const chain = buildChain(leafUuid, index.firstByUuid);
90800
+ const chainSet = new Set(chain);
90801
+ const branchPointUuid = findBranchPoint(chain, leafCountByAncestor);
90802
+ const containsRewindUuids = chain.filter(
90803
+ (uuid) => isRewindRecord(index.firstByUuid.get(uuid))
90804
+ );
90805
+ const siblingRewindUuids = rewindUuids.filter(
90806
+ (rewindUuid) => !chainSet.has(rewindUuid) && isSiblingPath(
90807
+ leafUuid,
90808
+ chain,
90809
+ rewindUuid,
90810
+ forestPositions,
90811
+ index.firstByUuid
90812
+ )
90813
+ );
90814
+ const firstRecord = index.firstByUuid.get(chain[0]);
90815
+ const physicalLeafRecord = index.firstByUuid.get(physicalLeafUuid);
90816
+ const recordCounts = { user: 0, assistant: 0, toolResult: 0, system: 0 };
90817
+ for (const uuid of chain) {
90818
+ const record2 = index.firstByUuid.get(uuid);
90819
+ if (record2.type === "tool_result") {
90820
+ recordCounts.toolResult++;
90821
+ } else {
90822
+ recordCounts[record2.type]++;
90823
+ }
90824
+ }
90825
+ const firstDistinctIndex = branchPointUuid ? chain.indexOf(branchPointUuid) + 1 : 0;
90826
+ const firstUserTextAfterBranchPoint = findUserText(
90827
+ chain.slice(firstDistinctIndex),
90828
+ index
90829
+ );
90830
+ const lastUserText = findUserText([...chain].reverse(), index);
90831
+ const lastAssistantText = findAssistantText([...chain].reverse(), index);
90832
+ return {
90833
+ leafUuid,
90834
+ branchPointUuid,
90835
+ classification: classifyBranch(
90836
+ containsRewindUuids.length > 0,
90837
+ siblingRewindUuids.length > 0
90838
+ ),
90839
+ containsRewindUuids,
90840
+ siblingRewindUuids,
90841
+ ...firstUserTextAfterBranchPoint ? { firstUserTextAfterBranchPoint } : {},
90842
+ ...lastUserText ? { lastUserText } : {},
90843
+ ...lastAssistantText ? { lastAssistantText } : {},
90844
+ recordCounts,
90845
+ startedAt: firstRecord.timestamp,
90846
+ updatedAt: physicalLeafRecord.timestamp
90847
+ };
90848
+ }
90849
+ __name(summarizeBranch, "summarizeBranch");
90850
+ function findBranchPoint(chain, leafCountByAncestor) {
90851
+ for (let index = chain.length - 2; index >= 0; index--) {
90852
+ const candidate = chain[index];
90853
+ if (candidate && (leafCountByAncestor.get(candidate) ?? 0) > 1) {
90854
+ return candidate;
90855
+ }
90856
+ }
90857
+ return null;
90858
+ }
90859
+ __name(findBranchPoint, "findBranchPoint");
90860
+ function findUserText(uuids, index) {
90861
+ for (const uuid of uuids) {
90862
+ const record2 = index.firstByUuid.get(uuid);
90863
+ if (!record2 || record2.type !== "user" || isSyntheticUserRecord(record2)) {
90864
+ continue;
90865
+ }
90866
+ const text = extractText2(index.recordsByUuid.get(uuid) ?? [], "user");
90867
+ if (text) return text;
90868
+ }
90869
+ return void 0;
90870
+ }
90871
+ __name(findUserText, "findUserText");
90872
+ function findAssistantText(uuids, index) {
90873
+ for (const uuid of uuids) {
90874
+ if (index.firstByUuid.get(uuid)?.type !== "assistant") continue;
90875
+ const text = extractText2(index.recordsByUuid.get(uuid) ?? [], "assistant");
90876
+ if (text) return text;
90877
+ }
90878
+ return void 0;
90879
+ }
90880
+ __name(findAssistantText, "findAssistantText");
90881
+ function extractText2(records, type) {
90882
+ const text = records.filter(
90883
+ (record2) => record2.type === type && (type !== "user" || !isSyntheticUserRecord(record2))
90884
+ ).flatMap((record2) => record2.message?.parts ?? []).map((part) => {
90885
+ const textPart = part;
90886
+ return typeof textPart.text === "string" && textPart.thought !== true ? textPart.text : "";
90887
+ }).join(" ").replace(/\s+/g, " ").trim();
90888
+ if (!text) return void 0;
90889
+ return text.length > SUMMARY_TEXT_LIMIT ? `${text.slice(0, SUMMARY_TEXT_LIMIT)}...` : text;
90890
+ }
90891
+ __name(extractText2, "extractText");
90892
+ function buildChain(leafUuid, firstByUuid) {
90893
+ const chain = [];
90894
+ const visited = /* @__PURE__ */ new Set();
90895
+ let currentUuid = leafUuid;
90896
+ while (currentUuid !== null && firstByUuid.has(currentUuid) && !visited.has(currentUuid)) {
90897
+ visited.add(currentUuid);
90898
+ chain.push(currentUuid);
90899
+ currentUuid = firstByUuid.get(currentUuid)?.parentUuid ?? null;
90900
+ }
90901
+ chain.reverse();
90902
+ return chain;
90903
+ }
90904
+ __name(buildChain, "buildChain");
90905
+ function isSiblingPath(leafUuid, leafChain, rewindUuid, forestPositions, firstByUuid) {
90906
+ const leafPosition = forestPositions.get(leafUuid);
90907
+ const rewindPosition = forestPositions.get(rewindUuid);
90908
+ if (leafPosition && rewindPosition) {
90909
+ return leafPosition.rootUuid === rewindPosition.rootUuid && !isAncestorPosition(leafPosition, rewindPosition);
90910
+ }
90911
+ return pathsDiverge(leafChain, buildChain(rewindUuid, firstByUuid));
90912
+ }
90913
+ __name(isSiblingPath, "isSiblingPath");
90914
+ function isAncestorPosition(ancestor, descendant) {
90915
+ return ancestor.enteredAt <= descendant.enteredAt && ancestor.exitedAt >= descendant.exitedAt;
90916
+ }
90917
+ __name(isAncestorPosition, "isAncestorPosition");
90918
+ function pathsDiverge(left, right) {
90919
+ const rightPositions = new Map(right.map((uuid, index) => [uuid, index]));
90920
+ for (let leftIndex = left.length - 1; leftIndex >= 0; leftIndex--) {
90921
+ const uuid = left[leftIndex];
90922
+ if (!uuid) continue;
90923
+ const rightIndex = rightPositions.get(uuid);
90924
+ if (rightIndex === void 0) continue;
90925
+ return leftIndex < left.length - 1 && rightIndex < right.length - 1;
90926
+ }
90927
+ return false;
90928
+ }
90929
+ __name(pathsDiverge, "pathsDiverge");
90930
+ function isNeutralTailRecord(record2) {
90931
+ return record2.type === "system" && record2.subtype !== void 0 && NEUTRAL_TAIL_SUBTYPES.has(record2.subtype);
90932
+ }
90933
+ __name(isNeutralTailRecord, "isNeutralTailRecord");
90934
+ function isSyntheticUserRecord(record2) {
90935
+ return record2.externalInputKind === "notification" || record2.subtype !== void 0 && SYNTHETIC_USER_SUBTYPES.has(record2.subtype);
90936
+ }
90937
+ __name(isSyntheticUserRecord, "isSyntheticUserRecord");
90938
+ function isRewindRecord(record2) {
90939
+ return record2?.type === "system" && record2.subtype === "rewind";
90940
+ }
90941
+ __name(isRewindRecord, "isRewindRecord");
90942
+ function classifyBranch(containsRewind, hasSiblingRewind) {
90943
+ if (containsRewind && hasSiblingRewind) return "mixed-rewind";
90944
+ if (containsRewind) return "rewind-descendant";
90945
+ if (hasSiblingRewind) return "rewind-sibling";
90946
+ return "ordinary";
90947
+ }
90948
+ __name(classifyBranch, "classifyBranch");
90949
+
89999
90950
  // packages/core/src/services/worktreeSessionService.ts
90000
90951
  init_esbuild_shims();
90001
90952
  import * as fs26 from "node:fs/promises";
@@ -90259,8 +91210,8 @@ async function restoreWorktreeContext(sidecarPath, onWarn) {
90259
91210
  }
90260
91211
  let worktreeAlive = false;
90261
91212
  try {
90262
- const stat19 = await fs26.stat(session.worktreePath);
90263
- worktreeAlive = stat19.isDirectory();
91213
+ const stat20 = await fs26.stat(session.worktreePath);
91214
+ worktreeAlive = stat20.isDirectory();
90264
91215
  } catch {
90265
91216
  worktreeAlive = false;
90266
91217
  }
@@ -93051,10 +94002,10 @@ function readOutputTail(outputFile) {
93051
94002
  let fd;
93052
94003
  try {
93053
94004
  fd = fs28.openSync(outputFile, getReadOutputOpenFlags());
93054
- const stat19 = fs28.fstatSync(fd);
93055
- if (!stat19.isFile() || stat19.size <= 0) return void 0;
93056
- const length = Math.min(stat19.size, MAX_NOTIFICATION_OUTPUT_TAIL_BYTES);
93057
- const start = stat19.size - length;
94005
+ const stat20 = fs28.fstatSync(fd);
94006
+ if (!stat20.isFile() || stat20.size <= 0) return void 0;
94007
+ const length = Math.min(stat20.size, MAX_NOTIFICATION_OUTPUT_TAIL_BYTES);
94008
+ const start = stat20.size - length;
93058
94009
  const buffer = Buffer.allocUnsafe(length);
93059
94010
  const bytesRead = fs28.readSync(fd, buffer, 0, length, start);
93060
94011
  let sliceOffset = 0;
@@ -95318,6 +96269,32 @@ async function listChannelMemoryEntries(target) {
95318
96269
  return document.entries;
95319
96270
  }
95320
96271
  __name(listChannelMemoryEntries, "listChannelMemoryEntries");
96272
+ async function getFileRevision(filePath) {
96273
+ try {
96274
+ const stats = await fs32.stat(filePath, { bigint: true });
96275
+ return [
96276
+ stats.dev,
96277
+ stats.ino,
96278
+ stats.size,
96279
+ stats.mtimeNs,
96280
+ stats.ctimeNs
96281
+ ].join(":");
96282
+ } catch (error) {
96283
+ if (isMissingFile(error)) {
96284
+ return "missing";
96285
+ }
96286
+ throw error;
96287
+ }
96288
+ }
96289
+ __name(getFileRevision, "getFileRevision");
96290
+ async function getChannelMemoryRevision(target) {
96291
+ const [canonical, legacy] = await Promise.all([
96292
+ getFileRevision(getChannelMemoryFilePath(target)),
96293
+ getFileRevision(getLegacyChannelMemoryFilePath(target))
96294
+ ]);
96295
+ return createHash11("sha256").update(canonical).update("\0").update(legacy).digest("hex");
96296
+ }
96297
+ __name(getChannelMemoryRevision, "getChannelMemoryRevision");
95321
96298
  async function addChannelMemoryEntries(target, texts, createdBy) {
95322
96299
  const textSnapshot = Array.from(texts);
95323
96300
  if (textSnapshot.length > MAX_CHANNEL_MEMORY_ENTRIES_PER_REQUEST) {
@@ -97327,11 +98304,11 @@ var WorkspaceMemoryFileTooLargeError = class extends Error {
97327
98304
  async function composeAppendedContent(filePath, newContent) {
97328
98305
  let existing = "";
97329
98306
  try {
97330
- const stat19 = await fs39.stat(filePath);
97331
- if (stat19.size > MAX_EXISTING_FILE_BYTES) {
98307
+ const stat20 = await fs39.stat(filePath);
98308
+ if (stat20.size > MAX_EXISTING_FILE_BYTES) {
97332
98309
  throw new WorkspaceMemoryFileTooLargeError(
97333
98310
  filePath,
97334
- stat19.size,
98311
+ stat20.size,
97335
98312
  MAX_EXISTING_FILE_BYTES
97336
98313
  );
97337
98314
  }
@@ -98380,13 +99357,13 @@ var IdeClient = class _IdeClient {
98380
99357
  lockFiles.map(async (file) => {
98381
99358
  const fullPath = path47.join(ideDir, file);
98382
99359
  try {
98383
- const stat19 = await fs40.promises.stat(fullPath);
99360
+ const stat20 = await fs40.promises.stat(fullPath);
98384
99361
  const content = await fs40.promises.readFile(fullPath, "utf8");
98385
99362
  try {
98386
99363
  return {
98387
99364
  file,
98388
99365
  fullPath,
98389
- mtimeMs: stat19.mtimeMs,
99366
+ mtimeMs: stat20.mtimeMs,
98390
99367
  parsed: JSON.parse(content)
98391
99368
  };
98392
99369
  } catch (error) {
@@ -99922,7 +100899,7 @@ var LspResponseNormalizer = class {
99922
100899
  /**
99923
100900
  * Convert diagnostic back to LSP format for requests
99924
100901
  */
99925
- denormalizeDiagnostic(diagnostic) {
100902
+ denormalizeDiagnostic(diagnostic2) {
99926
100903
  const severityMap = {
99927
100904
  error: 1,
99928
100905
  warning: 2,
@@ -99930,11 +100907,11 @@ var LspResponseNormalizer = class {
99930
100907
  hint: 4
99931
100908
  };
99932
100909
  return {
99933
- range: diagnostic.range,
99934
- message: diagnostic.message,
99935
- severity: diagnostic.severity ? severityMap[diagnostic.severity] : void 0,
99936
- code: diagnostic.code,
99937
- source: diagnostic.source
100910
+ range: diagnostic2.range,
100911
+ message: diagnostic2.message,
100912
+ severity: diagnostic2.severity ? severityMap[diagnostic2.severity] : void 0,
100913
+ code: diagnostic2.code,
100914
+ source: diagnostic2.source
99938
100915
  };
99939
100916
  }
99940
100917
  /**
@@ -107832,8 +108809,8 @@ async function collectResources(resourcePaths, pluginRoot, destDir) {
107832
108809
  debugLogger75.warn(`Resource path not found: ${resolvedPath}`);
107833
108810
  continue;
107834
108811
  }
107835
- const stat19 = fs51.statSync(resolvedPath);
107836
- if (stat19.isDirectory()) {
108812
+ const stat20 = fs51.statSync(resolvedPath);
108813
+ if (stat20.isDirectory()) {
107837
108814
  const dirName = path56.basename(resolvedPath);
107838
108815
  const finalDestDir = dirName === destFolderName ? destDir : path56.join(destDir, dirName);
107839
108816
  const files = await glob("**/*", {
@@ -109425,7 +110402,7 @@ import * as path62 from "node:path";
109425
110402
  init_esbuild_shims();
109426
110403
  import * as fs57 from "node:fs";
109427
110404
  import * as path61 from "node:path";
109428
- import { stat as stat9 } from "node:fs/promises";
110405
+ import { stat as stat10 } from "node:fs/promises";
109429
110406
  var debugLogger79 = createDebugLogger("EXT_MARKETPLACE");
109430
110407
  function parseSourceAndPluginName(source) {
109431
110408
  const urlSchemes = ["http://", "https://", "git@", "sso://"];
@@ -109612,7 +110589,7 @@ async function loadMarketplaceConfigFromSource(source, networkPolicy) {
109612
110589
  const trimmed2 = source.trim();
109613
110590
  const lowerTrimmed = trimmed2.toLowerCase();
109614
110591
  try {
109615
- const stats = await stat9(trimmed2);
110592
+ const stats = await stat10(trimmed2);
109616
110593
  if (stats.isDirectory()) {
109617
110594
  return await readLocalMarketplaceConfig(trimmed2);
109618
110595
  }
@@ -109685,7 +110662,7 @@ async function parseInstallSource(source, options2 = {}) {
109685
110662
  let marketplaceConfig = null;
109686
110663
  let isLocalPath = false;
109687
110664
  try {
109688
- await stat9(repo);
110665
+ await stat10(repo);
109689
110666
  isLocalPath = true;
109690
110667
  } catch {
109691
110668
  }
@@ -115584,13 +116561,13 @@ import * as os20 from "os";
115584
116561
  // node_modules/chokidar/esm/index.js
115585
116562
  init_esbuild_shims();
115586
116563
  import { stat as statcb } from "fs";
115587
- import { stat as stat13, readdir as readdir11 } from "fs/promises";
116564
+ import { stat as stat14, readdir as readdir11 } from "fs/promises";
115588
116565
  import { EventEmitter as EventEmitter5 } from "events";
115589
116566
  import * as sysPath2 from "path";
115590
116567
 
115591
116568
  // node_modules/readdirp/esm/index.js
115592
116569
  init_esbuild_shims();
115593
- import { stat as stat11, lstat as lstat6, readdir as readdir10, realpath as realpath7 } from "node:fs/promises";
116570
+ import { stat as stat12, lstat as lstat6, readdir as readdir10, realpath as realpath7 } from "node:fs/promises";
115594
116571
  import { Readable } from "node:stream";
115595
116572
  import { resolve as presolve, relative as prelative, join as pjoin, sep as psep } from "node:path";
115596
116573
  var EntryTypes = {
@@ -115660,7 +116637,7 @@ var ReaddirpStream = class extends Readable {
115660
116637
  const { root, type } = opts;
115661
116638
  this._fileFilter = normalizeFilter(opts.fileFilter);
115662
116639
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
115663
- const statMethod = opts.lstat ? lstat6 : stat11;
116640
+ const statMethod = opts.lstat ? lstat6 : stat12;
115664
116641
  if (wantBigintFsStats) {
115665
116642
  this._stat = (path99) => statMethod(path99, { bigint: true });
115666
116643
  } else {
@@ -115815,7 +116792,7 @@ __name(readdirp, "readdirp");
115815
116792
  // node_modules/chokidar/esm/handler.js
115816
116793
  init_esbuild_shims();
115817
116794
  import { watchFile, unwatchFile, watch as fs_watch } from "fs";
115818
- import { open as open6, stat as stat12, lstat as lstat7, realpath as fsrealpath } from "fs/promises";
116795
+ import { open as open6, stat as stat13, lstat as lstat7, realpath as fsrealpath } from "fs/promises";
115819
116796
  import * as sysPath from "path";
115820
116797
  import { type as osType } from "os";
115821
116798
  var STR_DATA = "data";
@@ -115842,7 +116819,7 @@ var EVENTS = {
115842
116819
  };
115843
116820
  var EV = EVENTS;
115844
116821
  var THROTTLE_MODE_WATCH = "watch";
115845
- var statMethods = { lstat: lstat7, stat: stat12 };
116822
+ var statMethods = { lstat: lstat7, stat: stat13 };
115846
116823
  var KEY_LISTENERS = "listeners";
115847
116824
  var KEY_ERR = "errHandlers";
115848
116825
  var KEY_RAW = "rawEmitters";
@@ -116332,7 +117309,7 @@ var NodeFsHandler = class {
116332
117309
  return;
116333
117310
  if (!newStats || newStats.mtimeMs === 0) {
116334
117311
  try {
116335
- const newStats2 = await stat12(file);
117312
+ const newStats2 = await stat13(file);
116336
117313
  if (this.fsw.closed)
116337
117314
  return;
116338
117315
  const at2 = newStats2.atimeMs;
@@ -117045,7 +118022,7 @@ var FSWatcher = class extends EventEmitter5 {
117045
118022
  const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path99) : path99;
117046
118023
  let stats2;
117047
118024
  try {
117048
- stats2 = await stat13(fullPath);
118025
+ stats2 = await stat14(fullPath);
117049
118026
  } catch (err) {
117050
118027
  }
117051
118028
  if (!stats2 || this.closed)
@@ -117173,8 +118150,8 @@ var FSWatcher = class extends EventEmitter5 {
117173
118150
  }
117174
118151
  return this._userIgnored(path99, stats);
117175
118152
  }
117176
- _isntIgnored(path99, stat19) {
117177
- return !this._isIgnored(path99, stat19);
118153
+ _isntIgnored(path99, stat20) {
118154
+ return !this._isIgnored(path99, stat20);
117178
118155
  }
117179
118156
  /**
117180
118157
  * Provides a set of common helpers and properties relating to symlink handling.
@@ -118345,12 +119322,12 @@ __name(isWithin, "isWithin");
118345
119322
  async function readBoundedTaskFile(filePath) {
118346
119323
  const handle = await fs66.open(filePath, "r");
118347
119324
  try {
118348
- const stat19 = await handle.stat();
118349
- if (!stat19.isFile()) {
119325
+ const stat20 = await handle.stat();
119326
+ if (!stat20.isFile()) {
118350
119327
  return null;
118351
119328
  }
118352
119329
  const cap = LOOP_TASK_FILE_MAX_BYTES + 1;
118353
- const allocSize = Math.min(cap, stat19.size + 1);
119330
+ const allocSize = Math.min(cap, stat20.size + 1);
118354
119331
  const buffer = Buffer.alloc(allocSize);
118355
119332
  let total = 0;
118356
119333
  while (total < allocSize) {
@@ -123613,6 +124590,7 @@ ${_TeamManager.escapeEnvelopeTags(m2.text)}
123613
124590
  // fileDiff}`), which doesn't match what permission policies
123614
124591
  // expect to see (e.g. `{file_path, content}`).
123615
124592
  toolInput: event.args ?? {},
124593
+ confirmationDetails: event.confirmationDetails,
123616
124594
  respond: event.respond,
123617
124595
  timestamp: Date.now()
123618
124596
  };
@@ -123814,9 +124792,12 @@ var MAX_DESCRIPTION_LENGTH2 = 40;
123814
124792
  var MAX_RECENT_ACTIVITIES = 10;
123815
124793
  var DEFAULT_MAX_CONCURRENT_BACKGROUND_AGENTS = 10;
123816
124794
  var BACKGROUND_AGENT_CONCURRENCY_ENV = "QWEN_CODE_MAX_BACKGROUND_AGENTS";
123817
- function normalizeBackgroundApprovalOutcome(outcome) {
124795
+ function normalizeBackgroundApprovalOutcome(outcome, confirmationDetails) {
123818
124796
  if (outcome === "proceed_always" /* ProceedAlways */ || outcome === "proceed_always_project" /* ProceedAlwaysProject */ || outcome === "proceed_always_user" /* ProceedAlwaysUser */ || outcome === "proceed_always_server" /* ProceedAlwaysServer */ || outcome === "proceed_always_tool" /* ProceedAlwaysTool */) {
123819
- return "proceed_once" /* ProceedOnce */;
124797
+ if (confirmationDetails.type === "plan" && outcome === "proceed_always" /* ProceedAlways */) {
124798
+ return outcome;
124799
+ }
124800
+ return "cancel" /* Cancel */;
123820
124801
  }
123821
124802
  return outcome;
123822
124803
  }
@@ -124228,9 +125209,13 @@ var BackgroundTaskRegistry = class {
124228
125209
  );
124229
125210
  this.emitApprovalChange(entry);
124230
125211
  try {
125212
+ const normalizedOutcome = normalizeBackgroundApprovalOutcome(
125213
+ outcome,
125214
+ approval.confirmationDetails
125215
+ );
124231
125216
  await approval.respond(
124232
- normalizeBackgroundApprovalOutcome(outcome),
124233
- payload
125217
+ normalizedOutcome,
125218
+ normalizedOutcome === outcome ? payload : void 0
124234
125219
  );
124235
125220
  } catch (error) {
124236
125221
  debugLogger99.error(
@@ -124928,11 +125913,11 @@ function reconstructHistory(records, leafUuid) {
124928
125913
  return uuids.map((uuid) => firstByUuid.get(uuid)).filter((record2) => !!record2);
124929
125914
  }
124930
125915
  __name(reconstructHistory, "reconstructHistory");
124931
- function extractText2(parts) {
125916
+ function extractText3(parts) {
124932
125917
  if (!parts?.length) return "";
124933
125918
  return parts.map((part) => "text" in part && part.text ? part.text : "").join("\n").trim();
124934
125919
  }
124935
- __name(extractText2, "extractText");
125920
+ __name(extractText3, "extractText");
124936
125921
  function coalesceAdjacentUserHistory(messages) {
124937
125922
  const result = [];
124938
125923
  for (const message of messages) {
@@ -124960,7 +125945,7 @@ function recoverTranscript(records) {
124960
125945
  const launchPromptRecord = filtered.find(
124961
125946
  (record2) => record2.type === "system" && record2.subtype === "agent_launch_prompt" && record2.systemPayload
124962
125947
  );
124963
- const initialPrompt = filtered.find((record2) => record2.type === "user") ? extractText2(
125948
+ const initialPrompt = filtered.find((record2) => record2.type === "user") ? extractText3(
124964
125949
  filtered.find((record2) => record2.type === "user")?.message?.parts
124965
125950
  ) : void 0;
124966
125951
  const stableForBranch = [...filtered];
@@ -126272,7 +127257,7 @@ async function evaluateToolCall(toolName, args, overlayFs, approvalMode) {
126272
127257
  }
126273
127258
  if (toolName === ToolNames.SHELL) {
126274
127259
  const command = typeof args["command"] === "string" ? args["command"] : "";
126275
- if (command && await isShellCommandReadOnlyAST(command)) {
127260
+ if (command && await classifyShellCommandSafety(command) === "read-only") {
126276
127261
  return { action: "allow" };
126277
127262
  }
126278
127263
  return {
@@ -127148,12 +128133,12 @@ function resolveGitDir2(crawlDirectory) {
127148
128133
  while (current) {
127149
128134
  const gitPath = path77.join(current, ".git");
127150
128135
  try {
127151
- const stat19 = fs71.statSync(gitPath);
127152
- if (stat19.isDirectory()) {
128136
+ const stat20 = fs71.statSync(gitPath);
128137
+ if (stat20.isDirectory()) {
127153
128138
  pathCacheSet(resolveGitDirCache, cacheKey, gitPath);
127154
128139
  return gitPath;
127155
128140
  }
127156
- if (stat19.isFile()) {
128141
+ if (stat20.isFile()) {
127157
128142
  const contents = fs71.readFileSync(gitPath, "utf8").trim();
127158
128143
  const match2 = contents.match(/^gitdir:\s*(.+)$/i);
127159
128144
  if (!match2) {
@@ -127748,13 +128733,13 @@ async function crawlWithGitLsFiles(stateKey, crawlDirectory, cwd, options2, work
127748
128733
  if (deletedSet.has(normalizedFile)) {
127749
128734
  return true;
127750
128735
  }
127751
- let stat19;
128736
+ let stat20;
127752
128737
  try {
127753
- stat19 = fs71.lstatSync(path77.join(gitRoot, ...normalizedFile.split("/")));
128738
+ stat20 = fs71.lstatSync(path77.join(gitRoot, ...normalizedFile.split("/")));
127754
128739
  } catch {
127755
128740
  return true;
127756
128741
  }
127757
- if (stat19.isDirectory()) {
128742
+ if (stat20.isDirectory()) {
127758
128743
  return true;
127759
128744
  }
127760
128745
  if (relativeToGitRoot && relativeToGitRoot !== "." && normalizedFile === relativeToGitRoot) {
@@ -133084,8 +134069,8 @@ function getWelcomeBackStatePath() {
133084
134069
  return path86.join(process.cwd(), ".qwen", WELCOME_BACK_STATE_FILENAME);
133085
134070
  }
133086
134071
  __name(getWelcomeBackStatePath, "getWelcomeBackStatePath");
133087
- function buildSummaryFingerprint(stat19) {
133088
- return `${stat19.mtimeMs}:${stat19.size}`;
134072
+ function buildSummaryFingerprint(stat20) {
134073
+ return `${stat20.mtimeMs}:${stat20.size}`;
133089
134074
  }
133090
134075
  __name(buildSummaryFingerprint, "buildSummaryFingerprint");
133091
134076
  async function getWelcomeBackState() {
@@ -139212,7 +140197,7 @@ var CoreToolScheduler = class {
139212
140197
  if (!unknownToolName.startsWith("mcp__")) {
139213
140198
  return null;
139214
140199
  }
139215
- const prefixOf = /* @__PURE__ */ __name((server) => `mcp__${server}__`.replace(/[^a-zA-Z0-9_.-]/g, "_"), "prefixOf");
140200
+ const prefixOf = /* @__PURE__ */ __name((server) => sanitizeToolNameForProvider(`mcp__${server}__`), "prefixOf");
139216
140201
  const byPrefixLengthDesc = /* @__PURE__ */ __name((a, b3) => prefixOf(b3).length - prefixOf(a).length, "byPrefixLengthDesc");
139217
140202
  const candidates = Array.from(
139218
140203
  /* @__PURE__ */ new Set([
@@ -139511,7 +140496,7 @@ var CoreToolScheduler = class {
139511
140496
  this.finalizeToolSpan(reqInfo.callId);
139512
140497
  continue;
139513
140498
  }
139514
- const toolParams = invocation.params;
140499
+ let toolParams = invocation.params;
139515
140500
  const flowResult = await evaluatePermissionFlow(
139516
140501
  this.config,
139517
140502
  invocation,
@@ -139528,6 +140513,7 @@ var CoreToolScheduler = class {
139528
140513
  } = flowResult;
139529
140514
  const approvalMode = this.config.getApprovalMode();
139530
140515
  const isPlanMode = approvalMode === "plan" /* PLAN */;
140516
+ const isPlanShellCall = isPlanMode && (canonicalName === ToolNames.SHELL || canonicalName === ToolNames.MONITOR);
139531
140517
  const isExitPlanModeTool = canonicalName === ToolNames.EXIT_PLAN_MODE;
139532
140518
  const isEnterPlanModeTool = canonicalName === ToolNames.ENTER_PLAN_MODE;
139533
140519
  const forceAutoReviewForAllow = approvalMode === "auto" /* AUTO */ && (shouldForceAutoModeReviewForAllow(pmCtx, this.config.getCwd()) || shouldClassifyAllShellForAutoMode(canonicalName, this.config));
@@ -139572,19 +140558,6 @@ var CoreToolScheduler = class {
139572
140558
  this.finalizeToolSpan(reqInfo.callId);
139573
140559
  continue;
139574
140560
  }
139575
- if (finalPermission === "allow" && !forceAutoReviewForAllow) {
139576
- if (approvalMode === "auto" /* AUTO */) {
139577
- this.config.setAutoModeDenialState(
139578
- recordAllow(this.config.getAutoModeDenialState())
139579
- );
139580
- }
139581
- this.setToolCallOutcome(
139582
- reqInfo.callId,
139583
- "proceed_always" /* ProceedAlways */
139584
- );
139585
- this.setStatusInternal(reqInfo.callId, "scheduled");
139586
- continue;
139587
- }
139588
140561
  if (finalPermission === "deny") {
139589
140562
  this.setStatusInternal(
139590
140563
  reqInfo.callId,
@@ -139603,6 +140576,72 @@ var CoreToolScheduler = class {
139603
140576
  this.finalizeToolSpan(reqInfo.callId);
139604
140577
  continue;
139605
140578
  }
140579
+ let planShellAmbientWorkingDirectory;
140580
+ if (isPlanShellCall) {
140581
+ const directory = toolParams["directory"];
140582
+ planShellAmbientWorkingDirectory = typeof directory === "string" && directory.length > 0 ? void 0 : this.config.getTargetDir();
140583
+ invocation.params = {
140584
+ ...structuredClone(invocation.params),
140585
+ directory: typeof directory === "string" && directory.length > 0 ? directory : planShellAmbientWorkingDirectory
140586
+ };
140587
+ toolParams = invocation.params;
140588
+ }
140589
+ const planShellDecision = isPlanShellCall ? await evaluatePlanModeShellPolicy({
140590
+ config: this.config,
140591
+ toolName: canonicalName,
140592
+ requestArgs: reqInfo.args,
140593
+ invocationParams: toolParams,
140594
+ permissionContext: pmCtx,
140595
+ ambientWorkingDirectory: planShellAmbientWorkingDirectory,
140596
+ signal
140597
+ }) : { classification: "not-applicable" };
140598
+ const rejectPlanShell = /* @__PURE__ */ __name((message) => {
140599
+ this.setStatusInternal(reqInfo.callId, "error", {
140600
+ ...createErrorResponse(
140601
+ reqInfo,
140602
+ new Error(message),
140603
+ "execution_denied" /* EXECUTION_DENIED */
140604
+ ),
140605
+ resultDisplay: message
140606
+ });
140607
+ setToolSpanFailure(
140608
+ toolSpan,
140609
+ TOOL_FAILURE_KIND_PLAN_MODE_BLOCKED,
140610
+ TOOL_SPAN_STATUS_PLAN_MODE_BLOCKED
140611
+ );
140612
+ this.finalizeToolSpan(reqInfo.callId);
140613
+ }, "rejectPlanShell");
140614
+ if (planShellDecision.classification !== "not-applicable") {
140615
+ const initialPlanShellError = await validatePlanModeShellContext({
140616
+ config: this.config,
140617
+ decision: planShellDecision,
140618
+ requestArgs: reqInfo.args,
140619
+ invocationParams: invocation.params,
140620
+ signal
140621
+ });
140622
+ if (initialPlanShellError) {
140623
+ rejectPlanShell(initialPlanShellError);
140624
+ continue;
140625
+ }
140626
+ }
140627
+ if (planShellDecision.classification === "write") {
140628
+ rejectPlanShell(planShellDecision.writeBlockMessage);
140629
+ continue;
140630
+ }
140631
+ const planShellRequiresConfirmation = planShellDecision.classification === "unknown";
140632
+ if (finalPermission === "allow" && !forceAutoReviewForAllow && !planShellRequiresConfirmation) {
140633
+ if (approvalMode === "auto" /* AUTO */) {
140634
+ this.config.setAutoModeDenialState(
140635
+ recordAllow(this.config.getAutoModeDenialState())
140636
+ );
140637
+ }
140638
+ this.setToolCallOutcome(
140639
+ reqInfo.callId,
140640
+ "proceed_always" /* ProceedAlways */
140641
+ );
140642
+ this.setStatusInternal(reqInfo.callId, "scheduled");
140643
+ continue;
140644
+ }
139606
140645
  if (!requiresUserInteraction && shouldRunAutoModeForCall(approvalMode, canonicalName)) {
139607
140646
  const denialState = this.config.getAutoModeDenialState();
139608
140647
  const fallback = shouldFallback(denialState);
@@ -139676,7 +140715,7 @@ var CoreToolScheduler = class {
139676
140715
  const isAskUserQuestionTool = canonicalName === ToolNames.ASK_USER_QUESTION;
139677
140716
  let confirmationDetails;
139678
140717
  if (!needsConfirmation(
139679
- confirmationPermission,
140718
+ planShellRequiresConfirmation ? "ask" : confirmationPermission,
139680
140719
  approvalMode,
139681
140720
  canonicalName,
139682
140721
  requiresUserInteraction
@@ -139688,8 +140727,33 @@ var CoreToolScheduler = class {
139688
140727
  this.setStatusInternal(reqInfo.callId, "scheduled");
139689
140728
  } else {
139690
140729
  confirmationDetails = await invocation.getConfirmationDetails(signal);
140730
+ if (planShellDecision.classification !== "not-applicable") {
140731
+ const preDisplayPlanShellError = await validatePlanModeShellContext({
140732
+ config: this.config,
140733
+ decision: planShellDecision,
140734
+ requestArgs: reqInfo.args,
140735
+ invocationParams: invocation.params,
140736
+ signal
140737
+ });
140738
+ if (preDisplayPlanShellError) {
140739
+ rejectPlanShell(preDisplayPlanShellError);
140740
+ continue;
140741
+ }
140742
+ }
140743
+ try {
140744
+ confirmationDetails = decoratePlanModeShellConfirmation(
140745
+ planShellDecision,
140746
+ confirmationDetails
140747
+ );
140748
+ } catch {
140749
+ if (planShellDecision.classification === "unknown") {
140750
+ rejectPlanShell(planShellDecision.noApprovalMessage);
140751
+ continue;
140752
+ }
140753
+ throw new Error("Unable to prepare shell confirmation.");
140754
+ }
139691
140755
  injectPermissionRulesIfMissing(confirmationDetails, pmCtx);
139692
- if (isPlanModeBlocked(
140756
+ if (planShellDecision.classification === "not-applicable" && isPlanModeBlocked(
139693
140757
  isPlanMode,
139694
140758
  isExitPlanModeTool,
139695
140759
  isAskUserQuestionTool,
@@ -139726,7 +140790,11 @@ var CoreToolScheduler = class {
139726
140790
  }
139727
140791
  const isNonInteractiveDeny = !this.config.isInteractive() && !this.config.getExperimentalZedIntegration() && this.config.getInputFormat() !== "stream-json" /* STREAM_JSON */;
139728
140792
  if (isNonInteractiveDeny) {
139729
- const errorMessage = `Qwen Code requires permission to use "${reqInfo.name}", but that permission was declined (non-interactive mode cannot prompt for confirmation).`;
140793
+ const errorMessage = planShellDecision.classification === "unknown" ? planShellDecision.noApprovalMessage : `Qwen Code requires permission to use "${reqInfo.name}", but that permission was declined (non-interactive mode cannot prompt for confirmation).`;
140794
+ if (planShellDecision.classification === "unknown") {
140795
+ rejectPlanShell(errorMessage);
140796
+ continue;
140797
+ }
139730
140798
  this.setStatusInternal(
139731
140799
  reqInfo.callId,
139732
140800
  "error",
@@ -139752,10 +140820,44 @@ var CoreToolScheduler = class {
139752
140820
  messageBus,
139753
140821
  canonicalName,
139754
140822
  reqInfo.args || {},
139755
- permissionMode
140823
+ permissionMode,
140824
+ void 0,
140825
+ signal
139756
140826
  );
139757
140827
  if (hookResult.hasDecision && (!hookResult.shouldAllow || !requiresUserInteraction)) {
139758
140828
  if (hookResult.shouldAllow) {
140829
+ if (planShellDecision.classification !== "not-applicable") {
140830
+ const approval = await validatePlanModeShellApproval({
140831
+ config: this.config,
140832
+ decision: planShellDecision,
140833
+ requestArgs: reqInfo.args,
140834
+ invocationParams: invocation.params,
140835
+ signal,
140836
+ outcome: "proceed_once" /* ProceedOnce */,
140837
+ payload: hookResult.updatedInput ? { updatedInput: hookResult.updatedInput } : void 0
140838
+ });
140839
+ if (approval.outcome === "cancel" /* Cancel */) {
140840
+ await confirmationDetails.onConfirm(
140841
+ approval.outcome,
140842
+ approval.payload
140843
+ );
140844
+ rejectPlanShell(
140845
+ approval.payload?.cancelMessage ?? planShellDecision.noApprovalMessage
140846
+ );
140847
+ continue;
140848
+ }
140849
+ await confirmationDetails.onConfirm(
140850
+ approval.outcome,
140851
+ approval.payload
140852
+ );
140853
+ this.recordAutoModeFallbackResolution(
140854
+ reqInfo.callId,
140855
+ approval.outcome
140856
+ );
140857
+ this.setToolCallOutcome(reqInfo.callId, approval.outcome);
140858
+ this.setStatusInternal(reqInfo.callId, "scheduled");
140859
+ continue;
140860
+ }
139759
140861
  if (hookResult.updatedInput && typeof reqInfo.args === "object") {
139760
140862
  this.setArgsInternal(
139761
140863
  reqInfo.callId,
@@ -139810,7 +140912,11 @@ var CoreToolScheduler = class {
139810
140912
  }
139811
140913
  }
139812
140914
  if (this.config.getShouldAvoidPermissionPrompts?.()) {
139813
- const errorMessage = `Tool "${reqInfo.name}" requires permission, but background agents cannot prompt for confirmation. The tool call was denied.`;
140915
+ const errorMessage = planShellDecision.classification === "unknown" ? planShellDecision.noApprovalMessage : `Tool "${reqInfo.name}" requires permission, but background agents cannot prompt for confirmation. The tool call was denied.`;
140916
+ if (planShellDecision.classification === "unknown") {
140917
+ rejectPlanShell(errorMessage);
140918
+ continue;
140919
+ }
139814
140920
  this.setStatusInternal(
139815
140921
  reqInfo.callId,
139816
140922
  "error",
@@ -139838,25 +140944,68 @@ var CoreToolScheduler = class {
139838
140944
  this.finalizeToolSpan(reqInfo.callId);
139839
140945
  continue;
139840
140946
  }
139841
- this.openIdeDiffIfEnabled(
139842
- confirmationDetails,
139843
- reqInfo.callId,
139844
- signal
139845
- );
140947
+ if (planShellDecision.classification !== "not-applicable") {
140948
+ const finalPreDisplayPlanShellError = await validatePlanModeShellContext({
140949
+ config: this.config,
140950
+ decision: planShellDecision,
140951
+ requestArgs: reqInfo.args,
140952
+ invocationParams: invocation.params,
140953
+ signal
140954
+ });
140955
+ if (finalPreDisplayPlanShellError) {
140956
+ rejectPlanShell(finalPreDisplayPlanShellError);
140957
+ continue;
140958
+ }
140959
+ }
140960
+ if (confirmationDetails.type !== "edit" || !confirmationDetails.skipIdeDiff) {
140961
+ this.openIdeDiffIfEnabled(
140962
+ confirmationDetails,
140963
+ reqInfo.callId,
140964
+ signal
140965
+ );
140966
+ }
139846
140967
  const originalOnConfirm = confirmationDetails.onConfirm;
140968
+ let planShellResponseClaimed = false;
139847
140969
  const wrappedConfirmationDetails = {
139848
140970
  ...confirmationDetails,
139849
140971
  // When PM has an explicit 'ask' rule, 'always allow' would be
139850
140972
  // ineffective because ask takes priority over allow.
139851
140973
  // Hide the option so users aren't misled.
139852
140974
  ...pmForcedAsk || requiresUserInteraction ? { hideAlwaysAllow: true } : {},
139853
- onConfirm: /* @__PURE__ */ __name((outcome, payload) => this.handleConfirmationResponse(
139854
- reqInfo.callId,
139855
- originalOnConfirm,
139856
- outcome,
139857
- signal,
139858
- payload
139859
- ), "onConfirm")
140975
+ onConfirm: /* @__PURE__ */ __name(async (outcome, payload) => {
140976
+ if (planShellDecision.classification !== "not-applicable") {
140977
+ if (planShellResponseClaimed) return;
140978
+ planShellResponseClaimed = true;
140979
+ const currentCall = this.toolCalls.find(
140980
+ (call) => call.request.callId === reqInfo.callId && call.status === "awaiting_approval"
140981
+ );
140982
+ if (!currentCall) return;
140983
+ const approval = await validatePlanModeShellApproval({
140984
+ config: this.config,
140985
+ decision: planShellDecision,
140986
+ requestArgs: currentCall.request.args,
140987
+ invocationParams: currentCall.invocation.params,
140988
+ signal,
140989
+ outcome,
140990
+ payload
140991
+ });
140992
+ await this.handleConfirmationResponse(
140993
+ reqInfo.callId,
140994
+ originalOnConfirm,
140995
+ approval.outcome,
140996
+ signal,
140997
+ approval.payload
140998
+ );
140999
+ return;
141000
+ }
141001
+ await this.handleConfirmationResponse(
141002
+ reqInfo.callId,
141003
+ originalOnConfirm,
141004
+ outcome,
141005
+ signal,
141006
+ payload
141007
+ );
141008
+ }, "onConfirm")
139860
141009
  };
139861
141010
  this.setStatusInternal(
139862
141011
  reqInfo.callId,
@@ -141297,7 +142446,7 @@ ${failureHookResult.additionalContext}`;
141297
142446
  }
141298
142447
  async autoApproveCompatiblePendingTools(signal, triggeringCallId) {
141299
142448
  const pendingTools = this.toolCalls.filter(
141300
- (call) => call.status === "awaiting_approval" && call.request.callId !== triggeringCallId && // A tool bounced by a PreToolUse 'ask' must NOT be auto-approved as a
142449
+ (call) => call.status === "awaiting_approval" && call.request.callId !== triggeringCallId && (!("hideAlwaysAllow" in call.confirmationDetails) || call.confirmationDetails.hideAlwaysAllow !== true) && // A tool bounced by a PreToolUse 'ask' must NOT be auto-approved as a
141301
142450
  // side effect of approving a sibling: the hook explicitly requested
141302
142451
  // confirmation, and re-execution skips the hook — auto-approving here
141303
142452
  // would silently defeat the hook's gate. It requires its own explicit
@@ -149580,7 +150729,7 @@ The current date is: ${today}. Note: This is the authoritative current date \u20
149580
150729
  if (isTopLevelInteraction) endInteractionSpan("cancelled");
149581
150730
  return turn;
149582
150731
  }
149583
- const continueReason = stopOutput.getEffectiveReason();
150732
+ const continueReason = getStopHookContinuationReason(stopOutput);
149584
150733
  const currentIterationCount = (options2?.stopHookState?.iterationCount ?? 0) + 1;
149585
150734
  const currentReasons = [
149586
150735
  ...options2?.stopHookState?.reasons ?? [],
@@ -149630,9 +150779,30 @@ The current date is: ${today}. Note: This is the authoritative current date \u20
149630
150779
  const activeGoal = getActiveGoal(this.config.getSessionId());
149631
150780
  const hookTurnBudget = activeGoal ? boundedTurns : boundedTurns - 1;
149632
150781
  const pendingSteer = await takeSteerInput(hookTurnBudget);
149633
- const continueRequest = [{ text: continueReason }];
150782
+ const activeGoalAfterSteer = getActiveGoal(
150783
+ this.config.getSessionId()
150784
+ );
150785
+ const activeGoalChanged = activeGoal !== void 0 && activeGoalAfterSteer?.hookId !== activeGoal.hookId;
150786
+ const goalContinuationChanged = activeGoalChanged && stopOutput.hookSpecificOutput?.[GOAL_HOOK_ID_OUTPUT_KEY] === activeGoal.hookId;
150787
+ if (activeGoalChanged) {
150788
+ const activeGoalEvent3 = maybeEmitActiveGoalChange(activeGoalAfterSteer);
150789
+ if (activeGoalEvent3) {
150790
+ yield activeGoalEvent3;
150791
+ }
150792
+ }
150793
+ const discardGoalContinuation = goalContinuationChanged && response.hasNonGoalBlockingStopHook === false;
150794
+ const continuationReasonAfterSteer = discardGoalContinuation ? void 0 : goalContinuationChanged && response.hasNonGoalBlockingStopHook === true ? response.nonGoalBlockingStopReason || "No reason provided" : continueReason;
150795
+ if (!continuationReasonAfterSteer && !pendingSteer) {
150796
+ if (isTopLevelInteraction) endInteractionSpan("ok");
150797
+ normalCompletion = true;
150798
+ return turn;
150799
+ }
150800
+ const continueRequest = continuationReasonAfterSteer ? [{ text: continuationReasonAfterSteer }] : [];
149634
150801
  if (pendingSteer) {
149635
- continueRequest.push({ text: "\n\n" }, ...pendingSteer.parts);
150802
+ if (continueRequest.length > 0) {
150803
+ continueRequest.push({ text: "\n\n" });
150804
+ }
150805
+ continueRequest.push(...pendingSteer.parts);
149636
150806
  }
149637
150807
  const pushCountBefore = currentPushCount();
149638
150808
  let hookTurn;
@@ -149645,9 +150815,12 @@ The current date is: ${today}. Note: This is the authoritative current date \u20
149645
150815
  type: "hook" /* Hook */,
149646
150816
  modelOverride: options2?.modelOverride,
149647
150817
  getSteerInput: options2?.getSteerInput,
149648
- stopHookState: {
150818
+ stopHookState: discardGoalContinuation ? void 0 : {
149649
150819
  iterationCount: currentIterationCount,
149650
- reasons: currentReasons
150820
+ reasons: continuationReasonAfterSteer && continuationReasonAfterSteer !== continueReason ? [
150821
+ ...currentReasons.slice(0, -1),
150822
+ continuationReasonAfterSteer
150823
+ ] : currentReasons
149651
150824
  }
149652
150825
  },
149653
150826
  hookTurnBudget
@@ -152051,6 +153224,8 @@ var Config = class {
152051
153224
  }
152052
153225
  let result;
152053
153226
  let stopHookCount;
153227
+ let hasNonGoalBlockingStopHook;
153228
+ let nonGoalBlockingStopReason;
152054
153229
  const input = request.input || {};
152055
153230
  const signal = request.signal;
152056
153231
  switch (request.eventName) {
@@ -152081,6 +153256,18 @@ var Config = class {
152081
153256
  );
152082
153257
  result = stopResult.finalOutput ? createHookOutput("Stop", stopResult.finalOutput) : void 0;
152083
153258
  stopHookCount = stopResult.allOutputs.length;
153259
+ const goalHookId = stopResult.finalOutput?.hookSpecificOutput?.[GOAL_HOOK_ID_OUTPUT_KEY];
153260
+ if (typeof goalHookId === "string") {
153261
+ const nonGoalBlockingOutputs = stopResult.allOutputs.filter(
153262
+ (output) => output.hookSpecificOutput?.[GOAL_HOOK_ID_OUTPUT_KEY] !== goalHookId && (output.decision === "block" || output.decision === "deny" || output.continue === false)
153263
+ );
153264
+ hasNonGoalBlockingStopHook = nonGoalBlockingOutputs.length > 0;
153265
+ if (hasNonGoalBlockingStopHook) {
153266
+ nonGoalBlockingStopReason = nonGoalBlockingOutputs.map(
153267
+ (output) => output.stopReason || output.reason || "No reason provided"
153268
+ ).join("\n");
153269
+ }
153270
+ }
152084
153271
  break;
152085
153272
  }
152086
153273
  case "MessageDisplay": {
@@ -152195,7 +153382,9 @@ var Config = class {
152195
153382
  success: true,
152196
153383
  output: result,
152197
153384
  // Include stop hook count for Stop events
152198
- stopHookCount
153385
+ stopHookCount,
153386
+ hasNonGoalBlockingStopHook,
153387
+ nonGoalBlockingStopReason
152199
153388
  });
152200
153389
  } catch (error) {
152201
153390
  this.debugLogger.warn(`Hook execution failed: ${error}`);
@@ -155211,25 +156400,25 @@ var Config = class {
155211
156400
  if (options2?.forSubAgent) return;
155212
156401
  const schema = this.jsonSchema;
155213
156402
  await registerLazy(ToolNames.STRUCTURED_OUTPUT, async () => {
155214
- const { SyntheticOutputTool } = await import("./syntheticOutput-ULOVVLY4.js");
156403
+ const { SyntheticOutputTool } = await import("./syntheticOutput-FG5PQKIR.js");
155215
156404
  return new SyntheticOutputTool(schema);
155216
156405
  });
155217
156406
  }, "registerStructuredOutputIfRequested");
155218
156407
  if (this.getBareMode()) {
155219
156408
  await registerLazy(ToolNames.READ_FILE, async () => {
155220
- const { ReadFileTool } = await import("./read-file-VSKOE22I.js");
156409
+ const { ReadFileTool } = await import("./read-file-CPS2CYYG.js");
155221
156410
  return new ReadFileTool(this);
155222
156411
  });
155223
156412
  await registerLazy(ToolNames.EDIT, async () => {
155224
- const { EditTool } = await import("./edit-GORZTX2U.js");
156413
+ const { EditTool } = await import("./edit-4ZOPT6OC.js");
155225
156414
  return new EditTool(this);
155226
156415
  });
155227
156416
  await registerLazy(ToolNames.NOTEBOOK_EDIT, async () => {
155228
- const { NotebookEditTool } = await import("./notebook-edit-IBEOVZ6A.js");
156417
+ const { NotebookEditTool } = await import("./notebook-edit-BMQLME3Q.js");
155229
156418
  return new NotebookEditTool(this);
155230
156419
  });
155231
156420
  await registerLazy(ToolNames.SHELL, async () => {
155232
- const { ShellTool: ShellTool2 } = await import("./shell-2NGEMAVM.js");
156421
+ const { ShellTool: ShellTool2 } = await import("./shell-KVNHDHMT.js");
155233
156422
  return new ShellTool2(this);
155234
156423
  });
155235
156424
  await registerStructuredOutputIfRequested();
@@ -155239,35 +156428,35 @@ var Config = class {
155239
156428
  return registry;
155240
156429
  }
155241
156430
  await registerLazy(ToolNames.TOOL_SEARCH, async () => {
155242
- const { ToolSearchTool } = await import("./tool-search-5IE2VO7X.js");
156431
+ const { ToolSearchTool } = await import("./tool-search-MHXUDFD2.js");
155243
156432
  return new ToolSearchTool(this);
155244
156433
  });
155245
156434
  await registerLazy(ToolNames.READ_MCP_RESOURCE, async () => {
155246
- const { ReadMcpResourceTool } = await import("./read-mcp-resource-C6NT52T6.js");
156435
+ const { ReadMcpResourceTool } = await import("./read-mcp-resource-AKCL7I43.js");
155247
156436
  return new ReadMcpResourceTool(this);
155248
156437
  });
155249
156438
  await registerLazy(ToolNames.AGENT, async () => {
155250
- const { AgentTool: AgentTool2 } = await import("./agent-CKSI7BTR.js");
156439
+ const { AgentTool: AgentTool2 } = await import("./agent-J7EPFLA6.js");
155251
156440
  return new AgentTool2(this);
155252
156441
  });
155253
156442
  await registerLazy(ToolNames.TASK_STOP, async () => {
155254
- const { TaskStopTool } = await import("./task-stop-CPEQWOT6.js");
156443
+ const { TaskStopTool } = await import("./task-stop-GWC6UWAL.js");
155255
156444
  return new TaskStopTool(this);
155256
156445
  });
155257
156446
  await registerLazy(ToolNames.SEND_MESSAGE, async () => {
155258
- const { SendMessageTool } = await import("./send-message-5GZ4FX2V.js");
156447
+ const { SendMessageTool } = await import("./send-message-3RHE7HSM.js");
155259
156448
  return new SendMessageTool(this);
155260
156449
  });
155261
156450
  await registerLazy(ToolNames.SKILL, async () => {
155262
- const { SkillTool } = await import("./skill-3U2T6H3E.js");
156451
+ const { SkillTool } = await import("./skill-32525KCE.js");
155263
156452
  return new SkillTool(this);
155264
156453
  });
155265
156454
  await registerLazy(ToolNames.LS, async () => {
155266
- const { LSTool } = await import("./ls-APTSOOS5.js");
156455
+ const { LSTool } = await import("./ls-FHBY3Y7I.js");
155267
156456
  return new LSTool(this);
155268
156457
  });
155269
156458
  await registerLazy(ToolNames.READ_FILE, async () => {
155270
- const { ReadFileTool } = await import("./read-file-VSKOE22I.js");
156459
+ const { ReadFileTool } = await import("./read-file-CPS2CYYG.js");
155271
156460
  return new ReadFileTool(this);
155272
156461
  });
155273
156462
  if (this.getUseRipgrep()) {
@@ -155282,7 +156471,7 @@ var Config = class {
155282
156471
  recordStartupEvent("config_initialize_ripgrep_probe_end");
155283
156472
  if (useRipgrep) {
155284
156473
  await registerLazy(ToolNames.GREP, async () => {
155285
- const { RipGrepTool: RipGrepTool2 } = await import("./ripGrep-5V5FLW2A.js");
156474
+ const { RipGrepTool: RipGrepTool2 } = await import("./ripGrep-UKGJ7RHZ.js");
155286
156475
  return new RipGrepTool2(this);
155287
156476
  });
155288
156477
  } else {
@@ -155295,7 +156484,7 @@ var Config = class {
155295
156484
  )
155296
156485
  );
155297
156486
  await registerLazy(ToolNames.GREP, async () => {
155298
- const { GrepTool } = await import("./grep-HZLSTX7D.js");
156487
+ const { GrepTool } = await import("./grep-RS22OMZG.js");
155299
156488
  return new GrepTool(this);
155300
156489
  });
155301
156490
  }
@@ -155303,139 +156492,139 @@ var Config = class {
155303
156492
  recordStartupEvent("config_initialize_ripgrep_probe_start");
155304
156493
  recordStartupEvent("config_initialize_ripgrep_probe_end");
155305
156494
  await registerLazy(ToolNames.GREP, async () => {
155306
- const { GrepTool } = await import("./grep-HZLSTX7D.js");
156495
+ const { GrepTool } = await import("./grep-RS22OMZG.js");
155307
156496
  return new GrepTool(this);
155308
156497
  });
155309
156498
  }
155310
156499
  await registerLazy(ToolNames.GLOB, async () => {
155311
- const { GlobTool } = await import("./glob-GOAPGD6G.js");
156500
+ const { GlobTool } = await import("./glob-FPKZY5W6.js");
155312
156501
  return new GlobTool(this);
155313
156502
  });
155314
156503
  await registerLazy(ToolNames.EDIT, async () => {
155315
- const { EditTool } = await import("./edit-GORZTX2U.js");
156504
+ const { EditTool } = await import("./edit-4ZOPT6OC.js");
155316
156505
  return new EditTool(this);
155317
156506
  });
155318
156507
  await registerLazy(ToolNames.NOTEBOOK_EDIT, async () => {
155319
- const { NotebookEditTool } = await import("./notebook-edit-IBEOVZ6A.js");
156508
+ const { NotebookEditTool } = await import("./notebook-edit-BMQLME3Q.js");
155320
156509
  return new NotebookEditTool(this);
155321
156510
  });
155322
156511
  await registerLazy(ToolNames.WRITE_FILE, async () => {
155323
- const { WriteFileTool } = await import("./write-file-DR3HN7IH.js");
156512
+ const { WriteFileTool } = await import("./write-file-XRGEJRCC.js");
155324
156513
  return new WriteFileTool(this);
155325
156514
  });
155326
156515
  await registerLazy(ToolNames.SHELL, async () => {
155327
- const { ShellTool: ShellTool2 } = await import("./shell-2NGEMAVM.js");
156516
+ const { ShellTool: ShellTool2 } = await import("./shell-KVNHDHMT.js");
155328
156517
  return new ShellTool2(this);
155329
156518
  });
155330
156519
  await registerLazy(ToolNames.TODO_WRITE, async () => {
155331
- const { TodoWriteTool } = await import("./todoWrite-JHHIDOIV.js");
156520
+ const { TodoWriteTool } = await import("./todoWrite-ERCAMLFS.js");
155332
156521
  return new TodoWriteTool(this);
155333
156522
  });
155334
156523
  await registerLazy(ToolNames.ASK_USER_QUESTION, async () => {
155335
- const { AskUserQuestionTool } = await import("./askUserQuestion-CEPBT47X.js");
156524
+ const { AskUserQuestionTool } = await import("./askUserQuestion-6DZC4UV5.js");
155336
156525
  return new AskUserQuestionTool(this);
155337
156526
  });
155338
156527
  if (!this.sdkMode) {
155339
156528
  await registerLazy(ToolNames.EXIT_PLAN_MODE, async () => {
155340
- const { ExitPlanModeTool } = await import("./exitPlanMode-U5Z6XBLO.js");
156529
+ const { ExitPlanModeTool } = await import("./exitPlanMode-SX2F6PDJ.js");
155341
156530
  return new ExitPlanModeTool(this);
155342
156531
  });
155343
156532
  await registerLazy(ToolNames.ENTER_PLAN_MODE, async () => {
155344
- const { EnterPlanModeTool } = await import("./enterPlanMode-LIIPP37T.js");
156533
+ const { EnterPlanModeTool } = await import("./enterPlanMode-7VEJ7A2A.js");
155345
156534
  return new EnterPlanModeTool(this);
155346
156535
  });
155347
156536
  }
155348
156537
  await registerLazy(ToolNames.ENTER_WORKTREE, async () => {
155349
- const { EnterWorktreeTool } = await import("./enter-worktree-LJB2AW4L.js");
156538
+ const { EnterWorktreeTool } = await import("./enter-worktree-DFP5CZYS.js");
155350
156539
  return new EnterWorktreeTool(this);
155351
156540
  });
155352
156541
  await registerLazy(ToolNames.EXIT_WORKTREE, async () => {
155353
- const { ExitWorktreeTool } = await import("./exit-worktree-IEP2WHOV.js");
156542
+ const { ExitWorktreeTool } = await import("./exit-worktree-5Q7V6D4C.js");
155354
156543
  return new ExitWorktreeTool(this);
155355
156544
  });
155356
156545
  await registerLazy(ToolNames.WEB_FETCH, async () => {
155357
- const { WebFetchTool } = await import("./web-fetch-ZDNE6FF2.js");
156546
+ const { WebFetchTool } = await import("./web-fetch-DINW4Z65.js");
155358
156547
  return new WebFetchTool(this);
155359
156548
  });
155360
156549
  if (this.isArtifactEnabled()) {
155361
156550
  await registerLazy(ToolNames.ARTIFACT, async () => {
155362
- const { ArtifactTool } = await import("./artifact-tool-PHO5XEGZ.js");
156551
+ const { ArtifactTool } = await import("./artifact-tool-WBCAMD3O.js");
155363
156552
  return new ArtifactTool(this);
155364
156553
  });
155365
156554
  }
155366
156555
  if (this.isRecordArtifactEnabled()) {
155367
156556
  await registerLazy(ToolNames.RECORD_ARTIFACT, async () => {
155368
- const { RecordArtifactTool } = await import("./record-artifact-ENCU7QCL.js");
156557
+ const { RecordArtifactTool } = await import("./record-artifact-PEUB7727.js");
155369
156558
  return new RecordArtifactTool();
155370
156559
  });
155371
156560
  }
155372
156561
  if (this.isLspEnabled() && this.getLspClient()) {
155373
156562
  await registerLazy(ToolNames.LSP, async () => {
155374
- const { LspTool } = await import("./lsp-HPACPJAN.js");
156563
+ const { LspTool } = await import("./lsp-B6VMEW6Y.js");
155375
156564
  return new LspTool(this);
155376
156565
  });
155377
156566
  }
155378
156567
  await registerStructuredOutputIfRequested();
155379
156568
  if (this.isCronEnabled()) {
155380
156569
  await registerLazy(ToolNames.CRON_CREATE, async () => {
155381
- const { CronCreateTool } = await import("./cron-create-X462ERYA.js");
156570
+ const { CronCreateTool } = await import("./cron-create-JWFHBDRQ.js");
155382
156571
  return new CronCreateTool(this);
155383
156572
  });
155384
156573
  await registerLazy(ToolNames.CRON_LIST, async () => {
155385
- const { CronListTool } = await import("./cron-list-3MD6SVXI.js");
156574
+ const { CronListTool } = await import("./cron-list-USMAIWPT.js");
155386
156575
  return new CronListTool(this);
155387
156576
  });
155388
156577
  await registerLazy(ToolNames.CRON_DELETE, async () => {
155389
- const { CronDeleteTool } = await import("./cron-delete-SL5UJUM3.js");
156578
+ const { CronDeleteTool } = await import("./cron-delete-GDX4E26G.js");
155390
156579
  return new CronDeleteTool(this);
155391
156580
  });
155392
156581
  await registerLazy(ToolNames.LOOP_WAKEUP, async () => {
155393
- const { LoopWakeupTool } = await import("./loop-wakeup-6H7OENTB.js");
156582
+ const { LoopWakeupTool } = await import("./loop-wakeup-5GLTUBHA.js");
155394
156583
  return new LoopWakeupTool(this);
155395
156584
  });
155396
156585
  }
155397
156586
  await registerLazy(ToolNames.CREATE_SUB_SESSION, async () => {
155398
- const { CreateSubSessionTool } = await import("./create-sub-session-DIJOV6HV.js");
156587
+ const { CreateSubSessionTool } = await import("./create-sub-session-P26FE5GG.js");
155399
156588
  return new CreateSubSessionTool(this);
155400
156589
  });
155401
156590
  if (this.isAgentTeamEnabled()) {
155402
156591
  await registerLazy(ToolNames.TEAM_CREATE, async () => {
155403
- const { TeamCreateTool } = await import("./team-create-R6AXDYPG.js");
156592
+ const { TeamCreateTool } = await import("./team-create-LS2Q32Y4.js");
155404
156593
  return new TeamCreateTool(this);
155405
156594
  });
155406
156595
  await registerLazy(ToolNames.TEAM_DELETE, async () => {
155407
- const { TeamDeleteTool } = await import("./team-delete-JJV6IUOA.js");
156596
+ const { TeamDeleteTool } = await import("./team-delete-KK37HTOG.js");
155408
156597
  return new TeamDeleteTool(this);
155409
156598
  });
155410
156599
  await registerLazy(ToolNames.TEAM_PLAN_APPROVAL, async () => {
155411
- const { TeamPlanApprovalTool } = await import("./team-plan-approval-O2ZPPT64.js");
156600
+ const { TeamPlanApprovalTool } = await import("./team-plan-approval-DWCZABX6.js");
155412
156601
  return new TeamPlanApprovalTool(this);
155413
156602
  });
155414
156603
  await registerLazy(ToolNames.TASK_CREATE, async () => {
155415
- const { TaskCreateTool } = await import("./task-create-DUE2PMNI.js");
156604
+ const { TaskCreateTool } = await import("./task-create-HX32YXO7.js");
155416
156605
  return new TaskCreateTool(this);
155417
156606
  });
155418
156607
  await registerLazy(ToolNames.TASK_UPDATE, async () => {
155419
- const { TaskUpdateTool } = await import("./task-update-HY2LNFFB.js");
156608
+ const { TaskUpdateTool } = await import("./task-update-NCTAB73Q.js");
155420
156609
  return new TaskUpdateTool(this);
155421
156610
  });
155422
156611
  await registerLazy(ToolNames.TASK_LIST, async () => {
155423
- const { TaskListTool } = await import("./task-list-WVPNX7BZ.js");
156612
+ const { TaskListTool } = await import("./task-list-QWSY4ZIU.js");
155424
156613
  return new TaskListTool(this);
155425
156614
  });
155426
156615
  }
155427
156616
  if (this.isWorkflowsEnabled()) {
155428
156617
  await registerLazy(ToolNames.WORKFLOW, async () => {
155429
- const { WorkflowTool } = await import("./workflow-G7U6OQWS.js");
156618
+ const { WorkflowTool } = await import("./workflow-GPMXRWKK.js");
155430
156619
  return new WorkflowTool(this);
155431
156620
  });
155432
156621
  }
155433
156622
  if (this.isComputerUseEnabled()) {
155434
- const { registerComputerUseTools } = await import("./computer-use-4PUGCUQK.js");
156623
+ const { registerComputerUseTools } = await import("./computer-use-ET5476VX.js");
155435
156624
  await registerComputerUseTools(registerLazy, this);
155436
156625
  }
155437
156626
  await registerLazy(ToolNames.MONITOR, async () => {
155438
- const { MonitorTool } = await import("./monitor-LMYKCF6R.js");
156627
+ const { MonitorTool } = await import("./monitor-2ZZC2NKH.js");
155439
156628
  return new MonitorTool(this);
155440
156629
  });
155441
156630
  if (this.pendingMcpBudgetCallback) {
@@ -159075,6 +160264,7 @@ export {
159075
160264
  MAX_GOAL_ITERATIONS,
159076
160265
  GOAL_HOOK_TIMEOUT_SECONDS,
159077
160266
  GOAL_HOOK_TIMEOUT_MS,
160267
+ getStopHookContinuationReason,
159078
160268
  abortGoalForStopHookCap,
159079
160269
  createGoalStopHookCallback,
159080
160270
  unregisterGoalHook,
@@ -159125,7 +160315,14 @@ export {
159125
160315
  TERMINAL_CSI_REGEX,
159126
160316
  TERMINAL_SHIFT_DCS_REGEX,
159127
160317
  stripTerminalControlSequences,
159128
- buildOrderedUuidChain,
160318
+ TranscriptRecordPreparationError,
160319
+ isTranscriptConversationRecord,
160320
+ isTranscriptArtifactRecord,
160321
+ validateTranscriptRecord,
160322
+ selectTranscriptLeaf,
160323
+ walkTranscriptUuidChain,
160324
+ aggregateTranscriptRecordFragments,
160325
+ prepareTranscriptRecords,
159129
160326
  MAX_FILES,
159130
160327
  MAX_DIFF_SIZE_BYTES,
159131
160328
  MAX_LINES_PER_FILE,
@@ -159311,6 +160508,12 @@ export {
159311
160508
  getEffectivePermissionForConfirmation,
159312
160509
  isPlanModeBlocked,
159313
160510
  isAutoEditApproved,
160511
+ isShellCommandReadOnlyAST,
160512
+ extractCommandRules,
160513
+ evaluatePlanModeShellPolicy,
160514
+ validatePlanModeShellContext,
160515
+ decoratePlanModeShellConfirmation,
160516
+ validatePlanModeShellApproval,
159314
160517
  MAX_TRANSCRIPT_MESSAGES,
159315
160518
  extractShellOperations,
159316
160519
  AUTO_MODE_DENIAL_LIMITS,
@@ -159374,8 +160577,6 @@ export {
159374
160577
  ShellExecutionService,
159375
160578
  StructuredToolError,
159376
160579
  checkPriorRead,
159377
- isShellCommandReadOnlyAST,
159378
- extractCommandRules,
159379
160580
  escape,
159380
160581
  globStream,
159381
160582
  glob,
@@ -159480,6 +160681,7 @@ export {
159480
160681
  MAX_RETAINED_TERMINAL_AGENTS,
159481
160682
  buildBackgroundEntryLabel,
159482
160683
  BackgroundTaskRegistry,
160684
+ buildOrderedUuidChain,
159483
160685
  DEFAULT_BACKGROUND_AGENT_CONTINUATION_MESSAGE,
159484
160686
  BackgroundAgentResumeService,
159485
160687
  saveCacheSafeParams,
@@ -159775,6 +160977,7 @@ export {
159775
160977
  applyProviderInstallPlan,
159776
160978
  IMAGE_CAPABILITY,
159777
160979
  generateSessionRecap,
160980
+ inspectConversationBranches,
159778
160981
  createToolUseSummaryMessage,
159779
160982
  TOOL_USE_SUMMARY_SYSTEM_PROMPT,
159780
160983
  generateToolUseSummary,
@@ -159805,6 +161008,7 @@ export {
159805
161008
  getChannelMemoryFilePath,
159806
161009
  getLegacyChannelMemoryFilePath,
159807
161010
  listChannelMemoryEntries,
161011
+ getChannelMemoryRevision,
159808
161012
  addChannelMemoryEntries,
159809
161013
  updateChannelMemoryEntry,
159810
161014
  removeChannelMemoryEntries,