@openclaw/discord 2026.9.1-beta.1 → 2026.9.1
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-E-segZn6.js} +30 -17
- package/dist/activities-api.js +1 -1
- package/dist/{allow-list-BDMimASD.js → allow-list-C2JuH-R0.js} +10 -6
- 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-CW5k3mSa.js} +19 -12
- package/dist/{audit-CBEv_ERu.js → audit-B9rydv5a.js} +8 -7
- package/dist/{channel-Dx1tMTfx.js → channel-D93LnbTE.js} +29 -23
- package/dist/{channel-actions.runtime-CLWWu9nC.js → channel-actions.runtime-DMFv4doE.js} +16 -13
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-DOzXS2Pk.js → channel.setup-DTL7kPOM.js} +18 -18
- package/dist/{components-B9V5o361.js → components-DmXYIQ26.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-24afmvEC.js} +1 -1
- package/dist/{directory-config-BK6eqekJ.js → directory-config-BD4YL7wT.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-DSAJSrJk.js → directory-live-BrFVc1Ds.js} +4 -4
- package/dist/{doctor-Cm7Y1pJ2.js → doctor-BUB41_lr.js} +5 -5
- package/dist/{doctor-contract-DsWvKIXF.js → doctor-contract-Co5vRCZ6.js} +9 -6
- package/dist/doctor-contract-api.js +3 -2
- package/dist/{handle-action.guild-admin-BdwCRHmm.js → handle-action.guild-admin-B0egstYq.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/ingress-identity-BCzfPPYM.js +60 -0
- package/dist/{message-handler-BXpWZyni.js → message-handler-Qdw9c0j4.js} +14 -10
- package/dist/{message-handler.preflight-Ba5LAY_X.js → message-handler.preflight-Dxi2yBfR.js} +41 -101
- package/dist/{message-handler.process-3HEzmemS.js → message-handler.process-BYDjtxZJ.js} +83 -109
- package/dist/{message-text-aiwO5R2F.js → message-text-BRVqYm-t.js} +11 -6
- package/dist/{outbound-adapter-BE4jSq2d.js → outbound-adapter-DEhthWTk.js} +52 -67
- package/dist/{outbound-components-oLpg8Qzb.js → outbound-components-DehyxvA4.js} +5 -4
- package/dist/{outbound-session-route-Cg15ZFJd.js → outbound-session-route-BFGRF9fE.js} +55 -12
- package/dist/{owner-access-UlYi9t0M.js → owner-access-yc1sX7Gx.js} +7 -6
- package/dist/{pluralkit-Tiyl70dx.js → pluralkit-XmmAHoV6.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-B11xwilq.js → provider-DuDtKbF8.js} +294 -131
- package/dist/{provider-session.runtime-B9xe-Qaf.js → provider-session.runtime-BA2BPyZ4.js} +3 -3
- package/dist/provider.runtime-Db8YwZBv.js +2 -0
- package/dist/{realtime-session.runtime-CU8IQUS-.js → realtime-session.runtime-DgSbX6ay.js} +103 -163
- package/dist/{resolve-allowlist-common-BLoYaxEG.js → resolve-allowlist-common-BJ5UZNNT.js} +3 -3
- package/dist/{resolve-channels-C2sT_n67.js → resolve-channels-CYseD5Uw.js} +4 -4
- package/dist/{resolve-users-CzpjLwjy.js → resolve-users-DrmhDrqm.js} +5 -4
- package/dist/{retry-Cv4jCU5Z.js → retry-BNCxiyyR.js} +120 -32
- package/dist/{retry-after-DdLPmPoa.js → retry-after-BrLjLUJi.js} +2 -1
- package/dist/{runtime-BHrTlFkf.js → runtime-BbWNtfyq.js} +127 -93
- package/dist/{runtime-CY4PRMF-.js → runtime-DB7Fb6AU.js} +2 -2
- package/dist/runtime-api.js +19 -19
- 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-BnTEIeLE.js} +132 -100
- package/dist/{send.components-DKKAw5VX.js → send.components-BWVEcjRP.js} +21 -15
- package/dist/{send.outbound-zam0TrZx.js → send.outbound-b5xwHTlL.js} +35 -22
- package/dist/{send.shared-JjljcV4O.js → send.shared-5vxBTagO.js} +25 -18
- package/dist/{sender-identity-BJtfyise.js → sender-identity-Dt0imZyY.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-_5EcP4jW.js → shared-BSJWHEMA.js} +20 -14
- package/dist/{subagent-hooks-DQzvOptn.js → subagent-hooks-IzQKX4RQ.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{system-events-C7yxaHWP.js → system-events-BOiDS8b3.js} +2 -2
- package/dist/{target-resolver-vxIh6O3-.js → target-resolver-BVI8xSSC.js} +6 -5
- package/dist/targets-DbxVbq8k.js +3 -0
- package/dist/{thread-bindings-DW5F9vat.js → thread-bindings-D7mcaXQC.js} +6 -5
- package/dist/{thread-bindings.manager-ByOtwjo_.js → thread-bindings.manager-B1oySiVc.js} +37 -28
- package/dist/{thread-bindings.session-updates-CJb-BpPL.js → thread-bindings.session-updates-CC7HoQvt.js} +2 -1
- package/dist/{threading-agH1T_6s.js → threading-OQnL-0Zx.js} +8 -6
- package/dist/{timeouts-B9cy6RvQ.js → timeouts-D86uWLt_.js} +1 -1
- package/dist/{transcripts-source-BR11iHA4.js → transcripts-source-D8lH7AkN.js} +9 -4
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-Dc_YMY2e.js → typing-C9q0AQMb.js} +2 -2
- package/dist/{voice-runtime-DIeaa8fJ.js → voice-runtime-Dfhjh1tV.js} +433 -93
- 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/typebox/build/format/email.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
- package/node_modules/typebox/package.json +1 -1
- package/openclaw.plugin.json +14 -6
- package/package.json +6 -5
- 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
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as createDiscordActionGate } from "./accounts-
|
|
3
|
-
import { g as notifyDiscordInboundEventOutboundPayloadSuccess, h as discordInboundEventDelivery, r as formatDiscordApprovalDisplayValue } from "./outbound-session-route-
|
|
4
|
-
import { a as sendDiscordComponentMessageLazy, i as resolveDiscordComponentSpec, n as buildDiscordPresentationPayload, t as DISCORD_PRESENTATION_CAPABILITIES } from "./outbound-components-
|
|
1
|
+
import { _ as normalizeDiscordOutboundTarget, c as createDiscordSendReceiptFromResults, i as hasDiscordMessageCreateAmbiguity, o as chunkDiscordTextWithMode, p as resolveDiscordReplyReference, s as createDiscordSendReceipt, t as canFallbackDiscordWebhookSend, u as toDiscordOutboundDeliveryResult } from "./retry-BNCxiyyR.js";
|
|
2
|
+
import { t as createDiscordActionGate } from "./accounts-CwJQoLjM.js";
|
|
3
|
+
import { g as notifyDiscordInboundEventOutboundPayloadSuccess, h as discordInboundEventDelivery, r as formatDiscordApprovalDisplayValue } from "./outbound-session-route-BFGRF9fE.js";
|
|
4
|
+
import { a as sendDiscordComponentMessageLazy, i as resolveDiscordComponentSpec, n as buildDiscordPresentationPayload, t as DISCORD_PRESENTATION_CAPABILITIES } from "./outbound-components-DehyxvA4.js";
|
|
5
5
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
6
6
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
|
+
import { getReplyPayloadTtsSupplement, resolvePayloadMediaUrls, sendPayloadMediaSequenceOrFallback, sendTextMediaPayload } from "openclaw/plugin-sdk/reply-payload";
|
|
7
8
|
import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
|
|
8
9
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
9
10
|
import { createReplyToFanout, resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-outbound";
|
|
10
11
|
import { attachChannelToResult, createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
|
|
11
|
-
import { getReplyPayloadTtsSupplement, resolvePayloadMediaUrls, sendPayloadMediaSequenceOrFallback, sendTextMediaPayload } from "openclaw/plugin-sdk/reply-payload";
|
|
12
12
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
13
13
|
import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
|
|
14
14
|
//#region extensions/discord/src/media-detection.ts
|
|
@@ -33,7 +33,8 @@ function normalizeMediaPathForExtension(mediaUrl) {
|
|
|
33
33
|
}
|
|
34
34
|
} catch {
|
|
35
35
|
const withoutHash = trimmed.split("#", 1)[0] ?? trimmed;
|
|
36
|
-
|
|
36
|
+
const withoutQuery = withoutHash.split("?", 1)[0] ?? withoutHash;
|
|
37
|
+
return normalizeLowercaseStringOrEmpty(withoutQuery);
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
function isLikelyDiscordVideoMedia(mediaUrl) {
|
|
@@ -59,7 +60,7 @@ function normalizeDiscordApprovalPayload(payload) {
|
|
|
59
60
|
}
|
|
60
61
|
//#endregion
|
|
61
62
|
//#region extensions/discord/src/outbound-send-context.ts
|
|
62
|
-
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-
|
|
63
|
+
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-BnTEIeLE.js").then((n) => n.t));
|
|
63
64
|
function resolveDiscordOutboundTarget(params) {
|
|
64
65
|
if (params.threadId == null) return params.to;
|
|
65
66
|
const threadId = normalizeOptionalStringifiedId(params.threadId) ?? "";
|
|
@@ -107,18 +108,19 @@ function createDiscordUnknownPayloadResult(target) {
|
|
|
107
108
|
})
|
|
108
109
|
};
|
|
109
110
|
}
|
|
110
|
-
function resolveDiscordDeliveryOptions(ctx, sendContext, reply = sendContext.resolveReply()) {
|
|
111
|
+
function resolveDiscordDeliveryOptions$1(ctx, sendContext, reply = sendContext.resolveReply()) {
|
|
111
112
|
return {
|
|
112
113
|
reply,
|
|
113
114
|
accountId: ctx.accountId ?? void 0,
|
|
114
115
|
silent: ctx.silent ?? void 0,
|
|
115
116
|
cfg: ctx.cfg,
|
|
116
|
-
onPlatformSendDispatch: ctx.onPlatformSendDispatch
|
|
117
|
+
onPlatformSendDispatch: ctx.onPlatformSendDispatch,
|
|
118
|
+
assertPlatformSendAuthorized: ctx.assertDirectAdapterHandoff
|
|
117
119
|
};
|
|
118
120
|
}
|
|
119
121
|
function resolveDiscordFormattedDeliveryOptions(ctx, sendContext, reply = sendContext.resolveReply()) {
|
|
120
122
|
return {
|
|
121
|
-
...resolveDiscordDeliveryOptions(ctx, sendContext, reply),
|
|
123
|
+
...resolveDiscordDeliveryOptions$1(ctx, sendContext, reply),
|
|
122
124
|
...sendContext.formatting
|
|
123
125
|
};
|
|
124
126
|
}
|
|
@@ -175,7 +177,7 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
175
177
|
try {
|
|
176
178
|
const voiceUrl = expectDefined(mediaUrls.at(0), "non-empty Discord voice media URLs");
|
|
177
179
|
lastResult = await sendContext.sendVoice(sendContext.target, voiceUrl, {
|
|
178
|
-
...resolveDiscordDeliveryOptions(ctx, sendContext, voiceReply),
|
|
180
|
+
...resolveDiscordDeliveryOptions$1(ctx, sendContext, voiceReply),
|
|
179
181
|
mediaAccess: ctx.mediaAccess,
|
|
180
182
|
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
181
183
|
mediaReadFile: ctx.mediaReadFile
|
|
@@ -216,12 +218,12 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
216
218
|
if (voiceFailure) throw voiceFailure.error;
|
|
217
219
|
return completeDelivery(lastResult);
|
|
218
220
|
}
|
|
221
|
+
const discordData = payload.channelData?.discord && typeof payload.channelData.discord === "object" && !Array.isArray(payload.channelData.discord) ? payload.channelData.discord : {};
|
|
222
|
+
const filename = normalizeOptionalString(discordData.filename);
|
|
219
223
|
const componentSpec = await resolveDiscordComponentSpec(payload);
|
|
220
224
|
if (!componentSpec) {
|
|
221
|
-
const discordData = payload.channelData?.discord && typeof payload.channelData.discord === "object" && !Array.isArray(payload.channelData.discord) ? payload.channelData.discord : {};
|
|
222
225
|
const nativeComponents = Array.isArray(discordData.components) ? discordData.components : void 0;
|
|
223
226
|
const embeds = Array.isArray(discordData.embeds) ? discordData.embeds : void 0;
|
|
224
|
-
const filename = normalizeOptionalString(discordData.filename);
|
|
225
227
|
if (nativeComponents || embeds?.length || filename) return completeDelivery(await sendPayloadMediaSequenceOrFallback({
|
|
226
228
|
text: payload.text ?? "",
|
|
227
229
|
mediaUrls,
|
|
@@ -256,12 +258,14 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
256
258
|
sendNoMedia: async () => {
|
|
257
259
|
return await sendDiscordComponentMessageLazy(sendContext.target, componentSpec, {
|
|
258
260
|
...resolveDiscordFormattedDeliveryOptions(ctx, sendContext),
|
|
261
|
+
filename,
|
|
259
262
|
onDeliveryResult
|
|
260
263
|
});
|
|
261
264
|
},
|
|
262
265
|
send: async ({ text, mediaUrl, isFirst }) => {
|
|
263
266
|
if (isFirst) return await sendDiscordComponentMessageLazy(sendContext.target, componentSpec, {
|
|
264
267
|
...resolveDiscordMediaDeliveryOptions(ctx, sendContext, mediaUrl),
|
|
268
|
+
filename,
|
|
265
269
|
onDeliveryResult
|
|
266
270
|
});
|
|
267
271
|
return await sendContext.send(sendContext.target, text, {
|
|
@@ -276,29 +280,22 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
276
280
|
//#region extensions/discord/src/outbound-adapter.ts
|
|
277
281
|
const DISCORD_TEXT_CHUNK_LIMIT = 2e3;
|
|
278
282
|
const log = createSubsystemLogger("discord/outbound");
|
|
279
|
-
const loadDiscordThreadBindings = createLazyRuntimeModule(() => import("./thread-bindings-
|
|
280
|
-
const loadDiscordComponentSendRuntime = createLazyRuntimeModule(() => import("./send.components-
|
|
281
|
-
function
|
|
282
|
-
const usernameRaw = normalizeOptionalString(params.identity?.name);
|
|
283
|
-
const fallbackUsername = normalizeOptionalString(params.binding.label) ?? params.binding.agentId;
|
|
283
|
+
const loadDiscordThreadBindings = createLazyRuntimeModule(() => import("./thread-bindings-D7mcaXQC.js").then((n) => n.t));
|
|
284
|
+
const loadDiscordComponentSendRuntime = createLazyRuntimeModule(() => import("./send.components-BWVEcjRP.js").then((n) => n.i));
|
|
285
|
+
function resolveDiscordDeliveryOptions(params) {
|
|
284
286
|
return {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
+
onPlatformSendDispatch: params.onPlatformSendDispatch,
|
|
288
|
+
assertPlatformSendAuthorized: params.assertDirectAdapterHandoff,
|
|
289
|
+
onDeliveryResult: params.onDeliveryResult ? async (result) => params.onDeliveryResult?.(attachChannelToResult("discord", toDiscordOutboundDeliveryResult(result))) : void 0
|
|
287
290
|
};
|
|
288
291
|
}
|
|
289
292
|
async function maybeSendDiscordWebhookText(params) {
|
|
290
|
-
if (params.threadId == null) return null;
|
|
291
293
|
const threadId = normalizeOptionalStringifiedId(params.threadId) ?? "";
|
|
292
294
|
if (!threadId) return null;
|
|
293
295
|
const { getThreadBindingManager } = await loadDiscordThreadBindings();
|
|
294
|
-
const
|
|
295
|
-
if (!manager) return null;
|
|
296
|
-
const binding = manager.getByThreadId(threadId);
|
|
296
|
+
const binding = getThreadBindingManager(params.accountId ?? void 0)?.getByThreadId(threadId);
|
|
297
297
|
if (!binding?.webhookId || !binding?.webhookToken) return null;
|
|
298
|
-
const
|
|
299
|
-
identity: params.identity,
|
|
300
|
-
binding
|
|
301
|
-
});
|
|
298
|
+
const username = normalizeOptionalString(params.identity?.name) || normalizeOptionalString(binding.label) || binding.agentId || "";
|
|
302
299
|
const { sendWebhookMessageDiscord } = await loadDiscordSendRuntime();
|
|
303
300
|
return await sendWebhookMessageDiscord(params.text, {
|
|
304
301
|
webhookId: binding.webhookId,
|
|
@@ -307,9 +304,9 @@ async function maybeSendDiscordWebhookText(params) {
|
|
|
307
304
|
threadId: binding.threadId,
|
|
308
305
|
cfg: params.cfg,
|
|
309
306
|
replyTo: params.replyToId ?? void 0,
|
|
310
|
-
username:
|
|
311
|
-
avatarUrl:
|
|
312
|
-
|
|
307
|
+
username: truncateUtf16Safe(username, 80) || void 0,
|
|
308
|
+
avatarUrl: normalizeOptionalString(params.identity?.avatarUrl),
|
|
309
|
+
...resolveDiscordDeliveryOptions(params)
|
|
313
310
|
});
|
|
314
311
|
}
|
|
315
312
|
async function resolveDiscordOutboundMessageSend(params) {
|
|
@@ -332,10 +329,7 @@ async function resolveDiscordOutboundMessageSend(params) {
|
|
|
332
329
|
silent: params.silent ?? void 0,
|
|
333
330
|
cfg: params.cfg,
|
|
334
331
|
...resolveDiscordFormattingOptions({ formatting: params.formatting }),
|
|
335
|
-
|
|
336
|
-
await params.onDeliveryResult?.(attachChannelToResult("discord", toDiscordOutboundDeliveryResult(result)));
|
|
337
|
-
} : void 0,
|
|
338
|
-
onPlatformSendDispatch: params.onPlatformSendDispatch
|
|
332
|
+
...resolveDiscordDeliveryOptions(params)
|
|
339
333
|
}
|
|
340
334
|
};
|
|
341
335
|
}
|
|
@@ -373,42 +367,32 @@ const discordOutbound = {
|
|
|
373
367
|
...createAttachedChannelResultAdapter({
|
|
374
368
|
channel: "discord",
|
|
375
369
|
sendText: async (ctx) => {
|
|
376
|
-
if (!ctx.silent) {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
threadId: ctx.threadId,
|
|
383
|
-
accountId: ctx.accountId,
|
|
384
|
-
identity: ctx.identity,
|
|
385
|
-
replyToId: ctx.replyToId,
|
|
386
|
-
onPlatformSendDispatch: ctx.onPlatformSendDispatch ? async () => {
|
|
387
|
-
webhookSelected = true;
|
|
388
|
-
await ctx.onPlatformSendDispatch?.();
|
|
389
|
-
} : void 0
|
|
390
|
-
});
|
|
391
|
-
if (webhookResult) return toDiscordOutboundDeliveryResult(webhookResult);
|
|
392
|
-
} catch (error) {
|
|
393
|
-
if (webhookSelected) throw error;
|
|
394
|
-
log.warn("discord webhook persona send failed; falling back to bot send", { error });
|
|
395
|
-
}
|
|
370
|
+
if (!ctx.silent) try {
|
|
371
|
+
const webhookResult = await maybeSendDiscordWebhookText(ctx);
|
|
372
|
+
if (webhookResult) return toDiscordOutboundDeliveryResult(webhookResult);
|
|
373
|
+
} catch (error) {
|
|
374
|
+
if (!canFallbackDiscordWebhookSend(error)) throw error;
|
|
375
|
+
log.warn("discord webhook persona send failed; falling back to bot send", { error });
|
|
396
376
|
}
|
|
397
377
|
const { send, target, options } = await resolveDiscordOutboundMessageSend(ctx);
|
|
398
378
|
return toDiscordOutboundDeliveryResult(await send(target, ctx.text, options));
|
|
399
379
|
},
|
|
400
380
|
sendMedia: async (ctx) => {
|
|
401
381
|
const { send, target, options } = await resolveDiscordOutboundMessageSend(ctx);
|
|
402
|
-
if (ctx.audioAsVoice && ctx.mediaUrl)
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
382
|
+
if (ctx.audioAsVoice && ctx.mediaUrl) {
|
|
383
|
+
const sendVoice = resolveOutboundSendDep(ctx.deps, "discordVoice") ?? (await loadDiscordSendRuntime()).sendVoiceMessageDiscord;
|
|
384
|
+
return toDiscordOutboundDeliveryResult(await sendVoice(target, ctx.mediaUrl, {
|
|
385
|
+
cfg: ctx.cfg,
|
|
386
|
+
reply: options.reply,
|
|
387
|
+
accountId: ctx.accountId ?? void 0,
|
|
388
|
+
silent: ctx.silent ?? void 0,
|
|
389
|
+
mediaAccess: ctx.mediaAccess,
|
|
390
|
+
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
391
|
+
mediaReadFile: ctx.mediaReadFile,
|
|
392
|
+
onPlatformSendDispatch: ctx.onPlatformSendDispatch,
|
|
393
|
+
assertPlatformSendAuthorized: ctx.assertDirectAdapterHandoff
|
|
394
|
+
}));
|
|
395
|
+
}
|
|
412
396
|
const mediaOptions = {
|
|
413
397
|
...options,
|
|
414
398
|
mediaUrl: ctx.mediaUrl,
|
|
@@ -433,7 +417,7 @@ const discordOutbound = {
|
|
|
433
417
|
}
|
|
434
418
|
return toDiscordOutboundDeliveryResult(await send(target, ctx.text, mediaOptions));
|
|
435
419
|
},
|
|
436
|
-
sendPoll: async ({ cfg, to, poll, content, accountId, threadId, silent, sessionKey, inboundEventKind, onPlatformSendDispatch }) => {
|
|
420
|
+
sendPoll: async ({ cfg, to, poll, content, accountId, threadId, silent, sessionKey, inboundEventKind, onPlatformSendDispatch, assertDirectAdapterHandoff }) => {
|
|
437
421
|
if (!createDiscordActionGate({
|
|
438
422
|
cfg,
|
|
439
423
|
accountId
|
|
@@ -448,7 +432,8 @@ const discordOutbound = {
|
|
|
448
432
|
threadId: threadId ?? void 0,
|
|
449
433
|
silent: silent ?? void 0,
|
|
450
434
|
cfg,
|
|
451
|
-
onPlatformSendDispatch
|
|
435
|
+
onPlatformSendDispatch,
|
|
436
|
+
assertPlatformSendAuthorized: assertDirectAdapterHandoff
|
|
452
437
|
});
|
|
453
438
|
discordInboundEventDelivery.notify({
|
|
454
439
|
sessionKey,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h as readDiscordComponentSpec } from "./components-DmXYIQ26.js";
|
|
2
|
+
import { resolveAskUserQuestionOptionIndices } from "openclaw/plugin-sdk/reply-payload";
|
|
2
3
|
import { createLazyRuntimeModule, createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
|
|
3
4
|
//#region extensions/discord/src/outbound-components.ts
|
|
4
5
|
const DISCORD_MESSAGE_COMPONENT_LIMIT = 40;
|
|
@@ -30,11 +31,11 @@ const DISCORD_PRESENTATION_CAPABILITIES = {
|
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
};
|
|
33
|
-
const loadDiscordComponentSend = createLazyRuntimeNamedExport(() => import("./send.components-
|
|
34
|
+
const loadDiscordComponentSend = createLazyRuntimeNamedExport(() => import("./send.components-BWVEcjRP.js").then((n) => n.i), "sendDiscordComponentMessage");
|
|
34
35
|
async function sendDiscordComponentMessageLazy(...args) {
|
|
35
36
|
return await (await loadDiscordComponentSend())(...args);
|
|
36
37
|
}
|
|
37
|
-
const loadDiscordSharedInteractive = createLazyRuntimeModule(() => import("./components-
|
|
38
|
+
const loadDiscordSharedInteractive = createLazyRuntimeModule(() => import("./components-DmXYIQ26.js").then((n) => n.a));
|
|
38
39
|
function addPayloadTextFallback(spec, payload) {
|
|
39
40
|
return spec.text ? spec : {
|
|
40
41
|
...spec,
|
|
@@ -68,7 +69,7 @@ function isDiscordComponentSpecWithinMessageLimit(params) {
|
|
|
68
69
|
}) <= DISCORD_MESSAGE_COMPONENT_LIMIT;
|
|
69
70
|
}
|
|
70
71
|
async function buildDiscordPresentationPayload(params) {
|
|
71
|
-
const componentSpec = (await loadDiscordSharedInteractive()).buildDiscordPresentationComponents(params.presentation);
|
|
72
|
+
const componentSpec = (await loadDiscordSharedInteractive()).buildDiscordPresentationComponents(params.presentation, { questionOptionIndices: resolveAskUserQuestionOptionIndices(params.payload) });
|
|
72
73
|
if (!componentSpec) return null;
|
|
73
74
|
const includesMedia = Boolean(params.payload.mediaUrl || params.payload.mediaUrls?.some((mediaUrl) => mediaUrl));
|
|
74
75
|
if (!isDiscordComponentSpecWithinMessageLimit({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { c as resolveDiscordAccount, r as listDiscordAccountIds, t as createDiscordActionGate } from "./accounts-
|
|
4
|
-
import { t as inspectDiscordAccount } from "./account-inspect-
|
|
1
|
+
import { g as normalizeDiscordMessagingTarget, v as parseDiscordTarget } from "./retry-BNCxiyyR.js";
|
|
2
|
+
import { h as readDiscordComponentSpec, m as coerceDiscordComponentParam } from "./components-DmXYIQ26.js";
|
|
3
|
+
import { c as resolveDiscordAccount, r as listDiscordAccountIds, t as createDiscordActionGate } from "./accounts-CwJQoLjM.js";
|
|
4
|
+
import { t as inspectDiscordAccount } from "./account-inspect-BY-ve3yH.js";
|
|
5
5
|
import { ChannelType } from "discord-api-types/v10";
|
|
6
6
|
import { Type } from "typebox";
|
|
7
7
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -43,8 +43,9 @@ function getDiscordExecApprovalApprovers(params) {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
function isDiscordExecApprovalClientEnabled(params) {
|
|
46
|
+
const config = params.configOverride ?? resolveDiscordAccount(params).config.execApprovals;
|
|
46
47
|
return isChannelExecApprovalClientEnabledFromConfig({
|
|
47
|
-
enabled:
|
|
48
|
+
enabled: config?.enabled,
|
|
48
49
|
approverCount: getDiscordExecApprovalApprovers({
|
|
49
50
|
cfg: params.cfg,
|
|
50
51
|
accountId: params.accountId,
|
|
@@ -201,7 +202,9 @@ function withDiscordInboundEventDeliveryMetadata(payload, params) {
|
|
|
201
202
|
};
|
|
202
203
|
}
|
|
203
204
|
function notifyDiscordInboundEventOutboundPayloadSuccess(params) {
|
|
204
|
-
const
|
|
205
|
+
const channelData = asOptionalRecord(params.payload.channelData);
|
|
206
|
+
const discordData = asOptionalRecord(channelData?.discord);
|
|
207
|
+
const metadata = asOptionalRecord(discordData?.[DISCORD_INBOUND_EVENT_DELIVERY_KEY]);
|
|
205
208
|
if (!metadata) return;
|
|
206
209
|
discordInboundEventDelivery.notify({
|
|
207
210
|
sessionKey: normalizeOptionalString(metadata.sessionKey),
|
|
@@ -247,7 +250,22 @@ const localExecutionActions = /* @__PURE__ */ new Set([
|
|
|
247
250
|
function resolveDiscordActionExecutionMode({ action }) {
|
|
248
251
|
return localExecutionActions.has(action) ? "local" : "gateway";
|
|
249
252
|
}
|
|
250
|
-
|
|
253
|
+
function resolveDiscordThreadReplyDeliveryAlias(args) {
|
|
254
|
+
if (normalizeOptionalString(args.target) || normalizeOptionalString(args.to) || normalizeOptionalString(args.channelId)) return;
|
|
255
|
+
const threadId = normalizeOptionalString(args.threadId);
|
|
256
|
+
return threadId ? normalizeDiscordMessagingTarget(`channel:${threadId}`) : void 0;
|
|
257
|
+
}
|
|
258
|
+
function resolveDiscordThreadReplyTarget(args) {
|
|
259
|
+
const threadId = normalizeOptionalString(args.threadId);
|
|
260
|
+
const target = threadId !== void 0 ? `channel:${threadId}` : normalizeOptionalString(args.channelId) ?? normalizeOptionalString(args.to) ?? normalizeOptionalString(args.target);
|
|
261
|
+
return target ? normalizeDiscordMessagingTarget(target) : void 0;
|
|
262
|
+
}
|
|
263
|
+
function matchesCurrentDiscordThread(params) {
|
|
264
|
+
const requestedTarget = resolveDiscordThreadReplyTarget(params.args);
|
|
265
|
+
if (!requestedTarget) return false;
|
|
266
|
+
return [params.toolContext.currentChannelId, params.toolContext.currentMessagingTarget].some((currentTarget) => currentTarget !== void 0 && normalizeDiscordMessagingTarget(currentTarget) === requestedTarget);
|
|
267
|
+
}
|
|
268
|
+
const loadDiscordChannelActionsRuntime = createLazyRuntimeModule(() => import("./channel-actions.runtime-DMFv4doE.js"));
|
|
251
269
|
function listDiscoverableDiscordAccounts(cfg) {
|
|
252
270
|
return listDiscordAccountIds(cfg).map((accountId) => inspectDiscordAccount({
|
|
253
271
|
cfg,
|
|
@@ -344,13 +362,29 @@ function describeDiscordMessageTool({ cfg, accountId }) {
|
|
|
344
362
|
actions.add("ban");
|
|
345
363
|
}
|
|
346
364
|
if (discovery.isEnabled("presence", false)) actions.add("set-presence");
|
|
365
|
+
const schema = [];
|
|
366
|
+
if (actions.has("react")) schema.push({
|
|
367
|
+
actions: ["react", "reactions"],
|
|
368
|
+
properties: { emoji: Type.Optional(Type.String({ description: `Unicode emoji or custom name:id (also <:name:id> / <a:name:id>).${actions.has("emoji-list") ? " Use action:\"emoji-list\" for server emojis." : ""}` })) }
|
|
369
|
+
});
|
|
370
|
+
if (actions.has("send")) schema.push({
|
|
371
|
+
actions: ["send"],
|
|
372
|
+
visibility: "all-configured",
|
|
373
|
+
properties: { components: Type.Optional(Type.Object({
|
|
374
|
+
blocks: Type.Optional(Type.Array(Type.Unknown(), { description: "Discord Components V2 blocks such as text, buttons, selects, media, containers, and separators." })),
|
|
375
|
+
modal: Type.Optional(Type.Object({}, {
|
|
376
|
+
additionalProperties: true,
|
|
377
|
+
description: "Optional Discord modal triggered by generated components."
|
|
378
|
+
}))
|
|
379
|
+
}, {
|
|
380
|
+
additionalProperties: true,
|
|
381
|
+
description: "Discord Components V2 payload for send actions. Accepts the same object consumed by the Discord components adapter."
|
|
382
|
+
})) }
|
|
383
|
+
});
|
|
347
384
|
return {
|
|
348
385
|
actions: Array.from(actions),
|
|
349
386
|
capabilities: ["presentation"],
|
|
350
|
-
|
|
351
|
-
properties: { emoji: Type.Optional(Type.String({ description: `Unicode emoji or custom name:id (also <:name:id> / <a:name:id>).${actions.has("emoji-list") ? " Use action:\"emoji-list\" for server emojis." : ""}` })) },
|
|
352
|
-
actions: ["react", "reactions"]
|
|
353
|
-
} } : {}
|
|
387
|
+
schema
|
|
354
388
|
};
|
|
355
389
|
}
|
|
356
390
|
const discordMessageActions = {
|
|
@@ -358,6 +392,15 @@ const discordMessageActions = {
|
|
|
358
392
|
resolveExecutionMode: resolveDiscordActionExecutionMode,
|
|
359
393
|
describeMessageTool: describeDiscordMessageTool,
|
|
360
394
|
supportsAction: ({ action }) => action !== "poll",
|
|
395
|
+
messageActionTargetAliases: { "thread-reply": {
|
|
396
|
+
aliases: ["threadId"],
|
|
397
|
+
deliveryTargetAliases: ["threadId"],
|
|
398
|
+
resolveDeliveryTarget: ({ args }) => resolveDiscordThreadReplyDeliveryAlias(args),
|
|
399
|
+
matchesCurrentConversation: ({ args, toolContext }) => matchesCurrentDiscordThread({
|
|
400
|
+
args,
|
|
401
|
+
toolContext
|
|
402
|
+
})
|
|
403
|
+
} },
|
|
361
404
|
requiresTrustedRequesterSender: ({ action, toolContext }) => Boolean(toolContext) && isTrustedRequesterGuildAdminAction(action),
|
|
362
405
|
extractToolSend: ({ args }) => {
|
|
363
406
|
const action = normalizeOptionalString(args.action) ?? "";
|
|
@@ -374,7 +417,7 @@ const discordMessageActions = {
|
|
|
374
417
|
sessionKey: ctx.sessionKey,
|
|
375
418
|
inboundEventKind: ctx.inboundEventKind
|
|
376
419
|
});
|
|
377
|
-
const rawComponents = ctx.params.components;
|
|
420
|
+
const rawComponents = coerceDiscordComponentParam(ctx.params.components);
|
|
378
421
|
if (typeof rawComponents === "function") return null;
|
|
379
422
|
const componentSpec = rawComponents && typeof rawComponents === "object" && !Array.isArray(rawComponents) ? readDiscordComponentSpec(rawComponents) : void 0;
|
|
380
423
|
const nativeComponents = Array.isArray(rawComponents) ? rawComponents : void 0;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as resolveDiscordAccountAllowFrom } from "./accounts-
|
|
2
|
-
import { c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordCommandOwnerAllowFrom, f as resolveDiscordGuildEntry, n as isDiscordGroupAllowedByPolicy, p as resolveDiscordMemberAccessState, r as normalizeDiscordAllowList, t as allowListMatches } from "./allow-list-
|
|
1
|
+
import { l as resolveDiscordAccountAllowFrom } from "./accounts-CwJQoLjM.js";
|
|
2
|
+
import { c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordCommandOwnerAllowFrom, f as resolveDiscordGuildEntry, n as isDiscordGroupAllowedByPolicy, p as resolveDiscordMemberAccessState, r as normalizeDiscordAllowList, t as allowListMatches } from "./allow-list-C2JuH-R0.js";
|
|
3
3
|
import { resolveCommandAuthorizedFromAuthorizers } from "openclaw/plugin-sdk/command-auth-native";
|
|
4
4
|
import { resolveOpenProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
5
5
|
//#region extensions/discord/src/voice/access.ts
|
|
@@ -9,11 +9,12 @@ async function authorizeDiscordVoiceIngress(params) {
|
|
|
9
9
|
groupPolicy: params.discordConfig.groupPolicy,
|
|
10
10
|
defaultGroupPolicy: params.cfg.channels?.defaults?.groupPolicy
|
|
11
11
|
}).groupPolicy;
|
|
12
|
+
const guild = params.guild ?? {
|
|
13
|
+
id: params.guildId,
|
|
14
|
+
...params.guildName ? { name: params.guildName } : {}
|
|
15
|
+
};
|
|
12
16
|
const guildInfo = resolveDiscordGuildEntry({
|
|
13
|
-
guild
|
|
14
|
-
id: params.guildId,
|
|
15
|
-
...params.guildName ? { name: params.guildName } : {}
|
|
16
|
-
},
|
|
17
|
+
guild,
|
|
17
18
|
guildId: params.guildId,
|
|
18
19
|
guildEntries: params.discordConfig.guilds
|
|
19
20
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { sn as __exportAll } from "./retry-BNCxiyyR.js";
|
|
2
2
|
import { readProviderJsonObjectResponse, readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
|
|
3
3
|
import { resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
4
4
|
import { buildTimeoutAbortSignal } from "openclaw/plugin-sdk/extension-shared";
|
|
5
5
|
//#region extensions/discord/src/pluralkit.ts
|
|
6
6
|
var pluralkit_exports = /* @__PURE__ */ __exportAll({ fetchPluralKitMessageInfo: () => fetchPluralKitMessageInfo });
|
|
7
7
|
const PLURALKIT_API_BASE = "https://api.pluralkit.me/v2";
|
|
8
|
-
const PLURALKIT_ERROR_BODY_LIMIT_BYTES =
|
|
8
|
+
const PLURALKIT_ERROR_BODY_LIMIT_BYTES = 8192;
|
|
9
9
|
const PLURALKIT_LOOKUP_TIMEOUT_MS = 1e4;
|
|
10
10
|
async function fetchPluralKitMessageInfo(params) {
|
|
11
11
|
if (!params.config?.enabled) return null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as normalizeDiscordToken } from "./accounts-
|
|
2
|
-
import { n as DiscordApiError, r as fetchDiscord } from "./api-
|
|
1
|
+
import { m as normalizeDiscordToken } from "./accounts-CwJQoLjM.js";
|
|
2
|
+
import { n as DiscordApiError, r as fetchDiscord } from "./api-BfmEP6wp.js";
|
|
3
3
|
import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
|
|
4
4
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
5
5
|
import { resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
@@ -7,7 +7,7 @@ import { fetchWithTimeout, runChannelProbe } from "openclaw/plugin-sdk/text-util
|
|
|
7
7
|
//#region extensions/discord/src/probe.ts
|
|
8
8
|
const DISCORD_API_BASE = "https://discord.com/api/v10";
|
|
9
9
|
const DISCORD_PROBE_GET_ME_LABEL = "discord.probe.getMe";
|
|
10
|
-
const DISCORD_PROBE_JSON_MAX_BYTES =
|
|
10
|
+
const DISCORD_PROBE_JSON_MAX_BYTES = 16777216;
|
|
11
11
|
const DISCORD_PROBE_COMPLETION_RESERVE_MAX_MS = 25;
|
|
12
12
|
const DISCORD_APP_FLAG_GATEWAY_PRESENCE = 4096;
|
|
13
13
|
const DISCORD_APP_FLAG_GATEWAY_PRESENCE_LIMITED = 8192;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as probeDiscordApplicationId, i as probeDiscord, n as fetchDiscordApplicationSummary, o as resolveDiscordPrivilegedIntentsFromFlags, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-
|
|
1
|
+
import { a as probeDiscordApplicationId, i as probeDiscord, n as fetchDiscordApplicationSummary, o as resolveDiscordPrivilegedIntentsFromFlags, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-3ovFAp3b.js";
|
|
2
2
|
export { fetchDiscordApplicationId, fetchDiscordApplicationSummary, parseApplicationIdFromToken, probeDiscord, probeDiscordApplicationId, resolveDiscordPrivilegedIntentsFromFlags };
|