@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
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { r as normalizeDiscordAllowList } from "./allow-list-BDMimASD.js";
|
|
2
|
+
import { defineStableChannelIngressIdentity } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
3
|
+
//#region extensions/discord/src/monitor/ingress-identity.ts
|
|
4
|
+
const DISCORD_ALLOW_LIST_PREFIXES = [
|
|
5
|
+
"discord:",
|
|
6
|
+
"user:",
|
|
7
|
+
"pk:"
|
|
8
|
+
];
|
|
9
|
+
const DISCORD_USER_ID_KIND = "stable-id";
|
|
10
|
+
const DISCORD_USER_NAME_KIND = "username";
|
|
11
|
+
function normalizeDiscordIdEntry(entry) {
|
|
12
|
+
const text = entry.trim();
|
|
13
|
+
if (!text) return null;
|
|
14
|
+
const maybeId = text.replace(/^<@!?/, "").replace(/>$/, "");
|
|
15
|
+
if (/^\d+$/.test(maybeId)) return maybeId;
|
|
16
|
+
const prefix = DISCORD_ALLOW_LIST_PREFIXES.find((entryPrefix) => text.startsWith(entryPrefix));
|
|
17
|
+
if (prefix) return text.slice(prefix.length).trim() || null;
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
function normalizeDiscordNameEntry(entry) {
|
|
21
|
+
const text = entry.trim();
|
|
22
|
+
if (!text || text === "*" || normalizeDiscordIdEntry(text) || /#\d{4}$/.test(text)) return null;
|
|
23
|
+
const nameSlug = normalizeDiscordAllowList([text], DISCORD_ALLOW_LIST_PREFIXES)?.names.values().next().value;
|
|
24
|
+
return typeof nameSlug === "string" && nameSlug ? nameSlug : null;
|
|
25
|
+
}
|
|
26
|
+
function normalizeDiscordTagEntry(entry) {
|
|
27
|
+
const text = entry.trim();
|
|
28
|
+
return /#\d{4}$/.test(text) ? normalizeDiscordNameSubject(text) : null;
|
|
29
|
+
}
|
|
30
|
+
function normalizeDiscordNameSubject(value) {
|
|
31
|
+
const nameSlug = normalizeDiscordAllowList([value], DISCORD_ALLOW_LIST_PREFIXES)?.names.values().next().value;
|
|
32
|
+
return typeof nameSlug === "string" && nameSlug ? nameSlug : null;
|
|
33
|
+
}
|
|
34
|
+
const discordIngressIdentity = defineStableChannelIngressIdentity({
|
|
35
|
+
resolveParticipant: (subject) => {
|
|
36
|
+
const kind = subject.aliases?.participantKind;
|
|
37
|
+
const id = subject.stableId;
|
|
38
|
+
return typeof id === "string" && id && (kind === "user" || kind === "bot" || kind === "pluralkit-member") ? {
|
|
39
|
+
domain: kind === "pluralkit-member" ? "pluralkit" : "discord",
|
|
40
|
+
idKind: kind,
|
|
41
|
+
id
|
|
42
|
+
} : void 0;
|
|
43
|
+
},
|
|
44
|
+
key: "discordUserId",
|
|
45
|
+
kind: DISCORD_USER_ID_KIND,
|
|
46
|
+
authentication: "verified",
|
|
47
|
+
normalizeEntry: normalizeDiscordIdEntry,
|
|
48
|
+
normalizeSubject: (value) => value.trim() || null,
|
|
49
|
+
sensitivity: "pii",
|
|
50
|
+
aliases: [["discordUserName", normalizeDiscordNameEntry], ["discordUserTag", normalizeDiscordTagEntry]].map(([key, normalizeEntry]) => ({
|
|
51
|
+
key,
|
|
52
|
+
kind: DISCORD_USER_NAME_KIND,
|
|
53
|
+
normalizeEntry,
|
|
54
|
+
normalizeSubject: normalizeDiscordNameSubject,
|
|
55
|
+
authentication: "mutable",
|
|
56
|
+
sensitivity: "pii"
|
|
57
|
+
}))
|
|
58
|
+
});
|
|
59
|
+
//#endregion
|
|
60
|
+
export { discordIngressIdentity as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
2
|
-
import { c as resolveDiscordChannelInfoSafe, d as resolveDiscordChannelParentSafe, l as resolveDiscordChannelNameSafe, s as resolveDiscordChannelIdSafe } from "./thread-bindings.manager-
|
|
3
|
-
import {
|
|
4
|
-
import { i as resolveDiscordMessageText, l as
|
|
2
|
+
import { c as resolveDiscordChannelInfoSafe, d as resolveDiscordChannelParentSafe, l as resolveDiscordChannelNameSafe, s as resolveDiscordChannelIdSafe } from "./thread-bindings.manager-Clm77DBM.js";
|
|
3
|
+
import { v as mapGatewayDispatchData } from "./provider-LXiOcJrH.js";
|
|
4
|
+
import { d as resolveDiscordCdnPolicy, i as resolveDiscordMessageText, l as hasDiscordMessageStickers, p as resolveDiscordMessageChannelId } from "./message-text-Ca8M6TU8.js";
|
|
5
5
|
import { logDebug } from "openclaw/plugin-sdk/logging-core";
|
|
6
6
|
import { GatewayDispatchEvents } from "discord-api-types/v10";
|
|
7
7
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -248,7 +248,7 @@ function applyImplicitReplyBatchGate(ctx, replyToMode, isBatched) {
|
|
|
248
248
|
}
|
|
249
249
|
//#endregion
|
|
250
250
|
//#region extensions/discord/src/monitor/message-run-queue.ts
|
|
251
|
-
const loadMessageProcessRuntime = createLazyRuntimeModule(() => import("./message-handler.process
|
|
251
|
+
const loadMessageProcessRuntime = createLazyRuntimeModule(() => import("./message-handler.process-DyFPDLCt.js"));
|
|
252
252
|
async function processDiscordQueuedMessage(params) {
|
|
253
253
|
const abortSignal = params.job.runtime.abortSignal && params.lifecycleSignal ? AbortSignal.any([params.job.runtime.abortSignal, params.lifecycleSignal]) : params.job.runtime.abortSignal ?? params.lifecycleSignal;
|
|
254
254
|
try {
|
|
@@ -335,7 +335,7 @@ function createDiscordMessageRunQueue(params) {
|
|
|
335
335
|
}
|
|
336
336
|
//#endregion
|
|
337
337
|
//#region extensions/discord/src/monitor/message-dispatcher.ts
|
|
338
|
-
const loadMessagePreflightRuntime = createLazyRuntimeModule(() => import("./message-handler.preflight-
|
|
338
|
+
const loadMessagePreflightRuntime = createLazyRuntimeModule(() => import("./message-handler.preflight-DrszWuHw.js"));
|
|
339
339
|
function isNonEmptyString(value) {
|
|
340
340
|
return typeof value === "string" && value.length > 0;
|
|
341
341
|
}
|
package/dist/{message-handler.preflight-Bzg_Hawz.js → message-handler.preflight-DrszWuHw.js}
RENAMED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { s as resolveDefaultDiscordAccountId } from "./accounts-
|
|
3
|
-
import { C as resolveTimestampMs, S as resolveDiscordSystemLocation, _ as resolveDiscordShouldRequireMention, a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, f as resolveDiscordGuildEntry, i as normalizeDiscordDisplaySlug,
|
|
1
|
+
import { W as Message, jt as getChannelMessage, y as discord_exports } from "./retry-DqHCW6PV.js";
|
|
2
|
+
import { s as resolveDefaultDiscordAccountId } from "./accounts-CfQ-vSyf.js";
|
|
3
|
+
import { C as resolveTimestampMs, S as resolveDiscordSystemLocation, _ as resolveDiscordShouldRequireMention, a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, f as resolveDiscordGuildEntry, i as normalizeDiscordDisplaySlug, p as resolveDiscordMemberAccessState, x as formatDiscordUserTag } from "./allow-list-BDMimASD.js";
|
|
4
|
+
import { t as isDiscordThreadChannelType } from "./channel-type-CVLZyGYS.js";
|
|
4
5
|
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-B9cy6RvQ.js";
|
|
5
|
-
import {
|
|
6
|
-
import { t as resolveDiscordConversationBindingRoute } from "./conversation-binding-route-
|
|
7
|
-
import { c as resolveDiscordChannelInfoSafe, l as resolveDiscordChannelNameSafe } from "./thread-bindings.manager-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { a as buildDiscordRoutePeer, c as resolveDiscordEffectiveRoute, f as resolveDiscordRuntimeBindingConversationId, s as resolveDiscordConversationRoute, u as resolveDiscordConversationIdentity } from "./outbound-session-route-Bn4uXaoE.js";
|
|
7
|
+
import { t as resolveDiscordConversationBindingRoute } from "./conversation-binding-route-BjvX4e35.js";
|
|
8
|
+
import { c as resolveDiscordChannelInfoSafe, l as resolveDiscordChannelNameSafe } from "./thread-bindings.manager-Clm77DBM.js";
|
|
9
|
+
import { S as resolveDiscordTextCommandAccess, _ as handleDiscordDmCommandDecision, n as resolveDiscordPreflightChannelAccess, x as resolveDiscordDmCommandAccess } from "./provider-LXiOcJrH.js";
|
|
10
|
+
import { f as resolveDiscordChannelInfo, i as resolveDiscordMessageText, o as resolveForwardedMediaList, p as resolveDiscordMessageChannelId, r as resolveDiscordMessageHistoryText, s as resolveMediaList, u as resolveDiscordMessageStickers } from "./message-text-Ca8M6TU8.js";
|
|
10
11
|
import { n as resolveDiscordWebhookId, t as resolveDiscordSenderIdentity } from "./sender-identity-BJtfyise.js";
|
|
11
12
|
import { t as createDiscordHistorySenderProvenance } from "./message-handler.history-CJOsN9w5.js";
|
|
12
13
|
import { logDebug } from "openclaw/plugin-sdk/logging-core";
|
|
@@ -28,7 +29,7 @@ import { shouldHandleTextCommands } from "openclaw/plugin-sdk/command-surface";
|
|
|
28
29
|
import { createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
|
|
29
30
|
//#region extensions/discord/src/monitor/message-handler.dm-preflight.ts
|
|
30
31
|
const loadConversationRuntime$1 = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/conversation-binding-runtime"));
|
|
31
|
-
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-
|
|
32
|
+
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-UJHiAm4C.js").then((n) => n.t));
|
|
32
33
|
function resolveDiscordDmPairingSenderId(sender) {
|
|
33
34
|
return sender.isPluralKit ? `pk:${sender.id}` : sender.id;
|
|
34
35
|
}
|
|
@@ -53,7 +54,9 @@ async function resolveDiscordDmPreflightAccess(params) {
|
|
|
53
54
|
sender: {
|
|
54
55
|
id: params.sender.id,
|
|
55
56
|
name: params.sender.name,
|
|
56
|
-
tag: params.sender.tag
|
|
57
|
+
tag: params.sender.tag,
|
|
58
|
+
isPluralKit: params.sender.isPluralKit,
|
|
59
|
+
authorKind: params.author.bot ? "bot" : "user"
|
|
57
60
|
},
|
|
58
61
|
allowNameMatching: params.allowNameMatching,
|
|
59
62
|
cfg: params.preflight.cfg,
|
|
@@ -267,72 +270,6 @@ async function hydrateDiscordMessageIfNeeded(params) {
|
|
|
267
270
|
};
|
|
268
271
|
}
|
|
269
272
|
//#endregion
|
|
270
|
-
//#region extensions/discord/src/monitor/message-handler.preflight-channel-access.ts
|
|
271
|
-
function resolveDiscordPreflightChannelAccess(params) {
|
|
272
|
-
if (params.isGuildMessage && params.channelConfig?.enabled === false) {
|
|
273
|
-
logDebug(`[discord-preflight] drop: channel disabled`);
|
|
274
|
-
logVerbose(`Blocked discord channel ${params.messageChannelId} (channel disabled, ${params.channelMatchMeta})`);
|
|
275
|
-
return {
|
|
276
|
-
allowed: false,
|
|
277
|
-
channelAllowlistConfigured: false,
|
|
278
|
-
channelAllowed: false
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
const groupDmAllowed = params.isGroupDm && resolveGroupDmAllow({
|
|
282
|
-
channels: params.groupDmChannels,
|
|
283
|
-
channelId: params.messageChannelId,
|
|
284
|
-
channelName: params.displayChannelName,
|
|
285
|
-
channelSlug: params.displayChannelSlug
|
|
286
|
-
});
|
|
287
|
-
if (params.isGroupDm && !groupDmAllowed) return {
|
|
288
|
-
allowed: false,
|
|
289
|
-
channelAllowlistConfigured: false,
|
|
290
|
-
channelAllowed: false
|
|
291
|
-
};
|
|
292
|
-
const channelAllowlistConfigured = Boolean(params.guildInfo?.channels) && Object.keys(params.guildInfo?.channels ?? {}).length > 0;
|
|
293
|
-
const channelAllowed = params.channelConfig?.allowed !== false;
|
|
294
|
-
if (params.isGuildMessage && !isDiscordGroupAllowedByPolicy({
|
|
295
|
-
groupPolicy: params.groupPolicy,
|
|
296
|
-
guildAllowlisted: Boolean(params.guildInfo),
|
|
297
|
-
channelAllowlistConfigured,
|
|
298
|
-
channelAllowed
|
|
299
|
-
})) {
|
|
300
|
-
if (params.groupPolicy === "disabled") {
|
|
301
|
-
logDebug(`[discord-preflight] drop: groupPolicy disabled`);
|
|
302
|
-
logVerbose(`discord: drop guild message (groupPolicy: disabled, ${params.channelMatchMeta})`);
|
|
303
|
-
} else if (!channelAllowlistConfigured) {
|
|
304
|
-
logDebug(`[discord-preflight] drop: groupPolicy allowlist, no channel allowlist configured`);
|
|
305
|
-
logVerbose(`discord: drop guild message (groupPolicy: allowlist, no channel allowlist, ${params.channelMatchMeta})`);
|
|
306
|
-
} else {
|
|
307
|
-
logDebug(`[discord] Ignored message from channel ${params.messageChannelId} (not in guild allowlist). Add to guilds.<guildId>.channels to enable.`);
|
|
308
|
-
logVerbose(`Blocked discord channel ${params.messageChannelId} not in guild channel allowlist (groupPolicy: allowlist, ${params.channelMatchMeta})`);
|
|
309
|
-
}
|
|
310
|
-
return {
|
|
311
|
-
allowed: false,
|
|
312
|
-
channelAllowlistConfigured,
|
|
313
|
-
channelAllowed
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
if (params.isGuildMessage && params.channelConfig?.allowed === false) {
|
|
317
|
-
logDebug(`[discord-preflight] drop: channelConfig.allowed===false`);
|
|
318
|
-
logVerbose(`Blocked discord channel ${params.messageChannelId} not in guild channel allowlist (${params.channelMatchMeta})`);
|
|
319
|
-
return {
|
|
320
|
-
allowed: false,
|
|
321
|
-
channelAllowlistConfigured,
|
|
322
|
-
channelAllowed
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
if (params.isGuildMessage) {
|
|
326
|
-
logDebug(`[discord-preflight] pass: channel allowed`);
|
|
327
|
-
logVerbose(`discord: allow channel ${params.messageChannelId} (${params.channelMatchMeta})`);
|
|
328
|
-
}
|
|
329
|
-
return {
|
|
330
|
-
allowed: true,
|
|
331
|
-
channelAllowlistConfigured,
|
|
332
|
-
channelAllowed
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
//#endregion
|
|
336
273
|
//#region extensions/discord/src/monitor/message-handler.preflight-channel-context.ts
|
|
337
274
|
function resolveDiscordPreflightChannelContext(params) {
|
|
338
275
|
const threadName = params.threadChannel?.name;
|
|
@@ -401,9 +338,6 @@ function isBoundThreadBotSystemMessage(params) {
|
|
|
401
338
|
if (!text) return false;
|
|
402
339
|
return DISCORD_BOUND_THREAD_SYSTEM_PREFIXES.some((prefix) => text.startsWith(prefix));
|
|
403
340
|
}
|
|
404
|
-
function isDiscordThreadChannelType(type) {
|
|
405
|
-
return type === discord_exports.ChannelType.PublicThread || type === discord_exports.ChannelType.PrivateThread || type === discord_exports.ChannelType.AnnouncementThread;
|
|
406
|
-
}
|
|
407
341
|
function isDiscordThreadChannelMessage(params) {
|
|
408
342
|
if (!params.isGuildMessage) return false;
|
|
409
343
|
const channel = "channel" in params.message ? params.message.channel : void 0;
|
|
@@ -489,10 +423,10 @@ function logDiscordPreflightInboundSummary(params) {
|
|
|
489
423
|
}
|
|
490
424
|
//#endregion
|
|
491
425
|
//#region extensions/discord/src/monitor/message-handler.preflight-runtime.ts
|
|
492
|
-
const loadPluralKitRuntime = createLazyRuntimeModule(() => import("./pluralkit-
|
|
426
|
+
const loadPluralKitRuntime = createLazyRuntimeModule(() => import("./pluralkit-9EuEN4UD.js").then((n) => n.n));
|
|
493
427
|
const loadPreflightAudioRuntime = createLazyRuntimeModule(() => import("./preflight-audio-DrnqFA8U.js"));
|
|
494
|
-
const loadSystemEventsRuntime = createLazyRuntimeModule(() => import("./system-events-
|
|
495
|
-
const loadDiscordThreadingRuntime = createLazyRuntimeModule(() => import("./threading-
|
|
428
|
+
const loadSystemEventsRuntime = createLazyRuntimeModule(() => import("./system-events-BEmcj4xJ.js"));
|
|
429
|
+
const loadDiscordThreadingRuntime = createLazyRuntimeModule(() => import("./threading-CXuu_7o9.js").then((n) => n.t));
|
|
496
430
|
function isPreflightAborted(abortSignal) {
|
|
497
431
|
return Boolean(abortSignal?.aborted);
|
|
498
432
|
}
|
|
@@ -707,7 +641,7 @@ async function preflightDiscordMessage(params) {
|
|
|
707
641
|
channelType: channelInfo?.type
|
|
708
642
|
});
|
|
709
643
|
const messageText = resolveDiscordMessageText(message, { includeForwarded: true });
|
|
710
|
-
const injectedBoundThreadBinding = !isDirectMessage && !isGroupDm ? resolveInjectedBoundThreadLookupRecord({
|
|
644
|
+
const injectedBoundThreadBinding = !isDirectMessage && !isGroupDm && (webhookId || author.bot) ? resolveInjectedBoundThreadLookupRecord({
|
|
711
645
|
threadBindings: params.threadBindings,
|
|
712
646
|
threadId: messageChannelId
|
|
713
647
|
}) : void 0;
|
|
@@ -967,7 +901,9 @@ async function preflightDiscordMessage(params) {
|
|
|
967
901
|
sender: {
|
|
968
902
|
id: sender.id,
|
|
969
903
|
name: sender.name,
|
|
970
|
-
tag: sender.tag
|
|
904
|
+
tag: sender.tag,
|
|
905
|
+
isPluralKit: sender.isPluralKit,
|
|
906
|
+
authorKind: author.bot ? "bot" : "user"
|
|
971
907
|
},
|
|
972
908
|
memberAccessConfigured: hasAccessRestrictions,
|
|
973
909
|
memberAllowed,
|
|
@@ -1,33 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Dt as deleteChannelMessage, a as chunkDiscordTextWithMode, kt as editChannelMessage, v as resolveDiscordChannelId, wt as createChannelMessage, y as discord_exports } from "./retry-DqHCW6PV.js";
|
|
2
|
+
import { p as resolveDiscordMaxLinesPerMessage } from "./accounts-CfQ-vSyf.js";
|
|
3
3
|
import { C as resolveTimestampMs, a as normalizeDiscordSlug, r as normalizeDiscordAllowList } from "./allow-list-BDMimASD.js";
|
|
4
|
-
import {
|
|
5
|
-
import { i as discordTextHasBroadcastMention } from "./send.outbound-
|
|
6
|
-
import {
|
|
4
|
+
import { F as createDiscordRuntimeAccountContext, P as createDiscordRestClient, d as resolveDiscordTargetChannelId, k as resolveDiscordMessageFlags } from "./send.shared-DZJ1akvQ.js";
|
|
5
|
+
import { i as discordTextHasBroadcastMention } from "./send.outbound-D7JYmfm9.js";
|
|
6
|
+
import { a as removeReactionDiscord, f as editMessageDiscord, r as reactMessageDiscord } from "./send-UJHiAm4C.js";
|
|
7
7
|
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-B9cy6RvQ.js";
|
|
8
|
-
import
|
|
9
|
-
import "./
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { a as
|
|
14
|
-
import { a as formatDiscordMediaText, c as resolveReferencedReplyMediaList, d as resolveDiscordMessageStickers, i as resolveDiscordMessageText } from "./message-utils-BXLLnFl6.js";
|
|
15
|
-
import { a as resolveDiscordThreadStarter, n as resolveDiscordAutoThreadReplyPlan } from "./threading-DU6pgeGm.js";
|
|
8
|
+
import "./targets-CQp53cGj.js";
|
|
9
|
+
import { a as buildDiscordRoutePeer, h as discordInboundEventDelivery, u as resolveDiscordConversationIdentity } from "./outbound-session-route-Bn4uXaoE.js";
|
|
10
|
+
import { t as DISCORD_TEXT_CHUNK_LIMIT } from "./outbound-adapter-Dif8p481.js";
|
|
11
|
+
import { a as formatDiscordReplySkip, c as buildGuildLabel, g as createDiscordSupplementalContextAccessChecker, h as buildDiscordInboundAccessContext, i as formatDiscordReplyDeliveryFailure, l as resolveReplyContext, o as sanitizeDiscordFrontChannelReplyPayloads, r as deliverDiscordReply, s as buildDirectLabel } from "./provider-LXiOcJrH.js";
|
|
12
|
+
import { a as formatDiscordMediaText, c as resolveReferencedReplyMediaList, i as resolveDiscordMessageText, u as resolveDiscordMessageStickers } from "./message-text-Ca8M6TU8.js";
|
|
13
|
+
import { a as resolveDiscordThreadStarter, n as resolveDiscordAutoThreadReplyPlan } from "./threading-CXuu_7o9.js";
|
|
16
14
|
import { n as resolveDiscordWebhookId } from "./sender-identity-BJtfyise.js";
|
|
17
15
|
import { t as beginDiscordActiveTurnThreadRoute } from "./active-turn-thread-route-fmHl1HNd.js";
|
|
18
16
|
import { n as filterDiscordHistoryEntriesForContext, t as createDiscordHistorySenderProvenance } from "./message-handler.history-CJOsN9w5.js";
|
|
19
|
-
import { t as sendTyping } from "./typing-
|
|
17
|
+
import { t as sendTyping } from "./typing-B9snnwMe.js";
|
|
20
18
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
21
19
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
22
20
|
import { buildAgentSessionKey, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
|
|
21
|
+
import { getReplyPayloadTtsSupplement, isReplyPayloadNonTerminalToolErrorWarning, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
23
22
|
import { danger, logVerbose, shouldLogVerbose, sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
24
23
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
25
24
|
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
26
25
|
import { resolveChunkMode } from "openclaw/plugin-sdk/reply-chunking";
|
|
27
26
|
import { convertMarkdownTables, stripInlineDirectiveTagsForDelivery, stripReasoningTagsFromText } from "openclaw/plugin-sdk/text-chunking";
|
|
28
|
-
import { bindIngressLifecycleToReplyOptions, buildChannelProgressDraftLine, buildChannelProgressDraftLineForEntry, createChannelMessageReplyPipeline, createChannelProgressDraftCompositor,
|
|
27
|
+
import { bindIngressLifecycleToReplyOptions, buildChannelProgressDraftLine, buildChannelProgressDraftLineForEntry, createChannelMessageReplyPipeline, createChannelProgressDraftCompositor, createFinalizableDraftStreamControlsForState, createTypingCallbacks, defineFinalizableLivePreviewAdapter, deliverWithFinalizableLivePreviewAdapter, resolveChannelDraftStreamingChunking, resolveChannelMessageSourceReplyDeliveryMode, resolveChannelPreviewStreamMode, resolveChannelStreamingBlockEnabled, resolveChannelStreamingPreviewCommandText, resolveChannelStreamingPreviewToolProgress, resolveChannelStreamingProgressNarration, resolveChannelStreamingSuppressDefaultToolProgressMessages, resolveTranscriptBackedChannelFinalText } from "openclaw/plugin-sdk/channel-outbound";
|
|
29
28
|
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
|
|
30
|
-
import { getReplyPayloadTtsSupplement, isReplyPayloadNonTerminalToolErrorWarning, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
|
31
29
|
import { evaluateSupplementalContextVisibility } from "openclaw/plugin-sdk/security-runtime";
|
|
32
30
|
import { resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/conversation-runtime";
|
|
33
31
|
import { resolveAgentConfig } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
@@ -199,6 +197,7 @@ async function buildDiscordMessageProcessContext(params) {
|
|
|
199
197
|
const starter = await resolveDiscordThreadStarter({
|
|
200
198
|
channel: threadChannel,
|
|
201
199
|
client,
|
|
200
|
+
accountId,
|
|
202
201
|
parentId: threadParentId,
|
|
203
202
|
parentType: threadParentType,
|
|
204
203
|
resolveTimestampMs
|
|
@@ -792,7 +791,7 @@ function createDiscordDraftStream(params) {
|
|
|
792
791
|
let streamGeneration = 0;
|
|
793
792
|
let activeCreateGeneration;
|
|
794
793
|
let discardActiveCreate = false;
|
|
795
|
-
let
|
|
794
|
+
let pendingCleanupMessages = [];
|
|
796
795
|
const sendOrEditStreamMessage = async (text) => {
|
|
797
796
|
const generation = streamGeneration;
|
|
798
797
|
if (streamState.stopped && !streamState.final) return false;
|
|
@@ -833,11 +832,11 @@ function createDiscordDraftStream(params) {
|
|
|
833
832
|
activeCreateGeneration = void 0;
|
|
834
833
|
discardActiveCreate = false;
|
|
835
834
|
if (generation !== streamGeneration) {
|
|
836
|
-
if (shouldDiscardStaleCreate && typeof sentMessageId === "string" && sentMessageId)
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
}
|
|
835
|
+
if (shouldDiscardStaleCreate && typeof sentMessageId === "string" && sentMessageId) await deleteCleanupMessage({
|
|
836
|
+
channelId,
|
|
837
|
+
messageId: sentMessageId,
|
|
838
|
+
warnPrefix: "discord stale stream preview cleanup failed"
|
|
839
|
+
});
|
|
841
840
|
return true;
|
|
842
841
|
}
|
|
843
842
|
if (typeof sentMessageId !== "string" || !sentMessageId) {
|
|
@@ -858,24 +857,10 @@ function createDiscordDraftStream(params) {
|
|
|
858
857
|
return false;
|
|
859
858
|
}
|
|
860
859
|
};
|
|
861
|
-
const
|
|
862
|
-
const clearMessageId = () => {
|
|
863
|
-
streamMessageId = void 0;
|
|
864
|
-
};
|
|
865
|
-
const isValidStreamMessageId = (value) => typeof value === "string";
|
|
866
|
-
const deleteStreamMessage = async (messageId) => {
|
|
867
|
-
await deleteChannelMessage(rest, channelId, messageId);
|
|
868
|
-
};
|
|
869
|
-
const { loop, update, stop, clear, discardPending, seal } = createFinalizableDraftLifecycle({
|
|
860
|
+
const { loop, update, stop, discardPending, seal } = createFinalizableDraftStreamControlsForState({
|
|
870
861
|
throttleMs,
|
|
871
862
|
state: streamState,
|
|
872
|
-
sendOrEditStreamMessage
|
|
873
|
-
readMessageId,
|
|
874
|
-
clearMessageId,
|
|
875
|
-
isValidMessageId: isValidStreamMessageId,
|
|
876
|
-
deleteMessage: deleteStreamMessage,
|
|
877
|
-
warn: params.warn,
|
|
878
|
-
warnPrefix: "discord stream preview cleanup failed"
|
|
863
|
+
sendOrEditStreamMessage
|
|
879
864
|
});
|
|
880
865
|
const forceNewMessage = (mode = "preserve") => {
|
|
881
866
|
if (mode === "discard" && activeCreateGeneration !== void 0) discardActiveCreate = true;
|
|
@@ -887,16 +872,19 @@ function createDiscordDraftStream(params) {
|
|
|
887
872
|
loop.resetPending();
|
|
888
873
|
loop.resetThrottleWindow();
|
|
889
874
|
};
|
|
890
|
-
const
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
for (const stale of pending) try {
|
|
894
|
-
await deleteChannelMessage(rest, stale.channelId, stale.messageId);
|
|
875
|
+
const deleteCleanupMessage = async (message) => {
|
|
876
|
+
try {
|
|
877
|
+
await deleteChannelMessage(rest, message.channelId, message.messageId);
|
|
895
878
|
} catch (err) {
|
|
896
|
-
|
|
897
|
-
params.warn?.(
|
|
879
|
+
pendingCleanupMessages.push(message);
|
|
880
|
+
params.warn?.(`${message.warnPrefix}: ${formatErrorMessage(err)}`);
|
|
898
881
|
}
|
|
899
882
|
};
|
|
883
|
+
const cleanupPendingMessages = async () => {
|
|
884
|
+
const pending = pendingCleanupMessages;
|
|
885
|
+
pendingCleanupMessages = [];
|
|
886
|
+
for (const message of pending) await deleteCleanupMessage(message);
|
|
887
|
+
};
|
|
900
888
|
const retarget = async (nextChannelId) => {
|
|
901
889
|
const normalized = nextChannelId.trim();
|
|
902
890
|
if (!normalized || normalized === channelId) return;
|
|
@@ -919,33 +907,33 @@ function createDiscordDraftStream(params) {
|
|
|
919
907
|
if (previousMessageId) {
|
|
920
908
|
const stale = {
|
|
921
909
|
channelId: previousChannelId,
|
|
922
|
-
messageId: previousMessageId
|
|
910
|
+
messageId: previousMessageId,
|
|
911
|
+
warnPrefix: "discord stream preview retarget cleanup failed"
|
|
923
912
|
};
|
|
924
913
|
if (!streamMessageId) {
|
|
925
|
-
|
|
914
|
+
pendingCleanupMessages.push(stale);
|
|
926
915
|
throw new Error("discord stream preview retarget replacement failed");
|
|
927
916
|
}
|
|
928
|
-
|
|
929
|
-
await deleteChannelMessage(rest, previousChannelId, previousMessageId);
|
|
930
|
-
} catch (err) {
|
|
931
|
-
retargetedCleanup.push(stale);
|
|
932
|
-
params.warn?.(`discord stream preview retarget cleanup failed: ${formatErrorMessage(err)}`);
|
|
933
|
-
}
|
|
917
|
+
await deleteCleanupMessage(stale);
|
|
934
918
|
}
|
|
935
919
|
};
|
|
936
920
|
const deleteCurrentMessage = async () => {
|
|
937
921
|
loop.resetPending();
|
|
938
922
|
await loop.waitForInFlight();
|
|
939
|
-
const
|
|
923
|
+
const currentMessage = streamMessageId ? {
|
|
924
|
+
channelId,
|
|
925
|
+
messageId: streamMessageId,
|
|
926
|
+
warnPrefix: "discord stream preview cleanup failed"
|
|
927
|
+
} : void 0;
|
|
940
928
|
streamMessageId = void 0;
|
|
941
929
|
lastSentText = "";
|
|
942
930
|
loop.resetThrottleWindow();
|
|
943
|
-
if (!
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
931
|
+
if (!currentMessage) return;
|
|
932
|
+
await deleteCleanupMessage(currentMessage);
|
|
933
|
+
};
|
|
934
|
+
const clear = async () => {
|
|
935
|
+
await discardPending();
|
|
936
|
+
await deleteCurrentMessage();
|
|
949
937
|
};
|
|
950
938
|
params.log?.(`discord stream preview ready (maxChars=${maxChars}, throttleMs=${throttleMs})`);
|
|
951
939
|
return {
|
|
@@ -958,7 +946,7 @@ function createDiscordDraftStream(params) {
|
|
|
958
946
|
seal,
|
|
959
947
|
stop,
|
|
960
948
|
retarget,
|
|
961
|
-
|
|
949
|
+
cleanupPendingMessages,
|
|
962
950
|
forceNewMessage
|
|
963
951
|
};
|
|
964
952
|
}
|
|
@@ -1232,7 +1220,7 @@ function createDiscordDraftPreviewController(params) {
|
|
|
1232
1220
|
progressDraft.cancel();
|
|
1233
1221
|
if (finalReplyError !== false) await draftStream?.discardPending();
|
|
1234
1222
|
if (finalReplyError !== true && !finalizedViaPreviewMessage && draftStream?.messageId()) await draftStream.clear();
|
|
1235
|
-
await draftStream?.
|
|
1223
|
+
await draftStream?.cleanupPendingMessages();
|
|
1236
1224
|
} catch (err) {
|
|
1237
1225
|
params.log(`discord: draft cleanup failed: ${String(err)}`);
|
|
1238
1226
|
}
|
|
@@ -1609,7 +1597,8 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1609
1597
|
threadBindings,
|
|
1610
1598
|
mediaLocalRoots,
|
|
1611
1599
|
kind: "block",
|
|
1612
|
-
bindPendingFinalDelivery: info.bindPendingFinalDelivery
|
|
1600
|
+
bindPendingFinalDelivery: info.bindPendingFinalDelivery,
|
|
1601
|
+
onPlatformSendDispatch: info.onPlatformSendDispatch
|
|
1613
1602
|
});
|
|
1614
1603
|
if (result.visibleReplySent) replyReference.markSent();
|
|
1615
1604
|
return result;
|
|
@@ -1708,7 +1697,8 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1708
1697
|
mediaLocalRoots,
|
|
1709
1698
|
allowedMentions,
|
|
1710
1699
|
kind: info.kind,
|
|
1711
|
-
bindPendingFinalDelivery: info.bindPendingFinalDelivery
|
|
1700
|
+
bindPendingFinalDelivery: info.bindPendingFinalDelivery,
|
|
1701
|
+
onPlatformSendDispatch: info.onPlatformSendDispatch
|
|
1712
1702
|
})).visibleReplySent;
|
|
1713
1703
|
},
|
|
1714
1704
|
onNormalDelivered: () => {
|
|
@@ -1746,7 +1736,8 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1746
1736
|
threadBindings,
|
|
1747
1737
|
mediaLocalRoots,
|
|
1748
1738
|
kind: info.kind,
|
|
1749
|
-
bindPendingFinalDelivery: info.bindPendingFinalDelivery
|
|
1739
|
+
bindPendingFinalDelivery: info.bindPendingFinalDelivery,
|
|
1740
|
+
onPlatformSendDispatch: info.onPlatformSendDispatch
|
|
1750
1741
|
});
|
|
1751
1742
|
if (!result.visibleReplySent) return result;
|
|
1752
1743
|
replyReference.markSent();
|
|
@@ -1864,7 +1855,10 @@ async function processDiscordMessageInner(ctx, observer) {
|
|
|
1864
1855
|
return;
|
|
1865
1856
|
}
|
|
1866
1857
|
dispatchError = true;
|
|
1867
|
-
if (await completeDiscordSessionConflict(err,
|
|
1858
|
+
if (await completeDiscordSessionConflict(err, (payload, info) => deliverDiscordPayload(payload, {
|
|
1859
|
+
...info,
|
|
1860
|
+
onPlatformSendDispatch: () => Promise.resolve()
|
|
1861
|
+
}), onDiscordDeliveryError)) return;
|
|
1868
1862
|
throw err;
|
|
1869
1863
|
} finally {
|
|
1870
1864
|
activeThreadRoute.end();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as resolveDiscordChannelInfoSafe } from "./thread-bindings.manager-
|
|
1
|
+
import { c as resolveDiscordChannelInfoSafe } from "./thread-bindings.manager-Clm77DBM.js";
|
|
2
2
|
import { ComponentType, StickerFormatType } from "discord-api-types/v10";
|
|
3
3
|
import { asDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
|
|
4
4
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -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) {
|
|
@@ -115,34 +143,6 @@ function formatDiscordSnapshotAuthor(author) {
|
|
|
115
143
|
if (author.id) return `@${author.id}`;
|
|
116
144
|
}
|
|
117
145
|
//#endregion
|
|
118
|
-
//#region extensions/discord/src/monitor/media-ssrf-policy.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
|
-
function mergeHostnameList(...lists) {
|
|
129
|
-
const merged = lists.flatMap((list) => list ?? []).map((value) => value.trim()).filter((value) => value.length > 0);
|
|
130
|
-
return merged.length > 0 ? uniqueStrings(merged) : void 0;
|
|
131
|
-
}
|
|
132
|
-
/** Merges caller network policy with the Discord-owned CDN allowlist. */
|
|
133
|
-
function resolveDiscordCdnPolicy(policy) {
|
|
134
|
-
if (!policy) return DISCORD_MEDIA_SSRF_POLICY;
|
|
135
|
-
const hostnameAllowlist = mergeHostnameList(DISCORD_MEDIA_SSRF_POLICY.hostnameAllowlist, policy.hostnameAllowlist);
|
|
136
|
-
const allowedHostnames = mergeHostnameList(DISCORD_MEDIA_SSRF_POLICY.allowedHostnames, policy.allowedHostnames);
|
|
137
|
-
return {
|
|
138
|
-
...DISCORD_MEDIA_SSRF_POLICY,
|
|
139
|
-
...policy,
|
|
140
|
-
...allowedHostnames ? { allowedHostnames } : {},
|
|
141
|
-
...hostnameAllowlist ? { hostnameAllowlist } : {},
|
|
142
|
-
allowRfc2544BenchmarkRange: Boolean(DISCORD_MEDIA_SSRF_POLICY.allowRfc2544BenchmarkRange) || Boolean(policy.allowRfc2544BenchmarkRange)
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
//#endregion
|
|
146
146
|
//#region extensions/discord/src/monitor/message-media.ts
|
|
147
147
|
const AUDIO_ATTACHMENT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
148
148
|
".aac",
|
|
@@ -366,6 +366,7 @@ async function appendResolvedMediaFromAttachments(params) {
|
|
|
366
366
|
});
|
|
367
367
|
params.out.push({
|
|
368
368
|
path: saved.path,
|
|
369
|
+
fileName: attachment.filename,
|
|
369
370
|
...classification
|
|
370
371
|
});
|
|
371
372
|
} catch (err) {
|
|
@@ -436,6 +437,7 @@ async function appendResolvedMediaFromStickers(params) {
|
|
|
436
437
|
params.out.push({
|
|
437
438
|
path: saved.path,
|
|
438
439
|
contentType: saved.contentType,
|
|
440
|
+
fileName: candidate.fileName,
|
|
439
441
|
kind: "sticker"
|
|
440
442
|
});
|
|
441
443
|
lastError = null;
|
|
@@ -495,8 +497,8 @@ function resolveDiscordMentions(text, message) {
|
|
|
495
497
|
if (!Array.isArray(mentions) || mentions.length === 0) return text;
|
|
496
498
|
let out = text;
|
|
497
499
|
for (const user of mentions) {
|
|
498
|
-
const label = user.globalName || user.username;
|
|
499
|
-
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}`);
|
|
500
502
|
}
|
|
501
503
|
return out;
|
|
502
504
|
}
|
|
@@ -561,4 +563,4 @@ function resolveDiscordSnapshotMessageText(snapshot) {
|
|
|
561
563
|
return [content || embedText || componentText, attachmentText].filter(Boolean).join("\n");
|
|
562
564
|
}
|
|
563
565
|
//#endregion
|
|
564
|
-
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 };
|