@openclaw/discord 2026.11.1 → 2026.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.setup/{account-inspect-X_Xlr42B.mjs → account-inspect-8cCu6uPG.mjs} +3 -2
- package/dist/.setup/{accounts-C18HNgge.mjs → accounts-ljrzXBJi.mjs} +8 -4
- package/dist/.setup/{active-turn-thread-route-BAc_Xik-.mjs → active-turn-thread-route-C4tp9noA.mjs} +2 -1
- package/dist/.setup/{allow-list-D1ZGfhXh.mjs → allow-list-BKqOldGy.mjs} +11 -6
- package/dist/.setup/{api-Bth1wKF9.mjs → api-DqmMUZau.mjs} +5 -3
- package/dist/.setup/{approval-handler.runtime-krznjTz9.mjs → approval-handler.runtime-D0qu1um7.mjs} +9 -8
- package/dist/.setup/{approval-message-updates-Cks-MSCJ.mjs → approval-message-updates-CdurC9Ej.mjs} +4 -3
- package/dist/.setup/{audit-Dw_rAZIz.mjs → audit-ChorIwio.mjs} +7 -6
- package/dist/.setup/{channel-DwvRHJL0.mjs → channel-ZilgdF5e.mjs} +41 -33
- package/dist/.setup/{channel-access-BPrWoEXM.mjs → channel-access-DasWY_OV.mjs} +2 -1
- package/dist/.setup/{channel.setup-BHjvtK1U.mjs → channel.setup-DaDQdctj.mjs} +12 -8
- package/dist/.setup/{command-deploy-store-DPWiBMks.mjs → command-deploy-store-DFkBTViB.mjs} +2 -1
- package/dist/.setup/{command-owners-BzlhNBxA.mjs → command-owners-C7rUdqUX.mjs} +2 -1
- package/dist/.setup/{components-BvOWSPxr.mjs → components-Du9NhD8h.mjs} +20 -11
- package/dist/.setup/{config-schema-Coyq5wOr.mjs → config-schema-_uBILpQf.mjs} +5 -3
- package/dist/.setup/{conversation-binding-route-DOPUZNYo.mjs → conversation-binding-route-8Ul1KpGF.mjs} +3 -2
- package/dist/.setup/{directory-config-CIqVnQtn.mjs → directory-config-3iVub-3m.mjs} +4 -3
- package/dist/.setup/{directory-live-DUuPEWub.mjs → directory-live-BDVl2DoC.mjs} +15 -14
- package/dist/.setup/{discord-eFlHX1Gn.mjs → discord-BMD-JiVS.mjs} +68 -35
- package/dist/.setup/{doctor-contract-Dstl3cMg.mjs → doctor-contract-Bwv8EuQ_.mjs} +3 -2
- package/dist/.setup/{doctor-Cg_N6ZOI.mjs → doctor-hQKbkNKq.mjs} +9 -8
- package/dist/.setup/{handle-action-DXY91jF-.mjs → handle-action-B1lmt4ms.mjs} +11 -10
- package/dist/.setup/{handle-action.guild-admin-BvBCfhXF.mjs → handle-action.guild-admin-B6g31cwt.mjs} +4 -3
- package/dist/.setup/{live-policy-config-DO1Fk2hp.mjs → live-policy-config-C_Q966Wh.mjs} +5 -3
- package/dist/.setup/{message-handler-TR7l1P3P.mjs → message-handler-CkI3yMjL.mjs} +16 -11
- package/dist/.setup/{message-handler.preflight-DxGb4zsm.mjs → message-handler.preflight-CEfkFV9U.mjs} +28 -20
- package/dist/.setup/{message-handler.preflight-pluralkit-BTE5JebL.mjs → message-handler.preflight-pluralkit-D5si80_L.mjs} +14 -10
- package/dist/.setup/{message-handler.process-DVHZKc2e.mjs → message-handler.process-DsMtetRf.mjs} +47 -33
- package/dist/.setup/{outbound-adapter-DWyAWBFh.mjs → outbound-adapter-DfAanoCO.mjs} +19 -13
- package/dist/.setup/{outbound-session-route-TFBPPkoz.mjs → outbound-session-route-BtUpGBTb.mjs} +32 -21
- package/dist/.setup/{output-activity-CDgs2s3O.mjs → output-activity-uBpMSX75.mjs} +2 -1
- package/dist/.setup/{pluralkit-DcXbHTpQ.mjs → pluralkit-B64dfq_j.mjs} +3 -2
- package/dist/.setup/{preflight-audio-CwtPIsvk.mjs → preflight-audio-wWgsZG5F.mjs} +2 -1
- package/dist/.setup/{presence-cache-CgutE4NN.mjs → presence-cache-DCeTsL73.mjs} +2 -1
- package/dist/.setup/{probe-DNge7OEP.mjs → probe-CBaoCs-c.mjs} +6 -5
- package/dist/.setup/{provider-C61K7HHq.mjs → provider-CI_OLfvz.mjs} +209 -119
- package/dist/.setup/{provider-session.runtime-D87e36ut.mjs → provider-session.runtime-TWOo_JZx.mjs} +3 -3
- package/dist/.setup/provider.runtime-DnionCyo.mjs +2 -0
- package/dist/.setup/{realtime-session.runtime-D1YHKwbc.mjs → realtime-session.runtime-DvfS4vJj.mjs} +23 -14
- package/dist/.setup/{receive-recovery-C77CVdGM.mjs → receive-recovery-CKvaG2Hf.mjs} +6 -3
- package/dist/.setup/{resolve-allowlist-common-CI77288n.mjs → resolve-allowlist-common-cIjtqh2F.mjs} +7 -5
- package/dist/.setup/{resolve-channels-DYc6-xgV.mjs → resolve-channels-Cj5i7hzj.mjs} +10 -7
- package/dist/.setup/{resolve-users-BQT7XWF2.mjs → resolve-users-BQLbysRB.mjs} +5 -4
- package/dist/.setup/{rolldown-runtime-nwUcYXjP.mjs → rolldown-runtime-B4FMCO8f.mjs} +2 -1
- package/dist/.setup/{runtime-DcBvHOm1.mjs → runtime-DgnVQ7zW.mjs} +2 -1
- package/dist/.setup/{runtime-CI0UJqeS.mjs → runtime-RWnuJgWB.mjs} +35 -23
- package/dist/.setup/{runtime-doctor-migrations-BpV1jKk0.mjs → runtime-doctor-migrations-BPV-R4G9.mjs} +9 -5
- package/dist/.setup/{runtime-CcijhTJT.mjs → runtime-plifsKg9.mjs} +6 -4
- package/dist/.setup/{secret-config-contract-B7UlqVYr.mjs → secret-config-contract-z6FhbT8E.mjs} +2 -1
- package/dist/.setup/{security-audit-CTwisG7c.mjs → security-audit-BFT84Uny.mjs} +4 -3
- package/dist/.setup/{security-contract-D-o0iWDk.mjs → security-contract-DNyyjTZZ.mjs} +2 -1
- package/dist/.setup/{security-doctor-4s7omTZd.mjs → security-doctor-nGgPm65L.mjs} +2 -1
- package/dist/.setup/{send-Cbq-IVsS.mjs → send-da6ENJ9f.mjs} +28 -18
- package/dist/.setup/{send.components-BV6ucNpJ.mjs → send.components-CWZUuGvA.mjs} +15 -10
- package/dist/.setup/{send.outbound-CGhBhzjQ.mjs → send.outbound-qZ3iK3Vq.mjs} +13 -9
- package/dist/.setup/{send.receipt-Dw-_r5Bx.mjs → send.receipt-C18khRYH.mjs} +16 -9
- package/dist/.setup/{send.shared-D4MioxW_.mjs → send.shared-CnlMgoqQ.mjs} +23 -14
- package/dist/.setup/{sender-identity-DrN5c4ec.mjs → sender-identity-DgbJykq0.mjs} +3 -2
- package/dist/.setup/{session-contract-Bq71MS78.mjs → session-contract-BO5tlIdl.mjs} +2 -1
- package/dist/.setup/{session-key-normalization-Cfvze5hd.mjs → session-key-normalization-CCHGNSQw.mjs} +2 -1
- package/dist/.setup/setup-plugin-api-D1QuM187.mjs +3 -0
- package/dist/.setup/{shared-_o59Fvrr.mjs → shared-CY5vJM48.mjs} +19 -15
- package/dist/.setup/{subagent-hooks-mQbDkvuD.mjs → subagent-hooks-CIu2TFz3.mjs} +4 -3
- package/dist/.setup/{system-events-2zc2eGfF.mjs → system-events-DCOLXkwS.mjs} +4 -3
- package/dist/.setup/{target-parsing-BiuhcK9Q.mjs → target-parsing-C-HyNxcE.mjs} +2 -1
- package/dist/.setup/{target-resolver-CAHeVfmZ.mjs → target-resolver-CApivu3G.mjs} +7 -6
- package/dist/.setup/targets-UWWZ6gF7.mjs +3 -0
- package/dist/.setup/{thread-binding-api-Drd4Zu-5.mjs → thread-binding-api-BDZJD4na.mjs} +2 -1
- package/dist/.setup/{thread-bindings-Dg7X_ZXP.mjs → thread-bindings-DcvT_JgI.mjs} +11 -8
- package/dist/.setup/{thread-bindings.manager-DCDYksah.mjs → thread-bindings.manager-5Sh7yedN.mjs} +20 -15
- package/dist/.setup/{thread-bindings.session-updates-C76plLS3.mjs → thread-bindings.session-updates-BMdJeJMc.mjs} +9 -5
- package/dist/.setup/{threading-BKn_OF3K.mjs → threading-CzjFeUSe.mjs} +9 -6
- package/dist/.setup/{timeouts-DTrUsJ_W.mjs → timeouts-CuNARfyw.mjs} +2 -1
- package/dist/.setup/{transcripts-source-BSorJ4AS.mjs → transcripts-source-8RDQrSVb.mjs} +32 -19
- package/dist/.setup/{typing-DAv4S2fI.mjs → typing-CNlSKY5S.mjs} +3 -2
- package/dist/.setup/{voice-runtime-B5m2Ryg8.mjs → voice-runtime-BsDILmAv.mjs} +55 -33
- package/dist/account-inspect-api.js +3 -2
- package/dist/action-runtime-api.js +2 -1
- package/dist/activities-api.js +20 -13
- package/dist/api.js +22 -21
- package/dist/channel-config-api.js +2 -1
- package/dist/channel-plugin-api.js +2 -1
- package/dist/contract-api.js +2 -1
- package/dist/directory-contract-api.js +3 -2
- package/dist/doctor-contract-api.js +7 -5
- package/dist/index.js +2 -1
- package/dist/runtime-api.js +22 -22
- package/dist/runtime-setter-api.js +2 -1
- package/dist/secret-contract-api.js +2 -1
- package/dist/security-audit-contract-api.js +2 -1
- package/dist/security-contract-api.js +2 -1
- package/dist/session-key-api.js +2 -1
- package/dist/setup-entry.js +3 -2
- package/dist/setup-plugin-api.js +2 -1
- package/dist/src/voice/audio-worker.runtime.js +14 -8
- package/dist/subagent-hooks-api.js +3 -2
- package/dist/thread-binding-api.js +2 -1
- package/dist/transcripts-source-api.js +3 -2
- package/package.json +4 -4
- package/dist/.setup/provider.runtime-xk5CVdoI.mjs +0 -1
- package/dist/.setup/setup-plugin-api-DGfQO4Ec.mjs +0 -2
- package/dist/.setup/targets-BaklhOqq.mjs +0 -3
- package/dist/.source-module-urls/d6c089460280c5a04184542d6712e04545caeb1ebb290d3504377b4cc5e22fea.json +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { D as getDiscordEndpointRuntime, O as resolveDiscordEndpointAttachmentGuard, T as parseDiscordRetryAfterBodySeconds } from "./allow-list-
|
|
3
|
-
import { C as hasAnyChannelPermissionDiscord, D as createDiscordMessageNonce, I as resolveDiscordClientAccountContext, L as resolveDiscordRest, M as parseAndResolveChannelRecipient, N as createDiscordClient, O as resolveDiscordMessageFlags, R as DISCORD_REST_TIMEOUT_MS, S as hasAllGuildPermissionsDiscord, _ as canManageGuildMemberRoleDiscord, a as normalizeEmojiName, b as fetchChannelPermissionsDiscord, c as resolveChannelId, d as sendDiscordChunks, g as DiscordSendError, h as DISCORD_MAX_STICKER_BYTES, j as resolveDiscordSuppressEmbeds, m as DISCORD_MAX_EVENT_COVER_BYTES, n as buildDiscordTextChunks, o as normalizeReactionEmoji, p as DISCORD_MAX_EMOJI_BYTES, r as buildReactionIdentifier, t as buildDiscordSendError, v as canManageGuildRoleDiscord, w as hasAnyGuildPermissionDiscord, x as fetchMemberGuildPermissionsDiscord, y as canViewDiscordGuildChannel } from "./send.shared-
|
|
4
|
-
import { B as isUnknownDiscordVoiceStateError, G as withDiscordRequestAuthority, H as readDiscordMessage, L as DiscordError, R as RateLimitError, U as readRetryAfter, V as readDiscordCode, _t as getGuild, at as createOwnMessageReaction, bt as listGuildEmojis, dt as editChannelMessage, ft as getChannel, gt as unpinChannelMessage, ht as pinChannelMessage, lt as createThread, ot as deleteOwnMessageReaction, pt as getChannelMessage, st as listMessageReactionUsers, ut as deleteChannelMessage, vt as getGuildMember, xt as stripUndefinedFields, yt as getGuildVoiceState, z as isUnknownDiscordMessageError } from "./discord-
|
|
5
|
-
import { _ as recordDiscordMessageCreateAmbiguity, a as createReusableDiscordReplyReference, h as createDiscordRetryRunner, m as classifyDiscordDeliveryFailure, n as createDiscordSendReceiptFromResults, o as resolveDiscordReplyMessageId, r as createDiscordSendResult, v as chunkDiscordTextWithMode } from "./send.receipt-
|
|
6
|
-
import { o as parseDiscordHttpErrorBody } from "./api-
|
|
7
|
-
import { a as prepareDiscordOutboundText, n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-
|
|
8
|
-
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS } from "./timeouts-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
+
import { D as getDiscordEndpointRuntime, O as resolveDiscordEndpointAttachmentGuard, T as parseDiscordRetryAfterBodySeconds } from "./allow-list-BKqOldGy.mjs";
|
|
3
|
+
import { C as hasAnyChannelPermissionDiscord, D as createDiscordMessageNonce, I as resolveDiscordClientAccountContext, L as resolveDiscordRest, M as parseAndResolveChannelRecipient, N as createDiscordClient, O as resolveDiscordMessageFlags, R as DISCORD_REST_TIMEOUT_MS, S as hasAllGuildPermissionsDiscord, _ as canManageGuildMemberRoleDiscord, a as normalizeEmojiName, b as fetchChannelPermissionsDiscord, c as resolveChannelId, d as sendDiscordChunks, g as DiscordSendError, h as DISCORD_MAX_STICKER_BYTES, j as resolveDiscordSuppressEmbeds, m as DISCORD_MAX_EVENT_COVER_BYTES, n as buildDiscordTextChunks, o as normalizeReactionEmoji, p as DISCORD_MAX_EMOJI_BYTES, r as buildReactionIdentifier, t as buildDiscordSendError, v as canManageGuildRoleDiscord, w as hasAnyGuildPermissionDiscord, x as fetchMemberGuildPermissionsDiscord, y as canViewDiscordGuildChannel } from "./send.shared-CnlMgoqQ.mjs";
|
|
4
|
+
import { B as isUnknownDiscordVoiceStateError, G as withDiscordRequestAuthority, H as readDiscordMessage, L as DiscordError, R as RateLimitError, U as readRetryAfter, V as readDiscordCode, _t as getGuild, at as createOwnMessageReaction, bt as listGuildEmojis, dt as editChannelMessage, ft as getChannel, gt as unpinChannelMessage, ht as pinChannelMessage, lt as createThread, ot as deleteOwnMessageReaction, pt as getChannelMessage, st as listMessageReactionUsers, ut as deleteChannelMessage, vt as getGuildMember, xt as stripUndefinedFields, yt as getGuildVoiceState, z as isUnknownDiscordMessageError } from "./discord-BMD-JiVS.mjs";
|
|
5
|
+
import { _ as recordDiscordMessageCreateAmbiguity, a as createReusableDiscordReplyReference, h as createDiscordRetryRunner, m as classifyDiscordDeliveryFailure, n as createDiscordSendReceiptFromResults, o as resolveDiscordReplyMessageId, r as createDiscordSendResult, v as chunkDiscordTextWithMode } from "./send.receipt-C18khRYH.mjs";
|
|
6
|
+
import { o as parseDiscordHttpErrorBody } from "./api-DqmMUZau.mjs";
|
|
7
|
+
import { a as prepareDiscordOutboundText, n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-qZ3iK3Vq.mjs";
|
|
8
|
+
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS } from "./timeouts-CuNARfyw.mjs";
|
|
9
9
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
10
10
|
import { resolvePreferredOpenClawTmpDir, withTempWorkspace } from "openclaw/plugin-sdk/temp-path";
|
|
11
11
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -24,7 +24,7 @@ import { buildTimeoutAbortSignal } from "openclaw/plugin-sdk/extension-shared";
|
|
|
24
24
|
import fs from "node:fs/promises";
|
|
25
25
|
import path from "node:path";
|
|
26
26
|
import { writeExternalFileWithinRoot } from "openclaw/plugin-sdk/security-runtime";
|
|
27
|
-
|
|
27
|
+
//#region extensions/discord/src/send.channels.ts
|
|
28
28
|
async function createChannelDiscord(payload, opts) {
|
|
29
29
|
const rest = resolveDiscordRest(opts);
|
|
30
30
|
const body = stripUndefinedFields({
|
|
@@ -90,7 +90,8 @@ async function removeChannelPermissionDiscord(channelId, targetId, opts) {
|
|
|
90
90
|
await resolveDiscordRest(opts).delete(Routes.channelPermission(channelId, targetId));
|
|
91
91
|
return { ok: true };
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region extensions/discord/src/send.emojis-stickers.ts
|
|
94
95
|
const DISCORD_IMAGE_UPLOAD_TYPES = [
|
|
95
96
|
"image/png",
|
|
96
97
|
"image/jpeg",
|
|
@@ -148,7 +149,8 @@ async function uploadStickerDiscord(payload, opts) {
|
|
|
148
149
|
}
|
|
149
150
|
});
|
|
150
151
|
}
|
|
151
|
-
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region extensions/discord/src/send.guild.ts
|
|
152
154
|
function readDiscordResource(read) {
|
|
153
155
|
return async (id, opts) => await read(resolveDiscordRest(opts), id);
|
|
154
156
|
}
|
|
@@ -227,7 +229,8 @@ async function banMemberDiscord(payload, opts) {
|
|
|
227
229
|
});
|
|
228
230
|
return { ok: true };
|
|
229
231
|
}
|
|
230
|
-
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region extensions/discord/src/send.messages.ts
|
|
231
234
|
const DISCORD_THREAD_TRANSPORT_ONLY_MAX_LINES = Number.MAX_SAFE_INTEGER;
|
|
232
235
|
function resolveDiscordThreadStarterMessageId(thread) {
|
|
233
236
|
const starterMessage = "message" in thread ? thread.message : void 0;
|
|
@@ -418,7 +421,8 @@ async function searchMessagesDiscord(query, opts) {
|
|
|
418
421
|
if (!Array.isArray(result.messages)) throw new Error("Unexpected Discord response for message search: expected messages array.");
|
|
419
422
|
return result;
|
|
420
423
|
}
|
|
421
|
-
|
|
424
|
+
//#endregion
|
|
425
|
+
//#region extensions/discord/src/send.webhook.ts
|
|
422
426
|
const DISCORD_WEBHOOK_ERROR_BODY_LIMIT_BYTES = 8192;
|
|
423
427
|
const DISCORD_WEBHOOK_TIMEOUT_MS = DISCORD_REST_TIMEOUT_MS;
|
|
424
428
|
function throwIfWebhookDeadlineExpired(signal) {
|
|
@@ -543,7 +547,8 @@ async function sendWebhookMessageDiscord(text, opts) {
|
|
|
543
547
|
deadline.cleanup();
|
|
544
548
|
}
|
|
545
549
|
}
|
|
546
|
-
|
|
550
|
+
//#endregion
|
|
551
|
+
//#region extensions/discord/src/voice-message.ts
|
|
547
552
|
const WAVEFORM_SAMPLES = 256;
|
|
548
553
|
const DISCORD_OPUS_SAMPLE_RATE_HZ = 48e3;
|
|
549
554
|
const DISCORD_VOICE_ERROR_BODY_LIMIT_BYTES = 8192;
|
|
@@ -812,7 +817,8 @@ async function sendDiscordVoiceMessage(rest, channelId, audioBuffer, metadata, r
|
|
|
812
817
|
throw error;
|
|
813
818
|
}
|
|
814
819
|
}
|
|
815
|
-
|
|
820
|
+
//#endregion
|
|
821
|
+
//#region extensions/discord/src/send.voice.ts
|
|
816
822
|
/** Discord voice messages require OGG/Opus audio with a waveform and cannot include text. */
|
|
817
823
|
async function sendVoiceMessageDiscord(to, audioPath, opts) {
|
|
818
824
|
return await withDiscordRequestAuthority(opts.assertPlatformSendAuthorized, async () => {
|
|
@@ -872,7 +878,8 @@ async function sendVoiceMessageDiscord(to, audioPath, opts) {
|
|
|
872
878
|
});
|
|
873
879
|
});
|
|
874
880
|
}
|
|
875
|
-
|
|
881
|
+
//#endregion
|
|
882
|
+
//#region extensions/discord/src/send.typing.ts
|
|
876
883
|
async function sendTypingDiscord(channelId, opts) {
|
|
877
884
|
await resolveDiscordRest(opts).post(Routes.channelTyping(channelId));
|
|
878
885
|
return {
|
|
@@ -880,7 +887,8 @@ async function sendTypingDiscord(channelId, opts) {
|
|
|
880
887
|
channelId
|
|
881
888
|
};
|
|
882
889
|
}
|
|
883
|
-
|
|
890
|
+
//#endregion
|
|
891
|
+
//#region extensions/discord/src/send.reactions.ts
|
|
884
892
|
function resolveDiscordReactionClient(opts) {
|
|
885
893
|
if (opts.rest && opts.cfg && opts.accountId) return createDiscordClient(opts);
|
|
886
894
|
const cfg = requireRuntimeConfig(opts.cfg, "Discord reactions");
|
|
@@ -944,7 +952,8 @@ async function fetchReactionsDiscord(channelId, messageId, opts) {
|
|
|
944
952
|
}
|
|
945
953
|
return summaries;
|
|
946
954
|
}
|
|
947
|
-
|
|
955
|
+
//#endregion
|
|
956
|
+
//#region extensions/discord/src/send.ts
|
|
948
957
|
var send_exports = /* @__PURE__ */ __exportAll({
|
|
949
958
|
DiscordSendError: () => DiscordSendError,
|
|
950
959
|
DiscordThreadInitialMessageError: () => DiscordThreadInitialMessageError,
|
|
@@ -1000,4 +1009,5 @@ var send_exports = /* @__PURE__ */ __exportAll({
|
|
|
1000
1009
|
uploadEmojiDiscord: () => uploadEmojiDiscord,
|
|
1001
1010
|
uploadStickerDiscord: () => uploadStickerDiscord
|
|
1002
1011
|
});
|
|
1012
|
+
//#endregion
|
|
1003
1013
|
export { listScheduledEventsDiscord as A, moveChannelDiscord as B, fetchChannelInfoDiscord as C, fetchVoiceStatusDiscord as D, fetchRoleInfoDiscord as E, uploadEmojiDiscord as F, setChannelPermissionDiscord as H, uploadStickerDiscord as I, createChannelDiscord as L, resolveEventCoverImage as M, timeoutMemberDiscord as N, kickMemberDiscord as O, listGuildEmojisDiscord as P, deleteChannelDiscord as R, createScheduledEventDiscord as S, fetchMemberInfoDiscord as T, removeChannelPermissionDiscord as V, readMessagesDiscord as _, removeReactionDiscord as a, addRoleDiscord as b, sendWebhookMessageDiscord as c, deleteMessageDiscord as d, editMessageDiscord as f, pinMessageDiscord as g, listThreadsDiscord as h, removeOwnReactionsDiscord as i, removeRoleDiscord as j, listGuildChannelsDiscord as k, DiscordThreadInitialMessageError as l, listPinsDiscord as m, fetchReactionsDiscord as n, sendTypingDiscord as o, fetchMessageDiscord as p, reactMessageDiscord as r, sendVoiceMessageDiscord as s, send_exports as t, createThreadDiscord as u, searchMessagesDiscord as v, fetchGuildInfoDiscord as w, banMemberDiscord as x, unpinMessageDiscord as y, editChannelDiscord as z };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { D as createDiscordMessageNonce, M as parseAndResolveChannelRecipient, N as createDiscordClient, T as SUPPRESS_NOTIFICATIONS_FLAG, c as resolveChannelId, l as resolveDiscordChannel, t as buildDiscordSendError } from "./send.shared-
|
|
3
|
-
import { G as withDiscordRequestAuthority, ct as createChannelMessage, dt as editChannelMessage, q as serializePayload } from "./discord-
|
|
4
|
-
import { r as createDiscordSendResult } from "./send.receipt-
|
|
5
|
-
import { t as sendMessageDiscord } from "./send.outbound-
|
|
6
|
-
import { d as buildDiscordComponentMessage, f as buildDiscordComponentMessageFlags, g as resolveDiscordComponentAttachmentName } from "./components-
|
|
7
|
-
import { n as getOptionalDiscordRuntime } from "./runtime-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
+
import { D as createDiscordMessageNonce, M as parseAndResolveChannelRecipient, N as createDiscordClient, T as SUPPRESS_NOTIFICATIONS_FLAG, c as resolveChannelId, l as resolveDiscordChannel, t as buildDiscordSendError } from "./send.shared-CnlMgoqQ.mjs";
|
|
3
|
+
import { G as withDiscordRequestAuthority, ct as createChannelMessage, dt as editChannelMessage, q as serializePayload } from "./discord-BMD-JiVS.mjs";
|
|
4
|
+
import { r as createDiscordSendResult } from "./send.receipt-C18khRYH.mjs";
|
|
5
|
+
import { t as sendMessageDiscord } from "./send.outbound-qZ3iK3Vq.mjs";
|
|
6
|
+
import { d as buildDiscordComponentMessage, f as buildDiscordComponentMessageFlags, g as resolveDiscordComponentAttachmentName } from "./components-Du9NhD8h.mjs";
|
|
7
|
+
import { n as getOptionalDiscordRuntime } from "./runtime-DgnVQ7zW.mjs";
|
|
8
8
|
import { hasNonEmptyString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
9
|
import { ChannelType } from "discord-api-types/v10";
|
|
10
10
|
import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
|
|
@@ -15,7 +15,7 @@ import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runt
|
|
|
15
15
|
import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
|
|
16
16
|
import { createPluginStateErrorReporter } from "openclaw/plugin-sdk/plugin-state-runtime";
|
|
17
17
|
import { createAsyncLock } from "openclaw/plugin-sdk/async-lock-runtime";
|
|
18
|
-
|
|
18
|
+
//#region extensions/discord/src/components-registry-state.ts
|
|
19
19
|
const discordComponentRegistryState = resolveGlobalSingleton(Symbol.for("openclaw.discord.componentRegistryState"), () => ({
|
|
20
20
|
withRegistryLock: createAsyncLock(),
|
|
21
21
|
componentEntries: /* @__PURE__ */ new Map(),
|
|
@@ -30,7 +30,8 @@ const discordComponentRegistryState = resolveGlobalSingleton(Symbol.for("opencla
|
|
|
30
30
|
state.persistentModalStore = void 0;
|
|
31
31
|
state.persistentRegistryDisabled = false;
|
|
32
32
|
}));
|
|
33
|
-
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region extensions/discord/src/components-registry.ts
|
|
34
35
|
const DEFAULT_COMPONENT_TTL_MS = 18e5;
|
|
35
36
|
const PERSISTENT_COMPONENT_NAMESPACE = "discord.components";
|
|
36
37
|
const PERSISTENT_MODAL_NAMESPACE = "discord.modals";
|
|
@@ -178,6 +179,8 @@ function registerDiscordComponentEntries(params) {
|
|
|
178
179
|
return discordComponentRegistryState.withRegistryLock(async () => {
|
|
179
180
|
for (const entry of normalizedEntries) discordComponentRegistryState.componentEntries.set(entry.id, entry);
|
|
180
181
|
for (const entry of normalizedModals) discordComponentRegistryState.modalEntries.set(entry.id, entry);
|
|
182
|
+
const pruneAt = Date.now();
|
|
183
|
+
for (const store of [discordComponentRegistryState.componentEntries, discordComponentRegistryState.modalEntries]) for (const [id, entry] of store) if (entry.expiresAt !== void 0 && !isFutureDateTimestampMs(entry.expiresAt, { nowMs: pruneAt })) store.delete(id);
|
|
181
184
|
await Promise.all([registerPersistentRegistryEntries({
|
|
182
185
|
entries: normalizedEntries,
|
|
183
186
|
ttlMs,
|
|
@@ -223,7 +226,8 @@ async function resolveDiscordModalEntryWithPersistence(params) {
|
|
|
223
226
|
});
|
|
224
227
|
});
|
|
225
228
|
}
|
|
226
|
-
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region extensions/discord/src/send.components.ts
|
|
227
231
|
var send_components_exports = /* @__PURE__ */ __exportAll({
|
|
228
232
|
editDiscordComponentMessage: () => editDiscordComponentMessage,
|
|
229
233
|
registerBuiltDiscordComponentMessage: () => registerBuiltDiscordComponentMessage,
|
|
@@ -402,4 +406,5 @@ async function writeDiscordComponentMessage(to, spec, opts, messageId) {
|
|
|
402
406
|
});
|
|
403
407
|
return deliveryResult ?? toDeliveryResult();
|
|
404
408
|
}
|
|
409
|
+
//#endregion
|
|
405
410
|
export { registerDiscordComponentEntries as a, send_components_exports as i, registerBuiltDiscordComponentMessage as n, resolveDiscordComponentEntryWithPersistence as o, sendDiscordComponentMessage as r, resolveDiscordModalEntryWithPersistence as s, editDiscordComponentMessage as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { A as resolveDiscordSendEmbeds, D as createDiscordMessageNonce, E as buildDiscordMessageRequest, M as parseAndResolveChannelRecipient, N as createDiscordClient, O as resolveDiscordMessageFlags, c as resolveChannelId, d as sendDiscordChunks, f as sendDiscordMedia, i as normalizeDiscordPollInput, j as resolveDiscordSuppressEmbeds, k as resolveDiscordSendComponents, l as resolveDiscordChannel, n as buildDiscordTextChunks, s as normalizeStickerIds, t as buildDiscordSendError } from "./send.shared-
|
|
3
|
-
import { G as withDiscordRequestAuthority, ct as createChannelMessage, lt as createThread } from "./discord-
|
|
4
|
-
import { a as createReusableDiscordReplyReference, n as createDiscordSendReceiptFromResults, r as createDiscordSendResult } from "./send.receipt-
|
|
5
|
-
import { a as normalizeDiscordSnowflake, i as normalizeDiscordHandleKey, s as resolveDiscordDirectoryUserId } from "./directory-live-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
+
import { A as resolveDiscordSendEmbeds, D as createDiscordMessageNonce, E as buildDiscordMessageRequest, M as parseAndResolveChannelRecipient, N as createDiscordClient, O as resolveDiscordMessageFlags, c as resolveChannelId, d as sendDiscordChunks, f as sendDiscordMedia, i as normalizeDiscordPollInput, j as resolveDiscordSuppressEmbeds, k as resolveDiscordSendComponents, l as resolveDiscordChannel, n as buildDiscordTextChunks, s as normalizeStickerIds, t as buildDiscordSendError } from "./send.shared-CnlMgoqQ.mjs";
|
|
3
|
+
import { G as withDiscordRequestAuthority, ct as createChannelMessage, lt as createThread } from "./discord-BMD-JiVS.mjs";
|
|
4
|
+
import { a as createReusableDiscordReplyReference, n as createDiscordSendReceiptFromResults, r as createDiscordSendResult } from "./send.receipt-C18khRYH.mjs";
|
|
5
|
+
import { a as normalizeDiscordSnowflake, i as normalizeDiscordHandleKey, s as resolveDiscordDirectoryUserId } from "./directory-live-BDVl2DoC.mjs";
|
|
6
6
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { ChannelType } from "discord-api-types/v10";
|
|
8
8
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
@@ -13,7 +13,7 @@ import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
|
13
13
|
import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runtime";
|
|
14
14
|
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
15
15
|
import { fromMarkdown } from "mdast-util-from-markdown";
|
|
16
|
-
|
|
16
|
+
//#region extensions/discord/src/mentions.ts
|
|
17
17
|
const MENTION_CANDIDATE_PATTERN = /(^|[\s([{"'.,;:!?])@([a-z0-9_.-]{2,32}(?:#[0-9]{4})?)/gi;
|
|
18
18
|
const DISCORD_RESERVED_MENTIONS = /* @__PURE__ */ new Set(["everyone", "here"]);
|
|
19
19
|
const DISCORD_DISCRIMINATOR_SUFFIX = /#\d{4}$/;
|
|
@@ -108,7 +108,8 @@ function rewriteDiscordKnownMentions(text, params) {
|
|
|
108
108
|
function discordTextHasBroadcastMention(text) {
|
|
109
109
|
return DISCORD_BROADCAST_MENTION_PATTERN.test(text);
|
|
110
110
|
}
|
|
111
|
-
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region extensions/discord/src/markdown.ts
|
|
112
113
|
const DISCORD_NATIVE_TOKEN_RE = /<a?:[A-Za-z0-9_]+:\d+>|<\/[^>]+:\d+>/giu;
|
|
113
114
|
const DISCORD_URL_START_RE = /(?:[A-Za-z][A-Za-z0-9+.-]*:\/\/|www\.)/giu;
|
|
114
115
|
function findDiscordUrlRanges(markdown) {
|
|
@@ -345,7 +346,8 @@ function normalizeDiscordBold(markdown) {
|
|
|
345
346
|
function renderDiscordMarkdown(markdown, tableMode) {
|
|
346
347
|
return normalizeDiscordBold(convertMarkdownTables(markdown, tableMode));
|
|
347
348
|
}
|
|
348
|
-
|
|
349
|
+
//#endregion
|
|
350
|
+
//#region extensions/discord/src/outbound-text.ts
|
|
349
351
|
function prepareDiscordOutboundText(text, params) {
|
|
350
352
|
const { account } = params;
|
|
351
353
|
const renderedText = renderDiscordMarkdown(text, params.tableMode ?? resolveMarkdownTableMode({
|
|
@@ -362,7 +364,8 @@ function prepareDiscordOutboundText(text, params) {
|
|
|
362
364
|
})
|
|
363
365
|
};
|
|
364
366
|
}
|
|
365
|
-
|
|
367
|
+
//#endregion
|
|
368
|
+
//#region extensions/discord/src/send.outbound.ts
|
|
366
369
|
var send_outbound_exports = /* @__PURE__ */ __exportAll({
|
|
367
370
|
sendMessageDiscord: () => sendMessageDiscord,
|
|
368
371
|
sendPollDiscord: () => sendPollDiscord,
|
|
@@ -624,4 +627,5 @@ async function sendDiscordStructuredMessage(to, opts, kind, buildPayload) {
|
|
|
624
627
|
});
|
|
625
628
|
});
|
|
626
629
|
}
|
|
630
|
+
//#endregion
|
|
627
631
|
export { prepareDiscordOutboundText as a, send_outbound_exports as i, sendPollDiscord as n, discordTextHasBroadcastMention as o, sendStickerDiscord as r, formatMention as s, sendMessageDiscord as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RateLimitError } from "./discord-
|
|
2
|
-
import { t as parseDiscordTarget } from "./target-parsing-
|
|
1
|
+
import { R as RateLimitError } from "./discord-BMD-JiVS.mjs";
|
|
2
|
+
import { t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
|
|
3
3
|
import { collectErrorGraphCandidates, extractErrorCode, formatErrorMessage, readErrorName } from "openclaw/plugin-sdk/error-runtime";
|
|
4
4
|
import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
5
5
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
@@ -10,7 +10,7 @@ import { classifyTransientNetworkErrorCode, createChannelApiRetryRunner, resolve
|
|
|
10
10
|
import { isSingleUseReplyToMode } from "openclaw/plugin-sdk/reply-reference";
|
|
11
11
|
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
12
12
|
import { attachChannelToResults } from "openclaw/plugin-sdk/channel-send-result";
|
|
13
|
-
|
|
13
|
+
//#region packages/normalization-core/src/utf16-slice.ts
|
|
14
14
|
function isHighSurrogate(codeUnit) {
|
|
15
15
|
return codeUnit >= 55296 && codeUnit <= 56319;
|
|
16
16
|
}
|
|
@@ -23,7 +23,8 @@ function avoidTrailingHighSurrogateBreak(text, start, end) {
|
|
|
23
23
|
const adjusted = end - 1;
|
|
24
24
|
return adjusted > start ? adjusted : end + 1;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region packages/normalization-core/src/grapheme.ts
|
|
27
28
|
let graphemeSegmenter;
|
|
28
29
|
function getGraphemeSegmenter() {
|
|
29
30
|
graphemeSegmenter ??= new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
@@ -47,7 +48,8 @@ function findGraphemeChunkEnd(text, start, maxEnd, preferredEnd = maxEnd, allowP
|
|
|
47
48
|
if (end <= start && preferred < hardEnd) end = hardEnd === text.length ? hardEnd : segments.containing(hardEnd)?.index ?? hardEnd;
|
|
48
49
|
return end > start ? end : allowPartial ? avoidTrailingHighSurrogateBreak(text, start, hardEnd) : start;
|
|
49
50
|
}
|
|
50
|
-
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region extensions/discord/src/chunk.ts
|
|
51
53
|
const DEFAULT_MAX_CHARS = 2e3;
|
|
52
54
|
const DEFAULT_MAX_LINES = 17;
|
|
53
55
|
const REASONING_ITALICS_MARKER_CHARS = 2;
|
|
@@ -362,7 +364,8 @@ function createDiscordRanges(source, maxChars, maxLines) {
|
|
|
362
364
|
cutBoundary
|
|
363
365
|
};
|
|
364
366
|
}
|
|
365
|
-
|
|
367
|
+
//#endregion
|
|
368
|
+
//#region extensions/discord/src/retry.ts
|
|
366
369
|
const DISCORD_RETRY_DEFAULTS = {
|
|
367
370
|
attempts: 3,
|
|
368
371
|
minDelayMs: 500,
|
|
@@ -456,7 +459,8 @@ function createDiscordRetryRunner(params) {
|
|
|
456
459
|
})(runRequest, label);
|
|
457
460
|
};
|
|
458
461
|
}
|
|
459
|
-
|
|
462
|
+
//#endregion
|
|
463
|
+
//#region extensions/discord/src/normalize.ts
|
|
460
464
|
function normalizeDiscordMessagingTarget(raw) {
|
|
461
465
|
return parseDiscordTarget(raw, { defaultKind: "channel" })?.normalized;
|
|
462
466
|
}
|
|
@@ -501,7 +505,8 @@ function looksLikeDiscordTargetId(raw) {
|
|
|
501
505
|
const trimmed = raw.trim();
|
|
502
506
|
return /^<@!?\d+>$/.test(trimmed) || /^(?:(?:user|channel|discord):\d+|discord:(?:user|channel):\d+)$/i.test(trimmed) || /^\d{6,}$/.test(trimmed);
|
|
503
507
|
}
|
|
504
|
-
|
|
508
|
+
//#endregion
|
|
509
|
+
//#region extensions/discord/src/reply-reference.ts
|
|
505
510
|
function resolveDiscordReplyReference(params) {
|
|
506
511
|
if (!params.replyToId) return;
|
|
507
512
|
const singleUse = params.replyToIdSource !== "explicit" && params.replyToMode !== void 0 && isSingleUseReplyToMode(params.replyToMode);
|
|
@@ -519,7 +524,8 @@ function createReusableDiscordReplyReference(messageId) {
|
|
|
519
524
|
function resolveDiscordReplyMessageId(reply, isFirst) {
|
|
520
525
|
return reply && (isFirst || reply.scope === "all") ? reply.messageId : void 0;
|
|
521
526
|
}
|
|
522
|
-
|
|
527
|
+
//#endregion
|
|
528
|
+
//#region extensions/discord/src/send.receipt.ts
|
|
523
529
|
function toDiscordOutboundDeliveryResult(result) {
|
|
524
530
|
const { channelId, ...delivery } = result;
|
|
525
531
|
return {
|
|
@@ -584,4 +590,5 @@ function createDiscordSendResult(params) {
|
|
|
584
590
|
})
|
|
585
591
|
};
|
|
586
592
|
}
|
|
593
|
+
//#endregion
|
|
587
594
|
export { recordDiscordMessageCreateAmbiguity as _, createReusableDiscordReplyReference as a, allowFromContainsDiscordUserId as c, normalizeDiscordMessagingTarget as d, normalizeDiscordOutboundTarget as f, hasDiscordMessageCreateAmbiguity as g, createDiscordRetryRunner as h, toDiscordOutboundDeliveryResult as i, looksLikeDiscordTargetId as l, classifyDiscordDeliveryFailure as m, createDiscordSendReceiptFromResults as n, resolveDiscordReplyMessageId as o, canFallbackDiscordWebhookSend as p, createDiscordSendResult as r, resolveDiscordReplyReference as s, createDiscordSendReceipt as t, matchesDiscordToolContextTarget as u, chunkDiscordTextWithMode as v, findGraphemeChunkEnd as y };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { h as normalizeDiscordToken, l as resolveDiscordAccount, s as mergeDiscordAccountConfig } from "./accounts-
|
|
2
|
-
import { A as isDiscordThreadChannelType } from "./allow-list-
|
|
3
|
-
import { I as RequestClient, J as Embed, K as hasDiscordV2Components, _t as getGuild, ct as createChannelMessage, ft as getChannel, it as getCurrentUser, mt as getThreadMember, q as serializePayload, rt as createUserDmChannel, vt as getGuildMember } from "./discord-
|
|
4
|
-
import { h as createDiscordRetryRunner, o as resolveDiscordReplyMessageId, v as chunkDiscordTextWithMode } from "./send.receipt-
|
|
5
|
-
import { t as parseAndResolveDiscordTarget } from "./target-resolver-
|
|
1
|
+
import { h as normalizeDiscordToken, l as resolveDiscordAccount, s as mergeDiscordAccountConfig } from "./accounts-ljrzXBJi.mjs";
|
|
2
|
+
import { A as isDiscordThreadChannelType } from "./allow-list-BKqOldGy.mjs";
|
|
3
|
+
import { I as RequestClient, J as Embed, K as hasDiscordV2Components, _t as getGuild, ct as createChannelMessage, ft as getChannel, it as getCurrentUser, mt as getThreadMember, q as serializePayload, rt as createUserDmChannel, vt as getGuildMember } from "./discord-BMD-JiVS.mjs";
|
|
4
|
+
import { h as createDiscordRetryRunner, o as resolveDiscordReplyMessageId, v as chunkDiscordTextWithMode } from "./send.receipt-C18khRYH.mjs";
|
|
5
|
+
import { t as parseAndResolveDiscordTarget } from "./target-resolver-CApivu3G.mjs";
|
|
6
6
|
import { danger } from "openclaw/plugin-sdk/runtime-env";
|
|
7
7
|
import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
8
8
|
import { normalizeOptionalString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -14,7 +14,7 @@ import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime"
|
|
|
14
14
|
import { resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
15
15
|
import { makeProxyFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
16
16
|
import { randomBytes } from "node:crypto";
|
|
17
|
-
|
|
17
|
+
//#region extensions/discord/src/monitor/gateway-registry.ts
|
|
18
18
|
/**
|
|
19
19
|
* Module-level registry of active Discord GatewayPlugin instances.
|
|
20
20
|
* Bridges the gap between agent tool handlers (which only have REST access)
|
|
@@ -35,7 +35,8 @@ function getGateway(accountId) {
|
|
|
35
35
|
function clearGateways() {
|
|
36
36
|
gatewayRegistry.clear();
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region extensions/discord/src/proxy-fetch.ts
|
|
39
40
|
function resolveDiscordProxyFetchForAccount(account, cfg, runtime) {
|
|
40
41
|
return withValidatedDiscordProxy(normalizeOptionalString(account.config.proxy) ?? normalizeOptionalString(cfg?.channels?.discord?.proxy), runtime, makeProxyFetch);
|
|
41
42
|
}
|
|
@@ -61,12 +62,14 @@ function validateDiscordProxyUrl(proxyUrl) {
|
|
|
61
62
|
if (!parsed.hostname) throw new Error("Proxy URL must include a host");
|
|
62
63
|
return proxyUrl;
|
|
63
64
|
}
|
|
64
|
-
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region extensions/discord/src/proxy-request-client.ts
|
|
65
67
|
const DISCORD_REST_TIMEOUT_MS = 15e3;
|
|
66
68
|
function createDiscordRequestClient(token, options) {
|
|
67
69
|
return new RequestClient(token, options);
|
|
68
70
|
}
|
|
69
|
-
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region extensions/discord/src/client.ts
|
|
70
73
|
function createDiscordRuntimeAccountContext(params) {
|
|
71
74
|
return {
|
|
72
75
|
cfg: params.cfg,
|
|
@@ -150,7 +153,8 @@ function createDiscordClient(opts) {
|
|
|
150
153
|
function resolveDiscordRest(opts) {
|
|
151
154
|
return createDiscordRestClient(opts).rest;
|
|
152
155
|
}
|
|
153
|
-
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region extensions/discord/src/recipient-resolution.ts
|
|
154
158
|
async function parseAndResolveRecipient(raw, cfg, accountId, parseOptions = {}) {
|
|
155
159
|
const resolvedCfg = requireRuntimeConfig(cfg, "Discord recipient resolution");
|
|
156
160
|
const accountInfo = resolveDiscordAccount({
|
|
@@ -177,7 +181,8 @@ async function parseAndResolveChannelRecipient(raw, cfg, accountId) {
|
|
|
177
181
|
id: resolved.id
|
|
178
182
|
};
|
|
179
183
|
}
|
|
180
|
-
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region extensions/discord/src/send.message-request.ts
|
|
181
186
|
const SUPPRESS_EMBEDS_FLAG = MessageFlags.SuppressEmbeds;
|
|
182
187
|
const SUPPRESS_NOTIFICATIONS_FLAG = MessageFlags.SuppressNotifications;
|
|
183
188
|
function createDiscordMessageNonce() {
|
|
@@ -219,7 +224,8 @@ function buildDiscordMessageRequest(params) {
|
|
|
219
224
|
...nonce ? { enforce_nonce: true } : {}
|
|
220
225
|
};
|
|
221
226
|
}
|
|
222
|
-
|
|
227
|
+
//#endregion
|
|
228
|
+
//#region extensions/discord/src/send.permissions.ts
|
|
223
229
|
const PERMISSION_ENTRIES = Object.entries(PermissionFlagsBits).filter(([, value]) => typeof value === "bigint");
|
|
224
230
|
const ALL_PERMISSIONS = PERMISSION_ENTRIES.reduce((acc, [, value]) => acc | value, 0n);
|
|
225
231
|
const ADMINISTRATOR_BIT = PermissionFlagsBits.Administrator;
|
|
@@ -433,7 +439,8 @@ async function fetchChannelPermissionsDiscord(channelId, opts) {
|
|
|
433
439
|
channelType
|
|
434
440
|
};
|
|
435
441
|
}
|
|
436
|
-
|
|
442
|
+
//#endregion
|
|
443
|
+
//#region extensions/discord/src/send.types.ts
|
|
437
444
|
var DiscordSendError = class extends Error {
|
|
438
445
|
constructor(message, opts) {
|
|
439
446
|
super(message);
|
|
@@ -447,7 +454,8 @@ var DiscordSendError = class extends Error {
|
|
|
447
454
|
const DISCORD_MAX_EMOJI_BYTES = 262144;
|
|
448
455
|
const DISCORD_MAX_STICKER_BYTES = 524288;
|
|
449
456
|
const DISCORD_MAX_EVENT_COVER_BYTES = 8388608;
|
|
450
|
-
|
|
457
|
+
//#endregion
|
|
458
|
+
//#region extensions/discord/src/send.shared.ts
|
|
451
459
|
const DISCORD_TEXT_LIMIT = 2e3;
|
|
452
460
|
const DISCORD_MAX_STICKERS = 3;
|
|
453
461
|
const DISCORD_POLL_MAX_ANSWERS = 10;
|
|
@@ -654,4 +662,5 @@ function buildReactionIdentifier(emoji) {
|
|
|
654
662
|
if (emoji.id && emoji.name) return `${emoji.name}:${emoji.id}`;
|
|
655
663
|
return emoji.name ?? "";
|
|
656
664
|
}
|
|
665
|
+
//#endregion
|
|
657
666
|
export { resolveDiscordSendEmbeds as A, validateDiscordProxyUrl as B, hasAnyChannelPermissionDiscord as C, createDiscordMessageNonce as D, buildDiscordMessageRequest as E, createDiscordRuntimeAccountContext as F, unregisterGateway as G, clearGateways as H, resolveDiscordClientAccountContext as I, resolveDiscordRest as L, parseAndResolveChannelRecipient as M, createDiscordClient as N, resolveDiscordMessageFlags as O, createDiscordRestClient as P, DISCORD_REST_TIMEOUT_MS as R, hasAllGuildPermissionsDiscord as S, SUPPRESS_NOTIFICATIONS_FLAG as T, getGateway as U, withValidatedDiscordProxy as V, registerGateway as W, canManageGuildMemberRoleDiscord as _, normalizeEmojiName as a, fetchChannelPermissionsDiscord as b, resolveChannelId as c, sendDiscordChunks as d, sendDiscordMedia as f, DiscordSendError as g, DISCORD_MAX_STICKER_BYTES as h, normalizeDiscordPollInput as i, resolveDiscordSuppressEmbeds as j, resolveDiscordSendComponents as k, resolveDiscordChannel as l, DISCORD_MAX_EVENT_COVER_BYTES as m, buildDiscordTextChunks as n, normalizeReactionEmoji as o, DISCORD_MAX_EMOJI_BYTES as p, buildReactionIdentifier as r, normalizeStickerIds as s, buildDiscordSendError as t, resolveDiscordTargetChannelId as u, canManageGuildRoleDiscord as v, hasAnyGuildPermissionDiscord as w, fetchMemberGuildPermissionsDiscord as x, canViewDiscordGuildChannel as y, resolveDiscordProxyFetchForAccount as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as formatDiscordUserTag } from "./allow-list-
|
|
1
|
+
import { S as formatDiscordUserTag } from "./allow-list-BKqOldGy.mjs";
|
|
2
2
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
-
|
|
3
|
+
//#region extensions/discord/src/monitor/sender-identity.ts
|
|
4
4
|
function resolveDiscordWebhookId(message) {
|
|
5
5
|
return normalizeOptionalString(message.webhookId ?? message.webhook_id) ?? null;
|
|
6
6
|
}
|
|
@@ -38,4 +38,5 @@ function resolveDiscordSenderIdentity(params) {
|
|
|
38
38
|
isPluralKit: false
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
+
//#endregion
|
|
41
42
|
export { resolveDiscordWebhookId as n, resolveDiscordSenderIdentity as t };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
//#region extensions/discord/src/session-contract.ts
|
|
2
2
|
function deriveLegacySessionChatType(sessionKey) {
|
|
3
3
|
return /^discord:(?:[^:]+:)?guild-[^:]+:channel-[^:]+$/.test(sessionKey) ? "channel" : void 0;
|
|
4
4
|
}
|
|
5
|
+
//#endregion
|
|
5
6
|
export { deriveLegacySessionChatType as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
-
|
|
2
|
+
//#region extensions/discord/src/session-key-normalization.ts
|
|
3
3
|
function normalizeExplicitDiscordSessionKey(sessionKey, ctx) {
|
|
4
4
|
let normalized = normalizeLowercaseStringOrEmpty(sessionKey);
|
|
5
5
|
const chatType = normalizeLowercaseStringOrEmpty(ctx.ChatType);
|
|
@@ -13,4 +13,5 @@ function normalizeExplicitDiscordSessionKey(sessionKey, ctx) {
|
|
|
13
13
|
const directId = senderId || fromDiscordId;
|
|
14
14
|
return directId && directId === match[2] ? `${match[1]}discord:direct:${match[2]}` : normalized;
|
|
15
15
|
}
|
|
16
|
+
//#endregion
|
|
16
17
|
export { normalizeExplicitDiscordSessionKey as t };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { c as resolveDefaultDiscordAccountId, f as resolveDiscordAccountDisabledReason, i as listDiscordAccountIds, l as resolveDiscordAccount, p as resolveDiscordAccountDmPolicy, r as isDiscordAccountEnabledForRuntime, s as mergeDiscordAccountConfig, u as resolveDiscordAccountAllowFrom } from "./accounts-
|
|
2
|
-
import { t as inspectDiscordAccount } from "./account-inspect-
|
|
3
|
-
import { t as parseDiscordTarget } from "./target-parsing-
|
|
4
|
-
import { n as discordIngressIdentity, t as selectDiscordLivePolicyConfig } from "./live-policy-config-
|
|
5
|
-
import { t as DiscordChannelConfigSchema } from "./config-schema-
|
|
6
|
-
import { n as normalizeCompatibilityConfig } from "./doctor-contract-
|
|
7
|
-
import { r as secretTargetRegistryEntries, t as collectRuntimeConfigAssignments } from "./secret-config-contract-
|
|
8
|
-
import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-
|
|
9
|
-
import { t as deriveLegacySessionChatType } from "./session-contract-
|
|
1
|
+
import { c as resolveDefaultDiscordAccountId, f as resolveDiscordAccountDisabledReason, i as listDiscordAccountIds, l as resolveDiscordAccount, p as resolveDiscordAccountDmPolicy, r as isDiscordAccountEnabledForRuntime, s as mergeDiscordAccountConfig, u as resolveDiscordAccountAllowFrom } from "./accounts-ljrzXBJi.mjs";
|
|
2
|
+
import { t as inspectDiscordAccount } from "./account-inspect-8cCu6uPG.mjs";
|
|
3
|
+
import { t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
|
|
4
|
+
import { n as discordIngressIdentity, t as selectDiscordLivePolicyConfig } from "./live-policy-config-C_Q966Wh.mjs";
|
|
5
|
+
import { t as DiscordChannelConfigSchema } from "./config-schema-_uBILpQf.mjs";
|
|
6
|
+
import { n as normalizeCompatibilityConfig } from "./doctor-contract-Bwv8EuQ_.mjs";
|
|
7
|
+
import { r as secretTargetRegistryEntries, t as collectRuntimeConfigAssignments } from "./secret-config-contract-z6FhbT8E.mjs";
|
|
8
|
+
import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-DNyyjTZZ.mjs";
|
|
9
|
+
import { t as deriveLegacySessionChatType } from "./session-contract-BO5tlIdl.mjs";
|
|
10
10
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
11
11
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
12
12
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
@@ -17,7 +17,7 @@ import { createConditionalWarningCollector, createOpenProviderConfiguredRouteWar
|
|
|
17
17
|
import { identityEntryAuthenticationClassifier } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
18
18
|
import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
|
|
19
19
|
import { createEnvPatchedAccountSetupAdapter } from "openclaw/plugin-sdk/setup-runtime";
|
|
20
|
-
|
|
20
|
+
//#region extensions/discord/src/security.ts
|
|
21
21
|
const resolveDiscordDmPolicy = createScopedDmSecurityResolver({
|
|
22
22
|
channelKey: "discord",
|
|
23
23
|
resolvePolicy: (account) => account.config.dmPolicy,
|
|
@@ -60,9 +60,10 @@ const discordSecurityAdapter = {
|
|
|
60
60
|
severity: "warn",
|
|
61
61
|
title: "Discord security warning"
|
|
62
62
|
}),
|
|
63
|
-
collectAuditFindings: async (params) => (await import("./security-audit-
|
|
63
|
+
collectAuditFindings: async (params) => (await import("./security-audit-BFT84Uny.mjs").then((n) => n.n)).collectDiscordSecurityAuditFindings(params)
|
|
64
64
|
};
|
|
65
|
-
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region extensions/discord/src/setup-adapter.ts
|
|
66
67
|
const discordSetupAdapter = createEnvPatchedAccountSetupAdapter({
|
|
67
68
|
channelKey: "discord",
|
|
68
69
|
defaultAccountOnlyEnvError: "DISCORD_BOT_TOKEN can only be used for the default account.",
|
|
@@ -92,12 +93,14 @@ const discordSetupContract = defineChannelSetupContract({
|
|
|
92
93
|
},
|
|
93
94
|
legacyAdapter: discordSetupAdapter
|
|
94
95
|
});
|
|
95
|
-
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region extensions/discord/src/doctor-shared.ts
|
|
96
98
|
const DISCORD_LEGACY_CONFIG_RULES = [];
|
|
97
|
-
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region extensions/discord/src/shared.ts
|
|
98
101
|
const DISCORD_CHANNEL = "discord";
|
|
99
102
|
const livePolicyConfigPrefixes = Object.keys(selectDiscordLivePolicyConfig({})).flatMap((key) => [`channels.discord.${key}`, `channels.discord.accounts.*.${key}`]);
|
|
100
|
-
const loadDiscordDoctorModule = createLazyRuntimeModule(() => import("./doctor-
|
|
103
|
+
const loadDiscordDoctorModule = createLazyRuntimeModule(() => import("./doctor-hQKbkNKq.mjs"));
|
|
101
104
|
const discordDoctor = {
|
|
102
105
|
dmAllowFromMode: "topOnly",
|
|
103
106
|
groupModel: "route",
|
|
@@ -223,4 +226,5 @@ function createDiscordPluginBase(params) {
|
|
|
223
226
|
}
|
|
224
227
|
};
|
|
225
228
|
}
|
|
229
|
+
//#endregion
|
|
226
230
|
export { discordSecurityAdapter as a, discordSetupContract as i, discordConfigAdapter as n, DISCORD_LEGACY_CONFIG_RULES as r, createDiscordPluginBase as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { d as unbindThreadBindingsBySessionKeyAsync, o as listThreadBindingsBySessionKey, s as listThreadBindingsBySessionKeyAsync } from "./thread-bindings-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
+
import { d as unbindThreadBindingsBySessionKeyAsync, o as listThreadBindingsBySessionKey, s as listThreadBindingsBySessionKeyAsync } from "./thread-bindings-DcvT_JgI.mjs";
|
|
3
3
|
import { normalizeOptionalLowercaseString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { warnPluginSdkDeprecation } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
|
|
5
|
-
|
|
5
|
+
//#region extensions/discord/src/subagent-hooks.ts
|
|
6
6
|
var subagent_hooks_exports = /* @__PURE__ */ __exportAll({
|
|
7
7
|
handleDiscordSubagentDeliveryTarget: () => handleDiscordSubagentDeliveryTarget,
|
|
8
8
|
handleDiscordSubagentDeliveryTargetAsync: () => handleDiscordSubagentDeliveryTargetAsync,
|
|
@@ -55,4 +55,5 @@ function resolveDiscordDeliveryTarget(event, bindings) {
|
|
|
55
55
|
threadId: binding.threadId
|
|
56
56
|
} };
|
|
57
57
|
}
|
|
58
|
+
//#endregion
|
|
58
59
|
export { subagent_hooks_exports as i, handleDiscordSubagentDeliveryTargetAsync as n, handleDiscordSubagentEnded as r, handleDiscordSubagentDeliveryTarget as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as formatDiscordUserTag } from "./allow-list-
|
|
2
|
-
import { t as discord_exports } from "./discord-
|
|
3
|
-
|
|
1
|
+
import { S as formatDiscordUserTag } from "./allow-list-BKqOldGy.mjs";
|
|
2
|
+
import { t as discord_exports } from "./discord-BMD-JiVS.mjs";
|
|
3
|
+
//#region extensions/discord/src/monitor/system-events.ts
|
|
4
4
|
const SYSTEM_EVENT_ACTIONS = /* @__PURE__ */ new Map([
|
|
5
5
|
[discord_exports.MessageType.ChannelPinnedMessage, "pinned a message"],
|
|
6
6
|
[discord_exports.MessageType.RecipientAdd, "added a recipient"],
|
|
@@ -29,4 +29,5 @@ function resolveDiscordSystemEvent(message, location) {
|
|
|
29
29
|
const authorLabel = message.author ? formatDiscordUserTag(message.author) : "";
|
|
30
30
|
return `Discord system: ${authorLabel ? `${authorLabel} ` : ""}${action} in ${location}`;
|
|
31
31
|
}
|
|
32
|
+
//#endregion
|
|
32
33
|
export { resolveDiscordSystemEvent };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { buildMessagingTarget, parseMentionPrefixOrAtUserTarget, requireTargetKind } from "openclaw/plugin-sdk/channel-targets";
|
|
2
|
-
|
|
2
|
+
//#region extensions/discord/src/target-parsing.ts
|
|
3
3
|
function parseDiscordTarget(raw, options = {}) {
|
|
4
4
|
const trimmed = raw.trim();
|
|
5
5
|
if (!trimmed) return;
|
|
@@ -44,4 +44,5 @@ function resolveDiscordChannelId(raw) {
|
|
|
44
44
|
kind: "channel"
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
+
//#endregion
|
|
47
48
|
export { resolveDiscordChannelId as n, parseDiscordTarget as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { l as resolveDiscordAccount, u as resolveDiscordAccountAllowFrom } from "./accounts-
|
|
3
|
-
import { c as allowFromContainsDiscordUserId } from "./send.receipt-
|
|
4
|
-
import { o as rememberDiscordDirectoryUser, r as listDiscordDirectoryPeersLive } from "./directory-live-
|
|
5
|
-
import { t as parseDiscordTarget } from "./target-parsing-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
+
import { l as resolveDiscordAccount, u as resolveDiscordAccountAllowFrom } from "./accounts-ljrzXBJi.mjs";
|
|
3
|
+
import { c as allowFromContainsDiscordUserId } from "./send.receipt-C18khRYH.mjs";
|
|
4
|
+
import { o as rememberDiscordDirectoryUser, r as listDiscordDirectoryPeersLive } from "./directory-live-BDVl2DoC.mjs";
|
|
5
|
+
import { t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
|
|
6
6
|
import { buildMessagingTarget } from "openclaw/plugin-sdk/channel-targets";
|
|
7
|
-
|
|
7
|
+
//#region extensions/discord/src/target-resolver.ts
|
|
8
8
|
var target_resolver_exports = /* @__PURE__ */ __exportAll({
|
|
9
9
|
parseAndResolveDiscordTarget: () => parseAndResolveDiscordTarget,
|
|
10
10
|
resolveDiscordTarget: () => resolveDiscordTarget
|
|
@@ -53,4 +53,5 @@ async function parseAndResolveDiscordTarget(raw, options, parseOptions = {}) {
|
|
|
53
53
|
if (!resolved) throw new Error("Recipient is required for Discord sends");
|
|
54
54
|
return resolved;
|
|
55
55
|
}
|
|
56
|
+
//#endregion
|
|
56
57
|
export { resolveDiscordTarget as n, target_resolver_exports as r, parseAndResolveDiscordTarget as t };
|