@openclaw/discord 2026.5.7 → 2026.5.9-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{access-CHY9FK3X.js → access-Lk7H_e7y.js} +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/{allow-list-ek-1hMKN.js → allow-list-Dtho5Hww.js} +1 -1
- package/dist/api.js +19 -17
- package/dist/{approval-handler.runtime-BBZRYAGs.js → approval-handler.runtime-CqvKEAqO.js} +3 -3
- package/dist/{approval-native-CBdZsAR7.js → approval-native-W5mtrjYy.js} +2 -2
- package/dist/{approval-shared-Ck6TxKgo.js → approval-shared-D0FVj8b_.js} +1 -1
- package/dist/{audit-CCJ0h49k.js → audit-CrCPCVFG.js} +3 -3
- package/dist/{channel-UXGa9PGc.js → channel-CRTWY5R-.js} +53 -31
- package/dist/{channel-actions-Br29_1nE.js → channel-actions-BRgtLo8F.js} +27 -1
- package/dist/{channel-actions.runtime-ChmNUig1.js → channel-actions.runtime-gosyu06g.js} +5 -5
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-D_xyQu_h.js → channel.setup-BQlXR1Gt.js} +3 -3
- package/dist/chunk-BDgKaWaV.js +179 -0
- package/dist/{components-D5LnN7ZQ.js → components-BWdIitIb.js} +2 -2
- package/dist/{config-schema-Cc953rAs.js → config-schema-D1DUqXws.js} +46 -1
- package/dist/contract-api.js +7 -7
- package/dist/{conversation-identity-DHhS0ez3.js → conversation-identity-6hcTVj3L.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-DJ0V5asB.js → directory-live-D3kbmVAu.js} +3 -3
- package/dist/{discord-eZlimVfW.js → discord-Du6FnKAq.js} +30 -13
- package/dist/{doctor-Bo-yifB3.js → doctor-Ys2-q5bc.js} +3 -3
- package/dist/{doctor-contract-Bso46EOQ.js → doctor-contract-DSB2zzJA.js} +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{handle-action.guild-admin-sJiQymg8.js → handle-action.guild-admin-LM6kZ6zE.js} +6 -3
- package/dist/{inbound-context-CRylwjg0.js → inbound-context-BobVUBqo.js} +1 -1
- package/dist/{manager.runtime-Cug1PoeZ.js → manager.runtime-C_cPd048.js} +802 -134
- package/dist/{mentions-BPZUaFk7.js → mentions-CiPUID82.js} +1 -1
- package/dist/{message-handler-C9Ohf-ea.js → message-handler-C2ZQV7ZQ.js} +7 -7
- package/dist/{message-handler.preflight-BrvazsYn.js → message-handler.preflight-B5hN7RpX.js} +15 -15
- package/dist/{message-handler.process-CEnzuLiN.js → message-handler.process-Dns8D7t2.js} +82 -65
- package/dist/{message-utils-9kaGF59d.js → message-utils-B3uf0_3D.js} +2 -2
- package/dist/normalize-DBcng6RL.js +58 -0
- package/dist/{outbound-adapter-DNsTVJfH.js → outbound-adapter-jP0OgIyW.js} +78 -17
- package/dist/{outbound-session-route-DK9qkPgP.js → outbound-session-route-BaJRt05p.js} +1 -1
- package/dist/{preflight-audio-CRmUxxuM.js → preflight-audio-6J0vFNtu.js} +1 -1
- package/dist/{preview-streaming-Cc_oeIPP.js → preview-streaming-CXrFDP2T.js} +1 -0
- package/dist/{probe-E80IMT1X.js → probe-91lU5eh8.js} +1 -1
- package/dist/{probe.runtime-CMgUDax3.js → probe.runtime-DV37RDCU.js} +1 -1
- package/dist/{provider-CuOh6z_b.js → provider-D_QVXvp8.js} +53 -50
- package/dist/{provider-session.runtime-CCESIHVo.js → provider-session.runtime-CcPDguh6.js} +3 -3
- package/dist/provider.runtime-O7G03kik.js +2 -0
- package/dist/{reply-delivery-D9aKHtDH.js → reply-delivery-DKTZ6HkK.js} +10 -7
- package/dist/{resolve-allowlist-common-_e1cWOb3.js → resolve-allowlist-common-LhuVITjh.js} +2 -2
- package/dist/{resolve-channels-kyuvrXJg.js → resolve-channels-DjpVRJdT.js} +3 -3
- package/dist/{resolve-users-CAwh4EBq.js → resolve-users-DrZYxZSX.js} +2 -2
- package/dist/{route-resolution-BWErj5Cn.js → route-resolution-CYRPDKY4.js} +3 -3
- package/dist/{runtime-D8alY00g.js → runtime-BHAwVXEa.js} +7 -7
- package/dist/runtime-api.actions.js +2 -2
- package/dist/runtime-api.js +25 -25
- package/dist/runtime-api.lookup.js +6 -6
- package/dist/runtime-api.monitor--iuvLjPX.js +6 -0
- package/dist/runtime-api.monitor.js +7 -7
- package/dist/runtime-api.send.js +5 -5
- package/dist/runtime-api.threads.js +5 -5
- package/dist/runtime-setter-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/{security-audit-BtRd_VhN.js → security-audit-D8IaFuCm.js} +1 -1
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/{security-audit.runtime-Dm1LW9KX.js → security-audit.runtime-DO1398sV.js} +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/{send-8S_HKJpQ.js → send-C3peGbWO.js} +83 -56
- package/dist/{send.components-A42c_5tQ.js → send.components-Dsk3IzS_.js} +22 -14
- package/dist/{send.outbound-D3tonSz8.js → send.outbound-CXyInQ3c.js} +22 -11
- package/dist/send.receipt-DXimpUGs.js +35 -0
- package/dist/{send.shared-BQGiUPvZ.js → send.shared-BydEWvYg.js} +26 -7
- package/dist/{sender-identity-BGUfyvOC.js → sender-identity-DVJCrDxs.js} +1 -1
- package/dist/session-key-api.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-BEW4H3bj.js → shared-BWD6uc0p.js} +8 -8
- package/dist/{shared-interactive-KgJjCqnB.js → shared-interactive-BZCU0ZJ8.js} +2 -2
- package/dist/{subagent-hooks-T0LPLh4H.js → subagent-hooks-DtbWOdAK.js} +1 -1
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{system-events-_fzSG--3.js → system-events-Dsc8MFYs.js} +2 -2
- package/dist/target-parsing-D-H7nnh2.js +51 -0
- package/dist/target-resolver-D7t8FMhO.js +85 -0
- package/dist/targets-DzAZIwg4.js +3 -0
- package/dist/test-api.js +4 -4
- package/dist/{thread-bindings-CMpZjP50.js → thread-bindings-B90pBWJg.js} +6 -6
- package/dist/{thread-bindings.discord-api-CwWGoyei.js → thread-bindings.discord-api-Dvf789Je.js} +7 -7
- package/dist/{thread-bindings.manager-BtxfLfWf.js → thread-bindings.manager-AwZ5Vble.js} +5 -5
- package/dist/{thread-bindings.session-updates-jcZSiRPI.js → thread-bindings.session-updates-B_AcsXSf.js} +1 -1
- package/dist/{threading-BMmpA2JR.js → threading-Dku_cGS8.js} +4 -4
- package/dist/timeouts.js +1 -1
- package/dist/{typing-Bw6NKWLZ.js → typing-BIjMmOZB.js} +2 -2
- package/openclaw.plugin.json +222 -1
- package/package.json +5 -5
- package/dist/provider.runtime-B68g3qLv.js +0 -2
- package/dist/runtime-api.monitor-DzkCxeBL.js +0 -6
- package/dist/target-resolver-DA84_xbt.js +0 -365
- package/dist/targets-FwL1BPTU.js +0 -2
- /package/dist/{agent-components.runtime-Dof1YMSz.js → agent-components.runtime-caj0h9y4.js} +0 -0
- /package/dist/{api-DzNBVTto.js → api-DaTujGTe.js} +0 -0
- /package/dist/{audit-core-CejGc3hO.js → audit-core-CIvZE94W.js} +0 -0
- /package/dist/{channel-access-DFIQqbYm.js → channel-access-CXAdcM95.js} +0 -0
- /package/dist/{directory-cache-D93eSrpB.js → directory-cache-D3l2v2_L.js} +0 -0
- /package/dist/{directory-config-DoETeOOx.js → directory-config-S2852QcC.js} +0 -0
- /package/dist/{doctor-shared-Cqvfgv9m.js → doctor-shared-DtOaqWzy.js} +0 -0
- /package/dist/{format-D8TsaXxW.js → format-XDPCvGK4.js} +0 -0
- /package/dist/{pluralkit-OFss_pIy.js → pluralkit-EXKKni07.js} +0 -0
- /package/dist/{preflight-audio.runtime-DPVbpZid.js → preflight-audio.runtime-3hiRefuj.js} +0 -0
- /package/dist/{runtime-K9RT6Egn.js → runtime-EoVRXYxX.js} +0 -0
- /package/dist/{secret-config-contract-5S9U9pjx.js → secret-config-contract-BA9jVaKx.js} +0 -0
- /package/dist/{security-contract-BE8rsdPq.js → security-contract-B7i5uqn6.js} +0 -0
- /package/dist/{security-doctor-DiilN216.js → security-doctor-2SGSPibT.js} +0 -0
- /package/dist/{session-contract-CuW9Nlxg.js → session-contract-DwjfF970.js} +0 -0
- /package/dist/{session-key-normalization-B5La-jFM.js → session-key-normalization-DvI2OlyS.js} +0 -0
- /package/dist/{thread-bindings.state-WU4duXKY.js → thread-bindings.state-CBwtFsbB.js} +0 -0
- /package/dist/{timeouts-CdsmBWWs.js → timeouts-BxAzVpSG.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as resolveDiscordDirectoryUserId } from "./directory-cache-
|
|
1
|
+
import { n as resolveDiscordDirectoryUserId } from "./directory-cache-D3l2v2_L.js";
|
|
2
2
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/text-runtime";
|
|
3
3
|
//#region extensions/discord/src/mentions.ts
|
|
4
4
|
const MARKDOWN_CODE_SEGMENT_PATTERN = /```[\s\S]*?```|`[^`\n]*`/g;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { j as createDiscordRestClient } from "./send.shared-
|
|
2
|
-
import { a as resolveDiscordChannelParentSafe, n as resolveDiscordChannelInfoSafe, r as resolveDiscordChannelNameSafe, t as resolveDiscordChannelIdSafe } from "./channel-access-
|
|
3
|
-
import { a as mergeAbortSignals } from "./timeouts-
|
|
4
|
-
import { l as resolveDiscordMessageChannelId, r as resolveDiscordMessageText, s as hasDiscordMessageStickers } from "./message-utils-
|
|
5
|
-
import { t as sendTyping } from "./typing-
|
|
1
|
+
import { j as createDiscordRestClient } from "./send.shared-BydEWvYg.js";
|
|
2
|
+
import { a as resolveDiscordChannelParentSafe, n as resolveDiscordChannelInfoSafe, r as resolveDiscordChannelNameSafe, t as resolveDiscordChannelIdSafe } from "./channel-access-CXAdcM95.js";
|
|
3
|
+
import { a as mergeAbortSignals } from "./timeouts-BxAzVpSG.js";
|
|
4
|
+
import { l as resolveDiscordMessageChannelId, r as resolveDiscordMessageText, s as hasDiscordMessageStickers } from "./message-utils-B3uf0_3D.js";
|
|
5
|
+
import { t as sendTyping } from "./typing-BIjMmOZB.js";
|
|
6
6
|
import { danger, logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
7
7
|
import { resolveOpenProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
8
8
|
import { resolveBatchedReplyThreadingPolicy } from "openclaw/plugin-sdk/reply-reference";
|
|
@@ -121,7 +121,7 @@ function applyImplicitReplyBatchGate(ctx, replyToMode, isBatched) {
|
|
|
121
121
|
//#region extensions/discord/src/monitor/message-run-queue.ts
|
|
122
122
|
let messageProcessRuntimePromise;
|
|
123
123
|
async function loadMessageProcessRuntime() {
|
|
124
|
-
messageProcessRuntimePromise ??= import("./message-handler.process-
|
|
124
|
+
messageProcessRuntimePromise ??= import("./message-handler.process-Dns8D7t2.js");
|
|
125
125
|
return await messageProcessRuntimePromise;
|
|
126
126
|
}
|
|
127
127
|
async function processDiscordQueuedMessage(params) {
|
|
@@ -173,7 +173,7 @@ function createDiscordMessageRunQueue(params) {
|
|
|
173
173
|
//#region extensions/discord/src/monitor/message-handler.ts
|
|
174
174
|
let messagePreflightRuntimePromise;
|
|
175
175
|
async function loadMessagePreflightRuntime() {
|
|
176
|
-
messagePreflightRuntimePromise ??= import("./message-handler.preflight-
|
|
176
|
+
messagePreflightRuntimePromise ??= import("./message-handler.preflight-B5hN7RpX.js");
|
|
177
177
|
return await messagePreflightRuntimePromise;
|
|
178
178
|
}
|
|
179
179
|
function isNonEmptyString(value) {
|
package/dist/{message-handler.preflight-BrvazsYn.js → message-handler.preflight-B5hN7RpX.js}
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { o as resolveDefaultDiscordAccountId } from "./accounts-CaHGiVB4.js";
|
|
2
|
-
import { S as Message, ot as getChannelMessage, t as discord_exports } from "./discord-
|
|
3
|
-
import { i as resolveTimestampMs, n as formatDiscordUserTag, r as resolveDiscordSystemLocation } from "./format-
|
|
4
|
-
import { _ as resolveGroupDmAllow, a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordGuildEntry, f as resolveDiscordMemberAccessState, g as resolveDiscordShouldRequireMention, i as normalizeDiscordDisplaySlug, m as resolveDiscordOwnerAccess, n as isDiscordGroupAllowedByPolicy } from "./allow-list-
|
|
5
|
-
import { t as resolveDiscordConversationIdentity } from "./conversation-identity-
|
|
6
|
-
import { l as isRecentlyUnboundThreadWebhookMessage } from "./thread-bindings.state-
|
|
7
|
-
import "./thread-bindings-
|
|
8
|
-
import { n as resolveDiscordChannelInfoSafe, r as resolveDiscordChannelNameSafe } from "./channel-access-
|
|
9
|
-
import { c as resolveDiscordChannelInfo, l as resolveDiscordMessageChannelId, r as resolveDiscordMessageText } from "./message-utils-
|
|
10
|
-
import { a as shouldIgnoreStaleDiscordRouteBinding, i as resolveDiscordEffectiveRoute, o as handleDiscordDmCommandDecision, r as resolveDiscordConversationRoute, s as resolveDiscordDmCommandAccess, t as buildDiscordRoutePeer } from "./route-resolution-
|
|
11
|
-
import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-
|
|
2
|
+
import { S as Message, ot as getChannelMessage, t as discord_exports } from "./discord-Du6FnKAq.js";
|
|
3
|
+
import { i as resolveTimestampMs, n as formatDiscordUserTag, r as resolveDiscordSystemLocation } from "./format-XDPCvGK4.js";
|
|
4
|
+
import { _ as resolveGroupDmAllow, a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordGuildEntry, f as resolveDiscordMemberAccessState, g as resolveDiscordShouldRequireMention, i as normalizeDiscordDisplaySlug, m as resolveDiscordOwnerAccess, n as isDiscordGroupAllowedByPolicy } from "./allow-list-Dtho5Hww.js";
|
|
5
|
+
import { t as resolveDiscordConversationIdentity } from "./conversation-identity-6hcTVj3L.js";
|
|
6
|
+
import { l as isRecentlyUnboundThreadWebhookMessage } from "./thread-bindings.state-CBwtFsbB.js";
|
|
7
|
+
import "./thread-bindings-B90pBWJg.js";
|
|
8
|
+
import { n as resolveDiscordChannelInfoSafe, r as resolveDiscordChannelNameSafe } from "./channel-access-CXAdcM95.js";
|
|
9
|
+
import { c as resolveDiscordChannelInfo, l as resolveDiscordMessageChannelId, r as resolveDiscordMessageText } from "./message-utils-B3uf0_3D.js";
|
|
10
|
+
import { a as shouldIgnoreStaleDiscordRouteBinding, i as resolveDiscordEffectiveRoute, o as handleDiscordDmCommandDecision, r as resolveDiscordConversationRoute, s as resolveDiscordDmCommandAccess, t as buildDiscordRoutePeer } from "./route-resolution-CYRPDKY4.js";
|
|
11
|
+
import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-DVJCrDxs.js";
|
|
12
12
|
import { logDebug, normalizeOptionalString } from "openclaw/plugin-sdk/text-runtime";
|
|
13
13
|
import { getChildLogger, logVerbose, shouldLogVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
14
14
|
import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runtime";
|
|
@@ -28,7 +28,7 @@ async function loadConversationRuntime$1() {
|
|
|
28
28
|
return await conversationRuntimePromise$1;
|
|
29
29
|
}
|
|
30
30
|
async function loadDiscordSendRuntime() {
|
|
31
|
-
discordSendRuntimePromise ??= import("./send-
|
|
31
|
+
discordSendRuntimePromise ??= import("./send-C3peGbWO.js").then((n) => n.t);
|
|
32
32
|
return await discordSendRuntimePromise;
|
|
33
33
|
}
|
|
34
34
|
async function resolveDiscordDmPreflightAccess(params) {
|
|
@@ -428,19 +428,19 @@ let preflightAudioRuntimePromise;
|
|
|
428
428
|
let systemEventsRuntimePromise;
|
|
429
429
|
let discordThreadingRuntimePromise;
|
|
430
430
|
async function loadPluralKitRuntime() {
|
|
431
|
-
pluralkitRuntimePromise ??= import("./pluralkit-
|
|
431
|
+
pluralkitRuntimePromise ??= import("./pluralkit-EXKKni07.js").then((n) => n.n);
|
|
432
432
|
return await pluralkitRuntimePromise;
|
|
433
433
|
}
|
|
434
434
|
async function loadPreflightAudioRuntime() {
|
|
435
|
-
preflightAudioRuntimePromise ??= import("./preflight-audio-
|
|
435
|
+
preflightAudioRuntimePromise ??= import("./preflight-audio-6J0vFNtu.js");
|
|
436
436
|
return await preflightAudioRuntimePromise;
|
|
437
437
|
}
|
|
438
438
|
async function loadSystemEventsRuntime() {
|
|
439
|
-
systemEventsRuntimePromise ??= import("./system-events-
|
|
439
|
+
systemEventsRuntimePromise ??= import("./system-events-Dsc8MFYs.js");
|
|
440
440
|
return await systemEventsRuntimePromise;
|
|
441
441
|
}
|
|
442
442
|
async function loadDiscordThreadingRuntime() {
|
|
443
|
-
discordThreadingRuntimePromise ??= import("./threading-
|
|
443
|
+
discordThreadingRuntimePromise ??= import("./threading-Dku_cGS8.js").then((n) => n.t);
|
|
444
444
|
return await discordThreadingRuntimePromise;
|
|
445
445
|
}
|
|
446
446
|
function isPreflightAborted(abortSignal) {
|
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
import { f as resolveDiscordMaxLinesPerMessage } from "./accounts-CaHGiVB4.js";
|
|
2
|
-
import {
|
|
3
|
-
import { $ as createChannelMessage, it as editChannelMessage, nt as deleteChannelMessage, t as discord_exports } from "./discord-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { a as
|
|
8
|
-
import "./
|
|
9
|
-
import
|
|
10
|
-
import { t as
|
|
11
|
-
import { t as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { a as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
2
|
+
import { n as resolveDiscordChannelId } from "./target-parsing-D-H7nnh2.js";
|
|
3
|
+
import { $ as createChannelMessage, it as editChannelMessage, nt as deleteChannelMessage, t as discord_exports } from "./discord-Du6FnKAq.js";
|
|
4
|
+
import { t as chunkDiscordTextWithMode } from "./chunk-BDgKaWaV.js";
|
|
5
|
+
import { M as createDiscordRuntimeAccountContext, d as resolveDiscordTargetChannelId, j as createDiscordRestClient } from "./send.shared-BydEWvYg.js";
|
|
6
|
+
import { i as resolveTimestampMs } from "./format-XDPCvGK4.js";
|
|
7
|
+
import { a as normalizeDiscordSlug, r as normalizeDiscordAllowList } from "./allow-list-Dtho5Hww.js";
|
|
8
|
+
import { a as removeReactionDiscord, f as editMessageDiscord, r as reactMessageDiscord } from "./send-C3peGbWO.js";
|
|
9
|
+
import "./targets-DzAZIwg4.js";
|
|
10
|
+
import { t as resolveDiscordConversationIdentity } from "./conversation-identity-6hcTVj3L.js";
|
|
11
|
+
import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-jP0OgIyW.js";
|
|
12
|
+
import { t as resolveDiscordPreviewStreamMode } from "./preview-streaming-CXrFDP2T.js";
|
|
13
|
+
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-BxAzVpSG.js";
|
|
14
|
+
import { a as resolveForwardedMediaList, i as buildDiscordMediaPayload, o as resolveMediaList, r as resolveDiscordMessageText } from "./message-utils-B3uf0_3D.js";
|
|
15
|
+
import { a as resolveDiscordThreadStarter, n as resolveDiscordAutoThreadReplyPlan } from "./threading-Dku_cGS8.js";
|
|
16
|
+
import { t as sendTyping } from "./typing-BIjMmOZB.js";
|
|
17
|
+
import { n as buildDiscordInboundAccessContext, r as createDiscordSupplementalContextAccessChecker } from "./inbound-context-BobVUBqo.js";
|
|
18
|
+
import { i as resolveReplyContext, n as buildDirectLabel, r as buildGuildLabel, t as deliverDiscordReply } from "./reply-delivery-DKTZ6HkK.js";
|
|
18
19
|
import { convertMarkdownTables, stripInlineDirectiveTagsForDelivery, stripReasoningTagsFromText, truncateUtf16Safe } from "openclaw/plugin-sdk/text-runtime";
|
|
19
20
|
import { buildAgentSessionKey, normalizeAccountId, resolveAccountEntry, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
|
|
21
|
+
import { evaluateSupplementalContextVisibility } from "openclaw/plugin-sdk/security-runtime";
|
|
20
22
|
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
|
|
21
23
|
import { resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
22
24
|
import { resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-chunking";
|
|
23
25
|
import { danger, logVerbose, shouldLogVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
24
26
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
25
27
|
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
26
|
-
import {
|
|
28
|
+
import { createChannelMessageReplyPipeline, defineFinalizableLivePreviewAdapter, deliverWithFinalizableLivePreviewAdapter, resolveChannelMessageSourceReplyDeliveryMode } from "openclaw/plugin-sdk/channel-message";
|
|
29
|
+
import { buildChannelProgressDraftLine, buildChannelProgressDraftLineForEntry, createChannelProgressDraftGate, formatChannelProgressDraftText, isChannelProgressDraftWorkToolName, resolveChannelProgressDraftMaxLines, resolveChannelStreamingBlockEnabled, resolveChannelStreamingPreviewChunk, resolveChannelStreamingPreviewToolProgress, resolveChannelStreamingSuppressDefaultToolProgressMessages } from "openclaw/plugin-sdk/channel-streaming";
|
|
27
30
|
import { recordInboundSession, resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/conversation-runtime";
|
|
28
|
-
import { EmbeddedBlockChunker, resolveAckReaction, resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
|
|
31
|
+
import { EmbeddedBlockChunker, formatReasoningMessage, resolveAckReaction, resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
|
|
29
32
|
import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
|
|
30
|
-
import { evaluateSupplementalContextVisibility } from "openclaw/plugin-sdk/security-runtime";
|
|
31
33
|
import { readSessionUpdatedAt, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
32
34
|
import { formatInboundEnvelope, resolveEnvelopeFormatOptions } from "openclaw/plugin-sdk/channel-inbound";
|
|
33
|
-
import { createFinalizableDraftLifecycle
|
|
34
|
-
import { createChannelReplyPipeline, resolveChannelSourceReplyDeliveryMode } from "openclaw/plugin-sdk/channel-reply-pipeline";
|
|
35
|
+
import { createFinalizableDraftLifecycle } from "openclaw/plugin-sdk/channel-lifecycle";
|
|
35
36
|
import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-dispatch-runtime";
|
|
36
37
|
import { hasFinalInboundReplyDispatch, runInboundReplyTurn } from "openclaw/plugin-sdk/inbound-reply-dispatch";
|
|
37
38
|
import { buildPendingHistoryContextFromMap } from "openclaw/plugin-sdk/reply-history";
|
|
@@ -557,12 +558,14 @@ function createDiscordDraftPreviewController(params) {
|
|
|
557
558
|
async pushToolProgress(line, options) {
|
|
558
559
|
if (!draftStream) return;
|
|
559
560
|
if (options?.toolName !== void 0 && !isChannelProgressDraftWorkToolName(options.toolName)) return;
|
|
560
|
-
|
|
561
|
+
if (isEmptyDiscordProgressLine(line)) return;
|
|
562
|
+
const normalized = normalizeProgressLineIdentity(line);
|
|
561
563
|
if (!normalized) return;
|
|
564
|
+
const progressLine = typeof line === "object" && line !== void 0 ? line : normalized;
|
|
562
565
|
if (discordStreamMode !== "progress") {
|
|
563
566
|
if (!previewToolProgressEnabled || previewToolProgressSuppressed) return;
|
|
564
|
-
if (previewToolProgressLines.at(-1) === normalized) return;
|
|
565
|
-
previewToolProgressLines = [...previewToolProgressLines,
|
|
567
|
+
if (normalizeProgressLineIdentity(previewToolProgressLines.at(-1)) === normalized) return;
|
|
568
|
+
previewToolProgressLines = [...previewToolProgressLines, progressLine].slice(-resolveChannelProgressDraftMaxLines(params.discordConfig));
|
|
566
569
|
const previewText = formatChannelProgressDraftText({
|
|
567
570
|
entry: params.discordConfig,
|
|
568
571
|
lines: previewToolProgressLines,
|
|
@@ -576,10 +579,11 @@ function createDiscordDraftPreviewController(params) {
|
|
|
576
579
|
return;
|
|
577
580
|
}
|
|
578
581
|
if (previewToolProgressEnabled && !previewToolProgressSuppressed && normalized) {
|
|
579
|
-
if (previewToolProgressLines.at(-1) !== normalized) previewToolProgressLines = [...previewToolProgressLines,
|
|
582
|
+
if (normalizeProgressLineIdentity(previewToolProgressLines.at(-1)) !== normalized) previewToolProgressLines = [...previewToolProgressLines, progressLine].slice(-resolveChannelProgressDraftMaxLines(params.discordConfig));
|
|
580
583
|
}
|
|
581
584
|
const alreadyStarted = progressDraftGate.hasStarted;
|
|
582
|
-
await progressDraftGate.
|
|
585
|
+
if (shouldStartDiscordProgressDraftNow(line)) await progressDraftGate.startNow();
|
|
586
|
+
else await progressDraftGate.noteWork();
|
|
583
587
|
if (alreadyStarted && progressDraftGate.hasStarted) await renderProgressDraft();
|
|
584
588
|
},
|
|
585
589
|
async pushReasoningProgress(text) {
|
|
@@ -698,6 +702,16 @@ function mergeReasoningProgressText(current, incoming) {
|
|
|
698
702
|
function isReasoningSnapshotText(text) {
|
|
699
703
|
return /^\s*(?:>\s*)?Reasoning:\s*/i.test(text);
|
|
700
704
|
}
|
|
705
|
+
function normalizeProgressLineIdentity(line) {
|
|
706
|
+
return (typeof line === "string" ? line : line?.text)?.replace(/\s+/g, " ").trim() ?? "";
|
|
707
|
+
}
|
|
708
|
+
function isEmptyDiscordProgressLine(line) {
|
|
709
|
+
if (!line || typeof line === "string") return false;
|
|
710
|
+
return line.toolName === "apply_patch" && !line.detail && !line.status;
|
|
711
|
+
}
|
|
712
|
+
function shouldStartDiscordProgressDraftNow(line) {
|
|
713
|
+
return typeof line === "object" && line?.kind === "patch" && Boolean(line.detail);
|
|
714
|
+
}
|
|
701
715
|
//#endregion
|
|
702
716
|
//#region extensions/discord/src/monitor/message-handler.process.ts
|
|
703
717
|
function sleep(ms) {
|
|
@@ -748,7 +762,7 @@ async function processDiscordMessage(ctx, observer) {
|
|
|
748
762
|
const boundThreadId = ctx.threadBinding?.conversation?.conversationId?.trim();
|
|
749
763
|
if (boundThreadId && typeof threadBindings.touchThread === "function") threadBindings.touchThread({ threadId: boundThreadId });
|
|
750
764
|
const { createReplyDispatcherWithTyping, dispatchInboundMessage, settleReplyDispatcher } = await loadReplyRuntime();
|
|
751
|
-
const sourceReplyDeliveryMode =
|
|
765
|
+
const sourceReplyDeliveryMode = resolveChannelMessageSourceReplyDeliveryMode({
|
|
752
766
|
cfg,
|
|
753
767
|
ctx: { ChatType: isGuildMessage ? "channel" : void 0 }
|
|
754
768
|
});
|
|
@@ -887,7 +901,7 @@ async function processDiscordMessage(ctx, observer) {
|
|
|
887
901
|
sessionKey: persistedSessionKey
|
|
888
902
|
});
|
|
889
903
|
const typingChannelId = deliverTarget.startsWith("channel:") ? deliverTarget.slice(8) : messageChannelId;
|
|
890
|
-
const { onModelSelected, ...replyPipeline } =
|
|
904
|
+
const { onModelSelected, ...replyPipeline } = createChannelMessageReplyPipeline({
|
|
891
905
|
cfg,
|
|
892
906
|
agentId: route.agentId,
|
|
893
907
|
channel: "discord",
|
|
@@ -957,29 +971,39 @@ async function processDiscordMessage(ctx, observer) {
|
|
|
957
971
|
const finalText = payload.text;
|
|
958
972
|
const previewFinalText = draftPreview.resolvePreviewFinalText(finalText);
|
|
959
973
|
const hasExplicitReplyDirective = Boolean(payload.replyToTag || payload.replyToCurrent) || typeof finalText === "string" && /\[\[\s*reply_to(?:_current|\s*:)/i.test(finalText);
|
|
960
|
-
if (await
|
|
974
|
+
if ((await deliverWithFinalizableLivePreviewAdapter({
|
|
961
975
|
kind: info.kind,
|
|
962
976
|
payload,
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
977
|
+
adapter: defineFinalizableLivePreviewAdapter({
|
|
978
|
+
draft: {
|
|
979
|
+
flush: () => draftPreview.flush(),
|
|
980
|
+
clear: () => draftStream.clear(),
|
|
981
|
+
discardPending: () => draftStream.discardPending(),
|
|
982
|
+
seal: () => draftStream.seal(),
|
|
983
|
+
id: draftStream.messageId
|
|
984
|
+
},
|
|
985
|
+
buildFinalEdit: () => {
|
|
986
|
+
if (draftPreview.finalizedViaPreviewMessage || hasMedia || typeof previewFinalText !== "string" || hasExplicitReplyDirective || payload.isError) return;
|
|
987
|
+
return { content: previewFinalText };
|
|
988
|
+
},
|
|
989
|
+
editFinal: async (previewMessageId, edit) => {
|
|
990
|
+
if (isProcessAborted(abortSignal)) throw new Error("process aborted");
|
|
991
|
+
notifyFinalReplyStart();
|
|
992
|
+
await editMessageDiscord(deliverChannelId, previewMessageId, edit, {
|
|
993
|
+
cfg,
|
|
994
|
+
accountId,
|
|
995
|
+
rest: deliveryRest
|
|
996
|
+
});
|
|
997
|
+
},
|
|
998
|
+
onPreviewFinalized: () => {
|
|
999
|
+
draftPreview.markPreviewFinalized();
|
|
1000
|
+
replyReference.markSent();
|
|
1001
|
+
observer?.onFinalReplyDelivered?.();
|
|
1002
|
+
},
|
|
1003
|
+
logPreviewEditFailure: (err) => {
|
|
1004
|
+
logVerbose(`discord: preview final edit failed; falling back to standard send (${String(err)})`);
|
|
1005
|
+
}
|
|
1006
|
+
}),
|
|
983
1007
|
deliverNormally: async () => {
|
|
984
1008
|
if (isProcessAborted(abortSignal)) return false;
|
|
985
1009
|
const replyToId = replyReference.use();
|
|
@@ -1005,16 +1029,8 @@ async function processDiscordMessage(ctx, observer) {
|
|
|
1005
1029
|
replyReference.markSent();
|
|
1006
1030
|
observer?.onFinalReplyDelivered?.();
|
|
1007
1031
|
return true;
|
|
1008
|
-
},
|
|
1009
|
-
onPreviewFinalized: () => {
|
|
1010
|
-
draftPreview.markPreviewFinalized();
|
|
1011
|
-
replyReference.markSent();
|
|
1012
|
-
observer?.onFinalReplyDelivered?.();
|
|
1013
|
-
},
|
|
1014
|
-
logPreviewEditFailure: (err) => {
|
|
1015
|
-
logVerbose(`discord: preview final edit failed; falling back to standard send (${String(err)})`);
|
|
1016
1032
|
}
|
|
1017
|
-
}) !== "normal-skipped") return;
|
|
1033
|
+
})).kind !== "normal-skipped") return;
|
|
1018
1034
|
}
|
|
1019
1035
|
if (isProcessAborted(abortSignal)) return;
|
|
1020
1036
|
const replyToId = replyReference.use();
|
|
@@ -1121,13 +1137,14 @@ async function processDiscordMessage(ctx, observer) {
|
|
|
1121
1137
|
suppressDefaultToolProgressMessages: draftPreview.suppressDefaultToolProgressMessages ? true : void 0,
|
|
1122
1138
|
onReasoningStream: async (payload) => {
|
|
1123
1139
|
await statusReactions.setThinking();
|
|
1124
|
-
|
|
1140
|
+
const formattedText = payload?.text ? formatReasoningMessage(payload.text) : void 0;
|
|
1141
|
+
await draftPreview.pushReasoningProgress(formattedText);
|
|
1125
1142
|
},
|
|
1126
1143
|
onToolStart: async (payload) => {
|
|
1127
1144
|
if (isProcessAborted(abortSignal)) return;
|
|
1128
1145
|
await maybeBindStatusReactionsToToolReaction(payload);
|
|
1129
1146
|
await statusReactions.setTool(payload.name);
|
|
1130
|
-
await draftPreview.pushToolProgress(
|
|
1147
|
+
await draftPreview.pushToolProgress(buildChannelProgressDraftLineForEntry(discordConfig, {
|
|
1131
1148
|
event: "tool",
|
|
1132
1149
|
name: payload.name,
|
|
1133
1150
|
phase: payload.phase,
|
|
@@ -1135,7 +1152,7 @@ async function processDiscordMessage(ctx, observer) {
|
|
|
1135
1152
|
}, payload.detailMode ? { detailMode: payload.detailMode } : void 0), { toolName: payload.name });
|
|
1136
1153
|
},
|
|
1137
1154
|
onItemEvent: async (payload) => {
|
|
1138
|
-
await draftPreview.pushToolProgress(
|
|
1155
|
+
await draftPreview.pushToolProgress(buildChannelProgressDraftLineForEntry(discordConfig, {
|
|
1139
1156
|
event: "item",
|
|
1140
1157
|
itemKind: payload.kind,
|
|
1141
1158
|
title: payload.title,
|
|
@@ -1149,7 +1166,7 @@ async function processDiscordMessage(ctx, observer) {
|
|
|
1149
1166
|
},
|
|
1150
1167
|
onPlanUpdate: async (payload) => {
|
|
1151
1168
|
if (payload.phase !== "update") return;
|
|
1152
|
-
await draftPreview.pushToolProgress(
|
|
1169
|
+
await draftPreview.pushToolProgress(buildChannelProgressDraftLine({
|
|
1153
1170
|
event: "plan",
|
|
1154
1171
|
phase: payload.phase,
|
|
1155
1172
|
title: payload.title,
|
|
@@ -1159,7 +1176,7 @@ async function processDiscordMessage(ctx, observer) {
|
|
|
1159
1176
|
},
|
|
1160
1177
|
onApprovalEvent: async (payload) => {
|
|
1161
1178
|
if (payload.phase !== "requested") return;
|
|
1162
|
-
await draftPreview.pushToolProgress(
|
|
1179
|
+
await draftPreview.pushToolProgress(buildChannelProgressDraftLine({
|
|
1163
1180
|
event: "approval",
|
|
1164
1181
|
phase: payload.phase,
|
|
1165
1182
|
title: payload.title,
|
|
@@ -1170,7 +1187,7 @@ async function processDiscordMessage(ctx, observer) {
|
|
|
1170
1187
|
},
|
|
1171
1188
|
onCommandOutput: async (payload) => {
|
|
1172
1189
|
if (payload.phase !== "end") return;
|
|
1173
|
-
await draftPreview.pushToolProgress(
|
|
1190
|
+
await draftPreview.pushToolProgress(buildChannelProgressDraftLine({
|
|
1174
1191
|
event: "command-output",
|
|
1175
1192
|
phase: payload.phase,
|
|
1176
1193
|
title: payload.title,
|
|
@@ -1181,7 +1198,7 @@ async function processDiscordMessage(ctx, observer) {
|
|
|
1181
1198
|
},
|
|
1182
1199
|
onPatchSummary: async (payload) => {
|
|
1183
1200
|
if (payload.phase !== "end") return;
|
|
1184
|
-
await draftPreview.pushToolProgress(
|
|
1201
|
+
await draftPreview.pushToolProgress(buildChannelProgressDraftLine({
|
|
1185
1202
|
event: "patch",
|
|
1186
1203
|
phase: payload.phase,
|
|
1187
1204
|
title: payload.title,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as resolveDiscordChannelInfoSafe } from "./channel-access-
|
|
2
|
-
import { a as mergeAbortSignals } from "./timeouts-
|
|
1
|
+
import { n as resolveDiscordChannelInfoSafe } from "./channel-access-CXAdcM95.js";
|
|
2
|
+
import { a as mergeAbortSignals } from "./timeouts-BxAzVpSG.js";
|
|
3
3
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/text-runtime";
|
|
4
4
|
import { ComponentType, StickerFormatType } from "discord-api-types/v10";
|
|
5
5
|
import { fetchRemoteMedia, saveMediaBuffer } from "openclaw/plugin-sdk/media-runtime";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { t as parseDiscordTarget } from "./target-parsing-D-H7nnh2.js";
|
|
2
|
+
//#region extensions/discord/src/normalize.ts
|
|
3
|
+
function normalizeDiscordMessagingTarget(raw) {
|
|
4
|
+
return parseDiscordTarget(raw, { defaultKind: "channel" })?.normalized;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Normalize a Discord outbound target for delivery. Bare numeric IDs are
|
|
8
|
+
* prefixed with "channel:" to avoid the ambiguous-target error in
|
|
9
|
+
* parseDiscordTarget, unless the ID is explicitly configured as an allowed DM
|
|
10
|
+
* sender. All other formats pass through unchanged.
|
|
11
|
+
*/
|
|
12
|
+
function normalizeDiscordOutboundTarget(to, allowFrom) {
|
|
13
|
+
const trimmed = to?.trim();
|
|
14
|
+
if (!trimmed) return {
|
|
15
|
+
ok: false,
|
|
16
|
+
error: /* @__PURE__ */ new Error("Discord recipient is required. Use \"channel:<id>\" for channels or \"user:<id>\" for DMs.")
|
|
17
|
+
};
|
|
18
|
+
if (/^\d+$/.test(trimmed)) {
|
|
19
|
+
if (allowFromContainsDiscordUserId(allowFrom, trimmed)) return {
|
|
20
|
+
ok: true,
|
|
21
|
+
to: `user:${trimmed}`
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
ok: true,
|
|
25
|
+
to: `channel:${trimmed}`
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
ok: true,
|
|
30
|
+
to: trimmed
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function allowFromContainsDiscordUserId(allowFrom, userId) {
|
|
34
|
+
const normalizedUserId = userId.trim();
|
|
35
|
+
if (!normalizedUserId) return false;
|
|
36
|
+
return (allowFrom ?? []).some((entry) => normalizeAllowFromDiscordUserId(entry) === normalizedUserId);
|
|
37
|
+
}
|
|
38
|
+
function normalizeAllowFromDiscordUserId(entry) {
|
|
39
|
+
const trimmed = entry.trim().toLowerCase();
|
|
40
|
+
if (!trimmed || trimmed === "*") return;
|
|
41
|
+
const mentionMatch = /^<@!?(\d+)>$/.exec(trimmed);
|
|
42
|
+
if (mentionMatch) return mentionMatch[1];
|
|
43
|
+
const prefixedMatch = /^(?:discord:)?user:(\d+)$/.exec(trimmed);
|
|
44
|
+
if (prefixedMatch) return prefixedMatch[1];
|
|
45
|
+
const discordMatch = /^discord:(\d+)$/.exec(trimmed);
|
|
46
|
+
if (discordMatch) return discordMatch[1];
|
|
47
|
+
return /^\d+$/.test(trimmed) ? trimmed : void 0;
|
|
48
|
+
}
|
|
49
|
+
function looksLikeDiscordTargetId(raw) {
|
|
50
|
+
const trimmed = raw.trim();
|
|
51
|
+
if (!trimmed) return false;
|
|
52
|
+
if (/^<@!?\d+>$/.test(trimmed)) return true;
|
|
53
|
+
if (/^(user|channel|discord):/i.test(trimmed)) return true;
|
|
54
|
+
if (/^\d{6,}$/.test(trimmed)) return true;
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { normalizeDiscordOutboundTarget as i, looksLikeDiscordTargetId as n, normalizeDiscordMessagingTarget as r, allowFromContainsDiscordUserId as t };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { s as resolveDiscordAccount } from "./accounts-CaHGiVB4.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { m as DiscordError } from "./discord-Du6FnKAq.js";
|
|
3
|
+
import { t as chunkDiscordTextWithMode } from "./chunk-BDgKaWaV.js";
|
|
4
|
+
import { i as normalizeDiscordOutboundTarget } from "./normalize-DBcng6RL.js";
|
|
5
|
+
import { t as createDiscordSendReceipt } from "./send.receipt-DXimpUGs.js";
|
|
6
|
+
import { c as readDiscordComponentSpec } from "./components-BWdIitIb.js";
|
|
5
7
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/text-runtime";
|
|
6
8
|
import { resolvePayloadMediaUrls, sendPayloadMediaSequenceOrFallback, sendTextMediaPayload } from "openclaw/plugin-sdk/reply-payload";
|
|
7
9
|
import { resolveRetryConfig, retryAsync } from "openclaw/plugin-sdk/retry-runtime";
|
|
@@ -85,11 +87,11 @@ function normalizeDiscordApprovalPayload(payload) {
|
|
|
85
87
|
let discordComponentSendPromise;
|
|
86
88
|
let discordSharedInteractivePromise;
|
|
87
89
|
async function sendDiscordComponentMessageLazy(...args) {
|
|
88
|
-
discordComponentSendPromise ??= import("./send.components-
|
|
90
|
+
discordComponentSendPromise ??= import("./send.components-Dsk3IzS_.js").then((n) => n.i).then((module) => module.sendDiscordComponentMessage);
|
|
89
91
|
return await (await discordComponentSendPromise)(...args);
|
|
90
92
|
}
|
|
91
93
|
function loadDiscordSharedInteractive() {
|
|
92
|
-
discordSharedInteractivePromise ??= import("./shared-interactive-
|
|
94
|
+
discordSharedInteractivePromise ??= import("./shared-interactive-BZCU0ZJ8.js").then((n) => n.r);
|
|
93
95
|
return discordSharedInteractivePromise;
|
|
94
96
|
}
|
|
95
97
|
function addPayloadTextFallback(spec, payload) {
|
|
@@ -114,7 +116,7 @@ async function buildDiscordPresentationPayload(params) {
|
|
|
114
116
|
}
|
|
115
117
|
async function resolveDiscordComponentSpec(payload) {
|
|
116
118
|
const discordData = payload.channelData?.discord;
|
|
117
|
-
const rawComponentSpec = discordData?.presentationComponents ??
|
|
119
|
+
const rawComponentSpec = discordData?.presentationComponents ?? (discordData?.components && typeof discordData.components === "object" && !Array.isArray(discordData.components) ? readDiscordComponentSpec(discordData.components) : null);
|
|
118
120
|
if (rawComponentSpec) return addPayloadTextFallback(rawComponentSpec, payload);
|
|
119
121
|
if (!payload.interactive) return;
|
|
120
122
|
const interactiveSpec = (await loadDiscordSharedInteractive()).buildDiscordInteractiveComponents(payload.interactive);
|
|
@@ -124,7 +126,7 @@ async function resolveDiscordComponentSpec(payload) {
|
|
|
124
126
|
//#region extensions/discord/src/outbound-send-context.ts
|
|
125
127
|
let discordSendRuntimePromise;
|
|
126
128
|
async function loadDiscordSendRuntime() {
|
|
127
|
-
discordSendRuntimePromise ??= import("./send-
|
|
129
|
+
discordSendRuntimePromise ??= import("./send-C3peGbWO.js").then((n) => n.t);
|
|
128
130
|
return await discordSendRuntimePromise;
|
|
129
131
|
}
|
|
130
132
|
function resolveDiscordOutboundTarget(params) {
|
|
@@ -204,20 +206,70 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
204
206
|
return attachChannelToResult("discord", lastResult);
|
|
205
207
|
}
|
|
206
208
|
const componentSpec = await resolveDiscordComponentSpec(payload);
|
|
207
|
-
if (!componentSpec)
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
209
|
+
if (!componentSpec) {
|
|
210
|
+
const discordData = payload.channelData?.discord && typeof payload.channelData.discord === "object" && !Array.isArray(payload.channelData.discord) ? payload.channelData.discord : {};
|
|
211
|
+
const nativeComponents = Array.isArray(discordData.components) ? discordData.components : void 0;
|
|
212
|
+
const embeds = Array.isArray(discordData.embeds) ? discordData.embeds : void 0;
|
|
213
|
+
const filename = normalizeOptionalString(discordData.filename);
|
|
214
|
+
if (nativeComponents || embeds?.length || filename) return attachChannelToResult("discord", await sendPayloadMediaSequenceOrFallback({
|
|
215
|
+
text: payload.text ?? "",
|
|
216
|
+
mediaUrls,
|
|
217
|
+
fallbackResult: {
|
|
218
|
+
messageId: "",
|
|
219
|
+
channelId: sendContext.target,
|
|
220
|
+
receipt: createDiscordSendReceipt({
|
|
221
|
+
platformMessageIds: [],
|
|
222
|
+
channelId: sendContext.target,
|
|
223
|
+
kind: "unknown"
|
|
224
|
+
})
|
|
225
|
+
},
|
|
226
|
+
sendNoMedia: async () => await sendContext.withRetry(async () => await sendContext.send(sendContext.target, payload.text ?? "", {
|
|
227
|
+
verbose: false,
|
|
228
|
+
components: nativeComponents,
|
|
229
|
+
embeds,
|
|
230
|
+
filename,
|
|
231
|
+
replyTo: sendContext.resolveReplyTo(),
|
|
232
|
+
accountId: ctx.accountId ?? void 0,
|
|
233
|
+
silent: ctx.silent ?? void 0,
|
|
234
|
+
cfg: ctx.cfg,
|
|
235
|
+
...sendContext.formatting
|
|
236
|
+
})),
|
|
237
|
+
send: async ({ text, mediaUrl, isFirst }) => await sendContext.withRetry(async () => await sendContext.send(sendContext.target, text, {
|
|
238
|
+
verbose: false,
|
|
239
|
+
mediaUrl,
|
|
240
|
+
mediaAccess: ctx.mediaAccess,
|
|
241
|
+
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
242
|
+
mediaReadFile: ctx.mediaReadFile,
|
|
243
|
+
components: isFirst ? nativeComponents : void 0,
|
|
244
|
+
embeds: isFirst ? embeds : void 0,
|
|
245
|
+
filename: isFirst ? filename : void 0,
|
|
246
|
+
replyTo: sendContext.resolveReplyTo(),
|
|
247
|
+
accountId: ctx.accountId ?? void 0,
|
|
248
|
+
silent: ctx.silent ?? void 0,
|
|
249
|
+
cfg: ctx.cfg,
|
|
250
|
+
...sendContext.formatting
|
|
251
|
+
}))
|
|
252
|
+
}));
|
|
253
|
+
return await sendTextMediaPayload({
|
|
254
|
+
channel: "discord",
|
|
255
|
+
ctx: {
|
|
256
|
+
...ctx,
|
|
257
|
+
payload
|
|
258
|
+
},
|
|
259
|
+
adapter: params.fallbackAdapter
|
|
260
|
+
});
|
|
261
|
+
}
|
|
215
262
|
return attachChannelToResult("discord", await sendPayloadMediaSequenceOrFallback({
|
|
216
263
|
text: payload.text ?? "",
|
|
217
264
|
mediaUrls,
|
|
218
265
|
fallbackResult: {
|
|
219
266
|
messageId: "",
|
|
220
|
-
channelId: sendContext.target
|
|
267
|
+
channelId: sendContext.target,
|
|
268
|
+
receipt: createDiscordSendReceipt({
|
|
269
|
+
platformMessageIds: [],
|
|
270
|
+
channelId: sendContext.target,
|
|
271
|
+
kind: "unknown"
|
|
272
|
+
})
|
|
221
273
|
},
|
|
222
274
|
sendNoMedia: async () => await sendContext.withRetry(async () => await sendDiscordComponentMessageLazy(sendContext.target, componentSpec, {
|
|
223
275
|
replyTo: sendContext.resolveReplyTo(),
|
|
@@ -264,7 +316,7 @@ function stripDiscordInternalRuntimeScaffolding(text) {
|
|
|
264
316
|
}
|
|
265
317
|
let discordThreadBindingsPromise;
|
|
266
318
|
function loadDiscordThreadBindings() {
|
|
267
|
-
discordThreadBindingsPromise ??= import("./thread-bindings-
|
|
319
|
+
discordThreadBindingsPromise ??= import("./thread-bindings-B90pBWJg.js").then((n) => n.t);
|
|
268
320
|
return discordThreadBindingsPromise;
|
|
269
321
|
}
|
|
270
322
|
function resolveDiscordWebhookIdentity(params) {
|
|
@@ -317,6 +369,15 @@ const discordOutbound = {
|
|
|
317
369
|
context: true,
|
|
318
370
|
divider: true
|
|
319
371
|
},
|
|
372
|
+
deliveryCapabilities: { durableFinal: {
|
|
373
|
+
text: true,
|
|
374
|
+
media: true,
|
|
375
|
+
payload: true,
|
|
376
|
+
silent: true,
|
|
377
|
+
replyTo: true,
|
|
378
|
+
thread: true,
|
|
379
|
+
messageSendingHooks: true
|
|
380
|
+
} },
|
|
320
381
|
renderPresentation: async ({ payload, presentation }) => {
|
|
321
382
|
return await buildDiscordPresentationPayload({
|
|
322
383
|
payload,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as parseDiscordTarget } from "./target-parsing-D-H7nnh2.js";
|
|
2
2
|
import { buildOutboundBaseSessionKey } from "openclaw/plugin-sdk/routing";
|
|
3
3
|
import { buildThreadAwareOutboundSessionRoute } from "openclaw/plugin-sdk/channel-core";
|
|
4
4
|
//#region extensions/discord/src/outbound-session-route.ts
|
|
@@ -4,7 +4,7 @@ import { getFileExtension } from "openclaw/plugin-sdk/media-mime";
|
|
|
4
4
|
//#region extensions/discord/src/monitor/preflight-audio.ts
|
|
5
5
|
let discordPreflightAudioRuntimePromise;
|
|
6
6
|
function loadDiscordPreflightAudioRuntime() {
|
|
7
|
-
discordPreflightAudioRuntimePromise ??= import("./preflight-audio.runtime-
|
|
7
|
+
discordPreflightAudioRuntimePromise ??= import("./preflight-audio.runtime-3hiRefuj.js");
|
|
8
8
|
return discordPreflightAudioRuntimePromise;
|
|
9
9
|
}
|
|
10
10
|
const AUDIO_ATTACHMENT_MIME_BY_EXT = new Map([
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { resolveChannelPreviewStreamMode } from "openclaw/plugin-sdk/channel-streaming";
|
|
2
2
|
//#region extensions/discord/src/preview-streaming.ts
|
|
3
3
|
function resolveDiscordPreviewStreamMode(params = {}) {
|
|
4
|
+
if (params.streaming === void 0 && params.streamMode === void 0) return "progress";
|
|
4
5
|
return resolveChannelPreviewStreamMode(params, "off");
|
|
5
6
|
}
|
|
6
7
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as normalizeDiscordToken } from "./token-BZtonk7d.js";
|
|
2
|
-
import { n as fetchDiscord, t as DiscordApiError } from "./api-
|
|
2
|
+
import { n as fetchDiscord, t as DiscordApiError } from "./api-DaTujGTe.js";
|
|
3
3
|
import { fetchWithTimeout } from "openclaw/plugin-sdk/text-runtime";
|
|
4
4
|
import { resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
5
5
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as resolveDiscordPrivilegedIntentsFromFlags, i as probeDiscord, n as fetchDiscordApplicationSummary, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-
|
|
1
|
+
import { a as resolveDiscordPrivilegedIntentsFromFlags, i as probeDiscord, n as fetchDiscordApplicationSummary, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-91lU5eh8.js";
|
|
2
2
|
export { fetchDiscordApplicationId, fetchDiscordApplicationSummary, parseApplicationIdFromToken, probeDiscord, resolveDiscordPrivilegedIntentsFromFlags };
|