@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,12 +1,12 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
-
import { D as createDiscordMessageNonce, M as parseAndResolveChannelRecipient, N as createDiscordClient, T as SUPPRESS_NOTIFICATIONS_FLAG, c as resolveChannelId, l as resolveDiscordChannel, t as buildDiscordSendError } from "./send.shared-
|
|
3
|
-
import {
|
|
4
|
-
import { r as createDiscordSendResult } from "./send.receipt-
|
|
5
|
-
import { t as sendMessageDiscord } from "./send.outbound-
|
|
6
|
-
import { d as buildDiscordComponentMessage, f as buildDiscordComponentMessageFlags, g as resolveDiscordComponentAttachmentName } from "./components-
|
|
2
|
+
import { D as createDiscordMessageNonce, M as parseAndResolveChannelRecipient, N as createDiscordClient, T as SUPPRESS_NOTIFICATIONS_FLAG, c as resolveChannelId, l as resolveDiscordChannel, t as buildDiscordSendError } from "./send.shared-CjQ4jbMA.mjs";
|
|
3
|
+
import { K as serializePayload, W as withDiscordRequestAuthority, st as createChannelMessage, ut as editChannelMessage } from "./discord-BGqgx-yd.mjs";
|
|
4
|
+
import { r as createDiscordSendResult } from "./send.receipt-BAlzXd8e.mjs";
|
|
5
|
+
import { t as sendMessageDiscord } from "./send.outbound-_jx4Xpd3.mjs";
|
|
6
|
+
import { d as buildDiscordComponentMessage, f as buildDiscordComponentMessageFlags, g as resolveDiscordComponentAttachmentName } from "./components-HN9052L1.mjs";
|
|
7
7
|
import { n as getOptionalDiscordRuntime } from "./runtime-DgnVQ7zW.mjs";
|
|
8
8
|
import { hasNonEmptyString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
|
-
import { ChannelType
|
|
9
|
+
import { ChannelType } from "discord-api-types/v10";
|
|
10
10
|
import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
|
|
11
11
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
12
12
|
import { asDateTimestampMs, isFutureDateTimestampMs, resolveDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
|
|
@@ -38,19 +38,17 @@ const PERSISTENT_MODAL_NAMESPACE = "discord.modals";
|
|
|
38
38
|
const PERSISTENT_REGISTRY_MAX_ENTRIES = 500;
|
|
39
39
|
function formatRegistryError(error) {
|
|
40
40
|
if (!(error instanceof Error)) return { error: formatRegistryErrorValue(error) };
|
|
41
|
-
const details = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
const details = {};
|
|
42
|
+
const appendError = (prefix, entry) => {
|
|
43
|
+
details[prefix] = String(entry);
|
|
44
|
+
details[`${prefix}Name`] = entry.name;
|
|
45
|
+
details[`${prefix}Message`] = entry.message;
|
|
46
|
+
if (entry.stack) details[`${prefix}Stack`] = entry.stack;
|
|
45
47
|
};
|
|
46
|
-
|
|
48
|
+
appendError("error", error);
|
|
47
49
|
const cause = error.cause;
|
|
48
|
-
if (cause instanceof Error)
|
|
49
|
-
|
|
50
|
-
details.errorCauseName = cause.name;
|
|
51
|
-
details.errorCauseMessage = cause.message;
|
|
52
|
-
if (cause.stack) details.errorCauseStack = cause.stack;
|
|
53
|
-
} else if (cause !== void 0) details.errorCause = formatRegistryErrorValue(cause);
|
|
50
|
+
if (cause instanceof Error) appendError("errorCause", cause);
|
|
51
|
+
else if (cause !== void 0) details.errorCause = formatRegistryErrorValue(cause);
|
|
54
52
|
return details;
|
|
55
53
|
}
|
|
56
54
|
const reportPersistentComponentRegistryError = createPluginStateErrorReporter(getOptionalDiscordRuntime, "discord", "component-registry-state", "Discord persistent component registry state failed", formatRegistryError);
|
|
@@ -91,11 +89,8 @@ function getPersistentComponentStore() {
|
|
|
91
89
|
function getPersistentModalStore() {
|
|
92
90
|
return discordComponentRegistryState.persistentModalStore = openPersistentRegistryStore(discordComponentRegistryState.persistentModalStore, PERSISTENT_MODAL_NAMESPACE);
|
|
93
91
|
}
|
|
94
|
-
function isExpired(entry, now) {
|
|
95
|
-
return entry.expiresAt !== void 0 && !isFutureDateTimestampMs(entry.expiresAt, { nowMs: now });
|
|
96
|
-
}
|
|
97
92
|
function pruneUndefinedRegistryValues(value) {
|
|
98
|
-
if (Array.isArray(value)) return value.filter((entry) => entry !== void 0).map(
|
|
93
|
+
if (Array.isArray(value)) return value.filter((entry) => entry !== void 0).map(pruneUndefinedRegistryValues);
|
|
99
94
|
if (!value || typeof value !== "object") return value;
|
|
100
95
|
const result = {};
|
|
101
96
|
for (const [key, entry] of Object.entries(value)) {
|
|
@@ -119,7 +114,8 @@ function normalizeRegistryEntries(entries, params) {
|
|
|
119
114
|
function resolveEntry(store, params) {
|
|
120
115
|
const entry = store.get(params.id);
|
|
121
116
|
if (!entry) return null;
|
|
122
|
-
|
|
117
|
+
const now = Date.now();
|
|
118
|
+
if (entry.expiresAt !== void 0 && !isFutureDateTimestampMs(entry.expiresAt, { nowMs: now })) {
|
|
123
119
|
store.delete(params.id);
|
|
124
120
|
return null;
|
|
125
121
|
}
|
|
@@ -160,12 +156,6 @@ function resolveComponentConsumptionIds(entry) {
|
|
|
160
156
|
const ids = entry.consumptionGroupEntryIds?.filter((id) => typeof id === "string" && id) ?? [];
|
|
161
157
|
return ids.length > 0 ? uniqueStrings(ids) : [entry.id];
|
|
162
158
|
}
|
|
163
|
-
async function deletePersistentComponentConsumptionGroup(entry) {
|
|
164
|
-
await Promise.all(resolveComponentConsumptionIds(entry).map((id) => deletePersistentEntry({
|
|
165
|
-
id,
|
|
166
|
-
openStore: getPersistentComponentStore
|
|
167
|
-
})));
|
|
168
|
-
}
|
|
169
159
|
async function resolvePersistentRegistryEntry(params) {
|
|
170
160
|
const store = params.openStore();
|
|
171
161
|
if (!store) return null;
|
|
@@ -179,16 +169,13 @@ async function resolvePersistentRegistryEntry(params) {
|
|
|
179
169
|
function registerDiscordComponentEntries(params) {
|
|
180
170
|
const now = Date.now();
|
|
181
171
|
const ttlMs = params.ttlMs ?? DEFAULT_COMPONENT_TTL_MS;
|
|
182
|
-
const
|
|
172
|
+
const entryOptions = {
|
|
183
173
|
now,
|
|
184
174
|
ttlMs,
|
|
185
175
|
messageId: params.messageId
|
|
186
|
-
}
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
ttlMs,
|
|
190
|
-
messageId: params.messageId
|
|
191
|
-
});
|
|
176
|
+
};
|
|
177
|
+
const normalizedEntries = normalizeRegistryEntries(params.entries, entryOptions);
|
|
178
|
+
const normalizedModals = normalizeRegistryEntries(params.modals, entryOptions);
|
|
192
179
|
return discordComponentRegistryState.withRegistryLock(async () => {
|
|
193
180
|
for (const entry of normalizedEntries) discordComponentRegistryState.componentEntries.set(entry.id, entry);
|
|
194
181
|
for (const entry of normalizedModals) discordComponentRegistryState.modalEntries.set(entry.id, entry);
|
|
@@ -207,19 +194,18 @@ async function resolveDiscordComponentEntryWithPersistence(params) {
|
|
|
207
194
|
return discordComponentRegistryState.withRegistryLock(async () => {
|
|
208
195
|
const store = discordComponentRegistryState.componentEntries;
|
|
209
196
|
const inMemory = resolveEntry(store, params);
|
|
210
|
-
|
|
211
|
-
if (params.consume !== false) {
|
|
212
|
-
for (const id of resolveComponentConsumptionIds(inMemory)) store.delete(id);
|
|
213
|
-
await deletePersistentComponentConsumptionGroup(inMemory);
|
|
214
|
-
}
|
|
215
|
-
return inMemory;
|
|
216
|
-
}
|
|
217
|
-
const persisted = await resolvePersistentRegistryEntry({
|
|
197
|
+
const entry = inMemory ?? await resolvePersistentRegistryEntry({
|
|
218
198
|
...params,
|
|
219
199
|
openStore: getPersistentComponentStore
|
|
220
200
|
});
|
|
221
|
-
if (
|
|
222
|
-
|
|
201
|
+
if (entry && params.consume !== false) {
|
|
202
|
+
if (inMemory) for (const id of resolveComponentConsumptionIds(entry)) store.delete(id);
|
|
203
|
+
await Promise.all(resolveComponentConsumptionIds(entry).map((id) => deletePersistentEntry({
|
|
204
|
+
id,
|
|
205
|
+
openStore: getPersistentComponentStore
|
|
206
|
+
})));
|
|
207
|
+
}
|
|
208
|
+
return entry;
|
|
223
209
|
});
|
|
224
210
|
}
|
|
225
211
|
async function resolveDiscordModalEntryWithPersistence(params) {
|
|
@@ -251,19 +237,6 @@ function extractComponentAttachmentNames(spec) {
|
|
|
251
237
|
for (const block of spec.blocks ?? []) if (block.type === "file") names.push(resolveDiscordComponentAttachmentName(block.file));
|
|
252
238
|
return names;
|
|
253
239
|
}
|
|
254
|
-
function hasComponentAttachmentBlock(spec) {
|
|
255
|
-
return (spec.blocks ?? []).some((block) => block.type === "file");
|
|
256
|
-
}
|
|
257
|
-
function withImplicitComponentAttachmentBlock(spec, attachmentName) {
|
|
258
|
-
if (!attachmentName || hasComponentAttachmentBlock(spec)) return spec;
|
|
259
|
-
return {
|
|
260
|
-
...spec,
|
|
261
|
-
blocks: [...spec.blocks ?? [], {
|
|
262
|
-
type: "file",
|
|
263
|
-
file: `attachment://${attachmentName}`
|
|
264
|
-
}]
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
240
|
function resolveClassicDiscordMessage(spec) {
|
|
268
241
|
if (spec.modal || spec.container) return;
|
|
269
242
|
const parts = hasNonEmptyString(spec.text) ? [spec.text] : [];
|
|
@@ -300,6 +273,7 @@ async function buildDiscordComponentPayload(params) {
|
|
|
300
273
|
let spec = params.spec;
|
|
301
274
|
let resolvedFileName;
|
|
302
275
|
let files;
|
|
276
|
+
let attachmentNames;
|
|
303
277
|
if (params.opts.mediaUrl) {
|
|
304
278
|
const media = await loadOutboundMediaFromUrl(params.opts.mediaUrl, {
|
|
305
279
|
mediaAccess: params.opts.mediaAccess,
|
|
@@ -307,17 +281,27 @@ async function buildDiscordComponentPayload(params) {
|
|
|
307
281
|
mediaReadFile: params.opts.mediaReadFile
|
|
308
282
|
});
|
|
309
283
|
const filenameOverride = params.opts.filename?.trim();
|
|
310
|
-
|
|
284
|
+
attachmentNames = extractComponentAttachmentNames(spec);
|
|
285
|
+
const explicitAttachmentName = attachmentNames[0];
|
|
311
286
|
resolvedFileName = filenameOverride || explicitAttachmentName || media.fileName || `upload${extensionForMime(media.contentType) ?? ""}`;
|
|
312
|
-
|
|
287
|
+
if (attachmentNames.length === 0) {
|
|
288
|
+
const file = `attachment://${resolvedFileName}`;
|
|
289
|
+
spec = {
|
|
290
|
+
...spec,
|
|
291
|
+
blocks: [...spec.blocks ?? [], {
|
|
292
|
+
type: "file",
|
|
293
|
+
file
|
|
294
|
+
}]
|
|
295
|
+
};
|
|
296
|
+
attachmentNames = [resolveDiscordComponentAttachmentName(file)];
|
|
297
|
+
}
|
|
313
298
|
files = [{
|
|
314
299
|
data: media.buffer,
|
|
315
300
|
name: resolvedFileName,
|
|
316
301
|
contentType: media.contentType
|
|
317
302
|
}];
|
|
318
303
|
}
|
|
319
|
-
const
|
|
320
|
-
const uniqueAttachmentNames = uniqueStrings(attachmentNames);
|
|
304
|
+
const uniqueAttachmentNames = uniqueStrings(attachmentNames ?? extractComponentAttachmentNames(spec));
|
|
321
305
|
if (uniqueAttachmentNames.length > 1) throw new Error("Discord component attachments currently support a single file. Use media-gallery for multiple files.");
|
|
322
306
|
const expectedAttachmentName = uniqueAttachmentNames[0];
|
|
323
307
|
if (expectedAttachmentName && resolvedFileName && expectedAttachmentName !== resolvedFileName) throw new Error(`Component file block expects attachment "${expectedAttachmentName}", but the uploaded file is "${resolvedFileName}". Update components.blocks[].file or provide a matching filename.`);
|
|
@@ -386,7 +370,7 @@ async function writeDiscordComponentMessage(to, spec, opts, messageId) {
|
|
|
386
370
|
if (messageId !== void 0) return editChannelMessage(rest, channelId, messageId, { body });
|
|
387
371
|
await opts.onPlatformSendDispatch?.();
|
|
388
372
|
opts.assertPlatformSendAuthorized?.();
|
|
389
|
-
return
|
|
373
|
+
return createChannelMessage(rest, channelId, { body });
|
|
390
374
|
}, "components", creating ? { safety: "nonce-protected-create" } : void 0);
|
|
391
375
|
} catch (err) {
|
|
392
376
|
throw await buildDiscordSendError(err, {
|