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,4268 @@
|
|
|
1
|
+
import { i as formatUncaughtError } from "./errors-Bs2h5H8p.js";
|
|
2
|
+
import { i as getChildLogger } from "./logger-MWEZrHUL.js";
|
|
3
|
+
import { t as createNonExitingRuntime } from "./runtime-kS8e4c6-.js";
|
|
4
|
+
import { t as createSubsystemLogger } from "./subsystem-C9VSlEcV.js";
|
|
5
|
+
import { g as resolveDefaultModelForAgent } from "./model-selection-w1RJdjfl.js";
|
|
6
|
+
import { _ as resolveStateDir } from "./paths-GWMNxnBn.js";
|
|
7
|
+
import { _ as normalizeAccountId, d as resolveThreadSessionKeys } from "./session-key-Do__tq1E.js";
|
|
8
|
+
import { a as shouldLogVerbose, r as logVerbose, s as warn, t as danger } from "./globals-CDtV0ht8.js";
|
|
9
|
+
import { a as resolveAgentDir, m as resolveDefaultAgentId } from "./agent-scope-rWWUivuC.js";
|
|
10
|
+
import { c as loadConfig, o as getRuntimeConfigSnapshot, x as writeConfigFile } from "./io-8kNEV_ou.js";
|
|
11
|
+
import { i as resolveTelegramCustomCommands, r as normalizeTelegramCommandName, t as TELEGRAM_COMMAND_NAME_PATTERN } from "./telegram-custom-commands-C-nv8yoB.js";
|
|
12
|
+
import { c as resolveSessionStoreEntry, d as updateSessionStore, i as loadSessionStore } from "./store-DJaTq2_f.js";
|
|
13
|
+
import { l as resolveStorePath } from "./paths-BJziUb2E.js";
|
|
14
|
+
import { a as resolveNativeSkillsEnabled, i as resolveNativeCommandsEnabled, n as isNativeCommandsExplicitlyDisabled } from "./commands-DBiogh0E.js";
|
|
15
|
+
import { m as dispatchPluginInteractiveHandler, v as getPluginCommandSpecs } from "./types-CAIybprP.js";
|
|
16
|
+
import { t as createDedupeCache } from "./dedupe-Bc4PYKgL.js";
|
|
17
|
+
import { f as parsePluginBindingApprovalCustomId, i as buildPluginBindingResolvedText, m as resolvePluginConversationBindingApproval } from "./conversation-binding-C9dt9f8n.js";
|
|
18
|
+
import { $ as buildCommandsMessagePaginated } from "./pi-embedded-T_JLa73v.js";
|
|
19
|
+
import { T as resolveExecApprovalRequestAllowedDecisions } from "./exec-approvals-iwcnYHar.js";
|
|
20
|
+
import { r as enqueueSystemEvent } from "./system-events-Di7LVrMk.js";
|
|
21
|
+
import { a as buildExecApprovalPendingReplyPayload, u as parseExecApprovalCommandText } from "./exec-approval-reply-CnW2WZof.js";
|
|
22
|
+
import { p as resolveSendableOutboundReplyParts } from "./reply-payload-DPD7eb4b.js";
|
|
23
|
+
import { c as resolveTextChunkLimit, s as resolveChunkMode } from "./chunk-qF6XcBVp.js";
|
|
24
|
+
import { r as getAgentScopedMediaLocalRoots } from "./local-roots-DaJ_5SJs.js";
|
|
25
|
+
import { _ as resolveChannelConfigWrites } from "./channel-config-helpers-CDrwTLrh.js";
|
|
26
|
+
import { _ as formatReasoningMessage } from "./minimax-vlm-BDKu6hqL.js";
|
|
27
|
+
import { n as findCodeRegions, r as isInsideCode, t as stripReasoningTagsFromText } from "./reasoning-tags-BJIyhv7E.js";
|
|
28
|
+
import { t as MediaFetchError } from "./fetch-7TnqHJNY.js";
|
|
29
|
+
import { t as loadWebMedia } from "./web-media-CDBfT8E2.js";
|
|
30
|
+
import { i as loadModelCatalog, n as findModelInCatalog, o as modelSupportsVision } from "./model-catalog-sx4GaLTc.js";
|
|
31
|
+
import { i as resolveAgentRoute } from "./resolve-route-BxAbY_hl.js";
|
|
32
|
+
import { n as sleepWithAbort, t as computeBackoff } from "./backoff-Y3d8DA-r.js";
|
|
33
|
+
import { d as listNativeCommandSpecsForConfig, g as resolveCommandArgMenu, m as parseCommandArgs, n as buildCommandTextFromArgs, r as findCommandByNativeName, u as listNativeCommandSpecs } from "./commands-registry-Dyv8XTRB.js";
|
|
34
|
+
import { t as applyModelOverrideToSessionEntry } from "./model-overrides-CbljEHPO.js";
|
|
35
|
+
import { c as resolveThreadBindingIdleTimeoutMsForChannel, d as resolveThreadBindingMaxAgeMsForChannel, p as resolveThreadBindingSpawnPolicy } from "./thread-bindings-policy-BlyUVG6S.js";
|
|
36
|
+
import { n as resolveChannelGroupRequireMention, t as resolveChannelGroupPolicy } from "./group-policy-BY9nSFJ6.js";
|
|
37
|
+
import "./core-_nKe7lGV.js";
|
|
38
|
+
import "./routing-BKQZI-Y4.js";
|
|
39
|
+
import { n as isAbortRequestText } from "./abort-primitives-CoECHfZc.js";
|
|
40
|
+
import { n as resolveInboundDebounceMs, t as createInboundDebouncer } from "./inbound-debounce-YEtyt_k_.js";
|
|
41
|
+
import { t as dispatchReplyWithBufferedBlockDispatcher } from "./provider-dispatcher-BEZOvNvI.js";
|
|
42
|
+
import { t as removeAckReactionAfterReply } from "./ack-reactions-BZ-o06GS.js";
|
|
43
|
+
import { t as resolveCommandAuthorizedFromAuthorizers } from "./command-gating-HO-bVa6h.js";
|
|
44
|
+
import { t as resolveMarkdownTableMode } from "./markdown-tables-BUWco8M1.js";
|
|
45
|
+
import { a as readChannelAllowFromStore, d as upsertChannelPairingRequest } from "./pairing-store-BZr880dY.js";
|
|
46
|
+
import { t as resolveCommandAuthorization } from "./command-auth-BAiTM8wj.js";
|
|
47
|
+
import { i as resolveStoredModelOverride } from "./model-selection-rJYfkbE0.js";
|
|
48
|
+
import { s as clearHistoryEntriesIfEnabled } from "./history-UDByIZZ1.js";
|
|
49
|
+
import "./reply-history-UL04gA_Z.js";
|
|
50
|
+
import "./runtime-env-Gi8zIuHa.js";
|
|
51
|
+
import { o as resolveExecApprovalCommandDisplay } from "./exec-approval-session-target-Ci45mXNL.js";
|
|
52
|
+
import "./approval-runtime-B6PXavdQ.js";
|
|
53
|
+
import { r as buildPluginApprovalPendingReplyPayload } from "./approval-renderers-DV32j7l9.js";
|
|
54
|
+
import { t as createChannelNativeApprovalRuntime } from "./approval-native-runtime-Bw_-auoy.js";
|
|
55
|
+
import { t as createOperatorApprovalsGatewayClient } from "./operator-approvals-client-CKNBQMzI.js";
|
|
56
|
+
import "./config-runtime-D208l2BL.js";
|
|
57
|
+
import { n as isBtwRequestText } from "./btw-command-a7GDEcBZ.js";
|
|
58
|
+
import { n as resolveAutoTopicLabelConfig, t as generateTopicLabel } from "./reply-runtime-CvaF7P6-.js";
|
|
59
|
+
import "./reply-dispatch-runtime-DxUm7xv8.js";
|
|
60
|
+
import "./reply-chunking-nY356hXd.js";
|
|
61
|
+
import { t as createChannelReplyPipeline } from "./channel-reply-pipeline-Dyh1zCi9.js";
|
|
62
|
+
import "./channel-runtime-DLANIaFl.js";
|
|
63
|
+
import "./infra-runtime-C9fJenAY.js";
|
|
64
|
+
import "./runtime-config-snapshot-CxSWoWK1.js";
|
|
65
|
+
import "./media-runtime-QMgMQ3WZ.js";
|
|
66
|
+
import "./conversation-runtime-DvoDx5Lp.js";
|
|
67
|
+
import "./text-runtime-UxAYZSfy.js";
|
|
68
|
+
import "./agent-runtime-Cm6WYH1X.js";
|
|
69
|
+
import "./plugin-runtime-CE3WN5Ec.js";
|
|
70
|
+
import "./gateway-runtime-C3cNR3CI.js";
|
|
71
|
+
import "./web-media-B5nBRcQh.js";
|
|
72
|
+
import { r as logTypingFailure, t as logAckFailure } from "./logging-DIucOhk1.js";
|
|
73
|
+
import { n as shouldDebounceTextInbound } from "./channel-inbound-BbIwjinv.js";
|
|
74
|
+
import { t as resolveNativeCommandSessionTargets } from "./native-command-session-targets-oTjRWnvo.js";
|
|
75
|
+
import { t as listSkillCommandsForAgents } from "./skill-commands-BG9LO4Bn.js";
|
|
76
|
+
import { t as buildCommandsPaginationKeyboard } from "./commands-info-CSt3aoRZ.js";
|
|
77
|
+
import { n as formatModelsAvailableHeader, t as buildModelsProviderData } from "./commands-models-FgUB1hGv.js";
|
|
78
|
+
import "./command-auth-BoH1IkmW.js";
|
|
79
|
+
import "./markdown-table-runtime-CaSJnE6P.js";
|
|
80
|
+
import "./command-auth-native-Chh7EhCj.js";
|
|
81
|
+
import "./error-runtime-CXqo4HDL.js";
|
|
82
|
+
import { i as createFinalizableDraftLifecycle } from "./channel-lifecycle-CobgWzsY.js";
|
|
83
|
+
import "./state-paths-COT2PUaZ.js";
|
|
84
|
+
import "./models-provider-runtime-C0oxGm-e.js";
|
|
85
|
+
import "./skill-commands-runtime-CkBcqGUZ.js";
|
|
86
|
+
import { s as resolveTelegramAccount } from "./accounts-CkhyYlS6.js";
|
|
87
|
+
import { r as resolveTelegramTransport } from "./fetch-D4lSNBEw.js";
|
|
88
|
+
import { a as isTelegramExecApprovalHandlerConfigured, f as shouldSuppressLocalTelegramExecApprovalPrompt, h as resolveTelegramInlineButtonsScope, l as shouldEnableTelegramExecApprovalButtons, n as isTelegramExecApprovalApprover, r as isTelegramExecApprovalAuthorizedSender, u as shouldHandleTelegramExecApprovalRequest } from "./exec-approvals-D9wFcLn9.js";
|
|
89
|
+
import { n as telegramNativeApprovalAdapter } from "./approval-native-B4HJRa55.js";
|
|
90
|
+
import { C as resolveTelegramThreadSpec, E as buildSenderName, L as isSenderAllowed, P as normalizeTelegramReplyToMessageId, S as resolveTelegramStreamMode, b as resolveTelegramGroupAllowFromContext, d as buildTelegramParentPeer, f as buildTelegramRoutingTarget, g as extractTelegramForumFlag, i as renderTelegramHtmlText, k as getTelegramTextParts, l as buildTelegramGroupFrom, p as buildTelegramThreadParams, s as withTelegramApiErrorLogging, u as buildTelegramGroupPeerId, v as resolveTelegramForumFlag, w as withResolvedTelegramForumFlag, y as resolveTelegramForumThreadId, z as normalizeDmAllowFromWithStore } from "./format-BN8tV56q.js";
|
|
91
|
+
import { t as resolveTelegramInlineButtons } from "./button-types-z3AImy4H.js";
|
|
92
|
+
import { C as wasSentByBot, E as isTelegramClientRejection, O as tagTelegramNetworkError, S as recordSentMessage, T as isSafeToRetrySendError, d as editMessageReplyMarkupTelegram, f as editMessageTelegram, g as sendMessageTelegram, n as describeStickerImage, s as buildInlineKeyboard, t as cacheSticker, w as isRecoverableTelegramNetworkError, y as sendTypingTelegram } from "./sticker-cache-BN_g5-an.js";
|
|
93
|
+
import { t as createTelegramThreadBindingManager } from "./thread-bindings-B0ugWuKq.js";
|
|
94
|
+
import { a as calculateTotalPages, c as resolveModelSelection, i as buildProviderKeyboard, o as getModelsPageSize, r as buildModelsKeyboard, s as parseModelCallbackData } from "./model-buttons-BLt7TaIX.js";
|
|
95
|
+
import { n as evaluateTelegramGroupPolicyAccess, t as evaluateTelegramGroupBaseAccess } from "./group-access-DHoGAQFt.js";
|
|
96
|
+
import { a as resolveTelegramGroupPromptSettings, i as resolveTelegramConversationRoute, n as enforceTelegramDmAccess, r as resolveTelegramConversationBaseSessionKey, t as buildTelegramMessageContext } from "./bot-message-context-SFoFcMU0.js";
|
|
97
|
+
import { n as deliverReplies, r as emitInternalMessageSentHook, t as resolveMedia } from "./delivery-D8E92dmQ.js";
|
|
98
|
+
import path from "node:path";
|
|
99
|
+
import os from "node:os";
|
|
100
|
+
import fs from "node:fs/promises";
|
|
101
|
+
import { createHash } from "node:crypto";
|
|
102
|
+
import { Bot as Bot$1 } from "grammy";
|
|
103
|
+
import { sequentialize } from "@grammyjs/runner";
|
|
104
|
+
import { apiThrottler } from "@grammyjs/transformer-throttler";
|
|
105
|
+
//#region extensions/telegram/src/exec-approvals-handler.ts
|
|
106
|
+
const log = createSubsystemLogger("telegram/exec-approvals");
|
|
107
|
+
function isHandlerConfigured(params) {
|
|
108
|
+
return isTelegramExecApprovalHandlerConfigured(params);
|
|
109
|
+
}
|
|
110
|
+
var TelegramExecApprovalHandler = class {
|
|
111
|
+
constructor(opts, deps = {}) {
|
|
112
|
+
this.opts = opts;
|
|
113
|
+
this.nowMs = deps.nowMs ?? Date.now;
|
|
114
|
+
this.sendTyping = deps.sendTyping ?? sendTypingTelegram;
|
|
115
|
+
this.sendMessage = deps.sendMessage ?? sendMessageTelegram;
|
|
116
|
+
this.editReplyMarkup = deps.editReplyMarkup ?? editMessageReplyMarkupTelegram;
|
|
117
|
+
this.runtime = createChannelNativeApprovalRuntime({
|
|
118
|
+
label: "telegram/exec-approvals",
|
|
119
|
+
clientDisplayName: `Telegram Exec Approvals (${this.opts.accountId})`,
|
|
120
|
+
cfg: this.opts.cfg,
|
|
121
|
+
accountId: this.opts.accountId,
|
|
122
|
+
gatewayUrl: this.opts.gatewayUrl,
|
|
123
|
+
eventKinds: ["exec", "plugin"],
|
|
124
|
+
nowMs: this.nowMs,
|
|
125
|
+
nativeAdapter: telegramNativeApprovalAdapter.native,
|
|
126
|
+
isConfigured: () => isHandlerConfigured({
|
|
127
|
+
cfg: this.opts.cfg,
|
|
128
|
+
accountId: this.opts.accountId
|
|
129
|
+
}),
|
|
130
|
+
shouldHandle: (request) => shouldHandleTelegramExecApprovalRequest({
|
|
131
|
+
cfg: this.opts.cfg,
|
|
132
|
+
accountId: this.opts.accountId,
|
|
133
|
+
request
|
|
134
|
+
}),
|
|
135
|
+
buildPendingContent: ({ request, approvalKind, nowMs }) => {
|
|
136
|
+
const payload = approvalKind === "plugin" ? buildPluginApprovalPendingReplyPayload({
|
|
137
|
+
request,
|
|
138
|
+
nowMs
|
|
139
|
+
}) : buildExecApprovalPendingReplyPayload({
|
|
140
|
+
approvalId: request.id,
|
|
141
|
+
approvalSlug: request.id.slice(0, 8),
|
|
142
|
+
approvalCommandId: request.id,
|
|
143
|
+
command: resolveExecApprovalCommandDisplay(request.request).commandText,
|
|
144
|
+
cwd: request.request.cwd ?? void 0,
|
|
145
|
+
host: request.request.host === "node" ? "node" : "gateway",
|
|
146
|
+
nodeId: request.request.nodeId ?? void 0,
|
|
147
|
+
allowedDecisions: resolveExecApprovalRequestAllowedDecisions(request.request),
|
|
148
|
+
expiresAtMs: request.expiresAtMs,
|
|
149
|
+
nowMs
|
|
150
|
+
});
|
|
151
|
+
return {
|
|
152
|
+
text: payload.text ?? "",
|
|
153
|
+
buttons: resolveTelegramInlineButtons({ interactive: payload.interactive })
|
|
154
|
+
};
|
|
155
|
+
},
|
|
156
|
+
prepareTarget: ({ plannedTarget }) => ({
|
|
157
|
+
dedupeKey: `${plannedTarget.target.to}:${plannedTarget.target.threadId == null ? "" : String(plannedTarget.target.threadId)}`,
|
|
158
|
+
target: {
|
|
159
|
+
chatId: plannedTarget.target.to,
|
|
160
|
+
messageThreadId: typeof plannedTarget.target.threadId === "number" ? plannedTarget.target.threadId : void 0
|
|
161
|
+
}
|
|
162
|
+
}),
|
|
163
|
+
deliverTarget: async ({ preparedTarget, pendingContent }) => {
|
|
164
|
+
await this.sendTyping(preparedTarget.chatId, {
|
|
165
|
+
cfg: this.opts.cfg,
|
|
166
|
+
token: this.opts.token,
|
|
167
|
+
accountId: this.opts.accountId,
|
|
168
|
+
...preparedTarget.messageThreadId != null ? { messageThreadId: preparedTarget.messageThreadId } : {}
|
|
169
|
+
}).catch(() => {});
|
|
170
|
+
const result = await this.sendMessage(preparedTarget.chatId, pendingContent.text, {
|
|
171
|
+
cfg: this.opts.cfg,
|
|
172
|
+
token: this.opts.token,
|
|
173
|
+
accountId: this.opts.accountId,
|
|
174
|
+
buttons: pendingContent.buttons,
|
|
175
|
+
...preparedTarget.messageThreadId != null ? { messageThreadId: preparedTarget.messageThreadId } : {}
|
|
176
|
+
});
|
|
177
|
+
return {
|
|
178
|
+
chatId: result.chatId,
|
|
179
|
+
messageId: result.messageId
|
|
180
|
+
};
|
|
181
|
+
},
|
|
182
|
+
onDeliveryError: ({ error, request }) => {
|
|
183
|
+
log.error(`telegram exec approvals: failed to send request ${request.id}: ${String(error)}`);
|
|
184
|
+
},
|
|
185
|
+
finalizeResolved: async ({ resolved, entries }) => {
|
|
186
|
+
await this.finalizeResolved(resolved, entries);
|
|
187
|
+
},
|
|
188
|
+
finalizeExpired: async ({ entries }) => {
|
|
189
|
+
await this.clearPending(entries);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
shouldHandle(request) {
|
|
194
|
+
return shouldHandleTelegramExecApprovalRequest({
|
|
195
|
+
cfg: this.opts.cfg,
|
|
196
|
+
accountId: this.opts.accountId,
|
|
197
|
+
request
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
async start() {
|
|
201
|
+
await this.runtime.start();
|
|
202
|
+
}
|
|
203
|
+
async stop() {
|
|
204
|
+
await this.runtime.stop();
|
|
205
|
+
}
|
|
206
|
+
async handleRequested(request) {
|
|
207
|
+
await this.runtime.handleRequested(request);
|
|
208
|
+
}
|
|
209
|
+
async handleResolved(resolved) {
|
|
210
|
+
await this.runtime.handleResolved(resolved);
|
|
211
|
+
}
|
|
212
|
+
async finalizeResolved(_resolved, messages) {
|
|
213
|
+
await this.clearPending(messages);
|
|
214
|
+
}
|
|
215
|
+
async clearPending(messages) {
|
|
216
|
+
await Promise.allSettled(messages.map(async (message) => {
|
|
217
|
+
await this.editReplyMarkup(message.chatId, message.messageId, [], {
|
|
218
|
+
cfg: this.opts.cfg,
|
|
219
|
+
token: this.opts.token,
|
|
220
|
+
accountId: this.opts.accountId
|
|
221
|
+
});
|
|
222
|
+
}));
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
const TELEGRAM_COMMAND_RETRY_RATIO = .8;
|
|
226
|
+
function readErrorTextField(value, key) {
|
|
227
|
+
if (!value || typeof value !== "object" || !(key in value)) return;
|
|
228
|
+
const text = value[key];
|
|
229
|
+
return typeof text === "string" ? text : void 0;
|
|
230
|
+
}
|
|
231
|
+
function isBotCommandsTooMuchError(err) {
|
|
232
|
+
if (!err) return false;
|
|
233
|
+
const pattern = /\bBOT_COMMANDS_TOO_MUCH\b/i;
|
|
234
|
+
if (typeof err === "string") return pattern.test(err);
|
|
235
|
+
if (err instanceof Error) {
|
|
236
|
+
if (pattern.test(err.message)) return true;
|
|
237
|
+
}
|
|
238
|
+
const description = readErrorTextField(err, "description");
|
|
239
|
+
if (description && pattern.test(description)) return true;
|
|
240
|
+
const message = readErrorTextField(err, "message");
|
|
241
|
+
if (message && pattern.test(message)) return true;
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
function formatTelegramCommandRetrySuccessLog(params) {
|
|
245
|
+
const omittedCount = Math.max(0, params.initialCount - params.acceptedCount);
|
|
246
|
+
return `Telegram accepted ${params.acceptedCount} commands after BOT_COMMANDS_TOO_MUCH (started with ${params.initialCount}; omitted ${omittedCount}). Reduce plugin/skill/custom commands to expose more menu entries.`;
|
|
247
|
+
}
|
|
248
|
+
function buildPluginTelegramMenuCommands(params) {
|
|
249
|
+
const { specs, existingCommands } = params;
|
|
250
|
+
const commands = [];
|
|
251
|
+
const issues = [];
|
|
252
|
+
const pluginCommandNames = /* @__PURE__ */ new Set();
|
|
253
|
+
for (const spec of specs) {
|
|
254
|
+
const rawName = typeof spec.name === "string" ? spec.name : "";
|
|
255
|
+
const normalized = normalizeTelegramCommandName(rawName);
|
|
256
|
+
if (!normalized || !TELEGRAM_COMMAND_NAME_PATTERN.test(normalized)) {
|
|
257
|
+
const invalidName = rawName.trim() ? rawName : "<unknown>";
|
|
258
|
+
issues.push(`Plugin command "/${invalidName}" is invalid for Telegram (use a-z, 0-9, underscore; max 32 chars).`);
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
const description = typeof spec.description === "string" ? spec.description.trim() : "";
|
|
262
|
+
if (!description) {
|
|
263
|
+
issues.push(`Plugin command "/${normalized}" is missing a description.`);
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
if (existingCommands.has(normalized)) {
|
|
267
|
+
if (pluginCommandNames.has(normalized)) issues.push(`Plugin command "/${normalized}" is duplicated.`);
|
|
268
|
+
else issues.push(`Plugin command "/${normalized}" conflicts with an existing Telegram command.`);
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
pluginCommandNames.add(normalized);
|
|
272
|
+
existingCommands.add(normalized);
|
|
273
|
+
commands.push({
|
|
274
|
+
command: normalized,
|
|
275
|
+
description
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
return {
|
|
279
|
+
commands,
|
|
280
|
+
issues
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
function buildCappedTelegramMenuCommands(params) {
|
|
284
|
+
const { allCommands } = params;
|
|
285
|
+
const maxCommands = params.maxCommands ?? 100;
|
|
286
|
+
const totalCommands = allCommands.length;
|
|
287
|
+
const overflowCount = Math.max(0, totalCommands - maxCommands);
|
|
288
|
+
return {
|
|
289
|
+
commandsToRegister: allCommands.slice(0, maxCommands),
|
|
290
|
+
totalCommands,
|
|
291
|
+
maxCommands,
|
|
292
|
+
overflowCount
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
/** Compute a stable hash of the command list for change detection. */
|
|
296
|
+
function hashCommandList(commands) {
|
|
297
|
+
const sorted = [...commands].toSorted((a, b) => a.command.localeCompare(b.command));
|
|
298
|
+
return createHash("sha256").update(JSON.stringify(sorted)).digest("hex").slice(0, 16);
|
|
299
|
+
}
|
|
300
|
+
function hashBotIdentity(botIdentity) {
|
|
301
|
+
const normalized = botIdentity?.trim();
|
|
302
|
+
if (!normalized) return "no-bot";
|
|
303
|
+
return createHash("sha256").update(normalized).digest("hex").slice(0, 16);
|
|
304
|
+
}
|
|
305
|
+
function resolveCommandHashPath(accountId, botIdentity) {
|
|
306
|
+
const stateDir = resolveStateDir(process.env, os.homedir);
|
|
307
|
+
const normalizedAccount = accountId?.trim().replace(/[^a-z0-9._-]+/gi, "_") || "default";
|
|
308
|
+
const botHash = hashBotIdentity(botIdentity);
|
|
309
|
+
return path.join(stateDir, "telegram", `command-hash-${normalizedAccount}-${botHash}.txt`);
|
|
310
|
+
}
|
|
311
|
+
async function readCachedCommandHash(accountId, botIdentity) {
|
|
312
|
+
try {
|
|
313
|
+
return (await fs.readFile(resolveCommandHashPath(accountId, botIdentity), "utf-8")).trim();
|
|
314
|
+
} catch {
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
async function writeCachedCommandHash(accountId, botIdentity, hash) {
|
|
319
|
+
const filePath = resolveCommandHashPath(accountId, botIdentity);
|
|
320
|
+
try {
|
|
321
|
+
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
322
|
+
await fs.writeFile(filePath, hash, "utf-8");
|
|
323
|
+
} catch {}
|
|
324
|
+
}
|
|
325
|
+
function syncTelegramMenuCommands(params) {
|
|
326
|
+
const { bot, runtime, commandsToRegister, accountId, botIdentity } = params;
|
|
327
|
+
const sync = async () => {
|
|
328
|
+
const currentHash = hashCommandList(commandsToRegister);
|
|
329
|
+
if (await readCachedCommandHash(accountId, botIdentity) === currentHash) {
|
|
330
|
+
logVerbose("telegram: command menu unchanged; skipping sync");
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
let deleteSucceeded = true;
|
|
334
|
+
if (typeof bot.api.deleteMyCommands === "function") deleteSucceeded = await withTelegramApiErrorLogging({
|
|
335
|
+
operation: "deleteMyCommands",
|
|
336
|
+
runtime,
|
|
337
|
+
fn: () => bot.api.deleteMyCommands()
|
|
338
|
+
}).then(() => true).catch(() => false);
|
|
339
|
+
if (commandsToRegister.length === 0) {
|
|
340
|
+
if (!deleteSucceeded) {
|
|
341
|
+
runtime.log?.("telegram: deleteMyCommands failed; skipping empty-menu hash cache write");
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
await writeCachedCommandHash(accountId, botIdentity, currentHash);
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
let retryCommands = commandsToRegister;
|
|
348
|
+
const initialCommandCount = commandsToRegister.length;
|
|
349
|
+
while (retryCommands.length > 0) try {
|
|
350
|
+
await withTelegramApiErrorLogging({
|
|
351
|
+
operation: "setMyCommands",
|
|
352
|
+
runtime,
|
|
353
|
+
shouldLog: (err) => !isBotCommandsTooMuchError(err),
|
|
354
|
+
fn: () => bot.api.setMyCommands(retryCommands)
|
|
355
|
+
});
|
|
356
|
+
if (retryCommands.length < initialCommandCount) runtime.log?.(formatTelegramCommandRetrySuccessLog({
|
|
357
|
+
initialCount: initialCommandCount,
|
|
358
|
+
acceptedCount: retryCommands.length
|
|
359
|
+
}));
|
|
360
|
+
await writeCachedCommandHash(accountId, botIdentity, currentHash);
|
|
361
|
+
return;
|
|
362
|
+
} catch (err) {
|
|
363
|
+
if (!isBotCommandsTooMuchError(err)) throw err;
|
|
364
|
+
const nextCount = Math.floor(retryCommands.length * TELEGRAM_COMMAND_RETRY_RATIO);
|
|
365
|
+
const reducedCount = nextCount < retryCommands.length ? nextCount : retryCommands.length - 1;
|
|
366
|
+
if (reducedCount <= 0) {
|
|
367
|
+
runtime.error?.("Telegram rejected native command registration (BOT_COMMANDS_TOO_MUCH); leaving menu empty. Reduce commands or disable channels.telegram.commands.native.");
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
runtime.log?.(`Telegram rejected ${retryCommands.length} commands (BOT_COMMANDS_TOO_MUCH); retrying with ${reducedCount}.`);
|
|
371
|
+
retryCommands = retryCommands.slice(0, reducedCount);
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
sync().catch((err) => {
|
|
375
|
+
runtime.error?.(`Telegram command sync failed: ${String(err)}`);
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region extensions/telegram/src/draft-stream.ts
|
|
380
|
+
const TELEGRAM_STREAM_MAX_CHARS = 4096;
|
|
381
|
+
const DEFAULT_THROTTLE_MS = 1e3;
|
|
382
|
+
const TELEGRAM_DRAFT_ID_MAX = 2147483647;
|
|
383
|
+
const THREAD_NOT_FOUND_RE = /400:\s*Bad Request:\s*message thread not found/i;
|
|
384
|
+
const DRAFT_METHOD_UNAVAILABLE_RE = /(unknown method|method .*not (found|available|supported)|unsupported)/i;
|
|
385
|
+
const DRAFT_CHAT_UNSUPPORTED_RE = /(can't be used|can be used only)/i;
|
|
386
|
+
function hasNumericMessageThreadId(params) {
|
|
387
|
+
return typeof params === "object" && params !== null && typeof params.message_thread_id === "number";
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Keep draft-id allocation shared across bundled chunks so concurrent preview
|
|
391
|
+
* lanes do not accidentally reuse draft ids when code-split entries coexist.
|
|
392
|
+
*/
|
|
393
|
+
const TELEGRAM_DRAFT_STREAM_STATE_KEY = Symbol.for("openclaw.telegramDraftStreamState");
|
|
394
|
+
let draftStreamState;
|
|
395
|
+
function getDraftStreamState() {
|
|
396
|
+
if (!draftStreamState) {
|
|
397
|
+
const globalStore = globalThis;
|
|
398
|
+
draftStreamState = globalStore[TELEGRAM_DRAFT_STREAM_STATE_KEY] ?? { nextDraftId: 0 };
|
|
399
|
+
globalStore[TELEGRAM_DRAFT_STREAM_STATE_KEY] = draftStreamState;
|
|
400
|
+
}
|
|
401
|
+
return draftStreamState;
|
|
402
|
+
}
|
|
403
|
+
function allocateTelegramDraftId() {
|
|
404
|
+
const state = getDraftStreamState();
|
|
405
|
+
state.nextDraftId = state.nextDraftId >= TELEGRAM_DRAFT_ID_MAX ? 1 : state.nextDraftId + 1;
|
|
406
|
+
return state.nextDraftId;
|
|
407
|
+
}
|
|
408
|
+
function resolveSendMessageDraftApi(api) {
|
|
409
|
+
const sendMessageDraft = api.sendMessageDraft;
|
|
410
|
+
if (typeof sendMessageDraft !== "function") return;
|
|
411
|
+
return sendMessageDraft.bind(api);
|
|
412
|
+
}
|
|
413
|
+
function shouldFallbackFromDraftTransport(err) {
|
|
414
|
+
const text = typeof err === "string" ? err : err instanceof Error ? err.message : typeof err === "object" && err && "description" in err ? typeof err.description === "string" ? err.description : "" : "";
|
|
415
|
+
if (!/sendMessageDraft/i.test(text)) return false;
|
|
416
|
+
return DRAFT_METHOD_UNAVAILABLE_RE.test(text) || DRAFT_CHAT_UNSUPPORTED_RE.test(text);
|
|
417
|
+
}
|
|
418
|
+
function createTelegramDraftStream(params) {
|
|
419
|
+
const maxChars = Math.min(params.maxChars ?? TELEGRAM_STREAM_MAX_CHARS, TELEGRAM_STREAM_MAX_CHARS);
|
|
420
|
+
const throttleMs = Math.max(250, params.throttleMs ?? DEFAULT_THROTTLE_MS);
|
|
421
|
+
const minInitialChars = params.minInitialChars;
|
|
422
|
+
const chatId = params.chatId;
|
|
423
|
+
const requestedPreviewTransport = params.previewTransport ?? "auto";
|
|
424
|
+
const prefersDraftTransport = requestedPreviewTransport === "draft" ? true : requestedPreviewTransport === "message" ? false : params.thread?.scope === "dm";
|
|
425
|
+
const threadParams = buildTelegramThreadParams(params.thread);
|
|
426
|
+
const replyToMessageId = normalizeTelegramReplyToMessageId(params.replyToMessageId);
|
|
427
|
+
const replyParams = replyToMessageId != null ? {
|
|
428
|
+
...threadParams,
|
|
429
|
+
reply_to_message_id: replyToMessageId,
|
|
430
|
+
allow_sending_without_reply: true
|
|
431
|
+
} : threadParams;
|
|
432
|
+
const resolvedDraftApi = prefersDraftTransport ? resolveSendMessageDraftApi(params.api) : void 0;
|
|
433
|
+
const usesDraftTransport = Boolean(prefersDraftTransport && resolvedDraftApi);
|
|
434
|
+
if (prefersDraftTransport && !usesDraftTransport) params.warn?.("telegram stream preview: sendMessageDraft unavailable; falling back to sendMessage/editMessageText");
|
|
435
|
+
const streamState = {
|
|
436
|
+
stopped: false,
|
|
437
|
+
final: false
|
|
438
|
+
};
|
|
439
|
+
let messageSendAttempted = false;
|
|
440
|
+
let streamMessageId;
|
|
441
|
+
let streamDraftId = usesDraftTransport ? allocateTelegramDraftId() : void 0;
|
|
442
|
+
let previewTransport = usesDraftTransport ? "draft" : "message";
|
|
443
|
+
let lastSentText = "";
|
|
444
|
+
let lastDeliveredText = "";
|
|
445
|
+
let lastSentParseMode;
|
|
446
|
+
let previewRevision = 0;
|
|
447
|
+
let generation = 0;
|
|
448
|
+
const sendRenderedMessageWithThreadFallback = async (sendArgs) => {
|
|
449
|
+
const sendParams = sendArgs.renderedParseMode ? {
|
|
450
|
+
...replyParams,
|
|
451
|
+
parse_mode: sendArgs.renderedParseMode
|
|
452
|
+
} : replyParams;
|
|
453
|
+
const usedThreadParams = hasNumericMessageThreadId(sendParams);
|
|
454
|
+
try {
|
|
455
|
+
return {
|
|
456
|
+
sent: await params.api.sendMessage(chatId, sendArgs.renderedText, sendParams),
|
|
457
|
+
usedThreadParams
|
|
458
|
+
};
|
|
459
|
+
} catch (err) {
|
|
460
|
+
if (!usedThreadParams || !THREAD_NOT_FOUND_RE.test(String(err))) throw err;
|
|
461
|
+
const threadlessParams = { ...sendParams ?? {} };
|
|
462
|
+
delete threadlessParams.message_thread_id;
|
|
463
|
+
params.warn?.(sendArgs.fallbackWarnMessage);
|
|
464
|
+
return {
|
|
465
|
+
sent: await params.api.sendMessage(chatId, sendArgs.renderedText, Object.keys(threadlessParams).length > 0 ? threadlessParams : void 0),
|
|
466
|
+
usedThreadParams: false
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
const sendMessageTransportPreview = async ({ renderedText, renderedParseMode, sendGeneration }) => {
|
|
471
|
+
if (typeof streamMessageId === "number") {
|
|
472
|
+
if (renderedParseMode) await params.api.editMessageText(chatId, streamMessageId, renderedText, { parse_mode: renderedParseMode });
|
|
473
|
+
else await params.api.editMessageText(chatId, streamMessageId, renderedText);
|
|
474
|
+
return true;
|
|
475
|
+
}
|
|
476
|
+
messageSendAttempted = true;
|
|
477
|
+
let sent;
|
|
478
|
+
try {
|
|
479
|
+
({sent} = await sendRenderedMessageWithThreadFallback({
|
|
480
|
+
renderedText,
|
|
481
|
+
renderedParseMode,
|
|
482
|
+
fallbackWarnMessage: "telegram stream preview send failed with message_thread_id, retrying without thread"
|
|
483
|
+
}));
|
|
484
|
+
} catch (err) {
|
|
485
|
+
if (isSafeToRetrySendError(err) || isTelegramClientRejection(err)) messageSendAttempted = false;
|
|
486
|
+
throw err;
|
|
487
|
+
}
|
|
488
|
+
const sentMessageId = sent?.message_id;
|
|
489
|
+
if (typeof sentMessageId !== "number" || !Number.isFinite(sentMessageId)) {
|
|
490
|
+
streamState.stopped = true;
|
|
491
|
+
params.warn?.("telegram stream preview stopped (missing message id from sendMessage)");
|
|
492
|
+
return false;
|
|
493
|
+
}
|
|
494
|
+
const normalizedMessageId = Math.trunc(sentMessageId);
|
|
495
|
+
if (sendGeneration !== generation) {
|
|
496
|
+
params.onSupersededPreview?.({
|
|
497
|
+
messageId: normalizedMessageId,
|
|
498
|
+
textSnapshot: renderedText,
|
|
499
|
+
parseMode: renderedParseMode
|
|
500
|
+
});
|
|
501
|
+
return true;
|
|
502
|
+
}
|
|
503
|
+
streamMessageId = normalizedMessageId;
|
|
504
|
+
return true;
|
|
505
|
+
};
|
|
506
|
+
const sendDraftTransportPreview = async ({ renderedText, renderedParseMode }) => {
|
|
507
|
+
const draftId = streamDraftId ?? allocateTelegramDraftId();
|
|
508
|
+
streamDraftId = draftId;
|
|
509
|
+
const draftParams = {
|
|
510
|
+
...threadParams?.message_thread_id != null ? { message_thread_id: threadParams.message_thread_id } : {},
|
|
511
|
+
...renderedParseMode ? { parse_mode: renderedParseMode } : {}
|
|
512
|
+
};
|
|
513
|
+
await resolvedDraftApi(chatId, draftId, renderedText, Object.keys(draftParams).length > 0 ? draftParams : void 0);
|
|
514
|
+
return true;
|
|
515
|
+
};
|
|
516
|
+
const sendOrEditStreamMessage = async (text) => {
|
|
517
|
+
if (streamState.stopped && !streamState.final) return false;
|
|
518
|
+
const trimmed = text.trimEnd();
|
|
519
|
+
if (!trimmed) return false;
|
|
520
|
+
const rendered = params.renderText?.(trimmed) ?? { text: trimmed };
|
|
521
|
+
const renderedText = rendered.text.trimEnd();
|
|
522
|
+
const renderedParseMode = rendered.parseMode;
|
|
523
|
+
if (!renderedText) return false;
|
|
524
|
+
if (renderedText.length > maxChars) {
|
|
525
|
+
streamState.stopped = true;
|
|
526
|
+
params.warn?.(`telegram stream preview stopped (text length ${renderedText.length} > ${maxChars})`);
|
|
527
|
+
return false;
|
|
528
|
+
}
|
|
529
|
+
if (renderedText === lastSentText && renderedParseMode === lastSentParseMode) return true;
|
|
530
|
+
const sendGeneration = generation;
|
|
531
|
+
if (typeof streamMessageId !== "number" && minInitialChars != null && !streamState.final) {
|
|
532
|
+
if (renderedText.length < minInitialChars) return false;
|
|
533
|
+
}
|
|
534
|
+
lastSentText = renderedText;
|
|
535
|
+
lastSentParseMode = renderedParseMode;
|
|
536
|
+
try {
|
|
537
|
+
let sent = false;
|
|
538
|
+
if (previewTransport === "draft") try {
|
|
539
|
+
sent = await sendDraftTransportPreview({
|
|
540
|
+
renderedText,
|
|
541
|
+
renderedParseMode,
|
|
542
|
+
sendGeneration
|
|
543
|
+
});
|
|
544
|
+
} catch (err) {
|
|
545
|
+
if (!shouldFallbackFromDraftTransport(err)) throw err;
|
|
546
|
+
previewTransport = "message";
|
|
547
|
+
streamDraftId = void 0;
|
|
548
|
+
params.warn?.("telegram stream preview: sendMessageDraft rejected by API; falling back to sendMessage/editMessageText");
|
|
549
|
+
sent = await sendMessageTransportPreview({
|
|
550
|
+
renderedText,
|
|
551
|
+
renderedParseMode,
|
|
552
|
+
sendGeneration
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
else sent = await sendMessageTransportPreview({
|
|
556
|
+
renderedText,
|
|
557
|
+
renderedParseMode,
|
|
558
|
+
sendGeneration
|
|
559
|
+
});
|
|
560
|
+
if (sent) {
|
|
561
|
+
previewRevision += 1;
|
|
562
|
+
lastDeliveredText = trimmed;
|
|
563
|
+
}
|
|
564
|
+
return sent;
|
|
565
|
+
} catch (err) {
|
|
566
|
+
streamState.stopped = true;
|
|
567
|
+
params.warn?.(`telegram stream preview failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
568
|
+
return false;
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
const { loop, update, stop, clear } = createFinalizableDraftLifecycle({
|
|
572
|
+
throttleMs,
|
|
573
|
+
state: streamState,
|
|
574
|
+
sendOrEditStreamMessage,
|
|
575
|
+
readMessageId: () => streamMessageId,
|
|
576
|
+
clearMessageId: () => {
|
|
577
|
+
streamMessageId = void 0;
|
|
578
|
+
},
|
|
579
|
+
isValidMessageId: (value) => typeof value === "number" && Number.isFinite(value),
|
|
580
|
+
deleteMessage: async (messageId) => {
|
|
581
|
+
await params.api.deleteMessage(chatId, messageId);
|
|
582
|
+
},
|
|
583
|
+
onDeleteSuccess: (messageId) => {
|
|
584
|
+
params.log?.(`telegram stream preview deleted (chat=${chatId}, message=${messageId})`);
|
|
585
|
+
},
|
|
586
|
+
warn: params.warn,
|
|
587
|
+
warnPrefix: "telegram stream preview cleanup failed"
|
|
588
|
+
});
|
|
589
|
+
const forceNewMessage = () => {
|
|
590
|
+
streamState.final = false;
|
|
591
|
+
generation += 1;
|
|
592
|
+
messageSendAttempted = false;
|
|
593
|
+
streamMessageId = void 0;
|
|
594
|
+
if (previewTransport === "draft") streamDraftId = allocateTelegramDraftId();
|
|
595
|
+
lastSentText = "";
|
|
596
|
+
lastSentParseMode = void 0;
|
|
597
|
+
loop.resetPending();
|
|
598
|
+
loop.resetThrottleWindow();
|
|
599
|
+
};
|
|
600
|
+
/**
|
|
601
|
+
* Materialize the current draft into a permanent message.
|
|
602
|
+
* For draft transport: sends the accumulated text as a real sendMessage.
|
|
603
|
+
* For message transport: the message is already permanent (noop).
|
|
604
|
+
* Returns the permanent message id, or undefined if nothing to materialize.
|
|
605
|
+
*/
|
|
606
|
+
const materialize = async () => {
|
|
607
|
+
await stop();
|
|
608
|
+
if (previewTransport === "message" && typeof streamMessageId === "number") return streamMessageId;
|
|
609
|
+
const renderedText = lastSentText || lastDeliveredText;
|
|
610
|
+
if (!renderedText) return;
|
|
611
|
+
const renderedParseMode = lastSentText ? lastSentParseMode : void 0;
|
|
612
|
+
try {
|
|
613
|
+
const { sent, usedThreadParams } = await sendRenderedMessageWithThreadFallback({
|
|
614
|
+
renderedText,
|
|
615
|
+
renderedParseMode,
|
|
616
|
+
fallbackWarnMessage: "telegram stream preview materialize send failed with message_thread_id, retrying without thread"
|
|
617
|
+
});
|
|
618
|
+
const sentId = sent?.message_id;
|
|
619
|
+
if (typeof sentId === "number" && Number.isFinite(sentId)) {
|
|
620
|
+
streamMessageId = Math.trunc(sentId);
|
|
621
|
+
if (resolvedDraftApi != null && streamDraftId != null) {
|
|
622
|
+
const clearDraftId = streamDraftId;
|
|
623
|
+
const clearThreadParams = usedThreadParams && threadParams?.message_thread_id != null ? { message_thread_id: threadParams.message_thread_id } : void 0;
|
|
624
|
+
try {
|
|
625
|
+
await resolvedDraftApi(chatId, clearDraftId, "", clearThreadParams);
|
|
626
|
+
} catch {}
|
|
627
|
+
}
|
|
628
|
+
return streamMessageId;
|
|
629
|
+
}
|
|
630
|
+
} catch (err) {
|
|
631
|
+
params.warn?.(`telegram stream preview materialize failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
params.log?.(`telegram stream preview ready (maxChars=${maxChars}, throttleMs=${throttleMs})`);
|
|
635
|
+
return {
|
|
636
|
+
update,
|
|
637
|
+
flush: loop.flush,
|
|
638
|
+
messageId: () => streamMessageId,
|
|
639
|
+
previewMode: () => previewTransport,
|
|
640
|
+
previewRevision: () => previewRevision,
|
|
641
|
+
lastDeliveredText: () => lastDeliveredText,
|
|
642
|
+
clear,
|
|
643
|
+
stop,
|
|
644
|
+
materialize,
|
|
645
|
+
forceNewMessage,
|
|
646
|
+
sendMayHaveLanded: () => messageSendAttempted && typeof streamMessageId !== "number"
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
//#endregion
|
|
650
|
+
//#region extensions/telegram/src/exec-approval-resolver.ts
|
|
651
|
+
const INVALID_REQUEST = "INVALID_REQUEST";
|
|
652
|
+
const APPROVAL_NOT_FOUND = "APPROVAL_NOT_FOUND";
|
|
653
|
+
function readErrorCode(value) {
|
|
654
|
+
return typeof value === "string" && value.trim() ? value : null;
|
|
655
|
+
}
|
|
656
|
+
function readApprovalNotFoundDetailsReason(value) {
|
|
657
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
658
|
+
const reason = value.reason;
|
|
659
|
+
return typeof reason === "string" && reason.trim() ? reason : null;
|
|
660
|
+
}
|
|
661
|
+
function isApprovalNotFoundError(err) {
|
|
662
|
+
if (!(err instanceof Error)) return false;
|
|
663
|
+
const gatewayCode = readErrorCode(err.gatewayCode);
|
|
664
|
+
if (gatewayCode === APPROVAL_NOT_FOUND) return true;
|
|
665
|
+
const detailsReason = readApprovalNotFoundDetailsReason(err.details);
|
|
666
|
+
if (gatewayCode === INVALID_REQUEST && detailsReason === APPROVAL_NOT_FOUND) return true;
|
|
667
|
+
return /unknown or expired approval id/i.test(err.message);
|
|
668
|
+
}
|
|
669
|
+
async function resolveTelegramExecApproval(params) {
|
|
670
|
+
let readySettled = false;
|
|
671
|
+
let resolveReady;
|
|
672
|
+
let rejectReady;
|
|
673
|
+
const ready = new Promise((resolve, reject) => {
|
|
674
|
+
resolveReady = resolve;
|
|
675
|
+
rejectReady = reject;
|
|
676
|
+
});
|
|
677
|
+
const markReady = () => {
|
|
678
|
+
if (readySettled) return;
|
|
679
|
+
readySettled = true;
|
|
680
|
+
resolveReady();
|
|
681
|
+
};
|
|
682
|
+
const failReady = (err) => {
|
|
683
|
+
if (readySettled) return;
|
|
684
|
+
readySettled = true;
|
|
685
|
+
rejectReady(err);
|
|
686
|
+
};
|
|
687
|
+
const gatewayClient = await createOperatorApprovalsGatewayClient({
|
|
688
|
+
config: params.cfg,
|
|
689
|
+
gatewayUrl: params.gatewayUrl,
|
|
690
|
+
clientDisplayName: `Telegram approval (${params.senderId?.trim() || "unknown"})`,
|
|
691
|
+
onHelloOk: () => {
|
|
692
|
+
markReady();
|
|
693
|
+
},
|
|
694
|
+
onConnectError: (err) => {
|
|
695
|
+
failReady(err);
|
|
696
|
+
},
|
|
697
|
+
onClose: (code, reason) => {
|
|
698
|
+
failReady(/* @__PURE__ */ new Error(`gateway closed (${code}): ${reason}`));
|
|
699
|
+
}
|
|
700
|
+
});
|
|
701
|
+
try {
|
|
702
|
+
gatewayClient.start();
|
|
703
|
+
await ready;
|
|
704
|
+
const requestApproval = async (method) => {
|
|
705
|
+
await gatewayClient.request(method, {
|
|
706
|
+
id: params.approvalId,
|
|
707
|
+
decision: params.decision
|
|
708
|
+
});
|
|
709
|
+
};
|
|
710
|
+
if (params.approvalId.startsWith("plugin:")) await requestApproval("plugin.approval.resolve");
|
|
711
|
+
else try {
|
|
712
|
+
await requestApproval("exec.approval.resolve");
|
|
713
|
+
} catch (err) {
|
|
714
|
+
if (!params.allowPluginFallback || !isApprovalNotFoundError(err)) throw err;
|
|
715
|
+
await requestApproval("plugin.approval.resolve");
|
|
716
|
+
}
|
|
717
|
+
} finally {
|
|
718
|
+
await gatewayClient.stopAndWait().catch(() => {
|
|
719
|
+
gatewayClient.stop();
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
//#endregion
|
|
724
|
+
//#region extensions/telegram/src/bot-deps.ts
|
|
725
|
+
const defaultTelegramBotDeps = {
|
|
726
|
+
get loadConfig() {
|
|
727
|
+
return loadConfig;
|
|
728
|
+
},
|
|
729
|
+
get resolveStorePath() {
|
|
730
|
+
return resolveStorePath;
|
|
731
|
+
},
|
|
732
|
+
get readChannelAllowFromStore() {
|
|
733
|
+
return readChannelAllowFromStore;
|
|
734
|
+
},
|
|
735
|
+
get loadSessionStore() {
|
|
736
|
+
return loadSessionStore;
|
|
737
|
+
},
|
|
738
|
+
get upsertChannelPairingRequest() {
|
|
739
|
+
return upsertChannelPairingRequest;
|
|
740
|
+
},
|
|
741
|
+
get enqueueSystemEvent() {
|
|
742
|
+
return enqueueSystemEvent;
|
|
743
|
+
},
|
|
744
|
+
get dispatchReplyWithBufferedBlockDispatcher() {
|
|
745
|
+
return dispatchReplyWithBufferedBlockDispatcher;
|
|
746
|
+
},
|
|
747
|
+
get loadWebMedia() {
|
|
748
|
+
return loadWebMedia;
|
|
749
|
+
},
|
|
750
|
+
get buildModelsProviderData() {
|
|
751
|
+
return buildModelsProviderData;
|
|
752
|
+
},
|
|
753
|
+
get listSkillCommandsForAgents() {
|
|
754
|
+
return listSkillCommandsForAgents;
|
|
755
|
+
},
|
|
756
|
+
get syncTelegramMenuCommands() {
|
|
757
|
+
return syncTelegramMenuCommands;
|
|
758
|
+
},
|
|
759
|
+
get wasSentByBot() {
|
|
760
|
+
return wasSentByBot;
|
|
761
|
+
},
|
|
762
|
+
get resolveExecApproval() {
|
|
763
|
+
return resolveTelegramExecApproval;
|
|
764
|
+
},
|
|
765
|
+
get createTelegramDraftStream() {
|
|
766
|
+
return createTelegramDraftStream;
|
|
767
|
+
},
|
|
768
|
+
get deliverReplies() {
|
|
769
|
+
return deliverReplies;
|
|
770
|
+
},
|
|
771
|
+
get emitInternalMessageSentHook() {
|
|
772
|
+
return emitInternalMessageSentHook;
|
|
773
|
+
},
|
|
774
|
+
get editMessageTelegram() {
|
|
775
|
+
return editMessageTelegram;
|
|
776
|
+
},
|
|
777
|
+
get createChannelReplyPipeline() {
|
|
778
|
+
return createChannelReplyPipeline;
|
|
779
|
+
}
|
|
780
|
+
};
|
|
781
|
+
//#endregion
|
|
782
|
+
//#region extensions/telegram/src/bot-handlers.media.ts
|
|
783
|
+
function isMediaSizeLimitError(err) {
|
|
784
|
+
const errMsg = String(err);
|
|
785
|
+
return errMsg.includes("exceeds") && errMsg.includes("MB limit");
|
|
786
|
+
}
|
|
787
|
+
function isRecoverableMediaGroupError(err) {
|
|
788
|
+
return err instanceof MediaFetchError || isMediaSizeLimitError(err);
|
|
789
|
+
}
|
|
790
|
+
function hasInboundMedia(msg) {
|
|
791
|
+
return Boolean(msg.media_group_id) || Array.isArray(msg.photo) && msg.photo.length > 0 || Boolean(msg.video ?? msg.video_note ?? msg.document ?? msg.audio ?? msg.voice ?? msg.sticker);
|
|
792
|
+
}
|
|
793
|
+
function hasReplyTargetMedia(msg) {
|
|
794
|
+
const externalReply = msg.external_reply;
|
|
795
|
+
const replyTarget = msg.reply_to_message ?? externalReply;
|
|
796
|
+
return Boolean(replyTarget && hasInboundMedia(replyTarget));
|
|
797
|
+
}
|
|
798
|
+
function resolveInboundMediaFileId(msg) {
|
|
799
|
+
return msg.sticker?.file_id ?? msg.photo?.[msg.photo.length - 1]?.file_id ?? msg.video?.file_id ?? msg.video_note?.file_id ?? msg.document?.file_id ?? msg.audio?.file_id ?? msg.voice?.file_id;
|
|
800
|
+
}
|
|
801
|
+
//#endregion
|
|
802
|
+
//#region extensions/telegram/src/bot-native-commands.ts
|
|
803
|
+
const EMPTY_RESPONSE_FALLBACK$1 = "No response generated. Please try again.";
|
|
804
|
+
const TELEGRAM_NATIVE_COMMAND_CALLBACK_PREFIX = "tgcmd:";
|
|
805
|
+
let telegramNativeCommandDeliveryRuntimePromise;
|
|
806
|
+
async function loadTelegramNativeCommandDeliveryRuntime() {
|
|
807
|
+
telegramNativeCommandDeliveryRuntimePromise ??= import("./bot-native-commands.delivery.runtime-CMVcyVfr.js");
|
|
808
|
+
return await telegramNativeCommandDeliveryRuntimePromise;
|
|
809
|
+
}
|
|
810
|
+
let telegramNativeCommandRuntimePromise;
|
|
811
|
+
async function loadTelegramNativeCommandRuntime() {
|
|
812
|
+
telegramNativeCommandRuntimePromise ??= import("./bot-native-commands.runtime-DPXiZ-g-.js");
|
|
813
|
+
return await telegramNativeCommandRuntimePromise;
|
|
814
|
+
}
|
|
815
|
+
function resolveTelegramProgressPlaceholder(command) {
|
|
816
|
+
const text = command.telegramNativeProgressMessage?.trim();
|
|
817
|
+
return text ? text : null;
|
|
818
|
+
}
|
|
819
|
+
function resolveTelegramNativeReplyChannelData(result) {
|
|
820
|
+
return result.channelData?.telegram;
|
|
821
|
+
}
|
|
822
|
+
function isEditableTelegramProgressResult(result) {
|
|
823
|
+
const telegramData = resolveTelegramNativeReplyChannelData(result);
|
|
824
|
+
return Boolean(typeof result.text === "string" && result.text.trim() && !result.mediaUrl && (!result.mediaUrls || result.mediaUrls.length === 0) && !result.interactive && !result.btw && telegramData?.pin !== true);
|
|
825
|
+
}
|
|
826
|
+
async function cleanupTelegramProgressPlaceholder(params) {
|
|
827
|
+
const progressMessageId = params.progressMessageId;
|
|
828
|
+
if (progressMessageId == null) return;
|
|
829
|
+
try {
|
|
830
|
+
await withTelegramApiErrorLogging({
|
|
831
|
+
operation: "deleteMessage",
|
|
832
|
+
runtime: params.runtime,
|
|
833
|
+
fn: () => params.bot.api.deleteMessage(params.chatId, progressMessageId)
|
|
834
|
+
});
|
|
835
|
+
} catch {}
|
|
836
|
+
}
|
|
837
|
+
function buildTelegramNativeCommandCallbackData(commandText) {
|
|
838
|
+
return `${TELEGRAM_NATIVE_COMMAND_CALLBACK_PREFIX}${commandText}`;
|
|
839
|
+
}
|
|
840
|
+
function parseTelegramNativeCommandCallbackData(data) {
|
|
841
|
+
if (!data) return null;
|
|
842
|
+
const trimmed = data.trim();
|
|
843
|
+
if (!trimmed.startsWith(TELEGRAM_NATIVE_COMMAND_CALLBACK_PREFIX)) return null;
|
|
844
|
+
const commandText = trimmed.slice(6).trim();
|
|
845
|
+
return commandText.startsWith("/") ? commandText : null;
|
|
846
|
+
}
|
|
847
|
+
async function resolveTelegramCommandAuth(params) {
|
|
848
|
+
const { msg, bot, cfg, accountId, telegramCfg, readChannelAllowFromStore, allowFrom, groupAllowFrom, useAccessGroups, resolveGroupPolicy, resolveTelegramGroupConfig, requireAuth } = params;
|
|
849
|
+
const chatId = msg.chat.id;
|
|
850
|
+
const isGroup = msg.chat.type === "group" || msg.chat.type === "supergroup";
|
|
851
|
+
const messageThreadId = msg.message_thread_id;
|
|
852
|
+
const getChat = typeof bot.api.getChat === "function" ? bot.api.getChat.bind(bot.api) : void 0;
|
|
853
|
+
const isForum = await resolveTelegramForumFlag({
|
|
854
|
+
chatId,
|
|
855
|
+
chatType: msg.chat.type,
|
|
856
|
+
isGroup,
|
|
857
|
+
isForum: extractTelegramForumFlag(msg.chat),
|
|
858
|
+
getChat
|
|
859
|
+
});
|
|
860
|
+
const threadParams = buildTelegramThreadParams(resolveTelegramThreadSpec({
|
|
861
|
+
isGroup,
|
|
862
|
+
isForum,
|
|
863
|
+
messageThreadId
|
|
864
|
+
})) ?? {};
|
|
865
|
+
const { resolvedThreadId, dmThreadId, storeAllowFrom, groupConfig, topicConfig, groupAllowOverride, effectiveGroupAllow, hasGroupAllowOverride } = await resolveTelegramGroupAllowFromContext({
|
|
866
|
+
chatId,
|
|
867
|
+
accountId,
|
|
868
|
+
isGroup,
|
|
869
|
+
isForum,
|
|
870
|
+
messageThreadId,
|
|
871
|
+
groupAllowFrom,
|
|
872
|
+
readChannelAllowFromStore,
|
|
873
|
+
resolveTelegramGroupConfig
|
|
874
|
+
});
|
|
875
|
+
const effectiveDmPolicy = !isGroup && groupConfig && "dmPolicy" in groupConfig ? groupConfig.dmPolicy ?? telegramCfg.dmPolicy ?? "pairing" : telegramCfg.dmPolicy ?? "pairing";
|
|
876
|
+
const requireTopic = groupConfig?.requireTopic;
|
|
877
|
+
if (!isGroup && requireTopic === true && dmThreadId == null) {
|
|
878
|
+
logVerbose(`Blocked telegram command in DM ${chatId}: requireTopic=true but no topic present`);
|
|
879
|
+
return null;
|
|
880
|
+
}
|
|
881
|
+
const dmAllowFrom = groupAllowOverride ?? allowFrom;
|
|
882
|
+
const senderId = msg.from?.id ? String(msg.from.id) : "";
|
|
883
|
+
const senderUsername = msg.from?.username ?? "";
|
|
884
|
+
const commandsAllowFrom = cfg.commands?.allowFrom;
|
|
885
|
+
const commandsAllowFromConfigured = commandsAllowFrom != null && typeof commandsAllowFrom === "object" && (Array.isArray(commandsAllowFrom.telegram) || Array.isArray(commandsAllowFrom["*"]));
|
|
886
|
+
const commandsAllowFromAccess = commandsAllowFromConfigured ? resolveCommandAuthorization({
|
|
887
|
+
ctx: {
|
|
888
|
+
Provider: "telegram",
|
|
889
|
+
Surface: "telegram",
|
|
890
|
+
OriginatingChannel: "telegram",
|
|
891
|
+
AccountId: accountId,
|
|
892
|
+
ChatType: isGroup ? "group" : "direct",
|
|
893
|
+
From: isGroup ? buildTelegramGroupFrom(chatId, resolvedThreadId) : `telegram:${chatId}`,
|
|
894
|
+
SenderId: senderId || void 0,
|
|
895
|
+
SenderUsername: senderUsername || void 0
|
|
896
|
+
},
|
|
897
|
+
cfg,
|
|
898
|
+
commandAuthorized: false
|
|
899
|
+
}) : null;
|
|
900
|
+
const sendAuthMessage = async (text) => {
|
|
901
|
+
await withTelegramApiErrorLogging({
|
|
902
|
+
operation: "sendMessage",
|
|
903
|
+
fn: () => bot.api.sendMessage(chatId, text, threadParams)
|
|
904
|
+
});
|
|
905
|
+
return null;
|
|
906
|
+
};
|
|
907
|
+
const rejectNotAuthorized = async () => {
|
|
908
|
+
return await sendAuthMessage("You are not authorized to use this command.");
|
|
909
|
+
};
|
|
910
|
+
const baseAccess = evaluateTelegramGroupBaseAccess({
|
|
911
|
+
isGroup,
|
|
912
|
+
groupConfig,
|
|
913
|
+
topicConfig,
|
|
914
|
+
hasGroupAllowOverride,
|
|
915
|
+
effectiveGroupAllow,
|
|
916
|
+
senderId,
|
|
917
|
+
senderUsername,
|
|
918
|
+
enforceAllowOverride: requireAuth,
|
|
919
|
+
requireSenderForAllowOverride: true
|
|
920
|
+
});
|
|
921
|
+
if (!baseAccess.allowed) {
|
|
922
|
+
if (baseAccess.reason === "group-disabled") return await sendAuthMessage("This group is disabled.");
|
|
923
|
+
if (baseAccess.reason === "topic-disabled") return await sendAuthMessage("This topic is disabled.");
|
|
924
|
+
return await rejectNotAuthorized();
|
|
925
|
+
}
|
|
926
|
+
const policyAccess = evaluateTelegramGroupPolicyAccess({
|
|
927
|
+
isGroup,
|
|
928
|
+
chatId,
|
|
929
|
+
cfg,
|
|
930
|
+
telegramCfg,
|
|
931
|
+
topicConfig,
|
|
932
|
+
groupConfig,
|
|
933
|
+
effectiveGroupAllow,
|
|
934
|
+
senderId,
|
|
935
|
+
senderUsername,
|
|
936
|
+
resolveGroupPolicy,
|
|
937
|
+
enforcePolicy: useAccessGroups,
|
|
938
|
+
useTopicAndGroupOverrides: false,
|
|
939
|
+
enforceAllowlistAuthorization: requireAuth && !commandsAllowFromConfigured,
|
|
940
|
+
allowEmptyAllowlistEntries: true,
|
|
941
|
+
requireSenderForAllowlistAuthorization: true,
|
|
942
|
+
checkChatAllowlist: useAccessGroups
|
|
943
|
+
});
|
|
944
|
+
if (!policyAccess.allowed) {
|
|
945
|
+
if (policyAccess.reason === "group-policy-disabled") return await sendAuthMessage("Telegram group commands are disabled.");
|
|
946
|
+
if (policyAccess.reason === "group-policy-allowlist-no-sender" || policyAccess.reason === "group-policy-allowlist-unauthorized") return await rejectNotAuthorized();
|
|
947
|
+
if (policyAccess.reason === "group-chat-not-allowed") return await sendAuthMessage("This group is not allowed.");
|
|
948
|
+
}
|
|
949
|
+
const dmAllow = normalizeDmAllowFromWithStore({
|
|
950
|
+
allowFrom: dmAllowFrom,
|
|
951
|
+
storeAllowFrom: isGroup ? [] : storeAllowFrom,
|
|
952
|
+
dmPolicy: effectiveDmPolicy
|
|
953
|
+
});
|
|
954
|
+
const senderAllowed = isSenderAllowed({
|
|
955
|
+
allow: dmAllow,
|
|
956
|
+
senderId,
|
|
957
|
+
senderUsername
|
|
958
|
+
});
|
|
959
|
+
const groupSenderAllowed = isGroup ? isSenderAllowed({
|
|
960
|
+
allow: effectiveGroupAllow,
|
|
961
|
+
senderId,
|
|
962
|
+
senderUsername
|
|
963
|
+
}) : false;
|
|
964
|
+
const commandAuthorized = commandsAllowFromConfigured ? Boolean(commandsAllowFromAccess?.isAuthorizedSender) : resolveCommandAuthorizedFromAuthorizers({
|
|
965
|
+
useAccessGroups,
|
|
966
|
+
authorizers: [{
|
|
967
|
+
configured: dmAllow.hasEntries,
|
|
968
|
+
allowed: senderAllowed
|
|
969
|
+
}, ...isGroup ? [{
|
|
970
|
+
configured: effectiveGroupAllow.hasEntries,
|
|
971
|
+
allowed: groupSenderAllowed
|
|
972
|
+
}] : []],
|
|
973
|
+
modeWhenAccessGroupsOff: "configured"
|
|
974
|
+
});
|
|
975
|
+
if (requireAuth && !commandAuthorized) return await rejectNotAuthorized();
|
|
976
|
+
return {
|
|
977
|
+
chatId,
|
|
978
|
+
isGroup,
|
|
979
|
+
isForum,
|
|
980
|
+
resolvedThreadId,
|
|
981
|
+
senderId,
|
|
982
|
+
senderUsername,
|
|
983
|
+
groupConfig,
|
|
984
|
+
topicConfig,
|
|
985
|
+
commandAuthorized
|
|
986
|
+
};
|
|
987
|
+
}
|
|
988
|
+
const registerTelegramNativeCommands = ({ bot, cfg, runtime, accountId, telegramCfg, allowFrom, groupAllowFrom, replyToMode, textLimit, useAccessGroups, nativeEnabled, nativeSkillsEnabled, nativeDisabledExplicit, resolveGroupPolicy, resolveTelegramGroupConfig, shouldSkipUpdate, telegramDeps = defaultTelegramBotDeps, opts }) => {
|
|
989
|
+
const boundRoute = nativeEnabled && nativeSkillsEnabled ? resolveAgentRoute({
|
|
990
|
+
cfg,
|
|
991
|
+
channel: "telegram",
|
|
992
|
+
accountId
|
|
993
|
+
}) : null;
|
|
994
|
+
if (nativeEnabled && nativeSkillsEnabled && !boundRoute) runtime.log?.("nativeSkillsEnabled is true but no agent route is bound for this Telegram account; skill commands will not appear in the native menu.");
|
|
995
|
+
const skillCommands = nativeEnabled && nativeSkillsEnabled && boundRoute ? telegramDeps.listSkillCommandsForAgents({
|
|
996
|
+
cfg,
|
|
997
|
+
agentIds: [boundRoute.agentId]
|
|
998
|
+
}) : [];
|
|
999
|
+
const nativeCommands = nativeEnabled ? listNativeCommandSpecsForConfig(cfg, {
|
|
1000
|
+
skillCommands,
|
|
1001
|
+
provider: "telegram"
|
|
1002
|
+
}) : [];
|
|
1003
|
+
const reservedCommands = new Set(listNativeCommandSpecs().map((command) => normalizeTelegramCommandName(command.name)));
|
|
1004
|
+
for (const command of skillCommands) reservedCommands.add(command.name.toLowerCase());
|
|
1005
|
+
const customResolution = resolveTelegramCustomCommands({
|
|
1006
|
+
commands: telegramCfg.customCommands,
|
|
1007
|
+
reservedCommands
|
|
1008
|
+
});
|
|
1009
|
+
for (const issue of customResolution.issues) runtime.error?.(danger(issue.message));
|
|
1010
|
+
const customCommands = customResolution.commands;
|
|
1011
|
+
const pluginCatalog = buildPluginTelegramMenuCommands({
|
|
1012
|
+
specs: getPluginCommandSpecs("telegram"),
|
|
1013
|
+
existingCommands: new Set([...nativeCommands.map((command) => normalizeTelegramCommandName(command.name)), ...customCommands.map((command) => command.command)].map((command) => command.toLowerCase()))
|
|
1014
|
+
});
|
|
1015
|
+
for (const issue of pluginCatalog.issues) runtime.error?.(danger(issue));
|
|
1016
|
+
const loadFreshRuntimeConfig = () => telegramDeps.loadConfig();
|
|
1017
|
+
const resolveFreshTelegramConfig = (runtimeCfg) => {
|
|
1018
|
+
try {
|
|
1019
|
+
return resolveTelegramAccount({
|
|
1020
|
+
cfg: runtimeCfg,
|
|
1021
|
+
accountId
|
|
1022
|
+
}).config;
|
|
1023
|
+
} catch (error) {
|
|
1024
|
+
logVerbose(`telegram native command: failed to load fresh account config for ${accountId}; using startup snapshot: ${String(error)}`);
|
|
1025
|
+
return telegramCfg;
|
|
1026
|
+
}
|
|
1027
|
+
};
|
|
1028
|
+
const { commandsToRegister, totalCommands, maxCommands, overflowCount } = buildCappedTelegramMenuCommands({ allCommands: [
|
|
1029
|
+
...nativeCommands.map((command) => {
|
|
1030
|
+
const normalized = normalizeTelegramCommandName(command.name);
|
|
1031
|
+
if (!TELEGRAM_COMMAND_NAME_PATTERN.test(normalized)) {
|
|
1032
|
+
runtime.error?.(danger(`Native command "${command.name}" is invalid for Telegram (resolved to "${normalized}"). Skipping.`));
|
|
1033
|
+
return null;
|
|
1034
|
+
}
|
|
1035
|
+
return {
|
|
1036
|
+
command: normalized,
|
|
1037
|
+
description: command.description
|
|
1038
|
+
};
|
|
1039
|
+
}).filter((cmd) => cmd !== null),
|
|
1040
|
+
...nativeEnabled ? pluginCatalog.commands : [],
|
|
1041
|
+
...customCommands
|
|
1042
|
+
] });
|
|
1043
|
+
if (overflowCount > 0) runtime.log?.(`Telegram limits bots to ${maxCommands} commands. ${totalCommands} configured; registering first ${maxCommands}. Use channels.telegram.commands.native: false to disable, or reduce plugin/skill/custom commands.`);
|
|
1044
|
+
(telegramDeps.syncTelegramMenuCommands ?? syncTelegramMenuCommands)({
|
|
1045
|
+
bot,
|
|
1046
|
+
runtime,
|
|
1047
|
+
commandsToRegister,
|
|
1048
|
+
accountId,
|
|
1049
|
+
botIdentity: opts.token
|
|
1050
|
+
});
|
|
1051
|
+
const resolveCommandRuntimeContext = async (params) => {
|
|
1052
|
+
const { msg, runtimeCfg, isGroup, isForum, resolvedThreadId, senderId, topicAgentId } = params;
|
|
1053
|
+
const chatId = msg.chat.id;
|
|
1054
|
+
const messageThreadId = msg.message_thread_id;
|
|
1055
|
+
const threadSpec = resolveTelegramThreadSpec({
|
|
1056
|
+
isGroup,
|
|
1057
|
+
isForum,
|
|
1058
|
+
messageThreadId: resolvedThreadId ?? messageThreadId
|
|
1059
|
+
});
|
|
1060
|
+
let { route, configuredBinding } = resolveTelegramConversationRoute({
|
|
1061
|
+
cfg: runtimeCfg,
|
|
1062
|
+
accountId,
|
|
1063
|
+
chatId,
|
|
1064
|
+
isGroup,
|
|
1065
|
+
resolvedThreadId,
|
|
1066
|
+
replyThreadId: threadSpec.id,
|
|
1067
|
+
senderId,
|
|
1068
|
+
topicAgentId
|
|
1069
|
+
});
|
|
1070
|
+
const nativeCommandRuntime = await loadTelegramNativeCommandRuntime();
|
|
1071
|
+
if (configuredBinding) {
|
|
1072
|
+
const ensured = await nativeCommandRuntime.ensureConfiguredBindingRouteReady({
|
|
1073
|
+
cfg: runtimeCfg,
|
|
1074
|
+
bindingResolution: configuredBinding
|
|
1075
|
+
});
|
|
1076
|
+
if (!ensured.ok) {
|
|
1077
|
+
logVerbose(`telegram native command: configured ACP binding unavailable for topic ${configuredBinding.record.conversation.conversationId}: ${ensured.error}`);
|
|
1078
|
+
await withTelegramApiErrorLogging({
|
|
1079
|
+
operation: "sendMessage",
|
|
1080
|
+
runtime,
|
|
1081
|
+
fn: () => bot.api.sendMessage(chatId, "Configured ACP binding is unavailable right now. Please try again.", buildTelegramThreadParams(threadSpec) ?? {})
|
|
1082
|
+
});
|
|
1083
|
+
return null;
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
return {
|
|
1087
|
+
chatId,
|
|
1088
|
+
threadSpec,
|
|
1089
|
+
route,
|
|
1090
|
+
mediaLocalRoots: nativeCommandRuntime.getAgentScopedMediaLocalRoots(runtimeCfg, route.agentId),
|
|
1091
|
+
tableMode: resolveMarkdownTableMode({
|
|
1092
|
+
cfg: runtimeCfg,
|
|
1093
|
+
channel: "telegram",
|
|
1094
|
+
accountId: route.accountId
|
|
1095
|
+
}),
|
|
1096
|
+
chunkMode: nativeCommandRuntime.resolveChunkMode(runtimeCfg, "telegram", route.accountId)
|
|
1097
|
+
};
|
|
1098
|
+
};
|
|
1099
|
+
const buildCommandDeliveryBaseOptions = (params) => ({
|
|
1100
|
+
chatId: String(params.chatId),
|
|
1101
|
+
accountId: params.accountId,
|
|
1102
|
+
sessionKeyForInternalHooks: params.sessionKeyForInternalHooks,
|
|
1103
|
+
mirrorIsGroup: params.mirrorIsGroup,
|
|
1104
|
+
mirrorGroupId: params.mirrorGroupId,
|
|
1105
|
+
token: opts.token,
|
|
1106
|
+
runtime,
|
|
1107
|
+
bot,
|
|
1108
|
+
mediaLocalRoots: params.mediaLocalRoots,
|
|
1109
|
+
replyToMode,
|
|
1110
|
+
textLimit,
|
|
1111
|
+
thread: params.threadSpec,
|
|
1112
|
+
tableMode: params.tableMode,
|
|
1113
|
+
chunkMode: params.chunkMode,
|
|
1114
|
+
linkPreview: params.linkPreview
|
|
1115
|
+
});
|
|
1116
|
+
if (commandsToRegister.length > 0 || pluginCatalog.commands.length > 0) {
|
|
1117
|
+
for (const command of nativeCommands) {
|
|
1118
|
+
const normalizedCommandName = normalizeTelegramCommandName(command.name);
|
|
1119
|
+
bot.command(normalizedCommandName, async (ctx) => {
|
|
1120
|
+
const msg = ctx.message;
|
|
1121
|
+
if (!msg) return;
|
|
1122
|
+
if (shouldSkipUpdate(ctx)) return;
|
|
1123
|
+
const runtimeCfg = loadFreshRuntimeConfig();
|
|
1124
|
+
const runtimeTelegramCfg = resolveFreshTelegramConfig(runtimeCfg);
|
|
1125
|
+
const auth = await resolveTelegramCommandAuth({
|
|
1126
|
+
msg,
|
|
1127
|
+
bot,
|
|
1128
|
+
cfg: runtimeCfg,
|
|
1129
|
+
accountId,
|
|
1130
|
+
telegramCfg: runtimeTelegramCfg,
|
|
1131
|
+
readChannelAllowFromStore: telegramDeps.readChannelAllowFromStore,
|
|
1132
|
+
allowFrom,
|
|
1133
|
+
groupAllowFrom,
|
|
1134
|
+
useAccessGroups,
|
|
1135
|
+
resolveGroupPolicy,
|
|
1136
|
+
resolveTelegramGroupConfig,
|
|
1137
|
+
requireAuth: true
|
|
1138
|
+
});
|
|
1139
|
+
if (!auth) return;
|
|
1140
|
+
const { chatId, isGroup, isForum, resolvedThreadId, senderId, senderUsername, groupConfig, topicConfig, commandAuthorized } = auth;
|
|
1141
|
+
const runtimeContext = await resolveCommandRuntimeContext({
|
|
1142
|
+
msg,
|
|
1143
|
+
runtimeCfg,
|
|
1144
|
+
isGroup,
|
|
1145
|
+
isForum,
|
|
1146
|
+
resolvedThreadId,
|
|
1147
|
+
senderId,
|
|
1148
|
+
topicAgentId: topicConfig?.agentId
|
|
1149
|
+
});
|
|
1150
|
+
if (!runtimeContext) return;
|
|
1151
|
+
const { threadSpec, route, mediaLocalRoots, tableMode, chunkMode } = runtimeContext;
|
|
1152
|
+
const threadParams = buildTelegramThreadParams(threadSpec) ?? {};
|
|
1153
|
+
const originatingTo = buildTelegramRoutingTarget(chatId, threadSpec);
|
|
1154
|
+
const executionCfg = getRuntimeConfigSnapshot() ?? cfg;
|
|
1155
|
+
const commandDefinition = findCommandByNativeName(command.name, "telegram");
|
|
1156
|
+
const rawText = ctx.match?.trim() ?? "";
|
|
1157
|
+
const commandArgs = commandDefinition ? parseCommandArgs(commandDefinition, rawText) : rawText ? { raw: rawText } : void 0;
|
|
1158
|
+
const prompt = commandDefinition ? buildCommandTextFromArgs(commandDefinition, commandArgs) : rawText ? `/${command.name} ${rawText}` : `/${command.name}`;
|
|
1159
|
+
const menu = commandDefinition ? resolveCommandArgMenu({
|
|
1160
|
+
command: commandDefinition,
|
|
1161
|
+
args: commandArgs,
|
|
1162
|
+
cfg: runtimeCfg
|
|
1163
|
+
}) : null;
|
|
1164
|
+
if (menu && commandDefinition) {
|
|
1165
|
+
const title = menu.title ?? `Choose ${menu.arg.description || menu.arg.name} for /${commandDefinition.nativeName ?? commandDefinition.key}.`;
|
|
1166
|
+
const rows = [];
|
|
1167
|
+
for (let i = 0; i < menu.choices.length; i += 2) {
|
|
1168
|
+
const slice = menu.choices.slice(i, i + 2);
|
|
1169
|
+
rows.push(slice.map((choice) => {
|
|
1170
|
+
const args = { values: { [menu.arg.name]: choice.value } };
|
|
1171
|
+
return {
|
|
1172
|
+
text: choice.label,
|
|
1173
|
+
callback_data: buildTelegramNativeCommandCallbackData(buildCommandTextFromArgs(commandDefinition, args))
|
|
1174
|
+
};
|
|
1175
|
+
}));
|
|
1176
|
+
}
|
|
1177
|
+
const replyMarkup = buildInlineKeyboard(rows);
|
|
1178
|
+
await withTelegramApiErrorLogging({
|
|
1179
|
+
operation: "sendMessage",
|
|
1180
|
+
runtime,
|
|
1181
|
+
fn: () => bot.api.sendMessage(chatId, title, {
|
|
1182
|
+
...replyMarkup ? { reply_markup: replyMarkup } : {},
|
|
1183
|
+
...threadParams
|
|
1184
|
+
})
|
|
1185
|
+
});
|
|
1186
|
+
return;
|
|
1187
|
+
}
|
|
1188
|
+
const baseSessionKey = resolveTelegramConversationBaseSessionKey({
|
|
1189
|
+
cfg: runtimeCfg,
|
|
1190
|
+
route,
|
|
1191
|
+
chatId,
|
|
1192
|
+
isGroup,
|
|
1193
|
+
senderId
|
|
1194
|
+
});
|
|
1195
|
+
const dmThreadId = threadSpec.scope === "dm" ? threadSpec.id : void 0;
|
|
1196
|
+
const nativeCommandRuntime = await loadTelegramNativeCommandRuntime();
|
|
1197
|
+
const sessionKey = (dmThreadId != null ? nativeCommandRuntime.resolveThreadSessionKeys({
|
|
1198
|
+
baseSessionKey,
|
|
1199
|
+
threadId: `${chatId}:${dmThreadId}`
|
|
1200
|
+
}) : null)?.sessionKey ?? baseSessionKey;
|
|
1201
|
+
const { skillFilter, groupSystemPrompt } = resolveTelegramGroupPromptSettings({
|
|
1202
|
+
groupConfig,
|
|
1203
|
+
topicConfig
|
|
1204
|
+
});
|
|
1205
|
+
const { sessionKey: commandSessionKey, commandTargetSessionKey } = resolveNativeCommandSessionTargets({
|
|
1206
|
+
agentId: route.agentId,
|
|
1207
|
+
sessionPrefix: "telegram:slash",
|
|
1208
|
+
userId: String(senderId || chatId),
|
|
1209
|
+
targetSessionKey: sessionKey
|
|
1210
|
+
});
|
|
1211
|
+
const deliveryBaseOptions = buildCommandDeliveryBaseOptions({
|
|
1212
|
+
chatId,
|
|
1213
|
+
accountId: route.accountId,
|
|
1214
|
+
sessionKeyForInternalHooks: commandSessionKey,
|
|
1215
|
+
mirrorIsGroup: isGroup,
|
|
1216
|
+
mirrorGroupId: isGroup ? String(chatId) : void 0,
|
|
1217
|
+
mediaLocalRoots,
|
|
1218
|
+
threadSpec,
|
|
1219
|
+
tableMode,
|
|
1220
|
+
chunkMode,
|
|
1221
|
+
linkPreview: runtimeTelegramCfg.linkPreview
|
|
1222
|
+
});
|
|
1223
|
+
const conversationLabel = isGroup ? msg.chat.title ? `${msg.chat.title} id:${chatId}` : `group:${chatId}` : buildSenderName(msg) ?? String(senderId || chatId);
|
|
1224
|
+
const ctxPayload = nativeCommandRuntime.finalizeInboundContext({
|
|
1225
|
+
Body: prompt,
|
|
1226
|
+
BodyForAgent: prompt,
|
|
1227
|
+
RawBody: prompt,
|
|
1228
|
+
CommandBody: prompt,
|
|
1229
|
+
CommandArgs: commandArgs,
|
|
1230
|
+
From: isGroup ? buildTelegramGroupFrom(chatId, resolvedThreadId) : `telegram:${chatId}`,
|
|
1231
|
+
To: `slash:${senderId || chatId}`,
|
|
1232
|
+
ChatType: isGroup ? "group" : "direct",
|
|
1233
|
+
ConversationLabel: conversationLabel,
|
|
1234
|
+
GroupSubject: isGroup ? msg.chat.title ?? void 0 : void 0,
|
|
1235
|
+
GroupSystemPrompt: isGroup || !isGroup && groupConfig ? groupSystemPrompt : void 0,
|
|
1236
|
+
SenderName: buildSenderName(msg),
|
|
1237
|
+
SenderId: senderId || void 0,
|
|
1238
|
+
SenderUsername: senderUsername || void 0,
|
|
1239
|
+
Surface: "telegram",
|
|
1240
|
+
Provider: "telegram",
|
|
1241
|
+
MessageSid: String(msg.message_id),
|
|
1242
|
+
Timestamp: msg.date ? msg.date * 1e3 : void 0,
|
|
1243
|
+
WasMentioned: true,
|
|
1244
|
+
CommandAuthorized: commandAuthorized,
|
|
1245
|
+
CommandSource: "native",
|
|
1246
|
+
SessionKey: commandSessionKey,
|
|
1247
|
+
AccountId: route.accountId,
|
|
1248
|
+
CommandTargetSessionKey: commandTargetSessionKey,
|
|
1249
|
+
MessageThreadId: threadSpec.id,
|
|
1250
|
+
IsForum: isForum,
|
|
1251
|
+
OriginatingChannel: "telegram",
|
|
1252
|
+
OriginatingTo: originatingTo
|
|
1253
|
+
});
|
|
1254
|
+
await nativeCommandRuntime.recordInboundSessionMetaSafe({
|
|
1255
|
+
cfg: executionCfg,
|
|
1256
|
+
agentId: route.agentId,
|
|
1257
|
+
sessionKey: ctxPayload.SessionKey ?? route.sessionKey,
|
|
1258
|
+
ctx: ctxPayload,
|
|
1259
|
+
onError: (err) => runtime.error?.(danger(`telegram slash: failed updating session meta: ${String(err)}`))
|
|
1260
|
+
});
|
|
1261
|
+
const disableBlockStreaming = typeof runtimeTelegramCfg.blockStreaming === "boolean" ? !runtimeTelegramCfg.blockStreaming : void 0;
|
|
1262
|
+
const deliveryState = {
|
|
1263
|
+
delivered: false,
|
|
1264
|
+
skippedNonSilent: 0
|
|
1265
|
+
};
|
|
1266
|
+
const { createChannelReplyPipeline, deliverReplies } = await loadTelegramNativeCommandDeliveryRuntime();
|
|
1267
|
+
const { onModelSelected, ...replyPipeline } = createChannelReplyPipeline({
|
|
1268
|
+
cfg: executionCfg,
|
|
1269
|
+
agentId: route.agentId,
|
|
1270
|
+
channel: "telegram",
|
|
1271
|
+
accountId: route.accountId
|
|
1272
|
+
});
|
|
1273
|
+
await telegramDeps.dispatchReplyWithBufferedBlockDispatcher({
|
|
1274
|
+
ctx: ctxPayload,
|
|
1275
|
+
cfg: executionCfg,
|
|
1276
|
+
dispatcherOptions: {
|
|
1277
|
+
...replyPipeline,
|
|
1278
|
+
deliver: async (payload, _info) => {
|
|
1279
|
+
if (shouldSuppressLocalTelegramExecApprovalPrompt({
|
|
1280
|
+
cfg: executionCfg,
|
|
1281
|
+
accountId: route.accountId,
|
|
1282
|
+
payload
|
|
1283
|
+
})) {
|
|
1284
|
+
deliveryState.delivered = true;
|
|
1285
|
+
return;
|
|
1286
|
+
}
|
|
1287
|
+
if ((await deliverReplies({
|
|
1288
|
+
replies: [payload],
|
|
1289
|
+
...deliveryBaseOptions,
|
|
1290
|
+
silent: runtimeTelegramCfg.silentErrorReplies === true && payload.isError === true
|
|
1291
|
+
})).delivered) deliveryState.delivered = true;
|
|
1292
|
+
},
|
|
1293
|
+
onSkip: (_payload, info) => {
|
|
1294
|
+
if (info.reason !== "silent") deliveryState.skippedNonSilent += 1;
|
|
1295
|
+
},
|
|
1296
|
+
onError: (err, info) => {
|
|
1297
|
+
runtime.error?.(danger(`telegram slash ${info.kind} reply failed: ${String(err)}`));
|
|
1298
|
+
}
|
|
1299
|
+
},
|
|
1300
|
+
replyOptions: {
|
|
1301
|
+
skillFilter,
|
|
1302
|
+
disableBlockStreaming,
|
|
1303
|
+
onModelSelected
|
|
1304
|
+
}
|
|
1305
|
+
});
|
|
1306
|
+
if (!deliveryState.delivered && deliveryState.skippedNonSilent > 0) await deliverReplies({
|
|
1307
|
+
replies: [{ text: EMPTY_RESPONSE_FALLBACK$1 }],
|
|
1308
|
+
...deliveryBaseOptions
|
|
1309
|
+
});
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
for (const pluginCommand of pluginCatalog.commands) bot.command(pluginCommand.command, async (ctx) => {
|
|
1313
|
+
const msg = ctx.message;
|
|
1314
|
+
if (!msg) return;
|
|
1315
|
+
if (shouldSkipUpdate(ctx)) return;
|
|
1316
|
+
const chatId = msg.chat.id;
|
|
1317
|
+
const runtimeCfg = loadFreshRuntimeConfig();
|
|
1318
|
+
const runtimeTelegramCfg = resolveFreshTelegramConfig(runtimeCfg);
|
|
1319
|
+
const rawText = ctx.match?.trim() ?? "";
|
|
1320
|
+
const commandBody = `/${pluginCommand.command}${rawText ? ` ${rawText}` : ""}`;
|
|
1321
|
+
const nativeCommandRuntime = await loadTelegramNativeCommandRuntime();
|
|
1322
|
+
const match = nativeCommandRuntime.matchPluginCommand(commandBody);
|
|
1323
|
+
if (!match) {
|
|
1324
|
+
await withTelegramApiErrorLogging({
|
|
1325
|
+
operation: "sendMessage",
|
|
1326
|
+
runtime,
|
|
1327
|
+
fn: () => bot.api.sendMessage(chatId, "Command not found.")
|
|
1328
|
+
});
|
|
1329
|
+
return;
|
|
1330
|
+
}
|
|
1331
|
+
const auth = await resolveTelegramCommandAuth({
|
|
1332
|
+
msg,
|
|
1333
|
+
bot,
|
|
1334
|
+
cfg: runtimeCfg,
|
|
1335
|
+
accountId,
|
|
1336
|
+
telegramCfg: runtimeTelegramCfg,
|
|
1337
|
+
readChannelAllowFromStore: telegramDeps.readChannelAllowFromStore,
|
|
1338
|
+
allowFrom,
|
|
1339
|
+
groupAllowFrom,
|
|
1340
|
+
useAccessGroups,
|
|
1341
|
+
resolveGroupPolicy,
|
|
1342
|
+
resolveTelegramGroupConfig,
|
|
1343
|
+
requireAuth: match.command.requireAuth !== false
|
|
1344
|
+
});
|
|
1345
|
+
if (!auth) return;
|
|
1346
|
+
const { senderId, commandAuthorized, isGroup, isForum, resolvedThreadId } = auth;
|
|
1347
|
+
const runtimeContext = await resolveCommandRuntimeContext({
|
|
1348
|
+
msg,
|
|
1349
|
+
runtimeCfg,
|
|
1350
|
+
isGroup,
|
|
1351
|
+
isForum,
|
|
1352
|
+
resolvedThreadId,
|
|
1353
|
+
senderId,
|
|
1354
|
+
topicAgentId: auth.topicConfig?.agentId
|
|
1355
|
+
});
|
|
1356
|
+
if (!runtimeContext) return;
|
|
1357
|
+
const { threadSpec, route, mediaLocalRoots, tableMode, chunkMode } = runtimeContext;
|
|
1358
|
+
const deliveryBaseOptions = buildCommandDeliveryBaseOptions({
|
|
1359
|
+
chatId,
|
|
1360
|
+
accountId: route.accountId,
|
|
1361
|
+
sessionKeyForInternalHooks: route.sessionKey,
|
|
1362
|
+
mirrorIsGroup: isGroup,
|
|
1363
|
+
mirrorGroupId: isGroup ? String(chatId) : void 0,
|
|
1364
|
+
mediaLocalRoots,
|
|
1365
|
+
threadSpec,
|
|
1366
|
+
tableMode,
|
|
1367
|
+
chunkMode,
|
|
1368
|
+
linkPreview: runtimeTelegramCfg.linkPreview
|
|
1369
|
+
});
|
|
1370
|
+
const from = isGroup ? buildTelegramGroupFrom(chatId, threadSpec.id) : `telegram:${chatId}`;
|
|
1371
|
+
const to = `telegram:${chatId}`;
|
|
1372
|
+
const { deliverReplies, emitTelegramMessageSentHooks } = await loadTelegramNativeCommandDeliveryRuntime();
|
|
1373
|
+
let progressMessageId;
|
|
1374
|
+
const progressPlaceholder = resolveTelegramProgressPlaceholder(match.command);
|
|
1375
|
+
if (progressPlaceholder) try {
|
|
1376
|
+
const maybeMessageId = (await withTelegramApiErrorLogging({
|
|
1377
|
+
operation: "sendMessage",
|
|
1378
|
+
runtime,
|
|
1379
|
+
fn: () => bot.api.sendMessage(chatId, progressPlaceholder, buildTelegramThreadParams(threadSpec))
|
|
1380
|
+
}))?.message_id;
|
|
1381
|
+
if (typeof maybeMessageId === "number") progressMessageId = maybeMessageId;
|
|
1382
|
+
} catch {}
|
|
1383
|
+
const result = await nativeCommandRuntime.executePluginCommand({
|
|
1384
|
+
command: match.command,
|
|
1385
|
+
args: match.args,
|
|
1386
|
+
senderId,
|
|
1387
|
+
channel: "telegram",
|
|
1388
|
+
isAuthorizedSender: commandAuthorized,
|
|
1389
|
+
sessionKey: route.sessionKey,
|
|
1390
|
+
commandBody,
|
|
1391
|
+
config: runtimeCfg,
|
|
1392
|
+
from,
|
|
1393
|
+
to,
|
|
1394
|
+
accountId,
|
|
1395
|
+
messageThreadId: threadSpec.id
|
|
1396
|
+
});
|
|
1397
|
+
if (shouldSuppressLocalTelegramExecApprovalPrompt({
|
|
1398
|
+
cfg: runtimeCfg,
|
|
1399
|
+
accountId: route.accountId,
|
|
1400
|
+
payload: result
|
|
1401
|
+
})) {
|
|
1402
|
+
await cleanupTelegramProgressPlaceholder({
|
|
1403
|
+
bot,
|
|
1404
|
+
chatId,
|
|
1405
|
+
progressMessageId,
|
|
1406
|
+
runtime
|
|
1407
|
+
});
|
|
1408
|
+
return;
|
|
1409
|
+
}
|
|
1410
|
+
const progressResultText = typeof result.text === "string" && result.text.trim().length > 0 ? result.text : null;
|
|
1411
|
+
const telegramResultData = resolveTelegramNativeReplyChannelData(result);
|
|
1412
|
+
if (progressMessageId != null && telegramDeps.editMessageTelegram && progressResultText && isEditableTelegramProgressResult(result)) try {
|
|
1413
|
+
await telegramDeps.editMessageTelegram(chatId, progressMessageId, progressResultText, {
|
|
1414
|
+
cfg: runtimeCfg,
|
|
1415
|
+
accountId: route.accountId,
|
|
1416
|
+
textMode: "markdown",
|
|
1417
|
+
linkPreview: runtimeTelegramCfg.linkPreview,
|
|
1418
|
+
buttons: telegramResultData?.buttons
|
|
1419
|
+
});
|
|
1420
|
+
recordSentMessage(chatId, progressMessageId);
|
|
1421
|
+
emitTelegramMessageSentHooks({
|
|
1422
|
+
sessionKeyForInternalHooks: route.sessionKey,
|
|
1423
|
+
chatId: String(chatId),
|
|
1424
|
+
accountId: route.accountId,
|
|
1425
|
+
content: progressResultText,
|
|
1426
|
+
success: true,
|
|
1427
|
+
messageId: progressMessageId,
|
|
1428
|
+
isGroup,
|
|
1429
|
+
groupId: isGroup ? String(chatId) : void 0
|
|
1430
|
+
});
|
|
1431
|
+
return;
|
|
1432
|
+
} catch {}
|
|
1433
|
+
await cleanupTelegramProgressPlaceholder({
|
|
1434
|
+
bot,
|
|
1435
|
+
chatId,
|
|
1436
|
+
progressMessageId,
|
|
1437
|
+
runtime
|
|
1438
|
+
});
|
|
1439
|
+
await deliverReplies({
|
|
1440
|
+
replies: [result],
|
|
1441
|
+
...deliveryBaseOptions,
|
|
1442
|
+
silent: runtimeTelegramCfg.silentErrorReplies === true && result.isError === true
|
|
1443
|
+
});
|
|
1444
|
+
});
|
|
1445
|
+
} else if (nativeDisabledExplicit) withTelegramApiErrorLogging({
|
|
1446
|
+
operation: "setMyCommands",
|
|
1447
|
+
runtime,
|
|
1448
|
+
fn: () => bot.api.setMyCommands([])
|
|
1449
|
+
}).catch(() => {});
|
|
1450
|
+
};
|
|
1451
|
+
//#endregion
|
|
1452
|
+
//#region extensions/telegram/src/bot-updates.ts
|
|
1453
|
+
const RECENT_TELEGRAM_UPDATE_TTL_MS = 5 * 6e4;
|
|
1454
|
+
const RECENT_TELEGRAM_UPDATE_MAX = 2e3;
|
|
1455
|
+
const resolveTelegramUpdateId = (ctx) => ctx.update?.update_id ?? ctx.update_id;
|
|
1456
|
+
const buildTelegramUpdateKey = (ctx) => {
|
|
1457
|
+
const updateId = resolveTelegramUpdateId(ctx);
|
|
1458
|
+
if (typeof updateId === "number") return `update:${updateId}`;
|
|
1459
|
+
const callbackId = ctx.callbackQuery?.id;
|
|
1460
|
+
if (callbackId) return `callback:${callbackId}`;
|
|
1461
|
+
const msg = ctx.message ?? ctx.channelPost ?? ctx.editedChannelPost ?? ctx.update?.message ?? ctx.update?.edited_message ?? ctx.update?.channel_post ?? ctx.update?.edited_channel_post ?? ctx.callbackQuery?.message;
|
|
1462
|
+
const chatId = msg?.chat?.id;
|
|
1463
|
+
const messageId = msg?.message_id;
|
|
1464
|
+
if (typeof chatId !== "undefined" && typeof messageId === "number") return `message:${chatId}:${messageId}`;
|
|
1465
|
+
};
|
|
1466
|
+
const createTelegramUpdateDedupe = () => createDedupeCache({
|
|
1467
|
+
ttlMs: RECENT_TELEGRAM_UPDATE_TTL_MS,
|
|
1468
|
+
maxSize: RECENT_TELEGRAM_UPDATE_MAX
|
|
1469
|
+
});
|
|
1470
|
+
//#endregion
|
|
1471
|
+
//#region extensions/telegram/src/group-migration.ts
|
|
1472
|
+
function resolveAccountGroups(cfg, accountId) {
|
|
1473
|
+
if (!accountId) return {};
|
|
1474
|
+
const normalized = normalizeAccountId(accountId);
|
|
1475
|
+
const accounts = cfg.channels?.telegram?.accounts;
|
|
1476
|
+
if (!accounts || typeof accounts !== "object") return {};
|
|
1477
|
+
const exact = accounts[normalized];
|
|
1478
|
+
if (exact?.groups) return { groups: exact.groups };
|
|
1479
|
+
const matchKey = Object.keys(accounts).find((key) => key.toLowerCase() === normalized.toLowerCase());
|
|
1480
|
+
return { groups: matchKey ? accounts[matchKey]?.groups : void 0 };
|
|
1481
|
+
}
|
|
1482
|
+
function migrateTelegramGroupsInPlace(groups, oldChatId, newChatId) {
|
|
1483
|
+
if (!groups) return {
|
|
1484
|
+
migrated: false,
|
|
1485
|
+
skippedExisting: false
|
|
1486
|
+
};
|
|
1487
|
+
if (oldChatId === newChatId) return {
|
|
1488
|
+
migrated: false,
|
|
1489
|
+
skippedExisting: false
|
|
1490
|
+
};
|
|
1491
|
+
if (!Object.hasOwn(groups, oldChatId)) return {
|
|
1492
|
+
migrated: false,
|
|
1493
|
+
skippedExisting: false
|
|
1494
|
+
};
|
|
1495
|
+
if (Object.hasOwn(groups, newChatId)) return {
|
|
1496
|
+
migrated: false,
|
|
1497
|
+
skippedExisting: true
|
|
1498
|
+
};
|
|
1499
|
+
groups[newChatId] = groups[oldChatId];
|
|
1500
|
+
delete groups[oldChatId];
|
|
1501
|
+
return {
|
|
1502
|
+
migrated: true,
|
|
1503
|
+
skippedExisting: false
|
|
1504
|
+
};
|
|
1505
|
+
}
|
|
1506
|
+
function migrateTelegramGroupConfig(params) {
|
|
1507
|
+
const scopes = [];
|
|
1508
|
+
let migrated = false;
|
|
1509
|
+
let skippedExisting = false;
|
|
1510
|
+
const migrationTargets = [{
|
|
1511
|
+
scope: "account",
|
|
1512
|
+
groups: resolveAccountGroups(params.cfg, params.accountId).groups
|
|
1513
|
+
}, {
|
|
1514
|
+
scope: "global",
|
|
1515
|
+
groups: params.cfg.channels?.telegram?.groups
|
|
1516
|
+
}];
|
|
1517
|
+
for (const target of migrationTargets) {
|
|
1518
|
+
const result = migrateTelegramGroupsInPlace(target.groups, params.oldChatId, params.newChatId);
|
|
1519
|
+
if (result.migrated) {
|
|
1520
|
+
migrated = true;
|
|
1521
|
+
scopes.push(target.scope);
|
|
1522
|
+
}
|
|
1523
|
+
if (result.skippedExisting) skippedExisting = true;
|
|
1524
|
+
}
|
|
1525
|
+
return {
|
|
1526
|
+
migrated,
|
|
1527
|
+
skippedExisting,
|
|
1528
|
+
scopes
|
|
1529
|
+
};
|
|
1530
|
+
}
|
|
1531
|
+
//#endregion
|
|
1532
|
+
//#region extensions/telegram/src/bot-handlers.runtime.ts
|
|
1533
|
+
const registerTelegramHandlers = ({ cfg, accountId, bot, opts, telegramTransport, runtime, mediaMaxBytes, telegramCfg, allowFrom, groupAllowFrom, resolveGroupPolicy, resolveTelegramGroupConfig, shouldSkipUpdate, processMessage, logger, telegramDeps = defaultTelegramBotDeps }) => {
|
|
1534
|
+
const DEFAULT_TEXT_FRAGMENT_MAX_GAP_MS = 1500;
|
|
1535
|
+
const TELEGRAM_TEXT_FRAGMENT_START_THRESHOLD_CHARS = 4e3;
|
|
1536
|
+
const TELEGRAM_TEXT_FRAGMENT_MAX_GAP_MS = typeof opts.testTimings?.textFragmentGapMs === "number" && Number.isFinite(opts.testTimings.textFragmentGapMs) ? Math.max(10, Math.floor(opts.testTimings.textFragmentGapMs)) : DEFAULT_TEXT_FRAGMENT_MAX_GAP_MS;
|
|
1537
|
+
const TELEGRAM_TEXT_FRAGMENT_MAX_ID_GAP = 1;
|
|
1538
|
+
const TELEGRAM_TEXT_FRAGMENT_MAX_PARTS = 12;
|
|
1539
|
+
const TELEGRAM_TEXT_FRAGMENT_MAX_TOTAL_CHARS = 5e4;
|
|
1540
|
+
const mediaGroupTimeoutMs = typeof opts.testTimings?.mediaGroupFlushMs === "number" && Number.isFinite(opts.testTimings.mediaGroupFlushMs) ? Math.max(10, Math.floor(opts.testTimings.mediaGroupFlushMs)) : 500;
|
|
1541
|
+
const mediaGroupBuffer = /* @__PURE__ */ new Map();
|
|
1542
|
+
let mediaGroupProcessing = Promise.resolve();
|
|
1543
|
+
const textFragmentBuffer = /* @__PURE__ */ new Map();
|
|
1544
|
+
let textFragmentProcessing = Promise.resolve();
|
|
1545
|
+
const debounceMs = resolveInboundDebounceMs({
|
|
1546
|
+
cfg,
|
|
1547
|
+
channel: "telegram"
|
|
1548
|
+
});
|
|
1549
|
+
const FORWARD_BURST_DEBOUNCE_MS = 80;
|
|
1550
|
+
const resolveTelegramDebounceLane = (msg) => {
|
|
1551
|
+
const forwardMeta = msg;
|
|
1552
|
+
return forwardMeta.forward_origin ?? forwardMeta.forward_from ?? forwardMeta.forward_from_chat ?? forwardMeta.forward_sender_name ?? forwardMeta.forward_date ? "forward" : "default";
|
|
1553
|
+
};
|
|
1554
|
+
const buildSyntheticTextMessage = (params) => ({
|
|
1555
|
+
...params.base,
|
|
1556
|
+
...params.from ? { from: params.from } : {},
|
|
1557
|
+
text: params.text,
|
|
1558
|
+
caption: void 0,
|
|
1559
|
+
caption_entities: void 0,
|
|
1560
|
+
entities: void 0,
|
|
1561
|
+
...params.date != null ? { date: params.date } : {}
|
|
1562
|
+
});
|
|
1563
|
+
const buildSyntheticContext = (ctx, message) => {
|
|
1564
|
+
const getFile = typeof ctx.getFile === "function" ? ctx.getFile.bind(ctx) : async () => ({});
|
|
1565
|
+
return {
|
|
1566
|
+
message,
|
|
1567
|
+
me: ctx.me,
|
|
1568
|
+
getFile
|
|
1569
|
+
};
|
|
1570
|
+
};
|
|
1571
|
+
const inboundDebouncer = createInboundDebouncer({
|
|
1572
|
+
debounceMs,
|
|
1573
|
+
resolveDebounceMs: (entry) => entry.debounceLane === "forward" ? FORWARD_BURST_DEBOUNCE_MS : debounceMs,
|
|
1574
|
+
buildKey: (entry) => entry.debounceKey,
|
|
1575
|
+
shouldDebounce: (entry) => {
|
|
1576
|
+
const hasDebounceableText = shouldDebounceTextInbound({
|
|
1577
|
+
text: entry.msg.text ?? entry.msg.caption ?? "",
|
|
1578
|
+
cfg,
|
|
1579
|
+
commandOptions: { botUsername: entry.botUsername }
|
|
1580
|
+
});
|
|
1581
|
+
if (entry.debounceLane === "forward") return hasDebounceableText || entry.allMedia.length > 0;
|
|
1582
|
+
if (!hasDebounceableText) return false;
|
|
1583
|
+
return entry.allMedia.length === 0;
|
|
1584
|
+
},
|
|
1585
|
+
onFlush: async (entries) => {
|
|
1586
|
+
const last = entries.at(-1);
|
|
1587
|
+
if (!last) return;
|
|
1588
|
+
if (entries.length === 1) {
|
|
1589
|
+
const replyMedia = await resolveReplyMediaForMessage(last.ctx, last.msg);
|
|
1590
|
+
await processMessage(last.ctx, last.allMedia, last.storeAllowFrom, {
|
|
1591
|
+
receivedAtMs: last.receivedAtMs,
|
|
1592
|
+
ingressBuffer: "inbound-debounce"
|
|
1593
|
+
}, replyMedia);
|
|
1594
|
+
return;
|
|
1595
|
+
}
|
|
1596
|
+
const combinedText = entries.map((entry) => entry.msg.text ?? entry.msg.caption ?? "").filter(Boolean).join("\n");
|
|
1597
|
+
const combinedMedia = entries.flatMap((entry) => entry.allMedia);
|
|
1598
|
+
if (!combinedText.trim() && combinedMedia.length === 0) return;
|
|
1599
|
+
const first = entries[0];
|
|
1600
|
+
const baseCtx = first.ctx;
|
|
1601
|
+
const syntheticMessage = buildSyntheticTextMessage({
|
|
1602
|
+
base: first.msg,
|
|
1603
|
+
text: combinedText,
|
|
1604
|
+
date: last.msg.date ?? first.msg.date
|
|
1605
|
+
});
|
|
1606
|
+
const messageIdOverride = last.msg.message_id ? String(last.msg.message_id) : void 0;
|
|
1607
|
+
const syntheticCtx = buildSyntheticContext(baseCtx, syntheticMessage);
|
|
1608
|
+
const replyMedia = await resolveReplyMediaForMessage(baseCtx, syntheticMessage);
|
|
1609
|
+
await processMessage(syntheticCtx, combinedMedia, first.storeAllowFrom, {
|
|
1610
|
+
...messageIdOverride ? { messageIdOverride } : {},
|
|
1611
|
+
receivedAtMs: first.receivedAtMs,
|
|
1612
|
+
ingressBuffer: "inbound-debounce"
|
|
1613
|
+
}, replyMedia);
|
|
1614
|
+
},
|
|
1615
|
+
onError: (err, items) => {
|
|
1616
|
+
runtime.error?.(danger(`telegram debounce flush failed: ${String(err)}`));
|
|
1617
|
+
const chatId = items[0]?.msg.chat.id;
|
|
1618
|
+
if (chatId != null) {
|
|
1619
|
+
const threadId = items[0]?.msg.message_thread_id;
|
|
1620
|
+
bot.api.sendMessage(chatId, "Something went wrong while processing your message. Please try again.", threadId != null ? { message_thread_id: threadId } : void 0).catch((sendErr) => {
|
|
1621
|
+
logVerbose(`telegram: error fallback send failed: ${String(sendErr)}`);
|
|
1622
|
+
});
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
});
|
|
1626
|
+
const resolveTelegramSessionState = (params) => {
|
|
1627
|
+
const runtimeCfg = telegramDeps.loadConfig();
|
|
1628
|
+
const resolvedThreadId = params.resolvedThreadId ?? resolveTelegramForumThreadId({
|
|
1629
|
+
isForum: params.isForum,
|
|
1630
|
+
messageThreadId: params.messageThreadId
|
|
1631
|
+
});
|
|
1632
|
+
const dmThreadId = !params.isGroup ? params.messageThreadId : void 0;
|
|
1633
|
+
const topicThreadId = resolvedThreadId ?? dmThreadId;
|
|
1634
|
+
const { topicConfig } = resolveTelegramGroupConfig(params.chatId, topicThreadId);
|
|
1635
|
+
const { route } = resolveTelegramConversationRoute({
|
|
1636
|
+
cfg: runtimeCfg,
|
|
1637
|
+
accountId,
|
|
1638
|
+
chatId: params.chatId,
|
|
1639
|
+
isGroup: params.isGroup,
|
|
1640
|
+
resolvedThreadId,
|
|
1641
|
+
replyThreadId: topicThreadId,
|
|
1642
|
+
senderId: params.senderId,
|
|
1643
|
+
topicAgentId: topicConfig?.agentId
|
|
1644
|
+
});
|
|
1645
|
+
const baseSessionKey = resolveTelegramConversationBaseSessionKey({
|
|
1646
|
+
cfg: runtimeCfg,
|
|
1647
|
+
route,
|
|
1648
|
+
chatId: params.chatId,
|
|
1649
|
+
isGroup: params.isGroup,
|
|
1650
|
+
senderId: params.senderId
|
|
1651
|
+
});
|
|
1652
|
+
const sessionKey = (dmThreadId != null ? resolveThreadSessionKeys({
|
|
1653
|
+
baseSessionKey,
|
|
1654
|
+
threadId: `${params.chatId}:${dmThreadId}`
|
|
1655
|
+
}) : null)?.sessionKey ?? baseSessionKey;
|
|
1656
|
+
const store = loadSessionStore(telegramDeps.resolveStorePath(runtimeCfg.session?.store, { agentId: route.agentId }));
|
|
1657
|
+
const entry = resolveSessionStoreEntry({
|
|
1658
|
+
store,
|
|
1659
|
+
sessionKey
|
|
1660
|
+
}).existing;
|
|
1661
|
+
const storedOverride = resolveStoredModelOverride({
|
|
1662
|
+
sessionEntry: entry,
|
|
1663
|
+
sessionStore: store,
|
|
1664
|
+
sessionKey
|
|
1665
|
+
});
|
|
1666
|
+
if (storedOverride) return {
|
|
1667
|
+
agentId: route.agentId,
|
|
1668
|
+
sessionEntry: entry,
|
|
1669
|
+
sessionKey,
|
|
1670
|
+
model: storedOverride.provider ? `${storedOverride.provider}/${storedOverride.model}` : storedOverride.model
|
|
1671
|
+
};
|
|
1672
|
+
const provider = entry?.modelProvider?.trim();
|
|
1673
|
+
const model = entry?.model?.trim();
|
|
1674
|
+
if (provider && model) return {
|
|
1675
|
+
agentId: route.agentId,
|
|
1676
|
+
sessionEntry: entry,
|
|
1677
|
+
sessionKey,
|
|
1678
|
+
model: `${provider}/${model}`
|
|
1679
|
+
};
|
|
1680
|
+
const modelCfg = runtimeCfg.agents?.defaults?.model;
|
|
1681
|
+
return {
|
|
1682
|
+
agentId: route.agentId,
|
|
1683
|
+
sessionEntry: entry,
|
|
1684
|
+
sessionKey,
|
|
1685
|
+
model: typeof modelCfg === "string" ? modelCfg : modelCfg?.primary
|
|
1686
|
+
};
|
|
1687
|
+
};
|
|
1688
|
+
const processMediaGroup = async (entry) => {
|
|
1689
|
+
try {
|
|
1690
|
+
entry.messages.sort((a, b) => a.msg.message_id - b.msg.message_id);
|
|
1691
|
+
const primaryEntry = entry.messages.find((m) => m.msg.caption || m.msg.text) ?? entry.messages[0];
|
|
1692
|
+
const allMedia = [];
|
|
1693
|
+
for (const { ctx } of entry.messages) {
|
|
1694
|
+
let media;
|
|
1695
|
+
try {
|
|
1696
|
+
media = await resolveMedia(ctx, mediaMaxBytes, opts.token, telegramTransport, telegramCfg.apiRoot);
|
|
1697
|
+
} catch (mediaErr) {
|
|
1698
|
+
if (!isRecoverableMediaGroupError(mediaErr)) throw mediaErr;
|
|
1699
|
+
runtime.log?.(warn(`media group: skipping photo that failed to fetch: ${String(mediaErr)}`));
|
|
1700
|
+
continue;
|
|
1701
|
+
}
|
|
1702
|
+
if (media) allMedia.push({
|
|
1703
|
+
path: media.path,
|
|
1704
|
+
contentType: media.contentType,
|
|
1705
|
+
stickerMetadata: media.stickerMetadata
|
|
1706
|
+
});
|
|
1707
|
+
}
|
|
1708
|
+
const storeAllowFrom = await loadStoreAllowFrom();
|
|
1709
|
+
const replyMedia = await resolveReplyMediaForMessage(primaryEntry.ctx, primaryEntry.msg);
|
|
1710
|
+
await processMessage(primaryEntry.ctx, allMedia, storeAllowFrom, void 0, replyMedia);
|
|
1711
|
+
} catch (err) {
|
|
1712
|
+
runtime.error?.(danger(`media group handler failed: ${String(err)}`));
|
|
1713
|
+
}
|
|
1714
|
+
};
|
|
1715
|
+
const flushTextFragments = async (entry) => {
|
|
1716
|
+
try {
|
|
1717
|
+
entry.messages.sort((a, b) => a.msg.message_id - b.msg.message_id);
|
|
1718
|
+
const first = entry.messages[0];
|
|
1719
|
+
const last = entry.messages.at(-1);
|
|
1720
|
+
if (!first || !last) return;
|
|
1721
|
+
const combinedText = entry.messages.map((m) => m.msg.text ?? "").join("");
|
|
1722
|
+
if (!combinedText.trim()) return;
|
|
1723
|
+
const syntheticMessage = buildSyntheticTextMessage({
|
|
1724
|
+
base: first.msg,
|
|
1725
|
+
text: combinedText,
|
|
1726
|
+
date: last.msg.date ?? first.msg.date
|
|
1727
|
+
});
|
|
1728
|
+
const storeAllowFrom = await loadStoreAllowFrom();
|
|
1729
|
+
const baseCtx = first.ctx;
|
|
1730
|
+
await processMessage(buildSyntheticContext(baseCtx, syntheticMessage), [], storeAllowFrom, {
|
|
1731
|
+
messageIdOverride: String(last.msg.message_id),
|
|
1732
|
+
receivedAtMs: first.receivedAtMs,
|
|
1733
|
+
ingressBuffer: "text-fragment"
|
|
1734
|
+
});
|
|
1735
|
+
} catch (err) {
|
|
1736
|
+
runtime.error?.(danger(`text fragment handler failed: ${String(err)}`));
|
|
1737
|
+
}
|
|
1738
|
+
};
|
|
1739
|
+
const queueTextFragmentFlush = async (entry) => {
|
|
1740
|
+
textFragmentProcessing = textFragmentProcessing.then(async () => {
|
|
1741
|
+
await flushTextFragments(entry);
|
|
1742
|
+
}).catch(() => void 0);
|
|
1743
|
+
await textFragmentProcessing;
|
|
1744
|
+
};
|
|
1745
|
+
const runTextFragmentFlush = async (entry) => {
|
|
1746
|
+
textFragmentBuffer.delete(entry.key);
|
|
1747
|
+
await queueTextFragmentFlush(entry);
|
|
1748
|
+
};
|
|
1749
|
+
const scheduleTextFragmentFlush = (entry) => {
|
|
1750
|
+
clearTimeout(entry.timer);
|
|
1751
|
+
entry.timer = setTimeout(async () => {
|
|
1752
|
+
await runTextFragmentFlush(entry);
|
|
1753
|
+
}, TELEGRAM_TEXT_FRAGMENT_MAX_GAP_MS);
|
|
1754
|
+
};
|
|
1755
|
+
const loadStoreAllowFrom = async () => telegramDeps.readChannelAllowFromStore("telegram", process.env, accountId).catch(() => []);
|
|
1756
|
+
const resolveReplyMediaForMessage = async (ctx, msg) => {
|
|
1757
|
+
const replyMessage = msg.reply_to_message;
|
|
1758
|
+
if (!replyMessage || !hasInboundMedia(replyMessage)) return [];
|
|
1759
|
+
const replyFileId = resolveInboundMediaFileId(replyMessage);
|
|
1760
|
+
if (!replyFileId) return [];
|
|
1761
|
+
try {
|
|
1762
|
+
const media = await resolveMedia({
|
|
1763
|
+
message: replyMessage,
|
|
1764
|
+
me: ctx.me,
|
|
1765
|
+
getFile: async () => await bot.api.getFile(replyFileId)
|
|
1766
|
+
}, mediaMaxBytes, opts.token, telegramTransport, telegramCfg.apiRoot);
|
|
1767
|
+
if (!media) return [];
|
|
1768
|
+
return [{
|
|
1769
|
+
path: media.path,
|
|
1770
|
+
contentType: media.contentType,
|
|
1771
|
+
stickerMetadata: media.stickerMetadata
|
|
1772
|
+
}];
|
|
1773
|
+
} catch (err) {
|
|
1774
|
+
logger.warn({
|
|
1775
|
+
chatId: msg.chat.id,
|
|
1776
|
+
error: String(err)
|
|
1777
|
+
}, "reply media fetch failed");
|
|
1778
|
+
return [];
|
|
1779
|
+
}
|
|
1780
|
+
};
|
|
1781
|
+
const isAllowlistAuthorized = (allow, senderId, senderUsername) => allow.hasWildcard || allow.hasEntries && isSenderAllowed({
|
|
1782
|
+
allow,
|
|
1783
|
+
senderId,
|
|
1784
|
+
senderUsername
|
|
1785
|
+
});
|
|
1786
|
+
const shouldSkipGroupMessage = (params) => {
|
|
1787
|
+
const { isGroup, chatId, chatTitle, resolvedThreadId, senderId, senderUsername, effectiveGroupAllow, hasGroupAllowOverride, groupConfig, topicConfig } = params;
|
|
1788
|
+
const baseAccess = evaluateTelegramGroupBaseAccess({
|
|
1789
|
+
isGroup,
|
|
1790
|
+
groupConfig,
|
|
1791
|
+
topicConfig,
|
|
1792
|
+
hasGroupAllowOverride,
|
|
1793
|
+
effectiveGroupAllow,
|
|
1794
|
+
senderId,
|
|
1795
|
+
senderUsername,
|
|
1796
|
+
enforceAllowOverride: true,
|
|
1797
|
+
requireSenderForAllowOverride: true
|
|
1798
|
+
});
|
|
1799
|
+
if (!baseAccess.allowed) {
|
|
1800
|
+
if (baseAccess.reason === "group-disabled") {
|
|
1801
|
+
logVerbose(`Blocked telegram group ${chatId} (group disabled)`);
|
|
1802
|
+
return true;
|
|
1803
|
+
}
|
|
1804
|
+
if (baseAccess.reason === "topic-disabled") {
|
|
1805
|
+
logVerbose(`Blocked telegram topic ${chatId} (${resolvedThreadId ?? "unknown"}) (topic disabled)`);
|
|
1806
|
+
return true;
|
|
1807
|
+
}
|
|
1808
|
+
logVerbose(`Blocked telegram group sender ${senderId || "unknown"} (group allowFrom override)`);
|
|
1809
|
+
return true;
|
|
1810
|
+
}
|
|
1811
|
+
if (!isGroup) return false;
|
|
1812
|
+
const policyAccess = evaluateTelegramGroupPolicyAccess({
|
|
1813
|
+
isGroup,
|
|
1814
|
+
chatId,
|
|
1815
|
+
cfg,
|
|
1816
|
+
telegramCfg,
|
|
1817
|
+
topicConfig,
|
|
1818
|
+
groupConfig,
|
|
1819
|
+
effectiveGroupAllow,
|
|
1820
|
+
senderId,
|
|
1821
|
+
senderUsername,
|
|
1822
|
+
resolveGroupPolicy,
|
|
1823
|
+
enforcePolicy: true,
|
|
1824
|
+
useTopicAndGroupOverrides: true,
|
|
1825
|
+
enforceAllowlistAuthorization: true,
|
|
1826
|
+
allowEmptyAllowlistEntries: false,
|
|
1827
|
+
requireSenderForAllowlistAuthorization: true,
|
|
1828
|
+
checkChatAllowlist: true
|
|
1829
|
+
});
|
|
1830
|
+
if (!policyAccess.allowed) {
|
|
1831
|
+
if (policyAccess.reason === "group-policy-disabled") {
|
|
1832
|
+
logVerbose("Blocked telegram group message (groupPolicy: disabled)");
|
|
1833
|
+
return true;
|
|
1834
|
+
}
|
|
1835
|
+
if (policyAccess.reason === "group-policy-allowlist-no-sender") {
|
|
1836
|
+
logVerbose("Blocked telegram group message (no sender ID, groupPolicy: allowlist)");
|
|
1837
|
+
return true;
|
|
1838
|
+
}
|
|
1839
|
+
if (policyAccess.reason === "group-policy-allowlist-empty") {
|
|
1840
|
+
logVerbose("Blocked telegram group message (groupPolicy: allowlist, no group allowlist entries)");
|
|
1841
|
+
return true;
|
|
1842
|
+
}
|
|
1843
|
+
if (policyAccess.reason === "group-policy-allowlist-unauthorized") {
|
|
1844
|
+
logVerbose(`Blocked telegram group message from ${senderId} (groupPolicy: allowlist)`);
|
|
1845
|
+
return true;
|
|
1846
|
+
}
|
|
1847
|
+
logger.info({
|
|
1848
|
+
chatId,
|
|
1849
|
+
title: chatTitle,
|
|
1850
|
+
reason: "not-allowed"
|
|
1851
|
+
}, "skipping group message");
|
|
1852
|
+
return true;
|
|
1853
|
+
}
|
|
1854
|
+
return false;
|
|
1855
|
+
};
|
|
1856
|
+
const getChat = typeof bot.api.getChat === "function" ? bot.api.getChat.bind(bot.api) : void 0;
|
|
1857
|
+
const TELEGRAM_EVENT_AUTH_RULES = {
|
|
1858
|
+
reaction: {
|
|
1859
|
+
enforceDirectAuthorization: true,
|
|
1860
|
+
enforceGroupAllowlistAuthorization: false,
|
|
1861
|
+
deniedDmReason: "reaction unauthorized by dm policy/allowlist",
|
|
1862
|
+
deniedGroupReason: "reaction unauthorized by group allowlist"
|
|
1863
|
+
},
|
|
1864
|
+
"callback-scope": {
|
|
1865
|
+
enforceDirectAuthorization: false,
|
|
1866
|
+
enforceGroupAllowlistAuthorization: false,
|
|
1867
|
+
deniedDmReason: "callback unauthorized by inlineButtonsScope",
|
|
1868
|
+
deniedGroupReason: "callback unauthorized by inlineButtonsScope"
|
|
1869
|
+
},
|
|
1870
|
+
"callback-allowlist": {
|
|
1871
|
+
enforceDirectAuthorization: true,
|
|
1872
|
+
enforceGroupAllowlistAuthorization: false,
|
|
1873
|
+
deniedDmReason: "callback unauthorized by inlineButtonsScope allowlist",
|
|
1874
|
+
deniedGroupReason: "callback unauthorized by inlineButtonsScope allowlist"
|
|
1875
|
+
}
|
|
1876
|
+
};
|
|
1877
|
+
const resolveTelegramEventAuthorizationContext = async (params) => {
|
|
1878
|
+
const groupAllowContext = params.groupAllowContext ?? await resolveTelegramGroupAllowFromContext({
|
|
1879
|
+
chatId: params.chatId,
|
|
1880
|
+
accountId,
|
|
1881
|
+
isGroup: params.isGroup,
|
|
1882
|
+
isForum: params.isForum,
|
|
1883
|
+
messageThreadId: params.messageThreadId,
|
|
1884
|
+
groupAllowFrom,
|
|
1885
|
+
readChannelAllowFromStore: telegramDeps.readChannelAllowFromStore,
|
|
1886
|
+
resolveTelegramGroupConfig
|
|
1887
|
+
});
|
|
1888
|
+
return {
|
|
1889
|
+
dmPolicy: !params.isGroup && groupAllowContext.groupConfig && "dmPolicy" in groupAllowContext.groupConfig ? groupAllowContext.groupConfig.dmPolicy ?? telegramCfg.dmPolicy ?? "pairing" : telegramCfg.dmPolicy ?? "pairing",
|
|
1890
|
+
...groupAllowContext
|
|
1891
|
+
};
|
|
1892
|
+
};
|
|
1893
|
+
const authorizeTelegramEventSender = (params) => {
|
|
1894
|
+
const { chatId, chatTitle, isGroup, senderId, senderUsername, mode, context } = params;
|
|
1895
|
+
const { dmPolicy, resolvedThreadId, storeAllowFrom, groupConfig, topicConfig, groupAllowOverride, effectiveGroupAllow, hasGroupAllowOverride } = context;
|
|
1896
|
+
const { enforceDirectAuthorization, enforceGroupAllowlistAuthorization, deniedDmReason, deniedGroupReason } = TELEGRAM_EVENT_AUTH_RULES[mode];
|
|
1897
|
+
if (shouldSkipGroupMessage({
|
|
1898
|
+
isGroup,
|
|
1899
|
+
chatId,
|
|
1900
|
+
chatTitle,
|
|
1901
|
+
resolvedThreadId,
|
|
1902
|
+
senderId,
|
|
1903
|
+
senderUsername,
|
|
1904
|
+
effectiveGroupAllow,
|
|
1905
|
+
hasGroupAllowOverride,
|
|
1906
|
+
groupConfig,
|
|
1907
|
+
topicConfig
|
|
1908
|
+
})) return {
|
|
1909
|
+
allowed: false,
|
|
1910
|
+
reason: "group-policy"
|
|
1911
|
+
};
|
|
1912
|
+
if (!isGroup && enforceDirectAuthorization) {
|
|
1913
|
+
if (dmPolicy === "disabled") {
|
|
1914
|
+
logVerbose(`Blocked telegram direct event from ${senderId || "unknown"} (${deniedDmReason})`);
|
|
1915
|
+
return {
|
|
1916
|
+
allowed: false,
|
|
1917
|
+
reason: "direct-disabled"
|
|
1918
|
+
};
|
|
1919
|
+
}
|
|
1920
|
+
if (dmPolicy !== "open") {
|
|
1921
|
+
if (!isAllowlistAuthorized(normalizeDmAllowFromWithStore({
|
|
1922
|
+
allowFrom: groupAllowOverride ?? allowFrom,
|
|
1923
|
+
storeAllowFrom,
|
|
1924
|
+
dmPolicy
|
|
1925
|
+
}), senderId, senderUsername)) {
|
|
1926
|
+
logVerbose(`Blocked telegram direct sender ${senderId || "unknown"} (${deniedDmReason})`);
|
|
1927
|
+
return {
|
|
1928
|
+
allowed: false,
|
|
1929
|
+
reason: "direct-unauthorized"
|
|
1930
|
+
};
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
if (isGroup && enforceGroupAllowlistAuthorization) {
|
|
1935
|
+
if (!isAllowlistAuthorized(effectiveGroupAllow, senderId, senderUsername)) {
|
|
1936
|
+
logVerbose(`Blocked telegram group sender ${senderId || "unknown"} (${deniedGroupReason})`);
|
|
1937
|
+
return {
|
|
1938
|
+
allowed: false,
|
|
1939
|
+
reason: "group-unauthorized"
|
|
1940
|
+
};
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
return { allowed: true };
|
|
1944
|
+
};
|
|
1945
|
+
bot.on("message_reaction", async (ctx) => {
|
|
1946
|
+
try {
|
|
1947
|
+
const reaction = ctx.messageReaction;
|
|
1948
|
+
if (!reaction) return;
|
|
1949
|
+
if (shouldSkipUpdate(ctx)) return;
|
|
1950
|
+
const chatId = reaction.chat.id;
|
|
1951
|
+
const messageId = reaction.message_id;
|
|
1952
|
+
const user = reaction.user;
|
|
1953
|
+
const senderId = user?.id != null ? String(user.id) : "";
|
|
1954
|
+
const senderUsername = user?.username ?? "";
|
|
1955
|
+
const isGroup = reaction.chat.type === "group" || reaction.chat.type === "supergroup";
|
|
1956
|
+
const isForum = reaction.chat.is_forum === true;
|
|
1957
|
+
const reactionMode = telegramCfg.reactionNotifications ?? "own";
|
|
1958
|
+
if (reactionMode === "off") return;
|
|
1959
|
+
if (user?.is_bot) return;
|
|
1960
|
+
if (reactionMode === "own" && !telegramDeps.wasSentByBot(chatId, messageId)) {
|
|
1961
|
+
logVerbose(`telegram: skipped reaction on msg ${messageId} in chat ${chatId} (own mode, not sent by bot)`);
|
|
1962
|
+
return;
|
|
1963
|
+
}
|
|
1964
|
+
const eventAuthContext = await resolveTelegramEventAuthorizationContext({
|
|
1965
|
+
chatId,
|
|
1966
|
+
isGroup,
|
|
1967
|
+
isForum
|
|
1968
|
+
});
|
|
1969
|
+
if (!authorizeTelegramEventSender({
|
|
1970
|
+
chatId,
|
|
1971
|
+
chatTitle: reaction.chat.title,
|
|
1972
|
+
isGroup,
|
|
1973
|
+
senderId,
|
|
1974
|
+
senderUsername,
|
|
1975
|
+
mode: "reaction",
|
|
1976
|
+
context: eventAuthContext
|
|
1977
|
+
}).allowed) return;
|
|
1978
|
+
if (!isGroup) {
|
|
1979
|
+
if (eventAuthContext.groupConfig?.requireTopic === true) {
|
|
1980
|
+
logVerbose(`Blocked telegram reaction in DM ${chatId}: requireTopic=true but topic unknown for reactions`);
|
|
1981
|
+
return;
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
const oldEmojis = new Set(reaction.old_reaction.filter((r) => r.type === "emoji").map((r) => r.emoji));
|
|
1985
|
+
const addedReactions = reaction.new_reaction.filter((r) => r.type === "emoji").filter((r) => !oldEmojis.has(r.emoji));
|
|
1986
|
+
if (addedReactions.length === 0) return;
|
|
1987
|
+
const senderName = user ? [user.first_name, user.last_name].filter(Boolean).join(" ").trim() || user.username : void 0;
|
|
1988
|
+
const senderUsernameLabel = user?.username ? `@${user.username}` : void 0;
|
|
1989
|
+
let senderLabel = senderName;
|
|
1990
|
+
if (senderName && senderUsernameLabel) senderLabel = `${senderName} (${senderUsernameLabel})`;
|
|
1991
|
+
else if (!senderName && senderUsernameLabel) senderLabel = senderUsernameLabel;
|
|
1992
|
+
if (!senderLabel && user?.id) senderLabel = `id:${user.id}`;
|
|
1993
|
+
senderLabel = senderLabel || "unknown";
|
|
1994
|
+
const resolvedThreadId = isForum ? resolveTelegramForumThreadId({
|
|
1995
|
+
isForum,
|
|
1996
|
+
messageThreadId: void 0
|
|
1997
|
+
}) : void 0;
|
|
1998
|
+
const peerId = isGroup ? buildTelegramGroupPeerId(chatId, resolvedThreadId) : String(chatId);
|
|
1999
|
+
const parentPeer = buildTelegramParentPeer({
|
|
2000
|
+
isGroup,
|
|
2001
|
+
resolvedThreadId,
|
|
2002
|
+
chatId
|
|
2003
|
+
});
|
|
2004
|
+
const sessionKey = resolveAgentRoute({
|
|
2005
|
+
cfg: telegramDeps.loadConfig(),
|
|
2006
|
+
channel: "telegram",
|
|
2007
|
+
accountId,
|
|
2008
|
+
peer: {
|
|
2009
|
+
kind: isGroup ? "group" : "direct",
|
|
2010
|
+
id: peerId
|
|
2011
|
+
},
|
|
2012
|
+
parentPeer
|
|
2013
|
+
}).sessionKey;
|
|
2014
|
+
for (const r of addedReactions) {
|
|
2015
|
+
const emoji = r.emoji;
|
|
2016
|
+
const text = `Telegram reaction added: ${emoji} by ${senderLabel} on msg ${messageId}`;
|
|
2017
|
+
telegramDeps.enqueueSystemEvent(text, {
|
|
2018
|
+
sessionKey,
|
|
2019
|
+
contextKey: `telegram:reaction:add:${chatId}:${messageId}:${user?.id ?? "anon"}:${emoji}`
|
|
2020
|
+
});
|
|
2021
|
+
logVerbose(`telegram: reaction event enqueued: ${text}`);
|
|
2022
|
+
}
|
|
2023
|
+
} catch (err) {
|
|
2024
|
+
runtime.error?.(danger(`telegram reaction handler failed: ${String(err)}`));
|
|
2025
|
+
}
|
|
2026
|
+
});
|
|
2027
|
+
const processInboundMessage = async (params) => {
|
|
2028
|
+
const { ctx, msg, chatId, resolvedThreadId, dmThreadId, storeAllowFrom, sendOversizeWarning, oversizeLogMessage } = params;
|
|
2029
|
+
const text = typeof msg.text === "string" ? msg.text : void 0;
|
|
2030
|
+
const isCommandLike = (text ?? "").trim().startsWith("/");
|
|
2031
|
+
if (text && !isCommandLike) {
|
|
2032
|
+
const nowMs = Date.now();
|
|
2033
|
+
const senderId = msg.from?.id != null ? String(msg.from.id) : "unknown";
|
|
2034
|
+
const key = `text:${chatId}:${resolvedThreadId ?? dmThreadId ?? "main"}:${senderId}`;
|
|
2035
|
+
const existing = textFragmentBuffer.get(key);
|
|
2036
|
+
if (existing) {
|
|
2037
|
+
const last = existing.messages.at(-1);
|
|
2038
|
+
const lastMsgId = last?.msg.message_id;
|
|
2039
|
+
const lastReceivedAtMs = last?.receivedAtMs ?? nowMs;
|
|
2040
|
+
const idGap = typeof lastMsgId === "number" ? msg.message_id - lastMsgId : Infinity;
|
|
2041
|
+
const timeGapMs = nowMs - lastReceivedAtMs;
|
|
2042
|
+
if (idGap > 0 && idGap <= TELEGRAM_TEXT_FRAGMENT_MAX_ID_GAP && timeGapMs >= 0 && timeGapMs <= TELEGRAM_TEXT_FRAGMENT_MAX_GAP_MS) {
|
|
2043
|
+
const nextTotalChars = existing.messages.reduce((sum, m) => sum + (m.msg.text?.length ?? 0), 0) + text.length;
|
|
2044
|
+
if (existing.messages.length + 1 <= TELEGRAM_TEXT_FRAGMENT_MAX_PARTS && nextTotalChars <= TELEGRAM_TEXT_FRAGMENT_MAX_TOTAL_CHARS) {
|
|
2045
|
+
existing.messages.push({
|
|
2046
|
+
msg,
|
|
2047
|
+
ctx,
|
|
2048
|
+
receivedAtMs: nowMs
|
|
2049
|
+
});
|
|
2050
|
+
scheduleTextFragmentFlush(existing);
|
|
2051
|
+
return;
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
clearTimeout(existing.timer);
|
|
2055
|
+
textFragmentBuffer.delete(key);
|
|
2056
|
+
textFragmentProcessing = textFragmentProcessing.then(async () => {
|
|
2057
|
+
await flushTextFragments(existing);
|
|
2058
|
+
}).catch(() => void 0);
|
|
2059
|
+
await textFragmentProcessing;
|
|
2060
|
+
}
|
|
2061
|
+
if (text.length >= TELEGRAM_TEXT_FRAGMENT_START_THRESHOLD_CHARS) {
|
|
2062
|
+
const entry = {
|
|
2063
|
+
key,
|
|
2064
|
+
messages: [{
|
|
2065
|
+
msg,
|
|
2066
|
+
ctx,
|
|
2067
|
+
receivedAtMs: nowMs
|
|
2068
|
+
}],
|
|
2069
|
+
timer: setTimeout(() => {}, TELEGRAM_TEXT_FRAGMENT_MAX_GAP_MS)
|
|
2070
|
+
};
|
|
2071
|
+
textFragmentBuffer.set(key, entry);
|
|
2072
|
+
scheduleTextFragmentFlush(entry);
|
|
2073
|
+
return;
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
const mediaGroupId = msg.media_group_id;
|
|
2077
|
+
if (mediaGroupId) {
|
|
2078
|
+
const existing = mediaGroupBuffer.get(mediaGroupId);
|
|
2079
|
+
if (existing) {
|
|
2080
|
+
clearTimeout(existing.timer);
|
|
2081
|
+
existing.messages.push({
|
|
2082
|
+
msg,
|
|
2083
|
+
ctx
|
|
2084
|
+
});
|
|
2085
|
+
existing.timer = setTimeout(async () => {
|
|
2086
|
+
mediaGroupBuffer.delete(mediaGroupId);
|
|
2087
|
+
mediaGroupProcessing = mediaGroupProcessing.then(async () => {
|
|
2088
|
+
await processMediaGroup(existing);
|
|
2089
|
+
}).catch(() => void 0);
|
|
2090
|
+
await mediaGroupProcessing;
|
|
2091
|
+
}, mediaGroupTimeoutMs);
|
|
2092
|
+
} else {
|
|
2093
|
+
const entry = {
|
|
2094
|
+
messages: [{
|
|
2095
|
+
msg,
|
|
2096
|
+
ctx
|
|
2097
|
+
}],
|
|
2098
|
+
timer: setTimeout(async () => {
|
|
2099
|
+
mediaGroupBuffer.delete(mediaGroupId);
|
|
2100
|
+
mediaGroupProcessing = mediaGroupProcessing.then(async () => {
|
|
2101
|
+
await processMediaGroup(entry);
|
|
2102
|
+
}).catch(() => void 0);
|
|
2103
|
+
await mediaGroupProcessing;
|
|
2104
|
+
}, mediaGroupTimeoutMs)
|
|
2105
|
+
};
|
|
2106
|
+
mediaGroupBuffer.set(mediaGroupId, entry);
|
|
2107
|
+
}
|
|
2108
|
+
return;
|
|
2109
|
+
}
|
|
2110
|
+
let media = null;
|
|
2111
|
+
try {
|
|
2112
|
+
media = await resolveMedia(ctx, mediaMaxBytes, opts.token, telegramTransport, telegramCfg.apiRoot);
|
|
2113
|
+
} catch (mediaErr) {
|
|
2114
|
+
if (isMediaSizeLimitError(mediaErr)) {
|
|
2115
|
+
if (sendOversizeWarning) {
|
|
2116
|
+
const limitMb = Math.round(mediaMaxBytes / (1024 * 1024));
|
|
2117
|
+
await withTelegramApiErrorLogging({
|
|
2118
|
+
operation: "sendMessage",
|
|
2119
|
+
runtime,
|
|
2120
|
+
fn: () => bot.api.sendMessage(chatId, `⚠️ File too large. Maximum size is ${limitMb}MB.`, { reply_parameters: {
|
|
2121
|
+
message_id: msg.message_id,
|
|
2122
|
+
allow_sending_without_reply: true
|
|
2123
|
+
} })
|
|
2124
|
+
}).catch(() => {});
|
|
2125
|
+
}
|
|
2126
|
+
logger.warn({
|
|
2127
|
+
chatId,
|
|
2128
|
+
error: String(mediaErr)
|
|
2129
|
+
}, oversizeLogMessage);
|
|
2130
|
+
return;
|
|
2131
|
+
}
|
|
2132
|
+
logger.warn({
|
|
2133
|
+
chatId,
|
|
2134
|
+
error: String(mediaErr)
|
|
2135
|
+
}, "media fetch failed");
|
|
2136
|
+
await withTelegramApiErrorLogging({
|
|
2137
|
+
operation: "sendMessage",
|
|
2138
|
+
runtime,
|
|
2139
|
+
fn: () => bot.api.sendMessage(chatId, "⚠️ Failed to download media. Please try again.", { reply_parameters: {
|
|
2140
|
+
message_id: msg.message_id,
|
|
2141
|
+
allow_sending_without_reply: true
|
|
2142
|
+
} })
|
|
2143
|
+
}).catch(() => {});
|
|
2144
|
+
return;
|
|
2145
|
+
}
|
|
2146
|
+
const hasText = Boolean(getTelegramTextParts(msg).text.trim());
|
|
2147
|
+
if (msg.sticker && !media && !hasText) {
|
|
2148
|
+
logVerbose("telegram: skipping sticker-only message (unsupported sticker type)");
|
|
2149
|
+
return;
|
|
2150
|
+
}
|
|
2151
|
+
const allMedia = media ? [{
|
|
2152
|
+
path: media.path,
|
|
2153
|
+
contentType: media.contentType,
|
|
2154
|
+
stickerMetadata: media.stickerMetadata
|
|
2155
|
+
}] : [];
|
|
2156
|
+
const senderId = msg.from?.id ? String(msg.from.id) : "";
|
|
2157
|
+
const conversationThreadId = resolvedThreadId ?? dmThreadId;
|
|
2158
|
+
const conversationKey = conversationThreadId != null ? `${chatId}:topic:${conversationThreadId}` : String(chatId);
|
|
2159
|
+
const debounceLane = resolveTelegramDebounceLane(msg);
|
|
2160
|
+
const debounceKey = senderId ? `telegram:${accountId ?? "default"}:${conversationKey}:${senderId}:${debounceLane}` : null;
|
|
2161
|
+
await inboundDebouncer.enqueue({
|
|
2162
|
+
ctx,
|
|
2163
|
+
msg,
|
|
2164
|
+
allMedia,
|
|
2165
|
+
storeAllowFrom,
|
|
2166
|
+
receivedAtMs: Date.now(),
|
|
2167
|
+
debounceKey,
|
|
2168
|
+
debounceLane,
|
|
2169
|
+
botUsername: ctx.me?.username
|
|
2170
|
+
});
|
|
2171
|
+
};
|
|
2172
|
+
bot.on("callback_query", async (ctx) => {
|
|
2173
|
+
const callback = ctx.callbackQuery;
|
|
2174
|
+
if (!callback) return;
|
|
2175
|
+
if (shouldSkipUpdate(ctx)) return;
|
|
2176
|
+
await withTelegramApiErrorLogging({
|
|
2177
|
+
operation: "answerCallbackQuery",
|
|
2178
|
+
runtime,
|
|
2179
|
+
fn: typeof ctx.answerCallbackQuery === "function" ? () => ctx.answerCallbackQuery() : () => bot.api.answerCallbackQuery(callback.id)
|
|
2180
|
+
}).catch(() => {});
|
|
2181
|
+
try {
|
|
2182
|
+
const data = (callback.data ?? "").trim();
|
|
2183
|
+
const callbackMessage = callback.message;
|
|
2184
|
+
if (!data || !callbackMessage) return;
|
|
2185
|
+
const editCallbackMessage = async (text, params) => {
|
|
2186
|
+
if (typeof ctx.editMessageText === "function") return await ctx.editMessageText(text, params);
|
|
2187
|
+
return await bot.api.editMessageText(callbackMessage.chat.id, callbackMessage.message_id, text, params);
|
|
2188
|
+
};
|
|
2189
|
+
const clearCallbackButtons = async () => {
|
|
2190
|
+
const replyMarkup = { reply_markup: { inline_keyboard: [] } };
|
|
2191
|
+
if (typeof ctx.editMessageReplyMarkup === "function") return await ctx.editMessageReplyMarkup(replyMarkup);
|
|
2192
|
+
if (typeof bot.api.editMessageReplyMarkup === "function") return await bot.api.editMessageReplyMarkup(callbackMessage.chat.id, callbackMessage.message_id, replyMarkup);
|
|
2193
|
+
const messageText = callbackMessage.text ?? callbackMessage.caption;
|
|
2194
|
+
if (typeof messageText !== "string" || messageText.trim().length === 0) return;
|
|
2195
|
+
return await editCallbackMessage(messageText, replyMarkup);
|
|
2196
|
+
};
|
|
2197
|
+
const editCallbackButtons = async (buttons) => {
|
|
2198
|
+
const replyMarkup = { reply_markup: buildInlineKeyboard(buttons) ?? { inline_keyboard: [] } };
|
|
2199
|
+
if (typeof ctx.editMessageReplyMarkup === "function") return await ctx.editMessageReplyMarkup(replyMarkup);
|
|
2200
|
+
return await bot.api.editMessageReplyMarkup(callbackMessage.chat.id, callbackMessage.message_id, replyMarkup);
|
|
2201
|
+
};
|
|
2202
|
+
const deleteCallbackMessage = async () => {
|
|
2203
|
+
if (typeof ctx.deleteMessage === "function") return await ctx.deleteMessage();
|
|
2204
|
+
return await bot.api.deleteMessage(callbackMessage.chat.id, callbackMessage.message_id);
|
|
2205
|
+
};
|
|
2206
|
+
const replyToCallbackChat = async (text, params) => {
|
|
2207
|
+
if (typeof ctx.reply === "function") return await ctx.reply(text, params);
|
|
2208
|
+
return await bot.api.sendMessage(callbackMessage.chat.id, text, params);
|
|
2209
|
+
};
|
|
2210
|
+
const chatId = callbackMessage.chat.id;
|
|
2211
|
+
const isGroup = callbackMessage.chat.type === "group" || callbackMessage.chat.type === "supergroup";
|
|
2212
|
+
const approvalCallback = parseExecApprovalCommandText(data);
|
|
2213
|
+
const isApprovalCallback = approvalCallback !== null;
|
|
2214
|
+
const inlineButtonsScope = resolveTelegramInlineButtonsScope({
|
|
2215
|
+
cfg,
|
|
2216
|
+
accountId
|
|
2217
|
+
});
|
|
2218
|
+
const execApprovalButtonsEnabled = isApprovalCallback && shouldEnableTelegramExecApprovalButtons({
|
|
2219
|
+
cfg,
|
|
2220
|
+
accountId,
|
|
2221
|
+
to: String(chatId)
|
|
2222
|
+
});
|
|
2223
|
+
if (!execApprovalButtonsEnabled) {
|
|
2224
|
+
if (inlineButtonsScope === "off") return;
|
|
2225
|
+
if (inlineButtonsScope === "dm" && isGroup) return;
|
|
2226
|
+
if (inlineButtonsScope === "group" && !isGroup) return;
|
|
2227
|
+
}
|
|
2228
|
+
const messageThreadId = callbackMessage.message_thread_id;
|
|
2229
|
+
const isForum = await resolveTelegramForumFlag({
|
|
2230
|
+
chatId,
|
|
2231
|
+
chatType: callbackMessage.chat.type,
|
|
2232
|
+
isGroup,
|
|
2233
|
+
isForum: callbackMessage.chat.is_forum,
|
|
2234
|
+
getChat
|
|
2235
|
+
});
|
|
2236
|
+
const eventAuthContext = await resolveTelegramEventAuthorizationContext({
|
|
2237
|
+
chatId,
|
|
2238
|
+
isGroup,
|
|
2239
|
+
isForum,
|
|
2240
|
+
messageThreadId
|
|
2241
|
+
});
|
|
2242
|
+
const { resolvedThreadId, dmThreadId, storeAllowFrom, groupConfig } = eventAuthContext;
|
|
2243
|
+
const requireTopic = groupConfig?.requireTopic;
|
|
2244
|
+
if (!isGroup && requireTopic === true && dmThreadId == null) {
|
|
2245
|
+
logVerbose(`Blocked telegram callback in DM ${chatId}: requireTopic=true but no topic present`);
|
|
2246
|
+
return;
|
|
2247
|
+
}
|
|
2248
|
+
const senderId = callback.from?.id ? String(callback.from.id) : "";
|
|
2249
|
+
const senderUsername = callback.from?.username ?? "";
|
|
2250
|
+
const authorizationMode = !isGroup || !execApprovalButtonsEnabled && inlineButtonsScope === "allowlist" ? "callback-allowlist" : "callback-scope";
|
|
2251
|
+
if (!authorizeTelegramEventSender({
|
|
2252
|
+
chatId,
|
|
2253
|
+
chatTitle: callbackMessage.chat.title,
|
|
2254
|
+
isGroup,
|
|
2255
|
+
senderId,
|
|
2256
|
+
senderUsername,
|
|
2257
|
+
mode: authorizationMode,
|
|
2258
|
+
context: eventAuthContext
|
|
2259
|
+
}).allowed) return;
|
|
2260
|
+
const callbackThreadId = resolvedThreadId ?? dmThreadId;
|
|
2261
|
+
const callbackConversationId = callbackThreadId != null ? `${chatId}:topic:${callbackThreadId}` : String(chatId);
|
|
2262
|
+
const pluginBindingApproval = parsePluginBindingApprovalCustomId(data);
|
|
2263
|
+
if (pluginBindingApproval) {
|
|
2264
|
+
const resolved = await resolvePluginConversationBindingApproval({
|
|
2265
|
+
approvalId: pluginBindingApproval.approvalId,
|
|
2266
|
+
decision: pluginBindingApproval.decision,
|
|
2267
|
+
senderId: senderId || void 0
|
|
2268
|
+
});
|
|
2269
|
+
await clearCallbackButtons();
|
|
2270
|
+
await replyToCallbackChat(buildPluginBindingResolvedText(resolved));
|
|
2271
|
+
return;
|
|
2272
|
+
}
|
|
2273
|
+
if ((await dispatchPluginInteractiveHandler({
|
|
2274
|
+
channel: "telegram",
|
|
2275
|
+
data,
|
|
2276
|
+
callbackId: callback.id,
|
|
2277
|
+
ctx: {
|
|
2278
|
+
accountId,
|
|
2279
|
+
callbackId: callback.id,
|
|
2280
|
+
conversationId: callbackConversationId,
|
|
2281
|
+
parentConversationId: callbackThreadId != null ? String(chatId) : void 0,
|
|
2282
|
+
senderId: senderId || void 0,
|
|
2283
|
+
senderUsername: senderUsername || void 0,
|
|
2284
|
+
threadId: callbackThreadId,
|
|
2285
|
+
isGroup,
|
|
2286
|
+
isForum,
|
|
2287
|
+
auth: { isAuthorizedSender: true },
|
|
2288
|
+
callbackMessage: {
|
|
2289
|
+
messageId: callbackMessage.message_id,
|
|
2290
|
+
chatId: String(chatId),
|
|
2291
|
+
messageText: callbackMessage.text ?? callbackMessage.caption
|
|
2292
|
+
}
|
|
2293
|
+
},
|
|
2294
|
+
respond: {
|
|
2295
|
+
reply: async ({ text, buttons }) => {
|
|
2296
|
+
await replyToCallbackChat(text, buttons ? { reply_markup: buildInlineKeyboard(buttons) } : void 0);
|
|
2297
|
+
},
|
|
2298
|
+
editMessage: async ({ text, buttons }) => {
|
|
2299
|
+
await editCallbackMessage(text, buttons ? { reply_markup: buildInlineKeyboard(buttons) } : void 0);
|
|
2300
|
+
},
|
|
2301
|
+
editButtons: async ({ buttons }) => {
|
|
2302
|
+
await editCallbackButtons(buttons);
|
|
2303
|
+
},
|
|
2304
|
+
clearButtons: async () => {
|
|
2305
|
+
await clearCallbackButtons();
|
|
2306
|
+
},
|
|
2307
|
+
deleteMessage: async () => {
|
|
2308
|
+
await deleteCallbackMessage();
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
2311
|
+
})).handled) return;
|
|
2312
|
+
const runtimeCfg = telegramDeps.loadConfig();
|
|
2313
|
+
if (approvalCallback) {
|
|
2314
|
+
const isPluginApproval = approvalCallback.approvalId.startsWith("plugin:");
|
|
2315
|
+
const pluginApprovalAuthorizedSender = isTelegramExecApprovalApprover({
|
|
2316
|
+
cfg: runtimeCfg,
|
|
2317
|
+
accountId,
|
|
2318
|
+
senderId
|
|
2319
|
+
});
|
|
2320
|
+
const execApprovalAuthorizedSender = isTelegramExecApprovalAuthorizedSender({
|
|
2321
|
+
cfg: runtimeCfg,
|
|
2322
|
+
accountId,
|
|
2323
|
+
senderId
|
|
2324
|
+
});
|
|
2325
|
+
if (!(isPluginApproval ? pluginApprovalAuthorizedSender : execApprovalAuthorizedSender || pluginApprovalAuthorizedSender)) {
|
|
2326
|
+
logVerbose(`Blocked telegram approval callback from ${senderId || "unknown"} (not authorized)`);
|
|
2327
|
+
return;
|
|
2328
|
+
}
|
|
2329
|
+
try {
|
|
2330
|
+
await (telegramDeps.resolveExecApproval ?? resolveTelegramExecApproval)({
|
|
2331
|
+
cfg: runtimeCfg,
|
|
2332
|
+
approvalId: approvalCallback.approvalId,
|
|
2333
|
+
decision: approvalCallback.decision,
|
|
2334
|
+
senderId,
|
|
2335
|
+
allowPluginFallback: pluginApprovalAuthorizedSender
|
|
2336
|
+
});
|
|
2337
|
+
} catch (resolveErr) {
|
|
2338
|
+
const errStr = String(resolveErr);
|
|
2339
|
+
logVerbose(`telegram: failed to resolve approval callback ${approvalCallback.approvalId}: ${errStr}`);
|
|
2340
|
+
await replyToCallbackChat("❌ Failed to submit approval. Please try again or contact an admin.");
|
|
2341
|
+
return;
|
|
2342
|
+
}
|
|
2343
|
+
try {
|
|
2344
|
+
await clearCallbackButtons();
|
|
2345
|
+
} catch (editErr) {
|
|
2346
|
+
const errStr = String(editErr);
|
|
2347
|
+
if (errStr.includes("message is not modified") || errStr.includes("there is no text in the message to edit")) return;
|
|
2348
|
+
logVerbose(`telegram: failed to clear approval callback buttons: ${errStr}`);
|
|
2349
|
+
}
|
|
2350
|
+
return;
|
|
2351
|
+
}
|
|
2352
|
+
const paginationMatch = data.match(/^commands_page_(\d+|noop)(?::(.+))?$/);
|
|
2353
|
+
if (paginationMatch) {
|
|
2354
|
+
const pageValue = paginationMatch[1];
|
|
2355
|
+
if (pageValue === "noop") return;
|
|
2356
|
+
const page = Number.parseInt(pageValue, 10);
|
|
2357
|
+
if (Number.isNaN(page) || page < 1) return;
|
|
2358
|
+
const agentId = paginationMatch[2]?.trim() || resolveDefaultAgentId(runtimeCfg);
|
|
2359
|
+
const result = buildCommandsMessagePaginated(runtimeCfg, telegramDeps.listSkillCommandsForAgents({
|
|
2360
|
+
cfg: runtimeCfg,
|
|
2361
|
+
agentIds: [agentId]
|
|
2362
|
+
}), {
|
|
2363
|
+
page,
|
|
2364
|
+
surface: "telegram"
|
|
2365
|
+
});
|
|
2366
|
+
const keyboard = result.totalPages > 1 ? buildInlineKeyboard(buildCommandsPaginationKeyboard(result.currentPage, result.totalPages, agentId)) : void 0;
|
|
2367
|
+
try {
|
|
2368
|
+
await editCallbackMessage(result.text, keyboard ? { reply_markup: keyboard } : void 0);
|
|
2369
|
+
} catch (editErr) {
|
|
2370
|
+
if (!String(editErr).includes("message is not modified")) throw editErr;
|
|
2371
|
+
}
|
|
2372
|
+
return;
|
|
2373
|
+
}
|
|
2374
|
+
const modelCallback = parseModelCallbackData(data);
|
|
2375
|
+
if (modelCallback) {
|
|
2376
|
+
const sessionState = resolveTelegramSessionState({
|
|
2377
|
+
chatId,
|
|
2378
|
+
isGroup,
|
|
2379
|
+
isForum,
|
|
2380
|
+
messageThreadId,
|
|
2381
|
+
resolvedThreadId,
|
|
2382
|
+
senderId
|
|
2383
|
+
});
|
|
2384
|
+
const { byProvider, providers } = await telegramDeps.buildModelsProviderData(runtimeCfg, sessionState.agentId);
|
|
2385
|
+
const editMessageWithButtons = async (text, buttons) => {
|
|
2386
|
+
const keyboard = buildInlineKeyboard(buttons);
|
|
2387
|
+
try {
|
|
2388
|
+
await editCallbackMessage(text, keyboard ? { reply_markup: keyboard } : void 0);
|
|
2389
|
+
} catch (editErr) {
|
|
2390
|
+
const errStr = String(editErr);
|
|
2391
|
+
if (errStr.includes("no text in the message")) {
|
|
2392
|
+
try {
|
|
2393
|
+
await deleteCallbackMessage();
|
|
2394
|
+
} catch {}
|
|
2395
|
+
await replyToCallbackChat(text, keyboard ? { reply_markup: keyboard } : void 0);
|
|
2396
|
+
} else if (!errStr.includes("message is not modified")) throw editErr;
|
|
2397
|
+
}
|
|
2398
|
+
};
|
|
2399
|
+
if (modelCallback.type === "providers" || modelCallback.type === "back") {
|
|
2400
|
+
if (providers.length === 0) {
|
|
2401
|
+
await editMessageWithButtons("No providers available.", []);
|
|
2402
|
+
return;
|
|
2403
|
+
}
|
|
2404
|
+
await editMessageWithButtons("Select a provider:", buildProviderKeyboard(providers.map((p) => ({
|
|
2405
|
+
id: p,
|
|
2406
|
+
count: byProvider.get(p)?.size ?? 0
|
|
2407
|
+
}))));
|
|
2408
|
+
return;
|
|
2409
|
+
}
|
|
2410
|
+
if (modelCallback.type === "list") {
|
|
2411
|
+
const { provider, page } = modelCallback;
|
|
2412
|
+
const modelSet = byProvider.get(provider);
|
|
2413
|
+
if (!modelSet || modelSet.size === 0) {
|
|
2414
|
+
const buttons = buildProviderKeyboard(providers.map((p) => ({
|
|
2415
|
+
id: p,
|
|
2416
|
+
count: byProvider.get(p)?.size ?? 0
|
|
2417
|
+
})));
|
|
2418
|
+
await editMessageWithButtons(`Unknown provider: ${provider}\n\nSelect a provider:`, buttons);
|
|
2419
|
+
return;
|
|
2420
|
+
}
|
|
2421
|
+
const models = [...modelSet].toSorted();
|
|
2422
|
+
const pageSize = getModelsPageSize();
|
|
2423
|
+
const totalPages = calculateTotalPages(models.length, pageSize);
|
|
2424
|
+
const safePage = Math.max(1, Math.min(page, totalPages));
|
|
2425
|
+
const currentSessionState = resolveTelegramSessionState({
|
|
2426
|
+
chatId,
|
|
2427
|
+
isGroup,
|
|
2428
|
+
isForum,
|
|
2429
|
+
messageThreadId,
|
|
2430
|
+
resolvedThreadId,
|
|
2431
|
+
senderId
|
|
2432
|
+
});
|
|
2433
|
+
const currentModel = currentSessionState.model;
|
|
2434
|
+
const buttons = buildModelsKeyboard({
|
|
2435
|
+
provider,
|
|
2436
|
+
models,
|
|
2437
|
+
currentModel,
|
|
2438
|
+
currentPage: safePage,
|
|
2439
|
+
totalPages,
|
|
2440
|
+
pageSize
|
|
2441
|
+
});
|
|
2442
|
+
await editMessageWithButtons(formatModelsAvailableHeader({
|
|
2443
|
+
provider,
|
|
2444
|
+
total: models.length,
|
|
2445
|
+
cfg,
|
|
2446
|
+
agentDir: resolveAgentDir(cfg, currentSessionState.agentId),
|
|
2447
|
+
sessionEntry: currentSessionState.sessionEntry
|
|
2448
|
+
}), buttons);
|
|
2449
|
+
return;
|
|
2450
|
+
}
|
|
2451
|
+
if (modelCallback.type === "select") {
|
|
2452
|
+
const selection = resolveModelSelection({
|
|
2453
|
+
callback: modelCallback,
|
|
2454
|
+
providers,
|
|
2455
|
+
byProvider
|
|
2456
|
+
});
|
|
2457
|
+
if (selection.kind !== "resolved") {
|
|
2458
|
+
const buttons = buildProviderKeyboard(providers.map((p) => ({
|
|
2459
|
+
id: p,
|
|
2460
|
+
count: byProvider.get(p)?.size ?? 0
|
|
2461
|
+
})));
|
|
2462
|
+
await editMessageWithButtons(`Could not resolve model "${selection.model}".\n\nSelect a provider:`, buttons);
|
|
2463
|
+
return;
|
|
2464
|
+
}
|
|
2465
|
+
if (!byProvider.get(selection.provider)?.has(selection.model)) {
|
|
2466
|
+
await editMessageWithButtons(`❌ Model "${selection.provider}/${selection.model}" is not allowed.`, []);
|
|
2467
|
+
return;
|
|
2468
|
+
}
|
|
2469
|
+
try {
|
|
2470
|
+
const storePath = telegramDeps.resolveStorePath(cfg.session?.store, { agentId: sessionState.agentId });
|
|
2471
|
+
const resolvedDefault = resolveDefaultModelForAgent({
|
|
2472
|
+
cfg,
|
|
2473
|
+
agentId: sessionState.agentId
|
|
2474
|
+
});
|
|
2475
|
+
const isDefaultSelection = selection.provider === resolvedDefault.provider && selection.model === resolvedDefault.model;
|
|
2476
|
+
await updateSessionStore(storePath, (store) => {
|
|
2477
|
+
const sessionKey = sessionState.sessionKey;
|
|
2478
|
+
const entry = store[sessionKey] ?? {};
|
|
2479
|
+
store[sessionKey] = entry;
|
|
2480
|
+
applyModelOverrideToSessionEntry({
|
|
2481
|
+
entry,
|
|
2482
|
+
selection: {
|
|
2483
|
+
provider: selection.provider,
|
|
2484
|
+
model: selection.model,
|
|
2485
|
+
isDefault: isDefaultSelection
|
|
2486
|
+
}
|
|
2487
|
+
});
|
|
2488
|
+
});
|
|
2489
|
+
await editMessageWithButtons(`✅ Model ${isDefaultSelection ? "reset to default" : `changed to **${selection.provider}/${selection.model}**`}\n\nThis model will be used for your next message.`, []);
|
|
2490
|
+
} catch (err) {
|
|
2491
|
+
await editMessageWithButtons(`❌ Failed to change model: ${String(err)}`, []);
|
|
2492
|
+
}
|
|
2493
|
+
return;
|
|
2494
|
+
}
|
|
2495
|
+
return;
|
|
2496
|
+
}
|
|
2497
|
+
const nativeCallbackCommand = parseTelegramNativeCommandCallbackData(data);
|
|
2498
|
+
await processMessage(buildSyntheticContext(ctx, buildSyntheticTextMessage({
|
|
2499
|
+
base: withResolvedTelegramForumFlag(callbackMessage, isForum),
|
|
2500
|
+
from: callback.from,
|
|
2501
|
+
text: nativeCallbackCommand ?? data
|
|
2502
|
+
})), [], storeAllowFrom, {
|
|
2503
|
+
...nativeCallbackCommand ? { commandSource: "native" } : {},
|
|
2504
|
+
forceWasMentioned: true,
|
|
2505
|
+
messageIdOverride: callback.id
|
|
2506
|
+
});
|
|
2507
|
+
} catch (err) {
|
|
2508
|
+
runtime.error?.(danger(`callback handler failed: ${String(err)}`));
|
|
2509
|
+
}
|
|
2510
|
+
});
|
|
2511
|
+
bot.on("message:migrate_to_chat_id", async (ctx) => {
|
|
2512
|
+
try {
|
|
2513
|
+
const msg = ctx.message;
|
|
2514
|
+
if (!msg?.migrate_to_chat_id) return;
|
|
2515
|
+
if (shouldSkipUpdate(ctx)) return;
|
|
2516
|
+
const oldChatId = String(msg.chat.id);
|
|
2517
|
+
const newChatId = String(msg.migrate_to_chat_id);
|
|
2518
|
+
const chatTitle = msg.chat.title ?? "Unknown";
|
|
2519
|
+
runtime.log?.(warn(`[telegram] Group migrated: "${chatTitle}" ${oldChatId} → ${newChatId}`));
|
|
2520
|
+
if (!resolveChannelConfigWrites({
|
|
2521
|
+
cfg,
|
|
2522
|
+
channelId: "telegram",
|
|
2523
|
+
accountId
|
|
2524
|
+
})) {
|
|
2525
|
+
runtime.log?.(warn("[telegram] Config writes disabled; skipping group config migration."));
|
|
2526
|
+
return;
|
|
2527
|
+
}
|
|
2528
|
+
const currentConfig = telegramDeps.loadConfig();
|
|
2529
|
+
const migration = migrateTelegramGroupConfig({
|
|
2530
|
+
cfg: currentConfig,
|
|
2531
|
+
accountId,
|
|
2532
|
+
oldChatId,
|
|
2533
|
+
newChatId
|
|
2534
|
+
});
|
|
2535
|
+
if (migration.migrated) {
|
|
2536
|
+
runtime.log?.(warn(`[telegram] Migrating group config from ${oldChatId} to ${newChatId}`));
|
|
2537
|
+
migrateTelegramGroupConfig({
|
|
2538
|
+
cfg,
|
|
2539
|
+
accountId,
|
|
2540
|
+
oldChatId,
|
|
2541
|
+
newChatId
|
|
2542
|
+
});
|
|
2543
|
+
await writeConfigFile(currentConfig);
|
|
2544
|
+
runtime.log?.(warn(`[telegram] Group config migrated and saved successfully`));
|
|
2545
|
+
} else if (migration.skippedExisting) runtime.log?.(warn(`[telegram] Group config already exists for ${newChatId}; leaving ${oldChatId} unchanged`));
|
|
2546
|
+
else runtime.log?.(warn(`[telegram] No config found for old group ID ${oldChatId}, migration logged only`));
|
|
2547
|
+
} catch (err) {
|
|
2548
|
+
runtime.error?.(danger(`[telegram] Group migration handler failed: ${String(err)}`));
|
|
2549
|
+
}
|
|
2550
|
+
});
|
|
2551
|
+
const handleInboundMessageLike = async (event) => {
|
|
2552
|
+
try {
|
|
2553
|
+
if (shouldSkipUpdate(event.ctxForDedupe)) return;
|
|
2554
|
+
const { dmPolicy, resolvedThreadId, dmThreadId, storeAllowFrom, groupConfig, topicConfig, groupAllowOverride, effectiveGroupAllow, hasGroupAllowOverride } = await resolveTelegramEventAuthorizationContext({
|
|
2555
|
+
chatId: event.chatId,
|
|
2556
|
+
isGroup: event.isGroup,
|
|
2557
|
+
isForum: event.isForum,
|
|
2558
|
+
messageThreadId: event.messageThreadId
|
|
2559
|
+
});
|
|
2560
|
+
const effectiveDmAllow = normalizeDmAllowFromWithStore({
|
|
2561
|
+
allowFrom: groupAllowOverride ?? allowFrom,
|
|
2562
|
+
storeAllowFrom,
|
|
2563
|
+
dmPolicy
|
|
2564
|
+
});
|
|
2565
|
+
if (event.requireConfiguredGroup && (!groupConfig || groupConfig.enabled === false)) {
|
|
2566
|
+
logVerbose(`Blocked telegram channel ${event.chatId} (channel disabled)`);
|
|
2567
|
+
return;
|
|
2568
|
+
}
|
|
2569
|
+
if (shouldSkipGroupMessage({
|
|
2570
|
+
isGroup: event.isGroup,
|
|
2571
|
+
chatId: event.chatId,
|
|
2572
|
+
chatTitle: event.msg.chat.title,
|
|
2573
|
+
resolvedThreadId,
|
|
2574
|
+
senderId: event.senderId,
|
|
2575
|
+
senderUsername: event.senderUsername,
|
|
2576
|
+
effectiveGroupAllow,
|
|
2577
|
+
hasGroupAllowOverride,
|
|
2578
|
+
groupConfig,
|
|
2579
|
+
topicConfig
|
|
2580
|
+
})) return;
|
|
2581
|
+
if (!event.isGroup && (hasInboundMedia(event.msg) || hasReplyTargetMedia(event.msg))) {
|
|
2582
|
+
if (!await enforceTelegramDmAccess({
|
|
2583
|
+
isGroup: event.isGroup,
|
|
2584
|
+
dmPolicy,
|
|
2585
|
+
msg: event.msg,
|
|
2586
|
+
chatId: event.chatId,
|
|
2587
|
+
effectiveDmAllow,
|
|
2588
|
+
accountId,
|
|
2589
|
+
bot,
|
|
2590
|
+
logger,
|
|
2591
|
+
upsertPairingRequest: telegramDeps.upsertChannelPairingRequest
|
|
2592
|
+
})) return;
|
|
2593
|
+
}
|
|
2594
|
+
await processInboundMessage({
|
|
2595
|
+
ctx: event.ctx,
|
|
2596
|
+
msg: event.msg,
|
|
2597
|
+
chatId: event.chatId,
|
|
2598
|
+
resolvedThreadId,
|
|
2599
|
+
dmThreadId,
|
|
2600
|
+
storeAllowFrom,
|
|
2601
|
+
sendOversizeWarning: event.sendOversizeWarning,
|
|
2602
|
+
oversizeLogMessage: event.oversizeLogMessage
|
|
2603
|
+
});
|
|
2604
|
+
} catch (err) {
|
|
2605
|
+
runtime.error?.(danger(`${event.errorMessage}: ${String(err)}`));
|
|
2606
|
+
}
|
|
2607
|
+
};
|
|
2608
|
+
bot.on("message", async (ctx) => {
|
|
2609
|
+
const msg = ctx.message;
|
|
2610
|
+
if (!msg) return;
|
|
2611
|
+
const isGroup = msg.chat.type === "group" || msg.chat.type === "supergroup";
|
|
2612
|
+
const isForum = await resolveTelegramForumFlag({
|
|
2613
|
+
chatId: msg.chat.id,
|
|
2614
|
+
chatType: msg.chat.type,
|
|
2615
|
+
isGroup,
|
|
2616
|
+
isForum: msg.chat.is_forum,
|
|
2617
|
+
getChat
|
|
2618
|
+
});
|
|
2619
|
+
const normalizedMsg = withResolvedTelegramForumFlag(msg, isForum);
|
|
2620
|
+
if (normalizedMsg.from?.id != null && normalizedMsg.from.id === ctx.me?.id) return;
|
|
2621
|
+
await handleInboundMessageLike({
|
|
2622
|
+
ctxForDedupe: ctx,
|
|
2623
|
+
ctx: buildSyntheticContext(ctx, normalizedMsg),
|
|
2624
|
+
msg: normalizedMsg,
|
|
2625
|
+
chatId: normalizedMsg.chat.id,
|
|
2626
|
+
isGroup,
|
|
2627
|
+
isForum,
|
|
2628
|
+
messageThreadId: normalizedMsg.message_thread_id,
|
|
2629
|
+
senderId: normalizedMsg.from?.id != null ? String(normalizedMsg.from.id) : "",
|
|
2630
|
+
senderUsername: normalizedMsg.from?.username ?? "",
|
|
2631
|
+
requireConfiguredGroup: false,
|
|
2632
|
+
sendOversizeWarning: true,
|
|
2633
|
+
oversizeLogMessage: "media exceeds size limit",
|
|
2634
|
+
errorMessage: "handler failed"
|
|
2635
|
+
});
|
|
2636
|
+
});
|
|
2637
|
+
bot.on("channel_post", async (ctx) => {
|
|
2638
|
+
const post = ctx.channelPost;
|
|
2639
|
+
if (!post) return;
|
|
2640
|
+
const chatId = post.chat.id;
|
|
2641
|
+
const syntheticFrom = post.sender_chat ? {
|
|
2642
|
+
id: post.sender_chat.id,
|
|
2643
|
+
is_bot: true,
|
|
2644
|
+
first_name: post.sender_chat.title || "Channel",
|
|
2645
|
+
username: post.sender_chat.username
|
|
2646
|
+
} : {
|
|
2647
|
+
id: chatId,
|
|
2648
|
+
is_bot: true,
|
|
2649
|
+
first_name: post.chat.title || "Channel",
|
|
2650
|
+
username: post.chat.username
|
|
2651
|
+
};
|
|
2652
|
+
const syntheticMsg = {
|
|
2653
|
+
...post,
|
|
2654
|
+
from: post.from ?? syntheticFrom,
|
|
2655
|
+
chat: {
|
|
2656
|
+
...post.chat,
|
|
2657
|
+
type: "supergroup"
|
|
2658
|
+
}
|
|
2659
|
+
};
|
|
2660
|
+
await handleInboundMessageLike({
|
|
2661
|
+
ctxForDedupe: ctx,
|
|
2662
|
+
ctx: buildSyntheticContext(ctx, syntheticMsg),
|
|
2663
|
+
msg: syntheticMsg,
|
|
2664
|
+
chatId,
|
|
2665
|
+
isGroup: true,
|
|
2666
|
+
isForum: false,
|
|
2667
|
+
senderId: post.sender_chat?.id != null ? String(post.sender_chat.id) : post.from?.id != null ? String(post.from.id) : "",
|
|
2668
|
+
senderUsername: post.sender_chat?.username ?? post.from?.username ?? "",
|
|
2669
|
+
requireConfiguredGroup: true,
|
|
2670
|
+
sendOversizeWarning: false,
|
|
2671
|
+
oversizeLogMessage: "channel post media exceeds size limit",
|
|
2672
|
+
errorMessage: "channel_post handler failed"
|
|
2673
|
+
});
|
|
2674
|
+
});
|
|
2675
|
+
};
|
|
2676
|
+
//#endregion
|
|
2677
|
+
//#region extensions/telegram/src/error-policy.ts
|
|
2678
|
+
const errorCooldownStore = /* @__PURE__ */ new Map();
|
|
2679
|
+
const DEFAULT_ERROR_COOLDOWN_MS = 144e5;
|
|
2680
|
+
function pruneExpiredCooldowns(messageStore, now) {
|
|
2681
|
+
for (const [message, expiresAt] of messageStore) if (expiresAt <= now) messageStore.delete(message);
|
|
2682
|
+
}
|
|
2683
|
+
function resolveTelegramErrorPolicy(params) {
|
|
2684
|
+
const configs = [
|
|
2685
|
+
params.accountConfig,
|
|
2686
|
+
params.groupConfig,
|
|
2687
|
+
params.topicConfig
|
|
2688
|
+
];
|
|
2689
|
+
let policy = "always";
|
|
2690
|
+
let cooldownMs = DEFAULT_ERROR_COOLDOWN_MS;
|
|
2691
|
+
for (const config of configs) {
|
|
2692
|
+
if (config?.errorPolicy) policy = config.errorPolicy;
|
|
2693
|
+
if (typeof config?.errorCooldownMs === "number") cooldownMs = config.errorCooldownMs;
|
|
2694
|
+
}
|
|
2695
|
+
return {
|
|
2696
|
+
policy,
|
|
2697
|
+
cooldownMs
|
|
2698
|
+
};
|
|
2699
|
+
}
|
|
2700
|
+
function buildTelegramErrorScopeKey(params) {
|
|
2701
|
+
const threadId = params.threadId == null ? "main" : String(params.threadId);
|
|
2702
|
+
return `${params.accountId}:${String(params.chatId)}:${threadId}`;
|
|
2703
|
+
}
|
|
2704
|
+
function shouldSuppressTelegramError(params) {
|
|
2705
|
+
const { scopeKey, cooldownMs, errorMessage } = params;
|
|
2706
|
+
const now = Date.now();
|
|
2707
|
+
const messageKey = errorMessage ?? "";
|
|
2708
|
+
const scopeStore = errorCooldownStore.get(scopeKey);
|
|
2709
|
+
if (scopeStore) {
|
|
2710
|
+
pruneExpiredCooldowns(scopeStore, now);
|
|
2711
|
+
if (scopeStore.size === 0) errorCooldownStore.delete(scopeKey);
|
|
2712
|
+
}
|
|
2713
|
+
if (errorCooldownStore.size > 100) for (const [scope, messageStore] of errorCooldownStore) {
|
|
2714
|
+
pruneExpiredCooldowns(messageStore, now);
|
|
2715
|
+
if (messageStore.size === 0) errorCooldownStore.delete(scope);
|
|
2716
|
+
}
|
|
2717
|
+
const expiresAt = scopeStore?.get(messageKey);
|
|
2718
|
+
if (typeof expiresAt === "number" && expiresAt > now) return true;
|
|
2719
|
+
const nextScopeStore = scopeStore ?? /* @__PURE__ */ new Map();
|
|
2720
|
+
nextScopeStore.set(messageKey, now + cooldownMs);
|
|
2721
|
+
errorCooldownStore.set(scopeKey, nextScopeStore);
|
|
2722
|
+
return false;
|
|
2723
|
+
}
|
|
2724
|
+
function isSilentErrorPolicy(policy) {
|
|
2725
|
+
return policy === "silent";
|
|
2726
|
+
}
|
|
2727
|
+
//#endregion
|
|
2728
|
+
//#region extensions/telegram/src/lane-delivery-text-deliverer.ts
|
|
2729
|
+
const MESSAGE_NOT_MODIFIED_RE = /400:\s*Bad Request:\s*message is not modified|MESSAGE_NOT_MODIFIED/i;
|
|
2730
|
+
const MESSAGE_NOT_FOUND_RE = /400:\s*Bad Request:\s*message to edit not found|MESSAGE_ID_INVALID|message can't be edited/i;
|
|
2731
|
+
function extractErrorText(err) {
|
|
2732
|
+
return typeof err === "string" ? err : err instanceof Error ? err.message : typeof err === "object" && err && "description" in err ? typeof err.description === "string" ? err.description : "" : "";
|
|
2733
|
+
}
|
|
2734
|
+
function isMessageNotModifiedError(err) {
|
|
2735
|
+
return MESSAGE_NOT_MODIFIED_RE.test(extractErrorText(err));
|
|
2736
|
+
}
|
|
2737
|
+
/**
|
|
2738
|
+
* Returns true when Telegram rejects an edit because the target message can no
|
|
2739
|
+
* longer be resolved or edited. The caller still needs preview context to
|
|
2740
|
+
* decide whether to retain a different visible preview or fall back to send.
|
|
2741
|
+
*/
|
|
2742
|
+
function isMissingPreviewMessageError(err) {
|
|
2743
|
+
return MESSAGE_NOT_FOUND_RE.test(extractErrorText(err));
|
|
2744
|
+
}
|
|
2745
|
+
function result(kind, delivery) {
|
|
2746
|
+
if (kind === "preview-finalized") return {
|
|
2747
|
+
kind,
|
|
2748
|
+
delivery
|
|
2749
|
+
};
|
|
2750
|
+
return { kind };
|
|
2751
|
+
}
|
|
2752
|
+
function shouldSkipRegressivePreviewUpdate(args) {
|
|
2753
|
+
const currentPreviewText = args.currentPreviewText;
|
|
2754
|
+
if (currentPreviewText === void 0) return false;
|
|
2755
|
+
return currentPreviewText.startsWith(args.text) && args.text.length < currentPreviewText.length && (args.skipRegressive === "always" || args.hadPreviewMessage);
|
|
2756
|
+
}
|
|
2757
|
+
function resolvePreviewTarget(params) {
|
|
2758
|
+
const lanePreviewMessageId = params.lane.stream?.messageId();
|
|
2759
|
+
const previewMessageId = typeof params.previewMessageIdOverride === "number" ? params.previewMessageIdOverride : lanePreviewMessageId;
|
|
2760
|
+
const hadPreviewMessage = typeof params.previewMessageIdOverride === "number" || typeof lanePreviewMessageId === "number";
|
|
2761
|
+
return {
|
|
2762
|
+
hadPreviewMessage,
|
|
2763
|
+
previewMessageId: typeof previewMessageId === "number" ? previewMessageId : void 0,
|
|
2764
|
+
stopCreatesFirstPreview: params.stopBeforeEdit && !hadPreviewMessage && params.context === "final"
|
|
2765
|
+
};
|
|
2766
|
+
}
|
|
2767
|
+
function createLaneTextDeliverer(params) {
|
|
2768
|
+
const getLanePreviewText = (lane) => lane.lastPartialText;
|
|
2769
|
+
const markActivePreviewComplete = (laneName) => {
|
|
2770
|
+
params.activePreviewLifecycleByLane[laneName] = "complete";
|
|
2771
|
+
params.retainPreviewOnCleanupByLane[laneName] = true;
|
|
2772
|
+
};
|
|
2773
|
+
const isDraftPreviewLane = (lane) => lane.stream?.previewMode?.() === "draft";
|
|
2774
|
+
const canMaterializeDraftFinal = (lane, previewButtons) => {
|
|
2775
|
+
const hasPreviewButtons = Boolean(previewButtons && previewButtons.length > 0);
|
|
2776
|
+
return isDraftPreviewLane(lane) && !hasPreviewButtons && typeof lane.stream?.materialize === "function";
|
|
2777
|
+
};
|
|
2778
|
+
const tryMaterializeDraftPreviewForFinal = async (args) => {
|
|
2779
|
+
const stream = args.lane.stream;
|
|
2780
|
+
if (!stream || !isDraftPreviewLane(args.lane)) return;
|
|
2781
|
+
stream.update(args.text);
|
|
2782
|
+
const materializedMessageId = await stream.materialize?.();
|
|
2783
|
+
if (typeof materializedMessageId !== "number") {
|
|
2784
|
+
params.log(`telegram: ${args.laneName} draft preview materialize produced no message id; falling back to standard send`);
|
|
2785
|
+
return;
|
|
2786
|
+
}
|
|
2787
|
+
args.lane.lastPartialText = args.text;
|
|
2788
|
+
params.markDelivered();
|
|
2789
|
+
return materializedMessageId;
|
|
2790
|
+
};
|
|
2791
|
+
const tryEditPreviewMessage = async (args) => {
|
|
2792
|
+
try {
|
|
2793
|
+
await params.editPreview({
|
|
2794
|
+
laneName: args.laneName,
|
|
2795
|
+
messageId: args.messageId,
|
|
2796
|
+
text: args.text,
|
|
2797
|
+
previewButtons: args.previewButtons,
|
|
2798
|
+
context: args.context
|
|
2799
|
+
});
|
|
2800
|
+
if (args.updateLaneSnapshot) args.lane.lastPartialText = args.text;
|
|
2801
|
+
params.markDelivered();
|
|
2802
|
+
return "edited";
|
|
2803
|
+
} catch (err) {
|
|
2804
|
+
if (isMessageNotModifiedError(err)) {
|
|
2805
|
+
params.log(`telegram: ${args.laneName} preview ${args.context} edit returned "message is not modified"; treating as delivered`);
|
|
2806
|
+
params.markDelivered();
|
|
2807
|
+
return "edited";
|
|
2808
|
+
}
|
|
2809
|
+
if (args.context === "final") {
|
|
2810
|
+
if (args.finalTextAlreadyLanded) {
|
|
2811
|
+
params.log(`telegram: ${args.laneName} preview final edit failed after stop flush; keeping existing preview (${String(err)})`);
|
|
2812
|
+
params.markDelivered();
|
|
2813
|
+
return "retained";
|
|
2814
|
+
}
|
|
2815
|
+
if (isSafeToRetrySendError(err)) {
|
|
2816
|
+
params.log(`telegram: ${args.laneName} preview final edit failed before reaching Telegram; falling back to standard send (${String(err)})`);
|
|
2817
|
+
return "fallback";
|
|
2818
|
+
}
|
|
2819
|
+
if (isMissingPreviewMessageError(err)) {
|
|
2820
|
+
if (args.retainAlternatePreviewOnMissingTarget) {
|
|
2821
|
+
params.log(`telegram: ${args.laneName} preview final edit target missing; keeping alternate preview without fallback (${String(err)})`);
|
|
2822
|
+
params.markDelivered();
|
|
2823
|
+
return "retained";
|
|
2824
|
+
}
|
|
2825
|
+
params.log(`telegram: ${args.laneName} preview final edit target missing with no alternate preview; falling back to standard send (${String(err)})`);
|
|
2826
|
+
return "fallback";
|
|
2827
|
+
}
|
|
2828
|
+
if (isRecoverableTelegramNetworkError(err, { allowMessageMatch: true })) {
|
|
2829
|
+
params.log(`telegram: ${args.laneName} preview final edit may have landed despite network error; keeping existing preview (${String(err)})`);
|
|
2830
|
+
params.markDelivered();
|
|
2831
|
+
return "retained";
|
|
2832
|
+
}
|
|
2833
|
+
if (isTelegramClientRejection(err)) {
|
|
2834
|
+
params.log(`telegram: ${args.laneName} preview final edit rejected by Telegram (client error); falling back to standard send (${String(err)})`);
|
|
2835
|
+
return "fallback";
|
|
2836
|
+
}
|
|
2837
|
+
params.log(`telegram: ${args.laneName} preview final edit failed with ambiguous error; keeping existing preview to avoid duplicate (${String(err)})`);
|
|
2838
|
+
params.markDelivered();
|
|
2839
|
+
return "retained";
|
|
2840
|
+
}
|
|
2841
|
+
params.log(`telegram: ${args.laneName} preview ${args.context} edit failed; falling back to standard send (${String(err)})`);
|
|
2842
|
+
return "fallback";
|
|
2843
|
+
}
|
|
2844
|
+
};
|
|
2845
|
+
const tryUpdatePreviewForLane = async ({ lane, laneName, text, previewButtons, stopBeforeEdit = false, updateLaneSnapshot = false, skipRegressive, context, previewMessageId: previewMessageIdOverride, previewTextSnapshot }) => {
|
|
2846
|
+
const editPreview = (messageId, finalTextAlreadyLanded, retainAlternatePreviewOnMissingTarget) => tryEditPreviewMessage({
|
|
2847
|
+
laneName,
|
|
2848
|
+
messageId,
|
|
2849
|
+
text,
|
|
2850
|
+
context,
|
|
2851
|
+
previewButtons,
|
|
2852
|
+
updateLaneSnapshot,
|
|
2853
|
+
lane,
|
|
2854
|
+
finalTextAlreadyLanded,
|
|
2855
|
+
retainAlternatePreviewOnMissingTarget
|
|
2856
|
+
});
|
|
2857
|
+
const finalizePreview = (previewMessageId, finalTextAlreadyLanded, hadPreviewMessage, retainAlternatePreviewOnMissingTarget = false) => {
|
|
2858
|
+
if (shouldSkipRegressivePreviewUpdate({
|
|
2859
|
+
currentPreviewText: previewTextSnapshot ?? getLanePreviewText(lane),
|
|
2860
|
+
text,
|
|
2861
|
+
skipRegressive,
|
|
2862
|
+
hadPreviewMessage
|
|
2863
|
+
})) {
|
|
2864
|
+
params.markDelivered();
|
|
2865
|
+
return "regressive-skipped";
|
|
2866
|
+
}
|
|
2867
|
+
return editPreview(previewMessageId, finalTextAlreadyLanded, retainAlternatePreviewOnMissingTarget);
|
|
2868
|
+
};
|
|
2869
|
+
if (!lane.stream) return "fallback";
|
|
2870
|
+
if (resolvePreviewTarget({
|
|
2871
|
+
lane,
|
|
2872
|
+
previewMessageIdOverride,
|
|
2873
|
+
stopBeforeEdit,
|
|
2874
|
+
context
|
|
2875
|
+
}).stopCreatesFirstPreview) {
|
|
2876
|
+
lane.stream.update(text);
|
|
2877
|
+
await params.stopDraftLane(lane);
|
|
2878
|
+
const previewTargetAfterStop = resolvePreviewTarget({
|
|
2879
|
+
lane,
|
|
2880
|
+
stopBeforeEdit: false,
|
|
2881
|
+
context
|
|
2882
|
+
});
|
|
2883
|
+
if (typeof previewTargetAfterStop.previewMessageId !== "number") return "fallback";
|
|
2884
|
+
return finalizePreview(previewTargetAfterStop.previewMessageId, true, false);
|
|
2885
|
+
}
|
|
2886
|
+
if (stopBeforeEdit) await params.stopDraftLane(lane);
|
|
2887
|
+
const previewTargetAfterStop = resolvePreviewTarget({
|
|
2888
|
+
lane,
|
|
2889
|
+
previewMessageIdOverride,
|
|
2890
|
+
stopBeforeEdit: false,
|
|
2891
|
+
context
|
|
2892
|
+
});
|
|
2893
|
+
if (typeof previewTargetAfterStop.previewMessageId !== "number") {
|
|
2894
|
+
if (context === "final" && lane.hasStreamedMessage && lane.stream?.sendMayHaveLanded?.()) {
|
|
2895
|
+
params.log(`telegram: ${laneName} preview send may have landed despite missing message id; keeping to avoid duplicate`);
|
|
2896
|
+
params.markDelivered();
|
|
2897
|
+
return "retained";
|
|
2898
|
+
}
|
|
2899
|
+
return "fallback";
|
|
2900
|
+
}
|
|
2901
|
+
const activePreviewMessageId = lane.stream?.messageId();
|
|
2902
|
+
return finalizePreview(previewTargetAfterStop.previewMessageId, false, previewTargetAfterStop.hadPreviewMessage, typeof activePreviewMessageId === "number" && activePreviewMessageId !== previewTargetAfterStop.previewMessageId);
|
|
2903
|
+
};
|
|
2904
|
+
const consumeArchivedAnswerPreviewForFinal = async ({ lane, text, payload, previewButtons, canEditViaPreview }) => {
|
|
2905
|
+
const archivedPreview = params.archivedAnswerPreviews.shift();
|
|
2906
|
+
if (!archivedPreview) return;
|
|
2907
|
+
if (canEditViaPreview) {
|
|
2908
|
+
const finalized = await tryUpdatePreviewForLane({
|
|
2909
|
+
lane,
|
|
2910
|
+
laneName: "answer",
|
|
2911
|
+
text,
|
|
2912
|
+
previewButtons,
|
|
2913
|
+
stopBeforeEdit: false,
|
|
2914
|
+
skipRegressive: "existingOnly",
|
|
2915
|
+
context: "final",
|
|
2916
|
+
previewMessageId: archivedPreview.messageId,
|
|
2917
|
+
previewTextSnapshot: archivedPreview.textSnapshot
|
|
2918
|
+
});
|
|
2919
|
+
if (finalized === "edited") return result("preview-finalized", {
|
|
2920
|
+
content: text,
|
|
2921
|
+
messageId: archivedPreview.messageId
|
|
2922
|
+
});
|
|
2923
|
+
if (finalized === "regressive-skipped") return result("preview-finalized", {
|
|
2924
|
+
content: archivedPreview.textSnapshot,
|
|
2925
|
+
messageId: archivedPreview.messageId
|
|
2926
|
+
});
|
|
2927
|
+
if (finalized === "retained") {
|
|
2928
|
+
params.retainPreviewOnCleanupByLane.answer = true;
|
|
2929
|
+
return result("preview-retained");
|
|
2930
|
+
}
|
|
2931
|
+
}
|
|
2932
|
+
const delivered = await params.sendPayload(params.applyTextToPayload(payload, text));
|
|
2933
|
+
if (delivered || archivedPreview.deleteIfUnused !== false) try {
|
|
2934
|
+
await params.deletePreviewMessage(archivedPreview.messageId);
|
|
2935
|
+
} catch (err) {
|
|
2936
|
+
params.log(`telegram: archived answer preview cleanup failed (${archivedPreview.messageId}): ${String(err)}`);
|
|
2937
|
+
}
|
|
2938
|
+
return delivered ? result("sent") : result("skipped");
|
|
2939
|
+
};
|
|
2940
|
+
return async ({ laneName, text, payload, infoKind, previewButtons, allowPreviewUpdateForNonFinal = false }) => {
|
|
2941
|
+
const lane = params.lanes[laneName];
|
|
2942
|
+
const hasMedia = resolveSendableOutboundReplyParts(payload, { text }).hasMedia;
|
|
2943
|
+
const canEditViaPreview = !hasMedia && text.length > 0 && text.length <= params.draftMaxChars && !payload.isError;
|
|
2944
|
+
if (infoKind === "final") {
|
|
2945
|
+
if (params.activePreviewLifecycleByLane[laneName] === "transient") params.retainPreviewOnCleanupByLane[laneName] = false;
|
|
2946
|
+
if (laneName === "answer") {
|
|
2947
|
+
const archivedResult = await consumeArchivedAnswerPreviewForFinal({
|
|
2948
|
+
lane,
|
|
2949
|
+
text,
|
|
2950
|
+
payload,
|
|
2951
|
+
previewButtons,
|
|
2952
|
+
canEditViaPreview
|
|
2953
|
+
});
|
|
2954
|
+
if (archivedResult) return archivedResult;
|
|
2955
|
+
}
|
|
2956
|
+
if (canEditViaPreview && params.activePreviewLifecycleByLane[laneName] === "transient") {
|
|
2957
|
+
await params.flushDraftLane(lane);
|
|
2958
|
+
if (laneName === "answer") {
|
|
2959
|
+
const archivedResultAfterFlush = await consumeArchivedAnswerPreviewForFinal({
|
|
2960
|
+
lane,
|
|
2961
|
+
text,
|
|
2962
|
+
payload,
|
|
2963
|
+
previewButtons,
|
|
2964
|
+
canEditViaPreview
|
|
2965
|
+
});
|
|
2966
|
+
if (archivedResultAfterFlush) return archivedResultAfterFlush;
|
|
2967
|
+
}
|
|
2968
|
+
if (canMaterializeDraftFinal(lane, previewButtons)) {
|
|
2969
|
+
const materializedMessageId = await tryMaterializeDraftPreviewForFinal({
|
|
2970
|
+
lane,
|
|
2971
|
+
laneName,
|
|
2972
|
+
text
|
|
2973
|
+
});
|
|
2974
|
+
if (typeof materializedMessageId === "number") {
|
|
2975
|
+
markActivePreviewComplete(laneName);
|
|
2976
|
+
return result("preview-finalized", {
|
|
2977
|
+
content: text,
|
|
2978
|
+
messageId: materializedMessageId
|
|
2979
|
+
});
|
|
2980
|
+
}
|
|
2981
|
+
}
|
|
2982
|
+
const previewMessageId = lane.stream?.messageId();
|
|
2983
|
+
const finalized = await tryUpdatePreviewForLane({
|
|
2984
|
+
lane,
|
|
2985
|
+
laneName,
|
|
2986
|
+
text,
|
|
2987
|
+
previewButtons,
|
|
2988
|
+
stopBeforeEdit: true,
|
|
2989
|
+
skipRegressive: "existingOnly",
|
|
2990
|
+
context: "final"
|
|
2991
|
+
});
|
|
2992
|
+
if (finalized === "edited") {
|
|
2993
|
+
markActivePreviewComplete(laneName);
|
|
2994
|
+
return result("preview-finalized", {
|
|
2995
|
+
content: text,
|
|
2996
|
+
messageId: previewMessageId ?? lane.stream?.messageId()
|
|
2997
|
+
});
|
|
2998
|
+
}
|
|
2999
|
+
if (finalized === "regressive-skipped") {
|
|
3000
|
+
markActivePreviewComplete(laneName);
|
|
3001
|
+
return result("preview-finalized", {
|
|
3002
|
+
content: lane.lastPartialText,
|
|
3003
|
+
messageId: previewMessageId ?? lane.stream?.messageId()
|
|
3004
|
+
});
|
|
3005
|
+
}
|
|
3006
|
+
if (finalized === "retained") {
|
|
3007
|
+
markActivePreviewComplete(laneName);
|
|
3008
|
+
return result("preview-retained");
|
|
3009
|
+
}
|
|
3010
|
+
} else if (!hasMedia && !payload.isError && text.length > params.draftMaxChars) params.log(`telegram: preview final too long for edit (${text.length} > ${params.draftMaxChars}); falling back to standard send`);
|
|
3011
|
+
await params.stopDraftLane(lane);
|
|
3012
|
+
return await params.sendPayload(params.applyTextToPayload(payload, text)) ? result("sent") : result("skipped");
|
|
3013
|
+
}
|
|
3014
|
+
if (allowPreviewUpdateForNonFinal && canEditViaPreview) {
|
|
3015
|
+
if (isDraftPreviewLane(lane)) {
|
|
3016
|
+
const previewRevisionBeforeFlush = lane.stream?.previewRevision?.() ?? 0;
|
|
3017
|
+
lane.stream?.update(text);
|
|
3018
|
+
await params.flushDraftLane(lane);
|
|
3019
|
+
if (!((lane.stream?.previewRevision?.() ?? 0) > previewRevisionBeforeFlush)) {
|
|
3020
|
+
params.log(`telegram: ${laneName} draft preview update not emitted; falling back to standard send`);
|
|
3021
|
+
return await params.sendPayload(params.applyTextToPayload(payload, text)) ? result("sent") : result("skipped");
|
|
3022
|
+
}
|
|
3023
|
+
lane.lastPartialText = text;
|
|
3024
|
+
params.markDelivered();
|
|
3025
|
+
return result("preview-updated");
|
|
3026
|
+
}
|
|
3027
|
+
const updated = await tryUpdatePreviewForLane({
|
|
3028
|
+
lane,
|
|
3029
|
+
laneName,
|
|
3030
|
+
text,
|
|
3031
|
+
previewButtons,
|
|
3032
|
+
stopBeforeEdit: false,
|
|
3033
|
+
updateLaneSnapshot: true,
|
|
3034
|
+
skipRegressive: "always",
|
|
3035
|
+
context: "update"
|
|
3036
|
+
});
|
|
3037
|
+
if (updated === "edited" || updated === "regressive-skipped") return result("preview-updated");
|
|
3038
|
+
}
|
|
3039
|
+
return await params.sendPayload(params.applyTextToPayload(payload, text)) ? result("sent") : result("skipped");
|
|
3040
|
+
};
|
|
3041
|
+
}
|
|
3042
|
+
//#endregion
|
|
3043
|
+
//#region extensions/telegram/src/lane-delivery-state.ts
|
|
3044
|
+
function createLaneDeliveryStateTracker() {
|
|
3045
|
+
const state = {
|
|
3046
|
+
delivered: false,
|
|
3047
|
+
skippedNonSilent: 0,
|
|
3048
|
+
failedNonSilent: 0
|
|
3049
|
+
};
|
|
3050
|
+
return {
|
|
3051
|
+
markDelivered: () => {
|
|
3052
|
+
state.delivered = true;
|
|
3053
|
+
},
|
|
3054
|
+
markNonSilentSkip: () => {
|
|
3055
|
+
state.skippedNonSilent += 1;
|
|
3056
|
+
},
|
|
3057
|
+
markNonSilentFailure: () => {
|
|
3058
|
+
state.failedNonSilent += 1;
|
|
3059
|
+
},
|
|
3060
|
+
snapshot: () => ({ ...state })
|
|
3061
|
+
};
|
|
3062
|
+
}
|
|
3063
|
+
//#endregion
|
|
3064
|
+
//#region extensions/telegram/src/reasoning-lane-coordinator.ts
|
|
3065
|
+
const REASONING_MESSAGE_PREFIX = "Reasoning:\n";
|
|
3066
|
+
const REASONING_TAG_PREFIXES = [
|
|
3067
|
+
"<think",
|
|
3068
|
+
"<thinking",
|
|
3069
|
+
"<thought",
|
|
3070
|
+
"<antthinking",
|
|
3071
|
+
"</think",
|
|
3072
|
+
"</thinking",
|
|
3073
|
+
"</thought",
|
|
3074
|
+
"</antthinking"
|
|
3075
|
+
];
|
|
3076
|
+
const THINKING_TAG_RE = /<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;
|
|
3077
|
+
function extractThinkingFromTaggedStreamOutsideCode(text) {
|
|
3078
|
+
if (!text) return "";
|
|
3079
|
+
const codeRegions = findCodeRegions(text);
|
|
3080
|
+
let result = "";
|
|
3081
|
+
let lastIndex = 0;
|
|
3082
|
+
let inThinking = false;
|
|
3083
|
+
THINKING_TAG_RE.lastIndex = 0;
|
|
3084
|
+
for (const match of text.matchAll(THINKING_TAG_RE)) {
|
|
3085
|
+
const idx = match.index ?? 0;
|
|
3086
|
+
if (isInsideCode(idx, codeRegions)) continue;
|
|
3087
|
+
if (inThinking) result += text.slice(lastIndex, idx);
|
|
3088
|
+
inThinking = !(match[1] === "/");
|
|
3089
|
+
lastIndex = idx + match[0].length;
|
|
3090
|
+
}
|
|
3091
|
+
if (inThinking) result += text.slice(lastIndex);
|
|
3092
|
+
return result.trim();
|
|
3093
|
+
}
|
|
3094
|
+
function isPartialReasoningTagPrefix(text) {
|
|
3095
|
+
const trimmed = text.trimStart().toLowerCase();
|
|
3096
|
+
if (!trimmed.startsWith("<")) return false;
|
|
3097
|
+
if (trimmed.includes(">")) return false;
|
|
3098
|
+
return REASONING_TAG_PREFIXES.some((prefix) => prefix.startsWith(trimmed));
|
|
3099
|
+
}
|
|
3100
|
+
function splitTelegramReasoningText(text) {
|
|
3101
|
+
if (typeof text !== "string") return {};
|
|
3102
|
+
const trimmed = text.trim();
|
|
3103
|
+
if (isPartialReasoningTagPrefix(trimmed)) return {};
|
|
3104
|
+
if (trimmed.startsWith(REASONING_MESSAGE_PREFIX) && trimmed.length > 11) return { reasoningText: trimmed };
|
|
3105
|
+
const taggedReasoning = extractThinkingFromTaggedStreamOutsideCode(text);
|
|
3106
|
+
const strippedAnswer = stripReasoningTagsFromText(text, {
|
|
3107
|
+
mode: "strict",
|
|
3108
|
+
trim: "both"
|
|
3109
|
+
});
|
|
3110
|
+
if (!taggedReasoning && strippedAnswer === text) return { answerText: text };
|
|
3111
|
+
return {
|
|
3112
|
+
reasoningText: taggedReasoning ? formatReasoningMessage(taggedReasoning) : void 0,
|
|
3113
|
+
answerText: strippedAnswer || void 0
|
|
3114
|
+
};
|
|
3115
|
+
}
|
|
3116
|
+
function createTelegramReasoningStepState() {
|
|
3117
|
+
let reasoningStatus = "none";
|
|
3118
|
+
let bufferedFinalAnswer;
|
|
3119
|
+
const noteReasoningHint = () => {
|
|
3120
|
+
if (reasoningStatus === "none") reasoningStatus = "hinted";
|
|
3121
|
+
};
|
|
3122
|
+
const noteReasoningDelivered = () => {
|
|
3123
|
+
reasoningStatus = "delivered";
|
|
3124
|
+
};
|
|
3125
|
+
const shouldBufferFinalAnswer = () => {
|
|
3126
|
+
return reasoningStatus === "hinted" && !bufferedFinalAnswer;
|
|
3127
|
+
};
|
|
3128
|
+
const bufferFinalAnswer = (value) => {
|
|
3129
|
+
bufferedFinalAnswer = value;
|
|
3130
|
+
};
|
|
3131
|
+
const takeBufferedFinalAnswer = () => {
|
|
3132
|
+
const value = bufferedFinalAnswer;
|
|
3133
|
+
bufferedFinalAnswer = void 0;
|
|
3134
|
+
return value;
|
|
3135
|
+
};
|
|
3136
|
+
const resetForNextStep = () => {
|
|
3137
|
+
reasoningStatus = "none";
|
|
3138
|
+
bufferedFinalAnswer = void 0;
|
|
3139
|
+
};
|
|
3140
|
+
return {
|
|
3141
|
+
noteReasoningHint,
|
|
3142
|
+
noteReasoningDelivered,
|
|
3143
|
+
shouldBufferFinalAnswer,
|
|
3144
|
+
bufferFinalAnswer,
|
|
3145
|
+
takeBufferedFinalAnswer,
|
|
3146
|
+
resetForNextStep
|
|
3147
|
+
};
|
|
3148
|
+
}
|
|
3149
|
+
//#endregion
|
|
3150
|
+
//#region extensions/telegram/src/bot-message-dispatch.ts
|
|
3151
|
+
const EMPTY_RESPONSE_FALLBACK = "No response generated. Please try again.";
|
|
3152
|
+
/** Minimum chars before sending first streaming message (improves push notification UX) */
|
|
3153
|
+
const DRAFT_MIN_INITIAL_CHARS = 30;
|
|
3154
|
+
async function resolveStickerVisionSupport(cfg, agentId) {
|
|
3155
|
+
try {
|
|
3156
|
+
const catalog = await loadModelCatalog({ config: cfg });
|
|
3157
|
+
const defaultModel = resolveDefaultModelForAgent({
|
|
3158
|
+
cfg,
|
|
3159
|
+
agentId
|
|
3160
|
+
});
|
|
3161
|
+
const entry = findModelInCatalog(catalog, defaultModel.provider, defaultModel.model);
|
|
3162
|
+
if (!entry) return false;
|
|
3163
|
+
return modelSupportsVision(entry);
|
|
3164
|
+
} catch {
|
|
3165
|
+
return false;
|
|
3166
|
+
}
|
|
3167
|
+
}
|
|
3168
|
+
function pruneStickerMediaFromContext(ctxPayload, opts) {
|
|
3169
|
+
if (opts?.stickerMediaIncluded === false) return;
|
|
3170
|
+
const nextMediaPaths = Array.isArray(ctxPayload.MediaPaths) ? ctxPayload.MediaPaths.slice(1) : void 0;
|
|
3171
|
+
const nextMediaUrls = Array.isArray(ctxPayload.MediaUrls) ? ctxPayload.MediaUrls.slice(1) : void 0;
|
|
3172
|
+
const nextMediaTypes = Array.isArray(ctxPayload.MediaTypes) ? ctxPayload.MediaTypes.slice(1) : void 0;
|
|
3173
|
+
ctxPayload.MediaPaths = nextMediaPaths && nextMediaPaths.length > 0 ? nextMediaPaths : void 0;
|
|
3174
|
+
ctxPayload.MediaUrls = nextMediaUrls && nextMediaUrls.length > 0 ? nextMediaUrls : void 0;
|
|
3175
|
+
ctxPayload.MediaTypes = nextMediaTypes && nextMediaTypes.length > 0 ? nextMediaTypes : void 0;
|
|
3176
|
+
ctxPayload.MediaPath = ctxPayload.MediaPaths?.[0];
|
|
3177
|
+
ctxPayload.MediaUrl = ctxPayload.MediaUrls?.[0] ?? ctxPayload.MediaPath;
|
|
3178
|
+
ctxPayload.MediaType = ctxPayload.MediaTypes?.[0];
|
|
3179
|
+
}
|
|
3180
|
+
function resolveTelegramReasoningLevel(params) {
|
|
3181
|
+
const { cfg, sessionKey, agentId, telegramDeps } = params;
|
|
3182
|
+
if (!sessionKey) return "off";
|
|
3183
|
+
try {
|
|
3184
|
+
const storePath = telegramDeps.resolveStorePath(cfg.session?.store, { agentId });
|
|
3185
|
+
const level = resolveSessionStoreEntry({
|
|
3186
|
+
store: (telegramDeps.loadSessionStore ?? loadSessionStore)(storePath, { skipCache: true }),
|
|
3187
|
+
sessionKey
|
|
3188
|
+
}).existing?.reasoningLevel;
|
|
3189
|
+
if (level === "on" || level === "stream") return level;
|
|
3190
|
+
} catch {}
|
|
3191
|
+
return "off";
|
|
3192
|
+
}
|
|
3193
|
+
const dispatchTelegramMessage = async ({ context, bot, cfg, runtime, replyToMode, streamMode, textLimit, telegramCfg, telegramDeps = defaultTelegramBotDeps, opts }) => {
|
|
3194
|
+
const { ctxPayload, msg, chatId, isGroup, groupConfig, topicConfig, threadSpec, historyKey, historyLimit, groupHistories, route, skillFilter, sendTyping, sendRecordVoice, ackReactionPromise, reactionApi, removeAckAfterReply, statusReactionController } = context;
|
|
3195
|
+
const draftMaxChars = Math.min(textLimit, 4096);
|
|
3196
|
+
const tableMode = resolveMarkdownTableMode({
|
|
3197
|
+
cfg,
|
|
3198
|
+
channel: "telegram",
|
|
3199
|
+
accountId: route.accountId
|
|
3200
|
+
});
|
|
3201
|
+
const renderDraftPreview = (text) => ({
|
|
3202
|
+
text: renderTelegramHtmlText(text, { tableMode }),
|
|
3203
|
+
parseMode: "HTML"
|
|
3204
|
+
});
|
|
3205
|
+
const accountBlockStreamingEnabled = typeof telegramCfg.blockStreaming === "boolean" ? telegramCfg.blockStreaming : cfg.agents?.defaults?.blockStreamingDefault === "on";
|
|
3206
|
+
const resolvedReasoningLevel = resolveTelegramReasoningLevel({
|
|
3207
|
+
cfg,
|
|
3208
|
+
sessionKey: ctxPayload.SessionKey,
|
|
3209
|
+
agentId: route.agentId,
|
|
3210
|
+
telegramDeps
|
|
3211
|
+
});
|
|
3212
|
+
const forceBlockStreamingForReasoning = resolvedReasoningLevel === "on";
|
|
3213
|
+
const streamReasoningDraft = resolvedReasoningLevel === "stream";
|
|
3214
|
+
const previewStreamingEnabled = streamMode !== "off";
|
|
3215
|
+
const canStreamAnswerDraft = previewStreamingEnabled && !accountBlockStreamingEnabled && !forceBlockStreamingForReasoning;
|
|
3216
|
+
const canStreamReasoningDraft = canStreamAnswerDraft || streamReasoningDraft;
|
|
3217
|
+
const draftReplyToMessageId = replyToMode !== "off" && typeof msg.message_id === "number" ? msg.message_id : void 0;
|
|
3218
|
+
const draftMinInitialChars = DRAFT_MIN_INITIAL_CHARS;
|
|
3219
|
+
const useMessagePreviewTransportForDm = threadSpec?.scope === "dm" && canStreamAnswerDraft;
|
|
3220
|
+
const mediaLocalRoots = getAgentScopedMediaLocalRoots(cfg, route.agentId);
|
|
3221
|
+
const archivedAnswerPreviews = [];
|
|
3222
|
+
const archivedReasoningPreviewIds = [];
|
|
3223
|
+
const createDraftLane = (laneName, enabled) => {
|
|
3224
|
+
return {
|
|
3225
|
+
stream: enabled ? (telegramDeps.createTelegramDraftStream ?? createTelegramDraftStream)({
|
|
3226
|
+
api: bot.api,
|
|
3227
|
+
chatId,
|
|
3228
|
+
maxChars: draftMaxChars,
|
|
3229
|
+
thread: threadSpec,
|
|
3230
|
+
previewTransport: useMessagePreviewTransportForDm ? "message" : "auto",
|
|
3231
|
+
replyToMessageId: draftReplyToMessageId,
|
|
3232
|
+
minInitialChars: draftMinInitialChars,
|
|
3233
|
+
renderText: renderDraftPreview,
|
|
3234
|
+
onSupersededPreview: laneName === "answer" || laneName === "reasoning" ? (preview) => {
|
|
3235
|
+
if (laneName === "reasoning") {
|
|
3236
|
+
if (!archivedReasoningPreviewIds.includes(preview.messageId)) archivedReasoningPreviewIds.push(preview.messageId);
|
|
3237
|
+
return;
|
|
3238
|
+
}
|
|
3239
|
+
archivedAnswerPreviews.push({
|
|
3240
|
+
messageId: preview.messageId,
|
|
3241
|
+
textSnapshot: preview.textSnapshot,
|
|
3242
|
+
deleteIfUnused: true
|
|
3243
|
+
});
|
|
3244
|
+
} : void 0,
|
|
3245
|
+
log: logVerbose,
|
|
3246
|
+
warn: logVerbose
|
|
3247
|
+
}) : void 0,
|
|
3248
|
+
lastPartialText: "",
|
|
3249
|
+
hasStreamedMessage: false
|
|
3250
|
+
};
|
|
3251
|
+
};
|
|
3252
|
+
const lanes = {
|
|
3253
|
+
answer: createDraftLane("answer", canStreamAnswerDraft),
|
|
3254
|
+
reasoning: createDraftLane("reasoning", canStreamReasoningDraft)
|
|
3255
|
+
};
|
|
3256
|
+
const activePreviewLifecycleByLane = {
|
|
3257
|
+
answer: "transient",
|
|
3258
|
+
reasoning: "transient"
|
|
3259
|
+
};
|
|
3260
|
+
const retainPreviewOnCleanupByLane = {
|
|
3261
|
+
answer: false,
|
|
3262
|
+
reasoning: false
|
|
3263
|
+
};
|
|
3264
|
+
const answerLane = lanes.answer;
|
|
3265
|
+
const reasoningLane = lanes.reasoning;
|
|
3266
|
+
let splitReasoningOnNextStream = false;
|
|
3267
|
+
let skipNextAnswerMessageStartRotation = false;
|
|
3268
|
+
let draftLaneEventQueue = Promise.resolve();
|
|
3269
|
+
const reasoningStepState = createTelegramReasoningStepState();
|
|
3270
|
+
const enqueueDraftLaneEvent = (task) => {
|
|
3271
|
+
draftLaneEventQueue = draftLaneEventQueue.then(task).catch((err) => {
|
|
3272
|
+
logVerbose(`telegram: draft lane callback failed: ${String(err)}`);
|
|
3273
|
+
});
|
|
3274
|
+
return draftLaneEventQueue;
|
|
3275
|
+
};
|
|
3276
|
+
const splitTextIntoLaneSegments = (text) => {
|
|
3277
|
+
const split = splitTelegramReasoningText(text);
|
|
3278
|
+
const segments = [];
|
|
3279
|
+
const suppressReasoning = resolvedReasoningLevel === "off";
|
|
3280
|
+
if (split.reasoningText && !suppressReasoning) segments.push({
|
|
3281
|
+
lane: "reasoning",
|
|
3282
|
+
text: split.reasoningText
|
|
3283
|
+
});
|
|
3284
|
+
if (split.answerText) segments.push({
|
|
3285
|
+
lane: "answer",
|
|
3286
|
+
text: split.answerText
|
|
3287
|
+
});
|
|
3288
|
+
return {
|
|
3289
|
+
segments,
|
|
3290
|
+
suppressedReasoningOnly: Boolean(split.reasoningText) && suppressReasoning && !split.answerText
|
|
3291
|
+
};
|
|
3292
|
+
};
|
|
3293
|
+
const resetDraftLaneState = (lane) => {
|
|
3294
|
+
lane.lastPartialText = "";
|
|
3295
|
+
lane.hasStreamedMessage = false;
|
|
3296
|
+
};
|
|
3297
|
+
const rotateAnswerLaneForNewAssistantMessage = async () => {
|
|
3298
|
+
let didForceNewMessage = false;
|
|
3299
|
+
if (answerLane.hasStreamedMessage) {
|
|
3300
|
+
const previewMessageId = await answerLane.stream?.materialize?.() ?? answerLane.stream?.messageId();
|
|
3301
|
+
if (typeof previewMessageId === "number" && activePreviewLifecycleByLane.answer === "transient") archivedAnswerPreviews.push({
|
|
3302
|
+
messageId: previewMessageId,
|
|
3303
|
+
textSnapshot: answerLane.lastPartialText,
|
|
3304
|
+
deleteIfUnused: false
|
|
3305
|
+
});
|
|
3306
|
+
answerLane.stream?.forceNewMessage();
|
|
3307
|
+
didForceNewMessage = true;
|
|
3308
|
+
}
|
|
3309
|
+
resetDraftLaneState(answerLane);
|
|
3310
|
+
if (didForceNewMessage) {
|
|
3311
|
+
activePreviewLifecycleByLane.answer = "transient";
|
|
3312
|
+
retainPreviewOnCleanupByLane.answer = false;
|
|
3313
|
+
}
|
|
3314
|
+
return didForceNewMessage;
|
|
3315
|
+
};
|
|
3316
|
+
const updateDraftFromPartial = (lane, text) => {
|
|
3317
|
+
const laneStream = lane.stream;
|
|
3318
|
+
if (!laneStream || !text) return;
|
|
3319
|
+
if (text === lane.lastPartialText) return;
|
|
3320
|
+
lane.hasStreamedMessage = true;
|
|
3321
|
+
if (lane.lastPartialText && lane.lastPartialText.startsWith(text) && text.length < lane.lastPartialText.length) return;
|
|
3322
|
+
lane.lastPartialText = text;
|
|
3323
|
+
laneStream.update(text);
|
|
3324
|
+
};
|
|
3325
|
+
const ingestDraftLaneSegments = async (text) => {
|
|
3326
|
+
const split = splitTextIntoLaneSegments(text);
|
|
3327
|
+
if (split.segments.some((segment) => segment.lane === "answer") && activePreviewLifecycleByLane.answer !== "transient") skipNextAnswerMessageStartRotation = await rotateAnswerLaneForNewAssistantMessage();
|
|
3328
|
+
for (const segment of split.segments) {
|
|
3329
|
+
if (segment.lane === "reasoning") {
|
|
3330
|
+
reasoningStepState.noteReasoningHint();
|
|
3331
|
+
reasoningStepState.noteReasoningDelivered();
|
|
3332
|
+
}
|
|
3333
|
+
updateDraftFromPartial(lanes[segment.lane], segment.text);
|
|
3334
|
+
}
|
|
3335
|
+
};
|
|
3336
|
+
const flushDraftLane = async (lane) => {
|
|
3337
|
+
if (!lane.stream) return;
|
|
3338
|
+
await lane.stream.flush();
|
|
3339
|
+
};
|
|
3340
|
+
const disableBlockStreaming = !previewStreamingEnabled ? true : forceBlockStreamingForReasoning ? false : typeof telegramCfg.blockStreaming === "boolean" ? !telegramCfg.blockStreaming : canStreamAnswerDraft ? true : void 0;
|
|
3341
|
+
const chunkMode = resolveChunkMode(cfg, "telegram", route.accountId);
|
|
3342
|
+
const sticker = ctxPayload.Sticker;
|
|
3343
|
+
if (sticker?.fileId && sticker.fileUniqueId && ctxPayload.MediaPath) {
|
|
3344
|
+
const agentDir = resolveAgentDir(cfg, route.agentId);
|
|
3345
|
+
const stickerSupportsVision = await resolveStickerVisionSupport(cfg, route.agentId);
|
|
3346
|
+
let description = sticker.cachedDescription ?? null;
|
|
3347
|
+
if (!description) description = await describeStickerImage({
|
|
3348
|
+
imagePath: ctxPayload.MediaPath,
|
|
3349
|
+
cfg,
|
|
3350
|
+
agentDir,
|
|
3351
|
+
agentId: route.agentId
|
|
3352
|
+
});
|
|
3353
|
+
if (description) {
|
|
3354
|
+
const stickerContext = [sticker.emoji, sticker.setName ? `from "${sticker.setName}"` : null].filter(Boolean).join(" ");
|
|
3355
|
+
const formattedDesc = `[Sticker${stickerContext ? ` ${stickerContext}` : ""}] ${description}`;
|
|
3356
|
+
sticker.cachedDescription = description;
|
|
3357
|
+
if (!stickerSupportsVision) {
|
|
3358
|
+
ctxPayload.Body = formattedDesc;
|
|
3359
|
+
ctxPayload.BodyForAgent = formattedDesc;
|
|
3360
|
+
pruneStickerMediaFromContext(ctxPayload, { stickerMediaIncluded: ctxPayload.StickerMediaIncluded });
|
|
3361
|
+
}
|
|
3362
|
+
if (sticker.fileId) {
|
|
3363
|
+
cacheSticker({
|
|
3364
|
+
fileId: sticker.fileId,
|
|
3365
|
+
fileUniqueId: sticker.fileUniqueId,
|
|
3366
|
+
emoji: sticker.emoji,
|
|
3367
|
+
setName: sticker.setName,
|
|
3368
|
+
description,
|
|
3369
|
+
cachedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3370
|
+
receivedFrom: ctxPayload.From
|
|
3371
|
+
});
|
|
3372
|
+
logVerbose(`telegram: cached sticker description for ${sticker.fileUniqueId}`);
|
|
3373
|
+
} else logVerbose(`telegram: skipped sticker cache (missing fileId)`);
|
|
3374
|
+
}
|
|
3375
|
+
}
|
|
3376
|
+
const replyQuoteText = ctxPayload.ReplyToIsQuote && ctxPayload.ReplyToBody ? ctxPayload.ReplyToBody.trim() || void 0 : void 0;
|
|
3377
|
+
const deliveryState = createLaneDeliveryStateTracker();
|
|
3378
|
+
const clearGroupHistory = () => {
|
|
3379
|
+
if (isGroup && historyKey) clearHistoryEntriesIfEnabled({
|
|
3380
|
+
historyMap: groupHistories,
|
|
3381
|
+
historyKey,
|
|
3382
|
+
limit: historyLimit
|
|
3383
|
+
});
|
|
3384
|
+
};
|
|
3385
|
+
const deliveryBaseOptions = {
|
|
3386
|
+
chatId: String(chatId),
|
|
3387
|
+
accountId: route.accountId,
|
|
3388
|
+
sessionKeyForInternalHooks: ctxPayload.SessionKey,
|
|
3389
|
+
mirrorIsGroup: isGroup,
|
|
3390
|
+
mirrorGroupId: isGroup ? String(chatId) : void 0,
|
|
3391
|
+
token: opts.token,
|
|
3392
|
+
runtime,
|
|
3393
|
+
bot,
|
|
3394
|
+
mediaLocalRoots,
|
|
3395
|
+
replyToMode,
|
|
3396
|
+
textLimit,
|
|
3397
|
+
thread: threadSpec,
|
|
3398
|
+
tableMode,
|
|
3399
|
+
chunkMode,
|
|
3400
|
+
linkPreview: telegramCfg.linkPreview,
|
|
3401
|
+
replyQuoteText
|
|
3402
|
+
};
|
|
3403
|
+
const silentErrorReplies = telegramCfg.silentErrorReplies === true;
|
|
3404
|
+
const applyTextToPayload = (payload, text) => {
|
|
3405
|
+
if (payload.text === text) return payload;
|
|
3406
|
+
return {
|
|
3407
|
+
...payload,
|
|
3408
|
+
text
|
|
3409
|
+
};
|
|
3410
|
+
};
|
|
3411
|
+
const sendPayload = async (payload) => {
|
|
3412
|
+
const result = await (telegramDeps.deliverReplies ?? deliverReplies)({
|
|
3413
|
+
...deliveryBaseOptions,
|
|
3414
|
+
replies: [payload],
|
|
3415
|
+
onVoiceRecording: sendRecordVoice,
|
|
3416
|
+
silent: silentErrorReplies && payload.isError === true,
|
|
3417
|
+
mediaLoader: telegramDeps.loadWebMedia
|
|
3418
|
+
});
|
|
3419
|
+
if (result.delivered) deliveryState.markDelivered();
|
|
3420
|
+
return result.delivered;
|
|
3421
|
+
};
|
|
3422
|
+
const emitPreviewFinalizedHook = (result) => {
|
|
3423
|
+
if (result.kind !== "preview-finalized") return;
|
|
3424
|
+
(telegramDeps.emitInternalMessageSentHook ?? emitInternalMessageSentHook)({
|
|
3425
|
+
sessionKeyForInternalHooks: deliveryBaseOptions.sessionKeyForInternalHooks,
|
|
3426
|
+
chatId: deliveryBaseOptions.chatId,
|
|
3427
|
+
accountId: deliveryBaseOptions.accountId,
|
|
3428
|
+
content: result.delivery.content,
|
|
3429
|
+
success: true,
|
|
3430
|
+
messageId: result.delivery.messageId,
|
|
3431
|
+
isGroup: deliveryBaseOptions.mirrorIsGroup,
|
|
3432
|
+
groupId: deliveryBaseOptions.mirrorGroupId
|
|
3433
|
+
});
|
|
3434
|
+
};
|
|
3435
|
+
const deliverLaneText = createLaneTextDeliverer({
|
|
3436
|
+
lanes,
|
|
3437
|
+
archivedAnswerPreviews,
|
|
3438
|
+
activePreviewLifecycleByLane,
|
|
3439
|
+
retainPreviewOnCleanupByLane,
|
|
3440
|
+
draftMaxChars,
|
|
3441
|
+
applyTextToPayload,
|
|
3442
|
+
sendPayload,
|
|
3443
|
+
flushDraftLane,
|
|
3444
|
+
stopDraftLane: async (lane) => {
|
|
3445
|
+
await lane.stream?.stop();
|
|
3446
|
+
},
|
|
3447
|
+
editPreview: async ({ messageId, text, previewButtons }) => {
|
|
3448
|
+
await (telegramDeps.editMessageTelegram ?? editMessageTelegram)(chatId, messageId, text, {
|
|
3449
|
+
api: bot.api,
|
|
3450
|
+
cfg,
|
|
3451
|
+
accountId: route.accountId,
|
|
3452
|
+
linkPreview: telegramCfg.linkPreview,
|
|
3453
|
+
buttons: previewButtons
|
|
3454
|
+
});
|
|
3455
|
+
},
|
|
3456
|
+
deletePreviewMessage: async (messageId) => {
|
|
3457
|
+
await bot.api.deleteMessage(chatId, messageId);
|
|
3458
|
+
},
|
|
3459
|
+
log: logVerbose,
|
|
3460
|
+
markDelivered: () => {
|
|
3461
|
+
deliveryState.markDelivered();
|
|
3462
|
+
}
|
|
3463
|
+
});
|
|
3464
|
+
let queuedFinal = false;
|
|
3465
|
+
let hadErrorReplyFailureOrSkip = false;
|
|
3466
|
+
const isDmTopic = !isGroup && threadSpec.scope === "dm" && threadSpec.id != null;
|
|
3467
|
+
let isFirstTurnInSession = false;
|
|
3468
|
+
if (isDmTopic) try {
|
|
3469
|
+
const storePath = telegramDeps.resolveStorePath(cfg.session?.store, { agentId: route.agentId });
|
|
3470
|
+
const store = (telegramDeps.loadSessionStore ?? loadSessionStore)(storePath, { skipCache: true });
|
|
3471
|
+
const sessionKey = ctxPayload.SessionKey;
|
|
3472
|
+
if (sessionKey) isFirstTurnInSession = !resolveSessionStoreEntry({
|
|
3473
|
+
store,
|
|
3474
|
+
sessionKey
|
|
3475
|
+
}).existing?.systemSent;
|
|
3476
|
+
else logVerbose("auto-topic-label: SessionKey is absent, skipping first-turn detection");
|
|
3477
|
+
} catch (err) {
|
|
3478
|
+
logVerbose(`auto-topic-label: session store error: ${err instanceof Error ? err.message : String(err)}`);
|
|
3479
|
+
}
|
|
3480
|
+
if (statusReactionController) statusReactionController.setThinking();
|
|
3481
|
+
const { onModelSelected, ...replyPipeline } = (telegramDeps.createChannelReplyPipeline ?? createChannelReplyPipeline)({
|
|
3482
|
+
cfg,
|
|
3483
|
+
agentId: route.agentId,
|
|
3484
|
+
channel: "telegram",
|
|
3485
|
+
accountId: route.accountId,
|
|
3486
|
+
typing: {
|
|
3487
|
+
start: sendTyping,
|
|
3488
|
+
onStartError: (err) => {
|
|
3489
|
+
logTypingFailure({
|
|
3490
|
+
log: logVerbose,
|
|
3491
|
+
channel: "telegram",
|
|
3492
|
+
target: String(chatId),
|
|
3493
|
+
error: err
|
|
3494
|
+
});
|
|
3495
|
+
}
|
|
3496
|
+
}
|
|
3497
|
+
});
|
|
3498
|
+
let dispatchError;
|
|
3499
|
+
try {
|
|
3500
|
+
({queuedFinal} = await telegramDeps.dispatchReplyWithBufferedBlockDispatcher({
|
|
3501
|
+
ctx: ctxPayload,
|
|
3502
|
+
cfg,
|
|
3503
|
+
dispatcherOptions: {
|
|
3504
|
+
...replyPipeline,
|
|
3505
|
+
deliver: async (payload, info) => {
|
|
3506
|
+
if (payload.isError === true) hadErrorReplyFailureOrSkip = true;
|
|
3507
|
+
if (info.kind === "final") await enqueueDraftLaneEvent(async () => {});
|
|
3508
|
+
if (shouldSuppressLocalTelegramExecApprovalPrompt({
|
|
3509
|
+
cfg,
|
|
3510
|
+
accountId: route.accountId,
|
|
3511
|
+
payload
|
|
3512
|
+
})) {
|
|
3513
|
+
queuedFinal = true;
|
|
3514
|
+
return;
|
|
3515
|
+
}
|
|
3516
|
+
const previewButtons = (payload.channelData?.telegram)?.buttons;
|
|
3517
|
+
const split = splitTextIntoLaneSegments(payload.text);
|
|
3518
|
+
const segments = split.segments;
|
|
3519
|
+
const reply = resolveSendableOutboundReplyParts(payload);
|
|
3520
|
+
reply.hasMedia;
|
|
3521
|
+
const flushBufferedFinalAnswer = async () => {
|
|
3522
|
+
const buffered = reasoningStepState.takeBufferedFinalAnswer();
|
|
3523
|
+
if (!buffered) return;
|
|
3524
|
+
const bufferedButtons = (buffered.payload.channelData?.telegram)?.buttons;
|
|
3525
|
+
await deliverLaneText({
|
|
3526
|
+
laneName: "answer",
|
|
3527
|
+
text: buffered.text,
|
|
3528
|
+
payload: buffered.payload,
|
|
3529
|
+
infoKind: "final",
|
|
3530
|
+
previewButtons: bufferedButtons
|
|
3531
|
+
});
|
|
3532
|
+
reasoningStepState.resetForNextStep();
|
|
3533
|
+
};
|
|
3534
|
+
for (const segment of segments) {
|
|
3535
|
+
if (segment.lane === "answer" && info.kind === "final" && reasoningStepState.shouldBufferFinalAnswer()) {
|
|
3536
|
+
reasoningStepState.bufferFinalAnswer({
|
|
3537
|
+
payload,
|
|
3538
|
+
text: segment.text
|
|
3539
|
+
});
|
|
3540
|
+
continue;
|
|
3541
|
+
}
|
|
3542
|
+
if (segment.lane === "reasoning") reasoningStepState.noteReasoningHint();
|
|
3543
|
+
const result = await deliverLaneText({
|
|
3544
|
+
laneName: segment.lane,
|
|
3545
|
+
text: segment.text,
|
|
3546
|
+
payload,
|
|
3547
|
+
infoKind: info.kind,
|
|
3548
|
+
previewButtons,
|
|
3549
|
+
allowPreviewUpdateForNonFinal: segment.lane === "reasoning"
|
|
3550
|
+
});
|
|
3551
|
+
if (info.kind === "final") emitPreviewFinalizedHook(result);
|
|
3552
|
+
if (segment.lane === "reasoning") {
|
|
3553
|
+
if (result.kind !== "skipped") {
|
|
3554
|
+
reasoningStepState.noteReasoningDelivered();
|
|
3555
|
+
await flushBufferedFinalAnswer();
|
|
3556
|
+
}
|
|
3557
|
+
continue;
|
|
3558
|
+
}
|
|
3559
|
+
if (info.kind === "final") {
|
|
3560
|
+
if (reasoningLane.hasStreamedMessage) {
|
|
3561
|
+
activePreviewLifecycleByLane.reasoning = "complete";
|
|
3562
|
+
retainPreviewOnCleanupByLane.reasoning = true;
|
|
3563
|
+
}
|
|
3564
|
+
reasoningStepState.resetForNextStep();
|
|
3565
|
+
}
|
|
3566
|
+
}
|
|
3567
|
+
if (segments.length > 0) return;
|
|
3568
|
+
if (split.suppressedReasoningOnly) {
|
|
3569
|
+
if (reply.hasMedia) await sendPayload(typeof payload.text === "string" ? {
|
|
3570
|
+
...payload,
|
|
3571
|
+
text: ""
|
|
3572
|
+
} : payload);
|
|
3573
|
+
if (info.kind === "final") await flushBufferedFinalAnswer();
|
|
3574
|
+
return;
|
|
3575
|
+
}
|
|
3576
|
+
if (info.kind === "final") {
|
|
3577
|
+
await answerLane.stream?.stop();
|
|
3578
|
+
await reasoningLane.stream?.stop();
|
|
3579
|
+
reasoningStepState.resetForNextStep();
|
|
3580
|
+
}
|
|
3581
|
+
if (!(reply.hasMedia || reply.text.length > 0)) {
|
|
3582
|
+
if (info.kind === "final") await flushBufferedFinalAnswer();
|
|
3583
|
+
return;
|
|
3584
|
+
}
|
|
3585
|
+
await sendPayload(payload);
|
|
3586
|
+
if (info.kind === "final") await flushBufferedFinalAnswer();
|
|
3587
|
+
},
|
|
3588
|
+
onSkip: (payload, info) => {
|
|
3589
|
+
if (payload.isError === true) hadErrorReplyFailureOrSkip = true;
|
|
3590
|
+
if (info.reason !== "silent") deliveryState.markNonSilentSkip();
|
|
3591
|
+
},
|
|
3592
|
+
onError: (err, info) => {
|
|
3593
|
+
const errorPolicy = resolveTelegramErrorPolicy({
|
|
3594
|
+
accountConfig: telegramCfg,
|
|
3595
|
+
groupConfig,
|
|
3596
|
+
topicConfig
|
|
3597
|
+
});
|
|
3598
|
+
if (isSilentErrorPolicy(errorPolicy.policy)) return;
|
|
3599
|
+
if (errorPolicy.policy === "once" && shouldSuppressTelegramError({
|
|
3600
|
+
scopeKey: buildTelegramErrorScopeKey({
|
|
3601
|
+
accountId: route.accountId,
|
|
3602
|
+
chatId,
|
|
3603
|
+
threadId: threadSpec.id
|
|
3604
|
+
}),
|
|
3605
|
+
cooldownMs: errorPolicy.cooldownMs,
|
|
3606
|
+
errorMessage: String(err)
|
|
3607
|
+
})) return;
|
|
3608
|
+
deliveryState.markNonSilentFailure();
|
|
3609
|
+
runtime.error?.(danger(`telegram ${info.kind} reply failed: ${String(err)}`));
|
|
3610
|
+
}
|
|
3611
|
+
},
|
|
3612
|
+
replyOptions: {
|
|
3613
|
+
skillFilter,
|
|
3614
|
+
disableBlockStreaming,
|
|
3615
|
+
onPartialReply: answerLane.stream || reasoningLane.stream ? (payload) => enqueueDraftLaneEvent(async () => {
|
|
3616
|
+
await ingestDraftLaneSegments(payload.text);
|
|
3617
|
+
}) : void 0,
|
|
3618
|
+
onReasoningStream: reasoningLane.stream ? (payload) => enqueueDraftLaneEvent(async () => {
|
|
3619
|
+
if (splitReasoningOnNextStream) {
|
|
3620
|
+
reasoningLane.stream?.forceNewMessage();
|
|
3621
|
+
resetDraftLaneState(reasoningLane);
|
|
3622
|
+
splitReasoningOnNextStream = false;
|
|
3623
|
+
}
|
|
3624
|
+
await ingestDraftLaneSegments(payload.text);
|
|
3625
|
+
}) : void 0,
|
|
3626
|
+
onAssistantMessageStart: answerLane.stream ? () => enqueueDraftLaneEvent(async () => {
|
|
3627
|
+
reasoningStepState.resetForNextStep();
|
|
3628
|
+
if (skipNextAnswerMessageStartRotation) {
|
|
3629
|
+
skipNextAnswerMessageStartRotation = false;
|
|
3630
|
+
activePreviewLifecycleByLane.answer = "transient";
|
|
3631
|
+
retainPreviewOnCleanupByLane.answer = false;
|
|
3632
|
+
return;
|
|
3633
|
+
}
|
|
3634
|
+
await rotateAnswerLaneForNewAssistantMessage();
|
|
3635
|
+
activePreviewLifecycleByLane.answer = "transient";
|
|
3636
|
+
retainPreviewOnCleanupByLane.answer = false;
|
|
3637
|
+
}) : void 0,
|
|
3638
|
+
onReasoningEnd: reasoningLane.stream ? () => enqueueDraftLaneEvent(async () => {
|
|
3639
|
+
splitReasoningOnNextStream = reasoningLane.hasStreamedMessage;
|
|
3640
|
+
}) : void 0,
|
|
3641
|
+
onToolStart: statusReactionController ? async (payload) => {
|
|
3642
|
+
await statusReactionController.setTool(payload.name);
|
|
3643
|
+
} : void 0,
|
|
3644
|
+
onCompactionStart: statusReactionController ? () => statusReactionController.setCompacting() : void 0,
|
|
3645
|
+
onCompactionEnd: statusReactionController ? async () => {
|
|
3646
|
+
statusReactionController.cancelPending();
|
|
3647
|
+
await statusReactionController.setThinking();
|
|
3648
|
+
} : void 0,
|
|
3649
|
+
onModelSelected
|
|
3650
|
+
}
|
|
3651
|
+
}));
|
|
3652
|
+
} catch (err) {
|
|
3653
|
+
dispatchError = err;
|
|
3654
|
+
runtime.error?.(danger(`telegram dispatch failed: ${String(err)}`));
|
|
3655
|
+
} finally {
|
|
3656
|
+
await draftLaneEventQueue;
|
|
3657
|
+
const streamCleanupStates = /* @__PURE__ */ new Map();
|
|
3658
|
+
const lanesToCleanup = [{
|
|
3659
|
+
laneName: "answer",
|
|
3660
|
+
lane: answerLane
|
|
3661
|
+
}, {
|
|
3662
|
+
laneName: "reasoning",
|
|
3663
|
+
lane: reasoningLane
|
|
3664
|
+
}];
|
|
3665
|
+
for (const laneState of lanesToCleanup) {
|
|
3666
|
+
const stream = laneState.lane.stream;
|
|
3667
|
+
if (!stream) continue;
|
|
3668
|
+
const activePreviewMessageId = stream.messageId();
|
|
3669
|
+
const hasBoundaryFinalizedActivePreview = laneState.laneName === "answer" && typeof activePreviewMessageId === "number" && archivedAnswerPreviews.some((p) => p.deleteIfUnused === false && p.messageId === activePreviewMessageId);
|
|
3670
|
+
const shouldClear = !retainPreviewOnCleanupByLane[laneState.laneName] && !hasBoundaryFinalizedActivePreview;
|
|
3671
|
+
const existing = streamCleanupStates.get(stream);
|
|
3672
|
+
if (!existing) {
|
|
3673
|
+
streamCleanupStates.set(stream, { shouldClear });
|
|
3674
|
+
continue;
|
|
3675
|
+
}
|
|
3676
|
+
existing.shouldClear = existing.shouldClear && shouldClear;
|
|
3677
|
+
}
|
|
3678
|
+
for (const [stream, cleanupState] of streamCleanupStates) {
|
|
3679
|
+
await stream.stop();
|
|
3680
|
+
if (cleanupState.shouldClear) await stream.clear();
|
|
3681
|
+
}
|
|
3682
|
+
for (const archivedPreview of archivedAnswerPreviews) {
|
|
3683
|
+
if (archivedPreview.deleteIfUnused === false) continue;
|
|
3684
|
+
try {
|
|
3685
|
+
await bot.api.deleteMessage(chatId, archivedPreview.messageId);
|
|
3686
|
+
} catch (err) {
|
|
3687
|
+
logVerbose(`telegram: archived answer preview cleanup failed (${archivedPreview.messageId}): ${String(err)}`);
|
|
3688
|
+
}
|
|
3689
|
+
}
|
|
3690
|
+
for (const messageId of archivedReasoningPreviewIds) try {
|
|
3691
|
+
await bot.api.deleteMessage(chatId, messageId);
|
|
3692
|
+
} catch (err) {
|
|
3693
|
+
logVerbose(`telegram: archived reasoning preview cleanup failed (${messageId}): ${String(err)}`);
|
|
3694
|
+
}
|
|
3695
|
+
}
|
|
3696
|
+
let sentFallback = false;
|
|
3697
|
+
const deliverySummary = deliveryState.snapshot();
|
|
3698
|
+
if (dispatchError || !deliverySummary.delivered && (deliverySummary.skippedNonSilent > 0 || deliverySummary.failedNonSilent > 0)) {
|
|
3699
|
+
const fallbackText = dispatchError ? "Something went wrong while processing your request. Please try again." : EMPTY_RESPONSE_FALLBACK;
|
|
3700
|
+
sentFallback = (await (telegramDeps.deliverReplies ?? deliverReplies)({
|
|
3701
|
+
replies: [{ text: fallbackText }],
|
|
3702
|
+
...deliveryBaseOptions,
|
|
3703
|
+
silent: silentErrorReplies && (dispatchError != null || hadErrorReplyFailureOrSkip),
|
|
3704
|
+
mediaLoader: telegramDeps.loadWebMedia
|
|
3705
|
+
})).delivered;
|
|
3706
|
+
}
|
|
3707
|
+
const hasFinalResponse = queuedFinal || sentFallback;
|
|
3708
|
+
if (statusReactionController && !hasFinalResponse) statusReactionController.setError().catch((err) => {
|
|
3709
|
+
logVerbose(`telegram: status reaction error finalize failed: ${String(err)}`);
|
|
3710
|
+
});
|
|
3711
|
+
if (!hasFinalResponse) {
|
|
3712
|
+
clearGroupHistory();
|
|
3713
|
+
return;
|
|
3714
|
+
}
|
|
3715
|
+
if (isDmTopic && isFirstTurnInSession) {
|
|
3716
|
+
const userMessage = (ctxPayload.RawBody ?? ctxPayload.Body ?? "").slice(0, 500);
|
|
3717
|
+
if (userMessage.trim()) {
|
|
3718
|
+
const agentDir = resolveAgentDir(cfg, route.agentId);
|
|
3719
|
+
const directAutoTopicLabel = (!isGroup ? groupConfig : void 0)?.autoTopicLabel;
|
|
3720
|
+
const accountAutoTopicLabel = telegramCfg?.autoTopicLabel;
|
|
3721
|
+
const autoTopicConfig = resolveAutoTopicLabelConfig(directAutoTopicLabel, accountAutoTopicLabel);
|
|
3722
|
+
if (autoTopicConfig) {
|
|
3723
|
+
const topicThreadId = threadSpec.id;
|
|
3724
|
+
(async () => {
|
|
3725
|
+
try {
|
|
3726
|
+
const label = await generateTopicLabel({
|
|
3727
|
+
userMessage,
|
|
3728
|
+
prompt: autoTopicConfig.prompt,
|
|
3729
|
+
cfg,
|
|
3730
|
+
agentId: route.agentId,
|
|
3731
|
+
agentDir
|
|
3732
|
+
});
|
|
3733
|
+
if (!label) {
|
|
3734
|
+
logVerbose("auto-topic-label: LLM returned empty label");
|
|
3735
|
+
return;
|
|
3736
|
+
}
|
|
3737
|
+
logVerbose(`auto-topic-label: generated label (len=${label.length})`);
|
|
3738
|
+
await bot.api.editForumTopic(chatId, topicThreadId, { name: label });
|
|
3739
|
+
logVerbose(`auto-topic-label: renamed topic ${chatId}/${topicThreadId}`);
|
|
3740
|
+
} catch (err) {
|
|
3741
|
+
logVerbose(`auto-topic-label: failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
3742
|
+
}
|
|
3743
|
+
})();
|
|
3744
|
+
}
|
|
3745
|
+
}
|
|
3746
|
+
}
|
|
3747
|
+
if (statusReactionController) statusReactionController.setDone().catch((err) => {
|
|
3748
|
+
logVerbose(`telegram: status reaction finalize failed: ${String(err)}`);
|
|
3749
|
+
});
|
|
3750
|
+
else removeAckReactionAfterReply({
|
|
3751
|
+
removeAfterReply: removeAckAfterReply,
|
|
3752
|
+
ackReactionPromise,
|
|
3753
|
+
ackReactionValue: ackReactionPromise ? "ack" : null,
|
|
3754
|
+
remove: () => (reactionApi?.(chatId, msg.message_id ?? 0, []) ?? Promise.resolve()).then(() => {}),
|
|
3755
|
+
onError: (err) => {
|
|
3756
|
+
if (!msg.message_id) return;
|
|
3757
|
+
logAckFailure({
|
|
3758
|
+
log: logVerbose,
|
|
3759
|
+
channel: "telegram",
|
|
3760
|
+
target: `${chatId}/${msg.message_id}`,
|
|
3761
|
+
error: err
|
|
3762
|
+
});
|
|
3763
|
+
}
|
|
3764
|
+
});
|
|
3765
|
+
clearGroupHistory();
|
|
3766
|
+
};
|
|
3767
|
+
//#endregion
|
|
3768
|
+
//#region extensions/telegram/src/bot-message.ts
|
|
3769
|
+
const createTelegramMessageProcessor = (deps) => {
|
|
3770
|
+
const { bot, cfg, account, telegramCfg, historyLimit, groupHistories, dmPolicy, allowFrom, groupAllowFrom, ackReactionScope, logger, resolveGroupActivation, resolveGroupRequireMention, resolveTelegramGroupConfig, loadFreshConfig, sendChatActionHandler, runtime, replyToMode, streamMode, textLimit, telegramDeps, opts } = deps;
|
|
3771
|
+
return async (primaryCtx, allMedia, storeAllowFrom, options, replyMedia) => {
|
|
3772
|
+
const ingressReceivedAtMs = typeof options?.receivedAtMs === "number" && Number.isFinite(options.receivedAtMs) ? options.receivedAtMs : void 0;
|
|
3773
|
+
const ingressDebugEnabled = shouldLogVerbose() || process.env.OPENCLAW_DEBUG_TELEGRAM_INGRESS === "1";
|
|
3774
|
+
const ingressContextStartMs = ingressReceivedAtMs ? Date.now() : void 0;
|
|
3775
|
+
const context = await buildTelegramMessageContext({
|
|
3776
|
+
primaryCtx,
|
|
3777
|
+
allMedia,
|
|
3778
|
+
replyMedia,
|
|
3779
|
+
storeAllowFrom,
|
|
3780
|
+
options,
|
|
3781
|
+
bot,
|
|
3782
|
+
cfg,
|
|
3783
|
+
account,
|
|
3784
|
+
historyLimit,
|
|
3785
|
+
groupHistories,
|
|
3786
|
+
dmPolicy,
|
|
3787
|
+
allowFrom,
|
|
3788
|
+
groupAllowFrom,
|
|
3789
|
+
ackReactionScope,
|
|
3790
|
+
logger,
|
|
3791
|
+
resolveGroupActivation,
|
|
3792
|
+
resolveGroupRequireMention,
|
|
3793
|
+
resolveTelegramGroupConfig,
|
|
3794
|
+
sendChatActionHandler,
|
|
3795
|
+
loadFreshConfig,
|
|
3796
|
+
upsertPairingRequest: telegramDeps.upsertChannelPairingRequest
|
|
3797
|
+
});
|
|
3798
|
+
if (!context) {
|
|
3799
|
+
if (ingressDebugEnabled && ingressReceivedAtMs && ingressContextStartMs) logVerbose(`telegram ingress: chatId=${primaryCtx.message.chat.id} dropped after ${Date.now() - ingressReceivedAtMs}ms${options?.ingressBuffer ? ` buffer=${options.ingressBuffer}` : ""}`);
|
|
3800
|
+
return;
|
|
3801
|
+
}
|
|
3802
|
+
if (ingressDebugEnabled && ingressReceivedAtMs && ingressContextStartMs) logVerbose(`telegram ingress: chatId=${context.chatId} contextReadyMs=${Date.now() - ingressReceivedAtMs} preDispatchMs=${Date.now() - ingressContextStartMs}${options?.ingressBuffer ? ` buffer=${options.ingressBuffer}` : ""}`);
|
|
3803
|
+
try {
|
|
3804
|
+
await dispatchTelegramMessage({
|
|
3805
|
+
context,
|
|
3806
|
+
bot,
|
|
3807
|
+
cfg,
|
|
3808
|
+
runtime,
|
|
3809
|
+
replyToMode,
|
|
3810
|
+
streamMode,
|
|
3811
|
+
textLimit,
|
|
3812
|
+
telegramCfg,
|
|
3813
|
+
telegramDeps,
|
|
3814
|
+
opts
|
|
3815
|
+
});
|
|
3816
|
+
if (ingressDebugEnabled && ingressReceivedAtMs) logVerbose(`telegram ingress: chatId=${context.chatId} dispatchCompleteMs=${Date.now() - ingressReceivedAtMs}${options?.ingressBuffer ? ` buffer=${options.ingressBuffer}` : ""}`);
|
|
3817
|
+
} catch (err) {
|
|
3818
|
+
runtime.error?.(danger(`telegram message processing failed: ${String(err)}`));
|
|
3819
|
+
try {
|
|
3820
|
+
await bot.api.sendMessage(context.chatId, "Something went wrong while processing your request. Please try again.", buildTelegramThreadParams(context.threadSpec));
|
|
3821
|
+
} catch {}
|
|
3822
|
+
}
|
|
3823
|
+
};
|
|
3824
|
+
};
|
|
3825
|
+
//#endregion
|
|
3826
|
+
//#region extensions/telegram/src/sendchataction-401-backoff.ts
|
|
3827
|
+
const BACKOFF_POLICY = {
|
|
3828
|
+
initialMs: 1e3,
|
|
3829
|
+
maxMs: 3e5,
|
|
3830
|
+
factor: 2,
|
|
3831
|
+
jitter: .1
|
|
3832
|
+
};
|
|
3833
|
+
function is401Error(error) {
|
|
3834
|
+
if (!error) return false;
|
|
3835
|
+
const message = error instanceof Error ? error.message : JSON.stringify(error);
|
|
3836
|
+
return message.includes("401") || message.toLowerCase().includes("unauthorized");
|
|
3837
|
+
}
|
|
3838
|
+
/**
|
|
3839
|
+
* Creates a GLOBAL (per-account) handler for sendChatAction that tracks 401 errors
|
|
3840
|
+
* across all message contexts. This prevents the infinite loop that caused Telegram
|
|
3841
|
+
* to delete bots (issue #27092).
|
|
3842
|
+
*
|
|
3843
|
+
* When a 401 occurs, exponential backoff is applied (1s → 2s → 4s → ... → 5min).
|
|
3844
|
+
* After maxConsecutive401 failures (default 10), all sendChatAction calls are
|
|
3845
|
+
* suspended until reset() is called.
|
|
3846
|
+
*/
|
|
3847
|
+
function createTelegramSendChatActionHandler({ sendChatActionFn, logger, maxConsecutive401 = 10 }) {
|
|
3848
|
+
let consecutive401Failures = 0;
|
|
3849
|
+
let suspended = false;
|
|
3850
|
+
const reset = () => {
|
|
3851
|
+
consecutive401Failures = 0;
|
|
3852
|
+
suspended = false;
|
|
3853
|
+
};
|
|
3854
|
+
const sendChatAction = async (chatId, action, threadParams) => {
|
|
3855
|
+
if (suspended) return;
|
|
3856
|
+
if (consecutive401Failures > 0) {
|
|
3857
|
+
const backoffMs = computeBackoff(BACKOFF_POLICY, consecutive401Failures);
|
|
3858
|
+
logger(`sendChatAction backoff: waiting ${backoffMs}ms before retry (failure ${consecutive401Failures}/${maxConsecutive401})`);
|
|
3859
|
+
await sleepWithAbort(backoffMs);
|
|
3860
|
+
}
|
|
3861
|
+
try {
|
|
3862
|
+
await sendChatActionFn(chatId, action, threadParams);
|
|
3863
|
+
if (consecutive401Failures > 0) {
|
|
3864
|
+
logger(`sendChatAction recovered after ${consecutive401Failures} consecutive 401 failures`);
|
|
3865
|
+
consecutive401Failures = 0;
|
|
3866
|
+
}
|
|
3867
|
+
} catch (error) {
|
|
3868
|
+
if (is401Error(error)) {
|
|
3869
|
+
consecutive401Failures++;
|
|
3870
|
+
if (consecutive401Failures >= maxConsecutive401) {
|
|
3871
|
+
suspended = true;
|
|
3872
|
+
logger(`CRITICAL: sendChatAction suspended after ${consecutive401Failures} consecutive 401 errors. Bot token is likely invalid. Telegram may DELETE the bot if requests continue. Replace the token and restart: openclaw channels restart telegram`);
|
|
3873
|
+
} else logger(`sendChatAction 401 error (${consecutive401Failures}/${maxConsecutive401}). Retrying with exponential backoff.`);
|
|
3874
|
+
}
|
|
3875
|
+
throw error;
|
|
3876
|
+
}
|
|
3877
|
+
};
|
|
3878
|
+
return {
|
|
3879
|
+
sendChatAction,
|
|
3880
|
+
isSuspended: () => suspended,
|
|
3881
|
+
reset
|
|
3882
|
+
};
|
|
3883
|
+
}
|
|
3884
|
+
//#endregion
|
|
3885
|
+
//#region extensions/telegram/src/sequential-key.ts
|
|
3886
|
+
function getTelegramSequentialKey(ctx) {
|
|
3887
|
+
const reaction = ctx.update?.message_reaction;
|
|
3888
|
+
if (reaction?.chat?.id) return `telegram:${reaction.chat.id}`;
|
|
3889
|
+
const msg = ctx.message ?? ctx.channelPost ?? ctx.editedChannelPost ?? ctx.update?.message ?? ctx.update?.edited_message ?? ctx.update?.channel_post ?? ctx.update?.edited_channel_post ?? ctx.update?.callback_query?.message;
|
|
3890
|
+
const chatId = msg?.chat?.id ?? ctx.chat?.id;
|
|
3891
|
+
const rawText = msg?.text ?? msg?.caption;
|
|
3892
|
+
const botUsername = ctx.me?.username;
|
|
3893
|
+
if (isAbortRequestText(rawText, botUsername ? { botUsername } : void 0)) {
|
|
3894
|
+
if (typeof chatId === "number") return `telegram:${chatId}:control`;
|
|
3895
|
+
return "telegram:control";
|
|
3896
|
+
}
|
|
3897
|
+
if (isBtwRequestText(rawText, botUsername ? { botUsername } : void 0)) {
|
|
3898
|
+
const messageId = msg?.message_id;
|
|
3899
|
+
if (typeof chatId === "number" && typeof messageId === "number") return `telegram:${chatId}:btw:${messageId}`;
|
|
3900
|
+
if (typeof chatId === "number") return `telegram:${chatId}:btw`;
|
|
3901
|
+
return "telegram:btw";
|
|
3902
|
+
}
|
|
3903
|
+
const isGroup = msg?.chat?.type === "group" || msg?.chat?.type === "supergroup";
|
|
3904
|
+
const messageThreadId = msg?.message_thread_id;
|
|
3905
|
+
const isForum = msg?.chat?.is_forum;
|
|
3906
|
+
const threadId = isGroup ? resolveTelegramForumThreadId({
|
|
3907
|
+
isForum,
|
|
3908
|
+
messageThreadId
|
|
3909
|
+
}) : messageThreadId;
|
|
3910
|
+
if (typeof chatId === "number") return threadId != null ? `telegram:${chatId}:topic:${threadId}` : `telegram:${chatId}`;
|
|
3911
|
+
return "telegram:unknown";
|
|
3912
|
+
}
|
|
3913
|
+
//#endregion
|
|
3914
|
+
//#region extensions/telegram/src/bot.ts
|
|
3915
|
+
const DEFAULT_TELEGRAM_BOT_RUNTIME = {
|
|
3916
|
+
Bot: Bot$1,
|
|
3917
|
+
sequentialize,
|
|
3918
|
+
apiThrottler
|
|
3919
|
+
};
|
|
3920
|
+
const TELEGRAM_GET_UPDATES_REQUEST_TIMEOUT_MS = 45e3;
|
|
3921
|
+
let telegramBotRuntimeForTest;
|
|
3922
|
+
function asTelegramClientFetch(fetchImpl) {
|
|
3923
|
+
return fetchImpl;
|
|
3924
|
+
}
|
|
3925
|
+
function asTelegramCompatFetch(fetchImpl) {
|
|
3926
|
+
return fetchImpl;
|
|
3927
|
+
}
|
|
3928
|
+
function readRequestUrl(input) {
|
|
3929
|
+
if (typeof input === "string") return input;
|
|
3930
|
+
if (input instanceof URL) return input.toString();
|
|
3931
|
+
if (input instanceof Request) return input.url;
|
|
3932
|
+
return null;
|
|
3933
|
+
}
|
|
3934
|
+
function extractTelegramApiMethod(input) {
|
|
3935
|
+
const url = readRequestUrl(input);
|
|
3936
|
+
if (!url) return null;
|
|
3937
|
+
try {
|
|
3938
|
+
const segments = new URL(url).pathname.split("/").filter(Boolean);
|
|
3939
|
+
return (segments.length > 0 ? segments.at(-1) ?? null : null)?.toLowerCase() ?? null;
|
|
3940
|
+
} catch {
|
|
3941
|
+
return null;
|
|
3942
|
+
}
|
|
3943
|
+
}
|
|
3944
|
+
function createTelegramBot(opts) {
|
|
3945
|
+
const botRuntime = telegramBotRuntimeForTest ?? DEFAULT_TELEGRAM_BOT_RUNTIME;
|
|
3946
|
+
const runtime = opts.runtime ?? createNonExitingRuntime();
|
|
3947
|
+
const telegramDeps = opts.telegramDeps ?? defaultTelegramBotDeps;
|
|
3948
|
+
const cfg = opts.config ?? telegramDeps.loadConfig();
|
|
3949
|
+
const account = resolveTelegramAccount({
|
|
3950
|
+
cfg,
|
|
3951
|
+
accountId: opts.accountId
|
|
3952
|
+
});
|
|
3953
|
+
const threadBindingManager = resolveThreadBindingSpawnPolicy({
|
|
3954
|
+
cfg,
|
|
3955
|
+
channel: "telegram",
|
|
3956
|
+
accountId: account.accountId,
|
|
3957
|
+
kind: "subagent"
|
|
3958
|
+
}).enabled ? createTelegramThreadBindingManager({
|
|
3959
|
+
accountId: account.accountId,
|
|
3960
|
+
idleTimeoutMs: resolveThreadBindingIdleTimeoutMsForChannel({
|
|
3961
|
+
cfg,
|
|
3962
|
+
channel: "telegram",
|
|
3963
|
+
accountId: account.accountId
|
|
3964
|
+
}),
|
|
3965
|
+
maxAgeMs: resolveThreadBindingMaxAgeMsForChannel({
|
|
3966
|
+
cfg,
|
|
3967
|
+
channel: "telegram",
|
|
3968
|
+
accountId: account.accountId
|
|
3969
|
+
})
|
|
3970
|
+
}) : null;
|
|
3971
|
+
const telegramCfg = account.config;
|
|
3972
|
+
const telegramTransport = opts.telegramTransport ?? resolveTelegramTransport(opts.proxyFetch, { network: telegramCfg.network });
|
|
3973
|
+
const shouldProvideFetch = Boolean(telegramTransport.fetch);
|
|
3974
|
+
const fetchForClient = telegramTransport.fetch ? asTelegramCompatFetch(asTelegramClientFetch(telegramTransport.fetch)) : void 0;
|
|
3975
|
+
let finalFetch = shouldProvideFetch ? fetchForClient : void 0;
|
|
3976
|
+
if (finalFetch || opts.fetchAbortSignal) {
|
|
3977
|
+
const callFetch = finalFetch ?? asTelegramCompatFetch(asTelegramClientFetch(globalThis.fetch));
|
|
3978
|
+
finalFetch = (input, init) => {
|
|
3979
|
+
const controller = new AbortController();
|
|
3980
|
+
const abortWith = (signal) => controller.abort(signal.reason);
|
|
3981
|
+
const shutdownSignal = opts.fetchAbortSignal;
|
|
3982
|
+
const onShutdown = () => {
|
|
3983
|
+
if (shutdownSignal) abortWith(shutdownSignal);
|
|
3984
|
+
};
|
|
3985
|
+
const method = extractTelegramApiMethod(input);
|
|
3986
|
+
const requestTimeoutMs = method === "getupdates" ? TELEGRAM_GET_UPDATES_REQUEST_TIMEOUT_MS : void 0;
|
|
3987
|
+
let requestTimeout;
|
|
3988
|
+
let onRequestAbort;
|
|
3989
|
+
const requestSignal = init?.signal;
|
|
3990
|
+
if (shutdownSignal?.aborted) abortWith(shutdownSignal);
|
|
3991
|
+
else if (shutdownSignal) shutdownSignal.addEventListener("abort", onShutdown, { once: true });
|
|
3992
|
+
if (requestSignal) if (requestSignal.aborted) abortWith(requestSignal);
|
|
3993
|
+
else {
|
|
3994
|
+
onRequestAbort = () => abortWith(requestSignal);
|
|
3995
|
+
requestSignal.addEventListener("abort", onRequestAbort);
|
|
3996
|
+
}
|
|
3997
|
+
if (requestTimeoutMs) {
|
|
3998
|
+
requestTimeout = setTimeout(() => {
|
|
3999
|
+
controller.abort(/* @__PURE__ */ new Error(`Telegram ${method} timed out after ${requestTimeoutMs}ms`));
|
|
4000
|
+
}, requestTimeoutMs);
|
|
4001
|
+
requestTimeout.unref?.();
|
|
4002
|
+
}
|
|
4003
|
+
return callFetch(input, {
|
|
4004
|
+
...init,
|
|
4005
|
+
signal: controller.signal
|
|
4006
|
+
}).finally(() => {
|
|
4007
|
+
if (requestTimeout) clearTimeout(requestTimeout);
|
|
4008
|
+
shutdownSignal?.removeEventListener("abort", onShutdown);
|
|
4009
|
+
if (requestSignal && onRequestAbort) requestSignal.removeEventListener("abort", onRequestAbort);
|
|
4010
|
+
});
|
|
4011
|
+
};
|
|
4012
|
+
}
|
|
4013
|
+
if (finalFetch) {
|
|
4014
|
+
const baseFetch = finalFetch;
|
|
4015
|
+
finalFetch = (input, init) => {
|
|
4016
|
+
return Promise.resolve(baseFetch(input, init)).catch((err) => {
|
|
4017
|
+
try {
|
|
4018
|
+
tagTelegramNetworkError(err, {
|
|
4019
|
+
method: extractTelegramApiMethod(input),
|
|
4020
|
+
url: readRequestUrl(input)
|
|
4021
|
+
});
|
|
4022
|
+
} catch {}
|
|
4023
|
+
throw err;
|
|
4024
|
+
});
|
|
4025
|
+
};
|
|
4026
|
+
}
|
|
4027
|
+
const timeoutSeconds = typeof telegramCfg?.timeoutSeconds === "number" && Number.isFinite(telegramCfg.timeoutSeconds) ? Math.max(1, Math.floor(telegramCfg.timeoutSeconds)) : void 0;
|
|
4028
|
+
const apiRoot = telegramCfg.apiRoot?.trim() || void 0;
|
|
4029
|
+
const client = finalFetch || timeoutSeconds || apiRoot ? {
|
|
4030
|
+
...finalFetch ? { fetch: asTelegramClientFetch(finalFetch) } : {},
|
|
4031
|
+
...timeoutSeconds ? { timeoutSeconds } : {},
|
|
4032
|
+
...apiRoot ? { apiRoot } : {}
|
|
4033
|
+
} : void 0;
|
|
4034
|
+
const bot = new botRuntime.Bot(opts.token, client ? { client } : void 0);
|
|
4035
|
+
bot.api.config.use(botRuntime.apiThrottler());
|
|
4036
|
+
bot.catch((err) => {
|
|
4037
|
+
runtime.error?.(danger(`telegram bot error: ${formatUncaughtError(err)}`));
|
|
4038
|
+
});
|
|
4039
|
+
const recentUpdates = createTelegramUpdateDedupe();
|
|
4040
|
+
const initialUpdateId = typeof opts.updateOffset?.lastUpdateId === "number" ? opts.updateOffset.lastUpdateId : null;
|
|
4041
|
+
const pendingUpdateIds = /* @__PURE__ */ new Set();
|
|
4042
|
+
let highestCompletedUpdateId = initialUpdateId;
|
|
4043
|
+
let highestPersistedUpdateId = initialUpdateId;
|
|
4044
|
+
const maybePersistSafeWatermark = () => {
|
|
4045
|
+
if (typeof opts.updateOffset?.onUpdateId !== "function") return;
|
|
4046
|
+
if (highestCompletedUpdateId === null) return;
|
|
4047
|
+
let safe = highestCompletedUpdateId;
|
|
4048
|
+
if (pendingUpdateIds.size > 0) {
|
|
4049
|
+
let minPending = null;
|
|
4050
|
+
for (const id of pendingUpdateIds) if (minPending === null || id < minPending) minPending = id;
|
|
4051
|
+
if (minPending !== null) safe = Math.min(safe, minPending - 1);
|
|
4052
|
+
}
|
|
4053
|
+
if (highestPersistedUpdateId !== null && safe <= highestPersistedUpdateId) return;
|
|
4054
|
+
highestPersistedUpdateId = safe;
|
|
4055
|
+
opts.updateOffset.onUpdateId(safe);
|
|
4056
|
+
};
|
|
4057
|
+
const shouldSkipUpdate = (ctx) => {
|
|
4058
|
+
const updateId = resolveTelegramUpdateId(ctx);
|
|
4059
|
+
const skipCutoff = highestPersistedUpdateId ?? initialUpdateId;
|
|
4060
|
+
if (typeof updateId === "number" && skipCutoff !== null && updateId <= skipCutoff) return true;
|
|
4061
|
+
const key = buildTelegramUpdateKey(ctx);
|
|
4062
|
+
const skipped = recentUpdates.check(key);
|
|
4063
|
+
if (skipped && key && shouldLogVerbose()) logVerbose(`telegram dedupe: skipped ${key}`);
|
|
4064
|
+
return skipped;
|
|
4065
|
+
};
|
|
4066
|
+
bot.use(async (ctx, next) => {
|
|
4067
|
+
const updateId = resolveTelegramUpdateId(ctx);
|
|
4068
|
+
if (typeof updateId === "number") pendingUpdateIds.add(updateId);
|
|
4069
|
+
try {
|
|
4070
|
+
await next();
|
|
4071
|
+
} finally {
|
|
4072
|
+
if (typeof updateId === "number") {
|
|
4073
|
+
pendingUpdateIds.delete(updateId);
|
|
4074
|
+
if (highestCompletedUpdateId === null || updateId > highestCompletedUpdateId) highestCompletedUpdateId = updateId;
|
|
4075
|
+
maybePersistSafeWatermark();
|
|
4076
|
+
}
|
|
4077
|
+
}
|
|
4078
|
+
});
|
|
4079
|
+
bot.use(botRuntime.sequentialize(getTelegramSequentialKey));
|
|
4080
|
+
const rawUpdateLogger = createSubsystemLogger("gateway/channels/telegram/raw-update");
|
|
4081
|
+
const MAX_RAW_UPDATE_CHARS = 8e3;
|
|
4082
|
+
const MAX_RAW_UPDATE_STRING = 500;
|
|
4083
|
+
const MAX_RAW_UPDATE_ARRAY = 20;
|
|
4084
|
+
const stringifyUpdate = (update) => {
|
|
4085
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
4086
|
+
return JSON.stringify(update ?? null, (key, value) => {
|
|
4087
|
+
if (typeof value === "string" && value.length > MAX_RAW_UPDATE_STRING) return `${value.slice(0, MAX_RAW_UPDATE_STRING)}...`;
|
|
4088
|
+
if (Array.isArray(value) && value.length > MAX_RAW_UPDATE_ARRAY) return [...value.slice(0, MAX_RAW_UPDATE_ARRAY), `...(${value.length - MAX_RAW_UPDATE_ARRAY} more)`];
|
|
4089
|
+
if (value && typeof value === "object") {
|
|
4090
|
+
if (seen.has(value)) return "[Circular]";
|
|
4091
|
+
seen.add(value);
|
|
4092
|
+
}
|
|
4093
|
+
return value;
|
|
4094
|
+
});
|
|
4095
|
+
};
|
|
4096
|
+
bot.use(async (ctx, next) => {
|
|
4097
|
+
if (shouldLogVerbose()) try {
|
|
4098
|
+
const raw = stringifyUpdate(ctx.update);
|
|
4099
|
+
const preview = raw.length > MAX_RAW_UPDATE_CHARS ? `${raw.slice(0, MAX_RAW_UPDATE_CHARS)}...` : raw;
|
|
4100
|
+
rawUpdateLogger.debug(`telegram update: ${preview}`);
|
|
4101
|
+
} catch (err) {
|
|
4102
|
+
rawUpdateLogger.debug(`telegram update log failed: ${String(err)}`);
|
|
4103
|
+
}
|
|
4104
|
+
await next();
|
|
4105
|
+
});
|
|
4106
|
+
const historyLimit = Math.max(0, telegramCfg.historyLimit ?? cfg.messages?.groupChat?.historyLimit ?? 50);
|
|
4107
|
+
const groupHistories = /* @__PURE__ */ new Map();
|
|
4108
|
+
const textLimit = resolveTextChunkLimit(cfg, "telegram", account.accountId);
|
|
4109
|
+
const dmPolicy = telegramCfg.dmPolicy ?? "pairing";
|
|
4110
|
+
const allowFrom = opts.allowFrom ?? telegramCfg.allowFrom;
|
|
4111
|
+
const groupAllowFrom = opts.groupAllowFrom ?? telegramCfg.groupAllowFrom ?? telegramCfg.allowFrom ?? allowFrom;
|
|
4112
|
+
const replyToMode = opts.replyToMode ?? telegramCfg.replyToMode ?? "off";
|
|
4113
|
+
const nativeEnabled = resolveNativeCommandsEnabled({
|
|
4114
|
+
providerId: "telegram",
|
|
4115
|
+
providerSetting: telegramCfg.commands?.native,
|
|
4116
|
+
globalSetting: cfg.commands?.native
|
|
4117
|
+
});
|
|
4118
|
+
const nativeSkillsEnabled = resolveNativeSkillsEnabled({
|
|
4119
|
+
providerId: "telegram",
|
|
4120
|
+
providerSetting: telegramCfg.commands?.nativeSkills,
|
|
4121
|
+
globalSetting: cfg.commands?.nativeSkills
|
|
4122
|
+
});
|
|
4123
|
+
const nativeDisabledExplicit = isNativeCommandsExplicitlyDisabled({
|
|
4124
|
+
providerSetting: telegramCfg.commands?.native,
|
|
4125
|
+
globalSetting: cfg.commands?.native
|
|
4126
|
+
});
|
|
4127
|
+
const useAccessGroups = cfg.commands?.useAccessGroups !== false;
|
|
4128
|
+
const ackReactionScope = cfg.messages?.ackReactionScope ?? "group-mentions";
|
|
4129
|
+
const mediaMaxBytes = (opts.mediaMaxMb ?? telegramCfg.mediaMaxMb ?? 100) * 1024 * 1024;
|
|
4130
|
+
const logger = getChildLogger({ module: "telegram-auto-reply" });
|
|
4131
|
+
const streamMode = resolveTelegramStreamMode(telegramCfg);
|
|
4132
|
+
const resolveGroupPolicy = (chatId) => resolveChannelGroupPolicy({
|
|
4133
|
+
cfg,
|
|
4134
|
+
channel: "telegram",
|
|
4135
|
+
accountId: account.accountId,
|
|
4136
|
+
groupId: String(chatId)
|
|
4137
|
+
});
|
|
4138
|
+
const resolveGroupActivation = (params) => {
|
|
4139
|
+
const agentId = params.agentId ?? resolveDefaultAgentId(cfg);
|
|
4140
|
+
const sessionKey = params.sessionKey ?? `agent:${agentId}:telegram:group:${buildTelegramGroupPeerId(params.chatId, params.messageThreadId)}`;
|
|
4141
|
+
const storePath = resolveStorePath(cfg.session?.store, { agentId });
|
|
4142
|
+
try {
|
|
4143
|
+
const entry = (telegramDeps.loadSessionStore ?? loadSessionStore)(storePath)[sessionKey];
|
|
4144
|
+
if (entry?.groupActivation === "always") return false;
|
|
4145
|
+
if (entry?.groupActivation === "mention") return true;
|
|
4146
|
+
} catch (err) {
|
|
4147
|
+
logVerbose(`Failed to load session for activation check: ${String(err)}`);
|
|
4148
|
+
}
|
|
4149
|
+
};
|
|
4150
|
+
const resolveGroupRequireMention = (chatId) => resolveChannelGroupRequireMention({
|
|
4151
|
+
cfg,
|
|
4152
|
+
channel: "telegram",
|
|
4153
|
+
accountId: account.accountId,
|
|
4154
|
+
groupId: String(chatId),
|
|
4155
|
+
requireMentionOverride: opts.requireMention,
|
|
4156
|
+
overrideOrder: "after-config"
|
|
4157
|
+
});
|
|
4158
|
+
const loadFreshTelegramAccountConfig = () => {
|
|
4159
|
+
try {
|
|
4160
|
+
return resolveTelegramAccount({
|
|
4161
|
+
cfg: telegramDeps.loadConfig(),
|
|
4162
|
+
accountId: account.accountId
|
|
4163
|
+
}).config;
|
|
4164
|
+
} catch (error) {
|
|
4165
|
+
logVerbose(`telegram: failed to load fresh config for account ${account.accountId}; using startup snapshot: ${String(error)}`);
|
|
4166
|
+
return telegramCfg;
|
|
4167
|
+
}
|
|
4168
|
+
};
|
|
4169
|
+
const resolveTelegramGroupConfig = (chatId, messageThreadId) => {
|
|
4170
|
+
const freshTelegramCfg = loadFreshTelegramAccountConfig();
|
|
4171
|
+
const groups = freshTelegramCfg.groups;
|
|
4172
|
+
const direct = freshTelegramCfg.direct;
|
|
4173
|
+
const chatIdStr = String(chatId);
|
|
4174
|
+
if (!chatIdStr.startsWith("-")) {
|
|
4175
|
+
const directConfig = direct?.[chatIdStr] ?? direct?.["*"];
|
|
4176
|
+
if (directConfig) return {
|
|
4177
|
+
groupConfig: directConfig,
|
|
4178
|
+
topicConfig: messageThreadId != null ? directConfig.topics?.[String(messageThreadId)] : void 0
|
|
4179
|
+
};
|
|
4180
|
+
return {
|
|
4181
|
+
groupConfig: void 0,
|
|
4182
|
+
topicConfig: void 0
|
|
4183
|
+
};
|
|
4184
|
+
}
|
|
4185
|
+
if (!groups) return {
|
|
4186
|
+
groupConfig: void 0,
|
|
4187
|
+
topicConfig: void 0
|
|
4188
|
+
};
|
|
4189
|
+
const groupConfig = groups[chatIdStr] ?? groups["*"];
|
|
4190
|
+
return {
|
|
4191
|
+
groupConfig,
|
|
4192
|
+
topicConfig: messageThreadId != null ? groupConfig?.topics?.[String(messageThreadId)] : void 0
|
|
4193
|
+
};
|
|
4194
|
+
};
|
|
4195
|
+
const processMessage = createTelegramMessageProcessor({
|
|
4196
|
+
bot,
|
|
4197
|
+
cfg,
|
|
4198
|
+
account,
|
|
4199
|
+
telegramCfg,
|
|
4200
|
+
historyLimit,
|
|
4201
|
+
groupHistories,
|
|
4202
|
+
dmPolicy,
|
|
4203
|
+
allowFrom,
|
|
4204
|
+
groupAllowFrom,
|
|
4205
|
+
ackReactionScope,
|
|
4206
|
+
logger,
|
|
4207
|
+
resolveGroupActivation,
|
|
4208
|
+
resolveGroupRequireMention,
|
|
4209
|
+
resolveTelegramGroupConfig,
|
|
4210
|
+
loadFreshConfig: () => telegramDeps.loadConfig(),
|
|
4211
|
+
sendChatActionHandler: createTelegramSendChatActionHandler({
|
|
4212
|
+
sendChatActionFn: (chatId, action, threadParams) => bot.api.sendChatAction(chatId, action, threadParams),
|
|
4213
|
+
logger: (message) => logVerbose(`telegram: ${message}`)
|
|
4214
|
+
}),
|
|
4215
|
+
runtime,
|
|
4216
|
+
replyToMode,
|
|
4217
|
+
streamMode,
|
|
4218
|
+
textLimit,
|
|
4219
|
+
opts,
|
|
4220
|
+
telegramDeps
|
|
4221
|
+
});
|
|
4222
|
+
registerTelegramNativeCommands({
|
|
4223
|
+
bot,
|
|
4224
|
+
cfg,
|
|
4225
|
+
runtime,
|
|
4226
|
+
accountId: account.accountId,
|
|
4227
|
+
telegramCfg,
|
|
4228
|
+
allowFrom,
|
|
4229
|
+
groupAllowFrom,
|
|
4230
|
+
replyToMode,
|
|
4231
|
+
textLimit,
|
|
4232
|
+
useAccessGroups,
|
|
4233
|
+
nativeEnabled,
|
|
4234
|
+
nativeSkillsEnabled,
|
|
4235
|
+
nativeDisabledExplicit,
|
|
4236
|
+
resolveGroupPolicy,
|
|
4237
|
+
resolveTelegramGroupConfig,
|
|
4238
|
+
shouldSkipUpdate,
|
|
4239
|
+
opts,
|
|
4240
|
+
telegramDeps
|
|
4241
|
+
});
|
|
4242
|
+
registerTelegramHandlers({
|
|
4243
|
+
cfg,
|
|
4244
|
+
accountId: account.accountId,
|
|
4245
|
+
bot,
|
|
4246
|
+
opts,
|
|
4247
|
+
telegramTransport,
|
|
4248
|
+
runtime,
|
|
4249
|
+
mediaMaxBytes,
|
|
4250
|
+
telegramCfg,
|
|
4251
|
+
allowFrom,
|
|
4252
|
+
groupAllowFrom,
|
|
4253
|
+
resolveGroupPolicy,
|
|
4254
|
+
resolveTelegramGroupConfig,
|
|
4255
|
+
shouldSkipUpdate,
|
|
4256
|
+
processMessage,
|
|
4257
|
+
logger,
|
|
4258
|
+
telegramDeps
|
|
4259
|
+
});
|
|
4260
|
+
const originalStop = bot.stop.bind(bot);
|
|
4261
|
+
bot.stop = ((...args) => {
|
|
4262
|
+
threadBindingManager?.stop();
|
|
4263
|
+
return originalStop(...args);
|
|
4264
|
+
});
|
|
4265
|
+
return bot;
|
|
4266
|
+
}
|
|
4267
|
+
//#endregion
|
|
4268
|
+
export { TelegramExecApprovalHandler as n, createTelegramBot as t };
|