@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.
- package/bundled/qc-helper/docs/configuration/settings.md +41 -38
- package/bundled/qc-helper/docs/features/channels/github.md +7 -0
- package/bundled/qc-helper/docs/features/channels/gitlab.md +6 -0
- package/bundled/qc-helper/docs/features/code-review.md +78 -23
- package/bundled/qc-helper/docs/features/commands.md +2 -0
- package/bundled/qc-helper/docs/features/hooks.md +115 -18
- package/bundled/qc-helper/docs/features/memory.md +27 -0
- package/bundled/qc-helper/docs/features/skills.md +46 -1
- package/bundled/qc-helper/docs/features/sub-agents.md +42 -9
- package/bundled/qc-helper/docs/features/tool-use-summaries.md +7 -7
- package/bundled/qc-helper/docs/qwen-serve.md +21 -1
- package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +13 -13
- package/bundled/qc-helper/docs/support/troubleshooting.md +6 -1
- package/bundled/review/DESIGN.md +167 -32
- package/bundled/review/SKILL.md +156 -32
- package/chunks/{MaxSizedBox-TQBQ247P.js → MaxSizedBox-OJR636GP.js} +40 -38
- package/chunks/{StandaloneSessionPicker-2HPTKCLX.js → StandaloneSessionPicker-AMMBF5UY.js} +62 -59
- package/chunks/{acp-startup-profiler-2C4A5ZTJ.js → acp-startup-profiler-3RICG2YW.js} +2 -2
- package/chunks/{acpAgent-PS6EDGH3.js → acpAgent-M57LVIQA.js} +662 -560
- package/chunks/{agent-VDOUB35F.js → agent-PE37ARLM.js} +36 -34
- package/chunks/{agent-headless-EO53EFS2.js → agent-headless-45ASME4R.js} +36 -34
- package/chunks/{anthropicContentGenerator-OFHSZJBF.js → anthropicContentGenerator-WCBYB6JG.js} +337 -27
- package/chunks/{artifact-tool-RDN2W7ND.js → artifact-tool-TBOYEKTY.js} +2 -2
- package/chunks/{askUserQuestion-OZERWH5R.js → askUserQuestion-23Y5WZFJ.js} +2 -2
- package/chunks/{bridge-W7AZSRZQ.js → bridge-K3ZRPO4D.js} +42 -40
- package/chunks/{ca-6W3SK7OQ.js → ca-4OJN75WT.js} +46 -5
- package/chunks/{channel-management-service-5S7YCWX5.js → channel-management-service-IXJ2MZTS.js} +7 -7
- package/chunks/{channel-settings-store-JFVRSNER.js → channel-settings-store-PEAR3IME.js} +43 -41
- package/chunks/{channel-worker-group-OVWGYMZS.js → channel-worker-group-NDG4WOOZ.js} +8 -8
- package/chunks/{channel-worker-manager-H55GKOQA.js → channel-worker-manager-ZCW6UW34.js} +8 -8
- package/chunks/{channel-worker-supervisor-CABBXYHK.js → channel-worker-supervisor-ATGFTZRN.js} +4 -4
- package/chunks/{chunk-W3UKBMSI.js → chunk-22YFMJBW.js} +84 -8
- package/chunks/{chunk-6MPDY6ZG.js → chunk-24ER7UV4.js} +1 -1
- package/chunks/{chunk-QDK4F2N5.js → chunk-2DNKEBXY.js} +1 -1
- package/chunks/{chunk-D6MDRSZ6.js → chunk-2LZCLQIS.js} +22 -11
- package/chunks/{chunk-JYBU6YUE.js → chunk-2M5N3DHY.js} +1 -1
- package/chunks/{chunk-KR32NIAN.js → chunk-2MI7ZTRT.js} +10 -10
- package/chunks/{chunk-LHKCY7DY.js → chunk-2UISUFHQ.js} +3 -3
- package/chunks/{chunk-JXVC2PL3.js → chunk-33FNCQSY.js} +2 -2
- package/chunks/{chunk-NBD76HUW.js → chunk-3LGZEYOF.js} +2 -2
- package/chunks/{chunk-CO2U743O.js → chunk-3MWNROHB.js} +4 -4
- package/chunks/{chunk-E2BHWIDT.js → chunk-3RXUYQJI.js} +6 -2
- package/chunks/{chunk-E5Z2AVNV.js → chunk-3SH53ANB.js} +0 -11
- package/chunks/{chunk-LYI2PZDK.js → chunk-3XF4WT3B.js} +2 -2
- package/chunks/{chunk-N4ACHWNH.js → chunk-432XCUHF.js} +1 -1
- package/chunks/{chunk-FNDXMN7I.js → chunk-4AGGSHCH.js} +774 -205
- package/chunks/{chunk-DUNI4EBW.js → chunk-4K3RV3OA.js} +80 -50
- package/chunks/{chunk-L2E5GFAG.js → chunk-4LKVQFHM.js} +2 -2
- package/chunks/{chunk-YDLJGZHL.js → chunk-4NFY2S7N.js} +0 -33
- package/chunks/{chunk-JLZ3RBQG.js → chunk-5JPVOYWA.js} +144 -11
- package/chunks/{chunk-6TAASXWL.js → chunk-5VYFXHY2.js} +3 -3
- package/chunks/{chunk-EU5TBFJI.js → chunk-6NE5NTHJ.js} +2 -2
- package/chunks/{chunk-XQK4XXTN.js → chunk-6O5DVH27.js} +1 -1
- package/chunks/{chunk-2RFKHEXL.js → chunk-6PLDPT2C.js} +1 -1
- package/chunks/{chunk-3APUUXRF.js → chunk-A5YZ3FA2.js} +2 -1
- package/chunks/{chunk-SHN4KHDK.js → chunk-A6SX5TAH.js} +3 -3
- package/chunks/{chunk-SZ3KHTDR.js → chunk-AKA24BGO.js} +1 -1
- package/chunks/{chunk-Q3T5KA2V.js → chunk-BFHXDAR7.js} +1 -1
- package/chunks/{chunk-L55JWS76.js → chunk-BGXZBI5B.js} +1 -1
- package/chunks/{chunk-P5VC5USY.js → chunk-BKGA75MU.js} +1 -1
- package/chunks/{chunk-2KKCCLPT.js → chunk-BKXTHMOZ.js} +1 -1
- package/chunks/{chunk-V4XNUDPE.js → chunk-BSKUTHLO.js} +15 -7
- package/chunks/{chunk-MM7TH7ZM.js → chunk-CFDR3GNL.js} +18 -3
- package/chunks/{chunk-E2FN6SM7.js → chunk-CIUUYB23.js} +5 -5
- package/chunks/{chunk-A7Y5H4TX.js → chunk-D2GPKXCQ.js} +7 -7
- package/chunks/{chunk-JCJ7LKNA.js → chunk-DIEFUBV6.js} +1644 -1570
- package/chunks/{chunk-GL4JOZXU.js → chunk-DSGJLHM3.js} +4 -4
- package/chunks/{chunk-675H6PLP.js → chunk-DYA25Y7U.js} +1 -1
- package/chunks/{chunk-3I6DUGQD.js → chunk-E4WHKETF.js} +32 -4
- package/chunks/{chunk-CU47KXB5.js → chunk-EGYJRIDF.js} +6 -6
- package/chunks/{chunk-6CQWRWUC.js → chunk-EIMKVOSF.js} +3 -3
- package/chunks/{chunk-QTERJVPZ.js → chunk-EKTCKZV5.js} +1 -0
- package/chunks/{chunk-NHFEMWAZ.js → chunk-FF75UUB2.js} +1 -1
- package/chunks/{chunk-L32VV3ZJ.js → chunk-FG63DZQA.js} +12 -12
- package/chunks/{chunk-FCYYAB4S.js → chunk-FHPKHXHT.js} +3 -3
- package/chunks/{chunk-GJ2GBPBD.js → chunk-FXVHVCNA.js} +5 -5
- package/chunks/{chunk-56Z7QEAQ.js → chunk-GMSBXEH4.js} +16 -16
- package/chunks/chunk-GOFAQQZA.js +132 -0
- package/chunks/{chunk-YUFIEIWC.js → chunk-GTM6IHBB.js} +2 -2
- package/chunks/{chunk-HIVKI6O6.js → chunk-H35Q5CEG.js} +9 -7
- package/chunks/{chunk-FJ5WUMUQ.js → chunk-H36SETQS.js} +1 -1
- package/chunks/{chunk-AUOULH6Q.js → chunk-H6FIBBXK.js} +1610 -2196
- package/chunks/{chunk-VEMNQMHA.js → chunk-H6ZYP74A.js} +5 -13
- package/chunks/{chunk-TTJZAIFP.js → chunk-HEBW74ZW.js} +3 -3
- package/chunks/{chunk-6FMJLI5M.js → chunk-HFVW54NL.js} +41 -6
- package/chunks/{chunk-44F4LBWZ.js → chunk-HIXVWF7I.js} +56 -18
- package/chunks/{chunk-EQNUDTL6.js → chunk-HUIQ4FYC.js} +2 -2
- package/chunks/{chunk-5NNHICSA.js → chunk-I7JDGNG6.js} +3 -3
- package/chunks/{chunk-PVNQRENX.js → chunk-IF6K42YJ.js} +1 -1
- package/chunks/{chunk-PJOHNFIY.js → chunk-IWGTGH4G.js} +5 -5
- package/chunks/{chunk-B4AJNNOL.js → chunk-J26HHFI5.js} +1 -1
- package/chunks/{chunk-CNTR4GR6.js → chunk-JELIWHXD.js} +1 -1
- package/chunks/{chunk-V25K5ID7.js → chunk-K2J5JZ6B.js} +1 -1
- package/chunks/{chunk-IGTHU3T4.js → chunk-KKN2IE7Q.js} +1 -1
- package/chunks/{chunk-TZTAV5RH.js → chunk-KVUBYJDM.js} +2 -2
- package/chunks/{chunk-3F2WDAV6.js → chunk-KXWERR6P.js} +14 -14
- package/chunks/{chunk-JJPKFJBT.js → chunk-L7FTDKCD.js} +3 -3
- package/chunks/chunk-LBOVL47Y.js +29 -0
- package/chunks/{chunk-FS674JW4.js → chunk-LBWNSLJK.js} +3 -3
- package/chunks/{chunk-I5BT7ADR.js → chunk-LGT3YMLN.js} +4 -4
- package/chunks/{chunk-UV6KF7T3.js → chunk-LZV2BZPL.js} +3 -3
- package/chunks/{chunk-P755N4CS.js → chunk-M5LIY7Y6.js} +6 -6
- package/chunks/{chunk-YGE3IXJP.js → chunk-M744OFVE.js} +1 -1
- package/chunks/{chunk-NTDH4IML.js → chunk-MCXMWLFT.js} +7 -7
- package/chunks/chunk-MISUEWB4.js +8749 -0
- package/chunks/{chunk-TEGJSJDF.js → chunk-MOHAWIAW.js} +2 -2
- package/chunks/{chunk-KXDONCPU.js → chunk-MTR4JWQJ.js} +4 -4
- package/chunks/{chunk-RSVPYAGK.js → chunk-MUEJ4R3E.js} +5 -5
- package/chunks/{chunk-PCK4B6LR.js → chunk-N42C2FU3.js} +1 -1
- package/chunks/{chunk-WWCMSZII.js → chunk-NW57GHNL.js} +71 -7
- package/chunks/{chunk-PQNHRFJC.js → chunk-NYX53SV4.js} +0 -2
- package/chunks/{chunk-QARJNL2V.js → chunk-O2ZYHG33.js} +5 -4
- package/chunks/{chunk-V7RNNPGC.js → chunk-P5Y23G2L.js} +18 -1
- package/chunks/{chunk-GURGAJTX.js → chunk-PDDYAXL2.js} +4 -1
- package/chunks/chunk-PWCQRLM5.js +1170 -0
- package/chunks/{chunk-VMX5RZQH.js → chunk-Q3G5L5KF.js} +18 -9
- package/chunks/{chunk-DQ2O5QOJ.js → chunk-QDWLUXKP.js} +1 -1
- package/chunks/chunk-QL4TN4HS.js +59 -0
- package/chunks/{chunk-E6CJ2SMM.js → chunk-QMBEW7EW.js} +2 -2
- package/chunks/{chunk-U4VTUMMK.js → chunk-QONSRAEV.js} +1 -1
- package/chunks/{chunk-DEEABGH2.js → chunk-QPSYIV2O.js} +3320 -536
- package/chunks/{chunk-Q5WZTTWE.js → chunk-QWDVZH24.js} +6 -8
- package/chunks/{chunk-2LEOZTBT.js → chunk-QWW6I2UO.js} +111 -26
- package/chunks/{chunk-LOY7RWQG.js → chunk-QYPT3QUD.js} +3 -3
- package/chunks/{chunk-6PQPKTXP.js → chunk-R7XNRHYD.js} +1 -1
- package/chunks/{chunk-7SJN2IWT.js → chunk-RCXCGZG6.js} +5 -5
- package/chunks/{chunk-HX6RLYUO.js → chunk-RL6J3BPE.js} +4 -4
- package/chunks/{chunk-Z3S5EMOW.js → chunk-RPYYTL7E.js} +60 -12
- package/chunks/{chunk-MB32MS4U.js → chunk-RR224BUP.js} +215 -174
- package/chunks/{chunk-H6I4PGRV.js → chunk-SKSF3LGQ.js} +4 -4
- package/chunks/{chunk-77V3VIKL.js → chunk-SQ3YD5MI.js} +9 -9
- package/chunks/{chunk-CBBP4BMC.js → chunk-SRY26X4H.js} +72 -206
- package/chunks/{chunk-RDJOB6S3.js → chunk-TXABHVZD.js} +1 -1
- package/chunks/{chunk-R2XWGR75.js → chunk-TYERNYH4.js} +2 -2
- package/chunks/chunk-TZTBZ25J.js +222 -0
- package/chunks/{chunk-45IOTAUS.js → chunk-U25CMJYY.js} +1 -1
- package/chunks/{chunk-7ULQIS27.js → chunk-UEJESCS7.js} +1 -1
- package/chunks/{chunk-HC45LTEN.js → chunk-UH7Z7Y45.js} +1 -1
- package/chunks/{chunk-CPZAH673.js → chunk-UKZEXS6K.js} +2 -0
- package/chunks/{chunk-54YCNSK5.js → chunk-UQDFEU47.js} +4113 -10152
- package/chunks/{chunk-XP4L6KS3.js → chunk-URN76TKR.js} +2 -2
- package/chunks/{chunk-XUGZYLDH.js → chunk-UWSXFI6E.js} +1 -1
- package/chunks/{chunk-AOHY3QJ3.js → chunk-VA5NLVPT.js} +3 -3
- package/chunks/{chunk-PZEXDV3H.js → chunk-VUNRNRN6.js} +71 -43
- package/chunks/{chunk-FANRZEAJ.js → chunk-VWOVHOTT.js} +1 -1
- package/chunks/{chunk-QTHQ6Z5X.js → chunk-WK4TJUEA.js} +1 -1
- package/chunks/{chunk-ZPZ7ZJEE.js → chunk-WUC6ZFXO.js} +1 -1
- package/chunks/{chunk-7KAXXBER.js → chunk-WY2ENRDN.js} +3 -3
- package/chunks/{chunk-TIRRPCFS.js → chunk-X6QNZOTC.js} +1 -1
- package/chunks/{chunk-KWHKHSIS.js → chunk-X6WUYMOV.js} +8 -8
- package/chunks/{chunk-IIUGIWWY.js → chunk-XC2VAFVZ.js} +1 -1
- package/chunks/{chunk-D4HTUMGX.js → chunk-XC656O42.js} +3 -3
- package/chunks/{chunk-RG64CDT2.js → chunk-XMJO6C44.js} +131 -48
- package/chunks/{chunk-ZMOJ7ISP.js → chunk-XUMAD5IT.js} +1 -1
- package/chunks/{chunk-THVU3RNH.js → chunk-YAVY33G4.js} +1 -1
- package/chunks/{chunk-YANIWTRZ.js → chunk-YPUHMQXV.js} +1 -1
- package/chunks/{chunk-QCXGC7QB.js → chunk-YU6TBRTA.js} +3 -3
- package/chunks/{chunk-OFZKFPYG.js → chunk-YWMDTMAU.js} +3 -3
- package/chunks/{chunk-DSFHVTWD.js → chunk-YXEVDA66.js} +2 -2
- package/chunks/{chunk-JE2CEOBO.js → chunk-ZGSUFIL5.js} +4 -4
- package/chunks/{chunk-BBIQAX4V.js → chunk-ZJES4C3I.js} +30 -18
- package/chunks/{computer-use-5QWCFNKD.js → computer-use-UJMK6JQU.js} +36 -34
- package/chunks/{config-utils-WADIDWGG.js → config-utils-7COTJMWK.js} +4 -4
- package/chunks/{contextCommand-4Z7T7TUM.js → contextCommand-4YABGF4S.js} +40 -38
- package/chunks/{core-runtime-6N4EFC2Q.js → core-runtime-7M4VM3DA.js} +36 -34
- package/chunks/{create-sub-session-AEREHZBQ.js → create-sub-session-HOFDW4N7.js} +39 -37
- package/chunks/{create-sub-session-62YZWVAY.js → create-sub-session-J32WC64U.js} +2 -2
- package/chunks/{cron-create-6E7GIQTG.js → cron-create-HMFSHIAR.js} +4 -4
- package/chunks/{cron-delete-JD26XY3W.js → cron-delete-ZJFHOX57.js} +4 -4
- package/chunks/{cron-list-CUWFB44G.js → cron-list-ZEX2NBMN.js} +4 -4
- package/chunks/{daemon-PCNCI5YU.js → daemon-CCIX4BMG.js} +47 -6
- package/chunks/{daemon-status-provider-DDF7C5M7.js → daemon-status-provider-W2U5Q3J5.js} +47 -45
- package/chunks/{daemon-trust-policy-Q4KSOJTR.js → daemon-trust-policy-IFICWPXP.js} +42 -40
- package/chunks/{daemon-trust-policy-monitor-V6FTE3IY.js → daemon-trust-policy-monitor-GX7EO6FW.js} +42 -40
- package/chunks/{de-SY6O76BF.js → de-A6TI4LBB.js} +46 -5
- package/chunks/{deferred-core-runtime-GHJ5GQHK.js → deferred-core-runtime-U36OOOKE.js} +36 -34
- package/chunks/display-image-VS3TXYQH.js +184 -0
- package/chunks/{dist-ZHXOBXDN.js → dist-3BMEUGTG.js} +1 -1
- package/chunks/{dist-26BIMQT6.js → dist-4KAX7CCL.js} +289 -27
- package/chunks/{dist-OAOC5OV4.js → dist-7JGAAQSC.js} +2 -2
- package/chunks/{dist-SL2LUMML.js → dist-A7H2KKUC.js} +1 -1
- package/chunks/{dist-2PERFI23.js → dist-DPPHJAVL.js} +3 -3
- package/chunks/{dist-PVEAFLHY.js → dist-HVBMEYWK.js} +1 -1
- package/chunks/{dist-ULIG4M5H.js → dist-NEBRI7WO.js} +67 -15
- package/chunks/{dist-WGMNT3JQ.js → dist-SFQ34F4M.js} +24 -6
- package/chunks/{earlyInputCapture-TQXLLISD.js → earlyInputCapture-5ZWDH3SB.js} +37 -35
- package/chunks/{edit-FJEUV6KZ.js → edit-J7SW6UP6.js} +36 -34
- package/chunks/{en-NBK3JKCE.js → en-L4UQDLWW.js} +57 -6
- package/chunks/{enter-worktree-7GE3TZ4P.js → enter-worktree-NRLOHRB6.js} +36 -34
- package/chunks/{enterPlanMode-KR5TMPCJ.js → enterPlanMode-GDSTEFSM.js} +36 -34
- package/chunks/{environment-SWL3CMB3.js → environment-KHYEKG5W.js} +39 -37
- package/chunks/{errors-XQE7BGZV.js → errors-VNLAJV3O.js} +39 -37
- package/chunks/{exit-worktree-CHKTYNCV.js → exit-worktree-ARVID7DF.js} +36 -34
- package/chunks/{exitPlanMode-QYAG6LWX.js → exitPlanMode-4ZFY7KUH.js} +36 -34
- package/chunks/{fast-path-Z2K7W6DC.js → fast-path-KA65VREJ.js} +9 -5
- package/chunks/{fr-4KG5V7UT.js → fr-QF7RI5ZE.js} +46 -5
- package/chunks/{gemini-YU4XKEDG.js → gemini-5PMCNPF7.js} +149 -90
- package/chunks/{geminiContentGenerator-ZZX6NBO4.js → geminiContentGenerator-NFSYJ4HA.js} +6 -6
- package/chunks/{glob-VYF5CXSX.js → glob-F3EAUDAX.js} +36 -34
- package/chunks/{goal-tools-HGO6VXPB.js → goal-tools-SPQ5M6D3.js} +3 -3
- package/chunks/{grep-5DP5ZUTW.js → grep-UJMPVZER.js} +36 -34
- package/chunks/{handleAutoUpdate-UVBJ56DL.js → handleAutoUpdate-MG4FRZPN.js} +42 -40
- package/chunks/{i18n-UQNYHEUD.js → i18n-EVHV4ZF3.js} +38 -36
- package/chunks/{image-gen-WHPIZNWF.js → image-gen-UC7XVHI7.js} +9 -9
- package/chunks/{initializer-GMIICF4W.js → initializer-O5B6HUBI.js} +43 -41
- package/chunks/{installationInfo-4MGG4WVI.js → installationInfo-2LIKCNVX.js} +37 -35
- package/chunks/{ja-F3GSQXMF.js → ja-URQESVGW.js} +46 -5
- package/chunks/{keychain-token-storage-IKO4G53C.js → keychain-token-storage-7BT4TQ2A.js} +2 -2
- package/chunks/{kittyProtocolDetector-MBRTDRBK.js → kittyProtocolDetector-BFLAKYXH.js} +1 -1
- package/chunks/{list-CPN2W334.js → list-BPKIE3Z4.js} +45 -43
- package/chunks/{list-agents-PXJ7ZUFB.js → list-agents-TWEGRJWO.js} +2 -2
- package/chunks/{loadedSettingsAdapter-ZQAV5NDO.js → loadedSettingsAdapter-NGLFF4V4.js} +42 -40
- package/chunks/{loggingContentGenerator-5E7W4IEP.js → loggingContentGenerator-7TFESRG5.js} +52 -37
- package/chunks/{loop-wakeup-Y26NQZ5I.js → loop-wakeup-6LLEOQYV.js} +5 -5
- package/chunks/{ls-ONQTTMQR.js → ls-H5WX22VK.js} +4 -4
- package/chunks/{lsp-YGHHRGMD.js → lsp-G6FXYEIS.js} +2 -2
- package/chunks/{managed-npm-update-MKKAXYXA.js → managed-npm-update-CLZGGV7F.js} +39 -37
- package/chunks/{mcp-V5NTJF6X.js → mcp-X5OZOOXX.js} +42 -40
- package/chunks/{monitor-CO3ASY6E.js → monitor-TGSVSAZZ.js} +36 -34
- package/chunks/nonInteractiveCli-GUMJ5JLG.js +150 -0
- package/chunks/{notebook-edit-Z7AEE6FM.js → notebook-edit-EZISE7IC.js} +36 -34
- package/chunks/{openaiContentGenerator-CA3MQOP3.js → openaiContentGenerator-ZAKS5A6P.js} +18 -18
- package/chunks/{pidfile-NL7MKDRU.js → pidfile-PCMBX4LR.js} +37 -35
- package/chunks/{processUtils-PB5K2DYH.js → processUtils-2CSVE5BW.js} +2 -2
- package/chunks/{pt-EQ33KWEN.js → pt-EEEQXRUI.js} +46 -5
- package/chunks/{qwenContentGenerator-JYFNDCOS.js → qwenContentGenerator-S3H6PIC4.js} +42 -40
- package/chunks/{qwenOAuth2-W2ALKQDD.js → qwenOAuth2-MNU425VE.js} +8 -8
- package/chunks/{read-file-IEOR5H5W.js → read-file-HXJXHBI6.js} +10 -10
- package/chunks/{read-mcp-resource-U2IJN5HM.js → read-mcp-resource-DRZSI3HE.js} +2 -2
- package/chunks/{record-artifact-MGPJ7EG4.js → record-artifact-IPIRWMFY.js} +3 -3
- package/chunks/{resumeHistoryUtils-BNBTP5AS.js → resumeHistoryUtils-4QAMC2S6.js} +44 -42
- package/chunks/{ripGrep-UMQODKEB.js → ripGrep-MCETPF2E.js} +36 -34
- package/chunks/{ru-7OZAUKGG.js → ru-WGZDYQAB.js} +46 -5
- package/chunks/{run-qwen-serve-RN2R6QQW.js → run-qwen-serve-3NMODTXV.js} +219 -55
- package/chunks/{runtime-QFJ2MJF5.js → runtime-AQOV7DVP.js} +49 -45
- package/chunks/{scheduler-AMYUFOZI.js → scheduler-DN7SZ6ZE.js} +36 -34
- package/chunks/{sdk-exporters-http-4BQANSJ6.js → sdk-exporters-http-IKNWQJNV.js} +2 -2
- package/chunks/{sdk-impl-Z4VXWVFX.js → sdk-impl-7CUUMQDB.js} +2 -2
- package/chunks/{send-message-PMP4ATVM.js → send-message-HGCVVDTZ.js} +5 -4
- package/chunks/{serve-EIIYJVX3.js → serve-WZB45HVT.js} +42 -40
- package/chunks/{server-EP2LLAPD.js → server-GOTZFEEZ.js} +616 -387
- package/chunks/{session-GMPZBLOW.js → session-23LOFLWN.js} +149 -87
- package/chunks/{settings-LN7RNKBS.js → settings-LI2ORVXC.js} +41 -39
- package/chunks/{shell-EM2OWU5X.js → shell-GLC6OP3C.js} +36 -34
- package/chunks/{skill-T5VPSK73.js → skill-C7W6M4GO.js} +27 -14
- package/chunks/{skill-settings-GMR3GMNY.js → skill-settings-W25NCK5I.js} +41 -39
- package/chunks/{spawnChannel-YPCU62DI.js → spawnChannel-OHJLEBLD.js} +38 -36
- package/chunks/{standalone-update-JAKIM2NF.js → standalone-update-E4V5V7WT.js} +39 -37
- package/chunks/{startInteractiveUI-YETQWGYF.js → startInteractiveUI-FKILLW7Q.js} +1815 -1034
- package/chunks/{syntheticOutput-D7E6ZFKR.js → syntheticOutput-EYL7DWO7.js} +3 -3
- package/chunks/{task-create-NFCYD43L.js → task-create-CSCEG4SM.js} +10 -9
- package/chunks/{task-list-TAVMGEVD.js → task-list-6CVQPORX.js} +6 -6
- package/chunks/{task-stop-ZDF2UJRM.js → task-stop-Y5ZTFVRX.js} +2 -2
- package/chunks/{task-update-6L7LHGEX.js → task-update-C52LNFU5.js} +10 -9
- package/chunks/{team-create-LFJ6HGNY.js → team-create-HBIJ7NHT.js} +36 -34
- package/chunks/{team-delete-DPGGRQBU.js → team-delete-CE7DC53R.js} +6 -6
- package/chunks/{team-plan-approval-C2KLSDGO.js → team-plan-approval-IBJOKS4J.js} +36 -34
- package/chunks/terminal-image-renderer-BOQJPVLB.js +89 -0
- package/chunks/{theme-manager-JQ3ZGBP5.js → theme-manager-NSS7VLUD.js} +37 -35
- package/chunks/{todoWrite-2UO5G6G6.js → todoWrite-YKAA57W2.js} +107 -36
- package/chunks/{tool-search-FAZBFRJZ.js → tool-search-DEAS54VG.js} +13 -12
- package/chunks/{total-session-admission-5CALIVYO.js → total-session-admission-4LWTX3WD.js} +43 -41
- package/chunks/{trustedFolders-KOPSP44S.js → trustedFolders-NF3J2TA7.js} +38 -36
- package/chunks/{update-relaunch-6QL2TICS.js → update-relaunch-WUHRH5V3.js} +5 -5
- package/chunks/{updateCheck-4Q6RIKFW.js → updateCheck-7EG4BLBH.js} +41 -39
- package/chunks/{useAutoAcceptIndicator-Q5BMKZV3.js → useAutoAcceptIndicator-ZRV56GVP.js} +46 -44
- package/chunks/{validateNonInterActiveAuth-GKOC5F6Z.js → validateNonInterActiveAuth-WC2FPE3I.js} +86 -84
- package/chunks/{version-VSATY2LD.js → version-6SS7KCUP.js} +1 -1
- package/chunks/{web-fetch-JCLKL6NL.js → web-fetch-Y5QQMPKA.js} +13 -13
- package/chunks/{web-search-DSQTFUBX.js → web-search-QKKEU723.js} +8 -8
- package/chunks/{workflow-M6QAVKVJ.js → workflow-PWIU6Q2M.js} +418 -304
- package/chunks/{workspace-providers-status-YKLTLMJA.js → workspace-providers-status-B2DM6FNK.js} +45 -43
- package/chunks/{workspace-registration-store-5DMGKU64.js → workspace-registration-store-7Y33TTHJ.js} +2 -2
- package/chunks/{workspace-registry-PTYUSYXX.js → workspace-registry-TSNJKLPC.js} +43 -41
- package/chunks/{workspace-service-25ML3T47.js → workspace-service-4I2QHDX4.js} +50 -48
- package/chunks/{workspace-skills-status-YKZWOYRX.js → workspace-skills-status-HVXNWVGR.js} +44 -42
- package/chunks/{workspace-trust-reconciler-5FI2S3OS.js → workspace-trust-reconciler-RDBBGMWP.js} +49 -47
- package/chunks/{write-file-AY7VLP5X.js → write-file-RQ4DG5RY.js} +36 -34
- package/chunks/{zh-H3YDK5QW.js → zh-72XPUG5P.js} +54 -6
- package/chunks/{zh-TW-JYCP7XUA.js → zh-TW-LTB4SRH3.js} +54 -6
- package/chunks/{zoom-image-S4LJZMD5.js → zoom-image-O5YCB7WN.js} +10 -10
- package/cli.js +32 -48
- package/locales/ca.js +60 -4
- package/locales/de.js +62 -4
- package/locales/en.js +76 -6
- package/locales/fr.js +64 -4
- package/locales/ja.js +61 -4
- package/locales/pt.js +60 -4
- package/locales/ru.js +63 -4
- package/locales/zh-TW.js +67 -6
- package/locales/zh.js +67 -6
- package/package.json +3 -3
- package/web-shell/assets/{arc-xjArKHU2.js → arc-Bd7d781i.js} +1 -1
- package/web-shell/assets/{architectureDiagram-3BPJPVTR-BgrQDNYG.js → architectureDiagram-3BPJPVTR-CpnOJqNE.js} +1 -1
- package/web-shell/assets/{blockDiagram-GPEHLZMM-CXxWC-1_.js → blockDiagram-GPEHLZMM-NxVTiWnk.js} +1 -1
- package/web-shell/assets/{c4Diagram-AAUBKEIU-Dx1tLm3v.js → c4Diagram-AAUBKEIU-BWT75l82.js} +1 -1
- package/web-shell/assets/channel-A434sWK5.js +1 -0
- package/web-shell/assets/{chunk-2J33WTMH-CBxjogVR.js → chunk-2J33WTMH-Dzz03hk6.js} +1 -1
- package/web-shell/assets/{chunk-4BX2VUAB-izb-rY5W.js → chunk-4BX2VUAB-DRF-egfm.js} +1 -1
- package/web-shell/assets/{chunk-55IACEB6-NzLyvSb8.js → chunk-55IACEB6-Co15vq5x.js} +1 -1
- package/web-shell/assets/{chunk-727SXJPM-DVyKb0dl.js → chunk-727SXJPM-DHSUk1J7.js} +1 -1
- package/web-shell/assets/{chunk-AQP2D5EJ-BtqL7NzB.js → chunk-AQP2D5EJ-Br8u_E2R.js} +1 -1
- package/web-shell/assets/{chunk-FMBD7UC4-iNpdKIO0.js → chunk-FMBD7UC4-DXbPTnqF.js} +1 -1
- package/web-shell/assets/{chunk-ND2GUHAM-DI7cbFmX.js → chunk-ND2GUHAM-BleQdi4d.js} +1 -1
- package/web-shell/assets/{chunk-QZHKN3VN-3Y_-xFYs.js → chunk-QZHKN3VN-CqgBf-95.js} +1 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-CwPuhldB.js +1 -0
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CwPuhldB.js +1 -0
- package/web-shell/assets/{cose-bilkent-S5V4N54A--raRatZn.js → cose-bilkent-S5V4N54A-WS7b13Yg.js} +1 -1
- package/web-shell/assets/{dagre-BM42HDAG-B8SU70mO.js → dagre-BM42HDAG-v_55ki8o.js} +1 -1
- package/web-shell/assets/{diagram-2AECGRRQ-ewgoakXo.js → diagram-2AECGRRQ-DaYAjbdK.js} +1 -1
- package/web-shell/assets/{diagram-5GNKFQAL-Bm_JLTnS.js → diagram-5GNKFQAL-D_Hy-L64.js} +1 -1
- package/web-shell/assets/{diagram-KO2AKTUF-DEIUjUy9.js → diagram-KO2AKTUF-dB06cZyD.js} +1 -1
- package/web-shell/assets/{diagram-LMA3HP47-C2Wmrpj-.js → diagram-LMA3HP47-DzSluD4F.js} +1 -1
- package/web-shell/assets/{diagram-OG6HWLK6-CtYe6bFx.js → diagram-OG6HWLK6-Cvb6CeXQ.js} +1 -1
- package/web-shell/assets/{erDiagram-TEJ5UH35-DfpHcWLV.js → erDiagram-TEJ5UH35-7eB2Hmov.js} +1 -1
- package/web-shell/assets/{flowDiagram-I6XJVG4X-CAiUhio5.js → flowDiagram-I6XJVG4X-B08iGCw_.js} +1 -1
- package/web-shell/assets/{ganttDiagram-6RSMTGT7-CYc7ezr4.js → ganttDiagram-6RSMTGT7-BgsrCHq-.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-PVQCEYII-70lbkcRS.js → gitGraphDiagram-PVQCEYII-DQLurQ2i.js} +1 -1
- package/web-shell/assets/{index-Ww86nT9f.js → index-B_1Z0Mgr.js} +1 -1
- package/web-shell/assets/index-Bi1dP2mU.css +5 -0
- package/web-shell/assets/index-DJ-z1Oba.js +1756 -0
- package/web-shell/assets/{infoDiagram-5YYISTIA-C7e8DWPa.js → infoDiagram-5YYISTIA-DXZGO8qB.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-BYLr2op-.js → ishikawaDiagram-YF4QCWOH-g7gbuH2w.js} +1 -1
- package/web-shell/assets/{journeyDiagram-JHISSGLW-hEibAHKX.js → journeyDiagram-JHISSGLW-euefICGn.js} +1 -1
- package/web-shell/assets/{kanban-definition-UN3LZRKU-F2rt8Uhp.js → kanban-definition-UN3LZRKU-Dws8-mjG.js} +1 -1
- package/web-shell/assets/{linear-DPhyNezd.js → linear-C63F0tyh.js} +1 -1
- package/web-shell/assets/{mermaid.core-ZUtnug0n.js → mermaid.core-fLrhp_4-.js} +5 -5
- package/web-shell/assets/{mindmap-definition-RKZ34NQL-DDWcMoi8.js → mindmap-definition-RKZ34NQL-qRkydfT-.js} +1 -1
- package/web-shell/assets/{pieDiagram-4H26LBE5-CTRKzw1_.js → pieDiagram-4H26LBE5-BZ0wQaKN.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-W4KKPZXB-CAEwYG_z.js → quadrantDiagram-W4KKPZXB-Fjq6GbSZ.js} +1 -1
- package/web-shell/assets/{requirementDiagram-4Y6WPE33-CRjnH9D9.js → requirementDiagram-4Y6WPE33-CqWvjLHU.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-5OEKKPKP-LPQT_sOd.js → sankeyDiagram-5OEKKPKP-VcXX6PVZ.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-3UESZ5HK-Ht2Iqvb0.js → sequenceDiagram-3UESZ5HK-BJSRtxFr.js} +1 -1
- package/web-shell/assets/{stateDiagram-AJRCARHV-CIUdqOXu.js → stateDiagram-AJRCARHV-Dt9zUwmZ.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-CCxQt56w.js +1 -0
- package/web-shell/assets/{timeline-definition-PNZ67QCA-BcilneZF.js → timeline-definition-PNZ67QCA-DQwlNRws.js} +1 -1
- package/web-shell/assets/{vennDiagram-CIIHVFJN-BljwiiH1.js → vennDiagram-CIIHVFJN-DwxjUEtQ.js} +1 -1
- package/web-shell/assets/{wardley-L42UT6IY-DeKjkYjq.js → wardley-L42UT6IY-D3QdMSpJ.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-YWT4CUSO-L3U1H7KG.js → wardleyDiagram-YWT4CUSO-BddN8oK8.js} +1 -1
- package/web-shell/assets/{xychartDiagram-2RQKCTM6-IJnWsgMT.js → xychartDiagram-2RQKCTM6-BUNuBrRJ.js} +1 -1
- package/web-shell/index.html +2 -2
- package/chunks/chunk-4KP2F2TE.js +0 -82
- package/chunks/chunk-HGT6JR3U.js +0 -177
- package/chunks/nonInteractiveCli-ZJYEOO7U.js +0 -148
- package/web-shell/assets/channel-B1cyk94G.js +0 -1
- package/web-shell/assets/classDiagram-4FO5ZUOK-BpBYZoRE.js +0 -1
- package/web-shell/assets/classDiagram-v2-Q7XG4LA2-BpBYZoRE.js +0 -1
- package/web-shell/assets/index-C1k3PDuU.css +0 -5
- package/web-shell/assets/index-DZLIXILO.js +0 -1750
- package/web-shell/assets/insert-DmRbh9Rv.svg +0 -1
- package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BmqqQZ6w.js +0 -1
|
@@ -11,88 +11,91 @@ import {
|
|
|
11
11
|
toModelVisibleSubagentResult,
|
|
12
12
|
writeWorkflowSnapshot,
|
|
13
13
|
writeWorktreeSessionMarker
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-UQDFEU47.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-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
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-
|
|
26
|
+
import "./chunk-XUMAD5IT.js";
|
|
27
27
|
import "./chunk-IRH27ZC2.js";
|
|
28
28
|
import "./chunk-QHWCP53L.js";
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
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-
|
|
35
|
-
import "./chunk-
|
|
36
|
-
import "./chunk-
|
|
37
|
-
import "./chunk-
|
|
38
|
-
import "./chunk-
|
|
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-
|
|
44
|
+
} from "./chunk-TZTBZ25J.js";
|
|
43
45
|
import "./chunk-S6LOFUVP.js";
|
|
46
|
+
import "./chunk-SRY26X4H.js";
|
|
44
47
|
import "./chunk-K623ENWT.js";
|
|
45
48
|
import "./chunk-AQ37AY7B.js";
|
|
46
49
|
import {
|
|
47
50
|
WorkspaceContext
|
|
48
|
-
} from "./chunk-
|
|
49
|
-
import "./chunk-
|
|
50
|
-
import "./chunk-D4HTUMGX.js";
|
|
51
|
+
} from "./chunk-432XCUHF.js";
|
|
52
|
+
import "./chunk-XC656O42.js";
|
|
51
53
|
import "./chunk-NAVJD2PQ.js";
|
|
52
|
-
import "./chunk-
|
|
53
|
-
import "./chunk-
|
|
54
|
+
import "./chunk-QYPT3QUD.js";
|
|
55
|
+
import "./chunk-QMBEW7EW.js";
|
|
54
56
|
import "./chunk-DGEIYUC3.js";
|
|
55
57
|
import "./chunk-MPHPFVKK.js";
|
|
56
58
|
import "./chunk-GLNBDYUX.js";
|
|
57
59
|
import {
|
|
60
|
+
createAbortController,
|
|
58
61
|
createChildAbortController
|
|
59
62
|
} from "./chunk-DJ2GSRLV.js";
|
|
60
|
-
import "./chunk-
|
|
61
|
-
import "./chunk-
|
|
63
|
+
import "./chunk-EIMKVOSF.js";
|
|
64
|
+
import "./chunk-RPYYTL7E.js";
|
|
62
65
|
import "./chunk-2J3OJGTL.js";
|
|
63
66
|
import "./chunk-P3QQPMQA.js";
|
|
64
|
-
import "./chunk-
|
|
67
|
+
import "./chunk-6O5DVH27.js";
|
|
65
68
|
import "./chunk-GLCZKT5V.js";
|
|
66
|
-
import "./chunk-
|
|
69
|
+
import "./chunk-2DNKEBXY.js";
|
|
67
70
|
import {
|
|
68
71
|
WorkflowRunEvent,
|
|
69
72
|
logWorkflowRun,
|
|
70
73
|
read,
|
|
71
74
|
writeLine
|
|
72
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-4K3RV3OA.js";
|
|
73
76
|
import "./chunk-VGC4I5JJ.js";
|
|
74
|
-
import "./chunk-
|
|
77
|
+
import "./chunk-E4WHKETF.js";
|
|
75
78
|
import {
|
|
76
79
|
SyntheticOutputTool
|
|
77
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-UEJESCS7.js";
|
|
78
81
|
import {
|
|
79
82
|
BaseDeclarativeTool,
|
|
80
83
|
BaseToolInvocation,
|
|
81
84
|
ToolDisplayNames,
|
|
82
85
|
ToolNames
|
|
83
|
-
} from "./chunk-
|
|
84
|
-
import "./chunk-
|
|
86
|
+
} from "./chunk-CFDR3GNL.js";
|
|
87
|
+
import "./chunk-H35Q5CEG.js";
|
|
85
88
|
import "./chunk-46UV252V.js";
|
|
86
89
|
import "./chunk-ZBVS26BY.js";
|
|
87
|
-
import "./chunk-
|
|
88
|
-
import "./chunk-
|
|
89
|
-
import "./chunk-
|
|
90
|
-
import "./chunk-
|
|
90
|
+
import "./chunk-BFHXDAR7.js";
|
|
91
|
+
import "./chunk-TYERNYH4.js";
|
|
92
|
+
import "./chunk-UH7Z7Y45.js";
|
|
93
|
+
import "./chunk-O2ZYHG33.js";
|
|
91
94
|
import "./chunk-W4RQUHY3.js";
|
|
92
95
|
import "./chunk-G7XXKQYS.js";
|
|
93
96
|
import {
|
|
94
97
|
createDebugLogger
|
|
95
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-3RXUYQJI.js";
|
|
96
99
|
import "./chunk-VOQXFAY5.js";
|
|
97
100
|
import "./chunk-75DOP5OR.js";
|
|
98
101
|
import "./chunk-DMTGGOSA.js";
|
|
@@ -109,6 +112,95 @@ import {
|
|
|
109
112
|
// packages/core/src/tools/workflow/workflow.ts
|
|
110
113
|
init_esbuild_shims();
|
|
111
114
|
|
|
115
|
+
// packages/core/src/agents/runtime/workflow-budget.ts
|
|
116
|
+
init_esbuild_shims();
|
|
117
|
+
var debugLogger = createDebugLogger("WORKFLOW_BUDGET");
|
|
118
|
+
var MAX_TOKENS_PER_WORKFLOW_ENV = "QWEN_CODE_MAX_TOKENS_PER_WORKFLOW";
|
|
119
|
+
var HARD_MAX_TOKENS_CEILING = 1e8;
|
|
120
|
+
function resolveMaxTokensPerWorkflow(env = process.env) {
|
|
121
|
+
const raw = env[MAX_TOKENS_PER_WORKFLOW_ENV];
|
|
122
|
+
if (raw === void 0 || raw.trim() === "") {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
const parsed = parsePositiveIntegerEnv(raw, 0);
|
|
126
|
+
if (parsed < 1) {
|
|
127
|
+
debugLogger.warn(
|
|
128
|
+
`Invalid ${MAX_TOKENS_PER_WORKFLOW_ENV}=${JSON.stringify(raw)}, treating as unset (no cap)`
|
|
129
|
+
);
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
if (parsed > HARD_MAX_TOKENS_CEILING) {
|
|
133
|
+
debugLogger.warn(
|
|
134
|
+
`${MAX_TOKENS_PER_WORKFLOW_ENV}=${parsed} exceeds hard ceiling (${HARD_MAX_TOKENS_CEILING}); clamping.`
|
|
135
|
+
);
|
|
136
|
+
return HARD_MAX_TOKENS_CEILING;
|
|
137
|
+
}
|
|
138
|
+
return parsed;
|
|
139
|
+
}
|
|
140
|
+
__name(resolveMaxTokensPerWorkflow, "resolveMaxTokensPerWorkflow");
|
|
141
|
+
var WorkflowBudgetImpl = class _WorkflowBudgetImpl {
|
|
142
|
+
static {
|
|
143
|
+
__name(this, "WorkflowBudgetImpl");
|
|
144
|
+
}
|
|
145
|
+
total;
|
|
146
|
+
_spent;
|
|
147
|
+
constructor(total) {
|
|
148
|
+
this.total = total;
|
|
149
|
+
this._spent = 0;
|
|
150
|
+
}
|
|
151
|
+
spent() {
|
|
152
|
+
return this._spent;
|
|
153
|
+
}
|
|
154
|
+
remaining() {
|
|
155
|
+
if (this.total === null) return Infinity;
|
|
156
|
+
return Math.max(0, this.total - this._spent);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Host-side increment. NOT exposed to the script — the
|
|
160
|
+
* `WorkflowBudget` interface deliberately omits any setter so a
|
|
161
|
+
* malicious workflow cannot inflate / deflate the budget. Only the
|
|
162
|
+
* orchestrator (in `countedDispatch`) calls this after a dispatch
|
|
163
|
+
* resolves with the agent's output token count.
|
|
164
|
+
*
|
|
165
|
+
* Non-positive deltas are silently dropped (some dispatches return
|
|
166
|
+
* `output_tokens: 0` on early failures); negative deltas would be a
|
|
167
|
+
* caller bug and are also dropped rather than silently rewinding
|
|
168
|
+
* the counter.
|
|
169
|
+
*/
|
|
170
|
+
recordSpent(deltaTokens) {
|
|
171
|
+
if (!Number.isFinite(deltaTokens) || deltaTokens <= 0) return;
|
|
172
|
+
this._spent += deltaTokens;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Factory: build a budget from the current environment. Convenience
|
|
176
|
+
* over `new WorkflowBudgetImpl(resolveMaxTokensPerWorkflow(env))`.
|
|
177
|
+
*/
|
|
178
|
+
static fromEnv(env = process.env) {
|
|
179
|
+
return new _WorkflowBudgetImpl(resolveMaxTokensPerWorkflow(env));
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
var WorkflowBudgetExceededError = class extends Error {
|
|
183
|
+
static {
|
|
184
|
+
__name(this, "WorkflowBudgetExceededError");
|
|
185
|
+
}
|
|
186
|
+
name = "WorkflowBudgetExceededError";
|
|
187
|
+
runId;
|
|
188
|
+
budgetTotal;
|
|
189
|
+
spent;
|
|
190
|
+
constructor(runId, budgetTotal, spent) {
|
|
191
|
+
super(
|
|
192
|
+
`Workflow ${runId} exceeded the token budget (${spent} / ${budgetTotal} output tokens spent).`
|
|
193
|
+
);
|
|
194
|
+
this.runId = runId;
|
|
195
|
+
this.budgetTotal = budgetTotal;
|
|
196
|
+
this.spent = spent;
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
// packages/core/src/agents/runtime/workflow-runner.ts
|
|
201
|
+
init_esbuild_shims();
|
|
202
|
+
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
203
|
+
|
|
112
204
|
// packages/core/src/agents/runtime/workflow-orchestrator.ts
|
|
113
205
|
init_esbuild_shims();
|
|
114
206
|
import { randomBytes } from "node:crypto";
|
|
@@ -294,7 +386,7 @@ function isRegexContext(source, i) {
|
|
|
294
386
|
return /[{[(,;:=!&|?+\-*/%^~<>]/.test(prev);
|
|
295
387
|
}
|
|
296
388
|
__name(isRegexContext, "isRegexContext");
|
|
297
|
-
var
|
|
389
|
+
var debugLogger2 = createDebugLogger("WORKFLOW");
|
|
298
390
|
var MAX_LOG_LINES = 1e4;
|
|
299
391
|
var MAX_PHASE_ENTRIES = 1e4;
|
|
300
392
|
var ARGS_MAX_DEPTH = 64;
|
|
@@ -353,7 +445,7 @@ function createWorkflowSandbox(opts) {
|
|
|
353
445
|
try {
|
|
354
446
|
opts.emitter?.logAppended?.(line);
|
|
355
447
|
} catch (e) {
|
|
356
|
-
|
|
448
|
+
debugLogger2.warn("emitter.logAppended threw:", e);
|
|
357
449
|
}
|
|
358
450
|
} else if (logs.length === MAX_LOG_LINES) {
|
|
359
451
|
logs.push(`[workflow log truncated at ${MAX_LOG_LINES} lines]`);
|
|
@@ -367,7 +459,7 @@ function createWorkflowSandbox(opts) {
|
|
|
367
459
|
try {
|
|
368
460
|
opts.emitter?.phaseStarted?.(t);
|
|
369
461
|
} catch (e) {
|
|
370
|
-
|
|
462
|
+
debugLogger2.warn("emitter.phaseStarted threw:", e);
|
|
371
463
|
}
|
|
372
464
|
} else if (phases.length === MAX_PHASE_ENTRIES) {
|
|
373
465
|
phases.push(
|
|
@@ -390,7 +482,7 @@ function createWorkflowSandbox(opts) {
|
|
|
390
482
|
// value" (this warn). Receives only primitive strings/numbers — the bridge
|
|
391
483
|
// contract forbids host objects crossing back to the script.
|
|
392
484
|
logRevivalFailure: /* @__PURE__ */ __name((idx, reason) => {
|
|
393
|
-
|
|
485
|
+
debugLogger2.warn(
|
|
394
486
|
`Workflow result revival failed at index ${idx}: ${reason}; slot set to null (non-JSON-serializable thunk return).`
|
|
395
487
|
);
|
|
396
488
|
}, "logRevivalFailure"),
|
|
@@ -819,91 +911,6 @@ ${stripped}
|
|
|
819
911
|
}
|
|
820
912
|
__name(createWorkflowSandbox, "createWorkflowSandbox");
|
|
821
913
|
|
|
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
914
|
// packages/core/src/agents/runtime/workflow-stall.ts
|
|
908
915
|
init_esbuild_shims();
|
|
909
916
|
var DEFAULT_STALL_MS = 6e4;
|
|
@@ -1199,13 +1206,13 @@ function resolveMaxAgentsPerRun(env = process.env) {
|
|
|
1199
1206
|
}
|
|
1200
1207
|
const parsed = parsePositiveIntegerEnv(raw, 0);
|
|
1201
1208
|
if (parsed < 1) {
|
|
1202
|
-
|
|
1209
|
+
debugLogger2.warn(
|
|
1203
1210
|
`Invalid ${MAX_WORKFLOW_AGENTS_ENV}=${JSON.stringify(raw)}, using default (${DEFAULT_MAX_AGENTS_PER_RUN})`
|
|
1204
1211
|
);
|
|
1205
1212
|
return DEFAULT_MAX_AGENTS_PER_RUN;
|
|
1206
1213
|
}
|
|
1207
1214
|
if (parsed > HARD_MAX_AGENTS_PER_RUN_CEILING) {
|
|
1208
|
-
|
|
1215
|
+
debugLogger2.warn(
|
|
1209
1216
|
`${MAX_WORKFLOW_AGENTS_ENV}=${parsed} exceeds hard ceiling (${HARD_MAX_AGENTS_PER_RUN_CEILING}); clamping.`
|
|
1210
1217
|
);
|
|
1211
1218
|
return HARD_MAX_AGENTS_PER_RUN_CEILING;
|
|
@@ -1221,14 +1228,14 @@ function resolveConcurrencyLimit(env = process.env) {
|
|
|
1221
1228
|
const parsed = parsePositiveIntegerEnv(raw, 0);
|
|
1222
1229
|
if (parsed >= 1) {
|
|
1223
1230
|
if (parsed > HARD_MAX_CONCURRENCY_CEILING) {
|
|
1224
|
-
|
|
1231
|
+
debugLogger2.warn(
|
|
1225
1232
|
`${MAX_WORKFLOW_CONCURRENCY_ENV}=${parsed} exceeds hard ceiling (${HARD_MAX_CONCURRENCY_CEILING}); clamping.`
|
|
1226
1233
|
);
|
|
1227
1234
|
return HARD_MAX_CONCURRENCY_CEILING;
|
|
1228
1235
|
}
|
|
1229
1236
|
return parsed;
|
|
1230
1237
|
}
|
|
1231
|
-
|
|
1238
|
+
debugLogger2.warn(
|
|
1232
1239
|
`Invalid ${MAX_WORKFLOW_CONCURRENCY_ENV}=${JSON.stringify(raw)}, using cpu-derived default`
|
|
1233
1240
|
);
|
|
1234
1241
|
}
|
|
@@ -1238,6 +1245,7 @@ __name(resolveConcurrencyLimit, "resolveConcurrencyLimit");
|
|
|
1238
1245
|
var WORKFLOW_SUBAGENT_MAX_TURNS = 50;
|
|
1239
1246
|
var WORKFLOW_SUBAGENT_MAX_TIME_MINUTES = 10;
|
|
1240
1247
|
var WORKFLOW_SUBAGENT_DISALLOWED_TOOLS = [
|
|
1248
|
+
ToolNames.ASK_USER_QUESTION,
|
|
1241
1249
|
ToolNames.SEND_MESSAGE,
|
|
1242
1250
|
ToolNames.MONITOR,
|
|
1243
1251
|
...SUBAGENT_PLAN_LIFECYCLE_TOOLS,
|
|
@@ -1269,20 +1277,27 @@ function sanitizeForErrorMessage(value) {
|
|
|
1269
1277
|
return stripAnsiAndControl(value);
|
|
1270
1278
|
}
|
|
1271
1279
|
__name(sanitizeForErrorMessage, "sanitizeForErrorMessage");
|
|
1272
|
-
function createProductionDispatch(config, signal, onTokens) {
|
|
1280
|
+
function createProductionDispatch(config, signal, onTokens, bridgeApprovalEvents) {
|
|
1273
1281
|
return async (prompt, opts) => {
|
|
1274
1282
|
const stallMs = resolveStallMs(
|
|
1275
1283
|
typeof opts.stallMs === "number" ? opts.stallMs : void 0
|
|
1276
1284
|
);
|
|
1277
1285
|
return runStallResilient(
|
|
1278
|
-
(attemptSignal, emitter) =>
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
+
async (attemptSignal, emitter) => {
|
|
1287
|
+
const cleanupApprovalBridge = bridgeApprovalEvents?.(emitter);
|
|
1288
|
+
try {
|
|
1289
|
+
return await runSingleDispatch(
|
|
1290
|
+
config,
|
|
1291
|
+
prompt,
|
|
1292
|
+
opts,
|
|
1293
|
+
attemptSignal,
|
|
1294
|
+
emitter,
|
|
1295
|
+
onTokens
|
|
1296
|
+
);
|
|
1297
|
+
} finally {
|
|
1298
|
+
cleanupApprovalBridge?.();
|
|
1299
|
+
}
|
|
1300
|
+
},
|
|
1286
1301
|
{
|
|
1287
1302
|
stallMs,
|
|
1288
1303
|
signal,
|
|
@@ -1293,11 +1308,11 @@ function createProductionDispatch(config, signal, onTokens) {
|
|
|
1293
1308
|
}
|
|
1294
1309
|
__name(createProductionDispatch, "createProductionDispatch");
|
|
1295
1310
|
async function runSingleDispatch(config, prompt, opts, attemptSignal, emitter, onTokens) {
|
|
1296
|
-
const { AgentHeadless, ContextState } = await import("./agent-headless-
|
|
1311
|
+
const { AgentHeadless, ContextState } = await import("./agent-headless-45ASME4R.js");
|
|
1297
1312
|
const ctx = new ContextState();
|
|
1298
1313
|
ctx.set("task_prompt", prompt);
|
|
1299
1314
|
const workflowAgentId = `workflow-agent-${randomBytes(8).toString("hex")}`;
|
|
1300
|
-
|
|
1315
|
+
debugLogger2.debug(`[workflow] Dispatch ${workflowAgentId}`);
|
|
1301
1316
|
if (opts.agentType === void 0 && opts.model === void 0 && opts.isolation === void 0 && opts.schema === void 0) {
|
|
1302
1317
|
const subagent = await AgentHeadless.create(
|
|
1303
1318
|
opts.label ?? "workflow-agent",
|
|
@@ -1355,7 +1370,7 @@ function reportTokens(subagent, opts, onTokens) {
|
|
|
1355
1370
|
const summary = subagent.getExecutionSummary();
|
|
1356
1371
|
onTokens(summary.outputTokens, opts);
|
|
1357
1372
|
} catch (e) {
|
|
1358
|
-
|
|
1373
|
+
debugLogger2.warn("onTokens callback threw:", e);
|
|
1359
1374
|
}
|
|
1360
1375
|
}
|
|
1361
1376
|
__name(reportTokens, "reportTokens");
|
|
@@ -1474,7 +1489,7 @@ ${WORKFLOW_SUBAGENT_SYSTEM_PROMPT_WITH_SCHEMA}` : WORKFLOW_SUBAGENT_SYSTEM_PROMP
|
|
|
1474
1489
|
worktreeIsolation = null;
|
|
1475
1490
|
const preserved = await cleanupWorkflowWorktree(isolation);
|
|
1476
1491
|
if (preserved) {
|
|
1477
|
-
|
|
1492
|
+
debugLogger2.info(
|
|
1478
1493
|
`[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
1494
|
);
|
|
1480
1495
|
}
|
|
@@ -1529,7 +1544,7 @@ ${WORKFLOW_SUBAGENT_SYSTEM_PROMPT_WITH_SCHEMA}` : WORKFLOW_SUBAGENT_SYSTEM_PROMP
|
|
|
1529
1544
|
try {
|
|
1530
1545
|
await cleanupWorkflowWorktree(worktreeIsolation);
|
|
1531
1546
|
} catch (error) {
|
|
1532
|
-
|
|
1547
|
+
debugLogger2.warn(
|
|
1533
1548
|
`Workflow worktree cleanup in fallback finally failed for ${worktreeIsolation.path}: ${error instanceof Error ? error.message : String(error)}`
|
|
1534
1549
|
);
|
|
1535
1550
|
}
|
|
@@ -1562,7 +1577,7 @@ async function provisionWorkflowWorktree(config) {
|
|
|
1562
1577
|
try {
|
|
1563
1578
|
parentDirty = await wtService.hasWorktreeChanges(projectRoot);
|
|
1564
1579
|
} catch (error) {
|
|
1565
|
-
|
|
1580
|
+
debugLogger2.warn(
|
|
1566
1581
|
`[Workflow] hasWorktreeChanges failed at ${projectRoot}: ${error}`
|
|
1567
1582
|
);
|
|
1568
1583
|
parentDirty = true;
|
|
@@ -1577,7 +1592,7 @@ async function provisionWorkflowWorktree(config) {
|
|
|
1577
1592
|
try {
|
|
1578
1593
|
parentBranch = await wtService.getCurrentBranch();
|
|
1579
1594
|
} catch (error) {
|
|
1580
|
-
|
|
1595
|
+
debugLogger2.warn(
|
|
1581
1596
|
`[Workflow] getCurrentBranch failed at ${projectRoot}: ${error}`
|
|
1582
1597
|
);
|
|
1583
1598
|
}
|
|
@@ -1595,7 +1610,7 @@ async function provisionWorkflowWorktree(config) {
|
|
|
1595
1610
|
config.getSessionId()
|
|
1596
1611
|
);
|
|
1597
1612
|
} catch (error) {
|
|
1598
|
-
|
|
1613
|
+
debugLogger2.warn(
|
|
1599
1614
|
`[Workflow] failed to write session marker at ${created.worktree.path}: ${error}`
|
|
1600
1615
|
);
|
|
1601
1616
|
}
|
|
@@ -1628,20 +1643,20 @@ async function cleanupWorkflowWorktree(isolation) {
|
|
|
1628
1643
|
const wtService = new GitWorktreeService(isolation.repoRoot);
|
|
1629
1644
|
const [hasChanges, hasUnmerged] = await Promise.all([
|
|
1630
1645
|
wtService.hasWorktreeChanges(isolation.path).catch((error) => {
|
|
1631
|
-
|
|
1646
|
+
debugLogger2.warn(
|
|
1632
1647
|
`[Workflow] hasWorktreeChanges failed for ${isolation.path}: ${error}`
|
|
1633
1648
|
);
|
|
1634
1649
|
return true;
|
|
1635
1650
|
}),
|
|
1636
1651
|
wtService.hasUnmergedWorktreeCommits(isolation.slug).catch((error) => {
|
|
1637
|
-
|
|
1652
|
+
debugLogger2.warn(
|
|
1638
1653
|
`[Workflow] hasUnmergedWorktreeCommits failed for ${isolation.slug}: ${error}`
|
|
1639
1654
|
);
|
|
1640
1655
|
return true;
|
|
1641
1656
|
})
|
|
1642
1657
|
]);
|
|
1643
1658
|
if (hasChanges || hasUnmerged) {
|
|
1644
|
-
|
|
1659
|
+
debugLogger2.info(
|
|
1645
1660
|
`[Workflow] Preserving isolation worktree ${isolation.path} (branch ${isolation.branch}, hasChanges=${hasChanges}, hasUnmerged=${hasUnmerged})`
|
|
1646
1661
|
);
|
|
1647
1662
|
return { path: isolation.path, branch: isolation.branch };
|
|
@@ -1651,19 +1666,19 @@ async function cleanupWorkflowWorktree(isolation) {
|
|
|
1651
1666
|
deleteBranch: true
|
|
1652
1667
|
});
|
|
1653
1668
|
if (!result.success) {
|
|
1654
|
-
|
|
1669
|
+
debugLogger2.warn(
|
|
1655
1670
|
`[Workflow] Failed to remove ephemeral worktree ${isolation.path}: ${result.error}`
|
|
1656
1671
|
);
|
|
1657
1672
|
return { path: isolation.path, branch: isolation.branch };
|
|
1658
1673
|
}
|
|
1659
1674
|
if (result.branchPreserved) {
|
|
1660
|
-
|
|
1675
|
+
debugLogger2.warn(
|
|
1661
1676
|
`[Workflow] Removed worktree directory ${isolation.path} but kept branch ${isolation.branch} (unmerged commits at delete time)`
|
|
1662
1677
|
);
|
|
1663
1678
|
return { branch: isolation.branch };
|
|
1664
1679
|
}
|
|
1665
1680
|
} catch (error) {
|
|
1666
|
-
|
|
1681
|
+
debugLogger2.warn(
|
|
1667
1682
|
`[Workflow] Failed to remove ephemeral worktree ${isolation.path}: ${error}`
|
|
1668
1683
|
);
|
|
1669
1684
|
return { path: isolation.path, branch: isolation.branch };
|
|
@@ -1751,7 +1766,7 @@ var WorkflowOrchestrator = class {
|
|
|
1751
1766
|
if (cached !== void 0) {
|
|
1752
1767
|
const respawns = replay.started.get(journalKey);
|
|
1753
1768
|
if (respawns && respawns.length > 0) {
|
|
1754
|
-
|
|
1769
|
+
debugLogger2.info(
|
|
1755
1770
|
`[Workflow] resume cache hit after ${respawns.length} prior respawn(s) for runId=${runId}.`
|
|
1756
1771
|
);
|
|
1757
1772
|
}
|
|
@@ -1759,12 +1774,12 @@ var WorkflowOrchestrator = class {
|
|
|
1759
1774
|
try {
|
|
1760
1775
|
emitter?.agentDispatched?.(label2);
|
|
1761
1776
|
} catch (e) {
|
|
1762
|
-
|
|
1777
|
+
debugLogger2.warn("emitter.agentDispatched threw:", e);
|
|
1763
1778
|
}
|
|
1764
1779
|
try {
|
|
1765
1780
|
emitter?.agentCompleted?.(label2);
|
|
1766
1781
|
} catch (e) {
|
|
1767
|
-
|
|
1782
|
+
debugLogger2.warn("emitter.agentCompleted threw:", e);
|
|
1768
1783
|
}
|
|
1769
1784
|
return Promise.resolve(cached.result);
|
|
1770
1785
|
}
|
|
@@ -1772,11 +1787,11 @@ var WorkflowOrchestrator = class {
|
|
|
1772
1787
|
hadMiss = true;
|
|
1773
1788
|
journalEntryId = String(journalAgentId += 1);
|
|
1774
1789
|
journal.append({ type: "started", key: journalKey, agentId: journalEntryId }).catch(
|
|
1775
|
-
(e) =>
|
|
1790
|
+
(e) => debugLogger2.warn(`journal started-append failed: ${e}`)
|
|
1776
1791
|
);
|
|
1777
1792
|
}
|
|
1778
1793
|
if (budget && budget.total !== null && budget.remaining() <= 0) {
|
|
1779
|
-
|
|
1794
|
+
debugLogger2.warn(
|
|
1780
1795
|
`[Workflow] budget gate refused dispatch at entry: runId=${runId} spent=${budget.spent()} total=${budget.total}`
|
|
1781
1796
|
);
|
|
1782
1797
|
return Promise.reject(
|
|
@@ -1795,11 +1810,11 @@ var WorkflowOrchestrator = class {
|
|
|
1795
1810
|
try {
|
|
1796
1811
|
emitter?.agentDispatched?.(label);
|
|
1797
1812
|
} catch (e) {
|
|
1798
|
-
|
|
1813
|
+
debugLogger2.warn("emitter.agentDispatched threw:", e);
|
|
1799
1814
|
}
|
|
1800
1815
|
return limiter.run(() => {
|
|
1801
1816
|
if (budget && budget.total !== null && budget.remaining() <= 0) {
|
|
1802
|
-
|
|
1817
|
+
debugLogger2.warn(
|
|
1803
1818
|
`[Workflow] budget gate refused dispatch at slot-acquire: runId=${runId} spent=${budget.spent()} total=${budget.total}`
|
|
1804
1819
|
);
|
|
1805
1820
|
throw new WorkflowBudgetExceededError(
|
|
@@ -1814,7 +1829,7 @@ var WorkflowOrchestrator = class {
|
|
|
1814
1829
|
try {
|
|
1815
1830
|
emitter?.agentCompleted?.(label);
|
|
1816
1831
|
} catch (e) {
|
|
1817
|
-
|
|
1832
|
+
debugLogger2.warn("emitter.agentCompleted threw:", e);
|
|
1818
1833
|
}
|
|
1819
1834
|
if (journal && journalKey !== void 0) {
|
|
1820
1835
|
journal.append({
|
|
@@ -1823,14 +1838,14 @@ var WorkflowOrchestrator = class {
|
|
|
1823
1838
|
agentId: journalEntryId ?? "",
|
|
1824
1839
|
result
|
|
1825
1840
|
}).catch(
|
|
1826
|
-
(e) =>
|
|
1841
|
+
(e) => debugLogger2.warn(`journal result-append failed: ${e}`)
|
|
1827
1842
|
);
|
|
1828
1843
|
}
|
|
1829
1844
|
if (budget) {
|
|
1830
1845
|
try {
|
|
1831
1846
|
emitter?.budgetUpdated?.(budget.spent(), budget.total);
|
|
1832
1847
|
} catch (e) {
|
|
1833
|
-
|
|
1848
|
+
debugLogger2.warn("emitter.budgetUpdated threw:", e);
|
|
1834
1849
|
}
|
|
1835
1850
|
}
|
|
1836
1851
|
return result;
|
|
@@ -1840,13 +1855,13 @@ var WorkflowOrchestrator = class {
|
|
|
1840
1855
|
try {
|
|
1841
1856
|
emitter?.agentCompleted?.(label, msg);
|
|
1842
1857
|
} catch (e) {
|
|
1843
|
-
|
|
1858
|
+
debugLogger2.warn("emitter.agentCompleted threw:", e);
|
|
1844
1859
|
}
|
|
1845
1860
|
if (budget) {
|
|
1846
1861
|
try {
|
|
1847
1862
|
emitter?.budgetUpdated?.(budget.spent(), budget.total);
|
|
1848
1863
|
} catch (e) {
|
|
1849
|
-
|
|
1864
|
+
debugLogger2.warn("emitter.budgetUpdated threw:", e);
|
|
1850
1865
|
}
|
|
1851
1866
|
}
|
|
1852
1867
|
throw err;
|
|
@@ -1912,14 +1927,14 @@ async function settleToNullArray(thunks, signal, kind = "parallel") {
|
|
|
1912
1927
|
if (reason?.name === "WorkflowBudgetExceededError") {
|
|
1913
1928
|
budgetDropped += 1;
|
|
1914
1929
|
} else {
|
|
1915
|
-
|
|
1930
|
+
debugLogger2.warn(
|
|
1916
1931
|
`Workflow thunk at index ${i} rejected: ${String(reason?.message ?? r.reason)}`
|
|
1917
1932
|
);
|
|
1918
1933
|
}
|
|
1919
1934
|
return null;
|
|
1920
1935
|
});
|
|
1921
1936
|
if (budgetDropped > 0) {
|
|
1922
|
-
|
|
1937
|
+
debugLogger2.warn(
|
|
1923
1938
|
`${kind}: ${budgetDropped} slot${budgetDropped === 1 ? "" : "s"} dropped \u2014 token budget exceeded.`
|
|
1924
1939
|
);
|
|
1925
1940
|
}
|
|
@@ -1992,8 +2007,176 @@ function extractErrorMessage(err) {
|
|
|
1992
2007
|
}
|
|
1993
2008
|
__name(extractErrorMessage, "extractErrorMessage");
|
|
1994
2009
|
|
|
2010
|
+
// packages/core/src/agents/runtime/workflow-runner.ts
|
|
2011
|
+
var WorkflowRunHandle = class {
|
|
2012
|
+
constructor(runId, budget, registry, controller, start) {
|
|
2013
|
+
this.runId = runId;
|
|
2014
|
+
this.budget = budget;
|
|
2015
|
+
this.registry = registry;
|
|
2016
|
+
this.controller = controller;
|
|
2017
|
+
this.completion = Promise.resolve().then(start);
|
|
2018
|
+
}
|
|
2019
|
+
static {
|
|
2020
|
+
__name(this, "WorkflowRunHandle");
|
|
2021
|
+
}
|
|
2022
|
+
completion;
|
|
2023
|
+
abort() {
|
|
2024
|
+
this.controller.abort();
|
|
2025
|
+
}
|
|
2026
|
+
};
|
|
2027
|
+
var WorkflowRunner = class {
|
|
2028
|
+
static {
|
|
2029
|
+
__name(this, "WorkflowRunner");
|
|
2030
|
+
}
|
|
2031
|
+
static async start(options) {
|
|
2032
|
+
const config = options.config;
|
|
2033
|
+
const runInBackground = options.runInBackground === true;
|
|
2034
|
+
const budget = WorkflowBudgetImpl.fromEnv();
|
|
2035
|
+
const loaded = options.scriptPath && options.script === void 0 ? await resolveSavedWorkflowScript(
|
|
2036
|
+
{ scriptPath: options.scriptPath },
|
|
2037
|
+
config
|
|
2038
|
+
) : void 0;
|
|
2039
|
+
const script = loaded?.script ?? options.script ?? "";
|
|
2040
|
+
const scriptPath = loaded?.scriptPath ?? options.scriptPath;
|
|
2041
|
+
const runId = options.resumeFromRunId ?? `wf_${randomBytes2(8).toString("hex")}`;
|
|
2042
|
+
const storage = config.storage;
|
|
2043
|
+
const journal = storage ? new WorkflowJournal(storage.getWorkflowRunJournalPath(runId)) : void 0;
|
|
2044
|
+
const resumeReplay = options.resumeFromRunId ? await journal?.load() : void 0;
|
|
2045
|
+
if (runInBackground && options.signal.aborted) {
|
|
2046
|
+
throw new Error("Background workflow start was cancelled.");
|
|
2047
|
+
}
|
|
2048
|
+
const callerWasAbortedBeforeStart = options.signal.aborted;
|
|
2049
|
+
const controller = runInBackground ? createAbortController() : createChildAbortController(options.signal);
|
|
2050
|
+
const registry = config.getWorkflowRunRegistry?.();
|
|
2051
|
+
const dispatch = options.dispatch ?? createProductionDispatch(
|
|
2052
|
+
config,
|
|
2053
|
+
controller.signal,
|
|
2054
|
+
(outputTokens) => budget.recordSpent(outputTokens),
|
|
2055
|
+
registry ? (emitter2) => registry.bridgeApprovalEvents(runId, emitter2) : void 0
|
|
2056
|
+
);
|
|
2057
|
+
const orchestrator = new WorkflowOrchestrator(dispatch);
|
|
2058
|
+
let entry;
|
|
2059
|
+
try {
|
|
2060
|
+
entry = registry?.register({
|
|
2061
|
+
runId,
|
|
2062
|
+
meta: null,
|
|
2063
|
+
status: "running",
|
|
2064
|
+
startTime: Date.now(),
|
|
2065
|
+
outputFile: "",
|
|
2066
|
+
abortController: controller,
|
|
2067
|
+
tokenBudgetTotal: budget.total,
|
|
2068
|
+
script,
|
|
2069
|
+
scriptPath,
|
|
2070
|
+
isBackgrounded: runInBackground
|
|
2071
|
+
});
|
|
2072
|
+
} catch (error) {
|
|
2073
|
+
controller.abort();
|
|
2074
|
+
throw error;
|
|
2075
|
+
}
|
|
2076
|
+
const emitUpdate = /* @__PURE__ */ __name(() => {
|
|
2077
|
+
if (!entry || !options.onUpdate) return;
|
|
2078
|
+
try {
|
|
2079
|
+
options.onUpdate(entry);
|
|
2080
|
+
} catch {
|
|
2081
|
+
}
|
|
2082
|
+
}, "emitUpdate");
|
|
2083
|
+
const emitter = {
|
|
2084
|
+
phaseStarted: /* @__PURE__ */ __name((title) => {
|
|
2085
|
+
registry?.onPhaseStarted(runId, title);
|
|
2086
|
+
emitUpdate();
|
|
2087
|
+
}, "phaseStarted"),
|
|
2088
|
+
agentDispatched: /* @__PURE__ */ __name(() => {
|
|
2089
|
+
registry?.onAgentDispatched(runId);
|
|
2090
|
+
emitUpdate();
|
|
2091
|
+
}, "agentDispatched"),
|
|
2092
|
+
agentCompleted: /* @__PURE__ */ __name(() => {
|
|
2093
|
+
registry?.onAgentCompleted(runId);
|
|
2094
|
+
}, "agentCompleted"),
|
|
2095
|
+
// Deliberate no-op: logs are snapshotted at terminal via
|
|
2096
|
+
// setRecentLogs; per-line emit would cause up to 10k TUI redraws.
|
|
2097
|
+
logAppended: /* @__PURE__ */ __name(() => {
|
|
2098
|
+
}, "logAppended"),
|
|
2099
|
+
budgetUpdated: /* @__PURE__ */ __name((spent, total) => {
|
|
2100
|
+
registry?.onBudgetUpdated(runId, spent, total);
|
|
2101
|
+
emitUpdate();
|
|
2102
|
+
}, "budgetUpdated")
|
|
2103
|
+
};
|
|
2104
|
+
const handle = new WorkflowRunHandle(
|
|
2105
|
+
runId,
|
|
2106
|
+
budget,
|
|
2107
|
+
registry,
|
|
2108
|
+
controller,
|
|
2109
|
+
async () => {
|
|
2110
|
+
try {
|
|
2111
|
+
const outcome = await orchestrator.run({
|
|
2112
|
+
script,
|
|
2113
|
+
args: options.args,
|
|
2114
|
+
abortOnTimeout: controller,
|
|
2115
|
+
runId,
|
|
2116
|
+
emitter,
|
|
2117
|
+
budget,
|
|
2118
|
+
resolveSavedWorkflow: /* @__PURE__ */ __name((ref) => resolveSavedWorkflowScript(ref, config), "resolveSavedWorkflow"),
|
|
2119
|
+
journal,
|
|
2120
|
+
resumeReplay
|
|
2121
|
+
});
|
|
2122
|
+
if (entry) {
|
|
2123
|
+
entry.meta = outcome.meta;
|
|
2124
|
+
if (outcome.meta?.name && entry.description === runId) {
|
|
2125
|
+
entry.description = outcome.meta.name;
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
registry?.setRecentLogs(runId, outcome.logs);
|
|
2129
|
+
registry?.complete(runId, outcome.result, Date.now());
|
|
2130
|
+
return { ok: true, outcome };
|
|
2131
|
+
} catch (error) {
|
|
2132
|
+
const details = error instanceof WorkflowExecutionError ? error : void 0;
|
|
2133
|
+
const message = extractErrorMessage2(error);
|
|
2134
|
+
if (entry && details?.meta && !entry.meta) entry.meta = details.meta;
|
|
2135
|
+
if (details?.logs) registry?.setRecentLogs(runId, details.logs);
|
|
2136
|
+
if (callerWasAbortedBeforeStart || !runInBackground && options.signal.aborted || entry?.status === "cancelled") {
|
|
2137
|
+
registry?.cancel(runId, Date.now());
|
|
2138
|
+
} else {
|
|
2139
|
+
registry?.fail(runId, message, Date.now());
|
|
2140
|
+
}
|
|
2141
|
+
return { ok: false, message, details };
|
|
2142
|
+
} finally {
|
|
2143
|
+
controller.abort();
|
|
2144
|
+
if (entry && entry.status !== "running") {
|
|
2145
|
+
await writeWorkflowSnapshot(config, entry);
|
|
2146
|
+
try {
|
|
2147
|
+
logWorkflowRun(
|
|
2148
|
+
config,
|
|
2149
|
+
new WorkflowRunEvent({
|
|
2150
|
+
status: entry.status,
|
|
2151
|
+
agents_dispatched: entry.agentsDispatched,
|
|
2152
|
+
agents_completed: entry.agentsCompleted,
|
|
2153
|
+
phase_count: entry.phases.length,
|
|
2154
|
+
tokens_spent: entry.tokensSpent,
|
|
2155
|
+
duration_ms: (entry.endTime ?? entry.startTime) - entry.startTime
|
|
2156
|
+
})
|
|
2157
|
+
);
|
|
2158
|
+
} catch {
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2161
|
+
registry?.releaseHandle(runId, handle);
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
);
|
|
2165
|
+
registry?.attachHandle(handle);
|
|
2166
|
+
return handle;
|
|
2167
|
+
}
|
|
2168
|
+
};
|
|
2169
|
+
function extractErrorMessage2(error) {
|
|
2170
|
+
if (error && typeof error === "object" && "message" in error) {
|
|
2171
|
+
const message = error.message;
|
|
2172
|
+
if (typeof message === "string") return message;
|
|
2173
|
+
return String(message);
|
|
2174
|
+
}
|
|
2175
|
+
return String(error);
|
|
2176
|
+
}
|
|
2177
|
+
__name(extractErrorMessage2, "extractErrorMessage");
|
|
2178
|
+
|
|
1995
2179
|
// packages/core/src/tools/workflow/workflow.ts
|
|
1996
|
-
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
1997
2180
|
import * as path from "node:path";
|
|
1998
2181
|
var WORKFLOW_PARAM_SCHEMA = {
|
|
1999
2182
|
type: "object",
|
|
@@ -2012,6 +2195,11 @@ var WORKFLOW_PARAM_SCHEMA = {
|
|
|
2012
2195
|
resumeFromRunId: {
|
|
2013
2196
|
type: "string",
|
|
2014
2197
|
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."
|
|
2198
|
+
},
|
|
2199
|
+
run_in_background: {
|
|
2200
|
+
type: "boolean",
|
|
2201
|
+
default: false,
|
|
2202
|
+
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
2203
|
}
|
|
2016
2204
|
}
|
|
2017
2205
|
// `script` is required UNLESS `scriptPath` is supplied; this XOR can't be
|
|
@@ -2041,104 +2229,54 @@ var WorkflowToolInvocation = class extends BaseToolInvocation {
|
|
|
2041
2229
|
return Promise.resolve("ask");
|
|
2042
2230
|
}
|
|
2043
2231
|
async execute(signal, updateOutput, _shellExecutionConfig) {
|
|
2044
|
-
const
|
|
2045
|
-
|
|
2046
|
-
|
|
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
|
-
}
|
|
2232
|
+
const runInBackground = this.params.run_in_background === true;
|
|
2233
|
+
if (runInBackground && signal.aborted) {
|
|
2234
|
+
return backgroundStartCancelledResult();
|
|
2074
2235
|
}
|
|
2075
|
-
|
|
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
|
-
};
|
|
2236
|
+
let handle;
|
|
2115
2237
|
try {
|
|
2116
|
-
|
|
2117
|
-
|
|
2238
|
+
handle = await WorkflowRunner.start({
|
|
2239
|
+
config: this.config,
|
|
2240
|
+
signal,
|
|
2241
|
+
script: this.params.script,
|
|
2242
|
+
scriptPath: this.params.scriptPath,
|
|
2118
2243
|
args: this.params.args,
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
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
|
|
2244
|
+
resumeFromRunId: this.params.resumeFromRunId,
|
|
2245
|
+
dispatch: this.toolOptions.dispatch,
|
|
2246
|
+
runInBackground,
|
|
2247
|
+
onUpdate: !runInBackground && updateOutput ? (entry) => safeEmitUpdate(updateOutput, entry) : void 0
|
|
2129
2248
|
});
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
registryEntry.description = outcome.meta.name;
|
|
2134
|
-
}
|
|
2249
|
+
} catch (error) {
|
|
2250
|
+
if (runInBackground && signal.aborted) {
|
|
2251
|
+
return backgroundStartCancelledResult();
|
|
2135
2252
|
}
|
|
2136
|
-
|
|
2137
|
-
|
|
2253
|
+
throw error;
|
|
2254
|
+
}
|
|
2255
|
+
if (runInBackground) {
|
|
2256
|
+
const status = handle.registry?.get(handle.runId)?.status ?? "running";
|
|
2257
|
+
const usageBanner = resolveUsageBanner(
|
|
2258
|
+
this.config,
|
|
2259
|
+
handle.registry,
|
|
2260
|
+
handle.budget.total
|
|
2261
|
+
);
|
|
2262
|
+
return {
|
|
2263
|
+
llmContent: [
|
|
2264
|
+
{
|
|
2265
|
+
text: `Workflow started in background.
|
|
2266
|
+
Run ID: ${handle.runId}
|
|
2267
|
+
Status: ${status}`
|
|
2268
|
+
}
|
|
2269
|
+
],
|
|
2270
|
+
returnDisplay: usageBanner + `Workflow ${handle.runId} started in the background (status: ${status}). Use Background Tasks to observe or stop it.`
|
|
2271
|
+
};
|
|
2272
|
+
}
|
|
2273
|
+
const settlement = await handle.completion;
|
|
2274
|
+
if (settlement.ok) {
|
|
2275
|
+
const { outcome } = settlement;
|
|
2138
2276
|
const usageBanner = resolveUsageBanner(
|
|
2139
2277
|
this.config,
|
|
2140
|
-
registry,
|
|
2141
|
-
budget.total
|
|
2278
|
+
handle.registry,
|
|
2279
|
+
handle.budget.total
|
|
2142
2280
|
);
|
|
2143
2281
|
const llmText = safeStringifyResult(outcome.result);
|
|
2144
2282
|
const displayJson = safeStringifyDisplayPayload({
|
|
@@ -2153,10 +2291,10 @@ var WorkflowToolInvocation = class extends BaseToolInvocation {
|
|
|
2153
2291
|
// tokens whenever ANY usage is reported OR a cap is set, not
|
|
2154
2292
|
// only when spend > 0. A capped-but-zero-spend run still wants
|
|
2155
2293
|
// the cap visible so the user sees the gate engaged.
|
|
2156
|
-
...budget.spent() > 0 || budget.total !== null ? {
|
|
2294
|
+
...handle.budget.spent() > 0 || handle.budget.total !== null ? {
|
|
2157
2295
|
tokens: {
|
|
2158
|
-
spent: budget.spent(),
|
|
2159
|
-
total: budget.total
|
|
2296
|
+
spent: handle.budget.spent(),
|
|
2297
|
+
total: handle.budget.total
|
|
2160
2298
|
}
|
|
2161
2299
|
} : {}
|
|
2162
2300
|
});
|
|
@@ -2164,20 +2302,9 @@ var WorkflowToolInvocation = class extends BaseToolInvocation {
|
|
|
2164
2302
|
llmContent: [{ text: llmText }],
|
|
2165
2303
|
returnDisplay: usageBanner + "```json\n" + displayJson + "\n```"
|
|
2166
2304
|
};
|
|
2167
|
-
}
|
|
2168
|
-
const message =
|
|
2169
|
-
const phases
|
|
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
|
-
}
|
|
2305
|
+
} else {
|
|
2306
|
+
const { message, details } = settlement;
|
|
2307
|
+
const { phases, logs, meta } = details ?? {};
|
|
2181
2308
|
const display = phases || logs || meta ? `Workflow failed: ${message}
|
|
2182
2309
|
|
|
2183
2310
|
${safeStringifyDisplayPayload({
|
|
@@ -2193,28 +2320,16 @@ ${safeStringifyDisplayPayload({
|
|
|
2193
2320
|
// the same way as other execution-time tool errors.
|
|
2194
2321
|
error: { message, type: "execution_failed" /* EXECUTION_FAILED */ }
|
|
2195
2322
|
};
|
|
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
2323
|
}
|
|
2216
2324
|
}
|
|
2217
2325
|
};
|
|
2326
|
+
function backgroundStartCancelledResult() {
|
|
2327
|
+
return {
|
|
2328
|
+
llmContent: "Workflow was cancelled before it could start.",
|
|
2329
|
+
returnDisplay: "Workflow cancelled."
|
|
2330
|
+
};
|
|
2331
|
+
}
|
|
2332
|
+
__name(backgroundStartCancelledResult, "backgroundStartCancelledResult");
|
|
2218
2333
|
function buildLivePhaseTreeDisplay(entry) {
|
|
2219
2334
|
const payload = {
|
|
2220
2335
|
runId: entry.runId,
|
|
@@ -2297,21 +2412,12 @@ function safeStringifyDisplayPayload(payload) {
|
|
|
2297
2412
|
}
|
|
2298
2413
|
}
|
|
2299
2414
|
__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
2415
|
var WorkflowTool = class extends BaseDeclarativeTool {
|
|
2310
2416
|
constructor(config, toolOptions = {}) {
|
|
2311
2417
|
super(
|
|
2312
2418
|
ToolNames.WORKFLOW,
|
|
2313
2419
|
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.",
|
|
2420
|
+
"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
2421
|
"other" /* Other */,
|
|
2316
2422
|
WORKFLOW_PARAM_SCHEMA,
|
|
2317
2423
|
/* isOutputMarkdown */
|
|
@@ -2337,6 +2443,14 @@ var WorkflowTool = class extends BaseDeclarativeTool {
|
|
|
2337
2443
|
if (params.resumeFromRunId !== void 0 && !/^wf_[0-9a-f]+$/.test(params.resumeFromRunId)) {
|
|
2338
2444
|
return "WorkflowTool: `resumeFromRunId` must match the generated id format `wf_<hex>`.";
|
|
2339
2445
|
}
|
|
2446
|
+
if (params.run_in_background === true) {
|
|
2447
|
+
if (!this.config.isInteractive() || this.config.getExperimentalZedIntegration?.() === true) {
|
|
2448
|
+
return "WorkflowTool: `run_in_background` is available only in the interactive TUI.";
|
|
2449
|
+
}
|
|
2450
|
+
if (!this.config.getWorkflowRunRegistry().hasCompletionCallback()) {
|
|
2451
|
+
return "WorkflowTool: `run_in_background` requires an active workflow completion channel.";
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2340
2454
|
return null;
|
|
2341
2455
|
}
|
|
2342
2456
|
createInvocation(params) {
|
|
@@ -2348,11 +2462,11 @@ export {
|
|
|
2348
2462
|
};
|
|
2349
2463
|
/**
|
|
2350
2464
|
* @license
|
|
2351
|
-
* Copyright
|
|
2465
|
+
* Copyright 2026 Qwen Team
|
|
2352
2466
|
* SPDX-License-Identifier: Apache-2.0
|
|
2353
2467
|
*/
|
|
2354
2468
|
/**
|
|
2355
2469
|
* @license
|
|
2356
|
-
* Copyright
|
|
2470
|
+
* Copyright 2025 Qwen
|
|
2357
2471
|
* SPDX-License-Identifier: Apache-2.0
|
|
2358
2472
|
*/
|