@openclaw/discord 2026.5.30-beta.1 → 2026.5.31-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/{account-inspect-BkL-fm-M.js → account-inspect-DDZtT5C8.js} +2 -2
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-dXTfmnSZ.js → accounts-P19jm1lf.js} +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/api.js +15 -15
- package/dist/{approval-handler.runtime-BFLqemq4.js → approval-handler.runtime-DSFfzXpo.js} +4 -4
- package/dist/{audit-CKzCd_nb.js → audit-kgIklCyI.js} +4 -4
- package/dist/{channel-DnUKVkVn.js → channel-D0gX0yj6.js} +44 -31
- package/dist/{channel-actions-D60aLg8q.js → channel-actions-DDoc4V7x.js} +4 -4
- package/dist/{channel-actions.runtime-D6awrVWB.js → channel-actions.runtime-CqZfnMaA.js} +5 -5
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-Cqfoar5h.js → channel.setup-BNZm3eed.js} +6 -7
- package/dist/{components-CWgTTA0J.js → components-DcLQ2JkV.js} +1 -1
- package/dist/{config-schema-C1lzB2Ld.js → config-schema-spuxW477.js} +16 -0
- package/dist/contract-api.js +3 -3
- package/dist/{conversation-identity-Dvi-8LyR.js → conversation-identity-BURFgcfI.js} +7 -5
- package/dist/{directory-config-B-i4XzWZ.js → directory-config-B9Jw1Q2R.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-B5E-IbgC.js → directory-live-CDWUg-nA.js} +2 -2
- package/dist/{doctor-DT41iqQA.js → doctor-BUhqxLb9.js} +4 -5
- package/dist/{doctor-contract-8-Ia3d_X.js → doctor-contract-BAu3WLvd.js} +5 -5
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{handle-action.guild-admin-B39nAL5c.js → handle-action.guild-admin-Dpa-kUzu.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/legacy-state-migrations-api.js +1 -1
- package/dist/{manager.runtime-ClHe315Q.js → manager.runtime-BWBENHRA.js} +10 -15
- package/dist/{message-handler-Deidymb-.js → message-handler-HO8BbZmQ.js} +6 -6
- package/dist/{message-handler.preflight-DeTwc2nk.js → message-handler.preflight-DxHBPQvD.js} +24 -17
- package/dist/{message-handler.process-DJkFWirK.js → message-handler.process-Cq3j7A9k.js} +20 -10
- package/dist/{message-utils-C4OlktSy.js → message-utils-D_3KTxh_.js} +1 -1
- package/dist/{outbound-adapter-DCC3zPuC.js → outbound-adapter-BkPkILpq.js} +7 -7
- package/dist/{pluralkit-Dhad974D.js → pluralkit-Ds9aZAM4.js} +1 -1
- package/dist/{probe-BiEg-_i1.js → probe-2MdGjUAf.js} +1 -1
- package/dist/{probe.runtime-Dja7CbJT.js → probe.runtime-J927koKG.js} +1 -1
- package/dist/{provider-SeIwaTTJ.js → provider-BK8hjk_y.js} +116 -36
- package/dist/{provider-session.runtime-B5aLy8NA.js → provider-session.runtime-CYMFlLg9.js} +3 -3
- package/dist/provider.runtime-RfQSSM_v.js +2 -0
- package/dist/{resolve-allowlist-common-DAIbZobr.js → resolve-allowlist-common-BIf3417N.js} +1 -1
- package/dist/{resolve-channels-LMOlvXSw.js → resolve-channels-DK-3f_aA.js} +2 -2
- package/dist/{resolve-users-WNAKeCd_.js → resolve-users-DUDPsfWt.js} +2 -2
- package/dist/{runtime-Dg0INaGm.js → runtime-Blf_d9E7.js} +8 -8
- package/dist/runtime-api.actions.js +2 -2
- package/dist/runtime-api.js +21 -21
- package/dist/runtime-api.lookup.js +5 -5
- package/dist/runtime-api.monitor-LVbgPRHA.js +6 -0
- package/dist/runtime-api.monitor.js +4 -4
- package/dist/runtime-api.send.js +5 -5
- package/dist/runtime-api.threads.js +5 -5
- package/dist/{send-DwUf-fzH.js → send-BHkA8a-k.js} +5 -5
- package/dist/{send.components-BVfuI0-G.js → send.components-CUHzDapa.js} +5 -5
- package/dist/{send.outbound-4IJRwYbJ.js → send.outbound-DSKZbjML.js} +15 -5
- package/dist/{send.receipt-CxFJX9o3.js → send.receipt-CjsWpitW.js} +4 -4
- package/dist/{send.shared-DQwyGjXe.js → send.shared-Cluujl6W.js} +3 -3
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-D-ePFtjZ.js → shared-BMGLQw74.js} +5 -5
- package/dist/{subagent-hooks-CqhiwYpb.js → subagent-hooks-7jAn9HT5.js} +3 -3
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{system-events-DZdHRt2j.js → system-events-BjuNA9Zs.js} +1 -1
- package/dist/{target-resolver-DTD90GqZ.js → target-resolver-BYuWNVQp.js} +3 -3
- package/dist/targets-BNDUOdvI.js +3 -0
- package/dist/{thread-bindings-VrlFUPDW.js → thread-bindings-CKruJE91.js} +6 -6
- package/dist/{thread-bindings.discord-api-CItgvv24.js → thread-bindings.discord-api-BjLUwwSP.js} +5 -5
- package/dist/{thread-bindings.manager-hhqHJlGr.js → thread-bindings.manager-Dji7SZHG.js} +4 -4
- package/dist/{thread-bindings.session-updates-0BaqAU8S.js → thread-bindings.session-updates-DoDFvU_h.js} +1 -1
- package/dist/{transcripts-source-CFsqnHc4.js → transcripts-source-O73_YIDs.js} +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-Bfns8H17.js → typing-CKW0i8du.js} +1 -1
- package/node_modules/typebox/build/type/script/mapping.d.mts +5 -2
- package/node_modules/typebox/build/type/script/mapping.mjs +15 -8
- package/node_modules/typebox/build/type/script/parser.d.mts +3 -1
- package/node_modules/typebox/build/type/script/parser.mjs +2 -1
- package/node_modules/typebox/package.json +29 -29
- package/npm-shrinkwrap.json +7 -38
- package/openclaw.plugin.json +76 -0
- package/package.json +7 -6
- package/dist/provider.runtime-DVHYE9ZI.js +0 -2
- package/dist/runtime-api.monitor-C56AP2ZG.js +0 -6
- package/dist/targets-xBATI2q7.js +0 -3
- package/dist/{thread-bindings.state-B-iprgEM.js → thread-bindings.state-DYp4FVEB.js} +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { I as createDiscordRestClient } from "./send.shared-
|
|
2
|
-
import { d as resolveDiscordChannelNameSafe, l as resolveDiscordChannelIdSafe, p as resolveDiscordChannelParentSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-
|
|
1
|
+
import { I as createDiscordRestClient } from "./send.shared-Cluujl6W.js";
|
|
2
|
+
import { d as resolveDiscordChannelNameSafe, l as resolveDiscordChannelIdSafe, p as resolveDiscordChannelParentSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-BjLUwwSP.js";
|
|
3
3
|
import { a as mergeAbortSignals } from "./timeouts-CEJ3--Uw.js";
|
|
4
|
-
import { c as hasDiscordMessageStickers, d as resolveDiscordMessageChannelId, r as resolveDiscordMessageText } from "./message-utils-
|
|
5
|
-
import { t as sendTyping } from "./typing-
|
|
4
|
+
import { c as hasDiscordMessageStickers, d as resolveDiscordMessageChannelId, r as resolveDiscordMessageText } from "./message-utils-D_3KTxh_.js";
|
|
5
|
+
import { t as sendTyping } from "./typing-CKW0i8du.js";
|
|
6
6
|
import { danger, logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
7
7
|
import { createChannelRunQueue, createTypingCallbacks, resolveChannelMessageSourceReplyDeliveryMode } from "openclaw/plugin-sdk/channel-outbound";
|
|
8
8
|
import { resolveOpenProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
@@ -178,7 +178,7 @@ function resolveDiscordAcceptedTypingPrestart(ctx) {
|
|
|
178
178
|
//#region extensions/discord/src/monitor/message-run-queue.ts
|
|
179
179
|
let messageProcessRuntimePromise;
|
|
180
180
|
async function loadMessageProcessRuntime() {
|
|
181
|
-
messageProcessRuntimePromise ??= import("./message-handler.process-
|
|
181
|
+
messageProcessRuntimePromise ??= import("./message-handler.process-Cq3j7A9k.js");
|
|
182
182
|
return await messageProcessRuntimePromise;
|
|
183
183
|
}
|
|
184
184
|
async function processDiscordQueuedMessage(params) {
|
|
@@ -307,7 +307,7 @@ function createDiscordReplyTypingFeedback(params) {
|
|
|
307
307
|
//#region extensions/discord/src/monitor/message-handler.ts
|
|
308
308
|
let messagePreflightRuntimePromise;
|
|
309
309
|
async function loadMessagePreflightRuntime() {
|
|
310
|
-
messagePreflightRuntimePromise ??= import("./message-handler.preflight-
|
|
310
|
+
messagePreflightRuntimePromise ??= import("./message-handler.preflight-DxHBPQvD.js");
|
|
311
311
|
return await messagePreflightRuntimePromise;
|
|
312
312
|
}
|
|
313
313
|
function isNonEmptyString(value) {
|
package/dist/{message-handler.preflight-DeTwc2nk.js → message-handler.preflight-DxHBPQvD.js}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { c as discord_exports, k as Message, mt as getChannelMessage } from "./send.receipt-
|
|
2
|
-
import { o as resolveDefaultDiscordAccountId } from "./accounts-
|
|
1
|
+
import { c as discord_exports, k as Message, mt as getChannelMessage } from "./send.receipt-CjsWpitW.js";
|
|
2
|
+
import { o as resolveDefaultDiscordAccountId } from "./accounts-P19jm1lf.js";
|
|
3
3
|
import { S as resolveTimestampMs, _ as resolveGroupDmAllow, a as normalizeDiscordSlug, b as formatDiscordUserTag, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordGuildEntry, f as resolveDiscordMemberAccessState, g as resolveDiscordShouldRequireMention, i as normalizeDiscordDisplaySlug, n as isDiscordGroupAllowedByPolicy, x as resolveDiscordSystemLocation } from "./allow-list-BnkWtVpA.js";
|
|
4
|
-
import { t as resolveDiscordConversationIdentity } from "./conversation-identity-
|
|
5
|
-
import { l as isRecentlyUnboundThreadWebhookMessage } from "./thread-bindings.state-
|
|
6
|
-
import { d as resolveDiscordChannelNameSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-
|
|
7
|
-
import "./thread-bindings-
|
|
8
|
-
import { D as resolveDiscordTextCommandAccess, E as resolveDiscordDmCommandAccess, _ as resolveDiscordEffectiveRoute, g as resolveDiscordConversationRoute, h as buildDiscordRoutePeer, v as shouldIgnoreStaleDiscordRouteBinding, y as handleDiscordDmCommandDecision } from "./provider-
|
|
9
|
-
import { d as resolveDiscordMessageChannelId, l as resolveDiscordMessageStickers, o as resolveMediaList, r as resolveDiscordMessageText, u as resolveDiscordChannelInfo } from "./message-utils-
|
|
4
|
+
import { t as resolveDiscordConversationIdentity } from "./conversation-identity-BURFgcfI.js";
|
|
5
|
+
import { l as isRecentlyUnboundThreadWebhookMessage } from "./thread-bindings.state-DYp4FVEB.js";
|
|
6
|
+
import { d as resolveDiscordChannelNameSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-BjLUwwSP.js";
|
|
7
|
+
import "./thread-bindings-CKruJE91.js";
|
|
8
|
+
import { D as resolveDiscordTextCommandAccess, E as resolveDiscordDmCommandAccess, _ as resolveDiscordEffectiveRoute, g as resolveDiscordConversationRoute, h as buildDiscordRoutePeer, v as shouldIgnoreStaleDiscordRouteBinding, y as handleDiscordDmCommandDecision } from "./provider-BK8hjk_y.js";
|
|
9
|
+
import { d as resolveDiscordMessageChannelId, l as resolveDiscordMessageStickers, o as resolveMediaList, r as resolveDiscordMessageText, u as resolveDiscordChannelInfo } from "./message-utils-D_3KTxh_.js";
|
|
10
10
|
import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-BFp5w0F8.js";
|
|
11
11
|
import { normalizeOptionalString, readStringValue } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
12
|
import { getChildLogger, logVerbose, shouldLogVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -28,9 +28,12 @@ async function loadConversationRuntime$1() {
|
|
|
28
28
|
return await conversationRuntimePromise$1;
|
|
29
29
|
}
|
|
30
30
|
async function loadDiscordSendRuntime() {
|
|
31
|
-
discordSendRuntimePromise ??= import("./send-
|
|
31
|
+
discordSendRuntimePromise ??= import("./send-BHkA8a-k.js").then((n) => n.t);
|
|
32
32
|
return await discordSendRuntimePromise;
|
|
33
33
|
}
|
|
34
|
+
function resolveDiscordDmPairingSenderId(sender) {
|
|
35
|
+
return sender.isPluralKit ? `pk:${sender.id}` : sender.id;
|
|
36
|
+
}
|
|
34
37
|
async function resolveDiscordDmPreflightAccess(params) {
|
|
35
38
|
if (params.dmPolicy === "disabled") {
|
|
36
39
|
logVerbose("discord: drop dm (dmPolicy: disabled)");
|
|
@@ -69,9 +72,9 @@ async function resolveDiscordDmPreflightAccess(params) {
|
|
|
69
72
|
senderAccess: dmAccess.senderAccess,
|
|
70
73
|
accountId: params.resolvedAccountId,
|
|
71
74
|
sender: {
|
|
72
|
-
id: params.
|
|
73
|
-
tag: formatDiscordUserTag(params.author),
|
|
74
|
-
name: params.author.username ?? void 0
|
|
75
|
+
id: resolveDiscordDmPairingSenderId(params.sender),
|
|
76
|
+
tag: params.sender.tag ?? formatDiscordUserTag(params.author),
|
|
77
|
+
name: params.sender.name ?? params.author.username ?? void 0
|
|
75
78
|
},
|
|
76
79
|
onPairingCreated: async (code) => {
|
|
77
80
|
logVerbose(`discord pairing request sender=${params.author.id} tag=${formatDiscordUserTag(params.author)} reason=${dmAccess.senderAccess.reasonCode}`);
|
|
@@ -423,7 +426,7 @@ let preflightAudioRuntimePromise;
|
|
|
423
426
|
let systemEventsRuntimePromise;
|
|
424
427
|
let discordThreadingRuntimePromise;
|
|
425
428
|
async function loadPluralKitRuntime() {
|
|
426
|
-
pluralkitRuntimePromise ??= import("./pluralkit-
|
|
429
|
+
pluralkitRuntimePromise ??= import("./pluralkit-Ds9aZAM4.js").then((n) => n.n);
|
|
427
430
|
return await pluralkitRuntimePromise;
|
|
428
431
|
}
|
|
429
432
|
async function loadPreflightAudioRuntime() {
|
|
@@ -431,11 +434,11 @@ async function loadPreflightAudioRuntime() {
|
|
|
431
434
|
return await preflightAudioRuntimePromise;
|
|
432
435
|
}
|
|
433
436
|
async function loadSystemEventsRuntime() {
|
|
434
|
-
systemEventsRuntimePromise ??= import("./system-events-
|
|
437
|
+
systemEventsRuntimePromise ??= import("./system-events-BjuNA9Zs.js");
|
|
435
438
|
return await systemEventsRuntimePromise;
|
|
436
439
|
}
|
|
437
440
|
async function loadDiscordThreadingRuntime() {
|
|
438
|
-
discordThreadingRuntimePromise ??= import("./provider-
|
|
441
|
+
discordThreadingRuntimePromise ??= import("./provider-BK8hjk_y.js").then((n) => n.x);
|
|
439
442
|
return await discordThreadingRuntimePromise;
|
|
440
443
|
}
|
|
441
444
|
function isPreflightAborted(abortSignal) {
|
|
@@ -796,7 +799,11 @@ async function preflightDiscordMessage(params) {
|
|
|
796
799
|
logVerbose(`discord: drop bound-thread bot system message ${message.id}`);
|
|
797
800
|
return null;
|
|
798
801
|
}
|
|
799
|
-
const mentionRegexes = buildMentionRegexes(params.cfg, effectiveRoute.agentId
|
|
802
|
+
const mentionRegexes = buildMentionRegexes(params.cfg, effectiveRoute.agentId, {
|
|
803
|
+
provider: "discord",
|
|
804
|
+
conversationId: messageChannelId,
|
|
805
|
+
providerPolicy: params.discordConfig?.mentionPatterns
|
|
806
|
+
});
|
|
800
807
|
const explicitlyMentioned = Boolean(botId && message.mentionedUsers?.some((user) => user.id === botId));
|
|
801
808
|
const hasAnyMention = !isDirectMessage && ((message.mentionedUsers?.length ?? 0) > 0 || (message.mentionedRoles?.length ?? 0) > 0 || message.mentionedEveryone && (!author.bot || sender.isPluralKit));
|
|
802
809
|
const hasUserOrRoleMention = !isDirectMessage && ((message.mentionedUsers?.length ?? 0) > 0 || (message.mentionedRoles?.length ?? 0) > 0);
|
|
@@ -809,7 +816,7 @@ async function preflightDiscordMessage(params) {
|
|
|
809
816
|
guildId: params.data.guild_id ?? void 0,
|
|
810
817
|
guildEntries: params.guildEntries
|
|
811
818
|
}) : null;
|
|
812
|
-
logDebug(`[discord-preflight] guild_id=${params.data.guild_id} guild_obj=${
|
|
819
|
+
logDebug(`[discord-preflight] guild_id=${params.data.guild_id} guild_obj=${Boolean(params.data.guild)} guild_obj_id=${params.data.guild?.id} guildInfo=${Boolean(guildInfo)} guildEntries=${params.guildEntries ? Object.keys(params.guildEntries).join(",") : "none"}`);
|
|
813
820
|
if (isGuildMessage && params.guildEntries && Object.keys(params.guildEntries).length > 0 && !guildInfo) {
|
|
814
821
|
logDebug(`[discord-preflight] guild blocked: guild_id=${params.data.guild_id} guildEntries keys=${Object.keys(params.guildEntries).join(",")}`);
|
|
815
822
|
logVerbose(`Blocked discord guild ${params.data.guild_id ?? "unknown"} (not in discord.guilds)`);
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { Ut as resolveDiscordChannelId, c as discord_exports, ft as editChannelMessage, s as chunkDiscordTextWithMode, st as createChannelMessage, ut as deleteChannelMessage } from "./send.receipt-
|
|
2
|
-
import { f as resolveDiscordMaxLinesPerMessage } from "./accounts-
|
|
3
|
-
import { I as createDiscordRestClient, L as createDiscordRuntimeAccountContext, _ as resolveDiscordMessageFlags, d as resolveDiscordTargetChannelId } from "./send.shared-
|
|
1
|
+
import { Ut as resolveDiscordChannelId, c as discord_exports, ft as editChannelMessage, s as chunkDiscordTextWithMode, st as createChannelMessage, ut as deleteChannelMessage } from "./send.receipt-CjsWpitW.js";
|
|
2
|
+
import { f as resolveDiscordMaxLinesPerMessage, s as resolveDiscordAccount } from "./accounts-P19jm1lf.js";
|
|
3
|
+
import { I as createDiscordRestClient, L as createDiscordRuntimeAccountContext, _ as resolveDiscordMessageFlags, d as resolveDiscordTargetChannelId } from "./send.shared-Cluujl6W.js";
|
|
4
4
|
import { S as resolveTimestampMs, a as normalizeDiscordSlug, r as normalizeDiscordAllowList } from "./allow-list-BnkWtVpA.js";
|
|
5
|
-
import { a as removeReactionDiscord, f as editMessageDiscord, r as reactMessageDiscord } from "./send-
|
|
6
|
-
import "./
|
|
7
|
-
import
|
|
5
|
+
import { a as removeReactionDiscord, f as editMessageDiscord, r as reactMessageDiscord } from "./send-BHkA8a-k.js";
|
|
6
|
+
import { a as discordTextHasTargetedMention, i as discordTextHasBroadcastMention, s as rewriteDiscordKnownMentions } from "./send.outbound-DSKZbjML.js";
|
|
7
|
+
import "./targets-BNDUOdvI.js";
|
|
8
|
+
import { t as resolveDiscordConversationIdentity } from "./conversation-identity-BURFgcfI.js";
|
|
8
9
|
import { t as beginDiscordInboundEventDeliveryCorrelation } from "./inbound-event-delivery-CEPlt2uz.js";
|
|
9
|
-
import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-
|
|
10
|
+
import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-BkPkILpq.js";
|
|
10
11
|
import { t as resolveDiscordPreviewStreamMode } from "./preview-streaming-DXT8oJdo.js";
|
|
11
12
|
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-CEJ3--Uw.js";
|
|
12
|
-
import { S as resolveDiscordAutoThreadReplyPlan, a as resolveReplyContext, i as buildGuildLabel, m as createDiscordSupplementalContextAccessChecker, n as deliverDiscordReply, p as buildDiscordInboundAccessContext, r as buildDirectLabel, w as resolveDiscordThreadStarter } from "./provider-
|
|
13
|
-
import { a as resolveForwardedMediaList, o as resolveMediaList, r as resolveDiscordMessageText, s as resolveReferencedReplyMediaList } from "./message-utils-
|
|
14
|
-
import { n as createDiscordReplyTypingFeedback } from "./message-handler-
|
|
13
|
+
import { S as resolveDiscordAutoThreadReplyPlan, a as resolveReplyContext, i as buildGuildLabel, m as createDiscordSupplementalContextAccessChecker, n as deliverDiscordReply, p as buildDiscordInboundAccessContext, r as buildDirectLabel, w as resolveDiscordThreadStarter } from "./provider-BK8hjk_y.js";
|
|
14
|
+
import { a as resolveForwardedMediaList, o as resolveMediaList, r as resolveDiscordMessageText, s as resolveReferencedReplyMediaList } from "./message-utils-D_3KTxh_.js";
|
|
15
|
+
import { n as createDiscordReplyTypingFeedback } from "./message-handler-HO8BbZmQ.js";
|
|
15
16
|
import { buildAgentSessionKey, normalizeAccountId, resolveAccountEntry, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
|
|
16
17
|
import { MessageFlags } from "discord-api-types/v10";
|
|
17
18
|
import path from "node:path";
|
|
@@ -286,6 +287,7 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
286
287
|
id: messageChannelId,
|
|
287
288
|
label: fromLabel,
|
|
288
289
|
spaceId: isGuildMessage ? (guildInfo?.id ?? guildSlug) || void 0 : void 0,
|
|
290
|
+
parentId: threadChannel ? threadParentId : void 0,
|
|
289
291
|
threadId: threadChannel?.id ?? autoThreadContext?.createdThreadId ?? void 0
|
|
290
292
|
},
|
|
291
293
|
route: {
|
|
@@ -1243,6 +1245,14 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1243
1245
|
},
|
|
1244
1246
|
buildFinalEdit: () => {
|
|
1245
1247
|
if (draftPreview.finalizedViaPreviewMessage || hasMedia && !ttsSupplement || typeof previewFinalText !== "string" || hasExplicitReplyDirective || payload.isError) return;
|
|
1248
|
+
const rewrittenFinal = rewriteDiscordKnownMentions(previewFinalText, {
|
|
1249
|
+
accountId,
|
|
1250
|
+
mentionAliases: resolveDiscordAccount({
|
|
1251
|
+
cfg,
|
|
1252
|
+
accountId
|
|
1253
|
+
}).config.mentionAliases
|
|
1254
|
+
});
|
|
1255
|
+
if (discordTextHasTargetedMention(rewrittenFinal) && !discordTextHasBroadcastMention(rewrittenFinal)) return;
|
|
1246
1256
|
return {
|
|
1247
1257
|
content: previewFinalText,
|
|
1248
1258
|
...finalPreviewFlags ? { flags: finalPreviewFlags } : {}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-
|
|
1
|
+
import { u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-BjLUwwSP.js";
|
|
2
2
|
import { a as mergeAbortSignals } from "./timeouts-CEJ3--Uw.js";
|
|
3
3
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { ComponentType, StickerFormatType } from "discord-api-types/v10";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as normalizeDiscordOutboundTarget, s as chunkDiscordTextWithMode, t as createDiscordSendReceipt, x as DiscordError } from "./send.receipt-
|
|
2
|
-
import { s as resolveDiscordAccount } from "./accounts-
|
|
3
|
-
import { d as readDiscordComponentSpec } from "./components-
|
|
1
|
+
import { o as normalizeDiscordOutboundTarget, s as chunkDiscordTextWithMode, t as createDiscordSendReceipt, x as DiscordError } from "./send.receipt-CjsWpitW.js";
|
|
2
|
+
import { s as resolveDiscordAccount } from "./accounts-P19jm1lf.js";
|
|
3
|
+
import { d as readDiscordComponentSpec } from "./components-DcLQ2JkV.js";
|
|
4
4
|
import { t as parseDiscordRetryAfterBodySeconds } from "./retry-after-D5_VmM-_.js";
|
|
5
5
|
import { n as notifyDiscordInboundEventOutboundPayloadSuccess } from "./inbound-event-delivery-CEPlt2uz.js";
|
|
6
6
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -86,11 +86,11 @@ function normalizeDiscordApprovalPayload(payload) {
|
|
|
86
86
|
let discordComponentSendPromise;
|
|
87
87
|
let discordSharedInteractivePromise;
|
|
88
88
|
async function sendDiscordComponentMessageLazy(...args) {
|
|
89
|
-
discordComponentSendPromise ??= import("./send.components-
|
|
89
|
+
discordComponentSendPromise ??= import("./send.components-CUHzDapa.js").then((n) => n.i).then((module) => module.sendDiscordComponentMessage);
|
|
90
90
|
return await (await discordComponentSendPromise)(...args);
|
|
91
91
|
}
|
|
92
92
|
function loadDiscordSharedInteractive() {
|
|
93
|
-
discordSharedInteractivePromise ??= import("./components-
|
|
93
|
+
discordSharedInteractivePromise ??= import("./components-DcLQ2JkV.js").then((n) => n.a);
|
|
94
94
|
return discordSharedInteractivePromise;
|
|
95
95
|
}
|
|
96
96
|
function addPayloadTextFallback(spec, payload) {
|
|
@@ -125,7 +125,7 @@ async function resolveDiscordComponentSpec(payload) {
|
|
|
125
125
|
//#region extensions/discord/src/outbound-send-context.ts
|
|
126
126
|
let discordSendRuntimePromise;
|
|
127
127
|
async function loadDiscordSendRuntime() {
|
|
128
|
-
discordSendRuntimePromise ??= import("./send-
|
|
128
|
+
discordSendRuntimePromise ??= import("./send-BHkA8a-k.js").then((n) => n.t);
|
|
129
129
|
return await discordSendRuntimePromise;
|
|
130
130
|
}
|
|
131
131
|
function resolveDiscordOutboundTarget(params) {
|
|
@@ -280,7 +280,7 @@ function stripDiscordInternalRuntimeScaffolding(text) {
|
|
|
280
280
|
}
|
|
281
281
|
let discordThreadBindingsPromise;
|
|
282
282
|
function loadDiscordThreadBindings() {
|
|
283
|
-
discordThreadBindingsPromise ??= import("./thread-bindings-
|
|
283
|
+
discordThreadBindingsPromise ??= import("./thread-bindings-CKruJE91.js").then((n) => n.t);
|
|
284
284
|
return discordThreadBindingsPromise;
|
|
285
285
|
}
|
|
286
286
|
function resolveDiscordWebhookIdentity(params) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Wt as __exportAll } from "./send.receipt-
|
|
1
|
+
import { Wt as __exportAll } from "./send.receipt-CjsWpitW.js";
|
|
2
2
|
import { resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
3
3
|
//#region extensions/discord/src/pluralkit.ts
|
|
4
4
|
var pluralkit_exports = /* @__PURE__ */ __exportAll({ fetchPluralKitMessageInfo: () => fetchPluralKitMessageInfo });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as normalizeDiscordToken } from "./accounts-
|
|
1
|
+
import { p as normalizeDiscordToken } from "./accounts-P19jm1lf.js";
|
|
2
2
|
import { n as fetchDiscord, t as DiscordApiError } from "./api-BmXlcjYW.js";
|
|
3
3
|
import { resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
4
4
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as resolveDiscordPrivilegedIntentsFromFlags, i as probeDiscord, n as fetchDiscordApplicationSummary, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-
|
|
1
|
+
import { a as resolveDiscordPrivilegedIntentsFromFlags, i as probeDiscord, n as fetchDiscordApplicationSummary, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-2MdGjUAf.js";
|
|
2
2
|
export { fetchDiscordApplicationId, fetchDiscordApplicationSummary, parseApplicationIdFromToken, probeDiscord, resolveDiscordPrivilegedIntentsFromFlags };
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { $ as BaseMessageInteractiveComponent, A as User, B as Container, D as CommandWithSubcommands, E as Command, F as Modal, J as Separator, K as Row, O as Guild, R as Button, S as RateLimitError, Wt as __exportAll, X as TextDisplay, Y as StringSelectMenu, c as discord_exports, ct as createThread, d as MessageReactionAddListener, dt as editChannel, f as MessageReactionRemoveListener, g as ThreadUpdateListener, k as Message, l as InteractionCreateListener, m as ReadyListener, mt as getChannelMessage, p as PresenceUpdateListener, s as chunkDiscordTextWithMode, u as MessageCreateListener, v as Client, y as Plugin } from "./send.receipt-
|
|
2
|
-
import { c as resolveDiscordAccountAllowFrom, d as resolveDiscordAccountDmPolicy, f as resolveDiscordMaxLinesPerMessage, p as normalizeDiscordToken, s as resolveDiscordAccount } from "./accounts-
|
|
3
|
-
import { _ as parseDiscordComponentCustomId, b as parseDiscordModalCustomIdForInteraction, v as parseDiscordComponentCustomIdForInteraction, y as parseDiscordModalCustomId } from "./components-
|
|
4
|
-
import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-
|
|
1
|
+
import { $ as BaseMessageInteractiveComponent, A as User, B as Container, D as CommandWithSubcommands, E as Command, F as Modal, J as Separator, K as Row, O as Guild, R as Button, S as RateLimitError, Wt as __exportAll, X as TextDisplay, Y as StringSelectMenu, c as discord_exports, ct as createThread, d as MessageReactionAddListener, dt as editChannel, f as MessageReactionRemoveListener, g as ThreadUpdateListener, k as Message, l as InteractionCreateListener, m as ReadyListener, mt as getChannelMessage, p as PresenceUpdateListener, s as chunkDiscordTextWithMode, u as MessageCreateListener, v as Client, y as Plugin } from "./send.receipt-CjsWpitW.js";
|
|
2
|
+
import { c as resolveDiscordAccountAllowFrom, d as resolveDiscordAccountDmPolicy, f as resolveDiscordMaxLinesPerMessage, p as normalizeDiscordToken, s as resolveDiscordAccount } from "./accounts-P19jm1lf.js";
|
|
3
|
+
import { _ as parseDiscordComponentCustomId, b as parseDiscordModalCustomIdForInteraction, v as parseDiscordComponentCustomIdForInteraction, y as parseDiscordModalCustomId } from "./components-DcLQ2JkV.js";
|
|
4
|
+
import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-CUHzDapa.js";
|
|
5
5
|
import { c as setPresence, i as unregisterGateway, r as registerGateway } from "./gateway-registry-DPxmW0Db.js";
|
|
6
|
-
import { B as DISCORD_REST_TIMEOUT_MS, D as canViewDiscordGuildChannel, H as withValidatedDiscordProxy, I as createDiscordRestClient, V as validateDiscordProxyUrl } from "./send.shared-
|
|
6
|
+
import { B as DISCORD_REST_TIMEOUT_MS, D as canViewDiscordGuildChannel, H as withValidatedDiscordProxy, I as createDiscordRestClient, V as validateDiscordProxyUrl } from "./send.shared-Cluujl6W.js";
|
|
7
7
|
import { a as summarizeDiscordResponseBody, i as isDiscordRateLimitResponseBody } from "./api-BmXlcjYW.js";
|
|
8
8
|
import { S as resolveTimestampMs, _ as resolveGroupDmAllow, a as normalizeDiscordSlug, b as formatDiscordUserTag, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordGuildEntry, f as resolveDiscordMemberAccessState, h as resolveDiscordOwnerAllowFrom, i as normalizeDiscordDisplaySlug, l as resolveDiscordChannelPolicyCommandAuthorizer, m as resolveDiscordOwnerAccess, n as isDiscordGroupAllowedByPolicy, o as resolveDiscordAllowListMatch, p as resolveDiscordMemberAllowed, r as normalizeDiscordAllowList, v as shouldEmitDiscordReactionNotification, y as formatDiscordReactionEmoji } from "./allow-list-BnkWtVpA.js";
|
|
9
|
-
import { s as sendVoiceMessageDiscord } from "./send-
|
|
10
|
-
import {
|
|
9
|
+
import { s as sendVoiceMessageDiscord } from "./send-BHkA8a-k.js";
|
|
10
|
+
import { o as formatMention, t as sendMessageDiscord } from "./send.outbound-DSKZbjML.js";
|
|
11
11
|
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
12
|
-
import { a as getDiscordExecApprovalApprovers, s as isDiscordExecApprovalClientEnabled, t as resolveDiscordConversationIdentity } from "./conversation-identity-
|
|
13
|
-
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-
|
|
14
|
-
import { t as resolveDiscordUserAllowlist } from "./resolve-users-
|
|
15
|
-
import { _ as formatThreadBindingDurationLabel, a as isThreadArchived, d as resolveDiscordChannelNameSafe, f as resolveDiscordChannelParentIdSafe, l as resolveDiscordChannelIdSafe, m as resolveDiscordChannelTopicSafe, p as resolveDiscordChannelParentSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-
|
|
16
|
-
import { r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-
|
|
12
|
+
import { a as getDiscordExecApprovalApprovers, s as isDiscordExecApprovalClientEnabled, t as resolveDiscordConversationIdentity } from "./conversation-identity-BURFgcfI.js";
|
|
13
|
+
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-DK-3f_aA.js";
|
|
14
|
+
import { t as resolveDiscordUserAllowlist } from "./resolve-users-DUDPsfWt.js";
|
|
15
|
+
import { _ as formatThreadBindingDurationLabel, a as isThreadArchived, d as resolveDiscordChannelNameSafe, f as resolveDiscordChannelParentIdSafe, l as resolveDiscordChannelIdSafe, m as resolveDiscordChannelTopicSafe, p as resolveDiscordChannelParentSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-BjLUwwSP.js";
|
|
16
|
+
import { r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-2MdGjUAf.js";
|
|
17
17
|
import { o as raceWithTimeout, s as withAbortTimeout } from "./timeouts-CEJ3--Uw.js";
|
|
18
|
-
import { d as resolveDiscordMessageChannelId, n as resolveDiscordForwardedMessagesTextFromSnapshots, t as resolveDiscordEmbedText, u as resolveDiscordChannelInfo } from "./message-utils-
|
|
18
|
+
import { d as resolveDiscordMessageChannelId, n as resolveDiscordForwardedMessagesTextFromSnapshots, t as resolveDiscordEmbedText, u as resolveDiscordChannelInfo } from "./message-utils-D_3KTxh_.js";
|
|
19
19
|
import { t as resolveDiscordSenderIdentity } from "./sender-identity-BFp5w0F8.js";
|
|
20
|
-
import "./approval-handler.runtime-
|
|
20
|
+
import "./approval-handler.runtime-DSFfzXpo.js";
|
|
21
21
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
22
22
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeOptionalStringifiedId, normalizeStringEntries, normalizeStringEntriesLower, summarizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
23
23
|
import { buildAgentSessionKey, deriveLastRoutePolicy, isAcpSessionKey, isSubagentSessionKey, parseAgentSessionKey, resolveAgentIdFromSessionKey, resolveAgentRoute } from "openclaw/plugin-sdk/routing";
|
|
24
24
|
import { getRuntimeConfig } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
25
25
|
import { ApplicationCommandOptionType, ButtonStyle, ChannelType, ComponentType, GatewayCloseCodes, GatewayCloseCodes as GatewayCloseCodes$1, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes } from "discord-api-types/v10";
|
|
26
|
+
import { MAX_DATE_TIMESTAMP_MS, asDateTimestampMs, parseFiniteNumber, parseStrictFiniteNumber, parseStrictInteger, parseStrictNonNegativeInteger, parseStrictPositiveInteger, resolveDateTimestampMs, resolveTimestampMsToIsoString, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
26
27
|
import { createHash, randomUUID } from "node:crypto";
|
|
27
28
|
import path from "node:path";
|
|
28
29
|
import { resolvePinnedMainDmOwnerFromAllowlist as resolvePinnedMainDmOwnerFromAllowlist$1 } from "openclaw/plugin-sdk/security-runtime";
|
|
29
|
-
import { MAX_DATE_TIMESTAMP_MS, parseFiniteNumber, parseStrictFiniteNumber, parseStrictInteger, parseStrictNonNegativeInteger, parseStrictPositiveInteger, resolveDateTimestampMs, resolveTimestampMsToIsoString, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
30
30
|
import { Type } from "typebox";
|
|
31
31
|
import { Check, Errors } from "typebox/value";
|
|
32
32
|
import { inspect } from "node:util";
|
|
@@ -2401,9 +2401,7 @@ async function recordDiscordModelPickerRecentModel(params) {
|
|
|
2401
2401
|
value: sanitizeStoredPreferenceEntry(entry.value)
|
|
2402
2402
|
})).filter((entry) => entry.value?.scopeKey === key).toSorted(comparePreferenceEntries);
|
|
2403
2403
|
await Promise.all(scopedEntries.slice(limit).map((entry) => store.delete(entry.key)));
|
|
2404
|
-
} catch {
|
|
2405
|
-
return;
|
|
2406
|
-
}
|
|
2404
|
+
} catch {}
|
|
2407
2405
|
}
|
|
2408
2406
|
//#endregion
|
|
2409
2407
|
//#region extensions/discord/src/monitor/model-picker.state.ts
|
|
@@ -4859,21 +4857,26 @@ function normalizeMaxConcurrency(value) {
|
|
|
4859
4857
|
}
|
|
4860
4858
|
var GatewayIdentifyLimiter = class {
|
|
4861
4859
|
constructor() {
|
|
4862
|
-
this.
|
|
4860
|
+
this.stateByKey = /* @__PURE__ */ new Map();
|
|
4863
4861
|
}
|
|
4864
4862
|
async wait(params) {
|
|
4865
4863
|
const maxConcurrency = normalizeMaxConcurrency(params.maxConcurrency);
|
|
4866
4864
|
const rateKey = (params.shardId ?? 0) % maxConcurrency;
|
|
4867
4865
|
const now = Date.now();
|
|
4868
|
-
const
|
|
4866
|
+
const state = this.stateByKey.get(rateKey);
|
|
4867
|
+
const clockMovedBackward = state !== void 0 && now < state.lastObservedAt;
|
|
4868
|
+
const nextAllowedAt = state === void 0 ? now : clockMovedBackward ? now + IDENTIFY_WINDOW_MS : state.nextAllowedAt;
|
|
4869
4869
|
const waitMs = Math.max(0, nextAllowedAt - now);
|
|
4870
|
-
this.
|
|
4870
|
+
this.stateByKey.set(rateKey, {
|
|
4871
|
+
lastObservedAt: now,
|
|
4872
|
+
nextAllowedAt: Math.max(now, nextAllowedAt) + IDENTIFY_WINDOW_MS
|
|
4873
|
+
});
|
|
4871
4874
|
if (waitMs > 0) await new Promise((resolve) => {
|
|
4872
4875
|
setTimeout(resolve, waitMs).unref?.();
|
|
4873
4876
|
});
|
|
4874
4877
|
}
|
|
4875
4878
|
reset() {
|
|
4876
|
-
this.
|
|
4879
|
+
this.stateByKey.clear();
|
|
4877
4880
|
}
|
|
4878
4881
|
};
|
|
4879
4882
|
const sharedGatewayIdentifyLimiter = new GatewayIdentifyLimiter();
|
|
@@ -5818,6 +5821,9 @@ async function fetchDiscordGatewayMetadataGuarded(input, init, options) {
|
|
|
5818
5821
|
//#endregion
|
|
5819
5822
|
//#region extensions/discord/src/monitor/gateway-plugin.ts
|
|
5820
5823
|
const DISCORD_GATEWAY_HANDSHAKE_TIMEOUT_MS = 3e4;
|
|
5824
|
+
const DISCORD_GATEWAY_POLICY_VIOLATION_CLOSE_CODE = 1008;
|
|
5825
|
+
const DISCORD_GATEWAY_WS_RECEIVER_LIMIT_CODE = "WS_ERR_TOO_MANY_BUFFERED_PARTS";
|
|
5826
|
+
const DISCORD_GATEWAY_CLOSE_REASON_LOG_MAX_CHARS = 240;
|
|
5821
5827
|
const discordDnsLookup$1 = createDiscordDnsLookup();
|
|
5822
5828
|
const registrationPromises = /* @__PURE__ */ new WeakMap();
|
|
5823
5829
|
function assignGatewayClient(plugin, client) {
|
|
@@ -5827,6 +5833,58 @@ function hasGatewaySocketStarted(plugin) {
|
|
|
5827
5833
|
const state = plugin;
|
|
5828
5834
|
return state.ws != null || state.isConnecting === true;
|
|
5829
5835
|
}
|
|
5836
|
+
function readStringProperty(value, key) {
|
|
5837
|
+
const property = value[key];
|
|
5838
|
+
return typeof property === "string" && property ? property : void 0;
|
|
5839
|
+
}
|
|
5840
|
+
function readNumberProperty(value, key) {
|
|
5841
|
+
const property = value[key];
|
|
5842
|
+
return typeof property === "number" && Number.isFinite(property) ? property : void 0;
|
|
5843
|
+
}
|
|
5844
|
+
function describeDiscordGatewayTransportError(error) {
|
|
5845
|
+
const code = readStringProperty(error, "code");
|
|
5846
|
+
const closeCode = readNumberProperty(error, "closeCode");
|
|
5847
|
+
const statusCode = readNumberProperty(error, "statusCode");
|
|
5848
|
+
return {
|
|
5849
|
+
...error.name ? { name: error.name } : {},
|
|
5850
|
+
message: error.message,
|
|
5851
|
+
...code ? { code } : {},
|
|
5852
|
+
...closeCode !== void 0 ? { closeCode } : {},
|
|
5853
|
+
...statusCode !== void 0 ? { statusCode } : {}
|
|
5854
|
+
};
|
|
5855
|
+
}
|
|
5856
|
+
function formatDiscordGatewayCloseReason(reason) {
|
|
5857
|
+
if (!reason.length) return "<empty>";
|
|
5858
|
+
const text = reason.toString("utf8").replaceAll(/\s+/g, " ").trim();
|
|
5859
|
+
if (!text) return `<${reason.length} bytes>`;
|
|
5860
|
+
if (text.length <= DISCORD_GATEWAY_CLOSE_REASON_LOG_MAX_CHARS) return text;
|
|
5861
|
+
return `${text.slice(0, DISCORD_GATEWAY_CLOSE_REASON_LOG_MAX_CHARS)}...`;
|
|
5862
|
+
}
|
|
5863
|
+
function formatDiscordGatewayTransportErrorLog(params) {
|
|
5864
|
+
return `discord: gateway websocket error ${[
|
|
5865
|
+
`flow=${params.flowId}`,
|
|
5866
|
+
params.error.name ? `name=${params.error.name}` : void 0,
|
|
5867
|
+
params.error.code ? `code=${params.error.code}` : void 0,
|
|
5868
|
+
typeof params.error.closeCode === "number" ? `closeCode=${params.error.closeCode}` : void 0,
|
|
5869
|
+
typeof params.error.statusCode === "number" ? `statusCode=${params.error.statusCode}` : void 0,
|
|
5870
|
+
`message=${params.error.message}`
|
|
5871
|
+
].filter(Boolean).join(" ")}`;
|
|
5872
|
+
}
|
|
5873
|
+
function formatDiscordGatewayTransportCloseLog(params) {
|
|
5874
|
+
const receiverLimit = params.code === DISCORD_GATEWAY_POLICY_VIOLATION_CLOSE_CODE || params.lastError?.code === DISCORD_GATEWAY_WS_RECEIVER_LIMIT_CODE;
|
|
5875
|
+
return `discord: gateway websocket closed ${[
|
|
5876
|
+
`flow=${params.flowId}`,
|
|
5877
|
+
`code=${params.code}`,
|
|
5878
|
+
`reasonBytes=${params.reason.length}`,
|
|
5879
|
+
`reason=${formatDiscordGatewayCloseReason(params.reason)}`,
|
|
5880
|
+
params.lastError?.code ? `lastErrorCode=${params.lastError.code}` : void 0,
|
|
5881
|
+
params.lastError?.message ? `lastError=${params.lastError.message}` : void 0,
|
|
5882
|
+
receiverLimit ? "hint=possible ws receiver buffered-parts limit" : void 0
|
|
5883
|
+
].filter(Boolean).join(" ")}`;
|
|
5884
|
+
}
|
|
5885
|
+
function shouldLogDiscordGatewayTransportClose(params) {
|
|
5886
|
+
return params.code === DISCORD_GATEWAY_POLICY_VIOLATION_CLOSE_CODE || params.code !== 1e3 && params.code !== 1001 || params.reason.length > 0 || params.lastError !== void 0;
|
|
5887
|
+
}
|
|
5830
5888
|
function resolveDiscordGatewayIntents(params) {
|
|
5831
5889
|
const intentsConfig = params?.intentsConfig;
|
|
5832
5890
|
const voiceEnabled = params?.voiceEnabled;
|
|
@@ -5881,6 +5939,7 @@ function createGatewayPlugin(params) {
|
|
|
5881
5939
|
handshakeTimeout: DISCORD_GATEWAY_HANDSHAKE_TIMEOUT_MS,
|
|
5882
5940
|
...params.wsAgent ? { agent: params.wsAgent } : {}
|
|
5883
5941
|
});
|
|
5942
|
+
let lastTransportError;
|
|
5884
5943
|
const emitTransportActivity = () => {
|
|
5885
5944
|
if (this.ws !== socket) return;
|
|
5886
5945
|
this.emitter.emit(DISCORD_GATEWAY_TRANSPORT_ACTIVITY_EVENT, { at: Date.now() });
|
|
@@ -5904,17 +5963,29 @@ function createGatewayPlugin(params) {
|
|
|
5904
5963
|
});
|
|
5905
5964
|
});
|
|
5906
5965
|
socket.on?.("close", (code, reason) => {
|
|
5966
|
+
const closeReason = Buffer.isBuffer(reason) ? reason : Buffer.from(String(reason ?? ""));
|
|
5907
5967
|
captureWsEvent({
|
|
5908
5968
|
url,
|
|
5909
5969
|
direction: "local",
|
|
5910
5970
|
kind: "ws-close",
|
|
5911
5971
|
flowId: wsFlowId,
|
|
5912
5972
|
closeCode: code,
|
|
5913
|
-
payload:
|
|
5973
|
+
payload: closeReason,
|
|
5914
5974
|
meta: { subsystem: "discord-gateway" }
|
|
5915
5975
|
});
|
|
5976
|
+
if (shouldLogDiscordGatewayTransportClose({
|
|
5977
|
+
code,
|
|
5978
|
+
reason: closeReason,
|
|
5979
|
+
lastError: lastTransportError
|
|
5980
|
+
})) params.runtime?.log?.(warn(formatDiscordGatewayTransportCloseLog({
|
|
5981
|
+
flowId: wsFlowId,
|
|
5982
|
+
code,
|
|
5983
|
+
reason: closeReason,
|
|
5984
|
+
lastError: lastTransportError
|
|
5985
|
+
})));
|
|
5916
5986
|
});
|
|
5917
5987
|
socket.on?.("error", (error) => {
|
|
5988
|
+
lastTransportError = describeDiscordGatewayTransportError(error);
|
|
5918
5989
|
captureWsEvent({
|
|
5919
5990
|
url,
|
|
5920
5991
|
direction: "local",
|
|
@@ -5923,6 +5994,10 @@ function createGatewayPlugin(params) {
|
|
|
5923
5994
|
errorText: error.message,
|
|
5924
5995
|
meta: { subsystem: "discord-gateway" }
|
|
5925
5996
|
});
|
|
5997
|
+
params.runtime?.log?.(warn(formatDiscordGatewayTransportErrorLog({
|
|
5998
|
+
flowId: wsFlowId,
|
|
5999
|
+
error: lastTransportError
|
|
6000
|
+
})));
|
|
5926
6001
|
});
|
|
5927
6002
|
if ("binaryType" in socket) try {
|
|
5928
6003
|
socket.binaryType = "arraybuffer";
|
|
@@ -6074,9 +6149,7 @@ function createDiscordGatewaySupervisor(params) {
|
|
|
6074
6149
|
case "teardown":
|
|
6075
6150
|
logLateEvent("teardown")(event);
|
|
6076
6151
|
return;
|
|
6077
|
-
case "buffering":
|
|
6078
|
-
pending.push(event);
|
|
6079
|
-
return;
|
|
6152
|
+
case "buffering": pending.push(event);
|
|
6080
6153
|
}
|
|
6081
6154
|
};
|
|
6082
6155
|
emitter.on("error", onGatewayError);
|
|
@@ -6129,6 +6202,13 @@ function classifyAcpStatusProbeError(params) {
|
|
|
6129
6202
|
reason: "status-error"
|
|
6130
6203
|
};
|
|
6131
6204
|
}
|
|
6205
|
+
function resolveRunningActivityAgeMs(params) {
|
|
6206
|
+
if (params.storedState !== "running") return 0;
|
|
6207
|
+
const nowMs = asDateTimestampMs(Date.now());
|
|
6208
|
+
if (nowMs === void 0) return 0;
|
|
6209
|
+
const activityAtMs = asDateTimestampMs(params.lastActivityAt);
|
|
6210
|
+
return Math.max(0, nowMs - (activityAtMs === void 0 ? 0 : Math.max(0, Math.floor(activityAtMs))));
|
|
6211
|
+
}
|
|
6132
6212
|
async function probeDiscordAcpBindingHealth(params) {
|
|
6133
6213
|
const { getAcpSessionManager, isAcpRuntimeError } = params.providerSessionRuntime;
|
|
6134
6214
|
const manager = getAcpSessionManager();
|
|
@@ -6149,7 +6229,7 @@ async function probeDiscordAcpBindingHealth(params) {
|
|
|
6149
6229
|
onTimeout: () => ({ kind: "timeout" })
|
|
6150
6230
|
});
|
|
6151
6231
|
if (result.kind === "timeout") statusProbeAbortController.abort();
|
|
6152
|
-
const runningForMs =
|
|
6232
|
+
const runningForMs = resolveRunningActivityAgeMs(params);
|
|
6153
6233
|
const isStaleRunning = params.storedState === "running" && runningForMs >= DISCORD_ACP_STALE_RUNNING_ACTIVITY_MS;
|
|
6154
6234
|
if (result.kind === "timeout") return isStaleRunning ? {
|
|
6155
6235
|
status: "stale",
|
|
@@ -6789,7 +6869,6 @@ async function deployDiscordCommands(params) {
|
|
|
6789
6869
|
try {
|
|
6790
6870
|
try {
|
|
6791
6871
|
await params.client.deployCommands({ mode: "reconcile" });
|
|
6792
|
-
return;
|
|
6793
6872
|
} catch (err) {
|
|
6794
6873
|
if (isDiscordDeployDailyCreateLimit(err)) {
|
|
6795
6874
|
params.runtime.log?.(warn(`discord: native slash command deploy skipped for ${accountId}; daily application command create limit reached. Existing slash commands stay active until Discord resets the quota. Message send/receive is unaffected.`));
|
|
@@ -7896,7 +7975,7 @@ async function loadConversationRuntime$1() {
|
|
|
7896
7975
|
return await conversationRuntimePromise$1;
|
|
7897
7976
|
}
|
|
7898
7977
|
async function loadTypingRuntime() {
|
|
7899
|
-
typingRuntimePromise ??= import("./typing-
|
|
7978
|
+
typingRuntimePromise ??= import("./typing-CKW0i8du.js").then((n) => n.n);
|
|
7900
7979
|
return await typingRuntimePromise;
|
|
7901
7980
|
}
|
|
7902
7981
|
function buildDiscordComponentConversationLabel(params) {
|
|
@@ -8317,7 +8396,7 @@ async function dispatchPluginDiscordInteractiveEvent(params) {
|
|
|
8317
8396
|
//#region extensions/discord/src/monitor/agent-components.handlers.ts
|
|
8318
8397
|
let componentsRuntimePromise;
|
|
8319
8398
|
async function loadComponentsRuntime() {
|
|
8320
|
-
componentsRuntimePromise ??= import("./components-
|
|
8399
|
+
componentsRuntimePromise ??= import("./components-DcLQ2JkV.js").then((n) => n.t);
|
|
8321
8400
|
return await componentsRuntimePromise;
|
|
8322
8401
|
}
|
|
8323
8402
|
async function handleDiscordComponentEvent(params) {
|
|
@@ -9261,7 +9340,8 @@ function parseGatewayCloseCode(message) {
|
|
|
9261
9340
|
}
|
|
9262
9341
|
function resolveTransportActivityAt(event) {
|
|
9263
9342
|
const at = event?.at;
|
|
9264
|
-
|
|
9343
|
+
const timestampMs = asDateTimestampMs(at);
|
|
9344
|
+
return timestampMs !== void 0 && timestampMs >= 0 ? timestampMs : Date.now();
|
|
9265
9345
|
}
|
|
9266
9346
|
function createGatewayStatusObserver(params) {
|
|
9267
9347
|
let forceStopHandler;
|
|
@@ -9523,7 +9603,7 @@ async function runDiscordGatewayLifecycle(params) {
|
|
|
9523
9603
|
gatewayEmitter?.removeListener(DISCORD_GATEWAY_TRANSPORT_ACTIVITY_EVENT, onGatewayTransportActivity);
|
|
9524
9604
|
if (params.voiceManager) {
|
|
9525
9605
|
await params.voiceManager.destroy();
|
|
9526
|
-
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-
|
|
9606
|
+
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-O73_YIDs.js").then((n) => n.n);
|
|
9527
9607
|
setDiscordTranscriptsVoiceManager({
|
|
9528
9608
|
accountId: params.accountId,
|
|
9529
9609
|
manager: null
|
|
@@ -9801,7 +9881,7 @@ function logDiscordStartupPhase(params) {
|
|
|
9801
9881
|
});
|
|
9802
9882
|
}
|
|
9803
9883
|
async function loadDiscordVoiceRuntime() {
|
|
9804
|
-
const promise = discordVoiceRuntimePromise ?? import("./manager.runtime-
|
|
9884
|
+
const promise = discordVoiceRuntimePromise ?? import("./manager.runtime-BWBENHRA.js");
|
|
9805
9885
|
discordVoiceRuntimePromise = promise;
|
|
9806
9886
|
try {
|
|
9807
9887
|
return await promise;
|
|
@@ -9811,7 +9891,7 @@ async function loadDiscordVoiceRuntime() {
|
|
|
9811
9891
|
}
|
|
9812
9892
|
}
|
|
9813
9893
|
async function loadDiscordProviderSessionRuntime() {
|
|
9814
|
-
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-
|
|
9894
|
+
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-CYMFlLg9.js");
|
|
9815
9895
|
discordProviderSessionRuntimePromise = promise;
|
|
9816
9896
|
try {
|
|
9817
9897
|
return await promise;
|
|
@@ -10057,7 +10137,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10057
10137
|
});
|
|
10058
10138
|
const logger = createSubsystemLogger("discord/monitor");
|
|
10059
10139
|
const guildHistories = /* @__PURE__ */ new Map();
|
|
10060
|
-
|
|
10140
|
+
const { botUserId, botUserName } = await fetchDiscordBotIdentity({
|
|
10061
10141
|
client,
|
|
10062
10142
|
token,
|
|
10063
10143
|
runtime,
|
|
@@ -10081,7 +10161,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10081
10161
|
runtime,
|
|
10082
10162
|
botUserId
|
|
10083
10163
|
});
|
|
10084
|
-
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-
|
|
10164
|
+
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-O73_YIDs.js").then((n) => n.n);
|
|
10085
10165
|
setDiscordTranscriptsVoiceManager({
|
|
10086
10166
|
accountId: account.accountId,
|
|
10087
10167
|
manager: voiceManager
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as reconcileAcpThreadBindingsOnStartup } from "./thread-bindings-
|
|
2
|
-
import { n as createThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-
|
|
3
|
-
import { t as createDiscordMessageHandler } from "./message-handler-
|
|
1
|
+
import { a as reconcileAcpThreadBindingsOnStartup } from "./thread-bindings-CKruJE91.js";
|
|
2
|
+
import { n as createThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-Dji7SZHG.js";
|
|
3
|
+
import { t as createDiscordMessageHandler } from "./message-handler-HO8BbZmQ.js";
|
|
4
4
|
import { resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled } from "openclaw/plugin-sdk/conversation-runtime";
|
|
5
5
|
import { getAcpSessionManager, isAcpRuntimeError } from "openclaw/plugin-sdk/acp-runtime";
|
|
6
6
|
export { createDiscordMessageHandler, createNoopThreadBindingManager, createThreadBindingManager, getAcpSessionManager, isAcpRuntimeError, reconcileAcpThreadBindingsOnStartup, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as normalizeDiscordToken } from "./accounts-
|
|
1
|
+
import { p as normalizeDiscordToken } from "./accounts-P19jm1lf.js";
|
|
2
2
|
import { n as fetchDiscord } from "./api-BmXlcjYW.js";
|
|
3
3
|
import { a as normalizeDiscordSlug } from "./allow-list-BnkWtVpA.js";
|
|
4
4
|
//#region extensions/discord/src/guilds.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Wt as __exportAll } from "./send.receipt-
|
|
1
|
+
import { Wt as __exportAll } from "./send.receipt-CjsWpitW.js";
|
|
2
2
|
import { n as fetchDiscord, t as DiscordApiError } from "./api-BmXlcjYW.js";
|
|
3
3
|
import { a as normalizeDiscordSlug } from "./allow-list-BnkWtVpA.js";
|
|
4
|
-
import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-
|
|
4
|
+
import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-BIf3417N.js";
|
|
5
5
|
//#region extensions/discord/src/resolve-channels.ts
|
|
6
6
|
var resolve_channels_exports = /* @__PURE__ */ __exportAll({ resolveDiscordChannelAllowlist: () => resolveDiscordChannelAllowlist });
|
|
7
7
|
function parseDiscordChannelInput(raw) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Wt as __exportAll } from "./send.receipt-
|
|
1
|
+
import { Wt as __exportAll } from "./send.receipt-CjsWpitW.js";
|
|
2
2
|
import { n as fetchDiscord } from "./api-BmXlcjYW.js";
|
|
3
|
-
import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-
|
|
3
|
+
import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-BIf3417N.js";
|
|
4
4
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
//#region extensions/discord/src/resolve-users.ts
|
|
6
6
|
var resolve_users_exports = /* @__PURE__ */ __exportAll({ resolveDiscordUserAllowlist: () => resolveDiscordUserAllowlist });
|