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,4976 @@
|
|
|
1
|
+
import { t as formatDocsLink } from "./links-D7o22Ygt.js";
|
|
2
|
+
import { r as normalizeProviderId } from "./provider-id-CHzLB538.js";
|
|
3
|
+
import { _ as normalizeAccountId, d as resolveThreadSessionKeys$1, g as DEFAULT_ACCOUNT_ID } from "./session-key-Do__tq1E.js";
|
|
4
|
+
import { a as hasConfiguredSecretInput, c as normalizeResolvedSecretInputString, l as normalizeSecretInputString } from "./types.secrets-BpcqHPAv.js";
|
|
5
|
+
import { I as requireOpenAllowFrom, h as MarkdownConfigSchema, l as GroupPolicySchema, n as BlockStreamingCoalesceSchema, o as DmPolicySchema } from "./zod-schema.core-C1Ewlj9j.js";
|
|
6
|
+
import { r as buildChannelConfigSchema } from "./config-schema-mfJ91WLf.js";
|
|
7
|
+
import { t as safeEqualSecret } from "./secret-equal-fMR1DjSl.js";
|
|
8
|
+
import { o as isTrustedProxyAddress, u as resolveClientIp } from "./net-DjzoSxQo.js";
|
|
9
|
+
import { i as loadSessionStore } from "./store-DJaTq2_f.js";
|
|
10
|
+
import { l as resolveStorePath } from "./paths-BJziUb2E.js";
|
|
11
|
+
import { i as parseStrictPositiveInteger } from "./parse-finite-number-BqmKghie.js";
|
|
12
|
+
import { n as safeParseWithSchema, t as safeParseJsonWithSchema } from "./zod-parse-DUwsd88H.js";
|
|
13
|
+
import { t as rawDataToString } from "./ws-BY-L7BeD.js";
|
|
14
|
+
import { t as createDedupeCache } from "./dedupe-Bc4PYKgL.js";
|
|
15
|
+
import { a as createSetupInputPresenceValidator, n as applySetupAccountConfigPatch, s as migrateBaseNameToDefaultAccount, t as applyAccountNameToChannelSection } from "./setup-helpers-D-3hhNDw.js";
|
|
16
|
+
import { a as warnMissingProviderGroupPolicyFallbackOnce, n as resolveAllowlistProviderRuntimeGroupPolicy, r as resolveDefaultGroupPolicy } from "./runtime-group-policy-5Lr0Ieci.js";
|
|
17
|
+
import { d as createDefaultChannelRuntimeState, u as createComputedAccountStatusAdapter } from "./status-helpers-BY87Y_59.js";
|
|
18
|
+
import { n as fetchWithSsrFGuard } from "./fetch-guard-a7JwFUYT.js";
|
|
19
|
+
import { i as deliverTextOrMediaReply, p as resolveSendableOutboundReplyParts } from "./reply-payload-DPD7eb4b.js";
|
|
20
|
+
import { r as getAgentScopedMediaLocalRoots } from "./local-roots-DaJ_5SJs.js";
|
|
21
|
+
import { n as describeAccountSnapshot, s as resolveMergedAccountConfig, t as createAccountListHelpers } from "./account-helpers-mH8qUcej.js";
|
|
22
|
+
import { c as createScopedChannelConfigAdapter, t as adaptScopedAccountAccessor } from "./channel-config-helpers-CDrwTLrh.js";
|
|
23
|
+
import { n as resolveChannelGroupRequireMention } from "./group-policy-BY9nSFJ6.js";
|
|
24
|
+
import { o as stripChannelTargetPrefix, r as createChatChannelPlugin, s as stripTargetKindPrefix, t as buildChannelOutboundSessionRoute } from "./core-_nKe7lGV.js";
|
|
25
|
+
import { t as normalizeOutboundThreadId } from "./routing-BKQZI-Y4.js";
|
|
26
|
+
import { r as buildSecretInputSchema } from "./secret-input-iODSIXu3.js";
|
|
27
|
+
import { i as formatInboundFromLabel$1 } from "./envelope-Eqtls_G0.js";
|
|
28
|
+
import { n as resolveControlCommandGate } from "./command-gating-HO-bVa6h.js";
|
|
29
|
+
import { t as resolveMarkdownTableMode } from "./markdown-tables-BUWco8M1.js";
|
|
30
|
+
import { t as convertMarkdownTables } from "./tables-UUpgxLHU.js";
|
|
31
|
+
import { t as resolveChannelMediaMaxBytes } from "./media-limits-DKs4csWd.js";
|
|
32
|
+
import { f as createStandardChannelSetupStatus } from "./setup-wizard-helpers-BkGb40gx.js";
|
|
33
|
+
import { i as resolveStoredModelOverride } from "./model-selection-rJYfkbE0.js";
|
|
34
|
+
import { t as createAccountStatusSink } from "./channel-lifecycle.core-DGFtUSNK.js";
|
|
35
|
+
import { t as createPluginRuntimeStore } from "./runtime-store-B8eKj7xF.js";
|
|
36
|
+
import { n as formatNormalizedAllowFromEntries } from "./allow-from-BubJNE_5.js";
|
|
37
|
+
import { n as readStoreAllowFromForDmPolicy, o as resolveDmGroupAccessWithLists, t as DM_GROUP_ACCESS_REASON } from "./dm-policy-shared-CaDbQVNm.js";
|
|
38
|
+
import { t as createRestrictSendersChannelSecurity } from "./channel-policy-CDO9-tmN.js";
|
|
39
|
+
import { a as buildPendingHistoryContextFromMap, s as clearHistoryEntriesIfEnabled, u as recordPendingHistoryEntryIfEnabled } from "./history-UDByIZZ1.js";
|
|
40
|
+
import { t as createChannelDirectoryAdapter } from "./directory-runtime-CsNWiBAI.js";
|
|
41
|
+
import "./setup-8JVr0TMo.js";
|
|
42
|
+
import "./setup-runtime-DAI-yGI9.js";
|
|
43
|
+
import { d as createResolvedApproverActionAuthAdapter, t as resolveApprovalApprovers } from "./approval-runtime-B6PXavdQ.js";
|
|
44
|
+
import { n as isDangerousNameMatchingEnabled } from "./dangerous-name-matching-DK6-X-Xt.js";
|
|
45
|
+
import "./config-runtime-D208l2BL.js";
|
|
46
|
+
import { t as createChannelReplyPipeline } from "./channel-reply-pipeline-Dyh1zCi9.js";
|
|
47
|
+
import { a as isRequestBodyLimitError, s as readRequestBodyWithLimit } from "./http-body-CfWmnfar.js";
|
|
48
|
+
import "./ssrf-runtime-VREJ79aM.js";
|
|
49
|
+
import { t as buildAgentMediaPayload } from "./agent-media-payload-C7m4W3_C.js";
|
|
50
|
+
import "./text-runtime-UxAYZSfy.js";
|
|
51
|
+
import { t as registerPluginHttpRoute } from "./http-registry-BosSTk62.js";
|
|
52
|
+
import { n as createChannelPairingController, r as createLoggedPairingApprovalNotifier } from "./channel-pairing-mk5cf7oC.js";
|
|
53
|
+
import { n as buildPassiveProbedChannelStatusSummary } from "./extension-shared-BRiiX_r8.js";
|
|
54
|
+
import "./account-resolution-ETKTx0tC.js";
|
|
55
|
+
import { t as loadOutboundMediaFromUrl } from "./outbound-media-DPt_PPtU.js";
|
|
56
|
+
import { n as logInboundDrop, r as logTypingFailure } from "./logging-DIucOhk1.js";
|
|
57
|
+
import { t as listSkillCommandsForAgents } from "./skill-commands-BG9LO4Bn.js";
|
|
58
|
+
import { t as buildModelsProviderData } from "./commands-models-FgUB1hGv.js";
|
|
59
|
+
import "./browser-support-D8_Ei1HS.js";
|
|
60
|
+
import "./channel-config-primitives-De5uD2-s.js";
|
|
61
|
+
import { t as createMessageToolButtonsSchema } from "./channel-actions-BvEWwP51.js";
|
|
62
|
+
import { t as chunkTextForOutbound } from "./text-chunking-CAb5Ddyn.js";
|
|
63
|
+
import { t as zod_exports } from "./zod-Bww_ovOv.js";
|
|
64
|
+
import "./runtime-api-Bih0haVa.js";
|
|
65
|
+
import { n as isMattermostSenderAllowed, r as normalizeMattermostAllowList, t as authorizeMattermostCommandInvocation } from "./monitor-auth-3ZkW5CEr.js";
|
|
66
|
+
import { createHash, createHmac } from "node:crypto";
|
|
67
|
+
import WebSocket$1 from "ws";
|
|
68
|
+
import { Type } from "@sinclair/typebox";
|
|
69
|
+
//#region extensions/mattermost/src/mattermost/client.ts
|
|
70
|
+
const MattermostPostSchema = zod_exports.z.object({
|
|
71
|
+
id: zod_exports.z.string(),
|
|
72
|
+
user_id: zod_exports.z.string().nullable().optional(),
|
|
73
|
+
channel_id: zod_exports.z.string().nullable().optional(),
|
|
74
|
+
message: zod_exports.z.string().nullable().optional(),
|
|
75
|
+
file_ids: zod_exports.z.array(zod_exports.z.string()).nullable().optional(),
|
|
76
|
+
type: zod_exports.z.string().nullable().optional(),
|
|
77
|
+
root_id: zod_exports.z.string().nullable().optional(),
|
|
78
|
+
create_at: zod_exports.z.number().nullable().optional(),
|
|
79
|
+
props: zod_exports.z.record(zod_exports.z.string(), zod_exports.z.unknown()).nullable().optional()
|
|
80
|
+
}).passthrough();
|
|
81
|
+
function normalizeMattermostBaseUrl(raw) {
|
|
82
|
+
const trimmed = raw?.trim();
|
|
83
|
+
if (!trimmed) return;
|
|
84
|
+
return trimmed.replace(/\/+$/, "").replace(/\/api\/v4$/i, "");
|
|
85
|
+
}
|
|
86
|
+
function buildMattermostApiUrl(baseUrl, path) {
|
|
87
|
+
const normalized = normalizeMattermostBaseUrl(baseUrl);
|
|
88
|
+
if (!normalized) throw new Error("Mattermost baseUrl is required");
|
|
89
|
+
return `${normalized}/api/v4${path.startsWith("/") ? path : `/${path}`}`;
|
|
90
|
+
}
|
|
91
|
+
async function readMattermostError(res) {
|
|
92
|
+
if ((res.headers.get("content-type") ?? "").includes("application/json")) {
|
|
93
|
+
const data = await res.json();
|
|
94
|
+
if (data?.message) return data.message;
|
|
95
|
+
return JSON.stringify(data);
|
|
96
|
+
}
|
|
97
|
+
return await res.text();
|
|
98
|
+
}
|
|
99
|
+
function createMattermostClient(params) {
|
|
100
|
+
const baseUrl = normalizeMattermostBaseUrl(params.baseUrl);
|
|
101
|
+
if (!baseUrl) throw new Error("Mattermost baseUrl is required");
|
|
102
|
+
const apiBaseUrl = `${baseUrl}/api/v4`;
|
|
103
|
+
const token = params.botToken.trim();
|
|
104
|
+
const externalFetchImpl = params.fetchImpl;
|
|
105
|
+
const NULL_BODY_STATUSES = new Set([
|
|
106
|
+
101,
|
|
107
|
+
204,
|
|
108
|
+
205,
|
|
109
|
+
304
|
|
110
|
+
]);
|
|
111
|
+
const guardedFetchImpl = async (input, init) => {
|
|
112
|
+
const { response, release } = await fetchWithSsrFGuard({
|
|
113
|
+
url: typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url,
|
|
114
|
+
init,
|
|
115
|
+
auditContext: "mattermost-api",
|
|
116
|
+
policy: params.allowPrivateNetwork ? { allowPrivateNetwork: true } : void 0
|
|
117
|
+
});
|
|
118
|
+
try {
|
|
119
|
+
const bodyBytes = NULL_BODY_STATUSES.has(response.status) ? null : await response.arrayBuffer();
|
|
120
|
+
return new Response(bodyBytes, {
|
|
121
|
+
status: response.status,
|
|
122
|
+
headers: response.headers
|
|
123
|
+
});
|
|
124
|
+
} finally {
|
|
125
|
+
await release();
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const fetchImpl = externalFetchImpl ?? guardedFetchImpl;
|
|
129
|
+
const request = async (path, init) => {
|
|
130
|
+
const url = buildMattermostApiUrl(baseUrl, path);
|
|
131
|
+
const headers = new Headers(init?.headers);
|
|
132
|
+
headers.set("Authorization", `Bearer ${token}`);
|
|
133
|
+
if (typeof init?.body === "string" && !headers.has("Content-Type")) headers.set("Content-Type", "application/json");
|
|
134
|
+
const res = await fetchImpl(url, {
|
|
135
|
+
...init,
|
|
136
|
+
headers
|
|
137
|
+
});
|
|
138
|
+
if (!res.ok) {
|
|
139
|
+
const detail = await readMattermostError(res);
|
|
140
|
+
throw new Error(`Mattermost API ${res.status} ${res.statusText}: ${detail || "unknown error"}`);
|
|
141
|
+
}
|
|
142
|
+
if (res.status === 204) return;
|
|
143
|
+
if ((res.headers.get("content-type") ?? "").includes("application/json")) return await res.json();
|
|
144
|
+
return await res.text();
|
|
145
|
+
};
|
|
146
|
+
return {
|
|
147
|
+
baseUrl,
|
|
148
|
+
apiBaseUrl,
|
|
149
|
+
token,
|
|
150
|
+
request,
|
|
151
|
+
fetchImpl
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
async function fetchMattermostMe(client) {
|
|
155
|
+
return await client.request("/users/me");
|
|
156
|
+
}
|
|
157
|
+
async function fetchMattermostUser(client, userId) {
|
|
158
|
+
return await client.request(`/users/${userId}`);
|
|
159
|
+
}
|
|
160
|
+
async function fetchMattermostUserByUsername(client, username) {
|
|
161
|
+
return await client.request(`/users/username/${encodeURIComponent(username)}`);
|
|
162
|
+
}
|
|
163
|
+
async function fetchMattermostChannel(client, channelId) {
|
|
164
|
+
return await client.request(`/channels/${channelId}`);
|
|
165
|
+
}
|
|
166
|
+
async function fetchMattermostChannelByName(client, teamId, channelName) {
|
|
167
|
+
return await client.request(`/teams/${teamId}/channels/name/${encodeURIComponent(channelName)}`);
|
|
168
|
+
}
|
|
169
|
+
async function sendMattermostTyping(client, params) {
|
|
170
|
+
const payload = { channel_id: params.channelId };
|
|
171
|
+
const parentId = params.parentId?.trim();
|
|
172
|
+
if (parentId) payload.parent_id = parentId;
|
|
173
|
+
await client.request("/users/me/typing", {
|
|
174
|
+
method: "POST",
|
|
175
|
+
body: JSON.stringify(payload)
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
async function createMattermostDirectChannel(client, userIds, signal) {
|
|
179
|
+
return await client.request("/channels/direct", {
|
|
180
|
+
method: "POST",
|
|
181
|
+
body: JSON.stringify(userIds),
|
|
182
|
+
signal
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
const RETRYABLE_NETWORK_ERROR_CODES = new Set([
|
|
186
|
+
"ECONNRESET",
|
|
187
|
+
"ECONNREFUSED",
|
|
188
|
+
"ETIMEDOUT",
|
|
189
|
+
"ESOCKETTIMEDOUT",
|
|
190
|
+
"ECONNABORTED",
|
|
191
|
+
"ENOTFOUND",
|
|
192
|
+
"EAI_AGAIN",
|
|
193
|
+
"EHOSTUNREACH",
|
|
194
|
+
"ENETUNREACH",
|
|
195
|
+
"EPIPE",
|
|
196
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
197
|
+
"UND_ERR_DNS_RESOLVE_FAILED",
|
|
198
|
+
"UND_ERR_CONNECT",
|
|
199
|
+
"UND_ERR_SOCKET",
|
|
200
|
+
"UND_ERR_HEADERS_TIMEOUT",
|
|
201
|
+
"UND_ERR_BODY_TIMEOUT"
|
|
202
|
+
]);
|
|
203
|
+
const RETRYABLE_NETWORK_ERROR_NAMES = new Set([
|
|
204
|
+
"AbortError",
|
|
205
|
+
"TimeoutError",
|
|
206
|
+
"ConnectTimeoutError",
|
|
207
|
+
"HeadersTimeoutError",
|
|
208
|
+
"BodyTimeoutError"
|
|
209
|
+
]);
|
|
210
|
+
const RETRYABLE_NETWORK_MESSAGE_SNIPPETS = [
|
|
211
|
+
"network error",
|
|
212
|
+
"timeout",
|
|
213
|
+
"timed out",
|
|
214
|
+
"abort",
|
|
215
|
+
"connection refused",
|
|
216
|
+
"econnreset",
|
|
217
|
+
"econnrefused",
|
|
218
|
+
"etimedout",
|
|
219
|
+
"enotfound",
|
|
220
|
+
"socket hang up",
|
|
221
|
+
"getaddrinfo"
|
|
222
|
+
];
|
|
223
|
+
/**
|
|
224
|
+
* Creates a Mattermost DM channel with exponential backoff retry logic.
|
|
225
|
+
* Retries on transient errors (429, 5xx, network errors) but not on
|
|
226
|
+
* client errors (4xx except 429) or permanent failures.
|
|
227
|
+
*/
|
|
228
|
+
async function createMattermostDirectChannelWithRetry(client, userIds, options = {}) {
|
|
229
|
+
const { maxRetries = 3, initialDelayMs = 1e3, maxDelayMs = 1e4, timeoutMs = 3e4, onRetry } = options;
|
|
230
|
+
let lastError;
|
|
231
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) try {
|
|
232
|
+
const controller = new AbortController();
|
|
233
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
234
|
+
try {
|
|
235
|
+
return await createMattermostDirectChannel(client, userIds, controller.signal);
|
|
236
|
+
} finally {
|
|
237
|
+
clearTimeout(timeoutId);
|
|
238
|
+
}
|
|
239
|
+
} catch (err) {
|
|
240
|
+
lastError = err instanceof Error ? err : new Error(String(err));
|
|
241
|
+
if (attempt >= maxRetries) break;
|
|
242
|
+
if (!isRetryableError(lastError)) throw lastError;
|
|
243
|
+
const exponentialDelay = initialDelayMs * Math.pow(2, attempt);
|
|
244
|
+
const jitter = Math.random() * exponentialDelay;
|
|
245
|
+
const delayMs = Math.min(exponentialDelay + jitter, maxDelayMs);
|
|
246
|
+
if (onRetry) onRetry(attempt + 1, delayMs, lastError);
|
|
247
|
+
await sleep(delayMs);
|
|
248
|
+
}
|
|
249
|
+
throw lastError ?? /* @__PURE__ */ new Error("Failed to create DM channel after retries");
|
|
250
|
+
}
|
|
251
|
+
function isRetryableError(error) {
|
|
252
|
+
const candidates = collectErrorCandidates(error);
|
|
253
|
+
const messages = candidates.map((candidate) => readErrorMessage(candidate)?.toLowerCase()).filter((message) => Boolean(message));
|
|
254
|
+
if (messages.some((message) => /mattermost api 5\d{2}\b/.test(message))) return true;
|
|
255
|
+
if (messages.some((message) => /mattermost api 429\b/.test(message) || message.includes("too many requests"))) return true;
|
|
256
|
+
for (const message of messages) {
|
|
257
|
+
const clientErrorMatch = message.match(/mattermost api (4\d{2})\b/);
|
|
258
|
+
if (!clientErrorMatch) continue;
|
|
259
|
+
const statusCode = parseInt(clientErrorMatch[1], 10);
|
|
260
|
+
if (statusCode >= 400 && statusCode < 500) return false;
|
|
261
|
+
}
|
|
262
|
+
if (messages.some((message) => /mattermost api \d{3}\b/.test(message))) return false;
|
|
263
|
+
if (candidates.map((candidate) => readErrorCode(candidate)).filter((code) => Boolean(code)).some((code) => RETRYABLE_NETWORK_ERROR_CODES.has(code))) return true;
|
|
264
|
+
if (candidates.map((candidate) => readErrorName(candidate)).filter((name) => Boolean(name)).some((name) => RETRYABLE_NETWORK_ERROR_NAMES.has(name))) return true;
|
|
265
|
+
return messages.some((message) => RETRYABLE_NETWORK_MESSAGE_SNIPPETS.some((pattern) => message.includes(pattern)));
|
|
266
|
+
}
|
|
267
|
+
function collectErrorCandidates(error) {
|
|
268
|
+
const queue = [error];
|
|
269
|
+
const seen = /* @__PURE__ */ new Set();
|
|
270
|
+
const candidates = [];
|
|
271
|
+
while (queue.length > 0) {
|
|
272
|
+
const current = queue.shift();
|
|
273
|
+
if (!current || seen.has(current)) continue;
|
|
274
|
+
seen.add(current);
|
|
275
|
+
candidates.push(current);
|
|
276
|
+
if (typeof current !== "object") continue;
|
|
277
|
+
const nested = current;
|
|
278
|
+
queue.push(nested.cause, nested.reason);
|
|
279
|
+
if (Array.isArray(nested.errors)) queue.push(...nested.errors);
|
|
280
|
+
}
|
|
281
|
+
return candidates;
|
|
282
|
+
}
|
|
283
|
+
function readErrorMessage(error) {
|
|
284
|
+
if (!error || typeof error !== "object") return;
|
|
285
|
+
const message = error.message;
|
|
286
|
+
return typeof message === "string" && message.trim() ? message : void 0;
|
|
287
|
+
}
|
|
288
|
+
function readErrorName(error) {
|
|
289
|
+
if (!error || typeof error !== "object") return;
|
|
290
|
+
const name = error.name;
|
|
291
|
+
return typeof name === "string" && name.trim() ? name : void 0;
|
|
292
|
+
}
|
|
293
|
+
function readErrorCode(error) {
|
|
294
|
+
if (!error || typeof error !== "object") return;
|
|
295
|
+
const { code, errno } = error;
|
|
296
|
+
const raw = typeof code === "string" && code.trim() ? code : errno;
|
|
297
|
+
if (typeof raw === "string" && raw.trim()) return raw.trim().toUpperCase();
|
|
298
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
299
|
+
}
|
|
300
|
+
function sleep(ms) {
|
|
301
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
302
|
+
}
|
|
303
|
+
async function createMattermostPost(client, params) {
|
|
304
|
+
const payload = {
|
|
305
|
+
channel_id: params.channelId,
|
|
306
|
+
message: params.message
|
|
307
|
+
};
|
|
308
|
+
if (params.rootId) payload.root_id = params.rootId;
|
|
309
|
+
if (params.fileIds?.length) payload.file_ids = params.fileIds;
|
|
310
|
+
if (params.props) payload.props = params.props;
|
|
311
|
+
return await client.request("/posts", {
|
|
312
|
+
method: "POST",
|
|
313
|
+
body: JSON.stringify(payload)
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
async function fetchMattermostUserTeams(client, userId) {
|
|
317
|
+
return await client.request(`/users/${userId}/teams`);
|
|
318
|
+
}
|
|
319
|
+
async function updateMattermostPost(client, postId, params) {
|
|
320
|
+
const payload = { id: postId };
|
|
321
|
+
if (params.message !== void 0) payload.message = params.message;
|
|
322
|
+
if (params.props !== void 0) payload.props = params.props;
|
|
323
|
+
return await client.request(`/posts/${postId}`, {
|
|
324
|
+
method: "PUT",
|
|
325
|
+
body: JSON.stringify(payload)
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
async function uploadMattermostFile(client, params) {
|
|
329
|
+
const form = new FormData();
|
|
330
|
+
const fileName = params.fileName?.trim() || "upload";
|
|
331
|
+
const bytes = Uint8Array.from(params.buffer);
|
|
332
|
+
const blob = params.contentType ? new Blob([bytes], { type: params.contentType }) : new Blob([bytes]);
|
|
333
|
+
form.append("files", blob, fileName);
|
|
334
|
+
form.append("channel_id", params.channelId);
|
|
335
|
+
const res = await client.fetchImpl(`${client.apiBaseUrl}/files`, {
|
|
336
|
+
method: "POST",
|
|
337
|
+
headers: { Authorization: `Bearer ${client.token}` },
|
|
338
|
+
body: form
|
|
339
|
+
});
|
|
340
|
+
if (!res.ok) {
|
|
341
|
+
const detail = await readMattermostError(res);
|
|
342
|
+
throw new Error(`Mattermost API ${res.status} ${res.statusText}: ${detail || "unknown error"}`);
|
|
343
|
+
}
|
|
344
|
+
const info = (await res.json()).file_infos?.[0];
|
|
345
|
+
if (!info?.id) throw new Error("Mattermost file upload failed");
|
|
346
|
+
return info;
|
|
347
|
+
}
|
|
348
|
+
//#endregion
|
|
349
|
+
//#region extensions/mattermost/src/mattermost/accounts.ts
|
|
350
|
+
const mattermostAccountHelpers = createAccountListHelpers("mattermost");
|
|
351
|
+
function listMattermostAccountIds(cfg) {
|
|
352
|
+
return mattermostAccountHelpers.listAccountIds(cfg);
|
|
353
|
+
}
|
|
354
|
+
function resolveDefaultMattermostAccountId(cfg) {
|
|
355
|
+
return mattermostAccountHelpers.resolveDefaultAccountId(cfg);
|
|
356
|
+
}
|
|
357
|
+
function mergeMattermostAccountConfig(cfg, accountId) {
|
|
358
|
+
return resolveMergedAccountConfig({
|
|
359
|
+
channelConfig: cfg.channels?.mattermost,
|
|
360
|
+
accounts: cfg.channels?.mattermost?.accounts,
|
|
361
|
+
accountId,
|
|
362
|
+
omitKeys: ["defaultAccount"],
|
|
363
|
+
nestedObjectKeys: ["commands"]
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
function resolveMattermostRequireMention(config) {
|
|
367
|
+
if (config.chatmode === "oncall") return true;
|
|
368
|
+
if (config.chatmode === "onmessage") return false;
|
|
369
|
+
if (config.chatmode === "onchar") return true;
|
|
370
|
+
return config.requireMention;
|
|
371
|
+
}
|
|
372
|
+
function resolveMattermostAccount(params) {
|
|
373
|
+
const accountId = normalizeAccountId(params.accountId);
|
|
374
|
+
const baseEnabled = params.cfg.channels?.mattermost?.enabled !== false;
|
|
375
|
+
const merged = mergeMattermostAccountConfig(params.cfg, accountId);
|
|
376
|
+
const accountEnabled = merged.enabled !== false;
|
|
377
|
+
const enabled = baseEnabled && accountEnabled;
|
|
378
|
+
const allowEnv = accountId === DEFAULT_ACCOUNT_ID;
|
|
379
|
+
const envToken = allowEnv ? process.env.MATTERMOST_BOT_TOKEN?.trim() : void 0;
|
|
380
|
+
const envUrl = allowEnv ? process.env.MATTERMOST_URL?.trim() : void 0;
|
|
381
|
+
const configToken = params.allowUnresolvedSecretRef ? normalizeSecretInputString(merged.botToken) : normalizeResolvedSecretInputString({
|
|
382
|
+
value: merged.botToken,
|
|
383
|
+
path: `channels.mattermost.accounts.${accountId}.botToken`
|
|
384
|
+
});
|
|
385
|
+
const configUrl = merged.baseUrl?.trim();
|
|
386
|
+
const botToken = configToken || envToken;
|
|
387
|
+
const baseUrl = normalizeMattermostBaseUrl(configUrl || envUrl);
|
|
388
|
+
const requireMention = resolveMattermostRequireMention(merged);
|
|
389
|
+
const botTokenSource = configToken ? "config" : envToken ? "env" : "none";
|
|
390
|
+
const baseUrlSource = configUrl ? "config" : envUrl ? "env" : "none";
|
|
391
|
+
return {
|
|
392
|
+
accountId,
|
|
393
|
+
enabled,
|
|
394
|
+
name: merged.name?.trim() || void 0,
|
|
395
|
+
botToken,
|
|
396
|
+
baseUrl,
|
|
397
|
+
botTokenSource,
|
|
398
|
+
baseUrlSource,
|
|
399
|
+
config: merged,
|
|
400
|
+
chatmode: merged.chatmode,
|
|
401
|
+
oncharPrefixes: merged.oncharPrefixes,
|
|
402
|
+
requireMention,
|
|
403
|
+
textChunkLimit: merged.textChunkLimit,
|
|
404
|
+
blockStreaming: merged.blockStreaming,
|
|
405
|
+
blockStreamingCoalesce: merged.blockStreamingCoalesce
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Resolve the effective replyToMode for a given chat type.
|
|
410
|
+
* Mattermost auto-threading only applies to channel and group messages.
|
|
411
|
+
*/
|
|
412
|
+
function resolveMattermostReplyToMode(account, kind) {
|
|
413
|
+
if (kind === "direct") return "off";
|
|
414
|
+
return account.config.replyToMode ?? "off";
|
|
415
|
+
}
|
|
416
|
+
//#endregion
|
|
417
|
+
//#region extensions/mattermost/src/approval-auth.ts
|
|
418
|
+
const MATTERMOST_USER_ID_RE = /^[a-z0-9]{26}$/;
|
|
419
|
+
function normalizeMattermostApproverId(value) {
|
|
420
|
+
const normalized = String(value).trim().replace(/^(mattermost|user):/i, "").replace(/^@/, "").trim().toLowerCase();
|
|
421
|
+
return MATTERMOST_USER_ID_RE.test(normalized) ? normalized : void 0;
|
|
422
|
+
}
|
|
423
|
+
const mattermostApprovalAuth = createResolvedApproverActionAuthAdapter({
|
|
424
|
+
channelLabel: "Mattermost",
|
|
425
|
+
resolveApprovers: ({ cfg, accountId }) => {
|
|
426
|
+
const account = resolveMattermostAccount({
|
|
427
|
+
cfg,
|
|
428
|
+
accountId
|
|
429
|
+
}).config;
|
|
430
|
+
return resolveApprovalApprovers({
|
|
431
|
+
allowFrom: account.allowFrom,
|
|
432
|
+
normalizeApprover: normalizeMattermostApproverId
|
|
433
|
+
});
|
|
434
|
+
},
|
|
435
|
+
normalizeSenderId: (value) => normalizeMattermostApproverId(value)
|
|
436
|
+
});
|
|
437
|
+
//#endregion
|
|
438
|
+
//#region extensions/mattermost/src/config-schema-core.ts
|
|
439
|
+
function requireMattermostOpenAllowFrom(params) {
|
|
440
|
+
requireOpenAllowFrom({
|
|
441
|
+
policy: params.policy,
|
|
442
|
+
allowFrom: params.allowFrom,
|
|
443
|
+
ctx: params.ctx,
|
|
444
|
+
path: ["allowFrom"],
|
|
445
|
+
message: "channels.mattermost.dmPolicy=\"open\" requires channels.mattermost.allowFrom to include \"*\""
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
const DmChannelRetrySchema = zod_exports.z.object({
|
|
449
|
+
maxRetries: zod_exports.z.number().int().min(0).max(10).optional(),
|
|
450
|
+
initialDelayMs: zod_exports.z.number().int().min(100).max(6e4).optional(),
|
|
451
|
+
maxDelayMs: zod_exports.z.number().int().min(1e3).max(6e4).optional(),
|
|
452
|
+
timeoutMs: zod_exports.z.number().int().min(5e3).max(12e4).optional()
|
|
453
|
+
}).strict().refine((data) => {
|
|
454
|
+
if (data.initialDelayMs !== void 0 && data.maxDelayMs !== void 0) return data.initialDelayMs <= data.maxDelayMs;
|
|
455
|
+
return true;
|
|
456
|
+
}, {
|
|
457
|
+
message: "initialDelayMs must be less than or equal to maxDelayMs",
|
|
458
|
+
path: ["initialDelayMs"]
|
|
459
|
+
}).optional();
|
|
460
|
+
const MattermostSlashCommandsSchema = zod_exports.z.object({
|
|
461
|
+
native: zod_exports.z.union([zod_exports.z.boolean(), zod_exports.z.literal("auto")]).optional(),
|
|
462
|
+
nativeSkills: zod_exports.z.union([zod_exports.z.boolean(), zod_exports.z.literal("auto")]).optional(),
|
|
463
|
+
callbackPath: zod_exports.z.string().optional(),
|
|
464
|
+
callbackUrl: zod_exports.z.string().optional()
|
|
465
|
+
}).strict().optional();
|
|
466
|
+
const MattermostAccountSchemaBase = zod_exports.z.object({
|
|
467
|
+
name: zod_exports.z.string().optional(),
|
|
468
|
+
capabilities: zod_exports.z.array(zod_exports.z.string()).optional(),
|
|
469
|
+
dangerouslyAllowNameMatching: zod_exports.z.boolean().optional(),
|
|
470
|
+
markdown: MarkdownConfigSchema,
|
|
471
|
+
enabled: zod_exports.z.boolean().optional(),
|
|
472
|
+
configWrites: zod_exports.z.boolean().optional(),
|
|
473
|
+
botToken: buildSecretInputSchema().optional(),
|
|
474
|
+
baseUrl: zod_exports.z.string().optional(),
|
|
475
|
+
chatmode: zod_exports.z.enum([
|
|
476
|
+
"oncall",
|
|
477
|
+
"onmessage",
|
|
478
|
+
"onchar"
|
|
479
|
+
]).optional(),
|
|
480
|
+
oncharPrefixes: zod_exports.z.array(zod_exports.z.string()).optional(),
|
|
481
|
+
requireMention: zod_exports.z.boolean().optional(),
|
|
482
|
+
dmPolicy: DmPolicySchema.optional().default("pairing"),
|
|
483
|
+
allowFrom: zod_exports.z.array(zod_exports.z.union([zod_exports.z.string(), zod_exports.z.number()])).optional(),
|
|
484
|
+
groupAllowFrom: zod_exports.z.array(zod_exports.z.union([zod_exports.z.string(), zod_exports.z.number()])).optional(),
|
|
485
|
+
groupPolicy: GroupPolicySchema.optional().default("allowlist"),
|
|
486
|
+
textChunkLimit: zod_exports.z.number().int().positive().optional(),
|
|
487
|
+
chunkMode: zod_exports.z.enum(["length", "newline"]).optional(),
|
|
488
|
+
blockStreaming: zod_exports.z.boolean().optional(),
|
|
489
|
+
blockStreamingCoalesce: BlockStreamingCoalesceSchema.optional(),
|
|
490
|
+
replyToMode: zod_exports.z.enum([
|
|
491
|
+
"off",
|
|
492
|
+
"first",
|
|
493
|
+
"all"
|
|
494
|
+
]).optional(),
|
|
495
|
+
responsePrefix: zod_exports.z.string().optional(),
|
|
496
|
+
actions: zod_exports.z.object({ reactions: zod_exports.z.boolean().optional() }).optional(),
|
|
497
|
+
commands: MattermostSlashCommandsSchema,
|
|
498
|
+
interactions: zod_exports.z.object({
|
|
499
|
+
callbackBaseUrl: zod_exports.z.string().optional(),
|
|
500
|
+
allowedSourceIps: zod_exports.z.array(zod_exports.z.string()).optional()
|
|
501
|
+
}).optional(),
|
|
502
|
+
allowPrivateNetwork: zod_exports.z.boolean().optional(),
|
|
503
|
+
dmChannelRetry: DmChannelRetrySchema
|
|
504
|
+
}).strict();
|
|
505
|
+
const MattermostAccountSchema = MattermostAccountSchemaBase.superRefine((value, ctx) => {
|
|
506
|
+
requireMattermostOpenAllowFrom({
|
|
507
|
+
policy: value.dmPolicy,
|
|
508
|
+
allowFrom: value.allowFrom,
|
|
509
|
+
ctx
|
|
510
|
+
});
|
|
511
|
+
});
|
|
512
|
+
//#endregion
|
|
513
|
+
//#region extensions/mattermost/src/config-surface.ts
|
|
514
|
+
const MattermostChannelConfigSchema = buildChannelConfigSchema(MattermostAccountSchemaBase.extend({
|
|
515
|
+
accounts: zod_exports.z.record(zod_exports.z.string(), MattermostAccountSchema.optional()).optional(),
|
|
516
|
+
defaultAccount: zod_exports.z.string().optional()
|
|
517
|
+
}).superRefine((value, ctx) => {
|
|
518
|
+
requireMattermostOpenAllowFrom({
|
|
519
|
+
policy: value.dmPolicy,
|
|
520
|
+
allowFrom: value.allowFrom,
|
|
521
|
+
ctx
|
|
522
|
+
});
|
|
523
|
+
}));
|
|
524
|
+
//#endregion
|
|
525
|
+
//#region extensions/mattermost/src/group-mentions.ts
|
|
526
|
+
function resolveMattermostGroupRequireMention(params) {
|
|
527
|
+
const account = resolveMattermostAccount({
|
|
528
|
+
cfg: params.cfg,
|
|
529
|
+
accountId: params.accountId
|
|
530
|
+
});
|
|
531
|
+
const requireMentionOverride = typeof params.requireMentionOverride === "boolean" ? params.requireMentionOverride : account.requireMention;
|
|
532
|
+
return resolveChannelGroupRequireMention({
|
|
533
|
+
cfg: params.cfg,
|
|
534
|
+
channel: "mattermost",
|
|
535
|
+
groupId: params.groupId,
|
|
536
|
+
accountId: params.accountId,
|
|
537
|
+
requireMentionOverride
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
//#endregion
|
|
541
|
+
//#region extensions/mattermost/src/mattermost/directory.ts
|
|
542
|
+
function buildClient(params) {
|
|
543
|
+
const account = resolveMattermostAccount({
|
|
544
|
+
cfg: params.cfg,
|
|
545
|
+
accountId: params.accountId
|
|
546
|
+
});
|
|
547
|
+
if (!account.enabled || !account.botToken || !account.baseUrl) return null;
|
|
548
|
+
return createMattermostClient({
|
|
549
|
+
baseUrl: account.baseUrl,
|
|
550
|
+
botToken: account.botToken,
|
|
551
|
+
allowPrivateNetwork: account.config?.allowPrivateNetwork === true
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Build clients from ALL enabled accounts (deduplicated by token).
|
|
556
|
+
*
|
|
557
|
+
* We always scan every account because:
|
|
558
|
+
* - Private channels are only visible to bots that are members
|
|
559
|
+
* - The requesting agent's account may have an expired/invalid token
|
|
560
|
+
*
|
|
561
|
+
* This means a single healthy bot token is enough for directory discovery.
|
|
562
|
+
*/
|
|
563
|
+
function buildClients(params) {
|
|
564
|
+
const accountIds = listMattermostAccountIds(params.cfg);
|
|
565
|
+
const seen = /* @__PURE__ */ new Set();
|
|
566
|
+
const clients = [];
|
|
567
|
+
for (const id of accountIds) {
|
|
568
|
+
const client = buildClient({
|
|
569
|
+
cfg: params.cfg,
|
|
570
|
+
accountId: id
|
|
571
|
+
});
|
|
572
|
+
if (client && !seen.has(client.token)) {
|
|
573
|
+
seen.add(client.token);
|
|
574
|
+
clients.push(client);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
return clients;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* List channels (public + private) visible to any configured bot account.
|
|
581
|
+
*
|
|
582
|
+
* NOTE: Uses per_page=200 which covers most instances. Mattermost does not
|
|
583
|
+
* return a "has more" indicator, so very large instances (200+ channels per bot)
|
|
584
|
+
* may see incomplete results. Pagination can be added if needed.
|
|
585
|
+
*/
|
|
586
|
+
async function listMattermostDirectoryGroups(params) {
|
|
587
|
+
const clients = buildClients(params);
|
|
588
|
+
if (!clients.length) return [];
|
|
589
|
+
const q = params.query?.trim().toLowerCase() || "";
|
|
590
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
591
|
+
const entries = [];
|
|
592
|
+
for (const client of clients) try {
|
|
593
|
+
const me = await fetchMattermostMe(client);
|
|
594
|
+
const channels = await client.request(`/users/${me.id}/channels?per_page=200`);
|
|
595
|
+
for (const ch of channels) {
|
|
596
|
+
if (ch.type !== "O" && ch.type !== "P") continue;
|
|
597
|
+
if (seenIds.has(ch.id)) continue;
|
|
598
|
+
if (q) {
|
|
599
|
+
const name = (ch.name ?? "").toLowerCase();
|
|
600
|
+
const display = (ch.display_name ?? "").toLowerCase();
|
|
601
|
+
if (!name.includes(q) && !display.includes(q)) continue;
|
|
602
|
+
}
|
|
603
|
+
seenIds.add(ch.id);
|
|
604
|
+
entries.push({
|
|
605
|
+
kind: "group",
|
|
606
|
+
id: `channel:${ch.id}`,
|
|
607
|
+
name: ch.name ?? void 0,
|
|
608
|
+
handle: ch.display_name ?? void 0
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
} catch (err) {
|
|
612
|
+
console.debug?.("[mattermost-directory] listGroups: skipping account:", err?.message);
|
|
613
|
+
continue;
|
|
614
|
+
}
|
|
615
|
+
return params.limit && params.limit > 0 ? entries.slice(0, params.limit) : entries;
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* List team members as peer directory entries.
|
|
619
|
+
*
|
|
620
|
+
* Uses only the first available client since all bots in a team see the same
|
|
621
|
+
* user list (unlike channels where membership varies). Uses the first team
|
|
622
|
+
* returned — multi-team setups will only see members from that team.
|
|
623
|
+
*
|
|
624
|
+
* NOTE: per_page=200 for member listing; same pagination caveat as groups.
|
|
625
|
+
*/
|
|
626
|
+
async function listMattermostDirectoryPeers(params) {
|
|
627
|
+
const clients = buildClients(params);
|
|
628
|
+
if (!clients.length) return [];
|
|
629
|
+
const client = clients[0];
|
|
630
|
+
try {
|
|
631
|
+
const me = await fetchMattermostMe(client);
|
|
632
|
+
const teams = await client.request("/users/me/teams");
|
|
633
|
+
if (!teams.length) return [];
|
|
634
|
+
const teamId = teams[0].id;
|
|
635
|
+
const q = params.query?.trim().toLowerCase() || "";
|
|
636
|
+
let users;
|
|
637
|
+
if (q) users = await client.request("/users/search", {
|
|
638
|
+
method: "POST",
|
|
639
|
+
body: JSON.stringify({
|
|
640
|
+
term: q,
|
|
641
|
+
team_id: teamId
|
|
642
|
+
})
|
|
643
|
+
});
|
|
644
|
+
else {
|
|
645
|
+
const userIds = (await client.request(`/teams/${teamId}/members?per_page=200`)).map((m) => m.user_id).filter((id) => id !== me.id);
|
|
646
|
+
if (!userIds.length) return [];
|
|
647
|
+
users = await client.request("/users/ids", {
|
|
648
|
+
method: "POST",
|
|
649
|
+
body: JSON.stringify(userIds)
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
const entries = users.filter((u) => u.id !== me.id).map((u) => ({
|
|
653
|
+
kind: "user",
|
|
654
|
+
id: `user:${u.id}`,
|
|
655
|
+
name: u.username ?? void 0,
|
|
656
|
+
handle: [u.first_name, u.last_name].filter(Boolean).join(" ").trim() || u.nickname || void 0
|
|
657
|
+
}));
|
|
658
|
+
return params.limit && params.limit > 0 ? entries.slice(0, params.limit) : entries;
|
|
659
|
+
} catch (err) {
|
|
660
|
+
console.debug?.("[mattermost-directory] listPeers failed:", err?.message);
|
|
661
|
+
return [];
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
//#endregion
|
|
665
|
+
//#region extensions/mattermost/src/runtime.ts
|
|
666
|
+
const { setRuntime: setMattermostRuntime, getRuntime: getMattermostRuntime } = createPluginRuntimeStore("Mattermost runtime not initialized");
|
|
667
|
+
//#endregion
|
|
668
|
+
//#region extensions/mattermost/src/mattermost/interactions.ts
|
|
669
|
+
const INTERACTION_MAX_BODY_BYTES = 64 * 1024;
|
|
670
|
+
const INTERACTION_BODY_TIMEOUT_MS = 1e4;
|
|
671
|
+
const SIGNED_CHANNEL_ID_CONTEXT_KEY = "__openclaw_channel_id";
|
|
672
|
+
const callbackUrls = /* @__PURE__ */ new Map();
|
|
673
|
+
function setInteractionCallbackUrl(accountId, url) {
|
|
674
|
+
callbackUrls.set(accountId, url);
|
|
675
|
+
}
|
|
676
|
+
function resolveInteractionCallbackPath(accountId) {
|
|
677
|
+
return `/mattermost/interactions/${accountId}`;
|
|
678
|
+
}
|
|
679
|
+
function isWildcardBindHost(rawHost) {
|
|
680
|
+
const trimmed = rawHost.trim();
|
|
681
|
+
if (!trimmed) return false;
|
|
682
|
+
const host = trimmed.startsWith("[") && trimmed.endsWith("]") ? trimmed.slice(1, -1) : trimmed;
|
|
683
|
+
return host === "0.0.0.0" || host === "::" || host === "0:0:0:0:0:0:0:0" || host === "::0";
|
|
684
|
+
}
|
|
685
|
+
function normalizeCallbackBaseUrl(baseUrl) {
|
|
686
|
+
return baseUrl.trim().replace(/\/+$/, "");
|
|
687
|
+
}
|
|
688
|
+
function headerValue(value) {
|
|
689
|
+
if (Array.isArray(value)) return value[0]?.trim() || void 0;
|
|
690
|
+
return value?.trim() || void 0;
|
|
691
|
+
}
|
|
692
|
+
function isAllowedInteractionSource(params) {
|
|
693
|
+
const { allowedSourceIps } = params;
|
|
694
|
+
if (!allowedSourceIps?.length) return true;
|
|
695
|
+
return isTrustedProxyAddress(resolveClientIp({
|
|
696
|
+
remoteAddr: params.req.socket?.remoteAddress,
|
|
697
|
+
forwardedFor: headerValue(params.req.headers["x-forwarded-for"]),
|
|
698
|
+
realIp: headerValue(params.req.headers["x-real-ip"]),
|
|
699
|
+
trustedProxies: params.trustedProxies,
|
|
700
|
+
allowRealIpFallback: params.allowRealIpFallback
|
|
701
|
+
}), allowedSourceIps);
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* Resolve the interaction callback URL for an account.
|
|
705
|
+
* Falls back to computing it from interactions.callbackBaseUrl or gateway host config.
|
|
706
|
+
*/
|
|
707
|
+
function computeInteractionCallbackUrl(accountId, cfg) {
|
|
708
|
+
const path = resolveInteractionCallbackPath(accountId);
|
|
709
|
+
const callbackBaseUrl = cfg?.interactions?.callbackBaseUrl?.trim() ?? cfg?.channels?.mattermost?.interactions?.callbackBaseUrl?.trim();
|
|
710
|
+
if (callbackBaseUrl) return `${normalizeCallbackBaseUrl(callbackBaseUrl)}${path}`;
|
|
711
|
+
const port = typeof cfg?.gateway?.port === "number" ? cfg.gateway.port : 18789;
|
|
712
|
+
let host = cfg?.gateway?.customBindHost && !isWildcardBindHost(cfg.gateway.customBindHost) ? cfg.gateway.customBindHost.trim() : "localhost";
|
|
713
|
+
if (host.includes(":") && !(host.startsWith("[") && host.endsWith("]"))) host = `[${host}]`;
|
|
714
|
+
return `http://${host}:${port}${path}`;
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Resolve the interaction callback URL for an account.
|
|
718
|
+
* Prefers the in-memory registered URL (set by the gateway monitor) so callers outside the
|
|
719
|
+
* monitor lifecycle can reuse the runtime-validated callback destination.
|
|
720
|
+
*/
|
|
721
|
+
function resolveInteractionCallbackUrl(accountId, cfg) {
|
|
722
|
+
const cached = callbackUrls.get(accountId);
|
|
723
|
+
if (cached) return cached;
|
|
724
|
+
return computeInteractionCallbackUrl(accountId, cfg);
|
|
725
|
+
}
|
|
726
|
+
const interactionSecrets = /* @__PURE__ */ new Map();
|
|
727
|
+
let defaultInteractionSecret;
|
|
728
|
+
function deriveInteractionSecret(botToken) {
|
|
729
|
+
return createHmac("sha256", "openclaw-mattermost-interactions").update(botToken).digest("hex");
|
|
730
|
+
}
|
|
731
|
+
function setInteractionSecret(accountIdOrBotToken, botToken) {
|
|
732
|
+
if (typeof botToken === "string") {
|
|
733
|
+
interactionSecrets.set(accountIdOrBotToken, deriveInteractionSecret(botToken));
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
defaultInteractionSecret = deriveInteractionSecret(accountIdOrBotToken);
|
|
737
|
+
}
|
|
738
|
+
function getInteractionSecret(accountId) {
|
|
739
|
+
const scoped = accountId ? interactionSecrets.get(accountId) : void 0;
|
|
740
|
+
if (scoped) return scoped;
|
|
741
|
+
if (defaultInteractionSecret) return defaultInteractionSecret;
|
|
742
|
+
if (interactionSecrets.size === 1) {
|
|
743
|
+
const first = interactionSecrets.values().next().value;
|
|
744
|
+
if (typeof first === "string") return first;
|
|
745
|
+
}
|
|
746
|
+
throw new Error("Interaction secret not initialized — call setInteractionSecret(accountId, botToken) first");
|
|
747
|
+
}
|
|
748
|
+
function canonicalizeInteractionContext(value) {
|
|
749
|
+
if (Array.isArray(value)) return value.map((item) => canonicalizeInteractionContext(item));
|
|
750
|
+
if (value && typeof value === "object") {
|
|
751
|
+
const entries = Object.entries(value).filter(([, entryValue]) => entryValue !== void 0).sort(([left], [right]) => left.localeCompare(right)).map(([key, entryValue]) => [key, canonicalizeInteractionContext(entryValue)]);
|
|
752
|
+
return Object.fromEntries(entries);
|
|
753
|
+
}
|
|
754
|
+
return value;
|
|
755
|
+
}
|
|
756
|
+
function generateInteractionToken(context, accountId) {
|
|
757
|
+
const secret = getInteractionSecret(accountId);
|
|
758
|
+
const payload = JSON.stringify(canonicalizeInteractionContext(context));
|
|
759
|
+
return createHmac("sha256", secret).update(payload).digest("hex");
|
|
760
|
+
}
|
|
761
|
+
function verifyInteractionToken(context, token, accountId) {
|
|
762
|
+
return safeEqualSecret(generateInteractionToken(context, accountId), token);
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* Build Mattermost `props.attachments` with interactive buttons.
|
|
766
|
+
*
|
|
767
|
+
* Each button includes an HMAC token in its integration context so the
|
|
768
|
+
* callback handler can verify the request originated from a legitimate
|
|
769
|
+
* button click (Mattermost's recommended security pattern).
|
|
770
|
+
*/
|
|
771
|
+
/**
|
|
772
|
+
* Sanitize a button ID so Mattermost's action router can match it.
|
|
773
|
+
* Mattermost uses the action ID in the URL path `/api/v4/posts/{id}/actions/{actionId}`
|
|
774
|
+
* and IDs containing hyphens or underscores break the server-side routing.
|
|
775
|
+
* See: https://github.com/mattermost/mattermost/issues/25747
|
|
776
|
+
*/
|
|
777
|
+
function sanitizeActionId(id) {
|
|
778
|
+
return id.replace(/[-_]/g, "");
|
|
779
|
+
}
|
|
780
|
+
function buildButtonAttachments(params) {
|
|
781
|
+
const actions = params.buttons.map((btn) => {
|
|
782
|
+
const safeId = sanitizeActionId(btn.id);
|
|
783
|
+
const context = {
|
|
784
|
+
action_id: safeId,
|
|
785
|
+
...btn.context
|
|
786
|
+
};
|
|
787
|
+
const token = generateInteractionToken(context, params.accountId);
|
|
788
|
+
return {
|
|
789
|
+
id: safeId,
|
|
790
|
+
type: "button",
|
|
791
|
+
name: btn.name,
|
|
792
|
+
style: btn.style,
|
|
793
|
+
integration: {
|
|
794
|
+
url: params.callbackUrl,
|
|
795
|
+
context: {
|
|
796
|
+
...context,
|
|
797
|
+
_token: token
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
};
|
|
801
|
+
});
|
|
802
|
+
return [{
|
|
803
|
+
text: params.text ?? "",
|
|
804
|
+
actions
|
|
805
|
+
}];
|
|
806
|
+
}
|
|
807
|
+
function buildButtonProps(params) {
|
|
808
|
+
const buttons = params.buttons.flatMap((item) => Array.isArray(item) ? item : [item]).map((btn) => ({
|
|
809
|
+
id: String(btn.id ?? btn.callback_data ?? "").trim(),
|
|
810
|
+
name: String(btn.text ?? btn.name ?? btn.label ?? "").trim(),
|
|
811
|
+
style: btn.style ?? "default",
|
|
812
|
+
context: typeof btn.context === "object" && btn.context !== null ? {
|
|
813
|
+
...btn.context,
|
|
814
|
+
[SIGNED_CHANNEL_ID_CONTEXT_KEY]: params.channelId
|
|
815
|
+
} : { [SIGNED_CHANNEL_ID_CONTEXT_KEY]: params.channelId }
|
|
816
|
+
})).filter((btn) => btn.id && btn.name);
|
|
817
|
+
if (buttons.length === 0) return;
|
|
818
|
+
return { attachments: buildButtonAttachments({
|
|
819
|
+
callbackUrl: params.callbackUrl,
|
|
820
|
+
accountId: params.accountId,
|
|
821
|
+
buttons,
|
|
822
|
+
text: params.text
|
|
823
|
+
}) };
|
|
824
|
+
}
|
|
825
|
+
function readInteractionBody(req) {
|
|
826
|
+
return new Promise((resolve, reject) => {
|
|
827
|
+
const chunks = [];
|
|
828
|
+
let totalBytes = 0;
|
|
829
|
+
const timer = setTimeout(() => {
|
|
830
|
+
req.destroy();
|
|
831
|
+
reject(/* @__PURE__ */ new Error("Request body read timeout"));
|
|
832
|
+
}, INTERACTION_BODY_TIMEOUT_MS);
|
|
833
|
+
req.on("data", (chunk) => {
|
|
834
|
+
totalBytes += chunk.length;
|
|
835
|
+
if (totalBytes > INTERACTION_MAX_BODY_BYTES) {
|
|
836
|
+
req.destroy();
|
|
837
|
+
clearTimeout(timer);
|
|
838
|
+
reject(/* @__PURE__ */ new Error("Request body too large"));
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
841
|
+
chunks.push(chunk);
|
|
842
|
+
});
|
|
843
|
+
req.on("end", () => {
|
|
844
|
+
clearTimeout(timer);
|
|
845
|
+
resolve(Buffer.concat(chunks).toString("utf8"));
|
|
846
|
+
});
|
|
847
|
+
req.on("error", (err) => {
|
|
848
|
+
clearTimeout(timer);
|
|
849
|
+
reject(err);
|
|
850
|
+
});
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
function createMattermostInteractionHandler(params) {
|
|
854
|
+
const { client, accountId, log } = params;
|
|
855
|
+
const core = getMattermostRuntime();
|
|
856
|
+
return async (req, res) => {
|
|
857
|
+
if (req.method !== "POST") {
|
|
858
|
+
res.statusCode = 405;
|
|
859
|
+
res.setHeader("Allow", "POST");
|
|
860
|
+
res.setHeader("Content-Type", "application/json");
|
|
861
|
+
res.end(JSON.stringify({ error: "Method Not Allowed" }));
|
|
862
|
+
return;
|
|
863
|
+
}
|
|
864
|
+
if (!isAllowedInteractionSource({
|
|
865
|
+
req,
|
|
866
|
+
allowedSourceIps: params.allowedSourceIps,
|
|
867
|
+
trustedProxies: params.trustedProxies,
|
|
868
|
+
allowRealIpFallback: params.allowRealIpFallback
|
|
869
|
+
})) {
|
|
870
|
+
log?.(`mattermost interaction: rejected callback source remote=${req.socket?.remoteAddress ?? "?"}`);
|
|
871
|
+
res.statusCode = 403;
|
|
872
|
+
res.setHeader("Content-Type", "application/json");
|
|
873
|
+
res.end(JSON.stringify({ error: "Forbidden origin" }));
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
let payload;
|
|
877
|
+
try {
|
|
878
|
+
const raw = await readInteractionBody(req);
|
|
879
|
+
payload = JSON.parse(raw);
|
|
880
|
+
} catch (err) {
|
|
881
|
+
log?.(`mattermost interaction: failed to parse body: ${String(err)}`);
|
|
882
|
+
res.statusCode = 400;
|
|
883
|
+
res.setHeader("Content-Type", "application/json");
|
|
884
|
+
res.end(JSON.stringify({ error: "Invalid request body" }));
|
|
885
|
+
return;
|
|
886
|
+
}
|
|
887
|
+
const context = payload.context;
|
|
888
|
+
if (!context) {
|
|
889
|
+
res.statusCode = 400;
|
|
890
|
+
res.setHeader("Content-Type", "application/json");
|
|
891
|
+
res.end(JSON.stringify({ error: "Missing context" }));
|
|
892
|
+
return;
|
|
893
|
+
}
|
|
894
|
+
const token = context._token;
|
|
895
|
+
if (typeof token !== "string") {
|
|
896
|
+
log?.("mattermost interaction: missing _token in context");
|
|
897
|
+
res.statusCode = 403;
|
|
898
|
+
res.setHeader("Content-Type", "application/json");
|
|
899
|
+
res.end(JSON.stringify({ error: "Missing token" }));
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
const { _token, ...contextWithoutToken } = context;
|
|
903
|
+
if (!verifyInteractionToken(contextWithoutToken, token, accountId)) {
|
|
904
|
+
log?.("mattermost interaction: invalid _token");
|
|
905
|
+
res.statusCode = 403;
|
|
906
|
+
res.setHeader("Content-Type", "application/json");
|
|
907
|
+
res.end(JSON.stringify({ error: "Invalid token" }));
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
910
|
+
const actionId = context.action_id;
|
|
911
|
+
if (typeof actionId !== "string") {
|
|
912
|
+
res.statusCode = 400;
|
|
913
|
+
res.setHeader("Content-Type", "application/json");
|
|
914
|
+
res.end(JSON.stringify({ error: "Missing action_id in context" }));
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
const signedChannelId = typeof contextWithoutToken[SIGNED_CHANNEL_ID_CONTEXT_KEY] === "string" ? contextWithoutToken[SIGNED_CHANNEL_ID_CONTEXT_KEY].trim() : "";
|
|
918
|
+
if (signedChannelId && signedChannelId !== payload.channel_id) {
|
|
919
|
+
log?.(`mattermost interaction: signed channel mismatch payload=${payload.channel_id} signed=${signedChannelId}`);
|
|
920
|
+
res.statusCode = 403;
|
|
921
|
+
res.setHeader("Content-Type", "application/json");
|
|
922
|
+
res.end(JSON.stringify({ error: "Channel mismatch" }));
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
925
|
+
const userName = payload.user_name ?? payload.user_id;
|
|
926
|
+
let originalMessage = "";
|
|
927
|
+
let originalPost = null;
|
|
928
|
+
let clickedButtonName = null;
|
|
929
|
+
try {
|
|
930
|
+
originalPost = await client.request(`/posts/${payload.post_id}`);
|
|
931
|
+
const postChannelId = originalPost.channel_id?.trim();
|
|
932
|
+
if (!postChannelId || postChannelId !== payload.channel_id) {
|
|
933
|
+
log?.(`mattermost interaction: post channel mismatch payload=${payload.channel_id} post=${postChannelId ?? "<missing>"}`);
|
|
934
|
+
res.statusCode = 403;
|
|
935
|
+
res.setHeader("Content-Type", "application/json");
|
|
936
|
+
res.end(JSON.stringify({ error: "Post/channel mismatch" }));
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
originalMessage = originalPost.message ?? "";
|
|
940
|
+
const postAttachments = Array.isArray(originalPost?.props?.attachments) ? originalPost.props.attachments : [];
|
|
941
|
+
for (const att of postAttachments) {
|
|
942
|
+
const match = att.actions?.find((a) => a.id === actionId);
|
|
943
|
+
if (match?.name) {
|
|
944
|
+
clickedButtonName = match.name;
|
|
945
|
+
break;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
if (clickedButtonName === null) {
|
|
949
|
+
log?.(`mattermost interaction: action ${actionId} not found in post ${payload.post_id}`);
|
|
950
|
+
res.statusCode = 403;
|
|
951
|
+
res.setHeader("Content-Type", "application/json");
|
|
952
|
+
res.end(JSON.stringify({ error: "Unknown action" }));
|
|
953
|
+
return;
|
|
954
|
+
}
|
|
955
|
+
} catch (err) {
|
|
956
|
+
log?.(`mattermost interaction: failed to validate post ${payload.post_id}: ${String(err)}`);
|
|
957
|
+
res.statusCode = 500;
|
|
958
|
+
res.setHeader("Content-Type", "application/json");
|
|
959
|
+
res.end(JSON.stringify({ error: "Failed to validate interaction" }));
|
|
960
|
+
return;
|
|
961
|
+
}
|
|
962
|
+
if (!originalPost) {
|
|
963
|
+
log?.(`mattermost interaction: missing fetched post ${payload.post_id}`);
|
|
964
|
+
res.statusCode = 500;
|
|
965
|
+
res.setHeader("Content-Type", "application/json");
|
|
966
|
+
res.end(JSON.stringify({ error: "Failed to load interaction post" }));
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
log?.(`mattermost interaction: action=${actionId} user=${payload.user_name ?? payload.user_id} post=${payload.post_id} channel=${payload.channel_id}`);
|
|
970
|
+
if (params.authorizeButtonClick) try {
|
|
971
|
+
const authorization = await params.authorizeButtonClick({
|
|
972
|
+
payload,
|
|
973
|
+
post: originalPost
|
|
974
|
+
});
|
|
975
|
+
if (!authorization.ok) {
|
|
976
|
+
res.statusCode = authorization.statusCode ?? 200;
|
|
977
|
+
res.setHeader("Content-Type", "application/json");
|
|
978
|
+
res.end(JSON.stringify(authorization.response ?? { ephemeral_text: "You are not allowed to use this action here." }));
|
|
979
|
+
return;
|
|
980
|
+
}
|
|
981
|
+
} catch (err) {
|
|
982
|
+
log?.(`mattermost interaction: authorization failed: ${String(err)}`);
|
|
983
|
+
res.statusCode = 500;
|
|
984
|
+
res.setHeader("Content-Type", "application/json");
|
|
985
|
+
res.end(JSON.stringify({ error: "Interaction authorization failed" }));
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
if (params.handleInteraction) try {
|
|
989
|
+
const response = await params.handleInteraction({
|
|
990
|
+
payload,
|
|
991
|
+
userName,
|
|
992
|
+
actionId,
|
|
993
|
+
actionName: clickedButtonName,
|
|
994
|
+
originalMessage,
|
|
995
|
+
context: contextWithoutToken,
|
|
996
|
+
post: originalPost
|
|
997
|
+
});
|
|
998
|
+
if (response !== null) {
|
|
999
|
+
res.statusCode = 200;
|
|
1000
|
+
res.setHeader("Content-Type", "application/json");
|
|
1001
|
+
res.end(JSON.stringify(response));
|
|
1002
|
+
return;
|
|
1003
|
+
}
|
|
1004
|
+
} catch (err) {
|
|
1005
|
+
log?.(`mattermost interaction: custom handler failed: ${String(err)}`);
|
|
1006
|
+
res.statusCode = 500;
|
|
1007
|
+
res.setHeader("Content-Type", "application/json");
|
|
1008
|
+
res.end(JSON.stringify({ error: "Interaction handler failed" }));
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
try {
|
|
1012
|
+
const eventLabel = `Mattermost button click: action="${actionId}" by ${payload.user_name ?? payload.user_id} in channel ${payload.channel_id}`;
|
|
1013
|
+
const sessionKey = params.resolveSessionKey ? await params.resolveSessionKey({
|
|
1014
|
+
channelId: payload.channel_id,
|
|
1015
|
+
userId: payload.user_id,
|
|
1016
|
+
post: originalPost
|
|
1017
|
+
}) : `agent:main:mattermost:${accountId}:${payload.channel_id}`;
|
|
1018
|
+
core.system.enqueueSystemEvent(eventLabel, {
|
|
1019
|
+
sessionKey,
|
|
1020
|
+
contextKey: `mattermost:interaction:${payload.post_id}:${actionId}`
|
|
1021
|
+
});
|
|
1022
|
+
} catch (err) {
|
|
1023
|
+
log?.(`mattermost interaction: system event dispatch failed: ${String(err)}`);
|
|
1024
|
+
}
|
|
1025
|
+
try {
|
|
1026
|
+
await updateMattermostPost(client, payload.post_id, {
|
|
1027
|
+
message: originalMessage,
|
|
1028
|
+
props: { attachments: [{ text: `✓ **${clickedButtonName}** selected by @${userName}` }] }
|
|
1029
|
+
});
|
|
1030
|
+
} catch (err) {
|
|
1031
|
+
log?.(`mattermost interaction: failed to update post ${payload.post_id}: ${String(err)}`);
|
|
1032
|
+
}
|
|
1033
|
+
res.statusCode = 200;
|
|
1034
|
+
res.setHeader("Content-Type", "application/json");
|
|
1035
|
+
res.end("{}");
|
|
1036
|
+
if (params.dispatchButtonClick) try {
|
|
1037
|
+
await params.dispatchButtonClick({
|
|
1038
|
+
channelId: payload.channel_id,
|
|
1039
|
+
userId: payload.user_id,
|
|
1040
|
+
userName,
|
|
1041
|
+
actionId,
|
|
1042
|
+
actionName: clickedButtonName,
|
|
1043
|
+
postId: payload.post_id,
|
|
1044
|
+
post: originalPost
|
|
1045
|
+
});
|
|
1046
|
+
} catch (err) {
|
|
1047
|
+
log?.(`mattermost interaction: dispatchButtonClick failed: ${String(err)}`);
|
|
1048
|
+
}
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
//#endregion
|
|
1052
|
+
//#region extensions/mattermost/src/mattermost/model-picker.ts
|
|
1053
|
+
const MATTERMOST_MODEL_PICKER_CONTEXT_KEY = "oc_model_picker";
|
|
1054
|
+
const MODELS_PAGE_SIZE = 8;
|
|
1055
|
+
const ACTION_IDS = {
|
|
1056
|
+
providers: "mdlprov",
|
|
1057
|
+
list: "mdllist",
|
|
1058
|
+
select: "mdlsel",
|
|
1059
|
+
back: "mdlback"
|
|
1060
|
+
};
|
|
1061
|
+
function splitModelRef(modelRef) {
|
|
1062
|
+
const match = (modelRef?.trim())?.match(/^([^/]+)\/(.+)$/u);
|
|
1063
|
+
if (!match) return null;
|
|
1064
|
+
const provider = normalizeProviderId(match[1]);
|
|
1065
|
+
const model = match[2].trim();
|
|
1066
|
+
if (!provider || !model) return null;
|
|
1067
|
+
return {
|
|
1068
|
+
provider,
|
|
1069
|
+
model
|
|
1070
|
+
};
|
|
1071
|
+
}
|
|
1072
|
+
function normalizePage(value) {
|
|
1073
|
+
if (!Number.isFinite(value)) return 1;
|
|
1074
|
+
return Math.max(1, Math.floor(value));
|
|
1075
|
+
}
|
|
1076
|
+
function paginateItems(items, page, pageSize = MODELS_PAGE_SIZE) {
|
|
1077
|
+
const totalPages = Math.max(1, Math.ceil(items.length / pageSize));
|
|
1078
|
+
const safePage = Math.max(1, Math.min(normalizePage(page), totalPages));
|
|
1079
|
+
const start = (safePage - 1) * pageSize;
|
|
1080
|
+
return {
|
|
1081
|
+
items: items.slice(start, start + pageSize),
|
|
1082
|
+
page: safePage,
|
|
1083
|
+
totalPages,
|
|
1084
|
+
hasPrev: safePage > 1,
|
|
1085
|
+
hasNext: safePage < totalPages,
|
|
1086
|
+
totalItems: items.length
|
|
1087
|
+
};
|
|
1088
|
+
}
|
|
1089
|
+
function buildContext(state) {
|
|
1090
|
+
return {
|
|
1091
|
+
[MATTERMOST_MODEL_PICKER_CONTEXT_KEY]: true,
|
|
1092
|
+
...state
|
|
1093
|
+
};
|
|
1094
|
+
}
|
|
1095
|
+
function buildButtonId(state) {
|
|
1096
|
+
const digest = createHash("sha256").update(JSON.stringify(state)).digest("hex").slice(0, 12);
|
|
1097
|
+
return `${ACTION_IDS[state.action]}${digest}`;
|
|
1098
|
+
}
|
|
1099
|
+
function buildButton(params) {
|
|
1100
|
+
const baseState = params.action === "providers" || params.action === "back" ? {
|
|
1101
|
+
action: params.action,
|
|
1102
|
+
ownerUserId: params.ownerUserId
|
|
1103
|
+
} : params.action === "list" ? {
|
|
1104
|
+
action: "list",
|
|
1105
|
+
ownerUserId: params.ownerUserId,
|
|
1106
|
+
provider: normalizeProviderId(params.provider ?? ""),
|
|
1107
|
+
page: normalizePage(params.page)
|
|
1108
|
+
} : {
|
|
1109
|
+
action: "select",
|
|
1110
|
+
ownerUserId: params.ownerUserId,
|
|
1111
|
+
provider: normalizeProviderId(params.provider ?? ""),
|
|
1112
|
+
page: normalizePage(params.page),
|
|
1113
|
+
model: String(params.model ?? "").trim()
|
|
1114
|
+
};
|
|
1115
|
+
return {
|
|
1116
|
+
id: buildButtonId(baseState),
|
|
1117
|
+
text: params.text,
|
|
1118
|
+
...params.style ? { style: params.style } : {},
|
|
1119
|
+
context: buildContext(baseState)
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
function getProviderModels(data, provider) {
|
|
1123
|
+
return [...data.byProvider.get(normalizeProviderId(provider)) ?? /* @__PURE__ */ new Set()].toSorted();
|
|
1124
|
+
}
|
|
1125
|
+
function formatCurrentModelLine(currentModel) {
|
|
1126
|
+
const parsed = splitModelRef(currentModel);
|
|
1127
|
+
if (!parsed) return "Current: default";
|
|
1128
|
+
return `Current: ${parsed.provider}/${parsed.model}`;
|
|
1129
|
+
}
|
|
1130
|
+
function resolveMattermostModelPickerEntry(commandText) {
|
|
1131
|
+
const normalized = commandText.trim().replace(/\s+/g, " ");
|
|
1132
|
+
if (/^\/model$/i.test(normalized)) return { kind: "summary" };
|
|
1133
|
+
if (/^\/models$/i.test(normalized)) return { kind: "providers" };
|
|
1134
|
+
const providerMatch = normalized.match(/^\/models\s+(\S+)$/i);
|
|
1135
|
+
if (!providerMatch?.[1]) return null;
|
|
1136
|
+
return {
|
|
1137
|
+
kind: "models",
|
|
1138
|
+
provider: normalizeProviderId(providerMatch[1])
|
|
1139
|
+
};
|
|
1140
|
+
}
|
|
1141
|
+
function parseMattermostModelPickerContext(context) {
|
|
1142
|
+
if (!context || context[MATTERMOST_MODEL_PICKER_CONTEXT_KEY] !== true) return null;
|
|
1143
|
+
const ownerUserId = String(context.ownerUserId ?? "").trim();
|
|
1144
|
+
const action = String(context.action ?? "").trim();
|
|
1145
|
+
if (!ownerUserId) return null;
|
|
1146
|
+
if (action === "providers" || action === "back") return {
|
|
1147
|
+
action,
|
|
1148
|
+
ownerUserId
|
|
1149
|
+
};
|
|
1150
|
+
const provider = normalizeProviderId(String(context.provider ?? ""));
|
|
1151
|
+
const page = Number.parseInt(String(context.page ?? "1"), 10);
|
|
1152
|
+
if (!provider) return null;
|
|
1153
|
+
if (action === "list") return {
|
|
1154
|
+
action,
|
|
1155
|
+
ownerUserId,
|
|
1156
|
+
provider,
|
|
1157
|
+
page: normalizePage(page)
|
|
1158
|
+
};
|
|
1159
|
+
if (action === "select") {
|
|
1160
|
+
const model = String(context.model ?? "").trim();
|
|
1161
|
+
if (!model) return null;
|
|
1162
|
+
return {
|
|
1163
|
+
action,
|
|
1164
|
+
ownerUserId,
|
|
1165
|
+
provider,
|
|
1166
|
+
page: normalizePage(page),
|
|
1167
|
+
model
|
|
1168
|
+
};
|
|
1169
|
+
}
|
|
1170
|
+
return null;
|
|
1171
|
+
}
|
|
1172
|
+
function buildMattermostAllowedModelRefs(data) {
|
|
1173
|
+
const refs = /* @__PURE__ */ new Set();
|
|
1174
|
+
for (const provider of data.providers) for (const model of data.byProvider.get(provider) ?? []) refs.add(`${provider}/${model}`);
|
|
1175
|
+
return refs;
|
|
1176
|
+
}
|
|
1177
|
+
function resolveMattermostModelPickerCurrentModel(params) {
|
|
1178
|
+
const fallback = `${params.data.resolvedDefault.provider}/${params.data.resolvedDefault.model}`;
|
|
1179
|
+
try {
|
|
1180
|
+
const storePath = resolveStorePath(params.cfg.session?.store, { agentId: params.route.agentId });
|
|
1181
|
+
const sessionStore = params.skipCache ? loadSessionStore(storePath, { skipCache: true }) : loadSessionStore(storePath);
|
|
1182
|
+
const sessionEntry = sessionStore[params.route.sessionKey];
|
|
1183
|
+
const override = resolveStoredModelOverride({
|
|
1184
|
+
sessionEntry,
|
|
1185
|
+
sessionStore,
|
|
1186
|
+
sessionKey: params.route.sessionKey
|
|
1187
|
+
});
|
|
1188
|
+
if (!override?.model) return fallback;
|
|
1189
|
+
const provider = (override.provider || params.data.resolvedDefault.provider).trim();
|
|
1190
|
+
return provider ? `${provider}/${override.model}` : fallback;
|
|
1191
|
+
} catch {
|
|
1192
|
+
return fallback;
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
function renderMattermostModelSummaryView(params) {
|
|
1196
|
+
return {
|
|
1197
|
+
text: [
|
|
1198
|
+
formatCurrentModelLine(params.currentModel),
|
|
1199
|
+
"",
|
|
1200
|
+
"Tap below to browse models, or use:",
|
|
1201
|
+
"/oc_model <provider/model> to switch",
|
|
1202
|
+
"/oc_model status for details"
|
|
1203
|
+
].join("\n"),
|
|
1204
|
+
buttons: [[buildButton({
|
|
1205
|
+
action: "providers",
|
|
1206
|
+
ownerUserId: params.ownerUserId,
|
|
1207
|
+
text: "Browse providers",
|
|
1208
|
+
style: "primary"
|
|
1209
|
+
})]]
|
|
1210
|
+
};
|
|
1211
|
+
}
|
|
1212
|
+
function renderMattermostProviderPickerView(params) {
|
|
1213
|
+
const currentProvider = splitModelRef(params.currentModel)?.provider;
|
|
1214
|
+
const rows = params.data.providers.map((provider) => [buildButton({
|
|
1215
|
+
action: "list",
|
|
1216
|
+
ownerUserId: params.ownerUserId,
|
|
1217
|
+
text: `${provider} (${params.data.byProvider.get(provider)?.size ?? 0})`,
|
|
1218
|
+
provider,
|
|
1219
|
+
page: 1,
|
|
1220
|
+
style: provider === currentProvider ? "primary" : "default"
|
|
1221
|
+
})]);
|
|
1222
|
+
return {
|
|
1223
|
+
text: [
|
|
1224
|
+
formatCurrentModelLine(params.currentModel),
|
|
1225
|
+
"",
|
|
1226
|
+
"Select a provider:"
|
|
1227
|
+
].join("\n"),
|
|
1228
|
+
buttons: rows
|
|
1229
|
+
};
|
|
1230
|
+
}
|
|
1231
|
+
function renderMattermostModelsPickerView(params) {
|
|
1232
|
+
const provider = normalizeProviderId(params.provider);
|
|
1233
|
+
const models = getProviderModels(params.data, provider);
|
|
1234
|
+
const current = splitModelRef(params.currentModel);
|
|
1235
|
+
if (models.length === 0) return {
|
|
1236
|
+
text: [
|
|
1237
|
+
formatCurrentModelLine(params.currentModel),
|
|
1238
|
+
"",
|
|
1239
|
+
`Unknown provider: ${provider}`
|
|
1240
|
+
].join("\n"),
|
|
1241
|
+
buttons: [[buildButton({
|
|
1242
|
+
action: "back",
|
|
1243
|
+
ownerUserId: params.ownerUserId,
|
|
1244
|
+
text: "Back to providers"
|
|
1245
|
+
})]]
|
|
1246
|
+
};
|
|
1247
|
+
const page = paginateItems(models, params.page);
|
|
1248
|
+
const rows = page.items.map((model) => {
|
|
1249
|
+
const isCurrent = current?.provider === provider && current.model === model;
|
|
1250
|
+
return [buildButton({
|
|
1251
|
+
action: "select",
|
|
1252
|
+
ownerUserId: params.ownerUserId,
|
|
1253
|
+
text: isCurrent ? `${model} [current]` : model,
|
|
1254
|
+
provider,
|
|
1255
|
+
model,
|
|
1256
|
+
page: page.page,
|
|
1257
|
+
style: isCurrent ? "primary" : "default"
|
|
1258
|
+
})];
|
|
1259
|
+
});
|
|
1260
|
+
const navRow = [];
|
|
1261
|
+
if (page.hasPrev) navRow.push(buildButton({
|
|
1262
|
+
action: "list",
|
|
1263
|
+
ownerUserId: params.ownerUserId,
|
|
1264
|
+
text: "Prev",
|
|
1265
|
+
provider,
|
|
1266
|
+
page: page.page - 1
|
|
1267
|
+
}));
|
|
1268
|
+
if (page.hasNext) navRow.push(buildButton({
|
|
1269
|
+
action: "list",
|
|
1270
|
+
ownerUserId: params.ownerUserId,
|
|
1271
|
+
text: "Next",
|
|
1272
|
+
provider,
|
|
1273
|
+
page: page.page + 1
|
|
1274
|
+
}));
|
|
1275
|
+
if (navRow.length > 0) rows.push(navRow);
|
|
1276
|
+
rows.push([buildButton({
|
|
1277
|
+
action: "back",
|
|
1278
|
+
ownerUserId: params.ownerUserId,
|
|
1279
|
+
text: "Back to providers"
|
|
1280
|
+
})]);
|
|
1281
|
+
return {
|
|
1282
|
+
text: [
|
|
1283
|
+
`Models (${provider}) - ${page.totalItems} available`,
|
|
1284
|
+
formatCurrentModelLine(params.currentModel),
|
|
1285
|
+
`Page ${page.page}/${page.totalPages}`,
|
|
1286
|
+
"Select a model to switch immediately."
|
|
1287
|
+
].join("\n"),
|
|
1288
|
+
buttons: rows
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
//#endregion
|
|
1292
|
+
//#region extensions/mattermost/src/mattermost/monitor-gating.ts
|
|
1293
|
+
function mapMattermostChannelTypeToChatType(channelType) {
|
|
1294
|
+
if (!channelType) return "channel";
|
|
1295
|
+
const normalized = channelType.trim().toUpperCase();
|
|
1296
|
+
if (normalized === "D") return "direct";
|
|
1297
|
+
if (normalized === "G" || normalized === "P") return "group";
|
|
1298
|
+
return "channel";
|
|
1299
|
+
}
|
|
1300
|
+
function evaluateMattermostMentionGate(params) {
|
|
1301
|
+
const shouldRequireMention = params.kind !== "direct" && params.resolveRequireMention({
|
|
1302
|
+
cfg: params.cfg,
|
|
1303
|
+
channel: "mattermost",
|
|
1304
|
+
accountId: params.accountId,
|
|
1305
|
+
groupId: params.channelId,
|
|
1306
|
+
requireMentionOverride: params.requireMentionOverride
|
|
1307
|
+
});
|
|
1308
|
+
const shouldBypassMention = params.isControlCommand && shouldRequireMention && !params.wasMentioned && params.commandAuthorized;
|
|
1309
|
+
const effectiveWasMentioned = params.wasMentioned || shouldBypassMention || params.oncharTriggered;
|
|
1310
|
+
if (params.oncharEnabled && !params.oncharTriggered && !params.wasMentioned && !params.isControlCommand) return {
|
|
1311
|
+
shouldRequireMention,
|
|
1312
|
+
shouldBypassMention,
|
|
1313
|
+
effectiveWasMentioned,
|
|
1314
|
+
dropReason: "onchar-not-triggered"
|
|
1315
|
+
};
|
|
1316
|
+
if (params.kind !== "direct" && shouldRequireMention && params.canDetectMention && !effectiveWasMentioned) return {
|
|
1317
|
+
shouldRequireMention,
|
|
1318
|
+
shouldBypassMention,
|
|
1319
|
+
effectiveWasMentioned,
|
|
1320
|
+
dropReason: "missing-mention"
|
|
1321
|
+
};
|
|
1322
|
+
return {
|
|
1323
|
+
shouldRequireMention,
|
|
1324
|
+
shouldBypassMention,
|
|
1325
|
+
effectiveWasMentioned,
|
|
1326
|
+
dropReason: null
|
|
1327
|
+
};
|
|
1328
|
+
}
|
|
1329
|
+
//#endregion
|
|
1330
|
+
//#region extensions/mattermost/src/mattermost/monitor-helpers.ts
|
|
1331
|
+
const formatInboundFromLabel = formatInboundFromLabel$1;
|
|
1332
|
+
function resolveThreadSessionKeys(params) {
|
|
1333
|
+
return resolveThreadSessionKeys$1({
|
|
1334
|
+
...params,
|
|
1335
|
+
normalizeThreadId: (threadId) => threadId
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
/**
|
|
1339
|
+
* Strip bot mention from message text while preserving newlines and
|
|
1340
|
+
* block-level Markdown formatting (headings, lists, blockquotes).
|
|
1341
|
+
*/
|
|
1342
|
+
function normalizeMention(text, mention) {
|
|
1343
|
+
if (!mention) return text.trim();
|
|
1344
|
+
const escaped = mention.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1345
|
+
const hasMentionRe = new RegExp(`@${escaped}\\b`, "i");
|
|
1346
|
+
const leadingMentionRe = new RegExp(`^([\\t ]*)@${escaped}\\b[\\t ]*`, "i");
|
|
1347
|
+
const trailingMentionRe = new RegExp(`[\\t ]*@${escaped}\\b[\\t ]*$`, "i");
|
|
1348
|
+
const normalizedLines = text.split("\n").map((line) => {
|
|
1349
|
+
const hadMention = hasMentionRe.test(line);
|
|
1350
|
+
const normalizedLine = line.replace(leadingMentionRe, "$1").replace(trailingMentionRe, "").replace(new RegExp(`@${escaped}\\b`, "gi"), "").replace(/(\S)[ \t]{2,}/g, "$1 ");
|
|
1351
|
+
return {
|
|
1352
|
+
text: normalizedLine,
|
|
1353
|
+
mentionOnlyBlank: hadMention && normalizedLine.trim() === ""
|
|
1354
|
+
};
|
|
1355
|
+
});
|
|
1356
|
+
while (normalizedLines[0]?.mentionOnlyBlank) normalizedLines.shift();
|
|
1357
|
+
while (normalizedLines.at(-1)?.text.trim() === "") normalizedLines.pop();
|
|
1358
|
+
return normalizedLines.map((line) => line.text).join("\n");
|
|
1359
|
+
}
|
|
1360
|
+
//#endregion
|
|
1361
|
+
//#region extensions/mattermost/src/mattermost/monitor-onchar.ts
|
|
1362
|
+
const DEFAULT_ONCHAR_PREFIXES = [">", "!"];
|
|
1363
|
+
function resolveOncharPrefixes(prefixes) {
|
|
1364
|
+
const cleaned = prefixes?.map((entry) => entry.trim()).filter(Boolean) ?? DEFAULT_ONCHAR_PREFIXES;
|
|
1365
|
+
return cleaned.length > 0 ? cleaned : DEFAULT_ONCHAR_PREFIXES;
|
|
1366
|
+
}
|
|
1367
|
+
function stripOncharPrefix(text, prefixes) {
|
|
1368
|
+
const trimmed = text.trimStart();
|
|
1369
|
+
for (const prefix of prefixes) {
|
|
1370
|
+
if (!prefix) continue;
|
|
1371
|
+
if (trimmed.startsWith(prefix)) return {
|
|
1372
|
+
triggered: true,
|
|
1373
|
+
stripped: trimmed.slice(prefix.length).trimStart()
|
|
1374
|
+
};
|
|
1375
|
+
}
|
|
1376
|
+
return {
|
|
1377
|
+
triggered: false,
|
|
1378
|
+
stripped: text
|
|
1379
|
+
};
|
|
1380
|
+
}
|
|
1381
|
+
//#endregion
|
|
1382
|
+
//#region extensions/mattermost/src/mattermost/monitor-resources.ts
|
|
1383
|
+
const CHANNEL_CACHE_TTL_MS = 5 * 6e4;
|
|
1384
|
+
const USER_CACHE_TTL_MS = 10 * 6e4;
|
|
1385
|
+
function createMattermostMonitorResources(params) {
|
|
1386
|
+
const { accountId, callbackUrl, client, logger, mediaMaxBytes, fetchRemoteMedia, saveMediaBuffer, mediaKindFromMime } = params;
|
|
1387
|
+
const channelCache = /* @__PURE__ */ new Map();
|
|
1388
|
+
const userCache = /* @__PURE__ */ new Map();
|
|
1389
|
+
const resolveMattermostMedia = async (fileIds) => {
|
|
1390
|
+
const ids = (fileIds ?? []).map((id) => id?.trim()).filter(Boolean);
|
|
1391
|
+
if (ids.length === 0) return [];
|
|
1392
|
+
const out = [];
|
|
1393
|
+
for (const fileId of ids) try {
|
|
1394
|
+
const fetched = await fetchRemoteMedia({
|
|
1395
|
+
url: `${client.apiBaseUrl}/files/${fileId}`,
|
|
1396
|
+
requestInit: { headers: { Authorization: `Bearer ${client.token}` } },
|
|
1397
|
+
filePathHint: fileId,
|
|
1398
|
+
maxBytes: mediaMaxBytes,
|
|
1399
|
+
ssrfPolicy: { allowedHostnames: [new URL(client.baseUrl).hostname] }
|
|
1400
|
+
});
|
|
1401
|
+
const saved = await saveMediaBuffer(Buffer.from(fetched.buffer), fetched.contentType ?? void 0, "inbound", mediaMaxBytes);
|
|
1402
|
+
const contentType = saved.contentType ?? fetched.contentType ?? void 0;
|
|
1403
|
+
out.push({
|
|
1404
|
+
path: saved.path,
|
|
1405
|
+
contentType,
|
|
1406
|
+
kind: mediaKindFromMime(contentType) ?? "unknown"
|
|
1407
|
+
});
|
|
1408
|
+
} catch (err) {
|
|
1409
|
+
logger.debug?.(`mattermost: failed to download file ${fileId}: ${String(err)}`);
|
|
1410
|
+
}
|
|
1411
|
+
return out;
|
|
1412
|
+
};
|
|
1413
|
+
const sendTypingIndicator = async (channelId, parentId) => {
|
|
1414
|
+
await sendMattermostTyping(client, {
|
|
1415
|
+
channelId,
|
|
1416
|
+
parentId
|
|
1417
|
+
});
|
|
1418
|
+
};
|
|
1419
|
+
const resolveChannelInfo = async (channelId) => {
|
|
1420
|
+
const cached = channelCache.get(channelId);
|
|
1421
|
+
if (cached && cached.expiresAt > Date.now()) return cached.value;
|
|
1422
|
+
try {
|
|
1423
|
+
const info = await fetchMattermostChannel(client, channelId);
|
|
1424
|
+
channelCache.set(channelId, {
|
|
1425
|
+
value: info,
|
|
1426
|
+
expiresAt: Date.now() + CHANNEL_CACHE_TTL_MS
|
|
1427
|
+
});
|
|
1428
|
+
return info;
|
|
1429
|
+
} catch (err) {
|
|
1430
|
+
logger.debug?.(`mattermost: channel lookup failed: ${String(err)}`);
|
|
1431
|
+
channelCache.set(channelId, {
|
|
1432
|
+
value: null,
|
|
1433
|
+
expiresAt: Date.now() + CHANNEL_CACHE_TTL_MS
|
|
1434
|
+
});
|
|
1435
|
+
return null;
|
|
1436
|
+
}
|
|
1437
|
+
};
|
|
1438
|
+
const resolveUserInfo = async (userId) => {
|
|
1439
|
+
const cached = userCache.get(userId);
|
|
1440
|
+
if (cached && cached.expiresAt > Date.now()) return cached.value;
|
|
1441
|
+
try {
|
|
1442
|
+
const info = await fetchMattermostUser(client, userId);
|
|
1443
|
+
userCache.set(userId, {
|
|
1444
|
+
value: info,
|
|
1445
|
+
expiresAt: Date.now() + USER_CACHE_TTL_MS
|
|
1446
|
+
});
|
|
1447
|
+
return info;
|
|
1448
|
+
} catch (err) {
|
|
1449
|
+
logger.debug?.(`mattermost: user lookup failed: ${String(err)}`);
|
|
1450
|
+
userCache.set(userId, {
|
|
1451
|
+
value: null,
|
|
1452
|
+
expiresAt: Date.now() + USER_CACHE_TTL_MS
|
|
1453
|
+
});
|
|
1454
|
+
return null;
|
|
1455
|
+
}
|
|
1456
|
+
};
|
|
1457
|
+
const buildModelPickerProps = (channelId, buttons) => buildButtonProps({
|
|
1458
|
+
callbackUrl,
|
|
1459
|
+
accountId,
|
|
1460
|
+
channelId,
|
|
1461
|
+
buttons
|
|
1462
|
+
});
|
|
1463
|
+
const updateModelPickerPost = async (params) => {
|
|
1464
|
+
const props = buildModelPickerProps(params.channelId, params.buttons ?? []) ?? { attachments: [] };
|
|
1465
|
+
await updateMattermostPost(client, params.postId, {
|
|
1466
|
+
message: params.message,
|
|
1467
|
+
props
|
|
1468
|
+
});
|
|
1469
|
+
return {};
|
|
1470
|
+
};
|
|
1471
|
+
return {
|
|
1472
|
+
resolveMattermostMedia,
|
|
1473
|
+
sendTypingIndicator,
|
|
1474
|
+
resolveChannelInfo,
|
|
1475
|
+
resolveUserInfo,
|
|
1476
|
+
updateModelPickerPost
|
|
1477
|
+
};
|
|
1478
|
+
}
|
|
1479
|
+
//#endregion
|
|
1480
|
+
//#region extensions/mattermost/src/mattermost/slash-commands.ts
|
|
1481
|
+
/**
|
|
1482
|
+
* Built-in OpenClaw commands to register as native slash commands.
|
|
1483
|
+
* These mirror the text-based commands already handled by the gateway.
|
|
1484
|
+
*/
|
|
1485
|
+
const DEFAULT_COMMAND_SPECS = [
|
|
1486
|
+
{
|
|
1487
|
+
trigger: "oc_status",
|
|
1488
|
+
originalName: "status",
|
|
1489
|
+
description: "Show session status (model, usage, uptime)",
|
|
1490
|
+
autoComplete: true
|
|
1491
|
+
},
|
|
1492
|
+
{
|
|
1493
|
+
trigger: "oc_model",
|
|
1494
|
+
originalName: "model",
|
|
1495
|
+
description: "View or change the current model",
|
|
1496
|
+
autoComplete: true,
|
|
1497
|
+
autoCompleteHint: "[model-name]"
|
|
1498
|
+
},
|
|
1499
|
+
{
|
|
1500
|
+
trigger: "oc_models",
|
|
1501
|
+
originalName: "models",
|
|
1502
|
+
description: "Browse available models",
|
|
1503
|
+
autoComplete: true,
|
|
1504
|
+
autoCompleteHint: "[provider]"
|
|
1505
|
+
},
|
|
1506
|
+
{
|
|
1507
|
+
trigger: "oc_new",
|
|
1508
|
+
originalName: "new",
|
|
1509
|
+
description: "Start a new conversation session",
|
|
1510
|
+
autoComplete: true
|
|
1511
|
+
},
|
|
1512
|
+
{
|
|
1513
|
+
trigger: "oc_help",
|
|
1514
|
+
originalName: "help",
|
|
1515
|
+
description: "Show available commands",
|
|
1516
|
+
autoComplete: true
|
|
1517
|
+
},
|
|
1518
|
+
{
|
|
1519
|
+
trigger: "oc_think",
|
|
1520
|
+
originalName: "think",
|
|
1521
|
+
description: "Set thinking/reasoning level",
|
|
1522
|
+
autoComplete: true,
|
|
1523
|
+
autoCompleteHint: "[off|low|medium|high]"
|
|
1524
|
+
},
|
|
1525
|
+
{
|
|
1526
|
+
trigger: "oc_reasoning",
|
|
1527
|
+
originalName: "reasoning",
|
|
1528
|
+
description: "Toggle reasoning mode",
|
|
1529
|
+
autoComplete: true,
|
|
1530
|
+
autoCompleteHint: "[on|off]"
|
|
1531
|
+
},
|
|
1532
|
+
{
|
|
1533
|
+
trigger: "oc_verbose",
|
|
1534
|
+
originalName: "verbose",
|
|
1535
|
+
description: "Toggle verbose mode",
|
|
1536
|
+
autoComplete: true,
|
|
1537
|
+
autoCompleteHint: "[on|off]"
|
|
1538
|
+
}
|
|
1539
|
+
];
|
|
1540
|
+
/**
|
|
1541
|
+
* List existing custom slash commands for a team.
|
|
1542
|
+
*/
|
|
1543
|
+
async function listMattermostCommands(client, teamId) {
|
|
1544
|
+
return await client.request(`/commands?team_id=${encodeURIComponent(teamId)}&custom_only=true`);
|
|
1545
|
+
}
|
|
1546
|
+
/**
|
|
1547
|
+
* Create a custom slash command on a Mattermost team.
|
|
1548
|
+
*/
|
|
1549
|
+
async function createMattermostCommand(client, params) {
|
|
1550
|
+
return await client.request("/commands", {
|
|
1551
|
+
method: "POST",
|
|
1552
|
+
body: JSON.stringify(params)
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1555
|
+
/**
|
|
1556
|
+
* Delete a custom slash command.
|
|
1557
|
+
*/
|
|
1558
|
+
async function deleteMattermostCommand(client, commandId) {
|
|
1559
|
+
await client.request(`/commands/${encodeURIComponent(commandId)}`, { method: "DELETE" });
|
|
1560
|
+
}
|
|
1561
|
+
/**
|
|
1562
|
+
* Update an existing custom slash command.
|
|
1563
|
+
*/
|
|
1564
|
+
async function updateMattermostCommand(client, params) {
|
|
1565
|
+
return await client.request(`/commands/${encodeURIComponent(params.id)}`, {
|
|
1566
|
+
method: "PUT",
|
|
1567
|
+
body: JSON.stringify(params)
|
|
1568
|
+
});
|
|
1569
|
+
}
|
|
1570
|
+
/**
|
|
1571
|
+
* Register all OpenClaw slash commands for a given team.
|
|
1572
|
+
* Skips commands that are already registered with the same trigger + callback URL.
|
|
1573
|
+
* Returns the list of newly created command IDs.
|
|
1574
|
+
*/
|
|
1575
|
+
async function registerSlashCommands(params) {
|
|
1576
|
+
const { client, teamId, creatorUserId, callbackUrl, commands, log } = params;
|
|
1577
|
+
const normalizedCreatorUserId = creatorUserId.trim();
|
|
1578
|
+
if (!normalizedCreatorUserId) throw new Error("creatorUserId is required for slash command reconciliation");
|
|
1579
|
+
let existing = [];
|
|
1580
|
+
try {
|
|
1581
|
+
existing = await listMattermostCommands(client, teamId);
|
|
1582
|
+
} catch (err) {
|
|
1583
|
+
log?.(`mattermost: failed to list existing commands: ${String(err)}`);
|
|
1584
|
+
throw err;
|
|
1585
|
+
}
|
|
1586
|
+
const existingByTrigger = /* @__PURE__ */ new Map();
|
|
1587
|
+
for (const cmd of existing) {
|
|
1588
|
+
const list = existingByTrigger.get(cmd.trigger) ?? [];
|
|
1589
|
+
list.push(cmd);
|
|
1590
|
+
existingByTrigger.set(cmd.trigger, list);
|
|
1591
|
+
}
|
|
1592
|
+
const registered = [];
|
|
1593
|
+
for (const spec of commands) {
|
|
1594
|
+
const existingForTrigger = existingByTrigger.get(spec.trigger) ?? [];
|
|
1595
|
+
const ownedCommands = existingForTrigger.filter((cmd) => cmd.creator_id?.trim() === normalizedCreatorUserId);
|
|
1596
|
+
const foreignCommands = existingForTrigger.filter((cmd) => cmd.creator_id?.trim() !== normalizedCreatorUserId);
|
|
1597
|
+
if (ownedCommands.length === 0 && foreignCommands.length > 0) {
|
|
1598
|
+
log?.(`mattermost: trigger /${spec.trigger} already used by non-OpenClaw command(s); skipping to avoid mutating external integrations`);
|
|
1599
|
+
continue;
|
|
1600
|
+
}
|
|
1601
|
+
if (ownedCommands.length > 1) log?.(`mattermost: multiple owned commands found for /${spec.trigger}; using the first and leaving extras untouched`);
|
|
1602
|
+
const existingCmd = ownedCommands[0];
|
|
1603
|
+
if (existingCmd && existingCmd.url === callbackUrl) {
|
|
1604
|
+
log?.(`mattermost: command /${spec.trigger} already registered (id=${existingCmd.id})`);
|
|
1605
|
+
registered.push({
|
|
1606
|
+
id: existingCmd.id,
|
|
1607
|
+
trigger: spec.trigger,
|
|
1608
|
+
teamId,
|
|
1609
|
+
token: existingCmd.token,
|
|
1610
|
+
managed: false
|
|
1611
|
+
});
|
|
1612
|
+
continue;
|
|
1613
|
+
}
|
|
1614
|
+
if (existingCmd && existingCmd.url !== callbackUrl) {
|
|
1615
|
+
log?.(`mattermost: command /${spec.trigger} exists with different callback URL; updating (id=${existingCmd.id})`);
|
|
1616
|
+
try {
|
|
1617
|
+
const updated = await updateMattermostCommand(client, {
|
|
1618
|
+
id: existingCmd.id,
|
|
1619
|
+
team_id: teamId,
|
|
1620
|
+
trigger: spec.trigger,
|
|
1621
|
+
method: "P",
|
|
1622
|
+
url: callbackUrl,
|
|
1623
|
+
description: spec.description,
|
|
1624
|
+
auto_complete: spec.autoComplete,
|
|
1625
|
+
auto_complete_desc: spec.description,
|
|
1626
|
+
auto_complete_hint: spec.autoCompleteHint
|
|
1627
|
+
});
|
|
1628
|
+
registered.push({
|
|
1629
|
+
id: updated.id,
|
|
1630
|
+
trigger: spec.trigger,
|
|
1631
|
+
teamId,
|
|
1632
|
+
token: updated.token,
|
|
1633
|
+
managed: false
|
|
1634
|
+
});
|
|
1635
|
+
continue;
|
|
1636
|
+
} catch (err) {
|
|
1637
|
+
log?.(`mattermost: failed to update command /${spec.trigger} (id=${existingCmd.id}): ${String(err)}`);
|
|
1638
|
+
try {
|
|
1639
|
+
await deleteMattermostCommand(client, existingCmd.id);
|
|
1640
|
+
log?.(`mattermost: deleted stale command /${spec.trigger} (id=${existingCmd.id})`);
|
|
1641
|
+
} catch (deleteErr) {
|
|
1642
|
+
log?.(`mattermost: failed to delete stale command /${spec.trigger} (id=${existingCmd.id}): ${String(deleteErr)}`);
|
|
1643
|
+
continue;
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
try {
|
|
1648
|
+
const created = await createMattermostCommand(client, {
|
|
1649
|
+
team_id: teamId,
|
|
1650
|
+
trigger: spec.trigger,
|
|
1651
|
+
method: "P",
|
|
1652
|
+
url: callbackUrl,
|
|
1653
|
+
description: spec.description,
|
|
1654
|
+
auto_complete: spec.autoComplete,
|
|
1655
|
+
auto_complete_desc: spec.description,
|
|
1656
|
+
auto_complete_hint: spec.autoCompleteHint
|
|
1657
|
+
});
|
|
1658
|
+
log?.(`mattermost: registered command /${spec.trigger} (id=${created.id})`);
|
|
1659
|
+
registered.push({
|
|
1660
|
+
id: created.id,
|
|
1661
|
+
trigger: spec.trigger,
|
|
1662
|
+
teamId,
|
|
1663
|
+
token: created.token,
|
|
1664
|
+
managed: true
|
|
1665
|
+
});
|
|
1666
|
+
} catch (err) {
|
|
1667
|
+
log?.(`mattermost: failed to register command /${spec.trigger}: ${String(err)}`);
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
return registered;
|
|
1671
|
+
}
|
|
1672
|
+
/**
|
|
1673
|
+
* Clean up all registered slash commands.
|
|
1674
|
+
*/
|
|
1675
|
+
async function cleanupSlashCommands(params) {
|
|
1676
|
+
const { client, commands, log } = params;
|
|
1677
|
+
for (const cmd of commands) {
|
|
1678
|
+
if (!cmd.managed) continue;
|
|
1679
|
+
try {
|
|
1680
|
+
await deleteMattermostCommand(client, cmd.id);
|
|
1681
|
+
log?.(`mattermost: deleted command /${cmd.trigger} (id=${cmd.id})`);
|
|
1682
|
+
} catch (err) {
|
|
1683
|
+
log?.(`mattermost: failed to delete command /${cmd.trigger}: ${String(err)}`);
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
/**
|
|
1688
|
+
* Parse a Mattermost slash command callback payload from a URL-encoded or JSON body.
|
|
1689
|
+
*/
|
|
1690
|
+
function parseSlashCommandPayload(body, contentType) {
|
|
1691
|
+
if (!body) return null;
|
|
1692
|
+
try {
|
|
1693
|
+
if (contentType?.includes("application/json")) {
|
|
1694
|
+
const parsed = JSON.parse(body);
|
|
1695
|
+
const token = typeof parsed.token === "string" ? parsed.token : "";
|
|
1696
|
+
const teamId = typeof parsed.team_id === "string" ? parsed.team_id : "";
|
|
1697
|
+
const channelId = typeof parsed.channel_id === "string" ? parsed.channel_id : "";
|
|
1698
|
+
const userId = typeof parsed.user_id === "string" ? parsed.user_id : "";
|
|
1699
|
+
const command = typeof parsed.command === "string" ? parsed.command : "";
|
|
1700
|
+
if (!token || !teamId || !channelId || !userId || !command) return null;
|
|
1701
|
+
return {
|
|
1702
|
+
token,
|
|
1703
|
+
team_id: teamId,
|
|
1704
|
+
team_domain: typeof parsed.team_domain === "string" ? parsed.team_domain : void 0,
|
|
1705
|
+
channel_id: channelId,
|
|
1706
|
+
channel_name: typeof parsed.channel_name === "string" ? parsed.channel_name : void 0,
|
|
1707
|
+
user_id: userId,
|
|
1708
|
+
user_name: typeof parsed.user_name === "string" ? parsed.user_name : void 0,
|
|
1709
|
+
command,
|
|
1710
|
+
text: typeof parsed.text === "string" ? parsed.text : "",
|
|
1711
|
+
trigger_id: typeof parsed.trigger_id === "string" ? parsed.trigger_id : void 0,
|
|
1712
|
+
response_url: typeof parsed.response_url === "string" ? parsed.response_url : void 0
|
|
1713
|
+
};
|
|
1714
|
+
}
|
|
1715
|
+
const params = new URLSearchParams(body);
|
|
1716
|
+
const token = params.get("token");
|
|
1717
|
+
const teamId = params.get("team_id");
|
|
1718
|
+
const channelId = params.get("channel_id");
|
|
1719
|
+
const userId = params.get("user_id");
|
|
1720
|
+
const command = params.get("command");
|
|
1721
|
+
if (!token || !teamId || !channelId || !userId || !command) return null;
|
|
1722
|
+
return {
|
|
1723
|
+
token,
|
|
1724
|
+
team_id: teamId,
|
|
1725
|
+
team_domain: params.get("team_domain") ?? void 0,
|
|
1726
|
+
channel_id: channelId,
|
|
1727
|
+
channel_name: params.get("channel_name") ?? void 0,
|
|
1728
|
+
user_id: userId,
|
|
1729
|
+
user_name: params.get("user_name") ?? void 0,
|
|
1730
|
+
command,
|
|
1731
|
+
text: params.get("text") ?? "",
|
|
1732
|
+
trigger_id: params.get("trigger_id") ?? void 0,
|
|
1733
|
+
response_url: params.get("response_url") ?? void 0
|
|
1734
|
+
};
|
|
1735
|
+
} catch {
|
|
1736
|
+
return null;
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
/**
|
|
1740
|
+
* Map the trigger word back to the original OpenClaw command name.
|
|
1741
|
+
* e.g. "oc_status" -> "/status", "oc_model" -> "/model"
|
|
1742
|
+
*/
|
|
1743
|
+
function resolveCommandText(trigger, text, triggerMap) {
|
|
1744
|
+
const commandName = triggerMap?.get(trigger) ?? (trigger.startsWith("oc_") ? trigger.slice(3) : trigger);
|
|
1745
|
+
const args = text.trim();
|
|
1746
|
+
return args ? `/${commandName} ${args}` : `/${commandName}`;
|
|
1747
|
+
}
|
|
1748
|
+
const DEFAULT_CALLBACK_PATH = "/api/channels/mattermost/command";
|
|
1749
|
+
/**
|
|
1750
|
+
* Ensure the callback path starts with a leading `/` to prevent
|
|
1751
|
+
* malformed URLs like `http://host:portapi/...`.
|
|
1752
|
+
*/
|
|
1753
|
+
function normalizeCallbackPath(path) {
|
|
1754
|
+
const trimmed = path.trim();
|
|
1755
|
+
if (!trimmed) return DEFAULT_CALLBACK_PATH;
|
|
1756
|
+
return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
1757
|
+
}
|
|
1758
|
+
function resolveSlashCommandConfig(raw) {
|
|
1759
|
+
return {
|
|
1760
|
+
native: raw?.native ?? "auto",
|
|
1761
|
+
nativeSkills: raw?.nativeSkills ?? "auto",
|
|
1762
|
+
callbackPath: normalizeCallbackPath(raw?.callbackPath ?? DEFAULT_CALLBACK_PATH),
|
|
1763
|
+
callbackUrl: raw?.callbackUrl?.trim() || void 0
|
|
1764
|
+
};
|
|
1765
|
+
}
|
|
1766
|
+
function isSlashCommandsEnabled(config) {
|
|
1767
|
+
if (config.native === true) return true;
|
|
1768
|
+
if (config.native === false) return false;
|
|
1769
|
+
return false;
|
|
1770
|
+
}
|
|
1771
|
+
/**
|
|
1772
|
+
* Build the callback URL that Mattermost will POST to when a command is invoked.
|
|
1773
|
+
*/
|
|
1774
|
+
function resolveCallbackUrl(params) {
|
|
1775
|
+
if (params.config.callbackUrl) return params.config.callbackUrl;
|
|
1776
|
+
const isWildcardBindHost = (rawHost) => {
|
|
1777
|
+
const trimmed = rawHost.trim();
|
|
1778
|
+
if (!trimmed) return false;
|
|
1779
|
+
const host = trimmed.startsWith("[") && trimmed.endsWith("]") ? trimmed.slice(1, -1) : trimmed;
|
|
1780
|
+
return host === "0.0.0.0" || host === "::" || host === "0:0:0:0:0:0:0:0" || host === "::0";
|
|
1781
|
+
};
|
|
1782
|
+
let host = params.gatewayHost && !isWildcardBindHost(params.gatewayHost) ? params.gatewayHost : "localhost";
|
|
1783
|
+
const path = normalizeCallbackPath(params.config.callbackPath);
|
|
1784
|
+
if (host.includes(":") && !(host.startsWith("[") && host.endsWith("]"))) host = `[${host}]`;
|
|
1785
|
+
return `http://${host}:${params.gatewayPort}${path}`;
|
|
1786
|
+
}
|
|
1787
|
+
//#endregion
|
|
1788
|
+
//#region extensions/mattermost/src/mattermost/reply-delivery.ts
|
|
1789
|
+
async function deliverMattermostReplyPayload(params) {
|
|
1790
|
+
const reply = resolveSendableOutboundReplyParts(params.payload, { text: params.core.channel.text.convertMarkdownTables(params.payload.text ?? "", params.tableMode) });
|
|
1791
|
+
const mediaLocalRoots = getAgentScopedMediaLocalRoots(params.cfg, params.agentId);
|
|
1792
|
+
const chunkMode = params.core.channel.text.resolveChunkMode(params.cfg, "mattermost", params.accountId);
|
|
1793
|
+
await deliverTextOrMediaReply({
|
|
1794
|
+
payload: params.payload,
|
|
1795
|
+
text: reply.text,
|
|
1796
|
+
chunkText: (value) => params.core.channel.text.chunkMarkdownTextWithMode(value, params.textLimit, chunkMode),
|
|
1797
|
+
sendText: async (chunk) => {
|
|
1798
|
+
await params.sendMessage(params.to, chunk, {
|
|
1799
|
+
cfg: params.cfg,
|
|
1800
|
+
accountId: params.accountId,
|
|
1801
|
+
replyToId: params.replyToId
|
|
1802
|
+
});
|
|
1803
|
+
},
|
|
1804
|
+
sendMedia: async ({ mediaUrl, caption }) => {
|
|
1805
|
+
await params.sendMessage(params.to, caption ?? "", {
|
|
1806
|
+
cfg: params.cfg,
|
|
1807
|
+
accountId: params.accountId,
|
|
1808
|
+
mediaUrl,
|
|
1809
|
+
mediaLocalRoots,
|
|
1810
|
+
replyToId: params.replyToId
|
|
1811
|
+
});
|
|
1812
|
+
}
|
|
1813
|
+
});
|
|
1814
|
+
}
|
|
1815
|
+
//#endregion
|
|
1816
|
+
//#region extensions/mattermost/src/mattermost/target-resolution.ts
|
|
1817
|
+
const mattermostOpaqueTargetCache = /* @__PURE__ */ new Map();
|
|
1818
|
+
function cacheKey$1(baseUrl, token, id) {
|
|
1819
|
+
return `${baseUrl}::${token}::${id}`;
|
|
1820
|
+
}
|
|
1821
|
+
/** Mattermost IDs are 26-character lowercase alphanumeric strings. */
|
|
1822
|
+
function isMattermostId(value) {
|
|
1823
|
+
return /^[a-z0-9]{26}$/.test(value);
|
|
1824
|
+
}
|
|
1825
|
+
function isExplicitMattermostTarget(raw) {
|
|
1826
|
+
const trimmed = raw.trim();
|
|
1827
|
+
if (!trimmed) return false;
|
|
1828
|
+
return /^(channel|user|mattermost):/i.test(trimmed) || trimmed.startsWith("@") || trimmed.startsWith("#");
|
|
1829
|
+
}
|
|
1830
|
+
function parseMattermostApiStatus(err) {
|
|
1831
|
+
if (!err || typeof err !== "object") return;
|
|
1832
|
+
const msg = "message" in err ? String(err.message ?? "") : "";
|
|
1833
|
+
const match = /Mattermost API (\d{3})\b/.exec(msg);
|
|
1834
|
+
if (!match) return;
|
|
1835
|
+
const code = Number(match[1]);
|
|
1836
|
+
return Number.isFinite(code) ? code : void 0;
|
|
1837
|
+
}
|
|
1838
|
+
async function resolveMattermostOpaqueTarget(params) {
|
|
1839
|
+
const input = params.input.trim();
|
|
1840
|
+
if (!input || isExplicitMattermostTarget(input) || !isMattermostId(input)) return null;
|
|
1841
|
+
const account = params.cfg && (!params.token || !params.baseUrl) ? resolveMattermostAccount({
|
|
1842
|
+
cfg: params.cfg,
|
|
1843
|
+
accountId: params.accountId
|
|
1844
|
+
}) : null;
|
|
1845
|
+
const token = params.token?.trim() || account?.botToken?.trim();
|
|
1846
|
+
const baseUrl = normalizeMattermostBaseUrl(params.baseUrl ?? account?.baseUrl);
|
|
1847
|
+
if (!token || !baseUrl) return null;
|
|
1848
|
+
const key = cacheKey$1(baseUrl, token, input);
|
|
1849
|
+
const cached = mattermostOpaqueTargetCache.get(key);
|
|
1850
|
+
if (cached === true) return {
|
|
1851
|
+
kind: "user",
|
|
1852
|
+
id: input,
|
|
1853
|
+
to: `user:${input}`
|
|
1854
|
+
};
|
|
1855
|
+
if (cached === false) return {
|
|
1856
|
+
kind: "channel",
|
|
1857
|
+
id: input,
|
|
1858
|
+
to: `channel:${input}`
|
|
1859
|
+
};
|
|
1860
|
+
const client = createMattermostClient({
|
|
1861
|
+
baseUrl,
|
|
1862
|
+
botToken: token,
|
|
1863
|
+
allowPrivateNetwork: account?.config?.allowPrivateNetwork === true
|
|
1864
|
+
});
|
|
1865
|
+
try {
|
|
1866
|
+
await fetchMattermostUser(client, input);
|
|
1867
|
+
mattermostOpaqueTargetCache.set(key, true);
|
|
1868
|
+
return {
|
|
1869
|
+
kind: "user",
|
|
1870
|
+
id: input,
|
|
1871
|
+
to: `user:${input}`
|
|
1872
|
+
};
|
|
1873
|
+
} catch (err) {
|
|
1874
|
+
if (parseMattermostApiStatus(err) === 404) mattermostOpaqueTargetCache.set(key, false);
|
|
1875
|
+
return {
|
|
1876
|
+
kind: "channel",
|
|
1877
|
+
id: input,
|
|
1878
|
+
to: `channel:${input}`
|
|
1879
|
+
};
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
//#endregion
|
|
1883
|
+
//#region extensions/mattermost/src/mattermost/send.ts
|
|
1884
|
+
const botUserCache = /* @__PURE__ */ new Map();
|
|
1885
|
+
const userByNameCache = /* @__PURE__ */ new Map();
|
|
1886
|
+
const channelByNameCache = /* @__PURE__ */ new Map();
|
|
1887
|
+
const dmChannelCache = /* @__PURE__ */ new Map();
|
|
1888
|
+
const getCore = () => getMattermostRuntime();
|
|
1889
|
+
function recordMattermostOutboundActivity(accountId) {
|
|
1890
|
+
try {
|
|
1891
|
+
getCore().channel.activity.record({
|
|
1892
|
+
channel: "mattermost",
|
|
1893
|
+
accountId,
|
|
1894
|
+
direction: "outbound"
|
|
1895
|
+
});
|
|
1896
|
+
} catch (error) {
|
|
1897
|
+
if (!(error instanceof Error) || error.message !== "Mattermost runtime not initialized") throw error;
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
function cacheKey(baseUrl, token) {
|
|
1901
|
+
return `${baseUrl}::${token}`;
|
|
1902
|
+
}
|
|
1903
|
+
function normalizeMessage(text, mediaUrl) {
|
|
1904
|
+
return [text.trim(), mediaUrl?.trim()].filter(Boolean).join("\n");
|
|
1905
|
+
}
|
|
1906
|
+
function isHttpUrl(value) {
|
|
1907
|
+
return /^https?:\/\//i.test(value);
|
|
1908
|
+
}
|
|
1909
|
+
function parseMattermostTarget(raw) {
|
|
1910
|
+
const trimmed = raw.trim();
|
|
1911
|
+
if (!trimmed) throw new Error("Recipient is required for Mattermost sends");
|
|
1912
|
+
const lower = trimmed.toLowerCase();
|
|
1913
|
+
if (lower.startsWith("channel:")) {
|
|
1914
|
+
const id = trimmed.slice(8).trim();
|
|
1915
|
+
if (!id) throw new Error("Channel id is required for Mattermost sends");
|
|
1916
|
+
if (id.startsWith("#")) {
|
|
1917
|
+
const name = id.slice(1).trim();
|
|
1918
|
+
if (!name) throw new Error("Channel name is required for Mattermost sends");
|
|
1919
|
+
return {
|
|
1920
|
+
kind: "channel-name",
|
|
1921
|
+
name
|
|
1922
|
+
};
|
|
1923
|
+
}
|
|
1924
|
+
if (!isMattermostId(id)) return {
|
|
1925
|
+
kind: "channel-name",
|
|
1926
|
+
name: id
|
|
1927
|
+
};
|
|
1928
|
+
return {
|
|
1929
|
+
kind: "channel",
|
|
1930
|
+
id
|
|
1931
|
+
};
|
|
1932
|
+
}
|
|
1933
|
+
if (lower.startsWith("user:")) {
|
|
1934
|
+
const id = trimmed.slice(5).trim();
|
|
1935
|
+
if (!id) throw new Error("User id is required for Mattermost sends");
|
|
1936
|
+
return {
|
|
1937
|
+
kind: "user",
|
|
1938
|
+
id
|
|
1939
|
+
};
|
|
1940
|
+
}
|
|
1941
|
+
if (lower.startsWith("mattermost:")) {
|
|
1942
|
+
const id = trimmed.slice(11).trim();
|
|
1943
|
+
if (!id) throw new Error("User id is required for Mattermost sends");
|
|
1944
|
+
return {
|
|
1945
|
+
kind: "user",
|
|
1946
|
+
id
|
|
1947
|
+
};
|
|
1948
|
+
}
|
|
1949
|
+
if (trimmed.startsWith("@")) {
|
|
1950
|
+
const username = trimmed.slice(1).trim();
|
|
1951
|
+
if (!username) throw new Error("Username is required for Mattermost sends");
|
|
1952
|
+
return {
|
|
1953
|
+
kind: "user",
|
|
1954
|
+
username
|
|
1955
|
+
};
|
|
1956
|
+
}
|
|
1957
|
+
if (trimmed.startsWith("#")) {
|
|
1958
|
+
const name = trimmed.slice(1).trim();
|
|
1959
|
+
if (!name) throw new Error("Channel name is required for Mattermost sends");
|
|
1960
|
+
return {
|
|
1961
|
+
kind: "channel-name",
|
|
1962
|
+
name
|
|
1963
|
+
};
|
|
1964
|
+
}
|
|
1965
|
+
if (!isMattermostId(trimmed)) return {
|
|
1966
|
+
kind: "channel-name",
|
|
1967
|
+
name: trimmed
|
|
1968
|
+
};
|
|
1969
|
+
return {
|
|
1970
|
+
kind: "channel",
|
|
1971
|
+
id: trimmed
|
|
1972
|
+
};
|
|
1973
|
+
}
|
|
1974
|
+
async function resolveBotUser(baseUrl, token, allowPrivateNetwork) {
|
|
1975
|
+
const key = cacheKey(baseUrl, token);
|
|
1976
|
+
const cached = botUserCache.get(key);
|
|
1977
|
+
if (cached) return cached;
|
|
1978
|
+
const user = await fetchMattermostMe(createMattermostClient({
|
|
1979
|
+
baseUrl,
|
|
1980
|
+
botToken: token,
|
|
1981
|
+
allowPrivateNetwork
|
|
1982
|
+
}));
|
|
1983
|
+
botUserCache.set(key, user);
|
|
1984
|
+
return user;
|
|
1985
|
+
}
|
|
1986
|
+
async function resolveUserIdByUsername(params) {
|
|
1987
|
+
const { baseUrl, token, username } = params;
|
|
1988
|
+
const key = `${cacheKey(baseUrl, token)}::${username.toLowerCase()}`;
|
|
1989
|
+
const cached = userByNameCache.get(key);
|
|
1990
|
+
if (cached?.id) return cached.id;
|
|
1991
|
+
const user = await fetchMattermostUserByUsername(createMattermostClient({
|
|
1992
|
+
baseUrl,
|
|
1993
|
+
botToken: token,
|
|
1994
|
+
allowPrivateNetwork: params.allowPrivateNetwork
|
|
1995
|
+
}), username);
|
|
1996
|
+
userByNameCache.set(key, user);
|
|
1997
|
+
return user.id;
|
|
1998
|
+
}
|
|
1999
|
+
async function resolveChannelIdByName(params) {
|
|
2000
|
+
const { baseUrl, token, name } = params;
|
|
2001
|
+
const key = `${cacheKey(baseUrl, token)}::channel::${name.toLowerCase()}`;
|
|
2002
|
+
const cached = channelByNameCache.get(key);
|
|
2003
|
+
if (cached) return cached;
|
|
2004
|
+
const client = createMattermostClient({
|
|
2005
|
+
baseUrl,
|
|
2006
|
+
botToken: token,
|
|
2007
|
+
allowPrivateNetwork: params.allowPrivateNetwork
|
|
2008
|
+
});
|
|
2009
|
+
const teams = await fetchMattermostUserTeams(client, (await fetchMattermostMe(client)).id);
|
|
2010
|
+
for (const team of teams) try {
|
|
2011
|
+
const channel = await fetchMattermostChannelByName(client, team.id, name);
|
|
2012
|
+
if (channel?.id) {
|
|
2013
|
+
channelByNameCache.set(key, channel.id);
|
|
2014
|
+
return channel.id;
|
|
2015
|
+
}
|
|
2016
|
+
} catch {}
|
|
2017
|
+
throw new Error(`Mattermost channel "#${name}" not found in any team the bot belongs to`);
|
|
2018
|
+
}
|
|
2019
|
+
function mergeDmRetryOptions(base, override) {
|
|
2020
|
+
const merged = {
|
|
2021
|
+
maxRetries: override?.maxRetries ?? base?.maxRetries,
|
|
2022
|
+
initialDelayMs: override?.initialDelayMs ?? base?.initialDelayMs,
|
|
2023
|
+
maxDelayMs: override?.maxDelayMs ?? base?.maxDelayMs,
|
|
2024
|
+
timeoutMs: override?.timeoutMs ?? base?.timeoutMs,
|
|
2025
|
+
onRetry: override?.onRetry
|
|
2026
|
+
};
|
|
2027
|
+
if (merged.maxRetries === void 0 && merged.initialDelayMs === void 0 && merged.maxDelayMs === void 0 && merged.timeoutMs === void 0 && merged.onRetry === void 0) return;
|
|
2028
|
+
return merged;
|
|
2029
|
+
}
|
|
2030
|
+
async function resolveTargetChannelId(params) {
|
|
2031
|
+
if (params.target.kind === "channel") return params.target.id;
|
|
2032
|
+
if (params.target.kind === "channel-name") return await resolveChannelIdByName({
|
|
2033
|
+
baseUrl: params.baseUrl,
|
|
2034
|
+
token: params.token,
|
|
2035
|
+
name: params.target.name,
|
|
2036
|
+
allowPrivateNetwork: params.allowPrivateNetwork
|
|
2037
|
+
});
|
|
2038
|
+
const userId = params.target.id ? params.target.id : await resolveUserIdByUsername({
|
|
2039
|
+
baseUrl: params.baseUrl,
|
|
2040
|
+
token: params.token,
|
|
2041
|
+
username: params.target.username ?? "",
|
|
2042
|
+
allowPrivateNetwork: params.allowPrivateNetwork
|
|
2043
|
+
});
|
|
2044
|
+
const dmKey = `${cacheKey(params.baseUrl, params.token)}::dm::${userId}`;
|
|
2045
|
+
const cachedDm = dmChannelCache.get(dmKey);
|
|
2046
|
+
if (cachedDm) return cachedDm;
|
|
2047
|
+
const botUser = await resolveBotUser(params.baseUrl, params.token, params.allowPrivateNetwork);
|
|
2048
|
+
const channel = await createMattermostDirectChannelWithRetry(createMattermostClient({
|
|
2049
|
+
baseUrl: params.baseUrl,
|
|
2050
|
+
botToken: params.token,
|
|
2051
|
+
allowPrivateNetwork: params.allowPrivateNetwork
|
|
2052
|
+
}), [botUser.id, userId], {
|
|
2053
|
+
...params.dmRetryOptions,
|
|
2054
|
+
onRetry: (attempt, delayMs, error) => {
|
|
2055
|
+
params.dmRetryOptions?.onRetry?.(attempt, delayMs, error);
|
|
2056
|
+
if (params.logger) params.logger.warn?.(`DM channel creation retry ${attempt} after ${delayMs}ms: ${error.message}`);
|
|
2057
|
+
}
|
|
2058
|
+
});
|
|
2059
|
+
dmChannelCache.set(dmKey, channel.id);
|
|
2060
|
+
return channel.id;
|
|
2061
|
+
}
|
|
2062
|
+
async function resolveMattermostSendContext(to, opts = {}) {
|
|
2063
|
+
const core = getCore();
|
|
2064
|
+
const logger = core.logging.getChildLogger({ module: "mattermost" });
|
|
2065
|
+
const cfg = opts.cfg ?? core.config.loadConfig();
|
|
2066
|
+
const account = resolveMattermostAccount({
|
|
2067
|
+
cfg,
|
|
2068
|
+
accountId: opts.accountId
|
|
2069
|
+
});
|
|
2070
|
+
const token = opts.botToken?.trim() || account.botToken?.trim();
|
|
2071
|
+
if (!token) throw new Error(`Mattermost bot token missing for account "${account.accountId}" (set channels.mattermost.accounts.${account.accountId}.botToken or MATTERMOST_BOT_TOKEN for default).`);
|
|
2072
|
+
const baseUrl = normalizeMattermostBaseUrl(opts.baseUrl ?? account.baseUrl);
|
|
2073
|
+
if (!baseUrl) throw new Error(`Mattermost baseUrl missing for account "${account.accountId}" (set channels.mattermost.accounts.${account.accountId}.baseUrl or MATTERMOST_URL for default).`);
|
|
2074
|
+
const trimmedTo = to?.trim() ?? "";
|
|
2075
|
+
const opaqueTarget = await resolveMattermostOpaqueTarget({
|
|
2076
|
+
input: trimmedTo,
|
|
2077
|
+
token,
|
|
2078
|
+
baseUrl
|
|
2079
|
+
});
|
|
2080
|
+
const target = opaqueTarget?.kind === "user" ? {
|
|
2081
|
+
kind: "user",
|
|
2082
|
+
id: opaqueTarget.id
|
|
2083
|
+
} : opaqueTarget?.kind === "channel" ? {
|
|
2084
|
+
kind: "channel",
|
|
2085
|
+
id: opaqueTarget.id
|
|
2086
|
+
} : parseMattermostTarget(trimmedTo);
|
|
2087
|
+
const dmRetryOptions = mergeDmRetryOptions(account.config.dmChannelRetry ? {
|
|
2088
|
+
maxRetries: account.config.dmChannelRetry.maxRetries,
|
|
2089
|
+
initialDelayMs: account.config.dmChannelRetry.initialDelayMs,
|
|
2090
|
+
maxDelayMs: account.config.dmChannelRetry.maxDelayMs,
|
|
2091
|
+
timeoutMs: account.config.dmChannelRetry.timeoutMs
|
|
2092
|
+
} : void 0, opts.dmRetryOptions);
|
|
2093
|
+
const allowPrivateNetwork = account.config.allowPrivateNetwork === true;
|
|
2094
|
+
const channelId = await resolveTargetChannelId({
|
|
2095
|
+
target,
|
|
2096
|
+
baseUrl,
|
|
2097
|
+
token,
|
|
2098
|
+
allowPrivateNetwork,
|
|
2099
|
+
dmRetryOptions,
|
|
2100
|
+
logger: core.logging.shouldLogVerbose() ? logger : void 0
|
|
2101
|
+
});
|
|
2102
|
+
return {
|
|
2103
|
+
cfg,
|
|
2104
|
+
accountId: account.accountId,
|
|
2105
|
+
token,
|
|
2106
|
+
baseUrl,
|
|
2107
|
+
channelId,
|
|
2108
|
+
allowPrivateNetwork
|
|
2109
|
+
};
|
|
2110
|
+
}
|
|
2111
|
+
async function sendMessageMattermost(to, text, opts = {}) {
|
|
2112
|
+
const core = getCore();
|
|
2113
|
+
const logger = core.logging.getChildLogger({ module: "mattermost" });
|
|
2114
|
+
const { cfg, accountId, token, baseUrl, channelId, allowPrivateNetwork } = await resolveMattermostSendContext(to, opts);
|
|
2115
|
+
const client = createMattermostClient({
|
|
2116
|
+
baseUrl,
|
|
2117
|
+
botToken: token,
|
|
2118
|
+
allowPrivateNetwork
|
|
2119
|
+
});
|
|
2120
|
+
let props = opts.props;
|
|
2121
|
+
if (!props && Array.isArray(opts.buttons) && opts.buttons.length > 0) {
|
|
2122
|
+
setInteractionSecret(accountId, token);
|
|
2123
|
+
props = buildButtonProps({
|
|
2124
|
+
callbackUrl: resolveInteractionCallbackUrl(accountId, {
|
|
2125
|
+
gateway: cfg.gateway,
|
|
2126
|
+
interactions: resolveMattermostAccount({
|
|
2127
|
+
cfg,
|
|
2128
|
+
accountId
|
|
2129
|
+
}).config?.interactions
|
|
2130
|
+
}),
|
|
2131
|
+
accountId,
|
|
2132
|
+
channelId,
|
|
2133
|
+
buttons: opts.buttons,
|
|
2134
|
+
text: opts.attachmentText
|
|
2135
|
+
});
|
|
2136
|
+
}
|
|
2137
|
+
let message = text?.trim() ?? "";
|
|
2138
|
+
let fileIds;
|
|
2139
|
+
let uploadError;
|
|
2140
|
+
const mediaUrl = opts.mediaUrl?.trim();
|
|
2141
|
+
if (mediaUrl) try {
|
|
2142
|
+
const media = await loadOutboundMediaFromUrl(mediaUrl, {
|
|
2143
|
+
mediaLocalRoots: opts.mediaLocalRoots,
|
|
2144
|
+
mediaReadFile: opts.mediaReadFile
|
|
2145
|
+
});
|
|
2146
|
+
fileIds = [(await uploadMattermostFile(client, {
|
|
2147
|
+
channelId,
|
|
2148
|
+
buffer: media.buffer,
|
|
2149
|
+
fileName: media.fileName ?? "upload",
|
|
2150
|
+
contentType: media.contentType ?? void 0
|
|
2151
|
+
})).id];
|
|
2152
|
+
} catch (err) {
|
|
2153
|
+
uploadError = err instanceof Error ? err : new Error(String(err));
|
|
2154
|
+
if (core.logging.shouldLogVerbose()) logger.debug?.(`mattermost send: media upload failed, falling back to URL text: ${String(err)}`);
|
|
2155
|
+
message = normalizeMessage(message, isHttpUrl(mediaUrl) ? mediaUrl : "");
|
|
2156
|
+
}
|
|
2157
|
+
if (message) {
|
|
2158
|
+
const tableMode = resolveMarkdownTableMode({
|
|
2159
|
+
cfg,
|
|
2160
|
+
channel: "mattermost",
|
|
2161
|
+
accountId
|
|
2162
|
+
});
|
|
2163
|
+
message = convertMarkdownTables(message, tableMode);
|
|
2164
|
+
}
|
|
2165
|
+
if (!message && (!fileIds || fileIds.length === 0)) {
|
|
2166
|
+
if (uploadError) throw new Error(`Mattermost media upload failed: ${uploadError.message}`);
|
|
2167
|
+
throw new Error("Mattermost message is empty");
|
|
2168
|
+
}
|
|
2169
|
+
const post = await createMattermostPost(client, {
|
|
2170
|
+
channelId,
|
|
2171
|
+
message,
|
|
2172
|
+
rootId: opts.replyToId,
|
|
2173
|
+
fileIds,
|
|
2174
|
+
props
|
|
2175
|
+
});
|
|
2176
|
+
recordMattermostOutboundActivity(accountId);
|
|
2177
|
+
return {
|
|
2178
|
+
messageId: post.id ?? "unknown",
|
|
2179
|
+
channelId
|
|
2180
|
+
};
|
|
2181
|
+
}
|
|
2182
|
+
//#endregion
|
|
2183
|
+
//#region extensions/mattermost/src/mattermost/slash-http.ts
|
|
2184
|
+
const MAX_BODY_BYTES = 64 * 1024;
|
|
2185
|
+
const BODY_READ_TIMEOUT_MS = 5e3;
|
|
2186
|
+
/**
|
|
2187
|
+
* Read the full request body as a string.
|
|
2188
|
+
*/
|
|
2189
|
+
function readBody(req, maxBytes) {
|
|
2190
|
+
return readRequestBodyWithLimit(req, {
|
|
2191
|
+
maxBytes,
|
|
2192
|
+
timeoutMs: BODY_READ_TIMEOUT_MS
|
|
2193
|
+
});
|
|
2194
|
+
}
|
|
2195
|
+
function sendJsonResponse(res, status, body) {
|
|
2196
|
+
res.statusCode = status;
|
|
2197
|
+
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
2198
|
+
res.end(JSON.stringify(body));
|
|
2199
|
+
}
|
|
2200
|
+
async function authorizeSlashInvocation(params) {
|
|
2201
|
+
const { account, cfg, client, commandText, channelId, senderId, senderName, log } = params;
|
|
2202
|
+
const core = getMattermostRuntime();
|
|
2203
|
+
let channelInfo = null;
|
|
2204
|
+
try {
|
|
2205
|
+
channelInfo = await fetchMattermostChannel(client, channelId);
|
|
2206
|
+
} catch (err) {
|
|
2207
|
+
log?.(`mattermost: slash channel lookup failed for ${channelId}: ${String(err)}`);
|
|
2208
|
+
}
|
|
2209
|
+
if (!channelInfo) return {
|
|
2210
|
+
ok: false,
|
|
2211
|
+
denyResponse: {
|
|
2212
|
+
response_type: "ephemeral",
|
|
2213
|
+
text: "Temporary error: unable to determine channel type. Please try again."
|
|
2214
|
+
},
|
|
2215
|
+
commandAuthorized: false,
|
|
2216
|
+
channelInfo: null,
|
|
2217
|
+
kind: "channel",
|
|
2218
|
+
chatType: "channel",
|
|
2219
|
+
channelName: "",
|
|
2220
|
+
channelDisplay: "",
|
|
2221
|
+
roomLabel: `#${channelId}`
|
|
2222
|
+
};
|
|
2223
|
+
const allowTextCommands = core.channel.commands.shouldHandleTextCommands({
|
|
2224
|
+
cfg,
|
|
2225
|
+
surface: "mattermost"
|
|
2226
|
+
});
|
|
2227
|
+
const hasControlCommand = core.channel.text.hasControlCommand(commandText, cfg);
|
|
2228
|
+
const storeAllowFrom = normalizeMattermostAllowList(await core.channel.pairing.readAllowFromStore({
|
|
2229
|
+
channel: "mattermost",
|
|
2230
|
+
accountId: account.accountId
|
|
2231
|
+
}).catch(() => []));
|
|
2232
|
+
const decision = authorizeMattermostCommandInvocation({
|
|
2233
|
+
account,
|
|
2234
|
+
cfg,
|
|
2235
|
+
senderId,
|
|
2236
|
+
senderName,
|
|
2237
|
+
channelId,
|
|
2238
|
+
channelInfo,
|
|
2239
|
+
storeAllowFrom,
|
|
2240
|
+
allowTextCommands,
|
|
2241
|
+
hasControlCommand
|
|
2242
|
+
});
|
|
2243
|
+
if (!decision.ok) {
|
|
2244
|
+
if (decision.denyReason === "dm-pairing") {
|
|
2245
|
+
const { code } = await core.channel.pairing.upsertPairingRequest({
|
|
2246
|
+
channel: "mattermost",
|
|
2247
|
+
accountId: account.accountId,
|
|
2248
|
+
id: senderId,
|
|
2249
|
+
meta: { name: senderName }
|
|
2250
|
+
});
|
|
2251
|
+
return {
|
|
2252
|
+
...decision,
|
|
2253
|
+
denyResponse: {
|
|
2254
|
+
response_type: "ephemeral",
|
|
2255
|
+
text: core.channel.pairing.buildPairingReply({
|
|
2256
|
+
channel: "mattermost",
|
|
2257
|
+
idLine: `Your Mattermost user id: ${senderId}`,
|
|
2258
|
+
code
|
|
2259
|
+
})
|
|
2260
|
+
}
|
|
2261
|
+
};
|
|
2262
|
+
}
|
|
2263
|
+
const denyText = decision.denyReason === "unknown-channel" ? "Temporary error: unable to determine channel type. Please try again." : decision.denyReason === "dm-disabled" ? "This bot is not accepting direct messages." : decision.denyReason === "channels-disabled" ? "Slash commands are disabled in channels." : decision.denyReason === "channel-no-allowlist" ? "Slash commands are not configured for this channel (no allowlist)." : "Unauthorized.";
|
|
2264
|
+
return {
|
|
2265
|
+
...decision,
|
|
2266
|
+
denyResponse: {
|
|
2267
|
+
response_type: "ephemeral",
|
|
2268
|
+
text: denyText
|
|
2269
|
+
}
|
|
2270
|
+
};
|
|
2271
|
+
}
|
|
2272
|
+
return {
|
|
2273
|
+
...decision,
|
|
2274
|
+
denyResponse: void 0
|
|
2275
|
+
};
|
|
2276
|
+
}
|
|
2277
|
+
/**
|
|
2278
|
+
* Create the HTTP request handler for Mattermost slash command callbacks.
|
|
2279
|
+
*
|
|
2280
|
+
* This handler is registered as a plugin HTTP route and receives POSTs
|
|
2281
|
+
* from the Mattermost server when a user invokes a registered slash command.
|
|
2282
|
+
*/
|
|
2283
|
+
function createSlashCommandHttpHandler(params) {
|
|
2284
|
+
const { account, cfg, runtime, commandTokens, triggerMap, log } = params;
|
|
2285
|
+
return async (req, res) => {
|
|
2286
|
+
if (req.method !== "POST") {
|
|
2287
|
+
res.statusCode = 405;
|
|
2288
|
+
res.setHeader("Allow", "POST");
|
|
2289
|
+
res.end("Method Not Allowed");
|
|
2290
|
+
return;
|
|
2291
|
+
}
|
|
2292
|
+
let body;
|
|
2293
|
+
try {
|
|
2294
|
+
body = await readBody(req, MAX_BODY_BYTES);
|
|
2295
|
+
} catch (error) {
|
|
2296
|
+
if (isRequestBodyLimitError(error, "REQUEST_BODY_TIMEOUT")) {
|
|
2297
|
+
res.statusCode = 408;
|
|
2298
|
+
res.end("Request body timeout");
|
|
2299
|
+
return;
|
|
2300
|
+
}
|
|
2301
|
+
res.statusCode = 413;
|
|
2302
|
+
res.end("Payload Too Large");
|
|
2303
|
+
return;
|
|
2304
|
+
}
|
|
2305
|
+
const contentType = req.headers["content-type"] ?? "";
|
|
2306
|
+
const payload = parseSlashCommandPayload(body, contentType);
|
|
2307
|
+
if (!payload) {
|
|
2308
|
+
sendJsonResponse(res, 400, {
|
|
2309
|
+
response_type: "ephemeral",
|
|
2310
|
+
text: "Invalid slash command payload."
|
|
2311
|
+
});
|
|
2312
|
+
return;
|
|
2313
|
+
}
|
|
2314
|
+
if (commandTokens.size === 0 || !commandTokens.has(payload.token)) {
|
|
2315
|
+
sendJsonResponse(res, 401, {
|
|
2316
|
+
response_type: "ephemeral",
|
|
2317
|
+
text: "Unauthorized: invalid command token."
|
|
2318
|
+
});
|
|
2319
|
+
return;
|
|
2320
|
+
}
|
|
2321
|
+
const trigger = payload.command.replace(/^\//, "").trim();
|
|
2322
|
+
const commandText = resolveCommandText(trigger, payload.text, triggerMap);
|
|
2323
|
+
const channelId = payload.channel_id;
|
|
2324
|
+
const senderId = payload.user_id;
|
|
2325
|
+
const senderName = payload.user_name ?? senderId;
|
|
2326
|
+
const client = createMattermostClient({
|
|
2327
|
+
baseUrl: account.baseUrl ?? "",
|
|
2328
|
+
botToken: account.botToken ?? "",
|
|
2329
|
+
allowPrivateNetwork: account.config?.allowPrivateNetwork === true
|
|
2330
|
+
});
|
|
2331
|
+
const auth = await authorizeSlashInvocation({
|
|
2332
|
+
account,
|
|
2333
|
+
cfg,
|
|
2334
|
+
client,
|
|
2335
|
+
commandText,
|
|
2336
|
+
channelId,
|
|
2337
|
+
senderId,
|
|
2338
|
+
senderName,
|
|
2339
|
+
log
|
|
2340
|
+
});
|
|
2341
|
+
if (!auth.ok) {
|
|
2342
|
+
sendJsonResponse(res, 200, auth.denyResponse ?? {
|
|
2343
|
+
response_type: "ephemeral",
|
|
2344
|
+
text: "Unauthorized."
|
|
2345
|
+
});
|
|
2346
|
+
return;
|
|
2347
|
+
}
|
|
2348
|
+
log?.(`mattermost: slash command /${trigger} from ${senderName} in ${channelId}`);
|
|
2349
|
+
sendJsonResponse(res, 200, {
|
|
2350
|
+
response_type: "ephemeral",
|
|
2351
|
+
text: "Processing..."
|
|
2352
|
+
});
|
|
2353
|
+
try {
|
|
2354
|
+
await handleSlashCommandAsync({
|
|
2355
|
+
account,
|
|
2356
|
+
cfg,
|
|
2357
|
+
runtime,
|
|
2358
|
+
client,
|
|
2359
|
+
commandText,
|
|
2360
|
+
channelId,
|
|
2361
|
+
senderId,
|
|
2362
|
+
senderName,
|
|
2363
|
+
teamId: payload.team_id,
|
|
2364
|
+
triggerId: payload.trigger_id,
|
|
2365
|
+
kind: auth.kind,
|
|
2366
|
+
chatType: auth.chatType,
|
|
2367
|
+
channelName: auth.channelName,
|
|
2368
|
+
channelDisplay: auth.channelDisplay,
|
|
2369
|
+
roomLabel: auth.roomLabel,
|
|
2370
|
+
commandAuthorized: auth.commandAuthorized,
|
|
2371
|
+
log
|
|
2372
|
+
});
|
|
2373
|
+
} catch (err) {
|
|
2374
|
+
log?.(`mattermost: slash command handler error: ${String(err)}`);
|
|
2375
|
+
try {
|
|
2376
|
+
await sendMessageMattermost(`channel:${channelId}`, "Sorry, something went wrong processing that command.", {
|
|
2377
|
+
cfg,
|
|
2378
|
+
accountId: account.accountId
|
|
2379
|
+
});
|
|
2380
|
+
} catch {}
|
|
2381
|
+
}
|
|
2382
|
+
};
|
|
2383
|
+
}
|
|
2384
|
+
async function handleSlashCommandAsync(params) {
|
|
2385
|
+
const { account, cfg, runtime, client, commandText, channelId, senderId, senderName, teamId, kind, chatType, channelName, channelDisplay, roomLabel, commandAuthorized, triggerId, log } = params;
|
|
2386
|
+
const core = getMattermostRuntime();
|
|
2387
|
+
const route = core.channel.routing.resolveAgentRoute({
|
|
2388
|
+
cfg,
|
|
2389
|
+
channel: "mattermost",
|
|
2390
|
+
accountId: account.accountId,
|
|
2391
|
+
teamId,
|
|
2392
|
+
peer: {
|
|
2393
|
+
kind,
|
|
2394
|
+
id: kind === "direct" ? senderId : channelId
|
|
2395
|
+
}
|
|
2396
|
+
});
|
|
2397
|
+
const fromLabel = kind === "direct" ? `Mattermost DM from ${senderName}` : `Mattermost message in ${roomLabel} from ${senderName}`;
|
|
2398
|
+
const to = kind === "direct" ? `user:${senderId}` : `channel:${channelId}`;
|
|
2399
|
+
const pickerEntry = resolveMattermostModelPickerEntry(commandText);
|
|
2400
|
+
if (pickerEntry) {
|
|
2401
|
+
const data = await buildModelsProviderData(cfg, route.agentId);
|
|
2402
|
+
if (data.providers.length === 0) {
|
|
2403
|
+
await sendMessageMattermost(to, "No models available.", {
|
|
2404
|
+
cfg,
|
|
2405
|
+
accountId: account.accountId
|
|
2406
|
+
});
|
|
2407
|
+
return;
|
|
2408
|
+
}
|
|
2409
|
+
const currentModel = resolveMattermostModelPickerCurrentModel({
|
|
2410
|
+
cfg,
|
|
2411
|
+
route,
|
|
2412
|
+
data
|
|
2413
|
+
});
|
|
2414
|
+
const view = pickerEntry.kind === "summary" ? renderMattermostModelSummaryView({
|
|
2415
|
+
ownerUserId: senderId,
|
|
2416
|
+
currentModel
|
|
2417
|
+
}) : pickerEntry.kind === "providers" ? renderMattermostProviderPickerView({
|
|
2418
|
+
ownerUserId: senderId,
|
|
2419
|
+
data,
|
|
2420
|
+
currentModel
|
|
2421
|
+
}) : renderMattermostModelsPickerView({
|
|
2422
|
+
ownerUserId: senderId,
|
|
2423
|
+
data,
|
|
2424
|
+
provider: pickerEntry.provider,
|
|
2425
|
+
page: 1,
|
|
2426
|
+
currentModel
|
|
2427
|
+
});
|
|
2428
|
+
await sendMessageMattermost(to, view.text, {
|
|
2429
|
+
cfg,
|
|
2430
|
+
accountId: account.accountId,
|
|
2431
|
+
buttons: view.buttons
|
|
2432
|
+
});
|
|
2433
|
+
runtime.log?.(`delivered model picker to ${to}`);
|
|
2434
|
+
return;
|
|
2435
|
+
}
|
|
2436
|
+
const ctxPayload = core.channel.reply.finalizeInboundContext({
|
|
2437
|
+
Body: commandText,
|
|
2438
|
+
BodyForAgent: commandText,
|
|
2439
|
+
RawBody: commandText,
|
|
2440
|
+
CommandBody: commandText,
|
|
2441
|
+
From: kind === "direct" ? `mattermost:${senderId}` : kind === "group" ? `mattermost:group:${channelId}` : `mattermost:channel:${channelId}`,
|
|
2442
|
+
To: to,
|
|
2443
|
+
SessionKey: route.sessionKey,
|
|
2444
|
+
AccountId: route.accountId,
|
|
2445
|
+
ChatType: chatType,
|
|
2446
|
+
ConversationLabel: fromLabel,
|
|
2447
|
+
GroupSubject: kind !== "direct" ? channelDisplay || roomLabel : void 0,
|
|
2448
|
+
SenderName: senderName,
|
|
2449
|
+
SenderId: senderId,
|
|
2450
|
+
Provider: "mattermost",
|
|
2451
|
+
Surface: "mattermost",
|
|
2452
|
+
MessageSid: triggerId ?? `slash-${Date.now()}`,
|
|
2453
|
+
Timestamp: Date.now(),
|
|
2454
|
+
WasMentioned: true,
|
|
2455
|
+
CommandAuthorized: commandAuthorized,
|
|
2456
|
+
CommandSource: "native",
|
|
2457
|
+
OriginatingChannel: "mattermost",
|
|
2458
|
+
OriginatingTo: to
|
|
2459
|
+
});
|
|
2460
|
+
const textLimit = core.channel.text.resolveTextChunkLimit(cfg, "mattermost", account.accountId, { fallbackLimit: account.textChunkLimit ?? 4e3 });
|
|
2461
|
+
const tableMode = core.channel.text.resolveMarkdownTableMode({
|
|
2462
|
+
cfg,
|
|
2463
|
+
channel: "mattermost",
|
|
2464
|
+
accountId: account.accountId
|
|
2465
|
+
});
|
|
2466
|
+
const { onModelSelected, typingCallbacks, ...replyPipeline } = createChannelReplyPipeline({
|
|
2467
|
+
cfg,
|
|
2468
|
+
agentId: route.agentId,
|
|
2469
|
+
channel: "mattermost",
|
|
2470
|
+
accountId: account.accountId,
|
|
2471
|
+
typing: {
|
|
2472
|
+
start: () => sendMattermostTyping(client, { channelId }),
|
|
2473
|
+
onStartError: (err) => {
|
|
2474
|
+
logTypingFailure({
|
|
2475
|
+
log: (message) => log?.(message),
|
|
2476
|
+
channel: "mattermost",
|
|
2477
|
+
target: channelId,
|
|
2478
|
+
error: err
|
|
2479
|
+
});
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2482
|
+
});
|
|
2483
|
+
const humanDelay = core.channel.reply.resolveHumanDelayConfig(cfg, route.agentId);
|
|
2484
|
+
const { dispatcher, replyOptions, markDispatchIdle } = core.channel.reply.createReplyDispatcherWithTyping({
|
|
2485
|
+
...replyPipeline,
|
|
2486
|
+
humanDelay,
|
|
2487
|
+
deliver: async (payload) => {
|
|
2488
|
+
await deliverMattermostReplyPayload({
|
|
2489
|
+
core,
|
|
2490
|
+
cfg,
|
|
2491
|
+
payload,
|
|
2492
|
+
to,
|
|
2493
|
+
accountId: account.accountId,
|
|
2494
|
+
agentId: route.agentId,
|
|
2495
|
+
textLimit,
|
|
2496
|
+
tableMode,
|
|
2497
|
+
sendMessage: sendMessageMattermost
|
|
2498
|
+
});
|
|
2499
|
+
runtime.log?.(`delivered slash reply to ${to}`);
|
|
2500
|
+
},
|
|
2501
|
+
onError: (err, info) => {
|
|
2502
|
+
runtime.error?.(`mattermost slash ${info.kind} reply failed: ${String(err)}`);
|
|
2503
|
+
},
|
|
2504
|
+
onReplyStart: typingCallbacks?.onReplyStart
|
|
2505
|
+
});
|
|
2506
|
+
await core.channel.reply.withReplyDispatcher({
|
|
2507
|
+
dispatcher,
|
|
2508
|
+
onSettled: () => {
|
|
2509
|
+
markDispatchIdle();
|
|
2510
|
+
},
|
|
2511
|
+
run: () => core.channel.reply.dispatchReplyFromConfig({
|
|
2512
|
+
ctx: ctxPayload,
|
|
2513
|
+
cfg,
|
|
2514
|
+
dispatcher,
|
|
2515
|
+
replyOptions: {
|
|
2516
|
+
...replyOptions,
|
|
2517
|
+
disableBlockStreaming: typeof account.blockStreaming === "boolean" ? !account.blockStreaming : void 0,
|
|
2518
|
+
onModelSelected
|
|
2519
|
+
}
|
|
2520
|
+
})
|
|
2521
|
+
});
|
|
2522
|
+
}
|
|
2523
|
+
//#endregion
|
|
2524
|
+
//#region extensions/mattermost/src/mattermost/slash-state.ts
|
|
2525
|
+
/** Map from accountId → per-account slash command state. */
|
|
2526
|
+
const accountStates = /* @__PURE__ */ new Map();
|
|
2527
|
+
function resolveSlashHandlerForToken(token) {
|
|
2528
|
+
const matches = [];
|
|
2529
|
+
for (const [accountId, state] of accountStates) if (state.commandTokens.has(token) && state.handler) matches.push({
|
|
2530
|
+
accountId,
|
|
2531
|
+
handler: state.handler
|
|
2532
|
+
});
|
|
2533
|
+
if (matches.length === 0) return { kind: "none" };
|
|
2534
|
+
if (matches.length === 1) return {
|
|
2535
|
+
kind: "single",
|
|
2536
|
+
handler: matches[0].handler,
|
|
2537
|
+
accountIds: [matches[0].accountId]
|
|
2538
|
+
};
|
|
2539
|
+
return {
|
|
2540
|
+
kind: "ambiguous",
|
|
2541
|
+
accountIds: matches.map((entry) => entry.accountId)
|
|
2542
|
+
};
|
|
2543
|
+
}
|
|
2544
|
+
/**
|
|
2545
|
+
* Get the slash command state for a specific account, or null if not activated.
|
|
2546
|
+
*/
|
|
2547
|
+
function getSlashCommandState(accountId) {
|
|
2548
|
+
return accountStates.get(accountId) ?? null;
|
|
2549
|
+
}
|
|
2550
|
+
/**
|
|
2551
|
+
* Activate slash commands for a specific account.
|
|
2552
|
+
* Called from the monitor after bot connects.
|
|
2553
|
+
*/
|
|
2554
|
+
function activateSlashCommands(params) {
|
|
2555
|
+
const { account, commandTokens, registeredCommands, triggerMap, api, log } = params;
|
|
2556
|
+
const accountId = account.accountId;
|
|
2557
|
+
const tokenSet = new Set(commandTokens);
|
|
2558
|
+
const handler = createSlashCommandHttpHandler({
|
|
2559
|
+
account,
|
|
2560
|
+
cfg: api.cfg,
|
|
2561
|
+
runtime: api.runtime,
|
|
2562
|
+
commandTokens: tokenSet,
|
|
2563
|
+
triggerMap,
|
|
2564
|
+
log
|
|
2565
|
+
});
|
|
2566
|
+
accountStates.set(accountId, {
|
|
2567
|
+
commandTokens: tokenSet,
|
|
2568
|
+
registeredCommands,
|
|
2569
|
+
handler,
|
|
2570
|
+
account,
|
|
2571
|
+
triggerMap: triggerMap ?? /* @__PURE__ */ new Map()
|
|
2572
|
+
});
|
|
2573
|
+
log?.(`mattermost: slash commands activated for account ${accountId} (${registeredCommands.length} commands)`);
|
|
2574
|
+
}
|
|
2575
|
+
/**
|
|
2576
|
+
* Deactivate slash commands for a specific account (on shutdown/disconnect).
|
|
2577
|
+
*/
|
|
2578
|
+
function deactivateSlashCommands(accountId) {
|
|
2579
|
+
if (accountId) {
|
|
2580
|
+
const state = accountStates.get(accountId);
|
|
2581
|
+
if (state) {
|
|
2582
|
+
state.commandTokens.clear();
|
|
2583
|
+
state.registeredCommands = [];
|
|
2584
|
+
state.handler = null;
|
|
2585
|
+
accountStates.delete(accountId);
|
|
2586
|
+
}
|
|
2587
|
+
} else {
|
|
2588
|
+
for (const [, state] of accountStates) {
|
|
2589
|
+
state.commandTokens.clear();
|
|
2590
|
+
state.registeredCommands = [];
|
|
2591
|
+
state.handler = null;
|
|
2592
|
+
}
|
|
2593
|
+
accountStates.clear();
|
|
2594
|
+
}
|
|
2595
|
+
}
|
|
2596
|
+
/**
|
|
2597
|
+
* Register the HTTP route for slash command callbacks.
|
|
2598
|
+
* Called during plugin registration.
|
|
2599
|
+
*
|
|
2600
|
+
* The single HTTP route dispatches to the correct per-account handler
|
|
2601
|
+
* by matching the inbound token against each account's registered tokens.
|
|
2602
|
+
*/
|
|
2603
|
+
function registerSlashCommandRoute(api) {
|
|
2604
|
+
const mmConfig = api.config.channels?.mattermost;
|
|
2605
|
+
const callbackPaths = /* @__PURE__ */ new Set();
|
|
2606
|
+
const addCallbackPaths = (raw) => {
|
|
2607
|
+
const resolved = resolveSlashCommandConfig(raw);
|
|
2608
|
+
callbackPaths.add(resolved.callbackPath);
|
|
2609
|
+
if (resolved.callbackUrl) try {
|
|
2610
|
+
const urlPath = new URL(resolved.callbackUrl).pathname;
|
|
2611
|
+
if (urlPath && urlPath !== resolved.callbackPath) callbackPaths.add(urlPath);
|
|
2612
|
+
} catch {}
|
|
2613
|
+
};
|
|
2614
|
+
const commandsRaw = mmConfig?.commands;
|
|
2615
|
+
addCallbackPaths(commandsRaw);
|
|
2616
|
+
const accountsRaw = mmConfig?.accounts ?? {};
|
|
2617
|
+
for (const accountId of Object.keys(accountsRaw)) {
|
|
2618
|
+
const accountCommandsRaw = accountsRaw[accountId]?.commands;
|
|
2619
|
+
addCallbackPaths(accountCommandsRaw);
|
|
2620
|
+
}
|
|
2621
|
+
const routeHandler = async (req, res) => {
|
|
2622
|
+
if (accountStates.size === 0) {
|
|
2623
|
+
res.statusCode = 503;
|
|
2624
|
+
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
2625
|
+
res.end(JSON.stringify({
|
|
2626
|
+
response_type: "ephemeral",
|
|
2627
|
+
text: "Slash commands are not yet initialized. Please try again in a moment."
|
|
2628
|
+
}));
|
|
2629
|
+
return;
|
|
2630
|
+
}
|
|
2631
|
+
if (accountStates.size === 1) {
|
|
2632
|
+
const [, state] = [...accountStates.entries()][0];
|
|
2633
|
+
if (!state.handler) {
|
|
2634
|
+
res.statusCode = 503;
|
|
2635
|
+
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
2636
|
+
res.end(JSON.stringify({
|
|
2637
|
+
response_type: "ephemeral",
|
|
2638
|
+
text: "Slash commands are not yet initialized. Please try again in a moment."
|
|
2639
|
+
}));
|
|
2640
|
+
return;
|
|
2641
|
+
}
|
|
2642
|
+
await state.handler(req, res);
|
|
2643
|
+
return;
|
|
2644
|
+
}
|
|
2645
|
+
const chunks = [];
|
|
2646
|
+
const MAX_BODY = 64 * 1024;
|
|
2647
|
+
let size = 0;
|
|
2648
|
+
for await (const chunk of req) {
|
|
2649
|
+
size += chunk.length;
|
|
2650
|
+
if (size > MAX_BODY) {
|
|
2651
|
+
res.statusCode = 413;
|
|
2652
|
+
res.end("Payload Too Large");
|
|
2653
|
+
return;
|
|
2654
|
+
}
|
|
2655
|
+
chunks.push(chunk);
|
|
2656
|
+
}
|
|
2657
|
+
const bodyStr = Buffer.concat(chunks).toString("utf8");
|
|
2658
|
+
let token = null;
|
|
2659
|
+
const ct = req.headers["content-type"] ?? "";
|
|
2660
|
+
try {
|
|
2661
|
+
if (ct.includes("application/json")) token = JSON.parse(bodyStr).token ?? null;
|
|
2662
|
+
else token = new URLSearchParams(bodyStr).get("token");
|
|
2663
|
+
} catch {}
|
|
2664
|
+
const match = token ? resolveSlashHandlerForToken(token) : { kind: "none" };
|
|
2665
|
+
if (match.kind === "none") {
|
|
2666
|
+
res.statusCode = 401;
|
|
2667
|
+
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
2668
|
+
res.end(JSON.stringify({
|
|
2669
|
+
response_type: "ephemeral",
|
|
2670
|
+
text: "Unauthorized: invalid command token."
|
|
2671
|
+
}));
|
|
2672
|
+
return;
|
|
2673
|
+
}
|
|
2674
|
+
if (match.kind === "ambiguous") {
|
|
2675
|
+
api.logger.warn?.(`mattermost: slash callback token matched multiple accounts (${match.accountIds?.join(", ")})`);
|
|
2676
|
+
res.statusCode = 409;
|
|
2677
|
+
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
2678
|
+
res.end(JSON.stringify({
|
|
2679
|
+
response_type: "ephemeral",
|
|
2680
|
+
text: "Conflict: command token is not unique across accounts."
|
|
2681
|
+
}));
|
|
2682
|
+
return;
|
|
2683
|
+
}
|
|
2684
|
+
const matchedHandler = match.handler;
|
|
2685
|
+
const { Readable } = await import("node:stream");
|
|
2686
|
+
const syntheticReq = new Readable({ read() {
|
|
2687
|
+
this.push(Buffer.from(bodyStr, "utf8"));
|
|
2688
|
+
this.push(null);
|
|
2689
|
+
} });
|
|
2690
|
+
syntheticReq.method = req.method;
|
|
2691
|
+
syntheticReq.url = req.url;
|
|
2692
|
+
syntheticReq.headers = req.headers;
|
|
2693
|
+
await matchedHandler(syntheticReq, res);
|
|
2694
|
+
};
|
|
2695
|
+
for (const callbackPath of callbackPaths) {
|
|
2696
|
+
api.registerHttpRoute({
|
|
2697
|
+
path: callbackPath,
|
|
2698
|
+
auth: "plugin",
|
|
2699
|
+
handler: routeHandler
|
|
2700
|
+
});
|
|
2701
|
+
api.logger.info?.(`mattermost: registered slash command callback at ${callbackPath}`);
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
//#endregion
|
|
2705
|
+
//#region extensions/mattermost/src/mattermost/monitor-slash.ts
|
|
2706
|
+
function isLoopbackHost$1(hostname) {
|
|
2707
|
+
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1";
|
|
2708
|
+
}
|
|
2709
|
+
function buildSlashCommands(params) {
|
|
2710
|
+
const commandsToRegister = [...DEFAULT_COMMAND_SPECS];
|
|
2711
|
+
if (!params.nativeSkills) return commandsToRegister;
|
|
2712
|
+
try {
|
|
2713
|
+
const skillCommands = listSkillCommandsForAgents({ cfg: params.cfg });
|
|
2714
|
+
for (const spec of skillCommands) {
|
|
2715
|
+
const name = typeof spec.name === "string" ? spec.name.trim() : "";
|
|
2716
|
+
if (!name) continue;
|
|
2717
|
+
const trigger = name.startsWith("oc_") ? name : `oc_${name}`;
|
|
2718
|
+
commandsToRegister.push({
|
|
2719
|
+
trigger,
|
|
2720
|
+
description: spec.description || `Run skill ${name}`,
|
|
2721
|
+
autoComplete: true,
|
|
2722
|
+
autoCompleteHint: "[args]",
|
|
2723
|
+
originalName: name
|
|
2724
|
+
});
|
|
2725
|
+
}
|
|
2726
|
+
} catch (err) {
|
|
2727
|
+
params.runtime.error?.(`mattermost: failed to list skill commands: ${String(err)}`);
|
|
2728
|
+
}
|
|
2729
|
+
return commandsToRegister;
|
|
2730
|
+
}
|
|
2731
|
+
function dedupeSlashCommands(commands) {
|
|
2732
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2733
|
+
return commands.filter((cmd) => {
|
|
2734
|
+
const key = cmd.trigger.trim();
|
|
2735
|
+
if (!key || seen.has(key)) return false;
|
|
2736
|
+
seen.add(key);
|
|
2737
|
+
return true;
|
|
2738
|
+
});
|
|
2739
|
+
}
|
|
2740
|
+
function buildTriggerMap(commands) {
|
|
2741
|
+
const triggerMap = /* @__PURE__ */ new Map();
|
|
2742
|
+
for (const cmd of commands) if (cmd.originalName) triggerMap.set(cmd.trigger, cmd.originalName);
|
|
2743
|
+
return triggerMap;
|
|
2744
|
+
}
|
|
2745
|
+
function warnOnSuspiciousCallbackUrl(params) {
|
|
2746
|
+
try {
|
|
2747
|
+
const mmHost = new URL(normalizeMattermostBaseUrl(params.baseUrl) ?? params.baseUrl).hostname;
|
|
2748
|
+
const callbackHost = new URL(params.callbackUrl).hostname;
|
|
2749
|
+
if (isLoopbackHost$1(callbackHost) && !isLoopbackHost$1(mmHost)) params.runtime.error?.(`mattermost: slash commands callbackUrl resolved to ${params.callbackUrl} (loopback) while baseUrl is ${params.baseUrl}. This MAY be unreachable depending on your deployment. If native slash commands don't work, set channels.mattermost.commands.callbackUrl to a URL reachable from the Mattermost server (e.g. your public reverse proxy URL).`);
|
|
2750
|
+
} catch {}
|
|
2751
|
+
}
|
|
2752
|
+
async function registerSlashCommandsAcrossTeams(params) {
|
|
2753
|
+
const registered = [];
|
|
2754
|
+
let teamRegistrationFailures = 0;
|
|
2755
|
+
for (const team of params.teams) try {
|
|
2756
|
+
const created = await registerSlashCommands({
|
|
2757
|
+
client: params.client,
|
|
2758
|
+
teamId: team.id,
|
|
2759
|
+
creatorUserId: params.botUserId,
|
|
2760
|
+
callbackUrl: params.callbackUrl,
|
|
2761
|
+
commands: params.commands,
|
|
2762
|
+
log: (msg) => params.runtime.log?.(msg)
|
|
2763
|
+
});
|
|
2764
|
+
registered.push(...created);
|
|
2765
|
+
} catch (err) {
|
|
2766
|
+
teamRegistrationFailures += 1;
|
|
2767
|
+
params.runtime.error?.(`mattermost: failed to register slash commands for team ${team.id}: ${String(err)}`);
|
|
2768
|
+
}
|
|
2769
|
+
return {
|
|
2770
|
+
registered,
|
|
2771
|
+
teamRegistrationFailures
|
|
2772
|
+
};
|
|
2773
|
+
}
|
|
2774
|
+
async function registerMattermostMonitorSlashCommands(params) {
|
|
2775
|
+
const commandsRaw = params.account.config.commands;
|
|
2776
|
+
const slashConfig = resolveSlashCommandConfig(commandsRaw);
|
|
2777
|
+
if (!isSlashCommandsEnabled(slashConfig)) return;
|
|
2778
|
+
try {
|
|
2779
|
+
const teams = await fetchMattermostUserTeams(params.client, params.botUserId);
|
|
2780
|
+
const slashCallbackUrl = resolveCallbackUrl({
|
|
2781
|
+
config: slashConfig,
|
|
2782
|
+
gatewayPort: parseStrictPositiveInteger(process.env.OPENCLAW_GATEWAY_PORT?.trim()) ?? params.cfg.gateway?.port ?? 18789,
|
|
2783
|
+
gatewayHost: params.cfg.gateway?.customBindHost ?? void 0
|
|
2784
|
+
});
|
|
2785
|
+
warnOnSuspiciousCallbackUrl({
|
|
2786
|
+
runtime: params.runtime,
|
|
2787
|
+
baseUrl: params.baseUrl,
|
|
2788
|
+
callbackUrl: slashCallbackUrl
|
|
2789
|
+
});
|
|
2790
|
+
const dedupedCommands = dedupeSlashCommands(buildSlashCommands({
|
|
2791
|
+
cfg: params.cfg,
|
|
2792
|
+
runtime: params.runtime,
|
|
2793
|
+
nativeSkills: slashConfig.nativeSkills === true
|
|
2794
|
+
}));
|
|
2795
|
+
const { registered, teamRegistrationFailures } = await registerSlashCommandsAcrossTeams({
|
|
2796
|
+
client: params.client,
|
|
2797
|
+
teams,
|
|
2798
|
+
botUserId: params.botUserId,
|
|
2799
|
+
callbackUrl: slashCallbackUrl,
|
|
2800
|
+
commands: dedupedCommands,
|
|
2801
|
+
runtime: params.runtime
|
|
2802
|
+
});
|
|
2803
|
+
if (registered.length === 0) {
|
|
2804
|
+
params.runtime.error?.("mattermost: native slash commands enabled but no commands could be registered; keeping slash callbacks inactive");
|
|
2805
|
+
return;
|
|
2806
|
+
}
|
|
2807
|
+
if (teamRegistrationFailures > 0) params.runtime.error?.(`mattermost: slash command registration completed with ${teamRegistrationFailures} team error(s)`);
|
|
2808
|
+
activateSlashCommands({
|
|
2809
|
+
account: params.account,
|
|
2810
|
+
commandTokens: registered.map((cmd) => cmd.token).filter(Boolean),
|
|
2811
|
+
registeredCommands: registered,
|
|
2812
|
+
triggerMap: buildTriggerMap(dedupedCommands),
|
|
2813
|
+
api: {
|
|
2814
|
+
cfg: params.cfg,
|
|
2815
|
+
runtime: params.runtime
|
|
2816
|
+
},
|
|
2817
|
+
log: (msg) => params.runtime.log?.(msg)
|
|
2818
|
+
});
|
|
2819
|
+
params.runtime.log?.(`mattermost: slash commands registered (${registered.length} commands across ${teams.length} teams, callback=${slashCallbackUrl})`);
|
|
2820
|
+
} catch (err) {
|
|
2821
|
+
params.runtime.error?.(`mattermost: failed to register slash commands: ${String(err)}`);
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
//#endregion
|
|
2825
|
+
//#region extensions/mattermost/src/mattermost/monitor-websocket.ts
|
|
2826
|
+
const MattermostEventPayloadSchema = zod_exports.z.object({
|
|
2827
|
+
event: zod_exports.z.string().optional(),
|
|
2828
|
+
data: zod_exports.z.object({
|
|
2829
|
+
post: zod_exports.z.union([zod_exports.z.string(), MattermostPostSchema]).optional(),
|
|
2830
|
+
reaction: zod_exports.z.union([zod_exports.z.string(), zod_exports.z.record(zod_exports.z.string(), zod_exports.z.unknown())]).optional(),
|
|
2831
|
+
channel_id: zod_exports.z.string().optional(),
|
|
2832
|
+
channel_name: zod_exports.z.string().optional(),
|
|
2833
|
+
channel_display_name: zod_exports.z.string().optional(),
|
|
2834
|
+
channel_type: zod_exports.z.string().optional(),
|
|
2835
|
+
sender_name: zod_exports.z.string().optional(),
|
|
2836
|
+
team_id: zod_exports.z.string().optional()
|
|
2837
|
+
}).optional(),
|
|
2838
|
+
broadcast: zod_exports.z.object({
|
|
2839
|
+
channel_id: zod_exports.z.string().optional(),
|
|
2840
|
+
team_id: zod_exports.z.string().optional(),
|
|
2841
|
+
user_id: zod_exports.z.string().optional()
|
|
2842
|
+
}).optional()
|
|
2843
|
+
});
|
|
2844
|
+
function parseMattermostEventPayload(raw) {
|
|
2845
|
+
return safeParseJsonWithSchema(MattermostEventPayloadSchema, raw);
|
|
2846
|
+
}
|
|
2847
|
+
function parseMattermostPost(value) {
|
|
2848
|
+
if (typeof value === "string") return safeParseJsonWithSchema(MattermostPostSchema, value);
|
|
2849
|
+
return safeParseWithSchema(MattermostPostSchema, value);
|
|
2850
|
+
}
|
|
2851
|
+
var WebSocketClosedBeforeOpenError = class extends Error {
|
|
2852
|
+
constructor(code, reason) {
|
|
2853
|
+
super(`websocket closed before open (code ${code})`);
|
|
2854
|
+
this.code = code;
|
|
2855
|
+
this.reason = reason;
|
|
2856
|
+
this.name = "WebSocketClosedBeforeOpenError";
|
|
2857
|
+
}
|
|
2858
|
+
};
|
|
2859
|
+
const defaultMattermostWebSocketFactory = (url) => new WebSocket$1(url);
|
|
2860
|
+
function parsePostedPayload(payload) {
|
|
2861
|
+
if (payload.event !== "posted") return null;
|
|
2862
|
+
const postData = payload.data?.post;
|
|
2863
|
+
if (!postData) return null;
|
|
2864
|
+
const post = parseMattermostPost(postData);
|
|
2865
|
+
if (!post) return null;
|
|
2866
|
+
return {
|
|
2867
|
+
payload,
|
|
2868
|
+
post
|
|
2869
|
+
};
|
|
2870
|
+
}
|
|
2871
|
+
function createMattermostConnectOnce(opts) {
|
|
2872
|
+
const webSocketFactory = opts.webSocketFactory ?? defaultMattermostWebSocketFactory;
|
|
2873
|
+
const healthCheckIntervalMs = opts.healthCheckIntervalMs ?? 3e4;
|
|
2874
|
+
return async () => {
|
|
2875
|
+
const ws = webSocketFactory(opts.wsUrl);
|
|
2876
|
+
const onAbort = () => ws.terminate();
|
|
2877
|
+
opts.abortSignal?.addEventListener("abort", onAbort, { once: true });
|
|
2878
|
+
const getBotUpdateAt = opts.getBotUpdateAt;
|
|
2879
|
+
try {
|
|
2880
|
+
return await new Promise((resolve, reject) => {
|
|
2881
|
+
let opened = false;
|
|
2882
|
+
let settled = false;
|
|
2883
|
+
let healthCheckEnabled = getBotUpdateAt != null;
|
|
2884
|
+
let healthCheckInFlight = false;
|
|
2885
|
+
let healthCheckTimer;
|
|
2886
|
+
let initialUpdateAt;
|
|
2887
|
+
const clearTimers = () => {
|
|
2888
|
+
if (healthCheckTimer !== void 0) {
|
|
2889
|
+
clearTimeout(healthCheckTimer);
|
|
2890
|
+
healthCheckTimer = void 0;
|
|
2891
|
+
}
|
|
2892
|
+
};
|
|
2893
|
+
const stopHealthChecks = () => {
|
|
2894
|
+
healthCheckEnabled = false;
|
|
2895
|
+
clearTimers();
|
|
2896
|
+
};
|
|
2897
|
+
const scheduleHealthCheck = () => {
|
|
2898
|
+
if (!getBotUpdateAt || !healthCheckEnabled || settled || healthCheckInFlight) return;
|
|
2899
|
+
healthCheckTimer = setTimeout(() => {
|
|
2900
|
+
healthCheckTimer = void 0;
|
|
2901
|
+
runHealthCheck();
|
|
2902
|
+
}, healthCheckIntervalMs);
|
|
2903
|
+
};
|
|
2904
|
+
const runHealthCheck = async () => {
|
|
2905
|
+
if (!getBotUpdateAt || !healthCheckEnabled || settled || healthCheckInFlight) return;
|
|
2906
|
+
healthCheckInFlight = true;
|
|
2907
|
+
try {
|
|
2908
|
+
const current = await getBotUpdateAt();
|
|
2909
|
+
if (!healthCheckEnabled || settled) return;
|
|
2910
|
+
if (initialUpdateAt === void 0) {
|
|
2911
|
+
initialUpdateAt = current;
|
|
2912
|
+
return;
|
|
2913
|
+
}
|
|
2914
|
+
if (current !== initialUpdateAt) {
|
|
2915
|
+
opts.runtime.log?.(`mattermost: bot account updated (update_at changed: ${initialUpdateAt} → ${current}) — reconnecting`);
|
|
2916
|
+
stopHealthChecks();
|
|
2917
|
+
ws.terminate();
|
|
2918
|
+
}
|
|
2919
|
+
} catch (err) {
|
|
2920
|
+
if (!healthCheckEnabled || settled) return;
|
|
2921
|
+
const label = initialUpdateAt === void 0 ? "mattermost: failed to get initial update_at" : "mattermost: health check error";
|
|
2922
|
+
opts.runtime.error?.(`${label}: ${String(err)}`);
|
|
2923
|
+
} finally {
|
|
2924
|
+
healthCheckInFlight = false;
|
|
2925
|
+
scheduleHealthCheck();
|
|
2926
|
+
}
|
|
2927
|
+
};
|
|
2928
|
+
const resolveOnce = () => {
|
|
2929
|
+
if (settled) return;
|
|
2930
|
+
settled = true;
|
|
2931
|
+
stopHealthChecks();
|
|
2932
|
+
resolve();
|
|
2933
|
+
};
|
|
2934
|
+
const rejectOnce = (error) => {
|
|
2935
|
+
if (settled) return;
|
|
2936
|
+
settled = true;
|
|
2937
|
+
stopHealthChecks();
|
|
2938
|
+
reject(error);
|
|
2939
|
+
};
|
|
2940
|
+
ws.on("open", () => {
|
|
2941
|
+
opened = true;
|
|
2942
|
+
opts.statusSink?.({
|
|
2943
|
+
connected: true,
|
|
2944
|
+
lastConnectedAt: Date.now(),
|
|
2945
|
+
lastError: null
|
|
2946
|
+
});
|
|
2947
|
+
ws.send(JSON.stringify({
|
|
2948
|
+
seq: opts.nextSeq(),
|
|
2949
|
+
action: "authentication_challenge",
|
|
2950
|
+
data: { token: opts.botToken }
|
|
2951
|
+
}));
|
|
2952
|
+
if (getBotUpdateAt) runHealthCheck();
|
|
2953
|
+
});
|
|
2954
|
+
ws.on("message", async (data) => {
|
|
2955
|
+
const payload = parseMattermostEventPayload(rawDataToString(data));
|
|
2956
|
+
if (!payload) return;
|
|
2957
|
+
if (payload.event === "reaction_added" || payload.event === "reaction_removed") {
|
|
2958
|
+
if (!opts.onReaction) return;
|
|
2959
|
+
try {
|
|
2960
|
+
await opts.onReaction(payload);
|
|
2961
|
+
} catch (err) {
|
|
2962
|
+
opts.runtime.error?.(`mattermost reaction handler failed: ${String(err)}`);
|
|
2963
|
+
}
|
|
2964
|
+
return;
|
|
2965
|
+
}
|
|
2966
|
+
if (payload.event !== "posted") return;
|
|
2967
|
+
const parsed = parsePostedPayload(payload);
|
|
2968
|
+
if (!parsed) return;
|
|
2969
|
+
try {
|
|
2970
|
+
await opts.onPosted(parsed.post, parsed.payload);
|
|
2971
|
+
} catch (err) {
|
|
2972
|
+
opts.runtime.error?.(`mattermost handler failed: ${String(err)}`);
|
|
2973
|
+
}
|
|
2974
|
+
});
|
|
2975
|
+
ws.on("close", (code, reason) => {
|
|
2976
|
+
stopHealthChecks();
|
|
2977
|
+
const message = reasonToString(reason);
|
|
2978
|
+
opts.statusSink?.({
|
|
2979
|
+
connected: false,
|
|
2980
|
+
lastDisconnect: {
|
|
2981
|
+
at: Date.now(),
|
|
2982
|
+
status: code,
|
|
2983
|
+
error: message || void 0
|
|
2984
|
+
}
|
|
2985
|
+
});
|
|
2986
|
+
if (opened) {
|
|
2987
|
+
resolveOnce();
|
|
2988
|
+
return;
|
|
2989
|
+
}
|
|
2990
|
+
rejectOnce(new WebSocketClosedBeforeOpenError(code, message || void 0));
|
|
2991
|
+
});
|
|
2992
|
+
ws.on("error", (err) => {
|
|
2993
|
+
opts.runtime.error?.(`mattermost websocket error: ${String(err)}`);
|
|
2994
|
+
opts.statusSink?.({ lastError: String(err) });
|
|
2995
|
+
try {
|
|
2996
|
+
ws.close();
|
|
2997
|
+
} catch {}
|
|
2998
|
+
});
|
|
2999
|
+
});
|
|
3000
|
+
} finally {
|
|
3001
|
+
opts.abortSignal?.removeEventListener("abort", onAbort);
|
|
3002
|
+
}
|
|
3003
|
+
};
|
|
3004
|
+
}
|
|
3005
|
+
function reasonToString(reason) {
|
|
3006
|
+
if (!reason) return "";
|
|
3007
|
+
if (typeof reason === "string") return reason;
|
|
3008
|
+
return reason.length > 0 ? reason.toString("utf8") : "";
|
|
3009
|
+
}
|
|
3010
|
+
//#endregion
|
|
3011
|
+
//#region extensions/mattermost/src/mattermost/reconnect.ts
|
|
3012
|
+
/**
|
|
3013
|
+
* Reconnection loop with exponential backoff.
|
|
3014
|
+
*
|
|
3015
|
+
* Calls `connectFn` in a while loop. On normal resolve (connection closed),
|
|
3016
|
+
* the backoff resets. On thrown error (connection failed), the current delay is
|
|
3017
|
+
* used, then doubled for the next retry.
|
|
3018
|
+
* The loop exits when `abortSignal` fires.
|
|
3019
|
+
*/
|
|
3020
|
+
async function runWithReconnect(connectFn, opts = {}) {
|
|
3021
|
+
const { initialDelayMs = 2e3, maxDelayMs = 6e4 } = opts;
|
|
3022
|
+
const jitterRatio = Math.max(0, opts.jitterRatio ?? 0);
|
|
3023
|
+
const random = opts.random ?? Math.random;
|
|
3024
|
+
let retryDelay = initialDelayMs;
|
|
3025
|
+
let attempt = 0;
|
|
3026
|
+
while (!opts.abortSignal?.aborted) {
|
|
3027
|
+
let shouldIncreaseDelay = false;
|
|
3028
|
+
let outcome = "resolved";
|
|
3029
|
+
let error;
|
|
3030
|
+
try {
|
|
3031
|
+
await connectFn();
|
|
3032
|
+
retryDelay = initialDelayMs;
|
|
3033
|
+
} catch (err) {
|
|
3034
|
+
if (opts.abortSignal?.aborted) return;
|
|
3035
|
+
outcome = "rejected";
|
|
3036
|
+
error = err;
|
|
3037
|
+
opts.onError?.(err);
|
|
3038
|
+
shouldIncreaseDelay = true;
|
|
3039
|
+
}
|
|
3040
|
+
if (opts.abortSignal?.aborted) return;
|
|
3041
|
+
const delayMs = withJitter(retryDelay, jitterRatio, random);
|
|
3042
|
+
if (!(opts.shouldReconnect?.({
|
|
3043
|
+
attempt,
|
|
3044
|
+
delayMs,
|
|
3045
|
+
outcome,
|
|
3046
|
+
error
|
|
3047
|
+
}) ?? true)) return;
|
|
3048
|
+
opts.onReconnect?.(delayMs);
|
|
3049
|
+
await sleepAbortable(delayMs, opts.abortSignal);
|
|
3050
|
+
if (shouldIncreaseDelay) retryDelay = Math.min(retryDelay * 2, maxDelayMs);
|
|
3051
|
+
attempt++;
|
|
3052
|
+
}
|
|
3053
|
+
}
|
|
3054
|
+
function withJitter(baseMs, jitterRatio, random) {
|
|
3055
|
+
if (jitterRatio <= 0) return baseMs;
|
|
3056
|
+
const normalized = Math.max(0, Math.min(1, random()));
|
|
3057
|
+
const spread = baseMs * jitterRatio;
|
|
3058
|
+
return Math.max(1, Math.round(baseMs - spread + normalized * spread * 2));
|
|
3059
|
+
}
|
|
3060
|
+
function sleepAbortable(ms, signal) {
|
|
3061
|
+
return new Promise((resolve) => {
|
|
3062
|
+
if (signal?.aborted) {
|
|
3063
|
+
resolve();
|
|
3064
|
+
return;
|
|
3065
|
+
}
|
|
3066
|
+
const onAbort = () => {
|
|
3067
|
+
clearTimeout(timer);
|
|
3068
|
+
resolve();
|
|
3069
|
+
};
|
|
3070
|
+
const timer = setTimeout(() => {
|
|
3071
|
+
signal?.removeEventListener("abort", onAbort);
|
|
3072
|
+
resolve();
|
|
3073
|
+
}, ms);
|
|
3074
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
3075
|
+
});
|
|
3076
|
+
}
|
|
3077
|
+
//#endregion
|
|
3078
|
+
//#region extensions/mattermost/src/mattermost/monitor.ts
|
|
3079
|
+
const RECENT_MATTERMOST_MESSAGE_TTL_MS = 5 * 6e4;
|
|
3080
|
+
const RECENT_MATTERMOST_MESSAGE_MAX = 2e3;
|
|
3081
|
+
function isLoopbackHost(hostname) {
|
|
3082
|
+
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1";
|
|
3083
|
+
}
|
|
3084
|
+
function normalizeInteractionSourceIps(values) {
|
|
3085
|
+
return (values ?? []).map((value) => value.trim()).filter(Boolean);
|
|
3086
|
+
}
|
|
3087
|
+
const recentInboundMessages = createDedupeCache({
|
|
3088
|
+
ttlMs: RECENT_MATTERMOST_MESSAGE_TTL_MS,
|
|
3089
|
+
maxSize: RECENT_MATTERMOST_MESSAGE_MAX
|
|
3090
|
+
});
|
|
3091
|
+
function resolveRuntime(opts) {
|
|
3092
|
+
return opts.runtime ?? {
|
|
3093
|
+
log: console.log,
|
|
3094
|
+
error: console.error,
|
|
3095
|
+
exit: (code) => {
|
|
3096
|
+
throw new Error(`exit ${code}`);
|
|
3097
|
+
}
|
|
3098
|
+
};
|
|
3099
|
+
}
|
|
3100
|
+
function isSystemPost(post) {
|
|
3101
|
+
const type = post.type?.trim();
|
|
3102
|
+
return Boolean(type);
|
|
3103
|
+
}
|
|
3104
|
+
function channelChatType(kind) {
|
|
3105
|
+
if (kind === "direct") return "direct";
|
|
3106
|
+
if (kind === "group") return "group";
|
|
3107
|
+
return "channel";
|
|
3108
|
+
}
|
|
3109
|
+
function resolveMattermostReplyRootId(params) {
|
|
3110
|
+
const threadRootId = params.threadRootId?.trim();
|
|
3111
|
+
if (threadRootId) return threadRootId;
|
|
3112
|
+
return params.replyToId?.trim() || void 0;
|
|
3113
|
+
}
|
|
3114
|
+
function resolveMattermostEffectiveReplyToId(params) {
|
|
3115
|
+
const threadRootId = params.threadRootId?.trim();
|
|
3116
|
+
if (threadRootId && params.replyToMode !== "off") return threadRootId;
|
|
3117
|
+
if (params.kind === "direct") return;
|
|
3118
|
+
const postId = params.postId?.trim();
|
|
3119
|
+
if (!postId) return;
|
|
3120
|
+
return params.replyToMode === "all" || params.replyToMode === "first" ? postId : void 0;
|
|
3121
|
+
}
|
|
3122
|
+
function resolveMattermostThreadSessionContext(params) {
|
|
3123
|
+
const effectiveReplyToId = resolveMattermostEffectiveReplyToId({
|
|
3124
|
+
kind: params.kind,
|
|
3125
|
+
postId: params.postId,
|
|
3126
|
+
replyToMode: params.replyToMode,
|
|
3127
|
+
threadRootId: params.threadRootId
|
|
3128
|
+
});
|
|
3129
|
+
const threadKeys = resolveThreadSessionKeys({
|
|
3130
|
+
baseSessionKey: params.baseSessionKey,
|
|
3131
|
+
threadId: effectiveReplyToId,
|
|
3132
|
+
parentSessionKey: effectiveReplyToId ? params.baseSessionKey : void 0
|
|
3133
|
+
});
|
|
3134
|
+
return {
|
|
3135
|
+
effectiveReplyToId,
|
|
3136
|
+
sessionKey: threadKeys.sessionKey,
|
|
3137
|
+
parentSessionKey: threadKeys.parentSessionKey
|
|
3138
|
+
};
|
|
3139
|
+
}
|
|
3140
|
+
function resolveMattermostReactionChannelId(payload) {
|
|
3141
|
+
return payload.broadcast?.channel_id?.trim() || payload.data?.channel_id?.trim() || void 0;
|
|
3142
|
+
}
|
|
3143
|
+
function buildMattermostAttachmentPlaceholder(mediaList) {
|
|
3144
|
+
if (mediaList.length === 0) return "";
|
|
3145
|
+
if (mediaList.length === 1) return `<media:${mediaList[0].kind === "unknown" ? "document" : mediaList[0].kind}>`;
|
|
3146
|
+
const allImages = mediaList.every((media) => media.kind === "image");
|
|
3147
|
+
const label = allImages ? "image" : "file";
|
|
3148
|
+
const suffix = mediaList.length === 1 ? label : `${label}s`;
|
|
3149
|
+
return `${allImages ? "<media:image>" : "<media:document>"} (${mediaList.length} ${suffix})`;
|
|
3150
|
+
}
|
|
3151
|
+
function buildMattermostWsUrl(baseUrl) {
|
|
3152
|
+
const normalized = normalizeMattermostBaseUrl(baseUrl);
|
|
3153
|
+
if (!normalized) throw new Error("Mattermost baseUrl is required");
|
|
3154
|
+
return `${normalized.replace(/^http/i, "ws")}/api/v4/websocket`;
|
|
3155
|
+
}
|
|
3156
|
+
async function monitorMattermostProvider(opts = {}) {
|
|
3157
|
+
const core = getMattermostRuntime();
|
|
3158
|
+
const runtime = resolveRuntime(opts);
|
|
3159
|
+
const cfg = opts.config ?? core.config.loadConfig();
|
|
3160
|
+
const account = resolveMattermostAccount({
|
|
3161
|
+
cfg,
|
|
3162
|
+
accountId: opts.accountId
|
|
3163
|
+
});
|
|
3164
|
+
const pairing = createChannelPairingController({
|
|
3165
|
+
core,
|
|
3166
|
+
channel: "mattermost",
|
|
3167
|
+
accountId: account.accountId
|
|
3168
|
+
});
|
|
3169
|
+
const allowNameMatching = isDangerousNameMatchingEnabled(account.config);
|
|
3170
|
+
const botToken = opts.botToken?.trim() || account.botToken?.trim();
|
|
3171
|
+
if (!botToken) throw new Error(`Mattermost bot token missing for account "${account.accountId}" (set channels.mattermost.accounts.${account.accountId}.botToken or MATTERMOST_BOT_TOKEN for default).`);
|
|
3172
|
+
const baseUrl = normalizeMattermostBaseUrl(opts.baseUrl ?? account.baseUrl);
|
|
3173
|
+
if (!baseUrl) throw new Error(`Mattermost baseUrl missing for account "${account.accountId}" (set channels.mattermost.accounts.${account.accountId}.baseUrl or MATTERMOST_URL for default).`);
|
|
3174
|
+
const client = createMattermostClient({
|
|
3175
|
+
baseUrl,
|
|
3176
|
+
botToken,
|
|
3177
|
+
allowPrivateNetwork: account.config?.allowPrivateNetwork === true
|
|
3178
|
+
});
|
|
3179
|
+
let botUser;
|
|
3180
|
+
await runWithReconnect(async () => {
|
|
3181
|
+
botUser = await fetchMattermostMe(client);
|
|
3182
|
+
}, {
|
|
3183
|
+
abortSignal: opts.abortSignal,
|
|
3184
|
+
jitterRatio: .2,
|
|
3185
|
+
shouldReconnect: ({ outcome }) => outcome === "rejected",
|
|
3186
|
+
onError: (err) => {
|
|
3187
|
+
runtime.error?.(`mattermost: API auth failed: ${String(err)}`);
|
|
3188
|
+
opts.statusSink?.({
|
|
3189
|
+
lastError: String(err),
|
|
3190
|
+
connected: false
|
|
3191
|
+
});
|
|
3192
|
+
},
|
|
3193
|
+
onReconnect: (delayMs) => {
|
|
3194
|
+
runtime.log?.(`mattermost: API not accessible, retrying in ${Math.round(delayMs / 1e3)}s`);
|
|
3195
|
+
}
|
|
3196
|
+
});
|
|
3197
|
+
if (opts.abortSignal?.aborted) return;
|
|
3198
|
+
const botUserId = botUser.id;
|
|
3199
|
+
const botUsername = botUser.username?.trim() || void 0;
|
|
3200
|
+
runtime.log?.(`mattermost connected as ${botUsername ? `@${botUsername}` : botUserId}`);
|
|
3201
|
+
await registerMattermostMonitorSlashCommands({
|
|
3202
|
+
client,
|
|
3203
|
+
cfg,
|
|
3204
|
+
runtime,
|
|
3205
|
+
account,
|
|
3206
|
+
baseUrl,
|
|
3207
|
+
botUserId
|
|
3208
|
+
});
|
|
3209
|
+
const slashEnabled = getSlashCommandState(account.accountId) != null;
|
|
3210
|
+
setInteractionSecret(account.accountId, botToken);
|
|
3211
|
+
const interactionPath = resolveInteractionCallbackPath(account.accountId);
|
|
3212
|
+
const callbackUrl = computeInteractionCallbackUrl(account.accountId, {
|
|
3213
|
+
gateway: cfg.gateway,
|
|
3214
|
+
interactions: account.config.interactions
|
|
3215
|
+
});
|
|
3216
|
+
setInteractionCallbackUrl(account.accountId, callbackUrl);
|
|
3217
|
+
const allowedInteractionSourceIps = normalizeInteractionSourceIps(account.config.interactions?.allowedSourceIps);
|
|
3218
|
+
try {
|
|
3219
|
+
const mmHost = new URL(baseUrl).hostname;
|
|
3220
|
+
const callbackHost = new URL(callbackUrl).hostname;
|
|
3221
|
+
if (isLoopbackHost(callbackHost) && !isLoopbackHost(mmHost)) runtime.error?.(`mattermost: interactions callbackUrl resolved to ${callbackUrl} (loopback) while baseUrl is ${baseUrl}. This MAY be unreachable depending on your deployment. If button clicks don't work, set channels.mattermost.interactions.callbackBaseUrl to a URL reachable from the Mattermost server (e.g. your public reverse proxy URL).`);
|
|
3222
|
+
if (!isLoopbackHost(callbackHost) && allowedInteractionSourceIps.length === 0) runtime.error?.(`mattermost: interactions callbackUrl resolved to ${callbackUrl} without channels.mattermost.interactions.allowedSourceIps. For safety, non-loopback callback sources will be rejected until you allowlist the Mattermost server or trusted ingress IPs.`);
|
|
3223
|
+
} catch {}
|
|
3224
|
+
const effectiveInteractionSourceIps = allowedInteractionSourceIps.length > 0 ? allowedInteractionSourceIps : ["127.0.0.1", "::1"];
|
|
3225
|
+
const unregisterInteractions = registerPluginHttpRoute({
|
|
3226
|
+
path: interactionPath,
|
|
3227
|
+
fallbackPath: "/mattermost/interactions/default",
|
|
3228
|
+
auth: "plugin",
|
|
3229
|
+
handler: createMattermostInteractionHandler({
|
|
3230
|
+
client,
|
|
3231
|
+
botUserId,
|
|
3232
|
+
accountId: account.accountId,
|
|
3233
|
+
allowedSourceIps: effectiveInteractionSourceIps,
|
|
3234
|
+
trustedProxies: cfg.gateway?.trustedProxies,
|
|
3235
|
+
allowRealIpFallback: cfg.gateway?.allowRealIpFallback === true,
|
|
3236
|
+
handleInteraction: handleModelPickerInteraction,
|
|
3237
|
+
authorizeButtonClick: async ({ payload, post }) => {
|
|
3238
|
+
const channelInfo = await resolveChannelInfo(payload.channel_id);
|
|
3239
|
+
const isDirect = channelInfo?.type?.trim().toUpperCase() === "D";
|
|
3240
|
+
const allowTextCommands = core.channel.commands.shouldHandleTextCommands({
|
|
3241
|
+
cfg,
|
|
3242
|
+
surface: "mattermost"
|
|
3243
|
+
});
|
|
3244
|
+
const decision = authorizeMattermostCommandInvocation({
|
|
3245
|
+
account,
|
|
3246
|
+
cfg,
|
|
3247
|
+
senderId: payload.user_id,
|
|
3248
|
+
senderName: payload.user_name ?? "",
|
|
3249
|
+
channelId: payload.channel_id,
|
|
3250
|
+
channelInfo,
|
|
3251
|
+
storeAllowFrom: isDirect ? await readStoreAllowFromForDmPolicy({
|
|
3252
|
+
provider: "mattermost",
|
|
3253
|
+
accountId: account.accountId,
|
|
3254
|
+
dmPolicy: account.config.dmPolicy ?? "pairing",
|
|
3255
|
+
readStore: pairing.readStoreForDmPolicy
|
|
3256
|
+
}) : void 0,
|
|
3257
|
+
allowTextCommands,
|
|
3258
|
+
hasControlCommand: false
|
|
3259
|
+
});
|
|
3260
|
+
if (decision.ok) return { ok: true };
|
|
3261
|
+
return {
|
|
3262
|
+
ok: false,
|
|
3263
|
+
response: {
|
|
3264
|
+
update: {
|
|
3265
|
+
message: post.message ?? "",
|
|
3266
|
+
props: post.props ?? void 0
|
|
3267
|
+
},
|
|
3268
|
+
ephemeral_text: `OpenClaw ignored this action for ${decision.roomLabel}.`
|
|
3269
|
+
}
|
|
3270
|
+
};
|
|
3271
|
+
},
|
|
3272
|
+
resolveSessionKey: async ({ channelId, userId, post }) => {
|
|
3273
|
+
const channelInfo = await resolveChannelInfo(channelId);
|
|
3274
|
+
const kind = mapMattermostChannelTypeToChatType(channelInfo?.type);
|
|
3275
|
+
const teamId = channelInfo?.team_id ?? void 0;
|
|
3276
|
+
const route = core.channel.routing.resolveAgentRoute({
|
|
3277
|
+
cfg,
|
|
3278
|
+
channel: "mattermost",
|
|
3279
|
+
accountId: account.accountId,
|
|
3280
|
+
teamId,
|
|
3281
|
+
peer: {
|
|
3282
|
+
kind,
|
|
3283
|
+
id: kind === "direct" ? userId : channelId
|
|
3284
|
+
}
|
|
3285
|
+
});
|
|
3286
|
+
const replyToMode = resolveMattermostReplyToMode(account, kind);
|
|
3287
|
+
return resolveMattermostThreadSessionContext({
|
|
3288
|
+
baseSessionKey: route.sessionKey,
|
|
3289
|
+
kind,
|
|
3290
|
+
postId: post.id || void 0,
|
|
3291
|
+
replyToMode,
|
|
3292
|
+
threadRootId: post.root_id
|
|
3293
|
+
}).sessionKey;
|
|
3294
|
+
},
|
|
3295
|
+
dispatchButtonClick: async (opts) => {
|
|
3296
|
+
const channelInfo = await resolveChannelInfo(opts.channelId);
|
|
3297
|
+
const kind = mapMattermostChannelTypeToChatType(channelInfo?.type);
|
|
3298
|
+
const chatType = channelChatType(kind);
|
|
3299
|
+
const teamId = channelInfo?.team_id ?? void 0;
|
|
3300
|
+
const channelName = channelInfo?.name ?? void 0;
|
|
3301
|
+
const channelDisplay = channelInfo?.display_name ?? channelName ?? opts.channelId;
|
|
3302
|
+
const route = core.channel.routing.resolveAgentRoute({
|
|
3303
|
+
cfg,
|
|
3304
|
+
channel: "mattermost",
|
|
3305
|
+
accountId: account.accountId,
|
|
3306
|
+
teamId,
|
|
3307
|
+
peer: {
|
|
3308
|
+
kind,
|
|
3309
|
+
id: kind === "direct" ? opts.userId : opts.channelId
|
|
3310
|
+
}
|
|
3311
|
+
});
|
|
3312
|
+
const replyToMode = resolveMattermostReplyToMode(account, kind);
|
|
3313
|
+
const threadContext = resolveMattermostThreadSessionContext({
|
|
3314
|
+
baseSessionKey: route.sessionKey,
|
|
3315
|
+
kind,
|
|
3316
|
+
postId: opts.post.id || opts.postId,
|
|
3317
|
+
replyToMode,
|
|
3318
|
+
threadRootId: opts.post.root_id
|
|
3319
|
+
});
|
|
3320
|
+
const to = kind === "direct" ? `user:${opts.userId}` : `channel:${opts.channelId}`;
|
|
3321
|
+
const bodyText = `[Button click: user @${opts.userName} selected "${opts.actionName}"]`;
|
|
3322
|
+
const ctxPayload = core.channel.reply.finalizeInboundContext({
|
|
3323
|
+
Body: bodyText,
|
|
3324
|
+
BodyForAgent: bodyText,
|
|
3325
|
+
RawBody: bodyText,
|
|
3326
|
+
CommandBody: bodyText,
|
|
3327
|
+
From: kind === "direct" ? `mattermost:${opts.userId}` : kind === "group" ? `mattermost:group:${opts.channelId}` : `mattermost:channel:${opts.channelId}`,
|
|
3328
|
+
To: to,
|
|
3329
|
+
SessionKey: threadContext.sessionKey,
|
|
3330
|
+
ParentSessionKey: threadContext.parentSessionKey,
|
|
3331
|
+
AccountId: route.accountId,
|
|
3332
|
+
ChatType: chatType,
|
|
3333
|
+
ConversationLabel: `mattermost:${opts.userName}`,
|
|
3334
|
+
GroupSubject: kind !== "direct" ? channelDisplay : void 0,
|
|
3335
|
+
GroupChannel: channelName ? `#${channelName}` : void 0,
|
|
3336
|
+
GroupSpace: teamId,
|
|
3337
|
+
SenderName: opts.userName,
|
|
3338
|
+
SenderId: opts.userId,
|
|
3339
|
+
Provider: "mattermost",
|
|
3340
|
+
Surface: "mattermost",
|
|
3341
|
+
MessageSid: `interaction:${opts.postId}:${opts.actionId}`,
|
|
3342
|
+
ReplyToId: threadContext.effectiveReplyToId,
|
|
3343
|
+
MessageThreadId: threadContext.effectiveReplyToId,
|
|
3344
|
+
WasMentioned: true,
|
|
3345
|
+
CommandAuthorized: false,
|
|
3346
|
+
OriginatingChannel: "mattermost",
|
|
3347
|
+
OriginatingTo: to
|
|
3348
|
+
});
|
|
3349
|
+
const textLimit = core.channel.text.resolveTextChunkLimit(cfg, "mattermost", account.accountId, { fallbackLimit: account.textChunkLimit ?? 4e3 });
|
|
3350
|
+
const tableMode = core.channel.text.resolveMarkdownTableMode({
|
|
3351
|
+
cfg,
|
|
3352
|
+
channel: "mattermost",
|
|
3353
|
+
accountId: account.accountId
|
|
3354
|
+
});
|
|
3355
|
+
const { onModelSelected, typingCallbacks, ...replyPipeline } = createChannelReplyPipeline({
|
|
3356
|
+
cfg,
|
|
3357
|
+
agentId: route.agentId,
|
|
3358
|
+
channel: "mattermost",
|
|
3359
|
+
accountId: account.accountId,
|
|
3360
|
+
typing: {
|
|
3361
|
+
start: () => sendTypingIndicator(opts.channelId, threadContext.effectiveReplyToId),
|
|
3362
|
+
onStartError: (err) => {
|
|
3363
|
+
logTypingFailure({
|
|
3364
|
+
log: (message) => logger.debug?.(message),
|
|
3365
|
+
channel: "mattermost",
|
|
3366
|
+
target: opts.channelId,
|
|
3367
|
+
error: err
|
|
3368
|
+
});
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3371
|
+
});
|
|
3372
|
+
const { dispatcher, replyOptions, markDispatchIdle } = core.channel.reply.createReplyDispatcherWithTyping({
|
|
3373
|
+
...replyPipeline,
|
|
3374
|
+
humanDelay: core.channel.reply.resolveHumanDelayConfig(cfg, route.agentId),
|
|
3375
|
+
deliver: async (payload) => {
|
|
3376
|
+
await deliverMattermostReplyPayload({
|
|
3377
|
+
core,
|
|
3378
|
+
cfg,
|
|
3379
|
+
payload,
|
|
3380
|
+
to,
|
|
3381
|
+
accountId: account.accountId,
|
|
3382
|
+
agentId: route.agentId,
|
|
3383
|
+
replyToId: resolveMattermostReplyRootId({
|
|
3384
|
+
threadRootId: threadContext.effectiveReplyToId,
|
|
3385
|
+
replyToId: payload.replyToId
|
|
3386
|
+
}),
|
|
3387
|
+
textLimit,
|
|
3388
|
+
tableMode,
|
|
3389
|
+
sendMessage: sendMessageMattermost
|
|
3390
|
+
});
|
|
3391
|
+
runtime.log?.(`delivered button-click reply to ${to}`);
|
|
3392
|
+
},
|
|
3393
|
+
onError: (err, info) => {
|
|
3394
|
+
runtime.error?.(`mattermost button-click ${info.kind} reply failed: ${String(err)}`);
|
|
3395
|
+
},
|
|
3396
|
+
onReplyStart: typingCallbacks?.onReplyStart
|
|
3397
|
+
});
|
|
3398
|
+
await core.channel.reply.dispatchReplyFromConfig({
|
|
3399
|
+
ctx: ctxPayload,
|
|
3400
|
+
cfg,
|
|
3401
|
+
dispatcher,
|
|
3402
|
+
replyOptions: {
|
|
3403
|
+
...replyOptions,
|
|
3404
|
+
disableBlockStreaming: typeof account.blockStreaming === "boolean" ? !account.blockStreaming : void 0,
|
|
3405
|
+
onModelSelected
|
|
3406
|
+
}
|
|
3407
|
+
});
|
|
3408
|
+
markDispatchIdle();
|
|
3409
|
+
},
|
|
3410
|
+
log: (msg) => runtime.log?.(msg)
|
|
3411
|
+
}),
|
|
3412
|
+
pluginId: "mattermost",
|
|
3413
|
+
source: "mattermost-interactions",
|
|
3414
|
+
accountId: account.accountId,
|
|
3415
|
+
log: (msg) => runtime.log?.(msg)
|
|
3416
|
+
});
|
|
3417
|
+
const logger = core.logging.getChildLogger({ module: "mattermost" });
|
|
3418
|
+
const logVerboseMessage = (message) => {
|
|
3419
|
+
if (!core.logging.shouldLogVerbose()) return;
|
|
3420
|
+
logger.debug?.(message);
|
|
3421
|
+
};
|
|
3422
|
+
const mediaMaxBytes = resolveChannelMediaMaxBytes({
|
|
3423
|
+
cfg,
|
|
3424
|
+
resolveChannelLimitMb: () => void 0,
|
|
3425
|
+
accountId: account.accountId
|
|
3426
|
+
}) ?? 8 * 1024 * 1024;
|
|
3427
|
+
const historyLimit = Math.max(0, cfg.messages?.groupChat?.historyLimit ?? 50);
|
|
3428
|
+
const channelHistories = /* @__PURE__ */ new Map();
|
|
3429
|
+
const defaultGroupPolicy = resolveDefaultGroupPolicy(cfg);
|
|
3430
|
+
const { groupPolicy, providerMissingFallbackApplied } = resolveAllowlistProviderRuntimeGroupPolicy({
|
|
3431
|
+
providerConfigPresent: cfg.channels?.mattermost !== void 0,
|
|
3432
|
+
groupPolicy: account.config.groupPolicy,
|
|
3433
|
+
defaultGroupPolicy
|
|
3434
|
+
});
|
|
3435
|
+
warnMissingProviderGroupPolicyFallbackOnce({
|
|
3436
|
+
providerMissingFallbackApplied,
|
|
3437
|
+
providerKey: "mattermost",
|
|
3438
|
+
accountId: account.accountId,
|
|
3439
|
+
log: (message) => logVerboseMessage(message)
|
|
3440
|
+
});
|
|
3441
|
+
const { resolveMattermostMedia, sendTypingIndicator, resolveChannelInfo, resolveUserInfo, updateModelPickerPost } = createMattermostMonitorResources({
|
|
3442
|
+
accountId: account.accountId,
|
|
3443
|
+
callbackUrl,
|
|
3444
|
+
client,
|
|
3445
|
+
logger: { debug: (message) => logger.debug?.(String(message)) },
|
|
3446
|
+
mediaMaxBytes,
|
|
3447
|
+
fetchRemoteMedia: (params) => core.channel.media.fetchRemoteMedia(params),
|
|
3448
|
+
saveMediaBuffer: (buffer, contentType, direction, maxBytes) => core.channel.media.saveMediaBuffer(Buffer.from(buffer), contentType, direction, maxBytes),
|
|
3449
|
+
mediaKindFromMime: (contentType) => core.media.mediaKindFromMime(contentType)
|
|
3450
|
+
});
|
|
3451
|
+
const runModelPickerCommand = async (params) => {
|
|
3452
|
+
const to = params.kind === "direct" ? `user:${params.senderId}` : `channel:${params.channelId}`;
|
|
3453
|
+
const fromLabel = params.kind === "direct" ? `Mattermost DM from ${params.senderName}` : `Mattermost message in ${params.roomLabel} from ${params.senderName}`;
|
|
3454
|
+
const ctxPayload = core.channel.reply.finalizeInboundContext({
|
|
3455
|
+
Body: params.commandText,
|
|
3456
|
+
BodyForAgent: params.commandText,
|
|
3457
|
+
RawBody: params.commandText,
|
|
3458
|
+
CommandBody: params.commandText,
|
|
3459
|
+
From: params.kind === "direct" ? `mattermost:${params.senderId}` : params.kind === "group" ? `mattermost:group:${params.channelId}` : `mattermost:channel:${params.channelId}`,
|
|
3460
|
+
To: to,
|
|
3461
|
+
SessionKey: params.sessionKey,
|
|
3462
|
+
ParentSessionKey: params.parentSessionKey,
|
|
3463
|
+
AccountId: params.route.accountId,
|
|
3464
|
+
ChatType: params.chatType,
|
|
3465
|
+
ConversationLabel: fromLabel,
|
|
3466
|
+
GroupSubject: params.kind !== "direct" ? params.channelDisplay || params.roomLabel : void 0,
|
|
3467
|
+
GroupChannel: params.channelName ? `#${params.channelName}` : void 0,
|
|
3468
|
+
GroupSpace: params.teamId,
|
|
3469
|
+
SenderName: params.senderName,
|
|
3470
|
+
SenderId: params.senderId,
|
|
3471
|
+
Provider: "mattermost",
|
|
3472
|
+
Surface: "mattermost",
|
|
3473
|
+
MessageSid: `interaction:${params.postId}:${Date.now()}`,
|
|
3474
|
+
ReplyToId: params.effectiveReplyToId,
|
|
3475
|
+
MessageThreadId: params.effectiveReplyToId,
|
|
3476
|
+
Timestamp: Date.now(),
|
|
3477
|
+
WasMentioned: true,
|
|
3478
|
+
CommandAuthorized: params.commandAuthorized,
|
|
3479
|
+
CommandSource: "native",
|
|
3480
|
+
OriginatingChannel: "mattermost",
|
|
3481
|
+
OriginatingTo: to
|
|
3482
|
+
});
|
|
3483
|
+
const tableMode = core.channel.text.resolveMarkdownTableMode({
|
|
3484
|
+
cfg,
|
|
3485
|
+
channel: "mattermost",
|
|
3486
|
+
accountId: account.accountId
|
|
3487
|
+
});
|
|
3488
|
+
const textLimit = core.channel.text.resolveTextChunkLimit(cfg, "mattermost", account.accountId, { fallbackLimit: account.textChunkLimit ?? 4e3 });
|
|
3489
|
+
const shouldDeliverReplies = params.deliverReplies === true;
|
|
3490
|
+
const { onModelSelected, typingCallbacks, ...replyPipeline } = createChannelReplyPipeline({
|
|
3491
|
+
cfg,
|
|
3492
|
+
agentId: params.route.agentId,
|
|
3493
|
+
channel: "mattermost",
|
|
3494
|
+
accountId: account.accountId,
|
|
3495
|
+
typing: shouldDeliverReplies ? {
|
|
3496
|
+
start: () => sendTypingIndicator(params.channelId, params.effectiveReplyToId),
|
|
3497
|
+
onStartError: (err) => {
|
|
3498
|
+
logTypingFailure({
|
|
3499
|
+
log: (message) => logger.debug?.(message),
|
|
3500
|
+
channel: "mattermost",
|
|
3501
|
+
target: params.channelId,
|
|
3502
|
+
error: err
|
|
3503
|
+
});
|
|
3504
|
+
}
|
|
3505
|
+
} : void 0
|
|
3506
|
+
});
|
|
3507
|
+
const capturedTexts = [];
|
|
3508
|
+
const { dispatcher, replyOptions, markDispatchIdle } = core.channel.reply.createReplyDispatcherWithTyping({
|
|
3509
|
+
...replyPipeline,
|
|
3510
|
+
deliver: async (payload) => {
|
|
3511
|
+
const trimmedPayload = {
|
|
3512
|
+
...payload,
|
|
3513
|
+
text: core.channel.text.convertMarkdownTables(payload.text ?? "", tableMode).trim()
|
|
3514
|
+
};
|
|
3515
|
+
if (!shouldDeliverReplies) {
|
|
3516
|
+
if (trimmedPayload.text) capturedTexts.push(trimmedPayload.text);
|
|
3517
|
+
return;
|
|
3518
|
+
}
|
|
3519
|
+
await deliverMattermostReplyPayload({
|
|
3520
|
+
core,
|
|
3521
|
+
cfg,
|
|
3522
|
+
payload: trimmedPayload,
|
|
3523
|
+
to,
|
|
3524
|
+
accountId: account.accountId,
|
|
3525
|
+
agentId: params.route.agentId,
|
|
3526
|
+
replyToId: resolveMattermostReplyRootId({
|
|
3527
|
+
threadRootId: params.effectiveReplyToId,
|
|
3528
|
+
replyToId: trimmedPayload.replyToId
|
|
3529
|
+
}),
|
|
3530
|
+
textLimit,
|
|
3531
|
+
tableMode: "off",
|
|
3532
|
+
sendMessage: sendMessageMattermost
|
|
3533
|
+
});
|
|
3534
|
+
},
|
|
3535
|
+
onError: (err, info) => {
|
|
3536
|
+
runtime.error?.(`mattermost model picker ${info.kind} reply failed: ${String(err)}`);
|
|
3537
|
+
},
|
|
3538
|
+
onReplyStart: typingCallbacks?.onReplyStart
|
|
3539
|
+
});
|
|
3540
|
+
await core.channel.reply.withReplyDispatcher({
|
|
3541
|
+
dispatcher,
|
|
3542
|
+
onSettled: () => {
|
|
3543
|
+
markDispatchIdle();
|
|
3544
|
+
},
|
|
3545
|
+
run: () => core.channel.reply.dispatchReplyFromConfig({
|
|
3546
|
+
ctx: ctxPayload,
|
|
3547
|
+
cfg,
|
|
3548
|
+
dispatcher,
|
|
3549
|
+
replyOptions: {
|
|
3550
|
+
...replyOptions,
|
|
3551
|
+
disableBlockStreaming: typeof account.blockStreaming === "boolean" ? !account.blockStreaming : void 0,
|
|
3552
|
+
onModelSelected
|
|
3553
|
+
}
|
|
3554
|
+
})
|
|
3555
|
+
});
|
|
3556
|
+
return capturedTexts.join("\n\n").trim();
|
|
3557
|
+
};
|
|
3558
|
+
async function handleModelPickerInteraction(params) {
|
|
3559
|
+
const pickerState = parseMattermostModelPickerContext(params.context);
|
|
3560
|
+
if (!pickerState) return null;
|
|
3561
|
+
if (pickerState.ownerUserId !== params.payload.user_id) return { ephemeral_text: "Only the person who opened this picker can use it." };
|
|
3562
|
+
const channelInfo = await resolveChannelInfo(params.payload.channel_id);
|
|
3563
|
+
const pickerCommandText = pickerState.action === "select" ? `/model ${pickerState.provider}/${pickerState.model}` : pickerState.action === "list" ? `/models ${pickerState.provider}` : "/models";
|
|
3564
|
+
const allowTextCommands = core.channel.commands.shouldHandleTextCommands({
|
|
3565
|
+
cfg,
|
|
3566
|
+
surface: "mattermost"
|
|
3567
|
+
});
|
|
3568
|
+
const hasControlCommand = core.channel.text.hasControlCommand(pickerCommandText, cfg);
|
|
3569
|
+
const dmPolicy = account.config.dmPolicy ?? "pairing";
|
|
3570
|
+
const storeAllowFrom = normalizeMattermostAllowList(await readStoreAllowFromForDmPolicy({
|
|
3571
|
+
provider: "mattermost",
|
|
3572
|
+
accountId: account.accountId,
|
|
3573
|
+
dmPolicy,
|
|
3574
|
+
readStore: pairing.readStoreForDmPolicy
|
|
3575
|
+
}));
|
|
3576
|
+
const auth = authorizeMattermostCommandInvocation({
|
|
3577
|
+
account,
|
|
3578
|
+
cfg,
|
|
3579
|
+
senderId: params.payload.user_id,
|
|
3580
|
+
senderName: params.userName,
|
|
3581
|
+
channelId: params.payload.channel_id,
|
|
3582
|
+
channelInfo,
|
|
3583
|
+
storeAllowFrom,
|
|
3584
|
+
allowTextCommands,
|
|
3585
|
+
hasControlCommand
|
|
3586
|
+
});
|
|
3587
|
+
if (!auth.ok) {
|
|
3588
|
+
if (auth.denyReason === "dm-pairing") {
|
|
3589
|
+
const { code } = await pairing.upsertPairingRequest({
|
|
3590
|
+
id: params.payload.user_id,
|
|
3591
|
+
meta: { name: params.userName }
|
|
3592
|
+
});
|
|
3593
|
+
return { ephemeral_text: core.channel.pairing.buildPairingReply({
|
|
3594
|
+
channel: "mattermost",
|
|
3595
|
+
idLine: `Your Mattermost user id: ${params.payload.user_id}`,
|
|
3596
|
+
code
|
|
3597
|
+
}) };
|
|
3598
|
+
}
|
|
3599
|
+
return { ephemeral_text: auth.denyReason === "unknown-channel" ? "Temporary error: unable to determine channel type. Please try again." : auth.denyReason === "dm-disabled" ? "This bot is not accepting direct messages." : auth.denyReason === "channels-disabled" ? "Model picker actions are disabled in channels." : auth.denyReason === "channel-no-allowlist" ? "Model picker actions are not configured for this channel." : "Unauthorized." };
|
|
3600
|
+
}
|
|
3601
|
+
const kind = auth.kind;
|
|
3602
|
+
const chatType = auth.chatType;
|
|
3603
|
+
const teamId = auth.channelInfo.team_id ?? params.payload.team_id ?? void 0;
|
|
3604
|
+
const channelName = auth.channelName || void 0;
|
|
3605
|
+
const channelDisplay = auth.channelDisplay || auth.channelName || params.payload.channel_id;
|
|
3606
|
+
const roomLabel = auth.roomLabel;
|
|
3607
|
+
const route = core.channel.routing.resolveAgentRoute({
|
|
3608
|
+
cfg,
|
|
3609
|
+
channel: "mattermost",
|
|
3610
|
+
accountId: account.accountId,
|
|
3611
|
+
teamId,
|
|
3612
|
+
peer: {
|
|
3613
|
+
kind,
|
|
3614
|
+
id: kind === "direct" ? params.payload.user_id : params.payload.channel_id
|
|
3615
|
+
}
|
|
3616
|
+
});
|
|
3617
|
+
const replyToMode = resolveMattermostReplyToMode(account, kind);
|
|
3618
|
+
const threadContext = resolveMattermostThreadSessionContext({
|
|
3619
|
+
baseSessionKey: route.sessionKey,
|
|
3620
|
+
kind,
|
|
3621
|
+
postId: params.post.id || params.payload.post_id,
|
|
3622
|
+
replyToMode,
|
|
3623
|
+
threadRootId: params.post.root_id
|
|
3624
|
+
});
|
|
3625
|
+
const modelSessionRoute = {
|
|
3626
|
+
agentId: route.agentId,
|
|
3627
|
+
sessionKey: threadContext.sessionKey
|
|
3628
|
+
};
|
|
3629
|
+
const data = await buildModelsProviderData(cfg, route.agentId);
|
|
3630
|
+
if (data.providers.length === 0) return await updateModelPickerPost({
|
|
3631
|
+
channelId: params.payload.channel_id,
|
|
3632
|
+
postId: params.payload.post_id,
|
|
3633
|
+
message: "No models available."
|
|
3634
|
+
});
|
|
3635
|
+
if (pickerState.action === "providers" || pickerState.action === "back") {
|
|
3636
|
+
const currentModel = resolveMattermostModelPickerCurrentModel({
|
|
3637
|
+
cfg,
|
|
3638
|
+
route: modelSessionRoute,
|
|
3639
|
+
data
|
|
3640
|
+
});
|
|
3641
|
+
const view = renderMattermostProviderPickerView({
|
|
3642
|
+
ownerUserId: pickerState.ownerUserId,
|
|
3643
|
+
data,
|
|
3644
|
+
currentModel
|
|
3645
|
+
});
|
|
3646
|
+
return await updateModelPickerPost({
|
|
3647
|
+
channelId: params.payload.channel_id,
|
|
3648
|
+
postId: params.payload.post_id,
|
|
3649
|
+
message: view.text,
|
|
3650
|
+
buttons: view.buttons
|
|
3651
|
+
});
|
|
3652
|
+
}
|
|
3653
|
+
if (pickerState.action === "list") {
|
|
3654
|
+
const currentModel = resolveMattermostModelPickerCurrentModel({
|
|
3655
|
+
cfg,
|
|
3656
|
+
route: modelSessionRoute,
|
|
3657
|
+
data
|
|
3658
|
+
});
|
|
3659
|
+
const view = renderMattermostModelsPickerView({
|
|
3660
|
+
ownerUserId: pickerState.ownerUserId,
|
|
3661
|
+
data,
|
|
3662
|
+
provider: pickerState.provider,
|
|
3663
|
+
page: pickerState.page,
|
|
3664
|
+
currentModel
|
|
3665
|
+
});
|
|
3666
|
+
return await updateModelPickerPost({
|
|
3667
|
+
channelId: params.payload.channel_id,
|
|
3668
|
+
postId: params.payload.post_id,
|
|
3669
|
+
message: view.text,
|
|
3670
|
+
buttons: view.buttons
|
|
3671
|
+
});
|
|
3672
|
+
}
|
|
3673
|
+
const targetModelRef = `${pickerState.provider}/${pickerState.model}`;
|
|
3674
|
+
if (!buildMattermostAllowedModelRefs(data).has(targetModelRef)) return { ephemeral_text: `That model is no longer available: ${targetModelRef}` };
|
|
3675
|
+
(async () => {
|
|
3676
|
+
try {
|
|
3677
|
+
await runModelPickerCommand({
|
|
3678
|
+
commandText: `/model ${targetModelRef}`,
|
|
3679
|
+
commandAuthorized: auth.commandAuthorized,
|
|
3680
|
+
route,
|
|
3681
|
+
sessionKey: threadContext.sessionKey,
|
|
3682
|
+
parentSessionKey: threadContext.parentSessionKey,
|
|
3683
|
+
channelId: params.payload.channel_id,
|
|
3684
|
+
senderId: params.payload.user_id,
|
|
3685
|
+
senderName: params.userName,
|
|
3686
|
+
kind,
|
|
3687
|
+
chatType,
|
|
3688
|
+
channelName,
|
|
3689
|
+
channelDisplay,
|
|
3690
|
+
roomLabel,
|
|
3691
|
+
teamId,
|
|
3692
|
+
postId: params.payload.post_id,
|
|
3693
|
+
effectiveReplyToId: threadContext.effectiveReplyToId,
|
|
3694
|
+
deliverReplies: true
|
|
3695
|
+
});
|
|
3696
|
+
const updatedModel = resolveMattermostModelPickerCurrentModel({
|
|
3697
|
+
cfg,
|
|
3698
|
+
route: modelSessionRoute,
|
|
3699
|
+
data,
|
|
3700
|
+
skipCache: true
|
|
3701
|
+
});
|
|
3702
|
+
const view = renderMattermostModelsPickerView({
|
|
3703
|
+
ownerUserId: pickerState.ownerUserId,
|
|
3704
|
+
data,
|
|
3705
|
+
provider: pickerState.provider,
|
|
3706
|
+
page: pickerState.page,
|
|
3707
|
+
currentModel: updatedModel
|
|
3708
|
+
});
|
|
3709
|
+
await updateModelPickerPost({
|
|
3710
|
+
channelId: params.payload.channel_id,
|
|
3711
|
+
postId: params.payload.post_id,
|
|
3712
|
+
message: view.text,
|
|
3713
|
+
buttons: view.buttons
|
|
3714
|
+
});
|
|
3715
|
+
} catch (err) {
|
|
3716
|
+
runtime.error?.(`mattermost model picker select failed: ${String(err)}`);
|
|
3717
|
+
}
|
|
3718
|
+
})();
|
|
3719
|
+
return {};
|
|
3720
|
+
}
|
|
3721
|
+
const handlePost = async (post, payload, messageIds) => {
|
|
3722
|
+
const channelId = post.channel_id ?? payload.data?.channel_id ?? payload.broadcast?.channel_id;
|
|
3723
|
+
if (!channelId) {
|
|
3724
|
+
logVerboseMessage("mattermost: drop post (missing channel id)");
|
|
3725
|
+
return;
|
|
3726
|
+
}
|
|
3727
|
+
const allMessageIds = messageIds?.length ? messageIds : post.id ? [post.id] : [];
|
|
3728
|
+
if (allMessageIds.length === 0) {
|
|
3729
|
+
logVerboseMessage("mattermost: drop post (missing message id)");
|
|
3730
|
+
return;
|
|
3731
|
+
}
|
|
3732
|
+
const dedupeEntries = allMessageIds.map((id) => recentInboundMessages.check(`${account.accountId}:${id}`));
|
|
3733
|
+
if (dedupeEntries.length > 0 && dedupeEntries.every(Boolean)) {
|
|
3734
|
+
logVerboseMessage(`mattermost: drop post (dedupe account=${account.accountId} ids=${allMessageIds.length})`);
|
|
3735
|
+
return;
|
|
3736
|
+
}
|
|
3737
|
+
const senderId = post.user_id ?? payload.broadcast?.user_id;
|
|
3738
|
+
if (!senderId) {
|
|
3739
|
+
logVerboseMessage("mattermost: drop post (missing sender id)");
|
|
3740
|
+
return;
|
|
3741
|
+
}
|
|
3742
|
+
if (senderId === botUserId) {
|
|
3743
|
+
logVerboseMessage(`mattermost: drop post (self sender=${senderId})`);
|
|
3744
|
+
return;
|
|
3745
|
+
}
|
|
3746
|
+
if (isSystemPost(post)) {
|
|
3747
|
+
logVerboseMessage(`mattermost: drop post (system post type=${post.type ?? "unknown"})`);
|
|
3748
|
+
return;
|
|
3749
|
+
}
|
|
3750
|
+
const channelInfo = await resolveChannelInfo(channelId);
|
|
3751
|
+
const kind = mapMattermostChannelTypeToChatType(payload.data?.channel_type ?? channelInfo?.type ?? void 0);
|
|
3752
|
+
const chatType = channelChatType(kind);
|
|
3753
|
+
const senderName = payload.data?.sender_name?.trim() || (await resolveUserInfo(senderId))?.username?.trim() || senderId;
|
|
3754
|
+
const rawText = post.message?.trim() || "";
|
|
3755
|
+
const dmPolicy = account.config.dmPolicy ?? "pairing";
|
|
3756
|
+
const normalizedAllowFrom = normalizeMattermostAllowList(account.config.allowFrom ?? []);
|
|
3757
|
+
const normalizedGroupAllowFrom = normalizeMattermostAllowList(account.config.groupAllowFrom ?? []);
|
|
3758
|
+
const storeAllowFrom = normalizeMattermostAllowList(await readStoreAllowFromForDmPolicy({
|
|
3759
|
+
provider: "mattermost",
|
|
3760
|
+
accountId: account.accountId,
|
|
3761
|
+
dmPolicy,
|
|
3762
|
+
readStore: pairing.readStoreForDmPolicy
|
|
3763
|
+
}));
|
|
3764
|
+
const accessDecision = resolveDmGroupAccessWithLists({
|
|
3765
|
+
isGroup: kind !== "direct",
|
|
3766
|
+
dmPolicy,
|
|
3767
|
+
groupPolicy,
|
|
3768
|
+
allowFrom: normalizedAllowFrom,
|
|
3769
|
+
groupAllowFrom: normalizedGroupAllowFrom,
|
|
3770
|
+
storeAllowFrom,
|
|
3771
|
+
isSenderAllowed: (allowFrom) => isMattermostSenderAllowed({
|
|
3772
|
+
senderId,
|
|
3773
|
+
senderName,
|
|
3774
|
+
allowFrom,
|
|
3775
|
+
allowNameMatching
|
|
3776
|
+
})
|
|
3777
|
+
});
|
|
3778
|
+
const effectiveAllowFrom = accessDecision.effectiveAllowFrom;
|
|
3779
|
+
const effectiveGroupAllowFrom = accessDecision.effectiveGroupAllowFrom;
|
|
3780
|
+
const allowTextCommands = core.channel.commands.shouldHandleTextCommands({
|
|
3781
|
+
cfg,
|
|
3782
|
+
surface: "mattermost"
|
|
3783
|
+
});
|
|
3784
|
+
const hasControlCommand = core.channel.text.hasControlCommand(rawText, cfg);
|
|
3785
|
+
const isControlCommand = allowTextCommands && hasControlCommand;
|
|
3786
|
+
const useAccessGroups = cfg.commands?.useAccessGroups !== false;
|
|
3787
|
+
const commandDmAllowFrom = kind === "direct" ? effectiveAllowFrom : normalizedAllowFrom;
|
|
3788
|
+
const senderAllowedForCommands = isMattermostSenderAllowed({
|
|
3789
|
+
senderId,
|
|
3790
|
+
senderName,
|
|
3791
|
+
allowFrom: commandDmAllowFrom,
|
|
3792
|
+
allowNameMatching
|
|
3793
|
+
});
|
|
3794
|
+
const groupAllowedForCommands = isMattermostSenderAllowed({
|
|
3795
|
+
senderId,
|
|
3796
|
+
senderName,
|
|
3797
|
+
allowFrom: effectiveGroupAllowFrom,
|
|
3798
|
+
allowNameMatching
|
|
3799
|
+
});
|
|
3800
|
+
const commandGate = resolveControlCommandGate({
|
|
3801
|
+
useAccessGroups,
|
|
3802
|
+
authorizers: [{
|
|
3803
|
+
configured: commandDmAllowFrom.length > 0,
|
|
3804
|
+
allowed: senderAllowedForCommands
|
|
3805
|
+
}, {
|
|
3806
|
+
configured: effectiveGroupAllowFrom.length > 0,
|
|
3807
|
+
allowed: groupAllowedForCommands
|
|
3808
|
+
}],
|
|
3809
|
+
allowTextCommands,
|
|
3810
|
+
hasControlCommand
|
|
3811
|
+
});
|
|
3812
|
+
const commandAuthorized = commandGate.commandAuthorized;
|
|
3813
|
+
if (accessDecision.decision !== "allow") {
|
|
3814
|
+
if (kind === "direct") {
|
|
3815
|
+
if (accessDecision.reasonCode === DM_GROUP_ACCESS_REASON.DM_POLICY_DISABLED) {
|
|
3816
|
+
logVerboseMessage(`mattermost: drop dm (dmPolicy=disabled sender=${senderId})`);
|
|
3817
|
+
return;
|
|
3818
|
+
}
|
|
3819
|
+
if (accessDecision.decision === "pairing") {
|
|
3820
|
+
const { code, created } = await pairing.upsertPairingRequest({
|
|
3821
|
+
id: senderId,
|
|
3822
|
+
meta: { name: senderName }
|
|
3823
|
+
});
|
|
3824
|
+
logVerboseMessage(`mattermost: pairing request sender=${senderId} created=${created}`);
|
|
3825
|
+
if (created) try {
|
|
3826
|
+
await sendMessageMattermost(`user:${senderId}`, core.channel.pairing.buildPairingReply({
|
|
3827
|
+
channel: "mattermost",
|
|
3828
|
+
idLine: `Your Mattermost user id: ${senderId}`,
|
|
3829
|
+
code
|
|
3830
|
+
}), {
|
|
3831
|
+
cfg,
|
|
3832
|
+
accountId: account.accountId
|
|
3833
|
+
});
|
|
3834
|
+
opts.statusSink?.({ lastOutboundAt: Date.now() });
|
|
3835
|
+
} catch (err) {
|
|
3836
|
+
logVerboseMessage(`mattermost: pairing reply failed for ${senderId}: ${String(err)}`);
|
|
3837
|
+
}
|
|
3838
|
+
return;
|
|
3839
|
+
}
|
|
3840
|
+
logVerboseMessage(`mattermost: drop dm sender=${senderId} (dmPolicy=${dmPolicy})`);
|
|
3841
|
+
return;
|
|
3842
|
+
}
|
|
3843
|
+
if (accessDecision.reasonCode === DM_GROUP_ACCESS_REASON.GROUP_POLICY_DISABLED) {
|
|
3844
|
+
logVerboseMessage("mattermost: drop group message (groupPolicy=disabled)");
|
|
3845
|
+
return;
|
|
3846
|
+
}
|
|
3847
|
+
if (accessDecision.reasonCode === DM_GROUP_ACCESS_REASON.GROUP_POLICY_EMPTY_ALLOWLIST) {
|
|
3848
|
+
logVerboseMessage("mattermost: drop group message (no group allowlist)");
|
|
3849
|
+
return;
|
|
3850
|
+
}
|
|
3851
|
+
if (accessDecision.reasonCode === DM_GROUP_ACCESS_REASON.GROUP_POLICY_NOT_ALLOWLISTED) {
|
|
3852
|
+
logVerboseMessage(`mattermost: drop group sender=${senderId} (not in groupAllowFrom)`);
|
|
3853
|
+
return;
|
|
3854
|
+
}
|
|
3855
|
+
logVerboseMessage(`mattermost: drop group message (groupPolicy=${groupPolicy} reason=${accessDecision.reason})`);
|
|
3856
|
+
return;
|
|
3857
|
+
}
|
|
3858
|
+
if (kind !== "direct" && commandGate.shouldBlock) {
|
|
3859
|
+
logInboundDrop({
|
|
3860
|
+
log: logVerboseMessage,
|
|
3861
|
+
channel: "mattermost",
|
|
3862
|
+
reason: "control command (unauthorized)",
|
|
3863
|
+
target: senderId
|
|
3864
|
+
});
|
|
3865
|
+
return;
|
|
3866
|
+
}
|
|
3867
|
+
const teamId = payload.data?.team_id ?? channelInfo?.team_id ?? void 0;
|
|
3868
|
+
const channelName = payload.data?.channel_name ?? channelInfo?.name ?? "";
|
|
3869
|
+
const channelDisplay = payload.data?.channel_display_name ?? channelInfo?.display_name ?? channelName;
|
|
3870
|
+
const roomLabel = channelName ? `#${channelName}` : channelDisplay || `#${channelId}`;
|
|
3871
|
+
const route = core.channel.routing.resolveAgentRoute({
|
|
3872
|
+
cfg,
|
|
3873
|
+
channel: "mattermost",
|
|
3874
|
+
accountId: account.accountId,
|
|
3875
|
+
teamId,
|
|
3876
|
+
peer: {
|
|
3877
|
+
kind,
|
|
3878
|
+
id: kind === "direct" ? senderId : channelId
|
|
3879
|
+
}
|
|
3880
|
+
});
|
|
3881
|
+
const baseSessionKey = route.sessionKey;
|
|
3882
|
+
const threadRootId = post.root_id?.trim() || void 0;
|
|
3883
|
+
const replyToMode = resolveMattermostReplyToMode(account, kind);
|
|
3884
|
+
const { effectiveReplyToId, sessionKey, parentSessionKey } = resolveMattermostThreadSessionContext({
|
|
3885
|
+
baseSessionKey,
|
|
3886
|
+
kind,
|
|
3887
|
+
postId: post.id,
|
|
3888
|
+
replyToMode,
|
|
3889
|
+
threadRootId
|
|
3890
|
+
});
|
|
3891
|
+
const historyKey = kind === "direct" ? null : sessionKey;
|
|
3892
|
+
const mentionRegexes = core.channel.mentions.buildMentionRegexes(cfg, route.agentId);
|
|
3893
|
+
const wasMentioned = kind !== "direct" && ((botUsername ? rawText.toLowerCase().includes(`@${botUsername.toLowerCase()}`) : false) || core.channel.mentions.matchesMentionPatterns(rawText, mentionRegexes));
|
|
3894
|
+
const pendingBody = rawText || (post.file_ids?.length ? `[Mattermost ${post.file_ids.length === 1 ? "file" : "files"}]` : "");
|
|
3895
|
+
const pendingSender = senderName;
|
|
3896
|
+
const recordPendingHistory = () => {
|
|
3897
|
+
const trimmed = pendingBody.trim();
|
|
3898
|
+
recordPendingHistoryEntryIfEnabled({
|
|
3899
|
+
historyMap: channelHistories,
|
|
3900
|
+
limit: historyLimit,
|
|
3901
|
+
historyKey: historyKey ?? "",
|
|
3902
|
+
entry: historyKey && trimmed ? {
|
|
3903
|
+
sender: pendingSender,
|
|
3904
|
+
body: trimmed,
|
|
3905
|
+
timestamp: typeof post.create_at === "number" ? post.create_at : void 0,
|
|
3906
|
+
messageId: post.id ?? void 0
|
|
3907
|
+
} : null
|
|
3908
|
+
});
|
|
3909
|
+
};
|
|
3910
|
+
const oncharEnabled = account.chatmode === "onchar" && kind !== "direct";
|
|
3911
|
+
const oncharPrefixes = oncharEnabled ? resolveOncharPrefixes(account.oncharPrefixes) : [];
|
|
3912
|
+
const oncharResult = oncharEnabled ? stripOncharPrefix(rawText, oncharPrefixes) : {
|
|
3913
|
+
triggered: false,
|
|
3914
|
+
stripped: rawText
|
|
3915
|
+
};
|
|
3916
|
+
const oncharTriggered = oncharResult.triggered;
|
|
3917
|
+
const canDetectMention = Boolean(botUsername) || mentionRegexes.length > 0;
|
|
3918
|
+
const mentionDecision = evaluateMattermostMentionGate({
|
|
3919
|
+
kind,
|
|
3920
|
+
cfg,
|
|
3921
|
+
accountId: account.accountId,
|
|
3922
|
+
channelId,
|
|
3923
|
+
threadRootId,
|
|
3924
|
+
requireMentionOverride: account.requireMention,
|
|
3925
|
+
resolveRequireMention: core.channel.groups.resolveRequireMention,
|
|
3926
|
+
wasMentioned,
|
|
3927
|
+
isControlCommand,
|
|
3928
|
+
commandAuthorized,
|
|
3929
|
+
oncharEnabled,
|
|
3930
|
+
oncharTriggered,
|
|
3931
|
+
canDetectMention
|
|
3932
|
+
});
|
|
3933
|
+
const { shouldRequireMention, shouldBypassMention } = mentionDecision;
|
|
3934
|
+
if (mentionDecision.dropReason === "onchar-not-triggered") {
|
|
3935
|
+
logVerboseMessage(`mattermost: drop group message (onchar not triggered channel=${channelId} sender=${senderId})`);
|
|
3936
|
+
recordPendingHistory();
|
|
3937
|
+
return;
|
|
3938
|
+
}
|
|
3939
|
+
if (mentionDecision.dropReason === "missing-mention") {
|
|
3940
|
+
logVerboseMessage(`mattermost: drop group message (missing mention channel=${channelId} sender=${senderId} requireMention=${shouldRequireMention} bypass=${shouldBypassMention} canDetectMention=${canDetectMention})`);
|
|
3941
|
+
recordPendingHistory();
|
|
3942
|
+
return;
|
|
3943
|
+
}
|
|
3944
|
+
const mediaList = await resolveMattermostMedia(post.file_ids);
|
|
3945
|
+
const mediaPlaceholder = buildMattermostAttachmentPlaceholder(mediaList);
|
|
3946
|
+
const bodyText = normalizeMention([oncharTriggered ? oncharResult.stripped : rawText, mediaPlaceholder].filter(Boolean).join("\n").trim(), botUsername);
|
|
3947
|
+
if (!bodyText) {
|
|
3948
|
+
logVerboseMessage(`mattermost: drop group message (empty body after normalization channel=${channelId} sender=${senderId})`);
|
|
3949
|
+
return;
|
|
3950
|
+
}
|
|
3951
|
+
core.channel.activity.record({
|
|
3952
|
+
channel: "mattermost",
|
|
3953
|
+
accountId: account.accountId,
|
|
3954
|
+
direction: "inbound"
|
|
3955
|
+
});
|
|
3956
|
+
const fromLabel = formatInboundFromLabel({
|
|
3957
|
+
isGroup: kind !== "direct",
|
|
3958
|
+
groupLabel: channelDisplay || roomLabel,
|
|
3959
|
+
groupId: channelId,
|
|
3960
|
+
groupFallback: roomLabel || "Channel",
|
|
3961
|
+
directLabel: senderName,
|
|
3962
|
+
directId: senderId
|
|
3963
|
+
});
|
|
3964
|
+
const preview = bodyText.replace(/\s+/g, " ").slice(0, 160);
|
|
3965
|
+
const inboundLabel = kind === "direct" ? `Mattermost DM from ${senderName}` : `Mattermost message in ${roomLabel} from ${senderName}`;
|
|
3966
|
+
core.system.enqueueSystemEvent(`${inboundLabel}: ${preview}`, {
|
|
3967
|
+
sessionKey,
|
|
3968
|
+
contextKey: `mattermost:message:${channelId}:${post.id ?? "unknown"}`
|
|
3969
|
+
});
|
|
3970
|
+
const textWithId = `${bodyText}\n[mattermost message id: ${post.id ?? "unknown"} channel: ${channelId}]`;
|
|
3971
|
+
let combinedBody = core.channel.reply.formatInboundEnvelope({
|
|
3972
|
+
channel: "Mattermost",
|
|
3973
|
+
from: fromLabel,
|
|
3974
|
+
timestamp: typeof post.create_at === "number" ? post.create_at : void 0,
|
|
3975
|
+
body: textWithId,
|
|
3976
|
+
chatType,
|
|
3977
|
+
sender: {
|
|
3978
|
+
name: senderName,
|
|
3979
|
+
id: senderId
|
|
3980
|
+
}
|
|
3981
|
+
});
|
|
3982
|
+
if (historyKey) combinedBody = buildPendingHistoryContextFromMap({
|
|
3983
|
+
historyMap: channelHistories,
|
|
3984
|
+
historyKey,
|
|
3985
|
+
limit: historyLimit,
|
|
3986
|
+
currentMessage: combinedBody,
|
|
3987
|
+
formatEntry: (entry) => core.channel.reply.formatInboundEnvelope({
|
|
3988
|
+
channel: "Mattermost",
|
|
3989
|
+
from: fromLabel,
|
|
3990
|
+
timestamp: entry.timestamp,
|
|
3991
|
+
body: `${entry.body}${entry.messageId ? ` [id:${entry.messageId} channel:${channelId}]` : ""}`,
|
|
3992
|
+
chatType,
|
|
3993
|
+
senderLabel: entry.sender
|
|
3994
|
+
})
|
|
3995
|
+
});
|
|
3996
|
+
const to = kind === "direct" ? `user:${senderId}` : `channel:${channelId}`;
|
|
3997
|
+
const mediaPayload = buildAgentMediaPayload(mediaList);
|
|
3998
|
+
const commandBody = rawText.trim();
|
|
3999
|
+
const inboundHistory = historyKey && historyLimit > 0 ? (channelHistories.get(historyKey) ?? []).map((entry) => ({
|
|
4000
|
+
sender: entry.sender,
|
|
4001
|
+
body: entry.body,
|
|
4002
|
+
timestamp: entry.timestamp
|
|
4003
|
+
})) : void 0;
|
|
4004
|
+
const ctxPayload = core.channel.reply.finalizeInboundContext({
|
|
4005
|
+
Body: combinedBody,
|
|
4006
|
+
BodyForAgent: bodyText,
|
|
4007
|
+
InboundHistory: inboundHistory,
|
|
4008
|
+
RawBody: bodyText,
|
|
4009
|
+
CommandBody: commandBody,
|
|
4010
|
+
BodyForCommands: commandBody,
|
|
4011
|
+
From: kind === "direct" ? `mattermost:${senderId}` : kind === "group" ? `mattermost:group:${channelId}` : `mattermost:channel:${channelId}`,
|
|
4012
|
+
To: to,
|
|
4013
|
+
SessionKey: sessionKey,
|
|
4014
|
+
ParentSessionKey: parentSessionKey,
|
|
4015
|
+
AccountId: route.accountId,
|
|
4016
|
+
ChatType: chatType,
|
|
4017
|
+
ConversationLabel: fromLabel,
|
|
4018
|
+
GroupSubject: kind !== "direct" ? channelDisplay || roomLabel : void 0,
|
|
4019
|
+
GroupChannel: channelName ? `#${channelName}` : void 0,
|
|
4020
|
+
GroupSpace: teamId,
|
|
4021
|
+
SenderName: senderName,
|
|
4022
|
+
SenderId: senderId,
|
|
4023
|
+
Provider: "mattermost",
|
|
4024
|
+
Surface: "mattermost",
|
|
4025
|
+
MessageSid: post.id ?? void 0,
|
|
4026
|
+
MessageSids: allMessageIds.length > 1 ? allMessageIds : void 0,
|
|
4027
|
+
MessageSidFirst: allMessageIds.length > 1 ? allMessageIds[0] : void 0,
|
|
4028
|
+
MessageSidLast: allMessageIds.length > 1 ? allMessageIds[allMessageIds.length - 1] : void 0,
|
|
4029
|
+
ReplyToId: effectiveReplyToId,
|
|
4030
|
+
MessageThreadId: effectiveReplyToId,
|
|
4031
|
+
Timestamp: typeof post.create_at === "number" ? post.create_at : void 0,
|
|
4032
|
+
WasMentioned: kind !== "direct" ? mentionDecision.effectiveWasMentioned : void 0,
|
|
4033
|
+
CommandAuthorized: commandAuthorized,
|
|
4034
|
+
OriginatingChannel: "mattermost",
|
|
4035
|
+
OriginatingTo: to,
|
|
4036
|
+
...mediaPayload
|
|
4037
|
+
});
|
|
4038
|
+
if (kind === "direct") {
|
|
4039
|
+
const sessionCfg = cfg.session;
|
|
4040
|
+
const storePath = core.channel.session.resolveStorePath(sessionCfg?.store, { agentId: route.agentId });
|
|
4041
|
+
await core.channel.session.updateLastRoute({
|
|
4042
|
+
storePath,
|
|
4043
|
+
sessionKey: route.mainSessionKey,
|
|
4044
|
+
deliveryContext: {
|
|
4045
|
+
channel: "mattermost",
|
|
4046
|
+
to,
|
|
4047
|
+
accountId: route.accountId
|
|
4048
|
+
}
|
|
4049
|
+
});
|
|
4050
|
+
}
|
|
4051
|
+
const previewLine = bodyText.slice(0, 200).replace(/\n/g, "\\n");
|
|
4052
|
+
logVerboseMessage(`mattermost inbound: from=${ctxPayload.From} len=${bodyText.length} preview="${previewLine}"`);
|
|
4053
|
+
const textLimit = core.channel.text.resolveTextChunkLimit(cfg, "mattermost", account.accountId, { fallbackLimit: account.textChunkLimit ?? 4e3 });
|
|
4054
|
+
const tableMode = core.channel.text.resolveMarkdownTableMode({
|
|
4055
|
+
cfg,
|
|
4056
|
+
channel: "mattermost",
|
|
4057
|
+
accountId: account.accountId
|
|
4058
|
+
});
|
|
4059
|
+
const { onModelSelected, typingCallbacks, ...replyPipeline } = createChannelReplyPipeline({
|
|
4060
|
+
cfg,
|
|
4061
|
+
agentId: route.agentId,
|
|
4062
|
+
channel: "mattermost",
|
|
4063
|
+
accountId: account.accountId,
|
|
4064
|
+
typing: {
|
|
4065
|
+
start: () => sendTypingIndicator(channelId, effectiveReplyToId),
|
|
4066
|
+
onStartError: (err) => {
|
|
4067
|
+
logTypingFailure({
|
|
4068
|
+
log: (message) => logger.debug?.(message),
|
|
4069
|
+
channel: "mattermost",
|
|
4070
|
+
target: channelId,
|
|
4071
|
+
error: err
|
|
4072
|
+
});
|
|
4073
|
+
}
|
|
4074
|
+
}
|
|
4075
|
+
});
|
|
4076
|
+
const { dispatcher, replyOptions, markDispatchIdle } = core.channel.reply.createReplyDispatcherWithTyping({
|
|
4077
|
+
...replyPipeline,
|
|
4078
|
+
humanDelay: core.channel.reply.resolveHumanDelayConfig(cfg, route.agentId),
|
|
4079
|
+
typingCallbacks,
|
|
4080
|
+
deliver: async (payload) => {
|
|
4081
|
+
await deliverMattermostReplyPayload({
|
|
4082
|
+
core,
|
|
4083
|
+
cfg,
|
|
4084
|
+
payload,
|
|
4085
|
+
to,
|
|
4086
|
+
accountId: account.accountId,
|
|
4087
|
+
agentId: route.agentId,
|
|
4088
|
+
replyToId: resolveMattermostReplyRootId({
|
|
4089
|
+
threadRootId: effectiveReplyToId,
|
|
4090
|
+
replyToId: payload.replyToId
|
|
4091
|
+
}),
|
|
4092
|
+
textLimit,
|
|
4093
|
+
tableMode,
|
|
4094
|
+
sendMessage: sendMessageMattermost
|
|
4095
|
+
});
|
|
4096
|
+
runtime.log?.(`delivered reply to ${to}`);
|
|
4097
|
+
},
|
|
4098
|
+
onError: (err, info) => {
|
|
4099
|
+
runtime.error?.(`mattermost ${info.kind} reply failed: ${String(err)}`);
|
|
4100
|
+
}
|
|
4101
|
+
});
|
|
4102
|
+
await core.channel.reply.withReplyDispatcher({
|
|
4103
|
+
dispatcher,
|
|
4104
|
+
onSettled: () => {
|
|
4105
|
+
markDispatchIdle();
|
|
4106
|
+
},
|
|
4107
|
+
run: () => core.channel.reply.dispatchReplyFromConfig({
|
|
4108
|
+
ctx: ctxPayload,
|
|
4109
|
+
cfg,
|
|
4110
|
+
dispatcher,
|
|
4111
|
+
replyOptions: {
|
|
4112
|
+
...replyOptions,
|
|
4113
|
+
disableBlockStreaming: typeof account.blockStreaming === "boolean" ? !account.blockStreaming : void 0,
|
|
4114
|
+
onModelSelected
|
|
4115
|
+
}
|
|
4116
|
+
})
|
|
4117
|
+
});
|
|
4118
|
+
if (historyKey) clearHistoryEntriesIfEnabled({
|
|
4119
|
+
historyMap: channelHistories,
|
|
4120
|
+
historyKey,
|
|
4121
|
+
limit: historyLimit
|
|
4122
|
+
});
|
|
4123
|
+
};
|
|
4124
|
+
const handleReactionEvent = async (payload) => {
|
|
4125
|
+
const reactionData = payload.data?.reaction;
|
|
4126
|
+
if (!reactionData) return;
|
|
4127
|
+
let reaction = null;
|
|
4128
|
+
if (typeof reactionData === "string") try {
|
|
4129
|
+
reaction = JSON.parse(reactionData);
|
|
4130
|
+
} catch {
|
|
4131
|
+
return;
|
|
4132
|
+
}
|
|
4133
|
+
else if (typeof reactionData === "object") reaction = reactionData;
|
|
4134
|
+
if (!reaction) return;
|
|
4135
|
+
const userId = reaction.user_id?.trim();
|
|
4136
|
+
const postId = reaction.post_id?.trim();
|
|
4137
|
+
const emojiName = reaction.emoji_name?.trim();
|
|
4138
|
+
if (!userId || !postId || !emojiName) return;
|
|
4139
|
+
if (userId === botUserId) return;
|
|
4140
|
+
const action = payload.event === "reaction_removed" ? "removed" : "added";
|
|
4141
|
+
const senderName = (await resolveUserInfo(userId))?.username?.trim() || userId;
|
|
4142
|
+
const channelId = resolveMattermostReactionChannelId(payload);
|
|
4143
|
+
if (!channelId) {
|
|
4144
|
+
logVerboseMessage(`mattermost: drop reaction (no channel_id in broadcast, cannot enforce policy)`);
|
|
4145
|
+
return;
|
|
4146
|
+
}
|
|
4147
|
+
const channelInfo = await resolveChannelInfo(channelId);
|
|
4148
|
+
if (!channelInfo?.type) {
|
|
4149
|
+
logVerboseMessage(`mattermost: drop reaction (cannot resolve channel type for ${channelId})`);
|
|
4150
|
+
return;
|
|
4151
|
+
}
|
|
4152
|
+
const kind = mapMattermostChannelTypeToChatType(channelInfo.type);
|
|
4153
|
+
const dmPolicy = account.config.dmPolicy ?? "pairing";
|
|
4154
|
+
const storeAllowFrom = normalizeMattermostAllowList(await readStoreAllowFromForDmPolicy({
|
|
4155
|
+
provider: "mattermost",
|
|
4156
|
+
accountId: account.accountId,
|
|
4157
|
+
dmPolicy,
|
|
4158
|
+
readStore: pairing.readStoreForDmPolicy
|
|
4159
|
+
}));
|
|
4160
|
+
const reactionAccess = resolveDmGroupAccessWithLists({
|
|
4161
|
+
isGroup: kind !== "direct",
|
|
4162
|
+
dmPolicy,
|
|
4163
|
+
groupPolicy,
|
|
4164
|
+
allowFrom: normalizeMattermostAllowList(account.config.allowFrom ?? []),
|
|
4165
|
+
groupAllowFrom: normalizeMattermostAllowList(account.config.groupAllowFrom ?? []),
|
|
4166
|
+
storeAllowFrom,
|
|
4167
|
+
isSenderAllowed: (allowFrom) => isMattermostSenderAllowed({
|
|
4168
|
+
senderId: userId,
|
|
4169
|
+
senderName,
|
|
4170
|
+
allowFrom,
|
|
4171
|
+
allowNameMatching
|
|
4172
|
+
})
|
|
4173
|
+
});
|
|
4174
|
+
if (reactionAccess.decision !== "allow") {
|
|
4175
|
+
if (kind === "direct") logVerboseMessage(`mattermost: drop reaction (dmPolicy=${dmPolicy} sender=${userId} reason=${reactionAccess.reason})`);
|
|
4176
|
+
else logVerboseMessage(`mattermost: drop reaction (groupPolicy=${groupPolicy} sender=${userId} reason=${reactionAccess.reason} channel=${channelId})`);
|
|
4177
|
+
return;
|
|
4178
|
+
}
|
|
4179
|
+
const teamId = channelInfo?.team_id ?? void 0;
|
|
4180
|
+
const sessionKey = core.channel.routing.resolveAgentRoute({
|
|
4181
|
+
cfg,
|
|
4182
|
+
channel: "mattermost",
|
|
4183
|
+
accountId: account.accountId,
|
|
4184
|
+
teamId,
|
|
4185
|
+
peer: {
|
|
4186
|
+
kind,
|
|
4187
|
+
id: kind === "direct" ? userId : channelId
|
|
4188
|
+
}
|
|
4189
|
+
}).sessionKey;
|
|
4190
|
+
const eventText = `Mattermost reaction ${action}: :${emojiName}: by @${senderName} on post ${postId} in channel ${channelId}`;
|
|
4191
|
+
core.system.enqueueSystemEvent(eventText, {
|
|
4192
|
+
sessionKey,
|
|
4193
|
+
contextKey: `mattermost:reaction:${postId}:${emojiName}:${userId}:${action}`
|
|
4194
|
+
});
|
|
4195
|
+
logVerboseMessage(`mattermost reaction: ${action} :${emojiName}: by ${senderName} on ${postId}`);
|
|
4196
|
+
};
|
|
4197
|
+
const inboundDebounceMs = core.channel.debounce.resolveInboundDebounceMs({
|
|
4198
|
+
cfg,
|
|
4199
|
+
channel: "mattermost"
|
|
4200
|
+
});
|
|
4201
|
+
const debouncer = core.channel.debounce.createInboundDebouncer({
|
|
4202
|
+
debounceMs: inboundDebounceMs,
|
|
4203
|
+
buildKey: (entry) => {
|
|
4204
|
+
const channelId = entry.post.channel_id ?? entry.payload.data?.channel_id ?? entry.payload.broadcast?.channel_id;
|
|
4205
|
+
if (!channelId) return null;
|
|
4206
|
+
const threadId = entry.post.root_id?.trim();
|
|
4207
|
+
const threadKey = threadId ? `thread:${threadId}` : "channel";
|
|
4208
|
+
return `mattermost:${account.accountId}:${channelId}:${threadKey}`;
|
|
4209
|
+
},
|
|
4210
|
+
shouldDebounce: (entry) => {
|
|
4211
|
+
if (entry.post.file_ids && entry.post.file_ids.length > 0) return false;
|
|
4212
|
+
const text = entry.post.message?.trim() ?? "";
|
|
4213
|
+
if (!text) return false;
|
|
4214
|
+
return !core.channel.text.hasControlCommand(text, cfg);
|
|
4215
|
+
},
|
|
4216
|
+
onFlush: async (entries) => {
|
|
4217
|
+
const last = entries.at(-1);
|
|
4218
|
+
if (!last) return;
|
|
4219
|
+
if (entries.length === 1) {
|
|
4220
|
+
await handlePost(last.post, last.payload);
|
|
4221
|
+
return;
|
|
4222
|
+
}
|
|
4223
|
+
const combinedText = entries.map((entry) => entry.post.message?.trim() ?? "").filter(Boolean).join("\n");
|
|
4224
|
+
const mergedPost = {
|
|
4225
|
+
...last.post,
|
|
4226
|
+
message: combinedText,
|
|
4227
|
+
file_ids: []
|
|
4228
|
+
};
|
|
4229
|
+
const ids = entries.map((entry) => entry.post.id).filter(Boolean);
|
|
4230
|
+
await handlePost(mergedPost, last.payload, ids.length > 0 ? ids : void 0);
|
|
4231
|
+
},
|
|
4232
|
+
onError: (err) => {
|
|
4233
|
+
runtime.error?.(`mattermost debounce flush failed: ${String(err)}`);
|
|
4234
|
+
}
|
|
4235
|
+
});
|
|
4236
|
+
const wsUrl = buildMattermostWsUrl(baseUrl);
|
|
4237
|
+
let seq = 1;
|
|
4238
|
+
const connectOnce = createMattermostConnectOnce({
|
|
4239
|
+
wsUrl,
|
|
4240
|
+
botToken,
|
|
4241
|
+
abortSignal: opts.abortSignal,
|
|
4242
|
+
statusSink: opts.statusSink,
|
|
4243
|
+
runtime,
|
|
4244
|
+
webSocketFactory: opts.webSocketFactory,
|
|
4245
|
+
nextSeq: () => seq++,
|
|
4246
|
+
getBotUpdateAt: async () => {
|
|
4247
|
+
return (await fetchMattermostMe(client)).update_at ?? 0;
|
|
4248
|
+
},
|
|
4249
|
+
onPosted: async (post, payload) => {
|
|
4250
|
+
await debouncer.enqueue({
|
|
4251
|
+
post,
|
|
4252
|
+
payload
|
|
4253
|
+
});
|
|
4254
|
+
},
|
|
4255
|
+
onReaction: async (payload) => {
|
|
4256
|
+
await handleReactionEvent(payload);
|
|
4257
|
+
}
|
|
4258
|
+
});
|
|
4259
|
+
let slashShutdownCleanup = null;
|
|
4260
|
+
if (slashEnabled) {
|
|
4261
|
+
const runAbortCleanup = () => {
|
|
4262
|
+
if (slashShutdownCleanup) return;
|
|
4263
|
+
const commands = getSlashCommandState(account.accountId)?.registeredCommands ?? [];
|
|
4264
|
+
deactivateSlashCommands(account.accountId);
|
|
4265
|
+
slashShutdownCleanup = cleanupSlashCommands({
|
|
4266
|
+
client,
|
|
4267
|
+
commands,
|
|
4268
|
+
log: (msg) => runtime.log?.(msg)
|
|
4269
|
+
}).catch((err) => {
|
|
4270
|
+
runtime.error?.(`mattermost: slash cleanup failed: ${String(err)}`);
|
|
4271
|
+
});
|
|
4272
|
+
};
|
|
4273
|
+
if (opts.abortSignal?.aborted) runAbortCleanup();
|
|
4274
|
+
else opts.abortSignal?.addEventListener("abort", runAbortCleanup, { once: true });
|
|
4275
|
+
}
|
|
4276
|
+
try {
|
|
4277
|
+
await runWithReconnect(connectOnce, {
|
|
4278
|
+
abortSignal: opts.abortSignal,
|
|
4279
|
+
jitterRatio: .2,
|
|
4280
|
+
onError: (err) => {
|
|
4281
|
+
runtime.error?.(`mattermost connection failed: ${String(err)}`);
|
|
4282
|
+
opts.statusSink?.({
|
|
4283
|
+
lastError: String(err),
|
|
4284
|
+
connected: false
|
|
4285
|
+
});
|
|
4286
|
+
},
|
|
4287
|
+
onReconnect: (delayMs) => {
|
|
4288
|
+
runtime.log?.(`mattermost reconnecting in ${Math.round(delayMs / 1e3)}s`);
|
|
4289
|
+
}
|
|
4290
|
+
});
|
|
4291
|
+
} finally {
|
|
4292
|
+
unregisterInteractions?.();
|
|
4293
|
+
}
|
|
4294
|
+
if (slashShutdownCleanup) await slashShutdownCleanup;
|
|
4295
|
+
}
|
|
4296
|
+
//#endregion
|
|
4297
|
+
//#region extensions/mattermost/src/mattermost/probe.ts
|
|
4298
|
+
async function probeMattermost(baseUrl, botToken, timeoutMs = 2500, allowPrivateNetwork = false) {
|
|
4299
|
+
const normalized = normalizeMattermostBaseUrl(baseUrl);
|
|
4300
|
+
if (!normalized) return {
|
|
4301
|
+
ok: false,
|
|
4302
|
+
error: "baseUrl missing"
|
|
4303
|
+
};
|
|
4304
|
+
const url = `${normalized}/api/v4/users/me`;
|
|
4305
|
+
const start = Date.now();
|
|
4306
|
+
const controller = timeoutMs > 0 ? new AbortController() : void 0;
|
|
4307
|
+
let timer = null;
|
|
4308
|
+
if (controller) timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
4309
|
+
try {
|
|
4310
|
+
const { response: res, release } = await fetchWithSsrFGuard({
|
|
4311
|
+
url,
|
|
4312
|
+
init: {
|
|
4313
|
+
headers: { Authorization: `Bearer ${botToken}` },
|
|
4314
|
+
signal: controller?.signal
|
|
4315
|
+
},
|
|
4316
|
+
auditContext: "mattermost-probe",
|
|
4317
|
+
policy: allowPrivateNetwork ? { allowPrivateNetwork: true } : void 0
|
|
4318
|
+
});
|
|
4319
|
+
try {
|
|
4320
|
+
const elapsedMs = Date.now() - start;
|
|
4321
|
+
if (!res.ok) {
|
|
4322
|
+
const detail = await readMattermostError(res);
|
|
4323
|
+
return {
|
|
4324
|
+
ok: false,
|
|
4325
|
+
status: res.status,
|
|
4326
|
+
error: detail || res.statusText,
|
|
4327
|
+
elapsedMs
|
|
4328
|
+
};
|
|
4329
|
+
}
|
|
4330
|
+
const bot = await res.json();
|
|
4331
|
+
return {
|
|
4332
|
+
ok: true,
|
|
4333
|
+
status: res.status,
|
|
4334
|
+
elapsedMs,
|
|
4335
|
+
bot
|
|
4336
|
+
};
|
|
4337
|
+
} finally {
|
|
4338
|
+
await release();
|
|
4339
|
+
}
|
|
4340
|
+
} catch (err) {
|
|
4341
|
+
return {
|
|
4342
|
+
ok: false,
|
|
4343
|
+
status: null,
|
|
4344
|
+
error: err instanceof Error ? err.message : String(err),
|
|
4345
|
+
elapsedMs: Date.now() - start
|
|
4346
|
+
};
|
|
4347
|
+
} finally {
|
|
4348
|
+
if (timer) clearTimeout(timer);
|
|
4349
|
+
}
|
|
4350
|
+
}
|
|
4351
|
+
//#endregion
|
|
4352
|
+
//#region extensions/mattermost/src/mattermost/reactions.ts
|
|
4353
|
+
const BOT_USER_CACHE_TTL_MS = 10 * 6e4;
|
|
4354
|
+
const botUserIdCache = /* @__PURE__ */ new Map();
|
|
4355
|
+
async function resolveBotUserId(client, cacheKey) {
|
|
4356
|
+
const cached = botUserIdCache.get(cacheKey);
|
|
4357
|
+
if (cached && cached.expiresAt > Date.now()) return cached.userId;
|
|
4358
|
+
const userId = (await fetchMattermostMe(client))?.id?.trim();
|
|
4359
|
+
if (!userId) return null;
|
|
4360
|
+
botUserIdCache.set(cacheKey, {
|
|
4361
|
+
userId,
|
|
4362
|
+
expiresAt: Date.now() + BOT_USER_CACHE_TTL_MS
|
|
4363
|
+
});
|
|
4364
|
+
return userId;
|
|
4365
|
+
}
|
|
4366
|
+
async function addMattermostReaction(params) {
|
|
4367
|
+
return runMattermostReaction(params, {
|
|
4368
|
+
action: "add",
|
|
4369
|
+
mutation: createReaction
|
|
4370
|
+
});
|
|
4371
|
+
}
|
|
4372
|
+
async function removeMattermostReaction(params) {
|
|
4373
|
+
return runMattermostReaction(params, {
|
|
4374
|
+
action: "remove",
|
|
4375
|
+
mutation: deleteReaction
|
|
4376
|
+
});
|
|
4377
|
+
}
|
|
4378
|
+
async function runMattermostReaction(params, options) {
|
|
4379
|
+
const resolved = resolveMattermostAccount({
|
|
4380
|
+
cfg: params.cfg,
|
|
4381
|
+
accountId: params.accountId
|
|
4382
|
+
});
|
|
4383
|
+
const baseUrl = resolved.baseUrl?.trim();
|
|
4384
|
+
const botToken = resolved.botToken?.trim();
|
|
4385
|
+
if (!baseUrl || !botToken) return {
|
|
4386
|
+
ok: false,
|
|
4387
|
+
error: "Mattermost botToken/baseUrl missing."
|
|
4388
|
+
};
|
|
4389
|
+
const client = createMattermostClient({
|
|
4390
|
+
baseUrl,
|
|
4391
|
+
botToken,
|
|
4392
|
+
fetchImpl: params.fetchImpl,
|
|
4393
|
+
allowPrivateNetwork: resolved.config?.allowPrivateNetwork === true
|
|
4394
|
+
});
|
|
4395
|
+
const userId = await resolveBotUserId(client, `${baseUrl}:${botToken}`);
|
|
4396
|
+
if (!userId) return {
|
|
4397
|
+
ok: false,
|
|
4398
|
+
error: "Mattermost reactions failed: could not resolve bot user id."
|
|
4399
|
+
};
|
|
4400
|
+
try {
|
|
4401
|
+
await options.mutation(client, {
|
|
4402
|
+
userId,
|
|
4403
|
+
postId: params.postId,
|
|
4404
|
+
emojiName: params.emojiName
|
|
4405
|
+
});
|
|
4406
|
+
} catch (err) {
|
|
4407
|
+
return {
|
|
4408
|
+
ok: false,
|
|
4409
|
+
error: `Mattermost ${options.action} reaction failed: ${String(err)}`
|
|
4410
|
+
};
|
|
4411
|
+
}
|
|
4412
|
+
return { ok: true };
|
|
4413
|
+
}
|
|
4414
|
+
async function createReaction(client, params) {
|
|
4415
|
+
await client.request("/reactions", {
|
|
4416
|
+
method: "POST",
|
|
4417
|
+
body: JSON.stringify({
|
|
4418
|
+
user_id: params.userId,
|
|
4419
|
+
post_id: params.postId,
|
|
4420
|
+
emoji_name: params.emojiName
|
|
4421
|
+
})
|
|
4422
|
+
});
|
|
4423
|
+
}
|
|
4424
|
+
async function deleteReaction(client, params) {
|
|
4425
|
+
const emoji = encodeURIComponent(params.emojiName);
|
|
4426
|
+
await client.request(`/users/${params.userId}/posts/${params.postId}/reactions/${emoji}`, { method: "DELETE" });
|
|
4427
|
+
}
|
|
4428
|
+
//#endregion
|
|
4429
|
+
//#region extensions/mattermost/src/normalize.ts
|
|
4430
|
+
function normalizeMattermostMessagingTarget(raw) {
|
|
4431
|
+
const trimmed = raw.trim();
|
|
4432
|
+
if (!trimmed) return;
|
|
4433
|
+
const lower = trimmed.toLowerCase();
|
|
4434
|
+
if (lower.startsWith("channel:")) {
|
|
4435
|
+
const id = trimmed.slice(8).trim();
|
|
4436
|
+
return id ? `channel:${id}` : void 0;
|
|
4437
|
+
}
|
|
4438
|
+
if (lower.startsWith("group:")) {
|
|
4439
|
+
const id = trimmed.slice(6).trim();
|
|
4440
|
+
return id ? `channel:${id}` : void 0;
|
|
4441
|
+
}
|
|
4442
|
+
if (lower.startsWith("user:")) {
|
|
4443
|
+
const id = trimmed.slice(5).trim();
|
|
4444
|
+
return id ? `user:${id}` : void 0;
|
|
4445
|
+
}
|
|
4446
|
+
if (lower.startsWith("mattermost:")) {
|
|
4447
|
+
const id = trimmed.slice(11).trim();
|
|
4448
|
+
return id ? `user:${id}` : void 0;
|
|
4449
|
+
}
|
|
4450
|
+
if (trimmed.startsWith("@")) {
|
|
4451
|
+
const id = trimmed.slice(1).trim();
|
|
4452
|
+
return id ? `@${id}` : void 0;
|
|
4453
|
+
}
|
|
4454
|
+
if (trimmed.startsWith("#")) return;
|
|
4455
|
+
}
|
|
4456
|
+
function looksLikeMattermostTargetId(raw, normalized) {
|
|
4457
|
+
const trimmed = raw.trim();
|
|
4458
|
+
if (!trimmed) return false;
|
|
4459
|
+
if (/^(user|channel|group|mattermost):/i.test(trimmed)) return true;
|
|
4460
|
+
if (trimmed.startsWith("@")) return true;
|
|
4461
|
+
return /^[a-z0-9]{26}$/i.test(trimmed) || /^[a-z0-9]{26}__[a-z0-9]{26}$/i.test(trimmed);
|
|
4462
|
+
}
|
|
4463
|
+
//#endregion
|
|
4464
|
+
//#region extensions/mattermost/src/session-route.ts
|
|
4465
|
+
function resolveMattermostOutboundSessionRoute(params) {
|
|
4466
|
+
let trimmed = stripChannelTargetPrefix(params.target, "mattermost");
|
|
4467
|
+
if (!trimmed) return null;
|
|
4468
|
+
const lower = trimmed.toLowerCase();
|
|
4469
|
+
const resolvedKind = params.resolvedTarget?.kind;
|
|
4470
|
+
const isUser = resolvedKind === "user" || resolvedKind !== "channel" && resolvedKind !== "group" && (lower.startsWith("user:") || trimmed.startsWith("@"));
|
|
4471
|
+
if (trimmed.startsWith("@")) trimmed = trimmed.slice(1).trim();
|
|
4472
|
+
const rawId = stripTargetKindPrefix(trimmed);
|
|
4473
|
+
if (!rawId) return null;
|
|
4474
|
+
const baseRoute = buildChannelOutboundSessionRoute({
|
|
4475
|
+
cfg: params.cfg,
|
|
4476
|
+
agentId: params.agentId,
|
|
4477
|
+
channel: "mattermost",
|
|
4478
|
+
accountId: params.accountId,
|
|
4479
|
+
peer: {
|
|
4480
|
+
kind: isUser ? "direct" : "channel",
|
|
4481
|
+
id: rawId
|
|
4482
|
+
},
|
|
4483
|
+
chatType: isUser ? "direct" : "channel",
|
|
4484
|
+
from: isUser ? `mattermost:${rawId}` : `mattermost:channel:${rawId}`,
|
|
4485
|
+
to: isUser ? `user:${rawId}` : `channel:${rawId}`
|
|
4486
|
+
});
|
|
4487
|
+
const threadId = normalizeOutboundThreadId(params.replyToId ?? params.threadId);
|
|
4488
|
+
const threadKeys = resolveThreadSessionKeys$1({
|
|
4489
|
+
baseSessionKey: baseRoute.baseSessionKey,
|
|
4490
|
+
threadId
|
|
4491
|
+
});
|
|
4492
|
+
return {
|
|
4493
|
+
...baseRoute,
|
|
4494
|
+
sessionKey: threadKeys.sessionKey,
|
|
4495
|
+
...threadId !== void 0 ? { threadId } : {}
|
|
4496
|
+
};
|
|
4497
|
+
}
|
|
4498
|
+
//#endregion
|
|
4499
|
+
//#region extensions/mattermost/src/setup-core.ts
|
|
4500
|
+
const channel$1 = "mattermost";
|
|
4501
|
+
function isMattermostConfigured(account) {
|
|
4502
|
+
return (Boolean(account.botToken?.trim()) || hasConfiguredSecretInput(account.config.botToken)) && Boolean(account.baseUrl);
|
|
4503
|
+
}
|
|
4504
|
+
function resolveMattermostAccountWithSecrets(cfg, accountId) {
|
|
4505
|
+
return resolveMattermostAccount({
|
|
4506
|
+
cfg,
|
|
4507
|
+
accountId,
|
|
4508
|
+
allowUnresolvedSecretRef: true
|
|
4509
|
+
});
|
|
4510
|
+
}
|
|
4511
|
+
const mattermostSetupAdapter = {
|
|
4512
|
+
resolveAccountId: ({ accountId }) => normalizeAccountId(accountId),
|
|
4513
|
+
applyAccountName: ({ cfg, accountId, name }) => applyAccountNameToChannelSection({
|
|
4514
|
+
cfg,
|
|
4515
|
+
channelKey: channel$1,
|
|
4516
|
+
accountId,
|
|
4517
|
+
name
|
|
4518
|
+
}),
|
|
4519
|
+
validateInput: createSetupInputPresenceValidator({
|
|
4520
|
+
defaultAccountOnlyEnvError: "Mattermost env vars can only be used for the default account.",
|
|
4521
|
+
whenNotUseEnv: [{
|
|
4522
|
+
someOf: ["botToken", "token"],
|
|
4523
|
+
message: "Mattermost requires --bot-token and --http-url (or --use-env)."
|
|
4524
|
+
}, {
|
|
4525
|
+
someOf: ["httpUrl"],
|
|
4526
|
+
message: "Mattermost requires --bot-token and --http-url (or --use-env)."
|
|
4527
|
+
}],
|
|
4528
|
+
validate: ({ accountId, input }) => {
|
|
4529
|
+
const token = input.botToken ?? input.token;
|
|
4530
|
+
const baseUrl = normalizeMattermostBaseUrl(input.httpUrl);
|
|
4531
|
+
if (!input.useEnv && (!token || !baseUrl)) return "Mattermost requires --bot-token and --http-url (or --use-env).";
|
|
4532
|
+
if (input.httpUrl && !baseUrl) return "Mattermost --http-url must include a valid base URL.";
|
|
4533
|
+
return null;
|
|
4534
|
+
}
|
|
4535
|
+
}),
|
|
4536
|
+
applyAccountConfig: ({ cfg, accountId, input }) => {
|
|
4537
|
+
const token = input.botToken ?? input.token;
|
|
4538
|
+
const baseUrl = normalizeMattermostBaseUrl(input.httpUrl);
|
|
4539
|
+
const namedConfig = applyAccountNameToChannelSection({
|
|
4540
|
+
cfg,
|
|
4541
|
+
channelKey: channel$1,
|
|
4542
|
+
accountId,
|
|
4543
|
+
name: input.name
|
|
4544
|
+
});
|
|
4545
|
+
return applySetupAccountConfigPatch({
|
|
4546
|
+
cfg: accountId !== "default" ? migrateBaseNameToDefaultAccount({
|
|
4547
|
+
cfg: namedConfig,
|
|
4548
|
+
channelKey: channel$1
|
|
4549
|
+
}) : namedConfig,
|
|
4550
|
+
channelKey: channel$1,
|
|
4551
|
+
accountId,
|
|
4552
|
+
patch: input.useEnv ? {} : {
|
|
4553
|
+
...token ? { botToken: token } : {},
|
|
4554
|
+
...baseUrl ? { baseUrl } : {}
|
|
4555
|
+
}
|
|
4556
|
+
});
|
|
4557
|
+
}
|
|
4558
|
+
};
|
|
4559
|
+
//#endregion
|
|
4560
|
+
//#region extensions/mattermost/src/setup-surface.ts
|
|
4561
|
+
const channel = "mattermost";
|
|
4562
|
+
const mattermostSetupWizard = {
|
|
4563
|
+
channel,
|
|
4564
|
+
status: createStandardChannelSetupStatus({
|
|
4565
|
+
channelLabel: "Mattermost",
|
|
4566
|
+
configuredLabel: "configured",
|
|
4567
|
+
unconfiguredLabel: "needs token + url",
|
|
4568
|
+
configuredHint: "configured",
|
|
4569
|
+
unconfiguredHint: "needs setup",
|
|
4570
|
+
configuredScore: 2,
|
|
4571
|
+
unconfiguredScore: 1,
|
|
4572
|
+
resolveConfigured: ({ cfg }) => listMattermostAccountIds(cfg).some((accountId) => isMattermostConfigured(resolveMattermostAccountWithSecrets(cfg, accountId)))
|
|
4573
|
+
}),
|
|
4574
|
+
introNote: {
|
|
4575
|
+
title: "Mattermost bot token",
|
|
4576
|
+
lines: [
|
|
4577
|
+
"1) Mattermost System Console -> Integrations -> Bot Accounts",
|
|
4578
|
+
"2) Create a bot + copy its token",
|
|
4579
|
+
"3) Use your server base URL (e.g., https://chat.example.com)",
|
|
4580
|
+
"Tip: the bot must be a member of any channel you want it to monitor.",
|
|
4581
|
+
`Docs: ${formatDocsLink("/mattermost", "mattermost")}`
|
|
4582
|
+
],
|
|
4583
|
+
shouldShow: ({ cfg, accountId }) => !isMattermostConfigured(resolveMattermostAccountWithSecrets(cfg, accountId))
|
|
4584
|
+
},
|
|
4585
|
+
envShortcut: {
|
|
4586
|
+
prompt: "MATTERMOST_BOT_TOKEN + MATTERMOST_URL detected. Use env vars?",
|
|
4587
|
+
preferredEnvVar: "MATTERMOST_BOT_TOKEN",
|
|
4588
|
+
isAvailable: ({ cfg, accountId }) => {
|
|
4589
|
+
if (accountId !== "default") return false;
|
|
4590
|
+
const resolvedAccount = resolveMattermostAccountWithSecrets(cfg, accountId);
|
|
4591
|
+
const hasConfigValues = hasConfiguredSecretInput(resolvedAccount.config.botToken) || Boolean(resolvedAccount.config.baseUrl?.trim());
|
|
4592
|
+
return Boolean(process.env.MATTERMOST_BOT_TOKEN?.trim() && process.env.MATTERMOST_URL?.trim() && !hasConfigValues);
|
|
4593
|
+
},
|
|
4594
|
+
apply: ({ cfg, accountId }) => applySetupAccountConfigPatch({
|
|
4595
|
+
cfg,
|
|
4596
|
+
channelKey: channel,
|
|
4597
|
+
accountId,
|
|
4598
|
+
patch: {}
|
|
4599
|
+
})
|
|
4600
|
+
},
|
|
4601
|
+
credentials: [{
|
|
4602
|
+
inputKey: "botToken",
|
|
4603
|
+
providerHint: channel,
|
|
4604
|
+
credentialLabel: "bot token",
|
|
4605
|
+
preferredEnvVar: "MATTERMOST_BOT_TOKEN",
|
|
4606
|
+
envPrompt: "MATTERMOST_BOT_TOKEN + MATTERMOST_URL detected. Use env vars?",
|
|
4607
|
+
keepPrompt: "Mattermost bot token already configured. Keep it?",
|
|
4608
|
+
inputPrompt: "Enter Mattermost bot token",
|
|
4609
|
+
inspect: ({ cfg, accountId }) => {
|
|
4610
|
+
const resolvedAccount = resolveMattermostAccountWithSecrets(cfg, accountId);
|
|
4611
|
+
return {
|
|
4612
|
+
accountConfigured: isMattermostConfigured(resolvedAccount),
|
|
4613
|
+
hasConfiguredValue: hasConfiguredSecretInput(resolvedAccount.config.botToken)
|
|
4614
|
+
};
|
|
4615
|
+
}
|
|
4616
|
+
}],
|
|
4617
|
+
textInputs: [{
|
|
4618
|
+
inputKey: "httpUrl",
|
|
4619
|
+
message: "Enter Mattermost base URL",
|
|
4620
|
+
confirmCurrentValue: false,
|
|
4621
|
+
currentValue: ({ cfg, accountId }) => resolveMattermostAccountWithSecrets(cfg, accountId).baseUrl ?? process.env.MATTERMOST_URL?.trim(),
|
|
4622
|
+
initialValue: ({ cfg, accountId }) => resolveMattermostAccountWithSecrets(cfg, accountId).baseUrl ?? process.env.MATTERMOST_URL?.trim(),
|
|
4623
|
+
shouldPrompt: ({ cfg, accountId, credentialValues, currentValue }) => {
|
|
4624
|
+
const resolvedAccount = resolveMattermostAccountWithSecrets(cfg, accountId);
|
|
4625
|
+
const tokenConfigured = Boolean(resolvedAccount.botToken?.trim()) || hasConfiguredSecretInput(resolvedAccount.config.botToken);
|
|
4626
|
+
return Boolean(credentialValues.botToken) || !tokenConfigured || !currentValue;
|
|
4627
|
+
},
|
|
4628
|
+
validate: ({ value }) => normalizeMattermostBaseUrl(value) ? void 0 : "Mattermost base URL must include a valid base URL.",
|
|
4629
|
+
normalizeValue: ({ value }) => normalizeMattermostBaseUrl(value) ?? value.trim()
|
|
4630
|
+
}],
|
|
4631
|
+
disable: (cfg) => ({
|
|
4632
|
+
...cfg,
|
|
4633
|
+
channels: {
|
|
4634
|
+
...cfg.channels,
|
|
4635
|
+
mattermost: {
|
|
4636
|
+
...cfg.channels?.mattermost,
|
|
4637
|
+
enabled: false
|
|
4638
|
+
}
|
|
4639
|
+
}
|
|
4640
|
+
})
|
|
4641
|
+
};
|
|
4642
|
+
//#endregion
|
|
4643
|
+
//#region extensions/mattermost/src/channel.ts
|
|
4644
|
+
const mattermostSecurityAdapter = createRestrictSendersChannelSecurity({
|
|
4645
|
+
channelKey: "mattermost",
|
|
4646
|
+
resolveDmPolicy: (account) => account.config.dmPolicy,
|
|
4647
|
+
resolveDmAllowFrom: (account) => account.config.allowFrom,
|
|
4648
|
+
resolveGroupPolicy: (account) => account.config.groupPolicy,
|
|
4649
|
+
surface: "Mattermost channels",
|
|
4650
|
+
openScope: "any member",
|
|
4651
|
+
groupPolicyPath: "channels.mattermost.groupPolicy",
|
|
4652
|
+
groupAllowFromPath: "channels.mattermost.groupAllowFrom",
|
|
4653
|
+
policyPathSuffix: "dmPolicy",
|
|
4654
|
+
normalizeDmEntry: (raw) => normalizeAllowEntry(raw)
|
|
4655
|
+
});
|
|
4656
|
+
function describeMattermostMessageTool({ cfg }) {
|
|
4657
|
+
const enabledAccounts = listMattermostAccountIds(cfg).map((accountId) => resolveMattermostAccount({
|
|
4658
|
+
cfg,
|
|
4659
|
+
accountId
|
|
4660
|
+
})).filter((account) => account.enabled).filter((account) => Boolean(account.botToken?.trim() && account.baseUrl?.trim()));
|
|
4661
|
+
const actions = [];
|
|
4662
|
+
if (enabledAccounts.length > 0) actions.push("send");
|
|
4663
|
+
const baseReactions = (cfg.channels?.mattermost?.actions)?.reactions;
|
|
4664
|
+
if (enabledAccounts.some((account) => {
|
|
4665
|
+
return (account.config.actions?.reactions ?? baseReactions ?? true) !== false;
|
|
4666
|
+
})) actions.push("react");
|
|
4667
|
+
return {
|
|
4668
|
+
actions,
|
|
4669
|
+
capabilities: enabledAccounts.length > 0 ? ["buttons"] : [],
|
|
4670
|
+
schema: enabledAccounts.length > 0 ? { properties: { buttons: Type.Optional(createMessageToolButtonsSchema()) } } : null
|
|
4671
|
+
};
|
|
4672
|
+
}
|
|
4673
|
+
const mattermostMessageActions = {
|
|
4674
|
+
describeMessageTool: describeMattermostMessageTool,
|
|
4675
|
+
supportsAction: ({ action }) => {
|
|
4676
|
+
return action === "send" || action === "react";
|
|
4677
|
+
},
|
|
4678
|
+
handleAction: async ({ action, params, cfg, accountId }) => {
|
|
4679
|
+
if (action === "react") {
|
|
4680
|
+
const resolvedAccountId = accountId ?? resolveDefaultMattermostAccountId(cfg);
|
|
4681
|
+
const mattermostConfig = cfg.channels?.mattermost;
|
|
4682
|
+
if (!(resolveMattermostAccount({
|
|
4683
|
+
cfg,
|
|
4684
|
+
accountId: resolvedAccountId
|
|
4685
|
+
}).config.actions?.reactions ?? mattermostConfig?.actions?.reactions ?? true)) throw new Error("Mattermost reactions are disabled in config");
|
|
4686
|
+
const { postId, emojiName, remove } = parseMattermostReactActionParams(params);
|
|
4687
|
+
if (remove) {
|
|
4688
|
+
const result = await removeMattermostReaction({
|
|
4689
|
+
cfg,
|
|
4690
|
+
postId,
|
|
4691
|
+
emojiName,
|
|
4692
|
+
accountId: resolvedAccountId
|
|
4693
|
+
});
|
|
4694
|
+
if (!result.ok) throw new Error(result.error);
|
|
4695
|
+
return {
|
|
4696
|
+
content: [{
|
|
4697
|
+
type: "text",
|
|
4698
|
+
text: `Removed reaction :${emojiName}: from ${postId}`
|
|
4699
|
+
}],
|
|
4700
|
+
details: {}
|
|
4701
|
+
};
|
|
4702
|
+
}
|
|
4703
|
+
const result = await addMattermostReaction({
|
|
4704
|
+
cfg,
|
|
4705
|
+
postId,
|
|
4706
|
+
emojiName,
|
|
4707
|
+
accountId: resolvedAccountId
|
|
4708
|
+
});
|
|
4709
|
+
if (!result.ok) throw new Error(result.error);
|
|
4710
|
+
return {
|
|
4711
|
+
content: [{
|
|
4712
|
+
type: "text",
|
|
4713
|
+
text: `Reacted with :${emojiName}: on ${postId}`
|
|
4714
|
+
}],
|
|
4715
|
+
details: {}
|
|
4716
|
+
};
|
|
4717
|
+
}
|
|
4718
|
+
if (action !== "send") throw new Error(`Unsupported Mattermost action: ${action}`);
|
|
4719
|
+
const to = typeof params.to === "string" ? params.to.trim() : typeof params.target === "string" ? params.target.trim() : "";
|
|
4720
|
+
if (!to) throw new Error("Mattermost send requires a target (to).");
|
|
4721
|
+
const message = typeof params.message === "string" ? params.message : "";
|
|
4722
|
+
const replyToId = readMattermostReplyToId(params);
|
|
4723
|
+
const resolvedAccountId = accountId || void 0;
|
|
4724
|
+
const mediaUrl = typeof params.media === "string" ? params.media.trim() || void 0 : void 0;
|
|
4725
|
+
const result = await sendMessageMattermost(to, message, {
|
|
4726
|
+
accountId: resolvedAccountId,
|
|
4727
|
+
replyToId,
|
|
4728
|
+
buttons: Array.isArray(params.buttons) ? params.buttons : void 0,
|
|
4729
|
+
attachmentText: typeof params.attachmentText === "string" ? params.attachmentText : void 0,
|
|
4730
|
+
mediaUrl
|
|
4731
|
+
});
|
|
4732
|
+
return {
|
|
4733
|
+
content: [{
|
|
4734
|
+
type: "text",
|
|
4735
|
+
text: JSON.stringify({
|
|
4736
|
+
ok: true,
|
|
4737
|
+
channel: "mattermost",
|
|
4738
|
+
messageId: result.messageId,
|
|
4739
|
+
channelId: result.channelId
|
|
4740
|
+
})
|
|
4741
|
+
}],
|
|
4742
|
+
details: {}
|
|
4743
|
+
};
|
|
4744
|
+
}
|
|
4745
|
+
};
|
|
4746
|
+
const meta = {
|
|
4747
|
+
id: "mattermost",
|
|
4748
|
+
label: "Mattermost",
|
|
4749
|
+
selectionLabel: "Mattermost (plugin)",
|
|
4750
|
+
detailLabel: "Mattermost Bot",
|
|
4751
|
+
docsPath: "/channels/mattermost",
|
|
4752
|
+
docsLabel: "mattermost",
|
|
4753
|
+
blurb: "self-hosted Slack-style chat; install the plugin to enable.",
|
|
4754
|
+
systemImage: "bubble.left.and.bubble.right",
|
|
4755
|
+
order: 65,
|
|
4756
|
+
quickstartAllowFrom: true
|
|
4757
|
+
};
|
|
4758
|
+
function readTrimmedString(value) {
|
|
4759
|
+
if (typeof value !== "string") return;
|
|
4760
|
+
return value.trim() || void 0;
|
|
4761
|
+
}
|
|
4762
|
+
function parseMattermostReactActionParams(params) {
|
|
4763
|
+
const postId = readTrimmedString(params.messageId) ?? readTrimmedString(params.postId);
|
|
4764
|
+
if (!postId) throw new Error("Mattermost react requires messageId (post id)");
|
|
4765
|
+
const emojiName = readTrimmedString(params.emoji)?.replace(/^:+|:+$/g, "");
|
|
4766
|
+
if (!emojiName) throw new Error("Mattermost react requires emoji");
|
|
4767
|
+
return {
|
|
4768
|
+
postId,
|
|
4769
|
+
emojiName,
|
|
4770
|
+
remove: params.remove === true
|
|
4771
|
+
};
|
|
4772
|
+
}
|
|
4773
|
+
function readMattermostReplyToId(params) {
|
|
4774
|
+
return readTrimmedString(params.replyToId) ?? readTrimmedString(params.replyTo);
|
|
4775
|
+
}
|
|
4776
|
+
function normalizeAllowEntry(entry) {
|
|
4777
|
+
return entry.trim().replace(/^(mattermost|user):/i, "").replace(/^@/, "").toLowerCase();
|
|
4778
|
+
}
|
|
4779
|
+
function formatAllowEntry(entry) {
|
|
4780
|
+
const trimmed = entry.trim();
|
|
4781
|
+
if (!trimmed) return "";
|
|
4782
|
+
if (trimmed.startsWith("@")) {
|
|
4783
|
+
const username = trimmed.slice(1).trim();
|
|
4784
|
+
return username ? `@${username.toLowerCase()}` : "";
|
|
4785
|
+
}
|
|
4786
|
+
return trimmed.replace(/^(mattermost|user):/i, "").toLowerCase();
|
|
4787
|
+
}
|
|
4788
|
+
const mattermostConfigAdapter = createScopedChannelConfigAdapter({
|
|
4789
|
+
sectionKey: "mattermost",
|
|
4790
|
+
listAccountIds: listMattermostAccountIds,
|
|
4791
|
+
resolveAccount: adaptScopedAccountAccessor(resolveMattermostAccount),
|
|
4792
|
+
defaultAccountId: resolveDefaultMattermostAccountId,
|
|
4793
|
+
clearBaseFields: [
|
|
4794
|
+
"botToken",
|
|
4795
|
+
"baseUrl",
|
|
4796
|
+
"name"
|
|
4797
|
+
],
|
|
4798
|
+
resolveAllowFrom: (account) => account.config.allowFrom,
|
|
4799
|
+
formatAllowFrom: (allowFrom) => formatNormalizedAllowFromEntries({
|
|
4800
|
+
allowFrom,
|
|
4801
|
+
normalizeEntry: formatAllowEntry
|
|
4802
|
+
})
|
|
4803
|
+
});
|
|
4804
|
+
const mattermostPlugin = createChatChannelPlugin({
|
|
4805
|
+
base: {
|
|
4806
|
+
id: "mattermost",
|
|
4807
|
+
meta: { ...meta },
|
|
4808
|
+
setup: mattermostSetupAdapter,
|
|
4809
|
+
setupWizard: mattermostSetupWizard,
|
|
4810
|
+
capabilities: {
|
|
4811
|
+
chatTypes: [
|
|
4812
|
+
"direct",
|
|
4813
|
+
"channel",
|
|
4814
|
+
"group",
|
|
4815
|
+
"thread"
|
|
4816
|
+
],
|
|
4817
|
+
reactions: true,
|
|
4818
|
+
threads: true,
|
|
4819
|
+
media: true,
|
|
4820
|
+
nativeCommands: true
|
|
4821
|
+
},
|
|
4822
|
+
streaming: { blockStreamingCoalesceDefaults: {
|
|
4823
|
+
minChars: 1500,
|
|
4824
|
+
idleMs: 1e3
|
|
4825
|
+
} },
|
|
4826
|
+
reload: { configPrefixes: ["channels.mattermost"] },
|
|
4827
|
+
configSchema: MattermostChannelConfigSchema,
|
|
4828
|
+
config: {
|
|
4829
|
+
...mattermostConfigAdapter,
|
|
4830
|
+
isConfigured: (account) => Boolean(account.botToken && account.baseUrl),
|
|
4831
|
+
describeAccount: (account) => describeAccountSnapshot({
|
|
4832
|
+
account,
|
|
4833
|
+
configured: Boolean(account.botToken && account.baseUrl),
|
|
4834
|
+
extra: {
|
|
4835
|
+
botTokenSource: account.botTokenSource,
|
|
4836
|
+
baseUrl: account.baseUrl
|
|
4837
|
+
}
|
|
4838
|
+
})
|
|
4839
|
+
},
|
|
4840
|
+
auth: mattermostApprovalAuth,
|
|
4841
|
+
groups: { resolveRequireMention: resolveMattermostGroupRequireMention },
|
|
4842
|
+
actions: mattermostMessageActions,
|
|
4843
|
+
directory: createChannelDirectoryAdapter({
|
|
4844
|
+
listGroups: async (params) => listMattermostDirectoryGroups(params),
|
|
4845
|
+
listGroupsLive: async (params) => listMattermostDirectoryGroups(params),
|
|
4846
|
+
listPeers: async (params) => listMattermostDirectoryPeers(params),
|
|
4847
|
+
listPeersLive: async (params) => listMattermostDirectoryPeers(params)
|
|
4848
|
+
}),
|
|
4849
|
+
messaging: {
|
|
4850
|
+
normalizeTarget: normalizeMattermostMessagingTarget,
|
|
4851
|
+
resolveOutboundSessionRoute: (params) => resolveMattermostOutboundSessionRoute(params),
|
|
4852
|
+
targetResolver: {
|
|
4853
|
+
looksLikeId: looksLikeMattermostTargetId,
|
|
4854
|
+
hint: "<channelId|user:ID|channel:ID>",
|
|
4855
|
+
resolveTarget: async ({ cfg, accountId, input }) => {
|
|
4856
|
+
const resolved = await resolveMattermostOpaqueTarget({
|
|
4857
|
+
input,
|
|
4858
|
+
cfg,
|
|
4859
|
+
accountId
|
|
4860
|
+
});
|
|
4861
|
+
if (!resolved) return null;
|
|
4862
|
+
return {
|
|
4863
|
+
to: resolved.to,
|
|
4864
|
+
kind: resolved.kind,
|
|
4865
|
+
source: "directory"
|
|
4866
|
+
};
|
|
4867
|
+
}
|
|
4868
|
+
}
|
|
4869
|
+
},
|
|
4870
|
+
status: createComputedAccountStatusAdapter({
|
|
4871
|
+
defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID, {
|
|
4872
|
+
connected: false,
|
|
4873
|
+
lastConnectedAt: null,
|
|
4874
|
+
lastDisconnect: null
|
|
4875
|
+
}),
|
|
4876
|
+
buildChannelSummary: ({ snapshot }) => buildPassiveProbedChannelStatusSummary(snapshot, {
|
|
4877
|
+
botTokenSource: snapshot.botTokenSource ?? "none",
|
|
4878
|
+
connected: snapshot.connected ?? false,
|
|
4879
|
+
baseUrl: snapshot.baseUrl ?? null
|
|
4880
|
+
}),
|
|
4881
|
+
probeAccount: async ({ account, timeoutMs }) => {
|
|
4882
|
+
const token = account.botToken?.trim();
|
|
4883
|
+
const baseUrl = account.baseUrl?.trim();
|
|
4884
|
+
if (!token || !baseUrl) return {
|
|
4885
|
+
ok: false,
|
|
4886
|
+
error: "bot token or baseUrl missing"
|
|
4887
|
+
};
|
|
4888
|
+
return await probeMattermost(baseUrl, token, timeoutMs, account.config.allowPrivateNetwork === true);
|
|
4889
|
+
},
|
|
4890
|
+
resolveAccountSnapshot: ({ account, runtime }) => ({
|
|
4891
|
+
accountId: account.accountId,
|
|
4892
|
+
name: account.name,
|
|
4893
|
+
enabled: account.enabled,
|
|
4894
|
+
configured: Boolean(account.botToken && account.baseUrl),
|
|
4895
|
+
extra: {
|
|
4896
|
+
botTokenSource: account.botTokenSource,
|
|
4897
|
+
baseUrl: account.baseUrl,
|
|
4898
|
+
connected: runtime?.connected ?? false,
|
|
4899
|
+
lastConnectedAt: runtime?.lastConnectedAt ?? null,
|
|
4900
|
+
lastDisconnect: runtime?.lastDisconnect ?? null
|
|
4901
|
+
}
|
|
4902
|
+
})
|
|
4903
|
+
}),
|
|
4904
|
+
gateway: { startAccount: async (ctx) => {
|
|
4905
|
+
const account = ctx.account;
|
|
4906
|
+
const statusSink = createAccountStatusSink({
|
|
4907
|
+
accountId: ctx.accountId,
|
|
4908
|
+
setStatus: ctx.setStatus
|
|
4909
|
+
});
|
|
4910
|
+
statusSink({
|
|
4911
|
+
baseUrl: account.baseUrl,
|
|
4912
|
+
botTokenSource: account.botTokenSource
|
|
4913
|
+
});
|
|
4914
|
+
ctx.log?.info(`[${account.accountId}] starting channel`);
|
|
4915
|
+
return monitorMattermostProvider({
|
|
4916
|
+
botToken: account.botToken ?? void 0,
|
|
4917
|
+
baseUrl: account.baseUrl ?? void 0,
|
|
4918
|
+
accountId: account.accountId,
|
|
4919
|
+
config: ctx.cfg,
|
|
4920
|
+
runtime: ctx.runtime,
|
|
4921
|
+
abortSignal: ctx.abortSignal,
|
|
4922
|
+
statusSink
|
|
4923
|
+
});
|
|
4924
|
+
} }
|
|
4925
|
+
},
|
|
4926
|
+
pairing: { text: {
|
|
4927
|
+
idLabel: "mattermostUserId",
|
|
4928
|
+
message: "OpenClaw: your access has been approved.",
|
|
4929
|
+
normalizeAllowEntry: (entry) => normalizeAllowEntry(entry),
|
|
4930
|
+
notify: createLoggedPairingApprovalNotifier(({ id }) => `[mattermost] User ${id} approved for pairing`)
|
|
4931
|
+
} },
|
|
4932
|
+
threading: { scopedAccountReplyToMode: {
|
|
4933
|
+
resolveAccount: (cfg, accountId) => resolveMattermostAccount({
|
|
4934
|
+
cfg,
|
|
4935
|
+
accountId: accountId ?? "default"
|
|
4936
|
+
}),
|
|
4937
|
+
resolveReplyToMode: (account, chatType) => resolveMattermostReplyToMode(account, chatType === "direct" || chatType === "group" || chatType === "channel" ? chatType : "channel")
|
|
4938
|
+
} },
|
|
4939
|
+
security: mattermostSecurityAdapter,
|
|
4940
|
+
outbound: {
|
|
4941
|
+
base: {
|
|
4942
|
+
deliveryMode: "direct",
|
|
4943
|
+
chunker: chunkTextForOutbound,
|
|
4944
|
+
chunkerMode: "markdown",
|
|
4945
|
+
textChunkLimit: 4e3,
|
|
4946
|
+
resolveTarget: ({ to }) => {
|
|
4947
|
+
const trimmed = to?.trim();
|
|
4948
|
+
if (!trimmed) return {
|
|
4949
|
+
ok: false,
|
|
4950
|
+
error: /* @__PURE__ */ new Error("Delivering to Mattermost requires --to <channelId|@username|user:ID|channel:ID>")
|
|
4951
|
+
};
|
|
4952
|
+
return {
|
|
4953
|
+
ok: true,
|
|
4954
|
+
to: trimmed
|
|
4955
|
+
};
|
|
4956
|
+
}
|
|
4957
|
+
},
|
|
4958
|
+
attachedResults: {
|
|
4959
|
+
channel: "mattermost",
|
|
4960
|
+
sendText: async ({ cfg, to, text, accountId, replyToId, threadId }) => await sendMessageMattermost(to, text, {
|
|
4961
|
+
cfg,
|
|
4962
|
+
accountId: accountId ?? void 0,
|
|
4963
|
+
replyToId: replyToId ?? (threadId != null ? String(threadId) : void 0)
|
|
4964
|
+
}),
|
|
4965
|
+
sendMedia: async ({ cfg, to, text, mediaUrl, mediaLocalRoots, accountId, replyToId, threadId }) => await sendMessageMattermost(to, text, {
|
|
4966
|
+
cfg,
|
|
4967
|
+
accountId: accountId ?? void 0,
|
|
4968
|
+
mediaUrl,
|
|
4969
|
+
mediaLocalRoots,
|
|
4970
|
+
replyToId: replyToId ?? (threadId != null ? String(threadId) : void 0)
|
|
4971
|
+
})
|
|
4972
|
+
}
|
|
4973
|
+
}
|
|
4974
|
+
});
|
|
4975
|
+
//#endregion
|
|
4976
|
+
export { registerSlashCommandRoute as n, setMattermostRuntime as r, mattermostPlugin as t };
|