@openclaw/discord 2026.5.12 → 2026.5.14-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-inspect-D7jL5YDH.js → account-inspect-B_N30NV0.js} +1 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-BcwyaFd-.js → accounts-DnNVBDfc.js} +95 -4
- package/dist/action-runtime-api.js +1 -1
- package/dist/{allow-list-n8Ki-Rt3.js → allow-list-CBI-M84K.js} +24 -2
- package/dist/api.js +19 -21
- package/dist/{approval-handler.runtime-S-ircYcz.js → approval-handler.runtime-Uco62pII.js} +4 -4
- package/dist/{audit-BliEqCEc.js → audit-eSlKbMHw.js} +5 -5
- package/dist/{channel-Bliqi-Qi.js → channel-BjBa8nYY.js} +23 -25
- package/dist/{channel-actions-Cn_K00Vy.js → channel-actions-DANVAtKL.js} +4 -4
- package/dist/{channel-actions.runtime-DcsRvPnx.js → channel-actions.runtime-CpIslHS9.js} +7 -5
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-DR-xVYso.js → channel.setup-DBFcGRFD.js} +4 -5
- package/dist/{components-Dxq2mU57.js → components-Cgm7XT8-.js} +120 -3
- package/dist/{config-schema-D2KGskAp.js → config-schema-D7AtCpJa.js} +21 -1
- package/dist/contract-api.js +7 -7
- package/dist/{approval-native-Gtqpyfdj.js → conversation-identity-C3AI-1tz.js} +123 -6
- package/dist/{directory-config-CDl4JTCA.js → directory-config-CW_JusGS.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/directory-live-MrDSKsMf.js +159 -0
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{doctor-contract-BGjjFBdq.js → doctor-contract-ftWAMvBl.js} +1 -1
- package/dist/{doctor-jcX_qXsS.js → doctor-mn2XyjuF.js} +5 -5
- package/dist/{handle-action.guild-admin-C4phin-a.js → handle-action.guild-admin-DriifPwO.js} +1 -1
- package/dist/{inbound-context-jtKcY9on.js → inbound-context-DD7n3Q6U.js} +1 -1
- package/dist/{manager.runtime-DqMGETqp.js → manager.runtime-DauS2xA3.js} +107 -25
- package/dist/{message-handler-DIsnboy2.js → message-handler-CMHwRlxG.js} +7 -7
- package/dist/{message-handler.preflight-BRH-dv1o.js → message-handler.preflight-C0sT-ewp.js} +27 -17
- package/dist/{message-handler.process-Bs5wropA.js → message-handler.process-Cy7_-0H0.js} +46 -37
- package/dist/{message-utils-ByofKwPe.js → message-utils-N5UTOXQ2.js} +16 -12
- package/dist/{outbound-adapter-lWjkSeyP.js → outbound-adapter-Cw9JsRTY.js} +7 -10
- package/dist/{pluralkit-B1HTaBc9.js → pluralkit-B2AqgTHV.js} +1 -1
- package/dist/{preflight-audio-CD97vnac.js → preflight-audio-DFGpAvzi.js} +1 -1
- package/dist/{probe-BZtr8qle.js → probe-CiBYm-vD.js} +2 -2
- package/dist/{probe.runtime-0F0UzBoJ.js → probe.runtime-9hi1GYNU.js} +1 -1
- package/dist/{provider-DABvNRT0.js → provider-nzJg2k5t.js} +1039 -45
- package/dist/{provider-session.runtime-BZyP90-i.js → provider-session.runtime-DMxaLPB3.js} +3 -3
- package/dist/provider.runtime-S-wZdzK5.js +2 -0
- package/dist/{resolve-allowlist-common-CVHYb5Hb.js → resolve-allowlist-common-DybgkAjk.js} +3 -3
- package/dist/{resolve-channels-JNt3Ak6P.js → resolve-channels-u7_agBcm.js} +4 -4
- package/dist/{resolve-users-CrjbUxrL.js → resolve-users-Bc25I6OP.js} +3 -3
- package/dist/{runtime-CdnAT8R5.js → runtime-DL82ijB1.js} +102 -46
- package/dist/runtime-api.actions.js +2 -2
- package/dist/runtime-api.js +25 -26
- package/dist/runtime-api.lookup.js +6 -6
- package/dist/runtime-api.monitor-DbLcHuhE.js +5 -0
- package/dist/runtime-api.monitor.js +7 -8
- package/dist/runtime-api.send.js +5 -5
- package/dist/runtime-api.threads.js +5 -5
- package/dist/runtime-setter-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/{security-audit-BQ_sGK3J.js → security-audit-CLPZKYi4.js} +1 -1
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/{security-audit.runtime-B7Gmz2DX.js → security-audit.runtime-CCm9leFJ.js} +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/{send-DCFuSiBi.js → send-BqzTEkt9.js} +4 -6
- package/dist/{send.components-DxDqPJZQ.js → send.components-D6pXHVrU.js} +8 -10
- package/dist/{send.outbound-PM0J0F60.js → send.outbound-D8o8BW6q.js} +91 -7
- package/dist/{discord-BqYcwxvG.js → send.receipt-nKLxvA1s.js} +319 -1
- package/dist/{send.shared-Dza0jdso.js → send.shared-DSpva7uA.js} +4 -6
- package/dist/{sender-identity-w9rSI-nD.js → sender-identity-BTGL3VbF.js} +1 -1
- package/dist/session-key-api.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-Yp_M6Cfp.js → shared-0kdaIxXP.js} +16 -14
- package/dist/{subagent-hooks-CtN-hfXy.js → subagent-hooks-DhuBhwRw.js} +3 -3
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{system-events-B04UOvPg.js → system-events-Bnit0zkQ.js} +2 -2
- package/dist/{target-resolver-CgJei-kD.js → target-resolver-BsGT9hI7.js} +3 -6
- package/dist/targets-DwW6OieO.js +3 -0
- package/dist/test-api.js +4 -4
- package/dist/{thread-bindings-B4of4OmR.js → thread-bindings-C1f7Iim4.js} +6 -7
- package/dist/{thread-bindings.discord-api-BAw15EQb.js → thread-bindings.discord-api-DJACBZJ1.js} +67 -8
- package/dist/{thread-bindings.manager-DNFl10CA.js → thread-bindings.manager-DN_q0IW7.js} +4 -5
- package/dist/{thread-bindings.session-updates-D18cCLmN.js → thread-bindings.session-updates-ZnRRzzgf.js} +1 -1
- package/dist/timeouts.js +1 -1
- package/dist/{typing-_jePdFIw.js → typing-C_8U8J7E.js} +2 -2
- package/openclaw.plugin.json +68 -0
- package/package.json +6 -6
- package/dist/access-Dxmzr0ix.js +0 -89
- package/dist/approval-shared-BFnWKSQD.js +0 -93
- package/dist/channel-access-BL-wemES.js +0 -62
- package/dist/chunk-DYl-_5RL.js +0 -179
- package/dist/conversation-identity-CvIx6J7M.js +0 -31
- package/dist/directory-cache-Ddl-Oxue.js +0 -62
- package/dist/directory-live-ApUXOSj0.js +0 -101
- package/dist/doctor-shared-D_QLzu30.js +0 -4
- package/dist/format-D8TsaXxW.js +0 -24
- package/dist/mentions-BZoGn0ul.js +0 -88
- package/dist/normalize-Cu94FOqy.js +0 -58
- package/dist/outbound-session-route-BaJRt05p.js +0 -43
- package/dist/provider.runtime-Cmv1SFtb.js +0 -2
- package/dist/reply-delivery-CUSK6SA_.js +0 -191
- package/dist/route-resolution-BFfF9xmG.js +0 -268
- package/dist/runtime-api.monitor-W_dJ5EQu.js +0 -6
- package/dist/send.receipt-BAZw2Zsz.js +0 -35
- package/dist/shared-interactive-DavY6jYt.js +0 -79
- package/dist/target-parsing-D-H7nnh2.js +0 -51
- package/dist/targets-DToZUkgV.js +0 -3
- package/dist/threading-CLZ3v7-y.js +0 -475
- package/dist/token-BZtonk7d.js +0 -93
- /package/dist/{agent-components.runtime-zT8qPsnM.js → agent-components.runtime-CEMbMQcQ.js} +0 -0
- /package/dist/{api-DzNBVTto.js → api-DgQLz1wq.js} +0 -0
- /package/dist/{audit-core-BgDZSkIR.js → audit-core-DRyoXREU.js} +0 -0
- /package/dist/{channel-api-CTSWMrnD.js → channel-api-JudoSiJv.js} +0 -0
- /package/dist/{config-api-CFZtoMaS.js → config-api-oLS_52S7.js} +0 -0
- /package/dist/{gateway-registry-BKG4KIVC.js → gateway-registry-BKSpa4GB.js} +0 -0
- /package/dist/{preflight-audio.runtime-fXnUxxBa.js → preflight-audio.runtime-Drc-OFcp.js} +0 -0
- /package/dist/{preview-streaming-DCPAe24T.js → preview-streaming-CXTZydhx.js} +0 -0
- /package/dist/{runtime-BqCoo-zp.js → runtime-Tqtvj5GX.js} +0 -0
- /package/dist/{secret-config-contract-BCQNNS7N.js → secret-config-contract-B3347_eU.js} +0 -0
- /package/dist/{security-contract-DkCMKSvb.js → security-contract-DyCRvz_Q.js} +0 -0
- /package/dist/{security-doctor-BJH5YIGL.js → security-doctor-Cp-NqNdS.js} +0 -0
- /package/dist/{session-contract-D871HDFG.js → session-contract-ugfEa9Xc.js} +0 -0
- /package/dist/{session-key-normalization-BV82IME9.js → session-key-normalization-B7h83qD2.js} +0 -0
- /package/dist/{thread-bindings.state-SPlv6mh7.js → thread-bindings.state-BdBeo7Rx.js} +0 -0
- /package/dist/{timeouts-C3FYXWJX.js → timeouts-snXNwR4m.js} +0 -0
|
@@ -1,8 +1,97 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
1
|
+
import { Ht as parseDiscordTarget } from "./send.receipt-nKLxvA1s.js";
|
|
2
|
+
import { r as listDiscordAccountIds, s as resolveDiscordAccount } from "./accounts-DnNVBDfc.js";
|
|
3
|
+
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { createLazyChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
|
|
5
|
-
import { resolveApprovalRequestSessionConversation } from "openclaw/plugin-sdk/approval-native-runtime";
|
|
5
|
+
import { createChannelApproverDmTargetResolver, createChannelNativeOriginTargetResolver, doesApprovalRequestMatchChannelAccount, resolveApprovalRequestSessionConversation } from "openclaw/plugin-sdk/approval-native-runtime";
|
|
6
|
+
import { getExecApprovalReplyMetadata, isChannelExecApprovalClientEnabledFromConfig, matchesApprovalRequestFilters } from "openclaw/plugin-sdk/approval-client-runtime";
|
|
7
|
+
import { resolveApprovalApprovers } from "openclaw/plugin-sdk/approval-auth-runtime";
|
|
8
|
+
import { createApproverRestrictedNativeApprovalCapability } from "openclaw/plugin-sdk/approval-delivery-runtime";
|
|
9
|
+
//#region extensions/discord/src/exec-approvals.ts
|
|
10
|
+
function normalizeDiscordApproverId(value) {
|
|
11
|
+
const trimmed = value.trim();
|
|
12
|
+
if (!trimmed) return;
|
|
13
|
+
if (/^\d+$/.test(trimmed)) return trimmed;
|
|
14
|
+
try {
|
|
15
|
+
const target = parseDiscordTarget(trimmed);
|
|
16
|
+
return target?.kind === "user" ? target.id : void 0;
|
|
17
|
+
} catch {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function resolveDiscordOwnerApprovers(cfg) {
|
|
22
|
+
const ownerAllowFrom = cfg.commands?.ownerAllowFrom;
|
|
23
|
+
if (!Array.isArray(ownerAllowFrom) || ownerAllowFrom.length === 0) return [];
|
|
24
|
+
return resolveApprovalApprovers({
|
|
25
|
+
explicit: ownerAllowFrom,
|
|
26
|
+
normalizeApprover: (value) => normalizeDiscordApproverId(String(value))
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function getDiscordExecApprovalApprovers(params) {
|
|
30
|
+
return resolveApprovalApprovers({
|
|
31
|
+
explicit: params.configOverride?.approvers ?? resolveDiscordAccount(params).config.execApprovals?.approvers ?? resolveDiscordOwnerApprovers(params.cfg),
|
|
32
|
+
normalizeApprover: (value) => normalizeDiscordApproverId(String(value))
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function isDiscordExecApprovalClientEnabled(params) {
|
|
36
|
+
return isChannelExecApprovalClientEnabledFromConfig({
|
|
37
|
+
enabled: (params.configOverride ?? resolveDiscordAccount(params).config.execApprovals)?.enabled,
|
|
38
|
+
approverCount: getDiscordExecApprovalApprovers({
|
|
39
|
+
cfg: params.cfg,
|
|
40
|
+
accountId: params.accountId,
|
|
41
|
+
configOverride: params.configOverride
|
|
42
|
+
}).length
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function isDiscordExecApprovalApprover(params) {
|
|
46
|
+
const senderId = params.senderId?.trim();
|
|
47
|
+
if (!senderId) return false;
|
|
48
|
+
return getDiscordExecApprovalApprovers({
|
|
49
|
+
cfg: params.cfg,
|
|
50
|
+
accountId: params.accountId,
|
|
51
|
+
configOverride: params.configOverride
|
|
52
|
+
}).includes(senderId);
|
|
53
|
+
}
|
|
54
|
+
function shouldSuppressLocalDiscordExecApprovalPrompt(params) {
|
|
55
|
+
const metadata = getExecApprovalReplyMetadata(params.payload);
|
|
56
|
+
const config = resolveDiscordAccount(params).config.execApprovals;
|
|
57
|
+
return params.hint?.kind === "approval-pending" && params.hint.nativeRouteActive === true && isDiscordExecApprovalClientEnabled(params) && metadata !== null && matchesApprovalRequestFilters({
|
|
58
|
+
request: {
|
|
59
|
+
agentId: metadata.agentId,
|
|
60
|
+
sessionKey: metadata.sessionKey
|
|
61
|
+
},
|
|
62
|
+
agentFilter: config?.agentFilter,
|
|
63
|
+
sessionFilter: config?.sessionFilter
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region extensions/discord/src/approval-shared.ts
|
|
68
|
+
function shouldHandleDiscordApprovalRequest(params) {
|
|
69
|
+
const config = params.configOverride ?? resolveDiscordAccount({
|
|
70
|
+
cfg: params.cfg,
|
|
71
|
+
accountId: params.accountId
|
|
72
|
+
}).config.execApprovals;
|
|
73
|
+
const approvers = getDiscordExecApprovalApprovers({
|
|
74
|
+
cfg: params.cfg,
|
|
75
|
+
accountId: params.accountId,
|
|
76
|
+
configOverride: params.configOverride
|
|
77
|
+
});
|
|
78
|
+
if (!doesApprovalRequestMatchChannelAccount({
|
|
79
|
+
cfg: params.cfg,
|
|
80
|
+
request: params.request,
|
|
81
|
+
channel: "discord",
|
|
82
|
+
accountId: params.accountId
|
|
83
|
+
})) return false;
|
|
84
|
+
if (!isChannelExecApprovalClientEnabledFromConfig({
|
|
85
|
+
enabled: config?.enabled,
|
|
86
|
+
approverCount: approvers.length
|
|
87
|
+
})) return false;
|
|
88
|
+
return matchesApprovalRequestFilters({
|
|
89
|
+
request: params.request.request,
|
|
90
|
+
agentFilter: config?.agentFilter,
|
|
91
|
+
sessionFilter: config?.sessionFilter
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
6
95
|
//#region extensions/discord/src/approval-native.ts
|
|
7
96
|
function extractDiscordSessionKind(sessionKey) {
|
|
8
97
|
if (!sessionKey) return null;
|
|
@@ -140,7 +229,7 @@ function createDiscordApprovalCapability(configOverride) {
|
|
|
140
229
|
request,
|
|
141
230
|
configOverride
|
|
142
231
|
}),
|
|
143
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
232
|
+
load: async () => (await import("./approval-handler.runtime-Uco62pII.js").then((n) => n.t)).discordApprovalNativeRuntime
|
|
144
233
|
})
|
|
145
234
|
});
|
|
146
235
|
}
|
|
@@ -150,4 +239,32 @@ function getDiscordApprovalCapability() {
|
|
|
150
239
|
return cachedDiscordApprovalCapability;
|
|
151
240
|
}
|
|
152
241
|
//#endregion
|
|
153
|
-
|
|
242
|
+
//#region extensions/discord/src/conversation-identity.ts
|
|
243
|
+
function normalizeDiscordTarget(raw, defaultKind) {
|
|
244
|
+
const trimmed = normalizeOptionalString(raw);
|
|
245
|
+
if (!trimmed) return;
|
|
246
|
+
return parseDiscordTarget(trimmed, { defaultKind })?.normalized;
|
|
247
|
+
}
|
|
248
|
+
function buildDiscordConversationIdentity(kind, rawId) {
|
|
249
|
+
const trimmed = normalizeOptionalString(rawId);
|
|
250
|
+
return trimmed ? `${kind}:${trimmed}` : void 0;
|
|
251
|
+
}
|
|
252
|
+
function resolveDiscordConversationIdentity(params) {
|
|
253
|
+
return params.isDirectMessage ? buildDiscordConversationIdentity("user", params.userId) : buildDiscordConversationIdentity("channel", params.channelId);
|
|
254
|
+
}
|
|
255
|
+
function resolveDiscordCurrentConversationIdentity(params) {
|
|
256
|
+
if (normalizeOptionalLowercaseString(params.chatType) === "direct") {
|
|
257
|
+
const senderTarget = normalizeDiscordTarget(params.from, "user");
|
|
258
|
+
if (senderTarget?.startsWith("user:")) return senderTarget;
|
|
259
|
+
}
|
|
260
|
+
for (const candidate of [
|
|
261
|
+
params.originatingTo,
|
|
262
|
+
params.commandTo,
|
|
263
|
+
params.fallbackTo
|
|
264
|
+
]) {
|
|
265
|
+
const target = normalizeDiscordTarget(candidate, "channel");
|
|
266
|
+
if (target) return target;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
//#endregion
|
|
270
|
+
export { getDiscordExecApprovalApprovers as a, shouldSuppressLocalDiscordExecApprovalPrompt as c, shouldHandleDiscordApprovalRequest as i, resolveDiscordCurrentConversationIdentity as n, isDiscordExecApprovalApprover as o, getDiscordApprovalCapability as r, isDiscordExecApprovalClientEnabled as s, resolveDiscordConversationIdentity as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as mergeDiscordAccountConfig, c as resolveDiscordAccountAllowFrom, o as resolveDefaultDiscordAccountId } from "./accounts-
|
|
1
|
+
import { Wt as __exportAll } from "./send.receipt-nKLxvA1s.js";
|
|
2
|
+
import { a as mergeDiscordAccountConfig, c as resolveDiscordAccountAllowFrom, o as resolveDefaultDiscordAccountId } from "./accounts-DnNVBDfc.js";
|
|
3
3
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
4
4
|
import { createResolvedDirectoryEntriesLister } from "openclaw/plugin-sdk/directory-config-runtime";
|
|
5
5
|
//#region extensions/discord/src/directory-config.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as listDiscordDirectoryGroupsFromConfig, r as listDiscordDirectoryPeersFromConfig } from "./directory-config-
|
|
1
|
+
import { n as listDiscordDirectoryGroupsFromConfig, r as listDiscordDirectoryPeersFromConfig } from "./directory-config-CW_JusGS.js";
|
|
2
2
|
export { listDiscordDirectoryGroupsFromConfig, listDiscordDirectoryPeersFromConfig };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { Wt as __exportAll } from "./send.receipt-nKLxvA1s.js";
|
|
2
|
+
import { p as normalizeDiscordToken, s as resolveDiscordAccount } from "./accounts-DnNVBDfc.js";
|
|
3
|
+
import { n as fetchDiscord } from "./api-DgQLz1wq.js";
|
|
4
|
+
import { a as normalizeDiscordSlug } from "./allow-list-CBI-M84K.js";
|
|
5
|
+
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
|
+
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
7
|
+
//#region extensions/discord/src/directory-cache.ts
|
|
8
|
+
const DISCORD_DIRECTORY_CACHE_MAX_ENTRIES = 4e3;
|
|
9
|
+
const DISCORD_DISCRIMINATOR_SUFFIX = /#\d{4}$/;
|
|
10
|
+
const DIRECTORY_HANDLE_CACHE = /* @__PURE__ */ new Map();
|
|
11
|
+
function normalizeAccountCacheKey(accountId) {
|
|
12
|
+
return normalizeAccountId(accountId ?? DEFAULT_ACCOUNT_ID) || DEFAULT_ACCOUNT_ID;
|
|
13
|
+
}
|
|
14
|
+
function normalizeSnowflake(value) {
|
|
15
|
+
const text = normalizeOptionalStringifiedId(value) ?? "";
|
|
16
|
+
if (!/^\d+$/.test(text)) return null;
|
|
17
|
+
return text;
|
|
18
|
+
}
|
|
19
|
+
function normalizeHandleKey(raw) {
|
|
20
|
+
let handle = normalizeOptionalString(raw) ?? "";
|
|
21
|
+
if (!handle) return null;
|
|
22
|
+
if (handle.startsWith("@")) handle = normalizeOptionalString(handle.slice(1)) ?? "";
|
|
23
|
+
if (!handle || /\s/.test(handle)) return null;
|
|
24
|
+
return normalizeLowercaseStringOrEmpty(handle);
|
|
25
|
+
}
|
|
26
|
+
function ensureAccountCache(accountId) {
|
|
27
|
+
const cacheKey = normalizeAccountCacheKey(accountId);
|
|
28
|
+
const existing = DIRECTORY_HANDLE_CACHE.get(cacheKey);
|
|
29
|
+
if (existing) return existing;
|
|
30
|
+
const created = /* @__PURE__ */ new Map();
|
|
31
|
+
DIRECTORY_HANDLE_CACHE.set(cacheKey, created);
|
|
32
|
+
return created;
|
|
33
|
+
}
|
|
34
|
+
function setCacheEntry(cache, key, userId) {
|
|
35
|
+
if (cache.has(key)) cache.delete(key);
|
|
36
|
+
cache.set(key, userId);
|
|
37
|
+
if (cache.size <= DISCORD_DIRECTORY_CACHE_MAX_ENTRIES) return;
|
|
38
|
+
const oldest = cache.keys().next();
|
|
39
|
+
if (!oldest.done) cache.delete(oldest.value);
|
|
40
|
+
}
|
|
41
|
+
function rememberDiscordDirectoryUser(params) {
|
|
42
|
+
const userId = normalizeSnowflake(params.userId);
|
|
43
|
+
if (!userId) return;
|
|
44
|
+
const cache = ensureAccountCache(params.accountId);
|
|
45
|
+
for (const candidate of params.handles) {
|
|
46
|
+
if (typeof candidate !== "string") continue;
|
|
47
|
+
const handle = normalizeHandleKey(candidate);
|
|
48
|
+
if (!handle) continue;
|
|
49
|
+
setCacheEntry(cache, handle, userId);
|
|
50
|
+
const withoutDiscriminator = handle.replace(DISCORD_DISCRIMINATOR_SUFFIX, "");
|
|
51
|
+
if (withoutDiscriminator && withoutDiscriminator !== handle) setCacheEntry(cache, withoutDiscriminator, userId);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function resolveDiscordDirectoryUserId(params) {
|
|
55
|
+
const cache = DIRECTORY_HANDLE_CACHE.get(normalizeAccountCacheKey(params.accountId));
|
|
56
|
+
if (!cache) return;
|
|
57
|
+
const handle = normalizeHandleKey(params.handle);
|
|
58
|
+
if (!handle) return;
|
|
59
|
+
const direct = cache.get(handle);
|
|
60
|
+
if (direct) return direct;
|
|
61
|
+
const withoutDiscriminator = handle.replace(DISCORD_DISCRIMINATOR_SUFFIX, "");
|
|
62
|
+
if (!withoutDiscriminator || withoutDiscriminator === handle) return;
|
|
63
|
+
return cache.get(withoutDiscriminator);
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region extensions/discord/src/directory-live.ts
|
|
67
|
+
var directory_live_exports = /* @__PURE__ */ __exportAll({
|
|
68
|
+
listDiscordDirectoryGroupsLive: () => listDiscordDirectoryGroupsLive,
|
|
69
|
+
listDiscordDirectoryPeersLive: () => listDiscordDirectoryPeersLive
|
|
70
|
+
});
|
|
71
|
+
function normalizeQuery(value) {
|
|
72
|
+
return normalizeOptionalLowercaseString(value) ?? "";
|
|
73
|
+
}
|
|
74
|
+
function buildUserRank(user) {
|
|
75
|
+
return user.bot ? 0 : 1;
|
|
76
|
+
}
|
|
77
|
+
function resolveDiscordDirectoryAccess(params) {
|
|
78
|
+
const account = resolveDiscordAccount({
|
|
79
|
+
cfg: params.cfg,
|
|
80
|
+
accountId: params.accountId
|
|
81
|
+
});
|
|
82
|
+
const token = normalizeDiscordToken(account.token, "channels.discord.token");
|
|
83
|
+
if (!token) return null;
|
|
84
|
+
return {
|
|
85
|
+
token,
|
|
86
|
+
query: normalizeQuery(params.query),
|
|
87
|
+
accountId: account.accountId
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
async function listDiscordGuilds(token) {
|
|
91
|
+
return (await fetchDiscord("/users/@me/guilds", token)).filter((guild) => guild.id && guild.name);
|
|
92
|
+
}
|
|
93
|
+
async function listDiscordDirectoryGroupsLive(params) {
|
|
94
|
+
const access = resolveDiscordDirectoryAccess(params);
|
|
95
|
+
if (!access) return [];
|
|
96
|
+
const { token, query } = access;
|
|
97
|
+
const guilds = await listDiscordGuilds(token);
|
|
98
|
+
const rows = [];
|
|
99
|
+
for (const guild of guilds) {
|
|
100
|
+
const channels = await fetchDiscord(`/guilds/${guild.id}/channels`, token);
|
|
101
|
+
for (const channel of channels) {
|
|
102
|
+
const name = channel.name?.trim();
|
|
103
|
+
if (!name) continue;
|
|
104
|
+
if (query && !normalizeDiscordSlug(name).includes(normalizeDiscordSlug(query))) continue;
|
|
105
|
+
rows.push({
|
|
106
|
+
kind: "group",
|
|
107
|
+
id: `channel:${channel.id}`,
|
|
108
|
+
name,
|
|
109
|
+
handle: `#${name}`,
|
|
110
|
+
raw: channel
|
|
111
|
+
});
|
|
112
|
+
if (typeof params.limit === "number" && params.limit > 0 && rows.length >= params.limit) return rows;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return rows;
|
|
116
|
+
}
|
|
117
|
+
async function listDiscordDirectoryPeersLive(params) {
|
|
118
|
+
const access = resolveDiscordDirectoryAccess(params);
|
|
119
|
+
if (!access) return [];
|
|
120
|
+
const { token, query, accountId } = access;
|
|
121
|
+
if (!query) return [];
|
|
122
|
+
const guilds = await listDiscordGuilds(token);
|
|
123
|
+
const rows = [];
|
|
124
|
+
const limit = typeof params.limit === "number" && params.limit > 0 ? params.limit : 25;
|
|
125
|
+
for (const guild of guilds) {
|
|
126
|
+
const paramsObj = new URLSearchParams({
|
|
127
|
+
query,
|
|
128
|
+
limit: String(Math.min(limit, 100))
|
|
129
|
+
});
|
|
130
|
+
const members = await fetchDiscord(`/guilds/${guild.id}/members/search?${paramsObj.toString()}`, token);
|
|
131
|
+
for (const member of members) {
|
|
132
|
+
const user = member.user;
|
|
133
|
+
if (!user?.id) continue;
|
|
134
|
+
rememberDiscordDirectoryUser({
|
|
135
|
+
accountId,
|
|
136
|
+
userId: user.id,
|
|
137
|
+
handles: [
|
|
138
|
+
user.username,
|
|
139
|
+
user.global_name,
|
|
140
|
+
member.nick,
|
|
141
|
+
user.username ? `@${user.username}` : null
|
|
142
|
+
]
|
|
143
|
+
});
|
|
144
|
+
const name = member.nick?.trim() || user.global_name?.trim() || user.username?.trim();
|
|
145
|
+
rows.push({
|
|
146
|
+
kind: "user",
|
|
147
|
+
id: `user:${user.id}`,
|
|
148
|
+
name: name || void 0,
|
|
149
|
+
handle: user.username ? `@${user.username}` : void 0,
|
|
150
|
+
rank: buildUserRank(user),
|
|
151
|
+
raw: member
|
|
152
|
+
});
|
|
153
|
+
if (rows.length >= limit) return rows;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return rows;
|
|
157
|
+
}
|
|
158
|
+
//#endregion
|
|
159
|
+
export { resolveDiscordDirectoryUserId as a, rememberDiscordDirectoryUser as i, listDiscordDirectoryGroupsLive as n, listDiscordDirectoryPeersLive as r, directory_live_exports as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-
|
|
1
|
+
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-ftWAMvBl.js";
|
|
2
2
|
export { legacyConfigRules, normalizeCompatibilityConfig };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as resolveDiscordPreviewStreamMode } from "./preview-streaming-
|
|
1
|
+
import { t as resolveDiscordPreviewStreamMode } from "./preview-streaming-CXTZydhx.js";
|
|
2
2
|
import { asObjectRecord, normalizeLegacyChannelAliases } from "openclaw/plugin-sdk/runtime-doctor";
|
|
3
3
|
//#region extensions/discord/src/doctor-contract.ts
|
|
4
4
|
const LEGACY_TTS_PROVIDER_KEYS = [
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { o as resolveDefaultDiscordAccountId } from "./accounts-
|
|
2
|
-
import { t as inspectDiscordAccount } from "./account-inspect-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as isDiscordMutableAllowEntry } from "./security-doctor-
|
|
1
|
+
import { o as resolveDefaultDiscordAccountId } from "./accounts-DnNVBDfc.js";
|
|
2
|
+
import { t as inspectDiscordAccount } from "./account-inspect-B_N30NV0.js";
|
|
3
|
+
import { r as DISCORD_LEGACY_CONFIG_RULES } from "./shared-0kdaIxXP.js";
|
|
4
|
+
import { n as normalizeCompatibilityConfig } from "./doctor-contract-ftWAMvBl.js";
|
|
5
|
+
import { t as isDiscordMutableAllowEntry } from "./security-doctor-Cp-NqNdS.js";
|
|
6
6
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { collectProviderDangerousNameMatchingScopes } from "openclaw/plugin-sdk/runtime-doctor";
|
|
8
8
|
//#region extensions/discord/src/doctor.ts
|
package/dist/{handle-action.guild-admin-C4phin-a.js → handle-action.guild-admin-DriifPwO.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as readDiscordChannelCreateParams, n as isDiscordModerationAction, o as readDiscordChannelEditParams, r as readDiscordModerationCommand, s as readDiscordChannelMoveParams, t as handleDiscordAction } from "./runtime-
|
|
1
|
+
import { a as readDiscordChannelCreateParams, n as isDiscordModerationAction, o as readDiscordChannelEditParams, r as readDiscordModerationCommand, s as readDiscordChannelMoveParams, t as handleDiscordAction } from "./runtime-DL82ijB1.js";
|
|
2
2
|
import "./action-runtime-api.js";
|
|
3
3
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { readNumberParam, readStringArrayParam, readStringParam } from "openclaw/plugin-sdk/agent-runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as resolveDiscordOwnerAllowFrom, p as resolveDiscordMemberAllowed } from "./allow-list-
|
|
1
|
+
import { h as resolveDiscordOwnerAllowFrom, p as resolveDiscordMemberAllowed } from "./allow-list-CBI-M84K.js";
|
|
2
2
|
import { buildUntrustedChannelMetadata, wrapExternalContent } from "openclaw/plugin-sdk/security-runtime";
|
|
3
3
|
//#region extensions/discord/src/monitor/inbound-context.ts
|
|
4
4
|
function createDiscordSupplementalContextAccessChecker(params) {
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as resolveDiscordAccountAllowFrom } from "./accounts-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
8
|
-
import { t as buildDiscordGroupSystemPrompt } from "./inbound-context-jtKcY9on.js";
|
|
9
|
-
import { n as resolveDiscordVoiceEnabled, t as authorizeDiscordVoiceIngress } from "./access-Dxmzr0ix.js";
|
|
1
|
+
import { Ht as parseDiscordTarget, _ as VoiceStateUpdateListener, c as discord_exports, h as ResumedListener, m as ReadyListener } from "./send.receipt-nKLxvA1s.js";
|
|
2
|
+
import { c as resolveDiscordAccountAllowFrom } from "./accounts-DnNVBDfc.js";
|
|
3
|
+
import { a as normalizeDiscordSlug, b as formatDiscordUserTag, m as resolveDiscordOwnerAccess } from "./allow-list-CBI-M84K.js";
|
|
4
|
+
import { i as formatMention } from "./send.outbound-D8o8BW6q.js";
|
|
5
|
+
import { t as getDiscordRuntime } from "./runtime-Tqtvj5GX.js";
|
|
6
|
+
import { o as authorizeDiscordVoiceIngress, u as resolveDiscordVoiceEnabled } from "./provider-nzJg2k5t.js";
|
|
7
|
+
import { t as buildDiscordGroupSystemPrompt } from "./inbound-context-DD7n3Q6U.js";
|
|
10
8
|
import { createRequire } from "node:module";
|
|
11
9
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
10
|
import { resolveAgentRoute } from "openclaw/plugin-sdk/routing";
|
|
@@ -245,6 +243,27 @@ function scheduleVoiceCaptureFinalize(params) {
|
|
|
245
243
|
});
|
|
246
244
|
return true;
|
|
247
245
|
}
|
|
246
|
+
const logger$3 = createSubsystemLogger("discord/voice");
|
|
247
|
+
function summarizeAgentTurnPayloads(payloads) {
|
|
248
|
+
let textPayloads = 0;
|
|
249
|
+
let nonEmptyTextPayloads = 0;
|
|
250
|
+
let reasoningPayloads = 0;
|
|
251
|
+
let errorPayloads = 0;
|
|
252
|
+
let mediaPayloads = 0;
|
|
253
|
+
for (const payload of payloads) {
|
|
254
|
+
if (!payload || typeof payload !== "object") continue;
|
|
255
|
+
const record = payload;
|
|
256
|
+
const text = record.text;
|
|
257
|
+
if (typeof text === "string") {
|
|
258
|
+
textPayloads += 1;
|
|
259
|
+
if (text.trim()) nonEmptyTextPayloads += 1;
|
|
260
|
+
}
|
|
261
|
+
if (record.isReasoning === true) reasoningPayloads += 1;
|
|
262
|
+
if (record.isError === true) errorPayloads += 1;
|
|
263
|
+
if (typeof record.mediaUrl === "string" || Array.isArray(record.mediaUrls) && record.mediaUrls.length > 0) mediaPayloads += 1;
|
|
264
|
+
}
|
|
265
|
+
return `payloadCount=${payloads.length} textPayloads=${textPayloads} nonEmptyTextPayloads=${nonEmptyTextPayloads} reasoningPayloads=${reasoningPayloads} errorPayloads=${errorPayloads} mediaPayloads=${mediaPayloads}`;
|
|
266
|
+
}
|
|
248
267
|
async function resolveDiscordVoiceIngressContext(params) {
|
|
249
268
|
const { entry, userId } = params;
|
|
250
269
|
if (!entry.guildName) entry.guildName = await params.fetchGuildName(entry.guildId);
|
|
@@ -286,21 +305,24 @@ async function runDiscordVoiceAgentTurn(params) {
|
|
|
286
305
|
});
|
|
287
306
|
if (!context) return null;
|
|
288
307
|
const voiceModel = normalizeOptionalString(params.discordConfig.voice?.model);
|
|
308
|
+
const payloads = (await agentCommandFromIngress({
|
|
309
|
+
message: params.message,
|
|
310
|
+
sessionKey: params.entry.route.sessionKey,
|
|
311
|
+
agentId: params.entry.route.agentId,
|
|
312
|
+
messageChannel: "discord",
|
|
313
|
+
messageProvider: "discord-voice",
|
|
314
|
+
extraSystemPrompt: context.extraSystemPrompt,
|
|
315
|
+
senderIsOwner: context.senderIsOwner,
|
|
316
|
+
allowModelOverride: Boolean(voiceModel),
|
|
317
|
+
model: voiceModel,
|
|
318
|
+
toolsAllow: params.toolsAllow,
|
|
319
|
+
deliver: false
|
|
320
|
+
}, params.runtime)).payloads ?? [];
|
|
321
|
+
const text = payloads.map((payload) => payload.text).filter((entry) => typeof entry === "string" && entry.trim()).join("\n").trim();
|
|
322
|
+
if (!text) logger$3.info(`discord voice: agent turn produced no speakable payloads guild=${params.entry.guildId} channel=${params.entry.channelId} voiceSession=${params.entry.voiceSessionKey} supervisorSession=${params.entry.route.sessionKey} agent=${params.entry.route.agentId} user=${params.userId} ${summarizeAgentTurnPayloads(payloads)}`);
|
|
289
323
|
return {
|
|
290
324
|
context,
|
|
291
|
-
text
|
|
292
|
-
message: params.message,
|
|
293
|
-
sessionKey: params.entry.route.sessionKey,
|
|
294
|
-
agentId: params.entry.route.agentId,
|
|
295
|
-
messageChannel: "discord",
|
|
296
|
-
messageProvider: "discord-voice",
|
|
297
|
-
extraSystemPrompt: context.extraSystemPrompt,
|
|
298
|
-
senderIsOwner: context.senderIsOwner,
|
|
299
|
-
allowModelOverride: Boolean(voiceModel),
|
|
300
|
-
model: voiceModel,
|
|
301
|
-
toolsAllow: params.toolsAllow,
|
|
302
|
-
deliver: false
|
|
303
|
-
}, params.runtime)).payloads ?? []).map((payload) => payload.text).filter((text) => typeof text === "string" && text.trim()).join("\n").trim()
|
|
325
|
+
text
|
|
304
326
|
};
|
|
305
327
|
}
|
|
306
328
|
//#endregion
|
|
@@ -356,6 +378,7 @@ const DISCORD_REALTIME_RECENT_AGENT_PROXY_CONSULT_TTL_MS = 15e3;
|
|
|
356
378
|
const DISCORD_REALTIME_LOG_PREVIEW_CHARS = 500;
|
|
357
379
|
const DISCORD_REALTIME_DEFAULT_MIN_BARGE_IN_AUDIO_END_MS = 250;
|
|
358
380
|
const DISCORD_REALTIME_FORCED_CONSULT_FALLBACK_DELAY_MS = 200;
|
|
381
|
+
const DISCORD_REALTIME_DUPLICATE_ERROR_SUPPRESS_MS = 6e4;
|
|
359
382
|
const REALTIME_PCM16_BYTES_PER_SAMPLE = 2;
|
|
360
383
|
const DISCORD_REALTIME_FORCED_CONSULT_TRAILING_FRAGMENT_WORDS = new Set([
|
|
361
384
|
"a",
|
|
@@ -603,8 +626,11 @@ var DiscordRealtimeVoiceSession = class {
|
|
|
603
626
|
const interruptionLog = formatRealtimeInterruptionLog(event);
|
|
604
627
|
if (interruptionLog) logger$2.info(interruptionLog);
|
|
605
628
|
},
|
|
606
|
-
onError: (error) =>
|
|
607
|
-
onClose: (reason) =>
|
|
629
|
+
onError: (error) => this.logRealtimeError(formatErrorMessage(error)),
|
|
630
|
+
onClose: (reason) => {
|
|
631
|
+
this.flushSuppressedRealtimeErrors();
|
|
632
|
+
logVoiceVerbose(`realtime closed: ${reason}`);
|
|
633
|
+
}
|
|
608
634
|
});
|
|
609
635
|
const resolvedModel = readProviderConfigString(resolved.providerConfig, "model") ?? resolved.provider.defaultModel;
|
|
610
636
|
const resolvedVoice = readProviderConfigString(resolved.providerConfig, "voice");
|
|
@@ -619,6 +645,7 @@ var DiscordRealtimeVoiceSession = class {
|
|
|
619
645
|
}
|
|
620
646
|
close() {
|
|
621
647
|
this.stopped = true;
|
|
648
|
+
this.flushSuppressedRealtimeErrors();
|
|
622
649
|
this.talkback.close();
|
|
623
650
|
this.clearForcedConsultTimers();
|
|
624
651
|
this.pendingAgentProxyConsultContexts = [];
|
|
@@ -633,6 +660,25 @@ var DiscordRealtimeVoiceSession = class {
|
|
|
633
660
|
const voiceSdk = loadDiscordVoiceSdk();
|
|
634
661
|
this.params.entry.player.off(voiceSdk.AudioPlayerStatus.Idle, this.playerIdleHandler);
|
|
635
662
|
}
|
|
663
|
+
logRealtimeError(message) {
|
|
664
|
+
const now = Date.now();
|
|
665
|
+
if (this.lastRealtimeError?.message === message && now - this.lastRealtimeError.lastLoggedAt < DISCORD_REALTIME_DUPLICATE_ERROR_SUPPRESS_MS) {
|
|
666
|
+
this.lastRealtimeError.suppressed += 1;
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
this.flushSuppressedRealtimeErrors();
|
|
670
|
+
this.lastRealtimeError = {
|
|
671
|
+
message,
|
|
672
|
+
suppressed: 0,
|
|
673
|
+
lastLoggedAt: now
|
|
674
|
+
};
|
|
675
|
+
logger$2.warn(`discord voice: realtime error: ${message}`);
|
|
676
|
+
}
|
|
677
|
+
flushSuppressedRealtimeErrors() {
|
|
678
|
+
if (!this.lastRealtimeError || this.lastRealtimeError.suppressed === 0) return;
|
|
679
|
+
logger$2.warn(`discord voice: suppressed ${this.lastRealtimeError.suppressed} duplicate realtime errors: ${this.lastRealtimeError.message}`);
|
|
680
|
+
this.lastRealtimeError.suppressed = 0;
|
|
681
|
+
}
|
|
636
682
|
beginSpeakerTurn(context, userId) {
|
|
637
683
|
const turn = {
|
|
638
684
|
context: {
|
|
@@ -1485,6 +1531,15 @@ var DiscordVoiceSpeakerContextResolver = class {
|
|
|
1485
1531
|
//#region extensions/discord/src/voice/manager.ts
|
|
1486
1532
|
const logger = createSubsystemLogger("discord/voice");
|
|
1487
1533
|
const VOICE_LOG_PREVIEW_CHARS = 500;
|
|
1534
|
+
const DISCORD_VOICE_FATAL_AUTOJOIN_ERROR_PATTERNS = [
|
|
1535
|
+
"api key missing",
|
|
1536
|
+
"incorrect api key",
|
|
1537
|
+
"invalid api key",
|
|
1538
|
+
"unauthorized",
|
|
1539
|
+
"authentication",
|
|
1540
|
+
"permission denied",
|
|
1541
|
+
"forbidden"
|
|
1542
|
+
];
|
|
1488
1543
|
function formatVoiceLogPreview(text) {
|
|
1489
1544
|
const oneLine = text.replace(/\s+/g, " ").trim();
|
|
1490
1545
|
if (oneLine.length <= VOICE_LOG_PREVIEW_CHARS) return oneLine;
|
|
@@ -1524,6 +1579,13 @@ function normalizeVoiceChannelResidencies(entries) {
|
|
|
1524
1579
|
function isVoiceChannelAllowed(params) {
|
|
1525
1580
|
return params.allowedChannels === null || params.allowedChannels.some((entry) => entry.guildId === params.guildId && entry.channelId === params.channelId);
|
|
1526
1581
|
}
|
|
1582
|
+
function formatAutoJoinFailureKey(entry) {
|
|
1583
|
+
return `${entry.guildId}:${entry.channelId}`;
|
|
1584
|
+
}
|
|
1585
|
+
function isFatalAutoJoinFailure(message) {
|
|
1586
|
+
const normalized = message.toLowerCase();
|
|
1587
|
+
return DISCORD_VOICE_FATAL_AUTOJOIN_ERROR_PATTERNS.some((pattern) => normalized.includes(pattern));
|
|
1588
|
+
}
|
|
1527
1589
|
function startAutoJoin(manager) {
|
|
1528
1590
|
manager.autoJoin().catch((err) => logger.warn(`discord voice: autoJoin failed: ${formatErrorMessage(err)}`));
|
|
1529
1591
|
}
|
|
@@ -1570,6 +1632,7 @@ var DiscordVoiceManager$1 = class {
|
|
|
1570
1632
|
this.params = params;
|
|
1571
1633
|
this.sessions = /* @__PURE__ */ new Map();
|
|
1572
1634
|
this.autoJoinTask = null;
|
|
1635
|
+
this.fatalAutoJoinFailures = /* @__PURE__ */ new Map();
|
|
1573
1636
|
this.botUserId = params.botUserId;
|
|
1574
1637
|
this.voiceEnabled = resolveDiscordVoiceEnabled(params.discordConfig.voice);
|
|
1575
1638
|
this.ownerAllowFrom = resolveDiscordAccountAllowFrom({
|
|
@@ -1611,12 +1674,27 @@ var DiscordVoiceManager$1 = class {
|
|
|
1611
1674
|
if (selected) logger.warn(`discord voice: autoJoin has multiple entries for guild ${guildId}; using channel ${selected.channelId}`);
|
|
1612
1675
|
}
|
|
1613
1676
|
for (const entry of entriesByGuild.values()) {
|
|
1677
|
+
const failureKey = formatAutoJoinFailureKey(entry);
|
|
1678
|
+
const fatalFailure = this.fatalAutoJoinFailures.get(failureKey);
|
|
1679
|
+
if (fatalFailure) {
|
|
1680
|
+
if (!fatalFailure.skipLogged) {
|
|
1681
|
+
logger.warn(`discord voice: autoJoin suppressed guild=${entry.guildId} channel=${entry.channelId} after fatal startup failure; retry with /vc join or reload config after fixing credentials: ${fatalFailure.message}`);
|
|
1682
|
+
fatalFailure.skipLogged = true;
|
|
1683
|
+
}
|
|
1684
|
+
continue;
|
|
1685
|
+
}
|
|
1614
1686
|
logVoiceVerbose(`autoJoin: joining guild ${entry.guildId} channel ${entry.channelId}`);
|
|
1615
1687
|
const result = await this.join({
|
|
1616
1688
|
guildId: entry.guildId,
|
|
1617
1689
|
channelId: entry.channelId
|
|
1618
1690
|
});
|
|
1619
|
-
if (!result.ok)
|
|
1691
|
+
if (!result.ok) {
|
|
1692
|
+
logger.warn(`discord voice: autoJoin skipped guild=${entry.guildId} channel=${entry.channelId}: ${result.message}`);
|
|
1693
|
+
if (isFatalAutoJoinFailure(result.message)) this.fatalAutoJoinFailures.set(failureKey, {
|
|
1694
|
+
message: result.message,
|
|
1695
|
+
skipLogged: false
|
|
1696
|
+
});
|
|
1697
|
+
}
|
|
1620
1698
|
}
|
|
1621
1699
|
})().finally(() => {
|
|
1622
1700
|
this.autoJoinTask = null;
|
|
@@ -1881,6 +1959,10 @@ var DiscordVoiceManager$1 = class {
|
|
|
1881
1959
|
connection.on(voiceSdk.VoiceConnectionStatus.Destroyed, destroyedHandler);
|
|
1882
1960
|
player.on("error", playerErrorHandler);
|
|
1883
1961
|
this.sessions.set(guildId, entry);
|
|
1962
|
+
this.fatalAutoJoinFailures.delete(formatAutoJoinFailureKey({
|
|
1963
|
+
guildId,
|
|
1964
|
+
channelId
|
|
1965
|
+
}));
|
|
1884
1966
|
logger.info(`discord voice: joined guild=${guildId} channel=${channelId} mode=${voiceMode} agent=${route.agentId} voiceSession=${voiceRoute.sessionKey} supervisorSession=${route.sessionKey} voiceModel=${voiceConfig?.model ?? "route-default"}`);
|
|
1885
1967
|
return {
|
|
1886
1968
|
ok: true,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as mergeAbortSignals } from "./timeouts-
|
|
4
|
-
import { l as resolveDiscordMessageChannelId, r as resolveDiscordMessageText, s as hasDiscordMessageStickers } from "./message-utils-
|
|
5
|
-
import { t as sendTyping } from "./typing-
|
|
1
|
+
import { M as createDiscordRestClient } from "./send.shared-DSpva7uA.js";
|
|
2
|
+
import { d as resolveDiscordChannelNameSafe, l as resolveDiscordChannelIdSafe, p as resolveDiscordChannelParentSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-DJACBZJ1.js";
|
|
3
|
+
import { a as mergeAbortSignals } from "./timeouts-snXNwR4m.js";
|
|
4
|
+
import { l as resolveDiscordMessageChannelId, r as resolveDiscordMessageText, s as hasDiscordMessageStickers } from "./message-utils-N5UTOXQ2.js";
|
|
5
|
+
import { t as sendTyping } from "./typing-C_8U8J7E.js";
|
|
6
6
|
import { danger, logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
7
7
|
import { resolveOpenProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
8
8
|
import { resolveBatchedReplyThreadingPolicy } from "openclaw/plugin-sdk/reply-reference";
|
|
@@ -121,7 +121,7 @@ function applyImplicitReplyBatchGate(ctx, replyToMode, isBatched) {
|
|
|
121
121
|
//#region extensions/discord/src/monitor/message-run-queue.ts
|
|
122
122
|
let messageProcessRuntimePromise;
|
|
123
123
|
async function loadMessageProcessRuntime() {
|
|
124
|
-
messageProcessRuntimePromise ??= import("./message-handler.process-
|
|
124
|
+
messageProcessRuntimePromise ??= import("./message-handler.process-Cy7_-0H0.js");
|
|
125
125
|
return await messageProcessRuntimePromise;
|
|
126
126
|
}
|
|
127
127
|
async function processDiscordQueuedMessage(params) {
|
|
@@ -173,7 +173,7 @@ function createDiscordMessageRunQueue(params) {
|
|
|
173
173
|
//#region extensions/discord/src/monitor/message-handler.ts
|
|
174
174
|
let messagePreflightRuntimePromise;
|
|
175
175
|
async function loadMessagePreflightRuntime() {
|
|
176
|
-
messagePreflightRuntimePromise ??= import("./message-handler.preflight-
|
|
176
|
+
messagePreflightRuntimePromise ??= import("./message-handler.preflight-C0sT-ewp.js");
|
|
177
177
|
return await messagePreflightRuntimePromise;
|
|
178
178
|
}
|
|
179
179
|
function isNonEmptyString(value) {
|