@openclaw/discord 2026.11.5 → 2026.11.10-beta.1
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/README.md +37 -0
- package/dist/.setup/{account-inspect-DGkdWwix.mjs → account-inspect-CSz5Qodj.mjs} +2 -3
- package/dist/.setup/{accounts-C_25wyxC.mjs → accounts-DtjvhJUj.mjs} +4 -8
- package/dist/.setup/{active-turn-thread-route-KvRTAVE3.mjs → active-turn-thread-route-DkPnk2x8.mjs} +1 -2
- package/dist/.setup/{allow-list-BXrS8-R9.mjs → allow-list-CkqpzPvP.mjs} +5 -9
- package/dist/.setup/{api-BlBD4ism.mjs → api-C4j_kC-2.mjs} +4 -6
- package/dist/.setup/{approval-handler.runtime-o2N6GRFH.mjs → approval-handler.runtime-DjtQbUPp.mjs} +10 -10
- package/dist/.setup/{approval-message-updates-DKsCfxSW.mjs → approval-message-updates-DqOXxPss.mjs} +3 -4
- package/dist/.setup/{audit-5b-FXj9R.mjs → audit-B9vk3V2z.mjs} +6 -7
- package/dist/.setup/{channel-CplVDtyZ.mjs → channel-Cihfaj84.mjs} +38 -41
- package/dist/.setup/{channel-access-9cyzozUP.mjs → channel-access-DhJhVrdZ.mjs} +1 -2
- package/dist/.setup/{channel.setup-B3MtmBQG.mjs → channel.setup-DmGdG9BH.mjs} +7 -10
- package/dist/.setup/{command-deploy-store-DFkBTViB.mjs → command-deploy-store-DPWiBMks.mjs} +1 -2
- package/dist/.setup/{command-owners-C7rUdqUX.mjs → command-owners-BzlhNBxA.mjs} +1 -2
- package/dist/.setup/{components-YCvQ6YLS.mjs → components-GePlato3.mjs} +10 -16
- package/dist/.setup/{components.base-CiS0h_XP.mjs → components.base-C5sAPHe4.mjs} +1 -2
- package/dist/.setup/config-DDwcUaxT.mjs +20 -0
- package/dist/.setup/{config-schema-BNKN1cu5.mjs → config-schema-D3M1livr.mjs} +5 -7
- package/dist/.setup/{conversation-binding-route-kCTw8cij.mjs → conversation-binding-route-CAaWWJdQ.mjs} +2 -3
- package/dist/.setup/conversation-fork-B6PiUuln.mjs +197 -0
- package/dist/.setup/{directory-config-Ble81PWH.mjs → directory-config-BXJuh9-J.mjs} +3 -4
- package/dist/.setup/directory-live-B9UoQG9g.mjs +90 -0
- package/dist/.setup/{discord-DGVSguhx.mjs → discord-cXPUdHQi.mjs} +98 -77
- package/dist/.setup/{doctor-eujgbnpZ.mjs → doctor-MTAWTgRa.mjs} +7 -8
- package/dist/.setup/{doctor-contract-Bwv8EuQ_.mjs → doctor-contract-Dstl3cMg.mjs} +2 -3
- package/dist/.setup/{endpoint-runtime-lf4DeLas.mjs → endpoint-runtime-BM3x-m6O.mjs} +1 -2
- package/dist/.setup/{guilds-eDq22iSM.mjs → guilds-DYBhgnfq.mjs} +3 -4
- package/dist/.setup/{handle-action-CktwmzMz.mjs → handle-action-El1ok7Ak.mjs} +13 -12
- package/dist/.setup/{handle-action.guild-admin-WLQ7fRqI.mjs → handle-action.guild-admin-CxYfg02j.mjs} +7 -5
- package/dist/.setup/identity-link-B7KOBo_l.mjs +74 -0
- package/dist/.setup/{listeners-Df8lx3vK.mjs → listeners-DIyynRvV.mjs} +2 -3
- package/dist/.setup/{live-policy-config-DiBVuaU6.mjs → live-policy-config-DjIHWFla.mjs} +3 -5
- package/dist/.setup/{message-handler-DeoWTD-4.mjs → message-handler-BoQcvdfV.mjs} +18 -17
- package/dist/.setup/{message-handler.preflight-DKOjgF0z.mjs → message-handler.preflight-C7uhmcsV.mjs} +20 -27
- package/dist/.setup/{message-handler.preflight-pluralkit-CYZfXXb6.mjs → message-handler.preflight-pluralkit-BFntgVKc.mjs} +10 -14
- package/dist/.setup/{message-handler.process-RKRgMCJy.mjs → message-handler.process-B29pkCxQ.mjs} +54 -66
- package/dist/.setup/oauth-http-DdVyzSbo.mjs +40 -0
- package/dist/.setup/{outbound-payload-BaZmjewa.mjs → outbound-payload-Dh6xCO6z.mjs} +18 -13
- package/dist/.setup/{outbound-session-route-Cgx4i9cS.mjs → outbound-session-route-G_fK5RAh.mjs} +22 -34
- package/dist/.setup/{output-activity-uBpMSX75.mjs → output-activity-CDgs2s3O.mjs} +1 -2
- package/dist/.setup/{pluralkit-B64dfq_j.mjs → pluralkit-DcXbHTpQ.mjs} +2 -3
- package/dist/.setup/{preflight-audio-C6QtD6HX.mjs → preflight-audio-r4BbaJxh.mjs} +1 -2
- package/dist/.setup/{presence-cache-Dq-3nH7R.mjs → presence-cache-B3xj3b0l.mjs} +1 -2
- package/dist/.setup/{probe-DezB-6xz.mjs → probe-CfGMZwFD.mjs} +5 -6
- package/dist/.setup/{provider-D63dgDSw.mjs → provider-CnDxdXUm.mjs} +252 -246
- package/dist/.setup/{provider-session.runtime-ePktW62k.mjs → provider-session.runtime-CCBGrm-d.mjs} +3 -3
- package/dist/.setup/provider.runtime-BoSMAwDb.mjs +1 -0
- package/dist/.setup/{proxy-fetch-BzXwBAXt.mjs → proxy-fetch-B8cK6FLQ.mjs} +1 -2
- package/dist/.setup/{realtime-session.runtime-rlZ3WzwC.mjs → realtime-session.runtime-OD95VAEG.mjs} +15 -25
- package/dist/.setup/{receive-recovery-C3Ks4wAQ.mjs → receive-recovery-DV_v5ROf.mjs} +3 -6
- package/dist/.setup/{resolve-allowlist-common-Bk8Fj6Ik.mjs → resolve-allowlist-common-CYdqBUgV.mjs} +3 -4
- package/dist/.setup/{resolve-channels-Bp8frXvc.mjs → resolve-channels-BNnyfCR8.mjs} +10 -9
- package/dist/.setup/{resolve-users-Cvcj22sG.mjs → resolve-users-CDMAGrzv.mjs} +5 -6
- package/dist/.setup/{rolldown-runtime-B4FMCO8f.mjs → rolldown-runtime-nwUcYXjP.mjs} +1 -2
- package/dist/.setup/{runtime-BJaCvlmq.mjs → runtime-CkeNX7ic.mjs} +62 -51
- package/dist/.setup/{runtime-BMgTyuwg.mjs → runtime-DSaHEGJd.mjs} +4 -24
- package/dist/.setup/{runtime-DgnVQ7zW.mjs → runtime-DcBvHOm1.mjs} +1 -2
- package/dist/.setup/{runtime-doctor-migrations-BPV-R4G9.mjs → runtime-doctor-migrations-BpV1jKk0.mjs} +5 -9
- package/dist/.setup/{secret-config-contract-B1kE4sDv.mjs → secret-config-contract-CP6teHec.mjs} +1 -2
- package/dist/.setup/{security-audit-BFT84Uny.mjs → security-audit-CTwisG7c.mjs} +3 -4
- package/dist/.setup/{security-contract-DNyyjTZZ.mjs → security-contract-D-o0iWDk.mjs} +1 -2
- package/dist/.setup/{security-doctor-nGgPm65L.mjs → security-doctor-4s7omTZd.mjs} +1 -2
- package/dist/.setup/{send-CVW7V-VZ.mjs → send-DKzwsZkm.mjs} +28 -32
- package/dist/.setup/{send.components-C8YXdnO_.mjs → send.components-CIZALYDP.mjs} +12 -14
- package/dist/.setup/{send.outbound-Uzcmh3Yd.mjs → send.outbound-cQ4Ohmsc.mjs} +11 -16
- package/dist/.setup/send.permissions-BvH_Dr8p.mjs +369 -0
- package/dist/.setup/{send.receipt-NZDOTZBU.mjs → send.receipt-CZ7ks6g7.mjs} +64 -17
- package/dist/.setup/send.shared-D2lh737v.mjs +259 -0
- package/dist/.setup/{sender-identity-76HFb8eK.mjs → sender-identity-Dt5ELjRN.mjs} +2 -3
- package/dist/.setup/{session-contract-BO5tlIdl.mjs → session-contract-Bq71MS78.mjs} +1 -2
- package/dist/.setup/{session-key-normalization-CCHGNSQw.mjs → session-key-normalization-Cfvze5hd.mjs} +1 -2
- package/dist/.setup/setup-plugin-api-BJt8tAAC.mjs +2 -0
- package/dist/.setup/{shared-yDUSExm2.mjs → shared-Bf7ifHlc.mjs} +14 -17
- package/dist/.setup/{shared-interactive-DmzaoKOM.mjs → shared-interactive-DKBw4SNV.mjs} +7 -12
- package/dist/.setup/{subagent-hooks-CDkdHQyy.mjs → subagent-hooks-CVmIOrAR.mjs} +4 -5
- package/dist/.setup/{system-events-yfWz150v.mjs → system-events-DB6p2H4l.mjs} +3 -4
- package/dist/.setup/{target-parsing-C-HyNxcE.mjs → target-parsing-BiuhcK9Q.mjs} +1 -2
- package/dist/.setup/{target-resolver-BOOzqxxM.mjs → target-resolver-48znkzky.mjs} +6 -7
- package/dist/.setup/{thread-binding-api-BDZJD4na.mjs → thread-binding-api-Drd4Zu-5.mjs} +1 -2
- package/dist/.setup/{thread-bindings-zce4cpu_.mjs → thread-bindings-DTHVdmvF.mjs} +7 -10
- package/dist/.setup/{thread-bindings.manager-NywKzUtc.mjs → thread-bindings.manager-6EnH3YZh.mjs} +45 -30
- package/dist/.setup/{thread-bindings.session-updates-D0j7oh8S.mjs → thread-bindings.session-updates-BPO6pPzd.mjs} +9 -12
- package/dist/.setup/{threading-DodLYDt-.mjs → threading-PC3IIaHd.mjs} +5 -7
- package/dist/.setup/{timeouts-cIxzatmv.mjs → timeouts-CT9hnmo4.mjs} +1 -2
- package/dist/.setup/{transcripts-source-ie9GBWaU.mjs → transcripts-source-C3F_ErM1.mjs} +33 -46
- package/dist/.setup/{typing-CNlSKY5S.mjs → typing-DAv4S2fI.mjs} +2 -3
- package/dist/.setup/{voice-runtime-Dc8Su9Cm.mjs → voice-runtime-CzV3fXxV.mjs} +28 -46
- package/dist/.source-module-urls/d6c089460280c5a04184542d6712e04545caeb1ebb290d3504377b4cc5e22fea.json +1 -1
- package/dist/account-inspect-api.js +2 -3
- package/dist/action-runtime-api.js +1 -1
- package/dist/activities-api.js +10 -50
- package/dist/api.js +21 -22
- package/dist/assets/embedded-app-sdk.mjs +1 -1
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/contract-api.js +1 -1
- package/dist/directory-contract-api.js +2 -3
- package/dist/doctor-contract-api.js +7 -8
- package/dist/index.js +1 -2
- package/dist/runtime-api.js +23 -22
- package/dist/runtime-setter-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/session-key-api.js +1 -1
- package/dist/setup-entry.js +2 -3
- package/dist/setup-plugin-api.js +1 -1
- package/dist/src/voice/audio-worker.runtime.js +14 -26
- package/dist/subagent-hooks-api.js +2 -3
- package/dist/thread-binding-api.js +1 -1
- package/dist/transcripts-source-api.js +2 -3
- package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.cjs +2 -3
- package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.mjs +2 -3
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/zlib.d.ts +752 -0
- package/node_modules/typebox/build/format/date_time.d.mts +2 -1
- package/node_modules/typebox/build/format/date_time.mjs +12 -3
- package/node_modules/typebox/package.json +1 -1
- package/openclaw.plugin.json +7 -2
- package/package.json +5 -5
- package/dist/.setup/directory-live-DH3tpS3x.mjs +0 -144
- package/dist/.setup/provider.runtime-DcNkwhPW.mjs +0 -1
- package/dist/.setup/send.shared-a_6Oeyg1.mjs +0 -589
- package/dist/.setup/setup-plugin-api-BExhGEhL.mjs +0 -2
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { g as resolveDiscordToken, h as normalizeDiscordToken, l as resolveDiscordAccount, m as resolveDiscordMaxLinesPerMessage, p as resolveDiscordAccountDmPolicy, s as mergeDiscordAccountConfig, u as resolveDiscordAccountAllowFrom } from "./accounts-
|
|
2
|
-
import {
|
|
3
|
-
import { B as RateLimitError, J as stripUndefinedFields, L as DISCORD_REST_TIMEOUT_MS, _ as Command, d as hasDiscordV2Components, g as User, h as Message, l as Client, m as Guild, n as GuildCreateListener, o as Modal, r as ReadyListener, t as discord_exports, u as asSerializableComponent, v as CommandWithSubcommands, z as DiscordError } from "./discord-
|
|
4
|
-
import { S as formatDiscordUserTag, _ as resolveDiscordOwnerAllowFrom, a as normalizeDiscordDisplaySlug, b as shouldEmitDiscordReactionNotification, c as resolveDiscordChannelConfig, f as resolveDiscordGuildEntry, g as resolveDiscordOwnerAccess, i as normalizeDiscordAllowList, l as resolveDiscordChannelConfigWithFallback, m as resolveDiscordMemberAllowed, n as hasConfiguredDiscordChannels, o as normalizeDiscordSlug, p as resolveDiscordMemberAccessState, r as isDiscordGroupAllowedByPolicy, s as resolveDiscordAllowListMatch, u as resolveDiscordChannelPolicyCommandAuthorizer, w as isDiscordThreadChannelType, x as formatDiscordReactionEmoji, y as resolveGroupDmAllow } from "./allow-list-
|
|
5
|
-
import {
|
|
6
|
-
import { n as getDiscordEndpointRuntime, t as assertDiscordEndpointGatewayUrl } from "./endpoint-runtime-
|
|
7
|
-
import { n as validateDiscordProxyUrl, r as withValidatedDiscordProxy } from "./proxy-fetch-
|
|
8
|
-
import { a as isDiscordRateLimitResponseBody, s as summarizeDiscordResponseBody } from "./api-
|
|
9
|
-
import { _ as readMessagesDiscord, s as sendVoiceMessageDiscord } from "./send-
|
|
10
|
-
import { s as formatMention, t as sendMessageDiscord } from "./send.outbound-
|
|
11
|
-
import { l as withAbortTimeout } from "./timeouts-
|
|
12
|
-
import { r as setPresence, t as clearPresences } from "./presence-cache-
|
|
13
|
-
import { _ as parseDiscordModalCustomId, a as DISCORD_APPROVAL_DECISIONS, b as encodeCustomIdComponent, g as parseDiscordComponentCustomIdForInteraction, h as parseDiscordComponentCustomId, i as parseDiscordQuestionData, m as parseDiscordActivityCustomIdForInteraction, s as parseExecApprovalData, u as buildDiscordActivityCustomId, v as parseDiscordModalCustomIdForInteraction, y as decodeCustomIdComponent } from "./shared-interactive-
|
|
14
|
-
import { a as buildDiscordComponentMessage } from "./components-
|
|
15
|
-
import { a as registerDiscordComponentEntries, o as resolveDiscordComponentEntryWithPersistence, s as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-
|
|
16
|
-
import { t as getDiscordRuntime } from "./runtime-
|
|
17
|
-
import { n as getDiscordActivitiesRuntime } from "./runtime-
|
|
18
|
-
import { t as resolveDiscordCommandOwnerAllowFrom } from "./command-owners-
|
|
19
|
-
import { D as getDiscordExecApprovalApprovers, _ as resolveDiscordConversationIdentity, a as resolveDiscordComponentSpec, c as formatDiscordApprovalDisplayValue, d as setDiscordPolicyBindings, f as buildDiscordConversationRouteContext, h as resolveDiscordEffectiveRoute, k as isDiscordExecApprovalClientEnabled, m as resolveDiscordConversationRoute, n as DISCORD_PRESENTATION_CAPABILITIES, p as buildDiscordRoutePeer, r as buildDiscordPresentationPayload, s as DISCORD_APPROVAL_ALLOWED_MENTIONS, u as resolveDiscordGroupToolPolicy } from "./outbound-session-route-
|
|
20
|
-
import { n as discordIngressIdentity, t as selectDiscordLivePolicyConfig } from "./live-policy-config-
|
|
21
|
-
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-
|
|
22
|
-
import { t as resolveDiscordUserAllowlist } from "./resolve-users-
|
|
23
|
-
import { a as isThreadArchived, n as getThreadBindingManager } from "./thread-bindings.manager-
|
|
24
|
-
import { n as resolveDiscordChannelNameSafe, r as resolveDiscordChannelTopicSafe, t as resolveDiscordChannelInfoSafe } from "./channel-access-
|
|
25
|
-
import { a as probeDiscordApplicationId, r as parseApplicationIdFromToken } from "./probe-
|
|
26
|
-
import { O as resolveDiscordReferencedReplyMessage, a as resolveDiscordVoiceEnabled, i as setDiscordTranscriptsVoiceManager, k as resolveDiscordReferencedReplyMessageId, l as resolveDiscordThreadLikeChannelContext, o as authorizeDiscordVoiceIngress, s as resolveDiscordVoiceAccess, u as resolveFetchedDiscordThreadLikeChannelContext } from "./transcripts-source-
|
|
27
|
-
import { t as resolveDiscordSenderIdentity } from "./sender-identity-
|
|
28
|
-
import { n as hasDiscordApprovalControl, t as discordApprovalMessageUpdates } from "./approval-message-updates-
|
|
1
|
+
import { g as resolveDiscordToken, h as normalizeDiscordToken, l as resolveDiscordAccount, m as resolveDiscordMaxLinesPerMessage, p as resolveDiscordAccountDmPolicy, s as mergeDiscordAccountConfig, u as resolveDiscordAccountAllowFrom } from "./accounts-DtjvhJUj.mjs";
|
|
2
|
+
import { _ as registerGateway, c as hasAnyChannelPermissionDiscord, d as createDiscordRestClient, r as canViewDiscordGuildChannel, v as unregisterGateway } from "./send.permissions-BvH_Dr8p.mjs";
|
|
3
|
+
import { B as RateLimitError, J as stripUndefinedFields, L as DISCORD_REST_TIMEOUT_MS, _ as Command, d as hasDiscordV2Components, g as User, h as Message, l as Client, m as Guild, n as GuildCreateListener, o as Modal, r as ReadyListener, t as discord_exports, u as asSerializableComponent, v as CommandWithSubcommands, z as DiscordError } from "./discord-cXPUdHQi.mjs";
|
|
4
|
+
import { S as formatDiscordUserTag, _ as resolveDiscordOwnerAllowFrom, a as normalizeDiscordDisplaySlug, b as shouldEmitDiscordReactionNotification, c as resolveDiscordChannelConfig, f as resolveDiscordGuildEntry, g as resolveDiscordOwnerAccess, i as normalizeDiscordAllowList, l as resolveDiscordChannelConfigWithFallback, m as resolveDiscordMemberAllowed, n as hasConfiguredDiscordChannels, o as normalizeDiscordSlug, p as resolveDiscordMemberAccessState, r as isDiscordGroupAllowedByPolicy, s as resolveDiscordAllowListMatch, u as resolveDiscordChannelPolicyCommandAuthorizer, w as isDiscordThreadChannelType, x as formatDiscordReactionEmoji, y as resolveGroupDmAllow } from "./allow-list-CkqpzPvP.mjs";
|
|
5
|
+
import { S as chunkDiscordTextWithMode } from "./send.receipt-CZ7ks6g7.mjs";
|
|
6
|
+
import { n as getDiscordEndpointRuntime, t as assertDiscordEndpointGatewayUrl } from "./endpoint-runtime-BM3x-m6O.mjs";
|
|
7
|
+
import { n as validateDiscordProxyUrl, r as withValidatedDiscordProxy } from "./proxy-fetch-B8cK6FLQ.mjs";
|
|
8
|
+
import { a as isDiscordRateLimitResponseBody, s as summarizeDiscordResponseBody } from "./api-C4j_kC-2.mjs";
|
|
9
|
+
import { _ as readMessagesDiscord, s as sendVoiceMessageDiscord } from "./send-DKzwsZkm.mjs";
|
|
10
|
+
import { s as formatMention, t as sendMessageDiscord } from "./send.outbound-cQ4Ohmsc.mjs";
|
|
11
|
+
import { l as withAbortTimeout } from "./timeouts-CT9hnmo4.mjs";
|
|
12
|
+
import { r as setPresence, t as clearPresences } from "./presence-cache-B3xj3b0l.mjs";
|
|
13
|
+
import { _ as parseDiscordModalCustomId, a as DISCORD_APPROVAL_DECISIONS, b as encodeCustomIdComponent, g as parseDiscordComponentCustomIdForInteraction, h as parseDiscordComponentCustomId, i as parseDiscordQuestionData, m as parseDiscordActivityCustomIdForInteraction, s as parseExecApprovalData, u as buildDiscordActivityCustomId, v as parseDiscordModalCustomIdForInteraction, y as decodeCustomIdComponent } from "./shared-interactive-DKBw4SNV.mjs";
|
|
14
|
+
import { a as buildDiscordComponentMessage } from "./components-GePlato3.mjs";
|
|
15
|
+
import { a as registerDiscordComponentEntries, o as resolveDiscordComponentEntryWithPersistence, s as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-CIZALYDP.mjs";
|
|
16
|
+
import { t as getDiscordRuntime } from "./runtime-DcBvHOm1.mjs";
|
|
17
|
+
import { n as getDiscordActivitiesRuntime } from "./runtime-DSaHEGJd.mjs";
|
|
18
|
+
import { t as resolveDiscordCommandOwnerAllowFrom } from "./command-owners-BzlhNBxA.mjs";
|
|
19
|
+
import { D as getDiscordExecApprovalApprovers, _ as resolveDiscordConversationIdentity, a as resolveDiscordComponentSpec, c as formatDiscordApprovalDisplayValue, d as setDiscordPolicyBindings, f as buildDiscordConversationRouteContext, h as resolveDiscordEffectiveRoute, k as isDiscordExecApprovalClientEnabled, m as resolveDiscordConversationRoute, n as DISCORD_PRESENTATION_CAPABILITIES, p as buildDiscordRoutePeer, r as buildDiscordPresentationPayload, s as DISCORD_APPROVAL_ALLOWED_MENTIONS, u as resolveDiscordGroupToolPolicy } from "./outbound-session-route-G_fK5RAh.mjs";
|
|
20
|
+
import { n as discordIngressIdentity, t as selectDiscordLivePolicyConfig } from "./live-policy-config-DjIHWFla.mjs";
|
|
21
|
+
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-BNnyfCR8.mjs";
|
|
22
|
+
import { t as resolveDiscordUserAllowlist } from "./resolve-users-CDMAGrzv.mjs";
|
|
23
|
+
import { a as isThreadArchived, n as getThreadBindingManager } from "./thread-bindings.manager-6EnH3YZh.mjs";
|
|
24
|
+
import { n as resolveDiscordChannelNameSafe, r as resolveDiscordChannelTopicSafe, t as resolveDiscordChannelInfoSafe } from "./channel-access-DhJhVrdZ.mjs";
|
|
25
|
+
import { a as probeDiscordApplicationId, r as parseApplicationIdFromToken } from "./probe-CfGMZwFD.mjs";
|
|
26
|
+
import { O as resolveDiscordReferencedReplyMessage, a as resolveDiscordVoiceEnabled, i as setDiscordTranscriptsVoiceManager, k as resolveDiscordReferencedReplyMessageId, l as resolveDiscordThreadLikeChannelContext, o as authorizeDiscordVoiceIngress, s as resolveDiscordVoiceAccess, u as resolveFetchedDiscordThreadLikeChannelContext } from "./transcripts-source-C3F_ErM1.mjs";
|
|
27
|
+
import { t as resolveDiscordSenderIdentity } from "./sender-identity-Dt5ELjRN.mjs";
|
|
28
|
+
import { n as hasDiscordApprovalControl, t as discordApprovalMessageUpdates } from "./approval-message-updates-DqOXxPss.mjs";
|
|
29
29
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
30
30
|
import { PlatformMessageNotDispatchedError, formatErrorMessage, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
|
|
31
31
|
import { createNonExitingRuntime, createSubsystemLogger, danger, formatDurationSeconds, logVerbose, shouldLogVerbose, sleepWithAbort, warn } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -34,8 +34,9 @@ import { resolveAgentRoute } from "openclaw/plugin-sdk/routing";
|
|
|
34
34
|
import { asFiniteNumber, asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeStringEntries, parseFiniteNumber, readNonBlankString, summarizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
35
35
|
import { captureRuntimeConfigAsyncReader, createRuntimeConfigReader, getRuntimeConfigSnapshot } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
36
36
|
import { ApplicationCommandOptionType, ButtonStyle, ChannelType, ComponentType, GatewayCloseCodes, GatewayCloseCodes as GatewayCloseCodes$1, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes, PermissionFlagsBits } from "discord-api-types/v10";
|
|
37
|
-
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
|
|
38
|
-
import {
|
|
37
|
+
import { MediaFetchError, buildOutboundMediaLoadOptions, getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
|
|
38
|
+
import { resolveOutboundMediaAccessForConfig } from "openclaw/plugin-sdk/outbound-media";
|
|
39
|
+
import { appendReplyMediaFailures, hasOutboundReplyContent, resolveSendableOutboundReplyParts, resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
39
40
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
40
41
|
import { MAX_TIMER_TIMEOUT_MS, asDateTimestampMs, asSafeIntegerInRange, parseStrictInteger, parseStrictPositiveInteger, resolvePromptHistoryLimit } from "openclaw/plugin-sdk/number-runtime";
|
|
41
42
|
import { resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-chunking";
|
|
@@ -50,7 +51,7 @@ import { createHash, randomUUID } from "node:crypto";
|
|
|
50
51
|
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
51
52
|
import { sliceUtf16Safe, truncateCodePoints, truncateUtf16Safe, withTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
52
53
|
import { addAllowlistUserEntriesFromConfigEntry, buildAllowlistResolutionSummary, canonicalizeAllowlistWithResolvedIds, patchAllowlistUsersInConfigEntries, summarizeMapping } from "openclaw/plugin-sdk/allow-from";
|
|
53
|
-
import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
|
|
54
|
+
import { LocalMediaAccessError, loadWebMedia } from "openclaw/plugin-sdk/web-media";
|
|
54
55
|
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
55
56
|
import { buildOutboundSessionContext, listMessageReceiptPlatformIds, resolveChannelStreamingBlockEnabled, sendDurableMessageBatch } from "openclaw/plugin-sdk/channel-outbound";
|
|
56
57
|
import { resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
|
|
@@ -67,18 +68,18 @@ import { readChannelIngressStoreAllowFromForDmPolicy } from "openclaw/plugin-sdk
|
|
|
67
68
|
import { enqueueKeyedTask } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
68
69
|
import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
|
|
69
70
|
import { resolveNativeCommandsEnabled, resolveNativeSkillsEnabled } from "openclaw/plugin-sdk/native-command-config-runtime";
|
|
71
|
+
import { buildChannelInboundEventContext, createChannelPartialDeliveryError, createCommandTurnContext, dispatchChannelInboundTurn, formatInboundEnvelope, hasVisibleInboundReplyDispatch, isChannelPartialDeliveryError, resolveEnvelopeFormatOptions, resolveInboundSupplementalSenderAllowed, runChannelInboundEvent } from "openclaw/plugin-sdk/channel-inbound";
|
|
70
72
|
import { clearExpiredCooldowns, ensureAuthProfileStoreAsync, formatReasoningMessage, getPreparedModelCatalogSnapshot, isProfileInCooldown, listAgentIds, loadPreparedModelCatalog, resolveAgentAvatar, resolveAgentDir, resolveDefaultModelForAgent, resolveHumanDelayConfig, resolveProfilesUnavailableReason } from "openclaw/plugin-sdk/agent-runtime";
|
|
71
73
|
import { deleteSessionEntry, getSessionEntryAsync, listSessionEntriesAsync, readSessionUpdatedAtAsync, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
72
74
|
import { enqueueRoutedSystemEvent } from "openclaw/plugin-sdk/system-event-runtime";
|
|
73
|
-
import { buildChannelInboundEventContext, createChannelPartialDeliveryError, createCommandTurnContext, dispatchChannelInboundTurn, formatInboundEnvelope, hasVisibleInboundReplyDispatch, isChannelPartialDeliveryError, resolveEnvelopeFormatOptions, resolveInboundSupplementalSenderAllowed, runChannelInboundEvent } from "openclaw/plugin-sdk/channel-inbound";
|
|
74
75
|
import { captureHttpExchangeAsync, captureWsEventAsync, resolveDebugProxySettings, resolveEffectiveDebugProxyUrl } from "openclaw/plugin-sdk/proxy-capture";
|
|
75
76
|
import { resolveRequestUrl } from "openclaw/plugin-sdk/request-url";
|
|
76
77
|
import { fetchWithRuntimeDispatcher } from "openclaw/plugin-sdk/runtime-fetch";
|
|
77
78
|
import * as dns from "node:dns";
|
|
78
79
|
import { resolveDirectStatusReplyForSession } from "openclaw/plugin-sdk/command-status-runtime";
|
|
79
80
|
import { buildCommandTextFromArgs, findCommandByNativeName, mergeNativeCommandSpecs, parseCommandArgs, resolveCommandArgChoices, resolveCommandArgMenuAsync, serializeCommandArgs } from "openclaw/plugin-sdk/native-command-registry";
|
|
81
|
+
import { PLUGIN_COMMAND_DISPATCH, pluginCommandResultContinuesAgent } from "openclaw/plugin-sdk/plugin-command-runtime";
|
|
80
82
|
import { recordDeliveredCommandExchange } from "openclaw/plugin-sdk/session-transcript-runtime";
|
|
81
|
-
import { PLUGIN_COMMAND_DISPATCH } from "openclaw/plugin-sdk/plugin-command-runtime";
|
|
82
83
|
import { buildCommandTextFromArgs as buildCommandTextFromArgs$1, findCommandByNativeName as findCommandByNativeName$1, formatCommandArgMenuTitle, listChatCommands, listNativeCommandSpecsForConfig, prepareSkillCommandsForAgents, resolveCommandAuthorization, resolveCommandAuthorizationAsync, resolveCommandAuthorizedFromAuthorizers, resolveEffectiveAgentRuntime, resolveNativeCommandSessionTargets, resolveStoredModelOverrideAsync, serializeCommandArgs as serializeCommandArgs$1 } from "openclaw/plugin-sdk/command-auth-native";
|
|
83
84
|
import { MODEL_PICKER_CHANGED_MESSAGE, getModelsRuntimeChoices } from "openclaw/plugin-sdk/models-provider-runtime";
|
|
84
85
|
import { normalizeProviderId } from "openclaw/plugin-sdk/model-ref-parse";
|
|
@@ -94,11 +95,11 @@ import { inspect } from "node:util";
|
|
|
94
95
|
import { channelReadyPatch, createTransportActivityStatusPatch } from "openclaw/plugin-sdk/gateway-runtime";
|
|
95
96
|
import { Agent } from "node:https";
|
|
96
97
|
import { reportChannelRoomJoin } from "openclaw/plugin-sdk/channel-join-intro-runtime";
|
|
97
|
-
|
|
98
|
+
// extensions/discord/src/monitor/listeners.queue.ts
|
|
98
99
|
const DISCORD_SLOW_LISTENER_THRESHOLD_MS = 3e4;
|
|
99
100
|
const discordEventQueueLog = createSubsystemLogger("discord/event-queue");
|
|
100
101
|
async function runDiscordListenerWithSlowLog(params) {
|
|
101
|
-
const startedAt =
|
|
102
|
+
const startedAt = performance.now();
|
|
102
103
|
try {
|
|
103
104
|
await params.run();
|
|
104
105
|
} catch (err) {
|
|
@@ -109,7 +110,7 @@ async function runDiscordListenerWithSlowLog(params) {
|
|
|
109
110
|
throw err;
|
|
110
111
|
} finally {
|
|
111
112
|
const { logger, listener, event } = params;
|
|
112
|
-
const durationMs =
|
|
113
|
+
const durationMs = performance.now() - startedAt;
|
|
113
114
|
if (!(durationMs < DISCORD_SLOW_LISTENER_THRESHOLD_MS)) {
|
|
114
115
|
const duration = formatDurationSeconds(durationMs, {
|
|
115
116
|
decimals: 1,
|
|
@@ -126,8 +127,7 @@ async function runDiscordListenerWithSlowLog(params) {
|
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
|
-
|
|
130
|
-
//#region extensions/discord/src/monitor/presence-events.ts
|
|
130
|
+
// extensions/discord/src/monitor/presence-events.ts
|
|
131
131
|
const DISCORD_PRESENCE_GREETING_COOLDOWN_MS = 288e5;
|
|
132
132
|
function isDiscordOnlineStatus(status) {
|
|
133
133
|
return status === "online" || status === "idle" || status === "dnd";
|
|
@@ -154,8 +154,7 @@ function resolveDiscordOnlinePresenceEvent(params) {
|
|
|
154
154
|
text: lines.join("\n")
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
|
-
|
|
158
|
-
//#region extensions/discord/src/monitor/presence-cooldown-store.ts
|
|
157
|
+
// extensions/discord/src/monitor/presence-cooldown-store.ts
|
|
159
158
|
const DISCORD_PRESENCE_COOLDOWN_MAX_ENTRIES = 25e3;
|
|
160
159
|
function openDiscordPresenceCooldownStore() {
|
|
161
160
|
return getDiscordRuntime().state.openKeyedStore({
|
|
@@ -165,8 +164,7 @@ function openDiscordPresenceCooldownStore() {
|
|
|
165
164
|
defaultTtlMs: DISCORD_PRESENCE_GREETING_COOLDOWN_MS
|
|
166
165
|
});
|
|
167
166
|
}
|
|
168
|
-
|
|
169
|
-
//#region extensions/discord/src/monitor/presence-emission-gate.ts
|
|
167
|
+
// extensions/discord/src/monitor/presence-emission-gate.ts
|
|
170
168
|
const DISCORD_PRESENCE_RECONNECT_SUPPRESS_MS = 3e5;
|
|
171
169
|
const DISCORD_PRESENCE_BURST_LIMIT = 8;
|
|
172
170
|
const DISCORD_PRESENCE_BURST_WINDOW_MS = 6e4;
|
|
@@ -240,8 +238,7 @@ var DiscordPresenceEmissionGate = class {
|
|
|
240
238
|
if (state.reservations.length === 0 && !state.logged) this.burstByGuild.delete(guildId);
|
|
241
239
|
}
|
|
242
240
|
};
|
|
243
|
-
|
|
244
|
-
//#region extensions/discord/src/monitor/presence-transition-cache.ts
|
|
241
|
+
// extensions/discord/src/monitor/presence-transition-cache.ts
|
|
245
242
|
const DEFAULT_PRESENCE_BASELINE_MAX_ENTRIES = 75e3;
|
|
246
243
|
var DiscordPresenceBaselineCache = class {
|
|
247
244
|
constructor(maxEntries = DEFAULT_PRESENCE_BASELINE_MAX_ENTRIES) {
|
|
@@ -283,8 +280,7 @@ var DiscordPresenceBaselineCache = class {
|
|
|
283
280
|
return evictedScope;
|
|
284
281
|
}
|
|
285
282
|
};
|
|
286
|
-
|
|
287
|
-
//#region extensions/discord/src/monitor/thread-session-close.ts
|
|
283
|
+
// extensions/discord/src/monitor/thread-session-close.ts
|
|
288
284
|
/**
|
|
289
285
|
* Closes every session entry in the store whose key contains {@link threadId}.
|
|
290
286
|
* The explicit lifecycle deletion archives the old transcript and guarantees
|
|
@@ -314,8 +310,7 @@ async function closeDiscordThreadSessions(params) {
|
|
|
314
310
|
}
|
|
315
311
|
return resetCount;
|
|
316
312
|
}
|
|
317
|
-
|
|
318
|
-
//#region extensions/discord/src/monitor/dm-command-auth.ts
|
|
313
|
+
// extensions/discord/src/monitor/dm-command-auth.ts
|
|
319
314
|
const DISCORD_CHANNEL_ID = "discord";
|
|
320
315
|
function createDiscordDmIngressSubject(sender) {
|
|
321
316
|
return {
|
|
@@ -417,8 +412,7 @@ async function resolveDiscordTextCommandAccess(params) {
|
|
|
417
412
|
}
|
|
418
413
|
});
|
|
419
414
|
}
|
|
420
|
-
|
|
421
|
-
//#region extensions/discord/src/monitor/listeners.reactions.ts
|
|
415
|
+
// extensions/discord/src/monitor/listeners.reactions.ts
|
|
422
416
|
var DiscordReactionListener = class {
|
|
423
417
|
constructor(params) {
|
|
424
418
|
this.params = params;
|
|
@@ -649,8 +643,7 @@ async function runDiscordReactionHandler(params) {
|
|
|
649
643
|
eventParams.logger.error(danger(`discord reaction handler failed: ${String(err)}`));
|
|
650
644
|
}
|
|
651
645
|
}
|
|
652
|
-
|
|
653
|
-
//#region extensions/discord/src/monitor/listeners.ts
|
|
646
|
+
// extensions/discord/src/monitor/listeners.ts
|
|
654
647
|
function registerDiscordListener(listeners, listener) {
|
|
655
648
|
if (listeners.some((existing) => existing.constructor === listener.constructor)) return false;
|
|
656
649
|
listeners.push(listener);
|
|
@@ -685,6 +678,45 @@ var DiscordInteractionListener = class {
|
|
|
685
678
|
});
|
|
686
679
|
}
|
|
687
680
|
};
|
|
681
|
+
async function isDiscordPresenceMemberAllowed(params) {
|
|
682
|
+
const { client, guildInfo } = params;
|
|
683
|
+
let channelConfig = null;
|
|
684
|
+
if (hasConfiguredDiscordChannels(guildInfo.channels)) {
|
|
685
|
+
const fetched = await client.fetchChannel(params.channelId);
|
|
686
|
+
if (!fetched) return false;
|
|
687
|
+
const channel = await resolveFetchedDiscordThreadLikeChannelContext({
|
|
688
|
+
client,
|
|
689
|
+
channel: fetched,
|
|
690
|
+
channelIdFallback: params.channelId
|
|
691
|
+
});
|
|
692
|
+
channelConfig = resolveDiscordChannelConfigWithFallback({
|
|
693
|
+
guildInfo,
|
|
694
|
+
channelId: params.channelId,
|
|
695
|
+
channelName: channel.channelName,
|
|
696
|
+
channelSlug: channel.channelSlug,
|
|
697
|
+
parentId: channel.isThreadChannel ? channel.threadParentId : channel.parentId,
|
|
698
|
+
parentName: channel.isThreadChannel ? channel.threadParentName : void 0,
|
|
699
|
+
parentSlug: channel.isThreadChannel ? channel.threadParentSlug : "",
|
|
700
|
+
scope: channel.isThreadChannel ? "thread" : "channel"
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
const sender = params.allowNameMatching ? await client.fetchUser(params.userId).then((user) => ({
|
|
704
|
+
id: user.id,
|
|
705
|
+
name: user.username,
|
|
706
|
+
tag: formatDiscordUserTag(user)
|
|
707
|
+
})) : { id: params.userId };
|
|
708
|
+
const access = (memberRoleIds) => resolveDiscordMemberAccessState({
|
|
709
|
+
channelConfig,
|
|
710
|
+
guildInfo,
|
|
711
|
+
memberRoleIds,
|
|
712
|
+
sender,
|
|
713
|
+
allowNameMatching: params.allowNameMatching
|
|
714
|
+
});
|
|
715
|
+
const { hasAccessRestrictions, memberAllowed } = access([]);
|
|
716
|
+
if (!hasAccessRestrictions || memberAllowed) return true;
|
|
717
|
+
if (!(channelConfig?.roles ?? guildInfo.roles)?.length) return false;
|
|
718
|
+
return access((await client.fetchMember(params.guildId, params.userId)).roles).memberAllowed;
|
|
719
|
+
}
|
|
688
720
|
var DiscordPresenceListener = class {
|
|
689
721
|
constructor(params) {
|
|
690
722
|
this.params = params;
|
|
@@ -787,11 +819,12 @@ var DiscordPresenceListener = class {
|
|
|
787
819
|
if (this.stopped) return;
|
|
788
820
|
const policy = await this.params.readPolicy?.();
|
|
789
821
|
const cfg = policy?.cfg ?? this.params.cfg;
|
|
790
|
-
const
|
|
822
|
+
const guildInfo = resolveDiscordGuildEntry({
|
|
791
823
|
guildId: data.guild_id,
|
|
792
824
|
guildEntries: policy ? policy.guildEntries : this.params.guildEntries
|
|
793
|
-
})
|
|
794
|
-
|
|
825
|
+
});
|
|
826
|
+
const config = guildInfo?.presenceEvents;
|
|
827
|
+
if (!guildInfo || !config || config.enabled === false) return;
|
|
795
828
|
if (config.users !== void 0 && !config.users.includes(userId)) return;
|
|
796
829
|
const route = resolveAgentRoute({
|
|
797
830
|
cfg,
|
|
@@ -851,6 +884,17 @@ var DiscordPresenceListener = class {
|
|
|
851
884
|
this.recordPresenceBaseline(data.guild_id, presenceKey, "online");
|
|
852
885
|
return;
|
|
853
886
|
}
|
|
887
|
+
if (!await isDiscordPresenceMemberAllowed({
|
|
888
|
+
client,
|
|
889
|
+
guildInfo,
|
|
890
|
+
guildId: data.guild_id,
|
|
891
|
+
channelId: presenceEvent.channelId,
|
|
892
|
+
userId,
|
|
893
|
+
allowNameMatching: policy?.allowNameMatching ?? this.params.allowNameMatching ?? false
|
|
894
|
+
})) {
|
|
895
|
+
this.recordPresenceBaseline(data.guild_id, presenceKey, "online");
|
|
896
|
+
return;
|
|
897
|
+
}
|
|
854
898
|
if (!await canViewDiscordGuildChannel(data.guild_id, presenceEvent.channelId, userId, {
|
|
855
899
|
cfg,
|
|
856
900
|
accountId: this.params.accountId,
|
|
@@ -1023,8 +1067,7 @@ var DiscordThreadDeleteListener = class {
|
|
|
1023
1067
|
});
|
|
1024
1068
|
}
|
|
1025
1069
|
};
|
|
1026
|
-
|
|
1027
|
-
//#region extensions/discord/src/internal/gateway-dispatch.ts
|
|
1070
|
+
// extensions/discord/src/internal/gateway-dispatch.ts
|
|
1028
1071
|
function mapGatewayDispatchData(client, type, data) {
|
|
1029
1072
|
if (type === GatewayDispatchEvents.MessageCreate) return createMessageDispatchData(client, data);
|
|
1030
1073
|
if (type === GatewayDispatchEvents.MessageReactionAdd || type === GatewayDispatchEvents.MessageReactionRemove) return createReactionDispatchData(client, data);
|
|
@@ -1064,8 +1107,7 @@ function createReactionDispatchData(client, data) {
|
|
|
1064
1107
|
})
|
|
1065
1108
|
};
|
|
1066
1109
|
}
|
|
1067
|
-
|
|
1068
|
-
//#region extensions/discord/src/monitor/provider.allowlist.ts
|
|
1110
|
+
// extensions/discord/src/monitor/provider.allowlist.ts
|
|
1069
1111
|
function formatResolutionLogDetails(base, details) {
|
|
1070
1112
|
const nonEmpty = details.map((value) => value?.trim()).filter((value) => Boolean(value));
|
|
1071
1113
|
return nonEmpty.length > 0 ? `${base} (${nonEmpty.join("; ")})` : base;
|
|
@@ -1264,8 +1306,7 @@ async function resolveDiscordAllowlistConfig(params) {
|
|
|
1264
1306
|
allowFrom
|
|
1265
1307
|
};
|
|
1266
1308
|
}
|
|
1267
|
-
|
|
1268
|
-
//#region extensions/discord/src/network-config.ts
|
|
1309
|
+
// extensions/discord/src/network-config.ts
|
|
1269
1310
|
const DISCORD_DNS_HOSTS = [
|
|
1270
1311
|
"discord.com",
|
|
1271
1312
|
"discord.gg",
|
|
@@ -1315,8 +1356,7 @@ function createDiscordEndpointDnsLookup(endpointHostname) {
|
|
|
1315
1356
|
});
|
|
1316
1357
|
};
|
|
1317
1358
|
}
|
|
1318
|
-
|
|
1319
|
-
//#region extensions/discord/src/monitor/rest-fetch.ts
|
|
1359
|
+
// extensions/discord/src/monitor/rest-fetch.ts
|
|
1320
1360
|
const discordDnsLookup$1 = createDiscordDnsLookup();
|
|
1321
1361
|
function createDiscordRestFetchWithDispatcher(dispatcher) {
|
|
1322
1362
|
return wrapFetchWithAbortSignal(((input, init) => fetchWithRuntimeDispatcher(input, {
|
|
@@ -1355,8 +1395,7 @@ function resolveDiscordRestFetch(proxyUrl, runtime) {
|
|
|
1355
1395
|
}
|
|
1356
1396
|
return createDiscordRestFetchWithDispatcher(dispatcher ?? createHttp1Agent({ connect: { lookup: discordDnsLookup$1 } }));
|
|
1357
1397
|
}
|
|
1358
|
-
|
|
1359
|
-
//#region extensions/discord/src/monitor/live-policy.ts
|
|
1398
|
+
// extensions/discord/src/monitor/live-policy.ts
|
|
1360
1399
|
/** One reader belongs to one admitted account; transport and lifetime remain its startup owners. */
|
|
1361
1400
|
function createDiscordLivePolicyReader(params) {
|
|
1362
1401
|
const readConfig = params.readConfig ?? createRuntimeConfigReader(params.cfg);
|
|
@@ -1454,8 +1493,7 @@ function createDiscordLivePolicyReader(params) {
|
|
|
1454
1493
|
}
|
|
1455
1494
|
};
|
|
1456
1495
|
}
|
|
1457
|
-
|
|
1458
|
-
//#region extensions/discord/src/monitor/dm-command-decision.ts
|
|
1496
|
+
// extensions/discord/src/monitor/dm-command-decision.ts
|
|
1459
1497
|
async function handleDiscordDmCommandDecision(params) {
|
|
1460
1498
|
if (params.senderAccess.decision === "pairing") {
|
|
1461
1499
|
const result = await createChannelPairingChallengeIssuer({
|
|
@@ -1481,8 +1519,7 @@ async function handleDiscordDmCommandDecision(params) {
|
|
|
1481
1519
|
}
|
|
1482
1520
|
await params.onUnauthorized();
|
|
1483
1521
|
}
|
|
1484
|
-
|
|
1485
|
-
//#region extensions/discord/src/monitor/live-policy-interaction.ts
|
|
1522
|
+
// extensions/discord/src/monitor/live-policy-interaction.ts
|
|
1486
1523
|
const INTERACTION_POLICY_WAIT_MS = 1e3;
|
|
1487
1524
|
async function readDiscordInteractionPolicy(readPolicy) {
|
|
1488
1525
|
const timeout = /* @__PURE__ */ new Error("Discord interaction access policy resolution timed out");
|
|
@@ -1493,8 +1530,7 @@ async function readDiscordInteractionPolicy(readPolicy) {
|
|
|
1493
1530
|
return null;
|
|
1494
1531
|
}
|
|
1495
1532
|
}
|
|
1496
|
-
|
|
1497
|
-
//#region extensions/discord/src/monitor/native-command-reply.ts
|
|
1533
|
+
// extensions/discord/src/monitor/native-command-reply.ts
|
|
1498
1534
|
const DISCORD_EMPTY_VISIBLE_REPLY_WARNING = "⚠️ Command produced no visible reply.";
|
|
1499
1535
|
/** Retain visible component text, not interaction IDs or option values. */
|
|
1500
1536
|
function formatDiscordCommandComponents(components) {
|
|
@@ -1512,7 +1548,8 @@ function resolveDiscordInteractionReplyOptions(params) {
|
|
|
1512
1548
|
return {
|
|
1513
1549
|
textLimit: resolveTextChunkLimit(params.cfg, "discord", params.accountId, { fallbackLimit: 2e3 }),
|
|
1514
1550
|
maxLinesPerMessage: resolveDiscordMaxLinesPerMessage(params),
|
|
1515
|
-
chunkMode: resolveChunkMode(params.cfg, "discord", params.accountId)
|
|
1551
|
+
chunkMode: resolveChunkMode(params.cfg, "discord", params.accountId),
|
|
1552
|
+
mediaAccess: resolveOutboundMediaAccessForConfig(params.cfg)
|
|
1516
1553
|
};
|
|
1517
1554
|
}
|
|
1518
1555
|
function isDiscordUnknownInteraction(error) {
|
|
@@ -1612,31 +1649,46 @@ async function deliverDiscordInteractionReply(params) {
|
|
|
1612
1649
|
throw createChannelPartialDeliveryError(error, { visibleReplySent: true });
|
|
1613
1650
|
}
|
|
1614
1651
|
};
|
|
1615
|
-
const
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1652
|
+
const mediaFailures = [];
|
|
1653
|
+
const files = (await Promise.all(reply.mediaUrls.map(async (url, index) => {
|
|
1654
|
+
try {
|
|
1655
|
+
const loaded = await loadWebMedia(url, {
|
|
1656
|
+
localRoots: params.mediaLocalRoots,
|
|
1657
|
+
ssrfPolicy: buildOutboundMediaLoadOptions({ mediaAccess: params.mediaAccess }).ssrfPolicy
|
|
1658
|
+
});
|
|
1659
|
+
return {
|
|
1660
|
+
name: loaded.fileName ?? "upload",
|
|
1661
|
+
data: loaded.buffer,
|
|
1662
|
+
contentType: loaded.contentType
|
|
1663
|
+
};
|
|
1664
|
+
} catch (error) {
|
|
1665
|
+
if (!(error instanceof MediaFetchError || error instanceof LocalMediaAccessError)) throw error;
|
|
1666
|
+
logVerbose(`discord: interaction media not attached: ${String(error)}`);
|
|
1667
|
+
mediaFailures[index] = {
|
|
1668
|
+
code: "delivery-failed",
|
|
1669
|
+
kind: "document",
|
|
1670
|
+
label: (URL.canParse(url) ? new URL(url).pathname : url).split(/[\\/]/).findLast(Boolean) ?? `Attachment ${index + 1}`
|
|
1671
|
+
};
|
|
1672
|
+
return;
|
|
1673
|
+
}
|
|
1674
|
+
}))).filter((file) => file !== void 0);
|
|
1675
|
+
const text = appendReplyMediaFailures(reply.text, mediaFailures.filter(Boolean)) ?? "";
|
|
1676
|
+
if (files.length === 0 && !text.trim() && !hasFirstMessageParts) return false;
|
|
1677
|
+
const chunks = resolveTextChunksWithFallback(text, chunkDiscordTextWithMode(text, {
|
|
1625
1678
|
maxChars: textLimit,
|
|
1626
1679
|
maxLines: maxLinesPerMessage,
|
|
1627
1680
|
chunkMode
|
|
1628
1681
|
}));
|
|
1629
1682
|
if (chunks.length === 0) chunks.push("");
|
|
1630
1683
|
for (const [index, chunk] of chunks.entries()) {
|
|
1631
|
-
const chunkFiles = index === 0 ? files : void 0;
|
|
1684
|
+
const chunkFiles = index === 0 && files.length > 0 ? files : void 0;
|
|
1632
1685
|
if (!chunk.trim() && !chunkFiles && (payloadDelivered || !hasFirstMessageParts)) continue;
|
|
1633
1686
|
await sendMessage(chunk, chunkFiles);
|
|
1634
1687
|
}
|
|
1635
1688
|
if (payloadDelivered && params.onDelivered) await params.onDelivered(deliveredText?.filter(Boolean).join("\n") ?? "");
|
|
1636
1689
|
return payloadDelivered;
|
|
1637
1690
|
}
|
|
1638
|
-
|
|
1639
|
-
//#region extensions/discord/src/monitor/native-command-agent-reply.ts
|
|
1691
|
+
// extensions/discord/src/monitor/native-command-agent-reply.ts
|
|
1640
1692
|
async function dispatchDiscordNativeAgentReply(params) {
|
|
1641
1693
|
const blockStreamingEnabled = resolveChannelStreamingBlockEnabled(params.discordConfig);
|
|
1642
1694
|
let didReply = false;
|
|
@@ -1712,13 +1764,11 @@ async function dispatchDiscordNativeAgentReply(params) {
|
|
|
1712
1764
|
}));
|
|
1713
1765
|
return dispatchResult;
|
|
1714
1766
|
}
|
|
1715
|
-
|
|
1716
|
-
//#region extensions/discord/src/monitor/commands.ts
|
|
1767
|
+
// extensions/discord/src/monitor/commands.ts
|
|
1717
1768
|
function resolveDiscordSlashCommandConfig(raw) {
|
|
1718
1769
|
return { ephemeral: raw?.ephemeral !== false };
|
|
1719
1770
|
}
|
|
1720
|
-
|
|
1721
|
-
//#region extensions/discord/src/monitor/native-command-arg-ui.ts
|
|
1771
|
+
// extensions/discord/src/monitor/native-command-arg-ui.ts
|
|
1722
1772
|
const DISCORD_COMMAND_ARG_CUSTOM_ID_KEY = "cmdarg";
|
|
1723
1773
|
function parseDiscordCommandArgData(data) {
|
|
1724
1774
|
if (!data || typeof data !== "object") return null;
|
|
@@ -1811,8 +1861,7 @@ function createDiscordCommandArgFallbackButton$1(params) {
|
|
|
1811
1861
|
}
|
|
1812
1862
|
};
|
|
1813
1863
|
}
|
|
1814
|
-
|
|
1815
|
-
//#region extensions/discord/src/monitor/inbound-context.ts
|
|
1864
|
+
// extensions/discord/src/monitor/inbound-context.ts
|
|
1816
1865
|
function createDiscordSupplementalContextAccessChecker(params) {
|
|
1817
1866
|
const userAllowList = params.channelConfig?.users ?? params.guildInfo?.users ?? [];
|
|
1818
1867
|
const roleAllowList = params.channelConfig?.roles ?? params.guildInfo?.roles ?? [];
|
|
@@ -1861,8 +1910,7 @@ function buildDiscordInboundAccessContext(params) {
|
|
|
1861
1910
|
ownerAllowFrom: resolveDiscordOwnerAllowFrom(params)
|
|
1862
1911
|
};
|
|
1863
1912
|
}
|
|
1864
|
-
|
|
1865
|
-
//#region extensions/discord/src/monitor/native-command-context.ts
|
|
1913
|
+
// extensions/discord/src/monitor/native-command-context.ts
|
|
1866
1914
|
async function buildDiscordNativeInteractionContext(params) {
|
|
1867
1915
|
const { interaction, route, boundSessionKey, sessionPrefix, channelContext, ...context } = params;
|
|
1868
1916
|
const targets = resolveNativeCommandSessionTargets({
|
|
@@ -1999,8 +2047,7 @@ async function buildDiscordNativeInteractionContext(params) {
|
|
|
1999
2047
|
...targets
|
|
2000
2048
|
};
|
|
2001
2049
|
}
|
|
2002
|
-
|
|
2003
|
-
//#region extensions/discord/src/monitor/native-command-route.ts
|
|
2050
|
+
// extensions/discord/src/monitor/native-command-route.ts
|
|
2004
2051
|
function resolveDiscordNativeInteractionRouteState(params) {
|
|
2005
2052
|
const { channelContext, interaction } = params;
|
|
2006
2053
|
const conversationId = params.conversationId ?? channelContext.rawChannelId;
|
|
@@ -2042,8 +2089,7 @@ function resolveDiscordNativeInteractionRouteState(params) {
|
|
|
2042
2089
|
configuredBinding
|
|
2043
2090
|
};
|
|
2044
2091
|
}
|
|
2045
|
-
|
|
2046
|
-
//#region extensions/discord/src/monitor/native-interaction-channel-context.ts
|
|
2092
|
+
// extensions/discord/src/monitor/native-interaction-channel-context.ts
|
|
2047
2093
|
async function resolveDiscordNativeInteractionChannelContext(interaction, channelIdFallback) {
|
|
2048
2094
|
const { channel, client, guild, rawData } = interaction;
|
|
2049
2095
|
const hasGuild = Boolean(guild);
|
|
@@ -2066,8 +2112,7 @@ async function resolveDiscordNativeInteractionChannelContext(interaction, channe
|
|
|
2066
2112
|
threadParentSlug: hasGuild ? channelContext.threadParentSlug : ""
|
|
2067
2113
|
};
|
|
2068
2114
|
}
|
|
2069
|
-
|
|
2070
|
-
//#region extensions/discord/src/monitor/native-command-auth.ts
|
|
2115
|
+
// extensions/discord/src/monitor/native-command-auth.ts
|
|
2071
2116
|
function resolveDiscordNativePolicyReader(params) {
|
|
2072
2117
|
return params.readPolicy ?? createDiscordLivePolicyReader({
|
|
2073
2118
|
...params,
|
|
@@ -2348,8 +2393,7 @@ async function resolveDiscordNativeAutocompleteAuthorized(params) {
|
|
|
2348
2393
|
}
|
|
2349
2394
|
return params.isPolicyCurrent?.() !== false;
|
|
2350
2395
|
}
|
|
2351
|
-
|
|
2352
|
-
//#region extensions/discord/src/monitor/native-command-bypass.ts
|
|
2396
|
+
// extensions/discord/src/monitor/native-command-bypass.ts
|
|
2353
2397
|
function shouldBypassConfiguredAcpEnsure(commandName) {
|
|
2354
2398
|
const command = commandName.trim().toLowerCase();
|
|
2355
2399
|
return command === "acp" || command === "status";
|
|
@@ -2358,8 +2402,7 @@ function shouldBypassConfiguredAcpGuildGuards(commandName) {
|
|
|
2358
2402
|
const command = commandName.trim().toLowerCase();
|
|
2359
2403
|
return command === "new" || command === "reset";
|
|
2360
2404
|
}
|
|
2361
|
-
|
|
2362
|
-
//#region extensions/discord/src/monitor/model-picker-preference-primitives.ts
|
|
2405
|
+
// extensions/discord/src/monitor/model-picker-preference-primitives.ts
|
|
2363
2406
|
function splitDiscordModelRef(modelRef) {
|
|
2364
2407
|
const trimmed = modelRef.trim();
|
|
2365
2408
|
const slashIndex = trimmed.indexOf("/");
|
|
@@ -2387,8 +2430,7 @@ function preferenceTimestampMs(value) {
|
|
|
2387
2430
|
const parsed = typeof value === "string" ? Date.parse(value) : NaN;
|
|
2388
2431
|
return Number.isFinite(parsed) ? parsed : 0;
|
|
2389
2432
|
}
|
|
2390
|
-
|
|
2391
|
-
//#region extensions/discord/src/monitor/model-picker-preferences.ts
|
|
2433
|
+
// extensions/discord/src/monitor/model-picker-preferences.ts
|
|
2392
2434
|
const RECENT_LIMIT = 5;
|
|
2393
2435
|
const PREFERENCE_MAX_ENTRIES = 2e3;
|
|
2394
2436
|
let lastPreferenceTimestampMs = 0;
|
|
@@ -2467,8 +2509,7 @@ async function recordDiscordModelPickerRecentModel(params) {
|
|
|
2467
2509
|
await Promise.all(expired.map((entry) => store.delete(entry.key)));
|
|
2468
2510
|
} catch {}
|
|
2469
2511
|
}
|
|
2470
|
-
|
|
2471
|
-
//#region extensions/discord/src/monitor/model-picker.state.ts
|
|
2512
|
+
// extensions/discord/src/monitor/model-picker.state.ts
|
|
2472
2513
|
const DISCORD_MODEL_PICKER_CUSTOM_ID_KEY = "mdlpk";
|
|
2473
2514
|
const DISCORD_CUSTOM_ID_MAX_CHARS = 100;
|
|
2474
2515
|
const DISCORD_COMPONENT_MAX_SELECT_OPTIONS = 25;
|
|
@@ -2718,8 +2759,7 @@ function getDiscordModelPickerRecentModelRefs(data, quickModels) {
|
|
|
2718
2759
|
const defaultModelRef = `${data.resolvedDefault.provider}/${data.resolvedDefault.model}`;
|
|
2719
2760
|
return [defaultModelRef, ...quickModels.filter((modelRef) => modelRef !== defaultModelRef)];
|
|
2720
2761
|
}
|
|
2721
|
-
|
|
2722
|
-
//#region extensions/discord/src/monitor/model-picker.view.ts
|
|
2762
|
+
// extensions/discord/src/monitor/model-picker.view.ts
|
|
2723
2763
|
const DISCORD_MODEL_PICKER_PAGE_INDICATOR_CUSTOM_ID = "mdlpk:nav-indicator";
|
|
2724
2764
|
function parseCurrentModelRef(raw) {
|
|
2725
2765
|
const match = raw?.trim().match(/^([^/]+)\/(.+)$/u);
|
|
@@ -3106,8 +3146,7 @@ function renderDiscordModelPickerRecentsView(params) {
|
|
|
3106
3146
|
trailingRows: [backRow]
|
|
3107
3147
|
});
|
|
3108
3148
|
}
|
|
3109
|
-
|
|
3110
|
-
//#region extensions/discord/src/monitor/native-command-model-picker-ui.ts
|
|
3149
|
+
// extensions/discord/src/monitor/native-command-model-picker-ui.ts
|
|
3111
3150
|
function createDiscordModelPickerSessionReader(params, readConsistency) {
|
|
3112
3151
|
const storePath = resolveStorePath(params.cfg.session?.store, { agentId: params.route.agentId });
|
|
3113
3152
|
return (sessionKey = params.route.sessionKey) => getSessionEntryAsync({
|
|
@@ -3268,8 +3307,7 @@ async function replyWithDiscordModelPickerProviders(params) {
|
|
|
3268
3307
|
replyText: formatDiscordCommandComponents(rendered.components)
|
|
3269
3308
|
});
|
|
3270
3309
|
}
|
|
3271
|
-
|
|
3272
|
-
//#region extensions/discord/src/monitor/native-command-model-picker-interaction.ts
|
|
3310
|
+
// extensions/discord/src/monitor/native-command-model-picker-interaction.ts
|
|
3273
3311
|
function resolveModelPickerSelectionValue(interaction) {
|
|
3274
3312
|
return normalizeOptionalString(interaction.values?.[0]) ?? null;
|
|
3275
3313
|
}
|
|
@@ -3632,8 +3670,7 @@ function createDiscordModelPickerFallbackSelect$1(params) {
|
|
|
3632
3670
|
}
|
|
3633
3671
|
};
|
|
3634
3672
|
}
|
|
3635
|
-
|
|
3636
|
-
//#region extensions/discord/src/monitor/native-command.options.ts
|
|
3673
|
+
// extensions/discord/src/monitor/native-command.options.ts
|
|
3637
3674
|
const DISCORD_COMMAND_DESCRIPTION_MAX = 100;
|
|
3638
3675
|
function truncateDiscordCommandDescription(params) {
|
|
3639
3676
|
return truncateUtf16Safe(params.value, DISCORD_COMMAND_DESCRIPTION_MAX);
|
|
@@ -3699,8 +3736,7 @@ function buildDiscordCommandOptions(params) {
|
|
|
3699
3736
|
});
|
|
3700
3737
|
});
|
|
3701
3738
|
}
|
|
3702
|
-
|
|
3703
|
-
//#region extensions/discord/src/monitor/native-command.ts
|
|
3739
|
+
// extensions/discord/src/monitor/native-command.ts
|
|
3704
3740
|
const log = createSubsystemLogger("discord/native-command");
|
|
3705
3741
|
const NON_PLUGIN_COMMAND_DISPATCH = Object.freeze({ kind: "non-plugin" });
|
|
3706
3742
|
function createNativeCommandDefinition(command) {
|
|
@@ -4032,41 +4068,43 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
4032
4068
|
messageThreadId,
|
|
4033
4069
|
threadParentId: pluginThreadParentId
|
|
4034
4070
|
});
|
|
4035
|
-
if (pluginReply
|
|
4036
|
-
|
|
4071
|
+
if (!pluginCommandResultContinuesAgent(pluginReply)) {
|
|
4072
|
+
if (pluginReply.suppressReply === true) {
|
|
4073
|
+
await settleDiscordInteractionWithoutVisibleReply(interaction);
|
|
4074
|
+
return {
|
|
4075
|
+
accepted: true,
|
|
4076
|
+
effectiveRoute
|
|
4077
|
+
};
|
|
4078
|
+
}
|
|
4079
|
+
const recordReply = async (replyText) => {
|
|
4080
|
+
await recordDeliveredCommandExchange({
|
|
4081
|
+
config: cfg,
|
|
4082
|
+
agentId: pluginCommandAgentId,
|
|
4083
|
+
sessionKey: effectiveRoute.sessionKey,
|
|
4084
|
+
expectedSessionId: targetSessionEntry?.sessionId,
|
|
4085
|
+
commandText: prompt,
|
|
4086
|
+
commandId: `discord:${accountId}:${channelId}:${interaction.id}`,
|
|
4087
|
+
replyId: "plugin-reply",
|
|
4088
|
+
replyText
|
|
4089
|
+
});
|
|
4090
|
+
};
|
|
4091
|
+
if (hasRenderableReplyPayload(pluginReply)) await deliverDiscordInteractionReply({
|
|
4092
|
+
interaction,
|
|
4093
|
+
payload: pluginReply,
|
|
4094
|
+
...resolveDiscordInteractionReplyOptions({
|
|
4095
|
+
cfg,
|
|
4096
|
+
discordConfig,
|
|
4097
|
+
accountId
|
|
4098
|
+
}),
|
|
4099
|
+
responseEphemeral,
|
|
4100
|
+
onDelivered: recordReply
|
|
4101
|
+
});
|
|
4102
|
+
else if (await respond("⚠️ Command produced no visible reply.")) await recordReply(DISCORD_EMPTY_VISIBLE_REPLY_WARNING);
|
|
4037
4103
|
return {
|
|
4038
4104
|
accepted: true,
|
|
4039
4105
|
effectiveRoute
|
|
4040
4106
|
};
|
|
4041
4107
|
}
|
|
4042
|
-
const recordReply = async (replyText) => {
|
|
4043
|
-
await recordDeliveredCommandExchange({
|
|
4044
|
-
config: cfg,
|
|
4045
|
-
agentId: pluginCommandAgentId,
|
|
4046
|
-
sessionKey: effectiveRoute.sessionKey,
|
|
4047
|
-
expectedSessionId: targetSessionEntry?.sessionId,
|
|
4048
|
-
commandText: prompt,
|
|
4049
|
-
commandId: `discord:${accountId}:${channelId}:${interaction.id}`,
|
|
4050
|
-
replyId: "plugin-reply",
|
|
4051
|
-
replyText
|
|
4052
|
-
});
|
|
4053
|
-
};
|
|
4054
|
-
if (hasRenderableReplyPayload(pluginReply)) await deliverDiscordInteractionReply({
|
|
4055
|
-
interaction,
|
|
4056
|
-
payload: pluginReply,
|
|
4057
|
-
...resolveDiscordInteractionReplyOptions({
|
|
4058
|
-
cfg,
|
|
4059
|
-
discordConfig,
|
|
4060
|
-
accountId
|
|
4061
|
-
}),
|
|
4062
|
-
responseEphemeral,
|
|
4063
|
-
onDelivered: recordReply
|
|
4064
|
-
});
|
|
4065
|
-
else if (await respond("⚠️ Command produced no visible reply.")) await recordReply(DISCORD_EMPTY_VISIBLE_REPLY_WARNING);
|
|
4066
|
-
return {
|
|
4067
|
-
accepted: true,
|
|
4068
|
-
effectiveRoute
|
|
4069
|
-
};
|
|
4070
4108
|
}
|
|
4071
4109
|
const pickerCommandContext = shouldOpenDiscordModelPickerFromCommand({
|
|
4072
4110
|
command,
|
|
@@ -4167,17 +4205,11 @@ function bindDiscordCommandControl(createControl) {
|
|
|
4167
4205
|
const createDiscordCommandArgFallbackButton = bindDiscordCommandControl(createDiscordCommandArgFallbackButton$1);
|
|
4168
4206
|
const createDiscordModelPickerFallbackButton = bindDiscordCommandControl(createDiscordModelPickerFallbackButton$1);
|
|
4169
4207
|
const createDiscordModelPickerFallbackSelect = bindDiscordCommandControl(createDiscordModelPickerFallbackSelect$1);
|
|
4170
|
-
|
|
4171
|
-
//#region extensions/discord/src/monitor/agent-components-reply.ts
|
|
4208
|
+
// extensions/discord/src/monitor/agent-components-reply.ts
|
|
4172
4209
|
async function replySilently(interaction, params, onError) {
|
|
4173
|
-
|
|
4174
|
-
await interaction.reply(params);
|
|
4175
|
-
} catch (error) {
|
|
4176
|
-
onError?.(error);
|
|
4177
|
-
}
|
|
4210
|
+
await interaction[interaction.responseState === "deferred-update" ? "followUp" : "reply"](params).catch((error) => onError?.(error));
|
|
4178
4211
|
}
|
|
4179
|
-
|
|
4180
|
-
//#region extensions/discord/src/activities/interaction.ts
|
|
4212
|
+
// extensions/discord/src/activities/interaction.ts
|
|
4181
4213
|
const REGISTRATION_WIDGET_ID = "AAAAAAAAAAAAAAAAAAAAAA";
|
|
4182
4214
|
const PENDING_LAUNCH_WRITE_BUDGET_MS = 250;
|
|
4183
4215
|
function createActivityButton(ctx) {
|
|
@@ -4227,8 +4259,7 @@ function createDiscordActivityButton(ctx, applicationId) {
|
|
|
4227
4259
|
if (!runtime.resolveAccount(ctx.accountId, ctx.cfg)) return null;
|
|
4228
4260
|
return createActivityButton(ctx);
|
|
4229
4261
|
}
|
|
4230
|
-
|
|
4231
|
-
//#region extensions/discord/src/internal/gateway-close-codes.ts
|
|
4262
|
+
// extensions/discord/src/internal/gateway-close-codes.ts
|
|
4232
4263
|
const fatalGatewayCloseCodes = /* @__PURE__ */ new Set([
|
|
4233
4264
|
GatewayCloseCodes.AuthenticationFailed,
|
|
4234
4265
|
GatewayCloseCodes.InvalidShard,
|
|
@@ -4249,8 +4280,7 @@ function isFatalGatewayCloseCode(code) {
|
|
|
4249
4280
|
function canResumeAfterGatewayClose(code) {
|
|
4250
4281
|
return !nonResumableGatewayCloseCodes.has(code);
|
|
4251
4282
|
}
|
|
4252
|
-
|
|
4253
|
-
//#region extensions/discord/src/internal/gateway-identify-limiter.ts
|
|
4283
|
+
// extensions/discord/src/internal/gateway-identify-limiter.ts
|
|
4254
4284
|
const IDENTIFY_WINDOW_MS = 5e3;
|
|
4255
4285
|
var GatewayIdentifyLimiter = class {
|
|
4256
4286
|
async wait() {
|
|
@@ -4267,8 +4297,7 @@ var GatewayIdentifyLimiter = class {
|
|
|
4267
4297
|
}
|
|
4268
4298
|
};
|
|
4269
4299
|
const sharedGatewayIdentifyLimiter = new GatewayIdentifyLimiter();
|
|
4270
|
-
|
|
4271
|
-
//#region extensions/discord/src/internal/gateway-payload.ts
|
|
4300
|
+
// extensions/discord/src/internal/gateway-payload.ts
|
|
4272
4301
|
function ensureGatewayParams(url) {
|
|
4273
4302
|
const parsed = new URL(url);
|
|
4274
4303
|
parsed.searchParams.set("v", parsed.searchParams.get("v") ?? "10");
|
|
@@ -4283,8 +4312,7 @@ function decodeGatewayMessage(incoming) {
|
|
|
4283
4312
|
return null;
|
|
4284
4313
|
}
|
|
4285
4314
|
}
|
|
4286
|
-
|
|
4287
|
-
//#region extensions/discord/src/internal/gateway-rate-limit.ts
|
|
4315
|
+
// extensions/discord/src/internal/gateway-rate-limit.ts
|
|
4288
4316
|
const GATEWAY_SEND_LIMIT = 120;
|
|
4289
4317
|
const GATEWAY_SEND_WINDOW_MS = 6e4;
|
|
4290
4318
|
const GATEWAY_SEND_QUEUE_LIMIT = GATEWAY_SEND_LIMIT;
|
|
@@ -4370,8 +4398,7 @@ var GatewaySendLimiter = class {
|
|
|
4370
4398
|
this.scheduleFlush();
|
|
4371
4399
|
}
|
|
4372
4400
|
};
|
|
4373
|
-
|
|
4374
|
-
//#region extensions/discord/src/internal/gateway-voice-state-cache.ts
|
|
4401
|
+
// extensions/discord/src/internal/gateway-voice-state-cache.ts
|
|
4375
4402
|
var DiscordGatewayVoiceStateCache = class {
|
|
4376
4403
|
constructor() {
|
|
4377
4404
|
this.statesByGuild = /* @__PURE__ */ new Map();
|
|
@@ -4444,8 +4471,7 @@ var DiscordGatewayVoiceStateCache = class {
|
|
|
4444
4471
|
}
|
|
4445
4472
|
}
|
|
4446
4473
|
};
|
|
4447
|
-
|
|
4448
|
-
//#region extensions/discord/src/internal/gateway.ts
|
|
4474
|
+
// extensions/discord/src/internal/gateway.ts
|
|
4449
4475
|
const GatewayIntents = GatewayIntentBits;
|
|
4450
4476
|
const READY_STATE_OPEN = 1;
|
|
4451
4477
|
const DEFAULT_GATEWAY_URL = "wss://gateway.discord.gg/";
|
|
@@ -4763,8 +4789,7 @@ var GatewayPlugin = class {
|
|
|
4763
4789
|
}, true);
|
|
4764
4790
|
}
|
|
4765
4791
|
};
|
|
4766
|
-
|
|
4767
|
-
//#region extensions/discord/src/voice/session.ts
|
|
4792
|
+
// extensions/discord/src/voice/session.ts
|
|
4768
4793
|
const MIN_SEGMENT_SECONDS = .35;
|
|
4769
4794
|
const CAPTURE_FINALIZE_GRACE_MS = 2e3;
|
|
4770
4795
|
const VOICE_CONNECT_READY_TIMEOUT_MS = 3e4;
|
|
@@ -4781,8 +4806,7 @@ function logVoiceVerbose(message) {
|
|
|
4781
4806
|
function isVoiceChannel(type) {
|
|
4782
4807
|
return type === discord_exports.ChannelType.GuildVoice || type === discord_exports.ChannelType.GuildStageVoice;
|
|
4783
4808
|
}
|
|
4784
|
-
|
|
4785
|
-
//#region extensions/discord/src/voice/command.ts
|
|
4809
|
+
// extensions/discord/src/voice/command.ts
|
|
4786
4810
|
const VOICE_CHANNEL_TYPES = [ChannelType.GuildVoice, ChannelType.GuildStageVoice];
|
|
4787
4811
|
const DISCORD_VOICE_COMMAND_SPEC = {
|
|
4788
4812
|
name: "vc",
|
|
@@ -4947,8 +4971,7 @@ function createDiscordVoiceCommand(startupParams) {
|
|
|
4947
4971
|
}
|
|
4948
4972
|
}();
|
|
4949
4973
|
}
|
|
4950
|
-
|
|
4951
|
-
//#region extensions/discord/src/monitor/agent-components-context.ts
|
|
4974
|
+
// extensions/discord/src/monitor/agent-components-context.ts
|
|
4952
4975
|
function resolveAgentComponentRoute(params) {
|
|
4953
4976
|
return resolveAgentRoute({
|
|
4954
4977
|
cfg: params.ctx.cfg,
|
|
@@ -5029,8 +5052,7 @@ async function resolveComponentInteractionContext(params) {
|
|
|
5029
5052
|
memberRoleIds: Array.isArray(interaction.rawData.member?.roles) ? interaction.rawData.member.roles.slice() : []
|
|
5030
5053
|
};
|
|
5031
5054
|
}
|
|
5032
|
-
|
|
5033
|
-
//#region extensions/discord/src/monitor/agent-components-data.ts
|
|
5055
|
+
// extensions/discord/src/monitor/agent-components-data.ts
|
|
5034
5056
|
function readParsedId(data, key) {
|
|
5035
5057
|
if (!data || typeof data !== "object") return;
|
|
5036
5058
|
return key in data ? data[key] : data[key === "cid" ? "componentId" : "modalId"];
|
|
@@ -5117,8 +5139,7 @@ function formatModalSubmissionText(entry, interaction) {
|
|
|
5117
5139
|
});
|
|
5118
5140
|
return [title, ...lines.length > 0 ? lines : ["- (no values)"]].join("\n");
|
|
5119
5141
|
}
|
|
5120
|
-
|
|
5121
|
-
//#region extensions/discord/src/monitor/agent-components-live-policy.ts
|
|
5142
|
+
// extensions/discord/src/monitor/agent-components-live-policy.ts
|
|
5122
5143
|
async function resolveAgentComponentPolicyContext(params) {
|
|
5123
5144
|
if (!params.ctx.readPolicy) return params.ctx;
|
|
5124
5145
|
try {
|
|
@@ -5138,8 +5159,7 @@ async function resolveAgentComponentPolicyContext(params) {
|
|
|
5138
5159
|
throw error;
|
|
5139
5160
|
}
|
|
5140
5161
|
}
|
|
5141
|
-
|
|
5142
|
-
//#region extensions/discord/src/monitor/agent-components-dm-auth.ts
|
|
5162
|
+
// extensions/discord/src/monitor/agent-components-dm-auth.ts
|
|
5143
5163
|
async function ensureDmComponentAuthorized(params) {
|
|
5144
5164
|
const { ctx, interaction, user, componentLabel } = params;
|
|
5145
5165
|
const dmPolicy = ctx.dmPolicy ?? "pairing";
|
|
@@ -5240,8 +5260,7 @@ async function resolveInteractionContextWithDmAuth(params) {
|
|
|
5240
5260
|
})) return null;
|
|
5241
5261
|
return interactionCtx;
|
|
5242
5262
|
}
|
|
5243
|
-
|
|
5244
|
-
//#region extensions/discord/src/monitor/agent-components-guild-auth.ts
|
|
5263
|
+
// extensions/discord/src/monitor/agent-components-guild-auth.ts
|
|
5245
5264
|
function resolveComponentGuildContext(params) {
|
|
5246
5265
|
const guildInfo = resolveDiscordGuildEntry({
|
|
5247
5266
|
guild: params.interaction.guild ?? void 0,
|
|
@@ -5409,8 +5428,7 @@ async function resolveAuthorizedComponentInteraction(params) {
|
|
|
5409
5428
|
commandAuthorized
|
|
5410
5429
|
};
|
|
5411
5430
|
}
|
|
5412
|
-
|
|
5413
|
-
//#region extensions/discord/src/monitor/reply-context.ts
|
|
5431
|
+
// extensions/discord/src/monitor/reply-context.ts
|
|
5414
5432
|
function resolveReplyContext(message, resolveDiscordMessageText) {
|
|
5415
5433
|
const id = resolveDiscordReferencedReplyMessageId(message);
|
|
5416
5434
|
if (!id) return null;
|
|
@@ -5441,8 +5459,7 @@ function buildGuildLabel(params) {
|
|
|
5441
5459
|
const { guild, channelName, channelId } = params;
|
|
5442
5460
|
return `${guild?.name ?? "Guild"} #${channelName} channel id:${channelId}`;
|
|
5443
5461
|
}
|
|
5444
|
-
|
|
5445
|
-
//#region extensions/discord/src/monitor/reply-safety.ts
|
|
5462
|
+
// extensions/discord/src/monitor/reply-safety.ts
|
|
5446
5463
|
const DISCORD_INTERNAL_CHANNEL_LINE_RE = /^(?:>\s*)?(?:analysis|commentary|thinking|reasoning)\s*[:=]/i;
|
|
5447
5464
|
function hasNonEmptyRecord(value) {
|
|
5448
5465
|
return Boolean(value && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length > 0);
|
|
@@ -5489,8 +5506,7 @@ function sanitizeDiscordFrontChannelReplyPayloads(payloads, options = {}) {
|
|
|
5489
5506
|
}
|
|
5490
5507
|
return safePayloads;
|
|
5491
5508
|
}
|
|
5492
|
-
|
|
5493
|
-
//#region extensions/discord/src/monitor/reply-delivery.ts
|
|
5509
|
+
// extensions/discord/src/monitor/reply-delivery.ts
|
|
5494
5510
|
function formatDiscordReplyContext(target, sessionKey) {
|
|
5495
5511
|
return `target=${target}${sessionKey ? ` session=${sessionKey}` : ""}`;
|
|
5496
5512
|
}
|
|
@@ -5511,11 +5527,13 @@ function resolveBoundThreadBinding(params) {
|
|
|
5511
5527
|
}
|
|
5512
5528
|
function resolveBindingIdentity(cfg, binding) {
|
|
5513
5529
|
if (!binding) return;
|
|
5514
|
-
const
|
|
5530
|
+
const baseLabel = binding.label?.trim() || binding.agentId;
|
|
5531
|
+
if (!baseLabel) return;
|
|
5532
|
+
const displayName = `🤖 ${baseLabel}`.trim();
|
|
5515
5533
|
const identity = { name: truncateUtf16Safe(displayName, 80) };
|
|
5516
5534
|
try {
|
|
5517
|
-
const avatar = resolveAgentAvatar(cfg, binding.agentId);
|
|
5518
|
-
if (avatar
|
|
5535
|
+
const avatar = binding.agentId ? resolveAgentAvatar(cfg, binding.agentId) : void 0;
|
|
5536
|
+
if (avatar?.kind === "remote") identity.avatarUrl = avatar.url;
|
|
5519
5537
|
} catch {}
|
|
5520
5538
|
return identity;
|
|
5521
5539
|
}
|
|
@@ -5600,10 +5618,9 @@ async function deliverDiscordReply(params) {
|
|
|
5600
5618
|
if (send.status === "partial_failed") throw createChannelPartialDeliveryError(send.error, deliveryResult);
|
|
5601
5619
|
return deliveryResult;
|
|
5602
5620
|
}
|
|
5603
|
-
|
|
5604
|
-
//#region extensions/discord/src/monitor/agent-components.dispatch.ts
|
|
5621
|
+
// extensions/discord/src/monitor/agent-components.dispatch.ts
|
|
5605
5622
|
const loadReplyRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/reply-runtime"));
|
|
5606
|
-
const loadTypingRuntime = createLazyRuntimeModule(() => import("./typing-
|
|
5623
|
+
const loadTypingRuntime = createLazyRuntimeModule(() => import("./typing-DAv4S2fI.mjs").then((n) => n.n));
|
|
5607
5624
|
function buildDiscordComponentConversationLabel(params) {
|
|
5608
5625
|
if (params.interactionCtx.isDirectMessage) return buildDirectLabel(params.interactionCtx.user);
|
|
5609
5626
|
if (params.interactionCtx.isGroupDm) return `Group DM #${params.channelCtx.channelName ?? params.interactionCtx.channelId} channel id:${params.interactionCtx.channelId}`;
|
|
@@ -5837,8 +5854,7 @@ async function dispatchDiscordComponentEvent(params) {
|
|
|
5837
5854
|
}
|
|
5838
5855
|
});
|
|
5839
5856
|
}
|
|
5840
|
-
|
|
5841
|
-
//#region extensions/discord/src/interactive-dispatch.ts
|
|
5857
|
+
// extensions/discord/src/interactive-dispatch.ts
|
|
5842
5858
|
const dispatchDiscordInteractive = createChannelInteractiveDispatcher({
|
|
5843
5859
|
channel: "discord",
|
|
5844
5860
|
interactiveKey: "interaction"
|
|
@@ -5849,8 +5865,7 @@ async function dispatchDiscordPluginInteractiveHandler(params) {
|
|
|
5849
5865
|
dedupeId: params.interactionId
|
|
5850
5866
|
});
|
|
5851
5867
|
}
|
|
5852
|
-
|
|
5853
|
-
//#region extensions/discord/src/monitor/agent-components.plugin-interactive.ts
|
|
5868
|
+
// extensions/discord/src/monitor/agent-components.plugin-interactive.ts
|
|
5854
5869
|
const loadConversationRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/conversation-runtime"));
|
|
5855
5870
|
async function dispatchPluginDiscordInteractiveEvent(params) {
|
|
5856
5871
|
const normalizedConversationId = params.interactionCtx.rawGuildId || params.channelCtx.channelType === ChannelType.GroupDM ? `channel:${params.interactionCtx.channelId}` : `user:${params.interactionCtx.userId}`;
|
|
@@ -5962,8 +5977,7 @@ async function dispatchPluginDiscordInteractiveEvent(params) {
|
|
|
5962
5977
|
}
|
|
5963
5978
|
return "unmatched";
|
|
5964
5979
|
}
|
|
5965
|
-
|
|
5966
|
-
//#region extensions/discord/src/monitor/agent-components.system-controls.ts
|
|
5980
|
+
// extensions/discord/src/monitor/agent-components.system-controls.ts
|
|
5967
5981
|
const AGENT_BUTTON_KEY = "agent";
|
|
5968
5982
|
const AGENT_SELECT_KEY = "agentsel";
|
|
5969
5983
|
async function runAgentSystemControlInteraction(params) {
|
|
@@ -6043,9 +6057,8 @@ function createAgentSelectMenu(ctx) {
|
|
|
6043
6057
|
}
|
|
6044
6058
|
};
|
|
6045
6059
|
}
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
const loadComponentsRuntime = createLazyRuntimeModule(() => import("./components-YCvQ6YLS.mjs").then((n) => n.t));
|
|
6060
|
+
// extensions/discord/src/monitor/agent-components.ts
|
|
6061
|
+
const loadComponentsRuntime = createLazyRuntimeModule(() => import("./components-GePlato3.mjs").then((n) => n.t));
|
|
6049
6062
|
async function resolveAuthorizedComponentEntry(params) {
|
|
6050
6063
|
const entry = params.entry ?? await params.resolve(false);
|
|
6051
6064
|
if (!entry) {
|
|
@@ -6299,8 +6312,7 @@ function createDiscordComponentButton(ctx) {
|
|
|
6299
6312
|
}
|
|
6300
6313
|
const createAgentComponentControls = [createAgentComponentButton, createAgentSelectMenu];
|
|
6301
6314
|
const createDiscordComponentControls = [createDiscordComponentButton, ...SELECT_CONTROLS.map((spec) => (ctx) => createDiscordComponentSelectControl(spec, ctx))];
|
|
6302
|
-
|
|
6303
|
-
//#region extensions/discord/src/monitor/exec-approvals.ts
|
|
6315
|
+
// extensions/discord/src/monitor/exec-approvals.ts
|
|
6304
6316
|
function resolveTerminalLabel(approval) {
|
|
6305
6317
|
if (approval.status === "allowed" || approval.status === "denied") return formatApprovalDecisionLabel(approval.decision);
|
|
6306
6318
|
return approval.status === "expired" ? "Expired" : "Cancelled";
|
|
@@ -6429,8 +6441,7 @@ function createDiscordExecApprovalButtonContext(params) {
|
|
|
6429
6441
|
}
|
|
6430
6442
|
};
|
|
6431
6443
|
}
|
|
6432
|
-
|
|
6433
|
-
//#region extensions/discord/src/monitor/gateway-supervisor.ts
|
|
6444
|
+
// extensions/discord/src/monitor/gateway-supervisor.ts
|
|
6434
6445
|
var DiscordGatewayLifecycleError = class extends Error {
|
|
6435
6446
|
constructor(event) {
|
|
6436
6447
|
super(`discord gateway ${event.type}: ${event.message}`, { cause: event.err instanceof Error ? event.err : void 0 });
|
|
@@ -6536,8 +6547,7 @@ function createDiscordGatewaySupervisor(params) {
|
|
|
6536
6547
|
}
|
|
6537
6548
|
};
|
|
6538
6549
|
}
|
|
6539
|
-
|
|
6540
|
-
//#region extensions/discord/src/monitor/provider.commands.ts
|
|
6550
|
+
// extensions/discord/src/monitor/provider.commands.ts
|
|
6541
6551
|
const loadPluginCommandRuntime = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/plugin-command-runtime"));
|
|
6542
6552
|
async function resolveDiscordProviderCommandSpecs(params) {
|
|
6543
6553
|
const maxDiscordCommands = 100;
|
|
@@ -6583,8 +6593,7 @@ async function resolveDiscordProviderCommandSpecs(params) {
|
|
|
6583
6593
|
if (params.nativeEnabled && commandSpecs.length > maxDiscordCommands) params.runtime.log?.(warn(`${commandSpecs.length} commands exceed the ${maxDiscordCommands}-command Discord limit; some commands may fail to deploy.`));
|
|
6584
6594
|
return { commandSpecs };
|
|
6585
6595
|
}
|
|
6586
|
-
|
|
6587
|
-
//#region extensions/discord/src/monitor/provider.deploy-errors.ts
|
|
6596
|
+
// extensions/discord/src/monitor/provider.deploy-errors.ts
|
|
6588
6597
|
const DISCORD_DEPLOY_REJECTED_ENTRY_LIMIT = 3;
|
|
6589
6598
|
function stringifyDiscordDeployField(value, depth = 2) {
|
|
6590
6599
|
try {
|
|
@@ -6693,8 +6702,7 @@ function formatDiscordDeployErrorDetails(err) {
|
|
|
6693
6702
|
function isDiscordDeployDailyCreateLimit(err) {
|
|
6694
6703
|
return err instanceof DiscordError && err.discordCode === 30034 && /daily application command creates/i.test(err.message);
|
|
6695
6704
|
}
|
|
6696
|
-
|
|
6697
|
-
//#region extensions/discord/src/monitor/provider.deploy.ts
|
|
6705
|
+
// extensions/discord/src/monitor/provider.deploy.ts
|
|
6698
6706
|
function runDiscordCommandDeployInBackground(params) {
|
|
6699
6707
|
if (!params.enabled) return;
|
|
6700
6708
|
async function deployDiscordCommands() {
|
|
@@ -6718,11 +6726,9 @@ function runDiscordCommandDeployInBackground(params) {
|
|
|
6718
6726
|
params.runtime.log?.(warn(`[${params.accountId}] slash command deploy failed in background (message send/receive unaffected): ${formatErrorMessage$1(err)}`));
|
|
6719
6727
|
});
|
|
6720
6728
|
}
|
|
6721
|
-
|
|
6722
|
-
//#region extensions/discord/src/monitor/gateway-handle.ts
|
|
6729
|
+
// extensions/discord/src/monitor/gateway-handle.ts
|
|
6723
6730
|
const DISCORD_GATEWAY_TRANSPORT_ACTIVITY_EVENT = "openclaw:discord-gateway-transport-activity";
|
|
6724
|
-
|
|
6725
|
-
//#region extensions/discord/src/monitor/status.ts
|
|
6731
|
+
// extensions/discord/src/monitor/status.ts
|
|
6726
6732
|
/** READY proves a prior terminal failure was repaired, so the account is restartable again. */
|
|
6727
6733
|
function createDiscordReadyStatusPatch(at = Date.now()) {
|
|
6728
6734
|
return channelReadyPatch({
|
|
@@ -6731,8 +6737,7 @@ function createDiscordReadyStatusPatch(at = Date.now()) {
|
|
|
6731
6737
|
lastDisconnect: null
|
|
6732
6738
|
});
|
|
6733
6739
|
}
|
|
6734
|
-
|
|
6735
|
-
//#region extensions/discord/src/monitor/provider.lifecycle.ts
|
|
6740
|
+
// extensions/discord/src/monitor/provider.lifecycle.ts
|
|
6736
6741
|
const DEFAULT_DISCORD_GATEWAY_READY_TIMEOUT_MS = 15e3;
|
|
6737
6742
|
const DEFAULT_DISCORD_GATEWAY_RUNTIME_READY_TIMEOUT_MS = 3e4;
|
|
6738
6743
|
const MAX_DISCORD_GATEWAY_READY_TIMEOUT_MS = 12e4;
|
|
@@ -6780,7 +6785,17 @@ async function runDiscordGatewayLifecycle(params) {
|
|
|
6780
6785
|
const gatewayEmitter = params.gatewaySupervisor.emitter;
|
|
6781
6786
|
const loggingRuntime = params.runtime;
|
|
6782
6787
|
let lifecycleStopping = false;
|
|
6788
|
+
let hasConnected = gatewayReadyAtLifecycleStart;
|
|
6789
|
+
let reconnectStartedAt;
|
|
6783
6790
|
const pushStatus = (patch) => {
|
|
6791
|
+
if (patch.connected === true) {
|
|
6792
|
+
if (reconnectStartedAt !== void 0) loggingRuntime.log?.("discord gateway: connection recovered");
|
|
6793
|
+
hasConnected = true;
|
|
6794
|
+
reconnectStartedAt = void 0;
|
|
6795
|
+
} else if (patch.connected === false && patch.lifecycle === "recovering") patch.lastDisconnect = hasConnected ? {
|
|
6796
|
+
...typeof patch.lastDisconnect === "object" ? patch.lastDisconnect : {},
|
|
6797
|
+
at: reconnectStartedAt ??= Date.now()
|
|
6798
|
+
} : null;
|
|
6784
6799
|
params.statusSink?.(patch);
|
|
6785
6800
|
};
|
|
6786
6801
|
const gatewayReadyTimeoutMs = normalizeGatewayReadyTimeoutMs(process.env[DISCORD_GATEWAY_READY_TIMEOUT_ENV]) ?? DEFAULT_DISCORD_GATEWAY_READY_TIMEOUT_MS;
|
|
@@ -7021,8 +7036,7 @@ async function runDiscordGatewayLifecycle(params) {
|
|
|
7021
7036
|
}
|
|
7022
7037
|
}
|
|
7023
7038
|
}
|
|
7024
|
-
|
|
7025
|
-
//#region extensions/discord/src/internal/voice.ts
|
|
7039
|
+
// extensions/discord/src/internal/voice.ts
|
|
7026
7040
|
var VoicePlugin = class {
|
|
7027
7041
|
constructor() {
|
|
7028
7042
|
this.id = "voice";
|
|
@@ -7056,8 +7070,7 @@ var VoicePlugin = class {
|
|
|
7056
7070
|
};
|
|
7057
7071
|
}
|
|
7058
7072
|
};
|
|
7059
|
-
|
|
7060
|
-
//#region extensions/discord/src/monitor/presence.ts
|
|
7073
|
+
// extensions/discord/src/monitor/presence.ts
|
|
7061
7074
|
const DEFAULT_CUSTOM_ACTIVITY_TYPE = 4;
|
|
7062
7075
|
const CUSTOM_STATUS_NAME = "Custom Status";
|
|
7063
7076
|
function resolveDiscordPresenceUpdate(config) {
|
|
@@ -7086,8 +7099,7 @@ function resolveDiscordPresenceUpdate(config) {
|
|
|
7086
7099
|
afk: false
|
|
7087
7100
|
};
|
|
7088
7101
|
}
|
|
7089
|
-
|
|
7090
|
-
//#region extensions/discord/src/monitor/auto-presence.ts
|
|
7102
|
+
// extensions/discord/src/monitor/auto-presence.ts
|
|
7091
7103
|
const DEFAULT_INTERVAL_MS = 3e4;
|
|
7092
7104
|
const DEFAULT_MIN_UPDATE_INTERVAL_MS = 15e3;
|
|
7093
7105
|
const MIN_INTERVAL_MS = 5e3;
|
|
@@ -7180,8 +7192,7 @@ function createDiscordAutoPresenceController(params) {
|
|
|
7180
7192
|
stop: () => scheduler.stop()
|
|
7181
7193
|
};
|
|
7182
7194
|
}
|
|
7183
|
-
|
|
7184
|
-
//#region extensions/discord/src/monitor/gateway-metadata.ts
|
|
7195
|
+
// extensions/discord/src/monitor/gateway-metadata.ts
|
|
7185
7196
|
const DISCORD_GATEWAY_BOT_URL = "https://discord.com/api/v10/gateway/bot";
|
|
7186
7197
|
const DISCORD_API_HOST = "discord.com";
|
|
7187
7198
|
const DEFAULT_DISCORD_GATEWAY_URL = "wss://gateway.discord.gg/";
|
|
@@ -7334,8 +7345,7 @@ async function fetchDiscordGatewayMetadataGuarded(input, init, options) {
|
|
|
7334
7345
|
}).catch(() => {});
|
|
7335
7346
|
return response;
|
|
7336
7347
|
}
|
|
7337
|
-
|
|
7338
|
-
//#region extensions/discord/src/monitor/gateway-plugin.ts
|
|
7348
|
+
// extensions/discord/src/monitor/gateway-plugin.ts
|
|
7339
7349
|
const DISCORD_GATEWAY_POLICY_VIOLATION_CLOSE_CODE = 1008;
|
|
7340
7350
|
const DISCORD_GATEWAY_WS_RECEIVER_LIMIT_CODE = "WS_ERR_TOO_MANY_BUFFERED_PARTS";
|
|
7341
7351
|
const DISCORD_GATEWAY_CLOSE_REASON_LOG_MAX_CHARS = 240;
|
|
@@ -7540,8 +7550,7 @@ function waitForDiscordGatewayPluginRegistration(plugin) {
|
|
|
7540
7550
|
if (typeof plugin !== "object" || plugin === null) return;
|
|
7541
7551
|
return registrationPromises.get(plugin);
|
|
7542
7552
|
}
|
|
7543
|
-
|
|
7544
|
-
//#region extensions/discord/src/monitor/message-handler.preflight-channel-access.ts
|
|
7553
|
+
// extensions/discord/src/monitor/message-handler.preflight-channel-access.ts
|
|
7545
7554
|
function resolveDiscordPreflightChannelAccess(params) {
|
|
7546
7555
|
if (params.isGuildMessage && params.channelConfig?.enabled === false) {
|
|
7547
7556
|
logVerbose(`Blocked discord channel ${params.messageChannelId} (channel disabled, ${params.channelMatchMeta})`);
|
|
@@ -7573,8 +7582,7 @@ function resolveDiscordPreflightChannelAccess(params) {
|
|
|
7573
7582
|
}
|
|
7574
7583
|
return true;
|
|
7575
7584
|
}
|
|
7576
|
-
|
|
7577
|
-
//#region extensions/discord/src/monitor/listeners.guild-join.ts
|
|
7585
|
+
// extensions/discord/src/monitor/listeners.guild-join.ts
|
|
7578
7586
|
const DISCORD_GUILD_JOIN_INTRO_MAX_AGE_MS = 3e5;
|
|
7579
7587
|
var DiscordGuildJoinIntroductionListener = class extends GuildCreateListener {
|
|
7580
7588
|
constructor(params) {
|
|
@@ -7698,8 +7706,7 @@ var DiscordGuildJoinIntroductionListener = class extends GuildCreateListener {
|
|
|
7698
7706
|
await Promise.allSettled(this.pendingReports);
|
|
7699
7707
|
}
|
|
7700
7708
|
};
|
|
7701
|
-
|
|
7702
|
-
//#region extensions/discord/src/monitor/provider.startup.ts
|
|
7709
|
+
// extensions/discord/src/monitor/provider.startup.ts
|
|
7703
7710
|
async function createDiscordMonitorClient(params) {
|
|
7704
7711
|
let autoPresenceController = null;
|
|
7705
7712
|
const gateway = createDiscordGatewayPlugin(params);
|
|
@@ -7825,7 +7832,10 @@ function registerDiscordMonitorListeners(params) {
|
|
|
7825
7832
|
register(threadUpdateListener, new DiscordThreadReadyListener(threadUpdateListener), new DiscordThreadDeleteListener(params.cfg, params.accountId, params.logger));
|
|
7826
7833
|
let presenceListener;
|
|
7827
7834
|
if (params.discordConfig.intents?.presence) {
|
|
7828
|
-
presenceListener = new DiscordPresenceListener(
|
|
7835
|
+
presenceListener = new DiscordPresenceListener({
|
|
7836
|
+
...listenerOptions,
|
|
7837
|
+
allowNameMatching: isDangerousNameMatchingEnabled(params.discordConfig)
|
|
7838
|
+
});
|
|
7829
7839
|
register(presenceListener, new DiscordPresenceGuildCreateListener(presenceListener), new DiscordPresenceGuildDeleteListener(presenceListener), new DiscordPresenceReadyListener(presenceListener));
|
|
7830
7840
|
params.runtime.log?.("discord: GuildPresences intent enabled — presence listener registered");
|
|
7831
7841
|
}
|
|
@@ -7838,8 +7848,7 @@ function registerDiscordMonitorListeners(params) {
|
|
|
7838
7848
|
}
|
|
7839
7849
|
};
|
|
7840
7850
|
}
|
|
7841
|
-
|
|
7842
|
-
//#region extensions/discord/src/monitor/questions.ts
|
|
7851
|
+
// extensions/discord/src/monitor/questions.ts
|
|
7843
7852
|
function createDiscordQuestionButton(params) {
|
|
7844
7853
|
const authContext = params.authContext ?? {
|
|
7845
7854
|
cfg: params.cfg,
|
|
@@ -7889,15 +7898,13 @@ function createDiscordQuestionButton(params) {
|
|
|
7889
7898
|
}
|
|
7890
7899
|
};
|
|
7891
7900
|
}
|
|
7892
|
-
|
|
7893
|
-
//#region extensions/discord/src/monitor/startup-status.ts
|
|
7901
|
+
// extensions/discord/src/monitor/startup-status.ts
|
|
7894
7902
|
function formatDiscordStartupStatusMessage(params) {
|
|
7895
7903
|
const identitySuffix = params.botIdentity ? ` as ${params.botIdentity}` : "";
|
|
7896
7904
|
if (params.gatewayReady) return `logged in to discord${identitySuffix}`;
|
|
7897
7905
|
return `discord client initialized${identitySuffix}; awaiting gateway readiness`;
|
|
7898
7906
|
}
|
|
7899
|
-
|
|
7900
|
-
//#region extensions/discord/src/monitor/provider.ts
|
|
7907
|
+
// extensions/discord/src/monitor/provider.ts
|
|
7901
7908
|
const DEFAULT_DISCORD_MEDIA_MAX_MB = 100;
|
|
7902
7909
|
const DISCORD_ACP_STATUS_PROBE_TIMEOUT_MS = 8e3;
|
|
7903
7910
|
const DISCORD_ACP_STALE_RUNNING_ACTIVITY_MS = 12e4;
|
|
@@ -7958,7 +7965,7 @@ async function monitorDiscordProvider(opts) {
|
|
|
7958
7965
|
cfg,
|
|
7959
7966
|
accountId: account.accountId
|
|
7960
7967
|
}) ?? "pairing";
|
|
7961
|
-
const discordProviderSessionRuntime = await import("./provider-session.runtime-
|
|
7968
|
+
const discordProviderSessionRuntime = await import("./provider-session.runtime-CCBGrm-d.mjs");
|
|
7962
7969
|
const threadBindingIdleTimeoutMs = discordProviderSessionRuntime.resolveThreadBindingIdleTimeoutMs({
|
|
7963
7970
|
channelIdleHoursRaw: discordCfg.threadBindings?.idleHours,
|
|
7964
7971
|
sessionIdleHoursRaw: cfg.session?.threadBindings?.idleHours
|
|
@@ -8269,8 +8276,8 @@ async function monitorDiscordProvider(opts) {
|
|
|
8269
8276
|
};
|
|
8270
8277
|
let voiceManager = null;
|
|
8271
8278
|
if (voiceEnabled) {
|
|
8272
|
-
const { DiscordVoiceManager } = await import("./voice-runtime-
|
|
8273
|
-
const { DiscordVoiceGuildCreateListener, DiscordVoiceReadyListener, DiscordVoiceResumedListener, DiscordVoiceStateUpdateListener } = await import("./listeners-
|
|
8279
|
+
const { DiscordVoiceManager } = await import("./voice-runtime-CzV3fXxV.mjs");
|
|
8280
|
+
const { DiscordVoiceGuildCreateListener, DiscordVoiceReadyListener, DiscordVoiceResumedListener, DiscordVoiceStateUpdateListener } = await import("./listeners-DIyynRvV.mjs");
|
|
8274
8281
|
voiceManager = new DiscordVoiceManager({
|
|
8275
8282
|
...monitorOptions,
|
|
8276
8283
|
scheduler
|
|
@@ -8366,5 +8373,4 @@ async function monitorDiscordProvider(opts) {
|
|
|
8366
8373
|
}
|
|
8367
8374
|
}
|
|
8368
8375
|
}
|
|
8369
|
-
//#endregion
|
|
8370
8376
|
export { resolveDiscordTextCommandAccess as A, buildDiscordInboundAccessContext as C, createMessageDispatchData as D, createDiscordLivePolicyReader as E, registerDiscordListener as O, buildDiscordGroupSystemPrompt as S, handleDiscordDmCommandDecision as T, isDiscordRealtimeVoiceMode as _, waitForDiscordGatewayPluginRegistration as a, resolveDiscordVoiceMode as b, formatDiscordReplySkip as c, buildGuildLabel as d, resolveReplyContext as f, VOICE_RECONNECT_GRACE_MS as g, VOICE_CONNECT_READY_TIMEOUT_MS as h, resolveDiscordGatewayIntents as i, resolveDiscordDmCommandAccess as k, sanitizeDiscordFrontChannelReplyPayloads as l, MIN_SEGMENT_SECONDS as m, resolveDiscordPreflightChannelAccess as n, deliverDiscordReply as o, CAPTURE_FINALIZE_GRACE_MS as p, createDiscordGatewayPlugin as r, formatDiscordReplyDeliveryFailure as s, monitorDiscordProvider as t, buildDirectLabel as u, isVoiceChannel as v, createDiscordSupplementalContextAccessChecker as w, createDiscordNativeCommand as x, logVoiceVerbose as y };
|