@openclaw/discord 2026.9.8 → 2026.10.1-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 +7 -0
- package/dist/.setup/{account-inspect-De8hOUxG.mjs → account-inspect-CjKqkDnH.mjs} +2 -2
- package/dist/.setup/{accounts-ChaMcixG.mjs → accounts-DXHCL8Zm.mjs} +9 -32
- package/dist/.setup/{active-turn-thread-route-fmHl1HNd.mjs → active-turn-thread-route-C4tp9noA.mjs} +5 -9
- package/dist/.setup/{activities-api-tvbsU2e3.mjs → activities-api-BL_hJ0JQ.mjs} +15 -18
- package/dist/.setup/{api-DVbJwZVt.mjs → api-_oznjffB.mjs} +1 -1
- package/dist/.setup/{approval-handler.runtime-DxCK2Rux.mjs → approval-handler.runtime-BilYSrRF.mjs} +22 -61
- package/dist/.setup/{approval-message-updates-BKFqavHZ.mjs → approval-message-updates-CgRwc2_Q.mjs} +2 -2
- package/dist/.setup/{audit-CLg9I71N.mjs → audit-DtvzxONM.mjs} +4 -4
- package/dist/.setup/{channel-access-C12aDZ0p.mjs → channel-access-BRp3Y-rF.mjs} +4 -17
- package/dist/.setup/{channel-type-DRCrEMss.mjs → channel-type-D1_b5UhU.mjs} +12 -16
- package/dist/.setup/{channel-DxlUVU9t.mjs → channel-z5lQMS_9.mjs} +79 -75
- package/dist/.setup/{channel.setup-CRo1GjV7.mjs → channel.setup-DBJtugJO.mjs} +14 -34
- package/dist/.setup/{components-Cq1PvIpN.mjs → components-CzXLR3QH.mjs} +56 -72
- package/dist/.setup/{config-schema-oxELUSDx.mjs → config-schema-CsemBDpS.mjs} +6 -17
- package/dist/.setup/{conversation-binding-route-Caz_XuFH.mjs → conversation-binding-route-Bi62ApSt.mjs} +1 -1
- package/dist/.setup/{directory-config-esqNn0Eo.mjs → directory-config-BH1LA-gi.mjs} +1 -1
- package/dist/.setup/{directory-live-DtKRHuGV.mjs → directory-live-C9xz7IPm.mjs} +10 -13
- package/dist/.setup/{discord-0xJYfdDD.mjs → discord-J7aRzq2Q.mjs} +101 -381
- package/dist/.setup/{doctor-BCl1H5tl.mjs → doctor-DxSAngJq.mjs} +31 -70
- package/dist/.setup/doctor-contract-Bg3NPAMw.mjs +137 -0
- package/dist/.setup/{handle-action-CUvQWnE7.mjs → handle-action-DlmFX-_G.mjs} +10 -11
- package/dist/.setup/{handle-action.guild-admin-Df-8gVle.mjs → handle-action.guild-admin-BnyqTczR.mjs} +67 -129
- package/dist/.setup/{live-policy-config-8Pv20CHc.mjs → live-policy-config-emmPNyh4.mjs} +1 -1
- package/dist/.setup/{message-handler-B-Jk4oDk.mjs → message-handler-BNToPZrx.mjs} +7 -6
- package/dist/.setup/{message-handler.preflight-v-__NSDq.mjs → message-handler.preflight-D0BcCyI7.mjs} +13 -23
- package/dist/.setup/{message-handler.preflight-pluralkit-CWLUBVcx.mjs → message-handler.preflight-pluralkit-D1g3eq0B.mjs} +5 -8
- package/dist/.setup/{message-handler.process-BNFFuChn.mjs → message-handler.process-CThRmCWK.mjs} +57 -96
- package/dist/.setup/{outbound-adapter-BobT-kse.mjs → outbound-adapter-BPq0c2wY.mjs} +11 -17
- package/dist/.setup/{outbound-session-route-zVGxxceg.mjs → outbound-session-route-DGPPKA0z.mjs} +21 -46
- package/dist/.setup/{presence-cache-Di3H3DIU.mjs → presence-cache-Dg3_dADn.mjs} +2 -4
- package/dist/.setup/{probe-LYrIHlBF.mjs → probe-DIRY8vh7.mjs} +17 -27
- package/dist/.setup/{provider-B_G5hASF.mjs → provider-D2OKMo0f.mjs} +273 -446
- package/dist/.setup/{provider-session.runtime-BYlTBFD2.mjs → provider-session.runtime-BupCTZQv.mjs} +3 -3
- package/dist/.setup/provider.runtime-BaW_JnfU.mjs +2 -0
- package/dist/.setup/{realtime-session.runtime-oUd9DOcz.mjs → realtime-session.runtime-D5RSC8Mm.mjs} +6 -8
- package/dist/.setup/{receive-recovery-CHPOsnLc.mjs → receive-recovery-GqF2PUN_.mjs} +1 -4
- package/dist/.setup/{resolve-allowlist-common-DPdRggu5.mjs → resolve-allowlist-common-DUYRrrVB.mjs} +5 -9
- package/dist/.setup/{resolve-channels-BFPNRmVv.mjs → resolve-channels--MUatisx.mjs} +3 -3
- package/dist/.setup/{resolve-users-0-aBuCy3.mjs → resolve-users-CxLcDmM0.mjs} +6 -9
- package/dist/.setup/{retry-pz_cSha2.mjs → retry-BKzO25k4.mjs} +27 -51
- package/dist/.setup/{runtime-sUksZ--Q.mjs → runtime-CerRBfaa.mjs} +2 -2
- package/dist/.setup/{runtime-FN000lxA.mjs → runtime-CwUA0RLr.mjs} +228 -255
- package/dist/.setup/{runtime-doctor-migrations-CshUGl36.mjs → runtime-doctor-migrations-BPV-R4G9.mjs} +6 -0
- package/dist/.setup/{security-audit-Cdaegq7C.mjs → security-audit-D42cp5N7.mjs} +21 -48
- package/dist/.setup/{send-CrfEI6Bs.mjs → send-2X7m2Zmw.mjs} +45 -58
- package/dist/.setup/{send.components-DxQAMfES.mjs → send.components-RqvgmCs3.mjs} +44 -90
- package/dist/.setup/{send.outbound-BISKnb-a.mjs → send.outbound-B4QHSEzm.mjs} +60 -98
- package/dist/.setup/{send.shared-DGFkbkQR.mjs → send.shared-BQIUh6Vn.mjs} +13 -20
- package/dist/.setup/{sender-identity-B9X5Vb9R.mjs → sender-identity-CooeYfAn.mjs} +1 -1
- package/dist/.setup/{session-key-normalization-wJgsKPNF.mjs → session-key-normalization-CCHGNSQw.mjs} +3 -9
- package/dist/.setup/setup-plugin-api-nn_giXvZ.mjs +3 -0
- package/dist/.setup/{shared-B3wZ4hN-.mjs → shared-CIJn6AEC.mjs} +7 -7
- package/dist/.setup/{subagent-hooks-nlUE9ow7.mjs → subagent-hooks-BYlVnxzy.mjs} +4 -9
- package/dist/.setup/{system-events-CdeZnvPV.mjs → system-events-CQ3if_pS.mjs} +2 -2
- package/dist/.setup/{target-resolver-BuLapkhy.mjs → target-resolver-Dzxf80Y3.mjs} +5 -13
- package/dist/.setup/targets-Lf8D55w-.mjs +3 -0
- package/dist/.setup/{thread-bindings-D7TfgjR_.mjs → thread-bindings-yNNlcUWE.mjs} +5 -6
- package/dist/.setup/{thread-bindings.manager-DN-NissX.mjs → thread-bindings.manager-plk0zJAW.mjs} +14 -20
- package/dist/.setup/{thread-bindings.session-updates-CshfKghV.mjs → thread-bindings.session-updates-C9aKtVs6.mjs} +295 -5
- package/dist/.setup/{timeouts-D86uWLt_.mjs → timeouts-pun7VJ02.mjs} +2 -15
- package/dist/.setup/{transcripts-source-p8EV179h.mjs → transcripts-source-CNWswry-.mjs} +31 -79
- package/dist/.setup/typing-CNlSKY5S.mjs +11 -0
- package/dist/.setup/{voice-runtime-B46rcwrG.mjs → voice-runtime-Bc75quiH.mjs} +62 -110
- package/dist/account-inspect-api.js +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/activities-api.js +1 -1
- package/dist/api.js +18 -18
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/control-ui/2afbdab1d3aa65a789d8a3eba666f4b1ec5df07073538fe30d6cf32093a1fb2d/index.js +1 -0
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +19 -128
- package/dist/index.js +1 -1
- package/dist/runtime-api.js +20 -21
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/session-key-api.js +1 -1
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/src/voice/audio-worker.runtime.js +6 -8
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/node_modules/libopus-wasm/CHANGELOG.md +8 -0
- package/node_modules/libopus-wasm/dist/discordjs.d.ts.map +1 -1
- package/node_modules/libopus-wasm/dist/discordjs.js +14 -2
- package/node_modules/libopus-wasm/dist/generated/libopus.generated.mjs +0 -0
- package/node_modules/libopus-wasm/dist/index.d.ts.map +1 -1
- package/node_modules/libopus-wasm/dist/index.js +55 -100
- package/node_modules/libopus-wasm/package.json +5 -5
- package/node_modules/undici/README.md +10 -1
- package/node_modules/undici/docs/docs/api/Agent.md +8 -8
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +9 -6
- package/node_modules/undici/docs/docs/api/Dispatcher.md +9 -0
- package/node_modules/undici/docs/docs/api/Errors.md +25 -0
- package/node_modules/undici/docs/docs/api/Fetch.md +10 -0
- package/node_modules/undici/docs/docs/api/Interceptors.md +4 -3
- package/node_modules/undici/docs/docs/api/Pool.md +5 -6
- package/node_modules/undici/docs/docs/index.md +10 -1
- package/node_modules/undici/lib/api/readable.js +1 -2
- package/node_modules/undici/lib/core/request.js +23 -2
- package/node_modules/undici/lib/core/util.js +0 -39
- package/node_modules/undici/lib/dispatcher/client-h1.js +11 -4
- package/node_modules/undici/lib/dispatcher/client-h2.js +52 -8
- package/node_modules/undici/lib/dispatcher/client.js +6 -1
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +21 -6
- package/node_modules/undici/lib/dispatcher/pool-base.js +63 -2
- package/node_modules/undici/lib/dispatcher/pool.js +90 -7
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +16 -3
- package/node_modules/undici/lib/handler/deduplication-handler.js +24 -11
- package/node_modules/undici/lib/handler/redirect-handler.js +5 -0
- package/node_modules/undici/lib/handler/retry-handler.js +72 -13
- package/node_modules/undici/lib/interceptor/cache.js +4 -1
- package/node_modules/undici/lib/interceptor/decompress.js +236 -69
- package/node_modules/undici/lib/web/cache/cache.js +17 -8
- package/node_modules/undici/lib/web/cache/cachestorage.js +11 -5
- package/node_modules/undici/lib/web/cookies/index.js +19 -7
- package/node_modules/undici/lib/web/cookies/util.js +3 -1
- package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -1
- package/node_modules/undici/lib/web/fetch/body.js +22 -15
- package/node_modules/undici/lib/web/fetch/data-url.js +6 -6
- package/node_modules/undici/lib/web/fetch/formdata.js +30 -36
- package/node_modules/undici/lib/web/fetch/headers.js +34 -31
- package/node_modules/undici/lib/web/fetch/index.js +46 -25
- package/node_modules/undici/lib/web/fetch/request.js +74 -79
- package/node_modules/undici/lib/web/fetch/response.js +43 -44
- package/node_modules/undici/lib/web/fetch/util.js +7 -7
- package/node_modules/undici/lib/web/infra/index.js +16 -1
- package/node_modules/undici/lib/web/webidl/index.js +2 -14
- package/node_modules/undici/lib/web/websocket/connection.js +33 -12
- package/node_modules/undici/lib/web/websocket/events.js +43 -26
- package/node_modules/undici/lib/web/websocket/receiver.js +2 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketerror.js +13 -10
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +19 -4
- package/node_modules/undici/lib/web/websocket/websocket.js +44 -41
- package/node_modules/undici/package.json +1 -1
- package/node_modules/undici/types/diagnostics-channel.d.ts +2 -1
- package/node_modules/undici/types/interceptors.d.ts +1 -1
- package/node_modules/undici/types/webidl.d.ts +13 -7
- package/openclaw.plugin.json +6 -0
- package/package.json +12 -7
- package/dist/.setup/doctor-contract-CvvgwrrG.mjs +0 -409
- package/dist/.setup/model-picker-preference-primitives-BHT1LkR_.mjs +0 -37
- package/dist/.setup/provider.runtime-CUE3UxER.mjs +0 -2
- package/dist/.setup/setup-plugin-api-BQUBxbhe.mjs +0 -3
- package/dist/.setup/targets-0KUcEIYx.mjs +0 -3
- package/dist/.setup/thread-bindings.state-g6v9zAym.mjs +0 -331
- package/dist/.setup/typing-BiHCzBRu.mjs +0 -15
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { D as Message,
|
|
2
|
-
import { C as
|
|
3
|
-
import { s as resolveDefaultDiscordAccountId } from "./accounts-
|
|
4
|
-
import { n as resolveDiscordChannelInfoSafe, r as resolveDiscordChannelNameSafe } from "./channel-access-
|
|
5
|
-
import { A as resolveDiscordMessageChannelId, D as resolveDiscordReferencedReplyMessage, E as resolveDiscordMessageStickers, S as resolveMediaList, _ as resolveDiscordMessageHistoryText, g as resolveDiscordMessageBatch, k as resolveDiscordChannelInfo, v as resolveDiscordMessageMentionDocuments, x as resolveForwardedMediaList, y as resolveDiscordMessageText } from "./transcripts-source-
|
|
6
|
-
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-
|
|
7
|
-
import { _ as resolveDiscordRuntimeBindingConversationId, f as resolveDiscordConversationRoute, h as resolveDiscordConversationIdentity, p as resolveDiscordEffectiveRoute, u as buildDiscordRoutePeer } from "./outbound-session-route-
|
|
8
|
-
import { t as resolveDiscordConversationBindingRoute } from "./conversation-binding-route-
|
|
9
|
-
import { A as resolveDiscordDmCommandAccess, E as handleDiscordDmCommandDecision, j as resolveDiscordTextCommandAccess, n as resolveDiscordPreflightChannelAccess } from "./provider-
|
|
10
|
-
import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-
|
|
11
|
-
import { a as createDiscordHistorySenderProvenance, c as hasRawDiscordUserMention, d as matchesActiveDiscordMentionPatterns, f as resolveDiscordMentionState,
|
|
1
|
+
import { D as Message, ft as getChannelMessage, t as discord_exports } from "./discord-J7aRzq2Q.mjs";
|
|
2
|
+
import { C as formatDiscordUserTag, T as resolveTimestampMs, g as resolveDiscordMentionPolicy, m as resolveDiscordMemberAccessState, o as normalizeDiscordDisplaySlug, p as resolveDiscordGuildEntry, s as normalizeDiscordSlug, u as resolveDiscordChannelConfigWithFallback, w as resolveDiscordSystemLocation } from "./channel-type-D1_b5UhU.mjs";
|
|
3
|
+
import { s as resolveDefaultDiscordAccountId } from "./accounts-DXHCL8Zm.mjs";
|
|
4
|
+
import { n as resolveDiscordChannelInfoSafe, r as resolveDiscordChannelNameSafe } from "./channel-access-BRp3Y-rF.mjs";
|
|
5
|
+
import { A as resolveDiscordMessageChannelId, D as resolveDiscordReferencedReplyMessage, E as resolveDiscordMessageStickers, S as resolveMediaList, _ as resolveDiscordMessageHistoryText, g as resolveDiscordMessageBatch, k as resolveDiscordChannelInfo, v as resolveDiscordMessageMentionDocuments, x as resolveForwardedMediaList, y as resolveDiscordMessageText } from "./transcripts-source-CNWswry-.mjs";
|
|
6
|
+
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-pun7VJ02.mjs";
|
|
7
|
+
import { _ as resolveDiscordRuntimeBindingConversationId, f as resolveDiscordConversationRoute, h as resolveDiscordConversationIdentity, p as resolveDiscordEffectiveRoute, u as buildDiscordRoutePeer } from "./outbound-session-route-DGPPKA0z.mjs";
|
|
8
|
+
import { t as resolveDiscordConversationBindingRoute } from "./conversation-binding-route-Bi62ApSt.mjs";
|
|
9
|
+
import { A as resolveDiscordDmCommandAccess, E as handleDiscordDmCommandDecision, j as resolveDiscordTextCommandAccess, n as resolveDiscordPreflightChannelAccess } from "./provider-D2OKMo0f.mjs";
|
|
10
|
+
import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-CooeYfAn.mjs";
|
|
11
|
+
import { a as createDiscordHistorySenderProvenance, c as hasRawDiscordUserMention, d as matchesActiveDiscordMentionPatterns, f as resolveDiscordMentionState, i as loadSystemEventsRuntime, l as isBoundThreadBotSystemMessage, m as shouldIgnoreBoundThreadWebhookMessage, n as loadDiscordThreadingRuntime, p as resolveInjectedBoundThreadLookupRecord, r as loadPreflightAudioRuntime, s as resolveDiscordHistoryMediaIds, t as resolveDiscordPreflightPluralKitInfo, u as isDiscordThreadChannelMessage } from "./message-handler.preflight-pluralkit-D1g3eq0B.mjs";
|
|
12
12
|
import { logDebug } from "openclaw/plugin-sdk/logging-core";
|
|
13
13
|
import { MessageReferenceType, MessageType } from "discord-api-types/v10";
|
|
14
14
|
import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runtime";
|
|
@@ -26,7 +26,7 @@ import { shouldHandleTextCommands } from "openclaw/plugin-sdk/command-surface";
|
|
|
26
26
|
import { createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
|
|
27
27
|
//#region extensions/discord/src/monitor/message-handler.dm-preflight.ts
|
|
28
28
|
const loadConversationRuntime$1 = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/conversation-binding-runtime"));
|
|
29
|
-
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-
|
|
29
|
+
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-2X7m2Zmw.mjs").then((n) => n.t));
|
|
30
30
|
async function resolveDiscordDmPreflightAccess(params) {
|
|
31
31
|
if (params.dmPolicy === "disabled") {
|
|
32
32
|
logVerbose("discord: drop dm (dmPolicy: disabled)");
|
|
@@ -185,8 +185,6 @@ async function hydrateDiscordMessageIfNeeded(params) {
|
|
|
185
185
|
//#region extensions/discord/src/monitor/message-handler.preflight-channel-context.ts
|
|
186
186
|
function resolveDiscordPreflightChannelContext(params) {
|
|
187
187
|
const threadName = params.threadChannel?.name;
|
|
188
|
-
const configChannelName = params.threadParentName ?? params.channelName;
|
|
189
|
-
const configChannelSlug = configChannelName ? normalizeDiscordSlug(configChannelName) : "";
|
|
190
188
|
const displayChannelName = threadName ?? params.channelName;
|
|
191
189
|
const displayChannelSlug = displayChannelName ? normalizeDiscordDisplaySlug(displayChannelName) : "";
|
|
192
190
|
const guildSlug = params.guildInfo?.slug || (params.guildName ? normalizeDiscordSlug(params.guildName) : "");
|
|
@@ -194,13 +192,9 @@ function resolveDiscordPreflightChannelContext(params) {
|
|
|
194
192
|
const threadParentSlug = params.threadParentName ? normalizeDiscordSlug(params.threadParentName) : "";
|
|
195
193
|
return {
|
|
196
194
|
threadName,
|
|
197
|
-
configChannelName,
|
|
198
|
-
configChannelSlug,
|
|
199
195
|
displayChannelName,
|
|
200
196
|
displayChannelSlug,
|
|
201
197
|
guildSlug,
|
|
202
|
-
threadChannelSlug,
|
|
203
|
-
threadParentSlug,
|
|
204
198
|
channelConfig: params.isGuildMessage ? resolveDiscordChannelConfigWithFallback({
|
|
205
199
|
guildInfo: params.guildInfo,
|
|
206
200
|
channelId: params.messageChannelId,
|
|
@@ -552,7 +546,6 @@ async function preflightDiscordMessage(params) {
|
|
|
552
546
|
return null;
|
|
553
547
|
}
|
|
554
548
|
const isBoundThreadSession = Boolean(threadBinding && threadChannel);
|
|
555
|
-
const bypassMentionRequirement = isBoundThreadSession;
|
|
556
549
|
if (isBoundThreadBotSystemMessage({
|
|
557
550
|
isBoundThreadSession,
|
|
558
551
|
isBotAuthor: Boolean(author.bot),
|
|
@@ -640,10 +633,7 @@ async function preflightDiscordMessage(params) {
|
|
|
640
633
|
guildInfo
|
|
641
634
|
});
|
|
642
635
|
const shouldRequireMentionByConfig = mentionPolicy.requireMention;
|
|
643
|
-
const shouldRequireMention =
|
|
644
|
-
shouldRequireMention: shouldRequireMentionByConfig,
|
|
645
|
-
bypassMentionRequirement
|
|
646
|
-
});
|
|
636
|
+
const shouldRequireMention = shouldRequireMentionByConfig && !isBoundThreadSession;
|
|
647
637
|
const { hasAccessRestrictions, memberAllowed } = resolveDiscordMemberAccessState({
|
|
648
638
|
channelConfig,
|
|
649
639
|
guildInfo,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as isDiscordThreadChannelType } from "./channel-type-
|
|
2
|
-
import { E as resolveDiscordMessageStickers } from "./transcripts-source-
|
|
1
|
+
import { t as isDiscordThreadChannelType } from "./channel-type-D1_b5UhU.mjs";
|
|
2
|
+
import { E as resolveDiscordMessageStickers } from "./transcripts-source-CNWswry-.mjs";
|
|
3
3
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
5
5
|
import { findCodeRegions, isInsideCode } from "openclaw/plugin-sdk/text-chunking";
|
|
@@ -74,9 +74,6 @@ function matchesActiveDiscordMentionPatterns(text, mentionRegexes) {
|
|
|
74
74
|
for (const regex of mentionRegexes) for (const match of cleaned.matchAll(new RegExp(regex.source, `${regex.flags}g`))) if (!codeRegions.some(({ start, end }) => match.index < end && (match.index >= start || match.index + match[0].length > start))) return true;
|
|
75
75
|
return false;
|
|
76
76
|
}
|
|
77
|
-
function resolvePreflightMentionRequirement(params) {
|
|
78
|
-
return params.shouldRequireMention && !params.bypassMentionRequirement;
|
|
79
|
-
}
|
|
80
77
|
function shouldIgnoreBoundThreadWebhookMessage(params) {
|
|
81
78
|
const webhookId = normalizeOptionalString(params.webhookId) ?? "";
|
|
82
79
|
if (!webhookId) return false;
|
|
@@ -118,8 +115,8 @@ function resolveDiscordHistoryMediaIds(message) {
|
|
|
118
115
|
//#region extensions/discord/src/monitor/message-handler.preflight-runtime.ts
|
|
119
116
|
const loadPluralKitRuntime = createLazyRuntimeModule(() => import("./pluralkit-a6_NLfH9.mjs").then((n) => n.n));
|
|
120
117
|
const loadPreflightAudioRuntime = createLazyRuntimeModule(() => import("./preflight-audio-DHGIHEpv.mjs"));
|
|
121
|
-
const loadSystemEventsRuntime = createLazyRuntimeModule(() => import("./system-events-
|
|
122
|
-
const loadDiscordThreadingRuntime = createLazyRuntimeModule(() => import("./transcripts-source-
|
|
118
|
+
const loadSystemEventsRuntime = createLazyRuntimeModule(() => import("./system-events-CQ3if_pS.mjs"));
|
|
119
|
+
const loadDiscordThreadingRuntime = createLazyRuntimeModule(() => import("./transcripts-source-CNWswry-.mjs").then((n) => n.d));
|
|
123
120
|
//#endregion
|
|
124
121
|
//#region extensions/discord/src/monitor/message-handler.preflight-pluralkit.ts
|
|
125
122
|
async function resolveDiscordPreflightPluralKitInfo(params) {
|
|
@@ -138,4 +135,4 @@ async function resolveDiscordPreflightPluralKitInfo(params) {
|
|
|
138
135
|
}
|
|
139
136
|
}
|
|
140
137
|
//#endregion
|
|
141
|
-
export { createDiscordHistorySenderProvenance as a, hasRawDiscordUserMention as c, matchesActiveDiscordMentionPatterns as d, resolveDiscordMentionState as f,
|
|
138
|
+
export { createDiscordHistorySenderProvenance as a, hasRawDiscordUserMention as c, matchesActiveDiscordMentionPatterns as d, resolveDiscordMentionState as f, loadSystemEventsRuntime as i, isBoundThreadBotSystemMessage as l, shouldIgnoreBoundThreadWebhookMessage as m, loadDiscordThreadingRuntime as n, filterDiscordHistoryEntriesForContext as o, resolveInjectedBoundThreadLookupRecord as p, loadPreflightAudioRuntime as r, resolveDiscordHistoryMediaIds as s, resolveDiscordPreflightPluralKitInfo as t, isDiscordThreadChannelMessage as u };
|
package/dist/.setup/{message-handler.process-BNFFuChn.mjs → message-handler.process-CThRmCWK.mjs}
RENAMED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { C as withDiscordRequestAuthority, D as Message,
|
|
2
|
-
import {
|
|
3
|
-
import { p as resolveDiscordMaxLinesPerMessage } from "./accounts-
|
|
4
|
-
import { o as chunkDiscordTextWithMode, x as resolveDiscordChannelId } from "./retry-
|
|
5
|
-
import { N as createDiscordRestClient, O as resolveDiscordMessageFlags, P as createDiscordRuntimeAccountContext, u as resolveDiscordTargetChannelId } from "./send.shared-
|
|
6
|
-
import { a as discordTextHasBroadcastMention } from "./send.outbound-
|
|
7
|
-
import { C as resolveReferencedReplyMediaList, E as resolveDiscordMessageStickers, O as resolveDiscordReferencedReplyMessageId, _ as resolveDiscordMessageHistoryText, b as formatDiscordMediaText, f as resolveDiscordAutoThreadReplyPlan, m as resolveDiscordThreadStarter, y as resolveDiscordMessageText } from "./transcripts-source-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import "./targets-
|
|
11
|
-
import { b as discordInboundEventDelivery, h as resolveDiscordConversationIdentity, u as buildDiscordRoutePeer } from "./outbound-session-route-
|
|
12
|
-
import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-
|
|
13
|
-
import { T as createDiscordSupplementalContextAccessChecker, a as formatDiscordReplySkip, c as buildGuildLabel, i as formatDiscordReplyDeliveryFailure, l as resolveReplyContext, o as sanitizeDiscordFrontChannelReplyPayloads, r as deliverDiscordReply, s as buildDirectLabel, w as buildDiscordInboundAccessContext } from "./provider-
|
|
14
|
-
import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-
|
|
15
|
-
import { t as beginDiscordActiveTurnThreadRoute } from "./active-turn-thread-route-
|
|
16
|
-
import { a as createDiscordHistorySenderProvenance,
|
|
17
|
-
import { t as sendTyping } from "./typing-
|
|
1
|
+
import { C as withDiscordRequestAuthority, D as Message, _t as getGuildMember, lt as deleteChannelMessage, t as discord_exports, ut as editChannelMessage } from "./discord-J7aRzq2Q.mjs";
|
|
2
|
+
import { T as resolveTimestampMs, a as normalizeDiscordAllowList, s as normalizeDiscordSlug } from "./channel-type-D1_b5UhU.mjs";
|
|
3
|
+
import { p as resolveDiscordMaxLinesPerMessage } from "./accounts-DXHCL8Zm.mjs";
|
|
4
|
+
import { o as chunkDiscordTextWithMode, x as resolveDiscordChannelId } from "./retry-BKzO25k4.mjs";
|
|
5
|
+
import { N as createDiscordRestClient, O as resolveDiscordMessageFlags, P as createDiscordRuntimeAccountContext, u as resolveDiscordTargetChannelId } from "./send.shared-BQIUh6Vn.mjs";
|
|
6
|
+
import { a as discordTextHasBroadcastMention } from "./send.outbound-B4QHSEzm.mjs";
|
|
7
|
+
import { C as resolveReferencedReplyMediaList, E as resolveDiscordMessageStickers, O as resolveDiscordReferencedReplyMessageId, _ as resolveDiscordMessageHistoryText, b as formatDiscordMediaText, f as resolveDiscordAutoThreadReplyPlan, m as resolveDiscordThreadStarter, y as resolveDiscordMessageText } from "./transcripts-source-CNWswry-.mjs";
|
|
8
|
+
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-pun7VJ02.mjs";
|
|
9
|
+
import { a as removeReactionDiscord, r as reactMessageDiscord } from "./send-2X7m2Zmw.mjs";
|
|
10
|
+
import "./targets-Lf8D55w-.mjs";
|
|
11
|
+
import { b as discordInboundEventDelivery, h as resolveDiscordConversationIdentity, u as buildDiscordRoutePeer } from "./outbound-session-route-DGPPKA0z.mjs";
|
|
12
|
+
import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-BPq0c2wY.mjs";
|
|
13
|
+
import { T as createDiscordSupplementalContextAccessChecker, a as formatDiscordReplySkip, c as buildGuildLabel, i as formatDiscordReplyDeliveryFailure, l as resolveReplyContext, o as sanitizeDiscordFrontChannelReplyPayloads, r as deliverDiscordReply, s as buildDirectLabel, w as buildDiscordInboundAccessContext } from "./provider-D2OKMo0f.mjs";
|
|
14
|
+
import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-CooeYfAn.mjs";
|
|
15
|
+
import { t as beginDiscordActiveTurnThreadRoute } from "./active-turn-thread-route-C4tp9noA.mjs";
|
|
16
|
+
import { a as createDiscordHistorySenderProvenance, l as isBoundThreadBotSystemMessage, m as shouldIgnoreBoundThreadWebhookMessage, o as filterDiscordHistoryEntriesForContext, s as resolveDiscordHistoryMediaIds, t as resolveDiscordPreflightPluralKitInfo } from "./message-handler.preflight-pluralkit-D1g3eq0B.mjs";
|
|
17
|
+
import { t as sendTyping } from "./typing-CNlSKY5S.mjs";
|
|
18
|
+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
19
|
+
import { Routes } from "discord-api-types/v10";
|
|
18
20
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
19
21
|
import { buildAgentSessionKey, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
|
|
20
|
-
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
21
22
|
import { getReplyPayloadTtsSupplement, isReplyPayloadNonTerminalToolErrorWarning, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
22
23
|
import { danger, logVerbose, shouldLogVerbose, sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
23
24
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
@@ -58,7 +59,7 @@ async function recoverDiscordChannelHistory(params) {
|
|
|
58
59
|
try {
|
|
59
60
|
while (remaining > 0 && isCurrent()) {
|
|
60
61
|
const limit = Math.min(100, remaining);
|
|
61
|
-
const page = await
|
|
62
|
+
const page = await ctx.client.rest.get(Routes.channelMessages(ctx.messageChannelId), {
|
|
62
63
|
before,
|
|
63
64
|
limit
|
|
64
65
|
});
|
|
@@ -386,10 +387,7 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
386
387
|
threadParentInheritanceEnabled
|
|
387
388
|
});
|
|
388
389
|
if (!isHistoryCurrent()) return null;
|
|
389
|
-
const deliverTarget = replyPlan
|
|
390
|
-
const replyTarget = replyPlan.replyTarget;
|
|
391
|
-
const replyReference = replyPlan.replyReference;
|
|
392
|
-
const autoThreadContext = replyPlan.autoThreadContext;
|
|
390
|
+
const { deliverTarget, replyTarget, replyReference, autoThreadContext } = replyPlan;
|
|
393
391
|
const conversationParentId = threadChannel ? threadParentId : autoThreadContext ? messageChannelId : void 0;
|
|
394
392
|
const effectiveFrom = isDirectMessage ? `discord:${author.id}` : autoThreadContext?.From ?? `discord:channel:${messageChannelId}`;
|
|
395
393
|
const dmConversationTarget = isDirectMessage ? resolveDiscordConversationIdentity({
|
|
@@ -423,6 +421,13 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
423
421
|
threadId: threadChannel?.id ?? autoThreadContext?.createdThreadId ?? void 0
|
|
424
422
|
});
|
|
425
423
|
if (!isHistoryCurrent()) return null;
|
|
424
|
+
const conversationThreadId = threadChannel?.id ?? autoThreadContext?.createdThreadId;
|
|
425
|
+
const conversationChannelId = conversationThreadId ?? messageChannelId;
|
|
426
|
+
const conversationGuildId = isGuildMessage ? guildInfo?.id ?? data.guild?.id ?? data.guild_id : "@me";
|
|
427
|
+
const conversationLink = /^\d+$/.test(conversationChannelId) && conversationGuildId && (conversationGuildId === "@me" || /^\d+$/.test(conversationGuildId)) ? {
|
|
428
|
+
url: `https://discord.com/channels/${conversationGuildId}/${conversationChannelId}`,
|
|
429
|
+
label: conversationThreadId ? "Discord Thread" : "Discord Conversation"
|
|
430
|
+
} : void 0;
|
|
426
431
|
const batchMessageIds = ctx.sourceMessageIds && ctx.sourceMessageIds.length > 1 ? [...ctx.sourceMessageIds] : void 0;
|
|
427
432
|
const ctxPayload = await (ctx.buildContext ?? buildChannelInboundEventContext)({
|
|
428
433
|
channelIngress,
|
|
@@ -454,6 +459,7 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
454
459
|
}),
|
|
455
460
|
nativeChannelId: messageChannelId,
|
|
456
461
|
avatar: ctx.conversationAvatar,
|
|
462
|
+
link: conversationLink,
|
|
457
463
|
label: fromLabel,
|
|
458
464
|
spaceId: isGuildMessage ? (guildInfo?.id ?? data.guild?.id ?? data.guild_id ?? guildSlug) || void 0 : void 0,
|
|
459
465
|
parentId: conversationParentId,
|
|
@@ -868,11 +874,6 @@ function createDiscordMessageReactionRuntime(params) {
|
|
|
868
874
|
};
|
|
869
875
|
}
|
|
870
876
|
//#endregion
|
|
871
|
-
//#region extensions/discord/src/draft-chunking.ts
|
|
872
|
-
function resolveDiscordDraftStreamingChunking(cfg, accountId) {
|
|
873
|
-
return resolveChannelDraftStreamingChunking(cfg, "discord", accountId, { fallbackLimit: DISCORD_TEXT_CHUNK_LIMIT });
|
|
874
|
-
}
|
|
875
|
-
//#endregion
|
|
876
877
|
//#region extensions/discord/src/draft-stream.ts
|
|
877
878
|
/** Discord messages cap at 2000 characters. */
|
|
878
879
|
const DISCORD_STREAM_MAX_CHARS = 2e3;
|
|
@@ -892,13 +893,9 @@ function createDiscordDraftStream(params) {
|
|
|
892
893
|
};
|
|
893
894
|
let streamMessage;
|
|
894
895
|
let lastSentText = "";
|
|
895
|
-
let streamGeneration = 0;
|
|
896
|
-
let activeCreateGeneration;
|
|
897
|
-
let discardActiveCreate = false;
|
|
898
896
|
const sendOrEditStreamMessage = async ({ text, complete }) => {
|
|
899
|
-
const generation =
|
|
897
|
+
const generation = lifecycle.generation;
|
|
900
898
|
const targetChannelId = channelId;
|
|
901
|
-
if (streamState.stopped && !streamState.final) return false;
|
|
902
899
|
const trimmed = text.trimEnd();
|
|
903
900
|
if (!trimmed) return false;
|
|
904
901
|
if (trimmed.length > maxChars) {
|
|
@@ -918,7 +915,7 @@ function createDiscordDraftStream(params) {
|
|
|
918
915
|
};
|
|
919
916
|
if (streamMessage !== void 0) {
|
|
920
917
|
await editChannelMessage(rest, streamMessage.channelId, streamMessage.messageId, { body });
|
|
921
|
-
if (generation ===
|
|
918
|
+
if (generation === lifecycle.generation) lastSentText = trimmed;
|
|
922
919
|
return true;
|
|
923
920
|
}
|
|
924
921
|
const replyToMessageId = resolveReplyToMessageId()?.trim();
|
|
@@ -926,38 +923,27 @@ function createDiscordDraftStream(params) {
|
|
|
926
923
|
message_id: replyToMessageId,
|
|
927
924
|
fail_if_not_exists: false
|
|
928
925
|
} : void 0;
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
activeCreateGeneration = void 0;
|
|
936
|
-
discardActiveCreate = false;
|
|
937
|
-
if (generation !== streamGeneration) {
|
|
938
|
-
if (shouldDiscardStaleCreate && typeof sentMessageId === "string" && sentMessageId) await lifecycle.retire({
|
|
926
|
+
return await lifecycle.createMessage(async () => {
|
|
927
|
+
const sent = await rest.post(Routes.channelMessages(targetChannelId), { body: {
|
|
928
|
+
...body,
|
|
929
|
+
...messageReference ? { message_reference: messageReference } : {}
|
|
930
|
+
} });
|
|
931
|
+
return typeof sent?.id === "string" && sent.id ? {
|
|
939
932
|
channelId: targetChannelId,
|
|
940
|
-
messageId:
|
|
941
|
-
}
|
|
933
|
+
messageId: sent.id
|
|
934
|
+
} : void 0;
|
|
935
|
+
}, (message) => {
|
|
936
|
+
if (!message) {
|
|
937
|
+
streamState.stopped = true;
|
|
938
|
+
params.warn?.("discord stream preview stopped (missing message id from send)");
|
|
939
|
+
return false;
|
|
940
|
+
}
|
|
941
|
+
streamMessage = message;
|
|
942
|
+
lastSentText = trimmed;
|
|
942
943
|
return true;
|
|
943
|
-
}
|
|
944
|
-
if (typeof sentMessageId !== "string" || !sentMessageId) {
|
|
945
|
-
streamState.stopped = true;
|
|
946
|
-
params.warn?.("discord stream preview stopped (missing message id from send)");
|
|
947
|
-
return false;
|
|
948
|
-
}
|
|
949
|
-
streamMessage = {
|
|
950
|
-
channelId: targetChannelId,
|
|
951
|
-
messageId: sentMessageId
|
|
952
|
-
};
|
|
953
|
-
lastSentText = trimmed;
|
|
954
|
-
return true;
|
|
944
|
+
});
|
|
955
945
|
} catch (err) {
|
|
956
|
-
if (
|
|
957
|
-
activeCreateGeneration = void 0;
|
|
958
|
-
discardActiveCreate = false;
|
|
959
|
-
}
|
|
960
|
-
if (generation !== streamGeneration) return true;
|
|
946
|
+
if (generation !== lifecycle.generation) return true;
|
|
961
947
|
streamState.stopped = true;
|
|
962
948
|
params.warn?.(`discord stream preview failed: ${formatErrorMessage(err)}`);
|
|
963
949
|
return false;
|
|
@@ -990,16 +976,7 @@ function createDiscordDraftStream(params) {
|
|
|
990
976
|
text,
|
|
991
977
|
complete: options?.complete === true
|
|
992
978
|
});
|
|
993
|
-
|
|
994
|
-
if (mode === "discard" && activeCreateGeneration !== void 0) discardActiveCreate = true;
|
|
995
|
-
streamGeneration += 1;
|
|
996
|
-
streamState.stopped = false;
|
|
997
|
-
streamState.final = false;
|
|
998
|
-
streamMessage = void 0;
|
|
999
|
-
lastSentText = "";
|
|
1000
|
-
loop.resetPending();
|
|
1001
|
-
loop.resetThrottleWindow();
|
|
1002
|
-
};
|
|
979
|
+
/** Move the draft to another channel, preserving its current text. */
|
|
1003
980
|
const retarget = async (nextChannelId) => {
|
|
1004
981
|
const normalized = nextChannelId.trim();
|
|
1005
982
|
if (!normalized || normalized === channelId) return;
|
|
@@ -1007,13 +984,8 @@ function createDiscordDraftStream(params) {
|
|
|
1007
984
|
const pending = loop.takePending();
|
|
1008
985
|
const previousMessage = streamMessage;
|
|
1009
986
|
const previousText = pending.text || lastSentText;
|
|
1010
|
-
streamGeneration += 1;
|
|
1011
987
|
channelId = normalized;
|
|
1012
|
-
|
|
1013
|
-
lastSentText = "";
|
|
1014
|
-
streamState.stopped = false;
|
|
1015
|
-
streamState.final = false;
|
|
1016
|
-
loop.resetThrottleWindow();
|
|
988
|
+
lifecycle.reset();
|
|
1017
989
|
if (previousText) {
|
|
1018
990
|
update(previousText, { complete: pending.text ? pending.complete : true });
|
|
1019
991
|
await loop.flush();
|
|
@@ -1026,22 +998,14 @@ function createDiscordDraftStream(params) {
|
|
|
1026
998
|
await lifecycle.retire(previousMessage);
|
|
1027
999
|
}
|
|
1028
1000
|
};
|
|
1029
|
-
const retireCurrentMessage = async (stopForClear) => {
|
|
1030
|
-
const generation = streamGeneration;
|
|
1031
|
-
await stopForClear();
|
|
1032
|
-
if (generation !== streamGeneration) return;
|
|
1033
|
-
const message = streamMessage;
|
|
1034
|
-
clearMessageId();
|
|
1035
|
-
if (message) await lifecycle.retire(message);
|
|
1036
|
-
};
|
|
1037
1001
|
params.log?.(`discord stream preview ready (maxChars=${maxChars}, throttleMs=${throttleMs})`);
|
|
1038
1002
|
return {
|
|
1039
1003
|
update,
|
|
1040
1004
|
flush: loop.flush,
|
|
1041
1005
|
messageId: () => streamMessage?.messageId,
|
|
1042
1006
|
lastDeliveredText: () => lastSentText,
|
|
1043
|
-
clear: () =>
|
|
1044
|
-
deleteCurrentMessage: () =>
|
|
1007
|
+
clear: () => lifecycle.retireCurrent(discardPending),
|
|
1008
|
+
deleteCurrentMessage: () => lifecycle.retireCurrent(async () => {
|
|
1045
1009
|
loop.resetPending();
|
|
1046
1010
|
await loop.waitForInFlight();
|
|
1047
1011
|
}),
|
|
@@ -1049,10 +1013,8 @@ function createDiscordDraftStream(params) {
|
|
|
1049
1013
|
seal,
|
|
1050
1014
|
stop,
|
|
1051
1015
|
retarget,
|
|
1052
|
-
cleanupPendingMessages:
|
|
1053
|
-
|
|
1054
|
-
},
|
|
1055
|
-
forceNewMessage
|
|
1016
|
+
cleanupPendingMessages: lifecycle.cleanupPending,
|
|
1017
|
+
forceNewMessage: lifecycle.reset
|
|
1056
1018
|
};
|
|
1057
1019
|
}
|
|
1058
1020
|
//#endregion
|
|
@@ -1084,7 +1046,7 @@ function createDiscordDraftPreviewController(params) {
|
|
|
1084
1046
|
log: params.log,
|
|
1085
1047
|
warn: params.log
|
|
1086
1048
|
}) : void 0;
|
|
1087
|
-
const draftChunking = draftStream && discordStreamMode === "block" ?
|
|
1049
|
+
const draftChunking = draftStream && discordStreamMode === "block" ? resolveChannelDraftStreamingChunking(params.cfg, "discord", params.accountId, { fallbackLimit: DISCORD_TEXT_CHUNK_LIMIT }) : void 0;
|
|
1088
1050
|
const shouldSplitPreviewMessages = discordStreamMode === "block";
|
|
1089
1051
|
const draftChunker = draftChunking ? new EmbeddedBlockChunker(draftChunking) : void 0;
|
|
1090
1052
|
let lastPartialText = "";
|
|
@@ -1729,7 +1691,7 @@ async function processDiscordMessage(ctx, observer) {
|
|
|
1729
1691
|
}
|
|
1730
1692
|
if (isFinal && !replyLifecycleStarted && !isRoomEvent && configuredTypingMode !== "never") await onDiscordReplyStart();
|
|
1731
1693
|
const draftStream = draftPreview.draftStream;
|
|
1732
|
-
if (draftStream && draftPreview.isProgressMode && info.kind === "block" && !deliverablePayload.isCommentary
|
|
1694
|
+
if (draftStream && draftPreview.isProgressMode && info.kind === "block" && !deliverablePayload.isCommentary) {
|
|
1733
1695
|
if (!resolveSendableOutboundReplyParts(deliverablePayload).hasMedia && !deliverablePayload.isError) return { visibleReplySent: false };
|
|
1734
1696
|
}
|
|
1735
1697
|
let deliveryResult = { visibleReplySent: false };
|
|
@@ -1891,7 +1853,6 @@ async function processDiscordMessage(ctx, observer) {
|
|
|
1891
1853
|
finalDeliveryFailed
|
|
1892
1854
|
});
|
|
1893
1855
|
}
|
|
1894
|
-
if (dispatchAborted) return;
|
|
1895
1856
|
const finalDispatchResult = dispatchResult;
|
|
1896
1857
|
if (!finalDispatchResult || !hasFinalInboundReplyDispatch(finalDispatchResult)) return;
|
|
1897
1858
|
if (shouldLogVerbose()) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { t as createDiscordActionGate } from "./accounts-
|
|
2
|
-
import { b as parseDiscordTarget, c as createDiscordSendReceipt, d as toDiscordOutboundDeliveryResult, i as hasDiscordMessageCreateAmbiguity, l as createDiscordSendReceiptFromResults, m as resolveDiscordReplyReference, o as chunkDiscordTextWithMode, t as canFallbackDiscordWebhookSend, v as normalizeDiscordMessagingTarget, y as normalizeDiscordOutboundTarget } from "./retry-
|
|
3
|
-
import { a as resolveDiscordComponentSpec, b as discordInboundEventDelivery, c as formatDiscordApprovalDisplayValue, g as resolveDiscordCurrentConversationIdentity, n as DISCORD_PRESENTATION_CAPABILITIES, o as sendDiscordComponentMessageLazy, r as buildDiscordPresentationPayload, x as notifyDiscordInboundEventOutboundPayloadSuccess } from "./outbound-session-route-
|
|
4
|
-
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
1
|
+
import { t as createDiscordActionGate } from "./accounts-DXHCL8Zm.mjs";
|
|
2
|
+
import { b as parseDiscordTarget, c as createDiscordSendReceipt, d as toDiscordOutboundDeliveryResult, i as hasDiscordMessageCreateAmbiguity, l as createDiscordSendReceiptFromResults, m as resolveDiscordReplyReference, o as chunkDiscordTextWithMode, t as canFallbackDiscordWebhookSend, v as normalizeDiscordMessagingTarget, y as normalizeDiscordOutboundTarget } from "./retry-BKzO25k4.mjs";
|
|
3
|
+
import { a as resolveDiscordComponentSpec, b as discordInboundEventDelivery, c as formatDiscordApprovalDisplayValue, g as resolveDiscordCurrentConversationIdentity, n as DISCORD_PRESENTATION_CAPABILITIES, o as sendDiscordComponentMessageLazy, r as buildDiscordPresentationPayload, x as notifyDiscordInboundEventOutboundPayloadSuccess } from "./outbound-session-route-DGPPKA0z.mjs";
|
|
5
4
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
5
|
import { getReplyPayloadTtsSupplement, resolvePayloadMediaUrls, sendPayloadMediaSequenceOrFallback, sendTextMediaPayload } from "openclaw/plugin-sdk/reply-payload";
|
|
7
6
|
import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
|
|
8
7
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
8
|
+
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
9
9
|
import { createReplyToFanout, resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-outbound";
|
|
10
10
|
import { attachChannelToResult, createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
|
|
11
11
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
@@ -103,14 +103,14 @@ function resolveDiscordInboundConversation(params) {
|
|
|
103
103
|
}
|
|
104
104
|
//#endregion
|
|
105
105
|
//#region extensions/discord/src/media-detection.ts
|
|
106
|
-
const DISCORD_VIDEO_MEDIA_EXTENSIONS =
|
|
106
|
+
const DISCORD_VIDEO_MEDIA_EXTENSIONS = [
|
|
107
107
|
".avi",
|
|
108
108
|
".m4v",
|
|
109
109
|
".mkv",
|
|
110
110
|
".mov",
|
|
111
111
|
".mp4",
|
|
112
112
|
".webm"
|
|
113
|
-
]
|
|
113
|
+
];
|
|
114
114
|
function normalizeMediaPathForExtension(mediaUrl) {
|
|
115
115
|
const trimmed = mediaUrl.trim();
|
|
116
116
|
if (!trimmed) return "";
|
|
@@ -130,8 +130,7 @@ function normalizeMediaPathForExtension(mediaUrl) {
|
|
|
130
130
|
}
|
|
131
131
|
function isLikelyDiscordVideoMedia(mediaUrl) {
|
|
132
132
|
const normalized = normalizeMediaPathForExtension(mediaUrl);
|
|
133
|
-
|
|
134
|
-
return false;
|
|
133
|
+
return DISCORD_VIDEO_MEDIA_EXTENSIONS.some((ext) => normalized.endsWith(ext));
|
|
135
134
|
}
|
|
136
135
|
//#endregion
|
|
137
136
|
//#region extensions/discord/src/outbound-approval.ts
|
|
@@ -151,7 +150,7 @@ function normalizeDiscordApprovalPayload(payload) {
|
|
|
151
150
|
}
|
|
152
151
|
//#endregion
|
|
153
152
|
//#region extensions/discord/src/outbound-send-context.ts
|
|
154
|
-
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-
|
|
153
|
+
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-2X7m2Zmw.mjs").then((n) => n.t));
|
|
155
154
|
function resolveDiscordFormattingOptions(ctx) {
|
|
156
155
|
const formatting = ctx.formatting;
|
|
157
156
|
return {
|
|
@@ -366,8 +365,8 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
366
365
|
const DISCORD_TEXT_CHUNK_LIMIT = 2e3;
|
|
367
366
|
const DISCORD_PRECHUNK_MAX_LINES = Number.MAX_SAFE_INTEGER;
|
|
368
367
|
const log = createSubsystemLogger("discord/outbound");
|
|
369
|
-
const loadDiscordThreadBindings = createLazyRuntimeModule(() => import("./thread-bindings-
|
|
370
|
-
const loadDiscordComponentSendRuntime = createLazyRuntimeModule(() => import("./send.components-
|
|
368
|
+
const loadDiscordThreadBindings = createLazyRuntimeModule(() => import("./thread-bindings-yNNlcUWE.mjs").then((n) => n.i));
|
|
369
|
+
const loadDiscordComponentSendRuntime = createLazyRuntimeModule(() => import("./send.components-RqvgmCs3.mjs").then((n) => n.i));
|
|
371
370
|
function resolveDiscordDeliveryOptions(params) {
|
|
372
371
|
return {
|
|
373
372
|
onPlatformSendDispatch: params.onPlatformSendDispatch,
|
|
@@ -444,12 +443,7 @@ const discordOutbound = {
|
|
|
444
443
|
thread: true,
|
|
445
444
|
messageSendingHooks: true
|
|
446
445
|
} },
|
|
447
|
-
renderPresentation:
|
|
448
|
-
return await buildDiscordPresentationPayload({
|
|
449
|
-
payload,
|
|
450
|
-
presentation
|
|
451
|
-
});
|
|
452
|
-
},
|
|
446
|
+
renderPresentation: buildDiscordPresentationPayload,
|
|
453
447
|
resolveTarget: ({ to, allowFrom }) => normalizeDiscordOutboundTarget(to, allowFrom),
|
|
454
448
|
sendPayload: async (ctx) => await sendDiscordOutboundPayload({
|
|
455
449
|
ctx,
|
package/dist/.setup/{outbound-session-route-zVGxxceg.mjs → outbound-session-route-DGPPKA0z.mjs}
RENAMED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { h as readDiscordComponentSpec, m as coerceDiscordComponentParam } from "./components-
|
|
2
|
-
import { t as isDiscordThreadChannelType } from "./channel-type-
|
|
3
|
-
import { c as resolveDiscordAccount, r as listDiscordAccountIds, t as createDiscordActionGate } from "./accounts-
|
|
4
|
-
import { _ as matchesDiscordToolContextTarget, b as parseDiscordTarget, v as normalizeDiscordMessagingTarget } from "./retry-
|
|
1
|
+
import { h as readDiscordComponentSpec, m as coerceDiscordComponentParam } from "./components-CzXLR3QH.mjs";
|
|
2
|
+
import { t as isDiscordThreadChannelType } from "./channel-type-D1_b5UhU.mjs";
|
|
3
|
+
import { c as resolveDiscordAccount, r as listDiscordAccountIds, t as createDiscordActionGate } from "./accounts-DXHCL8Zm.mjs";
|
|
4
|
+
import { _ as matchesDiscordToolContextTarget, b as parseDiscordTarget, v as normalizeDiscordMessagingTarget } from "./retry-BKzO25k4.mjs";
|
|
5
5
|
import { n as resolveDiscordCommandOwnerEntries } from "./command-owners-D78sAoOz.mjs";
|
|
6
|
-
import { t as inspectDiscordAccount } from "./account-inspect-
|
|
6
|
+
import { t as inspectDiscordAccount } from "./account-inspect-CjKqkDnH.mjs";
|
|
7
|
+
import { asOptionalRecord, isRecord, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
8
|
import { ChannelType } from "discord-api-types/v10";
|
|
8
9
|
import { Type } from "typebox";
|
|
9
10
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
10
11
|
import { buildOutboundBaseSessionKey, deriveLastRoutePolicy, isAcpSessionKey, isSubagentSessionKey, parseAgentSessionKey, resolveAgentIdFromSessionKey, resolveAgentRoute } from "openclaw/plugin-sdk/routing";
|
|
11
|
-
import { asOptionalRecord, isRecord, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
12
|
import { resolveAskUserQuestionOptionIndices } from "openclaw/plugin-sdk/reply-payload";
|
|
13
|
-
import {
|
|
13
|
+
import { createLazyRuntimeMethod, createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
14
14
|
import { createUnionActionGate } from "openclaw/plugin-sdk/channel-actions";
|
|
15
15
|
import { buildThreadAwareOutboundSessionRoute } from "openclaw/plugin-sdk/channel-core";
|
|
16
16
|
import { getExecApprovalReplyMetadata, isChannelExecApprovalClientEnabledFromConfig, matchesApprovalRequestFilters } from "openclaw/plugin-sdk/approval-client-runtime";
|
|
@@ -256,15 +256,7 @@ function resolveDiscordThreadReplyTarget(args) {
|
|
|
256
256
|
const target = threadId !== void 0 ? `channel:${threadId}` : normalizeOptionalString(args.channelId) ?? normalizeOptionalString(args.to) ?? normalizeOptionalString(args.target);
|
|
257
257
|
return target ? normalizeDiscordMessagingTarget(target) : void 0;
|
|
258
258
|
}
|
|
259
|
-
|
|
260
|
-
const requestedTarget = resolveDiscordThreadReplyTarget(params.args);
|
|
261
|
-
if (!requestedTarget) return false;
|
|
262
|
-
return matchesDiscordToolContextTarget({
|
|
263
|
-
target: requestedTarget,
|
|
264
|
-
toolContext: params.toolContext
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
const loadDiscordChannelActionsRuntime = createLazyRuntimeModule(() => import("./handle-action-CUvQWnE7.mjs"));
|
|
259
|
+
const loadDiscordChannelActionsRuntime = createLazyRuntimeModule(() => import("./handle-action-DlmFX-_G.mjs"));
|
|
268
260
|
const discordActionGroups = [
|
|
269
261
|
{
|
|
270
262
|
gate: "polls",
|
|
@@ -447,10 +439,13 @@ const discordMessageActions = {
|
|
|
447
439
|
aliases: ["threadId"],
|
|
448
440
|
deliveryTargetAliases: ["threadId"],
|
|
449
441
|
resolveDeliveryTarget: ({ args }) => resolveDiscordThreadReplyDeliveryAlias(args),
|
|
450
|
-
matchesCurrentConversation: ({ args, toolContext }) =>
|
|
451
|
-
args
|
|
452
|
-
|
|
453
|
-
|
|
442
|
+
matchesCurrentConversation: ({ args, toolContext }) => {
|
|
443
|
+
const target = resolveDiscordThreadReplyTarget(args);
|
|
444
|
+
return target ? matchesDiscordToolContextTarget({
|
|
445
|
+
target,
|
|
446
|
+
toolContext
|
|
447
|
+
}) : false;
|
|
448
|
+
}
|
|
454
449
|
} },
|
|
455
450
|
requiresTrustedRequesterSender: ({ action, toolContext }) => Boolean(toolContext) && isTrustedRequesterGuildAdminAction(action),
|
|
456
451
|
extractToolSend: ({ args }) => {
|
|
@@ -491,27 +486,10 @@ const discordMessageActions = {
|
|
|
491
486
|
}
|
|
492
487
|
};
|
|
493
488
|
},
|
|
494
|
-
handleAction: async ({
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
cfg,
|
|
499
|
-
accountId,
|
|
500
|
-
requesterSenderId,
|
|
501
|
-
senderIsOwner,
|
|
502
|
-
toolContext,
|
|
503
|
-
mediaAccess,
|
|
504
|
-
mediaLocalRoots,
|
|
505
|
-
mediaReadFile,
|
|
506
|
-
...sessionKey ? { sessionKey } : {},
|
|
507
|
-
...inboundEventKind ? { inboundEventKind } : {},
|
|
508
|
-
...requesterAccountId ? { requesterAccountId } : {},
|
|
509
|
-
...conversationReadOrigin ? { conversationReadOrigin } : {},
|
|
510
|
-
...reply ? { reply } : {},
|
|
511
|
-
...progressSnapshot ? { progressSnapshot } : {},
|
|
512
|
-
...assertDirectAdapterHandoff ? { assertDirectAdapterHandoff } : {}
|
|
513
|
-
});
|
|
514
|
-
}
|
|
489
|
+
handleAction: async ({ channel: _channel, sessionKey, ...ctx }) => (await loadDiscordChannelActionsRuntime()).handleDiscordMessageAction({
|
|
490
|
+
...ctx,
|
|
491
|
+
...sessionKey ? { sessionKey } : {}
|
|
492
|
+
})
|
|
515
493
|
};
|
|
516
494
|
//#endregion
|
|
517
495
|
//#region extensions/discord/src/conversation-identity.ts
|
|
@@ -713,11 +691,8 @@ const DISCORD_PRESENTATION_CAPABILITIES = {
|
|
|
713
691
|
}
|
|
714
692
|
}
|
|
715
693
|
};
|
|
716
|
-
const
|
|
717
|
-
|
|
718
|
-
return await (await loadDiscordComponentSend())(...args);
|
|
719
|
-
}
|
|
720
|
-
const loadDiscordSharedInteractive = createLazyRuntimeModule(() => import("./components-Cq1PvIpN.mjs").then((n) => n.a));
|
|
694
|
+
const sendDiscordComponentMessageLazy = createLazyRuntimeMethod(createLazyRuntimeModule(() => import("./send.components-RqvgmCs3.mjs").then((n) => n.i)), (runtime) => runtime.sendDiscordComponentMessage);
|
|
695
|
+
const loadDiscordSharedInteractive = createLazyRuntimeModule(() => import("./components-CzXLR3QH.mjs").then((n) => n.a));
|
|
721
696
|
function addPayloadTextFallback(spec, payload) {
|
|
722
697
|
return spec.text ? spec : {
|
|
723
698
|
...spec,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
1
2
|
//#region extensions/discord/src/monitor/presence-cache.ts
|
|
2
3
|
/**
|
|
3
4
|
* In-memory cache of Discord user presence data.
|
|
@@ -17,10 +18,7 @@ function setPresence(accountId, userId, data) {
|
|
|
17
18
|
presenceCache.set(accountKey, accountCache);
|
|
18
19
|
}
|
|
19
20
|
accountCache.set(userId, data);
|
|
20
|
-
|
|
21
|
-
const oldest = accountCache.keys().next().value;
|
|
22
|
-
if (oldest !== void 0) accountCache.delete(oldest);
|
|
23
|
-
}
|
|
21
|
+
pruneMapToMaxSize(accountCache, MAX_PRESENCE_PER_ACCOUNT);
|
|
24
22
|
}
|
|
25
23
|
function getPresence(accountId, userId) {
|
|
26
24
|
return presenceCache.get(resolveAccountKey(accountId))?.get(userId);
|