@openclaw/discord 2026.7.2-beta.7 → 2026.8.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-inspect-SXiCBCgP.js → account-inspect-CqzrH14k.js} +48 -42
- package/dist/account-inspect-api.js +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/{active-turn-thread-route-MlKWp8RD.js → active-turn-thread-route-fmHl1HNd.js} +9 -11
- package/dist/{activities-api-DTKsuDxf.js → activities-api-DS7vpdtp.js} +4 -4
- package/dist/activities-api.js +1 -1
- package/dist/{allow-list-DzKrtfah.js → allow-list-DnxIlPP2.js} +2 -3
- package/dist/{api-DnrK9gML.js → api-DNVbJyEy.js} +7 -2
- package/dist/api.js +15 -15
- package/dist/{approval-handler.runtime-HymvFTYn.js → approval-handler.runtime-B6yEV79q.js} +5 -5
- package/dist/{approval-message-safety-DEyKVsAw.js → approval-message-safety-AcIxvrf3.js} +1 -1
- package/dist/{audit-CjsrabP8.js → audit-Db-rlntl.js} +4 -4
- package/dist/{channel-vKa-76xY.js → channel-CnnbJSt5.js} +46 -72
- package/dist/{channel-actions-uXFTJX3o.js → channel-actions-5s_hjYKd.js} +4 -4
- package/dist/{channel-actions.runtime-CIYU90sl.js → channel-actions.runtime-CLKrx6tr.js} +53 -36
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-CmcwZ_qd.js → channel.setup-BFAO-V1P.js} +15 -53
- package/dist/{config-schema-WHRQcY19.js → config-schema-BgEskFAs.js} +9 -4
- package/dist/{directory-config-D_LojtCe.js → directory-config-BVX7Cflc.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-Bw5Ephzv.js → directory-live-DGIGxpIo.js} +6 -3
- package/dist/{doctor-Bc4S1qyd.js → doctor-BzC-TLnB.js} +4 -4
- package/dist/{doctor-contract-CCFMIDk9.js → doctor-contract-DLa-BTiU.js} +2 -3
- package/dist/doctor-contract-api.js +147 -2
- package/dist/{handle-action.guild-admin-D6VRRW-C.js → handle-action.guild-admin-BNVTUISF.js} +4 -7
- package/dist/{inbound-event-delivery-CEPlt2uz.js → inbound-event-delivery-De2qxTrP.js} +4 -25
- package/dist/index.js +4 -2
- package/dist/{message-handler-CeiSulIw.js → message-handler-Unk_f10F.js} +41 -32
- package/dist/{message-handler.preflight-DibgQFf2.js → message-handler.preflight-C9zecxR9.js} +50 -26
- package/dist/{message-handler.process-Dnc_oz9y.js → message-handler.process-DWQ6UHHu.js} +130 -166
- package/dist/{message-utils-BgTwT_q7.js → message-utils-BSCPVgy0.js} +4 -4
- package/dist/{model-picker-preference-primitives-D25pnCOu.js → model-picker-preference-primitives-BHT1LkR_.js} +3 -3
- package/dist/{outbound-adapter-DtE-i2OJ.js → outbound-adapter-D9nRivT1.js} +91 -32
- package/dist/{outbound-components-C7GVyfPh.js → outbound-components-cTzwBJ60.js} +3 -3
- package/dist/{outbound-session-route-H-HoyH5U.js → outbound-session-route-DxLkrgKQ.js} +68 -95
- package/dist/{pluralkit-CD4B11JB.js → pluralkit-DdiJ9KMK.js} +1 -1
- package/dist/{preflight-audio-BjnQZ5yS.js → preflight-audio-DrnqFA8U.js} +22 -28
- package/dist/{probe-BeWKhjqX.js → probe-Bl-k5_Ku.js} +36 -12
- package/dist/probe.runtime-M9fREKvp.js +2 -0
- package/dist/{provider-DfQJX3z5.js → provider-DvSNb-2v.js} +969 -1248
- package/dist/{provider-session.runtime-Bo88k0pV.js → provider-session.runtime-BUEqD0rA.js} +3 -3
- package/dist/provider.runtime-C9PnJZbZ.js +2 -0
- package/dist/realtime-session.runtime-C7wen-aF.js +1340 -0
- package/dist/{resolve-allowlist-common-DHERApxi.js → resolve-allowlist-common-D04lpEzb.js} +2 -2
- package/dist/{resolve-channels-BjepAj8b.js → resolve-channels-Dm7jEeg6.js} +4 -4
- package/dist/{resolve-users-Bc28htgt.js → resolve-users-bktrCUUU.js} +3 -3
- package/dist/{chunk-DX4jpFQP.js → retry-CLpJcXXf.js} +291 -68
- package/dist/{runtime-_aRC6V2s.js → runtime-DGsSyDTS.js} +30 -25
- package/dist/{runtime-BmW_j_hl.js → runtime-DoHjckYm.js} +4 -6
- package/dist/runtime-api.actions.js +2 -2
- package/dist/runtime-api.js +22 -23
- package/dist/runtime-api.lookup.js +5 -5
- package/dist/runtime-api.monitor-CHxrFPnW.js +5 -0
- package/dist/runtime-api.monitor.js +5 -5
- package/dist/runtime-api.send.js +6 -6
- package/dist/runtime-api.threads.js +5 -6
- package/dist/sdk-runtime-QpY8PvCh.js +370 -0
- package/dist/{send-CdkZ6zeW.js → send-B7Q6Oc1I.js} +175 -86
- package/dist/{send.components-5uqwkjgE.js → send.components-iJyFXw9L.js} +24 -28
- package/dist/{send.outbound-D-80Ej-t.js → send.outbound-DS5tHwfR.js} +37 -24
- package/dist/{send.reactions-CtlmGd_o.js → send.reactions-BAn0iiVQ.js} +14 -21
- package/dist/{send.receipt-CuwRrpFz.js → send.receipt-IPI1p-SP.js} +19 -1
- package/dist/{send.shared-jpvAG_u6.js → send.shared-BmwFjW6T.js} +16 -85
- package/dist/{sender-identity-mG_zsdox.js → sender-identity-QtalnCYv.js} +1 -1
- package/dist/setup-entry.js +0 -5
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-CXF1tup1.js → shared-BIXIX6uJ.js} +16 -17
- package/dist/{subagent-hooks-Dxy7Fmnq.js → subagent-hooks-CTt5KCJr.js} +2 -2
- package/dist/subagent-hooks-api.js +2 -6
- package/dist/subagent-progress-DhaE_h8a.js +109 -0
- package/dist/{system-events-DdUqf91B.js → system-events-CTqDf6_s.js} +2 -2
- package/dist/{target-resolver-C3s_2m0t.js → target-resolver-maOKSqO0.js} +2 -2
- package/dist/targets-yUFTHoAx.js +3 -0
- package/dist/{thread-bindings-C-M-ly7P.js → thread-bindings-3L8p82GV.js} +5 -7
- package/dist/{thread-bindings.manager-DYvSlrva.js → thread-bindings.manager-DCIH6WDC.js} +257 -29
- package/dist/{thread-bindings.session-updates-DAIlp7Px.js → thread-bindings.session-updates-bJ2KQFY6.js} +1 -1
- package/dist/{thread-bindings.state-Cgi5uRn-.js → thread-bindings.state-aeV8HNgV.js} +2 -15
- package/dist/{transcripts-source-DIKGsTGT.js → transcripts-source-CfFMexGt.js} +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing--Mzo2kM7.js → typing-CS-nNVoe.js} +1 -1
- package/dist/voice-runtime-BEdqNcST.js +2459 -0
- package/openclaw.plugin.json +203 -19
- package/package.json +15 -9
- package/skills/discord/SKILL.md +22 -115
- package/dist/legacy-state-migrations-api.js +0 -138
- package/dist/manager.runtime-Bjav3pfC.js +0 -3655
- package/dist/preflight-audio.runtime-CoCXMM8r.js +0 -7
- package/dist/probe.runtime-DqFGFMbZ.js +0 -2
- package/dist/provider.runtime-Cy7XZmyh.js +0 -2
- package/dist/runtime-api.monitor-CCRubd3-.js +0 -5
- package/dist/session-binding-contract-api.js +0 -2
- package/dist/subagent-progress-DI3sYLLo.js +0 -664
- package/dist/targets-Dv_RN7vT.js +0 -3
- package/dist/thread-bindings.discord-api-BoDNqamb.js +0 -246
|
@@ -17,67 +17,73 @@ function inspectDiscordConfiguredToken(value) {
|
|
|
17
17
|
};
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function inspectDiscordAccount(params) {
|
|
23
|
-
const accountId = normalizeAccountId(params.accountId ?? resolveDefaultDiscordAccountId(params.cfg));
|
|
24
|
-
const merged = mergeDiscordAccountConfig(params.cfg, accountId);
|
|
25
|
-
const enabled = params.cfg.channels?.discord?.enabled !== false && merged.enabled !== false;
|
|
26
|
-
const accountConfig = resolveDiscordAccountConfig(params.cfg, accountId);
|
|
27
|
-
const hasAccountToken = Boolean(accountConfig && Object.hasOwn(accountConfig, "token"));
|
|
28
|
-
const accountToken = inspectDiscordConfiguredToken(accountConfig?.token);
|
|
20
|
+
function inspectDiscordAccountTokenState(params) {
|
|
21
|
+
const accountToken = inspectDiscordConfiguredToken(params.accountToken);
|
|
29
22
|
if (accountToken) return {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
name: normalizeOptionalString(merged.name),
|
|
33
|
-
token: accountToken.token,
|
|
34
|
-
tokenSource: accountToken.tokenSource,
|
|
35
|
-
tokenStatus: accountToken.tokenStatus,
|
|
23
|
+
...params.base,
|
|
24
|
+
...accountToken,
|
|
36
25
|
configured: true,
|
|
37
|
-
config:
|
|
26
|
+
config: params.config
|
|
38
27
|
};
|
|
39
|
-
if (hasAccountToken) return {
|
|
40
|
-
|
|
41
|
-
enabled,
|
|
42
|
-
name: normalizeOptionalString(merged.name),
|
|
28
|
+
if (params.hasAccountToken) return {
|
|
29
|
+
...params.base,
|
|
43
30
|
token: "",
|
|
44
31
|
tokenSource: "none",
|
|
45
32
|
tokenStatus: "missing",
|
|
46
33
|
configured: false,
|
|
47
|
-
config:
|
|
34
|
+
config: params.config
|
|
48
35
|
};
|
|
49
|
-
const channelToken = inspectDiscordConfiguredToken(params.
|
|
36
|
+
const channelToken = inspectDiscordConfiguredToken(params.channelToken);
|
|
50
37
|
if (channelToken) return {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
name: normalizeOptionalString(merged.name),
|
|
54
|
-
token: channelToken.token,
|
|
55
|
-
tokenSource: channelToken.tokenSource,
|
|
56
|
-
tokenStatus: channelToken.tokenStatus,
|
|
38
|
+
...params.base,
|
|
39
|
+
...channelToken,
|
|
57
40
|
configured: true,
|
|
58
|
-
config:
|
|
41
|
+
config: params.config
|
|
59
42
|
};
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
token: envToken.replace(/^Bot\s+/i, ""),
|
|
66
|
-
tokenSource: "env",
|
|
43
|
+
const fallback = params.resolveFallbackToken();
|
|
44
|
+
if (fallback.token) return {
|
|
45
|
+
...params.base,
|
|
46
|
+
token: fallback.token,
|
|
47
|
+
tokenSource: fallback.source,
|
|
67
48
|
tokenStatus: "available",
|
|
68
49
|
configured: true,
|
|
69
|
-
config:
|
|
50
|
+
config: params.config
|
|
70
51
|
};
|
|
71
52
|
return {
|
|
72
|
-
|
|
73
|
-
enabled,
|
|
74
|
-
name: normalizeOptionalString(merged.name),
|
|
53
|
+
...params.base,
|
|
75
54
|
token: "",
|
|
76
55
|
tokenSource: "none",
|
|
77
56
|
tokenStatus: "missing",
|
|
78
57
|
configured: false,
|
|
79
|
-
config:
|
|
58
|
+
config: params.config
|
|
80
59
|
};
|
|
81
60
|
}
|
|
82
61
|
//#endregion
|
|
83
|
-
|
|
62
|
+
//#region extensions/discord/src/account-inspect.ts
|
|
63
|
+
function inspectDiscordAccount(params) {
|
|
64
|
+
const accountId = normalizeAccountId(params.accountId ?? resolveDefaultDiscordAccountId(params.cfg));
|
|
65
|
+
const merged = mergeDiscordAccountConfig(params.cfg, accountId);
|
|
66
|
+
const enabled = params.cfg.channels?.discord?.enabled !== false && merged.enabled !== false;
|
|
67
|
+
const accountConfig = resolveDiscordAccountConfig(params.cfg, accountId);
|
|
68
|
+
const hasAccountToken = Boolean(accountConfig && Object.hasOwn(accountConfig, "token"));
|
|
69
|
+
return inspectDiscordAccountTokenState({
|
|
70
|
+
base: {
|
|
71
|
+
accountId,
|
|
72
|
+
enabled,
|
|
73
|
+
name: normalizeOptionalString(merged.name)
|
|
74
|
+
},
|
|
75
|
+
config: merged,
|
|
76
|
+
accountToken: accountConfig?.token,
|
|
77
|
+
hasAccountToken,
|
|
78
|
+
channelToken: params.cfg.channels?.discord?.token,
|
|
79
|
+
resolveFallbackToken: () => {
|
|
80
|
+
const envToken = accountId === DEFAULT_ACCOUNT_ID ? normalizeSecretInputString(params.envToken ?? process.env.DISCORD_BOT_TOKEN) : void 0;
|
|
81
|
+
return {
|
|
82
|
+
token: envToken?.replace(/^Bot\s+/i, "") ?? "",
|
|
83
|
+
source: envToken ? "env" : "none"
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
export { inspectDiscordAccountTokenState as n, inspectDiscordAccount as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as inspectDiscordAccount } from "./account-inspect-
|
|
1
|
+
import { t as inspectDiscordAccount } from "./account-inspect-CqzrH14k.js";
|
|
2
2
|
//#region extensions/discord/account-inspect-api.ts
|
|
3
3
|
function inspectDiscordReadOnlyAccount(cfg, accountId) {
|
|
4
4
|
return inspectDiscordAccount({
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as handleDiscordAction } from "./runtime-
|
|
1
|
+
import { t as handleDiscordAction } from "./runtime-DGsSyDTS.js";
|
|
2
2
|
export { handleDiscordAction };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
1
2
|
//#region extensions/discord/src/active-turn-thread-route.ts
|
|
2
3
|
const activeRoutes = /* @__PURE__ */ new Map();
|
|
3
|
-
function normalizeId(value) {
|
|
4
|
-
return value?.trim() || void 0;
|
|
5
|
-
}
|
|
6
4
|
function beginDiscordActiveTurnThreadRoute(sessionKey, route) {
|
|
7
|
-
const key =
|
|
5
|
+
const key = normalizeOptionalString(sessionKey);
|
|
8
6
|
if (!key) return () => {};
|
|
9
7
|
const routes = activeRoutes.get(key) ?? /* @__PURE__ */ new Set();
|
|
10
8
|
routes.add(route);
|
|
@@ -15,10 +13,10 @@ function beginDiscordActiveTurnThreadRoute(sessionKey, route) {
|
|
|
15
13
|
};
|
|
16
14
|
}
|
|
17
15
|
async function notifyDiscordActiveTurnThreadCreated(params) {
|
|
18
|
-
const key =
|
|
19
|
-
const threadId =
|
|
20
|
-
const sourceChannelId =
|
|
21
|
-
const sourceMessageId =
|
|
16
|
+
const key = normalizeOptionalString(params.sessionKey ?? void 0);
|
|
17
|
+
const threadId = normalizeOptionalString(params.threadId);
|
|
18
|
+
const sourceChannelId = normalizeOptionalString(params.sourceChannelId);
|
|
19
|
+
const sourceMessageId = normalizeOptionalString(params.sourceMessageId);
|
|
22
20
|
const route = key ? Array.from(activeRoutes.get(key) ?? []).find((candidate) => sourceChannelId === candidate.sourceChannelId && sourceMessageId === candidate.sourceMessageId && (!candidate.accountId || !params.accountId || candidate.accountId === params.accountId)) : void 0;
|
|
23
21
|
if (!route || !threadId) return false;
|
|
24
22
|
route.adoptedThreadId = threadId;
|
|
@@ -31,14 +29,14 @@ async function notifyDiscordActiveTurnThreadCreated(params) {
|
|
|
31
29
|
}
|
|
32
30
|
function notifyDiscordActiveTurnThreadReplyDelivered(params) {
|
|
33
31
|
const route = findDiscordActiveTurnThreadReplyRoute(params);
|
|
34
|
-
const threadId =
|
|
32
|
+
const threadId = normalizeOptionalString(params.threadId ?? void 0);
|
|
35
33
|
if (!route || !threadId) return false;
|
|
36
34
|
route.onThreadReplyDelivered?.(threadId);
|
|
37
35
|
return true;
|
|
38
36
|
}
|
|
39
37
|
function findDiscordActiveTurnThreadReplyRoute(params) {
|
|
40
|
-
const key =
|
|
41
|
-
const threadId =
|
|
38
|
+
const key = normalizeOptionalString(params.sessionKey ?? void 0);
|
|
39
|
+
const threadId = normalizeOptionalString(params.threadId);
|
|
42
40
|
if (!key || !threadId) return;
|
|
43
41
|
return Array.from(activeRoutes.get(key) ?? []).find((route) => Boolean(route.adoptedThreadId) && route.adoptedThreadId === threadId && (!route.accountId || !params.accountId || route.accountId === params.accountId));
|
|
44
42
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { m as resolveDiscordChannelId$1 } from "./retry-CLpJcXXf.js";
|
|
2
2
|
import { n as isDiscordAccountEnabledForRuntime, r as listDiscordAccountIds, s as resolveDiscordAccount } from "./accounts-DJTf1LtA.js";
|
|
3
|
-
import { i as resolveDiscordActivitiesConfig, r as setDiscordActivitiesRuntime, t as DiscordActivitiesRuntime } from "./runtime-
|
|
4
|
-
import { S as parseDiscordActivityCustomId, a as buildDiscordPresentationComponents } from "./outbound-session-route-
|
|
5
|
-
import { r as sendDiscordComponentMessage } from "./send.components-
|
|
3
|
+
import { i as resolveDiscordActivitiesConfig, r as setDiscordActivitiesRuntime, t as DiscordActivitiesRuntime } from "./runtime-DoHjckYm.js";
|
|
4
|
+
import { S as parseDiscordActivityCustomId, a as buildDiscordPresentationComponents } from "./outbound-session-route-DxLkrgKQ.js";
|
|
5
|
+
import { r as sendDiscordComponentMessage } from "./send.components-iJyFXw9L.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";
|
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-DS7vpdtp.js";
|
|
2
2
|
export { registerDiscordActivities };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
+
import { parseDateStringTimestampMs } from "openclaw/plugin-sdk/number-runtime";
|
|
2
3
|
import { buildChannelKeyCandidates, resolveChannelEntryMatchWithFallback, resolveChannelMatchConfig } from "openclaw/plugin-sdk/channel-targets";
|
|
3
4
|
import { resolveAllowlistMatchByCandidates } from "openclaw/plugin-sdk/allow-from";
|
|
4
5
|
//#region extensions/discord/src/monitor/format.ts
|
|
@@ -19,9 +20,7 @@ function formatDiscordUserTag(user) {
|
|
|
19
20
|
return user.username ?? user.id;
|
|
20
21
|
}
|
|
21
22
|
function resolveTimestampMs(timestamp) {
|
|
22
|
-
|
|
23
|
-
const parsed = Date.parse(timestamp);
|
|
24
|
-
return Number.isNaN(parsed) ? void 0 : parsed;
|
|
23
|
+
return parseDateStringTimestampMs(timestamp);
|
|
25
24
|
}
|
|
26
25
|
//#endregion
|
|
27
26
|
//#region extensions/discord/src/monitor/allow-list.ts
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { t as parseDiscordRetryAfterBodySeconds } from "./retry-after-DdLPmPoa.js";
|
|
2
|
+
import { redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
|
|
2
3
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
3
4
|
import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
|
|
4
5
|
import { parseRetryAfterHeaderSeconds, resolveRetryConfig, retryAsync } from "openclaw/plugin-sdk/retry-runtime";
|
|
@@ -11,7 +12,7 @@ const DISCORD_RESPONSE_BODY_SUMMARY_MAX_CHARS = 240;
|
|
|
11
12
|
function summarizeDiscordResponseBody(body, opts = {}) {
|
|
12
13
|
const summary = body.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi, " ").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi, " ").replace(/<[^>]+>/g, " ").replace(/ /gi, " ").replace(/&/gi, "&").replace(/</gi, "<").replace(/>/gi, ">").replace(/\s+/g, " ").trim();
|
|
13
14
|
if (!summary) return opts.emptyText;
|
|
14
|
-
return truncateUtf16Safe(summary, DISCORD_RESPONSE_BODY_SUMMARY_MAX_CHARS);
|
|
15
|
+
return truncateUtf16Safe(redactToolPayloadText(summary), DISCORD_RESPONSE_BODY_SUMMARY_MAX_CHARS);
|
|
15
16
|
}
|
|
16
17
|
function isDiscordHtmlResponseBody(body, contentType) {
|
|
17
18
|
return /\bhtml\b/i.test(contentType ?? "") || /^\s*<!doctype\s+html\b/i.test(body) || /^\s*<html\b/i.test(body);
|
|
@@ -55,7 +56,7 @@ function formatRetryAfterSeconds(value) {
|
|
|
55
56
|
if (value === void 0 || !Number.isFinite(value) || value < 0) return;
|
|
56
57
|
return `${value < 10 ? value.toFixed(1) : Math.round(value).toString()}s`;
|
|
57
58
|
}
|
|
58
|
-
function
|
|
59
|
+
function formatDiscordApiErrorTextUntrusted(text, response) {
|
|
59
60
|
const trimmed = text.trim();
|
|
60
61
|
if (!trimmed) return;
|
|
61
62
|
const payload = parseDiscordApiErrorPayload(trimmed);
|
|
@@ -72,6 +73,10 @@ function formatDiscordApiErrorText(text, response) {
|
|
|
72
73
|
const retryAfter = formatRetryAfterSeconds(parseDiscordRetryAfterBodySeconds(payload.retry_after));
|
|
73
74
|
return retryAfter ? `${message} (retry after ${retryAfter})` : message;
|
|
74
75
|
}
|
|
76
|
+
function formatDiscordApiErrorText(text, response) {
|
|
77
|
+
const detail = formatDiscordApiErrorTextUntrusted(text, response);
|
|
78
|
+
return detail ? redactToolPayloadText(detail) : detail;
|
|
79
|
+
}
|
|
75
80
|
var DiscordApiError = class extends Error {
|
|
76
81
|
constructor(message, status, retryAfter) {
|
|
77
82
|
super(message);
|
package/dist/api.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as normalizeDiscordMessagingTarget, f as normalizeDiscordOutboundTarget, m as resolveDiscordChannelId, p as parseDiscordTarget, u as looksLikeDiscordTargetId } from "./retry-CLpJcXXf.js";
|
|
2
2
|
import { a as mergeDiscordAccountConfig, f as resolveDiscordMaxLinesPerMessage, i as listEnabledDiscordAccounts, l as resolveDiscordAccountConfig, o as resolveDefaultDiscordAccountId, r as listDiscordAccountIds, s as resolveDiscordAccount, t as createDiscordActionGate } from "./accounts-DJTf1LtA.js";
|
|
3
|
-
import { D as parseDiscordModalCustomIdForInteraction, E as parseDiscordModalCustomId, T as parseDiscordComponentCustomIdForInteraction, _ as DISCORD_COMPONENT_CUSTOM_ID_KEY, b as buildDiscordComponentCustomId, d as createDiscordFormModal, f as buildDiscordComponentMessage, g as resolveDiscordComponentAttachmentName, h as readDiscordComponentSpec, i as buildDiscordInteractiveComponents, m as DISCORD_COMPONENT_ATTACHMENT_PREFIX, p as buildDiscordComponentMessageFlags, r as formatDiscordComponentEventText, u as DiscordFormModal, v as DISCORD_MODAL_CUSTOM_ID_KEY, w as parseDiscordComponentCustomId, x as buildDiscordModalCustomId } from "./outbound-session-route-
|
|
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-
|
|
3
|
+
import { D as parseDiscordModalCustomIdForInteraction, E as parseDiscordModalCustomId, T as parseDiscordComponentCustomIdForInteraction, _ as DISCORD_COMPONENT_CUSTOM_ID_KEY, b as buildDiscordComponentCustomId, d as createDiscordFormModal, f as buildDiscordComponentMessage, g as resolveDiscordComponentAttachmentName, h as readDiscordComponentSpec, i as buildDiscordInteractiveComponents, m as DISCORD_COMPONENT_ATTACHMENT_PREFIX, p as buildDiscordComponentMessageFlags, r as formatDiscordComponentEventText, u as DiscordFormModal, v as DISCORD_MODAL_CUSTOM_ID_KEY, w as parseDiscordComponentCustomId, x as buildDiscordModalCustomId } from "./outbound-session-route-DxLkrgKQ.js";
|
|
4
|
+
import { i as requestDiscord, n as DiscordApiError, r as fetchDiscord } from "./api-DNVbJyEy.js";
|
|
5
|
+
import { i as parseDiscordSendTarget, n as resolveDiscordTarget } from "./target-resolver-maOKSqO0.js";
|
|
6
|
+
import { t as inspectDiscordAccount } from "./account-inspect-CqzrH14k.js";
|
|
7
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-B9cy6RvQ.js";
|
|
8
|
-
import "./targets-
|
|
9
|
-
import { a as getDiscordExecApprovalApprovers, c as shouldSuppressLocalDiscordExecApprovalPrompt, o as isDiscordExecApprovalApprover, s as isDiscordExecApprovalClientEnabled } from "./approval-message-safety-
|
|
10
|
-
import { i as resolveDiscordGroupToolPolicy, n as collectDiscordStatusIssues, r as resolveDiscordGroupRequireMention, t as discordPlugin } from "./channel-
|
|
8
|
+
import "./targets-yUFTHoAx.js";
|
|
9
|
+
import { a as getDiscordExecApprovalApprovers, c as shouldSuppressLocalDiscordExecApprovalPrompt, o as isDiscordExecApprovalApprover, s as isDiscordExecApprovalClientEnabled } from "./approval-message-safety-AcIxvrf3.js";
|
|
10
|
+
import { i as resolveDiscordGroupToolPolicy, n as collectDiscordStatusIssues, r as resolveDiscordGroupRequireMention, t as discordPlugin } from "./channel-CnnbJSt5.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, r as handleDiscordSubagentSpawning, 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 {
|
|
12
|
+
import { t as discordSetupPlugin } from "./channel.setup-BFAO-V1P.js";
|
|
13
|
+
import { n as handleDiscordSubagentEnded, r as handleDiscordSubagentSpawning, t as handleDiscordSubagentDeliveryTarget } from "./subagent-hooks-CTt5KCJr.js";
|
|
14
|
+
import { t as tryHandleDiscordMessageActionGuildAdmin } from "./handle-action.guild-admin-BNVTUISF.js";
|
|
15
|
+
import { n as listDiscordDirectoryGroupsFromConfig, r as listDiscordDirectoryPeersFromConfig } from "./directory-config-BVX7Cflc.js";
|
|
16
|
+
import { t as fetchPluralKitMessageInfo } from "./pluralkit-DdiJ9KMK.js";
|
|
17
|
+
import { i as probeDiscord, n as fetchDiscordApplicationSummary, o as resolveDiscordPrivilegedIntentsFromFlags, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-Bl-k5_Ku.js";
|
|
18
18
|
import { t as collectDiscordSecurityAuditFindings } from "./security-audit-jGnJF__m.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-CLKrx6tr.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 {
|
|
2
|
-
import { c as buildExecApprovalCustomId } from "./outbound-session-route-
|
|
3
|
-
import { P as createDiscordClient,
|
|
4
|
-
import { n as formatDiscordApprovalDisplayValue, s as isDiscordExecApprovalClientEnabled, t as DISCORD_APPROVAL_ALLOWED_MENTIONS } from "./approval-message-safety-
|
|
5
|
-
import { a as shouldHandleDiscordApprovalRequest } from "./channel-
|
|
1
|
+
import { H as serializePayload, St as deleteChannelMessage, Y as Button, Z as Container, at as Separator, ft as stripUndefinedFields, mt as createUserDmChannel, rt as Row, st as TextDisplay, wt as editChannelMessage, yt as createChannelMessage } from "./retry-CLpJcXXf.js";
|
|
2
|
+
import { c as buildExecApprovalCustomId } from "./outbound-session-route-DxLkrgKQ.js";
|
|
3
|
+
import { P as createDiscordClient, g as createDiscordMessageNonce } from "./send.shared-BmwFjW6T.js";
|
|
4
|
+
import { n as formatDiscordApprovalDisplayValue, s as isDiscordExecApprovalClientEnabled, t as DISCORD_APPROVAL_ALLOWED_MENTIONS } from "./approval-message-safety-AcIxvrf3.js";
|
|
5
|
+
import { a as shouldHandleDiscordApprovalRequest } from "./channel-CnnbJSt5.js";
|
|
6
6
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { logDebug, logError } from "openclaw/plugin-sdk/logging-core";
|
|
8
8
|
import { ButtonStyle } from "discord-api-types/v10";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { p as parseDiscordTarget } from "./retry-CLpJcXXf.js";
|
|
2
2
|
import { s as resolveDiscordAccount } from "./accounts-DJTf1LtA.js";
|
|
3
3
|
import { normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { createChannelApproverDmTargetResolver, createChannelNativeOriginTargetResolver } from "openclaw/plugin-sdk/approval-native-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { O as fetchChannelPermissionsDiscord } from "./send.shared-
|
|
3
|
-
import { t as inspectDiscordAccount } from "./account-inspect-
|
|
4
|
-
import "./send-
|
|
1
|
+
import { tn as __exportAll } from "./retry-CLpJcXXf.js";
|
|
2
|
+
import { O as fetchChannelPermissionsDiscord } from "./send.shared-BmwFjW6T.js";
|
|
3
|
+
import { t as inspectDiscordAccount } from "./account-inspect-CqzrH14k.js";
|
|
4
|
+
import "./send-B7Q6Oc1I.js";
|
|
5
5
|
import { n as collectDiscordAuditChannelIdsForAccount, t as auditDiscordChannelPermissionsWithFetcher } from "./audit-core-xwjIczO0.js";
|
|
6
6
|
//#region extensions/discord/src/audit.ts
|
|
7
7
|
var audit_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as normalizeDiscordMessagingTarget, p as parseDiscordTarget, u as looksLikeDiscordTargetId } from "./retry-CLpJcXXf.js";
|
|
2
2
|
import { c as resolveDiscordAccountAllowFrom, i as listEnabledDiscordAccounts, o as resolveDefaultDiscordAccountId, r as listDiscordAccountIds, s as resolveDiscordAccount } from "./accounts-DJTf1LtA.js";
|
|
3
|
-
import { t as resolveDiscordOutboundSessionRoute } from "./outbound-session-route-
|
|
3
|
+
import { t as resolveDiscordOutboundSessionRoute } from "./outbound-session-route-DxLkrgKQ.js";
|
|
4
4
|
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
5
5
|
import { a as projectCredentialSnapshotFields, n as PAIRING_APPROVED_MESSAGE, o as resolveConfiguredFromCredentialStatuses, r as buildTokenChannelStatusSummary, t as DEFAULT_ACCOUNT_ID } from "./channel-api-CAJ0wMoV.js";
|
|
6
6
|
import { u as withAbortTimeout } from "./timeouts-B9cy6RvQ.js";
|
|
7
|
-
import { a as getDiscordExecApprovalApprovers, c as shouldSuppressLocalDiscordExecApprovalPrompt, d as createChannelNativeOriginTargetResolver, f as isChannelExecApprovalClientEnabledFromConfig, i as resolveDiscordCurrentConversationIdentity, l as createApproverRestrictedNativeApprovalCapability, o as isDiscordExecApprovalApprover, p as matchesApprovalRequestFilters, s as isDiscordExecApprovalClientEnabled, u as createChannelApproverDmTargetResolver } from "./approval-message-safety-
|
|
7
|
+
import { a as getDiscordExecApprovalApprovers, c as shouldSuppressLocalDiscordExecApprovalPrompt, d as createChannelNativeOriginTargetResolver, f as isChannelExecApprovalClientEnabledFromConfig, i as resolveDiscordCurrentConversationIdentity, l as createApproverRestrictedNativeApprovalCapability, o as isDiscordExecApprovalApprover, p as matchesApprovalRequestFilters, s as isDiscordExecApprovalClientEnabled, u as createChannelApproverDmTargetResolver } from "./approval-message-safety-AcIxvrf3.js";
|
|
8
8
|
import { r as resolveRequiredDiscordChannelPermissions } from "./audit-core-xwjIczO0.js";
|
|
9
|
-
import { t as discordMessageActions$1 } from "./channel-actions-
|
|
9
|
+
import { t as discordMessageActions$1 } from "./channel-actions-5s_hjYKd.js";
|
|
10
10
|
import { r as openDiscordCommandDeployHashStore } from "./command-deploy-store-DFkBTViB.js";
|
|
11
|
-
import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-
|
|
12
|
-
import { n as discordOutbound } from "./outbound-adapter-
|
|
13
|
-
import { a as
|
|
11
|
+
import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-bJ2KQFY6.js";
|
|
12
|
+
import { n as discordOutbound } from "./outbound-adapter-D9nRivT1.js";
|
|
13
|
+
import { a as discordSecurityAdapter, i as discordSetupContract, n as discordConfigAdapter, t as createDiscordPluginBase } from "./shared-BIXIX6uJ.js";
|
|
14
14
|
import { t as normalizeExplicitDiscordSessionKey } from "./session-key-normalization-wJgsKPNF.js";
|
|
15
15
|
import { t as defaultTopLevelPlacement } from "./thread-binding-api-BDZJD4na.js";
|
|
16
16
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -22,39 +22,38 @@ import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
|
22
22
|
import { buildLegacyDmAccountAllowlistAdapter, createAccountScopedAllowlistNameResolver, createNestedAllowlistOverrideResolver } from "openclaw/plugin-sdk/allowlist-config-edit";
|
|
23
23
|
import { createPairingPrefixStripper } from "openclaw/plugin-sdk/channel-pairing";
|
|
24
24
|
import { createChannelDirectoryAdapter, createRuntimeDirectoryLiveAdapter } from "openclaw/plugin-sdk/directory-runtime";
|
|
25
|
-
import { appendMatchMetadata,
|
|
25
|
+
import { appendMatchMetadata, createComputedAccountStatusAdapter, createDefaultChannelRuntimeState, isRecord as isRecord$1, readAccountStatusSnapshot, resolveEnabledConfiguredAccountId } from "openclaw/plugin-sdk/status-helpers";
|
|
26
26
|
import { resolveTargetsWithOptionalToken } from "openclaw/plugin-sdk/target-resolver-runtime";
|
|
27
27
|
import { createLazyChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
|
|
28
|
-
import {
|
|
28
|
+
import { doesApprovalRequestSelectChannelAccount, resolveApprovalRequestSessionConversation } from "openclaw/plugin-sdk/approval-native-runtime";
|
|
29
29
|
import { resolveScopeRequireMention, resolveScopeToolsPolicy, scopeKey } from "openclaw/plugin-sdk/channel-policy";
|
|
30
30
|
import { normalizeAtHashSlug } from "openclaw/plugin-sdk/string-normalization-runtime";
|
|
31
31
|
//#region extensions/discord/src/approval-shared.ts
|
|
32
|
-
function
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}).config.execApprovals;
|
|
37
|
-
const approvers = getDiscordExecApprovalApprovers({
|
|
38
|
-
cfg: params.cfg,
|
|
39
|
-
accountId: params.accountId,
|
|
40
|
-
configOverride: params.configOverride
|
|
41
|
-
});
|
|
42
|
-
if (!doesApprovalRequestMatchChannelAccount({
|
|
43
|
-
cfg: params.cfg,
|
|
44
|
-
request: params.request,
|
|
45
|
-
channel: "discord",
|
|
46
|
-
accountId: params.accountId
|
|
47
|
-
})) return false;
|
|
48
|
-
if (!isChannelExecApprovalClientEnabledFromConfig({
|
|
32
|
+
function isDiscordApprovalAccountEligible(params) {
|
|
33
|
+
const account = resolveDiscordAccount(params);
|
|
34
|
+
const config = params.configOverride ?? account.config.execApprovals;
|
|
35
|
+
return account.enabled && isChannelExecApprovalClientEnabledFromConfig({
|
|
49
36
|
enabled: config?.enabled,
|
|
50
|
-
approverCount:
|
|
51
|
-
})
|
|
52
|
-
return matchesApprovalRequestFilters({
|
|
37
|
+
approverCount: getDiscordExecApprovalApprovers(params).length
|
|
38
|
+
}) && matchesApprovalRequestFilters({
|
|
53
39
|
request: params.request.request,
|
|
54
40
|
agentFilter: config?.agentFilter,
|
|
55
41
|
sessionFilter: config?.sessionFilter
|
|
56
42
|
});
|
|
57
43
|
}
|
|
44
|
+
function shouldHandleDiscordApprovalRequest(params) {
|
|
45
|
+
const accountId = params.accountId ?? resolveDefaultDiscordAccountId(params.cfg);
|
|
46
|
+
if (!doesApprovalRequestSelectChannelAccount({
|
|
47
|
+
...params,
|
|
48
|
+
channel: "discord",
|
|
49
|
+
defaultAccountId: resolveDefaultDiscordAccountId(params.cfg),
|
|
50
|
+
eligibleAccountIds: isDiscordApprovalAccountEligible({
|
|
51
|
+
...params,
|
|
52
|
+
accountId
|
|
53
|
+
}) ? [accountId] : []
|
|
54
|
+
})) return false;
|
|
55
|
+
return isDiscordApprovalAccountEligible(params);
|
|
56
|
+
}
|
|
58
57
|
//#endregion
|
|
59
58
|
//#region extensions/discord/src/approval-native.ts
|
|
60
59
|
function extractDiscordSessionKind(sessionKey) {
|
|
@@ -195,7 +194,7 @@ function createDiscordApprovalCapability(configOverride) {
|
|
|
195
194
|
request,
|
|
196
195
|
configOverride
|
|
197
196
|
}),
|
|
198
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
197
|
+
load: async () => (await import("./approval-handler.runtime-B6yEV79q.js")).discordApprovalNativeRuntime
|
|
199
198
|
})
|
|
200
199
|
});
|
|
201
200
|
}
|
|
@@ -302,22 +301,22 @@ function resolveDiscordInboundConversation(params) {
|
|
|
302
301
|
}
|
|
303
302
|
//#endregion
|
|
304
303
|
//#region extensions/discord/src/channel.loaders.ts
|
|
305
|
-
const loadDiscordDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-
|
|
306
|
-
const loadDiscordResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels-
|
|
307
|
-
const loadDiscordResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-
|
|
308
|
-
const loadDiscordThreadBindingsManagerModule = createLazyRuntimeModule(() => import("./thread-bindings.manager-
|
|
309
|
-
const loadDiscordTargetResolverModule = createLazyRuntimeModule(() => import("./target-resolver-
|
|
310
|
-
const loadDiscordProviderRuntime = createLazyRuntimeModule(() => import("./provider.runtime-
|
|
311
|
-
const loadDiscordProbeRuntime = createLazyRuntimeModule(() => import("./probe.runtime-
|
|
304
|
+
const loadDiscordDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-BVX7Cflc.js").then((n) => n.t));
|
|
305
|
+
const loadDiscordResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels-Dm7jEeg6.js").then((n) => n.n));
|
|
306
|
+
const loadDiscordResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-bktrCUUU.js").then((n) => n.n));
|
|
307
|
+
const loadDiscordThreadBindingsManagerModule = createLazyRuntimeModule(() => import("./thread-bindings.manager-DCIH6WDC.js").then((n) => n.i));
|
|
308
|
+
const loadDiscordTargetResolverModule = createLazyRuntimeModule(() => import("./target-resolver-maOKSqO0.js").then((n) => n.r));
|
|
309
|
+
const loadDiscordProviderRuntime = createLazyRuntimeModule(() => import("./provider.runtime-C9PnJZbZ.js"));
|
|
310
|
+
const loadDiscordProbeRuntime = createLazyRuntimeModule(() => import("./probe.runtime-M9fREKvp.js"));
|
|
312
311
|
async function probeDiscordStatusAccount(params) {
|
|
313
312
|
const startedAtMs = Date.now();
|
|
314
313
|
const runtime = await loadDiscordProbeRuntime();
|
|
315
314
|
const remainingMs = Math.max(1, params.timeoutMs - Math.max(0, Date.now() - startedAtMs));
|
|
316
315
|
return await runtime.probeDiscord(params.token, remainingMs, { includeApplication: true });
|
|
317
316
|
}
|
|
318
|
-
const loadDiscordAuditModule = createLazyRuntimeModule(() => import("./audit-
|
|
319
|
-
const loadDiscordSendModule = createLazyRuntimeModule(() => import("./send-
|
|
320
|
-
const loadDiscordDirectoryLiveModule = createLazyRuntimeModule(() => import("./directory-live-
|
|
317
|
+
const loadDiscordAuditModule = createLazyRuntimeModule(() => import("./audit-Db-rlntl.js").then((n) => n.n));
|
|
318
|
+
const loadDiscordSendModule = createLazyRuntimeModule(() => import("./send-B7Q6Oc1I.js").then((n) => n.t));
|
|
319
|
+
const loadDiscordDirectoryLiveModule = createLazyRuntimeModule(() => import("./directory-live-DGIGxpIo.js").then((n) => n.t));
|
|
321
320
|
//#endregion
|
|
322
321
|
//#region extensions/discord/src/group-policy.ts
|
|
323
322
|
function normalizeDiscordSlug(value) {
|
|
@@ -406,13 +405,13 @@ function readDiscordPermissionsAuditSummary(value) {
|
|
|
406
405
|
unresolvedChannels,
|
|
407
406
|
channels: Array.isArray(channelsRaw) ? channelsRaw.map((entry) => {
|
|
408
407
|
if (!isRecord$1(entry)) return null;
|
|
409
|
-
const channelId =
|
|
408
|
+
const channelId = normalizeOptionalString(entry.channelId);
|
|
410
409
|
if (!channelId) return null;
|
|
411
410
|
const ok = typeof entry.ok === "boolean" ? entry.ok : void 0;
|
|
412
|
-
const missing = Array.isArray(entry.missing) ? entry.missing.map((v) =>
|
|
413
|
-
const error =
|
|
414
|
-
const matchKey =
|
|
415
|
-
const matchSource =
|
|
411
|
+
const missing = Array.isArray(entry.missing) ? entry.missing.map((v) => normalizeOptionalString(v)).filter(Boolean) : void 0;
|
|
412
|
+
const error = normalizeOptionalString(entry.error) ?? null;
|
|
413
|
+
const matchKey = normalizeOptionalString(entry.matchKey);
|
|
414
|
+
const matchSource = normalizeOptionalString(entry.matchSource);
|
|
416
415
|
return {
|
|
417
416
|
channelId,
|
|
418
417
|
ok,
|
|
@@ -427,32 +426,10 @@ function readDiscordPermissionsAuditSummary(value) {
|
|
|
427
426
|
function collectDiscordStatusIssues(accounts) {
|
|
428
427
|
const issues = [];
|
|
429
428
|
for (const entry of accounts) {
|
|
430
|
-
const account = readAccountStatusSnapshot(entry, [
|
|
431
|
-
"healthState",
|
|
432
|
-
"application",
|
|
433
|
-
"audit"
|
|
434
|
-
]);
|
|
429
|
+
const account = readAccountStatusSnapshot(entry, ["application", "audit"]);
|
|
435
430
|
if (!account) continue;
|
|
436
431
|
const accountId = resolveEnabledConfiguredAccountId(account);
|
|
437
432
|
if (!accountId) continue;
|
|
438
|
-
const running = account.running === true;
|
|
439
|
-
const healthState = asString(account.healthState);
|
|
440
|
-
if (healthState === "stale-socket" || healthState === "stuck" || healthState === "disconnected" || healthState === "not-running") {
|
|
441
|
-
const runningLabel = running ? "running" : "not running";
|
|
442
|
-
issues.push({
|
|
443
|
-
channel: "discord",
|
|
444
|
-
accountId,
|
|
445
|
-
kind: "runtime",
|
|
446
|
-
message: `Discord gateway transport is degraded (${healthState}; account is ${runningLabel}).`,
|
|
447
|
-
fix: "Check gateway event-loop health and Discord connectivity, then restart the Discord channel or gateway if the transport does not recover."
|
|
448
|
-
});
|
|
449
|
-
} else if (running && account.connected === false) issues.push({
|
|
450
|
-
channel: "discord",
|
|
451
|
-
accountId,
|
|
452
|
-
kind: "runtime",
|
|
453
|
-
message: "Discord gateway transport is running but disconnected.",
|
|
454
|
-
fix: "Check gateway logs for Discord websocket errors and wait for reconnect; restart the Discord channel or gateway if it does not recover."
|
|
455
|
-
});
|
|
456
433
|
if (readDiscordApplicationSummary(account.application).intents?.messageContent === "disabled") issues.push({
|
|
457
434
|
channel: "discord",
|
|
458
435
|
accountId,
|
|
@@ -600,10 +577,7 @@ function toConversationLifecycleBinding(binding) {
|
|
|
600
577
|
}
|
|
601
578
|
const discordPlugin = createChatChannelPlugin({
|
|
602
579
|
base: {
|
|
603
|
-
...createDiscordPluginBase({
|
|
604
|
-
setup: discordSetupAdapter,
|
|
605
|
-
setupContract: discordSetupContract
|
|
606
|
-
}),
|
|
580
|
+
...createDiscordPluginBase({ setupContract: discordSetupContract }),
|
|
607
581
|
allowlist: {
|
|
608
582
|
...buildLegacyDmAccountAllowlistAdapter({
|
|
609
583
|
channelId: "discord",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as listDiscordAccountIds, t as createDiscordActionGate } from "./accounts-DJTf1LtA.js";
|
|
2
|
-
import { h as readDiscordComponentSpec } from "./outbound-session-route-
|
|
3
|
-
import { t as inspectDiscordAccount } from "./account-inspect-
|
|
4
|
-
import {
|
|
2
|
+
import { h as readDiscordComponentSpec } from "./outbound-session-route-DxLkrgKQ.js";
|
|
3
|
+
import { t as inspectDiscordAccount } from "./account-inspect-CqzrH14k.js";
|
|
4
|
+
import { r as withDiscordInboundEventDeliveryMetadata } from "./inbound-event-delivery-De2qxTrP.js";
|
|
5
5
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { createUnionActionGate } from "openclaw/plugin-sdk/channel-actions";
|
|
7
7
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
@@ -41,7 +41,7 @@ const localExecutionActions = /* @__PURE__ */ new Set([
|
|
|
41
41
|
function resolveDiscordActionExecutionMode({ action }) {
|
|
42
42
|
return localExecutionActions.has(action) ? "local" : "gateway";
|
|
43
43
|
}
|
|
44
|
-
const loadDiscordChannelActionsRuntime = createLazyRuntimeModule(() => import("./channel-actions.runtime-
|
|
44
|
+
const loadDiscordChannelActionsRuntime = createLazyRuntimeModule(() => import("./channel-actions.runtime-CLKrx6tr.js"));
|
|
45
45
|
function listDiscoverableDiscordAccounts(cfg) {
|
|
46
46
|
return listDiscordAccountIds(cfg).map((accountId) => inspectDiscordAccount({
|
|
47
47
|
cfg,
|