@qwen-code/qwen-code 0.21.2 → 0.21.3

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