@openclaw/discord 2026.9.8 → 2026.10.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/README.md +7 -0
- package/dist/.setup/{account-inspect-De8hOUxG.mjs → account-inspect-CjKqkDnH.mjs} +2 -2
- package/dist/.setup/{accounts-ChaMcixG.mjs → accounts-DXHCL8Zm.mjs} +9 -32
- package/dist/.setup/{active-turn-thread-route-fmHl1HNd.mjs → active-turn-thread-route-C4tp9noA.mjs} +5 -9
- package/dist/.setup/{activities-api-tvbsU2e3.mjs → activities-api-BL_hJ0JQ.mjs} +15 -18
- package/dist/.setup/{api-DVbJwZVt.mjs → api-_oznjffB.mjs} +1 -1
- package/dist/.setup/{approval-handler.runtime-DxCK2Rux.mjs → approval-handler.runtime-BilYSrRF.mjs} +22 -61
- package/dist/.setup/{approval-message-updates-BKFqavHZ.mjs → approval-message-updates-CgRwc2_Q.mjs} +2 -2
- package/dist/.setup/{audit-CLg9I71N.mjs → audit-DtvzxONM.mjs} +4 -4
- package/dist/.setup/{channel-access-C12aDZ0p.mjs → channel-access-BRp3Y-rF.mjs} +4 -17
- package/dist/.setup/{channel-type-DRCrEMss.mjs → channel-type-D1_b5UhU.mjs} +12 -16
- package/dist/.setup/{channel-DxlUVU9t.mjs → channel-z5lQMS_9.mjs} +79 -75
- package/dist/.setup/{channel.setup-CRo1GjV7.mjs → channel.setup-DBJtugJO.mjs} +14 -34
- package/dist/.setup/{components-Cq1PvIpN.mjs → components-CzXLR3QH.mjs} +56 -72
- package/dist/.setup/{config-schema-oxELUSDx.mjs → config-schema-CsemBDpS.mjs} +6 -17
- package/dist/.setup/{conversation-binding-route-Caz_XuFH.mjs → conversation-binding-route-Bi62ApSt.mjs} +1 -1
- package/dist/.setup/{directory-config-esqNn0Eo.mjs → directory-config-BH1LA-gi.mjs} +1 -1
- package/dist/.setup/{directory-live-DtKRHuGV.mjs → directory-live-C9xz7IPm.mjs} +10 -13
- package/dist/.setup/{discord-0xJYfdDD.mjs → discord-J7aRzq2Q.mjs} +101 -381
- package/dist/.setup/{doctor-BCl1H5tl.mjs → doctor-DxSAngJq.mjs} +31 -70
- package/dist/.setup/doctor-contract-Bg3NPAMw.mjs +137 -0
- package/dist/.setup/{handle-action-CUvQWnE7.mjs → handle-action-DlmFX-_G.mjs} +10 -11
- package/dist/.setup/{handle-action.guild-admin-Df-8gVle.mjs → handle-action.guild-admin-BnyqTczR.mjs} +67 -129
- package/dist/.setup/{live-policy-config-8Pv20CHc.mjs → live-policy-config-emmPNyh4.mjs} +1 -1
- package/dist/.setup/{message-handler-B-Jk4oDk.mjs → message-handler-BNToPZrx.mjs} +7 -6
- package/dist/.setup/{message-handler.preflight-v-__NSDq.mjs → message-handler.preflight-D0BcCyI7.mjs} +13 -23
- package/dist/.setup/{message-handler.preflight-pluralkit-CWLUBVcx.mjs → message-handler.preflight-pluralkit-D1g3eq0B.mjs} +5 -8
- package/dist/.setup/{message-handler.process-BNFFuChn.mjs → message-handler.process-CThRmCWK.mjs} +57 -96
- package/dist/.setup/{outbound-adapter-BobT-kse.mjs → outbound-adapter-BPq0c2wY.mjs} +11 -17
- package/dist/.setup/{outbound-session-route-zVGxxceg.mjs → outbound-session-route-DGPPKA0z.mjs} +21 -46
- package/dist/.setup/{presence-cache-Di3H3DIU.mjs → presence-cache-Dg3_dADn.mjs} +2 -4
- package/dist/.setup/{probe-LYrIHlBF.mjs → probe-DIRY8vh7.mjs} +17 -27
- package/dist/.setup/{provider-B_G5hASF.mjs → provider-D2OKMo0f.mjs} +273 -446
- package/dist/.setup/{provider-session.runtime-BYlTBFD2.mjs → provider-session.runtime-BupCTZQv.mjs} +3 -3
- package/dist/.setup/provider.runtime-BaW_JnfU.mjs +2 -0
- package/dist/.setup/{realtime-session.runtime-oUd9DOcz.mjs → realtime-session.runtime-D5RSC8Mm.mjs} +6 -8
- package/dist/.setup/{receive-recovery-CHPOsnLc.mjs → receive-recovery-GqF2PUN_.mjs} +1 -4
- package/dist/.setup/{resolve-allowlist-common-DPdRggu5.mjs → resolve-allowlist-common-DUYRrrVB.mjs} +5 -9
- package/dist/.setup/{resolve-channels-BFPNRmVv.mjs → resolve-channels--MUatisx.mjs} +3 -3
- package/dist/.setup/{resolve-users-0-aBuCy3.mjs → resolve-users-CxLcDmM0.mjs} +6 -9
- package/dist/.setup/{retry-pz_cSha2.mjs → retry-BKzO25k4.mjs} +27 -51
- package/dist/.setup/{runtime-sUksZ--Q.mjs → runtime-CerRBfaa.mjs} +2 -2
- package/dist/.setup/{runtime-FN000lxA.mjs → runtime-CwUA0RLr.mjs} +228 -255
- package/dist/.setup/{runtime-doctor-migrations-CshUGl36.mjs → runtime-doctor-migrations-BPV-R4G9.mjs} +6 -0
- package/dist/.setup/{security-audit-Cdaegq7C.mjs → security-audit-D42cp5N7.mjs} +21 -48
- package/dist/.setup/{send-CrfEI6Bs.mjs → send-2X7m2Zmw.mjs} +45 -58
- package/dist/.setup/{send.components-DxQAMfES.mjs → send.components-RqvgmCs3.mjs} +44 -90
- package/dist/.setup/{send.outbound-BISKnb-a.mjs → send.outbound-B4QHSEzm.mjs} +60 -98
- package/dist/.setup/{send.shared-DGFkbkQR.mjs → send.shared-BQIUh6Vn.mjs} +13 -20
- package/dist/.setup/{sender-identity-B9X5Vb9R.mjs → sender-identity-CooeYfAn.mjs} +1 -1
- package/dist/.setup/{session-key-normalization-wJgsKPNF.mjs → session-key-normalization-CCHGNSQw.mjs} +3 -9
- package/dist/.setup/setup-plugin-api-nn_giXvZ.mjs +3 -0
- package/dist/.setup/{shared-B3wZ4hN-.mjs → shared-CIJn6AEC.mjs} +7 -7
- package/dist/.setup/{subagent-hooks-nlUE9ow7.mjs → subagent-hooks-BYlVnxzy.mjs} +4 -9
- package/dist/.setup/{system-events-CdeZnvPV.mjs → system-events-CQ3if_pS.mjs} +2 -2
- package/dist/.setup/{target-resolver-BuLapkhy.mjs → target-resolver-Dzxf80Y3.mjs} +5 -13
- package/dist/.setup/targets-Lf8D55w-.mjs +3 -0
- package/dist/.setup/{thread-bindings-D7TfgjR_.mjs → thread-bindings-yNNlcUWE.mjs} +5 -6
- package/dist/.setup/{thread-bindings.manager-DN-NissX.mjs → thread-bindings.manager-plk0zJAW.mjs} +14 -20
- package/dist/.setup/{thread-bindings.session-updates-CshfKghV.mjs → thread-bindings.session-updates-C9aKtVs6.mjs} +295 -5
- package/dist/.setup/{timeouts-D86uWLt_.mjs → timeouts-pun7VJ02.mjs} +2 -15
- package/dist/.setup/{transcripts-source-p8EV179h.mjs → transcripts-source-CNWswry-.mjs} +31 -79
- package/dist/.setup/typing-CNlSKY5S.mjs +11 -0
- package/dist/.setup/{voice-runtime-B46rcwrG.mjs → voice-runtime-Bc75quiH.mjs} +62 -110
- package/dist/account-inspect-api.js +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/activities-api.js +1 -1
- package/dist/api.js +18 -18
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/control-ui/2afbdab1d3aa65a789d8a3eba666f4b1ec5df07073538fe30d6cf32093a1fb2d/index.js +1 -0
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +19 -128
- package/dist/index.js +1 -1
- package/dist/runtime-api.js +20 -21
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/session-key-api.js +1 -1
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/src/voice/audio-worker.runtime.js +6 -8
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/node_modules/libopus-wasm/CHANGELOG.md +8 -0
- package/node_modules/libopus-wasm/dist/discordjs.d.ts.map +1 -1
- package/node_modules/libopus-wasm/dist/discordjs.js +14 -2
- package/node_modules/libopus-wasm/dist/generated/libopus.generated.mjs +0 -0
- package/node_modules/libopus-wasm/dist/index.d.ts.map +1 -1
- package/node_modules/libopus-wasm/dist/index.js +55 -100
- package/node_modules/libopus-wasm/package.json +5 -5
- package/node_modules/undici/README.md +10 -1
- package/node_modules/undici/docs/docs/api/Agent.md +8 -8
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +9 -6
- package/node_modules/undici/docs/docs/api/Dispatcher.md +9 -0
- package/node_modules/undici/docs/docs/api/Errors.md +25 -0
- package/node_modules/undici/docs/docs/api/Fetch.md +10 -0
- package/node_modules/undici/docs/docs/api/Interceptors.md +4 -3
- package/node_modules/undici/docs/docs/api/Pool.md +5 -6
- package/node_modules/undici/docs/docs/index.md +10 -1
- package/node_modules/undici/lib/api/readable.js +1 -2
- package/node_modules/undici/lib/core/request.js +23 -2
- package/node_modules/undici/lib/core/util.js +0 -39
- package/node_modules/undici/lib/dispatcher/client-h1.js +11 -4
- package/node_modules/undici/lib/dispatcher/client-h2.js +52 -8
- package/node_modules/undici/lib/dispatcher/client.js +6 -1
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +21 -6
- package/node_modules/undici/lib/dispatcher/pool-base.js +63 -2
- package/node_modules/undici/lib/dispatcher/pool.js +90 -7
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +16 -3
- package/node_modules/undici/lib/handler/deduplication-handler.js +24 -11
- package/node_modules/undici/lib/handler/redirect-handler.js +5 -0
- package/node_modules/undici/lib/handler/retry-handler.js +72 -13
- package/node_modules/undici/lib/interceptor/cache.js +4 -1
- package/node_modules/undici/lib/interceptor/decompress.js +236 -69
- package/node_modules/undici/lib/web/cache/cache.js +17 -8
- package/node_modules/undici/lib/web/cache/cachestorage.js +11 -5
- package/node_modules/undici/lib/web/cookies/index.js +19 -7
- package/node_modules/undici/lib/web/cookies/util.js +3 -1
- package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -1
- package/node_modules/undici/lib/web/fetch/body.js +22 -15
- package/node_modules/undici/lib/web/fetch/data-url.js +6 -6
- package/node_modules/undici/lib/web/fetch/formdata.js +30 -36
- package/node_modules/undici/lib/web/fetch/headers.js +34 -31
- package/node_modules/undici/lib/web/fetch/index.js +46 -25
- package/node_modules/undici/lib/web/fetch/request.js +74 -79
- package/node_modules/undici/lib/web/fetch/response.js +43 -44
- package/node_modules/undici/lib/web/fetch/util.js +7 -7
- package/node_modules/undici/lib/web/infra/index.js +16 -1
- package/node_modules/undici/lib/web/webidl/index.js +2 -14
- package/node_modules/undici/lib/web/websocket/connection.js +33 -12
- package/node_modules/undici/lib/web/websocket/events.js +43 -26
- package/node_modules/undici/lib/web/websocket/receiver.js +2 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketerror.js +13 -10
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +19 -4
- package/node_modules/undici/lib/web/websocket/websocket.js +44 -41
- package/node_modules/undici/package.json +1 -1
- package/node_modules/undici/types/diagnostics-channel.d.ts +2 -1
- package/node_modules/undici/types/interceptors.d.ts +1 -1
- package/node_modules/undici/types/webidl.d.ts +13 -7
- package/openclaw.plugin.json +6 -0
- package/package.json +12 -7
- package/dist/.setup/doctor-contract-CvvgwrrG.mjs +0 -409
- package/dist/.setup/model-picker-preference-primitives-BHT1LkR_.mjs +0 -37
- package/dist/.setup/provider.runtime-CUE3UxER.mjs +0 -2
- package/dist/.setup/setup-plugin-api-BQUBxbhe.mjs +0 -3
- package/dist/.setup/targets-0KUcEIYx.mjs +0 -3
- package/dist/.setup/thread-bindings.state-g6v9zAym.mjs +0 -331
- package/dist/.setup/typing-BiHCzBRu.mjs +0 -15
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { C as withDiscordRequestAuthority } from "./discord-
|
|
2
|
-
import { c as resolveDiscordAccount, i as listDiscordStartupAccountIds, l as resolveDiscordAccountAllowFrom, r as listDiscordAccountIds, s as resolveDefaultDiscordAccountId, u as resolveDiscordAccountConfig } from "./accounts-
|
|
1
|
+
import { C as withDiscordRequestAuthority } from "./discord-J7aRzq2Q.mjs";
|
|
2
|
+
import { c as resolveDiscordAccount, i as listDiscordStartupAccountIds, l as resolveDiscordAccountAllowFrom, r as listDiscordAccountIds, s as resolveDefaultDiscordAccountId, u as resolveDiscordAccountConfig } from "./accounts-DXHCL8Zm.mjs";
|
|
3
3
|
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.mjs";
|
|
4
|
-
import { _ as matchesDiscordToolContextTarget, b as parseDiscordTarget, g as looksLikeDiscordTargetId, v as normalizeDiscordMessagingTarget } from "./retry-
|
|
5
|
-
import {
|
|
6
|
-
import { D as isDiscordExecApprovalClientEnabled, E as isDiscordExecApprovalApprover, O as shouldSuppressLocalDiscordExecApprovalPrompt, T as getDiscordExecApprovalApprovers, _ as resolveDiscordRuntimeBindingConversationId, f as resolveDiscordConversationRoute, t as resolveDiscordOutboundSessionRoute, v as discordMessageActions, w as resolveRequiredDiscordChannelPermissions } from "./outbound-session-route-
|
|
7
|
-
import { a as normalizeDiscordAcpConversationId, c as resolveDiscordInboundConversation, i as matchDiscordAcpConversation, n as discordOutbound, o as resolveDiscordAttachedOutboundTarget, r as buildDiscordCrossContextPresentation, s as resolveDiscordCommandConversation } from "./outbound-adapter-
|
|
4
|
+
import { _ as matchesDiscordToolContextTarget, b as parseDiscordTarget, g as looksLikeDiscordTargetId, v as normalizeDiscordMessagingTarget } from "./retry-BKzO25k4.mjs";
|
|
5
|
+
import { l as withAbortTimeout } from "./timeouts-pun7VJ02.mjs";
|
|
6
|
+
import { D as isDiscordExecApprovalClientEnabled, E as isDiscordExecApprovalApprover, O as shouldSuppressLocalDiscordExecApprovalPrompt, T as getDiscordExecApprovalApprovers, _ as resolveDiscordRuntimeBindingConversationId, f as resolveDiscordConversationRoute, t as resolveDiscordOutboundSessionRoute, v as discordMessageActions, w as resolveRequiredDiscordChannelPermissions } from "./outbound-session-route-DGPPKA0z.mjs";
|
|
7
|
+
import { a as normalizeDiscordAcpConversationId, c as resolveDiscordInboundConversation, i as matchDiscordAcpConversation, n as discordOutbound, o as resolveDiscordAttachedOutboundTarget, r as buildDiscordCrossContextPresentation, s as resolveDiscordCommandConversation } from "./outbound-adapter-BPq0c2wY.mjs";
|
|
8
8
|
import { r as openDiscordCommandDeployHashStore } from "./command-deploy-store-DFkBTViB.mjs";
|
|
9
|
-
import { t as resolveDiscordConversationBindingRoute } from "./conversation-binding-route-
|
|
10
|
-
import { a as discordSecurityAdapter, i as discordSetupContract, n as discordConfigAdapter, t as createDiscordPluginBase } from "./shared-
|
|
11
|
-
import { t as normalizeExplicitDiscordSessionKey } from "./session-key-normalization-
|
|
12
|
-
import { i as setThreadBindingMaxAgeBySessionKeyAsync, n as setThreadBindingIdleTimeoutBySessionKeyAsync, r as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-
|
|
9
|
+
import { t as resolveDiscordConversationBindingRoute } from "./conversation-binding-route-Bi62ApSt.mjs";
|
|
10
|
+
import { a as discordSecurityAdapter, i as discordSetupContract, n as discordConfigAdapter, t as createDiscordPluginBase } from "./shared-CIJn6AEC.mjs";
|
|
11
|
+
import { t as normalizeExplicitDiscordSessionKey } from "./session-key-normalization-CCHGNSQw.mjs";
|
|
12
|
+
import { i as setThreadBindingMaxAgeBySessionKeyAsync, n as setThreadBindingIdleTimeoutBySessionKeyAsync, r as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-C9aKtVs6.mjs";
|
|
13
13
|
import { t as defaultTopLevelPlacement } from "./thread-binding-api-BDZJD4na.mjs";
|
|
14
|
+
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
14
15
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
15
16
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
16
17
|
import { PAIRING_APPROVED_MESSAGE, buildTokenChannelStatusSummary, projectCredentialSnapshotFields, resolveConfiguredFromCredentialStatuses } from "openclaw/plugin-sdk/channel-status";
|
|
17
|
-
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
18
18
|
import { createRuntimeConfigReader } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
19
19
|
import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
20
20
|
import { createChannelMessageAdapterFromOutbound } from "openclaw/plugin-sdk/channel-outbound";
|
|
@@ -196,7 +196,7 @@ function createDiscordApprovalCapability() {
|
|
|
196
196
|
accountId,
|
|
197
197
|
request
|
|
198
198
|
}),
|
|
199
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
199
|
+
load: async () => (await import("./approval-handler.runtime-BilYSrRF.mjs")).discordApprovalNativeRuntime
|
|
200
200
|
})
|
|
201
201
|
});
|
|
202
202
|
}
|
|
@@ -207,22 +207,22 @@ function getDiscordApprovalCapability() {
|
|
|
207
207
|
}
|
|
208
208
|
//#endregion
|
|
209
209
|
//#region extensions/discord/src/channel.loaders.ts
|
|
210
|
-
const loadDiscordDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-
|
|
211
|
-
const loadDiscordResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels
|
|
212
|
-
const loadDiscordResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-
|
|
213
|
-
const loadDiscordThreadBindingsManagerModule = createLazyRuntimeModule(() => import("./thread-bindings.manager-
|
|
214
|
-
const loadDiscordTargetResolverModule = createLazyRuntimeModule(() => import("./target-resolver-
|
|
215
|
-
const loadDiscordProviderRuntime = createLazyRuntimeModule(() => import("./provider.runtime-
|
|
216
|
-
const loadDiscordProbeRuntime = createLazyRuntimeModule(() => import("./probe-
|
|
210
|
+
const loadDiscordDirectoryConfigModule = createLazyRuntimeModule(() => import("./directory-config-BH1LA-gi.mjs").then((n) => n.t));
|
|
211
|
+
const loadDiscordResolveChannelsModule = createLazyRuntimeModule(() => import("./resolve-channels--MUatisx.mjs").then((n) => n.n));
|
|
212
|
+
const loadDiscordResolveUsersModule = createLazyRuntimeModule(() => import("./resolve-users-CxLcDmM0.mjs").then((n) => n.n));
|
|
213
|
+
const loadDiscordThreadBindingsManagerModule = createLazyRuntimeModule(() => import("./thread-bindings.manager-plk0zJAW.mjs").then((n) => n.r));
|
|
214
|
+
const loadDiscordTargetResolverModule = createLazyRuntimeModule(() => import("./target-resolver-Dzxf80Y3.mjs").then((n) => n.r));
|
|
215
|
+
const loadDiscordProviderRuntime = createLazyRuntimeModule(() => import("./provider.runtime-BaW_JnfU.mjs"));
|
|
216
|
+
const loadDiscordProbeRuntime = createLazyRuntimeModule(() => import("./probe-DIRY8vh7.mjs").then((n) => n.o));
|
|
217
217
|
async function probeDiscordStatusAccount(params) {
|
|
218
218
|
const startedAtMs = Date.now();
|
|
219
219
|
const runtime = await loadDiscordProbeRuntime();
|
|
220
220
|
const remainingMs = Math.max(1, params.timeoutMs - Math.max(0, Date.now() - startedAtMs));
|
|
221
221
|
return await runtime.probeDiscord(params.token, remainingMs, { includeApplication: true });
|
|
222
222
|
}
|
|
223
|
-
const loadDiscordAuditModule = createLazyRuntimeModule(() => import("./audit-
|
|
224
|
-
const loadDiscordSendModule = createLazyRuntimeModule(() => import("./send-
|
|
225
|
-
const loadDiscordDirectoryLiveModule = createLazyRuntimeModule(() => import("./directory-live-
|
|
223
|
+
const loadDiscordAuditModule = createLazyRuntimeModule(() => import("./audit-DtvzxONM.mjs").then((n) => n.n));
|
|
224
|
+
const loadDiscordSendModule = createLazyRuntimeModule(() => import("./send-2X7m2Zmw.mjs").then((n) => n.t));
|
|
225
|
+
const loadDiscordDirectoryLiveModule = createLazyRuntimeModule(() => import("./directory-live-C9xz7IPm.mjs").then((n) => n.t));
|
|
226
226
|
//#endregion
|
|
227
227
|
//#region extensions/discord/src/conversation-route-owner.ts
|
|
228
228
|
function inspectDiscordConversationRouteOwner(params) {
|
|
@@ -359,20 +359,15 @@ function readDiscordPermissionsAuditSummary(value) {
|
|
|
359
359
|
if (!isRecord$1(entry)) return null;
|
|
360
360
|
const channelId = normalizeOptionalString(entry.channelId);
|
|
361
361
|
if (!channelId) return null;
|
|
362
|
-
const ok = typeof entry.ok === "boolean" ? entry.ok : void 0;
|
|
363
|
-
const missing = Array.isArray(entry.missing) ? entry.missing.map((v) => normalizeOptionalString(v)).filter(Boolean) : void 0;
|
|
364
|
-
const error = normalizeOptionalString(entry.error) ?? null;
|
|
365
|
-
const matchKey = normalizeOptionalString(entry.matchKey);
|
|
366
|
-
const matchSource = normalizeOptionalString(entry.matchSource);
|
|
367
362
|
return {
|
|
368
363
|
channelId,
|
|
369
|
-
ok,
|
|
370
|
-
missing: missing
|
|
371
|
-
error,
|
|
372
|
-
matchKey,
|
|
373
|
-
matchSource
|
|
364
|
+
ok: typeof entry.ok === "boolean" ? entry.ok : void 0,
|
|
365
|
+
missing: normalizeOptionalTrimmedStringList(entry.missing),
|
|
366
|
+
error: normalizeOptionalString(entry.error) ?? null,
|
|
367
|
+
matchKey: normalizeOptionalString(entry.matchKey),
|
|
368
|
+
matchSource: normalizeOptionalString(entry.matchSource)
|
|
374
369
|
};
|
|
375
|
-
}).filter(
|
|
370
|
+
}).filter((entry) => entry !== null) : void 0
|
|
376
371
|
};
|
|
377
372
|
}
|
|
378
373
|
function collectDiscordStatusIssues(accounts) {
|
|
@@ -857,51 +852,55 @@ const discordPlugin = createChatChannelPlugin({
|
|
|
857
852
|
};
|
|
858
853
|
}
|
|
859
854
|
}),
|
|
860
|
-
gateway: {
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
ctx.
|
|
855
|
+
gateway: {
|
|
856
|
+
apiVersion: 2,
|
|
857
|
+
startAccount: async (ctx) => {
|
|
858
|
+
const readConfig = createRuntimeConfigReader(ctx.cfg);
|
|
859
|
+
const account = ctx.account;
|
|
860
|
+
if (account.tokenStatus === "configured_unavailable") throw new Error(`Discord bot token configured for account "${account.accountId}" is unavailable; resolve SecretRefs against the active runtime snapshot before using this account.`);
|
|
861
|
+
const startupDelayMs = resolveDiscordStartupDelayMs(ctx.cfg, account.accountId);
|
|
862
|
+
if (startupDelayMs > 0) {
|
|
863
|
+
ctx.log?.info(`[${account.accountId}] delaying provider startup ${Math.round(startupDelayMs / 1e3)}s to reduce Discord startup rate limits`);
|
|
864
|
+
try {
|
|
865
|
+
await sleepWithAbort(startupDelayMs, ctx.abortSignal);
|
|
866
|
+
} catch {
|
|
867
|
+
return;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
const token = account.token.trim();
|
|
871
|
+
startDiscordStartupProbe({
|
|
872
|
+
accountId: account.accountId,
|
|
873
|
+
token,
|
|
874
|
+
abortSignal: ctx.abortSignal,
|
|
875
|
+
setStatus: ctx.setStatus,
|
|
876
|
+
log: ctx.log
|
|
877
|
+
});
|
|
878
|
+
ctx.log?.info(`[${account.accountId}] starting provider`);
|
|
879
|
+
let commandDeployHashStore;
|
|
867
880
|
try {
|
|
868
|
-
|
|
869
|
-
} catch {
|
|
870
|
-
|
|
881
|
+
commandDeployHashStore = openDiscordCommandDeployHashStore(getDiscordRuntime().state.openKeyedStore);
|
|
882
|
+
} catch (error) {
|
|
883
|
+
ctx.log?.warn?.(`[${account.accountId}] Discord command deploy cache unavailable; continuing without persistence: ${formatErrorMessage(error)}`);
|
|
871
884
|
}
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
accountId: account.accountId,
|
|
876
|
-
token,
|
|
877
|
-
abortSignal: ctx.abortSignal,
|
|
878
|
-
setStatus: ctx.setStatus,
|
|
879
|
-
log: ctx.log
|
|
880
|
-
});
|
|
881
|
-
ctx.log?.info(`[${account.accountId}] starting provider`);
|
|
882
|
-
let commandDeployHashStore;
|
|
883
|
-
try {
|
|
884
|
-
commandDeployHashStore = openDiscordCommandDeployHashStore(getDiscordRuntime().state.openKeyedStore);
|
|
885
|
-
} catch (error) {
|
|
886
|
-
ctx.log?.warn?.(`[${account.accountId}] Discord command deploy cache unavailable; continuing without persistence: ${formatErrorMessage(error)}`);
|
|
887
|
-
}
|
|
888
|
-
return (await loadDiscordProviderRuntime()).monitorDiscordProvider({
|
|
889
|
-
token,
|
|
890
|
-
accountId: account.accountId,
|
|
891
|
-
config: ctx.cfg,
|
|
892
|
-
readConfig,
|
|
893
|
-
runtime: ctx.runtime,
|
|
894
|
-
channelRuntime: ctx.channelRuntime,
|
|
895
|
-
abortSignal: ctx.abortSignal,
|
|
896
|
-
mediaMaxMb: account.config.mediaMaxMb,
|
|
897
|
-
historyLimit: account.config.historyLimit,
|
|
898
|
-
setStatus: (patch) => ctx.setStatus({
|
|
885
|
+
return (await loadDiscordProviderRuntime()).monitorDiscordProvider({
|
|
886
|
+
scheduler: ctx.scheduler,
|
|
887
|
+
token,
|
|
899
888
|
accountId: account.accountId,
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
889
|
+
config: ctx.cfg,
|
|
890
|
+
readConfig,
|
|
891
|
+
runtime: ctx.runtime,
|
|
892
|
+
channelRuntime: ctx.channelRuntime,
|
|
893
|
+
abortSignal: ctx.abortSignal,
|
|
894
|
+
mediaMaxMb: account.config.mediaMaxMb,
|
|
895
|
+
historyLimit: account.config.historyLimit,
|
|
896
|
+
setStatus: (patch) => ctx.setStatus({
|
|
897
|
+
accountId: account.accountId,
|
|
898
|
+
...patch
|
|
899
|
+
}),
|
|
900
|
+
commandDeployHashStore
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
}
|
|
905
904
|
},
|
|
906
905
|
pairing: { text: {
|
|
907
906
|
idLabel: "discordUserId",
|
|
@@ -917,6 +916,11 @@ const discordPlugin = createChatChannelPlugin({
|
|
|
917
916
|
security: discordSecurityAdapter,
|
|
918
917
|
threading: {
|
|
919
918
|
matchesToolContextTarget: matchesDiscordToolContextTarget,
|
|
919
|
+
resolveAutoThreadId: ({ to, toolContext }) => {
|
|
920
|
+
const threadId = normalizeOptionalString(toolContext?.currentThreadTs);
|
|
921
|
+
if (!threadId) return;
|
|
922
|
+
return normalizeDiscordMessagingTarget(to) === `channel:${threadId}` ? threadId : void 0;
|
|
923
|
+
},
|
|
920
924
|
scopedAccountReplyToMode: {
|
|
921
925
|
resolveAccount: (cfg, accountId) => resolveDiscordAccount({
|
|
922
926
|
cfg,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { _ as inspectDiscordAccountTokenState, h as resolveDiscordToken, l as resolveDiscordAccountAllowFrom, o as mergeDiscordAccountConfig, s as resolveDefaultDiscordAccountId, u as resolveDiscordAccountConfig } from "./accounts-
|
|
2
|
-
import { i as discordSetupContract, t as createDiscordPluginBase } from "./shared-
|
|
3
|
-
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels
|
|
4
|
-
import { t as resolveDiscordUserAllowlist } from "./resolve-users-
|
|
5
|
-
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
1
|
+
import { _ as inspectDiscordAccountTokenState, h as resolveDiscordToken, l as resolveDiscordAccountAllowFrom, o as mergeDiscordAccountConfig, s as resolveDefaultDiscordAccountId, u as resolveDiscordAccountConfig } from "./accounts-DXHCL8Zm.mjs";
|
|
2
|
+
import { i as discordSetupContract, t as createDiscordPluginBase } from "./shared-CIJn6AEC.mjs";
|
|
3
|
+
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels--MUatisx.mjs";
|
|
4
|
+
import { t as resolveDiscordUserAllowlist } from "./resolve-users-CxLcDmM0.mjs";
|
|
6
5
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
|
+
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
7
7
|
import { resolveBasicAllowFromEntries } from "openclaw/plugin-sdk/allow-from";
|
|
8
8
|
import { createAccountScopedAllowFromSection, createAccountScopedGroupAccessSection, createSetupTranslator, createStandardChannelSetupStatus, defineTokenCredential, parseMentionOrPrefixedId, patchChannelConfigForAccount, promptResolvedAllowFrom, resolveEntriesWithOptionalToken, resolveSetupAccountId, setSetupChannelEnabled, splitSetupEntries } from "openclaw/plugin-sdk/setup-runtime";
|
|
9
9
|
import { formatDocsLink } from "openclaw/plugin-sdk/setup-tools";
|
|
@@ -197,16 +197,6 @@ function createDiscordSetupWizardBase(handlers) {
|
|
|
197
197
|
//#region extensions/discord/src/setup-surface.ts
|
|
198
198
|
const t = createSetupTranslator();
|
|
199
199
|
const channel = "discord";
|
|
200
|
-
async function resolveDiscordAllowFromEntries(params) {
|
|
201
|
-
return await resolveBasicAllowFromEntries({
|
|
202
|
-
token: params.token,
|
|
203
|
-
entries: params.entries,
|
|
204
|
-
resolveEntries: async ({ token, entries }) => await resolveDiscordUserAllowlist({
|
|
205
|
-
token,
|
|
206
|
-
entries
|
|
207
|
-
})
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
200
|
async function promptDiscordAllowFrom(params) {
|
|
211
201
|
const accountId = resolveSetupAccountId({
|
|
212
202
|
accountId: params.accountId,
|
|
@@ -239,14 +229,11 @@ async function promptDiscordAllowFrom(params) {
|
|
|
239
229
|
parseInputs: splitSetupEntries,
|
|
240
230
|
parseId: parseDiscordAllowFromId,
|
|
241
231
|
invalidWithoutTokenNote: t("wizard.discord.allowFromInvalidWithoutToken"),
|
|
242
|
-
resolveEntries: async ({ token, entries }) =>
|
|
232
|
+
resolveEntries: async ({ token, entries }) => await resolveBasicAllowFromEntries({
|
|
243
233
|
token,
|
|
244
|
-
entries
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
resolved: entry.resolved,
|
|
248
|
-
id: entry.id ?? null
|
|
249
|
-
}))
|
|
234
|
+
entries,
|
|
235
|
+
resolveEntries: resolveDiscordUserAllowlist
|
|
236
|
+
})
|
|
250
237
|
});
|
|
251
238
|
return patchChannelConfigForAccount({
|
|
252
239
|
cfg: params.cfg,
|
|
@@ -269,24 +256,17 @@ async function resolveDiscordGroupAllowlist(params) {
|
|
|
269
256
|
input,
|
|
270
257
|
resolved: false
|
|
271
258
|
}),
|
|
272
|
-
resolveEntries:
|
|
273
|
-
token,
|
|
274
|
-
entries
|
|
275
|
-
})
|
|
259
|
+
resolveEntries: resolveDiscordChannelAllowlist
|
|
276
260
|
});
|
|
277
261
|
}
|
|
278
262
|
const discordSetupWizard = createDiscordSetupWizardBase({
|
|
279
263
|
promptAllowFrom: promptDiscordAllowFrom,
|
|
280
|
-
resolveAllowFromEntries: async ({ cfg, accountId, credentialValues, entries }) => await
|
|
264
|
+
resolveAllowFromEntries: async ({ cfg, accountId, credentialValues, entries }) => await resolveBasicAllowFromEntries({
|
|
281
265
|
token: resolveDiscordToken(cfg, { accountId }).token || (typeof credentialValues.token === "string" ? credentialValues.token : ""),
|
|
282
|
-
entries
|
|
266
|
+
entries,
|
|
267
|
+
resolveEntries: resolveDiscordUserAllowlist
|
|
283
268
|
}),
|
|
284
|
-
resolveGroupAllowlist:
|
|
285
|
-
cfg,
|
|
286
|
-
accountId,
|
|
287
|
-
credentialValues,
|
|
288
|
-
entries
|
|
289
|
-
})
|
|
269
|
+
resolveGroupAllowlist: resolveDiscordGroupAllowlist
|
|
290
270
|
});
|
|
291
271
|
//#endregion
|
|
292
272
|
//#region extensions/discord/src/channel.setup.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
-
import { B as Container, F as RadioGroup, G as RoleSelectMenu, H as LinkButton, I as TextInput, J as Separator, K as Row, L as AnySelectMenu, M as CheckboxGroup, N as Label, P as Modal, Q as UserSelectMenu, R as Button, U as MediaGallery, V as File, W as MentionableSelectMenu, X as TextDisplay, Y as StringSelectMenu, Z as Thumbnail, et as parseCustomId, q as Section, z as ChannelSelectMenu } from "./discord-
|
|
2
|
+
import { B as Container, F as RadioGroup, G as RoleSelectMenu, H as LinkButton, I as TextInput, J as Separator, K as Row, L as AnySelectMenu, M as CheckboxGroup, N as Label, P as Modal, Q as UserSelectMenu, R as Button, U as MediaGallery, V as File, W as MentionableSelectMenu, X as TextDisplay, Y as StringSelectMenu, Z as Thumbnail, et as parseCustomId, q as Section, tt as stripUndefinedFields, z as ChannelSelectMenu } from "./discord-J7aRzq2Q.mjs";
|
|
3
|
+
import { asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString, readNonBlankString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
4
|
import { ButtonStyle, MessageFlags, TextInputStyle } from "discord-api-types/v10";
|
|
4
5
|
import crypto from "node:crypto";
|
|
5
|
-
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, readNonBlankString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { legacyInteractiveReplyToPresentation, resolveMessagePresentationActionValue, resolveMessagePresentationButtonAction, resolveMessagePresentationOptionAction } from "openclaw/plugin-sdk/interactive-runtime";
|
|
7
7
|
import { resolveAskUserQuestionOptionIndex } from "openclaw/plugin-sdk/reply-payload";
|
|
8
8
|
import { buildApprovalResolutionRef } from "openclaw/plugin-sdk/approval-reference-runtime";
|
|
@@ -86,20 +86,17 @@ function parseDiscordComponentCustomId(id) {
|
|
|
86
86
|
const parsed = parseCustomId(id);
|
|
87
87
|
if (parsed.key !== "occomp") return null;
|
|
88
88
|
const data = decodeParsedCustomIdData(parsed.data);
|
|
89
|
-
const componentId = data.cid;
|
|
90
|
-
if (
|
|
91
|
-
const modalId = data.mid;
|
|
89
|
+
const componentId = readNonBlankString(data.cid);
|
|
90
|
+
if (!componentId) return null;
|
|
92
91
|
return {
|
|
93
92
|
componentId,
|
|
94
|
-
modalId:
|
|
93
|
+
modalId: readNonBlankString(data.mid)
|
|
95
94
|
};
|
|
96
95
|
}
|
|
97
96
|
function parseDiscordModalCustomId(id) {
|
|
98
97
|
const parsed = parseCustomId(id);
|
|
99
98
|
if (parsed.key !== "ocmodal") return null;
|
|
100
|
-
|
|
101
|
-
if (typeof modalId !== "string" || !modalId.trim()) return null;
|
|
102
|
-
return modalId;
|
|
99
|
+
return readNonBlankString(decodeParsedCustomIdData(parsed.data).mid) ?? null;
|
|
103
100
|
}
|
|
104
101
|
function isDiscordComponentWildcardRegistrationId(id) {
|
|
105
102
|
return /^__openclaw_discord_component_[a-z_]+_wildcard__$/.test(id);
|
|
@@ -127,8 +124,9 @@ function parseDiscordModalCustomIdForInteraction(id) {
|
|
|
127
124
|
const DISCORD_COMPONENT_ATTACHMENT_PREFIX = "attachment://";
|
|
128
125
|
const BLOCK_ALIASES = /* @__PURE__ */ new Map([["row", "actions"], ["action-row", "actions"]]);
|
|
129
126
|
function requireObject(value, label) {
|
|
130
|
-
|
|
131
|
-
|
|
127
|
+
const record = asOptionalRecord(value);
|
|
128
|
+
if (!record) throw new Error(`${label} must be an object`);
|
|
129
|
+
return record;
|
|
132
130
|
}
|
|
133
131
|
function readRequiredString(value, label, trim = true) {
|
|
134
132
|
if (typeof value !== "string") throw new Error(`${label} must be a string`);
|
|
@@ -150,14 +148,14 @@ function readOptionalStringArray(value, label) {
|
|
|
150
148
|
}
|
|
151
149
|
function readOptionalInteger(value, label, bounds) {
|
|
152
150
|
if (value == null) return;
|
|
153
|
-
if (typeof value !== "number" || !Number.
|
|
151
|
+
if (typeof value !== "number" || !Number.isInteger(value)) throw new Error(`${label} must be an integer`);
|
|
154
152
|
if (bounds?.min !== void 0 && value < bounds.min) throw new Error(`${label} must be at least ${bounds.min}`);
|
|
155
153
|
if (bounds?.max !== void 0 && value > bounds.max) throw new Error(`${label} must be at most ${bounds.max}`);
|
|
156
154
|
return value;
|
|
157
155
|
}
|
|
158
156
|
function readOptionalEmoji(value, label) {
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
const obj = asOptionalRecord(value);
|
|
158
|
+
if (!obj) return;
|
|
161
159
|
return {
|
|
162
160
|
name: readRequiredString(obj.name, `${label}.name`),
|
|
163
161
|
id: normalizeOptionalString(obj.id),
|
|
@@ -165,9 +163,7 @@ function readOptionalEmoji(value, label) {
|
|
|
165
163
|
};
|
|
166
164
|
}
|
|
167
165
|
function normalizeModalFieldName(value, index) {
|
|
168
|
-
|
|
169
|
-
if (trimmed) return trimmed;
|
|
170
|
-
return `field_${index + 1}`;
|
|
166
|
+
return value?.trim() || `field_${index + 1}`;
|
|
171
167
|
}
|
|
172
168
|
function readAttachmentName(value, label, filenameLabel = "a filename") {
|
|
173
169
|
const trimmed = value.trim();
|
|
@@ -209,7 +205,7 @@ function parseButtonSpec(raw, label) {
|
|
|
209
205
|
const obj = requireObject(raw, label);
|
|
210
206
|
const style = normalizeOptionalString(obj.style);
|
|
211
207
|
const url = normalizeOptionalString(obj.url);
|
|
212
|
-
if (
|
|
208
|
+
if (style === "link" && !url) throw new Error(`${label}.url is required for link buttons`);
|
|
213
209
|
return {
|
|
214
210
|
label: readRequiredString(obj.label, `${label}.label`),
|
|
215
211
|
style,
|
|
@@ -334,15 +330,11 @@ function parseComponentBlock(raw, label) {
|
|
|
334
330
|
}
|
|
335
331
|
case "separator": {
|
|
336
332
|
const spacingRaw = obj.spacing;
|
|
337
|
-
|
|
338
|
-
if (spacingRaw === "small" || spacingRaw === "large") spacing = spacingRaw;
|
|
339
|
-
else if (spacingRaw === 1 || spacingRaw === 2) spacing = spacingRaw;
|
|
340
|
-
else if (spacingRaw !== void 0) throw new Error(`${label}.spacing must be "small", "large", 1, or 2`);
|
|
341
|
-
const divider = typeof obj.divider === "boolean" ? obj.divider : void 0;
|
|
333
|
+
if (spacingRaw !== void 0 && spacingRaw !== "small" && spacingRaw !== "large" && spacingRaw !== 1 && spacingRaw !== 2) throw new Error(`${label}.spacing must be "small", "large", 1, or 2`);
|
|
342
334
|
return {
|
|
343
335
|
type: "separator",
|
|
344
|
-
spacing,
|
|
345
|
-
divider
|
|
336
|
+
spacing: spacingRaw,
|
|
337
|
+
divider: typeof obj.divider === "boolean" ? obj.divider : void 0
|
|
346
338
|
};
|
|
347
339
|
}
|
|
348
340
|
case "actions": {
|
|
@@ -413,12 +405,13 @@ function readDiscordComponentSpec(raw) {
|
|
|
413
405
|
fields
|
|
414
406
|
};
|
|
415
407
|
}
|
|
408
|
+
const container = asOptionalRecord(obj.container);
|
|
416
409
|
return {
|
|
417
410
|
text: readNonBlankString(obj.text),
|
|
418
411
|
reusable: typeof obj.reusable === "boolean" ? obj.reusable : void 0,
|
|
419
|
-
container:
|
|
420
|
-
accentColor:
|
|
421
|
-
spoiler: typeof
|
|
412
|
+
container: container ? {
|
|
413
|
+
accentColor: container.accentColor,
|
|
414
|
+
spoiler: typeof container.spoiler === "boolean" ? container.spoiler : void 0
|
|
422
415
|
} : void 0,
|
|
423
416
|
blocks,
|
|
424
417
|
modal
|
|
@@ -469,11 +462,6 @@ function createDiscordSelectMenu(type, customId, options) {
|
|
|
469
462
|
if (select instanceof StringSelectMenu) select.options = options ?? [];
|
|
470
463
|
return select;
|
|
471
464
|
}
|
|
472
|
-
function buildTextDisplays(text, texts) {
|
|
473
|
-
if (texts && texts.length > 0) return texts.map((entry) => new TextDisplay(entry));
|
|
474
|
-
if (text) return [new TextDisplay(text)];
|
|
475
|
-
return [];
|
|
476
|
-
}
|
|
477
465
|
function createButtonComponent(params) {
|
|
478
466
|
const style = mapButtonStyle(params.spec.style);
|
|
479
467
|
if (style === ButtonStyle.Link || Boolean(params.spec.url)) {
|
|
@@ -509,16 +497,16 @@ function createButtonComponent(params) {
|
|
|
509
497
|
if (internalCustomId) return { component: new DynamicButton() };
|
|
510
498
|
return {
|
|
511
499
|
component: new DynamicButton(),
|
|
512
|
-
entry: {
|
|
500
|
+
entry: stripUndefinedFields({
|
|
513
501
|
id: componentId,
|
|
514
502
|
kind: params.modalId ? "modal-trigger" : "button",
|
|
515
503
|
label: params.spec.label,
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
}
|
|
504
|
+
callbackData: params.spec.callbackData,
|
|
505
|
+
callbackDataKind: params.spec.callbackDataKind,
|
|
506
|
+
modalId: params.modalId,
|
|
507
|
+
reusable: params.spec.reusable,
|
|
508
|
+
allowedUsers: params.spec.allowedUsers
|
|
509
|
+
})
|
|
522
510
|
};
|
|
523
511
|
}
|
|
524
512
|
function createSelectComponent(params) {
|
|
@@ -534,7 +522,7 @@ function createSelectComponent(params) {
|
|
|
534
522
|
select.disabled = false;
|
|
535
523
|
return {
|
|
536
524
|
component: select,
|
|
537
|
-
entry: {
|
|
525
|
+
entry: stripUndefinedFields({
|
|
538
526
|
id: componentId,
|
|
539
527
|
kind: "select",
|
|
540
528
|
label: params.spec.placeholder ?? {
|
|
@@ -544,22 +532,21 @@ function createSelectComponent(params) {
|
|
|
544
532
|
mentionable: "mentionable select",
|
|
545
533
|
channel: "channel select"
|
|
546
534
|
}[type],
|
|
547
|
-
|
|
548
|
-
|
|
535
|
+
callbackData: params.spec.callbackData,
|
|
536
|
+
callbackDataKind: params.spec.callbackDataKind,
|
|
549
537
|
selectType: type,
|
|
550
|
-
|
|
538
|
+
options: type === "string" ? options.map((option) => ({
|
|
551
539
|
value: option.value,
|
|
552
540
|
label: option.label
|
|
553
|
-
}))
|
|
554
|
-
|
|
555
|
-
}
|
|
541
|
+
})) : void 0,
|
|
542
|
+
allowedUsers: params.spec.allowedUsers
|
|
543
|
+
})
|
|
556
544
|
};
|
|
557
545
|
}
|
|
558
546
|
function buildDiscordComponentMessage(params) {
|
|
559
547
|
const entries = [];
|
|
560
548
|
const consumptionGroupId = createShortId("grp_");
|
|
561
549
|
const modals = [];
|
|
562
|
-
const components = [];
|
|
563
550
|
const containerChildren = [];
|
|
564
551
|
const addEntry = (entry) => {
|
|
565
552
|
const reusable = entry.reusable ?? params.spec.reusable;
|
|
@@ -580,7 +567,7 @@ function buildDiscordComponentMessage(params) {
|
|
|
580
567
|
continue;
|
|
581
568
|
}
|
|
582
569
|
if (block.type === "section") {
|
|
583
|
-
const displays =
|
|
570
|
+
const displays = (block.texts?.length ? block.texts : block.text ? [block.text] : []).map((entry) => new TextDisplay(entry));
|
|
584
571
|
if (displays.length > 3) throw new Error("Section blocks support up to 3 text displays");
|
|
585
572
|
let accessory;
|
|
586
573
|
if (block.accessory?.type === "thumbnail") accessory = new Thumbnail(block.accessory.url);
|
|
@@ -626,32 +613,32 @@ function buildDiscordComponentMessage(params) {
|
|
|
626
613
|
}
|
|
627
614
|
if (params.spec.modal) {
|
|
628
615
|
const modalId = createShortId("mdl_");
|
|
629
|
-
const fields = params.spec.modal.fields.map((field, index) => ({
|
|
616
|
+
const fields = params.spec.modal.fields.map((field, index) => stripUndefinedFields({
|
|
630
617
|
id: createShortId("fld_"),
|
|
631
618
|
name: normalizeModalFieldName(field.name, index),
|
|
632
619
|
label: field.label,
|
|
633
620
|
type: field.type,
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
621
|
+
description: field.description,
|
|
622
|
+
placeholder: field.placeholder,
|
|
623
|
+
required: field.required,
|
|
624
|
+
options: field.options,
|
|
625
|
+
minValues: field.minValues,
|
|
626
|
+
maxValues: field.maxValues,
|
|
627
|
+
minLength: field.minLength,
|
|
628
|
+
maxLength: field.maxLength,
|
|
629
|
+
style: field.style
|
|
643
630
|
}));
|
|
644
|
-
modals.push({
|
|
631
|
+
modals.push(stripUndefinedFields({
|
|
645
632
|
id: modalId,
|
|
646
633
|
title: params.spec.modal.title,
|
|
647
634
|
fields,
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
});
|
|
635
|
+
callbackData: params.spec.modal.callbackData,
|
|
636
|
+
sessionKey: params.sessionKey,
|
|
637
|
+
agentId: params.agentId,
|
|
638
|
+
accountId: params.accountId,
|
|
639
|
+
reusable: params.spec.reusable,
|
|
640
|
+
allowedUsers: params.spec.modal.allowedUsers
|
|
641
|
+
}));
|
|
655
642
|
const { component, entry } = createButtonComponent({
|
|
656
643
|
spec: {
|
|
657
644
|
label: params.spec.modal.triggerLabel ?? "Open form",
|
|
@@ -667,11 +654,10 @@ function buildDiscordComponentMessage(params) {
|
|
|
667
654
|
}
|
|
668
655
|
if (containerChildren.length === 0) throw new Error("components must include at least one block, text, or modal trigger");
|
|
669
656
|
const container = new Container(containerChildren, params.spec.container);
|
|
670
|
-
components.push(container);
|
|
671
657
|
const consumptionGroupEntryIds = entries.map((entry) => entry.id);
|
|
672
658
|
for (const entry of entries) entry.consumptionGroupEntryIds = consumptionGroupEntryIds;
|
|
673
659
|
return {
|
|
674
|
-
components,
|
|
660
|
+
components: [container],
|
|
675
661
|
entries,
|
|
676
662
|
modals
|
|
677
663
|
};
|
|
@@ -818,12 +804,10 @@ function parseExecApprovalData(data) {
|
|
|
818
804
|
}
|
|
819
805
|
//#endregion
|
|
820
806
|
//#region extensions/discord/src/question-custom-id.ts
|
|
821
|
-
const DISCORD_QUESTION_CUSTOM_ID_MAX_CHARS = 100;
|
|
822
807
|
const QUESTION_RECORD_ID_PATTERN = /^ask_[a-f0-9]{32}$/u;
|
|
823
808
|
function buildDiscordQuestionCustomId(callback) {
|
|
824
809
|
if (!QUESTION_RECORD_ID_PATTERN.test(callback.questionId) || !Number.isInteger(callback.optionIndex) || callback.optionIndex < 0 || callback.optionIndex > 3) return;
|
|
825
|
-
|
|
826
|
-
return customId.length <= DISCORD_QUESTION_CUSTOM_ID_MAX_CHARS ? customId : void 0;
|
|
810
|
+
return `ocq:id=${callback.questionId};i=${callback.optionIndex}`;
|
|
827
811
|
}
|
|
828
812
|
function parseDiscordQuestionData(data) {
|
|
829
813
|
const questionId = typeof data.id === "string" ? data.id : "";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as runtime_doctor_migrations_exports } from "./runtime-doctor-migrations-
|
|
2
|
-
import { normalizeLegacyDmAliases } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
1
|
+
import { t as runtime_doctor_migrations_exports } from "./runtime-doctor-migrations-BPV-R4G9.mjs";
|
|
3
2
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
+
import { normalizeLegacyDmAliases } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
4
4
|
import { buildSecretInputSchema, registerSensitiveConfigSchema } from "openclaw/plugin-sdk/secret-input";
|
|
5
5
|
import { createChannelConfigUiHints } from "openclaw/plugin-sdk/channel-core";
|
|
6
|
-
import { ChannelBotLoopProtectionSchema, ChannelDangerouslyAllowNameMatchingSchema, ChannelPreviewStreamingConfigSchema,
|
|
6
|
+
import { ChannelBotLoopProtectionSchema, ChannelDangerouslyAllowNameMatchingSchema, ChannelPreviewStreamingConfigSchema, ChannelThreadBindingsSchema, ProviderCommandsSchema, TtsConfigSchema, buildChannelAccountSchemaParts, buildChannelAllowBotsSchema, buildChannelConfigSchema, buildChannelExecApprovalsSchema, buildChannelReactionShape, buildGroupEntrySchema, refineChannelDmPolicy } from "openclaw/plugin-sdk/channel-config-schema";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
//#region extensions/discord/src/config-ui-hints.ts
|
|
9
9
|
const discordChannelConfigUiHints = {
|
|
@@ -334,7 +334,6 @@ const discordChannelConfigUiHints = {
|
|
|
334
334
|
//#endregion
|
|
335
335
|
//#region extensions/discord/src/config-schema.ts
|
|
336
336
|
const SecretInputSchema = buildSecretInputSchema();
|
|
337
|
-
const DiscordPreviewStreamingConfigSchema = ChannelPreviewStreamingConfigSchema.extend({ progress: ChannelStreamingProgressSchema.optional() }).strict();
|
|
338
337
|
const DiscordIdSchema = z.union([z.string(), z.number()]).transform((value, ctx) => {
|
|
339
338
|
if (typeof value === "number") {
|
|
340
339
|
if (!Number.isSafeInteger(value) || value < 0) {
|
|
@@ -407,15 +406,11 @@ const DiscordGuildSchema = buildGroupEntrySchema({
|
|
|
407
406
|
"allowFrom",
|
|
408
407
|
"systemPrompt"
|
|
409
408
|
] });
|
|
410
|
-
const DiscordVoiceAutoJoinSchema = z.object({
|
|
411
|
-
guildId: z.string().min(1),
|
|
412
|
-
channelId: z.string().min(1),
|
|
413
|
-
whenOccupied: z.boolean().optional()
|
|
414
|
-
}).strict();
|
|
415
409
|
const DiscordVoiceAllowedChannelSchema = z.object({
|
|
416
410
|
guildId: z.string().min(1),
|
|
417
411
|
channelId: z.string().min(1)
|
|
418
412
|
}).strict();
|
|
413
|
+
const DiscordVoiceAutoJoinSchema = DiscordVoiceAllowedChannelSchema.extend({ whenOccupied: z.boolean().optional() });
|
|
419
414
|
const DiscordVoiceRealtimeToolPolicySchema = z.enum([
|
|
420
415
|
"safe-read-only",
|
|
421
416
|
"owner",
|
|
@@ -478,7 +473,7 @@ const DiscordVoiceSchema = z.object({
|
|
|
478
473
|
const { accountShape, rootPolicyShape } = buildChannelAccountSchemaParts({
|
|
479
474
|
omit: ["groupAllowFrom"],
|
|
480
475
|
allowFrom: DiscordIdListSchema.optional(),
|
|
481
|
-
streaming:
|
|
476
|
+
streaming: ChannelPreviewStreamingConfigSchema.optional()
|
|
482
477
|
});
|
|
483
478
|
const DiscordAccountSchemaBase = z.object({
|
|
484
479
|
...accountShape,
|
|
@@ -527,13 +522,7 @@ const DiscordAccountSchemaBase = z.object({
|
|
|
527
522
|
ttlMs: z.number().int().positive().max(864e5).optional()
|
|
528
523
|
}).strict().optional(),
|
|
529
524
|
slashCommand: z.object({ ephemeral: z.boolean().optional() }).strict().optional(),
|
|
530
|
-
threadBindings:
|
|
531
|
-
enabled: z.boolean().optional(),
|
|
532
|
-
idleHours: z.number().nonnegative().optional(),
|
|
533
|
-
maxAgeHours: z.number().nonnegative().optional(),
|
|
534
|
-
spawnSessions: z.boolean().optional(),
|
|
535
|
-
defaultSpawnContext: z.enum(["isolated", "fork"]).optional()
|
|
536
|
-
}).strict().optional(),
|
|
525
|
+
threadBindings: ChannelThreadBindingsSchema.optional(),
|
|
537
526
|
intents: z.object({
|
|
538
527
|
messageContent: z.boolean().optional(),
|
|
539
528
|
presence: z.boolean().optional(),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as shouldIgnoreStaleDiscordRouteBinding } from "./outbound-session-route-
|
|
1
|
+
import { m as shouldIgnoreStaleDiscordRouteBinding } from "./outbound-session-route-DGPPKA0z.mjs";
|
|
2
2
|
import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
3
3
|
import { resolveConfiguredBindingRoute, resolveRuntimeConversationBindingRoute } from "openclaw/plugin-sdk/conversation-binding-runtime";
|
|
4
4
|
//#region extensions/discord/src/monitor/conversation-binding-route.ts
|