@openclaw/discord 2026.11.1 → 2026.11.3
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,7 +1,7 @@
|
|
|
1
|
-
import { i as listDiscordAccountIds, n as inspectDiscordAccountConfig, v as resolveDiscordAccountAvailability } from "./accounts-
|
|
1
|
+
import { i as listDiscordAccountIds, n as inspectDiscordAccountConfig, v as resolveDiscordAccountAvailability } from "./accounts-ljrzXBJi.mjs";
|
|
2
2
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
3
3
|
import { normalizeSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
4
|
-
|
|
4
|
+
//#region extensions/discord/src/account-inspect.ts
|
|
5
5
|
function inspectDiscordAccountPrimary(params) {
|
|
6
6
|
return inspectDiscordAccountConfig(params, {
|
|
7
7
|
includeName: true,
|
|
@@ -27,4 +27,5 @@ function inspectDiscordAccount(params) {
|
|
|
27
27
|
})
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
+
//#endregion
|
|
30
31
|
export { inspectDiscordAccount as t };
|
|
@@ -6,7 +6,7 @@ import { resolveConfiguredFromCredentialStatuses } from "openclaw/plugin-sdk/cha
|
|
|
6
6
|
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, normalizeAccountId as normalizeAccountId$1, resolveAccountEntry } from "openclaw/plugin-sdk/routing";
|
|
7
7
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
8
|
import { getRuntimeConfigSnapshot, getRuntimeConfigSourceSnapshot, selectApplicableRuntimeConfig } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
9
|
-
|
|
9
|
+
//#region extensions/discord/src/account-token-inspect.ts
|
|
10
10
|
function inspectDiscordConfiguredToken(value) {
|
|
11
11
|
const normalized = normalizeSecretInputString(value);
|
|
12
12
|
if (normalized || hasConfiguredSecretInput(value)) return {
|
|
@@ -56,7 +56,8 @@ function resolveDiscordAccountAvailability(params) {
|
|
|
56
56
|
stateReason: duplicateOwner ? `duplicate bot token; using account "${duplicateOwner}"` : void 0
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region extensions/discord/src/runtime-config.ts
|
|
60
61
|
function selectDiscordRuntimeConfig(inputConfig) {
|
|
61
62
|
return selectApplicableRuntimeConfig({
|
|
62
63
|
inputConfig,
|
|
@@ -90,7 +91,8 @@ function selectDiscordActivitiesRuntimeConfig(inputConfig) {
|
|
|
90
91
|
}
|
|
91
92
|
};
|
|
92
93
|
}
|
|
93
|
-
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region extensions/discord/src/token.ts
|
|
94
96
|
function stripDiscordBotPrefix(token) {
|
|
95
97
|
return token.replace(/^Bot\s+/i, "");
|
|
96
98
|
}
|
|
@@ -157,7 +159,8 @@ function resolveDiscordToken(cfg, opts = {}) {
|
|
|
157
159
|
tokenStatus: "missing"
|
|
158
160
|
};
|
|
159
161
|
}
|
|
160
|
-
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region extensions/discord/src/accounts.ts
|
|
161
164
|
const { listAccountIds: listDiscordAccountIds, resolveDefaultAccountId: resolveDefaultDiscordAccountId, resolveAccountConfig: mergeDiscordAccountConfig } = createAccountListHelpers("discord", {
|
|
162
165
|
implicitDefaultAccount: {
|
|
163
166
|
channelKeys: ["token"],
|
|
@@ -265,4 +268,5 @@ function listDiscordStartupAccountIds(cfg) {
|
|
|
265
268
|
if (!startupAccountIds.includes(defaultAccountId)) return startupAccountIds;
|
|
266
269
|
return [defaultAccountId, ...startupAccountIds.filter((candidateId) => candidateId !== defaultAccountId)];
|
|
267
270
|
}
|
|
271
|
+
//#endregion
|
|
268
272
|
export { selectDiscordActivitiesRuntimeConfig as _, listDiscordStartupAccountIds as a, resolveDefaultDiscordAccountId as c, resolveDiscordAccountConfig as d, resolveDiscordAccountDisabledReason as f, resolveDiscordToken as g, normalizeDiscordToken as h, listDiscordAccountIds as i, resolveDiscordAccount as l, resolveDiscordMaxLinesPerMessage as m, inspectDiscordAccountConfig as n, listEnabledDiscordAccounts as o, resolveDiscordAccountDmPolicy as p, isDiscordAccountEnabledForRuntime as r, mergeDiscordAccountConfig as s, createDiscordActionGate as t, resolveDiscordAccountAllowFrom as u, resolveDiscordAccountAvailability as v };
|
package/dist/.setup/{active-turn-thread-route-BAc_Xik-.mjs → active-turn-thread-route-C4tp9noA.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
-
|
|
2
|
+
//#region extensions/discord/src/active-turn-thread-route.ts
|
|
3
3
|
const activeRoutes = /* @__PURE__ */ new Map();
|
|
4
4
|
function beginDiscordActiveTurnThreadRoute(sessionKey, route) {
|
|
5
5
|
const key = normalizeOptionalString(sessionKey);
|
|
@@ -36,4 +36,5 @@ function notifyDiscordActiveTurnThreadReplyDelivered(params) {
|
|
|
36
36
|
route.onThreadReplyDelivered?.(threadId);
|
|
37
37
|
return true;
|
|
38
38
|
}
|
|
39
|
+
//#endregion
|
|
39
40
|
export { notifyDiscordActiveTurnThreadCreated as n, notifyDiscordActiveTurnThreadReplyDelivered as r, beginDiscordActiveTurnThreadRoute as t };
|
|
@@ -5,11 +5,12 @@ import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtim
|
|
|
5
5
|
import { fetchWithSsrFGuard, isBlockedHostnameOrIp, isLoopbackHost } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
6
6
|
import { buildChannelKeyCandidates, normalizeChannelSlug, resolveChannelEntryMatchWithFallback, resolveChannelMatchConfig } from "openclaw/plugin-sdk/channel-targets";
|
|
7
7
|
import { resolveAllowlistMatchByCandidates } from "openclaw/plugin-sdk/allow-from";
|
|
8
|
-
|
|
8
|
+
//#region extensions/discord/src/channel-type.ts
|
|
9
9
|
function isDiscordThreadChannelType(channelType) {
|
|
10
10
|
return channelType === ChannelType.AnnouncementThread || channelType === ChannelType.PublicThread || channelType === ChannelType.PrivateThread;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region extensions/discord/src/endpoint-runtime.ts
|
|
13
14
|
const DISCORD_ENDPOINT_RESPONSE_MAX_BYTES = 8388608;
|
|
14
15
|
const DISCORD_API_URL_ENV = "DISCORD_API_URL";
|
|
15
16
|
function parseHttpAnchor(value, label) {
|
|
@@ -144,7 +145,8 @@ function assertDiscordEndpointGatewayUrl(url, gatewayOrigin) {
|
|
|
144
145
|
}
|
|
145
146
|
if (parsed.origin !== gatewayOrigin || parsed.username || parsed.password || parsed.hash) throw new Error("Discord endpoint Gateway URL is outside the configured WebSocket origin");
|
|
146
147
|
}
|
|
147
|
-
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region extensions/discord/src/retry-after.ts
|
|
148
150
|
const RETRY_AFTER_BODY_SECONDS_RE = /^(?:\d+\.?\d*|\.\d+)$/;
|
|
149
151
|
const MAX_SAFE_RETRY_AFTER_SECONDS = Number.MAX_SAFE_INTEGER / 1e3;
|
|
150
152
|
function parseDiscordRetryAfterBodySeconds(value) {
|
|
@@ -154,7 +156,8 @@ function parseDiscordRetryAfterBodySeconds(value) {
|
|
|
154
156
|
max: MAX_SAFE_RETRY_AFTER_SECONDS
|
|
155
157
|
});
|
|
156
158
|
}
|
|
157
|
-
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region extensions/discord/src/monitor/format.ts
|
|
158
161
|
function resolveDiscordSystemLocation(params) {
|
|
159
162
|
const { isDirectMessage, isGroupDm, guild, channelName } = params;
|
|
160
163
|
if (isDirectMessage) return "DM";
|
|
@@ -174,7 +177,8 @@ function formatDiscordUserTag(user) {
|
|
|
174
177
|
function resolveTimestampMs(timestamp) {
|
|
175
178
|
return parseDateStringTimestampMs(timestamp);
|
|
176
179
|
}
|
|
177
|
-
|
|
180
|
+
//#endregion
|
|
181
|
+
//#region extensions/discord/src/monitor/allow-list.ts
|
|
178
182
|
const DISCORD_OWNER_ALLOWLIST_PREFIXES = [
|
|
179
183
|
"discord:",
|
|
180
184
|
"user:",
|
|
@@ -212,7 +216,7 @@ function normalizeDiscordSlug(value) {
|
|
|
212
216
|
return normalizeChannelSlug(value);
|
|
213
217
|
}
|
|
214
218
|
function normalizeDiscordDisplaySlug(value) {
|
|
215
|
-
return normalizeLowercaseStringOrEmpty(value).normalize("NFC").replace(/^#/, "").replace(/[\s_]+/g, "-").replace(/[^\p{L}\p{M}\p{N}-]+/gu, "-").replace(/-{2,}/g, "-").replace(/^-+|-+$/g, "");
|
|
219
|
+
return normalizeLowercaseStringOrEmpty(value).normalize("NFC").replace(/[\uFE0E\uFE0F\u20E3]/g, "").replace(/^#/, "").replace(/[\s_]+/g, "-").replace(/[^\p{L}\p{M}\p{N}-]+/gu, "-").replace(/-{2,}/g, "-").replace(/^-+|-+$/g, "");
|
|
216
220
|
}
|
|
217
221
|
function allowListMatches(list, candidate, params) {
|
|
218
222
|
return resolveDiscordAllowListMatch({
|
|
@@ -455,4 +459,5 @@ function shouldEmitDiscordReactionNotification(params) {
|
|
|
455
459
|
if (mode === "own") return Boolean(params.botId && params.messageAuthorId === params.botId);
|
|
456
460
|
return false;
|
|
457
461
|
}
|
|
462
|
+
//#endregion
|
|
458
463
|
export { isDiscordThreadChannelType as A, resolveDiscordSystemLocation as C, getDiscordEndpointRuntime as D, assertDiscordEndpointGatewayUrl as E, resolveDiscordEndpointAttachmentGuard as O, formatDiscordUserTag as S, parseDiscordRetryAfterBodySeconds as T, resolveDiscordOwnerAllowFrom as _, normalizeDiscordDisplaySlug as a, shouldEmitDiscordReactionNotification as b, resolveDiscordChannelConfig as c, resolveDiscordCommandAuthorized as d, resolveDiscordGuildEntry as f, resolveDiscordOwnerAccess as g, resolveDiscordMentionPolicy as h, normalizeDiscordAllowList as i, resolveDiscordEndpointMediaGuard as k, resolveDiscordChannelConfigWithFallback as l, resolveDiscordMemberAllowed as m, hasConfiguredDiscordChannels as n, normalizeDiscordSlug as o, resolveDiscordMemberAccessState as p, isDiscordGroupAllowedByPolicy as r, resolveDiscordAllowListMatch as s, allowListMatches as t, resolveDiscordChannelPolicyCommandAuthorizer as u, resolveDiscordShouldRequireMention as v, resolveTimestampMs as w, formatDiscordReactionEmoji as x, resolveGroupDmAllow as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as getDiscordEndpointRuntime, T as parseDiscordRetryAfterBodySeconds } from "./allow-list-
|
|
1
|
+
import { D as getDiscordEndpointRuntime, T as parseDiscordRetryAfterBodySeconds } from "./allow-list-BKqOldGy.mjs";
|
|
2
2
|
import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
3
3
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
4
4
|
import { captureChannelReadAuthority, captureEffectAuthority, resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
@@ -7,7 +7,7 @@ import { redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
|
|
|
7
7
|
import { parseRetryAfterHeaderSeconds, resolveRetryConfig, retryAsync } from "openclaw/plugin-sdk/retry-runtime";
|
|
8
8
|
import { readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
|
|
9
9
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
10
|
-
|
|
10
|
+
//#region extensions/discord/src/error-body.ts
|
|
11
11
|
const DISCORD_RESPONSE_BODY_SUMMARY_MAX_CHARS = 240;
|
|
12
12
|
function parseDiscordHttpErrorBody(raw) {
|
|
13
13
|
if (!raw) return;
|
|
@@ -28,7 +28,8 @@ function isDiscordHtmlResponseBody(body, contentType) {
|
|
|
28
28
|
function isDiscordRateLimitResponseBody(body) {
|
|
29
29
|
return /error 1015|cloudflare|rate limit/i.test(body);
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region extensions/discord/src/api.ts
|
|
32
33
|
const DISCORD_API_BASE = "https://discord.com/api/v10";
|
|
33
34
|
const DISCORD_API_RETRY_DEFAULTS = {
|
|
34
35
|
attempts: 3,
|
|
@@ -161,4 +162,5 @@ async function fetchDiscord(path, token, fetcher = fetch, options) {
|
|
|
161
162
|
method: "GET"
|
|
162
163
|
});
|
|
163
164
|
}
|
|
165
|
+
//#endregion
|
|
164
166
|
export { isDiscordRateLimitResponseBody as a, requestDiscord as i, DiscordApiError as n, parseDiscordHttpErrorBody as o, fetchDiscord as r, summarizeDiscordResponseBody as s, DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS as t };
|
package/dist/.setup/{approval-handler.runtime-krznjTz9.mjs → approval-handler.runtime-D0qu1um7.mjs}
RENAMED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { D as createDiscordMessageNonce, N as createDiscordClient } from "./send.shared-
|
|
2
|
-
import { D as Row, ct as createChannelMessage, dt as editChannelMessage, j as TextDisplay, k as Separator, q as serializePayload, rt as createUserDmChannel, ut as deleteChannelMessage, x as Container, xt as stripUndefinedFields, y as Button } from "./discord-
|
|
3
|
-
import { y as findGraphemeChunkEnd } from "./send.receipt-
|
|
4
|
-
import { s as buildExecApprovalCustomId } from "./components-
|
|
5
|
-
import { A as isDiscordExecApprovalClientEnabled, c as formatDiscordApprovalDisplayValue, s as DISCORD_APPROVAL_ALLOWED_MENTIONS } from "./outbound-session-route-
|
|
6
|
-
import { a as shouldHandleDiscordApprovalRequest } from "./channel-
|
|
7
|
-
import { t as discordApprovalMessageUpdates } from "./approval-message-updates-
|
|
1
|
+
import { D as createDiscordMessageNonce, N as createDiscordClient } from "./send.shared-CnlMgoqQ.mjs";
|
|
2
|
+
import { D as Row, ct as createChannelMessage, dt as editChannelMessage, j as TextDisplay, k as Separator, q as serializePayload, rt as createUserDmChannel, ut as deleteChannelMessage, x as Container, xt as stripUndefinedFields, y as Button } from "./discord-BMD-JiVS.mjs";
|
|
3
|
+
import { y as findGraphemeChunkEnd } from "./send.receipt-C18khRYH.mjs";
|
|
4
|
+
import { s as buildExecApprovalCustomId } from "./components-Du9NhD8h.mjs";
|
|
5
|
+
import { A as isDiscordExecApprovalClientEnabled, c as formatDiscordApprovalDisplayValue, s as DISCORD_APPROVAL_ALLOWED_MENTIONS } from "./outbound-session-route-BtUpGBTb.mjs";
|
|
6
|
+
import { a as shouldHandleDiscordApprovalRequest } from "./channel-ZilgdF5e.mjs";
|
|
7
|
+
import { t as discordApprovalMessageUpdates } from "./approval-message-updates-CdurC9Ej.mjs";
|
|
8
8
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
9
|
import { ButtonStyle } from "discord-api-types/v10";
|
|
10
10
|
import { logDebug, logError } from "openclaw/plugin-sdk/logging-core";
|
|
11
11
|
import { createChannelApprovalNativeRuntimeAdapterAsync } from "openclaw/plugin-sdk/approval-handler-runtime";
|
|
12
12
|
import { formatChannelApprovalResolvedLabel } from "openclaw/plugin-sdk/approval-runtime";
|
|
13
|
-
|
|
13
|
+
//#region extensions/discord/src/approval-handler.runtime.ts
|
|
14
14
|
function resolveHandlerContext(params) {
|
|
15
15
|
const context = params.context;
|
|
16
16
|
const accountId = normalizeOptionalString(params.accountId) ?? "";
|
|
@@ -236,4 +236,5 @@ const discordApprovalNativeRuntime = createChannelApprovalNativeRuntimeAdapterAs
|
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
});
|
|
239
|
+
//#endregion
|
|
239
240
|
export { discordApprovalNativeRuntime };
|
package/dist/.setup/{approval-message-updates-Cks-MSCJ.mjs → approval-message-updates-CdurC9Ej.mjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { tt as parseCustomId } from "./discord-
|
|
2
|
-
import { c as parseExecApprovalData } from "./components-
|
|
1
|
+
import { tt as parseCustomId } from "./discord-BMD-JiVS.mjs";
|
|
2
|
+
import { c as parseExecApprovalData } from "./components-Du9NhD8h.mjs";
|
|
3
3
|
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
4
|
-
|
|
4
|
+
//#region extensions/discord/src/approval-message-updates.ts
|
|
5
5
|
const discordApprovalMessageUpdates = new KeyedAsyncQueue();
|
|
6
6
|
/** Read the current control identity, rather than reconstructing delivery ownership. */
|
|
7
7
|
function hasDiscordApprovalControl(message, approval) {
|
|
@@ -13,4 +13,5 @@ function hasDiscordApprovalControl(message, approval) {
|
|
|
13
13
|
}
|
|
14
14
|
return "components" in message && Array.isArray(message.components) && message.components.some((component) => hasDiscordApprovalControl(component, approval));
|
|
15
15
|
}
|
|
16
|
+
//#endregion
|
|
16
17
|
export { hasDiscordApprovalControl as n, discordApprovalMessageUpdates as t };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { t as inspectDiscordAccount } from "./account-inspect-
|
|
3
|
-
import { b as fetchChannelPermissionsDiscord } from "./send.shared-
|
|
4
|
-
import "./send-
|
|
5
|
-
import { E as collectDiscordAuditChannelIdsForAccount, T as auditDiscordChannelPermissionsWithFetcher } from "./outbound-session-route-
|
|
6
|
-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
+
import { t as inspectDiscordAccount } from "./account-inspect-8cCu6uPG.mjs";
|
|
3
|
+
import { b as fetchChannelPermissionsDiscord } from "./send.shared-CnlMgoqQ.mjs";
|
|
4
|
+
import "./send-da6ENJ9f.mjs";
|
|
5
|
+
import { E as collectDiscordAuditChannelIdsForAccount, T as auditDiscordChannelPermissionsWithFetcher } from "./outbound-session-route-BtUpGBTb.mjs";
|
|
6
|
+
//#region extensions/discord/src/audit.ts
|
|
7
7
|
var audit_exports = /* @__PURE__ */ __exportAll({
|
|
8
8
|
auditDiscordChannelPermissions: () => auditDiscordChannelPermissions,
|
|
9
9
|
collectDiscordAuditChannelIds: () => collectDiscordAuditChannelIds
|
|
@@ -18,4 +18,5 @@ async function auditDiscordChannelPermissions(params) {
|
|
|
18
18
|
fetchChannelPermissions: fetchChannelPermissionsDiscord
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
+
//#endregion
|
|
21
22
|
export { audit_exports as n, collectDiscordAuditChannelIds as r, auditDiscordChannelPermissions as t };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { a as listDiscordStartupAccountIds, c as resolveDefaultDiscordAccountId, d as resolveDiscordAccountConfig, i as listDiscordAccountIds, l as resolveDiscordAccount, u as resolveDiscordAccountAllowFrom } from "./accounts-
|
|
2
|
-
import { G as withDiscordRequestAuthority } from "./discord-
|
|
3
|
-
import { d as normalizeDiscordMessagingTarget, l as looksLikeDiscordTargetId, u as matchesDiscordToolContextTarget } from "./send.receipt-
|
|
4
|
-
import { t as parseDiscordTarget } from "./target-parsing-
|
|
5
|
-
import { l as withAbortTimeout } from "./timeouts-
|
|
6
|
-
import { t as getDiscordRuntime } from "./runtime-
|
|
7
|
-
import { A as isDiscordExecApprovalClientEnabled, D as resolveRequiredDiscordChannelPermissions, O as getDiscordExecApprovalApprovers, b as resolveDiscordRuntimeBindingConversationId, h as resolveDiscordConversationRoute, j as shouldSuppressLocalDiscordExecApprovalPrompt, k as isDiscordExecApprovalApprover, l as findDiscordChannelPolicyKey, t as resolveDiscordOutboundSessionRoute, u as getDiscordChannelPolicyBinding, x as discordMessageActions } from "./outbound-session-route-
|
|
8
|
-
import { a as normalizeDiscordAcpConversationId, c as resolveDiscordInboundConversation, i as matchDiscordAcpConversation, n as discordOutbound, o as resolveDiscordAttachedOutboundTarget, r as buildDiscordCrossContextPresentation, s as resolveDiscordCommandConversation } from "./outbound-adapter-
|
|
9
|
-
import { r as openDiscordCommandDeployHashStore } from "./command-deploy-store-
|
|
10
|
-
import { t as resolveDiscordConversationBindingRoute } from "./conversation-binding-route-
|
|
11
|
-
import { a as discordSecurityAdapter, i as discordSetupContract, n as discordConfigAdapter, t as createDiscordPluginBase } from "./shared-
|
|
12
|
-
import { t as normalizeExplicitDiscordSessionKey } from "./session-key-normalization-
|
|
13
|
-
import { i as setThreadBindingMaxAgeBySessionKeyAsync, n as setThreadBindingIdleTimeoutBySessionKeyAsync, r as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-
|
|
14
|
-
import { t as defaultTopLevelPlacement } from "./thread-binding-api-
|
|
1
|
+
import { a as listDiscordStartupAccountIds, c as resolveDefaultDiscordAccountId, d as resolveDiscordAccountConfig, i as listDiscordAccountIds, l as resolveDiscordAccount, u as resolveDiscordAccountAllowFrom } from "./accounts-ljrzXBJi.mjs";
|
|
2
|
+
import { G as withDiscordRequestAuthority } from "./discord-BMD-JiVS.mjs";
|
|
3
|
+
import { d as normalizeDiscordMessagingTarget, l as looksLikeDiscordTargetId, u as matchesDiscordToolContextTarget } from "./send.receipt-C18khRYH.mjs";
|
|
4
|
+
import { t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
|
|
5
|
+
import { l as withAbortTimeout } from "./timeouts-CuNARfyw.mjs";
|
|
6
|
+
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.mjs";
|
|
7
|
+
import { A as isDiscordExecApprovalClientEnabled, D as resolveRequiredDiscordChannelPermissions, O as getDiscordExecApprovalApprovers, b as resolveDiscordRuntimeBindingConversationId, h as resolveDiscordConversationRoute, j as shouldSuppressLocalDiscordExecApprovalPrompt, k as isDiscordExecApprovalApprover, l as findDiscordChannelPolicyKey, t as resolveDiscordOutboundSessionRoute, u as getDiscordChannelPolicyBinding, x as discordMessageActions } from "./outbound-session-route-BtUpGBTb.mjs";
|
|
8
|
+
import { a as normalizeDiscordAcpConversationId, c as resolveDiscordInboundConversation, i as matchDiscordAcpConversation, n as discordOutbound, o as resolveDiscordAttachedOutboundTarget, r as buildDiscordCrossContextPresentation, s as resolveDiscordCommandConversation } from "./outbound-adapter-DfAanoCO.mjs";
|
|
9
|
+
import { r as openDiscordCommandDeployHashStore } from "./command-deploy-store-DFkBTViB.mjs";
|
|
10
|
+
import { t as resolveDiscordConversationBindingRoute } from "./conversation-binding-route-8Ul1KpGF.mjs";
|
|
11
|
+
import { a as discordSecurityAdapter, i as discordSetupContract, n as discordConfigAdapter, t as createDiscordPluginBase } from "./shared-CY5vJM48.mjs";
|
|
12
|
+
import { t as normalizeExplicitDiscordSessionKey } from "./session-key-normalization-CCHGNSQw.mjs";
|
|
13
|
+
import { i as setThreadBindingMaxAgeBySessionKeyAsync, n as setThreadBindingIdleTimeoutBySessionKeyAsync, r as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-BMdJeJMc.mjs";
|
|
14
|
+
import { t as defaultTopLevelPlacement } from "./thread-binding-api-BDZJD4na.mjs";
|
|
15
15
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
16
16
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
17
17
|
import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -34,7 +34,7 @@ import { createChannelApproverDmTargetResolverAsync, createChannelNativeOriginTa
|
|
|
34
34
|
import { isChannelExecApprovalClientEnabledFromConfig, matchesApprovalRequestFilters } from "openclaw/plugin-sdk/approval-client-runtime";
|
|
35
35
|
import { resolveThreadBindingSpawnPolicy } from "openclaw/plugin-sdk/conversation-runtime";
|
|
36
36
|
import { resolveScopeRequireMention, resolveScopeToolsPolicy, scopeKey } from "openclaw/plugin-sdk/channel-policy";
|
|
37
|
-
|
|
37
|
+
//#region extensions/discord/src/approval-shared.ts
|
|
38
38
|
function isDiscordApprovalAccountEligible(params) {
|
|
39
39
|
const account = resolveDiscordAccount(params);
|
|
40
40
|
const config = params.configOverride ?? account.config.execApprovals;
|
|
@@ -59,7 +59,8 @@ async function shouldHandleDiscordApprovalRequest(params) {
|
|
|
59
59
|
}) ? [accountId] : []
|
|
60
60
|
}) && isDiscordApprovalAccountEligible(params);
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region extensions/discord/src/approval-native.ts
|
|
63
64
|
function extractDiscordSessionKind(sessionKey) {
|
|
64
65
|
if (!sessionKey) return null;
|
|
65
66
|
const raw = sessionKey.match(/discord:(?:[^:]+:)?(channel|group|dm|direct):/)?.[1];
|
|
@@ -163,7 +164,7 @@ function createDiscordApprovalCapability() {
|
|
|
163
164
|
accountId
|
|
164
165
|
}),
|
|
165
166
|
shouldHandle: shouldHandleDiscordApprovalRequest,
|
|
166
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
167
|
+
load: async () => (await import("./approval-handler.runtime-D0qu1um7.mjs")).discordApprovalNativeRuntime
|
|
167
168
|
})
|
|
168
169
|
});
|
|
169
170
|
}
|
|
@@ -172,24 +173,26 @@ function getDiscordApprovalCapability() {
|
|
|
172
173
|
cachedDiscordApprovalCapability ??= createDiscordApprovalCapability();
|
|
173
174
|
return cachedDiscordApprovalCapability;
|
|
174
175
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const
|
|
178
|
-
const
|
|
179
|
-
const
|
|
180
|
-
const
|
|
181
|
-
const
|
|
182
|
-
const
|
|
176
|
+
//#endregion
|
|
177
|
+
//#region extensions/discord/src/channel.loaders.ts
|
|
178
|
+
const loadDiscordDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-3iVub-3m.mjs").then((n) => n.t));
|
|
179
|
+
const loadDiscordResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels-Cj5i7hzj.mjs").then((n) => n.n));
|
|
180
|
+
const loadDiscordResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-BQLbysRB.mjs").then((n) => n.n));
|
|
181
|
+
const loadDiscordThreadBindingsManagerModule = createLazyRuntimeModule(() => import("./thread-bindings.manager-5Sh7yedN.mjs").then((n) => n.r));
|
|
182
|
+
const loadDiscordTargetResolverModule = createLazyRuntimeModule(() => import("./target-resolver-CApivu3G.mjs").then((n) => n.r));
|
|
183
|
+
const loadDiscordProviderRuntime = createLazyRuntimeModule(() => import("./provider.runtime-DnionCyo.mjs"));
|
|
184
|
+
const loadDiscordProbeRuntime = createLazyRuntimeModule(() => import("./probe-CBaoCs-c.mjs").then((n) => n.o));
|
|
183
185
|
async function probeDiscordStatusAccount(params) {
|
|
184
186
|
const startedAtMs = Date.now();
|
|
185
187
|
const runtime = await loadDiscordProbeRuntime();
|
|
186
188
|
const remainingMs = Math.max(1, params.timeoutMs - Math.max(0, Date.now() - startedAtMs));
|
|
187
189
|
return await runtime.probeDiscord(params.token, remainingMs, { includeApplication: true });
|
|
188
190
|
}
|
|
189
|
-
const loadDiscordAuditModule = createLazyRuntimeModule(() => import("./audit-
|
|
190
|
-
const loadDiscordSendModule = createLazyRuntimeModule(() => import("./send-
|
|
191
|
-
const loadDiscordDirectoryLiveModule = createLazyRuntimeModule(() => import("./directory-live-
|
|
192
|
-
|
|
191
|
+
const loadDiscordAuditModule = createLazyRuntimeModule(() => import("./audit-ChorIwio.mjs").then((n) => n.n));
|
|
192
|
+
const loadDiscordSendModule = createLazyRuntimeModule(() => import("./send-da6ENJ9f.mjs").then((n) => n.t));
|
|
193
|
+
const loadDiscordDirectoryLiveModule = createLazyRuntimeModule(() => import("./directory-live-BDVl2DoC.mjs").then((n) => n.t));
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region extensions/discord/src/conversation-route-owner.ts
|
|
193
196
|
function prepareDiscordConversationRouteOwner(params) {
|
|
194
197
|
const accountId = normalizeAccountId(params.accountId);
|
|
195
198
|
if (params.cfg.channels?.discord?.enabled === false || !listDiscordAccountIds(params.cfg).some((id) => normalizeAccountId(id) === accountId) || resolveDiscordAccountConfig(params.cfg, accountId)?.enabled === false) return null;
|
|
@@ -263,7 +266,8 @@ async function prepareDiscordConversationRouteOwnersAsync(inputs, inspectBinding
|
|
|
263
266
|
return () => item.resolve(inspect()[position]);
|
|
264
267
|
});
|
|
265
268
|
}
|
|
266
|
-
|
|
269
|
+
//#endregion
|
|
270
|
+
//#region extensions/discord/src/group-policy.ts
|
|
267
271
|
const guildScopeKey = (guildKey) => scopeKey(["guild", guildKey]);
|
|
268
272
|
const channelScopeKey = (guildKey, channelKey) => scopeKey(["guild", guildKey], ["channel", channelKey]);
|
|
269
273
|
function resolveDiscordGuildKey(guilds, groupSpace) {
|
|
@@ -325,7 +329,8 @@ function resolveDiscordGroupToolPolicy(params) {
|
|
|
325
329
|
senderE164: params.senderE164
|
|
326
330
|
});
|
|
327
331
|
}
|
|
328
|
-
|
|
332
|
+
//#endregion
|
|
333
|
+
//#region extensions/discord/src/status-issues.ts
|
|
329
334
|
function isDiscordMessageContentIntentDisabled(value) {
|
|
330
335
|
return isRecord$1(value) && isRecord$1(value.intents) && value.intents.messageContent === "disabled";
|
|
331
336
|
}
|
|
@@ -403,7 +408,8 @@ function collectDiscordStatusIssues(accounts) {
|
|
|
403
408
|
}
|
|
404
409
|
return issues;
|
|
405
410
|
}
|
|
406
|
-
|
|
411
|
+
//#endregion
|
|
412
|
+
//#region extensions/discord/src/thread-bindings-channel.ts
|
|
407
413
|
function toConversationLifecycleBinding(binding) {
|
|
408
414
|
return {
|
|
409
415
|
boundAt: binding.boundAt,
|
|
@@ -439,7 +445,8 @@ const discordConversationBindings = {
|
|
|
439
445
|
accountId: params.accountId ?? void 0
|
|
440
446
|
})).map(toConversationLifecycleBinding)
|
|
441
447
|
};
|
|
442
|
-
|
|
448
|
+
//#endregion
|
|
449
|
+
//#region extensions/discord/src/channel.ts
|
|
443
450
|
const DISCORD_ACCOUNT_STARTUP_STAGGER_MS = 1e4;
|
|
444
451
|
const discordMessageAdapter = createChannelMessageAdapterFromOutbound({
|
|
445
452
|
id: "discord",
|
|
@@ -886,4 +893,5 @@ const discordPlugin = createChatChannelPlugin({
|
|
|
886
893
|
shouldSuppressLocalPayloadPrompt: shouldSuppressLocalDiscordExecApprovalPrompt
|
|
887
894
|
}
|
|
888
895
|
});
|
|
896
|
+
//#endregion
|
|
889
897
|
export { shouldHandleDiscordApprovalRequest as a, resolveDiscordGroupToolPolicy as i, collectDiscordStatusIssues as n, resolveDiscordGroupRequireMention as r, discordPlugin as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
//#region extensions/discord/src/monitor/channel-access.ts
|
|
2
2
|
function readDiscordChannelPropertySafe(channel, key) {
|
|
3
3
|
if (!channel || typeof channel !== "object") return;
|
|
4
4
|
try {
|
|
@@ -44,4 +44,5 @@ function resolveDiscordChannelInfoSafe(channel) {
|
|
|
44
44
|
parentName: resolveDiscordChannelNameSafe(parent)
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
+
//#endregion
|
|
47
48
|
export { resolveDiscordChannelParentSafe as a, resolveDiscordChannelParentIdSafe as i, resolveDiscordChannelInfoSafe as n, resolveDiscordChannelTopicSafe as o, resolveDiscordChannelNameSafe as r, resolveDiscordChannelIdSafe as t };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { c as resolveDefaultDiscordAccountId, g as resolveDiscordToken, n as inspectDiscordAccountConfig, s as mergeDiscordAccountConfig, u as resolveDiscordAccountAllowFrom } from "./accounts-
|
|
2
|
-
import { i as discordSetupContract, t as createDiscordPluginBase } from "./shared-
|
|
3
|
-
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-
|
|
4
|
-
import { t as resolveDiscordUserAllowlist } from "./resolve-users-
|
|
1
|
+
import { c as resolveDefaultDiscordAccountId, g as resolveDiscordToken, n as inspectDiscordAccountConfig, s as mergeDiscordAccountConfig, u as resolveDiscordAccountAllowFrom } from "./accounts-ljrzXBJi.mjs";
|
|
2
|
+
import { i as discordSetupContract, t as createDiscordPluginBase } from "./shared-CY5vJM48.mjs";
|
|
3
|
+
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-Cj5i7hzj.mjs";
|
|
4
|
+
import { t as resolveDiscordUserAllowlist } from "./resolve-users-BQLbysRB.mjs";
|
|
5
5
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
6
6
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { resolveBasicAllowFromEntries } from "openclaw/plugin-sdk/allow-from";
|
|
8
8
|
import { createAccountScopedAllowFromSection, createAccountScopedGroupAccessSection, createSetupTranslator, createStandardChannelSetupStatus, defineTokenCredential, parseMentionOrPrefixedId, patchChannelConfigForAccount, promptResolvedAllowFrom, resolveEntriesWithOptionalToken, resolveSetupAccountId, setSetupChannelEnabled, splitSetupEntries } from "openclaw/plugin-sdk/setup-runtime";
|
|
9
9
|
import { createChannelDmPolicy } from "openclaw/plugin-sdk/channel-dm-policy";
|
|
10
10
|
import { formatDocsLink } from "openclaw/plugin-sdk/setup-tools";
|
|
11
|
-
|
|
11
|
+
//#region extensions/discord/src/setup-account-state.ts
|
|
12
12
|
function resolveDiscordSetupAccountConfig(params) {
|
|
13
13
|
const accountId = normalizeAccountId(params.accountId ?? resolveDefaultDiscordAccountId(params.cfg));
|
|
14
14
|
return {
|
|
@@ -19,7 +19,8 @@ function resolveDiscordSetupAccountConfig(params) {
|
|
|
19
19
|
function inspectDiscordSetupAccount(params) {
|
|
20
20
|
return inspectDiscordAccountConfig(params, { resolveFallbackToken: (accountId) => resolveDiscordToken(params.cfg, { accountId }) });
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region extensions/discord/src/setup-core.ts
|
|
23
24
|
const t$1 = createSetupTranslator();
|
|
24
25
|
const channel$1 = "discord";
|
|
25
26
|
const DISCORD_TOKEN_HELP_LINES = [
|
|
@@ -174,7 +175,8 @@ function createDiscordSetupWizardBase(handlers) {
|
|
|
174
175
|
disable: (cfg) => setSetupChannelEnabled(cfg, channel$1, false)
|
|
175
176
|
};
|
|
176
177
|
}
|
|
177
|
-
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region extensions/discord/src/setup-surface.ts
|
|
178
180
|
const t = createSetupTranslator();
|
|
179
181
|
const channel = "discord";
|
|
180
182
|
async function promptDiscordAllowFrom(params) {
|
|
@@ -237,9 +239,11 @@ const discordSetupWizard = createDiscordSetupWizardBase({
|
|
|
237
239
|
resolveEntries: resolveDiscordChannelAllowlist
|
|
238
240
|
})
|
|
239
241
|
});
|
|
240
|
-
|
|
242
|
+
//#endregion
|
|
243
|
+
//#region extensions/discord/src/channel.setup.ts
|
|
241
244
|
const discordSetupPlugin = { ...createDiscordPluginBase({
|
|
242
245
|
setupWizard: discordSetupWizard,
|
|
243
246
|
setupContract: discordSetupContract
|
|
244
247
|
}) };
|
|
248
|
+
//#endregion
|
|
245
249
|
export { discordSetupPlugin as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
//#region extensions/discord/src/command-deploy-store.ts
|
|
2
2
|
const DISCORD_COMMAND_DEPLOY_HASH_NAMESPACE = "command-deploy-hashes";
|
|
3
3
|
const DISCORD_COMMAND_DEPLOY_HASH_MAX_ENTRIES = 1e4;
|
|
4
4
|
function openDiscordCommandDeployHashStore(openKeyedStore) {
|
|
@@ -8,4 +8,5 @@ function openDiscordCommandDeployHashStore(openKeyedStore) {
|
|
|
8
8
|
overflowPolicy: "evict-oldest"
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
|
+
//#endregion
|
|
11
12
|
export { DISCORD_COMMAND_DEPLOY_HASH_NAMESPACE as n, openDiscordCommandDeployHashStore as r, DISCORD_COMMAND_DEPLOY_HASH_MAX_ENTRIES as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
//#region extensions/discord/src/command-owners.ts
|
|
2
2
|
function resolveDiscordCommandOwnerEntries(cfg) {
|
|
3
3
|
const entries = (cfg.commands?.ownerAllowFrom ?? []).map((entry) => String(entry).trim()).filter((entry) => entry && (/^(discord|user|pk):/i.test(entry) || !entry.includes(":")));
|
|
4
4
|
return entries.length > 0 ? entries : void 0;
|
|
@@ -6,4 +6,5 @@ function resolveDiscordCommandOwnerEntries(cfg) {
|
|
|
6
6
|
function resolveDiscordCommandOwnerAllowFrom(cfg) {
|
|
7
7
|
return resolveDiscordCommandOwnerEntries(cfg)?.map((entry) => entry.replace(/^discord:/i, "").trim()).filter(Boolean);
|
|
8
8
|
}
|
|
9
|
+
//#endregion
|
|
9
10
|
export { resolveDiscordCommandOwnerEntries as n, resolveDiscordCommandOwnerAllowFrom as t };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { A as StringSelectMenu, C as LinkButton, D as Row, E as RoleSelectMenu, M as Thumbnail, N as UserSelectMenu, O as Section, S as File, T as MentionableSelectMenu, _ as TextInput, b as ChannelSelectMenu, g as RadioGroup, h as Modal, j as TextDisplay, k as Separator, m as Label, p as CheckboxGroup, tt as parseCustomId, v as AnySelectMenu, w as MediaGallery, x as Container, xt as stripUndefinedFields, y as Button } from "./discord-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
+
import { A as StringSelectMenu, C as LinkButton, D as Row, E as RoleSelectMenu, M as Thumbnail, N as UserSelectMenu, O as Section, S as File, T as MentionableSelectMenu, _ as TextInput, b as ChannelSelectMenu, g as RadioGroup, h as Modal, j as TextDisplay, k as Separator, m as Label, p as CheckboxGroup, tt as parseCustomId, v as AnySelectMenu, w as MediaGallery, x as Container, xt as stripUndefinedFields, y as Button } from "./discord-BMD-JiVS.mjs";
|
|
3
3
|
import { asBoolean, asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString, readNonBlankString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { ButtonStyle, MessageFlags, TextInputStyle } from "discord-api-types/v10";
|
|
5
5
|
import { resolveAskUserQuestionOptionIndex } from "openclaw/plugin-sdk/reply-payload";
|
|
6
6
|
import crypto from "node:crypto";
|
|
7
7
|
import { legacyInteractiveReplyToPresentation, resolveMessagePresentationActionValue, resolveMessagePresentationButtonAction, resolveMessagePresentationOptionAction } from "openclaw/plugin-sdk/interactive-runtime";
|
|
8
8
|
import { buildApprovalResolutionRef } from "openclaw/plugin-sdk/approval-reference-runtime";
|
|
9
|
-
|
|
9
|
+
//#region extensions/discord/src/custom-id-codec.ts
|
|
10
10
|
/**
|
|
11
11
|
* URI-component codec for values embedded in `k=v;` custom-id grammars
|
|
12
12
|
* (exec approvals, model picker, command args, agent components).
|
|
@@ -36,7 +36,8 @@ function needsCustomIdFieldEscaping(value) {
|
|
|
36
36
|
function unescapeCustomIdFieldValue(value) {
|
|
37
37
|
return value.replace(/%(25|3B)/gi, (match) => match.toLowerCase() === "%25" ? "%" : ";");
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region extensions/discord/src/component-custom-id.ts
|
|
40
41
|
const DISCORD_COMPONENT_CUSTOM_ID_KEY = "occomp";
|
|
41
42
|
const DISCORD_MODAL_CUSTOM_ID_KEY = "ocmodal";
|
|
42
43
|
const DISCORD_ACTIVITY_CUSTOM_ID_KEY = "ocactivity";
|
|
@@ -116,7 +117,8 @@ function parseDiscordComponentCustomIdForInteraction(id) {
|
|
|
116
117
|
function parseDiscordModalCustomIdForInteraction(id) {
|
|
117
118
|
return parseDiscordCustomIdForInteraction(id, DISCORD_MODAL_CUSTOM_ID_KEY);
|
|
118
119
|
}
|
|
119
|
-
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region extensions/discord/src/components.parse.ts
|
|
120
122
|
const DISCORD_COMPONENT_ATTACHMENT_PREFIX = "attachment://";
|
|
121
123
|
const BLOCK_ALIASES = /* @__PURE__ */ new Map([["row", "actions"], ["action-row", "actions"]]);
|
|
122
124
|
function requireObject(value, label) {
|
|
@@ -415,7 +417,8 @@ function readDiscordComponentSpec(raw) {
|
|
|
415
417
|
modal
|
|
416
418
|
};
|
|
417
419
|
}
|
|
418
|
-
|
|
420
|
+
//#endregion
|
|
421
|
+
//#region extensions/discord/src/components.builders.ts
|
|
419
422
|
function createShortId(prefix) {
|
|
420
423
|
return `${prefix}${crypto.randomBytes(6).toString("base64url")}`;
|
|
421
424
|
}
|
|
@@ -658,7 +661,8 @@ function buildDiscordComponentMessage(params) {
|
|
|
658
661
|
function buildDiscordComponentMessageFlags(components) {
|
|
659
662
|
return components.some((component) => component.isV2) ? MessageFlags.IsComponentsV2 : void 0;
|
|
660
663
|
}
|
|
661
|
-
|
|
664
|
+
//#endregion
|
|
665
|
+
//#region extensions/discord/src/components.modal.ts
|
|
662
666
|
function createModalFieldComponent(field) {
|
|
663
667
|
if (field.type === "text") {
|
|
664
668
|
class DynamicTextInput extends TextInput {
|
|
@@ -731,7 +735,8 @@ function createDiscordFormModal(entry) {
|
|
|
731
735
|
fields: entry.fields
|
|
732
736
|
});
|
|
733
737
|
}
|
|
734
|
-
|
|
738
|
+
//#endregion
|
|
739
|
+
//#region extensions/discord/src/approval-custom-id.ts
|
|
735
740
|
const DISCORD_APPROVAL_CUSTOM_ID_MAX_CHARS = 100;
|
|
736
741
|
function encodeDiscordApprovalCustomId(action) {
|
|
737
742
|
return `execapproval:kind=${action.approvalKind};id=${encodeURIComponent(action.approvalId)};action=${action.decision}`;
|
|
@@ -780,7 +785,8 @@ function parseExecApprovalData(data) {
|
|
|
780
785
|
action: rawAction
|
|
781
786
|
};
|
|
782
787
|
}
|
|
783
|
-
|
|
788
|
+
//#endregion
|
|
789
|
+
//#region extensions/discord/src/question-custom-id.ts
|
|
784
790
|
const QUESTION_RECORD_ID_PATTERN = /^ask_[a-f0-9]{32}$/u;
|
|
785
791
|
function buildDiscordQuestionCustomId(callback) {
|
|
786
792
|
if (!QUESTION_RECORD_ID_PATTERN.test(callback.questionId) || !Number.isInteger(callback.optionIndex) || callback.optionIndex < 0 || callback.optionIndex > 3) return;
|
|
@@ -795,7 +801,8 @@ function parseDiscordQuestionData(data) {
|
|
|
795
801
|
optionIndex: Number(rawIndex)
|
|
796
802
|
};
|
|
797
803
|
}
|
|
798
|
-
|
|
804
|
+
//#endregion
|
|
805
|
+
//#region extensions/discord/src/shared-interactive.ts
|
|
799
806
|
var shared_interactive_exports = /* @__PURE__ */ __exportAll({
|
|
800
807
|
buildDiscordInteractiveComponents: () => buildDiscordInteractiveComponents,
|
|
801
808
|
buildDiscordPresentationComponents: () => buildDiscordPresentationComponents
|
|
@@ -911,7 +918,8 @@ function buildDiscordPresentationComponents(presentation, options = {}) {
|
|
|
911
918
|
}
|
|
912
919
|
return blocks.length ? { blocks } : void 0;
|
|
913
920
|
}
|
|
914
|
-
|
|
921
|
+
//#endregion
|
|
922
|
+
//#region extensions/discord/src/components.ts
|
|
915
923
|
var components_exports = /* @__PURE__ */ __exportAll({
|
|
916
924
|
DISCORD_COMPONENT_ATTACHMENT_PREFIX: () => DISCORD_COMPONENT_ATTACHMENT_PREFIX,
|
|
917
925
|
DISCORD_COMPONENT_CUSTOM_ID_KEY: () => DISCORD_COMPONENT_CUSTOM_ID_KEY,
|
|
@@ -939,4 +947,5 @@ function formatDiscordComponentEventText(params) {
|
|
|
939
947
|
if (values.length === 0) return `Updated "${params.label}".`;
|
|
940
948
|
return `Selected ${values.join(", ")} from "${params.label}".`;
|
|
941
949
|
}
|
|
950
|
+
//#endregion
|
|
942
951
|
export { parseDiscordActivityCustomIdForInteraction as C, parseDiscordModalCustomIdForInteraction as D, parseDiscordModalCustomId as E, decodeCustomIdComponent as O, parseDiscordActivityCustomId as S, parseDiscordComponentCustomIdForInteraction as T, DISCORD_COMPONENT_CUSTOM_ID_KEY as _, shared_interactive_exports as a, buildDiscordComponentCustomId as b, parseExecApprovalData as c, buildDiscordComponentMessage as d, buildDiscordComponentMessageFlags as f, resolveDiscordComponentAttachmentName as g, readDiscordComponentSpec as h, buildDiscordPresentationComponents as i, encodeCustomIdComponent as k, DiscordFormModal as l, coerceDiscordComponentParam as m, formatDiscordComponentEventText as n, parseDiscordQuestionData as o, DISCORD_COMPONENT_ATTACHMENT_PREFIX as p, buildDiscordInteractiveComponents as r, buildExecApprovalCustomId as s, components_exports as t, createDiscordFormModal as u, DISCORD_MODAL_CUSTOM_ID_KEY as v, parseDiscordComponentCustomId as w, buildDiscordModalCustomId as x, buildDiscordActivityCustomId as y };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { t as runtime_doctor_migrations_exports } from "./runtime-doctor-migrations-
|
|
1
|
+
import { t as runtime_doctor_migrations_exports } from "./runtime-doctor-migrations-BPV-R4G9.mjs";
|
|
2
2
|
import { buildSecretInputSchema, registerSensitiveConfigSchema } from "openclaw/plugin-sdk/secret-input";
|
|
3
3
|
import { normalizeLegacyDmAliases } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
4
4
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { createChannelConfigUiHints } from "openclaw/plugin-sdk/channel-core";
|
|
6
6
|
import { ChannelBotLoopProtectionSchema, ChannelDangerouslyAllowNameMatchingSchema, ChannelPreviewStreamingConfigSchema, ChannelThreadBindingsSchema, ProviderCommandsSchema, TtsConfigSchema, buildChannelAccountSchemaParts, buildChannelAllowBotsSchema, buildChannelConfigSchema, buildChannelExecApprovalsSchema, buildChannelReactionShape, buildGroupEntrySchema, refineChannelDmPolicy } from "openclaw/plugin-sdk/channel-config-schema";
|
|
7
7
|
import { z } from "zod";
|
|
8
|
-
|
|
8
|
+
//#region extensions/discord/src/config-ui-hints.ts
|
|
9
9
|
const discordChannelConfigUiHints = {
|
|
10
10
|
"": {
|
|
11
11
|
label: "Discord",
|
|
@@ -335,7 +335,8 @@ const discordChannelConfigUiHints = {
|
|
|
335
335
|
help: "Optional Activity application ID. Defaults to the bot application ID learned at gateway startup."
|
|
336
336
|
}
|
|
337
337
|
};
|
|
338
|
-
|
|
338
|
+
//#endregion
|
|
339
|
+
//#region extensions/discord/src/config-schema.ts
|
|
339
340
|
const SecretInputSchema = buildSecretInputSchema();
|
|
340
341
|
const DiscordIdSchema = z.union([z.string(), z.number()]).transform((value, ctx) => {
|
|
341
342
|
if (typeof value === "number") {
|
|
@@ -638,4 +639,5 @@ const DiscordConfigSchemaBase = DiscordAccountSchemaBase.safeExtend({
|
|
|
638
639
|
});
|
|
639
640
|
const DiscordConfigSchema = z.preprocess(normalizeShippedDiscordDmAliases, DiscordConfigSchemaBase);
|
|
640
641
|
const DiscordChannelConfigSchema = buildChannelConfigSchema(DiscordConfigSchema, { uiHints: discordChannelConfigUiHints });
|
|
642
|
+
//#endregion
|
|
641
643
|
export { DiscordChannelConfigSchema as t };
|