@qwen-code/qwen-code 0.23.1-preview.1 → 0.23.1-preview.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/qc-helper/docs/configuration/settings.md +7 -7
- package/bundled/qc-helper/docs/features/channels/dingtalk.md +26 -0
- package/bundled/qc-helper/docs/features/commands.md +71 -6
- package/bundled/qc-helper/docs/features/skills.md +40 -0
- package/chunks/{MaxSizedBox-5ARLO5PR.js → MaxSizedBox-IYIQ43IZ.js} +26 -27
- package/chunks/{StandaloneSessionPicker-T6B322CB.js → StandaloneSessionPicker-AWB2OHX6.js} +44 -45
- package/chunks/{acp-startup-profiler-6ULXXQMS.js → acp-startup-profiler-BAL4LJTN.js} +2 -2
- package/chunks/{acpAgent-WTDEY5KD.js → acpAgent-ZC57OLS4.js} +148 -96
- package/chunks/{agent-NXPUXEVZ.js → agent-GEBPAEJS.js} +16 -17
- package/chunks/{agent-headless-QQZTWOKO.js → agent-headless-63ZEYAJK.js} +16 -17
- package/chunks/{artifact-tool-DFVVJXL2.js → artifact-tool-P52OKKEF.js} +1 -1
- package/chunks/{askUserQuestion-GF7VQ44M.js → askUserQuestion-3KAYLLMM.js} +2 -2
- package/chunks/{bridge-OHY5OGOZ.js → bridge-MHWO5I5T.js} +30 -31
- package/chunks/{channel-management-service-ZDDG3G5S.js → channel-management-service-NFRZXQFO.js} +4 -4
- package/chunks/{channel-settings-store-7BJAS2SU.js → channel-settings-store-T7PMIHKC.js} +36 -37
- package/chunks/{channel-worker-group-2ISMRENV.js → channel-worker-group-O2BWK5F7.js} +5 -5
- package/chunks/{channel-worker-manager-VSRPVPRH.js → channel-worker-manager-4WP7VJOD.js} +5 -5
- package/chunks/{channel-worker-supervisor-SRJBK72Z.js → channel-worker-supervisor-CCUXD6J5.js} +3 -3
- package/chunks/{chunk-4VZCORNT.js → chunk-22QOQKG4.js} +1 -1
- package/chunks/{chunk-AHBLRVD5.js → chunk-2C3XDBGL.js} +4 -4
- package/chunks/{chunk-WTW36TJ3.js → chunk-2EKVPSIJ.js} +1 -1
- package/chunks/{chunk-ZTAVGFKA.js → chunk-37SOBIA3.js} +1 -1
- package/chunks/{chunk-IXSGOSEG.js → chunk-3RMVM33U.js} +28 -25
- package/chunks/{chunk-H3UDNQLO.js → chunk-4OCYWXKF.js} +1 -1
- package/chunks/{chunk-D6PIMKY3.js → chunk-4VY3ITHR.js} +4 -4
- package/chunks/{chunk-J3O5I5ZD.js → chunk-5FYGZ7E3.js} +3 -3
- package/chunks/{chunk-4JAGXZR3.js → chunk-5V4B3EWA.js} +1 -1
- package/chunks/{chunk-HFTB354P.js → chunk-5Z4FCEPY.js} +60 -6
- package/chunks/{chunk-VDXYYVCD.js → chunk-65GHQ4FX.js} +65 -10
- package/chunks/{chunk-32YDNYXP.js → chunk-6KYWU726.js} +1 -1
- package/chunks/{chunk-4HC4DYKN.js → chunk-6RZX2HIH.js} +1 -1
- package/chunks/{chunk-IFD3BTEA.js → chunk-733KQL63.js} +3 -3
- package/chunks/{chunk-MWHY26G3.js → chunk-75UQFGFE.js} +1 -1
- package/chunks/{chunk-QWZOOIR3.js → chunk-7PMKXGRP.js} +4 -4
- package/chunks/{chunk-KE3Q4JMY.js → chunk-AIMZIXZM.js} +3 -3
- package/chunks/{chunk-G34YLYCS.js → chunk-ANVC5CSK.js} +10 -10
- package/chunks/{chunk-SAZS4IWW.js → chunk-AUJOWIT5.js} +3 -3
- package/chunks/{chunk-Z6WZPXQH.js → chunk-AWDF462I.js} +1 -1
- package/chunks/{chunk-47BZVBTE.js → chunk-AX23QSX3.js} +3 -3
- package/chunks/{chunk-7BZS4ZDV.js → chunk-B5FF3LRF.js} +17 -17
- package/chunks/{chunk-TMWB67LS.js → chunk-BNWIX6BM.js} +2 -2
- package/chunks/{chunk-GZWW2QWR.js → chunk-C4NXRR7T.js} +2 -2
- package/chunks/{chunk-DNPHKA72.js → chunk-C55CR5I4.js} +6 -6
- package/chunks/{chunk-JPEAQJNS.js → chunk-C7M445SS.js} +1 -1
- package/chunks/{chunk-R355CUNQ.js → chunk-CLKE4IY3.js} +1 -77
- package/chunks/{chunk-VUSSAGKI.js → chunk-E4VX6LXB.js} +1 -1
- package/chunks/{chunk-GMNLYQOS.js → chunk-E6TI726I.js} +1 -1
- package/chunks/{chunk-Y3ZKI4RQ.js → chunk-EGRFCIXD.js} +19 -17
- package/chunks/{chunk-D4CU6DKR.js → chunk-EPZWBYQI.js} +5 -5
- package/chunks/{chunk-43NOB5NM.js → chunk-ERMAXPXA.js} +1 -1
- package/chunks/{chunk-KPXRFTT7.js → chunk-FETY36NQ.js} +1 -1
- package/chunks/{chunk-P6LATTDG.js → chunk-FWH4736Q.js} +3 -3
- package/chunks/{chunk-43JNQAHO.js → chunk-FXYNIZPW.js} +2 -2
- package/chunks/{chunk-4VUVBN3Y.js → chunk-G6UUOCUT.js} +87 -0
- package/chunks/{chunk-XY3USGFE.js → chunk-GEV66YGE.js} +1 -1
- package/chunks/{chunk-VEFRT7NX.js → chunk-H3Q3RSKZ.js} +1 -1
- package/chunks/{chunk-BKNY7PDI.js → chunk-HPE4LEWX.js} +1 -1
- package/chunks/{chunk-E4L5BM2B.js → chunk-HWZOOSEB.js} +4 -4
- package/chunks/{chunk-MNEYUNOE.js → chunk-HZS3JRQW.js} +2 -2
- package/chunks/{chunk-2RYWGYB3.js → chunk-I67KJGM6.js} +3 -3
- package/chunks/{chunk-O2GG7H4C.js → chunk-I7UNCY24.js} +2 -2
- package/chunks/{chunk-JLWFGYXU.js → chunk-IGOIYZBG.js} +2 -2
- package/chunks/{chunk-L4R7BCVV.js → chunk-IMWCUWQT.js} +1 -1
- package/chunks/{chunk-QMFOYPGV.js → chunk-J3VZF2AL.js} +2 -2
- package/chunks/{chunk-XOVVCGZX.js → chunk-JOV46WGX.js} +1 -1
- package/chunks/{chunk-LMJQSPWB.js → chunk-KA5HR3G2.js} +1 -1
- package/chunks/{chunk-VY6UVU7G.js → chunk-KAZWXVI3.js} +2 -2
- package/chunks/{chunk-IQN2CCIE.js → chunk-KP5QK3FB.js} +3 -3
- package/chunks/{chunk-2WGJG2KW.js → chunk-KTLT7VCX.js} +4 -4
- package/chunks/{chunk-IKLFS6SC.js → chunk-L36LLVA5.js} +3 -3
- package/chunks/{chunk-MUZCSTOO.js → chunk-LD53HMPV.js} +4 -4
- package/chunks/{chunk-P4RUUG64.js → chunk-LTCI6ZOJ.js} +1 -1
- package/chunks/{chunk-SN5FV4FY.js → chunk-LYHYXJJ3.js} +3 -3
- package/chunks/{chunk-RDKXZ2LS.js → chunk-LYT2OU7D.js} +1 -1
- package/chunks/{chunk-GVVCLL2P.js → chunk-MFCWL4LI.js} +9 -9
- package/chunks/{chunk-RPBMP6BN.js → chunk-MWIO7MF6.js} +3 -0
- package/chunks/{chunk-OECNP26L.js → chunk-N6S3NUYJ.js} +1 -1
- package/chunks/{chunk-NGX4NUNP.js → chunk-O2FEO2CB.js} +131 -6
- package/chunks/{chunk-GXZHYPHZ.js → chunk-OFB36ZBA.js} +4 -1
- package/chunks/{chunk-LDS57224.js → chunk-OWCFKIFQ.js} +1 -1
- package/chunks/{chunk-ZAZ3NFL6.js → chunk-P5Z7VD23.js} +237 -52
- package/chunks/{chunk-5MTARK4Y.js → chunk-PLUAIHZO.js} +4 -4
- package/chunks/{chunk-KK2GZGBK.js → chunk-PMGWY6ZP.js} +10 -10
- package/chunks/{chunk-JRYL3T2O.js → chunk-PQSCGZT2.js} +1 -1
- package/chunks/{chunk-UKKYOIVT.js → chunk-QAZ2MGYT.js} +2 -2
- package/chunks/{chunk-CZACBHAW.js → chunk-QQGAR64U.js} +4 -4
- package/chunks/{chunk-ER273QE6.js → chunk-QW7BUOSI.js} +2 -2
- package/chunks/{chunk-RVNS7NWN.js → chunk-R7TKFIQO.js} +1 -1
- package/chunks/{chunk-GCFZ2LAX.js → chunk-RCUWMVN3.js} +1 -1
- package/chunks/{chunk-CWNC7M73.js → chunk-RD3VPM4E.js} +2 -2
- package/chunks/{chunk-KJJPJYHI.js → chunk-REDVV5NC.js} +7 -7
- package/chunks/{chunk-4IQKBLTQ.js → chunk-RGAQDQ3Z.js} +9 -9
- package/chunks/{chunk-WXC6OAWD.js → chunk-RH344FKI.js} +1 -1
- package/chunks/{chunk-64MQTIX7.js → chunk-RPFJJ33Z.js} +2 -2
- package/chunks/{chunk-LPBQODMR.js → chunk-RQNAO42A.js} +4 -4
- package/chunks/{chunk-LK7S2D6V.js → chunk-RRCNEW2A.js} +4 -4
- package/chunks/{chunk-O45WBTNS.js → chunk-RSU3I6UL.js} +3 -3
- package/chunks/{chunk-AQ5NAGWI.js → chunk-RUMSY4ES.js} +4 -4
- package/chunks/{chunk-QSC5YOEC.js → chunk-SD7Y2PMC.js} +1 -1
- package/chunks/{chunk-SFMCYMVF.js → chunk-SHK2SIR5.js} +4 -4
- package/chunks/{chunk-XUSOYE2I.js → chunk-SHX2HIE7.js} +1 -1
- package/chunks/{chunk-PTFFWTTO.js → chunk-SI6Q52UI.js} +3 -3
- package/chunks/{chunk-JBTZUFR4.js → chunk-T7TP5UQL.js} +6 -6
- package/chunks/{chunk-YCDL2SAS.js → chunk-TDHVOZ65.js} +2 -2
- package/chunks/{chunk-PZV2FASB.js → chunk-TRWQQBVH.js} +1 -1
- package/chunks/{chunk-I72PHOKL.js → chunk-TSLRORQR.js} +93 -95
- package/chunks/{chunk-UEZOXZNI.js → chunk-TXAEXF2B.js} +786 -366
- package/chunks/{chunk-4F2QRVW6.js → chunk-UTVIIA7N.js} +1 -1
- package/chunks/{chunk-WR3SH3EY.js → chunk-VMFPZXRT.js} +131 -60
- package/chunks/{chunk-XHGGYCTA.js → chunk-VYCJITND.js} +1 -1
- package/chunks/{chunk-5YY5MZT6.js → chunk-WFXD5OZH.js} +1 -1
- package/chunks/{chunk-URSCX7S7.js → chunk-WLZRMF3C.js} +2 -2
- package/chunks/{chunk-P5LDR7FI.js → chunk-WQBR7LN5.js} +3 -3
- package/chunks/{chunk-N7VURC4O.js → chunk-WXFCI3O5.js} +2 -2
- package/chunks/{chunk-HJ34U5J4.js → chunk-XNC2TCUO.js} +4 -4
- package/chunks/{chunk-N7EYO2E7.js → chunk-XQ4RDO5B.js} +1 -1
- package/chunks/{chunk-JOPC3FND.js → chunk-XX4MBBFW.js} +5 -5
- package/chunks/{chunk-TDP7UULF.js → chunk-Y3C5COGI.js} +1 -1
- package/chunks/{chunk-54TF2ZIQ.js → chunk-YLFICBYK.js} +3 -3
- package/chunks/{chunk-4MCY33Y2.js → chunk-Z6DDPSGJ.js} +1 -1
- package/chunks/{chunk-WEXA2DNG.js → chunk-Z6KFLEG7.js} +13 -0
- package/chunks/{chunk-PZUOHCWI.js → chunk-ZNI3V2XA.js} +2 -2
- package/chunks/{chunk-6UIACMGH.js → chunk-ZRVFHLLK.js} +1 -1
- package/chunks/{chunk-NAKALAL4.js → chunk-ZT3XUGSU.js} +32 -8
- package/chunks/{config-utils-QXDOTXEQ.js → config-utils-F4CFJ4MW.js} +30 -31
- package/chunks/{contextCommand-RN4KARWC.js → contextCommand-OIIGGOMU.js} +28 -29
- package/chunks/{core-runtime-NAZCOKHB.js → core-runtime-JEHLOGMB.js} +26 -27
- package/chunks/{create-sub-session-BCSM4WKB.js → create-sub-session-MVFBE5RA.js} +35 -30
- package/chunks/{create-sub-session-BQ3SE4TX.js → create-sub-session-TGIX63YU.js} +2 -2
- package/chunks/{cron-create-D6HQ7I7I.js → cron-create-GTPVMJCF.js} +1 -1
- package/chunks/{cron-delete-KK3D2SQV.js → cron-delete-ZBK27Z4K.js} +1 -1
- package/chunks/{cron-list-VBF3IZMF.js → cron-list-KTFKFDKC.js} +1 -1
- package/chunks/{daemon-git-worktree-guard-3K5CAU36.js → daemon-git-worktree-guard-5FTKLJOU.js} +26 -27
- package/chunks/{daemon-status-provider-4X3ZZQTZ.js → daemon-status-provider-P6A5MPMW.js} +35 -36
- package/chunks/{daemon-trust-policy-R45CFUJA.js → daemon-trust-policy-ZJ3NFYUO.js} +32 -33
- package/chunks/{daemon-trust-policy-monitor-DSSFCO3K.js → daemon-trust-policy-monitor-6SDLEW7S.js} +32 -33
- package/chunks/{deferred-core-runtime-UO2M6WYI.js → deferred-core-runtime-DWOXIU5S.js} +26 -27
- package/chunks/{display-image-EVVTBVYE.js → display-image-CTNHJRZC.js} +4 -4
- package/chunks/{dist-PH5RSTEA.js → dist-3H3WODVS.js} +1 -1
- package/chunks/{dist-UVHW2U56.js → dist-AI25RVRA.js} +1 -1
- package/chunks/{dist-AFH3BMZZ.js → dist-I74QLLQS.js} +1 -1
- package/chunks/{dist-SIHF5MU2.js → dist-NXW4DUUX.js} +1 -1
- package/chunks/{dist-MK5PPBRF.js → dist-P6YWBITG.js} +670 -17
- package/chunks/{dist-QUU7TVE3.js → dist-T4PRA5EZ.js} +1 -1
- package/chunks/{dist-SB2XRXZA.js → dist-VCAS67N5.js} +1 -1
- package/chunks/{dist-3T5MDUHP.js → dist-XINEKB5A.js} +1 -1
- package/chunks/{dist-R5Y34V6T.js → dist-YNQU4CKC.js} +2 -2
- package/chunks/{edit-VNBCTRWP.js → edit-WPVXLL3T.js} +16 -17
- package/chunks/{en-JMR535HP.js → en-YJNRUQG4.js} +1 -1
- package/chunks/{enter-worktree-CEVK7MQ2.js → enter-worktree-5A6VW6BN.js} +4 -4
- package/chunks/{enterPlanMode-4KMZMUIA.js → enterPlanMode-JSODW7E2.js} +16 -17
- package/chunks/{environment-S2HYQDON.js → environment-5LLJ3I3W.js} +28 -29
- package/chunks/{errors-DAAN5TL7.js → errors-IQT3YZEP.js} +28 -29
- package/chunks/{exit-worktree-D3YE6MUN.js → exit-worktree-QV7E7KP6.js} +4 -4
- package/chunks/{exitPlanMode-HR36HG3D.js → exitPlanMode-DDVFYNW4.js} +16 -17
- package/chunks/{fast-path-4IWSW3UV.js → fast-path-PAUQQEVU.js} +2 -2
- package/chunks/{glob-IZYB2XH2.js → glob-SQ7CTZ7F.js} +16 -17
- package/chunks/{goal-tools-VGUPKQDJ.js → goal-tools-UWZRCLQB.js} +16 -17
- package/chunks/{grep-OUVLNXG7.js → grep-BLHF2S5D.js} +2 -2
- package/chunks/{handleAutoUpdate-D56FMDTW.js → handleAutoUpdate-RUPZZTSG.js} +29 -30
- package/chunks/{i18n-BKE5WO6T.js → i18n-SF5MPWEB.js} +27 -28
- package/chunks/{image-gen-SHVQ3XID.js → image-gen-Q3RUTVKR.js} +1 -1
- package/chunks/{initializer-MS4SGEHF.js → initializer-CK4WPYZG.js} +32 -33
- package/chunks/{installationInfo-542MGC4S.js → installationInfo-IRPQEYRF.js} +26 -27
- package/chunks/{list-H6XTKUWL.js → list-E3PS3EBJ.js} +35 -36
- package/chunks/{list-agents-ULYBGJXC.js → list-agents-I5TRH3J7.js} +2 -2
- package/chunks/{llm-3NUC4EJY.js → llm-JQKBOYAF.js} +67 -68
- package/chunks/{llm-content-generator-R4NL3OQN.js → llm-content-generator-2QWGBW42.js} +2 -2
- package/chunks/{loadedSettingsAdapter-3XLKYDVT.js → loadedSettingsAdapter-DGXGVYZS.js} +32 -33
- package/chunks/{loggingContentGenerator-ZYSWVNEO.js → loggingContentGenerator-ZYURLJKK.js} +18 -19
- package/chunks/{loop-wakeup-B27BEYRL.js → loop-wakeup-HL6XOWI4.js} +2 -2
- package/chunks/{ls-3IIMMVKF.js → ls-YV7RKLKY.js} +1 -1
- package/chunks/{lsp-VJAT7XKS.js → lsp-NO3AMRZT.js} +1 -1
- package/chunks/{managed-npm-update-L2I53ZAI.js → managed-npm-update-HTHR63EA.js} +26 -27
- package/chunks/{mcp-4PIXQASW.js → mcp-I7G2AEWS.js} +32 -33
- package/chunks/{monitor-O2YQTOZZ.js → monitor-4R76BCRZ.js} +16 -17
- package/chunks/{nonInteractiveCli-LV7CDBA2.js → nonInteractiveCli-24OQ3VP2.js} +64 -65
- package/chunks/{notebook-edit-4RE2ALH4.js → notebook-edit-PPSH7FEX.js} +16 -17
- package/chunks/{openaiContentGenerator-7ND7K5CP.js → openaiContentGenerator-K7V5EO7F.js} +10 -10
- package/chunks/{pidfile-UFTLQ7NP.js → pidfile-TGIUY2GG.js} +26 -27
- package/chunks/{processUtils-3XBB4FYV.js → processUtils-3USXUQWX.js} +2 -2
- package/chunks/{prompt-terminal-ledger-2QASOGMM.js → prompt-terminal-ledger-XHVZRXJI.js} +27 -28
- package/chunks/{qwenContentGenerator-AELTUTH6.js → qwenContentGenerator-MPBOQB64.js} +18 -19
- package/chunks/{read-file-PDWHZPHX.js → read-file-R256LDWQ.js} +4 -4
- package/chunks/{read-mcp-resource-YXJZ75UB.js → read-mcp-resource-D3N75DGF.js} +1 -1
- package/chunks/{record-artifact-WJDOV6XU.js → record-artifact-Q5CRGJTP.js} +2 -2
- package/chunks/{report-findings-Q4UACKWR.js → report-findings-TJ34R7QK.js} +3 -3
- package/chunks/{request-shutdown-2YZ3E3GH.js → request-shutdown-LRKMTBAD.js} +6 -6
- package/chunks/{resumeHistoryUtils-QRXZEEBA.js → resumeHistoryUtils-S43LTFHD.js} +30 -31
- package/chunks/{ripGrep-KSOOLE6H.js → ripGrep-L7HPZ75Y.js} +7 -7
- package/chunks/{run-qwen-serve-RTAREPT6.js → run-qwen-serve-CTFL5R6U.js} +46 -46
- package/chunks/{runtime-ESFSCJRZ.js → runtime-FS5TL6P7.js} +37 -38
- package/chunks/{scheduled-tasks-6ZHRNBH6.js → scheduled-tasks-QXPV3Q35.js} +32 -33
- package/chunks/{scheduler-DQI6KV7T.js → scheduler-EXU5HMVK.js} +28 -29
- package/chunks/{send-message-PQCVSVMN.js → send-message-GQKXGMPI.js} +7 -7
- package/chunks/{serve-FY7ZEW52.js → serve-ITJC7WNN.js} +32 -33
- package/chunks/{server-KNDY6K5F.js → server-6JQY3PTU.js} +66 -67
- package/chunks/{session-MCEPXAZP.js → session-PJDEKXD4.js} +85 -72
- package/chunks/{session-attachments-root-OLNAE6GF.js → session-attachments-root-L37ORSST.js} +26 -27
- package/chunks/{session-pr-refresh-HKJHQQQK.js → session-pr-refresh-WIFD52YL.js} +31 -32
- package/chunks/{settings-VXO4WBMK.js → settings-LO6J5SAZ.js} +31 -32
- package/chunks/{shell-U263OTES.js → shell-ANAFVYGR.js} +16 -17
- package/chunks/{skill-SDODGBKL.js → skill-SHJWKSPH.js} +10 -57
- package/chunks/{skill-settings-YEIA22QJ.js → skill-settings-GX3XHZ5Q.js} +31 -32
- package/chunks/{spawnChannel-4WJZVFPP.js → spawnChannel-WE42VBKM.js} +28 -29
- package/chunks/{standalone-update-ZWVQUO64.js → standalone-update-CWDIKJRP.js} +28 -29
- package/chunks/{start-opentui-ui-BFYCJQRZ.js → start-opentui-ui-BBHGFOTF.js} +70 -71
- package/chunks/{startInteractiveUI-JYAFCMHL.js → startInteractiveUI-FQX7LUYP.js} +172 -110
- package/chunks/{syntheticOutput-AUAJBNXR.js → syntheticOutput-D2P5V6RG.js} +2 -2
- package/chunks/{task-create-LD5ISM3E.js → task-create-PMAFST2T.js} +7 -7
- package/chunks/{task-list-YISJ4RJA.js → task-list-R2HSY2NC.js} +1 -1
- package/chunks/{task-stop-65ZOVATJ.js → task-stop-BFSKRTGV.js} +1 -1
- package/chunks/{task-update-AAN4ZVEY.js → task-update-JYC57USF.js} +7 -7
- package/chunks/{team-create-KU7MABNO.js → team-create-WKTPCH6D.js} +16 -17
- package/chunks/{team-delete-XFRRTJTT.js → team-delete-CBHVBTPB.js} +1 -1
- package/chunks/{team-plan-approval-DPB377A3.js → team-plan-approval-Y23DL7WR.js} +16 -17
- package/chunks/{terminal-image-renderer-WGWRENOF.js → terminal-image-renderer-B646HBDW.js} +28 -29
- package/chunks/{theme-manager-GBUFULSO.js → theme-manager-BNWESY26.js} +26 -27
- package/chunks/{todoWrite-G7NT4IFP.js → todoWrite-5ERKFWAK.js} +3 -5
- package/chunks/{tool-search-6YUXHBPT.js → tool-search-PVQ5O5Y2.js} +9 -9
- package/chunks/{total-session-admission-54R2JQ5L.js → total-session-admission-P5Z43KNW.js} +30 -31
- package/chunks/{trustedFolders-KAJIDJTH.js → trustedFolders-FH2LT2MZ.js} +27 -28
- package/chunks/{update-relaunch-XM4IWBFD.js → update-relaunch-WOWTKJSN.js} +5 -5
- package/chunks/{updateCheck-W6UZFURI.js → updateCheck-3MYFMM35.js} +28 -29
- package/chunks/{useAutoAcceptIndicator-LAWYHY3U.js → useAutoAcceptIndicator-Q7ZRRRKO.js} +33 -34
- package/chunks/{validateNonInterActiveAuth-7WCKHRN2.js → validateNonInterActiveAuth-MYEWJX3G.js} +61 -62
- package/chunks/{version-3ZU43RJ6.js → version-RO2FPO76.js} +1 -1
- package/chunks/{web-fetch-QHI2SQL4.js → web-fetch-QAKY2LUA.js} +4 -4
- package/chunks/{web-search-3KZZKWNY.js → web-search-XA5Z4ZCD.js} +2 -2
- package/chunks/{workflow-HRW7Y2X4.js → workflow-QFIOCMDM.js} +18 -19
- package/chunks/{workspace-providers-status-KTGCWCPC.js → workspace-providers-status-B2UD7RAG.js} +35 -36
- package/chunks/{workspace-registration-store-LHLPPWNE.js → workspace-registration-store-VZLRTI3Q.js} +1 -1
- package/chunks/{workspace-registry-X34MLN52.js → workspace-registry-GYOGG6TM.js} +30 -31
- package/chunks/{workspace-runtime-coordinator-U4PW4P7K.js → workspace-runtime-coordinator-7KRXGQ4V.js} +31 -32
- package/chunks/{workspace-service-KD7BCGYL.js → workspace-service-DJEYGJE4.js} +36 -37
- package/chunks/{workspace-skills-status-YJGO6Y3T.js → workspace-skills-status-MOKNESUC.js} +33 -34
- package/chunks/{workspace-trust-reconciler-EUYHISCH.js → workspace-trust-reconciler-AXOSUTQW.js} +36 -37
- package/chunks/{write-file-EBSB34NJ.js → write-file-QOYVHAKK.js} +18 -19
- package/chunks/{zh-TW-W2GNP2IU.js → zh-TW-N2TBF2F2.js} +1 -1
- package/chunks/{zh-DVFYHRK5.js → zh-VBFCRQBL.js} +1 -1
- package/chunks/{zoom-image-UJ5VKWKP.js → zoom-image-UCCLGFNC.js} +4 -4
- package/cli.js +13 -13
- package/export-transcript-document.js +2 -2
- package/locales/en.js +2 -2
- package/locales/zh-TW.js +2 -2
- package/locales/zh.js +2 -2
- package/package.json +3 -3
- package/web-shell/assets/{abnfDiagram-VCTEODGH-Dur--luQ.js → abnfDiagram-VCTEODGH-CTstZpXw.js} +1 -1
- package/web-shell/assets/{arc-tYLobxFi.js → arc-DKW0mbPo.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-IG6aXD03.js → architectureDiagram-5GKGNRK7-DkMpJ42t.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-C6eBSkfA.js → blockDiagram-NRAW4CY4-7Cp1_4i3.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-BrX3HJqB.js → c4Diagram-UCG6FXSJ-BfaoSlBK.js} +1 -1
- package/web-shell/assets/channel-CQx7VSAp.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-B3fcJ8ee.js → chunk-2Q5K7J3B-_n1qzAio.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-CeC90yKM.js → chunk-5VM5RSS4-0cira5ZV.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-CW44RVki.js → chunk-F27PBJKO-DseRXSHC.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-D1PAMukD.js → chunk-G27WJ6UU-BehQWin0.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-Dt3Y2Fvx.js → chunk-JWPE2WC7-B5ftg1Bb.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-CZHw2lLI.js → chunk-LCL6LL3I-D7rnbVdk.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-ysNAdTGx.js → chunk-POPQ4Y6H-2Bp-Orju.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-BdNXW6YQ.js → chunk-SVP7TREG-CD2goGva.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-DgqQ9UA8.js → chunk-XXDRQBXY-DzQt-Rji.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-C-Uz8hHk.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-C-Uz8hHk.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-BILImXzJ.js → cose-bilkent-JH36ORCC-C-BZXSUn.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-DR88Pund.js → cynefin-OW5HDTMX-BTcvowe1.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-BYFbfkA6.js → cynefinDiagram-5FMLGOSQ-BoUE6K81.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-rfpyc6sX.js → dagre-3AP2YEHR-BHxy9xeB.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-BJxLmEwH.js → diagram-S7CK7UJ4-DMiJIvDT.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-H34xm7k3.js → diagram-UQ7AKVKN-DXV09Aes.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-HYxhwNLx.js → diagram-VSXAHHWV-CocpRomV.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-BJazso8F.js → diagram-VX7I27RA-DL7nqtb4.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-Clje1aNy.js → diagram-Z3DM3KII-CPZ2Jux_.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-M93YBkFh.js → ebnfDiagram-PWID7BFC-BX-eVNsX.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-DY8XzSHU.js → erDiagram-SSCWMZ5O-CPy_Ir6y.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-CE6Aylcq.js → flowDiagram-A5DVABFB-eknAOte9.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-DI-5LL22.js → ganttDiagram-EL5Y4UJY-crAxw_t7.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-C7BZWElk.js → gitGraphDiagram-WWUBYQGX-M29pa3Tc.js} +1 -1
- package/web-shell/assets/{index-CVyqwW7y.js → index-B4TLaxWs.js} +474 -474
- package/web-shell/assets/{index-DclFHns9.js → index-C9R-iojE.js} +1 -1
- package/web-shell/assets/index-CCrkEbzz.css +36 -0
- package/web-shell/assets/{infoDiagram-RXCK75RN-CGUSy4Pc.js → infoDiagram-RXCK75RN-XqspXdOU.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-B5BVks9q.js → ishikawaDiagram-5VMMS53U-C5KFS-7j.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-CFh6Tf7h.js → journeyDiagram-EYS64GPL-Cc57LVRo.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-B7TlxP7c.js → kanban-definition-3QL26DDD-C81OG-AI.js} +1 -1
- package/web-shell/assets/{layout-Br_pZq2Q.js → layout-CFVu37BB.js} +1 -1
- package/web-shell/assets/{linear-BVlP6fte.js → linear-ChBxdtWf.js} +1 -1
- package/web-shell/assets/{mermaid.core-TrcYWoiF.js → mermaid.core-CMLfue0w.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-BJ4LzqjZ.js → mindmap-definition-FBJOCRG2-DFsvJThp.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-1b_MxlOl.js → pegDiagram-XKGWAZYB-BzpRzM4F.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-B8zl0YhY.js → pieDiagram-E7YTZNPT-Cv0Kankl.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-CIZO8ukl.js → quadrantDiagram-AXDQQJYC-Bh2BJ3Ay.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-CepHSbCj.js → railroadDiagram-O6MQD6OU-y8rNDdDS.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-BCgxkcSW.js → requirementDiagram-EFPCY7ZU-C0m2DKJ_.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-CE5CcoMM.js → sankeyDiagram-P5KCCOFB-BzdGnSF4.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-DvgHi-d5.js → sequenceDiagram-WJ2MYXX4-DPzAVmzz.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-T-fAsCPX.js → sizeCapture-X5ZJPWSS-LcHG28Zh.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-DYHaul-5.js → stateDiagram-HBIQ2CUA-C1Bzy3IT.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-LuuL5byY.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-Dbz3Qiej.js → swimlanes-XN3QIQJK-Bftk8V64.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-COmnNq8s.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-9NVRts3N.js → timeline-definition-24CTP7MA-BfXHcN1A.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-C7cb7vnH.js → vennDiagram-4TSXK5OY-DRSlI9-V.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-CG-8Ddjm.js → wardleyDiagram-VM6X3IG4-CaLmqGau.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-iGeYAcP4.js → xychartDiagram-S5SC5T6Z-8lgUT6e8.js} +1 -1
- package/web-shell/index.html +6 -3
- package/chunks/chunk-FKJM6JKY.js +0 -98
- package/web-shell/assets/channel-uEkvKckd.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-DuPsnhWS.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-DuPsnhWS.js +0 -1
- package/web-shell/assets/index-FO7JXPnH.css +0 -36
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-BcYho9a4.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-D6HsOIgX.js +0 -8
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
sanitizePromptText,
|
|
15
15
|
sanitizeSenderName,
|
|
16
16
|
truncateUtf16Units
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-65GHQ4FX.js";
|
|
18
18
|
import "./chunk-IW6RQPQB.js";
|
|
19
19
|
import "./chunk-CQ35AJ4Z.js";
|
|
20
20
|
import "./chunk-DMTGGOSA.js";
|
|
@@ -8382,6 +8382,9 @@ ${boundedLines.join("\n")}`);
|
|
|
8382
8382
|
}
|
|
8383
8383
|
__name(formatChatRecord, "formatChatRecord");
|
|
8384
8384
|
var DEDUP_TTL_MS = 5 * 60 * 1e3;
|
|
8385
|
+
var BACKGROUND_RESPONSE_AGGREGATION_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
8386
|
+
var BACKGROUND_RESPONSE_AGGREGATION_RETRY_MS = 30 * 1e3;
|
|
8387
|
+
var BACKGROUND_RESPONSE_AGGREGATION_MAX_RETRIES = 3;
|
|
8385
8388
|
var ACK_REACTION_NAME = "\u{1F440}";
|
|
8386
8389
|
var ACK_EMOTION_ID = "2659900";
|
|
8387
8390
|
var ACK_EMOTION_BG_ID = "im_bg_1";
|
|
@@ -8552,6 +8555,30 @@ async function withConnectLoggingSuppressed(connect) {
|
|
|
8552
8555
|
}
|
|
8553
8556
|
}
|
|
8554
8557
|
__name(withConnectLoggingSuppressed, "withConnectLoggingSuppressed");
|
|
8558
|
+
var ProactiveTextDeliveryError = class extends Error {
|
|
8559
|
+
static {
|
|
8560
|
+
__name(this, "ProactiveTextDeliveryError");
|
|
8561
|
+
}
|
|
8562
|
+
plan;
|
|
8563
|
+
retryable;
|
|
8564
|
+
constructor(plan, cause) {
|
|
8565
|
+
super(cause instanceof Error ? cause.message : String(cause), { cause });
|
|
8566
|
+
this.plan = plan;
|
|
8567
|
+
if (cause instanceof DingtalkCardRequestError) {
|
|
8568
|
+
this.retryable = cause.retryable;
|
|
8569
|
+
}
|
|
8570
|
+
}
|
|
8571
|
+
};
|
|
8572
|
+
var ReplyTextDeliveryError = class extends Error {
|
|
8573
|
+
static {
|
|
8574
|
+
__name(this, "ReplyTextDeliveryError");
|
|
8575
|
+
}
|
|
8576
|
+
plan;
|
|
8577
|
+
constructor(plan, cause) {
|
|
8578
|
+
super(cause instanceof Error ? cause.message : String(cause), { cause });
|
|
8579
|
+
this.plan = plan;
|
|
8580
|
+
}
|
|
8581
|
+
};
|
|
8555
8582
|
var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
8556
8583
|
static {
|
|
8557
8584
|
__name(this, "DingtalkChannel");
|
|
@@ -8582,6 +8609,7 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
8582
8609
|
*/
|
|
8583
8610
|
proactiveToken;
|
|
8584
8611
|
interactiveCardConfig;
|
|
8612
|
+
aggregateBackgroundAgentResponses;
|
|
8585
8613
|
interactiveCardClient;
|
|
8586
8614
|
statusCardController;
|
|
8587
8615
|
questionCardController;
|
|
@@ -8601,6 +8629,10 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
8601
8629
|
// must be dropped, because recreating state would post the tail of a
|
|
8602
8630
|
// force-split [FILE: ...] marker verbatim.
|
|
8603
8631
|
blockProjectionArmed = /* @__PURE__ */ new Set();
|
|
8632
|
+
backgroundResponseAggregations = /* @__PURE__ */ new Map();
|
|
8633
|
+
detachedBackgroundResponseAggregations = /* @__PURE__ */ new Set();
|
|
8634
|
+
pendingBackgroundResponseTerminals = /* @__PURE__ */ new Map();
|
|
8635
|
+
detachedPendingBackgroundResponseTerminals = /* @__PURE__ */ new Set();
|
|
8604
8636
|
constructor(name, config, bridge, options) {
|
|
8605
8637
|
super(name, config, bridge, options);
|
|
8606
8638
|
this.atSender = config["atSender"] === true;
|
|
@@ -8618,6 +8650,11 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
8618
8650
|
this.config.instructions += FILE_INSTRUCTIONS;
|
|
8619
8651
|
}
|
|
8620
8652
|
this.interactiveCardConfig = parseDingtalkInteractiveCardConfig(config.interactiveCards);
|
|
8653
|
+
const rawAggregateBackgroundAgentResponses = config.aggregateBackgroundAgentResponses;
|
|
8654
|
+
if (rawAggregateBackgroundAgentResponses !== void 0 && typeof rawAggregateBackgroundAgentResponses !== "boolean") {
|
|
8655
|
+
throw new Error(`Channel "${name}" aggregateBackgroundAgentResponses must be a boolean.`);
|
|
8656
|
+
}
|
|
8657
|
+
this.aggregateBackgroundAgentResponses = rawAggregateBackgroundAgentResponses === true;
|
|
8621
8658
|
if (!config.clientId || !config.clientSecret) {
|
|
8622
8659
|
throw new Error(`Channel "${name}" requires clientId and clientSecret for DingTalk.`);
|
|
8623
8660
|
}
|
|
@@ -9015,16 +9052,27 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9015
9052
|
}
|
|
9016
9053
|
return replaceImageMarkers(text, markers, replacements);
|
|
9017
9054
|
}
|
|
9018
|
-
async sendReply(chatId, text, atUserId, sourceLabel, prepared = false) {
|
|
9055
|
+
async sendReply(chatId, text, atUserId, sourceLabel, prepared = false, failOnHttpError = false) {
|
|
9019
9056
|
const webhook = this.webhooks.get(chatId);
|
|
9020
9057
|
if (!webhook) {
|
|
9021
9058
|
process.stderr.write(`[DingTalk:${this.name}] No webhook for chatId ${chatId}, cannot send.
|
|
9022
9059
|
`);
|
|
9060
|
+
if (failOnHttpError) {
|
|
9061
|
+
throw new Error("DingTalk session webhook unavailable");
|
|
9062
|
+
}
|
|
9023
9063
|
return;
|
|
9024
9064
|
}
|
|
9025
9065
|
const outgoingText = prepared ? text : await this.prepareReplyOutput(chatId, text);
|
|
9026
9066
|
if (!outgoingText.trim())
|
|
9027
9067
|
return;
|
|
9068
|
+
const plan = this.createReplyTextDelivery(outgoingText, atUserId, sourceLabel);
|
|
9069
|
+
try {
|
|
9070
|
+
await this.deliverReplyText(chatId, plan, failOnHttpError);
|
|
9071
|
+
} catch (error) {
|
|
9072
|
+
throw new ReplyTextDeliveryError(plan, error);
|
|
9073
|
+
}
|
|
9074
|
+
}
|
|
9075
|
+
createReplyTextDelivery(outgoingText, atUserId, sourceLabel) {
|
|
9028
9076
|
const mentionPrefix = atUserId ? `@${atUserId}
|
|
9029
9077
|
|
|
9030
9078
|
` : "";
|
|
@@ -9036,17 +9084,32 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9036
9084
|
throw new Error("DingTalk source label exceeds the message limit.");
|
|
9037
9085
|
}
|
|
9038
9086
|
const chunks = normalizeDingTalkMarkdown(outgoingText, contentLimit).map((chunk, index) => `${index === 0 ? mentionPrefix : ""}${sourcePrefix}${chunk}`);
|
|
9039
|
-
|
|
9040
|
-
|
|
9041
|
-
|
|
9042
|
-
|
|
9087
|
+
return {
|
|
9088
|
+
title: extractTitle(outgoingText),
|
|
9089
|
+
chunks,
|
|
9090
|
+
nextChunk: 0,
|
|
9091
|
+
...atUserId ? { atUserId } : {}
|
|
9092
|
+
};
|
|
9093
|
+
}
|
|
9094
|
+
async deliverReplyText(chatId, plan, failOnHttpError = false) {
|
|
9095
|
+
const webhook = this.webhooks.get(chatId);
|
|
9096
|
+
if (!webhook) {
|
|
9097
|
+
if (failOnHttpError) {
|
|
9098
|
+
throw new Error("DingTalk session webhook unavailable");
|
|
9099
|
+
}
|
|
9100
|
+
return;
|
|
9101
|
+
}
|
|
9102
|
+
while (plan.nextChunk < plan.chunks.length) {
|
|
9103
|
+
const index = plan.nextChunk;
|
|
9104
|
+
const chunk = plan.chunks[index];
|
|
9105
|
+
const isMention = index === 0 && plan.atUserId !== void 0;
|
|
9043
9106
|
const body = {
|
|
9044
9107
|
msgtype: "markdown",
|
|
9045
9108
|
markdown: {
|
|
9046
|
-
title:
|
|
9109
|
+
title: index === 0 ? plan.title : `${plan.title} (cont.)`,
|
|
9047
9110
|
text: chunk
|
|
9048
9111
|
},
|
|
9049
|
-
...isMention ? { at: { atUserIds: [atUserId] } } : {}
|
|
9112
|
+
...isMention ? { at: { atUserIds: [plan.atUserId] } } : {}
|
|
9050
9113
|
};
|
|
9051
9114
|
let resp;
|
|
9052
9115
|
try {
|
|
@@ -9073,7 +9136,21 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9073
9136
|
const detail = await resp.text().catch(() => "");
|
|
9074
9137
|
process.stderr.write(`[DingTalk:${this.name}] sendMessage failed: HTTP ${resp.status} ${detail}
|
|
9075
9138
|
`);
|
|
9139
|
+
if (failOnHttpError) {
|
|
9140
|
+
throw new Error(`DingTalk reply send failed: HTTP ${resp.status} ${detail}`);
|
|
9141
|
+
}
|
|
9142
|
+
} else if (failOnHttpError) {
|
|
9143
|
+
const payload = await resp.clone().json().catch(() => void 0);
|
|
9144
|
+
const response = payload && typeof payload === "object" ? payload : void 0;
|
|
9145
|
+
const value = response?.["errcode"] ?? response?.["code"];
|
|
9146
|
+
if (value !== void 0 && String(value) !== "0") {
|
|
9147
|
+
const detail = sanitizeLogText(String(response?.["errmsg"] ?? response?.["message"] ?? value), 300);
|
|
9148
|
+
process.stderr.write(`[DingTalk:${this.name}] sendMessage failed: ${detail}
|
|
9149
|
+
`);
|
|
9150
|
+
throw new Error(`DingTalk reply send failed: ${detail}`);
|
|
9151
|
+
}
|
|
9076
9152
|
}
|
|
9153
|
+
plan.nextChunk++;
|
|
9077
9154
|
}
|
|
9078
9155
|
}
|
|
9079
9156
|
async sendMessage(chatId, text) {
|
|
@@ -9103,9 +9180,19 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9103
9180
|
async pushProactive(target, text, sourceLabel) {
|
|
9104
9181
|
if (!text.trim())
|
|
9105
9182
|
return;
|
|
9183
|
+
const plan = await this.createProactiveTextDelivery(target, text, sourceLabel);
|
|
9184
|
+
if (!plan)
|
|
9185
|
+
return;
|
|
9186
|
+
try {
|
|
9187
|
+
await this.deliverProactiveText(target, plan);
|
|
9188
|
+
} catch (error) {
|
|
9189
|
+
throw new ProactiveTextDeliveryError(plan, error);
|
|
9190
|
+
}
|
|
9191
|
+
}
|
|
9192
|
+
async createProactiveTextDelivery(target, text, sourceLabel) {
|
|
9106
9193
|
const outgoingText = await this.prepareFileOutput(text, (file, mediaId) => this.sendProactiveFile(target, file, mediaId));
|
|
9107
9194
|
if (!outgoingText.trim())
|
|
9108
|
-
return;
|
|
9195
|
+
return void 0;
|
|
9109
9196
|
const sourcePrefix = sourceLabel ? `${escapeDingTalkMarkdown(sourceLabel)}
|
|
9110
9197
|
|
|
9111
9198
|
` : "";
|
|
@@ -9114,9 +9201,13 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9114
9201
|
throw new Error("DingTalk source label exceeds the message limit.");
|
|
9115
9202
|
}
|
|
9116
9203
|
const chunks = normalizeDingTalkMarkdown(outgoingText, contentLimit).map((chunk) => `${sourcePrefix}${chunk}`);
|
|
9117
|
-
|
|
9118
|
-
|
|
9119
|
-
|
|
9204
|
+
return { title: extractTitle(outgoingText), chunks, nextChunk: 0 };
|
|
9205
|
+
}
|
|
9206
|
+
async deliverProactiveText(target, plan) {
|
|
9207
|
+
while (plan.nextChunk < plan.chunks.length) {
|
|
9208
|
+
const index = plan.nextChunk;
|
|
9209
|
+
await this.sendProactiveChunk(target, index === 0 ? plan.title : `${plan.title} (cont.)`, plan.chunks[index], `chunk ${index + 1}/${plan.chunks.length}`);
|
|
9210
|
+
plan.nextChunk++;
|
|
9120
9211
|
}
|
|
9121
9212
|
}
|
|
9122
9213
|
async getProactiveToken() {
|
|
@@ -9316,6 +9407,7 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9316
9407
|
clearInterval(this.dedupTimer);
|
|
9317
9408
|
}
|
|
9318
9409
|
this.statusCardController?.dispose();
|
|
9410
|
+
this.drainBackgroundResponseAggregations();
|
|
9319
9411
|
this.activeReactionKeys.clear();
|
|
9320
9412
|
this.sessionReactionKeys.clear();
|
|
9321
9413
|
if (this.connectionManager) {
|
|
@@ -9409,6 +9501,7 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9409
9501
|
}
|
|
9410
9502
|
}
|
|
9411
9503
|
this.sessionMentionTargets.delete(sessionId);
|
|
9504
|
+
this.drainBackgroundResponseAggregations(sessionId);
|
|
9412
9505
|
const cardRunId = this.cardRunBySession.get(sessionId);
|
|
9413
9506
|
if (cardRunId) {
|
|
9414
9507
|
this.cardRunBySession.delete(sessionId);
|
|
@@ -9428,6 +9521,9 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9428
9521
|
}
|
|
9429
9522
|
super.onSessionDied(sessionId);
|
|
9430
9523
|
}
|
|
9524
|
+
onSessionRetiring(sessionId) {
|
|
9525
|
+
this.drainBackgroundResponseAggregations(sessionId);
|
|
9526
|
+
}
|
|
9431
9527
|
onTaskLifecycle(event) {
|
|
9432
9528
|
if (event.type === "started") {
|
|
9433
9529
|
this.startReaction(event.chatId, event.messageId, event.sessionId);
|
|
@@ -9583,18 +9679,569 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9583
9679
|
`);
|
|
9584
9680
|
});
|
|
9585
9681
|
}
|
|
9682
|
+
/** Deliver every Agent segment immediately unless aggregation is enabled. */
|
|
9683
|
+
async dispatchBackgroundResponse(sessionId, text, context) {
|
|
9684
|
+
const target = this.router.getTarget(sessionId);
|
|
9685
|
+
if (!target || target.channelName !== this.name || context !== void 0 && context.kind !== "agent") {
|
|
9686
|
+
return super.dispatchBackgroundResponse(sessionId, text, context);
|
|
9687
|
+
}
|
|
9688
|
+
const canAggregate = this.aggregateBackgroundAgentResponses && context?.kind === "agent" && typeof context.turnComplete === "boolean";
|
|
9689
|
+
if (!canAggregate) {
|
|
9690
|
+
if (text.trim().length === 0) {
|
|
9691
|
+
return super.dispatchBackgroundResponse(sessionId, text, context);
|
|
9692
|
+
}
|
|
9693
|
+
return super.dispatchBackgroundResponse(sessionId, this.formatBackgroundAgentResponse(text, context?.label), context);
|
|
9694
|
+
}
|
|
9695
|
+
const key = JSON.stringify([sessionId, context.taskId, context.turnId]);
|
|
9696
|
+
let current = this.backgroundResponseAggregations.get(key);
|
|
9697
|
+
let parked = this.pendingBackgroundResponseTerminals.get(key);
|
|
9698
|
+
if (current?.turnComplete === true) {
|
|
9699
|
+
this.detachedBackgroundResponseAggregations.add(current);
|
|
9700
|
+
this.backgroundResponseAggregations.delete(key);
|
|
9701
|
+
current = void 0;
|
|
9702
|
+
}
|
|
9703
|
+
if (!current && (parked?.turnEnded === true || parked?.turnComplete === true && (parked.retryTimer || parked.retryInFlight || parked.resolvers > 0))) {
|
|
9704
|
+
if (!parked.turnEnded) {
|
|
9705
|
+
this.detachedPendingBackgroundResponseTerminals.add(parked);
|
|
9706
|
+
}
|
|
9707
|
+
parked = { sessionId, target, resolvers: 0, held: [] };
|
|
9708
|
+
this.pendingBackgroundResponseTerminals.set(key, parked);
|
|
9709
|
+
}
|
|
9710
|
+
if (!current && text.trim().length === 0) {
|
|
9711
|
+
if (!parked || parked.resolvers === 0 && !parked.retryTimer && !parked.retryInFlight && !parked.resolutionDropped && !parked.turnComplete) {
|
|
9712
|
+
if (parked)
|
|
9713
|
+
this.pendingBackgroundResponseTerminals.delete(key);
|
|
9714
|
+
return super.dispatchBackgroundResponse(sessionId, text, context);
|
|
9715
|
+
}
|
|
9716
|
+
if (context.turnComplete) {
|
|
9717
|
+
parked.turnComplete = true;
|
|
9718
|
+
parked.status = context.status;
|
|
9719
|
+
parked.label = context.label ?? parked.label;
|
|
9720
|
+
parked.completionPartial = context.partial === true;
|
|
9721
|
+
if (parked.resolvers === 0 && !parked.retryTimer && !parked.retryInFlight && (parked.retryAttempts ?? 0) >= BACKGROUND_RESPONSE_AGGREGATION_MAX_RETRIES) {
|
|
9722
|
+
parked.turnEnded = true;
|
|
9723
|
+
this.pendingBackgroundResponseTerminals.delete(key);
|
|
9724
|
+
}
|
|
9725
|
+
}
|
|
9726
|
+
return;
|
|
9727
|
+
}
|
|
9728
|
+
if (!current) {
|
|
9729
|
+
parked ??= { sessionId, target, resolvers: 0, held: [] };
|
|
9730
|
+
this.pendingBackgroundResponseTerminals.set(key, parked);
|
|
9731
|
+
this.holdPendingBackgroundResponse(parked, text, context);
|
|
9732
|
+
parked.resolvers++;
|
|
9733
|
+
try {
|
|
9734
|
+
let delivery;
|
|
9735
|
+
try {
|
|
9736
|
+
delivery = await this.resolveBackgroundResponseDelivery(sessionId);
|
|
9737
|
+
} catch (error) {
|
|
9738
|
+
if (parked.resolvers === 1 && !this.backgroundResponseAggregations.has(key)) {
|
|
9739
|
+
this.scheduleBackgroundResponseResolutionRetry(key, sessionId, parked);
|
|
9740
|
+
} else {
|
|
9741
|
+
const existing = this.backgroundResponseAggregations.get(key);
|
|
9742
|
+
if (existing) {
|
|
9743
|
+
if (parked.held.length > 0) {
|
|
9744
|
+
this.applyHeldBackgroundResponses(existing, parked);
|
|
9745
|
+
}
|
|
9746
|
+
this.applyPendingBackgroundResponseTerminal(existing, parked);
|
|
9747
|
+
if (parked.resolvers === 1) {
|
|
9748
|
+
if (existing.turnComplete) {
|
|
9749
|
+
await this.completeBackgroundResponseAggregation(key, existing);
|
|
9750
|
+
} else {
|
|
9751
|
+
this.scheduleBackgroundResponseAggregationFlush(key, existing);
|
|
9752
|
+
}
|
|
9753
|
+
}
|
|
9754
|
+
}
|
|
9755
|
+
}
|
|
9756
|
+
throw error;
|
|
9757
|
+
}
|
|
9758
|
+
if (!delivery || this.router.getTarget(sessionId) !== delivery.target) {
|
|
9759
|
+
if (parked.resolvers === 1 && !this.backgroundResponseAggregations.has(key)) {
|
|
9760
|
+
this.scheduleBackgroundResponseResolutionRetry(key, sessionId, parked);
|
|
9761
|
+
} else {
|
|
9762
|
+
const existing = this.backgroundResponseAggregations.get(key);
|
|
9763
|
+
if (existing) {
|
|
9764
|
+
if (parked.held.length > 0) {
|
|
9765
|
+
this.applyHeldBackgroundResponses(existing, parked);
|
|
9766
|
+
}
|
|
9767
|
+
this.applyPendingBackgroundResponseTerminal(existing, parked);
|
|
9768
|
+
if (parked.resolvers === 1) {
|
|
9769
|
+
if (existing.turnComplete) {
|
|
9770
|
+
await this.completeBackgroundResponseAggregation(key, existing);
|
|
9771
|
+
} else {
|
|
9772
|
+
this.scheduleBackgroundResponseAggregationFlush(key, existing);
|
|
9773
|
+
}
|
|
9774
|
+
}
|
|
9775
|
+
}
|
|
9776
|
+
}
|
|
9777
|
+
return;
|
|
9778
|
+
}
|
|
9779
|
+
if (parked.retiring || this.pendingBackgroundResponseTerminals.get(key) !== parked) {
|
|
9780
|
+
await this.flushDetachedBackgroundResponse(key, sessionId, parked, delivery);
|
|
9781
|
+
return;
|
|
9782
|
+
}
|
|
9783
|
+
if (parked.retryTimer) {
|
|
9784
|
+
clearTimeout(parked.retryTimer);
|
|
9785
|
+
parked.retryTimer = void 0;
|
|
9786
|
+
}
|
|
9787
|
+
current = this.backgroundResponseAggregations.get(key) ?? this.createBackgroundResponseAggregation(key, sessionId, parked.held[0]?.context ?? context, delivery.target, delivery.sourceLabel);
|
|
9788
|
+
this.applyHeldBackgroundResponses(current, parked);
|
|
9789
|
+
this.applyPendingBackgroundResponseTerminal(current, parked);
|
|
9790
|
+
if (parked.resolutionDropped) {
|
|
9791
|
+
current.resolutionDropped = true;
|
|
9792
|
+
parked.resolutionDropped = void 0;
|
|
9793
|
+
}
|
|
9794
|
+
} finally {
|
|
9795
|
+
parked.resolvers--;
|
|
9796
|
+
if (this.pendingBackgroundResponseTerminals.get(key) === parked && parked.resolvers === 0 && !parked.retryTimer && parked.held.length === 0 && (!parked.resolutionDropped || parked.turnEnded)) {
|
|
9797
|
+
this.pendingBackgroundResponseTerminals.delete(key);
|
|
9798
|
+
}
|
|
9799
|
+
}
|
|
9800
|
+
if (!current)
|
|
9801
|
+
return;
|
|
9802
|
+
if (current.turnComplete && parked.resolvers > 0)
|
|
9803
|
+
return;
|
|
9804
|
+
if (!current.turnComplete) {
|
|
9805
|
+
this.scheduleBackgroundResponseAggregationFlush(key, current);
|
|
9806
|
+
} else {
|
|
9807
|
+
await this.completeBackgroundResponseAggregation(key, current);
|
|
9808
|
+
}
|
|
9809
|
+
return;
|
|
9810
|
+
}
|
|
9811
|
+
current.status = context.status;
|
|
9812
|
+
current.label = context.label ?? current.label;
|
|
9813
|
+
if (text.trim().length > 0)
|
|
9814
|
+
current.parts.push(text);
|
|
9815
|
+
if (context.turnComplete && parked && parked.resolvers > 0) {
|
|
9816
|
+
parked.turnComplete = true;
|
|
9817
|
+
parked.status = context.status;
|
|
9818
|
+
parked.label = context.label ?? parked.label;
|
|
9819
|
+
parked.completionPartial = context.partial === true;
|
|
9820
|
+
} else if (context.turnComplete) {
|
|
9821
|
+
current.turnComplete = true;
|
|
9822
|
+
current.completionPartial = context.partial === true;
|
|
9823
|
+
} else if (parked?.turnComplete && parked.resolvers === 0) {
|
|
9824
|
+
current.turnComplete = true;
|
|
9825
|
+
current.status = parked.status ?? current.status;
|
|
9826
|
+
current.label = parked.label ?? current.label;
|
|
9827
|
+
current.completionPartial = parked.completionPartial === true;
|
|
9828
|
+
}
|
|
9829
|
+
current.resolutionDropped ||= parked?.resolutionDropped;
|
|
9830
|
+
if (!current.turnComplete) {
|
|
9831
|
+
this.scheduleBackgroundResponseAggregationFlush(key, current);
|
|
9832
|
+
return;
|
|
9833
|
+
}
|
|
9834
|
+
await this.completeBackgroundResponseAggregation(key, current);
|
|
9835
|
+
}
|
|
9836
|
+
async flushBackgroundResponseAggregation(key, aggregation) {
|
|
9837
|
+
if (this.backgroundResponseAggregations.get(key) !== aggregation && !this.detachedBackgroundResponseAggregations.has(aggregation) || aggregation.flushing) {
|
|
9838
|
+
return;
|
|
9839
|
+
}
|
|
9840
|
+
this.refreshBackgroundResponseDelivery(aggregation);
|
|
9841
|
+
if (aggregation.retryTimer)
|
|
9842
|
+
clearTimeout(aggregation.retryTimer);
|
|
9843
|
+
aggregation.retryTimer = void 0;
|
|
9844
|
+
let delivery = aggregation.delivery;
|
|
9845
|
+
if (!delivery) {
|
|
9846
|
+
if (aggregation.parts.length === 0) {
|
|
9847
|
+
if (!this.owesTerminalBackgroundResponseCard(aggregation)) {
|
|
9848
|
+
if (aggregation.retiring || aggregation.turnComplete) {
|
|
9849
|
+
this.removeBackgroundResponseAggregation(key, aggregation);
|
|
9850
|
+
} else {
|
|
9851
|
+
this.scheduleBackgroundResponseAggregationFlush(key, aggregation);
|
|
9852
|
+
}
|
|
9853
|
+
return;
|
|
9854
|
+
}
|
|
9855
|
+
}
|
|
9856
|
+
if (aggregation.timeoutTimer)
|
|
9857
|
+
clearTimeout(aggregation.timeoutTimer);
|
|
9858
|
+
aggregation.timeoutTimer = void 0;
|
|
9859
|
+
const parts = aggregation.parts.splice(0);
|
|
9860
|
+
delivery = {
|
|
9861
|
+
status: aggregation.status,
|
|
9862
|
+
label: aggregation.label,
|
|
9863
|
+
parts,
|
|
9864
|
+
partial: this.isPartialBackgroundResponseDelivery(aggregation, parts.length),
|
|
9865
|
+
attempts: 0,
|
|
9866
|
+
composedTurnComplete: aggregation.turnComplete === true
|
|
9867
|
+
};
|
|
9868
|
+
aggregation.delivery = delivery;
|
|
9869
|
+
}
|
|
9870
|
+
const body = this.formatBackgroundResponseAggregation(delivery);
|
|
9871
|
+
aggregation.flushing = true;
|
|
9872
|
+
let error;
|
|
9873
|
+
try {
|
|
9874
|
+
if (delivery.proactivePlan) {
|
|
9875
|
+
await this.deliverProactiveText(aggregation.target, delivery.proactivePlan);
|
|
9876
|
+
} else if (delivery.replyPlan) {
|
|
9877
|
+
await this.deliverReplyText(aggregation.target.chatId, delivery.replyPlan, true);
|
|
9878
|
+
} else if (this.supportsProactiveSend() && this.supportsProactiveTarget(aggregation.target)) {
|
|
9879
|
+
await this.deliverBackgroundResponseToTarget(aggregation.sessionId, body, {
|
|
9880
|
+
target: aggregation.target,
|
|
9881
|
+
sourceLabel: aggregation.sourceLabel
|
|
9882
|
+
});
|
|
9883
|
+
} else {
|
|
9884
|
+
delivery.preparedReplyBody ??= await this.prepareReplyOutput(aggregation.target.chatId, body);
|
|
9885
|
+
await this.deliverBackgroundReply(aggregation.target.chatId, delivery.preparedReplyBody, aggregation.sessionId, aggregation.sourceLabel, true, true);
|
|
9886
|
+
}
|
|
9887
|
+
} catch (caught) {
|
|
9888
|
+
error = caught;
|
|
9889
|
+
if (caught instanceof ProactiveTextDeliveryError) {
|
|
9890
|
+
delivery.proactivePlan = caught.plan;
|
|
9891
|
+
} else if (caught instanceof ReplyTextDeliveryError) {
|
|
9892
|
+
delivery.replyPlan = caught.plan;
|
|
9893
|
+
}
|
|
9894
|
+
} finally {
|
|
9895
|
+
aggregation.flushing = false;
|
|
9896
|
+
}
|
|
9897
|
+
if (error === void 0) {
|
|
9898
|
+
aggregation.delivery = void 0;
|
|
9899
|
+
aggregation.delivered = true;
|
|
9900
|
+
if (delivery.composedTurnComplete === true && aggregation.turnComplete && delivery.partial !== true && !aggregation.retiring) {
|
|
9901
|
+
aggregation.completionDelivered = true;
|
|
9902
|
+
}
|
|
9903
|
+
if (aggregation.retiring || aggregation.turnComplete) {
|
|
9904
|
+
await this.flushBackgroundResponseAggregation(key, aggregation);
|
|
9905
|
+
} else {
|
|
9906
|
+
this.scheduleBackgroundResponseAggregationFlush(key, aggregation);
|
|
9907
|
+
}
|
|
9908
|
+
return;
|
|
9909
|
+
}
|
|
9910
|
+
delivery.attempts++;
|
|
9911
|
+
process.stderr.write(`[DingTalk:${this.name}] background response delivery failed (attempt ${delivery.attempts}): ${sanitizeLogText(error instanceof Error ? error.message : String(error), 300)}
|
|
9912
|
+
`);
|
|
9913
|
+
if (delivery.attempts >= BACKGROUND_RESPONSE_AGGREGATION_MAX_RETRIES || // A permanently rejected send (an invalid appkey, a missing app) cannot
|
|
9914
|
+
// succeed later; retrying it only spends the chat's send quota.
|
|
9915
|
+
error instanceof ProactiveTextDeliveryError && error.retryable === false) {
|
|
9916
|
+
aggregation.delivery = void 0;
|
|
9917
|
+
aggregation.dropped = true;
|
|
9918
|
+
if (aggregation.parts.length === 0) {
|
|
9919
|
+
if (aggregation.retiring || aggregation.turnComplete) {
|
|
9920
|
+
this.removeBackgroundResponseAggregation(key, aggregation);
|
|
9921
|
+
} else {
|
|
9922
|
+
this.scheduleBackgroundResponseAggregationFlush(key, aggregation);
|
|
9923
|
+
}
|
|
9924
|
+
} else if (aggregation.retiring || aggregation.turnComplete) {
|
|
9925
|
+
await this.flushBackgroundResponseAggregation(key, aggregation);
|
|
9926
|
+
} else {
|
|
9927
|
+
this.scheduleBackgroundResponseAggregationFlush(key, aggregation);
|
|
9928
|
+
}
|
|
9929
|
+
return;
|
|
9930
|
+
}
|
|
9931
|
+
aggregation.retryTimer = setTimeout(() => {
|
|
9932
|
+
aggregation.retryTimer = void 0;
|
|
9933
|
+
void this.flushBackgroundResponseAggregation(key, aggregation);
|
|
9934
|
+
}, BACKGROUND_RESPONSE_AGGREGATION_RETRY_MS);
|
|
9935
|
+
aggregation.retryTimer.unref?.();
|
|
9936
|
+
}
|
|
9937
|
+
/**
|
|
9938
|
+
* A card carries `(部分)` whenever it is not the turn's whole output: the
|
|
9939
|
+
* turn is still open, earlier text already went out (or was given up on),
|
|
9940
|
+
* or the turn itself ended early.
|
|
9941
|
+
*/
|
|
9942
|
+
isPartialBackgroundResponseDelivery(aggregation, partCount) {
|
|
9943
|
+
return partCount > 0 && (aggregation.delivered === true || aggregation.dropped === true || aggregation.resolutionDropped === true || aggregation.retiring === true || aggregation.completionPartial === true || aggregation.turnComplete !== true);
|
|
9944
|
+
}
|
|
9945
|
+
/**
|
|
9946
|
+
* A turn that outran the bounded wait had its text delivered under the
|
|
9947
|
+
* `(部分)` label. When it then completes normally with nothing buffered,
|
|
9948
|
+
* a header-only card is the only way the chat ever learns it finished.
|
|
9949
|
+
*/
|
|
9950
|
+
owesTerminalBackgroundResponseCard(aggregation) {
|
|
9951
|
+
return aggregation.turnComplete === true && aggregation.delivered === true && aggregation.completionDelivered !== true && aggregation.retiring !== true && aggregation.completionPartial !== true && aggregation.dropped !== true && aggregation.resolutionDropped !== true;
|
|
9952
|
+
}
|
|
9953
|
+
refreshBackgroundResponseDelivery(aggregation) {
|
|
9954
|
+
const delivery = aggregation.delivery;
|
|
9955
|
+
if (!delivery || aggregation.flushing)
|
|
9956
|
+
return;
|
|
9957
|
+
const plan = delivery.proactivePlan ?? delivery.replyPlan;
|
|
9958
|
+
if (plan && plan.nextChunk > 0)
|
|
9959
|
+
return;
|
|
9960
|
+
const body = this.formatBackgroundResponseAggregation(delivery);
|
|
9961
|
+
const header = body.split("\n", 1)[0];
|
|
9962
|
+
const replaceHeader = /* @__PURE__ */ __name((text) => text.replace(/## (?:✅|❌|⏹️) Agent · [^\n]+/, () => header), "replaceHeader");
|
|
9963
|
+
if (plan) {
|
|
9964
|
+
plan.title = extractTitle(body);
|
|
9965
|
+
plan.chunks[0] = replaceHeader(plan.chunks[0]);
|
|
9966
|
+
}
|
|
9967
|
+
if (delivery.preparedReplyBody) {
|
|
9968
|
+
delivery.preparedReplyBody = replaceHeader(delivery.preparedReplyBody);
|
|
9969
|
+
}
|
|
9970
|
+
delivery.composedTurnComplete = aggregation.turnComplete === true;
|
|
9971
|
+
}
|
|
9972
|
+
removeBackgroundResponseAggregation(key, aggregation) {
|
|
9973
|
+
if (this.backgroundResponseAggregations.get(key) === aggregation) {
|
|
9974
|
+
this.backgroundResponseAggregations.delete(key);
|
|
9975
|
+
}
|
|
9976
|
+
this.detachedBackgroundResponseAggregations.delete(aggregation);
|
|
9977
|
+
}
|
|
9978
|
+
drainBackgroundResponseAggregations(sessionId) {
|
|
9979
|
+
for (const [key, pending] of this.pendingBackgroundResponseTerminals) {
|
|
9980
|
+
if (sessionId !== void 0 && pending.sessionId !== sessionId)
|
|
9981
|
+
continue;
|
|
9982
|
+
if (pending.retryTimer)
|
|
9983
|
+
clearTimeout(pending.retryTimer);
|
|
9984
|
+
pending.retryTimer = void 0;
|
|
9985
|
+
pending.retiring = true;
|
|
9986
|
+
pending.turnComplete = true;
|
|
9987
|
+
pending.completionPartial = true;
|
|
9988
|
+
this.pendingBackgroundResponseTerminals.delete(key);
|
|
9989
|
+
this.detachedPendingBackgroundResponseTerminals.add(pending);
|
|
9990
|
+
}
|
|
9991
|
+
for (const pending of this.detachedPendingBackgroundResponseTerminals) {
|
|
9992
|
+
if (sessionId !== void 0 && pending.sessionId !== sessionId)
|
|
9993
|
+
continue;
|
|
9994
|
+
if (pending.retryTimer)
|
|
9995
|
+
clearTimeout(pending.retryTimer);
|
|
9996
|
+
pending.retryTimer = void 0;
|
|
9997
|
+
pending.retiring = true;
|
|
9998
|
+
pending.turnComplete = true;
|
|
9999
|
+
pending.completionPartial = true;
|
|
10000
|
+
if (pending.held.length > 0 && this.router.getTarget(pending.sessionId) === pending.target) {
|
|
10001
|
+
void this.flushDetachedBackgroundResponse("", pending.sessionId, pending, { target: pending.target }).catch((error) => {
|
|
10002
|
+
process.stderr.write(`[DingTalk:${this.name}] background response delivery failed during drain: ${sanitizeLogText(error instanceof Error ? error.message : String(error), 300)}
|
|
10003
|
+
`);
|
|
10004
|
+
});
|
|
10005
|
+
} else if (pending.held.length > 0) {
|
|
10006
|
+
process.stderr.write(`[DingTalk:${this.name}] background response target unavailable during drain; ${pending.held.length} buffered segment(s) discarded
|
|
10007
|
+
`);
|
|
10008
|
+
pending.held.length = 0;
|
|
10009
|
+
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10010
|
+
} else if (pending.held.length === 0) {
|
|
10011
|
+
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10012
|
+
}
|
|
10013
|
+
}
|
|
10014
|
+
const aggregations = /* @__PURE__ */ new Set([
|
|
10015
|
+
...this.backgroundResponseAggregations.values(),
|
|
10016
|
+
...this.detachedBackgroundResponseAggregations
|
|
10017
|
+
]);
|
|
10018
|
+
for (const aggregation of aggregations) {
|
|
10019
|
+
if (sessionId !== void 0 && aggregation.sessionId !== sessionId) {
|
|
10020
|
+
continue;
|
|
10021
|
+
}
|
|
10022
|
+
if (aggregation.timeoutTimer)
|
|
10023
|
+
clearTimeout(aggregation.timeoutTimer);
|
|
10024
|
+
if (aggregation.retryTimer)
|
|
10025
|
+
clearTimeout(aggregation.retryTimer);
|
|
10026
|
+
aggregation.timeoutTimer = void 0;
|
|
10027
|
+
aggregation.retryTimer = void 0;
|
|
10028
|
+
aggregation.retiring = true;
|
|
10029
|
+
aggregation.turnComplete = true;
|
|
10030
|
+
aggregation.completionPartial = true;
|
|
10031
|
+
if (!aggregation.flushing) {
|
|
10032
|
+
void this.flushBackgroundResponseAggregation(aggregation.key, aggregation);
|
|
10033
|
+
}
|
|
10034
|
+
}
|
|
10035
|
+
}
|
|
10036
|
+
createBackgroundResponseAggregation(key, sessionId, context, target, sourceLabel) {
|
|
10037
|
+
const aggregation = {
|
|
10038
|
+
key,
|
|
10039
|
+
sessionId,
|
|
10040
|
+
target,
|
|
10041
|
+
sourceLabel,
|
|
10042
|
+
status: context.status,
|
|
10043
|
+
label: context.label,
|
|
10044
|
+
parts: []
|
|
10045
|
+
};
|
|
10046
|
+
this.backgroundResponseAggregations.set(key, aggregation);
|
|
10047
|
+
return aggregation;
|
|
10048
|
+
}
|
|
10049
|
+
scheduleBackgroundResponseResolutionRetry(key, sessionId, pending) {
|
|
10050
|
+
if (pending.retiring)
|
|
10051
|
+
return;
|
|
10052
|
+
if (pending.retryTimer)
|
|
10053
|
+
return;
|
|
10054
|
+
pending.retryAttempts = (pending.retryAttempts ?? 0) + 1;
|
|
10055
|
+
if (pending.retryAttempts >= BACKGROUND_RESPONSE_AGGREGATION_MAX_RETRIES) {
|
|
10056
|
+
pending.resolutionDropped = true;
|
|
10057
|
+
pending.turnEnded = pending.turnComplete === true;
|
|
10058
|
+
pending.held.length = 0;
|
|
10059
|
+
pending.turnComplete = void 0;
|
|
10060
|
+
pending.status = void 0;
|
|
10061
|
+
pending.label = void 0;
|
|
10062
|
+
pending.completionPartial = void 0;
|
|
10063
|
+
if (pending.turnEnded) {
|
|
10064
|
+
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10065
|
+
}
|
|
10066
|
+
return;
|
|
10067
|
+
}
|
|
10068
|
+
pending.retryTimer = setTimeout(() => {
|
|
10069
|
+
pending.retryTimer = void 0;
|
|
10070
|
+
pending.retryInFlight = true;
|
|
10071
|
+
void this.retryBackgroundResponseResolution(key, sessionId, pending).catch((error) => {
|
|
10072
|
+
process.stderr.write(`[DingTalk:${this.name}] background response target resolution failed: ${sanitizeLogText(error instanceof Error ? error.message : String(error), 300)}
|
|
10073
|
+
`);
|
|
10074
|
+
}).finally(() => {
|
|
10075
|
+
pending.retryInFlight = false;
|
|
10076
|
+
if (pending.retiring || !pending.retryTimer && !pending.resolutionDropped) {
|
|
10077
|
+
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10078
|
+
}
|
|
10079
|
+
if (this.pendingBackgroundResponseTerminals.get(key) === pending && pending.resolvers === 0 && !pending.retryTimer && pending.held.length === 0 && (!pending.resolutionDropped || pending.turnEnded)) {
|
|
10080
|
+
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10081
|
+
}
|
|
10082
|
+
});
|
|
10083
|
+
}, BACKGROUND_RESPONSE_AGGREGATION_RETRY_MS);
|
|
10084
|
+
pending.retryTimer.unref?.();
|
|
10085
|
+
const active = this.pendingBackgroundResponseTerminals.get(key);
|
|
10086
|
+
if (!active || active === pending) {
|
|
10087
|
+
this.pendingBackgroundResponseTerminals.set(key, pending);
|
|
10088
|
+
}
|
|
10089
|
+
}
|
|
10090
|
+
async retryBackgroundResponseResolution(key, sessionId, pending) {
|
|
10091
|
+
let delivery;
|
|
10092
|
+
try {
|
|
10093
|
+
delivery = await this.resolveBackgroundResponseDelivery(sessionId);
|
|
10094
|
+
} catch (error) {
|
|
10095
|
+
if (this.pendingBackgroundResponseTerminals.get(key) === pending && !this.backgroundResponseAggregations.has(key) || this.detachedPendingBackgroundResponseTerminals.has(pending)) {
|
|
10096
|
+
this.scheduleBackgroundResponseResolutionRetry(key, sessionId, pending);
|
|
10097
|
+
}
|
|
10098
|
+
throw error;
|
|
10099
|
+
}
|
|
10100
|
+
if (!delivery || this.router.getTarget(sessionId) !== delivery.target) {
|
|
10101
|
+
if (pending.retiring) {
|
|
10102
|
+
if (pending.held.length > 0) {
|
|
10103
|
+
process.stderr.write(`[DingTalk:${this.name}] background response target unavailable during drain; ${pending.held.length} buffered segment(s) discarded
|
|
10104
|
+
`);
|
|
10105
|
+
}
|
|
10106
|
+
pending.held.length = 0;
|
|
10107
|
+
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10108
|
+
return;
|
|
10109
|
+
}
|
|
10110
|
+
if (this.pendingBackgroundResponseTerminals.get(key) === pending && !this.backgroundResponseAggregations.has(key) || this.detachedPendingBackgroundResponseTerminals.has(pending)) {
|
|
10111
|
+
this.scheduleBackgroundResponseResolutionRetry(key, sessionId, pending);
|
|
10112
|
+
}
|
|
10113
|
+
return;
|
|
10114
|
+
}
|
|
10115
|
+
if (pending.retiring || this.pendingBackgroundResponseTerminals.get(key) !== pending || pending.turnComplete) {
|
|
10116
|
+
await this.flushDetachedBackgroundResponse(key, sessionId, pending, delivery);
|
|
10117
|
+
return;
|
|
10118
|
+
}
|
|
10119
|
+
const first = pending.held[0];
|
|
10120
|
+
if (!first)
|
|
10121
|
+
return;
|
|
10122
|
+
const aggregation = this.createBackgroundResponseAggregation(key, sessionId, first.context, delivery.target, delivery.sourceLabel);
|
|
10123
|
+
this.applyHeldBackgroundResponses(aggregation, pending);
|
|
10124
|
+
if (pending.resolutionDropped) {
|
|
10125
|
+
aggregation.resolutionDropped = true;
|
|
10126
|
+
pending.resolutionDropped = void 0;
|
|
10127
|
+
}
|
|
10128
|
+
if (this.pendingBackgroundResponseTerminals.get(key) === pending) {
|
|
10129
|
+
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10130
|
+
}
|
|
10131
|
+
this.scheduleBackgroundResponseAggregationFlush(key, aggregation);
|
|
10132
|
+
}
|
|
10133
|
+
holdPendingBackgroundResponse(pending, text, context) {
|
|
10134
|
+
if (text.trim().length > 0)
|
|
10135
|
+
pending.held.push({ text, context });
|
|
10136
|
+
if (context.turnComplete) {
|
|
10137
|
+
pending.turnComplete = true;
|
|
10138
|
+
pending.status = context.status;
|
|
10139
|
+
pending.label = context.label ?? pending.label;
|
|
10140
|
+
pending.completionPartial = context.partial === true;
|
|
10141
|
+
}
|
|
10142
|
+
}
|
|
10143
|
+
applyHeldBackgroundResponses(aggregation, pending) {
|
|
10144
|
+
for (const { text, context } of pending.held.splice(0)) {
|
|
10145
|
+
aggregation.status = context.status;
|
|
10146
|
+
aggregation.label = context.label ?? aggregation.label;
|
|
10147
|
+
aggregation.parts.push(text);
|
|
10148
|
+
if (context.turnComplete) {
|
|
10149
|
+
aggregation.turnComplete = true;
|
|
10150
|
+
aggregation.completionPartial = context.partial === true;
|
|
10151
|
+
}
|
|
10152
|
+
}
|
|
10153
|
+
}
|
|
10154
|
+
applyPendingBackgroundResponseTerminal(aggregation, pending) {
|
|
10155
|
+
if (!pending.turnComplete)
|
|
10156
|
+
return;
|
|
10157
|
+
aggregation.turnComplete = true;
|
|
10158
|
+
aggregation.status = pending.status ?? aggregation.status;
|
|
10159
|
+
aggregation.label = pending.label ?? aggregation.label;
|
|
10160
|
+
aggregation.completionPartial = pending.completionPartial === true;
|
|
10161
|
+
pending.turnComplete = void 0;
|
|
10162
|
+
pending.status = void 0;
|
|
10163
|
+
pending.label = void 0;
|
|
10164
|
+
pending.completionPartial = void 0;
|
|
10165
|
+
}
|
|
10166
|
+
async completeBackgroundResponseAggregation(key, aggregation) {
|
|
10167
|
+
if (aggregation.delivery) {
|
|
10168
|
+
aggregation.delivery.status = aggregation.status;
|
|
10169
|
+
aggregation.delivery.label = aggregation.label ?? aggregation.delivery.label;
|
|
10170
|
+
aggregation.delivery.partial = this.isPartialBackgroundResponseDelivery(aggregation, aggregation.delivery.parts.length) || aggregation.parts.length > 0;
|
|
10171
|
+
}
|
|
10172
|
+
if (aggregation.timeoutTimer)
|
|
10173
|
+
clearTimeout(aggregation.timeoutTimer);
|
|
10174
|
+
aggregation.timeoutTimer = void 0;
|
|
10175
|
+
await this.flushBackgroundResponseAggregation(key, aggregation);
|
|
10176
|
+
}
|
|
10177
|
+
async flushDetachedBackgroundResponse(key, sessionId, pending, delivery) {
|
|
10178
|
+
const first = pending.held[0];
|
|
10179
|
+
if (!first) {
|
|
10180
|
+
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10181
|
+
return;
|
|
10182
|
+
}
|
|
10183
|
+
const aggregation = {
|
|
10184
|
+
key,
|
|
10185
|
+
sessionId,
|
|
10186
|
+
target: delivery.target,
|
|
10187
|
+
sourceLabel: delivery.sourceLabel,
|
|
10188
|
+
status: first.context.status,
|
|
10189
|
+
label: first.context.label,
|
|
10190
|
+
parts: [],
|
|
10191
|
+
turnComplete: pending.turnComplete,
|
|
10192
|
+
completionPartial: pending.completionPartial,
|
|
10193
|
+
resolutionDropped: pending.resolutionDropped
|
|
10194
|
+
};
|
|
10195
|
+
this.applyHeldBackgroundResponses(aggregation, pending);
|
|
10196
|
+
aggregation.status = pending.status ?? aggregation.status;
|
|
10197
|
+
aggregation.label = pending.label ?? aggregation.label;
|
|
10198
|
+
if (this.pendingBackgroundResponseTerminals.get(key) === pending) {
|
|
10199
|
+
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10200
|
+
}
|
|
10201
|
+
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10202
|
+
this.detachedBackgroundResponseAggregations.add(aggregation);
|
|
10203
|
+
await this.flushBackgroundResponseAggregation(key, aggregation);
|
|
10204
|
+
}
|
|
10205
|
+
scheduleBackgroundResponseAggregationFlush(key, aggregation) {
|
|
10206
|
+
if (aggregation.timeoutTimer || aggregation.delivery)
|
|
10207
|
+
return;
|
|
10208
|
+
aggregation.timeoutTimer = setTimeout(() => {
|
|
10209
|
+
aggregation.timeoutTimer = void 0;
|
|
10210
|
+
void this.flushBackgroundResponseAggregation(key, aggregation);
|
|
10211
|
+
}, BACKGROUND_RESPONSE_AGGREGATION_TIMEOUT_MS);
|
|
10212
|
+
aggregation.timeoutTimer.unref?.();
|
|
10213
|
+
}
|
|
10214
|
+
formatBackgroundResponseAggregation(delivery) {
|
|
10215
|
+
const icon = delivery.status === "completed" ? "\u2705" : delivery.status === "failed" ? "\u274C" : "\u23F9\uFE0F";
|
|
10216
|
+
const label = this.formatBackgroundAgentLabel(delivery.label);
|
|
10217
|
+
const header = `## ${icon} Agent \xB7 ${label}${delivery.partial ? "\uFF08\u90E8\u5206\uFF09" : ""}`;
|
|
10218
|
+
if (delivery.parts.length === 0)
|
|
10219
|
+
return header;
|
|
10220
|
+
return `${header}
|
|
10221
|
+
|
|
10222
|
+
${delivery.parts.join("\n\n")}`;
|
|
10223
|
+
}
|
|
10224
|
+
formatBackgroundAgentResponse(text, label) {
|
|
10225
|
+
return `## \u{1F916} Agent \xB7 ${this.formatBackgroundAgentLabel(label)}
|
|
10226
|
+
|
|
10227
|
+
${text}`;
|
|
10228
|
+
}
|
|
10229
|
+
formatBackgroundAgentLabel(label) {
|
|
10230
|
+
const normalized = label?.replace(new RegExp("\\p{Cc}+", "gu"), " ").replace(/\s+/g, " ").trim();
|
|
10231
|
+
return escapeDingTalkMarkdown(normalized || "\u540E\u53F0\u4EFB\u52A1");
|
|
10232
|
+
}
|
|
9586
10233
|
/**
|
|
9587
10234
|
* Out-of-turn one-shot sends (background responses) must not flow through
|
|
9588
10235
|
* the session's block-streaming projector: a second sender interleaving with
|
|
9589
10236
|
* mid-projection state can swallow the send or split a held marker.
|
|
9590
10237
|
*/
|
|
9591
|
-
async deliverBackgroundReply(chatId, text, sessionId, sourceLabel) {
|
|
10238
|
+
async deliverBackgroundReply(chatId, text, sessionId, sourceLabel, prepared = false, failOnHttpError = false) {
|
|
9592
10239
|
if (this.config.blockStreaming !== "on") {
|
|
9593
|
-
return
|
|
10240
|
+
return this.sendResponseMessage(chatId, text, sessionId, sourceLabel, prepared, failOnHttpError);
|
|
9594
10241
|
}
|
|
9595
|
-
await this.sendReply(chatId, text, void 0, sourceLabel);
|
|
10242
|
+
await this.sendReply(chatId, text, void 0, sourceLabel, prepared, failOnHttpError);
|
|
9596
10243
|
}
|
|
9597
|
-
async sendResponseMessage(chatId, text, sessionId, sourceLabel, prepared = false) {
|
|
10244
|
+
async sendResponseMessage(chatId, text, sessionId, sourceLabel, prepared = false, failOnHttpError = false) {
|
|
9598
10245
|
let outgoingText = text;
|
|
9599
10246
|
let consumesMention = true;
|
|
9600
10247
|
if (this.config.blockStreaming === "on") {
|
|
@@ -9607,7 +10254,7 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9607
10254
|
const atUserId = consumesMention && this.atSender ? this.sessionMentionTargets.get(sessionId) : void 0;
|
|
9608
10255
|
if (atUserId)
|
|
9609
10256
|
this.sessionMentionTargets.delete(sessionId);
|
|
9610
|
-
await this.sendReply(chatId, outgoingText, atUserId, sourceLabel ?? this.getResponseSourceLabel(sessionId), prepared);
|
|
10257
|
+
await this.sendReply(chatId, outgoingText, atUserId, sourceLabel ?? this.getResponseSourceLabel(sessionId), prepared, failOnHttpError);
|
|
9611
10258
|
}
|
|
9612
10259
|
projectBlockStreamChunk(text, sessionId) {
|
|
9613
10260
|
let state = this.blockFileProjectors.get(sessionId);
|
|
@@ -10069,6 +10716,12 @@ var plugin = {
|
|
|
10069
10716
|
required: true,
|
|
10070
10717
|
envResolvable: true
|
|
10071
10718
|
},
|
|
10719
|
+
{
|
|
10720
|
+
key: "aggregateBackgroundAgentResponses",
|
|
10721
|
+
label: "Aggregate Background Agent Responses",
|
|
10722
|
+
kind: "boolean",
|
|
10723
|
+
description: "Buffer each background Agent turn and send one labeled result instead of labeled segments"
|
|
10724
|
+
},
|
|
10072
10725
|
{
|
|
10073
10726
|
key: "interactiveCards",
|
|
10074
10727
|
label: "Interactive Cards",
|