@openclaw/discord 2026.8.1-beta.3 → 2026.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-inspect-D5xmUpnj.js → account-inspect-BDfKyuvL.js} +1 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-DNl-oCEw.js → accounts-CfQ-vSyf.js} +5 -124
- package/dist/action-runtime-api.js +1 -1
- package/dist/{activities-api-KCBAmWxD.js → activities-api-Dl-TOyOX.js} +5 -4
- package/dist/activities-api.js +1 -1
- package/dist/api.js +16 -16
- package/dist/{approval-handler.runtime-B12RCYr8.js → approval-handler.runtime-q4Zqo44V.js} +28 -105
- package/dist/{audit-Yc7eZDd6.js → audit-DgrvFPGt.js} +5 -5
- package/dist/{channel-cXYzGc4L.js → channel-BsQUalPw.js} +18 -20
- package/dist/{channel-actions.runtime-CODTvo7c.js → channel-actions.runtime-UMGGIfSy.js} +59 -58
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/channel-type-CVLZyGYS.js +7 -0
- package/dist/{channel.setup-CSiwnMgs.js → channel.setup-rPs4dsk_.js} +5 -5
- package/dist/{components-ezGKo_Yh.js → components-Dk35LTf_.js} +33 -29
- package/dist/{config-schema-DC5kDtQ5.js → config-schema-CxPqtVI1.js} +16 -10
- package/dist/{conversation-binding-route-D6rCQ5S0.js → conversation-binding-route-BjvX4e35.js} +1 -1
- package/dist/{directory-config-XyCfoqLg.js → directory-config-B7DY_pNG.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-Df0NbFJB.js → directory-live-DuAXKkan.js} +2 -2
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{doctor-DYY31GrO.js → doctor-zQTtn6hm.js} +4 -4
- package/dist/{handle-action.guild-admin-6Tvvinsa.js → handle-action.guild-admin-DZewwLr1.js} +9 -5
- package/dist/index.js +1 -1
- package/dist/ingress-identity-CzZKcPK8.js +60 -0
- package/dist/{message-handler-B61q5MOF.js → message-handler-C5By3yl5.js} +5 -5
- package/dist/{message-handler.preflight-Bzg_Hawz.js → message-handler.preflight-DrszWuHw.js} +20 -84
- package/dist/{message-handler.process--4_712Ec.js → message-handler.process-DyFPDLCt.js} +60 -66
- package/dist/{message-utils-BXLLnFl6.js → message-text-Ca8M6TU8.js} +34 -32
- package/dist/{outbound-adapter-DxHTOqiN.js → outbound-adapter-Dif8p481.js} +58 -61
- package/dist/{outbound-components-B2PL0ooH.js → outbound-components-wjv7yyAj.js} +5 -4
- package/dist/outbound-session-route-Bn4uXaoE.js +665 -0
- package/dist/{owner-access-Bg41VzAf.js → owner-access-UlYi9t0M.js} +1 -1
- package/dist/{pluralkit-dUl4v1X3.js → pluralkit-9EuEN4UD.js} +1 -1
- package/dist/{probe-BTdtVRwU.js → probe-n6ZXxK8V.js} +1 -1
- package/dist/{probe.runtime-Dq5-PRKT.js → probe.runtime-CN4bdPfZ.js} +1 -1
- package/dist/{provider-DlK_ynqt.js → provider-LXiOcJrH.js} +443 -295
- package/dist/{provider-session.runtime-CvvphHvs.js → provider-session.runtime-DSNe7r2W.js} +3 -3
- package/dist/provider.runtime-DiInaDXO.js +2 -0
- package/dist/{realtime-session.runtime-ysbMG8v7.js → realtime-session.runtime-DOViOIjY.js} +106 -122
- package/dist/{resolve-allowlist-common-DIVXbD1P.js → resolve-allowlist-common-BLoYaxEG.js} +1 -1
- package/dist/{resolve-channels-CGeUoIqb.js → resolve-channels-D2yl_2CN.js} +4 -3
- package/dist/{resolve-users-BtKxLUZv.js → resolve-users-BLxfqajZ.js} +2 -2
- package/dist/{retry-DNsVTeTo.js → retry-DqHCW6PV.js} +220 -6
- package/dist/{runtime-D71_VFLr.js → runtime-BYamRVPN.js} +73 -56
- package/dist/{runtime-CQovMsH3.js → runtime-DrxVBTtp.js} +2 -2
- package/dist/runtime-api.js +16 -23
- package/dist/{sdk-runtime-37OU6_Yh.js → sdk-runtime-6tfgYDjY.js} +55 -86
- package/dist/{security-audit-BfJhAXZp.js → security-audit-DKfK-iPY.js} +10 -11
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/{security-audit.runtime-BVKF9VtY.js → security-audit.runtime-sKZyKgpx.js} +1 -1
- package/dist/{send-rQIffSYu.js → send-UJHiAm4C.js} +78 -15
- package/dist/{send.components-ChK1wS7w.js → send.components-CrBJpGT_.js} +15 -22
- package/dist/{send.outbound-HIkgji_7.js → send.outbound-D7JYmfm9.js} +58 -69
- package/dist/{send.shared-B3fpaLWJ.js → send.shared-DZJ1akvQ.js} +36 -21
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-CaAaoksy.js → shared-Dii2HTn7.js} +31 -9
- package/dist/{subagent-hooks-CNT2ZJTJ.js → subagent-hooks-JyGrtQIl.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -6
- package/dist/{system-events-Nuwoq_au.js → system-events-BEmcj4xJ.js} +1 -1
- package/dist/{target-resolver-DIXShHaZ.js → target-resolver-V-IYae6s.js} +3 -3
- package/dist/targets-CQp53cGj.js +3 -0
- package/dist/{thread-bindings-VlymUnbz.js → thread-bindings-DvYP79fy.js} +3 -4
- package/dist/{thread-bindings.manager-CngsgErq.js → thread-bindings.manager-Clm77DBM.js} +8 -12
- package/dist/{threading-DU6pgeGm.js → threading-CXuu_7o9.js} +47 -25
- package/dist/{transcripts-source-DeIMNbRh.js → transcripts-source-BLEMH_yi.js} +9 -4
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-oLiS5Z13.js → typing-B9snnwMe.js} +1 -1
- package/dist/{voice-runtime-CjNFaynA.js → voice-runtime-DY6_o73o.js} +76 -66
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/README.md +19 -19
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v1.js +7 -3
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v7.js +5 -2
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v1.js +7 -3
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v7.js +5 -2
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/package.json +4 -3
- package/node_modules/@discordjs/voice/node_modules/@types/node/README.md +1 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@discordjs/voice/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@discordjs/voice/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@discordjs/voice/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@discordjs/voice/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@discordjs/voice/node_modules/@types/node/package.json +2 -2
- package/node_modules/@discordjs/voice/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@discordjs/voice/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@discordjs/voice/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@discordjs/voice/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/discord-api-types/CHANGELOG.md +8 -0
- package/node_modules/discord-api-types/package.json +4 -4
- package/node_modules/discord-api-types/payloads/v10/channel.d.ts +2 -2
- package/node_modules/discord-api-types/payloads/v10/channel.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/gateway.d.ts +4 -0
- package/node_modules/discord-api-types/payloads/v10/gateway.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/gateway.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/message.d.ts +4 -1
- package/node_modules/discord-api-types/payloads/v10/message.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/message.js +1 -0
- package/node_modules/discord-api-types/payloads/v10/message.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/channel.d.ts +2 -2
- package/node_modules/discord-api-types/payloads/v9/channel.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/gateway.d.ts +4 -0
- package/node_modules/discord-api-types/payloads/v9/gateway.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/gateway.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/message.d.ts +4 -1
- package/node_modules/discord-api-types/payloads/v9/message.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/message.js +1 -0
- package/node_modules/discord-api-types/payloads/v9/message.js.map +1 -1
- package/node_modules/typebox/build/format/date.d.mts +1 -1
- package/node_modules/typebox/build/format/date.mjs +1 -1
- package/node_modules/typebox/build/format/date_time.d.mts +2 -2
- package/node_modules/typebox/build/format/date_time.mjs +3 -3
- package/node_modules/typebox/build/format/email.d.mts +1 -1
- package/node_modules/typebox/build/format/email.mjs +2 -2
- package/node_modules/typebox/build/format/hostname.mjs +2 -10
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_email.mjs +3 -3
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
- package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
- package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
- package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
- package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
- package/node_modules/typebox/build/format/idna/index.mjs +2 -0
- package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
- package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
- package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
- package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
- package/node_modules/typebox/build/format/ipv4.mjs +2 -32
- package/node_modules/typebox/build/format/ipv6.mjs +2 -61
- package/node_modules/typebox/build/format/iri.d.mts +2 -2
- package/node_modules/typebox/build/format/iri.mjs +26 -8
- package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
- package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
- package/node_modules/typebox/build/format/regex.d.mts +1 -2
- package/node_modules/typebox/build/format/regex.mjs +2 -6
- package/node_modules/typebox/build/format/time.d.mts +2 -2
- package/node_modules/typebox/build/format/time.mjs +19 -14
- package/node_modules/typebox/build/format/uri.d.mts +1 -1
- package/node_modules/typebox/build/format/uri.mjs +3 -130
- package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
- package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
- package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
- package/node_modules/typebox/build/format/uri_template.mjs +4 -5
- package/node_modules/typebox/build/format/url.d.mts +3 -3
- package/node_modules/typebox/build/format/url.mjs +4 -5
- package/node_modules/typebox/build/guard/emit.d.mts +3 -1
- package/node_modules/typebox/build/guard/emit.mjs +12 -5
- package/node_modules/typebox/build/guard/guard.d.mts +8 -2
- package/node_modules/typebox/build/guard/guard.mjs +25 -4
- package/node_modules/typebox/build/guard/string.d.mts +2 -2
- package/node_modules/typebox/build/guard/string.mjs +7 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
- package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
- package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
- package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
- package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
- package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
- package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
- package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
- package/node_modules/typebox/build/schema/types/index.mjs +0 -2
- package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
- package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
- package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
- package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
- package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
- package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
- package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
- package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
- package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
- package/node_modules/typebox/build/type/script/parser.mjs +27 -23
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
- package/node_modules/typebox/package.json +27 -27
- package/node_modules/typebox/readme.md +79 -82
- package/node_modules/undici/docs/docs/api/Client.md +21 -8
- package/node_modules/undici/lib/api/readable.js +33 -43
- package/node_modules/undici/lib/core/connect.js +16 -2
- package/node_modules/undici/lib/core/symbols.js +1 -0
- package/node_modules/undici/lib/dispatcher/client-h1.js +3 -3
- package/node_modules/undici/lib/dispatcher/client-h2.js +179 -10
- package/node_modules/undici/lib/dispatcher/client.js +74 -29
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +28 -6
- package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +15 -1
- package/node_modules/undici/lib/handler/retry-handler.js +7 -2
- package/node_modules/undici/lib/interceptor/cache.js +5 -2
- package/node_modules/undici/lib/interceptor/deduplicate.js +1 -1
- package/node_modules/undici/lib/mock/mock-utils.js +213 -24
- package/node_modules/undici/lib/util/cache.js +2 -4
- package/node_modules/undici/lib/web/websocket/websocket.js +22 -0
- package/node_modules/undici/package.json +1 -1
- package/node_modules/undici/types/client.d.ts +40 -0
- package/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/ws/package.json +1 -1
- package/openclaw.plugin.json +12 -4
- package/package.json +8 -8
- package/skills/discord/SKILL.md +1 -1
- package/dist/approval-message-safety-XGFPbDoI.js +0 -226
- package/dist/audit-core-BCX8UeFH.js +0 -105
- package/dist/channel-actions-Dr2QI8Bf.js +0 -212
- package/dist/inbound-event-delivery-De2qxTrP.js +0 -39
- package/dist/provider.runtime-CzKGRiAF.js +0 -2
- package/dist/runtime-api.actions.js +0 -3
- package/dist/runtime-api.lookup.js +0 -7
- package/dist/runtime-api.monitor-CzeTYF32.js +0 -6
- package/dist/runtime-api.monitor.js +0 -9
- package/dist/runtime-api.send.js +0 -7
- package/dist/runtime-api.threads.js +0 -5
- package/dist/send.reactions-gmJ6yFPo.js +0 -78
- package/dist/send.receipt-Cnhoautb.js +0 -76
- package/dist/subagent-progress-FPLqBY1s.js +0 -110
- package/dist/targets-B2pf49zc.js +0 -3
- package/node_modules/typebox/build/format/_idna.d.mts +0 -2
- package/node_modules/typebox/build/format/_idna.mjs +0 -246
- package/node_modules/typebox/build/format/_puny.d.mts +0 -1
- package/node_modules/typebox/build/format/_puny.mjs +0 -77
- package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
- package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
- package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
- package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { A as resolveDiscordMessageFlags, M as resolveDiscordSendEmbeds, N as resolveDiscordSuppressEmbeds, O as buildDiscordMessageRequest, P as createDiscordClient, a as normalizeDiscordPollInput, c as normalizeStickerIds, f as sendDiscordMedia, j as resolveDiscordSendComponents, k as createDiscordMessageNonce, l as resolveChannelId, n as buildDiscordTextChunks, p as sendDiscordText, q as parseAndResolveChannelRecipient, t as buildDiscordSendError, u as resolveDiscordChannel } from "./send.shared-B3fpaLWJ.js";
|
|
5
|
-
import { n as createDiscordSendReceiptFromResults, r as createDiscordSendResult } from "./send.receipt-Cnhoautb.js";
|
|
1
|
+
import { Tt as createThread, c as createDiscordSendResult, s as createDiscordSendReceiptFromResults, u as createReusableDiscordReplyReference, wt as createChannelMessage } from "./retry-DqHCW6PV.js";
|
|
2
|
+
import { i as normalizeDiscordHandleKey, o as resolveDiscordDirectoryUserId } from "./directory-live-DuAXKkan.js";
|
|
3
|
+
import { A as resolveDiscordSendComponents, D as buildDiscordMessageRequest, K as parseAndResolveChannelRecipient, M as resolveDiscordSuppressEmbeds, N as createDiscordClient, O as createDiscordMessageNonce, a as normalizeDiscordPollInput, c as normalizeStickerIds, f as sendDiscordMedia, j as resolveDiscordSendEmbeds, k as resolveDiscordMessageFlags, l as resolveChannelId, n as buildDiscordTextChunks, p as sendDiscordText, t as buildDiscordSendError, u as resolveDiscordChannel } from "./send.shared-DZJ1akvQ.js";
|
|
6
4
|
import { ChannelType } from "discord-api-types/v10";
|
|
7
5
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
8
6
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -377,23 +375,14 @@ function findFenceEnd(text, startIndex, runLength) {
|
|
|
377
375
|
return text.length;
|
|
378
376
|
}
|
|
379
377
|
function findNextMarkdownCodeSegment(text, startIndex) {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
endIndex: inlineEndIndex
|
|
389
|
-
};
|
|
390
|
-
if (runLength >= 3) return {
|
|
391
|
-
startIndex: segmentStart,
|
|
392
|
-
endIndex: findFenceEnd(text, segmentStart, runLength)
|
|
393
|
-
};
|
|
394
|
-
searchIndex = segmentStart + runLength;
|
|
395
|
-
}
|
|
396
|
-
return null;
|
|
378
|
+
const segmentOffset = text.slice(startIndex).search(/(?<=(?:^|[^\\])(?:\\\\)*)`/);
|
|
379
|
+
if (segmentOffset === -1) return null;
|
|
380
|
+
const segmentStart = startIndex + segmentOffset;
|
|
381
|
+
const runLength = countBacktickRun(text, segmentStart);
|
|
382
|
+
return {
|
|
383
|
+
startIndex: segmentStart,
|
|
384
|
+
endIndex: findSameLineBacktickRun(text, segmentStart + runLength, runLength) ?? (runLength >= 3 ? findFenceEnd(text, segmentStart, runLength) : text.length)
|
|
385
|
+
};
|
|
397
386
|
}
|
|
398
387
|
function rewriteDiscordKnownMentions(text, params) {
|
|
399
388
|
if (!text.includes("@")) return text;
|
|
@@ -456,22 +445,23 @@ function toDiscordSendResult(result, fallbackChannelId, params = {}) {
|
|
|
456
445
|
}
|
|
457
446
|
async function resolveDiscordSendTarget(to, opts) {
|
|
458
447
|
const cfg = requireRuntimeConfig(opts.cfg, "Discord send target resolution");
|
|
459
|
-
const { rest, request } = createDiscordClient({
|
|
448
|
+
const { rest, request, account } = createDiscordClient({
|
|
460
449
|
...opts,
|
|
461
450
|
cfg
|
|
462
451
|
});
|
|
463
|
-
const { channelId } = await resolveChannelId(rest, await parseAndResolveChannelRecipient(to, cfg,
|
|
452
|
+
const { channelId } = await resolveChannelId(rest, await parseAndResolveChannelRecipient(to, cfg, account.accountId), request);
|
|
464
453
|
return {
|
|
465
454
|
rest,
|
|
466
455
|
request,
|
|
467
|
-
channelId
|
|
456
|
+
channelId,
|
|
457
|
+
account
|
|
468
458
|
};
|
|
469
459
|
}
|
|
470
460
|
async function sendMessageDiscord(to, text, opts) {
|
|
471
461
|
const cfg = requireRuntimeConfig(opts.cfg, "Discord send");
|
|
472
|
-
const accountInfo =
|
|
473
|
-
|
|
474
|
-
|
|
462
|
+
const { token, rest, request, account: accountInfo } = createDiscordClient({
|
|
463
|
+
...opts,
|
|
464
|
+
cfg
|
|
475
465
|
});
|
|
476
466
|
const tableMode = resolveMarkdownTableMode({
|
|
477
467
|
cfg,
|
|
@@ -492,12 +482,19 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
492
482
|
accountId: accountInfo.accountId,
|
|
493
483
|
mentionAliases: accountInfo.config.mentionAliases
|
|
494
484
|
});
|
|
495
|
-
const {
|
|
496
|
-
...opts,
|
|
497
|
-
cfg
|
|
498
|
-
});
|
|
499
|
-
const { channelId } = await resolveChannelId(rest, await parseAndResolveChannelRecipient(to, cfg, opts.accountId), request);
|
|
485
|
+
const { channelId } = await resolveChannelId(rest, await parseAndResolveChannelRecipient(to, cfg, accountInfo.accountId), request);
|
|
500
486
|
const channel = await resolveDiscordChannel(rest, channelId);
|
|
487
|
+
const deliveredResults = [];
|
|
488
|
+
let deliveryThreadId;
|
|
489
|
+
const reportResult = async (progressResult, kind, replyToId) => {
|
|
490
|
+
const deliveredResult = toDiscordSendResult(progressResult, deliveryThreadId ?? channelId, {
|
|
491
|
+
kind,
|
|
492
|
+
threadId: deliveryThreadId,
|
|
493
|
+
reply: createReusableDiscordReplyReference(replyToId)
|
|
494
|
+
});
|
|
495
|
+
deliveredResults.push(deliveredResult);
|
|
496
|
+
await opts.onDeliveryResult?.(deliveredResult);
|
|
497
|
+
};
|
|
501
498
|
if (isForumLikeChannel(channel)) {
|
|
502
499
|
if (((channel.flags ?? 0) & DISCORD_FORUM_REQUIRE_TAG_FLAG) !== 0) throw new Error(`Discord forum channel ${channelId} requires an applied tag; use thread-create with appliedTags, then send to the created thread.`);
|
|
503
500
|
const threadName = deriveForumThreadName(renderedText);
|
|
@@ -529,12 +526,14 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
529
526
|
});
|
|
530
527
|
let threadRes;
|
|
531
528
|
try {
|
|
532
|
-
await
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
529
|
+
threadRes = await request(async () => {
|
|
530
|
+
await opts.onPlatformSendDispatch?.();
|
|
531
|
+
return createThread(rest, channelId, { body: {
|
|
532
|
+
name: threadName,
|
|
533
|
+
...channel.default_auto_archive_duration === void 0 ? {} : { auto_archive_duration: channel.default_auto_archive_duration },
|
|
534
|
+
message: starterBody
|
|
535
|
+
} });
|
|
536
|
+
}, "forum-thread", { safety: "non-idempotent-create" });
|
|
538
537
|
} catch (err) {
|
|
539
538
|
throw await buildDiscordSendError(err, {
|
|
540
539
|
channelId,
|
|
@@ -545,6 +544,7 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
545
544
|
});
|
|
546
545
|
}
|
|
547
546
|
const threadId = threadRes.id;
|
|
547
|
+
deliveryThreadId = threadId;
|
|
548
548
|
const messageId = threadRes.message?.id ?? threadId;
|
|
549
549
|
const resultChannelId = threadRes.message?.channel_id ?? threadId;
|
|
550
550
|
const remainingChunks = chunks.slice(1);
|
|
@@ -555,16 +555,8 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
555
555
|
kind: "text",
|
|
556
556
|
threadId
|
|
557
557
|
});
|
|
558
|
-
|
|
558
|
+
deliveredResults.push(starterResult);
|
|
559
559
|
await opts.onDeliveryResult?.(starterResult);
|
|
560
|
-
const reportThreadResult = async (result, kind) => {
|
|
561
|
-
const deliveredResult = toDiscordSendResult(result, threadId, {
|
|
562
|
-
kind,
|
|
563
|
-
threadId
|
|
564
|
-
});
|
|
565
|
-
deliveredResults.push(deliveredResult);
|
|
566
|
-
await opts.onDeliveryResult?.(deliveredResult);
|
|
567
|
-
};
|
|
568
560
|
try {
|
|
569
561
|
if (opts.mediaUrl) {
|
|
570
562
|
const [mediaCaption, ...afterMediaChunks] = remainingChunks;
|
|
@@ -585,7 +577,7 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
585
577
|
suppressEmbeds,
|
|
586
578
|
allowedMentions: opts.allowedMentions,
|
|
587
579
|
maxChars: textLimit,
|
|
588
|
-
onResult:
|
|
580
|
+
onResult: reportResult,
|
|
589
581
|
onPlatformSendDispatch: opts.onPlatformSendDispatch
|
|
590
582
|
});
|
|
591
583
|
await sendDiscordThreadTextChunks({
|
|
@@ -599,7 +591,7 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
599
591
|
silent: opts.silent,
|
|
600
592
|
suppressEmbeds,
|
|
601
593
|
allowedMentions: opts.allowedMentions,
|
|
602
|
-
onResult:
|
|
594
|
+
onResult: reportResult,
|
|
603
595
|
onPlatformSendDispatch: opts.onPlatformSendDispatch
|
|
604
596
|
});
|
|
605
597
|
} else await sendDiscordThreadTextChunks({
|
|
@@ -613,7 +605,7 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
613
605
|
silent: opts.silent,
|
|
614
606
|
suppressEmbeds,
|
|
615
607
|
allowedMentions: opts.allowedMentions,
|
|
616
|
-
onResult:
|
|
608
|
+
onResult: reportResult,
|
|
617
609
|
onPlatformSendDispatch: opts.onPlatformSendDispatch
|
|
618
610
|
});
|
|
619
611
|
} catch (err) {
|
|
@@ -639,12 +631,6 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
639
631
|
};
|
|
640
632
|
}
|
|
641
633
|
let result;
|
|
642
|
-
const reportResult = async (progressResult, kind, replyToId) => {
|
|
643
|
-
await opts.onDeliveryResult?.(toDiscordSendResult(progressResult, channelId, {
|
|
644
|
-
kind,
|
|
645
|
-
reply: createReusableDiscordReplyReference(replyToId)
|
|
646
|
-
}));
|
|
647
|
-
};
|
|
648
634
|
try {
|
|
649
635
|
if (opts.mediaUrl) result = await sendDiscordMedia({
|
|
650
636
|
rest,
|
|
@@ -700,16 +686,20 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
700
686
|
accountId: accountInfo.accountId,
|
|
701
687
|
direction: "outbound"
|
|
702
688
|
});
|
|
703
|
-
return
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
689
|
+
return {
|
|
690
|
+
messageId: result.id || "unknown",
|
|
691
|
+
channelId: result.channel_id ?? channelId,
|
|
692
|
+
receipt: createDiscordSendReceiptFromResults({ results: deliveredResults })
|
|
693
|
+
};
|
|
707
694
|
}
|
|
708
695
|
async function sendStickerDiscord(to, stickerIds, opts) {
|
|
709
696
|
const context = await resolveDiscordStructuredSendContext(to, opts);
|
|
710
697
|
const { rewrittenContent, suppressEmbeds } = context;
|
|
711
698
|
const stickers = normalizeStickerIds(stickerIds);
|
|
712
|
-
const flags = resolveDiscordMessageFlags({
|
|
699
|
+
const flags = resolveDiscordMessageFlags({
|
|
700
|
+
silent: opts.silent,
|
|
701
|
+
suppressEmbeds
|
|
702
|
+
});
|
|
713
703
|
const body = {
|
|
714
704
|
content: rewrittenContent || void 0,
|
|
715
705
|
sticker_ids: stickers,
|
|
@@ -738,16 +728,15 @@ async function sendPollDiscord(to, poll, opts) {
|
|
|
738
728
|
return context.send("poll", body);
|
|
739
729
|
}
|
|
740
730
|
async function resolveDiscordStructuredSendContext(to, opts) {
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
accountId: opts.accountId
|
|
744
|
-
});
|
|
745
|
-
const { rest, request, channelId } = await resolveDiscordSendTarget(to, opts);
|
|
731
|
+
requireRuntimeConfig(opts.cfg, "Discord structured send");
|
|
732
|
+
const { rest, request, channelId, account: accountInfo } = await resolveDiscordSendTarget(to, opts);
|
|
746
733
|
const content = opts.content?.trim();
|
|
747
734
|
return {
|
|
748
735
|
send: async (kind, body) => {
|
|
749
|
-
await
|
|
750
|
-
|
|
736
|
+
const result = await request(async () => {
|
|
737
|
+
await opts.onPlatformSendDispatch?.();
|
|
738
|
+
return createChannelMessage(rest, channelId, { body });
|
|
739
|
+
}, kind, { safety: "nonce-protected-create" });
|
|
751
740
|
recordChannelActivity({
|
|
752
741
|
channel: "discord",
|
|
753
742
|
accountId: accountInfo.accountId,
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as resolveDiscordAccount, m as normalizeDiscordToken, o as mergeDiscordAccountConfig } from "./accounts-
|
|
3
|
-
import { t as parseAndResolveDiscordTarget } from "./target-resolver-
|
|
1
|
+
import { At as getChannel, J as Embed, Jt as getGuildMember, K as hasDiscordV2Components, Mt as getThreadMember, P as RequestClient, a as chunkDiscordTextWithMode, bt as getCurrentUser, d as resolveDiscordReplyMessageId, n as createDiscordRetryRunner, q as serializePayload, qt as getGuild, wt as createChannelMessage, yt as createUserDmChannel } from "./retry-DqHCW6PV.js";
|
|
2
|
+
import { c as resolveDiscordAccount, m as normalizeDiscordToken, o as mergeDiscordAccountConfig } from "./accounts-CfQ-vSyf.js";
|
|
3
|
+
import { t as parseAndResolveDiscordTarget } from "./target-resolver-V-IYae6s.js";
|
|
4
|
+
import { t as isDiscordThreadChannelType } from "./channel-type-CVLZyGYS.js";
|
|
4
5
|
import { ChannelType, MessageFlags, PermissionFlagsBits } from "discord-api-types/v10";
|
|
5
6
|
import { randomBytes } from "node:crypto";
|
|
6
7
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
7
8
|
import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
8
9
|
import { normalizeOptionalString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
10
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
11
|
+
import { resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
10
12
|
import { makeProxyFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
11
13
|
import { danger } from "openclaw/plugin-sdk/runtime-env";
|
|
12
14
|
import { PollLayoutType } from "discord-api-types/payloads/v10";
|
|
13
15
|
import { buildOutboundMediaLoadOptions, extensionForMime, normalizePollDurationHours, normalizePollInput } from "openclaw/plugin-sdk/media-runtime";
|
|
14
|
-
import { resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
15
16
|
import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
|
|
16
17
|
//#region extensions/discord/src/recipient-resolution.ts
|
|
17
18
|
async function parseAndResolveRecipient(raw, cfg, accountId, parseOptions = {}) {
|
|
@@ -30,7 +31,14 @@ async function parseAndResolveRecipient(raw, cfg, accountId, parseOptions = {})
|
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
33
|
async function parseAndResolveChannelRecipient(raw, cfg, accountId) {
|
|
33
|
-
|
|
34
|
+
const resolved = await parseAndResolveDiscordTarget(raw, {
|
|
35
|
+
cfg: requireRuntimeConfig(cfg, "Discord recipient resolution"),
|
|
36
|
+
accountId
|
|
37
|
+
}, { defaultKind: "channel" });
|
|
38
|
+
return {
|
|
39
|
+
kind: resolved.kind,
|
|
40
|
+
id: resolved.id
|
|
41
|
+
};
|
|
34
42
|
}
|
|
35
43
|
//#endregion
|
|
36
44
|
//#region extensions/discord/src/monitor/gateway-registry.ts
|
|
@@ -181,7 +189,11 @@ function createDiscordRestClient(opts) {
|
|
|
181
189
|
};
|
|
182
190
|
}
|
|
183
191
|
function createDiscordClient(opts) {
|
|
184
|
-
const { token, rest, account } = createDiscordRestClient(opts);
|
|
192
|
+
const { token, rest, account: restAccount } = createDiscordRestClient(opts);
|
|
193
|
+
const account = normalizeDiscordToken(opts.token, "channels.discord.token") ? resolveDiscordAccount({
|
|
194
|
+
cfg: opts.cfg,
|
|
195
|
+
accountId: opts.accountId
|
|
196
|
+
}) : restAccount;
|
|
185
197
|
return {
|
|
186
198
|
token,
|
|
187
199
|
rest,
|
|
@@ -189,10 +201,11 @@ function createDiscordClient(opts) {
|
|
|
189
201
|
retry: opts.retry,
|
|
190
202
|
verbose: opts.verbose,
|
|
191
203
|
isGatewayDisconnected: () => {
|
|
192
|
-
const gateway = getGateway(
|
|
204
|
+
const gateway = getGateway(restAccount.accountId);
|
|
193
205
|
return gateway !== void 0 && !gateway.isConnected;
|
|
194
206
|
}
|
|
195
|
-
})
|
|
207
|
+
}),
|
|
208
|
+
account
|
|
196
209
|
};
|
|
197
210
|
}
|
|
198
211
|
function resolveDiscordRest(opts) {
|
|
@@ -273,9 +286,6 @@ function hasAdministrator(bitfield) {
|
|
|
273
286
|
function hasPermissionBit(bitfield, permission) {
|
|
274
287
|
return (bitfield & permission) === permission;
|
|
275
288
|
}
|
|
276
|
-
function isThreadChannelType(channelType) {
|
|
277
|
-
return channelType === ChannelType.GuildNewsThread || channelType === ChannelType.GuildPublicThread || channelType === ChannelType.GuildPrivateThread;
|
|
278
|
-
}
|
|
279
289
|
async function fetchBotUserId(rest) {
|
|
280
290
|
const me = await getCurrentUser(rest);
|
|
281
291
|
if (!me?.id) throw new Error("Failed to resolve bot user id");
|
|
@@ -330,7 +340,7 @@ function resolveMemberChannelPermissionBits(params) {
|
|
|
330
340
|
async function resolveChannelPermissionSubject(rest, channel) {
|
|
331
341
|
const channelType = "type" in channel ? channel.type : void 0;
|
|
332
342
|
const parentId = "parent_id" in channel ? channel.parent_id : void 0;
|
|
333
|
-
if (
|
|
343
|
+
if (isDiscordThreadChannelType(channelType) && parentId) return await getChannel(rest, parentId);
|
|
334
344
|
return channel;
|
|
335
345
|
}
|
|
336
346
|
/**
|
|
@@ -365,7 +375,7 @@ async function canViewDiscordGuildChannel(guildId, channelId, userId, opts) {
|
|
|
365
375
|
channel: permissionChannel
|
|
366
376
|
});
|
|
367
377
|
if (!hasPermissionBit(permissions, PermissionFlagsBits.ViewChannel)) return false;
|
|
368
|
-
if ("type" in channel && channel.type === ChannelType.
|
|
378
|
+
if ("type" in channel && channel.type === ChannelType.PrivateThread) {
|
|
369
379
|
if (hasPermissionBit(permissions, PermissionFlagsBits.ManageThreads)) return true;
|
|
370
380
|
await getThreadMember(rest, channel.id, userId);
|
|
371
381
|
}
|
|
@@ -586,14 +596,14 @@ async function buildDiscordSendError(err, ctx) {
|
|
|
586
596
|
probedChannelType = permissions.channelType;
|
|
587
597
|
const current = new Set(permissions.permissions);
|
|
588
598
|
const required = ["ViewChannel", "SendMessages"];
|
|
589
|
-
if (
|
|
599
|
+
if (isDiscordThreadChannelType(probedChannelType)) required.push("SendMessagesInThreads");
|
|
590
600
|
if (ctx.hasMedia) required.push("AttachFiles");
|
|
591
601
|
missing = required.filter((permission) => !current.has(permission));
|
|
592
602
|
} catch {}
|
|
593
603
|
const status = getDiscordErrorStatus(err);
|
|
594
604
|
const apiDetails = [`code=${code}`, status != null ? `status=${status}` : void 0].filter(Boolean).join(" ");
|
|
595
605
|
const probedPermissions = ["ViewChannel", "SendMessages"];
|
|
596
|
-
if (
|
|
606
|
+
if (isDiscordThreadChannelType(probedChannelType)) probedPermissions.push("SendMessagesInThreads");
|
|
597
607
|
if (ctx.hasMedia) probedPermissions.push("AttachFiles");
|
|
598
608
|
const probeSummary = probedPermissions.join("/");
|
|
599
609
|
return new DiscordSendError(`${missing.length ? `discord missing permissions in channel ${ctx.channelId}: ${missing.join(", ")}` : `discord missing permissions in channel ${ctx.channelId}; permission probe did not identify missing ${probeSummary}`} (${apiDetails}). bot might be blocked by channel/thread overrides, archived thread state, reply target visibility, or app-role position`, {
|
|
@@ -667,9 +677,11 @@ async function sendDiscordText(params) {
|
|
|
667
677
|
flags,
|
|
668
678
|
replyTo: chunkReplyTo
|
|
669
679
|
});
|
|
670
|
-
await onPlatformSendDispatch?.();
|
|
671
680
|
return {
|
|
672
|
-
result: await request(() =>
|
|
681
|
+
result: await request(async () => {
|
|
682
|
+
await onPlatformSendDispatch?.();
|
|
683
|
+
return createChannelMessage(rest, channelId, { body });
|
|
684
|
+
}, "text", { safety: "nonce-protected-create" }),
|
|
673
685
|
replyToId: chunkReplyTo,
|
|
674
686
|
kind
|
|
675
687
|
};
|
|
@@ -739,8 +751,10 @@ async function sendDiscordMedia(params) {
|
|
|
739
751
|
});
|
|
740
752
|
let res;
|
|
741
753
|
try {
|
|
742
|
-
await
|
|
743
|
-
|
|
754
|
+
res = await request(async () => {
|
|
755
|
+
await onPlatformSendDispatch?.();
|
|
756
|
+
return createChannelMessage(rest, channelId, { body });
|
|
757
|
+
}, "media", { safety: "nonce-protected-create" });
|
|
744
758
|
} catch (err) {
|
|
745
759
|
if (!isDiscordUploadTooLargeError(err)) throw err;
|
|
746
760
|
return sendDiscordText({
|
|
@@ -776,7 +790,8 @@ async function sendDiscordMedia(params) {
|
|
|
776
790
|
suppressEmbeds,
|
|
777
791
|
allowedMentions,
|
|
778
792
|
maxChars,
|
|
779
|
-
onResult
|
|
793
|
+
onResult,
|
|
794
|
+
onPlatformSendDispatch
|
|
780
795
|
});
|
|
781
796
|
for (const id of followup.platformMessageIds) if (id) platformMessageIds.push(id);
|
|
782
797
|
}
|
|
@@ -793,4 +808,4 @@ function formatReactionEmoji(emoji) {
|
|
|
793
808
|
return buildReactionIdentifier(emoji);
|
|
794
809
|
}
|
|
795
810
|
//#endregion
|
|
796
|
-
export {
|
|
811
|
+
export { resolveDiscordSendComponents as A, validateDiscordProxyUrl as B, hasAllGuildPermissionsDiscord as C, buildDiscordMessageRequest as D, SUPPRESS_NOTIFICATIONS_FLAG as E, createDiscordRuntimeAccountContext as F, unregisterGateway as G, clearGateways as H, resolveDiscordClientAccountContext as I, parseAndResolveChannelRecipient as K, resolveDiscordRest as L, resolveDiscordSuppressEmbeds as M, createDiscordClient as N, createDiscordMessageNonce as O, createDiscordRestClient as P, DISCORD_REST_TIMEOUT_MS as R, fetchMemberGuildPermissionsDiscord as S, hasAnyGuildPermissionDiscord as T, getGateway as U, withValidatedDiscordProxy as V, registerGateway as W, DiscordSendError as _, normalizeDiscordPollInput as a, canViewDiscordGuildChannel as b, normalizeStickerIds as c, resolveDiscordTargetChannelId as d, sendDiscordMedia as f, DISCORD_MAX_STICKER_BYTES as g, DISCORD_MAX_EVENT_COVER_BYTES as h, formatReactionEmoji as i, resolveDiscordSendEmbeds as j, resolveDiscordMessageFlags as k, resolveChannelId as l, DISCORD_MAX_EMOJI_BYTES as m, buildDiscordTextChunks as n, normalizeEmojiName as o, sendDiscordText as p, buildReactionIdentifier as r, normalizeReactionEmoji as s, buildDiscordSendError as t, resolveDiscordChannel as u, canManageGuildMemberRoleDiscord as v, hasAnyChannelPermissionDiscord as w, fetchChannelPermissionsDiscord as x, canManageGuildRoleDiscord as y, resolveDiscordProxyFetchForAccount as z };
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as discordSetupPlugin } from "./channel.setup-
|
|
1
|
+
import { t as discordSetupPlugin } from "./channel.setup-rPs4dsk_.js";
|
|
2
2
|
export { discordSetupPlugin };
|
|
@@ -1,18 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
1
|
+
import { c as resolveDiscordAccount, d as resolveDiscordAccountDisabledReason, f as resolveDiscordAccountDmPolicy, l as resolveDiscordAccountAllowFrom, n as isDiscordAccountEnabledForRuntime, o as mergeDiscordAccountConfig, r as listDiscordAccountIds, s as resolveDefaultDiscordAccountId } from "./accounts-CfQ-vSyf.js";
|
|
2
|
+
import { t as inspectDiscordAccount } from "./account-inspect-BDfKyuvL.js";
|
|
3
|
+
import { t as discordIngressIdentity } from "./ingress-identity-CzZKcPK8.js";
|
|
4
|
+
import { t as DiscordChannelConfigSchema } from "./config-schema-CxPqtVI1.js";
|
|
4
5
|
import { n as normalizeCompatibilityConfig } from "./doctor-contract-DsWvKIXF.js";
|
|
5
6
|
import { r as secretTargetRegistryEntries, t as collectRuntimeConfigAssignments } from "./secret-config-contract-B3i6WxV5.js";
|
|
6
7
|
import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-DSHk7I2w.js";
|
|
7
8
|
import { t as deriveLegacySessionChatType } from "./session-contract-BO5tlIdl.js";
|
|
8
9
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
9
|
-
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
10
|
+
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
10
11
|
import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter, createScopedDmSecurityResolver } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
12
|
+
import { PAIRING_APPROVED_MESSAGE, buildTokenChannelStatusSummary, projectCredentialSnapshotFields, resolveConfiguredFromCredentialStatuses as resolveConfiguredFromCredentialStatuses$1 } from "openclaw/plugin-sdk/channel-status";
|
|
11
13
|
import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from";
|
|
12
14
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
13
15
|
import { createConditionalWarningCollector, createOpenProviderConfiguredRouteWarningCollector } from "openclaw/plugin-sdk/channel-policy";
|
|
16
|
+
import { identityEntryAuthenticationClassifier } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
14
17
|
import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
|
|
15
18
|
import { createEnvPatchedAccountSetupAdapter } from "openclaw/plugin-sdk/setup-runtime";
|
|
19
|
+
//#region extensions/discord/src/channel-api.ts
|
|
20
|
+
const DISCORD_CHANNEL_META = {
|
|
21
|
+
id: "discord",
|
|
22
|
+
label: "Discord",
|
|
23
|
+
selectionLabel: "Discord (Bot API)",
|
|
24
|
+
detailLabel: "Discord Bot",
|
|
25
|
+
docsPath: "/channels/discord",
|
|
26
|
+
docsLabel: "discord",
|
|
27
|
+
blurb: "very well supported right now.",
|
|
28
|
+
systemImage: "bubble.left.and.bubble.right",
|
|
29
|
+
markdownCapable: true,
|
|
30
|
+
preferSessionLookupForAnnounceTarget: true
|
|
31
|
+
};
|
|
32
|
+
function getChatChannelMeta(id) {
|
|
33
|
+
if (id !== DISCORD_CHANNEL_META.id) throw new Error(`Unsupported Discord channel meta lookup: ${id}`);
|
|
34
|
+
return DISCORD_CHANNEL_META;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
16
37
|
//#region extensions/discord/src/security.ts
|
|
17
38
|
const resolveDiscordDmPolicy = createScopedDmSecurityResolver({
|
|
18
39
|
channelKey: "discord",
|
|
@@ -29,6 +50,7 @@ const resolveDiscordDmPolicy = createScopedDmSecurityResolver({
|
|
|
29
50
|
})
|
|
30
51
|
}),
|
|
31
52
|
policyPathSuffix: "dmPolicy",
|
|
53
|
+
classifyEntryAuthentication: identityEntryAuthenticationClassifier(discordIngressIdentity),
|
|
32
54
|
normalizeEntry: (raw) => raw.trim().replace(/^(discord|user):/i, "").replace(/^<@!?(\d+)>$/, "$1")
|
|
33
55
|
});
|
|
34
56
|
const collectDiscordSecurityWarnings = createOpenProviderConfiguredRouteWarningCollector({
|
|
@@ -53,7 +75,7 @@ const collectDiscordSecurityFindings = createConditionalWarningCollector.finding
|
|
|
53
75
|
severity: "critical",
|
|
54
76
|
title: "Discord security warning"
|
|
55
77
|
});
|
|
56
|
-
const loadDiscordSecurityAuditModule = createLazyRuntimeModule(() => import("./security-audit.runtime-
|
|
78
|
+
const loadDiscordSecurityAuditModule = createLazyRuntimeModule(() => import("./security-audit.runtime-sKZyKgpx.js"));
|
|
57
79
|
const discordSecurityAdapter = {
|
|
58
80
|
resolveDmPolicy: resolveDiscordDmPolicy,
|
|
59
81
|
collectWarnings: collectDiscordSecurityFindings,
|
|
@@ -92,7 +114,7 @@ const DISCORD_LEGACY_CONFIG_RULES = [];
|
|
|
92
114
|
//#endregion
|
|
93
115
|
//#region extensions/discord/src/shared.ts
|
|
94
116
|
const DISCORD_CHANNEL = "discord";
|
|
95
|
-
const loadDiscordDoctorModule = createLazyRuntimeModule(() => import("./doctor-
|
|
117
|
+
const loadDiscordDoctorModule = createLazyRuntimeModule(() => import("./doctor-zQTtn6hm.js"));
|
|
96
118
|
const discordDoctor = {
|
|
97
119
|
dmAllowFromMode: "topOnly",
|
|
98
120
|
groupModel: "route",
|
|
@@ -166,10 +188,10 @@ function createDiscordPluginBase(params) {
|
|
|
166
188
|
hasConfiguredState: ({ env }) => typeof env?.DISCORD_BOT_TOKEN === "string" && env.DISCORD_BOT_TOKEN.trim().length > 0,
|
|
167
189
|
isEnabled: (account, cfg) => isDiscordAccountEnabledForRuntime(account, cfg),
|
|
168
190
|
disabledReason: (account, cfg) => resolveDiscordAccountDisabledReason(account, cfg),
|
|
169
|
-
isConfigured: (account) => resolveConfiguredFromCredentialStatuses(account) ?? Boolean(account.token?.trim()),
|
|
191
|
+
isConfigured: (account) => resolveConfiguredFromCredentialStatuses$1(account) ?? Boolean(account.token?.trim()),
|
|
170
192
|
describeAccount: (account) => describeAccountSnapshot({
|
|
171
193
|
account,
|
|
172
|
-
configured: resolveConfiguredFromCredentialStatuses(account) ?? Boolean(account.token?.trim()),
|
|
194
|
+
configured: resolveConfiguredFromCredentialStatuses$1(account) ?? Boolean(account.token?.trim()),
|
|
173
195
|
extra: {
|
|
174
196
|
tokenSource: account.tokenSource,
|
|
175
197
|
tokenStatus: account.tokenStatus
|
|
@@ -187,4 +209,4 @@ function createDiscordPluginBase(params) {
|
|
|
187
209
|
};
|
|
188
210
|
}
|
|
189
211
|
//#endregion
|
|
190
|
-
export { discordSecurityAdapter as a, discordSetupContract as i, discordConfigAdapter as n, DISCORD_LEGACY_CONFIG_RULES as r, createDiscordPluginBase as t };
|
|
212
|
+
export { discordSecurityAdapter as a, buildTokenChannelStatusSummary as c, discordSetupContract as i, projectCredentialSnapshotFields as l, discordConfigAdapter as n, DEFAULT_ACCOUNT_ID$1 as o, DISCORD_LEGACY_CONFIG_RULES as r, PAIRING_APPROVED_MESSAGE as s, createDiscordPluginBase as t, resolveConfiguredFromCredentialStatuses$1 as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey } from "./thread-bindings-
|
|
1
|
+
import { on as __exportAll } from "./retry-DqHCW6PV.js";
|
|
2
|
+
import { o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey } from "./thread-bindings-DvYP79fy.js";
|
|
3
3
|
import { normalizeOptionalLowercaseString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
//#region extensions/discord/src/subagent-hooks.ts
|
|
5
5
|
var subagent_hooks_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
2
2
|
//#region extensions/discord/subagent-hooks-api.ts
|
|
3
|
-
const loadDiscordSubagentHooksModule = createLazyRuntimeModule(() => import("./subagent-hooks-
|
|
4
|
-
const loadDiscordSubagentProgressModule = createLazyRuntimeModule(() => import("./subagent-progress-FPLqBY1s.js"));
|
|
3
|
+
const loadDiscordSubagentHooksModule = createLazyRuntimeModule(() => import("./subagent-hooks-JyGrtQIl.js").then((n) => n.r));
|
|
5
4
|
function registerDiscordSubagentHooks(api) {
|
|
6
|
-
api.on("gateway_start", async () => {
|
|
7
|
-
const { recoverDiscordSubagentProgress } = await loadDiscordSubagentProgressModule();
|
|
8
|
-
await recoverDiscordSubagentProgress(api);
|
|
9
|
-
});
|
|
10
5
|
api.on("subagent_ended", async (event) => {
|
|
11
6
|
const { handleDiscordSubagentEnded } = await loadDiscordSubagentHooksModule();
|
|
12
7
|
handleDiscordSubagentEnded(event);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { y as discord_exports } from "./retry-DqHCW6PV.js";
|
|
2
2
|
import { x as formatDiscordUserTag } from "./allow-list-BDMimASD.js";
|
|
3
3
|
//#region extensions/discord/src/monitor/system-events.ts
|
|
4
4
|
function resolveDiscordSystemEvent(message, location) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as resolveDiscordAccount,
|
|
3
|
-
import { a as rememberDiscordDirectoryUser, r as listDiscordDirectoryPeersLive } from "./directory-live-
|
|
1
|
+
import { _ as parseDiscordTarget, on as __exportAll, p as allowFromContainsDiscordUserId } from "./retry-DqHCW6PV.js";
|
|
2
|
+
import { c as resolveDiscordAccount, l as resolveDiscordAccountAllowFrom } from "./accounts-CfQ-vSyf.js";
|
|
3
|
+
import { a as rememberDiscordDirectoryUser, r as listDiscordDirectoryPeersLive } from "./directory-live-DuAXKkan.js";
|
|
4
4
|
import { buildMessagingTarget } from "openclaw/plugin-sdk/channel-targets";
|
|
5
5
|
//#region extensions/discord/src/send-target-parsing.ts
|
|
6
6
|
const parseDiscordSendTarget = (raw, options = {}) => parseDiscordTarget(raw, options);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import "./targets-B2pf49zc.js";
|
|
1
|
+
import { _ as parseDiscordTarget, on as __exportAll } from "./retry-DqHCW6PV.js";
|
|
2
|
+
import "./targets-CQp53cGj.js";
|
|
4
3
|
import { C as resolveThreadBindingMaxAgeExpiresAt, O as shouldPersistBindingMutations, S as resolveThreadBindingInactivityExpiresAt, T as saveBindingsToDisk, h as refreshUnboundThreadWebhookIdentity, m as normalizeThreadId, n as MANAGERS_BY_ACCOUNT_ID, t as BINDINGS_BY_THREAD_ID, u as getThreadBindingToken, v as removeBindingRecord, w as resolveThreadBindingMaxAgeMs$1, x as resolveThreadBindingIdleTimeoutMs$1 } from "./thread-bindings.state-D8OMdk4O.js";
|
|
5
4
|
import { n as setThreadBindingMaxAgeBySessionKey, r as resolveBindingIdsForTargetSession, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-CJb-BpPL.js";
|
|
6
|
-
import { _ as resolveThreadBindingThreadName, g as resolveThreadBindingIntroText, h as formatThreadBindingDurationLabel, m as resolveThreadBindingPersonaFromRecord, n as createThreadBindingManager, o as resolveChannelIdForBinding, p as resolveThreadBindingPersona, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-
|
|
5
|
+
import { _ as resolveThreadBindingThreadName, g as resolveThreadBindingIntroText, h as formatThreadBindingDurationLabel, m as resolveThreadBindingPersonaFromRecord, n as createThreadBindingManager, o as resolveChannelIdForBinding, p as resolveThreadBindingPersona, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-Clm77DBM.js";
|
|
7
6
|
import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
8
7
|
import { normalizeOptionalLowercaseString, normalizeOptionalString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
8
|
import { resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled } from "openclaw/plugin-sdk/conversation-runtime";
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
1
|
+
import { At as getChannel, on as __exportAll, v as resolveDiscordChannelId, vt as createChannelWebhook } from "./retry-DqHCW6PV.js";
|
|
2
|
+
import { P as createDiscordRestClient } from "./send.shared-DZJ1akvQ.js";
|
|
3
|
+
import { t as sendMessageDiscord } from "./send.outbound-D7JYmfm9.js";
|
|
4
|
+
import { t as isDiscordThreadChannelType } from "./channel-type-CVLZyGYS.js";
|
|
5
|
+
import { c as sendWebhookMessageDiscord, u as createThreadDiscord } from "./send-UJHiAm4C.js";
|
|
6
6
|
import { A as toReusableWebhookKey, C as resolveThreadBindingMaxAgeExpiresAt, D as shouldDefaultPersist, E as setBindingRecord, S as resolveThreadBindingInactivityExpiresAt, T as saveBindingsToDisk, _ as rememberThreadBindingToken, b as resolveBindingRecordKey, c as ensureBindingsLoaded, f as normalizeTargetKind, g as rememberReusableWebhook, h as refreshUnboundThreadWebhookIdentity, i as REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL, l as forgetThreadBindingToken, m as normalizeThreadId, n as MANAGERS_BY_ACCOUNT_ID, p as normalizeThreadBindingDurationMs, r as PERSIST_BY_ACCOUNT_ID, s as THREAD_BINDING_TOUCH_PERSIST_MIN_INTERVAL_MS, t as BINDINGS_BY_THREAD_ID, u as getThreadBindingToken, v as removeBindingRecord, w as resolveThreadBindingMaxAgeMs$1, x as resolveThreadBindingIdleTimeoutMs$1, y as resolveBindingIdsForSession } from "./thread-bindings.state-D8OMdk4O.js";
|
|
7
|
-
import { ChannelType } from "discord-api-types/v10";
|
|
8
7
|
import { parseStrictNonNegativeInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
9
8
|
import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
10
9
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -13,7 +12,7 @@ import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
|
13
12
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
14
13
|
import { SYSTEM_MARK } from "openclaw/plugin-sdk/text-chunking";
|
|
15
14
|
import { formatThreadBindingDurationLabel, registerSessionBindingAdapter, resolveThreadBindingConversationIdFromBindingId, resolveThreadBindingFarewellText, resolveThreadBindingIntroText, resolveThreadBindingThreadName, unregisterSessionBindingAdapter } from "openclaw/plugin-sdk/conversation-runtime";
|
|
16
|
-
import {
|
|
15
|
+
import { resolveSessionAgentIdStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
17
16
|
//#region extensions/discord/src/monitor/thread-bindings.persona.ts
|
|
18
17
|
const THREAD_BINDING_PERSONA_MAX_CHARS = 80;
|
|
19
18
|
function normalizePersonaLabel(value) {
|
|
@@ -107,9 +106,6 @@ function isThreadArchived(raw) {
|
|
|
107
106
|
if (asRecord.threadMetadata?.archived === true) return true;
|
|
108
107
|
return false;
|
|
109
108
|
}
|
|
110
|
-
function isThreadChannelType(type) {
|
|
111
|
-
return type === ChannelType.PublicThread || type === ChannelType.PrivateThread || type === ChannelType.AnnouncementThread;
|
|
112
|
-
}
|
|
113
109
|
function normalizeDiscordBindingChannelId(raw) {
|
|
114
110
|
const trimmed = normalizeOptionalString(raw) ?? "";
|
|
115
111
|
if (!trimmed) return null;
|
|
@@ -227,7 +223,7 @@ async function resolveChannelIdForBinding(params) {
|
|
|
227
223
|
const channelId = normalizeOptionalString(resolveDiscordChannelIdSafe(channel)) ?? "";
|
|
228
224
|
const type = channelInfo.type;
|
|
229
225
|
const parentId = normalizeOptionalString(channelInfo.parentId) ?? "";
|
|
230
|
-
if (parentId &&
|
|
226
|
+
if (parentId && isDiscordThreadChannelType(type)) return parentId;
|
|
231
227
|
return channelId || null;
|
|
232
228
|
} catch (err) {
|
|
233
229
|
logVerbose(`discord thread binding channel resolve failed for ${lookupThreadId}: ${summarizeDiscordError(err)}`);
|
|
@@ -635,7 +631,7 @@ function createThreadBindingManager(params) {
|
|
|
635
631
|
threadId,
|
|
636
632
|
targetKind,
|
|
637
633
|
targetSessionKey,
|
|
638
|
-
agentId: normalizeOptionalString(bindParams.agentId) ?? normalizeOptionalString(existingValue?.agentId) ??
|
|
634
|
+
agentId: normalizeOptionalString(bindParams.agentId) ?? normalizeOptionalString(existingValue?.agentId) ?? resolveSessionAgentIdStrict({
|
|
639
635
|
config: cfg,
|
|
640
636
|
sessionKey: targetSessionKey
|
|
641
637
|
}),
|