@openclaw/discord 2026.5.12 → 2026.5.14-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-D7jL5YDH.js → account-inspect-B_N30NV0.js} +1 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-BcwyaFd-.js → accounts-DnNVBDfc.js} +95 -4
- package/dist/action-runtime-api.js +1 -1
- package/dist/{allow-list-n8Ki-Rt3.js → allow-list-CBI-M84K.js} +24 -2
- package/dist/api.js +19 -21
- package/dist/{approval-handler.runtime-S-ircYcz.js → approval-handler.runtime-Uco62pII.js} +4 -4
- package/dist/{audit-BliEqCEc.js → audit-eSlKbMHw.js} +5 -5
- package/dist/{channel-Bliqi-Qi.js → channel-BjBa8nYY.js} +23 -25
- package/dist/{channel-actions-Cn_K00Vy.js → channel-actions-DANVAtKL.js} +4 -4
- package/dist/{channel-actions.runtime-DcsRvPnx.js → channel-actions.runtime-CpIslHS9.js} +7 -5
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-DR-xVYso.js → channel.setup-DBFcGRFD.js} +4 -5
- package/dist/{components-Dxq2mU57.js → components-Cgm7XT8-.js} +120 -3
- package/dist/{config-schema-D2KGskAp.js → config-schema-D7AtCpJa.js} +21 -1
- package/dist/contract-api.js +7 -7
- package/dist/{approval-native-Gtqpyfdj.js → conversation-identity-C3AI-1tz.js} +123 -6
- package/dist/{directory-config-CDl4JTCA.js → directory-config-CW_JusGS.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/directory-live-MrDSKsMf.js +159 -0
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{doctor-contract-BGjjFBdq.js → doctor-contract-ftWAMvBl.js} +1 -1
- package/dist/{doctor-jcX_qXsS.js → doctor-mn2XyjuF.js} +5 -5
- package/dist/{handle-action.guild-admin-C4phin-a.js → handle-action.guild-admin-DriifPwO.js} +1 -1
- package/dist/{inbound-context-jtKcY9on.js → inbound-context-DD7n3Q6U.js} +1 -1
- package/dist/{manager.runtime-DqMGETqp.js → manager.runtime-DauS2xA3.js} +107 -25
- package/dist/{message-handler-DIsnboy2.js → message-handler-CMHwRlxG.js} +7 -7
- package/dist/{message-handler.preflight-BRH-dv1o.js → message-handler.preflight-C0sT-ewp.js} +27 -17
- package/dist/{message-handler.process-Bs5wropA.js → message-handler.process-Cy7_-0H0.js} +46 -37
- package/dist/{message-utils-ByofKwPe.js → message-utils-N5UTOXQ2.js} +16 -12
- package/dist/{outbound-adapter-lWjkSeyP.js → outbound-adapter-Cw9JsRTY.js} +7 -10
- package/dist/{pluralkit-B1HTaBc9.js → pluralkit-B2AqgTHV.js} +1 -1
- package/dist/{preflight-audio-CD97vnac.js → preflight-audio-DFGpAvzi.js} +1 -1
- package/dist/{probe-BZtr8qle.js → probe-CiBYm-vD.js} +2 -2
- package/dist/{probe.runtime-0F0UzBoJ.js → probe.runtime-9hi1GYNU.js} +1 -1
- package/dist/{provider-DABvNRT0.js → provider-nzJg2k5t.js} +1039 -45
- package/dist/{provider-session.runtime-BZyP90-i.js → provider-session.runtime-DMxaLPB3.js} +3 -3
- package/dist/provider.runtime-S-wZdzK5.js +2 -0
- package/dist/{resolve-allowlist-common-CVHYb5Hb.js → resolve-allowlist-common-DybgkAjk.js} +3 -3
- package/dist/{resolve-channels-JNt3Ak6P.js → resolve-channels-u7_agBcm.js} +4 -4
- package/dist/{resolve-users-CrjbUxrL.js → resolve-users-Bc25I6OP.js} +3 -3
- package/dist/{runtime-CdnAT8R5.js → runtime-DL82ijB1.js} +102 -46
- package/dist/runtime-api.actions.js +2 -2
- package/dist/runtime-api.js +25 -26
- package/dist/runtime-api.lookup.js +6 -6
- package/dist/runtime-api.monitor-DbLcHuhE.js +5 -0
- package/dist/runtime-api.monitor.js +7 -8
- package/dist/runtime-api.send.js +5 -5
- package/dist/runtime-api.threads.js +5 -5
- package/dist/runtime-setter-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/{security-audit-BQ_sGK3J.js → security-audit-CLPZKYi4.js} +1 -1
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/{security-audit.runtime-B7Gmz2DX.js → security-audit.runtime-CCm9leFJ.js} +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/{send-DCFuSiBi.js → send-BqzTEkt9.js} +4 -6
- package/dist/{send.components-DxDqPJZQ.js → send.components-D6pXHVrU.js} +8 -10
- package/dist/{send.outbound-PM0J0F60.js → send.outbound-D8o8BW6q.js} +91 -7
- package/dist/{discord-BqYcwxvG.js → send.receipt-nKLxvA1s.js} +319 -1
- package/dist/{send.shared-Dza0jdso.js → send.shared-DSpva7uA.js} +4 -6
- package/dist/{sender-identity-w9rSI-nD.js → sender-identity-BTGL3VbF.js} +1 -1
- package/dist/session-key-api.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-Yp_M6Cfp.js → shared-0kdaIxXP.js} +16 -14
- package/dist/{subagent-hooks-CtN-hfXy.js → subagent-hooks-DhuBhwRw.js} +3 -3
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{system-events-B04UOvPg.js → system-events-Bnit0zkQ.js} +2 -2
- package/dist/{target-resolver-CgJei-kD.js → target-resolver-BsGT9hI7.js} +3 -6
- package/dist/targets-DwW6OieO.js +3 -0
- package/dist/test-api.js +4 -4
- package/dist/{thread-bindings-B4of4OmR.js → thread-bindings-C1f7Iim4.js} +6 -7
- package/dist/{thread-bindings.discord-api-BAw15EQb.js → thread-bindings.discord-api-DJACBZJ1.js} +67 -8
- package/dist/{thread-bindings.manager-DNFl10CA.js → thread-bindings.manager-DN_q0IW7.js} +4 -5
- package/dist/{thread-bindings.session-updates-D18cCLmN.js → thread-bindings.session-updates-ZnRRzzgf.js} +1 -1
- package/dist/timeouts.js +1 -1
- package/dist/{typing-_jePdFIw.js → typing-C_8U8J7E.js} +2 -2
- package/openclaw.plugin.json +68 -0
- package/package.json +6 -6
- package/dist/access-Dxmzr0ix.js +0 -89
- package/dist/approval-shared-BFnWKSQD.js +0 -93
- package/dist/channel-access-BL-wemES.js +0 -62
- package/dist/chunk-DYl-_5RL.js +0 -179
- package/dist/conversation-identity-CvIx6J7M.js +0 -31
- package/dist/directory-cache-Ddl-Oxue.js +0 -62
- package/dist/directory-live-ApUXOSj0.js +0 -101
- package/dist/doctor-shared-D_QLzu30.js +0 -4
- package/dist/format-D8TsaXxW.js +0 -24
- package/dist/mentions-BZoGn0ul.js +0 -88
- package/dist/normalize-Cu94FOqy.js +0 -58
- package/dist/outbound-session-route-BaJRt05p.js +0 -43
- package/dist/provider.runtime-Cmv1SFtb.js +0 -2
- package/dist/reply-delivery-CUSK6SA_.js +0 -191
- package/dist/route-resolution-BFfF9xmG.js +0 -268
- package/dist/runtime-api.monitor-W_dJ5EQu.js +0 -6
- package/dist/send.receipt-BAZw2Zsz.js +0 -35
- package/dist/shared-interactive-DavY6jYt.js +0 -79
- package/dist/target-parsing-D-H7nnh2.js +0 -51
- package/dist/targets-DToZUkgV.js +0 -3
- package/dist/threading-CLZ3v7-y.js +0 -475
- package/dist/token-BZtonk7d.js +0 -93
- /package/dist/{agent-components.runtime-zT8qPsnM.js → agent-components.runtime-CEMbMQcQ.js} +0 -0
- /package/dist/{api-DzNBVTto.js → api-DgQLz1wq.js} +0 -0
- /package/dist/{audit-core-BgDZSkIR.js → audit-core-DRyoXREU.js} +0 -0
- /package/dist/{channel-api-CTSWMrnD.js → channel-api-JudoSiJv.js} +0 -0
- /package/dist/{config-api-CFZtoMaS.js → config-api-oLS_52S7.js} +0 -0
- /package/dist/{gateway-registry-BKG4KIVC.js → gateway-registry-BKSpa4GB.js} +0 -0
- /package/dist/{preflight-audio.runtime-fXnUxxBa.js → preflight-audio.runtime-Drc-OFcp.js} +0 -0
- /package/dist/{preview-streaming-DCPAe24T.js → preview-streaming-CXTZydhx.js} +0 -0
- /package/dist/{runtime-BqCoo-zp.js → runtime-Tqtvj5GX.js} +0 -0
- /package/dist/{secret-config-contract-BCQNNS7N.js → secret-config-contract-B3347_eU.js} +0 -0
- /package/dist/{security-contract-DkCMKSvb.js → security-contract-DyCRvz_Q.js} +0 -0
- /package/dist/{security-doctor-BJH5YIGL.js → security-doctor-Cp-NqNdS.js} +0 -0
- /package/dist/{session-contract-D871HDFG.js → session-contract-ugfEa9Xc.js} +0 -0
- /package/dist/{session-key-normalization-BV82IME9.js → session-key-normalization-B7h83qD2.js} +0 -0
- /package/dist/{thread-bindings.state-SPlv6mh7.js → thread-bindings.state-BdBeo7Rx.js} +0 -0
- /package/dist/{timeouts-C3FYXWJX.js → timeouts-snXNwR4m.js} +0 -0
|
@@ -1,15 +1,99 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { s as resolveDiscordAccount } from "./accounts-
|
|
3
|
-
import { A as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
1
|
+
import { ct as createThread, n as createDiscordSendResult, st as createChannelMessage } from "./send.receipt-nKLxvA1s.js";
|
|
2
|
+
import { s as resolveDiscordAccount } from "./accounts-DnNVBDfc.js";
|
|
3
|
+
import { A as parseAndResolveRecipient, _ as resolveDiscordSendComponents, a as normalizeDiscordPollInput, c as normalizeStickerIds, f as sendDiscordMedia, g as buildDiscordMessageRequest, h as SUPPRESS_NOTIFICATIONS_FLAG, j as createDiscordClient, l as resolveChannelId, n as buildDiscordTextChunks, p as sendDiscordText, t as buildDiscordSendError, u as resolveDiscordChannelType, v as resolveDiscordSendEmbeds } from "./send.shared-DSpva7uA.js";
|
|
4
|
+
import { a as resolveDiscordDirectoryUserId } from "./directory-live-MrDSKsMf.js";
|
|
5
|
+
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
6
|
import { ChannelType } from "discord-api-types/v10";
|
|
8
7
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
9
8
|
import { resolveChunkMode } from "openclaw/plugin-sdk/reply-chunking";
|
|
10
9
|
import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runtime";
|
|
11
10
|
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
12
11
|
import { convertMarkdownTables } from "openclaw/plugin-sdk/text-chunking";
|
|
12
|
+
//#region extensions/discord/src/mentions.ts
|
|
13
|
+
const MARKDOWN_CODE_SEGMENT_PATTERN = /```[\s\S]*?```|`[^`\n]*`/g;
|
|
14
|
+
const MENTION_CANDIDATE_PATTERN = /(^|[\s([{"'.,;:!?])@([a-z0-9_.-]{2,32}(?:#[0-9]{4})?)/gi;
|
|
15
|
+
const DISCORD_RESERVED_MENTIONS = new Set(["everyone", "here"]);
|
|
16
|
+
const DISCORD_DISCRIMINATOR_SUFFIX = /#\d{4}$/;
|
|
17
|
+
function normalizeSnowflake(value) {
|
|
18
|
+
const text = normalizeOptionalStringifiedId(value) ?? "";
|
|
19
|
+
if (!/^\d+$/.test(text)) return null;
|
|
20
|
+
return text;
|
|
21
|
+
}
|
|
22
|
+
function formatMention(params) {
|
|
23
|
+
const userId = params.userId == null ? null : normalizeSnowflake(params.userId);
|
|
24
|
+
const roleId = params.roleId == null ? null : normalizeSnowflake(params.roleId);
|
|
25
|
+
const channelId = params.channelId == null ? null : normalizeSnowflake(params.channelId);
|
|
26
|
+
const values = [
|
|
27
|
+
userId ? {
|
|
28
|
+
kind: "user",
|
|
29
|
+
id: userId
|
|
30
|
+
} : null,
|
|
31
|
+
roleId ? {
|
|
32
|
+
kind: "role",
|
|
33
|
+
id: roleId
|
|
34
|
+
} : null,
|
|
35
|
+
channelId ? {
|
|
36
|
+
kind: "channel",
|
|
37
|
+
id: channelId
|
|
38
|
+
} : null
|
|
39
|
+
].filter((entry) => Boolean(entry));
|
|
40
|
+
if (values.length !== 1) throw new Error("formatMention requires exactly one of userId, roleId, or channelId");
|
|
41
|
+
const target = values[0];
|
|
42
|
+
if (target.kind === "user") return `<@${target.id}>`;
|
|
43
|
+
if (target.kind === "role") return `<@&${target.id}>`;
|
|
44
|
+
return `<#${target.id}>`;
|
|
45
|
+
}
|
|
46
|
+
function normalizeHandleKey(raw) {
|
|
47
|
+
let handle = normalizeOptionalString(raw) ?? "";
|
|
48
|
+
if (!handle) return null;
|
|
49
|
+
if (handle.startsWith("@")) handle = normalizeOptionalString(handle.slice(1)) ?? "";
|
|
50
|
+
if (!handle || /\s/.test(handle)) return null;
|
|
51
|
+
return normalizeLowercaseStringOrEmpty(handle);
|
|
52
|
+
}
|
|
53
|
+
function resolveConfiguredMentionAlias(handle, mentionAliases) {
|
|
54
|
+
const key = normalizeHandleKey(handle);
|
|
55
|
+
if (!key || !mentionAliases) return;
|
|
56
|
+
const withoutDiscriminator = key.replace(DISCORD_DISCRIMINATOR_SUFFIX, "");
|
|
57
|
+
for (const [rawAlias, rawUserId] of Object.entries(mentionAliases)) {
|
|
58
|
+
const alias = normalizeHandleKey(rawAlias);
|
|
59
|
+
if (!alias) continue;
|
|
60
|
+
const aliasWithoutDiscriminator = alias.replace(DISCORD_DISCRIMINATOR_SUFFIX, "");
|
|
61
|
+
if (alias === key || withoutDiscriminator && withoutDiscriminator !== key && alias === withoutDiscriminator || aliasWithoutDiscriminator && aliasWithoutDiscriminator !== alias && aliasWithoutDiscriminator === key) {
|
|
62
|
+
const userId = normalizeSnowflake(rawUserId);
|
|
63
|
+
if (userId) return userId;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function rewritePlainTextMentions(text, params) {
|
|
68
|
+
if (!text.includes("@")) return text;
|
|
69
|
+
return text.replace(MENTION_CANDIDATE_PATTERN, (match, prefix, rawHandle) => {
|
|
70
|
+
const handle = normalizeOptionalString(rawHandle) ?? "";
|
|
71
|
+
if (!handle) return match;
|
|
72
|
+
const lookup = normalizeLowercaseStringOrEmpty(handle);
|
|
73
|
+
if (DISCORD_RESERVED_MENTIONS.has(lookup)) return match;
|
|
74
|
+
const userId = resolveConfiguredMentionAlias(handle, params.mentionAliases) ?? resolveDiscordDirectoryUserId({
|
|
75
|
+
accountId: params.accountId,
|
|
76
|
+
handle
|
|
77
|
+
});
|
|
78
|
+
if (!userId) return match;
|
|
79
|
+
return `${String(prefix ?? "")}${formatMention({ userId })}`;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function rewriteDiscordKnownMentions(text, params) {
|
|
83
|
+
if (!text.includes("@")) return text;
|
|
84
|
+
let rewritten = "";
|
|
85
|
+
let offset = 0;
|
|
86
|
+
MARKDOWN_CODE_SEGMENT_PATTERN.lastIndex = 0;
|
|
87
|
+
for (const match of text.matchAll(MARKDOWN_CODE_SEGMENT_PATTERN)) {
|
|
88
|
+
const matchIndex = match.index ?? 0;
|
|
89
|
+
rewritten += rewritePlainTextMentions(text.slice(offset, matchIndex), params);
|
|
90
|
+
rewritten += match[0];
|
|
91
|
+
offset = matchIndex + match[0].length;
|
|
92
|
+
}
|
|
93
|
+
rewritten += rewritePlainTextMentions(text.slice(offset), params);
|
|
94
|
+
return rewritten;
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
13
97
|
//#region extensions/discord/src/send.outbound.ts
|
|
14
98
|
const DEFAULT_DISCORD_MEDIA_MAX_MB = 100;
|
|
15
99
|
async function sendDiscordThreadTextChunks(params) {
|
|
@@ -220,4 +304,4 @@ async function resolveDiscordStructuredSendContext(to, opts) {
|
|
|
220
304
|
};
|
|
221
305
|
}
|
|
222
306
|
//#endregion
|
|
223
|
-
export { sendPollDiscord as n, sendStickerDiscord as r, sendMessageDiscord as t };
|
|
307
|
+
export { rewriteDiscordKnownMentions as a, formatMention as i, sendPollDiscord as n, sendStickerDiscord as r, sendMessageDiscord as t };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
+
import { buildMessagingTarget, parseMentionPrefixOrAtUserTarget, requireTargetKind } from "openclaw/plugin-sdk/messaging-targets";
|
|
2
3
|
import { ApplicationCommandOptionType, ApplicationCommandType, ButtonStyle, ComponentType, GatewayDispatchEvents, InteractionContextType, InteractionResponseType, InteractionType, MessageFlags, Routes, TextInputStyle } from "discord-api-types/v10";
|
|
3
4
|
import { createHash, randomBytes } from "node:crypto";
|
|
4
5
|
import path from "node:path";
|
|
@@ -6,6 +7,8 @@ import { privateFileStore } from "openclaw/plugin-sdk/security-runtime";
|
|
|
6
7
|
import { Type } from "typebox";
|
|
7
8
|
import { Check } from "typebox/value";
|
|
8
9
|
import { inspect } from "node:util";
|
|
10
|
+
import { chunkMarkdownTextWithMode } from "openclaw/plugin-sdk/reply-chunking";
|
|
11
|
+
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-message";
|
|
9
12
|
//#region \0rolldown/runtime.js
|
|
10
13
|
var __defProp = Object.defineProperty;
|
|
11
14
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -32,6 +35,55 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
32
35
|
};
|
|
33
36
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
34
37
|
//#endregion
|
|
38
|
+
//#region extensions/discord/src/target-parsing.ts
|
|
39
|
+
function parseDiscordTarget(raw, options = {}) {
|
|
40
|
+
const trimmed = raw.trim();
|
|
41
|
+
if (!trimmed) return;
|
|
42
|
+
const providerPrefixedTarget = parseDiscordProviderPrefixedTarget(trimmed);
|
|
43
|
+
if (providerPrefixedTarget) return providerPrefixedTarget;
|
|
44
|
+
const userTarget = parseMentionPrefixOrAtUserTarget({
|
|
45
|
+
raw: trimmed,
|
|
46
|
+
mentionPattern: /^<@!?(\d+)>$/,
|
|
47
|
+
prefixes: [
|
|
48
|
+
{
|
|
49
|
+
prefix: "user:",
|
|
50
|
+
kind: "user"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
prefix: "channel:",
|
|
54
|
+
kind: "channel"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
prefix: "discord:",
|
|
58
|
+
kind: "user"
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
atUserPattern: /^\d+$/,
|
|
62
|
+
atUserErrorMessage: "Discord DMs require a user id (use user:<id> or a <@id> mention)"
|
|
63
|
+
});
|
|
64
|
+
if (userTarget) return userTarget;
|
|
65
|
+
if (/^\d+$/.test(trimmed)) {
|
|
66
|
+
if (options.defaultKind) return buildMessagingTarget(options.defaultKind, trimmed, trimmed);
|
|
67
|
+
throw new Error(options.ambiguousMessage ?? `Ambiguous Discord recipient "${trimmed}". For DMs use "user:${trimmed}" or "<@${trimmed}>"; for channels use "channel:${trimmed}".`);
|
|
68
|
+
}
|
|
69
|
+
return buildMessagingTarget("channel", trimmed, trimmed);
|
|
70
|
+
}
|
|
71
|
+
function parseDiscordProviderPrefixedTarget(raw) {
|
|
72
|
+
const match = /^discord:(channel|user):(.+)$/i.exec(raw);
|
|
73
|
+
if (!match) return;
|
|
74
|
+
const kind = match[1]?.toLowerCase();
|
|
75
|
+
const id = match[2]?.trim();
|
|
76
|
+
if (!kind || !id) return;
|
|
77
|
+
return buildMessagingTarget(kind, id, `${kind}:${id}`);
|
|
78
|
+
}
|
|
79
|
+
function resolveDiscordChannelId(raw) {
|
|
80
|
+
return requireTargetKind({
|
|
81
|
+
platform: "Discord",
|
|
82
|
+
target: parseDiscordTarget(raw, { defaultKind: "channel" }),
|
|
83
|
+
kind: "channel"
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
35
87
|
//#region extensions/discord/src/internal/api.commands.ts
|
|
36
88
|
async function listApplicationCommands(rest, clientId) {
|
|
37
89
|
return await rest.get(Routes.applicationCommands(clientId));
|
|
@@ -2798,4 +2850,270 @@ var discord_exports = /* @__PURE__ */ __exportAll({
|
|
|
2798
2850
|
import * as import_discord_api_types_v10 from "discord-api-types/v10";
|
|
2799
2851
|
__reExport(discord_exports, import_discord_api_types_v10);
|
|
2800
2852
|
//#endregion
|
|
2801
|
-
|
|
2853
|
+
//#region extensions/discord/src/chunk.ts
|
|
2854
|
+
const DEFAULT_MAX_CHARS = 2e3;
|
|
2855
|
+
const DEFAULT_MAX_LINES = 17;
|
|
2856
|
+
const FENCE_RE = /^( {0,3})(`{3,}|~{3,})(.*)$/;
|
|
2857
|
+
const CJK_PUNCTUATION_BREAK_AFTER_RE = /[、。,.!?;:)]}〉》」』】〕〗〙]/u;
|
|
2858
|
+
function countLines(text) {
|
|
2859
|
+
if (!text) return 0;
|
|
2860
|
+
return text.split("\n").length;
|
|
2861
|
+
}
|
|
2862
|
+
function parseFenceLine(line) {
|
|
2863
|
+
const match = line.match(FENCE_RE);
|
|
2864
|
+
if (!match) return null;
|
|
2865
|
+
const indent = match[1] ?? "";
|
|
2866
|
+
const marker = match[2] ?? "";
|
|
2867
|
+
return {
|
|
2868
|
+
indent,
|
|
2869
|
+
markerChar: marker[0] ?? "`",
|
|
2870
|
+
markerLen: marker.length,
|
|
2871
|
+
openLine: line
|
|
2872
|
+
};
|
|
2873
|
+
}
|
|
2874
|
+
function closeFenceLine(openFence) {
|
|
2875
|
+
return `${openFence.indent}${openFence.markerChar.repeat(openFence.markerLen)}`;
|
|
2876
|
+
}
|
|
2877
|
+
function closeFenceIfNeeded(text, openFence) {
|
|
2878
|
+
if (!openFence) return text;
|
|
2879
|
+
const closeLine = closeFenceLine(openFence);
|
|
2880
|
+
if (!text) return closeLine;
|
|
2881
|
+
if (!text.endsWith("\n")) return `${text}\n${closeLine}`;
|
|
2882
|
+
return `${text}${closeLine}`;
|
|
2883
|
+
}
|
|
2884
|
+
function isHighSurrogate(code) {
|
|
2885
|
+
return code >= 55296 && code <= 56319;
|
|
2886
|
+
}
|
|
2887
|
+
function isLowSurrogate(code) {
|
|
2888
|
+
return code >= 56320 && code <= 57343;
|
|
2889
|
+
}
|
|
2890
|
+
function clampToCodePointBoundary(text, index) {
|
|
2891
|
+
const boundary = Math.min(Math.max(0, index), text.length);
|
|
2892
|
+
if (boundary <= 0 || boundary >= text.length) return boundary;
|
|
2893
|
+
const previous = text.charCodeAt(boundary - 1);
|
|
2894
|
+
const next = text.charCodeAt(boundary);
|
|
2895
|
+
if (isHighSurrogate(previous) && isLowSurrogate(next)) return boundary > 1 ? boundary - 1 : boundary + 1;
|
|
2896
|
+
return boundary;
|
|
2897
|
+
}
|
|
2898
|
+
function findWhitespaceBreak(window) {
|
|
2899
|
+
for (let i = window.length - 1; i >= 0; i--) if (/\s/.test(window[i])) return i;
|
|
2900
|
+
return -1;
|
|
2901
|
+
}
|
|
2902
|
+
function findCjkPunctuationBreak(window) {
|
|
2903
|
+
for (let end = window.length; end > 0;) {
|
|
2904
|
+
const start = isLowSurrogate(window.charCodeAt(end - 1)) && end > 1 ? end - 2 : end - 1;
|
|
2905
|
+
const char = window.slice(start, end);
|
|
2906
|
+
if (start > 0 && CJK_PUNCTUATION_BREAK_AFTER_RE.test(char)) return end;
|
|
2907
|
+
end = start;
|
|
2908
|
+
}
|
|
2909
|
+
return -1;
|
|
2910
|
+
}
|
|
2911
|
+
function splitLongLine(line, maxChars, opts) {
|
|
2912
|
+
const limit = Math.max(1, Math.floor(maxChars));
|
|
2913
|
+
if (line.length <= limit) return [line];
|
|
2914
|
+
const out = [];
|
|
2915
|
+
let remaining = line;
|
|
2916
|
+
while (remaining.length > limit) {
|
|
2917
|
+
if (opts.preserveWhitespace) {
|
|
2918
|
+
const breakIdx = clampToCodePointBoundary(remaining, limit);
|
|
2919
|
+
out.push(remaining.slice(0, breakIdx));
|
|
2920
|
+
remaining = remaining.slice(breakIdx);
|
|
2921
|
+
continue;
|
|
2922
|
+
}
|
|
2923
|
+
const window = remaining.slice(0, limit);
|
|
2924
|
+
let breakIdx = findWhitespaceBreak(window);
|
|
2925
|
+
if (breakIdx <= 0) breakIdx = findCjkPunctuationBreak(window);
|
|
2926
|
+
if (breakIdx <= 0) breakIdx = clampToCodePointBoundary(remaining, limit);
|
|
2927
|
+
out.push(remaining.slice(0, breakIdx));
|
|
2928
|
+
remaining = remaining.slice(breakIdx);
|
|
2929
|
+
}
|
|
2930
|
+
if (remaining.length) out.push(remaining);
|
|
2931
|
+
return out;
|
|
2932
|
+
}
|
|
2933
|
+
/**
|
|
2934
|
+
* Chunks outbound Discord text by both character count and (soft) line count,
|
|
2935
|
+
* while keeping fenced code blocks balanced across chunks.
|
|
2936
|
+
*/
|
|
2937
|
+
function chunkDiscordText(text, opts = {}) {
|
|
2938
|
+
const maxChars = Math.max(1, Math.floor(opts.maxChars ?? DEFAULT_MAX_CHARS));
|
|
2939
|
+
const maxLines = Math.max(1, Math.floor(opts.maxLines ?? DEFAULT_MAX_LINES));
|
|
2940
|
+
const body = text ?? "";
|
|
2941
|
+
if (!body) return [];
|
|
2942
|
+
if (body.length <= maxChars && countLines(body) <= maxLines) return [body];
|
|
2943
|
+
const lines = body.split("\n");
|
|
2944
|
+
const chunks = [];
|
|
2945
|
+
let current = "";
|
|
2946
|
+
let currentLines = 0;
|
|
2947
|
+
let openFence = null;
|
|
2948
|
+
const flush = () => {
|
|
2949
|
+
if (!current) return;
|
|
2950
|
+
const payload = closeFenceIfNeeded(current, openFence);
|
|
2951
|
+
if (payload.trim().length) chunks.push(payload);
|
|
2952
|
+
current = "";
|
|
2953
|
+
currentLines = 0;
|
|
2954
|
+
if (openFence) {
|
|
2955
|
+
current = openFence.openLine;
|
|
2956
|
+
currentLines = 1;
|
|
2957
|
+
}
|
|
2958
|
+
};
|
|
2959
|
+
for (const originalLine of lines) {
|
|
2960
|
+
const fenceInfo = parseFenceLine(originalLine);
|
|
2961
|
+
const wasInsideFence = openFence !== null;
|
|
2962
|
+
let nextOpenFence = openFence;
|
|
2963
|
+
if (fenceInfo) {
|
|
2964
|
+
if (!openFence) nextOpenFence = fenceInfo;
|
|
2965
|
+
else if (openFence.markerChar === fenceInfo.markerChar && fenceInfo.markerLen >= openFence.markerLen) nextOpenFence = null;
|
|
2966
|
+
}
|
|
2967
|
+
const reserveChars = nextOpenFence ? closeFenceLine(nextOpenFence).length + 1 : 0;
|
|
2968
|
+
const reserveLines = nextOpenFence ? 1 : 0;
|
|
2969
|
+
const effectiveMaxChars = maxChars - reserveChars;
|
|
2970
|
+
const effectiveMaxLines = maxLines - reserveLines;
|
|
2971
|
+
const charLimit = effectiveMaxChars > 0 ? effectiveMaxChars : maxChars;
|
|
2972
|
+
const lineLimit = effectiveMaxLines > 0 ? effectiveMaxLines : maxLines;
|
|
2973
|
+
const prefixLen = current.length > 0 ? current.length + 1 : 0;
|
|
2974
|
+
const segments = splitLongLine(originalLine, Math.max(1, charLimit - prefixLen), { preserveWhitespace: wasInsideFence });
|
|
2975
|
+
for (let segIndex = 0; segIndex < segments.length; segIndex++) {
|
|
2976
|
+
const segment = segments[segIndex];
|
|
2977
|
+
const isLineContinuation = segIndex > 0;
|
|
2978
|
+
const addition = `${isLineContinuation ? "" : current.length > 0 ? "\n" : ""}${segment}`;
|
|
2979
|
+
const nextLen = current.length + addition.length;
|
|
2980
|
+
const nextLines = currentLines + (isLineContinuation ? 0 : 1);
|
|
2981
|
+
if ((nextLen > charLimit || nextLines > lineLimit) && current.length > 0) flush();
|
|
2982
|
+
if (current.length > 0) {
|
|
2983
|
+
current += addition;
|
|
2984
|
+
if (!isLineContinuation) currentLines += 1;
|
|
2985
|
+
} else {
|
|
2986
|
+
current = segment;
|
|
2987
|
+
currentLines = 1;
|
|
2988
|
+
}
|
|
2989
|
+
}
|
|
2990
|
+
openFence = nextOpenFence;
|
|
2991
|
+
}
|
|
2992
|
+
if (current.length) {
|
|
2993
|
+
const payload = closeFenceIfNeeded(current, openFence);
|
|
2994
|
+
if (payload.trim().length) chunks.push(payload);
|
|
2995
|
+
}
|
|
2996
|
+
return rebalanceReasoningItalics(text, chunks);
|
|
2997
|
+
}
|
|
2998
|
+
function chunkDiscordTextWithMode(text, opts) {
|
|
2999
|
+
if ((opts.chunkMode ?? "length") !== "newline") return chunkDiscordText(text, opts);
|
|
3000
|
+
const lineChunks = chunkMarkdownTextWithMode(text, Math.max(1, Math.floor(opts.maxChars ?? DEFAULT_MAX_CHARS)), "newline");
|
|
3001
|
+
const chunks = [];
|
|
3002
|
+
for (const line of lineChunks) {
|
|
3003
|
+
const nested = chunkDiscordText(line, opts);
|
|
3004
|
+
if (!nested.length && line) {
|
|
3005
|
+
chunks.push(line);
|
|
3006
|
+
continue;
|
|
3007
|
+
}
|
|
3008
|
+
chunks.push(...nested);
|
|
3009
|
+
}
|
|
3010
|
+
return chunks;
|
|
3011
|
+
}
|
|
3012
|
+
function rebalanceReasoningItalics(source, chunks) {
|
|
3013
|
+
if (chunks.length <= 1) return chunks;
|
|
3014
|
+
if (!(source.startsWith("Reasoning:\n_") && source.trimEnd().endsWith("_"))) return chunks;
|
|
3015
|
+
const adjusted = [...chunks];
|
|
3016
|
+
for (let i = 0; i < adjusted.length; i++) {
|
|
3017
|
+
const isLast = i === adjusted.length - 1;
|
|
3018
|
+
const current = adjusted[i];
|
|
3019
|
+
if (!current.trimEnd().endsWith("_")) adjusted[i] = `${current}_`;
|
|
3020
|
+
if (isLast) break;
|
|
3021
|
+
const next = adjusted[i + 1];
|
|
3022
|
+
const leadingWhitespaceLen = next.length - next.trimStart().length;
|
|
3023
|
+
const leadingWhitespace = next.slice(0, leadingWhitespaceLen);
|
|
3024
|
+
const nextBody = next.slice(leadingWhitespaceLen);
|
|
3025
|
+
if (!nextBody.startsWith("_")) adjusted[i + 1] = `${leadingWhitespace}_${nextBody}`;
|
|
3026
|
+
}
|
|
3027
|
+
return adjusted;
|
|
3028
|
+
}
|
|
3029
|
+
//#endregion
|
|
3030
|
+
//#region extensions/discord/src/normalize.ts
|
|
3031
|
+
function normalizeDiscordMessagingTarget(raw) {
|
|
3032
|
+
return parseDiscordTarget(raw, { defaultKind: "channel" })?.normalized;
|
|
3033
|
+
}
|
|
3034
|
+
/**
|
|
3035
|
+
* Normalize a Discord outbound target for delivery. Bare numeric IDs are
|
|
3036
|
+
* prefixed with "channel:" to avoid the ambiguous-target error in
|
|
3037
|
+
* parseDiscordTarget, unless the ID is explicitly configured as an allowed DM
|
|
3038
|
+
* sender. All other formats pass through unchanged.
|
|
3039
|
+
*/
|
|
3040
|
+
function normalizeDiscordOutboundTarget(to, allowFrom) {
|
|
3041
|
+
const trimmed = to?.trim();
|
|
3042
|
+
if (!trimmed) return {
|
|
3043
|
+
ok: false,
|
|
3044
|
+
error: /* @__PURE__ */ new Error("Discord recipient is required. Use \"channel:<id>\" for channels or \"user:<id>\" for DMs.")
|
|
3045
|
+
};
|
|
3046
|
+
if (/^\d+$/.test(trimmed)) {
|
|
3047
|
+
if (allowFromContainsDiscordUserId(allowFrom, trimmed)) return {
|
|
3048
|
+
ok: true,
|
|
3049
|
+
to: `user:${trimmed}`
|
|
3050
|
+
};
|
|
3051
|
+
return {
|
|
3052
|
+
ok: true,
|
|
3053
|
+
to: `channel:${trimmed}`
|
|
3054
|
+
};
|
|
3055
|
+
}
|
|
3056
|
+
return {
|
|
3057
|
+
ok: true,
|
|
3058
|
+
to: trimmed
|
|
3059
|
+
};
|
|
3060
|
+
}
|
|
3061
|
+
function allowFromContainsDiscordUserId(allowFrom, userId) {
|
|
3062
|
+
const normalizedUserId = userId.trim();
|
|
3063
|
+
if (!normalizedUserId) return false;
|
|
3064
|
+
return (allowFrom ?? []).some((entry) => normalizeAllowFromDiscordUserId(entry) === normalizedUserId);
|
|
3065
|
+
}
|
|
3066
|
+
function normalizeAllowFromDiscordUserId(entry) {
|
|
3067
|
+
const trimmed = entry.trim().toLowerCase();
|
|
3068
|
+
if (!trimmed || trimmed === "*") return;
|
|
3069
|
+
const mentionMatch = /^<@!?(\d+)>$/.exec(trimmed);
|
|
3070
|
+
if (mentionMatch) return mentionMatch[1];
|
|
3071
|
+
const prefixedMatch = /^(?:discord:)?user:(\d+)$/.exec(trimmed);
|
|
3072
|
+
if (prefixedMatch) return prefixedMatch[1];
|
|
3073
|
+
const discordMatch = /^discord:(\d+)$/.exec(trimmed);
|
|
3074
|
+
if (discordMatch) return discordMatch[1];
|
|
3075
|
+
return /^\d+$/.test(trimmed) ? trimmed : void 0;
|
|
3076
|
+
}
|
|
3077
|
+
function looksLikeDiscordTargetId(raw) {
|
|
3078
|
+
const trimmed = raw.trim();
|
|
3079
|
+
if (!trimmed) return false;
|
|
3080
|
+
if (/^<@!?\d+>$/.test(trimmed)) return true;
|
|
3081
|
+
if (/^(user|channel|discord):/i.test(trimmed)) return true;
|
|
3082
|
+
if (/^\d{6,}$/.test(trimmed)) return true;
|
|
3083
|
+
return false;
|
|
3084
|
+
}
|
|
3085
|
+
//#endregion
|
|
3086
|
+
//#region extensions/discord/src/send.receipt.ts
|
|
3087
|
+
function createDiscordSendReceipt(params) {
|
|
3088
|
+
return createMessageReceiptFromOutboundResults({
|
|
3089
|
+
results: params.platformMessageIds.map((messageId) => messageId.trim()).filter((messageId) => messageId && messageId !== "unknown").map((messageId) => {
|
|
3090
|
+
const result = {
|
|
3091
|
+
channel: "discord",
|
|
3092
|
+
messageId
|
|
3093
|
+
};
|
|
3094
|
+
if (params.channelId) result.channelId = params.channelId;
|
|
3095
|
+
return result;
|
|
3096
|
+
}),
|
|
3097
|
+
kind: params.kind,
|
|
3098
|
+
threadId: params.threadId,
|
|
3099
|
+
replyToId: params.replyToId
|
|
3100
|
+
});
|
|
3101
|
+
}
|
|
3102
|
+
function createDiscordSendResult(params) {
|
|
3103
|
+
const messageId = params.result.id || "unknown";
|
|
3104
|
+
const channelId = params.result.channel_id ?? params.fallbackChannelId;
|
|
3105
|
+
const receiptParams = {
|
|
3106
|
+
platformMessageIds: params.result.platformMessageIds?.length ? params.result.platformMessageIds : [messageId],
|
|
3107
|
+
channelId,
|
|
3108
|
+
kind: params.kind
|
|
3109
|
+
};
|
|
3110
|
+
if (params.threadId != null) receiptParams.threadId = String(params.threadId);
|
|
3111
|
+
if (params.replyToId) receiptParams.replyToId = params.replyToId;
|
|
3112
|
+
return {
|
|
3113
|
+
messageId,
|
|
3114
|
+
channelId,
|
|
3115
|
+
receipt: createDiscordSendReceipt(receiptParams)
|
|
3116
|
+
};
|
|
3117
|
+
}
|
|
3118
|
+
//#endregion
|
|
3119
|
+
export { BaseMessageInteractiveComponent as $, Message as A, getGuildMember as At, Container as B, removeGuildMemberRole as Bt, RateLimitError as C, createGuildBan as Ct, Command as D, createGuildSticker as Dt, readRetryAfter as E, createGuildScheduledEvent as Et, Modal as F, listGuildRoles as Ft, RoleSelectMenu as G, LinkButton as H, parseDiscordTarget as Ht, RadioGroup as I, listGuildScheduledEvents as It, Separator as J, Row as K, TextInput as L, moveGuildChannels as Lt, serializePayload as M, listGuildActiveThreads as Mt, CheckboxGroup as N, listGuildChannels as Nt, CommandWithSubcommands as O, deleteChannelPermission as Ot, Label as P, listGuildEmojis as Pt, UserSelectMenu as Q, Button as R, putChannelPermission as Rt, DiscordError as S, addGuildMemberRole as St, readDiscordMessage as T, createGuildEmoji as Tt, MediaGallery as U, resolveDiscordChannelId as Ut, File as V, timeoutGuildMember as Vt, MentionableSelectMenu as W, __exportAll as Wt, TextDisplay as X, StringSelectMenu as Y, Thumbnail as Z, VoiceStateUpdateListener as _, listChannelPins as _t, normalizeDiscordMessagingTarget as a, deleteOwnMessageReaction as at, Plugin as b, sendChannelTyping as bt, discord_exports as c, createThread as ct, MessageReactionAddListener as d, editChannel as dt, parseCustomId as et, MessageReactionRemoveListener as f, editChannelMessage as ft, ThreadUpdateListener as g, listChannelMessages as gt, ResumedListener as h, listChannelArchivedThreads as ht, looksLikeDiscordTargetId as i, createOwnMessageReaction as it, User as j, getGuildVoiceState as jt, Guild as k, getGuild as kt, InteractionCreateListener as l, deleteChannel as lt, ReadyListener as m, getChannelMessage as mt, createDiscordSendResult as n, createUserDmChannel as nt, normalizeDiscordOutboundTarget as o, listMessageReactionUsers as ot, PresenceUpdateListener as p, getChannel as pt, Section as q, allowFromContainsDiscordUserId as r, getCurrentUser as rt, chunkDiscordTextWithMode as s, createChannelMessage as st, createDiscordSendReceipt as t, createChannelWebhook as tt, MessageCreateListener as u, deleteChannelMessage as ut, Embed as v, pinChannelMessage as vt, readDiscordCode as w, createGuildChannel as wt, RequestClient as x, unpinChannelMessage as xt, Client as y, searchGuildMessages as yt, ChannelSelectMenu as z, removeGuildMember as zt };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as chunkDiscordTextWithMode } from "./chunk-DYl-_5RL.js";
|
|
5
|
-
import { t as parseAndResolveDiscordTarget } from "./target-resolver-CgJei-kD.js";
|
|
1
|
+
import { At as getGuildMember, C as RateLimitError, M as serializePayload, kt as getGuild, nt as createUserDmChannel, pt as getChannel, rt as getCurrentUser, s as chunkDiscordTextWithMode, st as createChannelMessage, v as Embed, x as RequestClient } from "./send.receipt-nKLxvA1s.js";
|
|
2
|
+
import { a as mergeDiscordAccountConfig, p as normalizeDiscordToken, s as resolveDiscordAccount } from "./accounts-DnNVBDfc.js";
|
|
3
|
+
import { t as parseAndResolveDiscordTarget } from "./target-resolver-BsGT9hI7.js";
|
|
6
4
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
5
|
import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
8
6
|
import { ChannelType, PermissionFlagsBits } from "discord-api-types/v10";
|
|
@@ -653,4 +651,4 @@ function formatReactionEmoji(emoji) {
|
|
|
653
651
|
return buildReactionIdentifier(emoji);
|
|
654
652
|
}
|
|
655
653
|
//#endregion
|
|
656
|
-
export {
|
|
654
|
+
export { parseAndResolveRecipient as A, DiscordSendError as C, hasAllGuildPermissionsDiscord as D, fetchMemberGuildPermissionsDiscord as E, resolveDiscordRest as F, DISCORD_REST_TIMEOUT_MS as I, validateDiscordProxyUrl as L, createDiscordRestClient as M, createDiscordRuntimeAccountContext as N, hasAnyGuildPermissionDiscord as O, resolveDiscordClientAccountContext as P, withValidatedDiscordProxy as R, DISCORD_MAX_STICKER_BYTES as S, fetchChannelPermissionsDiscord as T, resolveDiscordSendComponents as _, normalizeDiscordPollInput as a, DISCORD_MAX_EMOJI_BYTES as b, normalizeStickerIds as c, resolveDiscordTargetChannelId as d, sendDiscordMedia as f, buildDiscordMessageRequest as g, SUPPRESS_NOTIFICATIONS_FLAG as h, formatReactionEmoji as i, createDiscordClient as j, isThreadChannelType as k, resolveChannelId as l, toDiscordFileBlob as m, buildDiscordTextChunks as n, normalizeEmojiName as o, sendDiscordText as p, buildReactionIdentifier as r, normalizeReactionEmoji as s, buildDiscordSendError as t, resolveDiscordChannelType as u, resolveDiscordSendEmbeds as v, canViewDiscordGuildChannel as w, DISCORD_MAX_EVENT_COVER_BYTES as x, stripUndefinedFields as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as formatDiscordUserTag } from "./allow-list-CBI-M84K.js";
|
|
2
2
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
//#region extensions/discord/src/monitor/sender-identity.ts
|
|
4
4
|
function resolveDiscordWebhookId(message) {
|
package/dist/session-key-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as normalizeExplicitDiscordSessionKey } from "./session-key-normalization-
|
|
1
|
+
import { t as normalizeExplicitDiscordSessionKey } from "./session-key-normalization-B7h83qD2.js";
|
|
2
2
|
export { normalizeExplicitDiscordSessionKey };
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as discordSetupPlugin } from "./channel.setup-
|
|
1
|
+
import { t as discordSetupPlugin } from "./channel.setup-DBFcGRFD.js";
|
|
2
2
|
export { discordSetupPlugin };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { a as mergeDiscordAccountConfig, c as resolveDiscordAccountAllowFrom, d as resolveDiscordAccountDmPolicy, n as isDiscordAccountEnabledForRuntime, o as resolveDefaultDiscordAccountId, r as listDiscordAccountIds, s as resolveDiscordAccount, u as resolveDiscordAccountDisabledReason } from "./accounts-
|
|
2
|
-
import { t as inspectDiscordAccount } from "./account-inspect-
|
|
3
|
-
import { i as getChatChannelMeta } from "./channel-api-
|
|
4
|
-
import { t as DiscordChannelConfigSchema } from "./config-schema-
|
|
5
|
-
import { n as normalizeCompatibilityConfig } from "./doctor-contract-
|
|
6
|
-
import { t as
|
|
7
|
-
import { n as
|
|
8
|
-
import {
|
|
9
|
-
import { t as deriveLegacySessionChatType } from "./session-contract-D871HDFG.js";
|
|
1
|
+
import { a as mergeDiscordAccountConfig, c as resolveDiscordAccountAllowFrom, d as resolveDiscordAccountDmPolicy, n as isDiscordAccountEnabledForRuntime, o as resolveDefaultDiscordAccountId, r as listDiscordAccountIds, s as resolveDiscordAccount, u as resolveDiscordAccountDisabledReason } from "./accounts-DnNVBDfc.js";
|
|
2
|
+
import { t as inspectDiscordAccount } from "./account-inspect-B_N30NV0.js";
|
|
3
|
+
import { i as getChatChannelMeta, o as resolveConfiguredFromCredentialStatuses } from "./channel-api-JudoSiJv.js";
|
|
4
|
+
import { t as DiscordChannelConfigSchema } from "./config-schema-D7AtCpJa.js";
|
|
5
|
+
import { n as normalizeCompatibilityConfig } from "./doctor-contract-ftWAMvBl.js";
|
|
6
|
+
import { n as secretTargetRegistryEntries, t as collectRuntimeConfigAssignments } from "./secret-config-contract-B3347_eU.js";
|
|
7
|
+
import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-DyCRvz_Q.js";
|
|
8
|
+
import { t as deriveLegacySessionChatType } from "./session-contract-ugfEa9Xc.js";
|
|
10
9
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
11
10
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
12
11
|
import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter, createScopedDmSecurityResolver } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
@@ -49,7 +48,7 @@ const collectDiscordSecurityWarnings = createOpenProviderConfiguredRouteWarningC
|
|
|
49
48
|
});
|
|
50
49
|
let discordSecurityAuditModulePromise;
|
|
51
50
|
async function loadDiscordSecurityAuditModule() {
|
|
52
|
-
discordSecurityAuditModulePromise ??= import("./security-audit.runtime-
|
|
51
|
+
discordSecurityAuditModulePromise ??= import("./security-audit.runtime-CCm9leFJ.js");
|
|
53
52
|
return await discordSecurityAuditModulePromise;
|
|
54
53
|
}
|
|
55
54
|
const discordSecurityAdapter = {
|
|
@@ -65,11 +64,14 @@ const discordSetupAdapter = createEnvPatchedAccountSetupAdapter({
|
|
|
65
64
|
buildPatch: (input) => input.token ? { token: input.token } : {}
|
|
66
65
|
});
|
|
67
66
|
//#endregion
|
|
67
|
+
//#region extensions/discord/src/doctor-shared.ts
|
|
68
|
+
const DISCORD_LEGACY_CONFIG_RULES = [];
|
|
69
|
+
//#endregion
|
|
68
70
|
//#region extensions/discord/src/shared.ts
|
|
69
71
|
const DISCORD_CHANNEL = "discord";
|
|
70
72
|
let discordDoctorModulePromise;
|
|
71
73
|
async function loadDiscordDoctorModule() {
|
|
72
|
-
discordDoctorModulePromise ??= import("./doctor-
|
|
74
|
+
discordDoctorModulePromise ??= import("./doctor-mn2XyjuF.js");
|
|
73
75
|
return await discordDoctorModulePromise;
|
|
74
76
|
}
|
|
75
77
|
const discordDoctor = {
|
|
@@ -144,10 +146,10 @@ function createDiscordPluginBase(params) {
|
|
|
144
146
|
hasConfiguredState: ({ env }) => typeof env?.DISCORD_BOT_TOKEN === "string" && env.DISCORD_BOT_TOKEN.trim().length > 0,
|
|
145
147
|
isEnabled: (account, cfg) => isDiscordAccountEnabledForRuntime(account, cfg),
|
|
146
148
|
disabledReason: (account, cfg) => resolveDiscordAccountDisabledReason(account, cfg),
|
|
147
|
-
isConfigured: (account) => Boolean(account.token?.trim()),
|
|
149
|
+
isConfigured: (account) => resolveConfiguredFromCredentialStatuses(account) ?? Boolean(account.token?.trim()),
|
|
148
150
|
describeAccount: (account) => describeAccountSnapshot({
|
|
149
151
|
account,
|
|
150
|
-
configured: Boolean(account.token?.trim()),
|
|
152
|
+
configured: resolveConfiguredFromCredentialStatuses(account) ?? Boolean(account.token?.trim()),
|
|
151
153
|
extra: {
|
|
152
154
|
tokenSource: account.tokenSource,
|
|
153
155
|
tokenStatus: account.tokenStatus
|
|
@@ -166,4 +168,4 @@ function createDiscordPluginBase(params) {
|
|
|
166
168
|
};
|
|
167
169
|
}
|
|
168
170
|
//#endregion
|
|
169
|
-
export { discordSecurityAdapter as i, discordConfigAdapter as n,
|
|
171
|
+
export { discordSecurityAdapter as a, discordSetupAdapter as i, discordConfigAdapter as n, DISCORD_LEGACY_CONFIG_RULES as r, createDiscordPluginBase as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { s as resolveDiscordAccount } from "./accounts-
|
|
3
|
-
import { n as autoBindSpawnedDiscordSubagent, o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey } from "./thread-bindings-
|
|
1
|
+
import { Wt as __exportAll } from "./send.receipt-nKLxvA1s.js";
|
|
2
|
+
import { s as resolveDiscordAccount } from "./accounts-DnNVBDfc.js";
|
|
3
|
+
import { n as autoBindSpawnedDiscordSubagent, o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey } from "./thread-bindings-C1f7Iim4.js";
|
|
4
4
|
import { normalizeOptionalLowercaseString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { formatThreadBindingDisabledError, formatThreadBindingSpawnDisabledError, resolveThreadBindingSpawnPolicy } from "openclaw/plugin-sdk/conversation-runtime";
|
|
6
6
|
//#region extensions/discord/src/subagent-hooks.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region extensions/discord/subagent-hooks-api.ts
|
|
2
2
|
let discordSubagentHooksPromise = null;
|
|
3
3
|
function loadDiscordSubagentHooksModule() {
|
|
4
|
-
discordSubagentHooksPromise ??= import("./subagent-hooks-
|
|
4
|
+
discordSubagentHooksPromise ??= import("./subagent-hooks-DhuBhwRw.js").then((n) => n.i);
|
|
5
5
|
return discordSubagentHooksPromise;
|
|
6
6
|
}
|
|
7
7
|
function registerDiscordSubagentHooks(api) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { c as discord_exports } from "./send.receipt-nKLxvA1s.js";
|
|
2
|
+
import { b as formatDiscordUserTag } from "./allow-list-CBI-M84K.js";
|
|
3
3
|
//#region extensions/discord/src/monitor/system-events.ts
|
|
4
4
|
function resolveDiscordSystemEvent(message, location) {
|
|
5
5
|
switch (message.type) {
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as resolveDiscordAccountAllowFrom, s as resolveDiscordAccount } from "./accounts-
|
|
3
|
-
import {
|
|
4
|
-
import { t as rememberDiscordDirectoryUser } from "./directory-cache-Ddl-Oxue.js";
|
|
5
|
-
import { r as listDiscordDirectoryPeersLive } from "./directory-live-ApUXOSj0.js";
|
|
6
|
-
import { t as allowFromContainsDiscordUserId } from "./normalize-Cu94FOqy.js";
|
|
1
|
+
import { Ht as parseDiscordTarget, Wt as __exportAll, r as allowFromContainsDiscordUserId } from "./send.receipt-nKLxvA1s.js";
|
|
2
|
+
import { c as resolveDiscordAccountAllowFrom, s as resolveDiscordAccount } from "./accounts-DnNVBDfc.js";
|
|
3
|
+
import { i as rememberDiscordDirectoryUser, r as listDiscordDirectoryPeersLive } from "./directory-live-MrDSKsMf.js";
|
|
7
4
|
import { buildMessagingTarget } from "openclaw/plugin-sdk/messaging-targets";
|
|
8
5
|
//#region extensions/discord/src/send-target-parsing.ts
|
|
9
6
|
const parseDiscordSendTarget = (raw, options = {}) => parseDiscordTarget(raw, options);
|
package/dist/test-api.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as discordPlugin } from "./channel-
|
|
2
|
-
import { n as discordOutbound } from "./outbound-adapter-
|
|
3
|
-
import { t as __testing } from "./thread-bindings.manager-
|
|
4
|
-
import { n as buildDiscordInboundAccessContext } from "./inbound-context-
|
|
1
|
+
import { t as discordPlugin } from "./channel-BjBa8nYY.js";
|
|
2
|
+
import { n as discordOutbound } from "./outbound-adapter-Cw9JsRTY.js";
|
|
3
|
+
import { t as __testing } from "./thread-bindings.manager-DN_q0IW7.js";
|
|
4
|
+
import { n as buildDiscordInboundAccessContext } from "./inbound-context-DD7n3Q6U.js";
|
|
5
5
|
import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-dispatch-runtime";
|
|
6
6
|
//#region extensions/discord/src/monitor/inbound-context.test-helpers.ts
|
|
7
7
|
function buildFinalizedDiscordDirectInboundContext() {
|