@openclaw/discord 2026.8.2 → 2026.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action-runtime-api.js +1 -1
- package/dist/{activities-api-CkKcHUB6.js → activities-api-E-segZn6.js} +20 -8
- package/dist/activities-api.js +1 -1
- package/dist/api.js +12 -12
- package/dist/{approval-handler.runtime-DZM6Kt1Z.js → approval-handler.runtime-CW5k3mSa.js} +16 -10
- package/dist/{audit-DIbQA4VT.js → audit-B9rydv5a.js} +4 -4
- package/dist/{channel-CarzU3bg.js → channel-D93LnbTE.js} +20 -16
- package/dist/{channel-actions.runtime-B2wMqeVK.js → channel-actions.runtime-DMFv4doE.js} +7 -7
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-z_ewMVa9.js → channel.setup-DTL7kPOM.js} +3 -3
- package/dist/{components-gvRA0oaI.js → components-DmXYIQ26.js} +83 -141
- package/dist/{conversation-binding-route-DPpBRpYI.js → conversation-binding-route-24afmvEC.js} +1 -1
- package/dist/{directory-config-AA8wQx0D.js → directory-config-BD4YL7wT.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-D_kFz_Fj.js → directory-live-BrFVc1Ds.js} +1 -1
- package/dist/{doctor-QQTOkBfW.js → doctor-BUB41_lr.js} +2 -2
- package/dist/{handle-action.guild-admin-Cc88ZGon.js → handle-action.guild-admin-B0egstYq.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/{message-handler-CAeEpqWo.js → message-handler-Qdw9c0j4.js} +5 -5
- package/dist/{message-handler.preflight-CoKoE3dY.js → message-handler.preflight-Dxi2yBfR.js} +21 -24
- package/dist/{message-handler.process-cdIJ_fDT.js → message-handler.process-BYDjtxZJ.js} +37 -45
- package/dist/{message-text-C0K4-fkg.js → message-text-BRVqYm-t.js} +1 -1
- package/dist/{outbound-adapter-Ch0At5Ra.js → outbound-adapter-DEhthWTk.js} +25 -52
- package/dist/{outbound-components-Bnt_7x7r.js → outbound-components-DehyxvA4.js} +3 -3
- package/dist/{outbound-session-route-CzzerX2K.js → outbound-session-route-BFGRF9fE.js} +3 -3
- package/dist/{pluralkit-B3cUVI7i.js → pluralkit-XmmAHoV6.js} +1 -1
- package/dist/{provider-CjI8BSzS.js → provider-DuDtKbF8.js} +21 -21
- package/dist/{provider-session.runtime-DdKRMcE9.js → provider-session.runtime-BA2BPyZ4.js} +3 -3
- package/dist/provider.runtime-Db8YwZBv.js +2 -0
- package/dist/{realtime-session.runtime-37IC-p5K.js → realtime-session.runtime-DgSbX6ay.js} +66 -122
- package/dist/{resolve-channels-BexR2eUn.js → resolve-channels-CYseD5Uw.js} +1 -1
- package/dist/{resolve-users-BtXBCH5W.js → resolve-users-DrmhDrqm.js} +1 -1
- package/dist/{retry-t5RcEsPk.js → retry-BNCxiyyR.js} +8 -3
- package/dist/{runtime-DydyfxST.js → runtime-BbWNtfyq.js} +7 -7
- package/dist/{runtime-BNlDfLwS.js → runtime-DB7Fb6AU.js} +1 -1
- package/dist/runtime-api.js +15 -15
- package/dist/{send-mTKSBdmZ.js → send-BnTEIeLE.js} +60 -56
- package/dist/{send.components-nsPnc7kK.js → send.components-BWVEcjRP.js} +4 -4
- package/dist/{send.outbound-CaOs9Zy1.js → send.outbound-b5xwHTlL.js} +4 -5
- package/dist/{send.shared-BJHt0Vyf.js → send.shared-5vxBTagO.js} +2 -2
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-BNesVA4P.js → shared-BSJWHEMA.js} +1 -1
- package/dist/{subagent-hooks-IeZVPLGj.js → subagent-hooks-IzQKX4RQ.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{system-events-Be5EJI3b.js → system-events-BOiDS8b3.js} +1 -1
- package/dist/{target-resolver-C0MnwEki.js → target-resolver-BVI8xSSC.js} +2 -2
- package/dist/targets-DbxVbq8k.js +3 -0
- package/dist/{thread-bindings-wECUSIIG.js → thread-bindings-D7mcaXQC.js} +3 -3
- package/dist/{thread-bindings.manager-B-3UHCc1.js → thread-bindings.manager-B1oySiVc.js} +12 -6
- package/dist/{threading-te5ADPQI.js → threading-OQnL-0Zx.js} +3 -3
- package/dist/{transcripts-source-DkUhR7YK.js → transcripts-source-D8lH7AkN.js} +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-DAwJF5VT.js → typing-C9q0AQMb.js} +1 -1
- package/dist/{voice-runtime-COyYYTDD.js → voice-runtime-Dfhjh1tV.js} +75 -87
- package/package.json +5 -4
- package/dist/provider.runtime-Bo1WbLLr.js +0 -2
- package/dist/targets-DQSye1Rv.js +0 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { s as resolveDefaultDiscordAccountId } from "./accounts-CwJQoLjM.js";
|
|
2
|
-
import { t as discordVoiceTranscriptsSourceProvider } from "./transcripts-source-
|
|
2
|
+
import { t as discordVoiceTranscriptsSourceProvider } from "./transcripts-source-D8lH7AkN.js";
|
|
3
3
|
import { t as inspectDiscordAccount } from "./account-inspect-BY-ve3yH.js";
|
|
4
|
-
import { r as DISCORD_LEGACY_CONFIG_RULES } from "./shared-
|
|
4
|
+
import { r as DISCORD_LEGACY_CONFIG_RULES } from "./shared-BSJWHEMA.js";
|
|
5
5
|
import { n as normalizeCompatibilityConfig } from "./doctor-contract-Co5vRCZ6.js";
|
|
6
6
|
import { t as isDiscordMutableAllowEntry } from "./security-doctor-nGgPm65L.js";
|
|
7
7
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
package/dist/{handle-action.guild-admin-Cc88ZGon.js → handle-action.guild-admin-B0egstYq.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as readDiscordChannelMoveParams, n as isDiscordModerationAction, o as readDiscordChannelCreateParams, r as readDiscordModerationCommand, s as readDiscordChannelEditParams, t as handleDiscordAction } from "./runtime-
|
|
1
|
+
import { c as readDiscordChannelMoveParams, n as isDiscordModerationAction, o as readDiscordChannelCreateParams, r as readDiscordModerationCommand, s as readDiscordChannelEditParams, t as handleDiscordAction } from "./runtime-BbWNtfyq.js";
|
|
2
2
|
import "./action-runtime-api.js";
|
|
3
|
-
import { m as isTrustedRequesterGuildAdminAction } from "./outbound-session-route-
|
|
3
|
+
import { m as isTrustedRequesterGuildAdminAction } from "./outbound-session-route-BFGRF9fE.js";
|
|
4
4
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { readBooleanParam } from "openclaw/plugin-sdk/boolean-param";
|
|
6
6
|
import { readNonNegativeIntegerParam, readPositiveIntegerParam, readStringArrayParam, readStringParam } from "openclaw/plugin-sdk/agent-runtime";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as registerDiscordActivities } from "./activities-api-
|
|
1
|
+
import { t as registerDiscordActivities } from "./activities-api-E-segZn6.js";
|
|
2
2
|
import { registerDiscordSubagentHooks } from "./subagent-hooks-api.js";
|
|
3
3
|
import { registerDiscordTranscriptSourceProvider } from "./transcripts-source-api.js";
|
|
4
4
|
import { defineBundledChannelEntry } from "openclaw/plugin-sdk/channel-entry-contract";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
2
|
-
import { c as resolveDiscordChannelInfoSafe, d as resolveDiscordChannelParentSafe, l as resolveDiscordChannelNameSafe, s as resolveDiscordChannelIdSafe } from "./thread-bindings.manager-
|
|
3
|
-
import { v as mapGatewayDispatchData } from "./provider-
|
|
4
|
-
import { f as resolveDiscordReferencedReplyMessageId, h as resolveDiscordMessageChannelId, i as resolveDiscordMessageText, l as hasDiscordMessageStickers, p as resolveDiscordCdnPolicy } from "./message-text-
|
|
2
|
+
import { c as resolveDiscordChannelInfoSafe, d as resolveDiscordChannelParentSafe, l as resolveDiscordChannelNameSafe, s as resolveDiscordChannelIdSafe } from "./thread-bindings.manager-B1oySiVc.js";
|
|
3
|
+
import { v as mapGatewayDispatchData } from "./provider-DuDtKbF8.js";
|
|
4
|
+
import { f as resolveDiscordReferencedReplyMessageId, h as resolveDiscordMessageChannelId, i as resolveDiscordMessageText, l as hasDiscordMessageStickers, p as resolveDiscordCdnPolicy } from "./message-text-BRVqYm-t.js";
|
|
5
5
|
import { logDebug } from "openclaw/plugin-sdk/logging-core";
|
|
6
6
|
import { GatewayDispatchEvents } from "discord-api-types/v10";
|
|
7
7
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -249,7 +249,7 @@ function applyImplicitReplyBatchGate(ctx, replyToMode, isBatched) {
|
|
|
249
249
|
}
|
|
250
250
|
//#endregion
|
|
251
251
|
//#region extensions/discord/src/monitor/message-run-queue.ts
|
|
252
|
-
const loadMessageProcessRuntime = createLazyRuntimeModule(() => import("./message-handler.process-
|
|
252
|
+
const loadMessageProcessRuntime = createLazyRuntimeModule(() => import("./message-handler.process-BYDjtxZJ.js"));
|
|
253
253
|
async function processDiscordQueuedMessage(params) {
|
|
254
254
|
const abortSignal = params.job.runtime.abortSignal && params.lifecycleSignal ? AbortSignal.any([params.job.runtime.abortSignal, params.lifecycleSignal]) : params.job.runtime.abortSignal ?? params.lifecycleSignal;
|
|
255
255
|
try {
|
|
@@ -336,7 +336,7 @@ function createDiscordMessageRunQueue(params) {
|
|
|
336
336
|
}
|
|
337
337
|
//#endregion
|
|
338
338
|
//#region extensions/discord/src/monitor/message-dispatcher.ts
|
|
339
|
-
const loadMessagePreflightRuntime = createLazyRuntimeModule(() => import("./message-handler.preflight-
|
|
339
|
+
const loadMessagePreflightRuntime = createLazyRuntimeModule(() => import("./message-handler.preflight-Dxi2yBfR.js"));
|
|
340
340
|
function isNonEmptyString(value) {
|
|
341
341
|
return typeof value === "string" && value.length > 0;
|
|
342
342
|
}
|
package/dist/{message-handler.preflight-CoKoE3dY.js → message-handler.preflight-Dxi2yBfR.js}
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { G as Message, Mt as getChannelMessage, b as discord_exports } from "./retry-BNCxiyyR.js";
|
|
2
2
|
import { s as resolveDefaultDiscordAccountId } from "./accounts-CwJQoLjM.js";
|
|
3
3
|
import { C as resolveTimestampMs, S as resolveDiscordSystemLocation, _ as resolveDiscordShouldRequireMention, a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, f as resolveDiscordGuildEntry, i as normalizeDiscordDisplaySlug, p as resolveDiscordMemberAccessState, x as formatDiscordUserTag } from "./allow-list-C2JuH-R0.js";
|
|
4
4
|
import { t as isDiscordThreadChannelType } from "./channel-type-CVLZyGYS.js";
|
|
5
5
|
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-D86uWLt_.js";
|
|
6
|
-
import { a as buildDiscordRoutePeer, c as resolveDiscordEffectiveRoute, f as resolveDiscordRuntimeBindingConversationId, s as resolveDiscordConversationRoute, u as resolveDiscordConversationIdentity } from "./outbound-session-route-
|
|
7
|
-
import { t as resolveDiscordConversationBindingRoute } from "./conversation-binding-route-
|
|
8
|
-
import { c as resolveDiscordChannelInfoSafe, l as resolveDiscordChannelNameSafe } from "./thread-bindings.manager-
|
|
9
|
-
import { S as resolveDiscordTextCommandAccess, _ as handleDiscordDmCommandDecision, n as resolveDiscordPreflightChannelAccess, x as resolveDiscordDmCommandAccess } from "./provider-
|
|
10
|
-
import { d as resolveDiscordReferencedReplyMessage, h as resolveDiscordMessageChannelId, i as resolveDiscordMessageText, m as resolveDiscordChannelInfo, o as resolveForwardedMediaList, r as resolveDiscordMessageHistoryText, s as resolveMediaList, u as resolveDiscordMessageStickers } from "./message-text-
|
|
6
|
+
import { a as buildDiscordRoutePeer, c as resolveDiscordEffectiveRoute, f as resolveDiscordRuntimeBindingConversationId, s as resolveDiscordConversationRoute, u as resolveDiscordConversationIdentity } from "./outbound-session-route-BFGRF9fE.js";
|
|
7
|
+
import { t as resolveDiscordConversationBindingRoute } from "./conversation-binding-route-24afmvEC.js";
|
|
8
|
+
import { c as resolveDiscordChannelInfoSafe, l as resolveDiscordChannelNameSafe } from "./thread-bindings.manager-B1oySiVc.js";
|
|
9
|
+
import { S as resolveDiscordTextCommandAccess, _ as handleDiscordDmCommandDecision, n as resolveDiscordPreflightChannelAccess, x as resolveDiscordDmCommandAccess } from "./provider-DuDtKbF8.js";
|
|
10
|
+
import { d as resolveDiscordReferencedReplyMessage, h as resolveDiscordMessageChannelId, i as resolveDiscordMessageText, m as resolveDiscordChannelInfo, o as resolveForwardedMediaList, r as resolveDiscordMessageHistoryText, s as resolveMediaList, u as resolveDiscordMessageStickers } from "./message-text-BRVqYm-t.js";
|
|
11
11
|
import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-Dt0imZyY.js";
|
|
12
12
|
import { t as createDiscordHistorySenderProvenance } from "./message-handler.history-CJOsN9w5.js";
|
|
13
13
|
import { logDebug } from "openclaw/plugin-sdk/logging-core";
|
|
@@ -29,7 +29,7 @@ import { shouldHandleTextCommands } from "openclaw/plugin-sdk/command-surface";
|
|
|
29
29
|
import { createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
|
|
30
30
|
//#region extensions/discord/src/monitor/message-handler.dm-preflight.ts
|
|
31
31
|
const loadConversationRuntime$1 = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/conversation-binding-runtime"));
|
|
32
|
-
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-
|
|
32
|
+
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-BnTEIeLE.js").then((n) => n.t));
|
|
33
33
|
function resolveDiscordDmPairingSenderId(sender) {
|
|
34
34
|
return sender.isPluralKit ? `pk:${sender.id}` : sender.id;
|
|
35
35
|
}
|
|
@@ -424,13 +424,10 @@ function logDiscordPreflightInboundSummary(params) {
|
|
|
424
424
|
}
|
|
425
425
|
//#endregion
|
|
426
426
|
//#region extensions/discord/src/monitor/message-handler.preflight-runtime.ts
|
|
427
|
-
const loadPluralKitRuntime = createLazyRuntimeModule(() => import("./pluralkit-
|
|
427
|
+
const loadPluralKitRuntime = createLazyRuntimeModule(() => import("./pluralkit-XmmAHoV6.js").then((n) => n.n));
|
|
428
428
|
const loadPreflightAudioRuntime = createLazyRuntimeModule(() => import("./preflight-audio-DrnqFA8U.js"));
|
|
429
|
-
const loadSystemEventsRuntime = createLazyRuntimeModule(() => import("./system-events-
|
|
430
|
-
const loadDiscordThreadingRuntime = createLazyRuntimeModule(() => import("./threading-
|
|
431
|
-
function isPreflightAborted(abortSignal) {
|
|
432
|
-
return Boolean(abortSignal?.aborted);
|
|
433
|
-
}
|
|
429
|
+
const loadSystemEventsRuntime = createLazyRuntimeModule(() => import("./system-events-BOiDS8b3.js"));
|
|
430
|
+
const loadDiscordThreadingRuntime = createLazyRuntimeModule(() => import("./threading-OQnL-0Zx.js").then((n) => n.t));
|
|
434
431
|
//#endregion
|
|
435
432
|
//#region extensions/discord/src/monitor/message-handler.preflight-pluralkit.ts
|
|
436
433
|
async function resolveDiscordPreflightPluralKitInfo(params) {
|
|
@@ -442,7 +439,7 @@ async function resolveDiscordPreflightPluralKitInfo(params) {
|
|
|
442
439
|
config: params.config,
|
|
443
440
|
signal: params.abortSignal
|
|
444
441
|
});
|
|
445
|
-
return
|
|
442
|
+
return params.abortSignal?.aborted ? null : info;
|
|
446
443
|
} catch (err) {
|
|
447
444
|
logVerbose(`discord: pluralkit lookup failed for ${params.message.id}: ${String(err)}`);
|
|
448
445
|
return null;
|
|
@@ -464,7 +461,7 @@ async function resolveDiscordPreflightThreadContext(params) {
|
|
|
464
461
|
threadChannel: earlyThreadChannel,
|
|
465
462
|
channelInfo: params.channelInfo
|
|
466
463
|
});
|
|
467
|
-
if (
|
|
464
|
+
if (params.abortSignal?.aborted) return null;
|
|
468
465
|
return {
|
|
469
466
|
earlyThreadChannel,
|
|
470
467
|
earlyThreadParentId: parentInfo.id,
|
|
@@ -591,7 +588,7 @@ async function recordDiscordPendingHistoryEntry(params) {
|
|
|
591
588
|
limit: params.preflight.historyLimit,
|
|
592
589
|
mediaLimit: DISCORD_HISTORY_MEDIA_MAX_ATTACHMENTS,
|
|
593
590
|
messageId: params.message.id,
|
|
594
|
-
shouldRecord: () => !
|
|
591
|
+
shouldRecord: () => !params.preflight.abortSignal?.aborted,
|
|
595
592
|
media: async () => toHistoryMediaEntries(await resolveDiscordHistoryMediaForPendingRecord({
|
|
596
593
|
preflight: params.preflight,
|
|
597
594
|
message: params.message
|
|
@@ -599,7 +596,7 @@ async function recordDiscordPendingHistoryEntry(params) {
|
|
|
599
596
|
});
|
|
600
597
|
}
|
|
601
598
|
async function preflightDiscordMessage(params) {
|
|
602
|
-
if (
|
|
599
|
+
if (params.abortSignal?.aborted) return null;
|
|
603
600
|
const logger = getChildLogger({ module: "discord-auto-reply" });
|
|
604
601
|
let message = params.data.message;
|
|
605
602
|
const author = params.data.author;
|
|
@@ -621,7 +618,7 @@ async function preflightDiscordMessage(params) {
|
|
|
621
618
|
messageChannelId
|
|
622
619
|
});
|
|
623
620
|
message = hydration.message;
|
|
624
|
-
if (
|
|
621
|
+
if (params.abortSignal?.aborted) return null;
|
|
625
622
|
const pluralkitConfig = params.discordConfig?.pluralkit;
|
|
626
623
|
const webhookId = resolveDiscordWebhookId(message);
|
|
627
624
|
if (isRecentOutboundMessageIdentity({
|
|
@@ -636,7 +633,7 @@ async function preflightDiscordMessage(params) {
|
|
|
636
633
|
}
|
|
637
634
|
const isGuildMessage = Boolean(params.data.guild_id);
|
|
638
635
|
const channelInfo = await resolveDiscordChannelInfo(params.client, messageChannelId);
|
|
639
|
-
if (
|
|
636
|
+
if (params.abortSignal?.aborted) return null;
|
|
640
637
|
const { isDirectMessage, isGroupDm } = resolveDiscordPreflightConversationKind({
|
|
641
638
|
isGuildMessage,
|
|
642
639
|
channelType: channelInfo?.type
|
|
@@ -672,7 +669,7 @@ async function preflightDiscordMessage(params) {
|
|
|
672
669
|
config: pluralkitConfig,
|
|
673
670
|
abortSignal: params.abortSignal
|
|
674
671
|
});
|
|
675
|
-
if (
|
|
672
|
+
if (params.abortSignal?.aborted) return null;
|
|
676
673
|
const sender = resolveDiscordSenderIdentity({
|
|
677
674
|
author,
|
|
678
675
|
member: params.data.member,
|
|
@@ -713,7 +710,7 @@ async function preflightDiscordMessage(params) {
|
|
|
713
710
|
allowNameMatching,
|
|
714
711
|
conversationId: messageChannelId
|
|
715
712
|
});
|
|
716
|
-
if (
|
|
713
|
+
if (params.abortSignal?.aborted) return null;
|
|
717
714
|
if (!access) return null;
|
|
718
715
|
commandAuthorized = access.commandAuthorized;
|
|
719
716
|
channelIngress = access.channelIngress;
|
|
@@ -864,7 +861,7 @@ async function preflightDiscordMessage(params) {
|
|
|
864
861
|
cfg: params.cfg,
|
|
865
862
|
abortSignal: params.abortSignal
|
|
866
863
|
});
|
|
867
|
-
if (
|
|
864
|
+
if (params.abortSignal?.aborted) return null;
|
|
868
865
|
const mentionText = hasTypedText ? baseText : "";
|
|
869
866
|
const { implicitMentionKinds, wasMentioned } = resolveDiscordMentionState({
|
|
870
867
|
authorIsBot: Boolean(author.bot),
|
|
@@ -1059,9 +1056,9 @@ async function preflightDiscordMessage(params) {
|
|
|
1059
1056
|
abortSignal: params.abortSignal
|
|
1060
1057
|
};
|
|
1061
1058
|
const preparedMedia = await resolveMediaList(message, params.mediaMaxBytes, mediaResolveOptions);
|
|
1062
|
-
if (
|
|
1059
|
+
if (params.abortSignal?.aborted) return null;
|
|
1063
1060
|
const forwardedMedia = await resolveForwardedMediaList(message, params.mediaMaxBytes, mediaResolveOptions);
|
|
1064
|
-
if (
|
|
1061
|
+
if (params.abortSignal?.aborted) return null;
|
|
1065
1062
|
preparedMedia.push(...forwardedMedia);
|
|
1066
1063
|
logDebug(`[discord-preflight] success: route=${effectiveRoute.agentId} sessionKey=${effectiveRoute.sessionKey}`);
|
|
1067
1064
|
return buildDiscordMessagePreflightContext({
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { At as editChannelMessage, Ot as deleteChannelMessage, Tt as createChannelMessage, b as discord_exports, o as chunkDiscordTextWithMode, y as resolveDiscordChannelId } from "./retry-BNCxiyyR.js";
|
|
2
2
|
import { p as resolveDiscordMaxLinesPerMessage } from "./accounts-CwJQoLjM.js";
|
|
3
3
|
import { C as resolveTimestampMs, a as normalizeDiscordSlug, r as normalizeDiscordAllowList } from "./allow-list-C2JuH-R0.js";
|
|
4
|
-
import { F as createDiscordRuntimeAccountContext, P as createDiscordRestClient, d as resolveDiscordTargetChannelId, k as resolveDiscordMessageFlags } from "./send.shared-
|
|
5
|
-
import { i as discordTextHasBroadcastMention } from "./send.outbound-
|
|
6
|
-
import { a as removeReactionDiscord, f as editMessageDiscord, r as reactMessageDiscord } from "./send-
|
|
4
|
+
import { F as createDiscordRuntimeAccountContext, P as createDiscordRestClient, d as resolveDiscordTargetChannelId, k as resolveDiscordMessageFlags } from "./send.shared-5vxBTagO.js";
|
|
5
|
+
import { i as discordTextHasBroadcastMention } from "./send.outbound-b5xwHTlL.js";
|
|
6
|
+
import { a as removeReactionDiscord, f as editMessageDiscord, r as reactMessageDiscord } from "./send-BnTEIeLE.js";
|
|
7
7
|
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-D86uWLt_.js";
|
|
8
|
-
import "./targets-
|
|
9
|
-
import { a as buildDiscordRoutePeer, h as discordInboundEventDelivery, u as resolveDiscordConversationIdentity } from "./outbound-session-route-
|
|
10
|
-
import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-
|
|
11
|
-
import { a as formatDiscordReplySkip, c as buildGuildLabel, g as createDiscordSupplementalContextAccessChecker, h as buildDiscordInboundAccessContext, i as formatDiscordReplyDeliveryFailure, l as resolveReplyContext, o as sanitizeDiscordFrontChannelReplyPayloads, r as deliverDiscordReply, s as buildDirectLabel } from "./provider-
|
|
12
|
-
import { a as formatDiscordMediaText, c as resolveReferencedReplyMediaList, i as resolveDiscordMessageText, u as resolveDiscordMessageStickers } from "./message-text-
|
|
13
|
-
import { a as resolveDiscordThreadStarter, n as resolveDiscordAutoThreadReplyPlan } from "./threading-
|
|
8
|
+
import "./targets-DbxVbq8k.js";
|
|
9
|
+
import { a as buildDiscordRoutePeer, h as discordInboundEventDelivery, u as resolveDiscordConversationIdentity } from "./outbound-session-route-BFGRF9fE.js";
|
|
10
|
+
import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-DEhthWTk.js";
|
|
11
|
+
import { a as formatDiscordReplySkip, c as buildGuildLabel, g as createDiscordSupplementalContextAccessChecker, h as buildDiscordInboundAccessContext, i as formatDiscordReplyDeliveryFailure, l as resolveReplyContext, o as sanitizeDiscordFrontChannelReplyPayloads, r as deliverDiscordReply, s as buildDirectLabel } from "./provider-DuDtKbF8.js";
|
|
12
|
+
import { a as formatDiscordMediaText, c as resolveReferencedReplyMediaList, i as resolveDiscordMessageText, u as resolveDiscordMessageStickers } from "./message-text-BRVqYm-t.js";
|
|
13
|
+
import { a as resolveDiscordThreadStarter, n as resolveDiscordAutoThreadReplyPlan } from "./threading-OQnL-0Zx.js";
|
|
14
14
|
import { n as resolveDiscordWebhookId } from "./sender-identity-Dt0imZyY.js";
|
|
15
15
|
import { t as beginDiscordActiveTurnThreadRoute } from "./active-turn-thread-route-fmHl1HNd.js";
|
|
16
16
|
import { n as filterDiscordHistoryEntriesForContext, t as createDiscordHistorySenderProvenance } from "./message-handler.history-CJOsN9w5.js";
|
|
17
|
-
import { t as sendTyping } from "./typing-
|
|
17
|
+
import { t as sendTyping } from "./typing-C9q0AQMb.js";
|
|
18
18
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
19
19
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
20
20
|
import { buildAgentSessionKey, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
|
|
@@ -42,18 +42,15 @@ import { readLatestAssistantTextByIdentity } from "openclaw/plugin-sdk/session-t
|
|
|
42
42
|
//#region extensions/discord/src/monitor/message-handler.retry.ts
|
|
43
43
|
const REPLY_SESSION_INIT_CONFLICT_MESSAGE_RE = /^reply session initialization conflicted for \S+$/u;
|
|
44
44
|
const DISCORD_SESSION_CONFLICT_FAILURE_TEXT = "⚠️ Couldn't process this message because the session stayed busy. Please try again in a moment.";
|
|
45
|
-
function
|
|
45
|
+
async function completeDiscordSessionConflict(error, sourceReplyDeliveryMode, deliver, onDeliveryError) {
|
|
46
46
|
const message = error instanceof Error ? error.message : String(error);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
async function completeDiscordSessionConflict(error, deliver, onDeliveryError) {
|
|
50
|
-
if (!isReplySessionInitConflictError(error)) return false;
|
|
47
|
+
if (!REPLY_SESSION_INIT_CONFLICT_MESSAGE_RE.test(message)) return;
|
|
48
|
+
if (sourceReplyDeliveryMode === "message_tool_only") return "suppressed";
|
|
51
49
|
try {
|
|
52
|
-
await deliver({
|
|
50
|
+
return (await deliver({
|
|
53
51
|
text: DISCORD_SESSION_CONFLICT_FAILURE_TEXT,
|
|
54
52
|
isError: true
|
|
55
|
-
}, { kind: "final" });
|
|
56
|
-
return true;
|
|
53
|
+
}, { kind: "final" })).visibleReplySent ? "delivered" : "suppressed";
|
|
57
54
|
} catch (deliveryError) {
|
|
58
55
|
onDeliveryError(deliveryError, { kind: "final" });
|
|
59
56
|
throw new Error(`discord: reply session init conflict exhausted and terminal notice failed: ${String(deliveryError)}`, { cause: deliveryError });
|
|
@@ -74,9 +71,6 @@ function normalizeDiscordDmOwnerEntry(entry) {
|
|
|
74
71
|
])?.ids.values().next().value;
|
|
75
72
|
return typeof candidate === "string" && /^\d+$/.test(candidate) ? candidate : void 0;
|
|
76
73
|
}
|
|
77
|
-
function isContextAborted(abortSignal) {
|
|
78
|
-
return Boolean(abortSignal?.aborted);
|
|
79
|
-
}
|
|
80
74
|
async function buildDiscordMessageProcessContext(params) {
|
|
81
75
|
const { ctx, text, mediaList } = params;
|
|
82
76
|
const { cfg, discordConfig, accountId, runtime, botUserId, mediaMaxBytes, discordRestFetch, abortSignal, guildHistories, historyLimit, replyToMode, message, author, sender, canonicalMessageId, data, client, channelInfo, channelName, messageChannelId, isGuildMessage, isDirectMessage, isGroupDm, baseText, preflightAudioTranscript, threadChannel, threadParentId, threadParentName, threadParentType, threadName, displayChannelSlug, guildInfo, guildSlug, memberRoleIds, channelConfig, baseSessionKey, boundSessionKey, route, commandAuthorized, hasControlCommand, resolveChannelIngress } = ctx;
|
|
@@ -383,7 +377,7 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
383
377
|
totalTimeoutMs: DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS,
|
|
384
378
|
abortSignal
|
|
385
379
|
});
|
|
386
|
-
return
|
|
380
|
+
return abortSignal?.aborted ? [] : await toInboundMediaFactsWithMetadata(referencedReplyMediaList, { messageId: replyContext.id });
|
|
387
381
|
}
|
|
388
382
|
} : void 0,
|
|
389
383
|
thread: {
|
|
@@ -461,9 +455,6 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
461
455
|
}
|
|
462
456
|
//#endregion
|
|
463
457
|
//#region extensions/discord/src/monitor/message-handler.process-progress.ts
|
|
464
|
-
function isProcessAborted$1(abortSignal) {
|
|
465
|
-
return Boolean(abortSignal?.aborted);
|
|
466
|
-
}
|
|
467
458
|
function isFailedProgress(payload) {
|
|
468
459
|
return payload.phase === "error" || payload.status === "failed" || payload.status === "error" || typeof payload.exitCode === "number" && payload.exitCode !== 0;
|
|
469
460
|
}
|
|
@@ -516,7 +507,7 @@ function createDiscordMessageProgressRuntime(params) {
|
|
|
516
507
|
shouldYieldDraftCommentary = isActive;
|
|
517
508
|
},
|
|
518
509
|
onNarrationUpdate: draftPreview.narrationProgressEnabled ? async (payload) => {
|
|
519
|
-
if (
|
|
510
|
+
if (abortSignal?.aborted || shouldYieldDraftCommentary()) return;
|
|
520
511
|
await draftPreview.pushNarrationProgress(payload.text);
|
|
521
512
|
} : void 0,
|
|
522
513
|
onProgressNarratorLifecycle: draftPreview.narrationProgressEnabled ? (lifecycle) => draftPreview.setProgressNarratorLifecycle(lifecycle) : void 0,
|
|
@@ -529,7 +520,7 @@ function createDiscordMessageProgressRuntime(params) {
|
|
|
529
520
|
},
|
|
530
521
|
streamReasoningInNonStreamModes: reasoningWindowEnabled,
|
|
531
522
|
onToolStart: async (payload) => {
|
|
532
|
-
if (
|
|
523
|
+
if (abortSignal?.aborted) return false;
|
|
533
524
|
await params.reactions.maybeBindToToolReaction(payload);
|
|
534
525
|
await params.reactions.controller.setTool(payload.name);
|
|
535
526
|
return await draftPreview.pushToolEvent(payload);
|
|
@@ -557,11 +548,11 @@ function createDiscordMessageProgressRuntime(params) {
|
|
|
557
548
|
return await draftPreview.pushPatchEvent(payload);
|
|
558
549
|
},
|
|
559
550
|
onCompactionStart: async () => {
|
|
560
|
-
if (!
|
|
551
|
+
if (!abortSignal?.aborted) await params.reactions.controller.setCompacting();
|
|
561
552
|
return false;
|
|
562
553
|
},
|
|
563
554
|
onCompactionEnd: async () => {
|
|
564
|
-
if (!
|
|
555
|
+
if (!abortSignal?.aborted) {
|
|
565
556
|
params.reactions.controller.cancelPending();
|
|
566
557
|
await params.reactions.controller.setThinking();
|
|
567
558
|
}
|
|
@@ -1402,9 +1393,6 @@ function createDiscordMessageActiveThreadRoute(params) {
|
|
|
1402
1393
|
//#endregion
|
|
1403
1394
|
//#region extensions/discord/src/monitor/message-handler.process.ts
|
|
1404
1395
|
const TARGETED_ONLY_ALLOWED_MENTIONS = { parse: ["users", "roles"] };
|
|
1405
|
-
function isProcessAborted(abortSignal) {
|
|
1406
|
-
return Boolean(abortSignal?.aborted);
|
|
1407
|
-
}
|
|
1408
1396
|
function isFallbackOnlyToolWarningFinal(payload) {
|
|
1409
1397
|
if (payload.isError !== true || !isReplyPayloadNonTerminalToolErrorWarning(payload)) return false;
|
|
1410
1398
|
return !resolveSendableOutboundReplyParts(payload).hasMedia;
|
|
@@ -1415,7 +1403,7 @@ async function processDiscordMessage(ctx, observer) {
|
|
|
1415
1403
|
async function processDiscordMessageInner(ctx, observer) {
|
|
1416
1404
|
const dispatchStartedAt = Date.now();
|
|
1417
1405
|
const { cfg, accountId, token, runtime, textLimit, replyToMode, message, messageChannelId, isGuildMessage, isDirectMessage, isGroupDm, messageText, threadBindings, route, abortSignal, turnAdoptionLifecycle, preparedMedia: mediaList } = ctx;
|
|
1418
|
-
if (
|
|
1406
|
+
if (abortSignal?.aborted) return;
|
|
1419
1407
|
const text = messageText;
|
|
1420
1408
|
if (!text && mediaList.length === 0) {
|
|
1421
1409
|
logVerbose("discord: drop message " + message.id + " (empty content)");
|
|
@@ -1518,7 +1506,7 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1518
1506
|
});
|
|
1519
1507
|
let replyLifecycleStarted = false;
|
|
1520
1508
|
const onDiscordReplyStart = async () => {
|
|
1521
|
-
if (
|
|
1509
|
+
if (abortSignal?.aborted) return;
|
|
1522
1510
|
replyLifecycleStarted = true;
|
|
1523
1511
|
await replyPipeline.typingCallbacks?.onReplyStart();
|
|
1524
1512
|
await reactions.controller.setThinking();
|
|
@@ -1531,7 +1519,7 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1531
1519
|
isFallbackOnlyToolWarningFinal
|
|
1532
1520
|
});
|
|
1533
1521
|
const deliverDiscordPayload = async (payload, info, options) => {
|
|
1534
|
-
if (
|
|
1522
|
+
if (abortSignal?.aborted) {
|
|
1535
1523
|
logVerbose(formatDiscordReplySkip({
|
|
1536
1524
|
kind: info.kind,
|
|
1537
1525
|
reason: "aborted before delivery",
|
|
@@ -1631,7 +1619,7 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1631
1619
|
},
|
|
1632
1620
|
buildFinalEdit: () => {},
|
|
1633
1621
|
editFinal: async (previewMessageId, edit) => {
|
|
1634
|
-
if (
|
|
1622
|
+
if (abortSignal?.aborted) throw new Error("process aborted");
|
|
1635
1623
|
notifyFinalReplyStart();
|
|
1636
1624
|
await editMessageDiscord(deliverChannelId, previewMessageId, edit, {
|
|
1637
1625
|
cfg,
|
|
@@ -1649,7 +1637,7 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1649
1637
|
}
|
|
1650
1638
|
}),
|
|
1651
1639
|
deliverNormally: async () => {
|
|
1652
|
-
if (
|
|
1640
|
+
if (abortSignal?.aborted) return false;
|
|
1653
1641
|
const fallbackPayload = ttsSupplement && ttsSupplement.visibleTextAlreadyDelivered !== true && !deliverablePayload.text?.trim() ? {
|
|
1654
1642
|
...deliverablePayload,
|
|
1655
1643
|
text: ttsSupplement.spokenText
|
|
@@ -1687,7 +1675,7 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1687
1675
|
}
|
|
1688
1676
|
})).kind !== "normal-skipped") return { visibleReplySent: true };
|
|
1689
1677
|
}
|
|
1690
|
-
if (
|
|
1678
|
+
if (abortSignal?.aborted) {
|
|
1691
1679
|
logVerbose(formatDiscordReplySkip({
|
|
1692
1680
|
kind: info.kind,
|
|
1693
1681
|
reason: "aborted before delivery",
|
|
@@ -1746,7 +1734,7 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1746
1734
|
let dispatchError = false;
|
|
1747
1735
|
let dispatchAborted = false;
|
|
1748
1736
|
const deliverPendingToolWarningFinalIfNeeded = async () => {
|
|
1749
|
-
if (!pendingToolWarningFinal || userFacingFinalDelivered ||
|
|
1737
|
+
if (!pendingToolWarningFinal || userFacingFinalDelivered || abortSignal?.aborted) return;
|
|
1750
1738
|
const pending = pendingToolWarningFinal;
|
|
1751
1739
|
pendingToolWarningFinal = void 0;
|
|
1752
1740
|
try {
|
|
@@ -1758,7 +1746,7 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1758
1746
|
}
|
|
1759
1747
|
};
|
|
1760
1748
|
try {
|
|
1761
|
-
if (
|
|
1749
|
+
if (abortSignal?.aborted) {
|
|
1762
1750
|
dispatchAborted = true;
|
|
1763
1751
|
return;
|
|
1764
1752
|
}
|
|
@@ -1817,7 +1805,7 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1817
1805
|
});
|
|
1818
1806
|
if (!preparedResult.dispatched) return;
|
|
1819
1807
|
dispatchResult = preparedResult.dispatchResult;
|
|
1820
|
-
if (
|
|
1808
|
+
if (abortSignal?.aborted) {
|
|
1821
1809
|
dispatchAborted = true;
|
|
1822
1810
|
return;
|
|
1823
1811
|
}
|
|
@@ -1831,16 +1819,20 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1831
1819
|
markFinalReplyDelivered();
|
|
1832
1820
|
}
|
|
1833
1821
|
} catch (err) {
|
|
1834
|
-
if (
|
|
1822
|
+
if (abortSignal?.aborted) {
|
|
1835
1823
|
dispatchAborted = true;
|
|
1836
1824
|
return;
|
|
1837
1825
|
}
|
|
1838
1826
|
dispatchError = true;
|
|
1839
|
-
|
|
1827
|
+
const conflictOutcome = await completeDiscordSessionConflict(err, sourceReplyDeliveryMode, (payload, info) => deliverDiscordPayload(payload, {
|
|
1840
1828
|
...info,
|
|
1841
1829
|
onPlatformSendDispatch: () => Promise.resolve(),
|
|
1842
1830
|
assertPlatformSendAuthorized: () => void 0
|
|
1843
|
-
}), onDiscordDeliveryError)
|
|
1831
|
+
}), onDiscordDeliveryError);
|
|
1832
|
+
if (conflictOutcome) {
|
|
1833
|
+
runtime.error(`discord: reply session init conflict exhausted; terminal notice ${conflictOutcome} (sourceReplyDeliveryMode=${sourceReplyDeliveryMode}, message=${message.id}, session=${persistedSessionKey})`);
|
|
1834
|
+
return;
|
|
1835
|
+
}
|
|
1844
1836
|
throw err;
|
|
1845
1837
|
} finally {
|
|
1846
1838
|
activeThreadRoute.end();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as resolveDiscordChannelInfoSafe } from "./thread-bindings.manager-
|
|
1
|
+
import { c as resolveDiscordChannelInfoSafe } from "./thread-bindings.manager-B1oySiVc.js";
|
|
2
2
|
import { ComponentType, StickerFormatType } from "discord-api-types/v10";
|
|
3
3
|
import { asDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
|
|
4
4
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as normalizeDiscordOutboundTarget, c as createDiscordSendReceiptFromResults, i as hasDiscordMessageCreateAmbiguity, o as chunkDiscordTextWithMode, p as resolveDiscordReplyReference, s as createDiscordSendReceipt, t as canFallbackDiscordWebhookSend, u as toDiscordOutboundDeliveryResult } from "./retry-BNCxiyyR.js";
|
|
2
2
|
import { t as createDiscordActionGate } from "./accounts-CwJQoLjM.js";
|
|
3
|
-
import { g as notifyDiscordInboundEventOutboundPayloadSuccess, h as discordInboundEventDelivery, r as formatDiscordApprovalDisplayValue } from "./outbound-session-route-
|
|
4
|
-
import { a as sendDiscordComponentMessageLazy, i as resolveDiscordComponentSpec, n as buildDiscordPresentationPayload, t as DISCORD_PRESENTATION_CAPABILITIES } from "./outbound-components-
|
|
3
|
+
import { g as notifyDiscordInboundEventOutboundPayloadSuccess, h as discordInboundEventDelivery, r as formatDiscordApprovalDisplayValue } from "./outbound-session-route-BFGRF9fE.js";
|
|
4
|
+
import { a as sendDiscordComponentMessageLazy, i as resolveDiscordComponentSpec, n as buildDiscordPresentationPayload, t as DISCORD_PRESENTATION_CAPABILITIES } from "./outbound-components-DehyxvA4.js";
|
|
5
5
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
6
6
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { getReplyPayloadTtsSupplement, resolvePayloadMediaUrls, sendPayloadMediaSequenceOrFallback, sendTextMediaPayload } from "openclaw/plugin-sdk/reply-payload";
|
|
@@ -60,7 +60,7 @@ function normalizeDiscordApprovalPayload(payload) {
|
|
|
60
60
|
}
|
|
61
61
|
//#endregion
|
|
62
62
|
//#region extensions/discord/src/outbound-send-context.ts
|
|
63
|
-
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-
|
|
63
|
+
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-BnTEIeLE.js").then((n) => n.t));
|
|
64
64
|
function resolveDiscordOutboundTarget(params) {
|
|
65
65
|
if (params.threadId == null) return params.to;
|
|
66
66
|
const threadId = normalizeOptionalStringifiedId(params.threadId) ?? "";
|
|
@@ -108,7 +108,7 @@ function createDiscordUnknownPayloadResult(target) {
|
|
|
108
108
|
})
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
|
-
function resolveDiscordDeliveryOptions(ctx, sendContext, reply = sendContext.resolveReply()) {
|
|
111
|
+
function resolveDiscordDeliveryOptions$1(ctx, sendContext, reply = sendContext.resolveReply()) {
|
|
112
112
|
return {
|
|
113
113
|
reply,
|
|
114
114
|
accountId: ctx.accountId ?? void 0,
|
|
@@ -120,7 +120,7 @@ function resolveDiscordDeliveryOptions(ctx, sendContext, reply = sendContext.res
|
|
|
120
120
|
}
|
|
121
121
|
function resolveDiscordFormattedDeliveryOptions(ctx, sendContext, reply = sendContext.resolveReply()) {
|
|
122
122
|
return {
|
|
123
|
-
...resolveDiscordDeliveryOptions(ctx, sendContext, reply),
|
|
123
|
+
...resolveDiscordDeliveryOptions$1(ctx, sendContext, reply),
|
|
124
124
|
...sendContext.formatting
|
|
125
125
|
};
|
|
126
126
|
}
|
|
@@ -177,7 +177,7 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
177
177
|
try {
|
|
178
178
|
const voiceUrl = expectDefined(mediaUrls.at(0), "non-empty Discord voice media URLs");
|
|
179
179
|
lastResult = await sendContext.sendVoice(sendContext.target, voiceUrl, {
|
|
180
|
-
...resolveDiscordDeliveryOptions(ctx, sendContext, voiceReply),
|
|
180
|
+
...resolveDiscordDeliveryOptions$1(ctx, sendContext, voiceReply),
|
|
181
181
|
mediaAccess: ctx.mediaAccess,
|
|
182
182
|
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
183
183
|
mediaReadFile: ctx.mediaReadFile
|
|
@@ -280,29 +280,22 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
280
280
|
//#region extensions/discord/src/outbound-adapter.ts
|
|
281
281
|
const DISCORD_TEXT_CHUNK_LIMIT = 2e3;
|
|
282
282
|
const log = createSubsystemLogger("discord/outbound");
|
|
283
|
-
const loadDiscordThreadBindings = createLazyRuntimeModule(() => import("./thread-bindings-
|
|
284
|
-
const loadDiscordComponentSendRuntime = createLazyRuntimeModule(() => import("./send.components-
|
|
285
|
-
function
|
|
286
|
-
const usernameRaw = normalizeOptionalString(params.identity?.name);
|
|
287
|
-
const fallbackUsername = normalizeOptionalString(params.binding.label) ?? params.binding.agentId;
|
|
283
|
+
const loadDiscordThreadBindings = createLazyRuntimeModule(() => import("./thread-bindings-D7mcaXQC.js").then((n) => n.t));
|
|
284
|
+
const loadDiscordComponentSendRuntime = createLazyRuntimeModule(() => import("./send.components-BWVEcjRP.js").then((n) => n.i));
|
|
285
|
+
function resolveDiscordDeliveryOptions(params) {
|
|
288
286
|
return {
|
|
289
|
-
|
|
290
|
-
|
|
287
|
+
onPlatformSendDispatch: params.onPlatformSendDispatch,
|
|
288
|
+
assertPlatformSendAuthorized: params.assertDirectAdapterHandoff,
|
|
289
|
+
onDeliveryResult: params.onDeliveryResult ? async (result) => params.onDeliveryResult?.(attachChannelToResult("discord", toDiscordOutboundDeliveryResult(result))) : void 0
|
|
291
290
|
};
|
|
292
291
|
}
|
|
293
292
|
async function maybeSendDiscordWebhookText(params) {
|
|
294
|
-
if (params.threadId == null) return null;
|
|
295
293
|
const threadId = normalizeOptionalStringifiedId(params.threadId) ?? "";
|
|
296
294
|
if (!threadId) return null;
|
|
297
295
|
const { getThreadBindingManager } = await loadDiscordThreadBindings();
|
|
298
|
-
const
|
|
299
|
-
if (!manager) return null;
|
|
300
|
-
const binding = manager.getByThreadId(threadId);
|
|
296
|
+
const binding = getThreadBindingManager(params.accountId ?? void 0)?.getByThreadId(threadId);
|
|
301
297
|
if (!binding?.webhookId || !binding?.webhookToken) return null;
|
|
302
|
-
const
|
|
303
|
-
identity: params.identity,
|
|
304
|
-
binding
|
|
305
|
-
});
|
|
298
|
+
const username = normalizeOptionalString(params.identity?.name) || normalizeOptionalString(binding.label) || binding.agentId || "";
|
|
306
299
|
const { sendWebhookMessageDiscord } = await loadDiscordSendRuntime();
|
|
307
300
|
return await sendWebhookMessageDiscord(params.text, {
|
|
308
301
|
webhookId: binding.webhookId,
|
|
@@ -311,10 +304,9 @@ async function maybeSendDiscordWebhookText(params) {
|
|
|
311
304
|
threadId: binding.threadId,
|
|
312
305
|
cfg: params.cfg,
|
|
313
306
|
replyTo: params.replyToId ?? void 0,
|
|
314
|
-
username:
|
|
315
|
-
avatarUrl:
|
|
316
|
-
|
|
317
|
-
assertPlatformSendAuthorized: params.assertPlatformSendAuthorized
|
|
307
|
+
username: truncateUtf16Safe(username, 80) || void 0,
|
|
308
|
+
avatarUrl: normalizeOptionalString(params.identity?.avatarUrl),
|
|
309
|
+
...resolveDiscordDeliveryOptions(params)
|
|
318
310
|
});
|
|
319
311
|
}
|
|
320
312
|
async function resolveDiscordOutboundMessageSend(params) {
|
|
@@ -337,11 +329,7 @@ async function resolveDiscordOutboundMessageSend(params) {
|
|
|
337
329
|
silent: params.silent ?? void 0,
|
|
338
330
|
cfg: params.cfg,
|
|
339
331
|
...resolveDiscordFormattingOptions({ formatting: params.formatting }),
|
|
340
|
-
|
|
341
|
-
await params.onDeliveryResult?.(attachChannelToResult("discord", toDiscordOutboundDeliveryResult(result)));
|
|
342
|
-
} : void 0,
|
|
343
|
-
onPlatformSendDispatch: params.onPlatformSendDispatch,
|
|
344
|
-
assertPlatformSendAuthorized: params.assertDirectAdapterHandoff
|
|
332
|
+
...resolveDiscordDeliveryOptions(params)
|
|
345
333
|
}
|
|
346
334
|
};
|
|
347
335
|
}
|
|
@@ -379,27 +367,12 @@ const discordOutbound = {
|
|
|
379
367
|
...createAttachedChannelResultAdapter({
|
|
380
368
|
channel: "discord",
|
|
381
369
|
sendText: async (ctx) => {
|
|
382
|
-
if (!ctx.silent) {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
threadId: ctx.threadId,
|
|
389
|
-
accountId: ctx.accountId,
|
|
390
|
-
identity: ctx.identity,
|
|
391
|
-
replyToId: ctx.replyToId,
|
|
392
|
-
onPlatformSendDispatch: ctx.onPlatformSendDispatch ? async () => {
|
|
393
|
-
webhookSelected = true;
|
|
394
|
-
await ctx.onPlatformSendDispatch?.();
|
|
395
|
-
} : void 0,
|
|
396
|
-
assertPlatformSendAuthorized: ctx.assertDirectAdapterHandoff
|
|
397
|
-
});
|
|
398
|
-
if (webhookResult) return toDiscordOutboundDeliveryResult(webhookResult);
|
|
399
|
-
} catch (error) {
|
|
400
|
-
if (webhookSelected) throw error;
|
|
401
|
-
log.warn("discord webhook persona send failed; falling back to bot send", { error });
|
|
402
|
-
}
|
|
370
|
+
if (!ctx.silent) try {
|
|
371
|
+
const webhookResult = await maybeSendDiscordWebhookText(ctx);
|
|
372
|
+
if (webhookResult) return toDiscordOutboundDeliveryResult(webhookResult);
|
|
373
|
+
} catch (error) {
|
|
374
|
+
if (!canFallbackDiscordWebhookSend(error)) throw error;
|
|
375
|
+
log.warn("discord webhook persona send failed; falling back to bot send", { error });
|
|
403
376
|
}
|
|
404
377
|
const { send, target, options } = await resolveDiscordOutboundMessageSend(ctx);
|
|
405
378
|
return toDiscordOutboundDeliveryResult(await send(target, ctx.text, options));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as readDiscordComponentSpec } from "./components-
|
|
1
|
+
import { h as readDiscordComponentSpec } from "./components-DmXYIQ26.js";
|
|
2
2
|
import { resolveAskUserQuestionOptionIndices } from "openclaw/plugin-sdk/reply-payload";
|
|
3
3
|
import { createLazyRuntimeModule, createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
|
|
4
4
|
//#region extensions/discord/src/outbound-components.ts
|
|
@@ -31,11 +31,11 @@ const DISCORD_PRESENTATION_CAPABILITIES = {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
-
const loadDiscordComponentSend = createLazyRuntimeNamedExport(() => import("./send.components-
|
|
34
|
+
const loadDiscordComponentSend = createLazyRuntimeNamedExport(() => import("./send.components-BWVEcjRP.js").then((n) => n.i), "sendDiscordComponentMessage");
|
|
35
35
|
async function sendDiscordComponentMessageLazy(...args) {
|
|
36
36
|
return await (await loadDiscordComponentSend())(...args);
|
|
37
37
|
}
|
|
38
|
-
const loadDiscordSharedInteractive = createLazyRuntimeModule(() => import("./components-
|
|
38
|
+
const loadDiscordSharedInteractive = createLazyRuntimeModule(() => import("./components-DmXYIQ26.js").then((n) => n.a));
|
|
39
39
|
function addPayloadTextFallback(spec, payload) {
|
|
40
40
|
return spec.text ? spec : {
|
|
41
41
|
...spec,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { h as readDiscordComponentSpec, m as coerceDiscordComponentParam } from "./components-
|
|
1
|
+
import { g as normalizeDiscordMessagingTarget, v as parseDiscordTarget } from "./retry-BNCxiyyR.js";
|
|
2
|
+
import { h as readDiscordComponentSpec, m as coerceDiscordComponentParam } from "./components-DmXYIQ26.js";
|
|
3
3
|
import { c as resolveDiscordAccount, r as listDiscordAccountIds, t as createDiscordActionGate } from "./accounts-CwJQoLjM.js";
|
|
4
4
|
import { t as inspectDiscordAccount } from "./account-inspect-BY-ve3yH.js";
|
|
5
5
|
import { ChannelType } from "discord-api-types/v10";
|
|
@@ -265,7 +265,7 @@ function matchesCurrentDiscordThread(params) {
|
|
|
265
265
|
if (!requestedTarget) return false;
|
|
266
266
|
return [params.toolContext.currentChannelId, params.toolContext.currentMessagingTarget].some((currentTarget) => currentTarget !== void 0 && normalizeDiscordMessagingTarget(currentTarget) === requestedTarget);
|
|
267
267
|
}
|
|
268
|
-
const loadDiscordChannelActionsRuntime = createLazyRuntimeModule(() => import("./channel-actions.runtime-
|
|
268
|
+
const loadDiscordChannelActionsRuntime = createLazyRuntimeModule(() => import("./channel-actions.runtime-DMFv4doE.js"));
|
|
269
269
|
function listDiscoverableDiscordAccounts(cfg) {
|
|
270
270
|
return listDiscordAccountIds(cfg).map((accountId) => inspectDiscordAccount({
|
|
271
271
|
cfg,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { sn as __exportAll } from "./retry-BNCxiyyR.js";
|
|
2
2
|
import { readProviderJsonObjectResponse, readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
|
|
3
3
|
import { resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
4
4
|
import { buildTimeoutAbortSignal } from "openclaw/plugin-sdk/extension-shared";
|