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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (352) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +53 -38
  2. package/bundled/qc-helper/docs/features/channels/github.md +16 -5
  3. package/bundled/qc-helper/docs/features/channels/gitlab.md +6 -0
  4. package/bundled/qc-helper/docs/features/code-review.md +92 -24
  5. package/bundled/qc-helper/docs/features/commands.md +46 -38
  6. package/bundled/qc-helper/docs/features/hooks.md +115 -18
  7. package/bundled/qc-helper/docs/features/memory.md +27 -0
  8. package/bundled/qc-helper/docs/features/skills.md +46 -1
  9. package/bundled/qc-helper/docs/features/sub-agents.md +42 -9
  10. package/bundled/qc-helper/docs/features/tool-use-summaries.md +7 -7
  11. package/bundled/qc-helper/docs/qwen-serve.md +46 -25
  12. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +62 -31
  13. package/bundled/qc-helper/docs/support/troubleshooting.md +6 -1
  14. package/bundled/review/DESIGN.md +167 -32
  15. package/bundled/review/SKILL.md +207 -38
  16. package/chunks/{MaxSizedBox-TQBQ247P.js → MaxSizedBox-FCEK5P5K.js} +41 -38
  17. package/chunks/{StandaloneSessionPicker-2HPTKCLX.js → StandaloneSessionPicker-AT77J3PM.js} +63 -59
  18. package/chunks/{acp-startup-profiler-2C4A5ZTJ.js → acp-startup-profiler-3RICG2YW.js} +2 -2
  19. package/chunks/{acpAgent-PS6EDGH3.js → acpAgent-PBMKZ5KH.js} +664 -560
  20. package/chunks/{agent-VDOUB35F.js → agent-55W5BPK3.js} +37 -34
  21. package/chunks/{agent-headless-EO53EFS2.js → agent-headless-I7VMHI22.js} +37 -34
  22. package/chunks/{anthropicContentGenerator-OFHSZJBF.js → anthropicContentGenerator-3CAHEZBM.js} +341 -29
  23. package/chunks/{artifact-tool-RDN2W7ND.js → artifact-tool-TBOYEKTY.js} +2 -2
  24. package/chunks/{askUserQuestion-OZERWH5R.js → askUserQuestion-23Y5WZFJ.js} +2 -2
  25. package/chunks/{bridge-W7AZSRZQ.js → bridge-XNAWEDAN.js} +43 -40
  26. package/chunks/{ca-6W3SK7OQ.js → ca-NYKNH222.js} +50 -5
  27. package/chunks/{channel-management-service-5S7YCWX5.js → channel-management-service-UHX56NBO.js} +7 -7
  28. package/chunks/{channel-settings-store-JFVRSNER.js → channel-settings-store-7P6RJSSF.js} +44 -41
  29. package/chunks/{channel-worker-group-OVWGYMZS.js → channel-worker-group-NDG4WOOZ.js} +8 -8
  30. package/chunks/{channel-worker-manager-H55GKOQA.js → channel-worker-manager-ZCW6UW34.js} +8 -8
  31. package/chunks/{channel-worker-supervisor-CABBXYHK.js → channel-worker-supervisor-ATGFTZRN.js} +4 -4
  32. package/chunks/{chunk-6MPDY6ZG.js → chunk-24ER7UV4.js} +1 -1
  33. package/chunks/{chunk-QDK4F2N5.js → chunk-2DNKEBXY.js} +1 -1
  34. package/chunks/{chunk-AUOULH6Q.js → chunk-2GF3IDEK.js} +1610 -2196
  35. package/chunks/{chunk-JYBU6YUE.js → chunk-2M5N3DHY.js} +1 -1
  36. package/chunks/{chunk-LHKCY7DY.js → chunk-2UISUFHQ.js} +3 -3
  37. package/chunks/{chunk-BBIQAX4V.js → chunk-2ZCYE3F2.js} +30 -18
  38. package/chunks/{chunk-GJ2GBPBD.js → chunk-332FMXSD.js} +5 -5
  39. package/chunks/{chunk-JXVC2PL3.js → chunk-33FNCQSY.js} +2 -2
  40. package/chunks/{chunk-P755N4CS.js → chunk-3GALLNII.js} +6 -6
  41. package/chunks/{chunk-YANIWTRZ.js → chunk-3ICGQSVO.js} +1 -1
  42. package/chunks/{chunk-NBD76HUW.js → chunk-3LGZEYOF.js} +2 -2
  43. package/chunks/{chunk-E2BHWIDT.js → chunk-3RXUYQJI.js} +6 -2
  44. package/chunks/{chunk-E5Z2AVNV.js → chunk-3SH53ANB.js} +0 -11
  45. package/chunks/{chunk-N4ACHWNH.js → chunk-432XCUHF.js} +1 -1
  46. package/chunks/{chunk-JLZ3RBQG.js → chunk-44EJDGMS.js} +144 -11
  47. package/chunks/{chunk-KR32NIAN.js → chunk-4JP34TZ6.js} +10 -10
  48. package/chunks/{chunk-L2E5GFAG.js → chunk-4LKVQFHM.js} +2 -2
  49. package/chunks/{chunk-YDLJGZHL.js → chunk-4NFY2S7N.js} +0 -33
  50. package/chunks/{chunk-NHFEMWAZ.js → chunk-5WY5QEM6.js} +1 -1
  51. package/chunks/{chunk-56Z7QEAQ.js → chunk-6BUPGI3J.js} +16 -16
  52. package/chunks/{chunk-H6I4PGRV.js → chunk-6DNHLK7F.js} +4 -4
  53. package/chunks/{chunk-XQK4XXTN.js → chunk-6O5DVH27.js} +1 -1
  54. package/chunks/{chunk-2RFKHEXL.js → chunk-6PLDPT2C.js} +1 -1
  55. package/chunks/{chunk-Q5WZTTWE.js → chunk-7UPJXZLD.js} +6 -8
  56. package/chunks/{chunk-CBBP4BMC.js → chunk-7UXI6P72.js} +82 -207
  57. package/chunks/{chunk-6CQWRWUC.js → chunk-7XLPYF6B.js} +3 -3
  58. package/chunks/{chunk-VEMNQMHA.js → chunk-7ZH55K26.js} +5 -13
  59. package/chunks/{chunk-JJPKFJBT.js → chunk-A2FOI762.js} +3 -3
  60. package/chunks/{chunk-LYI2PZDK.js → chunk-A5LNZGJB.js} +2 -2
  61. package/chunks/{chunk-3APUUXRF.js → chunk-A5YZ3FA2.js} +2 -1
  62. package/chunks/{chunk-SHN4KHDK.js → chunk-A6SX5TAH.js} +3 -3
  63. package/chunks/{chunk-QCXGC7QB.js → chunk-A7PONO5G.js} +3 -3
  64. package/chunks/{chunk-SZ3KHTDR.js → chunk-AKA24BGO.js} +1 -1
  65. package/chunks/{chunk-RSVPYAGK.js → chunk-B4HXOGF5.js} +5 -5
  66. package/chunks/{chunk-D6MDRSZ6.js → chunk-BBXSRVSN.js} +22 -11
  67. package/chunks/{chunk-Q3T5KA2V.js → chunk-BFHXDAR7.js} +1 -1
  68. package/chunks/{chunk-L55JWS76.js → chunk-BGXZBI5B.js} +1 -1
  69. package/chunks/{chunk-2KKCCLPT.js → chunk-C4IUDGPI.js} +1 -1
  70. package/chunks/{chunk-MM7TH7ZM.js → chunk-CFDR3GNL.js} +18 -3
  71. package/chunks/{chunk-3F2WDAV6.js → chunk-CFVFQWFB.js} +14 -14
  72. package/chunks/{chunk-E2FN6SM7.js → chunk-CIUUYB23.js} +5 -5
  73. package/chunks/{chunk-JCJ7LKNA.js → chunk-DIEFUBV6.js} +1644 -1570
  74. package/chunks/{chunk-KWHKHSIS.js → chunk-DTAPI453.js} +8 -8
  75. package/chunks/{chunk-WWCMSZII.js → chunk-DV2GAGR7.js} +71 -7
  76. package/chunks/{chunk-675H6PLP.js → chunk-DYA25Y7U.js} +1 -1
  77. package/chunks/{chunk-3I6DUGQD.js → chunk-E4WHKETF.js} +32 -4
  78. package/chunks/{chunk-QTERJVPZ.js → chunk-EKTCKZV5.js} +1 -0
  79. package/chunks/{chunk-HX6RLYUO.js → chunk-ENOHFX2M.js} +4 -4
  80. package/chunks/{chunk-VMX5RZQH.js → chunk-EZZJHMFK.js} +18 -9
  81. package/chunks/{chunk-KXDONCPU.js → chunk-FBDRTW3I.js} +4 -4
  82. package/chunks/{chunk-FCYYAB4S.js → chunk-FHPKHXHT.js} +3 -3
  83. package/chunks/{chunk-DQ2O5QOJ.js → chunk-FJZS2MXB.js} +1 -1
  84. package/chunks/{chunk-EQNUDTL6.js → chunk-FVLPZSKH.js} +3 -3
  85. package/chunks/{chunk-2LEOZTBT.js → chunk-FYMMZV5F.js} +111 -26
  86. package/chunks/{chunk-UV6KF7T3.js → chunk-GNZ7MX73.js} +3 -3
  87. package/chunks/chunk-GOFAQQZA.js +132 -0
  88. package/chunks/{chunk-YUFIEIWC.js → chunk-GTM6IHBB.js} +2 -2
  89. package/chunks/{chunk-W3UKBMSI.js → chunk-GU5B6IF3.js} +118 -9
  90. package/chunks/{chunk-PCK4B6LR.js → chunk-GU5XWZU2.js} +1 -1
  91. package/chunks/{chunk-DEEABGH2.js → chunk-H2EDCJIM.js} +5954 -1766
  92. package/chunks/{chunk-FJ5WUMUQ.js → chunk-H36SETQS.js} +1 -1
  93. package/chunks/{chunk-6FMJLI5M.js → chunk-HFVW54NL.js} +41 -6
  94. package/chunks/chunk-HGCQ5SE7.js +136 -0
  95. package/chunks/{chunk-OFZKFPYG.js → chunk-HR4CHEQS.js} +3 -3
  96. package/chunks/{chunk-CO2U743O.js → chunk-I3GX6LGS.js} +4 -4
  97. package/chunks/{chunk-5NNHICSA.js → chunk-I7JDGNG6.js} +3 -3
  98. package/chunks/{chunk-RDJOB6S3.js → chunk-IEBT6DXF.js} +1 -1
  99. package/chunks/{chunk-EU5TBFJI.js → chunk-IV7QPMC2.js} +2 -2
  100. package/chunks/{chunk-B4AJNNOL.js → chunk-J26HHFI5.js} +1 -1
  101. package/chunks/{chunk-CNTR4GR6.js → chunk-JELIWHXD.js} +1 -1
  102. package/chunks/{chunk-FNDXMN7I.js → chunk-JQFMW7BD.js} +936 -223
  103. package/chunks/{chunk-IGTHU3T4.js → chunk-KKN2IE7Q.js} +1 -1
  104. package/chunks/{chunk-TZTAV5RH.js → chunk-KVUBYJDM.js} +2 -2
  105. package/chunks/{chunk-DUNI4EBW.js → chunk-KZXSAQYV.js} +86 -52
  106. package/chunks/chunk-LBOVL47Y.js +29 -0
  107. package/chunks/{chunk-FS674JW4.js → chunk-LBWNSLJK.js} +3 -3
  108. package/chunks/{chunk-I5BT7ADR.js → chunk-LEZFUYPM.js} +4 -4
  109. package/chunks/chunk-LLMGP5IC.js +222 -0
  110. package/chunks/{chunk-44F4LBWZ.js → chunk-LVW7BHTW.js} +56 -18
  111. package/chunks/{chunk-YGE3IXJP.js → chunk-M744OFVE.js} +1 -1
  112. package/chunks/chunk-MISUEWB4.js +8749 -0
  113. package/chunks/{chunk-7SJN2IWT.js → chunk-MJ2SKNTY.js} +5 -5
  114. package/chunks/{chunk-JE2CEOBO.js → chunk-MNTXIO6T.js} +4 -4
  115. package/chunks/{chunk-TEGJSJDF.js → chunk-MOHAWIAW.js} +2 -2
  116. package/chunks/{chunk-54YCNSK5.js → chunk-MVMBE5EH.js} +4521 -10220
  117. package/chunks/{chunk-PZEXDV3H.js → chunk-NCY2CDDX.js} +71 -43
  118. package/chunks/{chunk-TTJZAIFP.js → chunk-NJELCSFL.js} +3 -3
  119. package/chunks/{chunk-A7Y5H4TX.js → chunk-NXDJEZCI.js} +7 -7
  120. package/chunks/{chunk-PQNHRFJC.js → chunk-NYX53SV4.js} +0 -2
  121. package/chunks/{chunk-QARJNL2V.js → chunk-O2ZYHG33.js} +5 -4
  122. package/chunks/{chunk-6PQPKTXP.js → chunk-OPMLL3B3.js} +1 -1
  123. package/chunks/{chunk-PVNQRENX.js → chunk-OUQGNGIU.js} +1 -1
  124. package/chunks/{chunk-V7RNNPGC.js → chunk-P5Y23G2L.js} +18 -1
  125. package/chunks/{chunk-GURGAJTX.js → chunk-PDDYAXL2.js} +4 -1
  126. package/chunks/chunk-PWCQRLM5.js +1170 -0
  127. package/chunks/{chunk-GL4JOZXU.js → chunk-Q43MIWDH.js} +4 -4
  128. package/chunks/{chunk-V4XNUDPE.js → chunk-QFIYH5KR.js} +28 -7
  129. package/chunks/chunk-QL4TN4HS.js +59 -0
  130. package/chunks/{chunk-E6CJ2SMM.js → chunk-QMBEW7EW.js} +2 -2
  131. package/chunks/{chunk-U4VTUMMK.js → chunk-QONSRAEV.js} +1 -1
  132. package/chunks/{chunk-LOY7RWQG.js → chunk-QYPT3QUD.js} +3 -3
  133. package/chunks/{chunk-RG64CDT2.js → chunk-RJAVNGJJ.js} +131 -48
  134. package/chunks/{chunk-Z3S5EMOW.js → chunk-RPYYTL7E.js} +60 -12
  135. package/chunks/{chunk-V25K5ID7.js → chunk-SWCEYR6T.js} +1 -1
  136. package/chunks/{chunk-77V3VIKL.js → chunk-SXGNNAMC.js} +9 -9
  137. package/chunks/{chunk-7KAXXBER.js → chunk-TNQ5BEEB.js} +3 -3
  138. package/chunks/{chunk-R2XWGR75.js → chunk-TYERNYH4.js} +2 -2
  139. package/chunks/{chunk-45IOTAUS.js → chunk-U25CMJYY.js} +1 -1
  140. package/chunks/{chunk-7ULQIS27.js → chunk-UEJESCS7.js} +1 -1
  141. package/chunks/{chunk-HC45LTEN.js → chunk-UH7Z7Y45.js} +1 -1
  142. package/chunks/{chunk-P5VC5USY.js → chunk-UIKCPMID.js} +1 -1
  143. package/chunks/{chunk-CPZAH673.js → chunk-UKZEXS6K.js} +2 -0
  144. package/chunks/{chunk-HIVKI6O6.js → chunk-UO7AWUZJ.js} +9 -7
  145. package/chunks/{chunk-XP4L6KS3.js → chunk-URN76TKR.js} +2 -2
  146. package/chunks/{chunk-XUGZYLDH.js → chunk-UWSXFI6E.js} +1 -1
  147. package/chunks/{chunk-AOHY3QJ3.js → chunk-VA5NLVPT.js} +3 -3
  148. package/chunks/{chunk-FANRZEAJ.js → chunk-VWOVHOTT.js} +1 -1
  149. package/chunks/{chunk-NTDH4IML.js → chunk-W2K4OEW4.js} +7 -7
  150. package/chunks/{chunk-L32VV3ZJ.js → chunk-WH7W24EN.js} +12 -12
  151. package/chunks/{chunk-QTHQ6Z5X.js → chunk-WK4TJUEA.js} +1 -1
  152. package/chunks/{chunk-ZPZ7ZJEE.js → chunk-WUC6ZFXO.js} +1 -1
  153. package/chunks/{chunk-TIRRPCFS.js → chunk-X6QNZOTC.js} +1 -1
  154. package/chunks/{chunk-IIUGIWWY.js → chunk-XC2VAFVZ.js} +1 -1
  155. package/chunks/{chunk-D4HTUMGX.js → chunk-XC656O42.js} +3 -3
  156. package/chunks/{chunk-ZMOJ7ISP.js → chunk-XXOVLDZQ.js} +1 -1
  157. package/chunks/{chunk-THVU3RNH.js → chunk-YAVY33G4.js} +1 -1
  158. package/chunks/{chunk-PJOHNFIY.js → chunk-YIAC2OXH.js} +5 -5
  159. package/chunks/{chunk-CU47KXB5.js → chunk-YTSN63PD.js} +6 -6
  160. package/chunks/{chunk-DSFHVTWD.js → chunk-YXEVDA66.js} +2 -2
  161. package/chunks/{chunk-MB32MS4U.js → chunk-ZLJQIGCH.js} +260 -175
  162. package/chunks/{chunk-6TAASXWL.js → chunk-ZX6RZZFB.js} +3 -3
  163. package/chunks/{computer-use-5QWCFNKD.js → computer-use-BG2EHNJE.js} +37 -34
  164. package/chunks/{config-utils-WADIDWGG.js → config-utils-E3ZQTHGM.js} +4 -4
  165. package/chunks/{contextCommand-4Z7T7TUM.js → contextCommand-JAPYNKFC.js} +41 -38
  166. package/chunks/{core-runtime-6N4EFC2Q.js → core-runtime-2VCZN5QF.js} +37 -34
  167. package/chunks/{create-sub-session-AEREHZBQ.js → create-sub-session-52OUA2VU.js} +52 -43
  168. package/chunks/{create-sub-session-62YZWVAY.js → create-sub-session-J32WC64U.js} +2 -2
  169. package/chunks/{cron-create-6E7GIQTG.js → cron-create-HMFSHIAR.js} +4 -4
  170. package/chunks/{cron-delete-JD26XY3W.js → cron-delete-ZJFHOX57.js} +4 -4
  171. package/chunks/{cron-list-CUWFB44G.js → cron-list-ZEX2NBMN.js} +4 -4
  172. package/chunks/{daemon-PCNCI5YU.js → daemon-CCIX4BMG.js} +47 -6
  173. package/chunks/{daemon-status-provider-DDF7C5M7.js → daemon-status-provider-F2YGDKHR.js} +48 -45
  174. package/chunks/{daemon-trust-policy-Q4KSOJTR.js → daemon-trust-policy-XCY7JETR.js} +43 -40
  175. package/chunks/{daemon-trust-policy-monitor-V6FTE3IY.js → daemon-trust-policy-monitor-FBHB5GMQ.js} +43 -40
  176. package/chunks/{de-SY6O76BF.js → de-VL76CPLV.js} +50 -5
  177. package/chunks/{deferred-core-runtime-GHJ5GQHK.js → deferred-core-runtime-BBLJ4JUM.js} +37 -34
  178. package/chunks/display-image-2WOG27DY.js +184 -0
  179. package/chunks/{dist-ZHXOBXDN.js → dist-3BMEUGTG.js} +1 -1
  180. package/chunks/{dist-OAOC5OV4.js → dist-7JGAAQSC.js} +2 -2
  181. package/chunks/{dist-SL2LUMML.js → dist-A7H2KKUC.js} +1 -1
  182. package/chunks/{dist-ULIG4M5H.js → dist-C5U4LJKW.js} +162 -15
  183. package/chunks/{dist-2PERFI23.js → dist-DPPHJAVL.js} +3 -3
  184. package/chunks/{dist-PVEAFLHY.js → dist-HVBMEYWK.js} +1 -1
  185. package/chunks/{dist-26BIMQT6.js → dist-IKGVITP3.js} +676 -37
  186. package/chunks/{dist-WGMNT3JQ.js → dist-SFQ34F4M.js} +24 -6
  187. package/chunks/{earlyInputCapture-TQXLLISD.js → earlyInputCapture-ALVSMKP7.js} +38 -35
  188. package/chunks/{edit-FJEUV6KZ.js → edit-POB3CIHQ.js} +37 -34
  189. package/chunks/{en-NBK3JKCE.js → en-IRJ2WN5T.js} +61 -6
  190. package/chunks/{enter-worktree-7GE3TZ4P.js → enter-worktree-Q2N7UZWC.js} +37 -34
  191. package/chunks/{enterPlanMode-KR5TMPCJ.js → enterPlanMode-QGAH2GMP.js} +37 -34
  192. package/chunks/{environment-SWL3CMB3.js → environment-FE5AX2U5.js} +40 -37
  193. package/chunks/{errors-XQE7BGZV.js → errors-SLMCFLSC.js} +40 -37
  194. package/chunks/{exit-worktree-CHKTYNCV.js → exit-worktree-7WO2LPLF.js} +37 -34
  195. package/chunks/{exitPlanMode-QYAG6LWX.js → exitPlanMode-3PINWUTY.js} +37 -34
  196. package/chunks/{fast-path-Z2K7W6DC.js → fast-path-SVFFEL6U.js} +17 -4
  197. package/chunks/{fr-4KG5V7UT.js → fr-GK3HQYVB.js} +50 -5
  198. package/chunks/{gemini-YU4XKEDG.js → gemini-QECJNKNJ.js} +151 -90
  199. package/chunks/{geminiContentGenerator-ZZX6NBO4.js → geminiContentGenerator-ZFAZKT6R.js} +6 -6
  200. package/chunks/{glob-VYF5CXSX.js → glob-GXUNQYNR.js} +37 -34
  201. package/chunks/{goal-tools-HGO6VXPB.js → goal-tools-SPQ5M6D3.js} +3 -3
  202. package/chunks/{grep-5DP5ZUTW.js → grep-LVU5KBCV.js} +37 -34
  203. package/chunks/{handleAutoUpdate-UVBJ56DL.js → handleAutoUpdate-MPDHQY72.js} +43 -40
  204. package/chunks/{i18n-UQNYHEUD.js → i18n-LEYRN6RV.js} +39 -36
  205. package/chunks/{image-gen-WHPIZNWF.js → image-gen-4T2D4PTP.js} +9 -9
  206. package/chunks/{initializer-GMIICF4W.js → initializer-PQV2THBS.js} +44 -41
  207. package/chunks/{installationInfo-4MGG4WVI.js → installationInfo-XC3HXLTX.js} +38 -35
  208. package/chunks/{ja-F3GSQXMF.js → ja-3FA46IKD.js} +50 -5
  209. package/chunks/{keychain-token-storage-IKO4G53C.js → keychain-token-storage-7BT4TQ2A.js} +2 -2
  210. package/chunks/{kittyProtocolDetector-MBRTDRBK.js → kittyProtocolDetector-BFLAKYXH.js} +1 -1
  211. package/chunks/{list-CPN2W334.js → list-AQBTPZRG.js} +46 -43
  212. package/chunks/{list-agents-PXJ7ZUFB.js → list-agents-TWEGRJWO.js} +2 -2
  213. package/chunks/{loadedSettingsAdapter-ZQAV5NDO.js → loadedSettingsAdapter-EZYPDX2J.js} +43 -40
  214. package/chunks/{loggingContentGenerator-5E7W4IEP.js → loggingContentGenerator-WD6YWU7Q.js} +52 -37
  215. package/chunks/{loop-wakeup-Y26NQZ5I.js → loop-wakeup-6LLEOQYV.js} +5 -5
  216. package/chunks/{ls-ONQTTMQR.js → ls-H5WX22VK.js} +4 -4
  217. package/chunks/{lsp-YGHHRGMD.js → lsp-G6FXYEIS.js} +2 -2
  218. package/chunks/{managed-npm-update-MKKAXYXA.js → managed-npm-update-BMM57CHD.js} +40 -37
  219. package/chunks/{mcp-V5NTJF6X.js → mcp-FMI6NCWA.js} +43 -40
  220. package/chunks/{monitor-CO3ASY6E.js → monitor-PZJOYAA2.js} +37 -34
  221. package/chunks/nonInteractiveCli-QPX6R4LL.js +152 -0
  222. package/chunks/{notebook-edit-Z7AEE6FM.js → notebook-edit-GZF2SKTQ.js} +37 -34
  223. package/chunks/{openaiContentGenerator-CA3MQOP3.js → openaiContentGenerator-ZPLCFAAG.js} +18 -18
  224. package/chunks/{pidfile-NL7MKDRU.js → pidfile-PCADVJQW.js} +38 -35
  225. package/chunks/{processUtils-PB5K2DYH.js → processUtils-FKUVQVEU.js} +2 -2
  226. package/chunks/{pt-EQ33KWEN.js → pt-3AOBKPIJ.js} +50 -5
  227. package/chunks/{qwenContentGenerator-JYFNDCOS.js → qwenContentGenerator-2Y4R6YLB.js} +42 -40
  228. package/chunks/{qwenOAuth2-W2ALKQDD.js → qwenOAuth2-UCEHY3I2.js} +8 -8
  229. package/chunks/{read-file-IEOR5H5W.js → read-file-DYHDFVAS.js} +10 -10
  230. package/chunks/{read-mcp-resource-U2IJN5HM.js → read-mcp-resource-DRZSI3HE.js} +2 -2
  231. package/chunks/{record-artifact-MGPJ7EG4.js → record-artifact-IPIRWMFY.js} +3 -3
  232. package/chunks/{resumeHistoryUtils-BNBTP5AS.js → resumeHistoryUtils-5JS6R3AJ.js} +45 -42
  233. package/chunks/{ripGrep-UMQODKEB.js → ripGrep-2QOR3ZQT.js} +37 -34
  234. package/chunks/{ru-7OZAUKGG.js → ru-VJRAMC4W.js} +50 -5
  235. package/chunks/{run-qwen-serve-RN2R6QQW.js → run-qwen-serve-MTVRAUBR.js} +271 -60
  236. package/chunks/{runtime-QFJ2MJF5.js → runtime-DQGE2DYR.js} +50 -45
  237. package/chunks/{scheduler-AMYUFOZI.js → scheduler-BXIZQ4OO.js} +37 -34
  238. package/chunks/{sdk-exporters-http-4BQANSJ6.js → sdk-exporters-http-IKNWQJNV.js} +2 -2
  239. package/chunks/{sdk-impl-Z4VXWVFX.js → sdk-impl-7CUUMQDB.js} +2 -2
  240. package/chunks/{send-message-PMP4ATVM.js → send-message-LHJLVWFD.js} +5 -4
  241. package/chunks/{serve-EIIYJVX3.js → serve-D4GYHFLL.js} +44 -40
  242. package/chunks/{server-EP2LLAPD.js → server-S22MLWTJ.js} +618 -387
  243. package/chunks/{session-GMPZBLOW.js → session-AHNM6YXP.js} +151 -87
  244. package/chunks/{settings-LN7RNKBS.js → settings-77MDDUSX.js} +42 -39
  245. package/chunks/{shell-EM2OWU5X.js → shell-DLD2VQTQ.js} +37 -34
  246. package/chunks/{skill-T5VPSK73.js → skill-3B2PAQE4.js} +27 -14
  247. package/chunks/{skill-settings-GMR3GMNY.js → skill-settings-STR5NF4B.js} +42 -39
  248. package/chunks/{spawnChannel-YPCU62DI.js → spawnChannel-TOWYOVDZ.js} +39 -36
  249. package/chunks/{standalone-update-JAKIM2NF.js → standalone-update-F6ZWABD7.js} +40 -37
  250. package/chunks/{startInteractiveUI-YETQWGYF.js → startInteractiveUI-QR7MHDX7.js} +1829 -1036
  251. package/chunks/{syntheticOutput-D7E6ZFKR.js → syntheticOutput-EYL7DWO7.js} +3 -3
  252. package/chunks/{task-create-NFCYD43L.js → task-create-4ALZMGP5.js} +10 -9
  253. package/chunks/{task-list-TAVMGEVD.js → task-list-6CVQPORX.js} +6 -6
  254. package/chunks/{task-stop-ZDF2UJRM.js → task-stop-Y5ZTFVRX.js} +2 -2
  255. package/chunks/{task-update-6L7LHGEX.js → task-update-IKCEEWJ6.js} +10 -9
  256. package/chunks/{team-create-LFJ6HGNY.js → team-create-LQVIAVRF.js} +37 -34
  257. package/chunks/{team-delete-DPGGRQBU.js → team-delete-CE7DC53R.js} +6 -6
  258. package/chunks/{team-plan-approval-C2KLSDGO.js → team-plan-approval-G5PUNI52.js} +37 -34
  259. package/chunks/terminal-image-renderer-33GSM55L.js +90 -0
  260. package/chunks/{theme-manager-JQ3ZGBP5.js → theme-manager-DBFM5QOG.js} +38 -35
  261. package/chunks/{todoWrite-2UO5G6G6.js → todoWrite-FTZWQRZH.js} +108 -36
  262. package/chunks/{tool-search-FAZBFRJZ.js → tool-search-RGG7BBC4.js} +13 -12
  263. package/chunks/{total-session-admission-5CALIVYO.js → total-session-admission-LY3RMXXI.js} +44 -41
  264. package/chunks/{trustedFolders-KOPSP44S.js → trustedFolders-3M4IQ6K6.js} +39 -36
  265. package/chunks/{update-relaunch-6QL2TICS.js → update-relaunch-G3CMSX3M.js} +5 -5
  266. package/chunks/{updateCheck-4Q6RIKFW.js → updateCheck-ZKFGBDTG.js} +42 -39
  267. package/chunks/{useAutoAcceptIndicator-Q5BMKZV3.js → useAutoAcceptIndicator-7SAFZK5H.js} +47 -44
  268. package/chunks/{validateNonInterActiveAuth-GKOC5F6Z.js → validateNonInterActiveAuth-F2K6UGE4.js} +88 -84
  269. package/chunks/{version-VSATY2LD.js → version-KM6MYV2D.js} +1 -1
  270. package/chunks/{web-fetch-JCLKL6NL.js → web-fetch-SM4LZHRS.js} +13 -13
  271. package/chunks/{web-search-DSQTFUBX.js → web-search-OGKZNDAC.js} +8 -8
  272. package/chunks/{workflow-M6QAVKVJ.js → workflow-HU365RFR.js} +419 -304
  273. package/chunks/{workspace-providers-status-YKLTLMJA.js → workspace-providers-status-QKKXQHL7.js} +46 -43
  274. package/chunks/{workspace-registration-store-5DMGKU64.js → workspace-registration-store-7J7KOXFD.js} +2 -2
  275. package/chunks/{workspace-registry-PTYUSYXX.js → workspace-registry-KC66O6DH.js} +44 -41
  276. package/chunks/{workspace-service-25ML3T47.js → workspace-service-TEV5Q2AA.js} +51 -48
  277. package/chunks/{workspace-skills-status-YKZWOYRX.js → workspace-skills-status-VRL55OMU.js} +45 -42
  278. package/chunks/{workspace-trust-reconciler-5FI2S3OS.js → workspace-trust-reconciler-COC5M7CY.js} +50 -47
  279. package/chunks/{write-file-AY7VLP5X.js → write-file-3SO2BMNO.js} +37 -34
  280. package/chunks/{zh-H3YDK5QW.js → zh-ARWDLDLR.js} +58 -6
  281. package/chunks/{zh-TW-JYCP7XUA.js → zh-TW-Y4RGI3P7.js} +58 -6
  282. package/chunks/{zoom-image-S4LJZMD5.js → zoom-image-O3RWTVKV.js} +10 -10
  283. package/cli.js +32 -48
  284. package/locales/ca.js +68 -4
  285. package/locales/de.js +70 -4
  286. package/locales/en.js +84 -6
  287. package/locales/fr.js +72 -4
  288. package/locales/ja.js +69 -4
  289. package/locales/pt.js +68 -4
  290. package/locales/ru.js +71 -4
  291. package/locales/zh-TW.js +74 -6
  292. package/locales/zh.js +74 -6
  293. package/package.json +3 -3
  294. package/web-shell/assets/{arc-xjArKHU2.js → arc-KuwiZ67W.js} +1 -1
  295. package/web-shell/assets/{architectureDiagram-3BPJPVTR-BgrQDNYG.js → architectureDiagram-3BPJPVTR-Cppop6HB.js} +1 -1
  296. package/web-shell/assets/{blockDiagram-GPEHLZMM-CXxWC-1_.js → blockDiagram-GPEHLZMM-DQ6HT72s.js} +1 -1
  297. package/web-shell/assets/{c4Diagram-AAUBKEIU-Dx1tLm3v.js → c4Diagram-AAUBKEIU-B8TX_Mh-.js} +1 -1
  298. package/web-shell/assets/channel-BZd6Ile0.js +1 -0
  299. package/web-shell/assets/{chunk-2J33WTMH-CBxjogVR.js → chunk-2J33WTMH-B2WBUTp8.js} +1 -1
  300. package/web-shell/assets/{chunk-4BX2VUAB-izb-rY5W.js → chunk-4BX2VUAB-DXUsWC6O.js} +1 -1
  301. package/web-shell/assets/{chunk-55IACEB6-NzLyvSb8.js → chunk-55IACEB6-DtB-6cyk.js} +1 -1
  302. package/web-shell/assets/{chunk-727SXJPM-DVyKb0dl.js → chunk-727SXJPM-B-PhPyC3.js} +1 -1
  303. package/web-shell/assets/{chunk-AQP2D5EJ-BtqL7NzB.js → chunk-AQP2D5EJ-DNaTFMSC.js} +1 -1
  304. package/web-shell/assets/{chunk-FMBD7UC4-iNpdKIO0.js → chunk-FMBD7UC4-DZ345tFf.js} +1 -1
  305. package/web-shell/assets/{chunk-ND2GUHAM-DI7cbFmX.js → chunk-ND2GUHAM-BR_EpgzJ.js} +1 -1
  306. package/web-shell/assets/{chunk-QZHKN3VN-3Y_-xFYs.js → chunk-QZHKN3VN-BTU-0gDT.js} +1 -1
  307. package/web-shell/assets/classDiagram-4FO5ZUOK-B7c-TqtK.js +1 -0
  308. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-B7c-TqtK.js +1 -0
  309. package/web-shell/assets/{cose-bilkent-S5V4N54A--raRatZn.js → cose-bilkent-S5V4N54A-BmsKBCNt.js} +1 -1
  310. package/web-shell/assets/{dagre-BM42HDAG-B8SU70mO.js → dagre-BM42HDAG-Ba8YWdDC.js} +1 -1
  311. package/web-shell/assets/{diagram-2AECGRRQ-ewgoakXo.js → diagram-2AECGRRQ-CCt2SnI6.js} +1 -1
  312. package/web-shell/assets/{diagram-5GNKFQAL-Bm_JLTnS.js → diagram-5GNKFQAL-BVTLXEU7.js} +1 -1
  313. package/web-shell/assets/{diagram-KO2AKTUF-DEIUjUy9.js → diagram-KO2AKTUF-DpDAVCYV.js} +1 -1
  314. package/web-shell/assets/{diagram-LMA3HP47-C2Wmrpj-.js → diagram-LMA3HP47-8ljXg-TB.js} +1 -1
  315. package/web-shell/assets/{diagram-OG6HWLK6-CtYe6bFx.js → diagram-OG6HWLK6-JAXfQSmd.js} +1 -1
  316. package/web-shell/assets/{erDiagram-TEJ5UH35-DfpHcWLV.js → erDiagram-TEJ5UH35-CUeakG6k.js} +1 -1
  317. package/web-shell/assets/{flowDiagram-I6XJVG4X-CAiUhio5.js → flowDiagram-I6XJVG4X-Cd4Wrdwv.js} +1 -1
  318. package/web-shell/assets/{ganttDiagram-6RSMTGT7-CYc7ezr4.js → ganttDiagram-6RSMTGT7-C0nMFvH_.js} +1 -1
  319. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-70lbkcRS.js → gitGraphDiagram-PVQCEYII-uKk88n_L.js} +1 -1
  320. package/web-shell/assets/index-BXGtjHs5.js +1756 -0
  321. package/web-shell/assets/{index-Ww86nT9f.js → index-C1UWBJSX.js} +1 -1
  322. package/web-shell/assets/index-WxSvj2tI.css +5 -0
  323. package/web-shell/assets/{infoDiagram-5YYISTIA-C7e8DWPa.js → infoDiagram-5YYISTIA-GfPN17hR.js} +1 -1
  324. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-BYLr2op-.js → ishikawaDiagram-YF4QCWOH-CDbWTcGa.js} +1 -1
  325. package/web-shell/assets/{journeyDiagram-JHISSGLW-hEibAHKX.js → journeyDiagram-JHISSGLW-J8TvvVFz.js} +1 -1
  326. package/web-shell/assets/{kanban-definition-UN3LZRKU-F2rt8Uhp.js → kanban-definition-UN3LZRKU-Ds_ndLrs.js} +1 -1
  327. package/web-shell/assets/{linear-DPhyNezd.js → linear-DuL9O4i3.js} +1 -1
  328. package/web-shell/assets/{mermaid.core-ZUtnug0n.js → mermaid.core-DtK4PsQB.js} +5 -5
  329. package/web-shell/assets/{mindmap-definition-RKZ34NQL-DDWcMoi8.js → mindmap-definition-RKZ34NQL-DD0r7MS3.js} +1 -1
  330. package/web-shell/assets/{pieDiagram-4H26LBE5-CTRKzw1_.js → pieDiagram-4H26LBE5-CxGPZ8Q-.js} +1 -1
  331. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-CAEwYG_z.js → quadrantDiagram-W4KKPZXB-Ds7Buxed.js} +1 -1
  332. package/web-shell/assets/{requirementDiagram-4Y6WPE33-CRjnH9D9.js → requirementDiagram-4Y6WPE33-DIx28ph5.js} +1 -1
  333. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-LPQT_sOd.js → sankeyDiagram-5OEKKPKP-AxdAYcVX.js} +1 -1
  334. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-Ht2Iqvb0.js → sequenceDiagram-3UESZ5HK-CojoXAZ5.js} +1 -1
  335. package/web-shell/assets/{stateDiagram-AJRCARHV-CIUdqOXu.js → stateDiagram-AJRCARHV-Dy1WN3mi.js} +1 -1
  336. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BaTNMz02.js +1 -0
  337. package/web-shell/assets/{timeline-definition-PNZ67QCA-BcilneZF.js → timeline-definition-PNZ67QCA-DeWe_43M.js} +1 -1
  338. package/web-shell/assets/{vennDiagram-CIIHVFJN-BljwiiH1.js → vennDiagram-CIIHVFJN-BN8PVlFq.js} +1 -1
  339. package/web-shell/assets/{wardley-L42UT6IY-DeKjkYjq.js → wardley-L42UT6IY-CbjV_1hf.js} +1 -1
  340. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-L3U1H7KG.js → wardleyDiagram-YWT4CUSO-D2mw84_p.js} +1 -1
  341. package/web-shell/assets/{xychartDiagram-2RQKCTM6-IJnWsgMT.js → xychartDiagram-2RQKCTM6-er9CTQXi.js} +1 -1
  342. package/web-shell/index.html +2 -2
  343. package/chunks/chunk-4KP2F2TE.js +0 -82
  344. package/chunks/chunk-HGT6JR3U.js +0 -177
  345. package/chunks/nonInteractiveCli-ZJYEOO7U.js +0 -148
  346. package/web-shell/assets/channel-B1cyk94G.js +0 -1
  347. package/web-shell/assets/classDiagram-4FO5ZUOK-BpBYZoRE.js +0 -1
  348. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-BpBYZoRE.js +0 -1
  349. package/web-shell/assets/index-C1k3PDuU.css +0 -5
  350. package/web-shell/assets/index-DZLIXILO.js +0 -1750
  351. package/web-shell/assets/insert-DmRbh9Rv.svg +0 -1
  352. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BmqqQZ6w.js +0 -1
@@ -11,88 +11,92 @@ import {
11
11
  toModelVisibleSubagentResult,
12
12
  writeWorkflowSnapshot,
13
13
  writeWorktreeSessionMarker
14
- } from "./chunk-54YCNSK5.js";
14
+ } from "./chunk-MVMBE5EH.js";
15
+ import "./chunk-GOFAQQZA.js";
15
16
  import "./chunk-5M6IDOMF.js";
16
17
  import "./chunk-TWPJO254.js";
17
18
  import "./chunk-H6XPXXMH.js";
18
- import "./chunk-AOHY3QJ3.js";
19
- import "./chunk-5NNHICSA.js";
20
- import "./chunk-SHN4KHDK.js";
21
- import "./chunk-JXVC2PL3.js";
22
- import "./chunk-KRXPRVGL.js";
19
+ import "./chunk-VA5NLVPT.js";
20
+ import "./chunk-I7JDGNG6.js";
21
+ import "./chunk-A6SX5TAH.js";
22
+ import "./chunk-33FNCQSY.js";
23
23
  import {
24
24
  parsePositiveIntegerEnv
25
25
  } from "./chunk-6PVPNMXU.js";
26
- import "./chunk-ZMOJ7ISP.js";
26
+ import "./chunk-XXOVLDZQ.js";
27
27
  import "./chunk-IRH27ZC2.js";
28
28
  import "./chunk-QHWCP53L.js";
29
- import "./chunk-TEGJSJDF.js";
30
- import "./chunk-TIRRPCFS.js";
29
+ import "./chunk-MOHAWIAW.js";
30
+ import "./chunk-X6QNZOTC.js";
31
31
  import "./chunk-O6GEWCJA.js";
32
32
  import "./chunk-T26EAKDL.js";
33
+ import "./chunk-ZPJWUGCS.js";
33
34
  import "./chunk-CPBF7KYF.js";
34
- import "./chunk-4KP2F2TE.js";
35
- import "./chunk-3APUUXRF.js";
36
- import "./chunk-THVU3RNH.js";
37
- import "./chunk-LHKCY7DY.js";
38
- import "./chunk-6FMJLI5M.js";
35
+ import "./chunk-MISUEWB4.js";
36
+ import "./chunk-KRXPRVGL.js";
37
+ import "./chunk-A5YZ3FA2.js";
38
+ import "./chunk-YAVY33G4.js";
39
+ import "./chunk-2UISUFHQ.js";
40
+ import "./chunk-HFVW54NL.js";
39
41
  import {
40
42
  SUBAGENT_PLAN_LIFECYCLE_TOOLS,
41
43
  runWithAgentContext
42
- } from "./chunk-CBBP4BMC.js";
44
+ } from "./chunk-LLMGP5IC.js";
43
45
  import "./chunk-S6LOFUVP.js";
46
+ import "./chunk-7UXI6P72.js";
44
47
  import "./chunk-K623ENWT.js";
45
48
  import "./chunk-AQ37AY7B.js";
46
49
  import {
47
50
  WorkspaceContext
48
- } from "./chunk-N4ACHWNH.js";
49
- import "./chunk-ZPJWUGCS.js";
50
- import "./chunk-D4HTUMGX.js";
51
+ } from "./chunk-432XCUHF.js";
52
+ import "./chunk-YXEVDA66.js";
53
+ import "./chunk-XC656O42.js";
51
54
  import "./chunk-NAVJD2PQ.js";
52
- import "./chunk-LOY7RWQG.js";
53
- import "./chunk-E6CJ2SMM.js";
55
+ import "./chunk-QYPT3QUD.js";
56
+ import "./chunk-QMBEW7EW.js";
54
57
  import "./chunk-DGEIYUC3.js";
55
58
  import "./chunk-MPHPFVKK.js";
56
59
  import "./chunk-GLNBDYUX.js";
57
60
  import {
61
+ createAbortController,
58
62
  createChildAbortController
59
63
  } from "./chunk-DJ2GSRLV.js";
60
- import "./chunk-6CQWRWUC.js";
61
- import "./chunk-Z3S5EMOW.js";
64
+ import "./chunk-7XLPYF6B.js";
65
+ import "./chunk-RPYYTL7E.js";
62
66
  import "./chunk-2J3OJGTL.js";
63
67
  import "./chunk-P3QQPMQA.js";
64
- import "./chunk-XQK4XXTN.js";
68
+ import "./chunk-6O5DVH27.js";
65
69
  import "./chunk-GLCZKT5V.js";
66
- import "./chunk-QDK4F2N5.js";
70
+ import "./chunk-2DNKEBXY.js";
67
71
  import {
68
72
  WorkflowRunEvent,
69
73
  logWorkflowRun,
70
74
  read,
71
75
  writeLine
72
- } from "./chunk-DUNI4EBW.js";
76
+ } from "./chunk-KZXSAQYV.js";
73
77
  import "./chunk-VGC4I5JJ.js";
74
- import "./chunk-3I6DUGQD.js";
78
+ import "./chunk-E4WHKETF.js";
75
79
  import {
76
80
  SyntheticOutputTool
77
- } from "./chunk-7ULQIS27.js";
81
+ } from "./chunk-UEJESCS7.js";
78
82
  import {
79
83
  BaseDeclarativeTool,
80
84
  BaseToolInvocation,
81
85
  ToolDisplayNames,
82
86
  ToolNames
83
- } from "./chunk-MM7TH7ZM.js";
84
- import "./chunk-HIVKI6O6.js";
87
+ } from "./chunk-CFDR3GNL.js";
88
+ import "./chunk-UO7AWUZJ.js";
85
89
  import "./chunk-46UV252V.js";
86
90
  import "./chunk-ZBVS26BY.js";
87
- import "./chunk-Q3T5KA2V.js";
88
- import "./chunk-R2XWGR75.js";
89
- import "./chunk-HC45LTEN.js";
90
- import "./chunk-QARJNL2V.js";
91
+ import "./chunk-BFHXDAR7.js";
92
+ import "./chunk-TYERNYH4.js";
93
+ import "./chunk-UH7Z7Y45.js";
94
+ import "./chunk-O2ZYHG33.js";
91
95
  import "./chunk-W4RQUHY3.js";
92
96
  import "./chunk-G7XXKQYS.js";
93
97
  import {
94
98
  createDebugLogger
95
- } from "./chunk-E2BHWIDT.js";
99
+ } from "./chunk-3RXUYQJI.js";
96
100
  import "./chunk-VOQXFAY5.js";
97
101
  import "./chunk-75DOP5OR.js";
98
102
  import "./chunk-DMTGGOSA.js";
@@ -109,6 +113,95 @@ import {
109
113
  // packages/core/src/tools/workflow/workflow.ts
110
114
  init_esbuild_shims();
111
115
 
116
+ // packages/core/src/agents/runtime/workflow-budget.ts
117
+ init_esbuild_shims();
118
+ var debugLogger = createDebugLogger("WORKFLOW_BUDGET");
119
+ var MAX_TOKENS_PER_WORKFLOW_ENV = "QWEN_CODE_MAX_TOKENS_PER_WORKFLOW";
120
+ var HARD_MAX_TOKENS_CEILING = 1e8;
121
+ function resolveMaxTokensPerWorkflow(env = process.env) {
122
+ const raw = env[MAX_TOKENS_PER_WORKFLOW_ENV];
123
+ if (raw === void 0 || raw.trim() === "") {
124
+ return null;
125
+ }
126
+ const parsed = parsePositiveIntegerEnv(raw, 0);
127
+ if (parsed < 1) {
128
+ debugLogger.warn(
129
+ `Invalid ${MAX_TOKENS_PER_WORKFLOW_ENV}=${JSON.stringify(raw)}, treating as unset (no cap)`
130
+ );
131
+ return null;
132
+ }
133
+ if (parsed > HARD_MAX_TOKENS_CEILING) {
134
+ debugLogger.warn(
135
+ `${MAX_TOKENS_PER_WORKFLOW_ENV}=${parsed} exceeds hard ceiling (${HARD_MAX_TOKENS_CEILING}); clamping.`
136
+ );
137
+ return HARD_MAX_TOKENS_CEILING;
138
+ }
139
+ return parsed;
140
+ }
141
+ __name(resolveMaxTokensPerWorkflow, "resolveMaxTokensPerWorkflow");
142
+ var WorkflowBudgetImpl = class _WorkflowBudgetImpl {
143
+ static {
144
+ __name(this, "WorkflowBudgetImpl");
145
+ }
146
+ total;
147
+ _spent;
148
+ constructor(total) {
149
+ this.total = total;
150
+ this._spent = 0;
151
+ }
152
+ spent() {
153
+ return this._spent;
154
+ }
155
+ remaining() {
156
+ if (this.total === null) return Infinity;
157
+ return Math.max(0, this.total - this._spent);
158
+ }
159
+ /**
160
+ * Host-side increment. NOT exposed to the script — the
161
+ * `WorkflowBudget` interface deliberately omits any setter so a
162
+ * malicious workflow cannot inflate / deflate the budget. Only the
163
+ * orchestrator (in `countedDispatch`) calls this after a dispatch
164
+ * resolves with the agent's output token count.
165
+ *
166
+ * Non-positive deltas are silently dropped (some dispatches return
167
+ * `output_tokens: 0` on early failures); negative deltas would be a
168
+ * caller bug and are also dropped rather than silently rewinding
169
+ * the counter.
170
+ */
171
+ recordSpent(deltaTokens) {
172
+ if (!Number.isFinite(deltaTokens) || deltaTokens <= 0) return;
173
+ this._spent += deltaTokens;
174
+ }
175
+ /**
176
+ * Factory: build a budget from the current environment. Convenience
177
+ * over `new WorkflowBudgetImpl(resolveMaxTokensPerWorkflow(env))`.
178
+ */
179
+ static fromEnv(env = process.env) {
180
+ return new _WorkflowBudgetImpl(resolveMaxTokensPerWorkflow(env));
181
+ }
182
+ };
183
+ var WorkflowBudgetExceededError = class extends Error {
184
+ static {
185
+ __name(this, "WorkflowBudgetExceededError");
186
+ }
187
+ name = "WorkflowBudgetExceededError";
188
+ runId;
189
+ budgetTotal;
190
+ spent;
191
+ constructor(runId, budgetTotal, spent) {
192
+ super(
193
+ `Workflow ${runId} exceeded the token budget (${spent} / ${budgetTotal} output tokens spent).`
194
+ );
195
+ this.runId = runId;
196
+ this.budgetTotal = budgetTotal;
197
+ this.spent = spent;
198
+ }
199
+ };
200
+
201
+ // packages/core/src/agents/runtime/workflow-runner.ts
202
+ init_esbuild_shims();
203
+ import { randomBytes as randomBytes2 } from "node:crypto";
204
+
112
205
  // packages/core/src/agents/runtime/workflow-orchestrator.ts
113
206
  init_esbuild_shims();
114
207
  import { randomBytes } from "node:crypto";
@@ -294,7 +387,7 @@ function isRegexContext(source, i) {
294
387
  return /[{[(,;:=!&|?+\-*/%^~<>]/.test(prev);
295
388
  }
296
389
  __name(isRegexContext, "isRegexContext");
297
- var debugLogger = createDebugLogger("WORKFLOW");
390
+ var debugLogger2 = createDebugLogger("WORKFLOW");
298
391
  var MAX_LOG_LINES = 1e4;
299
392
  var MAX_PHASE_ENTRIES = 1e4;
300
393
  var ARGS_MAX_DEPTH = 64;
@@ -353,7 +446,7 @@ function createWorkflowSandbox(opts) {
353
446
  try {
354
447
  opts.emitter?.logAppended?.(line);
355
448
  } catch (e) {
356
- debugLogger.warn("emitter.logAppended threw:", e);
449
+ debugLogger2.warn("emitter.logAppended threw:", e);
357
450
  }
358
451
  } else if (logs.length === MAX_LOG_LINES) {
359
452
  logs.push(`[workflow log truncated at ${MAX_LOG_LINES} lines]`);
@@ -367,7 +460,7 @@ function createWorkflowSandbox(opts) {
367
460
  try {
368
461
  opts.emitter?.phaseStarted?.(t);
369
462
  } catch (e) {
370
- debugLogger.warn("emitter.phaseStarted threw:", e);
463
+ debugLogger2.warn("emitter.phaseStarted threw:", e);
371
464
  }
372
465
  } else if (phases.length === MAX_PHASE_ENTRIES) {
373
466
  phases.push(
@@ -390,7 +483,7 @@ function createWorkflowSandbox(opts) {
390
483
  // value" (this warn). Receives only primitive strings/numbers — the bridge
391
484
  // contract forbids host objects crossing back to the script.
392
485
  logRevivalFailure: /* @__PURE__ */ __name((idx, reason) => {
393
- debugLogger.warn(
486
+ debugLogger2.warn(
394
487
  `Workflow result revival failed at index ${idx}: ${reason}; slot set to null (non-JSON-serializable thunk return).`
395
488
  );
396
489
  }, "logRevivalFailure"),
@@ -819,91 +912,6 @@ ${stripped}
819
912
  }
820
913
  __name(createWorkflowSandbox, "createWorkflowSandbox");
821
914
 
822
- // packages/core/src/agents/runtime/workflow-budget.ts
823
- init_esbuild_shims();
824
- var debugLogger2 = createDebugLogger("WORKFLOW_BUDGET");
825
- var MAX_TOKENS_PER_WORKFLOW_ENV = "QWEN_CODE_MAX_TOKENS_PER_WORKFLOW";
826
- var HARD_MAX_TOKENS_CEILING = 1e8;
827
- function resolveMaxTokensPerWorkflow(env = process.env) {
828
- const raw = env[MAX_TOKENS_PER_WORKFLOW_ENV];
829
- if (raw === void 0 || raw.trim() === "") {
830
- return null;
831
- }
832
- const parsed = parsePositiveIntegerEnv(raw, 0);
833
- if (parsed < 1) {
834
- debugLogger2.warn(
835
- `Invalid ${MAX_TOKENS_PER_WORKFLOW_ENV}=${JSON.stringify(raw)}, treating as unset (no cap)`
836
- );
837
- return null;
838
- }
839
- if (parsed > HARD_MAX_TOKENS_CEILING) {
840
- debugLogger2.warn(
841
- `${MAX_TOKENS_PER_WORKFLOW_ENV}=${parsed} exceeds hard ceiling (${HARD_MAX_TOKENS_CEILING}); clamping.`
842
- );
843
- return HARD_MAX_TOKENS_CEILING;
844
- }
845
- return parsed;
846
- }
847
- __name(resolveMaxTokensPerWorkflow, "resolveMaxTokensPerWorkflow");
848
- var WorkflowBudgetImpl = class _WorkflowBudgetImpl {
849
- static {
850
- __name(this, "WorkflowBudgetImpl");
851
- }
852
- total;
853
- _spent;
854
- constructor(total) {
855
- this.total = total;
856
- this._spent = 0;
857
- }
858
- spent() {
859
- return this._spent;
860
- }
861
- remaining() {
862
- if (this.total === null) return Infinity;
863
- return Math.max(0, this.total - this._spent);
864
- }
865
- /**
866
- * Host-side increment. NOT exposed to the script — the
867
- * `WorkflowBudget` interface deliberately omits any setter so a
868
- * malicious workflow cannot inflate / deflate the budget. Only the
869
- * orchestrator (in `countedDispatch`) calls this after a dispatch
870
- * resolves with the agent's output token count.
871
- *
872
- * Non-positive deltas are silently dropped (some dispatches return
873
- * `output_tokens: 0` on early failures); negative deltas would be a
874
- * caller bug and are also dropped rather than silently rewinding
875
- * the counter.
876
- */
877
- recordSpent(deltaTokens) {
878
- if (!Number.isFinite(deltaTokens) || deltaTokens <= 0) return;
879
- this._spent += deltaTokens;
880
- }
881
- /**
882
- * Factory: build a budget from the current environment. Convenience
883
- * over `new WorkflowBudgetImpl(resolveMaxTokensPerWorkflow(env))`.
884
- */
885
- static fromEnv(env = process.env) {
886
- return new _WorkflowBudgetImpl(resolveMaxTokensPerWorkflow(env));
887
- }
888
- };
889
- var WorkflowBudgetExceededError = class extends Error {
890
- static {
891
- __name(this, "WorkflowBudgetExceededError");
892
- }
893
- name = "WorkflowBudgetExceededError";
894
- runId;
895
- budgetTotal;
896
- spent;
897
- constructor(runId, budgetTotal, spent) {
898
- super(
899
- `Workflow ${runId} exceeded the token budget (${spent} / ${budgetTotal} output tokens spent).`
900
- );
901
- this.runId = runId;
902
- this.budgetTotal = budgetTotal;
903
- this.spent = spent;
904
- }
905
- };
906
-
907
915
  // packages/core/src/agents/runtime/workflow-stall.ts
908
916
  init_esbuild_shims();
909
917
  var DEFAULT_STALL_MS = 6e4;
@@ -1199,13 +1207,13 @@ function resolveMaxAgentsPerRun(env = process.env) {
1199
1207
  }
1200
1208
  const parsed = parsePositiveIntegerEnv(raw, 0);
1201
1209
  if (parsed < 1) {
1202
- debugLogger.warn(
1210
+ debugLogger2.warn(
1203
1211
  `Invalid ${MAX_WORKFLOW_AGENTS_ENV}=${JSON.stringify(raw)}, using default (${DEFAULT_MAX_AGENTS_PER_RUN})`
1204
1212
  );
1205
1213
  return DEFAULT_MAX_AGENTS_PER_RUN;
1206
1214
  }
1207
1215
  if (parsed > HARD_MAX_AGENTS_PER_RUN_CEILING) {
1208
- debugLogger.warn(
1216
+ debugLogger2.warn(
1209
1217
  `${MAX_WORKFLOW_AGENTS_ENV}=${parsed} exceeds hard ceiling (${HARD_MAX_AGENTS_PER_RUN_CEILING}); clamping.`
1210
1218
  );
1211
1219
  return HARD_MAX_AGENTS_PER_RUN_CEILING;
@@ -1221,14 +1229,14 @@ function resolveConcurrencyLimit(env = process.env) {
1221
1229
  const parsed = parsePositiveIntegerEnv(raw, 0);
1222
1230
  if (parsed >= 1) {
1223
1231
  if (parsed > HARD_MAX_CONCURRENCY_CEILING) {
1224
- debugLogger.warn(
1232
+ debugLogger2.warn(
1225
1233
  `${MAX_WORKFLOW_CONCURRENCY_ENV}=${parsed} exceeds hard ceiling (${HARD_MAX_CONCURRENCY_CEILING}); clamping.`
1226
1234
  );
1227
1235
  return HARD_MAX_CONCURRENCY_CEILING;
1228
1236
  }
1229
1237
  return parsed;
1230
1238
  }
1231
- debugLogger.warn(
1239
+ debugLogger2.warn(
1232
1240
  `Invalid ${MAX_WORKFLOW_CONCURRENCY_ENV}=${JSON.stringify(raw)}, using cpu-derived default`
1233
1241
  );
1234
1242
  }
@@ -1238,6 +1246,7 @@ __name(resolveConcurrencyLimit, "resolveConcurrencyLimit");
1238
1246
  var WORKFLOW_SUBAGENT_MAX_TURNS = 50;
1239
1247
  var WORKFLOW_SUBAGENT_MAX_TIME_MINUTES = 10;
1240
1248
  var WORKFLOW_SUBAGENT_DISALLOWED_TOOLS = [
1249
+ ToolNames.ASK_USER_QUESTION,
1241
1250
  ToolNames.SEND_MESSAGE,
1242
1251
  ToolNames.MONITOR,
1243
1252
  ...SUBAGENT_PLAN_LIFECYCLE_TOOLS,
@@ -1269,20 +1278,27 @@ function sanitizeForErrorMessage(value) {
1269
1278
  return stripAnsiAndControl(value);
1270
1279
  }
1271
1280
  __name(sanitizeForErrorMessage, "sanitizeForErrorMessage");
1272
- function createProductionDispatch(config, signal, onTokens) {
1281
+ function createProductionDispatch(config, signal, onTokens, bridgeApprovalEvents) {
1273
1282
  return async (prompt, opts) => {
1274
1283
  const stallMs = resolveStallMs(
1275
1284
  typeof opts.stallMs === "number" ? opts.stallMs : void 0
1276
1285
  );
1277
1286
  return runStallResilient(
1278
- (attemptSignal, emitter) => runSingleDispatch(
1279
- config,
1280
- prompt,
1281
- opts,
1282
- attemptSignal,
1283
- emitter,
1284
- onTokens
1285
- ),
1287
+ async (attemptSignal, emitter) => {
1288
+ const cleanupApprovalBridge = bridgeApprovalEvents?.(emitter);
1289
+ try {
1290
+ return await runSingleDispatch(
1291
+ config,
1292
+ prompt,
1293
+ opts,
1294
+ attemptSignal,
1295
+ emitter,
1296
+ onTokens
1297
+ );
1298
+ } finally {
1299
+ cleanupApprovalBridge?.();
1300
+ }
1301
+ },
1286
1302
  {
1287
1303
  stallMs,
1288
1304
  signal,
@@ -1293,11 +1309,11 @@ function createProductionDispatch(config, signal, onTokens) {
1293
1309
  }
1294
1310
  __name(createProductionDispatch, "createProductionDispatch");
1295
1311
  async function runSingleDispatch(config, prompt, opts, attemptSignal, emitter, onTokens) {
1296
- const { AgentHeadless, ContextState } = await import("./agent-headless-EO53EFS2.js");
1312
+ const { AgentHeadless, ContextState } = await import("./agent-headless-I7VMHI22.js");
1297
1313
  const ctx = new ContextState();
1298
1314
  ctx.set("task_prompt", prompt);
1299
1315
  const workflowAgentId = `workflow-agent-${randomBytes(8).toString("hex")}`;
1300
- debugLogger.debug(`[workflow] Dispatch ${workflowAgentId}`);
1316
+ debugLogger2.debug(`[workflow] Dispatch ${workflowAgentId}`);
1301
1317
  if (opts.agentType === void 0 && opts.model === void 0 && opts.isolation === void 0 && opts.schema === void 0) {
1302
1318
  const subagent = await AgentHeadless.create(
1303
1319
  opts.label ?? "workflow-agent",
@@ -1355,7 +1371,7 @@ function reportTokens(subagent, opts, onTokens) {
1355
1371
  const summary = subagent.getExecutionSummary();
1356
1372
  onTokens(summary.outputTokens, opts);
1357
1373
  } catch (e) {
1358
- debugLogger.warn("onTokens callback threw:", e);
1374
+ debugLogger2.warn("onTokens callback threw:", e);
1359
1375
  }
1360
1376
  }
1361
1377
  __name(reportTokens, "reportTokens");
@@ -1474,7 +1490,7 @@ ${WORKFLOW_SUBAGENT_SYSTEM_PROMPT_WITH_SCHEMA}` : WORKFLOW_SUBAGENT_SYSTEM_PROMP
1474
1490
  worktreeIsolation = null;
1475
1491
  const preserved = await cleanupWorkflowWorktree(isolation);
1476
1492
  if (preserved) {
1477
- debugLogger.info(
1493
+ debugLogger2.info(
1478
1494
  `[Workflow] Schema-mode subagent preserved worktree at ${preserved.path ?? "(directory removed)"} on branch ${preserved.branch}. The structured payload is returned verbatim; recover the work from the preserved path / branch.`
1479
1495
  );
1480
1496
  }
@@ -1529,7 +1545,7 @@ ${WORKFLOW_SUBAGENT_SYSTEM_PROMPT_WITH_SCHEMA}` : WORKFLOW_SUBAGENT_SYSTEM_PROMP
1529
1545
  try {
1530
1546
  await cleanupWorkflowWorktree(worktreeIsolation);
1531
1547
  } catch (error) {
1532
- debugLogger.warn(
1548
+ debugLogger2.warn(
1533
1549
  `Workflow worktree cleanup in fallback finally failed for ${worktreeIsolation.path}: ${error instanceof Error ? error.message : String(error)}`
1534
1550
  );
1535
1551
  }
@@ -1562,7 +1578,7 @@ async function provisionWorkflowWorktree(config) {
1562
1578
  try {
1563
1579
  parentDirty = await wtService.hasWorktreeChanges(projectRoot);
1564
1580
  } catch (error) {
1565
- debugLogger.warn(
1581
+ debugLogger2.warn(
1566
1582
  `[Workflow] hasWorktreeChanges failed at ${projectRoot}: ${error}`
1567
1583
  );
1568
1584
  parentDirty = true;
@@ -1577,7 +1593,7 @@ async function provisionWorkflowWorktree(config) {
1577
1593
  try {
1578
1594
  parentBranch = await wtService.getCurrentBranch();
1579
1595
  } catch (error) {
1580
- debugLogger.warn(
1596
+ debugLogger2.warn(
1581
1597
  `[Workflow] getCurrentBranch failed at ${projectRoot}: ${error}`
1582
1598
  );
1583
1599
  }
@@ -1595,7 +1611,7 @@ async function provisionWorkflowWorktree(config) {
1595
1611
  config.getSessionId()
1596
1612
  );
1597
1613
  } catch (error) {
1598
- debugLogger.warn(
1614
+ debugLogger2.warn(
1599
1615
  `[Workflow] failed to write session marker at ${created.worktree.path}: ${error}`
1600
1616
  );
1601
1617
  }
@@ -1628,20 +1644,20 @@ async function cleanupWorkflowWorktree(isolation) {
1628
1644
  const wtService = new GitWorktreeService(isolation.repoRoot);
1629
1645
  const [hasChanges, hasUnmerged] = await Promise.all([
1630
1646
  wtService.hasWorktreeChanges(isolation.path).catch((error) => {
1631
- debugLogger.warn(
1647
+ debugLogger2.warn(
1632
1648
  `[Workflow] hasWorktreeChanges failed for ${isolation.path}: ${error}`
1633
1649
  );
1634
1650
  return true;
1635
1651
  }),
1636
1652
  wtService.hasUnmergedWorktreeCommits(isolation.slug).catch((error) => {
1637
- debugLogger.warn(
1653
+ debugLogger2.warn(
1638
1654
  `[Workflow] hasUnmergedWorktreeCommits failed for ${isolation.slug}: ${error}`
1639
1655
  );
1640
1656
  return true;
1641
1657
  })
1642
1658
  ]);
1643
1659
  if (hasChanges || hasUnmerged) {
1644
- debugLogger.info(
1660
+ debugLogger2.info(
1645
1661
  `[Workflow] Preserving isolation worktree ${isolation.path} (branch ${isolation.branch}, hasChanges=${hasChanges}, hasUnmerged=${hasUnmerged})`
1646
1662
  );
1647
1663
  return { path: isolation.path, branch: isolation.branch };
@@ -1651,19 +1667,19 @@ async function cleanupWorkflowWorktree(isolation) {
1651
1667
  deleteBranch: true
1652
1668
  });
1653
1669
  if (!result.success) {
1654
- debugLogger.warn(
1670
+ debugLogger2.warn(
1655
1671
  `[Workflow] Failed to remove ephemeral worktree ${isolation.path}: ${result.error}`
1656
1672
  );
1657
1673
  return { path: isolation.path, branch: isolation.branch };
1658
1674
  }
1659
1675
  if (result.branchPreserved) {
1660
- debugLogger.warn(
1676
+ debugLogger2.warn(
1661
1677
  `[Workflow] Removed worktree directory ${isolation.path} but kept branch ${isolation.branch} (unmerged commits at delete time)`
1662
1678
  );
1663
1679
  return { branch: isolation.branch };
1664
1680
  }
1665
1681
  } catch (error) {
1666
- debugLogger.warn(
1682
+ debugLogger2.warn(
1667
1683
  `[Workflow] Failed to remove ephemeral worktree ${isolation.path}: ${error}`
1668
1684
  );
1669
1685
  return { path: isolation.path, branch: isolation.branch };
@@ -1751,7 +1767,7 @@ var WorkflowOrchestrator = class {
1751
1767
  if (cached !== void 0) {
1752
1768
  const respawns = replay.started.get(journalKey);
1753
1769
  if (respawns && respawns.length > 0) {
1754
- debugLogger.info(
1770
+ debugLogger2.info(
1755
1771
  `[Workflow] resume cache hit after ${respawns.length} prior respawn(s) for runId=${runId}.`
1756
1772
  );
1757
1773
  }
@@ -1759,12 +1775,12 @@ var WorkflowOrchestrator = class {
1759
1775
  try {
1760
1776
  emitter?.agentDispatched?.(label2);
1761
1777
  } catch (e) {
1762
- debugLogger.warn("emitter.agentDispatched threw:", e);
1778
+ debugLogger2.warn("emitter.agentDispatched threw:", e);
1763
1779
  }
1764
1780
  try {
1765
1781
  emitter?.agentCompleted?.(label2);
1766
1782
  } catch (e) {
1767
- debugLogger.warn("emitter.agentCompleted threw:", e);
1783
+ debugLogger2.warn("emitter.agentCompleted threw:", e);
1768
1784
  }
1769
1785
  return Promise.resolve(cached.result);
1770
1786
  }
@@ -1772,11 +1788,11 @@ var WorkflowOrchestrator = class {
1772
1788
  hadMiss = true;
1773
1789
  journalEntryId = String(journalAgentId += 1);
1774
1790
  journal.append({ type: "started", key: journalKey, agentId: journalEntryId }).catch(
1775
- (e) => debugLogger.warn(`journal started-append failed: ${e}`)
1791
+ (e) => debugLogger2.warn(`journal started-append failed: ${e}`)
1776
1792
  );
1777
1793
  }
1778
1794
  if (budget && budget.total !== null && budget.remaining() <= 0) {
1779
- debugLogger.warn(
1795
+ debugLogger2.warn(
1780
1796
  `[Workflow] budget gate refused dispatch at entry: runId=${runId} spent=${budget.spent()} total=${budget.total}`
1781
1797
  );
1782
1798
  return Promise.reject(
@@ -1795,11 +1811,11 @@ var WorkflowOrchestrator = class {
1795
1811
  try {
1796
1812
  emitter?.agentDispatched?.(label);
1797
1813
  } catch (e) {
1798
- debugLogger.warn("emitter.agentDispatched threw:", e);
1814
+ debugLogger2.warn("emitter.agentDispatched threw:", e);
1799
1815
  }
1800
1816
  return limiter.run(() => {
1801
1817
  if (budget && budget.total !== null && budget.remaining() <= 0) {
1802
- debugLogger.warn(
1818
+ debugLogger2.warn(
1803
1819
  `[Workflow] budget gate refused dispatch at slot-acquire: runId=${runId} spent=${budget.spent()} total=${budget.total}`
1804
1820
  );
1805
1821
  throw new WorkflowBudgetExceededError(
@@ -1814,7 +1830,7 @@ var WorkflowOrchestrator = class {
1814
1830
  try {
1815
1831
  emitter?.agentCompleted?.(label);
1816
1832
  } catch (e) {
1817
- debugLogger.warn("emitter.agentCompleted threw:", e);
1833
+ debugLogger2.warn("emitter.agentCompleted threw:", e);
1818
1834
  }
1819
1835
  if (journal && journalKey !== void 0) {
1820
1836
  journal.append({
@@ -1823,14 +1839,14 @@ var WorkflowOrchestrator = class {
1823
1839
  agentId: journalEntryId ?? "",
1824
1840
  result
1825
1841
  }).catch(
1826
- (e) => debugLogger.warn(`journal result-append failed: ${e}`)
1842
+ (e) => debugLogger2.warn(`journal result-append failed: ${e}`)
1827
1843
  );
1828
1844
  }
1829
1845
  if (budget) {
1830
1846
  try {
1831
1847
  emitter?.budgetUpdated?.(budget.spent(), budget.total);
1832
1848
  } catch (e) {
1833
- debugLogger.warn("emitter.budgetUpdated threw:", e);
1849
+ debugLogger2.warn("emitter.budgetUpdated threw:", e);
1834
1850
  }
1835
1851
  }
1836
1852
  return result;
@@ -1840,13 +1856,13 @@ var WorkflowOrchestrator = class {
1840
1856
  try {
1841
1857
  emitter?.agentCompleted?.(label, msg);
1842
1858
  } catch (e) {
1843
- debugLogger.warn("emitter.agentCompleted threw:", e);
1859
+ debugLogger2.warn("emitter.agentCompleted threw:", e);
1844
1860
  }
1845
1861
  if (budget) {
1846
1862
  try {
1847
1863
  emitter?.budgetUpdated?.(budget.spent(), budget.total);
1848
1864
  } catch (e) {
1849
- debugLogger.warn("emitter.budgetUpdated threw:", e);
1865
+ debugLogger2.warn("emitter.budgetUpdated threw:", e);
1850
1866
  }
1851
1867
  }
1852
1868
  throw err;
@@ -1912,14 +1928,14 @@ async function settleToNullArray(thunks, signal, kind = "parallel") {
1912
1928
  if (reason?.name === "WorkflowBudgetExceededError") {
1913
1929
  budgetDropped += 1;
1914
1930
  } else {
1915
- debugLogger.warn(
1931
+ debugLogger2.warn(
1916
1932
  `Workflow thunk at index ${i} rejected: ${String(reason?.message ?? r.reason)}`
1917
1933
  );
1918
1934
  }
1919
1935
  return null;
1920
1936
  });
1921
1937
  if (budgetDropped > 0) {
1922
- debugLogger.warn(
1938
+ debugLogger2.warn(
1923
1939
  `${kind}: ${budgetDropped} slot${budgetDropped === 1 ? "" : "s"} dropped \u2014 token budget exceeded.`
1924
1940
  );
1925
1941
  }
@@ -1992,8 +2008,176 @@ function extractErrorMessage(err) {
1992
2008
  }
1993
2009
  __name(extractErrorMessage, "extractErrorMessage");
1994
2010
 
2011
+ // packages/core/src/agents/runtime/workflow-runner.ts
2012
+ var WorkflowRunHandle = class {
2013
+ constructor(runId, budget, registry, controller, start) {
2014
+ this.runId = runId;
2015
+ this.budget = budget;
2016
+ this.registry = registry;
2017
+ this.controller = controller;
2018
+ this.completion = Promise.resolve().then(start);
2019
+ }
2020
+ static {
2021
+ __name(this, "WorkflowRunHandle");
2022
+ }
2023
+ completion;
2024
+ abort() {
2025
+ this.controller.abort();
2026
+ }
2027
+ };
2028
+ var WorkflowRunner = class {
2029
+ static {
2030
+ __name(this, "WorkflowRunner");
2031
+ }
2032
+ static async start(options) {
2033
+ const config = options.config;
2034
+ const runInBackground = options.runInBackground === true;
2035
+ const budget = WorkflowBudgetImpl.fromEnv();
2036
+ const loaded = options.scriptPath && options.script === void 0 ? await resolveSavedWorkflowScript(
2037
+ { scriptPath: options.scriptPath },
2038
+ config
2039
+ ) : void 0;
2040
+ const script = loaded?.script ?? options.script ?? "";
2041
+ const scriptPath = loaded?.scriptPath ?? options.scriptPath;
2042
+ const runId = options.resumeFromRunId ?? `wf_${randomBytes2(8).toString("hex")}`;
2043
+ const storage = config.storage;
2044
+ const journal = storage ? new WorkflowJournal(storage.getWorkflowRunJournalPath(runId)) : void 0;
2045
+ const resumeReplay = options.resumeFromRunId ? await journal?.load() : void 0;
2046
+ if (runInBackground && options.signal.aborted) {
2047
+ throw new Error("Background workflow start was cancelled.");
2048
+ }
2049
+ const callerWasAbortedBeforeStart = options.signal.aborted;
2050
+ const controller = runInBackground ? createAbortController() : createChildAbortController(options.signal);
2051
+ const registry = config.getWorkflowRunRegistry?.();
2052
+ const dispatch = options.dispatch ?? createProductionDispatch(
2053
+ config,
2054
+ controller.signal,
2055
+ (outputTokens) => budget.recordSpent(outputTokens),
2056
+ registry ? (emitter2) => registry.bridgeApprovalEvents(runId, emitter2) : void 0
2057
+ );
2058
+ const orchestrator = new WorkflowOrchestrator(dispatch);
2059
+ let entry;
2060
+ try {
2061
+ entry = registry?.register({
2062
+ runId,
2063
+ meta: null,
2064
+ status: "running",
2065
+ startTime: Date.now(),
2066
+ outputFile: "",
2067
+ abortController: controller,
2068
+ tokenBudgetTotal: budget.total,
2069
+ script,
2070
+ scriptPath,
2071
+ isBackgrounded: runInBackground
2072
+ });
2073
+ } catch (error) {
2074
+ controller.abort();
2075
+ throw error;
2076
+ }
2077
+ const emitUpdate = /* @__PURE__ */ __name(() => {
2078
+ if (!entry || !options.onUpdate) return;
2079
+ try {
2080
+ options.onUpdate(entry);
2081
+ } catch {
2082
+ }
2083
+ }, "emitUpdate");
2084
+ const emitter = {
2085
+ phaseStarted: /* @__PURE__ */ __name((title) => {
2086
+ registry?.onPhaseStarted(runId, title);
2087
+ emitUpdate();
2088
+ }, "phaseStarted"),
2089
+ agentDispatched: /* @__PURE__ */ __name(() => {
2090
+ registry?.onAgentDispatched(runId);
2091
+ emitUpdate();
2092
+ }, "agentDispatched"),
2093
+ agentCompleted: /* @__PURE__ */ __name(() => {
2094
+ registry?.onAgentCompleted(runId);
2095
+ }, "agentCompleted"),
2096
+ // Deliberate no-op: logs are snapshotted at terminal via
2097
+ // setRecentLogs; per-line emit would cause up to 10k TUI redraws.
2098
+ logAppended: /* @__PURE__ */ __name(() => {
2099
+ }, "logAppended"),
2100
+ budgetUpdated: /* @__PURE__ */ __name((spent, total) => {
2101
+ registry?.onBudgetUpdated(runId, spent, total);
2102
+ emitUpdate();
2103
+ }, "budgetUpdated")
2104
+ };
2105
+ const handle = new WorkflowRunHandle(
2106
+ runId,
2107
+ budget,
2108
+ registry,
2109
+ controller,
2110
+ async () => {
2111
+ try {
2112
+ const outcome = await orchestrator.run({
2113
+ script,
2114
+ args: options.args,
2115
+ abortOnTimeout: controller,
2116
+ runId,
2117
+ emitter,
2118
+ budget,
2119
+ resolveSavedWorkflow: /* @__PURE__ */ __name((ref) => resolveSavedWorkflowScript(ref, config), "resolveSavedWorkflow"),
2120
+ journal,
2121
+ resumeReplay
2122
+ });
2123
+ if (entry) {
2124
+ entry.meta = outcome.meta;
2125
+ if (outcome.meta?.name && entry.description === runId) {
2126
+ entry.description = outcome.meta.name;
2127
+ }
2128
+ }
2129
+ registry?.setRecentLogs(runId, outcome.logs);
2130
+ registry?.complete(runId, outcome.result, Date.now());
2131
+ return { ok: true, outcome };
2132
+ } catch (error) {
2133
+ const details = error instanceof WorkflowExecutionError ? error : void 0;
2134
+ const message = extractErrorMessage2(error);
2135
+ if (entry && details?.meta && !entry.meta) entry.meta = details.meta;
2136
+ if (details?.logs) registry?.setRecentLogs(runId, details.logs);
2137
+ if (callerWasAbortedBeforeStart || !runInBackground && options.signal.aborted || entry?.status === "cancelled") {
2138
+ registry?.cancel(runId, Date.now());
2139
+ } else {
2140
+ registry?.fail(runId, message, Date.now());
2141
+ }
2142
+ return { ok: false, message, details };
2143
+ } finally {
2144
+ controller.abort();
2145
+ if (entry && entry.status !== "running") {
2146
+ await writeWorkflowSnapshot(config, entry);
2147
+ try {
2148
+ logWorkflowRun(
2149
+ config,
2150
+ new WorkflowRunEvent({
2151
+ status: entry.status,
2152
+ agents_dispatched: entry.agentsDispatched,
2153
+ agents_completed: entry.agentsCompleted,
2154
+ phase_count: entry.phases.length,
2155
+ tokens_spent: entry.tokensSpent,
2156
+ duration_ms: (entry.endTime ?? entry.startTime) - entry.startTime
2157
+ })
2158
+ );
2159
+ } catch {
2160
+ }
2161
+ }
2162
+ registry?.releaseHandle(runId, handle);
2163
+ }
2164
+ }
2165
+ );
2166
+ registry?.attachHandle(handle);
2167
+ return handle;
2168
+ }
2169
+ };
2170
+ function extractErrorMessage2(error) {
2171
+ if (error && typeof error === "object" && "message" in error) {
2172
+ const message = error.message;
2173
+ if (typeof message === "string") return message;
2174
+ return String(message);
2175
+ }
2176
+ return String(error);
2177
+ }
2178
+ __name(extractErrorMessage2, "extractErrorMessage");
2179
+
1995
2180
  // packages/core/src/tools/workflow/workflow.ts
1996
- import { randomBytes as randomBytes2 } from "node:crypto";
1997
2181
  import * as path from "node:path";
1998
2182
  var WORKFLOW_PARAM_SCHEMA = {
1999
2183
  type: "object",
@@ -2012,6 +2196,11 @@ var WORKFLOW_PARAM_SCHEMA = {
2012
2196
  resumeFromRunId: {
2013
2197
  type: "string",
2014
2198
  description: "Optional. Resume a prior workflow run by id (e.g. wf_abc123\u2026). Re-runs the SAME script; agent() calls whose rolling prefix-hash (prompt + opts, chained in call order) matches a journaled result are served from cache for the longest unchanged prefix, and the first changed/missing call onward runs live. Pass the same script and args as the original run for the cache to apply."
2199
+ },
2200
+ run_in_background: {
2201
+ type: "boolean",
2202
+ default: false,
2203
+ description: "Optional. When true, start the workflow under the interactive session and return a run handle immediately. The Background Tasks view can observe or stop it, and completion is delivered to the conversation when the run settles. Interactive TUI only. Defaults to false."
2015
2204
  }
2016
2205
  }
2017
2206
  // `script` is required UNLESS `scriptPath` is supplied; this XOR can't be
@@ -2041,104 +2230,54 @@ var WorkflowToolInvocation = class extends BaseToolInvocation {
2041
2230
  return Promise.resolve("ask");
2042
2231
  }
2043
2232
  async execute(signal, updateOutput, _shellExecutionConfig) {
2044
- const dispatchController = createChildAbortController(signal);
2045
- const budget = WorkflowBudgetImpl.fromEnv();
2046
- const dispatch = this.toolOptions.dispatch ?? createProductionDispatch(
2047
- this.config,
2048
- dispatchController.signal,
2049
- // P5 T3: production-dispatch onTokens callback. Test-injected
2050
- // dispatches (`toolOptions.dispatch`) handle their own
2051
- // recording — they don't surface stats the same way.
2052
- (outputTokens) => budget.recordSpent(outputTokens)
2053
- );
2054
- const orchestrator = new WorkflowOrchestrator(dispatch);
2055
- let resolvedScript = this.params.script ?? "";
2056
- let resolvedScriptPath = this.params.scriptPath;
2057
- if (this.params.scriptPath && this.params.script === void 0) {
2058
- const loaded = await resolveSavedWorkflowScript(
2059
- { scriptPath: this.params.scriptPath },
2060
- this.config
2061
- );
2062
- resolvedScript = loaded.script;
2063
- resolvedScriptPath = loaded.scriptPath;
2064
- }
2065
- const runId = this.params.resumeFromRunId ?? `wf_${randomBytes2(8).toString("hex")}`;
2066
- let journal;
2067
- let resumeReplay;
2068
- const storage = this.config.storage;
2069
- if (storage) {
2070
- journal = new WorkflowJournal(storage.getWorkflowRunJournalPath(runId));
2071
- if (this.params.resumeFromRunId) {
2072
- resumeReplay = await journal.load();
2073
- }
2233
+ const runInBackground = this.params.run_in_background === true;
2234
+ if (runInBackground && signal.aborted) {
2235
+ return backgroundStartCancelledResult();
2074
2236
  }
2075
- const registry = this.config.getWorkflowRunRegistry?.();
2076
- const registryEntry = registry?.register({
2077
- runId,
2078
- meta: null,
2079
- // populated after meta parses; safe default until then
2080
- status: "running",
2081
- startTime: Date.now(),
2082
- outputFile: "",
2083
- // P4b reserves the field but doesn't materialize
2084
- abortController: dispatchController,
2085
- // P5: seed the cap so the dialog can render the `M / N` form
2086
- // immediately, before the first `budgetUpdated` fires. Stays
2087
- // `null` when no env override.
2088
- tokenBudgetTotal: budget.total,
2089
- // P7b: carry the script source so a completed run can be snapshotted
2090
- // to disk and saved to `.qwen/workflows/<name>.js` from the dialog.
2091
- // `scriptPath` is set when the run was launched from a saved file (run
2092
- // provenance for the snapshot).
2093
- script: resolvedScript,
2094
- scriptPath: resolvedScriptPath
2095
- });
2096
- const emitter = {
2097
- phaseStarted: /* @__PURE__ */ __name((title) => {
2098
- registry?.onPhaseStarted(runId, title);
2099
- safeEmitUpdate(updateOutput, registryEntry);
2100
- }, "phaseStarted"),
2101
- agentDispatched: /* @__PURE__ */ __name(() => {
2102
- registry?.onAgentDispatched(runId);
2103
- safeEmitUpdate(updateOutput, registryEntry);
2104
- }, "agentDispatched"),
2105
- agentCompleted: /* @__PURE__ */ __name(() => {
2106
- registry?.onAgentCompleted(runId);
2107
- }, "agentCompleted"),
2108
- logAppended: /* @__PURE__ */ __name(() => {
2109
- }, "logAppended"),
2110
- budgetUpdated: /* @__PURE__ */ __name((spent, total) => {
2111
- registry?.onBudgetUpdated(runId, spent, total);
2112
- safeEmitUpdate(updateOutput, registryEntry);
2113
- }, "budgetUpdated")
2114
- };
2237
+ let handle;
2115
2238
  try {
2116
- const outcome = await orchestrator.run({
2117
- script: resolvedScript,
2239
+ handle = await WorkflowRunner.start({
2240
+ config: this.config,
2241
+ signal,
2242
+ script: this.params.script,
2243
+ scriptPath: this.params.scriptPath,
2118
2244
  args: this.params.args,
2119
- abortOnTimeout: dispatchController,
2120
- runId,
2121
- emitter,
2122
- budget,
2123
- // P-nested: resolve `workflow('<name>')` / `workflow({scriptPath})`
2124
- // against the saved-workflow scripts in `.qwen/workflows/`.
2125
- resolveSavedWorkflow: /* @__PURE__ */ __name((ref) => resolveSavedWorkflowScript(ref, this.config), "resolveSavedWorkflow"),
2126
- // P6: resume journal (always wired) + replay maps (resume only).
2127
- journal,
2128
- resumeReplay
2245
+ resumeFromRunId: this.params.resumeFromRunId,
2246
+ dispatch: this.toolOptions.dispatch,
2247
+ runInBackground,
2248
+ onUpdate: !runInBackground && updateOutput ? (entry) => safeEmitUpdate(updateOutput, entry) : void 0
2129
2249
  });
2130
- if (registryEntry) {
2131
- registryEntry.meta = outcome.meta;
2132
- if (outcome.meta?.name && registryEntry.description === runId) {
2133
- registryEntry.description = outcome.meta.name;
2134
- }
2250
+ } catch (error) {
2251
+ if (runInBackground && signal.aborted) {
2252
+ return backgroundStartCancelledResult();
2135
2253
  }
2136
- registry?.setRecentLogs(runId, outcome.logs);
2137
- registry?.complete(runId, outcome.result, Date.now());
2254
+ throw error;
2255
+ }
2256
+ if (runInBackground) {
2257
+ const status = handle.registry?.get(handle.runId)?.status ?? "running";
2258
+ const usageBanner = resolveUsageBanner(
2259
+ this.config,
2260
+ handle.registry,
2261
+ handle.budget.total
2262
+ );
2263
+ return {
2264
+ llmContent: [
2265
+ {
2266
+ text: `Workflow started in background.
2267
+ Run ID: ${handle.runId}
2268
+ Status: ${status}`
2269
+ }
2270
+ ],
2271
+ returnDisplay: usageBanner + `Workflow ${handle.runId} started in the background (status: ${status}). Use Background Tasks to observe or stop it.`
2272
+ };
2273
+ }
2274
+ const settlement = await handle.completion;
2275
+ if (settlement.ok) {
2276
+ const { outcome } = settlement;
2138
2277
  const usageBanner = resolveUsageBanner(
2139
2278
  this.config,
2140
- registry,
2141
- budget.total
2279
+ handle.registry,
2280
+ handle.budget.total
2142
2281
  );
2143
2282
  const llmText = safeStringifyResult(outcome.result);
2144
2283
  const displayJson = safeStringifyDisplayPayload({
@@ -2153,10 +2292,10 @@ var WorkflowToolInvocation = class extends BaseToolInvocation {
2153
2292
  // tokens whenever ANY usage is reported OR a cap is set, not
2154
2293
  // only when spend > 0. A capped-but-zero-spend run still wants
2155
2294
  // the cap visible so the user sees the gate engaged.
2156
- ...budget.spent() > 0 || budget.total !== null ? {
2295
+ ...handle.budget.spent() > 0 || handle.budget.total !== null ? {
2157
2296
  tokens: {
2158
- spent: budget.spent(),
2159
- total: budget.total
2297
+ spent: handle.budget.spent(),
2298
+ total: handle.budget.total
2160
2299
  }
2161
2300
  } : {}
2162
2301
  });
@@ -2164,20 +2303,9 @@ var WorkflowToolInvocation = class extends BaseToolInvocation {
2164
2303
  llmContent: [{ text: llmText }],
2165
2304
  returnDisplay: usageBanner + "```json\n" + displayJson + "\n```"
2166
2305
  };
2167
- } catch (err) {
2168
- const message = extractErrorMessage2(err);
2169
- const phases = err instanceof WorkflowExecutionError ? err.phases : void 0;
2170
- const logs = err instanceof WorkflowExecutionError ? err.logs : void 0;
2171
- const meta = err instanceof WorkflowExecutionError ? err.meta : void 0;
2172
- if (registryEntry) {
2173
- if (meta && !registryEntry.meta) registryEntry.meta = meta;
2174
- }
2175
- if (logs) registry?.setRecentLogs(runId, logs);
2176
- if (signal.aborted) {
2177
- registry?.cancel(runId, Date.now());
2178
- } else {
2179
- registry?.fail(runId, message, Date.now());
2180
- }
2306
+ } else {
2307
+ const { message, details } = settlement;
2308
+ const { phases, logs, meta } = details ?? {};
2181
2309
  const display = phases || logs || meta ? `Workflow failed: ${message}
2182
2310
 
2183
2311
  ${safeStringifyDisplayPayload({
@@ -2193,28 +2321,16 @@ ${safeStringifyDisplayPayload({
2193
2321
  // the same way as other execution-time tool errors.
2194
2322
  error: { message, type: "execution_failed" /* EXECUTION_FAILED */ }
2195
2323
  };
2196
- } finally {
2197
- dispatchController.abort();
2198
- if (registryEntry && registryEntry.status !== "running") {
2199
- await writeWorkflowSnapshot(this.config, registryEntry);
2200
- try {
2201
- logWorkflowRun(
2202
- this.config,
2203
- new WorkflowRunEvent({
2204
- status: registryEntry.status,
2205
- agents_dispatched: registryEntry.agentsDispatched,
2206
- agents_completed: registryEntry.agentsCompleted,
2207
- phase_count: registryEntry.phases.length,
2208
- tokens_spent: registryEntry.tokensSpent,
2209
- duration_ms: (registryEntry.endTime ?? registryEntry.startTime) - registryEntry.startTime
2210
- })
2211
- );
2212
- } catch {
2213
- }
2214
- }
2215
2324
  }
2216
2325
  }
2217
2326
  };
2327
+ function backgroundStartCancelledResult() {
2328
+ return {
2329
+ llmContent: "Workflow was cancelled before it could start.",
2330
+ returnDisplay: "Workflow cancelled."
2331
+ };
2332
+ }
2333
+ __name(backgroundStartCancelledResult, "backgroundStartCancelledResult");
2218
2334
  function buildLivePhaseTreeDisplay(entry) {
2219
2335
  const payload = {
2220
2336
  runId: entry.runId,
@@ -2297,21 +2413,12 @@ function safeStringifyDisplayPayload(payload) {
2297
2413
  }
2298
2414
  }
2299
2415
  __name(safeStringifyDisplayPayload, "safeStringifyDisplayPayload");
2300
- function extractErrorMessage2(err) {
2301
- if (err && typeof err === "object" && "message" in err) {
2302
- const m = err.message;
2303
- if (typeof m === "string") return m;
2304
- return String(m);
2305
- }
2306
- return String(err);
2307
- }
2308
- __name(extractErrorMessage2, "extractErrorMessage");
2309
2416
  var WorkflowTool = class extends BaseDeclarativeTool {
2310
2417
  constructor(config, toolOptions = {}) {
2311
2418
  super(
2312
2419
  ToolNames.WORKFLOW,
2313
2420
  ToolDisplayNames.WORKFLOW,
2314
- "Execute a workflow script that orchestrates subagents. Supports `phase`, `log`, sequential `agent`, concurrent fan-out via `parallel(thunks)` / `pipeline(items, ...stages)` (default `max(1, min(16, cpus-2))` agents in flight per run, up to 1000 agents total; both env-overridable), per-call `agent({ schema, agentType, model, isolation: 'worktree' })` for structured-output contracts, declarative-agent selection, model override, and git-worktree-isolated subagents. Pass `resumeFromRunId` to resume a prior run \u2014 agent() calls whose rolling prefix-hash matches the journal are served from cache for the longest unchanged prefix. Runs are tracked in the background-tasks view and the `/workflows` dialog (live phase tree, token usage, cancel). Scripts run in a node:vm sandbox without access to the filesystem or shell; all I/O happens through the spawned agents.",
2421
+ "Execute a workflow script that orchestrates subagents. Supports `phase`, `log`, sequential `agent`, concurrent fan-out via `parallel(thunks)` / `pipeline(items, ...stages)` (default `max(1, min(16, cpus-2))` agents in flight per run, up to 1000 agents total; both env-overridable), per-call `agent({ schema, agentType, model, isolation: 'worktree' })` for structured-output contracts, declarative-agent selection, model override, and git-worktree-isolated subagents. Pass `resumeFromRunId` to resume a prior run \u2014 agent() calls whose rolling prefix-hash matches the journal are served from cache for the longest unchanged prefix. Runs are tracked in the background-tasks view and the `/workflows` dialog (live phase tree, token usage, cancel). Set `run_in_background: true` to return a run handle immediately in the interactive TUI and receive completion through the conversation. Scripts run in a node:vm sandbox without access to the filesystem or shell; all I/O happens through the spawned agents.",
2315
2422
  "other" /* Other */,
2316
2423
  WORKFLOW_PARAM_SCHEMA,
2317
2424
  /* isOutputMarkdown */
@@ -2337,6 +2444,14 @@ var WorkflowTool = class extends BaseDeclarativeTool {
2337
2444
  if (params.resumeFromRunId !== void 0 && !/^wf_[0-9a-f]+$/.test(params.resumeFromRunId)) {
2338
2445
  return "WorkflowTool: `resumeFromRunId` must match the generated id format `wf_<hex>`.";
2339
2446
  }
2447
+ if (params.run_in_background === true) {
2448
+ if (!this.config.isInteractive() || this.config.getExperimentalZedIntegration?.() === true) {
2449
+ return "WorkflowTool: `run_in_background` is available only in the interactive TUI.";
2450
+ }
2451
+ if (!this.config.getWorkflowRunRegistry().hasCompletionCallback()) {
2452
+ return "WorkflowTool: `run_in_background` requires an active workflow completion channel.";
2453
+ }
2454
+ }
2340
2455
  return null;
2341
2456
  }
2342
2457
  createInvocation(params) {
@@ -2348,11 +2463,11 @@ export {
2348
2463
  };
2349
2464
  /**
2350
2465
  * @license
2351
- * Copyright 2025 Qwen
2466
+ * Copyright 2026 Qwen Team
2352
2467
  * SPDX-License-Identifier: Apache-2.0
2353
2468
  */
2354
2469
  /**
2355
2470
  * @license
2356
- * Copyright 2026 Qwen Team
2471
+ * Copyright 2025 Qwen
2357
2472
  * SPDX-License-Identifier: Apache-2.0
2358
2473
  */