@openclaw/discord 2026.7.2-beta.7 → 2026.8.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-inspect-SXiCBCgP.js → account-inspect-CqzrH14k.js} +48 -42
- package/dist/account-inspect-api.js +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/{active-turn-thread-route-MlKWp8RD.js → active-turn-thread-route-fmHl1HNd.js} +9 -11
- package/dist/{activities-api-DTKsuDxf.js → activities-api-DS7vpdtp.js} +4 -4
- package/dist/activities-api.js +1 -1
- package/dist/{allow-list-DzKrtfah.js → allow-list-DnxIlPP2.js} +2 -3
- package/dist/{api-DnrK9gML.js → api-DNVbJyEy.js} +7 -2
- package/dist/api.js +15 -15
- package/dist/{approval-handler.runtime-HymvFTYn.js → approval-handler.runtime-B6yEV79q.js} +5 -5
- package/dist/{approval-message-safety-DEyKVsAw.js → approval-message-safety-AcIxvrf3.js} +1 -1
- package/dist/{audit-CjsrabP8.js → audit-Db-rlntl.js} +4 -4
- package/dist/{channel-vKa-76xY.js → channel-CnnbJSt5.js} +46 -72
- package/dist/{channel-actions-uXFTJX3o.js → channel-actions-5s_hjYKd.js} +4 -4
- package/dist/{channel-actions.runtime-CIYU90sl.js → channel-actions.runtime-CLKrx6tr.js} +53 -36
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-CmcwZ_qd.js → channel.setup-BFAO-V1P.js} +15 -53
- package/dist/{config-schema-WHRQcY19.js → config-schema-BgEskFAs.js} +9 -4
- package/dist/{directory-config-D_LojtCe.js → directory-config-BVX7Cflc.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-Bw5Ephzv.js → directory-live-DGIGxpIo.js} +6 -3
- package/dist/{doctor-Bc4S1qyd.js → doctor-BzC-TLnB.js} +4 -4
- package/dist/{doctor-contract-CCFMIDk9.js → doctor-contract-DLa-BTiU.js} +2 -3
- package/dist/doctor-contract-api.js +147 -2
- package/dist/{handle-action.guild-admin-D6VRRW-C.js → handle-action.guild-admin-BNVTUISF.js} +4 -7
- package/dist/{inbound-event-delivery-CEPlt2uz.js → inbound-event-delivery-De2qxTrP.js} +4 -25
- package/dist/index.js +4 -2
- package/dist/{message-handler-CeiSulIw.js → message-handler-Unk_f10F.js} +41 -32
- package/dist/{message-handler.preflight-DibgQFf2.js → message-handler.preflight-C9zecxR9.js} +50 -26
- package/dist/{message-handler.process-Dnc_oz9y.js → message-handler.process-DWQ6UHHu.js} +130 -166
- package/dist/{message-utils-BgTwT_q7.js → message-utils-BSCPVgy0.js} +4 -4
- package/dist/{model-picker-preference-primitives-D25pnCOu.js → model-picker-preference-primitives-BHT1LkR_.js} +3 -3
- package/dist/{outbound-adapter-DtE-i2OJ.js → outbound-adapter-D9nRivT1.js} +91 -32
- package/dist/{outbound-components-C7GVyfPh.js → outbound-components-cTzwBJ60.js} +3 -3
- package/dist/{outbound-session-route-H-HoyH5U.js → outbound-session-route-DxLkrgKQ.js} +68 -95
- package/dist/{pluralkit-CD4B11JB.js → pluralkit-DdiJ9KMK.js} +1 -1
- package/dist/{preflight-audio-BjnQZ5yS.js → preflight-audio-DrnqFA8U.js} +22 -28
- package/dist/{probe-BeWKhjqX.js → probe-Bl-k5_Ku.js} +36 -12
- package/dist/probe.runtime-M9fREKvp.js +2 -0
- package/dist/{provider-DfQJX3z5.js → provider-DvSNb-2v.js} +969 -1248
- package/dist/{provider-session.runtime-Bo88k0pV.js → provider-session.runtime-BUEqD0rA.js} +3 -3
- package/dist/provider.runtime-C9PnJZbZ.js +2 -0
- package/dist/realtime-session.runtime-C7wen-aF.js +1340 -0
- package/dist/{resolve-allowlist-common-DHERApxi.js → resolve-allowlist-common-D04lpEzb.js} +2 -2
- package/dist/{resolve-channels-BjepAj8b.js → resolve-channels-Dm7jEeg6.js} +4 -4
- package/dist/{resolve-users-Bc28htgt.js → resolve-users-bktrCUUU.js} +3 -3
- package/dist/{chunk-DX4jpFQP.js → retry-CLpJcXXf.js} +291 -68
- package/dist/{runtime-_aRC6V2s.js → runtime-DGsSyDTS.js} +30 -25
- package/dist/{runtime-BmW_j_hl.js → runtime-DoHjckYm.js} +4 -6
- package/dist/runtime-api.actions.js +2 -2
- package/dist/runtime-api.js +22 -23
- package/dist/runtime-api.lookup.js +5 -5
- package/dist/runtime-api.monitor-CHxrFPnW.js +5 -0
- package/dist/runtime-api.monitor.js +5 -5
- package/dist/runtime-api.send.js +6 -6
- package/dist/runtime-api.threads.js +5 -6
- package/dist/sdk-runtime-QpY8PvCh.js +370 -0
- package/dist/{send-CdkZ6zeW.js → send-B7Q6Oc1I.js} +175 -86
- package/dist/{send.components-5uqwkjgE.js → send.components-iJyFXw9L.js} +24 -28
- package/dist/{send.outbound-D-80Ej-t.js → send.outbound-DS5tHwfR.js} +37 -24
- package/dist/{send.reactions-CtlmGd_o.js → send.reactions-BAn0iiVQ.js} +14 -21
- package/dist/{send.receipt-CuwRrpFz.js → send.receipt-IPI1p-SP.js} +19 -1
- package/dist/{send.shared-jpvAG_u6.js → send.shared-BmwFjW6T.js} +16 -85
- package/dist/{sender-identity-mG_zsdox.js → sender-identity-QtalnCYv.js} +1 -1
- package/dist/setup-entry.js +0 -5
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-CXF1tup1.js → shared-BIXIX6uJ.js} +16 -17
- package/dist/{subagent-hooks-Dxy7Fmnq.js → subagent-hooks-CTt5KCJr.js} +2 -2
- package/dist/subagent-hooks-api.js +2 -6
- package/dist/subagent-progress-DhaE_h8a.js +109 -0
- package/dist/{system-events-DdUqf91B.js → system-events-CTqDf6_s.js} +2 -2
- package/dist/{target-resolver-C3s_2m0t.js → target-resolver-maOKSqO0.js} +2 -2
- package/dist/targets-yUFTHoAx.js +3 -0
- package/dist/{thread-bindings-C-M-ly7P.js → thread-bindings-3L8p82GV.js} +5 -7
- package/dist/{thread-bindings.manager-DYvSlrva.js → thread-bindings.manager-DCIH6WDC.js} +257 -29
- package/dist/{thread-bindings.session-updates-DAIlp7Px.js → thread-bindings.session-updates-bJ2KQFY6.js} +1 -1
- package/dist/{thread-bindings.state-Cgi5uRn-.js → thread-bindings.state-aeV8HNgV.js} +2 -15
- package/dist/{transcripts-source-DIKGsTGT.js → transcripts-source-CfFMexGt.js} +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing--Mzo2kM7.js → typing-CS-nNVoe.js} +1 -1
- package/dist/voice-runtime-BEdqNcST.js +2459 -0
- package/openclaw.plugin.json +203 -19
- package/package.json +15 -9
- package/skills/discord/SKILL.md +22 -115
- package/dist/legacy-state-migrations-api.js +0 -138
- package/dist/manager.runtime-Bjav3pfC.js +0 -3655
- package/dist/preflight-audio.runtime-CoCXMM8r.js +0 -7
- package/dist/probe.runtime-DqFGFMbZ.js +0 -2
- package/dist/provider.runtime-Cy7XZmyh.js +0 -2
- package/dist/runtime-api.monitor-CCRubd3-.js +0 -5
- package/dist/session-binding-contract-api.js +0 -2
- package/dist/subagent-progress-DI3sYLLo.js +0 -664
- package/dist/targets-Dv_RN7vT.js +0 -3
- package/dist/thread-bindings.discord-api-BoDNqamb.js +0 -246
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
2
|
-
import {
|
|
3
|
-
import { w as mapGatewayDispatchData } from "./provider-
|
|
4
|
-
import { f as resolveDiscordMessageChannelId, i as resolveDiscordMessageText, l as hasDiscordMessageStickers } from "./message-utils-
|
|
2
|
+
import { c as resolveDiscordChannelInfoSafe, d as resolveDiscordChannelParentSafe, l as resolveDiscordChannelNameSafe, s as resolveDiscordChannelIdSafe } from "./thread-bindings.manager-DCIH6WDC.js";
|
|
3
|
+
import { w as mapGatewayDispatchData } from "./provider-DvSNb-2v.js";
|
|
4
|
+
import { f as resolveDiscordMessageChannelId, i as resolveDiscordMessageText, l as hasDiscordMessageStickers } from "./message-utils-BSCPVgy0.js";
|
|
5
5
|
import { normalizeNullableString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { GatewayDispatchEvents } from "discord-api-types/v10";
|
|
7
|
+
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
7
8
|
import { danger } from "openclaw/plugin-sdk/runtime-env";
|
|
8
9
|
import { resolveBatchedReplyThreadingPolicy } from "openclaw/plugin-sdk/reply-reference";
|
|
9
|
-
import { createChannelIngressError, createChannelIngressMonitor, createChannelRunQueue } from "openclaw/plugin-sdk/channel-outbound";
|
|
10
|
+
import { DEFAULT_INGRESS_RETRY_MAX_ATTEMPTS, createChannelIngressError, createChannelIngressMonitor, createChannelRunQueue } from "openclaw/plugin-sdk/channel-outbound";
|
|
10
11
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
11
12
|
import { resolveOpenProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
12
13
|
import { fanInChannelIngressLifecycles } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
@@ -43,9 +44,6 @@ function decodeDiscordIngressPayload(payload, claimedId) {
|
|
|
43
44
|
}
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
|
-
function errorText(error) {
|
|
47
|
-
return error instanceof Error ? error.message : String(error);
|
|
48
|
-
}
|
|
49
47
|
function isDiscordAuthenticationFailure(error) {
|
|
50
48
|
let current = error;
|
|
51
49
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -87,6 +85,10 @@ function createDiscordIngressMonitor(params) {
|
|
|
87
85
|
},
|
|
88
86
|
appendRetryDelaysMs: [0],
|
|
89
87
|
drain: {
|
|
88
|
+
retryPolicy: {
|
|
89
|
+
maxAttempts: DEFAULT_INGRESS_RETRY_MAX_ATTEMPTS,
|
|
90
|
+
deadLetterMinAgeMs: 0
|
|
91
|
+
},
|
|
90
92
|
resolveNonRetryableFailure: (error) => {
|
|
91
93
|
if (error instanceof DiscordIngressPayloadError) return {
|
|
92
94
|
reason: "invalid-event",
|
|
@@ -94,13 +96,13 @@ function createDiscordIngressMonitor(params) {
|
|
|
94
96
|
};
|
|
95
97
|
if (isDiscordAuthenticationFailure(error)) return {
|
|
96
98
|
reason: "authentication-failed",
|
|
97
|
-
message:
|
|
99
|
+
message: formatErrorMessage(error)
|
|
98
100
|
};
|
|
99
101
|
return null;
|
|
100
102
|
},
|
|
101
103
|
onLog: (message) => params.runtime.error?.(danger(`discord ingress: ${message}`))
|
|
102
104
|
},
|
|
103
|
-
onError: (error) => params.runtime.error?.(danger(`discord ingress drain failed: ${
|
|
105
|
+
onError: (error) => params.runtime.error?.(danger(`discord ingress drain failed: ${formatErrorMessage(error)}`))
|
|
104
106
|
});
|
|
105
107
|
return {
|
|
106
108
|
accept: async (rawMessage) => {
|
|
@@ -112,18 +114,10 @@ function createDiscordIngressMonitor(params) {
|
|
|
112
114
|
}
|
|
113
115
|
//#endregion
|
|
114
116
|
//#region extensions/discord/src/monitor/inbound-job.ts
|
|
115
|
-
function resolveDiscordInboundJobQueueKey(ctx) {
|
|
116
|
-
const sessionKey = ctx.route.sessionKey?.trim();
|
|
117
|
-
if (sessionKey) return sessionKey;
|
|
118
|
-
const baseSessionKey = ctx.baseSessionKey?.trim();
|
|
119
|
-
if (baseSessionKey) return baseSessionKey;
|
|
120
|
-
return ctx.messageChannelId;
|
|
121
|
-
}
|
|
122
117
|
function buildDiscordInboundJob(ctx, options) {
|
|
123
118
|
const { runtime, abortSignal, guildHistories, client, turnAdoptionLifecycle, threadBindings, discordRestFetch, message, data, threadChannel, ...payload } = ctx;
|
|
124
119
|
const sanitizedMessage = sanitizeDiscordInboundMessage(message);
|
|
125
120
|
return {
|
|
126
|
-
queueKey: resolveDiscordInboundJobQueueKey(ctx),
|
|
127
121
|
payload: {
|
|
128
122
|
...payload,
|
|
129
123
|
message: sanitizedMessage,
|
|
@@ -181,20 +175,21 @@ function applyImplicitReplyBatchGate(ctx, replyToMode, isBatched) {
|
|
|
181
175
|
}
|
|
182
176
|
//#endregion
|
|
183
177
|
//#region extensions/discord/src/monitor/message-run-queue.ts
|
|
184
|
-
const loadMessageProcessRuntime = createLazyRuntimeModule(() => import("./message-handler.process-
|
|
178
|
+
const loadMessageProcessRuntime = createLazyRuntimeModule(() => import("./message-handler.process-DWQ6UHHu.js"));
|
|
185
179
|
async function processDiscordQueuedMessage(params) {
|
|
186
180
|
const abortSignal = params.job.runtime.abortSignal && params.lifecycleSignal ? AbortSignal.any([params.job.runtime.abortSignal, params.lifecycleSignal]) : params.job.runtime.abortSignal ?? params.lifecycleSignal;
|
|
187
181
|
try {
|
|
188
182
|
await (params.testing?.processDiscordMessage ?? (await loadMessageProcessRuntime()).processDiscordMessage)(materializeDiscordInboundJob(params.job, abortSignal));
|
|
189
|
-
if (abortSignal?.aborted) await params.job.ingressSettlement?.
|
|
183
|
+
if (abortSignal?.aborted) await params.job.ingressSettlement?.cancel();
|
|
190
184
|
else await params.job.ingressSettlement?.settle();
|
|
191
185
|
} catch (error) {
|
|
192
|
-
await params.job.ingressSettlement?.
|
|
186
|
+
if (abortSignal?.aborted) await params.job.ingressSettlement?.cancel();
|
|
187
|
+
else await params.job.ingressSettlement?.abandon(error);
|
|
193
188
|
throw error;
|
|
194
189
|
}
|
|
195
190
|
}
|
|
196
191
|
async function cleanupSkippedDiscordQueuedMessage(params) {
|
|
197
|
-
await params.job.ingressSettlement?.
|
|
192
|
+
await params.job.ingressSettlement?.cancel();
|
|
198
193
|
}
|
|
199
194
|
function createDiscordMessageRunQueue(params) {
|
|
200
195
|
const skippedCleanup = /* @__PURE__ */ new Set();
|
|
@@ -232,6 +227,10 @@ function createDiscordMessageRunQueue(params) {
|
|
|
232
227
|
const cleanupSkipped = async () => {
|
|
233
228
|
try {
|
|
234
229
|
await cleanupSkippedDiscordQueuedMessage({ job });
|
|
230
|
+
} catch (error) {
|
|
231
|
+
try {
|
|
232
|
+
params.runtime.error(danger(`discord queued message cleanup failed: ${String(error)}`));
|
|
233
|
+
} catch {}
|
|
235
234
|
} finally {
|
|
236
235
|
settlePending();
|
|
237
236
|
}
|
|
@@ -241,7 +240,7 @@ function createDiscordMessageRunQueue(params) {
|
|
|
241
240
|
return;
|
|
242
241
|
}
|
|
243
242
|
skippedCleanup.add(cleanupSkipped);
|
|
244
|
-
runQueue.enqueue(job.
|
|
243
|
+
runQueue.enqueue(job.payload.message.id, async ({ lifecycleSignal }) => {
|
|
245
244
|
skippedCleanup.delete(cleanupSkipped);
|
|
246
245
|
try {
|
|
247
246
|
await processDiscordQueuedMessage({
|
|
@@ -263,7 +262,7 @@ function createDiscordMessageRunQueue(params) {
|
|
|
263
262
|
}
|
|
264
263
|
//#endregion
|
|
265
264
|
//#region extensions/discord/src/monitor/message-dispatcher.ts
|
|
266
|
-
const loadMessagePreflightRuntime = createLazyRuntimeModule(() => import("./message-handler.preflight-
|
|
265
|
+
const loadMessagePreflightRuntime = createLazyRuntimeModule(() => import("./message-handler.preflight-C9zecxR9.js"));
|
|
267
266
|
function isNonEmptyString(value) {
|
|
268
267
|
return typeof value === "string" && value.length > 0;
|
|
269
268
|
}
|
|
@@ -317,7 +316,7 @@ function createDiscordMessageDispatcher(params) {
|
|
|
317
316
|
if (!last) return;
|
|
318
317
|
const abortSignal = last.abortSignal;
|
|
319
318
|
if (abortSignal?.aborted) {
|
|
320
|
-
await
|
|
319
|
+
await ingress.cancel();
|
|
321
320
|
return;
|
|
322
321
|
}
|
|
323
322
|
try {
|
|
@@ -332,7 +331,7 @@ function createDiscordMessageDispatcher(params) {
|
|
|
332
331
|
turnAdoptionLifecycle: admissionLifecycle
|
|
333
332
|
});
|
|
334
333
|
if (abortSignal?.aborted) {
|
|
335
|
-
await ingress.
|
|
334
|
+
await ingress.cancel();
|
|
336
335
|
return;
|
|
337
336
|
}
|
|
338
337
|
if (!ctx) {
|
|
@@ -386,7 +385,7 @@ function createDiscordMessageDispatcher(params) {
|
|
|
386
385
|
turnAdoptionLifecycle: admissionLifecycle
|
|
387
386
|
});
|
|
388
387
|
if (abortSignal?.aborted) {
|
|
389
|
-
await ingress.
|
|
388
|
+
await ingress.cancel();
|
|
390
389
|
return;
|
|
391
390
|
}
|
|
392
391
|
if (!ctx) {
|
|
@@ -403,7 +402,10 @@ function createDiscordMessageDispatcher(params) {
|
|
|
403
402
|
}
|
|
404
403
|
messageRunQueue.enqueue(buildDiscordInboundJob(ctx, { ingressSettlement: ingress }));
|
|
405
404
|
} catch (error) {
|
|
406
|
-
|
|
405
|
+
if (abortSignal?.aborted) {
|
|
406
|
+
await ingress.cancel();
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
407
409
|
throw error;
|
|
408
410
|
}
|
|
409
411
|
}
|
|
@@ -415,7 +417,7 @@ function createDiscordMessageDispatcher(params) {
|
|
|
415
417
|
onCancel: (entries) => {
|
|
416
418
|
for (const entry of entries) {
|
|
417
419
|
pendingDebounceEntries.delete(entry);
|
|
418
|
-
const settlement =
|
|
420
|
+
const settlement = fanInChannelIngressLifecycles([entry.turnAdoptionLifecycle]).cancel().catch((error) => {
|
|
419
421
|
params.runtime.error(danger(`discord ingress cancellation settlement failed: ${String(error)}`));
|
|
420
422
|
}).finally(() => {
|
|
421
423
|
pendingCancellationSettlements.delete(settlement);
|
|
@@ -426,10 +428,17 @@ function createDiscordMessageDispatcher(params) {
|
|
|
426
428
|
});
|
|
427
429
|
const dispatchMessage = async (data, client, options) => {
|
|
428
430
|
try {
|
|
429
|
-
if (dispatcherShutdown.signal.aborted || options?.abortSignal?.aborted)
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
431
|
+
if (dispatcherShutdown.signal.aborted || options?.abortSignal?.aborted) {
|
|
432
|
+
const reason = dispatcherShutdown.signal.aborted ? dispatcherShutdown.signal.reason ?? /* @__PURE__ */ new Error("discord dispatcher shut down") : options?.abortSignal?.reason ?? /* @__PURE__ */ new Error("discord dispatch aborted");
|
|
433
|
+
if (options?.turnAdoptionLifecycle) {
|
|
434
|
+
await fanInChannelIngressLifecycles([options.turnAdoptionLifecycle]).cancel();
|
|
435
|
+
return { kind: "deferred" };
|
|
436
|
+
}
|
|
437
|
+
return {
|
|
438
|
+
kind: "failed-retryable",
|
|
439
|
+
error: reason
|
|
440
|
+
};
|
|
441
|
+
}
|
|
433
442
|
const msgAuthorId = data.message?.author?.id ?? data.author?.id;
|
|
434
443
|
if (params.botUserId && msgAuthorId === params.botUserId) return { kind: "completed" };
|
|
435
444
|
const entry = {
|
package/dist/{message-handler.preflight-DibgQFf2.js → message-handler.preflight-C9zecxR9.js}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { B as Message, Et as getChannelMessage, h as discord_exports } from "./retry-CLpJcXXf.js";
|
|
2
2
|
import { o as resolveDefaultDiscordAccountId } from "./accounts-DJTf1LtA.js";
|
|
3
|
-
import { C as resolveTimestampMs, S as resolveDiscordSystemLocation, _ as resolveDiscordShouldRequireMention, a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, f as resolveDiscordGuildEntry, i as normalizeDiscordDisplaySlug, n as isDiscordGroupAllowedByPolicy, p as resolveDiscordMemberAccessState, v as resolveGroupDmAllow, x as formatDiscordUserTag } from "./allow-list-
|
|
3
|
+
import { C as resolveTimestampMs, S as resolveDiscordSystemLocation, _ as resolveDiscordShouldRequireMention, a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, f as resolveDiscordGuildEntry, i as normalizeDiscordDisplaySlug, n as isDiscordGroupAllowedByPolicy, p as resolveDiscordMemberAccessState, v as resolveGroupDmAllow, x as formatDiscordUserTag } from "./allow-list-DnxIlPP2.js";
|
|
4
4
|
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-B9cy6RvQ.js";
|
|
5
|
-
import { r as resolveDiscordConversationIdentity } from "./approval-message-safety-
|
|
6
|
-
import {
|
|
7
|
-
import { C as handleDiscordDmCommandDecision, M as resolveDiscordTextCommandAccess, S as shouldIgnoreStaleDiscordRouteBinding, b as resolveDiscordConversationRoute, j as resolveDiscordDmCommandAccess, x as resolveDiscordEffectiveRoute, y as buildDiscordRoutePeer } from "./provider-
|
|
8
|
-
import { d as resolveDiscordChannelInfo, f as resolveDiscordMessageChannelId, i as resolveDiscordMessageText, o as resolveForwardedMediaList, r as resolveDiscordMessageHistoryText, s as resolveMediaList, u as resolveDiscordMessageStickers } from "./message-utils-
|
|
9
|
-
import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-
|
|
5
|
+
import { r as resolveDiscordConversationIdentity } from "./approval-message-safety-AcIxvrf3.js";
|
|
6
|
+
import { c as resolveDiscordChannelInfoSafe, l as resolveDiscordChannelNameSafe } from "./thread-bindings.manager-DCIH6WDC.js";
|
|
7
|
+
import { C as handleDiscordDmCommandDecision, M as resolveDiscordTextCommandAccess, S as shouldIgnoreStaleDiscordRouteBinding, b as resolveDiscordConversationRoute, j as resolveDiscordDmCommandAccess, x as resolveDiscordEffectiveRoute, y as buildDiscordRoutePeer } from "./provider-DvSNb-2v.js";
|
|
8
|
+
import { d as resolveDiscordChannelInfo, f as resolveDiscordMessageChannelId, i as resolveDiscordMessageText, o as resolveForwardedMediaList, r as resolveDiscordMessageHistoryText, s as resolveMediaList, u as resolveDiscordMessageStickers } from "./message-utils-BSCPVgy0.js";
|
|
9
|
+
import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-QtalnCYv.js";
|
|
10
10
|
import { t as createDiscordHistorySenderProvenance } from "./message-handler.history-CJOsN9w5.js";
|
|
11
11
|
import { normalizeOptionalString, readStringValue } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
12
|
import { logDebug } from "openclaw/plugin-sdk/logging-core";
|
|
@@ -18,7 +18,7 @@ import { findCodeRegions, isInsideCode } from "openclaw/plugin-sdk/text-chunking
|
|
|
18
18
|
import { isRecentOutboundMessageIdentity } from "openclaw/plugin-sdk/channel-outbound";
|
|
19
19
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
20
20
|
import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
|
|
21
|
-
import {
|
|
21
|
+
import { enqueueRoutedSystemEvent } from "openclaw/plugin-sdk/system-event-runtime";
|
|
22
22
|
import { buildMentionRegexes, classifyChannelInboundEvent, implicitMentionKindWhen, logInboundDrop, matchesMentionWithExplicit, recordChannelBotPairLoopAndCheckSuppression, resolveInboundMentionDecision, resolveUnmentionedGroupInboundPolicy, toHistoryMediaEntries, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
|
|
23
23
|
import { mimeTypeFromFilePath } from "openclaw/plugin-sdk/media-mime";
|
|
24
24
|
import { hasControlCommand } from "openclaw/plugin-sdk/command-detection";
|
|
@@ -27,7 +27,7 @@ import { shouldHandleTextCommands } from "openclaw/plugin-sdk/command-surface";
|
|
|
27
27
|
import { createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
|
|
28
28
|
//#region extensions/discord/src/monitor/message-handler.dm-preflight.ts
|
|
29
29
|
const loadConversationRuntime$1 = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/conversation-binding-runtime"));
|
|
30
|
-
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-
|
|
30
|
+
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-B7Q6Oc1I.js").then((n) => n.t));
|
|
31
31
|
function resolveDiscordDmPairingSenderId(sender) {
|
|
32
32
|
return sender.isPluralKit ? `pk:${sender.id}` : sender.id;
|
|
33
33
|
}
|
|
@@ -45,7 +45,7 @@ async function resolveDiscordDmPreflightAccess(params) {
|
|
|
45
45
|
accountId: params.preflight.accountId,
|
|
46
46
|
conversationId: directBindingConversationId
|
|
47
47
|
});
|
|
48
|
-
const
|
|
48
|
+
const resolveChannelIngress = async (contextBinding, conversation) => await resolveDiscordDmCommandAccess({
|
|
49
49
|
accountId: params.resolvedAccountId,
|
|
50
50
|
dmPolicy: params.dmPolicy,
|
|
51
51
|
configuredAllowFrom: params.preflight.allowFrom ?? [],
|
|
@@ -57,13 +57,26 @@ async function resolveDiscordDmPreflightAccess(params) {
|
|
|
57
57
|
allowNameMatching: params.allowNameMatching,
|
|
58
58
|
cfg: params.preflight.cfg,
|
|
59
59
|
token: params.preflight.token,
|
|
60
|
-
rest: params.preflight.client.rest
|
|
60
|
+
rest: params.preflight.client.rest,
|
|
61
|
+
conversationId: params.conversationId,
|
|
62
|
+
conversationParentId: conversation?.parentId,
|
|
63
|
+
conversationThreadId: conversation?.threadId,
|
|
64
|
+
...contextBinding ? { contextBinding } : {}
|
|
61
65
|
});
|
|
66
|
+
const dmAccess = await resolveChannelIngress();
|
|
62
67
|
const commandAuthorized = dmAccess.senderAccess.allowed && dmAccess.commandAccess.authorized || directBindingRecord != null;
|
|
63
|
-
if (dmAccess.senderAccess.decision === "allow") return {
|
|
68
|
+
if (dmAccess.senderAccess.decision === "allow") return {
|
|
69
|
+
commandAuthorized,
|
|
70
|
+
channelIngress: dmAccess,
|
|
71
|
+
resolveChannelIngress
|
|
72
|
+
};
|
|
64
73
|
if (directBindingRecord) {
|
|
65
74
|
logVerbose(`discord: allow bound DM conversation ${directBindingConversationId} despite dmPolicy=${params.dmPolicy}`);
|
|
66
|
-
return {
|
|
75
|
+
return {
|
|
76
|
+
commandAuthorized,
|
|
77
|
+
channelIngress: dmAccess,
|
|
78
|
+
resolveChannelIngress
|
|
79
|
+
};
|
|
67
80
|
}
|
|
68
81
|
await handleDiscordDmCommandDecision({
|
|
69
82
|
senderAccess: dmAccess.senderAccess,
|
|
@@ -475,10 +488,10 @@ function logDiscordPreflightInboundSummary(params) {
|
|
|
475
488
|
}
|
|
476
489
|
//#endregion
|
|
477
490
|
//#region extensions/discord/src/monitor/message-handler.preflight-runtime.ts
|
|
478
|
-
const loadPluralKitRuntime = createLazyRuntimeModule(() => import("./pluralkit-
|
|
479
|
-
const loadPreflightAudioRuntime = createLazyRuntimeModule(() => import("./preflight-audio-
|
|
480
|
-
const loadSystemEventsRuntime = createLazyRuntimeModule(() => import("./system-events-
|
|
481
|
-
const loadDiscordThreadingRuntime = createLazyRuntimeModule(() => import("./provider-
|
|
491
|
+
const loadPluralKitRuntime = createLazyRuntimeModule(() => import("./pluralkit-DdiJ9KMK.js").then((n) => n.n));
|
|
492
|
+
const loadPreflightAudioRuntime = createLazyRuntimeModule(() => import("./preflight-audio-DrnqFA8U.js"));
|
|
493
|
+
const loadSystemEventsRuntime = createLazyRuntimeModule(() => import("./system-events-CTqDf6_s.js"));
|
|
494
|
+
const loadDiscordThreadingRuntime = createLazyRuntimeModule(() => import("./provider-DvSNb-2v.js").then((n) => n.E));
|
|
482
495
|
function isPreflightAborted(abortSignal) {
|
|
483
496
|
return Boolean(abortSignal?.aborted);
|
|
484
497
|
}
|
|
@@ -771,6 +784,8 @@ async function preflightDiscordMessage(params) {
|
|
|
771
784
|
const resolvedAccountId = params.accountId ?? resolveDefaultDiscordAccountId(params.cfg);
|
|
772
785
|
const allowNameMatching = isDangerousNameMatchingEnabled(params.discordConfig);
|
|
773
786
|
let commandAuthorized = true;
|
|
787
|
+
let channelIngress;
|
|
788
|
+
let resolveChannelIngress;
|
|
774
789
|
if (isDirectMessage) {
|
|
775
790
|
const access = await resolveDiscordDmPreflightAccess({
|
|
776
791
|
preflight: params,
|
|
@@ -778,11 +793,14 @@ async function preflightDiscordMessage(params) {
|
|
|
778
793
|
sender,
|
|
779
794
|
dmPolicy,
|
|
780
795
|
resolvedAccountId,
|
|
781
|
-
allowNameMatching
|
|
796
|
+
allowNameMatching,
|
|
797
|
+
conversationId: messageChannelId
|
|
782
798
|
});
|
|
783
799
|
if (isPreflightAborted(params.abortSignal)) return null;
|
|
784
800
|
if (!access) return null;
|
|
785
801
|
commandAuthorized = access.commandAuthorized;
|
|
802
|
+
channelIngress = access.channelIngress;
|
|
803
|
+
resolveChannelIngress = access.resolveChannelIngress;
|
|
786
804
|
}
|
|
787
805
|
const botId = params.botUserId;
|
|
788
806
|
const baseText = resolveDiscordMessageText(message, { includeForwarded: false });
|
|
@@ -960,7 +978,7 @@ async function preflightDiscordMessage(params) {
|
|
|
960
978
|
const hasControlCommandInMessage = hasControlCommand(baseText, params.cfg);
|
|
961
979
|
const hasAbortRequest = isAbortRequestText(baseText);
|
|
962
980
|
if (!isDirectMessage) {
|
|
963
|
-
const
|
|
981
|
+
const resolveCommandIngress = async (contextBinding, conversation) => await resolveDiscordTextCommandAccess({
|
|
964
982
|
accountId: params.accountId,
|
|
965
983
|
cfg: params.cfg,
|
|
966
984
|
ownerAllowFrom: params.allowFrom,
|
|
@@ -973,10 +991,17 @@ async function preflightDiscordMessage(params) {
|
|
|
973
991
|
memberAllowed,
|
|
974
992
|
allowNameMatching,
|
|
975
993
|
allowTextCommands,
|
|
976
|
-
hasControlCommand: hasControlCommandInMessage
|
|
994
|
+
hasControlCommand: hasControlCommandInMessage,
|
|
995
|
+
conversationId: messageChannelId,
|
|
996
|
+
conversationParentId: conversation?.parentId,
|
|
997
|
+
conversationThreadId: conversation?.threadId,
|
|
998
|
+
...contextBinding ? { contextBinding } : {}
|
|
977
999
|
});
|
|
978
|
-
|
|
979
|
-
|
|
1000
|
+
const commandAccess = await resolveCommandIngress();
|
|
1001
|
+
commandAuthorized = commandAccess.commandAccess.authorized;
|
|
1002
|
+
channelIngress = commandAccess;
|
|
1003
|
+
resolveChannelIngress = resolveCommandIngress;
|
|
1004
|
+
if (commandAccess.commandAccess.shouldBlockControlCommand) {
|
|
980
1005
|
logInboundDrop({
|
|
981
1006
|
log: logVerbose,
|
|
982
1007
|
channel: "discord",
|
|
@@ -1060,10 +1085,7 @@ async function preflightDiscordMessage(params) {
|
|
|
1060
1085
|
const systemText = resolveDiscordSystemEvent(message, systemLocation);
|
|
1061
1086
|
if (systemText) {
|
|
1062
1087
|
logDebug(`[discord-preflight] drop: system event`);
|
|
1063
|
-
|
|
1064
|
-
sessionKey: effectiveRoute.sessionKey,
|
|
1065
|
-
contextKey: `discord:system:${messageChannelId}:${message.id}`
|
|
1066
|
-
});
|
|
1088
|
+
enqueueRoutedSystemEvent(systemText, effectiveRoute, { contextKey: `discord:system:${messageChannelId}:${message.id}` });
|
|
1067
1089
|
return null;
|
|
1068
1090
|
}
|
|
1069
1091
|
const hasNativeMedia = (message.attachments?.length ?? 0) > 0 || resolveDiscordMessageStickers(message).length > 0;
|
|
@@ -1128,6 +1150,8 @@ async function preflightDiscordMessage(params) {
|
|
|
1128
1150
|
isDirectMessage,
|
|
1129
1151
|
isGroupDm,
|
|
1130
1152
|
commandAuthorized,
|
|
1153
|
+
channelIngress,
|
|
1154
|
+
resolveChannelIngress,
|
|
1131
1155
|
baseText,
|
|
1132
1156
|
messageText,
|
|
1133
1157
|
...preflightTranscript !== void 0 ? { preflightAudioTranscript: preflightTranscript } : {},
|