@openclaw/discord 2026.11.3 → 2026.11.5-beta.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-8cCu6uPG.mjs → account-inspect-DGkdWwix.mjs} +1 -1
- package/dist/.setup/{accounts-ljrzXBJi.mjs → accounts-C_25wyxC.mjs} +9 -6
- package/dist/.setup/{active-turn-thread-route-C4tp9noA.mjs → active-turn-thread-route-KvRTAVE3.mjs} +1 -2
- package/dist/.setup/{allow-list-BKqOldGy.mjs → allow-list-BXrS8-R9.mjs} +4 -152
- package/dist/.setup/{api-DqmMUZau.mjs → api-BlBD4ism.mjs} +10 -20
- package/dist/.setup/{approval-handler.runtime-D0qu1um7.mjs → approval-handler.runtime-BGYjX1t9.mjs} +80 -61
- package/dist/.setup/{approval-message-updates-CdurC9Ej.mjs → approval-message-updates-DKsCfxSW.mjs} +2 -2
- package/dist/.setup/{audit-ChorIwio.mjs → audit-5b-FXj9R.mjs} +4 -4
- package/dist/.setup/{channel-ZilgdF5e.mjs → channel-CWwTHWFo.mjs} +134 -202
- package/dist/.setup/channel-access-9cyzozUP.mjs +24 -0
- package/dist/.setup/channel.setup-B3MtmBQG.mjs +238 -0
- package/dist/.setup/{components-Du9NhD8h.mjs → components-YCvQ6YLS.mjs} +209 -430
- package/dist/.setup/components.base-CiS0h_XP.mjs +32 -0
- package/dist/.setup/{config-schema-_uBILpQf.mjs → config-schema-BNKN1cu5.mjs} +6 -7
- package/dist/.setup/{conversation-binding-route-8Ul1KpGF.mjs → conversation-binding-route-kCTw8cij.mjs} +2 -2
- package/dist/.setup/{directory-config-3iVub-3m.mjs → directory-config-Ble81PWH.mjs} +1 -1
- package/dist/.setup/{directory-live-BDVl2DoC.mjs → directory-live-DH3tpS3x.mjs} +52 -57
- package/dist/.setup/{discord-BMD-JiVS.mjs → discord-DGVSguhx.mjs} +1124 -1710
- package/dist/.setup/{doctor-hQKbkNKq.mjs → doctor-eujgbnpZ.mjs} +3 -5
- package/dist/.setup/endpoint-runtime-lf4DeLas.mjs +139 -0
- package/dist/.setup/guilds-eDq22iSM.mjs +22 -0
- package/dist/.setup/{handle-action-B1lmt4ms.mjs → handle-action-CktwmzMz.mjs} +15 -15
- package/dist/.setup/{handle-action.guild-admin-B6g31cwt.mjs → handle-action.guild-admin-WLQ7fRqI.mjs} +5 -5
- package/dist/.setup/listeners-Df8lx3vK.mjs +47 -0
- package/dist/.setup/{live-policy-config-C_Q966Wh.mjs → live-policy-config-DiBVuaU6.mjs} +2 -3
- package/dist/.setup/{message-handler-CkI3yMjL.mjs → message-handler-hhNSioxo.mjs} +154 -115
- package/dist/.setup/{message-handler.preflight-CEfkFV9U.mjs → message-handler.preflight-BZcZE1o-.mjs} +30 -105
- package/dist/.setup/{message-handler.preflight-pluralkit-D5si80_L.mjs → message-handler.preflight-pluralkit-CYZfXXb6.mjs} +9 -22
- package/dist/.setup/{message-handler.process-DsMtetRf.mjs → message-handler.process-B0n-mQ99.mjs} +256 -373
- package/dist/.setup/outbound-payload-BaZmjewa.mjs +447 -0
- package/dist/.setup/{outbound-session-route-BtUpGBTb.mjs → outbound-session-route-Cgx4i9cS.mjs} +139 -86
- package/dist/.setup/{preflight-audio-wWgsZG5F.mjs → preflight-audio-C6QtD6HX.mjs} +1 -5
- package/dist/.setup/{presence-cache-DCeTsL73.mjs → presence-cache-Dq-3nH7R.mjs} +1 -6
- package/dist/.setup/{probe-CBaoCs-c.mjs → probe-DezB-6xz.mjs} +5 -9
- package/dist/.setup/{provider-CI_OLfvz.mjs → provider-BN2bCIUp.mjs} +3440 -4308
- package/dist/.setup/{provider-session.runtime-TWOo_JZx.mjs → provider-session.runtime-Dr_5X43t.mjs} +3 -3
- package/dist/.setup/provider.runtime-BuJpl0Pv.mjs +1 -0
- package/dist/.setup/proxy-fetch-BzXwBAXt.mjs +30 -0
- package/dist/.setup/{realtime-session.runtime-DvfS4vJj.mjs → realtime-session.runtime-BTDWsV4d.mjs} +44 -81
- package/dist/.setup/{receive-recovery-CKvaG2Hf.mjs → receive-recovery-C3Ks4wAQ.mjs} +13 -27
- package/dist/.setup/{resolve-allowlist-common-cIjtqh2F.mjs → resolve-allowlist-common-Bk8Fj6Ik.mjs} +3 -13
- package/dist/.setup/{resolve-channels-Cj5i7hzj.mjs → resolve-channels-Bp8frXvc.mjs} +7 -8
- package/dist/.setup/{resolve-users-BQLbysRB.mjs → resolve-users-Cvcj22sG.mjs} +4 -7
- package/dist/.setup/{runtime-RWnuJgWB.mjs → runtime-BJaCvlmq.mjs} +196 -239
- package/dist/.setup/{runtime-plifsKg9.mjs → runtime-BMgTyuwg.mjs} +6 -6
- package/dist/.setup/{secret-config-contract-z6FhbT8E.mjs → secret-config-contract-B1kE4sDv.mjs} +4 -9
- package/dist/.setup/{send-da6ENJ9f.mjs → send-CVW7V-VZ.mjs} +149 -175
- package/dist/.setup/{send.components-CWZUuGvA.mjs → send.components-C8YXdnO_.mjs} +59 -71
- package/dist/.setup/{send.outbound-qZ3iK3Vq.mjs → send.outbound-Uzcmh3Yd.mjs} +76 -129
- package/dist/.setup/{send.receipt-C18khRYH.mjs → send.receipt-NZDOTZBU.mjs} +30 -32
- package/dist/.setup/{send.shared-CnlMgoqQ.mjs → send.shared-a_6Oeyg1.mjs} +38 -115
- package/dist/.setup/{sender-identity-DgbJykq0.mjs → sender-identity-76HFb8eK.mjs} +3 -9
- package/dist/.setup/setup-plugin-api-BExhGEhL.mjs +2 -0
- package/dist/.setup/shared-interactive-DmzaoKOM.mjs +316 -0
- package/dist/.setup/{shared-CY5vJM48.mjs → shared-yDUSExm2.mjs} +8 -11
- package/dist/.setup/{subagent-hooks-CIu2TFz3.mjs → subagent-hooks-CDkdHQyy.mjs} +1 -1
- package/dist/.setup/{system-events-DCOLXkwS.mjs → system-events-yfWz150v.mjs} +2 -2
- package/dist/.setup/{target-resolver-CApivu3G.mjs → target-resolver-BOOzqxxM.mjs} +3 -3
- package/dist/.setup/{thread-bindings-DcvT_JgI.mjs → thread-bindings-zce4cpu_.mjs} +12 -20
- package/dist/.setup/{thread-bindings.manager-5Sh7yedN.mjs → thread-bindings.manager-NywKzUtc.mjs} +22 -42
- package/dist/.setup/{thread-bindings.session-updates-BMdJeJMc.mjs → thread-bindings.session-updates-D0j7oh8S.mjs} +11 -18
- package/dist/.setup/{threading-CzjFeUSe.mjs → threading-DodLYDt-.mjs} +68 -105
- package/dist/.setup/{timeouts-CuNARfyw.mjs → timeouts-cIxzatmv.mjs} +1 -1
- package/dist/.setup/{transcripts-source-8RDQrSVb.mjs → transcripts-source-ie9GBWaU.mjs} +110 -179
- package/dist/.setup/{voice-runtime-BsDILmAv.mjs → voice-runtime-B7V_LTdX.mjs} +231 -452
- package/dist/.source-module-urls/d6c089460280c5a04184542d6712e04545caeb1ebb290d3504377b4cc5e22fea.json +1 -0
- package/dist/account-inspect-api.js +1 -1
- package/dist/action-runtime-api.js +1 -2
- package/dist/activities-api.js +286 -341
- package/dist/api.js +16 -16
- package/dist/channel-config-api.js +1 -2
- package/dist/channel-plugin-api.js +1 -2
- package/dist/contract-api.js +1 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/runtime-api.js +22 -22
- package/dist/runtime-setter-api.js +1 -2
- package/dist/secret-contract-api.js +1 -2
- package/dist/security-audit-contract-api.js +1 -2
- package/dist/security-contract-api.js +1 -2
- package/dist/session-key-api.js +1 -2
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-api.js +1 -2
- package/dist/src/voice/audio-worker.runtime.js +56 -68
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/thread-binding-api.js +1 -2
- package/dist/transcripts-source-api.js +1 -1
- package/node_modules/@napi-rs/wasm-runtime/dist/fs.js +3339 -4021
- package/node_modules/@napi-rs/wasm-runtime/package.json +1 -1
- package/node_modules/@types/lodash/README.md +1 -1
- package/node_modules/@types/lodash/common/function.d.ts +2 -2
- package/node_modules/@types/lodash/package.json +2 -2
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/util.d.ts +6 -3
- package/node_modules/discord-api-types/package.json +4 -4
- package/node_modules/discord-api-types/rest/v10/index.d.ts +8 -0
- package/node_modules/discord-api-types/rest/v10/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v10/index.js +8 -0
- package/node_modules/discord-api-types/rest/v10/index.js.map +1 -1
- package/node_modules/discord-api-types/rest/v10/oauth2.d.ts +26 -2
- package/node_modules/discord-api-types/rest/v10/oauth2.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v9/index.d.ts +8 -0
- package/node_modules/discord-api-types/rest/v9/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v9/index.js +8 -0
- package/node_modules/discord-api-types/rest/v9/index.js.map +1 -1
- package/node_modules/discord-api-types/rest/v9/oauth2.d.ts +26 -2
- package/node_modules/discord-api-types/rest/v9/oauth2.d.ts.map +1 -1
- package/node_modules/typebox/build/format/duration.d.mts +2 -2
- package/node_modules/typebox/build/format/duration.mjs +2 -2
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_email.mjs +1 -0
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
- package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
- package/node_modules/typebox/build/format/ipv4.mjs +2 -2
- package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
- package/node_modules/typebox/build/format/ipv6.mjs +1 -1
- package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
- package/node_modules/typebox/build/schema/build.mjs +1 -0
- package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
- package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
- package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
- package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
- package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
- package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
- package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
- package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
- package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
- package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
- package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
- package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
- package/node_modules/typebox/build/system/memory/create.mjs +18 -13
- package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
- package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
- package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
- package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
- package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
- package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
- package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
- package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
- package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
- package/node_modules/typebox/build/system/memory/update.mjs +43 -16
- package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
- package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
- package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
- package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
- package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
- package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
- package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
- package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
- package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
- package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +1 -1
- package/node_modules/undici/docs/docs/api/Interceptors.md +15 -2
- package/node_modules/undici/lib/dispatcher/client-h2.js +78 -3
- package/node_modules/undici/lib/dispatcher/pool-base.js +20 -3
- package/node_modules/undici/package.json +3 -3
- package/node_modules/undici/types/api.d.ts +1 -1
- package/node_modules/undici/types/utility.d.ts +4 -4
- package/node_modules/uuid/package.json +17 -17
- package/node_modules/zod/package.json +1 -1
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
- package/node_modules/zod/src/v4/core/compile.ts +9 -0
- package/node_modules/zod/src/v4/core/schemas.ts +35 -1
- package/node_modules/zod/src/v4/core/util.ts +13 -0
- package/node_modules/zod/src/v4/core/versions.ts +1 -1
- package/node_modules/zod/v4/core/compile.cjs +8 -0
- package/node_modules/zod/v4/core/compile.js +8 -0
- package/node_modules/zod/v4/core/schemas.cjs +30 -0
- package/node_modules/zod/v4/core/schemas.d.cts +3 -1
- package/node_modules/zod/v4/core/schemas.d.ts +3 -1
- package/node_modules/zod/v4/core/schemas.js +30 -0
- package/node_modules/zod/v4/core/util.cjs +15 -0
- package/node_modules/zod/v4/core/util.d.cts +2 -0
- package/node_modules/zod/v4/core/util.d.ts +2 -0
- package/node_modules/zod/v4/core/util.js +14 -0
- package/node_modules/zod/v4/core/versions.cjs +1 -1
- package/node_modules/zod/v4/core/versions.js +1 -1
- package/openclaw.plugin.json +1 -31
- package/package.json +8 -8
- package/dist/.setup/channel-access-DasWY_OV.mjs +0 -48
- package/dist/.setup/channel.setup-DaDQdctj.mjs +0 -249
- package/dist/.setup/outbound-adapter-DfAanoCO.mjs +0 -543
- package/dist/.setup/provider.runtime-DnionCyo.mjs +0 -2
- package/dist/.setup/setup-plugin-api-D1QuM187.mjs +0 -3
- package/dist/.setup/targets-UWWZ6gF7.mjs +0 -3
- package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
- package/node_modules/typebox/build/system/memory/freeze.mjs +0 -6
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { c as resolveDefaultDiscordAccountId } from "./accounts-
|
|
2
|
-
import { t as inspectDiscordAccount } from "./account-inspect-
|
|
3
|
-
import { r as DISCORD_LEGACY_CONFIG_RULES } from "./shared-CY5vJM48.mjs";
|
|
1
|
+
import { c as resolveDefaultDiscordAccountId } from "./accounts-C_25wyxC.mjs";
|
|
2
|
+
import { t as inspectDiscordAccount } from "./account-inspect-DGkdWwix.mjs";
|
|
4
3
|
import { t as runtime_doctor_migrations_exports } from "./runtime-doctor-migrations-BPV-R4G9.mjs";
|
|
5
4
|
import { n as normalizeCompatibilityConfig } from "./doctor-contract-Bwv8EuQ_.mjs";
|
|
6
5
|
import { t as isDiscordMutableAllowEntry } from "./security-doctor-nGgPm65L.mjs";
|
|
7
|
-
import { n as discordVoiceTranscriptsSourceProvider } from "./transcripts-source-
|
|
6
|
+
import { n as discordVoiceTranscriptsSourceProvider } from "./transcripts-source-ie9GBWaU.mjs";
|
|
8
7
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
8
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
10
9
|
//#region extensions/discord/src/doctor.ts
|
|
@@ -168,7 +167,6 @@ const discordDoctor = {
|
|
|
168
167
|
groupModel: "route",
|
|
169
168
|
groupAllowFromFallbackToAllowFrom: false,
|
|
170
169
|
warnOnEmptyGroupSenderAllowlist: false,
|
|
171
|
-
legacyConfigRules: DISCORD_LEGACY_CONFIG_RULES,
|
|
172
170
|
normalizeCompatibilityConfig,
|
|
173
171
|
collectPreviewWarnings: ({ cfg, doctorFixCommand, env }) => [
|
|
174
172
|
...collectDiscordMissingEnvTokenWarnings({
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
|
|
2
|
+
import { fetchWithSsrFGuard, isBlockedHostnameOrIp, isLoopbackHost } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
3
|
+
//#region extensions/discord/src/endpoint-runtime.ts
|
|
4
|
+
const DISCORD_ENDPOINT_RESPONSE_MAX_BYTES = 8388608;
|
|
5
|
+
const DISCORD_API_URL_ENV = "DISCORD_API_URL";
|
|
6
|
+
function parseHttpAnchor(value, label) {
|
|
7
|
+
let url;
|
|
8
|
+
try {
|
|
9
|
+
url = new URL(value);
|
|
10
|
+
} catch {
|
|
11
|
+
throw new Error(`${label} must be a valid URL`);
|
|
12
|
+
}
|
|
13
|
+
if (url.protocol !== "https:" && !(url.protocol === "http:" && isLoopbackHost(url.hostname))) throw new Error(`${label} must use HTTPS or loopback HTTP`);
|
|
14
|
+
if (url.username || url.password || url.hash) throw new Error(`${label} must not contain credentials or a fragment`);
|
|
15
|
+
return url;
|
|
16
|
+
}
|
|
17
|
+
function normalizeRestApiBaseUrl(value) {
|
|
18
|
+
const url = parseHttpAnchor(value, "Discord endpoint REST API base URL");
|
|
19
|
+
if (url.search) throw new Error("Discord endpoint REST API base URL must not contain a query");
|
|
20
|
+
url.pathname = url.pathname.replace(/\/+$/u, "") || "/";
|
|
21
|
+
return url;
|
|
22
|
+
}
|
|
23
|
+
function resolveDescriptor(apiUrl) {
|
|
24
|
+
const restApiBaseUrl = normalizeRestApiBaseUrl(apiUrl);
|
|
25
|
+
const gatewayBotUrl = new URL(`${restApiBaseUrl.pathname.replace(/\/+$/u, "")}/gateway/bot`, restApiBaseUrl.origin);
|
|
26
|
+
const gatewayOriginUrl = new URL(restApiBaseUrl.origin);
|
|
27
|
+
gatewayOriginUrl.protocol = gatewayOriginUrl.protocol === "https:" ? "wss:" : "ws:";
|
|
28
|
+
if (gatewayOriginUrl.protocol === "wss:" && isBlockedHostnameOrIp(gatewayOriginUrl.hostname)) throw new Error("Discord endpoint Gateway origin must not target a private/internal/special-use hostname or IP address");
|
|
29
|
+
return Object.freeze({
|
|
30
|
+
restApiBaseUrl: restApiBaseUrl.toString().replace(/\/$/u, ""),
|
|
31
|
+
gatewayBotUrl: gatewayBotUrl.toString(),
|
|
32
|
+
gatewayOrigin: gatewayOriginUrl.origin
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function isWithinRestApiBase(target, restApiBaseUrl) {
|
|
36
|
+
if (target.origin !== restApiBaseUrl.origin) return false;
|
|
37
|
+
const basePath = restApiBaseUrl.pathname.replace(/\/+$/u, "");
|
|
38
|
+
return basePath === "" || target.pathname === basePath || target.pathname.startsWith(`${basePath}/`);
|
|
39
|
+
}
|
|
40
|
+
function assertEndpointHttpTarget(target, descriptor) {
|
|
41
|
+
const restApiBaseUrl = new URL(descriptor.restApiBaseUrl);
|
|
42
|
+
const gatewayBotUrl = new URL(descriptor.gatewayBotUrl);
|
|
43
|
+
if (!isWithinRestApiBase(target, restApiBaseUrl) && target.toString() !== gatewayBotUrl.toString()) throw new Error("Discord endpoint request is outside the configured boundaries");
|
|
44
|
+
}
|
|
45
|
+
function requestInitFromRequest(request, signal) {
|
|
46
|
+
return {
|
|
47
|
+
method: request.method,
|
|
48
|
+
headers: request.headers,
|
|
49
|
+
...request.body ? {
|
|
50
|
+
body: request.body,
|
|
51
|
+
duplex: "half"
|
|
52
|
+
} : {},
|
|
53
|
+
signal,
|
|
54
|
+
cache: request.cache,
|
|
55
|
+
credentials: request.credentials,
|
|
56
|
+
integrity: request.integrity,
|
|
57
|
+
keepalive: request.keepalive,
|
|
58
|
+
mode: request.mode,
|
|
59
|
+
referrer: request.referrer,
|
|
60
|
+
referrerPolicy: request.referrerPolicy
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function createEndpointFetch(descriptor) {
|
|
64
|
+
const allowedOrigins = Array.from(/* @__PURE__ */ new Set([new URL(descriptor.restApiBaseUrl).origin, new URL(descriptor.gatewayBotUrl).origin]));
|
|
65
|
+
return async (input, init, beforeRequest) => {
|
|
66
|
+
const request = new Request(input, init);
|
|
67
|
+
const target = new URL(request.url);
|
|
68
|
+
assertEndpointHttpTarget(target, descriptor);
|
|
69
|
+
const guarded = await fetchWithSsrFGuard({
|
|
70
|
+
url: target.toString(),
|
|
71
|
+
init: requestInitFromRequest(request, request.signal),
|
|
72
|
+
signal: request.signal,
|
|
73
|
+
requireHttps: target.protocol === "https:",
|
|
74
|
+
policy: { allowedOrigins },
|
|
75
|
+
maxRedirects: 0,
|
|
76
|
+
capture: false,
|
|
77
|
+
auditContext: "discord.endpoint-runtime",
|
|
78
|
+
beforeRequest
|
|
79
|
+
});
|
|
80
|
+
try {
|
|
81
|
+
const body = await readResponseWithLimit(guarded.response, DISCORD_ENDPOINT_RESPONSE_MAX_BYTES, { onOverflow: ({ size, maxBytes }) => /* @__PURE__ */ new Error(`Discord endpoint response too large: ${size} bytes (limit: ${maxBytes} bytes)`) });
|
|
82
|
+
return new Response(body.byteLength > 0 ? new Uint8Array(body) : null, {
|
|
83
|
+
status: guarded.response.status,
|
|
84
|
+
statusText: guarded.response.statusText,
|
|
85
|
+
headers: guarded.response.headers
|
|
86
|
+
});
|
|
87
|
+
} finally {
|
|
88
|
+
await guarded.release();
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/** Resolve the process-wide Discord API override using the same env convention as sibling channels. */
|
|
93
|
+
function getDiscordEndpointRuntime() {
|
|
94
|
+
const apiUrl = process.env[DISCORD_API_URL_ENV]?.trim();
|
|
95
|
+
if (!apiUrl) return;
|
|
96
|
+
const descriptor = resolveDescriptor(apiUrl);
|
|
97
|
+
return Object.freeze({
|
|
98
|
+
descriptor,
|
|
99
|
+
fetch: createEndpointFetch(descriptor)
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function resolveDiscordEndpointMediaGuard(url, retainedRuntime) {
|
|
103
|
+
const guard = resolveEndpointResourceGuard(url, "media", retainedRuntime);
|
|
104
|
+
return guard ? {
|
|
105
|
+
maxRedirects: guard.maxRedirects,
|
|
106
|
+
ssrfPolicy: guard.policy
|
|
107
|
+
} : void 0;
|
|
108
|
+
}
|
|
109
|
+
function resolveDiscordEndpointAttachmentGuard(url, retainedRuntime) {
|
|
110
|
+
return resolveEndpointResourceGuard(url, "attachment upload", retainedRuntime);
|
|
111
|
+
}
|
|
112
|
+
function resolveEndpointResourceGuard(url, kind, retainedRuntime) {
|
|
113
|
+
if (retainedRuntime === null) return;
|
|
114
|
+
const runtime = retainedRuntime ?? getDiscordEndpointRuntime();
|
|
115
|
+
if (!runtime) return;
|
|
116
|
+
const target = parseHttpAnchor(url, `Discord endpoint ${kind} URL`);
|
|
117
|
+
const restOrigin = new URL(runtime.descriptor.restApiBaseUrl).origin;
|
|
118
|
+
if (target.origin !== restOrigin) throw new Error(`Discord endpoint ${kind} URL is outside the configured REST origin`);
|
|
119
|
+
return {
|
|
120
|
+
maxRedirects: 0,
|
|
121
|
+
policy: {
|
|
122
|
+
allowedOrigins: [restOrigin],
|
|
123
|
+
hostnameAllowlist: [target.hostname]
|
|
124
|
+
},
|
|
125
|
+
requireHttps: target.protocol === "https:"
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function assertDiscordEndpointGatewayUrl(url, gatewayOrigin) {
|
|
129
|
+
if (!gatewayOrigin) return;
|
|
130
|
+
let parsed;
|
|
131
|
+
try {
|
|
132
|
+
parsed = new URL(url);
|
|
133
|
+
} catch {
|
|
134
|
+
throw new Error("Discord endpoint returned an invalid Gateway WebSocket URL");
|
|
135
|
+
}
|
|
136
|
+
if (parsed.origin !== gatewayOrigin || parsed.username || parsed.password || parsed.hash) throw new Error("Discord endpoint Gateway URL is outside the configured WebSocket origin");
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
139
|
+
export { resolveDiscordEndpointMediaGuard as i, getDiscordEndpointRuntime as n, resolveDiscordEndpointAttachmentGuard as r, assertDiscordEndpointGatewayUrl as t };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { o as normalizeDiscordSlug } from "./allow-list-BXrS8-R9.mjs";
|
|
2
|
+
import { r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-BlBD4ism.mjs";
|
|
3
|
+
//#region extensions/discord/src/guilds.ts
|
|
4
|
+
function listDiscordGuildChannels(token, fetcher, guildId) {
|
|
5
|
+
return fetchDiscord(`/guilds/${guildId}/channels`, token, fetcher, { timeoutMs: DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS });
|
|
6
|
+
}
|
|
7
|
+
function searchDiscordGuildMembers(token, fetcher, guildId, query, limit) {
|
|
8
|
+
const params = new URLSearchParams({
|
|
9
|
+
query,
|
|
10
|
+
limit: String(limit)
|
|
11
|
+
});
|
|
12
|
+
return fetchDiscord(`/guilds/${guildId}/members/search?${params.toString()}`, token, fetcher, { timeoutMs: DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS });
|
|
13
|
+
}
|
|
14
|
+
async function listGuilds(token, fetcher, options) {
|
|
15
|
+
return (await fetchDiscord("/users/@me/guilds", token, fetcher, options)).flatMap((guild) => typeof guild.id === "string" && typeof guild.name === "string" ? [{
|
|
16
|
+
id: guild.id,
|
|
17
|
+
name: guild.name,
|
|
18
|
+
slug: normalizeDiscordSlug(guild.name)
|
|
19
|
+
}] : []);
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { listGuilds as n, searchDiscordGuildMembers as r, listDiscordGuildChannels as t };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { q as withDiscordRequestAuthority } from "./discord-DGVSguhx.mjs";
|
|
2
|
+
import { s as matchesDiscordToolContextTarget } from "./send.receipt-NZDOTZBU.mjs";
|
|
3
3
|
import { n as resolveDiscordChannelId, t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
|
|
4
|
-
import "./
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { a as readDiscordAutoArchiveDurationParam, t as handleDiscordAction } from "./runtime-BJaCvlmq.mjs";
|
|
5
|
+
import { n as buildDiscordPresentationComponents, t as buildDiscordInteractiveComponents } from "./shared-interactive-DmzaoKOM.mjs";
|
|
6
|
+
import { c as coerceDiscordComponentParam } from "./components-YCvQ6YLS.mjs";
|
|
7
7
|
import "../action-runtime-api.js";
|
|
8
|
-
import {
|
|
9
|
-
import { t as tryHandleDiscordMessageActionGuildAdmin } from "./handle-action.guild-admin-
|
|
10
|
-
import { n as notifyDiscordActiveTurnThreadCreated, r as notifyDiscordActiveTurnThreadReplyDelivered } from "./active-turn-thread-route-
|
|
8
|
+
import { S as discordInboundEventDelivery, i as isDiscordComponentSpecWithinMessageLimit, n as DISCORD_PRESENTATION_CAPABILITIES } from "./outbound-session-route-Cgx4i9cS.mjs";
|
|
9
|
+
import { t as tryHandleDiscordMessageActionGuildAdmin } from "./handle-action.guild-admin-WLQ7fRqI.mjs";
|
|
10
|
+
import { n as notifyDiscordActiveTurnThreadCreated, r as notifyDiscordActiveTurnThreadReplyDelivered } from "./active-turn-thread-route-KvRTAVE3.mjs";
|
|
11
11
|
import { asOptionalRecord, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
12
|
import { resolveReactionMessageId } from "openclaw/plugin-sdk/channel-actions";
|
|
13
13
|
import { readBooleanParam } from "openclaw/plugin-sdk/boolean-param";
|
|
@@ -54,7 +54,7 @@ async function dispatchDiscordMessageAction(ctx) {
|
|
|
54
54
|
const details = asOptionalRecord(result.details);
|
|
55
55
|
if (details?.ok !== true) return result;
|
|
56
56
|
discordInboundEventDelivery.notify({
|
|
57
|
-
sessionKey: ctx.sessionKey ?? fallbackSessionKey
|
|
57
|
+
sessionKey: ctx.sessionKey ?? fallbackSessionKey,
|
|
58
58
|
to,
|
|
59
59
|
accountId,
|
|
60
60
|
inboundEventKind: ctx.inboundEventKind
|
|
@@ -137,9 +137,9 @@ async function dispatchDiscordMessageAction(ctx) {
|
|
|
137
137
|
to,
|
|
138
138
|
content: deliveryContent,
|
|
139
139
|
...threadName ? { threadName } : {},
|
|
140
|
-
mediaUrl
|
|
141
|
-
filename
|
|
142
|
-
replyTo
|
|
140
|
+
mediaUrl,
|
|
141
|
+
filename,
|
|
142
|
+
replyTo,
|
|
143
143
|
...action === "send" ? {
|
|
144
144
|
components,
|
|
145
145
|
embeds,
|
|
@@ -147,8 +147,8 @@ async function dispatchDiscordMessageAction(ctx) {
|
|
|
147
147
|
} : {},
|
|
148
148
|
silent,
|
|
149
149
|
...suppressEmbeds === void 0 ? {} : { suppressEmbeds },
|
|
150
|
-
__sessionKey: sessionKey
|
|
151
|
-
__agentId: agentId
|
|
150
|
+
__sessionKey: sessionKey,
|
|
151
|
+
__agentId: agentId
|
|
152
152
|
}), to, sessionKey);
|
|
153
153
|
}
|
|
154
154
|
if (action === "react") {
|
|
@@ -229,7 +229,7 @@ async function dispatchDiscordMessageAction(ctx) {
|
|
|
229
229
|
messageId,
|
|
230
230
|
content,
|
|
231
231
|
autoArchiveMinutes,
|
|
232
|
-
appliedTags
|
|
232
|
+
appliedTags
|
|
233
233
|
});
|
|
234
234
|
const details = result.details && typeof result.details === "object" && !Array.isArray(result.details) ? result.details : void 0;
|
|
235
235
|
if (details?.ok === true) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as readDiscordChannelMoveParams, n as isDiscordModerationAction, o as readDiscordChannelCreateParams, r as readDiscordModerationCommand, s as readDiscordChannelEditParams, t as handleDiscordAction } from "./runtime-
|
|
1
|
+
import { c as readDiscordChannelMoveParams, n as isDiscordModerationAction, o as readDiscordChannelCreateParams, r as readDiscordModerationCommand, s as readDiscordChannelEditParams, t as handleDiscordAction } from "./runtime-BJaCvlmq.mjs";
|
|
2
2
|
import "../action-runtime-api.js";
|
|
3
|
-
import {
|
|
3
|
+
import { x as isTrustedRequesterGuildAdminAction } from "./outbound-session-route-Cgx4i9cS.mjs";
|
|
4
4
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { readBooleanParam } from "openclaw/plugin-sdk/boolean-param";
|
|
6
6
|
import { readNonNegativeIntegerParam, readPositiveIntegerParam, readStringArrayParam, readStringParam } from "openclaw/plugin-sdk/param-readers";
|
|
@@ -63,7 +63,7 @@ async function tryHandleDiscordMessageActionGuildAdmin(params) {
|
|
|
63
63
|
const sender = senderUserId ? { senderUserId } : {};
|
|
64
64
|
const runAction = (runtimeAction, values, options) => handleDiscordAction({
|
|
65
65
|
action: runtimeAction,
|
|
66
|
-
accountId
|
|
66
|
+
accountId,
|
|
67
67
|
...values
|
|
68
68
|
}, cfg, options);
|
|
69
69
|
const metadataRead = guildMetadataReads[action];
|
|
@@ -169,8 +169,8 @@ async function tryHandleDiscordMessageActionGuildAdmin(params) {
|
|
|
169
169
|
return await runAction("threadReply", {
|
|
170
170
|
channelId: readStringParam(actionParams, "threadId") ?? resolveChannelId(),
|
|
171
171
|
content,
|
|
172
|
-
mediaUrl
|
|
173
|
-
replyTo
|
|
172
|
+
mediaUrl,
|
|
173
|
+
replyTo,
|
|
174
174
|
...readBooleanParam(actionParams, "silent") === true ? { silent: true } : {}
|
|
175
175
|
}, actionOptions);
|
|
176
176
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { t as discord_exports } from "./discord-DGVSguhx.mjs";
|
|
2
|
+
import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
|
|
3
|
+
import { formatErrorMessage } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
4
|
+
//#region extensions/discord/src/voice/listeners.ts
|
|
5
|
+
const logger = createSubsystemLogger("discord/voice");
|
|
6
|
+
function startAutoJoin(operation, context = "") {
|
|
7
|
+
operation().catch((err) => logger.warn(`discord voice: autoJoin${context} failed: ${formatErrorMessage(err)}`));
|
|
8
|
+
}
|
|
9
|
+
var DiscordVoiceReadyListener = class {
|
|
10
|
+
constructor(manager) {
|
|
11
|
+
this.manager = manager;
|
|
12
|
+
this.type = discord_exports.GatewayDispatchEvents.Ready;
|
|
13
|
+
}
|
|
14
|
+
async handle(_data, _client) {
|
|
15
|
+
startAutoJoin(() => this.manager.autoJoin());
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
var DiscordVoiceResumedListener = class extends DiscordVoiceReadyListener {
|
|
19
|
+
constructor(..._args) {
|
|
20
|
+
super(..._args);
|
|
21
|
+
this.type = discord_exports.GatewayDispatchEvents.Resumed;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
var DiscordVoiceGuildCreateListener = class {
|
|
25
|
+
constructor(manager) {
|
|
26
|
+
this.manager = manager;
|
|
27
|
+
this.type = discord_exports.GatewayDispatchEvents.GuildCreate;
|
|
28
|
+
}
|
|
29
|
+
async handle(data, _client) {
|
|
30
|
+
if (!data.unavailable) {
|
|
31
|
+
this.manager.refreshGuildRoster(data.id);
|
|
32
|
+
startAutoJoin(() => this.manager.reconcileAutoJoinGuild(data.id), ` occupancy reconciliation guild=${data.id}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var DiscordVoiceStateUpdateListener = class {
|
|
37
|
+
constructor(manager) {
|
|
38
|
+
this.manager = manager;
|
|
39
|
+
this.type = discord_exports.GatewayDispatchEvents.VoiceStateUpdate;
|
|
40
|
+
}
|
|
41
|
+
async handle(data, client) {
|
|
42
|
+
const transition = client.getPlugin("gateway")?.takeVoiceStateTransition(data);
|
|
43
|
+
await this.manager.handleVoiceStateUpdate(data, transition ? transition.previous ?? null : void 0);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { DiscordVoiceGuildCreateListener, DiscordVoiceReadyListener, DiscordVoiceResumedListener, DiscordVoiceStateUpdateListener };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as normalizeDiscordAllowList } from "./allow-list-
|
|
1
|
+
import { i as normalizeDiscordAllowList } from "./allow-list-BXrS8-R9.mjs";
|
|
2
2
|
import { defineStableChannelIngressIdentity } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
3
3
|
//#region extensions/discord/src/monitor/ingress-identity.ts
|
|
4
4
|
const DISCORD_ALLOW_LIST_PREFIXES = [
|
|
@@ -27,8 +27,7 @@ function normalizeDiscordTagEntry(entry) {
|
|
|
27
27
|
return /#\d{4}$/.test(text) ? normalizeDiscordNameSubject(text) : null;
|
|
28
28
|
}
|
|
29
29
|
function normalizeDiscordNameSubject(value) {
|
|
30
|
-
|
|
31
|
-
return typeof nameSlug === "string" && nameSlug ? nameSlug : null;
|
|
30
|
+
return normalizeDiscordAllowList([value], DISCORD_ALLOW_LIST_PREFIXES)?.names.values().next().value || null;
|
|
32
31
|
}
|
|
33
32
|
const discordIngressIdentity = defineStableChannelIngressIdentity({
|
|
34
33
|
resolveParticipant: (subject) => {
|