@qwen-code/qwen-code 0.21.2 → 0.21.3-nightly.20260803.e1e5b42ce

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 (352) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +53 -38
  2. package/bundled/qc-helper/docs/features/channels/github.md +16 -5
  3. package/bundled/qc-helper/docs/features/channels/gitlab.md +6 -0
  4. package/bundled/qc-helper/docs/features/code-review.md +92 -24
  5. package/bundled/qc-helper/docs/features/commands.md +46 -38
  6. package/bundled/qc-helper/docs/features/hooks.md +115 -18
  7. package/bundled/qc-helper/docs/features/memory.md +27 -0
  8. package/bundled/qc-helper/docs/features/skills.md +46 -1
  9. package/bundled/qc-helper/docs/features/sub-agents.md +42 -9
  10. package/bundled/qc-helper/docs/features/tool-use-summaries.md +7 -7
  11. package/bundled/qc-helper/docs/qwen-serve.md +46 -25
  12. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +62 -31
  13. package/bundled/qc-helper/docs/support/troubleshooting.md +6 -1
  14. package/bundled/review/DESIGN.md +167 -32
  15. package/bundled/review/SKILL.md +207 -38
  16. package/chunks/{MaxSizedBox-TQBQ247P.js → MaxSizedBox-FCEK5P5K.js} +41 -38
  17. package/chunks/{StandaloneSessionPicker-2HPTKCLX.js → StandaloneSessionPicker-AT77J3PM.js} +63 -59
  18. package/chunks/{acp-startup-profiler-2C4A5ZTJ.js → acp-startup-profiler-3RICG2YW.js} +2 -2
  19. package/chunks/{acpAgent-PS6EDGH3.js → acpAgent-PBMKZ5KH.js} +664 -560
  20. package/chunks/{agent-VDOUB35F.js → agent-55W5BPK3.js} +37 -34
  21. package/chunks/{agent-headless-EO53EFS2.js → agent-headless-I7VMHI22.js} +37 -34
  22. package/chunks/{anthropicContentGenerator-OFHSZJBF.js → anthropicContentGenerator-3CAHEZBM.js} +341 -29
  23. package/chunks/{artifact-tool-RDN2W7ND.js → artifact-tool-TBOYEKTY.js} +2 -2
  24. package/chunks/{askUserQuestion-OZERWH5R.js → askUserQuestion-23Y5WZFJ.js} +2 -2
  25. package/chunks/{bridge-W7AZSRZQ.js → bridge-XNAWEDAN.js} +43 -40
  26. package/chunks/{ca-6W3SK7OQ.js → ca-NYKNH222.js} +50 -5
  27. package/chunks/{channel-management-service-5S7YCWX5.js → channel-management-service-UHX56NBO.js} +7 -7
  28. package/chunks/{channel-settings-store-JFVRSNER.js → channel-settings-store-7P6RJSSF.js} +44 -41
  29. package/chunks/{channel-worker-group-OVWGYMZS.js → channel-worker-group-NDG4WOOZ.js} +8 -8
  30. package/chunks/{channel-worker-manager-H55GKOQA.js → channel-worker-manager-ZCW6UW34.js} +8 -8
  31. package/chunks/{channel-worker-supervisor-CABBXYHK.js → channel-worker-supervisor-ATGFTZRN.js} +4 -4
  32. package/chunks/{chunk-6MPDY6ZG.js → chunk-24ER7UV4.js} +1 -1
  33. package/chunks/{chunk-QDK4F2N5.js → chunk-2DNKEBXY.js} +1 -1
  34. package/chunks/{chunk-AUOULH6Q.js → chunk-2GF3IDEK.js} +1610 -2196
  35. package/chunks/{chunk-JYBU6YUE.js → chunk-2M5N3DHY.js} +1 -1
  36. package/chunks/{chunk-LHKCY7DY.js → chunk-2UISUFHQ.js} +3 -3
  37. package/chunks/{chunk-BBIQAX4V.js → chunk-2ZCYE3F2.js} +30 -18
  38. package/chunks/{chunk-GJ2GBPBD.js → chunk-332FMXSD.js} +5 -5
  39. package/chunks/{chunk-JXVC2PL3.js → chunk-33FNCQSY.js} +2 -2
  40. package/chunks/{chunk-P755N4CS.js → chunk-3GALLNII.js} +6 -6
  41. package/chunks/{chunk-YANIWTRZ.js → chunk-3ICGQSVO.js} +1 -1
  42. package/chunks/{chunk-NBD76HUW.js → chunk-3LGZEYOF.js} +2 -2
  43. package/chunks/{chunk-E2BHWIDT.js → chunk-3RXUYQJI.js} +6 -2
  44. package/chunks/{chunk-E5Z2AVNV.js → chunk-3SH53ANB.js} +0 -11
  45. package/chunks/{chunk-N4ACHWNH.js → chunk-432XCUHF.js} +1 -1
  46. package/chunks/{chunk-JLZ3RBQG.js → chunk-44EJDGMS.js} +144 -11
  47. package/chunks/{chunk-KR32NIAN.js → chunk-4JP34TZ6.js} +10 -10
  48. package/chunks/{chunk-L2E5GFAG.js → chunk-4LKVQFHM.js} +2 -2
  49. package/chunks/{chunk-YDLJGZHL.js → chunk-4NFY2S7N.js} +0 -33
  50. package/chunks/{chunk-NHFEMWAZ.js → chunk-5WY5QEM6.js} +1 -1
  51. package/chunks/{chunk-56Z7QEAQ.js → chunk-6BUPGI3J.js} +16 -16
  52. package/chunks/{chunk-H6I4PGRV.js → chunk-6DNHLK7F.js} +4 -4
  53. package/chunks/{chunk-XQK4XXTN.js → chunk-6O5DVH27.js} +1 -1
  54. package/chunks/{chunk-2RFKHEXL.js → chunk-6PLDPT2C.js} +1 -1
  55. package/chunks/{chunk-Q5WZTTWE.js → chunk-7UPJXZLD.js} +6 -8
  56. package/chunks/{chunk-CBBP4BMC.js → chunk-7UXI6P72.js} +82 -207
  57. package/chunks/{chunk-6CQWRWUC.js → chunk-7XLPYF6B.js} +3 -3
  58. package/chunks/{chunk-VEMNQMHA.js → chunk-7ZH55K26.js} +5 -13
  59. package/chunks/{chunk-JJPKFJBT.js → chunk-A2FOI762.js} +3 -3
  60. package/chunks/{chunk-LYI2PZDK.js → chunk-A5LNZGJB.js} +2 -2
  61. package/chunks/{chunk-3APUUXRF.js → chunk-A5YZ3FA2.js} +2 -1
  62. package/chunks/{chunk-SHN4KHDK.js → chunk-A6SX5TAH.js} +3 -3
  63. package/chunks/{chunk-QCXGC7QB.js → chunk-A7PONO5G.js} +3 -3
  64. package/chunks/{chunk-SZ3KHTDR.js → chunk-AKA24BGO.js} +1 -1
  65. package/chunks/{chunk-RSVPYAGK.js → chunk-B4HXOGF5.js} +5 -5
  66. package/chunks/{chunk-D6MDRSZ6.js → chunk-BBXSRVSN.js} +22 -11
  67. package/chunks/{chunk-Q3T5KA2V.js → chunk-BFHXDAR7.js} +1 -1
  68. package/chunks/{chunk-L55JWS76.js → chunk-BGXZBI5B.js} +1 -1
  69. package/chunks/{chunk-2KKCCLPT.js → chunk-C4IUDGPI.js} +1 -1
  70. package/chunks/{chunk-MM7TH7ZM.js → chunk-CFDR3GNL.js} +18 -3
  71. package/chunks/{chunk-3F2WDAV6.js → chunk-CFVFQWFB.js} +14 -14
  72. package/chunks/{chunk-E2FN6SM7.js → chunk-CIUUYB23.js} +5 -5
  73. package/chunks/{chunk-JCJ7LKNA.js → chunk-DIEFUBV6.js} +1644 -1570
  74. package/chunks/{chunk-KWHKHSIS.js → chunk-DTAPI453.js} +8 -8
  75. package/chunks/{chunk-WWCMSZII.js → chunk-DV2GAGR7.js} +71 -7
  76. package/chunks/{chunk-675H6PLP.js → chunk-DYA25Y7U.js} +1 -1
  77. package/chunks/{chunk-3I6DUGQD.js → chunk-E4WHKETF.js} +32 -4
  78. package/chunks/{chunk-QTERJVPZ.js → chunk-EKTCKZV5.js} +1 -0
  79. package/chunks/{chunk-HX6RLYUO.js → chunk-ENOHFX2M.js} +4 -4
  80. package/chunks/{chunk-VMX5RZQH.js → chunk-EZZJHMFK.js} +18 -9
  81. package/chunks/{chunk-KXDONCPU.js → chunk-FBDRTW3I.js} +4 -4
  82. package/chunks/{chunk-FCYYAB4S.js → chunk-FHPKHXHT.js} +3 -3
  83. package/chunks/{chunk-DQ2O5QOJ.js → chunk-FJZS2MXB.js} +1 -1
  84. package/chunks/{chunk-EQNUDTL6.js → chunk-FVLPZSKH.js} +3 -3
  85. package/chunks/{chunk-2LEOZTBT.js → chunk-FYMMZV5F.js} +111 -26
  86. package/chunks/{chunk-UV6KF7T3.js → chunk-GNZ7MX73.js} +3 -3
  87. package/chunks/chunk-GOFAQQZA.js +132 -0
  88. package/chunks/{chunk-YUFIEIWC.js → chunk-GTM6IHBB.js} +2 -2
  89. package/chunks/{chunk-W3UKBMSI.js → chunk-GU5B6IF3.js} +118 -9
  90. package/chunks/{chunk-PCK4B6LR.js → chunk-GU5XWZU2.js} +1 -1
  91. package/chunks/{chunk-DEEABGH2.js → chunk-H2EDCJIM.js} +5954 -1766
  92. package/chunks/{chunk-FJ5WUMUQ.js → chunk-H36SETQS.js} +1 -1
  93. package/chunks/{chunk-6FMJLI5M.js → chunk-HFVW54NL.js} +41 -6
  94. package/chunks/chunk-HGCQ5SE7.js +136 -0
  95. package/chunks/{chunk-OFZKFPYG.js → chunk-HR4CHEQS.js} +3 -3
  96. package/chunks/{chunk-CO2U743O.js → chunk-I3GX6LGS.js} +4 -4
  97. package/chunks/{chunk-5NNHICSA.js → chunk-I7JDGNG6.js} +3 -3
  98. package/chunks/{chunk-RDJOB6S3.js → chunk-IEBT6DXF.js} +1 -1
  99. package/chunks/{chunk-EU5TBFJI.js → chunk-IV7QPMC2.js} +2 -2
  100. package/chunks/{chunk-B4AJNNOL.js → chunk-J26HHFI5.js} +1 -1
  101. package/chunks/{chunk-CNTR4GR6.js → chunk-JELIWHXD.js} +1 -1
  102. package/chunks/{chunk-FNDXMN7I.js → chunk-JQFMW7BD.js} +936 -223
  103. package/chunks/{chunk-IGTHU3T4.js → chunk-KKN2IE7Q.js} +1 -1
  104. package/chunks/{chunk-TZTAV5RH.js → chunk-KVUBYJDM.js} +2 -2
  105. package/chunks/{chunk-DUNI4EBW.js → chunk-KZXSAQYV.js} +86 -52
  106. package/chunks/chunk-LBOVL47Y.js +29 -0
  107. package/chunks/{chunk-FS674JW4.js → chunk-LBWNSLJK.js} +3 -3
  108. package/chunks/{chunk-I5BT7ADR.js → chunk-LEZFUYPM.js} +4 -4
  109. package/chunks/chunk-LLMGP5IC.js +222 -0
  110. package/chunks/{chunk-44F4LBWZ.js → chunk-LVW7BHTW.js} +56 -18
  111. package/chunks/{chunk-YGE3IXJP.js → chunk-M744OFVE.js} +1 -1
  112. package/chunks/chunk-MISUEWB4.js +8749 -0
  113. package/chunks/{chunk-7SJN2IWT.js → chunk-MJ2SKNTY.js} +5 -5
  114. package/chunks/{chunk-JE2CEOBO.js → chunk-MNTXIO6T.js} +4 -4
  115. package/chunks/{chunk-TEGJSJDF.js → chunk-MOHAWIAW.js} +2 -2
  116. package/chunks/{chunk-54YCNSK5.js → chunk-MVMBE5EH.js} +4521 -10220
  117. package/chunks/{chunk-PZEXDV3H.js → chunk-NCY2CDDX.js} +71 -43
  118. package/chunks/{chunk-TTJZAIFP.js → chunk-NJELCSFL.js} +3 -3
  119. package/chunks/{chunk-A7Y5H4TX.js → chunk-NXDJEZCI.js} +7 -7
  120. package/chunks/{chunk-PQNHRFJC.js → chunk-NYX53SV4.js} +0 -2
  121. package/chunks/{chunk-QARJNL2V.js → chunk-O2ZYHG33.js} +5 -4
  122. package/chunks/{chunk-6PQPKTXP.js → chunk-OPMLL3B3.js} +1 -1
  123. package/chunks/{chunk-PVNQRENX.js → chunk-OUQGNGIU.js} +1 -1
  124. package/chunks/{chunk-V7RNNPGC.js → chunk-P5Y23G2L.js} +18 -1
  125. package/chunks/{chunk-GURGAJTX.js → chunk-PDDYAXL2.js} +4 -1
  126. package/chunks/chunk-PWCQRLM5.js +1170 -0
  127. package/chunks/{chunk-GL4JOZXU.js → chunk-Q43MIWDH.js} +4 -4
  128. package/chunks/{chunk-V4XNUDPE.js → chunk-QFIYH5KR.js} +28 -7
  129. package/chunks/chunk-QL4TN4HS.js +59 -0
  130. package/chunks/{chunk-E6CJ2SMM.js → chunk-QMBEW7EW.js} +2 -2
  131. package/chunks/{chunk-U4VTUMMK.js → chunk-QONSRAEV.js} +1 -1
  132. package/chunks/{chunk-LOY7RWQG.js → chunk-QYPT3QUD.js} +3 -3
  133. package/chunks/{chunk-RG64CDT2.js → chunk-RJAVNGJJ.js} +131 -48
  134. package/chunks/{chunk-Z3S5EMOW.js → chunk-RPYYTL7E.js} +60 -12
  135. package/chunks/{chunk-V25K5ID7.js → chunk-SWCEYR6T.js} +1 -1
  136. package/chunks/{chunk-77V3VIKL.js → chunk-SXGNNAMC.js} +9 -9
  137. package/chunks/{chunk-7KAXXBER.js → chunk-TNQ5BEEB.js} +3 -3
  138. package/chunks/{chunk-R2XWGR75.js → chunk-TYERNYH4.js} +2 -2
  139. package/chunks/{chunk-45IOTAUS.js → chunk-U25CMJYY.js} +1 -1
  140. package/chunks/{chunk-7ULQIS27.js → chunk-UEJESCS7.js} +1 -1
  141. package/chunks/{chunk-HC45LTEN.js → chunk-UH7Z7Y45.js} +1 -1
  142. package/chunks/{chunk-P5VC5USY.js → chunk-UIKCPMID.js} +1 -1
  143. package/chunks/{chunk-CPZAH673.js → chunk-UKZEXS6K.js} +2 -0
  144. package/chunks/{chunk-HIVKI6O6.js → chunk-UO7AWUZJ.js} +9 -7
  145. package/chunks/{chunk-XP4L6KS3.js → chunk-URN76TKR.js} +2 -2
  146. package/chunks/{chunk-XUGZYLDH.js → chunk-UWSXFI6E.js} +1 -1
  147. package/chunks/{chunk-AOHY3QJ3.js → chunk-VA5NLVPT.js} +3 -3
  148. package/chunks/{chunk-FANRZEAJ.js → chunk-VWOVHOTT.js} +1 -1
  149. package/chunks/{chunk-NTDH4IML.js → chunk-W2K4OEW4.js} +7 -7
  150. package/chunks/{chunk-L32VV3ZJ.js → chunk-WH7W24EN.js} +12 -12
  151. package/chunks/{chunk-QTHQ6Z5X.js → chunk-WK4TJUEA.js} +1 -1
  152. package/chunks/{chunk-ZPZ7ZJEE.js → chunk-WUC6ZFXO.js} +1 -1
  153. package/chunks/{chunk-TIRRPCFS.js → chunk-X6QNZOTC.js} +1 -1
  154. package/chunks/{chunk-IIUGIWWY.js → chunk-XC2VAFVZ.js} +1 -1
  155. package/chunks/{chunk-D4HTUMGX.js → chunk-XC656O42.js} +3 -3
  156. package/chunks/{chunk-ZMOJ7ISP.js → chunk-XXOVLDZQ.js} +1 -1
  157. package/chunks/{chunk-THVU3RNH.js → chunk-YAVY33G4.js} +1 -1
  158. package/chunks/{chunk-PJOHNFIY.js → chunk-YIAC2OXH.js} +5 -5
  159. package/chunks/{chunk-CU47KXB5.js → chunk-YTSN63PD.js} +6 -6
  160. package/chunks/{chunk-DSFHVTWD.js → chunk-YXEVDA66.js} +2 -2
  161. package/chunks/{chunk-MB32MS4U.js → chunk-ZLJQIGCH.js} +260 -175
  162. package/chunks/{chunk-6TAASXWL.js → chunk-ZX6RZZFB.js} +3 -3
  163. package/chunks/{computer-use-5QWCFNKD.js → computer-use-BG2EHNJE.js} +37 -34
  164. package/chunks/{config-utils-WADIDWGG.js → config-utils-E3ZQTHGM.js} +4 -4
  165. package/chunks/{contextCommand-4Z7T7TUM.js → contextCommand-JAPYNKFC.js} +41 -38
  166. package/chunks/{core-runtime-6N4EFC2Q.js → core-runtime-2VCZN5QF.js} +37 -34
  167. package/chunks/{create-sub-session-AEREHZBQ.js → create-sub-session-52OUA2VU.js} +52 -43
  168. package/chunks/{create-sub-session-62YZWVAY.js → create-sub-session-J32WC64U.js} +2 -2
  169. package/chunks/{cron-create-6E7GIQTG.js → cron-create-HMFSHIAR.js} +4 -4
  170. package/chunks/{cron-delete-JD26XY3W.js → cron-delete-ZJFHOX57.js} +4 -4
  171. package/chunks/{cron-list-CUWFB44G.js → cron-list-ZEX2NBMN.js} +4 -4
  172. package/chunks/{daemon-PCNCI5YU.js → daemon-CCIX4BMG.js} +47 -6
  173. package/chunks/{daemon-status-provider-DDF7C5M7.js → daemon-status-provider-F2YGDKHR.js} +48 -45
  174. package/chunks/{daemon-trust-policy-Q4KSOJTR.js → daemon-trust-policy-XCY7JETR.js} +43 -40
  175. package/chunks/{daemon-trust-policy-monitor-V6FTE3IY.js → daemon-trust-policy-monitor-FBHB5GMQ.js} +43 -40
  176. package/chunks/{de-SY6O76BF.js → de-VL76CPLV.js} +50 -5
  177. package/chunks/{deferred-core-runtime-GHJ5GQHK.js → deferred-core-runtime-BBLJ4JUM.js} +37 -34
  178. package/chunks/display-image-2WOG27DY.js +184 -0
  179. package/chunks/{dist-ZHXOBXDN.js → dist-3BMEUGTG.js} +1 -1
  180. package/chunks/{dist-OAOC5OV4.js → dist-7JGAAQSC.js} +2 -2
  181. package/chunks/{dist-SL2LUMML.js → dist-A7H2KKUC.js} +1 -1
  182. package/chunks/{dist-ULIG4M5H.js → dist-C5U4LJKW.js} +162 -15
  183. package/chunks/{dist-2PERFI23.js → dist-DPPHJAVL.js} +3 -3
  184. package/chunks/{dist-PVEAFLHY.js → dist-HVBMEYWK.js} +1 -1
  185. package/chunks/{dist-26BIMQT6.js → dist-IKGVITP3.js} +676 -37
  186. package/chunks/{dist-WGMNT3JQ.js → dist-SFQ34F4M.js} +24 -6
  187. package/chunks/{earlyInputCapture-TQXLLISD.js → earlyInputCapture-ALVSMKP7.js} +38 -35
  188. package/chunks/{edit-FJEUV6KZ.js → edit-POB3CIHQ.js} +37 -34
  189. package/chunks/{en-NBK3JKCE.js → en-IRJ2WN5T.js} +61 -6
  190. package/chunks/{enter-worktree-7GE3TZ4P.js → enter-worktree-Q2N7UZWC.js} +37 -34
  191. package/chunks/{enterPlanMode-KR5TMPCJ.js → enterPlanMode-QGAH2GMP.js} +37 -34
  192. package/chunks/{environment-SWL3CMB3.js → environment-FE5AX2U5.js} +40 -37
  193. package/chunks/{errors-XQE7BGZV.js → errors-SLMCFLSC.js} +40 -37
  194. package/chunks/{exit-worktree-CHKTYNCV.js → exit-worktree-7WO2LPLF.js} +37 -34
  195. package/chunks/{exitPlanMode-QYAG6LWX.js → exitPlanMode-3PINWUTY.js} +37 -34
  196. package/chunks/{fast-path-Z2K7W6DC.js → fast-path-SVFFEL6U.js} +17 -4
  197. package/chunks/{fr-4KG5V7UT.js → fr-GK3HQYVB.js} +50 -5
  198. package/chunks/{gemini-YU4XKEDG.js → gemini-QECJNKNJ.js} +151 -90
  199. package/chunks/{geminiContentGenerator-ZZX6NBO4.js → geminiContentGenerator-ZFAZKT6R.js} +6 -6
  200. package/chunks/{glob-VYF5CXSX.js → glob-GXUNQYNR.js} +37 -34
  201. package/chunks/{goal-tools-HGO6VXPB.js → goal-tools-SPQ5M6D3.js} +3 -3
  202. package/chunks/{grep-5DP5ZUTW.js → grep-LVU5KBCV.js} +37 -34
  203. package/chunks/{handleAutoUpdate-UVBJ56DL.js → handleAutoUpdate-MPDHQY72.js} +43 -40
  204. package/chunks/{i18n-UQNYHEUD.js → i18n-LEYRN6RV.js} +39 -36
  205. package/chunks/{image-gen-WHPIZNWF.js → image-gen-4T2D4PTP.js} +9 -9
  206. package/chunks/{initializer-GMIICF4W.js → initializer-PQV2THBS.js} +44 -41
  207. package/chunks/{installationInfo-4MGG4WVI.js → installationInfo-XC3HXLTX.js} +38 -35
  208. package/chunks/{ja-F3GSQXMF.js → ja-3FA46IKD.js} +50 -5
  209. package/chunks/{keychain-token-storage-IKO4G53C.js → keychain-token-storage-7BT4TQ2A.js} +2 -2
  210. package/chunks/{kittyProtocolDetector-MBRTDRBK.js → kittyProtocolDetector-BFLAKYXH.js} +1 -1
  211. package/chunks/{list-CPN2W334.js → list-AQBTPZRG.js} +46 -43
  212. package/chunks/{list-agents-PXJ7ZUFB.js → list-agents-TWEGRJWO.js} +2 -2
  213. package/chunks/{loadedSettingsAdapter-ZQAV5NDO.js → loadedSettingsAdapter-EZYPDX2J.js} +43 -40
  214. package/chunks/{loggingContentGenerator-5E7W4IEP.js → loggingContentGenerator-WD6YWU7Q.js} +52 -37
  215. package/chunks/{loop-wakeup-Y26NQZ5I.js → loop-wakeup-6LLEOQYV.js} +5 -5
  216. package/chunks/{ls-ONQTTMQR.js → ls-H5WX22VK.js} +4 -4
  217. package/chunks/{lsp-YGHHRGMD.js → lsp-G6FXYEIS.js} +2 -2
  218. package/chunks/{managed-npm-update-MKKAXYXA.js → managed-npm-update-BMM57CHD.js} +40 -37
  219. package/chunks/{mcp-V5NTJF6X.js → mcp-FMI6NCWA.js} +43 -40
  220. package/chunks/{monitor-CO3ASY6E.js → monitor-PZJOYAA2.js} +37 -34
  221. package/chunks/nonInteractiveCli-QPX6R4LL.js +152 -0
  222. package/chunks/{notebook-edit-Z7AEE6FM.js → notebook-edit-GZF2SKTQ.js} +37 -34
  223. package/chunks/{openaiContentGenerator-CA3MQOP3.js → openaiContentGenerator-ZPLCFAAG.js} +18 -18
  224. package/chunks/{pidfile-NL7MKDRU.js → pidfile-PCADVJQW.js} +38 -35
  225. package/chunks/{processUtils-PB5K2DYH.js → processUtils-FKUVQVEU.js} +2 -2
  226. package/chunks/{pt-EQ33KWEN.js → pt-3AOBKPIJ.js} +50 -5
  227. package/chunks/{qwenContentGenerator-JYFNDCOS.js → qwenContentGenerator-2Y4R6YLB.js} +42 -40
  228. package/chunks/{qwenOAuth2-W2ALKQDD.js → qwenOAuth2-UCEHY3I2.js} +8 -8
  229. package/chunks/{read-file-IEOR5H5W.js → read-file-DYHDFVAS.js} +10 -10
  230. package/chunks/{read-mcp-resource-U2IJN5HM.js → read-mcp-resource-DRZSI3HE.js} +2 -2
  231. package/chunks/{record-artifact-MGPJ7EG4.js → record-artifact-IPIRWMFY.js} +3 -3
  232. package/chunks/{resumeHistoryUtils-BNBTP5AS.js → resumeHistoryUtils-5JS6R3AJ.js} +45 -42
  233. package/chunks/{ripGrep-UMQODKEB.js → ripGrep-2QOR3ZQT.js} +37 -34
  234. package/chunks/{ru-7OZAUKGG.js → ru-VJRAMC4W.js} +50 -5
  235. package/chunks/{run-qwen-serve-RN2R6QQW.js → run-qwen-serve-MTVRAUBR.js} +271 -60
  236. package/chunks/{runtime-QFJ2MJF5.js → runtime-DQGE2DYR.js} +50 -45
  237. package/chunks/{scheduler-AMYUFOZI.js → scheduler-BXIZQ4OO.js} +37 -34
  238. package/chunks/{sdk-exporters-http-4BQANSJ6.js → sdk-exporters-http-IKNWQJNV.js} +2 -2
  239. package/chunks/{sdk-impl-Z4VXWVFX.js → sdk-impl-7CUUMQDB.js} +2 -2
  240. package/chunks/{send-message-PMP4ATVM.js → send-message-LHJLVWFD.js} +5 -4
  241. package/chunks/{serve-EIIYJVX3.js → serve-D4GYHFLL.js} +44 -40
  242. package/chunks/{server-EP2LLAPD.js → server-S22MLWTJ.js} +618 -387
  243. package/chunks/{session-GMPZBLOW.js → session-AHNM6YXP.js} +151 -87
  244. package/chunks/{settings-LN7RNKBS.js → settings-77MDDUSX.js} +42 -39
  245. package/chunks/{shell-EM2OWU5X.js → shell-DLD2VQTQ.js} +37 -34
  246. package/chunks/{skill-T5VPSK73.js → skill-3B2PAQE4.js} +27 -14
  247. package/chunks/{skill-settings-GMR3GMNY.js → skill-settings-STR5NF4B.js} +42 -39
  248. package/chunks/{spawnChannel-YPCU62DI.js → spawnChannel-TOWYOVDZ.js} +39 -36
  249. package/chunks/{standalone-update-JAKIM2NF.js → standalone-update-F6ZWABD7.js} +40 -37
  250. package/chunks/{startInteractiveUI-YETQWGYF.js → startInteractiveUI-QR7MHDX7.js} +1829 -1036
  251. package/chunks/{syntheticOutput-D7E6ZFKR.js → syntheticOutput-EYL7DWO7.js} +3 -3
  252. package/chunks/{task-create-NFCYD43L.js → task-create-4ALZMGP5.js} +10 -9
  253. package/chunks/{task-list-TAVMGEVD.js → task-list-6CVQPORX.js} +6 -6
  254. package/chunks/{task-stop-ZDF2UJRM.js → task-stop-Y5ZTFVRX.js} +2 -2
  255. package/chunks/{task-update-6L7LHGEX.js → task-update-IKCEEWJ6.js} +10 -9
  256. package/chunks/{team-create-LFJ6HGNY.js → team-create-LQVIAVRF.js} +37 -34
  257. package/chunks/{team-delete-DPGGRQBU.js → team-delete-CE7DC53R.js} +6 -6
  258. package/chunks/{team-plan-approval-C2KLSDGO.js → team-plan-approval-G5PUNI52.js} +37 -34
  259. package/chunks/terminal-image-renderer-33GSM55L.js +90 -0
  260. package/chunks/{theme-manager-JQ3ZGBP5.js → theme-manager-DBFM5QOG.js} +38 -35
  261. package/chunks/{todoWrite-2UO5G6G6.js → todoWrite-FTZWQRZH.js} +108 -36
  262. package/chunks/{tool-search-FAZBFRJZ.js → tool-search-RGG7BBC4.js} +13 -12
  263. package/chunks/{total-session-admission-5CALIVYO.js → total-session-admission-LY3RMXXI.js} +44 -41
  264. package/chunks/{trustedFolders-KOPSP44S.js → trustedFolders-3M4IQ6K6.js} +39 -36
  265. package/chunks/{update-relaunch-6QL2TICS.js → update-relaunch-G3CMSX3M.js} +5 -5
  266. package/chunks/{updateCheck-4Q6RIKFW.js → updateCheck-ZKFGBDTG.js} +42 -39
  267. package/chunks/{useAutoAcceptIndicator-Q5BMKZV3.js → useAutoAcceptIndicator-7SAFZK5H.js} +47 -44
  268. package/chunks/{validateNonInterActiveAuth-GKOC5F6Z.js → validateNonInterActiveAuth-F2K6UGE4.js} +88 -84
  269. package/chunks/{version-VSATY2LD.js → version-KM6MYV2D.js} +1 -1
  270. package/chunks/{web-fetch-JCLKL6NL.js → web-fetch-SM4LZHRS.js} +13 -13
  271. package/chunks/{web-search-DSQTFUBX.js → web-search-OGKZNDAC.js} +8 -8
  272. package/chunks/{workflow-M6QAVKVJ.js → workflow-HU365RFR.js} +419 -304
  273. package/chunks/{workspace-providers-status-YKLTLMJA.js → workspace-providers-status-QKKXQHL7.js} +46 -43
  274. package/chunks/{workspace-registration-store-5DMGKU64.js → workspace-registration-store-7J7KOXFD.js} +2 -2
  275. package/chunks/{workspace-registry-PTYUSYXX.js → workspace-registry-KC66O6DH.js} +44 -41
  276. package/chunks/{workspace-service-25ML3T47.js → workspace-service-TEV5Q2AA.js} +51 -48
  277. package/chunks/{workspace-skills-status-YKZWOYRX.js → workspace-skills-status-VRL55OMU.js} +45 -42
  278. package/chunks/{workspace-trust-reconciler-5FI2S3OS.js → workspace-trust-reconciler-COC5M7CY.js} +50 -47
  279. package/chunks/{write-file-AY7VLP5X.js → write-file-3SO2BMNO.js} +37 -34
  280. package/chunks/{zh-H3YDK5QW.js → zh-ARWDLDLR.js} +58 -6
  281. package/chunks/{zh-TW-JYCP7XUA.js → zh-TW-Y4RGI3P7.js} +58 -6
  282. package/chunks/{zoom-image-S4LJZMD5.js → zoom-image-O3RWTVKV.js} +10 -10
  283. package/cli.js +32 -48
  284. package/locales/ca.js +68 -4
  285. package/locales/de.js +70 -4
  286. package/locales/en.js +84 -6
  287. package/locales/fr.js +72 -4
  288. package/locales/ja.js +69 -4
  289. package/locales/pt.js +68 -4
  290. package/locales/ru.js +71 -4
  291. package/locales/zh-TW.js +74 -6
  292. package/locales/zh.js +74 -6
  293. package/package.json +3 -3
  294. package/web-shell/assets/{arc-xjArKHU2.js → arc-KuwiZ67W.js} +1 -1
  295. package/web-shell/assets/{architectureDiagram-3BPJPVTR-BgrQDNYG.js → architectureDiagram-3BPJPVTR-Cppop6HB.js} +1 -1
  296. package/web-shell/assets/{blockDiagram-GPEHLZMM-CXxWC-1_.js → blockDiagram-GPEHLZMM-DQ6HT72s.js} +1 -1
  297. package/web-shell/assets/{c4Diagram-AAUBKEIU-Dx1tLm3v.js → c4Diagram-AAUBKEIU-B8TX_Mh-.js} +1 -1
  298. package/web-shell/assets/channel-BZd6Ile0.js +1 -0
  299. package/web-shell/assets/{chunk-2J33WTMH-CBxjogVR.js → chunk-2J33WTMH-B2WBUTp8.js} +1 -1
  300. package/web-shell/assets/{chunk-4BX2VUAB-izb-rY5W.js → chunk-4BX2VUAB-DXUsWC6O.js} +1 -1
  301. package/web-shell/assets/{chunk-55IACEB6-NzLyvSb8.js → chunk-55IACEB6-DtB-6cyk.js} +1 -1
  302. package/web-shell/assets/{chunk-727SXJPM-DVyKb0dl.js → chunk-727SXJPM-B-PhPyC3.js} +1 -1
  303. package/web-shell/assets/{chunk-AQP2D5EJ-BtqL7NzB.js → chunk-AQP2D5EJ-DNaTFMSC.js} +1 -1
  304. package/web-shell/assets/{chunk-FMBD7UC4-iNpdKIO0.js → chunk-FMBD7UC4-DZ345tFf.js} +1 -1
  305. package/web-shell/assets/{chunk-ND2GUHAM-DI7cbFmX.js → chunk-ND2GUHAM-BR_EpgzJ.js} +1 -1
  306. package/web-shell/assets/{chunk-QZHKN3VN-3Y_-xFYs.js → chunk-QZHKN3VN-BTU-0gDT.js} +1 -1
  307. package/web-shell/assets/classDiagram-4FO5ZUOK-B7c-TqtK.js +1 -0
  308. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-B7c-TqtK.js +1 -0
  309. package/web-shell/assets/{cose-bilkent-S5V4N54A--raRatZn.js → cose-bilkent-S5V4N54A-BmsKBCNt.js} +1 -1
  310. package/web-shell/assets/{dagre-BM42HDAG-B8SU70mO.js → dagre-BM42HDAG-Ba8YWdDC.js} +1 -1
  311. package/web-shell/assets/{diagram-2AECGRRQ-ewgoakXo.js → diagram-2AECGRRQ-CCt2SnI6.js} +1 -1
  312. package/web-shell/assets/{diagram-5GNKFQAL-Bm_JLTnS.js → diagram-5GNKFQAL-BVTLXEU7.js} +1 -1
  313. package/web-shell/assets/{diagram-KO2AKTUF-DEIUjUy9.js → diagram-KO2AKTUF-DpDAVCYV.js} +1 -1
  314. package/web-shell/assets/{diagram-LMA3HP47-C2Wmrpj-.js → diagram-LMA3HP47-8ljXg-TB.js} +1 -1
  315. package/web-shell/assets/{diagram-OG6HWLK6-CtYe6bFx.js → diagram-OG6HWLK6-JAXfQSmd.js} +1 -1
  316. package/web-shell/assets/{erDiagram-TEJ5UH35-DfpHcWLV.js → erDiagram-TEJ5UH35-CUeakG6k.js} +1 -1
  317. package/web-shell/assets/{flowDiagram-I6XJVG4X-CAiUhio5.js → flowDiagram-I6XJVG4X-Cd4Wrdwv.js} +1 -1
  318. package/web-shell/assets/{ganttDiagram-6RSMTGT7-CYc7ezr4.js → ganttDiagram-6RSMTGT7-C0nMFvH_.js} +1 -1
  319. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-70lbkcRS.js → gitGraphDiagram-PVQCEYII-uKk88n_L.js} +1 -1
  320. package/web-shell/assets/index-BXGtjHs5.js +1756 -0
  321. package/web-shell/assets/{index-Ww86nT9f.js → index-C1UWBJSX.js} +1 -1
  322. package/web-shell/assets/index-WxSvj2tI.css +5 -0
  323. package/web-shell/assets/{infoDiagram-5YYISTIA-C7e8DWPa.js → infoDiagram-5YYISTIA-GfPN17hR.js} +1 -1
  324. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-BYLr2op-.js → ishikawaDiagram-YF4QCWOH-CDbWTcGa.js} +1 -1
  325. package/web-shell/assets/{journeyDiagram-JHISSGLW-hEibAHKX.js → journeyDiagram-JHISSGLW-J8TvvVFz.js} +1 -1
  326. package/web-shell/assets/{kanban-definition-UN3LZRKU-F2rt8Uhp.js → kanban-definition-UN3LZRKU-Ds_ndLrs.js} +1 -1
  327. package/web-shell/assets/{linear-DPhyNezd.js → linear-DuL9O4i3.js} +1 -1
  328. package/web-shell/assets/{mermaid.core-ZUtnug0n.js → mermaid.core-DtK4PsQB.js} +5 -5
  329. package/web-shell/assets/{mindmap-definition-RKZ34NQL-DDWcMoi8.js → mindmap-definition-RKZ34NQL-DD0r7MS3.js} +1 -1
  330. package/web-shell/assets/{pieDiagram-4H26LBE5-CTRKzw1_.js → pieDiagram-4H26LBE5-CxGPZ8Q-.js} +1 -1
  331. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-CAEwYG_z.js → quadrantDiagram-W4KKPZXB-Ds7Buxed.js} +1 -1
  332. package/web-shell/assets/{requirementDiagram-4Y6WPE33-CRjnH9D9.js → requirementDiagram-4Y6WPE33-DIx28ph5.js} +1 -1
  333. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-LPQT_sOd.js → sankeyDiagram-5OEKKPKP-AxdAYcVX.js} +1 -1
  334. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-Ht2Iqvb0.js → sequenceDiagram-3UESZ5HK-CojoXAZ5.js} +1 -1
  335. package/web-shell/assets/{stateDiagram-AJRCARHV-CIUdqOXu.js → stateDiagram-AJRCARHV-Dy1WN3mi.js} +1 -1
  336. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BaTNMz02.js +1 -0
  337. package/web-shell/assets/{timeline-definition-PNZ67QCA-BcilneZF.js → timeline-definition-PNZ67QCA-DeWe_43M.js} +1 -1
  338. package/web-shell/assets/{vennDiagram-CIIHVFJN-BljwiiH1.js → vennDiagram-CIIHVFJN-BN8PVlFq.js} +1 -1
  339. package/web-shell/assets/{wardley-L42UT6IY-DeKjkYjq.js → wardley-L42UT6IY-CbjV_1hf.js} +1 -1
  340. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-L3U1H7KG.js → wardleyDiagram-YWT4CUSO-D2mw84_p.js} +1 -1
  341. package/web-shell/assets/{xychartDiagram-2RQKCTM6-IJnWsgMT.js → xychartDiagram-2RQKCTM6-er9CTQXi.js} +1 -1
  342. package/web-shell/index.html +2 -2
  343. package/chunks/chunk-4KP2F2TE.js +0 -82
  344. package/chunks/chunk-HGT6JR3U.js +0 -177
  345. package/chunks/nonInteractiveCli-ZJYEOO7U.js +0 -148
  346. package/web-shell/assets/channel-B1cyk94G.js +0 -1
  347. package/web-shell/assets/classDiagram-4FO5ZUOK-BpBYZoRE.js +0 -1
  348. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-BpBYZoRE.js +0 -1
  349. package/web-shell/assets/index-C1k3PDuU.css +0 -5
  350. package/web-shell/assets/index-DZLIXILO.js +0 -1750
  351. package/web-shell/assets/insert-DmRbh9Rv.svg +0 -1
  352. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BmqqQZ6w.js +0 -1
@@ -1,8 +1,12 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
3
  import {
4
- classifyApiError
5
- } from "./chunk-V7RNNPGC.js";
4
+ recomputeMcpGating
5
+ } from "./chunk-MJ2SKNTY.js";
6
+ import {
7
+ classifyApiError,
8
+ fireSessionDeleteHook
9
+ } from "./chunk-P5Y23G2L.js";
6
10
  import {
7
11
  EXTENSION_CONTEXT_BUDGET,
8
12
  buildExtensionMentionContext,
@@ -12,47 +16,47 @@ import {
12
16
  matchMcpServerByRef,
13
17
  parseExtensionRef,
14
18
  parseMcpServerRef
15
- } from "./chunk-RG64CDT2.js";
19
+ } from "./chunk-RJAVNGJJ.js";
16
20
  import {
17
21
  getAvailableCommands,
18
22
  handleSlashCommand,
19
23
  insertAfterFunctionResponses,
20
24
  isSlashCommand,
21
25
  normalizePartList
22
- } from "./chunk-FNDXMN7I.js";
23
- import {
24
- collectContextData,
25
- formatContextUsageText
26
- } from "./chunk-H6I4PGRV.js";
27
- import {
28
- recomputeMcpGating
29
- } from "./chunk-7SJN2IWT.js";
26
+ } from "./chunk-JQFMW7BD.js";
30
27
  import {
28
+ SessionIdConflictError,
31
29
  appEvents,
32
30
  buildDisabledSkillNamesProvider,
33
31
  cleanupReviewWorktreeLeases,
34
32
  loadCliConfig,
35
33
  normalizeDisabledToolList
36
- } from "./chunk-DEEABGH2.js";
34
+ } from "./chunk-H2EDCJIM.js";
35
+ import "./chunk-NYX53SV4.js";
36
+ import {
37
+ collectContextData,
38
+ formatContextUsageText
39
+ } from "./chunk-6DNHLK7F.js";
37
40
  import {
38
41
  getCommandSubcommandNames
39
- } from "./chunk-RDJOB6S3.js";
42
+ } from "./chunk-IEBT6DXF.js";
40
43
  import {
41
44
  getEffectiveSupportedModes
42
- } from "./chunk-UV6KF7T3.js";
45
+ } from "./chunk-GNZ7MX73.js";
46
+ import "./chunk-3LGZEYOF.js";
43
47
  import "./chunk-4WGODMVR.js";
44
- import "./chunk-PQNHRFJC.js";
45
- import "./chunk-NBD76HUW.js";
46
- import "./chunk-IGTHU3T4.js";
48
+ import "./chunk-HR4CHEQS.js";
49
+ import "./chunk-KKN2IE7Q.js";
50
+ import "./chunk-QFIYH5KR.js";
51
+ import "./chunk-6H67XLET.js";
47
52
  import {
48
53
  beginAcpBootstrapConfigProfiling,
49
54
  buildAndFreezeAcpStartupProfile,
50
55
  endAcpBootstrapConfigProfiling,
51
56
  markAcpStartup
52
- } from "./chunk-YGE3IXJP.js";
53
- import "./chunk-KXDONCPU.js";
54
- import "./chunk-CU47KXB5.js";
55
- import "./chunk-OFZKFPYG.js";
57
+ } from "./chunk-M744OFVE.js";
58
+ import "./chunk-FBDRTW3I.js";
59
+ import "./chunk-YTSN63PD.js";
56
60
  import "./chunk-YAF2MQZ6.js";
57
61
  import {
58
62
  GENERATION_MAX_PROMPT_BYTES,
@@ -66,6 +70,7 @@ import {
66
70
  executeGeneration,
67
71
  formatWorkspaceMemoryForgetSummary,
68
72
  isValidServerName,
73
+ loadSettingsCached,
69
74
  normalizeChannelDeliveryText,
70
75
  redactMcpServerSecrets,
71
76
  replayTranscriptRecordPage,
@@ -73,7 +78,7 @@ import {
73
78
  shouldSuppressRememberErrorDetails,
74
79
  workspaceMemoryFailureCode,
75
80
  workspaceMemoryFailureDiagnostics
76
- } from "./chunk-JLZ3RBQG.js";
81
+ } from "./chunk-44EJDGMS.js";
77
82
  import {
78
83
  HistoryReplayer,
79
84
  MessageEmitter,
@@ -83,57 +88,62 @@ import {
83
88
  goalTerminalEventToHistoryItem,
84
89
  recordGoalStatusItem,
85
90
  restoreGoalFromHistory
86
- } from "./chunk-PZEXDV3H.js";
87
- import "./chunk-675H6PLP.js";
88
- import "./chunk-YDLJGZHL.js";
89
- import "./chunk-PCK4B6LR.js";
91
+ } from "./chunk-NCY2CDDX.js";
92
+ import "./chunk-DYA25Y7U.js";
93
+ import "./chunk-4NFY2S7N.js";
94
+ import "./chunk-GU5XWZU2.js";
90
95
  import "./chunk-2MIN6GRR.js";
91
96
  import "./chunk-QHTIBUWB.js";
92
97
  import {
93
98
  isTerminalGoalStatusKind
94
- } from "./chunk-QTERJVPZ.js";
99
+ } from "./chunk-EKTCKZV5.js";
95
100
  import "./chunk-3Z43GZUQ.js";
96
101
  import {
97
102
  computeCpuPercent
98
- } from "./chunk-HGT6JR3U.js";
103
+ } from "./chunk-LBOVL47Y.js";
99
104
  import "./chunk-RXFQM6FQ.js";
100
- import "./chunk-V4XNUDPE.js";
101
- import "./chunk-6H67XLET.js";
105
+ import "./chunk-HGCQ5SE7.js";
102
106
  import {
103
107
  mapSkillConfigToStatus
104
- } from "./chunk-L55JWS76.js";
108
+ } from "./chunk-BGXZBI5B.js";
105
109
  import {
106
110
  PERMISSION_RULE_TYPES,
107
111
  PermissionRulesValidationError,
108
112
  buildPermissionSettings,
109
113
  normalizePermissionRules,
110
114
  readPermissionRuleSet
111
- } from "./chunk-YANIWTRZ.js";
115
+ } from "./chunk-3ICGQSVO.js";
112
116
  import {
113
117
  MAX_AUDIO_BYTES,
114
118
  sanitizeVoiceErrorMessage,
115
119
  transcribeVoiceAudio
116
- } from "./chunk-7KAXXBER.js";
120
+ } from "./chunk-TNQ5BEEB.js";
117
121
  import {
118
122
  readVoiceModel
119
- } from "./chunk-P5VC5USY.js";
120
- import "./chunk-CNTR4GR6.js";
123
+ } from "./chunk-UIKCPMID.js";
124
+ import "./chunk-JELIWHXD.js";
125
+ import {
126
+ resolveSkillSettings
127
+ } from "./chunk-Z4X5MTRT.js";
128
+ import "./chunk-BBXSRVSN.js";
129
+ import "./chunk-NXDJEZCI.js";
130
+ import "./chunk-57OAHC2Y.js";
121
131
  import {
122
132
  createLoadedSettingsAdapter
123
- } from "./chunk-PVNQRENX.js";
133
+ } from "./chunk-OUQGNGIU.js";
124
134
  import "./chunk-VXZBKKQR.js";
125
- import "./chunk-Q5WZTTWE.js";
126
- import "./chunk-E5Z2AVNV.js";
135
+ import "./chunk-7UPJXZLD.js";
136
+ import "./chunk-3SH53ANB.js";
127
137
  import {
128
138
  SESSION_SOURCE_META_KEY,
129
139
  parseSessionSource
130
- } from "./chunk-44F4LBWZ.js";
140
+ } from "./chunk-LVW7BHTW.js";
131
141
  import "./chunk-GLWP3FDB.js";
132
142
  import "./chunk-XCGIMOLN.js";
133
143
  import "./chunk-OCPBI7J5.js";
134
144
  import {
135
145
  ndJsonStream
136
- } from "./chunk-XUGZYLDH.js";
146
+ } from "./chunk-UWSXFI6E.js";
137
147
  import {
138
148
  ACP_ROUTE_ID_PREFIX,
139
149
  buildAcpModelOptions,
@@ -142,7 +152,7 @@ import {
142
152
  parseAcpModelOption,
143
153
  resolveAcpModelOption,
144
154
  sanitizeProviderBaseUrl
145
- } from "./chunk-6TAASXWL.js";
155
+ } from "./chunk-ZX6RZZFB.js";
146
156
  import {
147
157
  ACP_PREFLIGHT_KINDS,
148
158
  IDLE_HOOK_EVENTS,
@@ -150,16 +160,10 @@ import {
150
160
  SERVE_STATUS_EXT_METHODS,
151
161
  STATUS_SCHEMA_VERSION,
152
162
  mapDomainErrorToErrorKind
153
- } from "./chunk-GURGAJTX.js";
154
- import {
155
- resolveSkillSettings
156
- } from "./chunk-Z4X5MTRT.js";
157
- import "./chunk-D6MDRSZ6.js";
158
- import "./chunk-A7Y5H4TX.js";
159
- import "./chunk-57OAHC2Y.js";
160
- import "./chunk-I5BT7ADR.js";
161
- import "./chunk-FANRZEAJ.js";
162
- import "./chunk-KWHKHSIS.js";
163
+ } from "./chunk-PDDYAXL2.js";
164
+ import "./chunk-LEZFUYPM.js";
165
+ import "./chunk-DTAPI453.js";
166
+ import "./chunk-VWOVHOTT.js";
163
167
  import "./chunk-V6WHFGST.js";
164
168
  import {
165
169
  CHANNEL_STARTUP_PROFILE_META_KEY,
@@ -174,24 +178,27 @@ import {
174
178
  LOAD_REPLAY_VERSION,
175
179
  MID_TURN_QUEUE_DRAIN_METHOD,
176
180
  PROMPT_CANCEL_METHOD,
181
+ REQUESTED_SESSION_ID_META_KEY,
177
182
  TODO_STOP_GUARD_CONTINUATION_CLAIM_METHOD,
178
183
  TODO_STOP_GUARD_QUEUE_RELEASE_METHOD,
179
184
  WORKTREE_MCP_DEFER_META_KEY
180
- } from "./chunk-CPZAH673.js";
185
+ } from "./chunk-UKZEXS6K.js";
181
186
  import {
182
187
  NOT_CURRENTLY_GENERATING_CANCEL_MESSAGE,
183
188
  isNotCurrentlyGeneratingCancelError
184
- } from "./chunk-B4AJNNOL.js";
185
- import "./chunk-2RFKHEXL.js";
189
+ } from "./chunk-J26HHFI5.js";
190
+ import "./chunk-6PLDPT2C.js";
186
191
  import "./chunk-FYJ7W2PI.js";
187
- import "./chunk-U4VTUMMK.js";
188
- import "./chunk-6MPDY6ZG.js";
192
+ import "./chunk-QONSRAEV.js";
193
+ import "./chunk-24ER7UV4.js";
189
194
  import "./chunk-ALMR3E6Q.js";
190
195
  import "./chunk-BK2UNYWD.js";
191
196
  import "./chunk-M5GB774H.js";
192
- import "./chunk-IIUGIWWY.js";
193
- import "./chunk-ZPZ7ZJEE.js";
194
- import "./chunk-JCJ7LKNA.js";
197
+ import "./chunk-XC2VAFVZ.js";
198
+ import "./chunk-WUC6ZFXO.js";
199
+ import {
200
+ ACP_EVENT_LOOP_STALL_RESTART_MS
201
+ } from "./chunk-DIEFUBV6.js";
195
202
  import {
196
203
  AgentSideConnection,
197
204
  PROTOCOL_VERSION,
@@ -200,48 +207,38 @@ import {
200
207
  import {
201
208
  assembleMcpServers,
202
209
  loadMcpApprovals
203
- } from "./chunk-KR32NIAN.js";
210
+ } from "./chunk-4JP34TZ6.js";
204
211
  import {
205
212
  getOutputLanguageFilePath,
206
213
  getPersistScopeForModelSelection,
207
- getUserSettingsPath,
208
214
  loadSettings,
209
215
  resolveOutputLanguageOrPreserveAuto,
210
216
  updateOutputLanguageFile,
211
217
  writeOutputLanguageAndRegisterPath
212
- } from "./chunk-W3UKBMSI.js";
218
+ } from "./chunk-GU5B6IF3.js";
213
219
  import "./chunk-RKUWKYED.js";
214
220
  import "./chunk-GOXKNSDZ.js";
215
- import {
216
- getSystemDefaultsPath,
217
- getSystemSettingsPath
218
- } from "./chunk-IDS7MSUP.js";
221
+ import "./chunk-IDS7MSUP.js";
219
222
  import {
220
223
  SUPPORTED_LANGUAGES,
221
224
  getCurrentLanguage,
222
225
  setLanguageAsync
223
- } from "./chunk-3F2WDAV6.js";
226
+ } from "./chunk-CFVFQWFB.js";
224
227
  import {
225
- findEnvFiles,
226
- preResolveHomeEnvOverrides,
227
228
  reloadEnvironment
228
- } from "./chunk-EU5TBFJI.js";
229
+ } from "./chunk-IV7QPMC2.js";
229
230
  import "./chunk-6PEXNQTX.js";
230
- import "./chunk-GJ2GBPBD.js";
231
+ import "./chunk-332FMXSD.js";
232
+ import "./chunk-C4IUDGPI.js";
233
+ import "./chunk-VJNBRRZG.js";
231
234
  import {
232
235
  isFolderTrustEnabled,
233
236
  isWorkspaceTrusted,
234
237
  loadTrustedFolders
235
- } from "./chunk-P755N4CS.js";
238
+ } from "./chunk-3GALLNII.js";
236
239
  import "./chunk-ALGGS7UH.js";
237
240
  import "./chunk-MR3PXB6E.js";
238
241
  import "./chunk-XFSFZCM5.js";
239
- import "./chunk-2KKCCLPT.js";
240
- import "./chunk-VJNBRRZG.js";
241
- import {
242
- writeStderrLine,
243
- writeStderrLineSafe
244
- } from "./chunk-OWAK7LMW.js";
245
242
  import {
246
243
  ALL_PROVIDERS,
247
244
  APPROVAL_MODE_INFO,
@@ -303,6 +300,7 @@ import {
303
300
  evaluateAutoMode,
304
301
  evaluatePermissionFlow,
305
302
  evaluatePlanModeShellPolicy,
303
+ evaluateToolInvocationGuard,
306
304
  finalizeToolResponses,
307
305
  findExistingProviderModels,
308
306
  findPlanModeEntryBatchBoundaryIndex,
@@ -329,7 +327,6 @@ import {
329
327
  getProviderToolCallId,
330
328
  getScopedEnvContents,
331
329
  getStopHookContinuationReason,
332
- ideContextStore,
333
330
  injectPermissionRulesIfMissing,
334
331
  isApproveOutcome,
335
332
  isDenialFallbackReason,
@@ -366,63 +363,67 @@ import {
366
363
  validatePlanModeShellApproval,
367
364
  validatePlanModeShellContext,
368
365
  wrapUserPromptSubmitContext
369
- } from "./chunk-54YCNSK5.js";
366
+ } from "./chunk-MVMBE5EH.js";
367
+ import "./chunk-GOFAQQZA.js";
370
368
  import "./chunk-5M6IDOMF.js";
371
369
  import "./chunk-TWPJO254.js";
372
370
  import {
373
371
  external_exports
374
372
  } from "./chunk-H6XPXXMH.js";
375
- import "./chunk-AOHY3QJ3.js";
376
- import "./chunk-5NNHICSA.js";
377
- import "./chunk-SHN4KHDK.js";
378
- import "./chunk-JXVC2PL3.js";
379
- import "./chunk-KRXPRVGL.js";
373
+ import "./chunk-VA5NLVPT.js";
374
+ import "./chunk-I7JDGNG6.js";
375
+ import "./chunk-A6SX5TAH.js";
376
+ import "./chunk-33FNCQSY.js";
380
377
  import {
381
378
  parsePositiveIntegerEnv
382
379
  } from "./chunk-6PVPNMXU.js";
383
- import "./chunk-ZMOJ7ISP.js";
380
+ import "./chunk-XXOVLDZQ.js";
384
381
  import "./chunk-IRH27ZC2.js";
385
382
  import "./chunk-QHWCP53L.js";
386
- import "./chunk-TEGJSJDF.js";
387
- import "./chunk-TIRRPCFS.js";
383
+ import "./chunk-MOHAWIAW.js";
384
+ import "./chunk-X6QNZOTC.js";
388
385
  import {
389
386
  promptIdContext,
390
387
  todoWorkChainContext
391
388
  } from "./chunk-O6GEWCJA.js";
392
389
  import "./chunk-T26EAKDL.js";
390
+ import "./chunk-ZPJWUGCS.js";
393
391
  import "./chunk-CPBF7KYF.js";
394
- import "./chunk-4KP2F2TE.js";
392
+ import "./chunk-MISUEWB4.js";
393
+ import "./chunk-KRXPRVGL.js";
395
394
  import {
396
395
  HookEventName,
397
396
  createHookOutput
398
- } from "./chunk-3APUUXRF.js";
399
- import "./chunk-THVU3RNH.js";
400
- import "./chunk-LHKCY7DY.js";
401
- import "./chunk-6FMJLI5M.js";
397
+ } from "./chunk-A5YZ3FA2.js";
398
+ import "./chunk-YAVY33G4.js";
399
+ import "./chunk-2UISUFHQ.js";
400
+ import "./chunk-HFVW54NL.js";
402
401
  import {
403
402
  APPROVAL_MODES,
404
- FORK_SUBAGENT_TYPE,
405
- getStartupContextLength,
406
- isSystemReminderContent,
407
403
  runWithRuntimeContentGenerator
408
- } from "./chunk-CBBP4BMC.js";
404
+ } from "./chunk-LLMGP5IC.js";
409
405
  import "./chunk-S6LOFUVP.js";
406
+ import {
407
+ FORK_SUBAGENT_TYPE,
408
+ getStartupContextLength,
409
+ isSystemReminderContent
410
+ } from "./chunk-7UXI6P72.js";
410
411
  import "./chunk-K623ENWT.js";
411
412
  import "./chunk-AQ37AY7B.js";
412
- import "./chunk-N4ACHWNH.js";
413
- import "./chunk-ZPJWUGCS.js";
413
+ import "./chunk-432XCUHF.js";
414
+ import "./chunk-YXEVDA66.js";
414
415
  import {
415
416
  clearCachedCredentialFile,
416
417
  qwenOAuth2Events
417
- } from "./chunk-D4HTUMGX.js";
418
+ } from "./chunk-XC656O42.js";
418
419
  import "./chunk-NAVJD2PQ.js";
419
- import "./chunk-LOY7RWQG.js";
420
- import "./chunk-E6CJ2SMM.js";
420
+ import "./chunk-QYPT3QUD.js";
421
+ import "./chunk-QMBEW7EW.js";
421
422
  import "./chunk-DGEIYUC3.js";
422
423
  import "./chunk-MPHPFVKK.js";
423
424
  import "./chunk-GLNBDYUX.js";
424
425
  import "./chunk-DJ2GSRLV.js";
425
- import "./chunk-6CQWRWUC.js";
426
+ import "./chunk-7XLPYF6B.js";
426
427
  import {
427
428
  addToolArgumentsAttributes,
428
429
  addToolCallResultAttributes,
@@ -430,14 +431,14 @@ import {
430
431
  registerAcpEventLoopLagGauge,
431
432
  startEventLoopLagMonitor,
432
433
  withDaemonSpan
433
- } from "./chunk-Z3S5EMOW.js";
434
+ } from "./chunk-RPYYTL7E.js";
434
435
  import "./chunk-2J3OJGTL.js";
435
436
  import "./chunk-P3QQPMQA.js";
436
- import "./chunk-XQK4XXTN.js";
437
+ import "./chunk-6O5DVH27.js";
437
438
  import {
438
439
  getToolCallPreparations
439
440
  } from "./chunk-GLCZKT5V.js";
440
- import "./chunk-QDK4F2N5.js";
441
+ import "./chunk-2DNKEBXY.js";
441
442
  import {
442
443
  ConversationFinishedEvent,
443
444
  DiscoveredMCPTool,
@@ -468,30 +469,30 @@ import {
468
469
  shouldRunVisionBridge,
469
470
  splitImageParts,
470
471
  uiTelemetryService
471
- } from "./chunk-DUNI4EBW.js";
472
+ } from "./chunk-KZXSAQYV.js";
472
473
  import "./chunk-VGC4I5JJ.js";
473
474
  import {
474
475
  getAutoMemoryRoot,
475
476
  getUserAutoMemoryRoot
476
- } from "./chunk-3I6DUGQD.js";
477
- import "./chunk-7ULQIS27.js";
477
+ } from "./chunk-E4WHKETF.js";
478
+ import "./chunk-UEJESCS7.js";
478
479
  import {
479
480
  ToolConfirmationOutcome,
480
481
  ToolNames,
481
482
  isShellProgressData
482
- } from "./chunk-MM7TH7ZM.js";
483
+ } from "./chunk-CFDR3GNL.js";
483
484
  import {
484
485
  AuthType,
485
486
  preloadContentGenerator
486
- } from "./chunk-HIVKI6O6.js";
487
+ } from "./chunk-UO7AWUZJ.js";
487
488
  import "./chunk-46UV252V.js";
488
489
  import {
489
490
  DEFAULT_TOKEN_LIMIT,
490
491
  tokenLimit
491
492
  } from "./chunk-ZBVS26BY.js";
492
- import "./chunk-Q3T5KA2V.js";
493
- import "./chunk-R2XWGR75.js";
494
- import "./chunk-HC45LTEN.js";
493
+ import "./chunk-BFHXDAR7.js";
494
+ import "./chunk-TYERNYH4.js";
495
+ import "./chunk-UH7Z7Y45.js";
495
496
  import {
496
497
  endToolExecutionSpan,
497
498
  endToolSpan,
@@ -500,7 +501,7 @@ import {
500
501
  startToolExecutionSpan,
501
502
  startToolSpan,
502
503
  withInteractionSpan
503
- } from "./chunk-QARJNL2V.js";
504
+ } from "./chunk-O2ZYHG33.js";
504
505
  import "./chunk-W4RQUHY3.js";
505
506
  import "./chunk-G7XXKQYS.js";
506
507
  import {
@@ -509,12 +510,16 @@ import {
509
510
  getErrorMessage,
510
511
  getErrorStatus,
511
512
  isSubpath
512
- } from "./chunk-E2BHWIDT.js";
513
+ } from "./chunk-3RXUYQJI.js";
513
514
  import "./chunk-VOQXFAY5.js";
514
- import "./chunk-6PQPKTXP.js";
515
+ import "./chunk-OPMLL3B3.js";
515
516
  import {
516
517
  runExitCleanup
517
- } from "./chunk-DQ2O5QOJ.js";
518
+ } from "./chunk-FJZS2MXB.js";
519
+ import {
520
+ writeStderrLine,
521
+ writeStderrLineSafe
522
+ } from "./chunk-OWAK7LMW.js";
518
523
  import "./chunk-75DOP5OR.js";
519
524
  import "./chunk-DMTGGOSA.js";
520
525
  import "./chunk-YQ3U5MUC.js";
@@ -759,126 +764,11 @@ var AcpFileSystemService = class {
759
764
  // packages/cli/src/acp-integration/acpAgent.ts
760
765
  import { Readable, Writable } from "node:stream";
761
766
  import { pipeline } from "node:stream/promises";
762
- import * as fs2 from "node:fs/promises";
763
- import * as os3 from "node:os";
764
- import * as path4 from "node:path";
767
+ import * as fs from "node:fs/promises";
768
+ import * as os2 from "node:os";
769
+ import * as path3 from "node:path";
765
770
  import { createGunzip } from "node:zlib";
766
771
 
767
- // packages/cli/src/config/settings-cache.ts
768
- init_esbuild_shims();
769
- import * as fs from "node:fs";
770
- import * as os from "node:os";
771
- import * as path2 from "node:path";
772
- var MAX_CACHE_ENTRIES = 64;
773
- var debugLogger2 = createDebugLogger("SETTINGS_CACHE");
774
- var cache = /* @__PURE__ */ new Map();
775
- function statSig(filePath) {
776
- const st = fs.statSync(filePath, { throwIfNoEntry: false });
777
- return st ? `${st.mtimeMs}:${st.size}:${st.ino}` : "missing";
778
- }
779
- __name(statSig, "statSig");
780
- function realpathOr(p) {
781
- try {
782
- return fs.realpathSync(p);
783
- } catch {
784
- return path2.resolve(p);
785
- }
786
- }
787
- __name(realpathOr, "realpathOr");
788
- function settingsFileSigs(workspaceDir) {
789
- const filePaths = [
790
- getSystemSettingsPath(),
791
- getSystemDefaultsPath(),
792
- getUserSettingsPath(),
793
- new Storage(workspaceDir).getWorkspaceSettingsPath()
794
- ];
795
- return filePaths.map((filePath) => ({ filePath, sig: statSig(filePath) }));
796
- }
797
- __name(settingsFileSigs, "settingsFileSigs");
798
- function envFileSigs(settings, workspaceDir) {
799
- return findEnvFiles(settings.merged, workspaceDir).map((filePath) => ({
800
- filePath,
801
- sig: statSig(filePath)
802
- }));
803
- }
804
- __name(envFileSigs, "envFileSigs");
805
- function sameFileSigs(a, b) {
806
- if (a.length !== b.length) {
807
- return false;
808
- }
809
- return a.every(
810
- (sig, i) => sig.filePath === b[i].filePath && sig.sig === b[i].sig
811
- );
812
- }
813
- __name(sameFileSigs, "sameFileSigs");
814
- function isEntryFresh(key, entry) {
815
- const fp = entry.fingerprint;
816
- return ideContextStore.get()?.workspaceState?.isTrusted === fp.ideTrust && realpathOr(key) === fp.realCwd && // homeDir guards the corner where nothing else moves: QWEN_HOME set (so
817
- // settings paths don't follow HOME), no .env files anywhere, and the new
818
- // home equals the workspace dir — which flips workspaceSettingsActive.
819
- realpathOr(os.homedir()) === fp.homeDir && sameFileSigs(settingsFileSigs(key), fp.settingsFiles) && sameFileSigs(envFileSigs(entry.settings, key), fp.envFiles);
820
- }
821
- __name(isEntryFresh, "isEntryFresh");
822
- function loadSettingsCached(workspaceDir) {
823
- preResolveHomeEnvOverrides();
824
- const key = path2.resolve(workspaceDir);
825
- const entry = cache.get(key);
826
- if (entry) {
827
- let isFresh = false;
828
- try {
829
- isFresh = isEntryFresh(key, entry);
830
- } catch (error) {
831
- debugLogger2.warn(
832
- `fingerprint check failed for ${key}; reloading:`,
833
- error
834
- );
835
- }
836
- if (isFresh) {
837
- cache.delete(key);
838
- cache.set(key, entry);
839
- debugLogger2.debug(`hit ${key}`);
840
- return entry.settings;
841
- }
842
- cache.delete(key);
843
- }
844
- debugLogger2.debug(`miss ${key}`);
845
- let preLoadSigs;
846
- try {
847
- preLoadSigs = settingsFileSigs(key);
848
- } catch (error) {
849
- debugLogger2.warn(`pre-load signing failed for ${key}; not caching:`, error);
850
- }
851
- const settings = loadSettings(key);
852
- if (preLoadSigs) {
853
- try {
854
- cache.set(key, {
855
- settings,
856
- fingerprint: {
857
- settingsFiles: preLoadSigs,
858
- // .env discovery needs the merged settings (trust), so it can only
859
- // be signed after the load — see difference (2) in the module doc.
860
- envFiles: envFileSigs(settings, key),
861
- ideTrust: ideContextStore.get()?.workspaceState?.isTrusted,
862
- realCwd: realpathOr(key),
863
- homeDir: realpathOr(os.homedir())
864
- }
865
- });
866
- if (cache.size > MAX_CACHE_ENTRIES) {
867
- const oldest = cache.keys().next().value;
868
- if (oldest !== void 0) {
869
- cache.delete(oldest);
870
- debugLogger2.debug(`evicted LRU entry ${oldest}`);
871
- }
872
- }
873
- } catch (error) {
874
- cache.delete(key);
875
- debugLogger2.warn(`caching failed for ${key}; serving uncached:`, error);
876
- }
877
- }
878
- return settings;
879
- }
880
- __name(loadSettingsCached, "loadSettingsCached");
881
-
882
772
  // packages/cli/src/acp-integration/extension-skills.ts
883
773
  init_esbuild_shims();
884
774
  function extensionSkillRef(extensionName, skillName) {
@@ -908,9 +798,9 @@ __name(isInactiveExtensionSkill, "isInactiveExtensionSkill");
908
798
  init_esbuild_shims();
909
799
  import { Buffer as Buffer2 } from "node:buffer";
910
800
  import { randomUUID } from "node:crypto";
911
- import { existsSync as existsSync2, statSync as statSync2 } from "node:fs";
912
- import * as os2 from "node:os";
913
- import * as path3 from "node:path";
801
+ import { realpathSync, statSync } from "node:fs";
802
+ import * as os from "node:os";
803
+ import * as path2 from "node:path";
914
804
 
915
805
  // packages/cli/src/utils/midTurnUserMessage.ts
916
806
  init_esbuild_shims();
@@ -1120,7 +1010,7 @@ function requestPermissionWithAbort(client, params, signal) {
1120
1010
  if (signal.aborted) {
1121
1011
  return Promise.reject(permissionAbortError(signal));
1122
1012
  }
1123
- return new Promise((resolve5, reject) => {
1013
+ return new Promise((resolve4, reject) => {
1124
1014
  let settled = false;
1125
1015
  const finish = /* @__PURE__ */ __name((callback) => {
1126
1016
  if (settled) return;
@@ -1138,7 +1028,7 @@ function requestPermissionWithAbort(client, params, signal) {
1138
1028
  return;
1139
1029
  }
1140
1030
  request.then(
1141
- (response) => finish(() => resolve5(response)),
1031
+ (response) => finish(() => resolve4(response)),
1142
1032
  (error) => finish(() => reject(error))
1143
1033
  );
1144
1034
  });
@@ -1278,12 +1168,13 @@ function toPermissionOptions(confirmation, forceHideAlwaysAllow = false) {
1278
1168
  __name(toPermissionOptions, "toPermissionOptions");
1279
1169
 
1280
1170
  // packages/cli/src/acp-integration/session/SubAgentTracker.ts
1281
- var debugLogger3 = createDebugLogger("ACP_SUBAGENT_TRACKER");
1171
+ var debugLogger2 = createDebugLogger("ACP_SUBAGENT_TRACKER");
1282
1172
  var SubAgentTracker = class {
1283
- constructor(ctx, client, parentToolCallId, subagentType, onPermissionCancel) {
1173
+ constructor(ctx, client, parentToolCallId, subagentType, onPermissionCancel, permissionRequester = (params, signal) => requestPermissionWithAbort(this.client, params, signal)) {
1284
1174
  this.ctx = ctx;
1285
1175
  this.client = client;
1286
1176
  this.onPermissionCancel = onPermissionCancel;
1177
+ this.permissionRequester = permissionRequester;
1287
1178
  this.toolCallEmitter = new ToolCallEmitter(ctx);
1288
1179
  this.messageEmitter = new MessageEmitter(ctx);
1289
1180
  this.subagentMeta = { parentToolCallId, subagentType };
@@ -1338,7 +1229,7 @@ var SubAgentTracker = class {
1338
1229
  try {
1339
1230
  invocation = tool.build(event.args);
1340
1231
  } catch (e) {
1341
- debugLogger3.warn(`Failed to build subagent tool ${event.name}:`, e);
1232
+ debugLogger2.warn(`Failed to build subagent tool ${event.name}:`, e);
1342
1233
  }
1343
1234
  }
1344
1235
  this.toolStates.set(event.callId, {
@@ -1415,11 +1306,7 @@ var SubAgentTracker = class {
1415
1306
  }
1416
1307
  };
1417
1308
  try {
1418
- const output = await requestPermissionWithAbort(
1419
- this.client,
1420
- params,
1421
- abortSignal
1422
- );
1309
+ const output = await this.permissionRequester(params, abortSignal);
1423
1310
  const outcome = resolvePermissionOutcome(
1424
1311
  output,
1425
1312
  offeredPermissionOptions
@@ -1431,7 +1318,7 @@ var SubAgentTracker = class {
1431
1318
  this.onPermissionCancel?.();
1432
1319
  }
1433
1320
  } catch (error) {
1434
- debugLogger3.error(
1321
+ debugLogger2.error(
1435
1322
  `Permission request failed for subagent tool ${event.name}:`,
1436
1323
  error
1437
1324
  );
@@ -1439,7 +1326,7 @@ var SubAgentTracker = class {
1439
1326
  try {
1440
1327
  await event.respond("cancel" /* Cancel */);
1441
1328
  } catch (respondError) {
1442
- debugLogger3.error(
1329
+ debugLogger2.error(
1443
1330
  `Failed to cancel subagent tool ${event.name} after permission request failure:`,
1444
1331
  respondError
1445
1332
  );
@@ -1537,8 +1424,8 @@ var TurnBuffer = class {
1537
1424
  // packages/cli/src/acp-integration/session/rewrite/LlmRewriter.ts
1538
1425
  init_esbuild_shims();
1539
1426
  import { readFileSync, existsSync } from "node:fs";
1540
- import { resolve as resolve2 } from "node:path";
1541
- var debugLogger4 = createDebugLogger("MESSAGE_REWRITER");
1427
+ import { resolve } from "node:path";
1428
+ var debugLogger3 = createDebugLogger("MESSAGE_REWRITER");
1542
1429
  var DEFAULT_REWRITE_PROMPT = `You are an assistant that rewrites raw coding-agent output into concise, user-friendly progress updates.
1543
1430
 
1544
1431
  The agent is a software engineering assistant that reads files, writes code, runs commands, and uses tools. Its raw output mixes internal reasoning with user-facing information. Your job: extract what the user cares about, drop what they don't.
@@ -1564,14 +1451,14 @@ var LlmRewriter = class {
1564
1451
  this.rewriteModel = rewriteConfig.model || void 0;
1565
1452
  this.contextTurns = rewriteConfig.contextTurns === "all" ? Infinity : rewriteConfig.contextTurns ?? 1;
1566
1453
  if (rewriteConfig.promptFile) {
1567
- const filePath = resolve2(rewriteConfig.promptFile);
1454
+ const filePath = resolve(rewriteConfig.promptFile);
1568
1455
  if (existsSync(filePath)) {
1569
1456
  this.prompt = readFileSync(filePath, "utf-8").trim();
1570
- debugLogger4.info(
1457
+ debugLogger3.info(
1571
1458
  `Loaded rewrite prompt from file: ${filePath} (${this.prompt.length} chars)`
1572
1459
  );
1573
1460
  } else {
1574
- debugLogger4.warn(
1461
+ debugLogger3.warn(
1575
1462
  `Rewrite prompt file not found: ${filePath}, using default`
1576
1463
  );
1577
1464
  this.prompt = DEFAULT_REWRITE_PROMPT;
@@ -1608,7 +1495,7 @@ var LlmRewriter = class {
1608
1495
  const inputText = inputParts.join("\n\n");
1609
1496
  if (!inputText.trim()) return null;
1610
1497
  if (inputText.length < 10) return null;
1611
- debugLogger4.info(
1498
+ debugLogger3.info(
1612
1499
  `[REWRITE INPUT] system_prompt_len=${this.prompt.length} input_len=${inputText.length} context_turns=${this.outputHistory.length}
1613
1500
  --- INPUT TEXT ---
1614
1501
  ${inputText}
@@ -1637,10 +1524,10 @@ ${inputText}
1637
1524
  });
1638
1525
  const rewritten = result.text;
1639
1526
  if (!rewritten || rewritten.length < 5) {
1640
- debugLogger4.info(`[REWRITE OUTPUT] empty or too short, skipping`);
1527
+ debugLogger3.info(`[REWRITE OUTPUT] empty or too short, skipping`);
1641
1528
  return null;
1642
1529
  }
1643
- debugLogger4.info(
1530
+ debugLogger3.info(
1644
1531
  `[REWRITE OUTPUT] len=${rewritten.length}
1645
1532
  --- OUTPUT ---
1646
1533
  ${rewritten}
@@ -1654,7 +1541,7 @@ ${rewritten}
1654
1541
  }
1655
1542
  return rewritten;
1656
1543
  } catch (error) {
1657
- debugLogger4.warn(
1544
+ debugLogger3.warn(
1658
1545
  `LLM rewrite failed, skipping: ${error instanceof Error ? error.message : String(error)}`
1659
1546
  );
1660
1547
  return null;
@@ -1663,7 +1550,7 @@ ${rewritten}
1663
1550
  };
1664
1551
 
1665
1552
  // packages/cli/src/acp-integration/session/rewrite/MessageRewriteMiddleware.ts
1666
- var debugLogger5 = createDebugLogger("MESSAGE_REWRITE");
1553
+ var debugLogger4 = createDebugLogger("MESSAGE_REWRITE");
1667
1554
  var DEFAULT_REWRITE_TIMEOUT_MS = 3e4;
1668
1555
  var REWRITE_META_EXCLUDED_KEYS = /* @__PURE__ */ new Set([]);
1669
1556
  var MessageRewriteMiddleware = class {
@@ -1746,10 +1633,10 @@ var MessageRewriteMiddleware = class {
1746
1633
  try {
1747
1634
  const rewritten = await this.rewriter.rewrite(content, rewriteSignal);
1748
1635
  if (!rewritten) {
1749
- debugLogger5.info(`Turn ${turnIdx}: no rewrite output`);
1636
+ debugLogger4.info(`Turn ${turnIdx}: no rewrite output`);
1750
1637
  return;
1751
1638
  }
1752
- debugLogger5.info(
1639
+ debugLogger4.info(
1753
1640
  `Turn ${turnIdx}: rewritten ${rewritten.length} chars`
1754
1641
  );
1755
1642
  await this.sendUpdate({
@@ -1762,7 +1649,7 @@ var MessageRewriteMiddleware = class {
1762
1649
  }
1763
1650
  });
1764
1651
  } catch (error) {
1765
- debugLogger5.warn(
1652
+ debugLogger4.warn(
1766
1653
  `Turn ${turnIdx}: rewrite failed: ${error instanceof Error ? error.message : String(error)}`
1767
1654
  );
1768
1655
  }
@@ -1971,7 +1858,8 @@ var DaemonTodoStopGuard = class {
1971
1858
  };
1972
1859
 
1973
1860
  // packages/cli/src/acp-integration/session/Session.ts
1974
- var debugLogger6 = createDebugLogger("SESSION");
1861
+ var debugLogger5 = createDebugLogger("SESSION");
1862
+ var permissionRequestTails = /* @__PURE__ */ new WeakMap();
1975
1863
  var USER_CANCEL_ABORT_REASON = "qwen:user-cancel";
1976
1864
  var SESSION_DISPOSE_ABORT_REASON = "qwen:session-dispose";
1977
1865
  var DAEMON_RETRY_META_KEY = "qwen.daemon.retry";
@@ -2003,7 +1891,7 @@ async function finalizeToolCallPreparations(tracker, includeResolved, streamName
2003
1891
  await tracker.discard(includeResolved);
2004
1892
  } catch (error) {
2005
1893
  const message = error instanceof Error ? error.message : String(error);
2006
- debugLogger6.warn(
1894
+ debugLogger5.warn(
2007
1895
  `Failed to discard tool preparations for ${streamName}; continuing stream: ${message}`
2008
1896
  );
2009
1897
  }
@@ -2035,7 +1923,7 @@ __name(createDaemonToolLoopState, "createDaemonToolLoopState");
2035
1923
  function recordDaemonLoopDetected(config, promptId, loopType, message, loopState) {
2036
1924
  if (!loopState.loopDetected) {
2037
1925
  loopState.loopDetected = true;
2038
- debugLogger6.warn(message);
1926
+ debugLogger5.warn(message);
2039
1927
  logLoopDetected(config, new LoopDetectedEvent(loopType, promptId));
2040
1928
  }
2041
1929
  return true;
@@ -2104,7 +1992,7 @@ function isContentBlock(value) {
2104
1992
  case "resource":
2105
1993
  return isEmbeddedResourceResource(value["resource"]);
2106
1994
  default:
2107
- debugLogger6.warn(`Unknown ContentBlock type: ${value["type"]}`);
1995
+ debugLogger5.warn(`Unknown ContentBlock type: ${value["type"]}`);
2108
1996
  return false;
2109
1997
  }
2110
1998
  }
@@ -2162,7 +2050,7 @@ function hasInlineMediaContentBlock(content) {
2162
2050
  __name(hasInlineMediaContentBlock, "hasInlineMediaContentBlock");
2163
2051
  function capMidTurnDrainItems(items, fieldName) {
2164
2052
  if (items.length <= MAX_MID_TURN_DRAIN_ITEMS) return items;
2165
- debugLogger6.warn(
2053
+ debugLogger5.warn(
2166
2054
  `Mid-turn drain response had ${items.length} ${fieldName}; processing first ${MAX_MID_TURN_DRAIN_ITEMS}`
2167
2055
  );
2168
2056
  return items.slice(0, MAX_MID_TURN_DRAIN_ITEMS);
@@ -2177,7 +2065,7 @@ function getMidTurnItemDisplayTextForLog(displayText) {
2177
2065
  __name(getMidTurnItemDisplayTextForLog, "getMidTurnItemDisplayTextForLog");
2178
2066
  function getValidMidTurnContentBlocks(content, displayText) {
2179
2067
  if (!Array.isArray(content)) {
2180
- debugLogger6.warn(
2068
+ debugLogger5.warn(
2181
2069
  `Dropped invalid mid-turn item: ${getMidTurnItemDisplayTextForLog(
2182
2070
  displayText
2183
2071
  )}`
@@ -2187,7 +2075,7 @@ function getValidMidTurnContentBlocks(content, displayText) {
2187
2075
  const validBlocks = content.filter(isContentBlock);
2188
2076
  const invalidBlockCount = content.length - validBlocks.length;
2189
2077
  if (invalidBlockCount > 0) {
2190
- debugLogger6.warn(
2078
+ debugLogger5.warn(
2191
2079
  `Dropped ${invalidBlockCount} invalid mid-turn content block(s): ${getMidTurnItemDisplayTextForLog(
2192
2080
  displayText
2193
2081
  )}`
@@ -2233,7 +2121,7 @@ function parseMidTurnDrainResponse(response) {
2233
2121
  );
2234
2122
  }
2235
2123
  if (!Array.isArray(response["messages"])) {
2236
- debugLogger6.warn(
2124
+ debugLogger5.warn(
2237
2125
  `Mid-turn drain response had no recognized 'items' or 'messages' field; keys: ${Object.keys(
2238
2126
  response
2239
2127
  ).join(", ")}`
@@ -2318,21 +2206,23 @@ function parsePromptChannelDelivery(params) {
2318
2206
  __name(parsePromptChannelDelivery, "parsePromptChannelDelivery");
2319
2207
  var MAX_NOTIFICATION_QUEUE = 20;
2320
2208
  var MAX_DEFERRED_UNRELATED_CRON_QUEUE = 20;
2321
- function isExistingFile(resolved, fileExists = existsSync2, statFile = statSync2) {
2209
+ function resolveExistingFile(resolved, resolveRealPath2 = realpathSync, statFile = statSync) {
2322
2210
  try {
2323
- return fileExists(resolved) && statFile(resolved).isFile();
2211
+ const canonicalPath = resolveRealPath2(resolved);
2212
+ const stats = statFile(canonicalPath);
2213
+ return stats.isFile() || stats.isDirectory?.() ? canonicalPath : void 0;
2324
2214
  } catch {
2325
- return false;
2215
+ return void 0;
2326
2216
  }
2327
2217
  }
2328
- __name(isExistingFile, "isExistingFile");
2218
+ __name(resolveExistingFile, "resolveExistingFile");
2329
2219
  function resolveHomeLoopResolverRoots({
2330
2220
  homeQwenDir = Storage.getGlobalQwenDir(),
2331
- homeDir = os2.homedir(),
2221
+ homeDir = os.homedir(),
2332
2222
  qwenHome = process.env["QWEN_HOME"]
2333
2223
  } = {}) {
2334
2224
  return {
2335
- homeConfineRoot: (qwenHome ? homeQwenDir : homeDir) || path3.dirname(homeQwenDir),
2225
+ homeConfineRoot: (qwenHome ? homeQwenDir : homeDir) || path2.dirname(homeQwenDir),
2336
2226
  homeQwenDir
2337
2227
  };
2338
2228
  }
@@ -2371,7 +2261,7 @@ async function fireSessionPermissionDeniedForAutoMode(config, decision, outcome,
2371
2261
  callId
2372
2262
  );
2373
2263
  } catch (hookError) {
2374
- debugLogger6.warn(
2264
+ debugLogger5.warn(
2375
2265
  `PermissionDenied hook failed for tool ${callId}: ${hookError instanceof Error ? hookError.message : String(hookError)}`
2376
2266
  );
2377
2267
  }
@@ -2501,7 +2391,7 @@ async function buildAvailableCommandsSnapshot(config, abortSignal = AbortSignal.
2501
2391
  }
2502
2392
  }
2503
2393
  } catch (error) {
2504
- debugLogger6.error("Error loading available skills:", error);
2394
+ debugLogger5.error("Error loading available skills:", error);
2505
2395
  }
2506
2396
  for (const command of visibleSlashCommands) {
2507
2397
  if (command.kind !== "skill" /* SKILL */ || !command.skillDetail) {
@@ -2545,6 +2435,9 @@ var Session = class {
2545
2435
  this.installGoalTerminalObserver();
2546
2436
  this.#registerBackgroundNotificationCallbacks();
2547
2437
  this.#registerSubSessionSpawner();
2438
+ this.config.getWorkflowRunRegistry?.().setApprovalRequestCallback(
2439
+ (entry, approval, rawArgs, signal) => this.#requestWorkflowApproval(entry.runId, approval, rawArgs, signal)
2440
+ );
2548
2441
  }
2549
2442
  static {
2550
2443
  __name(this, "Session");
@@ -2631,6 +2524,7 @@ var Session = class {
2631
2524
  closeGateCompletion = null;
2632
2525
  resolveCloseGate = null;
2633
2526
  unsubscribeChatRecordingFailure;
2527
+ workflowApprovalAbortController = new AbortController();
2634
2528
  // Modular components
2635
2529
  historyReplayer;
2636
2530
  toolCallEmitter;
@@ -2656,6 +2550,106 @@ var Session = class {
2656
2550
  pendingRecoveredAgentsNotice = null;
2657
2551
  // Implement SessionContext interface
2658
2552
  sessionId;
2553
+ async #requestWorkflowApproval(runId, approval, rawArgs, approvalSignal) {
2554
+ const registry = this.config.getWorkflowRunRegistry();
2555
+ const externalToolCallId = `workflow:${this.sessionId}:${runId}:${approval.approvalId}`;
2556
+ const confirmationDetails = {
2557
+ ...approval.confirmationDetails,
2558
+ onConfirm: /* @__PURE__ */ __name(async () => {
2559
+ }, "onConfirm")
2560
+ };
2561
+ const permissionOptions = toPermissionOptions(confirmationDetails, true);
2562
+ const offeredPermissionOptions = permissionOptions.map((option) => ({
2563
+ ...option
2564
+ }));
2565
+ const content = confirmationDetails.type === "edit" ? [
2566
+ ...(confirmationDetails.warnings ?? []).map((warning) => ({
2567
+ type: "content",
2568
+ content: { type: "text", text: warning }
2569
+ })),
2570
+ ...confirmationDetails.fileDiff ? [
2571
+ {
2572
+ type: "content",
2573
+ content: {
2574
+ type: "text",
2575
+ text: confirmationDetails.fileDiff
2576
+ }
2577
+ }
2578
+ ] : []
2579
+ ] : buildPermissionRequestContent(confirmationDetails);
2580
+ const { title, locations, kind } = this.toolCallEmitter.resolveToolMetadata(
2581
+ approval.name,
2582
+ rawArgs
2583
+ );
2584
+ const params = {
2585
+ sessionId: this.sessionId,
2586
+ options: permissionOptions,
2587
+ toolCall: {
2588
+ toolCallId: externalToolCallId,
2589
+ status: "pending",
2590
+ title,
2591
+ content,
2592
+ locations,
2593
+ kind,
2594
+ rawInput: rawArgs,
2595
+ _meta: { toolName: approval.name, workflowApproval: true }
2596
+ }
2597
+ };
2598
+ const signal = AbortSignal.any([
2599
+ this.workflowApprovalAbortController.signal,
2600
+ approvalSignal
2601
+ ]);
2602
+ try {
2603
+ const response = await this.#requestPermissionQueued(params, signal);
2604
+ const outcome = resolvePermissionOutcome(
2605
+ response,
2606
+ offeredPermissionOptions
2607
+ );
2608
+ const resolved = await registry.resolvePendingApproval(
2609
+ runId,
2610
+ approval.approvalId,
2611
+ outcome === "proceed_once" /* ProceedOnce */ ? outcome : "cancel" /* Cancel */,
2612
+ void 0
2613
+ );
2614
+ await this.#finishWorkflowApprovalToolCall(
2615
+ approval,
2616
+ externalToolCallId,
2617
+ resolved && outcome === "proceed_once" /* ProceedOnce */
2618
+ );
2619
+ } catch (error) {
2620
+ debugLogger5.error("Workflow permission request failed:", error);
2621
+ await registry.resolvePendingApproval(
2622
+ runId,
2623
+ approval.approvalId,
2624
+ "cancel" /* Cancel */
2625
+ );
2626
+ await this.#finishWorkflowApprovalToolCall(
2627
+ approval,
2628
+ externalToolCallId,
2629
+ false
2630
+ );
2631
+ }
2632
+ }
2633
+ async #finishWorkflowApprovalToolCall(approval, externalToolCallId, success) {
2634
+ try {
2635
+ await this.sendUpdate({
2636
+ sessionUpdate: "tool_call_update",
2637
+ toolCallId: externalToolCallId,
2638
+ status: success ? "completed" : "failed",
2639
+ content: [],
2640
+ _meta: {
2641
+ toolName: approval.name,
2642
+ workflowApproval: true,
2643
+ approvalOutcome: success ? "approved" : "denied"
2644
+ }
2645
+ });
2646
+ } catch (error) {
2647
+ debugLogger5.warn(
2648
+ "Failed to finalize workflow approval tool call:",
2649
+ error
2650
+ );
2651
+ }
2652
+ }
2659
2653
  #prepareTodoStopGuardForPrompt(params) {
2660
2654
  if (!this.todoStopGuard.enabled) {
2661
2655
  return {
@@ -2816,7 +2810,7 @@ var Session = class {
2816
2810
  }
2817
2811
  return "unavailable";
2818
2812
  } catch (error) {
2819
- debugLogger6.warn(
2813
+ debugLogger5.warn(
2820
2814
  `Todo Stop Guard continuation claim unavailable [session ${this.sessionId}]: ${this.#formatError(error)}`
2821
2815
  );
2822
2816
  return "unavailable";
@@ -2982,7 +2976,7 @@ var Session = class {
2982
2976
  */
2983
2977
  startCronScheduler() {
2984
2978
  this.#startCronSchedulerInRuntime().catch((error) => {
2985
- debugLogger6.warn(
2979
+ debugLogger5.warn(
2986
2980
  `Cron scheduler startup failed [session ${this.sessionId}]: ${error}`
2987
2981
  );
2988
2982
  });
@@ -3025,8 +3019,8 @@ var Session = class {
3025
3019
  }
3026
3020
  this.closing = true;
3027
3021
  let resolveGate;
3028
- const completion = new Promise((resolve5) => {
3029
- resolveGate = resolve5;
3022
+ const completion = new Promise((resolve4) => {
3023
+ resolveGate = resolve4;
3030
3024
  });
3031
3025
  this.closeGateCompletion = completion;
3032
3026
  this.resolveCloseGate = resolveGate;
@@ -3066,7 +3060,7 @@ var Session = class {
3066
3060
  if (pending.length > 0) {
3067
3061
  await Promise.allSettled(pending);
3068
3062
  }
3069
- await new Promise((resolve5) => setImmediate(resolve5));
3063
+ await new Promise((resolve4) => setImmediate(resolve4));
3070
3064
  }
3071
3065
  }
3072
3066
  #deferAutomaticQueueDrainUntilTurnsSettle() {
@@ -3125,6 +3119,8 @@ var Session = class {
3125
3119
  this.unsubscribeChatRecordingFailure?.();
3126
3120
  this.unsubscribeChatRecordingFailure = void 0;
3127
3121
  this.config.setSubSessionSpawner(void 0);
3122
+ this.config.getWorkflowRunRegistry?.().setApprovalRequestCallback(void 0);
3123
+ this.workflowApprovalAbortController.abort(SESSION_DISPOSE_ABORT_REASON);
3128
3124
  clearGoalTerminalObserver(this.sessionId);
3129
3125
  }
3130
3126
  /**
@@ -3134,7 +3130,7 @@ var Session = class {
3134
3130
  installRewriter() {
3135
3131
  const rewriteConfig = loadRewriteConfig(this.settings);
3136
3132
  if (rewriteConfig?.enabled) {
3137
- debugLogger6.info("Message rewrite middleware enabled");
3133
+ debugLogger5.info("Message rewrite middleware enabled");
3138
3134
  this.messageRewriter = new MessageRewriteMiddleware(
3139
3135
  this.config,
3140
3136
  rewriteConfig,
@@ -3153,7 +3149,7 @@ var Session = class {
3153
3149
  installGoalTerminalObserver() {
3154
3150
  setGoalTerminalObserver(this.sessionId, (event) => {
3155
3151
  void this.messageEmitter.emitGoalTerminal(event).catch((error) => {
3156
- debugLogger6.warn(
3152
+ debugLogger5.warn(
3157
3153
  `Failed to emit goal terminal update: ${this.#formatError(error)}`
3158
3154
  );
3159
3155
  });
@@ -3170,7 +3166,7 @@ var Session = class {
3170
3166
  */
3171
3167
  emitGoalStatus(status) {
3172
3168
  void this.messageEmitter.emitGoalStatus(status).catch((error) => {
3173
- debugLogger6.warn(
3169
+ debugLogger5.warn(
3174
3170
  `Failed to emit goal status update: ${this.#formatError(error)}`
3175
3171
  );
3176
3172
  });
@@ -3414,8 +3410,8 @@ var Session = class {
3414
3410
  const channelDelivery = parsePromptChannelDelivery(params);
3415
3411
  const channelDeliveryCapture = channelDelivery ? { finalText: "" } : void 0;
3416
3412
  let resolveCompletion;
3417
- this.pendingPromptCompletion = new Promise((resolve5) => {
3418
- resolveCompletion = resolve5;
3413
+ this.pendingPromptCompletion = new Promise((resolve4) => {
3414
+ resolveCompletion = resolve4;
3419
3415
  });
3420
3416
  try {
3421
3417
  const result = await this.#executePrompt(
@@ -3535,7 +3531,7 @@ var Session = class {
3535
3531
  const fullHistory = chat.getHistory(true);
3536
3532
  const lastEntry = fullHistory[fullHistory.length - 1];
3537
3533
  if (!lastEntry || lastEntry.role !== "model") {
3538
- debugLogger6.debug(
3534
+ debugLogger5.debug(
3539
3535
  "Skipping followup suggestion: last history entry is not model"
3540
3536
  );
3541
3537
  return;
@@ -3571,9 +3567,9 @@ var Session = class {
3571
3567
  }
3572
3568
  } catch (error) {
3573
3569
  if (ac.signal.aborted) {
3574
- debugLogger6.debug("Follow-up suggestion generation aborted");
3570
+ debugLogger5.debug("Follow-up suggestion generation aborted");
3575
3571
  } else {
3576
- debugLogger6.warn("Follow-up suggestion generation failed", error);
3572
+ debugLogger5.warn("Follow-up suggestion generation failed", error);
3577
3573
  }
3578
3574
  } finally {
3579
3575
  if (this.followupAbort === ac) {
@@ -3643,7 +3639,7 @@ var Session = class {
3643
3639
  apiHistory: this.#getCurrentChat().getHistory()
3644
3640
  });
3645
3641
  if (!recoveryPlan.continuation) {
3646
- debugLogger6.warn(
3642
+ debugLogger5.warn(
3647
3643
  `[Session] continue ${promptId}: no interrupted turn on re-detection, nothing to continue`
3648
3644
  );
3649
3645
  logConversationFinishedEvent(
@@ -3758,10 +3754,10 @@ var Session = class {
3758
3754
  this.config.getChatRecordingService()?.recordFileHistorySnapshot(latestSnapshot);
3759
3755
  }
3760
3756
  } catch (e) {
3761
- debugLogger6.error(`FileHistory: recordSnapshot failed: ${e}`);
3757
+ debugLogger5.error(`FileHistory: recordSnapshot failed: ${e}`);
3762
3758
  }
3763
3759
  } catch (e) {
3764
- debugLogger6.error(`FileHistory: makeSnapshot failed: ${e}`);
3760
+ debugLogger5.error(`FileHistory: makeSnapshot failed: ${e}`);
3765
3761
  }
3766
3762
  const systemReminders = await this.#buildInitialSystemReminders();
3767
3763
  if (systemReminders.length > 0) {
@@ -3924,7 +3920,7 @@ ${this.pendingRecoveredAgentsNotice}
3924
3920
  const hooksEnabledForStopFailure = !this.config.getDisableAllHooks?.();
3925
3921
  if (hooksEnabledForStopFailure && hookSystem && this.config.hasHooksForEvent?.("StopFailure")) {
3926
3922
  hookSystem.fireStopFailureEvent(errorType, errorMessage).catch((err) => {
3927
- debugLogger6.warn(`StopFailure hook failed: ${err}`);
3923
+ debugLogger5.warn(`StopFailure hook failed: ${err}`);
3928
3924
  });
3929
3925
  }
3930
3926
  if (errorStatus === 429) {
@@ -4232,7 +4228,7 @@ ${this.pendingRecoveredAgentsNotice}
4232
4228
  );
4233
4229
  this.todoStopGuard.suspend();
4234
4230
  await this.messageEmitter.emitAgentMessage(warning);
4235
- debugLogger6.warn(warning);
4231
+ debugLogger5.warn(warning);
4236
4232
  return { stopReason: "end_turn" };
4237
4233
  }
4238
4234
  if (!externalReason && !guardContinuation) {
@@ -4661,7 +4657,7 @@ ${this.pendingRecoveredAgentsNotice}
4661
4657
  const hookSystem = this.config.getHookSystem?.();
4662
4658
  if (!this.config.getDisableAllHooks?.() && hookSystem && this.config.hasHooksForEvent?.("StopFailure")) {
4663
4659
  hookSystem.fireStopFailureEvent(errorType, errorMessage).catch((err) => {
4664
- debugLogger6.warn(`StopFailure hook failed: ${err}`);
4660
+ debugLogger5.warn(`StopFailure hook failed: ${err}`);
4665
4661
  });
4666
4662
  }
4667
4663
  if (errorStatus === 429) {
@@ -4793,7 +4789,7 @@ ${this.pendingRecoveredAgentsNotice}
4793
4789
  }
4794
4790
  });
4795
4791
  } catch (error) {
4796
- debugLogger6.warn(
4792
+ debugLogger5.warn(
4797
4793
  `Failed to emit Todo Stop Guard status: ${this.#formatError(error)}`
4798
4794
  );
4799
4795
  }
@@ -4809,7 +4805,7 @@ ${this.pendingRecoveredAgentsNotice}
4809
4805
  const timer = setTimeout(() => {
4810
4806
  void this.client.extMethod(SERVE_CONTROL_EXT_METHODS.channelDelivery, params).catch((error) => {
4811
4807
  try {
4812
- debugLogger6.warn(
4808
+ debugLogger5.warn(
4813
4809
  `Channel delivery submission failed: ${error instanceof Error ? error.message : String(error)}`
4814
4810
  );
4815
4811
  } catch {
@@ -4847,7 +4843,7 @@ ${this.pendingRecoveredAgentsNotice}
4847
4843
  return new MessageDisplayDispatcher(
4848
4844
  messageBus,
4849
4845
  signal,
4850
- (message) => debugLogger6.warn(message)
4846
+ (message) => debugLogger5.warn(message)
4851
4847
  );
4852
4848
  }
4853
4849
  /**
@@ -4868,7 +4864,7 @@ ${this.pendingRecoveredAgentsNotice}
4868
4864
  message = decision.message;
4869
4865
  }
4870
4866
  if (abortSignal.aborted) {
4871
- debugLogger6.debug(
4867
+ debugLogger5.debug(
4872
4868
  `Send aborted after pre-compression preparation for prompt ${promptId}`
4873
4869
  );
4874
4870
  return { responseStream: null, stopReason: "cancelled" };
@@ -4891,24 +4887,26 @@ ${this.pendingRecoveredAgentsNotice}
4891
4887
  if (compressed.compressionStatus === 1 /* COMPRESSED */) {
4892
4888
  this.loopTickResolver?.resetCache();
4893
4889
  const reasonClause = compressed.triggerReason === "image_overflow" ? `accumulated enough tool screenshots to trigger compaction for ${this.config.getModel()}` : `approached the input token limit for ${this.config.getModel()}`;
4894
- compressionDiagnostic = `IMPORTANT: This conversation ${reasonClause}. A compressed context will be sent for future messages (compressed from: ${compressed.originalTokenCount ?? "unknown"} to ${compressed.newTokenCount ?? "unknown"} tokens).`;
4890
+ const warningSuffix = compressed.warning ? `
4891
+ \u26A0\uFE0F ${compressed.warning}` : "";
4892
+ compressionDiagnostic = `IMPORTANT: This conversation ${reasonClause}. A compressed context will be sent for future messages (compressed from: ${compressed.originalTokenCount ?? "unknown"} to ${compressed.newTokenCount ?? "unknown"} tokens).` + warningSuffix;
4895
4893
  }
4896
4894
  } catch (compressionError) {
4897
4895
  if (abortSignal.aborted) {
4898
- debugLogger6.debug(`Auto-compression aborted for prompt ${promptId}`);
4896
+ debugLogger5.debug(`Auto-compression aborted for prompt ${promptId}`);
4899
4897
  return { responseStream: null, stopReason: "cancelled" };
4900
4898
  }
4901
4899
  if (this.#isAbortError(compressionError)) {
4902
4900
  throw compressionError;
4903
4901
  }
4904
- debugLogger6.warn(
4902
+ debugLogger5.warn(
4905
4903
  `Auto-compression failed for prompt ${promptId}; proceeding without compression: ` + this.#formatError(compressionError)
4906
4904
  );
4907
4905
  compressionFailed = true;
4908
4906
  }
4909
4907
  }
4910
4908
  if (abortSignal.aborted) {
4911
- debugLogger6.debug(`Auto-compression aborted for prompt ${promptId}`);
4909
+ debugLogger5.debug(`Auto-compression aborted for prompt ${promptId}`);
4912
4910
  return { responseStream: null, stopReason: "cancelled" };
4913
4911
  }
4914
4912
  if (!compressionInfo) {
@@ -4918,7 +4916,7 @@ ${this.pendingRecoveredAgentsNotice}
4918
4916
  if (sessionTokenLimit > 0) {
4919
4917
  const lastPromptTokenCount = this.#getPostCompressionTokenCount(compressionInfo);
4920
4918
  if (lastPromptTokenCount > sessionTokenLimit) {
4921
- debugLogger6.warn(
4919
+ debugLogger5.warn(
4922
4920
  `Session token limit exceeded for prompt ${promptId}: ${lastPromptTokenCount} > ${sessionTokenLimit}. Send dropped.`
4923
4921
  );
4924
4922
  await this.#emitAgentDiagnosticMessageSafely(
@@ -4935,7 +4933,7 @@ ${this.pendingRecoveredAgentsNotice}
4935
4933
  );
4936
4934
  }
4937
4935
  if (abortSignal.aborted) {
4938
- debugLogger6.debug(
4936
+ debugLogger5.debug(
4939
4937
  `Send aborted after compression diagnostic for prompt ${promptId}`
4940
4938
  );
4941
4939
  return { responseStream: null, stopReason: "cancelled" };
@@ -4948,7 +4946,7 @@ ${this.pendingRecoveredAgentsNotice}
4948
4946
  message = decision.message;
4949
4947
  }
4950
4948
  if (abortSignal.aborted) {
4951
- debugLogger6.debug(
4949
+ debugLogger5.debug(
4952
4950
  `Send aborted after pre-send validation for prompt ${promptId}`
4953
4951
  );
4954
4952
  return { responseStream: null, stopReason: "cancelled" };
@@ -4976,7 +4974,7 @@ ${this.pendingRecoveredAgentsNotice}
4976
4974
  ) ?? [];
4977
4975
  const droppedParts = (message.parts?.length ?? 0) - functionResponseParts.length;
4978
4976
  if (droppedParts > 0) {
4979
- debugLogger6.debug(
4977
+ debugLogger5.debug(
4980
4978
  `Dropping ${droppedParts} non-functionResponse part(s) from unsent ACP message after send was skipped.`
4981
4979
  );
4982
4980
  }
@@ -5008,12 +5006,12 @@ ${this.pendingRecoveredAgentsNotice}
5008
5006
  }
5009
5007
  async #buildNextMessageAfterToolRun(toolRun, abortSignal, promptId, onFullTurnModel) {
5010
5008
  if (toolRun.loopDetected) {
5011
- debugLogger6.debug("Stopping ACP turn after daemon loop detection.");
5009
+ debugLogger5.debug("Stopping ACP turn after daemon loop detection.");
5012
5010
  return { message: null, hadMidTurnUserInput: false };
5013
5011
  }
5014
5012
  if (toolRun.repeatedDuplicateProviderToolCall) {
5015
5013
  this.todoStopGuard.suspend();
5016
- debugLogger6.debug(
5014
+ debugLogger5.debug(
5017
5015
  "Stopping ACP turn after dropping repeated duplicate provider tool-call response."
5018
5016
  );
5019
5017
  return { message: null, hadMidTurnUserInput: false };
@@ -5103,7 +5101,7 @@ ${this.pendingRecoveredAgentsNotice}
5103
5101
  try {
5104
5102
  await this.#emitAgentDiagnosticMessage(text);
5105
5103
  } catch (notifyError) {
5106
- debugLogger6.warn(`${failureContext}: ${this.#formatError(notifyError)}`);
5104
+ debugLogger5.warn(`${failureContext}: ${this.#formatError(notifyError)}`);
5107
5105
  }
5108
5106
  }
5109
5107
  async #emitAgentDiagnosticMessage(text) {
@@ -5169,7 +5167,7 @@ ${this.pendingRecoveredAgentsNotice}
5169
5167
  if (isPermanentError) {
5170
5168
  this.midTurnDrainUnavailable = true;
5171
5169
  }
5172
- debugLogger6.warn(
5170
+ debugLogger5.warn(
5173
5171
  `Mid-turn queue drain ${isPermanentError ? "permanently " : ""}unavailable [session ${this.sessionId}]: ${errorMessage}`
5174
5172
  );
5175
5173
  return {
@@ -5199,9 +5197,9 @@ ${this.pendingRecoveredAgentsNotice}
5199
5197
  });
5200
5198
  const expired = Symbol("mid-turn-recovery-expired");
5201
5199
  let timer;
5202
- const deadline = new Promise((resolve5) => {
5200
+ const deadline = new Promise((resolve4) => {
5203
5201
  timer = setTimeout(
5204
- () => resolve5(expired),
5202
+ () => resolve4(expired),
5205
5203
  MID_TURN_QUEUE_RECOVERY_TIMEOUT_MS
5206
5204
  );
5207
5205
  timer.unref?.();
@@ -5215,14 +5213,14 @@ ${this.pendingRecoveredAgentsNotice}
5215
5213
  clearTimeout(timer);
5216
5214
  }
5217
5215
  if (late === expired) {
5218
- debugLogger6.warn(
5216
+ debugLogger5.warn(
5219
5217
  `[mid-turn] dropped a drain response that arrived after the ${MID_TURN_QUEUE_RECOVERY_TIMEOUT_MS}ms recovery deadline [session ${this.sessionId}]`
5220
5218
  );
5221
5219
  return;
5222
5220
  }
5223
5221
  const lateMessages = parseMidTurnDrainResponse(late);
5224
5222
  if (lateMessages.length > 0) {
5225
- debugLogger6.debug(
5223
+ debugLogger5.debug(
5226
5224
  `[mid-turn] recovered ${lateMessages.length} message(s) from a timed-out drain [session ${this.sessionId}]`
5227
5225
  );
5228
5226
  this.midTurnRecoveredMessages.push(...lateMessages);
@@ -5253,7 +5251,7 @@ ${this.pendingRecoveredAgentsNotice}
5253
5251
  }
5254
5252
  if (!abortSignal.aborted) {
5255
5253
  const errorMessage = this.#formatError(messageError);
5256
- debugLogger6.warn(
5254
+ debugLogger5.warn(
5257
5255
  `Failed to resolve mid-turn message: ${errorMessage}`
5258
5256
  );
5259
5257
  }
@@ -5281,7 +5279,7 @@ ${this.pendingRecoveredAgentsNotice}
5281
5279
  try {
5282
5280
  await scheduler.enableDurable(this.sessionId);
5283
5281
  } catch (err) {
5284
- debugLogger6.warn(
5282
+ debugLogger5.warn(
5285
5283
  `Durable cron init failed \u2014 persistent tasks will not fire in this session: ${err}`
5286
5284
  );
5287
5285
  }
@@ -5344,7 +5342,7 @@ ${this.pendingRecoveredAgentsNotice}
5344
5342
  unrelatedCount--;
5345
5343
  }
5346
5344
  if (evictedTaskIds.length > 0) {
5347
- debugLogger6.warn(
5345
+ debugLogger5.warn(
5348
5346
  `Cron queue overflow while automatic work is deferred: evicted ${evictedTaskIds.length} unrelated task(s): ${evictedTaskIds.join(", ")}`
5349
5347
  );
5350
5348
  }
@@ -5367,7 +5365,7 @@ ${this.pendingRecoveredAgentsNotice}
5367
5365
  try {
5368
5366
  await this.assertCanStartTurn();
5369
5367
  } catch (error) {
5370
- debugLogger6.warn(
5368
+ debugLogger5.warn(
5371
5369
  `Cron turn rejected [session ${this.sessionId}]: ${error instanceof Error ? error.message : String(error)}`
5372
5370
  );
5373
5371
  return;
@@ -5378,8 +5376,8 @@ ${this.pendingRecoveredAgentsNotice}
5378
5376
  if (this.#deferAutomaticQueueDrainUntilTurnsSettle()) return;
5379
5377
  this.cronProcessing = true;
5380
5378
  let resolveCompletion;
5381
- this.cronCompletion = new Promise((resolve5) => {
5382
- resolveCompletion = resolve5;
5379
+ this.cronCompletion = new Promise((resolve4) => {
5380
+ resolveCompletion = resolve4;
5383
5381
  });
5384
5382
  try {
5385
5383
  while (this.cronQueue.length > 0) {
@@ -5484,7 +5482,7 @@ ${this.pendingRecoveredAgentsNotice}
5484
5482
  loopTick = await resolver.resolve(loopMode, trustedAtResolve);
5485
5483
  } catch (resolveErr) {
5486
5484
  const code = resolveErr.code ?? "unknown";
5487
- debugLogger6.warn(
5485
+ debugLogger5.warn(
5488
5486
  `loop.md sentinel resolution failed (mode=${loopMode}, code=${code}) \u2014 check .qwen/loop.md permissions/IO`,
5489
5487
  resolveErr
5490
5488
  );
@@ -5507,7 +5505,7 @@ ${this.pendingRecoveredAgentsNotice}
5507
5505
  }
5508
5506
  const modelText = loopTick ? loopTick.modelText : prompt;
5509
5507
  if (loopTick) {
5510
- debugLogger6.debug(
5508
+ debugLogger5.debug(
5511
5509
  `loop tick: mode=${loopMode ?? autonomousMode} delivery=${loopTick.full ? "full" : loopTick.transientError ? "transient-error" : loopTick.autonomous ? "autonomous-tick" : loopTick.sourceLabel ? "reminder" : "absent"} source=${loopTick.sourceLabel ?? "none"} autonomous=${loopTick.autonomous ?? false} transient=${loopTick.transientError ?? false}`
5512
5510
  );
5513
5511
  }
@@ -5705,7 +5703,7 @@ ${this.pendingRecoveredAgentsNotice}
5705
5703
  }
5706
5704
  this.todoStopGuard.pauseForTrustedRetry();
5707
5705
  cronHadError = true;
5708
- debugLogger6.error("Error processing cron prompt:", error);
5706
+ debugLogger5.error("Error processing cron prompt:", error);
5709
5707
  const msg = error instanceof Error ? error.message : String(error);
5710
5708
  await this.messageEmitter.emitAgentMessage(
5711
5709
  `[${item.source} error] ${msg}`
@@ -5831,20 +5829,20 @@ ${this.pendingRecoveredAgentsNotice}
5831
5829
  (queued) => !this.#notificationContinuesTodoStopGuardWorkChain(queued)
5832
5830
  );
5833
5831
  if (evictedIndex < 0 && !incomingIsRelated) {
5834
- debugLogger6.warn(
5832
+ debugLogger5.warn(
5835
5833
  `Notification queue overflow: dropping unrelated task=${item.taskId} kind=${item.kind} while automatic work is deferred`
5836
5834
  );
5837
5835
  return;
5838
5836
  }
5839
5837
  if (evictedIndex < 0) {
5840
- debugLogger6.warn(
5838
+ debugLogger5.warn(
5841
5839
  `Notification queue overflow: dropping related task=${item.taskId} kind=${item.kind} because all queued items are related`
5842
5840
  );
5843
5841
  return;
5844
5842
  }
5845
5843
  }
5846
5844
  const [evicted] = this.notificationQueue.splice(evictedIndex, 1);
5847
- debugLogger6.warn(
5845
+ debugLogger5.warn(
5848
5846
  `Notification queue overflow: evicting task=${evicted?.taskId ?? "unknown"} kind=${evicted?.kind ?? "unknown"}`
5849
5847
  );
5850
5848
  }
@@ -5864,7 +5862,7 @@ ${this.pendingRecoveredAgentsNotice}
5864
5862
  try {
5865
5863
  await this.assertCanStartTurn();
5866
5864
  } catch (error) {
5867
- debugLogger6.warn(
5865
+ debugLogger5.warn(
5868
5866
  `Notification turn rejected [session ${this.sessionId}]: ${error instanceof Error ? error.message : String(error)}`
5869
5867
  );
5870
5868
  return;
@@ -5875,8 +5873,8 @@ ${this.pendingRecoveredAgentsNotice}
5875
5873
  if (this.#deferAutomaticQueueDrainUntilTurnsSettle()) return;
5876
5874
  this.notificationProcessing = true;
5877
5875
  let resolveCompletion;
5878
- this.notificationCompletion = new Promise((resolve5) => {
5879
- resolveCompletion = resolve5;
5876
+ this.notificationCompletion = new Promise((resolve4) => {
5877
+ resolveCompletion = resolve4;
5880
5878
  });
5881
5879
  try {
5882
5880
  while (this.notificationQueue.length > 0) {
@@ -6116,14 +6114,14 @@ ${this.pendingRecoveredAgentsNotice}
6116
6114
  return;
6117
6115
  }
6118
6116
  this.todoStopGuard.pauseForTrustedRetry();
6119
- debugLogger6.error("Error processing background notification:", error);
6117
+ debugLogger5.error("Error processing background notification:", error);
6120
6118
  const msg = error instanceof Error ? error.message : String(error);
6121
6119
  try {
6122
6120
  await this.messageEmitter.emitAgentMessage(
6123
6121
  `[notification error] ${msg}`
6124
6122
  );
6125
6123
  } catch (emitError) {
6126
- debugLogger6.error(
6124
+ debugLogger5.error(
6127
6125
  "Failed to emit background notification error:",
6128
6126
  emitError
6129
6127
  );
@@ -6184,7 +6182,7 @@ ${this.pendingRecoveredAgentsNotice}
6184
6182
  source: "background_notification"
6185
6183
  });
6186
6184
  } catch (error) {
6187
- debugLogger6.debug(
6185
+ debugLogger5.debug(
6188
6186
  `Background notification end-turn extNotification dropped: ${this.#formatError(error)}`
6189
6187
  );
6190
6188
  }
@@ -6193,7 +6191,7 @@ ${this.pendingRecoveredAgentsNotice}
6193
6191
  try {
6194
6192
  await this.sendAvailableCommandsUpdateOrThrow();
6195
6193
  } catch (error) {
6196
- debugLogger6.error("Error sending available commands update:", error);
6194
+ debugLogger5.error("Error sending available commands update:", error);
6197
6195
  }
6198
6196
  }
6199
6197
  async refreshSkillsFromSettings(options = {}) {
@@ -6215,7 +6213,7 @@ ${this.pendingRecoveredAgentsNotice}
6215
6213
  await skillManager.notifyConfigChanged();
6216
6214
  } catch (error) {
6217
6215
  if (!updateFailed) throw error;
6218
- debugLogger6.error(
6216
+ debugLogger5.error(
6219
6217
  "SkillManager refresh failed after command update failure:",
6220
6218
  error
6221
6219
  );
@@ -6251,6 +6249,32 @@ ${this.pendingRecoveredAgentsNotice}
6251
6249
  async requestPermission(params) {
6252
6250
  return this.client.requestPermission(params);
6253
6251
  }
6252
+ #requestPermissionQueued(params, signal) {
6253
+ const prior = permissionRequestTails.get(this.client) ?? Promise.resolve();
6254
+ const transportRequest = prior.then(
6255
+ () => signal.aborted ? requestPermissionWithAbort(this.client, params, signal) : this.client.requestPermission(params)
6256
+ );
6257
+ let abortListener;
6258
+ const tail = Promise.race([
6259
+ transportRequest.then(
6260
+ () => void 0,
6261
+ () => void 0
6262
+ ),
6263
+ new Promise((resolve4) => {
6264
+ if (signal.aborted) return resolve4();
6265
+ abortListener = /* @__PURE__ */ __name(() => resolve4(), "abortListener");
6266
+ signal.addEventListener("abort", abortListener, { once: true });
6267
+ })
6268
+ ]).finally(() => {
6269
+ if (abortListener) signal.removeEventListener("abort", abortListener);
6270
+ });
6271
+ permissionRequestTails.set(this.client, tail);
6272
+ return requestPermissionWithAbort(
6273
+ { requestPermission: /* @__PURE__ */ __name(() => transportRequest, "requestPermission") },
6274
+ params,
6275
+ signal
6276
+ );
6277
+ }
6254
6278
  /**
6255
6279
  * Sets the approval mode for the current session.
6256
6280
  * Maps ACP approval mode values to core ApprovalMode enum.
@@ -6279,7 +6303,7 @@ ${this.pendingRecoveredAgentsNotice}
6279
6303
  sessionId: this.sessionId,
6280
6304
  currentModeId: params.modeId
6281
6305
  }).catch((error) => {
6282
- debugLogger6.debug("mode-update extNotification failed", error);
6306
+ debugLogger5.debug("mode-update extNotification failed", error);
6283
6307
  });
6284
6308
  }
6285
6309
  /**
@@ -6335,7 +6359,7 @@ ${this.pendingRecoveredAgentsNotice}
6335
6359
  sessionId: this.sessionId,
6336
6360
  currentModelId: currentAcpModelId
6337
6361
  }).catch((error) => {
6338
- debugLogger6.debug("model-update extNotification failed", error);
6362
+ debugLogger5.debug("model-update extNotification failed", error);
6339
6363
  });
6340
6364
  if (options.persistDefault ?? true) {
6341
6365
  const persistScope = getPersistScopeForModelSelection(this.settings);
@@ -6382,7 +6406,7 @@ ${this.pendingRecoveredAgentsNotice}
6382
6406
  await this.sendUpdate(update);
6383
6407
  legacyFrameSent = true;
6384
6408
  } catch (error) {
6385
- debugLogger6.debug("current_mode_update notification failed", error);
6409
+ debugLogger5.debug("current_mode_update notification failed", error);
6386
6410
  }
6387
6411
  try {
6388
6412
  await this.client.extNotification("qwen/notify/session/mode-update", {
@@ -6392,7 +6416,7 @@ ${this.pendingRecoveredAgentsNotice}
6392
6416
  legacyFrameSent
6393
6417
  });
6394
6418
  } catch (error) {
6395
- debugLogger6.debug("mode-update extNotification failed", error);
6419
+ debugLogger5.debug("mode-update extNotification failed", error);
6396
6420
  }
6397
6421
  }
6398
6422
  /**
@@ -6484,7 +6508,7 @@ ${this.pendingRecoveredAgentsNotice}
6484
6508
  }
6485
6509
  await this.toolCallEmitter.emitError(callId, toolName, error);
6486
6510
  } catch (recordError) {
6487
- debugLogger6.error("Failed to record skipped tool call:", recordError);
6511
+ debugLogger5.error("Failed to record skipped tool call:", recordError);
6488
6512
  }
6489
6513
  return part;
6490
6514
  }, "recordSkippedToolCall");
@@ -6516,7 +6540,7 @@ ${this.pendingRecoveredAgentsNotice}
6516
6540
  );
6517
6541
  if (repeatedDuplicateCall) {
6518
6542
  const providerCallId = getProviderToolCallId(repeatedDuplicateCall) ?? repeatedDuplicateCall.id;
6519
- debugLogger6.debug(
6543
+ debugLogger5.debug(
6520
6544
  `[Session.runToolCalls] Dropping batch after repeated duplicate provider tool-call id: ${providerCallId} (tool: ${repeatedDuplicateCall.name ?? "unknown_tool"})`
6521
6545
  );
6522
6546
  return await finalizeRunToolResult({
@@ -6532,7 +6556,7 @@ ${this.pendingRecoveredAgentsNotice}
6532
6556
  this.duplicateProviderToolCallResponseIds
6533
6557
  );
6534
6558
  const response = createDuplicateProviderToolCallResponse(request);
6535
- debugLogger6.debug(
6559
+ debugLogger5.debug(
6536
6560
  `[Session.runToolCalls] Suppressing duplicate provider tool-call id: ${providerCallId} (tool: ${request.name})`
6537
6561
  );
6538
6562
  batches.push({ kind: "duplicate", fc, request, response });
@@ -6981,10 +7005,10 @@ ${this.pendingRecoveredAgentsNotice}
6981
7005
  responseParts: errorParts,
6982
7006
  metadata: {
6983
7007
  callId,
6984
- status: "error",
7008
+ status: opts?.status ?? "error",
6985
7009
  resultDisplay: void 0,
6986
7010
  error,
6987
- errorType: void 0
7011
+ errorType: opts?.errorType
6988
7012
  }
6989
7013
  });
6990
7014
  const loopDetected = opts?.recordInvalidToolParams === true && !activeToolAbortSignal.aborted && !opts?.stopAfterPermissionCancel && recordDaemonInvalidToolParams(
@@ -7068,10 +7092,8 @@ ${this.pendingRecoveredAgentsNotice}
7068
7092
  let toolBuildSucceeded = false;
7069
7093
  try {
7070
7094
  const invocation = tool.build(args);
7071
- if (policyToolName === ToolNames.MONITOR) {
7072
- const callIdAware = invocation;
7073
- callIdAware.setCallId?.(callId);
7074
- }
7095
+ const callIdAware = invocation;
7096
+ callIdAware.setCallId?.(callId);
7075
7097
  toolBuildSucceeded = true;
7076
7098
  const taskEventEmitter = invocation.eventEmitter;
7077
7099
  if (isAgentTool && taskEventEmitter) {
@@ -7086,7 +7108,8 @@ ${this.pendingRecoveredAgentsNotice}
7086
7108
  nestedPermissionCancelled = true;
7087
7109
  agentToolAbortController?.abort(USER_CANCEL_ABORT_REASON);
7088
7110
  onStopAfterPermissionCancel?.();
7089
- }
7111
+ },
7112
+ (params, signal) => this.#requestPermissionQueued(params, signal)
7090
7113
  );
7091
7114
  subAgentCleanupFunctions = subSubAgentTracker.setup(
7092
7115
  taskEventEmitter,
@@ -7164,7 +7187,7 @@ ${this.pendingRecoveredAgentsNotice}
7164
7187
  forceAutoReviewForAllow
7165
7188
  );
7166
7189
  if (finalPermission === "allow" && forceAutoReviewForAllow) {
7167
- debugLogger6.info(
7190
+ debugLogger5.info(
7168
7191
  `Auto mode: L4 allow overridden by protected-write guard for ${policyToolName}`
7169
7192
  );
7170
7193
  }
@@ -7208,7 +7231,7 @@ ${this.pendingRecoveredAgentsNotice}
7208
7231
  autoModeAllowed = true;
7209
7232
  break;
7210
7233
  case "blocked":
7211
- debugLogger6.warn(
7234
+ debugLogger5.warn(
7212
7235
  `Auto mode blocked (${outcome.reason}): tool=${policyToolName}, ` + formatDenialStateLog(denialState)
7213
7236
  );
7214
7237
  return earlyErrorResponse(
@@ -7219,7 +7242,7 @@ ${this.pendingRecoveredAgentsNotice}
7219
7242
  wasAutoModeManualFallback = isDenialFallbackReason(outcome.reason) || outcome.reason === "classifier_unavailable";
7220
7243
  autoModeFallbackMessage = outcome.message;
7221
7244
  if (wasAutoModeManualFallback) {
7222
- debugLogger6.warn(
7245
+ debugLogger5.warn(
7223
7246
  `Auto mode fallback to manual approval (${outcome.reason}): ` + formatDenialStateLog(denialState)
7224
7247
  );
7225
7248
  }
@@ -7237,12 +7260,12 @@ ${this.pendingRecoveredAgentsNotice}
7237
7260
  const before = this.config.getAutoModeDenialState();
7238
7261
  const after = recordFallbackApprove(before);
7239
7262
  if (after === before) {
7240
- debugLogger6.warn(
7263
+ debugLogger5.warn(
7241
7264
  `Auto mode denial counters already clear after fallback approval: ` + formatDenialStateLog(before)
7242
7265
  );
7243
7266
  return;
7244
7267
  }
7245
- debugLogger6.warn(
7268
+ debugLogger5.warn(
7246
7269
  `Auto mode denial counters reset after fallback approval: ${formatDenialStateLog(before)} -> ${formatDenialStateLog(after)}`
7247
7270
  );
7248
7271
  this.config.setAutoModeDenialState(after);
@@ -7439,8 +7462,7 @@ ${this.pendingRecoveredAgentsNotice}
7439
7462
  let output;
7440
7463
  let outcome;
7441
7464
  try {
7442
- output = await requestPermissionWithAbort(
7443
- this.client,
7465
+ output = await this.#requestPermissionQueued(
7444
7466
  params,
7445
7467
  activeToolAbortSignal
7446
7468
  );
@@ -7449,7 +7471,7 @@ ${this.pendingRecoveredAgentsNotice}
7449
7471
  offeredPermissionOptions
7450
7472
  );
7451
7473
  } catch (error) {
7452
- debugLogger6.error(
7474
+ debugLogger5.error(
7453
7475
  `Permission request failed for tool ${toolName}:`,
7454
7476
  error
7455
7477
  );
@@ -7458,7 +7480,7 @@ ${this.pendingRecoveredAgentsNotice}
7458
7480
  "cancel" /* Cancel */
7459
7481
  );
7460
7482
  } catch (confirmError) {
7461
- debugLogger6.error(
7483
+ debugLogger5.error(
7462
7484
  `Failed to cancel tool ${toolName} after permission request failure:`,
7463
7485
  confirmError
7464
7486
  );
@@ -7505,7 +7527,7 @@ ${this.pendingRecoveredAgentsNotice}
7505
7527
  if (outcome !== "cancel" /* Cancel */) {
7506
7528
  throw error;
7507
7529
  }
7508
- debugLogger6.error(
7530
+ debugLogger5.error(
7509
7531
  `Failed to confirm cancellation for tool ${toolName}:`,
7510
7532
  error
7511
7533
  );
@@ -7582,11 +7604,37 @@ ${this.pendingRecoveredAgentsNotice}
7582
7604
  return earlyErrorResponse(new Error(blockReason), toolName);
7583
7605
  }
7584
7606
  if (preHookResult.additionalContext) {
7585
- debugLogger6.debug(
7607
+ debugLogger5.debug(
7586
7608
  `PreToolUse hook additional context for ${toolName}: ${preHookResult.additionalContext}`
7587
7609
  );
7588
7610
  }
7589
7611
  }
7612
+ const toolInvocationGuard = this.config.getToolInvocationGuard?.();
7613
+ if (toolInvocationGuard) {
7614
+ const guardDecision = await evaluateToolInvocationGuard(
7615
+ toolInvocationGuard,
7616
+ {
7617
+ callId,
7618
+ toolName: policyToolName,
7619
+ args: invocation.params,
7620
+ signal: activeToolAbortSignal
7621
+ }
7622
+ );
7623
+ if (activeToolAbortSignal.aborted) {
7624
+ return earlyErrorResponse(
7625
+ new Error("Tool invocation was cancelled"),
7626
+ toolName,
7627
+ { status: "cancelled" }
7628
+ );
7629
+ }
7630
+ if (!guardDecision.allowed) {
7631
+ return earlyErrorResponse(
7632
+ new Error(guardDecision.reason),
7633
+ toolName,
7634
+ { errorType: "execution_denied" /* EXECUTION_DENIED */ }
7635
+ );
7636
+ }
7637
+ }
7590
7638
  const continuedAgentId = toolName === ToolNames.SEND_MESSAGE && typeof args["task_id"] === "string" && args["task_id"].length > 0 ? args["task_id"] : void 0;
7591
7639
  const provisionalRelatedAgent = continuedAgentId !== void 0 && !this.relatedAgentIds.has(continuedAgentId);
7592
7640
  if (provisionalRelatedAgent) {
@@ -7633,7 +7681,7 @@ ${this.pendingRecoveredAgentsNotice}
7633
7681
  status: "in_progress",
7634
7682
  _meta: { toolName, shellProgress: chunk }
7635
7683
  }).catch((err) => {
7636
- debugLogger6.debug(
7684
+ debugLogger5.debug(
7637
7685
  `[Session.runTool] heartbeat update failed for ${callId}: ${err}`
7638
7686
  );
7639
7687
  });
@@ -7659,7 +7707,7 @@ ${this.pendingRecoveredAgentsNotice}
7659
7707
  invocation.params
7660
7708
  );
7661
7709
  } catch {
7662
- debugLogger6.debug(
7710
+ debugLogger5.debug(
7663
7711
  "[Session.runTool] Failed to record tool arguments telemetry"
7664
7712
  );
7665
7713
  }
@@ -7734,7 +7782,7 @@ ${this.pendingRecoveredAgentsNotice}
7734
7782
  );
7735
7783
  if (postHookResult.shouldStop) {
7736
7784
  const stopMessage = postHookResult.stopReason || "Execution stopped by PostToolUse hook";
7737
- debugLogger6.info(
7785
+ debugLogger5.info(
7738
7786
  `PostToolUse hook requested stop for ${toolName}: ${stopMessage}`
7739
7787
  );
7740
7788
  this.todoStopGuard.suspend();
@@ -7764,7 +7812,7 @@ ${this.pendingRecoveredAgentsNotice}
7764
7812
  callId
7765
7813
  );
7766
7814
  if (failureHookResult.additionalContext) {
7767
- debugLogger6.debug(
7815
+ debugLogger5.debug(
7768
7816
  `PostToolUseFailure hook additional context for ${toolName}: ${failureHookResult.additionalContext}`
7769
7817
  );
7770
7818
  }
@@ -7788,14 +7836,14 @@ ${this.pendingRecoveredAgentsNotice}
7788
7836
  await this.messageEmitter.emitAgentMessage(visionBridgeNotice);
7789
7837
  }
7790
7838
  if (isTodoWriteTool) {
7791
- const todos = this.planEmitter.extractTodos(
7839
+ const plan = this.planEmitter.extractPlan(
7792
7840
  toolResult.returnDisplay,
7793
- args
7841
+ succeeded ? args : void 0
7794
7842
  );
7795
- if (todos && todos.length > 0 || Array.isArray(args["todos"])) {
7796
- await this.planEmitter.emitPlan(todos ?? []);
7843
+ if (plan && (plan.todos.length > 0 || Array.isArray(args["todos"]))) {
7844
+ await this.planEmitter.emitPlan(plan, callId);
7797
7845
  }
7798
- } else {
7846
+ } else if (!isTodoWriteTool) {
7799
7847
  await this.toolCallEmitter.emitResult({
7800
7848
  callId,
7801
7849
  toolName,
@@ -7844,7 +7892,7 @@ ${this.pendingRecoveredAgentsNotice}
7844
7892
  try {
7845
7893
  addToolCallResultAttributes(this.config, toolSpan, result);
7846
7894
  } catch {
7847
- debugLogger6.debug(
7895
+ debugLogger5.debug(
7848
7896
  "[Session.runTool] Failed to record tool result telemetry"
7849
7897
  );
7850
7898
  }
@@ -7886,7 +7934,7 @@ ${this.pendingRecoveredAgentsNotice}
7886
7934
  callId
7887
7935
  );
7888
7936
  if (failureHookResult.additionalContext) {
7889
- debugLogger6.debug(
7937
+ debugLogger5.debug(
7890
7938
  `PostToolUseFailure hook additional context for ${toolName}: ${failureHookResult.additionalContext}`
7891
7939
  );
7892
7940
  }
@@ -8036,7 +8084,7 @@ ${this.pendingRecoveredAgentsNotice}
8036
8084
  const embeddedContext = [];
8037
8085
  const extensionMentions = /* @__PURE__ */ new Map();
8038
8086
  const mcpServerMentions = /* @__PURE__ */ new Map();
8039
- const textPathSpecsToRead = /* @__PURE__ */ new Set();
8087
+ const textPathSpecsToRead = /* @__PURE__ */ new Map();
8040
8088
  const preserveUnsupportedImageForBridge = shouldRunVisionBridge(
8041
8089
  this.config
8042
8090
  );
@@ -8046,13 +8094,16 @@ ${this.pendingRecoveredAgentsNotice}
8046
8094
  collectExtensionMentionRefs(part.text, extensionMentions);
8047
8095
  collectMcpServerMentionRefs(part.text, mcpServerMentions);
8048
8096
  for (const pathSpec of extractAtPathCommands(part.text)) {
8049
- const resolved = path3.resolve(
8097
+ if (!path2.isAbsolute(pathSpec)) continue;
8098
+ const resolved = path2.resolve(
8050
8099
  this.config.getProjectRoot(),
8051
8100
  pathSpec
8052
8101
  );
8053
- const filteringOptions = this.config.getFileFilteringOptions();
8054
- if (path3.isAbsolute(pathSpec) && getSpecificMimeType(resolved)?.startsWith("image/") && isExistingFile(resolved) && this.config.getWorkspaceContext().isPathWithinWorkspace(pathSpec) && !this.config.getFileService().shouldIgnoreFile(pathSpec, filteringOptions)) {
8055
- textPathSpecsToRead.add(pathSpec);
8102
+ const canonicalPath = resolveExistingFile(resolved);
8103
+ if (!canonicalPath) continue;
8104
+ const filteringOptions2 = this.config.getFileFilteringOptions();
8105
+ if (getSpecificMimeType(canonicalPath)?.startsWith("image/") && this.config.getWorkspaceContext().isPathWithinWorkspace(canonicalPath) && !this.config.getFileService().shouldIgnoreFile(pathSpec, filteringOptions2) && !this.config.getFileService().shouldIgnoreFile(canonicalPath, filteringOptions2)) {
8106
+ textPathSpecsToRead.set(canonicalPath, pathSpec);
8056
8107
  }
8057
8108
  }
8058
8109
  return { text: part.text };
@@ -8102,34 +8153,62 @@ ${this.pendingRecoveredAgentsNotice}
8102
8153
  }
8103
8154
  });
8104
8155
  const atPathCommandParts = parts.filter((part) => "fileData" in part);
8105
- const pathSpecsToRead = [
8106
- .../* @__PURE__ */ new Set([
8107
- ...textPathSpecsToRead,
8108
- ...atPathCommandParts.map((part) => part.fileData.fileUri)
8109
- ])
8110
- ];
8111
8156
  const extensionParts = await this.#resolveExtensionMentionParts(
8112
8157
  extensionMentions,
8113
8158
  abortSignal
8114
8159
  );
8115
8160
  const mcpServerParts = this.#resolveMcpServerMentionParts(mcpServerMentions);
8161
+ const revalidatedTextPaths = [];
8162
+ const validatedPathIdentities = /* @__PURE__ */ new Map();
8163
+ const candidatePathsToRead = [
8164
+ ...textPathSpecsToRead.entries(),
8165
+ ...atPathCommandParts.flatMap((part) => {
8166
+ const fileUri = part.fileData.fileUri;
8167
+ const resolved = path2.resolve(this.config.getTargetDir(), fileUri);
8168
+ const canonicalPath = resolveExistingFile(resolved);
8169
+ return canonicalPath ? [[canonicalPath, fileUri]] : [];
8170
+ })
8171
+ ];
8172
+ const filteringOptions = candidatePathsToRead.length > 0 ? this.config.getFileFilteringOptions() : void 0;
8173
+ const displayPaths = /* @__PURE__ */ new Map();
8174
+ const acceptedFileUris = /* @__PURE__ */ new Set();
8175
+ for (const [textPath, displayPath] of candidatePathsToRead) {
8176
+ try {
8177
+ if (resolveExistingFile(textPath) !== textPath || !this.config.getWorkspaceContext().isPathWithinWorkspace(textPath) || textPathSpecsToRead.has(textPath) && !getSpecificMimeType(textPath)?.startsWith("image/") || this.config.getFileService().shouldIgnoreFile(displayPath, filteringOptions) || this.config.getFileService().shouldIgnoreFile(textPath, filteringOptions)) {
8178
+ continue;
8179
+ }
8180
+ const stats = statSync(textPath);
8181
+ revalidatedTextPaths.push(textPath);
8182
+ displayPaths.set(textPath, displayPath);
8183
+ acceptedFileUris.add(displayPath);
8184
+ validatedPathIdentities.set(textPath, {
8185
+ dev: stats.dev,
8186
+ ino: stats.ino
8187
+ });
8188
+ } catch {
8189
+ }
8190
+ }
8191
+ const pathSpecsToRead = [...new Set(revalidatedTextPaths)];
8192
+ const partsToSend = parts.filter(
8193
+ (part) => !("fileData" in part) || acceptedFileUris.has(part.fileData.fileUri)
8194
+ );
8116
8195
  if (pathSpecsToRead.length === 0 && embeddedContext.length === 0 && extensionParts.length === 0 && mcpServerParts.length === 0) {
8117
8196
  return this.#applyBridgeConversionsIfNeeded(
8118
- parts,
8197
+ partsToSend,
8119
8198
  abortSignal,
8120
8199
  options.onFullTurnModel
8121
8200
  );
8122
8201
  }
8123
8202
  if (pathSpecsToRead.length === 0 && embeddedContext.length === 0) {
8124
8203
  return this.#applyBridgeConversionsIfNeeded(
8125
- [...parts, ...extensionParts, ...mcpServerParts],
8204
+ [...partsToSend, ...extensionParts, ...mcpServerParts],
8126
8205
  abortSignal,
8127
8206
  options.onFullTurnModel
8128
8207
  );
8129
8208
  }
8130
8209
  let initialQueryText = "";
8131
- for (let i = 0; i < parts.length; i++) {
8132
- const chunk = parts[i];
8210
+ for (let i = 0; i < partsToSend.length; i++) {
8211
+ const chunk = partsToSend[i];
8133
8212
  if ("text" in chunk) {
8134
8213
  initialQueryText += chunk.text;
8135
8214
  } else if ("fileData" in chunk) {
@@ -8145,7 +8224,9 @@ ${this.pendingRecoveredAgentsNotice}
8145
8224
  const readResult = await readManyFiles(this.config, {
8146
8225
  paths: pathSpecsToRead,
8147
8226
  signal: abortSignal,
8148
- ...preserveUnsupportedImageForBridge ? { preserveUnsupportedImageForBridge } : {}
8227
+ ...preserveUnsupportedImageForBridge ? { preserveUnsupportedImageForBridge } : {},
8228
+ ...validatedPathIdentities.size > 0 ? { validatedPathIdentities } : {},
8229
+ ...displayPaths.size > 0 ? { displayPaths } : {}
8149
8230
  });
8150
8231
  const contentParts = Array.isArray(readResult.contentParts) ? readResult.contentParts : [readResult.contentParts];
8151
8232
  for (const part of contentParts) {
@@ -8209,7 +8290,7 @@ ${contextPart.text}`
8209
8290
  formatFullTurnVisionNotice(fullTurnModel)
8210
8291
  );
8211
8292
  } catch (error) {
8212
- debugLogger6.debug(
8293
+ debugLogger5.debug(
8213
8294
  `full-turn vision: failed to emit notice; continuing error=${error instanceof Error ? error.message : String(error)}`
8214
8295
  );
8215
8296
  }
@@ -8218,19 +8299,19 @@ ${contextPart.text}`
8218
8299
  }
8219
8300
  let bridgeResult;
8220
8301
  try {
8221
- debugLogger6.debug("vision bridge: gate matched, running conversion");
8302
+ debugLogger5.debug("vision bridge: gate matched, running conversion");
8222
8303
  bridgeResult = await runVisionBridge({
8223
8304
  config: this.config,
8224
8305
  parts,
8225
8306
  signal: abortSignal
8226
8307
  });
8227
8308
  } catch (error) {
8228
- debugLogger6.debug(
8309
+ debugLogger5.debug(
8229
8310
  `vision bridge: failed before replacement; falling back to text-only parts error=${String(error instanceof Error ? error.message : error)}`
8230
8311
  );
8231
8312
  return splitImageParts(parts).nonImageParts;
8232
8313
  }
8233
- debugLogger6.debug(
8314
+ debugLogger5.debug(
8234
8315
  `vision bridge: status=${bridgeResult.status} applied=${bridgeResult.applied} model=${bridgeResult.modelId ?? "(none)"}${bridgeResult.error ? ` error=${bridgeResult.error}` : ""}`
8235
8316
  );
8236
8317
  if (bridgeResult.status !== "skipped" || bridgeResult.egressOccurred) {
@@ -8239,13 +8320,13 @@ ${contextPart.text}`
8239
8320
  formatVisionBridgeNotice(bridgeResult)
8240
8321
  );
8241
8322
  } catch (error) {
8242
- debugLogger6.debug(
8323
+ debugLogger5.debug(
8243
8324
  `vision bridge: failed to emit notice; continuing with bridge result error=${String(error instanceof Error ? error.message : error)}`
8244
8325
  );
8245
8326
  }
8246
8327
  }
8247
8328
  if (abortSignal.aborted) {
8248
- debugLogger6.debug("vision bridge: turn aborted after bridge returned");
8329
+ debugLogger5.debug("vision bridge: turn aborted after bridge returned");
8249
8330
  return splitImageParts(parts).nonImageParts;
8250
8331
  }
8251
8332
  if (bridgeResult.applied && bridgeResult.parts != null) {
@@ -8259,7 +8340,7 @@ ${contextPart.text}`
8259
8340
  }
8260
8341
  const voiceModel = readVoiceModel(this.settings);
8261
8342
  if (!voiceModel) {
8262
- debugLogger6.debug(
8343
+ debugLogger5.debug(
8263
8344
  "voice bridge: no voice model configured; replacing audio with note"
8264
8345
  );
8265
8346
  return parts.map(
@@ -8278,14 +8359,14 @@ ${contextPart.text}`
8278
8359
  }
8279
8360
  const inlineData = part.inlineData;
8280
8361
  if (approxBase64Bytes(inlineData.data) > MAX_AUDIO_BYTES) {
8281
- debugLogger6.debug(
8362
+ debugLogger5.debug(
8282
8363
  "voice bridge: audio too large; replacing audio with note"
8283
8364
  );
8284
8365
  converted.push({ text: buildVoiceUnavailableBlock("audio too large") });
8285
8366
  continue;
8286
8367
  }
8287
8368
  try {
8288
- debugLogger6.debug(`voice bridge: transcribing audio via ${voiceModel}`);
8369
+ debugLogger5.debug(`voice bridge: transcribing audio via ${voiceModel}`);
8289
8370
  const transcript = (await transcribeVoiceAudio(
8290
8371
  {
8291
8372
  data: new Uint8Array(Buffer2.from(inlineData.data, "base64")),
@@ -8302,7 +8383,7 @@ ${contextPart.text}`
8302
8383
  }
8303
8384
  )).trim();
8304
8385
  if (abortSignal.aborted) {
8305
- debugLogger6.debug("voice bridge: turn aborted after transcription");
8386
+ debugLogger5.debug("voice bridge: turn aborted after transcription");
8306
8387
  return converted;
8307
8388
  }
8308
8389
  if (transcript.length > 0) {
@@ -8315,10 +8396,10 @@ ${contextPart.text}`
8315
8396
  });
8316
8397
  } catch (error) {
8317
8398
  if (abortSignal.aborted) {
8318
- debugLogger6.debug("voice bridge: transcription cancelled");
8399
+ debugLogger5.debug("voice bridge: transcription cancelled");
8319
8400
  return converted;
8320
8401
  }
8321
- debugLogger6.debug(
8402
+ debugLogger5.debug(
8322
8403
  `voice bridge: transcription failed; replacing audio with note error=${sanitizeVoiceErrorMessage(String(error instanceof Error ? error.message : error))}`
8323
8404
  );
8324
8405
  converted.push({
@@ -8332,7 +8413,7 @@ ${contextPart.text}`
8332
8413
  transcribedCount > 0 ? this.#formatVoiceBridgeNotice(voiceModel, transcribedCount) : this.#formatVoiceBridgeEgressNotice(voiceModel, egressCount)
8333
8414
  );
8334
8415
  } catch (error) {
8335
- debugLogger6.debug(
8416
+ debugLogger5.debug(
8336
8417
  `voice bridge: failed to emit notice; continuing with bridge result error=${String(error instanceof Error ? error.message : error)}`
8337
8418
  );
8338
8419
  }
@@ -8393,7 +8474,7 @@ ${contextPart.text}`
8393
8474
  }
8394
8475
  debug(msg) {
8395
8476
  if (this.config.getDebugMode()) {
8396
- debugLogger6.warn(msg);
8477
+ debugLogger5.warn(msg);
8397
8478
  }
8398
8479
  }
8399
8480
  async emitHookArtifactsNotification(args) {
@@ -8433,7 +8514,7 @@ ${contextPart.text}`
8433
8514
  }
8434
8515
  );
8435
8516
  }).catch((err) => {
8436
- debugLogger6.debug(
8517
+ debugLogger5.debug(
8437
8518
  `ACP terminalSequence notification dropped (session=${this.sessionId}): ${err instanceof Error ? err.message : String(err)}`
8438
8519
  );
8439
8520
  });
@@ -8551,7 +8632,7 @@ function runWithAcpRuntimeOutputDir(settings, cwd, fn) {
8551
8632
  __name(runWithAcpRuntimeOutputDir, "runWithAcpRuntimeOutputDir");
8552
8633
 
8553
8634
  // packages/cli/src/acp-integration/acpAgent.ts
8554
- var debugLogger7 = createDebugLogger("ACP_AGENT");
8635
+ var debugLogger6 = createDebugLogger("ACP_AGENT");
8555
8636
  var QWEN_ACP_LOCAL_READ_ROOTS_ENV = "QWEN_ACP_LOCAL_READ_ROOTS";
8556
8637
  var POSIX_TMP_LOCAL_READ_ROOT = "/tmp";
8557
8638
  var BTW_CHILD_TIMEOUT_MS = 55e3;
@@ -8686,10 +8767,10 @@ async function beginSessionCloseAfterCurrentGate(session, timeoutMs) {
8686
8767
  }
8687
8768
  }
8688
8769
  __name(beginSessionCloseAfterCurrentGate, "beginSessionCloseAfterCurrentGate");
8689
- var logWorkspaceMemoryExtractionError = createWorkspaceMemoryExtractionErrorLogger(debugLogger7);
8770
+ var logWorkspaceMemoryExtractionError = createWorkspaceMemoryExtractionErrorLogger(debugLogger6);
8690
8771
  function parseAcpLocalReadRootsEnv(raw = process.env[QWEN_ACP_LOCAL_READ_ROOTS_ENV]) {
8691
8772
  if (!raw) return [];
8692
- return raw.split(path4.delimiter).map((entry) => entry.trim()).filter((entry) => entry.length > 0 && path4.isAbsolute(entry));
8773
+ return raw.split(path3.delimiter).map((entry) => entry.trim()).filter((entry) => entry.length > 0 && path3.isAbsolute(entry));
8693
8774
  }
8694
8775
  __name(parseAcpLocalReadRootsEnv, "parseAcpLocalReadRootsEnv");
8695
8776
  function defaultAcpOnlyLocalReadRoots() {
@@ -8702,8 +8783,8 @@ function buildAcpLocalReadRoots(config) {
8702
8783
  // including auto-memory roots. The ACP-only additions below expand only
8703
8784
  // local read fallback, not read_file's default permission.
8704
8785
  config.storage.getProjectTempDir(),
8705
- path4.join(config.storage.getProjectDir(), "subagents"),
8706
- path4.join(config.getSessionRuntimeBaseDir(), "tmp"),
8786
+ path3.join(config.storage.getProjectDir(), "subagents"),
8787
+ path3.join(config.getSessionRuntimeBaseDir(), "tmp"),
8707
8788
  getAutoMemoryRoot(config.getTargetDir()),
8708
8789
  getUserAutoMemoryRoot(),
8709
8790
  ...config.storage.getUserSkillsDirs(),
@@ -8777,12 +8858,18 @@ function selectVisibleHistoryRecords(records, hideInheritedHistory) {
8777
8858
  return hideInheritedHistory ? records.filter((record) => record.forkedFrom === void 0) : records;
8778
8859
  }
8779
8860
  __name(selectVisibleHistoryRecords, "selectVisibleHistoryRecords");
8780
- function isChannelSessionRequest(params) {
8861
+ function getSessionSource(params) {
8781
8862
  const meta = isObjectRecord(params._meta) ? params._meta : void 0;
8782
8863
  const value = meta?.[SESSION_SOURCE_META_KEY];
8783
- return isObjectRecord(value) && value["sourceType"] === "channel";
8864
+ if (!isObjectRecord(value) || typeof value["sourceType"] !== "string") {
8865
+ return void 0;
8866
+ }
8867
+ return {
8868
+ sourceType: value["sourceType"],
8869
+ ...typeof value["sourceId"] === "string" ? { sourceId: value["sourceId"] } : {}
8870
+ };
8784
8871
  }
8785
- __name(isChannelSessionRequest, "isChannelSessionRequest");
8872
+ __name(getSessionSource, "getSessionSource");
8786
8873
  function shouldDeferMcpDiscovery(params) {
8787
8874
  const meta = isObjectRecord(params._meta) ? params._meta : void 0;
8788
8875
  return meta?.[WORKTREE_MCP_DEFER_META_KEY] === true;
@@ -8963,7 +9050,7 @@ function readRequiredString(value, fieldName) {
8963
9050
  }
8964
9051
  __name(readRequiredString, "readRequiredString");
8965
9052
  function validateSkillSlug(slug) {
8966
- if (!slug || slug === "." || slug === ".." || slug.includes("/") || slug.includes(path4.sep) || !/^[a-zA-Z0-9._-]+$/.test(slug)) {
9053
+ if (!slug || slug === "." || slug === ".." || slug.includes("/") || slug.includes(path3.sep) || !/^[a-zA-Z0-9._-]+$/.test(slug)) {
8967
9054
  throw RequestError.invalidParams(void 0, "Invalid skill.slug");
8968
9055
  }
8969
9056
  }
@@ -9432,7 +9519,7 @@ async function downloadGitHubSkillDirectoryFromApi(githubUrl, directoryPath, rel
9432
9519
  const name = readRequiredString(record["name"], "github.name");
9433
9520
  const itemPath = readRequiredString(record["path"], "github.path");
9434
9521
  const type = readRequiredString(record["type"], "github.type");
9435
- const relativePath = relativeRoot ? path4.posix.join(relativeRoot, name) : name;
9522
+ const relativePath = relativeRoot ? path3.posix.join(relativeRoot, name) : name;
9436
9523
  if (type === "dir") {
9437
9524
  files.push(
9438
9525
  ...await downloadGitHubSkillDirectoryFromApi(
@@ -9479,7 +9566,7 @@ async function downloadGitHubSkillDirectory(githubUrl, directoryPath) {
9479
9566
  githubUrl,
9480
9567
  directoryPath
9481
9568
  ).catch((error) => {
9482
- debugLogger7.warn(
9569
+ debugLogger6.warn(
9483
9570
  "GitHub API directory listing failed, falling back to archive download:",
9484
9571
  error
9485
9572
  );
@@ -9492,10 +9579,10 @@ __name(downloadGitHubSkillDirectory, "downloadGitHubSkillDirectory");
9492
9579
  async function downloadSkill(sourceUrl) {
9493
9580
  assertAllowedSkillSourceUrl(sourceUrl);
9494
9581
  const githubUrl = parseGitHubBlobSkillUrl(sourceUrl);
9495
- if (!githubUrl || path4.posix.basename(githubUrl.filePath) !== "SKILL.md") {
9582
+ if (!githubUrl || path3.posix.basename(githubUrl.filePath) !== "SKILL.md") {
9496
9583
  return downloadSingleSkillFile(sourceUrl);
9497
9584
  }
9498
- const skillDirectory = path4.posix.dirname(githubUrl.filePath);
9585
+ const skillDirectory = path3.posix.dirname(githubUrl.filePath);
9499
9586
  const files = await downloadGitHubSkillDirectory(githubUrl, skillDirectory);
9500
9587
  const skillFile = files.find((file) => file.relativePath === "SKILL.md");
9501
9588
  if (!skillFile) {
@@ -9511,9 +9598,9 @@ async function downloadSkill(sourceUrl) {
9511
9598
  }
9512
9599
  __name(downloadSkill, "downloadSkill");
9513
9600
  function resolveSkillInstallPath(skillDir, relativePath) {
9514
- const root = path4.resolve(skillDir);
9515
- const target = path4.resolve(skillDir, relativePath);
9516
- if (target !== root && !target.startsWith(root + path4.sep)) {
9601
+ const root = path3.resolve(skillDir);
9602
+ const target = path3.resolve(skillDir, relativePath);
9603
+ if (target !== root && !target.startsWith(root + path3.sep)) {
9517
9604
  throw RequestError.invalidParams(
9518
9605
  void 0,
9519
9606
  `Invalid skill file path: ${relativePath}`
@@ -9523,9 +9610,9 @@ function resolveSkillInstallPath(skillDir, relativePath) {
9523
9610
  }
9524
9611
  __name(resolveSkillInstallPath, "resolveSkillInstallPath");
9525
9612
  function resolveManagedSkillDir(skillsBaseDir, slug) {
9526
- const root = path4.resolve(skillsBaseDir);
9527
- const skillDir = path4.resolve(skillsBaseDir, slug);
9528
- if (!skillDir.startsWith(root + path4.sep)) {
9613
+ const root = path3.resolve(skillsBaseDir);
9614
+ const skillDir = path3.resolve(skillsBaseDir, slug);
9615
+ if (!skillDir.startsWith(root + path3.sep)) {
9529
9616
  throw RequestError.invalidParams(void 0, "Invalid skill.slug");
9530
9617
  }
9531
9618
  return skillDir;
@@ -10045,7 +10132,7 @@ function readMcpServers(source, scope) {
10045
10132
  const server = toMcpServerConfig(value);
10046
10133
  return server ? { name, scope, server: redactMcpServerSecrets(server) } : void 0;
10047
10134
  } catch (error) {
10048
- debugLogger7.warn(
10135
+ debugLogger6.warn(
10049
10136
  `Skipping malformed MCP server config [${scope}:${name}]:`,
10050
10137
  error
10051
10138
  );
@@ -10141,7 +10228,7 @@ function readHooks(source, scope, extensionName) {
10141
10228
  extensionName
10142
10229
  });
10143
10230
  } catch (error) {
10144
- debugLogger7.warn(
10231
+ debugLogger6.warn(
10145
10232
  `Skipping malformed hook entry [${scope}:${event}:${index}]:`,
10146
10233
  error
10147
10234
  );
@@ -10166,14 +10253,14 @@ function readScopeSettings(settings, scope) {
10166
10253
  __name(readScopeSettings, "readScopeSettings");
10167
10254
  async function resolvePreferredMemoryFile(dir, fallbackFilename) {
10168
10255
  for (const filename of getAllGeminiMdFilenames()) {
10169
- const filePath = path4.join(dir, filename);
10256
+ const filePath = path3.join(dir, filename);
10170
10257
  try {
10171
- await fs2.access(filePath);
10258
+ await fs.access(filePath);
10172
10259
  return filePath;
10173
10260
  } catch {
10174
10261
  }
10175
10262
  }
10176
- return path4.join(dir, fallbackFilename);
10263
+ return path3.join(dir, fallbackFilename);
10177
10264
  }
10178
10265
  __name(resolvePreferredMemoryFile, "resolvePreferredMemoryFile");
10179
10266
  async function resolveQwenMemoryPaths(params) {
@@ -10333,6 +10420,7 @@ async function runAcpAgent(config, settings, argv, options) {
10333
10420
  `);
10334
10421
  }
10335
10422
  const eventLoopMonitor = startEventLoopLagMonitor({
10423
+ suspendThresholdMs: ACP_EVENT_LOOP_STALL_RESTART_MS,
10336
10424
  onNewMaxStall: /* @__PURE__ */ __name((maxMs) => {
10337
10425
  console.error(`[perf] acp agent event loop stall: max=${maxMs}ms`);
10338
10426
  }, "onNewMaxStall")
@@ -10366,7 +10454,7 @@ async function runAcpAgent(config, settings, argv, options) {
10366
10454
  void preloadContentGenerator(
10367
10455
  session.getConfig().getContentGenerator()
10368
10456
  ).catch((error) => {
10369
- debugLogger7.debug(
10457
+ debugLogger6.debug(
10370
10458
  `[ACP] Session provider preload failed for ${sessionId}: ${error instanceof Error ? error.message : String(error)}`
10371
10459
  );
10372
10460
  });
@@ -10405,7 +10493,7 @@ async function runAcpAgent(config, settings, argv, options) {
10405
10493
  try {
10406
10494
  await agentInstance.shutdownMcpPool(8e3);
10407
10495
  } catch (err) {
10408
- debugLogger7.error(`[ACP] MCP pool drain (${label}) error:`, err);
10496
+ debugLogger6.error(`[ACP] MCP pool drain (${label}) error:`, err);
10409
10497
  if (strict) throw err;
10410
10498
  }
10411
10499
  }, "drainPoolBeforeExit");
@@ -10438,7 +10526,7 @@ async function runAcpAgent(config, settings, argv, options) {
10438
10526
  await hookSystem.fireSessionEndEvent(reason);
10439
10527
  } catch (err) {
10440
10528
  if (managedConfigs) failures.push(err);
10441
- debugLogger7.warn(
10529
+ debugLogger6.warn(
10442
10530
  `SessionEnd hook failed: ${err instanceof Error ? err.message : String(err)}`
10443
10531
  );
10444
10532
  }
@@ -10462,13 +10550,13 @@ async function runAcpAgent(config, settings, argv, options) {
10462
10550
  await terminal.writerShutdown;
10463
10551
  } catch (error) {
10464
10552
  failures.push(error);
10465
- debugLogger7.error("[ACP] Managed writer shutdown error:", error);
10553
+ debugLogger6.error("[ACP] Managed writer shutdown error:", error);
10466
10554
  const retainedLockPaths = terminal.configs.flatMap((config2) => {
10467
10555
  if (typeof config2.getSessionRuntimeBaseDir !== "function" || typeof config2.getSessionId !== "function") {
10468
10556
  return [];
10469
10557
  }
10470
10558
  return [
10471
- path4.join(
10559
+ path3.join(
10472
10560
  config2.getSessionRuntimeBaseDir(),
10473
10561
  "tmp",
10474
10562
  "session-writer-locks",
@@ -10489,7 +10577,7 @@ async function runAcpAgent(config, settings, argv, options) {
10489
10577
  await agent.finishManagedShutdown(terminal.configs);
10490
10578
  } catch (error) {
10491
10579
  failures.push(error);
10492
- debugLogger7.error("[ACP] Managed resource shutdown error:", error);
10580
+ debugLogger6.error("[ACP] Managed resource shutdown error:", error);
10493
10581
  }
10494
10582
  try {
10495
10583
  await drainPoolBeforeExit(label, true);
@@ -10500,7 +10588,7 @@ async function runAcpAgent(config, settings, argv, options) {
10500
10588
  await runExitCleanup();
10501
10589
  } catch (error) {
10502
10590
  failures.push(error);
10503
- debugLogger7.error("[ACP] Cleanup error:", error);
10591
+ debugLogger6.error("[ACP] Cleanup error:", error);
10504
10592
  }
10505
10593
  if (failures.length > 0) {
10506
10594
  throw new AggregateError(failures, "Managed ACP shutdown failed");
@@ -10511,14 +10599,14 @@ async function runAcpAgent(config, settings, argv, options) {
10511
10599
  const shutdownHandler = /* @__PURE__ */ __name(async () => {
10512
10600
  if (shuttingDown) return;
10513
10601
  shuttingDown = true;
10514
- debugLogger7.debug("[ACP] Shutdown signal received, closing streams");
10602
+ debugLogger6.debug("[ACP] Shutdown signal received, closing streams");
10515
10603
  if (agentInstance?.isTrustedManagedParent()) {
10516
10604
  let exitCode = 0;
10517
10605
  try {
10518
10606
  await shutdownManagedAgent("other" /* Other */, "signal");
10519
10607
  } catch (err) {
10520
10608
  exitCode = 1;
10521
- debugLogger7.error("[ACP] Managed shutdown error:", err);
10609
+ debugLogger6.error("[ACP] Managed shutdown error:", err);
10522
10610
  } finally {
10523
10611
  eventLoopMonitor.dispose();
10524
10612
  }
@@ -10543,12 +10631,12 @@ async function runAcpAgent(config, settings, argv, options) {
10543
10631
  }
10544
10632
  await drainPoolBeforeExit("signal");
10545
10633
  } catch (err) {
10546
- debugLogger7.error("[ACP] Shutdown error:", err);
10634
+ debugLogger6.error("[ACP] Shutdown error:", err);
10547
10635
  } finally {
10548
10636
  eventLoopMonitor.dispose();
10549
10637
  }
10550
10638
  runExitCleanup().catch((err) => {
10551
- debugLogger7.error("[ACP] Cleanup error:", err);
10639
+ debugLogger6.error("[ACP] Cleanup error:", err);
10552
10640
  }).finally(() => {
10553
10641
  process.exit(0);
10554
10642
  });
@@ -10745,7 +10833,7 @@ var QwenAgent = class {
10745
10833
  // cadence, so successive calls form a clean delta window independent of tool
10746
10834
  // activity. Init is guarded — `process.cpuUsage()` can throw in restricted
10747
10835
  // containers.
10748
- childCpuCoreCount = os3.availableParallelism?.() ?? os3.cpus().length ?? 1;
10836
+ childCpuCoreCount = os2.availableParallelism?.() ?? os2.cpus().length ?? 1;
10749
10837
  prevChildCpu = (() => {
10750
10838
  try {
10751
10839
  return process.cpuUsage();
@@ -10803,12 +10891,12 @@ var QwenAgent = class {
10803
10891
  try {
10804
10892
  session.beginCloseIfAvailable();
10805
10893
  } catch (error) {
10806
- debugLogger7.debug(
10894
+ debugLogger6.debug(
10807
10895
  `Session ${session.getId()} admission close during managed shutdown failed: ${error instanceof Error ? error.message : String(error)}`
10808
10896
  );
10809
10897
  }
10810
10898
  void session.cancelPendingPrompt().catch((error) => {
10811
- debugLogger7.debug(
10899
+ debugLogger6.debug(
10812
10900
  `Session ${session.getId()} cancel during managed shutdown failed: ${error instanceof Error ? error.message : String(error)}`
10813
10901
  );
10814
10902
  });
@@ -10956,7 +11044,7 @@ var QwenAgent = class {
10956
11044
  await run();
10957
11045
  }).catch((err) => {
10958
11046
  this.workspaceMcpDiscoveryError = err instanceof Error ? err.message : String(err);
10959
- debugLogger7.error(
11047
+ debugLogger6.error(
10960
11048
  `Workspace MCP ${label} failed: ${err instanceof Error ? err.message : String(err)}`
10961
11049
  );
10962
11050
  }).finally(() => {
@@ -11143,7 +11231,7 @@ var QwenAgent = class {
11143
11231
  try {
11144
11232
  const result = await this.mcpPool.drainAll({ force: true, timeoutMs });
11145
11233
  if (result.forced > 0 || result.errors.length > 0) {
11146
- debugLogger7.warn(
11234
+ debugLogger6.warn(
11147
11235
  `MCP pool drain: ${result.drained} clean, ${result.forced} timed out, ${result.errors.length} errors`
11148
11236
  );
11149
11237
  throw new Error(
@@ -11151,7 +11239,7 @@ var QwenAgent = class {
11151
11239
  );
11152
11240
  }
11153
11241
  } catch (err) {
11154
- debugLogger7.error(
11242
+ debugLogger6.error(
11155
11243
  `MCP pool drainAll failed: ${err instanceof Error ? err.message : String(err)}`
11156
11244
  );
11157
11245
  throw err;
@@ -11188,7 +11276,7 @@ var QwenAgent = class {
11188
11276
  }
11189
11277
  this.sessions.delete(sessionId);
11190
11278
  if (cleanupErrors.length > 0) {
11191
- debugLogger7.warn(
11279
+ debugLogger6.warn(
11192
11280
  `Session ${sessionId} closed after ${cleanupErrors.length} cleanup failure(s): ${cleanupErrors.map(
11193
11281
  (error) => error instanceof Error ? error.message : String(error)
11194
11282
  ).join("; ")}`
@@ -11242,21 +11330,21 @@ var QwenAgent = class {
11242
11330
  try {
11243
11331
  await cleanup();
11244
11332
  } catch (cleanupError) {
11245
- debugLogger7.warn(
11333
+ debugLogger6.warn(
11246
11334
  `Session cleanup failed while preserving the original request error: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`
11247
11335
  );
11248
11336
  }
11249
11337
  throw mapSessionWriterRequestError(error);
11250
11338
  }
11251
11339
  pendingConfigCleanupKey(runtimeBaseDir, sessionId) {
11252
- return `${path4.resolve(runtimeBaseDir)}\0${sessionId}`;
11340
+ return `${path3.resolve(runtimeBaseDir)}\0${sessionId}`;
11253
11341
  }
11254
11342
  async retryPendingConfigCleanup(runtimeBaseDir, requiredSessionId) {
11255
- const resolvedRuntimeBaseDir = path4.resolve(runtimeBaseDir);
11343
+ const resolvedRuntimeBaseDir = path3.resolve(runtimeBaseDir);
11256
11344
  const configs = /* @__PURE__ */ new Set();
11257
11345
  for (const pending of this.pendingConfigCleanup.values()) {
11258
11346
  for (const config of pending) {
11259
- if (path4.resolve(config.getSessionRuntimeBaseDir()) === resolvedRuntimeBaseDir) {
11347
+ if (path3.resolve(config.getSessionRuntimeBaseDir()) === resolvedRuntimeBaseDir) {
11260
11348
  configs.add(config);
11261
11349
  }
11262
11350
  }
@@ -11266,7 +11354,7 @@ var QwenAgent = class {
11266
11354
  await this.cleanupUnstoredConfig(config);
11267
11355
  } catch (error) {
11268
11356
  if (config.getSessionId() === requiredSessionId) throw error;
11269
- debugLogger7.warn(
11357
+ debugLogger6.warn(
11270
11358
  `Deferred Config cleanup retry failed for session ${config.getSessionId()}: ${error instanceof Error ? error.message : String(error)}`
11271
11359
  );
11272
11360
  }
@@ -11297,7 +11385,7 @@ var QwenAgent = class {
11297
11385
  try {
11298
11386
  await session.cancelPendingPrompt();
11299
11387
  } catch (err) {
11300
- debugLogger7.debug(
11388
+ debugLogger6.debug(
11301
11389
  `Session ${sessionId} cancel during close failed: ${err instanceof Error ? err.message : String(err)}`
11302
11390
  );
11303
11391
  }
@@ -11367,7 +11455,7 @@ var QwenAgent = class {
11367
11455
  return runWithAcpRuntimeOutputDir(settings, cwd, operation);
11368
11456
  }
11369
11457
  async assertLiveSessionScope(config, settings, cwd) {
11370
- if (path4.resolve(config.storage.getProjectRoot()) !== path4.resolve(cwd)) {
11458
+ if (path3.resolve(config.storage.getProjectRoot()) !== path3.resolve(cwd)) {
11371
11459
  throw RequestError.invalidParams(
11372
11460
  void 0,
11373
11461
  "The live session belongs to another workspace."
@@ -11378,7 +11466,7 @@ var QwenAgent = class {
11378
11466
  cwd,
11379
11467
  () => Storage.getRuntimeBaseDir()
11380
11468
  );
11381
- if (path4.resolve(config.getSessionRuntimeBaseDir()) !== path4.resolve(requestedRuntimeBaseDir)) {
11469
+ if (path3.resolve(config.getSessionRuntimeBaseDir()) !== path3.resolve(requestedRuntimeBaseDir)) {
11382
11470
  throw mapSessionWriterRequestError(new SessionWriterUnavailableError());
11383
11471
  }
11384
11472
  }
@@ -11401,7 +11489,7 @@ var QwenAgent = class {
11401
11489
  scope: "workspace",
11402
11490
  ...event
11403
11491
  }).catch((err) => {
11404
- debugLogger7.debug(
11492
+ debugLogger6.debug(
11405
11493
  `MCP workspace budget event delivery to session ${sid} failed (kind=${event.kind}): ${err instanceof Error ? err.message : String(err)}`
11406
11494
  );
11407
11495
  });
@@ -11436,7 +11524,7 @@ var QwenAgent = class {
11436
11524
  }
11437
11525
  this.clientCapabilities = args.clientCapabilities;
11438
11526
  const authMethods = buildAuthMethods();
11439
- const version = "0.21.2";
11527
+ const version = "0.21.3-nightly.20260803.e1e5b42ce";
11440
11528
  const response = {
11441
11529
  protocolVersion: PROTOCOL_VERSION,
11442
11530
  agentInfo: {
@@ -11510,7 +11598,8 @@ var QwenAgent = class {
11510
11598
  }
11511
11599
  async newSession(params) {
11512
11600
  const { cwd, mcpServers } = params;
11513
- const isChannelSession = isChannelSessionRequest(params);
11601
+ const requestedSessionId = typeof params._meta?.[REQUESTED_SESSION_ID_META_KEY] === "string" ? params._meta[REQUESTED_SESSION_ID_META_KEY] : void 0;
11602
+ const sessionSource = getSessionSource(params);
11514
11603
  const parentContext = extractDaemonTraceContext(params);
11515
11604
  return await withDaemonSpan(
11516
11605
  "qwen-code.daemon.session_start",
@@ -11528,8 +11617,8 @@ var QwenAgent = class {
11528
11617
  cwd,
11529
11618
  mcpServers,
11530
11619
  settings,
11531
- isChannelSession,
11532
- void 0,
11620
+ sessionSource,
11621
+ requestedSessionId,
11533
11622
  void 0,
11534
11623
  shouldDeferMcpDiscovery(params) ? { skipMcpDiscovery: true } : void 0
11535
11624
  )
@@ -11564,7 +11653,7 @@ var QwenAgent = class {
11564
11653
  );
11565
11654
  }
11566
11655
  async loadSession(params) {
11567
- const isChannelSession = isChannelSessionRequest(params);
11656
+ const sessionSource = getSessionSource(params);
11568
11657
  const settings = loadSettingsCached(params.cwd);
11569
11658
  const liveSession = this.sessions.get(params.sessionId);
11570
11659
  if (liveSession) {
@@ -11597,7 +11686,7 @@ var QwenAgent = class {
11597
11686
  records: replayPage.records,
11598
11687
  gaps: sessionData2.historyGaps,
11599
11688
  cumulativeUsage: createReplayCumulativeUsage(),
11600
- logger: debugLogger7
11689
+ logger: debugLogger6
11601
11690
  });
11602
11691
  if (!bulkReplay2) {
11603
11692
  for (const update of replay.updates) {
@@ -11642,7 +11731,7 @@ var QwenAgent = class {
11642
11731
  // a `null`/`undefined` would otherwise throw `TypeError`.
11643
11732
  params.mcpServers ?? [],
11644
11733
  settings,
11645
- isChannelSession,
11734
+ sessionSource,
11646
11735
  params.sessionId,
11647
11736
  true
11648
11737
  );
@@ -11677,7 +11766,7 @@ var QwenAgent = class {
11677
11766
  gaps: sessionData?.historyGaps,
11678
11767
  cumulativeUsage: replayUsage,
11679
11768
  supersedeUnrestorableGoal: true,
11680
- logger: debugLogger7
11769
+ logger: debugLogger6
11681
11770
  });
11682
11771
  replayUpdates = replay.updates;
11683
11772
  copyCumulativeUsage(createdSession.cumulativeUsage, replayUsage);
@@ -11733,7 +11822,7 @@ var QwenAgent = class {
11733
11822
  };
11734
11823
  }
11735
11824
  async unstable_resumeSession(params) {
11736
- const isChannelSession = isChannelSessionRequest(params);
11825
+ const sessionSource = getSessionSource(params);
11737
11826
  const settings = loadSettingsCached(params.cwd);
11738
11827
  const liveSession = this.sessions.get(params.sessionId);
11739
11828
  if (liveSession) {
@@ -11766,7 +11855,7 @@ var QwenAgent = class {
11766
11855
  params.cwd,
11767
11856
  params.mcpServers ?? [],
11768
11857
  settings,
11769
- isChannelSession,
11858
+ sessionSource,
11770
11859
  params.sessionId,
11771
11860
  true
11772
11861
  );
@@ -11818,7 +11907,7 @@ var QwenAgent = class {
11818
11907
  session.pendingWorktreeNotice = restored.contextMessage;
11819
11908
  }
11820
11909
  } catch (error) {
11821
- debugLogger7.warn(`ACP worktree restore failed: ${error}`);
11910
+ debugLogger6.warn(`ACP worktree restore failed: ${error}`);
11822
11911
  }
11823
11912
  }
11824
11913
  async #restoreBackgroundAgentsOnResume(config, session) {
@@ -11851,7 +11940,7 @@ var QwenAgent = class {
11851
11940
  config
11852
11941
  );
11853
11942
  if (restored.restored) {
11854
- debugLogger7.info(
11943
+ debugLogger6.info(
11855
11944
  `ACP goal restored sessionId=${config.getSessionId()} condition=${restored.condition}`
11856
11945
  );
11857
11946
  } else if (restored.blockedBy && restored.blockedBy !== "condition-invalid") {
@@ -11979,8 +12068,8 @@ var QwenAgent = class {
11979
12068
  }, "settleCall");
11980
12069
  const call = {
11981
12070
  controller: new AbortController(),
11982
- settled: new Promise((resolve5) => {
11983
- settleCall = resolve5;
12071
+ settled: new Promise((resolve4) => {
12072
+ settleCall = resolve4;
11984
12073
  })
11985
12074
  };
11986
12075
  let calls = this.activePromptCalls.get(params.sessionId);
@@ -12034,7 +12123,7 @@ var QwenAgent = class {
12034
12123
  await extensionManager.refreshCache();
12035
12124
  extensions = extensionManager.getLoadedExtensions();
12036
12125
  } catch (error) {
12037
- debugLogger7.warn(
12126
+ debugLogger6.warn(
12038
12127
  "Extension loading failed, continuing without extensions:",
12039
12128
  error
12040
12129
  );
@@ -12160,7 +12249,7 @@ var QwenAgent = class {
12160
12249
  pm.addPersistentRule(rule, ruleType);
12161
12250
  }
12162
12251
  } catch (error) {
12163
- debugLogger7.warn(
12252
+ debugLogger6.warn(
12164
12253
  `Failed to sync permission rules to a live session: ${error instanceof Error ? error.message : String(error)}`
12165
12254
  );
12166
12255
  }
@@ -12718,7 +12807,7 @@ var QwenAgent = class {
12718
12807
  if (!changed) return;
12719
12808
  await config.getSkillManager()?.refreshCache();
12720
12809
  } catch (error) {
12721
- debugLogger7.warn("Extension source revalidation failed:", error);
12810
+ debugLogger6.warn("Extension source revalidation failed:", error);
12722
12811
  }
12723
12812
  }
12724
12813
  async buildWorkspaceSkillsStatus(config) {
@@ -13607,9 +13696,9 @@ var QwenAgent = class {
13607
13696
  );
13608
13697
  }
13609
13698
  const download = await downloadSkill(request.sourceUrl);
13610
- const skillsBaseDir = path4.join(Storage.getGlobalQwenDir(), "skills");
13699
+ const skillsBaseDir = path3.join(Storage.getGlobalQwenDir(), "skills");
13611
13700
  const skillDir = resolveManagedSkillDir(skillsBaseDir, request.slug);
13612
- const skillFile = path4.join(skillDir, "SKILL.md");
13701
+ const skillFile = path3.join(skillDir, "SKILL.md");
13613
13702
  const parsed = skillManager.parseSkillContent(
13614
13703
  download.skillContent,
13615
13704
  skillFile,
@@ -13623,19 +13712,19 @@ var QwenAgent = class {
13623
13712
  }
13624
13713
  const stagingDir = `${skillDir}.installing-${process.pid}-${Date.now()}`;
13625
13714
  try {
13626
- await fs2.rm(stagingDir, { recursive: true, force: true });
13715
+ await fs.rm(stagingDir, { recursive: true, force: true });
13627
13716
  for (const file of download.files) {
13628
13717
  const targetPath = resolveSkillInstallPath(
13629
13718
  stagingDir,
13630
13719
  file.relativePath
13631
13720
  );
13632
- await fs2.mkdir(path4.dirname(targetPath), { recursive: true });
13633
- await fs2.writeFile(targetPath, file.content);
13721
+ await fs.mkdir(path3.dirname(targetPath), { recursive: true });
13722
+ await fs.writeFile(targetPath, file.content);
13634
13723
  }
13635
- await fs2.rm(skillDir, { recursive: true, force: true });
13636
- await fs2.rename(stagingDir, skillDir);
13724
+ await fs.rm(skillDir, { recursive: true, force: true });
13725
+ await fs.rename(stagingDir, skillDir);
13637
13726
  } catch (error) {
13638
- await fs2.rm(stagingDir, { recursive: true, force: true }).catch(() => {
13727
+ await fs.rm(stagingDir, { recursive: true, force: true }).catch(() => {
13639
13728
  });
13640
13729
  throw error;
13641
13730
  }
@@ -13668,17 +13757,17 @@ var QwenAgent = class {
13668
13757
  `Skill name "${parsed.name}" does not match requested slug "${request.slug}"`
13669
13758
  );
13670
13759
  }
13671
- const resolvedSkillDir = path4.resolve(skillDir);
13672
- const resolvedSkillFile = path4.resolve(skillFile);
13673
- const globalDir = path4.resolve(Storage.getGlobalQwenDir());
13674
- const isDedicatedSkillDir = resolvedSkillFile === path4.join(resolvedSkillDir, "SKILL.md");
13675
- if (!isDedicatedSkillDir || resolvedSkillDir === path4.parse(resolvedSkillDir).root || resolvedSkillDir === globalDir) {
13760
+ const resolvedSkillDir = path3.resolve(skillDir);
13761
+ const resolvedSkillFile = path3.resolve(skillFile);
13762
+ const globalDir = path3.resolve(Storage.getGlobalQwenDir());
13763
+ const isDedicatedSkillDir = resolvedSkillFile === path3.join(resolvedSkillDir, "SKILL.md");
13764
+ if (!isDedicatedSkillDir || resolvedSkillDir === path3.parse(resolvedSkillDir).root || resolvedSkillDir === globalDir) {
13676
13765
  throw RequestError.invalidParams(
13677
13766
  void 0,
13678
13767
  `Refusing to delete unexpected skill directory: ${skillDir}`
13679
13768
  );
13680
13769
  }
13681
- await fs2.rm(skillDir, { recursive: true, force: true });
13770
+ await fs.rm(skillDir, { recursive: true, force: true });
13682
13771
  await skillManager.refreshCache();
13683
13772
  return {
13684
13773
  slug: request.slug,
@@ -13688,11 +13777,11 @@ var QwenAgent = class {
13688
13777
  async readManagedSkillFile(slug, scope, skillManager, cwd) {
13689
13778
  if (scope === "global") {
13690
13779
  const qwenSkillDir = resolveManagedSkillDir(
13691
- path4.join(Storage.getGlobalQwenDir(), "skills"),
13780
+ path3.join(Storage.getGlobalQwenDir(), "skills"),
13692
13781
  slug
13693
13782
  );
13694
- const qwenSkillFile = path4.join(qwenSkillDir, "SKILL.md");
13695
- const qwenContent = await fs2.readFile(qwenSkillFile, "utf8").catch(() => void 0);
13783
+ const qwenSkillFile = path3.join(qwenSkillDir, "SKILL.md");
13784
+ const qwenContent = await fs.readFile(qwenSkillFile, "utf8").catch(() => void 0);
13696
13785
  if (qwenContent !== void 0) {
13697
13786
  return {
13698
13787
  skillDir: qwenSkillDir,
@@ -13720,34 +13809,34 @@ var QwenAgent = class {
13720
13809
  `${scope === "project" ? "Project" : "Global"} skill not found: ${slug}`
13721
13810
  );
13722
13811
  }
13723
- const content = await fs2.readFile(skillFile, "utf8").catch(() => {
13812
+ const content = await fs.readFile(skillFile, "utf8").catch(() => {
13724
13813
  throw RequestError.invalidParams(
13725
13814
  void 0,
13726
13815
  `${scope === "project" ? "Project" : "Global"} skill not found: ${slug}`
13727
13816
  );
13728
13817
  });
13729
13818
  return {
13730
- skillDir: path4.dirname(skillFile),
13819
+ skillDir: path3.dirname(skillFile),
13731
13820
  skillFile,
13732
13821
  content
13733
13822
  };
13734
13823
  }
13735
13824
  async findProjectSkillFileFromCwd(slug, cwd, skillManager) {
13736
- const projectRoot = path4.resolve(cwd);
13825
+ const projectRoot = path3.resolve(cwd);
13737
13826
  for (const configDir of PROJECT_SKILL_DIRS) {
13738
- const baseDir = path4.join(projectRoot, configDir, SKILLS_DIR);
13827
+ const baseDir = path3.join(projectRoot, configDir, SKILLS_DIR);
13739
13828
  const skills = await skillManager.loadSkillsFromDir(baseDir, "project");
13740
13829
  const skill = skills.find((candidate) => candidate.name === slug);
13741
13830
  const skillFile = skill?.filePath;
13742
13831
  if (!skillFile) continue;
13743
- const content = await fs2.readFile(skillFile, "utf8").catch(() => {
13832
+ const content = await fs.readFile(skillFile, "utf8").catch(() => {
13744
13833
  throw RequestError.invalidParams(
13745
13834
  void 0,
13746
13835
  `Project skill not found: ${slug}`
13747
13836
  );
13748
13837
  });
13749
13838
  return {
13750
- skillDir: path4.dirname(skillFile),
13839
+ skillDir: path3.dirname(skillFile),
13751
13840
  skillFile,
13752
13841
  content
13753
13842
  };
@@ -13778,13 +13867,13 @@ var QwenAgent = class {
13778
13867
  }
13779
13868
  const nextContent = setSkillFrontmatterEnabled(content, request.enabled);
13780
13869
  skillManager.parseSkillContent(nextContent, skillFile, level);
13781
- if (path4.basename(skillFile) !== "SKILL.md") {
13870
+ if (path3.basename(skillFile) !== "SKILL.md") {
13782
13871
  throw RequestError.invalidParams(
13783
13872
  void 0,
13784
13873
  `Refusing to write to unexpected skill file: ${skillFile}`
13785
13874
  );
13786
13875
  }
13787
- await fs2.writeFile(skillFile, nextContent, "utf8");
13876
+ await fs.writeFile(skillFile, nextContent, "utf8");
13788
13877
  await skillManager.refreshCache();
13789
13878
  return {
13790
13879
  slug: request.slug,
@@ -14157,7 +14246,7 @@ var QwenAgent = class {
14157
14246
  page,
14158
14247
  config,
14159
14248
  encodeCursor: /* @__PURE__ */ __name((state) => encodeSessionTranscriptCursor(state, cwd), "encodeCursor"),
14160
- logger: debugLogger7
14249
+ logger: debugLogger6
14161
14250
  });
14162
14251
  return {
14163
14252
  v: 1,
@@ -14350,7 +14439,7 @@ var QwenAgent = class {
14350
14439
  );
14351
14440
  if (childSignal.aborted) {
14352
14441
  const timeoutCode = "remember_timeout";
14353
- debugLogger7.error("Workspace memory remember timed out:", {
14442
+ debugLogger6.error("Workspace memory remember timed out:", {
14354
14443
  projectRoot,
14355
14444
  code: timeoutCode,
14356
14445
  details: diagnostics.debugDetails,
@@ -14362,7 +14451,7 @@ var QwenAgent = class {
14362
14451
  workspaceMemoryErrorData(timeoutCode, diagnostics)
14363
14452
  );
14364
14453
  }
14365
- debugLogger7.error("Workspace memory remember failed:", {
14454
+ debugLogger6.error("Workspace memory remember failed:", {
14366
14455
  projectRoot,
14367
14456
  code,
14368
14457
  details: diagnostics.debugDetails,
@@ -14436,7 +14525,7 @@ var QwenAgent = class {
14436
14525
  );
14437
14526
  if (childSignal.aborted) {
14438
14527
  const timeoutCode = "forget_timeout";
14439
- debugLogger7.error("Workspace memory forget timed out:", {
14528
+ debugLogger6.error("Workspace memory forget timed out:", {
14440
14529
  projectRoot,
14441
14530
  code: timeoutCode,
14442
14531
  details: diagnostics.debugDetails,
@@ -14448,7 +14537,7 @@ var QwenAgent = class {
14448
14537
  workspaceMemoryErrorData(timeoutCode, diagnostics)
14449
14538
  );
14450
14539
  }
14451
- debugLogger7.error("Workspace memory forget failed:", {
14540
+ debugLogger6.error("Workspace memory forget failed:", {
14452
14541
  projectRoot,
14453
14542
  code,
14454
14543
  details: diagnostics.debugDetails,
@@ -14513,7 +14602,7 @@ var QwenAgent = class {
14513
14602
  );
14514
14603
  if (childSignal.aborted) {
14515
14604
  const timeoutCode = "dream_timeout";
14516
- debugLogger7.error("Workspace memory dream timed out:", {
14605
+ debugLogger6.error("Workspace memory dream timed out:", {
14517
14606
  projectRoot,
14518
14607
  code: timeoutCode,
14519
14608
  details: diagnostics.debugDetails,
@@ -14525,7 +14614,7 @@ var QwenAgent = class {
14525
14614
  workspaceMemoryErrorData(timeoutCode, diagnostics)
14526
14615
  );
14527
14616
  }
14528
- debugLogger7.error("Workspace memory dream failed:", {
14617
+ debugLogger6.error("Workspace memory dream failed:", {
14529
14618
  projectRoot,
14530
14619
  code,
14531
14620
  details: diagnostics.debugDetails,
@@ -14876,10 +14965,10 @@ var QwenAgent = class {
14876
14965
  let resolveStarted;
14877
14966
  let rejectStarted;
14878
14967
  let startedTimer;
14879
- const started = new Promise((resolve5, reject) => {
14968
+ const started = new Promise((resolve4, reject) => {
14880
14969
  resolveStarted = /* @__PURE__ */ __name((value) => {
14881
14970
  clearTimeout(startedTimer);
14882
- resolve5(value);
14971
+ resolve4(value);
14883
14972
  }, "resolveStarted");
14884
14973
  rejectStarted = /* @__PURE__ */ __name((reason) => {
14885
14974
  clearTimeout(startedTimer);
@@ -14935,7 +15024,7 @@ var QwenAgent = class {
14935
15024
  error: error instanceof Error ? error.message : String(error)
14936
15025
  });
14937
15026
  rejectStarted(error);
14938
- debugLogger7.warn(
15027
+ debugLogger6.warn(
14939
15028
  `MCP OAuth authentication failed for ${serverName}:`,
14940
15029
  error
14941
15030
  );
@@ -14947,7 +15036,7 @@ var QwenAgent = class {
14947
15036
  "discover"
14948
15037
  );
14949
15038
  } catch (error) {
14950
- debugLogger7.warn(
15039
+ debugLogger6.warn(
14951
15040
  `MCP OAuth authenticated for ${serverName}, but tool synchronization failed:`,
14952
15041
  error
14953
15042
  );
@@ -15234,7 +15323,7 @@ var QwenAgent = class {
15234
15323
  "Invalid or missing sessionId"
15235
15324
  );
15236
15325
  }
15237
- if (typeof targetPath !== "string" || targetPath.length === 0 || !path4.isAbsolute(targetPath) || targetPath.includes("\0")) {
15326
+ if (typeof targetPath !== "string" || targetPath.length === 0 || !path3.isAbsolute(targetPath) || targetPath.includes("\0")) {
15238
15327
  throw RequestError.invalidParams(
15239
15328
  void 0,
15240
15329
  "Invalid or missing path (must be an absolute path)"
@@ -15249,7 +15338,7 @@ var QwenAgent = class {
15249
15338
  }
15250
15339
  let stats;
15251
15340
  try {
15252
- stats = await fs2.stat(targetPath);
15341
+ stats = await fs.stat(targetPath);
15253
15342
  } catch {
15254
15343
  throw new RequestError(-32002, `Directory not found: ${targetPath}`, {
15255
15344
  errorKind: "directory_not_found",
@@ -15262,13 +15351,13 @@ var QwenAgent = class {
15262
15351
  path: targetPath
15263
15352
  });
15264
15353
  }
15265
- const canonicalPath = await fs2.realpath(targetPath);
15354
+ const canonicalPath = await fs.realpath(targetPath);
15266
15355
  const allowedRoots = params["allowedRoots"];
15267
15356
  if (Array.isArray(allowedRoots) && allowedRoots.length > 0) {
15268
15357
  const contained = allowedRoots.some((root) => {
15269
15358
  if (typeof root !== "string") return false;
15270
- const rel = path4.relative(root, canonicalPath);
15271
- return !rel.startsWith("..") && !path4.isAbsolute(rel);
15359
+ const rel = path3.relative(root, canonicalPath);
15360
+ return !rel.startsWith("..") && !path3.isAbsolute(rel);
15272
15361
  });
15273
15362
  if (!contained) {
15274
15363
  throw new RequestError(
@@ -15413,7 +15502,7 @@ var QwenAgent = class {
15413
15502
  try {
15414
15503
  await setLanguageAsync(language);
15415
15504
  } catch (err) {
15416
- debugLogger7.warn("setLanguageAsync failed:", err);
15505
+ debugLogger6.warn("setLanguageAsync failed:", err);
15417
15506
  throw new RequestError(
15418
15507
  -32603,
15419
15508
  `Failed to switch UI language: ${err instanceof Error ? err.message : String(err)}`
@@ -15427,7 +15516,7 @@ var QwenAgent = class {
15427
15516
  language
15428
15517
  );
15429
15518
  } catch (err) {
15430
- debugLogger7.warn("Failed to persist UI language setting:", err);
15519
+ debugLogger6.warn("Failed to persist UI language setting:", err);
15431
15520
  }
15432
15521
  let outputLanguage = null;
15433
15522
  let refreshed = false;
@@ -15441,7 +15530,7 @@ var QwenAgent = class {
15441
15530
  );
15442
15531
  fileWriteOk = true;
15443
15532
  } catch (err) {
15444
- debugLogger7.warn("Failed to write output-language.md:", err);
15533
+ debugLogger6.warn("Failed to write output-language.md:", err);
15445
15534
  }
15446
15535
  if (fileWriteOk) {
15447
15536
  try {
@@ -15451,7 +15540,7 @@ var QwenAgent = class {
15451
15540
  settingValue
15452
15541
  );
15453
15542
  } catch (err) {
15454
- debugLogger7.warn(
15543
+ debugLogger6.warn(
15455
15544
  "Failed to persist output language setting:",
15456
15545
  err
15457
15546
  );
@@ -15471,7 +15560,7 @@ var QwenAgent = class {
15471
15560
  writeOutputLanguageAndRegisterPath(settingValue, cfg);
15472
15561
  }
15473
15562
  } catch (err) {
15474
- debugLogger7.warn(
15563
+ debugLogger6.warn(
15475
15564
  `Failed to write output-language.md for session ${s.getId()} (path=${sessionPath ?? "global-default"}):`,
15476
15565
  err
15477
15566
  );
@@ -15484,7 +15573,7 @@ var QwenAgent = class {
15484
15573
  (r) => r.status === "rejected"
15485
15574
  ).length;
15486
15575
  if (failedCount > 0) {
15487
- debugLogger7.warn(
15576
+ debugLogger6.warn(
15488
15577
  `Language refresh failed for ${failedCount}/${results.length} session(s)`
15489
15578
  );
15490
15579
  }
@@ -15502,14 +15591,14 @@ var QwenAgent = class {
15502
15591
  "Invalid or missing sessionId"
15503
15592
  );
15504
15593
  }
15505
- debugLogger7.debug(`recap ext-method received for session=${sessionId}`);
15594
+ debugLogger6.debug(`recap ext-method received for session=${sessionId}`);
15506
15595
  const session = this.sessionOrThrow(sessionId);
15507
15596
  const config = session.getConfig();
15508
15597
  const recap = await generateSessionRecap(
15509
15598
  config,
15510
15599
  new AbortController().signal
15511
15600
  );
15512
- debugLogger7.debug(
15601
+ debugLogger6.debug(
15513
15602
  `recap ext-method completed for session=${sessionId} result=${recap ? `len=${recap.length}` : "null"}`
15514
15603
  );
15515
15604
  return { sessionId, recap };
@@ -15591,7 +15680,7 @@ var QwenAgent = class {
15591
15680
  const config = session.getConfig();
15592
15681
  const cacheSafeParams = buildBtwCacheSafeParams(config);
15593
15682
  if (!cacheSafeParams) {
15594
- debugLogger7.debug(`btw: no cacheSafeParams for session=${sessionId}`);
15683
+ debugLogger6.debug(`btw: no cacheSafeParams for session=${sessionId}`);
15595
15684
  return { sessionId, answer: null };
15596
15685
  }
15597
15686
  const childSignal = AbortSignal.timeout(BTW_CHILD_TIMEOUT_MS);
@@ -15639,7 +15728,7 @@ var QwenAgent = class {
15639
15728
  try {
15640
15729
  hasHistory = (config.getGeminiClient().getHistoryShallow() ?? []).length > 0;
15641
15730
  } catch (error) {
15642
- debugLogger7.debug("Failed to read history before /fork:", error);
15731
+ debugLogger6.debug("Failed to read history before /fork:", error);
15643
15732
  }
15644
15733
  if (!hasHistory) {
15645
15734
  throw RequestError.invalidParams(
@@ -15681,7 +15770,7 @@ var QwenAgent = class {
15681
15770
  ]
15682
15771
  });
15683
15772
  } catch (error) {
15684
- debugLogger7.debug("Failed to record fork event in history:", error);
15773
+ debugLogger6.debug("Failed to record fork event in history:", error);
15685
15774
  }
15686
15775
  return { sessionId, description, launched: true };
15687
15776
  }
@@ -15744,7 +15833,7 @@ ${outputText}
15744
15833
  'taskKind must be "agent", "shell", or "monitor"'
15745
15834
  );
15746
15835
  }
15747
- debugLogger7.info(
15836
+ debugLogger6.info(
15748
15837
  `sessionTaskCancel requested sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind}`
15749
15838
  );
15750
15839
  const session = this.sessionOrThrow(sessionId);
@@ -15754,7 +15843,7 @@ ${outputText}
15754
15843
  const task = config.getBackgroundTaskRegistry().get(taskId);
15755
15844
  if (!task || task.status !== "running" && task.status !== "paused") {
15756
15845
  const reason = task ? "not_running" : "not_found";
15757
- debugLogger7.info(
15846
+ debugLogger6.info(
15758
15847
  `sessionTaskCancel skipped sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} reason=${reason} status=${task?.status ?? "missing"}`
15759
15848
  );
15760
15849
  return { cancelled: false, reason, status: task?.status };
@@ -15764,7 +15853,7 @@ ${outputText}
15764
15853
  } else {
15765
15854
  config.getBackgroundTaskRegistry().cancel(taskId);
15766
15855
  }
15767
- debugLogger7.info(
15856
+ debugLogger6.info(
15768
15857
  `sessionTaskCancel completed sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} status=${task.status}`
15769
15858
  );
15770
15859
  return { cancelled: true, status: task.status };
@@ -15773,13 +15862,13 @@ ${outputText}
15773
15862
  const task = config.getBackgroundShellRegistry().get(taskId);
15774
15863
  if (!task || task.status !== "running") {
15775
15864
  const reason = task ? "not_running" : "not_found";
15776
- debugLogger7.info(
15865
+ debugLogger6.info(
15777
15866
  `sessionTaskCancel skipped sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} reason=${reason} status=${task?.status ?? "missing"}`
15778
15867
  );
15779
15868
  return { cancelled: false, reason, status: task?.status };
15780
15869
  }
15781
15870
  config.getBackgroundShellRegistry().requestCancel(taskId);
15782
- debugLogger7.info(
15871
+ debugLogger6.info(
15783
15872
  `sessionTaskCancel completed sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} status=${task.status}`
15784
15873
  );
15785
15874
  return { cancelled: true, status: task.status };
@@ -15788,13 +15877,13 @@ ${outputText}
15788
15877
  const task = config.getMonitorRegistry().get(taskId);
15789
15878
  if (!task || task.status !== "running") {
15790
15879
  const reason = task ? "not_running" : "not_found";
15791
- debugLogger7.info(
15880
+ debugLogger6.info(
15792
15881
  `sessionTaskCancel skipped sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} reason=${reason} status=${task?.status ?? "missing"}`
15793
15882
  );
15794
15883
  return { cancelled: false, reason, status: task?.status };
15795
15884
  }
15796
15885
  config.getMonitorRegistry().cancel(taskId);
15797
- debugLogger7.info(
15886
+ debugLogger6.info(
15798
15887
  `sessionTaskCancel completed sessionId=${sessionId} taskId=${taskId} taskKind=${taskKind} status=${task.status}`
15799
15888
  );
15800
15889
  return { cancelled: true, status: task.status };
@@ -15824,7 +15913,7 @@ ${outputText}
15824
15913
  durationMs: Date.now() - cleared.setAt
15825
15914
  });
15826
15915
  }
15827
- debugLogger7.info(
15916
+ debugLogger6.info(
15828
15917
  `sessionGoalClear sessionId=${sessionId} cleared=${!!cleared} condition=${cleared?.condition ?? "(none)"}`
15829
15918
  );
15830
15919
  return {
@@ -15863,7 +15952,7 @@ ${outputText}
15863
15952
  }
15864
15953
  const session = this.sessionOrThrow(sessionId);
15865
15954
  const result = await session.continueLastTurn();
15866
- debugLogger7.info(
15955
+ debugLogger6.info(
15867
15956
  `sessionContinue sessionId=${sessionId} accepted=${result.accepted} interruption=${result.interruption}`
15868
15957
  );
15869
15958
  return result;
@@ -15885,7 +15974,7 @@ ${outputText}
15885
15974
  request.runtimeClientId
15886
15975
  );
15887
15976
  } catch (sessionErr) {
15888
- debugLogger7.warn(
15977
+ debugLogger6.warn(
15889
15978
  `workspaceMcpRuntimeAdd: failed to add runtime MCP server '${request.name}' to active session ${session.getConfig().getSessionId()}: ${sessionErr instanceof Error ? sessionErr.message : String(sessionErr)}`
15890
15979
  );
15891
15980
  }
@@ -15908,7 +15997,7 @@ ${outputText}
15908
15997
  request.runtimeClientId
15909
15998
  );
15910
15999
  } catch (sessionErr) {
15911
- debugLogger7.warn(
16000
+ debugLogger6.warn(
15912
16001
  `workspaceMcpRuntimeRemove: failed to remove runtime MCP server '${request.name}' from active session ${session.getConfig().getSessionId()}: ${sessionErr instanceof Error ? sessionErr.message : String(sessionErr)}`
15913
16002
  );
15914
16003
  }
@@ -16016,6 +16105,9 @@ ${outputText}
16016
16105
  return sessionService.removeSession(sessionId);
16017
16106
  }
16018
16107
  );
16108
+ if (success) {
16109
+ fireSessionDeleteHook(this.config, sessionId, debugLogger6);
16110
+ }
16019
16111
  return { success };
16020
16112
  }
16021
16113
  case "renameSession": {
@@ -16140,7 +16232,7 @@ ${outputText}
16140
16232
  filesFailed = fileResult.filesFailed;
16141
16233
  } catch (err) {
16142
16234
  const reason = err instanceof Error ? err.message : String(err);
16143
- debugLogger7.error(
16235
+ debugLogger6.error(
16144
16236
  `[ACP] File-history rewind failed for session=${sessionId} promptId=${promptId}: ${reason}`
16145
16237
  );
16146
16238
  filesFailed = [`file-history-rewind: ${reason}`];
@@ -16172,7 +16264,7 @@ ${outputText}
16172
16264
  } catch (err) {
16173
16265
  const reason = err instanceof Error ? err.message : String(err);
16174
16266
  artifactSnapshotUnavailable = "artifact snapshot unavailable after rewind";
16175
- debugLogger7.warn(
16267
+ debugLogger6.warn(
16176
16268
  `[ACP] Failed to rebuild artifact snapshot after rewind for session=${sessionId}: ${reason}`
16177
16269
  );
16178
16270
  }
@@ -16228,7 +16320,7 @@ ${outputText}
16228
16320
  records: sessionData.conversation.messages,
16229
16321
  gaps: sessionData.historyGaps,
16230
16322
  cumulativeUsage: createReplayCumulativeUsage(),
16231
- logger: debugLogger7
16323
+ logger: debugLogger6
16232
16324
  });
16233
16325
  return {
16234
16326
  updates: replay.updates,
@@ -16584,7 +16676,7 @@ ${outputText}
16584
16676
  newMerged.providerProtocol ?? {}
16585
16677
  );
16586
16678
  } catch (err) {
16587
- debugLogger7.warn(
16679
+ debugLogger6.warn(
16588
16680
  `reload: reloadModelProvidersConfig failed for session ${id}: ${err}`
16589
16681
  );
16590
16682
  }
@@ -16594,7 +16686,7 @@ ${outputText}
16594
16686
  try {
16595
16687
  await config.switchModel(authType, newModelName);
16596
16688
  } catch (err) {
16597
- debugLogger7.warn(
16689
+ debugLogger6.warn(
16598
16690
  `reload: switchModel failed for session ${id}: ${err}`
16599
16691
  );
16600
16692
  }
@@ -16602,7 +16694,7 @@ ${outputText}
16602
16694
  try {
16603
16695
  await config.refreshAuth(authType);
16604
16696
  } catch (err) {
16605
- debugLogger7.warn(
16697
+ debugLogger6.warn(
16606
16698
  `reload: refreshAuth failed for session ${id}: ${err}`
16607
16699
  );
16608
16700
  }
@@ -16620,7 +16712,7 @@ ${outputText}
16620
16712
  session.clearTodoStopGuardTrust();
16621
16713
  }
16622
16714
  } catch (err) {
16623
- debugLogger7.warn(
16715
+ debugLogger6.warn(
16624
16716
  `reload: setApprovalMode failed for session ${id}: ${err}`
16625
16717
  );
16626
16718
  }
@@ -16629,14 +16721,14 @@ ${outputText}
16629
16721
  try {
16630
16722
  await config.refreshHierarchicalMemory();
16631
16723
  } catch (err) {
16632
- debugLogger7.warn(
16724
+ debugLogger6.warn(
16633
16725
  `reload: refreshHierarchicalMemory failed for session ${id}: ${err}`
16634
16726
  );
16635
16727
  }
16636
16728
  try {
16637
16729
  await config.getGeminiClient()?.refreshSystemInstruction();
16638
16730
  } catch (err) {
16639
- debugLogger7.warn(
16731
+ debugLogger6.warn(
16640
16732
  `reload: refreshSystemInstruction failed for session ${id}: ${err}`
16641
16733
  );
16642
16734
  }
@@ -16646,7 +16738,7 @@ ${outputText}
16646
16738
  for (let i = 0; i < results.length; i++) {
16647
16739
  if (results[i].status === "rejected") {
16648
16740
  const reason = results[i].reason;
16649
- debugLogger7.warn(
16741
+ debugLogger6.warn(
16650
16742
  `Session ${sessions[i][0]} reload failed: ${reason}`
16651
16743
  );
16652
16744
  skipped.push(sessions[i][0]);
@@ -16691,7 +16783,7 @@ ${outputText}
16691
16783
  );
16692
16784
  for (const result of configResults) {
16693
16785
  if (result.status === "rejected") {
16694
- debugLogger7.warn(`Skill config refresh failed: ${result.reason}`);
16786
+ debugLogger6.warn(`Skill config refresh failed: ${result.reason}`);
16695
16787
  }
16696
16788
  }
16697
16789
  }
@@ -16710,7 +16802,7 @@ ${outputText}
16710
16802
  for (let i = 0; i < results.length; i++) {
16711
16803
  if (results[i].status === "rejected") {
16712
16804
  const reason2 = results[i].reason;
16713
- debugLogger7.warn(
16805
+ debugLogger6.warn(
16714
16806
  `Session ${sessions[i].getId()} skill refresh failed: ${reason2}`
16715
16807
  );
16716
16808
  }
@@ -16754,12 +16846,12 @@ ${outputText}
16754
16846
  disposeTranscriptReplayConfig(config) {
16755
16847
  try {
16756
16848
  void Promise.resolve(config.getToolRegistry()?.stop()).catch((err) => {
16757
- debugLogger7.debug(
16849
+ debugLogger6.debug(
16758
16850
  `Transcript replay config tool registry stop failed: ${err instanceof Error ? err.message : String(err)}`
16759
16851
  );
16760
16852
  });
16761
16853
  } catch (err) {
16762
- debugLogger7.debug(
16854
+ debugLogger6.debug(
16763
16855
  `Transcript replay config tool registry stop failed: ${err instanceof Error ? err.message : String(err)}`
16764
16856
  );
16765
16857
  }
@@ -16773,7 +16865,7 @@ ${outputText}
16773
16865
  this.transcriptReplayConfigCache.clear();
16774
16866
  }
16775
16867
  async getTranscriptReplayConfig(cwd, settings) {
16776
- const key = path4.resolve(cwd);
16868
+ const key = path3.resolve(cwd);
16777
16869
  const cached = this.transcriptReplayConfigCache.get(key);
16778
16870
  if (cached?.settings === settings) {
16779
16871
  if (cached.config) {
@@ -16833,7 +16925,7 @@ ${outputText}
16833
16925
  throw error;
16834
16926
  }
16835
16927
  }
16836
- async newSessionConfig(cwd, mcpServers, settings, isChannelSession, sessionId, resume, initializeOptions = {}, chatRecording) {
16928
+ async newSessionConfig(cwd, mcpServers, settings, sessionSource, sessionId, resume, initializeOptions = {}, chatRecording) {
16837
16929
  try {
16838
16930
  this.assertManagedSessionAdmission();
16839
16931
  return await this.runWithPinnedRuntimeBaseDir(settings, cwd, async () => {
@@ -16845,7 +16937,7 @@ ${outputText}
16845
16937
  cwd,
16846
16938
  mcpServers,
16847
16939
  settings,
16848
- isChannelSession,
16940
+ sessionSource,
16849
16941
  sessionId,
16850
16942
  resume,
16851
16943
  initializeOptions,
@@ -16853,6 +16945,9 @@ ${outputText}
16853
16945
  );
16854
16946
  });
16855
16947
  } catch (error) {
16948
+ if (error instanceof SessionIdConflictError) {
16949
+ throw RequestError.invalidParams(void 0, error.message);
16950
+ }
16856
16951
  const writerError = getSessionWriterError(error);
16857
16952
  if (writerError) {
16858
16953
  throw new RequestError(writerError.rpcCode, writerError.message, {
@@ -16862,7 +16957,7 @@ ${outputText}
16862
16957
  throw error;
16863
16958
  }
16864
16959
  }
16865
- async newSessionConfigInRuntimeContext(cwd, mcpServers, settings, isChannelSession, sessionId, resume, initializeOptions = {}, chatRecording) {
16960
+ async newSessionConfigInRuntimeContext(cwd, mcpServers, settings, sessionSource, sessionId, resume, initializeOptions = {}, chatRecording) {
16866
16961
  const sessionMcpServers = {};
16867
16962
  for (const server of mcpServers) {
16868
16963
  const stdioServer = toStdioServer(server);
@@ -16918,7 +17013,7 @@ ${outputText}
16918
17013
  experimental: {
16919
17014
  ...settings.merged.experimental,
16920
17015
  sessionWriterLease: this.sessionWriterLeaseEnabledAtStartup,
16921
- ...isChannelSession ? { cron: false } : {}
17016
+ ...sessionSource?.sourceType === "channel" ? { cron: false } : {}
16922
17017
  }
16923
17018
  };
16924
17019
  const sessionArg = resume === true ? { resume: sessionId, sessionId: void 0 } : { sessionId, resume: void 0 };
@@ -16953,8 +17048,17 @@ ${outputText}
16953
17048
  // session. ACP/Zed sessions otherwise leak persisted disabled skills
16954
17049
  // into the first <available_skills> at cold start.
16955
17050
  buildDisabledSkillNamesProvider(settings),
16956
- sessionMcpServers
17051
+ sessionMcpServers,
17052
+ // The daemon owns the settings watcher lifecycle.
17053
+ void 0,
17054
+ // A duplicate caller-supplied session id must fail this one request,
17055
+ // not process.exit(1) the shared ACP child and every session on its
17056
+ // channel. newSessionConfig maps the throw to a RequestError.
17057
+ true
16957
17058
  );
17059
+ if (sessionSource) {
17060
+ config.setSessionSource(sessionSource.sourceType, sessionSource.sourceId);
17061
+ }
16958
17062
  if (chatRecording !== false) {
16959
17063
  this.initializingConfigs.add(config);
16960
17064
  }
@@ -16994,7 +17098,7 @@ ${outputText}
16994
17098
  sessionId: sid,
16995
17099
  ...event
16996
17100
  }).catch((err) => {
16997
- debugLogger7.debug(
17101
+ debugLogger6.debug(
16998
17102
  `MCP budget extNotification dropped (session=${sid}, kind=${event.kind}): ${err instanceof Error ? err.message : String(err)}`
16999
17103
  );
17000
17104
  });
@@ -17024,7 +17128,7 @@ ${outputText}
17024
17128
  try {
17025
17129
  await config.waitForMcpReady();
17026
17130
  } catch (err) {
17027
- debugLogger7.error(
17131
+ debugLogger6.error(
17028
17132
  `MCP discovery readiness failed: ${err instanceof Error ? err.message : String(err)}`
17029
17133
  );
17030
17134
  return;
@@ -17048,7 +17152,7 @@ ${outputText}
17048
17152
  try {
17049
17153
  await config.refreshAuth(selectedType, true);
17050
17154
  } catch (e) {
17051
- debugLogger7.error(`Authentication failed: ${e}`);
17155
+ debugLogger6.error(`Authentication failed: ${e}`);
17052
17156
  throw RequestError.authRequired(
17053
17157
  {
17054
17158
  authMethods: pickAuthMethodsForAuthRequired(selectedType)