@qwen-code/qwen-code 0.23.3-nightly.20260910.c46cb85cf2 → 0.23.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/goal-draft/SKILL.md +2 -2
- package/bundled/qc-helper/docs/features/channels/dingtalk.md +20 -0
- package/bundled/qc-helper/docs/features/channels/overview.md +6 -5
- package/bundled/qc-helper/docs/features/goals.md +2 -2
- package/bundled/qc-helper/docs/features/hooks.md +13 -14
- package/bundled/qc-helper/docs/qwen-serve.md +3 -7
- package/chunks/{MaxSizedBox-UZW24XUX.js → MaxSizedBox-D4LW7RZZ.js} +15 -15
- package/chunks/{StandaloneSessionPicker-IDK7NAZL.js → StandaloneSessionPicker-ALTTRWUP.js} +33 -33
- package/chunks/{acp-startup-profiler-ARO4II44.js → acp-startup-profiler-KEU6VAYR.js} +2 -2
- package/chunks/{acp-subagent-executor-7TLJGISS.js → acp-subagent-executor-LEUN3N7N.js} +15 -15
- package/chunks/{acpAgent-YRCNNIIU.js → acpAgent-BBSW7XZG.js} +68 -258
- package/chunks/{agent-SGU5EE7U.js → agent-SQ6OY3QD.js} +9 -9
- package/chunks/{agent-headless-JVYBLNLT.js → agent-headless-RI2THRQ7.js} +9 -9
- package/chunks/{anthropicContentGenerator-SGIR5IKF.js → anthropicContentGenerator-JSKMKS6V.js} +2 -2
- package/chunks/{bridge-YF6NYRPZ.js → bridge-DAFMI72L.js} +17 -17
- package/chunks/{ca-MX3WCEEG.js → ca-KC2AISNS.js} +1 -1
- package/chunks/{channel-management-service-E4HTMU7T.js → channel-management-service-OWDXVL7R.js} +5 -5
- package/chunks/{channel-settings-store-FZ5VKHQD.js → channel-settings-store-4I6JONT7.js} +25 -25
- package/chunks/{channel-worker-group-X6WH4XWF.js → channel-worker-group-F2ZZMLNS.js} +6 -6
- package/chunks/{channel-worker-manager-SICFJDPJ.js → channel-worker-manager-2SZLJJSJ.js} +6 -6
- package/chunks/{channel-worker-supervisor-HSFAKML6.js → channel-worker-supervisor-ZFNWMG6D.js} +4 -4
- package/chunks/{chunk-NVIBH7WS.js → chunk-2ALXPGB4.js} +1 -1
- package/chunks/{chunk-UBEYS536.js → chunk-2PJRI3EH.js} +3 -3
- package/chunks/{chunk-GP47UR3M.js → chunk-2ZN3O5FT.js} +6 -6
- package/chunks/{chunk-BI3WSRQE.js → chunk-3BTSSIJO.js} +3 -3
- package/chunks/{chunk-PIGUW2U2.js → chunk-3KQBQ6FM.js} +2 -14
- package/chunks/{chunk-RJZTX2OF.js → chunk-3UXUOFO6.js} +6 -6
- package/chunks/{chunk-HL2DQG3Y.js → chunk-3XLK2QMY.js} +10 -10
- package/chunks/{chunk-L3DTX6U4.js → chunk-4ALNJDHL.js} +1 -3
- package/chunks/{chunk-KHIBLKNK.js → chunk-53GWJOLP.js} +1 -1
- package/chunks/{chunk-LIR7YS2O.js → chunk-5KI7ZDTB.js} +4 -4
- package/chunks/{chunk-ZT6EPPBY.js → chunk-6JACAGYH.js} +1 -1
- package/chunks/{chunk-DMX7RF6E.js → chunk-6W4HBUA2.js} +1 -1
- package/chunks/{chunk-CSHX5ZC4.js → chunk-76RGWKLS.js} +1 -1
- package/chunks/{chunk-J5PYQVD2.js → chunk-7APZIRH3.js} +2 -2
- package/chunks/{chunk-OOLSYRZ7.js → chunk-7BXXIQG4.js} +4 -4
- package/chunks/{chunk-WY4N6KS7.js → chunk-7ICHPMBQ.js} +3 -3
- package/chunks/{chunk-KZ2CU2LH.js → chunk-7Q2AXRDJ.js} +1 -1
- package/chunks/{chunk-C4NLHK7X.js → chunk-7QYWGTHB.js} +128 -33
- package/chunks/{chunk-7XM6KEVW.js → chunk-AC6KDLH3.js} +1 -1
- package/chunks/{chunk-GDWE23OR.js → chunk-ALMR3E6Q.js} +3 -3
- package/chunks/{chunk-B6BDT4RX.js → chunk-AXTFYDXT.js} +1 -1
- package/chunks/{chunk-6EDWSKN4.js → chunk-BV6Q5HMY.js} +2 -2
- package/chunks/{chunk-3VPFA6L2.js → chunk-BWAMMKIS.js} +2 -2
- package/chunks/{chunk-IFHJIEMN.js → chunk-BWQLXU37.js} +10 -10
- package/chunks/{chunk-F2RKL5I2.js → chunk-BZM5U74J.js} +3 -3
- package/chunks/{chunk-JOMCZWX7.js → chunk-CUEXOHQH.js} +15 -9
- package/chunks/{chunk-CAAMI77K.js → chunk-CXTPVBFA.js} +1 -1
- package/chunks/{chunk-ATH66AEU.js → chunk-DAWWT2ID.js} +16 -16
- package/chunks/{chunk-MXOALJIL.js → chunk-DT75RKNH.js} +1 -1
- package/chunks/{chunk-BHR6IN2X.js → chunk-DYFOSJHU.js} +30 -30
- package/chunks/{chunk-KVBNJ4K2.js → chunk-E7LB57MB.js} +2 -2
- package/chunks/{chunk-XDQUDARC.js → chunk-EDMXGXAK.js} +7 -4
- package/chunks/{chunk-KFGPNCCY.js → chunk-EVTNACMT.js} +4 -4
- package/chunks/{chunk-TP2DUOB6.js → chunk-F42YYSCK.js} +2 -2
- package/chunks/{chunk-UGS62IR2.js → chunk-GCDXVPFK.js} +3 -3
- package/chunks/{chunk-SAWPURIU.js → chunk-GOXQL4YH.js} +2 -2
- package/chunks/{chunk-SXEE6PND.js → chunk-GSILBZLN.js} +2 -2
- package/chunks/{chunk-BTWGOKHU.js → chunk-HBQ2NXOU.js} +2 -2
- package/chunks/{chunk-34ZYDM3F.js → chunk-HBU7EKY4.js} +1 -1
- package/chunks/{chunk-T4JVQR7Z.js → chunk-HGAELO7B.js} +2 -2
- package/chunks/{chunk-ZHECLGA6.js → chunk-HNLMYDQE.js} +4 -2
- package/chunks/{chunk-PMS4FVLY.js → chunk-IL5M5NYD.js} +5 -5
- package/chunks/{chunk-HZTXKVSV.js → chunk-IV7GDNKC.js} +1 -1
- package/chunks/{chunk-5FFAUU4T.js → chunk-J3TJH52D.js} +1 -1
- package/chunks/{chunk-JDEW3V5B.js → chunk-JYKWOREU.js} +1 -1
- package/chunks/{chunk-E5GQNSJY.js → chunk-KFZYGSJN.js} +3 -3
- package/chunks/{chunk-ZUQVZTWG.js → chunk-KOKPXIAN.js} +3 -3
- package/chunks/{chunk-Q6HXLBZF.js → chunk-LDVNJZGH.js} +6 -6
- package/chunks/{chunk-VHKOULAI.js → chunk-MF6E7FSA.js} +2 -2
- package/chunks/{chunk-F45SKYIQ.js → chunk-MHAADZOZ.js} +3 -3
- package/chunks/{chunk-72BGC7RT.js → chunk-MLQNSPRZ.js} +4 -4
- package/chunks/{chunk-L2KF7HUE.js → chunk-MSNHNAQZ.js} +1 -1
- package/chunks/{chunk-JV5YASQA.js → chunk-N7VWZDWW.js} +55 -155
- package/chunks/{chunk-Q2XLNLAV.js → chunk-NE624IVP.js} +1 -1
- package/chunks/{chunk-CGKEUUYG.js → chunk-NFYEQRLG.js} +1 -1
- package/chunks/{chunk-FGRDUDCI.js → chunk-NHCZJQE4.js} +5 -5
- package/chunks/{chunk-TWC3FHUI.js → chunk-NHJKAR6E.js} +3 -3
- package/chunks/{chunk-VTBPMLRO.js → chunk-NJQTG2G3.js} +9 -9
- package/chunks/{chunk-LEGNDA46.js → chunk-NLNQNBZ2.js} +1 -1
- package/chunks/{chunk-QPWZX4ZV.js → chunk-NMCDMLHL.js} +12 -12
- package/chunks/{chunk-WS7MOFK6.js → chunk-NMRCXKQ5.js} +3 -3
- package/chunks/{chunk-YIU5PEAT.js → chunk-NOAG7N22.js} +1 -1
- package/chunks/{chunk-C75BXMPM.js → chunk-NOO4QFXM.js} +3 -1
- package/chunks/{chunk-B2TGBZXY.js → chunk-NRXWJXJ4.js} +2 -2
- package/chunks/{chunk-J2RNOJRV.js → chunk-OLTN767L.js} +2 -2
- package/chunks/{chunk-AWMJRE5N.js → chunk-OX7IZ2G5.js} +4 -4
- package/chunks/{chunk-O3MKRN2I.js → chunk-POC3YMHG.js} +1 -1
- package/chunks/{chunk-YKK2XXHF.js → chunk-PSPAM24S.js} +0 -4
- package/chunks/{chunk-YS2ZJSOA.js → chunk-Q2LVVIKF.js} +11 -28
- package/chunks/{chunk-AW2SIT3B.js → chunk-Q5BD56BW.js} +2 -2
- package/chunks/{chunk-LAP7X6EC.js → chunk-QMUYLYT5.js} +1 -1
- package/chunks/{chunk-ONGZNOIP.js → chunk-R4Q2PEFV.js} +1 -1
- package/chunks/{chunk-FRVV5SSD.js → chunk-RLLRJJDR.js} +2 -2
- package/chunks/{chunk-6EOMQPTS.js → chunk-RWVD5RRY.js} +3 -3
- package/chunks/{chunk-FYZ5NZ3V.js → chunk-RZHU3K6M.js} +20 -2
- package/chunks/{chunk-CUK6F5UF.js → chunk-S6Q6Q4P2.js} +1 -1
- package/chunks/{chunk-SNZWDV67.js → chunk-SBRX4BDI.js} +1 -1
- package/chunks/{chunk-5ZJ3KK5J.js → chunk-SODMFNAR.js} +4 -4
- package/chunks/{chunk-VID4BW52.js → chunk-SSGAAWLY.js} +28 -28
- package/chunks/{chunk-LY2GK2PR.js → chunk-SYLECP23.js} +4 -4
- package/chunks/{chunk-BQOP3K76.js → chunk-TWUKBNWM.js} +1 -1
- package/chunks/{chunk-5FKZ7KFQ.js → chunk-UKZ45TJL.js} +3 -3
- package/chunks/{chunk-7XVQNDFB.js → chunk-V2P3DOQR.js} +1 -1
- package/chunks/{chunk-WXFK4MH7.js → chunk-VG3Q2NC4.js} +5 -25
- package/chunks/{chunk-74JEYK2C.js → chunk-VZUCTJ2P.js} +9 -9
- package/chunks/{chunk-VLZOU6UH.js → chunk-W5FIP7FC.js} +3 -3
- package/chunks/{chunk-6NONRGYX.js → chunk-X6K77VHC.js} +1 -1
- package/chunks/{chunk-FGV2QEAO.js → chunk-X7UJKOHZ.js} +6 -4
- package/chunks/{chunk-7ZVIGDZF.js → chunk-XBZTAGB7.js} +1 -1
- package/chunks/{chunk-6UK77U7D.js → chunk-XGYHNWL3.js} +3 -3
- package/chunks/{chunk-ZGQIIGNQ.js → chunk-YBUMTY7B.js} +1 -1
- package/chunks/{chunk-JEMDIKGQ.js → chunk-YQHLFCPU.js} +1 -1
- package/chunks/{chunk-7ZKDPTYO.js → chunk-Z3GF56ME.js} +2 -2
- package/chunks/{chunk-IOUBOANU.js → chunk-ZU47FBOC.js} +1 -1
- package/chunks/{config-utils-S5LFS4RN.js → config-utils-L6KLDYIV.js} +19 -19
- package/chunks/{contextCommand-XXKZMMSQ.js → contextCommand-UYEH7NIU.js} +17 -17
- package/chunks/{core-runtime-YGUA42AZ.js → core-runtime-NVHT3Z3V.js} +15 -15
- package/chunks/{create-sub-session-SEK6KCYR.js → create-sub-session-YWASE5VH.js} +15 -15
- package/chunks/{daemon-git-worktree-guard-3AWINPPX.js → daemon-git-worktree-guard-FOW4RQSK.js} +15 -15
- package/chunks/{daemon-status-provider-RTKHKUFJ.js → daemon-status-provider-O5KQZYMP.js} +21 -21
- package/chunks/{daemon-trust-policy-6YQOC7B6.js → daemon-trust-policy-3ATXEON7.js} +21 -21
- package/chunks/{daemon-trust-policy-monitor-EN5L23GS.js → daemon-trust-policy-monitor-7MCNDNEC.js} +21 -21
- package/chunks/{de-OOLZAU2U.js → de-UU2YTO37.js} +1 -1
- package/chunks/{deferred-core-runtime-JPLQRVZO.js → deferred-core-runtime-JK5IXL5K.js} +15 -15
- package/chunks/{dist-JCXKXRH6.js → dist-AHJYPSJL.js} +5 -2
- package/chunks/{dist-3BJVSJ7D.js → dist-AIKC5E5P.js} +630 -9
- package/chunks/{dist-HX2LG76F.js → dist-F2DVGTL3.js} +29 -9
- package/chunks/{dist-J7PDFK53.js → dist-GWNQVPZT.js} +27 -8
- package/chunks/{dist-65Q3TRLH.js → dist-H6G3K26N.js} +34 -14
- package/chunks/{dist-SBK33YLC.js → dist-KJGRVIGJ.js} +33 -2
- package/chunks/{dist-WMFHZG3R.js → dist-KLZ7XGEQ.js} +4 -1
- package/chunks/{dist-LHGMHIDK.js → dist-ZA52JXAS.js} +5 -1
- package/chunks/{dist-QPTIRE3U.js → dist-ZXTZTE54.js} +11 -3
- package/chunks/{edit-QXJZIWRQ.js → edit-SY35KYIE.js} +9 -9
- package/chunks/{en-7BZ2OZKH.js → en-CAJHTIQT.js} +1 -1
- package/chunks/{enterPlanMode-2ITCVQ5N.js → enterPlanMode-HXX6KQJR.js} +9 -9
- package/chunks/{environment-URPO5ORZ.js → environment-DKXHG4HB.js} +17 -17
- package/chunks/{errors-TDUYLEKI.js → errors-ADY7LQJJ.js} +17 -17
- package/chunks/{exitPlanMode-RA7KMUEW.js → exitPlanMode-HSK2CQI6.js} +9 -9
- package/chunks/{fast-path-Q2JYP64P.js → fast-path-U636VWN2.js} +3 -3
- package/chunks/{fast-path-settings-GTHZLVSS.js → fast-path-settings-V7MI7EZJ.js} +1 -1
- package/chunks/{fr-JJWM2HUS.js → fr-HKNWVXRJ.js} +1 -1
- package/chunks/{glob-VHSV4BKE.js → glob-GUGGTH5L.js} +9 -9
- package/chunks/{goal-tools-5FIE56CK.js → goal-tools-PXYRSQGX.js} +11 -15
- package/chunks/{handleAutoUpdate-7FZFLKNZ.js → handleAutoUpdate-5KHS4HIN.js} +18 -18
- package/chunks/{i18n-NTFQDWKR.js → i18n-KSGKMUPT.js} +16 -16
- package/chunks/{image-gen-TF3IQWSH.js → image-gen-OCCR2WWU.js} +4 -4
- package/chunks/{initializer-LB3T635H.js → initializer-YYT5XEZF.js} +21 -21
- package/chunks/{installationInfo-KRO433ZG.js → installationInfo-UNSBPYW2.js} +15 -15
- package/chunks/{ja-L67TXFDJ.js → ja-GJS5RZGU.js} +1 -1
- package/chunks/{list-NEP3WPZ7.js → list-YL6LDQKQ.js} +24 -24
- package/chunks/{llm-AZEJEIAD.js → llm-XGGLBGPH.js} +57 -57
- package/chunks/{llm-content-generator-KWXFHBR3.js → llm-content-generator-ZHQQT5W7.js} +3 -3
- package/chunks/{loadedSettingsAdapter-NZORJLSD.js → loadedSettingsAdapter-3DXLASK7.js} +21 -21
- package/chunks/{loggingContentGenerator-NGHVU6AK.js → loggingContentGenerator-V72OCCJO.js} +10 -10
- package/chunks/{managed-npm-update-3LHNBEAG.js → managed-npm-update-HV5LPZH2.js} +15 -15
- package/chunks/{mcp-4SWJKDX7.js → mcp-IYVSIW6O.js} +21 -21
- package/chunks/{monitor-V5EFBZC7.js → monitor-TLBNM4MV.js} +9 -9
- package/chunks/{nonInteractiveCli-5UFUBUAT.js → nonInteractiveCli-LSJSQ2W4.js} +57 -57
- package/chunks/{notebook-edit-ATV46KWD.js → notebook-edit-OSPOLZP6.js} +9 -9
- package/chunks/{openaiContentGenerator-BKTO5QJK.js → openaiContentGenerator-BE4S5TRD.js} +6 -6
- package/chunks/{pidfile-JAIOWPI3.js → pidfile-H32FEPWA.js} +15 -15
- package/chunks/{processUtils-TCQH3LVD.js → processUtils-SSLIPDEA.js} +2 -2
- package/chunks/{prompt-terminal-ledger-BYXHEUHX.js → prompt-terminal-ledger-I5SLL6UF.js} +16 -16
- package/chunks/{pt-77SBDL4B.js → pt-FXMYXEUV.js} +1 -1
- package/chunks/{qwenContentGenerator-K5TJK75P.js → qwenContentGenerator-TMQC623Z.js} +11 -11
- package/chunks/{qwenOAuth2-NOXRK323.js → qwenOAuth2-3ZRQHHTC.js} +4 -4
- package/chunks/{read-file-DL7GNZD5.js → read-file-T2QAIZE2.js} +2 -2
- package/chunks/{resumeHistoryUtils-OYKXZ4YO.js → resumeHistoryUtils-QLKDH5GY.js} +19 -19
- package/chunks/{ripGrep-EOUMIU4K.js → ripGrep-YGWL7KCV.js} +3 -3
- package/chunks/{ru-UYWHKWF2.js → ru-RMHURE5U.js} +1 -1
- package/chunks/{run-qwen-serve-PPTGWC5B.js → run-qwen-serve-26KZDECC.js} +89 -231
- package/chunks/{runtime-5RO22P2N.js → runtime-BMEIVDDG.js} +26 -26
- package/chunks/{scheduled-tasks-YGERFWLZ.js → scheduled-tasks-NCFPP6VQ.js} +19 -19
- package/chunks/{scheduler-S6WU6M3C.js → scheduler-47TVMUVN.js} +17 -17
- package/chunks/{serve-HT4WOCWS.js → serve-KL3G6LQQ.js} +22 -22
- package/chunks/{server-SWXVPRCS.js → server-LBPYXZ5G.js} +55 -66
- package/chunks/{session-6DSFUOMO.js → session-YG6742LO.js} +58 -58
- package/chunks/{session-attachments-root-SOZCTQWW.js → session-attachments-root-OUBQDYC4.js} +15 -15
- package/chunks/{session-pr-refresh-F7XUBQBH.js → session-pr-refresh-EKGMYNAW.js} +18 -18
- package/chunks/{settings-SWQH36PO.js → settings-DDNHJX2L.js} +20 -20
- package/chunks/{shell-XUQL6EYV.js → shell-KUCXWITU.js} +9 -9
- package/chunks/{skill-HNRDD54C.js → skill-JQLKPNWZ.js} +2 -2
- package/chunks/{skill-settings-JU72PCII.js → skill-settings-XERQCUXZ.js} +20 -20
- package/chunks/{spawnChannel-7ZVM3GBU.js → spawnChannel-GQ45QFGB.js} +15 -15
- package/chunks/{standalone-update-64JQY2LX.js → standalone-update-PRF3ILGZ.js} +17 -17
- package/chunks/{start-opentui-ui-RSLBXESU.js → start-opentui-ui-JDSOZE3N.js} +62 -67
- package/chunks/{startInteractiveUI-ZDPHD7XE.js → startInteractiveUI-RRW3JVHN.js} +69 -85
- package/chunks/{team-create-U52VYSNO.js → team-create-5DRLOLOE.js} +9 -9
- package/chunks/{team-plan-approval-IQ4ADQIK.js → team-plan-approval-MWSGAL5T.js} +9 -9
- package/chunks/{terminal-image-renderer-ZEMF7LB2.js → terminal-image-renderer-H7PD4FQW.js} +15 -15
- package/chunks/{theme-manager-DK2S2SOX.js → theme-manager-7AV73D6R.js} +15 -15
- package/chunks/{tool-search-6U4OQG7K.js → tool-search-UGYTBLUV.js} +2 -6
- package/chunks/{total-session-admission-BOARHBZU.js → total-session-admission-JIHSTJ5S.js} +17 -17
- package/chunks/{trustedFolders-GKQZXZSV.js → trustedFolders-5VCBXFOP.js} +16 -16
- package/chunks/{update-relaunch-GLACF7PX.js → update-relaunch-4LF3APCV.js} +5 -5
- package/chunks/{updateCheck-NLBSZB4Q.js → updateCheck-4T3WUE5F.js} +17 -17
- package/chunks/{useAutoAcceptIndicator-3X3BYU7H.js → useAutoAcceptIndicator-UMGB64Z6.js} +23 -23
- package/chunks/{validateNonInterActiveAuth-NE3JLOIR.js → validateNonInterActiveAuth-GFJ72U2C.js} +54 -54
- package/chunks/{version-6H5YAT4N.js → version-EAAZN4T2.js} +1 -1
- package/chunks/{web-fetch-RWSO7TTN.js → web-fetch-VRU3A2NI.js} +5 -5
- package/chunks/{web-search-DADI3LV5.js → web-search-NEGYQNDJ.js} +319 -376
- package/chunks/{workflow-LPGCZCIT.js → workflow-UHPFALVZ.js} +10 -10
- package/chunks/{workspace-providers-status-QBRBEFTO.js → workspace-providers-status-AEYISSU2.js} +23 -23
- package/chunks/{workspace-registration-store-WUKTMJPW.js → workspace-registration-store-A7RGKW62.js} +1 -1
- package/chunks/{workspace-registry-CJV7KVGF.js → workspace-registry-C2NGE6SD.js} +17 -17
- package/chunks/{workspace-runtime-coordinator-7LYMFMFF.js → workspace-runtime-coordinator-QKMZ24YF.js} +18 -20
- package/chunks/{workspace-service-HWXZSA4J.js → workspace-service-RQTTAGGC.js} +24 -24
- package/chunks/{workspace-skills-status-D6QXUWCC.js → workspace-skills-status-5HWZU3HX.js} +21 -21
- package/chunks/{workspace-trust-reconciler-VZX7G7CZ.js → workspace-trust-reconciler-KFWATZUU.js} +23 -23
- package/chunks/{write-file-KKHV26YV.js → write-file-DPVB2SBQ.js} +10 -10
- package/chunks/{zh-J2GLI64H.js → zh-S5V3Z5CR.js} +1 -1
- package/chunks/{zh-TW-TBAICUJQ.js → zh-TW-2K2WRFPY.js} +1 -1
- package/chunks/{zoom-image-OG7X7KAA.js → zoom-image-S7AWLAPC.js} +2 -2
- package/cli.js +13 -13
- package/export-transcript-document.js +1 -1
- package/locales/ca.js +2 -2
- package/locales/de.js +2 -2
- package/locales/en.js +2 -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 +2 -2
- package/locales/zh.js +2 -2
- package/package.json +3 -3
- package/web-shell/assets/{abnfDiagram-VCTEODGH-NT0lTLRG.js → abnfDiagram-VCTEODGH-nU24rpIE.js} +1 -1
- package/web-shell/assets/{arc-DDqnIMMx.js → arc-D1hTu8QI.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-DfYghE3W.js → architectureDiagram-5GKGNRK7-B_fgkKe7.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-DlqJIx5c.js → blockDiagram-NRAW4CY4-C3pddUNg.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-CinqLGU4.js → c4Diagram-UCG6FXSJ-kEFoC1ei.js} +1 -1
- package/web-shell/assets/channel-Blod4z1X.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-CsjJX5M7.js → chunk-2Q5K7J3B-DbT9wS7j.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-CaVb2tdH.js → chunk-5VM5RSS4-CNbULt6O.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-CRyErlzW.js → chunk-F27PBJKO-CbQRy4Tb.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-7I79DZCf.js → chunk-G27WJ6UU-CVbXTxYk.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-Dz4cac5F.js → chunk-JWPE2WC7-D89c_BXy.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-Ls24Derb.js → chunk-LCL6LL3I-B7-I_9KB.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-JzYe4qx7.js → chunk-POPQ4Y6H-DcLQFzS4.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-BxDwesA-.js → chunk-SVP7TREG-DyBb2Axj.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-CW4hjgWc.js → chunk-XXDRQBXY-BIA0eb5B.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-D6hFDMqb.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-D6hFDMqb.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-DxikE9iF.js → cose-bilkent-JH36ORCC-Db2FYN85.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-CvVsIkVN.js → cynefin-OW5HDTMX-i4GwmBVy.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-CDHkk3wq.js → cynefinDiagram-5FMLGOSQ-LENf_IUy.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-BgLdkVLT.js → dagre-3AP2YEHR-CF9XVrD9.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-DP43cGhe.js → diagram-S7CK7UJ4-DD5PJfSm.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-BWrZYhoT.js → diagram-UQ7AKVKN-CjD_sBMj.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-B80wjH_n.js → diagram-VSXAHHWV-U5WwMqyA.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-DPpKmDsY.js → diagram-VX7I27RA-BujpHJJf.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-kaEBNbNU.js → diagram-Z3DM3KII-3ZLtKEXo.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-1-qbEZvk.js → ebnfDiagram-PWID7BFC-BGpiquRm.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-CrK2gMkV.js → erDiagram-SSCWMZ5O-D0besu_U.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-Dic2xofW.js → flowDiagram-A5DVABFB-9DwDuIyr.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-DJko8vT7.js → ganttDiagram-EL5Y4UJY-CNlsAeNr.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-DxsQ-bHT.js → gitGraphDiagram-WWUBYQGX-C_pPFiTR.js} +1 -1
- package/web-shell/assets/{index-t7VBrUeD.js → index-BYWs4JWq.js} +1 -1
- package/web-shell/assets/{index-DY8CxdBr.js → index-D3YS6KuJ.js} +152 -152
- package/web-shell/assets/{infoDiagram-RXCK75RN-DcRUJbNi.js → infoDiagram-RXCK75RN-Bpai64Ll.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-CUPw-2_e.js → ishikawaDiagram-5VMMS53U-ktpJFq4r.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-yOHhZxkW.js → journeyDiagram-EYS64GPL-iz_DKgFX.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-CFUGBbqz.js → kanban-definition-3QL26DDD-m_gG00Yt.js} +1 -1
- package/web-shell/assets/{layout-BoilNfBU.js → layout-qEvKgnvU.js} +1 -1
- package/web-shell/assets/{linear-DOuHaPrl.js → linear-C6lklGdq.js} +1 -1
- package/web-shell/assets/{mermaid.core-1G1fXWda.js → mermaid.core-DSCYB_2P.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-B8BhkrOX.js → mindmap-definition-FBJOCRG2-DRQbT8w-.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-CipC5K1D.js → pegDiagram-XKGWAZYB-BhD0q0i6.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-CHBDFDUJ.js → pieDiagram-E7YTZNPT-BvIGQCSd.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-_iiBkoZO.js → quadrantDiagram-AXDQQJYC-BDQtfpU-.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-Cx1peHDi.js → railroadDiagram-O6MQD6OU-E1g2KIFK.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-CBRiPbdQ.js → requirementDiagram-EFPCY7ZU-CuerYJOe.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-TT6GcHaZ.js → sankeyDiagram-P5KCCOFB-CqWyCZGA.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-CWP42PNb.js → sequenceDiagram-WJ2MYXX4-B-YWb8x4.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-Bp94roEG.js → sizeCapture-X5ZJPWSS-BB7YY4Tl.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-0ftrzTAy.js → stateDiagram-HBIQ2CUA-C8LDpNHS.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-C4CbdvGa.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-D-FsenYJ.js → swimlanes-XN3QIQJK-D94vOoxZ.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN--QNSIOC8.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-Ctvrj28y.js → timeline-definition-24CTP7MA-C9C8uEYm.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-5DZncjOt.js → vennDiagram-4TSXK5OY-CYzMHbVW.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-jZjYwPY7.js → wardleyDiagram-VM6X3IG4-G9nhtLES.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-Ci6Q2C2_.js → xychartDiagram-S5SC5T6Z-ruD2Wjhg.js} +1 -1
- package/web-shell/index.html +1 -1
- package/web-shell/assets/channel-BHGoSkEv.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-E47Xnn15.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-E47Xnn15.js +0 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-PgAST0dK.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-BcWcB5bj.js +0 -8
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
sanitizePromptText,
|
|
15
15
|
sanitizeSenderName,
|
|
16
16
|
truncateUtf16Units
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-7QYWGTHB.js";
|
|
18
18
|
import "./chunk-IJOS26LH.js";
|
|
19
19
|
import "./chunk-CQ35AJ4Z.js";
|
|
20
20
|
import "./chunk-DMTGGOSA.js";
|
|
@@ -8844,6 +8844,9 @@ ${boundedLines.join("\n")}`);
|
|
|
8844
8844
|
}
|
|
8845
8845
|
__name(formatChatRecord, "formatChatRecord");
|
|
8846
8846
|
var DEDUP_TTL_MS = 5 * 60 * 1e3;
|
|
8847
|
+
var BACKGROUND_RESPONSE_AGGREGATION_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
8848
|
+
var BACKGROUND_RESPONSE_AGGREGATION_RETRY_MS = 30 * 1e3;
|
|
8849
|
+
var BACKGROUND_RESPONSE_AGGREGATION_MAX_RETRIES = 3;
|
|
8847
8850
|
var ACK_REACTION_NAME = "\u{1F440}";
|
|
8848
8851
|
var ACK_EMOTION_ID = "2659900";
|
|
8849
8852
|
var ACK_EMOTION_BG_ID = "im_bg_1";
|
|
@@ -9040,6 +9043,30 @@ async function withConnectLoggingSuppressed(connect) {
|
|
|
9040
9043
|
}
|
|
9041
9044
|
}
|
|
9042
9045
|
__name(withConnectLoggingSuppressed, "withConnectLoggingSuppressed");
|
|
9046
|
+
var ProactiveTextDeliveryError = class extends Error {
|
|
9047
|
+
static {
|
|
9048
|
+
__name(this, "ProactiveTextDeliveryError");
|
|
9049
|
+
}
|
|
9050
|
+
plan;
|
|
9051
|
+
retryable;
|
|
9052
|
+
constructor(plan, cause) {
|
|
9053
|
+
super(cause instanceof Error ? cause.message : String(cause), { cause });
|
|
9054
|
+
this.plan = plan;
|
|
9055
|
+
if (cause instanceof DingtalkCardRequestError) {
|
|
9056
|
+
this.retryable = cause.retryable;
|
|
9057
|
+
}
|
|
9058
|
+
}
|
|
9059
|
+
};
|
|
9060
|
+
var ReplyTextDeliveryError = class extends Error {
|
|
9061
|
+
static {
|
|
9062
|
+
__name(this, "ReplyTextDeliveryError");
|
|
9063
|
+
}
|
|
9064
|
+
plan;
|
|
9065
|
+
constructor(plan, cause) {
|
|
9066
|
+
super(cause instanceof Error ? cause.message : String(cause), { cause });
|
|
9067
|
+
this.plan = plan;
|
|
9068
|
+
}
|
|
9069
|
+
};
|
|
9043
9070
|
var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
9044
9071
|
static {
|
|
9045
9072
|
__name(this, "DingtalkChannel");
|
|
@@ -9074,6 +9101,7 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9074
9101
|
*/
|
|
9075
9102
|
proactiveToken;
|
|
9076
9103
|
interactiveCardConfig;
|
|
9104
|
+
aggregateBackgroundAgentResponses;
|
|
9077
9105
|
interactiveCardClient;
|
|
9078
9106
|
statusCardController;
|
|
9079
9107
|
questionCardController;
|
|
@@ -9086,6 +9114,10 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9086
9114
|
// boundary, input requested) mints a fresh segment UUID but the projection
|
|
9087
9115
|
// state must survive it, or a marker split across the reset leaks.
|
|
9088
9116
|
fileProjectors = /* @__PURE__ */ new Map();
|
|
9117
|
+
backgroundResponseAggregations = /* @__PURE__ */ new Map();
|
|
9118
|
+
detachedBackgroundResponseAggregations = /* @__PURE__ */ new Set();
|
|
9119
|
+
pendingBackgroundResponseTerminals = /* @__PURE__ */ new Map();
|
|
9120
|
+
detachedPendingBackgroundResponseTerminals = /* @__PURE__ */ new Set();
|
|
9089
9121
|
constructor(name, config, bridge, options) {
|
|
9090
9122
|
super(name, config, bridge, options);
|
|
9091
9123
|
this.atSender = config["atSender"] === true;
|
|
@@ -9104,6 +9136,11 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9104
9136
|
this.config.instructions += FILE_INSTRUCTIONS;
|
|
9105
9137
|
}
|
|
9106
9138
|
this.interactiveCardConfig = parseDingtalkInteractiveCardConfig(config.interactiveCards);
|
|
9139
|
+
const rawAggregateBackgroundAgentResponses = config.aggregateBackgroundAgentResponses;
|
|
9140
|
+
if (rawAggregateBackgroundAgentResponses !== void 0 && typeof rawAggregateBackgroundAgentResponses !== "boolean") {
|
|
9141
|
+
throw new Error(`Channel "${name}" aggregateBackgroundAgentResponses must be a boolean.`);
|
|
9142
|
+
}
|
|
9143
|
+
this.aggregateBackgroundAgentResponses = rawAggregateBackgroundAgentResponses === true;
|
|
9107
9144
|
if (!config.clientId || !config.clientSecret) {
|
|
9108
9145
|
throw new Error(`Channel "${name}" requires clientId and clientSecret for DingTalk.`);
|
|
9109
9146
|
}
|
|
@@ -9515,18 +9552,25 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9515
9552
|
}
|
|
9516
9553
|
return replaceImageMarkers(text, markers, replacements);
|
|
9517
9554
|
}
|
|
9518
|
-
async sendReply(chatId, text, atUserId, sourceLabel, prepared = false) {
|
|
9555
|
+
async sendReply(chatId, text, atUserId, sourceLabel, prepared = false, failOnHttpError = false) {
|
|
9519
9556
|
const webhook = this.webhooks.get(chatId);
|
|
9520
9557
|
if (!webhook) {
|
|
9521
9558
|
process.stderr.write(`[DingTalk:${this.name}] No webhook for chatId ${chatId}, cannot send.
|
|
9522
9559
|
`);
|
|
9560
|
+
if (failOnHttpError) {
|
|
9561
|
+
throw new Error("DingTalk session webhook unavailable");
|
|
9562
|
+
}
|
|
9523
9563
|
return;
|
|
9524
9564
|
}
|
|
9525
9565
|
const outgoingText = prepared ? text : await this.prepareReplyOutput(chatId, text);
|
|
9526
9566
|
if (!outgoingText.trim())
|
|
9527
9567
|
return;
|
|
9528
9568
|
const plan = this.createReplyTextDelivery(outgoingText, atUserId, sourceLabel);
|
|
9529
|
-
|
|
9569
|
+
try {
|
|
9570
|
+
await this.deliverReplyText(chatId, plan, failOnHttpError);
|
|
9571
|
+
} catch (error) {
|
|
9572
|
+
throw new ReplyTextDeliveryError(plan, error);
|
|
9573
|
+
}
|
|
9530
9574
|
}
|
|
9531
9575
|
createReplyTextDelivery(outgoingText, atUserId, sourceLabel) {
|
|
9532
9576
|
const mentionPrefix = atUserId ? `@${atUserId}
|
|
@@ -9547,9 +9591,12 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9547
9591
|
...atUserId ? { atUserId } : {}
|
|
9548
9592
|
};
|
|
9549
9593
|
}
|
|
9550
|
-
async deliverReplyText(chatId, plan) {
|
|
9594
|
+
async deliverReplyText(chatId, plan, failOnHttpError = false) {
|
|
9551
9595
|
const webhook = this.webhooks.get(chatId);
|
|
9552
9596
|
if (!webhook) {
|
|
9597
|
+
if (failOnHttpError) {
|
|
9598
|
+
throw new Error("DingTalk session webhook unavailable");
|
|
9599
|
+
}
|
|
9553
9600
|
return;
|
|
9554
9601
|
}
|
|
9555
9602
|
while (plan.nextChunk < plan.chunks.length) {
|
|
@@ -9589,6 +9636,19 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9589
9636
|
const detail = await resp.text().catch(() => "");
|
|
9590
9637
|
process.stderr.write(`[DingTalk:${this.name}] sendMessage failed: HTTP ${resp.status} ${detail}
|
|
9591
9638
|
`);
|
|
9639
|
+
if (failOnHttpError) {
|
|
9640
|
+
throw new Error(`DingTalk reply send failed: HTTP ${resp.status} ${detail}`);
|
|
9641
|
+
}
|
|
9642
|
+
} else if (failOnHttpError) {
|
|
9643
|
+
const payload = await resp.clone().json().catch(() => void 0);
|
|
9644
|
+
const response = payload && typeof payload === "object" ? payload : void 0;
|
|
9645
|
+
const value = response?.["errcode"] ?? response?.["code"];
|
|
9646
|
+
if (value !== void 0 && String(value) !== "0") {
|
|
9647
|
+
const detail = sanitizeLogText(String(response?.["errmsg"] ?? response?.["message"] ?? value), 300);
|
|
9648
|
+
process.stderr.write(`[DingTalk:${this.name}] sendMessage failed: ${detail}
|
|
9649
|
+
`);
|
|
9650
|
+
throw new Error(`DingTalk reply send failed: ${detail}`);
|
|
9651
|
+
}
|
|
9592
9652
|
}
|
|
9593
9653
|
plan.nextChunk++;
|
|
9594
9654
|
}
|
|
@@ -9623,7 +9683,11 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9623
9683
|
const plan = await this.createProactiveTextDelivery(target, text, sourceLabel);
|
|
9624
9684
|
if (!plan)
|
|
9625
9685
|
return;
|
|
9626
|
-
|
|
9686
|
+
try {
|
|
9687
|
+
await this.deliverProactiveText(target, plan);
|
|
9688
|
+
} catch (error) {
|
|
9689
|
+
throw new ProactiveTextDeliveryError(plan, error);
|
|
9690
|
+
}
|
|
9627
9691
|
}
|
|
9628
9692
|
async createProactiveTextDelivery(target, text, sourceLabel) {
|
|
9629
9693
|
const outgoingText = await this.prepareFileOutput(text, (file, mediaId) => this.sendProactiveFile(target, file, mediaId));
|
|
@@ -9858,6 +9922,7 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
9858
9922
|
this.finishReaction(state.chatId, state.messageId, state.sessionId);
|
|
9859
9923
|
}
|
|
9860
9924
|
this.statusCardController?.dispose();
|
|
9925
|
+
this.drainBackgroundResponseAggregations();
|
|
9861
9926
|
this.activeReactionKeys.clear();
|
|
9862
9927
|
this.sessionReactionKeys.clear();
|
|
9863
9928
|
this.reactionStates.clear();
|
|
@@ -10106,6 +10171,7 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
10106
10171
|
}
|
|
10107
10172
|
}
|
|
10108
10173
|
this.sessionMentionTargets.delete(sessionId);
|
|
10174
|
+
this.drainBackgroundResponseAggregations(sessionId);
|
|
10109
10175
|
const cardRunId = this.cardRunBySession.get(sessionId);
|
|
10110
10176
|
if (cardRunId) {
|
|
10111
10177
|
this.cardRunBySession.delete(sessionId);
|
|
@@ -10141,6 +10207,9 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
10141
10207
|
this.cardRuns.delete(runId);
|
|
10142
10208
|
}
|
|
10143
10209
|
}
|
|
10210
|
+
onSessionRetiring(sessionId) {
|
|
10211
|
+
this.drainBackgroundResponseAggregations(sessionId);
|
|
10212
|
+
}
|
|
10144
10213
|
onTaskLifecycle(event) {
|
|
10145
10214
|
if (event.type === "started") {
|
|
10146
10215
|
this.startReaction(event.chatId, event.messageId, event.sessionId);
|
|
@@ -10277,12 +10346,547 @@ var DingtalkChannel = class _DingtalkChannel extends ChannelBase {
|
|
|
10277
10346
|
this.sessionMentionTargets.delete(sessionId);
|
|
10278
10347
|
this.stopReaction(chatId, messageId, sessionId);
|
|
10279
10348
|
}
|
|
10349
|
+
/** Deliver every Agent segment immediately unless aggregation is enabled. */
|
|
10280
10350
|
async dispatchBackgroundResponse(sessionId, text, context) {
|
|
10281
10351
|
const target = this.router.getTarget(sessionId);
|
|
10282
|
-
if (!target || target.channelName !== this.name || context !== void 0 && context.kind !== "agent"
|
|
10352
|
+
if (!target || target.channelName !== this.name || context !== void 0 && context.kind !== "agent") {
|
|
10283
10353
|
return super.dispatchBackgroundResponse(sessionId, text, context);
|
|
10284
10354
|
}
|
|
10285
|
-
|
|
10355
|
+
const canAggregate = this.aggregateBackgroundAgentResponses && context?.kind === "agent" && typeof context.turnComplete === "boolean";
|
|
10356
|
+
if (!canAggregate) {
|
|
10357
|
+
if (text.trim().length === 0) {
|
|
10358
|
+
return super.dispatchBackgroundResponse(sessionId, text, context);
|
|
10359
|
+
}
|
|
10360
|
+
return super.dispatchBackgroundResponse(sessionId, this.formatBackgroundAgentResponse(text, context?.label), context);
|
|
10361
|
+
}
|
|
10362
|
+
const key = JSON.stringify([sessionId, context.taskId, context.turnId]);
|
|
10363
|
+
let current = this.backgroundResponseAggregations.get(key);
|
|
10364
|
+
let parked = this.pendingBackgroundResponseTerminals.get(key);
|
|
10365
|
+
if (current?.turnComplete === true) {
|
|
10366
|
+
this.detachedBackgroundResponseAggregations.add(current);
|
|
10367
|
+
this.backgroundResponseAggregations.delete(key);
|
|
10368
|
+
current = void 0;
|
|
10369
|
+
}
|
|
10370
|
+
if (!current && (parked?.turnEnded === true || parked?.turnComplete === true && (parked.retryTimer || parked.retryInFlight || parked.resolvers > 0))) {
|
|
10371
|
+
if (!parked.turnEnded) {
|
|
10372
|
+
this.detachedPendingBackgroundResponseTerminals.add(parked);
|
|
10373
|
+
}
|
|
10374
|
+
parked = { sessionId, target, resolvers: 0, held: [] };
|
|
10375
|
+
this.pendingBackgroundResponseTerminals.set(key, parked);
|
|
10376
|
+
}
|
|
10377
|
+
if (!current && text.trim().length === 0) {
|
|
10378
|
+
if (!parked || parked.resolvers === 0 && !parked.retryTimer && !parked.retryInFlight && !parked.resolutionDropped && !parked.turnComplete) {
|
|
10379
|
+
if (parked)
|
|
10380
|
+
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10381
|
+
return super.dispatchBackgroundResponse(sessionId, text, context);
|
|
10382
|
+
}
|
|
10383
|
+
if (context.turnComplete) {
|
|
10384
|
+
parked.turnComplete = true;
|
|
10385
|
+
parked.status = context.status;
|
|
10386
|
+
parked.label = context.label ?? parked.label;
|
|
10387
|
+
parked.completionPartial = context.partial === true;
|
|
10388
|
+
if (parked.resolvers === 0 && !parked.retryTimer && !parked.retryInFlight && (parked.retryAttempts ?? 0) >= BACKGROUND_RESPONSE_AGGREGATION_MAX_RETRIES) {
|
|
10389
|
+
parked.turnEnded = true;
|
|
10390
|
+
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10391
|
+
}
|
|
10392
|
+
}
|
|
10393
|
+
return;
|
|
10394
|
+
}
|
|
10395
|
+
if (!current) {
|
|
10396
|
+
parked ??= { sessionId, target, resolvers: 0, held: [] };
|
|
10397
|
+
this.pendingBackgroundResponseTerminals.set(key, parked);
|
|
10398
|
+
this.holdPendingBackgroundResponse(parked, text, context);
|
|
10399
|
+
parked.resolvers++;
|
|
10400
|
+
try {
|
|
10401
|
+
let delivery;
|
|
10402
|
+
try {
|
|
10403
|
+
delivery = await this.resolveBackgroundResponseDelivery(sessionId);
|
|
10404
|
+
} catch (error) {
|
|
10405
|
+
if (parked.resolvers === 1 && !this.backgroundResponseAggregations.has(key)) {
|
|
10406
|
+
this.scheduleBackgroundResponseResolutionRetry(key, sessionId, parked);
|
|
10407
|
+
} else {
|
|
10408
|
+
const existing = this.backgroundResponseAggregations.get(key);
|
|
10409
|
+
if (existing) {
|
|
10410
|
+
if (parked.held.length > 0) {
|
|
10411
|
+
this.applyHeldBackgroundResponses(existing, parked);
|
|
10412
|
+
}
|
|
10413
|
+
this.applyPendingBackgroundResponseTerminal(existing, parked);
|
|
10414
|
+
if (parked.resolvers === 1) {
|
|
10415
|
+
if (existing.turnComplete) {
|
|
10416
|
+
await this.completeBackgroundResponseAggregation(key, existing);
|
|
10417
|
+
} else {
|
|
10418
|
+
this.scheduleBackgroundResponseAggregationFlush(key, existing);
|
|
10419
|
+
}
|
|
10420
|
+
}
|
|
10421
|
+
}
|
|
10422
|
+
}
|
|
10423
|
+
throw error;
|
|
10424
|
+
}
|
|
10425
|
+
if (!delivery || this.router.getTarget(sessionId) !== delivery.target) {
|
|
10426
|
+
if (parked.resolvers === 1 && !this.backgroundResponseAggregations.has(key)) {
|
|
10427
|
+
this.scheduleBackgroundResponseResolutionRetry(key, sessionId, parked);
|
|
10428
|
+
} else {
|
|
10429
|
+
const existing = this.backgroundResponseAggregations.get(key);
|
|
10430
|
+
if (existing) {
|
|
10431
|
+
if (parked.held.length > 0) {
|
|
10432
|
+
this.applyHeldBackgroundResponses(existing, parked);
|
|
10433
|
+
}
|
|
10434
|
+
this.applyPendingBackgroundResponseTerminal(existing, parked);
|
|
10435
|
+
if (parked.resolvers === 1) {
|
|
10436
|
+
if (existing.turnComplete) {
|
|
10437
|
+
await this.completeBackgroundResponseAggregation(key, existing);
|
|
10438
|
+
} else {
|
|
10439
|
+
this.scheduleBackgroundResponseAggregationFlush(key, existing);
|
|
10440
|
+
}
|
|
10441
|
+
}
|
|
10442
|
+
}
|
|
10443
|
+
}
|
|
10444
|
+
return;
|
|
10445
|
+
}
|
|
10446
|
+
if (parked.retiring || this.pendingBackgroundResponseTerminals.get(key) !== parked) {
|
|
10447
|
+
await this.flushDetachedBackgroundResponse(key, sessionId, parked, delivery);
|
|
10448
|
+
return;
|
|
10449
|
+
}
|
|
10450
|
+
if (parked.retryTimer) {
|
|
10451
|
+
clearTimeout(parked.retryTimer);
|
|
10452
|
+
parked.retryTimer = void 0;
|
|
10453
|
+
}
|
|
10454
|
+
current = this.backgroundResponseAggregations.get(key) ?? this.createBackgroundResponseAggregation(key, sessionId, parked.held[0]?.context ?? context, delivery.target, delivery.sourceLabel);
|
|
10455
|
+
this.applyHeldBackgroundResponses(current, parked);
|
|
10456
|
+
this.applyPendingBackgroundResponseTerminal(current, parked);
|
|
10457
|
+
if (parked.resolutionDropped) {
|
|
10458
|
+
current.resolutionDropped = true;
|
|
10459
|
+
parked.resolutionDropped = void 0;
|
|
10460
|
+
}
|
|
10461
|
+
} finally {
|
|
10462
|
+
parked.resolvers--;
|
|
10463
|
+
if (this.pendingBackgroundResponseTerminals.get(key) === parked && parked.resolvers === 0 && !parked.retryTimer && parked.held.length === 0 && (!parked.resolutionDropped || parked.turnEnded)) {
|
|
10464
|
+
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10465
|
+
}
|
|
10466
|
+
}
|
|
10467
|
+
if (!current)
|
|
10468
|
+
return;
|
|
10469
|
+
if (current.turnComplete && parked.resolvers > 0)
|
|
10470
|
+
return;
|
|
10471
|
+
if (!current.turnComplete) {
|
|
10472
|
+
this.scheduleBackgroundResponseAggregationFlush(key, current);
|
|
10473
|
+
} else {
|
|
10474
|
+
await this.completeBackgroundResponseAggregation(key, current);
|
|
10475
|
+
}
|
|
10476
|
+
return;
|
|
10477
|
+
}
|
|
10478
|
+
current.status = context.status;
|
|
10479
|
+
current.label = context.label ?? current.label;
|
|
10480
|
+
if (text.trim().length > 0)
|
|
10481
|
+
current.parts.push(text);
|
|
10482
|
+
if (context.turnComplete && parked && parked.resolvers > 0) {
|
|
10483
|
+
parked.turnComplete = true;
|
|
10484
|
+
parked.status = context.status;
|
|
10485
|
+
parked.label = context.label ?? parked.label;
|
|
10486
|
+
parked.completionPartial = context.partial === true;
|
|
10487
|
+
} else if (context.turnComplete) {
|
|
10488
|
+
current.turnComplete = true;
|
|
10489
|
+
current.completionPartial = context.partial === true;
|
|
10490
|
+
} else if (parked?.turnComplete && parked.resolvers === 0) {
|
|
10491
|
+
current.turnComplete = true;
|
|
10492
|
+
current.status = parked.status ?? current.status;
|
|
10493
|
+
current.label = parked.label ?? current.label;
|
|
10494
|
+
current.completionPartial = parked.completionPartial === true;
|
|
10495
|
+
}
|
|
10496
|
+
current.resolutionDropped ||= parked?.resolutionDropped;
|
|
10497
|
+
if (!current.turnComplete) {
|
|
10498
|
+
this.scheduleBackgroundResponseAggregationFlush(key, current);
|
|
10499
|
+
return;
|
|
10500
|
+
}
|
|
10501
|
+
await this.completeBackgroundResponseAggregation(key, current);
|
|
10502
|
+
}
|
|
10503
|
+
async flushBackgroundResponseAggregation(key, aggregation) {
|
|
10504
|
+
if (this.backgroundResponseAggregations.get(key) !== aggregation && !this.detachedBackgroundResponseAggregations.has(aggregation) || aggregation.flushing) {
|
|
10505
|
+
return;
|
|
10506
|
+
}
|
|
10507
|
+
this.refreshBackgroundResponseDelivery(aggregation);
|
|
10508
|
+
if (aggregation.retryTimer)
|
|
10509
|
+
clearTimeout(aggregation.retryTimer);
|
|
10510
|
+
aggregation.retryTimer = void 0;
|
|
10511
|
+
let delivery = aggregation.delivery;
|
|
10512
|
+
if (!delivery) {
|
|
10513
|
+
if (aggregation.parts.length === 0) {
|
|
10514
|
+
if (!this.owesTerminalBackgroundResponseCard(aggregation)) {
|
|
10515
|
+
if (aggregation.retiring || aggregation.turnComplete) {
|
|
10516
|
+
this.removeBackgroundResponseAggregation(key, aggregation);
|
|
10517
|
+
} else {
|
|
10518
|
+
this.scheduleBackgroundResponseAggregationFlush(key, aggregation);
|
|
10519
|
+
}
|
|
10520
|
+
return;
|
|
10521
|
+
}
|
|
10522
|
+
}
|
|
10523
|
+
if (aggregation.timeoutTimer)
|
|
10524
|
+
clearTimeout(aggregation.timeoutTimer);
|
|
10525
|
+
aggregation.timeoutTimer = void 0;
|
|
10526
|
+
const parts = aggregation.parts.splice(0);
|
|
10527
|
+
delivery = {
|
|
10528
|
+
status: aggregation.status,
|
|
10529
|
+
label: aggregation.label,
|
|
10530
|
+
parts,
|
|
10531
|
+
partial: this.isPartialBackgroundResponseDelivery(aggregation, parts.length),
|
|
10532
|
+
attempts: 0,
|
|
10533
|
+
composedTurnComplete: aggregation.turnComplete === true
|
|
10534
|
+
};
|
|
10535
|
+
aggregation.delivery = delivery;
|
|
10536
|
+
}
|
|
10537
|
+
const body = this.formatBackgroundResponseAggregation(delivery);
|
|
10538
|
+
aggregation.flushing = true;
|
|
10539
|
+
let error;
|
|
10540
|
+
try {
|
|
10541
|
+
if (delivery.proactivePlan) {
|
|
10542
|
+
await this.deliverProactiveText(aggregation.target, delivery.proactivePlan);
|
|
10543
|
+
} else if (delivery.replyPlan) {
|
|
10544
|
+
await this.deliverReplyText(aggregation.target.chatId, delivery.replyPlan, true);
|
|
10545
|
+
} else if (this.supportsProactiveSend() && this.supportsProactiveTarget(aggregation.target)) {
|
|
10546
|
+
await this.deliverBackgroundResponseToTarget(aggregation.sessionId, body, {
|
|
10547
|
+
target: aggregation.target,
|
|
10548
|
+
sourceLabel: aggregation.sourceLabel
|
|
10549
|
+
});
|
|
10550
|
+
} else {
|
|
10551
|
+
delivery.preparedReplyBody ??= await this.prepareReplyOutput(aggregation.target.chatId, body);
|
|
10552
|
+
await this.deliverBackgroundReply(aggregation.target.chatId, delivery.preparedReplyBody, aggregation.sessionId, aggregation.sourceLabel, true, true);
|
|
10553
|
+
}
|
|
10554
|
+
} catch (caught) {
|
|
10555
|
+
error = caught;
|
|
10556
|
+
if (caught instanceof ProactiveTextDeliveryError) {
|
|
10557
|
+
delivery.proactivePlan = caught.plan;
|
|
10558
|
+
} else if (caught instanceof ReplyTextDeliveryError) {
|
|
10559
|
+
delivery.replyPlan = caught.plan;
|
|
10560
|
+
}
|
|
10561
|
+
} finally {
|
|
10562
|
+
aggregation.flushing = false;
|
|
10563
|
+
}
|
|
10564
|
+
if (error === void 0) {
|
|
10565
|
+
aggregation.delivery = void 0;
|
|
10566
|
+
aggregation.delivered = true;
|
|
10567
|
+
if (delivery.composedTurnComplete === true && aggregation.turnComplete && delivery.partial !== true && !aggregation.retiring) {
|
|
10568
|
+
aggregation.completionDelivered = true;
|
|
10569
|
+
}
|
|
10570
|
+
if (aggregation.retiring || aggregation.turnComplete) {
|
|
10571
|
+
await this.flushBackgroundResponseAggregation(key, aggregation);
|
|
10572
|
+
} else {
|
|
10573
|
+
this.scheduleBackgroundResponseAggregationFlush(key, aggregation);
|
|
10574
|
+
}
|
|
10575
|
+
return;
|
|
10576
|
+
}
|
|
10577
|
+
delivery.attempts++;
|
|
10578
|
+
process.stderr.write(`[DingTalk:${this.name}] background response delivery failed (attempt ${delivery.attempts}): ${sanitizeLogText(error instanceof Error ? error.message : String(error), 300)}
|
|
10579
|
+
`);
|
|
10580
|
+
if (delivery.attempts >= BACKGROUND_RESPONSE_AGGREGATION_MAX_RETRIES || // A permanently rejected send (an invalid appkey, a missing app) cannot
|
|
10581
|
+
// succeed later; retrying it only spends the chat's send quota.
|
|
10582
|
+
error instanceof ProactiveTextDeliveryError && error.retryable === false) {
|
|
10583
|
+
aggregation.delivery = void 0;
|
|
10584
|
+
aggregation.dropped = true;
|
|
10585
|
+
if (aggregation.parts.length === 0) {
|
|
10586
|
+
if (aggregation.retiring || aggregation.turnComplete) {
|
|
10587
|
+
this.removeBackgroundResponseAggregation(key, aggregation);
|
|
10588
|
+
} else {
|
|
10589
|
+
this.scheduleBackgroundResponseAggregationFlush(key, aggregation);
|
|
10590
|
+
}
|
|
10591
|
+
} else if (aggregation.retiring || aggregation.turnComplete) {
|
|
10592
|
+
await this.flushBackgroundResponseAggregation(key, aggregation);
|
|
10593
|
+
} else {
|
|
10594
|
+
this.scheduleBackgroundResponseAggregationFlush(key, aggregation);
|
|
10595
|
+
}
|
|
10596
|
+
return;
|
|
10597
|
+
}
|
|
10598
|
+
aggregation.retryTimer = setTimeout(() => {
|
|
10599
|
+
aggregation.retryTimer = void 0;
|
|
10600
|
+
void this.flushBackgroundResponseAggregation(key, aggregation);
|
|
10601
|
+
}, BACKGROUND_RESPONSE_AGGREGATION_RETRY_MS);
|
|
10602
|
+
aggregation.retryTimer.unref?.();
|
|
10603
|
+
}
|
|
10604
|
+
/**
|
|
10605
|
+
* A card carries `(部分)` whenever it is not the turn's whole output: the
|
|
10606
|
+
* turn is still open, earlier text already went out (or was given up on),
|
|
10607
|
+
* or the turn itself ended early.
|
|
10608
|
+
*/
|
|
10609
|
+
isPartialBackgroundResponseDelivery(aggregation, partCount) {
|
|
10610
|
+
return partCount > 0 && (aggregation.delivered === true || aggregation.dropped === true || aggregation.resolutionDropped === true || aggregation.retiring === true || aggregation.completionPartial === true || aggregation.turnComplete !== true);
|
|
10611
|
+
}
|
|
10612
|
+
/**
|
|
10613
|
+
* A turn that outran the bounded wait had its text delivered under the
|
|
10614
|
+
* `(部分)` label. When it then completes normally with nothing buffered,
|
|
10615
|
+
* a header-only card is the only way the chat ever learns it finished.
|
|
10616
|
+
*/
|
|
10617
|
+
owesTerminalBackgroundResponseCard(aggregation) {
|
|
10618
|
+
return aggregation.turnComplete === true && aggregation.delivered === true && aggregation.completionDelivered !== true && aggregation.retiring !== true && aggregation.completionPartial !== true && aggregation.dropped !== true && aggregation.resolutionDropped !== true;
|
|
10619
|
+
}
|
|
10620
|
+
refreshBackgroundResponseDelivery(aggregation) {
|
|
10621
|
+
const delivery = aggregation.delivery;
|
|
10622
|
+
if (!delivery || aggregation.flushing)
|
|
10623
|
+
return;
|
|
10624
|
+
const plan = delivery.proactivePlan ?? delivery.replyPlan;
|
|
10625
|
+
if (plan && plan.nextChunk > 0)
|
|
10626
|
+
return;
|
|
10627
|
+
const body = this.formatBackgroundResponseAggregation(delivery);
|
|
10628
|
+
const header = body.split("\n", 1)[0];
|
|
10629
|
+
const replaceHeader = /* @__PURE__ */ __name((text) => text.replace(/## (?:✅|❌|⏹️) Agent · [^\n]+/, () => header), "replaceHeader");
|
|
10630
|
+
if (plan) {
|
|
10631
|
+
plan.title = extractTitle(body);
|
|
10632
|
+
plan.chunks[0] = replaceHeader(plan.chunks[0]);
|
|
10633
|
+
}
|
|
10634
|
+
if (delivery.preparedReplyBody) {
|
|
10635
|
+
delivery.preparedReplyBody = replaceHeader(delivery.preparedReplyBody);
|
|
10636
|
+
}
|
|
10637
|
+
delivery.composedTurnComplete = aggregation.turnComplete === true;
|
|
10638
|
+
}
|
|
10639
|
+
removeBackgroundResponseAggregation(key, aggregation) {
|
|
10640
|
+
if (this.backgroundResponseAggregations.get(key) === aggregation) {
|
|
10641
|
+
this.backgroundResponseAggregations.delete(key);
|
|
10642
|
+
}
|
|
10643
|
+
this.detachedBackgroundResponseAggregations.delete(aggregation);
|
|
10644
|
+
}
|
|
10645
|
+
drainBackgroundResponseAggregations(sessionId) {
|
|
10646
|
+
for (const [key, pending] of this.pendingBackgroundResponseTerminals) {
|
|
10647
|
+
if (sessionId !== void 0 && pending.sessionId !== sessionId)
|
|
10648
|
+
continue;
|
|
10649
|
+
if (pending.retryTimer)
|
|
10650
|
+
clearTimeout(pending.retryTimer);
|
|
10651
|
+
pending.retryTimer = void 0;
|
|
10652
|
+
pending.retiring = true;
|
|
10653
|
+
pending.turnComplete = true;
|
|
10654
|
+
pending.completionPartial = true;
|
|
10655
|
+
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10656
|
+
this.detachedPendingBackgroundResponseTerminals.add(pending);
|
|
10657
|
+
}
|
|
10658
|
+
for (const pending of this.detachedPendingBackgroundResponseTerminals) {
|
|
10659
|
+
if (sessionId !== void 0 && pending.sessionId !== sessionId)
|
|
10660
|
+
continue;
|
|
10661
|
+
if (pending.retryTimer)
|
|
10662
|
+
clearTimeout(pending.retryTimer);
|
|
10663
|
+
pending.retryTimer = void 0;
|
|
10664
|
+
pending.retiring = true;
|
|
10665
|
+
pending.turnComplete = true;
|
|
10666
|
+
pending.completionPartial = true;
|
|
10667
|
+
if (pending.held.length > 0 && this.router.getTarget(pending.sessionId) === pending.target) {
|
|
10668
|
+
void this.flushDetachedBackgroundResponse("", pending.sessionId, pending, { target: pending.target }).catch((error) => {
|
|
10669
|
+
process.stderr.write(`[DingTalk:${this.name}] background response delivery failed during drain: ${sanitizeLogText(error instanceof Error ? error.message : String(error), 300)}
|
|
10670
|
+
`);
|
|
10671
|
+
});
|
|
10672
|
+
} else if (pending.held.length > 0) {
|
|
10673
|
+
process.stderr.write(`[DingTalk:${this.name}] background response target unavailable during drain; ${pending.held.length} buffered segment(s) discarded
|
|
10674
|
+
`);
|
|
10675
|
+
pending.held.length = 0;
|
|
10676
|
+
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10677
|
+
} else if (pending.held.length === 0) {
|
|
10678
|
+
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10679
|
+
}
|
|
10680
|
+
}
|
|
10681
|
+
const aggregations = /* @__PURE__ */ new Set([
|
|
10682
|
+
...this.backgroundResponseAggregations.values(),
|
|
10683
|
+
...this.detachedBackgroundResponseAggregations
|
|
10684
|
+
]);
|
|
10685
|
+
for (const aggregation of aggregations) {
|
|
10686
|
+
if (sessionId !== void 0 && aggregation.sessionId !== sessionId) {
|
|
10687
|
+
continue;
|
|
10688
|
+
}
|
|
10689
|
+
if (aggregation.timeoutTimer)
|
|
10690
|
+
clearTimeout(aggregation.timeoutTimer);
|
|
10691
|
+
if (aggregation.retryTimer)
|
|
10692
|
+
clearTimeout(aggregation.retryTimer);
|
|
10693
|
+
aggregation.timeoutTimer = void 0;
|
|
10694
|
+
aggregation.retryTimer = void 0;
|
|
10695
|
+
aggregation.retiring = true;
|
|
10696
|
+
aggregation.turnComplete = true;
|
|
10697
|
+
aggregation.completionPartial = true;
|
|
10698
|
+
if (!aggregation.flushing) {
|
|
10699
|
+
void this.flushBackgroundResponseAggregation(aggregation.key, aggregation);
|
|
10700
|
+
}
|
|
10701
|
+
}
|
|
10702
|
+
}
|
|
10703
|
+
createBackgroundResponseAggregation(key, sessionId, context, target, sourceLabel) {
|
|
10704
|
+
const aggregation = {
|
|
10705
|
+
key,
|
|
10706
|
+
sessionId,
|
|
10707
|
+
target,
|
|
10708
|
+
sourceLabel,
|
|
10709
|
+
status: context.status,
|
|
10710
|
+
label: context.label,
|
|
10711
|
+
parts: []
|
|
10712
|
+
};
|
|
10713
|
+
this.backgroundResponseAggregations.set(key, aggregation);
|
|
10714
|
+
return aggregation;
|
|
10715
|
+
}
|
|
10716
|
+
scheduleBackgroundResponseResolutionRetry(key, sessionId, pending) {
|
|
10717
|
+
if (pending.retiring)
|
|
10718
|
+
return;
|
|
10719
|
+
if (pending.retryTimer)
|
|
10720
|
+
return;
|
|
10721
|
+
pending.retryAttempts = (pending.retryAttempts ?? 0) + 1;
|
|
10722
|
+
if (pending.retryAttempts >= BACKGROUND_RESPONSE_AGGREGATION_MAX_RETRIES) {
|
|
10723
|
+
pending.resolutionDropped = true;
|
|
10724
|
+
pending.turnEnded = pending.turnComplete === true;
|
|
10725
|
+
pending.held.length = 0;
|
|
10726
|
+
pending.turnComplete = void 0;
|
|
10727
|
+
pending.status = void 0;
|
|
10728
|
+
pending.label = void 0;
|
|
10729
|
+
pending.completionPartial = void 0;
|
|
10730
|
+
if (pending.turnEnded) {
|
|
10731
|
+
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10732
|
+
}
|
|
10733
|
+
return;
|
|
10734
|
+
}
|
|
10735
|
+
pending.retryTimer = setTimeout(() => {
|
|
10736
|
+
pending.retryTimer = void 0;
|
|
10737
|
+
pending.retryInFlight = true;
|
|
10738
|
+
void this.retryBackgroundResponseResolution(key, sessionId, pending).catch((error) => {
|
|
10739
|
+
process.stderr.write(`[DingTalk:${this.name}] background response target resolution failed: ${sanitizeLogText(error instanceof Error ? error.message : String(error), 300)}
|
|
10740
|
+
`);
|
|
10741
|
+
}).finally(() => {
|
|
10742
|
+
pending.retryInFlight = false;
|
|
10743
|
+
if (pending.retiring || !pending.retryTimer && !pending.resolutionDropped) {
|
|
10744
|
+
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10745
|
+
}
|
|
10746
|
+
if (this.pendingBackgroundResponseTerminals.get(key) === pending && pending.resolvers === 0 && !pending.retryTimer && pending.held.length === 0 && (!pending.resolutionDropped || pending.turnEnded)) {
|
|
10747
|
+
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10748
|
+
}
|
|
10749
|
+
});
|
|
10750
|
+
}, BACKGROUND_RESPONSE_AGGREGATION_RETRY_MS);
|
|
10751
|
+
pending.retryTimer.unref?.();
|
|
10752
|
+
const active = this.pendingBackgroundResponseTerminals.get(key);
|
|
10753
|
+
if (!active || active === pending) {
|
|
10754
|
+
this.pendingBackgroundResponseTerminals.set(key, pending);
|
|
10755
|
+
}
|
|
10756
|
+
}
|
|
10757
|
+
async retryBackgroundResponseResolution(key, sessionId, pending) {
|
|
10758
|
+
let delivery;
|
|
10759
|
+
try {
|
|
10760
|
+
delivery = await this.resolveBackgroundResponseDelivery(sessionId);
|
|
10761
|
+
} catch (error) {
|
|
10762
|
+
if (this.pendingBackgroundResponseTerminals.get(key) === pending && !this.backgroundResponseAggregations.has(key) || this.detachedPendingBackgroundResponseTerminals.has(pending)) {
|
|
10763
|
+
this.scheduleBackgroundResponseResolutionRetry(key, sessionId, pending);
|
|
10764
|
+
}
|
|
10765
|
+
throw error;
|
|
10766
|
+
}
|
|
10767
|
+
if (!delivery || this.router.getTarget(sessionId) !== delivery.target) {
|
|
10768
|
+
if (pending.retiring) {
|
|
10769
|
+
if (pending.held.length > 0) {
|
|
10770
|
+
process.stderr.write(`[DingTalk:${this.name}] background response target unavailable during drain; ${pending.held.length} buffered segment(s) discarded
|
|
10771
|
+
`);
|
|
10772
|
+
}
|
|
10773
|
+
pending.held.length = 0;
|
|
10774
|
+
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10775
|
+
return;
|
|
10776
|
+
}
|
|
10777
|
+
if (this.pendingBackgroundResponseTerminals.get(key) === pending && !this.backgroundResponseAggregations.has(key) || this.detachedPendingBackgroundResponseTerminals.has(pending)) {
|
|
10778
|
+
this.scheduleBackgroundResponseResolutionRetry(key, sessionId, pending);
|
|
10779
|
+
}
|
|
10780
|
+
return;
|
|
10781
|
+
}
|
|
10782
|
+
if (pending.retiring || this.pendingBackgroundResponseTerminals.get(key) !== pending || pending.turnComplete) {
|
|
10783
|
+
await this.flushDetachedBackgroundResponse(key, sessionId, pending, delivery);
|
|
10784
|
+
return;
|
|
10785
|
+
}
|
|
10786
|
+
const first = pending.held[0];
|
|
10787
|
+
if (!first)
|
|
10788
|
+
return;
|
|
10789
|
+
const aggregation = this.createBackgroundResponseAggregation(key, sessionId, first.context, delivery.target, delivery.sourceLabel);
|
|
10790
|
+
this.applyHeldBackgroundResponses(aggregation, pending);
|
|
10791
|
+
if (pending.resolutionDropped) {
|
|
10792
|
+
aggregation.resolutionDropped = true;
|
|
10793
|
+
pending.resolutionDropped = void 0;
|
|
10794
|
+
}
|
|
10795
|
+
if (this.pendingBackgroundResponseTerminals.get(key) === pending) {
|
|
10796
|
+
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10797
|
+
}
|
|
10798
|
+
this.scheduleBackgroundResponseAggregationFlush(key, aggregation);
|
|
10799
|
+
}
|
|
10800
|
+
holdPendingBackgroundResponse(pending, text, context) {
|
|
10801
|
+
if (text.trim().length > 0)
|
|
10802
|
+
pending.held.push({ text, context });
|
|
10803
|
+
if (context.turnComplete) {
|
|
10804
|
+
pending.turnComplete = true;
|
|
10805
|
+
pending.status = context.status;
|
|
10806
|
+
pending.label = context.label ?? pending.label;
|
|
10807
|
+
pending.completionPartial = context.partial === true;
|
|
10808
|
+
}
|
|
10809
|
+
}
|
|
10810
|
+
applyHeldBackgroundResponses(aggregation, pending) {
|
|
10811
|
+
for (const { text, context } of pending.held.splice(0)) {
|
|
10812
|
+
aggregation.status = context.status;
|
|
10813
|
+
aggregation.label = context.label ?? aggregation.label;
|
|
10814
|
+
aggregation.parts.push(text);
|
|
10815
|
+
if (context.turnComplete) {
|
|
10816
|
+
aggregation.turnComplete = true;
|
|
10817
|
+
aggregation.completionPartial = context.partial === true;
|
|
10818
|
+
}
|
|
10819
|
+
}
|
|
10820
|
+
}
|
|
10821
|
+
applyPendingBackgroundResponseTerminal(aggregation, pending) {
|
|
10822
|
+
if (!pending.turnComplete)
|
|
10823
|
+
return;
|
|
10824
|
+
aggregation.turnComplete = true;
|
|
10825
|
+
aggregation.status = pending.status ?? aggregation.status;
|
|
10826
|
+
aggregation.label = pending.label ?? aggregation.label;
|
|
10827
|
+
aggregation.completionPartial = pending.completionPartial === true;
|
|
10828
|
+
pending.turnComplete = void 0;
|
|
10829
|
+
pending.status = void 0;
|
|
10830
|
+
pending.label = void 0;
|
|
10831
|
+
pending.completionPartial = void 0;
|
|
10832
|
+
}
|
|
10833
|
+
async completeBackgroundResponseAggregation(key, aggregation) {
|
|
10834
|
+
if (aggregation.delivery) {
|
|
10835
|
+
aggregation.delivery.status = aggregation.status;
|
|
10836
|
+
aggregation.delivery.label = aggregation.label ?? aggregation.delivery.label;
|
|
10837
|
+
aggregation.delivery.partial = this.isPartialBackgroundResponseDelivery(aggregation, aggregation.delivery.parts.length) || aggregation.parts.length > 0;
|
|
10838
|
+
}
|
|
10839
|
+
if (aggregation.timeoutTimer)
|
|
10840
|
+
clearTimeout(aggregation.timeoutTimer);
|
|
10841
|
+
aggregation.timeoutTimer = void 0;
|
|
10842
|
+
await this.flushBackgroundResponseAggregation(key, aggregation);
|
|
10843
|
+
}
|
|
10844
|
+
async flushDetachedBackgroundResponse(key, sessionId, pending, delivery) {
|
|
10845
|
+
const first = pending.held[0];
|
|
10846
|
+
if (!first) {
|
|
10847
|
+
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10848
|
+
return;
|
|
10849
|
+
}
|
|
10850
|
+
const aggregation = {
|
|
10851
|
+
key,
|
|
10852
|
+
sessionId,
|
|
10853
|
+
target: delivery.target,
|
|
10854
|
+
sourceLabel: delivery.sourceLabel,
|
|
10855
|
+
status: first.context.status,
|
|
10856
|
+
label: first.context.label,
|
|
10857
|
+
parts: [],
|
|
10858
|
+
turnComplete: pending.turnComplete,
|
|
10859
|
+
completionPartial: pending.completionPartial,
|
|
10860
|
+
resolutionDropped: pending.resolutionDropped
|
|
10861
|
+
};
|
|
10862
|
+
this.applyHeldBackgroundResponses(aggregation, pending);
|
|
10863
|
+
aggregation.status = pending.status ?? aggregation.status;
|
|
10864
|
+
aggregation.label = pending.label ?? aggregation.label;
|
|
10865
|
+
if (this.pendingBackgroundResponseTerminals.get(key) === pending) {
|
|
10866
|
+
this.pendingBackgroundResponseTerminals.delete(key);
|
|
10867
|
+
}
|
|
10868
|
+
this.detachedPendingBackgroundResponseTerminals.delete(pending);
|
|
10869
|
+
this.detachedBackgroundResponseAggregations.add(aggregation);
|
|
10870
|
+
await this.flushBackgroundResponseAggregation(key, aggregation);
|
|
10871
|
+
}
|
|
10872
|
+
scheduleBackgroundResponseAggregationFlush(key, aggregation) {
|
|
10873
|
+
if (aggregation.timeoutTimer || aggregation.delivery)
|
|
10874
|
+
return;
|
|
10875
|
+
aggregation.timeoutTimer = setTimeout(() => {
|
|
10876
|
+
aggregation.timeoutTimer = void 0;
|
|
10877
|
+
void this.flushBackgroundResponseAggregation(key, aggregation);
|
|
10878
|
+
}, BACKGROUND_RESPONSE_AGGREGATION_TIMEOUT_MS);
|
|
10879
|
+
aggregation.timeoutTimer.unref?.();
|
|
10880
|
+
}
|
|
10881
|
+
formatBackgroundResponseAggregation(delivery) {
|
|
10882
|
+
const icon = delivery.status === "completed" ? "\u2705" : delivery.status === "failed" ? "\u274C" : "\u23F9\uFE0F";
|
|
10883
|
+
const label = this.formatBackgroundAgentLabel(delivery.label);
|
|
10884
|
+
const header = `## ${icon} Agent \xB7 ${label}${delivery.partial ? "\uFF08\u90E8\u5206\uFF09" : ""}`;
|
|
10885
|
+
if (delivery.parts.length === 0)
|
|
10886
|
+
return header;
|
|
10887
|
+
return `${header}
|
|
10888
|
+
|
|
10889
|
+
${delivery.parts.join("\n\n")}`;
|
|
10286
10890
|
}
|
|
10287
10891
|
formatBackgroundAgentResponse(text, label) {
|
|
10288
10892
|
return `## \u{1F916} Agent \xB7 ${this.formatBackgroundAgentLabel(label)}
|
|
@@ -10293,11 +10897,22 @@ ${text}`;
|
|
|
10293
10897
|
const normalized = label?.replace(new RegExp("\\p{Cc}+", "gu"), " ").replace(/\s+/g, " ").trim();
|
|
10294
10898
|
return escapeDingTalkMarkdown(normalized || "\u540E\u53F0\u4EFB\u52A1");
|
|
10295
10899
|
}
|
|
10296
|
-
|
|
10900
|
+
/**
|
|
10901
|
+
* Body-identical to the base implementation — this override exists only to
|
|
10902
|
+
* widen the signature, which the base seam does not declare. The background
|
|
10903
|
+
* aggregation flush passes `prepared` so the body it already projected isn't
|
|
10904
|
+
* projected a second time (that would re-upload its files), and
|
|
10905
|
+
* `failOnHttpError` so a failed send throws instead of being swallowed,
|
|
10906
|
+
* letting the flush capture the delivery plan for the next retry.
|
|
10907
|
+
*/
|
|
10908
|
+
async deliverBackgroundReply(chatId, text, sessionId, sourceLabel, prepared = false, failOnHttpError = false) {
|
|
10909
|
+
await this.sendResponseMessage(chatId, text, sessionId, sourceLabel, prepared, failOnHttpError);
|
|
10910
|
+
}
|
|
10911
|
+
async sendResponseMessage(chatId, text, sessionId, sourceLabel, prepared = false, failOnHttpError = false) {
|
|
10297
10912
|
const atUserId = this.atSender ? this.sessionMentionTargets.get(sessionId) : void 0;
|
|
10298
10913
|
if (atUserId)
|
|
10299
10914
|
this.sessionMentionTargets.delete(sessionId);
|
|
10300
|
-
await this.sendReply(chatId, text, atUserId, sourceLabel ?? this.getResponseSourceLabel(sessionId), prepared);
|
|
10915
|
+
await this.sendReply(chatId, text, atUserId, sourceLabel ?? this.getResponseSourceLabel(sessionId), prepared, failOnHttpError);
|
|
10301
10916
|
}
|
|
10302
10917
|
async sendFallbackReply(chatId, text, sessionId, sourceLabel) {
|
|
10303
10918
|
const atUserId = this.atSender ? this.sessionMentionTargets.get(sessionId) : void 0;
|
|
@@ -10748,6 +11363,12 @@ var plugin = {
|
|
|
10748
11363
|
required: true,
|
|
10749
11364
|
envResolvable: true
|
|
10750
11365
|
},
|
|
11366
|
+
{
|
|
11367
|
+
key: "aggregateBackgroundAgentResponses",
|
|
11368
|
+
label: "Aggregate Background Agent Responses",
|
|
11369
|
+
kind: "boolean",
|
|
11370
|
+
description: "Buffer each background Agent turn and send one labeled result instead of labeled segments"
|
|
11371
|
+
},
|
|
10751
11372
|
{
|
|
10752
11373
|
key: "interactiveCards",
|
|
10753
11374
|
label: "Interactive Cards",
|