@qwen-code/qwen-code 0.23.2-preview.0 → 0.23.3-nightly.20260910.c46cb85cf2
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 +2 -2
- package/bundled/qc-helper/docs/configuration/auth.md +1 -1
- package/bundled/qc-helper/docs/configuration/model-providers.md +76 -34
- package/bundled/qc-helper/docs/configuration/settings.md +5 -3
- package/bundled/qc-helper/docs/features/_meta.ts +1 -0
- package/bundled/qc-helper/docs/features/channels/dingtalk.md +1 -21
- package/bundled/qc-helper/docs/features/channels/dws.md +7 -1
- package/bundled/qc-helper/docs/features/channels/github.md +1 -9
- package/bundled/qc-helper/docs/features/channels/overview.md +30 -56
- package/bundled/qc-helper/docs/features/channels/qqbot.md +1 -2
- package/bundled/qc-helper/docs/features/commands.md +105 -18
- package/bundled/qc-helper/docs/features/computer-use.md +1 -1
- package/bundled/qc-helper/docs/features/cross-session-protocol.md +320 -0
- package/bundled/qc-helper/docs/features/goals.md +5 -3
- package/bundled/qc-helper/docs/features/hooks.md +14 -13
- package/bundled/qc-helper/docs/features/sub-agents.md +8 -0
- package/bundled/qc-helper/docs/qwen-serve.md +84 -53
- package/bundled/review/SKILL.md +82 -79
- package/bundled/review/references/posting.md +31 -14
- package/chunks/{MaxSizedBox-ZZJT3PJF.js → MaxSizedBox-UZW24XUX.js} +63 -55
- package/chunks/{StandaloneSessionPicker-DIOSZTMX.js → StandaloneSessionPicker-IDK7NAZL.js} +85 -77
- package/chunks/{acp-startup-profiler-KEU6VAYR.js → acp-startup-profiler-ARO4II44.js} +2 -2
- package/chunks/acp-subagent-executor-7TLJGISS.js +919 -0
- package/chunks/{acpAgent-62JUP5A7.js → acpAgent-YRCNNIIU.js} +939 -306
- package/chunks/{agent-NLPEQQDZ.js → agent-SGU5EE7U.js} +47 -41
- package/chunks/{agent-headless-Y2GR5F2Q.js → agent-headless-JVYBLNLT.js} +47 -41
- package/chunks/{anthropicContentGenerator-I7LQZH26.js → anthropicContentGenerator-SGIR5IKF.js} +68 -36
- package/chunks/{artifact-tool-P52OKKEF.js → artifact-tool-PMYZCYNH.js} +2 -2
- package/chunks/{askUserQuestion-I5W5S3D6.js → askUserQuestion-4M4YYIB4.js} +2 -2
- package/chunks/{bridge-Q66BD62H.js → bridge-YF6NYRPZ.js} +68 -60
- package/chunks/{ca-KC2AISNS.js → ca-MX3WCEEG.js} +1 -1
- package/chunks/{channel-management-service-TRTLQTSV.js → channel-management-service-E4HTMU7T.js} +9 -9
- package/chunks/{channel-settings-store-R5STFWUW.js → channel-settings-store-FZ5VKHQD.js} +74 -66
- package/chunks/{channel-worker-group-PIYPVCTF.js → channel-worker-group-X6WH4XWF.js} +9 -9
- package/chunks/{channel-worker-manager-FQHEDTD2.js → channel-worker-manager-SICFJDPJ.js} +19 -10
- package/chunks/{channel-worker-supervisor-XJPZZ3VK.js → channel-worker-supervisor-HSFAKML6.js} +6 -6
- package/chunks/{chunk-CLKE4IY3.js → chunk-2SZH22YO.js} +1 -1
- package/chunks/{chunk-OIPUQE3S.js → chunk-34ZYDM3F.js} +27 -12
- package/chunks/{chunk-HIXUUCGY.js → chunk-36HCNKDS.js} +1 -1
- package/chunks/{chunk-6YEOCHSE.js → chunk-3FPYT6QC.js} +101 -31
- package/chunks/{chunk-NFIDVZND.js → chunk-3I7W2POO.js} +3 -22
- package/chunks/{chunk-W3ONSAYO.js → chunk-3VPFA6L2.js} +3 -3
- package/chunks/chunk-532WHF4F.js +127 -0
- package/chunks/{chunk-J3TJH52D.js → chunk-5FFAUU4T.js} +1 -1
- package/chunks/{chunk-G5QLLD53.js → chunk-5FKZ7KFQ.js} +1864 -35
- package/chunks/{chunk-B44JBZBB.js → chunk-5GLDOLNQ.js} +132 -27
- package/chunks/{chunk-ORREXWOM.js → chunk-5ZJ3KK5J.js} +5 -5
- package/chunks/{chunk-2OR32P5M.js → chunk-6EDWSKN4.js} +125 -10
- package/chunks/{chunk-EA4NFWVG.js → chunk-6EOMQPTS.js} +4 -4
- package/chunks/{chunk-45ROPFQY.js → chunk-6NONRGYX.js} +1 -1
- package/chunks/{chunk-EHTKOO6W.js → chunk-6UK77U7D.js} +46 -3
- package/chunks/{chunk-QXXBW2G4.js → chunk-72BGC7RT.js} +4 -4
- package/chunks/{chunk-CRZBDVP2.js → chunk-74JEYK2C.js} +10 -10
- package/chunks/{chunk-B54PFQS5.js → chunk-7CLLH5TI.js} +1 -1
- package/chunks/{chunk-CG2PDIGD.js → chunk-7XM6KEVW.js} +1 -1
- package/chunks/{chunk-CALNF3Z3.js → chunk-7XVQNDFB.js} +1 -1
- package/chunks/{chunk-TK4XHPKW.js → chunk-7ZKDPTYO.js} +2 -2
- package/chunks/{chunk-ZIPYCXQP.js → chunk-7ZVIGDZF.js} +1 -1
- package/chunks/chunk-AEY27Z35.js +1411 -0
- package/chunks/{chunk-WIRYFL2L.js → chunk-ATH66AEU.js} +64 -59
- package/chunks/{chunk-33MLFMCL.js → chunk-AW2SIT3B.js} +3 -3
- package/chunks/{chunk-4BLTSTF6.js → chunk-AWMJRE5N.js} +4 -4
- package/chunks/chunk-AYEJOTIU.js +43 -0
- package/chunks/{chunk-M73KHGNR.js → chunk-B2TGBZXY.js} +420 -227
- package/chunks/{chunk-XDNFODER.js → chunk-B6BDT4RX.js} +1 -1
- package/chunks/{chunk-WZ4YULVF.js → chunk-BHR6IN2X.js} +3251 -974
- package/chunks/{chunk-GXIHBIHC.js → chunk-BI3WSRQE.js} +61 -72
- package/chunks/{chunk-NVS4Z6GT.js → chunk-BQOP3K76.js} +1 -1
- package/chunks/{chunk-R2266LQ5.js → chunk-BTWGOKHU.js} +2 -2
- package/chunks/{process-registry-OAEG6WGC.js → chunk-BYUAT5OC.js} +1 -0
- package/chunks/{chunk-XVTCSVBK.js → chunk-C4NLHK7X.js} +227 -298
- package/chunks/{chunk-NOO4QFXM.js → chunk-C75BXMPM.js} +1 -3
- package/chunks/chunk-CAAMI77K.js +937 -0
- package/chunks/chunk-CF5KXZZX.js +150 -0
- package/chunks/{chunk-SOA4HKRJ.js → chunk-CGKEUUYG.js} +2 -2
- package/chunks/{chunk-BF3RUIVP.js → chunk-CH2YDT6X.js} +36 -38
- package/chunks/{chunk-5HBA2Z7V.js → chunk-CJ3DHN5I.js} +3 -3
- package/chunks/{chunk-3BTHHXXE.js → chunk-CSHX5ZC4.js} +1 -1
- package/chunks/{chunk-UYDQYDW2.js → chunk-CUK6F5UF.js} +1 -1
- package/chunks/{chunk-RPFJJ33Z.js → chunk-DLH7YIX6.js} +3 -3
- package/chunks/{chunk-L6ZME3W7.js → chunk-DMX7RF6E.js} +1 -1
- package/chunks/{chunk-TRWQQBVH.js → chunk-DTNV6UZY.js} +1 -1
- package/chunks/{chunk-FDOGGKAA.js → chunk-E4UEO3XM.js} +5 -2
- package/chunks/{chunk-RN6V5HKE.js → chunk-E5GQNSJY.js} +3 -3
- package/chunks/chunk-ELRMZTPF.js +374 -0
- package/chunks/chunk-ERU3SDXT.js +27 -0
- package/chunks/{chunk-O2FEO2CB.js → chunk-EUURTIV6.js} +18 -2
- package/chunks/{chunk-4HOEU2OR.js → chunk-EWJTAP3Y.js} +1 -19
- package/chunks/{chunk-ZELCTN6Y.js → chunk-F23YN37B.js} +10 -0
- package/chunks/{chunk-BL6B2QS2.js → chunk-F2RKL5I2.js} +809 -1195
- package/chunks/{chunk-J4ECGDA3.js → chunk-F45SKYIQ.js} +3 -3
- package/chunks/{chunk-5WC2ECUK.js → chunk-FCQJLMA2.js} +114 -8
- package/chunks/{chunk-4JKLPTV6.js → chunk-FGRDUDCI.js} +13 -6
- package/chunks/{chunk-ZUNWKOAP.js → chunk-FGV2QEAO.js} +5 -27
- package/chunks/{chunk-4VY3ITHR.js → chunk-FN3JNDRU.js} +3 -3
- package/chunks/{chunk-XI7RST4D.js → chunk-FRVV5SSD.js} +2 -2
- package/chunks/{chunk-UXDVUFKU.js → chunk-FYZ5NZ3V.js} +2 -20
- package/chunks/{chunk-ALMR3E6Q.js → chunk-GDWE23OR.js} +3 -3
- package/chunks/{chunk-W7PXLIZJ.js → chunk-GP47UR3M.js} +6 -6
- package/chunks/{chunk-LNYV4GXX.js → chunk-GSKX53AN.js} +0 -139
- package/chunks/{chunk-MA5OUNN6.js → chunk-HG46TTAG.js} +1 -1
- package/chunks/{chunk-FETY36NQ.js → chunk-HGEUHUEV.js} +1 -1
- package/chunks/{chunk-UULHYZ4W.js → chunk-HL2DQG3Y.js} +148 -23
- package/chunks/{chunk-E6TI726I.js → chunk-HUXPEUFL.js} +1 -1
- package/chunks/{chunk-5DQ4YTIZ.js → chunk-HZTXKVSV.js} +1 -1
- package/chunks/{chunk-LYT2OU7D.js → chunk-IAEXTMED.js} +1 -1
- package/chunks/{chunk-CPJRFFPH.js → chunk-IFHJIEMN.js} +576 -169
- package/chunks/{chunk-IW6RQPQB.js → chunk-IJOS26LH.js} +1 -3
- package/chunks/{chunk-ORFIYTI2.js → chunk-IK2MWJP5.js} +1 -1
- package/chunks/{chunk-MWEF5MUK.js → chunk-IOUBOANU.js} +42 -13
- package/chunks/{chunk-KA5HR3G2.js → chunk-IUVIBDKU.js} +2 -2
- package/chunks/{chunk-PQWM4SX2.js → chunk-J2RNOJRV.js} +2 -2
- package/chunks/{chunk-VHPG7BH6.js → chunk-J5PYQVD2.js} +2 -2
- package/chunks/{chunk-JDPBJIKI.js → chunk-JDEW3V5B.js} +1 -1
- package/chunks/{chunk-RX3FYFCN.js → chunk-JEMDIKGQ.js} +7 -7
- package/chunks/chunk-JL6APGBX.js +43 -0
- package/chunks/{chunk-UHUT4IDM.js → chunk-JOMCZWX7.js} +9 -15
- package/chunks/{chunk-43CI6YWJ.js → chunk-JV5YASQA.js} +2777 -2151
- package/chunks/{chunk-N6S3NUYJ.js → chunk-JXNIF2O5.js} +1 -1
- package/chunks/chunk-K2OJUPOE.js +78 -0
- package/chunks/{chunk-QLM7D7W3.js → chunk-KFGPNCCY.js} +8 -8
- package/chunks/{chunk-7RXOEUFF.js → chunk-KHIBLKNK.js} +1 -1
- package/chunks/{chunk-5GD7LYOH.js → chunk-KVBNJ4K2.js} +5 -5
- package/chunks/{chunk-QJAFSFYA.js → chunk-KZ2CU2LH.js} +1 -1
- package/chunks/{chunk-DCPRCDSR.js → chunk-L2KF7HUE.js} +6 -6
- package/chunks/{chunk-4ALNJDHL.js → chunk-L3DTX6U4.js} +3 -1
- package/chunks/{chunk-3SH53ANB.js → chunk-LAP7X6EC.js} +12 -0
- package/chunks/{chunk-GM44O6F7.js → chunk-LEGNDA46.js} +1 -1
- package/chunks/{chunk-WXFCI3O5.js → chunk-LG5Y4OWO.js} +2 -2
- package/chunks/{chunk-3LPJ776W.js → chunk-LILGKQ4B.js} +10 -7
- package/chunks/{chunk-LBKYQ33T.js → chunk-LIR7YS2O.js} +18 -12
- package/chunks/{chunk-5Z4FCEPY.js → chunk-LK2WUCDQ.js} +625 -119
- package/chunks/{chunk-W673V2H3.js → chunk-LY2GK2PR.js} +4 -4
- package/chunks/{chunk-PQSCGZT2.js → chunk-MOS5OAOG.js} +36 -10
- package/chunks/chunk-MXOALJIL.js +691 -0
- package/chunks/chunk-NFXXBWSE.js +463 -0
- package/chunks/chunk-NUQ4GK5I.js +315 -0
- package/chunks/{chunk-J3VZF2AL.js → chunk-NUQVB25K.js} +2 -2
- package/chunks/{chunk-GNY7B3CA.js → chunk-NVIBH7WS.js} +1 -1
- package/chunks/{chunk-M6YLOETP.js → chunk-O3MKRN2I.js} +4 -4
- package/chunks/{chunk-ISPBBKJN.js → chunk-ONGZNOIP.js} +7 -2
- package/chunks/{chunk-Q2F43WTJ.js → chunk-OOLSYRZ7.js} +36 -19
- package/chunks/{chunk-63ACHB2H.js → chunk-PIGUW2U2.js} +197 -28
- package/chunks/{chunk-QAZ2MGYT.js → chunk-PLLIWEM3.js} +2 -2
- package/chunks/{chunk-ULY4ISY2.js → chunk-PMS4FVLY.js} +23 -8
- package/chunks/{chunk-NB3NDQQK.js → chunk-Q2XLNLAV.js} +1 -1
- package/chunks/{chunk-6GRDHIVI.js → chunk-Q6HXLBZF.js} +12 -12
- package/chunks/{chunk-EUXF6URV.js → chunk-QPWZX4ZV.js} +32 -34
- package/chunks/{chunk-DTB5BXRG.js → chunk-RJZTX2OF.js} +30 -17
- package/chunks/{chunk-PQEISIKS.js → chunk-SAH4BD2J.js} +0 -67
- package/chunks/{chunk-LUVXLLMS.js → chunk-SAWPURIU.js} +2 -2
- package/chunks/{chunk-WZS3X663.js → chunk-SNZWDV67.js} +43 -18
- package/chunks/{chunk-IRKQ4YYX.js → chunk-SVWWF5TZ.js} +29 -1
- package/chunks/{chunk-5VZFJTL2.js → chunk-SXEE6PND.js} +2 -2
- package/chunks/{chunk-743XE7N7.js → chunk-T4JVQR7Z.js} +2 -2
- package/chunks/{chunk-6RZX2HIH.js → chunk-TBEXLLAO.js} +2 -2
- package/chunks/{chunk-LN3WBOKU.js → chunk-TP2DUOB6.js} +8 -8
- package/chunks/{chunk-MWIO7MF6.js → chunk-TP6FYVQT.js} +2 -0
- package/chunks/{chunk-HRPFBHW7.js → chunk-TPKQIA7G.js} +1 -0
- package/chunks/{chunk-VH764G6B.js → chunk-TWC3FHUI.js} +4 -4
- package/chunks/{chunk-H3Q3RSKZ.js → chunk-U7O65WKL.js} +1 -1
- package/chunks/{chunk-IUJLW6ZI.js → chunk-UBEYS536.js} +7 -7
- package/chunks/{chunk-VEQBVJYH.js → chunk-UGS62IR2.js} +3 -3
- package/chunks/{chunk-VF6D6EGV.js → chunk-UKMWZ5NS.js} +109 -842
- package/chunks/{chunk-7GZCCHJL.js → chunk-VHKOULAI.js} +6 -5
- package/chunks/{chunk-ODBNTMZW.js → chunk-VID4BW52.js} +97 -86
- package/chunks/{chunk-7L35FKPF.js → chunk-VLZOU6UH.js} +7 -7
- package/chunks/{chunk-XBLG564H.js → chunk-VTBPMLRO.js} +12 -12
- package/chunks/{chunk-QTNCGZHQ.js → chunk-VX63RJXE.js} +9 -0
- package/chunks/{chunk-7VEYUF3N.js → chunk-W5ZQMAEM.js} +1 -1
- package/chunks/{chunk-XQ4RDO5B.js → chunk-WBCPROWX.js} +1 -1
- package/chunks/{chunk-RDV4NLI3.js → chunk-WS7MOFK6.js} +3 -3
- package/chunks/{chunk-FV4DM2M4.js → chunk-WXFK4MH7.js} +32 -12
- package/chunks/{chunk-XAXTQURR.js → chunk-WY4N6KS7.js} +4 -4
- package/chunks/{chunk-CABDNUJ4.js → chunk-XDQUDARC.js} +11 -14
- package/chunks/{chunk-YHDGABDC.js → chunk-XKBFYTCD.js} +1 -1
- package/chunks/{chunk-2EKVPSIJ.js → chunk-Y2MYW47X.js} +1 -1
- package/chunks/{chunk-Y6ZWXM44.js → chunk-YIU5PEAT.js} +2 -2
- package/chunks/{chunk-PSPAM24S.js → chunk-YKK2XXHF.js} +4 -0
- package/chunks/{chunk-HZ2HUXX7.js → chunk-YS2ZJSOA.js} +29 -12
- package/chunks/{chunk-OFVAS4AR.js → chunk-ZGQIIGNQ.js} +2 -2
- package/chunks/{chunk-HNLMYDQE.js → chunk-ZHECLGA6.js} +2 -4
- package/chunks/{chunk-XBVNNDPK.js → chunk-ZHKTKHMO.js} +8 -1
- package/chunks/{chunk-OWCFKIFQ.js → chunk-ZKYR7QS4.js} +1 -1
- package/chunks/{chunk-YZTGGCEE.js → chunk-ZKZHSB5W.js} +1 -1
- package/chunks/{chunk-ERXNTINK.js → chunk-ZT6EPPBY.js} +1 -1
- package/chunks/{chunk-565U2ANU.js → chunk-ZTTC7T4X.js} +1 -1
- package/chunks/{chunk-MMMA36MN.js → chunk-ZUQVZTWG.js} +3 -3
- package/chunks/{chunk-7OCIQNKX.js → chunk-ZW2EUO2A.js} +1 -1
- package/chunks/{config-utils-37FHWPTP.js → config-utils-S5LFS4RN.js} +67 -59
- package/chunks/{contextCommand-R4JUBV5N.js → contextCommand-XXKZMMSQ.js} +64 -56
- package/chunks/{core-runtime-6U4OXU5C.js → core-runtime-YGUA42AZ.js} +68 -59
- package/chunks/{create-sub-session-LLUYAGZN.js → create-sub-session-SEK6KCYR.js} +64 -56
- package/chunks/{create-sub-session-TGIX63YU.js → create-sub-session-TIGCFGCS.js} +2 -2
- package/chunks/{cron-create-GTPVMJCF.js → cron-create-AKWX67FO.js} +1 -1
- package/chunks/{cron-delete-ZBK27Z4K.js → cron-delete-XPB6IYZJ.js} +1 -1
- package/chunks/{cron-list-KTFKFDKC.js → cron-list-XBKO4WU5.js} +1 -1
- package/chunks/{daemon-UI6SQSBV.js → daemon-G5TYKZD6.js} +2 -2
- package/chunks/{daemon-git-worktree-guard-O2UTNFJC.js → daemon-git-worktree-guard-3AWINPPX.js} +65 -57
- package/chunks/{daemon-status-provider-7GMAKSTX.js → daemon-status-provider-RTKHKUFJ.js} +73 -65
- package/chunks/{daemon-trust-policy-VNP76VMO.js → daemon-trust-policy-6YQOC7B6.js} +69 -61
- package/chunks/{daemon-trust-policy-monitor-TD5O3BZA.js → daemon-trust-policy-monitor-EN5L23GS.js} +69 -61
- package/chunks/{de-UU2YTO37.js → de-OOLZAU2U.js} +1 -1
- package/chunks/{deferred-core-runtime-NJM63YJS.js → deferred-core-runtime-JPLQRVZO.js} +62 -54
- package/chunks/{display-image-CTNHJRZC.js → display-image-NAH3AZ63.js} +3 -3
- package/chunks/{dist-STAGIFNB.js → dist-3BJVSJ7D.js} +389 -724
- package/chunks/{dist-OR2ZQTXZ.js → dist-65Q3TRLH.js} +16 -36
- package/chunks/{dist-24TCWK5H.js → dist-HX2LG76F.js} +233 -35
- package/chunks/{dist-XJ25G6OH.js → dist-J7PDFK53.js} +13 -38
- package/chunks/{dist-WZTUKIDR.js → dist-JCXKXRH6.js} +3 -6
- package/chunks/{dist-M4CBX53H.js → dist-LHGMHIDK.js} +2 -6
- package/chunks/{dist-5I4HLUTO.js → dist-QPTIRE3U.js} +4 -13
- package/chunks/{dist-FDISN4AK.js → dist-SBK33YLC.js} +5 -40
- package/chunks/{dist-NQ2636VT.js → dist-WMFHZG3R.js} +2 -5
- package/chunks/{edit-GL7OA6RV.js → edit-QXJZIWRQ.js} +50 -44
- package/chunks/{en-YJNRUQG4.js → en-7BZ2OZKH.js} +2 -1
- package/chunks/{enter-worktree-YFTKHXHZ.js → enter-worktree-54L5QJ3N.js} +4 -4
- package/chunks/{enterPlanMode-VC4BCSZE.js → enterPlanMode-2ITCVQ5N.js} +47 -41
- package/chunks/{environment-BI6IBAZJ.js → environment-URPO5ORZ.js} +65 -57
- package/chunks/{errors-D6G2ZM2R.js → errors-TDUYLEKI.js} +64 -56
- package/chunks/{exit-worktree-NF2XEMES.js → exit-worktree-EORJDKDS.js} +4 -4
- package/chunks/{exitPlanMode-DX446CA6.js → exitPlanMode-RA7KMUEW.js} +47 -41
- package/chunks/{fast-path-MAYDLJIP.js → fast-path-Q2JYP64P.js} +7 -7
- package/chunks/{fast-path-settings-SATXY3PD.js → fast-path-settings-GTHZLVSS.js} +2 -2
- package/chunks/{fr-HKNWVXRJ.js → fr-JJWM2HUS.js} +1 -1
- package/chunks/{glob-TVKRFY36.js → glob-VHSV4BKE.js} +50 -44
- package/chunks/{goal-tools-CA6YANRN.js → goal-tools-5FIE56CK.js} +53 -43
- package/chunks/{grep-BLHF2S5D.js → grep-3PKFKLCA.js} +2 -2
- package/chunks/{handleAutoUpdate-AW4ZAHON.js → handleAutoUpdate-7FZFLKNZ.js} +65 -57
- package/chunks/{i18n-IH5CRAY7.js → i18n-NTFQDWKR.js} +63 -55
- package/chunks/{image-gen-XP4NNIYG.js → image-gen-TF3IQWSH.js} +7 -6
- package/chunks/{initializer-UBR37ZNM.js → initializer-LB3T635H.js} +69 -61
- package/chunks/{installationInfo-Y52756EC.js → installationInfo-KRO433ZG.js} +62 -54
- package/chunks/{ja-GJS5RZGU.js → ja-L67TXFDJ.js} +1 -1
- package/chunks/{list-7V5JDZPO.js → list-NEP3WPZ7.js} +72 -64
- package/chunks/{list-agents-I5TRH3J7.js → list-agents-QLDXS5OD.js} +18 -8
- package/chunks/{llm-QDB6JVF5.js → llm-AZEJEIAD.js} +141 -128
- package/chunks/{llm-content-generator-EO6MZCEO.js → llm-content-generator-KWXFHBR3.js} +6 -5
- package/chunks/{loadedSettingsAdapter-I3YQKMC4.js → loadedSettingsAdapter-NZORJLSD.js} +69 -61
- package/chunks/{loggingContentGenerator-MNXYUGDG.js → loggingContentGenerator-NGHVU6AK.js} +69 -62
- package/chunks/{loop-wakeup-HL6XOWI4.js → loop-wakeup-HHMYIC7Z.js} +2 -2
- package/chunks/{ls-YV7RKLKY.js → ls-N7ABR6HI.js} +4 -4
- package/chunks/{lsp-NO3AMRZT.js → lsp-LTOFWG5P.js} +1 -1
- package/chunks/{managed-npm-update-EA3EXPTO.js → managed-npm-update-3LHNBEAG.js} +62 -54
- package/chunks/{mcp-QTAJ544Y.js → mcp-4SWJKDX7.js} +69 -61
- package/chunks/{monitor-6FQKQOTP.js → monitor-V5EFBZC7.js} +49 -43
- package/chunks/{nonInteractiveCli-MRCTZL5X.js → nonInteractiveCli-5UFUBUAT.js} +117 -109
- package/chunks/{notebook-edit-BQQCKI7K.js → notebook-edit-ATV46KWD.js} +48 -42
- package/chunks/{open-with-auth-D6JD6LDS.js → open-with-auth-6MVIHMXB.js} +1 -1
- package/chunks/openai-WX26N5OJ.js +47 -0
- package/chunks/{openaiContentGenerator-TTSKXNVH.js → openaiContentGenerator-BKTO5QJK.js} +31 -25
- package/chunks/openaiResponsesContentGenerator-RTCAJ5V5.js +1658 -0
- package/chunks/{pidfile-KPIS6RIT.js → pidfile-JAIOWPI3.js} +65 -55
- package/chunks/process-registry-X6ZCASEN.js +10 -0
- package/chunks/{processUtils-ZCASPKK4.js → processUtils-TCQH3LVD.js} +2 -2
- package/chunks/{prompt-terminal-ledger-D6HM6TV7.js → prompt-terminal-ledger-BYXHEUHX.js} +63 -55
- package/chunks/{pt-FXMYXEUV.js → pt-77SBDL4B.js} +1 -1
- package/chunks/{qwenContentGenerator-GGZEFLBD.js → qwenContentGenerator-K5TJK75P.js} +60 -52
- package/chunks/{qwenOAuth2-KX6LVYQ3.js → qwenOAuth2-NOXRK323.js} +6 -5
- package/chunks/{read-file-VE5GDFLP.js → read-file-DL7GNZD5.js} +11 -9
- package/chunks/{read-mcp-resource-D3N75DGF.js → read-mcp-resource-B37WANAQ.js} +1 -1
- package/chunks/{record-artifact-Q5CRGJTP.js → record-artifact-OAXWXZ5D.js} +2 -2
- package/chunks/record-source-D7R7X3GT.js +22 -0
- package/chunks/{report-findings-TJ34R7QK.js → report-findings-AR3VC6EQ.js} +3 -3
- package/chunks/{request-shutdown-LRKMTBAD.js → request-shutdown-IKNWTX5M.js} +5 -5
- package/chunks/{resumeHistoryUtils-HSSGMYDC.js → resumeHistoryUtils-OYKXZ4YO.js} +68 -60
- package/chunks/{ripGrep-SEJE7AA6.js → ripGrep-EOUMIU4K.js} +15 -13
- package/chunks/{ru-RMHURE5U.js → ru-UYWHKWF2.js} +1 -1
- package/chunks/{run-qwen-serve-OJYVH7N6.js → run-qwen-serve-PPTGWC5B.js} +471 -152
- package/chunks/{runtime-KGMQQFJD.js → runtime-5RO22P2N.js} +77 -67
- package/chunks/{scheduled-tasks-7H5HWHYD.js → scheduled-tasks-YGERFWLZ.js} +70 -62
- package/chunks/{scheduler-BE42AKDG.js → scheduler-S6WU6M3C.js} +64 -56
- 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-AWKUDJBH.js → send-message-TWOGWCBG.js} +13 -10
- package/chunks/{serve-KZVKYMSL.js → serve-HT4WOCWS.js} +70 -62
- package/chunks/{server-PJRALPJQ.js → server-SWXVPRCS.js} +2977 -617
- package/chunks/{session-IHITXU2S.js → session-6DSFUOMO.js} +154 -119
- package/chunks/{session-attachments-root-GQ2TUI3Y.js → session-attachments-root-SOZCTQWW.js} +62 -54
- package/chunks/{session-pr-refresh-H43LULTE.js → session-pr-refresh-F7XUBQBH.js} +70 -62
- package/chunks/{settings-RKEQQDFC.js → settings-SWQH36PO.js} +74 -66
- package/chunks/{shell-6PJ444U5.js → shell-XUQL6EYV.js} +47 -41
- package/chunks/{skill-Q3UP7B5V.js → skill-HNRDD54C.js} +33 -23
- package/chunks/{skill-settings-LZR5YRRW.js → skill-settings-JU72PCII.js} +68 -60
- package/chunks/{spawnChannel-WM3DT2BF.js → spawnChannel-7ZVM3GBU.js} +65 -57
- package/chunks/{standalone-update-E5474IBI.js → standalone-update-64JQY2LX.js} +64 -56
- package/chunks/{start-opentui-ui-WLWZNQ2I.js → start-opentui-ui-RSLBXESU.js} +554 -297
- package/chunks/{startInteractiveUI-FBQSGWGO.js → startInteractiveUI-ZDPHD7XE.js} +1282 -1915
- package/chunks/{syntheticOutput-D2P5V6RG.js → syntheticOutput-F6F27JMK.js} +2 -2
- package/chunks/{task-create-PMAFST2T.js → task-create-Y623TBHB.js} +10 -10
- package/chunks/{task-list-R2HSY2NC.js → task-list-FCPEEGWL.js} +3 -3
- package/chunks/{task-stop-BFSKRTGV.js → task-stop-QTKZXLPH.js} +1 -1
- package/chunks/{task-update-JYC57USF.js → task-update-YLSXF25N.js} +10 -10
- package/chunks/{team-create-VIGUFUT4.js → team-create-U52VYSNO.js} +49 -43
- package/chunks/{team-delete-CBHVBTPB.js → team-delete-S7TLHZCF.js} +3 -3
- package/chunks/{team-plan-approval-HQVZA3MD.js → team-plan-approval-IQ4ADQIK.js} +47 -41
- package/chunks/{terminal-image-renderer-LUKNCOVM.js → terminal-image-renderer-ZEMF7LB2.js} +64 -56
- package/chunks/{theme-manager-LOENKYLY.js → theme-manager-DK2S2SOX.js} +62 -54
- package/chunks/{todoWrite-5ERKFWAK.js → todoWrite-5QI2H2FW.js} +4 -4
- package/chunks/{tool-search-ZIFAQCE2.js → tool-search-6U4OQG7K.js} +21 -15
- package/chunks/{total-session-admission-FUUJH3QH.js → total-session-admission-BOARHBZU.js} +68 -60
- package/chunks/{trustedFolders-C76KYROP.js → trustedFolders-GKQZXZSV.js} +63 -55
- package/chunks/{update-relaunch-4G2SRXKX.js → update-relaunch-GLACF7PX.js} +5 -5
- package/chunks/{updateCheck-EIZIO7HI.js → updateCheck-NLBSZB4Q.js} +64 -56
- package/chunks/{useAutoAcceptIndicator-EAA6KSY4.js → useAutoAcceptIndicator-3X3BYU7H.js} +72 -64
- package/chunks/{validateNonInterActiveAuth-BRX22QCN.js → validateNonInterActiveAuth-NE3JLOIR.js} +114 -106
- package/chunks/{version-E56RU7PR.js → version-6H5YAT4N.js} +3 -1
- package/chunks/{web-fetch-AAUCD7RM.js → web-fetch-RWSO7TTN.js} +15 -13
- package/chunks/{web-search-HFUQF44Q.js → web-search-DADI3LV5.js} +560 -322
- package/chunks/{web-shell-static-POZHGGXE.js → web-shell-static-CCN4JZEE.js} +5 -4
- package/chunks/workflow-LPGCZCIT.js +1224 -0
- package/chunks/workspace-providers-status-QBRBEFTO.js +127 -0
- package/chunks/{workspace-registration-store-YL7HLYYI.js → workspace-registration-store-WUKTMJPW.js} +3 -2
- package/chunks/{workspace-registry-BNRP2ELW.js → workspace-registry-CJV7KVGF.js} +68 -60
- package/chunks/{workspace-runtime-coordinator-WKGF7VHS.js → workspace-runtime-coordinator-7LYMFMFF.js} +71 -61
- package/chunks/{workspace-service-4MYO72MM.js → workspace-service-HWXZSA4J.js} +75 -67
- package/chunks/{workspace-skills-status-SU66TJLZ.js → workspace-skills-status-D6QXUWCC.js} +70 -62
- package/chunks/{workspace-trust-reconciler-D5QT7WQB.js → workspace-trust-reconciler-VZX7G7CZ.js} +75 -67
- package/chunks/{write-file-NVPQE2AZ.js → write-file-KKHV26YV.js} +49 -43
- package/chunks/{zh-VBFCRQBL.js → zh-J2GLI64H.js} +2 -1
- package/chunks/{zh-TW-N2TBF2F2.js → zh-TW-TBAICUJQ.js} +2 -1
- package/chunks/{zoom-image-RJHC66WG.js → zoom-image-OG7X7KAA.js} +12 -10
- package/cli.js +14 -14
- 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 +3 -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 +3 -2
- package/locales/zh.js +3 -2
- package/package.json +6 -5
- package/web-shell/assets/{abnfDiagram-VCTEODGH-DHc6plZn.js → abnfDiagram-VCTEODGH-NT0lTLRG.js} +1 -1
- package/web-shell/assets/{arc-BQ9m8TDV.js → arc-DDqnIMMx.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-D5ap3oVB.js → architectureDiagram-5GKGNRK7-DfYghE3W.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-BIbnyNph.js → blockDiagram-NRAW4CY4-DlqJIx5c.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-BRsdx_iG.js → c4Diagram-UCG6FXSJ-CinqLGU4.js} +1 -1
- package/web-shell/assets/channel-BHGoSkEv.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-3lf1fNlx.js → chunk-2Q5K7J3B-CsjJX5M7.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-DP8VNRc4.js → chunk-5VM5RSS4-CaVb2tdH.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-DrohDmZ6.js → chunk-F27PBJKO-CRyErlzW.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-UZ2QhSx6.js → chunk-G27WJ6UU-7I79DZCf.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-BIMHVcZK.js → chunk-JWPE2WC7-Dz4cac5F.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-izRxdSDd.js → chunk-LCL6LL3I-Ls24Derb.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-CXADD4PP.js → chunk-POPQ4Y6H-JzYe4qx7.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-B96d8Y_1.js → chunk-SVP7TREG-BxDwesA-.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-CF2sVQpv.js → chunk-XXDRQBXY-CW4hjgWc.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-E47Xnn15.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-E47Xnn15.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-CT6tXVAS.js → cose-bilkent-JH36ORCC-DxikE9iF.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-X1NS4vtV.js → cynefin-OW5HDTMX-CvVsIkVN.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-DNsKNOT4.js → cynefinDiagram-5FMLGOSQ-CDHkk3wq.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-9-AHKqsb.js → dagre-3AP2YEHR-BgLdkVLT.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-Bjgms7j6.js → diagram-S7CK7UJ4-DP43cGhe.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-h6bCprbE.js → diagram-UQ7AKVKN-BWrZYhoT.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-4SbQXVLt.js → diagram-VSXAHHWV-B80wjH_n.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-B5gPCzzB.js → diagram-VX7I27RA-DPpKmDsY.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-DFJXIA3A.js → diagram-Z3DM3KII-kaEBNbNU.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-FwyaU7VY.js → ebnfDiagram-PWID7BFC-1-qbEZvk.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-8vJQh2te.js → erDiagram-SSCWMZ5O-CrK2gMkV.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-BzA_1gMN.js → flowDiagram-A5DVABFB-Dic2xofW.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-Co-ABbVX.js → ganttDiagram-EL5Y4UJY-DJko8vT7.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-DW_FcyrX.js → gitGraphDiagram-WWUBYQGX-DxsQ-bHT.js} +1 -1
- package/web-shell/assets/index-DY8CxdBr.js +2173 -0
- package/web-shell/assets/index-eBxK3rs2.css +36 -0
- package/web-shell/assets/{index-BbMXfhNG.js → index-t7VBrUeD.js} +1 -1
- package/web-shell/assets/{infoDiagram-RXCK75RN-BEgfhUFN.js → infoDiagram-RXCK75RN-DcRUJbNi.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-DCsMxQmc.js → ishikawaDiagram-5VMMS53U-CUPw-2_e.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-DyIEYoHz.js → journeyDiagram-EYS64GPL-yOHhZxkW.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-CkxjqCNr.js → kanban-definition-3QL26DDD-CFUGBbqz.js} +1 -1
- package/web-shell/assets/{layout-BEWc0Al9.js → layout-BoilNfBU.js} +1 -1
- package/web-shell/assets/{linear-CNuNxirL.js → linear-DOuHaPrl.js} +1 -1
- package/web-shell/assets/{mermaid.core-DZBre674.js → mermaid.core-1G1fXWda.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-CpafFz_F.js → mindmap-definition-FBJOCRG2-B8BhkrOX.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-DfZqk_dq.js → pegDiagram-XKGWAZYB-CipC5K1D.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-S0UWXlgC.js → pieDiagram-E7YTZNPT-CHBDFDUJ.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-dd37_Ohj.js → quadrantDiagram-AXDQQJYC-_iiBkoZO.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-CH8NJZ7u.js → railroadDiagram-O6MQD6OU-Cx1peHDi.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-CFdqWYih.js → requirementDiagram-EFPCY7ZU-CBRiPbdQ.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-CsddcEGD.js → sankeyDiagram-P5KCCOFB-TT6GcHaZ.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-BZ270mGw.js → sequenceDiagram-WJ2MYXX4-CWP42PNb.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-CGaS4DBV.js → sizeCapture-X5ZJPWSS-Bp94roEG.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-COpIzMu6.js → stateDiagram-HBIQ2CUA-0ftrzTAy.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-PgAST0dK.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-CMF889m3.js → swimlanes-XN3QIQJK-D-FsenYJ.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-BcWcB5bj.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-BelnxYz5.js → timeline-definition-24CTP7MA-Ctvrj28y.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-CU-NRqIB.js → vennDiagram-4TSXK5OY-5DZncjOt.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-CDNKqWh-.js → wardleyDiagram-VM6X3IG4-jZjYwPY7.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-CLqguL5D.js → xychartDiagram-S5SC5T6Z-Ci6Q2C2_.js} +1 -1
- package/web-shell/index.html +29 -5
- package/chunks/chunk-V7RNNPGC.js +0 -44
- package/chunks/chunk-X35VIWWJ.js +0 -276
- package/chunks/workflow-3MABM53N.js +0 -2771
- package/chunks/workspace-providers-status-2FRLBZ5I.js +0 -119
- package/web-shell/assets/channel-uMMdTrYk.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-DcY-26Ig.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-DcY-26Ig.js +0 -1
- package/web-shell/assets/index-Bu-rZoJ-.js +0 -2150
- package/web-shell/assets/index-CsPwZ1ut.css +0 -36
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-D6qEVAji.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-mem5Jj4m.js +0 -8
- /package/chunks/{chunk-JA5CBKRP.js → chunk-7NXSVSFB.js} +0 -0
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
sanitizePromptText,
|
|
15
15
|
sanitizeSenderName,
|
|
16
16
|
truncateUtf16Units
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-C4NLHK7X.js";
|
|
18
|
+
import "./chunk-IJOS26LH.js";
|
|
19
19
|
import "./chunk-CQ35AJ4Z.js";
|
|
20
20
|
import "./chunk-DMTGGOSA.js";
|
|
21
21
|
import "./chunk-YQ3U5MUC.js";
|
|
@@ -38,7 +38,7 @@ init_esbuild_shims();
|
|
|
38
38
|
// packages/channels/dingtalk/dist/DingtalkAdapter.js
|
|
39
39
|
init_esbuild_shims();
|
|
40
40
|
import { mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
41
|
-
import { randomUUID as
|
|
41
|
+
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
42
42
|
import { basename as basename3, join } from "node:path";
|
|
43
43
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
44
44
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
@@ -6279,11 +6279,6 @@ function projectFileText(text) {
|
|
|
6279
6279
|
return projector.result(safe);
|
|
6280
6280
|
}
|
|
6281
6281
|
__name(projectFileText, "projectFileText");
|
|
6282
|
-
function withFileUnavailableNotice(text) {
|
|
6283
|
-
const safe = text.trimEnd();
|
|
6284
|
-
return `${safe}${safe ? "\n" : ""}${FILE_UNAVAILABLE_NOTICE}`;
|
|
6285
|
-
}
|
|
6286
|
-
__name(withFileUnavailableNotice, "withFileUnavailableNotice");
|
|
6287
6282
|
function safeFileName(filePath) {
|
|
6288
6283
|
return basename2(filePath).replace(/[\p{Cc}\p{Cf}[\]]+/gu, "_").slice(0, 200) || "file";
|
|
6289
6284
|
}
|
|
@@ -6853,16 +6848,24 @@ function parseDingtalkInteractiveCardConfig(value) {
|
|
|
6853
6848
|
const root = asRecord(value) ?? {};
|
|
6854
6849
|
const status = asRecord(root["statusCard"]);
|
|
6855
6850
|
const question = asRecord(root["questionCard"]);
|
|
6851
|
+
const permission = asRecord(root["permissionCard"]);
|
|
6856
6852
|
if (root["statusCard"] !== void 0 && !status) {
|
|
6857
6853
|
throw new Error("DingTalk interactiveCards.statusCard must be an object.");
|
|
6858
6854
|
}
|
|
6859
6855
|
if (root["questionCard"] !== void 0 && !question) {
|
|
6860
6856
|
throw new Error("DingTalk interactiveCards.questionCard must be an object.");
|
|
6861
6857
|
}
|
|
6862
|
-
|
|
6863
|
-
|
|
6858
|
+
if (root["permissionCard"] !== void 0 && !permission) {
|
|
6859
|
+
throw new Error("DingTalk interactiveCards.permissionCard must be an object.");
|
|
6860
|
+
}
|
|
6861
|
+
const questionTimeoutMs = question?.["timeoutMs"] === void 0 ? DEFAULT_QUESTION_TIMEOUT_MS : question["timeoutMs"];
|
|
6862
|
+
if (typeof questionTimeoutMs !== "number" || !Number.isFinite(questionTimeoutMs) || questionTimeoutMs <= DINGTALK_INTERACTIVE_CARD_TIMEOUT_EXCLUSIVE_MINIMUM) {
|
|
6864
6863
|
throw new Error("DingTalk interactiveCards.questionCard.timeoutMs must be a finite positive number.");
|
|
6865
6864
|
}
|
|
6865
|
+
const permissionTimeoutMs = permission?.["timeoutMs"] === void 0 ? DEFAULT_QUESTION_TIMEOUT_MS : permission["timeoutMs"];
|
|
6866
|
+
if (typeof permissionTimeoutMs !== "number" || !Number.isFinite(permissionTimeoutMs) || permissionTimeoutMs <= DINGTALK_INTERACTIVE_CARD_TIMEOUT_EXCLUSIVE_MINIMUM) {
|
|
6867
|
+
throw new Error("DingTalk interactiveCards.permissionCard.timeoutMs must be a finite positive number.");
|
|
6868
|
+
}
|
|
6866
6869
|
return {
|
|
6867
6870
|
enabled: optionalBoolean(root["enabled"], "enabled", configured),
|
|
6868
6871
|
statusCard: {
|
|
@@ -6870,7 +6873,11 @@ function parseDingtalkInteractiveCardConfig(value) {
|
|
|
6870
6873
|
},
|
|
6871
6874
|
questionCard: {
|
|
6872
6875
|
enabled: optionalBoolean(question?.["enabled"], "questionCard.enabled", true),
|
|
6873
|
-
timeoutMs: Math.min(
|
|
6876
|
+
timeoutMs: Math.min(questionTimeoutMs, DINGTALK_INTERACTIVE_CARD_TIMEOUT_MAXIMUM_MS)
|
|
6877
|
+
},
|
|
6878
|
+
permissionCard: {
|
|
6879
|
+
enabled: optionalBoolean(permission?.["enabled"], "permissionCard.enabled", true),
|
|
6880
|
+
timeoutMs: Math.min(permissionTimeoutMs, DINGTALK_INTERACTIVE_CARD_TIMEOUT_MAXIMUM_MS)
|
|
6874
6881
|
}
|
|
6875
6882
|
};
|
|
6876
6883
|
}
|
|
@@ -7981,9 +7988,294 @@ ${text}`;
|
|
|
7981
7988
|
}
|
|
7982
7989
|
};
|
|
7983
7990
|
|
|
7984
|
-
// packages/channels/dingtalk/dist/
|
|
7991
|
+
// packages/channels/dingtalk/dist/permission-card-controller.js
|
|
7985
7992
|
init_esbuild_shims();
|
|
7986
7993
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
7994
|
+
var DECISION_FIELD = "permission_decision";
|
|
7995
|
+
var PERMISSION_CARD_COPY = {
|
|
7996
|
+
en: {
|
|
7997
|
+
title: "Permission required",
|
|
7998
|
+
submit: "Submit",
|
|
7999
|
+
choose: "Choose how to continue",
|
|
8000
|
+
approved: { description: "Permission approved.", button: "Approved" },
|
|
8001
|
+
denied: { description: "Permission denied.", button: "Denied" },
|
|
8002
|
+
expired: {
|
|
8003
|
+
description: "This permission request is no longer available.",
|
|
8004
|
+
button: "Expired"
|
|
8005
|
+
},
|
|
8006
|
+
cancelled: {
|
|
8007
|
+
description: "Permission request cancelled.",
|
|
8008
|
+
button: "Cancelled"
|
|
8009
|
+
}
|
|
8010
|
+
},
|
|
8011
|
+
zh: {
|
|
8012
|
+
title: "\u9700\u8981\u6388\u6743",
|
|
8013
|
+
submit: "\u63D0\u4EA4",
|
|
8014
|
+
choose: "\u8BF7\u9009\u62E9\u540E\u7EED\u64CD\u4F5C",
|
|
8015
|
+
approved: { description: "\u5DF2\u6388\u6743\u3002", button: "\u5DF2\u6388\u6743" },
|
|
8016
|
+
denied: { description: "\u5DF2\u62D2\u7EDD\u6388\u6743\u3002", button: "\u5DF2\u62D2\u7EDD" },
|
|
8017
|
+
expired: { description: "\u6B64\u6388\u6743\u8BF7\u6C42\u5DF2\u5931\u6548\u3002", button: "\u5DF2\u5931\u6548" },
|
|
8018
|
+
cancelled: { description: "\u6388\u6743\u8BF7\u6C42\u5DF2\u53D6\u6D88\u3002", button: "\u5DF2\u53D6\u6D88" }
|
|
8019
|
+
}
|
|
8020
|
+
};
|
|
8021
|
+
var PermissionCardController = class {
|
|
8022
|
+
static {
|
|
8023
|
+
__name(this, "PermissionCardController");
|
|
8024
|
+
}
|
|
8025
|
+
options;
|
|
8026
|
+
byRequest = /* @__PURE__ */ new Map();
|
|
8027
|
+
byOutTrack = /* @__PURE__ */ new Map();
|
|
8028
|
+
pendingByRun = /* @__PURE__ */ new Map();
|
|
8029
|
+
constructor(options) {
|
|
8030
|
+
this.options = options;
|
|
8031
|
+
}
|
|
8032
|
+
async present(context, target) {
|
|
8033
|
+
const previous = this.byRequest.get(context.requestId);
|
|
8034
|
+
if (previous) {
|
|
8035
|
+
this.reserveTerminalProjection(previous);
|
|
8036
|
+
await this.finalize(previous, "expired");
|
|
8037
|
+
}
|
|
8038
|
+
const record = {
|
|
8039
|
+
context,
|
|
8040
|
+
target,
|
|
8041
|
+
outTrackId: `qwen-permission-${randomUUID4()}`,
|
|
8042
|
+
state: "reserved",
|
|
8043
|
+
delivered: false,
|
|
8044
|
+
forbiddenActors: /* @__PURE__ */ new Set()
|
|
8045
|
+
};
|
|
8046
|
+
this.byRequest.set(context.requestId, record);
|
|
8047
|
+
this.byOutTrack.set(record.outTrackId, record);
|
|
8048
|
+
const unsubscribe = context.onSettled((reason) => {
|
|
8049
|
+
if (record.state === "claimed")
|
|
8050
|
+
return;
|
|
8051
|
+
if (record.state === "pending")
|
|
8052
|
+
this.reserveTerminalProjection(record);
|
|
8053
|
+
void this.finalize(record, reason === "resolved_outside_presenter" ? "expired" : "cancelled");
|
|
8054
|
+
});
|
|
8055
|
+
record.unsubscribe = unsubscribe;
|
|
8056
|
+
if (record.state === "terminal")
|
|
8057
|
+
unsubscribe();
|
|
8058
|
+
try {
|
|
8059
|
+
await this.options.client.createAndDeliver({
|
|
8060
|
+
templateId: QUESTION_CARD_TEMPLATE_ID,
|
|
8061
|
+
outTrackId: record.outTrackId,
|
|
8062
|
+
target,
|
|
8063
|
+
cardParamMap: this.cardData(context)
|
|
8064
|
+
});
|
|
8065
|
+
record.delivered = true;
|
|
8066
|
+
} catch (error) {
|
|
8067
|
+
this.options.onError?.("permission card creation", error);
|
|
8068
|
+
if (record.state === "terminal")
|
|
8069
|
+
return { kind: "presented" };
|
|
8070
|
+
this.discard(record);
|
|
8071
|
+
return { kind: "unsupported" };
|
|
8072
|
+
}
|
|
8073
|
+
if (record.state !== "reserved") {
|
|
8074
|
+
await this.projectTerminal(record);
|
|
8075
|
+
return { kind: "presented" };
|
|
8076
|
+
}
|
|
8077
|
+
record.state = "pending";
|
|
8078
|
+
const pending = this.pendingByRun.get(context.runId) ?? /* @__PURE__ */ new Set();
|
|
8079
|
+
pending.add(context.requestId);
|
|
8080
|
+
this.pendingByRun.set(context.runId, pending);
|
|
8081
|
+
record.timer = setTimeout(() => {
|
|
8082
|
+
void this.expire(record);
|
|
8083
|
+
}, this.options.timeoutMs);
|
|
8084
|
+
record.timer.unref?.();
|
|
8085
|
+
return { kind: "presented" };
|
|
8086
|
+
}
|
|
8087
|
+
claim(callback) {
|
|
8088
|
+
const record = this.byOutTrack.get(callback.outTrackId);
|
|
8089
|
+
if (!record || record.state !== "pending") {
|
|
8090
|
+
return { kind: "ignored", actorId: callback.actorId };
|
|
8091
|
+
}
|
|
8092
|
+
if (record.context.owner.id !== callback.actorId) {
|
|
8093
|
+
if (record.forbiddenActors.has(callback.actorId)) {
|
|
8094
|
+
return { kind: "ignored" };
|
|
8095
|
+
}
|
|
8096
|
+
record.forbiddenActors.add(callback.actorId);
|
|
8097
|
+
return {
|
|
8098
|
+
kind: "forbidden",
|
|
8099
|
+
actorId: callback.actorId,
|
|
8100
|
+
target: record.target
|
|
8101
|
+
};
|
|
8102
|
+
}
|
|
8103
|
+
if (callback.hasBusinessPayload === false || !callback.isCancel && callback.actionId !== "cancel" && callback.actionId !== "submit" && callback.actionId !== record.context.requestId) {
|
|
8104
|
+
return { kind: "ignored", actorId: callback.actorId };
|
|
8105
|
+
}
|
|
8106
|
+
if (callback.isCancel || callback.actionId === "cancel") {
|
|
8107
|
+
this.reserveTerminalProjection(record);
|
|
8108
|
+
record.state = "claimed";
|
|
8109
|
+
return {
|
|
8110
|
+
kind: "accepted",
|
|
8111
|
+
execute: /* @__PURE__ */ __name(() => this.respond(record, "deny", "cancelled"), "execute")
|
|
8112
|
+
};
|
|
8113
|
+
}
|
|
8114
|
+
const decision = this.parseDecision(record, callback.formData);
|
|
8115
|
+
if (!decision)
|
|
8116
|
+
return { kind: "ignored", actorId: callback.actorId };
|
|
8117
|
+
this.reserveTerminalProjection(record);
|
|
8118
|
+
record.state = "claimed";
|
|
8119
|
+
return {
|
|
8120
|
+
kind: "accepted",
|
|
8121
|
+
execute: /* @__PURE__ */ __name(() => this.respond(record, decision), "execute")
|
|
8122
|
+
};
|
|
8123
|
+
}
|
|
8124
|
+
cancelRun(runId) {
|
|
8125
|
+
const requestIds = [...this.pendingByRun.get(runId) ?? []];
|
|
8126
|
+
for (const requestId of requestIds) {
|
|
8127
|
+
const record = this.byRequest.get(requestId);
|
|
8128
|
+
if (record) {
|
|
8129
|
+
this.reserveTerminalProjection(record);
|
|
8130
|
+
void this.finalize(record, "cancelled");
|
|
8131
|
+
}
|
|
8132
|
+
}
|
|
8133
|
+
}
|
|
8134
|
+
async respond(record, decision, terminalState) {
|
|
8135
|
+
try {
|
|
8136
|
+
const accepted = await record.context.respond(decision);
|
|
8137
|
+
await this.finalize(record, accepted ? terminalState ?? (decision === "deny" ? "denied" : "approved") : "expired");
|
|
8138
|
+
} catch (error) {
|
|
8139
|
+
this.options.onError?.("permission response", error);
|
|
8140
|
+
await this.finalize(record, "expired");
|
|
8141
|
+
}
|
|
8142
|
+
}
|
|
8143
|
+
async expire(record) {
|
|
8144
|
+
if (record.state !== "pending")
|
|
8145
|
+
return;
|
|
8146
|
+
this.reserveTerminalProjection(record);
|
|
8147
|
+
record.state = "claimed";
|
|
8148
|
+
const response = record.context.respond("deny").catch((error) => {
|
|
8149
|
+
this.options.onError?.("expired permission cancellation", error);
|
|
8150
|
+
});
|
|
8151
|
+
await this.finalize(record, "expired");
|
|
8152
|
+
await response;
|
|
8153
|
+
}
|
|
8154
|
+
async finalize(record, terminalState) {
|
|
8155
|
+
if (record.state === "terminal")
|
|
8156
|
+
return;
|
|
8157
|
+
record.state = "terminal";
|
|
8158
|
+
record.terminalState = terminalState;
|
|
8159
|
+
this.removeRecord(record);
|
|
8160
|
+
if (!record.delivered)
|
|
8161
|
+
return;
|
|
8162
|
+
const finishTerminalProjection = record.finishTerminalProjection;
|
|
8163
|
+
record.finishTerminalProjection = void 0;
|
|
8164
|
+
if (finishTerminalProjection) {
|
|
8165
|
+
await finishTerminalProjection(() => this.projectTerminal(record));
|
|
8166
|
+
} else {
|
|
8167
|
+
await this.projectTerminal(record);
|
|
8168
|
+
}
|
|
8169
|
+
}
|
|
8170
|
+
discard(record) {
|
|
8171
|
+
if (record.state === "terminal")
|
|
8172
|
+
return;
|
|
8173
|
+
record.state = "terminal";
|
|
8174
|
+
this.removeRecord(record);
|
|
8175
|
+
}
|
|
8176
|
+
removeRecord(record) {
|
|
8177
|
+
if (record.timer)
|
|
8178
|
+
clearTimeout(record.timer);
|
|
8179
|
+
record.timer = void 0;
|
|
8180
|
+
record.unsubscribe?.();
|
|
8181
|
+
record.unsubscribe = void 0;
|
|
8182
|
+
this.byRequest.delete(record.context.requestId);
|
|
8183
|
+
this.byOutTrack.delete(record.outTrackId);
|
|
8184
|
+
const pending = this.pendingByRun.get(record.context.runId);
|
|
8185
|
+
pending?.delete(record.context.requestId);
|
|
8186
|
+
if (pending?.size === 0)
|
|
8187
|
+
this.pendingByRun.delete(record.context.runId);
|
|
8188
|
+
}
|
|
8189
|
+
reserveTerminalProjection(record) {
|
|
8190
|
+
record.finishTerminalProjection ??= this.options.reserveRunProjection?.(record.context.runId);
|
|
8191
|
+
}
|
|
8192
|
+
async projectTerminal(record) {
|
|
8193
|
+
if (!record.terminalState)
|
|
8194
|
+
return;
|
|
8195
|
+
const copy = PERMISSION_CARD_COPY[this.options.locale ?? "en"];
|
|
8196
|
+
const cardParamMap = {
|
|
8197
|
+
approved: {
|
|
8198
|
+
card_status: "approved",
|
|
8199
|
+
question_desc: copy.approved.description,
|
|
8200
|
+
form_btn_text: copy.approved.button
|
|
8201
|
+
},
|
|
8202
|
+
denied: {
|
|
8203
|
+
card_status: "denied",
|
|
8204
|
+
question_desc: copy.denied.description,
|
|
8205
|
+
form_btn_text: copy.denied.button
|
|
8206
|
+
},
|
|
8207
|
+
expired: {
|
|
8208
|
+
card_status: "expired",
|
|
8209
|
+
question_desc: copy.expired.description,
|
|
8210
|
+
form_btn_text: copy.expired.button
|
|
8211
|
+
},
|
|
8212
|
+
cancelled: {
|
|
8213
|
+
card_status: "cancelled",
|
|
8214
|
+
question_desc: copy.cancelled.description,
|
|
8215
|
+
form_btn_text: copy.cancelled.button
|
|
8216
|
+
}
|
|
8217
|
+
};
|
|
8218
|
+
try {
|
|
8219
|
+
await this.options.client.updateInstance({
|
|
8220
|
+
outTrackId: record.outTrackId,
|
|
8221
|
+
cardParamMap: cardParamMap[record.terminalState]
|
|
8222
|
+
});
|
|
8223
|
+
} catch (error) {
|
|
8224
|
+
this.options.onError?.("permission card finalization", error);
|
|
8225
|
+
}
|
|
8226
|
+
}
|
|
8227
|
+
parseDecision(record, formData) {
|
|
8228
|
+
if (Object.keys(formData).length !== 1 || !Object.prototype.hasOwnProperty.call(formData, DECISION_FIELD)) {
|
|
8229
|
+
return void 0;
|
|
8230
|
+
}
|
|
8231
|
+
const values = this.readValues(formData[DECISION_FIELD]);
|
|
8232
|
+
if (values.length !== 1)
|
|
8233
|
+
return void 0;
|
|
8234
|
+
const decision = values[0];
|
|
8235
|
+
return record.context.decisions.some((candidate) => candidate.kind === decision) ? decision : void 0;
|
|
8236
|
+
}
|
|
8237
|
+
readValues(value) {
|
|
8238
|
+
if (typeof value === "string")
|
|
8239
|
+
return value.trim() ? [value.trim()] : [];
|
|
8240
|
+
if (Array.isArray(value)) {
|
|
8241
|
+
return value.filter((item) => typeof item === "string").map((item) => item.trim()).filter(Boolean);
|
|
8242
|
+
}
|
|
8243
|
+
if (value !== null && typeof value === "object") {
|
|
8244
|
+
return this.readValues(value["value"]);
|
|
8245
|
+
}
|
|
8246
|
+
return [];
|
|
8247
|
+
}
|
|
8248
|
+
cardData(context) {
|
|
8249
|
+
const copy = PERMISSION_CARD_COPY[this.options.locale ?? "en"];
|
|
8250
|
+
return {
|
|
8251
|
+
question_id: context.requestId,
|
|
8252
|
+
question_title: copy.title,
|
|
8253
|
+
question_desc: context.title,
|
|
8254
|
+
card_status: "pending",
|
|
8255
|
+
form_btn_text: copy.submit,
|
|
8256
|
+
selected_text: "",
|
|
8257
|
+
selected_values: "[]",
|
|
8258
|
+
form: {
|
|
8259
|
+
fields: [
|
|
8260
|
+
{
|
|
8261
|
+
name: DECISION_FIELD,
|
|
8262
|
+
label: copy.choose,
|
|
8263
|
+
type: "CHECKBOX_GROUP",
|
|
8264
|
+
required: true,
|
|
8265
|
+
options: context.decisions.map((decision) => ({
|
|
8266
|
+
value: decision.kind,
|
|
8267
|
+
text: decision.label
|
|
8268
|
+
}))
|
|
8269
|
+
}
|
|
8270
|
+
]
|
|
8271
|
+
}
|
|
8272
|
+
};
|
|
8273
|
+
}
|
|
8274
|
+
};
|
|
8275
|
+
|
|
8276
|
+
// packages/channels/dingtalk/dist/interaction-presenter.js
|
|
8277
|
+
init_esbuild_shims();
|
|
8278
|
+
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
7987
8279
|
function escapeSenderMarkdownText(text) {
|
|
7988
8280
|
return text.replace(/([\\`*_[\]{}()#+.!|>~-])/gu, "\\$1");
|
|
7989
8281
|
}
|
|
@@ -8149,6 +8441,16 @@ var DingtalkInteractionPresenter = class {
|
|
|
8149
8441
|
return Promise.resolve({ kind: "unsupported" });
|
|
8150
8442
|
return questionCards.present(context, this.cardTarget(context.target));
|
|
8151
8443
|
}
|
|
8444
|
+
presentPermission(context) {
|
|
8445
|
+
const run = this.runs.get(context.runId);
|
|
8446
|
+
if (!run || run.terminal || run.ownerId !== context.owner.id || run.target.chatId !== context.target.chatId || run.target.isGroup !== context.target.isGroup) {
|
|
8447
|
+
return Promise.resolve({ kind: "unsupported" });
|
|
8448
|
+
}
|
|
8449
|
+
const permissionCards = this.options.permissionCards;
|
|
8450
|
+
if (!permissionCards)
|
|
8451
|
+
return Promise.resolve({ kind: "unsupported" });
|
|
8452
|
+
return permissionCards.present(context, this.cardTarget(context.target));
|
|
8453
|
+
}
|
|
8152
8454
|
terminalCopy() {
|
|
8153
8455
|
if (this.options.language !== void 0 && !isChinesePresentationLanguage(this.options.language)) {
|
|
8154
8456
|
return {
|
|
@@ -8168,6 +8470,7 @@ var DingtalkInteractionPresenter = class {
|
|
|
8168
8470
|
if (!run || run.terminal)
|
|
8169
8471
|
return;
|
|
8170
8472
|
this.options.questionCards?.cancelRun(runId, terminal === "cancelled" && (detail === "cancel_command" || detail === "clear") ? "cancelled" : "expired");
|
|
8473
|
+
this.options.permissionCards?.cancelRun(runId);
|
|
8171
8474
|
run.terminal = true;
|
|
8172
8475
|
const activeSegmentId = run.activeSegmentId;
|
|
8173
8476
|
run.activeSegmentId = void 0;
|
|
@@ -8323,7 +8626,7 @@ ${this.boundContent(content, Math.max(0, CONTENT_LIMIT - sourceLabel.length - 2)
|
|
|
8323
8626
|
ensureStatusContext(run, segment) {
|
|
8324
8627
|
if (run.statusContext)
|
|
8325
8628
|
return run.statusContext;
|
|
8326
|
-
run.statusContext = segment ? { ...segment } : { ...run.baseContext, segmentId: `${run.runId}:${
|
|
8629
|
+
run.statusContext = segment ? { ...segment } : { ...run.baseContext, segmentId: `${run.runId}:${randomUUID5()}` };
|
|
8327
8630
|
return run.statusContext;
|
|
8328
8631
|
}
|
|
8329
8632
|
cardTarget(target) {
|
|
@@ -8541,9 +8844,6 @@ ${boundedLines.join("\n")}`);
|
|
|
8541
8844
|
}
|
|
8542
8845
|
__name(formatChatRecord, "formatChatRecord");
|
|
8543
8846
|
var DEDUP_TTL_MS = 5 * 60 * 1e3;
|
|
8544
|
-
var BACKGROUND_RESPONSE_AGGREGATION_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
8545
|
-
var BACKGROUND_RESPONSE_AGGREGATION_RETRY_MS = 30 * 1e3;
|
|
8546
|
-
var BACKGROUND_RESPONSE_AGGREGATION_MAX_RETRIES = 3;
|
|
8547
8847
|
var ACK_REACTION_NAME = "\u{1F440}";
|
|
8548
8848
|
var ACK_EMOTION_ID = "2659900";
|
|
8549
8849
|
var ACK_EMOTION_BG_ID = "im_bg_1";
|
|
@@ -8740,30 +9040,6 @@ async function withConnectLoggingSuppressed(connect) {
|
|
|
8740
9040
|
}
|
|
8741
9041
|
}
|
|
8742
9042
|
__name(withConnectLoggingSuppressed, "withConnectLoggingSuppressed");
|
|
8743
|
-
var ProactiveTextDeliveryError = class extends Error {
|
|
8744
|
-
static {
|
|
8745
|
-
__name(this, "ProactiveTextDeliveryError");
|
|
8746
|
-
}
|
|
8747
|
-
plan;
|
|
8748
|
-
retryable;
|
|
8749
|
-
constructor(plan, cause) {
|
|
8750
|
-
super(cause instanceof Error ? cause.message : String(cause), { cause });
|
|
8751
|
-
this.plan = plan;
|
|
8752
|
-
if (cause instanceof DingtalkCardRequestError) {
|
|
8753
|
-
this.retryable = cause.retryable;
|
|
8754
|
-
}
|
|
8755
|
-
}
|
|
8756
|
-
};
|
|
8757
|
-
var ReplyTextDeliveryError = class extends Error {
|
|
8758
|
-
static {
|
|
8759
|
-
__name(this, "ReplyTextDeliveryError");
|
|
8760
|
-
}
|
|
8761
|
-
plan;
|
|
8762
|
-
constructor(plan, cause) {
|
|
8763
|
-
super(cause instanceof Error ? cause.message : String(cause), { cause });
|
|
8764
|
-
this.plan = plan;
|
|
8765
|
-
}
|
|
8766
|
-
};
|
|
8767
9043
|
var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
8768
9044
|
static {
|
|
8769
9045
|
__name(this, "DingtalkChannel");
|
|
@@ -8798,10 +9074,10 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
8798
9074
|
*/
|
|
8799
9075
|
proactiveToken;
|
|
8800
9076
|
interactiveCardConfig;
|
|
8801
|
-
aggregateBackgroundAgentResponses;
|
|
8802
9077
|
interactiveCardClient;
|
|
8803
9078
|
statusCardController;
|
|
8804
9079
|
questionCardController;
|
|
9080
|
+
permissionCardController;
|
|
8805
9081
|
interactionPresenter;
|
|
8806
9082
|
inboundCardOwners = /* @__PURE__ */ new Map();
|
|
8807
9083
|
cardRunBySession = /* @__PURE__ */ new Map();
|
|
@@ -8810,18 +9086,6 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
8810
9086
|
// boundary, input requested) mints a fresh segment UUID but the projection
|
|
8811
9087
|
// state must survive it, or a marker split across the reset leaks.
|
|
8812
9088
|
fileProjectors = /* @__PURE__ */ new Map();
|
|
8813
|
-
blockFileProjectors = /* @__PURE__ */ new Map();
|
|
8814
|
-
// Sessions armed for block projection by onPromptStart and disarmed when
|
|
8815
|
-
// the turn settles (or the session dies). A block send that finds NO
|
|
8816
|
-
// projector state is only legitimate as a turn's FIRST block, which always
|
|
8817
|
-
// lands while armed: late sends from an evicted (/clear) or dead session
|
|
8818
|
-
// must be dropped, because recreating state would post the tail of a
|
|
8819
|
-
// force-split [FILE: ...] marker verbatim.
|
|
8820
|
-
blockProjectionArmed = /* @__PURE__ */ new Set();
|
|
8821
|
-
backgroundResponseAggregations = /* @__PURE__ */ new Map();
|
|
8822
|
-
detachedBackgroundResponseAggregations = /* @__PURE__ */ new Set();
|
|
8823
|
-
pendingBackgroundResponseTerminals = /* @__PURE__ */ new Map();
|
|
8824
|
-
detachedPendingBackgroundResponseTerminals = /* @__PURE__ */ new Set();
|
|
8825
9089
|
constructor(name, config, bridge, options) {
|
|
8826
9090
|
super(name, config, bridge, options);
|
|
8827
9091
|
this.atSender = config["atSender"] === true;
|
|
@@ -8836,15 +9100,10 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
8836
9100
|
} else if (!this.config.instructions.includes("[IMAGE:")) {
|
|
8837
9101
|
this.config.instructions += IMAGE_INSTRUCTIONS;
|
|
8838
9102
|
}
|
|
8839
|
-
if (
|
|
9103
|
+
if (!this.config.instructions.includes("[FILE:")) {
|
|
8840
9104
|
this.config.instructions += FILE_INSTRUCTIONS;
|
|
8841
9105
|
}
|
|
8842
9106
|
this.interactiveCardConfig = parseDingtalkInteractiveCardConfig(config.interactiveCards);
|
|
8843
|
-
const rawAggregateBackgroundAgentResponses = config.aggregateBackgroundAgentResponses;
|
|
8844
|
-
if (rawAggregateBackgroundAgentResponses !== void 0 && typeof rawAggregateBackgroundAgentResponses !== "boolean") {
|
|
8845
|
-
throw new Error(`Channel "${name}" aggregateBackgroundAgentResponses must be a boolean.`);
|
|
8846
|
-
}
|
|
8847
|
-
this.aggregateBackgroundAgentResponses = rawAggregateBackgroundAgentResponses === true;
|
|
8848
9107
|
if (!config.clientId || !config.clientSecret) {
|
|
8849
9108
|
throw new Error(`Channel "${name}" requires clientId and clientSecret for DingTalk.`);
|
|
8850
9109
|
}
|
|
@@ -8864,7 +9123,7 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
8864
9123
|
}
|
|
8865
9124
|
}, "invalidateAccessToken")
|
|
8866
9125
|
});
|
|
8867
|
-
if (this.interactiveCardConfig.statusCard.enabled
|
|
9126
|
+
if (this.interactiveCardConfig.statusCard.enabled) {
|
|
8868
9127
|
this.statusCardController = new StatusCardController({
|
|
8869
9128
|
client: this.interactiveCardClient,
|
|
8870
9129
|
cancelRun: /* @__PURE__ */ __name((sessionId, runId) => this.requestPromptRunCancellation(sessionId, runId), "cancelRun"),
|
|
@@ -8888,14 +9147,25 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
8888
9147
|
}, "onError")
|
|
8889
9148
|
});
|
|
8890
9149
|
}
|
|
8891
|
-
if (this.
|
|
9150
|
+
if (this.interactiveCardConfig.permissionCard.enabled) {
|
|
9151
|
+
this.permissionCardController = new PermissionCardController({
|
|
9152
|
+
client: this.interactiveCardClient,
|
|
9153
|
+
timeoutMs: this.interactiveCardConfig.permissionCard.timeoutMs,
|
|
9154
|
+
locale: this.locale,
|
|
9155
|
+
reserveRunProjection: /* @__PURE__ */ __name((runId) => this.interactionPresenter?.reserveProjection(runId), "reserveRunProjection"),
|
|
9156
|
+
onError: /* @__PURE__ */ __name((operation, error) => {
|
|
9157
|
+
process.stderr.write(`[DingTalk:${this.name}] ${operation} failed: ${sanitizeLogText(String(error), 300)}
|
|
9158
|
+
`);
|
|
9159
|
+
}, "onError")
|
|
9160
|
+
});
|
|
9161
|
+
}
|
|
9162
|
+
if (this.statusCardController || this.questionCardController || this.permissionCardController) {
|
|
8892
9163
|
this.interactionPresenter = new DingtalkInteractionPresenter({
|
|
8893
9164
|
statusCards: this.statusCardController,
|
|
8894
9165
|
questionCards: this.questionCardController,
|
|
9166
|
+
permissionCards: this.permissionCardController,
|
|
8895
9167
|
...options?.displayLanguage ? { language: options.displayLanguage } : {},
|
|
8896
|
-
|
|
8897
|
-
sendFallback: /* @__PURE__ */ __name((chatId, text, sessionId, sourceLabel) => this.sendFallbackReply(chatId, text, sessionId, sourceLabel), "sendFallback")
|
|
8898
|
-
} : {}
|
|
9168
|
+
sendFallback: /* @__PURE__ */ __name((chatId, text, sessionId, sourceLabel) => this.sendFallbackReply(chatId, text, sessionId, sourceLabel), "sendFallback")
|
|
8899
9169
|
});
|
|
8900
9170
|
}
|
|
8901
9171
|
}
|
|
@@ -8979,7 +9249,11 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
8979
9249
|
if (callback.actionId === "btn_stop") {
|
|
8980
9250
|
return this.statusCardController?.claimStop(callback.outTrackId, callback.actorId) ?? { kind: "ignored", actorId: callback.actorId };
|
|
8981
9251
|
}
|
|
8982
|
-
|
|
9252
|
+
const permissionResult = this.permissionCardController?.claim(callback);
|
|
9253
|
+
if (permissionResult && permissionResult.kind !== "ignored") {
|
|
9254
|
+
return permissionResult;
|
|
9255
|
+
}
|
|
9256
|
+
return this.questionCardController?.claim(callback) ?? permissionResult ?? {
|
|
8983
9257
|
kind: "ignored",
|
|
8984
9258
|
actorId: callback.actorId
|
|
8985
9259
|
};
|
|
@@ -9191,9 +9465,6 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9191
9465
|
process.stderr.write(`[DingTalk:${this.name}] file markers projected (final=${projection.markerCount}, streamed=${streamedMarkers})
|
|
9192
9466
|
`);
|
|
9193
9467
|
}
|
|
9194
|
-
if (this.config.blockStreaming === "on" && (projection.markerCount > 0 || streamedMarkers > 0)) {
|
|
9195
|
-
return this.prepareOutgoingText(withFileUnavailableNotice(projection.text));
|
|
9196
|
-
}
|
|
9197
9468
|
const notices = [];
|
|
9198
9469
|
if (projection.invalidMarkers > 0) {
|
|
9199
9470
|
notices.push("[File delivery failed: invalid marker]");
|
|
@@ -9244,25 +9515,18 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9244
9515
|
}
|
|
9245
9516
|
return replaceImageMarkers(text, markers, replacements);
|
|
9246
9517
|
}
|
|
9247
|
-
async sendReply(chatId, text, atUserId, sourceLabel, prepared = false
|
|
9518
|
+
async sendReply(chatId, text, atUserId, sourceLabel, prepared = false) {
|
|
9248
9519
|
const webhook = this.webhooks.get(chatId);
|
|
9249
9520
|
if (!webhook) {
|
|
9250
9521
|
process.stderr.write(`[DingTalk:${this.name}] No webhook for chatId ${chatId}, cannot send.
|
|
9251
9522
|
`);
|
|
9252
|
-
if (failOnHttpError) {
|
|
9253
|
-
throw new Error("DingTalk session webhook unavailable");
|
|
9254
|
-
}
|
|
9255
9523
|
return;
|
|
9256
9524
|
}
|
|
9257
9525
|
const outgoingText = prepared ? text : await this.prepareReplyOutput(chatId, text);
|
|
9258
9526
|
if (!outgoingText.trim())
|
|
9259
9527
|
return;
|
|
9260
9528
|
const plan = this.createReplyTextDelivery(outgoingText, atUserId, sourceLabel);
|
|
9261
|
-
|
|
9262
|
-
await this.deliverReplyText(chatId, plan, failOnHttpError);
|
|
9263
|
-
} catch (error) {
|
|
9264
|
-
throw new ReplyTextDeliveryError(plan, error);
|
|
9265
|
-
}
|
|
9529
|
+
await this.deliverReplyText(chatId, plan);
|
|
9266
9530
|
}
|
|
9267
9531
|
createReplyTextDelivery(outgoingText, atUserId, sourceLabel) {
|
|
9268
9532
|
const mentionPrefix = atUserId ? `@${atUserId}
|
|
@@ -9283,12 +9547,9 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9283
9547
|
...atUserId ? { atUserId } : {}
|
|
9284
9548
|
};
|
|
9285
9549
|
}
|
|
9286
|
-
async deliverReplyText(chatId, plan
|
|
9550
|
+
async deliverReplyText(chatId, plan) {
|
|
9287
9551
|
const webhook = this.webhooks.get(chatId);
|
|
9288
9552
|
if (!webhook) {
|
|
9289
|
-
if (failOnHttpError) {
|
|
9290
|
-
throw new Error("DingTalk session webhook unavailable");
|
|
9291
|
-
}
|
|
9292
9553
|
return;
|
|
9293
9554
|
}
|
|
9294
9555
|
while (plan.nextChunk < plan.chunks.length) {
|
|
@@ -9328,19 +9589,6 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9328
9589
|
const detail = await resp.text().catch(() => "");
|
|
9329
9590
|
process.stderr.write(`[DingTalk:${this.name}] sendMessage failed: HTTP ${resp.status} ${detail}
|
|
9330
9591
|
`);
|
|
9331
|
-
if (failOnHttpError) {
|
|
9332
|
-
throw new Error(`DingTalk reply send failed: HTTP ${resp.status} ${detail}`);
|
|
9333
|
-
}
|
|
9334
|
-
} else if (failOnHttpError) {
|
|
9335
|
-
const payload = await resp.clone().json().catch(() => void 0);
|
|
9336
|
-
const response = payload && typeof payload === "object" ? payload : void 0;
|
|
9337
|
-
const value = response?.["errcode"] ?? response?.["code"];
|
|
9338
|
-
if (value !== void 0 && String(value) !== "0") {
|
|
9339
|
-
const detail = sanitizeLogText(String(response?.["errmsg"] ?? response?.["message"] ?? value), 300);
|
|
9340
|
-
process.stderr.write(`[DingTalk:${this.name}] sendMessage failed: ${detail}
|
|
9341
|
-
`);
|
|
9342
|
-
throw new Error(`DingTalk reply send failed: ${detail}`);
|
|
9343
|
-
}
|
|
9344
9592
|
}
|
|
9345
9593
|
plan.nextChunk++;
|
|
9346
9594
|
}
|
|
@@ -9375,11 +9623,7 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9375
9623
|
const plan = await this.createProactiveTextDelivery(target, text, sourceLabel);
|
|
9376
9624
|
if (!plan)
|
|
9377
9625
|
return;
|
|
9378
|
-
|
|
9379
|
-
await this.deliverProactiveText(target, plan);
|
|
9380
|
-
} catch (error) {
|
|
9381
|
-
throw new ProactiveTextDeliveryError(plan, error);
|
|
9382
|
-
}
|
|
9626
|
+
await this.deliverProactiveText(target, plan);
|
|
9383
9627
|
}
|
|
9384
9628
|
async createProactiveTextDelivery(target, text, sourceLabel) {
|
|
9385
9629
|
const outgoingText = await this.prepareFileOutput(text, (file, mediaId) => this.sendProactiveFile(target, file, mediaId));
|
|
@@ -9432,20 +9676,29 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9432
9676
|
return data.access_token;
|
|
9433
9677
|
}
|
|
9434
9678
|
sendCardInteractionFeedback(actorId, target) {
|
|
9679
|
+
const copy = this.locale === "zh" ? {
|
|
9680
|
+
title: "\u5361\u7247\u64CD\u4F5C",
|
|
9681
|
+
group: "\u4EC5\u4EFB\u52A1\u53D1\u8D77\u4EBA\u53EF\u4EE5\u64CD\u4F5C\u8FD9\u5F20\u5361\u7247\uFF0C\u672C\u6B21\u64CD\u4F5C\u672A\u751F\u6548\u3002",
|
|
9682
|
+
direct: "\u4F60\u65E0\u6743\u64CD\u4F5C\u8FD9\u5F20\u5361\u7247\uFF0C\u4EC5\u4EFB\u52A1\u53D1\u8D77\u4EBA\u53EF\u4EE5\u63D0\u4EA4\u6216\u505C\u6B62\u3002"
|
|
9683
|
+
} : {
|
|
9684
|
+
title: "Card interaction",
|
|
9685
|
+
group: "Only the task initiator can operate this card. This action had no effect.",
|
|
9686
|
+
direct: "You cannot operate this card. Only the task initiator can submit or stop it."
|
|
9687
|
+
};
|
|
9435
9688
|
if (target?.isGroup) {
|
|
9436
9689
|
return this.sendProactiveChunk({
|
|
9437
9690
|
channelName: this.name,
|
|
9438
9691
|
senderId: actorId,
|
|
9439
9692
|
chatId: target.chatId,
|
|
9440
9693
|
isGroup: true
|
|
9441
|
-
},
|
|
9694
|
+
}, copy.title, copy.group, "card interaction feedback");
|
|
9442
9695
|
}
|
|
9443
9696
|
return this.sendProactiveChunk({
|
|
9444
9697
|
channelName: this.name,
|
|
9445
9698
|
senderId: actorId,
|
|
9446
9699
|
chatId: actorId,
|
|
9447
9700
|
isGroup: false
|
|
9448
|
-
},
|
|
9701
|
+
}, copy.title, copy.direct, "card interaction feedback");
|
|
9449
9702
|
}
|
|
9450
9703
|
async sendProactiveChunk(target, title, text, chunkLabel) {
|
|
9451
9704
|
return this.sendProactivePayload(target, PROACTIVE_MSG_KEY, { title, text }, chunkLabel);
|
|
@@ -9605,7 +9858,6 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9605
9858
|
this.finishReaction(state.chatId, state.messageId, state.sessionId);
|
|
9606
9859
|
}
|
|
9607
9860
|
this.statusCardController?.dispose();
|
|
9608
|
-
this.drainBackgroundResponseAggregations();
|
|
9609
9861
|
this.activeReactionKeys.clear();
|
|
9610
9862
|
this.sessionReactionKeys.clear();
|
|
9611
9863
|
this.reactionStates.clear();
|
|
@@ -9841,8 +10093,6 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9841
10093
|
}
|
|
9842
10094
|
/** Recall reactions left behind when a session dies without terminal lifecycle events. */
|
|
9843
10095
|
onSessionDied(sessionId) {
|
|
9844
|
-
this.blockProjectionArmed.delete(sessionId);
|
|
9845
|
-
this.blockFileProjectors.delete(sessionId);
|
|
9846
10096
|
for (const [runId, state] of this.fileProjectors) {
|
|
9847
10097
|
if (state.sessionId === sessionId)
|
|
9848
10098
|
this.fileProjectors.delete(runId);
|
|
@@ -9856,7 +10106,6 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9856
10106
|
}
|
|
9857
10107
|
}
|
|
9858
10108
|
this.sessionMentionTargets.delete(sessionId);
|
|
9859
|
-
this.drainBackgroundResponseAggregations(sessionId);
|
|
9860
10109
|
const cardRunId = this.cardRunBySession.get(sessionId);
|
|
9861
10110
|
if (cardRunId) {
|
|
9862
10111
|
this.cardRunBySession.delete(sessionId);
|
|
@@ -9892,9 +10141,6 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9892
10141
|
this.cardRuns.delete(runId);
|
|
9893
10142
|
}
|
|
9894
10143
|
}
|
|
9895
|
-
onSessionRetiring(sessionId) {
|
|
9896
|
-
this.drainBackgroundResponseAggregations(sessionId);
|
|
9897
|
-
}
|
|
9898
10144
|
onTaskLifecycle(event) {
|
|
9899
10145
|
if (event.type === "started") {
|
|
9900
10146
|
this.startReaction(event.chatId, event.messageId, event.sessionId);
|
|
@@ -9966,7 +10212,6 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9966
10212
|
}
|
|
9967
10213
|
}
|
|
9968
10214
|
onPromptStart(chatId, sessionId, messageId) {
|
|
9969
|
-
this.blockProjectionArmed.add(sessionId);
|
|
9970
10215
|
if (messageId) {
|
|
9971
10216
|
this.bufferedMentionTargets.delete(messageId);
|
|
9972
10217
|
this.untrackBufferedMentionTarget(sessionId, messageId);
|
|
@@ -10029,576 +10274,15 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
10029
10274
|
this.bufferedMentionTargetsBySession.delete(sessionId);
|
|
10030
10275
|
}
|
|
10031
10276
|
onPromptEnd(chatId, sessionId, messageId) {
|
|
10032
|
-
this.settleBlockFileProjector(chatId, sessionId);
|
|
10033
10277
|
this.sessionMentionTargets.delete(sessionId);
|
|
10034
10278
|
this.stopReaction(chatId, messageId, sessionId);
|
|
10035
10279
|
}
|
|
10036
|
-
/**
|
|
10037
|
-
* Turn end is the only point where the block projector's held state can be
|
|
10038
|
-
* settled: ChannelBase drains the turn's queued block sends before calling
|
|
10039
|
-
* onPromptEnd, so everything already appended belongs to this turn. Flush
|
|
10040
|
-
* the held candidate bytes (a trailing `[FILE:` prefix the stream never
|
|
10041
|
-
* completed) before deleting the entry — a later delete-without-settle
|
|
10042
|
-
* would silently drop them from the delivered answer. Also disarm the
|
|
10043
|
-
* session: /clear eviction and session death settle WITHOUT draining the
|
|
10044
|
-
* turn's send chain, and any block that lands afterwards must be dropped
|
|
10045
|
-
* rather than recreating projector state.
|
|
10046
|
-
*/
|
|
10047
|
-
settleBlockFileProjector(chatId, sessionId) {
|
|
10048
|
-
this.blockProjectionArmed.delete(sessionId);
|
|
10049
|
-
const state = this.blockFileProjectors.get(sessionId);
|
|
10050
|
-
if (!state)
|
|
10051
|
-
return;
|
|
10052
|
-
this.blockFileProjectors.delete(sessionId);
|
|
10053
|
-
const tail = state.projector.complete();
|
|
10054
|
-
if (!tail.trim())
|
|
10055
|
-
return;
|
|
10056
|
-
void this.sendReply(chatId, tail, void 0, this.getResponseSourceLabel(sessionId)).catch((err) => {
|
|
10057
|
-
process.stderr.write(`[DingTalk:${this.name}] projector tail delivery failed for session ${sessionId}: ${err instanceof Error ? err.message : String(err)}
|
|
10058
|
-
`);
|
|
10059
|
-
});
|
|
10060
|
-
}
|
|
10061
|
-
/** Deliver every Agent segment immediately unless aggregation is enabled. */
|
|
10062
10280
|
async dispatchBackgroundResponse(sessionId, text, context) {
|
|
10063
10281
|
const target = this.router.getTarget(sessionId);
|
|
10064
|
-
if (!target || target.channelName !== this.name || context !== void 0 && context.kind !== "agent") {
|
|
10282
|
+
if (!target || target.channelName !== this.name || context !== void 0 && context.kind !== "agent" || !text.trim()) {
|
|
10065
10283
|
return super.dispatchBackgroundResponse(sessionId, text, context);
|
|
10066
10284
|
}
|
|
10067
|
-
|
|
10068
|
-
if (!canAggregate) {
|
|
10069
|
-
if (text.trim().length === 0) {
|
|
10070
|
-
return super.dispatchBackgroundResponse(sessionId, text, context);
|
|
10071
|
-
}
|
|
10072
|
-
return super.dispatchBackgroundResponse(sessionId, this.formatBackgroundAgentResponse(text, context?.label), context);
|
|
10073
|
-
}
|
|
10074
|
-
const key = JSON.stringify([sessionId, context.taskId, context.turnId]);
|
|
10075
|
-
let current = this.backgroundResponseAggregations.get(key);
|
|
10076
|
-
let parked = this.pendingBackgroundResponseTerminals.get(key);
|
|
10077
|
-
if (current?.turnComplete === true) {
|
|
10078
|
-
this.detachedBackgroundResponseAggregations.add(current);
|
|
10079
|
-
this.backgroundResponseAggregations.delete(key);
|
|
10080
|
-
current = void 0;
|
|
10081
|
-
}
|
|
10082
|
-
if (!current && (parked?.turnEnded === true || parked?.turnComplete === true && (parked.retryTimer || parked.retryInFlight || parked.resolvers > 0))) {
|
|
10083
|
-
if (!parked.turnEnded) {
|
|
10084
|
-
this.detachedPendingBackgroundResponseTerminals.add(parked);
|
|
10085
|
-
}
|
|
10086
|
-
parked = { sessionId, target, resolvers: 0, held: [] };
|
|
10087
|
-
this.pendingBackgroundResponseTerminals.set(key, parked);
|
|
10088
|
-
}
|
|
10089
|
-
if (!current && text.trim().length === 0) {
|
|
10090
|
-
if (!parked || parked.resolvers === 0 && !parked.retryTimer && !parked.retryInFlight && !parked.resolutionDropped && !parked.turnComplete) {
|
|
10091
|
-
if (parked)
|
|
10092
|
-
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10093
|
-
return super.dispatchBackgroundResponse(sessionId, text, context);
|
|
10094
|
-
}
|
|
10095
|
-
if (context.turnComplete) {
|
|
10096
|
-
parked.turnComplete = true;
|
|
10097
|
-
parked.status = context.status;
|
|
10098
|
-
parked.label = context.label ?? parked.label;
|
|
10099
|
-
parked.completionPartial = context.partial === true;
|
|
10100
|
-
if (parked.resolvers === 0 && !parked.retryTimer && !parked.retryInFlight && (parked.retryAttempts ?? 0) >= BACKGROUND_RESPONSE_AGGREGATION_MAX_RETRIES) {
|
|
10101
|
-
parked.turnEnded = true;
|
|
10102
|
-
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10103
|
-
}
|
|
10104
|
-
}
|
|
10105
|
-
return;
|
|
10106
|
-
}
|
|
10107
|
-
if (!current) {
|
|
10108
|
-
parked ??= { sessionId, target, resolvers: 0, held: [] };
|
|
10109
|
-
this.pendingBackgroundResponseTerminals.set(key, parked);
|
|
10110
|
-
this.holdPendingBackgroundResponse(parked, text, context);
|
|
10111
|
-
parked.resolvers++;
|
|
10112
|
-
try {
|
|
10113
|
-
let delivery;
|
|
10114
|
-
try {
|
|
10115
|
-
delivery = await this.resolveBackgroundResponseDelivery(sessionId);
|
|
10116
|
-
} catch (error) {
|
|
10117
|
-
if (parked.resolvers === 1 && !this.backgroundResponseAggregations.has(key)) {
|
|
10118
|
-
this.scheduleBackgroundResponseResolutionRetry(key, sessionId, parked);
|
|
10119
|
-
} else {
|
|
10120
|
-
const existing = this.backgroundResponseAggregations.get(key);
|
|
10121
|
-
if (existing) {
|
|
10122
|
-
if (parked.held.length > 0) {
|
|
10123
|
-
this.applyHeldBackgroundResponses(existing, parked);
|
|
10124
|
-
}
|
|
10125
|
-
this.applyPendingBackgroundResponseTerminal(existing, parked);
|
|
10126
|
-
if (parked.resolvers === 1) {
|
|
10127
|
-
if (existing.turnComplete) {
|
|
10128
|
-
await this.completeBackgroundResponseAggregation(key, existing);
|
|
10129
|
-
} else {
|
|
10130
|
-
this.scheduleBackgroundResponseAggregationFlush(key, existing);
|
|
10131
|
-
}
|
|
10132
|
-
}
|
|
10133
|
-
}
|
|
10134
|
-
}
|
|
10135
|
-
throw error;
|
|
10136
|
-
}
|
|
10137
|
-
if (!delivery || this.router.getTarget(sessionId) !== delivery.target) {
|
|
10138
|
-
if (parked.resolvers === 1 && !this.backgroundResponseAggregations.has(key)) {
|
|
10139
|
-
this.scheduleBackgroundResponseResolutionRetry(key, sessionId, parked);
|
|
10140
|
-
} else {
|
|
10141
|
-
const existing = this.backgroundResponseAggregations.get(key);
|
|
10142
|
-
if (existing) {
|
|
10143
|
-
if (parked.held.length > 0) {
|
|
10144
|
-
this.applyHeldBackgroundResponses(existing, parked);
|
|
10145
|
-
}
|
|
10146
|
-
this.applyPendingBackgroundResponseTerminal(existing, parked);
|
|
10147
|
-
if (parked.resolvers === 1) {
|
|
10148
|
-
if (existing.turnComplete) {
|
|
10149
|
-
await this.completeBackgroundResponseAggregation(key, existing);
|
|
10150
|
-
} else {
|
|
10151
|
-
this.scheduleBackgroundResponseAggregationFlush(key, existing);
|
|
10152
|
-
}
|
|
10153
|
-
}
|
|
10154
|
-
}
|
|
10155
|
-
}
|
|
10156
|
-
return;
|
|
10157
|
-
}
|
|
10158
|
-
if (parked.retiring || this.pendingBackgroundResponseTerminals.get(key) !== parked) {
|
|
10159
|
-
await this.flushDetachedBackgroundResponse(key, sessionId, parked, delivery);
|
|
10160
|
-
return;
|
|
10161
|
-
}
|
|
10162
|
-
if (parked.retryTimer) {
|
|
10163
|
-
clearTimeout(parked.retryTimer);
|
|
10164
|
-
parked.retryTimer = void 0;
|
|
10165
|
-
}
|
|
10166
|
-
current = this.backgroundResponseAggregations.get(key) ?? this.createBackgroundResponseAggregation(key, sessionId, parked.held[0]?.context ?? context, delivery.target, delivery.sourceLabel);
|
|
10167
|
-
this.applyHeldBackgroundResponses(current, parked);
|
|
10168
|
-
this.applyPendingBackgroundResponseTerminal(current, parked);
|
|
10169
|
-
if (parked.resolutionDropped) {
|
|
10170
|
-
current.resolutionDropped = true;
|
|
10171
|
-
parked.resolutionDropped = void 0;
|
|
10172
|
-
}
|
|
10173
|
-
} finally {
|
|
10174
|
-
parked.resolvers--;
|
|
10175
|
-
if (this.pendingBackgroundResponseTerminals.get(key) === parked && parked.resolvers === 0 && !parked.retryTimer && parked.held.length === 0 && (!parked.resolutionDropped || parked.turnEnded)) {
|
|
10176
|
-
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10177
|
-
}
|
|
10178
|
-
}
|
|
10179
|
-
if (!current)
|
|
10180
|
-
return;
|
|
10181
|
-
if (current.turnComplete && parked.resolvers > 0)
|
|
10182
|
-
return;
|
|
10183
|
-
if (!current.turnComplete) {
|
|
10184
|
-
this.scheduleBackgroundResponseAggregationFlush(key, current);
|
|
10185
|
-
} else {
|
|
10186
|
-
await this.completeBackgroundResponseAggregation(key, current);
|
|
10187
|
-
}
|
|
10188
|
-
return;
|
|
10189
|
-
}
|
|
10190
|
-
current.status = context.status;
|
|
10191
|
-
current.label = context.label ?? current.label;
|
|
10192
|
-
if (text.trim().length > 0)
|
|
10193
|
-
current.parts.push(text);
|
|
10194
|
-
if (context.turnComplete && parked && parked.resolvers > 0) {
|
|
10195
|
-
parked.turnComplete = true;
|
|
10196
|
-
parked.status = context.status;
|
|
10197
|
-
parked.label = context.label ?? parked.label;
|
|
10198
|
-
parked.completionPartial = context.partial === true;
|
|
10199
|
-
} else if (context.turnComplete) {
|
|
10200
|
-
current.turnComplete = true;
|
|
10201
|
-
current.completionPartial = context.partial === true;
|
|
10202
|
-
} else if (parked?.turnComplete && parked.resolvers === 0) {
|
|
10203
|
-
current.turnComplete = true;
|
|
10204
|
-
current.status = parked.status ?? current.status;
|
|
10205
|
-
current.label = parked.label ?? current.label;
|
|
10206
|
-
current.completionPartial = parked.completionPartial === true;
|
|
10207
|
-
}
|
|
10208
|
-
current.resolutionDropped ||= parked?.resolutionDropped;
|
|
10209
|
-
if (!current.turnComplete) {
|
|
10210
|
-
this.scheduleBackgroundResponseAggregationFlush(key, current);
|
|
10211
|
-
return;
|
|
10212
|
-
}
|
|
10213
|
-
await this.completeBackgroundResponseAggregation(key, current);
|
|
10214
|
-
}
|
|
10215
|
-
async flushBackgroundResponseAggregation(key, aggregation) {
|
|
10216
|
-
if (this.backgroundResponseAggregations.get(key) !== aggregation && !this.detachedBackgroundResponseAggregations.has(aggregation) || aggregation.flushing) {
|
|
10217
|
-
return;
|
|
10218
|
-
}
|
|
10219
|
-
this.refreshBackgroundResponseDelivery(aggregation);
|
|
10220
|
-
if (aggregation.retryTimer)
|
|
10221
|
-
clearTimeout(aggregation.retryTimer);
|
|
10222
|
-
aggregation.retryTimer = void 0;
|
|
10223
|
-
let delivery = aggregation.delivery;
|
|
10224
|
-
if (!delivery) {
|
|
10225
|
-
if (aggregation.parts.length === 0) {
|
|
10226
|
-
if (!this.owesTerminalBackgroundResponseCard(aggregation)) {
|
|
10227
|
-
if (aggregation.retiring || aggregation.turnComplete) {
|
|
10228
|
-
this.removeBackgroundResponseAggregation(key, aggregation);
|
|
10229
|
-
} else {
|
|
10230
|
-
this.scheduleBackgroundResponseAggregationFlush(key, aggregation);
|
|
10231
|
-
}
|
|
10232
|
-
return;
|
|
10233
|
-
}
|
|
10234
|
-
}
|
|
10235
|
-
if (aggregation.timeoutTimer)
|
|
10236
|
-
clearTimeout(aggregation.timeoutTimer);
|
|
10237
|
-
aggregation.timeoutTimer = void 0;
|
|
10238
|
-
const parts = aggregation.parts.splice(0);
|
|
10239
|
-
delivery = {
|
|
10240
|
-
status: aggregation.status,
|
|
10241
|
-
label: aggregation.label,
|
|
10242
|
-
parts,
|
|
10243
|
-
partial: this.isPartialBackgroundResponseDelivery(aggregation, parts.length),
|
|
10244
|
-
attempts: 0,
|
|
10245
|
-
composedTurnComplete: aggregation.turnComplete === true
|
|
10246
|
-
};
|
|
10247
|
-
aggregation.delivery = delivery;
|
|
10248
|
-
}
|
|
10249
|
-
const body = this.formatBackgroundResponseAggregation(delivery);
|
|
10250
|
-
aggregation.flushing = true;
|
|
10251
|
-
let error;
|
|
10252
|
-
try {
|
|
10253
|
-
if (delivery.proactivePlan) {
|
|
10254
|
-
await this.deliverProactiveText(aggregation.target, delivery.proactivePlan);
|
|
10255
|
-
} else if (delivery.replyPlan) {
|
|
10256
|
-
await this.deliverReplyText(aggregation.target.chatId, delivery.replyPlan, true);
|
|
10257
|
-
} else if (this.supportsProactiveSend() && this.supportsProactiveTarget(aggregation.target)) {
|
|
10258
|
-
await this.deliverBackgroundResponseToTarget(aggregation.sessionId, body, {
|
|
10259
|
-
target: aggregation.target,
|
|
10260
|
-
sourceLabel: aggregation.sourceLabel
|
|
10261
|
-
});
|
|
10262
|
-
} else {
|
|
10263
|
-
delivery.preparedReplyBody ??= await this.prepareReplyOutput(aggregation.target.chatId, body);
|
|
10264
|
-
await this.deliverBackgroundReply(aggregation.target.chatId, delivery.preparedReplyBody, aggregation.sessionId, aggregation.sourceLabel, true, true);
|
|
10265
|
-
}
|
|
10266
|
-
} catch (caught) {
|
|
10267
|
-
error = caught;
|
|
10268
|
-
if (caught instanceof ProactiveTextDeliveryError) {
|
|
10269
|
-
delivery.proactivePlan = caught.plan;
|
|
10270
|
-
} else if (caught instanceof ReplyTextDeliveryError) {
|
|
10271
|
-
delivery.replyPlan = caught.plan;
|
|
10272
|
-
}
|
|
10273
|
-
} finally {
|
|
10274
|
-
aggregation.flushing = false;
|
|
10275
|
-
}
|
|
10276
|
-
if (error === void 0) {
|
|
10277
|
-
aggregation.delivery = void 0;
|
|
10278
|
-
aggregation.delivered = true;
|
|
10279
|
-
if (delivery.composedTurnComplete === true && aggregation.turnComplete && delivery.partial !== true && !aggregation.retiring) {
|
|
10280
|
-
aggregation.completionDelivered = true;
|
|
10281
|
-
}
|
|
10282
|
-
if (aggregation.retiring || aggregation.turnComplete) {
|
|
10283
|
-
await this.flushBackgroundResponseAggregation(key, aggregation);
|
|
10284
|
-
} else {
|
|
10285
|
-
this.scheduleBackgroundResponseAggregationFlush(key, aggregation);
|
|
10286
|
-
}
|
|
10287
|
-
return;
|
|
10288
|
-
}
|
|
10289
|
-
delivery.attempts++;
|
|
10290
|
-
process.stderr.write(`[DingTalk:${this.name}] background response delivery failed (attempt ${delivery.attempts}): ${sanitizeLogText(error instanceof Error ? error.message : String(error), 300)}
|
|
10291
|
-
`);
|
|
10292
|
-
if (delivery.attempts >= BACKGROUND_RESPONSE_AGGREGATION_MAX_RETRIES || // A permanently rejected send (an invalid appkey, a missing app) cannot
|
|
10293
|
-
// succeed later; retrying it only spends the chat's send quota.
|
|
10294
|
-
error instanceof ProactiveTextDeliveryError && error.retryable === false) {
|
|
10295
|
-
aggregation.delivery = void 0;
|
|
10296
|
-
aggregation.dropped = true;
|
|
10297
|
-
if (aggregation.parts.length === 0) {
|
|
10298
|
-
if (aggregation.retiring || aggregation.turnComplete) {
|
|
10299
|
-
this.removeBackgroundResponseAggregation(key, aggregation);
|
|
10300
|
-
} else {
|
|
10301
|
-
this.scheduleBackgroundResponseAggregationFlush(key, aggregation);
|
|
10302
|
-
}
|
|
10303
|
-
} else if (aggregation.retiring || aggregation.turnComplete) {
|
|
10304
|
-
await this.flushBackgroundResponseAggregation(key, aggregation);
|
|
10305
|
-
} else {
|
|
10306
|
-
this.scheduleBackgroundResponseAggregationFlush(key, aggregation);
|
|
10307
|
-
}
|
|
10308
|
-
return;
|
|
10309
|
-
}
|
|
10310
|
-
aggregation.retryTimer = setTimeout(() => {
|
|
10311
|
-
aggregation.retryTimer = void 0;
|
|
10312
|
-
void this.flushBackgroundResponseAggregation(key, aggregation);
|
|
10313
|
-
}, BACKGROUND_RESPONSE_AGGREGATION_RETRY_MS);
|
|
10314
|
-
aggregation.retryTimer.unref?.();
|
|
10315
|
-
}
|
|
10316
|
-
/**
|
|
10317
|
-
* A card carries `(部分)` whenever it is not the turn's whole output: the
|
|
10318
|
-
* turn is still open, earlier text already went out (or was given up on),
|
|
10319
|
-
* or the turn itself ended early.
|
|
10320
|
-
*/
|
|
10321
|
-
isPartialBackgroundResponseDelivery(aggregation, partCount) {
|
|
10322
|
-
return partCount > 0 && (aggregation.delivered === true || aggregation.dropped === true || aggregation.resolutionDropped === true || aggregation.retiring === true || aggregation.completionPartial === true || aggregation.turnComplete !== true);
|
|
10323
|
-
}
|
|
10324
|
-
/**
|
|
10325
|
-
* A turn that outran the bounded wait had its text delivered under the
|
|
10326
|
-
* `(部分)` label. When it then completes normally with nothing buffered,
|
|
10327
|
-
* a header-only card is the only way the chat ever learns it finished.
|
|
10328
|
-
*/
|
|
10329
|
-
owesTerminalBackgroundResponseCard(aggregation) {
|
|
10330
|
-
return aggregation.turnComplete === true && aggregation.delivered === true && aggregation.completionDelivered !== true && aggregation.retiring !== true && aggregation.completionPartial !== true && aggregation.dropped !== true && aggregation.resolutionDropped !== true;
|
|
10331
|
-
}
|
|
10332
|
-
refreshBackgroundResponseDelivery(aggregation) {
|
|
10333
|
-
const delivery = aggregation.delivery;
|
|
10334
|
-
if (!delivery || aggregation.flushing)
|
|
10335
|
-
return;
|
|
10336
|
-
const plan = delivery.proactivePlan ?? delivery.replyPlan;
|
|
10337
|
-
if (plan && plan.nextChunk > 0)
|
|
10338
|
-
return;
|
|
10339
|
-
const body = this.formatBackgroundResponseAggregation(delivery);
|
|
10340
|
-
const header = body.split("\n", 1)[0];
|
|
10341
|
-
const replaceHeader = /* @__PURE__ */ __name((text) => text.replace(/## (?:✅|❌|⏹️) Agent · [^\n]+/, () => header), "replaceHeader");
|
|
10342
|
-
if (plan) {
|
|
10343
|
-
plan.title = extractTitle(body);
|
|
10344
|
-
plan.chunks[0] = replaceHeader(plan.chunks[0]);
|
|
10345
|
-
}
|
|
10346
|
-
if (delivery.preparedReplyBody) {
|
|
10347
|
-
delivery.preparedReplyBody = replaceHeader(delivery.preparedReplyBody);
|
|
10348
|
-
}
|
|
10349
|
-
delivery.composedTurnComplete = aggregation.turnComplete === true;
|
|
10350
|
-
}
|
|
10351
|
-
removeBackgroundResponseAggregation(key, aggregation) {
|
|
10352
|
-
if (this.backgroundResponseAggregations.get(key) === aggregation) {
|
|
10353
|
-
this.backgroundResponseAggregations.delete(key);
|
|
10354
|
-
}
|
|
10355
|
-
this.detachedBackgroundResponseAggregations.delete(aggregation);
|
|
10356
|
-
}
|
|
10357
|
-
drainBackgroundResponseAggregations(sessionId) {
|
|
10358
|
-
for (const [key, pending] of this.pendingBackgroundResponseTerminals) {
|
|
10359
|
-
if (sessionId !== void 0 && pending.sessionId !== sessionId)
|
|
10360
|
-
continue;
|
|
10361
|
-
if (pending.retryTimer)
|
|
10362
|
-
clearTimeout(pending.retryTimer);
|
|
10363
|
-
pending.retryTimer = void 0;
|
|
10364
|
-
pending.retiring = true;
|
|
10365
|
-
pending.turnComplete = true;
|
|
10366
|
-
pending.completionPartial = true;
|
|
10367
|
-
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10368
|
-
this.detachedPendingBackgroundResponseTerminals.add(pending);
|
|
10369
|
-
}
|
|
10370
|
-
for (const pending of this.detachedPendingBackgroundResponseTerminals) {
|
|
10371
|
-
if (sessionId !== void 0 && pending.sessionId !== sessionId)
|
|
10372
|
-
continue;
|
|
10373
|
-
if (pending.retryTimer)
|
|
10374
|
-
clearTimeout(pending.retryTimer);
|
|
10375
|
-
pending.retryTimer = void 0;
|
|
10376
|
-
pending.retiring = true;
|
|
10377
|
-
pending.turnComplete = true;
|
|
10378
|
-
pending.completionPartial = true;
|
|
10379
|
-
if (pending.held.length > 0 && this.router.getTarget(pending.sessionId) === pending.target) {
|
|
10380
|
-
void this.flushDetachedBackgroundResponse("", pending.sessionId, pending, { target: pending.target }).catch((error) => {
|
|
10381
|
-
process.stderr.write(`[DingTalk:${this.name}] background response delivery failed during drain: ${sanitizeLogText(error instanceof Error ? error.message : String(error), 300)}
|
|
10382
|
-
`);
|
|
10383
|
-
});
|
|
10384
|
-
} else if (pending.held.length > 0) {
|
|
10385
|
-
process.stderr.write(`[DingTalk:${this.name}] background response target unavailable during drain; ${pending.held.length} buffered segment(s) discarded
|
|
10386
|
-
`);
|
|
10387
|
-
pending.held.length = 0;
|
|
10388
|
-
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10389
|
-
} else if (pending.held.length === 0) {
|
|
10390
|
-
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10391
|
-
}
|
|
10392
|
-
}
|
|
10393
|
-
const aggregations = /* @__PURE__ */ new Set([
|
|
10394
|
-
...this.backgroundResponseAggregations.values(),
|
|
10395
|
-
...this.detachedBackgroundResponseAggregations
|
|
10396
|
-
]);
|
|
10397
|
-
for (const aggregation of aggregations) {
|
|
10398
|
-
if (sessionId !== void 0 && aggregation.sessionId !== sessionId) {
|
|
10399
|
-
continue;
|
|
10400
|
-
}
|
|
10401
|
-
if (aggregation.timeoutTimer)
|
|
10402
|
-
clearTimeout(aggregation.timeoutTimer);
|
|
10403
|
-
if (aggregation.retryTimer)
|
|
10404
|
-
clearTimeout(aggregation.retryTimer);
|
|
10405
|
-
aggregation.timeoutTimer = void 0;
|
|
10406
|
-
aggregation.retryTimer = void 0;
|
|
10407
|
-
aggregation.retiring = true;
|
|
10408
|
-
aggregation.turnComplete = true;
|
|
10409
|
-
aggregation.completionPartial = true;
|
|
10410
|
-
if (!aggregation.flushing) {
|
|
10411
|
-
void this.flushBackgroundResponseAggregation(aggregation.key, aggregation);
|
|
10412
|
-
}
|
|
10413
|
-
}
|
|
10414
|
-
}
|
|
10415
|
-
createBackgroundResponseAggregation(key, sessionId, context, target, sourceLabel) {
|
|
10416
|
-
const aggregation = {
|
|
10417
|
-
key,
|
|
10418
|
-
sessionId,
|
|
10419
|
-
target,
|
|
10420
|
-
sourceLabel,
|
|
10421
|
-
status: context.status,
|
|
10422
|
-
label: context.label,
|
|
10423
|
-
parts: []
|
|
10424
|
-
};
|
|
10425
|
-
this.backgroundResponseAggregations.set(key, aggregation);
|
|
10426
|
-
return aggregation;
|
|
10427
|
-
}
|
|
10428
|
-
scheduleBackgroundResponseResolutionRetry(key, sessionId, pending) {
|
|
10429
|
-
if (pending.retiring)
|
|
10430
|
-
return;
|
|
10431
|
-
if (pending.retryTimer)
|
|
10432
|
-
return;
|
|
10433
|
-
pending.retryAttempts = (pending.retryAttempts ?? 0) + 1;
|
|
10434
|
-
if (pending.retryAttempts >= BACKGROUND_RESPONSE_AGGREGATION_MAX_RETRIES) {
|
|
10435
|
-
pending.resolutionDropped = true;
|
|
10436
|
-
pending.turnEnded = pending.turnComplete === true;
|
|
10437
|
-
pending.held.length = 0;
|
|
10438
|
-
pending.turnComplete = void 0;
|
|
10439
|
-
pending.status = void 0;
|
|
10440
|
-
pending.label = void 0;
|
|
10441
|
-
pending.completionPartial = void 0;
|
|
10442
|
-
if (pending.turnEnded) {
|
|
10443
|
-
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10444
|
-
}
|
|
10445
|
-
return;
|
|
10446
|
-
}
|
|
10447
|
-
pending.retryTimer = setTimeout(() => {
|
|
10448
|
-
pending.retryTimer = void 0;
|
|
10449
|
-
pending.retryInFlight = true;
|
|
10450
|
-
void this.retryBackgroundResponseResolution(key, sessionId, pending).catch((error) => {
|
|
10451
|
-
process.stderr.write(`[DingTalk:${this.name}] background response target resolution failed: ${sanitizeLogText(error instanceof Error ? error.message : String(error), 300)}
|
|
10452
|
-
`);
|
|
10453
|
-
}).finally(() => {
|
|
10454
|
-
pending.retryInFlight = false;
|
|
10455
|
-
if (pending.retiring || !pending.retryTimer && !pending.resolutionDropped) {
|
|
10456
|
-
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10457
|
-
}
|
|
10458
|
-
if (this.pendingBackgroundResponseTerminals.get(key) === pending && pending.resolvers === 0 && !pending.retryTimer && pending.held.length === 0 && (!pending.resolutionDropped || pending.turnEnded)) {
|
|
10459
|
-
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10460
|
-
}
|
|
10461
|
-
});
|
|
10462
|
-
}, BACKGROUND_RESPONSE_AGGREGATION_RETRY_MS);
|
|
10463
|
-
pending.retryTimer.unref?.();
|
|
10464
|
-
const active = this.pendingBackgroundResponseTerminals.get(key);
|
|
10465
|
-
if (!active || active === pending) {
|
|
10466
|
-
this.pendingBackgroundResponseTerminals.set(key, pending);
|
|
10467
|
-
}
|
|
10468
|
-
}
|
|
10469
|
-
async retryBackgroundResponseResolution(key, sessionId, pending) {
|
|
10470
|
-
let delivery;
|
|
10471
|
-
try {
|
|
10472
|
-
delivery = await this.resolveBackgroundResponseDelivery(sessionId);
|
|
10473
|
-
} catch (error) {
|
|
10474
|
-
if (this.pendingBackgroundResponseTerminals.get(key) === pending && !this.backgroundResponseAggregations.has(key) || this.detachedPendingBackgroundResponseTerminals.has(pending)) {
|
|
10475
|
-
this.scheduleBackgroundResponseResolutionRetry(key, sessionId, pending);
|
|
10476
|
-
}
|
|
10477
|
-
throw error;
|
|
10478
|
-
}
|
|
10479
|
-
if (!delivery || this.router.getTarget(sessionId) !== delivery.target) {
|
|
10480
|
-
if (pending.retiring) {
|
|
10481
|
-
if (pending.held.length > 0) {
|
|
10482
|
-
process.stderr.write(`[DingTalk:${this.name}] background response target unavailable during drain; ${pending.held.length} buffered segment(s) discarded
|
|
10483
|
-
`);
|
|
10484
|
-
}
|
|
10485
|
-
pending.held.length = 0;
|
|
10486
|
-
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10487
|
-
return;
|
|
10488
|
-
}
|
|
10489
|
-
if (this.pendingBackgroundResponseTerminals.get(key) === pending && !this.backgroundResponseAggregations.has(key) || this.detachedPendingBackgroundResponseTerminals.has(pending)) {
|
|
10490
|
-
this.scheduleBackgroundResponseResolutionRetry(key, sessionId, pending);
|
|
10491
|
-
}
|
|
10492
|
-
return;
|
|
10493
|
-
}
|
|
10494
|
-
if (pending.retiring || this.pendingBackgroundResponseTerminals.get(key) !== pending || pending.turnComplete) {
|
|
10495
|
-
await this.flushDetachedBackgroundResponse(key, sessionId, pending, delivery);
|
|
10496
|
-
return;
|
|
10497
|
-
}
|
|
10498
|
-
const first = pending.held[0];
|
|
10499
|
-
if (!first)
|
|
10500
|
-
return;
|
|
10501
|
-
const aggregation = this.createBackgroundResponseAggregation(key, sessionId, first.context, delivery.target, delivery.sourceLabel);
|
|
10502
|
-
this.applyHeldBackgroundResponses(aggregation, pending);
|
|
10503
|
-
if (pending.resolutionDropped) {
|
|
10504
|
-
aggregation.resolutionDropped = true;
|
|
10505
|
-
pending.resolutionDropped = void 0;
|
|
10506
|
-
}
|
|
10507
|
-
if (this.pendingBackgroundResponseTerminals.get(key) === pending) {
|
|
10508
|
-
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10509
|
-
}
|
|
10510
|
-
this.scheduleBackgroundResponseAggregationFlush(key, aggregation);
|
|
10511
|
-
}
|
|
10512
|
-
holdPendingBackgroundResponse(pending, text, context) {
|
|
10513
|
-
if (text.trim().length > 0)
|
|
10514
|
-
pending.held.push({ text, context });
|
|
10515
|
-
if (context.turnComplete) {
|
|
10516
|
-
pending.turnComplete = true;
|
|
10517
|
-
pending.status = context.status;
|
|
10518
|
-
pending.label = context.label ?? pending.label;
|
|
10519
|
-
pending.completionPartial = context.partial === true;
|
|
10520
|
-
}
|
|
10521
|
-
}
|
|
10522
|
-
applyHeldBackgroundResponses(aggregation, pending) {
|
|
10523
|
-
for (const { text, context } of pending.held.splice(0)) {
|
|
10524
|
-
aggregation.status = context.status;
|
|
10525
|
-
aggregation.label = context.label ?? aggregation.label;
|
|
10526
|
-
aggregation.parts.push(text);
|
|
10527
|
-
if (context.turnComplete) {
|
|
10528
|
-
aggregation.turnComplete = true;
|
|
10529
|
-
aggregation.completionPartial = context.partial === true;
|
|
10530
|
-
}
|
|
10531
|
-
}
|
|
10532
|
-
}
|
|
10533
|
-
applyPendingBackgroundResponseTerminal(aggregation, pending) {
|
|
10534
|
-
if (!pending.turnComplete)
|
|
10535
|
-
return;
|
|
10536
|
-
aggregation.turnComplete = true;
|
|
10537
|
-
aggregation.status = pending.status ?? aggregation.status;
|
|
10538
|
-
aggregation.label = pending.label ?? aggregation.label;
|
|
10539
|
-
aggregation.completionPartial = pending.completionPartial === true;
|
|
10540
|
-
pending.turnComplete = void 0;
|
|
10541
|
-
pending.status = void 0;
|
|
10542
|
-
pending.label = void 0;
|
|
10543
|
-
pending.completionPartial = void 0;
|
|
10544
|
-
}
|
|
10545
|
-
async completeBackgroundResponseAggregation(key, aggregation) {
|
|
10546
|
-
if (aggregation.delivery) {
|
|
10547
|
-
aggregation.delivery.status = aggregation.status;
|
|
10548
|
-
aggregation.delivery.label = aggregation.label ?? aggregation.delivery.label;
|
|
10549
|
-
aggregation.delivery.partial = this.isPartialBackgroundResponseDelivery(aggregation, aggregation.delivery.parts.length) || aggregation.parts.length > 0;
|
|
10550
|
-
}
|
|
10551
|
-
if (aggregation.timeoutTimer)
|
|
10552
|
-
clearTimeout(aggregation.timeoutTimer);
|
|
10553
|
-
aggregation.timeoutTimer = void 0;
|
|
10554
|
-
await this.flushBackgroundResponseAggregation(key, aggregation);
|
|
10555
|
-
}
|
|
10556
|
-
async flushDetachedBackgroundResponse(key, sessionId, pending, delivery) {
|
|
10557
|
-
const first = pending.held[0];
|
|
10558
|
-
if (!first) {
|
|
10559
|
-
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10560
|
-
return;
|
|
10561
|
-
}
|
|
10562
|
-
const aggregation = {
|
|
10563
|
-
key,
|
|
10564
|
-
sessionId,
|
|
10565
|
-
target: delivery.target,
|
|
10566
|
-
sourceLabel: delivery.sourceLabel,
|
|
10567
|
-
status: first.context.status,
|
|
10568
|
-
label: first.context.label,
|
|
10569
|
-
parts: [],
|
|
10570
|
-
turnComplete: pending.turnComplete,
|
|
10571
|
-
completionPartial: pending.completionPartial,
|
|
10572
|
-
resolutionDropped: pending.resolutionDropped
|
|
10573
|
-
};
|
|
10574
|
-
this.applyHeldBackgroundResponses(aggregation, pending);
|
|
10575
|
-
aggregation.status = pending.status ?? aggregation.status;
|
|
10576
|
-
aggregation.label = pending.label ?? aggregation.label;
|
|
10577
|
-
if (this.pendingBackgroundResponseTerminals.get(key) === pending) {
|
|
10578
|
-
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10579
|
-
}
|
|
10580
|
-
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10581
|
-
this.detachedBackgroundResponseAggregations.add(aggregation);
|
|
10582
|
-
await this.flushBackgroundResponseAggregation(key, aggregation);
|
|
10583
|
-
}
|
|
10584
|
-
scheduleBackgroundResponseAggregationFlush(key, aggregation) {
|
|
10585
|
-
if (aggregation.timeoutTimer || aggregation.delivery)
|
|
10586
|
-
return;
|
|
10587
|
-
aggregation.timeoutTimer = setTimeout(() => {
|
|
10588
|
-
aggregation.timeoutTimer = void 0;
|
|
10589
|
-
void this.flushBackgroundResponseAggregation(key, aggregation);
|
|
10590
|
-
}, BACKGROUND_RESPONSE_AGGREGATION_TIMEOUT_MS);
|
|
10591
|
-
aggregation.timeoutTimer.unref?.();
|
|
10592
|
-
}
|
|
10593
|
-
formatBackgroundResponseAggregation(delivery) {
|
|
10594
|
-
const icon = delivery.status === "completed" ? "\u2705" : delivery.status === "failed" ? "\u274C" : "\u23F9\uFE0F";
|
|
10595
|
-
const label = this.formatBackgroundAgentLabel(delivery.label);
|
|
10596
|
-
const header = `## ${icon} Agent \xB7 ${label}${delivery.partial ? "\uFF08\u90E8\u5206\uFF09" : ""}`;
|
|
10597
|
-
if (delivery.parts.length === 0)
|
|
10598
|
-
return header;
|
|
10599
|
-
return `${header}
|
|
10600
|
-
|
|
10601
|
-
${delivery.parts.join("\n\n")}`;
|
|
10285
|
+
return super.dispatchBackgroundResponse(sessionId, this.formatBackgroundAgentResponse(text, context?.label), context);
|
|
10602
10286
|
}
|
|
10603
10287
|
formatBackgroundAgentResponse(text, label) {
|
|
10604
10288
|
return `## \u{1F916} Agent \xB7 ${this.formatBackgroundAgentLabel(label)}
|
|
@@ -10609,52 +10293,11 @@ ${text}`;
|
|
|
10609
10293
|
const normalized = label?.replace(new RegExp("\\p{Cc}+", "gu"), " ").replace(/\s+/g, " ").trim();
|
|
10610
10294
|
return escapeDingTalkMarkdown(normalized || "\u540E\u53F0\u4EFB\u52A1");
|
|
10611
10295
|
}
|
|
10612
|
-
|
|
10613
|
-
|
|
10614
|
-
* the session's block-streaming projector: a second sender interleaving with
|
|
10615
|
-
* mid-projection state can swallow the send or split a held marker.
|
|
10616
|
-
*/
|
|
10617
|
-
async deliverBackgroundReply(chatId, text, sessionId, sourceLabel, prepared = false, failOnHttpError = false) {
|
|
10618
|
-
if (this.config.blockStreaming !== "on") {
|
|
10619
|
-
return this.sendResponseMessage(chatId, text, sessionId, sourceLabel, prepared, failOnHttpError);
|
|
10620
|
-
}
|
|
10621
|
-
await this.sendReply(chatId, text, void 0, sourceLabel, prepared, failOnHttpError);
|
|
10622
|
-
}
|
|
10623
|
-
async sendResponseMessage(chatId, text, sessionId, sourceLabel, prepared = false, failOnHttpError = false) {
|
|
10624
|
-
let outgoingText = text;
|
|
10625
|
-
let consumesMention = true;
|
|
10626
|
-
if (this.config.blockStreaming === "on") {
|
|
10627
|
-
const projected = this.projectBlockStreamChunk(text, sessionId);
|
|
10628
|
-
if (!projected.text.trim())
|
|
10629
|
-
return;
|
|
10630
|
-
outgoingText = projected.text;
|
|
10631
|
-
consumesMention = projected.hasContent;
|
|
10632
|
-
}
|
|
10633
|
-
const atUserId = consumesMention && this.atSender ? this.sessionMentionTargets.get(sessionId) : void 0;
|
|
10296
|
+
async sendResponseMessage(chatId, text, sessionId, sourceLabel, prepared = false) {
|
|
10297
|
+
const atUserId = this.atSender ? this.sessionMentionTargets.get(sessionId) : void 0;
|
|
10634
10298
|
if (atUserId)
|
|
10635
10299
|
this.sessionMentionTargets.delete(sessionId);
|
|
10636
|
-
await this.sendReply(chatId,
|
|
10637
|
-
}
|
|
10638
|
-
projectBlockStreamChunk(text, sessionId) {
|
|
10639
|
-
let state = this.blockFileProjectors.get(sessionId);
|
|
10640
|
-
if (!state) {
|
|
10641
|
-
if (!this.blockProjectionArmed.has(sessionId)) {
|
|
10642
|
-
return { text: "", hasContent: false };
|
|
10643
|
-
}
|
|
10644
|
-
state = { projector: new OutboundFileProjector(), reportedMarkers: 0 };
|
|
10645
|
-
this.blockFileProjectors.set(sessionId, state);
|
|
10646
|
-
}
|
|
10647
|
-
const safe = state.projector.append(text);
|
|
10648
|
-
const hasContent = safe.trim().length > 0;
|
|
10649
|
-
const result = state.projector.result(safe);
|
|
10650
|
-
let outgoingText = safe;
|
|
10651
|
-
if (result.markerCount > state.reportedMarkers) {
|
|
10652
|
-
outgoingText = withFileUnavailableNotice(safe);
|
|
10653
|
-
state.reportedMarkers = result.markerCount;
|
|
10654
|
-
process.stderr.write(`[DingTalk:${this.name}] file markers redacted in block stream (session ${sessionId}, markers=${result.markerCount})
|
|
10655
|
-
`);
|
|
10656
|
-
}
|
|
10657
|
-
return { text: outgoingText, hasContent };
|
|
10300
|
+
await this.sendReply(chatId, text, atUserId, sourceLabel ?? this.getResponseSourceLabel(sessionId), prepared);
|
|
10658
10301
|
}
|
|
10659
10302
|
async sendFallbackReply(chatId, text, sessionId, sourceLabel) {
|
|
10660
10303
|
const atUserId = this.atSender ? this.sessionMentionTargets.get(sessionId) : void 0;
|
|
@@ -10708,6 +10351,16 @@ ${text}`;
|
|
|
10708
10351
|
}
|
|
10709
10352
|
return this.interactionPresenter.presentInput(context);
|
|
10710
10353
|
}
|
|
10354
|
+
async presentPermissionRequest(context) {
|
|
10355
|
+
const run = this.cardRuns.get(context.runId);
|
|
10356
|
+
if (!run || run.ownerId !== context.owner.id) {
|
|
10357
|
+
return { kind: "unsupported" };
|
|
10358
|
+
}
|
|
10359
|
+
if (!this.permissionCardController || !this.interactionPresenter) {
|
|
10360
|
+
return { kind: "unsupported" };
|
|
10361
|
+
}
|
|
10362
|
+
return this.interactionPresenter.presentPermission(context);
|
|
10363
|
+
}
|
|
10711
10364
|
/**
|
|
10712
10365
|
* Extract quoted/referenced message context from a reply.
|
|
10713
10366
|
* DingTalk provides this via text.repliedMsg (newer) or quoteMessage (legacy).
|
|
@@ -10946,7 +10599,7 @@ ${text}`;
|
|
|
10946
10599
|
let filePath;
|
|
10947
10600
|
let safeName;
|
|
10948
10601
|
try {
|
|
10949
|
-
dir = join(tmpdir3(), "channel-files",
|
|
10602
|
+
dir = join(tmpdir3(), "channel-files", randomUUID6());
|
|
10950
10603
|
mkdirSync(dir, { recursive: true });
|
|
10951
10604
|
safeName = basename3(typeof fileName === "string" ? fileName : "") || `dingtalk_${mediaType}_${Date.now()}.${GENERATED_MEDIA_EXT[media.mimeType] ?? "bin"}`;
|
|
10952
10605
|
filePath = join(dir, safeName);
|
|
@@ -11053,7 +10706,7 @@ ${text}`;
|
|
|
11053
10706
|
}
|
|
11054
10707
|
}) : this.handleInbound(envelope);
|
|
11055
10708
|
processMessage.catch((err) => {
|
|
11056
|
-
const reference =
|
|
10709
|
+
const reference = randomUUID6().slice(0, 8);
|
|
11057
10710
|
let errorSummary = "Unknown error";
|
|
11058
10711
|
try {
|
|
11059
10712
|
errorSummary = err instanceof Error ? `${err.name}: ${err.message}` : String(err);
|
|
@@ -11095,12 +10748,6 @@ var plugin = {
|
|
|
11095
10748
|
required: true,
|
|
11096
10749
|
envResolvable: true
|
|
11097
10750
|
},
|
|
11098
|
-
{
|
|
11099
|
-
key: "aggregateBackgroundAgentResponses",
|
|
11100
|
-
label: "Aggregate Background Agent Responses",
|
|
11101
|
-
kind: "boolean",
|
|
11102
|
-
description: "Buffer each background Agent turn and send one labeled result instead of labeled segments"
|
|
11103
|
-
},
|
|
11104
10751
|
{
|
|
11105
10752
|
key: "interactiveCards",
|
|
11106
10753
|
label: "Interactive Cards",
|
|
@@ -11140,6 +10787,24 @@ var plugin = {
|
|
|
11140
10787
|
exclusiveMinimum: DINGTALK_INTERACTIVE_CARD_TIMEOUT_EXCLUSIVE_MINIMUM
|
|
11141
10788
|
}
|
|
11142
10789
|
]
|
|
10790
|
+
},
|
|
10791
|
+
{
|
|
10792
|
+
key: "permissionCard",
|
|
10793
|
+
label: "Permission Card",
|
|
10794
|
+
kind: "object",
|
|
10795
|
+
properties: [
|
|
10796
|
+
{
|
|
10797
|
+
key: "enabled",
|
|
10798
|
+
label: "Enabled",
|
|
10799
|
+
kind: "boolean"
|
|
10800
|
+
},
|
|
10801
|
+
{
|
|
10802
|
+
key: "timeoutMs",
|
|
10803
|
+
label: "Timeout (ms)",
|
|
10804
|
+
kind: "number",
|
|
10805
|
+
exclusiveMinimum: DINGTALK_INTERACTIVE_CARD_TIMEOUT_EXCLUSIVE_MINIMUM
|
|
10806
|
+
}
|
|
10807
|
+
]
|
|
11143
10808
|
}
|
|
11144
10809
|
]
|
|
11145
10810
|
}
|