@openclaw/discord 2026.9.1-beta.1 → 2026.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account-inspect-BY-ve3yH.js +45 -0
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-CfQ-vSyf.js → accounts-CwJQoLjM.js} +89 -45
- package/dist/action-runtime-api.js +1 -1
- package/dist/{activities-api-q-9PaaHH.js → activities-api-CTcGq3Hf.js} +30 -17
- package/dist/activities-api.js +1 -1
- package/dist/{allow-list-BDMimASD.js → allow-list-DBTtR2dz.js} +13 -35
- package/dist/{api-DNVbJyEy.js → api-BfmEP6wp.js} +6 -5
- package/dist/api.js +18 -18
- package/dist/{approval-handler.runtime-B7qhK3fR.js → approval-handler.runtime-DUSe5fyH.js} +19 -12
- package/dist/{audit-CBEv_ERu.js → audit-DpPfwoJM.js} +8 -7
- package/dist/{channel-Dx1tMTfx.js → channel-BHajPgwR.js} +29 -23
- package/dist/{channel-actions.runtime-CLWWu9nC.js → channel-actions.runtime-DS8pXo0S.js} +38 -38
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-DOzXS2Pk.js → channel.setup-BWmMe1tT.js} +18 -18
- package/dist/command-owners-D78sAoOz.js +10 -0
- package/dist/{components-B9V5o361.js → components-BimX47Mq.js} +111 -149
- package/dist/{config-schema-BR13IAx6.js → config-schema-B797-Spt.js} +19 -12
- package/dist/{conversation-binding-route-DJYrY2TQ.js → conversation-binding-route-DuR5NGIx.js} +1 -1
- package/dist/{directory-config-BK6eqekJ.js → directory-config-CD2v2Szs.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-DSAJSrJk.js → directory-live-DaJzWJ2N.js} +4 -4
- package/dist/{doctor-Cm7Y1pJ2.js → doctor-D4HH1inA.js} +9 -6
- package/dist/{doctor-contract-DsWvKIXF.js → doctor-contract-Co5vRCZ6.js} +9 -6
- package/dist/doctor-contract-api.js +31 -28
- package/dist/{handle-action.guild-admin-BdwCRHmm.js → handle-action.guild-admin-4We6wWQU.js} +6 -3
- package/dist/index.js +1 -1
- package/dist/ingress-identity-XNmW-mZS.js +60 -0
- package/dist/{message-handler-BXpWZyni.js → message-handler-DhgBabyU.js} +61 -70
- package/dist/{message-handler.preflight-Ba5LAY_X.js → message-handler.preflight-oZ7dQCd0.js} +41 -101
- package/dist/{message-handler.process-3HEzmemS.js → message-handler.process-BzCYf1pa.js} +82 -108
- package/dist/{message-text-aiwO5R2F.js → message-text-DK4NnBg-.js} +11 -6
- package/dist/{outbound-adapter-BE4jSq2d.js → outbound-adapter-CtggmGh9.js} +52 -67
- package/dist/{outbound-components-oLpg8Qzb.js → outbound-components-Dn8SJWMS.js} +5 -4
- package/dist/{outbound-session-route-Cg15ZFJd.js → outbound-session-route-Q_HEusBQ.js} +57 -15
- package/dist/{owner-access-UlYi9t0M.js → owner-access-Cp8r6Ipf.js} +9 -7
- package/dist/{pluralkit-Tiyl70dx.js → pluralkit-BY75YcK0.js} +2 -2
- package/dist/{probe-n6ZXxK8V.js → probe-3ovFAp3b.js} +3 -3
- package/dist/{probe.runtime-CN4bdPfZ.js → probe.runtime-BckHn3cJ.js} +1 -1
- package/dist/{provider-session.runtime-B9xe-Qaf.js → provider-session.runtime-BL2lHBH7.js} +3 -3
- package/dist/{provider-B11xwilq.js → provider-uKmmrDM4.js} +299 -136
- package/dist/provider.runtime-C-IkWF2w.js +2 -0
- package/dist/{realtime-session.runtime-CU8IQUS-.js → realtime-session.runtime-CGYm1t_0.js} +798 -448
- package/dist/{resolve-allowlist-common-BLoYaxEG.js → resolve-allowlist-common-sKIKy-cF.js} +3 -3
- package/dist/{resolve-channels-C2sT_n67.js → resolve-channels-CoiMlWy0.js} +4 -4
- package/dist/{resolve-users-CzpjLwjy.js → resolve-users-DJpiokfW.js} +5 -4
- package/dist/{retry-Cv4jCU5Z.js → retry-DQt1zDgH.js} +356 -214
- package/dist/{retry-after-DdLPmPoa.js → retry-after-BrLjLUJi.js} +2 -1
- package/dist/{runtime-CY4PRMF-.js → runtime-BHsdEdr5.js} +2 -2
- package/dist/{runtime-BHrTlFkf.js → runtime-Ghtfh5ZA.js} +151 -109
- package/dist/runtime-api.js +20 -20
- package/dist/{secret-config-contract-B3i6WxV5.js → secret-config-contract-DFu9hfU8.js} +14 -6
- package/dist/secret-contract-api.js +1 -1
- package/dist/{security-audit-BfJhAXZp.js → security-audit-DKfK-iPY.js} +10 -11
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/{security-audit.runtime-BVKF9VtY.js → security-audit.runtime-sKZyKgpx.js} +1 -1
- package/dist/{send-C49MFF9j.js → send-CZeWKUiA.js} +132 -100
- package/dist/{send.components-DKKAw5VX.js → send.components-BG5IDABj.js} +21 -15
- package/dist/{send.outbound-zam0TrZx.js → send.outbound-DHuFUL6W.js} +42 -63
- package/dist/{send.shared-JjljcV4O.js → send.shared-B0n_fWzu.js} +77 -149
- package/dist/{sender-identity-BJtfyise.js → sender-identity-B8Ncfi63.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-_5EcP4jW.js → shared-C3dKun_X.js} +24 -15
- package/dist/{subagent-hooks-DQzvOptn.js → subagent-hooks-ZoQXEI1E.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{system-events-C7yxaHWP.js → system-events-DFF_awl7.js} +2 -2
- package/dist/{target-resolver-vxIh6O3-.js → target-resolver-DLtHDwMK.js} +6 -5
- package/dist/targets-BObRyaKX.js +3 -0
- package/dist/{thread-bindings-DW5F9vat.js → thread-bindings-DKvsNjQR.js} +7 -6
- package/dist/{thread-bindings.manager-ByOtwjo_.js → thread-bindings.manager-pbbRT5gb.js} +38 -29
- package/dist/{thread-bindings.session-updates-CJb-BpPL.js → thread-bindings.session-updates-t6jeFB1-.js} +3 -2
- package/dist/{thread-bindings.state-D8OMdk4O.js → thread-bindings.state-DtgOqsbX.js} +34 -1
- package/dist/{threading-agH1T_6s.js → threading-BCx49X-6.js} +8 -6
- package/dist/{timeouts-B9cy6RvQ.js → timeouts-D86uWLt_.js} +1 -1
- package/dist/{transcripts-source-BR11iHA4.js → transcripts-source-Dc6Nnli5.js} +55 -7
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-Dc_YMY2e.js → typing-CuopV-Hi.js} +2 -2
- package/dist/{voice-runtime-DIeaa8fJ.js → voice-runtime-BQnILUbG.js} +492 -105
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/README.md +1 -1
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/conforms.d.ts +2 -0
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/package.json +3 -3
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubArray.d.ts +2 -0
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubObject.d.ts +2 -0
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubString.d.ts +2 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/README.md +1 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/buffer.buffer.d.ts +5 -5
- package/node_modules/@discordjs/voice/node_modules/@types/node/crypto.d.ts +2 -2
- package/node_modules/@discordjs/voice/node_modules/@types/node/http.d.ts +16 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/http2.d.ts +10 -2
- package/node_modules/@discordjs/voice/node_modules/@types/node/package.json +2 -2
- package/node_modules/@discordjs/voice/node_modules/@types/node/process.d.ts +52 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/quic.d.ts +210 -28
- package/node_modules/@discordjs/voice/node_modules/@types/node/sqlite.d.ts +6 -2
- package/node_modules/@discordjs/voice/node_modules/@types/node/test.d.ts +36 -0
- package/node_modules/typebox/build/format/email.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
- package/node_modules/typebox/build/format/json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/json_pointer.mjs +2 -2
- package/node_modules/typebox/build/format/json_pointer_uri_fragment.d.mts +2 -2
- package/node_modules/typebox/build/format/json_pointer_uri_fragment.mjs +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
- package/node_modules/typebox/build/system/memory/assign.mjs +2 -1
- package/node_modules/typebox/build/system/memory/create.mjs +3 -4
- package/node_modules/typebox/build/system/memory/discard.mjs +2 -2
- package/node_modules/typebox/build/system/memory/freeze.d.mts +4 -0
- package/node_modules/typebox/build/system/memory/freeze.mjs +6 -0
- package/node_modules/typebox/build/system/memory/update.mjs +3 -2
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/undici/docs/docs/api/Client.md +4 -0
- package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +3 -2
- package/node_modules/undici/docs/docs/api/EventSource.md +4 -0
- package/node_modules/undici/docs/docs/api/Interceptors.md +7 -3
- package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +7 -1
- package/node_modules/undici/lib/cache/memory-cache-store.js +2 -2
- package/node_modules/undici/lib/core/symbols.js +2 -0
- package/node_modules/undici/lib/dispatcher/agent.js +7 -2
- package/node_modules/undici/lib/dispatcher/balanced-pool.js +7 -4
- package/node_modules/undici/lib/dispatcher/client-h1.js +12 -4
- package/node_modules/undici/lib/dispatcher/client-h2.js +43 -3
- package/node_modules/undici/lib/dispatcher/client.js +3 -2
- 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 +10 -3
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -1
- 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 +91 -21
- package/node_modules/undici/lib/handler/cache-handler.js +29 -5
- 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 +21 -4
- package/node_modules/undici/lib/handler/retry-handler.js +148 -30
- package/node_modules/undici/lib/interceptor/cache.js +65 -12
- package/node_modules/undici/lib/interceptor/decompress.js +115 -13
- 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-utils.js +11 -10
- package/node_modules/undici/lib/util/cache.js +45 -3
- package/node_modules/undici/lib/web/cookies/parse.js +150 -147
- 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/fetch/index.js +6 -0
- package/node_modules/undici/lib/web/fetch/request.js +2 -3
- package/node_modules/undici/lib/web/fetch/util.js +6 -1
- 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/package.json +3 -3
- package/node_modules/undici/types/client.d.ts +10 -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/socks5-proxy-agent.d.ts +2 -0
- package/openclaw.plugin.json +15 -8
- package/package.json +7 -6
- package/skills/discord/SKILL.md +1 -1
- package/dist/account-inspect-BDfKyuvL.js +0 -89
- package/dist/provider.runtime-DiYaHvOz.js +0 -2
- package/dist/sdk-runtime-4geQHtXc.js +0 -338
- package/dist/targets-CtTKvntJ.js +0 -3
package/dist/{handle-action.guild-admin-BdwCRHmm.js → handle-action.guild-admin-4We6wWQU.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as readDiscordChannelMoveParams, n as isDiscordModerationAction, o as readDiscordChannelCreateParams, r as readDiscordModerationCommand, s as readDiscordChannelEditParams, t as handleDiscordAction } from "./runtime-
|
|
1
|
+
import { c as readDiscordChannelMoveParams, n as isDiscordModerationAction, o as readDiscordChannelCreateParams, r as readDiscordModerationCommand, s as readDiscordChannelEditParams, t as handleDiscordAction } from "./runtime-Ghtfh5ZA.js";
|
|
2
2
|
import "./action-runtime-api.js";
|
|
3
|
-
import { m as isTrustedRequesterGuildAdminAction } from "./outbound-session-route-
|
|
3
|
+
import { m as isTrustedRequesterGuildAdminAction } from "./outbound-session-route-Q_HEusBQ.js";
|
|
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/agent-runtime";
|
|
@@ -276,7 +276,10 @@ async function tryHandleDiscordMessageActionGuildAdmin(params) {
|
|
|
276
276
|
}, cfg, readPolicyOptions);
|
|
277
277
|
}
|
|
278
278
|
if (action === "thread-reply") {
|
|
279
|
-
const content = readStringParam(actionParams, "message", {
|
|
279
|
+
const content = readStringParam(actionParams, "message", {
|
|
280
|
+
required: true,
|
|
281
|
+
trim: false
|
|
282
|
+
});
|
|
280
283
|
const mediaUrl = readStringParam(actionParams, "media", { trim: false }) ?? readStringParam(actionParams, "path", { trim: false }) ?? readStringParam(actionParams, "filePath", { trim: false });
|
|
281
284
|
const replyTo = readStringParam(actionParams, "replyTo");
|
|
282
285
|
const channelId = readStringParam(actionParams, "threadId") ?? resolveChannelId();
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as registerDiscordActivities } from "./activities-api-
|
|
1
|
+
import { t as registerDiscordActivities } from "./activities-api-CTcGq3Hf.js";
|
|
2
2
|
import { registerDiscordSubagentHooks } from "./subagent-hooks-api.js";
|
|
3
3
|
import { registerDiscordTranscriptSourceProvider } from "./transcripts-source-api.js";
|
|
4
4
|
import { defineBundledChannelEntry } from "openclaw/plugin-sdk/channel-entry-contract";
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { r as normalizeDiscordAllowList } from "./allow-list-DBTtR2dz.js";
|
|
2
|
+
import { defineStableChannelIngressIdentity } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
3
|
+
//#region extensions/discord/src/monitor/ingress-identity.ts
|
|
4
|
+
const DISCORD_ALLOW_LIST_PREFIXES = [
|
|
5
|
+
"discord:",
|
|
6
|
+
"user:",
|
|
7
|
+
"pk:"
|
|
8
|
+
];
|
|
9
|
+
const DISCORD_USER_ID_KIND = "stable-id";
|
|
10
|
+
const DISCORD_USER_NAME_KIND = "username";
|
|
11
|
+
function normalizeDiscordIdEntry(entry) {
|
|
12
|
+
const text = entry.trim();
|
|
13
|
+
if (!text) return null;
|
|
14
|
+
const maybeId = text.replace(/^<@!?/, "").replace(/>$/, "");
|
|
15
|
+
if (/^\d+$/.test(maybeId)) return maybeId;
|
|
16
|
+
const prefix = DISCORD_ALLOW_LIST_PREFIXES.find((entryPrefix) => text.startsWith(entryPrefix));
|
|
17
|
+
if (prefix) return text.slice(prefix.length).trim() || null;
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
function normalizeDiscordNameEntry(entry) {
|
|
21
|
+
const text = entry.trim();
|
|
22
|
+
if (!text || text === "*" || normalizeDiscordIdEntry(text) || /#\d{4}$/.test(text)) return null;
|
|
23
|
+
const nameSlug = normalizeDiscordAllowList([text], DISCORD_ALLOW_LIST_PREFIXES)?.names.values().next().value;
|
|
24
|
+
return typeof nameSlug === "string" && nameSlug ? nameSlug : null;
|
|
25
|
+
}
|
|
26
|
+
function normalizeDiscordTagEntry(entry) {
|
|
27
|
+
const text = entry.trim();
|
|
28
|
+
return /#\d{4}$/.test(text) ? normalizeDiscordNameSubject(text) : null;
|
|
29
|
+
}
|
|
30
|
+
function normalizeDiscordNameSubject(value) {
|
|
31
|
+
const nameSlug = normalizeDiscordAllowList([value], DISCORD_ALLOW_LIST_PREFIXES)?.names.values().next().value;
|
|
32
|
+
return typeof nameSlug === "string" && nameSlug ? nameSlug : null;
|
|
33
|
+
}
|
|
34
|
+
const discordIngressIdentity = defineStableChannelIngressIdentity({
|
|
35
|
+
resolveParticipant: (subject) => {
|
|
36
|
+
const kind = subject.aliases?.participantKind;
|
|
37
|
+
const id = subject.stableId;
|
|
38
|
+
return typeof id === "string" && id && (kind === "user" || kind === "bot" || kind === "pluralkit-member") ? {
|
|
39
|
+
domain: kind === "pluralkit-member" ? "pluralkit" : "discord",
|
|
40
|
+
idKind: kind,
|
|
41
|
+
id
|
|
42
|
+
} : void 0;
|
|
43
|
+
},
|
|
44
|
+
key: "discordUserId",
|
|
45
|
+
kind: DISCORD_USER_ID_KIND,
|
|
46
|
+
authentication: "verified",
|
|
47
|
+
normalizeEntry: normalizeDiscordIdEntry,
|
|
48
|
+
normalizeSubject: (value) => value.trim() || null,
|
|
49
|
+
sensitivity: "pii",
|
|
50
|
+
aliases: [["discordUserName", normalizeDiscordNameEntry], ["discordUserTag", normalizeDiscordTagEntry]].map(([key, normalizeEntry]) => ({
|
|
51
|
+
key,
|
|
52
|
+
kind: DISCORD_USER_NAME_KIND,
|
|
53
|
+
normalizeEntry,
|
|
54
|
+
normalizeSubject: normalizeDiscordNameSubject,
|
|
55
|
+
authentication: "mutable",
|
|
56
|
+
sensitivity: "pii"
|
|
57
|
+
}))
|
|
58
|
+
});
|
|
59
|
+
//#endregion
|
|
60
|
+
export { discordIngressIdentity as t };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
2
|
-
import { c as resolveDiscordChannelInfoSafe, d as resolveDiscordChannelParentSafe, l as resolveDiscordChannelNameSafe, s as resolveDiscordChannelIdSafe } from "./thread-bindings.manager-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { c as resolveDiscordChannelInfoSafe, d as resolveDiscordChannelParentSafe, l as resolveDiscordChannelNameSafe, s as resolveDiscordChannelIdSafe } from "./thread-bindings.manager-pbbRT5gb.js";
|
|
3
|
+
import { v as mapGatewayDispatchData } from "./provider-uKmmrDM4.js";
|
|
4
|
+
import { f as resolveDiscordReferencedReplyMessageId, h as resolveDiscordMessageChannelId, i as resolveDiscordMessageText, l as hasDiscordMessageStickers, p as resolveDiscordCdnPolicy } from "./message-text-DK4NnBg-.js";
|
|
5
5
|
import { logDebug } from "openclaw/plugin-sdk/logging-core";
|
|
6
6
|
import { GatewayDispatchEvents } from "discord-api-types/v10";
|
|
7
7
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
8
8
|
import { normalizeNullableString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
|
+
import { createRuntimeConfigReader } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
9
10
|
import { danger } from "openclaw/plugin-sdk/runtime-env";
|
|
10
11
|
import { resolveBatchedReplyThreadingPolicy } from "openclaw/plugin-sdk/reply-reference";
|
|
11
12
|
import { DEFAULT_INGRESS_RETRY_MAX_ATTEMPTS, createChannelIngressError, createChannelIngressMonitor, createChannelRunQueue } from "openclaw/plugin-sdk/channel-outbound";
|
|
@@ -13,7 +14,7 @@ import { saveRemoteMedia } from "openclaw/plugin-sdk/media-runtime";
|
|
|
13
14
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
14
15
|
import { resolveOpenProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
15
16
|
import { fanInChannelIngressLifecycles } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
16
|
-
import { createChannelInboundDebouncer, shouldDebounceTextInbound } from "openclaw/plugin-sdk/channel-inbound";
|
|
17
|
+
import { createChannelInboundDebouncer, resolveInboundDebounceMs, shouldDebounceTextInbound } from "openclaw/plugin-sdk/channel-inbound";
|
|
17
18
|
//#region extensions/discord/src/monitor/ingress.ts
|
|
18
19
|
const DISCORD_INGRESS_PAYLOAD_VERSION = 1;
|
|
19
20
|
const DISCORD_INGRESS_DRAIN_INTERVAL_MS = 1e3;
|
|
@@ -58,8 +59,9 @@ function isDiscordAuthenticationFailure(error) {
|
|
|
58
59
|
return false;
|
|
59
60
|
}
|
|
60
61
|
function createDiscordIngressMonitor(params) {
|
|
62
|
+
const queue = params.queue ?? getDiscordRuntime().state.openChannelIngressQueue({ accountId: params.accountId });
|
|
61
63
|
const monitor = createChannelIngressMonitor({
|
|
62
|
-
queue
|
|
64
|
+
queue,
|
|
63
65
|
inspect: inspectDiscordMessage,
|
|
64
66
|
payload: {
|
|
65
67
|
version: DISCORD_INGRESS_PAYLOAD_VERSION,
|
|
@@ -170,9 +172,9 @@ function normalizeDiscordThreadChannel(threadChannel) {
|
|
|
170
172
|
}
|
|
171
173
|
//#endregion
|
|
172
174
|
//#region extensions/discord/src/monitor/message-avatar.ts
|
|
173
|
-
const DISCORD_AVATAR_MAX_BYTES =
|
|
175
|
+
const DISCORD_AVATAR_MAX_BYTES = 262144;
|
|
174
176
|
const DISCORD_AVATAR_CACHE_MAX_ENTRIES = 128;
|
|
175
|
-
const DISCORD_GUILD_ICON_TTL_MS =
|
|
177
|
+
const DISCORD_GUILD_ICON_TTL_MS = 3e5;
|
|
176
178
|
function setBoundedEntry(map, key, value) {
|
|
177
179
|
map.delete(key);
|
|
178
180
|
map.set(key, value);
|
|
@@ -248,7 +250,7 @@ function applyImplicitReplyBatchGate(ctx, replyToMode, isBatched) {
|
|
|
248
250
|
}
|
|
249
251
|
//#endregion
|
|
250
252
|
//#region extensions/discord/src/monitor/message-run-queue.ts
|
|
251
|
-
const loadMessageProcessRuntime = createLazyRuntimeModule(() => import("./message-handler.process-
|
|
253
|
+
const loadMessageProcessRuntime = createLazyRuntimeModule(() => import("./message-handler.process-BzCYf1pa.js"));
|
|
252
254
|
async function processDiscordQueuedMessage(params) {
|
|
253
255
|
const abortSignal = params.job.runtime.abortSignal && params.lifecycleSignal ? AbortSignal.any([params.job.runtime.abortSignal, params.lifecycleSignal]) : params.job.runtime.abortSignal ?? params.lifecycleSignal;
|
|
254
256
|
try {
|
|
@@ -335,7 +337,7 @@ function createDiscordMessageRunQueue(params) {
|
|
|
335
337
|
}
|
|
336
338
|
//#endregion
|
|
337
339
|
//#region extensions/discord/src/monitor/message-dispatcher.ts
|
|
338
|
-
const loadMessagePreflightRuntime = createLazyRuntimeModule(() => import("./message-handler.preflight-
|
|
340
|
+
const loadMessagePreflightRuntime = createLazyRuntimeModule(() => import("./message-handler.preflight-oZ7dQCd0.js"));
|
|
339
341
|
function isNonEmptyString(value) {
|
|
340
342
|
return typeof value === "string" && value.length > 0;
|
|
341
343
|
}
|
|
@@ -345,7 +347,7 @@ function createDiscordMessageDispatcher(params) {
|
|
|
345
347
|
groupPolicy: params.discordConfig?.groupPolicy,
|
|
346
348
|
defaultGroupPolicy: params.cfg.channels?.defaults?.groupPolicy
|
|
347
349
|
});
|
|
348
|
-
const
|
|
350
|
+
const readConfig = createRuntimeConfigReader(params.cfg);
|
|
349
351
|
const preflightDiscordMessageImpl = params.testing?.preflightDiscordMessage;
|
|
350
352
|
const messageRunQueue = createDiscordMessageRunQueue({
|
|
351
353
|
runtime: params.runtime,
|
|
@@ -365,17 +367,24 @@ function createDiscordMessageDispatcher(params) {
|
|
|
365
367
|
message,
|
|
366
368
|
eventChannelId: entry.data.channel_id
|
|
367
369
|
});
|
|
368
|
-
|
|
370
|
+
if (!channelId) return null;
|
|
371
|
+
const replyTargetId = resolveDiscordReferencedReplyMessageId(message);
|
|
372
|
+
return `discord:${params.accountId}:${channelId}:${authorId}:reply:${replyTargetId ?? "none"}`;
|
|
369
373
|
};
|
|
370
374
|
const { debouncer } = createChannelInboundDebouncer({
|
|
371
375
|
cfg: params.cfg,
|
|
372
376
|
channel: "discord",
|
|
377
|
+
resolveDebounceMs: () => resolveInboundDebounceMs({
|
|
378
|
+
cfg: readConfig(),
|
|
379
|
+
channel: "discord"
|
|
380
|
+
}),
|
|
373
381
|
buildKey: resolveDebounceKey,
|
|
374
382
|
shouldDebounce: (entry) => {
|
|
375
383
|
const message = entry.data.message;
|
|
376
384
|
if (!message) return false;
|
|
385
|
+
const baseText = resolveDiscordMessageText(message, { includeForwarded: false });
|
|
377
386
|
return shouldDebounceTextInbound({
|
|
378
|
-
text:
|
|
387
|
+
text: baseText,
|
|
379
388
|
cfg: params.cfg,
|
|
380
389
|
hasMedia: message.attachments && message.attachments.length > 0 || hasDiscordMessageStickers(message)
|
|
381
390
|
});
|
|
@@ -394,69 +403,51 @@ function createDiscordMessageDispatcher(params) {
|
|
|
394
403
|
return;
|
|
395
404
|
}
|
|
396
405
|
try {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
406
|
+
const cfg = readConfig();
|
|
407
|
+
let data = last.data;
|
|
408
|
+
if (entries.length > 1) {
|
|
409
|
+
const combinedBaseText = entries.map((entry) => resolveDiscordMessageText(entry.data.message, { includeForwarded: false })).filter(Boolean).join("\n");
|
|
410
|
+
const syntheticMessage = Object.create(Object.getPrototypeOf(last.data.message), {
|
|
411
|
+
...Object.getOwnPropertyDescriptors(last.data.message),
|
|
412
|
+
content: {
|
|
413
|
+
value: combinedBaseText,
|
|
414
|
+
enumerable: true,
|
|
415
|
+
configurable: true
|
|
416
|
+
},
|
|
417
|
+
attachments: {
|
|
418
|
+
value: [],
|
|
419
|
+
enumerable: true,
|
|
420
|
+
configurable: true
|
|
421
|
+
},
|
|
422
|
+
message_snapshots: {
|
|
423
|
+
value: last.data.message.message_snapshots,
|
|
424
|
+
enumerable: true,
|
|
425
|
+
configurable: true
|
|
426
|
+
},
|
|
427
|
+
messageSnapshots: {
|
|
428
|
+
value: last.data.message.messageSnapshots,
|
|
429
|
+
enumerable: true,
|
|
430
|
+
configurable: true
|
|
431
|
+
},
|
|
432
|
+
rawData: {
|
|
433
|
+
value: { ...last.data.message.rawData },
|
|
434
|
+
enumerable: true,
|
|
435
|
+
configurable: true
|
|
436
|
+
}
|
|
407
437
|
});
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
}
|
|
412
|
-
if (!ctx) {
|
|
413
|
-
await ingress.settle();
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
applyImplicitReplyBatchGate(ctx, params.replyToMode, false);
|
|
417
|
-
messageRunQueue.enqueue(buildDiscordInboundJob(ctx, { ingressSettlement: ingress }));
|
|
418
|
-
return;
|
|
438
|
+
data = {
|
|
439
|
+
...last.data,
|
|
440
|
+
message: syntheticMessage
|
|
441
|
+
};
|
|
419
442
|
}
|
|
420
|
-
const combinedBaseText = entries.map((entry) => resolveDiscordMessageText(entry.data.message, { includeForwarded: false })).filter(Boolean).join("\n");
|
|
421
|
-
const syntheticMessage = Object.create(Object.getPrototypeOf(last.data.message), {
|
|
422
|
-
...Object.getOwnPropertyDescriptors(last.data.message),
|
|
423
|
-
content: {
|
|
424
|
-
value: combinedBaseText,
|
|
425
|
-
enumerable: true,
|
|
426
|
-
configurable: true
|
|
427
|
-
},
|
|
428
|
-
attachments: {
|
|
429
|
-
value: [],
|
|
430
|
-
enumerable: true,
|
|
431
|
-
configurable: true
|
|
432
|
-
},
|
|
433
|
-
message_snapshots: {
|
|
434
|
-
value: last.data.message.message_snapshots,
|
|
435
|
-
enumerable: true,
|
|
436
|
-
configurable: true
|
|
437
|
-
},
|
|
438
|
-
messageSnapshots: {
|
|
439
|
-
value: last.data.message.messageSnapshots,
|
|
440
|
-
enumerable: true,
|
|
441
|
-
configurable: true
|
|
442
|
-
},
|
|
443
|
-
rawData: {
|
|
444
|
-
value: { ...last.data.message.rawData },
|
|
445
|
-
enumerable: true,
|
|
446
|
-
configurable: true
|
|
447
|
-
}
|
|
448
|
-
});
|
|
449
|
-
const syntheticData = {
|
|
450
|
-
...last.data,
|
|
451
|
-
message: syntheticMessage
|
|
452
|
-
};
|
|
453
443
|
const ctx = await (preflightDiscordMessageImpl ?? (await loadMessagePreflightRuntime()).preflightDiscordMessage)({
|
|
454
444
|
...params,
|
|
445
|
+
cfg,
|
|
455
446
|
avatarResolver,
|
|
456
|
-
ackReactionScope,
|
|
447
|
+
ackReactionScope: params.discordConfig?.ackReactionScope ?? cfg.messages?.ackReactionScope ?? "group-mentions",
|
|
457
448
|
groupPolicy,
|
|
458
449
|
abortSignal,
|
|
459
|
-
data
|
|
450
|
+
data,
|
|
460
451
|
client: last.client,
|
|
461
452
|
turnAdoptionLifecycle: admissionLifecycle
|
|
462
453
|
});
|
|
@@ -468,9 +459,9 @@ function createDiscordMessageDispatcher(params) {
|
|
|
468
459
|
await ingress.settle();
|
|
469
460
|
return;
|
|
470
461
|
}
|
|
471
|
-
applyImplicitReplyBatchGate(ctx, params.replyToMode,
|
|
462
|
+
applyImplicitReplyBatchGate(ctx, params.replyToMode, entries.length > 1);
|
|
472
463
|
const ids = entries.map((entry) => entry.data.message?.id).filter(isNonEmptyString);
|
|
473
|
-
if (ids.length > 0) {
|
|
464
|
+
if (entries.length > 1 && ids.length > 0) {
|
|
474
465
|
const ctxBatch = ctx;
|
|
475
466
|
ctxBatch.MessageSids = ids;
|
|
476
467
|
ctxBatch.MessageSidFirst = ids[0];
|
package/dist/{message-handler.preflight-Ba5LAY_X.js → message-handler.preflight-oZ7dQCd0.js}
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { s as resolveDefaultDiscordAccountId } from "./accounts-
|
|
3
|
-
import {
|
|
1
|
+
import { G as Message, Mt as getChannelMessage, b as discord_exports } from "./retry-DQt1zDgH.js";
|
|
2
|
+
import { s as resolveDefaultDiscordAccountId } from "./accounts-CwJQoLjM.js";
|
|
3
|
+
import { S as resolveTimestampMs, a as normalizeDiscordSlug, b as formatDiscordUserTag, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordGuildEntry, f as resolveDiscordMemberAccessState, g as resolveDiscordShouldRequireMention, i as normalizeDiscordDisplaySlug, x as resolveDiscordSystemLocation } from "./allow-list-DBTtR2dz.js";
|
|
4
4
|
import { t as isDiscordThreadChannelType } from "./channel-type-CVLZyGYS.js";
|
|
5
|
-
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-
|
|
6
|
-
import { a as buildDiscordRoutePeer, c as resolveDiscordEffectiveRoute, f as resolveDiscordRuntimeBindingConversationId, s as resolveDiscordConversationRoute, u as resolveDiscordConversationIdentity } from "./outbound-session-route-
|
|
7
|
-
import { t as resolveDiscordConversationBindingRoute } from "./conversation-binding-route-
|
|
8
|
-
import { c as resolveDiscordChannelInfoSafe, l as resolveDiscordChannelNameSafe } from "./thread-bindings.manager-
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-
|
|
5
|
+
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-D86uWLt_.js";
|
|
6
|
+
import { a as buildDiscordRoutePeer, c as resolveDiscordEffectiveRoute, f as resolveDiscordRuntimeBindingConversationId, s as resolveDiscordConversationRoute, u as resolveDiscordConversationIdentity } from "./outbound-session-route-Q_HEusBQ.js";
|
|
7
|
+
import { t as resolveDiscordConversationBindingRoute } from "./conversation-binding-route-DuR5NGIx.js";
|
|
8
|
+
import { c as resolveDiscordChannelInfoSafe, l as resolveDiscordChannelNameSafe } from "./thread-bindings.manager-pbbRT5gb.js";
|
|
9
|
+
import { S as resolveDiscordTextCommandAccess, _ as handleDiscordDmCommandDecision, n as resolveDiscordPreflightChannelAccess, x as resolveDiscordDmCommandAccess } from "./provider-uKmmrDM4.js";
|
|
10
|
+
import { d as resolveDiscordReferencedReplyMessage, h as resolveDiscordMessageChannelId, i as resolveDiscordMessageText, m as resolveDiscordChannelInfo, o as resolveForwardedMediaList, r as resolveDiscordMessageHistoryText, s as resolveMediaList, u as resolveDiscordMessageStickers } from "./message-text-DK4NnBg-.js";
|
|
11
|
+
import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-B8Ncfi63.js";
|
|
12
12
|
import { t as createDiscordHistorySenderProvenance } from "./message-handler.history-CJOsN9w5.js";
|
|
13
13
|
import { logDebug } from "openclaw/plugin-sdk/logging-core";
|
|
14
14
|
import { MessageReferenceType, MessageType } from "discord-api-types/v10";
|
|
@@ -29,7 +29,7 @@ import { shouldHandleTextCommands } from "openclaw/plugin-sdk/command-surface";
|
|
|
29
29
|
import { createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
|
|
30
30
|
//#region extensions/discord/src/monitor/message-handler.dm-preflight.ts
|
|
31
31
|
const loadConversationRuntime$1 = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/conversation-binding-runtime"));
|
|
32
|
-
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-
|
|
32
|
+
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-CZeWKUiA.js").then((n) => n.t));
|
|
33
33
|
function resolveDiscordDmPairingSenderId(sender) {
|
|
34
34
|
return sender.isPluralKit ? `pk:${sender.id}` : sender.id;
|
|
35
35
|
}
|
|
@@ -54,7 +54,9 @@ async function resolveDiscordDmPreflightAccess(params) {
|
|
|
54
54
|
sender: {
|
|
55
55
|
id: params.sender.id,
|
|
56
56
|
name: params.sender.name,
|
|
57
|
-
tag: params.sender.tag
|
|
57
|
+
tag: params.sender.tag,
|
|
58
|
+
isPluralKit: params.sender.isPluralKit,
|
|
59
|
+
authorKind: params.author.bot ? "bot" : "user"
|
|
58
60
|
},
|
|
59
61
|
allowNameMatching: params.allowNameMatching,
|
|
60
62
|
cfg: params.preflight.cfg,
|
|
@@ -268,72 +270,6 @@ async function hydrateDiscordMessageIfNeeded(params) {
|
|
|
268
270
|
};
|
|
269
271
|
}
|
|
270
272
|
//#endregion
|
|
271
|
-
//#region extensions/discord/src/monitor/message-handler.preflight-channel-access.ts
|
|
272
|
-
function resolveDiscordPreflightChannelAccess(params) {
|
|
273
|
-
if (params.isGuildMessage && params.channelConfig?.enabled === false) {
|
|
274
|
-
logDebug(`[discord-preflight] drop: channel disabled`);
|
|
275
|
-
logVerbose(`Blocked discord channel ${params.messageChannelId} (channel disabled, ${params.channelMatchMeta})`);
|
|
276
|
-
return {
|
|
277
|
-
allowed: false,
|
|
278
|
-
channelAllowlistConfigured: false,
|
|
279
|
-
channelAllowed: false
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
const groupDmAllowed = params.isGroupDm && resolveGroupDmAllow({
|
|
283
|
-
channels: params.groupDmChannels,
|
|
284
|
-
channelId: params.messageChannelId,
|
|
285
|
-
channelName: params.displayChannelName,
|
|
286
|
-
channelSlug: params.displayChannelSlug
|
|
287
|
-
});
|
|
288
|
-
if (params.isGroupDm && !groupDmAllowed) return {
|
|
289
|
-
allowed: false,
|
|
290
|
-
channelAllowlistConfigured: false,
|
|
291
|
-
channelAllowed: false
|
|
292
|
-
};
|
|
293
|
-
const channelAllowlistConfigured = Boolean(params.guildInfo?.channels) && Object.keys(params.guildInfo?.channels ?? {}).length > 0;
|
|
294
|
-
const channelAllowed = params.channelConfig?.allowed !== false;
|
|
295
|
-
if (params.isGuildMessage && !isDiscordGroupAllowedByPolicy({
|
|
296
|
-
groupPolicy: params.groupPolicy,
|
|
297
|
-
guildAllowlisted: Boolean(params.guildInfo),
|
|
298
|
-
channelAllowlistConfigured,
|
|
299
|
-
channelAllowed
|
|
300
|
-
})) {
|
|
301
|
-
if (params.groupPolicy === "disabled") {
|
|
302
|
-
logDebug(`[discord-preflight] drop: groupPolicy disabled`);
|
|
303
|
-
logVerbose(`discord: drop guild message (groupPolicy: disabled, ${params.channelMatchMeta})`);
|
|
304
|
-
} else if (!channelAllowlistConfigured) {
|
|
305
|
-
logDebug(`[discord-preflight] drop: groupPolicy allowlist, no channel allowlist configured`);
|
|
306
|
-
logVerbose(`discord: drop guild message (groupPolicy: allowlist, no channel allowlist, ${params.channelMatchMeta})`);
|
|
307
|
-
} else {
|
|
308
|
-
logDebug(`[discord] Ignored message from channel ${params.messageChannelId} (not in guild allowlist). Add to guilds.<guildId>.channels to enable.`);
|
|
309
|
-
logVerbose(`Blocked discord channel ${params.messageChannelId} not in guild channel allowlist (groupPolicy: allowlist, ${params.channelMatchMeta})`);
|
|
310
|
-
}
|
|
311
|
-
return {
|
|
312
|
-
allowed: false,
|
|
313
|
-
channelAllowlistConfigured,
|
|
314
|
-
channelAllowed
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
if (params.isGuildMessage && params.channelConfig?.allowed === false) {
|
|
318
|
-
logDebug(`[discord-preflight] drop: channelConfig.allowed===false`);
|
|
319
|
-
logVerbose(`Blocked discord channel ${params.messageChannelId} not in guild channel allowlist (${params.channelMatchMeta})`);
|
|
320
|
-
return {
|
|
321
|
-
allowed: false,
|
|
322
|
-
channelAllowlistConfigured,
|
|
323
|
-
channelAllowed
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
if (params.isGuildMessage) {
|
|
327
|
-
logDebug(`[discord-preflight] pass: channel allowed`);
|
|
328
|
-
logVerbose(`discord: allow channel ${params.messageChannelId} (${params.channelMatchMeta})`);
|
|
329
|
-
}
|
|
330
|
-
return {
|
|
331
|
-
allowed: true,
|
|
332
|
-
channelAllowlistConfigured,
|
|
333
|
-
channelAllowed
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
//#endregion
|
|
337
273
|
//#region extensions/discord/src/monitor/message-handler.preflight-channel-context.ts
|
|
338
274
|
function resolveDiscordPreflightChannelContext(params) {
|
|
339
275
|
const threadName = params.threadChannel?.name;
|
|
@@ -479,7 +415,8 @@ function buildDiscordPreflightHistoryEntry(params) {
|
|
|
479
415
|
//#region extensions/discord/src/monitor/message-handler.preflight-logging.ts
|
|
480
416
|
function logDiscordPreflightChannelConfig(params) {
|
|
481
417
|
if (!shouldLogVerbose()) return;
|
|
482
|
-
|
|
418
|
+
const channelConfigSummary = params.channelConfig ? `allowed=${params.channelConfig.allowed} enabled=${params.channelConfig.enabled ?? "unset"} requireMention=${params.channelConfig.requireMention ?? "unset"} ignoreOtherMentions=${params.channelConfig.ignoreOtherMentions ?? "unset"} matchKey=${params.channelConfig.matchKey ?? "none"} matchSource=${params.channelConfig.matchSource ?? "none"} users=${params.channelConfig.users?.length ?? 0} roles=${params.channelConfig.roles?.length ?? 0} skills=${params.channelConfig.skills?.length ?? 0}` : "none";
|
|
419
|
+
logDebug(`[discord-preflight] channelConfig=${channelConfigSummary} channelMatchMeta=${params.channelMatchMeta} channelId=${params.channelId}`);
|
|
483
420
|
}
|
|
484
421
|
function logDiscordPreflightInboundSummary(params) {
|
|
485
422
|
if (!shouldLogVerbose()) return;
|
|
@@ -487,13 +424,10 @@ function logDiscordPreflightInboundSummary(params) {
|
|
|
487
424
|
}
|
|
488
425
|
//#endregion
|
|
489
426
|
//#region extensions/discord/src/monitor/message-handler.preflight-runtime.ts
|
|
490
|
-
const loadPluralKitRuntime = createLazyRuntimeModule(() => import("./pluralkit-
|
|
427
|
+
const loadPluralKitRuntime = createLazyRuntimeModule(() => import("./pluralkit-BY75YcK0.js").then((n) => n.n));
|
|
491
428
|
const loadPreflightAudioRuntime = createLazyRuntimeModule(() => import("./preflight-audio-DrnqFA8U.js"));
|
|
492
|
-
const loadSystemEventsRuntime = createLazyRuntimeModule(() => import("./system-events-
|
|
493
|
-
const loadDiscordThreadingRuntime = createLazyRuntimeModule(() => import("./threading-
|
|
494
|
-
function isPreflightAborted(abortSignal) {
|
|
495
|
-
return Boolean(abortSignal?.aborted);
|
|
496
|
-
}
|
|
429
|
+
const loadSystemEventsRuntime = createLazyRuntimeModule(() => import("./system-events-DFF_awl7.js"));
|
|
430
|
+
const loadDiscordThreadingRuntime = createLazyRuntimeModule(() => import("./threading-BCx49X-6.js").then((n) => n.t));
|
|
497
431
|
//#endregion
|
|
498
432
|
//#region extensions/discord/src/monitor/message-handler.preflight-pluralkit.ts
|
|
499
433
|
async function resolveDiscordPreflightPluralKitInfo(params) {
|
|
@@ -505,7 +439,7 @@ async function resolveDiscordPreflightPluralKitInfo(params) {
|
|
|
505
439
|
config: params.config,
|
|
506
440
|
signal: params.abortSignal
|
|
507
441
|
});
|
|
508
|
-
return
|
|
442
|
+
return params.abortSignal?.aborted ? null : info;
|
|
509
443
|
} catch (err) {
|
|
510
444
|
logVerbose(`discord: pluralkit lookup failed for ${params.message.id}: ${String(err)}`);
|
|
511
445
|
return null;
|
|
@@ -527,7 +461,7 @@ async function resolveDiscordPreflightThreadContext(params) {
|
|
|
527
461
|
threadChannel: earlyThreadChannel,
|
|
528
462
|
channelInfo: params.channelInfo
|
|
529
463
|
});
|
|
530
|
-
if (
|
|
464
|
+
if (params.abortSignal?.aborted) return null;
|
|
531
465
|
return {
|
|
532
466
|
earlyThreadChannel,
|
|
533
467
|
earlyThreadParentId: parentInfo.id,
|
|
@@ -590,7 +524,7 @@ async function resolveDiscordPreflightRoute(params) {
|
|
|
590
524
|
//#endregion
|
|
591
525
|
//#region extensions/discord/src/monitor/message-handler.preflight.ts
|
|
592
526
|
const DISCORD_HISTORY_MEDIA_MAX_ATTACHMENTS = 4;
|
|
593
|
-
const DISCORD_HISTORY_MEDIA_MAX_BYTES =
|
|
527
|
+
const DISCORD_HISTORY_MEDIA_MAX_BYTES = 10485760;
|
|
594
528
|
const DISCORD_HISTORY_MEDIA_IDLE_TIMEOUT_MS = 1e3;
|
|
595
529
|
const DISCORD_HISTORY_MEDIA_TOTAL_TIMEOUT_MS = 3e3;
|
|
596
530
|
function resolveDiscordPreflightConversationKind(params) {
|
|
@@ -654,7 +588,7 @@ async function recordDiscordPendingHistoryEntry(params) {
|
|
|
654
588
|
limit: params.preflight.historyLimit,
|
|
655
589
|
mediaLimit: DISCORD_HISTORY_MEDIA_MAX_ATTACHMENTS,
|
|
656
590
|
messageId: params.message.id,
|
|
657
|
-
shouldRecord: () => !
|
|
591
|
+
shouldRecord: () => !params.preflight.abortSignal?.aborted,
|
|
658
592
|
media: async () => toHistoryMediaEntries(await resolveDiscordHistoryMediaForPendingRecord({
|
|
659
593
|
preflight: params.preflight,
|
|
660
594
|
message: params.message
|
|
@@ -662,7 +596,7 @@ async function recordDiscordPendingHistoryEntry(params) {
|
|
|
662
596
|
});
|
|
663
597
|
}
|
|
664
598
|
async function preflightDiscordMessage(params) {
|
|
665
|
-
if (
|
|
599
|
+
if (params.abortSignal?.aborted) return null;
|
|
666
600
|
const logger = getChildLogger({ module: "discord-auto-reply" });
|
|
667
601
|
let message = params.data.message;
|
|
668
602
|
const author = params.data.author;
|
|
@@ -684,7 +618,7 @@ async function preflightDiscordMessage(params) {
|
|
|
684
618
|
messageChannelId
|
|
685
619
|
});
|
|
686
620
|
message = hydration.message;
|
|
687
|
-
if (
|
|
621
|
+
if (params.abortSignal?.aborted) return null;
|
|
688
622
|
const pluralkitConfig = params.discordConfig?.pluralkit;
|
|
689
623
|
const webhookId = resolveDiscordWebhookId(message);
|
|
690
624
|
if (isRecentOutboundMessageIdentity({
|
|
@@ -699,7 +633,7 @@ async function preflightDiscordMessage(params) {
|
|
|
699
633
|
}
|
|
700
634
|
const isGuildMessage = Boolean(params.data.guild_id);
|
|
701
635
|
const channelInfo = await resolveDiscordChannelInfo(params.client, messageChannelId);
|
|
702
|
-
if (
|
|
636
|
+
if (params.abortSignal?.aborted) return null;
|
|
703
637
|
const { isDirectMessage, isGroupDm } = resolveDiscordPreflightConversationKind({
|
|
704
638
|
isGuildMessage,
|
|
705
639
|
channelType: channelInfo?.type
|
|
@@ -735,7 +669,7 @@ async function preflightDiscordMessage(params) {
|
|
|
735
669
|
config: pluralkitConfig,
|
|
736
670
|
abortSignal: params.abortSignal
|
|
737
671
|
});
|
|
738
|
-
if (
|
|
672
|
+
if (params.abortSignal?.aborted) return null;
|
|
739
673
|
const sender = resolveDiscordSenderIdentity({
|
|
740
674
|
author,
|
|
741
675
|
member: params.data.member,
|
|
@@ -776,7 +710,7 @@ async function preflightDiscordMessage(params) {
|
|
|
776
710
|
allowNameMatching,
|
|
777
711
|
conversationId: messageChannelId
|
|
778
712
|
});
|
|
779
|
-
if (
|
|
713
|
+
if (params.abortSignal?.aborted) return null;
|
|
780
714
|
if (!access) return null;
|
|
781
715
|
commandAuthorized = access.commandAuthorized;
|
|
782
716
|
channelIngress = access.channelIngress;
|
|
@@ -927,7 +861,7 @@ async function preflightDiscordMessage(params) {
|
|
|
927
861
|
cfg: params.cfg,
|
|
928
862
|
abortSignal: params.abortSignal
|
|
929
863
|
});
|
|
930
|
-
if (
|
|
864
|
+
if (params.abortSignal?.aborted) return null;
|
|
931
865
|
const mentionText = hasTypedText ? baseText : "";
|
|
932
866
|
const { implicitMentionKinds, wasMentioned } = resolveDiscordMentionState({
|
|
933
867
|
authorIsBot: Boolean(author.bot),
|
|
@@ -965,7 +899,9 @@ async function preflightDiscordMessage(params) {
|
|
|
965
899
|
sender: {
|
|
966
900
|
id: sender.id,
|
|
967
901
|
name: sender.name,
|
|
968
|
-
tag: sender.tag
|
|
902
|
+
tag: sender.tag,
|
|
903
|
+
isPluralKit: sender.isPluralKit,
|
|
904
|
+
authorKind: author.bot ? "bot" : "user"
|
|
969
905
|
},
|
|
970
906
|
memberAccessConfigured: hasAccessRestrictions,
|
|
971
907
|
memberAllowed,
|
|
@@ -1044,9 +980,13 @@ async function preflightDiscordMessage(params) {
|
|
|
1044
980
|
}
|
|
1045
981
|
}
|
|
1046
982
|
const ignoreOtherMentions = channelConfig?.ignoreOtherMentions ?? guildInfo?.ignoreOtherMentions ?? false;
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
983
|
+
const referencedReply = resolveDiscordReferencedReplyMessage(message);
|
|
984
|
+
const referencedWebhookId = referencedReply ? resolveDiscordWebhookId(referencedReply) : null;
|
|
985
|
+
const referencedAuthor = referencedReply?.author;
|
|
986
|
+
const replyTargetsOtherBot = Boolean(botId) && Boolean(referencedAuthor?.bot) && referencedAuthor?.id !== botId && !referencedWebhookId;
|
|
987
|
+
if (isGuildMessage && ignoreOtherMentions && (hasUserOrRoleMention || replyTargetsOtherBot) && !wasMentioned && !mentionDecision.implicitMention) {
|
|
988
|
+
logDebug(`[discord-preflight] drop: addressed-to-other`);
|
|
989
|
+
logVerbose(`discord: drop guild message (addressed to another identity, ignoreOtherMentions=true, botId=${botId})`);
|
|
1050
990
|
await recordDiscordPendingHistoryEntry({
|
|
1051
991
|
preflight: params,
|
|
1052
992
|
historyKey: messageChannelId,
|
|
@@ -1116,9 +1056,9 @@ async function preflightDiscordMessage(params) {
|
|
|
1116
1056
|
abortSignal: params.abortSignal
|
|
1117
1057
|
};
|
|
1118
1058
|
const preparedMedia = await resolveMediaList(message, params.mediaMaxBytes, mediaResolveOptions);
|
|
1119
|
-
if (
|
|
1059
|
+
if (params.abortSignal?.aborted) return null;
|
|
1120
1060
|
const forwardedMedia = await resolveForwardedMediaList(message, params.mediaMaxBytes, mediaResolveOptions);
|
|
1121
|
-
if (
|
|
1061
|
+
if (params.abortSignal?.aborted) return null;
|
|
1122
1062
|
preparedMedia.push(...forwardedMedia);
|
|
1123
1063
|
logDebug(`[discord-preflight] success: route=${effectiveRoute.agentId} sessionKey=${effectiveRoute.sessionKey}`);
|
|
1124
1064
|
return buildDiscordMessagePreflightContext({
|