@openclaw/discord 2026.10.2 → 2026.10.5-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/.setup/account-inspect-8cCu6uPG.mjs +31 -0
- package/dist/.setup/{accounts-HE9-mj1L.mjs → accounts-ljrzXBJi.mjs} +47 -45
- package/dist/.setup/{allow-list-vxkG9_JD.mjs → allow-list-B_ToXtew.mjs} +34 -101
- package/dist/.setup/{api-DlNUkDqj.mjs → api-CtmE1OUN.mjs} +25 -31
- package/dist/.setup/{approval-handler.runtime-DmnEa54W.mjs → approval-handler.runtime-D7FoZSn0.mjs} +30 -53
- package/dist/.setup/{approval-message-updates-B0jdSqOj.mjs → approval-message-updates-CIGByUcE.mjs} +2 -2
- package/dist/.setup/{audit-BpikUwN_.mjs → audit-zSawfbsN.mjs} +5 -8
- package/dist/.setup/{channel-Dr-AUnGt.mjs → channel-DI7DMzu0.mjs} +136 -215
- package/dist/.setup/{channel-access-BRp3Y-rF.mjs → channel-access-DasWY_OV.mjs} +6 -7
- package/dist/.setup/{channel.setup-BmNvkidb.mjs → channel.setup-DdFVN1mr.mjs} +35 -64
- package/dist/.setup/{components-DLJR0xU-.mjs → components-HN9052L1.mjs} +123 -146
- package/dist/.setup/{config-schema-BQWfnSCx.mjs → config-schema-_uBILpQf.mjs} +7 -3
- package/dist/.setup/{conversation-binding-route-DicJC1Lj.mjs → conversation-binding-route-DTjCBx-O.mjs} +1 -1
- package/dist/.setup/{directory-config-gqsdcplU.mjs → directory-config-3iVub-3m.mjs} +1 -1
- package/dist/.setup/{directory-live-Bipr0eUJ.mjs → directory-live-DLygQVtW.mjs} +18 -22
- package/dist/.setup/{discord-9gysrhzp.mjs → discord-BGqgx-yd.mjs} +686 -854
- package/dist/.setup/{doctor-B2bskDcF.mjs → doctor-DSrNJ7m2.mjs} +36 -47
- package/dist/.setup/{doctor-contract-Bg3NPAMw.mjs → doctor-contract-Bwv8EuQ_.mjs} +7 -16
- package/dist/.setup/{handle-action-UmkjXBfo.mjs → handle-action-CXH1h1tq.mjs} +25 -38
- package/dist/.setup/{handle-action.guild-admin-CB4sc9VV.mjs → handle-action.guild-admin-CHKW6PIs.mjs} +25 -31
- package/dist/.setup/{live-policy-config-VxexfRKo.mjs → live-policy-config-BPoB3eQi.mjs} +1 -1
- package/dist/.setup/{message-handler-BK69A-NB.mjs → message-handler-Ii_etru1.mjs} +9 -14
- package/dist/.setup/{message-handler.preflight-DFpsh90H.mjs → message-handler.preflight-C7YuSRl_.mjs} +79 -128
- package/dist/.setup/{message-handler.preflight-pluralkit-BXGGVmpe.mjs → message-handler.preflight-pluralkit-C3iAG--b.mjs} +6 -6
- package/dist/.setup/{message-handler.process-TKoqcqIP.mjs → message-handler.process-ClgWYH6o.mjs} +234 -206
- package/dist/.setup/{outbound-adapter-D4wRAb5S.mjs → outbound-adapter-D8OOIuKn.mjs} +73 -112
- package/dist/.setup/{outbound-session-route-BvBH4LC6.mjs → outbound-session-route-B0Hpwn3Q.mjs} +57 -115
- package/dist/.setup/output-activity-uBpMSX75.mjs +11 -0
- package/dist/.setup/{pluralkit-a6_NLfH9.mjs → pluralkit-B64dfq_j.mjs} +3 -1
- package/dist/.setup/{preflight-audio-DHGIHEpv.mjs → preflight-audio-wWgsZG5F.mjs} +1 -5
- package/dist/.setup/{presence-cache-Dg3_dADn.mjs → presence-cache-DCeTsL73.mjs} +3 -6
- package/dist/.setup/{probe-BwSKpnZf.mjs → probe-D3P1x4aN.mjs} +10 -18
- package/dist/.setup/{provider-YP8gN9_o.mjs → provider-D9EzOfG8.mjs} +2990 -3903
- package/dist/.setup/{provider-session.runtime-D1gkPxHT.mjs → provider-session.runtime-CsnRvddI.mjs} +5 -5
- package/dist/.setup/provider.runtime-BQVcM7Pg.mjs +2 -0
- package/dist/.setup/{realtime-session.runtime-BKUQBy1u.mjs → realtime-session.runtime-CxGBk8H-.mjs} +69 -98
- package/dist/.setup/{receive-recovery-DgkX7Qvi.mjs → receive-recovery-eVmK2_hl.mjs} +2 -12
- package/dist/.setup/resolve-allowlist-common-DNSsUQRF.mjs +66 -0
- package/dist/.setup/resolve-channels-UdT38DzU.mjs +173 -0
- package/dist/.setup/{resolve-users-DNrwvunm.mjs → resolve-users-DnCsrXZ_.mjs} +12 -41
- package/dist/.setup/{runtime-CESTexGn.mjs → runtime-CRTkKU1G.mjs} +202 -313
- package/dist/.setup/{runtime-DPcmPST9.mjs → runtime-DPm3gZXk.mjs} +2 -2
- package/dist/.setup/{secret-config-contract-uOE2J7yM.mjs → secret-config-contract-CIsH7R3B.mjs} +9 -18
- package/dist/.setup/{security-audit-D42cp5N7.mjs → security-audit-BFT84Uny.mjs} +1 -2
- package/dist/.setup/security-contract-DNyyjTZZ.mjs +19 -0
- package/dist/.setup/{send-CJk3VP5q.mjs → send-DbILKgcm.mjs} +184 -241
- package/dist/.setup/{send.components-dPljuV24.mjs → send.components-FxOS3CeP.mjs} +47 -63
- package/dist/.setup/{send.outbound-rOboMO_6.mjs → send.outbound-_jx4Xpd3.mjs} +178 -202
- package/dist/.setup/{send.receipt-DVOg2Oaw.mjs → send.receipt-BAlzXd8e.mjs} +33 -109
- package/dist/.setup/{send.shared-C4CN24D9.mjs → send.shared-CjQ4jbMA.mjs} +97 -153
- package/dist/.setup/{sender-identity-AHpUNr72.mjs → sender-identity-BNBvGt1l.mjs} +1 -1
- package/dist/.setup/setup-plugin-api-xfOFmxHP.mjs +3 -0
- package/dist/.setup/{shared-BoBnM5kM.mjs → shared-CestGDpq.mjs} +30 -20
- package/dist/.setup/{subagent-hooks-HH8Uy9cx.mjs → subagent-hooks-CME7dSGf.mjs} +5 -10
- package/dist/.setup/{system-events-Cwxaww8i.mjs → system-events-BwwSDCw4.mjs} +2 -2
- package/dist/.setup/target-parsing-C-HyNxcE.mjs +48 -0
- package/dist/.setup/{target-resolver-CSFoPQ12.mjs → target-resolver-Bse8fuTi.mjs} +11 -27
- package/dist/.setup/targets-DZJjkzwv.mjs +3 -0
- package/dist/.setup/{thread-bindings-DjQCkmsd.mjs → thread-bindings-0hPTSK14.mjs} +61 -52
- package/dist/.setup/{thread-bindings.manager-D2-GYZ5s.mjs → thread-bindings.manager-CdNa6UIs.mjs} +138 -211
- package/dist/.setup/{thread-bindings.session-updates-Bu_CGr_O.mjs → thread-bindings.session-updates-DGSljVf6.mjs} +60 -99
- package/dist/.setup/threading-BKe3E3tp.mjs +246 -0
- package/dist/.setup/{timeouts-pun7VJ02.mjs → timeouts-CuNARfyw.mjs} +10 -18
- package/dist/.setup/{transcripts-source-CaZQnGRH.mjs → transcripts-source-0qQYVu2H.mjs} +50 -368
- package/dist/.setup/{voice-runtime-DDymtIw8.mjs → voice-runtime-QlZJ4sHv.mjs} +166 -322
- package/dist/account-inspect-api.js +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/activities-api.js +77 -120
- package/dist/api.js +19 -18
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/runtime-api.js +21 -20
- package/dist/secret-contract-api.js +1 -1
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/src/voice/audio-worker.runtime.js +38 -57
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/crypto.d.ts +2 -2
- package/node_modules/@types/node/dgram.d.ts +1 -1
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/zlib.d.ts +6 -0
- package/node_modules/@types/ws/README.md +1 -1
- package/node_modules/@types/ws/index.d.mts +4 -0
- package/node_modules/@types/ws/index.d.ts +4 -0
- package/node_modules/@types/ws/package.json +3 -3
- package/node_modules/discord-api-types/_generated_/rest/v10/interfaces.d.ts +21 -0
- package/node_modules/discord-api-types/_generated_/rest/v10/interfaces.d.ts.map +1 -1
- package/node_modules/discord-api-types/_generated_/rest/v9/interfaces.d.ts +21 -0
- package/node_modules/discord-api-types/_generated_/rest/v9/interfaces.d.ts.map +1 -1
- package/node_modules/discord-api-types/globals.d.ts +6 -0
- package/node_modules/discord-api-types/globals.d.ts.map +1 -1
- package/node_modules/discord-api-types/globals.js +6 -0
- package/node_modules/discord-api-types/globals.js.map +1 -1
- package/node_modules/discord-api-types/package.json +3 -3
- package/node_modules/discord-api-types/payloads/index.mjs +1 -0
- package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.d.ts +207 -0
- package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.d.ts.map +1 -0
- package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.js +25 -0
- package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.js.map +1 -0
- package/node_modules/discord-api-types/payloads/v10/autoModeration.d.ts +1 -1
- package/node_modules/discord-api-types/payloads/v10/autoModeration.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/guild.d.ts +27 -23
- package/node_modules/discord-api-types/payloads/v10/guild.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/guild.js +26 -22
- package/node_modules/discord-api-types/payloads/v10/guild.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/index.d.ts +1 -0
- package/node_modules/discord-api-types/payloads/v10/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/index.js +1 -0
- package/node_modules/discord-api-types/payloads/v10/index.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/index.mjs +1 -0
- package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.d.ts +207 -0
- package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.d.ts.map +1 -0
- package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.js +25 -0
- package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.js.map +1 -0
- package/node_modules/discord-api-types/payloads/v9/autoModeration.d.ts +1 -1
- package/node_modules/discord-api-types/payloads/v9/autoModeration.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/guild.d.ts +27 -23
- package/node_modules/discord-api-types/payloads/v9/guild.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/guild.js +26 -22
- package/node_modules/discord-api-types/payloads/v9/guild.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/index.d.ts +1 -0
- package/node_modules/discord-api-types/payloads/v9/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/index.js +1 -0
- package/node_modules/discord-api-types/payloads/v9/index.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/index.mjs +1 -0
- package/node_modules/discord-api-types/rest/common.d.ts +2 -0
- package/node_modules/discord-api-types/rest/common.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/common.js +2 -0
- package/node_modules/discord-api-types/rest/common.js.map +1 -1
- package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.d.ts +70 -0
- package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.d.ts.map +1 -0
- package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.js +3 -0
- package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.js.map +1 -0
- package/node_modules/discord-api-types/rest/v10/index.d.ts +1 -0
- package/node_modules/discord-api-types/rest/v10/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v10/index.js +29 -0
- package/node_modules/discord-api-types/rest/v10/index.js.map +1 -1
- package/node_modules/discord-api-types/rest/v10/interactions.d.ts +4 -2
- package/node_modules/discord-api-types/rest/v10/interactions.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v10/user.d.ts +2 -2
- package/node_modules/discord-api-types/rest/v10/user.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.d.ts +70 -0
- package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.d.ts.map +1 -0
- package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.js +3 -0
- package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.js.map +1 -0
- package/node_modules/discord-api-types/rest/v9/index.d.ts +1 -0
- package/node_modules/discord-api-types/rest/v9/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v9/index.js +29 -0
- package/node_modules/discord-api-types/rest/v9/index.js.map +1 -1
- package/node_modules/discord-api-types/rest/v9/interactions.d.ts +4 -2
- package/node_modules/discord-api-types/rest/v9/interactions.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v9/user.d.ts +2 -2
- package/node_modules/discord-api-types/rest/v9/user.d.ts.map +1 -1
- package/node_modules/discord-api-types/v10.mjs +1 -0
- package/node_modules/discord-api-types/v9.mjs +1 -0
- package/node_modules/micromark/dev/lib/compile.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/compile.js +14 -4
- package/node_modules/micromark/dev/lib/create-tokenizer.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/create-tokenizer.js +7 -6
- package/node_modules/micromark/dev/lib/initialize/document.js +25 -21
- package/node_modules/micromark/dev/lib/initialize/text.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/initialize/text.js +10 -6
- package/node_modules/micromark/dev/lib/preprocess.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/preprocess.js +19 -21
- package/node_modules/micromark/lib/compile.d.ts.map +1 -1
- package/node_modules/micromark/lib/compile.js +37 -29
- package/node_modules/micromark/lib/create-tokenizer.d.ts.map +1 -1
- package/node_modules/micromark/lib/create-tokenizer.js +37 -35
- package/node_modules/micromark/lib/initialize/document.js +21 -13
- package/node_modules/micromark/lib/initialize/text.d.ts.map +1 -1
- package/node_modules/micromark/lib/initialize/text.js +7 -3
- package/node_modules/micromark/lib/preprocess.d.ts.map +1 -1
- package/node_modules/micromark/lib/preprocess.js +16 -19
- package/node_modules/micromark/package.json +2 -15
- package/node_modules/micromark-core-commonmark/dev/lib/attention.js +18 -24
- package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.js +1 -43
- package/node_modules/micromark-core-commonmark/dev/lib/code-indented.js +19 -43
- package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.js +2 -6
- package/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/html-flow.js +2 -53
- package/node_modules/micromark-core-commonmark/dev/lib/label-end.js +14 -12
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.js +14 -5
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.js +14 -5
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts +4 -0
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts.map +1 -0
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.js +67 -0
- package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.js +8 -5
- package/node_modules/micromark-core-commonmark/lib/attention.js +14 -24
- package/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/code-fenced.js +1 -39
- package/node_modules/micromark-core-commonmark/lib/code-indented.js +11 -29
- package/node_modules/micromark-core-commonmark/lib/heading-atx.js +2 -6
- package/node_modules/micromark-core-commonmark/lib/html-flow.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/html-flow.js +2 -51
- package/node_modules/micromark-core-commonmark/lib/label-end.js +11 -10
- package/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/label-start-image.js +11 -3
- package/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/label-start-link.js +11 -3
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts +4 -0
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts.map +1 -0
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js +61 -0
- package/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/setext-underline.js +7 -5
- package/node_modules/micromark-core-commonmark/package.json +4 -16
- package/node_modules/micromark-factory-space/dev/index.d.ts +24 -1
- package/node_modules/micromark-factory-space/dev/index.d.ts.map +1 -1
- package/node_modules/micromark-factory-space/dev/index.js +58 -3
- package/node_modules/micromark-factory-space/index.d.ts +24 -1
- package/node_modules/micromark-factory-space/index.d.ts.map +1 -1
- package/node_modules/micromark-factory-space/index.js +55 -3
- package/node_modules/micromark-factory-space/package.json +1 -10
- package/node_modules/micromark-factory-space/readme.md +25 -25
- package/node_modules/micromark-util-edit-map/dev/index.d.ts +78 -0
- package/node_modules/micromark-util-edit-map/dev/index.d.ts.map +1 -0
- package/node_modules/micromark-util-edit-map/dev/index.js +237 -0
- package/node_modules/micromark-util-edit-map/index.d.ts +78 -0
- package/node_modules/micromark-util-edit-map/index.d.ts.map +1 -0
- package/node_modules/micromark-util-edit-map/index.js +225 -0
- package/node_modules/micromark-util-edit-map/license +22 -0
- package/node_modules/micromark-util-edit-map/package.json +48 -0
- package/node_modules/micromark-util-edit-map/readme.md +234 -0
- package/node_modules/micromark-util-types/index.d.ts +6 -3
- package/node_modules/micromark-util-types/package.json +2 -36
- package/node_modules/ws/lib/websocket.js +17 -3
- package/node_modules/ws/package.json +1 -1
- package/openclaw.plugin.json +3 -6
- package/package.json +7 -12
- package/dist/.setup/account-inspect-DsER5ILV.mjs +0 -45
- package/dist/.setup/provider.runtime-CZ51OIgD.mjs +0 -2
- package/dist/.setup/resolve-allowlist-common-BUyU3C-T.mjs +0 -27
- package/dist/.setup/resolve-channels-DA6QlhZN.mjs +0 -246
- package/dist/.setup/security-contract-DSHk7I2w.mjs +0 -26
- package/dist/.setup/setup-plugin-api-BVlCz3fm.mjs +0 -3
- package/dist/.setup/targets-bqXQENmX.mjs +0 -3
- package/dist/control-ui/2afbdab1d3aa65a789d8a3eba666f4b1ec5df07073538fe30d6cf32093a1fb2d/index.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString, readNonBlankString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
+
import { A as StringSelectMenu, C as LinkButton, D as Row, E as RoleSelectMenu, M as Thumbnail, N as UserSelectMenu, O as Section, S as File, T as MentionableSelectMenu, _ as TextInput, b as ChannelSelectMenu, bt as stripUndefinedFields, et as parseCustomId, g as RadioGroup, h as Modal, j as TextDisplay, k as Separator, m as Label, p as CheckboxGroup, v as AnySelectMenu, w as MediaGallery, x as Container, y as Button } from "./discord-BGqgx-yd.mjs";
|
|
3
|
+
import { asBoolean, asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString, readNonBlankString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { ButtonStyle, MessageFlags, TextInputStyle } from "discord-api-types/v10";
|
|
5
5
|
import { resolveAskUserQuestionOptionIndex } from "openclaw/plugin-sdk/reply-payload";
|
|
6
6
|
import crypto from "node:crypto";
|
|
@@ -13,9 +13,7 @@ import { buildApprovalResolutionRef } from "openclaw/plugin-sdk/approval-referen
|
|
|
13
13
|
* Decode falls back to the raw value: Discord redelivers old component ids
|
|
14
14
|
* indefinitely and historical values may predate strict encoding.
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
return encodeURIComponent(value);
|
|
18
|
-
}
|
|
16
|
+
const encodeCustomIdComponent = encodeURIComponent;
|
|
19
17
|
function decodeCustomIdComponent(value) {
|
|
20
18
|
try {
|
|
21
19
|
return decodeURIComponent(value);
|
|
@@ -71,16 +69,19 @@ function decodeParsedCustomIdData(data) {
|
|
|
71
69
|
if (data.e !== ENCODED_CUSTOM_ID_VERSION) return data;
|
|
72
70
|
return Object.fromEntries(Object.entries(data).map(([key, value]) => [key, typeof value === "string" ? unescapeCustomIdFieldValue(value) : value]));
|
|
73
71
|
}
|
|
72
|
+
function buildDiscordFieldCustomId(key, fields) {
|
|
73
|
+
const encoded = Object.values(fields).some(needsCustomIdFieldEscaping);
|
|
74
|
+
const parts = Object.entries(fields).map(([name, value]) => `${name}=${encoded ? escapeCustomIdFieldValue(value) : value}`);
|
|
75
|
+
return (encoded ? `${key}:e=${ENCODED_CUSTOM_ID_VERSION};` : `${key}:`) + parts.join(";");
|
|
76
|
+
}
|
|
74
77
|
function buildDiscordComponentCustomId(params) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (!modalId) return base;
|
|
80
|
-
return `${base};mid=${encoded ? escapeCustomIdFieldValue(modalId) : modalId}`;
|
|
78
|
+
return buildDiscordFieldCustomId(DISCORD_COMPONENT_CUSTOM_ID_KEY, {
|
|
79
|
+
cid: params.componentId,
|
|
80
|
+
...params.modalId ? { mid: params.modalId } : {}
|
|
81
|
+
});
|
|
81
82
|
}
|
|
82
83
|
function buildDiscordModalCustomId(modalId) {
|
|
83
|
-
return
|
|
84
|
+
return buildDiscordFieldCustomId(DISCORD_MODAL_CUSTOM_ID_KEY, { mid: modalId });
|
|
84
85
|
}
|
|
85
86
|
function parseDiscordComponentCustomId(id) {
|
|
86
87
|
const parsed = parseCustomId(id);
|
|
@@ -98,11 +99,8 @@ function parseDiscordModalCustomId(id) {
|
|
|
98
99
|
if (parsed.key !== "ocmodal") return null;
|
|
99
100
|
return readNonBlankString(decodeParsedCustomIdData(parsed.data).mid) ?? null;
|
|
100
101
|
}
|
|
101
|
-
function isDiscordComponentWildcardRegistrationId(id) {
|
|
102
|
-
return /^__openclaw_discord_component_[a-z_]+_wildcard__$/.test(id);
|
|
103
|
-
}
|
|
104
102
|
function parseDiscordCustomIdForInteraction(id, key) {
|
|
105
|
-
if (id === "*" ||
|
|
103
|
+
if (id === "*" || /^__openclaw_discord_component_[a-z_]+_wildcard__$/.test(id)) return {
|
|
106
104
|
key: "*",
|
|
107
105
|
data: {}
|
|
108
106
|
};
|
|
@@ -134,17 +132,29 @@ function readRequiredString(value, label, trim = true) {
|
|
|
134
132
|
if (!trimmed) throw new Error(`${label} cannot be empty`);
|
|
135
133
|
return trim ? trimmed : value;
|
|
136
134
|
}
|
|
137
|
-
function
|
|
138
|
-
const
|
|
139
|
-
if (
|
|
140
|
-
|
|
141
|
-
throw new Error(`${label} must be one of command, callback`);
|
|
135
|
+
function readEnum(value, label, values) {
|
|
136
|
+
const match = values.find((candidate) => candidate === value);
|
|
137
|
+
if (match !== void 0) return match;
|
|
138
|
+
throw new Error(`${label} must be one of ${values.join(", ")}`);
|
|
142
139
|
}
|
|
143
|
-
function
|
|
140
|
+
function readOptionalEnum(value, label, values) {
|
|
141
|
+
const normalized = normalizeOptionalString(value);
|
|
142
|
+
return normalized === void 0 ? void 0 : readEnum(normalized, label, values);
|
|
143
|
+
}
|
|
144
|
+
function readCallbackDataKind(value, label) {
|
|
145
|
+
return readOptionalEnum(value, label, ["command", "callback"]);
|
|
146
|
+
}
|
|
147
|
+
function readOptionalArray(value, label, readEntry, nonArray = "reject") {
|
|
144
148
|
if (value === void 0) return;
|
|
145
|
-
if (!Array.isArray(value))
|
|
146
|
-
|
|
147
|
-
|
|
149
|
+
if (!Array.isArray(value)) {
|
|
150
|
+
if (nonArray === "ignore") return;
|
|
151
|
+
throw new Error(`${label} must be an array`);
|
|
152
|
+
}
|
|
153
|
+
return value.map((entry, index) => readEntry(entry, `${label}[${index}]`));
|
|
154
|
+
}
|
|
155
|
+
function readOptionalStringArray(value, label) {
|
|
156
|
+
const entries = readOptionalArray(value, label, readRequiredString);
|
|
157
|
+
return entries?.length ? entries : void 0;
|
|
148
158
|
}
|
|
149
159
|
function readOptionalInteger(value, label, bounds) {
|
|
150
160
|
if (value == null) return;
|
|
@@ -159,7 +169,7 @@ function readOptionalEmoji(value, label) {
|
|
|
159
169
|
return {
|
|
160
170
|
name: readRequiredString(obj.name, `${label}.name`),
|
|
161
171
|
id: normalizeOptionalString(obj.id),
|
|
162
|
-
animated:
|
|
172
|
+
animated: asBoolean(obj.animated)
|
|
163
173
|
};
|
|
164
174
|
}
|
|
165
175
|
function normalizeModalFieldName(value, index) {
|
|
@@ -175,29 +185,27 @@ function readAttachmentName(value, label, filenameLabel = "a filename") {
|
|
|
175
185
|
function resolveDiscordComponentAttachmentName(value) {
|
|
176
186
|
return readAttachmentName(value, "Attachment reference");
|
|
177
187
|
}
|
|
188
|
+
const buttonStyles = /* @__PURE__ */ new Map([
|
|
189
|
+
["secondary", ButtonStyle.Secondary],
|
|
190
|
+
["success", ButtonStyle.Success],
|
|
191
|
+
["danger", ButtonStyle.Danger],
|
|
192
|
+
["link", ButtonStyle.Link]
|
|
193
|
+
]);
|
|
178
194
|
function mapButtonStyle(style) {
|
|
179
|
-
|
|
180
|
-
case "secondary": return ButtonStyle.Secondary;
|
|
181
|
-
case "success": return ButtonStyle.Success;
|
|
182
|
-
case "danger": return ButtonStyle.Danger;
|
|
183
|
-
case "link": return ButtonStyle.Link;
|
|
184
|
-
default: return ButtonStyle.Primary;
|
|
185
|
-
}
|
|
195
|
+
return buttonStyles.get(normalizeLowercaseStringOrEmpty(style ?? "primary")) ?? ButtonStyle.Primary;
|
|
186
196
|
}
|
|
187
197
|
function mapTextInputStyle(style) {
|
|
188
198
|
return style === "paragraph" ? TextInputStyle.Paragraph : TextInputStyle.Short;
|
|
189
199
|
}
|
|
190
200
|
function parseSelectOptions(raw, label) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
return raw.map((entry, index) => {
|
|
194
|
-
const obj = requireObject(entry, `${label}[${index}]`);
|
|
201
|
+
return readOptionalArray(raw, label, (entry, entryLabel) => {
|
|
202
|
+
const obj = requireObject(entry, entryLabel);
|
|
195
203
|
return {
|
|
196
|
-
label: readRequiredString(obj.label, `${
|
|
197
|
-
value: readRequiredString(obj.value, `${
|
|
204
|
+
label: readRequiredString(obj.label, `${entryLabel}.label`),
|
|
205
|
+
value: readRequiredString(obj.value, `${entryLabel}.value`),
|
|
198
206
|
description: normalizeOptionalString(obj.description),
|
|
199
|
-
emoji: readOptionalEmoji(obj.emoji, `${
|
|
200
|
-
default:
|
|
207
|
+
emoji: readOptionalEmoji(obj.emoji, `${entryLabel}.emoji`),
|
|
208
|
+
default: asBoolean(obj.default)
|
|
201
209
|
};
|
|
202
210
|
});
|
|
203
211
|
}
|
|
@@ -211,28 +219,25 @@ function parseButtonSpec(raw, label) {
|
|
|
211
219
|
style,
|
|
212
220
|
url,
|
|
213
221
|
callbackData: normalizeOptionalString(obj.callbackData),
|
|
214
|
-
callbackDataKind:
|
|
222
|
+
callbackDataKind: readCallbackDataKind(obj.callbackDataKind, `${label}.callbackDataKind`),
|
|
215
223
|
emoji: readOptionalEmoji(obj.emoji, `${label}.emoji`),
|
|
216
|
-
disabled:
|
|
217
|
-
reusable:
|
|
224
|
+
disabled: asBoolean(obj.disabled),
|
|
225
|
+
reusable: asBoolean(obj.reusable),
|
|
218
226
|
allowedUsers: readOptionalStringArray(obj.allowedUsers, `${label}.allowedUsers`)
|
|
219
227
|
};
|
|
220
228
|
}
|
|
221
229
|
function parseSelectSpec(raw, label) {
|
|
222
230
|
const obj = requireObject(raw, label);
|
|
223
|
-
const type = normalizeOptionalString(obj.type);
|
|
224
|
-
const allowedTypes = [
|
|
225
|
-
"string",
|
|
226
|
-
"user",
|
|
227
|
-
"role",
|
|
228
|
-
"mentionable",
|
|
229
|
-
"channel"
|
|
230
|
-
];
|
|
231
|
-
if (type && !allowedTypes.includes(type)) throw new Error(`${label}.type must be one of ${allowedTypes.join(", ")}`);
|
|
232
231
|
return {
|
|
233
|
-
type,
|
|
232
|
+
type: readOptionalEnum(obj.type, `${label}.type`, [
|
|
233
|
+
"string",
|
|
234
|
+
"user",
|
|
235
|
+
"role",
|
|
236
|
+
"mentionable",
|
|
237
|
+
"channel"
|
|
238
|
+
]),
|
|
234
239
|
callbackData: normalizeOptionalString(obj.callbackData),
|
|
235
|
-
callbackDataKind:
|
|
240
|
+
callbackDataKind: readCallbackDataKind(obj.callbackDataKind, `${label}.callbackDataKind`),
|
|
236
241
|
placeholder: normalizeOptionalString(obj.placeholder),
|
|
237
242
|
minValues: readOptionalInteger(obj.minValues, `${label}.minValues`, {
|
|
238
243
|
min: 0,
|
|
@@ -248,16 +253,14 @@ function parseSelectSpec(raw, label) {
|
|
|
248
253
|
}
|
|
249
254
|
function parseModalField(raw, label, index) {
|
|
250
255
|
const obj = requireObject(raw, label);
|
|
251
|
-
const type = normalizeLowercaseStringOrEmpty(readRequiredString(obj.type, `${label}.type`))
|
|
252
|
-
const supported = [
|
|
256
|
+
const type = readEnum(normalizeLowercaseStringOrEmpty(readRequiredString(obj.type, `${label}.type`)), `${label}.type`, [
|
|
253
257
|
"text",
|
|
254
258
|
"checkbox",
|
|
255
259
|
"radio",
|
|
256
260
|
"select",
|
|
257
261
|
"role-select",
|
|
258
262
|
"user-select"
|
|
259
|
-
];
|
|
260
|
-
if (!supported.includes(type)) throw new Error(`${label}.type must be one of ${supported.join(", ")}`);
|
|
263
|
+
]);
|
|
261
264
|
const options = parseSelectOptions(obj.options, `${label}.options`);
|
|
262
265
|
if ([
|
|
263
266
|
"checkbox",
|
|
@@ -265,7 +268,7 @@ function parseModalField(raw, label, index) {
|
|
|
265
268
|
"select"
|
|
266
269
|
].includes(type) && (!options || options.length === 0)) throw new Error(`${label}.options is required for ${type} fields`);
|
|
267
270
|
if (type === "radio" && (obj.minValues != null || obj.maxValues != null)) throw new Error(`${label}.minValues/maxValues are not supported for radio fields`);
|
|
268
|
-
const required =
|
|
271
|
+
const required = asBoolean(obj.required);
|
|
269
272
|
const maxValues = type === "checkbox" ? 10 : 25;
|
|
270
273
|
return {
|
|
271
274
|
type,
|
|
@@ -304,8 +307,7 @@ function parseComponentBlock(raw, label) {
|
|
|
304
307
|
};
|
|
305
308
|
case "section": {
|
|
306
309
|
const text = readNonBlankString(obj.text);
|
|
307
|
-
const
|
|
308
|
-
const texts = Array.isArray(textsRaw) ? textsRaw.map((entry, idx) => readRequiredString(entry, `${label}.texts[${idx}]`, false)) : void 0;
|
|
310
|
+
const texts = readOptionalArray(obj.texts, `${label}.texts`, (entry, entryLabel) => readRequiredString(entry, entryLabel, false), "ignore");
|
|
309
311
|
if (!text && (!texts || texts.length === 0)) throw new Error(`${label}.text or ${label}.texts is required for section blocks`);
|
|
310
312
|
let accessory;
|
|
311
313
|
if (obj.accessory !== void 0) {
|
|
@@ -334,12 +336,11 @@ function parseComponentBlock(raw, label) {
|
|
|
334
336
|
return {
|
|
335
337
|
type: "separator",
|
|
336
338
|
spacing: spacingRaw,
|
|
337
|
-
divider:
|
|
339
|
+
divider: asBoolean(obj.divider)
|
|
338
340
|
};
|
|
339
341
|
}
|
|
340
342
|
case "actions": {
|
|
341
|
-
const
|
|
342
|
-
const buttons = Array.isArray(buttonsRaw) ? buttonsRaw.map((entry, idx) => parseButtonSpec(entry, `${label}.buttons[${idx}]`)) : void 0;
|
|
343
|
+
const buttons = readOptionalArray(obj.buttons, `${label}.buttons`, parseButtonSpec, "ignore");
|
|
343
344
|
const select = obj.select ? parseSelectSpec(obj.select, `${label}.select`) : void 0;
|
|
344
345
|
if ((!buttons || buttons.length === 0) && !select) throw new Error(`${label} requires buttons or select`);
|
|
345
346
|
if (buttons && select) throw new Error(`${label} cannot include both buttons and select`);
|
|
@@ -359,7 +360,7 @@ function parseComponentBlock(raw, label) {
|
|
|
359
360
|
return {
|
|
360
361
|
url: readRequiredString(itemObj.url, `${label}.items[${idx}].url`),
|
|
361
362
|
description: normalizeOptionalString(itemObj.description),
|
|
362
|
-
spoiler:
|
|
363
|
+
spoiler: asBoolean(itemObj.spoiler)
|
|
363
364
|
};
|
|
364
365
|
})
|
|
365
366
|
};
|
|
@@ -369,7 +370,7 @@ function parseComponentBlock(raw, label) {
|
|
|
369
370
|
return {
|
|
370
371
|
type: "file",
|
|
371
372
|
file: `${DISCORD_COMPONENT_ATTACHMENT_PREFIX}${readAttachmentName(file, `${label}.file`, "an attachment filename")}`,
|
|
372
|
-
spoiler:
|
|
373
|
+
spoiler: asBoolean(obj.spoiler)
|
|
373
374
|
};
|
|
374
375
|
}
|
|
375
376
|
default: throw new Error(`${label}.type must be a supported component block`);
|
|
@@ -386,8 +387,7 @@ function coerceDiscordComponentParam(raw) {
|
|
|
386
387
|
function readDiscordComponentSpec(raw) {
|
|
387
388
|
if (raw === void 0 || raw === null) return null;
|
|
388
389
|
const obj = requireObject(raw, "components");
|
|
389
|
-
const
|
|
390
|
-
const blocks = Array.isArray(blocksRaw) ? blocksRaw.map((entry, idx) => parseComponentBlock(entry, `components.blocks[${idx}]`)) : void 0;
|
|
390
|
+
const blocks = readOptionalArray(obj.blocks, "components.blocks", parseComponentBlock, "ignore");
|
|
391
391
|
const modalRaw = obj.modal;
|
|
392
392
|
let modal;
|
|
393
393
|
if (modalRaw !== void 0) {
|
|
@@ -408,10 +408,10 @@ function readDiscordComponentSpec(raw) {
|
|
|
408
408
|
const container = asOptionalRecord(obj.container);
|
|
409
409
|
return {
|
|
410
410
|
text: readNonBlankString(obj.text),
|
|
411
|
-
reusable:
|
|
411
|
+
reusable: asBoolean(obj.reusable),
|
|
412
412
|
container: container ? {
|
|
413
413
|
accentColor: container.accentColor,
|
|
414
|
-
spoiler:
|
|
414
|
+
spoiler: asBoolean(container.spoiler)
|
|
415
415
|
} : void 0,
|
|
416
416
|
blocks,
|
|
417
417
|
modal
|
|
@@ -478,7 +478,7 @@ function createButtonComponent(params) {
|
|
|
478
478
|
}
|
|
479
479
|
return { component: new DynamicLinkButton() };
|
|
480
480
|
}
|
|
481
|
-
const componentId =
|
|
481
|
+
const componentId = createShortId("btn_");
|
|
482
482
|
const internalCustomId = typeof params.spec.internalCustomId === "string" && params.spec.internalCustomId.trim() ? params.spec.internalCustomId.trim() : void 0;
|
|
483
483
|
const customId = internalCustomId ?? buildDiscordComponentCustomId({
|
|
484
484
|
componentId,
|
|
@@ -511,7 +511,7 @@ function createButtonComponent(params) {
|
|
|
511
511
|
}
|
|
512
512
|
function createSelectComponent(params) {
|
|
513
513
|
const type = normalizeLowercaseStringOrEmpty(params.spec.type ?? "string");
|
|
514
|
-
const componentId =
|
|
514
|
+
const componentId = createShortId("sel_");
|
|
515
515
|
const customId = buildDiscordComponentCustomId({ componentId });
|
|
516
516
|
const options = params.spec.options ?? [];
|
|
517
517
|
if (type === "string" && options.length === 0) throw new Error("String select menus require options");
|
|
@@ -519,7 +519,6 @@ function createSelectComponent(params) {
|
|
|
519
519
|
select.minValues = params.spec.minValues;
|
|
520
520
|
select.maxValues = params.spec.maxValues;
|
|
521
521
|
select.placeholder = params.spec.placeholder;
|
|
522
|
-
select.disabled = false;
|
|
523
522
|
return {
|
|
524
523
|
component: select,
|
|
525
524
|
entry: stripUndefinedFields({
|
|
@@ -559,6 +558,12 @@ function buildDiscordComponentMessage(params) {
|
|
|
559
558
|
consumptionGroupId
|
|
560
559
|
});
|
|
561
560
|
};
|
|
561
|
+
const buildButton = (options, row) => {
|
|
562
|
+
const { component, entry } = createButtonComponent(options);
|
|
563
|
+
row?.push(component);
|
|
564
|
+
if (entry) addEntry(entry);
|
|
565
|
+
return component;
|
|
566
|
+
};
|
|
562
567
|
const text = params.spec.text ?? params.fallbackText;
|
|
563
568
|
if (text) containerChildren.push(new TextDisplay(text));
|
|
564
569
|
for (const block of params.spec.blocks ?? []) {
|
|
@@ -571,11 +576,7 @@ function buildDiscordComponentMessage(params) {
|
|
|
571
576
|
if (displays.length > 3) throw new Error("Section blocks support up to 3 text displays");
|
|
572
577
|
let accessory;
|
|
573
578
|
if (block.accessory?.type === "thumbnail") accessory = new Thumbnail(block.accessory.url);
|
|
574
|
-
else if (block.accessory?.type === "button") {
|
|
575
|
-
const { component, entry } = createButtonComponent({ spec: block.accessory.button });
|
|
576
|
-
accessory = component;
|
|
577
|
-
if (entry) addEntry(entry);
|
|
578
|
-
}
|
|
579
|
+
else if (block.accessory?.type === "button") accessory = buildButton({ spec: block.accessory.button });
|
|
579
580
|
containerChildren.push(new Section(displays, accessory));
|
|
580
581
|
continue;
|
|
581
582
|
}
|
|
@@ -598,11 +599,7 @@ function buildDiscordComponentMessage(params) {
|
|
|
598
599
|
const rowComponents = [];
|
|
599
600
|
if (block.buttons) {
|
|
600
601
|
if (block.buttons.length > 5) throw new Error("Action rows support up to 5 buttons");
|
|
601
|
-
for (const button of block.buttons) {
|
|
602
|
-
const { component, entry } = createButtonComponent({ spec: button });
|
|
603
|
-
rowComponents.push(component);
|
|
604
|
-
if (entry) addEntry(entry);
|
|
605
|
-
}
|
|
602
|
+
for (const button of block.buttons) buildButton({ spec: button }, rowComponents);
|
|
606
603
|
} else if (block.select) {
|
|
607
604
|
const { component, entry } = createSelectComponent({ spec: block.select });
|
|
608
605
|
rowComponents.push(component);
|
|
@@ -639,7 +636,7 @@ function buildDiscordComponentMessage(params) {
|
|
|
639
636
|
reusable: params.spec.reusable,
|
|
640
637
|
allowedUsers: params.spec.modal.allowedUsers
|
|
641
638
|
}));
|
|
642
|
-
const
|
|
639
|
+
const component = buildButton({
|
|
643
640
|
spec: {
|
|
644
641
|
label: params.spec.modal.triggerLabel ?? "Open form",
|
|
645
642
|
style: params.spec.modal.triggerStyle ?? "primary",
|
|
@@ -647,7 +644,6 @@ function buildDiscordComponentMessage(params) {
|
|
|
647
644
|
},
|
|
648
645
|
modalId
|
|
649
646
|
});
|
|
650
|
-
if (entry) addEntry(entry);
|
|
651
647
|
const lastChild = containerChildren.at(-1);
|
|
652
648
|
if (lastChild instanceof Row && lastChild.components.length < 5 && !lastChild.components.some((child) => child instanceof AnySelectMenu)) lastChild.addComponent(component);
|
|
653
649
|
else containerChildren.push(new Row([component]));
|
|
@@ -690,30 +686,24 @@ function createModalFieldComponent(field) {
|
|
|
690
686
|
select.placeholder = field.placeholder;
|
|
691
687
|
return select;
|
|
692
688
|
}
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
super(..._args2);
|
|
698
|
-
this.customId = field.id;
|
|
699
|
-
this.options = options;
|
|
700
|
-
this.required = field.required;
|
|
701
|
-
this.minValues = field.minValues;
|
|
702
|
-
this.maxValues = field.maxValues;
|
|
703
|
-
}
|
|
689
|
+
const group = field.type === "checkbox" ? new class extends CheckboxGroup {
|
|
690
|
+
constructor(..._args2) {
|
|
691
|
+
super(..._args2);
|
|
692
|
+
this.customId = field.id;
|
|
704
693
|
}
|
|
705
|
-
|
|
706
|
-
}
|
|
707
|
-
const options = field.options ?? [];
|
|
708
|
-
class DynamicRadioGroup extends RadioGroup {
|
|
694
|
+
}() : new class extends RadioGroup {
|
|
709
695
|
constructor(..._args3) {
|
|
710
696
|
super(..._args3);
|
|
711
697
|
this.customId = field.id;
|
|
712
|
-
this.options = options;
|
|
713
|
-
this.required = field.required;
|
|
714
698
|
}
|
|
699
|
+
}();
|
|
700
|
+
group.options = field.options ?? [];
|
|
701
|
+
group.required = field.required;
|
|
702
|
+
if (field.type === "checkbox") {
|
|
703
|
+
group.minValues = field.minValues;
|
|
704
|
+
group.maxValues = field.maxValues;
|
|
715
705
|
}
|
|
716
|
-
return
|
|
706
|
+
return group;
|
|
717
707
|
}
|
|
718
708
|
var DiscordFormModal = class extends Modal {
|
|
719
709
|
constructor(params) {
|
|
@@ -728,7 +718,6 @@ var DiscordFormModal = class extends Modal {
|
|
|
728
718
|
super(..._args4);
|
|
729
719
|
this.label = field.label;
|
|
730
720
|
this.description = field.description;
|
|
731
|
-
this.component = component;
|
|
732
721
|
this.customId = field.id;
|
|
733
722
|
}
|
|
734
723
|
}
|
|
@@ -750,11 +739,7 @@ function createDiscordFormModal(entry) {
|
|
|
750
739
|
//#region extensions/discord/src/approval-custom-id.ts
|
|
751
740
|
const DISCORD_APPROVAL_CUSTOM_ID_MAX_CHARS = 100;
|
|
752
741
|
function encodeDiscordApprovalCustomId(action) {
|
|
753
|
-
return
|
|
754
|
-
`execapproval:kind=${action.approvalKind}`,
|
|
755
|
-
`id=${encodeURIComponent(action.approvalId)}`,
|
|
756
|
-
`action=${action.decision}`
|
|
757
|
-
].join(";");
|
|
742
|
+
return `execapproval:kind=${action.approvalKind};id=${encodeURIComponent(action.approvalId)};action=${action.decision}`;
|
|
758
743
|
}
|
|
759
744
|
function encodeBoundedDiscordApprovalCustomId(action) {
|
|
760
745
|
const exact = encodeDiscordApprovalCustomId(action);
|
|
@@ -779,22 +764,20 @@ function buildExecApprovalCustomId(approvalId, approvalKind, decision) {
|
|
|
779
764
|
decision
|
|
780
765
|
});
|
|
781
766
|
}
|
|
782
|
-
function decodeCustomIdValue(value) {
|
|
783
|
-
try {
|
|
784
|
-
return decodeURIComponent(value);
|
|
785
|
-
} catch {
|
|
786
|
-
return null;
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
767
|
function parseExecApprovalData(data) {
|
|
790
768
|
if (!data || typeof data !== "object") return null;
|
|
791
769
|
const coerce = (value) => typeof value === "string" || typeof value === "number" ? String(value) : "";
|
|
792
770
|
const rawId = coerce(data.id);
|
|
793
771
|
const rawKind = coerce(data.kind);
|
|
794
772
|
const rawAction = coerce(data.action);
|
|
795
|
-
if (!rawId || rawKind !== "exec" && rawKind !== "plugin" && rawKind !== "system-agent"
|
|
773
|
+
if (!rawId || rawKind !== "exec" && rawKind !== "plugin" && rawKind !== "system-agent") return null;
|
|
796
774
|
if (rawAction !== "allow-once" && rawAction !== "allow-always" && rawAction !== "deny") return null;
|
|
797
|
-
|
|
775
|
+
let approvalId;
|
|
776
|
+
try {
|
|
777
|
+
approvalId = decodeURIComponent(rawId);
|
|
778
|
+
} catch {
|
|
779
|
+
return null;
|
|
780
|
+
}
|
|
798
781
|
if (!approvalId) return null;
|
|
799
782
|
return {
|
|
800
783
|
approvalId,
|
|
@@ -824,16 +807,6 @@ var shared_interactive_exports = /* @__PURE__ */ __exportAll({
|
|
|
824
807
|
buildDiscordInteractiveComponents: () => buildDiscordInteractiveComponents,
|
|
825
808
|
buildDiscordPresentationComponents: () => buildDiscordPresentationComponents
|
|
826
809
|
});
|
|
827
|
-
function resolveDiscordSelectOptionValue(option) {
|
|
828
|
-
return resolveMessagePresentationActionValue(resolveMessagePresentationOptionAction(option));
|
|
829
|
-
}
|
|
830
|
-
function resolveDiscordSelectCallbackDataKind(options) {
|
|
831
|
-
const renderableOptions = options.filter((option) => resolveDiscordSelectOptionValue(option));
|
|
832
|
-
if (renderableOptions.length === 0) return;
|
|
833
|
-
if (renderableOptions.every((option) => option.action?.type === "command")) return "command";
|
|
834
|
-
if (renderableOptions.every((option) => option.action?.type === "callback")) return "callback";
|
|
835
|
-
if (renderableOptions.some((option) => option.action)) return "mixed";
|
|
836
|
-
}
|
|
837
810
|
const DISCORD_INTERACTIVE_BUTTON_ROW_SIZE = 5;
|
|
838
811
|
function buildDiscordButtonComponent(button, options) {
|
|
839
812
|
const action = resolveMessagePresentationButtonAction(button);
|
|
@@ -879,24 +852,21 @@ function buildDiscordButtonComponent(button, options) {
|
|
|
879
852
|
if (button.reusable === true) component.reusable = true;
|
|
880
853
|
return component;
|
|
881
854
|
}
|
|
882
|
-
function appendDiscordButtonBlocks(blocks, buttons, options) {
|
|
883
|
-
const components = buttons.flatMap((button) => {
|
|
884
|
-
const component = buildDiscordButtonComponent(button, options);
|
|
885
|
-
return component ? [component] : [];
|
|
886
|
-
});
|
|
887
|
-
for (let index = 0; index < components.length; index += DISCORD_INTERACTIVE_BUTTON_ROW_SIZE) blocks.push({
|
|
888
|
-
type: "actions",
|
|
889
|
-
buttons: components.slice(index, index + DISCORD_INTERACTIVE_BUTTON_ROW_SIZE)
|
|
890
|
-
});
|
|
891
|
-
}
|
|
892
855
|
function appendDiscordSelectBlock(blocks, block) {
|
|
893
|
-
const options =
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
856
|
+
const options = [];
|
|
857
|
+
let callbackDataKind;
|
|
858
|
+
for (const option of block.options) {
|
|
859
|
+
const value = resolveMessagePresentationActionValue(resolveMessagePresentationOptionAction(option));
|
|
860
|
+
if (!value) continue;
|
|
861
|
+
const kind = option.action?.type;
|
|
862
|
+
if (kind !== void 0 && kind !== "command" && kind !== "callback" || options.length > 0 && callbackDataKind !== kind) return;
|
|
863
|
+
callbackDataKind = kind;
|
|
864
|
+
options.push({
|
|
865
|
+
label: option.label,
|
|
866
|
+
value
|
|
867
|
+
});
|
|
868
|
+
}
|
|
897
869
|
if (options.length === 0) return;
|
|
898
|
-
const callbackDataKind = resolveDiscordSelectCallbackDataKind(block.options);
|
|
899
|
-
if (callbackDataKind === "mixed") return;
|
|
900
870
|
blocks.push({
|
|
901
871
|
type: "actions",
|
|
902
872
|
select: {
|
|
@@ -934,7 +904,14 @@ function buildDiscordPresentationComponents(presentation, options = {}) {
|
|
|
934
904
|
continue;
|
|
935
905
|
}
|
|
936
906
|
if (block.type === "buttons") {
|
|
937
|
-
|
|
907
|
+
const components = block.buttons.flatMap((button) => {
|
|
908
|
+
const component = buildDiscordButtonComponent(button, options);
|
|
909
|
+
return component ? [component] : [];
|
|
910
|
+
});
|
|
911
|
+
for (let index = 0; index < components.length; index += DISCORD_INTERACTIVE_BUTTON_ROW_SIZE) blocks.push({
|
|
912
|
+
type: "actions",
|
|
913
|
+
buttons: components.slice(index, index + DISCORD_INTERACTIVE_BUTTON_ROW_SIZE)
|
|
914
|
+
});
|
|
938
915
|
continue;
|
|
939
916
|
}
|
|
940
917
|
if (block.type === "select") appendDiscordSelectBlock(blocks, block);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as runtime_doctor_migrations_exports } from "./runtime-doctor-migrations-BPV-R4G9.mjs";
|
|
2
2
|
import { buildSecretInputSchema, registerSensitiveConfigSchema } from "openclaw/plugin-sdk/secret-input";
|
|
3
|
-
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
3
|
import { normalizeLegacyDmAliases } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
4
|
+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { createChannelConfigUiHints } from "openclaw/plugin-sdk/channel-core";
|
|
6
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";
|
|
@@ -22,8 +22,8 @@ const discordChannelConfigUiHints = {
|
|
|
22
22
|
},
|
|
23
23
|
nativeCommands: true,
|
|
24
24
|
streaming: {
|
|
25
|
-
"": "Discord
|
|
26
|
-
mode: "Discord preview mode: \"off\" | \"partial\" | \"block\" | \"progress\". Default: \"off\".",
|
|
25
|
+
"": "Discord shows useful work status by default without streaming answer text. Set mode to \"off\" for quiet final-only delivery, or \"partial\"/\"block\" for answer previews. Run openclaw doctor --fix to migrate legacy keys.",
|
|
26
|
+
mode: "Discord preview mode: \"off\" | \"partial\" | \"block\" | \"progress\". Default: \"progress\"; \"off\" explicitly disables progress drafts.",
|
|
27
27
|
chunkMode: "Chunking mode for outbound Discord text delivery: \"length\" (default) or \"newline\".",
|
|
28
28
|
"block.enabled": "Enable normal Discord block replies. This takes precedence over editable preview delivery.",
|
|
29
29
|
"block.coalesce": "Merge streamed Discord block replies before final delivery.",
|
|
@@ -35,6 +35,10 @@ const discordChannelConfigUiHints = {
|
|
|
35
35
|
},
|
|
36
36
|
progress: { includeCommentary: true }
|
|
37
37
|
}),
|
|
38
|
+
"streaming.progress.toolProgress": {
|
|
39
|
+
label: "Discord Progress Tool Lines",
|
|
40
|
+
help: "Show the detailed rolling tool log (default: false). Work status, delegated-task states, plans, and authored progress remain visible without it. Set streaming.mode to off for quiet final-only delivery."
|
|
41
|
+
},
|
|
38
42
|
joinIntro: {
|
|
39
43
|
label: "Discord Guild Join Introduction",
|
|
40
44
|
help: "Post one brief, room-specific introduction when the bot joins an allowed Discord guild (default: true). Account settings override the channel-wide setting."
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as shouldIgnoreStaleDiscordRouteBinding } from "./outbound-session-route-
|
|
1
|
+
import { m as shouldIgnoreStaleDiscordRouteBinding } from "./outbound-session-route-B0Hpwn3Q.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
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { c as resolveDefaultDiscordAccountId, s as mergeDiscordAccountConfig, u as resolveDiscordAccountAllowFrom } from "./accounts-ljrzXBJi.mjs";
|
|
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,9 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { o as normalizeDiscordSlug } from "./allow-list-
|
|
4
|
-
import { r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-
|
|
5
|
-
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
+
import { h as normalizeDiscordToken, l as resolveDiscordAccount } from "./accounts-ljrzXBJi.mjs";
|
|
3
|
+
import { o as normalizeDiscordSlug } from "./allow-list-B_ToXtew.mjs";
|
|
4
|
+
import { r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-CtmE1OUN.mjs";
|
|
6
5
|
import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
6
|
+
import { normalizeOptionalLowercaseString, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
//#region extensions/discord/src/directory-cache-state.ts
|
|
8
8
|
const discordDirectoryCacheState = { handlesByAccount: /* @__PURE__ */ new Map() };
|
|
9
9
|
//#endregion
|
|
@@ -20,7 +20,7 @@ function normalizeDiscordHandleKey(raw) {
|
|
|
20
20
|
if (!handle) return null;
|
|
21
21
|
if (handle.startsWith("@")) handle = normalizeOptionalString(handle.slice(1)) ?? "";
|
|
22
22
|
if (!handle || /\s/.test(handle)) return null;
|
|
23
|
-
return
|
|
23
|
+
return handle.toLowerCase();
|
|
24
24
|
}
|
|
25
25
|
function ensureAccountCache(accountId) {
|
|
26
26
|
const cacheKey = normalizeAccountId(accountId);
|
|
@@ -83,13 +83,15 @@ function resolveDiscordDirectoryAccess(params) {
|
|
|
83
83
|
async function listDiscordGuilds(token) {
|
|
84
84
|
return (await fetchDiscord("/users/@me/guilds", token, fetch, { timeoutMs: DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS })).filter((guild) => guild.id && guild.name);
|
|
85
85
|
}
|
|
86
|
-
async function
|
|
86
|
+
async function listDiscordDirectoryLive(params, kind) {
|
|
87
87
|
const access = resolveDiscordDirectoryAccess(params);
|
|
88
|
-
if (!access) return [];
|
|
89
|
-
const { token, query } = access;
|
|
88
|
+
if (!access || kind === "user" && !access.query) return [];
|
|
89
|
+
const { token, query, accountId } = access;
|
|
90
90
|
const guilds = await listDiscordGuilds(token);
|
|
91
91
|
const rows = [];
|
|
92
|
-
|
|
92
|
+
const seenUserIds = /* @__PURE__ */ new Set();
|
|
93
|
+
const limit = kind === "user" && typeof params.limit === "number" && params.limit > 0 ? params.limit : 25;
|
|
94
|
+
for (const guild of guilds) if (kind === "group") {
|
|
93
95
|
const channels = await fetchDiscord(`/guilds/${guild.id}/channels`, token, fetch, { timeoutMs: DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS });
|
|
94
96
|
for (const channel of channels) {
|
|
95
97
|
const name = channel.name?.trim();
|
|
@@ -104,19 +106,7 @@ async function listDiscordDirectoryGroupsLive(params) {
|
|
|
104
106
|
});
|
|
105
107
|
if (typeof params.limit === "number" && params.limit > 0 && rows.length >= params.limit) return rows;
|
|
106
108
|
}
|
|
107
|
-
}
|
|
108
|
-
return rows;
|
|
109
|
-
}
|
|
110
|
-
async function listDiscordDirectoryPeersLive(params) {
|
|
111
|
-
const access = resolveDiscordDirectoryAccess(params);
|
|
112
|
-
if (!access) return [];
|
|
113
|
-
const { token, query, accountId } = access;
|
|
114
|
-
if (!query) return [];
|
|
115
|
-
const guilds = await listDiscordGuilds(token);
|
|
116
|
-
const rows = [];
|
|
117
|
-
const seenUserIds = /* @__PURE__ */ new Set();
|
|
118
|
-
const limit = typeof params.limit === "number" && params.limit > 0 ? params.limit : 25;
|
|
119
|
-
for (const guild of guilds) {
|
|
109
|
+
} else {
|
|
120
110
|
const paramsObj = new URLSearchParams({
|
|
121
111
|
query,
|
|
122
112
|
limit: String(Math.min(limit, 100))
|
|
@@ -151,5 +141,11 @@ async function listDiscordDirectoryPeersLive(params) {
|
|
|
151
141
|
}
|
|
152
142
|
return rows;
|
|
153
143
|
}
|
|
144
|
+
function listDiscordDirectoryGroupsLive(params) {
|
|
145
|
+
return listDiscordDirectoryLive(params, "group");
|
|
146
|
+
}
|
|
147
|
+
function listDiscordDirectoryPeersLive(params) {
|
|
148
|
+
return listDiscordDirectoryLive(params, "user");
|
|
149
|
+
}
|
|
154
150
|
//#endregion
|
|
155
151
|
export { normalizeDiscordSnowflake as a, normalizeDiscordHandleKey as i, listDiscordDirectoryGroupsLive as n, rememberDiscordDirectoryUser as o, listDiscordDirectoryPeersLive as r, resolveDiscordDirectoryUserId as s, directory_live_exports as t };
|