@openclaw/discord 2026.6.33 → 2026.6.35
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/action-runtime-api.js +1 -1
- package/dist/{api-CjnGBhM3.js → api-1GXlSrYP.js} +42 -21
- package/dist/api.js +14 -14
- package/dist/{approval-handler.runtime-BWPQrzpP.js → approval-handler.runtime-Dv4p7REU.js} +3 -3
- package/dist/{audit-BwJ_2OjL.js → audit-DEVi9nIs.js} +3 -3
- package/dist/{channel-Ddnonoy4.js → channel-CQIRiosn.js} +15 -15
- package/dist/{channel-actions-CwmIqnYN.js → channel-actions-JziPEcBU.js} +2 -2
- package/dist/{channel-actions.runtime-DvpTfaJ4.js → channel-actions.runtime-D7L47LY3.js} +5 -5
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-glZ5Y98a.js → channel.setup-oMeR19Cc.js} +2 -2
- package/dist/{components-j6lTZBsT.js → components-_s5UPJqU.js} +1 -1
- package/dist/{conversation-identity-36FFBwm5.js → conversation-identity-B0k94-bz.js} +2 -2
- package/dist/{directory-config-BYMFzL29.js → directory-config-CD1svkyN.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-9JtJCiu8.js → directory-live-DBTsSRxl.js} +5 -5
- package/dist/{handle-action.guild-admin-xxGYrp-I.js → handle-action.guild-admin-CYIFMxh-.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/{manager.runtime-BK6cf2Zu.js → manager.runtime-BZVdGX2d.js} +17 -9
- package/dist/{message-handler-BqpJIavO.js → message-handler-DZd9Bpq8.js} +7 -6
- package/dist/{message-handler.preflight-C90MxCcv.js → message-handler.preflight-Axv9J9EO.js} +12 -11
- package/dist/{message-handler.process-CeQ7Bd_3.js → message-handler.process-CG0zFS-Z.js} +10 -10
- package/dist/{message-utils-CJeAoISH.js → message-utils-Dbuw27gd.js} +1 -1
- package/dist/{outbound-adapter-Dxs6iKEq.js → outbound-adapter-CKC_kmUN.js} +6 -6
- package/dist/pluralkit-CfTReLl3.js +40 -0
- package/dist/{probe-esE_Oqdm.js → probe-DcgZIpyF.js} +3 -2
- package/dist/{probe.runtime-C3Atgpvr.js → probe.runtime-CVwM9L5E.js} +1 -1
- package/dist/{provider-C7376XFH.js → provider-CwwSXIIj.js} +102 -37
- package/dist/{provider-session.runtime-CCdqogGf.js → provider-session.runtime-reBWkqHZ.js} +3 -3
- package/dist/provider.runtime-BsmTLYS_.js +2 -0
- package/dist/{resolve-allowlist-common-3gB2Gpmm.js → resolve-allowlist-common-D7bZqAw3.js} +3 -3
- package/dist/{resolve-channels-B3gQf8QL.js → resolve-channels--oE-RnO6.js} +6 -6
- package/dist/{resolve-users-BO10y5fJ.js → resolve-users-QXo8CXBU.js} +5 -5
- package/dist/{runtime-CFlR3L9X.js → runtime-CF7ramAs.js} +7 -7
- package/dist/runtime-api.actions.js +2 -2
- package/dist/runtime-api.js +19 -19
- package/dist/runtime-api.lookup.js +5 -5
- package/dist/runtime-api.monitor-CzF8MUl_.js +6 -0
- package/dist/runtime-api.monitor.js +5 -5
- package/dist/runtime-api.send.js +5 -5
- package/dist/runtime-api.threads.js +3 -3
- package/dist/{send-JHxfT4Pk.js → send-Bb295iHT.js} +5 -5
- package/dist/{send.components-CN35E2Ck.js → send.components-COkDUO3B.js} +4 -4
- package/dist/{send.outbound-B-cA1Esv.js → send.outbound-B_sk0hNe.js} +3 -3
- package/dist/{send.receipt-CGecJDin.js → send.receipt-Cli6_9Sn.js} +19 -7
- package/dist/{send.shared-vcbfThdy.js → send.shared-BCG7MWnP.js} +2 -2
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{subagent-hooks-20wXhVzZ.js → subagent-hooks-CtqoWK4x.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{system-events-DR27TE7p.js → system-events-BxGNk_wE.js} +1 -1
- package/dist/{target-resolver-CDi1gI90.js → target-resolver-BcoK6b0g.js} +2 -2
- package/dist/targets-Q-ZoP7K4.js +3 -0
- package/dist/{thread-bindings-DU4T6nDo.js → thread-bindings-DJ_HT6GJ.js} +4 -4
- package/dist/{thread-bindings.discord-api-CYkr-3Gj.js → thread-bindings.discord-api-OPyjvgyz.js} +4 -4
- package/dist/{thread-bindings.manager-BqWs1UE2.js → thread-bindings.manager-Cd2HAVw_.js} +3 -3
- package/dist/{transcripts-source-D-lBI5ZD.js → transcripts-source-CPf5gURy.js} +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-xr05bL-r.js → typing-DY0cwLdg.js} +1 -1
- package/node_modules/undici/README.md +8 -2
- package/node_modules/undici/docs/docs/api/Agent.md +248 -44
- package/node_modules/undici/docs/docs/api/BalancedPool.md +246 -48
- package/node_modules/undici/docs/docs/api/CacheStorage.md +171 -13
- package/node_modules/undici/docs/docs/api/CacheStore.md +294 -98
- package/node_modules/undici/docs/docs/api/Client.md +386 -179
- package/node_modules/undici/docs/docs/api/ClientStats.md +80 -14
- package/node_modules/undici/docs/docs/api/Connector.md +118 -36
- package/node_modules/undici/docs/docs/api/ContentType.md +65 -25
- package/node_modules/undici/docs/docs/api/Cookies.md +122 -71
- package/node_modules/undici/docs/docs/api/Debug.md +34 -18
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +364 -164
- package/node_modules/undici/docs/docs/api/Dispatcher.md +485 -1102
- package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +102 -87
- package/node_modules/undici/docs/docs/api/Errors.md +503 -40
- package/node_modules/undici/docs/docs/api/EventSource.md +298 -32
- package/node_modules/undici/docs/docs/api/Fetch.md +680 -31
- package/node_modules/undici/docs/docs/api/GlobalInstallation.md +78 -98
- package/node_modules/undici/docs/docs/api/H2CClient.md +298 -176
- package/node_modules/undici/docs/docs/api/Interceptors.md +418 -0
- package/node_modules/undici/docs/docs/api/MockAgent.md +333 -314
- package/node_modules/undici/docs/docs/api/MockCallHistory.md +272 -98
- package/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +189 -26
- package/node_modules/undici/docs/docs/api/MockClient.md +151 -33
- package/node_modules/undici/docs/docs/api/MockErrors.md +56 -5
- package/node_modules/undici/docs/docs/api/MockPool.md +321 -258
- package/node_modules/undici/docs/docs/api/Pool.md +235 -43
- package/node_modules/undici/docs/docs/api/PoolStats.md +119 -13
- package/node_modules/undici/docs/docs/api/ProxyAgent.md +179 -160
- package/node_modules/undici/docs/docs/api/RedirectHandler.md +238 -63
- package/node_modules/undici/docs/docs/api/RetryAgent.md +113 -26
- package/node_modules/undici/docs/docs/api/RetryHandler.md +161 -77
- package/node_modules/undici/docs/docs/api/RoundRobinPool.md +166 -72
- package/node_modules/undici/docs/docs/api/SnapshotAgent.md +264 -542
- package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +177 -196
- package/node_modules/undici/docs/docs/api/Util.md +68 -11
- package/node_modules/undici/docs/docs/api/WebSocket.md +475 -80
- package/node_modules/undici/docs/docs/api/api-lifecycle.md +100 -32
- package/node_modules/undici/docs/docs/best-practices/client-certificate.md +2 -0
- package/node_modules/undici/docs/docs/best-practices/crawling.md +3 -1
- package/node_modules/undici/docs/docs/best-practices/migrating-from-v7-to-v8.md +6 -4
- package/node_modules/undici/docs/docs/best-practices/mocking-request.md +9 -7
- package/node_modules/undici/docs/docs/best-practices/proxy.md +3 -1
- package/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +10 -8
- package/node_modules/undici/docs/docs/best-practices/writing-tests.md +2 -0
- package/node_modules/undici/docs/docs/{GettingStarted.md → getting-started.md} +22 -19
- package/node_modules/undici/docs/docs/index.md +784 -0
- package/node_modules/undici/docs/docs/site.json +125 -0
- package/node_modules/undici/docs/docs/type-map.json +79 -0
- package/node_modules/undici/lib/api/api-request.js +7 -1
- package/node_modules/undici/lib/api/readable.js +42 -7
- package/node_modules/undici/lib/cache/memory-cache-store.js +56 -11
- package/node_modules/undici/lib/cache/sqlite-cache-store.js +7 -1
- package/node_modules/undici/lib/core/connect.js +16 -2
- package/node_modules/undici/lib/core/errors.js +20 -0
- package/node_modules/undici/lib/core/request.js +14 -3
- package/node_modules/undici/lib/core/symbols.js +3 -0
- package/node_modules/undici/lib/core/util.js +30 -2
- package/node_modules/undici/lib/dispatcher/agent.js +10 -5
- package/node_modules/undici/lib/dispatcher/balanced-pool.js +7 -4
- package/node_modules/undici/lib/dispatcher/client-h1.js +74 -9
- package/node_modules/undici/lib/dispatcher/client-h2.js +483 -151
- package/node_modules/undici/lib/dispatcher/client.js +76 -30
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +13 -1
- package/node_modules/undici/lib/dispatcher/dispatcher.js +15 -1
- package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +3 -0
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +37 -8
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +58 -7
- package/node_modules/undici/lib/dispatcher/retry-agent.js +3 -0
- package/node_modules/undici/lib/dispatcher/round-robin-pool.js +1 -1
- package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +106 -22
- package/node_modules/undici/lib/global.js +36 -16
- package/node_modules/undici/lib/handler/cache-handler.js +297 -65
- package/node_modules/undici/lib/handler/cache-revalidation-handler.js +13 -3
- package/node_modules/undici/lib/handler/decorator-handler.js +7 -1
- package/node_modules/undici/lib/handler/deduplication-handler.js +12 -6
- package/node_modules/undici/lib/handler/redirect-handler.js +26 -5
- package/node_modules/undici/lib/handler/retry-handler.js +238 -51
- package/node_modules/undici/lib/interceptor/cache.js +221 -58
- package/node_modules/undici/lib/interceptor/decompress.js +124 -15
- package/node_modules/undici/lib/interceptor/deduplicate.js +5 -4
- package/node_modules/undici/lib/interceptor/dns.js +7 -0
- package/node_modules/undici/lib/interceptor/dump.js +10 -23
- package/node_modules/undici/lib/mock/mock-agent.js +13 -1
- package/node_modules/undici/lib/mock/mock-interceptor.js +25 -7
- package/node_modules/undici/lib/mock/mock-utils.js +246 -27
- package/node_modules/undici/lib/util/cache.js +415 -71
- package/node_modules/undici/lib/util/date.js +23 -6
- package/node_modules/undici/lib/web/cookies/parse.js +150 -146
- package/node_modules/undici/lib/web/cookies/util.js +79 -9
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +28 -1
- package/node_modules/undici/lib/web/eventsource/eventsource.js +13 -3
- package/node_modules/undici/lib/web/eventsource/util.js +1 -1
- package/node_modules/undici/lib/web/fetch/body.js +2 -1
- package/node_modules/undici/lib/web/fetch/constants.js +1 -1
- package/node_modules/undici/lib/web/fetch/index.js +17 -2
- package/node_modules/undici/lib/web/fetch/request.js +2 -3
- package/node_modules/undici/lib/web/fetch/response.js +1 -3
- package/node_modules/undici/lib/web/fetch/util.js +10 -2
- package/node_modules/undici/lib/web/webidl/index.js +3 -3
- package/node_modules/undici/lib/web/websocket/connection.js +1 -1
- package/node_modules/undici/lib/web/websocket/permessage-deflate.js +5 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +8 -10
- package/node_modules/undici/lib/web/websocket/websocket.js +22 -0
- package/node_modules/undici/package.json +4 -4
- package/node_modules/undici/types/client.d.ts +53 -3
- package/node_modules/undici/types/cookies.d.ts +1 -1
- package/node_modules/undici/types/dispatcher.d.ts +3 -3
- package/node_modules/undici/types/errors.d.ts +10 -0
- package/node_modules/undici/types/handlers.d.ts +2 -0
- package/node_modules/undici/types/interceptors.d.ts +2 -0
- package/node_modules/undici/types/mock-agent.d.ts +11 -10
- package/node_modules/undici/types/mock-interceptor.d.ts +5 -1
- package/node_modules/undici/types/proxy-agent.d.ts +7 -0
- package/node_modules/undici/types/socks5-proxy-agent.d.ts +2 -0
- package/npm-shrinkwrap.json +7 -7
- package/package.json +6 -5
- package/dist/pluralkit-DI6RYaVj.js +0 -24
- package/dist/provider.runtime-D1m66kDS.js +0 -2
- package/dist/runtime-api.monitor-4oc58TSk.js +0 -6
- package/dist/targets-C6yd3y8R.js +0 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as normalizeDiscordOutboundTarget, s as chunkDiscordTextWithMode, t as createDiscordSendReceipt } from "./send.receipt-
|
|
2
|
-
import { d as readDiscordComponentSpec } from "./components-
|
|
1
|
+
import { o as normalizeDiscordOutboundTarget, s as chunkDiscordTextWithMode, t as createDiscordSendReceipt } from "./send.receipt-Cli6_9Sn.js";
|
|
2
|
+
import { d as readDiscordComponentSpec } from "./components-_s5UPJqU.js";
|
|
3
3
|
import { n as notifyDiscordInboundEventOutboundPayloadSuccess } from "./inbound-event-delivery-CEPlt2uz.js";
|
|
4
4
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { resolvePayloadMediaUrls, sendPayloadMediaSequenceOrFallback, sendTextMediaPayload } from "openclaw/plugin-sdk/reply-payload";
|
|
@@ -50,11 +50,11 @@ function normalizeDiscordApprovalPayload(payload) {
|
|
|
50
50
|
let discordComponentSendPromise;
|
|
51
51
|
let discordSharedInteractivePromise;
|
|
52
52
|
async function sendDiscordComponentMessageLazy(...args) {
|
|
53
|
-
discordComponentSendPromise ??= import("./send.components-
|
|
53
|
+
discordComponentSendPromise ??= import("./send.components-COkDUO3B.js").then((n) => n.i).then((module) => module.sendDiscordComponentMessage);
|
|
54
54
|
return await (await discordComponentSendPromise)(...args);
|
|
55
55
|
}
|
|
56
56
|
function loadDiscordSharedInteractive() {
|
|
57
|
-
discordSharedInteractivePromise ??= import("./components-
|
|
57
|
+
discordSharedInteractivePromise ??= import("./components-_s5UPJqU.js").then((n) => n.a);
|
|
58
58
|
return discordSharedInteractivePromise;
|
|
59
59
|
}
|
|
60
60
|
function addPayloadTextFallback(spec, payload) {
|
|
@@ -89,7 +89,7 @@ async function resolveDiscordComponentSpec(payload) {
|
|
|
89
89
|
//#region extensions/discord/src/outbound-send-context.ts
|
|
90
90
|
let discordSendRuntimePromise;
|
|
91
91
|
async function loadDiscordSendRuntime() {
|
|
92
|
-
discordSendRuntimePromise ??= import("./send-
|
|
92
|
+
discordSendRuntimePromise ??= import("./send-Bb295iHT.js").then((n) => n.t);
|
|
93
93
|
return await discordSendRuntimePromise;
|
|
94
94
|
}
|
|
95
95
|
function resolveDiscordOutboundTarget(params) {
|
|
@@ -239,7 +239,7 @@ function stripDiscordInternalRuntimeScaffolding(text) {
|
|
|
239
239
|
}
|
|
240
240
|
let discordThreadBindingsPromise;
|
|
241
241
|
function loadDiscordThreadBindings() {
|
|
242
|
-
discordThreadBindingsPromise ??= import("./thread-bindings-
|
|
242
|
+
discordThreadBindingsPromise ??= import("./thread-bindings-DJ_HT6GJ.js").then((n) => n.t);
|
|
243
243
|
return discordThreadBindingsPromise;
|
|
244
244
|
}
|
|
245
245
|
function resolveDiscordWebhookIdentity(params) {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Wt as __exportAll } from "./send.receipt-Cli6_9Sn.js";
|
|
2
|
+
import { resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
3
|
+
import { readProviderJsonResponse, readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
|
|
4
|
+
import { buildTimeoutAbortSignal } from "openclaw/plugin-sdk/extension-shared";
|
|
5
|
+
//#region extensions/discord/src/pluralkit.ts
|
|
6
|
+
var pluralkit_exports = /* @__PURE__ */ __exportAll({ fetchPluralKitMessageInfo: () => fetchPluralKitMessageInfo });
|
|
7
|
+
const PLURALKIT_API_BASE = "https://api.pluralkit.me/v2";
|
|
8
|
+
const PLURALKIT_ERROR_BODY_LIMIT_BYTES = 8 * 1024;
|
|
9
|
+
const PLURALKIT_LOOKUP_TIMEOUT_MS = 1e4;
|
|
10
|
+
async function fetchPluralKitMessageInfo(params) {
|
|
11
|
+
if (!params.config?.enabled) return null;
|
|
12
|
+
const fetchImpl = resolveFetch(params.fetcher);
|
|
13
|
+
if (!fetchImpl) return null;
|
|
14
|
+
const headers = {};
|
|
15
|
+
if (params.config.token?.trim()) headers.Authorization = params.config.token.trim();
|
|
16
|
+
const url = `${PLURALKIT_API_BASE}/messages/${params.messageId}`;
|
|
17
|
+
const timeout = buildTimeoutAbortSignal({
|
|
18
|
+
signal: params.signal,
|
|
19
|
+
timeoutMs: PLURALKIT_LOOKUP_TIMEOUT_MS,
|
|
20
|
+
operation: "discord.pluralkit.lookup",
|
|
21
|
+
url
|
|
22
|
+
});
|
|
23
|
+
try {
|
|
24
|
+
const res = await fetchImpl(url, {
|
|
25
|
+
headers,
|
|
26
|
+
signal: timeout.signal
|
|
27
|
+
});
|
|
28
|
+
if (res.status === 404) return null;
|
|
29
|
+
if (!res.ok) {
|
|
30
|
+
const text = await readResponseTextLimited(res, PLURALKIT_ERROR_BODY_LIMIT_BYTES).catch(() => "");
|
|
31
|
+
const detail = text.trim() ? `: ${text.trim()}` : "";
|
|
32
|
+
throw new Error(`PluralKit API failed (${res.status})${detail}`);
|
|
33
|
+
}
|
|
34
|
+
return await readProviderJsonResponse(res, "PluralKit message");
|
|
35
|
+
} finally {
|
|
36
|
+
timeout.cleanup();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { pluralkit_exports as n, fetchPluralKitMessageInfo as t };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { p as normalizeDiscordToken } from "./accounts-P19jm1lf.js";
|
|
2
|
-
import { n as
|
|
2
|
+
import { n as DiscordApiError, r as fetchDiscord } from "./api-1GXlSrYP.js";
|
|
3
3
|
import { resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
4
4
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
5
|
+
import { readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";
|
|
5
6
|
import { fetchWithTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
6
7
|
//#region extensions/discord/src/probe.ts
|
|
7
8
|
const DISCORD_API_BASE = "https://discord.com/api/v10";
|
|
@@ -78,7 +79,7 @@ async function probeDiscord(token, timeoutMs, opts) {
|
|
|
78
79
|
elapsedMs: Date.now() - started
|
|
79
80
|
};
|
|
80
81
|
}
|
|
81
|
-
const json = await res.
|
|
82
|
+
const json = await readProviderJsonResponse(res, "discord.probe.getMe");
|
|
82
83
|
result.ok = true;
|
|
83
84
|
result.bot = {
|
|
84
85
|
id: json.id ?? null,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as resolveDiscordPrivilegedIntentsFromFlags, i as probeDiscord, n as fetchDiscordApplicationSummary, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-
|
|
1
|
+
import { a as resolveDiscordPrivilegedIntentsFromFlags, i as probeDiscord, n as fetchDiscordApplicationSummary, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-DcgZIpyF.js";
|
|
2
2
|
export { fetchDiscordApplicationId, fetchDiscordApplicationSummary, parseApplicationIdFromToken, probeDiscord, resolveDiscordPrivilegedIntentsFromFlags };
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { $ as BaseMessageInteractiveComponent, A as User, B as Container, D as CommandWithSubcommands, E as Command, F as Modal, J as Separator, K as Row, O as Guild, R as Button, S as RateLimitError, Wt as __exportAll, X as TextDisplay, Y as StringSelectMenu, c as discord_exports, ct as createThread, d as MessageReactionAddListener, dt as editChannel, f as MessageReactionRemoveListener, g as ThreadUpdateListener, k as Message, l as InteractionCreateListener, m as ReadyListener, mt as getChannelMessage, p as PresenceUpdateListener, s as chunkDiscordTextWithMode, u as MessageCreateListener, v as Client, y as Plugin } from "./send.receipt-
|
|
1
|
+
import { $ as BaseMessageInteractiveComponent, A as User, B as Container, D as CommandWithSubcommands, E as Command, F as Modal, J as Separator, K as Row, O as Guild, R as Button, S as RateLimitError, Wt as __exportAll, X as TextDisplay, Y as StringSelectMenu, c as discord_exports, ct as createThread, d as MessageReactionAddListener, dt as editChannel, f as MessageReactionRemoveListener, g as ThreadUpdateListener, k as Message, l as InteractionCreateListener, m as ReadyListener, mt as getChannelMessage, p as PresenceUpdateListener, s as chunkDiscordTextWithMode, u as MessageCreateListener, v as Client, y as Plugin } from "./send.receipt-Cli6_9Sn.js";
|
|
2
2
|
import { c as resolveDiscordAccountAllowFrom, d as resolveDiscordAccountDmPolicy, f as resolveDiscordMaxLinesPerMessage, p as normalizeDiscordToken, s as resolveDiscordAccount } from "./accounts-P19jm1lf.js";
|
|
3
|
-
import { _ as parseDiscordComponentCustomId, b as parseDiscordModalCustomIdForInteraction, v as parseDiscordComponentCustomIdForInteraction, y as parseDiscordModalCustomId } from "./components-
|
|
4
|
-
import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-
|
|
3
|
+
import { _ as parseDiscordComponentCustomId, b as parseDiscordModalCustomIdForInteraction, v as parseDiscordComponentCustomIdForInteraction, y as parseDiscordModalCustomId } from "./components-_s5UPJqU.js";
|
|
4
|
+
import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-COkDUO3B.js";
|
|
5
5
|
import { i as setPresence } from "./presence-cache-z1N8MbJ3.js";
|
|
6
|
-
import { H as validateDiscordProxyUrl, K as registerGateway, L as createDiscordRestClient, O as canViewDiscordGuildChannel, U as withValidatedDiscordProxy, V as DISCORD_REST_TIMEOUT_MS, q as unregisterGateway } from "./send.shared-
|
|
7
|
-
import { a as
|
|
6
|
+
import { H as validateDiscordProxyUrl, K as registerGateway, L as createDiscordRestClient, O as canViewDiscordGuildChannel, U as withValidatedDiscordProxy, V as DISCORD_REST_TIMEOUT_MS, q as unregisterGateway } from "./send.shared-BCG7MWnP.js";
|
|
7
|
+
import { a as isDiscordRateLimitResponseBody, o as summarizeDiscordResponseBody } from "./api-1GXlSrYP.js";
|
|
8
8
|
import { S as resolveTimestampMs, _ as resolveGroupDmAllow, a as normalizeDiscordSlug, b as formatDiscordUserTag, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordGuildEntry, f as resolveDiscordMemberAccessState, h as resolveDiscordOwnerAllowFrom, i as normalizeDiscordDisplaySlug, l as resolveDiscordChannelPolicyCommandAuthorizer, m as resolveDiscordOwnerAccess, n as isDiscordGroupAllowedByPolicy, o as resolveDiscordAllowListMatch, p as resolveDiscordMemberAllowed, r as normalizeDiscordAllowList, v as shouldEmitDiscordReactionNotification, y as formatDiscordReactionEmoji } from "./allow-list-C-MqM-B_.js";
|
|
9
|
-
import { s as sendVoiceMessageDiscord } from "./send-
|
|
10
|
-
import { o as formatMention, t as sendMessageDiscord } from "./send.outbound-
|
|
9
|
+
import { s as sendVoiceMessageDiscord } from "./send-Bb295iHT.js";
|
|
10
|
+
import { o as formatMention, t as sendMessageDiscord } from "./send.outbound-B_sk0hNe.js";
|
|
11
11
|
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
12
|
-
import { a as getDiscordExecApprovalApprovers, s as isDiscordExecApprovalClientEnabled, t as resolveDiscordConversationIdentity } from "./conversation-identity-
|
|
12
|
+
import { a as getDiscordExecApprovalApprovers, s as isDiscordExecApprovalClientEnabled, t as resolveDiscordConversationIdentity } from "./conversation-identity-B0k94-bz.js";
|
|
13
13
|
import { d as withAbortTimeout, l as raceWithTimeout } from "./timeouts-C5TBc_9x.js";
|
|
14
|
-
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-
|
|
15
|
-
import { t as resolveDiscordUserAllowlist } from "./resolve-users-
|
|
16
|
-
import { _ as formatThreadBindingDurationLabel, a as isThreadArchived, d as resolveDiscordChannelNameSafe, f as resolveDiscordChannelParentIdSafe, l as resolveDiscordChannelIdSafe, m as resolveDiscordChannelTopicSafe, p as resolveDiscordChannelParentSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-
|
|
17
|
-
import { r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-
|
|
18
|
-
import { d as resolveDiscordMessageChannelId, n as resolveDiscordForwardedMessagesTextFromSnapshots, t as resolveDiscordEmbedText, u as resolveDiscordChannelInfo } from "./message-utils-
|
|
14
|
+
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels--oE-RnO6.js";
|
|
15
|
+
import { t as resolveDiscordUserAllowlist } from "./resolve-users-QXo8CXBU.js";
|
|
16
|
+
import { _ as formatThreadBindingDurationLabel, a as isThreadArchived, d as resolveDiscordChannelNameSafe, f as resolveDiscordChannelParentIdSafe, l as resolveDiscordChannelIdSafe, m as resolveDiscordChannelTopicSafe, p as resolveDiscordChannelParentSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-OPyjvgyz.js";
|
|
17
|
+
import { r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-DcgZIpyF.js";
|
|
18
|
+
import { d as resolveDiscordMessageChannelId, n as resolveDiscordForwardedMessagesTextFromSnapshots, t as resolveDiscordEmbedText, u as resolveDiscordChannelInfo } from "./message-utils-Dbuw27gd.js";
|
|
19
19
|
import { t as resolveDiscordSenderIdentity } from "./sender-identity-CEsfDF0L.js";
|
|
20
|
-
import "./approval-handler.runtime-
|
|
20
|
+
import "./approval-handler.runtime-Dv4p7REU.js";
|
|
21
21
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
22
22
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeOptionalStringifiedId, normalizeStringEntries, normalizeStringEntriesLower, summarizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
23
23
|
import { buildAgentSessionKey, deriveLastRoutePolicy, isAcpSessionKey, isSubagentSessionKey, parseAgentSessionKey, resolveAgentIdFromSessionKey, resolveAgentRoute } from "openclaw/plugin-sdk/routing";
|
|
@@ -4920,19 +4920,38 @@ var GatewayReconnectTimer = class {
|
|
|
4920
4920
|
//#region extensions/discord/src/internal/gateway-rate-limit.ts
|
|
4921
4921
|
const GATEWAY_SEND_LIMIT = 120;
|
|
4922
4922
|
const GATEWAY_SEND_WINDOW_MS = 6e4;
|
|
4923
|
+
const GATEWAY_SEND_QUEUE_LIMIT = GATEWAY_SEND_LIMIT;
|
|
4923
4924
|
var GatewaySendLimiter = class {
|
|
4924
|
-
constructor(sendNow, emitError) {
|
|
4925
|
+
constructor(sendNow, emitError, emitOverflowWarning) {
|
|
4925
4926
|
this.sendNow = sendNow;
|
|
4926
4927
|
this.emitError = emitError;
|
|
4928
|
+
this.emitOverflowWarning = emitOverflowWarning;
|
|
4927
4929
|
this.outboundSendTimestamps = [];
|
|
4928
4930
|
this.outboundQueue = [];
|
|
4931
|
+
this.droppedEvents = 0;
|
|
4932
|
+
this.overflowWarningEmitted = false;
|
|
4929
4933
|
}
|
|
4930
4934
|
send(serialized, options) {
|
|
4931
4935
|
if (options?.critical || this.canSend(Date.now())) {
|
|
4932
4936
|
this.sendSerialized(serialized);
|
|
4933
4937
|
return;
|
|
4934
4938
|
}
|
|
4939
|
+
let shouldEmitOverflowWarning = false;
|
|
4940
|
+
if (this.outboundQueue.length >= GATEWAY_SEND_QUEUE_LIMIT) {
|
|
4941
|
+
this.outboundQueue.shift();
|
|
4942
|
+
this.droppedEvents += 1;
|
|
4943
|
+
if (!this.overflowWarningEmitted) {
|
|
4944
|
+
this.overflowWarningEmitted = true;
|
|
4945
|
+
shouldEmitOverflowWarning = true;
|
|
4946
|
+
}
|
|
4947
|
+
}
|
|
4935
4948
|
this.outboundQueue.push({ payload: serialized });
|
|
4949
|
+
if (shouldEmitOverflowWarning) this.emitOverflowWarning({
|
|
4950
|
+
droppedEvents: this.droppedEvents,
|
|
4951
|
+
maxQueuedEvents: GATEWAY_SEND_QUEUE_LIMIT,
|
|
4952
|
+
policy: "drop-oldest",
|
|
4953
|
+
queuedEvents: this.outboundQueue.length
|
|
4954
|
+
});
|
|
4936
4955
|
this.scheduleFlush();
|
|
4937
4956
|
}
|
|
4938
4957
|
clear() {
|
|
@@ -4941,6 +4960,8 @@ var GatewaySendLimiter = class {
|
|
|
4941
4960
|
this.outboundFlushTimer = void 0;
|
|
4942
4961
|
}
|
|
4943
4962
|
this.outboundQueue = [];
|
|
4963
|
+
this.droppedEvents = 0;
|
|
4964
|
+
this.overflowWarningEmitted = false;
|
|
4944
4965
|
}
|
|
4945
4966
|
getStatus() {
|
|
4946
4967
|
const now = Date.now();
|
|
@@ -4950,7 +4971,8 @@ var GatewaySendLimiter = class {
|
|
|
4950
4971
|
remainingEvents: Math.max(0, GATEWAY_SEND_LIMIT - this.outboundSendTimestamps.length),
|
|
4951
4972
|
resetTime: this.outboundSendTimestamps.length > 0 ? oldest + GATEWAY_SEND_WINDOW_MS : now + GATEWAY_SEND_WINDOW_MS,
|
|
4952
4973
|
currentEventCount: this.outboundSendTimestamps.length,
|
|
4953
|
-
queuedEvents: this.outboundQueue.length
|
|
4974
|
+
queuedEvents: this.outboundQueue.length,
|
|
4975
|
+
droppedEvents: this.droppedEvents
|
|
4954
4976
|
};
|
|
4955
4977
|
}
|
|
4956
4978
|
pruneWindow(now) {
|
|
@@ -4989,6 +5011,7 @@ var GatewaySendLimiter = class {
|
|
|
4989
5011
|
return;
|
|
4990
5012
|
}
|
|
4991
5013
|
}
|
|
5014
|
+
if (this.outboundQueue.length < GATEWAY_SEND_QUEUE_LIMIT) this.overflowWarningEmitted = false;
|
|
4992
5015
|
this.scheduleFlush();
|
|
4993
5016
|
}
|
|
4994
5017
|
};
|
|
@@ -5000,6 +5023,7 @@ const DEFAULT_GATEWAY_URL = "wss://gateway.discord.gg/";
|
|
|
5000
5023
|
const DISCORD_GATEWAY_PAYLOAD_LIMIT_BYTES = 4096;
|
|
5001
5024
|
const INVALID_SESSION_MIN_DELAY_MS = 1e3;
|
|
5002
5025
|
const INVALID_SESSION_JITTER_MS = 4e3;
|
|
5026
|
+
const RESUME_FAILURE_THRESHOLD = 3;
|
|
5003
5027
|
function ensureGatewayParams(url) {
|
|
5004
5028
|
const parsed = new URL(url);
|
|
5005
5029
|
parsed.searchParams.set("v", parsed.searchParams.get("v") ?? "10");
|
|
@@ -5026,11 +5050,12 @@ var GatewayPlugin = class extends Plugin {
|
|
|
5026
5050
|
this.sessionId = null;
|
|
5027
5051
|
this.resumeGatewayUrl = null;
|
|
5028
5052
|
this.reconnectAttempts = 0;
|
|
5053
|
+
this.consecutiveResumeFailures = 0;
|
|
5029
5054
|
this.shouldReconnect = false;
|
|
5030
5055
|
this.isConnecting = false;
|
|
5031
5056
|
this.heartbeatTimers = new GatewayHeartbeatTimers();
|
|
5032
5057
|
this.reconnectTimer = new GatewayReconnectTimer();
|
|
5033
|
-
this.outboundLimiter = new GatewaySendLimiter((payload) => this.sendSerializedGatewayEvent(payload), (error) => this.emitter.emit("error", error));
|
|
5058
|
+
this.outboundLimiter = new GatewaySendLimiter((payload) => this.sendSerializedGatewayEvent(payload), (error) => this.emitter.emit("error", error), (warning) => this.emitter.emit("warning", `Gateway outbound queue overflow policy=${warning.policy} droppedEvents=${warning.droppedEvents} queuedEvents=${warning.queuedEvents} maxQueuedEvents=${warning.maxQueuedEvents}`));
|
|
5034
5059
|
this.options = {
|
|
5035
5060
|
...options,
|
|
5036
5061
|
reconnect: {
|
|
@@ -5091,6 +5116,7 @@ var GatewayPlugin = class extends Plugin {
|
|
|
5091
5116
|
this.isConnecting = false;
|
|
5092
5117
|
this.isConnected = false;
|
|
5093
5118
|
this.reconnectAttempts = 0;
|
|
5119
|
+
this.consecutiveResumeFailures = 0;
|
|
5094
5120
|
}
|
|
5095
5121
|
createWebSocket(url) {
|
|
5096
5122
|
return new ws.WebSocket(url);
|
|
@@ -5128,7 +5154,11 @@ var GatewayPlugin = class extends Plugin {
|
|
|
5128
5154
|
}
|
|
5129
5155
|
const canResume = canResumeAfterGatewayClose(closeCode);
|
|
5130
5156
|
if (!canResume) this.resetSessionState();
|
|
5131
|
-
this.scheduleReconnect(
|
|
5157
|
+
this.scheduleReconnect({
|
|
5158
|
+
reason: "close",
|
|
5159
|
+
preferResume: canResume,
|
|
5160
|
+
closeCode
|
|
5161
|
+
});
|
|
5132
5162
|
});
|
|
5133
5163
|
socket.on("error", (error) => {
|
|
5134
5164
|
if (socket !== this.ws) return;
|
|
@@ -5138,20 +5168,22 @@ var GatewayPlugin = class extends Plugin {
|
|
|
5138
5168
|
handlePayload(payload, resume, sourceSocket) {
|
|
5139
5169
|
if (payload.s !== null && payload.s !== void 0) this.sequence = payload.s;
|
|
5140
5170
|
switch (payload.op) {
|
|
5141
|
-
case GatewayOpcodes.Hello:
|
|
5171
|
+
case GatewayOpcodes.Hello: {
|
|
5142
5172
|
this.startHeartbeat(payload.d.heartbeat_interval ?? 45e3);
|
|
5143
|
-
|
|
5173
|
+
const resumeState = resume ? this.getResumeState() : null;
|
|
5174
|
+
if (resumeState) this.send({
|
|
5144
5175
|
op: GatewayOpcodes.Resume,
|
|
5145
5176
|
d: {
|
|
5146
5177
|
token: this.client?.options.token ?? "",
|
|
5147
|
-
session_id:
|
|
5148
|
-
seq:
|
|
5178
|
+
session_id: resumeState.sessionId,
|
|
5179
|
+
seq: resumeState.sequence
|
|
5149
5180
|
}
|
|
5150
5181
|
}, true);
|
|
5151
5182
|
else this.identifyWithConcurrency(sourceSocket).catch((error) => {
|
|
5152
5183
|
this.emitter.emit("error", error instanceof Error ? error : new Error(String(error), { cause: error }));
|
|
5153
5184
|
});
|
|
5154
5185
|
break;
|
|
5186
|
+
}
|
|
5155
5187
|
case GatewayOpcodes.HeartbeatAck:
|
|
5156
5188
|
this.lastHeartbeatAck = true;
|
|
5157
5189
|
break;
|
|
@@ -5165,10 +5197,17 @@ var GatewayPlugin = class extends Plugin {
|
|
|
5165
5197
|
break;
|
|
5166
5198
|
case GatewayOpcodes.InvalidSession:
|
|
5167
5199
|
if (!payload.d) this.resetSessionState();
|
|
5168
|
-
this.scheduleReconnect(
|
|
5200
|
+
this.scheduleReconnect({
|
|
5201
|
+
reason: "invalid-session",
|
|
5202
|
+
preferResume: payload.d,
|
|
5203
|
+
minDelayMs: INVALID_SESSION_MIN_DELAY_MS + Math.floor(Math.random() * INVALID_SESSION_JITTER_MS)
|
|
5204
|
+
});
|
|
5169
5205
|
break;
|
|
5170
5206
|
case GatewayOpcodes.Reconnect:
|
|
5171
|
-
this.scheduleReconnect(
|
|
5207
|
+
this.scheduleReconnect({
|
|
5208
|
+
reason: "reconnect-opcode",
|
|
5209
|
+
preferResume: true
|
|
5210
|
+
});
|
|
5172
5211
|
break;
|
|
5173
5212
|
}
|
|
5174
5213
|
}
|
|
@@ -5179,7 +5218,10 @@ var GatewayPlugin = class extends Plugin {
|
|
|
5179
5218
|
onHeartbeat: () => this.sendHeartbeat(),
|
|
5180
5219
|
onAckTimeout: () => {
|
|
5181
5220
|
this.emitter.emit("error", /* @__PURE__ */ new Error("Gateway heartbeat ACK timeout"));
|
|
5182
|
-
this.scheduleReconnect(
|
|
5221
|
+
this.scheduleReconnect({
|
|
5222
|
+
reason: "zombie",
|
|
5223
|
+
preferResume: true
|
|
5224
|
+
});
|
|
5183
5225
|
}
|
|
5184
5226
|
});
|
|
5185
5227
|
}
|
|
@@ -5220,7 +5262,10 @@ var GatewayPlugin = class extends Plugin {
|
|
|
5220
5262
|
const socket = sourceSocket ?? this.ws;
|
|
5221
5263
|
if (!socket || socket !== this.ws) return;
|
|
5222
5264
|
if (socket.readyState !== READY_STATE_OPEN) {
|
|
5223
|
-
this.scheduleReconnect(
|
|
5265
|
+
this.scheduleReconnect({
|
|
5266
|
+
reason: "identify",
|
|
5267
|
+
preferResume: false
|
|
5268
|
+
});
|
|
5224
5269
|
return;
|
|
5225
5270
|
}
|
|
5226
5271
|
this.identify();
|
|
@@ -5242,10 +5287,12 @@ var GatewayPlugin = class extends Plugin {
|
|
|
5242
5287
|
this.sessionId = ready.session_id ?? null;
|
|
5243
5288
|
this.resumeGatewayUrl = ready.resume_gateway_url ?? null;
|
|
5244
5289
|
this.reconnectAttempts = 0;
|
|
5290
|
+
this.consecutiveResumeFailures = 0;
|
|
5245
5291
|
this.isConnected = true;
|
|
5246
5292
|
}
|
|
5247
5293
|
if (payload.t === GatewayDispatchEvents.Resumed) {
|
|
5248
5294
|
this.reconnectAttempts = 0;
|
|
5295
|
+
this.consecutiveResumeFailures = 0;
|
|
5249
5296
|
this.isConnected = true;
|
|
5250
5297
|
}
|
|
5251
5298
|
dispatchVoiceGatewayEvent(this.client, payload.t, payload.d);
|
|
@@ -5257,8 +5304,15 @@ var GatewayPlugin = class extends Plugin {
|
|
|
5257
5304
|
this.sessionId = null;
|
|
5258
5305
|
this.resumeGatewayUrl = null;
|
|
5259
5306
|
this.sequence = null;
|
|
5307
|
+
this.consecutiveResumeFailures = 0;
|
|
5308
|
+
}
|
|
5309
|
+
getResumeState() {
|
|
5310
|
+
return this.sessionId && this.sequence !== null ? {
|
|
5311
|
+
sessionId: this.sessionId,
|
|
5312
|
+
sequence: this.sequence
|
|
5313
|
+
} : null;
|
|
5260
5314
|
}
|
|
5261
|
-
scheduleReconnect(
|
|
5315
|
+
scheduleReconnect(options) {
|
|
5262
5316
|
if (!this.shouldReconnect) return;
|
|
5263
5317
|
this.stopHeartbeat();
|
|
5264
5318
|
this.stopReconnectTimer();
|
|
@@ -5270,12 +5324,21 @@ var GatewayPlugin = class extends Plugin {
|
|
|
5270
5324
|
this.reconnectAttempts += 1;
|
|
5271
5325
|
if (this.reconnectAttempts > (this.options.reconnect?.maxAttempts ?? 50)) {
|
|
5272
5326
|
const maxAttempts = this.options.reconnect?.maxAttempts ?? 50;
|
|
5273
|
-
this.emitter.emit("error", /* @__PURE__ */ new Error(`Max reconnect attempts (${maxAttempts}) reached${closeCode !== void 0 ? ` after close code ${closeCode}` : ""}`));
|
|
5327
|
+
this.emitter.emit("error", /* @__PURE__ */ new Error(`Max reconnect attempts (${maxAttempts}) reached${options.closeCode !== void 0 ? ` after close code ${options.closeCode}` : ""}`));
|
|
5274
5328
|
return;
|
|
5275
5329
|
}
|
|
5276
|
-
|
|
5330
|
+
let shouldResume = options.preferResume && this.getResumeState() !== null;
|
|
5331
|
+
if (shouldResume && this.consecutiveResumeFailures >= RESUME_FAILURE_THRESHOLD) {
|
|
5332
|
+
this.resetSessionState();
|
|
5333
|
+
shouldResume = false;
|
|
5334
|
+
this.emitter.emit("debug", `Gateway forcing fresh IDENTIFY after ${RESUME_FAILURE_THRESHOLD} failed resume attempts`);
|
|
5335
|
+
}
|
|
5336
|
+
if (shouldResume) this.consecutiveResumeFailures += 1;
|
|
5337
|
+
else this.consecutiveResumeFailures = 0;
|
|
5338
|
+
const delay = Math.max(options.minDelayMs ?? 0, Math.min(3e4, 1e3 * 2 ** Math.min(this.reconnectAttempts, 5)));
|
|
5339
|
+
this.emitter.emit("debug", `Gateway reconnect scheduled in ${delay}ms (${options.reason}, resume=${String(shouldResume)})`);
|
|
5277
5340
|
this.reconnectTimer.schedule(delay, () => {
|
|
5278
|
-
this.connect(
|
|
5341
|
+
this.connect(shouldResume);
|
|
5279
5342
|
});
|
|
5280
5343
|
}
|
|
5281
5344
|
updatePresence(data) {
|
|
@@ -7978,7 +8041,7 @@ async function loadConversationRuntime$1() {
|
|
|
7978
8041
|
return await conversationRuntimePromise$1;
|
|
7979
8042
|
}
|
|
7980
8043
|
async function loadTypingRuntime() {
|
|
7981
|
-
typingRuntimePromise ??= import("./typing-
|
|
8044
|
+
typingRuntimePromise ??= import("./typing-DY0cwLdg.js").then((n) => n.n);
|
|
7982
8045
|
return await typingRuntimePromise;
|
|
7983
8046
|
}
|
|
7984
8047
|
function buildDiscordComponentConversationLabel(params) {
|
|
@@ -8399,7 +8462,7 @@ async function dispatchPluginDiscordInteractiveEvent(params) {
|
|
|
8399
8462
|
//#region extensions/discord/src/monitor/agent-components.handlers.ts
|
|
8400
8463
|
let componentsRuntimePromise;
|
|
8401
8464
|
async function loadComponentsRuntime() {
|
|
8402
|
-
componentsRuntimePromise ??= import("./components-
|
|
8465
|
+
componentsRuntimePromise ??= import("./components-_s5UPJqU.js").then((n) => n.t);
|
|
8403
8466
|
return await componentsRuntimePromise;
|
|
8404
8467
|
}
|
|
8405
8468
|
async function handleDiscordComponentEvent(params) {
|
|
@@ -9182,7 +9245,9 @@ function attachDiscordGatewayLogging(params) {
|
|
|
9182
9245
|
if (shouldPromoteGatewayDebug(message)) runtime.log?.(`discord gateway: ${message}`);
|
|
9183
9246
|
};
|
|
9184
9247
|
const onGatewayWarning = (warning) => {
|
|
9185
|
-
|
|
9248
|
+
const message = `discord gateway warning: ${String(warning)}`;
|
|
9249
|
+
logVerbose(message);
|
|
9250
|
+
runtime.log?.(warn(message));
|
|
9186
9251
|
};
|
|
9187
9252
|
const onGatewayMetrics = (metrics) => {
|
|
9188
9253
|
logVerbose(`discord gateway metrics: ${formatGatewayMetrics(metrics)}`);
|
|
@@ -9617,7 +9682,7 @@ async function runDiscordGatewayLifecycle(params) {
|
|
|
9617
9682
|
gatewayEmitter?.removeListener(DISCORD_GATEWAY_TRANSPORT_ACTIVITY_EVENT, onGatewayTransportActivity);
|
|
9618
9683
|
if (params.voiceManager) {
|
|
9619
9684
|
await params.voiceManager.destroy();
|
|
9620
|
-
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-
|
|
9685
|
+
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-CPf5gURy.js").then((n) => n.n);
|
|
9621
9686
|
setDiscordTranscriptsVoiceManager({
|
|
9622
9687
|
accountId: params.accountId,
|
|
9623
9688
|
manager: null
|
|
@@ -9895,7 +9960,7 @@ function logDiscordStartupPhase(params) {
|
|
|
9895
9960
|
});
|
|
9896
9961
|
}
|
|
9897
9962
|
async function loadDiscordVoiceRuntime() {
|
|
9898
|
-
const promise = discordVoiceRuntimePromise ?? import("./manager.runtime-
|
|
9963
|
+
const promise = discordVoiceRuntimePromise ?? import("./manager.runtime-BZVdGX2d.js");
|
|
9899
9964
|
discordVoiceRuntimePromise = promise;
|
|
9900
9965
|
try {
|
|
9901
9966
|
return await promise;
|
|
@@ -9905,7 +9970,7 @@ async function loadDiscordVoiceRuntime() {
|
|
|
9905
9970
|
}
|
|
9906
9971
|
}
|
|
9907
9972
|
async function loadDiscordProviderSessionRuntime() {
|
|
9908
|
-
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-
|
|
9973
|
+
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-reBWkqHZ.js");
|
|
9909
9974
|
discordProviderSessionRuntimePromise = promise;
|
|
9910
9975
|
try {
|
|
9911
9976
|
return await promise;
|
|
@@ -10176,7 +10241,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10176
10241
|
runtime,
|
|
10177
10242
|
botUserId
|
|
10178
10243
|
});
|
|
10179
|
-
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-
|
|
10244
|
+
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-CPf5gURy.js").then((n) => n.n);
|
|
10180
10245
|
setDiscordTranscriptsVoiceManager({
|
|
10181
10246
|
accountId: account.accountId,
|
|
10182
10247
|
manager: voiceManager
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as reconcileAcpThreadBindingsOnStartup } from "./thread-bindings-
|
|
2
|
-
import { n as createThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-
|
|
3
|
-
import { t as createDiscordMessageHandler } from "./message-handler-
|
|
1
|
+
import { a as reconcileAcpThreadBindingsOnStartup } from "./thread-bindings-DJ_HT6GJ.js";
|
|
2
|
+
import { n as createThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-Cd2HAVw_.js";
|
|
3
|
+
import { t as createDiscordMessageHandler } from "./message-handler-DZd9Bpq8.js";
|
|
4
4
|
import { resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled } from "openclaw/plugin-sdk/conversation-runtime";
|
|
5
5
|
import { getAcpSessionManager, isAcpRuntimeError } from "openclaw/plugin-sdk/acp-runtime";
|
|
6
6
|
export { createDiscordMessageHandler, createNoopThreadBindingManager, createThreadBindingManager, getAcpSessionManager, isAcpRuntimeError, reconcileAcpThreadBindingsOnStartup, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { p as normalizeDiscordToken } from "./accounts-P19jm1lf.js";
|
|
2
|
-
import {
|
|
2
|
+
import { r as fetchDiscord } from "./api-1GXlSrYP.js";
|
|
3
3
|
import { a as normalizeDiscordSlug } from "./allow-list-C-MqM-B_.js";
|
|
4
4
|
//#region extensions/discord/src/guilds.ts
|
|
5
|
-
async function listGuilds(token, fetcher) {
|
|
6
|
-
return (await fetchDiscord("/users/@me/guilds", token, fetcher)).filter((guild) => typeof guild.id === "string" && typeof guild.name === "string").map((guild) => ({
|
|
5
|
+
async function listGuilds(token, fetcher, options) {
|
|
6
|
+
return (await fetchDiscord("/users/@me/guilds", token, fetcher, options)).filter((guild) => typeof guild.id === "string" && typeof guild.name === "string").map((guild) => ({
|
|
7
7
|
id: guild.id,
|
|
8
8
|
name: guild.name,
|
|
9
9
|
slug: normalizeDiscordSlug(guild.name)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Wt as __exportAll } from "./send.receipt-
|
|
2
|
-
import { n as fetchDiscord, t as
|
|
1
|
+
import { Wt as __exportAll } from "./send.receipt-Cli6_9Sn.js";
|
|
2
|
+
import { n as DiscordApiError, r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-1GXlSrYP.js";
|
|
3
3
|
import { a as normalizeDiscordSlug } from "./allow-list-C-MqM-B_.js";
|
|
4
|
-
import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-
|
|
4
|
+
import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-D7bZqAw3.js";
|
|
5
5
|
//#region extensions/discord/src/resolve-channels.ts
|
|
6
6
|
var resolve_channels_exports = /* @__PURE__ */ __exportAll({ resolveDiscordChannelAllowlist: () => resolveDiscordChannelAllowlist });
|
|
7
7
|
function parseDiscordChannelInput(raw) {
|
|
@@ -45,7 +45,7 @@ function parseDiscordChannelInput(raw) {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
async function listGuildChannels(token, fetcher, guildId) {
|
|
48
|
-
return (await fetchDiscord(`/guilds/${guildId}/channels`, token, fetcher)).map((channel) => {
|
|
48
|
+
return (await fetchDiscord(`/guilds/${guildId}/channels`, token, fetcher, { timeoutMs: DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS })).map((channel) => {
|
|
49
49
|
const archived = channel.thread_metadata?.archived;
|
|
50
50
|
return {
|
|
51
51
|
id: typeof channel.id === "string" ? channel.id : "",
|
|
@@ -59,7 +59,7 @@ async function listGuildChannels(token, fetcher, guildId) {
|
|
|
59
59
|
async function fetchChannel(token, fetcher, channelId) {
|
|
60
60
|
let raw;
|
|
61
61
|
try {
|
|
62
|
-
raw = await fetchDiscord(`/channels/${channelId}`, token, fetcher);
|
|
62
|
+
raw = await fetchDiscord(`/channels/${channelId}`, token, fetcher, { timeoutMs: DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS });
|
|
63
63
|
} catch (err) {
|
|
64
64
|
if (err instanceof DiscordApiError && err.status === 403) return { status: "forbidden" };
|
|
65
65
|
if (err instanceof DiscordApiError && err.status === 404) return { status: "not-found" };
|
|
@@ -95,7 +95,7 @@ async function resolveDiscordChannelAllowlist(params) {
|
|
|
95
95
|
resolved: false
|
|
96
96
|
}));
|
|
97
97
|
const fetcher = params.fetcher ?? fetch;
|
|
98
|
-
const guilds = await listGuilds(token, fetcher);
|
|
98
|
+
const guilds = await listGuilds(token, fetcher, { timeoutMs: DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS });
|
|
99
99
|
const channelsByGuild = /* @__PURE__ */ new Map();
|
|
100
100
|
const getChannels = (guildId) => {
|
|
101
101
|
const existing = channelsByGuild.get(guildId);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Wt as __exportAll } from "./send.receipt-
|
|
2
|
-
import {
|
|
3
|
-
import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-
|
|
1
|
+
import { Wt as __exportAll } from "./send.receipt-Cli6_9Sn.js";
|
|
2
|
+
import { r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-1GXlSrYP.js";
|
|
3
|
+
import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-D7bZqAw3.js";
|
|
4
4
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
//#region extensions/discord/src/resolve-users.ts
|
|
6
6
|
var resolve_users_exports = /* @__PURE__ */ __exportAll({ resolveDiscordUserAllowlist: () => resolveDiscordUserAllowlist });
|
|
@@ -52,7 +52,7 @@ async function resolveDiscordUserAllowlist(params) {
|
|
|
52
52
|
const fetcher = params.fetcher ?? fetch;
|
|
53
53
|
let guilds = null;
|
|
54
54
|
const getGuilds = async () => {
|
|
55
|
-
if (!guilds) guilds = await listGuilds(token, fetcher);
|
|
55
|
+
if (!guilds) guilds = await listGuilds(token, fetcher, { timeoutMs: DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS });
|
|
56
56
|
return guilds;
|
|
57
57
|
};
|
|
58
58
|
const results = [];
|
|
@@ -85,7 +85,7 @@ async function resolveDiscordUserAllowlist(params) {
|
|
|
85
85
|
query,
|
|
86
86
|
limit: "25"
|
|
87
87
|
});
|
|
88
|
-
const members = await fetchDiscord(`/guilds/${guild.id}/members/search?${paramsObj.toString()}`, token, fetcher);
|
|
88
|
+
const members = await fetchDiscord(`/guilds/${guild.id}/members/search?${paramsObj.toString()}`, token, fetcher, { timeoutMs: DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS });
|
|
89
89
|
for (const member of members) {
|
|
90
90
|
const score = scoreDiscordMember(member, query);
|
|
91
91
|
if (score === 0) continue;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Ut as resolveDiscordChannelId } from "./send.receipt-
|
|
1
|
+
import { Ut as resolveDiscordChannelId } from "./send.receipt-Cli6_9Sn.js";
|
|
2
2
|
import { a as mergeDiscordAccountConfig, o as resolveDefaultDiscordAccountId, t as createDiscordActionGate } from "./accounts-P19jm1lf.js";
|
|
3
|
-
import { d as readDiscordComponentSpec } from "./components-
|
|
4
|
-
import { _ as withNormalizedTimestamp, c as jsonResult, d as readNonNegativeIntegerParam, f as readPositiveIntegerParam, g as resolvePollMaxSelections, h as readStringParam, l as parseAvailableTags, m as readStringArrayParam, p as readReactionParams, r as sendDiscordComponentMessage, s as assertMediaNotDataUrl, u as readBooleanParam } from "./send.components-
|
|
3
|
+
import { d as readDiscordComponentSpec } from "./components-_s5UPJqU.js";
|
|
4
|
+
import { _ as withNormalizedTimestamp, c as jsonResult, d as readNonNegativeIntegerParam, f as readPositiveIntegerParam, g as resolvePollMaxSelections, h as readStringParam, l as parseAvailableTags, m as readStringArrayParam, p as readReactionParams, r as sendDiscordComponentMessage, s as assertMediaNotDataUrl, u as readBooleanParam } from "./send.components-COkDUO3B.js";
|
|
5
5
|
import { n as getPresence } from "./presence-cache-z1N8MbJ3.js";
|
|
6
|
-
import { D as canManageGuildRoleDiscord, E as canManageGuildMemberRoleDiscord, G as getGateway, M as hasAnyChannelPermissionDiscord, N as hasAnyGuildPermissionDiscord, P as isThreadChannelType$1, R as createDiscordRuntimeAccountContext, d as resolveDiscordTargetChannelId, k as fetchChannelPermissionsDiscord } from "./send.shared-
|
|
6
|
+
import { D as canManageGuildRoleDiscord, E as canManageGuildMemberRoleDiscord, G as getGateway, M as hasAnyChannelPermissionDiscord, N as hasAnyGuildPermissionDiscord, P as isThreadChannelType$1, R as createDiscordRuntimeAccountContext, d as resolveDiscordTargetChannelId, k as fetchChannelPermissionsDiscord } from "./send.shared-BCG7MWnP.js";
|
|
7
7
|
import { a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, n as isDiscordGroupAllowedByPolicy } from "./allow-list-C-MqM-B_.js";
|
|
8
|
-
import { A as listScheduledEventsDiscord, B as moveChannelDiscord, C as fetchChannelInfoDiscord, D as fetchVoiceStatusDiscord, E as fetchRoleInfoDiscord, F as uploadEmojiDiscord, H as setChannelPermissionDiscord, I as uploadStickerDiscord, L as createChannelDiscord, M as resolveEventCoverImage, N as timeoutMemberDiscord, O as kickMemberDiscord, P as listGuildEmojisDiscord, R as deleteChannelDiscord, S as createScheduledEventDiscord, T as fetchMemberInfoDiscord, V as removeChannelPermissionDiscord, _ as readMessagesDiscord, a as removeReactionDiscord, b as addRoleDiscord, d as deleteMessageDiscord, f as editMessageDiscord, g as pinMessageDiscord, h as listThreadsDiscord, i as removeOwnReactionsDiscord, j as removeRoleDiscord, k as listGuildChannelsDiscord, l as DiscordThreadInitialMessageError, m as listPinsDiscord, n as fetchReactionsDiscord, p as fetchMessageDiscord, r as reactMessageDiscord, s as sendVoiceMessageDiscord, u as createThreadDiscord, v as searchMessagesDiscord, w as fetchGuildInfoDiscord, x as banMemberDiscord, y as unpinMessageDiscord, z as editChannelDiscord } from "./send-
|
|
9
|
-
import { n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-
|
|
10
|
-
import "./targets-
|
|
8
|
+
import { A as listScheduledEventsDiscord, B as moveChannelDiscord, C as fetchChannelInfoDiscord, D as fetchVoiceStatusDiscord, E as fetchRoleInfoDiscord, F as uploadEmojiDiscord, H as setChannelPermissionDiscord, I as uploadStickerDiscord, L as createChannelDiscord, M as resolveEventCoverImage, N as timeoutMemberDiscord, O as kickMemberDiscord, P as listGuildEmojisDiscord, R as deleteChannelDiscord, S as createScheduledEventDiscord, T as fetchMemberInfoDiscord, V as removeChannelPermissionDiscord, _ as readMessagesDiscord, a as removeReactionDiscord, b as addRoleDiscord, d as deleteMessageDiscord, f as editMessageDiscord, g as pinMessageDiscord, h as listThreadsDiscord, i as removeOwnReactionsDiscord, j as removeRoleDiscord, k as listGuildChannelsDiscord, l as DiscordThreadInitialMessageError, m as listPinsDiscord, n as fetchReactionsDiscord, p as fetchMessageDiscord, r as reactMessageDiscord, s as sendVoiceMessageDiscord, u as createThreadDiscord, v as searchMessagesDiscord, w as fetchGuildInfoDiscord, x as banMemberDiscord, y as unpinMessageDiscord, z as editChannelDiscord } from "./send-Bb295iHT.js";
|
|
9
|
+
import { n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-B_sk0hNe.js";
|
|
10
|
+
import "./targets-Q-ZoP7K4.js";
|
|
11
11
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
12
|
import { ChannelType, PermissionFlagsBits } from "discord-api-types/v10";
|
|
13
13
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as readDiscordChannelCreateParams, c as readDiscordParentIdParam, i as requiredGuildPermissionForModerationAction, n as isDiscordModerationAction, o as readDiscordChannelEditParams, r as readDiscordModerationCommand, s as readDiscordChannelMoveParams, t as handleDiscordAction } from "./runtime-
|
|
2
|
-
import { t as discordMessageActions } from "./channel-actions-
|
|
1
|
+
import { a as readDiscordChannelCreateParams, c as readDiscordParentIdParam, i as requiredGuildPermissionForModerationAction, n as isDiscordModerationAction, o as readDiscordChannelEditParams, r as readDiscordModerationCommand, s as readDiscordChannelMoveParams, t as handleDiscordAction } from "./runtime-CF7ramAs.js";
|
|
2
|
+
import { t as discordMessageActions } from "./channel-actions-JziPEcBU.js";
|
|
3
3
|
export { discordMessageActions, handleDiscordAction, isDiscordModerationAction, readDiscordChannelCreateParams, readDiscordChannelEditParams, readDiscordChannelMoveParams, readDiscordModerationCommand, readDiscordParentIdParam, requiredGuildPermissionForModerationAction };
|