@openclaw/discord 2026.9.1-beta.1 → 2026.9.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/dist/account-inspect-BY-ve3yH.js +45 -0
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-CfQ-vSyf.js → accounts-CwJQoLjM.js} +89 -45
- package/dist/action-runtime-api.js +1 -1
- package/dist/{activities-api-q-9PaaHH.js → activities-api-E-segZn6.js} +30 -17
- package/dist/activities-api.js +1 -1
- package/dist/{allow-list-BDMimASD.js → allow-list-C2JuH-R0.js} +10 -6
- package/dist/{api-DNVbJyEy.js → api-BfmEP6wp.js} +6 -5
- package/dist/api.js +18 -18
- package/dist/{approval-handler.runtime-B7qhK3fR.js → approval-handler.runtime-CW5k3mSa.js} +19 -12
- package/dist/{audit-CBEv_ERu.js → audit-B9rydv5a.js} +8 -7
- package/dist/{channel-Dx1tMTfx.js → channel-D93LnbTE.js} +29 -23
- package/dist/{channel-actions.runtime-CLWWu9nC.js → channel-actions.runtime-DMFv4doE.js} +16 -13
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-DOzXS2Pk.js → channel.setup-DTL7kPOM.js} +18 -18
- package/dist/{components-B9V5o361.js → components-DmXYIQ26.js} +111 -149
- package/dist/{config-schema-BR13IAx6.js → config-schema-B797-Spt.js} +19 -12
- package/dist/{conversation-binding-route-DJYrY2TQ.js → conversation-binding-route-24afmvEC.js} +1 -1
- package/dist/{directory-config-BK6eqekJ.js → directory-config-BD4YL7wT.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-DSAJSrJk.js → directory-live-BrFVc1Ds.js} +4 -4
- package/dist/{doctor-Cm7Y1pJ2.js → doctor-BUB41_lr.js} +5 -5
- package/dist/{doctor-contract-DsWvKIXF.js → doctor-contract-Co5vRCZ6.js} +9 -6
- package/dist/doctor-contract-api.js +3 -2
- package/dist/{handle-action.guild-admin-BdwCRHmm.js → handle-action.guild-admin-B0egstYq.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/ingress-identity-BCzfPPYM.js +60 -0
- package/dist/{message-handler-BXpWZyni.js → message-handler-Qdw9c0j4.js} +14 -10
- package/dist/{message-handler.preflight-Ba5LAY_X.js → message-handler.preflight-Dxi2yBfR.js} +41 -101
- package/dist/{message-handler.process-3HEzmemS.js → message-handler.process-BYDjtxZJ.js} +83 -109
- package/dist/{message-text-aiwO5R2F.js → message-text-BRVqYm-t.js} +11 -6
- package/dist/{outbound-adapter-BE4jSq2d.js → outbound-adapter-DEhthWTk.js} +52 -67
- package/dist/{outbound-components-oLpg8Qzb.js → outbound-components-DehyxvA4.js} +5 -4
- package/dist/{outbound-session-route-Cg15ZFJd.js → outbound-session-route-BFGRF9fE.js} +55 -12
- package/dist/{owner-access-UlYi9t0M.js → owner-access-yc1sX7Gx.js} +7 -6
- package/dist/{pluralkit-Tiyl70dx.js → pluralkit-XmmAHoV6.js} +2 -2
- package/dist/{probe-n6ZXxK8V.js → probe-3ovFAp3b.js} +3 -3
- package/dist/{probe.runtime-CN4bdPfZ.js → probe.runtime-BckHn3cJ.js} +1 -1
- package/dist/{provider-B11xwilq.js → provider-DuDtKbF8.js} +294 -131
- package/dist/{provider-session.runtime-B9xe-Qaf.js → provider-session.runtime-BA2BPyZ4.js} +3 -3
- package/dist/provider.runtime-Db8YwZBv.js +2 -0
- package/dist/{realtime-session.runtime-CU8IQUS-.js → realtime-session.runtime-DgSbX6ay.js} +103 -163
- package/dist/{resolve-allowlist-common-BLoYaxEG.js → resolve-allowlist-common-BJ5UZNNT.js} +3 -3
- package/dist/{resolve-channels-C2sT_n67.js → resolve-channels-CYseD5Uw.js} +4 -4
- package/dist/{resolve-users-CzpjLwjy.js → resolve-users-DrmhDrqm.js} +5 -4
- package/dist/{retry-Cv4jCU5Z.js → retry-BNCxiyyR.js} +120 -32
- package/dist/{retry-after-DdLPmPoa.js → retry-after-BrLjLUJi.js} +2 -1
- package/dist/{runtime-BHrTlFkf.js → runtime-BbWNtfyq.js} +127 -93
- package/dist/{runtime-CY4PRMF-.js → runtime-DB7Fb6AU.js} +2 -2
- package/dist/runtime-api.js +19 -19
- package/dist/{secret-config-contract-B3i6WxV5.js → secret-config-contract-DFu9hfU8.js} +14 -6
- package/dist/secret-contract-api.js +1 -1
- package/dist/{security-audit-BfJhAXZp.js → security-audit-DKfK-iPY.js} +10 -11
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/{security-audit.runtime-BVKF9VtY.js → security-audit.runtime-sKZyKgpx.js} +1 -1
- package/dist/{send-C49MFF9j.js → send-BnTEIeLE.js} +132 -100
- package/dist/{send.components-DKKAw5VX.js → send.components-BWVEcjRP.js} +21 -15
- package/dist/{send.outbound-zam0TrZx.js → send.outbound-b5xwHTlL.js} +35 -22
- package/dist/{send.shared-JjljcV4O.js → send.shared-5vxBTagO.js} +25 -18
- package/dist/{sender-identity-BJtfyise.js → sender-identity-Dt0imZyY.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-_5EcP4jW.js → shared-BSJWHEMA.js} +20 -14
- package/dist/{subagent-hooks-DQzvOptn.js → subagent-hooks-IzQKX4RQ.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{system-events-C7yxaHWP.js → system-events-BOiDS8b3.js} +2 -2
- package/dist/{target-resolver-vxIh6O3-.js → target-resolver-BVI8xSSC.js} +6 -5
- package/dist/targets-DbxVbq8k.js +3 -0
- package/dist/{thread-bindings-DW5F9vat.js → thread-bindings-D7mcaXQC.js} +6 -5
- package/dist/{thread-bindings.manager-ByOtwjo_.js → thread-bindings.manager-B1oySiVc.js} +37 -28
- package/dist/{thread-bindings.session-updates-CJb-BpPL.js → thread-bindings.session-updates-CC7HoQvt.js} +2 -1
- package/dist/{threading-agH1T_6s.js → threading-OQnL-0Zx.js} +8 -6
- package/dist/{timeouts-B9cy6RvQ.js → timeouts-D86uWLt_.js} +1 -1
- package/dist/{transcripts-source-BR11iHA4.js → transcripts-source-D8lH7AkN.js} +9 -4
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-Dc_YMY2e.js → typing-C9q0AQMb.js} +2 -2
- package/dist/{voice-runtime-DIeaa8fJ.js → voice-runtime-Dfhjh1tV.js} +433 -93
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/README.md +1 -1
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/conforms.d.ts +2 -0
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/package.json +3 -3
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubArray.d.ts +2 -0
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubObject.d.ts +2 -0
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubString.d.ts +2 -0
- package/node_modules/typebox/build/format/email.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
- package/node_modules/typebox/package.json +1 -1
- package/openclaw.plugin.json +14 -6
- package/package.json +6 -5
- package/skills/discord/SKILL.md +1 -1
- package/dist/account-inspect-BDfKyuvL.js +0 -89
- package/dist/provider.runtime-DiYaHvOz.js +0 -2
- package/dist/sdk-runtime-4geQHtXc.js +0 -338
- package/dist/targets-CtTKvntJ.js +0 -3
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { C as
|
|
3
|
-
import { c as resolveDiscordAccount, f as resolveDiscordAccountDmPolicy, l as resolveDiscordAccountAllowFrom, m as normalizeDiscordToken, p as resolveDiscordMaxLinesPerMessage } from "./accounts-
|
|
4
|
-
import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-
|
|
1
|
+
import { A as ThreadDeleteListener, C as InteractionCreateListener, D as PresenceUpdateListener, E as MessageReactionRemoveListener, G as Message, H as Command, K as User, L as RateLimitError, N as Client, O as ReadyListener, P as Plugin, Q as Modal, S as GuildDeleteListener, T as MessageReactionAddListener, U as CommandWithSubcommands, W as Guild, b as discord_exports, dt as Separator, ft as StringSelectMenu, gt as BaseMessageInteractiveComponent, j as ThreadUpdateListener, lt as Row, o as chunkDiscordTextWithMode, pt as TextDisplay, q as hasDiscordV2Components, rt as Container, tt as Button, w as MessageCreateListener, x as GuildCreateListener } from "./retry-BNCxiyyR.js";
|
|
2
|
+
import { C as parseDiscordActivityCustomIdForInteraction, D as parseDiscordModalCustomIdForInteraction, E as parseDiscordModalCustomId, O as decodeCustomIdComponent, T as parseDiscordComponentCustomIdForInteraction, c as parseExecApprovalData, k as encodeCustomIdComponent, o as parseDiscordQuestionData, w as parseDiscordComponentCustomId, y as buildDiscordActivityCustomId } from "./components-DmXYIQ26.js";
|
|
3
|
+
import { c as resolveDiscordAccount, f as resolveDiscordAccountDmPolicy, l as resolveDiscordAccountAllowFrom, m as normalizeDiscordToken, p as resolveDiscordMaxLinesPerMessage } from "./accounts-CwJQoLjM.js";
|
|
4
|
+
import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-BWVEcjRP.js";
|
|
5
5
|
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
6
|
-
import { a as isDiscordRateLimitResponseBody, o as summarizeDiscordResponseBody } from "./api-
|
|
7
|
-
import { C as resolveTimestampMs, a as normalizeDiscordSlug, b as formatDiscordReactionEmoji, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordCommandOwnerAllowFrom, f as resolveDiscordGuildEntry, g as resolveDiscordOwnerAllowFrom, h as resolveDiscordOwnerAccess, i as normalizeDiscordDisplaySlug, l as resolveDiscordChannelPolicyCommandAuthorizer, m as resolveDiscordMemberAllowed, n as isDiscordGroupAllowedByPolicy, o as resolveDiscordAllowListMatch, p as resolveDiscordMemberAccessState, r as normalizeDiscordAllowList, v as resolveGroupDmAllow, x as formatDiscordUserTag, y as shouldEmitDiscordReactionNotification } from "./allow-list-
|
|
8
|
-
import { B as validateDiscordProxyUrl, G as unregisterGateway, P as createDiscordRestClient, R as DISCORD_REST_TIMEOUT_MS, V as withValidatedDiscordProxy, W as registerGateway, b as canViewDiscordGuildChannel } from "./send.shared-
|
|
9
|
-
import { a as formatMention, t as sendMessageDiscord } from "./send.outbound-
|
|
6
|
+
import { a as isDiscordRateLimitResponseBody, o as summarizeDiscordResponseBody } from "./api-BfmEP6wp.js";
|
|
7
|
+
import { C as resolveTimestampMs, a as normalizeDiscordSlug, b as formatDiscordReactionEmoji, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordCommandOwnerAllowFrom, f as resolveDiscordGuildEntry, g as resolveDiscordOwnerAllowFrom, h as resolveDiscordOwnerAccess, i as normalizeDiscordDisplaySlug, l as resolveDiscordChannelPolicyCommandAuthorizer, m as resolveDiscordMemberAllowed, n as isDiscordGroupAllowedByPolicy, o as resolveDiscordAllowListMatch, p as resolveDiscordMemberAccessState, r as normalizeDiscordAllowList, s as resolveDiscordChannelConfig, v as resolveGroupDmAllow, x as formatDiscordUserTag, y as shouldEmitDiscordReactionNotification } from "./allow-list-C2JuH-R0.js";
|
|
8
|
+
import { B as validateDiscordProxyUrl, G as unregisterGateway, P as createDiscordRestClient, R as DISCORD_REST_TIMEOUT_MS, V as withValidatedDiscordProxy, W as registerGateway, b as canViewDiscordGuildChannel, w as hasAnyChannelPermissionDiscord } from "./send.shared-5vxBTagO.js";
|
|
9
|
+
import { a as formatMention, t as sendMessageDiscord } from "./send.outbound-b5xwHTlL.js";
|
|
10
10
|
import { t as isDiscordThreadChannelType } from "./channel-type-CVLZyGYS.js";
|
|
11
|
-
import { n as getDiscordActivitiesRuntime } from "./runtime-
|
|
12
|
-
import { n as resolveDiscordVoiceEnabled, r as authorizeDiscordVoiceIngress, t as resolveDiscordVoiceAccess } from "./owner-access-
|
|
11
|
+
import { n as getDiscordActivitiesRuntime } from "./runtime-DB7Fb6AU.js";
|
|
12
|
+
import { n as resolveDiscordVoiceEnabled, r as authorizeDiscordVoiceIngress, t as resolveDiscordVoiceAccess } from "./owner-access-yc1sX7Gx.js";
|
|
13
13
|
import { i as setPresence, t as clearPresences } from "./presence-cache-z1N8MbJ3.js";
|
|
14
|
-
import { s as sendVoiceMessageDiscord } from "./send-
|
|
15
|
-
import { c as raceWithTimeout, u as withAbortTimeout } from "./timeouts-
|
|
16
|
-
import { S as isDiscordExecApprovalClientEnabled, b as getDiscordExecApprovalApprovers, c as resolveDiscordEffectiveRoute, i as buildDiscordConversationRouteContext, n as DISCORD_APPROVAL_ALLOWED_MENTIONS, o as resolveDiscordBoundConversationRoute, r as formatDiscordApprovalDisplayValue, u as resolveDiscordConversationIdentity } from "./outbound-session-route-
|
|
17
|
-
import { t as
|
|
18
|
-
import { t as
|
|
19
|
-
import {
|
|
20
|
-
import { a as
|
|
14
|
+
import { _ as readMessagesDiscord, s as sendVoiceMessageDiscord } from "./send-BnTEIeLE.js";
|
|
15
|
+
import { c as raceWithTimeout, u as withAbortTimeout } from "./timeouts-D86uWLt_.js";
|
|
16
|
+
import { S as isDiscordExecApprovalClientEnabled, b as getDiscordExecApprovalApprovers, c as resolveDiscordEffectiveRoute, i as buildDiscordConversationRouteContext, n as DISCORD_APPROVAL_ALLOWED_MENTIONS, o as resolveDiscordBoundConversationRoute, r as formatDiscordApprovalDisplayValue, u as resolveDiscordConversationIdentity } from "./outbound-session-route-BFGRF9fE.js";
|
|
17
|
+
import { t as discordIngressIdentity } from "./ingress-identity-BCzfPPYM.js";
|
|
18
|
+
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-CYseD5Uw.js";
|
|
19
|
+
import { t as resolveDiscordUserAllowlist } from "./resolve-users-DrmhDrqm.js";
|
|
20
|
+
import { a as isThreadArchived, c as resolveDiscordChannelInfoSafe, f as resolveDiscordChannelTopicSafe, h as formatThreadBindingDurationLabel, l as resolveDiscordChannelNameSafe, r as getThreadBindingManager, s as resolveDiscordChannelIdSafe, u as resolveDiscordChannelParentIdSafe } from "./thread-bindings.manager-B1oySiVc.js";
|
|
21
|
+
import { a as probeDiscordApplicationId, r as parseApplicationIdFromToken } from "./probe-3ovFAp3b.js";
|
|
21
22
|
import { i as sanitizeRecentModels, n as normalizeModelRef, r as preferenceTimestampMs, t as buildPreferenceModelKey } from "./model-picker-preference-primitives-BHT1LkR_.js";
|
|
22
|
-
import {
|
|
23
|
-
import { i as resolveDiscordThreadParentInfo } from "./threading-
|
|
24
|
-
import { t as resolveDiscordSenderIdentity } from "./sender-identity-
|
|
23
|
+
import { m as resolveDiscordChannelInfo, u as resolveDiscordMessageStickers } from "./message-text-BRVqYm-t.js";
|
|
24
|
+
import { i as resolveDiscordThreadParentInfo } from "./threading-OQnL-0Zx.js";
|
|
25
|
+
import { t as resolveDiscordSenderIdentity } from "./sender-identity-Dt0imZyY.js";
|
|
25
26
|
import { logDebug, logError } from "openclaw/plugin-sdk/logging-core";
|
|
26
|
-
import { ApplicationCommandOptionType, ButtonStyle, ChannelType, ComponentType, GatewayCloseCodes, GatewayCloseCodes as GatewayCloseCodes$1, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes } from "discord-api-types/v10";
|
|
27
|
+
import { ApplicationCommandOptionType, ButtonStyle, ChannelType, ComponentType, GatewayCloseCodes, GatewayCloseCodes as GatewayCloseCodes$1, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes, PermissionFlagsBits } from "discord-api-types/v10";
|
|
27
28
|
import { Type } from "typebox";
|
|
28
29
|
import { Check, Errors } from "typebox/value";
|
|
29
30
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -37,6 +38,7 @@ import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
|
37
38
|
import { resolveAgentRoute } from "openclaw/plugin-sdk/routing";
|
|
38
39
|
import { asFiniteNumber, asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeStringEntries, parseFiniteNumber as parseFiniteNumber$1, parseStrictNonNegativeInteger as parseStrictNonNegativeInteger$1, summarizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
39
40
|
import { getRuntimeConfig, getRuntimeConfigSnapshot } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
41
|
+
import { resolveSendableOutboundReplyParts, resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
40
42
|
import { createHttp1EnvHttpProxyAgent, createHttp1ProxyAgent, createNodeProxyAgent, resolveEnvHttpProxyAgentOptions, wrapFetchWithAbortSignal } from "openclaw/plugin-sdk/fetch-runtime";
|
|
41
43
|
import { createNonExitingRuntime, createSubsystemLogger, danger, formatDurationSeconds, isVerbose, logVerbose, shouldLogVerbose, sleepWithAbort, warn } from "openclaw/plugin-sdk/runtime-env";
|
|
42
44
|
import { sliceUtf16Safe, truncateUtf16Safe, withTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
@@ -46,7 +48,6 @@ import { resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/rep
|
|
|
46
48
|
import { chunkItems, findCodeRegions, sanitizeAssistantVisibleText, sanitizeAssistantVisibleTextWithProfile } from "openclaw/plugin-sdk/text-chunking";
|
|
47
49
|
import { buildOutboundSessionContext, listMessageReceiptPlatformIds, resolveChannelStreamingBlockEnabled, sendDurableMessageBatch } from "openclaw/plugin-sdk/channel-outbound";
|
|
48
50
|
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
|
|
49
|
-
import { resolveSendableOutboundReplyParts, resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
50
51
|
import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
|
|
51
52
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
52
53
|
import { buildCommandTextFromArgs, findCommandByNativeName, formatCommandArgMenuTitle, listChatCommands, listNativeCommandSpecsForConfig, listSkillCommandsForAgents, resolveCommandAuthorizedFromAuthorizers, resolveEffectiveAgentRuntime, resolveNativeCommandSessionTargets, resolveStoredModelOverride, serializeCommandArgs } from "openclaw/plugin-sdk/command-auth-native";
|
|
@@ -57,13 +58,13 @@ import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plu
|
|
|
57
58
|
import { buildPairingReply, upsertChannelPairingRequest, upsertChannelPairingRequest as upsertChannelPairingRequest$1 } from "openclaw/plugin-sdk/conversation-runtime";
|
|
58
59
|
import * as conversationRuntime from "openclaw/plugin-sdk/conversation-binding-runtime";
|
|
59
60
|
import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
|
|
61
|
+
import { createChannelIngressResolver, readChannelIngressStoreAllowFromForDmPolicy } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
60
62
|
import { clearExpiredCooldowns, ensureAuthProfileStore, formatReasoningMessage, getPreparedModelCatalogSnapshot, isProfileInCooldown, listAgentIds, loadPreparedModelCatalog, resolveAgentAvatar, resolveAgentDir, resolveDefaultModelForAgent, resolveHumanDelayConfig, resolveProfilesUnavailableReason } from "openclaw/plugin-sdk/agent-runtime";
|
|
61
63
|
import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
|
|
62
64
|
import { resolveNativeCommandsEnabled, resolveNativeSkillsEnabled } from "openclaw/plugin-sdk/native-command-config-runtime";
|
|
63
65
|
import { requestHeartbeat } from "openclaw/plugin-sdk/heartbeat-runtime";
|
|
64
66
|
import { enqueueRoutedSystemEvent, enqueueRoutedSystemEvent as enqueueRoutedSystemEvent$1 } from "openclaw/plugin-sdk/system-event-runtime";
|
|
65
67
|
import { deleteSessionEntry, getSessionEntry, listSessionEntries, readSessionUpdatedAt as readSessionUpdatedAt$1, resolveStorePath, resolveStorePath as resolveStorePath$1 } from "openclaw/plugin-sdk/session-store-runtime";
|
|
66
|
-
import { createChannelIngressResolver, defineStableChannelIngressIdentity, readChannelIngressStoreAllowFromForDmPolicy } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
67
68
|
import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-dispatch-runtime";
|
|
68
69
|
import { createChannelPartialDeliveryError, dispatchChannelInboundTurn, formatInboundEnvelope, hasVisibleInboundReplyDispatch, isChannelPartialDeliveryError, resolveEnvelopeFormatOptions, resolveInboundSupplementalSenderAllowed, runChannelInboundEvent } from "openclaw/plugin-sdk/channel-inbound";
|
|
69
70
|
import { buildCommandTextFromArgs as buildCommandTextFromArgs$1, findCommandByNativeName as findCommandByNativeName$1, mergeNativeCommandSpecs, parseCommandArgs, resolveCommandArgChoices, resolveCommandArgMenu, serializeCommandArgs as serializeCommandArgs$1 } from "openclaw/plugin-sdk/native-command-registry";
|
|
@@ -80,6 +81,7 @@ import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runti
|
|
|
80
81
|
import { stripPlainTextToolCallBlocks } from "openclaw/plugin-sdk/tool-payload";
|
|
81
82
|
import { createChannelInteractiveDispatcher } from "openclaw/plugin-sdk/plugin-runtime";
|
|
82
83
|
import { resolveApprovalOverGateway } from "openclaw/plugin-sdk/approval-gateway-runtime";
|
|
84
|
+
import { reportChannelRoomJoin } from "openclaw/plugin-sdk/channel-join-intro-runtime";
|
|
83
85
|
import { resolveRequestUrl } from "openclaw/plugin-sdk/request-url";
|
|
84
86
|
import { fetchWithRuntimeDispatcher } from "openclaw/plugin-sdk/runtime-fetch";
|
|
85
87
|
import { Agent as Agent$1 } from "undici";
|
|
@@ -142,7 +144,7 @@ async function runDiscordListenerWithSlowLog(params) {
|
|
|
142
144
|
}
|
|
143
145
|
//#endregion
|
|
144
146
|
//#region extensions/discord/src/monitor/presence-events.ts
|
|
145
|
-
const DISCORD_PRESENCE_GREETING_COOLDOWN_MS =
|
|
147
|
+
const DISCORD_PRESENCE_GREETING_COOLDOWN_MS = 288e5;
|
|
146
148
|
function isDiscordOnlineStatus(status) {
|
|
147
149
|
return status === "online" || status === "idle" || status === "dnd";
|
|
148
150
|
}
|
|
@@ -181,9 +183,9 @@ function openDiscordPresenceCooldownStore() {
|
|
|
181
183
|
}
|
|
182
184
|
//#endregion
|
|
183
185
|
//#region extensions/discord/src/monitor/presence-emission-gate.ts
|
|
184
|
-
const DISCORD_PRESENCE_RECONNECT_SUPPRESS_MS =
|
|
186
|
+
const DISCORD_PRESENCE_RECONNECT_SUPPRESS_MS = 3e5;
|
|
185
187
|
const DISCORD_PRESENCE_BURST_LIMIT = 8;
|
|
186
|
-
const DISCORD_PRESENCE_BURST_WINDOW_MS =
|
|
188
|
+
const DISCORD_PRESENCE_BURST_WINDOW_MS = 6e4;
|
|
187
189
|
function resolveDiscordPresenceGateOptions(config) {
|
|
188
190
|
return {
|
|
189
191
|
reconnectSuppressMs: config?.reconnectSuppressSeconds !== void 0 ? config.reconnectSuppressSeconds * 1e3 : DISCORD_PRESENCE_RECONNECT_SUPPRESS_MS,
|
|
@@ -341,55 +343,16 @@ async function closeDiscordThreadSessions(params) {
|
|
|
341
343
|
}
|
|
342
344
|
//#endregion
|
|
343
345
|
//#region extensions/discord/src/monitor/dm-command-auth.ts
|
|
344
|
-
const DISCORD_ALLOW_LIST_PREFIXES = [
|
|
345
|
-
"discord:",
|
|
346
|
-
"user:",
|
|
347
|
-
"pk:"
|
|
348
|
-
];
|
|
349
346
|
const DISCORD_CHANNEL_ID = "discord";
|
|
350
|
-
const DISCORD_USER_ID_KIND = "stable-id";
|
|
351
|
-
const DISCORD_USER_NAME_KIND = "username";
|
|
352
|
-
function normalizeDiscordIdEntry(entry) {
|
|
353
|
-
const text = entry.trim();
|
|
354
|
-
if (!text) return null;
|
|
355
|
-
const maybeId = text.replace(/^<@!?/, "").replace(/>$/, "");
|
|
356
|
-
if (/^\d+$/.test(maybeId)) return maybeId;
|
|
357
|
-
const prefix = DISCORD_ALLOW_LIST_PREFIXES.find((entryPrefix) => text.startsWith(entryPrefix));
|
|
358
|
-
if (prefix) return text.slice(prefix.length).trim() || null;
|
|
359
|
-
return null;
|
|
360
|
-
}
|
|
361
|
-
function normalizeDiscordNameEntry(entry) {
|
|
362
|
-
const text = entry.trim();
|
|
363
|
-
if (!text || text === "*" || normalizeDiscordIdEntry(text)) return null;
|
|
364
|
-
const nameSlug = normalizeDiscordAllowList([text], DISCORD_ALLOW_LIST_PREFIXES)?.names.values().next().value;
|
|
365
|
-
return typeof nameSlug === "string" && nameSlug ? nameSlug : null;
|
|
366
|
-
}
|
|
367
|
-
function normalizeDiscordNameSubject(value) {
|
|
368
|
-
const nameSlug = normalizeDiscordAllowList([value], DISCORD_ALLOW_LIST_PREFIXES)?.names.values().next().value;
|
|
369
|
-
return typeof nameSlug === "string" && nameSlug ? nameSlug : null;
|
|
370
|
-
}
|
|
371
|
-
const discordIngressIdentity = defineStableChannelIngressIdentity({
|
|
372
|
-
key: "discordUserId",
|
|
373
|
-
kind: DISCORD_USER_ID_KIND,
|
|
374
|
-
normalizeEntry: normalizeDiscordIdEntry,
|
|
375
|
-
normalizeSubject: (value) => value.trim() || null,
|
|
376
|
-
sensitivity: "pii",
|
|
377
|
-
aliases: [["discordUserName", normalizeDiscordNameEntry], ["discordUserTag", () => null]].map(([key, normalizeEntry]) => ({
|
|
378
|
-
key,
|
|
379
|
-
kind: DISCORD_USER_NAME_KIND,
|
|
380
|
-
normalizeEntry,
|
|
381
|
-
normalizeSubject: normalizeDiscordNameSubject,
|
|
382
|
-
dangerous: true,
|
|
383
|
-
sensitivity: "pii"
|
|
384
|
-
}))
|
|
385
|
-
});
|
|
386
347
|
function createDiscordDmIngressSubject(sender) {
|
|
387
348
|
return {
|
|
388
349
|
stableId: sender.id,
|
|
389
350
|
aliases: {
|
|
390
351
|
discordUserName: sender.name,
|
|
391
|
-
discordUserTag: sender.tag
|
|
392
|
-
|
|
352
|
+
discordUserTag: sender.tag,
|
|
353
|
+
participantKind: sender.isPluralKit ? "pluralkit-member" : sender.authorKind
|
|
354
|
+
},
|
|
355
|
+
...sender.isPluralKit ? { authentication: { discordUserId: "asserted" } } : {}
|
|
393
356
|
};
|
|
394
357
|
}
|
|
395
358
|
function createDiscordDynamicAccessGroupResolver(params) {
|
|
@@ -464,7 +427,10 @@ async function resolveDiscordDmCommandAccess(params) {
|
|
|
464
427
|
},
|
|
465
428
|
dmPolicy: params.dmPolicy,
|
|
466
429
|
groupPolicy: "disabled",
|
|
467
|
-
policy: {
|
|
430
|
+
policy: {
|
|
431
|
+
mutableIdentifierMatching: params.allowNameMatching ? "enabled" : "disabled",
|
|
432
|
+
...params.minIdentifierAuthentication ? { minIdentifierAuthentication: params.minIdentifierAuthentication } : {}
|
|
433
|
+
},
|
|
468
434
|
allowFrom: params.configuredAllowFrom,
|
|
469
435
|
command: {
|
|
470
436
|
hasControlCommand: false,
|
|
@@ -494,7 +460,10 @@ async function resolveDiscordTextCommandAccess(params) {
|
|
|
494
460
|
accessGroupMembership,
|
|
495
461
|
dmPolicy: "allowlist",
|
|
496
462
|
groupPolicy: "allowlist",
|
|
497
|
-
policy: {
|
|
463
|
+
policy: {
|
|
464
|
+
mutableIdentifierMatching: params.allowNameMatching ? "enabled" : "disabled",
|
|
465
|
+
...params.minIdentifierAuthentication ? { minIdentifierAuthentication: params.minIdentifierAuthentication } : {}
|
|
466
|
+
},
|
|
498
467
|
allowFrom: ownerAllowFrom,
|
|
499
468
|
groupAllowFrom: commandGroup,
|
|
500
469
|
command: {
|
|
@@ -839,7 +808,7 @@ async function handleDiscordReactionEvent(params) {
|
|
|
839
808
|
};
|
|
840
809
|
const emitReaction = (text, parentPeerId) => {
|
|
841
810
|
const { contextKey } = resolveReactionBase();
|
|
842
|
-
|
|
811
|
+
const route = resolveAgentRoute({
|
|
843
812
|
cfg: params.cfg,
|
|
844
813
|
channel: "discord",
|
|
845
814
|
accountId: params.accountId,
|
|
@@ -853,7 +822,8 @@ async function handleDiscordReactionEvent(params) {
|
|
|
853
822
|
kind: "channel",
|
|
854
823
|
id: parentPeerId
|
|
855
824
|
} : void 0
|
|
856
|
-
})
|
|
825
|
+
});
|
|
826
|
+
enqueueRoutedSystemEvent(text, route, { contextKey });
|
|
857
827
|
};
|
|
858
828
|
const shouldNotifyReaction = (options) => shouldEmitDiscordReactionNotification({
|
|
859
829
|
mode: options.mode,
|
|
@@ -1523,7 +1493,7 @@ async function dispatchDiscordNativeAgentReply(params) {
|
|
|
1523
1493
|
deliver: async (payload) => {
|
|
1524
1494
|
if (params.suppressReplies) return {
|
|
1525
1495
|
visibleReplySent: false,
|
|
1526
|
-
suppression: { reason: "
|
|
1496
|
+
suppression: { reason: "channel_transform" }
|
|
1527
1497
|
};
|
|
1528
1498
|
const payloadDelivered = await deliverDiscordInteractionReply({
|
|
1529
1499
|
interaction: params.interaction,
|
|
@@ -1546,7 +1516,7 @@ async function dispatchDiscordNativeAgentReply(params) {
|
|
|
1546
1516
|
};
|
|
1547
1517
|
},
|
|
1548
1518
|
onDelivered: (payload, info, result) => {
|
|
1549
|
-
if (params.suppressReplies && info.kind === "final" && result?.suppression?.reason === "
|
|
1519
|
+
if (params.suppressReplies && info.kind === "final" && result?.suppression?.reason === "channel_transform" && payload.text?.trim()) hiddenFinalReply = payload;
|
|
1550
1520
|
if (info.kind === "final" && result?.visibleReplySent !== void 0 && (result.visibleReplySent || finalReplyOutcome !== "failed")) finalReplyOutcome = result.visibleReplySent ? "accepted" : "suppressed";
|
|
1551
1521
|
},
|
|
1552
1522
|
onError: (err, info) => {
|
|
@@ -1568,12 +1538,12 @@ async function dispatchDiscordNativeAgentReply(params) {
|
|
|
1568
1538
|
disableBlockStreaming: typeof blockStreamingEnabled === "boolean" ? !blockStreamingEnabled : void 0
|
|
1569
1539
|
}
|
|
1570
1540
|
});
|
|
1571
|
-
const
|
|
1541
|
+
const shouldSettleWithoutVisibleReply = params.suppressReplies || finalReplyOutcome === "suppressed" || turnResult.dispatched && (turnResult.dispatchResult.deliberateSilentTerminalReply === true || turnResult.dispatchResult.deferredToActiveRun !== void 0);
|
|
1572
1542
|
const dispatchResult = {
|
|
1573
1543
|
dispatched: turnResult.dispatched,
|
|
1574
1544
|
...hiddenFinalReply ? { hiddenFinalReply } : {}
|
|
1575
1545
|
};
|
|
1576
|
-
if (!didReply &&
|
|
1546
|
+
if (!didReply && shouldSettleWithoutVisibleReply) {
|
|
1577
1547
|
await settleDiscordInteractionWithoutVisibleReply(params.interaction);
|
|
1578
1548
|
return dispatchResult;
|
|
1579
1549
|
}
|
|
@@ -1695,7 +1665,7 @@ function buildDiscordCommandArgMenu(params) {
|
|
|
1695
1665
|
const commandLabel = command.nativeName ?? command.key;
|
|
1696
1666
|
const userId = interaction.user?.id ?? "";
|
|
1697
1667
|
const rows = chunkItems(menu.choices, 4).map((choices) => {
|
|
1698
|
-
|
|
1668
|
+
const buttons = choices.map((choice) => new DiscordCommandArgButton({
|
|
1699
1669
|
label: choice.label,
|
|
1700
1670
|
customId: buildDiscordCommandArgCustomId({
|
|
1701
1671
|
command: commandLabel,
|
|
@@ -1706,7 +1676,8 @@ function buildDiscordCommandArgMenu(params) {
|
|
|
1706
1676
|
ctx: params.ctx,
|
|
1707
1677
|
safeInteractionCall: params.safeInteractionCall,
|
|
1708
1678
|
dispatchCommandInteraction: params.dispatchCommandInteraction
|
|
1709
|
-
}))
|
|
1679
|
+
}));
|
|
1680
|
+
return new Row(buttons);
|
|
1710
1681
|
});
|
|
1711
1682
|
return {
|
|
1712
1683
|
content: formatCommandArgMenuTitle({
|
|
@@ -2312,8 +2283,8 @@ function paginateItems(params) {
|
|
|
2312
2283
|
};
|
|
2313
2284
|
}
|
|
2314
2285
|
async function loadDiscordModelPickerData(cfg, agentId) {
|
|
2315
|
-
const {
|
|
2316
|
-
return
|
|
2286
|
+
const { buildPreparedModelsProviderData } = await loadModelsProviderRuntime();
|
|
2287
|
+
return buildPreparedModelsProviderData(cfg, agentId);
|
|
2317
2288
|
}
|
|
2318
2289
|
function buildDiscordModelPickerCustomId(params) {
|
|
2319
2290
|
const userId = params.userId.trim();
|
|
@@ -2611,7 +2582,7 @@ function buildBucketSelectRow(params) {
|
|
|
2611
2582
|
value: bucket.id,
|
|
2612
2583
|
default: bucket.id === params.currentBucketId
|
|
2613
2584
|
}));
|
|
2614
|
-
|
|
2585
|
+
const select = createModelSelect({
|
|
2615
2586
|
customId: buildDiscordModelPickerCustomId({
|
|
2616
2587
|
command: params.command,
|
|
2617
2588
|
action: "bucket",
|
|
@@ -2626,7 +2597,8 @@ function buildBucketSelectRow(params) {
|
|
|
2626
2597
|
}),
|
|
2627
2598
|
options,
|
|
2628
2599
|
placeholder: params.view === "providers" ? "Filter providers by letter range" : "Filter models by letter range"
|
|
2629
|
-
})
|
|
2600
|
+
});
|
|
2601
|
+
return new Row([select]);
|
|
2630
2602
|
}
|
|
2631
2603
|
function getRuntimeChoices(params) {
|
|
2632
2604
|
const choices = params.data.runtimeChoicesByProvider?.get(normalizeProviderId(params.provider));
|
|
@@ -3052,7 +3024,7 @@ function formatRecentsButtonLabel(modelRef, suffix) {
|
|
|
3052
3024
|
const maxLen = 80;
|
|
3053
3025
|
const label = suffix ? `${modelRef} ${suffix}` : modelRef;
|
|
3054
3026
|
if (label.length <= maxLen) return label;
|
|
3055
|
-
return suffix ? `${sliceUtf16Safe(modelRef, 0, maxLen - suffix.length - 2)}… ${suffix}` : `${sliceUtf16Safe(modelRef, 0,
|
|
3027
|
+
return suffix ? `${sliceUtf16Safe(modelRef, 0, maxLen - suffix.length - 2)}… ${suffix}` : `${sliceUtf16Safe(modelRef, 0, 79)}…`;
|
|
3056
3028
|
}
|
|
3057
3029
|
function createModelRefToken(modelRef) {
|
|
3058
3030
|
const parsed = parseCurrentModelRef(modelRef);
|
|
@@ -3293,12 +3265,13 @@ function resolveDiscordModelPickerCurrentModel(params) {
|
|
|
3293
3265
|
const fallback = `${params.data.resolvedDefault.provider}/${params.data.resolvedDefault.model}`;
|
|
3294
3266
|
try {
|
|
3295
3267
|
const storePath = resolveStorePath(params.cfg.session?.store, { agentId: params.route.agentId });
|
|
3268
|
+
const sessionEntry = getSessionEntry({
|
|
3269
|
+
storePath,
|
|
3270
|
+
sessionKey: params.route.sessionKey,
|
|
3271
|
+
readConsistency: "latest"
|
|
3272
|
+
});
|
|
3296
3273
|
const override = resolveStoredModelOverride({
|
|
3297
|
-
sessionEntry
|
|
3298
|
-
storePath,
|
|
3299
|
-
sessionKey: params.route.sessionKey,
|
|
3300
|
-
readConsistency: "latest"
|
|
3301
|
-
}),
|
|
3274
|
+
sessionEntry,
|
|
3302
3275
|
loadSessionEntry: (sessionKey) => getSessionEntry({
|
|
3303
3276
|
storePath,
|
|
3304
3277
|
sessionKey,
|
|
@@ -3317,8 +3290,9 @@ function resolveDiscordModelPickerCurrentModel(params) {
|
|
|
3317
3290
|
}
|
|
3318
3291
|
function resolveDiscordModelPickerCurrentRuntime(params) {
|
|
3319
3292
|
try {
|
|
3293
|
+
const storePath = resolveStorePath(params.cfg.session?.store, { agentId: params.route.agentId });
|
|
3320
3294
|
const sessionRuntime = normalizeOptionalString(getSessionEntry({
|
|
3321
|
-
storePath
|
|
3295
|
+
storePath,
|
|
3322
3296
|
sessionKey: params.route.sessionKey,
|
|
3323
3297
|
readConsistency: "latest"
|
|
3324
3298
|
})?.agentRuntimeOverride);
|
|
@@ -3974,7 +3948,8 @@ function buildDiscordCommandOptions(params) {
|
|
|
3974
3948
|
await interaction.respond([]);
|
|
3975
3949
|
return;
|
|
3976
3950
|
}
|
|
3977
|
-
const
|
|
3951
|
+
const focused = interaction.options.getFocused();
|
|
3952
|
+
const focusValue = normalizeLowercaseStringOrEmpty(focused?.value);
|
|
3978
3953
|
const context = typeof arg.choices === "function" && resolveChoiceContext ? await resolveChoiceContext(interaction) : null;
|
|
3979
3954
|
const currentCfg = resolveConfig?.() ?? cfg;
|
|
3980
3955
|
const choiceCatalog = command.key === "think" ? getPreparedModelCatalogSnapshot({
|
|
@@ -4856,7 +4831,10 @@ const GatewayIntents = GatewayIntentBits;
|
|
|
4856
4831
|
const READY_STATE_OPEN = 1;
|
|
4857
4832
|
const DEFAULT_GATEWAY_URL = "wss://gateway.discord.gg/";
|
|
4858
4833
|
const DISCORD_GATEWAY_PAYLOAD_LIMIT_BYTES = 4096;
|
|
4859
|
-
const DISCORD_GATEWAY_WS_CLIENT_OPTIONS = Object.freeze({
|
|
4834
|
+
const DISCORD_GATEWAY_WS_CLIENT_OPTIONS = Object.freeze({
|
|
4835
|
+
maxPayload: 16777216,
|
|
4836
|
+
handshakeTimeout: 3e4
|
|
4837
|
+
});
|
|
4860
4838
|
const INVALID_SESSION_MIN_DELAY_MS = 1e3;
|
|
4861
4839
|
const INVALID_SESSION_JITTER_MS = 4e3;
|
|
4862
4840
|
const RESUME_FAILURE_THRESHOLD = 3;
|
|
@@ -5039,12 +5017,10 @@ var GatewayPlugin = class extends Plugin {
|
|
|
5039
5017
|
minDelayMs: INVALID_SESSION_MIN_DELAY_MS + Math.floor(Math.random() * INVALID_SESSION_JITTER_MS)
|
|
5040
5018
|
});
|
|
5041
5019
|
break;
|
|
5042
|
-
case GatewayOpcodes.Reconnect:
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
});
|
|
5047
|
-
break;
|
|
5020
|
+
case GatewayOpcodes.Reconnect: this.scheduleReconnect({
|
|
5021
|
+
reason: "reconnect-opcode",
|
|
5022
|
+
preferResume: true
|
|
5023
|
+
});
|
|
5048
5024
|
}
|
|
5049
5025
|
}
|
|
5050
5026
|
startHeartbeat(intervalMs) {
|
|
@@ -5486,7 +5462,7 @@ const DEFAULT_DISCORD_GATEWAY_URL = "wss://gateway.discord.gg/";
|
|
|
5486
5462
|
const DEFAULT_DISCORD_GATEWAY_INFO_TIMEOUT_MS = 3e4;
|
|
5487
5463
|
const MAX_DISCORD_GATEWAY_INFO_TIMEOUT_MS = 12e4;
|
|
5488
5464
|
const DISCORD_GATEWAY_INFO_TIMEOUT_ENV = "OPENCLAW_DISCORD_GATEWAY_INFO_TIMEOUT_MS";
|
|
5489
|
-
const DISCORD_GATEWAY_METADATA_MAX_BYTES =
|
|
5465
|
+
const DISCORD_GATEWAY_METADATA_MAX_BYTES = 4194304;
|
|
5490
5466
|
const DISCORD_GATEWAY_METADATA_FALLBACK_LOG_INTERVAL_MS = 6e4;
|
|
5491
5467
|
const discordGatewayBotInfoSchema = Type.Object({
|
|
5492
5468
|
url: Type.String({ minLength: 1 }),
|
|
@@ -5681,7 +5657,6 @@ async function fetchDiscordGatewayMetadataGuarded(input, init, options) {
|
|
|
5681
5657
|
}
|
|
5682
5658
|
//#endregion
|
|
5683
5659
|
//#region extensions/discord/src/monitor/gateway-plugin.ts
|
|
5684
|
-
const DISCORD_GATEWAY_HANDSHAKE_TIMEOUT_MS = 3e4;
|
|
5685
5660
|
const DISCORD_GATEWAY_POLICY_VIOLATION_CLOSE_CODE = 1008;
|
|
5686
5661
|
const DISCORD_GATEWAY_WS_RECEIVER_LIMIT_CODE = "WS_ERR_TOO_MANY_BUFFERED_PARTS";
|
|
5687
5662
|
const DISCORD_GATEWAY_CLOSE_REASON_LOG_MAX_CHARS = 240;
|
|
@@ -5798,7 +5773,6 @@ function createGatewayPlugin(params) {
|
|
|
5798
5773
|
const wsFlowId = randomUUID();
|
|
5799
5774
|
const socket = new ((params.testing?.webSocketCtor) ?? ws.default)(url, {
|
|
5800
5775
|
...DISCORD_GATEWAY_WS_CLIENT_OPTIONS,
|
|
5801
|
-
handshakeTimeout: DISCORD_GATEWAY_HANDSHAKE_TIMEOUT_MS,
|
|
5802
5776
|
...params.wsAgent ? { agent: params.wsAgent } : {}
|
|
5803
5777
|
});
|
|
5804
5778
|
let lastTransportError;
|
|
@@ -6526,7 +6500,7 @@ async function runDiscordGatewayLifecycle(params) {
|
|
|
6526
6500
|
gatewayEmitter?.removeListener(DISCORD_GATEWAY_TRANSPORT_ACTIVITY_EVENT, onGatewayTransportActivity);
|
|
6527
6501
|
if (params.voiceManager) {
|
|
6528
6502
|
await params.voiceManager.destroy();
|
|
6529
|
-
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-
|
|
6503
|
+
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-D8lH7AkN.js").then((n) => n.n);
|
|
6530
6504
|
setDiscordTranscriptsVoiceManager({
|
|
6531
6505
|
accountId: params.accountId,
|
|
6532
6506
|
manager: null
|
|
@@ -6541,7 +6515,7 @@ async function runDiscordGatewayLifecycle(params) {
|
|
|
6541
6515
|
let discordVoiceRuntimePromise;
|
|
6542
6516
|
let discordProviderSessionRuntimePromise;
|
|
6543
6517
|
async function loadDiscordVoiceRuntime() {
|
|
6544
|
-
const promise = discordVoiceRuntimePromise ?? import("./voice-runtime-
|
|
6518
|
+
const promise = discordVoiceRuntimePromise ?? import("./voice-runtime-Dfhjh1tV.js").then((n) => n.t);
|
|
6545
6519
|
discordVoiceRuntimePromise = promise;
|
|
6546
6520
|
try {
|
|
6547
6521
|
return await promise;
|
|
@@ -6551,7 +6525,7 @@ async function loadDiscordVoiceRuntime() {
|
|
|
6551
6525
|
}
|
|
6552
6526
|
}
|
|
6553
6527
|
async function loadDiscordProviderSessionRuntime() {
|
|
6554
|
-
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-
|
|
6528
|
+
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-BA2BPyZ4.js");
|
|
6555
6529
|
discordProviderSessionRuntimePromise = promise;
|
|
6556
6530
|
try {
|
|
6557
6531
|
return await promise;
|
|
@@ -6578,11 +6552,15 @@ const discordProviderRuntime = {
|
|
|
6578
6552
|
//#endregion
|
|
6579
6553
|
//#region extensions/discord/src/monitor/provider.acp.ts
|
|
6580
6554
|
const DISCORD_ACP_STATUS_PROBE_TIMEOUT_MS = 8e3;
|
|
6581
|
-
const DISCORD_ACP_STALE_RUNNING_ACTIVITY_MS =
|
|
6555
|
+
const DISCORD_ACP_STALE_RUNNING_ACTIVITY_MS = 12e4;
|
|
6582
6556
|
function isLegacyMissingSessionError(message) {
|
|
6583
6557
|
return message.includes("Session is not ACP-enabled") || message.includes("ACP session metadata missing");
|
|
6584
6558
|
}
|
|
6585
6559
|
function classifyAcpStatusProbeError(params) {
|
|
6560
|
+
if (params.isAcpRuntimeError(params.error) && ["SESSION_OWNER_MIGRATION_REQUIRED", "SESSION_OWNER_UNSUPPORTED"].includes(params.error.detailCode ?? "")) return {
|
|
6561
|
+
status: "uncertain",
|
|
6562
|
+
reason: formatErrorMessage$1(params.error)
|
|
6563
|
+
};
|
|
6586
6564
|
if (params.isAcpRuntimeError(params.error) && params.error.code === "ACP_SESSION_INIT_FAILED") return {
|
|
6587
6565
|
status: "stale",
|
|
6588
6566
|
reason: "session-init-failed"
|
|
@@ -6610,18 +6588,20 @@ async function probeDiscordAcpBindingHealth(params) {
|
|
|
6610
6588
|
const { getAcpSessionManager, isAcpRuntimeError } = params.providerSessionRuntime;
|
|
6611
6589
|
const manager = getAcpSessionManager();
|
|
6612
6590
|
const statusProbeAbortController = new AbortController();
|
|
6591
|
+
const statusPromise = manager.getSessionStatus({
|
|
6592
|
+
cfg: params.cfg,
|
|
6593
|
+
sessionKey: params.sessionKey,
|
|
6594
|
+
agentId: params.agentId,
|
|
6595
|
+
signal: statusProbeAbortController.signal
|
|
6596
|
+
}).then((status) => ({
|
|
6597
|
+
kind: "status",
|
|
6598
|
+
status
|
|
6599
|
+
})).catch((error) => ({
|
|
6600
|
+
kind: "error",
|
|
6601
|
+
error
|
|
6602
|
+
}));
|
|
6613
6603
|
const result = await raceWithTimeout({
|
|
6614
|
-
promise:
|
|
6615
|
-
cfg: params.cfg,
|
|
6616
|
-
sessionKey: params.sessionKey,
|
|
6617
|
-
signal: statusProbeAbortController.signal
|
|
6618
|
-
}).then((status) => ({
|
|
6619
|
-
kind: "status",
|
|
6620
|
-
status
|
|
6621
|
-
})).catch((error) => ({
|
|
6622
|
-
kind: "error",
|
|
6623
|
-
error
|
|
6624
|
-
})),
|
|
6604
|
+
promise: statusPromise,
|
|
6625
6605
|
timeoutMs: DISCORD_ACP_STATUS_PROBE_TIMEOUT_MS,
|
|
6626
6606
|
onTimeout: () => ({ kind: "timeout" })
|
|
6627
6607
|
});
|
|
@@ -6792,7 +6772,8 @@ async function resolveGuildEntriesByChannelAllowlist(params) {
|
|
|
6792
6772
|
};
|
|
6793
6773
|
}
|
|
6794
6774
|
}
|
|
6795
|
-
|
|
6775
|
+
const mapping = [...mappingByTarget.values()].map((group) => formatDiscordChannelResolvedGroup(group));
|
|
6776
|
+
summarizeMapping("discord channels", mapping, unresolved, params.runtime);
|
|
6796
6777
|
return nextGuilds;
|
|
6797
6778
|
} catch (err) {
|
|
6798
6779
|
params.runtime.log?.(`discord channel resolve failed; using config entries. ${formatErrorMessage$1(err)}`);
|
|
@@ -6803,11 +6784,12 @@ async function resolveAllowFromByUserAllowlist(params) {
|
|
|
6803
6784
|
const allowEntries = normalizeStringEntries(params.allowFrom).filter((entry) => entry !== "*");
|
|
6804
6785
|
if (allowEntries.length === 0) return params.allowFrom;
|
|
6805
6786
|
try {
|
|
6806
|
-
const
|
|
6787
|
+
const resolvedUsers = await resolveDiscordUserAllowlist({
|
|
6807
6788
|
token: params.token,
|
|
6808
6789
|
entries: allowEntries,
|
|
6809
6790
|
fetcher: params.fetcher
|
|
6810
|
-
})
|
|
6791
|
+
});
|
|
6792
|
+
const { resolvedMap, mapping, unresolved } = buildAllowlistResolutionSummary(resolvedUsers, {
|
|
6811
6793
|
formatResolved: formatDiscordUserResolved,
|
|
6812
6794
|
formatUnresolved: formatDiscordUserUnresolved
|
|
6813
6795
|
});
|
|
@@ -6836,11 +6818,12 @@ async function resolveGuildEntriesByUserAllowlist(params) {
|
|
|
6836
6818
|
const userEntries = collectGuildUserEntries(params.guildEntries);
|
|
6837
6819
|
if (userEntries.size === 0) return params.guildEntries;
|
|
6838
6820
|
try {
|
|
6839
|
-
const
|
|
6821
|
+
const resolvedUsers = await resolveDiscordUserAllowlist({
|
|
6840
6822
|
token: params.token,
|
|
6841
6823
|
entries: Array.from(userEntries),
|
|
6842
6824
|
fetcher: params.fetcher
|
|
6843
|
-
})
|
|
6825
|
+
});
|
|
6826
|
+
const { resolvedMap, mapping, unresolved } = buildAllowlistResolutionSummary(resolvedUsers, {
|
|
6844
6827
|
formatResolved: formatDiscordUserResolved,
|
|
6845
6828
|
formatUnresolved: formatDiscordUserUnresolved
|
|
6846
6829
|
});
|
|
@@ -7215,7 +7198,7 @@ function logDiscordResolvedConfig(params) {
|
|
|
7215
7198
|
limit: 4,
|
|
7216
7199
|
emptyText: "any"
|
|
7217
7200
|
});
|
|
7218
|
-
logVerbose(`discord: config dm=${params.dmEnabled ? "on" : "off"} dmPolicy=${params.dmPolicy} allowFrom=${allowFromSummary} groupDm=${params.groupDmEnabled ? "on" : "off"} groupDmChannels=${groupDmChannelSummary} groupPolicy=${params.groupPolicy} guilds=${guildSummary} historyLimit=${params.historyLimit} mediaMaxMb=${Math.round(params.mediaMaxBytes /
|
|
7201
|
+
logVerbose(`discord: config dm=${params.dmEnabled ? "on" : "off"} dmPolicy=${params.dmPolicy} allowFrom=${allowFromSummary} groupDm=${params.groupDmEnabled ? "on" : "off"} groupDmChannels=${groupDmChannelSummary} groupPolicy=${params.groupPolicy} guilds=${guildSummary} historyLimit=${params.historyLimit} mediaMaxMb=${Math.round(params.mediaMaxBytes / 1048576)} native=${params.nativeEnabled ? "on" : "off"} nativeSkills=${params.nativeSkillsEnabled ? "on" : "off"} accessGroups=${params.useAccessGroups ? "on" : "off"} threadBindings=${params.threadBindingsEnabled ? "on" : "off"} threadIdleTimeout=${formatThreadBindingDurationForConfigLabel(params.threadBindingIdleTimeoutMs)} threadMaxAge=${formatThreadBindingDurationForConfigLabel(params.threadBindingMaxAgeMs)}`);
|
|
7219
7202
|
}
|
|
7220
7203
|
//#endregion
|
|
7221
7204
|
//#region extensions/discord/src/monitor/provider.deploy-errors.ts
|
|
@@ -8203,7 +8186,9 @@ function stripDiscordInternalChannelLines(text) {
|
|
|
8203
8186
|
return kept.join("\n");
|
|
8204
8187
|
}
|
|
8205
8188
|
function sanitizeDiscordFrontChannelText(text) {
|
|
8206
|
-
|
|
8189
|
+
const withoutToolCallBlocks = stripPlainTextToolCallBlocks(text, { resolveProtectedRanges: findCodeRegions });
|
|
8190
|
+
const withoutAssistantScaffolding = sanitizeAssistantVisibleText(withoutToolCallBlocks);
|
|
8191
|
+
return collapseExcessBlankLines(stripDiscordInternalChannelLines(stripPlainTextToolCallBlocks(withoutAssistantScaffolding, { resolveProtectedRanges: findCodeRegions }))).trim();
|
|
8207
8192
|
}
|
|
8208
8193
|
function sanitizeDiscordFrontChannelReplyPayloads(payloads, options = {}) {
|
|
8209
8194
|
const preserveVerboseToolProgress = options.kind === "tool";
|
|
@@ -8242,7 +8227,8 @@ function resolveBoundThreadBinding(params) {
|
|
|
8242
8227
|
}
|
|
8243
8228
|
function resolveBindingIdentity(cfg, binding) {
|
|
8244
8229
|
if (!binding) return;
|
|
8245
|
-
const
|
|
8230
|
+
const displayName = `🤖 ${binding.label?.trim() || binding.agentId}`.trim() || "🤖 agent";
|
|
8231
|
+
const identity = { name: truncateUtf16Safe(displayName, 80) };
|
|
8246
8232
|
try {
|
|
8247
8233
|
const avatar = resolveAgentAvatar(cfg, binding.agentId);
|
|
8248
8234
|
if (avatar.kind === "remote") identity.avatarUrl = avatar.url;
|
|
@@ -8317,6 +8303,7 @@ async function deliverDiscordReply(params) {
|
|
|
8317
8303
|
threadId: delivery.threadId,
|
|
8318
8304
|
identity: delivery.identity,
|
|
8319
8305
|
onPlatformSendDispatch: params.onPlatformSendDispatch,
|
|
8306
|
+
assertDirectAdapterHandoff: params.assertPlatformSendAuthorized,
|
|
8320
8307
|
deps: createDiscordDeliveryDeps({
|
|
8321
8308
|
cfg: params.cfg,
|
|
8322
8309
|
token: params.token,
|
|
@@ -8355,7 +8342,7 @@ async function deliverDiscordReply(params) {
|
|
|
8355
8342
|
//#endregion
|
|
8356
8343
|
//#region extensions/discord/src/monitor/agent-components.dispatch.ts
|
|
8357
8344
|
const loadConversationRuntime$1 = createLazyRuntimeModule(() => import("./agent-components.runtime-CEPrf2SY.js"));
|
|
8358
|
-
const loadTypingRuntime = createLazyRuntimeModule(() => import("./typing-
|
|
8345
|
+
const loadTypingRuntime = createLazyRuntimeModule(() => import("./typing-C9q0AQMb.js").then((n) => n.n));
|
|
8359
8346
|
function buildDiscordComponentConversationLabel(params) {
|
|
8360
8347
|
if (params.interactionCtx.isDirectMessage) return buildDirectLabel(params.interactionCtx.user);
|
|
8361
8348
|
if (params.interactionCtx.isGroupDm) return `Group DM #${params.channelCtx.channelName ?? params.interactionCtx.channelId} channel id:${params.interactionCtx.channelId}`;
|
|
@@ -8596,7 +8583,8 @@ async function dispatchDiscordComponentEvent(params) {
|
|
|
8596
8583
|
mediaLocalRoots,
|
|
8597
8584
|
kind: info.kind,
|
|
8598
8585
|
bindPendingFinalDelivery: info.bindPendingFinalDelivery,
|
|
8599
|
-
onPlatformSendDispatch: info.onPlatformSendDispatch
|
|
8586
|
+
onPlatformSendDispatch: info.onPlatformSendDispatch,
|
|
8587
|
+
assertPlatformSendAuthorized: info.assertPlatformSendAuthorized
|
|
8600
8588
|
});
|
|
8601
8589
|
if (result.visibleReplySent) replyReference.markSent();
|
|
8602
8590
|
return result;
|
|
@@ -8761,7 +8749,7 @@ async function dispatchPluginDiscordInteractiveEvent(params) {
|
|
|
8761
8749
|
}
|
|
8762
8750
|
//#endregion
|
|
8763
8751
|
//#region extensions/discord/src/monitor/agent-components.handlers.ts
|
|
8764
|
-
const loadComponentsRuntime = createLazyRuntimeModule(() => import("./components-
|
|
8752
|
+
const loadComponentsRuntime = createLazyRuntimeModule(() => import("./components-DmXYIQ26.js").then((n) => n.t));
|
|
8765
8753
|
async function handleDiscordComponentEvent(params) {
|
|
8766
8754
|
const parsed = parseDiscordComponentData(params.data, resolveInteractionCustomId(params.interaction));
|
|
8767
8755
|
if (!parsed) {
|
|
@@ -8903,8 +8891,9 @@ async function handleDiscordModalTrigger(params) {
|
|
|
8903
8891
|
await replyUnavailableComponentInteraction(params.interaction, "This form has expired.");
|
|
8904
8892
|
return;
|
|
8905
8893
|
}
|
|
8894
|
+
const resolvedModalId = consumed.modalId ?? modalId;
|
|
8906
8895
|
const modalEntry = await resolveDiscordModalEntryWithPersistence({
|
|
8907
|
-
id:
|
|
8896
|
+
id: resolvedModalId,
|
|
8908
8897
|
consume: false
|
|
8909
8898
|
});
|
|
8910
8899
|
if (!modalEntry) {
|
|
@@ -9611,6 +9600,170 @@ var VoicePlugin = class extends Plugin {
|
|
|
9611
9600
|
}
|
|
9612
9601
|
};
|
|
9613
9602
|
//#endregion
|
|
9603
|
+
//#region extensions/discord/src/monitor/message-handler.preflight-channel-access.ts
|
|
9604
|
+
function resolveDiscordPreflightChannelAccess(params) {
|
|
9605
|
+
if (params.isGuildMessage && params.channelConfig?.enabled === false) {
|
|
9606
|
+
logDebug(`[discord-preflight] drop: channel disabled`);
|
|
9607
|
+
logVerbose(`Blocked discord channel ${params.messageChannelId} (channel disabled, ${params.channelMatchMeta})`);
|
|
9608
|
+
return {
|
|
9609
|
+
allowed: false,
|
|
9610
|
+
channelAllowlistConfigured: false,
|
|
9611
|
+
channelAllowed: false
|
|
9612
|
+
};
|
|
9613
|
+
}
|
|
9614
|
+
const groupDmAllowed = params.isGroupDm && resolveGroupDmAllow({
|
|
9615
|
+
channels: params.groupDmChannels,
|
|
9616
|
+
channelId: params.messageChannelId,
|
|
9617
|
+
channelName: params.displayChannelName,
|
|
9618
|
+
channelSlug: params.displayChannelSlug
|
|
9619
|
+
});
|
|
9620
|
+
if (params.isGroupDm && !groupDmAllowed) return {
|
|
9621
|
+
allowed: false,
|
|
9622
|
+
channelAllowlistConfigured: false,
|
|
9623
|
+
channelAllowed: false
|
|
9624
|
+
};
|
|
9625
|
+
const channelAllowlistConfigured = Boolean(params.guildInfo?.channels) && Object.keys(params.guildInfo?.channels ?? {}).length > 0;
|
|
9626
|
+
const channelAllowed = params.channelConfig?.allowed !== false;
|
|
9627
|
+
if (params.isGuildMessage && !isDiscordGroupAllowedByPolicy({
|
|
9628
|
+
groupPolicy: params.groupPolicy,
|
|
9629
|
+
guildAllowlisted: Boolean(params.guildInfo),
|
|
9630
|
+
channelAllowlistConfigured,
|
|
9631
|
+
channelAllowed
|
|
9632
|
+
})) {
|
|
9633
|
+
if (params.groupPolicy === "disabled") {
|
|
9634
|
+
logDebug(`[discord-preflight] drop: groupPolicy disabled`);
|
|
9635
|
+
logVerbose(`discord: drop guild message (groupPolicy: disabled, ${params.channelMatchMeta})`);
|
|
9636
|
+
} else if (!channelAllowlistConfigured) {
|
|
9637
|
+
logDebug(`[discord-preflight] drop: groupPolicy allowlist, no channel allowlist configured`);
|
|
9638
|
+
logVerbose(`discord: drop guild message (groupPolicy: allowlist, no channel allowlist, ${params.channelMatchMeta})`);
|
|
9639
|
+
} else {
|
|
9640
|
+
logDebug(`[discord] Ignored message from channel ${params.messageChannelId} (not in guild allowlist). Add to guilds.<guildId>.channels to enable.`);
|
|
9641
|
+
logVerbose(`Blocked discord channel ${params.messageChannelId} not in guild channel allowlist (groupPolicy: allowlist, ${params.channelMatchMeta})`);
|
|
9642
|
+
}
|
|
9643
|
+
return {
|
|
9644
|
+
allowed: false,
|
|
9645
|
+
channelAllowlistConfigured,
|
|
9646
|
+
channelAllowed
|
|
9647
|
+
};
|
|
9648
|
+
}
|
|
9649
|
+
if (params.isGuildMessage && params.channelConfig?.allowed === false) {
|
|
9650
|
+
logDebug(`[discord-preflight] drop: channelConfig.allowed===false`);
|
|
9651
|
+
logVerbose(`Blocked discord channel ${params.messageChannelId} not in guild channel allowlist (${params.channelMatchMeta})`);
|
|
9652
|
+
return {
|
|
9653
|
+
allowed: false,
|
|
9654
|
+
channelAllowlistConfigured,
|
|
9655
|
+
channelAllowed
|
|
9656
|
+
};
|
|
9657
|
+
}
|
|
9658
|
+
if (params.isGuildMessage) {
|
|
9659
|
+
logDebug(`[discord-preflight] pass: channel allowed`);
|
|
9660
|
+
logVerbose(`discord: allow channel ${params.messageChannelId} (${params.channelMatchMeta})`);
|
|
9661
|
+
}
|
|
9662
|
+
return {
|
|
9663
|
+
allowed: true,
|
|
9664
|
+
channelAllowlistConfigured,
|
|
9665
|
+
channelAllowed
|
|
9666
|
+
};
|
|
9667
|
+
}
|
|
9668
|
+
//#endregion
|
|
9669
|
+
//#region extensions/discord/src/monitor/listeners.guild-join.ts
|
|
9670
|
+
const DISCORD_GUILD_JOIN_INTRO_MAX_AGE_MS = 3e5;
|
|
9671
|
+
var DiscordGuildJoinIntroductionListener = class extends GuildCreateListener {
|
|
9672
|
+
constructor(params) {
|
|
9673
|
+
super();
|
|
9674
|
+
this.params = params;
|
|
9675
|
+
}
|
|
9676
|
+
async handle(data, client) {
|
|
9677
|
+
if (!("joined_at" in data) || data.unavailable || !this.params.botUserId) return;
|
|
9678
|
+
const joinAgeMs = Date.now() - Date.parse(data.joined_at);
|
|
9679
|
+
if (!Number.isFinite(joinAgeMs) || joinAgeMs < 0 || joinAgeMs > DISCORD_GUILD_JOIN_INTRO_MAX_AGE_MS) return;
|
|
9680
|
+
const textChannels = data.channels.filter((channel) => channel.type === ChannelType.GuildText);
|
|
9681
|
+
const systemChannel = textChannels.find((channel) => channel.id === data.system_channel_id);
|
|
9682
|
+
const candidateChannels = systemChannel ? [systemChannel, ...textChannels.filter((channel) => channel !== systemChannel)] : textChannels;
|
|
9683
|
+
const discordOptions = {
|
|
9684
|
+
cfg: this.params.cfg,
|
|
9685
|
+
accountId: this.params.accountId,
|
|
9686
|
+
rest: client.rest
|
|
9687
|
+
};
|
|
9688
|
+
const guildInfo = resolveDiscordGuildEntry({
|
|
9689
|
+
guild: new Guild(client, data),
|
|
9690
|
+
guildId: data.id,
|
|
9691
|
+
guildEntries: this.params.guildEntries
|
|
9692
|
+
});
|
|
9693
|
+
const guildConfigured = !this.params.guildEntries || Object.keys(this.params.guildEntries).length === 0 || Boolean(guildInfo);
|
|
9694
|
+
let targetChannel;
|
|
9695
|
+
let roomAllowed = false;
|
|
9696
|
+
for (const channel of candidateChannels) if (await canViewDiscordGuildChannel(data.id, channel.id, this.params.botUserId, discordOptions) && await hasAnyChannelPermissionDiscord(data.id, channel.id, this.params.botUserId, [PermissionFlagsBits.SendMessages], discordOptions)) {
|
|
9697
|
+
targetChannel ??= channel;
|
|
9698
|
+
const channelConfig = resolveDiscordChannelConfig({
|
|
9699
|
+
guildInfo,
|
|
9700
|
+
channelId: channel.id,
|
|
9701
|
+
channelName: channel.name,
|
|
9702
|
+
channelSlug: normalizeDiscordSlug(channel.name)
|
|
9703
|
+
});
|
|
9704
|
+
roomAllowed = guildConfigured && resolveDiscordPreflightChannelAccess({
|
|
9705
|
+
isGuildMessage: true,
|
|
9706
|
+
isGroupDm: false,
|
|
9707
|
+
groupPolicy: this.params.groupPolicy,
|
|
9708
|
+
messageChannelId: channel.id,
|
|
9709
|
+
displayChannelName: channel.name,
|
|
9710
|
+
displayChannelSlug: normalizeDiscordDisplaySlug(channel.name),
|
|
9711
|
+
guildInfo,
|
|
9712
|
+
channelConfig,
|
|
9713
|
+
channelMatchMeta: `guild=${data.id} channel=${channel.id}`
|
|
9714
|
+
}).allowed;
|
|
9715
|
+
if (roomAllowed) {
|
|
9716
|
+
targetChannel = channel;
|
|
9717
|
+
break;
|
|
9718
|
+
}
|
|
9719
|
+
}
|
|
9720
|
+
if (!targetChannel) {
|
|
9721
|
+
this.params.logger?.info("Discord guild join introduction skipped: no writable text channel", {
|
|
9722
|
+
guildId: data.id,
|
|
9723
|
+
accountId: this.params.accountId
|
|
9724
|
+
});
|
|
9725
|
+
return;
|
|
9726
|
+
}
|
|
9727
|
+
const selectedChannel = targetChannel;
|
|
9728
|
+
await reportChannelRoomJoin({
|
|
9729
|
+
cfg: this.params.cfg,
|
|
9730
|
+
channel: "discord",
|
|
9731
|
+
accountId: this.params.accountId,
|
|
9732
|
+
conversationId: data.id,
|
|
9733
|
+
deliverTo: `channel:${selectedChannel.id}`,
|
|
9734
|
+
route: resolveAgentRoute({
|
|
9735
|
+
cfg: this.params.cfg,
|
|
9736
|
+
channel: "discord",
|
|
9737
|
+
accountId: this.params.accountId,
|
|
9738
|
+
guildId: data.id,
|
|
9739
|
+
peer: {
|
|
9740
|
+
kind: "channel",
|
|
9741
|
+
id: selectedChannel.id
|
|
9742
|
+
}
|
|
9743
|
+
}),
|
|
9744
|
+
roomAllowed,
|
|
9745
|
+
resolveRoomContext: async ({ messageLimit }) => {
|
|
9746
|
+
const roomContext = {
|
|
9747
|
+
title: `#${selectedChannel.name}`,
|
|
9748
|
+
purpose: selectedChannel.topic ?? void 0
|
|
9749
|
+
};
|
|
9750
|
+
try {
|
|
9751
|
+
const messages = await readMessagesDiscord(selectedChannel.id, { limit: messageLimit }, discordOptions);
|
|
9752
|
+
return {
|
|
9753
|
+
...roomContext,
|
|
9754
|
+
recentMessages: messages.toReversed().flatMap(({ author, content }) => content.trim() ? [{
|
|
9755
|
+
sender: author.global_name ?? author.username,
|
|
9756
|
+
text: content
|
|
9757
|
+
}] : [])
|
|
9758
|
+
};
|
|
9759
|
+
} catch {
|
|
9760
|
+
return roomContext;
|
|
9761
|
+
}
|
|
9762
|
+
}
|
|
9763
|
+
});
|
|
9764
|
+
}
|
|
9765
|
+
};
|
|
9766
|
+
//#endregion
|
|
9614
9767
|
//#region extensions/discord/src/monitor/provider.startup.ts
|
|
9615
9768
|
function registerLatePlugin(client, plugin) {
|
|
9616
9769
|
plugin.registerClient?.(client);
|
|
@@ -9735,6 +9888,14 @@ async function fetchDiscordBotIdentity(params) {
|
|
|
9735
9888
|
function registerDiscordMonitorListeners(params) {
|
|
9736
9889
|
registerDiscordListener(params.client.listeners, new DiscordInteractionListener(params.logger, params.trackInboundEvent));
|
|
9737
9890
|
registerDiscordListener(params.client.listeners, new DiscordMessageListener(params.messageHandler, params.logger, params.trackInboundEvent));
|
|
9891
|
+
registerDiscordListener(params.client.listeners, new DiscordGuildJoinIntroductionListener({
|
|
9892
|
+
cfg: params.cfg,
|
|
9893
|
+
accountId: params.accountId,
|
|
9894
|
+
botUserId: params.botUserId,
|
|
9895
|
+
groupPolicy: params.groupPolicy,
|
|
9896
|
+
guildEntries: params.guildEntries,
|
|
9897
|
+
logger: params.logger
|
|
9898
|
+
}));
|
|
9738
9899
|
if (shouldRegisterDiscordReactionListeners(params)) {
|
|
9739
9900
|
const reactionListenerOptions = {
|
|
9740
9901
|
cfg: params.cfg,
|
|
@@ -9868,8 +10029,9 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
9868
10029
|
});
|
|
9869
10030
|
let guildEntries = rawDiscordCfg.guilds;
|
|
9870
10031
|
const defaultGroupPolicy = resolveDefaultGroupPolicy(cfg);
|
|
10032
|
+
const providerConfigPresent = cfg.channels?.discord !== void 0;
|
|
9871
10033
|
const { groupPolicy, providerMissingFallbackApplied } = resolveOpenProviderRuntimeGroupPolicy({
|
|
9872
|
-
providerConfigPresent
|
|
10034
|
+
providerConfigPresent,
|
|
9873
10035
|
groupPolicy: rawDiscordCfg.groupPolicy,
|
|
9874
10036
|
defaultGroupPolicy
|
|
9875
10037
|
});
|
|
@@ -10016,6 +10178,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10016
10178
|
const probe = await probeDiscordAcpBindingHealth({
|
|
10017
10179
|
cfg,
|
|
10018
10180
|
sessionKey,
|
|
10181
|
+
agentId: session.agentId,
|
|
10019
10182
|
storedState: session.acp?.state,
|
|
10020
10183
|
lastActivityAt: session.acp?.lastActivityAt,
|
|
10021
10184
|
providerSessionRuntime: discordProviderSessionRuntime
|
|
@@ -10129,7 +10292,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10129
10292
|
runtime,
|
|
10130
10293
|
botUserId
|
|
10131
10294
|
});
|
|
10132
|
-
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-
|
|
10295
|
+
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-D8lH7AkN.js").then((n) => n.n);
|
|
10133
10296
|
setDiscordTranscriptsVoiceManager({
|
|
10134
10297
|
accountId: account.accountId,
|
|
10135
10298
|
manager: voiceManager
|
|
@@ -10235,4 +10398,4 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10235
10398
|
}
|
|
10236
10399
|
}
|
|
10237
10400
|
//#endregion
|
|
10238
|
-
export {
|
|
10401
|
+
export { resolveDiscordTextCommandAccess as S, handleDiscordDmCommandDecision as _, formatDiscordReplySkip as a, resolveFetchedDiscordThreadLikeChannelContext as b, buildGuildLabel as c, resolveDiscordGatewayIntents as d, waitForDiscordGatewayPluginRegistration as f, createDiscordSupplementalContextAccessChecker as g, buildDiscordInboundAccessContext as h, formatDiscordReplyDeliveryFailure as i, resolveReplyContext as l, buildDiscordGroupSystemPrompt as m, resolveDiscordPreflightChannelAccess as n, sanitizeDiscordFrontChannelReplyPayloads as o, createDiscordNativeCommand as p, deliverDiscordReply as r, buildDirectLabel as s, monitorDiscordProvider as t, createDiscordGatewayPlugin as u, mapGatewayDispatchData as v, resolveDiscordDmCommandAccess as x, registerDiscordListener as y };
|