@openclaw/discord 2026.11.7 → 2026.11.9
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-DGkdWwix.mjs → account-inspect-CSz5Qodj.mjs} +2 -3
- package/dist/.setup/{accounts-C_25wyxC.mjs → accounts-DtjvhJUj.mjs} +4 -8
- package/dist/.setup/{active-turn-thread-route-KvRTAVE3.mjs → active-turn-thread-route-DkPnk2x8.mjs} +1 -2
- package/dist/.setup/{allow-list-C3j0qLDp.mjs → allow-list-CkqpzPvP.mjs} +4 -8
- package/dist/.setup/{api-DYRggUgK.mjs → api-C4j_kC-2.mjs} +4 -6
- package/dist/.setup/{approval-handler.runtime-BN4W1r0o.mjs → approval-handler.runtime-bB4eKcGl.mjs} +9 -10
- package/dist/.setup/{approval-message-updates-DKsCfxSW.mjs → approval-message-updates-DqOXxPss.mjs} +3 -4
- package/dist/.setup/{audit-BL6EoUun.mjs → audit-D1UISAXW.mjs} +6 -7
- package/dist/.setup/{channel-access-9cyzozUP.mjs → channel-access-DhJhVrdZ.mjs} +1 -2
- package/dist/.setup/{channel-DdI2l55_.mjs → channel-i4V5w1Nh.mjs} +35 -41
- package/dist/.setup/{channel.setup-kNWMxlgu.mjs → channel.setup-BrGEJ0Ia.mjs} +7 -10
- package/dist/.setup/{command-deploy-store-DFkBTViB.mjs → command-deploy-store-DPWiBMks.mjs} +1 -2
- package/dist/.setup/{command-owners-C7rUdqUX.mjs → command-owners-BzlhNBxA.mjs} +1 -2
- package/dist/.setup/{components-C1Phe3uw.mjs → components-DeCLO9w0.mjs} +10 -16
- package/dist/.setup/{components.base-CiS0h_XP.mjs → components.base-C5sAPHe4.mjs} +1 -2
- package/dist/.setup/{config-schema-BNKN1cu5.mjs → config-schema-GX2yDgIH.mjs} +3 -5
- package/dist/.setup/{conversation-binding-route-K_jFbvi5.mjs → conversation-binding-route-CHCfhsCl.mjs} +2 -3
- package/dist/.setup/{directory-config-Ble81PWH.mjs → directory-config-BXJuh9-J.mjs} +3 -4
- package/dist/.setup/{directory-live-CY2-qrHI.mjs → directory-live-dzJ14-DT.mjs} +9 -64
- package/dist/.setup/{discord-BRVFhk09.mjs → discord-BGkLzt2b.mjs} +93 -72
- package/dist/.setup/{doctor-RqH-6JB0.mjs → doctor-DBBXoP9w.mjs} +7 -8
- package/dist/.setup/{doctor-contract-Bwv8EuQ_.mjs → doctor-contract-Dstl3cMg.mjs} +2 -3
- package/dist/.setup/{endpoint-runtime-lf4DeLas.mjs → endpoint-runtime-BM3x-m6O.mjs} +1 -2
- package/dist/.setup/{guilds-BSnrns-F.mjs → guilds-DYBhgnfq.mjs} +3 -4
- package/dist/.setup/{handle-action-uD87h2FK.mjs → handle-action-Dx2N-4A6.mjs} +11 -11
- package/dist/.setup/{handle-action.guild-admin-CqBx_3mG.mjs → handle-action.guild-admin-CGzsE3bM.mjs} +7 -5
- package/dist/.setup/{listeners-DnHLrLIN.mjs → listeners-DHjDOlXW.mjs} +2 -3
- package/dist/.setup/{live-policy-config-y0Qy36X3.mjs → live-policy-config-DjIHWFla.mjs} +3 -5
- package/dist/.setup/{message-handler-CWL_u0X8.mjs → message-handler-OqhwO2Il.mjs} +11 -15
- package/dist/.setup/{message-handler.preflight-83tpEdBG.mjs → message-handler.preflight-DaqozzfW.mjs} +20 -43
- package/dist/.setup/{message-handler.preflight-pluralkit-Dhcx7Ifz.mjs → message-handler.preflight-pluralkit-CPWdqrEU.mjs} +10 -14
- package/dist/.setup/{message-handler.process-BC-wNZwK.mjs → message-handler.process-C6ETXKq2.mjs} +26 -34
- package/dist/.setup/{outbound-payload-CK3_bDvK.mjs → outbound-payload-DOFjmMNE.mjs} +9 -11
- package/dist/.setup/{outbound-session-route-Ay_DnOOl.mjs → outbound-session-route-CzL157kC.mjs} +22 -34
- package/dist/.setup/{output-activity-uBpMSX75.mjs → output-activity-CDgs2s3O.mjs} +1 -2
- package/dist/.setup/{pluralkit-B64dfq_j.mjs → pluralkit-DcXbHTpQ.mjs} +2 -3
- package/dist/.setup/{preflight-audio-C6QtD6HX.mjs → preflight-audio-r4BbaJxh.mjs} +1 -2
- package/dist/.setup/{presence-cache-Dq-3nH7R.mjs → presence-cache-B3xj3b0l.mjs} +1 -2
- package/dist/.setup/{probe-CbDJojNV.mjs → probe-CfGMZwFD.mjs} +5 -6
- package/dist/.setup/{provider-CRb3Myky.mjs → provider-BcSZ6vqo.mjs} +110 -186
- package/dist/.setup/{provider-session.runtime-3cZpps3H.mjs → provider-session.runtime-CxGNqH7Q.mjs} +3 -3
- package/dist/.setup/provider.runtime-DPhNybGw.mjs +1 -0
- package/dist/.setup/{proxy-fetch-BzXwBAXt.mjs → proxy-fetch-B8cK6FLQ.mjs} +1 -2
- package/dist/.setup/{realtime-session.runtime-BRYpjS9P.mjs → realtime-session.runtime-Carw2Z1J.mjs} +15 -25
- package/dist/.setup/{receive-recovery-C3Ks4wAQ.mjs → receive-recovery-DV_v5ROf.mjs} +3 -6
- package/dist/.setup/{resolve-allowlist-common-B-S0wRIw.mjs → resolve-allowlist-common-CYdqBUgV.mjs} +3 -4
- package/dist/.setup/{resolve-channels-g16NM6Ho.mjs → resolve-channels-BNnyfCR8.mjs} +6 -7
- package/dist/.setup/{resolve-users-DAfOOXdy.mjs → resolve-users-CDMAGrzv.mjs} +5 -6
- package/dist/.setup/{rolldown-runtime-B4FMCO8f.mjs → rolldown-runtime-nwUcYXjP.mjs} +1 -2
- package/dist/.setup/{runtime-BMgTyuwg.mjs → runtime-B-PgPsGR.mjs} +4 -6
- package/dist/.setup/{runtime--HZ9r3tF.mjs → runtime-BJxDx_zr.mjs} +49 -47
- package/dist/.setup/{runtime-DgnVQ7zW.mjs → runtime-DcBvHOm1.mjs} +1 -2
- package/dist/.setup/{runtime-doctor-migrations-BPV-R4G9.mjs → runtime-doctor-migrations-BpV1jKk0.mjs} +5 -9
- package/dist/.setup/{secret-config-contract-B1kE4sDv.mjs → secret-config-contract-CP6teHec.mjs} +1 -2
- package/dist/.setup/{security-audit-BFT84Uny.mjs → security-audit-CTwisG7c.mjs} +3 -4
- package/dist/.setup/{security-contract-DNyyjTZZ.mjs → security-contract-D-o0iWDk.mjs} +1 -2
- package/dist/.setup/{security-doctor-nGgPm65L.mjs → security-doctor-4s7omTZd.mjs} +1 -2
- package/dist/.setup/{send-CtvwfZQ2.mjs → send-BQtMCED2.mjs} +19 -28
- package/dist/.setup/{send.components-CtLtE0yD.mjs → send.components-BTjOU5BX.mjs} +11 -14
- package/dist/.setup/{send.outbound-D58xXPgs.mjs → send.outbound-izfb48w-.mjs} +10 -16
- package/dist/.setup/{send.receipt-DLOV4qx6.mjs → send.receipt-D0vpuJMr.mjs} +64 -17
- package/dist/.setup/{send.shared-B_KKRrD7.mjs → send.shared-BVJkIe93.mjs} +15 -20
- package/dist/.setup/{sender-identity-BbA7FNbr.mjs → sender-identity-Dt5ELjRN.mjs} +2 -3
- package/dist/.setup/{session-contract-BO5tlIdl.mjs → session-contract-Bq71MS78.mjs} +1 -2
- package/dist/.setup/{session-key-normalization-CCHGNSQw.mjs → session-key-normalization-Cfvze5hd.mjs} +1 -2
- package/dist/.setup/setup-plugin-api-DCiNtEra.mjs +2 -0
- package/dist/.setup/{shared-Dv2DamaK.mjs → shared-djlPz0hY.mjs} +14 -17
- package/dist/.setup/{shared-interactive-DmzaoKOM.mjs → shared-interactive-DKBw4SNV.mjs} +7 -12
- package/dist/.setup/{subagent-hooks-yT45eTyz.mjs → subagent-hooks-BTmMGFYh.mjs} +3 -4
- package/dist/.setup/{system-events-Dlzp9Jcj.mjs → system-events-LN3PXCia.mjs} +3 -4
- package/dist/.setup/{target-parsing-C-HyNxcE.mjs → target-parsing-BiuhcK9Q.mjs} +1 -2
- package/dist/.setup/{target-resolver-BzaZPBm9.mjs → target-resolver-C98DQ-sp.mjs} +6 -7
- package/dist/.setup/{thread-binding-api-BDZJD4na.mjs → thread-binding-api-Drd4Zu-5.mjs} +1 -2
- package/dist/.setup/{thread-bindings-DRWhgKCc.mjs → thread-bindings-ESkVljSW.mjs} +7 -10
- package/dist/.setup/{thread-bindings.manager-CWJKirn1.mjs → thread-bindings.manager-BG7MMT7H.mjs} +15 -20
- package/dist/.setup/{thread-bindings.session-updates-DzJrXc4w.mjs → thread-bindings.session-updates-Ddn14oJa.mjs} +6 -10
- package/dist/.setup/{threading-BbsPuT5G.mjs → threading-BzxVQcv8.mjs} +5 -7
- package/dist/.setup/{timeouts-cIxzatmv.mjs → timeouts-CT9hnmo4.mjs} +1 -2
- package/dist/.setup/{transcripts-source-DIW1fU_P.mjs → transcripts-source-a1btN-pC.mjs} +20 -33
- package/dist/.setup/{typing-CNlSKY5S.mjs → typing-DAv4S2fI.mjs} +2 -3
- package/dist/.setup/{voice-runtime-oJ6BZs5D.mjs → voice-runtime-BI76hQQH.mjs} +28 -46
- package/dist/.source-module-urls/d6c089460280c5a04184542d6712e04545caeb1ebb290d3504377b4cc5e22fea.json +1 -1
- package/dist/account-inspect-api.js +2 -3
- package/dist/action-runtime-api.js +1 -1
- package/dist/activities-api.js +9 -13
- package/dist/api.js +21 -22
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/contract-api.js +1 -1
- package/dist/directory-contract-api.js +2 -3
- package/dist/doctor-contract-api.js +5 -7
- package/dist/index.js +1 -2
- package/dist/runtime-api.js +22 -22
- package/dist/runtime-setter-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/session-key-api.js +1 -1
- package/dist/setup-entry.js +2 -3
- package/dist/setup-plugin-api.js +1 -1
- package/dist/src/voice/audio-worker.runtime.js +8 -14
- package/dist/subagent-hooks-api.js +2 -3
- package/dist/thread-binding-api.js +1 -1
- package/dist/transcripts-source-api.js +2 -3
- package/package.json +4 -4
- package/dist/.setup/provider.runtime-tmkt3QOg.mjs +0 -1
- package/dist/.setup/setup-plugin-api-ty5RJrMy.mjs +0 -2
|
@@ -1,65 +1,11 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { h as normalizeDiscordToken, l as resolveDiscordAccount } from "./accounts-
|
|
3
|
-
import { a as normalizeDiscordDisplaySlug } from "./allow-list-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { normalizeOptionalLowercaseString
|
|
8
|
-
|
|
9
|
-
//#region extensions/discord/src/directory-cache-state.ts
|
|
10
|
-
const discordDirectoryCacheState = { handlesByAccount: /* @__PURE__ */ new Map() };
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region extensions/discord/src/directory-cache.ts
|
|
13
|
-
const DISCORD_DIRECTORY_CACHE_MAX_ENTRIES = 4e3;
|
|
14
|
-
const DISCORD_DISCRIMINATOR_SUFFIX = /#\d{4}$/;
|
|
15
|
-
function normalizeDiscordSnowflake(value) {
|
|
16
|
-
const text = normalizeOptionalStringifiedId(value) ?? "";
|
|
17
|
-
if (!/^\d+$/.test(text)) return null;
|
|
18
|
-
return text;
|
|
19
|
-
}
|
|
20
|
-
function normalizeDiscordHandleKey(raw) {
|
|
21
|
-
let handle = normalizeOptionalString(raw) ?? "";
|
|
22
|
-
if (!handle) return null;
|
|
23
|
-
if (handle.startsWith("@")) handle = normalizeOptionalString(handle.slice(1)) ?? "";
|
|
24
|
-
if (!handle || /\s/.test(handle)) return null;
|
|
25
|
-
return handle.toLowerCase();
|
|
26
|
-
}
|
|
27
|
-
function ensureAccountCache(accountId) {
|
|
28
|
-
const cacheKey = normalizeAccountId(accountId);
|
|
29
|
-
const existing = discordDirectoryCacheState.handlesByAccount.get(cacheKey);
|
|
30
|
-
if (existing) return existing;
|
|
31
|
-
const created = /* @__PURE__ */ new Map();
|
|
32
|
-
discordDirectoryCacheState.handlesByAccount.set(cacheKey, created);
|
|
33
|
-
return created;
|
|
34
|
-
}
|
|
35
|
-
function setCacheEntry(cache, key, userId) {
|
|
36
|
-
const previous = cache.get(key);
|
|
37
|
-
cache.delete(key);
|
|
38
|
-
cache.set(key, previous === void 0 || previous === userId ? userId : null);
|
|
39
|
-
pruneMapToMaxSize(cache, DISCORD_DIRECTORY_CACHE_MAX_ENTRIES);
|
|
40
|
-
}
|
|
41
|
-
function rememberDiscordDirectoryUser(params) {
|
|
42
|
-
const userId = normalizeDiscordSnowflake(params.userId);
|
|
43
|
-
if (!userId) return;
|
|
44
|
-
const cache = ensureAccountCache(params.accountId);
|
|
45
|
-
for (const candidate of params.handles) {
|
|
46
|
-
if (typeof candidate !== "string") continue;
|
|
47
|
-
const handle = normalizeDiscordHandleKey(candidate);
|
|
48
|
-
if (!handle) continue;
|
|
49
|
-
setCacheEntry(cache, handle, userId);
|
|
50
|
-
const withoutDiscriminator = handle.replace(DISCORD_DISCRIMINATOR_SUFFIX, "");
|
|
51
|
-
if (withoutDiscriminator && withoutDiscriminator !== handle) setCacheEntry(cache, withoutDiscriminator, userId);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
function resolveDiscordDirectoryUserId(params) {
|
|
55
|
-
const cache = discordDirectoryCacheState.handlesByAccount.get(normalizeAccountId(params.accountId));
|
|
56
|
-
if (!cache) return;
|
|
57
|
-
const handle = normalizeDiscordHandleKey(params.handle);
|
|
58
|
-
if (!handle) return;
|
|
59
|
-
return cache.get(handle) ?? void 0;
|
|
60
|
-
}
|
|
61
|
-
//#endregion
|
|
62
|
-
//#region extensions/discord/src/directory-live.ts
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
|
|
2
|
+
import { h as normalizeDiscordToken, l as resolveDiscordAccount } from "./accounts-DtjvhJUj.mjs";
|
|
3
|
+
import { a as normalizeDiscordDisplaySlug } from "./allow-list-CkqpzPvP.mjs";
|
|
4
|
+
import { f as rememberDiscordDirectoryUser } from "./send.receipt-D0vpuJMr.mjs";
|
|
5
|
+
import { t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-C4j_kC-2.mjs";
|
|
6
|
+
import { n as listGuilds, r as searchDiscordGuildMembers, t as listDiscordGuildChannels } from "./guilds-DYBhgnfq.mjs";
|
|
7
|
+
import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
|
+
// extensions/discord/src/directory-live.ts
|
|
63
9
|
var directory_live_exports = /* @__PURE__ */ __exportAll({
|
|
64
10
|
listDiscordDirectoryGroupsLive: () => listDiscordDirectoryGroupsLive,
|
|
65
11
|
listDiscordDirectoryPeersLive: () => listDiscordDirectoryPeersLive
|
|
@@ -141,5 +87,4 @@ function listDiscordDirectoryGroupsLive(params) {
|
|
|
141
87
|
function listDiscordDirectoryPeersLive(params) {
|
|
142
88
|
return listDiscordDirectoryLive(params, "user");
|
|
143
89
|
}
|
|
144
|
-
|
|
145
|
-
export { normalizeDiscordSnowflake as a, normalizeDiscordHandleKey as i, listDiscordDirectoryGroupsLive as n, rememberDiscordDirectoryUser as o, listDiscordDirectoryPeersLive as r, resolveDiscordDirectoryUserId as s, directory_live_exports as t };
|
|
90
|
+
export { listDiscordDirectoryGroupsLive as n, listDiscordDirectoryPeersLive as r, directory_live_exports as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as __reExport, t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { C as parseDiscordRetryAfterBodySeconds } from "./allow-list-
|
|
3
|
-
import { n as getDiscordEndpointRuntime } from "./endpoint-runtime-
|
|
4
|
-
import { i as parseCustomId, n as BaseModalComponent, t as BaseMessageInteractiveComponent } from "./components.base-
|
|
1
|
+
import { n as __reExport, t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
|
|
2
|
+
import { C as parseDiscordRetryAfterBodySeconds } from "./allow-list-CkqpzPvP.mjs";
|
|
3
|
+
import { n as getDiscordEndpointRuntime } from "./endpoint-runtime-BM3x-m6O.mjs";
|
|
4
|
+
import { i as parseCustomId, n as BaseModalComponent, t as BaseMessageInteractiveComponent } from "./components.base-C5sAPHe4.mjs";
|
|
5
5
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
6
6
|
import { asOptionalObjectRecord, asRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { ApplicationCommandOptionType, ApplicationCommandType, ComponentType, GatewayDispatchEvents, InteractionContextType, InteractionResponseType, InteractionType, MessageFlags, Routes, TextInputStyle } from "discord-api-types/v10";
|
|
@@ -17,12 +17,11 @@ import { Type } from "typebox";
|
|
|
17
17
|
import { Check } from "typebox/value";
|
|
18
18
|
import { createHash } from "node:crypto";
|
|
19
19
|
import { createPermitPool } from "openclaw/plugin-sdk/concurrency-runtime";
|
|
20
|
-
|
|
20
|
+
// extensions/discord/src/internal/undefined-fields.ts
|
|
21
21
|
function stripUndefinedFields(value) {
|
|
22
22
|
return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== void 0));
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
//#region extensions/discord/src/internal/request-authority.ts
|
|
24
|
+
// extensions/discord/src/internal/request-authority.ts
|
|
26
25
|
const requestAuthority = resolveGlobalSingleton(Symbol.for("openclaw.discord.requestAuthority"), () => new AsyncLocalStorage());
|
|
27
26
|
/** Carry the host's existing assertion without changing its lifetime or ownership. */
|
|
28
27
|
function withDiscordRequestAuthority(assertCurrent, run) {
|
|
@@ -36,8 +35,7 @@ function withDiscordRequestAuthority(assertCurrent, run) {
|
|
|
36
35
|
function captureDiscordRequestAuthority() {
|
|
37
36
|
return requestAuthority.getStore();
|
|
38
37
|
}
|
|
39
|
-
|
|
40
|
-
//#region extensions/discord/src/internal/rest-body.ts
|
|
38
|
+
// extensions/discord/src/internal/rest-body.ts
|
|
41
39
|
function fileBlob(file) {
|
|
42
40
|
return file.data instanceof Blob ? file.data : new Blob([file.data], { type: typeof file.contentType === "string" ? file.contentType : void 0 });
|
|
43
41
|
}
|
|
@@ -95,8 +93,7 @@ function serializeRequestBody(data, headers) {
|
|
|
95
93
|
headers.set("Content-Type", "application/json");
|
|
96
94
|
return JSON.stringify(data.body);
|
|
97
95
|
}
|
|
98
|
-
|
|
99
|
-
//#region extensions/discord/src/internal/rest-errors.ts
|
|
96
|
+
// extensions/discord/src/internal/rest-errors.ts
|
|
100
97
|
const DISCORD_UNKNOWN_MESSAGE = 10008;
|
|
101
98
|
const DISCORD_UNKNOWN_VOICE_STATE = 10065;
|
|
102
99
|
const DISCORD_ERROR_BODY_MAX_DEPTH = 64;
|
|
@@ -228,8 +225,7 @@ var RateLimitError = class extends DiscordError {
|
|
|
228
225
|
this.scope = body.global ? "global" : readDiscordRateLimitScope(response);
|
|
229
226
|
}
|
|
230
227
|
};
|
|
231
|
-
|
|
232
|
-
//#region extensions/discord/src/internal/rest-routes.ts
|
|
228
|
+
// extensions/discord/src/internal/rest-routes.ts
|
|
233
229
|
const RATE_LIMIT_HEADER_NUMBER_RE = /^\d+(?:\.\d+)?$/;
|
|
234
230
|
const DISCORD_ROUTE_IDENTIFIER_HASH_LENGTH = 32;
|
|
235
231
|
function redactWebhookTokenInPath(path) {
|
|
@@ -279,8 +275,7 @@ function appendQuery(path, query) {
|
|
|
279
275
|
for (const [key, value] of Object.entries(query)) search.set(key, String(value));
|
|
280
276
|
return `${path}?${search.toString()}`;
|
|
281
277
|
}
|
|
282
|
-
|
|
283
|
-
//#region extensions/discord/src/internal/rest-scheduler.ts
|
|
278
|
+
// extensions/discord/src/internal/rest-scheduler.ts
|
|
284
279
|
const MAX_QUEUE_SIZE = 1e3;
|
|
285
280
|
const MAX_CONCURRENT_WORKERS = 4;
|
|
286
281
|
const MAX_RATE_LIMIT_RETRIES = 3;
|
|
@@ -321,21 +316,58 @@ var RestScheduler = class {
|
|
|
321
316
|
}
|
|
322
317
|
enqueue(params) {
|
|
323
318
|
if (this.queuedRequests >= MAX_QUEUE_SIZE) throw new Error("Discord request queue is full");
|
|
319
|
+
const signal = params.signal;
|
|
320
|
+
if (signal?.aborted) return Promise.reject(abortReason(signal));
|
|
324
321
|
const routeKey = createRouteKey(params.method, params.path);
|
|
325
322
|
const bucket = this.getBucket(this.routeBuckets.get(routeKey) ?? routeKey);
|
|
326
323
|
return new Promise((resolve, reject) => {
|
|
327
|
-
|
|
328
|
-
this.queuedByLane[params.priority] += 1;
|
|
329
|
-
bucket.pending[params.priority].push({
|
|
324
|
+
const request = {
|
|
330
325
|
...params,
|
|
331
326
|
routeKey,
|
|
332
327
|
retryCount: 0,
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
328
|
+
state: "queued",
|
|
329
|
+
resolve: (value) => {
|
|
330
|
+
this.settleRequest(request);
|
|
331
|
+
resolve(value);
|
|
332
|
+
},
|
|
333
|
+
reject: (reason) => {
|
|
334
|
+
this.settleRequest(request);
|
|
335
|
+
reject(reason);
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
if (signal) {
|
|
339
|
+
const onAbort = () => this.cancelQueuedRequest(request);
|
|
340
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
341
|
+
request.detachAbort = () => signal.removeEventListener("abort", onAbort);
|
|
342
|
+
}
|
|
343
|
+
this.queuedRequests += 1;
|
|
344
|
+
this.queuedByLane[params.priority] += 1;
|
|
345
|
+
bucket.pending[params.priority].push(request);
|
|
336
346
|
this.drainQueues();
|
|
337
347
|
});
|
|
338
348
|
}
|
|
349
|
+
/** Settles each request once, whether it completed, failed, or was cancelled. */
|
|
350
|
+
settleRequest(request) {
|
|
351
|
+
if (request.state === "settled") return;
|
|
352
|
+
request.state = "settled";
|
|
353
|
+
request.detachAbort?.();
|
|
354
|
+
request.detachAbort = void 0;
|
|
355
|
+
this.queuedRequests = Math.max(0, this.queuedRequests - 1);
|
|
356
|
+
}
|
|
357
|
+
/** Drops a queued attempt; dispatched work settles normally. */
|
|
358
|
+
cancelQueuedRequest(request) {
|
|
359
|
+
if (request.state !== "queued") return;
|
|
360
|
+
for (const bucket of this.buckets.values()) for (const lane of requestPriorities) {
|
|
361
|
+
const queue = bucket.pending[lane];
|
|
362
|
+
const index = queue.indexOf(request);
|
|
363
|
+
if (index < 0) continue;
|
|
364
|
+
queue.splice(index, 1);
|
|
365
|
+
this.queuedByLane[lane] = Math.max(0, this.queuedByLane[lane] - 1);
|
|
366
|
+
request.reject(abortReason(request.signal));
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
request.reject(abortReason(request.signal));
|
|
370
|
+
}
|
|
339
371
|
getBucket(key) {
|
|
340
372
|
const existing = this.buckets.get(key);
|
|
341
373
|
if (existing) return existing;
|
|
@@ -437,6 +469,7 @@ var RestScheduler = class {
|
|
|
437
469
|
}
|
|
438
470
|
const queued = queue.shift();
|
|
439
471
|
if (!queued) continue;
|
|
472
|
+
queued.state = "dispatched";
|
|
440
473
|
this.queuedByLane[lane] = Math.max(0, this.queuedByLane[lane] - 1);
|
|
441
474
|
this.laneCursor = (this.laneCursor + laneOffset + 1) % laneSchedule.length;
|
|
442
475
|
return {
|
|
@@ -448,38 +481,36 @@ var RestScheduler = class {
|
|
|
448
481
|
return { waitMs: nextDelayMs };
|
|
449
482
|
}
|
|
450
483
|
async runQueuedRequest(queued, bucket) {
|
|
451
|
-
let requeued = false;
|
|
452
484
|
try {
|
|
453
485
|
queued.resolve(await this.executor(queued));
|
|
454
486
|
} catch (error) {
|
|
455
|
-
if (error instanceof RateLimitError && this.requeueRateLimitedRequest(queued))
|
|
456
|
-
|
|
457
|
-
return;
|
|
458
|
-
}
|
|
459
|
-
queued.reject(error);
|
|
487
|
+
if (error instanceof RateLimitError && this.requeueRateLimitedRequest(queued)) return;
|
|
488
|
+
queued.reject(error instanceof Error ? error : new Error(String(error)));
|
|
460
489
|
} finally {
|
|
461
490
|
bucket.active = Math.max(0, bucket.active - 1);
|
|
462
491
|
this.activeWorkers = Math.max(0, this.activeWorkers - 1);
|
|
463
|
-
if (!requeued) this.queuedRequests = Math.max(0, this.queuedRequests - 1);
|
|
464
492
|
this.drainQueues();
|
|
465
493
|
}
|
|
466
494
|
}
|
|
467
495
|
requeueRateLimitedRequest(queued) {
|
|
468
|
-
if (queued.retryCount >= MAX_RATE_LIMIT_RETRIES) return false;
|
|
496
|
+
if (queued.signal?.aborted || queued.retryCount >= MAX_RATE_LIMIT_RETRIES) return false;
|
|
469
497
|
const bucketKey = this.routeBuckets.get(queued.routeKey) ?? queued.routeKey;
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
});
|
|
498
|
+
queued.retryCount += 1;
|
|
499
|
+
queued.state = "queued";
|
|
500
|
+
this.getBucket(bucketKey).pending[queued.priority].push(queued);
|
|
474
501
|
this.queuedByLane[queued.priority] += 1;
|
|
475
502
|
return true;
|
|
476
503
|
}
|
|
477
504
|
};
|
|
505
|
+
/** Promise rejections always carry an Error; a non-Error abort reason uses the standard shape. */
|
|
506
|
+
function abortReason(signal) {
|
|
507
|
+
const reason = signal?.reason;
|
|
508
|
+
return reason instanceof Error ? reason : new DOMException("The operation was aborted.", "AbortError");
|
|
509
|
+
}
|
|
478
510
|
function isGlobalRateLimit(parsed) {
|
|
479
511
|
return parsed && typeof parsed === "object" && "global" in parsed ? Boolean(parsed.global) : false;
|
|
480
512
|
}
|
|
481
|
-
|
|
482
|
-
//#region extensions/discord/src/internal/schemas.ts
|
|
513
|
+
// extensions/discord/src/internal/schemas.ts
|
|
483
514
|
const discordInteractionPayloadSchema = Type.Object({
|
|
484
515
|
id: Type.String({ minLength: 1 }),
|
|
485
516
|
token: Type.String({ minLength: 1 }),
|
|
@@ -497,8 +528,7 @@ function assertDiscordInteractionPayload(value) {
|
|
|
497
528
|
function isDiscordRateLimitBody(value) {
|
|
498
529
|
return Check(discordRateLimitBodySchema, value);
|
|
499
530
|
}
|
|
500
|
-
|
|
501
|
-
//#region extensions/discord/src/internal/rest.ts
|
|
531
|
+
// extensions/discord/src/internal/rest.ts
|
|
502
532
|
const DISCORD_REST_TIMEOUT_MS = 15e3;
|
|
503
533
|
const defaultOptions = {
|
|
504
534
|
baseUrl: "https://discord.com/api",
|
|
@@ -586,6 +616,8 @@ var RequestClient = class {
|
|
|
586
616
|
assertActionAuthority();
|
|
587
617
|
assertReadAuthority?.();
|
|
588
618
|
} : assertReadAuthority;
|
|
619
|
+
const callerSignal = this.options.callerSignal;
|
|
620
|
+
callerSignal?.throwIfAborted();
|
|
589
621
|
assertCurrent?.();
|
|
590
622
|
if (!this.options.queueRequests) return await this.executeRequest(method, path, params, routeKey, assertCurrent, effect);
|
|
591
623
|
return await this.scheduler.enqueue({
|
|
@@ -597,7 +629,8 @@ var RequestClient = class {
|
|
|
597
629
|
data: params.data,
|
|
598
630
|
assertCurrent,
|
|
599
631
|
effect
|
|
600
|
-
}
|
|
632
|
+
},
|
|
633
|
+
...callerSignal ? { signal: callerSignal } : {}
|
|
601
634
|
});
|
|
602
635
|
}
|
|
603
636
|
async executeRequest(method, path, params, routeKey = createRouteKey(method, path), assertCurrent, effect = captureEffectAuthority()) {
|
|
@@ -660,8 +693,7 @@ function getRequestPriority(method, path) {
|
|
|
660
693
|
if (/^\/interactions\/\d+\/[^/]+\/callback$/.test(normalizedPath)) return "critical";
|
|
661
694
|
return normalizedMethod === "GET" ? "background" : "standard";
|
|
662
695
|
}
|
|
663
|
-
|
|
664
|
-
//#region extensions/discord/src/internal/api.guild.ts
|
|
696
|
+
// extensions/discord/src/internal/api.guild.ts
|
|
665
697
|
const discordGuildEmojiListSchema = Type.Array(Type.Object({
|
|
666
698
|
id: Type.Union([Type.String(), Type.Null()]),
|
|
667
699
|
name: Type.Union([Type.String(), Type.Null()]),
|
|
@@ -680,8 +712,7 @@ async function listGuildEmojis(rest, guildId) {
|
|
|
680
712
|
if (!Check(discordGuildEmojiListSchema, emojis)) throw new Error("Invalid Discord guild emoji response.");
|
|
681
713
|
return emojis;
|
|
682
714
|
}
|
|
683
|
-
|
|
684
|
-
//#region extensions/discord/src/internal/api.messages.ts
|
|
715
|
+
// extensions/discord/src/internal/api.messages.ts
|
|
685
716
|
function normalizeDiscordMessageId(messageId) {
|
|
686
717
|
const normalized = messageId.trim();
|
|
687
718
|
if (!/^[0-9]+$/u.test(normalized)) throw new Error("Invalid Discord message ID. Expected decimal digits.");
|
|
@@ -714,8 +745,7 @@ async function createThread(rest, channelId, data, messageId) {
|
|
|
714
745
|
const route = messageId === void 0 ? Routes.threads(channelId) : Routes.threads(channelId, normalizeDiscordMessageId(messageId));
|
|
715
746
|
return await rest.post(route, data);
|
|
716
747
|
}
|
|
717
|
-
|
|
718
|
-
//#region extensions/discord/src/internal/api.reactions.ts
|
|
748
|
+
// extensions/discord/src/internal/api.reactions.ts
|
|
719
749
|
function ownReactionMutation(method) {
|
|
720
750
|
return async (rest, channelId, messageId, encodedEmoji) => {
|
|
721
751
|
await rest[method](Routes.channelMessageOwnReaction(channelId, normalizeDiscordMessageId(messageId), encodedEmoji));
|
|
@@ -726,8 +756,7 @@ const deleteOwnMessageReaction = ownReactionMutation("delete");
|
|
|
726
756
|
async function listMessageReactionUsers(rest, channelId, messageId, encodedEmoji, query) {
|
|
727
757
|
return await rest.get(Routes.channelMessageReaction(channelId, normalizeDiscordMessageId(messageId), encodedEmoji), query);
|
|
728
758
|
}
|
|
729
|
-
|
|
730
|
-
//#region extensions/discord/src/internal/api.users.ts
|
|
759
|
+
// extensions/discord/src/internal/api.users.ts
|
|
731
760
|
async function getCurrentUser(rest) {
|
|
732
761
|
return await rest.get(Routes.user("@me"));
|
|
733
762
|
}
|
|
@@ -737,8 +766,7 @@ async function getUser(rest, userId) {
|
|
|
737
766
|
async function createUserDmChannel(rest, recipientId) {
|
|
738
767
|
return await rest.post(Routes.userChannels(), { body: { recipient_id: recipientId } });
|
|
739
768
|
}
|
|
740
|
-
|
|
741
|
-
//#region extensions/discord/src/internal/commands.ts
|
|
769
|
+
// extensions/discord/src/internal/commands.ts
|
|
742
770
|
async function deferCommandInteractionIfNeeded(command, interaction) {
|
|
743
771
|
if (!command.defer) return;
|
|
744
772
|
await interaction.defer({ ephemeral: command.ephemeral });
|
|
@@ -826,8 +854,7 @@ var CommandWithSubcommands = class extends BaseCommand {
|
|
|
826
854
|
}));
|
|
827
855
|
}
|
|
828
856
|
};
|
|
829
|
-
|
|
830
|
-
//#region extensions/discord/src/internal/structures.ts
|
|
857
|
+
// extensions/discord/src/internal/structures.ts
|
|
831
858
|
var Base = class {
|
|
832
859
|
constructor(client) {
|
|
833
860
|
this.client = client;
|
|
@@ -981,8 +1008,7 @@ function channelFactory(clientForTest, channelData) {
|
|
|
981
1008
|
ownerId: "owner_id" in channelData ? channelData.owner_id : void 0
|
|
982
1009
|
};
|
|
983
1010
|
}
|
|
984
|
-
|
|
985
|
-
//#region extensions/discord/src/internal/interaction-options.ts
|
|
1011
|
+
// extensions/discord/src/internal/interaction-options.ts
|
|
986
1012
|
function findOption(options, matches) {
|
|
987
1013
|
for (const option of options ?? []) {
|
|
988
1014
|
if (matches(option)) return option;
|
|
@@ -1025,8 +1051,7 @@ var OptionsHandler = class {
|
|
|
1025
1051
|
return findOption(this.rawOptions, (option) => "focused" in option && Boolean(option.focused));
|
|
1026
1052
|
}
|
|
1027
1053
|
};
|
|
1028
|
-
|
|
1029
|
-
//#region extensions/discord/src/internal/modal-fields.ts
|
|
1054
|
+
// extensions/discord/src/internal/modal-fields.ts
|
|
1030
1055
|
function extractModalFields(components) {
|
|
1031
1056
|
const out = {};
|
|
1032
1057
|
for (const component of flattenModalComponents(components)) {
|
|
@@ -1085,8 +1110,7 @@ var ModalFields = class {
|
|
|
1085
1110
|
});
|
|
1086
1111
|
}
|
|
1087
1112
|
};
|
|
1088
|
-
|
|
1089
|
-
//#region extensions/discord/src/internal/embeds.ts
|
|
1113
|
+
// extensions/discord/src/internal/embeds.ts
|
|
1090
1114
|
var Embed = class {
|
|
1091
1115
|
constructor(embed) {
|
|
1092
1116
|
Object.assign(this, embed);
|
|
@@ -1106,8 +1130,7 @@ var Embed = class {
|
|
|
1106
1130
|
});
|
|
1107
1131
|
}
|
|
1108
1132
|
};
|
|
1109
|
-
|
|
1110
|
-
//#region extensions/discord/src/internal/payload.ts
|
|
1133
|
+
// extensions/discord/src/internal/payload.ts
|
|
1111
1134
|
function asSerializableComponent(component) {
|
|
1112
1135
|
return {
|
|
1113
1136
|
isV2: component.type !== ComponentType.ActionRow,
|
|
@@ -1138,8 +1161,7 @@ function serializePayload(payload) {
|
|
|
1138
1161
|
sticker_ids: payload.stickers
|
|
1139
1162
|
});
|
|
1140
1163
|
}
|
|
1141
|
-
|
|
1142
|
-
//#region extensions/discord/src/internal/interactions.ts
|
|
1164
|
+
// extensions/discord/src/internal/interactions.ts
|
|
1143
1165
|
function needsComponentsV2Query(body) {
|
|
1144
1166
|
return "flags" in body && ((body.flags ?? 0) & MessageFlags.IsComponentsV2) !== 0;
|
|
1145
1167
|
}
|
|
@@ -1292,8 +1314,7 @@ function createInteraction(client, rawData) {
|
|
|
1292
1314
|
if (rawData.type === InteractionType.MessageComponent) return new BaseComponentInteraction(client, rawData);
|
|
1293
1315
|
return new BaseInteraction(client, rawData);
|
|
1294
1316
|
}
|
|
1295
|
-
|
|
1296
|
-
//#region extensions/discord/src/internal/interaction-dispatch.ts
|
|
1317
|
+
// extensions/discord/src/internal/interaction-dispatch.ts
|
|
1297
1318
|
async function dispatchInteraction(client, rawData) {
|
|
1298
1319
|
const interaction = createInteraction(client, rawData);
|
|
1299
1320
|
if (rawData.type === InteractionType.ApplicationCommandAutocomplete) {
|
|
@@ -1360,8 +1381,7 @@ async function deferComponentInteractionIfNeeded(component, interaction) {
|
|
|
1360
1381
|
}
|
|
1361
1382
|
await interaction.acknowledge();
|
|
1362
1383
|
}
|
|
1363
|
-
|
|
1364
|
-
//#region extensions/discord/src/internal/client.ts
|
|
1384
|
+
// extensions/discord/src/internal/client.ts
|
|
1365
1385
|
const DEFAULT_REST_CACHE_TTL_MS = 3e4;
|
|
1366
1386
|
const DEFAULT_MAX_ENTRIES = 5e3;
|
|
1367
1387
|
const DEFAULT_SWEEP_INTERVAL_MS = 3e4;
|
|
@@ -1377,6 +1397,7 @@ const CACHE_KIND_BY_EVENT = /* @__PURE__ */ new Map([
|
|
|
1377
1397
|
[GatewayDispatchEvents.GuildMemberUpdate, "member"]
|
|
1378
1398
|
]);
|
|
1379
1399
|
const DISCORD_APPLICATION_COMMAND_LIMIT_REACHED = 30032;
|
|
1400
|
+
const DISCORD_UNKNOWN_APPLICATION_COMMAND = 10063;
|
|
1380
1401
|
function stableCommandKey(command) {
|
|
1381
1402
|
return `${command.type ?? ApplicationCommandType.ChatInput}:${command.name}`;
|
|
1382
1403
|
}
|
|
@@ -1593,7 +1614,11 @@ var Client = class {
|
|
|
1593
1614
|
return;
|
|
1594
1615
|
}
|
|
1595
1616
|
}
|
|
1596
|
-
for (const command of existing) if (!desiredKeys.has(stableCommandKey(command)))
|
|
1617
|
+
for (const command of existing) if (!desiredKeys.has(stableCommandKey(command))) try {
|
|
1618
|
+
await this.requestCommandDeploy("delete", Routes.applicationCommand(this.options.clientId, command.id));
|
|
1619
|
+
} catch (error) {
|
|
1620
|
+
if (!(error instanceof DiscordError && error.status === 404 && error.discordCode === DISCORD_UNKNOWN_APPLICATION_COMMAND)) throw error;
|
|
1621
|
+
}
|
|
1597
1622
|
}
|
|
1598
1623
|
async loadPersistedHash() {
|
|
1599
1624
|
if (this.commandDeployHashLoaded) return;
|
|
@@ -1650,8 +1675,7 @@ var Client = class {
|
|
|
1650
1675
|
}));
|
|
1651
1676
|
}
|
|
1652
1677
|
};
|
|
1653
|
-
|
|
1654
|
-
//#region extensions/discord/src/internal/components.modal.ts
|
|
1678
|
+
// extensions/discord/src/internal/components.modal.ts
|
|
1655
1679
|
var TextInput = class extends BaseModalComponent {
|
|
1656
1680
|
constructor(..._args) {
|
|
1657
1681
|
super(..._args);
|
|
@@ -1729,8 +1753,7 @@ var Modal = class {
|
|
|
1729
1753
|
};
|
|
1730
1754
|
}
|
|
1731
1755
|
};
|
|
1732
|
-
|
|
1733
|
-
//#region extensions/discord/src/internal/listeners.ts
|
|
1756
|
+
// extensions/discord/src/internal/listeners.ts
|
|
1734
1757
|
var BaseListener = class {};
|
|
1735
1758
|
var ReadyListener = class extends BaseListener {
|
|
1736
1759
|
constructor(..._args) {
|
|
@@ -1744,8 +1767,7 @@ var GuildCreateListener = class extends BaseListener {
|
|
|
1744
1767
|
this.type = GatewayDispatchEvents.GuildCreate;
|
|
1745
1768
|
}
|
|
1746
1769
|
};
|
|
1747
|
-
|
|
1748
|
-
//#region extensions/discord/src/internal/discord.ts
|
|
1770
|
+
// extensions/discord/src/internal/discord.ts
|
|
1749
1771
|
var discord_exports = /* @__PURE__ */ __exportAll({
|
|
1750
1772
|
AutocompleteInteraction: () => AutocompleteInteraction,
|
|
1751
1773
|
BaseCommand: () => BaseCommand,
|
|
@@ -1800,5 +1822,4 @@ var discord_exports = /* @__PURE__ */ __exportAll({
|
|
|
1800
1822
|
});
|
|
1801
1823
|
import * as import_discord_api_types_v10 from "discord-api-types/v10";
|
|
1802
1824
|
__reExport(discord_exports, import_discord_api_types_v10);
|
|
1803
|
-
//#endregion
|
|
1804
1825
|
export { getThreadMember as A, RateLimitError as B, listMessageReactionUsers as C, editChannelMessage as D, deleteChannelMessage as E, getGuildVoiceState as F, readRetryAfter as G, isUnknownDiscordVoiceStateError as H, listGuildEmojis as I, stripUndefinedFields as J, captureDiscordRequestAuthority as K, DISCORD_REST_TIMEOUT_MS as L, unpinChannelMessage as M, getGuild as N, getChannel as O, getGuildMember as P, RequestClient as R, deleteOwnMessageReaction as S, createThread as T, readDiscordCode as U, isUnknownDiscordMessageError as V, readDiscordMessage as W, Command as _, Label as a, getCurrentUser as b, TextInput as c, hasDiscordV2Components as d, serializePayload as f, User as g, Message as h, CheckboxGroup as i, pinChannelMessage as j, getChannelMessage as k, Client as l, Guild as m, GuildCreateListener as n, Modal as o, Embed as p, withDiscordRequestAuthority as q, ReadyListener as r, RadioGroup as s, discord_exports as t, asSerializableComponent as u, CommandWithSubcommands as v, createChannelMessage as w, createOwnMessageReaction as x, createUserDmChannel as y, DiscordError as z };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { c as resolveDefaultDiscordAccountId } from "./accounts-
|
|
2
|
-
import { t as inspectDiscordAccount } from "./account-inspect-
|
|
3
|
-
import { t as runtime_doctor_migrations_exports } from "./runtime-doctor-migrations-
|
|
4
|
-
import { n as normalizeCompatibilityConfig } from "./doctor-contract-
|
|
5
|
-
import { t as isDiscordMutableAllowEntry } from "./security-doctor-
|
|
6
|
-
import { n as discordVoiceTranscriptsSourceProvider } from "./transcripts-source-
|
|
1
|
+
import { c as resolveDefaultDiscordAccountId } from "./accounts-DtjvhJUj.mjs";
|
|
2
|
+
import { t as inspectDiscordAccount } from "./account-inspect-CSz5Qodj.mjs";
|
|
3
|
+
import { t as runtime_doctor_migrations_exports } from "./runtime-doctor-migrations-BpV1jKk0.mjs";
|
|
4
|
+
import { n as normalizeCompatibilityConfig } from "./doctor-contract-Dstl3cMg.mjs";
|
|
5
|
+
import { t as isDiscordMutableAllowEntry } from "./security-doctor-4s7omTZd.mjs";
|
|
6
|
+
import { n as discordVoiceTranscriptsSourceProvider } from "./transcripts-source-a1btN-pC.mjs";
|
|
7
7
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
8
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
9
|
-
|
|
9
|
+
// extensions/discord/src/doctor.ts
|
|
10
10
|
function sanitizeForLog(value) {
|
|
11
11
|
return value.replace(/\p{Cc}+/gu, " ").trim();
|
|
12
12
|
}
|
|
@@ -182,5 +182,4 @@ const discordDoctor = {
|
|
|
182
182
|
collectMutableAllowlistWarnings: ({ cfg }) => collectDiscordMutableAllowlistWarnings(cfg),
|
|
183
183
|
repairConfig: ({ cfg, doctorFixCommand }) => maybeRepairDiscordNumericIds(cfg, doctorFixCommand)
|
|
184
184
|
};
|
|
185
|
-
//#endregion
|
|
186
185
|
export { collectDiscordMissingEnvTokenWarnings, collectDiscordNumericIdWarnings, discordDoctor, maybeRepairDiscordNumericIds, scanDiscordNumericIdEntries };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as runtime_doctor_migrations_exports } from "./runtime-doctor-migrations-
|
|
1
|
+
import { t as runtime_doctor_migrations_exports } from "./runtime-doctor-migrations-BpV1jKk0.mjs";
|
|
2
2
|
import { isSupportedRealtimeVoiceActivationName, normalizeRealtimeVoiceActivationNamePrefix } from "openclaw/plugin-sdk/realtime-voice-activation";
|
|
3
|
-
|
|
3
|
+
// extensions/discord/src/doctor-contract.ts
|
|
4
4
|
const RETIRED_TUNING_KEYS = /* @__PURE__ */ new Set([
|
|
5
5
|
"gatewayInfoTimeoutMs",
|
|
6
6
|
"gatewayReadyTimeoutMs",
|
|
@@ -124,5 +124,4 @@ function normalizeCompatibilityConfig({ cfg }) {
|
|
|
124
124
|
changes
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
|
-
//#endregion
|
|
128
127
|
export { normalizeCompatibilityConfig as n, legacyConfigRules as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
|
|
2
2
|
import { fetchWithSsrFGuard, isBlockedHostnameOrIp, isLoopbackHost } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
3
|
-
|
|
3
|
+
// extensions/discord/src/endpoint-runtime.ts
|
|
4
4
|
const DISCORD_ENDPOINT_RESPONSE_MAX_BYTES = 8388608;
|
|
5
5
|
const DISCORD_API_URL_ENV = "DISCORD_API_URL";
|
|
6
6
|
function parseHttpAnchor(value, label) {
|
|
@@ -135,5 +135,4 @@ function assertDiscordEndpointGatewayUrl(url, gatewayOrigin) {
|
|
|
135
135
|
}
|
|
136
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
137
|
}
|
|
138
|
-
//#endregion
|
|
139
138
|
export { resolveDiscordEndpointMediaGuard as i, getDiscordEndpointRuntime as n, resolveDiscordEndpointAttachmentGuard as r, assertDiscordEndpointGatewayUrl as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as normalizeDiscordSlug } from "./allow-list-
|
|
2
|
-
import { r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-
|
|
3
|
-
|
|
1
|
+
import { o as normalizeDiscordSlug } from "./allow-list-CkqpzPvP.mjs";
|
|
2
|
+
import { r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-C4j_kC-2.mjs";
|
|
3
|
+
// extensions/discord/src/guilds.ts
|
|
4
4
|
function listDiscordGuildChannels(token, fetcher, guildId) {
|
|
5
5
|
return fetchDiscord(`/guilds/${guildId}/channels`, token, fetcher, { timeoutMs: DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS });
|
|
6
6
|
}
|
|
@@ -18,5 +18,4 @@ async function listGuilds(token, fetcher, options) {
|
|
|
18
18
|
slug: normalizeDiscordSlug(guild.name)
|
|
19
19
|
}] : []);
|
|
20
20
|
}
|
|
21
|
-
//#endregion
|
|
22
21
|
export { listGuilds as n, searchDiscordGuildMembers as r, listDiscordGuildChannels as t };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { q as withDiscordRequestAuthority } from "./discord-
|
|
2
|
-
import { s as matchesDiscordToolContextTarget } from "./send.receipt-
|
|
3
|
-
import { n as resolveDiscordChannelId, t as parseDiscordTarget } from "./target-parsing-
|
|
4
|
-
import { a as readDiscordAutoArchiveDurationParam, t as handleDiscordAction } from "./runtime
|
|
5
|
-
import { n as buildDiscordPresentationComponents, t as buildDiscordInteractiveComponents } from "./shared-interactive-
|
|
6
|
-
import { c as coerceDiscordComponentParam } from "./components-
|
|
1
|
+
import { q as withDiscordRequestAuthority } from "./discord-BGkLzt2b.mjs";
|
|
2
|
+
import { s as matchesDiscordToolContextTarget } from "./send.receipt-D0vpuJMr.mjs";
|
|
3
|
+
import { n as resolveDiscordChannelId, t as parseDiscordTarget } from "./target-parsing-BiuhcK9Q.mjs";
|
|
4
|
+
import { a as readDiscordAutoArchiveDurationParam, t as handleDiscordAction } from "./runtime-BJxDx_zr.mjs";
|
|
5
|
+
import { n as buildDiscordPresentationComponents, t as buildDiscordInteractiveComponents } from "./shared-interactive-DKBw4SNV.mjs";
|
|
6
|
+
import { c as coerceDiscordComponentParam } from "./components-DeCLO9w0.mjs";
|
|
7
7
|
import "../action-runtime-api.js";
|
|
8
|
-
import { S as discordInboundEventDelivery, i as isDiscordComponentSpecWithinMessageLimit, n as DISCORD_PRESENTATION_CAPABILITIES } from "./outbound-session-route-
|
|
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-CzL157kC.mjs";
|
|
9
|
+
import { t as tryHandleDiscordMessageActionGuildAdmin } from "./handle-action.guild-admin-CGzsE3bM.mjs";
|
|
10
|
+
import { n as notifyDiscordActiveTurnThreadCreated, r as notifyDiscordActiveTurnThreadReplyDelivered } from "./active-turn-thread-route-DkPnk2x8.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";
|
|
14
14
|
import { adaptMessagePresentationForChannel, normalizeLegacyInteractiveReply, normalizeMessagePresentation, renderMessagePresentationFallbackText } from "openclaw/plugin-sdk/interactive-runtime";
|
|
15
15
|
import { readPositiveIntegerParam as readPositiveIntegerParam$1, readStringArrayParam as readStringArrayParam$1, readStringParam as readStringParam$1 } from "openclaw/plugin-sdk/agent-runtime";
|
|
16
|
-
|
|
16
|
+
// extensions/discord/src/actions/handle-action.ts
|
|
17
17
|
const providerId = "discord";
|
|
18
18
|
function readCurrentDiscordTarget(toolContext) {
|
|
19
19
|
const provider = toolContext?.currentChannelProvider?.trim().toLowerCase();
|
|
@@ -44,6 +44,7 @@ async function dispatchDiscordMessageAction(ctx) {
|
|
|
44
44
|
mediaReadFile: ctx.mediaReadFile,
|
|
45
45
|
...ctx.reply ? { reply: ctx.reply } : {},
|
|
46
46
|
...ctx.progressSnapshot ? { progressSnapshot: ctx.progressSnapshot } : {},
|
|
47
|
+
...ctx.abortSignal ? { callerSignal: ctx.abortSignal } : {},
|
|
47
48
|
...readPolicyOptions
|
|
48
49
|
};
|
|
49
50
|
const runAction = (payload) => handleDiscordAction({
|
|
@@ -277,5 +278,4 @@ async function dispatchDiscordMessageAction(ctx) {
|
|
|
277
278
|
}
|
|
278
279
|
throw new Error(`Action ${action} is not supported for provider ${providerId}.`);
|
|
279
280
|
}
|
|
280
|
-
//#endregion
|
|
281
281
|
export { handleDiscordMessageAction };
|
|
@@ -1,10 +1,10 @@
|
|
|
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-BJxDx_zr.mjs";
|
|
2
2
|
import "../action-runtime-api.js";
|
|
3
|
-
import { x as isTrustedRequesterGuildAdminAction } from "./outbound-session-route-
|
|
3
|
+
import { x as isTrustedRequesterGuildAdminAction } from "./outbound-session-route-CzL157kC.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";
|
|
7
|
-
|
|
7
|
+
// extensions/discord/src/actions/handle-action.guild-admin.ts
|
|
8
8
|
const guildMetadataReads = {
|
|
9
9
|
"member-info": {
|
|
10
10
|
action: "memberInfo",
|
|
@@ -65,7 +65,10 @@ async function tryHandleDiscordMessageActionGuildAdmin(params) {
|
|
|
65
65
|
action: runtimeAction,
|
|
66
66
|
accountId,
|
|
67
67
|
...values
|
|
68
|
-
}, cfg,
|
|
68
|
+
}, cfg, actionOptions.callerSignal ? {
|
|
69
|
+
...options,
|
|
70
|
+
callerSignal: actionOptions.callerSignal
|
|
71
|
+
} : options);
|
|
69
72
|
const metadataRead = guildMetadataReads[action];
|
|
70
73
|
if (metadataRead) {
|
|
71
74
|
const values = Object.fromEntries(metadataRead.requiredParams.map((key) => [key, readStringParam(actionParams, key, { required: true })]));
|
|
@@ -191,5 +194,4 @@ async function tryHandleDiscordMessageActionGuildAdmin(params) {
|
|
|
191
194
|
}, readPolicyOptions);
|
|
192
195
|
}
|
|
193
196
|
}
|
|
194
|
-
//#endregion
|
|
195
197
|
export { tryHandleDiscordMessageActionGuildAdmin as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as discord_exports } from "./discord-
|
|
1
|
+
import { t as discord_exports } from "./discord-BGkLzt2b.mjs";
|
|
2
2
|
import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
|
|
3
3
|
import { formatErrorMessage } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
4
|
-
|
|
4
|
+
// extensions/discord/src/voice/listeners.ts
|
|
5
5
|
const logger = createSubsystemLogger("discord/voice");
|
|
6
6
|
function startAutoJoin(operation, context = "") {
|
|
7
7
|
operation().catch((err) => logger.warn(`discord voice: autoJoin${context} failed: ${formatErrorMessage(err)}`));
|
|
@@ -43,5 +43,4 @@ var DiscordVoiceStateUpdateListener = class {
|
|
|
43
43
|
await this.manager.handleVoiceStateUpdate(data, transition ? transition.previous ?? null : void 0);
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
-
//#endregion
|
|
47
46
|
export { DiscordVoiceGuildCreateListener, DiscordVoiceReadyListener, DiscordVoiceResumedListener, DiscordVoiceStateUpdateListener };
|