@qwen-code/qwen-code 0.23.2 → 0.23.3-nightly.20260911.aaa6a32aae
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/README.md +35 -15
- package/bundled/computer-use/SKILL.md +1 -1
- package/bundled/goal-draft/SKILL.md +10 -10
- package/bundled/qc-helper/docs/configuration/model-providers.md +66 -28
- package/bundled/qc-helper/docs/configuration/settings.md +8 -3
- package/bundled/qc-helper/docs/features/_meta.ts +1 -0
- package/bundled/qc-helper/docs/features/channels/dingtalk.md +0 -20
- package/bundled/qc-helper/docs/features/channels/dws.md +7 -1
- package/bundled/qc-helper/docs/features/channels/overview.md +5 -6
- package/bundled/qc-helper/docs/features/commands.md +62 -9
- package/bundled/qc-helper/docs/features/computer-use.md +1 -1
- package/bundled/qc-helper/docs/features/cross-session-protocol.md +338 -0
- package/bundled/qc-helper/docs/features/goals.md +22 -18
- package/bundled/qc-helper/docs/features/hooks.md +28 -22
- package/bundled/qc-helper/docs/features/sub-agents.md +27 -0
- package/bundled/qc-helper/docs/qwen-serve.md +23 -6
- package/bundled/review/SKILL.md +93 -80
- package/bundled/review/references/persistence.md +2 -0
- package/bundled/review/references/posting.md +31 -14
- package/bundled/workflow-authoring/SKILL.md +410 -0
- package/bundled/workflow-creator/SKILL.md +1 -1
- package/chunks/{MaxSizedBox-4C3BKKKY.js → MaxSizedBox-7C5XTBZI.js} +64 -53
- package/chunks/{StandaloneSessionPicker-TXVF65YW.js → StandaloneSessionPicker-IGTT3ZRX.js} +88 -76
- package/chunks/{acp-startup-profiler-KEU6VAYR.js → acp-startup-profiler-RUQNTNU5.js} +2 -2
- package/chunks/acp-subagent-executor-IUHVNVVO.js +140 -0
- package/chunks/{acpAgent-H5XBKGB4.js → acpAgent-W43WM2K4.js} +957 -243
- package/chunks/{agent-T5LEFJIU.js → agent-2XMXC5JW.js} +48 -38
- package/chunks/{agent-headless-VZKSRH36.js → agent-headless-2HHBVCP6.js} +48 -38
- package/chunks/{anthropicContentGenerator-PRJWWVYJ.js → anthropicContentGenerator-7RI3MPIW.js} +69 -36
- package/chunks/{artifact-tool-G5LHNECG.js → artifact-tool-HHVHCPNG.js} +59 -109
- package/chunks/{askUserQuestion-I5W5S3D6.js → askUserQuestion-RFMXTD3B.js} +2 -2
- package/chunks/{bridge-AOX5IY44.js → bridge-ID6N4IH5.js} +69 -58
- package/chunks/{ca-KC2AISNS.js → ca-MX3WCEEG.js} +1 -1
- package/chunks/{channel-management-service-MWQGHPAS.js → channel-management-service-ASCXI7FR.js} +6 -6
- package/chunks/{channel-settings-store-XZCGDGHW.js → channel-settings-store-TPJFQAZY.js} +76 -65
- package/chunks/{channel-worker-group-SQ5FRWOH.js → channel-worker-group-JR6JOELM.js} +9 -9
- package/chunks/{channel-worker-manager-TU4ZNWOE.js → channel-worker-manager-AVKJEZFL.js} +19 -10
- package/chunks/{channel-worker-supervisor-EMITFMCP.js → channel-worker-supervisor-OOYY7BAQ.js} +7 -7
- package/chunks/{chunk-4WMGYG3F.js → chunk-22FWWGSM.js} +2 -2
- package/chunks/{chunk-LWX4WDFF.js → chunk-2S5RIGZJ.js} +43 -15
- package/chunks/{chunk-CLKE4IY3.js → chunk-2SZH22YO.js} +1 -1
- package/chunks/{chunk-HJ5UJQQL.js → chunk-2UKKQGRA.js} +3639 -1804
- package/chunks/{chunk-MWIO7MF6.js → chunk-2WSLXP3W.js} +4 -0
- package/chunks/{chunk-HNLMYDQE.js → chunk-33LYAC4R.js} +10 -6
- package/chunks/{chunk-VBLAI2HA.js → chunk-3FPYT6QC.js} +0 -31
- package/chunks/{chunk-F53KKZUD.js → chunk-3LMDSCLU.js} +158 -10
- package/chunks/{chunk-WXFCI3O5.js → chunk-3MAUPOZ4.js} +2 -2
- package/chunks/{chunk-CRZBDVP2.js → chunk-432JQKIO.js} +10 -10
- package/chunks/{chunk-IRGDIDGJ.js → chunk-43RQ552L.js} +364 -84
- package/chunks/{chunk-PFKGV6PO.js → chunk-465USTVK.js} +9 -15
- package/chunks/{chunk-WG7BL3FY.js → chunk-473RJLIH.js} +1 -1
- package/chunks/{chunk-J3VZF2AL.js → chunk-4O2AXZXU.js} +2 -2
- package/chunks/{chunk-N6S3NUYJ.js → chunk-55VOWZ4C.js} +1 -1
- package/chunks/{chunk-OWCFKIFQ.js → chunk-5CZMWDJI.js} +2 -2
- package/chunks/{chunk-7NDZKE2M.js → chunk-5MUIHID6.js} +5 -5
- package/chunks/{chunk-RM244SCQ.js → chunk-5Z74GE4N.js} +1 -1
- package/chunks/{chunk-G5VOXCRX.js → chunk-6375QMAO.js} +2 -2
- package/chunks/{chunk-3LPJ776W.js → chunk-63GQZKXL.js} +164 -31
- package/chunks/{chunk-O2FEO2CB.js → chunk-6GDELAVL.js} +18 -2
- package/chunks/{chunk-7PD7ZMX5.js → chunk-6HI2I3OM.js} +168 -6
- package/chunks/{chunk-CALNF3Z3.js → chunk-7C57HCOR.js} +1 -1
- package/chunks/{chunk-UYDQYDW2.js → chunk-7IBS746B.js} +1 -1
- package/chunks/{chunk-AUTUFD5X.js → chunk-ABNX6E6K.js} +1 -1
- package/chunks/chunk-ACHCT36C.js +28 -0
- package/chunks/{chunk-2WC3Y7YY.js → chunk-AEY27Z35.js} +401 -23
- package/chunks/{chunk-AO2VMS72.js → chunk-AQFRRH73.js} +3 -3
- package/chunks/{chunk-PDN7FJZV.js → chunk-ASWEMQIZ.js} +4 -4
- package/chunks/chunk-AYEJOTIU.js +43 -0
- package/chunks/{chunk-QFJZAY7W.js → chunk-BKFRA4F5.js} +5 -5
- package/chunks/{chunk-KCF2436G.js → chunk-BNLW5N6U.js} +4 -4
- package/chunks/{chunk-GOKAOSCN.js → chunk-BRFOZEPA.js} +2 -2
- package/chunks/{process-registry-OAEG6WGC.js → chunk-BYUAT5OC.js} +1 -0
- package/chunks/chunk-C5CECJ46.js +340 -0
- package/chunks/{chunk-NOO4QFXM.js → chunk-C75BXMPM.js} +1 -3
- package/chunks/chunk-CAAMI77K.js +937 -0
- package/chunks/{chunk-QTB4VP4K.js → chunk-CBGHRAWM.js} +304 -23
- package/chunks/chunk-CF5KXZZX.js +150 -0
- package/chunks/chunk-CFMZLE3L.js +75 -0
- package/chunks/{chunk-TGNNLRC3.js → chunk-CJ3DHN5I.js} +1 -0
- package/chunks/{chunk-ERXNTINK.js → chunk-CQZJYGRX.js} +1 -1
- package/chunks/{chunk-WBU2PIZ5.js → chunk-CSDKDHWV.js} +23 -16
- package/chunks/{chunk-2EKVPSIJ.js → chunk-D754KKNZ.js} +9 -2
- package/chunks/{chunk-E6TI726I.js → chunk-DGC7BKEZ.js} +1 -1
- package/chunks/{chunk-7SVM3RP2.js → chunk-DMMOQWRF.js} +4 -6
- package/chunks/{chunk-J3TJH52D.js → chunk-DOTF2PF2.js} +1 -1
- package/chunks/{chunk-2BMXHB6N.js → chunk-DWBNQR53.js} +7 -7
- package/chunks/{chunk-ZN5TKAVR.js → chunk-E5LTUWKZ.js} +3 -3
- package/chunks/chunk-EGW3ZP6Y.js +32 -0
- package/chunks/chunk-ELRMZTPF.js +374 -0
- package/chunks/{chunk-RNAJVXUG.js → chunk-ENAUXRPG.js} +6 -6
- package/chunks/{chunk-WXD7INFV.js → chunk-EO4U2X47.js} +10 -8
- package/chunks/{chunk-WDVV3LRM.js → chunk-EPVEPTI3.js} +45 -152
- package/chunks/chunk-ERU3SDXT.js +27 -0
- package/chunks/{chunk-4HOEU2OR.js → chunk-EWJTAP3Y.js} +1 -19
- package/chunks/{chunk-GSFV5RQW.js → chunk-EYN3G5XD.js} +328 -4
- package/chunks/{chunk-QB3KS3N3.js → chunk-FGROOEKM.js} +5 -40
- package/chunks/{chunk-TOOOLHVS.js → chunk-FH5AVEWJ.js} +3 -3
- package/chunks/{chunk-DAI65CMX.js → chunk-FJZWRNEW.js} +1 -1
- package/chunks/{chunk-GNY7B3CA.js → chunk-FUQK5ZNL.js} +1 -1
- package/chunks/{chunk-GOEVQADN.js → chunk-GDIPPCW6.js} +330 -175
- package/chunks/{chunk-ALMR3E6Q.js → chunk-GDWE23OR.js} +3 -3
- package/chunks/{chunk-LNYV4GXX.js → chunk-GSKX53AN.js} +0 -139
- package/chunks/{chunk-ELD3OBPU.js → chunk-GWOVD63C.js} +3 -3
- package/chunks/{chunk-IWABUX6T.js → chunk-GX5FF2IE.js} +6 -6
- package/chunks/{chunk-22GORRNY.js → chunk-GZMNHAYC.js} +1 -1
- package/chunks/{chunk-YZTGGCEE.js → chunk-H3TFIFX3.js} +1 -1
- package/chunks/{chunk-6G4V7SE4.js → chunk-HG46TTAG.js} +1 -1
- package/chunks/{chunk-FETY36NQ.js → chunk-HGEUHUEV.js} +1 -1
- package/chunks/{chunk-KEPC5BOL.js → chunk-IBRQG2MP.js} +12 -15
- package/chunks/{chunk-OXR34GCD.js → chunk-IILWL3KY.js} +2054 -146
- package/chunks/{chunk-IW6RQPQB.js → chunk-IJOS26LH.js} +1 -3
- package/chunks/{chunk-ORFIYTI2.js → chunk-IK2MWJP5.js} +1 -1
- package/chunks/{chunk-CMWU6P4D.js → chunk-IRJRB3OD.js} +1 -1
- package/chunks/{chunk-QHLHE2OT.js → chunk-IUN5ZMFY.js} +1 -1
- package/chunks/{chunk-LYT2OU7D.js → chunk-IXXV6BVB.js} +172 -6
- package/chunks/{chunk-R3JIDRUL.js → chunk-J6H4JP25.js} +4 -4
- package/chunks/{chunk-NB3NDQQK.js → chunk-J6SBP5G2.js} +1 -1
- package/chunks/{chunk-TRQNRP2H.js → chunk-J7LBAKDH.js} +46 -3
- package/chunks/{chunk-67XTVRVB.js → chunk-JJFHISXU.js} +30 -25
- package/chunks/chunk-JL6APGBX.js +43 -0
- package/chunks/{chunk-NX7ZTXFF.js → chunk-JSKEW4E7.js} +2 -1
- package/chunks/{chunk-BK7D2JR6.js → chunk-JVTXAA35.js} +3 -3
- package/chunks/chunk-K2OJUPOE.js +78 -0
- package/chunks/{chunk-G3ZUMSFS.js → chunk-K3U6VB3O.js} +6 -6
- package/chunks/{chunk-4I3WFI3U.js → chunk-K4KWLF7Q.js} +12 -12
- package/chunks/{chunk-WXPPUPHM.js → chunk-KWFFJ6AK.js} +1 -1
- package/chunks/{chunk-46MMBZHI.js → chunk-KZYOFJ6V.js} +4 -4
- package/chunks/{chunk-ULZECEIP.js → chunk-LDQHA6L4.js} +2 -20
- package/chunks/{chunk-7LTCFO6T.js → chunk-LQBAFO5D.js} +6 -5
- package/chunks/{chunk-SOA4HKRJ.js → chunk-LT2XFADM.js} +2 -2
- package/chunks/{chunk-JYGIJA4W.js → chunk-LWWRJRCD.js} +1 -1
- package/chunks/{chunk-YQGW3M6Z.js → chunk-MFQWRBFB.js} +5 -5
- package/chunks/{chunk-TODNHE76.js → chunk-MUFGTWQH.js} +5 -5
- package/chunks/{chunk-5DQ4YTIZ.js → chunk-MV5XRRML.js} +3 -3
- package/chunks/{chunk-IR6JKBAP.js → chunk-NOUK63IR.js} +2 -2
- package/chunks/{chunk-XQ4RDO5B.js → chunk-NV77SEX3.js} +1 -1
- package/chunks/{chunk-OFVAS4AR.js → chunk-NWDPOFJI.js} +2 -2
- package/chunks/chunk-NY6OPAPS.js +820 -0
- package/chunks/{chunk-WDN64MVT.js → chunk-O5VX66FB.js} +127 -18
- package/chunks/{chunk-MV5DTLJV.js → chunk-OHCR4O3U.js} +1 -1
- package/chunks/{chunk-LEAOJ43M.js → chunk-OKOPKQ2X.js} +1310 -2107
- package/chunks/{chunk-B25JYXZE.js → chunk-ONLJBOI2.js} +971 -17
- package/chunks/{chunk-QQK4L3UU.js → chunk-OWUAZXXN.js} +132 -26
- package/chunks/{chunk-R457KFV7.js → chunk-P42IUOAO.js} +3 -3
- package/chunks/{chunk-LUNC5KCL.js → chunk-PRELUGCQ.js} +214 -39
- package/chunks/{chunk-5OZUKLL7.js → chunk-QSMQKTXV.js} +4 -4
- package/chunks/{chunk-FAJPLSYF.js → chunk-QTQYLQ5A.js} +85 -81
- package/chunks/{chunk-CALTQWTZ.js → chunk-QVZDV4ZS.js} +2 -2
- package/chunks/{chunk-J6MB5ZHZ.js → chunk-QZW6WRB7.js} +2 -1
- package/chunks/{chunk-KFECPHLV.js → chunk-RBWAGV73.js} +3 -3
- package/chunks/{chunk-4VY3ITHR.js → chunk-RF5RQRTD.js} +3 -3
- package/chunks/{chunk-HIXUUCGY.js → chunk-RPMXMR6U.js} +2 -2
- package/chunks/{chunk-3OAXF3UK.js → chunk-RRQEZBL2.js} +3756 -1343
- package/chunks/{chunk-4ALNJDHL.js → chunk-RSGEAWFJ.js} +19 -1
- package/chunks/{chunk-5BH2AIEY.js → chunk-RUE62UH6.js} +2 -2
- package/chunks/{chunk-PQEISIKS.js → chunk-SAH4BD2J.js} +0 -67
- package/chunks/{chunk-A7EFXK7P.js → chunk-SAOJHRWY.js} +2 -2
- package/chunks/{chunk-JO77FGNZ.js → chunk-SDUIETBG.js} +19 -7
- package/chunks/{chunk-6RZX2HIH.js → chunk-TBEXLLAO.js} +2 -2
- package/chunks/{chunk-PSPAM24S.js → chunk-TBSCTWKF.js} +6 -0
- package/chunks/{chunk-HRPFBHW7.js → chunk-TPKQIA7G.js} +1 -0
- package/chunks/{chunk-XDNFODER.js → chunk-TUIW5LLK.js} +1 -1
- package/chunks/{chunk-APXIW2TF.js → chunk-TVV5FA3G.js} +4 -4
- package/chunks/chunk-U6H3XTFA.js +95 -0
- package/chunks/{chunk-S5QR6CB5.js → chunk-UKMWZ5NS.js} +108 -887
- package/chunks/{chunk-U6REWGVR.js → chunk-VG2BRSEK.js} +2 -2
- package/chunks/chunk-VGBOJH2D.js +127 -0
- package/chunks/chunk-VGY2RGXL.js +100 -0
- package/chunks/{chunk-ZP5XDLSA.js → chunk-VLWG3EHY.js} +12 -12
- package/chunks/{chunk-4JNHNVAZ.js → chunk-W547PYQ7.js} +9 -4
- package/chunks/{chunk-7VEYUF3N.js → chunk-W5ZQMAEM.js} +1 -1
- package/chunks/{chunk-QAZ2MGYT.js → chunk-W7JJLUSB.js} +2 -2
- package/chunks/{chunk-CCBTNJB4.js → chunk-W7Q7XDQI.js} +39 -27
- package/chunks/{chunk-DARWOZY6.js → chunk-WD6YQI5M.js} +1 -1
- package/chunks/{chunk-F2NYVASI.js → chunk-WXAWG3JS.js} +30 -13
- package/chunks/{chunk-NPKCVSXX.js → chunk-XB5JRCAM.js} +11 -9
- package/chunks/{chunk-XSOXPG2L.js → chunk-XE46RQFI.js} +136 -8
- package/chunks/{chunk-QTNCGZHQ.js → chunk-XX5HQLCZ.js} +16 -0
- package/chunks/{chunk-2Z3T52OC.js → chunk-Y5TM7SBV.js} +7 -2
- package/chunks/chunk-YC6XOB5N.js +691 -0
- package/chunks/{chunk-CWVZBIZJ.js → chunk-YDW4ERSS.js} +1 -1
- package/chunks/{chunk-TRWQQBVH.js → chunk-YGCTOXUT.js} +10 -24
- package/chunks/{chunk-WK7P62DV.js → chunk-YKC67ZEF.js} +6 -6
- package/chunks/{chunk-KA5HR3G2.js → chunk-YKM6MITI.js} +5 -5
- package/chunks/{chunk-X7LFJF5D.js → chunk-YM6KUQ2S.js} +36 -84
- package/chunks/{chunk-HZ2HUXX7.js → chunk-YS2ZJSOA.js} +29 -12
- package/chunks/{chunk-G37O7YO6.js → chunk-ZAWM6KRF.js} +3 -3
- package/chunks/{chunk-H3Q3RSKZ.js → chunk-ZFIWHBJ3.js} +1 -1
- package/chunks/{chunk-XBVNNDPK.js → chunk-ZHKTKHMO.js} +8 -1
- package/chunks/{chunk-YLOHCA6I.js → chunk-ZKWO4CF4.js} +2 -2
- package/chunks/{chunk-VJJXG73H.js → chunk-ZMQL5BL5.js} +21 -6
- package/chunks/{chunk-FGHPZGOP.js → chunk-ZMUYBOYB.js} +39 -55
- package/chunks/{chunk-FV4DM2M4.js → chunk-ZNI3YJHS.js} +26 -6
- package/chunks/{chunk-565U2ANU.js → chunk-ZTTC7T4X.js} +1 -1
- package/chunks/{chunk-7OCIQNKX.js → chunk-ZW2EUO2A.js} +1 -1
- package/chunks/codex-subagent-executor-26XOHVKH.js +585 -0
- package/chunks/{config-utils-GPLIABL2.js → config-utils-JUG3MOYN.js} +68 -57
- package/chunks/{contextCommand-NCUQUDBY.js → contextCommand-6K3POZFA.js} +65 -54
- package/chunks/{core-runtime-WKYKWVYU.js → core-runtime-XQFZLA2V.js} +66 -55
- package/chunks/{create-sub-session-TGIX63YU.js → create-sub-session-4UJ6RM6W.js} +5 -2
- package/chunks/{create-sub-session-PPLXB3JJ.js → create-sub-session-T4IYIOC7.js} +178 -91
- package/chunks/{cron-create-GTPVMJCF.js → cron-create-6466RWSO.js} +2 -2
- package/chunks/{cron-delete-ZBK27Z4K.js → cron-delete-W4QUWHOA.js} +2 -2
- package/chunks/{cron-list-KTFKFDKC.js → cron-list-Q5LJ5PZE.js} +2 -2
- package/chunks/{daemon-2CKIAO3I.js → daemon-PHPJUXDZ.js} +4 -2
- package/chunks/{daemon-git-worktree-guard-73ZWOLKL.js → daemon-git-worktree-guard-5WEMZ64U.js} +65 -54
- package/chunks/{daemon-status-provider-OK7VONJG.js → daemon-status-provider-GMD7QD4T.js} +74 -63
- package/chunks/{daemon-trust-policy-CAUCREG2.js → daemon-trust-policy-IPBZES2Z.js} +71 -60
- package/chunks/{daemon-trust-policy-monitor-3Y36OOEQ.js → daemon-trust-policy-monitor-MHYEN7X7.js} +71 -60
- package/chunks/{de-UU2YTO37.js → de-OOLZAU2U.js} +1 -1
- package/chunks/{deferred-core-runtime-Q7WFWYD3.js → deferred-core-runtime-CY43FZNZ.js} +63 -52
- package/chunks/{discovery-XP4RMDUM.js → discovery-5KUEPR65.js} +2 -2
- package/chunks/{display-image-CTNHJRZC.js → display-image-6AZIHP3J.js} +3 -3
- package/chunks/{dist-F34J4FZX.js → dist-2QYIVNS6.js} +2 -5
- package/chunks/{dist-6YDUH3BB.js → dist-GIMQXYLI.js} +10 -631
- package/chunks/{dist-NP7QKLVG.js → dist-GUB7QRYA.js} +3 -6
- package/chunks/{dist-Y5KC3IHW.js → dist-L45UB6DG.js} +233 -35
- package/chunks/{dist-XLV33CLY.js → dist-MPUZZOG5.js} +5 -18
- package/chunks/{dist-ZDNJK74R.js → dist-PA7WPFVE.js} +6 -37
- package/chunks/{dist-F6JLAJLE.js → dist-T6DDPDLQ.js} +16 -36
- package/chunks/{dist-BNQVF565.js → dist-TFGETXFN.js} +14 -37
- package/chunks/{dist-UFTFGI6I.js → dist-VDLSBCLM.js} +2 -6
- package/chunks/{edit-YJD6IETK.js → edit-6NUP5IPX.js} +48 -38
- package/chunks/{en-YJNRUQG4.js → en-ZSZW3PZX.js} +4 -1
- package/chunks/{enter-worktree-YFTKHXHZ.js → enter-worktree-EETDMJRF.js} +5 -5
- package/chunks/{enterPlanMode-EFPVTWIH.js → enterPlanMode-AZHYHEII.js} +48 -38
- package/chunks/{environment-HP3AXFTB.js → environment-ON6GIQ4F.js} +66 -55
- package/chunks/{errors-22ON46G7.js → errors-DQE63SCC.js} +65 -54
- package/chunks/exec-66WQIVYU.js +505 -0
- package/chunks/{exit-worktree-NF2XEMES.js → exit-worktree-DIPJ6S55.js} +5 -5
- package/chunks/{exitPlanMode-MOQUNCBH.js → exitPlanMode-NHBV6LAI.js} +48 -38
- package/chunks/{fast-path-2X7BPMXX.js → fast-path-EPJSUZZC.js} +7 -7
- package/chunks/{fast-path-settings-SATXY3PD.js → fast-path-settings-XDYX7X5Z.js} +2 -2
- package/chunks/{fr-HKNWVXRJ.js → fr-JJWM2HUS.js} +1 -1
- package/chunks/{glob-Y7ACIB3P.js → glob-MNEXQ2NV.js} +51 -41
- package/chunks/{goal-tools-DABMICUC.js → goal-tools-D2A4QBCJ.js} +54 -40
- package/chunks/{grep-BLHF2S5D.js → grep-EFWPV3MM.js} +2 -2
- package/chunks/{handleAutoUpdate-MCAMHYDI.js → handleAutoUpdate-2RY3OQA6.js} +67 -56
- package/chunks/{i18n-C3GDCALP.js → i18n-HTHDB3I7.js} +64 -53
- package/chunks/{image-gen-XP4NNIYG.js → image-gen-2PHED3P4.js} +8 -6
- package/chunks/{initializer-4URDQL2G.js → initializer-JEVLJCQA.js} +71 -60
- package/chunks/{installationInfo-LBOL6SBV.js → installationInfo-ITRB6J4L.js} +63 -52
- package/chunks/{ja-GJS5RZGU.js → ja-L67TXFDJ.js} +1 -1
- package/chunks/list-KOUIMHT5.js +133 -0
- package/chunks/{list-agents-2CXPGJUE.js → list-agents-IY4NEWLP.js} +17 -7
- package/chunks/{llm-2KPNSAVY.js → llm-F7WHGESY.js} +132 -120
- package/chunks/{llm-content-generator-GR3FOHLB.js → llm-content-generator-NYQ2NAVA.js} +6 -5
- package/chunks/{loadedSettingsAdapter-DVKROEJD.js → loadedSettingsAdapter-HZUAX5CX.js} +71 -60
- package/chunks/{loggingContentGenerator-P4K6K5W4.js → loggingContentGenerator-WMNU7C5J.js} +70 -59
- package/chunks/{loop-wakeup-HL6XOWI4.js → loop-wakeup-ANX25YW2.js} +3 -3
- package/chunks/{ls-YV7RKLKY.js → ls-4XCMJNZF.js} +4 -4
- package/chunks/{lsp-NO3AMRZT.js → lsp-K5E2Y64R.js} +1 -1
- package/chunks/{managed-npm-update-VWBKHNIN.js → managed-npm-update-EJJB65QI.js} +63 -52
- package/chunks/mcp-I73R6HS3.js +127 -0
- package/chunks/{monitor-A255TNZR.js → monitor-T56GJNA4.js} +50 -40
- package/chunks/{nonInteractiveCli-LXGIKQAT.js → nonInteractiveCli-CKHHJ423.js} +120 -109
- package/chunks/{notebook-edit-5UYHS2DM.js → notebook-edit-W5TU3EZ3.js} +48 -38
- package/chunks/openai-WX26N5OJ.js +47 -0
- package/chunks/{openaiContentGenerator-A6MAMEO5.js → openaiContentGenerator-TH6YAWAH.js} +33 -25
- package/chunks/openaiResponsesContentGenerator-EWLWQPKS.js +1738 -0
- package/chunks/{pidfile-B7DZC4TP.js → pidfile-RCC6TCEM.js} +63 -52
- package/chunks/process-registry-X6ZCASEN.js +10 -0
- package/chunks/{processUtils-BPZ2MCZS.js → processUtils-DQDQBRMC.js} +2 -2
- package/chunks/{prompt-terminal-ledger-FYYTAOXS.js → prompt-terminal-ledger-2LXWAGWU.js} +64 -53
- package/chunks/{pt-FXMYXEUV.js → pt-77SBDL4B.js} +1 -1
- package/chunks/{qwenContentGenerator-4IOJFD4S.js → qwenContentGenerator-LG65Z2YV.js} +61 -49
- package/chunks/{qwenOAuth2-KX6LVYQ3.js → qwenOAuth2-PJ63CCFD.js} +7 -5
- package/chunks/{read-file-A4H4O3VQ.js → read-file-72HMRUT4.js} +12 -9
- package/chunks/{read-mcp-resource-D3N75DGF.js → read-mcp-resource-NPF44YSC.js} +1 -1
- package/chunks/{record-artifact-Q5CRGJTP.js → record-artifact-MDXCCW2J.js} +3 -3
- package/chunks/record-source-VJLKDGGR.js +22 -0
- package/chunks/{report-findings-TJ34R7QK.js → report-findings-CZTYMZTC.js} +4 -4
- package/chunks/{request-shutdown-LRKMTBAD.js → request-shutdown-KOZHPVZU.js} +5 -5
- package/chunks/{resumeHistoryUtils-YQQ43E4N.js → resumeHistoryUtils-S2Q3M3EH.js} +69 -58
- package/chunks/{ripGrep-W32NWFTA.js → ripGrep-B2I3L5CO.js} +17 -13
- package/chunks/{ru-RMHURE5U.js → ru-UYWHKWF2.js} +1 -1
- package/chunks/{run-qwen-serve-WBSWWIRV.js → run-qwen-serve-AOPYFCVP.js} +305 -132
- package/chunks/{runtime-VRVBX2E5.js → runtime-TZMHKZAP.js} +77 -66
- package/chunks/{scheduled-tasks-D65KJDA3.js → scheduled-tasks-7RL6ZOYT.js} +72 -60
- package/chunks/{scheduler-M2YPN7Z7.js → scheduler-D6RLOFNU.js} +65 -54
- package/chunks/{sdk-exporters-grpc-MXTVSE3C.js → sdk-exporters-grpc-Y2ZUQDUQ.js} +2 -2
- package/chunks/{sdk-exporters-http-7R2ARBPV.js → sdk-exporters-http-VWTF4W6K.js} +3 -3
- package/chunks/{sdk-impl-YOLO7LV4.js → sdk-impl-G6FVTBQZ.js} +9 -9
- package/chunks/{send-message-76BKWKFZ.js → send-message-MMZVSS7P.js} +12 -9
- package/chunks/{serve-BE3H2P6P.js → serve-HWWDYI37.js} +72 -61
- package/chunks/{server-FLY5JERG.js → server-MD2X5U5L.js} +3156 -564
- package/chunks/{session-JVN62R5K.js → session-AFUMFNN7.js} +124 -113
- package/chunks/{session-attachments-root-7ACGLHXA.js → session-attachments-root-QPN3YWTY.js} +63 -52
- package/chunks/{session-pr-refresh-TQS57SDK.js → session-pr-refresh-4Y2ANMJX.js} +72 -60
- package/chunks/{settings-D44YMZFT.js → settings-QQRQ2LR7.js} +74 -63
- package/chunks/{shell-3VE6I4V5.js → shell-NUYUYMVI.js} +48 -38
- package/chunks/{skill-FHEGRRZU.js → skill-KHLDVOXW.js} +68 -30
- package/chunks/{skill-settings-VHEJMBFL.js → skill-settings-INLEGDEZ.js} +70 -59
- package/chunks/{spawnChannel-T6MX2ZDN.js → spawnChannel-KBGZHW2G.js} +67 -56
- package/chunks/{standalone-update-QUGHFMCS.js → standalone-update-3QP5NDVJ.js} +65 -54
- package/chunks/{start-opentui-ui-IHIIZ2LE.js → start-opentui-ui-VBT3XDWN.js} +2682 -2153
- package/chunks/{startInteractiveUI-LR7K2ARZ.js → startInteractiveUI-AZHKCHMR.js} +1562 -2317
- package/chunks/{syntheticOutput-D2P5V6RG.js → syntheticOutput-KRASPDE3.js} +2 -2
- package/chunks/{task-create-MWXJFRRM.js → task-create-TNXNT7ZD.js} +8 -8
- package/chunks/{task-list-EYO3FE57.js → task-list-FHNIJDKT.js} +1 -1
- package/chunks/{task-stop-BFSKRTGV.js → task-stop-MG4ZMTEI.js} +1 -1
- package/chunks/{task-update-2JJJRHMT.js → task-update-4HU62CJT.js} +8 -8
- package/chunks/{team-create-GY3VFY47.js → team-create-K5DNSJXR.js} +50 -40
- package/chunks/{team-delete-IQZ6XGFI.js → team-delete-2T44GUNN.js} +1 -1
- package/chunks/{team-plan-approval-BQPGZOT5.js → team-plan-approval-2ZNAQT2A.js} +48 -38
- package/chunks/{terminal-image-renderer-YNYW5CQG.js → terminal-image-renderer-23CW4A6Q.js} +65 -54
- package/chunks/{theme-manager-U6CIK3GM.js → theme-manager-G2333AMH.js} +63 -52
- package/chunks/{todoWrite-5ERKFWAK.js → todoWrite-BO2GR5MN.js} +4 -4
- package/chunks/{tool-search-XI3QWD5I.js → tool-search-MKQCKXN5.js} +22 -15
- package/chunks/{total-session-admission-3SNSJJ32.js → total-session-admission-ENKTM2KX.js} +69 -58
- package/chunks/{trustedFolders-OVAQKNV5.js → trustedFolders-2ETDL7OD.js} +64 -53
- package/chunks/{update-relaunch-XV5O74E3.js → update-relaunch-FMVNN5KA.js} +5 -5
- package/chunks/{updateCheck-CHUYWD6L.js → updateCheck-KWRV5KLJ.js} +66 -55
- package/chunks/{useAutoAcceptIndicator-VKSVIXZC.js → useAutoAcceptIndicator-7AUXAIQF.js} +73 -62
- package/chunks/{validateNonInterActiveAuth-ZNUTD3E5.js → validateNonInterActiveAuth-NETKLLDV.js} +117 -106
- package/chunks/{version-EK7VAGSI.js → version-DACNN2ZM.js} +1 -1
- package/chunks/{web-fetch-24KZO763.js → web-fetch-CIVCRET4.js} +16 -12
- package/chunks/{web-search-CRNXKZ2X.js → web-search-GOHZRGMM.js} +389 -327
- package/chunks/{web-shell-static-BFDESDD4.js → web-shell-static-T7UGLVE4.js} +2 -7
- package/chunks/workflow-IL2FOALZ.js +1324 -0
- package/chunks/workspace-providers-status-YGXL6N5U.js +131 -0
- package/chunks/{workspace-registration-store-HKLJEDQX.js → workspace-registration-store-E4IAOFFZ.js} +3 -1
- package/chunks/{workspace-registry-7RDDOBLN.js → workspace-registry-KX6BIBYK.js} +69 -58
- package/chunks/{workspace-runtime-coordinator-LEPDPXJO.js → workspace-runtime-coordinator-2KYYGDDR.js} +72 -59
- package/chunks/{workspace-service-5IFDCNN3.js → workspace-service-5Q6LWBYR.js} +76 -65
- package/chunks/{workspace-skills-status-FJ3HNH4H.js → workspace-skills-status-PJZTFPVV.js} +72 -61
- package/chunks/{workspace-trust-reconciler-PQFHIWLR.js → workspace-trust-reconciler-HS6PWNEA.js} +77 -66
- package/chunks/{write-file-ERG67ZFX.js → write-file-JB3DRM7O.js} +50 -40
- package/chunks/{zh-VBFCRQBL.js → zh-7UJA4ICT.js} +4 -1
- package/chunks/{zh-TW-N2TBF2F2.js → zh-TW-RV24PWUI.js} +4 -1
- package/chunks/{zoom-image-WQYEC3SR.js → zoom-image-AVHQFOOQ.js} +12 -9
- package/cli.js +16 -16
- package/codeModeHost.js +4425 -0
- package/export-transcript-document.css +1 -0
- package/export-transcript-document.js +164 -165
- package/locales/ca.js +2 -2
- package/locales/de.js +2 -2
- package/locales/en.js +5 -2
- package/locales/fr.js +2 -2
- package/locales/ja.js +2 -2
- package/locales/pt.js +2 -2
- package/locales/ru.js +2 -2
- package/locales/zh-TW.js +5 -2
- package/locales/zh.js +5 -2
- package/package.json +6 -4
- package/web-shell/assets/{abnfDiagram-VCTEODGH-BRLgQbnT.js → abnfDiagram-VCTEODGH-BH2nK5Z_.js} +1 -1
- package/web-shell/assets/{arc-qAF9_XsR.js → arc-CUUQ6krv.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-BorUttEz.js → architectureDiagram-5GKGNRK7-CJjiRuGx.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-Bj0qZVxu.js → blockDiagram-NRAW4CY4-GCDyU9ZX.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-BTqJis32.js → c4Diagram-UCG6FXSJ-C68MiN6h.js} +1 -1
- package/web-shell/assets/channel-DauVlmdF.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-RrQ5X8m-.js → chunk-2Q5K7J3B-_8B6frXZ.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-uUjDl8wO.js → chunk-5VM5RSS4-CroSinX7.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-C3JhpyzI.js → chunk-F27PBJKO-CGn4Z0Fx.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-C8ZNFs7F.js → chunk-G27WJ6UU-BI5nLQcf.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-DNpXtEOs.js → chunk-JWPE2WC7-CYJH0FuH.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-DagA2ZLw.js → chunk-LCL6LL3I-DjWZUqA1.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-R23uH7Xm.js → chunk-POPQ4Y6H-DcTkIHm8.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-Qz9RN_BR.js → chunk-SVP7TREG-E8sZT5uK.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-jYb1_hni.js → chunk-XXDRQBXY-CurjPKw_.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-BuIh7bj1.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-BuIh7bj1.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-Cv2OunpE.js → cose-bilkent-JH36ORCC-CJEnNhth.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-LH42KFJx.js → cynefin-OW5HDTMX-jwEkm0yw.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-Dha4_OoR.js → cynefinDiagram-5FMLGOSQ-B-OVQ6AO.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-Br5lnUKD.js → dagre-3AP2YEHR-CKKK9WNR.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-dpKq2bBX.js → diagram-S7CK7UJ4-D486veFQ.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-BAgHWpXr.js → diagram-UQ7AKVKN-C3GujqHv.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-GRRzpyE2.js → diagram-VSXAHHWV-BrOTDwuU.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-BNFiaYpG.js → diagram-VX7I27RA-C4D9kWE3.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-BisZzB_h.js → diagram-Z3DM3KII-7rAManT0.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-B1xbwycf.js → ebnfDiagram-PWID7BFC-CqVzKOdr.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-CQMzbGE5.js → erDiagram-SSCWMZ5O-D2s08fc_.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-CZ_Zondl.js → flowDiagram-A5DVABFB-CrKtBxB2.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-BTh2ShxS.js → ganttDiagram-EL5Y4UJY-CD1CKdlt.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-oHOB-Uxt.js → gitGraphDiagram-WWUBYQGX-CHDXdVNn.js} +1 -1
- package/web-shell/assets/index-D8tzgUOC.css +36 -0
- package/web-shell/assets/{index-DWoFMu5x.js → index-DWz95m74.js} +1 -1
- package/web-shell/assets/index-cDFf68Wd.js +2204 -0
- package/web-shell/assets/{infoDiagram-RXCK75RN-C0QpudbG.js → infoDiagram-RXCK75RN-Cr1oLCwe.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-a6B741uT.js → ishikawaDiagram-5VMMS53U--RghV1mm.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-Dbht9ICp.js → journeyDiagram-EYS64GPL-MN1ZkGW8.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-D4OFR8-h.js → kanban-definition-3QL26DDD-DL05VTn0.js} +1 -1
- package/web-shell/assets/{layout-Dvdh5jRH.js → layout-D_TvQzvn.js} +1 -1
- package/web-shell/assets/{linear-Dvc6KIW2.js → linear-B_0OH6XF.js} +1 -1
- package/web-shell/assets/{mermaid.core-CB36RfIb.js → mermaid.core-B9Nklh9I.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-Fmqo1CjP.js → mindmap-definition-FBJOCRG2-CevIQ0LR.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-CCxYBoA4.js → pegDiagram-XKGWAZYB-DQ8PIv0d.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-BVHKQFzt.js → pieDiagram-E7YTZNPT-BVTV1pPe.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-l95IznwR.js → quadrantDiagram-AXDQQJYC-DHN6nhpe.js} +1 -1
- package/web-shell/assets/qwen-code-notification-BRVagufF.png +0 -0
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-BlLdRdXp.js → railroadDiagram-O6MQD6OU-8HOyX0u-.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-BkDLBR5w.js → requirementDiagram-EFPCY7ZU-9W4_14i8.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-jAIqRp65.js → sankeyDiagram-P5KCCOFB-DSUBB2XP.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-f-soZYPr.js → sequenceDiagram-WJ2MYXX4-DD3jH6Jn.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-BzOuAfB2.js → sizeCapture-X5ZJPWSS-RAFTU3Cz.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-BPLSs12r.js → stateDiagram-HBIQ2CUA-Drk-oZ2x.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-QzYteVIm.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-D-9E_RIR.js → swimlanes-XN3QIQJK-Cy2nlOGx.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-xTr-HG26.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-CT56K-gV.js → timeline-definition-24CTP7MA-B7outYof.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-B-vi4IyO.js → vennDiagram-4TSXK5OY-Di_u1Ic6.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-C9O7Ju98.js → wardleyDiagram-VM6X3IG4-DYocuCAM.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-6d8w3jg2.js → xychartDiagram-S5SC5T6Z-AADDse54.js} +1 -1
- package/web-shell/index.html +29 -5
- package/chunks/chunk-V7RNNPGC.js +0 -44
- package/chunks/list-JOGBAC2R.js +0 -122
- package/chunks/mcp-6YYNSYLK.js +0 -116
- package/chunks/workflow-HD5NYMW5.js +0 -2907
- package/chunks/workspace-providers-status-MAM42IZS.js +0 -120
- package/web-shell/assets/channel-COIuCrVH.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-DoX6OYqu.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-DoX6OYqu.js +0 -1
- package/web-shell/assets/index-CI1ysIEv.js +0 -2154
- package/web-shell/assets/index-CpxXGH-8.css +0 -36
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-IRul-LaT.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-D6lgKepA.js +0 -8
- package/chunks/{chunk-JA5CBKRP.js → chunk-7NXSVSFB.js} +0 -0
- package/chunks/{open-with-auth-6MVIHMXB.js → open-with-auth-XFCCJOO6.js} +3 -3
|
@@ -0,0 +1,1324 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import {
|
|
4
|
+
DEFAULT_MAX_AGENTS_PER_RUN,
|
|
5
|
+
DEFAULT_WORKFLOW_SUBAGENT_MAX_TIME_MINUTES,
|
|
6
|
+
DEFAULT_WORKFLOW_SUBAGENT_MAX_TURNS,
|
|
7
|
+
MAX_TOKENS_PER_WORKFLOW_ENV,
|
|
8
|
+
MAX_WORKFLOW_AGENTS_ENV,
|
|
9
|
+
MAX_WORKFLOW_CONCURRENCY_ENV,
|
|
10
|
+
WORKFLOW_AUTHORING_SKILL_NAME,
|
|
11
|
+
WORKFLOW_SUBAGENT_MAX_MINUTES_ENV,
|
|
12
|
+
WORKFLOW_SUBAGENT_MAX_TURNS_ENV,
|
|
13
|
+
WorkflowBudgetImpl,
|
|
14
|
+
WorkflowDispatchScheduler,
|
|
15
|
+
WorkflowExecutionError,
|
|
16
|
+
WorkflowJournal,
|
|
17
|
+
WorkflowOrchestrator,
|
|
18
|
+
compileWorkflowScript,
|
|
19
|
+
createProductionDispatch,
|
|
20
|
+
deleteInlineWorkflowScript,
|
|
21
|
+
describeWorkflowCompileError,
|
|
22
|
+
extractAndStripMeta,
|
|
23
|
+
isSymlinkedRoot,
|
|
24
|
+
persistInlineWorkflowScript,
|
|
25
|
+
readWorkflowAuthoringReference,
|
|
26
|
+
resolveConcurrencyLimit,
|
|
27
|
+
resolveMaxTokensPerWorkflow,
|
|
28
|
+
resolveReviewWorkflowLimits,
|
|
29
|
+
resolveSavedWorkflowScript,
|
|
30
|
+
resolveWorkflowAuthoringSurface,
|
|
31
|
+
toolSearchRevealSentence,
|
|
32
|
+
writeWorkflowSnapshot
|
|
33
|
+
} from "./chunk-IILWL3KY.js";
|
|
34
|
+
import {
|
|
35
|
+
RESUME_ARGS_TOO_LARGE_NOTE,
|
|
36
|
+
buildFailureLines,
|
|
37
|
+
buildResumeCall,
|
|
38
|
+
getRuleDisplayName,
|
|
39
|
+
getWorkflowTaskMutationKey,
|
|
40
|
+
hasUninlinableResumeArgs,
|
|
41
|
+
isTerminalWorkflowStatus,
|
|
42
|
+
markWorkflowRunPersistenceActive,
|
|
43
|
+
resolveToolName,
|
|
44
|
+
tryWithWorkflowTaskMutation
|
|
45
|
+
} from "./chunk-2UKKQGRA.js";
|
|
46
|
+
import "./chunk-GOFAQQZA.js";
|
|
47
|
+
import "./chunk-6HUXPLB5.js";
|
|
48
|
+
import "./chunk-TWPJO254.js";
|
|
49
|
+
import "./chunk-CQ35AJ4Z.js";
|
|
50
|
+
import "./chunk-65I7S4Z3.js";
|
|
51
|
+
import "./chunk-7CLLH5TI.js";
|
|
52
|
+
import "./chunk-XKBFYTCD.js";
|
|
53
|
+
import "./chunk-6PVPNMXU.js";
|
|
54
|
+
import "./chunk-ZTTC7T4X.js";
|
|
55
|
+
import "./chunk-EYN3G5XD.js";
|
|
56
|
+
import "./chunk-IXXV6BVB.js";
|
|
57
|
+
import "./chunk-IRH27ZC2.js";
|
|
58
|
+
import "./chunk-QHWCP53L.js";
|
|
59
|
+
import "./chunk-3LMDSCLU.js";
|
|
60
|
+
import "./chunk-O6GEWCJA.js";
|
|
61
|
+
import "./chunk-RPMXMR6U.js";
|
|
62
|
+
import "./chunk-2SZH22YO.js";
|
|
63
|
+
import "./chunk-YGCTOXUT.js";
|
|
64
|
+
import "./chunk-QJNDUTOL.js";
|
|
65
|
+
import "./chunk-55VOWZ4C.js";
|
|
66
|
+
import "./chunk-LT2XFADM.js";
|
|
67
|
+
import "./chunk-ELRMZTPF.js";
|
|
68
|
+
import "./chunk-U6H3XTFA.js";
|
|
69
|
+
import "./chunk-ACHCT36C.js";
|
|
70
|
+
import "./chunk-CHEIIBT3.js";
|
|
71
|
+
import "./chunk-W7JJLUSB.js";
|
|
72
|
+
import "./chunk-OWUAZXXN.js";
|
|
73
|
+
import "./chunk-CH2YDT6X.js";
|
|
74
|
+
import "./chunk-JX6XHPTX.js";
|
|
75
|
+
import "./chunk-ZSTCM3MX.js";
|
|
76
|
+
import "./chunk-MLXTMF7H.js";
|
|
77
|
+
import "./chunk-63GQZKXL.js";
|
|
78
|
+
import "./chunk-3CZ2BQV6.js";
|
|
79
|
+
import "./chunk-SAH4BD2J.js";
|
|
80
|
+
import "./chunk-CAAMI77K.js";
|
|
81
|
+
import "./chunk-ZFIWHBJ3.js";
|
|
82
|
+
import "./chunk-S6LOFUVP.js";
|
|
83
|
+
import "./chunk-RF5RQRTD.js";
|
|
84
|
+
import "./chunk-6GDELAVL.js";
|
|
85
|
+
import "./chunk-G6UUOCUT.js";
|
|
86
|
+
import "./chunk-IZ2U57NY.js";
|
|
87
|
+
import "./chunk-C5CECJ46.js";
|
|
88
|
+
import "./chunk-K2OJUPOE.js";
|
|
89
|
+
import "./chunk-NAVJD2PQ.js";
|
|
90
|
+
import "./chunk-NWDPOFJI.js";
|
|
91
|
+
import "./chunk-33LYAC4R.js";
|
|
92
|
+
import "./chunk-QHMLYMMS.js";
|
|
93
|
+
import "./chunk-CFKIH3D3.js";
|
|
94
|
+
import "./chunk-JL6APGBX.js";
|
|
95
|
+
import {
|
|
96
|
+
createAbortController,
|
|
97
|
+
createChildAbortController
|
|
98
|
+
} from "./chunk-DJ2GSRLV.js";
|
|
99
|
+
import "./chunk-RSGEAWFJ.js";
|
|
100
|
+
import "./chunk-VGY2RGXL.js";
|
|
101
|
+
import "./chunk-C75BXMPM.js";
|
|
102
|
+
import "./chunk-KFFCDLKV.js";
|
|
103
|
+
import "./chunk-ZW2EUO2A.js";
|
|
104
|
+
import {
|
|
105
|
+
WorkflowRunEvent,
|
|
106
|
+
logWorkflowRun
|
|
107
|
+
} from "./chunk-WXAWG3JS.js";
|
|
108
|
+
import "./chunk-5ETULJLP.js";
|
|
109
|
+
import "./chunk-ZHKTKHMO.js";
|
|
110
|
+
import "./chunk-VGC4I5JJ.js";
|
|
111
|
+
import {
|
|
112
|
+
isWithinRoot
|
|
113
|
+
} from "./chunk-QZW6WRB7.js";
|
|
114
|
+
import "./chunk-EDIDYZBT.js";
|
|
115
|
+
import "./chunk-HD7O6WLV.js";
|
|
116
|
+
import "./chunk-CFMZLE3L.js";
|
|
117
|
+
import "./chunk-WZAD4ZNJ.js";
|
|
118
|
+
import "./chunk-3FPYT6QC.js";
|
|
119
|
+
import "./chunk-FPGTNKCP.js";
|
|
120
|
+
import "./chunk-TIGXX4PA.js";
|
|
121
|
+
import "./chunk-SDUIETBG.js";
|
|
122
|
+
import "./chunk-XFFRI3WM.js";
|
|
123
|
+
import "./chunk-ERU3SDXT.js";
|
|
124
|
+
import "./chunk-EWJTAP3Y.js";
|
|
125
|
+
import "./chunk-HHJLM3WQ.js";
|
|
126
|
+
import {
|
|
127
|
+
stripAnsiAndControl
|
|
128
|
+
} from "./chunk-W5ZQMAEM.js";
|
|
129
|
+
import "./chunk-74TONY4F.js";
|
|
130
|
+
import "./chunk-DGC7BKEZ.js";
|
|
131
|
+
import {
|
|
132
|
+
BaseDeclarativeTool,
|
|
133
|
+
BaseToolInvocation,
|
|
134
|
+
ToolDisplayNames,
|
|
135
|
+
ToolNames
|
|
136
|
+
} from "./chunk-2WSLXP3W.js";
|
|
137
|
+
import "./chunk-ZAFYHRVY.js";
|
|
138
|
+
import "./chunk-TBWQLLFO.js";
|
|
139
|
+
import "./chunk-UKMWZ5NS.js";
|
|
140
|
+
import "./chunk-75DOP5OR.js";
|
|
141
|
+
import "./chunk-DMTGGOSA.js";
|
|
142
|
+
import "./chunk-YQ3U5MUC.js";
|
|
143
|
+
import "./chunk-MATEIJZF.js";
|
|
144
|
+
import {
|
|
145
|
+
init_esbuild_shims
|
|
146
|
+
} from "./chunk-5O2XNYP6.js";
|
|
147
|
+
import {
|
|
148
|
+
__name
|
|
149
|
+
} from "./chunk-J2S4EL5Y.js";
|
|
150
|
+
|
|
151
|
+
// packages/core/src/tools/workflow/workflow.ts
|
|
152
|
+
init_esbuild_shims();
|
|
153
|
+
|
|
154
|
+
// packages/core/src/agents/runtime/workflow-runner.ts
|
|
155
|
+
init_esbuild_shims();
|
|
156
|
+
import { randomBytes } from "node:crypto";
|
|
157
|
+
var WorkflowRunHandle = class {
|
|
158
|
+
constructor(runId, budget, registry, controller, scheduler, start, locations = {}) {
|
|
159
|
+
this.runId = runId;
|
|
160
|
+
this.budget = budget;
|
|
161
|
+
this.registry = registry;
|
|
162
|
+
this.controller = controller;
|
|
163
|
+
this.scheduler = scheduler;
|
|
164
|
+
this.scriptPath = locations.scriptPath;
|
|
165
|
+
this.journalPath = locations.journalPath;
|
|
166
|
+
this.completion = Promise.resolve().then(start);
|
|
167
|
+
}
|
|
168
|
+
static {
|
|
169
|
+
__name(this, "WorkflowRunHandle");
|
|
170
|
+
}
|
|
171
|
+
completion;
|
|
172
|
+
/**
|
|
173
|
+
* Where this run's script lives on disk: the file a `{scriptPath}` launch
|
|
174
|
+
* loaded, or the persisted copy of an inline `{script}`. `undefined` when
|
|
175
|
+
* an inline script could not be persisted (no `storage`, symlinked root,
|
|
176
|
+
* write failure) — callers report the run without it rather than naming a
|
|
177
|
+
* path that does not exist.
|
|
178
|
+
*/
|
|
179
|
+
scriptPath;
|
|
180
|
+
/** This run's resume journal, when the config has a `storage` to hold one. */
|
|
181
|
+
journalPath;
|
|
182
|
+
abort() {
|
|
183
|
+
this.controller.abort();
|
|
184
|
+
}
|
|
185
|
+
pause() {
|
|
186
|
+
return this.scheduler.pause();
|
|
187
|
+
}
|
|
188
|
+
resume() {
|
|
189
|
+
return this.scheduler.resume();
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
var WorkflowScriptNotLaunchedError = class extends Error {
|
|
193
|
+
constructor(detail) {
|
|
194
|
+
super(
|
|
195
|
+
`Workflow script is invalid and was not launched:
|
|
196
|
+
${detail}
|
|
197
|
+
|
|
198
|
+
Workflow scripts must be plain JavaScript \u2014 the usual causes are TypeScript syntax (type annotations, interfaces, generics) and broken string quoting or escaping. Metadata must use literal values.`
|
|
199
|
+
);
|
|
200
|
+
this.detail = detail;
|
|
201
|
+
this.name = "WorkflowScriptNotLaunchedError";
|
|
202
|
+
}
|
|
203
|
+
static {
|
|
204
|
+
__name(this, "WorkflowScriptNotLaunchedError");
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
var WorkflowStartCancelledError = class extends Error {
|
|
208
|
+
static {
|
|
209
|
+
__name(this, "WorkflowStartCancelledError");
|
|
210
|
+
}
|
|
211
|
+
constructor() {
|
|
212
|
+
super("Workflow start was cancelled.");
|
|
213
|
+
this.name = "WorkflowStartCancelledError";
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
var WorkflowRunner = class {
|
|
217
|
+
static {
|
|
218
|
+
__name(this, "WorkflowRunner");
|
|
219
|
+
}
|
|
220
|
+
static async start(options) {
|
|
221
|
+
if (options.resumeFromRunId) {
|
|
222
|
+
const attempt = await tryWithWorkflowTaskMutation(
|
|
223
|
+
getWorkflowTaskMutationKey(options.config, options.resumeFromRunId),
|
|
224
|
+
() => this.startClaimed(options)
|
|
225
|
+
);
|
|
226
|
+
if (!attempt.acquired) {
|
|
227
|
+
throw new Error(
|
|
228
|
+
`Workflow run ${options.resumeFromRunId} is already being modified.`
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
return attempt.value;
|
|
232
|
+
}
|
|
233
|
+
return this.startClaimed(options);
|
|
234
|
+
}
|
|
235
|
+
static async startClaimed(options) {
|
|
236
|
+
const config = options.config;
|
|
237
|
+
const runInBackground = options.runInBackground === true;
|
|
238
|
+
const budget = WorkflowBudgetImpl.fromEnv();
|
|
239
|
+
const runId = options.resumeFromRunId ?? `wf_${randomBytes(8).toString("hex")}`;
|
|
240
|
+
const registry = config.getWorkflowRunRegistry?.();
|
|
241
|
+
let entry;
|
|
242
|
+
const isCurrentEntry = /* @__PURE__ */ __name(() => registry === void 0 || entry !== void 0 && registry.get(runId) === entry, "isCurrentEntry");
|
|
243
|
+
const createController = /* @__PURE__ */ __name(() => runInBackground ? createAbortController() : createChildAbortController(options.signal), "createController");
|
|
244
|
+
const controller = registry ? registry.reserveStart(runId, createController) : createController();
|
|
245
|
+
const releasePersistenceActivity = markWorkflowRunPersistenceActive(
|
|
246
|
+
config,
|
|
247
|
+
runId
|
|
248
|
+
);
|
|
249
|
+
const assertStartNotCancelled = /* @__PURE__ */ __name(() => {
|
|
250
|
+
if (controller.signal.aborted && !options.signal.aborted) {
|
|
251
|
+
throw new WorkflowStartCancelledError();
|
|
252
|
+
}
|
|
253
|
+
if (runInBackground && options.signal.aborted) {
|
|
254
|
+
throw new WorkflowStartCancelledError();
|
|
255
|
+
}
|
|
256
|
+
}, "assertStartNotCancelled");
|
|
257
|
+
const storage = config.storage;
|
|
258
|
+
const previousEntry = registry?.get(runId);
|
|
259
|
+
let journalPath = storage ? storage.getWorkflowRunJournalPath(runId) : void 0;
|
|
260
|
+
const journal = journalPath ? new WorkflowJournal(journalPath, storage.getWorkflowRunsDir()) : void 0;
|
|
261
|
+
let script;
|
|
262
|
+
let scriptPath;
|
|
263
|
+
let resumeReplay;
|
|
264
|
+
let persistedInlineScript = false;
|
|
265
|
+
let callerWasAbortedBeforeStart;
|
|
266
|
+
let orchestrator;
|
|
267
|
+
let reviewLimits;
|
|
268
|
+
try {
|
|
269
|
+
const loaded = options.scriptPath && options.script === void 0 ? await resolveSavedWorkflowScript(
|
|
270
|
+
{ scriptPath: options.scriptPath },
|
|
271
|
+
config
|
|
272
|
+
) : void 0;
|
|
273
|
+
script = loaded?.script ?? options.script ?? "";
|
|
274
|
+
scriptPath = loaded?.scriptPath ?? options.scriptPath;
|
|
275
|
+
if (loaded && scriptPath && storage) {
|
|
276
|
+
reviewLimits = await resolveReviewWorkflowLimits(
|
|
277
|
+
scriptPath,
|
|
278
|
+
storage.getGeneratedWorkflowsDir(),
|
|
279
|
+
script
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
const workflowName = options.workflowName ?? loaded?.savedWorkflowName ?? registry?.get(runId)?.workflowName;
|
|
283
|
+
try {
|
|
284
|
+
compileWorkflowScript(script);
|
|
285
|
+
} catch (error) {
|
|
286
|
+
throw new WorkflowScriptNotLaunchedError(
|
|
287
|
+
describeWorkflowCompileError(
|
|
288
|
+
error,
|
|
289
|
+
script.split(/\r\n|[\n\r\u2028\u2029]/).length
|
|
290
|
+
)
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
resumeReplay = options.resumeFromRunId ? await journal?.load() : void 0;
|
|
294
|
+
assertStartNotCancelled();
|
|
295
|
+
callerWasAbortedBeforeStart = options.signal.aborted;
|
|
296
|
+
if (options.script !== void 0 && scriptPath === void 0) {
|
|
297
|
+
const persisted = await persistInlineWorkflowScript(
|
|
298
|
+
config,
|
|
299
|
+
runId,
|
|
300
|
+
script
|
|
301
|
+
);
|
|
302
|
+
scriptPath = persisted ?? void 0;
|
|
303
|
+
persistedInlineScript = persisted !== null;
|
|
304
|
+
}
|
|
305
|
+
if (journal && !await journal.ensureExists()) {
|
|
306
|
+
journalPath = void 0;
|
|
307
|
+
}
|
|
308
|
+
assertStartNotCancelled();
|
|
309
|
+
const dispatch = options.dispatch ?? createProductionDispatch(
|
|
310
|
+
config,
|
|
311
|
+
controller.signal,
|
|
312
|
+
(outputTokens) => budget.recordSpent(outputTokens),
|
|
313
|
+
registry ? (emitter2, dispatchId) => isCurrentEntry() ? registry.bridgeApprovalEvents(
|
|
314
|
+
runId,
|
|
315
|
+
emitter2,
|
|
316
|
+
dispatchId,
|
|
317
|
+
entry
|
|
318
|
+
) : () => void 0 : void 0,
|
|
319
|
+
reviewLimits?.subagent
|
|
320
|
+
);
|
|
321
|
+
orchestrator = new WorkflowOrchestrator(dispatch);
|
|
322
|
+
entry = registry?.register(
|
|
323
|
+
{
|
|
324
|
+
runId,
|
|
325
|
+
toolUseId: options.toolUseId,
|
|
326
|
+
...workflowName ? { workflowName } : {},
|
|
327
|
+
meta: null,
|
|
328
|
+
status: "running",
|
|
329
|
+
startTime: Date.now(),
|
|
330
|
+
outputFile: "",
|
|
331
|
+
abortController: controller,
|
|
332
|
+
tokenBudgetTotal: budget.total,
|
|
333
|
+
script,
|
|
334
|
+
scriptPath,
|
|
335
|
+
...journalPath ? { journalPath } : {},
|
|
336
|
+
// A saved workflow is the user's file, and the recovery advice says to
|
|
337
|
+
// copy it first. The name is resolved here — from the resumed run
|
|
338
|
+
// too, which a caller re-running a saved workflow's inline source
|
|
339
|
+
// does not pass — so the hint follows the same decision.
|
|
340
|
+
...options.authoringHint && !workflowName ? { authoringHint: options.authoringHint } : {},
|
|
341
|
+
args: options.args,
|
|
342
|
+
...options.resumeFromRunId ? {
|
|
343
|
+
sourceRunId: options.resumeFromRunId,
|
|
344
|
+
startMode: "retry"
|
|
345
|
+
} : {},
|
|
346
|
+
isBackgrounded: runInBackground,
|
|
347
|
+
resumeInBackground: runInBackground && config.isInteractive?.() === true && config.getExperimentalZedIntegration?.() !== true
|
|
348
|
+
},
|
|
349
|
+
controller
|
|
350
|
+
);
|
|
351
|
+
} catch (error) {
|
|
352
|
+
registry?.releaseStart(runId, controller);
|
|
353
|
+
controller.abort();
|
|
354
|
+
if (persistedInlineScript && options.resumeFromRunId === void 0) {
|
|
355
|
+
await deleteInlineWorkflowScript(config, runId);
|
|
356
|
+
}
|
|
357
|
+
if (persistedInlineScript && options.resumeFromRunId && previousEntry) {
|
|
358
|
+
await persistInlineWorkflowScript(config, runId, previousEntry.script);
|
|
359
|
+
}
|
|
360
|
+
if (options.resumeFromRunId === void 0) {
|
|
361
|
+
await journal?.remove();
|
|
362
|
+
}
|
|
363
|
+
releasePersistenceActivity();
|
|
364
|
+
throw error;
|
|
365
|
+
}
|
|
366
|
+
const emitUpdate = /* @__PURE__ */ __name(() => {
|
|
367
|
+
if (!entry || !options.onUpdate || !isCurrentEntry()) return;
|
|
368
|
+
try {
|
|
369
|
+
options.onUpdate(entry);
|
|
370
|
+
} catch {
|
|
371
|
+
}
|
|
372
|
+
}, "emitUpdate");
|
|
373
|
+
const emitter = {
|
|
374
|
+
phaseStarted: /* @__PURE__ */ __name((title) => {
|
|
375
|
+
if (!isCurrentEntry()) return;
|
|
376
|
+
registry?.onPhaseStarted(runId, title);
|
|
377
|
+
emitUpdate();
|
|
378
|
+
}, "phaseStarted"),
|
|
379
|
+
agentDispatched: /* @__PURE__ */ __name(() => {
|
|
380
|
+
if (!isCurrentEntry()) return;
|
|
381
|
+
registry?.onAgentDispatched(runId);
|
|
382
|
+
emitUpdate();
|
|
383
|
+
}, "agentDispatched"),
|
|
384
|
+
agentCompleted: /* @__PURE__ */ __name(() => {
|
|
385
|
+
if (!isCurrentEntry()) return;
|
|
386
|
+
registry?.onAgentCompleted(runId);
|
|
387
|
+
}, "agentCompleted"),
|
|
388
|
+
dispatchQueued: /* @__PURE__ */ __name((event) => {
|
|
389
|
+
if (!isCurrentEntry()) return;
|
|
390
|
+
registry?.onDispatchQueued(runId, event);
|
|
391
|
+
emitUpdate();
|
|
392
|
+
}, "dispatchQueued"),
|
|
393
|
+
dispatchStarted: /* @__PURE__ */ __name((dispatchId, startedAt) => {
|
|
394
|
+
if (!isCurrentEntry()) return;
|
|
395
|
+
registry?.onDispatchStarted(runId, dispatchId, startedAt);
|
|
396
|
+
emitUpdate();
|
|
397
|
+
}, "dispatchStarted"),
|
|
398
|
+
dispatchSettled: /* @__PURE__ */ __name((dispatchId, error, endedAt) => {
|
|
399
|
+
if (!isCurrentEntry()) return;
|
|
400
|
+
registry?.onDispatchSettled(
|
|
401
|
+
runId,
|
|
402
|
+
dispatchId,
|
|
403
|
+
error,
|
|
404
|
+
endedAt,
|
|
405
|
+
!runInBackground && options.signal.aborted
|
|
406
|
+
);
|
|
407
|
+
emitUpdate();
|
|
408
|
+
}, "dispatchSettled"),
|
|
409
|
+
// The registry records this without firing a status update, avoiding a
|
|
410
|
+
// TUI redraw per line while retaining the real replay timestamp.
|
|
411
|
+
logAppended: /* @__PURE__ */ __name((line) => {
|
|
412
|
+
if (!isCurrentEntry()) return;
|
|
413
|
+
registry?.onLogAppended(runId, line);
|
|
414
|
+
}, "logAppended"),
|
|
415
|
+
budgetUpdated: /* @__PURE__ */ __name((spent, total) => {
|
|
416
|
+
if (!isCurrentEntry()) return;
|
|
417
|
+
registry?.onBudgetUpdated(runId, spent, total);
|
|
418
|
+
emitUpdate();
|
|
419
|
+
}, "budgetUpdated"),
|
|
420
|
+
resumeRespawn: /* @__PURE__ */ __name((line) => {
|
|
421
|
+
if (!isCurrentEntry()) return;
|
|
422
|
+
registry?.onResumeRespawn(runId, line);
|
|
423
|
+
emitUpdate();
|
|
424
|
+
}, "resumeRespawn")
|
|
425
|
+
};
|
|
426
|
+
const scheduler = new WorkflowDispatchScheduler(
|
|
427
|
+
reviewLimits?.concurrency ?? resolveConcurrencyLimit(),
|
|
428
|
+
controller.signal,
|
|
429
|
+
({ state }) => {
|
|
430
|
+
if (!isCurrentEntry()) return;
|
|
431
|
+
registry?.onDispatchStateChange(runId, state);
|
|
432
|
+
}
|
|
433
|
+
);
|
|
434
|
+
const handle = new WorkflowRunHandle(
|
|
435
|
+
runId,
|
|
436
|
+
budget,
|
|
437
|
+
registry,
|
|
438
|
+
controller,
|
|
439
|
+
scheduler,
|
|
440
|
+
async () => {
|
|
441
|
+
try {
|
|
442
|
+
const outcome = await orchestrator.run({
|
|
443
|
+
script,
|
|
444
|
+
args: options.args,
|
|
445
|
+
maxWallClockMs: reviewLimits?.maxWallClockMs,
|
|
446
|
+
abortOnTimeout: controller,
|
|
447
|
+
runId,
|
|
448
|
+
emitter,
|
|
449
|
+
budget,
|
|
450
|
+
resolveSavedWorkflow: /* @__PURE__ */ __name((ref) => resolveSavedWorkflowScript(ref, config), "resolveSavedWorkflow"),
|
|
451
|
+
journal,
|
|
452
|
+
resumeReplay,
|
|
453
|
+
scheduler
|
|
454
|
+
});
|
|
455
|
+
if (entry) {
|
|
456
|
+
entry.meta = outcome.meta;
|
|
457
|
+
if (outcome.meta?.name && entry.description === runId) {
|
|
458
|
+
entry.description = outcome.meta.name;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
registry?.setRecentLogs(runId, outcome.logs);
|
|
462
|
+
if (entry && isTerminalWorkflowStatus(entry.status)) {
|
|
463
|
+
return {
|
|
464
|
+
ok: false,
|
|
465
|
+
message: entry.status === "cancelled" ? "Workflow run cancelled." : entry.error ?? "Workflow run failed."
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
registry?.complete(runId, outcome.result, Date.now());
|
|
469
|
+
return { ok: true, outcome };
|
|
470
|
+
} catch (error) {
|
|
471
|
+
const details = error instanceof WorkflowExecutionError ? error : void 0;
|
|
472
|
+
const message = extractErrorMessage(error);
|
|
473
|
+
if (entry && details?.meta && !entry.meta) entry.meta = details.meta;
|
|
474
|
+
if (details?.logs) registry?.setRecentLogs(runId, details.logs);
|
|
475
|
+
if (entry && isTerminalWorkflowStatus(entry.status)) {
|
|
476
|
+
return {
|
|
477
|
+
ok: false,
|
|
478
|
+
message: entry.status === "cancelled" ? "Workflow run cancelled." : entry.error ?? message,
|
|
479
|
+
details
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
if (callerWasAbortedBeforeStart || !runInBackground && options.signal.aborted) {
|
|
483
|
+
registry?.cancel(runId, Date.now());
|
|
484
|
+
} else {
|
|
485
|
+
registry?.fail(runId, message, Date.now());
|
|
486
|
+
}
|
|
487
|
+
return { ok: false, message, details };
|
|
488
|
+
} finally {
|
|
489
|
+
controller.abort();
|
|
490
|
+
if (entry && isTerminalWorkflowStatus(entry.status)) {
|
|
491
|
+
const telemetryEvent = new WorkflowRunEvent({
|
|
492
|
+
status: entry.status,
|
|
493
|
+
agents_dispatched: entry.agentsDispatched,
|
|
494
|
+
agents_completed: entry.agentsCompleted,
|
|
495
|
+
// Read off the dispatch traces rather than the counters: a
|
|
496
|
+
// dispatch that failed or replayed from cache still counts as
|
|
497
|
+
// completed, so without these three a run that lost half its
|
|
498
|
+
// fan-out and one that lost none report identically.
|
|
499
|
+
agents_failed: entry.dispatches.reduce(
|
|
500
|
+
(n, dispatch) => dispatch.status === "failed" ? n + 1 : n,
|
|
501
|
+
0
|
|
502
|
+
),
|
|
503
|
+
agents_cached: entry.dispatches.reduce(
|
|
504
|
+
(n, dispatch) => dispatch.status === "cached" ? n + 1 : n,
|
|
505
|
+
0
|
|
506
|
+
),
|
|
507
|
+
agents_respawned: entry.agentsRespawned ?? 0,
|
|
508
|
+
phase_count: entry.phases.length,
|
|
509
|
+
tokens_spent: entry.tokensSpent,
|
|
510
|
+
duration_ms: (entry.endTime ?? entry.startTime) - entry.startTime
|
|
511
|
+
});
|
|
512
|
+
const snapshotPersisted = await writeWorkflowSnapshot(
|
|
513
|
+
config,
|
|
514
|
+
entry
|
|
515
|
+
);
|
|
516
|
+
if (snapshotPersisted) {
|
|
517
|
+
registry?.notifySnapshotPersisted(entry.runId);
|
|
518
|
+
}
|
|
519
|
+
await journal?.drain();
|
|
520
|
+
try {
|
|
521
|
+
logWorkflowRun(config, telemetryEvent);
|
|
522
|
+
} catch {
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
releasePersistenceActivity();
|
|
526
|
+
registry?.releaseHandle(runId, handle);
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
...scriptPath ? { scriptPath } : {},
|
|
531
|
+
...journalPath ? { journalPath } : {}
|
|
532
|
+
}
|
|
533
|
+
);
|
|
534
|
+
registry?.attachHandle(handle);
|
|
535
|
+
return handle;
|
|
536
|
+
}
|
|
537
|
+
};
|
|
538
|
+
function extractErrorMessage(error) {
|
|
539
|
+
if (error && typeof error === "object" && "message" in error) {
|
|
540
|
+
const message = error.message;
|
|
541
|
+
if (typeof message === "string") return message;
|
|
542
|
+
return String(message);
|
|
543
|
+
}
|
|
544
|
+
return String(error);
|
|
545
|
+
}
|
|
546
|
+
__name(extractErrorMessage, "extractErrorMessage");
|
|
547
|
+
|
|
548
|
+
// packages/core/src/tools/workflow/workflow.ts
|
|
549
|
+
import { promises as fs } from "node:fs";
|
|
550
|
+
import * as path from "node:path";
|
|
551
|
+
var WORKFLOW_PARAM_SCHEMA = {
|
|
552
|
+
type: "object",
|
|
553
|
+
properties: {
|
|
554
|
+
script: {
|
|
555
|
+
type: "string",
|
|
556
|
+
description: "JavaScript source of the workflow, wrapped as an async IIFE: top-level `await` and `return` are both legal, and a trailing expression is NOT a return value. Uses the injected globals `phase()`, `log()`, `agent()`, `parallel()`, `pipeline()`, `workflow()`, `args` and `budget`, and cannot import anything. May start with a literal `export const meta = {...}` (stripped before execution). `Math.random()` and all of `Date` (`new Date()`, `Date.now()` included) throw \u2014 a script must be deterministic for resume, so pass timestamps in via `args` or stamp the result after the run returns. Pass THUNKS to parallel(), not eager calls: `parallel([() => agent(...)])`, not `parallel([agent(...)])`."
|
|
557
|
+
},
|
|
558
|
+
scriptPath: {
|
|
559
|
+
type: "string",
|
|
560
|
+
description: "Optional. Absolute path to a workflow `.js` file to load and run instead of inline `script`. Primarily set by the `/<name>` saved-workflow slash command; a tool that generated a script for this run hands you its path the same way. The file must resolve inside a saved-workflow directory (`.qwen/workflows`, `~/.qwen/workflows`) or the generated-scripts root (`$QWEN_CODE_PROJECT_DIR/workflows/generated` \u2014 the per-project runtime dir, not the project tree) \u2014 any other path is refused. Provide exactly ONE of `script` or `scriptPath`. The file is read at execution time, so edits to a saved workflow take effect on the next run. An inline `script` is persisted to `<generated root>/inline/<runId>.js` and that path comes back in the result, so a resume passes the path instead of the source."
|
|
561
|
+
},
|
|
562
|
+
args: {
|
|
563
|
+
description: "Optional structured value bound to the `args` global. Pass actual JSON, not a stringified value."
|
|
564
|
+
},
|
|
565
|
+
resumeFromRunId: {
|
|
566
|
+
type: "string",
|
|
567
|
+
description: "Optional. Resume a prior workflow run by id (e.g. wf_abc123\u2026). Re-runs the supplied script or returned script path; 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 `scriptPath` the original run returned and the same `args`. Editing a saved workflow changes future runs too, so copy it for run-specific edits. Replay requires a journal; without one, every agent() call runs live. The journal keys hash each agent() call's prompt and opts, not the script text, so post-processing can change without losing the cache."
|
|
568
|
+
},
|
|
569
|
+
run_in_background: {
|
|
570
|
+
type: "boolean",
|
|
571
|
+
default: false,
|
|
572
|
+
description: "Optional. When true, start the workflow under the interactive session and return a run handle immediately. The Background Tasks view can observe, cooperatively pause/resume, or stop it, and completion is delivered to the conversation when the run settles. Interactive TUI only. Defaults to false."
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
// `script` is required UNLESS `scriptPath` is supplied; this XOR can't be
|
|
576
|
+
// expressed as a plain `required` list, so it's enforced in
|
|
577
|
+
// `validateToolParamValues`. Inline authoring (the LLM path) should always
|
|
578
|
+
// pass `script`; the `scriptPath` property description states the XOR.
|
|
579
|
+
};
|
|
580
|
+
var WorkflowToolInvocation = class extends BaseToolInvocation {
|
|
581
|
+
constructor(config, toolOptions, params, authoringHint, workflowName) {
|
|
582
|
+
super(params);
|
|
583
|
+
this.config = config;
|
|
584
|
+
this.toolOptions = toolOptions;
|
|
585
|
+
this.authoringHint = authoringHint;
|
|
586
|
+
this.workflowName = workflowName;
|
|
587
|
+
}
|
|
588
|
+
static {
|
|
589
|
+
__name(this, "WorkflowToolInvocation");
|
|
590
|
+
}
|
|
591
|
+
callId;
|
|
592
|
+
/**
|
|
593
|
+
* The failure hint, when the failing script is one this call authored.
|
|
594
|
+
*
|
|
595
|
+
* A saved workflow is the user's file, and the resume advice already tells
|
|
596
|
+
* the model to copy it before making a run-specific change — "fix the script,
|
|
597
|
+
* and retry" would contradict that in the same message.
|
|
598
|
+
*/
|
|
599
|
+
authoredScriptHint() {
|
|
600
|
+
if (!this.authoringHint) return null;
|
|
601
|
+
return isScriptAuthoredByThisCall(
|
|
602
|
+
this.config,
|
|
603
|
+
this.workflowName,
|
|
604
|
+
this.params.scriptPath
|
|
605
|
+
) ? this.authoringHint : null;
|
|
606
|
+
}
|
|
607
|
+
setCallId(callId) {
|
|
608
|
+
this.callId = callId;
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Cache so the transcript header and the approval dialog cannot disagree,
|
|
612
|
+
* and so an oversized script is scanned once per invocation rather than
|
|
613
|
+
* once per surface that asks.
|
|
614
|
+
*/
|
|
615
|
+
metaCache;
|
|
616
|
+
resolveMeta() {
|
|
617
|
+
if (this.metaCache === void 0) {
|
|
618
|
+
this.metaCache = this.params.script ? readMetaForConfirmation(this.params.script) : null;
|
|
619
|
+
}
|
|
620
|
+
return this.metaCache;
|
|
621
|
+
}
|
|
622
|
+
getDescription() {
|
|
623
|
+
const meta = this.resolveMeta();
|
|
624
|
+
if (meta) {
|
|
625
|
+
return `Run workflow: ${sanitizeLine(meta.name)}`;
|
|
626
|
+
}
|
|
627
|
+
if (this.params.scriptPath && this.params.script === void 0) {
|
|
628
|
+
const kind = isGeneratedWorkflowScriptPath(
|
|
629
|
+
this.config,
|
|
630
|
+
this.params.scriptPath
|
|
631
|
+
) ? "generated workflow script" : "saved workflow";
|
|
632
|
+
return `Run ${kind} (${path.basename(this.params.scriptPath)})`;
|
|
633
|
+
}
|
|
634
|
+
return `Run a workflow script (${this.params.script?.length ?? 0} chars)`;
|
|
635
|
+
}
|
|
636
|
+
toolLocations() {
|
|
637
|
+
return [];
|
|
638
|
+
}
|
|
639
|
+
getDefaultPermission() {
|
|
640
|
+
return Promise.resolve("ask");
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* Show what is about to run, and scope the grant that approves it.
|
|
644
|
+
*
|
|
645
|
+
* Without this override the base class renders `Confirm WorkflowTool` over
|
|
646
|
+
* `Run a workflow script (4127 chars)` — a character count standing in for
|
|
647
|
+
* arbitrary model-authored JavaScript that may fan out to
|
|
648
|
+
* `DEFAULT_MAX_AGENTS_PER_RUN` subagents, provision git worktrees and spend
|
|
649
|
+
* an uncapped token budget. The asymmetry is visible within one run: the
|
|
650
|
+
* subagent approvals this workflow bubbles up each get a full dialog.
|
|
651
|
+
*
|
|
652
|
+
* Two properties of the grant matter as much as the disclosure:
|
|
653
|
+
*
|
|
654
|
+
* - An inline `script` can never be pre-approved. It is fresh
|
|
655
|
+
* model-authored source every time, so a blanket "always allow" would
|
|
656
|
+
* transfer consent from the script the user read to every script the
|
|
657
|
+
* model writes afterwards. `hideAlwaysAllow` removes the option and the
|
|
658
|
+
* empty `permissionRules` stops `injectPermissionRulesIfMissing` from
|
|
659
|
+
* supplying the bare-tool-name rule, which `buildPermissionRules`
|
|
660
|
+
* documents as matching *all* invocations.
|
|
661
|
+
* - A `scriptPath` names a file on disk that the user chose, so it can be
|
|
662
|
+
* pre-approved — but scoped to that path. The rule is built with the
|
|
663
|
+
* same helpers the matcher uses so a tool rename moves both sides.
|
|
664
|
+
*/
|
|
665
|
+
async getConfirmationDetails(_abortSignal) {
|
|
666
|
+
const meta = this.resolveMeta();
|
|
667
|
+
const isGeneratedScriptPath = this.params.scriptPath !== void 0 && await isGeneratedWorkflowScriptPathCanonical(
|
|
668
|
+
this.config,
|
|
669
|
+
this.params.scriptPath
|
|
670
|
+
);
|
|
671
|
+
const isGeneratedInlineScriptPath = this.params.scriptPath !== void 0 && await isWorkflowScriptPathWithinCanonicalRoot(
|
|
672
|
+
this.params.scriptPath,
|
|
673
|
+
path.dirname(this.config.storage.getInlineWorkflowScriptPath("wf_0"))
|
|
674
|
+
);
|
|
675
|
+
const body = buildConfirmationPrompt(
|
|
676
|
+
this.params,
|
|
677
|
+
meta,
|
|
678
|
+
isGeneratedScriptPath
|
|
679
|
+
);
|
|
680
|
+
const banner = resolveUsageBanner(
|
|
681
|
+
this.config,
|
|
682
|
+
this.config.getWorkflowRunRegistry?.(),
|
|
683
|
+
resolveMaxTokensPerWorkflow()
|
|
684
|
+
);
|
|
685
|
+
const isInlineScript = this.params.script !== void 0 || isGeneratedInlineScriptPath;
|
|
686
|
+
const details = {
|
|
687
|
+
type: "info",
|
|
688
|
+
title: "Run a dynamic workflow?",
|
|
689
|
+
prompt: banner ? `${banner}${body}` : body,
|
|
690
|
+
// The body is a script excerpt and a phase list: rendering it as
|
|
691
|
+
// Markdown would swallow the very characters the reader needs to see.
|
|
692
|
+
renderPromptAsPlainText: true,
|
|
693
|
+
hideAlwaysAllow: isInlineScript,
|
|
694
|
+
permissionRules: isInlineScript ? [] : [
|
|
695
|
+
`${getRuleDisplayName(resolveToolName(ToolNames.WORKFLOW))}(scriptPath:${this.params.scriptPath})`
|
|
696
|
+
],
|
|
697
|
+
onConfirm: /* @__PURE__ */ __name(async (_outcome, _payload) => {
|
|
698
|
+
}, "onConfirm")
|
|
699
|
+
};
|
|
700
|
+
return details;
|
|
701
|
+
}
|
|
702
|
+
async execute(signal, updateOutput, _shellExecutionConfig) {
|
|
703
|
+
const runInBackground = this.params.run_in_background === true;
|
|
704
|
+
if (runInBackground && signal.aborted) {
|
|
705
|
+
return startCancelledResult();
|
|
706
|
+
}
|
|
707
|
+
let handle;
|
|
708
|
+
try {
|
|
709
|
+
handle = await WorkflowRunner.start({
|
|
710
|
+
config: this.config,
|
|
711
|
+
signal,
|
|
712
|
+
toolUseId: this.callId,
|
|
713
|
+
...this.workflowName ? { workflowName: this.workflowName } : {},
|
|
714
|
+
...authoringHintOption(this.authoredScriptHint()),
|
|
715
|
+
script: this.params.script,
|
|
716
|
+
scriptPath: this.params.scriptPath,
|
|
717
|
+
args: this.params.args,
|
|
718
|
+
resumeFromRunId: this.params.resumeFromRunId,
|
|
719
|
+
dispatch: this.toolOptions.dispatch,
|
|
720
|
+
runInBackground,
|
|
721
|
+
onUpdate: !runInBackground && updateOutput ? (entry) => safeEmitUpdate(updateOutput, entry) : void 0
|
|
722
|
+
});
|
|
723
|
+
} catch (error) {
|
|
724
|
+
if (error instanceof WorkflowStartCancelledError || runInBackground && signal.aborted) {
|
|
725
|
+
return startCancelledResult();
|
|
726
|
+
}
|
|
727
|
+
if (error instanceof WorkflowScriptNotLaunchedError) {
|
|
728
|
+
const hint = this.authoredScriptHint();
|
|
729
|
+
const text = hint ? `${error.message}
|
|
730
|
+
${hint}` : error.message;
|
|
731
|
+
return {
|
|
732
|
+
llmContent: [{ text }],
|
|
733
|
+
returnDisplay: error.message,
|
|
734
|
+
error: {
|
|
735
|
+
message: text,
|
|
736
|
+
type: "invalid_tool_params" /* INVALID_TOOL_PARAMS */
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
throw error;
|
|
741
|
+
}
|
|
742
|
+
if (runInBackground) {
|
|
743
|
+
const status = handle.registry?.get(handle.runId)?.status ?? "running";
|
|
744
|
+
const usageBanner = resolveUsageBanner(
|
|
745
|
+
this.config,
|
|
746
|
+
handle.registry,
|
|
747
|
+
handle.budget.total
|
|
748
|
+
);
|
|
749
|
+
return {
|
|
750
|
+
workflowRunId: handle.runId,
|
|
751
|
+
...handle.scriptPath ? { scriptPath: handle.scriptPath } : {},
|
|
752
|
+
...handle.journalPath ? { journalPath: handle.journalPath } : {},
|
|
753
|
+
llmContent: [
|
|
754
|
+
{
|
|
755
|
+
text: buildBackgroundStartText(handle, status)
|
|
756
|
+
}
|
|
757
|
+
],
|
|
758
|
+
returnDisplay: usageBanner + `Workflow ${handle.runId} started in the background (status: ${status}). Use Background Tasks to observe, cooperatively pause/resume, or stop it.`
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
const settlement = await handle.completion;
|
|
762
|
+
if (settlement.ok) {
|
|
763
|
+
const { outcome } = settlement;
|
|
764
|
+
const usageBanner = resolveUsageBanner(
|
|
765
|
+
this.config,
|
|
766
|
+
handle.registry,
|
|
767
|
+
handle.budget.total
|
|
768
|
+
);
|
|
769
|
+
const llmText = safeStringifyResult(outcome.result);
|
|
770
|
+
const displayJson = safeStringifyDisplayPayload({
|
|
771
|
+
runId: outcome.runId,
|
|
772
|
+
...outcome.meta ? { meta: outcome.meta } : {},
|
|
773
|
+
phases: outcome.phases,
|
|
774
|
+
logs: outcome.logs,
|
|
775
|
+
result: outcome.result,
|
|
776
|
+
// P5: surface the per-run token total in the terminal display so
|
|
777
|
+
// the user sees actual usage even without opening the dialog.
|
|
778
|
+
// P5 R1 (#11): align with `buildLivePhaseTreeDisplay` — include
|
|
779
|
+
// tokens whenever ANY usage is reported OR a cap is set, not
|
|
780
|
+
// only when spend > 0. A capped-but-zero-spend run still wants
|
|
781
|
+
// the cap visible so the user sees the gate engaged.
|
|
782
|
+
...handle.budget.spent() > 0 || handle.budget.total !== null ? {
|
|
783
|
+
tokens: {
|
|
784
|
+
spent: handle.budget.spent(),
|
|
785
|
+
total: handle.budget.total
|
|
786
|
+
}
|
|
787
|
+
} : {}
|
|
788
|
+
});
|
|
789
|
+
return {
|
|
790
|
+
...handle.scriptPath ? { scriptPath: handle.scriptPath } : {},
|
|
791
|
+
...handle.journalPath ? { journalPath: handle.journalPath } : {},
|
|
792
|
+
// Two parts: the script's return value is left exactly as it was,
|
|
793
|
+
// and the run handle follows as a separate part. Note what this does
|
|
794
|
+
// NOT mean — `convertToFunctionResponse` joins the text parts with a
|
|
795
|
+
// newline, so the model reads `<return value>\n--- workflow run ---…`
|
|
796
|
+
// as one string. Keeping them apart is still what makes the return
|
|
797
|
+
// value untouched at the tool boundary, keeps `returnDisplay` clean,
|
|
798
|
+
// and gives the per-tool head/tail truncator a distinct trailer part.
|
|
799
|
+
// The scheduler-wide persistence gate may still fold both parts into
|
|
800
|
+
// one head-only preview when their combined text crosses its limit.
|
|
801
|
+
llmContent: [
|
|
802
|
+
{ text: llmText },
|
|
803
|
+
{ text: buildRunTrailer(this.config, handle, this.params.args) }
|
|
804
|
+
],
|
|
805
|
+
returnDisplay: usageBanner + "```json\n" + displayJson + "\n```"
|
|
806
|
+
};
|
|
807
|
+
} else {
|
|
808
|
+
const { message, details } = settlement;
|
|
809
|
+
const { phases, logs, meta } = details ?? {};
|
|
810
|
+
const cancelled = handle.registry?.get(handle.runId)?.status === "cancelled";
|
|
811
|
+
const failureText = cancelled ? "Workflow cancelled." : `Workflow failed: ${clampForDisplay(
|
|
812
|
+
sanitizeBlock(message),
|
|
813
|
+
TRAILER_ERROR_CHARS
|
|
814
|
+
)}`;
|
|
815
|
+
const trailer = buildRunTrailer(
|
|
816
|
+
this.config,
|
|
817
|
+
handle,
|
|
818
|
+
this.params.args,
|
|
819
|
+
logs,
|
|
820
|
+
!cancelled,
|
|
821
|
+
cancelled ? null : this.authoredScriptHint()
|
|
822
|
+
);
|
|
823
|
+
const display = `${cancelled ? "Workflow cancelled." : `Workflow failed: ${message}`}
|
|
824
|
+
|
|
825
|
+
${safeStringifyDisplayPayload(
|
|
826
|
+
{
|
|
827
|
+
runId: handle.runId,
|
|
828
|
+
...meta ? { meta } : {},
|
|
829
|
+
phases: phases ?? [],
|
|
830
|
+
logs: logs ?? []
|
|
831
|
+
}
|
|
832
|
+
)}`;
|
|
833
|
+
return {
|
|
834
|
+
...handle.scriptPath ? { scriptPath: handle.scriptPath } : {},
|
|
835
|
+
...handle.journalPath ? { journalPath: handle.journalPath } : {},
|
|
836
|
+
// The failure message alone names what threw but not where to look:
|
|
837
|
+
// the logs the runtime already mirrored (`dispatch failed (result not
|
|
838
|
+
// consumed)` and friends) only reached `returnDisplay`, which the
|
|
839
|
+
// scheduler overwrites with `error.message` — so the model never saw
|
|
840
|
+
// them. Mirror the two content parts into the error message because
|
|
841
|
+
// that is the only text the non-timeout scheduler branch delivers.
|
|
842
|
+
llmContent: [{ text: failureText }, { text: trailer }],
|
|
843
|
+
returnDisplay: display,
|
|
844
|
+
// FIX-10 (REUSE-I1): use the standard ToolErrorType.EXECUTION_FAILED
|
|
845
|
+
// code so error routing / dashboards can classify workflow failures
|
|
846
|
+
// the same way as other execution-time tool errors.
|
|
847
|
+
error: {
|
|
848
|
+
message: `${failureText}
|
|
849
|
+
${trailer}`,
|
|
850
|
+
type: "execution_failed" /* EXECUTION_FAILED */
|
|
851
|
+
}
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
};
|
|
856
|
+
var TRAILER_LOG_LINES = 20;
|
|
857
|
+
var TRAILER_LOG_LINE_CHARS = 400;
|
|
858
|
+
var TRAILER_ERROR_CHARS = 4e3;
|
|
859
|
+
function buildRunTrailer(config, handle, args, logs, includeResume = true, authoringHint = null) {
|
|
860
|
+
const lines = [
|
|
861
|
+
"--- workflow run ---",
|
|
862
|
+
`runId: ${sanitizeLine(handle.runId)}`
|
|
863
|
+
];
|
|
864
|
+
if (handle.scriptPath) {
|
|
865
|
+
lines.push(`script: ${sanitizeLine(handle.scriptPath)}`);
|
|
866
|
+
}
|
|
867
|
+
if (handle.journalPath) {
|
|
868
|
+
lines.push(`journal: ${sanitizeLine(handle.journalPath)}`);
|
|
869
|
+
}
|
|
870
|
+
const entry = handle.registry?.get(handle.runId);
|
|
871
|
+
let failedCount = 0;
|
|
872
|
+
if (entry) {
|
|
873
|
+
const countByStatus = /* @__PURE__ */ __name((status) => entry.dispatches.reduce(
|
|
874
|
+
(n, dispatch) => dispatch.status === status ? n + 1 : n,
|
|
875
|
+
0
|
|
876
|
+
), "countByStatus");
|
|
877
|
+
const respawned = entry.agentsRespawned ?? 0;
|
|
878
|
+
failedCount = countByStatus("failed");
|
|
879
|
+
lines.push(
|
|
880
|
+
`agents: ${entry.dispatches.length} dispatched` + (respawned > 0 ? ` (${respawned} re-ran from a prior run)` : "") + ` \xB7 ${countByStatus("completed")} completed \xB7 ${countByStatus("cached")} cached \xB7 ${failedCount} failed \xB7 ${countByStatus("cancelled")} cancelled`
|
|
881
|
+
);
|
|
882
|
+
}
|
|
883
|
+
const spent = handle.budget.spent();
|
|
884
|
+
lines.push(
|
|
885
|
+
handle.budget.total === null ? `tokens: ${spent} spent (no cap)` : `tokens: ${spent} / ${handle.budget.total} spent`
|
|
886
|
+
);
|
|
887
|
+
const failures = entry ? buildFailureLines(entry) : [];
|
|
888
|
+
if (failures.length > 0 && entry) {
|
|
889
|
+
lines.push(
|
|
890
|
+
`failures (${failedCount}):`,
|
|
891
|
+
...failures.map(
|
|
892
|
+
(line) => clampForDisplay(sanitizeLine(line), TRAILER_LOG_LINE_CHARS)
|
|
893
|
+
)
|
|
894
|
+
);
|
|
895
|
+
}
|
|
896
|
+
const resume = buildResumeCall({
|
|
897
|
+
runId: handle.runId,
|
|
898
|
+
scriptPath: handle.scriptPath,
|
|
899
|
+
args
|
|
900
|
+
});
|
|
901
|
+
if (resume && includeResume) {
|
|
902
|
+
const pathAdvice = entry?.workflowName || !isGeneratedWorkflowScriptPath(config, handle.scriptPath) ? "this reads the saved workflow; copy it before making a run-specific change" : "edit that generated copy first if the script needs to change";
|
|
903
|
+
const journalAdvice = handle.journalPath ? "the journal replays the longest unchanged prefix of agent() calls, and the first changed call onward runs live" : "no journal was written for this run, so every agent() call runs live";
|
|
904
|
+
lines.push(`resume: ${resume} \u2014 ${pathAdvice}; ${journalAdvice}.`);
|
|
905
|
+
if (hasUninlinableResumeArgs({ runId: handle.runId, args })) {
|
|
906
|
+
lines.push(RESUME_ARGS_TOO_LARGE_NOTE);
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
if (authoringHint && !entry?.workflowName) lines.push(authoringHint);
|
|
910
|
+
const tail = (logs ?? []).slice(-TRAILER_LOG_LINES);
|
|
911
|
+
if (tail.length > 0) {
|
|
912
|
+
lines.push(
|
|
913
|
+
`logs (last ${tail.length}):`,
|
|
914
|
+
...tail.map(
|
|
915
|
+
(line) => clampForDisplay(sanitizeLine(line), TRAILER_LOG_LINE_CHARS)
|
|
916
|
+
)
|
|
917
|
+
);
|
|
918
|
+
}
|
|
919
|
+
return lines.join("\n");
|
|
920
|
+
}
|
|
921
|
+
__name(buildRunTrailer, "buildRunTrailer");
|
|
922
|
+
function buildBackgroundStartText(handle, status) {
|
|
923
|
+
const lines = [
|
|
924
|
+
"Workflow started in background.",
|
|
925
|
+
`Run ID: ${sanitizeLine(handle.runId)}`,
|
|
926
|
+
`Status: ${sanitizeLine(status)}`
|
|
927
|
+
];
|
|
928
|
+
if (handle.scriptPath) {
|
|
929
|
+
lines.push(`Script file: ${sanitizeLine(handle.scriptPath)}`);
|
|
930
|
+
}
|
|
931
|
+
if (handle.journalPath) {
|
|
932
|
+
lines.push(`Journal: ${sanitizeLine(handle.journalPath)}`);
|
|
933
|
+
}
|
|
934
|
+
lines.push(
|
|
935
|
+
`You will be notified when it settles. Use /workflows ${sanitizeLine(handle.runId)} for the live phase tree.`
|
|
936
|
+
);
|
|
937
|
+
return lines.join("\n");
|
|
938
|
+
}
|
|
939
|
+
__name(buildBackgroundStartText, "buildBackgroundStartText");
|
|
940
|
+
function startCancelledResult() {
|
|
941
|
+
return {
|
|
942
|
+
llmContent: "Workflow was cancelled before it could start.",
|
|
943
|
+
returnDisplay: "Workflow cancelled."
|
|
944
|
+
};
|
|
945
|
+
}
|
|
946
|
+
__name(startCancelledResult, "startCancelledResult");
|
|
947
|
+
function buildLivePhaseTreeDisplay(entry) {
|
|
948
|
+
const payload = {
|
|
949
|
+
runId: entry.runId,
|
|
950
|
+
...entry.meta ? { meta: entry.meta } : {},
|
|
951
|
+
status: entry.status,
|
|
952
|
+
currentPhase: entry.currentPhase,
|
|
953
|
+
phases: entry.phases,
|
|
954
|
+
agentsDispatched: entry.agentsDispatched,
|
|
955
|
+
agentsCompleted: entry.agentsCompleted
|
|
956
|
+
};
|
|
957
|
+
if (entry.tokensSpent > 0 || entry.tokenBudgetTotal !== null) {
|
|
958
|
+
payload["tokens"] = {
|
|
959
|
+
spent: entry.tokensSpent,
|
|
960
|
+
total: entry.tokenBudgetTotal
|
|
961
|
+
};
|
|
962
|
+
}
|
|
963
|
+
try {
|
|
964
|
+
return "```json\n" + JSON.stringify(payload, null, 2) + "\n```";
|
|
965
|
+
} catch {
|
|
966
|
+
return `Workflow ${entry.runId} \u2014 ${entry.status} \u2014 ${entry.phases.length} phase(s)`;
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
__name(buildLivePhaseTreeDisplay, "buildLivePhaseTreeDisplay");
|
|
970
|
+
function resolveUsageBanner(config, registry, budgetTotal) {
|
|
971
|
+
if (!registry) return "";
|
|
972
|
+
if (config.getSkipWorkflowUsageWarning?.()) return "";
|
|
973
|
+
if (!registry.shouldShowUsageWarning()) return "";
|
|
974
|
+
return buildUsageBanner(budgetTotal);
|
|
975
|
+
}
|
|
976
|
+
__name(resolveUsageBanner, "resolveUsageBanner");
|
|
977
|
+
var CONFIRM_SCRIPT_EXCERPT_CHARS = 1200;
|
|
978
|
+
var CONFIRM_ARGS_CHARS = 300;
|
|
979
|
+
var CONFIRM_MAX_PHASES = 12;
|
|
980
|
+
function sanitizeLine(text) {
|
|
981
|
+
return stripAnsiAndControl(text);
|
|
982
|
+
}
|
|
983
|
+
__name(sanitizeLine, "sanitizeLine");
|
|
984
|
+
function sanitizeBlock(text) {
|
|
985
|
+
return text.replace(/\t/g, " ").split("\n").map((line) => stripAnsiAndControl(line)).join("\n");
|
|
986
|
+
}
|
|
987
|
+
__name(sanitizeBlock, "sanitizeBlock");
|
|
988
|
+
function clampForDisplay(text, max) {
|
|
989
|
+
if (text.length <= max) return text;
|
|
990
|
+
return `${text.slice(0, max)}
|
|
991
|
+
\u2026 (${text.length - max} more characters)`;
|
|
992
|
+
}
|
|
993
|
+
__name(clampForDisplay, "clampForDisplay");
|
|
994
|
+
function readMetaForConfirmation(script) {
|
|
995
|
+
try {
|
|
996
|
+
return extractAndStripMeta(script).meta;
|
|
997
|
+
} catch {
|
|
998
|
+
return null;
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
__name(readMetaForConfirmation, "readMetaForConfirmation");
|
|
1002
|
+
function isGeneratedWorkflowScriptPath(config, scriptPath) {
|
|
1003
|
+
return isWithinRoot(scriptPath, config.storage.getGeneratedWorkflowsDir());
|
|
1004
|
+
}
|
|
1005
|
+
__name(isGeneratedWorkflowScriptPath, "isGeneratedWorkflowScriptPath");
|
|
1006
|
+
async function isGeneratedWorkflowScriptPathCanonical(config, scriptPath) {
|
|
1007
|
+
return isWorkflowScriptPathWithinCanonicalRoot(
|
|
1008
|
+
scriptPath,
|
|
1009
|
+
config.storage.getGeneratedWorkflowsDir()
|
|
1010
|
+
);
|
|
1011
|
+
}
|
|
1012
|
+
__name(isGeneratedWorkflowScriptPathCanonical, "isGeneratedWorkflowScriptPathCanonical");
|
|
1013
|
+
async function isWorkflowScriptPathWithinCanonicalRoot(scriptPath, root) {
|
|
1014
|
+
if (await isSymlinkedRoot(root)) return false;
|
|
1015
|
+
let realScriptPath;
|
|
1016
|
+
try {
|
|
1017
|
+
realScriptPath = await fs.realpath(scriptPath);
|
|
1018
|
+
} catch {
|
|
1019
|
+
return isWithinRoot(scriptPath, root);
|
|
1020
|
+
}
|
|
1021
|
+
let realRoot;
|
|
1022
|
+
try {
|
|
1023
|
+
realRoot = await fs.realpath(root);
|
|
1024
|
+
} catch {
|
|
1025
|
+
realRoot = path.resolve(root);
|
|
1026
|
+
}
|
|
1027
|
+
return isWithinRoot(realScriptPath, realRoot);
|
|
1028
|
+
}
|
|
1029
|
+
__name(isWorkflowScriptPathWithinCanonicalRoot, "isWorkflowScriptPathWithinCanonicalRoot");
|
|
1030
|
+
function buildConfirmationPrompt(params, meta, isGeneratedScriptPath) {
|
|
1031
|
+
const lines = [];
|
|
1032
|
+
if (meta) {
|
|
1033
|
+
lines.push(`Workflow: ${sanitizeLine(meta.name)}`);
|
|
1034
|
+
lines.push(sanitizeLine(meta.description));
|
|
1035
|
+
} else if (params.scriptPath) {
|
|
1036
|
+
const label = isGeneratedScriptPath ? "Generated workflow script" : "Saved workflow";
|
|
1037
|
+
lines.push(`${label}: ${sanitizeLine(params.scriptPath)}`);
|
|
1038
|
+
} else {
|
|
1039
|
+
lines.push("Workflow: (the script declares no meta block)");
|
|
1040
|
+
}
|
|
1041
|
+
if (meta?.phases?.length) {
|
|
1042
|
+
const shown = meta.phases.slice(0, CONFIRM_MAX_PHASES);
|
|
1043
|
+
lines.push("", `Phases (${meta.phases.length}):`);
|
|
1044
|
+
shown.forEach((phase, i) => {
|
|
1045
|
+
const detail = phase.detail ? ` \u2014 ${sanitizeLine(phase.detail)}` : "";
|
|
1046
|
+
lines.push(` ${i + 1}. ${sanitizeLine(phase.title)}${detail}`);
|
|
1047
|
+
});
|
|
1048
|
+
if (meta.phases.length > shown.length) {
|
|
1049
|
+
lines.push(` \u2026 and ${meta.phases.length - shown.length} more`);
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
if (params.scriptPath && meta) {
|
|
1053
|
+
lines.push("", `Loaded from: ${sanitizeLine(params.scriptPath)}`);
|
|
1054
|
+
}
|
|
1055
|
+
if (params.resumeFromRunId) {
|
|
1056
|
+
lines.push("", `Resuming run: ${sanitizeLine(params.resumeFromRunId)}`);
|
|
1057
|
+
}
|
|
1058
|
+
if (params.args !== void 0) {
|
|
1059
|
+
let rendered;
|
|
1060
|
+
try {
|
|
1061
|
+
rendered = JSON.stringify(params.args) ?? String(params.args);
|
|
1062
|
+
} catch {
|
|
1063
|
+
rendered = "(args are not JSON-serializable)";
|
|
1064
|
+
}
|
|
1065
|
+
lines.push(
|
|
1066
|
+
"",
|
|
1067
|
+
`Args: ${clampForDisplay(sanitizeLine(rendered), CONFIRM_ARGS_CHARS)}`
|
|
1068
|
+
);
|
|
1069
|
+
}
|
|
1070
|
+
if (params.script) {
|
|
1071
|
+
lines.push(
|
|
1072
|
+
"",
|
|
1073
|
+
"Script:",
|
|
1074
|
+
clampForDisplay(
|
|
1075
|
+
sanitizeBlock(params.script),
|
|
1076
|
+
CONFIRM_SCRIPT_EXCERPT_CHARS
|
|
1077
|
+
)
|
|
1078
|
+
);
|
|
1079
|
+
}
|
|
1080
|
+
return lines.join("\n");
|
|
1081
|
+
}
|
|
1082
|
+
__name(buildConfirmationPrompt, "buildConfirmationPrompt");
|
|
1083
|
+
function buildUsageBanner(total) {
|
|
1084
|
+
if (total === null) {
|
|
1085
|
+
return `> Workflows have no per-run token cap. Set \`${MAX_TOKENS_PER_WORKFLOW_ENV}=<n>\` (env) for a soft cap. Suppress this notice with \`skipWorkflowUsageWarning: true\` in settings.
|
|
1086
|
+
|
|
1087
|
+
`;
|
|
1088
|
+
}
|
|
1089
|
+
return `> Workflow token cap is ${total} (per \`${MAX_TOKENS_PER_WORKFLOW_ENV}\`). Suppress this notice with \`skipWorkflowUsageWarning: true\` in settings.
|
|
1090
|
+
|
|
1091
|
+
`;
|
|
1092
|
+
}
|
|
1093
|
+
__name(buildUsageBanner, "buildUsageBanner");
|
|
1094
|
+
function safeEmitUpdate(updateOutput, entry) {
|
|
1095
|
+
if (!updateOutput || !entry) return;
|
|
1096
|
+
try {
|
|
1097
|
+
updateOutput(buildLivePhaseTreeDisplay(entry));
|
|
1098
|
+
} catch {
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
__name(safeEmitUpdate, "safeEmitUpdate");
|
|
1102
|
+
function safeStringifyResult(result) {
|
|
1103
|
+
if (result === void 0) return "(workflow returned no value)";
|
|
1104
|
+
if (typeof result === "string") return result;
|
|
1105
|
+
try {
|
|
1106
|
+
return JSON.stringify(result, null, 2);
|
|
1107
|
+
} catch {
|
|
1108
|
+
return `(workflow returned a non-JSON-serializable value of type ${typeof result})`;
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
__name(safeStringifyResult, "safeStringifyResult");
|
|
1112
|
+
function safeStringifyDisplayPayload(payload) {
|
|
1113
|
+
try {
|
|
1114
|
+
return JSON.stringify(payload, null, 2);
|
|
1115
|
+
} catch {
|
|
1116
|
+
if (payload && typeof payload === "object") {
|
|
1117
|
+
const sanitized = {};
|
|
1118
|
+
for (const [key, value] of Object.entries(payload)) {
|
|
1119
|
+
try {
|
|
1120
|
+
JSON.stringify(value);
|
|
1121
|
+
sanitized[key] = value;
|
|
1122
|
+
} catch {
|
|
1123
|
+
sanitized[key] = `(non-JSON-serializable value of type ${typeof value})`;
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
try {
|
|
1127
|
+
return JSON.stringify(sanitized, null, 2);
|
|
1128
|
+
} catch {
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
return "(display payload not JSON-serializable)";
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
__name(safeStringifyDisplayPayload, "safeStringifyDisplayPayload");
|
|
1135
|
+
var WORKFLOW_TOOL_DECISION = `Execute a workflow script that orchestrates subagents deterministically.
|
|
1136
|
+
|
|
1137
|
+
**Only on an explicit request**
|
|
1138
|
+
|
|
1139
|
+
Do not call this tool unless the user has asked for multi-agent orchestration. A run can dispatch up to ${DEFAULT_MAX_AGENTS_PER_RUN} subagents and spend tokens accordingly, so that scale has to be requested rather than inferred. It counts as requested when any of these holds:
|
|
1140
|
+
|
|
1141
|
+
- The user's message contains the word \`workflow\`; a system reminder confirms it when it does.
|
|
1142
|
+
- The user asked for orchestration in their own words \u2014 run a workflow, fan out agents, orchestrate this with subagents.
|
|
1143
|
+
- A skill or slash command the user invoked instructs you to use this tool.
|
|
1144
|
+
- The user named a saved workflow to run, reached through \`workflow('<name>')\` or \`scriptPath\`.
|
|
1145
|
+
- The user asked to resume or continue an earlier run, which is \`resumeFromRunId\`.
|
|
1146
|
+
|
|
1147
|
+
Otherwise do not call it, however well the task would parallelize. Do the work in the main loop, or spawn a single subagent for one self-contained piece. When a workflow would genuinely be the better tool, say in one sentence what it would fan out over and roughly how many agents that is, then let the user decide \u2014 and mention that including the word \`workflow\` next time skips the ask.
|
|
1148
|
+
|
|
1149
|
+
**What a workflow is for**
|
|
1150
|
+
|
|
1151
|
+
Reach for one to be comprehensive (cover every part of the work in parallel), to be confident (independent perspectives and adversarial checks before an answer is committed to), or to take on scale a single context cannot hold. Parallelism on its own is not a reason; work that is already one short sequence of edits belongs in the main loop.`;
|
|
1152
|
+
var WORKFLOW_TOOL_RUNTIME = `**Runtime**
|
|
1153
|
+
|
|
1154
|
+
\`phase(title)\`, \`log(msg)\`, \`agent(prompt, opts?)\`, \`parallel(thunks)\`, \`pipeline(items, ...stages)\`, \`workflow(nameOrRef, args?)\`, plus the \`args\` and \`budget\` globals. Saved workflows are \`<name>.js\` files under \`<projectRoot>/.qwen/workflows\` (project scope, also surfaced as \`/<name>\` slash commands) or \`~/.qwen/workflows\` (user scope); \`scriptPath\` additionally accepts a path inside the generated-scripts root (\`$QWEN_CODE_PROJECT_DIR/workflows/generated\` \u2014 the per-project runtime dir, not the project tree), and a path outside those roots is refused. Default \`max(2, min(16, availableParallelism()-2))\` agents in flight per run, which follows CPU affinity and container CPU limits (\`${MAX_WORKFLOW_CONCURRENCY_ENV}\`), up to ${DEFAULT_MAX_AGENTS_PER_RUN} agents total (\`${MAX_WORKFLOW_AGENTS_ENV}\`), under a 30-minute wall-clock cap per run (\`QWEN_CODE_MAX_WORKFLOW_SECONDS\`) \u2014 a fan-out near the agent cap will not fit inside the default cap. Each subagent attempt is separately capped at ${DEFAULT_WORKFLOW_SUBAGENT_MAX_TURNS} turns (\`${WORKFLOW_SUBAGENT_MAX_TURNS_ENV}\`) and ${DEFAULT_WORKFLOW_SUBAGENT_MAX_TIME_MINUTES} minutes (\`${WORKFLOW_SUBAGENT_MAX_MINUTES_ENV}\`). \`agent()\` resolves to \`null\` when that admitted agent fails on its own \u2014 turn/time caps, model or setup errors, missing structured output, exhausted stall retries \u2014 for a bare \`await agent()\` exactly as inside \`parallel()\`/\`pipeline()\`, so check for \`null\` wherever you read a result; run-level rejections no later call could survive (the token budget, the ${DEFAULT_MAX_AGENTS_PER_RUN}-agent cap, cancellation) throw instead. Every run hands back its runId, the script's path on disk (an inline script is persisted, so a resume edits that file rather than re-sending the source) and its journal path; read it before diagnosing an empty or surprising result. Runs appear in the background-tasks view and the \`/workflows\` dialog (live phase tree, token usage, cooperative pause/resume, cancel); \`run_in_background: true\` returns a run handle immediately in the interactive TUI and delivers completion through the conversation. Scripts run in a node:vm sandbox with no filesystem or shell access \u2014 all I/O happens through the spawned agents.`;
|
|
1155
|
+
var WORKFLOW_AUTHORING_POINTER = `**Writing the script**
|
|
1156
|
+
|
|
1157
|
+
Before writing a script, load the \`${WORKFLOW_AUTHORING_SKILL_NAME}\` skill \u2014 the authoring reference: the sandbox contract, agent() options, \`pipeline()\` vs \`parallel()\`, verification and convergence patterns, resume, and a worked example.`;
|
|
1158
|
+
var WORKFLOW_AUTHORING_TOOL_SEARCH_NOTE = ` ${toolSearchRevealSentence(ToolDisplayNames.SKILL)}`;
|
|
1159
|
+
var WORKFLOW_AUTHORING_INLINE_NOTE = "Skills cannot be loaded in this session, even one named in a skill listing, so the authoring reference follows in full. Where it points at another skill, that skill is not available here either.";
|
|
1160
|
+
function buildWorkflowToolDescription(surface, reference = readWorkflowAuthoringReference()) {
|
|
1161
|
+
const pointer = `${WORKFLOW_TOOL_DECISION}
|
|
1162
|
+
|
|
1163
|
+
${WORKFLOW_TOOL_RUNTIME}
|
|
1164
|
+
|
|
1165
|
+
${WORKFLOW_AUTHORING_POINTER}`;
|
|
1166
|
+
switch (surface) {
|
|
1167
|
+
case "pointer":
|
|
1168
|
+
return pointer;
|
|
1169
|
+
case "pointer-via-tool-search":
|
|
1170
|
+
return `${pointer}${WORKFLOW_AUTHORING_TOOL_SEARCH_NOTE}`;
|
|
1171
|
+
case "withheld":
|
|
1172
|
+
return `${WORKFLOW_TOOL_DECISION}
|
|
1173
|
+
|
|
1174
|
+
${WORKFLOW_TOOL_RUNTIME}`;
|
|
1175
|
+
case "inline":
|
|
1176
|
+
return reference ? `${WORKFLOW_TOOL_DECISION}
|
|
1177
|
+
|
|
1178
|
+
${WORKFLOW_AUTHORING_INLINE_NOTE}
|
|
1179
|
+
|
|
1180
|
+
---
|
|
1181
|
+
|
|
1182
|
+
${reference.body.trim()}` : pointer;
|
|
1183
|
+
default: {
|
|
1184
|
+
const unhandled = surface;
|
|
1185
|
+
return unhandled;
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
__name(buildWorkflowToolDescription, "buildWorkflowToolDescription");
|
|
1190
|
+
function buildWorkflowParamSchema(surface) {
|
|
1191
|
+
const base = WORKFLOW_PARAM_SCHEMA.properties.script.description;
|
|
1192
|
+
const where = surface === "pointer" || surface === "pointer-via-tool-search" ? ` agent() options and orchestration patterns are in the \`${WORKFLOW_AUTHORING_SKILL_NAME}\` skill.` : surface === "inline" ? " agent() options and orchestration patterns are in the authoring reference in this tool's description." : "";
|
|
1193
|
+
return {
|
|
1194
|
+
...WORKFLOW_PARAM_SCHEMA,
|
|
1195
|
+
properties: {
|
|
1196
|
+
...WORKFLOW_PARAM_SCHEMA.properties,
|
|
1197
|
+
script: { type: "string", description: `${base}${where}` }
|
|
1198
|
+
}
|
|
1199
|
+
};
|
|
1200
|
+
}
|
|
1201
|
+
__name(buildWorkflowParamSchema, "buildWorkflowParamSchema");
|
|
1202
|
+
function buildWorkflowAuthoringHint(surface) {
|
|
1203
|
+
const loadSkill = `hint: Load the \`${WORKFLOW_AUTHORING_SKILL_NAME}\` skill for the script reference if you have not, fix the script, and retry.`;
|
|
1204
|
+
switch (surface) {
|
|
1205
|
+
case "pointer":
|
|
1206
|
+
return loadSkill;
|
|
1207
|
+
case "pointer-via-tool-search":
|
|
1208
|
+
return `${loadSkill} ${toolSearchRevealSentence(ToolDisplayNames.SKILL)}`;
|
|
1209
|
+
case "inline":
|
|
1210
|
+
return "hint: See the authoring reference in this tool's description, fix the script, and retry.";
|
|
1211
|
+
case "withheld":
|
|
1212
|
+
return null;
|
|
1213
|
+
default: {
|
|
1214
|
+
const unhandled = surface;
|
|
1215
|
+
return unhandled;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
__name(buildWorkflowAuthoringHint, "buildWorkflowAuthoringHint");
|
|
1220
|
+
function isScriptAuthoredByThisCall(config, workflowName, scriptPath) {
|
|
1221
|
+
if (workflowName) return false;
|
|
1222
|
+
if (!scriptPath) return true;
|
|
1223
|
+
try {
|
|
1224
|
+
return isGeneratedWorkflowScriptPath(config, scriptPath);
|
|
1225
|
+
} catch {
|
|
1226
|
+
return false;
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
__name(isScriptAuthoredByThisCall, "isScriptAuthoredByThisCall");
|
|
1230
|
+
function authoringHintOption(hint) {
|
|
1231
|
+
return hint ? { authoringHint: hint } : {};
|
|
1232
|
+
}
|
|
1233
|
+
__name(authoringHintOption, "authoringHintOption");
|
|
1234
|
+
var WorkflowTool = class extends BaseDeclarativeTool {
|
|
1235
|
+
constructor(config, toolOptions = {}) {
|
|
1236
|
+
const surface = resolveWorkflowAuthoringSurface(config);
|
|
1237
|
+
super(
|
|
1238
|
+
ToolNames.WORKFLOW,
|
|
1239
|
+
ToolDisplayNames.WORKFLOW,
|
|
1240
|
+
buildWorkflowToolDescription(surface),
|
|
1241
|
+
"other" /* Other */,
|
|
1242
|
+
buildWorkflowParamSchema(surface),
|
|
1243
|
+
/* isOutputMarkdown */
|
|
1244
|
+
true,
|
|
1245
|
+
/* canUpdateOutput */
|
|
1246
|
+
true
|
|
1247
|
+
);
|
|
1248
|
+
this.config = config;
|
|
1249
|
+
this.toolOptions = toolOptions;
|
|
1250
|
+
this.authoringSurface = surface;
|
|
1251
|
+
}
|
|
1252
|
+
static {
|
|
1253
|
+
__name(this, "WorkflowTool");
|
|
1254
|
+
}
|
|
1255
|
+
/**
|
|
1256
|
+
* What this tool's description says about the authoring reference, decided
|
|
1257
|
+
* once here. The failure hint and the keyword reminder read it instead of
|
|
1258
|
+
* asking again, so a mid-session `/skills` toggle cannot make them disagree
|
|
1259
|
+
* with the description the model is holding.
|
|
1260
|
+
*/
|
|
1261
|
+
authoringSurface;
|
|
1262
|
+
buildSessionOwnedBackground(params, workflowName) {
|
|
1263
|
+
const validationError = this.validateToolParams(params);
|
|
1264
|
+
if (validationError) {
|
|
1265
|
+
throw new Error(validationError);
|
|
1266
|
+
}
|
|
1267
|
+
if (!this.config.getWorkflowRunRegistry().hasCompletionCallback()) {
|
|
1268
|
+
throw new Error(
|
|
1269
|
+
"WorkflowTool: session-owned background runs require an active workflow completion channel."
|
|
1270
|
+
);
|
|
1271
|
+
}
|
|
1272
|
+
return new WorkflowToolInvocation(
|
|
1273
|
+
this.config,
|
|
1274
|
+
this.toolOptions,
|
|
1275
|
+
{ ...params, run_in_background: true },
|
|
1276
|
+
buildWorkflowAuthoringHint(this.authoringSurface),
|
|
1277
|
+
workflowName
|
|
1278
|
+
);
|
|
1279
|
+
}
|
|
1280
|
+
validateToolParamValues(params) {
|
|
1281
|
+
const hasScript = typeof params.script === "string" && params.script.length > 0;
|
|
1282
|
+
const hasPath = typeof params.scriptPath === "string" && params.scriptPath.length > 0;
|
|
1283
|
+
if (!hasScript && !hasPath) {
|
|
1284
|
+
return "WorkflowTool: provide `script` (inline source) or `scriptPath` (a workflow script file).";
|
|
1285
|
+
}
|
|
1286
|
+
if (hasScript && hasPath) {
|
|
1287
|
+
return "WorkflowTool: provide exactly one of `script` or `scriptPath`, not both.";
|
|
1288
|
+
}
|
|
1289
|
+
if (params.resumeFromRunId !== void 0 && !/^wf_[0-9a-f]+$/.test(params.resumeFromRunId)) {
|
|
1290
|
+
return "WorkflowTool: `resumeFromRunId` must match the generated id format `wf_<hex>`.";
|
|
1291
|
+
}
|
|
1292
|
+
if (params.run_in_background === true) {
|
|
1293
|
+
if (!this.config.isInteractive() || this.config.getExperimentalZedIntegration?.() === true) {
|
|
1294
|
+
return "WorkflowTool: `run_in_background` is available only in the interactive TUI.";
|
|
1295
|
+
}
|
|
1296
|
+
if (!this.config.getWorkflowRunRegistry().hasCompletionCallback()) {
|
|
1297
|
+
return "WorkflowTool: `run_in_background` requires an active workflow completion channel.";
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
return null;
|
|
1301
|
+
}
|
|
1302
|
+
createInvocation(params) {
|
|
1303
|
+
return new WorkflowToolInvocation(
|
|
1304
|
+
this.config,
|
|
1305
|
+
this.toolOptions,
|
|
1306
|
+
params,
|
|
1307
|
+
buildWorkflowAuthoringHint(this.authoringSurface)
|
|
1308
|
+
);
|
|
1309
|
+
}
|
|
1310
|
+
};
|
|
1311
|
+
export {
|
|
1312
|
+
WorkflowTool,
|
|
1313
|
+
buildWorkflowToolDescription
|
|
1314
|
+
};
|
|
1315
|
+
/**
|
|
1316
|
+
* @license
|
|
1317
|
+
* Copyright 2026 Qwen Team
|
|
1318
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
1319
|
+
*/
|
|
1320
|
+
/**
|
|
1321
|
+
* @license
|
|
1322
|
+
* Copyright 2025 Qwen
|
|
1323
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
1324
|
+
*/
|