@openclaw/discord 2026.11.7 → 2026.11.10-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/README.md +37 -0
- package/dist/.setup/{account-inspect-DGkdWwix.mjs → account-inspect-CSz5Qodj.mjs} +2 -3
- package/dist/.setup/{accounts-C_25wyxC.mjs → accounts-DtjvhJUj.mjs} +4 -8
- package/dist/.setup/{active-turn-thread-route-KvRTAVE3.mjs → active-turn-thread-route-DkPnk2x8.mjs} +1 -2
- package/dist/.setup/{allow-list-C3j0qLDp.mjs → allow-list-CkqpzPvP.mjs} +4 -8
- package/dist/.setup/{api-DYRggUgK.mjs → api-C4j_kC-2.mjs} +4 -6
- package/dist/.setup/{approval-handler.runtime-BN4W1r0o.mjs → approval-handler.runtime-DXzPFNvC.mjs} +10 -10
- package/dist/.setup/{approval-message-updates-DKsCfxSW.mjs → approval-message-updates-DqOXxPss.mjs} +3 -4
- package/dist/.setup/{audit-BL6EoUun.mjs → audit-B9vk3V2z.mjs} +6 -7
- package/dist/.setup/{channel-DdI2l55_.mjs → channel-CKffiPiV.mjs} +38 -41
- package/dist/.setup/{channel-access-9cyzozUP.mjs → channel-access-DhJhVrdZ.mjs} +1 -2
- package/dist/.setup/{channel.setup-kNWMxlgu.mjs → channel.setup-DmGdG9BH.mjs} +7 -10
- package/dist/.setup/{command-deploy-store-DFkBTViB.mjs → command-deploy-store-DPWiBMks.mjs} +1 -2
- package/dist/.setup/{command-owners-C7rUdqUX.mjs → command-owners-BzlhNBxA.mjs} +1 -2
- package/dist/.setup/{components-C1Phe3uw.mjs → components-GePlato3.mjs} +10 -16
- package/dist/.setup/{components.base-CiS0h_XP.mjs → components.base-C5sAPHe4.mjs} +1 -2
- package/dist/.setup/config-DDwcUaxT.mjs +20 -0
- package/dist/.setup/{config-schema-BNKN1cu5.mjs → config-schema-D3M1livr.mjs} +5 -7
- package/dist/.setup/{conversation-binding-route-K_jFbvi5.mjs → conversation-binding-route-CAaWWJdQ.mjs} +2 -3
- package/dist/.setup/conversation-fork-B6PiUuln.mjs +197 -0
- package/dist/.setup/{directory-config-Ble81PWH.mjs → directory-config-BXJuh9-J.mjs} +3 -4
- package/dist/.setup/{directory-live-CY2-qrHI.mjs → directory-live-B9UoQG9g.mjs} +9 -64
- package/dist/.setup/{discord-BRVFhk09.mjs → discord-cXPUdHQi.mjs} +98 -77
- package/dist/.setup/{doctor-RqH-6JB0.mjs → doctor-MTAWTgRa.mjs} +7 -8
- package/dist/.setup/{doctor-contract-Bwv8EuQ_.mjs → doctor-contract-Dstl3cMg.mjs} +2 -3
- package/dist/.setup/{endpoint-runtime-lf4DeLas.mjs → endpoint-runtime-BM3x-m6O.mjs} +1 -2
- package/dist/.setup/{guilds-BSnrns-F.mjs → guilds-DYBhgnfq.mjs} +3 -4
- package/dist/.setup/{handle-action-uD87h2FK.mjs → handle-action-El1ok7Ak.mjs} +13 -12
- package/dist/.setup/{handle-action.guild-admin-CqBx_3mG.mjs → handle-action.guild-admin-CxYfg02j.mjs} +7 -5
- package/dist/.setup/identity-link-B7KOBo_l.mjs +74 -0
- package/dist/.setup/{listeners-DnHLrLIN.mjs → listeners-DIyynRvV.mjs} +2 -3
- package/dist/.setup/{live-policy-config-y0Qy36X3.mjs → live-policy-config-DjIHWFla.mjs} +3 -5
- package/dist/.setup/{message-handler-CWL_u0X8.mjs → message-handler-DP3cAQCZ.mjs} +18 -17
- package/dist/.setup/{message-handler.preflight-83tpEdBG.mjs → message-handler.preflight-S5yc9UdR.mjs} +20 -27
- package/dist/.setup/{message-handler.preflight-pluralkit-Dhcx7Ifz.mjs → message-handler.preflight-pluralkit-BFntgVKc.mjs} +10 -14
- package/dist/.setup/{message-handler.process-BC-wNZwK.mjs → message-handler.process-bXE_4sq5.mjs} +56 -67
- package/dist/.setup/oauth-http-DdVyzSbo.mjs +40 -0
- package/dist/.setup/{outbound-payload-CK3_bDvK.mjs → outbound-payload-Dh6xCO6z.mjs} +18 -13
- package/dist/.setup/{outbound-session-route-Ay_DnOOl.mjs → outbound-session-route-G_fK5RAh.mjs} +22 -34
- package/dist/.setup/{output-activity-uBpMSX75.mjs → output-activity-CDgs2s3O.mjs} +1 -2
- package/dist/.setup/{pluralkit-B64dfq_j.mjs → pluralkit-DcXbHTpQ.mjs} +2 -3
- package/dist/.setup/{preflight-audio-C6QtD6HX.mjs → preflight-audio-r4BbaJxh.mjs} +1 -2
- package/dist/.setup/{presence-cache-Dq-3nH7R.mjs → presence-cache-B3xj3b0l.mjs} +1 -2
- package/dist/.setup/{probe-CbDJojNV.mjs → probe-CfGMZwFD.mjs} +5 -6
- package/dist/.setup/{provider-CRb3Myky.mjs → provider-BA4ysXXm.mjs} +200 -249
- package/dist/.setup/{provider-session.runtime-3cZpps3H.mjs → provider-session.runtime-Cr2oPicL.mjs} +3 -3
- package/dist/.setup/provider.runtime-D4BlQKDq.mjs +1 -0
- package/dist/.setup/{proxy-fetch-BzXwBAXt.mjs → proxy-fetch-B8cK6FLQ.mjs} +1 -2
- package/dist/.setup/{realtime-session.runtime-BRYpjS9P.mjs → realtime-session.runtime-DQvAKxj9.mjs} +15 -25
- package/dist/.setup/{receive-recovery-C3Ks4wAQ.mjs → receive-recovery-DV_v5ROf.mjs} +3 -6
- package/dist/.setup/{resolve-allowlist-common-B-S0wRIw.mjs → resolve-allowlist-common-CYdqBUgV.mjs} +3 -4
- package/dist/.setup/{resolve-channels-g16NM6Ho.mjs → resolve-channels-BNnyfCR8.mjs} +6 -7
- package/dist/.setup/{resolve-users-DAfOOXdy.mjs → resolve-users-CDMAGrzv.mjs} +5 -6
- package/dist/.setup/{rolldown-runtime-B4FMCO8f.mjs → rolldown-runtime-nwUcYXjP.mjs} +1 -2
- package/dist/.setup/{runtime--HZ9r3tF.mjs → runtime-CkeNX7ic.mjs} +59 -50
- package/dist/.setup/{runtime-BMgTyuwg.mjs → runtime-DSaHEGJd.mjs} +4 -24
- package/dist/.setup/{runtime-DgnVQ7zW.mjs → runtime-DcBvHOm1.mjs} +1 -2
- package/dist/.setup/{runtime-doctor-migrations-BPV-R4G9.mjs → runtime-doctor-migrations-BpV1jKk0.mjs} +5 -9
- package/dist/.setup/{secret-config-contract-B1kE4sDv.mjs → secret-config-contract-CP6teHec.mjs} +1 -2
- package/dist/.setup/{security-audit-BFT84Uny.mjs → security-audit-CTwisG7c.mjs} +3 -4
- package/dist/.setup/{security-contract-DNyyjTZZ.mjs → security-contract-D-o0iWDk.mjs} +1 -2
- package/dist/.setup/{security-doctor-nGgPm65L.mjs → security-doctor-4s7omTZd.mjs} +1 -2
- package/dist/.setup/{send-CtvwfZQ2.mjs → send-DKzwsZkm.mjs} +26 -31
- package/dist/.setup/{send.components-CtLtE0yD.mjs → send.components-CIZALYDP.mjs} +12 -14
- package/dist/.setup/{send.outbound-D58xXPgs.mjs → send.outbound-cQ4Ohmsc.mjs} +11 -16
- package/dist/.setup/send.permissions-BvH_Dr8p.mjs +369 -0
- package/dist/.setup/{send.receipt-DLOV4qx6.mjs → send.receipt-CZ7ks6g7.mjs} +64 -17
- package/dist/.setup/send.shared-D2lh737v.mjs +259 -0
- package/dist/.setup/{sender-identity-BbA7FNbr.mjs → sender-identity-Dt5ELjRN.mjs} +2 -3
- package/dist/.setup/{session-contract-BO5tlIdl.mjs → session-contract-Bq71MS78.mjs} +1 -2
- package/dist/.setup/{session-key-normalization-CCHGNSQw.mjs → session-key-normalization-Cfvze5hd.mjs} +1 -2
- package/dist/.setup/setup-plugin-api-BJt8tAAC.mjs +2 -0
- package/dist/.setup/{shared-Dv2DamaK.mjs → shared-Bf7ifHlc.mjs} +14 -17
- package/dist/.setup/{shared-interactive-DmzaoKOM.mjs → shared-interactive-DKBw4SNV.mjs} +7 -12
- package/dist/.setup/{subagent-hooks-yT45eTyz.mjs → subagent-hooks-CVmIOrAR.mjs} +4 -5
- package/dist/.setup/{system-events-Dlzp9Jcj.mjs → system-events-DB6p2H4l.mjs} +3 -4
- package/dist/.setup/{target-parsing-C-HyNxcE.mjs → target-parsing-BiuhcK9Q.mjs} +1 -2
- package/dist/.setup/{target-resolver-BzaZPBm9.mjs → target-resolver-48znkzky.mjs} +6 -7
- package/dist/.setup/{thread-binding-api-BDZJD4na.mjs → thread-binding-api-Drd4Zu-5.mjs} +1 -2
- package/dist/.setup/{thread-bindings-DRWhgKCc.mjs → thread-bindings-DTHVdmvF.mjs} +7 -10
- package/dist/.setup/{thread-bindings.manager-CWJKirn1.mjs → thread-bindings.manager-6EnH3YZh.mjs} +45 -30
- package/dist/.setup/{thread-bindings.session-updates-DzJrXc4w.mjs → thread-bindings.session-updates-BPO6pPzd.mjs} +9 -12
- package/dist/.setup/{threading-BbsPuT5G.mjs → threading-PC3IIaHd.mjs} +5 -7
- package/dist/.setup/{timeouts-cIxzatmv.mjs → timeouts-CT9hnmo4.mjs} +1 -2
- package/dist/.setup/{transcripts-source-DIW1fU_P.mjs → transcripts-source-C3F_ErM1.mjs} +20 -33
- package/dist/.setup/{typing-CNlSKY5S.mjs → typing-DAv4S2fI.mjs} +2 -3
- package/dist/.setup/{voice-runtime-oJ6BZs5D.mjs → voice-runtime-CZGbraKC.mjs} +28 -46
- package/dist/.source-module-urls/d6c089460280c5a04184542d6712e04545caeb1ebb290d3504377b4cc5e22fea.json +1 -1
- package/dist/account-inspect-api.js +2 -3
- package/dist/action-runtime-api.js +1 -1
- package/dist/activities-api.js +10 -50
- package/dist/api.js +21 -22
- package/dist/assets/embedded-app-sdk.mjs +1 -1
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/contract-api.js +1 -1
- package/dist/directory-contract-api.js +2 -3
- package/dist/doctor-contract-api.js +7 -8
- package/dist/index.js +1 -2
- package/dist/runtime-api.js +23 -22
- package/dist/runtime-setter-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/session-key-api.js +1 -1
- package/dist/setup-entry.js +2 -3
- package/dist/setup-plugin-api.js +1 -1
- package/dist/src/voice/audio-worker.runtime.js +14 -26
- package/dist/subagent-hooks-api.js +2 -3
- package/dist/thread-binding-api.js +1 -1
- package/dist/transcripts-source-api.js +2 -3
- package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.cjs +2 -3
- package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.mjs +2 -3
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/zlib.d.ts +752 -0
- package/node_modules/typebox/build/format/date_time.d.mts +2 -1
- package/node_modules/typebox/build/format/date_time.mjs +12 -3
- package/node_modules/typebox/package.json +1 -1
- package/openclaw.plugin.json +7 -2
- package/package.json +5 -5
- package/dist/.setup/provider.runtime-tmkt3QOg.mjs +0 -1
- package/dist/.setup/send.shared-B_KKRrD7.mjs +0 -589
- package/dist/.setup/setup-plugin-api-ty5RJrMy.mjs +0 -2
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { i as fetchChannelPermissionsDiscord, u as createDiscordClient } from "./send.permissions-BvH_Dr8p.mjs";
|
|
2
|
+
import { O as getChannel, d as hasDiscordV2Components, f as serializePayload, p as Embed, w as createChannelMessage, y as createUserDmChannel, z as DiscordError } from "./discord-cXPUdHQi.mjs";
|
|
3
|
+
import { w as isDiscordThreadChannelType } from "./allow-list-CkqpzPvP.mjs";
|
|
4
|
+
import { S as chunkDiscordTextWithMode, h as resolveDiscordReplyMessageId } from "./send.receipt-CZ7ks6g7.mjs";
|
|
5
|
+
import { t as parseAndResolveDiscordTarget } from "./target-resolver-48znkzky.mjs";
|
|
6
|
+
import { normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
|
+
import { MessageFlags } from "discord-api-types/v10";
|
|
8
|
+
import { PollLayoutType } from "discord-api-types/payloads/v10";
|
|
9
|
+
import { extensionForMime, normalizePollDurationHours, normalizePollInput } from "openclaw/plugin-sdk/media-runtime";
|
|
10
|
+
import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
|
|
11
|
+
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
12
|
+
import { resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
13
|
+
import { randomBytes } from "node:crypto";
|
|
14
|
+
// extensions/discord/src/send.message-request.ts
|
|
15
|
+
const SUPPRESS_EMBEDS_FLAG = MessageFlags.SuppressEmbeds;
|
|
16
|
+
const SUPPRESS_NOTIFICATIONS_FLAG = MessageFlags.SuppressNotifications;
|
|
17
|
+
function createDiscordMessageNonce() {
|
|
18
|
+
return randomBytes(12).toString("hex");
|
|
19
|
+
}
|
|
20
|
+
function resolveDiscordSendComponents(params) {
|
|
21
|
+
if (!params.components || !params.isFirst) return;
|
|
22
|
+
return typeof params.components === "function" ? params.components(params.text) : params.components;
|
|
23
|
+
}
|
|
24
|
+
function resolveDiscordSendEmbeds(params) {
|
|
25
|
+
if (!params.embeds?.length || !params.isFirst) return;
|
|
26
|
+
return params.embeds.map((embed) => embed instanceof Embed ? embed : new Embed(embed));
|
|
27
|
+
}
|
|
28
|
+
function resolveDiscordMessageFlags(params) {
|
|
29
|
+
return (params.suppressEmbeds ? SUPPRESS_EMBEDS_FLAG : 0) | (params.silent ? SUPPRESS_NOTIFICATIONS_FLAG : 0) || void 0;
|
|
30
|
+
}
|
|
31
|
+
function resolveDiscordSuppressEmbeds(params) {
|
|
32
|
+
return params.override ?? params.configured ?? true;
|
|
33
|
+
}
|
|
34
|
+
function buildDiscordMessageRequest(params) {
|
|
35
|
+
const hasV2 = hasDiscordV2Components(params.components);
|
|
36
|
+
const trimmed = params.text.trim();
|
|
37
|
+
const payload = {
|
|
38
|
+
content: !hasV2 && trimmed ? params.text : void 0,
|
|
39
|
+
components: params.components?.length ? params.components : void 0,
|
|
40
|
+
embeds: !hasV2 && params.embeds?.length ? params.embeds : void 0,
|
|
41
|
+
allowed_mentions: params.allowedMentions || void 0,
|
|
42
|
+
flags: params.flags,
|
|
43
|
+
files: params.files?.length ? params.files : void 0
|
|
44
|
+
};
|
|
45
|
+
const nonce = params.endpoint === "create-message" ? params.nonce ?? createDiscordMessageNonce() : void 0;
|
|
46
|
+
return {
|
|
47
|
+
...serializePayload(payload),
|
|
48
|
+
...params.replyTo ? { message_reference: {
|
|
49
|
+
message_id: params.replyTo,
|
|
50
|
+
fail_if_not_exists: false
|
|
51
|
+
} } : {},
|
|
52
|
+
...nonce !== void 0 ? { nonce } : {},
|
|
53
|
+
...nonce ? { enforce_nonce: true } : {}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
// extensions/discord/src/send.types.ts
|
|
57
|
+
var DiscordSendError = class extends Error {
|
|
58
|
+
constructor(message, opts) {
|
|
59
|
+
super(message);
|
|
60
|
+
this.name = "DiscordSendError";
|
|
61
|
+
Object.assign(this, opts);
|
|
62
|
+
}
|
|
63
|
+
toString() {
|
|
64
|
+
return this.message;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const DISCORD_MAX_EMOJI_BYTES = 262144;
|
|
68
|
+
const DISCORD_MAX_STICKER_BYTES = 524288;
|
|
69
|
+
const DISCORD_MAX_EVENT_COVER_BYTES = 8388608;
|
|
70
|
+
// extensions/discord/src/send.shared.ts
|
|
71
|
+
const DISCORD_TEXT_LIMIT = 2e3;
|
|
72
|
+
const DISCORD_MAX_STICKERS = 3;
|
|
73
|
+
const DISCORD_POLL_MAX_ANSWERS = 10;
|
|
74
|
+
const DISCORD_POLL_MAX_DURATION_HOURS = 768;
|
|
75
|
+
const DISCORD_MISSING_PERMISSIONS = 50013;
|
|
76
|
+
const DISCORD_CANNOT_DM = 50007;
|
|
77
|
+
const DISCORD_UPLOAD_TOO_LARGE = 40005;
|
|
78
|
+
const DISCORD_UPLOAD_TOO_LARGE_STATUS = 413;
|
|
79
|
+
const DISCORD_UPLOAD_TOO_LARGE_NOTICE = "Attachment skipped: Discord rejected the file as too large.";
|
|
80
|
+
function resolveRequiredDiscordSendPermissions(channelType, hasMedia) {
|
|
81
|
+
const permissions = isDiscordThreadChannelType(channelType) ? ["ViewChannel", "SendMessagesInThreads"] : ["ViewChannel", "SendMessages"];
|
|
82
|
+
if (hasMedia) permissions.push("AttachFiles");
|
|
83
|
+
return permissions;
|
|
84
|
+
}
|
|
85
|
+
function normalizeReactionEmoji(raw) {
|
|
86
|
+
const trimmed = raw.trim();
|
|
87
|
+
if (!trimmed) throw new Error("emoji required");
|
|
88
|
+
const customMatch = trimmed.match(/^<a?:([^:>]+):(\d+)>$/);
|
|
89
|
+
const identifier = customMatch ? `${customMatch[1]}:${customMatch[2]}` : trimmed.replace(/[\uFE0E\uFE0F]/g, "");
|
|
90
|
+
return encodeURIComponent(identifier);
|
|
91
|
+
}
|
|
92
|
+
function normalizeStickerIds(raw) {
|
|
93
|
+
const ids = normalizeStringEntries(raw);
|
|
94
|
+
if (ids.length === 0) throw new Error("At least one sticker id is required");
|
|
95
|
+
if (ids.length > DISCORD_MAX_STICKERS) throw new Error("Discord supports up to 3 stickers per message");
|
|
96
|
+
return ids;
|
|
97
|
+
}
|
|
98
|
+
function normalizeEmojiName(raw, label) {
|
|
99
|
+
const name = raw.trim();
|
|
100
|
+
if (!name) throw new Error(`${label} is required`);
|
|
101
|
+
return name;
|
|
102
|
+
}
|
|
103
|
+
function normalizeDiscordPollInput(input) {
|
|
104
|
+
const poll = normalizePollInput(input, { maxOptions: DISCORD_POLL_MAX_ANSWERS });
|
|
105
|
+
const duration = normalizePollDurationHours(poll.durationHours, {
|
|
106
|
+
defaultHours: 24,
|
|
107
|
+
maxHours: DISCORD_POLL_MAX_DURATION_HOURS
|
|
108
|
+
});
|
|
109
|
+
return {
|
|
110
|
+
question: { text: poll.question },
|
|
111
|
+
answers: poll.options.map((answer) => ({ poll_media: { text: answer } })),
|
|
112
|
+
duration,
|
|
113
|
+
allow_multiselect: poll.maxSelections > 1,
|
|
114
|
+
layout_type: PollLayoutType.Default
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function isDiscordUploadTooLargeError(err) {
|
|
118
|
+
return err instanceof DiscordError && (err.discordCode === DISCORD_UPLOAD_TOO_LARGE || err.status === DISCORD_UPLOAD_TOO_LARGE_STATUS);
|
|
119
|
+
}
|
|
120
|
+
function buildDiscordUploadTooLargeFallbackText(text) {
|
|
121
|
+
return text.trim() ? `${text}\n\n[${DISCORD_UPLOAD_TOO_LARGE_NOTICE}]` : DISCORD_UPLOAD_TOO_LARGE_NOTICE;
|
|
122
|
+
}
|
|
123
|
+
async function buildDiscordSendError(err, ctx) {
|
|
124
|
+
if (!(err instanceof DiscordError)) return err;
|
|
125
|
+
const code = err.discordCode;
|
|
126
|
+
if (code === DISCORD_CANNOT_DM) return new DiscordSendError(`discord dm failed: user blocks dms or privacy settings disallow it (code=${code})`, { status: err.status });
|
|
127
|
+
if (code !== DISCORD_MISSING_PERMISSIONS) return err;
|
|
128
|
+
let missing = [];
|
|
129
|
+
let probedChannelType;
|
|
130
|
+
try {
|
|
131
|
+
const permissions = await fetchChannelPermissionsDiscord(ctx.channelId, {
|
|
132
|
+
rest: ctx.rest,
|
|
133
|
+
token: ctx.token,
|
|
134
|
+
cfg: ctx.cfg
|
|
135
|
+
});
|
|
136
|
+
probedChannelType = permissions.channelType;
|
|
137
|
+
const current = new Set(permissions.permissions);
|
|
138
|
+
missing = resolveRequiredDiscordSendPermissions(probedChannelType, ctx.hasMedia).filter((permission) => !current.has(permission));
|
|
139
|
+
} catch {}
|
|
140
|
+
const status = err.status;
|
|
141
|
+
const apiDetails = `code=${code} status=${status}`;
|
|
142
|
+
const probeSummary = resolveRequiredDiscordSendPermissions(probedChannelType, ctx.hasMedia).join("/");
|
|
143
|
+
return new DiscordSendError(`${missing.length ? `discord missing permissions in channel ${ctx.channelId}: ${missing.join(", ")}` : `discord missing permissions in channel ${ctx.channelId}; permission check did not identify missing ${probeSummary}`} (${apiDetails}). bot might be blocked by channel/thread overrides, archived thread state, reply target visibility, or app-role position`, { status });
|
|
144
|
+
}
|
|
145
|
+
async function resolveChannelId(rest, recipient, request) {
|
|
146
|
+
if (recipient.kind === "channel") return { channelId: recipient.id };
|
|
147
|
+
const dmChannel = await request(() => createUserDmChannel(rest, recipient.id), "dm-channel");
|
|
148
|
+
if (!dmChannel?.id) throw new Error("Failed to create Discord DM channel");
|
|
149
|
+
return {
|
|
150
|
+
channelId: dmChannel.id,
|
|
151
|
+
dm: true
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
async function resolveDiscordTargetChannelId(raw, opts) {
|
|
155
|
+
const cfg = requireRuntimeConfig(opts.cfg, "Discord target channel resolution");
|
|
156
|
+
const recipient = await parseAndResolveDiscordTarget(raw, {
|
|
157
|
+
cfg,
|
|
158
|
+
accountId: opts.accountId
|
|
159
|
+
}, { defaultKind: "channel" });
|
|
160
|
+
const { rest, request } = createDiscordClient(opts);
|
|
161
|
+
return await resolveChannelId(rest, recipient, request);
|
|
162
|
+
}
|
|
163
|
+
async function resolveDiscordChannel(rest, channelId) {
|
|
164
|
+
return getChannel(rest, channelId).catch(() => void 0);
|
|
165
|
+
}
|
|
166
|
+
function buildDiscordTextChunks(text, opts = {}) {
|
|
167
|
+
if (!text) return [];
|
|
168
|
+
const chunks = chunkDiscordTextWithMode(text, {
|
|
169
|
+
maxChars: opts.maxChars ?? DISCORD_TEXT_LIMIT,
|
|
170
|
+
maxLines: opts.maxLinesPerMessage,
|
|
171
|
+
chunkMode: opts.chunkMode
|
|
172
|
+
});
|
|
173
|
+
return resolveTextChunksWithFallback(text, chunks);
|
|
174
|
+
}
|
|
175
|
+
async function sendDiscordChunks(params, upload) {
|
|
176
|
+
const chunks = buildDiscordTextChunks(params.text, params);
|
|
177
|
+
if (!chunks.length) chunks.push("");
|
|
178
|
+
const platformMessageIds = [];
|
|
179
|
+
let primary;
|
|
180
|
+
for (const [index, chunk] of chunks.entries()) {
|
|
181
|
+
const isFirst = index === 0;
|
|
182
|
+
if (upload && !isFirst && !chunk.trim()) continue;
|
|
183
|
+
const files = isFirst ? upload?.files : void 0;
|
|
184
|
+
const components = resolveDiscordSendComponents({
|
|
185
|
+
...params,
|
|
186
|
+
text: chunk,
|
|
187
|
+
isFirst
|
|
188
|
+
});
|
|
189
|
+
const embeds = resolveDiscordSendEmbeds({
|
|
190
|
+
...params,
|
|
191
|
+
isFirst
|
|
192
|
+
});
|
|
193
|
+
if (!chunk.trim() && !components?.length && !embeds?.length && !files?.length) throw new Error("Message must be non-empty for Discord sends");
|
|
194
|
+
const replyToId = resolveDiscordReplyMessageId(params.reply, isFirst);
|
|
195
|
+
const kind = files ? "media" : components?.length || embeds?.length ? "card" : "text";
|
|
196
|
+
const body = buildDiscordMessageRequest({
|
|
197
|
+
endpoint: "create-message",
|
|
198
|
+
text: chunk,
|
|
199
|
+
components,
|
|
200
|
+
embeds,
|
|
201
|
+
files,
|
|
202
|
+
allowedMentions: params.allowedMentions,
|
|
203
|
+
flags: resolveDiscordMessageFlags({
|
|
204
|
+
silent: params.silent,
|
|
205
|
+
suppressEmbeds: params.suppressEmbeds && !embeds?.length
|
|
206
|
+
}),
|
|
207
|
+
replyTo: replyToId
|
|
208
|
+
});
|
|
209
|
+
let result;
|
|
210
|
+
try {
|
|
211
|
+
result = await params.request(async () => {
|
|
212
|
+
await params.onPlatformSendDispatch?.();
|
|
213
|
+
params.assertPlatformSendAuthorized?.();
|
|
214
|
+
return createChannelMessage(params.rest, params.channelId, { body });
|
|
215
|
+
}, files ? "media" : "text", { safety: "nonce-protected-create" });
|
|
216
|
+
} catch (error) {
|
|
217
|
+
if (files && upload) return upload.onRejected(error);
|
|
218
|
+
throw error;
|
|
219
|
+
}
|
|
220
|
+
await params.onResult?.(result, kind, replyToId);
|
|
221
|
+
if (result.id) platformMessageIds.push(result.id);
|
|
222
|
+
primary = upload ? primary ?? result : result;
|
|
223
|
+
}
|
|
224
|
+
if (!primary) throw new Error("Discord send failed (empty chunk result)");
|
|
225
|
+
return {
|
|
226
|
+
...primary,
|
|
227
|
+
platformMessageIds
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
async function sendDiscordMedia(params) {
|
|
231
|
+
const media = await loadOutboundMediaFromUrl(params.mediaUrl, {
|
|
232
|
+
maxBytes: params.maxBytes,
|
|
233
|
+
mediaAccess: params.mediaAccess,
|
|
234
|
+
mediaLocalRoots: params.mediaLocalRoots,
|
|
235
|
+
mediaReadFile: params.mediaReadFile
|
|
236
|
+
});
|
|
237
|
+
const resolvedFileName = params.filename?.trim() || media.fileName || (media.contentType ? `upload${extensionForMime(media.contentType) ?? ""}` : "") || "upload";
|
|
238
|
+
return sendDiscordChunks(params, {
|
|
239
|
+
files: [{
|
|
240
|
+
data: media.buffer,
|
|
241
|
+
name: resolvedFileName,
|
|
242
|
+
contentType: media.contentType
|
|
243
|
+
}],
|
|
244
|
+
onRejected(error) {
|
|
245
|
+
if (!isDiscordUploadTooLargeError(error)) throw error;
|
|
246
|
+
return sendDiscordChunks({
|
|
247
|
+
...params,
|
|
248
|
+
text: buildDiscordUploadTooLargeFallbackText(params.text),
|
|
249
|
+
components: void 0,
|
|
250
|
+
embeds: void 0
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
function buildReactionIdentifier(emoji) {
|
|
256
|
+
if (emoji.id && emoji.name) return `${emoji.name}:${emoji.id}`;
|
|
257
|
+
return emoji.name ?? "";
|
|
258
|
+
}
|
|
259
|
+
export { resolveDiscordSuppressEmbeds as C, resolveDiscordSendEmbeds as S, SUPPRESS_NOTIFICATIONS_FLAG as _, normalizeEmojiName as a, resolveDiscordMessageFlags as b, resolveChannelId as c, sendDiscordChunks as d, sendDiscordMedia as f, DiscordSendError as g, DISCORD_MAX_STICKER_BYTES as h, normalizeDiscordPollInput as i, resolveDiscordChannel as l, DISCORD_MAX_EVENT_COVER_BYTES as m, buildDiscordTextChunks as n, normalizeReactionEmoji as o, DISCORD_MAX_EMOJI_BYTES as p, buildReactionIdentifier as r, normalizeStickerIds as s, buildDiscordSendError as t, resolveDiscordTargetChannelId as u, buildDiscordMessageRequest as v, resolveDiscordSendComponents as x, createDiscordMessageNonce as y };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as formatDiscordUserTag } from "./allow-list-
|
|
1
|
+
import { S as formatDiscordUserTag } from "./allow-list-CkqpzPvP.mjs";
|
|
2
2
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
-
|
|
3
|
+
// extensions/discord/src/monitor/sender-identity.ts
|
|
4
4
|
function resolveDiscordWebhookId(message) {
|
|
5
5
|
return normalizeOptionalString(message.webhookId ?? message.webhook_id) ?? null;
|
|
6
6
|
}
|
|
@@ -32,5 +32,4 @@ function resolveDiscordSenderIdentity(params) {
|
|
|
32
32
|
isPluralKit: false
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
//#endregion
|
|
36
35
|
export { resolveDiscordWebhookId as n, resolveDiscordSenderIdentity as t };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// extensions/discord/src/session-contract.ts
|
|
2
2
|
function deriveLegacySessionChatType(sessionKey) {
|
|
3
3
|
return /^discord:(?:[^:]+:)?guild-[^:]+:channel-[^:]+$/.test(sessionKey) ? "channel" : void 0;
|
|
4
4
|
}
|
|
5
|
-
//#endregion
|
|
6
5
|
export { deriveLegacySessionChatType as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
-
|
|
2
|
+
// extensions/discord/src/session-key-normalization.ts
|
|
3
3
|
function normalizeExplicitDiscordSessionKey(sessionKey, ctx) {
|
|
4
4
|
let normalized = normalizeLowercaseStringOrEmpty(sessionKey);
|
|
5
5
|
const chatType = normalizeLowercaseStringOrEmpty(ctx.ChatType);
|
|
@@ -13,5 +13,4 @@ function normalizeExplicitDiscordSessionKey(sessionKey, ctx) {
|
|
|
13
13
|
const directId = senderId || fromDiscordId;
|
|
14
14
|
return directId && directId === match[2] ? `${match[1]}discord:direct:${match[2]}` : normalized;
|
|
15
15
|
}
|
|
16
|
-
//#endregion
|
|
17
16
|
export { normalizeExplicitDiscordSessionKey as t };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { c as resolveDefaultDiscordAccountId, f as resolveDiscordAccountDisabledReason, i as listDiscordAccountIds, l as resolveDiscordAccount, p as resolveDiscordAccountDmPolicy, r as isDiscordAccountEnabledForRuntime, s as mergeDiscordAccountConfig, u as resolveDiscordAccountAllowFrom } from "./accounts-
|
|
2
|
-
import { t as inspectDiscordAccount } from "./account-inspect-
|
|
3
|
-
import { t as parseDiscordTarget } from "./target-parsing-
|
|
4
|
-
import { n as discordIngressIdentity, t as selectDiscordLivePolicyConfig } from "./live-policy-config-
|
|
5
|
-
import { t as DiscordChannelConfigSchema } from "./config-schema-
|
|
6
|
-
import { n as normalizeCompatibilityConfig } from "./doctor-contract-
|
|
7
|
-
import { r as secretTargetRegistryEntries, t as collectRuntimeConfigAssignments } from "./secret-config-contract-
|
|
8
|
-
import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-
|
|
9
|
-
import { t as deriveLegacySessionChatType } from "./session-contract-
|
|
1
|
+
import { c as resolveDefaultDiscordAccountId, f as resolveDiscordAccountDisabledReason, i as listDiscordAccountIds, l as resolveDiscordAccount, p as resolveDiscordAccountDmPolicy, r as isDiscordAccountEnabledForRuntime, s as mergeDiscordAccountConfig, u as resolveDiscordAccountAllowFrom } from "./accounts-DtjvhJUj.mjs";
|
|
2
|
+
import { t as inspectDiscordAccount } from "./account-inspect-CSz5Qodj.mjs";
|
|
3
|
+
import { t as parseDiscordTarget } from "./target-parsing-BiuhcK9Q.mjs";
|
|
4
|
+
import { n as discordIngressIdentity, t as selectDiscordLivePolicyConfig } from "./live-policy-config-DjIHWFla.mjs";
|
|
5
|
+
import { t as DiscordChannelConfigSchema } from "./config-schema-D3M1livr.mjs";
|
|
6
|
+
import { n as normalizeCompatibilityConfig } from "./doctor-contract-Dstl3cMg.mjs";
|
|
7
|
+
import { r as secretTargetRegistryEntries, t as collectRuntimeConfigAssignments } from "./secret-config-contract-CP6teHec.mjs";
|
|
8
|
+
import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-D-o0iWDk.mjs";
|
|
9
|
+
import { t as deriveLegacySessionChatType } from "./session-contract-Bq71MS78.mjs";
|
|
10
10
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
11
11
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
12
12
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
@@ -17,7 +17,7 @@ import { createConditionalWarningCollector, createOpenProviderConfiguredRouteWar
|
|
|
17
17
|
import { identityEntryAuthenticationClassifier } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
18
18
|
import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
|
|
19
19
|
import { createEnvPatchedAccountSetupAdapter } from "openclaw/plugin-sdk/setup-runtime";
|
|
20
|
-
|
|
20
|
+
// extensions/discord/src/security.ts
|
|
21
21
|
const resolveDiscordDmPolicy = createScopedDmSecurityResolver({
|
|
22
22
|
channelKey: "discord",
|
|
23
23
|
resolvePolicy: (account) => account.config.dmPolicy,
|
|
@@ -60,10 +60,9 @@ const discordSecurityAdapter = {
|
|
|
60
60
|
severity: "warn",
|
|
61
61
|
title: "Discord security warning"
|
|
62
62
|
}),
|
|
63
|
-
collectAuditFindings: async (params) => (await import("./security-audit-
|
|
63
|
+
collectAuditFindings: async (params) => (await import("./security-audit-CTwisG7c.mjs").then((n) => n.n)).collectDiscordSecurityAuditFindings(params)
|
|
64
64
|
};
|
|
65
|
-
|
|
66
|
-
//#region extensions/discord/src/setup-adapter.ts
|
|
65
|
+
// extensions/discord/src/setup-adapter.ts
|
|
67
66
|
const discordSetupAdapter = createEnvPatchedAccountSetupAdapter({
|
|
68
67
|
channelKey: "discord",
|
|
69
68
|
defaultAccountOnlyEnvError: "DISCORD_BOT_TOKEN can only be used for the default account.",
|
|
@@ -93,11 +92,10 @@ const discordSetupContract = defineChannelSetupContract({
|
|
|
93
92
|
},
|
|
94
93
|
legacyAdapter: discordSetupAdapter
|
|
95
94
|
});
|
|
96
|
-
|
|
97
|
-
//#region extensions/discord/src/shared.ts
|
|
95
|
+
// extensions/discord/src/shared.ts
|
|
98
96
|
const DISCORD_CHANNEL = "discord";
|
|
99
97
|
const livePolicyConfigPrefixes = Object.keys(selectDiscordLivePolicyConfig({})).flatMap((key) => [`channels.discord.${key}`, `channels.discord.accounts.*.${key}`]);
|
|
100
|
-
const loadDiscordDoctorModule = createLazyRuntimeModule(() => import("./doctor-
|
|
98
|
+
const loadDiscordDoctorModule = createLazyRuntimeModule(() => import("./doctor-MTAWTgRa.mjs"));
|
|
101
99
|
const discordDoctor = {
|
|
102
100
|
dmAllowFromMode: "topOnly",
|
|
103
101
|
groupModel: "route",
|
|
@@ -223,5 +221,4 @@ function createDiscordPluginBase(params) {
|
|
|
223
221
|
}
|
|
224
222
|
};
|
|
225
223
|
}
|
|
226
|
-
//#endregion
|
|
227
224
|
export { discordSecurityAdapter as i, discordConfigAdapter as n, discordSetupContract as r, createDiscordPluginBase as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { i as parseCustomId } from "./components.base-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
|
|
2
|
+
import { i as parseCustomId } from "./components.base-C5sAPHe4.mjs";
|
|
3
3
|
import { readNonBlankString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { resolveAskUserQuestionOptionIndex } from "openclaw/plugin-sdk/reply-payload";
|
|
5
5
|
import { legacyInteractiveReplyToPresentation, resolveMessagePresentationActionValue, resolveMessagePresentationButtonAction, resolveMessagePresentationOptionAction } from "openclaw/plugin-sdk/interactive-runtime";
|
|
6
6
|
import { buildApprovalResolutionRef } from "openclaw/plugin-sdk/approval-reference-runtime";
|
|
7
|
-
|
|
7
|
+
// extensions/discord/src/custom-id-codec.ts
|
|
8
8
|
/**
|
|
9
9
|
* URI-component codec for values embedded in `k=v;` custom-id grammars
|
|
10
10
|
* (exec approvals, model picker, command args, agent components).
|
|
@@ -34,8 +34,7 @@ function needsCustomIdFieldEscaping(value) {
|
|
|
34
34
|
function unescapeCustomIdFieldValue(value) {
|
|
35
35
|
return value.replace(/%(25|3B)/gi, (match) => match.toLowerCase() === "%25" ? "%" : ";");
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
//#region extensions/discord/src/component-custom-id.ts
|
|
37
|
+
// extensions/discord/src/component-custom-id.ts
|
|
39
38
|
const DISCORD_COMPONENT_CUSTOM_ID_KEY = "occomp";
|
|
40
39
|
const DISCORD_MODAL_CUSTOM_ID_KEY = "ocmodal";
|
|
41
40
|
const DISCORD_ACTIVITY_CUSTOM_ID_KEY = "ocactivity";
|
|
@@ -115,8 +114,7 @@ function parseDiscordComponentCustomIdForInteraction(id) {
|
|
|
115
114
|
function parseDiscordModalCustomIdForInteraction(id) {
|
|
116
115
|
return parseDiscordCustomIdForInteraction(id, DISCORD_MODAL_CUSTOM_ID_KEY);
|
|
117
116
|
}
|
|
118
|
-
|
|
119
|
-
//#region extensions/discord/src/approval-custom-id.ts
|
|
117
|
+
// extensions/discord/src/approval-custom-id.ts
|
|
120
118
|
const DISCORD_APPROVAL_DECISIONS = {
|
|
121
119
|
"allow-once": {
|
|
122
120
|
label: "Allowed (once)",
|
|
@@ -179,8 +177,7 @@ function parseExecApprovalData(data) {
|
|
|
179
177
|
action: rawAction
|
|
180
178
|
};
|
|
181
179
|
}
|
|
182
|
-
|
|
183
|
-
//#region extensions/discord/src/question-custom-id.ts
|
|
180
|
+
// extensions/discord/src/question-custom-id.ts
|
|
184
181
|
const QUESTION_RECORD_ID_PATTERN = /^ask_[a-f0-9]{32}$/u;
|
|
185
182
|
function buildDiscordQuestionCustomId(callback) {
|
|
186
183
|
if (!QUESTION_RECORD_ID_PATTERN.test(callback.questionId) || !Number.isInteger(callback.optionIndex) || callback.optionIndex < 0 || callback.optionIndex > 3) return;
|
|
@@ -195,8 +192,7 @@ function parseDiscordQuestionData(data) {
|
|
|
195
192
|
optionIndex: Number(rawIndex)
|
|
196
193
|
};
|
|
197
194
|
}
|
|
198
|
-
|
|
199
|
-
//#region extensions/discord/src/shared-interactive.ts
|
|
195
|
+
// extensions/discord/src/shared-interactive.ts
|
|
200
196
|
var shared_interactive_exports = /* @__PURE__ */ __exportAll({
|
|
201
197
|
buildDiscordInteractiveComponents: () => buildDiscordInteractiveComponents,
|
|
202
198
|
buildDiscordPresentationComponents: () => buildDiscordPresentationComponents
|
|
@@ -312,5 +308,4 @@ function buildDiscordPresentationComponents(presentation, options = {}) {
|
|
|
312
308
|
}
|
|
313
309
|
return blocks.length ? { blocks } : void 0;
|
|
314
310
|
}
|
|
315
|
-
//#endregion
|
|
316
311
|
export { parseDiscordModalCustomId as _, DISCORD_APPROVAL_DECISIONS as a, encodeCustomIdComponent as b, DISCORD_COMPONENT_CUSTOM_ID_KEY as c, buildDiscordComponentCustomId as d, buildDiscordModalCustomId as f, parseDiscordComponentCustomIdForInteraction as g, parseDiscordComponentCustomId as h, parseDiscordQuestionData as i, DISCORD_MODAL_CUSTOM_ID_KEY as l, parseDiscordActivityCustomIdForInteraction as m, buildDiscordPresentationComponents as n, buildExecApprovalCustomId as o, parseDiscordActivityCustomId as p, shared_interactive_exports as r, parseExecApprovalData as s, buildDiscordInteractiveComponents as t, buildDiscordActivityCustomId as u, parseDiscordModalCustomIdForInteraction as v, decodeCustomIdComponent as y };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { d as unbindThreadBindingsBySessionKeyAsync, o as listThreadBindingsBySessionKey, s as listThreadBindingsBySessionKeyAsync } from "./thread-bindings-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
|
|
2
|
+
import { d as unbindThreadBindingsBySessionKeyAsync, o as listThreadBindingsBySessionKey, s as listThreadBindingsBySessionKeyAsync } from "./thread-bindings-DTHVdmvF.mjs";
|
|
3
3
|
import { normalizeOptionalLowercaseString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { warnPluginSdkDeprecation } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
|
|
5
|
-
|
|
5
|
+
// extensions/discord/src/subagent-hooks.ts
|
|
6
6
|
var subagent_hooks_exports = /* @__PURE__ */ __exportAll({
|
|
7
7
|
handleDiscordSubagentDeliveryTarget: () => handleDiscordSubagentDeliveryTarget,
|
|
8
8
|
handleDiscordSubagentDeliveryTargetAsync: () => handleDiscordSubagentDeliveryTargetAsync,
|
|
@@ -13,7 +13,7 @@ async function handleDiscordSubagentEnded(event) {
|
|
|
13
13
|
await unbindThreadBindingsBySessionKeyAsync({
|
|
14
14
|
targetSessionKey: event.targetSessionKey,
|
|
15
15
|
accountId: event.accountId,
|
|
16
|
-
targetKind: targetKind === "subagent" || targetKind === "acp" ? targetKind : void 0,
|
|
16
|
+
targetKind: targetKind === "subagent" || targetKind === "acp" || targetKind === "session" ? targetKind : void 0,
|
|
17
17
|
reason: event.reason,
|
|
18
18
|
sendFarewell: event.sendFarewell
|
|
19
19
|
});
|
|
@@ -55,5 +55,4 @@ function resolveDiscordDeliveryTarget(event, bindings) {
|
|
|
55
55
|
threadId: binding.threadId
|
|
56
56
|
} };
|
|
57
57
|
}
|
|
58
|
-
//#endregion
|
|
59
58
|
export { subagent_hooks_exports as i, handleDiscordSubagentDeliveryTargetAsync as n, handleDiscordSubagentEnded as r, handleDiscordSubagentDeliveryTarget as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as discord_exports } from "./discord-
|
|
2
|
-
import { S as formatDiscordUserTag } from "./allow-list-
|
|
3
|
-
|
|
1
|
+
import { t as discord_exports } from "./discord-cXPUdHQi.mjs";
|
|
2
|
+
import { S as formatDiscordUserTag } from "./allow-list-CkqpzPvP.mjs";
|
|
3
|
+
// extensions/discord/src/monitor/system-events.ts
|
|
4
4
|
const SYSTEM_EVENT_ACTIONS = /* @__PURE__ */ new Map([
|
|
5
5
|
[discord_exports.MessageType.ChannelPinnedMessage, "pinned a message"],
|
|
6
6
|
[discord_exports.MessageType.RecipientAdd, "added a recipient"],
|
|
@@ -29,5 +29,4 @@ function resolveDiscordSystemEvent(message, location) {
|
|
|
29
29
|
const authorLabel = message.author ? formatDiscordUserTag(message.author) : "";
|
|
30
30
|
return `Discord system: ${authorLabel ? `${authorLabel} ` : ""}${action} in ${location}`;
|
|
31
31
|
}
|
|
32
|
-
//#endregion
|
|
33
32
|
export { resolveDiscordSystemEvent };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { buildMessagingTarget, parseMentionPrefixOrAtUserTarget, requireTargetKind } from "openclaw/plugin-sdk/channel-targets";
|
|
2
|
-
|
|
2
|
+
// extensions/discord/src/target-parsing.ts
|
|
3
3
|
function parseDiscordTarget(raw, options = {}) {
|
|
4
4
|
const trimmed = raw.trim();
|
|
5
5
|
if (!trimmed) return;
|
|
@@ -44,5 +44,4 @@ function resolveDiscordChannelId(raw) {
|
|
|
44
44
|
kind: "channel"
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
//#endregion
|
|
48
47
|
export { resolveDiscordChannelId as n, parseDiscordTarget as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { l as resolveDiscordAccount, u as resolveDiscordAccountAllowFrom } from "./accounts-
|
|
3
|
-
import { a as allowFromContainsDiscordUserId } from "./send.receipt-
|
|
4
|
-
import {
|
|
5
|
-
import { t as parseDiscordTarget } from "./target-parsing-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
|
|
2
|
+
import { l as resolveDiscordAccount, u as resolveDiscordAccountAllowFrom } from "./accounts-DtjvhJUj.mjs";
|
|
3
|
+
import { a as allowFromContainsDiscordUserId, f as rememberDiscordDirectoryUser } from "./send.receipt-CZ7ks6g7.mjs";
|
|
4
|
+
import { r as listDiscordDirectoryPeersLive } from "./directory-live-B9UoQG9g.mjs";
|
|
5
|
+
import { t as parseDiscordTarget } from "./target-parsing-BiuhcK9Q.mjs";
|
|
6
6
|
import { buildMessagingTarget } from "openclaw/plugin-sdk/channel-targets";
|
|
7
|
-
|
|
7
|
+
// extensions/discord/src/target-resolver.ts
|
|
8
8
|
var target_resolver_exports = /* @__PURE__ */ __exportAll({
|
|
9
9
|
parseAndResolveDiscordTarget: () => parseAndResolveDiscordTarget,
|
|
10
10
|
resolveDiscordTarget: () => resolveDiscordTarget
|
|
@@ -53,5 +53,4 @@ async function parseAndResolveDiscordTarget(raw, options, parseOptions = {}) {
|
|
|
53
53
|
if (!resolved) throw new Error("Recipient is required for Discord sends");
|
|
54
54
|
return resolved;
|
|
55
55
|
}
|
|
56
|
-
//#endregion
|
|
57
56
|
export { resolveDiscordTarget as n, target_resolver_exports as r, parseAndResolveDiscordTarget as t };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { t as parseDiscordTarget } from "./target-parsing-
|
|
3
|
-
import { D as refreshUnboundThreadWebhookIdentity, F as resolveThreadBindingMaxAgeMs, M as resolveThreadBindingIdleTimeoutMs, N as resolveThreadBindingInactivityExpiresAt, P as resolveThreadBindingMaxAgeExpiresAt, S as ensureBindingsLoadedAsync, _ as MANAGERS_BY_ACCOUNT_ID, a as mutateBindingsForTargetSession, g as BINDINGS_BY_THREAD_ID, i as setThreadBindingMaxAgeBySessionKeyAsync, n as setThreadBindingIdleTimeoutBySessionKeyAsync, o as resolveBindingIdsForTargetSession, r as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey, u as removeBindingRecordSync, w as getThreadBindingToken, x as ensureBindingsLoaded } from "./thread-bindings.session-updates-
|
|
4
|
-
import { c as resolveThreadBindingPersonaFromRecord, i as createNoopThreadBindingManager, n as getThreadBindingManager, o as resolveChannelIdForBinding, s as resolveThreadBindingPersona, t as createThreadBindingManager } from "./thread-bindings.manager-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
|
|
2
|
+
import { t as parseDiscordTarget } from "./target-parsing-BiuhcK9Q.mjs";
|
|
3
|
+
import { D as refreshUnboundThreadWebhookIdentity, F as resolveThreadBindingMaxAgeMs, M as resolveThreadBindingIdleTimeoutMs, N as resolveThreadBindingInactivityExpiresAt, P as resolveThreadBindingMaxAgeExpiresAt, S as ensureBindingsLoadedAsync, _ as MANAGERS_BY_ACCOUNT_ID, a as mutateBindingsForTargetSession, g as BINDINGS_BY_THREAD_ID, i as setThreadBindingMaxAgeBySessionKeyAsync, n as setThreadBindingIdleTimeoutBySessionKeyAsync, o as resolveBindingIdsForTargetSession, r as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey, u as removeBindingRecordSync, w as getThreadBindingToken, x as ensureBindingsLoaded } from "./thread-bindings.session-updates-BPO6pPzd.mjs";
|
|
4
|
+
import { c as resolveThreadBindingPersonaFromRecord, i as createNoopThreadBindingManager, n as getThreadBindingManager, o as resolveChannelIdForBinding, s as resolveThreadBindingPersona, t as createThreadBindingManager } from "./thread-bindings.manager-6EnH3YZh.mjs";
|
|
5
5
|
import { normalizeOptionalLowercaseString, normalizeOptionalString, normalizeOptionalStringifiedId, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { runTasksWithConcurrency } from "openclaw/plugin-sdk/concurrency-runtime";
|
|
7
7
|
import { formatThreadBindingDurationLabel as formatThreadBindingDurationLabel$1, resolveThreadBindingIdleTimeoutMsForChannel, resolveThreadBindingIntroText, resolveThreadBindingIntroText as resolveThreadBindingIntroText$1, resolveThreadBindingMaxAgeMsForChannel, resolveThreadBindingThreadName, resolveThreadBindingThreadName as resolveThreadBindingThreadName$1, resolveThreadBindingsEnabled } from "openclaw/plugin-sdk/conversation-runtime";
|
|
8
8
|
import { warnPluginSdkDeprecation } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
|
|
9
9
|
import { prepareAcpSessionEntryRead, readAcpSessionEntryAsync, rethrowIncognitoSessionError } from "openclaw/plugin-sdk/acp-runtime";
|
|
10
|
-
|
|
10
|
+
// extensions/discord/src/monitor/thread-bindings.config.ts
|
|
11
11
|
function resolveDiscordThreadBindingIdleTimeoutMs(params) {
|
|
12
12
|
return resolveThreadBindingIdleTimeoutMsForChannel({
|
|
13
13
|
...params,
|
|
@@ -20,8 +20,7 @@ function resolveDiscordThreadBindingMaxAgeMs(params) {
|
|
|
20
20
|
channel: "discord"
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
//#region extensions/discord/src/monitor/thread-bindings.lifecycle.ts
|
|
23
|
+
// extensions/discord/src/monitor/thread-bindings.lifecycle.ts
|
|
25
24
|
const ACP_STARTUP_HEALTH_PROBE_CONCURRENCY_LIMIT = 8;
|
|
26
25
|
function listThreadBindingsForAccount(accountId) {
|
|
27
26
|
return getThreadBindingManager(accountId)?.listBindings() ?? [];
|
|
@@ -225,8 +224,7 @@ async function reconcileAcpThreadBindings(params, preparations) {
|
|
|
225
224
|
staleSessionKeys: uniqueStrings(staleSessionKeys)
|
|
226
225
|
};
|
|
227
226
|
}
|
|
228
|
-
|
|
229
|
-
//#region extensions/discord/src/monitor/thread-bindings.ts
|
|
227
|
+
// extensions/discord/src/monitor/thread-bindings.ts
|
|
230
228
|
var thread_bindings_exports = /* @__PURE__ */ __exportAll({
|
|
231
229
|
autoBindSpawnedDiscordSubagent: () => autoBindSpawnedDiscordSubagent,
|
|
232
230
|
createNoopThreadBindingManager: () => createNoopThreadBindingManager,
|
|
@@ -255,5 +253,4 @@ var thread_bindings_exports = /* @__PURE__ */ __exportAll({
|
|
|
255
253
|
unbindThreadBindingsBySessionKey: () => unbindThreadBindingsBySessionKey,
|
|
256
254
|
unbindThreadBindingsBySessionKeyAsync: () => unbindThreadBindingsBySessionKeyAsync
|
|
257
255
|
});
|
|
258
|
-
//#endregion
|
|
259
256
|
export { autoBindSpawnedDiscordSubagent as a, listThreadBindingsForAccount as c, unbindThreadBindingsBySessionKeyAsync as d, resolveDiscordThreadBindingIdleTimeoutMs as f, thread_bindings_exports as i, reconcileAcpThreadBindingsOnStartup as l, resolveThreadBindingsEnabled as m, resolveThreadBindingIntroText$1 as n, listThreadBindingsBySessionKey as o, resolveDiscordThreadBindingMaxAgeMs as p, resolveThreadBindingThreadName$1 as r, listThreadBindingsBySessionKeyAsync as s, formatThreadBindingDurationLabel$1 as t, unbindThreadBindingsBySessionKey as u };
|