stableclaw 2026.5.0 → 2026.5.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/dist/.buildstamp +1 -1
- package/dist/abort-DbOWfk1R.js +192 -0
- package/dist/abort-cutoff.runtime-ZDeu_mNv.js +20 -0
- package/dist/abort-cutoff.runtime.js +1 -1
- package/dist/abort.runtime-DzSEcqwd.js +2 -0
- package/dist/abort.runtime.js +1 -1
- package/dist/access-control-ChkJvEGP.js +152 -0
- package/dist/account-inspect-DCKRZRny.js +158 -0
- package/dist/accounts-BGTN7cr-.js +102 -0
- package/dist/accounts-CinolZTU.js +107 -0
- package/dist/accounts-CkhyYlS6.js +137 -0
- package/dist/accounts-D219ghr6.js +57 -0
- package/dist/accounts-DrggbKcd.js +2 -0
- package/dist/acp-runtime-_pYPcJEH.js +8 -0
- package/dist/acp-stateful-target-driver-BEIUsg83.js +60 -0
- package/dist/action-runtime-CJhBKfDC.js +318 -0
- package/dist/action-runtime-NLKQbAQA.js +72 -0
- package/dist/action-runtime-api-YzbQ4Qy6.js +1028 -0
- package/dist/actions-BrAcUNm-.js +531 -0
- package/dist/actions.runtime-BwB4CvxW.js +2 -0
- package/dist/actions.runtime-CiYUOMp1.js +18 -0
- package/dist/actions.runtime-SFl3LXbz.js +5 -0
- package/dist/actions.runtime.js +1 -1
- package/dist/agent-CdYMZ9fr.js +2 -0
- package/dist/agent-command-wY0aEiLZ.js +1457 -0
- package/dist/agent-runner.runtime-BJYxz_AG.js +2241 -0
- package/dist/agent-runner.runtime.js +1 -1
- package/dist/agent-runtime-Cm6WYH1X.js +142 -0
- package/dist/agent-tools-login-Bd1V75kh.js +57 -0
- package/dist/agents-IbQmK8Yn.js +888 -0
- package/dist/agents-MrSC-Up6.js +5 -0
- package/dist/api-BQHk-t06.js +5 -0
- package/dist/api-Bmx0BK0F.js +5 -0
- package/dist/api-CJIpnZrc.js +10 -0
- package/dist/api-CRhMGxLB.js +6 -0
- package/dist/api-CdYIiak82.js +322 -0
- package/dist/api-DOdPShPk.js +2 -0
- package/dist/api-jI3BtiNB.js +2 -0
- package/dist/apply-Cbt003x7.js +485 -0
- package/dist/apply.runtime-CY47EbzA.js +2 -0
- package/dist/apply.runtime.js +1 -1
- package/dist/approval-native-B4HJRa55.js +79 -0
- package/dist/approval-runtime-B6PXavdQ.js +262 -0
- package/dist/assistant-identity-CeKI09AJ.js +74 -0
- package/dist/attachment-normalize-BZdNI2So.js +921 -0
- package/dist/audit-BLq9P3oA.js +86 -0
- package/dist/audit-DtlsDuaM.js +892 -0
- package/dist/audit-channel.allow-from.runtime.js +1 -1
- package/dist/audit-channel.collect.runtime-CTutyCbl.js +528 -0
- package/dist/audit-channel.collect.runtime.js +1 -1
- package/dist/audit-channel.discord.runtime.js +1 -1
- package/dist/audit-channel.telegram.runtime-DgjqHj_y.js +8 -0
- package/dist/audit-channel.telegram.runtime.js +1 -1
- package/dist/audit-channel.zalouser.runtime.js +1 -1
- package/dist/audit-extra.async-azTwi9Ii.js +820 -0
- package/dist/audit.deep.runtime-DczMVmZl.js +2 -0
- package/dist/audit.deep.runtime.js +1 -1
- package/dist/audit.nondeep.runtime-C0-gevdg.js +831 -0
- package/dist/audit.nondeep.runtime.js +1 -1
- package/dist/audit.runtime-CjmP-IVf.js +7 -0
- package/dist/audit.runtime.js +1 -1
- package/dist/auth-D9R9vTdP.js +181 -0
- package/dist/auth-choice-ASVf3uqH.js +3 -0
- package/dist/auth-choice-CUGc7jRT.js +341 -0
- package/dist/auth-choice-TdFpgqf8.js +69 -0
- package/dist/binding-targets-BB736PNg.js +99 -0
- package/dist/bot-i7rkFnoU.js +4268 -0
- package/dist/bot-message-context-NjuZxwNf.js +2 -0
- package/dist/bot-message-context-SFoFcMU0.js +1175 -0
- package/dist/bot-message-context.runtime-BuHjCi1s.js +7 -0
- package/dist/bot-message-context.runtime.js +1 -1
- package/dist/bot-message-context.session.runtime-BOjKvTjg.js +12 -0
- package/dist/bot-message-context.session.runtime.js +1 -1
- package/dist/bot-native-commands.delivery.runtime-CMVcyVfr.js +3 -0
- package/dist/bot-native-commands.delivery.runtime.js +1 -1
- package/dist/bot-native-commands.runtime-DPXiZ-g-.js +11 -0
- package/dist/bot-native-commands.runtime.js +1 -1
- package/dist/bundled/boot-md/handler.js +3 -3
- package/dist/bundled/session-memory/handler.js +1 -1
- package/dist/channel-6JSPqz3S.js +599 -0
- package/dist/channel-8fxnaoxA.js +1135 -0
- package/dist/channel-BGr4lB_p.js +208 -0
- package/dist/channel-BRZOhpO-.js +1217 -0
- package/dist/channel-BTaI9Vsm.js +454 -0
- package/dist/channel-BuvbHCUl.js +800 -0
- package/dist/channel-C0kxZQ7E.js +883 -0
- package/dist/channel-CJgXhuIs.js +698 -0
- package/dist/channel-DQWDH71E.js +337 -0
- package/dist/channel-DqywfjHt.js +361 -0
- package/dist/channel-inbound-BbIwjinv.js +30 -0
- package/dist/channel-o7dERoVP.js +1129 -0
- package/dist/channel-ouAyZmKb.js +788 -0
- package/dist/channel-pGQXHihG.js +783 -0
- package/dist/channel-plugin-resolution-E1W_efdm.js +144 -0
- package/dist/channel-qw2GU-78.js +1661 -0
- package/dist/channel-shared-DsqgfMVz.js +58 -0
- package/dist/channel-x8EJXY-p.js +4976 -0
- package/dist/channel.runtime-9U-FzlTX.js +22252 -0
- package/dist/channel.runtime-CDRgtalS.js +309 -0
- package/dist/channel.runtime-CrTb-acp.js +373 -0
- package/dist/channel.runtime-CvUJhEWE.js +14 -0
- package/dist/channel.runtime-D86obE0J.js +108 -0
- package/dist/channel.runtime-DR14R1qn.js +125 -0
- package/dist/channel.runtime-DY-t80Mq.js +335 -0
- package/dist/channel.runtime-Db6-JgiT.js +80 -0
- package/dist/channel.setup-5ccX1E-a.js +279 -0
- package/dist/channels-CU1r9oWn.js +1134 -0
- package/dist/channels-cli-H6kLKRCJ.js +246 -0
- package/dist/clawhub-CicQAK3Q.js +163 -0
- package/dist/cli/daemon-cli.js +3 -9
- package/dist/cli-BeJobAfz.js +695 -0
- package/dist/cli-Bw_QTHCD.js +152 -0
- package/dist/cli-migration-DBUl9wOM.js +100 -0
- package/dist/cli-runner-CNdeXILj.js +1014 -0
- package/dist/client-C7KrfnR_.js +5 -0
- package/dist/client-D1IMuN2R.js +7 -0
- package/dist/client-bootstrap-BRL3IJbX.js +2 -0
- package/dist/client-bootstrap-BnU_fgOa.js +121 -0
- package/dist/code-execution-Dy3oNAvz.js +142 -0
- package/dist/command-auth-BoH1IkmW.js +64 -0
- package/dist/command-registry-CFUnlk3Y.js +199 -0
- package/dist/command-registry-Dy7lErHE.js +3 -0
- package/dist/commands-P7L4abaE.js +4 -0
- package/dist/commands-acp-CRBC84-r.js +990 -0
- package/dist/commands-core-DfVd-xq7.js +241 -0
- package/dist/commands-core.runtime-CCF1BiL7.js +2 -0
- package/dist/commands-core.runtime.js +1 -1
- package/dist/commands-handlers.runtime-BWoNwBZE.js +3708 -0
- package/dist/commands-handlers.runtime.js +1 -1
- package/dist/commands-info-CSt3aoRZ.js +651 -0
- package/dist/commands-models-FgUB1hGv.js +395 -0
- package/dist/commands-status.runtime-jcqPwtM3.js +2 -0
- package/dist/commands-status.runtime.js +1 -1
- package/dist/commands.runtime-CIbt20JL.js +4 -0
- package/dist/commands.runtime.js +1 -1
- package/dist/compact.runtime-DKdAjeMZ.js +7 -0
- package/dist/compact.runtime.js +1 -1
- package/dist/completion-cli-7xXpXxID.js +2 -0
- package/dist/completion-cli-Csbpl09N.js +466 -0
- package/dist/config-BGW2qyLw.js +475 -0
- package/dist/config-cli--4OexF6J.js +945 -0
- package/dist/config-guard-V5IAh_mF.js +113 -0
- package/dist/config-runtime-D208l2BL.js +13 -0
- package/dist/config-secret-input.runtime-BF9IBBeM.js +3 -0
- package/dist/config-secret-input.runtime.js +1 -1
- package/dist/config-update-BBzrkxal.js +127 -0
- package/dist/config-update-DrtP_s0Y.js +3 -0
- package/dist/configure-B5cJf26V.js +2 -0
- package/dist/configure-Ts01pF4g.js +1140 -0
- package/dist/context-DeDQINVq.js +227 -0
- package/dist/control-ui-C9vPgc9L.js +388 -0
- package/dist/conversation-bindings-CwHBn1fl.js +210 -0
- package/dist/conversation-id-BOk-dTsl.js +168 -0
- package/dist/conversation-runtime-DvoDx5Lp.js +85 -0
- package/dist/core-_nKe7lGV.js +195 -0
- package/dist/create-client-BenzpBNt.js +2 -0
- package/dist/create-client-CGt4-gcv.js +58 -0
- package/dist/credentials-7IVnN_TF.js +22 -0
- package/dist/credentials-write.runtime-D1VXZncp.js +9 -0
- package/dist/credentials-write.runtime.js +1 -1
- package/dist/crypto-runtime-Y20cyTTx.js +3495 -0
- package/dist/daemon-cli-DvP7I-Uu.js +383 -0
- package/dist/daemon-install-CVIbxBN5.js +63 -0
- package/dist/delegate-VctUvdru.js +43 -0
- package/dist/deliver-DTfKSC4Q.js +954 -0
- package/dist/deliver-LbQQnhR5.js +3 -0
- package/dist/deliver-reply-18sWD8M4.js +238 -0
- package/dist/deliver-runtime-Qg81IeZu.js +2 -0
- package/dist/delivery-D8E92dmQ.js +834 -0
- package/dist/delivery-info-Cls9iWRl.js +40 -0
- package/dist/direct-dm-Dg-rhCG0.js +139 -0
- package/dist/direct-management-CaI85_dA.js +2 -0
- package/dist/direct-management-DjdwL-F4.js +300 -0
- package/dist/directive-handling.fast-lane-3sGyxlH_.js +64 -0
- package/dist/directive-handling.fast-lane-CKe_S3fo.js +2 -0
- package/dist/directive-handling.impl-C1D-MGbp.js +2 -0
- package/dist/directive-handling.impl-Dk6oRN3H.js +672 -0
- package/dist/directive-handling.parse-ni5LIlSW.js +375 -0
- package/dist/directive-handling.persist-DSyJG2Kq.js +133 -0
- package/dist/directive-handling.persist.runtime-WEeAbhJ8.js +2 -0
- package/dist/directive-handling.persist.runtime.js +1 -1
- package/dist/directive-handling.shared-DPXk9T6l.js +158 -0
- package/dist/directory-cli-CL6UudXS.js +238 -0
- package/dist/directory.static-BX7RI4Aq.js +45 -0
- package/dist/discovery-DhEDepjw.js +171 -0
- package/dist/dispatch-acp.runtime-DHUc4MMQ.js +884 -0
- package/dist/dispatch-acp.runtime.js +1 -1
- package/dist/dispatch-au2t5HsH.js +858 -0
- package/dist/doctor-completion-fD570xvd.js +90 -0
- package/dist/doctor-config-preflight-B0C_HTWN.js +2 -0
- package/dist/doctor-config-preflight-OMEufm7U.js +148 -0
- package/dist/doctor-state-migrations-BJ5M0r8a.js +2 -0
- package/dist/doctor-state-migrations-CPG_ii-i.js +3 -0
- package/dist/embedding-provider-vb6JoF5D.js +129 -0
- package/dist/encryption-guidance-BRY-GWVy.js +33 -0
- package/dist/entry.js +2 -2
- package/dist/error-text-CM5bR2qT.js +24 -0
- package/dist/exec-approval-session-target-Ci45mXNL.js +159 -0
- package/dist/exec-approvals-D9wFcLn9.js +121 -0
- package/dist/extensionAPI.js +3 -3
- package/dist/extensions/acpx/index.js +3 -3
- package/dist/extensions/acpx/runtime-api.js +2 -2
- package/dist/extensions/amazon-bedrock/api.js +2 -2
- package/dist/extensions/amazon-bedrock/discovery.js +1 -1
- package/dist/extensions/amazon-bedrock/index.js +2 -2
- package/dist/extensions/anthropic/cli-migration.js +1 -1
- package/dist/extensions/anthropic/index.js +5 -5
- package/dist/extensions/anthropic/media-understanding-provider.js +1 -1
- package/dist/extensions/bluebubbles/api.js +2 -2
- package/dist/extensions/bluebubbles/index.js +2 -2
- package/dist/extensions/bluebubbles/setup-entry.js +1 -1
- package/dist/extensions/browser/test-support.js +1 -1
- package/dist/extensions/byteplus/index.js +2 -2
- package/dist/extensions/chutes/index.js +4 -4
- package/dist/extensions/cloudflare-ai-gateway/index.js +1 -1
- package/dist/extensions/deepseek/index.js +1 -1
- package/dist/extensions/device-pair/api.js +2 -2
- package/dist/extensions/device-pair/index.js +3 -3
- package/dist/extensions/device-pair/notify.js +1 -1
- package/dist/extensions/device-pair/qr-image.js +2 -2
- package/dist/extensions/diffs/index.js +1 -1
- package/dist/extensions/discord/action-runtime-api.js +1 -1
- package/dist/extensions/discord/api.js +4 -4
- package/dist/extensions/discord/index.js +9 -9
- package/dist/extensions/discord/runtime-api.js +10 -10
- package/dist/extensions/discord/setup-entry.js +2 -2
- package/dist/extensions/discord/test-api.js +3 -3
- package/dist/extensions/fal/index.js +2 -2
- package/dist/extensions/feishu/api.js +2 -2
- package/dist/extensions/feishu/index.js +7 -7
- package/dist/extensions/feishu/setup-api.js +1 -1
- package/dist/extensions/feishu/setup-entry.js +2 -2
- package/dist/extensions/github-copilot/api.js +1 -1
- package/dist/extensions/github-copilot/index.js +2 -2
- package/dist/extensions/github-copilot/login.js +1 -1
- package/dist/extensions/google/index.js +2 -2
- package/dist/extensions/google/media-understanding-provider.js +2 -2
- package/dist/extensions/googlechat/api.js +1 -1
- package/dist/extensions/googlechat/index.js +2 -2
- package/dist/extensions/googlechat/setup-entry.js +2 -2
- package/dist/extensions/googlechat/test-api.js +1 -1
- package/dist/extensions/groq/index.js +1 -1
- package/dist/extensions/groq/media-understanding-provider.js +1 -1
- package/dist/extensions/huggingface/index.js +2 -2
- package/dist/extensions/imessage/api.js +2 -2
- package/dist/extensions/imessage/index.js +7 -7
- package/dist/extensions/imessage/runtime-api.js +2 -2
- package/dist/extensions/imessage/setup-entry.js +3 -3
- package/dist/extensions/irc/api.js +1 -1
- package/dist/extensions/irc/index.js +2 -2
- package/dist/extensions/irc/setup-entry.js +2 -2
- package/dist/extensions/kilocode/index.js +1 -1
- package/dist/extensions/kimi-coding/index.js +2 -2
- package/dist/extensions/line/api.js +4 -4
- package/dist/extensions/line/index.js +5 -5
- package/dist/extensions/line/runtime-api.js +2 -2
- package/dist/extensions/line/setup-api.js +2 -2
- package/dist/extensions/line/setup-entry.js +3 -3
- package/dist/extensions/litellm/index.js +1 -1
- package/dist/extensions/lobster/index.js +1 -1
- package/dist/extensions/lobster/runtime-api.js +1 -1
- package/dist/extensions/matrix/api.js +3 -3
- package/dist/extensions/matrix/index.js +3 -3
- package/dist/extensions/matrix/plugin-entry.handlers.runtime.js +3 -3
- package/dist/extensions/matrix/setup-entry.js +2 -2
- package/dist/extensions/matrix/test-api.js +1 -1
- package/dist/extensions/mattermost/api.js +1 -1
- package/dist/extensions/mattermost/index.js +2 -2
- package/dist/extensions/mattermost/runtime-api.js +4 -4
- package/dist/extensions/mattermost/setup-entry.js +2 -2
- package/dist/extensions/media-understanding-core/runtime-api.js +2 -2
- package/dist/extensions/microsoft/index.js +1 -1
- package/dist/extensions/microsoft/speech-provider.js +1 -1
- package/dist/extensions/microsoft/test-api.js +1 -1
- package/dist/extensions/microsoft-foundry/auth.js +1 -1
- package/dist/extensions/microsoft-foundry/cli.js +1 -1
- package/dist/extensions/microsoft-foundry/index.js +1 -1
- package/dist/extensions/microsoft-foundry/onboard.js +2 -2
- package/dist/extensions/microsoft-foundry/provider.js +1 -1
- package/dist/extensions/microsoft-foundry/runtime.js +1 -1
- package/dist/extensions/microsoft-foundry/shared-runtime.js +2 -2
- package/dist/extensions/microsoft-foundry/shared.js +1 -1
- package/dist/extensions/minimax/index.js +4 -4
- package/dist/extensions/minimax/media-understanding-provider.js +1 -1
- package/dist/extensions/minimax/oauth.js +1 -1
- package/dist/extensions/minimax/oauth.runtime.js +1 -1
- package/dist/extensions/mistral/index.js +2 -2
- package/dist/extensions/mistral/media-understanding-provider.js +1 -1
- package/dist/extensions/modelstudio/index.js +1 -1
- package/dist/extensions/moonshot/index.js +2 -2
- package/dist/extensions/moonshot/media-understanding-provider.js +1 -1
- package/dist/extensions/msteams/api.js +1 -1
- package/dist/extensions/msteams/index.js +3 -3
- package/dist/extensions/msteams/runtime-api.js +4 -4
- package/dist/extensions/msteams/setup-entry.js +2 -2
- package/dist/extensions/msteams/test-api.js +1 -1
- package/dist/extensions/nextcloud-talk/api.js +1 -1
- package/dist/extensions/nextcloud-talk/index.js +2 -2
- package/dist/extensions/nextcloud-talk/runtime-api.js +2 -2
- package/dist/extensions/nextcloud-talk/setup-entry.js +2 -2
- package/dist/extensions/nostr/api.js +3 -3
- package/dist/extensions/nostr/index.js +4 -4
- package/dist/extensions/nostr/runtime-api.js +3 -3
- package/dist/extensions/nostr/setup-api.js +1 -1
- package/dist/extensions/nostr/setup-entry.js +2 -2
- package/dist/extensions/nostr/test-api.js +1 -1
- package/dist/extensions/nvidia/index.js +1 -1
- package/dist/extensions/ollama/api.js +2 -2
- package/dist/extensions/ollama/index.js +3 -3
- package/dist/extensions/ollama/runtime-api.js +2 -2
- package/dist/extensions/openai/api.js +1 -1
- package/dist/extensions/openai/index.js +3 -3
- package/dist/extensions/openai/media-understanding-provider.js +1 -1
- package/dist/extensions/openai/openai-codex-provider.js +1 -1
- package/dist/extensions/openai/openai-provider.js +1 -1
- package/dist/extensions/openai/test-api.js +1 -1
- package/dist/extensions/opencode/index.js +2 -2
- package/dist/extensions/opencode-go/index.js +2 -2
- package/dist/extensions/openrouter/index.js +3 -3
- package/dist/extensions/openrouter/media-understanding-provider.js +1 -1
- package/dist/extensions/openshell/index.js +1 -1
- package/dist/extensions/qianfan/index.js +1 -1
- package/dist/extensions/qqbot/index.js +2 -2
- package/dist/extensions/qqbot/setup-entry.js +2 -2
- package/dist/extensions/signal/api.js +4 -4
- package/dist/extensions/signal/index.js +9 -9
- package/dist/extensions/signal/reaction-runtime-api.js +1 -1
- package/dist/extensions/signal/runtime-api.js +4 -4
- package/dist/extensions/signal/setup-entry.js +2 -2
- package/dist/extensions/signal/test-api.js +4 -4
- package/dist/extensions/slack/api.js +6 -6
- package/dist/extensions/slack/index.js +2 -2
- package/dist/extensions/slack/runtime-api.js +6 -6
- package/dist/extensions/slack/setup-entry.js +2 -2
- package/dist/extensions/slack/test-api.js +4 -4
- package/dist/extensions/stepfun/index.js +2 -2
- package/dist/extensions/synology-chat/index.js +2 -2
- package/dist/extensions/synology-chat/setup-api.js +1 -1
- package/dist/extensions/synology-chat/setup-entry.js +2 -2
- package/dist/extensions/synthetic/index.js +1 -1
- package/dist/extensions/talk-voice/index.js +1 -1
- package/dist/extensions/telegram/api.js +8 -8
- package/dist/extensions/telegram/index.js +2 -2
- package/dist/extensions/telegram/runtime-api.js +8 -8
- package/dist/extensions/telegram/setup-entry.js +3 -3
- package/dist/extensions/telegram/test-api.js +7 -7
- package/dist/extensions/telegram/test-support.js +4 -4
- package/dist/extensions/tlon/index.js +2 -2
- package/dist/extensions/tlon/setup-entry.js +2 -2
- package/dist/extensions/tlon/test-api.js +1 -1
- package/dist/extensions/together/index.js +1 -1
- package/dist/extensions/twitch/index.js +1 -1
- package/dist/extensions/venice/index.js +1 -1
- package/dist/extensions/vercel-ai-gateway/index.js +1 -1
- package/dist/extensions/volcengine/index.js +2 -2
- package/dist/extensions/whatsapp/action-runtime-api.js +1 -1
- package/dist/extensions/whatsapp/action-runtime.runtime.js +1 -1
- package/dist/extensions/whatsapp/api.js +2 -2
- package/dist/extensions/whatsapp/index.js +2 -2
- package/dist/extensions/whatsapp/light-runtime-api.js +1 -1
- package/dist/extensions/whatsapp/login-qr-api.js +1 -1
- package/dist/extensions/whatsapp/runtime-api.js +13 -13
- package/dist/extensions/whatsapp/setup-entry.js +3 -3
- package/dist/extensions/whatsapp/test-api.js +6 -6
- package/dist/extensions/xai/code-execution.js +1 -1
- package/dist/extensions/xai/index.js +4 -4
- package/dist/extensions/xai/x-search.js +1 -1
- package/dist/extensions/xiaomi/index.js +1 -1
- package/dist/extensions/zai/index.js +2 -2
- package/dist/extensions/zai/media-understanding-provider.js +1 -1
- package/dist/extensions/zalo/api.js +2 -2
- package/dist/extensions/zalo/index.js +2 -2
- package/dist/extensions/zalo/runtime-api.js +2 -2
- package/dist/extensions/zalo/setup-entry.js +2 -2
- package/dist/extensions/zalo/test-api.js +1 -1
- package/dist/extensions/zalouser/api.js +1 -1
- package/dist/extensions/zalouser/index.js +10 -10
- package/dist/extensions/zalouser/runtime-api.js +3 -3
- package/dist/extensions/zalouser/setup-entry.js +3 -3
- package/dist/extensions/zalouser/test-api.js +4 -4
- package/dist/format-BN8tV56q.js +817 -0
- package/dist/gateway-CK0mVyJH.js +2575 -0
- package/dist/gateway-cli-BIGurgdT.js +1596 -0
- package/dist/gateway-install-token-CnLiX_Zd.js +230 -0
- package/dist/get-reply-from-config.runtime-DHVxBB-O.js +2 -0
- package/dist/get-reply-from-config.runtime.js +1 -1
- package/dist/gmail-watcher-lifecycle-BOSlI4iv.js +2 -0
- package/dist/graph-users-CceVBSPZ.js +918 -0
- package/dist/group-access-Cwl8gW8B.js +32 -0
- package/dist/group-access-DHoGAQFt.js +119 -0
- package/dist/handle-action-BmBnXGdV.js +500 -0
- package/dist/health-CkL8pqV8.js +2 -0
- package/dist/health-DhHzqohg.js +577 -0
- package/dist/heartbeat-runner-N3rkIDfo.js +995 -0
- package/dist/hooks-cli-LfG_KZSu.js +353 -0
- package/dist/http-client-lTUwUVkV.js +294 -0
- package/dist/image-BZJoriob.js +152 -0
- package/dist/image-runtime-V0FuCGlj.js +7 -0
- package/dist/inbound-reply-dispatch-C8za1uEq.js +73 -0
- package/dist/inbound.runtime-BYJ118rE.js +3 -0
- package/dist/inbound.runtime.js +1 -1
- package/dist/index.js +2 -2
- package/dist/infra-runtime-C9fJenAY.js +22 -0
- package/dist/install-BKR6ckWd.js +590 -0
- package/dist/install-security-scan-BWWG9NEd.js +22 -0
- package/dist/install-security-scan.runtime-CNFIn93M.js +299 -0
- package/dist/install-security-scan.runtime.js +1 -1
- package/dist/install.runtime-BKwzESsg.js +11 -0
- package/dist/install.runtime-DrieSb_M.js +27 -0
- package/dist/install.runtime.js +1 -1
- package/dist/irc-DRWT3CQf.js +14 -0
- package/dist/legacy-crypto-restore-CZycrxha.js +85 -0
- package/dist/library-CVZUhyOq.js +44 -0
- package/dist/llm-slug-generator-B79ECeWZ.js +68 -0
- package/dist/llm-slug-generator.js +1 -1
- package/dist/loader-BJO8z2ig.js +2 -0
- package/dist/login-Cs2tMFcs.js +2332 -0
- package/dist/login-GAWpWfxh.js +108 -0
- package/dist/login-qr-CUosF6JZ.js +211 -0
- package/dist/login-qr-api-W1NF3gA_.js +16 -0
- package/dist/manager.runtime-Dmq8R0mb.js +670 -0
- package/dist/manager.runtime.js +1 -1
- package/dist/matrix-DrH1M_Sr.js +351 -0
- package/dist/matrix-runtime-heavy-C6fkT2VX.js +4 -0
- package/dist/mattermost-B9327zl5.js +18 -0
- package/dist/media-CIdwV3Lu.js +1691 -0
- package/dist/media-runtime-QMgMQ3WZ.js +295 -0
- package/dist/media-understanding-C66pUC4U.js +51 -0
- package/dist/media-understanding-provider-BRzfmJfY.js +86 -0
- package/dist/media-understanding-provider-Bd8aZtsH.js +11 -0
- package/dist/media-understanding-provider-By1hanjB.js +16 -0
- package/dist/media-understanding-provider-C6SiAxyT.js +11 -0
- package/dist/media-understanding-provider-DGKwGu0P.js +16 -0
- package/dist/media-understanding-provider-Jlh0zs2Z.js +17 -0
- package/dist/media-understanding-provider-SRUeyQqG.js +28 -0
- package/dist/media-understanding-provider-wimL3kdC.js +11 -0
- package/dist/media-understanding.runtime-BPtAeqrg.js +7 -0
- package/dist/media-understanding.runtime.js +1 -1
- package/dist/message-CzGnK5F3.js +206 -0
- package/dist/message-action-runner-BZ8x9K7O.js +1330 -0
- package/dist/message-handler-gpYZEW_K.js +1771 -0
- package/dist/messages-Xy50Pa2j.js +270 -0
- package/dist/migration-snapshot.runtime-jCZaBq39.js +3 -0
- package/dist/migration-snapshot.runtime.js +1 -1
- package/dist/model-catalog-sx4GaLTc.js +216 -0
- package/dist/model-catalog.runtime-DDSdoGE4.js +2 -0
- package/dist/model-catalog.runtime.js +1 -1
- package/dist/model-picker-CDs8bq1G.js +3 -0
- package/dist/model-picker-bY3x3ppH.js +439 -0
- package/dist/model-runtime-BiWDK2-B.js +1772 -0
- package/dist/model-selection-rJYfkbE0.js +407 -0
- package/dist/models-D5u4cqP1.js +3 -0
- package/dist/models-Xs8Qafsh.js +2550 -0
- package/dist/models-cli-6McdkNo9.js +197 -0
- package/dist/models-config-CAPHcyO2.js +1106 -0
- package/dist/models-config-DABSjBBO.js +2 -0
- package/dist/models-config.runtime-B4-0SSTG.js +2 -0
- package/dist/models-config.runtime.js +1 -1
- package/dist/models-provider-runtime-C0oxGm-e.js +2 -0
- package/dist/monitor-B1P5ei52.js +3622 -0
- package/dist/monitor-B8Q7rxtC.js +666 -0
- package/dist/monitor-B9o5AegX.js +3660 -0
- package/dist/monitor-BSMPXJ97.js +676 -0
- package/dist/monitor-BgD5Jrad.js +4067 -0
- package/dist/monitor-Bzvaap7m.js +1525 -0
- package/dist/monitor-DOHgeQjB.js +687 -0
- package/dist/monitor-auth-3ZkW5CEr.js +192 -0
- package/dist/monitor-polling.runtime-Bs9-PKyv.js +307 -0
- package/dist/monitor-polling.runtime.js +1 -1
- package/dist/monitor-provider-BhVxiO1J.js +1782 -0
- package/dist/monitor-webhook.runtime-DtF-7o03.js +297 -0
- package/dist/monitor-webhook.runtime.js +1 -1
- package/dist/msteams-BIcHfY4o.js +33 -0
- package/dist/nextcloud-talk-Csx58yBv.js +18 -0
- package/dist/nostr-CMrgscuJ.js +19 -0
- package/dist/notify-DSCFVe6i.js +298 -0
- package/dist/oauth-CthjG7hQ.js +152 -0
- package/dist/onboard-C-jsaHwd.js +307 -0
- package/dist/onboard-channels-I98y7NZ8.js +2 -0
- package/dist/onboard-channels-NS1vMCQr.js +705 -0
- package/dist/onboard-custom-BMQ33xqX.js +2 -0
- package/dist/onboard-custom-Dz1DOCJM.js +646 -0
- package/dist/onboard-helpers-BnxgMgMT.js +228 -0
- package/dist/onboard-helpers-DEn4dg5k.js +4 -0
- package/dist/onboard-oYw6GJEA.js +591 -0
- package/dist/onboard-remote-CMmcPmsN.js +2 -0
- package/dist/onboard-remote-uiiE3QnY.js +193 -0
- package/dist/onboard-skills-CttSUeZa.js +2 -0
- package/dist/onboard-skills-DbUk33Ct.js +134 -0
- package/dist/openai-codex-provider-DZN_1A31.js +254 -0
- package/dist/openai-provider-CxBasM1Z.js +272 -0
- package/dist/openclaw-tools.runtime-nwmrOrNY.js +2 -0
- package/dist/openclaw-tools.runtime.js +1 -1
- package/dist/outbound-adapter-DfYvjhM_.js +183 -0
- package/dist/outbound-session-BTLOycg4.js +41 -0
- package/dist/persistent-bindings.lifecycle-CR9WhqMq.js +159 -0
- package/dist/pi-embedded-T_JLa73v.js +40738 -0
- package/dist/pi-embedded.runtime-Bn2DltTS.js +4 -0
- package/dist/pi-embedded.runtime.js +1 -1
- package/dist/plugin-install-BQ6Yfbir.js +230 -0
- package/dist/plugin-install-config-policy-Dr_wjNho.js +93 -0
- package/dist/plugin-install-lmnNJcpj.js +2 -0
- package/dist/plugin-install-plan-BysT2Zgt.js +50 -0
- package/dist/plugin-sdk/acp-runtime.js +2 -2
- package/dist/plugin-sdk/agent-runtime.js +4 -4
- package/dist/plugin-sdk/approval-runtime.js +2 -2
- package/dist/plugin-sdk/channel-inbound.js +3 -3
- package/dist/plugin-sdk/command-auth.js +6 -6
- package/dist/plugin-sdk/compat.js +1 -1
- package/dist/plugin-sdk/config-runtime.js +4 -4
- package/dist/plugin-sdk/conversation-runtime.js +3 -3
- package/dist/plugin-sdk/core.js +2 -2
- package/dist/plugin-sdk/direct-dm.js +1 -1
- package/dist/plugin-sdk/index.js +1 -1
- package/dist/plugin-sdk/infra-runtime.js +2 -2
- package/dist/plugin-sdk/irc.js +2 -2
- package/dist/plugin-sdk/matrix-runtime-heavy.js +3 -3
- package/dist/plugin-sdk/mattermost.js +4 -4
- package/dist/plugin-sdk/media-runtime.js +3 -3
- package/dist/plugin-sdk/media-understanding.js +2 -2
- package/dist/plugin-sdk/models-provider-runtime.js +2 -2
- package/dist/plugin-sdk/msteams.js +3 -3
- package/dist/plugin-sdk/nextcloud-talk.js +2 -2
- package/dist/plugin-sdk/nostr.js +2 -2
- package/dist/plugin-sdk/provider-auth-api-key.js +2 -2
- package/dist/plugin-sdk/provider-auth-login.js +1 -1
- package/dist/plugin-sdk/provider-auth.js +2 -2
- package/dist/plugin-sdk/provider-entry.js +1 -1
- package/dist/plugin-sdk/reply-dispatch-runtime.js +2 -2
- package/dist/plugin-sdk/reply-runtime.js +4 -4
- package/dist/plugin-sdk/session-store-runtime.js +2 -2
- package/dist/plugin-sdk/testing.js +3 -3
- package/dist/plugin-sdk/webhook-path.js +2 -29
- package/dist/plugin-sdk/zalo.js +2 -2
- package/dist/plugin-sdk/zalouser.js +2 -2
- package/dist/plugins/runtime/index.js +1 -1
- package/dist/plugins-cli-QKhcgiO8.js +561 -0
- package/dist/plugins-command-helpers-DhvJn5jI.js +116 -0
- package/dist/plugins-install-persist-Qeas2eSh.js +121 -0
- package/dist/plugins-update-command-BKJEivnf.js +974 -0
- package/dist/policy-Oilx4qmu.js +147 -0
- package/dist/preflight-audio-BmL4gGyL.js +48 -0
- package/dist/preflight-audio.runtime-CAepz41v.js +7 -0
- package/dist/preflight-audio.runtime.js +1 -1
- package/dist/prepare-8M63vDxs.js +1301 -0
- package/dist/probe-Btp49F9p.js +170 -0
- package/dist/probe-CAA_bibg.js +349 -0
- package/dist/probe-CcT1Zjlx.js +431 -0
- package/dist/probe-zQeRFb2K.js +1868 -0
- package/dist/profile-update-P49WNZII.js +67 -0
- package/dist/program-Kb8jcb5x.js +158 -0
- package/dist/prompt-select-styled-G8WwN-L7.js +6434 -0
- package/dist/provider-B2yqefja.js +3685 -0
- package/dist/provider-CzbklD1X.js +70 -0
- package/dist/provider-DIIdFC34.js +18901 -0
- package/dist/provider-api-key-auth-BliP73d_.js +109 -0
- package/dist/provider-api-key-auth.runtime.js +1 -1
- package/dist/provider-auth-DxViiapc.js +43 -0
- package/dist/provider-auth-api-key-BlF9OozZ.js +5 -0
- package/dist/provider-auth-login-DAhr6tMx.js +8 -0
- package/dist/provider-auth-login.runtime.js +1 -1
- package/dist/provider-discovery.runtime.js +1 -1
- package/dist/provider-dispatcher-BEZOvNvI.js +22 -0
- package/dist/provider-entry-CSq-QYSf.js +86 -0
- package/dist/provider-session.runtime-D3rfVYR5.js +7 -0
- package/dist/provider-session.runtime.js +1 -1
- package/dist/provider.runtime-Bbi0dGrm.js +2 -0
- package/dist/provider.runtime.js +1 -1
- package/dist/qr-image-IXoz2Bw3.js +2 -0
- package/dist/queue-Ca31F-8a.js +663 -0
- package/dist/reaction-runtime-api-CZLmJ_WX.js +114 -0
- package/dist/reactions-D-WSon-m.js +258 -0
- package/dist/read-only-account-inspect.telegram-MmNQAAZr.js +202 -0
- package/dist/register.agent-B7D4sSrd.js +240 -0
- package/dist/register.configure-BgQOxerG.js +15 -0
- package/dist/register.maintenance-CiTThGcR.js +449 -0
- package/dist/register.message-CReL6dlw.js +644 -0
- package/dist/register.onboard-DHhhEg9U.js +79 -0
- package/dist/register.setup-COczC1It.js +183 -0
- package/dist/register.status-health-sessions-DRX2aQSL.js +1206 -0
- package/dist/register.subclis-DXBjIEu_.js +3 -0
- package/dist/register.subclis-DokJMw3i.js +295 -0
- package/dist/replies-DuTJPPK4.js +118 -0
- package/dist/reply-CU8qGvKT.js +3192 -0
- package/dist/reply-blocks-BpVJG1en.js +103 -0
- package/dist/reply-dispatch-runtime-DxUm7xv8.js +3 -0
- package/dist/reply-runtime-CvaF7P6-.js +123 -0
- package/dist/reply.runtime-BfN6C1_l.js +2 -0
- package/dist/reply.runtime.js +1 -1
- package/dist/resolve-allowlist-C_Y8enFH.js +147 -0
- package/dist/resolve-targets-gk4hti4C.js +280 -0
- package/dist/rooms-Can12aFd.js +325 -0
- package/dist/route-reply-BxhqzhSe.js +133 -0
- package/dist/route-reply.runtime-BuSWcdvc.js +2 -0
- package/dist/route-reply.runtime.js +1 -1
- package/dist/route-resolution-DSj60ZbR.js +461 -0
- package/dist/rpc-context-a4f1uaqq.js +155 -0
- package/dist/run-main-CvRWW8mV.js +425 -0
- package/dist/runner-D_uJ9v3f.js +1479 -0
- package/dist/runtime-8Mw5wFou.js +68 -0
- package/dist/runtime-DQ8O9TLG.js +1175 -0
- package/dist/runtime-api-2l7jjGPw.js +3 -0
- package/dist/runtime-api-3_TNQnpI.js +81 -0
- package/dist/runtime-api-B6vjGOFJ.js +2 -0
- package/dist/runtime-api-BVjd5QC5.js +2 -0
- package/dist/runtime-api-BcMW34og.js +14 -0
- package/dist/runtime-api-Bih0haVa.js +2 -0
- package/dist/runtime-api-CZBqKHRi.js +2 -0
- package/dist/runtime-api-CnP_Jrha.js +2 -0
- package/dist/runtime-api-CnS87iaj.js +2 -0
- package/dist/runtime-api-DOLRVoZD.js +29 -0
- package/dist/runtime-api-R7oPeDFN.js +3676 -0
- package/dist/runtime-api-SP4kFvYZ.js +2 -0
- package/dist/runtime-api-y4jBsmod.js +2 -0
- package/dist/runtime-discord-ops.runtime.js +1 -1
- package/dist/runtime-embedded-pi.runtime-eHP2DunP.js +2 -0
- package/dist/runtime-embedded-pi.runtime.js +1 -1
- package/dist/runtime-media-understanding.runtime.js +1 -1
- package/dist/runtime-model-auth.runtime.js +1 -1
- package/dist/runtime-slack-ops.runtime.js +1 -1
- package/dist/runtime-tts.runtime.js +1 -1
- package/dist/sandbox-cli-DT2znKIY.js +443 -0
- package/dist/sdk-V8yEikk_.js +1108 -0
- package/dist/security-cli-DYR5zC6Y.js +477 -0
- package/dist/send-B-Z8V4Cq.js +532 -0
- package/dist/send-Bqywq3tg.js +3 -0
- package/dist/send-BxvA6SmF.js +100 -0
- package/dist/send-ChbtrSVp.js +2 -0
- package/dist/send-CzWEW9Zb.js +856 -0
- package/dist/send-DIfvOzDT.js +318 -0
- package/dist/send-DLHztqfo.js +442 -0
- package/dist/send-DYtTIT9n.js +178 -0
- package/dist/send-DiOk2E98.js +1076 -0
- package/dist/send.components-6LOUmhSy.js +2 -0
- package/dist/send.components-D75OT62r.js +942 -0
- package/dist/server-BNNkiKsj.js +9741 -0
- package/dist/server-cron-DuTAwT4O.js +4173 -0
- package/dist/server-cron-dsNWt3Xk.js +2 -0
- package/dist/server-lite-COJ3scXX.js +830 -0
- package/dist/server-maintenance-B1miba9h.js +542 -0
- package/dist/server-maintenance-Bc6xlNTK.js +2 -0
- package/dist/server-node-events-C8B10rlc.js +454 -0
- package/dist/server-node-subscriptions-BbcfGfam.js +2 -0
- package/dist/server-plugins-40fdRywj.js +10354 -0
- package/dist/server-plugins-D2LGejil.js +2 -0
- package/dist/server-startup-memory-BSth6DJB.js +2 -0
- package/dist/server-tailscale-Bwmz6UuQ.js +2 -0
- package/dist/services-CdVUH8cK.js +2 -0
- package/dist/session-DifMNh_t.js +50 -0
- package/dist/session-archive.runtime-EJGWbu-k.js +2 -0
- package/dist/session-archive.runtime.js +1 -1
- package/dist/session-envelope-Cc5bPuvN.js +18 -0
- package/dist/session-file-C6zGg-sn.js +120 -0
- package/dist/session-key-DPKf0dWL.js +52 -0
- package/dist/session-override-Cd7zBl0i.js +100 -0
- package/dist/session-reset-model.runtime-D_iAW4sx.js +119 -0
- package/dist/session-reset-model.runtime.js +1 -1
- package/dist/session-route-USlsJP9v.js +91 -0
- package/dist/session-store-runtime-Bac-IfWa.js +2 -0
- package/dist/session-subagent-reactivation.runtime-BrSBT1dK.js +2 -0
- package/dist/session-subagent-reactivation.runtime.js +1 -1
- package/dist/session-transcript-files.fs-D2Mq9mp7.js +149 -0
- package/dist/session-updates-RRq3LS7F.js +222 -0
- package/dist/session-updates.runtime-DlCqhR2y.js +2 -0
- package/dist/session-updates.runtime.js +1 -1
- package/dist/session-utils-B6yctVT6.js +1743 -0
- package/dist/sessions-BDZF0KSB.js +224 -0
- package/dist/sessions-Di_GACQe.js +2 -0
- package/dist/sessions-xeX9HpAZ.js +443 -0
- package/dist/setup-Du8OSH3g.js +427 -0
- package/dist/setup-api-ALaLEpZD.js +2 -0
- package/dist/setup-bootstrap-Dzdz67yA.js +54 -0
- package/dist/setup-core-CljP-9Aw.js +256 -0
- package/dist/setup-core-mlfG8i3t.js +146 -0
- package/dist/setup-surface-8NjprfQ4.js +261 -0
- package/dist/setup-surface-BBhpO_bO.js +304 -0
- package/dist/setup-surface-BpJACnBD.js +450 -0
- package/dist/setup-surface-C3-Jx6vF.js +272 -0
- package/dist/setup-surface-CzMh5yAL.js +656 -0
- package/dist/setup-surface-CzzVm3hE.js +353 -0
- package/dist/setup-surface-D6yTgwHY.js +346 -0
- package/dist/setup-surface-DjJE20Ud.js +484 -0
- package/dist/setup-surface-DpqfELkE.js +261 -0
- package/dist/setup-surface-VdCxFOLw.js +237 -0
- package/dist/setup-surface-fuNIOdUY.js +8848 -0
- package/dist/setup-surface-v155bftZ.js +333 -0
- package/dist/setup.finalize-iyzp5VAT.js +458 -0
- package/dist/setup.gateway-config-CU0y8lbT.js +247 -0
- package/dist/shared-Blh_fJTo.js +64 -0
- package/dist/shared-CBnUPRHA.js +180 -0
- package/dist/shared-CM5Gt0l4.js +198 -0
- package/dist/shared-CaqlRGF3.js +160 -0
- package/dist/shared-Cf75swpz.js +144 -0
- package/dist/shared-DL7by7Wd.js +2 -0
- package/dist/shared-DSx0wubR.js +72 -0
- package/dist/shared-DykGaEWS.js +94 -0
- package/dist/shared-azg27y31.js +78 -0
- package/dist/shared-runtime-Bt4waeX3.js +7 -0
- package/dist/skills-install-ByDR1-M6.js +819 -0
- package/dist/slash-commands-DG50c1a2.js +672 -0
- package/dist/slash-commands.runtime-CVcxhZ8u.js +20 -0
- package/dist/slash-commands.runtime.js +1 -1
- package/dist/slash-dispatch.runtime-C_YtFTUx.js +38 -0
- package/dist/slash-dispatch.runtime.js +1 -1
- package/dist/slash-skill-commands.runtime-Bj_cUvfb.js +8 -0
- package/dist/slash-skill-commands.runtime.js +1 -1
- package/dist/speech-provider-CC-UZuqH.js +190 -0
- package/dist/src-CAL53FNb.js +2739 -0
- package/dist/startup-verification-BpSIv6hV.js +131 -0
- package/dist/state-migrations-BZk1lezo.js +845 -0
- package/dist/status-8IelSped.js +650 -0
- package/dist/status-BVcZIA1F.js +3 -0
- package/dist/status-Bf-qPLzv.js +608 -0
- package/dist/status-BviySeE3.js +2 -0
- package/dist/status-all-Cmj7Gw5o.js +798 -0
- package/dist/status-issues--arI8w_g.js +187 -0
- package/dist/status-issues-byw_R8T_.js +336 -0
- package/dist/status-json-CKuOdeh3.js +86 -0
- package/dist/status.command.text-runtime-B3Z2fUDH.js +18 -0
- package/dist/status.scan-boBZeJmL.js +264 -0
- package/dist/status.scan.fast-json-AJppC2D5.js +97 -0
- package/dist/status.scan.fast-json-shj4aBtI.js +2 -0
- package/dist/status.scan.json-core-BpHhaewp.js +254 -0
- package/dist/status.summary-C4itGbbW.js +210 -0
- package/dist/status.summary-zSPMfFai.js +2 -0
- package/dist/sticker-cache-BN_g5-an.js +1573 -0
- package/dist/sticker-vision.runtime-DC2hIjcl.js +16 -0
- package/dist/sticker-vision.runtime.js +1 -1
- package/dist/storage-YrOCuZuJ.js +234 -0
- package/dist/store-DJaTq2_f.js +1343 -0
- package/dist/store.runtime-B05zX98d.js +2 -0
- package/dist/store.runtime.js +1 -1
- package/dist/stream-D5aKuhrW.js +633 -0
- package/dist/subagent-orphan-recovery-vUbckcfb.js +206 -0
- package/dist/subagent-registry-runtime-BE_luJ3B.js +2 -0
- package/dist/supervisor-log.runtime.js +1 -1
- package/dist/targets-BG8dKyny.js +748 -0
- package/dist/task-registry-delivery-runtime-B-oO-IGC.js +2 -0
- package/dist/task-registry.audit-BCghpxrn.js +320 -0
- package/dist/task-registry.maintenance-B55J7Hf8.js +2 -0
- package/dist/telegram/token.js +1 -1
- package/dist/test-api-BBW7IReU.js +47 -0
- package/dist/testing-fkQ9XFkv.js +677 -0
- package/dist/thread-bindings-B0ugWuKq.js +534 -0
- package/dist/thread-bindings-Dx2arldI.js +778 -0
- package/dist/thread-bindings-iFF5pMFx.js +219 -0
- package/dist/thread-bindings-lTuhY3On.js +352 -0
- package/dist/thread-bindings.discord-api-iGyDtjBI.js +487 -0
- package/dist/threading-7EMTgTsu.js +832 -0
- package/dist/threading-BkydE-cL.js +2 -0
- package/dist/threading-tool-context-C3JbrV_5.js +157 -0
- package/dist/token-wT6DwKaB.js +82 -0
- package/dist/tool-actions.runtime-B5mERIej.js +532 -0
- package/dist/tool-actions.runtime.js +1 -1
- package/dist/tools-effective-inventory-DWXkEygO.js +148 -0
- package/dist/tts.runtime.js +1 -1
- package/dist/ui-CC9JMpg4.js +212 -0
- package/dist/update-BjW3w9eI.js +1253 -0
- package/dist/update-cli-B27tZquO.js +1447 -0
- package/dist/update-runner-BMiyTW62.js +1195 -0
- package/dist/verification-C_ZgAv5v.js +130 -0
- package/dist/verification-DCQ1M0pg.js +2 -0
- package/dist/x-search-Btj7UfUg.js +166 -0
- package/dist/zalo-CnU0tzBl.js +13 -0
- package/dist/zalo-js-InpiWFuE.js +1156 -0
- package/dist/zalouser-CuRMbL4r.js +22 -0
- package/package.json +4 -1
- package/dist/abort-CuFxEr2t.js +0 -192
- package/dist/abort-cutoff.runtime-CU97Q3Ef.js +0 -20
- package/dist/abort.runtime-CZflOJv6.js +0 -2
- package/dist/access-control-CLswIHY1.js +0 -152
- package/dist/account-inspect-DiDpXY0-.js +0 -158
- package/dist/accounts-BwSkt2tm.js +0 -57
- package/dist/accounts-C8c90Uek.js +0 -2
- package/dist/accounts-CiFhbmdr.js +0 -107
- package/dist/accounts-D9Qnnbfl.js +0 -102
- package/dist/accounts-DKwfzzAC.js +0 -137
- package/dist/acp-runtime-CwGef6ZP.js +0 -8
- package/dist/acp-stateful-target-driver-p0EDW10u.js +0 -60
- package/dist/action-runtime-BWY3HXxf.js +0 -318
- package/dist/action-runtime-DNi9yizU.js +0 -72
- package/dist/action-runtime-api-BSPlMrO-.js +0 -1028
- package/dist/actions-MNvlds_S.js +0 -531
- package/dist/actions.runtime--mEwSSNe.js +0 -18
- package/dist/actions.runtime-B1HzEE8Z.js +0 -5
- package/dist/actions.runtime-BG6xvov3.js +0 -2
- package/dist/agent-CGwFOztX.js +0 -2
- package/dist/agent-command-IPMBbUVI.js +0 -1457
- package/dist/agent-runner.runtime-Bzf0jJA9.js +0 -2241
- package/dist/agent-runtime-oVxaAl9G.js +0 -142
- package/dist/agent-tools-login-BIEsXGSl.js +0 -57
- package/dist/agents-CYexVjSC.js +0 -888
- package/dist/agents-DpXXlVMm.js +0 -5
- package/dist/api-B5hYfONF2.js +0 -322
- package/dist/api-CWf7SD_r.js +0 -2
- package/dist/api-CoVu8JQC.js +0 -6
- package/dist/api-D1zC-04H.js +0 -2
- package/dist/api-DAJXC6Eh.js +0 -5
- package/dist/api-DIBiOiU5.js +0 -5
- package/dist/api-DNiO8MKu.js +0 -10
- package/dist/apply-T4gGjbIw.js +0 -485
- package/dist/apply.runtime-BIKyTMdb.js +0 -2
- package/dist/approval-native-PdTPYbWz.js +0 -79
- package/dist/approval-runtime-DQds_bzO.js +0 -262
- package/dist/attachment-normalize-KVBm83XJ.js +0 -921
- package/dist/audit-ClUk-eTw.js +0 -892
- package/dist/audit-NQngcqbL.js +0 -86
- package/dist/audit-channel.collect.runtime-BJlZ1Tqv.js +0 -528
- package/dist/audit-channel.telegram.runtime-CoLwvFcv.js +0 -8
- package/dist/audit-extra.async-B3ODYISl.js +0 -820
- package/dist/audit.deep.runtime-BaiMFfPv.js +0 -2
- package/dist/audit.nondeep.runtime-Cvt1jVHR.js +0 -831
- package/dist/audit.runtime-BOuTTKD4.js +0 -7
- package/dist/auth-BuSqMfLL.js +0 -181
- package/dist/auth-choice-B69NsSNK.js +0 -69
- package/dist/auth-choice-C7dAbZYQ.js +0 -3
- package/dist/auth-choice-ChlvsxHZ.js +0 -341
- package/dist/binding-targets-i1Phu9Ml.js +0 -99
- package/dist/bot-DA6nZ125.js +0 -4268
- package/dist/bot-message-context-4RzAPTiL.js +0 -2
- package/dist/bot-message-context-Bd0CyeDw.js +0 -1175
- package/dist/bot-message-context.runtime-CwPXKJUK.js +0 -7
- package/dist/bot-message-context.session.runtime-C9Qk9RJ2.js +0 -12
- package/dist/bot-native-commands.delivery.runtime-DP3bmRQI.js +0 -3
- package/dist/bot-native-commands.runtime-CIprmHSX.js +0 -11
- package/dist/build-info.json +0 -5
- package/dist/bundled/boot-md/HOOK.md +0 -20
- package/dist/bundled/bootstrap-extra-files/HOOK.md +0 -53
- package/dist/bundled/command-logger/HOOK.md +0 -122
- package/dist/bundled/session-memory/HOOK.md +0 -108
- package/dist/bundled/workflow-summary/HOOK.md +0 -123
- package/dist/canvas-host/a2ui/.bundle.hash +0 -1
- package/dist/canvas-host/a2ui/a2ui.bundle.js +0 -14896
- package/dist/canvas-host/a2ui/index.html +0 -307
- package/dist/channel-5dQinNdH.js +0 -783
- package/dist/channel-7CzQF9TT.js +0 -1135
- package/dist/channel-B4fvHRK-.js +0 -698
- package/dist/channel-B_TyijiN.js +0 -454
- package/dist/channel-Bcj7dCz-.js +0 -208
- package/dist/channel-CAPp1zv2.js +0 -599
- package/dist/channel-CSFDlAzr.js +0 -337
- package/dist/channel-CYMfBONo.js +0 -4976
- package/dist/channel-CkvHjmWG.js +0 -883
- package/dist/channel-CoWCft7t.js +0 -1217
- package/dist/channel-DNTrg5rc.js +0 -1661
- package/dist/channel-Dw5L6ZCL.js +0 -1129
- package/dist/channel-DzPVCd5F.js +0 -361
- package/dist/channel-GiLFmQxZ.js +0 -800
- package/dist/channel-XFvR7Dxh.js +0 -788
- package/dist/channel-inbound-bfoCnYI3.js +0 -30
- package/dist/channel-plugin-resolution-BMT07Y4B.js +0 -144
- package/dist/channel-shared-BNnyz1wC.js +0 -58
- package/dist/channel.runtime-B_dMxh1q.js +0 -125
- package/dist/channel.runtime-B_fR3JCp.js +0 -335
- package/dist/channel.runtime-BhQ_73jj.js +0 -14
- package/dist/channel.runtime-CDgrnVP6.js +0 -108
- package/dist/channel.runtime-DPFtjm6K.js +0 -309
- package/dist/channel.runtime-DigoZ45U.js +0 -80
- package/dist/channel.runtime-IHt2hi0h.js +0 -22252
- package/dist/channel.runtime-M3E3w35V.js +0 -373
- package/dist/channel.setup-CQIfV874.js +0 -279
- package/dist/channels-PlRayWHp.js +0 -1134
- package/dist/channels-cli-B4MObWHe.js +0 -246
- package/dist/clawhub-UfARocx9.js +0 -163
- package/dist/cli-B7qV90_y.js +0 -152
- package/dist/cli-DoYOPf2E.js +0 -695
- package/dist/cli-migration-7qu0VuUR.js +0 -100
- package/dist/cli-runner-C1qdQ4P5.js +0 -1014
- package/dist/cli-startup-metadata.json +0 -14
- package/dist/client-bootstrap-Bf-VJF8o.js +0 -2
- package/dist/client-bootstrap-BtDC_ghW.js +0 -121
- package/dist/client-c8NPFdV6.js +0 -7
- package/dist/client-xBBbf9T_.js +0 -5
- package/dist/code-execution-IwkUcM9K.js +0 -142
- package/dist/command-auth-CDvEQqI-.js +0 -64
- package/dist/command-registry-1pRI9W0V.js +0 -3
- package/dist/command-registry-Dr8xswzu.js +0 -199
- package/dist/commands-B7zoPsaq.js +0 -4
- package/dist/commands-acp-_0Jt7bpI.js +0 -990
- package/dist/commands-core-B2PxYebU.js +0 -241
- package/dist/commands-core.runtime-Bk-kMe8I.js +0 -2
- package/dist/commands-handlers.runtime-Dp-fdvyC.js +0 -3708
- package/dist/commands-info-CM-kPvq5.js +0 -651
- package/dist/commands-models-B_KkCnYQ.js +0 -395
- package/dist/commands-status.runtime-B7xG5l06.js +0 -2
- package/dist/commands.runtime-DTcg2ygT.js +0 -4
- package/dist/compact.runtime-C-TOc6On.js +0 -7
- package/dist/completion-cli-DYyVmY2G.js +0 -466
- package/dist/completion-cli-IsVueMzq.js +0 -2
- package/dist/config-DgES7wDO.js +0 -475
- package/dist/config-cli-B-FLvmji.js +0 -945
- package/dist/config-guard-DolG9Hb3.js +0 -113
- package/dist/config-runtime-DOU6nuit.js +0 -13
- package/dist/config-secret-input.runtime-D8uisXyK.js +0 -3
- package/dist/config-update-6NzLhzi0.js +0 -3
- package/dist/config-update-DvNp6OTj.js +0 -127
- package/dist/configure-BMLNn-t4.js +0 -1140
- package/dist/configure-Ce061vUB.js +0 -2
- package/dist/context-B_IskqEg.js +0 -227
- package/dist/control-ui/apple-touch-icon.png +0 -0
- package/dist/control-ui/assets/agents-CouEImnJ.js +0 -813
- package/dist/control-ui/assets/anthropic-D2gWjM8y.js +0 -37
- package/dist/control-ui/assets/azure-openai-responses-rSA0t6IS.js +0 -2
- package/dist/control-ui/assets/channel-config-extras-DNCeHtEf.js +0 -2
- package/dist/control-ui/assets/channels-BgJBIl8z.js +0 -349
- package/dist/control-ui/assets/cron-CESIxOYW.js +0 -928
- package/dist/control-ui/assets/de-DU-XmSEb.js +0 -2
- package/dist/control-ui/assets/debug-BAZT8Cur.js +0 -94
- package/dist/control-ui/assets/directive-C6NBp6xJ.js +0 -2
- package/dist/control-ui/assets/dist-D8DZLmCF.js +0 -18
- package/dist/control-ui/assets/es-Be891ZDf.js +0 -2
- package/dist/control-ui/assets/event-stream-B8X6sYaV.js +0 -2
- package/dist/control-ui/assets/format-nUIQxx1z.js +0 -2
- package/dist/control-ui/assets/github-copilot-headers-CrI0CIJ7.js +0 -2
- package/dist/control-ui/assets/google-B2pGWEiN.js +0 -2
- package/dist/control-ui/assets/google-gemini-cli-BpxbH95Q.js +0 -3
- package/dist/control-ui/assets/google-shared-CbPHVnPr.js +0 -12
- package/dist/control-ui/assets/google-vertex-lQwbjEII.js +0 -2
- package/dist/control-ui/assets/hash-Bt1aVMQ3.js +0 -2
- package/dist/control-ui/assets/index-C0UxQzEn.js +0 -4813
- package/dist/control-ui/assets/index-DOMg2RvO.css +0 -1
- package/dist/control-ui/assets/instances-ClbVvaQy.js +0 -57
- package/dist/control-ui/assets/lit-zdTgzAJI.js +0 -3
- package/dist/control-ui/assets/logs-vVeVJ0CI.js +0 -74
- package/dist/control-ui/assets/mistral-imHzDZ_7.js +0 -8
- package/dist/control-ui/assets/nodes-CeaJKODa.js +0 -430
- package/dist/control-ui/assets/openai-Cn7eGqwa.js +0 -17
- package/dist/control-ui/assets/openai-codex-responses-DRaOkrRO.js +0 -8
- package/dist/control-ui/assets/openai-completions-0yOZERna.js +0 -6
- package/dist/control-ui/assets/openai-responses-8vqADgIw.js +0 -2
- package/dist/control-ui/assets/openai-responses-shared-Q7jopnLp.js +0 -11
- package/dist/control-ui/assets/preload-helper-xBbMyY7u.js +0 -1
- package/dist/control-ui/assets/pt-BR-RqwUvKTB.js +0 -2
- package/dist/control-ui/assets/sessions-CiBN6LBg.js +0 -236
- package/dist/control-ui/assets/skills-shared-DJsJP4-4.js +0 -11
- package/dist/control-ui/assets/skills-yhlO3Ote.js +0 -216
- package/dist/control-ui/assets/transform-messages-XKqwKV3D.js +0 -2
- package/dist/control-ui/assets/zh-CN-CUzhgfRs.js +0 -2
- package/dist/control-ui/assets/zh-TW-CCgwa2eS.js +0 -2
- package/dist/control-ui/favicon-32.png +0 -0
- package/dist/control-ui/favicon.ico +0 -0
- package/dist/control-ui/favicon.svg +0 -66
- package/dist/control-ui/index.html +0 -75
- package/dist/conversation-bindings-BWn8Eq0t.js +0 -210
- package/dist/conversation-id-CIpyn-VD.js +0 -168
- package/dist/conversation-runtime-BpJdJqei.js +0 -85
- package/dist/core-BsdZRsb0.js +0 -195
- package/dist/create-client-HZBJ7-Fl.js +0 -2
- package/dist/create-client-WqOz1ro_.js +0 -58
- package/dist/credentials-5vTiF-oK.js +0 -22
- package/dist/credentials-write.runtime-3bouyp8U.js +0 -9
- package/dist/crypto-runtime-DirRLBDM.js +0 -3495
- package/dist/daemon-cli-AJpZY4sn.js +0 -383
- package/dist/daemon-install-FZTHcBaU.js +0 -63
- package/dist/delegate-BaC3I_I2.js +0 -43
- package/dist/deliver-BaDjGKa4.js +0 -3
- package/dist/deliver-CWBM3uFK.js +0 -954
- package/dist/deliver-reply-B1lULS4T.js +0 -238
- package/dist/deliver-runtime-C9wPhPVo.js +0 -2
- package/dist/delivery-info-UablM7m8.js +0 -40
- package/dist/delivery-jNAx1UXj.js +0 -834
- package/dist/direct-dm-BOWirToy.js +0 -139
- package/dist/direct-management-D7iGx6GI.js +0 -300
- package/dist/direct-management-DmQUf3My.js +0 -2
- package/dist/directive-handling.fast-lane-BgUe6rBZ.js +0 -64
- package/dist/directive-handling.fast-lane-C__EV2OZ.js +0 -2
- package/dist/directive-handling.impl-D466FFH9.js +0 -672
- package/dist/directive-handling.impl-tl3nNkjQ.js +0 -2
- package/dist/directive-handling.parse-H-NqZbGQ.js +0 -375
- package/dist/directive-handling.persist-D-TH7X00.js +0 -133
- package/dist/directive-handling.persist.runtime-CKzh0FFl.js +0 -2
- package/dist/directive-handling.shared-CMdDhj2s.js +0 -158
- package/dist/directory-cli-BkFOqvau.js +0 -238
- package/dist/directory.static-CWHw_6bd.js +0 -45
- package/dist/discovery-CmDmBzyt.js +0 -171
- package/dist/dispatch-5P8XNY-z.js +0 -858
- package/dist/dispatch-acp.runtime-BXLlUo6a.js +0 -884
- package/dist/doctor-completion-C-PtqnX4.js +0 -90
- package/dist/doctor-config-preflight--G_zFI_P.js +0 -148
- package/dist/doctor-config-preflight-Cgmj0J2d.js +0 -2
- package/dist/doctor-state-migrations-B4vgkpe8.js +0 -3
- package/dist/doctor-state-migrations-R3EnGfXE.js +0 -2
- package/dist/embedding-provider-DllEP1OZ.js +0 -129
- package/dist/encryption-guidance-DDwXFxqS.js +0 -33
- package/dist/error-text-C4BdRT0b.js +0 -24
- package/dist/exec-approval-session-target-BpHDdAt6.js +0 -159
- package/dist/exec-approvals-Lpud2QXU.js +0 -121
- package/dist/export-html/template.css +0 -1060
- package/dist/export-html/template.html +0 -88
- package/dist/export-html/template.js +0 -1875
- package/dist/export-html/vendor/highlight.min.js +0 -1213
- package/dist/export-html/vendor/marked.min.js +0 -6
- package/dist/format-CerBTToC.js +0 -817
- package/dist/gateway-BuNsK2ll.js +0 -2575
- package/dist/gateway-cli-WL9O_amN.js +0 -1596
- package/dist/gateway-install-token-DBjV7vuQ.js +0 -230
- package/dist/get-reply-from-config.runtime-Ci2UvY3-.js +0 -2
- package/dist/gmail-watcher-lifecycle-BE_4dMST.js +0 -2
- package/dist/graph-users-CGePGfzI.js +0 -918
- package/dist/group-access-D9zxJ9Eg.js +0 -119
- package/dist/group-access-qaCYNF5W.js +0 -32
- package/dist/handle-action-CqjxOWwH.js +0 -500
- package/dist/health-Ckh-98zt.js +0 -577
- package/dist/health-Dte2hwwy.js +0 -2
- package/dist/heartbeat-runner-BSkqJHkl.js +0 -995
- package/dist/hooks-cli-5qH5guhQ.js +0 -353
- package/dist/http-client-E-AK0hBj.js +0 -294
- package/dist/image-Dflgshq4.js +0 -152
- package/dist/image-runtime-C8N4pHiL.js +0 -7
- package/dist/inbound-reply-dispatch-DnSGPONh.js +0 -73
- package/dist/inbound.runtime-CSV1NzQc.js +0 -3
- package/dist/infra-runtime-B0CHuzrJ.js +0 -22
- package/dist/install-security-scan-pEC-BNIh.js +0 -22
- package/dist/install-security-scan.runtime-KtCBz8Ms.js +0 -299
- package/dist/install-slQpgebI.js +0 -590
- package/dist/install.runtime-BDKuVJIa.js +0 -27
- package/dist/install.runtime-Cdb5F3uW.js +0 -11
- package/dist/irc-CWidrqqa.js +0 -14
- package/dist/legacy-crypto-restore-DrVtd4-4.js +0 -85
- package/dist/library-CmpBsnzV.js +0 -44
- package/dist/llm-slug-generator-5ztca3GP.js +0 -68
- package/dist/loader-BOVnpEv5.js +0 -2
- package/dist/login-I8HWXek2.js +0 -108
- package/dist/login-Xx8YN-Ut.js +0 -2332
- package/dist/login-qr-AEmAM7Qe.js +0 -211
- package/dist/login-qr-api-BSW8Ta-A.js +0 -16
- package/dist/manager.runtime-DpPqh8fu.js +0 -670
- package/dist/matrix-CVj94cvn.js +0 -351
- package/dist/matrix-runtime-heavy-n2o8hviY.js +0 -4
- package/dist/mattermost-D0PPzHDR.js +0 -18
- package/dist/media-CS8BGM6_.js +0 -1691
- package/dist/media-runtime-CzcnSxHP.js +0 -295
- package/dist/media-understanding-6pmWMadX.js +0 -51
- package/dist/media-understanding-provider--2czf2Xl.js +0 -16
- package/dist/media-understanding-provider-1v3aAmph.js +0 -17
- package/dist/media-understanding-provider-Bo02B0WG.js +0 -16
- package/dist/media-understanding-provider-C1e568I5.js +0 -86
- package/dist/media-understanding-provider-DftOn7qM.js +0 -28
- package/dist/media-understanding-provider-JfEcvB6a.js +0 -11
- package/dist/media-understanding-provider-Zvb9Fi0L.js +0 -11
- package/dist/media-understanding-provider-fpeKUYrh.js +0 -11
- package/dist/media-understanding.runtime-CBg9Myvx.js +0 -7
- package/dist/message-DTcLbUjJ.js +0 -206
- package/dist/message-action-runner-Nkrb1psP.js +0 -1330
- package/dist/message-handler-ozmV6rws.js +0 -1771
- package/dist/messages-W3Tl9C55.js +0 -270
- package/dist/migration-snapshot.runtime-CBx6_nXj.js +0 -3
- package/dist/model-catalog-BdRYqKL1.js +0 -216
- package/dist/model-catalog.runtime--yFOIYWV.js +0 -2
- package/dist/model-picker-Cgjw3ytp.js +0 -3
- package/dist/model-picker-jZueDrUL.js +0 -439
- package/dist/model-runtime-51DWArDE.js +0 -1772
- package/dist/model-selection-BohZPMIS.js +0 -407
- package/dist/models-By72Z6_k.js +0 -2550
- package/dist/models-Dgkh71VB.js +0 -3
- package/dist/models-cli-6ZWkpdCu.js +0 -197
- package/dist/models-config-C4DcwiKp.js +0 -2
- package/dist/models-config-CMbP7C_L.js +0 -1106
- package/dist/models-config.runtime-Chha_CyE.js +0 -2
- package/dist/models-provider-runtime-Bu0Agcak.js +0 -2
- package/dist/monitor-B7gDwViK.js +0 -3622
- package/dist/monitor-BE6u7xIu.js +0 -1525
- package/dist/monitor-BRMbIrFT.js +0 -3660
- package/dist/monitor-COLTfgXl.js +0 -676
- package/dist/monitor-CvHGVZmI.js +0 -4067
- package/dist/monitor-DB9RduAn.js +0 -687
- package/dist/monitor-DL7WkrAh.js +0 -666
- package/dist/monitor-auth-EM0izKiw.js +0 -192
- package/dist/monitor-polling.runtime-DFWDyq0r.js +0 -307
- package/dist/monitor-provider-BCduxzuC.js +0 -1782
- package/dist/monitor-webhook.runtime-66MaZoy1.js +0 -297
- package/dist/msteams-DfVsNAAv.js +0 -33
- package/dist/nextcloud-talk-DzdSPp33.js +0 -18
- package/dist/nostr-CA9Nyz3w.js +0 -19
- package/dist/notify-C6g-CT-E.js +0 -298
- package/dist/oauth-0jEycYdH.js +0 -152
- package/dist/onboard-BBY0wtI-.js +0 -591
- package/dist/onboard-BJZUne8W.js +0 -307
- package/dist/onboard-channels-2M_l-yYq.js +0 -705
- package/dist/onboard-channels-B8fOn_J8.js +0 -2
- package/dist/onboard-custom-BQxH-LlD.js +0 -646
- package/dist/onboard-custom-BXJFm5tv.js +0 -2
- package/dist/onboard-helpers-DAmUY5cA.js +0 -228
- package/dist/onboard-helpers-DalDwXjg.js +0 -4
- package/dist/onboard-remote-CAS2F09D.js +0 -2
- package/dist/onboard-remote-nfFOhKzl.js +0 -193
- package/dist/onboard-skills-CH4ZsJr7.js +0 -2
- package/dist/onboard-skills-DSYZC5D0.js +0 -134
- package/dist/openai-codex-provider-B_8TNnmh.js +0 -254
- package/dist/openai-provider-CwnYhA5Q.js +0 -272
- package/dist/openclaw-tools.runtime-1mX4RgUb.js +0 -2
- package/dist/outbound-adapter-DDaf1Qmt.js +0 -183
- package/dist/outbound-session-XCEG44pM.js +0 -41
- package/dist/persistent-bindings.lifecycle-CC1LNlZw.js +0 -159
- package/dist/pi-embedded-B2zIKehU.js +0 -40738
- package/dist/pi-embedded.runtime-tIoF88cE.js +0 -4
- package/dist/plugin-install-CqzqZMog.js +0 -230
- package/dist/plugin-install-P8ACZKV4.js +0 -2
- package/dist/plugin-install-config-policy-CWxlz2Uf.js +0 -93
- package/dist/plugin-install-plan-D2X3sbgg.js +0 -50
- package/dist/plugin-sdk/account-core.d.ts +0 -1
- package/dist/plugin-sdk/account-helpers.d.ts +0 -1
- package/dist/plugin-sdk/account-id.d.ts +0 -1
- package/dist/plugin-sdk/account-resolution.d.ts +0 -1
- package/dist/plugin-sdk/acp-runtime.d.ts +0 -1
- package/dist/plugin-sdk/agent-config-primitives.d.ts +0 -1
- package/dist/plugin-sdk/agent-runtime.d.ts +0 -1
- package/dist/plugin-sdk/allow-from.d.ts +0 -1
- package/dist/plugin-sdk/allowlist-config-edit.d.ts +0 -1
- package/dist/plugin-sdk/amazon-bedrock.d.ts +0 -1
- package/dist/plugin-sdk/anthropic-vertex.d.ts +0 -1
- package/dist/plugin-sdk/approval-runtime.d.ts +0 -1
- package/dist/plugin-sdk/bluebubbles-policy.d.ts +0 -1
- package/dist/plugin-sdk/bluebubbles.d.ts +0 -1
- package/dist/plugin-sdk/boolean-param.d.ts +0 -1
- package/dist/plugin-sdk/browser-runtime.d.ts +0 -1
- package/dist/plugin-sdk/browser-support.d.ts +0 -1
- package/dist/plugin-sdk/browser.d.ts +0 -1
- package/dist/plugin-sdk/byteplus.d.ts +0 -1
- package/dist/plugin-sdk/channel-actions.d.ts +0 -1
- package/dist/plugin-sdk/channel-config-helpers.d.ts +0 -1
- package/dist/plugin-sdk/channel-config-primitives.d.ts +0 -1
- package/dist/plugin-sdk/channel-config-schema.d.ts +0 -1
- package/dist/plugin-sdk/channel-config-writes.d.ts +0 -1
- package/dist/plugin-sdk/channel-contract.d.ts +0 -1
- package/dist/plugin-sdk/channel-feedback.d.ts +0 -1
- package/dist/plugin-sdk/channel-inbound.d.ts +0 -1
- package/dist/plugin-sdk/channel-lifecycle.d.ts +0 -1
- package/dist/plugin-sdk/channel-pairing.d.ts +0 -1
- package/dist/plugin-sdk/channel-policy.d.ts +0 -1
- package/dist/plugin-sdk/channel-reply-pipeline.d.ts +0 -1
- package/dist/plugin-sdk/channel-runtime.d.ts +0 -1
- package/dist/plugin-sdk/channel-send-result.d.ts +0 -1
- package/dist/plugin-sdk/channel-setup.d.ts +0 -1
- package/dist/plugin-sdk/channel-status.d.ts +0 -1
- package/dist/plugin-sdk/channel-targets.d.ts +0 -1
- package/dist/plugin-sdk/chutes.d.ts +0 -1
- package/dist/plugin-sdk/cli-backend.d.ts +0 -1
- package/dist/plugin-sdk/cli-runtime.d.ts +0 -1
- package/dist/plugin-sdk/cloudflare-ai-gateway.d.ts +0 -1
- package/dist/plugin-sdk/collection-runtime.d.ts +0 -1
- package/dist/plugin-sdk/command-auth-native.d.ts +0 -1
- package/dist/plugin-sdk/command-auth.d.ts +0 -1
- package/dist/plugin-sdk/command-detection.d.ts +0 -1
- package/dist/plugin-sdk/command-surface.d.ts +0 -1
- package/dist/plugin-sdk/compat.d.ts +0 -1
- package/dist/plugin-sdk/config-runtime.d.ts +0 -1
- package/dist/plugin-sdk/conversation-runtime.d.ts +0 -1
- package/dist/plugin-sdk/core.d.ts +0 -1
- package/dist/plugin-sdk/dangerous-name-runtime.d.ts +0 -1
- package/dist/plugin-sdk/deepseek.d.ts +0 -1
- package/dist/plugin-sdk/device-bootstrap.d.ts +0 -1
- package/dist/plugin-sdk/diagnostic-runtime.d.ts +0 -1
- package/dist/plugin-sdk/diagnostics-otel.d.ts +0 -1
- package/dist/plugin-sdk/diffs.d.ts +0 -1
- package/dist/plugin-sdk/direct-dm.d.ts +0 -1
- package/dist/plugin-sdk/directory-runtime.d.ts +0 -1
- package/dist/plugin-sdk/discord-account.d.ts +0 -1
- package/dist/plugin-sdk/discord-core.d.ts +0 -1
- package/dist/plugin-sdk/discord-runtime-surface.d.ts +0 -1
- package/dist/plugin-sdk/discord-session-key.d.ts +0 -1
- package/dist/plugin-sdk/discord-surface.d.ts +0 -1
- package/dist/plugin-sdk/discord-thread-bindings.d.ts +0 -1
- package/dist/plugin-sdk/discord-timeouts.d.ts +0 -1
- package/dist/plugin-sdk/discord.d.ts +0 -1
- package/dist/plugin-sdk/error-runtime.d.ts +0 -1
- package/dist/plugin-sdk/extension-shared.d.ts +0 -1
- package/dist/plugin-sdk/extensions/anthropic/api.d.ts +0 -2
- package/dist/plugin-sdk/extensions/anthropic/cli-shared.d.ts +0 -8
- package/dist/plugin-sdk/extensions/anthropic/stream-wrappers.d.ts +0 -12
- package/dist/plugin-sdk/extensions/bluebubbles/api.d.ts +0 -5
- package/dist/plugin-sdk/extensions/bluebubbles/src/account-resolve.d.ts +0 -13
- package/dist/plugin-sdk/extensions/bluebubbles/src/accounts.d.ts +0 -17
- package/dist/plugin-sdk/extensions/bluebubbles/src/actions.d.ts +0 -2
- package/dist/plugin-sdk/extensions/bluebubbles/src/actions.runtime.d.ts +0 -19
- package/dist/plugin-sdk/extensions/bluebubbles/src/attachments.d.ts +0 -34
- package/dist/plugin-sdk/extensions/bluebubbles/src/channel-shared.d.ts +0 -49
- package/dist/plugin-sdk/extensions/bluebubbles/src/channel.d.ts +0 -4
- package/dist/plugin-sdk/extensions/bluebubbles/src/channel.runtime.d.ts +0 -13
- package/dist/plugin-sdk/extensions/bluebubbles/src/chat.d.ts +0 -48
- package/dist/plugin-sdk/extensions/bluebubbles/src/config-apply.d.ts +0 -15
- package/dist/plugin-sdk/extensions/bluebubbles/src/config-schema.d.ts +0 -76
- package/dist/plugin-sdk/extensions/bluebubbles/src/config-ui-hints.d.ts +0 -10
- package/dist/plugin-sdk/extensions/bluebubbles/src/conversation-bindings.d.ts +0 -37
- package/dist/plugin-sdk/extensions/bluebubbles/src/conversation-id.d.ts +0 -18
- package/dist/plugin-sdk/extensions/bluebubbles/src/conversation-route.d.ts +0 -12
- package/dist/plugin-sdk/extensions/bluebubbles/src/group-policy.d.ts +0 -14
- package/dist/plugin-sdk/extensions/bluebubbles/src/history.d.ts +0 -40
- package/dist/plugin-sdk/extensions/bluebubbles/src/local-file-access.d.ts +0 -2
- package/dist/plugin-sdk/extensions/bluebubbles/src/media-send.d.ts +0 -14
- package/dist/plugin-sdk/extensions/bluebubbles/src/monitor-debounce.d.ts +0 -22
- package/dist/plugin-sdk/extensions/bluebubbles/src/monitor-normalize.d.ts +0 -77
- package/dist/plugin-sdk/extensions/bluebubbles/src/monitor-processing.d.ts +0 -5
- package/dist/plugin-sdk/extensions/bluebubbles/src/monitor-reply-cache.d.ts +0 -36
- package/dist/plugin-sdk/extensions/bluebubbles/src/monitor-self-chat-cache.d.ts +0 -15
- package/dist/plugin-sdk/extensions/bluebubbles/src/monitor-shared.d.ts +0 -31
- package/dist/plugin-sdk/extensions/bluebubbles/src/monitor.d.ts +0 -8
- package/dist/plugin-sdk/extensions/bluebubbles/src/multipart.d.ts +0 -10
- package/dist/plugin-sdk/extensions/bluebubbles/src/participant-contact-names.d.ts +0 -28
- package/dist/plugin-sdk/extensions/bluebubbles/src/probe.d.ts +0 -53
- package/dist/plugin-sdk/extensions/bluebubbles/src/reactions.d.ts +0 -17
- package/dist/plugin-sdk/extensions/bluebubbles/src/request-url.d.ts +0 -1
- package/dist/plugin-sdk/extensions/bluebubbles/src/runtime-api.d.ts +0 -28
- package/dist/plugin-sdk/extensions/bluebubbles/src/runtime.d.ts +0 -6
- package/dist/plugin-sdk/extensions/bluebubbles/src/secret-input.d.ts +0 -1
- package/dist/plugin-sdk/extensions/bluebubbles/src/send-helpers.d.ts +0 -3
- package/dist/plugin-sdk/extensions/bluebubbles/src/send.d.ts +0 -45
- package/dist/plugin-sdk/extensions/bluebubbles/src/session-route.d.ts +0 -2
- package/dist/plugin-sdk/extensions/bluebubbles/src/setup-core.d.ts +0 -4
- package/dist/plugin-sdk/extensions/bluebubbles/src/setup-surface.d.ts +0 -4
- package/dist/plugin-sdk/extensions/bluebubbles/src/targets.d.ts +0 -45
- package/dist/plugin-sdk/extensions/bluebubbles/src/types.d.ts +0 -121
- package/dist/plugin-sdk/extensions/bluebubbles/src/webhook-shared.d.ts +0 -5
- package/dist/plugin-sdk/extensions/browser/runtime-api.d.ts +0 -7
- package/dist/plugin-sdk/extensions/browser/src/browser/bridge-auth-registry.d.ts +0 -8
- package/dist/plugin-sdk/extensions/browser/src/browser/bridge-server.d.ts +0 -24
- package/dist/plugin-sdk/extensions/browser/src/browser/cdp-proxy-bypass.d.ts +0 -31
- package/dist/plugin-sdk/extensions/browser/src/browser/cdp-timeouts.d.ts +0 -28
- package/dist/plugin-sdk/extensions/browser/src/browser/cdp.d.ts +0 -125
- package/dist/plugin-sdk/extensions/browser/src/browser/cdp.helpers.d.ts +0 -29
- package/dist/plugin-sdk/extensions/browser/src/browser/chrome-mcp.d.ts +0 -127
- package/dist/plugin-sdk/extensions/browser/src/browser/chrome-mcp.snapshot.d.ts +0 -26
- package/dist/plugin-sdk/extensions/browser/src/browser/chrome.d.ts +0 -26
- package/dist/plugin-sdk/extensions/browser/src/browser/chrome.executables.d.ts +0 -15
- package/dist/plugin-sdk/extensions/browser/src/browser/chrome.profile-decoration.d.ts +0 -10
- package/dist/plugin-sdk/extensions/browser/src/browser/client-actions-core.d.ts +0 -159
- package/dist/plugin-sdk/extensions/browser/src/browser/client-actions-observe.d.ts +0 -68
- package/dist/plugin-sdk/extensions/browser/src/browser/client-actions-state.d.ts +0 -93
- package/dist/plugin-sdk/extensions/browser/src/browser/client-actions-types.d.ts +0 -18
- package/dist/plugin-sdk/extensions/browser/src/browser/client-actions-url.d.ts +0 -2
- package/dist/plugin-sdk/extensions/browser/src/browser/client-actions.d.ts +0 -4
- package/dist/plugin-sdk/extensions/browser/src/browser/client-fetch.d.ts +0 -21
- package/dist/plugin-sdk/extensions/browser/src/browser/client.d.ts +0 -157
- package/dist/plugin-sdk/extensions/browser/src/browser/config-refresh-source.d.ts +0 -2
- package/dist/plugin-sdk/extensions/browser/src/browser/config.d.ts +0 -46
- package/dist/plugin-sdk/extensions/browser/src/browser/constants.d.ts +0 -8
- package/dist/plugin-sdk/extensions/browser/src/browser/control-auth.d.ts +0 -13
- package/dist/plugin-sdk/extensions/browser/src/browser/control-service.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/browser/csrf.d.ts +0 -8
- package/dist/plugin-sdk/extensions/browser/src/browser/errors.d.ts +0 -35
- package/dist/plugin-sdk/extensions/browser/src/browser/form-fields.d.ts +0 -8
- package/dist/plugin-sdk/extensions/browser/src/browser/http-auth.d.ts +0 -5
- package/dist/plugin-sdk/extensions/browser/src/browser/navigation-guard.d.ts +0 -30
- package/dist/plugin-sdk/extensions/browser/src/browser/output-atomic.d.ts +0 -5
- package/dist/plugin-sdk/extensions/browser/src/browser/paths.d.ts +0 -61
- package/dist/plugin-sdk/extensions/browser/src/browser/profile-capabilities.d.ts +0 -30
- package/dist/plugin-sdk/extensions/browser/src/browser/profiles-service.d.ts +0 -28
- package/dist/plugin-sdk/extensions/browser/src/browser/profiles.d.ts +0 -30
- package/dist/plugin-sdk/extensions/browser/src/browser/proxy-files.d.ts +0 -7
- package/dist/plugin-sdk/extensions/browser/src/browser/pw-ai-module.d.ts +0 -6
- package/dist/plugin-sdk/extensions/browser/src/browser/pw-ai-state.d.ts +0 -2
- package/dist/plugin-sdk/extensions/browser/src/browser/pw-ai.d.ts +0 -2
- package/dist/plugin-sdk/extensions/browser/src/browser/pw-role-snapshot.d.ts +0 -35
- package/dist/plugin-sdk/extensions/browser/src/browser/pw-session.d.ts +0 -182
- package/dist/plugin-sdk/extensions/browser/src/browser/pw-session.page-cdp.d.ts +0 -9
- package/dist/plugin-sdk/extensions/browser/src/browser/pw-tools-core.activity.d.ts +0 -21
- package/dist/plugin-sdk/extensions/browser/src/browser/pw-tools-core.d.ts +0 -8
- package/dist/plugin-sdk/extensions/browser/src/browser/pw-tools-core.downloads.d.ts +0 -34
- package/dist/plugin-sdk/extensions/browser/src/browser/pw-tools-core.interactions.d.ts +0 -135
- package/dist/plugin-sdk/extensions/browser/src/browser/pw-tools-core.responses.d.ts +0 -13
- package/dist/plugin-sdk/extensions/browser/src/browser/pw-tools-core.shared.d.ts +0 -10
- package/dist/plugin-sdk/extensions/browser/src/browser/pw-tools-core.snapshot.d.ts +0 -66
- package/dist/plugin-sdk/extensions/browser/src/browser/pw-tools-core.state.d.ts +0 -46
- package/dist/plugin-sdk/extensions/browser/src/browser/pw-tools-core.storage.d.ts +0 -47
- package/dist/plugin-sdk/extensions/browser/src/browser/pw-tools-core.trace.d.ts +0 -12
- package/dist/plugin-sdk/extensions/browser/src/browser/request-policy.d.ts +0 -9
- package/dist/plugin-sdk/extensions/browser/src/browser/resolved-config-refresh.d.ts +0 -12
- package/dist/plugin-sdk/extensions/browser/src/browser/routes/agent.act.d.ts +0 -3
- package/dist/plugin-sdk/extensions/browser/src/browser/routes/agent.act.download.d.ts +0 -3
- package/dist/plugin-sdk/extensions/browser/src/browser/routes/agent.act.hooks.d.ts +0 -3
- package/dist/plugin-sdk/extensions/browser/src/browser/routes/agent.act.shared.d.ts +0 -10
- package/dist/plugin-sdk/extensions/browser/src/browser/routes/agent.d.ts +0 -3
- package/dist/plugin-sdk/extensions/browser/src/browser/routes/agent.debug.d.ts +0 -3
- package/dist/plugin-sdk/extensions/browser/src/browser/routes/agent.shared.d.ts +0 -37
- package/dist/plugin-sdk/extensions/browser/src/browser/routes/agent.snapshot.d.ts +0 -12
- package/dist/plugin-sdk/extensions/browser/src/browser/routes/agent.snapshot.plan.d.ts +0 -22
- package/dist/plugin-sdk/extensions/browser/src/browser/routes/agent.storage.d.ts +0 -14
- package/dist/plugin-sdk/extensions/browser/src/browser/routes/basic.d.ts +0 -3
- package/dist/plugin-sdk/extensions/browser/src/browser/routes/dispatcher.d.ts +0 -16
- package/dist/plugin-sdk/extensions/browser/src/browser/routes/index.d.ts +0 -3
- package/dist/plugin-sdk/extensions/browser/src/browser/routes/output-paths.d.ts +0 -10
- package/dist/plugin-sdk/extensions/browser/src/browser/routes/path-output.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/browser/routes/tabs.d.ts +0 -3
- package/dist/plugin-sdk/extensions/browser/src/browser/routes/types.d.ts +0 -20
- package/dist/plugin-sdk/extensions/browser/src/browser/routes/utils.d.ts +0 -15
- package/dist/plugin-sdk/extensions/browser/src/browser/runtime-lifecycle.d.ts +0 -15
- package/dist/plugin-sdk/extensions/browser/src/browser/safe-filename.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/browser/screenshot.d.ts +0 -9
- package/dist/plugin-sdk/extensions/browser/src/browser/server-context.availability.d.ts +0 -19
- package/dist/plugin-sdk/extensions/browser/src/browser/server-context.constants.d.ts +0 -7
- package/dist/plugin-sdk/extensions/browser/src/browser/server-context.d.ts +0 -4
- package/dist/plugin-sdk/extensions/browser/src/browser/server-context.reset.d.ts +0 -20
- package/dist/plugin-sdk/extensions/browser/src/browser/server-context.selection.d.ts +0 -16
- package/dist/plugin-sdk/extensions/browser/src/browser/server-context.tab-ops.d.ts +0 -13
- package/dist/plugin-sdk/extensions/browser/src/browser/server-context.types.d.ts +0 -74
- package/dist/plugin-sdk/extensions/browser/src/browser/server-lifecycle.d.ts +0 -10
- package/dist/plugin-sdk/extensions/browser/src/browser/server-middleware.d.ts +0 -6
- package/dist/plugin-sdk/extensions/browser/src/browser/session-tab-registry.d.ts +0 -30
- package/dist/plugin-sdk/extensions/browser/src/browser/snapshot-roles.d.ts +0 -11
- package/dist/plugin-sdk/extensions/browser/src/browser/target-id.d.ts +0 -11
- package/dist/plugin-sdk/extensions/browser/src/browser/trash.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/browser/url-pattern.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/browser-runtime.d.ts +0 -28
- package/dist/plugin-sdk/extensions/browser/src/browser-tool.actions.d.ts +0 -44
- package/dist/plugin-sdk/extensions/browser/src/browser-tool.d.ts +0 -30
- package/dist/plugin-sdk/extensions/browser/src/browser-tool.schema.d.ts +0 -75
- package/dist/plugin-sdk/extensions/browser/src/cli/browser-cli-actions-input/register.d.ts +0 -3
- package/dist/plugin-sdk/extensions/browser/src/cli/browser-cli-actions-input/register.element.d.ts +0 -3
- package/dist/plugin-sdk/extensions/browser/src/cli/browser-cli-actions-input/register.files-downloads.d.ts +0 -3
- package/dist/plugin-sdk/extensions/browser/src/cli/browser-cli-actions-input/register.form-wait-eval.d.ts +0 -3
- package/dist/plugin-sdk/extensions/browser/src/cli/browser-cli-actions-input/register.navigation.d.ts +0 -3
- package/dist/plugin-sdk/extensions/browser/src/cli/browser-cli-actions-input/shared.d.ts +0 -20
- package/dist/plugin-sdk/extensions/browser/src/cli/browser-cli-actions-input.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/cli/browser-cli-actions-observe.d.ts +0 -3
- package/dist/plugin-sdk/extensions/browser/src/cli/browser-cli-debug.d.ts +0 -3
- package/dist/plugin-sdk/extensions/browser/src/cli/browser-cli-examples.d.ts +0 -2
- package/dist/plugin-sdk/extensions/browser/src/cli/browser-cli-inspect.d.ts +0 -3
- package/dist/plugin-sdk/extensions/browser/src/cli/browser-cli-manage.d.ts +0 -3
- package/dist/plugin-sdk/extensions/browser/src/cli/browser-cli-resize.d.ts +0 -10
- package/dist/plugin-sdk/extensions/browser/src/cli/browser-cli-shared.d.ts +0 -24
- package/dist/plugin-sdk/extensions/browser/src/cli/browser-cli-state.cookies-storage.d.ts +0 -3
- package/dist/plugin-sdk/extensions/browser/src/cli/browser-cli-state.d.ts +0 -3
- package/dist/plugin-sdk/extensions/browser/src/cli/browser-cli.d.ts +0 -2
- package/dist/plugin-sdk/extensions/browser/src/cli/command-format.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/cli/core-api.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/config/config.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/config/paths.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/config/port-defaults.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/control-service.d.ts +0 -5
- package/dist/plugin-sdk/extensions/browser/src/core-api.d.ts +0 -4
- package/dist/plugin-sdk/extensions/browser/src/gateway/auth.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/gateway/browser-request.d.ts +0 -3
- package/dist/plugin-sdk/extensions/browser/src/gateway/net.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/gateway/startup-auth.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/infra/errors.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/infra/fs-safe.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/infra/net/proxy-env.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/infra/net/ssrf.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/infra/path-guards.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/infra/ports.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/infra/secure-random.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/infra/tmp-openclaw-dir.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/infra/ws.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/logging/redact.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/logging/subsystem.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/media/image-ops.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/media/store.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/node-host/invoke-browser.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/plugin-enabled.d.ts +0 -2
- package/dist/plugin-sdk/extensions/browser/src/plugin-service.d.ts +0 -2
- package/dist/plugin-sdk/extensions/browser/src/process/exec.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/security/secret-equal.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/server.d.ts +0 -3
- package/dist/plugin-sdk/extensions/browser/src/utils/boolean.d.ts +0 -1
- package/dist/plugin-sdk/extensions/browser/src/utils.d.ts +0 -1
- package/dist/plugin-sdk/extensions/byteplus/api.d.ts +0 -2
- package/dist/plugin-sdk/extensions/byteplus/models.d.ts +0 -73
- package/dist/plugin-sdk/extensions/byteplus/provider-catalog.d.ts +0 -3
- package/dist/plugin-sdk/extensions/chutes/api.d.ts +0 -3
- package/dist/plugin-sdk/extensions/chutes/models.d.ts +0 -7
- package/dist/plugin-sdk/extensions/chutes/onboard.d.ts +0 -13
- package/dist/plugin-sdk/extensions/chutes/provider-catalog.d.ts +0 -7
- package/dist/plugin-sdk/extensions/cloudflare-ai-gateway/api.d.ts +0 -2
- package/dist/plugin-sdk/extensions/cloudflare-ai-gateway/models.d.ts +0 -14
- package/dist/plugin-sdk/extensions/cloudflare-ai-gateway/onboard.d.ts +0 -32
- package/dist/plugin-sdk/extensions/deepseek/api.d.ts +0 -2
- package/dist/plugin-sdk/extensions/deepseek/models.d.ts +0 -4
- package/dist/plugin-sdk/extensions/deepseek/provider-catalog.d.ts +0 -2
- package/dist/plugin-sdk/extensions/discord/action-runtime-api.d.ts +0 -1
- package/dist/plugin-sdk/extensions/discord/api.d.ts +0 -19
- package/dist/plugin-sdk/extensions/discord/runtime-api.d.ts +0 -18
- package/dist/plugin-sdk/extensions/discord/session-key-api.d.ts +0 -1
- package/dist/plugin-sdk/extensions/discord/src/actions/handle-action.d.ts +0 -3
- package/dist/plugin-sdk/extensions/discord/src/actions/handle-action.guild-admin.d.ts +0 -9
- package/dist/plugin-sdk/extensions/discord/src/actions/runtime.d.ts +0 -5
- package/dist/plugin-sdk/extensions/discord/src/actions/runtime.guild.d.ts +0 -24
- package/dist/plugin-sdk/extensions/discord/src/actions/runtime.messaging.d.ts +0 -33
- package/dist/plugin-sdk/extensions/discord/src/actions/runtime.moderation-shared.d.ts +0 -13
- package/dist/plugin-sdk/extensions/discord/src/actions/runtime.moderation.d.ts +0 -10
- package/dist/plugin-sdk/extensions/discord/src/actions/runtime.presence.d.ts +0 -3
- package/dist/plugin-sdk/extensions/discord/src/actions/runtime.shared.d.ts +0 -1
- package/dist/plugin-sdk/extensions/discord/src/approval-native.d.ts +0 -31
- package/dist/plugin-sdk/extensions/discord/src/audit.d.ts +0 -29
- package/dist/plugin-sdk/extensions/discord/src/channel-actions.d.ts +0 -2
- package/dist/plugin-sdk/extensions/discord/src/chunk.d.ts +0 -20
- package/dist/plugin-sdk/extensions/discord/src/client.d.ts +0 -23
- package/dist/plugin-sdk/extensions/discord/src/component-custom-id.d.ts +0 -15
- package/dist/plugin-sdk/extensions/discord/src/components-registry.d.ts +0 -16
- package/dist/plugin-sdk/extensions/discord/src/components.d.ts +0 -195
- package/dist/plugin-sdk/extensions/discord/src/directory-config.d.ts +0 -3
- package/dist/plugin-sdk/extensions/discord/src/draft-chunking.d.ts +0 -6
- package/dist/plugin-sdk/extensions/discord/src/draft-stream.d.ts +0 -21
- package/dist/plugin-sdk/extensions/discord/src/exec-approvals.d.ts +0 -24
- package/dist/plugin-sdk/extensions/discord/src/gateway-logging.d.ts +0 -8
- package/dist/plugin-sdk/extensions/discord/src/group-policy.d.ts +0 -4
- package/dist/plugin-sdk/extensions/discord/src/guilds.d.ts +0 -6
- package/dist/plugin-sdk/extensions/discord/src/mentions.d.ts +0 -8
- package/dist/plugin-sdk/extensions/discord/src/message-tool-schema.d.ts +0 -96
- package/dist/plugin-sdk/extensions/discord/src/monitor/agent-components-helpers.d.ts +0 -160
- package/dist/plugin-sdk/extensions/discord/src/monitor/agent-components.d.ts +0 -28
- package/dist/plugin-sdk/extensions/discord/src/monitor/auto-presence.d.ts +0 -59
- package/dist/plugin-sdk/extensions/discord/src/monitor/commands.d.ts +0 -2
- package/dist/plugin-sdk/extensions/discord/src/monitor/dm-command-auth.d.ts +0 -24
- package/dist/plugin-sdk/extensions/discord/src/monitor/dm-command-decision.d.ts +0 -14
- package/dist/plugin-sdk/extensions/discord/src/monitor/exec-approvals.d.ts +0 -54
- package/dist/plugin-sdk/extensions/discord/src/monitor/gateway-handle.d.ts +0 -28
- package/dist/plugin-sdk/extensions/discord/src/monitor/gateway-plugin.d.ts +0 -22
- package/dist/plugin-sdk/extensions/discord/src/monitor/gateway-registry.d.ts +0 -9
- package/dist/plugin-sdk/extensions/discord/src/monitor/gateway-supervisor.d.ts +0 -25
- package/dist/plugin-sdk/extensions/discord/src/monitor/inbound-context.d.ts +0 -36
- package/dist/plugin-sdk/extensions/discord/src/monitor/inbound-job.d.ts +0 -13
- package/dist/plugin-sdk/extensions/discord/src/monitor/inbound-worker.d.ts +0 -22
- package/dist/plugin-sdk/extensions/discord/src/monitor/listeners.d.ts +0 -67
- package/dist/plugin-sdk/extensions/discord/src/monitor/message-handler.d.ts +0 -19
- package/dist/plugin-sdk/extensions/discord/src/monitor/message-handler.preflight.d.ts +0 -14
- package/dist/plugin-sdk/extensions/discord/src/monitor/message-handler.preflight.types.d.ts +0 -88
- package/dist/plugin-sdk/extensions/discord/src/monitor/message-handler.process.d.ts +0 -11
- package/dist/plugin-sdk/extensions/discord/src/monitor/message-utils.d.ts +0 -53
- package/dist/plugin-sdk/extensions/discord/src/monitor/model-picker-preferences.d.ts +0 -18
- package/dist/plugin-sdk/extensions/discord/src/monitor/model-picker.d.ts +0 -117
- package/dist/plugin-sdk/extensions/discord/src/monitor/native-command-context.d.ts +0 -68
- package/dist/plugin-sdk/extensions/discord/src/monitor/native-command-route.d.ts +0 -28
- package/dist/plugin-sdk/extensions/discord/src/monitor/native-command-ui.d.ts +0 -106
- package/dist/plugin-sdk/extensions/discord/src/monitor/native-command.d.ts +0 -28
- package/dist/plugin-sdk/extensions/discord/src/monitor/preflight-audio.d.ts +0 -21
- package/dist/plugin-sdk/extensions/discord/src/monitor/preflight-audio.runtime.d.ts +0 -3
- package/dist/plugin-sdk/extensions/discord/src/monitor/presence.d.ts +0 -5
- package/dist/plugin-sdk/extensions/discord/src/monitor/provider-session.runtime.d.ts +0 -4
- package/dist/plugin-sdk/extensions/discord/src/monitor/provider.allowlist.d.ts +0 -14
- package/dist/plugin-sdk/extensions/discord/src/monitor/provider.d.ts +0 -61
- package/dist/plugin-sdk/extensions/discord/src/monitor/provider.lifecycle.d.ts +0 -27
- package/dist/plugin-sdk/extensions/discord/src/monitor/provider.startup.d.ts +0 -82
- package/dist/plugin-sdk/extensions/discord/src/monitor/reply-context.d.ts +0 -21
- package/dist/plugin-sdk/extensions/discord/src/monitor/reply-delivery.d.ts +0 -40
- package/dist/plugin-sdk/extensions/discord/src/monitor/rest-fetch.d.ts +0 -2
- package/dist/plugin-sdk/extensions/discord/src/monitor/route-resolution.d.ts +0 -40
- package/dist/plugin-sdk/extensions/discord/src/monitor/sender-identity.d.ts +0 -31
- package/dist/plugin-sdk/extensions/discord/src/monitor/startup-status.d.ts +0 -4
- package/dist/plugin-sdk/extensions/discord/src/monitor/status.d.ts +0 -17
- package/dist/plugin-sdk/extensions/discord/src/monitor/system-events.d.ts +0 -2
- package/dist/plugin-sdk/extensions/discord/src/monitor/thread-bindings.config.d.ts +0 -11
- package/dist/plugin-sdk/extensions/discord/src/monitor/thread-bindings.d.ts +0 -8
- package/dist/plugin-sdk/extensions/discord/src/monitor/thread-bindings.discord-api.d.ts +0 -41
- package/dist/plugin-sdk/extensions/discord/src/monitor/thread-bindings.lifecycle.d.ts +0 -60
- package/dist/plugin-sdk/extensions/discord/src/monitor/thread-bindings.manager.d.ts +0 -21
- package/dist/plugin-sdk/extensions/discord/src/monitor/thread-bindings.messages.d.ts +0 -1
- package/dist/plugin-sdk/extensions/discord/src/monitor/thread-bindings.persona.d.ts +0 -6
- package/dist/plugin-sdk/extensions/discord/src/monitor/thread-bindings.state.d.ts +0 -79
- package/dist/plugin-sdk/extensions/discord/src/monitor/thread-bindings.types.d.ts +0 -79
- package/dist/plugin-sdk/extensions/discord/src/monitor/thread-session-close.d.ts +0 -15
- package/dist/plugin-sdk/extensions/discord/src/monitor/thread-title.d.ts +0 -11
- package/dist/plugin-sdk/extensions/discord/src/monitor/threading.d.ts +0 -108
- package/dist/plugin-sdk/extensions/discord/src/monitor/timeouts.d.ts +0 -16
- package/dist/plugin-sdk/extensions/discord/src/monitor/typing.d.ts +0 -5
- package/dist/plugin-sdk/extensions/discord/src/monitor.d.ts +0 -10
- package/dist/plugin-sdk/extensions/discord/src/monitor.gateway.d.ts +0 -12
- package/dist/plugin-sdk/extensions/discord/src/normalize.d.ts +0 -14
- package/dist/plugin-sdk/extensions/discord/src/outbound-adapter.d.ts +0 -3
- package/dist/plugin-sdk/extensions/discord/src/pluralkit.d.ts +0 -26
- package/dist/plugin-sdk/extensions/discord/src/probe.d.ts +0 -37
- package/dist/plugin-sdk/extensions/discord/src/resolve-allowlist-common.d.ts +0 -11
- package/dist/plugin-sdk/extensions/discord/src/resolve-channels.d.ts +0 -15
- package/dist/plugin-sdk/extensions/discord/src/resolve-users.d.ts +0 -14
- package/dist/plugin-sdk/extensions/discord/src/retry.d.ts +0 -12
- package/dist/plugin-sdk/extensions/discord/src/send.channels.d.ts +0 -17
- package/dist/plugin-sdk/extensions/discord/src/send.components.d.ts +0 -29
- package/dist/plugin-sdk/extensions/discord/src/send.d.ts +0 -11
- package/dist/plugin-sdk/extensions/discord/src/send.emojis-stickers.d.ts +0 -4
- package/dist/plugin-sdk/extensions/discord/src/send.guild.d.ts +0 -24
- package/dist/plugin-sdk/extensions/discord/src/send.messages.d.ts +0 -20
- package/dist/plugin-sdk/extensions/discord/src/send.outbound.d.ts +0 -67
- package/dist/plugin-sdk/extensions/discord/src/send.permissions.d.ts +0 -20
- package/dist/plugin-sdk/extensions/discord/src/send.reactions.d.ts +0 -15
- package/dist/plugin-sdk/extensions/discord/src/send.shared.d.ts +0 -86
- package/dist/plugin-sdk/extensions/discord/src/send.types.d.ts +0 -148
- package/dist/plugin-sdk/extensions/discord/src/send.typing.d.ts +0 -5
- package/dist/plugin-sdk/extensions/discord/src/session-key-normalization.d.ts +0 -7
- package/dist/plugin-sdk/extensions/discord/src/shared-interactive.d.ts +0 -3
- package/dist/plugin-sdk/extensions/discord/src/status-issues.d.ts +0 -2
- package/dist/plugin-sdk/extensions/discord/src/ui.d.ts +0 -19
- package/dist/plugin-sdk/extensions/discord/src/voice/access.d.ts +0 -31
- package/dist/plugin-sdk/extensions/discord/src/voice/command.d.ts +0 -15
- package/dist/plugin-sdk/extensions/discord/src/voice/manager.d.ts +0 -59
- package/dist/plugin-sdk/extensions/discord/src/voice/manager.runtime.d.ts +0 -5
- package/dist/plugin-sdk/extensions/discord/src/voice/sdk-runtime.d.ts +0 -3
- package/dist/plugin-sdk/extensions/discord/src/voice-message.d.ts +0 -50
- package/dist/plugin-sdk/extensions/discord/timeouts.d.ts +0 -1
- package/dist/plugin-sdk/extensions/feishu/api.d.ts +0 -6
- package/dist/plugin-sdk/extensions/feishu/runtime-api.d.ts +0 -4
- package/dist/plugin-sdk/extensions/feishu/src/accounts.d.ts +0 -72
- package/dist/plugin-sdk/extensions/feishu/src/async.d.ts +0 -13
- package/dist/plugin-sdk/extensions/feishu/src/bot-content.d.ts +0 -85
- package/dist/plugin-sdk/extensions/feishu/src/bot-sender-name.d.ts +0 -19
- package/dist/plugin-sdk/extensions/feishu/src/bot.d.ts +0 -70
- package/dist/plugin-sdk/extensions/feishu/src/client.d.ts +0 -47
- package/dist/plugin-sdk/extensions/feishu/src/config-schema.d.ts +0 -550
- package/dist/plugin-sdk/extensions/feishu/src/conversation-id.d.ts +0 -19
- package/dist/plugin-sdk/extensions/feishu/src/dedup.d.ts +0 -19
- package/dist/plugin-sdk/extensions/feishu/src/dynamic-agent.d.ts +0 -18
- package/dist/plugin-sdk/extensions/feishu/src/external-keys.d.ts +0 -1
- package/dist/plugin-sdk/extensions/feishu/src/media.d.ts +0 -118
- package/dist/plugin-sdk/extensions/feishu/src/mention.d.ts +0 -52
- package/dist/plugin-sdk/extensions/feishu/src/policy.d.ts +0 -36
- package/dist/plugin-sdk/extensions/feishu/src/post.d.ts +0 -11
- package/dist/plugin-sdk/extensions/feishu/src/probe.d.ts +0 -10
- package/dist/plugin-sdk/extensions/feishu/src/reply-dispatcher.d.ts +0 -35
- package/dist/plugin-sdk/extensions/feishu/src/runtime.d.ts +0 -3
- package/dist/plugin-sdk/extensions/feishu/src/secret-input.d.ts +0 -1
- package/dist/plugin-sdk/extensions/feishu/src/send-result.d.ts +0 -12
- package/dist/plugin-sdk/extensions/feishu/src/send-target.d.ts +0 -10
- package/dist/plugin-sdk/extensions/feishu/src/send.d.ts +0 -131
- package/dist/plugin-sdk/extensions/feishu/src/setup-core.d.ts +0 -3
- package/dist/plugin-sdk/extensions/feishu/src/setup-surface.d.ts +0 -3
- package/dist/plugin-sdk/extensions/feishu/src/streaming-card.d.ts +0 -55
- package/dist/plugin-sdk/extensions/feishu/src/targets.d.ts +0 -6
- package/dist/plugin-sdk/extensions/feishu/src/thread-bindings.d.ts +0 -42
- package/dist/plugin-sdk/extensions/feishu/src/types.d.ts +0 -84
- package/dist/plugin-sdk/extensions/feishu/src/typing.d.ts +0 -57
- package/dist/plugin-sdk/extensions/github-copilot/api.d.ts +0 -1
- package/dist/plugin-sdk/extensions/github-copilot/login.d.ts +0 -5
- package/dist/plugin-sdk/extensions/google/api.d.ts +0 -33
- package/dist/plugin-sdk/extensions/google/model-id.d.ts +0 -2
- package/dist/plugin-sdk/extensions/huggingface/api.d.ts +0 -3
- package/dist/plugin-sdk/extensions/huggingface/models.d.ts +0 -7
- package/dist/plugin-sdk/extensions/huggingface/onboard.d.ts +0 -4
- package/dist/plugin-sdk/extensions/huggingface/provider-catalog.d.ts +0 -3
- package/dist/plugin-sdk/extensions/image-generation-core/api.d.ts +0 -1
- package/dist/plugin-sdk/extensions/image-generation-core/runtime-api.d.ts +0 -1
- package/dist/plugin-sdk/extensions/image-generation-core/src/runtime.d.ts +0 -24
- package/dist/plugin-sdk/extensions/irc/api.d.ts +0 -2
- package/dist/plugin-sdk/extensions/irc/src/accounts.d.ts +0 -23
- package/dist/plugin-sdk/extensions/irc/src/control-chars.d.ts +0 -3
- package/dist/plugin-sdk/extensions/irc/src/normalize.d.ts +0 -18
- package/dist/plugin-sdk/extensions/irc/src/runtime-api.d.ts +0 -2
- package/dist/plugin-sdk/extensions/irc/src/setup-core.d.ts +0 -10
- package/dist/plugin-sdk/extensions/irc/src/setup-surface.d.ts +0 -4
- package/dist/plugin-sdk/extensions/irc/src/types.d.ts +0 -83
- package/dist/plugin-sdk/extensions/kilocode/api.d.ts +0 -2
- package/dist/plugin-sdk/extensions/kilocode/provider-catalog.d.ts +0 -3
- package/dist/plugin-sdk/extensions/kilocode/provider-models.d.ts +0 -18
- package/dist/plugin-sdk/extensions/kimi-coding/api.d.ts +0 -2
- package/dist/plugin-sdk/extensions/kimi-coding/onboard.d.ts +0 -5
- package/dist/plugin-sdk/extensions/kimi-coding/provider-catalog.d.ts +0 -10
- package/dist/plugin-sdk/extensions/line/runtime-api.d.ts +0 -36
- package/dist/plugin-sdk/extensions/line/src/accounts.d.ts +0 -10
- package/dist/plugin-sdk/extensions/line/src/actions.d.ts +0 -22
- package/dist/plugin-sdk/extensions/line/src/auto-reply-delivery.d.ts +0 -38
- package/dist/plugin-sdk/extensions/line/src/bot-access.d.ts +0 -17
- package/dist/plugin-sdk/extensions/line/src/bot-handlers.d.ts +0 -23
- package/dist/plugin-sdk/extensions/line/src/bot-message-context.d.ts +0 -129
- package/dist/plugin-sdk/extensions/line/src/bot.d.ts +0 -24
- package/dist/plugin-sdk/extensions/line/src/channel-access-token.d.ts +0 -4
- package/dist/plugin-sdk/extensions/line/src/config-schema.d.ts +0 -80
- package/dist/plugin-sdk/extensions/line/src/download.d.ts +0 -7
- package/dist/plugin-sdk/extensions/line/src/flex-templates/basic-cards.d.ts +0 -46
- package/dist/plugin-sdk/extensions/line/src/flex-templates/common.d.ts +0 -2
- package/dist/plugin-sdk/extensions/line/src/flex-templates/media-control-cards.d.ts +0 -73
- package/dist/plugin-sdk/extensions/line/src/flex-templates/message.d.ts +0 -6
- package/dist/plugin-sdk/extensions/line/src/flex-templates/schedule-cards.d.ts +0 -55
- package/dist/plugin-sdk/extensions/line/src/flex-templates/types.d.ts +0 -19
- package/dist/plugin-sdk/extensions/line/src/flex-templates.d.ts +0 -5
- package/dist/plugin-sdk/extensions/line/src/group-keys.d.ts +0 -17
- package/dist/plugin-sdk/extensions/line/src/markdown-to-line.d.ts +0 -67
- package/dist/plugin-sdk/extensions/line/src/monitor.d.ts +0 -28
- package/dist/plugin-sdk/extensions/line/src/probe.d.ts +0 -2
- package/dist/plugin-sdk/extensions/line/src/reply-chunks.d.ts +0 -24
- package/dist/plugin-sdk/extensions/line/src/rich-menu.d.ts +0 -50
- package/dist/plugin-sdk/extensions/line/src/send.d.ts +0 -73
- package/dist/plugin-sdk/extensions/line/src/signature.d.ts +0 -1
- package/dist/plugin-sdk/extensions/line/src/template-messages.d.ts +0 -100
- package/dist/plugin-sdk/extensions/line/src/types.d.ts +0 -120
- package/dist/plugin-sdk/extensions/line/src/webhook-node.d.ts +0 -16
- package/dist/plugin-sdk/extensions/line/src/webhook-utils.d.ts +0 -3
- package/dist/plugin-sdk/extensions/line/src/webhook.d.ts +0 -19
- package/dist/plugin-sdk/extensions/litellm/api.d.ts +0 -1
- package/dist/plugin-sdk/extensions/litellm/onboard.d.ts +0 -7
- package/dist/plugin-sdk/extensions/matrix/api.d.ts +0 -9
- package/dist/plugin-sdk/extensions/matrix/runtime-api.d.ts +0 -12
- package/dist/plugin-sdk/extensions/matrix/src/account-selection.d.ts +0 -6
- package/dist/plugin-sdk/extensions/matrix/src/auth-precedence.d.ts +0 -11
- package/dist/plugin-sdk/extensions/matrix/src/directory-live.d.ts +0 -10
- package/dist/plugin-sdk/extensions/matrix/src/env-vars.d.ts +0 -10
- package/dist/plugin-sdk/extensions/matrix/src/matrix/account-config.d.ts +0 -10
- package/dist/plugin-sdk/extensions/matrix/src/matrix/accounts.d.ts +0 -23
- package/dist/plugin-sdk/extensions/matrix/src/matrix/actions/client.d.ts +0 -6
- package/dist/plugin-sdk/extensions/matrix/src/matrix/actions/types.d.ts +0 -68
- package/dist/plugin-sdk/extensions/matrix/src/matrix/actions/verification.d.ts +0 -78
- package/dist/plugin-sdk/extensions/matrix/src/matrix/active-client.d.ts +0 -3
- package/dist/plugin-sdk/extensions/matrix/src/matrix/async-lock.d.ts +0 -2
- package/dist/plugin-sdk/extensions/matrix/src/matrix/backup-health.d.ts +0 -19
- package/dist/plugin-sdk/extensions/matrix/src/matrix/client/config-runtime-api.d.ts +0 -3
- package/dist/plugin-sdk/extensions/matrix/src/matrix/client/config-secret-input.runtime.d.ts +0 -1
- package/dist/plugin-sdk/extensions/matrix/src/matrix/client/config.d.ts +0 -55
- package/dist/plugin-sdk/extensions/matrix/src/matrix/client/create-client.d.ts +0 -18
- package/dist/plugin-sdk/extensions/matrix/src/matrix/client/env-auth.d.ts +0 -23
- package/dist/plugin-sdk/extensions/matrix/src/matrix/client/file-sync-store.d.ts +0 -29
- package/dist/plugin-sdk/extensions/matrix/src/matrix/client/logging.d.ts +0 -13
- package/dist/plugin-sdk/extensions/matrix/src/matrix/client/migration-snapshot.runtime.d.ts +0 -1
- package/dist/plugin-sdk/extensions/matrix/src/matrix/client/private-network-host.d.ts +0 -1
- package/dist/plugin-sdk/extensions/matrix/src/matrix/client/runtime.d.ts +0 -1
- package/dist/plugin-sdk/extensions/matrix/src/matrix/client/shared.d.ts +0 -24
- package/dist/plugin-sdk/extensions/matrix/src/matrix/client/storage.d.ts +0 -30
- package/dist/plugin-sdk/extensions/matrix/src/matrix/client/types.d.ts +0 -47
- package/dist/plugin-sdk/extensions/matrix/src/matrix/client-bootstrap.d.ts +0 -25
- package/dist/plugin-sdk/extensions/matrix/src/matrix/client.d.ts +0 -6
- package/dist/plugin-sdk/extensions/matrix/src/matrix/config-paths.d.ts +0 -4
- package/dist/plugin-sdk/extensions/matrix/src/matrix/config-update.d.ts +0 -24
- package/dist/plugin-sdk/extensions/matrix/src/matrix/credentials-read.d.ts +0 -17
- package/dist/plugin-sdk/extensions/matrix/src/matrix/credentials-write.runtime.d.ts +0 -3
- package/dist/plugin-sdk/extensions/matrix/src/matrix/credentials.d.ts +0 -5
- package/dist/plugin-sdk/extensions/matrix/src/matrix/deps.d.ts +0 -25
- package/dist/plugin-sdk/extensions/matrix/src/matrix/direct-management.d.ts +0 -53
- package/dist/plugin-sdk/extensions/matrix/src/matrix/direct-room.d.ts +0 -27
- package/dist/plugin-sdk/extensions/matrix/src/matrix/encryption-guidance.d.ts +0 -4
- package/dist/plugin-sdk/extensions/matrix/src/matrix/errors.d.ts +0 -1
- package/dist/plugin-sdk/extensions/matrix/src/matrix/format.d.ts +0 -17
- package/dist/plugin-sdk/extensions/matrix/src/matrix/outbound-media-runtime.d.ts +0 -1
- package/dist/plugin-sdk/extensions/matrix/src/matrix/poll-types.d.ts +0 -114
- package/dist/plugin-sdk/extensions/matrix/src/matrix/reaction-common.d.ts +0 -32
- package/dist/plugin-sdk/extensions/matrix/src/matrix/sdk/crypto-bootstrap.d.ts +0 -34
- package/dist/plugin-sdk/extensions/matrix/src/matrix/sdk/crypto-facade.d.ts +0 -67
- package/dist/plugin-sdk/extensions/matrix/src/matrix/sdk/crypto-node.runtime.d.ts +0 -2
- package/dist/plugin-sdk/extensions/matrix/src/matrix/sdk/crypto-runtime.d.ts +0 -10
- package/dist/plugin-sdk/extensions/matrix/src/matrix/sdk/decrypt-bridge.d.ts +0 -45
- package/dist/plugin-sdk/extensions/matrix/src/matrix/sdk/event-helpers.d.ts +0 -10
- package/dist/plugin-sdk/extensions/matrix/src/matrix/sdk/http-client.d.ts +0 -34
- package/dist/plugin-sdk/extensions/matrix/src/matrix/sdk/idb-persistence-lock.d.ts +0 -4
- package/dist/plugin-sdk/extensions/matrix/src/matrix/sdk/idb-persistence.d.ts +0 -5
- package/dist/plugin-sdk/extensions/matrix/src/matrix/sdk/logger.d.ts +0 -25
- package/dist/plugin-sdk/extensions/matrix/src/matrix/sdk/read-response-with-limit.d.ts +0 -11
- package/dist/plugin-sdk/extensions/matrix/src/matrix/sdk/recovery-key-store.d.ts +0 -48
- package/dist/plugin-sdk/extensions/matrix/src/matrix/sdk/transport.d.ts +0 -29
- package/dist/plugin-sdk/extensions/matrix/src/matrix/sdk/types.d.ts +0 -186
- package/dist/plugin-sdk/extensions/matrix/src/matrix/sdk/verification-manager.d.ts +0 -127
- package/dist/plugin-sdk/extensions/matrix/src/matrix/sdk/verification-status.d.ts +0 -4
- package/dist/plugin-sdk/extensions/matrix/src/matrix/sdk.d.ts +0 -212
- package/dist/plugin-sdk/extensions/matrix/src/matrix/send/client.d.ts +0 -15
- package/dist/plugin-sdk/extensions/matrix/src/matrix/send/formatting.d.ts +0 -25
- package/dist/plugin-sdk/extensions/matrix/src/matrix/send/media.d.ts +0 -42
- package/dist/plugin-sdk/extensions/matrix/src/matrix/send/targets.d.ts +0 -3
- package/dist/plugin-sdk/extensions/matrix/src/matrix/send/types.d.ts +0 -80
- package/dist/plugin-sdk/extensions/matrix/src/matrix/send.d.ts +0 -54
- package/dist/plugin-sdk/extensions/matrix/src/matrix/target-ids.d.ts +0 -19
- package/dist/plugin-sdk/extensions/matrix/src/matrix/thread-bindings-shared.d.ts +0 -77
- package/dist/plugin-sdk/extensions/matrix/src/matrix/thread-bindings.d.ts +0 -15
- package/dist/plugin-sdk/extensions/matrix/src/onboarding.d.ts +0 -2
- package/dist/plugin-sdk/extensions/matrix/src/resolve-targets.d.ts +0 -8
- package/dist/plugin-sdk/extensions/matrix/src/runtime-api.d.ts +0 -11
- package/dist/plugin-sdk/extensions/matrix/src/runtime.d.ts +0 -3
- package/dist/plugin-sdk/extensions/matrix/src/setup-bootstrap.d.ts +0 -20
- package/dist/plugin-sdk/extensions/matrix/src/setup-config.d.ts +0 -12
- package/dist/plugin-sdk/extensions/matrix/src/setup-core.d.ts +0 -2
- package/dist/plugin-sdk/extensions/matrix/src/setup-surface.d.ts +0 -1
- package/dist/plugin-sdk/extensions/matrix/src/storage-paths.d.ts +0 -26
- package/dist/plugin-sdk/extensions/matrix/src/types.d.ts +0 -202
- package/dist/plugin-sdk/extensions/mattermost/api.d.ts +0 -1
- package/dist/plugin-sdk/extensions/mattermost/runtime-api.d.ts +0 -1
- package/dist/plugin-sdk/extensions/mattermost/src/mattermost/accounts.d.ts +0 -33
- package/dist/plugin-sdk/extensions/mattermost/src/mattermost/client.d.ts +0 -103
- package/dist/plugin-sdk/extensions/mattermost/src/mattermost/monitor-auth.d.ts +0 -51
- package/dist/plugin-sdk/extensions/mattermost/src/mattermost/runtime-api.d.ts +0 -1
- package/dist/plugin-sdk/extensions/mattermost/src/runtime-api.d.ts +0 -1
- package/dist/plugin-sdk/extensions/mattermost/src/secret-input.d.ts +0 -2
- package/dist/plugin-sdk/extensions/mattermost/src/types.d.ts +0 -105
- package/dist/plugin-sdk/extensions/media-understanding-core/runtime-api.d.ts +0 -1
- package/dist/plugin-sdk/extensions/media-understanding-core/src/runtime.d.ts +0 -54
- package/dist/plugin-sdk/extensions/memory-core/runtime-api.d.ts +0 -3
- package/dist/plugin-sdk/extensions/memory-core/src/memory/embeddings.d.ts +0 -21
- package/dist/plugin-sdk/extensions/memory-core/src/memory/hybrid.d.ts +0 -45
- package/dist/plugin-sdk/extensions/memory-core/src/memory/index.d.ts +0 -3
- package/dist/plugin-sdk/extensions/memory-core/src/memory/manager-embedding-ops.d.ts +0 -47
- package/dist/plugin-sdk/extensions/memory-core/src/memory/manager-runtime.d.ts +0 -1
- package/dist/plugin-sdk/extensions/memory-core/src/memory/manager-search.d.ts +0 -61
- package/dist/plugin-sdk/extensions/memory-core/src/memory/manager-sync-ops.d.ts +0 -142
- package/dist/plugin-sdk/extensions/memory-core/src/memory/manager.d.ts +0 -155
- package/dist/plugin-sdk/extensions/memory-core/src/memory/mmr.d.ts +0 -67
- package/dist/plugin-sdk/extensions/memory-core/src/memory/provider-adapters.d.ts +0 -19
- package/dist/plugin-sdk/extensions/memory-core/src/memory/qmd-manager.d.ts +0 -191
- package/dist/plugin-sdk/extensions/memory-core/src/memory/search-manager.d.ts +0 -12
- package/dist/plugin-sdk/extensions/memory-core/src/memory/temporal-decay.d.ts +0 -25
- package/dist/plugin-sdk/extensions/minimax/api.d.ts +0 -4
- package/dist/plugin-sdk/extensions/minimax/model-definitions.d.ts +0 -35
- package/dist/plugin-sdk/extensions/minimax/onboard.d.ts +0 -5
- package/dist/plugin-sdk/extensions/minimax/provider-catalog.d.ts +0 -3
- package/dist/plugin-sdk/extensions/minimax/provider-models.d.ts +0 -15
- package/dist/plugin-sdk/extensions/mistral/api.d.ts +0 -11
- package/dist/plugin-sdk/extensions/mistral/model-definitions.d.ts +0 -14
- package/dist/plugin-sdk/extensions/mistral/onboard.d.ts +0 -4
- package/dist/plugin-sdk/extensions/mistral/provider-catalog.d.ts +0 -2
- package/dist/plugin-sdk/extensions/modelstudio/api.d.ts +0 -2
- package/dist/plugin-sdk/extensions/modelstudio/models.d.ts +0 -27
- package/dist/plugin-sdk/extensions/modelstudio/provider-catalog.d.ts +0 -2
- package/dist/plugin-sdk/extensions/moonshot/api.d.ts +0 -2
- package/dist/plugin-sdk/extensions/moonshot/onboard.d.ts +0 -6
- package/dist/plugin-sdk/extensions/moonshot/provider-catalog.d.ts +0 -7
- package/dist/plugin-sdk/extensions/nvidia/api.d.ts +0 -1
- package/dist/plugin-sdk/extensions/nvidia/provider-catalog.d.ts +0 -2
- package/dist/plugin-sdk/extensions/ollama/api.d.ts +0 -4
- package/dist/plugin-sdk/extensions/ollama/runtime-api.d.ts +0 -2
- package/dist/plugin-sdk/extensions/ollama/src/defaults.d.ts +0 -11
- package/dist/plugin-sdk/extensions/ollama/src/embedding-provider.d.ts +0 -37
- package/dist/plugin-sdk/extensions/ollama/src/provider-models.d.ts +0 -31
- package/dist/plugin-sdk/extensions/ollama/src/setup.d.ts +0 -36
- package/dist/plugin-sdk/extensions/ollama/src/stream.d.ts +0 -104
- package/dist/plugin-sdk/extensions/openai/api.d.ts +0 -3
- package/dist/plugin-sdk/extensions/openai/default-models.d.ts +0 -10
- package/dist/plugin-sdk/extensions/openai/openai-codex-catalog.d.ts +0 -3
- package/dist/plugin-sdk/extensions/openai/openai-provider.d.ts +0 -2
- package/dist/plugin-sdk/extensions/openai/shared.d.ts +0 -5
- package/dist/plugin-sdk/extensions/opencode/api.d.ts +0 -6
- package/dist/plugin-sdk/extensions/opencode/onboard.d.ts +0 -4
- package/dist/plugin-sdk/extensions/opencode-go/api.d.ts +0 -5
- package/dist/plugin-sdk/extensions/opencode-go/onboard.d.ts +0 -4
- package/dist/plugin-sdk/extensions/openrouter/api.d.ts +0 -2
- package/dist/plugin-sdk/extensions/openrouter/onboard.d.ts +0 -4
- package/dist/plugin-sdk/extensions/openrouter/provider-catalog.d.ts +0 -2
- package/dist/plugin-sdk/extensions/qianfan/api.d.ts +0 -2
- package/dist/plugin-sdk/extensions/qianfan/onboard.d.ts +0 -4
- package/dist/plugin-sdk/extensions/qianfan/provider-catalog.d.ts +0 -4
- package/dist/plugin-sdk/extensions/sglang/api.d.ts +0 -2
- package/dist/plugin-sdk/extensions/sglang/defaults.d.ts +0 -4
- package/dist/plugin-sdk/extensions/sglang/models.d.ts +0 -8
- package/dist/plugin-sdk/extensions/signal/api.d.ts +0 -11
- package/dist/plugin-sdk/extensions/signal/reaction-runtime-api.d.ts +0 -1
- package/dist/plugin-sdk/extensions/signal/src/accounts.d.ts +0 -17
- package/dist/plugin-sdk/extensions/signal/src/client.d.ts +0 -32
- package/dist/plugin-sdk/extensions/signal/src/daemon.d.ts +0 -26
- package/dist/plugin-sdk/extensions/signal/src/format.d.ts +0 -17
- package/dist/plugin-sdk/extensions/signal/src/identity.d.ts +0 -25
- package/dist/plugin-sdk/extensions/signal/src/message-actions.d.ts +0 -2
- package/dist/plugin-sdk/extensions/signal/src/monitor/access-policy.d.ts +0 -40
- package/dist/plugin-sdk/extensions/signal/src/monitor/event-handler.d.ts +0 -5
- package/dist/plugin-sdk/extensions/signal/src/monitor/event-handler.types.d.ts +0 -128
- package/dist/plugin-sdk/extensions/signal/src/monitor/inbound-context.d.ts +0 -17
- package/dist/plugin-sdk/extensions/signal/src/monitor/mentions.d.ts +0 -2
- package/dist/plugin-sdk/extensions/signal/src/monitor.d.ts +0 -26
- package/dist/plugin-sdk/extensions/signal/src/normalize.d.ts +0 -2
- package/dist/plugin-sdk/extensions/signal/src/outbound-session.d.ts +0 -8
- package/dist/plugin-sdk/extensions/signal/src/probe.d.ts +0 -7
- package/dist/plugin-sdk/extensions/signal/src/reaction-level.d.ts +0 -17
- package/dist/plugin-sdk/extensions/signal/src/rpc-context.d.ts +0 -9
- package/dist/plugin-sdk/extensions/signal/src/runtime-api.d.ts +0 -25
- package/dist/plugin-sdk/extensions/signal/src/send-reactions.d.ts +0 -34
- package/dist/plugin-sdk/extensions/signal/src/send.d.ts +0 -32
- package/dist/plugin-sdk/extensions/signal/src/setup-core.d.ts +0 -20
- package/dist/plugin-sdk/extensions/signal/src/sse-reconnect.d.ts +0 -12
- package/dist/plugin-sdk/extensions/slack/api.d.ts +0 -19
- package/dist/plugin-sdk/extensions/slack/runtime-api.d.ts +0 -5
- package/dist/plugin-sdk/extensions/slack/src/account-inspect.d.ts +0 -32
- package/dist/plugin-sdk/extensions/slack/src/account-surface-fields.d.ts +0 -14
- package/dist/plugin-sdk/extensions/slack/src/accounts.d.ts +0 -25
- package/dist/plugin-sdk/extensions/slack/src/accounts.runtime.d.ts +0 -1
- package/dist/plugin-sdk/extensions/slack/src/action-runtime.d.ts +0 -38
- package/dist/plugin-sdk/extensions/slack/src/action-threading.d.ts +0 -11
- package/dist/plugin-sdk/extensions/slack/src/actions.d.ts +0 -81
- package/dist/plugin-sdk/extensions/slack/src/actions.runtime.d.ts +0 -1
- package/dist/plugin-sdk/extensions/slack/src/approval-auth.d.ts +0 -25
- package/dist/plugin-sdk/extensions/slack/src/approval-native.d.ts +0 -10
- package/dist/plugin-sdk/extensions/slack/src/blocks-fallback.d.ts +0 -2
- package/dist/plugin-sdk/extensions/slack/src/blocks-input.d.ts +0 -4
- package/dist/plugin-sdk/extensions/slack/src/blocks-render.d.ts +0 -6
- package/dist/plugin-sdk/extensions/slack/src/channel-actions.d.ts +0 -7
- package/dist/plugin-sdk/extensions/slack/src/channel-migration.d.ts +0 -20
- package/dist/plugin-sdk/extensions/slack/src/channel-type.d.ts +0 -6
- package/dist/plugin-sdk/extensions/slack/src/channel.d.ts +0 -4
- package/dist/plugin-sdk/extensions/slack/src/client.d.ts +0 -7
- package/dist/plugin-sdk/extensions/slack/src/config-schema.d.ts +0 -1
- package/dist/plugin-sdk/extensions/slack/src/config-ui-hints.d.ts +0 -98
- package/dist/plugin-sdk/extensions/slack/src/directory-config.d.ts +0 -3
- package/dist/plugin-sdk/extensions/slack/src/directory-live.d.ts +0 -3
- package/dist/plugin-sdk/extensions/slack/src/draft-stream.d.ts +0 -25
- package/dist/plugin-sdk/extensions/slack/src/exec-approvals.d.ts +0 -43
- package/dist/plugin-sdk/extensions/slack/src/format.d.ts +0 -8
- package/dist/plugin-sdk/extensions/slack/src/group-policy.d.ts +0 -4
- package/dist/plugin-sdk/extensions/slack/src/http/index.d.ts +0 -1
- package/dist/plugin-sdk/extensions/slack/src/http/registry.d.ts +0 -12
- package/dist/plugin-sdk/extensions/slack/src/index.d.ts +0 -7
- package/dist/plugin-sdk/extensions/slack/src/interactive-replies.d.ts +0 -5
- package/dist/plugin-sdk/extensions/slack/src/limits.d.ts +0 -1
- package/dist/plugin-sdk/extensions/slack/src/message-action-dispatch.d.ts +0 -12
- package/dist/plugin-sdk/extensions/slack/src/message-actions.d.ts +0 -5
- package/dist/plugin-sdk/extensions/slack/src/message-tool-schema.d.ts +0 -1
- package/dist/plugin-sdk/extensions/slack/src/modal-metadata.d.ts +0 -8
- package/dist/plugin-sdk/extensions/slack/src/monitor/allow-list.d.ts +0 -24
- package/dist/plugin-sdk/extensions/slack/src/monitor/auth.d.ts +0 -29
- package/dist/plugin-sdk/extensions/slack/src/monitor/channel-config.d.ts +0 -45
- package/dist/plugin-sdk/extensions/slack/src/monitor/channel-type.d.ts +0 -3
- package/dist/plugin-sdk/extensions/slack/src/monitor/commands.d.ts +0 -9
- package/dist/plugin-sdk/extensions/slack/src/monitor/context.d.ts +0 -107
- package/dist/plugin-sdk/extensions/slack/src/monitor/dm-auth.d.ts +0 -17
- package/dist/plugin-sdk/extensions/slack/src/monitor/events/channels.d.ts +0 -5
- package/dist/plugin-sdk/extensions/slack/src/monitor/events/interactions.block-actions.d.ts +0 -49
- package/dist/plugin-sdk/extensions/slack/src/monitor/events/interactions.d.ts +0 -4
- package/dist/plugin-sdk/extensions/slack/src/monitor/events/interactions.modal.d.ts +0 -68
- package/dist/plugin-sdk/extensions/slack/src/monitor/events/members.d.ts +0 -5
- package/dist/plugin-sdk/extensions/slack/src/monitor/events/message-subtype-handlers.d.ts +0 -13
- package/dist/plugin-sdk/extensions/slack/src/monitor/events/messages.d.ts +0 -6
- package/dist/plugin-sdk/extensions/slack/src/monitor/events/pins.d.ts +0 -5
- package/dist/plugin-sdk/extensions/slack/src/monitor/events/reactions.d.ts +0 -5
- package/dist/plugin-sdk/extensions/slack/src/monitor/events/system-event-context.d.ts +0 -12
- package/dist/plugin-sdk/extensions/slack/src/monitor/events.d.ts +0 -10
- package/dist/plugin-sdk/extensions/slack/src/monitor/exec-approvals.d.ts +0 -26
- package/dist/plugin-sdk/extensions/slack/src/monitor/external-arg-menu-store.d.ts +0 -18
- package/dist/plugin-sdk/extensions/slack/src/monitor/media.d.ts +0 -67
- package/dist/plugin-sdk/extensions/slack/src/monitor/message-handler/dispatch.d.ts +0 -21
- package/dist/plugin-sdk/extensions/slack/src/monitor/message-handler/prepare-content.d.ts +0 -14
- package/dist/plugin-sdk/extensions/slack/src/monitor/message-handler/prepare-thread-context.d.ts +0 -28
- package/dist/plugin-sdk/extensions/slack/src/monitor/message-handler/prepare.d.ts +0 -13
- package/dist/plugin-sdk/extensions/slack/src/monitor/message-handler/prepare.test-helpers.d.ts +0 -12
- package/dist/plugin-sdk/extensions/slack/src/monitor/message-handler/preview-finalize.d.ts +0 -44
- package/dist/plugin-sdk/extensions/slack/src/monitor/message-handler/types.d.ts +0 -23
- package/dist/plugin-sdk/extensions/slack/src/monitor/message-handler.d.ts +0 -22
- package/dist/plugin-sdk/extensions/slack/src/monitor/mrkdwn.d.ts +0 -1
- package/dist/plugin-sdk/extensions/slack/src/monitor/policy.d.ts +0 -5
- package/dist/plugin-sdk/extensions/slack/src/monitor/provider.d.ts +0 -33
- package/dist/plugin-sdk/extensions/slack/src/monitor/reconnect-policy.d.ts +0 -25
- package/dist/plugin-sdk/extensions/slack/src/monitor/replies.d.ts +0 -56
- package/dist/plugin-sdk/extensions/slack/src/monitor/room-context.d.ts +0 -14
- package/dist/plugin-sdk/extensions/slack/src/monitor/slash-commands.runtime.d.ts +0 -11
- package/dist/plugin-sdk/extensions/slack/src/monitor/slash-dispatch.runtime.d.ts +0 -17
- package/dist/plugin-sdk/extensions/slack/src/monitor/slash-skill-commands.runtime.d.ts +0 -3
- package/dist/plugin-sdk/extensions/slack/src/monitor/slash.d.ts +0 -6
- package/dist/plugin-sdk/extensions/slack/src/monitor/thread-resolution.d.ts +0 -12
- package/dist/plugin-sdk/extensions/slack/src/monitor/types.d.ts +0 -113
- package/dist/plugin-sdk/extensions/slack/src/monitor.d.ts +0 -5
- package/dist/plugin-sdk/extensions/slack/src/outbound-adapter.d.ts +0 -2
- package/dist/plugin-sdk/extensions/slack/src/probe.d.ts +0 -14
- package/dist/plugin-sdk/extensions/slack/src/reply-blocks.d.ts +0 -3
- package/dist/plugin-sdk/extensions/slack/src/resolve-allowlist-common.d.ts +0 -29
- package/dist/plugin-sdk/extensions/slack/src/resolve-channels.d.ts +0 -19
- package/dist/plugin-sdk/extensions/slack/src/resolve-users.d.ts +0 -26
- package/dist/plugin-sdk/extensions/slack/src/runtime-api.d.ts +0 -6
- package/dist/plugin-sdk/extensions/slack/src/runtime.d.ts +0 -3
- package/dist/plugin-sdk/extensions/slack/src/scopes.d.ts +0 -7
- package/dist/plugin-sdk/extensions/slack/src/send.d.ts +0 -32
- package/dist/plugin-sdk/extensions/slack/src/sent-thread-cache.d.ts +0 -3
- package/dist/plugin-sdk/extensions/slack/src/setup-core.d.ts +0 -80
- package/dist/plugin-sdk/extensions/slack/src/setup-surface.d.ts +0 -2
- package/dist/plugin-sdk/extensions/slack/src/shared.d.ts +0 -39
- package/dist/plugin-sdk/extensions/slack/src/stream-mode.d.ts +0 -23
- package/dist/plugin-sdk/extensions/slack/src/streaming.d.ts +0 -72
- package/dist/plugin-sdk/extensions/slack/src/targets.d.ts +0 -9
- package/dist/plugin-sdk/extensions/slack/src/threading-tool-context.d.ts +0 -10
- package/dist/plugin-sdk/extensions/slack/src/threading.d.ts +0 -29
- package/dist/plugin-sdk/extensions/slack/src/token.d.ts +0 -4
- package/dist/plugin-sdk/extensions/slack/src/truncate.d.ts +0 -1
- package/dist/plugin-sdk/extensions/slack/src/types.d.ts +0 -58
- package/dist/plugin-sdk/extensions/slack/test-api.d.ts +0 -9
- package/dist/plugin-sdk/extensions/speech-core/api.d.ts +0 -1
- package/dist/plugin-sdk/extensions/speech-core/runtime-api.d.ts +0 -1
- package/dist/plugin-sdk/extensions/speech-core/src/tts.d.ts +0 -145
- package/dist/plugin-sdk/extensions/synthetic/api.d.ts +0 -3
- package/dist/plugin-sdk/extensions/synthetic/models.d.ts +0 -160
- package/dist/plugin-sdk/extensions/synthetic/onboard.d.ts +0 -5
- package/dist/plugin-sdk/extensions/synthetic/provider-catalog.d.ts +0 -2
- package/dist/plugin-sdk/extensions/together/api.d.ts +0 -3
- package/dist/plugin-sdk/extensions/together/models.d.ts +0 -4
- package/dist/plugin-sdk/extensions/together/onboard.d.ts +0 -4
- package/dist/plugin-sdk/extensions/together/provider-catalog.d.ts +0 -2
- package/dist/plugin-sdk/extensions/venice/api.d.ts +0 -2
- package/dist/plugin-sdk/extensions/venice/models.d.ts +0 -345
- package/dist/plugin-sdk/extensions/venice/provider-catalog.d.ts +0 -2
- package/dist/plugin-sdk/extensions/vercel-ai-gateway/api.d.ts +0 -3
- package/dist/plugin-sdk/extensions/vercel-ai-gateway/models.d.ts +0 -15
- package/dist/plugin-sdk/extensions/vercel-ai-gateway/onboard.d.ts +0 -4
- package/dist/plugin-sdk/extensions/vercel-ai-gateway/provider-catalog.d.ts +0 -2
- package/dist/plugin-sdk/extensions/vllm/api.d.ts +0 -2
- package/dist/plugin-sdk/extensions/vllm/defaults.d.ts +0 -4
- package/dist/plugin-sdk/extensions/vllm/models.d.ts +0 -8
- package/dist/plugin-sdk/extensions/volcengine/api.d.ts +0 -2
- package/dist/plugin-sdk/extensions/volcengine/models.d.ts +0 -94
- package/dist/plugin-sdk/extensions/volcengine/provider-catalog.d.ts +0 -3
- package/dist/plugin-sdk/extensions/whatsapp/api.d.ts +0 -10
- package/dist/plugin-sdk/extensions/whatsapp/constants.d.ts +0 -1
- package/dist/plugin-sdk/extensions/whatsapp/light-runtime-api.d.ts +0 -4
- package/dist/plugin-sdk/extensions/whatsapp/login-qr-api.d.ts +0 -5
- package/dist/plugin-sdk/extensions/whatsapp/runtime-api.d.ts +0 -14
- package/dist/plugin-sdk/extensions/whatsapp/src/account-config.d.ts +0 -8
- package/dist/plugin-sdk/extensions/whatsapp/src/accounts.d.ts +0 -43
- package/dist/plugin-sdk/extensions/whatsapp/src/action-runtime-target-auth.d.ts +0 -10
- package/dist/plugin-sdk/extensions/whatsapp/src/action-runtime.d.ts +0 -9
- package/dist/plugin-sdk/extensions/whatsapp/src/agent-tools-login.d.ts +0 -2
- package/dist/plugin-sdk/extensions/whatsapp/src/auth-store.d.ts +0 -31
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/constants.d.ts +0 -1
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/deliver-reply.d.ts +0 -19
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/heartbeat-runner.d.ts +0 -20
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/loggers.d.ts +0 -4
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/mentions.d.ts +0 -19
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/monitor/ack-reaction.d.ts +0 -13
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/monitor/broadcast.d.ts +0 -16
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/monitor/commands.d.ts +0 -2
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/monitor/echo.d.ts +0 -17
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/monitor/group-activation.d.ts +0 -9
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/monitor/group-gating.d.ts +0 -33
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/monitor/group-members.d.ts +0 -6
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/monitor/inbound-context.d.ts +0 -28
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.d.ts +0 -140
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/monitor/last-route.d.ts +0 -15
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/monitor/message-line.d.ts +0 -11
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/monitor/on-message.d.ts +0 -24
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/monitor/peer.d.ts +0 -2
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/monitor/process-message.d.ts +0 -31
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/monitor/runtime-api.d.ts +0 -14
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/monitor-state.d.ts +0 -18
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/monitor.d.ts +0 -5
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/session-snapshot.d.ts +0 -17
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/types.d.ts +0 -33
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply/util.d.ts +0 -2
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply.d.ts +0 -1
- package/dist/plugin-sdk/extensions/whatsapp/src/auto-reply.impl.d.ts +0 -6
- package/dist/plugin-sdk/extensions/whatsapp/src/channel.runtime.d.ts +0 -23
- package/dist/plugin-sdk/extensions/whatsapp/src/creds-files.d.ts +0 -3
- package/dist/plugin-sdk/extensions/whatsapp/src/directory-config.d.ts +0 -3
- package/dist/plugin-sdk/extensions/whatsapp/src/group-policy.d.ts +0 -14
- package/dist/plugin-sdk/extensions/whatsapp/src/identity.d.ts +0 -52
- package/dist/plugin-sdk/extensions/whatsapp/src/inbound/access-control.d.ts +0 -36
- package/dist/plugin-sdk/extensions/whatsapp/src/inbound/dedupe.d.ts +0 -12
- package/dist/plugin-sdk/extensions/whatsapp/src/inbound/extract.d.ts +0 -8
- package/dist/plugin-sdk/extensions/whatsapp/src/inbound/lifecycle.d.ts +0 -14
- package/dist/plugin-sdk/extensions/whatsapp/src/inbound/media.d.ts +0 -7
- package/dist/plugin-sdk/extensions/whatsapp/src/inbound/monitor.d.ts +0 -32
- package/dist/plugin-sdk/extensions/whatsapp/src/inbound/send-api.d.ts +0 -22
- package/dist/plugin-sdk/extensions/whatsapp/src/inbound/types.d.ts +0 -48
- package/dist/plugin-sdk/extensions/whatsapp/src/inbound.d.ts +0 -4
- package/dist/plugin-sdk/extensions/whatsapp/src/login-qr.d.ts +0 -19
- package/dist/plugin-sdk/extensions/whatsapp/src/login.d.ts +0 -3
- package/dist/plugin-sdk/extensions/whatsapp/src/media.d.ts +0 -2
- package/dist/plugin-sdk/extensions/whatsapp/src/normalize-target.d.ts +0 -3
- package/dist/plugin-sdk/extensions/whatsapp/src/normalize.d.ts +0 -2
- package/dist/plugin-sdk/extensions/whatsapp/src/qr-image.d.ts +0 -1
- package/dist/plugin-sdk/extensions/whatsapp/src/reaction-level.d.ts +0 -9
- package/dist/plugin-sdk/extensions/whatsapp/src/reconnect.d.ts +0 -11
- package/dist/plugin-sdk/extensions/whatsapp/src/resolve-outbound-target.d.ts +0 -12
- package/dist/plugin-sdk/extensions/whatsapp/src/runtime-api.d.ts +0 -16
- package/dist/plugin-sdk/extensions/whatsapp/src/send.d.ts +0 -32
- package/dist/plugin-sdk/extensions/whatsapp/src/session-errors.d.ts +0 -2
- package/dist/plugin-sdk/extensions/whatsapp/src/session.d.ts +0 -17
- package/dist/plugin-sdk/extensions/whatsapp/src/setup-core.d.ts +0 -2
- package/dist/plugin-sdk/extensions/whatsapp/src/setup-surface.d.ts +0 -2
- package/dist/plugin-sdk/extensions/whatsapp/src/vcard.d.ts +0 -6
- package/dist/plugin-sdk/extensions/xai/api.d.ts +0 -27
- package/dist/plugin-sdk/extensions/xai/model-definitions.d.ts +0 -13
- package/dist/plugin-sdk/extensions/xai/model-id.d.ts +0 -1
- package/dist/plugin-sdk/extensions/xai/onboard.d.ts +0 -5
- package/dist/plugin-sdk/extensions/xai/provider-catalog.d.ts +0 -2
- package/dist/plugin-sdk/extensions/xai/provider-models.d.ts +0 -6
- package/dist/plugin-sdk/extensions/xiaomi/api.d.ts +0 -2
- package/dist/plugin-sdk/extensions/xiaomi/onboard.d.ts +0 -4
- package/dist/plugin-sdk/extensions/xiaomi/provider-catalog.d.ts +0 -3
- package/dist/plugin-sdk/extensions/zai/api.d.ts +0 -2
- package/dist/plugin-sdk/extensions/zai/model-definitions.d.ts +0 -23
- package/dist/plugin-sdk/extensions/zai/onboard.d.ts +0 -10
- package/dist/plugin-sdk/extensions/zalo/api.d.ts +0 -3
- package/dist/plugin-sdk/extensions/zalo/runtime-api.d.ts +0 -1
- package/dist/plugin-sdk/extensions/zalo/src/accounts.d.ts +0 -11
- package/dist/plugin-sdk/extensions/zalo/src/group-access.d.ts +0 -17
- package/dist/plugin-sdk/extensions/zalo/src/runtime-api.d.ts +0 -1
- package/dist/plugin-sdk/extensions/zalo/src/secret-input.d.ts +0 -1
- package/dist/plugin-sdk/extensions/zalo/src/setup-core.d.ts +0 -1
- package/dist/plugin-sdk/extensions/zalo/src/setup-surface.d.ts +0 -3
- package/dist/plugin-sdk/extensions/zalo/src/token.d.ts +0 -8
- package/dist/plugin-sdk/extensions/zalo/src/types.d.ts +0 -46
- package/dist/plugin-sdk/feishu-conversation.d.ts +0 -1
- package/dist/plugin-sdk/feishu-setup.d.ts +0 -1
- package/dist/plugin-sdk/feishu.d.ts +0 -1
- package/dist/plugin-sdk/fetch-runtime.d.ts +0 -1
- package/dist/plugin-sdk/file-lock.d.ts +0 -1
- package/dist/plugin-sdk/gateway-runtime.d.ts +0 -1
- package/dist/plugin-sdk/github-copilot-login.d.ts +0 -1
- package/dist/plugin-sdk/github-copilot-token.d.ts +0 -1
- package/dist/plugin-sdk/global-singleton.d.ts +0 -1
- package/dist/plugin-sdk/google.d.ts +0 -1
- package/dist/plugin-sdk/googlechat.d.ts +0 -1
- package/dist/plugin-sdk/group-access.d.ts +0 -1
- package/dist/plugin-sdk/hook-runtime.d.ts +0 -1
- package/dist/plugin-sdk/host-runtime.d.ts +0 -1
- package/dist/plugin-sdk/huggingface.d.ts +0 -1
- package/dist/plugin-sdk/image-generation-core.d.ts +0 -1
- package/dist/plugin-sdk/image-generation.d.ts +0 -1
- package/dist/plugin-sdk/index.d.ts +0 -1
- package/dist/plugin-sdk/infra-runtime.d.ts +0 -1
- package/dist/plugin-sdk/interactive-runtime.d.ts +0 -1
- package/dist/plugin-sdk/irc-surface.d.ts +0 -1
- package/dist/plugin-sdk/irc.d.ts +0 -1
- package/dist/plugin-sdk/json-store.d.ts +0 -1
- package/dist/plugin-sdk/keyed-async-queue.d.ts +0 -1
- package/dist/plugin-sdk/kilocode.d.ts +0 -1
- package/dist/plugin-sdk/kimi-coding.d.ts +0 -1
- package/dist/plugin-sdk/lazy-runtime.d.ts +0 -1
- package/dist/plugin-sdk/line-core.d.ts +0 -1
- package/dist/plugin-sdk/line-runtime.d.ts +0 -1
- package/dist/plugin-sdk/line-surface.d.ts +0 -1
- package/dist/plugin-sdk/line.d.ts +0 -1
- package/dist/plugin-sdk/llm-task.d.ts +0 -1
- package/dist/plugin-sdk/logging-core.d.ts +0 -1
- package/dist/plugin-sdk/markdown-table-runtime.d.ts +0 -1
- package/dist/plugin-sdk/matrix-helper.d.ts +0 -1
- package/dist/plugin-sdk/matrix-runtime-heavy.d.ts +0 -1
- package/dist/plugin-sdk/matrix-runtime-shared.d.ts +0 -1
- package/dist/plugin-sdk/matrix-runtime-surface.d.ts +0 -1
- package/dist/plugin-sdk/matrix-surface.d.ts +0 -1
- package/dist/plugin-sdk/matrix-thread-bindings.d.ts +0 -1
- package/dist/plugin-sdk/matrix.d.ts +0 -1
- package/dist/plugin-sdk/mattermost-policy.d.ts +0 -1
- package/dist/plugin-sdk/mattermost.d.ts +0 -1
- package/dist/plugin-sdk/media-runtime.d.ts +0 -1
- package/dist/plugin-sdk/media-understanding-runtime.d.ts +0 -1
- package/dist/plugin-sdk/media-understanding.d.ts +0 -1
- package/dist/plugin-sdk/memory-core-engine-runtime.d.ts +0 -1
- package/dist/plugin-sdk/memory-core-host-engine-embeddings.d.ts +0 -1
- package/dist/plugin-sdk/memory-core-host-engine-foundation.d.ts +0 -1
- package/dist/plugin-sdk/memory-core-host-engine-qmd.d.ts +0 -1
- package/dist/plugin-sdk/memory-core-host-engine-storage.d.ts +0 -1
- package/dist/plugin-sdk/memory-core-host-multimodal.d.ts +0 -1
- package/dist/plugin-sdk/memory-core-host-query.d.ts +0 -1
- package/dist/plugin-sdk/memory-core-host-runtime-cli.d.ts +0 -1
- package/dist/plugin-sdk/memory-core-host-runtime-core.d.ts +0 -1
- package/dist/plugin-sdk/memory-core-host-runtime-files.d.ts +0 -1
- package/dist/plugin-sdk/memory-core-host-secret.d.ts +0 -1
- package/dist/plugin-sdk/memory-core-host-status.d.ts +0 -1
- package/dist/plugin-sdk/memory-core.d.ts +0 -1
- package/dist/plugin-sdk/memory-lancedb.d.ts +0 -1
- package/dist/plugin-sdk/minimax.d.ts +0 -1
- package/dist/plugin-sdk/mistral.d.ts +0 -1
- package/dist/plugin-sdk/models-provider-runtime.d.ts +0 -1
- package/dist/plugin-sdk/modelstudio-definitions.d.ts +0 -1
- package/dist/plugin-sdk/modelstudio.d.ts +0 -1
- package/dist/plugin-sdk/moonshot.d.ts +0 -1
- package/dist/plugin-sdk/msteams.d.ts +0 -1
- package/dist/plugin-sdk/native-command-registry.d.ts +0 -1
- package/dist/plugin-sdk/nextcloud-talk.d.ts +0 -1
- package/dist/plugin-sdk/nostr.d.ts +0 -1
- package/dist/plugin-sdk/nvidia.d.ts +0 -1
- package/dist/plugin-sdk/ollama-surface.d.ts +0 -1
- package/dist/plugin-sdk/ollama.d.ts +0 -1
- package/dist/plugin-sdk/openai.d.ts +0 -1
- package/dist/plugin-sdk/opencode-go.d.ts +0 -1
- package/dist/plugin-sdk/opencode.d.ts +0 -1
- package/dist/plugin-sdk/outbound-runtime.d.ts +0 -1
- package/dist/plugin-sdk/packages/memory-host-sdk/src/engine-embeddings.d.ts +0 -16
- package/dist/plugin-sdk/packages/memory-host-sdk/src/engine-foundation.d.ts +0 -20
- package/dist/plugin-sdk/packages/memory-host-sdk/src/engine-qmd.d.ts +0 -5
- package/dist/plugin-sdk/packages/memory-host-sdk/src/engine.d.ts +0 -4
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/batch-embedding-common.d.ts +0 -9
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/batch-error-utils.d.ts +0 -15
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/batch-gemini.d.ts +0 -46
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/batch-http.d.ts +0 -8
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/batch-openai.d.ts +0 -19
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/batch-output.d.ts +0 -23
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/batch-provider-common.d.ts +0 -9
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/batch-runner.d.ts +0 -38
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/batch-status.d.ts +0 -27
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/batch-upload.d.ts +0 -6
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/batch-utils.d.ts +0 -11
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/batch-voyage.d.ts +0 -29
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/embedding-chunk-limits.d.ts +0 -3
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/embedding-model-limits.d.ts +0 -2
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/embedding-vectors.d.ts +0 -1
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/embeddings-debug.d.ts +0 -1
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/embeddings-gemini.d.ts +0 -63
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/embeddings-mistral.d.ts +0 -15
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/embeddings-model-normalize.d.ts +0 -5
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/embeddings-ollama.d.ts +0 -2
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/embeddings-openai.d.ts +0 -15
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/embeddings-remote-client.d.ts +0 -12
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/embeddings-remote-fetch.d.ts +0 -8
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/embeddings-remote-provider.d.ts +0 -21
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/embeddings-voyage.d.ts +0 -15
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/embeddings.d.ts +0 -59
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/node-llama.d.ts +0 -8
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/post-json.d.ts +0 -10
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/qmd-process.d.ts +0 -34
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/qmd-query-parser.d.ts +0 -11
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/qmd-scope.d.ts +0 -4
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/remote-http.d.ts +0 -9
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/secret-input.d.ts +0 -5
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/session-files.d.ts +0 -14
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/status-format.d.ts +0 -28
- package/dist/plugin-sdk/packages/memory-host-sdk/src/host/test-helpers/ssrf.d.ts +0 -2
- package/dist/plugin-sdk/packages/memory-host-sdk/src/runtime-cli.d.ts +0 -9
- package/dist/plugin-sdk/packages/memory-host-sdk/src/runtime-core.d.ts +0 -17
- package/dist/plugin-sdk/packages/memory-host-sdk/src/runtime-files.d.ts +0 -4
- package/dist/plugin-sdk/packages/memory-host-sdk/src/runtime.d.ts +0 -3
- package/dist/plugin-sdk/packages/memory-host-sdk/src/secret.d.ts +0 -1
- package/dist/plugin-sdk/packages/memory-host-sdk/src/status.d.ts +0 -1
- package/dist/plugin-sdk/param-readers.d.ts +0 -1
- package/dist/plugin-sdk/plugin-entry.d.ts +0 -1
- package/dist/plugin-sdk/plugin-runtime.d.ts +0 -1
- package/dist/plugin-sdk/process-runtime.d.ts +0 -1
- package/dist/plugin-sdk/provider-auth-api-key.d.ts +0 -1
- package/dist/plugin-sdk/provider-auth-login.d.ts +0 -1
- package/dist/plugin-sdk/provider-auth-result.d.ts +0 -1
- package/dist/plugin-sdk/provider-auth-runtime.d.ts +0 -1
- package/dist/plugin-sdk/provider-auth.d.ts +0 -1
- package/dist/plugin-sdk/provider-catalog-shared.d.ts +0 -1
- package/dist/plugin-sdk/provider-entry.d.ts +0 -1
- package/dist/plugin-sdk/provider-env-vars.d.ts +0 -1
- package/dist/plugin-sdk/provider-http.d.ts +0 -1
- package/dist/plugin-sdk/provider-model-shared.d.ts +0 -1
- package/dist/plugin-sdk/provider-moonshot.d.ts +0 -1
- package/dist/plugin-sdk/provider-onboard.d.ts +0 -1
- package/dist/plugin-sdk/provider-setup.d.ts +0 -1
- package/dist/plugin-sdk/provider-stream.d.ts +0 -1
- package/dist/plugin-sdk/provider-tools.d.ts +0 -1
- package/dist/plugin-sdk/provider-usage.d.ts +0 -1
- package/dist/plugin-sdk/provider-web-fetch.d.ts +0 -1
- package/dist/plugin-sdk/provider-web-search.d.ts +0 -1
- package/dist/plugin-sdk/provider-zai-endpoint.d.ts +0 -1
- package/dist/plugin-sdk/qianfan.d.ts +0 -1
- package/dist/plugin-sdk/reply-chunking.d.ts +0 -1
- package/dist/plugin-sdk/reply-dispatch-runtime.d.ts +0 -1
- package/dist/plugin-sdk/reply-history.d.ts +0 -1
- package/dist/plugin-sdk/reply-payload.d.ts +0 -1
- package/dist/plugin-sdk/reply-runtime.d.ts +0 -1
- package/dist/plugin-sdk/request-url.d.ts +0 -1
- package/dist/plugin-sdk/retry-runtime.d.ts +0 -1
- package/dist/plugin-sdk/routing.d.ts +0 -1
- package/dist/plugin-sdk/runtime-config-snapshot.d.ts +0 -1
- package/dist/plugin-sdk/runtime-env.d.ts +0 -1
- package/dist/plugin-sdk/runtime-group-policy.d.ts +0 -1
- package/dist/plugin-sdk/runtime-store.d.ts +0 -1
- package/dist/plugin-sdk/runtime.d.ts +0 -1
- package/dist/plugin-sdk/sandbox.d.ts +0 -1
- package/dist/plugin-sdk/scripts/lib/plugin-sdk-doc-metadata.d.ts +0 -64
- package/dist/plugin-sdk/secret-input.d.ts +0 -1
- package/dist/plugin-sdk/security-runtime.d.ts +0 -1
- package/dist/plugin-sdk/self-hosted-provider-setup.d.ts +0 -1
- package/dist/plugin-sdk/session-store-runtime.d.ts +0 -1
- package/dist/plugin-sdk/setup-adapter-runtime.d.ts +0 -1
- package/dist/plugin-sdk/setup-runtime.d.ts +0 -1
- package/dist/plugin-sdk/setup-tools.d.ts +0 -1
- package/dist/plugin-sdk/setup.d.ts +0 -1
- package/dist/plugin-sdk/sglang.d.ts +0 -1
- package/dist/plugin-sdk/signal-account.d.ts +0 -1
- package/dist/plugin-sdk/signal-surface.d.ts +0 -1
- package/dist/plugin-sdk/signal.d.ts +0 -1
- package/dist/plugin-sdk/skill-commands-runtime.d.ts +0 -1
- package/dist/plugin-sdk/slack-account.d.ts +0 -1
- package/dist/plugin-sdk/slack-core.d.ts +0 -1
- package/dist/plugin-sdk/slack-runtime-surface.d.ts +0 -1
- package/dist/plugin-sdk/slack-surface.d.ts +0 -1
- package/dist/plugin-sdk/slack-target-parser.d.ts +0 -1
- package/dist/plugin-sdk/slack-targets.d.ts +0 -1
- package/dist/plugin-sdk/slack.d.ts +0 -1
- package/dist/plugin-sdk/speech-core.d.ts +0 -1
- package/dist/plugin-sdk/speech-runtime.d.ts +0 -1
- package/dist/plugin-sdk/speech.d.ts +0 -1
- package/dist/plugin-sdk/src/acp/runtime/adapter-contract.testkit.d.ts +0 -14
- package/dist/plugin-sdk/src/agents/auth-profiles/upsert-with-lock.d.ts +0 -6
- package/dist/plugin-sdk/src/agents/live-test-helpers.d.ts +0 -12
- package/dist/plugin-sdk/src/agents/model-allowlist-ref.d.ts +0 -1
- package/dist/plugin-sdk/src/agents/model-catalog.d.ts +0 -35
- package/dist/plugin-sdk/src/agents/model-suppression.runtime.d.ts +0 -3
- package/dist/plugin-sdk/src/agents/openclaw-tools.runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/openrouter-model-capabilities.d.ts +0 -53
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/proxy-stream-wrappers.d.ts +0 -6
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/zai-stream-wrappers.d.ts +0 -7
- package/dist/plugin-sdk/src/agents/pi-embedded.runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/agents/sandbox/test-fixtures.d.ts +0 -5
- package/dist/plugin-sdk/src/agents/self-hosted-provider-defaults.d.ts +0 -8
- package/dist/plugin-sdk/src/agents/simple-completion-transport.d.ts +0 -6
- package/dist/plugin-sdk/src/agents/skills.e2e-test-helpers.d.ts +0 -8
- package/dist/plugin-sdk/src/auto-reply/chunk.d.ts +0 -45
- package/dist/plugin-sdk/src/auto-reply/dispatch.d.ts +0 -32
- package/dist/plugin-sdk/src/auto-reply/heartbeat-reply-payload.d.ts +0 -2
- package/dist/plugin-sdk/src/auto-reply/media-note.d.ts +0 -2
- package/dist/plugin-sdk/src/auto-reply/reply/abort-cutoff.runtime.d.ts +0 -7
- package/dist/plugin-sdk/src/auto-reply/reply/abort.d.ts +0 -40
- package/dist/plugin-sdk/src/auto-reply/reply/abort.runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/auto-reply/reply/acp-projector.d.ts +0 -21
- package/dist/plugin-sdk/src/auto-reply/reply/acp-stream-settings.d.ts +0 -24
- package/dist/plugin-sdk/src/auto-reply/reply/agent-runner-helpers.d.ts +0 -15
- package/dist/plugin-sdk/src/auto-reply/reply/agent-runner-memory.d.ts +0 -42
- package/dist/plugin-sdk/src/auto-reply/reply/agent-runner-payloads.d.ts +0 -29
- package/dist/plugin-sdk/src/auto-reply/reply/agent-runner-reminder-guard.d.ts +0 -13
- package/dist/plugin-sdk/src/auto-reply/reply/agent-runner-usage-line.d.ts +0 -17
- package/dist/plugin-sdk/src/auto-reply/reply/agent-runner.d.ts +0 -39
- package/dist/plugin-sdk/src/auto-reply/reply/agent-runner.runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/auto-reply/reply/auto-topic-label-config.d.ts +0 -14
- package/dist/plugin-sdk/src/auto-reply/reply/auto-topic-label.d.ts +0 -26
- package/dist/plugin-sdk/src/auto-reply/reply/body.d.ts +0 -10
- package/dist/plugin-sdk/src/auto-reply/reply/commands-core.d.ts +0 -13
- package/dist/plugin-sdk/src/auto-reply/reply/commands-core.runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/auto-reply/reply/commands-handlers.runtime.d.ts +0 -2
- package/dist/plugin-sdk/src/auto-reply/reply/commands-session-abort.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-session-store.d.ts +0 -13
- package/dist/plugin-sdk/src/auto-reply/reply/commands-session.d.ts +0 -9
- package/dist/plugin-sdk/src/auto-reply/reply/commands-spawn.test-harness.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-agents.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-focus.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-help.d.ts +0 -2
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-info.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-kill.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-list.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-log.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-send.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-spawn.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-unfocus.d.ts +0 -3
- package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents.d.ts +0 -4
- package/dist/plugin-sdk/src/auto-reply/reply/commands-tasks.d.ts +0 -8
- package/dist/plugin-sdk/src/auto-reply/reply/commands-tts.d.ts +0 -2
- package/dist/plugin-sdk/src/auto-reply/reply/commands.d.ts +0 -4
- package/dist/plugin-sdk/src/auto-reply/reply/commands.runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/auto-reply/reply/commands.test-harness.d.ts +0 -6
- package/dist/plugin-sdk/src/auto-reply/reply/dispatch-acp-delivery.d.ts +0 -35
- package/dist/plugin-sdk/src/auto-reply/reply/dispatch-acp.d.ts +0 -34
- package/dist/plugin-sdk/src/auto-reply/reply/dispatch-acp.runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/auto-reply/reply/dispatch-from-config.d.ts +0 -17
- package/dist/plugin-sdk/src/auto-reply/reply/exec.d.ts +0 -1
- package/dist/plugin-sdk/src/auto-reply/reply/followup-runner.d.ts +0 -16
- package/dist/plugin-sdk/src/auto-reply/reply/get-reply-from-config.runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/auto-reply/reply/get-reply-inline-actions.d.ts +0 -62
- package/dist/plugin-sdk/src/auto-reply/reply/get-reply-run.d.ts +0 -69
- package/dist/plugin-sdk/src/auto-reply/reply/get-reply.d.ts +0 -4
- package/dist/plugin-sdk/src/auto-reply/reply/history.d.ts +0 -72
- package/dist/plugin-sdk/src/auto-reply/reply/inbound-meta.d.ts +0 -4
- package/dist/plugin-sdk/src/auto-reply/reply/matrix-context.d.ts +0 -13
- package/dist/plugin-sdk/src/auto-reply/reply/memory-flush.d.ts +0 -48
- package/dist/plugin-sdk/src/auto-reply/reply/message-preprocess-hooks.d.ts +0 -7
- package/dist/plugin-sdk/src/auto-reply/reply/queue-policy.d.ts +0 -8
- package/dist/plugin-sdk/src/auto-reply/reply/reply-payloads-dedupe.runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/auto-reply/reply/reply-reference.d.ts +0 -20
- package/dist/plugin-sdk/src/auto-reply/reply/session-delivery.d.ts +0 -30
- package/dist/plugin-sdk/src/auto-reply/reply/session-fork.d.ts +0 -11
- package/dist/plugin-sdk/src/auto-reply/reply/session-fork.runtime.d.ts +0 -9
- package/dist/plugin-sdk/src/auto-reply/reply/session-reset-model.d.ts +0 -27
- package/dist/plugin-sdk/src/auto-reply/reply/session-reset-model.runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/auto-reply/reply/session-reset-prompt.d.ts +0 -9
- package/dist/plugin-sdk/src/auto-reply/reply/session-run-accounting.d.ts +0 -15
- package/dist/plugin-sdk/src/auto-reply/reply/session-updates.runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/auto-reply/reply/session-usage.d.ts +0 -25
- package/dist/plugin-sdk/src/auto-reply/reply/session.d.ts +0 -26
- package/dist/plugin-sdk/src/auto-reply/reply/stage-sandbox-media.d.ts +0 -9
- package/dist/plugin-sdk/src/auto-reply/reply/stage-sandbox-media.runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/auto-reply/reply/untrusted-context.d.ts +0 -1
- package/dist/plugin-sdk/src/auto-reply/reply.d.ts +0 -6
- package/dist/plugin-sdk/src/auto-reply/send-policy.d.ts +0 -6
- package/dist/plugin-sdk/src/channel-web.d.ts +0 -5
- package/dist/plugin-sdk/src/channels/draft-stream-controls.d.ts +0 -54
- package/dist/plugin-sdk/src/channels/draft-stream-loop.d.ts +0 -13
- package/dist/plugin-sdk/src/channels/native-command-session-targets.d.ts +0 -12
- package/dist/plugin-sdk/src/channels/plugins/actions/reaction-message-id.d.ts +0 -8
- package/dist/plugin-sdk/src/channels/plugins/actions/shared.d.ts +0 -7
- package/dist/plugin-sdk/src/channels/plugins/bluebubbles-actions.d.ts +0 -48
- package/dist/plugin-sdk/src/channels/plugins/bundled.d.ts +0 -7
- package/dist/plugin-sdk/src/channels/plugins/contracts/inbound-testkit.d.ts +0 -70
- package/dist/plugin-sdk/src/channels/plugins/contracts/suites.d.ts +0 -129
- package/dist/plugin-sdk/src/channels/plugins/pairing-adapters.d.ts +0 -13
- package/dist/plugin-sdk/src/channels/plugins/setup-registry.d.ts +0 -3
- package/dist/plugin-sdk/src/channels/plugins/status-issues/bluebubbles.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/plugins/types.adapters.d.ts +0 -694
- package/dist/plugin-sdk/src/channels/plugins/types.d.ts +0 -8
- package/dist/plugin-sdk/src/channels/plugins/whatsapp-shared.d.ts +0 -44
- package/dist/plugin-sdk/src/channels/registry.d.ts +0 -13
- package/dist/plugin-sdk/src/channels/run-state-machine.d.ts +0 -19
- package/dist/plugin-sdk/src/channels/sender-identity.d.ts +0 -2
- package/dist/plugin-sdk/src/channels/status-reactions.d.ts +0 -66
- package/dist/plugin-sdk/src/channels/transport/stall-watchdog.d.ts +0 -20
- package/dist/plugin-sdk/src/cli/cli-utils.d.ts +0 -19
- package/dist/plugin-sdk/src/cli/command-options.d.ts +0 -3
- package/dist/plugin-sdk/src/cli/deps.d.ts +0 -10
- package/dist/plugin-sdk/src/cli/gateway-rpc.d.ts +0 -13
- package/dist/plugin-sdk/src/cli/help-format.d.ts +0 -5
- package/dist/plugin-sdk/src/cli/progress.d.ts +0 -24
- package/dist/plugin-sdk/src/cli/send-runtime/discord.d.ts +0 -3
- package/dist/plugin-sdk/src/cli/send-runtime/imessage.d.ts +0 -12
- package/dist/plugin-sdk/src/cli/send-runtime/signal.d.ts +0 -3
- package/dist/plugin-sdk/src/cli/send-runtime/slack.d.ts +0 -3
- package/dist/plugin-sdk/src/cli/send-runtime/telegram.d.ts +0 -16
- package/dist/plugin-sdk/src/cli/send-runtime/whatsapp.d.ts +0 -4
- package/dist/plugin-sdk/src/cli/test-runtime-capture.d.ts +0 -31
- package/dist/plugin-sdk/src/commands/backup-shared.d.ts +0 -32
- package/dist/plugin-sdk/src/commands/channel-setup/registry.d.ts +0 -6
- package/dist/plugin-sdk/src/commands/channel-setup/types.d.ts +0 -1
- package/dist/plugin-sdk/src/commands/channel-test-helpers.d.ts +0 -7
- package/dist/plugin-sdk/src/commands/chutes-oauth.d.ts +0 -21
- package/dist/plugin-sdk/src/commands/cleanup-utils.d.ts +0 -36
- package/dist/plugin-sdk/src/commands/daemon-runtime.d.ts +0 -8
- package/dist/plugin-sdk/src/commands/health.d.ts +0 -63
- package/dist/plugin-sdk/src/commands/onboard-types.d.ts +0 -95
- package/dist/plugin-sdk/src/config/backup-rotation.d.ts +0 -58
- package/dist/plugin-sdk/src/config/config.d.ts +0 -8
- package/dist/plugin-sdk/src/config/env-preserve.d.ts +0 -10
- package/dist/plugin-sdk/src/config/includes.d.ts +0 -43
- package/dist/plugin-sdk/src/config/io.d.ts +0 -93
- package/dist/plugin-sdk/src/config/paths.d.ts +0 -58
- package/dist/plugin-sdk/src/config/types.agent-defaults.d.ts +0 -377
- package/dist/plugin-sdk/src/config/types.channel-messaging-common.d.ts +0 -53
- package/dist/plugin-sdk/src/config/types.d.ts +0 -34
- package/dist/plugin-sdk/src/config/types.googlechat.d.ts +0 -120
- package/dist/plugin-sdk/src/config/types.imessage.d.ts +0 -88
- package/dist/plugin-sdk/src/config/types.irc.d.ts +0 -61
- package/dist/plugin-sdk/src/config/types.msteams.d.ts +0 -132
- package/dist/plugin-sdk/src/config/types.signal.d.ts +0 -65
- package/dist/plugin-sdk/src/context-engine/registry.d.ts +0 -47
- package/dist/plugin-sdk/src/cron/delivery.d.ts +0 -33
- package/dist/plugin-sdk/src/cron/isolated-agent/delivery-target.d.ts +0 -27
- package/dist/plugin-sdk/src/cron/isolated-agent/session.d.ts +0 -15
- package/dist/plugin-sdk/src/cron/schedule.d.ts +0 -6
- package/dist/plugin-sdk/src/cron/service/initial-delivery.d.ts +0 -2
- package/dist/plugin-sdk/src/cron/service/jobs.d.ts +0 -33
- package/dist/plugin-sdk/src/cron/service/locked.d.ts +0 -2
- package/dist/plugin-sdk/src/cron/service/ops.d.ts +0 -84
- package/dist/plugin-sdk/src/cron/service/state.d.ts +0 -158
- package/dist/plugin-sdk/src/cron/service/store.d.ts +0 -11
- package/dist/plugin-sdk/src/cron/service/timeout-policy.d.ts +0 -13
- package/dist/plugin-sdk/src/cron/service/timer.d.ts +0 -46
- package/dist/plugin-sdk/src/cron/service.d.ts +0 -69
- package/dist/plugin-sdk/src/cron/session-reaper.d.ts +0 -35
- package/dist/plugin-sdk/src/gateway/auth-mode-policy.d.ts +0 -4
- package/dist/plugin-sdk/src/gateway/channel-status-patches.d.ts +0 -6
- package/dist/plugin-sdk/src/gateway/chat-abort.d.ts +0 -47
- package/dist/plugin-sdk/src/gateway/exec-approval-manager.d.ts +0 -47
- package/dist/plugin-sdk/src/gateway/node-command-policy.d.ts +0 -18
- package/dist/plugin-sdk/src/gateway/security-path.d.ts +0 -20
- package/dist/plugin-sdk/src/gateway/server-broadcast.d.ts +0 -17
- package/dist/plugin-sdk/src/gateway/server-channels.d.ts +0 -78
- package/dist/plugin-sdk/src/gateway/server-constants.d.ts +0 -9
- package/dist/plugin-sdk/src/gateway/server-methods/nodes.helpers.d.ts +0 -20
- package/dist/plugin-sdk/src/gateway/server-methods/types.d.ts +0 -108
- package/dist/plugin-sdk/src/gateway/server-shared.d.ts +0 -7
- package/dist/plugin-sdk/src/gateway/startup-auth.d.ts +0 -21
- package/dist/plugin-sdk/src/gateway/ws-log.d.ts +0 -5
- package/dist/plugin-sdk/src/gateway/ws-logging.d.ts +0 -4
- package/dist/plugin-sdk/src/generated/plugin-sdk-facade-type-map.generated.d.ts +0 -769
- package/dist/plugin-sdk/src/hooks/types.d.ts +0 -62
- package/dist/plugin-sdk/src/image-generation/provider-registry.d.ts +0 -4
- package/dist/plugin-sdk/src/infra/backup-create.d.ts +0 -29
- package/dist/plugin-sdk/src/infra/device-bootstrap.d.ts +0 -46
- package/dist/plugin-sdk/src/infra/device-pairing.d.ts +0 -122
- package/dist/plugin-sdk/src/infra/dotenv.d.ts +0 -9
- package/dist/plugin-sdk/src/infra/gemini-auth.d.ts +0 -16
- package/dist/plugin-sdk/src/infra/google-api-base-url.d.ts +0 -2
- package/dist/plugin-sdk/src/infra/heartbeat-active-hours.d.ts +0 -5
- package/dist/plugin-sdk/src/infra/heartbeat-events-filter.d.ts +0 -8
- package/dist/plugin-sdk/src/infra/heartbeat-runner.d.ts +0 -35
- package/dist/plugin-sdk/src/infra/heartbeat-summary.d.ts +0 -16
- package/dist/plugin-sdk/src/infra/http-body.d.ts +0 -46
- package/dist/plugin-sdk/src/infra/matrix-legacy-crypto.d.ts +0 -41
- package/dist/plugin-sdk/src/infra/matrix-legacy-state.d.ts +0 -30
- package/dist/plugin-sdk/src/infra/matrix-migration-config.d.ts +0 -48
- package/dist/plugin-sdk/src/infra/matrix-migration-snapshot.d.ts +0 -25
- package/dist/plugin-sdk/src/infra/matrix-plugin-helper.d.ts +0 -29
- package/dist/plugin-sdk/src/infra/outbound/deliver.d.ts +0 -50
- package/dist/plugin-sdk/src/infra/outbound/delivery-queue-recovery.d.ts +0 -41
- package/dist/plugin-sdk/src/infra/outbound/delivery-queue-storage.d.ts +0 -50
- package/dist/plugin-sdk/src/infra/outbound/delivery-queue.d.ts +0 -4
- package/dist/plugin-sdk/src/infra/outbound/sanitize-text.d.ts +0 -23
- package/dist/plugin-sdk/src/infra/session-maintenance-warning.d.ts +0 -15
- package/dist/plugin-sdk/src/link-understanding/apply.d.ts +0 -10
- package/dist/plugin-sdk/src/link-understanding/apply.runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/link-understanding/defaults.d.ts +0 -2
- package/dist/plugin-sdk/src/link-understanding/detect.d.ts +0 -3
- package/dist/plugin-sdk/src/link-understanding/format.d.ts +0 -4
- package/dist/plugin-sdk/src/link-understanding/runner.d.ts +0 -11
- package/dist/plugin-sdk/src/media/file-context.d.ts +0 -7
- package/dist/plugin-sdk/src/media/input-files.d.ts +0 -99
- package/dist/plugin-sdk/src/media-understanding/apply.d.ts +0 -19
- package/dist/plugin-sdk/src/media-understanding/apply.runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/media-understanding/audio.test-helpers.d.ts +0 -27
- package/dist/plugin-sdk/src/media-understanding/concurrency.d.ts +0 -1
- package/dist/plugin-sdk/src/media-understanding/echo-transcript.d.ts +0 -13
- package/dist/plugin-sdk/src/media-understanding/format.d.ts +0 -7
- package/dist/plugin-sdk/src/media-understanding/runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/media-understanding/transcribe-audio.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/account-core.d.ts +0 -20
- package/dist/plugin-sdk/src/plugin-sdk/account-resolution.d.ts +0 -24
- package/dist/plugin-sdk/src/plugin-sdk/acp-runtime.d.ts +0 -16
- package/dist/plugin-sdk/src/plugin-sdk/acpx.d.ts +0 -8
- package/dist/plugin-sdk/src/plugin-sdk/agent-config-primitives.d.ts +0 -3
- package/dist/plugin-sdk/src/plugin-sdk/allowlist-config-edit.d.ts +0 -99
- package/dist/plugin-sdk/src/plugin-sdk/amazon-bedrock.d.ts +0 -9
- package/dist/plugin-sdk/src/plugin-sdk/api-baseline.d.ts +0 -43
- package/dist/plugin-sdk/src/plugin-sdk/bluebubbles-policy.d.ts +0 -7
- package/dist/plugin-sdk/src/plugin-sdk/bluebubbles.d.ts +0 -62
- package/dist/plugin-sdk/src/plugin-sdk/browser-support.d.ts +0 -54
- package/dist/plugin-sdk/src/plugin-sdk/browser.d.ts +0 -9
- package/dist/plugin-sdk/src/plugin-sdk/byteplus.d.ts +0 -11
- package/dist/plugin-sdk/src/plugin-sdk/channel-actions.d.ts +0 -8
- package/dist/plugin-sdk/src/plugin-sdk/channel-config-primitives.d.ts +0 -3
- package/dist/plugin-sdk/src/plugin-sdk/channel-config-schema.d.ts +0 -6
- package/dist/plugin-sdk/src/plugin-sdk/channel-config-writes.d.ts +0 -2
- package/dist/plugin-sdk/src/plugin-sdk/channel-feedback.d.ts +0 -4
- package/dist/plugin-sdk/src/plugin-sdk/channel-lifecycle.d.ts +0 -5
- package/dist/plugin-sdk/src/plugin-sdk/channel-pairing.d.ts +0 -24
- package/dist/plugin-sdk/src/plugin-sdk/channel-plugin-common.d.ts +0 -12
- package/dist/plugin-sdk/src/plugin-sdk/channel-setup.d.ts +0 -21
- package/dist/plugin-sdk/src/plugin-sdk/chutes.d.ts +0 -14
- package/dist/plugin-sdk/src/plugin-sdk/cli-backend.d.ts +0 -3
- package/dist/plugin-sdk/src/plugin-sdk/cloudflare-ai-gateway.d.ts +0 -12
- package/dist/plugin-sdk/src/plugin-sdk/collection-runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/command-auth-native.d.ts +0 -5
- package/dist/plugin-sdk/src/plugin-sdk/command-auth.d.ts +0 -65
- package/dist/plugin-sdk/src/plugin-sdk/command-detection.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/command-surface.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/compat.d.ts +0 -17
- package/dist/plugin-sdk/src/plugin-sdk/config-paths.d.ts +0 -7
- package/dist/plugin-sdk/src/plugin-sdk/copilot-proxy.d.ts +0 -2
- package/dist/plugin-sdk/src/plugin-sdk/dangerous-name-runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/deepseek.d.ts +0 -8
- package/dist/plugin-sdk/src/plugin-sdk/device-bootstrap.d.ts +0 -3
- package/dist/plugin-sdk/src/plugin-sdk/diagnostics-otel.d.ts +0 -6
- package/dist/plugin-sdk/src/plugin-sdk/diffs.d.ts +0 -4
- package/dist/plugin-sdk/src/plugin-sdk/discord-account.d.ts +0 -6
- package/dist/plugin-sdk/src/plugin-sdk/discord-runtime-surface.d.ts +0 -61
- package/dist/plugin-sdk/src/plugin-sdk/discord-send.d.ts +0 -36
- package/dist/plugin-sdk/src/plugin-sdk/entrypoints.d.ts +0 -17
- package/dist/plugin-sdk/src/plugin-sdk/extension-shared.d.ts +0 -67
- package/dist/plugin-sdk/src/plugin-sdk/feishu-conversation.d.ts +0 -11
- package/dist/plugin-sdk/src/plugin-sdk/feishu-setup.d.ts +0 -6
- package/dist/plugin-sdk/src/plugin-sdk/feishu.d.ts +0 -45
- package/dist/plugin-sdk/src/plugin-sdk/fetch-auth.d.ts +0 -14
- package/dist/plugin-sdk/src/plugin-sdk/gateway-runtime.d.ts +0 -4
- package/dist/plugin-sdk/src/plugin-sdk/github-copilot-login.d.ts +0 -5
- package/dist/plugin-sdk/src/plugin-sdk/github-copilot-token.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/global-singleton.d.ts +0 -2
- package/dist/plugin-sdk/src/plugin-sdk/google.d.ts +0 -18
- package/dist/plugin-sdk/src/plugin-sdk/googlechat.d.ts +0 -49
- package/dist/plugin-sdk/src/plugin-sdk/hook-runtime.d.ts +0 -3
- package/dist/plugin-sdk/src/plugin-sdk/host-runtime.d.ts +0 -2
- package/dist/plugin-sdk/src/plugin-sdk/huggingface.d.ts +0 -12
- package/dist/plugin-sdk/src/plugin-sdk/image-generation-core.d.ts +0 -15
- package/dist/plugin-sdk/src/plugin-sdk/image-generation.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/index.d.ts +0 -28
- package/dist/plugin-sdk/src/plugin-sdk/infra-runtime.d.ts +0 -47
- package/dist/plugin-sdk/src/plugin-sdk/irc-surface.d.ts +0 -9
- package/dist/plugin-sdk/src/plugin-sdk/irc.d.ts +0 -38
- package/dist/plugin-sdk/src/plugin-sdk/kilocode.d.ts +0 -17
- package/dist/plugin-sdk/src/plugin-sdk/kimi-coding.d.ts +0 -5
- package/dist/plugin-sdk/src/plugin-sdk/lazy-runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/line-core.d.ts +0 -11
- package/dist/plugin-sdk/src/plugin-sdk/line-runtime.d.ts +0 -75
- package/dist/plugin-sdk/src/plugin-sdk/litellm.d.ts +0 -10
- package/dist/plugin-sdk/src/plugin-sdk/llm-task.d.ts +0 -4
- package/dist/plugin-sdk/src/plugin-sdk/lobster.d.ts +0 -3
- package/dist/plugin-sdk/src/plugin-sdk/logging-core.d.ts +0 -3
- package/dist/plugin-sdk/src/plugin-sdk/markdown-table-runtime.d.ts +0 -2
- package/dist/plugin-sdk/src/plugin-sdk/matrix-helper.d.ts +0 -14
- package/dist/plugin-sdk/src/plugin-sdk/matrix-runtime-heavy.d.ts +0 -4
- package/dist/plugin-sdk/src/plugin-sdk/matrix-runtime-shared.d.ts +0 -6
- package/dist/plugin-sdk/src/plugin-sdk/matrix-runtime-surface.d.ts +0 -6
- package/dist/plugin-sdk/src/plugin-sdk/matrix-surface.d.ts +0 -7
- package/dist/plugin-sdk/src/plugin-sdk/matrix-thread-bindings.d.ts +0 -6
- package/dist/plugin-sdk/src/plugin-sdk/matrix.d.ts +0 -72
- package/dist/plugin-sdk/src/plugin-sdk/mattermost-policy.d.ts +0 -5
- package/dist/plugin-sdk/src/plugin-sdk/mattermost.d.ts +0 -50
- package/dist/plugin-sdk/src/plugin-sdk/memory-core-engine-runtime.d.ts +0 -9
- package/dist/plugin-sdk/src/plugin-sdk/memory-core-host-engine-embeddings.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/memory-core-host-engine-foundation.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/memory-core-host-engine-qmd.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/memory-core-host-runtime-cli.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/memory-core-host-runtime-core.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/memory-core-host-runtime-files.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/memory-core-host-secret.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/memory-core-host-status.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/memory-core.d.ts +0 -6
- package/dist/plugin-sdk/src/plugin-sdk/memory-lancedb.d.ts +0 -3
- package/dist/plugin-sdk/src/plugin-sdk/minimax.d.ts +0 -18
- package/dist/plugin-sdk/src/plugin-sdk/mistral.d.ts +0 -11
- package/dist/plugin-sdk/src/plugin-sdk/models-provider-runtime.d.ts +0 -2
- package/dist/plugin-sdk/src/plugin-sdk/modelstudio-definitions.d.ts +0 -13
- package/dist/plugin-sdk/src/plugin-sdk/modelstudio.d.ts +0 -18
- package/dist/plugin-sdk/src/plugin-sdk/moonshot.d.ts +0 -11
- package/dist/plugin-sdk/src/plugin-sdk/msteams.d.ts +0 -60
- package/dist/plugin-sdk/src/plugin-sdk/native-command-registry.d.ts +0 -2
- package/dist/plugin-sdk/src/plugin-sdk/nextcloud-talk.d.ts +0 -45
- package/dist/plugin-sdk/src/plugin-sdk/nostr.d.ts +0 -20
- package/dist/plugin-sdk/src/plugin-sdk/nvidia.d.ts +0 -5
- package/dist/plugin-sdk/src/plugin-sdk/ollama-surface.d.ts +0 -21
- package/dist/plugin-sdk/src/plugin-sdk/open-prose.d.ts +0 -2
- package/dist/plugin-sdk/src/plugin-sdk/openai.d.ts +0 -15
- package/dist/plugin-sdk/src/plugin-sdk/opencode-go.d.ts +0 -8
- package/dist/plugin-sdk/src/plugin-sdk/opencode.d.ts +0 -9
- package/dist/plugin-sdk/src/plugin-sdk/openrouter.d.ts +0 -8
- package/dist/plugin-sdk/src/plugin-sdk/optional-channel-setup.d.ts +0 -11
- package/dist/plugin-sdk/src/plugin-sdk/pairing-access.d.ts +0 -19
- package/dist/plugin-sdk/src/plugin-sdk/param-readers.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/persistent-dedupe.d.ts +0 -22
- package/dist/plugin-sdk/src/plugin-sdk/phone-control.d.ts +0 -2
- package/dist/plugin-sdk/src/plugin-sdk/plugin-runtime.d.ts +0 -8
- package/dist/plugin-sdk/src/plugin-sdk/process-runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/provider-auth-api-key.d.ts +0 -7
- package/dist/plugin-sdk/src/plugin-sdk/provider-auth-login.d.ts +0 -27
- package/dist/plugin-sdk/src/plugin-sdk/provider-auth-login.runtime.d.ts +0 -3
- package/dist/plugin-sdk/src/plugin-sdk/provider-catalog-shared.d.ts +0 -2
- package/dist/plugin-sdk/src/plugin-sdk/provider-entry.d.ts +0 -38
- package/dist/plugin-sdk/src/plugin-sdk/provider-env-vars.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/provider-moonshot.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/provider-onboard.d.ts +0 -85
- package/dist/plugin-sdk/src/plugin-sdk/provider-reasoning.d.ts +0 -5
- package/dist/plugin-sdk/src/plugin-sdk/provider-setup.d.ts +0 -2
- package/dist/plugin-sdk/src/plugin-sdk/provider-stream.d.ts +0 -8
- package/dist/plugin-sdk/src/plugin-sdk/provider-usage.d.ts +0 -4
- package/dist/plugin-sdk/src/plugin-sdk/provider-web-fetch.d.ts +0 -8
- package/dist/plugin-sdk/src/plugin-sdk/provider-zai-endpoint.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/qianfan.d.ts +0 -7
- package/dist/plugin-sdk/src/plugin-sdk/reply-chunking.d.ts +0 -4
- package/dist/plugin-sdk/src/plugin-sdk/reply-dispatch-runtime.d.ts +0 -4
- package/dist/plugin-sdk/src/plugin-sdk/reply-history.d.ts +0 -3
- package/dist/plugin-sdk/src/plugin-sdk/reply-runtime.d.ts +0 -21
- package/dist/plugin-sdk/src/plugin-sdk/request-url.d.ts +0 -2
- package/dist/plugin-sdk/src/plugin-sdk/resolution-notes.d.ts +0 -5
- package/dist/plugin-sdk/src/plugin-sdk/run-command.d.ts +0 -13
- package/dist/plugin-sdk/src/plugin-sdk/runtime-config-snapshot.d.ts +0 -2
- package/dist/plugin-sdk/src/plugin-sdk/runtime-group-policy.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/runtime-store.d.ts +0 -8
- package/dist/plugin-sdk/src/plugin-sdk/runtime.d.ts +0 -39
- package/dist/plugin-sdk/src/plugin-sdk/sandbox.d.ts +0 -5
- package/dist/plugin-sdk/src/plugin-sdk/secret-input-runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/security-runtime.d.ts +0 -5
- package/dist/plugin-sdk/src/plugin-sdk/self-hosted-provider-setup.d.ts +0 -2
- package/dist/plugin-sdk/src/plugin-sdk/session-store-runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/setup-adapter-runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/setup-runtime.d.ts +0 -11
- package/dist/plugin-sdk/src/plugin-sdk/setup-tools.d.ts +0 -4
- package/dist/plugin-sdk/src/plugin-sdk/setup.d.ts +0 -22
- package/dist/plugin-sdk/src/plugin-sdk/sglang.d.ts +0 -9
- package/dist/plugin-sdk/src/plugin-sdk/signal-account.d.ts +0 -6
- package/dist/plugin-sdk/src/plugin-sdk/signal-core.d.ts +0 -8
- package/dist/plugin-sdk/src/plugin-sdk/skill-commands-runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/slack-account.d.ts +0 -6
- package/dist/plugin-sdk/src/plugin-sdk/slack-core.d.ts +0 -6
- package/dist/plugin-sdk/src/plugin-sdk/speech-core.d.ts +0 -6
- package/dist/plugin-sdk/src/plugin-sdk/speech.d.ts +0 -7
- package/dist/plugin-sdk/src/plugin-sdk/string-normalization-runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/synthetic.d.ts +0 -11
- package/dist/plugin-sdk/src/plugin-sdk/talk-voice.d.ts +0 -2
- package/dist/plugin-sdk/src/plugin-sdk/telegram-account.d.ts +0 -6
- package/dist/plugin-sdk/src/plugin-sdk/telegram-allow-from.d.ts +0 -6
- package/dist/plugin-sdk/src/plugin-sdk/telegram-command-config.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/telegram-surface.d.ts +0 -44
- package/dist/plugin-sdk/src/plugin-sdk/test-utils.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/testing.d.ts +0 -53
- package/dist/plugin-sdk/src/plugin-sdk/text-chunking.d.ts +0 -2
- package/dist/plugin-sdk/src/plugin-sdk/thread-bindings-runtime.d.ts +0 -4
- package/dist/plugin-sdk/src/plugin-sdk/thread-ownership.d.ts +0 -5
- package/dist/plugin-sdk/src/plugin-sdk/tlon.d.ts +0 -22
- package/dist/plugin-sdk/src/plugin-sdk/together.d.ts +0 -10
- package/dist/plugin-sdk/src/plugin-sdk/tool-send.d.ts +0 -7
- package/dist/plugin-sdk/src/plugin-sdk/twitch.d.ts +0 -18
- package/dist/plugin-sdk/src/plugin-sdk/venice.d.ts +0 -10
- package/dist/plugin-sdk/src/plugin-sdk/vercel-ai-gateway.d.ts +0 -14
- package/dist/plugin-sdk/src/plugin-sdk/vllm.d.ts +0 -9
- package/dist/plugin-sdk/src/plugin-sdk/voice-call.d.ts +0 -8
- package/dist/plugin-sdk/src/plugin-sdk/volcengine.d.ts +0 -11
- package/dist/plugin-sdk/src/plugin-sdk/webhook-ingress.d.ts +0 -6
- package/dist/plugin-sdk/src/plugin-sdk/webhook-memory-guards.d.ts +0 -52
- package/dist/plugin-sdk/src/plugin-sdk/webhook-path.d.ts +0 -8
- package/dist/plugin-sdk/src/plugin-sdk/webhook-request-guards.d.ts +0 -89
- package/dist/plugin-sdk/src/plugin-sdk/webhook-targets.d.ts +0 -97
- package/dist/plugin-sdk/src/plugin-sdk/whatsapp-action-runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/whatsapp-core.d.ts +0 -10
- package/dist/plugin-sdk/src/plugin-sdk/whatsapp-login-qr.d.ts +0 -1
- package/dist/plugin-sdk/src/plugin-sdk/whatsapp-shared.d.ts +0 -5
- package/dist/plugin-sdk/src/plugin-sdk/whatsapp-surface.d.ts +0 -19
- package/dist/plugin-sdk/src/plugin-sdk/whatsapp.d.ts +0 -32
- package/dist/plugin-sdk/src/plugin-sdk/xai.d.ts +0 -21
- package/dist/plugin-sdk/src/plugin-sdk/xiaomi.d.ts +0 -9
- package/dist/plugin-sdk/src/plugin-sdk/zai.d.ts +0 -12
- package/dist/plugin-sdk/src/plugin-sdk/zalo-setup.d.ts +0 -8
- package/dist/plugin-sdk/src/plugin-sdk/zalo.d.ts +0 -47
- package/dist/plugin-sdk/src/plugin-sdk/zalouser.d.ts +0 -39
- package/dist/plugin-sdk/src/plugin-sdk/zod.d.ts +0 -1
- package/dist/plugin-sdk/src/plugins/bundled-compat.d.ts +0 -14
- package/dist/plugin-sdk/src/plugins/http-path.d.ts +0 -1
- package/dist/plugin-sdk/src/plugins/http-registry.d.ts +0 -16
- package/dist/plugin-sdk/src/plugins/http-route-overlap.d.ts +0 -11
- package/dist/plugin-sdk/src/plugins/interactive-dispatch-adapters.d.ts +0 -44
- package/dist/plugin-sdk/src/plugins/interactive.d.ts +0 -60
- package/dist/plugin-sdk/src/plugins/lazy-service-module.d.ts +0 -13
- package/dist/plugin-sdk/src/plugins/loader.d.ts +0 -74
- package/dist/plugin-sdk/src/plugins/plugin-error-handler.d.ts +0 -130
- package/dist/plugin-sdk/src/plugins/provider-auth-choice.runtime.d.ts +0 -7
- package/dist/plugin-sdk/src/plugins/provider-catalog.d.ts +0 -24
- package/dist/plugin-sdk/src/plugins/provider-model-allowlist.d.ts +0 -6
- package/dist/plugin-sdk/src/plugins/provider-model-defaults.d.ts +0 -26
- package/dist/plugin-sdk/src/plugins/provider-oauth-flow.d.ts +0 -20
- package/dist/plugin-sdk/src/plugins/provider-openai-codex-oauth-tls.d.ts +0 -22
- package/dist/plugin-sdk/src/plugins/provider-openai-codex-oauth.d.ts +0 -10
- package/dist/plugin-sdk/src/plugins/provider-runtime.d.ts +0 -271
- package/dist/plugin-sdk/src/plugins/provider-runtime.runtime.d.ts +0 -14
- package/dist/plugin-sdk/src/plugins/provider-self-hosted-setup.d.ts +0 -60
- package/dist/plugin-sdk/src/plugins/provider-validation.d.ts +0 -7
- package/dist/plugin-sdk/src/plugins/provider-wizard.d.ts +0 -45
- package/dist/plugin-sdk/src/plugins/provider-zai-endpoint.d.ts +0 -16
- package/dist/plugin-sdk/src/plugins/providers.d.ts +0 -39
- package/dist/plugin-sdk/src/plugins/registry-empty.d.ts +0 -2
- package/dist/plugin-sdk/src/plugins/registry.d.ts +0 -217
- package/dist/plugin-sdk/src/plugins/runtime/gateway-request-scope.d.ts +0 -19
- package/dist/plugin-sdk/src/plugins/runtime/index.d.ts +0 -19
- package/dist/plugin-sdk/src/plugins/runtime/native-deps.d.ts +0 -8
- package/dist/plugin-sdk/src/plugins/runtime/runtime-channel.d.ts +0 -2
- package/dist/plugin-sdk/src/plugins/runtime/runtime-config.d.ts +0 -2
- package/dist/plugin-sdk/src/plugins/runtime/runtime-events.d.ts +0 -2
- package/dist/plugin-sdk/src/plugins/runtime/runtime-logging.d.ts +0 -2
- package/dist/plugin-sdk/src/plugins/runtime/runtime-media-understanding.runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/plugins/runtime/runtime-media.d.ts +0 -2
- package/dist/plugin-sdk/src/plugins/runtime/runtime-slack-ops.runtime.d.ts +0 -10
- package/dist/plugin-sdk/src/plugins/runtime/runtime-slack.d.ts +0 -2
- package/dist/plugin-sdk/src/plugins/runtime/runtime-system.d.ts +0 -2
- package/dist/plugin-sdk/src/plugins/runtime/runtime-tts.runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/plugins/runtime/runtime-whatsapp-boundary.d.ts +0 -35
- package/dist/plugin-sdk/src/plugins/runtime/types-channel.d.ts +0 -200
- package/dist/plugin-sdk/src/plugins/runtime/types-core.d.ts +0 -123
- package/dist/plugin-sdk/src/plugins/runtime/types.d.ts +0 -51
- package/dist/plugin-sdk/src/plugins/runtime.d.ts +0 -39
- package/dist/plugin-sdk/src/plugins/slots.d.ts +0 -36
- package/dist/plugin-sdk/src/plugins/types.d.ts +0 -2287
- package/dist/plugin-sdk/src/security/channel-metadata.d.ts +0 -6
- package/dist/plugin-sdk/src/security/context-visibility.d.ts +0 -26
- package/dist/plugin-sdk/src/shared/device-bootstrap-profile.d.ts +0 -10
- package/dist/plugin-sdk/src/terminal/health-style.d.ts +0 -1
- package/dist/plugin-sdk/src/terminal/note.d.ts +0 -5
- package/dist/plugin-sdk/src/test-helpers/http.d.ts +0 -3
- package/dist/plugin-sdk/src/test-helpers/ssrf.d.ts +0 -2
- package/dist/plugin-sdk/src/test-helpers/state-dir-env.d.ts +0 -9
- package/dist/plugin-sdk/src/test-helpers/whatsapp-outbound.d.ts +0 -22
- package/dist/plugin-sdk/src/test-utils/bundled-plugin-public-surface.d.ts +0 -10
- package/dist/plugin-sdk/src/test-utils/channel-plugins.d.ts +0 -40
- package/dist/plugin-sdk/src/test-utils/env.d.ts +0 -10
- package/dist/plugin-sdk/src/test-utils/fetch-mock.d.ts +0 -13
- package/dist/plugin-sdk/src/test-utils/session-state-cleanup.d.ts +0 -10
- package/dist/plugin-sdk/src/test-utils/vitest-mock-fn.d.ts +0 -1
- package/dist/plugin-sdk/src/tts/directives.d.ts +0 -10
- package/dist/plugin-sdk/src/tts/provider-error-utils.d.ts +0 -4
- package/dist/plugin-sdk/src/tts/provider-registry.d.ts +0 -7
- package/dist/plugin-sdk/src/tts/provider-types.d.ts +0 -100
- package/dist/plugin-sdk/src/tts/tts-core.d.ts +0 -32
- package/dist/plugin-sdk/src/tts/tts.runtime.d.ts +0 -1
- package/dist/plugin-sdk/src/utils/message-channel.d.ts +0 -29
- package/dist/plugin-sdk/src/utils.d.ts +0 -58
- package/dist/plugin-sdk/src/wizard/session.d.ts +0 -42
- package/dist/plugin-sdk/ssrf-runtime.d.ts +0 -1
- package/dist/plugin-sdk/state-paths.d.ts +0 -1
- package/dist/plugin-sdk/status-helpers.d.ts +0 -1
- package/dist/plugin-sdk/string-normalization-runtime.d.ts +0 -1
- package/dist/plugin-sdk/synthetic.d.ts +0 -1
- package/dist/plugin-sdk/telegram-account.d.ts +0 -1
- package/dist/plugin-sdk/telegram-allow-from.d.ts +0 -1
- package/dist/plugin-sdk/telegram-command-config.d.ts +0 -1
- package/dist/plugin-sdk/telegram-core.d.ts +0 -1
- package/dist/plugin-sdk/telegram-surface.d.ts +0 -1
- package/dist/plugin-sdk/temp-path.d.ts +0 -1
- package/dist/plugin-sdk/testing.d.ts +0 -1
- package/dist/plugin-sdk/text-runtime.d.ts +0 -1
- package/dist/plugin-sdk/thread-bindings-runtime.d.ts +0 -1
- package/dist/plugin-sdk/thread-ownership.d.ts +0 -1
- package/dist/plugin-sdk/tlon.d.ts +0 -1
- package/dist/plugin-sdk/together.d.ts +0 -1
- package/dist/plugin-sdk/tool-send.d.ts +0 -1
- package/dist/plugin-sdk/twitch.d.ts +0 -1
- package/dist/plugin-sdk/venice.d.ts +0 -1
- package/dist/plugin-sdk/vllm.d.ts +0 -1
- package/dist/plugin-sdk/voice-call.d.ts +0 -1
- package/dist/plugin-sdk/volcengine.d.ts +0 -1
- package/dist/plugin-sdk/web-media.d.ts +0 -1
- package/dist/plugin-sdk/webhook-ingress.d.ts +0 -1
- package/dist/plugin-sdk/webhook-path.d.ts +0 -1
- package/dist/plugin-sdk/webhook-request-guards.d.ts +0 -1
- package/dist/plugin-sdk/whatsapp-auth-presence.d.ts +0 -1
- package/dist/plugin-sdk/whatsapp-core.d.ts +0 -1
- package/dist/plugin-sdk/whatsapp-shared.d.ts +0 -1
- package/dist/plugin-sdk/whatsapp-surface.d.ts +0 -1
- package/dist/plugin-sdk/whatsapp-targets.d.ts +0 -1
- package/dist/plugin-sdk/windows-spawn.d.ts +0 -1
- package/dist/plugin-sdk/xai.d.ts +0 -1
- package/dist/plugin-sdk/zalo-setup.d.ts +0 -1
- package/dist/plugin-sdk/zalo.d.ts +0 -1
- package/dist/plugin-sdk/zalouser.d.ts +0 -1
- package/dist/plugin-sdk/zod.d.ts +0 -1
- package/dist/plugins-cli-BuRzZElZ.js +0 -561
- package/dist/plugins-command-helpers-2uhVdnBb.js +0 -116
- package/dist/plugins-install-persist-BVZkrB2-.js +0 -121
- package/dist/plugins-update-command-CWl-U7Wy.js +0 -974
- package/dist/policy-CBLebx7K.js +0 -147
- package/dist/preflight-audio-RQNk7yfw.js +0 -48
- package/dist/preflight-audio.runtime-BKLaDdXh.js +0 -7
- package/dist/prepare-BdWIhg02.js +0 -1301
- package/dist/probe-7PmWRQdg.js +0 -1868
- package/dist/probe-DBGVRz02.js +0 -170
- package/dist/probe-DtN67E1D.js +0 -349
- package/dist/probe-F0974SeN.js +0 -431
- package/dist/profile-update-B98rJ-pB.js +0 -67
- package/dist/program-CCSYcbNv.js +0 -158
- package/dist/prompt-select-styled-QezSJIFt.js +0 -6434
- package/dist/provider-CvWQLyt5.js +0 -18901
- package/dist/provider-Cvp1QQuM.js +0 -70
- package/dist/provider-IEIXFsBr.js +0 -3685
- package/dist/provider-api-key-auth-BjgG22Cp.js +0 -109
- package/dist/provider-auth-Dlfypk2e.js +0 -43
- package/dist/provider-auth-api-key-DPeAD4Wh.js +0 -5
- package/dist/provider-auth-login-eRYV4NRi.js +0 -8
- package/dist/provider-dispatcher-D2OJ5CNa.js +0 -22
- package/dist/provider-entry-D8rVAPy0.js +0 -86
- package/dist/provider-session.runtime-GQeUwL4B.js +0 -7
- package/dist/provider.runtime-BokN-cp6.js +0 -2
- package/dist/qr-image-CNXmqHBd.js +0 -2
- package/dist/queue-eLL6EbrW.js +0 -663
- package/dist/reaction-runtime-api-DwLFcfeo.js +0 -114
- package/dist/reactions-K9RuCuhE.js +0 -258
- package/dist/read-only-account-inspect.telegram-BoATG5TP.js +0 -202
- package/dist/register.agent-DdFsdgdX.js +0 -240
- package/dist/register.configure-BTVikzNj.js +0 -15
- package/dist/register.maintenance-CDt8_LBs.js +0 -449
- package/dist/register.message-C_Wf261e.js +0 -644
- package/dist/register.onboard-FL6Mny10.js +0 -79
- package/dist/register.setup-BeW8HY0P.js +0 -183
- package/dist/register.status-health-sessions-Bl0-x2Ok.js +0 -1206
- package/dist/register.subclis-DUBZB3bR.js +0 -295
- package/dist/register.subclis-Db9Qegv7.js +0 -3
- package/dist/replies-CWZyv0g5.js +0 -118
- package/dist/reply-DMsC03Iw.js +0 -3192
- package/dist/reply-blocks-DuXsQojy.js +0 -103
- package/dist/reply-dispatch-runtime-D_8J_oEP.js +0 -3
- package/dist/reply-runtime-TZcIYAGQ.js +0 -123
- package/dist/reply.runtime-Bht7FBbJ.js +0 -2
- package/dist/resolve-allowlist-Bnvzjka0.js +0 -147
- package/dist/resolve-targets-D3K5Z5gf.js +0 -280
- package/dist/rooms-mp7F7lsA.js +0 -325
- package/dist/route-reply-DKoNoGml.js +0 -133
- package/dist/route-reply.runtime-ByCsyDjS.js +0 -2
- package/dist/route-resolution-CshIQw9s.js +0 -461
- package/dist/rpc-context-DQ0FBc41.js +0 -155
- package/dist/run-main-BzIbww9g.js +0 -425
- package/dist/runner-IAThb076.js +0 -1479
- package/dist/runtime-C4nQKohR.js +0 -68
- package/dist/runtime-DpQadrfd.js +0 -1175
- package/dist/runtime-api-B-n73E_A.js +0 -2
- package/dist/runtime-api-B0TzzMRA.js +0 -2
- package/dist/runtime-api-B2g4aFI0.js +0 -2
- package/dist/runtime-api-Bjn-vYvi.js +0 -3676
- package/dist/runtime-api-Ckw6TKHu.js +0 -2
- package/dist/runtime-api-CqpkXWTZ.js +0 -14
- package/dist/runtime-api-DLcWBYBn.js +0 -2
- package/dist/runtime-api-DTkksxUA.js +0 -2
- package/dist/runtime-api-Dqjul0s_.js +0 -3
- package/dist/runtime-api-Dt4a5hxH.js +0 -81
- package/dist/runtime-api-exjXBw5x.js +0 -2
- package/dist/runtime-api-iiaetepr.js +0 -29
- package/dist/runtime-api-uq8PFObQ.js +0 -2
- package/dist/runtime-embedded-pi.runtime-C_VTO5Hb.js +0 -2
- package/dist/sandbox-cli-DCBzqdRP.js +0 -443
- package/dist/sdk-xNF3YVy5.js +0 -1108
- package/dist/security-cli-BRQ9l5SH.js +0 -477
- package/dist/send-BR9WsDjK.js +0 -532
- package/dist/send-BYZ6LXaA.js +0 -856
- package/dist/send-C9XFbxrx.js +0 -2
- package/dist/send-CP6xLBgu.js +0 -100
- package/dist/send-CevSHBU3.js +0 -442
- package/dist/send-CiU0wWHJ.js +0 -178
- package/dist/send-CzZHXvb0.js +0 -318
- package/dist/send-D8Q38WQW.js +0 -1076
- package/dist/send-DSrMDTx6.js +0 -3
- package/dist/send.components-CSiMYa_k.js +0 -2
- package/dist/send.components-DuCC5xXW.js +0 -942
- package/dist/server-cron-CnWsiroT.js +0 -2
- package/dist/server-cron-pXTPca6M.js +0 -4173
- package/dist/server-hfFKzOMa.js +0 -10120
- package/dist/server-lite-CpD0TAwt.js +0 -831
- package/dist/server-maintenance-CSzGshfI.js +0 -542
- package/dist/server-maintenance-m-ekNAYN.js +0 -2
- package/dist/server-node-events-o25FUhFi.js +0 -454
- package/dist/server-node-subscriptions-D1cnZtZz.js +0 -2
- package/dist/server-plugins-BYGRllKK.js +0 -10423
- package/dist/server-plugins-D-GLUOyL.js +0 -2
- package/dist/server-startup-memory-CwdtRW65.js +0 -2
- package/dist/server-tailscale-BurW9eR4.js +0 -2
- package/dist/services-B4WpjjQk.js +0 -2
- package/dist/session-BZC_ExXj.js +0 -50
- package/dist/session-archive.runtime-CpJ_-vMn.js +0 -2
- package/dist/session-envelope-D53bqIsw.js +0 -18
- package/dist/session-file-L8H_0oIY.js +0 -120
- package/dist/session-key-DlGku_2P.js +0 -52
- package/dist/session-override-BwLTMvlR.js +0 -100
- package/dist/session-reset-model.runtime-B-f6UyAY.js +0 -119
- package/dist/session-route-CWWuYCWY.js +0 -91
- package/dist/session-store-runtime-DbJ_acdU.js +0 -2
- package/dist/session-subagent-reactivation.runtime-DQP-UkdA.js +0 -2
- package/dist/session-transcript-files.fs-BRLPQRBN.js +0 -149
- package/dist/session-updates-BiofcJQ9.js +0 -222
- package/dist/session-updates.runtime-B5YxiezL.js +0 -2
- package/dist/session-utils-BsLMe4R0.js +0 -1743
- package/dist/sessions-BGky6-U4.js +0 -224
- package/dist/sessions-CizZS4Rb.js +0 -2
- package/dist/sessions-CnolLDg0.js +0 -443
- package/dist/setup-BPkdGC8C.js +0 -427
- package/dist/setup-api-Bd-qaaRg.js +0 -2
- package/dist/setup-bootstrap-BUPymwJl.js +0 -54
- package/dist/setup-core-CE5GuYaV.js +0 -256
- package/dist/setup-core-tvt7DN1q.js +0 -146
- package/dist/setup-surface-BbOvAxU6.js +0 -484
- package/dist/setup-surface-BlIvCltJ.js +0 -450
- package/dist/setup-surface-BoJI-ftG.js +0 -237
- package/dist/setup-surface-C6yPqLIS.js +0 -261
- package/dist/setup-surface-CNFczxjl.js +0 -656
- package/dist/setup-surface-D5hZFXlx.js +0 -8848
- package/dist/setup-surface-DMOex3oo.js +0 -346
- package/dist/setup-surface-DRmn71vw.js +0 -333
- package/dist/setup-surface-DUodX6wM.js +0 -353
- package/dist/setup-surface-DVnka34A.js +0 -272
- package/dist/setup-surface-DrFSCD5A.js +0 -304
- package/dist/setup-surface-WtMan1x2.js +0 -261
- package/dist/setup.finalize-BcpxSMo5.js +0 -458
- package/dist/setup.gateway-config-BHvGYGOD.js +0 -247
- package/dist/shared-1r1qYN6z.js +0 -198
- package/dist/shared-BXz6HKLm.js +0 -180
- package/dist/shared-Bg7yDHOE.js +0 -94
- package/dist/shared-DBX8qPP6.js +0 -144
- package/dist/shared-DHFHItFt.js +0 -160
- package/dist/shared-DJV3Mmv8.js +0 -72
- package/dist/shared-ZeWcr3rG.js +0 -2
- package/dist/shared-nCJ3kgXi.js +0 -78
- package/dist/shared-rKEs-OIg.js +0 -64
- package/dist/shared-runtime-CTD5ywGR.js +0 -7
- package/dist/skills-install-CoUJk9aZ.js +0 -819
- package/dist/slash-commands-CKUKTwMa.js +0 -672
- package/dist/slash-commands.runtime-BrfELsEA.js +0 -20
- package/dist/slash-dispatch.runtime-CfjHhQmx.js +0 -38
- package/dist/slash-skill-commands.runtime-Bxm-652_.js +0 -8
- package/dist/speech-provider-BjDZhOzO.js +0 -190
- package/dist/src-BscJ0OyQ.js +0 -2739
- package/dist/startup-verification-Bwer6SPQ.js +0 -131
- package/dist/state-migrations-Dh5gaxn0.js +0 -845
- package/dist/status-CxiD9-L2.js +0 -2
- package/dist/status-all-CteZuvg_.js +0 -798
- package/dist/status-hLuTMJgT.js +0 -650
- package/dist/status-issues-CZdlgUVQ.js +0 -187
- package/dist/status-issues-Dx4xsUU6.js +0 -336
- package/dist/status-json-CU_sqXwN.js +0 -86
- package/dist/status-l8LyDb-X.js +0 -608
- package/dist/status-mpmZALQx.js +0 -3
- package/dist/status.command.text-runtime-Ck9abrv4.js +0 -18
- package/dist/status.scan-N2AgYo5y.js +0 -264
- package/dist/status.scan.fast-json-B8TmllqQ.js +0 -97
- package/dist/status.scan.fast-json-CiJfPteF.js +0 -2
- package/dist/status.scan.json-core-Bqw5Ethf.js +0 -254
- package/dist/status.summary-CN0kS8iw.js +0 -2
- package/dist/status.summary-joaOukPU.js +0 -210
- package/dist/sticker-cache-DXLBnGCi.js +0 -1573
- package/dist/sticker-vision.runtime-DP1NsaCZ.js +0 -16
- package/dist/storage-BRnLX4P7.js +0 -234
- package/dist/store-BvP1FWCI.js +0 -1343
- package/dist/store.runtime-NoYeZeac.js +0 -2
- package/dist/stream-BJ4HYVwA.js +0 -633
- package/dist/subagent-orphan-recovery-hTBxfwY4.js +0 -206
- package/dist/subagent-registry-runtime-3PIBzuDd.js +0 -2
- package/dist/targets-BAsektUE.js +0 -748
- package/dist/task-registry-delivery-runtime-CkJ71rwb.js +0 -2
- package/dist/task-registry.audit-gdULOiFp.js +0 -320
- package/dist/task-registry.maintenance-DhI_cx5O.js +0 -2
- package/dist/test-api-B4g2UUbw.js +0 -47
- package/dist/testing-DFnq00vr.js +0 -677
- package/dist/thread-bindings-CEuvQ0a5.js +0 -219
- package/dist/thread-bindings-CzFRpuy7.js +0 -534
- package/dist/thread-bindings-D-QA8SBh.js +0 -352
- package/dist/thread-bindings-EP9pAodb.js +0 -778
- package/dist/thread-bindings.discord-api-DKSgmJf_.js +0 -487
- package/dist/threading-CLq9AwSD.js +0 -832
- package/dist/threading-CQM3vrch.js +0 -2
- package/dist/threading-tool-context-DN0TQ-o6.js +0 -157
- package/dist/token-Bs7YIYbI.js +0 -82
- package/dist/tool-actions.runtime-mxezUV4D.js +0 -532
- package/dist/tools-effective-inventory-Dz6tWQxy.js +0 -148
- package/dist/ui-Cmeq4ZXg.js +0 -212
- package/dist/update-CADy3L5e.js +0 -1253
- package/dist/update-cli-B61EQsEl.js +0 -1447
- package/dist/update-runner--BEMGokU.js +0 -1195
- package/dist/verification-C5PYFyB0.js +0 -130
- package/dist/verification-CzP234iv.js +0 -2
- package/dist/x-search-ToCIaz7t.js +0 -166
- package/dist/zalo-BCF4thCG.js +0 -13
- package/dist/zalo-js-C4A7Gxjy.js +0 -1156
- package/dist/zalouser-CO0W9KZf.js +0 -22
- /package/dist/{apply.runtime-DBsSkbq5.js → apply.runtime-eSa-O_F2.js} +0 -0
- /package/dist/{audit-channel.allow-from.runtime-BE3PpHCg.js → audit-channel.allow-from.runtime-DNte8cmH.js} +0 -0
- /package/dist/{audit-channel.discord.runtime-CKQwUTue.js → audit-channel.discord.runtime-BWLuLCE0.js} +0 -0
- /package/dist/{audit-channel.zalouser.runtime-DvOclP53.js → audit-channel.zalouser.runtime-D_nIX7hv.js} +0 -0
- /package/dist/{gaxios-fetch-compat-DSrL7y2X.js → gaxios-fetch-compat-Dsb6Dess.js} +0 -0
- /package/dist/{gmail-watcher-lifecycle-CnbN1EfN.js → gmail-watcher-lifecycle-D6jhzjD2.js} +0 -0
- /package/dist/{hooks-policy-BjyPwwpQ.js → hooks-policy-BS7eSxPm.js} +0 -0
- /package/dist/{install-target-BXHZSfie.js → install-target-DunBxcXd.js} +0 -0
- /package/dist/{loader-_QerU742.js → loader-DrwewZGF.js} +0 -0
- /package/dist/{plugin-error-boundary-Ze95TniC.js → plugin-error-boundary-BkeWnWCG.js} +0 -0
- /package/dist/{plugin-health-checker-BdL9iBvs.js → plugin-health-checker--ObpW5TZ.js} +0 -0
- /package/dist/{plugin-hot-reload-t-fD3k4-.js → plugin-hot-reload-uBgB89Et.js} +0 -0
- /package/dist/{provider-api-key-auth.runtime-PWOshlD_.js → provider-api-key-auth.runtime-s-qWJDKg.js} +0 -0
- /package/dist/{provider-auth-login.runtime-B8ZroIz0.js → provider-auth-login.runtime-BJ3_RYVu.js} +0 -0
- /package/dist/{provider-discovery.runtime-C9i7ZYfW.js → provider-discovery.runtime-hzNrePTv.js} +0 -0
- /package/dist/{runtime-discord-ops.runtime-DD-5fh_t.js → runtime-discord-ops.runtime-DXnkkrxh.js} +0 -0
- /package/dist/{runtime-media-understanding.runtime-BnpKjL7w.js → runtime-media-understanding.runtime-CqkE-xQD.js} +0 -0
- /package/dist/{runtime-model-auth.runtime-BJVutp59.js → runtime-model-auth.runtime-Eceghr0K.js} +0 -0
- /package/dist/{runtime-slack-ops.runtime-BHlRr1Yr.js → runtime-slack-ops.runtime-BiNFnBIK.js} +0 -0
- /package/dist/{runtime-tts.runtime-CraALy-I.js → runtime-tts.runtime-DucSlAZ7.js} +0 -0
- /package/dist/{server-constants-DYaJmd0J.js → server-constants-DygisMJm.js} +0 -0
- /package/dist/{server-node-subscriptions-B0IJt_Ut.js → server-node-subscriptions-k9pzvFjc.js} +0 -0
- /package/dist/{server-startup-memory-DVUV59tb.js → server-startup-memory-BF7b6hV-.js} +0 -0
- /package/dist/{server-tailscale-YNZLPwK0.js → server-tailscale-C4_57iBM.js} +0 -0
- /package/dist/{services-D-LPmYY2.js → services-DGh2Nlk1.js} +0 -0
- /package/dist/{skill-scanner-CiGO-i2b.js → skill-scanner-CQOOKx41.js} +0 -0
- /package/dist/{ssh-config-BeNW3BFI.js → ssh-config-C0OJnSro.js} +0 -0
- /package/dist/{supervisor-log.runtime-C5wGw6pn.js → supervisor-log.runtime-C7jNH-kn.js} +0 -0
- /package/dist/{system-presence-Dllq5OiL.js → system-presence-Ctj0G23x.js} +0 -0
- /package/dist/{tts.runtime-DmgJozN5.js → tts.runtime-BmZyMwz6.js} +0 -0
|
@@ -0,0 +1,4067 @@
|
|
|
1
|
+
import { c as normalizeAgentId, u as resolveAgentIdFromSessionKey } from "./session-key-Do__tq1E.js";
|
|
2
|
+
import { t as safeEqualSecret } from "./secret-equal-fMR1DjSl.js";
|
|
3
|
+
import { t as createDedupeCache } from "./dedupe-Bc4PYKgL.js";
|
|
4
|
+
import { t as readJsonFileWithFallback } from "./json-store-6yXxAwtu.js";
|
|
5
|
+
import { r as getSessionBindingService } from "./session-binding-service-B1JT9Vbs.js";
|
|
6
|
+
import { a as warnMissingProviderGroupPolicyFallbackOnce, i as resolveOpenProviderRuntimeGroupPolicy, r as resolveDefaultGroupPolicy } from "./runtime-group-policy-5Lr0Ieci.js";
|
|
7
|
+
import { n as fetchWithSsrFGuard } from "./fetch-guard-a7JwFUYT.js";
|
|
8
|
+
import { h as sendMediaWithLeadingCaption, m as resolveTextChunksWithFallback, p as resolveSendableOutboundReplyParts } from "./reply-payload-DPD7eb4b.js";
|
|
9
|
+
import { n as deriveLastRoutePolicy } from "./resolve-route-BxAbY_hl.js";
|
|
10
|
+
import "./routing-BKQZI-Y4.js";
|
|
11
|
+
import { a as buildPendingHistoryContextFromMap, s as clearHistoryEntriesIfEnabled, u as recordPendingHistoryEntryIfEnabled } from "./history-UDByIZZ1.js";
|
|
12
|
+
import { t as resolveChannelContextVisibilityMode } from "./context-visibility-DzjNwztO.js";
|
|
13
|
+
import { t as createReplyPrefixContext } from "./reply-prefix-hexlVI5L.js";
|
|
14
|
+
import { t as createChannelReplyPipeline } from "./channel-reply-pipeline-Dyh1zCi9.js";
|
|
15
|
+
import { n as resolveAgentOutboundIdentity } from "./identity-Rl0zYy8N.js";
|
|
16
|
+
import { a as isRequestBodyLimitError, c as requestBodyErrorToText, i as installRequestBodyLimitGuard, s as readRequestBodyWithLimit } from "./http-body-CfWmnfar.js";
|
|
17
|
+
import { t as buildAgentMediaPayload } from "./agent-media-payload-C7m4W3_C.js";
|
|
18
|
+
import { i as resolveConfiguredBindingRoute, r as ensureConfiguredBindingRouteReady } from "./conversation-runtime-DvoDx5Lp.js";
|
|
19
|
+
import { n as filterSupplementalContextItems, t as evaluateSupplementalContextVisibility } from "./context-visibility-Ct0SprKG.js";
|
|
20
|
+
import { n as createChannelPairingController } from "./channel-pairing-mk5cf7oC.js";
|
|
21
|
+
import { r as logTypingFailure } from "./logging-DIucOhk1.js";
|
|
22
|
+
import { a as createFixedWindowRateLimiter, o as createWebhookAnomalyTracker, r as WEBHOOK_RATE_LIMIT_DEFAULTS, t as WEBHOOK_ANOMALY_COUNTER_DEFAULTS } from "./webhook-memory-guards-BpJyxsWN.js";
|
|
23
|
+
import { r as applyBasicWebhookRequestGuards } from "./webhook-request-guards-B8flzgTp.js";
|
|
24
|
+
import "./browser-support-D8_Ei1HS.js";
|
|
25
|
+
import { t as createPersistentDedupe } from "./persistent-dedupe-6XlDpXGF.js";
|
|
26
|
+
import { a as createFeishuClient, c as listEnabledFeishuAccounts, d as resolveFeishuAccount, f as resolveFeishuRuntimeAccount, i as createEventDispatcher, n as raceWithTimeoutAndAbort, o as createFeishuWSClient, r as waitForAbortableDelay, t as probeFeishu } from "./probe-CcT1Zjlx.js";
|
|
27
|
+
import { D as deliverCommentThreadText, E as isMentionForwardRequest, I as getFeishuRuntime, N as buildFeishuCommentTarget, P as normalizeCommentFileType, _ as normalizeFeishuExternalKey, b as extractMentionTargets, c as getMessageFeishu, d as sendCardFeishu, g as parsePostContent, i as sendMediaFeishu, l as listFeishuThreadMessages, m as sendStructuredCardFeishu, p as sendMessageFeishu, t as downloadMessageResourceFeishu, u as resolveFeishuCardTemplate, v as buildMentionedCardContent } from "./media-CIdwV3Lu.js";
|
|
28
|
+
import "./runtime-api-CfWHYuSj.js";
|
|
29
|
+
import { r as resolveReceiveIdType } from "./targets-DRCaC599.js";
|
|
30
|
+
import { a as resolveFeishuReplyPolicy, c as createFeishuCardInteractionEnvelope, l as decodeFeishuCardAction, n as resolveFeishuAllowlistMatch, r as resolveFeishuGroupConfig, s as buildFeishuCardActionTextFallback, t as isFeishuGroupAllowed } from "./policy-BqmEosPc.js";
|
|
31
|
+
import { t as buildFeishuConversationId } from "./conversation-id-BJn8wAT8.js";
|
|
32
|
+
import { n as createFeishuThreadBindingManager } from "./thread-bindings-iFF5pMFx.js";
|
|
33
|
+
import fsSync from "node:fs";
|
|
34
|
+
import path from "node:path";
|
|
35
|
+
import os from "node:os";
|
|
36
|
+
import crypto from "node:crypto";
|
|
37
|
+
import * as crypto$1 from "crypto";
|
|
38
|
+
import * as http from "http";
|
|
39
|
+
import * as Lark from "@larksuiteoapi/node-sdk";
|
|
40
|
+
//#region extensions/feishu/src/bot-content.ts
|
|
41
|
+
function resolveFeishuGroupSession(params) {
|
|
42
|
+
const { chatId, senderOpenId, messageId, rootId, threadId, groupConfig, feishuCfg } = params;
|
|
43
|
+
const normalizedThreadId = threadId?.trim();
|
|
44
|
+
const normalizedRootId = rootId?.trim();
|
|
45
|
+
const threadReply = Boolean(normalizedThreadId || normalizedRootId);
|
|
46
|
+
const replyInThread = (groupConfig?.replyInThread ?? feishuCfg?.replyInThread ?? "disabled") === "enabled" || threadReply;
|
|
47
|
+
const legacyTopicSessionMode = groupConfig?.topicSessionMode ?? feishuCfg?.topicSessionMode ?? "disabled";
|
|
48
|
+
const groupSessionScope = groupConfig?.groupSessionScope ?? feishuCfg?.groupSessionScope ?? (legacyTopicSessionMode === "enabled" ? "group_topic" : "group");
|
|
49
|
+
const topicScope = groupSessionScope === "group_topic" || groupSessionScope === "group_topic_sender" ? normalizedRootId ?? normalizedThreadId ?? (replyInThread ? messageId : null) : null;
|
|
50
|
+
let peerId = chatId;
|
|
51
|
+
switch (groupSessionScope) {
|
|
52
|
+
case "group_sender":
|
|
53
|
+
peerId = buildFeishuConversationId({
|
|
54
|
+
chatId,
|
|
55
|
+
scope: "group_sender",
|
|
56
|
+
senderOpenId
|
|
57
|
+
});
|
|
58
|
+
break;
|
|
59
|
+
case "group_topic":
|
|
60
|
+
peerId = topicScope ? buildFeishuConversationId({
|
|
61
|
+
chatId,
|
|
62
|
+
scope: "group_topic",
|
|
63
|
+
topicId: topicScope
|
|
64
|
+
}) : chatId;
|
|
65
|
+
break;
|
|
66
|
+
case "group_topic_sender":
|
|
67
|
+
peerId = topicScope ? buildFeishuConversationId({
|
|
68
|
+
chatId,
|
|
69
|
+
scope: "group_topic_sender",
|
|
70
|
+
topicId: topicScope,
|
|
71
|
+
senderOpenId
|
|
72
|
+
}) : buildFeishuConversationId({
|
|
73
|
+
chatId,
|
|
74
|
+
scope: "group_sender",
|
|
75
|
+
senderOpenId
|
|
76
|
+
});
|
|
77
|
+
break;
|
|
78
|
+
default:
|
|
79
|
+
peerId = chatId;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
peerId,
|
|
84
|
+
parentPeer: topicScope && (groupSessionScope === "group_topic" || groupSessionScope === "group_topic_sender") ? {
|
|
85
|
+
kind: "group",
|
|
86
|
+
id: chatId
|
|
87
|
+
} : null,
|
|
88
|
+
groupSessionScope,
|
|
89
|
+
replyInThread,
|
|
90
|
+
threadReply
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function parseMessageContent(content, messageType) {
|
|
94
|
+
if (messageType === "post") return parsePostContent(content).textContent;
|
|
95
|
+
try {
|
|
96
|
+
const parsed = JSON.parse(content);
|
|
97
|
+
if (messageType === "text") return parsed.text || "";
|
|
98
|
+
if (messageType === "share_chat") {
|
|
99
|
+
if (parsed && typeof parsed === "object") {
|
|
100
|
+
const share = parsed;
|
|
101
|
+
if (typeof share.body === "string" && share.body.trim()) return share.body.trim();
|
|
102
|
+
if (typeof share.summary === "string" && share.summary.trim()) return share.summary.trim();
|
|
103
|
+
if (typeof share.share_chat_id === "string" && share.share_chat_id.trim()) return `[Forwarded message: ${share.share_chat_id.trim()}]`;
|
|
104
|
+
}
|
|
105
|
+
return "[Forwarded message]";
|
|
106
|
+
}
|
|
107
|
+
if (messageType === "merge_forward") return "[Merged and Forwarded Message - loading...]";
|
|
108
|
+
return content;
|
|
109
|
+
} catch {
|
|
110
|
+
return content;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function formatSubMessageContent(content, contentType) {
|
|
114
|
+
try {
|
|
115
|
+
const parsed = JSON.parse(content);
|
|
116
|
+
switch (contentType) {
|
|
117
|
+
case "text": return parsed.text || content;
|
|
118
|
+
case "post": return parsePostContent(content).textContent;
|
|
119
|
+
case "image": return "[Image]";
|
|
120
|
+
case "file": return `[File: ${parsed.file_name || "unknown"}]`;
|
|
121
|
+
case "audio": return "[Audio]";
|
|
122
|
+
case "video": return "[Video]";
|
|
123
|
+
case "sticker": return "[Sticker]";
|
|
124
|
+
case "merge_forward": return "[Nested Merged Forward]";
|
|
125
|
+
default: return `[${contentType}]`;
|
|
126
|
+
}
|
|
127
|
+
} catch {
|
|
128
|
+
return content;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function parseMergeForwardContent(params) {
|
|
132
|
+
const { content, log } = params;
|
|
133
|
+
const maxMessages = 50;
|
|
134
|
+
log?.("feishu: parsing merge_forward sub-messages from API response");
|
|
135
|
+
let items;
|
|
136
|
+
try {
|
|
137
|
+
items = JSON.parse(content);
|
|
138
|
+
} catch {
|
|
139
|
+
log?.("feishu: merge_forward items parse failed");
|
|
140
|
+
return "[Merged and Forwarded Message - parse error]";
|
|
141
|
+
}
|
|
142
|
+
if (!Array.isArray(items) || items.length === 0) return "[Merged and Forwarded Message - no sub-messages]";
|
|
143
|
+
const subMessages = items.filter((item) => item.upper_message_id);
|
|
144
|
+
if (subMessages.length === 0) return "[Merged and Forwarded Message - no sub-messages found]";
|
|
145
|
+
log?.(`feishu: merge_forward contains ${subMessages.length} sub-messages`);
|
|
146
|
+
subMessages.sort((a, b) => parseInt(a.create_time || "0", 10) - parseInt(b.create_time || "0", 10));
|
|
147
|
+
const lines = ["[Merged and Forwarded Messages]"];
|
|
148
|
+
for (const item of subMessages.slice(0, maxMessages)) lines.push(`- ${formatSubMessageContent(item.body?.content || "", item.msg_type || "text")}`);
|
|
149
|
+
if (subMessages.length > maxMessages) lines.push(`... and ${subMessages.length - maxMessages} more messages`);
|
|
150
|
+
return lines.join("\n");
|
|
151
|
+
}
|
|
152
|
+
function checkBotMentioned(event, botOpenId) {
|
|
153
|
+
if (!botOpenId) return false;
|
|
154
|
+
if ((event.message.content ?? "").includes("@_all")) return true;
|
|
155
|
+
const mentions = event.message.mentions ?? [];
|
|
156
|
+
if (mentions.length > 0) return mentions.some((mention) => mention.id.open_id === botOpenId);
|
|
157
|
+
if (event.message.message_type === "post") return parsePostContent(event.message.content).mentionedOpenIds.some((id) => id === botOpenId);
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
function normalizeMentions(text, mentions, botStripId) {
|
|
161
|
+
if (!mentions || mentions.length === 0) return text;
|
|
162
|
+
const escaped = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
163
|
+
const escapeName = (value) => value.replace(/</g, "<").replace(/>/g, ">");
|
|
164
|
+
let result = text;
|
|
165
|
+
for (const mention of mentions) {
|
|
166
|
+
const mentionId = mention.id.open_id;
|
|
167
|
+
const replacement = botStripId && mentionId === botStripId ? "" : mentionId ? `<at user_id="${mentionId}">${escapeName(mention.name)}</at>` : `@${mention.name}`;
|
|
168
|
+
result = result.replace(new RegExp(escaped(mention.key), "g"), () => replacement).trim();
|
|
169
|
+
}
|
|
170
|
+
return result;
|
|
171
|
+
}
|
|
172
|
+
function normalizeFeishuCommandProbeBody(text) {
|
|
173
|
+
if (!text) return "";
|
|
174
|
+
return text.replace(/<at\b[^>]*>[^<]*<\/at>/giu, " ").replace(/(^|\s)@[^/\s]+(?=\s|$|\/)/gu, "$1").replace(/\s+/g, " ").trim();
|
|
175
|
+
}
|
|
176
|
+
function parseMediaKeys(content, messageType) {
|
|
177
|
+
try {
|
|
178
|
+
const parsed = JSON.parse(content);
|
|
179
|
+
const imageKey = normalizeFeishuExternalKey(parsed.image_key);
|
|
180
|
+
const fileKey = normalizeFeishuExternalKey(parsed.file_key);
|
|
181
|
+
switch (messageType) {
|
|
182
|
+
case "image": return {
|
|
183
|
+
imageKey,
|
|
184
|
+
fileName: parsed.file_name
|
|
185
|
+
};
|
|
186
|
+
case "file":
|
|
187
|
+
case "audio":
|
|
188
|
+
case "sticker": return {
|
|
189
|
+
fileKey,
|
|
190
|
+
fileName: parsed.file_name
|
|
191
|
+
};
|
|
192
|
+
case "video":
|
|
193
|
+
case "media": return {
|
|
194
|
+
fileKey,
|
|
195
|
+
imageKey,
|
|
196
|
+
fileName: parsed.file_name
|
|
197
|
+
};
|
|
198
|
+
default: return {};
|
|
199
|
+
}
|
|
200
|
+
} catch {
|
|
201
|
+
return {};
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function toMessageResourceType(messageType) {
|
|
205
|
+
return messageType === "image" ? "image" : "file";
|
|
206
|
+
}
|
|
207
|
+
function inferPlaceholder(messageType) {
|
|
208
|
+
switch (messageType) {
|
|
209
|
+
case "image": return "<media:image>";
|
|
210
|
+
case "file": return "<media:document>";
|
|
211
|
+
case "audio": return "<media:audio>";
|
|
212
|
+
case "video":
|
|
213
|
+
case "media": return "<media:video>";
|
|
214
|
+
case "sticker": return "<media:sticker>";
|
|
215
|
+
default: return "<media:document>";
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
async function resolveFeishuMediaList(params) {
|
|
219
|
+
const { cfg, messageId, messageType, content, maxBytes, log, accountId } = params;
|
|
220
|
+
if (![
|
|
221
|
+
"image",
|
|
222
|
+
"file",
|
|
223
|
+
"audio",
|
|
224
|
+
"video",
|
|
225
|
+
"media",
|
|
226
|
+
"sticker",
|
|
227
|
+
"post"
|
|
228
|
+
].includes(messageType)) return [];
|
|
229
|
+
const out = [];
|
|
230
|
+
const core = getFeishuRuntime();
|
|
231
|
+
if (messageType === "post") {
|
|
232
|
+
const { imageKeys, mediaKeys } = parsePostContent(content);
|
|
233
|
+
if (imageKeys.length === 0 && mediaKeys.length === 0) return [];
|
|
234
|
+
if (imageKeys.length > 0) log?.(`feishu: post message contains ${imageKeys.length} embedded image(s)`);
|
|
235
|
+
if (mediaKeys.length > 0) log?.(`feishu: post message contains ${mediaKeys.length} embedded media file(s)`);
|
|
236
|
+
for (const imageKey of imageKeys) try {
|
|
237
|
+
const result = await downloadMessageResourceFeishu({
|
|
238
|
+
cfg,
|
|
239
|
+
messageId,
|
|
240
|
+
fileKey: imageKey,
|
|
241
|
+
type: "image",
|
|
242
|
+
accountId
|
|
243
|
+
});
|
|
244
|
+
const contentType = result.contentType ?? await core.media.detectMime({ buffer: result.buffer });
|
|
245
|
+
const saved = await core.channel.media.saveMediaBuffer(result.buffer, contentType, "inbound", maxBytes);
|
|
246
|
+
out.push({
|
|
247
|
+
path: saved.path,
|
|
248
|
+
contentType: saved.contentType,
|
|
249
|
+
placeholder: "<media:image>"
|
|
250
|
+
});
|
|
251
|
+
log?.(`feishu: downloaded embedded image ${imageKey}, saved to ${saved.path}`);
|
|
252
|
+
} catch (err) {
|
|
253
|
+
log?.(`feishu: failed to download embedded image ${imageKey}: ${String(err)}`);
|
|
254
|
+
}
|
|
255
|
+
for (const media of mediaKeys) try {
|
|
256
|
+
const result = await downloadMessageResourceFeishu({
|
|
257
|
+
cfg,
|
|
258
|
+
messageId,
|
|
259
|
+
fileKey: media.fileKey,
|
|
260
|
+
type: "file",
|
|
261
|
+
accountId
|
|
262
|
+
});
|
|
263
|
+
const contentType = result.contentType ?? await core.media.detectMime({ buffer: result.buffer });
|
|
264
|
+
const saved = await core.channel.media.saveMediaBuffer(result.buffer, contentType, "inbound", maxBytes);
|
|
265
|
+
out.push({
|
|
266
|
+
path: saved.path,
|
|
267
|
+
contentType: saved.contentType,
|
|
268
|
+
placeholder: "<media:video>"
|
|
269
|
+
});
|
|
270
|
+
log?.(`feishu: downloaded embedded media ${media.fileKey}, saved to ${saved.path}`);
|
|
271
|
+
} catch (err) {
|
|
272
|
+
log?.(`feishu: failed to download embedded media ${media.fileKey}: ${String(err)}`);
|
|
273
|
+
}
|
|
274
|
+
return out;
|
|
275
|
+
}
|
|
276
|
+
const mediaKeys = parseMediaKeys(content, messageType);
|
|
277
|
+
if (!mediaKeys.imageKey && !mediaKeys.fileKey) return [];
|
|
278
|
+
try {
|
|
279
|
+
const fileKey = mediaKeys.fileKey || mediaKeys.imageKey;
|
|
280
|
+
if (!fileKey) return [];
|
|
281
|
+
const result = await downloadMessageResourceFeishu({
|
|
282
|
+
cfg,
|
|
283
|
+
messageId,
|
|
284
|
+
fileKey,
|
|
285
|
+
type: toMessageResourceType(messageType),
|
|
286
|
+
accountId
|
|
287
|
+
});
|
|
288
|
+
const contentType = result.contentType ?? await core.media.detectMime({ buffer: result.buffer });
|
|
289
|
+
const saved = await core.channel.media.saveMediaBuffer(result.buffer, contentType, "inbound", maxBytes, result.fileName || mediaKeys.fileName);
|
|
290
|
+
out.push({
|
|
291
|
+
path: saved.path,
|
|
292
|
+
contentType: saved.contentType,
|
|
293
|
+
placeholder: inferPlaceholder(messageType)
|
|
294
|
+
});
|
|
295
|
+
log?.(`feishu: downloaded ${messageType} media, saved to ${saved.path}`);
|
|
296
|
+
} catch (err) {
|
|
297
|
+
log?.(`feishu: failed to download ${messageType} media: ${String(err)}`);
|
|
298
|
+
}
|
|
299
|
+
return out;
|
|
300
|
+
}
|
|
301
|
+
//#endregion
|
|
302
|
+
//#region extensions/feishu/src/bot-sender-name.ts
|
|
303
|
+
const IGNORED_PERMISSION_SCOPE_TOKENS = ["contact:contact.base:readonly"];
|
|
304
|
+
const FEISHU_SCOPE_CORRECTIONS = { "contact:contact.base:readonly": "contact:user.base:readonly" };
|
|
305
|
+
const SENDER_NAME_TTL_MS = 600 * 1e3;
|
|
306
|
+
const senderNameCache = /* @__PURE__ */ new Map();
|
|
307
|
+
function correctFeishuScopeInUrl(url) {
|
|
308
|
+
let corrected = url;
|
|
309
|
+
for (const [wrong, right] of Object.entries(FEISHU_SCOPE_CORRECTIONS)) {
|
|
310
|
+
corrected = corrected.replaceAll(encodeURIComponent(wrong), encodeURIComponent(right));
|
|
311
|
+
corrected = corrected.replaceAll(wrong, right);
|
|
312
|
+
}
|
|
313
|
+
return corrected;
|
|
314
|
+
}
|
|
315
|
+
function shouldSuppressPermissionErrorNotice(permissionError) {
|
|
316
|
+
const message = permissionError.message.toLowerCase();
|
|
317
|
+
return IGNORED_PERMISSION_SCOPE_TOKENS.some((token) => message.includes(token));
|
|
318
|
+
}
|
|
319
|
+
function extractPermissionError(err) {
|
|
320
|
+
if (!err || typeof err !== "object") return null;
|
|
321
|
+
const data = err.response?.data;
|
|
322
|
+
if (!data || typeof data !== "object") return null;
|
|
323
|
+
const feishuErr = data;
|
|
324
|
+
if (feishuErr.code !== 99991672) return null;
|
|
325
|
+
const msg = feishuErr.msg ?? "";
|
|
326
|
+
const urlMatch = msg.match(/https:\/\/[^\s,]+\/app\/[^\s,]+/);
|
|
327
|
+
return {
|
|
328
|
+
code: feishuErr.code,
|
|
329
|
+
message: msg,
|
|
330
|
+
grantUrl: urlMatch?.[0] ? correctFeishuScopeInUrl(urlMatch[0]) : void 0
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
function resolveSenderLookupIdType(senderId) {
|
|
334
|
+
const trimmed = senderId.trim();
|
|
335
|
+
if (trimmed.startsWith("ou_")) return "open_id";
|
|
336
|
+
if (trimmed.startsWith("on_")) return "union_id";
|
|
337
|
+
return "user_id";
|
|
338
|
+
}
|
|
339
|
+
async function resolveFeishuSenderName(params) {
|
|
340
|
+
const { account, senderId, log } = params;
|
|
341
|
+
if (!account.configured) return {};
|
|
342
|
+
const normalizedSenderId = senderId.trim();
|
|
343
|
+
if (!normalizedSenderId) return {};
|
|
344
|
+
const cached = senderNameCache.get(normalizedSenderId);
|
|
345
|
+
const now = Date.now();
|
|
346
|
+
if (cached && cached.expireAt > now) return { name: cached.name };
|
|
347
|
+
try {
|
|
348
|
+
const client = createFeishuClient(account);
|
|
349
|
+
const userIdType = resolveSenderLookupIdType(normalizedSenderId);
|
|
350
|
+
const user = (await client.contact.user.get({
|
|
351
|
+
path: { user_id: normalizedSenderId },
|
|
352
|
+
params: { user_id_type: userIdType }
|
|
353
|
+
})).data?.user;
|
|
354
|
+
const name = user?.name ?? user?.nickname ?? user?.en_name;
|
|
355
|
+
if (name) {
|
|
356
|
+
senderNameCache.set(normalizedSenderId, {
|
|
357
|
+
name,
|
|
358
|
+
expireAt: now + SENDER_NAME_TTL_MS
|
|
359
|
+
});
|
|
360
|
+
return { name };
|
|
361
|
+
}
|
|
362
|
+
return {};
|
|
363
|
+
} catch (err) {
|
|
364
|
+
const permErr = extractPermissionError(err);
|
|
365
|
+
if (permErr) {
|
|
366
|
+
if (shouldSuppressPermissionErrorNotice(permErr)) {
|
|
367
|
+
log(`feishu: ignoring stale permission scope error: ${permErr.message}`);
|
|
368
|
+
return {};
|
|
369
|
+
}
|
|
370
|
+
log(`feishu: permission error resolving sender name: code=${permErr.code}`);
|
|
371
|
+
return { permissionError: permErr };
|
|
372
|
+
}
|
|
373
|
+
log(`feishu: failed to resolve sender name for ${normalizedSenderId}: ${String(err)}`);
|
|
374
|
+
return {};
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
//#endregion
|
|
378
|
+
//#region extensions/feishu/src/dedup.ts
|
|
379
|
+
const DEDUP_TTL_MS = 1440 * 60 * 1e3;
|
|
380
|
+
const MEMORY_MAX_SIZE = 1e3;
|
|
381
|
+
const FILE_MAX_ENTRIES = 1e4;
|
|
382
|
+
const EVENT_DEDUP_TTL_MS = 300 * 1e3;
|
|
383
|
+
const EVENT_MEMORY_MAX_SIZE = 2e3;
|
|
384
|
+
const memoryDedupe = createDedupeCache({
|
|
385
|
+
ttlMs: DEDUP_TTL_MS,
|
|
386
|
+
maxSize: MEMORY_MAX_SIZE
|
|
387
|
+
});
|
|
388
|
+
const processingClaims = createDedupeCache({
|
|
389
|
+
ttlMs: EVENT_DEDUP_TTL_MS,
|
|
390
|
+
maxSize: EVENT_MEMORY_MAX_SIZE
|
|
391
|
+
});
|
|
392
|
+
function resolveStateDirFromEnv(env = process.env) {
|
|
393
|
+
const stateOverride = env.OPENCLAW_STATE_DIR?.trim();
|
|
394
|
+
if (stateOverride) return stateOverride;
|
|
395
|
+
if (env.VITEST || env.NODE_ENV === "test") return path.join(os.tmpdir(), ["openclaw-vitest", String(process.pid)].join("-"));
|
|
396
|
+
return path.join(os.homedir(), ".openclaw");
|
|
397
|
+
}
|
|
398
|
+
function resolveNamespaceFilePath(namespace) {
|
|
399
|
+
const safe = namespace.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
400
|
+
return path.join(resolveStateDirFromEnv(), "feishu", "dedup", `${safe}.json`);
|
|
401
|
+
}
|
|
402
|
+
const persistentDedupe = createPersistentDedupe({
|
|
403
|
+
ttlMs: DEDUP_TTL_MS,
|
|
404
|
+
memoryMaxSize: MEMORY_MAX_SIZE,
|
|
405
|
+
fileMaxEntries: FILE_MAX_ENTRIES,
|
|
406
|
+
resolveFilePath: resolveNamespaceFilePath
|
|
407
|
+
});
|
|
408
|
+
function resolveEventDedupeKey(namespace, messageId) {
|
|
409
|
+
const trimmed = messageId?.trim();
|
|
410
|
+
if (!trimmed) return null;
|
|
411
|
+
return `${namespace}:${trimmed}`;
|
|
412
|
+
}
|
|
413
|
+
function normalizeMessageId(messageId) {
|
|
414
|
+
const trimmed = messageId?.trim();
|
|
415
|
+
return trimmed ? trimmed : null;
|
|
416
|
+
}
|
|
417
|
+
function resolveMemoryDedupeKey(namespace, messageId) {
|
|
418
|
+
const trimmed = normalizeMessageId(messageId);
|
|
419
|
+
if (!trimmed) return null;
|
|
420
|
+
return `${namespace}:${trimmed}`;
|
|
421
|
+
}
|
|
422
|
+
function tryBeginFeishuMessageProcessing(messageId, namespace = "global") {
|
|
423
|
+
return !processingClaims.check(resolveEventDedupeKey(namespace, messageId));
|
|
424
|
+
}
|
|
425
|
+
function releaseFeishuMessageProcessing(messageId, namespace = "global") {
|
|
426
|
+
processingClaims.delete(resolveEventDedupeKey(namespace, messageId));
|
|
427
|
+
}
|
|
428
|
+
async function finalizeFeishuMessageProcessing(params) {
|
|
429
|
+
const { messageId, namespace = "global", log, claimHeld = false } = params;
|
|
430
|
+
const normalizedMessageId = normalizeMessageId(messageId);
|
|
431
|
+
const memoryKey = resolveMemoryDedupeKey(namespace, messageId);
|
|
432
|
+
if (!memoryKey || !normalizedMessageId) return false;
|
|
433
|
+
if (!claimHeld && !tryBeginFeishuMessageProcessing(normalizedMessageId, namespace)) return false;
|
|
434
|
+
if (!tryRecordMessage(memoryKey)) {
|
|
435
|
+
releaseFeishuMessageProcessing(normalizedMessageId, namespace);
|
|
436
|
+
return false;
|
|
437
|
+
}
|
|
438
|
+
if (!await tryRecordMessagePersistent(normalizedMessageId, namespace, log)) {
|
|
439
|
+
releaseFeishuMessageProcessing(normalizedMessageId, namespace);
|
|
440
|
+
return false;
|
|
441
|
+
}
|
|
442
|
+
return true;
|
|
443
|
+
}
|
|
444
|
+
async function recordProcessedFeishuMessage(messageId, namespace = "global", log) {
|
|
445
|
+
const normalizedMessageId = normalizeMessageId(messageId);
|
|
446
|
+
const memoryKey = resolveMemoryDedupeKey(namespace, messageId);
|
|
447
|
+
if (!memoryKey || !normalizedMessageId) return false;
|
|
448
|
+
tryRecordMessage(memoryKey);
|
|
449
|
+
return await tryRecordMessagePersistent(normalizedMessageId, namespace, log);
|
|
450
|
+
}
|
|
451
|
+
async function hasProcessedFeishuMessage(messageId, namespace = "global", log) {
|
|
452
|
+
const normalizedMessageId = normalizeMessageId(messageId);
|
|
453
|
+
const memoryKey = resolveMemoryDedupeKey(namespace, messageId);
|
|
454
|
+
if (!memoryKey || !normalizedMessageId) return false;
|
|
455
|
+
if (hasRecordedMessage(memoryKey)) return true;
|
|
456
|
+
return hasRecordedMessagePersistent(normalizedMessageId, namespace, log);
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Synchronous dedup — memory only.
|
|
460
|
+
* Kept for backward compatibility; prefer {@link tryRecordMessagePersistent}.
|
|
461
|
+
*/
|
|
462
|
+
function tryRecordMessage(messageId) {
|
|
463
|
+
return !memoryDedupe.check(messageId);
|
|
464
|
+
}
|
|
465
|
+
function hasRecordedMessage(messageId) {
|
|
466
|
+
const trimmed = messageId.trim();
|
|
467
|
+
if (!trimmed) return false;
|
|
468
|
+
return memoryDedupe.peek(trimmed);
|
|
469
|
+
}
|
|
470
|
+
async function tryRecordMessagePersistent(messageId, namespace = "global", log) {
|
|
471
|
+
return persistentDedupe.checkAndRecord(messageId, {
|
|
472
|
+
namespace,
|
|
473
|
+
onDiskError: (error) => {
|
|
474
|
+
log?.(`feishu-dedup: disk error, falling back to memory: ${String(error)}`);
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
async function hasRecordedMessagePersistent(messageId, namespace = "global", log) {
|
|
479
|
+
const trimmed = messageId.trim();
|
|
480
|
+
if (!trimmed) return false;
|
|
481
|
+
const now = Date.now();
|
|
482
|
+
const filePath = resolveNamespaceFilePath(namespace);
|
|
483
|
+
try {
|
|
484
|
+
const { value } = await readJsonFileWithFallback(filePath, {});
|
|
485
|
+
const seenAt = value[trimmed];
|
|
486
|
+
if (typeof seenAt !== "number" || !Number.isFinite(seenAt)) return false;
|
|
487
|
+
return DEDUP_TTL_MS <= 0 || now - seenAt < DEDUP_TTL_MS;
|
|
488
|
+
} catch (error) {
|
|
489
|
+
log?.(`feishu-dedup: persistent peek failed: ${String(error)}`);
|
|
490
|
+
return false;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
async function warmupDedupFromDisk(namespace, log) {
|
|
494
|
+
return persistentDedupe.warmup(namespace, (error) => {
|
|
495
|
+
log?.(`feishu-dedup: warmup disk error: ${String(error)}`);
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
//#endregion
|
|
499
|
+
//#region extensions/feishu/src/dynamic-agent.ts
|
|
500
|
+
/**
|
|
501
|
+
* Check if a dynamic agent should be created for a DM user and create it if needed.
|
|
502
|
+
* This creates a unique agent instance with its own workspace for each DM user.
|
|
503
|
+
*/
|
|
504
|
+
async function maybeCreateDynamicAgent(params) {
|
|
505
|
+
const { cfg, runtime, senderOpenId, dynamicCfg, log } = params;
|
|
506
|
+
const existingBindings = cfg.bindings ?? [];
|
|
507
|
+
if (existingBindings.some((b) => b.match?.channel === "feishu" && b.match?.peer?.kind === "direct" && b.match?.peer?.id === senderOpenId)) return {
|
|
508
|
+
created: false,
|
|
509
|
+
updatedCfg: cfg
|
|
510
|
+
};
|
|
511
|
+
if (dynamicCfg.maxAgents !== void 0) {
|
|
512
|
+
if ((cfg.agents?.list ?? []).filter((a) => a.id.startsWith("feishu-")).length >= dynamicCfg.maxAgents) {
|
|
513
|
+
log(`feishu: maxAgents limit (${dynamicCfg.maxAgents}) reached, not creating agent for ${senderOpenId}`);
|
|
514
|
+
return {
|
|
515
|
+
created: false,
|
|
516
|
+
updatedCfg: cfg
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
const agentId = `feishu-${senderOpenId}`;
|
|
521
|
+
if ((cfg.agents?.list ?? []).find((a) => a.id === agentId)) {
|
|
522
|
+
log(`feishu: agent "${agentId}" exists, adding missing binding for ${senderOpenId}`);
|
|
523
|
+
const updatedCfg = {
|
|
524
|
+
...cfg,
|
|
525
|
+
bindings: [...existingBindings, {
|
|
526
|
+
agentId,
|
|
527
|
+
match: {
|
|
528
|
+
channel: "feishu",
|
|
529
|
+
peer: {
|
|
530
|
+
kind: "direct",
|
|
531
|
+
id: senderOpenId
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}]
|
|
535
|
+
};
|
|
536
|
+
await runtime.config.writeConfigFile(updatedCfg);
|
|
537
|
+
return {
|
|
538
|
+
created: true,
|
|
539
|
+
updatedCfg,
|
|
540
|
+
agentId
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
const workspaceTemplate = dynamicCfg.workspaceTemplate ?? "~/.openclaw/workspace-{agentId}";
|
|
544
|
+
const agentDirTemplate = dynamicCfg.agentDirTemplate ?? "~/.openclaw/agents/{agentId}/agent";
|
|
545
|
+
const workspace = resolveUserPath(workspaceTemplate.replace("{userId}", senderOpenId).replace("{agentId}", agentId));
|
|
546
|
+
const agentDir = resolveUserPath(agentDirTemplate.replace("{userId}", senderOpenId).replace("{agentId}", agentId));
|
|
547
|
+
log(`feishu: creating dynamic agent "${agentId}" for user ${senderOpenId}`);
|
|
548
|
+
log(` workspace: ${workspace}`);
|
|
549
|
+
log(` agentDir: ${agentDir}`);
|
|
550
|
+
await fsSync.promises.mkdir(workspace, { recursive: true });
|
|
551
|
+
await fsSync.promises.mkdir(agentDir, { recursive: true });
|
|
552
|
+
const updatedCfg = {
|
|
553
|
+
...cfg,
|
|
554
|
+
agents: {
|
|
555
|
+
...cfg.agents,
|
|
556
|
+
list: [...cfg.agents?.list ?? [], {
|
|
557
|
+
id: agentId,
|
|
558
|
+
workspace,
|
|
559
|
+
agentDir
|
|
560
|
+
}]
|
|
561
|
+
},
|
|
562
|
+
bindings: [...existingBindings, {
|
|
563
|
+
agentId,
|
|
564
|
+
match: {
|
|
565
|
+
channel: "feishu",
|
|
566
|
+
peer: {
|
|
567
|
+
kind: "direct",
|
|
568
|
+
id: senderOpenId
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}]
|
|
572
|
+
};
|
|
573
|
+
await runtime.config.writeConfigFile(updatedCfg);
|
|
574
|
+
return {
|
|
575
|
+
created: true,
|
|
576
|
+
updatedCfg,
|
|
577
|
+
agentId
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Resolve a path that may start with ~ to the user's home directory.
|
|
582
|
+
*/
|
|
583
|
+
function resolveUserPath(p) {
|
|
584
|
+
if (p.startsWith("~/")) return path.join(os.homedir(), p.slice(2));
|
|
585
|
+
return p;
|
|
586
|
+
}
|
|
587
|
+
//#endregion
|
|
588
|
+
//#region extensions/feishu/src/streaming-card.ts
|
|
589
|
+
const tokenCache = /* @__PURE__ */ new Map();
|
|
590
|
+
function resolveApiBase(domain) {
|
|
591
|
+
if (domain === "lark") return "https://open.larksuite.com/open-apis";
|
|
592
|
+
if (domain && domain !== "feishu" && domain.startsWith("http")) return `${domain.replace(/\/+$/, "")}/open-apis`;
|
|
593
|
+
return "https://open.feishu.cn/open-apis";
|
|
594
|
+
}
|
|
595
|
+
function resolveAllowedHostnames(domain) {
|
|
596
|
+
if (domain === "lark") return ["open.larksuite.com"];
|
|
597
|
+
if (domain && domain !== "feishu" && domain.startsWith("http")) try {
|
|
598
|
+
return [new URL(domain).hostname];
|
|
599
|
+
} catch {
|
|
600
|
+
return [];
|
|
601
|
+
}
|
|
602
|
+
return ["open.feishu.cn"];
|
|
603
|
+
}
|
|
604
|
+
async function getToken(creds) {
|
|
605
|
+
const key = `${creds.domain ?? "feishu"}|${creds.appId}`;
|
|
606
|
+
const cached = tokenCache.get(key);
|
|
607
|
+
if (cached && cached.expiresAt > Date.now() + 6e4) return cached.token;
|
|
608
|
+
const { response, release } = await fetchWithSsrFGuard({
|
|
609
|
+
url: `${resolveApiBase(creds.domain)}/auth/v3/tenant_access_token/internal`,
|
|
610
|
+
init: {
|
|
611
|
+
method: "POST",
|
|
612
|
+
headers: { "Content-Type": "application/json" },
|
|
613
|
+
body: JSON.stringify({
|
|
614
|
+
app_id: creds.appId,
|
|
615
|
+
app_secret: creds.appSecret
|
|
616
|
+
})
|
|
617
|
+
},
|
|
618
|
+
policy: { allowedHostnames: resolveAllowedHostnames(creds.domain) },
|
|
619
|
+
auditContext: "feishu.streaming-card.token"
|
|
620
|
+
});
|
|
621
|
+
if (!response.ok) {
|
|
622
|
+
await release();
|
|
623
|
+
throw new Error(`Token request failed with HTTP ${response.status}`);
|
|
624
|
+
}
|
|
625
|
+
const data = await response.json();
|
|
626
|
+
await release();
|
|
627
|
+
if (data.code !== 0 || !data.tenant_access_token) throw new Error(`Token error: ${data.msg}`);
|
|
628
|
+
tokenCache.set(key, {
|
|
629
|
+
token: data.tenant_access_token,
|
|
630
|
+
expiresAt: Date.now() + (data.expire ?? 7200) * 1e3
|
|
631
|
+
});
|
|
632
|
+
return data.tenant_access_token;
|
|
633
|
+
}
|
|
634
|
+
function truncateSummary(text, max = 50) {
|
|
635
|
+
if (!text) return "";
|
|
636
|
+
const clean = text.replace(/\n/g, " ").trim();
|
|
637
|
+
return clean.length <= max ? clean : clean.slice(0, max - 3) + "...";
|
|
638
|
+
}
|
|
639
|
+
function mergeStreamingText(previousText, nextText) {
|
|
640
|
+
const previous = typeof previousText === "string" ? previousText : "";
|
|
641
|
+
const next = typeof nextText === "string" ? nextText : "";
|
|
642
|
+
if (!next) return previous;
|
|
643
|
+
if (!previous || next === previous) return next;
|
|
644
|
+
if (next.startsWith(previous)) return next;
|
|
645
|
+
if (previous.startsWith(next)) return previous;
|
|
646
|
+
if (next.includes(previous)) return next;
|
|
647
|
+
if (previous.includes(next)) return previous;
|
|
648
|
+
const maxOverlap = Math.min(previous.length, next.length);
|
|
649
|
+
for (let overlap = maxOverlap; overlap > 0; overlap -= 1) if (previous.slice(-overlap) === next.slice(0, overlap)) return `${previous}${next.slice(overlap)}`;
|
|
650
|
+
return `${previous}${next}`;
|
|
651
|
+
}
|
|
652
|
+
function resolveStreamingCardSendMode(options) {
|
|
653
|
+
if (options?.replyToMessageId) return "reply";
|
|
654
|
+
if (options?.rootId) return "root_create";
|
|
655
|
+
return "create";
|
|
656
|
+
}
|
|
657
|
+
/** Streaming card session manager */
|
|
658
|
+
var FeishuStreamingSession = class {
|
|
659
|
+
constructor(client, creds, log) {
|
|
660
|
+
this.state = null;
|
|
661
|
+
this.queue = Promise.resolve();
|
|
662
|
+
this.closed = false;
|
|
663
|
+
this.lastUpdateTime = 0;
|
|
664
|
+
this.pendingText = null;
|
|
665
|
+
this.flushTimer = null;
|
|
666
|
+
this.updateThrottleMs = 100;
|
|
667
|
+
this.client = client;
|
|
668
|
+
this.creds = creds;
|
|
669
|
+
this.log = log;
|
|
670
|
+
}
|
|
671
|
+
async start(receiveId, receiveIdType = "chat_id", options) {
|
|
672
|
+
if (this.state) return;
|
|
673
|
+
const apiBase = resolveApiBase(this.creds.domain);
|
|
674
|
+
const elements = [{
|
|
675
|
+
tag: "markdown",
|
|
676
|
+
content: "⏳ Thinking...",
|
|
677
|
+
element_id: "content"
|
|
678
|
+
}];
|
|
679
|
+
if (options?.note) {
|
|
680
|
+
elements.push({ tag: "hr" });
|
|
681
|
+
elements.push({
|
|
682
|
+
tag: "markdown",
|
|
683
|
+
content: `<font color='grey'>${options.note}</font>`,
|
|
684
|
+
element_id: "note"
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
const cardJson = {
|
|
688
|
+
schema: "2.0",
|
|
689
|
+
config: {
|
|
690
|
+
streaming_mode: true,
|
|
691
|
+
summary: { content: "[Generating...]" },
|
|
692
|
+
streaming_config: {
|
|
693
|
+
print_frequency_ms: { default: 50 },
|
|
694
|
+
print_step: { default: 1 }
|
|
695
|
+
}
|
|
696
|
+
},
|
|
697
|
+
body: { elements }
|
|
698
|
+
};
|
|
699
|
+
if (options?.header) cardJson.header = {
|
|
700
|
+
title: {
|
|
701
|
+
tag: "plain_text",
|
|
702
|
+
content: options.header.title
|
|
703
|
+
},
|
|
704
|
+
template: resolveFeishuCardTemplate(options.header.template) ?? "blue"
|
|
705
|
+
};
|
|
706
|
+
const { response: createRes, release: releaseCreate } = await fetchWithSsrFGuard({
|
|
707
|
+
url: `${apiBase}/cardkit/v1/cards`,
|
|
708
|
+
init: {
|
|
709
|
+
method: "POST",
|
|
710
|
+
headers: {
|
|
711
|
+
Authorization: `Bearer ${await getToken(this.creds)}`,
|
|
712
|
+
"Content-Type": "application/json"
|
|
713
|
+
},
|
|
714
|
+
body: JSON.stringify({
|
|
715
|
+
type: "card_json",
|
|
716
|
+
data: JSON.stringify(cardJson)
|
|
717
|
+
})
|
|
718
|
+
},
|
|
719
|
+
policy: { allowedHostnames: resolveAllowedHostnames(this.creds.domain) },
|
|
720
|
+
auditContext: "feishu.streaming-card.create"
|
|
721
|
+
});
|
|
722
|
+
if (!createRes.ok) {
|
|
723
|
+
await releaseCreate();
|
|
724
|
+
throw new Error(`Create card request failed with HTTP ${createRes.status}`);
|
|
725
|
+
}
|
|
726
|
+
const createData = await createRes.json();
|
|
727
|
+
await releaseCreate();
|
|
728
|
+
if (createData.code !== 0 || !createData.data?.card_id) throw new Error(`Create card failed: ${createData.msg}`);
|
|
729
|
+
const cardId = createData.data.card_id;
|
|
730
|
+
const cardContent = JSON.stringify({
|
|
731
|
+
type: "card",
|
|
732
|
+
data: { card_id: cardId }
|
|
733
|
+
});
|
|
734
|
+
let sendRes;
|
|
735
|
+
const sendOptions = options ?? {};
|
|
736
|
+
const sendMode = resolveStreamingCardSendMode(sendOptions);
|
|
737
|
+
if (sendMode === "reply") sendRes = await this.client.im.message.reply({
|
|
738
|
+
path: { message_id: sendOptions.replyToMessageId },
|
|
739
|
+
data: {
|
|
740
|
+
msg_type: "interactive",
|
|
741
|
+
content: cardContent,
|
|
742
|
+
...sendOptions.replyInThread ? { reply_in_thread: true } : {}
|
|
743
|
+
}
|
|
744
|
+
});
|
|
745
|
+
else if (sendMode === "root_create") sendRes = await this.client.im.message.create({
|
|
746
|
+
params: { receive_id_type: receiveIdType },
|
|
747
|
+
data: Object.assign({
|
|
748
|
+
receive_id: receiveId,
|
|
749
|
+
msg_type: "interactive",
|
|
750
|
+
content: cardContent
|
|
751
|
+
}, { root_id: sendOptions.rootId })
|
|
752
|
+
});
|
|
753
|
+
else sendRes = await this.client.im.message.create({
|
|
754
|
+
params: { receive_id_type: receiveIdType },
|
|
755
|
+
data: {
|
|
756
|
+
receive_id: receiveId,
|
|
757
|
+
msg_type: "interactive",
|
|
758
|
+
content: cardContent
|
|
759
|
+
}
|
|
760
|
+
});
|
|
761
|
+
if (sendRes.code !== 0 || !sendRes.data?.message_id) throw new Error(`Send card failed: ${sendRes.msg}`);
|
|
762
|
+
this.state = {
|
|
763
|
+
cardId,
|
|
764
|
+
messageId: sendRes.data.message_id,
|
|
765
|
+
sequence: 1,
|
|
766
|
+
currentText: "",
|
|
767
|
+
hasNote: !!options?.note
|
|
768
|
+
};
|
|
769
|
+
this.log?.(`Started streaming: cardId=${cardId}, messageId=${sendRes.data.message_id}`);
|
|
770
|
+
}
|
|
771
|
+
async updateCardContent(text, onError) {
|
|
772
|
+
if (!this.state) return;
|
|
773
|
+
const apiBase = resolveApiBase(this.creds.domain);
|
|
774
|
+
this.state.sequence += 1;
|
|
775
|
+
await fetchWithSsrFGuard({
|
|
776
|
+
url: `${apiBase}/cardkit/v1/cards/${this.state.cardId}/elements/content/content`,
|
|
777
|
+
init: {
|
|
778
|
+
method: "PUT",
|
|
779
|
+
headers: {
|
|
780
|
+
Authorization: `Bearer ${await getToken(this.creds)}`,
|
|
781
|
+
"Content-Type": "application/json"
|
|
782
|
+
},
|
|
783
|
+
body: JSON.stringify({
|
|
784
|
+
content: text,
|
|
785
|
+
sequence: this.state.sequence,
|
|
786
|
+
uuid: `s_${this.state.cardId}_${this.state.sequence}`
|
|
787
|
+
})
|
|
788
|
+
},
|
|
789
|
+
policy: { allowedHostnames: resolveAllowedHostnames(this.creds.domain) },
|
|
790
|
+
auditContext: "feishu.streaming-card.update"
|
|
791
|
+
}).then(async ({ release }) => {
|
|
792
|
+
await release();
|
|
793
|
+
}).catch((error) => onError?.(error));
|
|
794
|
+
}
|
|
795
|
+
async update(text) {
|
|
796
|
+
if (!this.state || this.closed) return;
|
|
797
|
+
const mergedInput = mergeStreamingText(this.pendingText ?? this.state.currentText, text);
|
|
798
|
+
if (!mergedInput || mergedInput === this.state.currentText) return;
|
|
799
|
+
const now = Date.now();
|
|
800
|
+
if (now - this.lastUpdateTime < this.updateThrottleMs) {
|
|
801
|
+
this.pendingText = mergedInput;
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
804
|
+
this.pendingText = null;
|
|
805
|
+
this.lastUpdateTime = now;
|
|
806
|
+
if (this.flushTimer) {
|
|
807
|
+
clearTimeout(this.flushTimer);
|
|
808
|
+
this.flushTimer = null;
|
|
809
|
+
}
|
|
810
|
+
this.queue = this.queue.then(async () => {
|
|
811
|
+
if (!this.state || this.closed) return;
|
|
812
|
+
const mergedText = mergeStreamingText(this.state.currentText, mergedInput);
|
|
813
|
+
if (!mergedText || mergedText === this.state.currentText) return;
|
|
814
|
+
this.state.currentText = mergedText;
|
|
815
|
+
await this.updateCardContent(mergedText, (e) => this.log?.(`Update failed: ${String(e)}`));
|
|
816
|
+
});
|
|
817
|
+
await this.queue;
|
|
818
|
+
}
|
|
819
|
+
async updateNoteContent(note) {
|
|
820
|
+
if (!this.state || !this.state.hasNote) return;
|
|
821
|
+
const apiBase = resolveApiBase(this.creds.domain);
|
|
822
|
+
this.state.sequence += 1;
|
|
823
|
+
await fetchWithSsrFGuard({
|
|
824
|
+
url: `${apiBase}/cardkit/v1/cards/${this.state.cardId}/elements/note/content`,
|
|
825
|
+
init: {
|
|
826
|
+
method: "PUT",
|
|
827
|
+
headers: {
|
|
828
|
+
Authorization: `Bearer ${await getToken(this.creds)}`,
|
|
829
|
+
"Content-Type": "application/json"
|
|
830
|
+
},
|
|
831
|
+
body: JSON.stringify({
|
|
832
|
+
content: `<font color='grey'>${note}</font>`,
|
|
833
|
+
sequence: this.state.sequence,
|
|
834
|
+
uuid: `n_${this.state.cardId}_${this.state.sequence}`
|
|
835
|
+
})
|
|
836
|
+
},
|
|
837
|
+
policy: { allowedHostnames: resolveAllowedHostnames(this.creds.domain) },
|
|
838
|
+
auditContext: "feishu.streaming-card.note-update"
|
|
839
|
+
}).then(async ({ release }) => {
|
|
840
|
+
await release();
|
|
841
|
+
}).catch((e) => this.log?.(`Note update failed: ${String(e)}`));
|
|
842
|
+
}
|
|
843
|
+
async close(finalText, options) {
|
|
844
|
+
if (!this.state || this.closed) return;
|
|
845
|
+
this.closed = true;
|
|
846
|
+
if (this.flushTimer) {
|
|
847
|
+
clearTimeout(this.flushTimer);
|
|
848
|
+
this.flushTimer = null;
|
|
849
|
+
}
|
|
850
|
+
await this.queue;
|
|
851
|
+
const pendingMerged = mergeStreamingText(this.state.currentText, this.pendingText ?? void 0);
|
|
852
|
+
const text = finalText ? mergeStreamingText(pendingMerged, finalText) : pendingMerged;
|
|
853
|
+
const apiBase = resolveApiBase(this.creds.domain);
|
|
854
|
+
if (text && text !== this.state.currentText) {
|
|
855
|
+
await this.updateCardContent(text);
|
|
856
|
+
this.state.currentText = text;
|
|
857
|
+
}
|
|
858
|
+
if (options?.note) await this.updateNoteContent(options.note);
|
|
859
|
+
this.state.sequence += 1;
|
|
860
|
+
await fetchWithSsrFGuard({
|
|
861
|
+
url: `${apiBase}/cardkit/v1/cards/${this.state.cardId}/settings`,
|
|
862
|
+
init: {
|
|
863
|
+
method: "PATCH",
|
|
864
|
+
headers: {
|
|
865
|
+
Authorization: `Bearer ${await getToken(this.creds)}`,
|
|
866
|
+
"Content-Type": "application/json; charset=utf-8"
|
|
867
|
+
},
|
|
868
|
+
body: JSON.stringify({
|
|
869
|
+
settings: JSON.stringify({ config: {
|
|
870
|
+
streaming_mode: false,
|
|
871
|
+
summary: { content: truncateSummary(text) }
|
|
872
|
+
} }),
|
|
873
|
+
sequence: this.state.sequence,
|
|
874
|
+
uuid: `c_${this.state.cardId}_${this.state.sequence}`
|
|
875
|
+
})
|
|
876
|
+
},
|
|
877
|
+
policy: { allowedHostnames: resolveAllowedHostnames(this.creds.domain) },
|
|
878
|
+
auditContext: "feishu.streaming-card.close"
|
|
879
|
+
}).then(async ({ release }) => {
|
|
880
|
+
await release();
|
|
881
|
+
}).catch((e) => this.log?.(`Close failed: ${String(e)}`));
|
|
882
|
+
const finalState = this.state;
|
|
883
|
+
this.state = null;
|
|
884
|
+
this.pendingText = null;
|
|
885
|
+
this.log?.(`Closed streaming: cardId=${finalState.cardId}`);
|
|
886
|
+
}
|
|
887
|
+
isActive() {
|
|
888
|
+
return this.state !== null && !this.closed;
|
|
889
|
+
}
|
|
890
|
+
};
|
|
891
|
+
//#endregion
|
|
892
|
+
//#region extensions/feishu/src/typing.ts
|
|
893
|
+
const TYPING_EMOJI = "Typing";
|
|
894
|
+
/**
|
|
895
|
+
* Feishu API error codes that indicate the caller should back off.
|
|
896
|
+
* These must propagate to the typing circuit breaker so the keepalive loop
|
|
897
|
+
* can trip and stop retrying.
|
|
898
|
+
*
|
|
899
|
+
* - 99991400: Rate limit (too many requests per second)
|
|
900
|
+
* - 99991403: Monthly API call quota exceeded
|
|
901
|
+
* - 429: Standard HTTP 429 returned as a Feishu SDK error code
|
|
902
|
+
*
|
|
903
|
+
* @see https://open.feishu.cn/document/server-docs/api-call-guide/generic-error-code
|
|
904
|
+
*/
|
|
905
|
+
const FEISHU_BACKOFF_CODES = new Set([
|
|
906
|
+
99991400,
|
|
907
|
+
99991403,
|
|
908
|
+
429
|
|
909
|
+
]);
|
|
910
|
+
/**
|
|
911
|
+
* Custom error class for Feishu backoff conditions detected from non-throwing
|
|
912
|
+
* SDK responses. Carries a numeric `.code` so that `isFeishuBackoffError()`
|
|
913
|
+
* recognises it when the error is caught downstream.
|
|
914
|
+
*/
|
|
915
|
+
var FeishuBackoffError = class extends Error {
|
|
916
|
+
constructor(code) {
|
|
917
|
+
super(`Feishu API backoff: code ${code}`);
|
|
918
|
+
this.name = "FeishuBackoffError";
|
|
919
|
+
this.code = code;
|
|
920
|
+
}
|
|
921
|
+
};
|
|
922
|
+
/**
|
|
923
|
+
* Check whether an error represents a rate-limit or quota-exceeded condition
|
|
924
|
+
* from the Feishu API that should stop the typing keepalive loop.
|
|
925
|
+
*
|
|
926
|
+
* Handles two shapes:
|
|
927
|
+
* 1. AxiosError with `response.status` and `response.data.code`
|
|
928
|
+
* 2. Feishu SDK error with a top-level `code` property
|
|
929
|
+
*/
|
|
930
|
+
function isFeishuBackoffError(err) {
|
|
931
|
+
if (typeof err !== "object" || err === null) return false;
|
|
932
|
+
const response = err.response;
|
|
933
|
+
if (response) {
|
|
934
|
+
if (response.status === 429) return true;
|
|
935
|
+
if (typeof response.data?.code === "number" && FEISHU_BACKOFF_CODES.has(response.data.code)) return true;
|
|
936
|
+
}
|
|
937
|
+
const code = err.code;
|
|
938
|
+
if (typeof code === "number" && FEISHU_BACKOFF_CODES.has(code)) return true;
|
|
939
|
+
return false;
|
|
940
|
+
}
|
|
941
|
+
/**
|
|
942
|
+
* Check whether a Feishu SDK response object contains a backoff error code.
|
|
943
|
+
*
|
|
944
|
+
* The Feishu SDK sometimes returns a normal response (no throw) with an
|
|
945
|
+
* API-level error code in the response body. This must be detected so the
|
|
946
|
+
* circuit breaker can trip. See codex review on #28157.
|
|
947
|
+
*/
|
|
948
|
+
function getBackoffCodeFromResponse(response) {
|
|
949
|
+
if (typeof response !== "object" || response === null) return;
|
|
950
|
+
const code = response.code;
|
|
951
|
+
if (typeof code === "number" && FEISHU_BACKOFF_CODES.has(code)) return code;
|
|
952
|
+
}
|
|
953
|
+
/**
|
|
954
|
+
* Add a typing indicator (reaction) to a message.
|
|
955
|
+
*
|
|
956
|
+
* Rate-limit and quota errors are re-thrown so the circuit breaker in
|
|
957
|
+
* `createTypingCallbacks` (typing-start-guard) can trip and stop the
|
|
958
|
+
* keepalive loop. See #28062.
|
|
959
|
+
*
|
|
960
|
+
* Also checks for backoff codes in non-throwing SDK responses (#28157).
|
|
961
|
+
*/
|
|
962
|
+
async function addTypingIndicator(params) {
|
|
963
|
+
const { cfg, messageId, accountId, runtime } = params;
|
|
964
|
+
const account = resolveFeishuRuntimeAccount({
|
|
965
|
+
cfg,
|
|
966
|
+
accountId
|
|
967
|
+
});
|
|
968
|
+
if (!account.configured) return {
|
|
969
|
+
messageId,
|
|
970
|
+
reactionId: null
|
|
971
|
+
};
|
|
972
|
+
const client = createFeishuClient(account);
|
|
973
|
+
try {
|
|
974
|
+
const response = await client.im.messageReaction.create({
|
|
975
|
+
path: { message_id: messageId },
|
|
976
|
+
data: { reaction_type: { emoji_type: TYPING_EMOJI } }
|
|
977
|
+
});
|
|
978
|
+
const backoffCode = getBackoffCodeFromResponse(response);
|
|
979
|
+
if (backoffCode !== void 0) {
|
|
980
|
+
if (getFeishuRuntime().logging.shouldLogVerbose()) runtime?.log?.(`[feishu] typing indicator response contains backoff code ${backoffCode}, stopping keepalive`);
|
|
981
|
+
throw new FeishuBackoffError(backoffCode);
|
|
982
|
+
}
|
|
983
|
+
return {
|
|
984
|
+
messageId,
|
|
985
|
+
reactionId: response.data?.reaction_id ?? null
|
|
986
|
+
};
|
|
987
|
+
} catch (err) {
|
|
988
|
+
if (isFeishuBackoffError(err)) {
|
|
989
|
+
if (getFeishuRuntime().logging.shouldLogVerbose()) runtime?.log?.("[feishu] typing indicator hit rate-limit/quota, stopping keepalive");
|
|
990
|
+
throw err;
|
|
991
|
+
}
|
|
992
|
+
if (getFeishuRuntime().logging.shouldLogVerbose()) runtime?.log?.(`[feishu] failed to add typing indicator: ${String(err)}`);
|
|
993
|
+
return {
|
|
994
|
+
messageId,
|
|
995
|
+
reactionId: null
|
|
996
|
+
};
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* Remove a typing indicator (reaction) from a message.
|
|
1001
|
+
*
|
|
1002
|
+
* Rate-limit and quota errors are re-thrown for the same reason as above.
|
|
1003
|
+
*/
|
|
1004
|
+
async function removeTypingIndicator(params) {
|
|
1005
|
+
const { cfg, state, accountId, runtime } = params;
|
|
1006
|
+
if (!state.reactionId) return;
|
|
1007
|
+
const account = resolveFeishuRuntimeAccount({
|
|
1008
|
+
cfg,
|
|
1009
|
+
accountId
|
|
1010
|
+
});
|
|
1011
|
+
if (!account.configured) return;
|
|
1012
|
+
const client = createFeishuClient(account);
|
|
1013
|
+
try {
|
|
1014
|
+
const backoffCode = getBackoffCodeFromResponse(await client.im.messageReaction.delete({ path: {
|
|
1015
|
+
message_id: state.messageId,
|
|
1016
|
+
reaction_id: state.reactionId
|
|
1017
|
+
} }));
|
|
1018
|
+
if (backoffCode !== void 0) {
|
|
1019
|
+
if (getFeishuRuntime().logging.shouldLogVerbose()) runtime?.log?.(`[feishu] typing indicator removal response contains backoff code ${backoffCode}, stopping keepalive`);
|
|
1020
|
+
throw new FeishuBackoffError(backoffCode);
|
|
1021
|
+
}
|
|
1022
|
+
} catch (err) {
|
|
1023
|
+
if (isFeishuBackoffError(err)) {
|
|
1024
|
+
if (getFeishuRuntime().logging.shouldLogVerbose()) runtime?.log?.("[feishu] typing indicator removal hit rate-limit/quota, stopping keepalive");
|
|
1025
|
+
throw err;
|
|
1026
|
+
}
|
|
1027
|
+
if (getFeishuRuntime().logging.shouldLogVerbose()) runtime?.log?.(`[feishu] failed to remove typing indicator: ${String(err)}`);
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
//#endregion
|
|
1031
|
+
//#region extensions/feishu/src/reply-dispatcher.ts
|
|
1032
|
+
/** Detect if text contains markdown elements that benefit from card rendering */
|
|
1033
|
+
function shouldUseCard(text) {
|
|
1034
|
+
return /```[\s\S]*?```/.test(text) || /\|.+\|[\r\n]+\|[-:| ]+\|/.test(text);
|
|
1035
|
+
}
|
|
1036
|
+
/** Maximum age (ms) for a message to receive a typing indicator reaction.
|
|
1037
|
+
* Messages older than this are likely replays after context compaction (#30418). */
|
|
1038
|
+
const TYPING_INDICATOR_MAX_AGE_MS = 2 * 6e4;
|
|
1039
|
+
const MS_EPOCH_MIN = 0xe8d4a51000;
|
|
1040
|
+
function normalizeEpochMs(timestamp) {
|
|
1041
|
+
if (!Number.isFinite(timestamp) || timestamp === void 0 || timestamp <= 0) return;
|
|
1042
|
+
return timestamp < MS_EPOCH_MIN ? timestamp * 1e3 : timestamp;
|
|
1043
|
+
}
|
|
1044
|
+
/** Build a card header from agent identity config. */
|
|
1045
|
+
function resolveCardHeader(agentId, identity) {
|
|
1046
|
+
const name = identity?.name?.trim() || agentId;
|
|
1047
|
+
const emoji = identity?.emoji?.trim();
|
|
1048
|
+
return {
|
|
1049
|
+
title: emoji ? `${emoji} ${name}` : name,
|
|
1050
|
+
template: identity?.theme ?? "blue"
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
1053
|
+
/** Build a card note footer from agent identity and model context. */
|
|
1054
|
+
function resolveCardNote(agentId, identity, prefixCtx) {
|
|
1055
|
+
const parts = [`Agent: ${identity?.name?.trim() || agentId}`];
|
|
1056
|
+
if (prefixCtx.model) parts.push(`Model: ${prefixCtx.model}`);
|
|
1057
|
+
if (prefixCtx.provider) parts.push(`Provider: ${prefixCtx.provider}`);
|
|
1058
|
+
return parts.join(" | ");
|
|
1059
|
+
}
|
|
1060
|
+
function createFeishuReplyDispatcher(params) {
|
|
1061
|
+
const core = getFeishuRuntime();
|
|
1062
|
+
const { cfg, agentId, chatId, replyToMessageId, skipReplyToInMessages, replyInThread, threadReply, rootId, mentionTargets, accountId, identity } = params;
|
|
1063
|
+
const sendReplyToMessageId = skipReplyToInMessages ? void 0 : replyToMessageId;
|
|
1064
|
+
const threadReplyMode = threadReply === true;
|
|
1065
|
+
const effectiveReplyInThread = threadReplyMode ? true : replyInThread;
|
|
1066
|
+
const account = resolveFeishuRuntimeAccount({
|
|
1067
|
+
cfg,
|
|
1068
|
+
accountId
|
|
1069
|
+
});
|
|
1070
|
+
const prefixContext = createReplyPrefixContext({
|
|
1071
|
+
cfg,
|
|
1072
|
+
agentId
|
|
1073
|
+
});
|
|
1074
|
+
let typingState = null;
|
|
1075
|
+
const { typingCallbacks } = createChannelReplyPipeline({
|
|
1076
|
+
cfg,
|
|
1077
|
+
agentId,
|
|
1078
|
+
channel: "feishu",
|
|
1079
|
+
accountId,
|
|
1080
|
+
typing: {
|
|
1081
|
+
start: async () => {
|
|
1082
|
+
if (!(account.config.typingIndicator ?? true)) return;
|
|
1083
|
+
if (!replyToMessageId) return;
|
|
1084
|
+
const messageCreateTimeMs = normalizeEpochMs(params.messageCreateTimeMs);
|
|
1085
|
+
if (messageCreateTimeMs !== void 0 && Date.now() - messageCreateTimeMs > TYPING_INDICATOR_MAX_AGE_MS) return;
|
|
1086
|
+
if (typingState?.reactionId) return;
|
|
1087
|
+
typingState = await addTypingIndicator({
|
|
1088
|
+
cfg,
|
|
1089
|
+
messageId: replyToMessageId,
|
|
1090
|
+
accountId,
|
|
1091
|
+
runtime: params.runtime
|
|
1092
|
+
});
|
|
1093
|
+
},
|
|
1094
|
+
stop: async () => {
|
|
1095
|
+
if (!typingState) return;
|
|
1096
|
+
await removeTypingIndicator({
|
|
1097
|
+
cfg,
|
|
1098
|
+
state: typingState,
|
|
1099
|
+
accountId,
|
|
1100
|
+
runtime: params.runtime
|
|
1101
|
+
});
|
|
1102
|
+
typingState = null;
|
|
1103
|
+
},
|
|
1104
|
+
onStartError: (err) => logTypingFailure({
|
|
1105
|
+
log: (message) => params.runtime.log?.(message),
|
|
1106
|
+
channel: "feishu",
|
|
1107
|
+
action: "start",
|
|
1108
|
+
error: err
|
|
1109
|
+
}),
|
|
1110
|
+
onStopError: (err) => logTypingFailure({
|
|
1111
|
+
log: (message) => params.runtime.log?.(message),
|
|
1112
|
+
channel: "feishu",
|
|
1113
|
+
action: "stop",
|
|
1114
|
+
error: err
|
|
1115
|
+
})
|
|
1116
|
+
}
|
|
1117
|
+
});
|
|
1118
|
+
const textChunkLimit = core.channel.text.resolveTextChunkLimit(cfg, "feishu", accountId, { fallbackLimit: 4e3 });
|
|
1119
|
+
const chunkMode = core.channel.text.resolveChunkMode(cfg, "feishu");
|
|
1120
|
+
const tableMode = core.channel.text.resolveMarkdownTableMode({
|
|
1121
|
+
cfg,
|
|
1122
|
+
channel: "feishu"
|
|
1123
|
+
});
|
|
1124
|
+
const renderMode = account.config?.renderMode ?? "auto";
|
|
1125
|
+
const streamingEnabled = !threadReplyMode && account.config?.streaming !== false && renderMode !== "raw";
|
|
1126
|
+
let streaming = null;
|
|
1127
|
+
let streamText = "";
|
|
1128
|
+
let lastPartial = "";
|
|
1129
|
+
let reasoningText = "";
|
|
1130
|
+
const deliveredFinalTexts = /* @__PURE__ */ new Set();
|
|
1131
|
+
let partialUpdateQueue = Promise.resolve();
|
|
1132
|
+
let streamingStartPromise = null;
|
|
1133
|
+
const formatReasoningPrefix = (thinking) => {
|
|
1134
|
+
if (!thinking) return "";
|
|
1135
|
+
return `> 💭 **Thinking**\n${thinking.replace(/^Reasoning:\n/, "").replace(/^_(.*)_$/gm, "$1").split("\n").map((line) => `> ${line}`).join("\n")}`;
|
|
1136
|
+
};
|
|
1137
|
+
const buildCombinedStreamText = (thinking, answer) => {
|
|
1138
|
+
const parts = [];
|
|
1139
|
+
if (thinking) parts.push(formatReasoningPrefix(thinking));
|
|
1140
|
+
if (thinking && answer) parts.push("\n\n---\n\n");
|
|
1141
|
+
if (answer) parts.push(answer);
|
|
1142
|
+
return parts.join("");
|
|
1143
|
+
};
|
|
1144
|
+
const flushStreamingCardUpdate = (combined) => {
|
|
1145
|
+
partialUpdateQueue = partialUpdateQueue.then(async () => {
|
|
1146
|
+
if (streamingStartPromise) await streamingStartPromise;
|
|
1147
|
+
if (streaming?.isActive()) await streaming.update(combined);
|
|
1148
|
+
});
|
|
1149
|
+
};
|
|
1150
|
+
const queueStreamingUpdate = (nextText, options) => {
|
|
1151
|
+
if (!nextText) return;
|
|
1152
|
+
if (options?.dedupeWithLastPartial && nextText === lastPartial) return;
|
|
1153
|
+
if (options?.dedupeWithLastPartial) lastPartial = nextText;
|
|
1154
|
+
streamText = (options?.mode ?? "snapshot") === "delta" ? `${streamText}${nextText}` : mergeStreamingText(streamText, nextText);
|
|
1155
|
+
flushStreamingCardUpdate(buildCombinedStreamText(reasoningText, streamText));
|
|
1156
|
+
};
|
|
1157
|
+
const queueReasoningUpdate = (nextThinking) => {
|
|
1158
|
+
if (!nextThinking) return;
|
|
1159
|
+
reasoningText = nextThinking;
|
|
1160
|
+
flushStreamingCardUpdate(buildCombinedStreamText(reasoningText, streamText));
|
|
1161
|
+
};
|
|
1162
|
+
const startStreaming = () => {
|
|
1163
|
+
if (!streamingEnabled || streamingStartPromise || streaming) return;
|
|
1164
|
+
streamingStartPromise = (async () => {
|
|
1165
|
+
const creds = account.appId && account.appSecret ? {
|
|
1166
|
+
appId: account.appId,
|
|
1167
|
+
appSecret: account.appSecret,
|
|
1168
|
+
domain: account.domain
|
|
1169
|
+
} : null;
|
|
1170
|
+
if (!creds) return;
|
|
1171
|
+
streaming = new FeishuStreamingSession(createFeishuClient(account), creds, (message) => params.runtime.log?.(`feishu[${account.accountId}] ${message}`));
|
|
1172
|
+
try {
|
|
1173
|
+
const cardHeader = resolveCardHeader(agentId, identity);
|
|
1174
|
+
const cardNote = resolveCardNote(agentId, identity, prefixContext.prefixContext);
|
|
1175
|
+
await streaming.start(chatId, resolveReceiveIdType(chatId), {
|
|
1176
|
+
replyToMessageId,
|
|
1177
|
+
replyInThread: effectiveReplyInThread,
|
|
1178
|
+
rootId,
|
|
1179
|
+
header: cardHeader,
|
|
1180
|
+
note: cardNote
|
|
1181
|
+
});
|
|
1182
|
+
} catch (error) {
|
|
1183
|
+
params.runtime.error?.(`feishu: streaming start failed: ${String(error)}`);
|
|
1184
|
+
streaming = null;
|
|
1185
|
+
streamingStartPromise = null;
|
|
1186
|
+
}
|
|
1187
|
+
})();
|
|
1188
|
+
};
|
|
1189
|
+
const closeStreaming = async () => {
|
|
1190
|
+
if (streamingStartPromise) await streamingStartPromise;
|
|
1191
|
+
await partialUpdateQueue;
|
|
1192
|
+
if (streaming?.isActive()) {
|
|
1193
|
+
let text = buildCombinedStreamText(reasoningText, streamText);
|
|
1194
|
+
if (mentionTargets?.length) text = buildMentionedCardContent(mentionTargets, text);
|
|
1195
|
+
const finalNote = resolveCardNote(agentId, identity, prefixContext.prefixContext);
|
|
1196
|
+
await streaming.close(text, { note: finalNote });
|
|
1197
|
+
}
|
|
1198
|
+
streaming = null;
|
|
1199
|
+
streamingStartPromise = null;
|
|
1200
|
+
streamText = "";
|
|
1201
|
+
lastPartial = "";
|
|
1202
|
+
reasoningText = "";
|
|
1203
|
+
};
|
|
1204
|
+
const sendChunkedTextReply = async (params) => {
|
|
1205
|
+
const chunkSource = params.useCard ? params.text : core.channel.text.convertMarkdownTables(params.text, tableMode);
|
|
1206
|
+
const chunks = resolveTextChunksWithFallback(chunkSource, core.channel.text.chunkTextWithMode(chunkSource, textChunkLimit, chunkMode));
|
|
1207
|
+
for (const [index, chunk] of chunks.entries()) await params.sendChunk({
|
|
1208
|
+
chunk,
|
|
1209
|
+
isFirst: index === 0
|
|
1210
|
+
});
|
|
1211
|
+
if (params.infoKind === "final") deliveredFinalTexts.add(params.text);
|
|
1212
|
+
};
|
|
1213
|
+
const sendMediaReplies = async (payload) => {
|
|
1214
|
+
await sendMediaWithLeadingCaption({
|
|
1215
|
+
mediaUrls: resolveSendableOutboundReplyParts(payload).mediaUrls,
|
|
1216
|
+
caption: "",
|
|
1217
|
+
send: async ({ mediaUrl }) => {
|
|
1218
|
+
await sendMediaFeishu({
|
|
1219
|
+
cfg,
|
|
1220
|
+
to: chatId,
|
|
1221
|
+
mediaUrl,
|
|
1222
|
+
replyToMessageId: sendReplyToMessageId,
|
|
1223
|
+
replyInThread: effectiveReplyInThread,
|
|
1224
|
+
accountId
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1227
|
+
});
|
|
1228
|
+
};
|
|
1229
|
+
const { dispatcher, replyOptions, markDispatchIdle } = core.channel.reply.createReplyDispatcherWithTyping({
|
|
1230
|
+
responsePrefix: prefixContext.responsePrefix,
|
|
1231
|
+
responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
|
|
1232
|
+
humanDelay: core.channel.reply.resolveHumanDelayConfig(cfg, agentId),
|
|
1233
|
+
onReplyStart: async () => {
|
|
1234
|
+
deliveredFinalTexts.clear();
|
|
1235
|
+
if (streamingEnabled && renderMode === "card") startStreaming();
|
|
1236
|
+
await typingCallbacks?.onReplyStart?.();
|
|
1237
|
+
},
|
|
1238
|
+
deliver: async (payload, info) => {
|
|
1239
|
+
const reply = resolveSendableOutboundReplyParts(payload);
|
|
1240
|
+
const text = reply.text;
|
|
1241
|
+
const hasText = reply.hasText;
|
|
1242
|
+
const hasMedia = reply.hasMedia;
|
|
1243
|
+
const skipTextForDuplicateFinal = info?.kind === "final" && hasText && deliveredFinalTexts.has(text);
|
|
1244
|
+
const shouldDeliverText = hasText && !skipTextForDuplicateFinal;
|
|
1245
|
+
if (!shouldDeliverText && !hasMedia) return;
|
|
1246
|
+
if (shouldDeliverText) {
|
|
1247
|
+
const useCard = renderMode === "card" || renderMode === "auto" && shouldUseCard(text);
|
|
1248
|
+
if (info?.kind === "block") {
|
|
1249
|
+
if (!(streamingEnabled && useCard)) return;
|
|
1250
|
+
startStreaming();
|
|
1251
|
+
if (streamingStartPromise) await streamingStartPromise;
|
|
1252
|
+
}
|
|
1253
|
+
if (info?.kind === "final" && streamingEnabled && useCard) {
|
|
1254
|
+
startStreaming();
|
|
1255
|
+
if (streamingStartPromise) await streamingStartPromise;
|
|
1256
|
+
}
|
|
1257
|
+
if (streaming?.isActive()) {
|
|
1258
|
+
if (info?.kind === "block") queueStreamingUpdate(text, { mode: "delta" });
|
|
1259
|
+
if (info?.kind === "final") {
|
|
1260
|
+
streamText = mergeStreamingText(streamText, text);
|
|
1261
|
+
await closeStreaming();
|
|
1262
|
+
deliveredFinalTexts.add(text);
|
|
1263
|
+
}
|
|
1264
|
+
if (hasMedia) await sendMediaReplies(payload);
|
|
1265
|
+
return;
|
|
1266
|
+
}
|
|
1267
|
+
if (useCard) {
|
|
1268
|
+
const cardHeader = resolveCardHeader(agentId, identity);
|
|
1269
|
+
const cardNote = resolveCardNote(agentId, identity, prefixContext.prefixContext);
|
|
1270
|
+
await sendChunkedTextReply({
|
|
1271
|
+
text,
|
|
1272
|
+
useCard: true,
|
|
1273
|
+
infoKind: info?.kind,
|
|
1274
|
+
sendChunk: async ({ chunk, isFirst }) => {
|
|
1275
|
+
await sendStructuredCardFeishu({
|
|
1276
|
+
cfg,
|
|
1277
|
+
to: chatId,
|
|
1278
|
+
text: chunk,
|
|
1279
|
+
replyToMessageId: sendReplyToMessageId,
|
|
1280
|
+
replyInThread: effectiveReplyInThread,
|
|
1281
|
+
mentions: isFirst ? mentionTargets : void 0,
|
|
1282
|
+
accountId,
|
|
1283
|
+
header: cardHeader,
|
|
1284
|
+
note: cardNote
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1287
|
+
});
|
|
1288
|
+
} else await sendChunkedTextReply({
|
|
1289
|
+
text,
|
|
1290
|
+
useCard: false,
|
|
1291
|
+
infoKind: info?.kind,
|
|
1292
|
+
sendChunk: async ({ chunk, isFirst }) => {
|
|
1293
|
+
await sendMessageFeishu({
|
|
1294
|
+
cfg,
|
|
1295
|
+
to: chatId,
|
|
1296
|
+
text: chunk,
|
|
1297
|
+
replyToMessageId: sendReplyToMessageId,
|
|
1298
|
+
replyInThread: effectiveReplyInThread,
|
|
1299
|
+
mentions: isFirst ? mentionTargets : void 0,
|
|
1300
|
+
accountId
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
if (hasMedia) await sendMediaReplies(payload);
|
|
1306
|
+
},
|
|
1307
|
+
onError: async (error, info) => {
|
|
1308
|
+
params.runtime.error?.(`feishu[${account.accountId}] ${info.kind} reply failed: ${String(error)}`);
|
|
1309
|
+
await closeStreaming();
|
|
1310
|
+
typingCallbacks?.onIdle?.();
|
|
1311
|
+
},
|
|
1312
|
+
onIdle: async () => {
|
|
1313
|
+
await closeStreaming();
|
|
1314
|
+
typingCallbacks?.onIdle?.();
|
|
1315
|
+
},
|
|
1316
|
+
onCleanup: () => {
|
|
1317
|
+
typingCallbacks?.onCleanup?.();
|
|
1318
|
+
}
|
|
1319
|
+
});
|
|
1320
|
+
return {
|
|
1321
|
+
dispatcher,
|
|
1322
|
+
replyOptions: {
|
|
1323
|
+
...replyOptions,
|
|
1324
|
+
onModelSelected: prefixContext.onModelSelected,
|
|
1325
|
+
disableBlockStreaming: true,
|
|
1326
|
+
onPartialReply: streamingEnabled ? (payload) => {
|
|
1327
|
+
if (!payload.text) return;
|
|
1328
|
+
queueStreamingUpdate(payload.text, {
|
|
1329
|
+
dedupeWithLastPartial: true,
|
|
1330
|
+
mode: "snapshot"
|
|
1331
|
+
});
|
|
1332
|
+
} : void 0,
|
|
1333
|
+
onReasoningStream: streamingEnabled ? (payload) => {
|
|
1334
|
+
if (!payload.text) return;
|
|
1335
|
+
startStreaming();
|
|
1336
|
+
queueReasoningUpdate(payload.text);
|
|
1337
|
+
} : void 0,
|
|
1338
|
+
onReasoningEnd: streamingEnabled ? () => {} : void 0
|
|
1339
|
+
},
|
|
1340
|
+
markDispatchIdle
|
|
1341
|
+
};
|
|
1342
|
+
}
|
|
1343
|
+
//#endregion
|
|
1344
|
+
//#region extensions/feishu/src/bot.ts
|
|
1345
|
+
const permissionErrorNotifiedAt = /* @__PURE__ */ new Map();
|
|
1346
|
+
const PERMISSION_ERROR_COOLDOWN_MS = 300 * 1e3;
|
|
1347
|
+
function resolveBroadcastAgents(cfg, peerId) {
|
|
1348
|
+
const broadcast = cfg.broadcast;
|
|
1349
|
+
if (!broadcast || typeof broadcast !== "object") return null;
|
|
1350
|
+
const agents = broadcast[peerId];
|
|
1351
|
+
if (!Array.isArray(agents) || agents.length === 0) return null;
|
|
1352
|
+
return agents;
|
|
1353
|
+
}
|
|
1354
|
+
function buildBroadcastSessionKey(baseSessionKey, originalAgentId, targetAgentId) {
|
|
1355
|
+
const prefix = `agent:${originalAgentId}:`;
|
|
1356
|
+
if (baseSessionKey.startsWith(prefix)) return `agent:${targetAgentId}:${baseSessionKey.slice(prefix.length)}`;
|
|
1357
|
+
return baseSessionKey;
|
|
1358
|
+
}
|
|
1359
|
+
/**
|
|
1360
|
+
* Build media payload for inbound context.
|
|
1361
|
+
* Similar to Discord's buildDiscordMediaPayload().
|
|
1362
|
+
*/
|
|
1363
|
+
function parseFeishuMessageEvent(event, botOpenId, _botName) {
|
|
1364
|
+
const rawContent = parseMessageContent(event.message.content, event.message.message_type);
|
|
1365
|
+
const mentionedBot = checkBotMentioned(event, botOpenId);
|
|
1366
|
+
const hasAnyMention = (event.message.mentions?.length ?? 0) > 0;
|
|
1367
|
+
const content = normalizeMentions(rawContent, event.message.mentions, botOpenId);
|
|
1368
|
+
const senderOpenId = event.sender.sender_id.open_id?.trim();
|
|
1369
|
+
const senderUserId = event.sender.sender_id.user_id?.trim();
|
|
1370
|
+
const senderFallbackId = senderOpenId || senderUserId || "";
|
|
1371
|
+
const ctx = {
|
|
1372
|
+
chatId: event.message.chat_id,
|
|
1373
|
+
messageId: event.message.message_id,
|
|
1374
|
+
senderId: senderUserId || senderOpenId || "",
|
|
1375
|
+
senderOpenId: senderFallbackId,
|
|
1376
|
+
chatType: event.message.chat_type,
|
|
1377
|
+
mentionedBot,
|
|
1378
|
+
hasAnyMention,
|
|
1379
|
+
rootId: event.message.root_id || void 0,
|
|
1380
|
+
parentId: event.message.parent_id || void 0,
|
|
1381
|
+
threadId: event.message.thread_id || void 0,
|
|
1382
|
+
content,
|
|
1383
|
+
contentType: event.message.message_type
|
|
1384
|
+
};
|
|
1385
|
+
if (isMentionForwardRequest(event, botOpenId)) {
|
|
1386
|
+
const mentionTargets = extractMentionTargets(event, botOpenId);
|
|
1387
|
+
if (mentionTargets.length > 0) ctx.mentionTargets = mentionTargets;
|
|
1388
|
+
}
|
|
1389
|
+
return ctx;
|
|
1390
|
+
}
|
|
1391
|
+
function buildFeishuAgentBody(params) {
|
|
1392
|
+
const { ctx, quotedContent, permissionErrorForAgent, botOpenId } = params;
|
|
1393
|
+
let messageBody = ctx.content;
|
|
1394
|
+
if (quotedContent) messageBody = `[Replying to: "${quotedContent}"]\n\n${ctx.content}`;
|
|
1395
|
+
messageBody = `${ctx.senderName ?? ctx.senderOpenId}: ${messageBody}`;
|
|
1396
|
+
if (ctx.hasAnyMention) {
|
|
1397
|
+
const botIdHint = botOpenId?.trim();
|
|
1398
|
+
messageBody += "\n\n[System: The content may include mention tags in the form <at user_id=\"...\">name</at>. Treat these as real mentions of Feishu entities (users or bots).]";
|
|
1399
|
+
if (botIdHint) messageBody += `\n[System: If user_id is "${botIdHint}", that mention refers to you.]`;
|
|
1400
|
+
}
|
|
1401
|
+
if (ctx.mentionTargets && ctx.mentionTargets.length > 0) {
|
|
1402
|
+
const targetNames = ctx.mentionTargets.map((t) => t.name).join(", ");
|
|
1403
|
+
messageBody += `\n\n[System: Your reply will automatically @mention: ${targetNames}. Do not write @xxx yourself.]`;
|
|
1404
|
+
}
|
|
1405
|
+
messageBody = `[message_id: ${ctx.messageId}]\n${messageBody}`;
|
|
1406
|
+
if (permissionErrorForAgent) {
|
|
1407
|
+
const grantUrl = permissionErrorForAgent.grantUrl ?? "";
|
|
1408
|
+
messageBody += `\n\n[System: The bot encountered a Feishu API permission error. Please inform the user about this issue and provide the permission grant URL for the admin to authorize. Permission grant URL: ${grantUrl}]`;
|
|
1409
|
+
}
|
|
1410
|
+
return messageBody;
|
|
1411
|
+
}
|
|
1412
|
+
function isFetchedGroupContextSenderAllowed(params) {
|
|
1413
|
+
if (!params.isGroup || params.allowFrom.length === 0) return true;
|
|
1414
|
+
if (params.senderType === "app") return true;
|
|
1415
|
+
const senderId = params.senderId?.trim();
|
|
1416
|
+
return !!senderId && isFeishuGroupAllowed({
|
|
1417
|
+
groupPolicy: "allowlist",
|
|
1418
|
+
allowFrom: params.allowFrom,
|
|
1419
|
+
senderId,
|
|
1420
|
+
senderName: void 0
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
function shouldIncludeFetchedGroupContextMessage(params) {
|
|
1424
|
+
const senderAllowed = isFetchedGroupContextSenderAllowed({
|
|
1425
|
+
isGroup: params.isGroup,
|
|
1426
|
+
allowFrom: params.allowFrom,
|
|
1427
|
+
senderId: params.senderId,
|
|
1428
|
+
senderType: params.senderType
|
|
1429
|
+
});
|
|
1430
|
+
return evaluateSupplementalContextVisibility({
|
|
1431
|
+
mode: params.mode,
|
|
1432
|
+
kind: params.kind,
|
|
1433
|
+
senderAllowed
|
|
1434
|
+
}).include;
|
|
1435
|
+
}
|
|
1436
|
+
function filterFetchedGroupContextMessages(messages, params) {
|
|
1437
|
+
return filterSupplementalContextItems({
|
|
1438
|
+
items: messages,
|
|
1439
|
+
mode: params.mode,
|
|
1440
|
+
kind: params.kind,
|
|
1441
|
+
isSenderAllowed: (message) => isFetchedGroupContextSenderAllowed({
|
|
1442
|
+
isGroup: params.isGroup,
|
|
1443
|
+
allowFrom: params.allowFrom,
|
|
1444
|
+
senderId: message.senderId,
|
|
1445
|
+
senderType: message.senderType
|
|
1446
|
+
})
|
|
1447
|
+
}).items;
|
|
1448
|
+
}
|
|
1449
|
+
async function handleFeishuMessage(params) {
|
|
1450
|
+
const { cfg, event, botOpenId, botName, runtime, chatHistories, accountId, processingClaimHeld = false } = params;
|
|
1451
|
+
const account = resolveFeishuRuntimeAccount({
|
|
1452
|
+
cfg,
|
|
1453
|
+
accountId
|
|
1454
|
+
});
|
|
1455
|
+
const feishuCfg = account.config;
|
|
1456
|
+
const log = runtime?.log ?? console.log;
|
|
1457
|
+
const error = runtime?.error ?? console.error;
|
|
1458
|
+
const messageId = event.message.message_id;
|
|
1459
|
+
if (!await finalizeFeishuMessageProcessing({
|
|
1460
|
+
messageId,
|
|
1461
|
+
namespace: account.accountId,
|
|
1462
|
+
log,
|
|
1463
|
+
claimHeld: processingClaimHeld
|
|
1464
|
+
})) {
|
|
1465
|
+
log(`feishu: skipping duplicate message ${messageId}`);
|
|
1466
|
+
return;
|
|
1467
|
+
}
|
|
1468
|
+
let ctx = parseFeishuMessageEvent(event, botOpenId, botName);
|
|
1469
|
+
const isGroup = ctx.chatType === "group";
|
|
1470
|
+
const isDirect = !isGroup;
|
|
1471
|
+
const senderUserId = event.sender.sender_id.user_id?.trim() || void 0;
|
|
1472
|
+
if (event.message.message_type === "merge_forward") {
|
|
1473
|
+
log(`feishu[${account.accountId}]: processing merge_forward message, fetching full content via API`);
|
|
1474
|
+
try {
|
|
1475
|
+
const response = await createFeishuClient(account).im.message.get({ path: { message_id: event.message.message_id } });
|
|
1476
|
+
if (response.code === 0 && response.data?.items && response.data.items.length > 0) {
|
|
1477
|
+
log(`feishu[${account.accountId}]: merge_forward API returned ${response.data.items.length} items`);
|
|
1478
|
+
const expandedContent = parseMergeForwardContent({
|
|
1479
|
+
content: JSON.stringify(response.data.items),
|
|
1480
|
+
log
|
|
1481
|
+
});
|
|
1482
|
+
ctx = {
|
|
1483
|
+
...ctx,
|
|
1484
|
+
content: expandedContent
|
|
1485
|
+
};
|
|
1486
|
+
} else {
|
|
1487
|
+
log(`feishu[${account.accountId}]: merge_forward API returned no items`);
|
|
1488
|
+
ctx = {
|
|
1489
|
+
...ctx,
|
|
1490
|
+
content: "[Merged and Forwarded Message - could not fetch]"
|
|
1491
|
+
};
|
|
1492
|
+
}
|
|
1493
|
+
} catch (err) {
|
|
1494
|
+
log(`feishu[${account.accountId}]: merge_forward fetch failed: ${String(err)}`);
|
|
1495
|
+
ctx = {
|
|
1496
|
+
...ctx,
|
|
1497
|
+
content: "[Merged and Forwarded Message - fetch error]"
|
|
1498
|
+
};
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
let permissionErrorForAgent;
|
|
1502
|
+
if (feishuCfg?.resolveSenderNames ?? true) {
|
|
1503
|
+
const senderResult = await resolveFeishuSenderName({
|
|
1504
|
+
account,
|
|
1505
|
+
senderId: ctx.senderOpenId,
|
|
1506
|
+
log
|
|
1507
|
+
});
|
|
1508
|
+
if (senderResult.name) ctx = {
|
|
1509
|
+
...ctx,
|
|
1510
|
+
senderName: senderResult.name
|
|
1511
|
+
};
|
|
1512
|
+
if (senderResult.permissionError) {
|
|
1513
|
+
const appKey = account.appId ?? "default";
|
|
1514
|
+
const now = Date.now();
|
|
1515
|
+
if (now - (permissionErrorNotifiedAt.get(appKey) ?? 0) > PERMISSION_ERROR_COOLDOWN_MS) {
|
|
1516
|
+
permissionErrorNotifiedAt.set(appKey, now);
|
|
1517
|
+
permissionErrorForAgent = senderResult.permissionError;
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
log(`feishu[${account.accountId}]: received message from ${ctx.senderOpenId} in ${ctx.chatId} (${ctx.chatType})`);
|
|
1522
|
+
if (ctx.mentionTargets && ctx.mentionTargets.length > 0) {
|
|
1523
|
+
const names = ctx.mentionTargets.map((t) => t.name).join(", ");
|
|
1524
|
+
log(`feishu[${account.accountId}]: detected @ forward request, targets: [${names}]`);
|
|
1525
|
+
}
|
|
1526
|
+
const historyLimit = Math.max(0, feishuCfg?.historyLimit ?? cfg.messages?.groupChat?.historyLimit ?? 50);
|
|
1527
|
+
const groupConfig = isGroup ? resolveFeishuGroupConfig({
|
|
1528
|
+
cfg: feishuCfg,
|
|
1529
|
+
groupId: ctx.chatId
|
|
1530
|
+
}) : void 0;
|
|
1531
|
+
const effectiveGroupSenderAllowFrom = isGroup ? (groupConfig?.allowFrom?.length ?? 0) > 0 ? groupConfig?.allowFrom ?? [] : feishuCfg?.groupSenderAllowFrom ?? [] : [];
|
|
1532
|
+
const groupSession = isGroup ? resolveFeishuGroupSession({
|
|
1533
|
+
chatId: ctx.chatId,
|
|
1534
|
+
senderOpenId: ctx.senderOpenId,
|
|
1535
|
+
messageId: ctx.messageId,
|
|
1536
|
+
rootId: ctx.rootId,
|
|
1537
|
+
threadId: ctx.threadId,
|
|
1538
|
+
groupConfig,
|
|
1539
|
+
feishuCfg
|
|
1540
|
+
}) : null;
|
|
1541
|
+
const groupHistoryKey = isGroup ? groupSession?.peerId ?? ctx.chatId : void 0;
|
|
1542
|
+
const dmPolicy = feishuCfg?.dmPolicy ?? "pairing";
|
|
1543
|
+
const configAllowFrom = feishuCfg?.allowFrom ?? [];
|
|
1544
|
+
const useAccessGroups = cfg.commands?.useAccessGroups !== false;
|
|
1545
|
+
const rawBroadcastAgents = isGroup ? resolveBroadcastAgents(cfg, ctx.chatId) : null;
|
|
1546
|
+
const broadcastAgents = rawBroadcastAgents ? [...new Set(rawBroadcastAgents.map((id) => normalizeAgentId(id)))] : null;
|
|
1547
|
+
const messageCreateTimeMs = event.message.create_time ? parseInt(event.message.create_time, 10) : Date.now();
|
|
1548
|
+
let requireMention = false;
|
|
1549
|
+
if (isGroup) {
|
|
1550
|
+
if (groupConfig?.enabled === false) {
|
|
1551
|
+
log(`feishu[${account.accountId}]: group ${ctx.chatId} is disabled`);
|
|
1552
|
+
return;
|
|
1553
|
+
}
|
|
1554
|
+
const defaultGroupPolicy = resolveDefaultGroupPolicy(cfg);
|
|
1555
|
+
const { groupPolicy, providerMissingFallbackApplied } = resolveOpenProviderRuntimeGroupPolicy({
|
|
1556
|
+
providerConfigPresent: cfg.channels?.feishu !== void 0,
|
|
1557
|
+
groupPolicy: feishuCfg?.groupPolicy,
|
|
1558
|
+
defaultGroupPolicy
|
|
1559
|
+
});
|
|
1560
|
+
warnMissingProviderGroupPolicyFallbackOnce({
|
|
1561
|
+
providerMissingFallbackApplied,
|
|
1562
|
+
providerKey: "feishu",
|
|
1563
|
+
accountId: account.accountId,
|
|
1564
|
+
log
|
|
1565
|
+
});
|
|
1566
|
+
if (!isFeishuGroupAllowed({
|
|
1567
|
+
groupPolicy,
|
|
1568
|
+
allowFrom: feishuCfg?.groupAllowFrom ?? [],
|
|
1569
|
+
senderId: ctx.chatId,
|
|
1570
|
+
senderName: void 0
|
|
1571
|
+
})) {
|
|
1572
|
+
log(`feishu[${account.accountId}]: group ${ctx.chatId} not in groupAllowFrom (groupPolicy=${groupPolicy})`);
|
|
1573
|
+
return;
|
|
1574
|
+
}
|
|
1575
|
+
if (effectiveGroupSenderAllowFrom.length > 0) {
|
|
1576
|
+
if (!isFeishuGroupAllowed({
|
|
1577
|
+
groupPolicy: "allowlist",
|
|
1578
|
+
allowFrom: effectiveGroupSenderAllowFrom,
|
|
1579
|
+
senderId: ctx.senderOpenId,
|
|
1580
|
+
senderIds: [senderUserId],
|
|
1581
|
+
senderName: ctx.senderName
|
|
1582
|
+
})) {
|
|
1583
|
+
log(`feishu: sender ${ctx.senderOpenId} not in group ${ctx.chatId} sender allowlist`);
|
|
1584
|
+
return;
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
({requireMention} = resolveFeishuReplyPolicy({
|
|
1588
|
+
isDirectMessage: false,
|
|
1589
|
+
cfg,
|
|
1590
|
+
accountId: account.accountId,
|
|
1591
|
+
groupId: ctx.chatId,
|
|
1592
|
+
groupPolicy
|
|
1593
|
+
}));
|
|
1594
|
+
if (requireMention && !ctx.mentionedBot) {
|
|
1595
|
+
log(`feishu[${account.accountId}]: message in group ${ctx.chatId} did not mention bot`);
|
|
1596
|
+
if (!broadcastAgents && chatHistories && groupHistoryKey) recordPendingHistoryEntryIfEnabled({
|
|
1597
|
+
historyMap: chatHistories,
|
|
1598
|
+
historyKey: groupHistoryKey,
|
|
1599
|
+
limit: historyLimit,
|
|
1600
|
+
entry: {
|
|
1601
|
+
sender: ctx.senderOpenId,
|
|
1602
|
+
body: `${ctx.senderName ?? ctx.senderOpenId}: ${ctx.content}`,
|
|
1603
|
+
timestamp: messageCreateTimeMs,
|
|
1604
|
+
messageId: ctx.messageId
|
|
1605
|
+
}
|
|
1606
|
+
});
|
|
1607
|
+
return;
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
try {
|
|
1611
|
+
const core = getFeishuRuntime();
|
|
1612
|
+
const pairing = createChannelPairingController({
|
|
1613
|
+
core,
|
|
1614
|
+
channel: "feishu",
|
|
1615
|
+
accountId: account.accountId
|
|
1616
|
+
});
|
|
1617
|
+
const commandProbeBody = isGroup ? normalizeFeishuCommandProbeBody(ctx.content) : ctx.content;
|
|
1618
|
+
const shouldComputeCommandAuthorized = core.channel.commands.shouldComputeCommandAuthorized(commandProbeBody, cfg);
|
|
1619
|
+
const storeAllowFrom = !isGroup && dmPolicy !== "allowlist" && (dmPolicy !== "open" || shouldComputeCommandAuthorized) ? await pairing.readAllowFromStore().catch(() => []) : [];
|
|
1620
|
+
const effectiveDmAllowFrom = [...configAllowFrom, ...storeAllowFrom];
|
|
1621
|
+
const dmAllowed = resolveFeishuAllowlistMatch({
|
|
1622
|
+
allowFrom: effectiveDmAllowFrom,
|
|
1623
|
+
senderId: ctx.senderOpenId,
|
|
1624
|
+
senderIds: [senderUserId],
|
|
1625
|
+
senderName: ctx.senderName
|
|
1626
|
+
}).allowed;
|
|
1627
|
+
if (isDirect && dmPolicy !== "open" && !dmAllowed) {
|
|
1628
|
+
if (dmPolicy === "pairing") await pairing.issueChallenge({
|
|
1629
|
+
senderId: ctx.senderOpenId,
|
|
1630
|
+
senderIdLine: `Your Feishu user id: ${ctx.senderOpenId}`,
|
|
1631
|
+
meta: { name: ctx.senderName },
|
|
1632
|
+
onCreated: () => {
|
|
1633
|
+
log(`feishu[${account.accountId}]: pairing request sender=${ctx.senderOpenId}`);
|
|
1634
|
+
},
|
|
1635
|
+
sendPairingReply: async (text) => {
|
|
1636
|
+
await sendMessageFeishu({
|
|
1637
|
+
cfg,
|
|
1638
|
+
to: `chat:${ctx.chatId}`,
|
|
1639
|
+
text,
|
|
1640
|
+
accountId: account.accountId
|
|
1641
|
+
});
|
|
1642
|
+
},
|
|
1643
|
+
onReplyError: (err) => {
|
|
1644
|
+
log(`feishu[${account.accountId}]: pairing reply failed for ${ctx.senderOpenId}: ${String(err)}`);
|
|
1645
|
+
}
|
|
1646
|
+
});
|
|
1647
|
+
else log(`feishu[${account.accountId}]: blocked unauthorized sender ${ctx.senderOpenId} (dmPolicy=${dmPolicy})`);
|
|
1648
|
+
return;
|
|
1649
|
+
}
|
|
1650
|
+
const commandAllowFrom = isGroup ? groupConfig?.allowFrom ?? configAllowFrom : effectiveDmAllowFrom;
|
|
1651
|
+
const senderAllowedForCommands = resolveFeishuAllowlistMatch({
|
|
1652
|
+
allowFrom: commandAllowFrom,
|
|
1653
|
+
senderId: ctx.senderOpenId,
|
|
1654
|
+
senderIds: [senderUserId],
|
|
1655
|
+
senderName: ctx.senderName
|
|
1656
|
+
}).allowed;
|
|
1657
|
+
const commandAuthorized = shouldComputeCommandAuthorized ? core.channel.commands.resolveCommandAuthorizedFromAuthorizers({
|
|
1658
|
+
useAccessGroups,
|
|
1659
|
+
authorizers: [{
|
|
1660
|
+
configured: commandAllowFrom.length > 0,
|
|
1661
|
+
allowed: senderAllowedForCommands
|
|
1662
|
+
}]
|
|
1663
|
+
}) : void 0;
|
|
1664
|
+
const feishuFrom = `feishu:${ctx.senderOpenId}`;
|
|
1665
|
+
const feishuTo = isGroup ? `chat:${ctx.chatId}` : `user:${ctx.senderOpenId}`;
|
|
1666
|
+
const peerId = isGroup ? groupSession?.peerId ?? ctx.chatId : ctx.senderOpenId;
|
|
1667
|
+
const parentPeer = isGroup ? groupSession?.parentPeer ?? null : null;
|
|
1668
|
+
const replyInThread = isGroup ? groupSession?.replyInThread ?? false : false;
|
|
1669
|
+
const feishuAcpConversationSupported = !isGroup || groupSession?.groupSessionScope === "group_topic" || groupSession?.groupSessionScope === "group_topic_sender";
|
|
1670
|
+
if (isGroup && groupSession) log(`feishu[${account.accountId}]: group session scope=${groupSession.groupSessionScope}, peer=${peerId}`);
|
|
1671
|
+
let route = core.channel.routing.resolveAgentRoute({
|
|
1672
|
+
cfg,
|
|
1673
|
+
channel: "feishu",
|
|
1674
|
+
accountId: account.accountId,
|
|
1675
|
+
peer: {
|
|
1676
|
+
kind: isGroup ? "group" : "direct",
|
|
1677
|
+
id: peerId
|
|
1678
|
+
},
|
|
1679
|
+
parentPeer
|
|
1680
|
+
});
|
|
1681
|
+
let effectiveCfg = cfg;
|
|
1682
|
+
if (!isGroup && route.matchedBy === "default") {
|
|
1683
|
+
const dynamicCfg = feishuCfg?.dynamicAgentCreation;
|
|
1684
|
+
if (dynamicCfg?.enabled) {
|
|
1685
|
+
const result = await maybeCreateDynamicAgent({
|
|
1686
|
+
cfg,
|
|
1687
|
+
runtime: getFeishuRuntime(),
|
|
1688
|
+
senderOpenId: ctx.senderOpenId,
|
|
1689
|
+
dynamicCfg,
|
|
1690
|
+
log: (msg) => log(msg)
|
|
1691
|
+
});
|
|
1692
|
+
if (result.created) {
|
|
1693
|
+
effectiveCfg = result.updatedCfg;
|
|
1694
|
+
route = core.channel.routing.resolveAgentRoute({
|
|
1695
|
+
cfg: result.updatedCfg,
|
|
1696
|
+
channel: "feishu",
|
|
1697
|
+
accountId: account.accountId,
|
|
1698
|
+
peer: {
|
|
1699
|
+
kind: "direct",
|
|
1700
|
+
id: ctx.senderOpenId
|
|
1701
|
+
}
|
|
1702
|
+
});
|
|
1703
|
+
log(`feishu[${account.accountId}]: dynamic agent created, new route: ${route.sessionKey}`);
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
const currentConversationId = peerId;
|
|
1708
|
+
const parentConversationId = isGroup ? parentPeer?.id ?? ctx.chatId : void 0;
|
|
1709
|
+
let configuredBinding = null;
|
|
1710
|
+
if (feishuAcpConversationSupported) {
|
|
1711
|
+
const configuredRoute = resolveConfiguredBindingRoute({
|
|
1712
|
+
cfg: effectiveCfg,
|
|
1713
|
+
route,
|
|
1714
|
+
conversation: {
|
|
1715
|
+
channel: "feishu",
|
|
1716
|
+
accountId: account.accountId,
|
|
1717
|
+
conversationId: currentConversationId,
|
|
1718
|
+
parentConversationId
|
|
1719
|
+
}
|
|
1720
|
+
});
|
|
1721
|
+
configuredBinding = configuredRoute.bindingResolution;
|
|
1722
|
+
route = configuredRoute.route;
|
|
1723
|
+
const threadBinding = getSessionBindingService().resolveByConversation({
|
|
1724
|
+
channel: "feishu",
|
|
1725
|
+
accountId: account.accountId,
|
|
1726
|
+
conversationId: currentConversationId,
|
|
1727
|
+
...parentConversationId ? { parentConversationId } : {}
|
|
1728
|
+
});
|
|
1729
|
+
const boundSessionKey = threadBinding?.targetSessionKey?.trim();
|
|
1730
|
+
if (threadBinding && boundSessionKey) {
|
|
1731
|
+
route = {
|
|
1732
|
+
...route,
|
|
1733
|
+
sessionKey: boundSessionKey,
|
|
1734
|
+
agentId: resolveAgentIdFromSessionKey(boundSessionKey) || route.agentId,
|
|
1735
|
+
lastRoutePolicy: deriveLastRoutePolicy({
|
|
1736
|
+
sessionKey: boundSessionKey,
|
|
1737
|
+
mainSessionKey: route.mainSessionKey
|
|
1738
|
+
}),
|
|
1739
|
+
matchedBy: "binding.channel"
|
|
1740
|
+
};
|
|
1741
|
+
configuredBinding = null;
|
|
1742
|
+
getSessionBindingService().touch(threadBinding.bindingId);
|
|
1743
|
+
log(`feishu[${account.accountId}]: routed via bound conversation ${currentConversationId} -> ${boundSessionKey}`);
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
if (configuredBinding) {
|
|
1747
|
+
const ensured = await ensureConfiguredBindingRouteReady({
|
|
1748
|
+
cfg: effectiveCfg,
|
|
1749
|
+
bindingResolution: configuredBinding
|
|
1750
|
+
});
|
|
1751
|
+
if (!ensured.ok) {
|
|
1752
|
+
const replyTargetMessageId = isGroup && (groupSession?.groupSessionScope === "group_topic" || groupSession?.groupSessionScope === "group_topic_sender") ? ctx.rootId ?? ctx.messageId : ctx.messageId;
|
|
1753
|
+
await sendMessageFeishu({
|
|
1754
|
+
cfg: effectiveCfg,
|
|
1755
|
+
to: `chat:${ctx.chatId}`,
|
|
1756
|
+
text: `⚠️ Failed to initialize the configured ACP session for this Feishu conversation: ${ensured.error}`,
|
|
1757
|
+
replyToMessageId: replyTargetMessageId,
|
|
1758
|
+
replyInThread: isGroup ? groupSession?.replyInThread ?? false : false,
|
|
1759
|
+
accountId: account.accountId
|
|
1760
|
+
}).catch((err) => {
|
|
1761
|
+
log(`feishu[${account.accountId}]: failed to send ACP init error reply: ${String(err)}`);
|
|
1762
|
+
});
|
|
1763
|
+
return;
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
const preview = ctx.content.replace(/\s+/g, " ").slice(0, 160);
|
|
1767
|
+
const inboundLabel = isGroup ? `Feishu[${account.accountId}] message in group ${ctx.chatId}` : `Feishu[${account.accountId}] DM from ${ctx.senderOpenId}`;
|
|
1768
|
+
const contextVisibilityMode = resolveChannelContextVisibilityMode({
|
|
1769
|
+
cfg: effectiveCfg,
|
|
1770
|
+
channel: "feishu",
|
|
1771
|
+
accountId: account.accountId
|
|
1772
|
+
});
|
|
1773
|
+
log(`feishu[${account.accountId}]: ${inboundLabel}: ${preview}`);
|
|
1774
|
+
const mediaMaxBytes = (feishuCfg?.mediaMaxMb ?? 30) * 1024 * 1024;
|
|
1775
|
+
const mediaPayload = buildAgentMediaPayload(await resolveFeishuMediaList({
|
|
1776
|
+
cfg,
|
|
1777
|
+
messageId: ctx.messageId,
|
|
1778
|
+
messageType: event.message.message_type,
|
|
1779
|
+
content: event.message.content,
|
|
1780
|
+
maxBytes: mediaMaxBytes,
|
|
1781
|
+
log,
|
|
1782
|
+
accountId: account.accountId
|
|
1783
|
+
}));
|
|
1784
|
+
let quotedMessageInfo = null;
|
|
1785
|
+
let quotedContent;
|
|
1786
|
+
if (ctx.parentId) try {
|
|
1787
|
+
quotedMessageInfo = await getMessageFeishu({
|
|
1788
|
+
cfg,
|
|
1789
|
+
messageId: ctx.parentId,
|
|
1790
|
+
accountId: account.accountId
|
|
1791
|
+
});
|
|
1792
|
+
if (quotedMessageInfo && shouldIncludeFetchedGroupContextMessage({
|
|
1793
|
+
isGroup,
|
|
1794
|
+
allowFrom: effectiveGroupSenderAllowFrom,
|
|
1795
|
+
mode: contextVisibilityMode,
|
|
1796
|
+
kind: "quote",
|
|
1797
|
+
senderId: quotedMessageInfo.senderId,
|
|
1798
|
+
senderType: quotedMessageInfo.senderType
|
|
1799
|
+
})) {
|
|
1800
|
+
quotedContent = quotedMessageInfo.content;
|
|
1801
|
+
log(`feishu[${account.accountId}]: fetched quoted message: ${quotedContent?.slice(0, 100)}`);
|
|
1802
|
+
} else if (quotedMessageInfo) log(`feishu[${account.accountId}]: skipped quoted message from sender ${quotedMessageInfo.senderId ?? "unknown"} (mode=${contextVisibilityMode})`);
|
|
1803
|
+
} catch (err) {
|
|
1804
|
+
log(`feishu[${account.accountId}]: failed to fetch quoted message: ${String(err)}`);
|
|
1805
|
+
}
|
|
1806
|
+
const isTopicSessionForThread = isGroup && (groupSession?.groupSessionScope === "group_topic" || groupSession?.groupSessionScope === "group_topic_sender");
|
|
1807
|
+
const envelopeOptions = core.channel.reply.resolveEnvelopeFormatOptions(cfg);
|
|
1808
|
+
const messageBody = buildFeishuAgentBody({
|
|
1809
|
+
ctx,
|
|
1810
|
+
quotedContent,
|
|
1811
|
+
permissionErrorForAgent,
|
|
1812
|
+
botOpenId
|
|
1813
|
+
});
|
|
1814
|
+
const envelopeFrom = isGroup ? `${ctx.chatId}:${ctx.senderOpenId}` : ctx.senderOpenId;
|
|
1815
|
+
if (permissionErrorForAgent) log(`feishu[${account.accountId}]: appending permission error notice to message body`);
|
|
1816
|
+
let combinedBody = core.channel.reply.formatAgentEnvelope({
|
|
1817
|
+
channel: "Feishu",
|
|
1818
|
+
from: envelopeFrom,
|
|
1819
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
1820
|
+
envelope: envelopeOptions,
|
|
1821
|
+
body: messageBody
|
|
1822
|
+
});
|
|
1823
|
+
const historyKey = groupHistoryKey;
|
|
1824
|
+
if (isGroup && historyKey && chatHistories) combinedBody = buildPendingHistoryContextFromMap({
|
|
1825
|
+
historyMap: chatHistories,
|
|
1826
|
+
historyKey,
|
|
1827
|
+
limit: historyLimit,
|
|
1828
|
+
currentMessage: combinedBody,
|
|
1829
|
+
formatEntry: (entry) => core.channel.reply.formatAgentEnvelope({
|
|
1830
|
+
channel: "Feishu",
|
|
1831
|
+
from: `${ctx.chatId}:${entry.sender}`,
|
|
1832
|
+
timestamp: entry.timestamp,
|
|
1833
|
+
body: entry.body,
|
|
1834
|
+
envelope: envelopeOptions
|
|
1835
|
+
})
|
|
1836
|
+
});
|
|
1837
|
+
const inboundHistory = isGroup && historyKey && historyLimit > 0 && chatHistories ? (chatHistories.get(historyKey) ?? []).map((entry) => ({
|
|
1838
|
+
sender: entry.sender,
|
|
1839
|
+
body: entry.body,
|
|
1840
|
+
timestamp: entry.timestamp
|
|
1841
|
+
})) : void 0;
|
|
1842
|
+
const threadContextBySessionKey = /* @__PURE__ */ new Map();
|
|
1843
|
+
let rootMessageInfo;
|
|
1844
|
+
let rootMessageThreadId;
|
|
1845
|
+
let rootMessageFetched = false;
|
|
1846
|
+
const getRootMessageInfo = async () => {
|
|
1847
|
+
if (!ctx.rootId) return null;
|
|
1848
|
+
if (!rootMessageFetched) {
|
|
1849
|
+
rootMessageFetched = true;
|
|
1850
|
+
if (ctx.rootId === ctx.parentId && quotedMessageInfo) rootMessageInfo = quotedMessageInfo;
|
|
1851
|
+
else try {
|
|
1852
|
+
rootMessageInfo = await getMessageFeishu({
|
|
1853
|
+
cfg,
|
|
1854
|
+
messageId: ctx.rootId,
|
|
1855
|
+
accountId: account.accountId
|
|
1856
|
+
});
|
|
1857
|
+
} catch (err) {
|
|
1858
|
+
log(`feishu[${account.accountId}]: failed to fetch root message: ${String(err)}`);
|
|
1859
|
+
rootMessageInfo = null;
|
|
1860
|
+
}
|
|
1861
|
+
rootMessageThreadId = rootMessageInfo?.threadId;
|
|
1862
|
+
if (rootMessageInfo && !shouldIncludeFetchedGroupContextMessage({
|
|
1863
|
+
isGroup,
|
|
1864
|
+
allowFrom: effectiveGroupSenderAllowFrom,
|
|
1865
|
+
mode: contextVisibilityMode,
|
|
1866
|
+
kind: "thread",
|
|
1867
|
+
senderId: rootMessageInfo.senderId,
|
|
1868
|
+
senderType: rootMessageInfo.senderType
|
|
1869
|
+
})) {
|
|
1870
|
+
log(`feishu[${account.accountId}]: skipped thread starter from sender ${rootMessageInfo.senderId ?? "unknown"} (mode=${contextVisibilityMode})`);
|
|
1871
|
+
rootMessageInfo = null;
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
return rootMessageInfo ?? null;
|
|
1875
|
+
};
|
|
1876
|
+
const resolveThreadContextForAgent = async (agentId, agentSessionKey) => {
|
|
1877
|
+
const cached = threadContextBySessionKey.get(agentSessionKey);
|
|
1878
|
+
if (cached) return cached;
|
|
1879
|
+
const threadContext = { threadLabel: (ctx.rootId || ctx.threadId) && isTopicSessionForThread ? `Feishu thread in ${ctx.chatId}` : void 0 };
|
|
1880
|
+
if (!(ctx.rootId || ctx.threadId) || !isTopicSessionForThread) {
|
|
1881
|
+
threadContextBySessionKey.set(agentSessionKey, threadContext);
|
|
1882
|
+
return threadContext;
|
|
1883
|
+
}
|
|
1884
|
+
const storePath = core.channel.session.resolveStorePath(cfg.session?.store, { agentId });
|
|
1885
|
+
if (core.channel.session.readSessionUpdatedAt({
|
|
1886
|
+
storePath,
|
|
1887
|
+
sessionKey: agentSessionKey
|
|
1888
|
+
})) {
|
|
1889
|
+
log(`feishu[${account.accountId}]: skipping thread bootstrap for existing session ${agentSessionKey}`);
|
|
1890
|
+
threadContextBySessionKey.set(agentSessionKey, threadContext);
|
|
1891
|
+
return threadContext;
|
|
1892
|
+
}
|
|
1893
|
+
const rootMsg = await getRootMessageInfo();
|
|
1894
|
+
let feishuThreadId = ctx.threadId ?? rootMessageThreadId ?? rootMsg?.threadId;
|
|
1895
|
+
if (feishuThreadId) log(`feishu[${account.accountId}]: resolved thread ID: ${feishuThreadId}`);
|
|
1896
|
+
if (!feishuThreadId) {
|
|
1897
|
+
log(`feishu[${account.accountId}]: no threadId found for root message ${ctx.rootId ?? "none"}, skipping thread history`);
|
|
1898
|
+
threadContextBySessionKey.set(agentSessionKey, threadContext);
|
|
1899
|
+
return threadContext;
|
|
1900
|
+
}
|
|
1901
|
+
try {
|
|
1902
|
+
const threadMessages = await listFeishuThreadMessages({
|
|
1903
|
+
cfg,
|
|
1904
|
+
threadId: feishuThreadId,
|
|
1905
|
+
currentMessageId: ctx.messageId,
|
|
1906
|
+
rootMessageId: ctx.rootId,
|
|
1907
|
+
limit: 20,
|
|
1908
|
+
accountId: account.accountId
|
|
1909
|
+
});
|
|
1910
|
+
const senderScoped = groupSession?.groupSessionScope === "group_topic_sender";
|
|
1911
|
+
const senderIds = new Set([ctx.senderOpenId, senderUserId].map((id) => id?.trim()).filter((id) => id !== void 0 && id.length > 0));
|
|
1912
|
+
const allowlistedMessages = filterFetchedGroupContextMessages(threadMessages, {
|
|
1913
|
+
isGroup,
|
|
1914
|
+
allowFrom: effectiveGroupSenderAllowFrom,
|
|
1915
|
+
mode: contextVisibilityMode,
|
|
1916
|
+
kind: "history"
|
|
1917
|
+
});
|
|
1918
|
+
const relevantMessages = (senderScoped ? allowlistedMessages.filter((msg) => msg.senderType === "app" || msg.senderId !== void 0 && senderIds.has(msg.senderId.trim())) : allowlistedMessages) ?? [];
|
|
1919
|
+
const threadStarterBody = rootMsg?.content ?? relevantMessages[0]?.content;
|
|
1920
|
+
const historyMessages = Boolean(rootMsg?.content || ctx.rootId) ? relevantMessages : relevantMessages.slice(1);
|
|
1921
|
+
const historyParts = historyMessages.map((msg) => {
|
|
1922
|
+
const role = msg.senderType === "app" ? "assistant" : "user";
|
|
1923
|
+
return core.channel.reply.formatAgentEnvelope({
|
|
1924
|
+
channel: "Feishu",
|
|
1925
|
+
from: `${msg.senderId ?? "Unknown"} (${role})`,
|
|
1926
|
+
timestamp: msg.createTime,
|
|
1927
|
+
body: msg.content,
|
|
1928
|
+
envelope: envelopeOptions
|
|
1929
|
+
});
|
|
1930
|
+
});
|
|
1931
|
+
threadContext.threadStarterBody = threadStarterBody;
|
|
1932
|
+
threadContext.threadHistoryBody = historyParts.length > 0 ? historyParts.join("\n\n") : void 0;
|
|
1933
|
+
log(`feishu[${account.accountId}]: populated thread bootstrap with starter=${threadStarterBody ? "yes" : "no"} history=${historyMessages.length}`);
|
|
1934
|
+
} catch (err) {
|
|
1935
|
+
log(`feishu[${account.accountId}]: failed to fetch thread history: ${String(err)}`);
|
|
1936
|
+
}
|
|
1937
|
+
threadContextBySessionKey.set(agentSessionKey, threadContext);
|
|
1938
|
+
return threadContext;
|
|
1939
|
+
};
|
|
1940
|
+
const buildCtxPayloadForAgent = async (agentId, agentSessionKey, agentAccountId, wasMentioned) => {
|
|
1941
|
+
const threadContext = await resolveThreadContextForAgent(agentId, agentSessionKey);
|
|
1942
|
+
return core.channel.reply.finalizeInboundContext({
|
|
1943
|
+
Body: combinedBody,
|
|
1944
|
+
BodyForAgent: messageBody,
|
|
1945
|
+
InboundHistory: inboundHistory,
|
|
1946
|
+
ReplyToId: ctx.parentId,
|
|
1947
|
+
RootMessageId: ctx.rootId,
|
|
1948
|
+
RawBody: ctx.content,
|
|
1949
|
+
CommandBody: ctx.content,
|
|
1950
|
+
From: feishuFrom,
|
|
1951
|
+
To: feishuTo,
|
|
1952
|
+
SessionKey: agentSessionKey,
|
|
1953
|
+
AccountId: agentAccountId,
|
|
1954
|
+
ChatType: isGroup ? "group" : "direct",
|
|
1955
|
+
GroupSubject: isGroup ? ctx.chatId : void 0,
|
|
1956
|
+
SenderName: ctx.senderName ?? ctx.senderOpenId,
|
|
1957
|
+
SenderId: ctx.senderOpenId,
|
|
1958
|
+
Provider: "feishu",
|
|
1959
|
+
Surface: "feishu",
|
|
1960
|
+
MessageSid: ctx.messageId,
|
|
1961
|
+
ReplyToBody: quotedContent ?? void 0,
|
|
1962
|
+
ThreadStarterBody: threadContext.threadStarterBody,
|
|
1963
|
+
ThreadHistoryBody: threadContext.threadHistoryBody,
|
|
1964
|
+
ThreadLabel: threadContext.threadLabel,
|
|
1965
|
+
MessageThreadId: ctx.rootId && isTopicSessionForThread ? ctx.rootId : void 0,
|
|
1966
|
+
Timestamp: messageCreateTimeMs,
|
|
1967
|
+
WasMentioned: wasMentioned,
|
|
1968
|
+
CommandAuthorized: commandAuthorized,
|
|
1969
|
+
OriginatingChannel: "feishu",
|
|
1970
|
+
OriginatingTo: feishuTo,
|
|
1971
|
+
GroupSystemPrompt: isGroup ? groupConfig?.systemPrompt?.trim() || void 0 : void 0,
|
|
1972
|
+
...mediaPayload
|
|
1973
|
+
});
|
|
1974
|
+
};
|
|
1975
|
+
const isTopicSession = isGroup && (groupSession?.groupSessionScope === "group_topic" || groupSession?.groupSessionScope === "group_topic_sender");
|
|
1976
|
+
const configReplyInThread = isGroup && (groupConfig?.replyInThread ?? feishuCfg?.replyInThread ?? "disabled") === "enabled";
|
|
1977
|
+
const replyTargetMessageId = isTopicSession || configReplyInThread ? ctx.rootId ?? ctx.messageId : ctx.messageId;
|
|
1978
|
+
const threadReply = isGroup ? groupSession?.threadReply ?? false : false;
|
|
1979
|
+
if (broadcastAgents) {
|
|
1980
|
+
if (!await tryRecordMessagePersistent(ctx.messageId, "broadcast", log)) {
|
|
1981
|
+
log(`feishu[${account.accountId}]: broadcast already claimed by another account for message ${ctx.messageId}; skipping`);
|
|
1982
|
+
return;
|
|
1983
|
+
}
|
|
1984
|
+
const strategy = cfg.broadcast?.strategy || "parallel";
|
|
1985
|
+
const activeAgentId = ctx.mentionedBot || !requireMention ? normalizeAgentId(route.agentId) : null;
|
|
1986
|
+
const agentIds = (cfg.agents?.list ?? []).map((a) => normalizeAgentId(a.id));
|
|
1987
|
+
const hasKnownAgents = agentIds.length > 0;
|
|
1988
|
+
log(`feishu[${account.accountId}]: broadcasting to ${broadcastAgents.length} agents (strategy=${strategy}, active=${activeAgentId ?? "none"})`);
|
|
1989
|
+
const dispatchForAgent = async (agentId) => {
|
|
1990
|
+
if (hasKnownAgents && !agentIds.includes(normalizeAgentId(agentId))) {
|
|
1991
|
+
log(`feishu[${account.accountId}]: broadcast agent ${agentId} not found in agents.list; skipping`);
|
|
1992
|
+
return;
|
|
1993
|
+
}
|
|
1994
|
+
const agentSessionKey = buildBroadcastSessionKey(route.sessionKey, route.agentId, agentId);
|
|
1995
|
+
const agentCtx = await buildCtxPayloadForAgent(agentId, agentSessionKey, route.accountId, ctx.mentionedBot && agentId === activeAgentId);
|
|
1996
|
+
if (agentId === activeAgentId) {
|
|
1997
|
+
const identity = resolveAgentOutboundIdentity(cfg, agentId);
|
|
1998
|
+
const { dispatcher, replyOptions, markDispatchIdle } = createFeishuReplyDispatcher({
|
|
1999
|
+
cfg,
|
|
2000
|
+
agentId,
|
|
2001
|
+
runtime,
|
|
2002
|
+
chatId: ctx.chatId,
|
|
2003
|
+
replyToMessageId: replyTargetMessageId,
|
|
2004
|
+
skipReplyToInMessages: !isGroup,
|
|
2005
|
+
replyInThread,
|
|
2006
|
+
rootId: ctx.rootId,
|
|
2007
|
+
threadReply,
|
|
2008
|
+
mentionTargets: ctx.mentionTargets,
|
|
2009
|
+
accountId: account.accountId,
|
|
2010
|
+
identity,
|
|
2011
|
+
messageCreateTimeMs
|
|
2012
|
+
});
|
|
2013
|
+
log(`feishu[${account.accountId}]: broadcast active dispatch agent=${agentId} (session=${agentSessionKey})`);
|
|
2014
|
+
await core.channel.reply.withReplyDispatcher({
|
|
2015
|
+
dispatcher,
|
|
2016
|
+
onSettled: () => markDispatchIdle(),
|
|
2017
|
+
run: () => core.channel.reply.dispatchReplyFromConfig({
|
|
2018
|
+
ctx: agentCtx,
|
|
2019
|
+
cfg,
|
|
2020
|
+
dispatcher,
|
|
2021
|
+
replyOptions
|
|
2022
|
+
})
|
|
2023
|
+
});
|
|
2024
|
+
} else {
|
|
2025
|
+
delete agentCtx.CommandAuthorized;
|
|
2026
|
+
const noopDispatcher = {
|
|
2027
|
+
sendToolResult: () => false,
|
|
2028
|
+
sendBlockReply: () => false,
|
|
2029
|
+
sendFinalReply: () => false,
|
|
2030
|
+
waitForIdle: async () => {},
|
|
2031
|
+
getQueuedCounts: () => ({
|
|
2032
|
+
tool: 0,
|
|
2033
|
+
block: 0,
|
|
2034
|
+
final: 0
|
|
2035
|
+
}),
|
|
2036
|
+
getFailedCounts: () => ({
|
|
2037
|
+
tool: 0,
|
|
2038
|
+
block: 0,
|
|
2039
|
+
final: 0
|
|
2040
|
+
}),
|
|
2041
|
+
markComplete: () => {}
|
|
2042
|
+
};
|
|
2043
|
+
log(`feishu[${account.accountId}]: broadcast observer dispatch agent=${agentId} (session=${agentSessionKey})`);
|
|
2044
|
+
await core.channel.reply.withReplyDispatcher({
|
|
2045
|
+
dispatcher: noopDispatcher,
|
|
2046
|
+
run: () => core.channel.reply.dispatchReplyFromConfig({
|
|
2047
|
+
ctx: agentCtx,
|
|
2048
|
+
cfg,
|
|
2049
|
+
dispatcher: noopDispatcher
|
|
2050
|
+
})
|
|
2051
|
+
});
|
|
2052
|
+
}
|
|
2053
|
+
};
|
|
2054
|
+
if (strategy === "sequential") for (const agentId of broadcastAgents) try {
|
|
2055
|
+
await dispatchForAgent(agentId);
|
|
2056
|
+
} catch (err) {
|
|
2057
|
+
log(`feishu[${account.accountId}]: broadcast dispatch failed for agent=${agentId}: ${String(err)}`);
|
|
2058
|
+
}
|
|
2059
|
+
else {
|
|
2060
|
+
const results = await Promise.allSettled(broadcastAgents.map(dispatchForAgent));
|
|
2061
|
+
for (let i = 0; i < results.length; i++) if (results[i].status === "rejected") log(`feishu[${account.accountId}]: broadcast dispatch failed for agent=${broadcastAgents[i]}: ${String(results[i].reason)}`);
|
|
2062
|
+
}
|
|
2063
|
+
if (isGroup && historyKey && chatHistories) clearHistoryEntriesIfEnabled({
|
|
2064
|
+
historyMap: chatHistories,
|
|
2065
|
+
historyKey,
|
|
2066
|
+
limit: historyLimit
|
|
2067
|
+
});
|
|
2068
|
+
log(`feishu[${account.accountId}]: broadcast dispatch complete for ${broadcastAgents.length} agents`);
|
|
2069
|
+
} else {
|
|
2070
|
+
const ctxPayload = await buildCtxPayloadForAgent(route.agentId, route.sessionKey, route.accountId, ctx.mentionedBot);
|
|
2071
|
+
const identity = resolveAgentOutboundIdentity(cfg, route.agentId);
|
|
2072
|
+
const { dispatcher, replyOptions, markDispatchIdle } = createFeishuReplyDispatcher({
|
|
2073
|
+
cfg,
|
|
2074
|
+
agentId: route.agentId,
|
|
2075
|
+
runtime,
|
|
2076
|
+
chatId: ctx.chatId,
|
|
2077
|
+
replyToMessageId: replyTargetMessageId,
|
|
2078
|
+
skipReplyToInMessages: !isGroup,
|
|
2079
|
+
replyInThread,
|
|
2080
|
+
rootId: ctx.rootId,
|
|
2081
|
+
threadReply,
|
|
2082
|
+
mentionTargets: ctx.mentionTargets,
|
|
2083
|
+
accountId: account.accountId,
|
|
2084
|
+
identity,
|
|
2085
|
+
messageCreateTimeMs
|
|
2086
|
+
});
|
|
2087
|
+
log(`feishu[${account.accountId}]: dispatching to agent (session=${route.sessionKey})`);
|
|
2088
|
+
const { queuedFinal, counts } = await core.channel.reply.withReplyDispatcher({
|
|
2089
|
+
dispatcher,
|
|
2090
|
+
onSettled: () => {
|
|
2091
|
+
markDispatchIdle();
|
|
2092
|
+
},
|
|
2093
|
+
run: () => core.channel.reply.dispatchReplyFromConfig({
|
|
2094
|
+
ctx: ctxPayload,
|
|
2095
|
+
cfg,
|
|
2096
|
+
dispatcher,
|
|
2097
|
+
replyOptions
|
|
2098
|
+
})
|
|
2099
|
+
});
|
|
2100
|
+
if (isGroup && historyKey && chatHistories) clearHistoryEntriesIfEnabled({
|
|
2101
|
+
historyMap: chatHistories,
|
|
2102
|
+
historyKey,
|
|
2103
|
+
limit: historyLimit
|
|
2104
|
+
});
|
|
2105
|
+
log(`feishu[${account.accountId}]: dispatch complete (queuedFinal=${queuedFinal}, replies=${counts.final})`);
|
|
2106
|
+
}
|
|
2107
|
+
} catch (err) {
|
|
2108
|
+
error(`feishu[${account.accountId}]: failed to dispatch message: ${String(err)}`);
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
//#endregion
|
|
2112
|
+
//#region extensions/feishu/src/card-ux-shared.ts
|
|
2113
|
+
function buildFeishuCardButton(params) {
|
|
2114
|
+
return {
|
|
2115
|
+
tag: "button",
|
|
2116
|
+
text: {
|
|
2117
|
+
tag: "plain_text",
|
|
2118
|
+
content: params.label
|
|
2119
|
+
},
|
|
2120
|
+
type: params.type ?? "default",
|
|
2121
|
+
value: params.value
|
|
2122
|
+
};
|
|
2123
|
+
}
|
|
2124
|
+
function buildFeishuCardInteractionContext(params) {
|
|
2125
|
+
return {
|
|
2126
|
+
u: params.operatorOpenId,
|
|
2127
|
+
...params.chatId ? { h: params.chatId } : {},
|
|
2128
|
+
...params.sessionKey ? { s: params.sessionKey } : {},
|
|
2129
|
+
e: params.expiresAt,
|
|
2130
|
+
...params.chatType ? { t: params.chatType } : {}
|
|
2131
|
+
};
|
|
2132
|
+
}
|
|
2133
|
+
//#endregion
|
|
2134
|
+
//#region extensions/feishu/src/card-ux-approval.ts
|
|
2135
|
+
const FEISHU_APPROVAL_REQUEST_ACTION = "feishu.quick_actions.request_approval";
|
|
2136
|
+
const FEISHU_APPROVAL_CONFIRM_ACTION = "feishu.approval.confirm";
|
|
2137
|
+
const FEISHU_APPROVAL_CANCEL_ACTION = "feishu.approval.cancel";
|
|
2138
|
+
function createApprovalCard(params) {
|
|
2139
|
+
const context = buildFeishuCardInteractionContext(params);
|
|
2140
|
+
return {
|
|
2141
|
+
schema: "2.0",
|
|
2142
|
+
config: { wide_screen_mode: true },
|
|
2143
|
+
header: {
|
|
2144
|
+
title: {
|
|
2145
|
+
tag: "plain_text",
|
|
2146
|
+
content: "Confirm action"
|
|
2147
|
+
},
|
|
2148
|
+
template: "orange"
|
|
2149
|
+
},
|
|
2150
|
+
body: { elements: [{
|
|
2151
|
+
tag: "markdown",
|
|
2152
|
+
content: params.prompt
|
|
2153
|
+
}, {
|
|
2154
|
+
tag: "action",
|
|
2155
|
+
actions: [buildFeishuCardButton({
|
|
2156
|
+
label: params.confirmLabel ?? "Confirm",
|
|
2157
|
+
type: "primary",
|
|
2158
|
+
value: createFeishuCardInteractionEnvelope({
|
|
2159
|
+
k: "quick",
|
|
2160
|
+
a: FEISHU_APPROVAL_CONFIRM_ACTION,
|
|
2161
|
+
q: params.command,
|
|
2162
|
+
c: context
|
|
2163
|
+
})
|
|
2164
|
+
}), buildFeishuCardButton({
|
|
2165
|
+
label: params.cancelLabel ?? "Cancel",
|
|
2166
|
+
value: createFeishuCardInteractionEnvelope({
|
|
2167
|
+
k: "button",
|
|
2168
|
+
a: FEISHU_APPROVAL_CANCEL_ACTION,
|
|
2169
|
+
c: context
|
|
2170
|
+
})
|
|
2171
|
+
})]
|
|
2172
|
+
}] }
|
|
2173
|
+
};
|
|
2174
|
+
}
|
|
2175
|
+
//#endregion
|
|
2176
|
+
//#region extensions/feishu/src/card-action.ts
|
|
2177
|
+
const FEISHU_APPROVAL_CARD_TTL_MS = 5 * 6e4;
|
|
2178
|
+
const FEISHU_CARD_ACTION_TOKEN_TTL_MS = 15 * 6e4;
|
|
2179
|
+
const processedCardActionTokens = /* @__PURE__ */ new Map();
|
|
2180
|
+
function pruneProcessedCardActionTokens(now) {
|
|
2181
|
+
for (const [key, entry] of processedCardActionTokens.entries()) if (entry.expiresAt <= now) processedCardActionTokens.delete(key);
|
|
2182
|
+
}
|
|
2183
|
+
function beginFeishuCardActionToken(params) {
|
|
2184
|
+
const now = params.now ?? Date.now();
|
|
2185
|
+
pruneProcessedCardActionTokens(now);
|
|
2186
|
+
const normalizedToken = params.token.trim();
|
|
2187
|
+
if (!normalizedToken) return true;
|
|
2188
|
+
const key = `${params.accountId}:${normalizedToken}`;
|
|
2189
|
+
const existing = processedCardActionTokens.get(key);
|
|
2190
|
+
if (existing && existing.expiresAt > now) return false;
|
|
2191
|
+
processedCardActionTokens.set(key, {
|
|
2192
|
+
status: "inflight",
|
|
2193
|
+
expiresAt: now + FEISHU_CARD_ACTION_TOKEN_TTL_MS
|
|
2194
|
+
});
|
|
2195
|
+
return true;
|
|
2196
|
+
}
|
|
2197
|
+
function completeFeishuCardActionToken(params) {
|
|
2198
|
+
const now = params.now ?? Date.now();
|
|
2199
|
+
const normalizedToken = params.token.trim();
|
|
2200
|
+
if (!normalizedToken) return;
|
|
2201
|
+
processedCardActionTokens.set(`${params.accountId}:${normalizedToken}`, {
|
|
2202
|
+
status: "completed",
|
|
2203
|
+
expiresAt: now + FEISHU_CARD_ACTION_TOKEN_TTL_MS
|
|
2204
|
+
});
|
|
2205
|
+
}
|
|
2206
|
+
function releaseFeishuCardActionToken(params) {
|
|
2207
|
+
const normalizedToken = params.token.trim();
|
|
2208
|
+
if (!normalizedToken) return;
|
|
2209
|
+
processedCardActionTokens.delete(`${params.accountId}:${normalizedToken}`);
|
|
2210
|
+
}
|
|
2211
|
+
function buildSyntheticMessageEvent(event, content, chatType) {
|
|
2212
|
+
return {
|
|
2213
|
+
sender: { sender_id: {
|
|
2214
|
+
open_id: event.operator.open_id,
|
|
2215
|
+
user_id: event.operator.user_id,
|
|
2216
|
+
union_id: event.operator.union_id
|
|
2217
|
+
} },
|
|
2218
|
+
message: {
|
|
2219
|
+
message_id: `card-action-${event.token}`,
|
|
2220
|
+
chat_id: event.context.chat_id || event.operator.open_id,
|
|
2221
|
+
chat_type: chatType ?? (event.context.chat_id ? "group" : "p2p"),
|
|
2222
|
+
message_type: "text",
|
|
2223
|
+
content: JSON.stringify({ text: content })
|
|
2224
|
+
}
|
|
2225
|
+
};
|
|
2226
|
+
}
|
|
2227
|
+
function resolveCallbackTarget(event) {
|
|
2228
|
+
const chatId = event.context.chat_id?.trim();
|
|
2229
|
+
if (chatId) return `chat:${chatId}`;
|
|
2230
|
+
return `user:${event.operator.open_id}`;
|
|
2231
|
+
}
|
|
2232
|
+
async function dispatchSyntheticCommand(params) {
|
|
2233
|
+
await handleFeishuMessage({
|
|
2234
|
+
cfg: params.cfg,
|
|
2235
|
+
event: buildSyntheticMessageEvent(params.event, params.command, params.chatType),
|
|
2236
|
+
botOpenId: params.botOpenId,
|
|
2237
|
+
runtime: params.runtime,
|
|
2238
|
+
accountId: params.accountId
|
|
2239
|
+
});
|
|
2240
|
+
}
|
|
2241
|
+
async function sendInvalidInteractionNotice(params) {
|
|
2242
|
+
const reasonText = params.reason === "stale" ? "This card action has expired. Open a fresh launcher card and try again." : params.reason === "wrong_user" ? "This card action belongs to a different user." : params.reason === "wrong_conversation" ? "This card action belongs to a different conversation." : "This card action payload is invalid.";
|
|
2243
|
+
await sendMessageFeishu({
|
|
2244
|
+
cfg: params.cfg,
|
|
2245
|
+
to: resolveCallbackTarget(params.event),
|
|
2246
|
+
text: `⚠️ ${reasonText}`,
|
|
2247
|
+
accountId: params.accountId
|
|
2248
|
+
});
|
|
2249
|
+
}
|
|
2250
|
+
async function handleFeishuCardAction(params) {
|
|
2251
|
+
const { cfg, event, runtime, accountId } = params;
|
|
2252
|
+
const account = resolveFeishuRuntimeAccount({
|
|
2253
|
+
cfg,
|
|
2254
|
+
accountId
|
|
2255
|
+
});
|
|
2256
|
+
const log = runtime?.log ?? console.log;
|
|
2257
|
+
const decoded = decodeFeishuCardAction({ event });
|
|
2258
|
+
if (!beginFeishuCardActionToken({
|
|
2259
|
+
token: event.token,
|
|
2260
|
+
accountId: account.accountId
|
|
2261
|
+
})) {
|
|
2262
|
+
log(`feishu[${account.accountId}]: skipping duplicate card action token ${event.token}`);
|
|
2263
|
+
return;
|
|
2264
|
+
}
|
|
2265
|
+
try {
|
|
2266
|
+
if (decoded.kind === "invalid") {
|
|
2267
|
+
log(`feishu[${account.accountId}]: rejected card action from ${event.operator.open_id}: ${decoded.reason}`);
|
|
2268
|
+
await sendInvalidInteractionNotice({
|
|
2269
|
+
cfg,
|
|
2270
|
+
event,
|
|
2271
|
+
reason: decoded.reason,
|
|
2272
|
+
accountId
|
|
2273
|
+
});
|
|
2274
|
+
completeFeishuCardActionToken({
|
|
2275
|
+
token: event.token,
|
|
2276
|
+
accountId: account.accountId
|
|
2277
|
+
});
|
|
2278
|
+
return;
|
|
2279
|
+
}
|
|
2280
|
+
if (decoded.kind === "structured") {
|
|
2281
|
+
const { envelope } = decoded;
|
|
2282
|
+
log(`feishu[${account.accountId}]: handling structured card action ${envelope.a} from ${event.operator.open_id}`);
|
|
2283
|
+
if (envelope.a === "feishu.quick_actions.request_approval") {
|
|
2284
|
+
const command = typeof envelope.m?.command === "string" ? envelope.m.command.trim() : "";
|
|
2285
|
+
if (!command) {
|
|
2286
|
+
await sendInvalidInteractionNotice({
|
|
2287
|
+
cfg,
|
|
2288
|
+
event,
|
|
2289
|
+
reason: "malformed",
|
|
2290
|
+
accountId
|
|
2291
|
+
});
|
|
2292
|
+
completeFeishuCardActionToken({
|
|
2293
|
+
token: event.token,
|
|
2294
|
+
accountId: account.accountId
|
|
2295
|
+
});
|
|
2296
|
+
return;
|
|
2297
|
+
}
|
|
2298
|
+
const prompt = typeof envelope.m?.prompt === "string" && envelope.m.prompt.trim() ? envelope.m.prompt : `Run \`${command}\` in this Feishu conversation?`;
|
|
2299
|
+
await sendCardFeishu({
|
|
2300
|
+
cfg,
|
|
2301
|
+
to: resolveCallbackTarget(event),
|
|
2302
|
+
card: createApprovalCard({
|
|
2303
|
+
operatorOpenId: event.operator.open_id,
|
|
2304
|
+
chatId: event.context.chat_id || void 0,
|
|
2305
|
+
command,
|
|
2306
|
+
prompt,
|
|
2307
|
+
sessionKey: envelope.c?.s,
|
|
2308
|
+
expiresAt: Date.now() + FEISHU_APPROVAL_CARD_TTL_MS,
|
|
2309
|
+
chatType: envelope.c?.t ?? (event.context.chat_id ? "group" : "p2p"),
|
|
2310
|
+
confirmLabel: command === "/reset" ? "Reset" : "Confirm"
|
|
2311
|
+
}),
|
|
2312
|
+
accountId
|
|
2313
|
+
});
|
|
2314
|
+
completeFeishuCardActionToken({
|
|
2315
|
+
token: event.token,
|
|
2316
|
+
accountId: account.accountId
|
|
2317
|
+
});
|
|
2318
|
+
return;
|
|
2319
|
+
}
|
|
2320
|
+
if (envelope.a === "feishu.approval.cancel") {
|
|
2321
|
+
await sendMessageFeishu({
|
|
2322
|
+
cfg,
|
|
2323
|
+
to: resolveCallbackTarget(event),
|
|
2324
|
+
text: "Cancelled.",
|
|
2325
|
+
accountId
|
|
2326
|
+
});
|
|
2327
|
+
completeFeishuCardActionToken({
|
|
2328
|
+
token: event.token,
|
|
2329
|
+
accountId: account.accountId
|
|
2330
|
+
});
|
|
2331
|
+
return;
|
|
2332
|
+
}
|
|
2333
|
+
if (envelope.a === "feishu.approval.confirm" || envelope.k === "quick") {
|
|
2334
|
+
const command = envelope.q?.trim();
|
|
2335
|
+
if (!command) {
|
|
2336
|
+
await sendInvalidInteractionNotice({
|
|
2337
|
+
cfg,
|
|
2338
|
+
event,
|
|
2339
|
+
reason: "malformed",
|
|
2340
|
+
accountId
|
|
2341
|
+
});
|
|
2342
|
+
completeFeishuCardActionToken({
|
|
2343
|
+
token: event.token,
|
|
2344
|
+
accountId: account.accountId
|
|
2345
|
+
});
|
|
2346
|
+
return;
|
|
2347
|
+
}
|
|
2348
|
+
await dispatchSyntheticCommand({
|
|
2349
|
+
cfg,
|
|
2350
|
+
event,
|
|
2351
|
+
command,
|
|
2352
|
+
botOpenId: params.botOpenId,
|
|
2353
|
+
runtime,
|
|
2354
|
+
accountId,
|
|
2355
|
+
chatType: envelope.c?.t ?? (event.context.chat_id ? "group" : "p2p")
|
|
2356
|
+
});
|
|
2357
|
+
completeFeishuCardActionToken({
|
|
2358
|
+
token: event.token,
|
|
2359
|
+
accountId: account.accountId
|
|
2360
|
+
});
|
|
2361
|
+
return;
|
|
2362
|
+
}
|
|
2363
|
+
await sendInvalidInteractionNotice({
|
|
2364
|
+
cfg,
|
|
2365
|
+
event,
|
|
2366
|
+
reason: "malformed",
|
|
2367
|
+
accountId
|
|
2368
|
+
});
|
|
2369
|
+
completeFeishuCardActionToken({
|
|
2370
|
+
token: event.token,
|
|
2371
|
+
accountId: account.accountId
|
|
2372
|
+
});
|
|
2373
|
+
return;
|
|
2374
|
+
}
|
|
2375
|
+
const content = buildFeishuCardActionTextFallback(event);
|
|
2376
|
+
log(`feishu[${account.accountId}]: handling card action from ${event.operator.open_id}: ${content}`);
|
|
2377
|
+
await dispatchSyntheticCommand({
|
|
2378
|
+
cfg,
|
|
2379
|
+
event,
|
|
2380
|
+
command: content,
|
|
2381
|
+
botOpenId: params.botOpenId,
|
|
2382
|
+
runtime,
|
|
2383
|
+
accountId
|
|
2384
|
+
});
|
|
2385
|
+
completeFeishuCardActionToken({
|
|
2386
|
+
token: event.token,
|
|
2387
|
+
accountId: account.accountId
|
|
2388
|
+
});
|
|
2389
|
+
} catch (err) {
|
|
2390
|
+
releaseFeishuCardActionToken({
|
|
2391
|
+
token: event.token,
|
|
2392
|
+
accountId: account.accountId
|
|
2393
|
+
});
|
|
2394
|
+
throw err;
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
//#endregion
|
|
2398
|
+
//#region extensions/feishu/src/card-ux-launcher.ts
|
|
2399
|
+
const FEISHU_QUICK_ACTION_CARD_TTL_MS = 10 * 6e4;
|
|
2400
|
+
const QUICK_ACTION_MENU_KEYS = new Set([
|
|
2401
|
+
"quick-actions",
|
|
2402
|
+
"quick_actions",
|
|
2403
|
+
"launcher"
|
|
2404
|
+
]);
|
|
2405
|
+
function isFeishuQuickActionMenuEventKey(eventKey) {
|
|
2406
|
+
return QUICK_ACTION_MENU_KEYS.has(eventKey.trim().toLowerCase());
|
|
2407
|
+
}
|
|
2408
|
+
function createQuickActionLauncherCard(params) {
|
|
2409
|
+
const context = buildFeishuCardInteractionContext(params);
|
|
2410
|
+
return {
|
|
2411
|
+
schema: "2.0",
|
|
2412
|
+
config: { wide_screen_mode: true },
|
|
2413
|
+
header: {
|
|
2414
|
+
title: {
|
|
2415
|
+
tag: "plain_text",
|
|
2416
|
+
content: "Quick actions"
|
|
2417
|
+
},
|
|
2418
|
+
template: "indigo"
|
|
2419
|
+
},
|
|
2420
|
+
body: { elements: [{
|
|
2421
|
+
tag: "markdown",
|
|
2422
|
+
content: "Run common actions without typing raw commands."
|
|
2423
|
+
}, {
|
|
2424
|
+
tag: "action",
|
|
2425
|
+
actions: [
|
|
2426
|
+
buildFeishuCardButton({
|
|
2427
|
+
label: "Help",
|
|
2428
|
+
value: createFeishuCardInteractionEnvelope({
|
|
2429
|
+
k: "quick",
|
|
2430
|
+
a: "feishu.quick_actions.help",
|
|
2431
|
+
q: "/help",
|
|
2432
|
+
c: context
|
|
2433
|
+
})
|
|
2434
|
+
}),
|
|
2435
|
+
buildFeishuCardButton({
|
|
2436
|
+
label: "New session",
|
|
2437
|
+
type: "primary",
|
|
2438
|
+
value: createFeishuCardInteractionEnvelope({
|
|
2439
|
+
k: "meta",
|
|
2440
|
+
a: FEISHU_APPROVAL_REQUEST_ACTION,
|
|
2441
|
+
m: {
|
|
2442
|
+
command: "/new",
|
|
2443
|
+
prompt: "Start a fresh session? This will reset the current chat context."
|
|
2444
|
+
},
|
|
2445
|
+
c: context
|
|
2446
|
+
})
|
|
2447
|
+
}),
|
|
2448
|
+
buildFeishuCardButton({
|
|
2449
|
+
label: "Reset",
|
|
2450
|
+
type: "danger",
|
|
2451
|
+
value: createFeishuCardInteractionEnvelope({
|
|
2452
|
+
k: "meta",
|
|
2453
|
+
a: FEISHU_APPROVAL_REQUEST_ACTION,
|
|
2454
|
+
m: {
|
|
2455
|
+
command: "/reset",
|
|
2456
|
+
prompt: "Reset this session now? Any active conversation state will be cleared."
|
|
2457
|
+
},
|
|
2458
|
+
c: context
|
|
2459
|
+
})
|
|
2460
|
+
})
|
|
2461
|
+
]
|
|
2462
|
+
}] }
|
|
2463
|
+
};
|
|
2464
|
+
}
|
|
2465
|
+
async function maybeHandleFeishuQuickActionMenu(params) {
|
|
2466
|
+
if (!isFeishuQuickActionMenuEventKey(params.eventKey)) return false;
|
|
2467
|
+
const expiresAt = (params.now ?? Date.now()) + FEISHU_QUICK_ACTION_CARD_TTL_MS;
|
|
2468
|
+
try {
|
|
2469
|
+
await sendCardFeishu({
|
|
2470
|
+
cfg: params.cfg,
|
|
2471
|
+
to: `user:${params.operatorOpenId}`,
|
|
2472
|
+
card: createQuickActionLauncherCard({
|
|
2473
|
+
operatorOpenId: params.operatorOpenId,
|
|
2474
|
+
expiresAt,
|
|
2475
|
+
chatType: "p2p"
|
|
2476
|
+
}),
|
|
2477
|
+
accountId: params.accountId
|
|
2478
|
+
});
|
|
2479
|
+
} catch (err) {
|
|
2480
|
+
params.runtime?.log?.(`feishu[${params.accountId ?? "default"}]: failed to open quick-action launcher for ${params.operatorOpenId}: ${String(err)}`);
|
|
2481
|
+
return false;
|
|
2482
|
+
}
|
|
2483
|
+
params.runtime?.log?.(`feishu[${params.accountId ?? "default"}]: opened quick-action launcher for ${params.operatorOpenId}`);
|
|
2484
|
+
return true;
|
|
2485
|
+
}
|
|
2486
|
+
//#endregion
|
|
2487
|
+
//#region extensions/feishu/src/comment-dispatcher.ts
|
|
2488
|
+
function createFeishuCommentReplyDispatcher(params) {
|
|
2489
|
+
const core = getFeishuRuntime();
|
|
2490
|
+
const prefixContext = createReplyPrefixContext({
|
|
2491
|
+
cfg: params.cfg,
|
|
2492
|
+
agentId: params.agentId,
|
|
2493
|
+
channel: "feishu",
|
|
2494
|
+
accountId: params.accountId
|
|
2495
|
+
});
|
|
2496
|
+
const client = createFeishuClient(resolveFeishuRuntimeAccount({
|
|
2497
|
+
cfg: params.cfg,
|
|
2498
|
+
accountId: params.accountId
|
|
2499
|
+
}));
|
|
2500
|
+
const textChunkLimit = core.channel.text.resolveTextChunkLimit(params.cfg, "feishu", params.accountId, { fallbackLimit: 4e3 });
|
|
2501
|
+
const chunkMode = core.channel.text.resolveChunkMode(params.cfg, "feishu");
|
|
2502
|
+
const { dispatcher, replyOptions, markDispatchIdle } = core.channel.reply.createReplyDispatcherWithTyping({
|
|
2503
|
+
responsePrefix: prefixContext.responsePrefix,
|
|
2504
|
+
responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
|
|
2505
|
+
humanDelay: core.channel.reply.resolveHumanDelayConfig(params.cfg, params.agentId),
|
|
2506
|
+
deliver: async (payload, info) => {
|
|
2507
|
+
if (info.kind !== "final") return;
|
|
2508
|
+
const reply = resolveSendableOutboundReplyParts(payload);
|
|
2509
|
+
if (!reply.hasText) {
|
|
2510
|
+
if (reply.hasMedia) params.runtime.log?.(`feishu[${params.accountId ?? "default"}]: comment reply ignored media-only payload for comment=${params.commentId}`);
|
|
2511
|
+
return;
|
|
2512
|
+
}
|
|
2513
|
+
const chunks = core.channel.text.chunkTextWithMode(reply.text, textChunkLimit, chunkMode);
|
|
2514
|
+
for (const chunk of chunks) await deliverCommentThreadText(client, {
|
|
2515
|
+
file_token: params.fileToken,
|
|
2516
|
+
file_type: params.fileType,
|
|
2517
|
+
comment_id: params.commentId,
|
|
2518
|
+
content: chunk,
|
|
2519
|
+
is_whole_comment: params.isWholeComment
|
|
2520
|
+
});
|
|
2521
|
+
},
|
|
2522
|
+
onError: (err, info) => {
|
|
2523
|
+
params.runtime.error?.(`feishu[${params.accountId ?? "default"}]: comment dispatcher failed kind=${info.kind} comment=${params.commentId}: ${String(err)}`);
|
|
2524
|
+
}
|
|
2525
|
+
});
|
|
2526
|
+
return {
|
|
2527
|
+
dispatcher,
|
|
2528
|
+
replyOptions,
|
|
2529
|
+
markDispatchIdle
|
|
2530
|
+
};
|
|
2531
|
+
}
|
|
2532
|
+
//#endregion
|
|
2533
|
+
//#region extensions/feishu/src/monitor.comment.ts
|
|
2534
|
+
const FEISHU_COMMENT_VERIFY_TIMEOUT_MS = 3e3;
|
|
2535
|
+
const FEISHU_COMMENT_REPLY_PAGE_SIZE = 100;
|
|
2536
|
+
const FEISHU_COMMENT_REPLY_PAGE_LIMIT = 5;
|
|
2537
|
+
const FEISHU_COMMENT_REPLY_MISS_RETRY_DELAY_MS = 1e3;
|
|
2538
|
+
const FEISHU_COMMENT_REPLY_MISS_RETRY_LIMIT = 6;
|
|
2539
|
+
function isRecord$1(value) {
|
|
2540
|
+
return typeof value === "object" && value !== null;
|
|
2541
|
+
}
|
|
2542
|
+
function readString$1(value) {
|
|
2543
|
+
return typeof value === "string" ? value : void 0;
|
|
2544
|
+
}
|
|
2545
|
+
function readBoolean(value) {
|
|
2546
|
+
return typeof value === "boolean" ? value : void 0;
|
|
2547
|
+
}
|
|
2548
|
+
function safeJsonStringify(value) {
|
|
2549
|
+
try {
|
|
2550
|
+
return JSON.stringify(value);
|
|
2551
|
+
} catch (error) {
|
|
2552
|
+
return JSON.stringify({ error: error instanceof Error ? error.message : String(error) });
|
|
2553
|
+
}
|
|
2554
|
+
}
|
|
2555
|
+
function summarizeCommentRepliesForLog(replies) {
|
|
2556
|
+
return safeJsonStringify(replies.map((reply) => ({
|
|
2557
|
+
reply_id: reply.reply_id,
|
|
2558
|
+
text_len: extractReplyText(reply)?.length ?? 0
|
|
2559
|
+
})));
|
|
2560
|
+
}
|
|
2561
|
+
function encodeQuery(params) {
|
|
2562
|
+
const query = new URLSearchParams();
|
|
2563
|
+
for (const [key, value] of Object.entries(params)) {
|
|
2564
|
+
const trimmed = value?.trim();
|
|
2565
|
+
if (trimmed) query.set(key, trimmed);
|
|
2566
|
+
}
|
|
2567
|
+
const queryString = query.toString();
|
|
2568
|
+
return queryString ? `?${queryString}` : "";
|
|
2569
|
+
}
|
|
2570
|
+
async function delayMs(ms) {
|
|
2571
|
+
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
2572
|
+
}
|
|
2573
|
+
function buildDriveCommentTargetUrl(params) {
|
|
2574
|
+
return `/open-apis/drive/v1/files/${encodeURIComponent(params.fileToken)}/comments/batch_query` + encodeQuery({
|
|
2575
|
+
file_type: params.fileType,
|
|
2576
|
+
user_id_type: "open_id"
|
|
2577
|
+
});
|
|
2578
|
+
}
|
|
2579
|
+
function buildDriveCommentRepliesUrl(params) {
|
|
2580
|
+
return `/open-apis/drive/v1/files/${encodeURIComponent(params.fileToken)}/comments/${encodeURIComponent(params.commentId)}/replies` + encodeQuery({
|
|
2581
|
+
file_type: params.fileType,
|
|
2582
|
+
page_token: params.pageToken,
|
|
2583
|
+
page_size: String(FEISHU_COMMENT_REPLY_PAGE_SIZE),
|
|
2584
|
+
user_id_type: "open_id"
|
|
2585
|
+
});
|
|
2586
|
+
}
|
|
2587
|
+
async function requestFeishuOpenApi(params) {
|
|
2588
|
+
const formatErrorDetails = (error) => {
|
|
2589
|
+
if (!isRecord$1(error)) return String(error);
|
|
2590
|
+
const response = isRecord$1(error.response) ? error.response : void 0;
|
|
2591
|
+
const responseData = isRecord$1(response?.data) ? response?.data : void 0;
|
|
2592
|
+
return safeJsonStringify({
|
|
2593
|
+
message: typeof error.message === "string" ? error.message : String(error),
|
|
2594
|
+
code: readString$1(error.code),
|
|
2595
|
+
method: readString$1(isRecord$1(error.config) ? error.config.method : void 0),
|
|
2596
|
+
url: readString$1(isRecord$1(error.config) ? error.config.url : void 0),
|
|
2597
|
+
http_status: typeof response?.status === "number" ? response.status : void 0,
|
|
2598
|
+
feishu_code: typeof responseData?.code === "number" ? responseData.code : readString$1(responseData?.code),
|
|
2599
|
+
feishu_msg: readString$1(responseData?.msg),
|
|
2600
|
+
feishu_log_id: readString$1(responseData?.log_id)
|
|
2601
|
+
});
|
|
2602
|
+
};
|
|
2603
|
+
const result = await raceWithTimeoutAndAbort(params.client.request({
|
|
2604
|
+
method: params.method,
|
|
2605
|
+
url: params.url,
|
|
2606
|
+
data: params.data ?? {},
|
|
2607
|
+
timeout: params.timeoutMs
|
|
2608
|
+
}), { timeoutMs: params.timeoutMs }).then((resolved) => resolved.status === "resolved" ? resolved.value : null).catch((error) => {
|
|
2609
|
+
params.logger?.(`${params.errorLabel}: ${formatErrorDetails(error)}`);
|
|
2610
|
+
return null;
|
|
2611
|
+
});
|
|
2612
|
+
if (!result) params.logger?.(`${params.errorLabel}: request timed out or returned no data`);
|
|
2613
|
+
return result;
|
|
2614
|
+
}
|
|
2615
|
+
function extractCommentElementText(element) {
|
|
2616
|
+
if (!isRecord$1(element)) return;
|
|
2617
|
+
const type = readString$1(element.type)?.trim();
|
|
2618
|
+
if (type === "text_run" && isRecord$1(element.text_run)) return readString$1(element.text_run.content)?.trim() || readString$1(element.text_run.text)?.trim() || void 0;
|
|
2619
|
+
if (type === "mention") {
|
|
2620
|
+
const mention = isRecord$1(element.mention) ? element.mention : void 0;
|
|
2621
|
+
const mentionName = readString$1(mention?.name)?.trim() || readString$1(mention?.display_name)?.trim() || readString$1(element.name)?.trim();
|
|
2622
|
+
return mentionName ? `@${mentionName}` : "@mention";
|
|
2623
|
+
}
|
|
2624
|
+
if (type === "docs_link") {
|
|
2625
|
+
const docsLink = isRecord$1(element.docs_link) ? element.docs_link : void 0;
|
|
2626
|
+
return readString$1(docsLink?.text)?.trim() || readString$1(docsLink?.url)?.trim() || readString$1(element.text)?.trim() || readString$1(element.url)?.trim() || void 0;
|
|
2627
|
+
}
|
|
2628
|
+
return readString$1(element.text)?.trim() || readString$1(element.content)?.trim() || readString$1(element.name)?.trim() || void 0;
|
|
2629
|
+
}
|
|
2630
|
+
function extractReplyText(reply) {
|
|
2631
|
+
if (!reply || !isRecord$1(reply.content)) return;
|
|
2632
|
+
return (Array.isArray(reply.content.elements) ? reply.content.elements : []).map(extractCommentElementText).filter((part) => Boolean(part && part.trim())).join("").trim() || void 0;
|
|
2633
|
+
}
|
|
2634
|
+
async function fetchDriveCommentReplies(params) {
|
|
2635
|
+
const replies = [];
|
|
2636
|
+
const logIds = [];
|
|
2637
|
+
let pageToken;
|
|
2638
|
+
for (let page = 0; page < FEISHU_COMMENT_REPLY_PAGE_LIMIT; page += 1) {
|
|
2639
|
+
const response = await requestFeishuOpenApi({
|
|
2640
|
+
client: params.client,
|
|
2641
|
+
method: "GET",
|
|
2642
|
+
url: buildDriveCommentRepliesUrl({
|
|
2643
|
+
fileToken: params.fileToken,
|
|
2644
|
+
commentId: params.commentId,
|
|
2645
|
+
fileType: params.fileType,
|
|
2646
|
+
pageToken
|
|
2647
|
+
}),
|
|
2648
|
+
timeoutMs: params.timeoutMs,
|
|
2649
|
+
logger: params.logger,
|
|
2650
|
+
errorLabel: `feishu[${params.accountId}]: failed to fetch comment replies for ${params.commentId}`
|
|
2651
|
+
});
|
|
2652
|
+
if (response?.log_id?.trim()) logIds.push(response.log_id.trim());
|
|
2653
|
+
if (response?.code !== 0) {
|
|
2654
|
+
if (response) params.logger?.(`feishu[${params.accountId}]: failed to fetch comment replies for ${params.commentId}: ${response.msg ?? "unknown error"} log_id=${response.log_id?.trim() || "unknown"}`);
|
|
2655
|
+
break;
|
|
2656
|
+
}
|
|
2657
|
+
replies.push(...response.data?.items ?? []);
|
|
2658
|
+
if (response.data?.has_more !== true || !response.data.page_token?.trim()) break;
|
|
2659
|
+
pageToken = response.data.page_token.trim();
|
|
2660
|
+
}
|
|
2661
|
+
return {
|
|
2662
|
+
replies,
|
|
2663
|
+
logIds
|
|
2664
|
+
};
|
|
2665
|
+
}
|
|
2666
|
+
async function fetchDriveCommentContext(params) {
|
|
2667
|
+
const [metaResponse, commentResponse] = await Promise.all([requestFeishuOpenApi({
|
|
2668
|
+
client: params.client,
|
|
2669
|
+
method: "POST",
|
|
2670
|
+
url: "/open-apis/drive/v1/metas/batch_query",
|
|
2671
|
+
data: {
|
|
2672
|
+
request_docs: [{
|
|
2673
|
+
doc_token: params.fileToken,
|
|
2674
|
+
doc_type: params.fileType
|
|
2675
|
+
}],
|
|
2676
|
+
with_url: true
|
|
2677
|
+
},
|
|
2678
|
+
timeoutMs: params.timeoutMs,
|
|
2679
|
+
logger: params.logger,
|
|
2680
|
+
errorLabel: `feishu[${params.accountId}]: failed to fetch drive metadata for ${params.fileToken}`
|
|
2681
|
+
}), requestFeishuOpenApi({
|
|
2682
|
+
client: params.client,
|
|
2683
|
+
method: "POST",
|
|
2684
|
+
url: buildDriveCommentTargetUrl({
|
|
2685
|
+
fileToken: params.fileToken,
|
|
2686
|
+
fileType: params.fileType
|
|
2687
|
+
}),
|
|
2688
|
+
data: { comment_ids: [params.commentId] },
|
|
2689
|
+
timeoutMs: params.timeoutMs,
|
|
2690
|
+
logger: params.logger,
|
|
2691
|
+
errorLabel: `feishu[${params.accountId}]: failed to fetch drive comment ${params.commentId}`
|
|
2692
|
+
})]);
|
|
2693
|
+
const commentCard = commentResponse?.code === 0 ? (commentResponse.data?.items ?? []).find((item) => item.comment_id?.trim() === params.commentId) : void 0;
|
|
2694
|
+
const embeddedReplies = commentCard?.reply_list?.replies ?? [];
|
|
2695
|
+
params.logger?.(`feishu[${params.accountId}]: embedded comment replies comment=${params.commentId} count=${embeddedReplies.length} summary=${summarizeCommentRepliesForLog(embeddedReplies)}`);
|
|
2696
|
+
const embeddedTargetReply = params.replyId ? embeddedReplies.find((reply) => reply.reply_id?.trim() === params.replyId?.trim()) : embeddedReplies.at(-1);
|
|
2697
|
+
let replies = embeddedReplies;
|
|
2698
|
+
let fetchedMatchedReply = params.replyId ? replies.find((reply) => reply.reply_id?.trim() === params.replyId?.trim()) : void 0;
|
|
2699
|
+
if (!embeddedTargetReply || replies.length === 0) {
|
|
2700
|
+
params.logger?.(`feishu[${params.accountId}]: fetching extra comment replies comment=${params.commentId} requested_reply=${params.replyId ?? "none"} embedded_count=${embeddedReplies.length} embedded_hit=${embeddedTargetReply ? "yes" : "no"}`);
|
|
2701
|
+
const fetched = await fetchDriveCommentReplies(params);
|
|
2702
|
+
if (fetched.replies.length > 0) {
|
|
2703
|
+
params.logger?.(`feishu[${params.accountId}]: fetched extra comment replies comment=${params.commentId} count=${fetched.replies.length} log_ids=${safeJsonStringify(fetched.logIds)} summary=${summarizeCommentRepliesForLog(fetched.replies)}`);
|
|
2704
|
+
replies = fetched.replies;
|
|
2705
|
+
fetchedMatchedReply = params.replyId ? replies.find((reply) => reply.reply_id?.trim() === params.replyId?.trim()) : void 0;
|
|
2706
|
+
}
|
|
2707
|
+
if (params.replyId && !embeddedTargetReply && !fetchedMatchedReply) for (let attempt = 1; attempt <= FEISHU_COMMENT_REPLY_MISS_RETRY_LIMIT; attempt += 1) {
|
|
2708
|
+
params.logger?.(`feishu[${params.accountId}]: retrying comment reply lookup comment=${params.commentId} requested_reply=${params.replyId} attempt=${attempt}/${FEISHU_COMMENT_REPLY_MISS_RETRY_LIMIT} delay_ms=${FEISHU_COMMENT_REPLY_MISS_RETRY_DELAY_MS}`);
|
|
2709
|
+
await params.waitMs(FEISHU_COMMENT_REPLY_MISS_RETRY_DELAY_MS);
|
|
2710
|
+
const retried = await fetchDriveCommentReplies(params);
|
|
2711
|
+
if (retried.replies.length > 0) {
|
|
2712
|
+
params.logger?.(`feishu[${params.accountId}]: fetched retried comment replies comment=${params.commentId} attempt=${attempt} count=${retried.replies.length} log_ids=${safeJsonStringify(retried.logIds)} summary=${summarizeCommentRepliesForLog(retried.replies)}`);
|
|
2713
|
+
replies = retried.replies;
|
|
2714
|
+
}
|
|
2715
|
+
fetchedMatchedReply = replies.find((reply) => reply.reply_id?.trim() === params.replyId);
|
|
2716
|
+
if (fetchedMatchedReply) break;
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
const rootReply = replies[0] ?? embeddedReplies[0];
|
|
2720
|
+
const targetReply = params.replyId ? embeddedTargetReply ?? fetchedMatchedReply ?? void 0 : replies.at(-1) ?? embeddedTargetReply ?? rootReply;
|
|
2721
|
+
const matchSource = params.replyId ? embeddedTargetReply ? "embedded" : fetchedMatchedReply ? "fetched" : "miss" : targetReply === rootReply ? "fallback_root" : targetReply === embeddedTargetReply ? "embedded_latest" : "fetched_latest";
|
|
2722
|
+
params.logger?.(`feishu[${params.accountId}]: comment reply resolution comment=${params.commentId} requested_reply=${params.replyId ?? "none"} match_source=${matchSource} root=${safeJsonStringify({
|
|
2723
|
+
reply_id: rootReply?.reply_id,
|
|
2724
|
+
text_len: extractReplyText(rootReply)?.length ?? 0
|
|
2725
|
+
})} target=${safeJsonStringify({
|
|
2726
|
+
reply_id: targetReply?.reply_id,
|
|
2727
|
+
text_len: extractReplyText(targetReply)?.length ?? 0
|
|
2728
|
+
})}`);
|
|
2729
|
+
const meta = metaResponse?.code === 0 ? metaResponse.data?.metas?.[0] : void 0;
|
|
2730
|
+
return {
|
|
2731
|
+
documentTitle: meta?.title?.trim() || void 0,
|
|
2732
|
+
documentUrl: meta?.url?.trim() || void 0,
|
|
2733
|
+
isWholeComment: commentCard?.is_whole,
|
|
2734
|
+
quoteText: commentCard?.quote?.trim() || void 0,
|
|
2735
|
+
rootCommentText: extractReplyText(rootReply),
|
|
2736
|
+
targetReplyText: extractReplyText(targetReply)
|
|
2737
|
+
};
|
|
2738
|
+
}
|
|
2739
|
+
function buildDriveCommentSurfacePrompt(params) {
|
|
2740
|
+
const documentLabel = params.documentTitle ? `"${params.documentTitle}"` : `${params.fileType} document ${params.fileToken}`;
|
|
2741
|
+
const actionLabel = params.noticeType === "add_reply" ? "reply" : "comment";
|
|
2742
|
+
const lines = [params.targetReplyText ? `The user added a ${actionLabel} in ${documentLabel}: ${params.targetReplyText}` : `The user added a ${actionLabel} in ${documentLabel}.`];
|
|
2743
|
+
if (params.noticeType === "add_reply" && params.rootCommentText && params.rootCommentText !== params.targetReplyText) lines.push(`Original comment: ${params.rootCommentText}`);
|
|
2744
|
+
if (params.quoteText) lines.push(`Quoted content: ${params.quoteText}`);
|
|
2745
|
+
if (params.isMentioned === true) lines.push("This comment mentioned you.");
|
|
2746
|
+
if (params.documentUrl) lines.push(`Document link: ${params.documentUrl}`);
|
|
2747
|
+
lines.push(`Event type: ${params.noticeType}`, `file_token: ${params.fileToken}`, `file_type: ${params.fileType}`, `comment_id: ${params.commentId}`);
|
|
2748
|
+
if (params.isWholeComment === true) lines.push("This is a whole-document comment.");
|
|
2749
|
+
if (params.replyId?.trim()) lines.push(`reply_id: ${params.replyId.trim()}`);
|
|
2750
|
+
lines.push("This is a Feishu document comment-thread event, not a Feishu IM conversation. Your final text reply will be posted automatically to the current comment thread and will not be sent as an instant message.", "If you need to inspect or handle the comment thread, prefer the feishu_drive tools: use list_comments / list_comment_replies to inspect comments, and use reply_comment/add_comment to notify the user after modifying the document.", "Whole-document comments do not support direct replies. When the current comment is whole-document, use feishu_drive.add_comment for any user-visible follow-up instead of reply_comment.", "If the comment asks you to modify document content, such as adding, inserting, replacing, or deleting text, tables, or headings, you must first use feishu_doc to actually modify the document. Do not reply with only \"done\", \"I'll handle it\", or a restated plan without calling tools.", "If the comment quotes document content, that quoted text is usually the edit anchor. For requests like \"insert xxx below this content\", first locate the position around the quoted content, then use feishu_doc to make the change.", "If the comment asks you to summarize, explain, rewrite, translate, refine, continue, or review the document content \"below\", \"above\", \"this paragraph\", \"this section\", or the quoted content, you must also treat the quoted content as the primary target anchor instead of defaulting to the whole document.", "For requests like \"summarize the content below\", \"explain this section\", or \"continue writing from here\", first locate the relevant document fragment based on the comment's quoted content. If the quote is not sufficient to support the answer, then use feishu_doc.read or feishu_doc.list_blocks to read nearby context.", "Do not guess document content based only on the comment text, and do not output a vague summary before reading enough context. Unless the user explicitly asks to summarize the entire document, default to handling only the local scope related to the quoted content.", "When document edits are involved, first use feishu_doc.read or feishu_doc.list_blocks to confirm the context, then use feishu_doc writing or updating capabilities to complete the change. After the edit succeeds, notify the user through feishu_drive.reply_comment.", "If the document edit fails or you cannot locate the anchor, do not pretend it succeeded. Reply clearly in the comment thread with the reason for failure or the missing information.", "If this is a reading-comprehension task, such as summarization, explanation, or extraction, you may directly output the final answer text after confirming the context. The system will automatically reply with that answer in the current comment thread.", "Prefer plain text suitable for a comment thread. Unless the user explicitly asks for Markdown, do not use Markdown headings, bullet lists, numbered lists, tables, blockquotes, or fenced code blocks in the final reply.", "If source content was read in Markdown form, rewrite it into normal plain-text prose before replying in the comment thread instead of copying Markdown syntax through.", "Do not include internal reasoning, analysis, chain-of-thought, scratch work, or any \"Reasoning:\" / \"Thinking:\" section in a user-visible reply. Output only the final answer meant for the user, or NO_REPLY when appropriate.", "Do not narrate your plan or execution process in the user-visible reply. Avoid meta lead-ins such as \"I will...\", \"I’ll first...\", \"I need to...\", \"The user wants...\", \"I have updated...\", or \"I am going to...\".", "When the task is complete, reply only with the user-facing result itself, such as the final answer or a concise completion confirmation. Do not include preambles about what you plan to do next.", "When you produce a user-visible reply, keep it in the same language as the user's original comment or reply unless they explicitly ask for another language.", "If you have already completed the user-visible action through feishu_drive.reply_comment or feishu_drive.add_comment, output NO_REPLY at the end to avoid duplicate sending.", "If the user directly asks a question in the comment and a plain text answer is sufficient, output the answer text directly. The system will automatically reply with your final answer in the current comment thread.", "If you determine that the current comment does not require any user-visible action, output NO_REPLY at the end.");
|
|
2751
|
+
lines.push(`Decide what to do next based on this document ${actionLabel} event.`);
|
|
2752
|
+
return lines.join("\n");
|
|
2753
|
+
}
|
|
2754
|
+
async function resolveDriveCommentEventCore(params) {
|
|
2755
|
+
const { cfg, accountId, event, botOpenId, createClient = (account) => createFeishuClient(account), verificationTimeoutMs = FEISHU_COMMENT_VERIFY_TIMEOUT_MS, logger, waitMs = delayMs } = params;
|
|
2756
|
+
const eventId = event.event_id?.trim();
|
|
2757
|
+
const commentId = event.comment_id?.trim();
|
|
2758
|
+
const replyId = event.reply_id?.trim();
|
|
2759
|
+
const noticeType = event.notice_meta?.notice_type?.trim();
|
|
2760
|
+
const fileToken = event.notice_meta?.file_token?.trim();
|
|
2761
|
+
const fileType = normalizeCommentFileType(event.notice_meta?.file_type);
|
|
2762
|
+
const senderId = event.notice_meta?.from_user_id?.open_id?.trim();
|
|
2763
|
+
const senderUserId = event.notice_meta?.from_user_id?.user_id?.trim() || void 0;
|
|
2764
|
+
if (!eventId || !commentId || !noticeType || !fileToken || !fileType || !senderId) {
|
|
2765
|
+
logger?.(`feishu[${accountId}]: drive comment notice missing required fields event=${eventId ?? "unknown"} comment=${commentId ?? "unknown"}`);
|
|
2766
|
+
return null;
|
|
2767
|
+
}
|
|
2768
|
+
if (noticeType !== "add_comment" && noticeType !== "add_reply") {
|
|
2769
|
+
logger?.(`feishu[${accountId}]: unsupported drive comment notice type ${noticeType}`);
|
|
2770
|
+
return null;
|
|
2771
|
+
}
|
|
2772
|
+
if (!botOpenId) {
|
|
2773
|
+
logger?.(`feishu[${accountId}]: skipping drive comment notice because bot open_id is unavailable event=${eventId}`);
|
|
2774
|
+
return null;
|
|
2775
|
+
}
|
|
2776
|
+
if (senderId === botOpenId) {
|
|
2777
|
+
logger?.(`feishu[${accountId}]: ignoring self-authored drive comment notice event=${eventId} sender=${senderId}`);
|
|
2778
|
+
return null;
|
|
2779
|
+
}
|
|
2780
|
+
const context = await fetchDriveCommentContext({
|
|
2781
|
+
client: createClient(resolveFeishuAccount({
|
|
2782
|
+
cfg,
|
|
2783
|
+
accountId
|
|
2784
|
+
})),
|
|
2785
|
+
fileToken,
|
|
2786
|
+
fileType,
|
|
2787
|
+
commentId,
|
|
2788
|
+
replyId,
|
|
2789
|
+
timeoutMs: verificationTimeoutMs,
|
|
2790
|
+
logger,
|
|
2791
|
+
accountId,
|
|
2792
|
+
waitMs
|
|
2793
|
+
});
|
|
2794
|
+
return {
|
|
2795
|
+
eventId,
|
|
2796
|
+
commentId,
|
|
2797
|
+
replyId,
|
|
2798
|
+
noticeType,
|
|
2799
|
+
fileToken,
|
|
2800
|
+
fileType,
|
|
2801
|
+
isWholeComment: context.isWholeComment,
|
|
2802
|
+
senderId,
|
|
2803
|
+
senderUserId,
|
|
2804
|
+
timestamp: event.timestamp,
|
|
2805
|
+
isMentioned: event.is_mentioned,
|
|
2806
|
+
context
|
|
2807
|
+
};
|
|
2808
|
+
}
|
|
2809
|
+
function parseFeishuDriveCommentNoticeEventPayload(value) {
|
|
2810
|
+
if (!isRecord$1(value) || !isRecord$1(value.notice_meta)) return null;
|
|
2811
|
+
const noticeMeta = value.notice_meta;
|
|
2812
|
+
const fromUserId = isRecord$1(noticeMeta.from_user_id) ? noticeMeta.from_user_id : void 0;
|
|
2813
|
+
const toUserId = isRecord$1(noticeMeta.to_user_id) ? noticeMeta.to_user_id : void 0;
|
|
2814
|
+
return {
|
|
2815
|
+
comment_id: readString$1(value.comment_id),
|
|
2816
|
+
event_id: readString$1(value.event_id),
|
|
2817
|
+
is_mentioned: readBoolean(value.is_mentioned),
|
|
2818
|
+
notice_meta: {
|
|
2819
|
+
file_token: readString$1(noticeMeta.file_token),
|
|
2820
|
+
file_type: readString$1(noticeMeta.file_type),
|
|
2821
|
+
from_user_id: fromUserId ? {
|
|
2822
|
+
open_id: readString$1(fromUserId.open_id),
|
|
2823
|
+
user_id: readString$1(fromUserId.user_id),
|
|
2824
|
+
union_id: readString$1(fromUserId.union_id)
|
|
2825
|
+
} : void 0,
|
|
2826
|
+
notice_type: readString$1(noticeMeta.notice_type),
|
|
2827
|
+
to_user_id: toUserId ? {
|
|
2828
|
+
open_id: readString$1(toUserId.open_id),
|
|
2829
|
+
user_id: readString$1(toUserId.user_id),
|
|
2830
|
+
union_id: readString$1(toUserId.union_id)
|
|
2831
|
+
} : void 0
|
|
2832
|
+
},
|
|
2833
|
+
reply_id: readString$1(value.reply_id),
|
|
2834
|
+
timestamp: readString$1(value.timestamp),
|
|
2835
|
+
type: readString$1(value.type)
|
|
2836
|
+
};
|
|
2837
|
+
}
|
|
2838
|
+
async function resolveDriveCommentEventTurn(params) {
|
|
2839
|
+
const resolved = await resolveDriveCommentEventCore(params);
|
|
2840
|
+
if (!resolved) return null;
|
|
2841
|
+
const prompt = buildDriveCommentSurfacePrompt({
|
|
2842
|
+
noticeType: resolved.noticeType,
|
|
2843
|
+
fileType: resolved.fileType,
|
|
2844
|
+
fileToken: resolved.fileToken,
|
|
2845
|
+
commentId: resolved.commentId,
|
|
2846
|
+
replyId: resolved.replyId,
|
|
2847
|
+
isWholeComment: resolved.isWholeComment,
|
|
2848
|
+
isMentioned: resolved.isMentioned,
|
|
2849
|
+
documentTitle: resolved.context.documentTitle,
|
|
2850
|
+
documentUrl: resolved.context.documentUrl,
|
|
2851
|
+
quoteText: resolved.context.quoteText,
|
|
2852
|
+
rootCommentText: resolved.context.rootCommentText,
|
|
2853
|
+
targetReplyText: resolved.context.targetReplyText
|
|
2854
|
+
});
|
|
2855
|
+
const preview = prompt.replace(/\s+/g, " ").slice(0, 160);
|
|
2856
|
+
return {
|
|
2857
|
+
eventId: resolved.eventId,
|
|
2858
|
+
messageId: `drive-comment:${resolved.eventId}`,
|
|
2859
|
+
commentId: resolved.commentId,
|
|
2860
|
+
replyId: resolved.replyId,
|
|
2861
|
+
noticeType: resolved.noticeType,
|
|
2862
|
+
fileToken: resolved.fileToken,
|
|
2863
|
+
fileType: resolved.fileType,
|
|
2864
|
+
isWholeComment: resolved.isWholeComment,
|
|
2865
|
+
senderId: resolved.senderId,
|
|
2866
|
+
senderUserId: resolved.senderUserId,
|
|
2867
|
+
timestamp: resolved.timestamp,
|
|
2868
|
+
isMentioned: resolved.isMentioned,
|
|
2869
|
+
documentTitle: resolved.context.documentTitle,
|
|
2870
|
+
documentUrl: resolved.context.documentUrl,
|
|
2871
|
+
quoteText: resolved.context.quoteText,
|
|
2872
|
+
rootCommentText: resolved.context.rootCommentText,
|
|
2873
|
+
targetReplyText: resolved.context.targetReplyText,
|
|
2874
|
+
prompt,
|
|
2875
|
+
preview
|
|
2876
|
+
};
|
|
2877
|
+
}
|
|
2878
|
+
//#endregion
|
|
2879
|
+
//#region extensions/feishu/src/comment-handler.ts
|
|
2880
|
+
function buildCommentSessionKey(params) {
|
|
2881
|
+
return params.core.channel.routing.buildAgentSessionKey({
|
|
2882
|
+
agentId: params.route.agentId,
|
|
2883
|
+
channel: "feishu",
|
|
2884
|
+
accountId: params.route.accountId,
|
|
2885
|
+
peer: {
|
|
2886
|
+
kind: "direct",
|
|
2887
|
+
id: params.commentTarget
|
|
2888
|
+
},
|
|
2889
|
+
dmScope: "per-account-channel-peer"
|
|
2890
|
+
});
|
|
2891
|
+
}
|
|
2892
|
+
function parseTimestampMs(value) {
|
|
2893
|
+
const parsed = value ? Number.parseInt(value, 10) : NaN;
|
|
2894
|
+
return Number.isFinite(parsed) ? parsed : Date.now();
|
|
2895
|
+
}
|
|
2896
|
+
async function handleFeishuCommentEvent(params) {
|
|
2897
|
+
const account = resolveFeishuRuntimeAccount({
|
|
2898
|
+
cfg: params.cfg,
|
|
2899
|
+
accountId: params.accountId
|
|
2900
|
+
});
|
|
2901
|
+
const feishuCfg = account.config;
|
|
2902
|
+
const core = getFeishuRuntime();
|
|
2903
|
+
const log = params.runtime?.log ?? console.log;
|
|
2904
|
+
const error = params.runtime?.error ?? console.error;
|
|
2905
|
+
const runtime = params.runtime ?? {
|
|
2906
|
+
log,
|
|
2907
|
+
error
|
|
2908
|
+
};
|
|
2909
|
+
const turn = await resolveDriveCommentEventTurn({
|
|
2910
|
+
cfg: params.cfg,
|
|
2911
|
+
accountId: account.accountId,
|
|
2912
|
+
event: params.event,
|
|
2913
|
+
botOpenId: params.botOpenId,
|
|
2914
|
+
logger: log
|
|
2915
|
+
});
|
|
2916
|
+
if (!turn) {
|
|
2917
|
+
log(`feishu[${account.accountId}]: drive comment notice skipped event=${params.event.event_id ?? "unknown"} comment=${params.event.comment_id ?? "unknown"}`);
|
|
2918
|
+
return;
|
|
2919
|
+
}
|
|
2920
|
+
const commentTarget = buildFeishuCommentTarget({
|
|
2921
|
+
fileType: turn.fileType,
|
|
2922
|
+
fileToken: turn.fileToken,
|
|
2923
|
+
commentId: turn.commentId
|
|
2924
|
+
});
|
|
2925
|
+
const dmPolicy = feishuCfg?.dmPolicy ?? "pairing";
|
|
2926
|
+
const configAllowFrom = feishuCfg?.allowFrom ?? [];
|
|
2927
|
+
const pairing = createChannelPairingController({
|
|
2928
|
+
core,
|
|
2929
|
+
channel: "feishu",
|
|
2930
|
+
accountId: account.accountId
|
|
2931
|
+
});
|
|
2932
|
+
const storeAllowFrom = dmPolicy !== "allowlist" && dmPolicy !== "open" ? await pairing.readAllowFromStore().catch(() => []) : [];
|
|
2933
|
+
const senderAllowed = resolveFeishuAllowlistMatch({
|
|
2934
|
+
allowFrom: [...configAllowFrom, ...storeAllowFrom],
|
|
2935
|
+
senderId: turn.senderId,
|
|
2936
|
+
senderIds: [turn.senderUserId]
|
|
2937
|
+
}).allowed;
|
|
2938
|
+
if (dmPolicy !== "open" && !senderAllowed) {
|
|
2939
|
+
if (dmPolicy === "pairing") {
|
|
2940
|
+
const client = createFeishuClient(account);
|
|
2941
|
+
await pairing.issueChallenge({
|
|
2942
|
+
senderId: turn.senderId,
|
|
2943
|
+
senderIdLine: `Your Feishu user id: ${turn.senderId}`,
|
|
2944
|
+
meta: { name: turn.senderId },
|
|
2945
|
+
onCreated: ({ code }) => {
|
|
2946
|
+
log(`feishu[${account.accountId}]: comment pairing request sender=${turn.senderId} code=${code}`);
|
|
2947
|
+
},
|
|
2948
|
+
sendPairingReply: async (text) => {
|
|
2949
|
+
await deliverCommentThreadText(client, {
|
|
2950
|
+
file_token: turn.fileToken,
|
|
2951
|
+
file_type: turn.fileType,
|
|
2952
|
+
comment_id: turn.commentId,
|
|
2953
|
+
content: text,
|
|
2954
|
+
is_whole_comment: turn.isWholeComment
|
|
2955
|
+
});
|
|
2956
|
+
},
|
|
2957
|
+
onReplyError: (err) => {
|
|
2958
|
+
log(`feishu[${account.accountId}]: comment pairing reply failed for ${turn.senderId}: ${String(err)}`);
|
|
2959
|
+
}
|
|
2960
|
+
});
|
|
2961
|
+
} else log(`feishu[${account.accountId}]: blocked unauthorized comment sender ${turn.senderId} (dmPolicy=${dmPolicy}, comment=${turn.commentId})`);
|
|
2962
|
+
return;
|
|
2963
|
+
}
|
|
2964
|
+
let effectiveCfg = params.cfg;
|
|
2965
|
+
let route = core.channel.routing.resolveAgentRoute({
|
|
2966
|
+
cfg: params.cfg,
|
|
2967
|
+
channel: "feishu",
|
|
2968
|
+
accountId: account.accountId,
|
|
2969
|
+
peer: {
|
|
2970
|
+
kind: "direct",
|
|
2971
|
+
id: turn.senderId
|
|
2972
|
+
}
|
|
2973
|
+
});
|
|
2974
|
+
if (route.matchedBy === "default") {
|
|
2975
|
+
const dynamicCfg = feishuCfg?.dynamicAgentCreation;
|
|
2976
|
+
if (dynamicCfg?.enabled) {
|
|
2977
|
+
const dynamicResult = await maybeCreateDynamicAgent({
|
|
2978
|
+
cfg: params.cfg,
|
|
2979
|
+
runtime: core,
|
|
2980
|
+
senderOpenId: turn.senderId,
|
|
2981
|
+
dynamicCfg,
|
|
2982
|
+
log: (message) => log(message)
|
|
2983
|
+
});
|
|
2984
|
+
if (dynamicResult.created) {
|
|
2985
|
+
effectiveCfg = dynamicResult.updatedCfg;
|
|
2986
|
+
route = core.channel.routing.resolveAgentRoute({
|
|
2987
|
+
cfg: dynamicResult.updatedCfg,
|
|
2988
|
+
channel: "feishu",
|
|
2989
|
+
accountId: account.accountId,
|
|
2990
|
+
peer: {
|
|
2991
|
+
kind: "direct",
|
|
2992
|
+
id: turn.senderId
|
|
2993
|
+
}
|
|
2994
|
+
});
|
|
2995
|
+
log(`feishu[${account.accountId}]: dynamic agent created for comment flow, route=${route.sessionKey}`);
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
const commentSessionKey = buildCommentSessionKey({
|
|
3000
|
+
core,
|
|
3001
|
+
route,
|
|
3002
|
+
commentTarget
|
|
3003
|
+
});
|
|
3004
|
+
const bodyForAgent = `[message_id: ${turn.messageId}]\n${turn.prompt}`;
|
|
3005
|
+
const ctxPayload = core.channel.reply.finalizeInboundContext({
|
|
3006
|
+
Body: bodyForAgent,
|
|
3007
|
+
BodyForAgent: bodyForAgent,
|
|
3008
|
+
RawBody: turn.targetReplyText ?? turn.rootCommentText ?? turn.prompt,
|
|
3009
|
+
CommandBody: turn.targetReplyText ?? turn.rootCommentText ?? turn.prompt,
|
|
3010
|
+
From: `feishu:${turn.senderId}`,
|
|
3011
|
+
To: commentTarget,
|
|
3012
|
+
SessionKey: commentSessionKey,
|
|
3013
|
+
AccountId: route.accountId,
|
|
3014
|
+
ChatType: "direct",
|
|
3015
|
+
ConversationLabel: turn.documentTitle ? `Feishu comment · ${turn.documentTitle}` : "Feishu comment",
|
|
3016
|
+
SenderName: turn.senderId,
|
|
3017
|
+
SenderId: turn.senderId,
|
|
3018
|
+
Provider: "feishu",
|
|
3019
|
+
Surface: "feishu-comment",
|
|
3020
|
+
MessageSid: turn.messageId,
|
|
3021
|
+
Timestamp: parseTimestampMs(turn.timestamp),
|
|
3022
|
+
WasMentioned: turn.isMentioned,
|
|
3023
|
+
CommandAuthorized: false,
|
|
3024
|
+
OriginatingChannel: "feishu",
|
|
3025
|
+
OriginatingTo: commentTarget
|
|
3026
|
+
});
|
|
3027
|
+
const storePath = core.channel.session.resolveStorePath(effectiveCfg.session?.store, { agentId: route.agentId });
|
|
3028
|
+
await core.channel.session.recordInboundSession({
|
|
3029
|
+
storePath,
|
|
3030
|
+
sessionKey: commentSessionKey,
|
|
3031
|
+
ctx: ctxPayload,
|
|
3032
|
+
onRecordError: (err) => {
|
|
3033
|
+
error(`feishu[${account.accountId}]: failed to record comment inbound session ${commentSessionKey}: ${String(err)}`);
|
|
3034
|
+
}
|
|
3035
|
+
});
|
|
3036
|
+
const { dispatcher, replyOptions, markDispatchIdle } = createFeishuCommentReplyDispatcher({
|
|
3037
|
+
cfg: effectiveCfg,
|
|
3038
|
+
agentId: route.agentId,
|
|
3039
|
+
runtime,
|
|
3040
|
+
accountId: account.accountId,
|
|
3041
|
+
fileToken: turn.fileToken,
|
|
3042
|
+
fileType: turn.fileType,
|
|
3043
|
+
commentId: turn.commentId,
|
|
3044
|
+
isWholeComment: turn.isWholeComment
|
|
3045
|
+
});
|
|
3046
|
+
log(`feishu[${account.accountId}]: dispatching drive comment to agent (session=${commentSessionKey} comment=${turn.commentId} type=${turn.noticeType})`);
|
|
3047
|
+
const { queuedFinal, counts } = await core.channel.reply.withReplyDispatcher({
|
|
3048
|
+
dispatcher,
|
|
3049
|
+
onSettled: () => {
|
|
3050
|
+
markDispatchIdle();
|
|
3051
|
+
},
|
|
3052
|
+
run: () => core.channel.reply.dispatchReplyFromConfig({
|
|
3053
|
+
ctx: ctxPayload,
|
|
3054
|
+
cfg: effectiveCfg,
|
|
3055
|
+
dispatcher,
|
|
3056
|
+
replyOptions
|
|
3057
|
+
})
|
|
3058
|
+
});
|
|
3059
|
+
log(`feishu[${account.accountId}]: drive comment dispatch complete (queuedFinal=${queuedFinal}, replies=${counts.final}, session=${commentSessionKey})`);
|
|
3060
|
+
}
|
|
3061
|
+
//#endregion
|
|
3062
|
+
//#region extensions/feishu/src/monitor.startup.ts
|
|
3063
|
+
const FEISHU_STARTUP_BOT_INFO_TIMEOUT_DEFAULT_MS = 3e4;
|
|
3064
|
+
const FEISHU_STARTUP_BOT_INFO_TIMEOUT_ENV = "OPENCLAW_FEISHU_STARTUP_PROBE_TIMEOUT_MS";
|
|
3065
|
+
function resolveStartupProbeTimeoutMs() {
|
|
3066
|
+
const raw = process.env[FEISHU_STARTUP_BOT_INFO_TIMEOUT_ENV];
|
|
3067
|
+
if (raw) {
|
|
3068
|
+
const parsed = Number(raw);
|
|
3069
|
+
if (Number.isFinite(parsed) && parsed > 0) return Math.floor(parsed);
|
|
3070
|
+
console.warn(`[feishu] ${FEISHU_STARTUP_BOT_INFO_TIMEOUT_ENV}="${raw}" is invalid; using default ${FEISHU_STARTUP_BOT_INFO_TIMEOUT_DEFAULT_MS}ms`);
|
|
3071
|
+
}
|
|
3072
|
+
return FEISHU_STARTUP_BOT_INFO_TIMEOUT_DEFAULT_MS;
|
|
3073
|
+
}
|
|
3074
|
+
const FEISHU_STARTUP_BOT_INFO_TIMEOUT_MS = resolveStartupProbeTimeoutMs();
|
|
3075
|
+
function isTimeoutErrorMessage(message) {
|
|
3076
|
+
return message?.toLowerCase().includes("timeout") || message?.toLowerCase().includes("timed out") ? true : false;
|
|
3077
|
+
}
|
|
3078
|
+
function isAbortErrorMessage(message) {
|
|
3079
|
+
return message?.toLowerCase().includes("aborted") ?? false;
|
|
3080
|
+
}
|
|
3081
|
+
async function fetchBotIdentityForMonitor(account, options = {}) {
|
|
3082
|
+
if (options.abortSignal?.aborted) return {};
|
|
3083
|
+
const timeoutMs = options.timeoutMs ?? FEISHU_STARTUP_BOT_INFO_TIMEOUT_MS;
|
|
3084
|
+
const result = await probeFeishu(account, {
|
|
3085
|
+
timeoutMs,
|
|
3086
|
+
abortSignal: options.abortSignal
|
|
3087
|
+
});
|
|
3088
|
+
if (result.ok) return {
|
|
3089
|
+
botOpenId: result.botOpenId,
|
|
3090
|
+
botName: result.botName
|
|
3091
|
+
};
|
|
3092
|
+
if (options.abortSignal?.aborted || isAbortErrorMessage(result.error)) return {};
|
|
3093
|
+
if (isTimeoutErrorMessage(result.error)) (options.runtime?.error ?? console.error)(`feishu[${account.accountId}]: bot info probe timed out after ${timeoutMs}ms; continuing startup`);
|
|
3094
|
+
return {};
|
|
3095
|
+
}
|
|
3096
|
+
//#endregion
|
|
3097
|
+
//#region extensions/feishu/src/monitor.state.ts
|
|
3098
|
+
const wsClients = /* @__PURE__ */ new Map();
|
|
3099
|
+
const httpServers = /* @__PURE__ */ new Map();
|
|
3100
|
+
const botOpenIds = /* @__PURE__ */ new Map();
|
|
3101
|
+
const botNames = /* @__PURE__ */ new Map();
|
|
3102
|
+
const FEISHU_WEBHOOK_MAX_BODY_BYTES = 64 * 1024;
|
|
3103
|
+
const FEISHU_WEBHOOK_BODY_TIMEOUT_MS = 5e3;
|
|
3104
|
+
const FEISHU_WEBHOOK_RATE_LIMIT_FALLBACK_DEFAULTS = {
|
|
3105
|
+
windowMs: 6e4,
|
|
3106
|
+
maxRequests: 120,
|
|
3107
|
+
maxTrackedKeys: 4096
|
|
3108
|
+
};
|
|
3109
|
+
const FEISHU_WEBHOOK_ANOMALY_FALLBACK_DEFAULTS = {
|
|
3110
|
+
maxTrackedKeys: 4096,
|
|
3111
|
+
ttlMs: 360 * 6e4,
|
|
3112
|
+
logEvery: 25
|
|
3113
|
+
};
|
|
3114
|
+
function coercePositiveInt(value, fallback) {
|
|
3115
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return fallback;
|
|
3116
|
+
const normalized = Math.floor(value);
|
|
3117
|
+
return normalized > 0 ? normalized : fallback;
|
|
3118
|
+
}
|
|
3119
|
+
function resolveFeishuWebhookRateLimitDefaultsForTest(defaults) {
|
|
3120
|
+
const resolved = defaults;
|
|
3121
|
+
return {
|
|
3122
|
+
windowMs: coercePositiveInt(resolved?.windowMs, FEISHU_WEBHOOK_RATE_LIMIT_FALLBACK_DEFAULTS.windowMs),
|
|
3123
|
+
maxRequests: coercePositiveInt(resolved?.maxRequests, FEISHU_WEBHOOK_RATE_LIMIT_FALLBACK_DEFAULTS.maxRequests),
|
|
3124
|
+
maxTrackedKeys: coercePositiveInt(resolved?.maxTrackedKeys, FEISHU_WEBHOOK_RATE_LIMIT_FALLBACK_DEFAULTS.maxTrackedKeys)
|
|
3125
|
+
};
|
|
3126
|
+
}
|
|
3127
|
+
function resolveFeishuWebhookAnomalyDefaultsForTest(defaults) {
|
|
3128
|
+
const resolved = defaults;
|
|
3129
|
+
return {
|
|
3130
|
+
maxTrackedKeys: coercePositiveInt(resolved?.maxTrackedKeys, FEISHU_WEBHOOK_ANOMALY_FALLBACK_DEFAULTS.maxTrackedKeys),
|
|
3131
|
+
ttlMs: coercePositiveInt(resolved?.ttlMs, FEISHU_WEBHOOK_ANOMALY_FALLBACK_DEFAULTS.ttlMs),
|
|
3132
|
+
logEvery: coercePositiveInt(resolved?.logEvery, FEISHU_WEBHOOK_ANOMALY_FALLBACK_DEFAULTS.logEvery)
|
|
3133
|
+
};
|
|
3134
|
+
}
|
|
3135
|
+
const feishuWebhookRateLimitDefaults = resolveFeishuWebhookRateLimitDefaultsForTest(WEBHOOK_RATE_LIMIT_DEFAULTS);
|
|
3136
|
+
const feishuWebhookAnomalyDefaults = resolveFeishuWebhookAnomalyDefaultsForTest(WEBHOOK_ANOMALY_COUNTER_DEFAULTS);
|
|
3137
|
+
const feishuWebhookRateLimiter = createFixedWindowRateLimiter({
|
|
3138
|
+
windowMs: feishuWebhookRateLimitDefaults.windowMs,
|
|
3139
|
+
maxRequests: feishuWebhookRateLimitDefaults.maxRequests,
|
|
3140
|
+
maxTrackedKeys: feishuWebhookRateLimitDefaults.maxTrackedKeys
|
|
3141
|
+
});
|
|
3142
|
+
const feishuWebhookAnomalyTracker = createWebhookAnomalyTracker({
|
|
3143
|
+
maxTrackedKeys: feishuWebhookAnomalyDefaults.maxTrackedKeys,
|
|
3144
|
+
ttlMs: feishuWebhookAnomalyDefaults.ttlMs,
|
|
3145
|
+
logEvery: feishuWebhookAnomalyDefaults.logEvery
|
|
3146
|
+
});
|
|
3147
|
+
function closeWsClient(client) {
|
|
3148
|
+
if (!client) return;
|
|
3149
|
+
try {
|
|
3150
|
+
client.close();
|
|
3151
|
+
} catch {}
|
|
3152
|
+
}
|
|
3153
|
+
function clearFeishuWebhookRateLimitStateForTest() {
|
|
3154
|
+
feishuWebhookRateLimiter.clear();
|
|
3155
|
+
feishuWebhookAnomalyTracker.clear();
|
|
3156
|
+
}
|
|
3157
|
+
function getFeishuWebhookRateLimitStateSizeForTest() {
|
|
3158
|
+
return feishuWebhookRateLimiter.size();
|
|
3159
|
+
}
|
|
3160
|
+
function isWebhookRateLimitedForTest(key, nowMs) {
|
|
3161
|
+
return feishuWebhookRateLimiter.isRateLimited(key, nowMs);
|
|
3162
|
+
}
|
|
3163
|
+
function recordWebhookStatus(runtime, accountId, path, statusCode) {
|
|
3164
|
+
feishuWebhookAnomalyTracker.record({
|
|
3165
|
+
key: `${accountId}:${path}:${statusCode}`,
|
|
3166
|
+
statusCode,
|
|
3167
|
+
log: runtime?.log ?? console.log,
|
|
3168
|
+
message: (count) => `feishu[${accountId}]: webhook anomaly path=${path} status=${statusCode} count=${count}`
|
|
3169
|
+
});
|
|
3170
|
+
}
|
|
3171
|
+
function stopFeishuMonitorState(accountId) {
|
|
3172
|
+
if (accountId) {
|
|
3173
|
+
closeWsClient(wsClients.get(accountId));
|
|
3174
|
+
wsClients.delete(accountId);
|
|
3175
|
+
const server = httpServers.get(accountId);
|
|
3176
|
+
if (server) {
|
|
3177
|
+
server.close();
|
|
3178
|
+
httpServers.delete(accountId);
|
|
3179
|
+
}
|
|
3180
|
+
botOpenIds.delete(accountId);
|
|
3181
|
+
botNames.delete(accountId);
|
|
3182
|
+
return;
|
|
3183
|
+
}
|
|
3184
|
+
for (const client of wsClients.values()) closeWsClient(client);
|
|
3185
|
+
wsClients.clear();
|
|
3186
|
+
for (const server of httpServers.values()) server.close();
|
|
3187
|
+
httpServers.clear();
|
|
3188
|
+
botOpenIds.clear();
|
|
3189
|
+
botNames.clear();
|
|
3190
|
+
}
|
|
3191
|
+
//#endregion
|
|
3192
|
+
//#region extensions/feishu/src/monitor.bot-identity.ts
|
|
3193
|
+
const BOT_IDENTITY_RETRY_DELAYS_MS = [
|
|
3194
|
+
6e4,
|
|
3195
|
+
12e4,
|
|
3196
|
+
3e5,
|
|
3197
|
+
6e5,
|
|
3198
|
+
9e5
|
|
3199
|
+
];
|
|
3200
|
+
function applyBotIdentityState(accountId, identity) {
|
|
3201
|
+
const botOpenId = identity.botOpenId?.trim() || void 0;
|
|
3202
|
+
const botName = identity.botName?.trim() || void 0;
|
|
3203
|
+
botOpenIds.set(accountId, botOpenId ?? "");
|
|
3204
|
+
if (botName) botNames.set(accountId, botName);
|
|
3205
|
+
else botNames.delete(accountId);
|
|
3206
|
+
return {
|
|
3207
|
+
botOpenId,
|
|
3208
|
+
botName
|
|
3209
|
+
};
|
|
3210
|
+
}
|
|
3211
|
+
async function retryBotIdentityProbe(account, accountId, runtime, abortSignal) {
|
|
3212
|
+
const log = runtime?.log ?? console.log;
|
|
3213
|
+
const error = runtime?.error ?? console.error;
|
|
3214
|
+
for (let i = 0; i < BOT_IDENTITY_RETRY_DELAYS_MS.length; i += 1) {
|
|
3215
|
+
if (abortSignal?.aborted) return;
|
|
3216
|
+
if (!await waitForAbortableDelay(BOT_IDENTITY_RETRY_DELAYS_MS[i], abortSignal)) return;
|
|
3217
|
+
const resolved = applyBotIdentityState(accountId, await fetchBotIdentityForMonitor(account, {
|
|
3218
|
+
runtime,
|
|
3219
|
+
abortSignal
|
|
3220
|
+
}));
|
|
3221
|
+
if (resolved.botOpenId) {
|
|
3222
|
+
log(`feishu[${accountId}]: bot open_id recovered via background retry: ${resolved.botOpenId}`);
|
|
3223
|
+
return;
|
|
3224
|
+
}
|
|
3225
|
+
const nextDelay = BOT_IDENTITY_RETRY_DELAYS_MS[i + 1];
|
|
3226
|
+
error(`feishu[${accountId}]: bot identity background retry ${i + 1}/${BOT_IDENTITY_RETRY_DELAYS_MS.length} failed` + (nextDelay ? `; next attempt in ${nextDelay / 1e3}s` : ""));
|
|
3227
|
+
}
|
|
3228
|
+
error(`feishu[${accountId}]: bot identity background retry exhausted; requireMention group messages may be skipped until restart`);
|
|
3229
|
+
}
|
|
3230
|
+
function startBotIdentityRecovery(params) {
|
|
3231
|
+
const { account, accountId, runtime, abortSignal } = params;
|
|
3232
|
+
const log = runtime?.log ?? console.log;
|
|
3233
|
+
log(`feishu[${accountId}]: bot open_id unknown; starting background retry (delays: ${BOT_IDENTITY_RETRY_DELAYS_MS.map((delay) => `${delay / 1e3}s`).join(", ")})`);
|
|
3234
|
+
log(`feishu[${accountId}]: requireMention group messages stay gated until bot identity recovery succeeds`);
|
|
3235
|
+
retryBotIdentityProbe(account, accountId, runtime, abortSignal);
|
|
3236
|
+
}
|
|
3237
|
+
//#endregion
|
|
3238
|
+
//#region extensions/feishu/src/monitor.transport.ts
|
|
3239
|
+
function isFeishuWebhookPayload(value) {
|
|
3240
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
3241
|
+
}
|
|
3242
|
+
function buildFeishuWebhookEnvelope(req, payload) {
|
|
3243
|
+
return Object.assign(Object.create({ headers: req.headers }), payload);
|
|
3244
|
+
}
|
|
3245
|
+
function parseFeishuWebhookPayload(rawBody) {
|
|
3246
|
+
try {
|
|
3247
|
+
const parsed = JSON.parse(rawBody);
|
|
3248
|
+
return isFeishuWebhookPayload(parsed) ? parsed : null;
|
|
3249
|
+
} catch {
|
|
3250
|
+
return null;
|
|
3251
|
+
}
|
|
3252
|
+
}
|
|
3253
|
+
function isFeishuWebhookSignatureValid(params) {
|
|
3254
|
+
const encryptKey = params.encryptKey?.trim();
|
|
3255
|
+
if (!encryptKey) return true;
|
|
3256
|
+
const timestampHeader = params.headers["x-lark-request-timestamp"];
|
|
3257
|
+
const nonceHeader = params.headers["x-lark-request-nonce"];
|
|
3258
|
+
const signatureHeader = params.headers["x-lark-signature"];
|
|
3259
|
+
const timestamp = Array.isArray(timestampHeader) ? timestampHeader[0] : timestampHeader;
|
|
3260
|
+
const nonce = Array.isArray(nonceHeader) ? nonceHeader[0] : nonceHeader;
|
|
3261
|
+
const signature = Array.isArray(signatureHeader) ? signatureHeader[0] : signatureHeader;
|
|
3262
|
+
if (!timestamp || !nonce || !signature) return false;
|
|
3263
|
+
return safeEqualSecret(crypto.createHash("sha256").update(timestamp + nonce + encryptKey + params.rawBody).digest("hex"), signature);
|
|
3264
|
+
}
|
|
3265
|
+
function respondText(res, statusCode, body) {
|
|
3266
|
+
res.statusCode = statusCode;
|
|
3267
|
+
res.setHeader("Content-Type", "text/plain; charset=utf-8");
|
|
3268
|
+
res.end(body);
|
|
3269
|
+
}
|
|
3270
|
+
async function monitorWebSocket({ account, accountId, runtime, abortSignal, eventDispatcher }) {
|
|
3271
|
+
const log = runtime?.log ?? console.log;
|
|
3272
|
+
const error = runtime?.error ?? console.error;
|
|
3273
|
+
log(`feishu[${accountId}]: starting WebSocket connection...`);
|
|
3274
|
+
const wsClient = createFeishuWSClient(account);
|
|
3275
|
+
wsClients.set(accountId, wsClient);
|
|
3276
|
+
return new Promise((resolve, reject) => {
|
|
3277
|
+
let cleanedUp = false;
|
|
3278
|
+
const cleanup = () => {
|
|
3279
|
+
if (cleanedUp) return;
|
|
3280
|
+
cleanedUp = true;
|
|
3281
|
+
abortSignal?.removeEventListener("abort", handleAbort);
|
|
3282
|
+
try {
|
|
3283
|
+
wsClient.close();
|
|
3284
|
+
} catch (err) {
|
|
3285
|
+
error(`feishu[${accountId}]: error closing WebSocket client: ${String(err)}`);
|
|
3286
|
+
} finally {
|
|
3287
|
+
wsClients.delete(accountId);
|
|
3288
|
+
botOpenIds.delete(accountId);
|
|
3289
|
+
botNames.delete(accountId);
|
|
3290
|
+
}
|
|
3291
|
+
};
|
|
3292
|
+
function handleAbort() {
|
|
3293
|
+
log(`feishu[${accountId}]: abort signal received, stopping`);
|
|
3294
|
+
cleanup();
|
|
3295
|
+
resolve();
|
|
3296
|
+
}
|
|
3297
|
+
if (abortSignal?.aborted) {
|
|
3298
|
+
cleanup();
|
|
3299
|
+
resolve();
|
|
3300
|
+
return;
|
|
3301
|
+
}
|
|
3302
|
+
abortSignal?.addEventListener("abort", handleAbort, { once: true });
|
|
3303
|
+
try {
|
|
3304
|
+
wsClient.start({ eventDispatcher });
|
|
3305
|
+
log(`feishu[${accountId}]: WebSocket client started`);
|
|
3306
|
+
} catch (err) {
|
|
3307
|
+
cleanup();
|
|
3308
|
+
reject(err);
|
|
3309
|
+
}
|
|
3310
|
+
});
|
|
3311
|
+
}
|
|
3312
|
+
async function monitorWebhook({ account, accountId, runtime, abortSignal, eventDispatcher }) {
|
|
3313
|
+
const log = runtime?.log ?? console.log;
|
|
3314
|
+
const error = runtime?.error ?? console.error;
|
|
3315
|
+
const port = account.config.webhookPort ?? 3e3;
|
|
3316
|
+
const path = account.config.webhookPath ?? "/feishu/events";
|
|
3317
|
+
const host = account.config.webhookHost ?? "127.0.0.1";
|
|
3318
|
+
log(`feishu[${accountId}]: starting Webhook server on ${host}:${port}, path ${path}...`);
|
|
3319
|
+
const server = http.createServer();
|
|
3320
|
+
server.on("request", (req, res) => {
|
|
3321
|
+
res.on("finish", () => {
|
|
3322
|
+
recordWebhookStatus(runtime, accountId, path, res.statusCode);
|
|
3323
|
+
});
|
|
3324
|
+
if (!applyBasicWebhookRequestGuards({
|
|
3325
|
+
req,
|
|
3326
|
+
res,
|
|
3327
|
+
rateLimiter: feishuWebhookRateLimiter,
|
|
3328
|
+
rateLimitKey: `${accountId}:${path}:${req.socket.remoteAddress ?? "unknown"}`,
|
|
3329
|
+
nowMs: Date.now(),
|
|
3330
|
+
requireJsonContentType: true
|
|
3331
|
+
})) return;
|
|
3332
|
+
const guard = installRequestBodyLimitGuard(req, res, {
|
|
3333
|
+
maxBytes: FEISHU_WEBHOOK_MAX_BODY_BYTES,
|
|
3334
|
+
timeoutMs: FEISHU_WEBHOOK_BODY_TIMEOUT_MS,
|
|
3335
|
+
responseFormat: "text"
|
|
3336
|
+
});
|
|
3337
|
+
if (guard.isTripped()) return;
|
|
3338
|
+
(async () => {
|
|
3339
|
+
try {
|
|
3340
|
+
const rawBody = await readRequestBodyWithLimit(req, {
|
|
3341
|
+
maxBytes: FEISHU_WEBHOOK_MAX_BODY_BYTES,
|
|
3342
|
+
timeoutMs: FEISHU_WEBHOOK_BODY_TIMEOUT_MS
|
|
3343
|
+
});
|
|
3344
|
+
if (guard.isTripped() || res.writableEnded) return;
|
|
3345
|
+
if (!isFeishuWebhookSignatureValid({
|
|
3346
|
+
headers: req.headers,
|
|
3347
|
+
rawBody,
|
|
3348
|
+
encryptKey: account.encryptKey
|
|
3349
|
+
})) {
|
|
3350
|
+
respondText(res, 401, "Invalid signature");
|
|
3351
|
+
return;
|
|
3352
|
+
}
|
|
3353
|
+
const payload = parseFeishuWebhookPayload(rawBody);
|
|
3354
|
+
if (!payload) {
|
|
3355
|
+
respondText(res, 400, "Invalid JSON");
|
|
3356
|
+
return;
|
|
3357
|
+
}
|
|
3358
|
+
const { isChallenge, challenge } = Lark.generateChallenge(payload, { encryptKey: account.encryptKey ?? "" });
|
|
3359
|
+
if (isChallenge) {
|
|
3360
|
+
res.statusCode = 200;
|
|
3361
|
+
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
3362
|
+
res.end(JSON.stringify(challenge));
|
|
3363
|
+
return;
|
|
3364
|
+
}
|
|
3365
|
+
const value = await eventDispatcher.invoke(buildFeishuWebhookEnvelope(req, payload), { needCheck: false });
|
|
3366
|
+
if (!res.headersSent) {
|
|
3367
|
+
res.statusCode = 200;
|
|
3368
|
+
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
3369
|
+
res.end(JSON.stringify(value));
|
|
3370
|
+
}
|
|
3371
|
+
} catch (err) {
|
|
3372
|
+
if (isRequestBodyLimitError(err)) {
|
|
3373
|
+
if (!res.headersSent) respondText(res, err.statusCode, requestBodyErrorToText(err.code));
|
|
3374
|
+
return;
|
|
3375
|
+
}
|
|
3376
|
+
if (!guard.isTripped()) {
|
|
3377
|
+
error(`feishu[${accountId}]: webhook handler error: ${String(err)}`);
|
|
3378
|
+
if (!res.headersSent) respondText(res, 500, "Internal Server Error");
|
|
3379
|
+
}
|
|
3380
|
+
} finally {
|
|
3381
|
+
guard.dispose();
|
|
3382
|
+
}
|
|
3383
|
+
})();
|
|
3384
|
+
});
|
|
3385
|
+
httpServers.set(accountId, server);
|
|
3386
|
+
return new Promise((resolve, reject) => {
|
|
3387
|
+
const cleanup = () => {
|
|
3388
|
+
server.close();
|
|
3389
|
+
httpServers.delete(accountId);
|
|
3390
|
+
botOpenIds.delete(accountId);
|
|
3391
|
+
botNames.delete(accountId);
|
|
3392
|
+
};
|
|
3393
|
+
const handleAbort = () => {
|
|
3394
|
+
log(`feishu[${accountId}]: abort signal received, stopping Webhook server`);
|
|
3395
|
+
cleanup();
|
|
3396
|
+
resolve();
|
|
3397
|
+
};
|
|
3398
|
+
if (abortSignal?.aborted) {
|
|
3399
|
+
cleanup();
|
|
3400
|
+
resolve();
|
|
3401
|
+
return;
|
|
3402
|
+
}
|
|
3403
|
+
abortSignal?.addEventListener("abort", handleAbort, { once: true });
|
|
3404
|
+
server.listen(port, host, () => {
|
|
3405
|
+
log(`feishu[${accountId}]: Webhook server listening on ${host}:${port}`);
|
|
3406
|
+
});
|
|
3407
|
+
server.on("error", (err) => {
|
|
3408
|
+
error(`feishu[${accountId}]: Webhook server error: ${err}`);
|
|
3409
|
+
abortSignal?.removeEventListener("abort", handleAbort);
|
|
3410
|
+
reject(err);
|
|
3411
|
+
});
|
|
3412
|
+
});
|
|
3413
|
+
}
|
|
3414
|
+
//#endregion
|
|
3415
|
+
//#region extensions/feishu/src/monitor.account.ts
|
|
3416
|
+
const FEISHU_REACTION_VERIFY_TIMEOUT_MS = 1500;
|
|
3417
|
+
async function resolveReactionSyntheticEvent(params) {
|
|
3418
|
+
const { cfg, accountId, event, botOpenId, fetchMessage = getMessageFeishu, verificationTimeoutMs = FEISHU_REACTION_VERIFY_TIMEOUT_MS, logger, uuid = () => crypto$1.randomUUID(), action = "created" } = params;
|
|
3419
|
+
const emoji = event.reaction_type?.emoji_type;
|
|
3420
|
+
const messageId = event.message_id;
|
|
3421
|
+
const senderId = event.user_id?.open_id;
|
|
3422
|
+
if (!emoji || !messageId || !senderId) return null;
|
|
3423
|
+
const reactionNotifications = resolveFeishuAccount({
|
|
3424
|
+
cfg,
|
|
3425
|
+
accountId
|
|
3426
|
+
}).config.reactionNotifications ?? "own";
|
|
3427
|
+
if (reactionNotifications === "off") return null;
|
|
3428
|
+
if (event.operator_type === "app" || senderId === botOpenId) return null;
|
|
3429
|
+
if (emoji === "Typing") return null;
|
|
3430
|
+
if (reactionNotifications === "own" && !botOpenId) {
|
|
3431
|
+
logger?.(`feishu[${accountId}]: bot open_id unavailable, skipping reaction ${emoji} on ${messageId}`);
|
|
3432
|
+
return null;
|
|
3433
|
+
}
|
|
3434
|
+
const reactedMsg = await raceWithTimeoutAndAbort(fetchMessage({
|
|
3435
|
+
cfg,
|
|
3436
|
+
messageId,
|
|
3437
|
+
accountId
|
|
3438
|
+
}), { timeoutMs: verificationTimeoutMs }).then((result) => result.status === "resolved" ? result.value : null).catch(() => null);
|
|
3439
|
+
const isBotMessage = reactedMsg?.senderType === "app" || reactedMsg?.senderOpenId === botOpenId;
|
|
3440
|
+
if (!reactedMsg || reactionNotifications === "own" && !isBotMessage) {
|
|
3441
|
+
logger?.(`feishu[${accountId}]: ignoring reaction on non-bot/unverified message ${messageId} (sender: ${reactedMsg?.senderOpenId ?? "unknown"})`);
|
|
3442
|
+
return null;
|
|
3443
|
+
}
|
|
3444
|
+
const fallbackChatType = reactedMsg.chatType;
|
|
3445
|
+
const resolvedChatType = normalizeFeishuChatType(event.chat_type) ?? fallbackChatType;
|
|
3446
|
+
if (!resolvedChatType) {
|
|
3447
|
+
logger?.(`feishu[${accountId}]: skipping reaction ${emoji} on ${messageId} without chat type context`);
|
|
3448
|
+
return null;
|
|
3449
|
+
}
|
|
3450
|
+
const syntheticChatIdRaw = event.chat_id ?? reactedMsg.chatId;
|
|
3451
|
+
const syntheticChatId = syntheticChatIdRaw?.trim() ? syntheticChatIdRaw : `p2p:${senderId}`;
|
|
3452
|
+
const syntheticChatType = resolvedChatType;
|
|
3453
|
+
return {
|
|
3454
|
+
sender: {
|
|
3455
|
+
sender_id: { open_id: senderId },
|
|
3456
|
+
sender_type: "user"
|
|
3457
|
+
},
|
|
3458
|
+
message: {
|
|
3459
|
+
message_id: `${messageId}:reaction:${emoji}:${uuid()}`,
|
|
3460
|
+
chat_id: syntheticChatId,
|
|
3461
|
+
chat_type: syntheticChatType,
|
|
3462
|
+
message_type: "text",
|
|
3463
|
+
content: JSON.stringify({ text: action === "deleted" ? `[removed reaction ${emoji} from message ${messageId}]` : `[reacted with ${emoji} to message ${messageId}]` })
|
|
3464
|
+
}
|
|
3465
|
+
};
|
|
3466
|
+
}
|
|
3467
|
+
function normalizeFeishuChatType(value) {
|
|
3468
|
+
return value === "group" || value === "private" || value === "p2p" ? value : void 0;
|
|
3469
|
+
}
|
|
3470
|
+
function isRecord(value) {
|
|
3471
|
+
return typeof value === "object" && value !== null;
|
|
3472
|
+
}
|
|
3473
|
+
function readString(value) {
|
|
3474
|
+
return typeof value === "string" ? value : void 0;
|
|
3475
|
+
}
|
|
3476
|
+
function readStringOrNumber(value) {
|
|
3477
|
+
return typeof value === "string" || typeof value === "number" ? value : void 0;
|
|
3478
|
+
}
|
|
3479
|
+
function parseFeishuMessageEventPayload(value) {
|
|
3480
|
+
if (!isRecord(value)) return null;
|
|
3481
|
+
const sender = value.sender;
|
|
3482
|
+
const message = value.message;
|
|
3483
|
+
if (!isRecord(sender) || !isRecord(message)) return null;
|
|
3484
|
+
const senderId = sender.sender_id;
|
|
3485
|
+
if (!isRecord(senderId)) return null;
|
|
3486
|
+
const messageId = readString(message.message_id);
|
|
3487
|
+
const chatId = readString(message.chat_id);
|
|
3488
|
+
const chatType = normalizeFeishuChatType(message.chat_type);
|
|
3489
|
+
const messageType = readString(message.message_type);
|
|
3490
|
+
const content = readString(message.content);
|
|
3491
|
+
if (!messageId || !chatId || !chatType || !messageType || !content) return null;
|
|
3492
|
+
return value;
|
|
3493
|
+
}
|
|
3494
|
+
function parseFeishuBotAddedEventPayload(value) {
|
|
3495
|
+
if (!isRecord(value) || !readString(value.chat_id) || !isRecord(value.operator_id)) return null;
|
|
3496
|
+
return value;
|
|
3497
|
+
}
|
|
3498
|
+
function parseFeishuBotRemovedChatId(value) {
|
|
3499
|
+
if (!isRecord(value)) return null;
|
|
3500
|
+
return readString(value.chat_id) ?? null;
|
|
3501
|
+
}
|
|
3502
|
+
function parseFeishuBotMenuEvent(value) {
|
|
3503
|
+
if (!isRecord(value)) return null;
|
|
3504
|
+
const operator = value.operator;
|
|
3505
|
+
if (operator !== void 0 && !isRecord(operator)) return null;
|
|
3506
|
+
return {
|
|
3507
|
+
event_key: readString(value.event_key),
|
|
3508
|
+
timestamp: readStringOrNumber(value.timestamp),
|
|
3509
|
+
operator: operator ? {
|
|
3510
|
+
operator_name: readString(operator.operator_name),
|
|
3511
|
+
operator_id: isRecord(operator.operator_id) ? {
|
|
3512
|
+
open_id: readString(operator.operator_id.open_id),
|
|
3513
|
+
user_id: readString(operator.operator_id.user_id),
|
|
3514
|
+
union_id: readString(operator.operator_id.union_id)
|
|
3515
|
+
} : void 0
|
|
3516
|
+
} : void 0
|
|
3517
|
+
};
|
|
3518
|
+
}
|
|
3519
|
+
function parseFeishuCardActionEventPayload(value) {
|
|
3520
|
+
if (!isRecord(value)) return null;
|
|
3521
|
+
const operator = value.operator;
|
|
3522
|
+
const action = value.action;
|
|
3523
|
+
const context = value.context;
|
|
3524
|
+
if (!isRecord(operator) || !isRecord(action) || !isRecord(context)) return null;
|
|
3525
|
+
const token = readString(value.token);
|
|
3526
|
+
const openId = readString(operator.open_id);
|
|
3527
|
+
const userId = readString(operator.user_id);
|
|
3528
|
+
const unionId = readString(operator.union_id);
|
|
3529
|
+
const tag = readString(action.tag);
|
|
3530
|
+
const actionValue = action.value;
|
|
3531
|
+
const contextOpenId = readString(context.open_id);
|
|
3532
|
+
const contextUserId = readString(context.user_id);
|
|
3533
|
+
const chatId = readString(context.chat_id);
|
|
3534
|
+
if (!token || !openId || !userId || !unionId || !tag || !isRecord(actionValue) || !contextOpenId || !contextUserId || !chatId) return null;
|
|
3535
|
+
return {
|
|
3536
|
+
operator: {
|
|
3537
|
+
open_id: openId,
|
|
3538
|
+
user_id: userId,
|
|
3539
|
+
union_id: unionId
|
|
3540
|
+
},
|
|
3541
|
+
token,
|
|
3542
|
+
action: {
|
|
3543
|
+
value: actionValue,
|
|
3544
|
+
tag
|
|
3545
|
+
},
|
|
3546
|
+
context: {
|
|
3547
|
+
open_id: contextOpenId,
|
|
3548
|
+
user_id: contextUserId,
|
|
3549
|
+
chat_id: chatId
|
|
3550
|
+
}
|
|
3551
|
+
};
|
|
3552
|
+
}
|
|
3553
|
+
/**
|
|
3554
|
+
* Per-chat serial queue that ensures messages from the same chat are processed
|
|
3555
|
+
* in arrival order while allowing different chats to run concurrently.
|
|
3556
|
+
*/
|
|
3557
|
+
function createChatQueue() {
|
|
3558
|
+
const queues = /* @__PURE__ */ new Map();
|
|
3559
|
+
return (chatId, task) => {
|
|
3560
|
+
const next = (queues.get(chatId) ?? Promise.resolve()).then(task, task);
|
|
3561
|
+
queues.set(chatId, next);
|
|
3562
|
+
next.finally(() => {
|
|
3563
|
+
if (queues.get(chatId) === next) queues.delete(chatId);
|
|
3564
|
+
});
|
|
3565
|
+
return next;
|
|
3566
|
+
};
|
|
3567
|
+
}
|
|
3568
|
+
function mergeFeishuDebounceMentions(entries) {
|
|
3569
|
+
const merged = /* @__PURE__ */ new Map();
|
|
3570
|
+
for (const entry of entries) for (const mention of entry.message.mentions ?? []) {
|
|
3571
|
+
const stableId = mention.id.open_id?.trim() || mention.id.user_id?.trim() || mention.id.union_id?.trim();
|
|
3572
|
+
const mentionName = mention.name?.trim();
|
|
3573
|
+
const mentionKey = mention.key?.trim();
|
|
3574
|
+
const fallback = mentionName && mentionKey ? `${mentionName}|${mentionKey}` : mentionName || mentionKey;
|
|
3575
|
+
const key = stableId || fallback;
|
|
3576
|
+
if (!key || merged.has(key)) continue;
|
|
3577
|
+
merged.set(key, mention);
|
|
3578
|
+
}
|
|
3579
|
+
if (merged.size === 0) return;
|
|
3580
|
+
return Array.from(merged.values());
|
|
3581
|
+
}
|
|
3582
|
+
function dedupeFeishuDebounceEntriesByMessageId(entries) {
|
|
3583
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3584
|
+
const deduped = [];
|
|
3585
|
+
for (const entry of entries) {
|
|
3586
|
+
const messageId = entry.message.message_id?.trim();
|
|
3587
|
+
if (!messageId) {
|
|
3588
|
+
deduped.push(entry);
|
|
3589
|
+
continue;
|
|
3590
|
+
}
|
|
3591
|
+
if (seen.has(messageId)) continue;
|
|
3592
|
+
seen.add(messageId);
|
|
3593
|
+
deduped.push(entry);
|
|
3594
|
+
}
|
|
3595
|
+
return deduped;
|
|
3596
|
+
}
|
|
3597
|
+
function resolveFeishuDebounceMentions(params) {
|
|
3598
|
+
const { entries, botOpenId } = params;
|
|
3599
|
+
if (entries.length === 0) return;
|
|
3600
|
+
for (let index = entries.length - 1; index >= 0; index -= 1) {
|
|
3601
|
+
const entry = entries[index];
|
|
3602
|
+
if (isMentionForwardRequest(entry, botOpenId)) return mergeFeishuDebounceMentions([entry]);
|
|
3603
|
+
}
|
|
3604
|
+
const merged = mergeFeishuDebounceMentions(entries);
|
|
3605
|
+
if (!merged) return;
|
|
3606
|
+
const normalizedBotOpenId = botOpenId?.trim();
|
|
3607
|
+
if (!normalizedBotOpenId) return;
|
|
3608
|
+
const botMentions = merged.filter((mention) => mention.id.open_id?.trim() === normalizedBotOpenId);
|
|
3609
|
+
return botMentions.length > 0 ? botMentions : void 0;
|
|
3610
|
+
}
|
|
3611
|
+
function registerEventHandlers(eventDispatcher, context) {
|
|
3612
|
+
const { cfg, accountId, runtime, chatHistories, fireAndForget } = context;
|
|
3613
|
+
const core = getFeishuRuntime();
|
|
3614
|
+
const inboundDebounceMs = core.channel.debounce.resolveInboundDebounceMs({
|
|
3615
|
+
cfg,
|
|
3616
|
+
channel: "feishu"
|
|
3617
|
+
});
|
|
3618
|
+
const log = runtime?.log ?? console.log;
|
|
3619
|
+
const error = runtime?.error ?? console.error;
|
|
3620
|
+
const enqueue = createChatQueue();
|
|
3621
|
+
const runFeishuHandler = async (params) => {
|
|
3622
|
+
if (fireAndForget) {
|
|
3623
|
+
params.task().catch((err) => {
|
|
3624
|
+
error(`${params.errorMessage}: ${String(err)}`);
|
|
3625
|
+
});
|
|
3626
|
+
return;
|
|
3627
|
+
}
|
|
3628
|
+
try {
|
|
3629
|
+
await params.task();
|
|
3630
|
+
} catch (err) {
|
|
3631
|
+
error(`${params.errorMessage}: ${String(err)}`);
|
|
3632
|
+
}
|
|
3633
|
+
};
|
|
3634
|
+
const dispatchFeishuMessage = async (event) => {
|
|
3635
|
+
const chatId = event.message.chat_id?.trim() || "unknown";
|
|
3636
|
+
const task = () => handleFeishuMessage({
|
|
3637
|
+
cfg,
|
|
3638
|
+
event,
|
|
3639
|
+
botOpenId: botOpenIds.get(accountId),
|
|
3640
|
+
botName: botNames.get(accountId),
|
|
3641
|
+
runtime,
|
|
3642
|
+
chatHistories,
|
|
3643
|
+
accountId,
|
|
3644
|
+
processingClaimHeld: true
|
|
3645
|
+
});
|
|
3646
|
+
await enqueue(chatId, task);
|
|
3647
|
+
};
|
|
3648
|
+
const resolveSenderDebounceId = (event) => {
|
|
3649
|
+
return event.sender.sender_id.open_id?.trim() || event.sender.sender_id.user_id?.trim() || void 0;
|
|
3650
|
+
};
|
|
3651
|
+
const resolveDebounceText = (event) => {
|
|
3652
|
+
return parseFeishuMessageEvent(event, botOpenIds.get(accountId), botNames.get(accountId)).content.trim();
|
|
3653
|
+
};
|
|
3654
|
+
const recordSuppressedMessageIds = async (entries, dispatchMessageId) => {
|
|
3655
|
+
const keepMessageId = dispatchMessageId?.trim();
|
|
3656
|
+
const suppressedIds = new Set(entries.map((entry) => entry.message.message_id?.trim()).filter((id) => Boolean(id) && (!keepMessageId || id !== keepMessageId)));
|
|
3657
|
+
if (suppressedIds.size === 0) return;
|
|
3658
|
+
for (const messageId of suppressedIds) try {
|
|
3659
|
+
await recordProcessedFeishuMessage(messageId, accountId, log);
|
|
3660
|
+
} catch (err) {
|
|
3661
|
+
error(`feishu[${accountId}]: failed to record merged dedupe id ${messageId}: ${String(err)}`);
|
|
3662
|
+
}
|
|
3663
|
+
};
|
|
3664
|
+
const isMessageAlreadyProcessed = async (entry) => {
|
|
3665
|
+
return await hasProcessedFeishuMessage(entry.message.message_id, accountId, log);
|
|
3666
|
+
};
|
|
3667
|
+
const inboundDebouncer = core.channel.debounce.createInboundDebouncer({
|
|
3668
|
+
debounceMs: inboundDebounceMs,
|
|
3669
|
+
buildKey: (event) => {
|
|
3670
|
+
const chatId = event.message.chat_id?.trim();
|
|
3671
|
+
const senderId = resolveSenderDebounceId(event);
|
|
3672
|
+
if (!chatId || !senderId) return null;
|
|
3673
|
+
const rootId = event.message.root_id?.trim();
|
|
3674
|
+
return `feishu:${accountId}:${chatId}:${rootId ? `thread:${rootId}` : "chat"}:${senderId}`;
|
|
3675
|
+
},
|
|
3676
|
+
shouldDebounce: (event) => {
|
|
3677
|
+
if (event.message.message_type !== "text") return false;
|
|
3678
|
+
const text = resolveDebounceText(event);
|
|
3679
|
+
if (!text) return false;
|
|
3680
|
+
return !core.channel.text.hasControlCommand(text, cfg);
|
|
3681
|
+
},
|
|
3682
|
+
onFlush: async (entries) => {
|
|
3683
|
+
const last = entries.at(-1);
|
|
3684
|
+
if (!last) return;
|
|
3685
|
+
if (entries.length === 1) {
|
|
3686
|
+
await dispatchFeishuMessage(last);
|
|
3687
|
+
return;
|
|
3688
|
+
}
|
|
3689
|
+
const dedupedEntries = dedupeFeishuDebounceEntriesByMessageId(entries);
|
|
3690
|
+
const freshEntries = [];
|
|
3691
|
+
for (const entry of dedupedEntries) if (!await isMessageAlreadyProcessed(entry)) freshEntries.push(entry);
|
|
3692
|
+
const dispatchEntry = freshEntries.at(-1);
|
|
3693
|
+
if (!dispatchEntry) return;
|
|
3694
|
+
await recordSuppressedMessageIds(dedupedEntries, dispatchEntry.message.message_id);
|
|
3695
|
+
const combinedText = freshEntries.map((entry) => resolveDebounceText(entry)).filter(Boolean).join("\n");
|
|
3696
|
+
const mergedMentions = resolveFeishuDebounceMentions({
|
|
3697
|
+
entries: freshEntries,
|
|
3698
|
+
botOpenId: botOpenIds.get(accountId)
|
|
3699
|
+
});
|
|
3700
|
+
if (!combinedText.trim()) {
|
|
3701
|
+
await dispatchFeishuMessage({
|
|
3702
|
+
...dispatchEntry,
|
|
3703
|
+
message: {
|
|
3704
|
+
...dispatchEntry.message,
|
|
3705
|
+
mentions: mergedMentions ?? dispatchEntry.message.mentions
|
|
3706
|
+
}
|
|
3707
|
+
});
|
|
3708
|
+
return;
|
|
3709
|
+
}
|
|
3710
|
+
await dispatchFeishuMessage({
|
|
3711
|
+
...dispatchEntry,
|
|
3712
|
+
message: {
|
|
3713
|
+
...dispatchEntry.message,
|
|
3714
|
+
message_type: "text",
|
|
3715
|
+
content: JSON.stringify({ text: combinedText }),
|
|
3716
|
+
mentions: mergedMentions ?? dispatchEntry.message.mentions
|
|
3717
|
+
}
|
|
3718
|
+
});
|
|
3719
|
+
},
|
|
3720
|
+
onError: (err, entries) => {
|
|
3721
|
+
for (const entry of entries) releaseFeishuMessageProcessing(entry.message.message_id, accountId);
|
|
3722
|
+
error(`feishu[${accountId}]: inbound debounce flush failed: ${String(err)}`);
|
|
3723
|
+
}
|
|
3724
|
+
});
|
|
3725
|
+
eventDispatcher.register({
|
|
3726
|
+
"im.message.receive_v1": async (data) => {
|
|
3727
|
+
const event = parseFeishuMessageEventPayload(data);
|
|
3728
|
+
if (!event) {
|
|
3729
|
+
error(`feishu[${accountId}]: ignoring malformed message event payload`);
|
|
3730
|
+
return;
|
|
3731
|
+
}
|
|
3732
|
+
const messageId = event.message?.message_id?.trim();
|
|
3733
|
+
if (!tryBeginFeishuMessageProcessing(messageId, accountId)) {
|
|
3734
|
+
log(`feishu[${accountId}]: dropping duplicate event for message ${messageId}`);
|
|
3735
|
+
return;
|
|
3736
|
+
}
|
|
3737
|
+
const processMessage = async () => {
|
|
3738
|
+
await inboundDebouncer.enqueue(event);
|
|
3739
|
+
};
|
|
3740
|
+
if (fireAndForget) {
|
|
3741
|
+
processMessage().catch((err) => {
|
|
3742
|
+
releaseFeishuMessageProcessing(messageId, accountId);
|
|
3743
|
+
error(`feishu[${accountId}]: error handling message: ${String(err)}`);
|
|
3744
|
+
});
|
|
3745
|
+
return;
|
|
3746
|
+
}
|
|
3747
|
+
try {
|
|
3748
|
+
await processMessage();
|
|
3749
|
+
} catch (err) {
|
|
3750
|
+
releaseFeishuMessageProcessing(messageId, accountId);
|
|
3751
|
+
error(`feishu[${accountId}]: error handling message: ${String(err)}`);
|
|
3752
|
+
}
|
|
3753
|
+
},
|
|
3754
|
+
"im.message.message_read_v1": async () => {},
|
|
3755
|
+
"im.chat.member.bot.added_v1": async (data) => {
|
|
3756
|
+
try {
|
|
3757
|
+
const event = parseFeishuBotAddedEventPayload(data);
|
|
3758
|
+
if (!event) return;
|
|
3759
|
+
log(`feishu[${accountId}]: bot added to chat ${event.chat_id}`);
|
|
3760
|
+
} catch (err) {
|
|
3761
|
+
error(`feishu[${accountId}]: error handling bot added event: ${String(err)}`);
|
|
3762
|
+
}
|
|
3763
|
+
},
|
|
3764
|
+
"im.chat.member.bot.deleted_v1": async (data) => {
|
|
3765
|
+
try {
|
|
3766
|
+
const chatId = parseFeishuBotRemovedChatId(data);
|
|
3767
|
+
if (!chatId) return;
|
|
3768
|
+
log(`feishu[${accountId}]: bot removed from chat ${chatId}`);
|
|
3769
|
+
} catch (err) {
|
|
3770
|
+
error(`feishu[${accountId}]: error handling bot removed event: ${String(err)}`);
|
|
3771
|
+
}
|
|
3772
|
+
},
|
|
3773
|
+
"drive.notice.comment_add_v1": async (data) => {
|
|
3774
|
+
await runFeishuHandler({
|
|
3775
|
+
errorMessage: `feishu[${accountId}]: error handling drive comment notice`,
|
|
3776
|
+
task: async () => {
|
|
3777
|
+
const event = parseFeishuDriveCommentNoticeEventPayload(data);
|
|
3778
|
+
if (!event) {
|
|
3779
|
+
error(`feishu[${accountId}]: ignoring malformed drive comment notice payload`);
|
|
3780
|
+
return;
|
|
3781
|
+
}
|
|
3782
|
+
const eventId = event.event_id?.trim();
|
|
3783
|
+
const syntheticMessageId = eventId ? `drive-comment:${eventId}` : void 0;
|
|
3784
|
+
if (syntheticMessageId && await hasProcessedFeishuMessage(syntheticMessageId, accountId, log)) {
|
|
3785
|
+
log(`feishu[${accountId}]: dropping duplicate comment event ${syntheticMessageId}`);
|
|
3786
|
+
return;
|
|
3787
|
+
}
|
|
3788
|
+
if (syntheticMessageId && !tryBeginFeishuMessageProcessing(syntheticMessageId, accountId)) {
|
|
3789
|
+
log(`feishu[${accountId}]: dropping in-flight comment event ${syntheticMessageId}`);
|
|
3790
|
+
return;
|
|
3791
|
+
}
|
|
3792
|
+
log(`feishu[${accountId}]: received drive comment notice event=${event.event_id ?? "unknown"} type=${event.notice_meta?.notice_type ?? "unknown"} file=${event.notice_meta?.file_type ?? "unknown"}:${event.notice_meta?.file_token ?? "unknown"} comment=${event.comment_id ?? "unknown"} reply=${event.reply_id ?? "none"} from=${event.notice_meta?.from_user_id?.open_id ?? "unknown"} mentioned=${event.is_mentioned === true ? "yes" : "no"}`);
|
|
3793
|
+
try {
|
|
3794
|
+
await handleFeishuCommentEvent({
|
|
3795
|
+
cfg,
|
|
3796
|
+
accountId,
|
|
3797
|
+
event,
|
|
3798
|
+
botOpenId: botOpenIds.get(accountId),
|
|
3799
|
+
runtime
|
|
3800
|
+
});
|
|
3801
|
+
if (syntheticMessageId) await recordProcessedFeishuMessage(syntheticMessageId, accountId, log);
|
|
3802
|
+
} finally {
|
|
3803
|
+
if (syntheticMessageId) releaseFeishuMessageProcessing(syntheticMessageId, accountId);
|
|
3804
|
+
}
|
|
3805
|
+
}
|
|
3806
|
+
});
|
|
3807
|
+
},
|
|
3808
|
+
"im.message.reaction.created_v1": async (data) => {
|
|
3809
|
+
await runFeishuHandler({
|
|
3810
|
+
errorMessage: `feishu[${accountId}]: error handling reaction event`,
|
|
3811
|
+
task: async () => {
|
|
3812
|
+
const event = data;
|
|
3813
|
+
const myBotId = botOpenIds.get(accountId);
|
|
3814
|
+
const syntheticEvent = await resolveReactionSyntheticEvent({
|
|
3815
|
+
cfg,
|
|
3816
|
+
accountId,
|
|
3817
|
+
event,
|
|
3818
|
+
botOpenId: myBotId,
|
|
3819
|
+
logger: log
|
|
3820
|
+
});
|
|
3821
|
+
if (!syntheticEvent) return;
|
|
3822
|
+
await handleFeishuMessage({
|
|
3823
|
+
cfg,
|
|
3824
|
+
event: syntheticEvent,
|
|
3825
|
+
botOpenId: myBotId,
|
|
3826
|
+
botName: botNames.get(accountId),
|
|
3827
|
+
runtime,
|
|
3828
|
+
chatHistories,
|
|
3829
|
+
accountId
|
|
3830
|
+
});
|
|
3831
|
+
}
|
|
3832
|
+
});
|
|
3833
|
+
},
|
|
3834
|
+
"im.message.reaction.deleted_v1": async (data) => {
|
|
3835
|
+
await runFeishuHandler({
|
|
3836
|
+
errorMessage: `feishu[${accountId}]: error handling reaction removal event`,
|
|
3837
|
+
task: async () => {
|
|
3838
|
+
const event = data;
|
|
3839
|
+
const myBotId = botOpenIds.get(accountId);
|
|
3840
|
+
const syntheticEvent = await resolveReactionSyntheticEvent({
|
|
3841
|
+
cfg,
|
|
3842
|
+
accountId,
|
|
3843
|
+
event,
|
|
3844
|
+
botOpenId: myBotId,
|
|
3845
|
+
logger: log,
|
|
3846
|
+
action: "deleted"
|
|
3847
|
+
});
|
|
3848
|
+
if (!syntheticEvent) return;
|
|
3849
|
+
await handleFeishuMessage({
|
|
3850
|
+
cfg,
|
|
3851
|
+
event: syntheticEvent,
|
|
3852
|
+
botOpenId: myBotId,
|
|
3853
|
+
botName: botNames.get(accountId),
|
|
3854
|
+
runtime,
|
|
3855
|
+
chatHistories,
|
|
3856
|
+
accountId
|
|
3857
|
+
});
|
|
3858
|
+
}
|
|
3859
|
+
});
|
|
3860
|
+
},
|
|
3861
|
+
"application.bot.menu_v6": async (data) => {
|
|
3862
|
+
try {
|
|
3863
|
+
const event = parseFeishuBotMenuEvent(data);
|
|
3864
|
+
if (!event) return;
|
|
3865
|
+
const operatorOpenId = event.operator?.operator_id?.open_id?.trim();
|
|
3866
|
+
const eventKey = event.event_key?.trim();
|
|
3867
|
+
if (!operatorOpenId || !eventKey) return;
|
|
3868
|
+
const syntheticEvent = {
|
|
3869
|
+
sender: {
|
|
3870
|
+
sender_id: {
|
|
3871
|
+
open_id: operatorOpenId,
|
|
3872
|
+
user_id: event.operator?.operator_id?.user_id,
|
|
3873
|
+
union_id: event.operator?.operator_id?.union_id
|
|
3874
|
+
},
|
|
3875
|
+
sender_type: "user"
|
|
3876
|
+
},
|
|
3877
|
+
message: {
|
|
3878
|
+
message_id: `bot-menu:${eventKey}:${event.timestamp ?? Date.now()}`,
|
|
3879
|
+
chat_id: `p2p:${operatorOpenId}`,
|
|
3880
|
+
chat_type: "p2p",
|
|
3881
|
+
message_type: "text",
|
|
3882
|
+
content: JSON.stringify({ text: `/menu ${eventKey}` })
|
|
3883
|
+
}
|
|
3884
|
+
};
|
|
3885
|
+
const syntheticMessageId = syntheticEvent.message.message_id;
|
|
3886
|
+
if (await hasProcessedFeishuMessage(syntheticMessageId, accountId, log)) {
|
|
3887
|
+
log(`feishu[${accountId}]: dropping duplicate bot-menu event for ${syntheticMessageId}`);
|
|
3888
|
+
return;
|
|
3889
|
+
}
|
|
3890
|
+
if (!tryBeginFeishuMessageProcessing(syntheticMessageId, accountId)) {
|
|
3891
|
+
log(`feishu[${accountId}]: dropping in-flight bot-menu event for ${syntheticMessageId}`);
|
|
3892
|
+
return;
|
|
3893
|
+
}
|
|
3894
|
+
const handleLegacyMenu = () => handleFeishuMessage({
|
|
3895
|
+
cfg,
|
|
3896
|
+
event: syntheticEvent,
|
|
3897
|
+
botOpenId: botOpenIds.get(accountId),
|
|
3898
|
+
botName: botNames.get(accountId),
|
|
3899
|
+
runtime,
|
|
3900
|
+
chatHistories,
|
|
3901
|
+
accountId,
|
|
3902
|
+
processingClaimHeld: true
|
|
3903
|
+
});
|
|
3904
|
+
const promise = maybeHandleFeishuQuickActionMenu({
|
|
3905
|
+
cfg,
|
|
3906
|
+
eventKey,
|
|
3907
|
+
operatorOpenId,
|
|
3908
|
+
runtime,
|
|
3909
|
+
accountId
|
|
3910
|
+
}).then(async (handledMenu) => {
|
|
3911
|
+
if (handledMenu) {
|
|
3912
|
+
await recordProcessedFeishuMessage(syntheticMessageId, accountId, log);
|
|
3913
|
+
releaseFeishuMessageProcessing(syntheticMessageId, accountId);
|
|
3914
|
+
return;
|
|
3915
|
+
}
|
|
3916
|
+
return await handleLegacyMenu();
|
|
3917
|
+
}).catch((err) => {
|
|
3918
|
+
releaseFeishuMessageProcessing(syntheticMessageId, accountId);
|
|
3919
|
+
throw err;
|
|
3920
|
+
});
|
|
3921
|
+
if (fireAndForget) {
|
|
3922
|
+
promise.catch((err) => {
|
|
3923
|
+
error(`feishu[${accountId}]: error handling bot menu event: ${String(err)}`);
|
|
3924
|
+
});
|
|
3925
|
+
return;
|
|
3926
|
+
}
|
|
3927
|
+
await promise;
|
|
3928
|
+
} catch (err) {
|
|
3929
|
+
error(`feishu[${accountId}]: error handling bot menu event: ${String(err)}`);
|
|
3930
|
+
}
|
|
3931
|
+
},
|
|
3932
|
+
"card.action.trigger": async (data) => {
|
|
3933
|
+
try {
|
|
3934
|
+
const event = parseFeishuCardActionEventPayload(data);
|
|
3935
|
+
if (!event) {
|
|
3936
|
+
error(`feishu[${accountId}]: ignoring malformed card action payload`);
|
|
3937
|
+
return;
|
|
3938
|
+
}
|
|
3939
|
+
const promise = handleFeishuCardAction({
|
|
3940
|
+
cfg,
|
|
3941
|
+
event,
|
|
3942
|
+
botOpenId: botOpenIds.get(accountId),
|
|
3943
|
+
runtime,
|
|
3944
|
+
accountId
|
|
3945
|
+
});
|
|
3946
|
+
if (fireAndForget) promise.catch((err) => {
|
|
3947
|
+
error(`feishu[${accountId}]: error handling card action: ${String(err)}`);
|
|
3948
|
+
});
|
|
3949
|
+
else await promise;
|
|
3950
|
+
} catch (err) {
|
|
3951
|
+
error(`feishu[${accountId}]: error handling card action: ${String(err)}`);
|
|
3952
|
+
}
|
|
3953
|
+
}
|
|
3954
|
+
});
|
|
3955
|
+
}
|
|
3956
|
+
async function monitorSingleAccount(params) {
|
|
3957
|
+
const { cfg, account, runtime, abortSignal } = params;
|
|
3958
|
+
const { accountId } = account;
|
|
3959
|
+
const log = runtime?.log ?? console.log;
|
|
3960
|
+
const botOpenIdSource = params.botOpenIdSource ?? { kind: "fetch" };
|
|
3961
|
+
const { botOpenId } = applyBotIdentityState(accountId, botOpenIdSource.kind === "prefetched" ? {
|
|
3962
|
+
botOpenId: botOpenIdSource.botOpenId,
|
|
3963
|
+
botName: botOpenIdSource.botName
|
|
3964
|
+
} : await fetchBotIdentityForMonitor(account, {
|
|
3965
|
+
runtime,
|
|
3966
|
+
abortSignal
|
|
3967
|
+
}));
|
|
3968
|
+
log(`feishu[${accountId}]: bot open_id resolved: ${botOpenId ?? "unknown"}`);
|
|
3969
|
+
if (!botOpenId && !abortSignal?.aborted) startBotIdentityRecovery({
|
|
3970
|
+
account,
|
|
3971
|
+
accountId,
|
|
3972
|
+
runtime,
|
|
3973
|
+
abortSignal
|
|
3974
|
+
});
|
|
3975
|
+
const connectionMode = account.config.connectionMode ?? "websocket";
|
|
3976
|
+
if (connectionMode === "webhook" && !account.verificationToken?.trim()) throw new Error(`Feishu account "${accountId}" webhook mode requires verificationToken`);
|
|
3977
|
+
if (connectionMode === "webhook" && !account.encryptKey?.trim()) throw new Error(`Feishu account "${accountId}" webhook mode requires encryptKey`);
|
|
3978
|
+
const warmupCount = await warmupDedupFromDisk(accountId, log);
|
|
3979
|
+
if (warmupCount > 0) log(`feishu[${accountId}]: dedup warmup loaded ${warmupCount} entries from disk`);
|
|
3980
|
+
let threadBindingManager = null;
|
|
3981
|
+
try {
|
|
3982
|
+
const eventDispatcher = createEventDispatcher(account);
|
|
3983
|
+
const chatHistories = /* @__PURE__ */ new Map();
|
|
3984
|
+
threadBindingManager = createFeishuThreadBindingManager({
|
|
3985
|
+
accountId,
|
|
3986
|
+
cfg
|
|
3987
|
+
});
|
|
3988
|
+
registerEventHandlers(eventDispatcher, {
|
|
3989
|
+
cfg,
|
|
3990
|
+
accountId,
|
|
3991
|
+
runtime,
|
|
3992
|
+
chatHistories,
|
|
3993
|
+
fireAndForget: true
|
|
3994
|
+
});
|
|
3995
|
+
if (connectionMode === "webhook") return await monitorWebhook({
|
|
3996
|
+
account,
|
|
3997
|
+
accountId,
|
|
3998
|
+
runtime,
|
|
3999
|
+
abortSignal,
|
|
4000
|
+
eventDispatcher
|
|
4001
|
+
});
|
|
4002
|
+
return await monitorWebSocket({
|
|
4003
|
+
account,
|
|
4004
|
+
accountId,
|
|
4005
|
+
runtime,
|
|
4006
|
+
abortSignal,
|
|
4007
|
+
eventDispatcher
|
|
4008
|
+
});
|
|
4009
|
+
} finally {
|
|
4010
|
+
threadBindingManager?.stop();
|
|
4011
|
+
}
|
|
4012
|
+
}
|
|
4013
|
+
//#endregion
|
|
4014
|
+
//#region extensions/feishu/src/monitor.ts
|
|
4015
|
+
async function monitorFeishuProvider(opts = {}) {
|
|
4016
|
+
const cfg = opts.config;
|
|
4017
|
+
if (!cfg) throw new Error("Config is required for Feishu monitor");
|
|
4018
|
+
const log = opts.runtime?.log ?? console.log;
|
|
4019
|
+
if (opts.accountId) {
|
|
4020
|
+
const account = resolveFeishuRuntimeAccount({
|
|
4021
|
+
cfg,
|
|
4022
|
+
accountId: opts.accountId
|
|
4023
|
+
}, { requireEventSecrets: true });
|
|
4024
|
+
if (!account.enabled || !account.configured) throw new Error(`Feishu account "${opts.accountId}" not configured or disabled`);
|
|
4025
|
+
return monitorSingleAccount({
|
|
4026
|
+
cfg,
|
|
4027
|
+
account,
|
|
4028
|
+
runtime: opts.runtime,
|
|
4029
|
+
abortSignal: opts.abortSignal
|
|
4030
|
+
});
|
|
4031
|
+
}
|
|
4032
|
+
const accounts = listEnabledFeishuAccounts(cfg);
|
|
4033
|
+
if (accounts.length === 0) throw new Error("No enabled Feishu accounts configured");
|
|
4034
|
+
log(`feishu: starting ${accounts.length} account(s): ${accounts.map((a) => a.accountId).join(", ")}`);
|
|
4035
|
+
const monitorPromises = [];
|
|
4036
|
+
for (const account of accounts) {
|
|
4037
|
+
if (opts.abortSignal?.aborted) {
|
|
4038
|
+
log("feishu: abort signal received during startup preflight; stopping startup");
|
|
4039
|
+
break;
|
|
4040
|
+
}
|
|
4041
|
+
const { botOpenId, botName } = await fetchBotIdentityForMonitor(account, {
|
|
4042
|
+
runtime: opts.runtime,
|
|
4043
|
+
abortSignal: opts.abortSignal
|
|
4044
|
+
});
|
|
4045
|
+
if (opts.abortSignal?.aborted) {
|
|
4046
|
+
log("feishu: abort signal received during startup preflight; stopping startup");
|
|
4047
|
+
break;
|
|
4048
|
+
}
|
|
4049
|
+
monitorPromises.push(monitorSingleAccount({
|
|
4050
|
+
cfg,
|
|
4051
|
+
account,
|
|
4052
|
+
runtime: opts.runtime,
|
|
4053
|
+
abortSignal: opts.abortSignal,
|
|
4054
|
+
botOpenIdSource: {
|
|
4055
|
+
kind: "prefetched",
|
|
4056
|
+
botOpenId,
|
|
4057
|
+
botName
|
|
4058
|
+
}
|
|
4059
|
+
}));
|
|
4060
|
+
}
|
|
4061
|
+
await Promise.all(monitorPromises);
|
|
4062
|
+
}
|
|
4063
|
+
function stopFeishuMonitor(accountId) {
|
|
4064
|
+
stopFeishuMonitorState(accountId);
|
|
4065
|
+
}
|
|
4066
|
+
//#endregion
|
|
4067
|
+
export { clearFeishuWebhookRateLimitStateForTest, getFeishuWebhookRateLimitStateSizeForTest, isWebhookRateLimitedForTest, monitorFeishuProvider, resolveReactionSyntheticEvent, stopFeishuMonitor };
|