@openclaw/discord 2026.8.1-beta.2 → 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-CqzrH14k.js → account-inspect-BDfKyuvL.js} +1 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-DJTf1LtA.js → accounts-CfQ-vSyf.js} +34 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/{activities-api-DS7vpdtp.js → activities-api-Dl-TOyOX.js} +134 -175
- package/dist/activities-api.js +1 -1
- package/dist/api.js +17 -17
- package/dist/{approval-handler.runtime-B6yEV79q.js → approval-handler.runtime-q4Zqo44V.js} +29 -106
- package/dist/{audit-Db-rlntl.js → audit-DgrvFPGt.js} +5 -5
- package/dist/{channel-CnnbJSt5.js → channel-BsQUalPw.js} +72 -50
- package/dist/{channel-actions.runtime-CLKrx6tr.js → channel-actions.runtime-UMGGIfSy.js} +31 -45
- 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-BFAO-V1P.js → channel.setup-rPs4dsk_.js} +5 -5
- package/dist/{outbound-session-route-DxLkrgKQ.js → components-Dk35LTf_.js} +34 -76
- package/dist/{config-schema-BgEskFAs.js → config-schema-CxPqtVI1.js} +46 -14
- package/dist/conversation-binding-route-BjvX4e35.js +43 -0
- package/dist/{directory-config-BVX7Cflc.js → directory-config-B7DY_pNG.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-DGIGxpIo.js → directory-live-DuAXKkan.js} +3 -3
- package/dist/doctor-contract-api.js +2 -2
- package/dist/{doctor-BzC-TLnB.js → doctor-zQTtn6hm.js} +33 -12
- package/dist/{handle-action.guild-admin-BNVTUISF.js → handle-action.guild-admin-DZewwLr1.js} +9 -5
- package/dist/index.js +3 -4
- package/dist/ingress-identity-CzZKcPK8.js +60 -0
- package/dist/{message-handler-Unk_f10F.js → message-handler-C5By3yl5.js} +82 -6
- package/dist/{message-handler.preflight-C9zecxR9.js → message-handler.preflight-DrszWuHw.js} +44 -118
- package/dist/{message-handler.process-DWQ6UHHu.js → message-handler.process-DyFPDLCt.js} +205 -235
- package/dist/{message-utils-BSCPVgy0.js → message-text-Ca8M6TU8.js} +43 -42
- package/dist/{outbound-adapter-D9nRivT1.js → outbound-adapter-Dif8p481.js} +118 -91
- package/dist/{outbound-components-cTzwBJ60.js → outbound-components-wjv7yyAj.js} +5 -4
- package/dist/outbound-session-route-Bn4uXaoE.js +665 -0
- package/dist/owner-access-UlYi9t0M.js +107 -0
- package/dist/{pluralkit-DdiJ9KMK.js → pluralkit-9EuEN4UD.js} +1 -1
- package/dist/{probe-Bl-k5_Ku.js → probe-n6ZXxK8V.js} +1 -1
- package/dist/{probe.runtime-M9fREKvp.js → probe.runtime-CN4bdPfZ.js} +1 -1
- package/dist/{provider-DvSNb-2v.js → provider-LXiOcJrH.js} +887 -1350
- package/dist/{provider-session.runtime-BUEqD0rA.js → provider-session.runtime-DSNe7r2W.js} +3 -3
- package/dist/provider.runtime-DiInaDXO.js +2 -0
- package/dist/{realtime-session.runtime-C7wen-aF.js → realtime-session.runtime-DOViOIjY.js} +129 -134
- package/dist/{resolve-allowlist-common-D04lpEzb.js → resolve-allowlist-common-BLoYaxEG.js} +2 -2
- package/dist/{resolve-channels-Dm7jEeg6.js → resolve-channels-D2yl_2CN.js} +5 -4
- package/dist/{resolve-users-bktrCUUU.js → resolve-users-BLxfqajZ.js} +2 -2
- package/dist/{retry-CLpJcXXf.js → retry-DqHCW6PV.js} +187 -19
- package/dist/{runtime-DGsSyDTS.js → runtime-BYamRVPN.js} +89 -86
- package/dist/{runtime-DoHjckYm.js → runtime-DrxVBTtp.js} +9 -10
- package/dist/runtime-api.js +19 -25
- package/dist/{sdk-runtime-QpY8PvCh.js → sdk-runtime-6tfgYDjY.js} +57 -89
- package/dist/{secret-config-contract-B1akrlyY.js → secret-config-contract-B3i6WxV5.js} +53 -25
- package/dist/secret-contract-api.js +1 -1
- package/dist/{security-audit-jGnJF__m.js → security-audit-DKfK-iPY.js} +11 -12
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/{security-audit.runtime-CPN0xFYz.js → security-audit.runtime-sKZyKgpx.js} +1 -1
- package/dist/{send-B7Q6Oc1I.js → send-UJHiAm4C.js} +82 -19
- package/dist/{send.components-iJyFXw9L.js → send.components-CrBJpGT_.js} +22 -39
- package/dist/{send.outbound-DS5tHwfR.js → send.outbound-D7JYmfm9.js} +77 -78
- package/dist/{send.shared-BmwFjW6T.js → send.shared-DZJ1akvQ.js} +136 -121
- package/dist/{sender-identity-QtalnCYv.js → sender-identity-BJtfyise.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-BIXIX6uJ.js → shared-Dii2HTn7.js} +41 -14
- package/dist/subagent-hooks-JyGrtQIl.js +49 -0
- package/dist/subagent-hooks-api.js +1 -6
- package/dist/{system-events-CTqDf6_s.js → system-events-BEmcj4xJ.js} +2 -2
- package/dist/{target-resolver-maOKSqO0.js → target-resolver-V-IYae6s.js} +3 -3
- package/dist/targets-CQp53cGj.js +3 -0
- package/dist/{thread-bindings-3L8p82GV.js → thread-bindings-DvYP79fy.js} +28 -26
- package/dist/{thread-bindings.manager-DCIH6WDC.js → thread-bindings.manager-Clm77DBM.js} +11 -14
- package/dist/{thread-bindings.session-updates-bJ2KQFY6.js → thread-bindings.session-updates-CJb-BpPL.js} +1 -1
- package/dist/{thread-bindings.state-aeV8HNgV.js → thread-bindings.state-D8OMdk4O.js} +1 -1
- package/dist/threading-CXuu_7o9.js +478 -0
- package/dist/transcripts-source-BLEMH_yi.js +270 -0
- package/dist/transcripts-source-api.js +7 -2
- package/dist/{typing-CS-nNVoe.js → typing-B9snnwMe.js} +1 -1
- package/dist/{voice-runtime-BEdqNcST.js → voice-runtime-DY6_o73o.js} +250 -150
- 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 +24 -10
- package/package.json +8 -10
- package/skills/discord/SKILL.md +1 -1
- package/dist/approval-message-safety-AcIxvrf3.js +0 -140
- package/dist/audit-core-xwjIczO0.js +0 -105
- package/dist/channel-actions-5s_hjYKd.js +0 -208
- package/dist/channel-api-CAJ0wMoV.js +0 -21
- package/dist/inbound-event-delivery-De2qxTrP.js +0 -39
- package/dist/provider.runtime-C9PnJZbZ.js +0 -2
- package/dist/runtime-api.actions.js +0 -3
- package/dist/runtime-api.lookup.js +0 -7
- package/dist/runtime-api.monitor-CHxrFPnW.js +0 -5
- package/dist/runtime-api.monitor.js +0 -8
- package/dist/runtime-api.send.js +0 -7
- package/dist/runtime-api.threads.js +0 -5
- package/dist/send.reactions-BAn0iiVQ.js +0 -78
- package/dist/send.receipt-IPI1p-SP.js +0 -66
- package/dist/subagent-hooks-CTt5KCJr.js +0 -120
- package/dist/subagent-progress-DhaE_h8a.js +0 -109
- package/dist/targets-yUFTHoAx.js +0 -3
- package/dist/transcripts-source-CfFMexGt.js +0 -123
- package/node_modules/p-map/index.d.ts +0 -155
- package/node_modules/p-map/index.js +0 -285
- package/node_modules/p-map/license +0 -9
- package/node_modules/p-map/package.json +0 -57
- package/node_modules/p-map/readme.md +0 -190
- 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
- package/dist/{allow-list-DnxIlPP2.js → allow-list-BDMimASD.js} +1 -1
- package/dist/{doctor-contract-DLa-BTiU.js → doctor-contract-DsWvKIXF.js} +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { c as resolveDiscordChannelInfoSafe } from "./thread-bindings.manager-
|
|
2
|
-
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
1
|
+
import { c as resolveDiscordChannelInfoSafe } from "./thread-bindings.manager-Clm77DBM.js";
|
|
3
2
|
import { ComponentType, StickerFormatType } from "discord-api-types/v10";
|
|
4
3
|
import { asDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
|
|
4
|
+
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
|
+
import { getFileExtension, normalizeMimeType } from "openclaw/plugin-sdk/media-mime";
|
|
5
6
|
import { getChildLogger, logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
6
7
|
import { saveRemoteMedia } from "openclaw/plugin-sdk/media-runtime";
|
|
7
8
|
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
8
9
|
import { formatMediaPlaceholderText } from "openclaw/plugin-sdk/channel-inbound";
|
|
9
|
-
import { getFileExtension, normalizeMimeType } from "openclaw/plugin-sdk/media-mime";
|
|
10
10
|
//#region extensions/discord/src/monitor/message-channel-info-state.ts
|
|
11
11
|
const discordChannelInfoCacheState = { entries: /* @__PURE__ */ new Map() };
|
|
12
12
|
//#endregion
|
|
@@ -68,6 +68,34 @@ async function resolveDiscordChannelInfo(client, channelId) {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
//#endregion
|
|
71
|
+
//#region extensions/discord/src/monitor/media-ssrf-policy.ts
|
|
72
|
+
const DISCORD_MEDIA_SSRF_POLICY = {
|
|
73
|
+
hostnameAllowlist: [
|
|
74
|
+
"cdn.discordapp.com",
|
|
75
|
+
"media.discordapp.net",
|
|
76
|
+
"*.discordapp.com",
|
|
77
|
+
"*.discordapp.net"
|
|
78
|
+
],
|
|
79
|
+
allowRfc2544BenchmarkRange: true
|
|
80
|
+
};
|
|
81
|
+
function mergeHostnameList(...lists) {
|
|
82
|
+
const merged = lists.flatMap((list) => list ?? []).map((value) => value.trim()).filter((value) => value.length > 0);
|
|
83
|
+
return merged.length > 0 ? uniqueStrings(merged) : void 0;
|
|
84
|
+
}
|
|
85
|
+
/** Merges caller network policy with the Discord-owned CDN allowlist. */
|
|
86
|
+
function resolveDiscordCdnPolicy(policy) {
|
|
87
|
+
if (!policy) return DISCORD_MEDIA_SSRF_POLICY;
|
|
88
|
+
const hostnameAllowlist = mergeHostnameList(DISCORD_MEDIA_SSRF_POLICY.hostnameAllowlist, policy.hostnameAllowlist);
|
|
89
|
+
const allowedHostnames = mergeHostnameList(DISCORD_MEDIA_SSRF_POLICY.allowedHostnames, policy.allowedHostnames);
|
|
90
|
+
return {
|
|
91
|
+
...DISCORD_MEDIA_SSRF_POLICY,
|
|
92
|
+
...policy,
|
|
93
|
+
...allowedHostnames ? { allowedHostnames } : {},
|
|
94
|
+
...hostnameAllowlist ? { hostnameAllowlist } : {},
|
|
95
|
+
allowRfc2544BenchmarkRange: Boolean(DISCORD_MEDIA_SSRF_POLICY.allowRfc2544BenchmarkRange) || Boolean(policy.allowRfc2544BenchmarkRange)
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
71
99
|
//#region extensions/discord/src/monitor/message-forwarded.ts
|
|
72
100
|
const FORWARD_MESSAGE_REFERENCE_TYPE = 1;
|
|
73
101
|
function normalizeDiscordStickerItems(value) {
|
|
@@ -116,15 +144,6 @@ function formatDiscordSnapshotAuthor(author) {
|
|
|
116
144
|
}
|
|
117
145
|
//#endregion
|
|
118
146
|
//#region extensions/discord/src/monitor/message-media.ts
|
|
119
|
-
const DISCORD_MEDIA_SSRF_POLICY = {
|
|
120
|
-
hostnameAllowlist: [
|
|
121
|
-
"cdn.discordapp.com",
|
|
122
|
-
"media.discordapp.net",
|
|
123
|
-
"*.discordapp.com",
|
|
124
|
-
"*.discordapp.net"
|
|
125
|
-
],
|
|
126
|
-
allowRfc2544BenchmarkRange: true
|
|
127
|
-
};
|
|
128
147
|
const AUDIO_ATTACHMENT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
129
148
|
".aac",
|
|
130
149
|
".caf",
|
|
@@ -171,26 +190,9 @@ function resolveDiscordMediaClassification(params) {
|
|
|
171
190
|
...kind ? { kind } : {}
|
|
172
191
|
};
|
|
173
192
|
}
|
|
174
|
-
function mergeHostnameList(...lists) {
|
|
175
|
-
const merged = lists.flatMap((list) => list ?? []).map((value) => value.trim()).filter((value) => value.length > 0);
|
|
176
|
-
if (merged.length === 0) return;
|
|
177
|
-
return uniqueStrings(merged);
|
|
178
|
-
}
|
|
179
|
-
function resolveDiscordMediaSsrFPolicy(policy) {
|
|
180
|
-
if (!policy) return DISCORD_MEDIA_SSRF_POLICY;
|
|
181
|
-
const hostnameAllowlist = mergeHostnameList(DISCORD_MEDIA_SSRF_POLICY.hostnameAllowlist, policy.hostnameAllowlist);
|
|
182
|
-
const allowedHostnames = mergeHostnameList(DISCORD_MEDIA_SSRF_POLICY.allowedHostnames, policy.allowedHostnames);
|
|
183
|
-
return {
|
|
184
|
-
...DISCORD_MEDIA_SSRF_POLICY,
|
|
185
|
-
...policy,
|
|
186
|
-
...allowedHostnames ? { allowedHostnames } : {},
|
|
187
|
-
...hostnameAllowlist ? { hostnameAllowlist } : {},
|
|
188
|
-
allowRfc2544BenchmarkRange: Boolean(DISCORD_MEDIA_SSRF_POLICY.allowRfc2544BenchmarkRange) || Boolean(policy.allowRfc2544BenchmarkRange)
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
193
|
async function resolveMediaList(message, maxBytes, options) {
|
|
192
194
|
const out = [];
|
|
193
|
-
const resolvedSsrFPolicy =
|
|
195
|
+
const resolvedSsrFPolicy = resolveDiscordCdnPolicy(options?.ssrfPolicy);
|
|
194
196
|
await appendResolvedMediaFromAttachments({
|
|
195
197
|
attachments: message.attachments ?? [],
|
|
196
198
|
maxBytes,
|
|
@@ -218,7 +220,7 @@ async function resolveMediaList(message, maxBytes, options) {
|
|
|
218
220
|
async function resolveForwardedMediaList(message, maxBytes, options) {
|
|
219
221
|
const snapshots = resolveDiscordMessageSnapshots(message);
|
|
220
222
|
const out = [];
|
|
221
|
-
const resolvedSsrFPolicy =
|
|
223
|
+
const resolvedSsrFPolicy = resolveDiscordCdnPolicy(options?.ssrfPolicy);
|
|
222
224
|
if (snapshots.length > 0) {
|
|
223
225
|
for (const snapshot of snapshots) {
|
|
224
226
|
await appendResolvedMediaFromAttachments({
|
|
@@ -276,7 +278,7 @@ async function resolveReferencedReplyMediaList(message, maxBytes, options) {
|
|
|
276
278
|
const referencedReply = resolveDiscordReferencedReplyMessage(message);
|
|
277
279
|
const out = [];
|
|
278
280
|
if (!referencedReply) return out;
|
|
279
|
-
const resolvedSsrFPolicy =
|
|
281
|
+
const resolvedSsrFPolicy = resolveDiscordCdnPolicy(options?.ssrfPolicy);
|
|
280
282
|
await appendResolvedMediaFromAttachments({
|
|
281
283
|
attachments: referencedReply.attachments,
|
|
282
284
|
maxBytes,
|
|
@@ -364,6 +366,7 @@ async function appendResolvedMediaFromAttachments(params) {
|
|
|
364
366
|
});
|
|
365
367
|
params.out.push({
|
|
366
368
|
path: saved.path,
|
|
369
|
+
fileName: attachment.filename,
|
|
367
370
|
...classification
|
|
368
371
|
});
|
|
369
372
|
} catch (err) {
|
|
@@ -434,6 +437,7 @@ async function appendResolvedMediaFromStickers(params) {
|
|
|
434
437
|
params.out.push({
|
|
435
438
|
path: saved.path,
|
|
436
439
|
contentType: saved.contentType,
|
|
440
|
+
fileName: candidate.fileName,
|
|
437
441
|
kind: "sticker"
|
|
438
442
|
});
|
|
439
443
|
lastError = null;
|
|
@@ -467,14 +471,11 @@ function formatDiscordMediaText(params) {
|
|
|
467
471
|
}
|
|
468
472
|
//#endregion
|
|
469
473
|
//#region extensions/discord/src/monitor/message-text.ts
|
|
470
|
-
function resolveDiscordEmbedText(
|
|
471
|
-
|
|
472
|
-
const description = normalizeOptionalString(embed?.description) ?? "";
|
|
473
|
-
if (title && description) return `${title}\n${description}`;
|
|
474
|
-
return title || description || "";
|
|
474
|
+
function resolveDiscordEmbedText(embeds) {
|
|
475
|
+
return (embeds ?? []).flatMap(({ title, description }) => [normalizeOptionalString(title), normalizeOptionalString(description)]).filter(Boolean).join("\n");
|
|
475
476
|
}
|
|
476
477
|
function resolveDiscordMessageText(message, options) {
|
|
477
|
-
const embedText = resolveDiscordEmbedText(message.embeds
|
|
478
|
+
const embedText = resolveDiscordEmbedText(message.embeds);
|
|
478
479
|
const componentText = extractDiscordComponentsV2Text(resolveDiscordMessageComponents(message));
|
|
479
480
|
const baseText = resolveDiscordMentions(normalizeOptionalString(message.content) || embedText || componentText || normalizeOptionalString(options?.fallbackText) || "", message);
|
|
480
481
|
if (!options?.includeForwarded) return baseText;
|
|
@@ -496,8 +497,8 @@ function resolveDiscordMentions(text, message) {
|
|
|
496
497
|
if (!Array.isArray(mentions) || mentions.length === 0) return text;
|
|
497
498
|
let out = text;
|
|
498
499
|
for (const user of mentions) {
|
|
499
|
-
const label = user.globalName || user.username;
|
|
500
|
-
out = out.replace(new RegExp(`<@!?${user.id}>`, "g"), `@${label}`);
|
|
500
|
+
const label = user.globalName || user.username || user.id;
|
|
501
|
+
out = out.replace(new RegExp(`<@!?${user.id}>`, "g"), () => `@${label}`);
|
|
501
502
|
}
|
|
502
503
|
return out;
|
|
503
504
|
}
|
|
@@ -557,9 +558,9 @@ function resolveDiscordSnapshotMessageText(snapshot) {
|
|
|
557
558
|
attachments: snapshot.attachments ?? void 0,
|
|
558
559
|
stickers: resolveDiscordSnapshotStickers(snapshot)
|
|
559
560
|
});
|
|
560
|
-
const embedText = resolveDiscordEmbedText(snapshot.embeds
|
|
561
|
+
const embedText = resolveDiscordEmbedText(snapshot.embeds);
|
|
561
562
|
const componentText = extractDiscordComponentsV2Text(snapshot.components);
|
|
562
563
|
return [content || embedText || componentText, attachmentText].filter(Boolean).join("\n");
|
|
563
564
|
}
|
|
564
565
|
//#endregion
|
|
565
|
-
export { formatDiscordMediaText as a, resolveReferencedReplyMediaList as c,
|
|
566
|
+
export { formatDiscordMediaText as a, resolveReferencedReplyMediaList as c, resolveDiscordCdnPolicy as d, resolveDiscordChannelInfo as f, resolveDiscordMessageText as i, hasDiscordMessageStickers as l, resolveDiscordForwardedMessagesTextFromSnapshots as n, resolveForwardedMediaList as o, resolveDiscordMessageChannelId as p, resolveDiscordMessageHistoryText as r, resolveMediaList as s, resolveDiscordEmbedText as t, resolveDiscordMessageStickers as u };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { a as chunkDiscordTextWithMode,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { n as
|
|
5
|
-
import { a as sendDiscordComponentMessageLazy, i as resolveDiscordComponentSpec, n as buildDiscordPresentationPayload, t as DISCORD_PRESENTATION_CAPABILITIES } from "./outbound-components-cTzwBJ60.js";
|
|
6
|
-
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
1
|
+
import { a as chunkDiscordTextWithMode, f as resolveDiscordReplyReference, g as normalizeDiscordOutboundTarget, l as toDiscordOutboundDeliveryResult, o as createDiscordSendReceipt, r as hasDiscordMessageCreateAmbiguity, s as createDiscordSendReceiptFromResults } from "./retry-DqHCW6PV.js";
|
|
2
|
+
import { t as createDiscordActionGate } from "./accounts-CfQ-vSyf.js";
|
|
3
|
+
import { g as notifyDiscordInboundEventOutboundPayloadSuccess, h as discordInboundEventDelivery, r as formatDiscordApprovalDisplayValue } from "./outbound-session-route-Bn4uXaoE.js";
|
|
4
|
+
import { a as sendDiscordComponentMessageLazy, i as resolveDiscordComponentSpec, n as buildDiscordPresentationPayload, t as DISCORD_PRESENTATION_CAPABILITIES } from "./outbound-components-wjv7yyAj.js";
|
|
7
5
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
6
|
+
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
|
+
import { getReplyPayloadTtsSupplement, resolvePayloadMediaUrls, sendPayloadMediaSequenceOrFallback, sendTextMediaPayload } from "openclaw/plugin-sdk/reply-payload";
|
|
8
|
+
import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
|
|
8
9
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
9
10
|
import { createReplyToFanout, resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-outbound";
|
|
10
11
|
import { attachChannelToResult, createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
|
|
11
|
-
import { getReplyPayloadTtsSupplement, resolvePayloadMediaUrls, sendPayloadMediaSequenceOrFallback, sendTextMediaPayload } from "openclaw/plugin-sdk/reply-payload";
|
|
12
12
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
13
13
|
import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
|
|
14
14
|
//#region extensions/discord/src/media-detection.ts
|
|
@@ -59,7 +59,7 @@ function normalizeDiscordApprovalPayload(payload) {
|
|
|
59
59
|
}
|
|
60
60
|
//#endregion
|
|
61
61
|
//#region extensions/discord/src/outbound-send-context.ts
|
|
62
|
-
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-
|
|
62
|
+
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-UJHiAm4C.js").then((n) => n.t));
|
|
63
63
|
function resolveDiscordOutboundTarget(params) {
|
|
64
64
|
if (params.threadId == null) return params.to;
|
|
65
65
|
const threadId = normalizeOptionalStringifiedId(params.threadId) ?? "";
|
|
@@ -95,11 +95,7 @@ async function createDiscordPayloadSendContext(ctx) {
|
|
|
95
95
|
}
|
|
96
96
|
//#endregion
|
|
97
97
|
//#region extensions/discord/src/outbound-payload.ts
|
|
98
|
-
|
|
99
|
-
return ctx.onDeliveryResult ? async (result) => {
|
|
100
|
-
await ctx.onDeliveryResult?.(attachChannelToResult("discord", result));
|
|
101
|
-
} : void 0;
|
|
102
|
-
}
|
|
98
|
+
const log$1 = createSubsystemLogger("discord/outbound");
|
|
103
99
|
function createDiscordUnknownPayloadResult(target) {
|
|
104
100
|
return {
|
|
105
101
|
messageId: "",
|
|
@@ -143,10 +139,39 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
143
139
|
});
|
|
144
140
|
const mediaUrls = resolvePayloadMediaUrls(payload);
|
|
145
141
|
const sendContext = await createDiscordPayloadSendContext(ctx);
|
|
142
|
+
const payloadContext = {
|
|
143
|
+
...ctx,
|
|
144
|
+
payload
|
|
145
|
+
};
|
|
146
|
+
const deliveredResults = [];
|
|
147
|
+
let createdThreadId;
|
|
148
|
+
payloadContext.onDeliveryResult = async (result) => {
|
|
149
|
+
await ctx.onDeliveryResult?.(result);
|
|
150
|
+
const threadId = result.receipt?.threadId;
|
|
151
|
+
if (threadId && payloadContext.threadId == null) {
|
|
152
|
+
payloadContext.threadId = threadId;
|
|
153
|
+
sendContext.target = `channel:${threadId}`;
|
|
154
|
+
createdThreadId = threadId;
|
|
155
|
+
}
|
|
156
|
+
if (createdThreadId && result.target?.kind === "channel" && result.receipt) deliveredResults.push({
|
|
157
|
+
messageId: result.messageId,
|
|
158
|
+
channelId: result.target.id,
|
|
159
|
+
receipt: result.receipt
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
const completeResult = (result) => createdThreadId ? {
|
|
163
|
+
...result,
|
|
164
|
+
receipt: createDiscordSendReceiptFromResults({
|
|
165
|
+
results: deliveredResults,
|
|
166
|
+
threadId: createdThreadId
|
|
167
|
+
})
|
|
168
|
+
} : result;
|
|
169
|
+
const completeDelivery = (result) => attachChannelToResult("discord", toDiscordOutboundDeliveryResult(completeResult(result)));
|
|
170
|
+
const onDeliveryResult = async (result) => await payloadContext.onDeliveryResult?.(attachChannelToResult("discord", toDiscordOutboundDeliveryResult(result)));
|
|
146
171
|
if (payload.audioAsVoice && mediaUrls.length > 0) {
|
|
147
172
|
const voiceReply = sendContext.resolveReply();
|
|
148
|
-
let
|
|
149
|
-
let lastResult;
|
|
173
|
+
let voiceFailure;
|
|
174
|
+
let lastResult = createDiscordUnknownPayloadResult(sendContext.target);
|
|
150
175
|
try {
|
|
151
176
|
const voiceUrl = expectDefined(mediaUrls.at(0), "non-empty Discord voice media URLs");
|
|
152
177
|
lastResult = await sendContext.sendVoice(sendContext.target, voiceUrl, {
|
|
@@ -155,41 +180,49 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
155
180
|
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
156
181
|
mediaReadFile: ctx.mediaReadFile
|
|
157
182
|
});
|
|
158
|
-
deliveredVoice = true;
|
|
159
183
|
} catch (err) {
|
|
160
184
|
if (hasDiscordMessageCreateAmbiguity(err)) throw err;
|
|
161
185
|
const supplement = getReplyPayloadTtsSupplement(payload);
|
|
162
186
|
const visibleFallbackText = payload.text?.trim() ? payload.text : void 0;
|
|
163
187
|
const hiddenFallbackText = supplement?.visibleTextAlreadyDelivered ? void 0 : supplement?.spokenText;
|
|
164
188
|
const fallbackText = visibleFallbackText ?? hiddenFallbackText;
|
|
165
|
-
if (!fallbackText
|
|
166
|
-
|
|
167
|
-
|
|
189
|
+
if (!fallbackText && !supplement?.visibleTextAlreadyDelivered) throw err;
|
|
190
|
+
log$1.warn("discord voice send failed; continuing without voice", { error: err });
|
|
191
|
+
if (fallbackText) await sendContext.send(sendContext.target, fallbackText, {
|
|
168
192
|
verbose: false,
|
|
169
193
|
...resolveDiscordFormattedDeliveryOptions(ctx, sendContext, voiceReply),
|
|
170
|
-
onDeliveryResult
|
|
194
|
+
onDeliveryResult
|
|
171
195
|
});
|
|
196
|
+
voiceFailure = { error: err };
|
|
172
197
|
}
|
|
173
|
-
if (
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
198
|
+
if (!voiceFailure) {
|
|
199
|
+
await payloadContext.onDeliveryResult?.(attachChannelToResult("discord", toDiscordOutboundDeliveryResult(lastResult)));
|
|
200
|
+
if (payload.text?.trim()) lastResult = await sendContext.send(sendContext.target, payload.text, {
|
|
201
|
+
verbose: false,
|
|
202
|
+
...resolveDiscordFormattedDeliveryOptions(ctx, sendContext),
|
|
203
|
+
onDeliveryResult
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
for (const mediaUrl of mediaUrls.slice(1)) try {
|
|
207
|
+
lastResult = await sendContext.send(sendContext.target, "", {
|
|
208
|
+
verbose: false,
|
|
209
|
+
...resolveDiscordMediaDeliveryOptions(ctx, sendContext, mediaUrl),
|
|
210
|
+
onDeliveryResult
|
|
211
|
+
});
|
|
212
|
+
} catch (err) {
|
|
213
|
+
if (!voiceFailure) throw err;
|
|
214
|
+
log$1.warn("discord remaining media send failed after voice failure", { error: err });
|
|
215
|
+
}
|
|
216
|
+
if (voiceFailure) throw voiceFailure.error;
|
|
217
|
+
return completeDelivery(lastResult);
|
|
185
218
|
}
|
|
219
|
+
const discordData = payload.channelData?.discord && typeof payload.channelData.discord === "object" && !Array.isArray(payload.channelData.discord) ? payload.channelData.discord : {};
|
|
220
|
+
const filename = normalizeOptionalString(discordData.filename);
|
|
186
221
|
const componentSpec = await resolveDiscordComponentSpec(payload);
|
|
187
222
|
if (!componentSpec) {
|
|
188
|
-
const discordData = payload.channelData?.discord && typeof payload.channelData.discord === "object" && !Array.isArray(payload.channelData.discord) ? payload.channelData.discord : {};
|
|
189
223
|
const nativeComponents = Array.isArray(discordData.components) ? discordData.components : void 0;
|
|
190
224
|
const embeds = Array.isArray(discordData.embeds) ? discordData.embeds : void 0;
|
|
191
|
-
|
|
192
|
-
if (nativeComponents || embeds?.length || filename) return attachChannelToResult("discord", await sendPayloadMediaSequenceOrFallback({
|
|
225
|
+
if (nativeComponents || embeds?.length || filename) return completeDelivery(await sendPayloadMediaSequenceOrFallback({
|
|
193
226
|
text: payload.text ?? "",
|
|
194
227
|
mediaUrls,
|
|
195
228
|
fallbackResult: createDiscordUnknownPayloadResult(sendContext.target),
|
|
@@ -199,7 +232,7 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
199
232
|
embeds,
|
|
200
233
|
filename,
|
|
201
234
|
...resolveDiscordFormattedDeliveryOptions(ctx, sendContext),
|
|
202
|
-
onDeliveryResult
|
|
235
|
+
onDeliveryResult
|
|
203
236
|
}),
|
|
204
237
|
send: async ({ text, mediaUrl, isFirst }) => await sendContext.send(sendContext.target, text, {
|
|
205
238
|
verbose: false,
|
|
@@ -207,60 +240,36 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
207
240
|
components: isFirst ? nativeComponents : void 0,
|
|
208
241
|
embeds: isFirst ? embeds : void 0,
|
|
209
242
|
filename: isFirst ? filename : void 0,
|
|
210
|
-
onDeliveryResult
|
|
243
|
+
onDeliveryResult
|
|
211
244
|
})
|
|
212
245
|
}));
|
|
213
|
-
|
|
214
|
-
...ctx,
|
|
215
|
-
payload
|
|
216
|
-
};
|
|
217
|
-
const deliveredResults = [];
|
|
218
|
-
let createdThreadId;
|
|
219
|
-
payloadContext.onDeliveryResult = async (result) => {
|
|
220
|
-
await ctx.onDeliveryResult?.(result);
|
|
221
|
-
const threadId = result.receipt?.threadId;
|
|
222
|
-
if (threadId && payloadContext.threadId == null) {
|
|
223
|
-
payloadContext.threadId = threadId;
|
|
224
|
-
createdThreadId = threadId;
|
|
225
|
-
}
|
|
226
|
-
if (createdThreadId && result.channelId && result.receipt) deliveredResults.push({
|
|
227
|
-
messageId: result.messageId,
|
|
228
|
-
channelId: result.channelId,
|
|
229
|
-
receipt: result.receipt
|
|
230
|
-
});
|
|
231
|
-
};
|
|
232
|
-
const result = await sendTextMediaPayload({
|
|
246
|
+
return completeResult(await sendTextMediaPayload({
|
|
233
247
|
channel: "discord",
|
|
234
248
|
ctx: payloadContext,
|
|
235
249
|
adapter: params.fallbackAdapter
|
|
236
|
-
});
|
|
237
|
-
return createdThreadId ? {
|
|
238
|
-
...result,
|
|
239
|
-
receipt: createDiscordSendReceiptFromResults({
|
|
240
|
-
results: deliveredResults,
|
|
241
|
-
threadId: createdThreadId
|
|
242
|
-
})
|
|
243
|
-
} : result;
|
|
250
|
+
}));
|
|
244
251
|
}
|
|
245
|
-
return
|
|
252
|
+
return completeDelivery(await sendPayloadMediaSequenceOrFallback({
|
|
246
253
|
text: payload.text ?? "",
|
|
247
254
|
mediaUrls,
|
|
248
255
|
fallbackResult: createDiscordUnknownPayloadResult(sendContext.target),
|
|
249
256
|
sendNoMedia: async () => {
|
|
250
257
|
return await sendDiscordComponentMessageLazy(sendContext.target, componentSpec, {
|
|
251
258
|
...resolveDiscordFormattedDeliveryOptions(ctx, sendContext),
|
|
252
|
-
|
|
259
|
+
filename,
|
|
260
|
+
onDeliveryResult
|
|
253
261
|
});
|
|
254
262
|
},
|
|
255
263
|
send: async ({ text, mediaUrl, isFirst }) => {
|
|
256
264
|
if (isFirst) return await sendDiscordComponentMessageLazy(sendContext.target, componentSpec, {
|
|
257
265
|
...resolveDiscordMediaDeliveryOptions(ctx, sendContext, mediaUrl),
|
|
258
|
-
|
|
266
|
+
filename,
|
|
267
|
+
onDeliveryResult
|
|
259
268
|
});
|
|
260
269
|
return await sendContext.send(sendContext.target, text, {
|
|
261
270
|
verbose: false,
|
|
262
271
|
...resolveDiscordMediaDeliveryOptions(ctx, sendContext, mediaUrl),
|
|
263
|
-
onDeliveryResult
|
|
272
|
+
onDeliveryResult
|
|
264
273
|
});
|
|
265
274
|
}
|
|
266
275
|
}));
|
|
@@ -268,8 +277,9 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
268
277
|
//#endregion
|
|
269
278
|
//#region extensions/discord/src/outbound-adapter.ts
|
|
270
279
|
const DISCORD_TEXT_CHUNK_LIMIT = 2e3;
|
|
271
|
-
const
|
|
272
|
-
const
|
|
280
|
+
const log = createSubsystemLogger("discord/outbound");
|
|
281
|
+
const loadDiscordThreadBindings = createLazyRuntimeModule(() => import("./thread-bindings-DvYP79fy.js").then((n) => n.t));
|
|
282
|
+
const loadDiscordComponentSendRuntime = createLazyRuntimeModule(() => import("./send.components-CrBJpGT_.js").then((n) => n.i));
|
|
273
283
|
function resolveDiscordWebhookIdentity(params) {
|
|
274
284
|
const usernameRaw = normalizeOptionalString(params.identity?.name);
|
|
275
285
|
const fallbackUsername = normalizeOptionalString(params.binding.label) ?? params.binding.agentId;
|
|
@@ -325,7 +335,7 @@ async function resolveDiscordOutboundMessageSend(params) {
|
|
|
325
335
|
cfg: params.cfg,
|
|
326
336
|
...resolveDiscordFormattingOptions({ formatting: params.formatting }),
|
|
327
337
|
onDeliveryResult: params.onDeliveryResult ? async (result) => {
|
|
328
|
-
await params.onDeliveryResult?.(attachChannelToResult("discord", result));
|
|
338
|
+
await params.onDeliveryResult?.(attachChannelToResult("discord", toDiscordOutboundDeliveryResult(result)));
|
|
329
339
|
} : void 0,
|
|
330
340
|
onPlatformSendDispatch: params.onPlatformSendDispatch
|
|
331
341
|
}
|
|
@@ -380,17 +390,18 @@ const discordOutbound = {
|
|
|
380
390
|
await ctx.onPlatformSendDispatch?.();
|
|
381
391
|
} : void 0
|
|
382
392
|
});
|
|
383
|
-
if (webhookResult) return webhookResult;
|
|
393
|
+
if (webhookResult) return toDiscordOutboundDeliveryResult(webhookResult);
|
|
384
394
|
} catch (error) {
|
|
385
395
|
if (webhookSelected) throw error;
|
|
396
|
+
log.warn("discord webhook persona send failed; falling back to bot send", { error });
|
|
386
397
|
}
|
|
387
398
|
}
|
|
388
399
|
const { send, target, options } = await resolveDiscordOutboundMessageSend(ctx);
|
|
389
|
-
return await send(target, ctx.text, options);
|
|
400
|
+
return toDiscordOutboundDeliveryResult(await send(target, ctx.text, options));
|
|
390
401
|
},
|
|
391
402
|
sendMedia: async (ctx) => {
|
|
392
403
|
const { send, target, options } = await resolveDiscordOutboundMessageSend(ctx);
|
|
393
|
-
if (ctx.audioAsVoice && ctx.mediaUrl) return await (resolveOutboundSendDep(ctx.deps, "discordVoice") ?? (await loadDiscordSendRuntime()).sendVoiceMessageDiscord)(target, ctx.mediaUrl, {
|
|
404
|
+
if (ctx.audioAsVoice && ctx.mediaUrl) return toDiscordOutboundDeliveryResult(await (resolveOutboundSendDep(ctx.deps, "discordVoice") ?? (await loadDiscordSendRuntime()).sendVoiceMessageDiscord)(target, ctx.mediaUrl, {
|
|
394
405
|
cfg: ctx.cfg,
|
|
395
406
|
reply: options.reply,
|
|
396
407
|
accountId: ctx.accountId ?? void 0,
|
|
@@ -399,7 +410,7 @@ const discordOutbound = {
|
|
|
399
410
|
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
400
411
|
mediaReadFile: ctx.mediaReadFile,
|
|
401
412
|
onPlatformSendDispatch: ctx.onPlatformSendDispatch
|
|
402
|
-
});
|
|
413
|
+
}));
|
|
403
414
|
const mediaOptions = {
|
|
404
415
|
...options,
|
|
405
416
|
mediaUrl: ctx.mediaUrl,
|
|
@@ -414,26 +425,41 @@ const discordOutbound = {
|
|
|
414
425
|
reply: options.reply?.scope === "all" ? options.reply : void 0
|
|
415
426
|
});
|
|
416
427
|
const threadId = captionResult.receipt?.threadId;
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
...captionResult,
|
|
428
|
+
return toDiscordOutboundDeliveryResult({
|
|
429
|
+
...threadId ? captionResult : mediaResult,
|
|
420
430
|
receipt: createDiscordSendReceiptFromResults({
|
|
421
431
|
results: [captionResult, mediaResult],
|
|
422
432
|
threadId
|
|
423
433
|
})
|
|
424
|
-
};
|
|
434
|
+
});
|
|
425
435
|
}
|
|
426
|
-
return await send(target, ctx.text, mediaOptions);
|
|
436
|
+
return toDiscordOutboundDeliveryResult(await send(target, ctx.text, mediaOptions));
|
|
427
437
|
},
|
|
428
|
-
sendPoll: async ({ cfg, to, poll, accountId, threadId, silent, onPlatformSendDispatch }) =>
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
438
|
+
sendPoll: async ({ cfg, to, poll, content, accountId, threadId, silent, sessionKey, inboundEventKind, onPlatformSendDispatch }) => {
|
|
439
|
+
if (!createDiscordActionGate({
|
|
440
|
+
cfg,
|
|
441
|
+
accountId
|
|
442
|
+
})("polls")) throw new Error("Discord polls are disabled.");
|
|
443
|
+
const outboundTo = resolveDiscordOutboundTarget({
|
|
444
|
+
to,
|
|
445
|
+
threadId
|
|
446
|
+
});
|
|
447
|
+
const result = await (await loadDiscordSendRuntime()).sendPollDiscord(outboundTo, poll, {
|
|
448
|
+
accountId: accountId ?? void 0,
|
|
449
|
+
content,
|
|
450
|
+
threadId: threadId ?? void 0,
|
|
451
|
+
silent: silent ?? void 0,
|
|
452
|
+
cfg,
|
|
453
|
+
onPlatformSendDispatch
|
|
454
|
+
});
|
|
455
|
+
discordInboundEventDelivery.notify({
|
|
456
|
+
sessionKey,
|
|
457
|
+
inboundEventKind,
|
|
458
|
+
to: outboundTo,
|
|
459
|
+
accountId
|
|
460
|
+
});
|
|
461
|
+
return result;
|
|
462
|
+
}
|
|
437
463
|
}),
|
|
438
464
|
adoptTargetFromDelivery: ({ result }) => {
|
|
439
465
|
const threadId = normalizeOptionalStringifiedId(result.receipt?.threadId);
|
|
@@ -456,9 +482,10 @@ const discordOutbound = {
|
|
|
456
482
|
to: target.to,
|
|
457
483
|
threadId: target.threadId
|
|
458
484
|
});
|
|
485
|
+
const channelId = result.target?.kind === "channel" ? result.target.id : to;
|
|
459
486
|
questionGatewayRuntime.registerChannelDelivery({
|
|
460
487
|
questionId,
|
|
461
|
-
deliveryId: `discord:${target.accountId ?? "default"}:${
|
|
488
|
+
deliveryId: `discord:${target.accountId ?? "default"}:${channelId}:${result.messageId}`,
|
|
462
489
|
finalize: async (statusLine) => {
|
|
463
490
|
const { editDiscordComponentMessage } = await loadDiscordComponentSendRuntime();
|
|
464
491
|
await editDiscordComponentMessage(to, result.messageId, {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { h as readDiscordComponentSpec } from "./
|
|
1
|
+
import { h as readDiscordComponentSpec } from "./components-Dk35LTf_.js";
|
|
2
|
+
import { resolveAskUserQuestionOptionIndices } from "openclaw/plugin-sdk/reply-payload";
|
|
2
3
|
import { createLazyRuntimeModule, createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
|
|
3
4
|
//#region extensions/discord/src/outbound-components.ts
|
|
4
5
|
const DISCORD_MESSAGE_COMPONENT_LIMIT = 40;
|
|
@@ -30,11 +31,11 @@ const DISCORD_PRESENTATION_CAPABILITIES = {
|
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
};
|
|
33
|
-
const loadDiscordComponentSend = createLazyRuntimeNamedExport(() => import("./send.components-
|
|
34
|
+
const loadDiscordComponentSend = createLazyRuntimeNamedExport(() => import("./send.components-CrBJpGT_.js").then((n) => n.i), "sendDiscordComponentMessage");
|
|
34
35
|
async function sendDiscordComponentMessageLazy(...args) {
|
|
35
36
|
return await (await loadDiscordComponentSend())(...args);
|
|
36
37
|
}
|
|
37
|
-
const loadDiscordSharedInteractive = createLazyRuntimeModule(() => import("./
|
|
38
|
+
const loadDiscordSharedInteractive = createLazyRuntimeModule(() => import("./components-Dk35LTf_.js").then((n) => n.a));
|
|
38
39
|
function addPayloadTextFallback(spec, payload) {
|
|
39
40
|
return spec.text ? spec : {
|
|
40
41
|
...spec,
|
|
@@ -68,7 +69,7 @@ function isDiscordComponentSpecWithinMessageLimit(params) {
|
|
|
68
69
|
}) <= DISCORD_MESSAGE_COMPONENT_LIMIT;
|
|
69
70
|
}
|
|
70
71
|
async function buildDiscordPresentationPayload(params) {
|
|
71
|
-
const componentSpec = (await loadDiscordSharedInteractive()).buildDiscordPresentationComponents(params.presentation);
|
|
72
|
+
const componentSpec = (await loadDiscordSharedInteractive()).buildDiscordPresentationComponents(params.presentation, { questionOptionIndices: resolveAskUserQuestionOptionIndices(params.payload) });
|
|
72
73
|
if (!componentSpec) return null;
|
|
73
74
|
const includesMedia = Boolean(params.payload.mediaUrl || params.payload.mediaUrls?.some((mediaUrl) => mediaUrl));
|
|
74
75
|
if (!isDiscordComponentSpecWithinMessageLimit({
|