@openclaw/discord 2026.8.1 → 2026.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account-inspect-BY-ve3yH.js +45 -0
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-CfQ-vSyf.js → accounts-CwJQoLjM.js} +89 -45
- package/dist/action-runtime-api.js +1 -1
- package/dist/{activities-api-Dl-TOyOX.js → activities-api-CkKcHUB6.js} +14 -13
- 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 +17 -17
- package/dist/{approval-handler.runtime-q4Zqo44V.js → approval-handler.runtime-DZM6Kt1Z.js} +8 -7
- package/dist/{audit-DgrvFPGt.js → audit-DIbQA4VT.js} +8 -7
- package/dist/{channel-BsQUalPw.js → channel-CarzU3bg.js} +24 -22
- package/dist/{channel-actions.runtime-UMGGIfSy.js → channel-actions.runtime-B2wMqeVK.js} +13 -11
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-rPs4dsk_.js → channel.setup-z_ewMVa9.js} +18 -18
- package/dist/{components-Dk35LTf_.js → components-gvRA0oaI.js} +1 -1
- package/dist/{config-schema-CxPqtVI1.js → config-schema-B797-Spt.js} +5 -4
- package/dist/{conversation-binding-route-BjvX4e35.js → conversation-binding-route-DPpBRpYI.js} +1 -1
- package/dist/{directory-config-B7DY_pNG.js → directory-config-AA8wQx0D.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-DuAXKkan.js → directory-live-D_kFz_Fj.js} +4 -4
- package/dist/{doctor-zQTtn6hm.js → doctor-QQTOkBfW.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-DZewwLr1.js → handle-action.guild-admin-Cc88ZGon.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/{ingress-identity-CzZKcPK8.js → ingress-identity-BCzfPPYM.js} +1 -1
- package/dist/{message-handler-C5By3yl5.js → message-handler-CAeEpqWo.js} +14 -10
- package/dist/{message-handler.preflight-DrszWuHw.js → message-handler.preflight-CoKoE3dY.js} +24 -19
- package/dist/{message-handler.process-DyFPDLCt.js → message-handler.process-cdIJ_fDT.js} +56 -74
- package/dist/{message-text-Ca8M6TU8.js → message-text-C0K4-fkg.js} +9 -4
- package/dist/{outbound-adapter-Dif8p481.js → outbound-adapter-Ch0At5Ra.js} +34 -24
- package/dist/{outbound-components-wjv7yyAj.js → outbound-components-Bnt_7x7r.js} +3 -3
- package/dist/{outbound-session-route-Bn4uXaoE.js → outbound-session-route-CzzerX2K.js} +10 -7
- package/dist/{owner-access-UlYi9t0M.js → owner-access-yc1sX7Gx.js} +7 -6
- package/dist/{pluralkit-9EuEN4UD.js → pluralkit-B3cUVI7i.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-LXiOcJrH.js → provider-CjI8BSzS.js} +97 -76
- package/dist/{provider-session.runtime-DSNe7r2W.js → provider-session.runtime-DdKRMcE9.js} +3 -3
- package/dist/provider.runtime-Bo1WbLLr.js +2 -0
- package/dist/{realtime-session.runtime-DOViOIjY.js → realtime-session.runtime-37IC-p5K.js} +5 -5
- package/dist/{resolve-allowlist-common-BLoYaxEG.js → resolve-allowlist-common-BJ5UZNNT.js} +3 -3
- package/dist/{resolve-channels-D2yl_2CN.js → resolve-channels-BexR2eUn.js} +4 -4
- package/dist/{resolve-users-BLxfqajZ.js → resolve-users-BtXBCH5W.js} +5 -4
- package/dist/{retry-after-DdLPmPoa.js → retry-after-BrLjLUJi.js} +2 -1
- package/dist/{retry-DqHCW6PV.js → retry-t5RcEsPk.js} +37 -29
- package/dist/{runtime-DrxVBTtp.js → runtime-BNlDfLwS.js} +2 -2
- package/dist/{runtime-BYamRVPN.js → runtime-DydyfxST.js} +126 -92
- 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/{send-UJHiAm4C.js → send-mTKSBdmZ.js} +76 -48
- package/dist/{send.components-CrBJpGT_.js → send.components-nsPnc7kK.js} +20 -14
- package/dist/{send.outbound-D7JYmfm9.js → send.outbound-CaOs9Zy1.js} +34 -20
- package/dist/{send.shared-DZJ1akvQ.js → send.shared-BJHt0Vyf.js} +24 -17
- package/dist/{sender-identity-BJtfyise.js → sender-identity-Dt0imZyY.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-Dii2HTn7.js → shared-BNesVA4P.js} +17 -14
- package/dist/{subagent-hooks-JyGrtQIl.js → subagent-hooks-IeZVPLGj.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{system-events-BEmcj4xJ.js → system-events-Be5EJI3b.js} +2 -2
- package/dist/{target-resolver-V-IYae6s.js → target-resolver-C0MnwEki.js} +6 -5
- package/dist/targets-DQSye1Rv.js +3 -0
- package/dist/{thread-bindings-DvYP79fy.js → thread-bindings-wECUSIIG.js} +6 -5
- package/dist/{thread-bindings.manager-Clm77DBM.js → thread-bindings.manager-B-3UHCc1.js} +28 -25
- package/dist/{thread-bindings.session-updates-CJb-BpPL.js → thread-bindings.session-updates-CC7HoQvt.js} +2 -1
- package/dist/{threading-CXuu_7o9.js → threading-te5ADPQI.js} +8 -6
- package/dist/{timeouts-B9cy6RvQ.js → timeouts-D86uWLt_.js} +1 -1
- package/dist/{transcripts-source-BLEMH_yi.js → transcripts-source-DkUhR7YK.js} +3 -3
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-B9snnwMe.js → typing-DAwJF5VT.js} +2 -2
- package/dist/{voice-runtime-DY6_o73o.js → voice-runtime-COyYYTDD.js} +348 -14
- 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 +2 -2
- package/package.json +5 -5
- package/dist/account-inspect-BDfKyuvL.js +0 -89
- package/dist/provider.runtime-DiInaDXO.js +0 -2
- package/dist/sdk-runtime-6tfgYDjY.js +0 -338
- package/dist/targets-CQp53cGj.js +0 -3
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { _ as inspectDiscordAccountTokenState, o as mergeDiscordAccountConfig, r as listDiscordAccountIds, s as resolveDefaultDiscordAccountId, u as resolveDiscordAccountConfig, v as resolveDiscordAccountAvailability } from "./accounts-CwJQoLjM.js";
|
|
2
|
+
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
3
|
+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
+
import { normalizeSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
5
|
+
//#region extensions/discord/src/account-inspect.ts
|
|
6
|
+
function inspectDiscordAccountPrimary(params) {
|
|
7
|
+
const accountId = normalizeAccountId(params.accountId ?? resolveDefaultDiscordAccountId(params.cfg));
|
|
8
|
+
const merged = mergeDiscordAccountConfig(params.cfg, accountId);
|
|
9
|
+
const enabled = params.cfg.channels?.discord?.enabled !== false && merged.enabled !== false;
|
|
10
|
+
const accountConfig = resolveDiscordAccountConfig(params.cfg, accountId);
|
|
11
|
+
const hasAccountToken = Boolean(accountConfig && Object.hasOwn(accountConfig, "token"));
|
|
12
|
+
return inspectDiscordAccountTokenState({
|
|
13
|
+
base: {
|
|
14
|
+
accountId,
|
|
15
|
+
enabled,
|
|
16
|
+
name: normalizeOptionalString(merged.name)
|
|
17
|
+
},
|
|
18
|
+
config: merged,
|
|
19
|
+
accountToken: accountConfig?.token,
|
|
20
|
+
hasAccountToken,
|
|
21
|
+
channelToken: params.cfg.channels?.discord?.token,
|
|
22
|
+
resolveFallbackToken: () => {
|
|
23
|
+
const envToken = accountId === DEFAULT_ACCOUNT_ID ? normalizeSecretInputString(params.envToken ?? process.env.DISCORD_BOT_TOKEN) : void 0;
|
|
24
|
+
return {
|
|
25
|
+
token: envToken?.replace(/^Bot\s+/i, "") ?? "",
|
|
26
|
+
source: envToken ? "env" : "none"
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function inspectDiscordAccount(params) {
|
|
32
|
+
const account = inspectDiscordAccountPrimary(params);
|
|
33
|
+
return {
|
|
34
|
+
...account,
|
|
35
|
+
...resolveDiscordAccountAvailability({
|
|
36
|
+
account,
|
|
37
|
+
resolveAccounts: () => listDiscordAccountIds(params.cfg).map((accountId) => inspectDiscordAccountPrimary({
|
|
38
|
+
...params,
|
|
39
|
+
accountId
|
|
40
|
+
}))
|
|
41
|
+
})
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { inspectDiscordAccount as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as inspectDiscordAccount } from "./account-inspect-
|
|
1
|
+
import { t as inspectDiscordAccount } from "./account-inspect-BY-ve3yH.js";
|
|
2
2
|
//#region extensions/discord/account-inspect-api.ts
|
|
3
3
|
function inspectDiscordReadOnlyAccount(cfg, accountId) {
|
|
4
4
|
return inspectDiscordAccount({
|
|
@@ -4,8 +4,87 @@ import { mapAllowFromEntries, normalizeChannelDmPolicy } from "openclaw/plugin-s
|
|
|
4
4
|
import { resolveConfiguredFromCredentialStatuses } from "openclaw/plugin-sdk/channel-status";
|
|
5
5
|
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, normalizeAccountId as normalizeAccountId$1, resolveAccountEntry } from "openclaw/plugin-sdk/routing";
|
|
6
6
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
|
+
import { hasConfiguredSecretInput, normalizeResolvedSecretInputString, normalizeSecretInputString, resolveSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
7
8
|
import { getRuntimeConfigSnapshot, getRuntimeConfigSourceSnapshot, selectApplicableRuntimeConfig } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
8
|
-
|
|
9
|
+
//#region extensions/discord/src/account-token-inspect.ts
|
|
10
|
+
function inspectDiscordConfiguredToken(value) {
|
|
11
|
+
const normalized = normalizeSecretInputString(value);
|
|
12
|
+
if (normalized) return {
|
|
13
|
+
token: normalized.replace(/^Bot\s+/i, ""),
|
|
14
|
+
tokenSource: "config",
|
|
15
|
+
tokenStatus: "available"
|
|
16
|
+
};
|
|
17
|
+
if (hasConfiguredSecretInput(value)) return {
|
|
18
|
+
token: "",
|
|
19
|
+
tokenSource: "config",
|
|
20
|
+
tokenStatus: "configured_unavailable"
|
|
21
|
+
};
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
function inspectDiscordAccountTokenState(params) {
|
|
25
|
+
const accountToken = inspectDiscordConfiguredToken(params.accountToken);
|
|
26
|
+
if (accountToken) return {
|
|
27
|
+
...params.base,
|
|
28
|
+
...accountToken,
|
|
29
|
+
configured: true,
|
|
30
|
+
config: params.config
|
|
31
|
+
};
|
|
32
|
+
if (params.hasAccountToken) return {
|
|
33
|
+
...params.base,
|
|
34
|
+
token: "",
|
|
35
|
+
tokenSource: "none",
|
|
36
|
+
tokenStatus: "missing",
|
|
37
|
+
configured: false,
|
|
38
|
+
config: params.config
|
|
39
|
+
};
|
|
40
|
+
const channelToken = inspectDiscordConfiguredToken(params.channelToken);
|
|
41
|
+
if (channelToken) return {
|
|
42
|
+
...params.base,
|
|
43
|
+
...channelToken,
|
|
44
|
+
configured: true,
|
|
45
|
+
config: params.config
|
|
46
|
+
};
|
|
47
|
+
const fallback = params.resolveFallbackToken();
|
|
48
|
+
if (fallback.token) return {
|
|
49
|
+
...params.base,
|
|
50
|
+
token: fallback.token,
|
|
51
|
+
tokenSource: fallback.source,
|
|
52
|
+
tokenStatus: "available",
|
|
53
|
+
configured: true,
|
|
54
|
+
config: params.config
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
...params.base,
|
|
58
|
+
token: "",
|
|
59
|
+
tokenSource: "none",
|
|
60
|
+
tokenStatus: "missing",
|
|
61
|
+
configured: false,
|
|
62
|
+
config: params.config
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/** Runtime and inspection keep the first enabled owner, preferring config over env tokens. */
|
|
66
|
+
function resolveDiscordAccountAvailability(params) {
|
|
67
|
+
if (!params.account.enabled) return {
|
|
68
|
+
enabled: false,
|
|
69
|
+
stateReason: "disabled"
|
|
70
|
+
};
|
|
71
|
+
const token = params.account.token.trim();
|
|
72
|
+
let owner;
|
|
73
|
+
if (token) for (const account of params.resolveAccounts()) {
|
|
74
|
+
if (!account.enabled || account.token.trim() !== token) continue;
|
|
75
|
+
const priority = account.tokenSource === "config" ? 2 : account.tokenSource === "env" ? 1 : 0;
|
|
76
|
+
if (!owner || priority > owner.priority) owner = {
|
|
77
|
+
accountId: account.accountId,
|
|
78
|
+
priority
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const duplicateOwner = owner && owner.accountId !== params.account.accountId ? owner.accountId : void 0;
|
|
82
|
+
return {
|
|
83
|
+
enabled: !duplicateOwner,
|
|
84
|
+
stateReason: duplicateOwner ? `duplicate bot token; using account "${duplicateOwner}"` : void 0
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
9
88
|
//#region extensions/discord/src/runtime-config.ts
|
|
10
89
|
function selectDiscordRuntimeConfig(inputConfig) {
|
|
11
90
|
return selectApplicableRuntimeConfig({
|
|
@@ -186,55 +265,20 @@ function resolveDiscordMaxLinesPerMessage(params) {
|
|
|
186
265
|
accountId: params.accountId
|
|
187
266
|
}).config.maxLinesPerMessage;
|
|
188
267
|
}
|
|
189
|
-
function
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
for (const [index, accountId] of accountIds.entries()) {
|
|
195
|
-
const account = resolveDiscordAccount({
|
|
196
|
-
cfg: params.cfg,
|
|
268
|
+
function inspectDiscordRuntimeAvailability(account, cfg) {
|
|
269
|
+
return resolveDiscordAccountAvailability({
|
|
270
|
+
account,
|
|
271
|
+
resolveAccounts: () => listDiscordAccountIds(cfg).map((accountId) => resolveDiscordAccount({
|
|
272
|
+
cfg,
|
|
197
273
|
accountId
|
|
198
|
-
})
|
|
199
|
-
const accountToken = account.token.trim();
|
|
200
|
-
if (!account.enabled || accountToken !== token) continue;
|
|
201
|
-
const priority = account.tokenSource === "config" ? 2 : account.tokenSource === "env" ? 1 : 0;
|
|
202
|
-
if (!owner || priority > owner.priority) {
|
|
203
|
-
owner = {
|
|
204
|
-
accountId: account.accountId,
|
|
205
|
-
priority,
|
|
206
|
-
index
|
|
207
|
-
};
|
|
208
|
-
continue;
|
|
209
|
-
}
|
|
210
|
-
if (priority === owner.priority && index < owner.index) owner = {
|
|
211
|
-
accountId: account.accountId,
|
|
212
|
-
priority,
|
|
213
|
-
index
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
return owner?.accountId;
|
|
217
|
-
}
|
|
218
|
-
function resolveDiscordDuplicateTokenOwner(params) {
|
|
219
|
-
const owner = resolveDiscordAccountTokenOwner({
|
|
220
|
-
cfg: params.cfg,
|
|
221
|
-
token: params.account.token
|
|
274
|
+
}))
|
|
222
275
|
});
|
|
223
|
-
return owner && owner !== params.account.accountId ? owner : void 0;
|
|
224
276
|
}
|
|
225
277
|
function isDiscordAccountEnabledForRuntime(account, cfg) {
|
|
226
|
-
return account.enabled
|
|
227
|
-
cfg,
|
|
228
|
-
account
|
|
229
|
-
});
|
|
278
|
+
return inspectDiscordRuntimeAvailability(account, cfg).enabled;
|
|
230
279
|
}
|
|
231
280
|
function resolveDiscordAccountDisabledReason(account, cfg) {
|
|
232
|
-
|
|
233
|
-
const owner = resolveDiscordDuplicateTokenOwner({
|
|
234
|
-
cfg,
|
|
235
|
-
account
|
|
236
|
-
});
|
|
237
|
-
return owner ? `duplicate bot token; using account "${owner}"` : "disabled";
|
|
281
|
+
return inspectDiscordRuntimeAvailability(account, cfg).stateReason ?? "disabled";
|
|
238
282
|
}
|
|
239
283
|
function listEnabledDiscordAccounts(cfg) {
|
|
240
284
|
return listDiscordAccountIds(cfg).map((accountId) => resolveDiscordAccount({
|
|
@@ -249,4 +293,4 @@ function listDiscordStartupAccountIds(cfg) {
|
|
|
249
293
|
return [defaultAccountId, ...startupAccountIds.filter((candidateId) => candidateId !== defaultAccountId)];
|
|
250
294
|
}
|
|
251
295
|
//#endregion
|
|
252
|
-
export { listEnabledDiscordAccounts as a, resolveDiscordAccount as c, resolveDiscordAccountDisabledReason as d, resolveDiscordAccountDmPolicy as f, selectDiscordActivitiesRuntimeConfig as g, resolveDiscordToken as h, listDiscordStartupAccountIds as i, resolveDiscordAccountAllowFrom as l, normalizeDiscordToken as m, isDiscordAccountEnabledForRuntime as n, mergeDiscordAccountConfig as o, resolveDiscordMaxLinesPerMessage as p, listDiscordAccountIds as r, resolveDefaultDiscordAccountId as s, createDiscordActionGate as t, resolveDiscordAccountConfig as u };
|
|
296
|
+
export { inspectDiscordAccountTokenState as _, listEnabledDiscordAccounts as a, resolveDiscordAccount as c, resolveDiscordAccountDisabledReason as d, resolveDiscordAccountDmPolicy as f, selectDiscordActivitiesRuntimeConfig as g, resolveDiscordToken as h, listDiscordStartupAccountIds as i, resolveDiscordAccountAllowFrom as l, normalizeDiscordToken as m, isDiscordAccountEnabledForRuntime as n, mergeDiscordAccountConfig as o, resolveDiscordMaxLinesPerMessage as p, listDiscordAccountIds as r, resolveDefaultDiscordAccountId as s, createDiscordActionGate as t, resolveDiscordAccountConfig as u, resolveDiscordAccountAvailability as v };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as handleDiscordAction } from "./runtime-
|
|
1
|
+
import { t as handleDiscordAction } from "./runtime-DydyfxST.js";
|
|
2
2
|
export { handleDiscordAction };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { v as resolveDiscordChannelId$1 } from "./retry-
|
|
2
|
-
import { S as parseDiscordActivityCustomId, i as buildDiscordPresentationComponents } from "./components-
|
|
3
|
-
import { c as resolveDiscordAccount } from "./accounts-
|
|
4
|
-
import { r as sendDiscordComponentMessage } from "./send.components-
|
|
5
|
-
import { r as setDiscordActivitiesRuntime, t as DiscordActivitiesRuntime } from "./runtime-
|
|
1
|
+
import { v as resolveDiscordChannelId$1 } from "./retry-t5RcEsPk.js";
|
|
2
|
+
import { S as parseDiscordActivityCustomId, i as buildDiscordPresentationComponents } from "./components-gvRA0oaI.js";
|
|
3
|
+
import { c as resolveDiscordAccount } from "./accounts-CwJQoLjM.js";
|
|
4
|
+
import { r as sendDiscordComponentMessage } from "./send.components-nsPnc7kK.js";
|
|
5
|
+
import { r as setDiscordActivitiesRuntime, t as DiscordActivitiesRuntime } from "./runtime-BNlDfLwS.js";
|
|
6
6
|
import fs from "node:fs/promises";
|
|
7
7
|
import { logError } from "openclaw/plugin-sdk/logging-core";
|
|
8
8
|
import { resolveRequestClientIp } from "openclaw/plugin-sdk/webhook-ingress";
|
|
@@ -14,7 +14,7 @@ import { fetchWithSsrFGuard as fetchWithSsrFGuard$1 } from "openclaw/plugin-sdk/
|
|
|
14
14
|
const DISCORD_TOKEN_URL = "https://discord.com/api/oauth2/token";
|
|
15
15
|
const DISCORD_USER_URL = "https://discord.com/api/v10/users/@me";
|
|
16
16
|
const DISCORD_HOST = "discord.com";
|
|
17
|
-
const JSON_MAX_BYTES =
|
|
17
|
+
const JSON_MAX_BYTES = 65536;
|
|
18
18
|
const INSTANCE_ID_MAX_LENGTH = 256;
|
|
19
19
|
function normalizeInstanceId(value) {
|
|
20
20
|
const instanceId = value?.trim();
|
|
@@ -243,7 +243,7 @@ run().catch((error) => {
|
|
|
243
243
|
`;
|
|
244
244
|
//#endregion
|
|
245
245
|
//#region extensions/discord/src/activities/http.ts
|
|
246
|
-
const BODY_MAX_BYTES =
|
|
246
|
+
const BODY_MAX_BYTES = 8192;
|
|
247
247
|
const WIDGET_ID_PATTERN = /^[A-Za-z0-9_-]{22}$/;
|
|
248
248
|
const DOC_TOKEN_PATTERN = /^[A-Za-z0-9_-]{43}$/;
|
|
249
249
|
const DISCORD_ACTIVITY_WIDGET_CSP = "sandbox allow-scripts; default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: blob:; font-src data:; connect-src 'none'; frame-ancestors *";
|
|
@@ -466,7 +466,7 @@ function createDiscordActivityHttpHandler(deps) {
|
|
|
466
466
|
}
|
|
467
467
|
//#endregion
|
|
468
468
|
//#region extensions/discord/src/activities/presenter.ts
|
|
469
|
-
const DISCORD_WIDGET_HTML_MAX_BYTES =
|
|
469
|
+
const DISCORD_WIDGET_HTML_MAX_BYTES = 49152;
|
|
470
470
|
function resolveDiscordChannelId(context) {
|
|
471
471
|
const raw = context.nativeChannelId?.trim() || context.currentMessagingTarget?.trim() || context.currentChannelId?.trim() || context.deliveryContext?.to?.trim();
|
|
472
472
|
if (!raw) return;
|
|
@@ -593,12 +593,12 @@ function createDiscordWidgetPresenter(runtime, deps = {}) {
|
|
|
593
593
|
}
|
|
594
594
|
//#endregion
|
|
595
595
|
//#region extensions/discord/src/activities/store.ts
|
|
596
|
-
const DAY_MS =
|
|
596
|
+
const DAY_MS = 864e5;
|
|
597
597
|
const DISCORD_EPOCH_MS = 14200704e5;
|
|
598
598
|
const WIDGET_TTL_MS = 7 * DAY_MS;
|
|
599
|
-
const SESSION_TTL_MS =
|
|
600
|
-
const DOC_TOKEN_TTL_MS =
|
|
601
|
-
const PENDING_LAUNCH_TTL_MS =
|
|
599
|
+
const SESSION_TTL_MS = 9e5;
|
|
600
|
+
const DOC_TOKEN_TTL_MS = 6e4;
|
|
601
|
+
const PENDING_LAUNCH_TTL_MS = 12e4;
|
|
602
602
|
function requireAtomicUpdate(store) {
|
|
603
603
|
if (!store.update) throw new Error("Discord Activities require atomic plugin state updates");
|
|
604
604
|
return store;
|
|
@@ -722,7 +722,8 @@ var DiscordActivityStore = class {
|
|
|
722
722
|
//#region extensions/discord/src/activities/register.ts
|
|
723
723
|
function registerDiscordActivities$1(api) {
|
|
724
724
|
setDiscordActivitiesRuntime(void 0);
|
|
725
|
-
const
|
|
725
|
+
const store = new DiscordActivityStore(openDiscordActivityStores((options) => api.runtime.state.openKeyedStore(options)));
|
|
726
|
+
const runtime = new DiscordActivitiesRuntime(store, api.config, api.runtime.config?.current ? () => api.runtime.config.current() : void 0);
|
|
726
727
|
setDiscordActivitiesRuntime(runtime);
|
|
727
728
|
const http = createDiscordActivityHttpHandler({
|
|
728
729
|
runtime,
|
package/dist/activities-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as registerDiscordActivities } from "./activities-api-
|
|
1
|
+
import { t as registerDiscordActivities } from "./activities-api-CkKcHUB6.js";
|
|
2
2
|
export { registerDiscordActivities };
|
|
@@ -258,10 +258,12 @@ function buildDiscordChannelKeys(params) {
|
|
|
258
258
|
return buildChannelKeyCandidates(params.id, allowNameMatch ? params.slug : void 0, allowNameMatch ? params.name : void 0);
|
|
259
259
|
}
|
|
260
260
|
function resolveDiscordChannelEntryMatch(channels, params, parentParams) {
|
|
261
|
+
const keys = buildDiscordChannelKeys(params);
|
|
262
|
+
const parentKeys = parentParams ? buildDiscordChannelKeys(parentParams) : void 0;
|
|
261
263
|
return resolveChannelEntryMatchWithFallback({
|
|
262
264
|
entries: channels,
|
|
263
|
-
keys
|
|
264
|
-
parentKeys
|
|
265
|
+
keys,
|
|
266
|
+
parentKeys,
|
|
265
267
|
wildcardKey: "*"
|
|
266
268
|
});
|
|
267
269
|
}
|
|
@@ -288,18 +290,19 @@ function resolveDiscordChannelConfig(params) {
|
|
|
288
290
|
const { guildInfo, channelId, channelName, channelSlug } = params;
|
|
289
291
|
const channels = guildInfo?.channels;
|
|
290
292
|
if (!hasConfiguredDiscordChannels(channels)) return null;
|
|
291
|
-
|
|
293
|
+
const match = resolveDiscordChannelEntryMatch(channels, {
|
|
292
294
|
id: channelId,
|
|
293
295
|
name: channelName,
|
|
294
296
|
slug: channelSlug
|
|
295
|
-
})
|
|
297
|
+
});
|
|
298
|
+
return resolveChannelMatchConfig(match, resolveDiscordChannelConfigEntry) ?? { allowed: false };
|
|
296
299
|
}
|
|
297
300
|
function resolveDiscordChannelConfigWithFallback(params) {
|
|
298
301
|
const { guildInfo, channelId, channelName, channelSlug, parentId, parentName, parentSlug, scope } = params;
|
|
299
302
|
const channels = guildInfo?.channels;
|
|
300
303
|
if (!hasConfiguredDiscordChannels(channels)) return null;
|
|
301
304
|
const resolvedParentSlug = parentSlug ?? (parentName ? normalizeDiscordSlug(parentName) : "");
|
|
302
|
-
|
|
305
|
+
const match = resolveDiscordChannelEntryMatch(channels, {
|
|
303
306
|
id: channelId,
|
|
304
307
|
name: channelName,
|
|
305
308
|
slug: channelSlug,
|
|
@@ -308,7 +311,8 @@ function resolveDiscordChannelConfigWithFallback(params) {
|
|
|
308
311
|
id: parentId ?? "",
|
|
309
312
|
name: parentName,
|
|
310
313
|
slug: resolvedParentSlug
|
|
311
|
-
} : void 0)
|
|
314
|
+
} : void 0);
|
|
315
|
+
return resolveChannelMatchConfig(match, resolveDiscordChannelConfigEntry) ?? { allowed: false };
|
|
312
316
|
}
|
|
313
317
|
function resolveDiscordShouldRequireMention(params) {
|
|
314
318
|
if (!params.isGuildMessage) return false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as parseDiscordRetryAfterBodySeconds } from "./retry-after-
|
|
1
|
+
import { t as parseDiscordRetryAfterBodySeconds } from "./retry-after-BrLjLUJi.js";
|
|
2
2
|
import { redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
|
|
3
3
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
4
4
|
import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
|
|
@@ -27,12 +27,12 @@ const DISCORD_API_BASE = "https://discord.com/api/v10";
|
|
|
27
27
|
const DISCORD_API_RETRY_DEFAULTS = {
|
|
28
28
|
attempts: 3,
|
|
29
29
|
minDelayMs: 500,
|
|
30
|
-
maxDelayMs:
|
|
30
|
+
maxDelayMs: 3e5,
|
|
31
31
|
jitter: .1
|
|
32
32
|
};
|
|
33
33
|
const DISCORD_API_429_FALLBACK_RETRY_AFTER_SECONDS = 60;
|
|
34
|
-
const DISCORD_API_ERROR_BODY_LIMIT_BYTES =
|
|
35
|
-
const DISCORD_API_RESPONSE_BODY_LIMIT_BYTES =
|
|
34
|
+
const DISCORD_API_ERROR_BODY_LIMIT_BYTES = 8192;
|
|
35
|
+
const DISCORD_API_RESPONSE_BODY_LIMIT_BYTES = 4194304;
|
|
36
36
|
const DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS = 1e4;
|
|
37
37
|
function parseDiscordApiErrorPayload(text) {
|
|
38
38
|
const trimmed = text.trim();
|
|
@@ -46,7 +46,8 @@ function parseDiscordApiErrorPayload(text) {
|
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
48
48
|
function parseRetryAfterSeconds(text, response) {
|
|
49
|
-
const
|
|
49
|
+
const payload = parseDiscordApiErrorPayload(text);
|
|
50
|
+
const retryAfter = parseDiscordRetryAfterBodySeconds(payload?.retry_after);
|
|
50
51
|
if (retryAfter !== void 0) return retryAfter;
|
|
51
52
|
const header = response.headers.get("Retry-After");
|
|
52
53
|
if (!header) return;
|
package/dist/api.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { _ as parseDiscordTarget, g as normalizeDiscordOutboundTarget, h as normalizeDiscordMessagingTarget, m as looksLikeDiscordTargetId, v as resolveDiscordChannelId } from "./retry-
|
|
2
|
-
import { D as parseDiscordModalCustomIdForInteraction, E as parseDiscordModalCustomId, T as parseDiscordComponentCustomIdForInteraction, _ as DISCORD_COMPONENT_CUSTOM_ID_KEY, b as buildDiscordComponentCustomId, d as buildDiscordComponentMessage, f as buildDiscordComponentMessageFlags, g as resolveDiscordComponentAttachmentName, h as readDiscordComponentSpec, l as DiscordFormModal, n as formatDiscordComponentEventText, p as DISCORD_COMPONENT_ATTACHMENT_PREFIX, r as buildDiscordInteractiveComponents, u as createDiscordFormModal, v as DISCORD_MODAL_CUSTOM_ID_KEY, w as parseDiscordComponentCustomId, x as buildDiscordModalCustomId } from "./components-
|
|
3
|
-
import { a as listEnabledDiscordAccounts, c as resolveDiscordAccount, o as mergeDiscordAccountConfig, p as resolveDiscordMaxLinesPerMessage, r as listDiscordAccountIds, s as resolveDefaultDiscordAccountId, t as createDiscordActionGate, u as resolveDiscordAccountConfig } from "./accounts-
|
|
4
|
-
import { i as requestDiscord, n as DiscordApiError, r as fetchDiscord } from "./api-
|
|
5
|
-
import { i as parseDiscordSendTarget, n as resolveDiscordTarget } from "./target-resolver-
|
|
6
|
-
import { t as inspectDiscordAccount } from "./account-inspect-
|
|
7
|
-
import { i as DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, r as DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-
|
|
8
|
-
import "./targets-
|
|
9
|
-
import { C as shouldSuppressLocalDiscordExecApprovalPrompt, S as isDiscordExecApprovalClientEnabled, b as getDiscordExecApprovalApprovers, x as isDiscordExecApprovalApprover } from "./outbound-session-route-
|
|
10
|
-
import { i as resolveDiscordGroupToolPolicy, n as collectDiscordStatusIssues, r as resolveDiscordGroupRequireMention, t as discordPlugin } from "./channel-
|
|
1
|
+
import { _ as parseDiscordTarget, g as normalizeDiscordOutboundTarget, h as normalizeDiscordMessagingTarget, m as looksLikeDiscordTargetId, v as resolveDiscordChannelId } from "./retry-t5RcEsPk.js";
|
|
2
|
+
import { D as parseDiscordModalCustomIdForInteraction, E as parseDiscordModalCustomId, T as parseDiscordComponentCustomIdForInteraction, _ as DISCORD_COMPONENT_CUSTOM_ID_KEY, b as buildDiscordComponentCustomId, d as buildDiscordComponentMessage, f as buildDiscordComponentMessageFlags, g as resolveDiscordComponentAttachmentName, h as readDiscordComponentSpec, l as DiscordFormModal, n as formatDiscordComponentEventText, p as DISCORD_COMPONENT_ATTACHMENT_PREFIX, r as buildDiscordInteractiveComponents, u as createDiscordFormModal, v as DISCORD_MODAL_CUSTOM_ID_KEY, w as parseDiscordComponentCustomId, x as buildDiscordModalCustomId } from "./components-gvRA0oaI.js";
|
|
3
|
+
import { a as listEnabledDiscordAccounts, c as resolveDiscordAccount, o as mergeDiscordAccountConfig, p as resolveDiscordMaxLinesPerMessage, r as listDiscordAccountIds, s as resolveDefaultDiscordAccountId, t as createDiscordActionGate, u as resolveDiscordAccountConfig } from "./accounts-CwJQoLjM.js";
|
|
4
|
+
import { i as requestDiscord, n as DiscordApiError, r as fetchDiscord } from "./api-BfmEP6wp.js";
|
|
5
|
+
import { i as parseDiscordSendTarget, n as resolveDiscordTarget } from "./target-resolver-C0MnwEki.js";
|
|
6
|
+
import { t as inspectDiscordAccount } from "./account-inspect-BY-ve3yH.js";
|
|
7
|
+
import { i as DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, r as DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-D86uWLt_.js";
|
|
8
|
+
import "./targets-DQSye1Rv.js";
|
|
9
|
+
import { C as shouldSuppressLocalDiscordExecApprovalPrompt, S as isDiscordExecApprovalClientEnabled, b as getDiscordExecApprovalApprovers, x as isDiscordExecApprovalApprover } from "./outbound-session-route-CzzerX2K.js";
|
|
10
|
+
import { i as resolveDiscordGroupToolPolicy, n as collectDiscordStatusIssues, r as resolveDiscordGroupRequireMention, t as discordPlugin } from "./channel-CarzU3bg.js";
|
|
11
11
|
import { t as normalizeExplicitDiscordSessionKey } from "./session-key-normalization-wJgsKPNF.js";
|
|
12
|
-
import { t as discordSetupPlugin } from "./channel.setup-
|
|
13
|
-
import { n as handleDiscordSubagentEnded, t as handleDiscordSubagentDeliveryTarget } from "./subagent-hooks-
|
|
14
|
-
import { t as tryHandleDiscordMessageActionGuildAdmin } from "./handle-action.guild-admin-
|
|
15
|
-
import { n as listDiscordDirectoryGroupsFromConfig, r as listDiscordDirectoryPeersFromConfig } from "./directory-config-
|
|
16
|
-
import { t as fetchPluralKitMessageInfo } from "./pluralkit-
|
|
17
|
-
import { i as probeDiscord, n as fetchDiscordApplicationSummary, o as resolveDiscordPrivilegedIntentsFromFlags, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-
|
|
12
|
+
import { t as discordSetupPlugin } from "./channel.setup-z_ewMVa9.js";
|
|
13
|
+
import { n as handleDiscordSubagentEnded, t as handleDiscordSubagentDeliveryTarget } from "./subagent-hooks-IeZVPLGj.js";
|
|
14
|
+
import { t as tryHandleDiscordMessageActionGuildAdmin } from "./handle-action.guild-admin-Cc88ZGon.js";
|
|
15
|
+
import { n as listDiscordDirectoryGroupsFromConfig, r as listDiscordDirectoryPeersFromConfig } from "./directory-config-AA8wQx0D.js";
|
|
16
|
+
import { t as fetchPluralKitMessageInfo } from "./pluralkit-B3cUVI7i.js";
|
|
17
|
+
import { i as probeDiscord, n as fetchDiscordApplicationSummary, o as resolveDiscordPrivilegedIntentsFromFlags, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-3ovFAp3b.js";
|
|
18
18
|
import { t as collectDiscordSecurityAuditFindings } from "./security-audit-DKfK-iPY.js";
|
|
19
19
|
import { resolveOpenProviderRuntimeGroupPolicy as resolveDiscordRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
20
20
|
//#region extensions/discord/api.ts
|
|
21
|
-
const handleDiscordMessageAction = async (...args) => (await import("./channel-actions.runtime-
|
|
21
|
+
const handleDiscordMessageAction = async (...args) => (await import("./channel-actions.runtime-B2wMqeVK.js")).handleDiscordMessageAction(...args);
|
|
22
22
|
/**
|
|
23
23
|
* @deprecated Shipped `@openclaw/discord/api` compatibility only. Use native
|
|
24
24
|
* `AbortSignal.any` after filtering optional signals. Removal with the next
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Dt as deleteChannelMessage, _t as stripUndefinedFields, ct as Row, et as Button, ft as TextDisplay, kt as editChannelMessage, nt as Container, q as serializePayload, ut as Separator, wt as createChannelMessage, yt as createUserDmChannel } from "./retry-
|
|
2
|
-
import { s as buildExecApprovalCustomId } from "./components-
|
|
3
|
-
import { N as createDiscordClient, O as createDiscordMessageNonce } from "./send.shared-
|
|
4
|
-
import { S as isDiscordExecApprovalClientEnabled, n as DISCORD_APPROVAL_ALLOWED_MENTIONS, r as formatDiscordApprovalDisplayValue } from "./outbound-session-route-
|
|
5
|
-
import { a as shouldHandleDiscordApprovalRequest } from "./channel-
|
|
1
|
+
import { Dt as deleteChannelMessage, _t as stripUndefinedFields, ct as Row, et as Button, ft as TextDisplay, kt as editChannelMessage, nt as Container, q as serializePayload, ut as Separator, wt as createChannelMessage, yt as createUserDmChannel } from "./retry-t5RcEsPk.js";
|
|
2
|
+
import { s as buildExecApprovalCustomId } from "./components-gvRA0oaI.js";
|
|
3
|
+
import { N as createDiscordClient, O as createDiscordMessageNonce } from "./send.shared-BJHt0Vyf.js";
|
|
4
|
+
import { S as isDiscordExecApprovalClientEnabled, n as DISCORD_APPROVAL_ALLOWED_MENTIONS, r as formatDiscordApprovalDisplayValue } from "./outbound-session-route-CzzerX2K.js";
|
|
5
|
+
import { a as shouldHandleDiscordApprovalRequest } from "./channel-CarzU3bg.js";
|
|
6
6
|
import { logDebug, logError } from "openclaw/plugin-sdk/logging-core";
|
|
7
7
|
import { ButtonStyle } from "discord-api-types/v10";
|
|
8
8
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -224,12 +224,13 @@ const discordApprovalNativeRuntime = createChannelApprovalNativeRuntimeAdapter({
|
|
|
224
224
|
context
|
|
225
225
|
});
|
|
226
226
|
if (!resolved) return { body: {} };
|
|
227
|
-
|
|
227
|
+
const container = createApprovalContainer({
|
|
228
228
|
view,
|
|
229
229
|
cfg,
|
|
230
230
|
accountId: resolved.accountId,
|
|
231
231
|
actionRow: createApprovalActionRow(view)
|
|
232
|
-
})
|
|
232
|
+
});
|
|
233
|
+
return { body: stripUndefinedFields(serializePayload(buildExecApprovalPayload(container))) };
|
|
233
234
|
},
|
|
234
235
|
buildResolvedResult: ({ cfg, accountId, context, view }) => {
|
|
235
236
|
const resolvedContext = resolveHandlerContext({
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { on as __exportAll } from "./retry-
|
|
2
|
-
import { x as fetchChannelPermissionsDiscord } from "./send.shared-
|
|
3
|
-
import { t as inspectDiscordAccount } from "./account-inspect-
|
|
4
|
-
import "./send-
|
|
5
|
-
import { _ as auditDiscordChannelPermissionsWithFetcher, v as collectDiscordAuditChannelIdsForAccount } from "./outbound-session-route-
|
|
1
|
+
import { on as __exportAll } from "./retry-t5RcEsPk.js";
|
|
2
|
+
import { x as fetchChannelPermissionsDiscord } from "./send.shared-BJHt0Vyf.js";
|
|
3
|
+
import { t as inspectDiscordAccount } from "./account-inspect-BY-ve3yH.js";
|
|
4
|
+
import "./send-mTKSBdmZ.js";
|
|
5
|
+
import { _ as auditDiscordChannelPermissionsWithFetcher, v as collectDiscordAuditChannelIdsForAccount } from "./outbound-session-route-CzzerX2K.js";
|
|
6
6
|
//#region extensions/discord/src/audit.ts
|
|
7
7
|
var audit_exports = /* @__PURE__ */ __exportAll({
|
|
8
8
|
auditDiscordChannelPermissions: () => auditDiscordChannelPermissions,
|
|
9
9
|
collectDiscordAuditChannelIds: () => collectDiscordAuditChannelIds
|
|
10
10
|
});
|
|
11
11
|
function collectDiscordAuditChannelIds(params) {
|
|
12
|
-
|
|
12
|
+
const account = inspectDiscordAccount({
|
|
13
13
|
cfg: params.cfg,
|
|
14
14
|
accountId: params.accountId
|
|
15
|
-
})
|
|
15
|
+
});
|
|
16
|
+
return collectDiscordAuditChannelIdsForAccount(account.config);
|
|
16
17
|
}
|
|
17
18
|
async function auditDiscordChannelPermissions(params) {
|
|
18
19
|
return await auditDiscordChannelPermissionsWithFetcher({
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { _ as parseDiscordTarget, h as normalizeDiscordMessagingTarget, m as looksLikeDiscordTargetId } from "./retry-
|
|
2
|
-
import { c as resolveDiscordAccount, i as listDiscordStartupAccountIds, l as resolveDiscordAccountAllowFrom, r as listDiscordAccountIds, s as resolveDefaultDiscordAccountId } from "./accounts-
|
|
1
|
+
import { _ as parseDiscordTarget, h as normalizeDiscordMessagingTarget, m as looksLikeDiscordTargetId } from "./retry-t5RcEsPk.js";
|
|
2
|
+
import { c as resolveDiscordAccount, i as listDiscordStartupAccountIds, l as resolveDiscordAccountAllowFrom, r as listDiscordAccountIds, s as resolveDefaultDiscordAccountId } from "./accounts-CwJQoLjM.js";
|
|
3
3
|
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
4
|
-
import { u as withAbortTimeout } from "./timeouts-
|
|
5
|
-
import { C as shouldSuppressLocalDiscordExecApprovalPrompt, D as isChannelExecApprovalClientEnabledFromConfig, E as createChannelNativeOriginTargetResolver, O as matchesApprovalRequestFilters, S as isDiscordExecApprovalClientEnabled, T as createChannelApproverDmTargetResolver, b as getDiscordExecApprovalApprovers, d as resolveDiscordCurrentConversationIdentity, f as resolveDiscordRuntimeBindingConversationId, p as discordMessageActions, s as resolveDiscordConversationRoute, t as resolveDiscordOutboundSessionRoute, w as createApproverRestrictedNativeApprovalCapability, x as isDiscordExecApprovalApprover, y as resolveRequiredDiscordChannelPermissions } from "./outbound-session-route-
|
|
6
|
-
import { a as discordSecurityAdapter, c as buildTokenChannelStatusSummary, i as discordSetupContract, l as projectCredentialSnapshotFields, n as discordConfigAdapter, o as DEFAULT_ACCOUNT_ID, s as PAIRING_APPROVED_MESSAGE, t as createDiscordPluginBase, u as resolveConfiguredFromCredentialStatuses } from "./shared-
|
|
4
|
+
import { u as withAbortTimeout } from "./timeouts-D86uWLt_.js";
|
|
5
|
+
import { C as shouldSuppressLocalDiscordExecApprovalPrompt, D as isChannelExecApprovalClientEnabledFromConfig, E as createChannelNativeOriginTargetResolver, O as matchesApprovalRequestFilters, S as isDiscordExecApprovalClientEnabled, T as createChannelApproverDmTargetResolver, b as getDiscordExecApprovalApprovers, d as resolveDiscordCurrentConversationIdentity, f as resolveDiscordRuntimeBindingConversationId, p as discordMessageActions, s as resolveDiscordConversationRoute, t as resolveDiscordOutboundSessionRoute, w as createApproverRestrictedNativeApprovalCapability, x as isDiscordExecApprovalApprover, y as resolveRequiredDiscordChannelPermissions } from "./outbound-session-route-CzzerX2K.js";
|
|
6
|
+
import { a as discordSecurityAdapter, c as buildTokenChannelStatusSummary, i as discordSetupContract, l as projectCredentialSnapshotFields, n as discordConfigAdapter, o as DEFAULT_ACCOUNT_ID, s as PAIRING_APPROVED_MESSAGE, t as createDiscordPluginBase, u as resolveConfiguredFromCredentialStatuses } from "./shared-BNesVA4P.js";
|
|
7
7
|
import { r as openDiscordCommandDeployHashStore } from "./command-deploy-store-DFkBTViB.js";
|
|
8
|
-
import { t as resolveDiscordConversationBindingRoute } from "./conversation-binding-route-
|
|
9
|
-
import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-
|
|
10
|
-
import { n as discordOutbound } from "./outbound-adapter-
|
|
8
|
+
import { t as resolveDiscordConversationBindingRoute } from "./conversation-binding-route-DPpBRpYI.js";
|
|
9
|
+
import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-CC7HoQvt.js";
|
|
10
|
+
import { n as discordOutbound } from "./outbound-adapter-Ch0At5Ra.js";
|
|
11
11
|
import { t as normalizeExplicitDiscordSessionKey } from "./session-key-normalization-wJgsKPNF.js";
|
|
12
12
|
import { t as defaultTopLevelPlacement } from "./thread-binding-api-BDZJD4na.js";
|
|
13
13
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -192,7 +192,7 @@ function createDiscordApprovalCapability(configOverride) {
|
|
|
192
192
|
request,
|
|
193
193
|
configOverride
|
|
194
194
|
}),
|
|
195
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
195
|
+
load: async () => (await import("./approval-handler.runtime-DZM6Kt1Z.js")).discordApprovalNativeRuntime
|
|
196
196
|
})
|
|
197
197
|
});
|
|
198
198
|
}
|
|
@@ -299,22 +299,22 @@ function resolveDiscordInboundConversation(params) {
|
|
|
299
299
|
}
|
|
300
300
|
//#endregion
|
|
301
301
|
//#region extensions/discord/src/channel.loaders.ts
|
|
302
|
-
const loadDiscordDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-
|
|
303
|
-
const loadDiscordResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels-
|
|
304
|
-
const loadDiscordResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-
|
|
305
|
-
const loadDiscordThreadBindingsManagerModule = createLazyRuntimeModule(() => import("./thread-bindings.manager-
|
|
306
|
-
const loadDiscordTargetResolverModule = createLazyRuntimeModule(() => import("./target-resolver-
|
|
307
|
-
const loadDiscordProviderRuntime = createLazyRuntimeModule(() => import("./provider.runtime-
|
|
308
|
-
const loadDiscordProbeRuntime = createLazyRuntimeModule(() => import("./probe.runtime-
|
|
302
|
+
const loadDiscordDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-AA8wQx0D.js").then((n) => n.t));
|
|
303
|
+
const loadDiscordResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels-BexR2eUn.js").then((n) => n.n));
|
|
304
|
+
const loadDiscordResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-BtXBCH5W.js").then((n) => n.n));
|
|
305
|
+
const loadDiscordThreadBindingsManagerModule = createLazyRuntimeModule(() => import("./thread-bindings.manager-B-3UHCc1.js").then((n) => n.i));
|
|
306
|
+
const loadDiscordTargetResolverModule = createLazyRuntimeModule(() => import("./target-resolver-C0MnwEki.js").then((n) => n.r));
|
|
307
|
+
const loadDiscordProviderRuntime = createLazyRuntimeModule(() => import("./provider.runtime-Bo1WbLLr.js"));
|
|
308
|
+
const loadDiscordProbeRuntime = createLazyRuntimeModule(() => import("./probe.runtime-BckHn3cJ.js"));
|
|
309
309
|
async function probeDiscordStatusAccount(params) {
|
|
310
310
|
const startedAtMs = Date.now();
|
|
311
311
|
const runtime = await loadDiscordProbeRuntime();
|
|
312
312
|
const remainingMs = Math.max(1, params.timeoutMs - Math.max(0, Date.now() - startedAtMs));
|
|
313
313
|
return await runtime.probeDiscord(params.token, remainingMs, { includeApplication: true });
|
|
314
314
|
}
|
|
315
|
-
const loadDiscordAuditModule = createLazyRuntimeModule(() => import("./audit-
|
|
316
|
-
const loadDiscordSendModule = createLazyRuntimeModule(() => import("./send-
|
|
317
|
-
const loadDiscordDirectoryLiveModule = createLazyRuntimeModule(() => import("./directory-live-
|
|
315
|
+
const loadDiscordAuditModule = createLazyRuntimeModule(() => import("./audit-DIbQA4VT.js").then((n) => n.n));
|
|
316
|
+
const loadDiscordSendModule = createLazyRuntimeModule(() => import("./send-mTKSBdmZ.js").then((n) => n.t));
|
|
317
|
+
const loadDiscordDirectoryLiveModule = createLazyRuntimeModule(() => import("./directory-live-D_kFz_Fj.js").then((n) => n.t));
|
|
318
318
|
//#endregion
|
|
319
319
|
//#region extensions/discord/src/conversation-route-owner.ts
|
|
320
320
|
function inspectDiscordConversationRouteOwner(params) {
|
|
@@ -426,8 +426,9 @@ function resolveDiscordGroupRequireMention(params) {
|
|
|
426
426
|
return resolveScopeRequireMention(resolveDiscordPolicyScope(params));
|
|
427
427
|
}
|
|
428
428
|
function resolveDiscordGroupToolPolicy(params) {
|
|
429
|
+
const scope = resolveDiscordPolicyScope(params);
|
|
429
430
|
return resolveScopeToolsPolicy({
|
|
430
|
-
...
|
|
431
|
+
...scope,
|
|
431
432
|
senderPolicyMode: params.senderPolicyMode,
|
|
432
433
|
senderId: params.senderId,
|
|
433
434
|
senderName: params.senderName,
|
|
@@ -764,10 +765,11 @@ const discordPlugin = createChatChannelPlugin({
|
|
|
764
765
|
}).map(toConversationLifecycleBinding)
|
|
765
766
|
},
|
|
766
767
|
heartbeat: { sendTyping: async ({ cfg, to, accountId, threadId }) => {
|
|
767
|
-
const
|
|
768
|
+
const resolvedTo = resolveDiscordAttachedOutboundTarget({
|
|
768
769
|
to,
|
|
769
770
|
threadId
|
|
770
|
-
})
|
|
771
|
+
});
|
|
772
|
+
const target = parseDiscordTarget(resolvedTo, { defaultKind: "channel" });
|
|
771
773
|
if (!target || target.kind !== "channel") return;
|
|
772
774
|
await (await loadDiscordSendModule()).sendTypingDiscord(target.id, {
|
|
773
775
|
cfg,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { _ as parseDiscordTarget, v as resolveDiscordChannelId } from "./retry-
|
|
2
|
-
import { i as buildDiscordPresentationComponents, m as coerceDiscordComponentParam, r as buildDiscordInteractiveComponents } from "./components-
|
|
3
|
-
import { a as readDiscordAutoArchiveDurationParam, t as handleDiscordAction } from "./runtime-
|
|
4
|
-
import "./targets-
|
|
1
|
+
import { _ as parseDiscordTarget, v as resolveDiscordChannelId } from "./retry-t5RcEsPk.js";
|
|
2
|
+
import { i as buildDiscordPresentationComponents, m as coerceDiscordComponentParam, r as buildDiscordInteractiveComponents } from "./components-gvRA0oaI.js";
|
|
3
|
+
import { a as readDiscordAutoArchiveDurationParam, t as handleDiscordAction } from "./runtime-DydyfxST.js";
|
|
4
|
+
import "./targets-DQSye1Rv.js";
|
|
5
5
|
import "./action-runtime-api.js";
|
|
6
|
-
import { h as discordInboundEventDelivery } from "./outbound-session-route-
|
|
7
|
-
import { r as isDiscordComponentSpecWithinMessageLimit, t as DISCORD_PRESENTATION_CAPABILITIES } from "./outbound-components-
|
|
8
|
-
import { t as tryHandleDiscordMessageActionGuildAdmin } from "./handle-action.guild-admin-
|
|
6
|
+
import { h as discordInboundEventDelivery } from "./outbound-session-route-CzzerX2K.js";
|
|
7
|
+
import { r as isDiscordComponentSpecWithinMessageLimit, t as DISCORD_PRESENTATION_CAPABILITIES } from "./outbound-components-Bnt_7x7r.js";
|
|
8
|
+
import { t as tryHandleDiscordMessageActionGuildAdmin } from "./handle-action.guild-admin-Cc88ZGon.js";
|
|
9
9
|
import { n as notifyDiscordActiveTurnThreadCreated, r as notifyDiscordActiveTurnThreadReplyDelivered } from "./active-turn-thread-route-fmHl1HNd.js";
|
|
10
10
|
import { normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
11
11
|
import { adaptMessagePresentationForChannel, normalizeLegacyInteractiveReply, normalizeMessagePresentation, renderMessagePresentationFallbackText } from "openclaw/plugin-sdk/interactive-runtime";
|
|
@@ -90,10 +90,11 @@ async function handleDiscordMessageAction(ctx) {
|
|
|
90
90
|
const requestedContent = readStringParam$1(params, "message", { allowEmpty: true });
|
|
91
91
|
const explicitComponents = coerceDiscordComponentParam(params.components);
|
|
92
92
|
const presentation = explicitComponents == null ? normalizeMessagePresentation(params.presentation) : void 0;
|
|
93
|
-
const
|
|
93
|
+
const adaptedPresentation = presentation ? adaptMessagePresentationForChannel({
|
|
94
94
|
presentation,
|
|
95
95
|
capabilities: DISCORD_PRESENTATION_CAPABILITIES
|
|
96
|
-
}) : void 0
|
|
96
|
+
}) : void 0;
|
|
97
|
+
const generatedPresentationComponents = buildDiscordPresentationComponents(adaptedPresentation);
|
|
97
98
|
const presentationComponents = generatedPresentationComponents && isDiscordComponentSpecWithinMessageLimit({
|
|
98
99
|
spec: generatedPresentationComponents,
|
|
99
100
|
fallbackText: requestedContent,
|
|
@@ -171,10 +172,11 @@ async function handleDiscordMessageAction(ctx) {
|
|
|
171
172
|
return withAdoptedThreadReplyRoute(result, to, sessionKey);
|
|
172
173
|
}
|
|
173
174
|
if (action === "react") {
|
|
174
|
-
const
|
|
175
|
+
const messageIdRaw = resolveReactionMessageId({
|
|
175
176
|
args: params,
|
|
176
177
|
toolContext: ctx.toolContext
|
|
177
|
-
})
|
|
178
|
+
});
|
|
179
|
+
const messageId = normalizeOptionalStringifiedId(messageIdRaw) ?? "";
|
|
178
180
|
if (!messageId) throw new Error("messageId required. Provide messageId explicitly or react to the current inbound message.");
|
|
179
181
|
const emoji = readStringParam$1(params, "emoji", { allowEmpty: true });
|
|
180
182
|
const remove = readBooleanParam(params, "remove");
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as DiscordChannelConfigSchema } from "./config-schema-
|
|
1
|
+
import { t as DiscordChannelConfigSchema } from "./config-schema-B797-Spt.js";
|
|
2
2
|
export { DiscordChannelConfigSchema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as discordPlugin } from "./channel-
|
|
1
|
+
import { t as discordPlugin } from "./channel-CarzU3bg.js";
|
|
2
2
|
export { discordPlugin };
|