@openclaw/discord 2026.11.5 → 2026.11.10-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/README.md +37 -0
- package/dist/.setup/{account-inspect-DGkdWwix.mjs → account-inspect-CSz5Qodj.mjs} +2 -3
- package/dist/.setup/{accounts-C_25wyxC.mjs → accounts-DtjvhJUj.mjs} +4 -8
- package/dist/.setup/{active-turn-thread-route-KvRTAVE3.mjs → active-turn-thread-route-DkPnk2x8.mjs} +1 -2
- package/dist/.setup/{allow-list-BXrS8-R9.mjs → allow-list-CkqpzPvP.mjs} +5 -9
- package/dist/.setup/{api-BlBD4ism.mjs → api-C4j_kC-2.mjs} +4 -6
- package/dist/.setup/{approval-handler.runtime-o2N6GRFH.mjs → approval-handler.runtime-DjtQbUPp.mjs} +10 -10
- package/dist/.setup/{approval-message-updates-DKsCfxSW.mjs → approval-message-updates-DqOXxPss.mjs} +3 -4
- package/dist/.setup/{audit-5b-FXj9R.mjs → audit-B9vk3V2z.mjs} +6 -7
- package/dist/.setup/{channel-CplVDtyZ.mjs → channel-Cihfaj84.mjs} +38 -41
- package/dist/.setup/{channel-access-9cyzozUP.mjs → channel-access-DhJhVrdZ.mjs} +1 -2
- package/dist/.setup/{channel.setup-B3MtmBQG.mjs → channel.setup-DmGdG9BH.mjs} +7 -10
- package/dist/.setup/{command-deploy-store-DFkBTViB.mjs → command-deploy-store-DPWiBMks.mjs} +1 -2
- package/dist/.setup/{command-owners-C7rUdqUX.mjs → command-owners-BzlhNBxA.mjs} +1 -2
- package/dist/.setup/{components-YCvQ6YLS.mjs → components-GePlato3.mjs} +10 -16
- package/dist/.setup/{components.base-CiS0h_XP.mjs → components.base-C5sAPHe4.mjs} +1 -2
- package/dist/.setup/config-DDwcUaxT.mjs +20 -0
- package/dist/.setup/{config-schema-BNKN1cu5.mjs → config-schema-D3M1livr.mjs} +5 -7
- package/dist/.setup/{conversation-binding-route-kCTw8cij.mjs → conversation-binding-route-CAaWWJdQ.mjs} +2 -3
- package/dist/.setup/conversation-fork-B6PiUuln.mjs +197 -0
- package/dist/.setup/{directory-config-Ble81PWH.mjs → directory-config-BXJuh9-J.mjs} +3 -4
- package/dist/.setup/directory-live-B9UoQG9g.mjs +90 -0
- package/dist/.setup/{discord-DGVSguhx.mjs → discord-cXPUdHQi.mjs} +98 -77
- package/dist/.setup/{doctor-eujgbnpZ.mjs → doctor-MTAWTgRa.mjs} +7 -8
- package/dist/.setup/{doctor-contract-Bwv8EuQ_.mjs → doctor-contract-Dstl3cMg.mjs} +2 -3
- package/dist/.setup/{endpoint-runtime-lf4DeLas.mjs → endpoint-runtime-BM3x-m6O.mjs} +1 -2
- package/dist/.setup/{guilds-eDq22iSM.mjs → guilds-DYBhgnfq.mjs} +3 -4
- package/dist/.setup/{handle-action-CktwmzMz.mjs → handle-action-El1ok7Ak.mjs} +13 -12
- package/dist/.setup/{handle-action.guild-admin-WLQ7fRqI.mjs → handle-action.guild-admin-CxYfg02j.mjs} +7 -5
- package/dist/.setup/identity-link-B7KOBo_l.mjs +74 -0
- package/dist/.setup/{listeners-Df8lx3vK.mjs → listeners-DIyynRvV.mjs} +2 -3
- package/dist/.setup/{live-policy-config-DiBVuaU6.mjs → live-policy-config-DjIHWFla.mjs} +3 -5
- package/dist/.setup/{message-handler-DeoWTD-4.mjs → message-handler-BoQcvdfV.mjs} +18 -17
- package/dist/.setup/{message-handler.preflight-DKOjgF0z.mjs → message-handler.preflight-C7uhmcsV.mjs} +20 -27
- package/dist/.setup/{message-handler.preflight-pluralkit-CYZfXXb6.mjs → message-handler.preflight-pluralkit-BFntgVKc.mjs} +10 -14
- package/dist/.setup/{message-handler.process-RKRgMCJy.mjs → message-handler.process-B29pkCxQ.mjs} +54 -66
- package/dist/.setup/oauth-http-DdVyzSbo.mjs +40 -0
- package/dist/.setup/{outbound-payload-BaZmjewa.mjs → outbound-payload-Dh6xCO6z.mjs} +18 -13
- package/dist/.setup/{outbound-session-route-Cgx4i9cS.mjs → outbound-session-route-G_fK5RAh.mjs} +22 -34
- package/dist/.setup/{output-activity-uBpMSX75.mjs → output-activity-CDgs2s3O.mjs} +1 -2
- package/dist/.setup/{pluralkit-B64dfq_j.mjs → pluralkit-DcXbHTpQ.mjs} +2 -3
- package/dist/.setup/{preflight-audio-C6QtD6HX.mjs → preflight-audio-r4BbaJxh.mjs} +1 -2
- package/dist/.setup/{presence-cache-Dq-3nH7R.mjs → presence-cache-B3xj3b0l.mjs} +1 -2
- package/dist/.setup/{probe-DezB-6xz.mjs → probe-CfGMZwFD.mjs} +5 -6
- package/dist/.setup/{provider-D63dgDSw.mjs → provider-CnDxdXUm.mjs} +252 -246
- package/dist/.setup/{provider-session.runtime-ePktW62k.mjs → provider-session.runtime-CCBGrm-d.mjs} +3 -3
- package/dist/.setup/provider.runtime-BoSMAwDb.mjs +1 -0
- package/dist/.setup/{proxy-fetch-BzXwBAXt.mjs → proxy-fetch-B8cK6FLQ.mjs} +1 -2
- package/dist/.setup/{realtime-session.runtime-rlZ3WzwC.mjs → realtime-session.runtime-OD95VAEG.mjs} +15 -25
- package/dist/.setup/{receive-recovery-C3Ks4wAQ.mjs → receive-recovery-DV_v5ROf.mjs} +3 -6
- package/dist/.setup/{resolve-allowlist-common-Bk8Fj6Ik.mjs → resolve-allowlist-common-CYdqBUgV.mjs} +3 -4
- package/dist/.setup/{resolve-channels-Bp8frXvc.mjs → resolve-channels-BNnyfCR8.mjs} +10 -9
- package/dist/.setup/{resolve-users-Cvcj22sG.mjs → resolve-users-CDMAGrzv.mjs} +5 -6
- package/dist/.setup/{rolldown-runtime-B4FMCO8f.mjs → rolldown-runtime-nwUcYXjP.mjs} +1 -2
- package/dist/.setup/{runtime-BJaCvlmq.mjs → runtime-CkeNX7ic.mjs} +62 -51
- package/dist/.setup/{runtime-BMgTyuwg.mjs → runtime-DSaHEGJd.mjs} +4 -24
- package/dist/.setup/{runtime-DgnVQ7zW.mjs → runtime-DcBvHOm1.mjs} +1 -2
- package/dist/.setup/{runtime-doctor-migrations-BPV-R4G9.mjs → runtime-doctor-migrations-BpV1jKk0.mjs} +5 -9
- package/dist/.setup/{secret-config-contract-B1kE4sDv.mjs → secret-config-contract-CP6teHec.mjs} +1 -2
- package/dist/.setup/{security-audit-BFT84Uny.mjs → security-audit-CTwisG7c.mjs} +3 -4
- package/dist/.setup/{security-contract-DNyyjTZZ.mjs → security-contract-D-o0iWDk.mjs} +1 -2
- package/dist/.setup/{security-doctor-nGgPm65L.mjs → security-doctor-4s7omTZd.mjs} +1 -2
- package/dist/.setup/{send-CVW7V-VZ.mjs → send-DKzwsZkm.mjs} +28 -32
- package/dist/.setup/{send.components-C8YXdnO_.mjs → send.components-CIZALYDP.mjs} +12 -14
- package/dist/.setup/{send.outbound-Uzcmh3Yd.mjs → send.outbound-cQ4Ohmsc.mjs} +11 -16
- package/dist/.setup/send.permissions-BvH_Dr8p.mjs +369 -0
- package/dist/.setup/{send.receipt-NZDOTZBU.mjs → send.receipt-CZ7ks6g7.mjs} +64 -17
- package/dist/.setup/send.shared-D2lh737v.mjs +259 -0
- package/dist/.setup/{sender-identity-76HFb8eK.mjs → sender-identity-Dt5ELjRN.mjs} +2 -3
- package/dist/.setup/{session-contract-BO5tlIdl.mjs → session-contract-Bq71MS78.mjs} +1 -2
- package/dist/.setup/{session-key-normalization-CCHGNSQw.mjs → session-key-normalization-Cfvze5hd.mjs} +1 -2
- package/dist/.setup/setup-plugin-api-BJt8tAAC.mjs +2 -0
- package/dist/.setup/{shared-yDUSExm2.mjs → shared-Bf7ifHlc.mjs} +14 -17
- package/dist/.setup/{shared-interactive-DmzaoKOM.mjs → shared-interactive-DKBw4SNV.mjs} +7 -12
- package/dist/.setup/{subagent-hooks-CDkdHQyy.mjs → subagent-hooks-CVmIOrAR.mjs} +4 -5
- package/dist/.setup/{system-events-yfWz150v.mjs → system-events-DB6p2H4l.mjs} +3 -4
- package/dist/.setup/{target-parsing-C-HyNxcE.mjs → target-parsing-BiuhcK9Q.mjs} +1 -2
- package/dist/.setup/{target-resolver-BOOzqxxM.mjs → target-resolver-48znkzky.mjs} +6 -7
- package/dist/.setup/{thread-binding-api-BDZJD4na.mjs → thread-binding-api-Drd4Zu-5.mjs} +1 -2
- package/dist/.setup/{thread-bindings-zce4cpu_.mjs → thread-bindings-DTHVdmvF.mjs} +7 -10
- package/dist/.setup/{thread-bindings.manager-NywKzUtc.mjs → thread-bindings.manager-6EnH3YZh.mjs} +45 -30
- package/dist/.setup/{thread-bindings.session-updates-D0j7oh8S.mjs → thread-bindings.session-updates-BPO6pPzd.mjs} +9 -12
- package/dist/.setup/{threading-DodLYDt-.mjs → threading-PC3IIaHd.mjs} +5 -7
- package/dist/.setup/{timeouts-cIxzatmv.mjs → timeouts-CT9hnmo4.mjs} +1 -2
- package/dist/.setup/{transcripts-source-ie9GBWaU.mjs → transcripts-source-C3F_ErM1.mjs} +33 -46
- package/dist/.setup/{typing-CNlSKY5S.mjs → typing-DAv4S2fI.mjs} +2 -3
- package/dist/.setup/{voice-runtime-Dc8Su9Cm.mjs → voice-runtime-CzV3fXxV.mjs} +28 -46
- package/dist/.source-module-urls/d6c089460280c5a04184542d6712e04545caeb1ebb290d3504377b4cc5e22fea.json +1 -1
- package/dist/account-inspect-api.js +2 -3
- package/dist/action-runtime-api.js +1 -1
- package/dist/activities-api.js +10 -50
- package/dist/api.js +21 -22
- package/dist/assets/embedded-app-sdk.mjs +1 -1
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/contract-api.js +1 -1
- package/dist/directory-contract-api.js +2 -3
- package/dist/doctor-contract-api.js +7 -8
- package/dist/index.js +1 -2
- package/dist/runtime-api.js +23 -22
- package/dist/runtime-setter-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/session-key-api.js +1 -1
- package/dist/setup-entry.js +2 -3
- package/dist/setup-plugin-api.js +1 -1
- package/dist/src/voice/audio-worker.runtime.js +14 -26
- package/dist/subagent-hooks-api.js +2 -3
- package/dist/thread-binding-api.js +1 -1
- package/dist/transcripts-source-api.js +2 -3
- package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.cjs +2 -3
- package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.mjs +2 -3
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/zlib.d.ts +752 -0
- package/node_modules/typebox/build/format/date_time.d.mts +2 -1
- package/node_modules/typebox/build/format/date_time.mjs +12 -3
- package/node_modules/typebox/package.json +1 -1
- package/openclaw.plugin.json +7 -2
- package/package.json +5 -5
- package/dist/.setup/directory-live-DH3tpS3x.mjs +0 -144
- package/dist/.setup/provider.runtime-DcNkwhPW.mjs +0 -1
- package/dist/.setup/send.shared-a_6Oeyg1.mjs +0 -589
- package/dist/.setup/setup-plugin-api-BExhGEhL.mjs +0 -2
package/dist/.setup/{message-handler.process-RKRgMCJy.mjs → message-handler.process-B29pkCxQ.mjs}
RENAMED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { m as resolveDiscordMaxLinesPerMessage } from "./accounts-
|
|
2
|
-
import {
|
|
3
|
-
import { D as editChannelMessage, E as deleteChannelMessage, K as captureDiscordRequestAuthority, P as getGuildMember, h as Message, q as withDiscordRequestAuthority, t as discord_exports } from "./discord-
|
|
4
|
-
import { i as normalizeDiscordAllowList, o as normalizeDiscordSlug } from "./allow-list-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { n as
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { t as
|
|
1
|
+
import { m as resolveDiscordMaxLinesPerMessage } from "./accounts-DtjvhJUj.mjs";
|
|
2
|
+
import { d as createDiscordRestClient, f as createDiscordRuntimeAccountContext } from "./send.permissions-BvH_Dr8p.mjs";
|
|
3
|
+
import { D as editChannelMessage, E as deleteChannelMessage, K as captureDiscordRequestAuthority, P as getGuildMember, h as Message, q as withDiscordRequestAuthority, t as discord_exports } from "./discord-cXPUdHQi.mjs";
|
|
4
|
+
import { i as normalizeDiscordAllowList, o as normalizeDiscordSlug } from "./allow-list-CkqpzPvP.mjs";
|
|
5
|
+
import { S as chunkDiscordTextWithMode, y as createDiscordRetryRunner } from "./send.receipt-CZ7ks6g7.mjs";
|
|
6
|
+
import { b as resolveDiscordMessageFlags, u as resolveDiscordTargetChannelId } from "./send.shared-D2lh737v.mjs";
|
|
7
|
+
import { n as resolveDiscordChannelId } from "./target-parsing-BiuhcK9Q.mjs";
|
|
8
|
+
import { a as removeReactionDiscord, r as reactMessageDiscord } from "./send-DKzwsZkm.mjs";
|
|
9
|
+
import { o as discordTextHasBroadcastMention } from "./send.outbound-cQ4Ohmsc.mjs";
|
|
10
|
+
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-CT9hnmo4.mjs";
|
|
11
|
+
import { S as discordInboundEventDelivery, _ as resolveDiscordConversationIdentity, p as buildDiscordRoutePeer } from "./outbound-session-route-G_fK5RAh.mjs";
|
|
12
|
+
import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-payload-Dh6xCO6z.mjs";
|
|
13
|
+
import { C as buildDiscordInboundAccessContext, c as formatDiscordReplySkip, d as buildGuildLabel, f as resolveReplyContext, l as sanitizeDiscordFrontChannelReplyPayloads, o as deliverDiscordReply, s as formatDiscordReplyDeliveryFailure, u as buildDirectLabel, w as createDiscordSupplementalContextAccessChecker } from "./provider-CnDxdXUm.mjs";
|
|
14
|
+
import { D as resolveDiscordMessageStickers, b as resolveDiscordMessageText, h as resolveDiscordThreadStarter, k as resolveDiscordReferencedReplyMessageId, v as resolveDiscordMessageHistoryText, w as resolveReferencedReplyMediaList, x as formatDiscordMediaText } from "./transcripts-source-C3F_ErM1.mjs";
|
|
15
|
+
import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-Dt5ELjRN.mjs";
|
|
16
|
+
import { n as resolveDiscordAutoThreadReplyPlan } from "./threading-PC3IIaHd.mjs";
|
|
17
|
+
import { t as beginDiscordActiveTurnThreadRoute } from "./active-turn-thread-route-DkPnk2x8.mjs";
|
|
18
|
+
import { a as createDiscordHistorySenderProvenance, l as isBoundThreadBotSystemMessage, o as filterDiscordHistoryEntriesForContext, p as shouldIgnoreBoundThreadWebhookMessage, s as resolveDiscordHistoryMediaIds, t as resolveDiscordPreflightPluralKitInfo } from "./message-handler.preflight-pluralkit-BFntgVKc.mjs";
|
|
19
|
+
import { t as sendTyping } from "./typing-DAv4S2fI.mjs";
|
|
19
20
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
20
21
|
import { danger, logVerbose, sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
21
22
|
import { buildAgentSessionKey, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
|
|
@@ -33,16 +34,16 @@ import { bindIngressLifecycleToReplyOptions, createChannelMessageReplyPipeline,
|
|
|
33
34
|
import { evaluateSupplementalContextVisibility } from "openclaw/plugin-sdk/security-runtime";
|
|
34
35
|
import { resolvePinnedMainDmOwnerFromAllowlist as resolvePinnedMainDmOwnerFromAllowlist$1 } from "openclaw/plugin-sdk/conversation-runtime";
|
|
35
36
|
import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
|
|
37
|
+
import { buildChannelInboundEventContext, createCommandTurnContext, dispatchChannelInboundTurn, formatInboundEnvelope, formatInboundMediaUnavailableText, getGroupThreadDeliverySession, readAgentRunTerminalOutcome, resolveEnvelopeFormatOptions, toHistoryMediaEntries, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
|
|
36
38
|
import { EmbeddedBlockChunker, resolveAckReaction, resolveAgentConfig, resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
|
|
37
39
|
import { getSessionEntryAsync, readSessionUpdatedAtAsync, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
38
|
-
import { buildChannelInboundEventContext, createCommandTurnContext, dispatchChannelInboundTurn, formatInboundEnvelope, formatInboundMediaUnavailableText, getGroupThreadDeliverySession, readAgentRunTerminalOutcome, resolveEnvelopeFormatOptions, toHistoryMediaEntries, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
|
|
39
40
|
import { readLatestAssistantTextByIdentity } from "openclaw/plugin-sdk/session-transcript-runtime";
|
|
40
41
|
import { getGlobalHookRunner } from "openclaw/plugin-sdk/plugin-runtime";
|
|
41
42
|
import { buildHistoryContextFromEntries, buildInboundHistoryFromEntries, createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
|
|
42
43
|
import { resolveChannelContextVisibilityMode } from "openclaw/plugin-sdk/context-visibility-runtime";
|
|
43
44
|
import { formatAudioTranscriptForAgent } from "openclaw/plugin-sdk/media-understanding-runtime";
|
|
44
45
|
import { createStatusReactionController, logAckFailure, logTypingFailure, shouldAckReaction } from "openclaw/plugin-sdk/channel-feedback";
|
|
45
|
-
|
|
46
|
+
// extensions/discord/src/monitor/message-handler.recent-history.ts
|
|
46
47
|
/** Fetch a physical recent window, never walking older pages to refill filtered rows. */
|
|
47
48
|
async function recoverDiscordChannelHistory(params) {
|
|
48
49
|
const { ctx, isCurrent } = params;
|
|
@@ -149,8 +150,7 @@ async function recoverDiscordChannelHistory(params) {
|
|
|
149
150
|
return [];
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
|
-
|
|
153
|
-
//#region extensions/discord/src/monitor/message-handler.retry.ts
|
|
153
|
+
// extensions/discord/src/monitor/message-handler.retry.ts
|
|
154
154
|
const REPLY_SESSION_INIT_CONFLICT_MESSAGE_RE = /^reply session initialization conflicted for \S+$/u;
|
|
155
155
|
const DISCORD_SESSION_CONFLICT_FAILURE_TEXT = "⚠️ Couldn't process this message because the session stayed busy. Please try again in a moment.";
|
|
156
156
|
async function completeDiscordSessionConflict(error, sourceReplyDeliveryMode, deliver, onDeliveryError) {
|
|
@@ -172,8 +172,7 @@ function removeDiscordReplayHistoryEntry(historyMap, historyKey, messageId) {
|
|
|
172
172
|
if (!history) return;
|
|
173
173
|
for (let index = history.length - 1; index >= 0; index -= 1) if (history[index]?.messageId === messageId) history.splice(index, 1);
|
|
174
174
|
}
|
|
175
|
-
|
|
176
|
-
//#region extensions/discord/src/monitor/message-handler.context.ts
|
|
175
|
+
// extensions/discord/src/monitor/message-handler.context.ts
|
|
177
176
|
function normalizeDiscordDmOwnerEntry(entry) {
|
|
178
177
|
const candidate = normalizeDiscordAllowList([entry], [
|
|
179
178
|
"discord:",
|
|
@@ -586,8 +585,7 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
586
585
|
replyPlan
|
|
587
586
|
};
|
|
588
587
|
}
|
|
589
|
-
|
|
590
|
-
//#region extensions/discord/src/monitor/message-handler.process-reactions.ts
|
|
588
|
+
// extensions/discord/src/monitor/message-handler.process-reactions.ts
|
|
591
589
|
function createDiscordMessageReactionRuntime(params) {
|
|
592
590
|
const { ctx } = params;
|
|
593
591
|
const { cfg, accountId, token, ackReactionScope, message, messageChannelId, isGuildMessage, isDirectMessage, isGroupDm, canDetectMention, effectiveWasMentioned, shouldBypassMention, route } = ctx;
|
|
@@ -716,8 +714,7 @@ function createDiscordMessageReactionRuntime(params) {
|
|
|
716
714
|
finish
|
|
717
715
|
};
|
|
718
716
|
}
|
|
719
|
-
|
|
720
|
-
//#region extensions/discord/src/draft-stream.ts
|
|
717
|
+
// extensions/discord/src/draft-stream.ts
|
|
721
718
|
/** Discord messages cap at 2000 characters. */
|
|
722
719
|
const DISCORD_STREAM_MAX_CHARS = 2e3;
|
|
723
720
|
const DEFAULT_THROTTLE_MS = 1200;
|
|
@@ -855,8 +852,7 @@ function createDiscordDraftStream(params) {
|
|
|
855
852
|
forceNewMessage: lifecycle.reset
|
|
856
853
|
};
|
|
857
854
|
}
|
|
858
|
-
|
|
859
|
-
//#region extensions/discord/src/monitor/message-handler.draft-preview.ts
|
|
855
|
+
// extensions/discord/src/monitor/message-handler.draft-preview.ts
|
|
860
856
|
function createDiscordDraftPreviewController(params) {
|
|
861
857
|
const runInChannelScope = AsyncLocalStorage.snapshot();
|
|
862
858
|
const assertChannelAuthority = captureDiscordRequestAuthority();
|
|
@@ -1171,8 +1167,7 @@ function isEmptyDiscordProgressLine(line) {
|
|
|
1171
1167
|
function shouldStartDiscordProgressDraftNow(line) {
|
|
1172
1168
|
return typeof line === "object" && line?.kind === "patch" && Boolean(line.detail);
|
|
1173
1169
|
}
|
|
1174
|
-
|
|
1175
|
-
//#region extensions/discord/src/monitor/message-handler.process-reply-runtime.ts
|
|
1170
|
+
// extensions/discord/src/monitor/message-handler.process-reply-runtime.ts
|
|
1176
1171
|
function formatDiscordGroupThreadReply(text, participant) {
|
|
1177
1172
|
return `**${participant.name.replace(/[\\`*_{}[\]()<>#!|]/g, "\\$&").replace(/\s+/g, " ")}**\n${text}`;
|
|
1178
1173
|
}
|
|
@@ -1193,7 +1188,7 @@ function createDiscordBeforePayloadDelivery(params) {
|
|
|
1193
1188
|
}));
|
|
1194
1189
|
return null;
|
|
1195
1190
|
}
|
|
1196
|
-
if (payload.isReasoning || payload.isCommentary) return payload;
|
|
1191
|
+
if (payload.isReasoning || payload.isCommentary || payload.isCompactionNotice) return payload;
|
|
1197
1192
|
if (params.draftPreview.draftStream && params.draftPreview.isProgressMode && info.kind === "block" && !resolveSendableOutboundReplyParts(payload).hasMedia && !payload.isError) return null;
|
|
1198
1193
|
if (info.kind === "final" && !params.isFallbackOnlyToolWarningFinal(payload)) params.draftPreview.freezeProgress();
|
|
1199
1194
|
return payload;
|
|
@@ -1307,8 +1302,7 @@ function createDiscordMessageReplyRuntime(params) {
|
|
|
1307
1302
|
resolvedBlockStreamingEnabled: resolveChannelStreamingBlockEnabled(discordConfig)
|
|
1308
1303
|
};
|
|
1309
1304
|
}
|
|
1310
|
-
|
|
1311
|
-
//#region extensions/discord/src/monitor/message-handler.process.ts
|
|
1305
|
+
// extensions/discord/src/monitor/message-handler.process.ts
|
|
1312
1306
|
const TARGETED_ONLY_ALLOWED_MENTIONS = { parse: [AllowedMentionsTypes.User, AllowedMentionsTypes.Role] };
|
|
1313
1307
|
function isFallbackOnlyToolWarningFinal(payload) {
|
|
1314
1308
|
if (payload.isError !== true || !isReplyPayloadNonTerminalToolErrorWarning(payload)) return false;
|
|
@@ -1357,26 +1351,9 @@ async function processDiscordMessage(ctx) {
|
|
|
1357
1351
|
if (!processContext) return;
|
|
1358
1352
|
const { ctxPayload, persistedSessionKey, record, replyPlan } = processContext;
|
|
1359
1353
|
let deliverTarget = replyPlan.deliverTarget;
|
|
1360
|
-
const sourceMessageId = ctx.canonicalMessageId ?? message.id;
|
|
1361
1354
|
const sourceReplyReference = replyPlan.replyReference;
|
|
1362
1355
|
let adoptedThreadId;
|
|
1363
1356
|
let threadReplyDelivered = false;
|
|
1364
|
-
let onThreadAdopted = void 0;
|
|
1365
|
-
const endActiveThreadRoute = beginDiscordActiveTurnThreadRoute(ctxPayload.SessionKey, {
|
|
1366
|
-
accountId,
|
|
1367
|
-
sourceChannelId: messageChannelId,
|
|
1368
|
-
sourceMessageId,
|
|
1369
|
-
onThreadAdopted: async (threadId) => {
|
|
1370
|
-
adoptedThreadId = threadId;
|
|
1371
|
-
await onThreadAdopted?.(threadId);
|
|
1372
|
-
},
|
|
1373
|
-
onThreadReplyDelivered: () => {
|
|
1374
|
-
threadReplyDelivered = true;
|
|
1375
|
-
},
|
|
1376
|
-
onThreadAdoptionError: (error) => {
|
|
1377
|
-
logVerbose(`discord: failed to move active progress into adopted thread (${String(error)})`);
|
|
1378
|
-
}
|
|
1379
|
-
});
|
|
1380
1357
|
const replyReference = {
|
|
1381
1358
|
peek: () => adoptedThreadId ? void 0 : sourceReplyReference.peek(),
|
|
1382
1359
|
use: () => adoptedThreadId ? void 0 : sourceReplyReference.use(),
|
|
@@ -1393,10 +1370,23 @@ async function processDiscordMessage(ctx) {
|
|
|
1393
1370
|
feedbackRest: reactions.feedbackRest,
|
|
1394
1371
|
deliveryRest: reactions.deliveryRest
|
|
1395
1372
|
});
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1373
|
+
const beginActiveThreadRoute = () => beginDiscordActiveTurnThreadRoute(ctxPayload.SessionKey, {
|
|
1374
|
+
accountId,
|
|
1375
|
+
sourceChannelId: messageChannelId,
|
|
1376
|
+
sourceMessageId: ctx.canonicalMessageId ?? message.id,
|
|
1377
|
+
onThreadAdopted: async (threadId) => {
|
|
1378
|
+
adoptedThreadId = threadId;
|
|
1379
|
+
deliverTarget = `channel:${threadId}`;
|
|
1380
|
+
await draftPreview.retarget(threadId);
|
|
1381
|
+
},
|
|
1382
|
+
onThreadReplyDelivered: () => {
|
|
1383
|
+
threadReplyDelivered = true;
|
|
1384
|
+
},
|
|
1385
|
+
onThreadAdoptionError: (error) => {
|
|
1386
|
+
logVerbose(`discord: failed to move active progress into adopted thread (${String(error)})`);
|
|
1387
|
+
}
|
|
1388
|
+
});
|
|
1389
|
+
const endActiveThreadRoute = beginActiveThreadRoute();
|
|
1400
1390
|
const { lifecycle } = draftPreview;
|
|
1401
1391
|
const hasCompletedFinalReply = () => lifecycle.finalSucceeded || lifecycle.previewFinalized;
|
|
1402
1392
|
const observeFinalDelivery = async () => {
|
|
@@ -1409,16 +1399,15 @@ async function processDiscordMessage(ctx) {
|
|
|
1409
1399
|
await retainedProgress;
|
|
1410
1400
|
};
|
|
1411
1401
|
let pendingToolWarningFinal;
|
|
1412
|
-
const progressSessionKey = ctxPayload.SessionKey;
|
|
1413
1402
|
const reasoningLevel = await (async () => {
|
|
1414
1403
|
const cfgDefault = resolveAgentConfig(cfg, route.agentId ?? "main")?.reasoningDefault ?? cfg.agents?.defaults?.reasoningDefault;
|
|
1415
1404
|
const configDefault = cfgDefault === "on" || cfgDefault === "stream" ? cfgDefault : "off";
|
|
1416
|
-
if (!
|
|
1405
|
+
if (!ctxPayload.SessionKey) return configDefault;
|
|
1417
1406
|
try {
|
|
1418
1407
|
const storePath = resolveStorePath(cfg.session?.store, { agentId: route.agentId });
|
|
1419
1408
|
const level = (await getSessionEntryAsync({
|
|
1420
1409
|
agentId: route.agentId,
|
|
1421
|
-
sessionKey:
|
|
1410
|
+
sessionKey: ctxPayload.SessionKey,
|
|
1422
1411
|
storePath
|
|
1423
1412
|
}))?.reasoningLevel;
|
|
1424
1413
|
if (level === "on" || level === "stream" || level === "off") return level;
|
|
@@ -1427,7 +1416,6 @@ async function processDiscordMessage(ctx) {
|
|
|
1427
1416
|
}
|
|
1428
1417
|
return configDefault;
|
|
1429
1418
|
})();
|
|
1430
|
-
const reasoningDurableEnabled = reasoningLevel === "on";
|
|
1431
1419
|
const reasoningWindowEnabled = reasoningLevel === "stream";
|
|
1432
1420
|
let shouldYieldDraftCommentary = async () => false;
|
|
1433
1421
|
let turnCommentaryVisible = false;
|
|
@@ -1451,7 +1439,7 @@ async function processDiscordMessage(ctx) {
|
|
|
1451
1439
|
progressPreambleEnabled: draftPreview.draftStream && draftPreview.isProgressMode ? true : void 0,
|
|
1452
1440
|
commentaryPayloadsEnabled: draftPreview.isProgressMode ? draftPreview.commentaryProgressEnabled : void 0,
|
|
1453
1441
|
shouldDeliverCommentaryPayloads: draftPreview.isProgressMode && draftPreview.commentaryProgressEnabled ? () => turnCommentaryVisible : void 0,
|
|
1454
|
-
reasoningPayloadsEnabled:
|
|
1442
|
+
reasoningPayloadsEnabled: reasoningLevel === "on",
|
|
1455
1443
|
onVerboseProgressVisibilityAsync: async (isActive) => {
|
|
1456
1444
|
shouldYieldDraftCommentary = isActive;
|
|
1457
1445
|
turnCommentaryVisible = await isActive();
|
|
@@ -1604,9 +1592,7 @@ async function processDiscordMessage(ctx) {
|
|
|
1604
1592
|
}
|
|
1605
1593
|
if (isFinal && !replyLifecycleStarted && !isRoomEvent && configuredTypingMode !== "never") await onDiscordReplyStart();
|
|
1606
1594
|
const draftStream = draftPreview.draftStream;
|
|
1607
|
-
if (draftStream && draftPreview.isProgressMode && info.kind === "block" && !deliverablePayload.isCommentary) {
|
|
1608
|
-
if (!resolveSendableOutboundReplyParts(deliverablePayload).hasMedia && !deliverablePayload.isError) return { visibleReplySent: false };
|
|
1609
|
-
}
|
|
1595
|
+
if (draftStream && draftPreview.isProgressMode && info.kind === "block" && !deliverablePayload.isCommentary && !deliverablePayload.isCompactionNotice && !resolveSendableOutboundReplyParts(deliverablePayload).hasMedia && !deliverablePayload.isError) return { visibleReplySent: false };
|
|
1610
1596
|
let deliveryResult = { visibleReplySent: false };
|
|
1611
1597
|
await lifecycle.deliver({
|
|
1612
1598
|
kind: info.kind,
|
|
@@ -1715,7 +1701,10 @@ async function processDiscordMessage(ctx) {
|
|
|
1715
1701
|
skillFilter: ctx.channelConfig?.skills,
|
|
1716
1702
|
sourceReplyDeliveryMode,
|
|
1717
1703
|
typingKeepalive: shouldDisableCoreTypingKeepalive ? false : void 0,
|
|
1718
|
-
queuedDeliveryCorrelations: isRoomEvent ? [{ begin: beginQueuedDeliveryCorrelation }] :
|
|
1704
|
+
queuedDeliveryCorrelations: [...isRoomEvent ? [{ begin: beginQueuedDeliveryCorrelation }] : [], { begin: () => {
|
|
1705
|
+
endActiveThreadRoute();
|
|
1706
|
+
return beginActiveThreadRoute();
|
|
1707
|
+
} }],
|
|
1719
1708
|
suppressTyping: isRoomEvent ? true : void 0,
|
|
1720
1709
|
allowProgressCallbacksWhenSourceDeliverySuppressed: sourceRepliesAreToolOnly && draftPreview.draftStream && draftPreview.isProgressMode ? true : void 0,
|
|
1721
1710
|
disableBlockStreaming: sourceRepliesAreToolOnly ? true : draftPreview.disableBlockStreamingForDraft ?? (typeof resolvedBlockStreamingEnabled === "boolean" ? !resolvedBlockStreamingEnabled : void 0),
|
|
@@ -1762,5 +1751,4 @@ async function processDiscordMessage(ctx) {
|
|
|
1762
1751
|
});
|
|
1763
1752
|
}
|
|
1764
1753
|
}
|
|
1765
|
-
//#endregion
|
|
1766
1754
|
export { processDiscordMessage };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { n as getDiscordEndpointRuntime } from "./endpoint-runtime-BM3x-m6O.mjs";
|
|
2
|
+
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
3
|
+
import { readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";
|
|
4
|
+
// extensions/discord/src/oauth-http.ts
|
|
5
|
+
const DISCORD_HOST = "discord.com";
|
|
6
|
+
const DISCORD_OAUTH_REQUEST_TIMEOUT_MS = 15e3;
|
|
7
|
+
const JSON_MAX_BYTES = 65536;
|
|
8
|
+
async function fetchDiscordJson(params) {
|
|
9
|
+
const endpoint = Object.hasOwn(params, "endpointRuntime") ? params.endpointRuntime : getDiscordEndpointRuntime();
|
|
10
|
+
const liveUrl = new URL(params.url);
|
|
11
|
+
const endpointPath = liveUrl.pathname === "/api/oauth2/token" ? "/oauth2/token" : liveUrl.pathname.startsWith("/api/v10/") ? liveUrl.pathname.slice(8) : void 0;
|
|
12
|
+
if (endpoint && !endpointPath) throw new Error("Discord request is outside the configured endpoint routes");
|
|
13
|
+
const { response, release } = endpoint ? {
|
|
14
|
+
response: await endpoint.fetch(`${endpoint.descriptor.restApiBaseUrl}${endpointPath}${liveUrl.search}`, {
|
|
15
|
+
...params.init,
|
|
16
|
+
signal: params.init.signal ? AbortSignal.any([params.init.signal, AbortSignal.timeout(DISCORD_OAUTH_REQUEST_TIMEOUT_MS)]) : AbortSignal.timeout(DISCORD_OAUTH_REQUEST_TIMEOUT_MS)
|
|
17
|
+
}),
|
|
18
|
+
release: async () => {}
|
|
19
|
+
} : await fetchWithSsrFGuard({
|
|
20
|
+
url: params.url,
|
|
21
|
+
fetchImpl: params.fetchImpl,
|
|
22
|
+
init: params.init,
|
|
23
|
+
policy: { allowedHostnames: [DISCORD_HOST] },
|
|
24
|
+
auditContext: params.auditContext,
|
|
25
|
+
timeoutMs: DISCORD_OAUTH_REQUEST_TIMEOUT_MS
|
|
26
|
+
});
|
|
27
|
+
try {
|
|
28
|
+
if (!response.ok) {
|
|
29
|
+
await response.body?.cancel().catch(() => void 0);
|
|
30
|
+
return { ok: false };
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
ok: true,
|
|
34
|
+
body: await readProviderJsonResponse(response, "Discord OAuth", { maxBytes: JSON_MAX_BYTES })
|
|
35
|
+
};
|
|
36
|
+
} finally {
|
|
37
|
+
await release();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export { fetchDiscordJson as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as createDiscordActionGate } from "./accounts-
|
|
2
|
-
import {
|
|
3
|
-
import { t as parseDiscordTarget } from "./target-parsing-
|
|
4
|
-
import { C as notifyDiscordInboundEventOutboundPayloadSuccess, S as discordInboundEventDelivery, a as resolveDiscordComponentSpec, c as formatDiscordApprovalDisplayValue, n as DISCORD_PRESENTATION_CAPABILITIES, o as sendDiscordComponentMessageLazy, r as buildDiscordPresentationPayload, v as resolveDiscordCurrentConversationIdentity } from "./outbound-session-route-
|
|
1
|
+
import { t as createDiscordActionGate } from "./accounts-DtjvhJUj.mjs";
|
|
2
|
+
import { S as chunkDiscordTextWithMode, _ as canFallbackDiscordWebhookSend, b as hasDiscordMessageCreateAmbiguity, c as normalizeDiscordMessagingTarget, g as resolveDiscordReplyReference, i as toDiscordOutboundDeliveryResult, l as normalizeDiscordOutboundTarget, n as createDiscordSendReceiptFromResults, t as createDiscordSendReceipt } from "./send.receipt-CZ7ks6g7.mjs";
|
|
3
|
+
import { t as parseDiscordTarget } from "./target-parsing-BiuhcK9Q.mjs";
|
|
4
|
+
import { C as notifyDiscordInboundEventOutboundPayloadSuccess, S as discordInboundEventDelivery, a as resolveDiscordComponentSpec, c as formatDiscordApprovalDisplayValue, n as DISCORD_PRESENTATION_CAPABILITIES, o as sendDiscordComponentMessageLazy, r as buildDiscordPresentationPayload, v as resolveDiscordCurrentConversationIdentity } from "./outbound-session-route-G_fK5RAh.mjs";
|
|
5
5
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
6
6
|
import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
|
|
7
7
|
import { asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -11,7 +11,7 @@ import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
|
11
11
|
import { createReplyToFanout, resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-outbound";
|
|
12
12
|
import { attachChannelToResult, createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
|
|
13
13
|
import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
|
|
14
|
-
|
|
14
|
+
// extensions/discord/src/channel.conversation.ts
|
|
15
15
|
function resolveDiscordAttachedOutboundTarget(params) {
|
|
16
16
|
if (params.threadId == null) return params.to;
|
|
17
17
|
const threadId = normalizeOptionalStringifiedId(params.threadId) ?? "";
|
|
@@ -72,9 +72,8 @@ function resolveDiscordInboundConversation(params) {
|
|
|
72
72
|
});
|
|
73
73
|
return conversationId ? { conversationId } : null;
|
|
74
74
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-CVW7V-VZ.mjs").then((n) => n.t));
|
|
75
|
+
// extensions/discord/src/outbound-payload.ts
|
|
76
|
+
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-DKzwsZkm.mjs").then((n) => n.t));
|
|
78
77
|
function resolveDiscordDeliveryOptions(ctx) {
|
|
79
78
|
return {
|
|
80
79
|
onPlatformSendDispatch: ctx.onPlatformSendDispatch,
|
|
@@ -162,8 +161,8 @@ const DISCORD_VIDEO_MEDIA_EXTENSIONS = [
|
|
|
162
161
|
".webm"
|
|
163
162
|
];
|
|
164
163
|
const log = createSubsystemLogger("discord/outbound");
|
|
165
|
-
const loadDiscordThreadBindings = createLazyRuntimeModule(() => import("./thread-bindings-
|
|
166
|
-
const loadDiscordComponentSendRuntime = createLazyRuntimeModule(() => import("./send.components-
|
|
164
|
+
const loadDiscordThreadBindings = createLazyRuntimeModule(() => import("./thread-bindings-DTHVdmvF.mjs").then((n) => n.i));
|
|
165
|
+
const loadDiscordComponentSendRuntime = createLazyRuntimeModule(() => import("./send.components-CIZALYDP.mjs").then((n) => n.i));
|
|
167
166
|
const discordOutbound = {
|
|
168
167
|
deliveryMode: "direct",
|
|
169
168
|
chunker: (text, limit, ctx) => chunkDiscordTextWithMode(text, {
|
|
@@ -253,11 +252,16 @@ const discordOutbound = {
|
|
|
253
252
|
return completeDelivery(lastResult);
|
|
254
253
|
}
|
|
255
254
|
const discordData = asOptionalRecord(payload.channelData?.discord) ?? {};
|
|
255
|
+
const literalText = discordData.literalText === true;
|
|
256
|
+
const literalOptions = literalText ? {
|
|
257
|
+
suppressEmbeds: true,
|
|
258
|
+
allowedMentions: { parse: [] }
|
|
259
|
+
} : {};
|
|
256
260
|
const filename = normalizeOptionalString(discordData.filename);
|
|
257
261
|
const componentSpec = await resolveDiscordComponentSpec(payload);
|
|
258
262
|
const nativeComponents = !componentSpec && Array.isArray(discordData.components) ? discordData.components : void 0;
|
|
259
263
|
const embeds = !componentSpec && Array.isArray(discordData.embeds) ? discordData.embeds : void 0;
|
|
260
|
-
if (!componentSpec && !nativeComponents && !embeds?.length && !filename) return completeResult(await sendTextMediaPayload({
|
|
264
|
+
if (!literalText && !componentSpec && !nativeComponents && !embeds?.length && !filename) return completeResult(await sendTextMediaPayload({
|
|
261
265
|
channel: "discord",
|
|
262
266
|
ctx: payloadContext,
|
|
263
267
|
adapter: discordOutbound
|
|
@@ -273,7 +277,8 @@ const discordOutbound = {
|
|
|
273
277
|
components: nativeComponents,
|
|
274
278
|
embeds,
|
|
275
279
|
filename,
|
|
276
|
-
...sendContext.options()
|
|
280
|
+
...sendContext.options(),
|
|
281
|
+
...literalOptions
|
|
277
282
|
}),
|
|
278
283
|
send: async ({ text, mediaUrl, isFirst }) => {
|
|
279
284
|
if (componentSpec && isFirst) return await sendDiscordComponentMessageLazy(sendContext.target, componentSpec, {
|
|
@@ -282,6 +287,7 @@ const discordOutbound = {
|
|
|
282
287
|
});
|
|
283
288
|
return await sendContext.send(sendContext.target, text, {
|
|
284
289
|
...sendContext.mediaOptions(mediaUrl),
|
|
290
|
+
...literalOptions,
|
|
285
291
|
...!componentSpec ? {
|
|
286
292
|
components: isFirst ? nativeComponents : void 0,
|
|
287
293
|
embeds: isFirst ? embeds : void 0,
|
|
@@ -443,5 +449,4 @@ const discordOutbound = {
|
|
|
443
449
|
await manager.touchThread({ threadId });
|
|
444
450
|
}
|
|
445
451
|
};
|
|
446
|
-
//#endregion
|
|
447
452
|
export { resolveDiscordInboundConversation as a, resolveDiscordCommandConversation as i, discordOutbound as n, resolveDiscordAttachedOutboundTarget as r, DISCORD_TEXT_CHUNK_LIMIT as t };
|
package/dist/.setup/{outbound-session-route-Cgx4i9cS.mjs → outbound-session-route-G_fK5RAh.mjs}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { d as resolveDiscordAccountConfig, i as listDiscordAccountIds, l as resolveDiscordAccount, t as createDiscordActionGate } from "./accounts-
|
|
2
|
-
import { t as inspectDiscordAccount } from "./account-inspect-
|
|
3
|
-
import { w as isDiscordThreadChannelType } from "./allow-list-
|
|
4
|
-
import { c as normalizeDiscordMessagingTarget, s as matchesDiscordToolContextTarget } from "./send.receipt-
|
|
5
|
-
import { t as parseDiscordTarget } from "./target-parsing-
|
|
6
|
-
import { c as coerceDiscordComponentParam, l as readDiscordComponentSpec } from "./components-
|
|
7
|
-
import { n as resolveDiscordCommandOwnerEntries } from "./command-owners-
|
|
1
|
+
import { d as resolveDiscordAccountConfig, i as listDiscordAccountIds, l as resolveDiscordAccount, t as createDiscordActionGate } from "./accounts-DtjvhJUj.mjs";
|
|
2
|
+
import { t as inspectDiscordAccount } from "./account-inspect-CSz5Qodj.mjs";
|
|
3
|
+
import { w as isDiscordThreadChannelType } from "./allow-list-CkqpzPvP.mjs";
|
|
4
|
+
import { c as normalizeDiscordMessagingTarget, s as matchesDiscordToolContextTarget } from "./send.receipt-CZ7ks6g7.mjs";
|
|
5
|
+
import { t as parseDiscordTarget } from "./target-parsing-BiuhcK9Q.mjs";
|
|
6
|
+
import { c as coerceDiscordComponentParam, l as readDiscordComponentSpec } from "./components-GePlato3.mjs";
|
|
7
|
+
import { n as resolveDiscordCommandOwnerEntries } from "./command-owners-BzlhNBxA.mjs";
|
|
8
8
|
import { createLazyRuntimeMethod, createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
9
9
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
10
10
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
@@ -22,7 +22,7 @@ import { resolveApprovalApprovers } from "openclaw/plugin-sdk/approval-auth-runt
|
|
|
22
22
|
import { extractToolSend } from "openclaw/plugin-sdk/tool-send";
|
|
23
23
|
import { createInboundEventDeliveryCorrelation } from "openclaw/plugin-sdk/inbound-event-delivery";
|
|
24
24
|
import { resolveScopeRequireMention, resolveScopeToolsPolicy } from "openclaw/plugin-sdk/channel-policy";
|
|
25
|
-
|
|
25
|
+
// extensions/discord/src/exec-approvals.ts
|
|
26
26
|
function normalizeDiscordApproverId(value) {
|
|
27
27
|
const trimmed = String(value).trim();
|
|
28
28
|
if (!trimmed) return;
|
|
@@ -67,8 +67,7 @@ function shouldSuppressLocalDiscordExecApprovalPrompt(params) {
|
|
|
67
67
|
sessionFilter: config?.sessionFilter
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
//#region extensions/discord/src/audit-core.ts
|
|
70
|
+
// extensions/discord/src/audit-core.ts
|
|
72
71
|
const REQUIRED_TEXT_CHANNEL_PERMISSIONS = ["ViewChannel", "SendMessages"];
|
|
73
72
|
const REQUIRED_THREAD_CHANNEL_PERMISSIONS = ["ViewChannel", "SendMessagesInThreads"];
|
|
74
73
|
const REQUIRED_VOICE_CHANNEL_PERMISSIONS = [
|
|
@@ -143,8 +142,7 @@ async function auditDiscordChannelPermissionsWithFetcher(params) {
|
|
|
143
142
|
elapsedMs: Date.now() - started
|
|
144
143
|
};
|
|
145
144
|
}
|
|
146
|
-
|
|
147
|
-
//#region extensions/discord/src/inbound-event-delivery.ts
|
|
145
|
+
// extensions/discord/src/inbound-event-delivery.ts
|
|
148
146
|
const DISCORD_INBOUND_EVENT_DELIVERY_KEY = "__openclawInboundEventDelivery";
|
|
149
147
|
function normalizeDiscordDeliveryTarget(value) {
|
|
150
148
|
return value.trim().replace(/^discord:/iu, "").replace(/^channel:/iu, "").toLowerCase();
|
|
@@ -181,8 +179,7 @@ function notifyDiscordInboundEventOutboundPayloadSuccess(params) {
|
|
|
181
179
|
accountId: params.accountId
|
|
182
180
|
});
|
|
183
181
|
}
|
|
184
|
-
|
|
185
|
-
//#region extensions/discord/src/trusted-requester-actions.ts
|
|
182
|
+
// extensions/discord/src/trusted-requester-actions.ts
|
|
186
183
|
const trustedRequesterGuildAdminActions = /* @__PURE__ */ new Set([
|
|
187
184
|
"emoji-upload",
|
|
188
185
|
"sticker-upload",
|
|
@@ -203,8 +200,7 @@ const trustedRequesterGuildAdminActions = /* @__PURE__ */ new Set([
|
|
|
203
200
|
function isTrustedRequesterGuildAdminAction(action) {
|
|
204
201
|
return trustedRequesterGuildAdminActions.has(action);
|
|
205
202
|
}
|
|
206
|
-
|
|
207
|
-
//#region extensions/discord/src/channel-actions.ts
|
|
203
|
+
// extensions/discord/src/channel-actions.ts
|
|
208
204
|
const localExecutionActions = /* @__PURE__ */ new Set([
|
|
209
205
|
"send",
|
|
210
206
|
"poll",
|
|
@@ -215,7 +211,7 @@ const localExecutionActions = /* @__PURE__ */ new Set([
|
|
|
215
211
|
"sticker-upload",
|
|
216
212
|
"event-create"
|
|
217
213
|
]);
|
|
218
|
-
const loadDiscordChannelActionsRuntime = createLazyRuntimeModule(() => import("./handle-action-
|
|
214
|
+
const loadDiscordChannelActionsRuntime = createLazyRuntimeModule(() => import("./handle-action-El1ok7Ak.mjs"));
|
|
219
215
|
const discordActionGroups = [
|
|
220
216
|
{
|
|
221
217
|
gate: "polls",
|
|
@@ -455,8 +451,7 @@ const discordMessageActions = {
|
|
|
455
451
|
...sessionKey ? { sessionKey } : {}
|
|
456
452
|
})
|
|
457
453
|
};
|
|
458
|
-
|
|
459
|
-
//#region extensions/discord/src/conversation-identity.ts
|
|
454
|
+
// extensions/discord/src/conversation-identity.ts
|
|
460
455
|
function normalizeDiscordTarget(raw, defaultKind) {
|
|
461
456
|
return parseDiscordTarget(raw ?? "", { defaultKind })?.normalized;
|
|
462
457
|
}
|
|
@@ -485,8 +480,7 @@ function resolveDiscordCurrentConversationIdentity(params) {
|
|
|
485
480
|
if (target) return target;
|
|
486
481
|
}
|
|
487
482
|
}
|
|
488
|
-
|
|
489
|
-
//#region extensions/discord/src/monitor/route-resolution.ts
|
|
483
|
+
// extensions/discord/src/monitor/route-resolution.ts
|
|
490
484
|
function buildDiscordRoutePeer(params) {
|
|
491
485
|
return {
|
|
492
486
|
kind: params.isGroupDm ? "group" : params.isDirectMessage ? "direct" : "channel",
|
|
@@ -556,8 +550,7 @@ function shouldIgnoreStaleDiscordRouteBinding(params) {
|
|
|
556
550
|
if (!bound || !routed || bound.rest !== routed.rest) return false;
|
|
557
551
|
return bound.agentId !== params.route.agentId;
|
|
558
552
|
}
|
|
559
|
-
|
|
560
|
-
//#region extensions/discord/src/channel-policy-state.ts
|
|
553
|
+
// extensions/discord/src/channel-policy-state.ts
|
|
561
554
|
const policyBindings = resolveGlobalMap(Symbol.for("openclaw.discord.policy-bindings"), "close-and-restart");
|
|
562
555
|
function setDiscordPolicyBindings(accountId, bindings, guilds = /* @__PURE__ */ new Map()) {
|
|
563
556
|
policyBindings.set(normalizeAccountId(accountId), {
|
|
@@ -574,8 +567,7 @@ function getDiscordChannelPolicyBinding(accountId, guildKey, channelKey) {
|
|
|
574
567
|
function findDiscordChannelPolicyKey(accountId, guildKey, channelId) {
|
|
575
568
|
return policyBindings.get(normalizeAccountId(accountId))?.channels.find((binding) => binding.guildKey === guildKey && binding.channelId === channelId)?.channelKey;
|
|
576
569
|
}
|
|
577
|
-
|
|
578
|
-
//#region extensions/discord/src/group-policy.ts
|
|
570
|
+
// extensions/discord/src/group-policy.ts
|
|
579
571
|
function resolveDiscordGuildKey(guilds, groupSpace, accountId) {
|
|
580
572
|
if (!guilds || Object.keys(guilds).length === 0) return;
|
|
581
573
|
const space = normalizeOptionalString(groupSpace) ?? "";
|
|
@@ -637,8 +629,7 @@ function resolveDiscordGroupToolPolicy(params) {
|
|
|
637
629
|
senderE164: params.senderE164
|
|
638
630
|
});
|
|
639
631
|
}
|
|
640
|
-
|
|
641
|
-
//#region extensions/discord/src/approval-message-safety.ts
|
|
632
|
+
// extensions/discord/src/approval-message-safety.ts
|
|
642
633
|
const DISCORD_APPROVAL_ALLOWED_MENTIONS = { parse: [] };
|
|
643
634
|
const DISCORD_MARKDOWN_META_CHARACTERS = /* @__PURE__ */ new Set([
|
|
644
635
|
"\\",
|
|
@@ -681,8 +672,7 @@ function formatDiscordApprovalDisplayValue(value) {
|
|
|
681
672
|
}
|
|
682
673
|
return escaped;
|
|
683
674
|
}
|
|
684
|
-
|
|
685
|
-
//#region extensions/discord/src/outbound-components.ts
|
|
675
|
+
// extensions/discord/src/outbound-components.ts
|
|
686
676
|
const DISCORD_MESSAGE_COMPONENT_LIMIT = 40;
|
|
687
677
|
const DISCORD_TEXT_DISPLAY_LIMIT = 2e3;
|
|
688
678
|
const DISCORD_PRESENTATION_CAPABILITIES = {
|
|
@@ -712,8 +702,8 @@ const DISCORD_PRESENTATION_CAPABILITIES = {
|
|
|
712
702
|
}
|
|
713
703
|
}
|
|
714
704
|
};
|
|
715
|
-
const sendDiscordComponentMessageLazy = createLazyRuntimeMethod(createLazyRuntimeModule(() => import("./send.components-
|
|
716
|
-
const loadDiscordSharedInteractive = createLazyRuntimeModule(() => import("./shared-interactive-
|
|
705
|
+
const sendDiscordComponentMessageLazy = createLazyRuntimeMethod(createLazyRuntimeModule(() => import("./send.components-CIZALYDP.mjs").then((n) => n.i)), (runtime) => runtime.sendDiscordComponentMessage);
|
|
706
|
+
const loadDiscordSharedInteractive = createLazyRuntimeModule(() => import("./shared-interactive-DKBw4SNV.mjs").then((n) => n.r));
|
|
717
707
|
function addPayloadTextFallback(spec, payload) {
|
|
718
708
|
return spec.text ? spec : {
|
|
719
709
|
...spec,
|
|
@@ -768,8 +758,7 @@ async function resolveDiscordComponentSpec(payload) {
|
|
|
768
758
|
const interactiveSpec = (await loadDiscordSharedInteractive()).buildDiscordInteractiveComponents(payload.interactive);
|
|
769
759
|
return interactiveSpec ? addPayloadTextFallback(interactiveSpec, payload) : void 0;
|
|
770
760
|
}
|
|
771
|
-
|
|
772
|
-
//#region extensions/discord/src/outbound-session-route.ts
|
|
761
|
+
// extensions/discord/src/outbound-session-route.ts
|
|
773
762
|
function resolveDiscordOutboundSessionRoute(params) {
|
|
774
763
|
const parsed = parseDiscordTarget(params.target, { defaultKind: resolveDiscordOutboundTargetKindHint(params) });
|
|
775
764
|
if (!parsed) return null;
|
|
@@ -809,5 +798,4 @@ function resolveDiscordOutboundTargetKindHint(params) {
|
|
|
809
798
|
if (resolvedKind === "group" || resolvedKind === "channel") return "channel";
|
|
810
799
|
return /^(user:|discord:|@|<@!?)/i.test(params.target.trim()) ? "user" : "channel";
|
|
811
800
|
}
|
|
812
|
-
//#endregion
|
|
813
801
|
export { shouldSuppressLocalDiscordExecApprovalPrompt as A, notifyDiscordInboundEventOutboundPayloadSuccess as C, getDiscordExecApprovalApprovers as D, resolveRequiredDiscordChannelPermissions as E, isDiscordExecApprovalApprover as O, discordInboundEventDelivery as S, collectDiscordAuditChannelIdsForAccount as T, resolveDiscordConversationIdentity as _, resolveDiscordComponentSpec as a, discordMessageActions as b, formatDiscordApprovalDisplayValue as c, setDiscordPolicyBindings as d, buildDiscordConversationRouteContext as f, shouldIgnoreStaleDiscordRouteBinding as g, resolveDiscordEffectiveRoute as h, isDiscordComponentSpecWithinMessageLimit as i, isDiscordExecApprovalClientEnabled as k, resolveDiscordGroupRequireMention as l, resolveDiscordConversationRoute as m, DISCORD_PRESENTATION_CAPABILITIES as n, sendDiscordComponentMessageLazy as o, buildDiscordRoutePeer as p, buildDiscordPresentationPayload as r, DISCORD_APPROVAL_ALLOWED_MENTIONS as s, resolveDiscordOutboundSessionRoute as t, resolveDiscordGroupToolPolicy as u, resolveDiscordCurrentConversationIdentity as v, auditDiscordChannelPermissionsWithFetcher as w, isTrustedRequesterGuildAdminAction as x, resolveDiscordRuntimeBindingConversationId as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// extensions/discord/src/voice/output-activity.ts
|
|
2
2
|
function resolveDiscordOutputAudioDelta(previous, sourceAudioBytes) {
|
|
3
3
|
const sinkAudioBytes = Math.floor((previous.sourceAudioBytes + sourceAudioBytes) / 2) * 8 - previous.sinkAudioBytes;
|
|
4
4
|
return {
|
|
@@ -7,5 +7,4 @@ function resolveDiscordOutputAudioDelta(previous, sourceAudioBytes) {
|
|
|
7
7
|
sinkAudioBytes
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
|
-
//#endregion
|
|
11
10
|
export { resolveDiscordOutputAudioDelta as t };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
|
|
2
2
|
import { resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
3
3
|
import { redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
|
|
4
4
|
import { readProviderJsonObjectResponse, readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
|
|
5
5
|
import { buildTimeoutAbortSignal } from "openclaw/plugin-sdk/extension-shared";
|
|
6
|
-
|
|
6
|
+
// extensions/discord/src/pluralkit.ts
|
|
7
7
|
var pluralkit_exports = /* @__PURE__ */ __exportAll({ fetchPluralKitMessageInfo: () => fetchPluralKitMessageInfo });
|
|
8
8
|
const PLURALKIT_API_BASE = "https://api.pluralkit.me/v2";
|
|
9
9
|
const PLURALKIT_ERROR_BODY_LIMIT_BYTES = 8192;
|
|
@@ -41,5 +41,4 @@ async function fetchPluralKitMessageInfo(params) {
|
|
|
41
41
|
timeout.cleanup();
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
//#endregion
|
|
45
44
|
export { pluralkit_exports as n, fetchPluralKitMessageInfo as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
2
|
import { getFileExtension } from "openclaw/plugin-sdk/media-mime";
|
|
3
3
|
import { createChannelPreflightAudio } from "openclaw/plugin-sdk/media-understanding-runtime";
|
|
4
|
-
|
|
4
|
+
// extensions/discord/src/monitor/preflight-audio.ts
|
|
5
5
|
const AUDIO_ATTACHMENT_MIME_BY_EXT = /* @__PURE__ */ new Map([
|
|
6
6
|
[".aac", "audio/aac"],
|
|
7
7
|
[".caf", "audio/x-caf"],
|
|
@@ -55,5 +55,4 @@ async function resolveDiscordPreflightAudioMentionContext(params) {
|
|
|
55
55
|
transcript
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
//#endregion
|
|
59
58
|
export { resolveDiscordPreflightAudioMentionContext };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
2
|
-
|
|
2
|
+
// extensions/discord/src/monitor/presence-cache.ts
|
|
3
3
|
/**
|
|
4
4
|
* In-memory cache of Discord user presence data.
|
|
5
5
|
* Populated by GUILD_CREATE snapshots and PRESENCE_UPDATE when GuildPresences is enabled.
|
|
@@ -27,5 +27,4 @@ function clearPresences(accountId) {
|
|
|
27
27
|
}
|
|
28
28
|
presenceCache.clear();
|
|
29
29
|
}
|
|
30
|
-
//#endregion
|
|
31
30
|
export { getPresence as n, setPresence as r, clearPresences as t };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { h as normalizeDiscordToken } from "./accounts-
|
|
3
|
-
import { n as getDiscordEndpointRuntime } from "./endpoint-runtime-
|
|
4
|
-
import { n as DiscordApiError, r as fetchDiscord } from "./api-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
|
|
2
|
+
import { h as normalizeDiscordToken } from "./accounts-DtjvhJUj.mjs";
|
|
3
|
+
import { n as getDiscordEndpointRuntime } from "./endpoint-runtime-BM3x-m6O.mjs";
|
|
4
|
+
import { n as DiscordApiError, r as fetchDiscord } from "./api-C4j_kC-2.mjs";
|
|
5
5
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
6
6
|
import { ApplicationFlags } from "discord-api-types/v10";
|
|
7
7
|
import { resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
8
8
|
import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
|
|
9
9
|
import { fetchWithTimeout, runChannelProbe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
10
|
-
|
|
10
|
+
// extensions/discord/src/probe.ts
|
|
11
11
|
var probe_exports = /* @__PURE__ */ __exportAll({
|
|
12
12
|
fetchDiscordApplicationId: () => fetchDiscordApplicationId,
|
|
13
13
|
fetchDiscordApplicationSummary: () => fetchDiscordApplicationSummary,
|
|
@@ -167,5 +167,4 @@ async function fetchDiscordApplicationId(token, timeoutMs, fetcher = fetch) {
|
|
|
167
167
|
if (result.kind === "resolved") return result.applicationId;
|
|
168
168
|
if (result.kind === "unavailable" && result.status === 429) throw result.error;
|
|
169
169
|
}
|
|
170
|
-
//#endregion
|
|
171
170
|
export { probeDiscordApplicationId as a, probeDiscord as i, fetchDiscordApplicationSummary as n, probe_exports as o, parseApplicationIdFromToken as r, resolveDiscordPrivilegedIntentsFromFlags as s, fetchDiscordApplicationId as t };
|