@openclaw/discord 2026.8.1-beta.3 → 2026.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-inspect-D5xmUpnj.js → account-inspect-BDfKyuvL.js} +1 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-DNl-oCEw.js → accounts-CfQ-vSyf.js} +5 -124
- package/dist/action-runtime-api.js +1 -1
- package/dist/{activities-api-KCBAmWxD.js → activities-api-Dl-TOyOX.js} +5 -4
- package/dist/activities-api.js +1 -1
- package/dist/api.js +16 -16
- package/dist/{approval-handler.runtime-B12RCYr8.js → approval-handler.runtime-q4Zqo44V.js} +28 -105
- package/dist/{audit-Yc7eZDd6.js → audit-DgrvFPGt.js} +5 -5
- package/dist/{channel-cXYzGc4L.js → channel-BsQUalPw.js} +18 -20
- package/dist/{channel-actions.runtime-CODTvo7c.js → channel-actions.runtime-UMGGIfSy.js} +59 -58
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/channel-type-CVLZyGYS.js +7 -0
- package/dist/{channel.setup-CSiwnMgs.js → channel.setup-rPs4dsk_.js} +5 -5
- package/dist/{components-ezGKo_Yh.js → components-Dk35LTf_.js} +33 -29
- package/dist/{config-schema-DC5kDtQ5.js → config-schema-CxPqtVI1.js} +16 -10
- package/dist/{conversation-binding-route-D6rCQ5S0.js → conversation-binding-route-BjvX4e35.js} +1 -1
- package/dist/{directory-config-XyCfoqLg.js → directory-config-B7DY_pNG.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-Df0NbFJB.js → directory-live-DuAXKkan.js} +2 -2
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{doctor-DYY31GrO.js → doctor-zQTtn6hm.js} +4 -4
- package/dist/{handle-action.guild-admin-6Tvvinsa.js → handle-action.guild-admin-DZewwLr1.js} +9 -5
- package/dist/index.js +1 -1
- package/dist/ingress-identity-CzZKcPK8.js +60 -0
- package/dist/{message-handler-B61q5MOF.js → message-handler-C5By3yl5.js} +5 -5
- package/dist/{message-handler.preflight-Bzg_Hawz.js → message-handler.preflight-DrszWuHw.js} +20 -84
- package/dist/{message-handler.process--4_712Ec.js → message-handler.process-DyFPDLCt.js} +60 -66
- package/dist/{message-utils-BXLLnFl6.js → message-text-Ca8M6TU8.js} +34 -32
- package/dist/{outbound-adapter-DxHTOqiN.js → outbound-adapter-Dif8p481.js} +58 -61
- package/dist/{outbound-components-B2PL0ooH.js → outbound-components-wjv7yyAj.js} +5 -4
- package/dist/outbound-session-route-Bn4uXaoE.js +665 -0
- package/dist/{owner-access-Bg41VzAf.js → owner-access-UlYi9t0M.js} +1 -1
- package/dist/{pluralkit-dUl4v1X3.js → pluralkit-9EuEN4UD.js} +1 -1
- package/dist/{probe-BTdtVRwU.js → probe-n6ZXxK8V.js} +1 -1
- package/dist/{probe.runtime-Dq5-PRKT.js → probe.runtime-CN4bdPfZ.js} +1 -1
- package/dist/{provider-DlK_ynqt.js → provider-LXiOcJrH.js} +443 -295
- package/dist/{provider-session.runtime-CvvphHvs.js → provider-session.runtime-DSNe7r2W.js} +3 -3
- package/dist/provider.runtime-DiInaDXO.js +2 -0
- package/dist/{realtime-session.runtime-ysbMG8v7.js → realtime-session.runtime-DOViOIjY.js} +106 -122
- package/dist/{resolve-allowlist-common-DIVXbD1P.js → resolve-allowlist-common-BLoYaxEG.js} +1 -1
- package/dist/{resolve-channels-CGeUoIqb.js → resolve-channels-D2yl_2CN.js} +4 -3
- package/dist/{resolve-users-BtKxLUZv.js → resolve-users-BLxfqajZ.js} +2 -2
- package/dist/{retry-DNsVTeTo.js → retry-DqHCW6PV.js} +220 -6
- package/dist/{runtime-D71_VFLr.js → runtime-BYamRVPN.js} +73 -56
- package/dist/{runtime-CQovMsH3.js → runtime-DrxVBTtp.js} +2 -2
- package/dist/runtime-api.js +16 -23
- package/dist/{sdk-runtime-37OU6_Yh.js → sdk-runtime-6tfgYDjY.js} +55 -86
- package/dist/{security-audit-BfJhAXZp.js → security-audit-DKfK-iPY.js} +10 -11
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/{security-audit.runtime-BVKF9VtY.js → security-audit.runtime-sKZyKgpx.js} +1 -1
- package/dist/{send-rQIffSYu.js → send-UJHiAm4C.js} +78 -15
- package/dist/{send.components-ChK1wS7w.js → send.components-CrBJpGT_.js} +15 -22
- package/dist/{send.outbound-HIkgji_7.js → send.outbound-D7JYmfm9.js} +58 -69
- package/dist/{send.shared-B3fpaLWJ.js → send.shared-DZJ1akvQ.js} +36 -21
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-CaAaoksy.js → shared-Dii2HTn7.js} +31 -9
- package/dist/{subagent-hooks-CNT2ZJTJ.js → subagent-hooks-JyGrtQIl.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -6
- package/dist/{system-events-Nuwoq_au.js → system-events-BEmcj4xJ.js} +1 -1
- package/dist/{target-resolver-DIXShHaZ.js → target-resolver-V-IYae6s.js} +3 -3
- package/dist/targets-CQp53cGj.js +3 -0
- package/dist/{thread-bindings-VlymUnbz.js → thread-bindings-DvYP79fy.js} +3 -4
- package/dist/{thread-bindings.manager-CngsgErq.js → thread-bindings.manager-Clm77DBM.js} +8 -12
- package/dist/{threading-DU6pgeGm.js → threading-CXuu_7o9.js} +47 -25
- package/dist/{transcripts-source-DeIMNbRh.js → transcripts-source-BLEMH_yi.js} +9 -4
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-oLiS5Z13.js → typing-B9snnwMe.js} +1 -1
- package/dist/{voice-runtime-CjNFaynA.js → voice-runtime-DY6_o73o.js} +76 -66
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/README.md +19 -19
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v1.js +7 -3
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v7.js +5 -2
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v1.js +7 -3
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v7.js +5 -2
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/package.json +4 -3
- package/node_modules/@discordjs/voice/node_modules/@types/node/README.md +1 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@discordjs/voice/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@discordjs/voice/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@discordjs/voice/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@discordjs/voice/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@discordjs/voice/node_modules/@types/node/package.json +2 -2
- package/node_modules/@discordjs/voice/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@discordjs/voice/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@discordjs/voice/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@discordjs/voice/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/discord-api-types/CHANGELOG.md +8 -0
- package/node_modules/discord-api-types/package.json +4 -4
- package/node_modules/discord-api-types/payloads/v10/channel.d.ts +2 -2
- package/node_modules/discord-api-types/payloads/v10/channel.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/gateway.d.ts +4 -0
- package/node_modules/discord-api-types/payloads/v10/gateway.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/gateway.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/message.d.ts +4 -1
- package/node_modules/discord-api-types/payloads/v10/message.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/message.js +1 -0
- package/node_modules/discord-api-types/payloads/v10/message.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/channel.d.ts +2 -2
- package/node_modules/discord-api-types/payloads/v9/channel.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/gateway.d.ts +4 -0
- package/node_modules/discord-api-types/payloads/v9/gateway.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/gateway.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/message.d.ts +4 -1
- package/node_modules/discord-api-types/payloads/v9/message.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/message.js +1 -0
- package/node_modules/discord-api-types/payloads/v9/message.js.map +1 -1
- package/node_modules/typebox/build/format/date.d.mts +1 -1
- package/node_modules/typebox/build/format/date.mjs +1 -1
- package/node_modules/typebox/build/format/date_time.d.mts +2 -2
- package/node_modules/typebox/build/format/date_time.mjs +3 -3
- package/node_modules/typebox/build/format/email.d.mts +1 -1
- package/node_modules/typebox/build/format/email.mjs +2 -2
- package/node_modules/typebox/build/format/hostname.mjs +2 -10
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_email.mjs +3 -3
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
- package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
- package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
- package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
- package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
- package/node_modules/typebox/build/format/idna/index.mjs +2 -0
- package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
- package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
- package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
- package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
- package/node_modules/typebox/build/format/ipv4.mjs +2 -32
- package/node_modules/typebox/build/format/ipv6.mjs +2 -61
- package/node_modules/typebox/build/format/iri.d.mts +2 -2
- package/node_modules/typebox/build/format/iri.mjs +26 -8
- package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
- package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
- package/node_modules/typebox/build/format/regex.d.mts +1 -2
- package/node_modules/typebox/build/format/regex.mjs +2 -6
- package/node_modules/typebox/build/format/time.d.mts +2 -2
- package/node_modules/typebox/build/format/time.mjs +19 -14
- package/node_modules/typebox/build/format/uri.d.mts +1 -1
- package/node_modules/typebox/build/format/uri.mjs +3 -130
- package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
- package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
- package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
- package/node_modules/typebox/build/format/uri_template.mjs +4 -5
- package/node_modules/typebox/build/format/url.d.mts +3 -3
- package/node_modules/typebox/build/format/url.mjs +4 -5
- package/node_modules/typebox/build/guard/emit.d.mts +3 -1
- package/node_modules/typebox/build/guard/emit.mjs +12 -5
- package/node_modules/typebox/build/guard/guard.d.mts +8 -2
- package/node_modules/typebox/build/guard/guard.mjs +25 -4
- package/node_modules/typebox/build/guard/string.d.mts +2 -2
- package/node_modules/typebox/build/guard/string.mjs +7 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
- package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
- package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
- package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
- package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
- package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
- package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
- package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
- package/node_modules/typebox/build/schema/types/index.mjs +0 -2
- package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
- package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
- package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
- package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
- package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
- package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
- package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
- package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
- package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
- package/node_modules/typebox/build/type/script/parser.mjs +27 -23
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
- package/node_modules/typebox/package.json +27 -27
- package/node_modules/typebox/readme.md +79 -82
- package/node_modules/undici/docs/docs/api/Client.md +21 -8
- package/node_modules/undici/lib/api/readable.js +33 -43
- package/node_modules/undici/lib/core/connect.js +16 -2
- package/node_modules/undici/lib/core/symbols.js +1 -0
- package/node_modules/undici/lib/dispatcher/client-h1.js +3 -3
- package/node_modules/undici/lib/dispatcher/client-h2.js +179 -10
- package/node_modules/undici/lib/dispatcher/client.js +74 -29
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +28 -6
- package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +15 -1
- package/node_modules/undici/lib/handler/retry-handler.js +7 -2
- package/node_modules/undici/lib/interceptor/cache.js +5 -2
- package/node_modules/undici/lib/interceptor/deduplicate.js +1 -1
- package/node_modules/undici/lib/mock/mock-utils.js +213 -24
- package/node_modules/undici/lib/util/cache.js +2 -4
- package/node_modules/undici/lib/web/websocket/websocket.js +22 -0
- package/node_modules/undici/package.json +1 -1
- package/node_modules/undici/types/client.d.ts +40 -0
- package/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/ws/package.json +1 -1
- package/openclaw.plugin.json +12 -4
- package/package.json +8 -8
- package/skills/discord/SKILL.md +1 -1
- package/dist/approval-message-safety-XGFPbDoI.js +0 -226
- package/dist/audit-core-BCX8UeFH.js +0 -105
- package/dist/channel-actions-Dr2QI8Bf.js +0 -212
- package/dist/inbound-event-delivery-De2qxTrP.js +0 -39
- package/dist/provider.runtime-CzKGRiAF.js +0 -2
- package/dist/runtime-api.actions.js +0 -3
- package/dist/runtime-api.lookup.js +0 -7
- package/dist/runtime-api.monitor-CzeTYF32.js +0 -6
- package/dist/runtime-api.monitor.js +0 -9
- package/dist/runtime-api.send.js +0 -7
- package/dist/runtime-api.threads.js +0 -5
- package/dist/send.reactions-gmJ6yFPo.js +0 -78
- package/dist/send.receipt-Cnhoautb.js +0 -76
- package/dist/subagent-progress-FPLqBY1s.js +0 -110
- package/dist/targets-B2pf49zc.js +0 -3
- package/node_modules/typebox/build/format/_idna.d.mts +0 -2
- package/node_modules/typebox/build/format/_idna.mjs +0 -246
- package/node_modules/typebox/build/format/_puny.d.mts +0 -1
- package/node_modules/typebox/build/format/_puny.mjs +0 -77
- package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
- package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
- package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
- package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { C as
|
|
3
|
-
import { c as resolveDiscordAccount, f as resolveDiscordAccountDmPolicy, l as resolveDiscordAccountAllowFrom, m as normalizeDiscordToken, p as resolveDiscordMaxLinesPerMessage } from "./accounts-
|
|
4
|
-
import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-
|
|
1
|
+
import { A as ThreadUpdateListener, C as MessageCreateListener, D as ReadyListener, E as PresenceUpdateListener, G as User, H as CommandWithSubcommands, I as RateLimitError, K as hasDiscordV2Components, M as Client, N as Plugin, S as InteractionCreateListener, T as MessageReactionRemoveListener, U as Guild, V as Command, W as Message, Z as Modal, a as chunkDiscordTextWithMode, b as GuildCreateListener, ct as Row, dt as StringSelectMenu, et as Button, ft as TextDisplay, ht as BaseMessageInteractiveComponent, k as ThreadDeleteListener, nt as Container, ut as Separator, w as MessageReactionAddListener, x as GuildDeleteListener, y as discord_exports } from "./retry-DqHCW6PV.js";
|
|
2
|
+
import { C as parseDiscordActivityCustomIdForInteraction, D as parseDiscordModalCustomIdForInteraction, E as parseDiscordModalCustomId, O as decodeCustomIdComponent, T as parseDiscordComponentCustomIdForInteraction, c as parseExecApprovalData, k as encodeCustomIdComponent, o as parseDiscordQuestionData, w as parseDiscordComponentCustomId, y as buildDiscordActivityCustomId } from "./components-Dk35LTf_.js";
|
|
3
|
+
import { c as resolveDiscordAccount, f as resolveDiscordAccountDmPolicy, l as resolveDiscordAccountAllowFrom, m as normalizeDiscordToken, p as resolveDiscordMaxLinesPerMessage } from "./accounts-CfQ-vSyf.js";
|
|
4
|
+
import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-CrBJpGT_.js";
|
|
5
5
|
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
6
6
|
import { a as isDiscordRateLimitResponseBody, o as summarizeDiscordResponseBody } from "./api-DNVbJyEy.js";
|
|
7
|
-
import { C as resolveTimestampMs, a as normalizeDiscordSlug, b as formatDiscordReactionEmoji, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordCommandOwnerAllowFrom, f as resolveDiscordGuildEntry, g as resolveDiscordOwnerAllowFrom, h as resolveDiscordOwnerAccess, i as normalizeDiscordDisplaySlug, l as resolveDiscordChannelPolicyCommandAuthorizer, m as resolveDiscordMemberAllowed, n as isDiscordGroupAllowedByPolicy, o as resolveDiscordAllowListMatch, p as resolveDiscordMemberAccessState, r as normalizeDiscordAllowList, v as resolveGroupDmAllow, x as formatDiscordUserTag, y as shouldEmitDiscordReactionNotification } from "./allow-list-BDMimASD.js";
|
|
8
|
-
import {
|
|
9
|
-
import { a as formatMention, t as sendMessageDiscord } from "./send.outbound-
|
|
10
|
-
import {
|
|
11
|
-
import { n as
|
|
7
|
+
import { C as resolveTimestampMs, a as normalizeDiscordSlug, b as formatDiscordReactionEmoji, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordCommandOwnerAllowFrom, f as resolveDiscordGuildEntry, g as resolveDiscordOwnerAllowFrom, h as resolveDiscordOwnerAccess, i as normalizeDiscordDisplaySlug, l as resolveDiscordChannelPolicyCommandAuthorizer, m as resolveDiscordMemberAllowed, n as isDiscordGroupAllowedByPolicy, o as resolveDiscordAllowListMatch, p as resolveDiscordMemberAccessState, r as normalizeDiscordAllowList, s as resolveDiscordChannelConfig, v as resolveGroupDmAllow, x as formatDiscordUserTag, y as shouldEmitDiscordReactionNotification } from "./allow-list-BDMimASD.js";
|
|
8
|
+
import { B as validateDiscordProxyUrl, G as unregisterGateway, P as createDiscordRestClient, R as DISCORD_REST_TIMEOUT_MS, V as withValidatedDiscordProxy, W as registerGateway, b as canViewDiscordGuildChannel, w as hasAnyChannelPermissionDiscord } from "./send.shared-DZJ1akvQ.js";
|
|
9
|
+
import { a as formatMention, t as sendMessageDiscord } from "./send.outbound-D7JYmfm9.js";
|
|
10
|
+
import { t as isDiscordThreadChannelType } from "./channel-type-CVLZyGYS.js";
|
|
11
|
+
import { n as getDiscordActivitiesRuntime } from "./runtime-DrxVBTtp.js";
|
|
12
|
+
import { n as resolveDiscordVoiceEnabled, r as authorizeDiscordVoiceIngress, t as resolveDiscordVoiceAccess } from "./owner-access-UlYi9t0M.js";
|
|
12
13
|
import { i as setPresence, t as clearPresences } from "./presence-cache-z1N8MbJ3.js";
|
|
13
|
-
import {
|
|
14
|
+
import { _ as readMessagesDiscord, s as sendVoiceMessageDiscord } from "./send-UJHiAm4C.js";
|
|
14
15
|
import { c as raceWithTimeout, u as withAbortTimeout } from "./timeouts-B9cy6RvQ.js";
|
|
15
|
-
import {
|
|
16
|
-
import { t as
|
|
17
|
-
import { t as
|
|
18
|
-
import {
|
|
19
|
-
import { a as
|
|
16
|
+
import { S as isDiscordExecApprovalClientEnabled, b as getDiscordExecApprovalApprovers, c as resolveDiscordEffectiveRoute, i as buildDiscordConversationRouteContext, n as DISCORD_APPROVAL_ALLOWED_MENTIONS, o as resolveDiscordBoundConversationRoute, r as formatDiscordApprovalDisplayValue, u as resolveDiscordConversationIdentity } from "./outbound-session-route-Bn4uXaoE.js";
|
|
17
|
+
import { t as discordIngressIdentity } from "./ingress-identity-CzZKcPK8.js";
|
|
18
|
+
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-D2yl_2CN.js";
|
|
19
|
+
import { t as resolveDiscordUserAllowlist } from "./resolve-users-BLxfqajZ.js";
|
|
20
|
+
import { a as isThreadArchived, c as resolveDiscordChannelInfoSafe, f as resolveDiscordChannelTopicSafe, h as formatThreadBindingDurationLabel, l as resolveDiscordChannelNameSafe, r as getThreadBindingManager, s as resolveDiscordChannelIdSafe, u as resolveDiscordChannelParentIdSafe } from "./thread-bindings.manager-Clm77DBM.js";
|
|
21
|
+
import { a as probeDiscordApplicationId, r as parseApplicationIdFromToken } from "./probe-n6ZXxK8V.js";
|
|
20
22
|
import { i as sanitizeRecentModels, n as normalizeModelRef, r as preferenceTimestampMs, t as buildPreferenceModelKey } from "./model-picker-preference-primitives-BHT1LkR_.js";
|
|
21
|
-
import {
|
|
22
|
-
import { i as resolveDiscordThreadParentInfo } from "./threading-
|
|
23
|
+
import { f as resolveDiscordChannelInfo, u as resolveDiscordMessageStickers } from "./message-text-Ca8M6TU8.js";
|
|
24
|
+
import { i as resolveDiscordThreadParentInfo } from "./threading-CXuu_7o9.js";
|
|
23
25
|
import { t as resolveDiscordSenderIdentity } from "./sender-identity-BJtfyise.js";
|
|
24
26
|
import { logDebug, logError } from "openclaw/plugin-sdk/logging-core";
|
|
25
|
-
import { ApplicationCommandOptionType, ButtonStyle, ChannelType, ComponentType, GatewayCloseCodes, GatewayCloseCodes as GatewayCloseCodes$1, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes } from "discord-api-types/v10";
|
|
27
|
+
import { ApplicationCommandOptionType, ButtonStyle, ChannelType, ComponentType, GatewayCloseCodes, GatewayCloseCodes as GatewayCloseCodes$1, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes, PermissionFlagsBits } from "discord-api-types/v10";
|
|
28
|
+
import { Type } from "typebox";
|
|
29
|
+
import { Check, Errors } from "typebox/value";
|
|
26
30
|
import { createHash, randomUUID } from "node:crypto";
|
|
27
31
|
import { MAX_DATE_TIMESTAMP_MS, MAX_TIMER_TIMEOUT_MS, asDateTimestampMs, asSafeIntegerInRange, parseFiniteNumber, parseStrictInteger, parseStrictPositiveInteger, resolveDateTimestampMs, resolveTimestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
28
32
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
29
|
-
import { Type } from "typebox";
|
|
30
|
-
import { Check, Errors } from "typebox/value";
|
|
31
33
|
import { inspect } from "node:util";
|
|
32
34
|
import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
|
|
33
35
|
import { PlatformMessageNotDispatchedError, formatErrorMessage, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -36,6 +38,7 @@ import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
|
36
38
|
import { resolveAgentRoute } from "openclaw/plugin-sdk/routing";
|
|
37
39
|
import { asFiniteNumber, asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeStringEntries, parseFiniteNumber as parseFiniteNumber$1, parseStrictNonNegativeInteger as parseStrictNonNegativeInteger$1, summarizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
38
40
|
import { getRuntimeConfig, getRuntimeConfigSnapshot } from "openclaw/plugin-sdk/runtime-config-snapshot";
|
|
41
|
+
import { resolveSendableOutboundReplyParts, resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
39
42
|
import { createHttp1EnvHttpProxyAgent, createHttp1ProxyAgent, createNodeProxyAgent, resolveEnvHttpProxyAgentOptions, wrapFetchWithAbortSignal } from "openclaw/plugin-sdk/fetch-runtime";
|
|
40
43
|
import { createNonExitingRuntime, createSubsystemLogger, danger, formatDurationSeconds, isVerbose, logVerbose, shouldLogVerbose, sleepWithAbort, warn } from "openclaw/plugin-sdk/runtime-env";
|
|
41
44
|
import { sliceUtf16Safe, truncateUtf16Safe, withTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
@@ -45,7 +48,6 @@ import { resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/rep
|
|
|
45
48
|
import { chunkItems, findCodeRegions, sanitizeAssistantVisibleText, sanitizeAssistantVisibleTextWithProfile } from "openclaw/plugin-sdk/text-chunking";
|
|
46
49
|
import { buildOutboundSessionContext, listMessageReceiptPlatformIds, resolveChannelStreamingBlockEnabled, sendDurableMessageBatch } from "openclaw/plugin-sdk/channel-outbound";
|
|
47
50
|
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
|
|
48
|
-
import { resolveSendableOutboundReplyParts, resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
49
51
|
import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
|
|
50
52
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
51
53
|
import { buildCommandTextFromArgs, findCommandByNativeName, formatCommandArgMenuTitle, listChatCommands, listNativeCommandSpecsForConfig, listSkillCommandsForAgents, resolveCommandAuthorizedFromAuthorizers, resolveEffectiveAgentRuntime, resolveNativeCommandSessionTargets, resolveStoredModelOverride, serializeCommandArgs } from "openclaw/plugin-sdk/command-auth-native";
|
|
@@ -56,15 +58,15 @@ import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plu
|
|
|
56
58
|
import { buildPairingReply, upsertChannelPairingRequest, upsertChannelPairingRequest as upsertChannelPairingRequest$1 } from "openclaw/plugin-sdk/conversation-runtime";
|
|
57
59
|
import * as conversationRuntime from "openclaw/plugin-sdk/conversation-binding-runtime";
|
|
58
60
|
import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
|
|
61
|
+
import { createChannelIngressResolver, readChannelIngressStoreAllowFromForDmPolicy } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
59
62
|
import { clearExpiredCooldowns, ensureAuthProfileStore, formatReasoningMessage, getPreparedModelCatalogSnapshot, isProfileInCooldown, listAgentIds, loadPreparedModelCatalog, resolveAgentAvatar, resolveAgentDir, resolveDefaultModelForAgent, resolveHumanDelayConfig, resolveProfilesUnavailableReason } from "openclaw/plugin-sdk/agent-runtime";
|
|
60
63
|
import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
|
|
61
64
|
import { resolveNativeCommandsEnabled, resolveNativeSkillsEnabled } from "openclaw/plugin-sdk/native-command-config-runtime";
|
|
62
65
|
import { requestHeartbeat } from "openclaw/plugin-sdk/heartbeat-runtime";
|
|
63
66
|
import { enqueueRoutedSystemEvent, enqueueRoutedSystemEvent as enqueueRoutedSystemEvent$1 } from "openclaw/plugin-sdk/system-event-runtime";
|
|
64
67
|
import { deleteSessionEntry, getSessionEntry, listSessionEntries, readSessionUpdatedAt as readSessionUpdatedAt$1, resolveStorePath, resolveStorePath as resolveStorePath$1 } from "openclaw/plugin-sdk/session-store-runtime";
|
|
65
|
-
import { createChannelIngressResolver, defineStableChannelIngressIdentity, readChannelIngressStoreAllowFromForDmPolicy } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
66
|
-
import { createChannelPartialDeliveryError, dispatchChannelInboundTurn, formatInboundEnvelope, hasVisibleInboundReplyDispatch, isChannelPartialDeliveryError, resolveEnvelopeFormatOptions, resolveInboundSupplementalSenderAllowed, runChannelInboundEvent } from "openclaw/plugin-sdk/channel-inbound";
|
|
67
68
|
import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-dispatch-runtime";
|
|
69
|
+
import { createChannelPartialDeliveryError, dispatchChannelInboundTurn, formatInboundEnvelope, hasVisibleInboundReplyDispatch, isChannelPartialDeliveryError, resolveEnvelopeFormatOptions, resolveInboundSupplementalSenderAllowed, runChannelInboundEvent } from "openclaw/plugin-sdk/channel-inbound";
|
|
68
70
|
import { buildCommandTextFromArgs as buildCommandTextFromArgs$1, findCommandByNativeName as findCommandByNativeName$1, mergeNativeCommandSpecs, parseCommandArgs, resolveCommandArgChoices, resolveCommandArgMenu, serializeCommandArgs as serializeCommandArgs$1 } from "openclaw/plugin-sdk/native-command-registry";
|
|
69
71
|
import { PLUGIN_COMMAND_DISPATCH } from "openclaw/plugin-sdk/plugin-command-runtime";
|
|
70
72
|
import { resolveDirectStatusReplyForSession } from "openclaw/plugin-sdk/command-status-runtime";
|
|
@@ -79,6 +81,7 @@ import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runti
|
|
|
79
81
|
import { stripPlainTextToolCallBlocks } from "openclaw/plugin-sdk/tool-payload";
|
|
80
82
|
import { createChannelInteractiveDispatcher } from "openclaw/plugin-sdk/plugin-runtime";
|
|
81
83
|
import { resolveApprovalOverGateway } from "openclaw/plugin-sdk/approval-gateway-runtime";
|
|
84
|
+
import { reportChannelRoomJoin } from "openclaw/plugin-sdk/channel-join-intro-runtime";
|
|
82
85
|
import { resolveRequestUrl } from "openclaw/plugin-sdk/request-url";
|
|
83
86
|
import { fetchWithRuntimeDispatcher } from "openclaw/plugin-sdk/runtime-fetch";
|
|
84
87
|
import { Agent as Agent$1 } from "undici";
|
|
@@ -340,55 +343,16 @@ async function closeDiscordThreadSessions(params) {
|
|
|
340
343
|
}
|
|
341
344
|
//#endregion
|
|
342
345
|
//#region extensions/discord/src/monitor/dm-command-auth.ts
|
|
343
|
-
const DISCORD_ALLOW_LIST_PREFIXES = [
|
|
344
|
-
"discord:",
|
|
345
|
-
"user:",
|
|
346
|
-
"pk:"
|
|
347
|
-
];
|
|
348
346
|
const DISCORD_CHANNEL_ID = "discord";
|
|
349
|
-
const DISCORD_USER_ID_KIND = "stable-id";
|
|
350
|
-
const DISCORD_USER_NAME_KIND = "username";
|
|
351
|
-
function normalizeDiscordIdEntry(entry) {
|
|
352
|
-
const text = entry.trim();
|
|
353
|
-
if (!text) return null;
|
|
354
|
-
const maybeId = text.replace(/^<@!?/, "").replace(/>$/, "");
|
|
355
|
-
if (/^\d+$/.test(maybeId)) return maybeId;
|
|
356
|
-
const prefix = DISCORD_ALLOW_LIST_PREFIXES.find((entryPrefix) => text.startsWith(entryPrefix));
|
|
357
|
-
if (prefix) return text.slice(prefix.length).trim() || null;
|
|
358
|
-
return null;
|
|
359
|
-
}
|
|
360
|
-
function normalizeDiscordNameEntry(entry) {
|
|
361
|
-
const text = entry.trim();
|
|
362
|
-
if (!text || text === "*" || normalizeDiscordIdEntry(text)) return null;
|
|
363
|
-
const nameSlug = normalizeDiscordAllowList([text], DISCORD_ALLOW_LIST_PREFIXES)?.names.values().next().value;
|
|
364
|
-
return typeof nameSlug === "string" && nameSlug ? nameSlug : null;
|
|
365
|
-
}
|
|
366
|
-
function normalizeDiscordNameSubject(value) {
|
|
367
|
-
const nameSlug = normalizeDiscordAllowList([value], DISCORD_ALLOW_LIST_PREFIXES)?.names.values().next().value;
|
|
368
|
-
return typeof nameSlug === "string" && nameSlug ? nameSlug : null;
|
|
369
|
-
}
|
|
370
|
-
const discordIngressIdentity = defineStableChannelIngressIdentity({
|
|
371
|
-
key: "discordUserId",
|
|
372
|
-
kind: DISCORD_USER_ID_KIND,
|
|
373
|
-
normalizeEntry: normalizeDiscordIdEntry,
|
|
374
|
-
normalizeSubject: (value) => value.trim() || null,
|
|
375
|
-
sensitivity: "pii",
|
|
376
|
-
aliases: [["discordUserName", normalizeDiscordNameEntry], ["discordUserTag", () => null]].map(([key, normalizeEntry]) => ({
|
|
377
|
-
key,
|
|
378
|
-
kind: DISCORD_USER_NAME_KIND,
|
|
379
|
-
normalizeEntry,
|
|
380
|
-
normalizeSubject: normalizeDiscordNameSubject,
|
|
381
|
-
dangerous: true,
|
|
382
|
-
sensitivity: "pii"
|
|
383
|
-
}))
|
|
384
|
-
});
|
|
385
347
|
function createDiscordDmIngressSubject(sender) {
|
|
386
348
|
return {
|
|
387
349
|
stableId: sender.id,
|
|
388
350
|
aliases: {
|
|
389
351
|
discordUserName: sender.name,
|
|
390
|
-
discordUserTag: sender.tag
|
|
391
|
-
|
|
352
|
+
discordUserTag: sender.tag,
|
|
353
|
+
participantKind: sender.isPluralKit ? "pluralkit-member" : sender.authorKind
|
|
354
|
+
},
|
|
355
|
+
...sender.isPluralKit ? { authentication: { discordUserId: "asserted" } } : {}
|
|
392
356
|
};
|
|
393
357
|
}
|
|
394
358
|
function createDiscordDynamicAccessGroupResolver(params) {
|
|
@@ -463,7 +427,10 @@ async function resolveDiscordDmCommandAccess(params) {
|
|
|
463
427
|
},
|
|
464
428
|
dmPolicy: params.dmPolicy,
|
|
465
429
|
groupPolicy: "disabled",
|
|
466
|
-
policy: {
|
|
430
|
+
policy: {
|
|
431
|
+
mutableIdentifierMatching: params.allowNameMatching ? "enabled" : "disabled",
|
|
432
|
+
...params.minIdentifierAuthentication ? { minIdentifierAuthentication: params.minIdentifierAuthentication } : {}
|
|
433
|
+
},
|
|
467
434
|
allowFrom: params.configuredAllowFrom,
|
|
468
435
|
command: {
|
|
469
436
|
hasControlCommand: false,
|
|
@@ -493,7 +460,10 @@ async function resolveDiscordTextCommandAccess(params) {
|
|
|
493
460
|
accessGroupMembership,
|
|
494
461
|
dmPolicy: "allowlist",
|
|
495
462
|
groupPolicy: "allowlist",
|
|
496
|
-
policy: {
|
|
463
|
+
policy: {
|
|
464
|
+
mutableIdentifierMatching: params.allowNameMatching ? "enabled" : "disabled",
|
|
465
|
+
...params.minIdentifierAuthentication ? { minIdentifierAuthentication: params.minIdentifierAuthentication } : {}
|
|
466
|
+
},
|
|
497
467
|
allowFrom: ownerAllowFrom,
|
|
498
468
|
groupAllowFrom: commandGroup,
|
|
499
469
|
command: {
|
|
@@ -505,9 +475,6 @@ async function resolveDiscordTextCommandAccess(params) {
|
|
|
505
475
|
}
|
|
506
476
|
//#endregion
|
|
507
477
|
//#region extensions/discord/src/monitor/thread-channel-context.ts
|
|
508
|
-
function isDiscordThreadChannelType(type) {
|
|
509
|
-
return type === discord_exports.ChannelType.PublicThread || type === discord_exports.ChannelType.PrivateThread || type === discord_exports.ChannelType.AnnouncementThread;
|
|
510
|
-
}
|
|
511
478
|
function buildFetchedChannelInfo(channel) {
|
|
512
479
|
const channelInfo = resolveDiscordChannelInfoSafe(channel);
|
|
513
480
|
if (channelInfo.type === void 0) return null;
|
|
@@ -834,8 +801,8 @@ async function handleDiscordReactionEvent(params) {
|
|
|
834
801
|
const guildSlug = guildInfo?.slug || (data.guild?.name ? normalizeDiscordSlug(data.guild.name) : data.guild_id ?? (isGroupDm ? "group-dm" : "dm"));
|
|
835
802
|
const channelLabel = channelSlug ? `#${channelSlug}` : channelName ? `#${normalizeDiscordSlug(channelName)}` : `#${data.channel_id}`;
|
|
836
803
|
reactionBase = {
|
|
837
|
-
baseText: `Discord reaction ${action}: ${emojiLabel} by ${actorLabel} on ${guildSlug} ${channelLabel} msg ${data.message_id}`,
|
|
838
|
-
contextKey: `discord:reaction:${action}:${data.message_id}:${user.id}:${emojiLabel}`
|
|
804
|
+
baseText: `Discord ${data.burst ? "super " : ""}reaction ${action}: ${emojiLabel} by ${actorLabel} on ${guildSlug} ${channelLabel} msg ${data.message_id}`,
|
|
805
|
+
contextKey: `discord:reaction:${action}:${data.message_id}:${user.id}:${emojiLabel}${data.burst ? ":burst" : ""}`
|
|
839
806
|
};
|
|
840
807
|
return reactionBase;
|
|
841
808
|
};
|
|
@@ -1520,6 +1487,7 @@ async function dispatchDiscordNativeAgentReply(params) {
|
|
|
1520
1487
|
sessionKey: params.ctxPayload.SessionKey ?? params.effectiveRoute.sessionKey
|
|
1521
1488
|
},
|
|
1522
1489
|
ctxPayload: params.ctxPayload,
|
|
1490
|
+
dispatchReplyFromConfig: params.dispatchReplyFromConfig,
|
|
1523
1491
|
delivery: {
|
|
1524
1492
|
deliver: async (payload) => {
|
|
1525
1493
|
if (params.suppressReplies) return {
|
|
@@ -1569,12 +1537,12 @@ async function dispatchDiscordNativeAgentReply(params) {
|
|
|
1569
1537
|
disableBlockStreaming: typeof blockStreamingEnabled === "boolean" ? !blockStreamingEnabled : void 0
|
|
1570
1538
|
}
|
|
1571
1539
|
});
|
|
1572
|
-
const
|
|
1540
|
+
const shouldSettleWithoutVisibleReply = params.suppressReplies || finalReplyOutcome === "suppressed" || turnResult.dispatched && (turnResult.dispatchResult.deliberateSilentTerminalReply === true || turnResult.dispatchResult.deferredToActiveRun !== void 0);
|
|
1573
1541
|
const dispatchResult = {
|
|
1574
1542
|
dispatched: turnResult.dispatched,
|
|
1575
1543
|
...hiddenFinalReply ? { hiddenFinalReply } : {}
|
|
1576
1544
|
};
|
|
1577
|
-
if (!didReply &&
|
|
1545
|
+
if (!didReply && shouldSettleWithoutVisibleReply) {
|
|
1578
1546
|
await settleDiscordInteractionWithoutVisibleReply(params.interaction);
|
|
1579
1547
|
return dispatchResult;
|
|
1580
1548
|
}
|
|
@@ -1593,6 +1561,149 @@ async function dispatchDiscordNativeAgentReply(params) {
|
|
|
1593
1561
|
return dispatchResult;
|
|
1594
1562
|
}
|
|
1595
1563
|
//#endregion
|
|
1564
|
+
//#region extensions/discord/src/monitor/commands.ts
|
|
1565
|
+
function resolveDiscordSlashCommandConfig(raw) {
|
|
1566
|
+
return { ephemeral: raw?.ephemeral !== false };
|
|
1567
|
+
}
|
|
1568
|
+
//#endregion
|
|
1569
|
+
//#region extensions/discord/src/monitor/native-command-arg-ui.ts
|
|
1570
|
+
const DISCORD_COMMAND_ARG_CUSTOM_ID_KEY = "cmdarg";
|
|
1571
|
+
function createCommandArgsWithValue(params) {
|
|
1572
|
+
return { values: { [params.argName]: params.value } };
|
|
1573
|
+
}
|
|
1574
|
+
function buildDiscordCommandArgCustomId(params) {
|
|
1575
|
+
return [
|
|
1576
|
+
`${DISCORD_COMMAND_ARG_CUSTOM_ID_KEY}:command=${encodeCustomIdComponent(params.command)}`,
|
|
1577
|
+
`arg=${encodeCustomIdComponent(params.arg)}`,
|
|
1578
|
+
`value=${encodeCustomIdComponent(params.value)}`,
|
|
1579
|
+
`user=${encodeCustomIdComponent(params.userId)}`
|
|
1580
|
+
].join(";");
|
|
1581
|
+
}
|
|
1582
|
+
function parseDiscordCommandArgData(data) {
|
|
1583
|
+
if (!data || typeof data !== "object") return null;
|
|
1584
|
+
const coerce = (value) => typeof value === "string" || typeof value === "number" ? String(value) : "";
|
|
1585
|
+
const rawCommand = coerce(data.command);
|
|
1586
|
+
const rawArg = coerce(data.arg);
|
|
1587
|
+
const rawValue = coerce(data.value);
|
|
1588
|
+
const rawUser = coerce(data.user);
|
|
1589
|
+
if (!rawCommand || !rawArg || !rawValue || !rawUser) return null;
|
|
1590
|
+
return {
|
|
1591
|
+
command: decodeCustomIdComponent(rawCommand),
|
|
1592
|
+
arg: decodeCustomIdComponent(rawArg),
|
|
1593
|
+
value: decodeCustomIdComponent(rawValue),
|
|
1594
|
+
userId: decodeCustomIdComponent(rawUser)
|
|
1595
|
+
};
|
|
1596
|
+
}
|
|
1597
|
+
async function handleDiscordCommandArgInteraction(params) {
|
|
1598
|
+
const { interaction, data, ctx } = params;
|
|
1599
|
+
const clearWithMessage = async (content) => await params.safeInteractionCall("command arg update", () => interaction.update({
|
|
1600
|
+
content,
|
|
1601
|
+
components: []
|
|
1602
|
+
}));
|
|
1603
|
+
const parsed = parseDiscordCommandArgData(data);
|
|
1604
|
+
if (!parsed) {
|
|
1605
|
+
await clearWithMessage("Sorry, that selection is no longer available.");
|
|
1606
|
+
return;
|
|
1607
|
+
}
|
|
1608
|
+
if (interaction.user?.id && interaction.user.id !== parsed.userId) {
|
|
1609
|
+
await params.safeInteractionCall("command arg ack", () => interaction.acknowledge());
|
|
1610
|
+
return;
|
|
1611
|
+
}
|
|
1612
|
+
const commandDefinition = findCommandByNativeName(parsed.command, "discord") ?? listChatCommands().find((entry) => entry.key === parsed.command);
|
|
1613
|
+
if (!commandDefinition) {
|
|
1614
|
+
await clearWithMessage("Sorry, that command is no longer available.");
|
|
1615
|
+
return;
|
|
1616
|
+
}
|
|
1617
|
+
if (await clearWithMessage(`⏳ Applying ${parsed.value}...`) === null) return;
|
|
1618
|
+
const commandArgs = createCommandArgsWithValue({
|
|
1619
|
+
argName: parsed.arg,
|
|
1620
|
+
value: parsed.value
|
|
1621
|
+
});
|
|
1622
|
+
const commandArgsWithRaw = {
|
|
1623
|
+
...commandArgs,
|
|
1624
|
+
raw: serializeCommandArgs(commandDefinition, commandArgs)
|
|
1625
|
+
};
|
|
1626
|
+
const prompt = buildCommandTextFromArgs(commandDefinition, commandArgsWithRaw);
|
|
1627
|
+
await params.dispatchCommandInteraction({
|
|
1628
|
+
interaction,
|
|
1629
|
+
prompt,
|
|
1630
|
+
command: commandDefinition,
|
|
1631
|
+
commandArgs: commandArgsWithRaw,
|
|
1632
|
+
cfg: ctx.cfg,
|
|
1633
|
+
discordConfig: ctx.discordConfig,
|
|
1634
|
+
accountId: ctx.accountId,
|
|
1635
|
+
sessionPrefix: ctx.sessionPrefix,
|
|
1636
|
+
preferFollowUp: true,
|
|
1637
|
+
threadBindings: ctx.threadBindings,
|
|
1638
|
+
responseEphemeral: resolveDiscordSlashCommandConfig(ctx.discordConfig?.slashCommand).ephemeral,
|
|
1639
|
+
dispatchReplyFromConfig: ctx.dispatchReplyFromConfig,
|
|
1640
|
+
pluginCommandDispatch: { kind: "non-plugin" }
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
async function runDiscordCommandArgButton(params) {
|
|
1644
|
+
await handleDiscordCommandArgInteraction(params);
|
|
1645
|
+
}
|
|
1646
|
+
var DiscordCommandArgButton = class extends Button {
|
|
1647
|
+
constructor(params) {
|
|
1648
|
+
super();
|
|
1649
|
+
this.style = ButtonStyle.Secondary;
|
|
1650
|
+
this.label = params.label;
|
|
1651
|
+
this.customId = params.customId;
|
|
1652
|
+
this.params = params;
|
|
1653
|
+
}
|
|
1654
|
+
async run(interaction, data) {
|
|
1655
|
+
await runDiscordCommandArgButton({
|
|
1656
|
+
...this.params,
|
|
1657
|
+
interaction,
|
|
1658
|
+
data
|
|
1659
|
+
});
|
|
1660
|
+
}
|
|
1661
|
+
};
|
|
1662
|
+
function buildDiscordCommandArgMenu(params) {
|
|
1663
|
+
const { command, menu, interaction } = params;
|
|
1664
|
+
const commandLabel = command.nativeName ?? command.key;
|
|
1665
|
+
const userId = interaction.user?.id ?? "";
|
|
1666
|
+
const rows = chunkItems(menu.choices, 4).map((choices) => {
|
|
1667
|
+
return new Row(choices.map((choice) => new DiscordCommandArgButton({
|
|
1668
|
+
label: choice.label,
|
|
1669
|
+
customId: buildDiscordCommandArgCustomId({
|
|
1670
|
+
command: commandLabel,
|
|
1671
|
+
arg: menu.arg.name,
|
|
1672
|
+
value: choice.value,
|
|
1673
|
+
userId
|
|
1674
|
+
}),
|
|
1675
|
+
ctx: params.ctx,
|
|
1676
|
+
safeInteractionCall: params.safeInteractionCall,
|
|
1677
|
+
dispatchCommandInteraction: params.dispatchCommandInteraction
|
|
1678
|
+
})));
|
|
1679
|
+
});
|
|
1680
|
+
return {
|
|
1681
|
+
content: formatCommandArgMenuTitle({
|
|
1682
|
+
command,
|
|
1683
|
+
menu
|
|
1684
|
+
}),
|
|
1685
|
+
components: rows
|
|
1686
|
+
};
|
|
1687
|
+
}
|
|
1688
|
+
var DiscordCommandArgFallbackButton = class extends Button {
|
|
1689
|
+
constructor(params) {
|
|
1690
|
+
super();
|
|
1691
|
+
this.params = params;
|
|
1692
|
+
this.label = "cmdarg";
|
|
1693
|
+
this.customId = "cmdarg:seed=1";
|
|
1694
|
+
}
|
|
1695
|
+
async run(interaction, data) {
|
|
1696
|
+
await runDiscordCommandArgButton({
|
|
1697
|
+
...this.params,
|
|
1698
|
+
interaction,
|
|
1699
|
+
data
|
|
1700
|
+
});
|
|
1701
|
+
}
|
|
1702
|
+
};
|
|
1703
|
+
function createDiscordCommandArgFallbackButton$1(params) {
|
|
1704
|
+
return new DiscordCommandArgFallbackButton(params);
|
|
1705
|
+
}
|
|
1706
|
+
//#endregion
|
|
1596
1707
|
//#region extensions/discord/src/monitor/native-interaction-channel-context.ts
|
|
1597
1708
|
async function resolveDiscordNativeInteractionChannelContext(params) {
|
|
1598
1709
|
const channelContext = await resolveDiscordThreadLikeChannelContext({
|
|
@@ -1992,188 +2103,6 @@ function buildDiscordNativeCommandContext(params) {
|
|
|
1992
2103
|
});
|
|
1993
2104
|
}
|
|
1994
2105
|
//#endregion
|
|
1995
|
-
//#region extensions/discord/src/monitor/native-command-status.ts
|
|
1996
|
-
async function maybeDeliverDiscordDirectStatus(params) {
|
|
1997
|
-
if (params.suppressReplies || params.commandName !== "status") return null;
|
|
1998
|
-
const statusReply = await params.resolveDirectStatusReplyForSession({
|
|
1999
|
-
cfg: params.cfg,
|
|
2000
|
-
sessionKey: params.commandTargetSessionKey?.trim() || params.sessionKey,
|
|
2001
|
-
channel: params.channel,
|
|
2002
|
-
senderId: params.senderId,
|
|
2003
|
-
senderIsOwner: params.senderIsOwner,
|
|
2004
|
-
isAuthorizedSender: params.isAuthorizedSender,
|
|
2005
|
-
isGroup: params.isGroup,
|
|
2006
|
-
defaultGroupActivation: params.defaultGroupActivation
|
|
2007
|
-
});
|
|
2008
|
-
if (statusReply && hasRenderableReplyPayload(statusReply)) {
|
|
2009
|
-
await deliverDiscordInteractionReply({
|
|
2010
|
-
interaction: params.interaction,
|
|
2011
|
-
payload: statusReply,
|
|
2012
|
-
mediaLocalRoots: params.mediaLocalRoots,
|
|
2013
|
-
textLimit: resolveTextChunkLimit(params.cfg, "discord", params.accountId, { fallbackLimit: 2e3 }),
|
|
2014
|
-
maxLinesPerMessage: resolveDiscordMaxLinesPerMessage({
|
|
2015
|
-
cfg: params.cfg,
|
|
2016
|
-
discordConfig: params.discordConfig,
|
|
2017
|
-
accountId: params.accountId
|
|
2018
|
-
}),
|
|
2019
|
-
preferFollowUp: params.preferFollowUp,
|
|
2020
|
-
responseEphemeral: params.responseEphemeral,
|
|
2021
|
-
chunkMode: resolveChunkMode(params.cfg, "discord", params.accountId)
|
|
2022
|
-
});
|
|
2023
|
-
return {
|
|
2024
|
-
accepted: true,
|
|
2025
|
-
effectiveRoute: params.effectiveRoute
|
|
2026
|
-
};
|
|
2027
|
-
}
|
|
2028
|
-
await params.respond("Status unavailable.");
|
|
2029
|
-
return {
|
|
2030
|
-
accepted: true,
|
|
2031
|
-
effectiveRoute: params.effectiveRoute
|
|
2032
|
-
};
|
|
2033
|
-
}
|
|
2034
|
-
//#endregion
|
|
2035
|
-
//#region extensions/discord/src/monitor/commands.ts
|
|
2036
|
-
function resolveDiscordSlashCommandConfig(raw) {
|
|
2037
|
-
return { ephemeral: raw?.ephemeral !== false };
|
|
2038
|
-
}
|
|
2039
|
-
//#endregion
|
|
2040
|
-
//#region extensions/discord/src/monitor/native-command-arg-ui.ts
|
|
2041
|
-
const DISCORD_COMMAND_ARG_CUSTOM_ID_KEY = "cmdarg";
|
|
2042
|
-
function createCommandArgsWithValue(params) {
|
|
2043
|
-
return { values: { [params.argName]: params.value } };
|
|
2044
|
-
}
|
|
2045
|
-
function buildDiscordCommandArgCustomId(params) {
|
|
2046
|
-
return [
|
|
2047
|
-
`${DISCORD_COMMAND_ARG_CUSTOM_ID_KEY}:command=${encodeCustomIdComponent(params.command)}`,
|
|
2048
|
-
`arg=${encodeCustomIdComponent(params.arg)}`,
|
|
2049
|
-
`value=${encodeCustomIdComponent(params.value)}`,
|
|
2050
|
-
`user=${encodeCustomIdComponent(params.userId)}`
|
|
2051
|
-
].join(";");
|
|
2052
|
-
}
|
|
2053
|
-
function parseDiscordCommandArgData(data) {
|
|
2054
|
-
if (!data || typeof data !== "object") return null;
|
|
2055
|
-
const coerce = (value) => typeof value === "string" || typeof value === "number" ? String(value) : "";
|
|
2056
|
-
const rawCommand = coerce(data.command);
|
|
2057
|
-
const rawArg = coerce(data.arg);
|
|
2058
|
-
const rawValue = coerce(data.value);
|
|
2059
|
-
const rawUser = coerce(data.user);
|
|
2060
|
-
if (!rawCommand || !rawArg || !rawValue || !rawUser) return null;
|
|
2061
|
-
return {
|
|
2062
|
-
command: decodeCustomIdComponent(rawCommand),
|
|
2063
|
-
arg: decodeCustomIdComponent(rawArg),
|
|
2064
|
-
value: decodeCustomIdComponent(rawValue),
|
|
2065
|
-
userId: decodeCustomIdComponent(rawUser)
|
|
2066
|
-
};
|
|
2067
|
-
}
|
|
2068
|
-
async function handleDiscordCommandArgInteraction(params) {
|
|
2069
|
-
const { interaction, data, ctx } = params;
|
|
2070
|
-
const clearWithMessage = async (content) => await params.safeInteractionCall("command arg update", () => interaction.update({
|
|
2071
|
-
content,
|
|
2072
|
-
components: []
|
|
2073
|
-
}));
|
|
2074
|
-
const parsed = parseDiscordCommandArgData(data);
|
|
2075
|
-
if (!parsed) {
|
|
2076
|
-
await clearWithMessage("Sorry, that selection is no longer available.");
|
|
2077
|
-
return;
|
|
2078
|
-
}
|
|
2079
|
-
if (interaction.user?.id && interaction.user.id !== parsed.userId) {
|
|
2080
|
-
await params.safeInteractionCall("command arg ack", () => interaction.acknowledge());
|
|
2081
|
-
return;
|
|
2082
|
-
}
|
|
2083
|
-
const commandDefinition = findCommandByNativeName(parsed.command, "discord") ?? listChatCommands().find((entry) => entry.key === parsed.command);
|
|
2084
|
-
if (!commandDefinition) {
|
|
2085
|
-
await clearWithMessage("Sorry, that command is no longer available.");
|
|
2086
|
-
return;
|
|
2087
|
-
}
|
|
2088
|
-
if (await clearWithMessage(`⏳ Applying ${parsed.value}...`) === null) return;
|
|
2089
|
-
const commandArgs = createCommandArgsWithValue({
|
|
2090
|
-
argName: parsed.arg,
|
|
2091
|
-
value: parsed.value
|
|
2092
|
-
});
|
|
2093
|
-
const commandArgsWithRaw = {
|
|
2094
|
-
...commandArgs,
|
|
2095
|
-
raw: serializeCommandArgs(commandDefinition, commandArgs)
|
|
2096
|
-
};
|
|
2097
|
-
const prompt = buildCommandTextFromArgs(commandDefinition, commandArgsWithRaw);
|
|
2098
|
-
await params.dispatchCommandInteraction({
|
|
2099
|
-
interaction,
|
|
2100
|
-
prompt,
|
|
2101
|
-
command: commandDefinition,
|
|
2102
|
-
commandArgs: commandArgsWithRaw,
|
|
2103
|
-
cfg: ctx.cfg,
|
|
2104
|
-
discordConfig: ctx.discordConfig,
|
|
2105
|
-
accountId: ctx.accountId,
|
|
2106
|
-
sessionPrefix: ctx.sessionPrefix,
|
|
2107
|
-
preferFollowUp: true,
|
|
2108
|
-
threadBindings: ctx.threadBindings,
|
|
2109
|
-
responseEphemeral: resolveDiscordSlashCommandConfig(ctx.discordConfig?.slashCommand).ephemeral,
|
|
2110
|
-
pluginCommandDispatch: { kind: "non-plugin" }
|
|
2111
|
-
});
|
|
2112
|
-
}
|
|
2113
|
-
async function runDiscordCommandArgButton(params) {
|
|
2114
|
-
await handleDiscordCommandArgInteraction(params);
|
|
2115
|
-
}
|
|
2116
|
-
var DiscordCommandArgButton = class extends Button {
|
|
2117
|
-
constructor(params) {
|
|
2118
|
-
super();
|
|
2119
|
-
this.style = ButtonStyle.Secondary;
|
|
2120
|
-
this.label = params.label;
|
|
2121
|
-
this.customId = params.customId;
|
|
2122
|
-
this.params = params;
|
|
2123
|
-
}
|
|
2124
|
-
async run(interaction, data) {
|
|
2125
|
-
await runDiscordCommandArgButton({
|
|
2126
|
-
...this.params,
|
|
2127
|
-
interaction,
|
|
2128
|
-
data
|
|
2129
|
-
});
|
|
2130
|
-
}
|
|
2131
|
-
};
|
|
2132
|
-
function buildDiscordCommandArgMenu(params) {
|
|
2133
|
-
const { command, menu, interaction } = params;
|
|
2134
|
-
const commandLabel = command.nativeName ?? command.key;
|
|
2135
|
-
const userId = interaction.user?.id ?? "";
|
|
2136
|
-
const rows = chunkItems(menu.choices, 4).map((choices) => {
|
|
2137
|
-
return new Row(choices.map((choice) => new DiscordCommandArgButton({
|
|
2138
|
-
label: choice.label,
|
|
2139
|
-
customId: buildDiscordCommandArgCustomId({
|
|
2140
|
-
command: commandLabel,
|
|
2141
|
-
arg: menu.arg.name,
|
|
2142
|
-
value: choice.value,
|
|
2143
|
-
userId
|
|
2144
|
-
}),
|
|
2145
|
-
ctx: params.ctx,
|
|
2146
|
-
safeInteractionCall: params.safeInteractionCall,
|
|
2147
|
-
dispatchCommandInteraction: params.dispatchCommandInteraction
|
|
2148
|
-
})));
|
|
2149
|
-
});
|
|
2150
|
-
return {
|
|
2151
|
-
content: formatCommandArgMenuTitle({
|
|
2152
|
-
command,
|
|
2153
|
-
menu
|
|
2154
|
-
}),
|
|
2155
|
-
components: rows
|
|
2156
|
-
};
|
|
2157
|
-
}
|
|
2158
|
-
var DiscordCommandArgFallbackButton = class extends Button {
|
|
2159
|
-
constructor(params) {
|
|
2160
|
-
super();
|
|
2161
|
-
this.params = params;
|
|
2162
|
-
this.label = "cmdarg";
|
|
2163
|
-
this.customId = "cmdarg:seed=1";
|
|
2164
|
-
}
|
|
2165
|
-
async run(interaction, data) {
|
|
2166
|
-
await runDiscordCommandArgButton({
|
|
2167
|
-
...this.params,
|
|
2168
|
-
interaction,
|
|
2169
|
-
data
|
|
2170
|
-
});
|
|
2171
|
-
}
|
|
2172
|
-
};
|
|
2173
|
-
function createDiscordCommandArgFallbackButton$1(params) {
|
|
2174
|
-
return new DiscordCommandArgFallbackButton(params);
|
|
2175
|
-
}
|
|
2176
|
-
//#endregion
|
|
2177
2106
|
//#region extensions/discord/src/monitor/model-picker-preferences.ts
|
|
2178
2107
|
const DEFAULT_RECENT_LIMIT = 5;
|
|
2179
2108
|
const PREFERENCE_MAX_ENTRIES = 2e3;
|
|
@@ -2352,8 +2281,8 @@ function paginateItems(params) {
|
|
|
2352
2281
|
};
|
|
2353
2282
|
}
|
|
2354
2283
|
async function loadDiscordModelPickerData(cfg, agentId) {
|
|
2355
|
-
const {
|
|
2356
|
-
return
|
|
2284
|
+
const { buildPreparedModelsProviderData } = await loadModelsProviderRuntime();
|
|
2285
|
+
return buildPreparedModelsProviderData(cfg, agentId);
|
|
2357
2286
|
}
|
|
2358
2287
|
function buildDiscordModelPickerCustomId(params) {
|
|
2359
2288
|
const userId = params.userId.trim();
|
|
@@ -3170,6 +3099,7 @@ async function applyDiscordModelPickerSelection(params) {
|
|
|
3170
3099
|
preferFollowUp: true,
|
|
3171
3100
|
threadBindings: params.threadBindings,
|
|
3172
3101
|
suppressReplies: true,
|
|
3102
|
+
dispatchReplyFromConfig: params.dispatchReplyFromConfig,
|
|
3173
3103
|
pluginCommandDispatch: { kind: "non-plugin" }
|
|
3174
3104
|
}), 12e3);
|
|
3175
3105
|
if (!dispatchResult.accepted) return {
|
|
@@ -3827,6 +3757,7 @@ async function handleDiscordModelPickerInteraction(params) {
|
|
|
3827
3757
|
accountId: ctx.accountId,
|
|
3828
3758
|
sessionPrefix: ctx.sessionPrefix,
|
|
3829
3759
|
threadBindings: ctx.threadBindings,
|
|
3760
|
+
dispatchReplyFromConfig: ctx.dispatchReplyFromConfig,
|
|
3830
3761
|
route,
|
|
3831
3762
|
resolvedModelRef,
|
|
3832
3763
|
selectedRuntime,
|
|
@@ -3890,6 +3821,46 @@ function createDiscordModelPickerFallbackSelect$1(params) {
|
|
|
3890
3821
|
return new DiscordModelPickerFallbackSelect(params);
|
|
3891
3822
|
}
|
|
3892
3823
|
//#endregion
|
|
3824
|
+
//#region extensions/discord/src/monitor/native-command-status.ts
|
|
3825
|
+
async function maybeDeliverDiscordDirectStatus(params) {
|
|
3826
|
+
if (params.suppressReplies || params.commandName !== "status") return null;
|
|
3827
|
+
const statusReply = await params.resolveDirectStatusReplyForSession({
|
|
3828
|
+
cfg: params.cfg,
|
|
3829
|
+
sessionKey: params.commandTargetSessionKey?.trim() || params.sessionKey,
|
|
3830
|
+
channel: params.channel,
|
|
3831
|
+
senderId: params.senderId,
|
|
3832
|
+
senderIsOwner: params.senderIsOwner,
|
|
3833
|
+
isAuthorizedSender: params.isAuthorizedSender,
|
|
3834
|
+
isGroup: params.isGroup,
|
|
3835
|
+
defaultGroupActivation: params.defaultGroupActivation
|
|
3836
|
+
});
|
|
3837
|
+
if (statusReply && hasRenderableReplyPayload(statusReply)) {
|
|
3838
|
+
await deliverDiscordInteractionReply({
|
|
3839
|
+
interaction: params.interaction,
|
|
3840
|
+
payload: statusReply,
|
|
3841
|
+
mediaLocalRoots: params.mediaLocalRoots,
|
|
3842
|
+
textLimit: resolveTextChunkLimit(params.cfg, "discord", params.accountId, { fallbackLimit: 2e3 }),
|
|
3843
|
+
maxLinesPerMessage: resolveDiscordMaxLinesPerMessage({
|
|
3844
|
+
cfg: params.cfg,
|
|
3845
|
+
discordConfig: params.discordConfig,
|
|
3846
|
+
accountId: params.accountId
|
|
3847
|
+
}),
|
|
3848
|
+
preferFollowUp: params.preferFollowUp,
|
|
3849
|
+
responseEphemeral: params.responseEphemeral,
|
|
3850
|
+
chunkMode: resolveChunkMode(params.cfg, "discord", params.accountId)
|
|
3851
|
+
});
|
|
3852
|
+
return {
|
|
3853
|
+
accepted: true,
|
|
3854
|
+
effectiveRoute: params.effectiveRoute
|
|
3855
|
+
};
|
|
3856
|
+
}
|
|
3857
|
+
await params.respond("Status unavailable.");
|
|
3858
|
+
return {
|
|
3859
|
+
accepted: true,
|
|
3860
|
+
effectiveRoute: params.effectiveRoute
|
|
3861
|
+
};
|
|
3862
|
+
}
|
|
3863
|
+
//#endregion
|
|
3893
3864
|
//#region extensions/discord/src/monitor/native-command.args.ts
|
|
3894
3865
|
function readDiscordCommandArgs(interaction, definitions) {
|
|
3895
3866
|
if (!definitions || definitions.length === 0) return;
|
|
@@ -4019,7 +3990,7 @@ function buildDiscordCommandOptions(params) {
|
|
|
4019
3990
|
const log = createSubsystemLogger("discord/native-command");
|
|
4020
3991
|
const NON_PLUGIN_COMMAND_DISPATCH = Object.freeze({ kind: "non-plugin" });
|
|
4021
3992
|
function createDiscordNativeCommand(params) {
|
|
4022
|
-
const { command, cfg, discordConfig, accountId, sessionPrefix, ephemeralDefault, threadBindings } = params;
|
|
3993
|
+
const { command, cfg, discordConfig, accountId, sessionPrefix, ephemeralDefault, threadBindings, dispatchReplyFromConfig } = params;
|
|
4023
3994
|
const fallbackCommandDefinition = createNativeCommandDefinition(command);
|
|
4024
3995
|
const pluginCommandCandidate = "prepareDispatch" in command ? command : void 0;
|
|
4025
3996
|
const commandDefinition = pluginCommandCandidate ? fallbackCommandDefinition : findCommandByNativeName$1(command.name, "discord", { includeBundledChannelFallback: false }) ?? fallbackCommandDefinition;
|
|
@@ -4086,13 +4057,14 @@ function createDiscordNativeCommand(params) {
|
|
|
4086
4057
|
preferFollowUp: true,
|
|
4087
4058
|
threadBindings,
|
|
4088
4059
|
responseEphemeral: ephemeralDefault,
|
|
4060
|
+
dispatchReplyFromConfig,
|
|
4089
4061
|
pluginCommandDispatch: preparedPluginCommand ?? NON_PLUGIN_COMMAND_DISPATCH
|
|
4090
4062
|
});
|
|
4091
4063
|
}
|
|
4092
4064
|
}();
|
|
4093
4065
|
}
|
|
4094
4066
|
async function dispatchDiscordCommandInteraction(params) {
|
|
4095
|
-
const { interaction, prompt, command, commandArgs, cfg: inputConfig, discordConfig, accountId, sessionPrefix, preferFollowUp, threadBindings, responseEphemeral, suppressReplies } = params;
|
|
4067
|
+
const { interaction, prompt, command, commandArgs, cfg: inputConfig, discordConfig, accountId, sessionPrefix, preferFollowUp, threadBindings, responseEphemeral, suppressReplies, dispatchReplyFromConfig } = params;
|
|
4096
4068
|
const cfg = getRuntimeConfigSnapshot() ?? inputConfig;
|
|
4097
4069
|
const commandName = command.nativeName ?? command.key;
|
|
4098
4070
|
const respond = async (content, options) => {
|
|
@@ -4330,7 +4302,8 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
4330
4302
|
discordConfig,
|
|
4331
4303
|
accountId,
|
|
4332
4304
|
sessionPrefix,
|
|
4333
|
-
threadBindings
|
|
4305
|
+
threadBindings,
|
|
4306
|
+
dispatchReplyFromConfig
|
|
4334
4307
|
},
|
|
4335
4308
|
safeInteractionCall: safeDiscordInteractionCall,
|
|
4336
4309
|
dispatchCommandInteraction: dispatchDiscordCommandInteraction
|
|
@@ -4517,6 +4490,7 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
4517
4490
|
preferFollowUp,
|
|
4518
4491
|
responseEphemeral,
|
|
4519
4492
|
suppressReplies,
|
|
4493
|
+
dispatchReplyFromConfig,
|
|
4520
4494
|
log,
|
|
4521
4495
|
pluginCommandDispatch: params.pluginCommandDispatch
|
|
4522
4496
|
});
|
|
@@ -4851,7 +4825,10 @@ const GatewayIntents = GatewayIntentBits;
|
|
|
4851
4825
|
const READY_STATE_OPEN = 1;
|
|
4852
4826
|
const DEFAULT_GATEWAY_URL = "wss://gateway.discord.gg/";
|
|
4853
4827
|
const DISCORD_GATEWAY_PAYLOAD_LIMIT_BYTES = 4096;
|
|
4854
|
-
const DISCORD_GATEWAY_WS_CLIENT_OPTIONS = Object.freeze({
|
|
4828
|
+
const DISCORD_GATEWAY_WS_CLIENT_OPTIONS = Object.freeze({
|
|
4829
|
+
maxPayload: 16 * 1024 * 1024,
|
|
4830
|
+
handshakeTimeout: 3e4
|
|
4831
|
+
});
|
|
4855
4832
|
const INVALID_SESSION_MIN_DELAY_MS = 1e3;
|
|
4856
4833
|
const INVALID_SESSION_JITTER_MS = 4e3;
|
|
4857
4834
|
const RESUME_FAILURE_THRESHOLD = 3;
|
|
@@ -4891,6 +4868,9 @@ var GatewayPlugin = class extends Plugin {
|
|
|
4891
4868
|
listVoiceChannelStates(guildId, channelId) {
|
|
4892
4869
|
return this.voiceStateCache.listVoiceChannelStates(guildId, channelId);
|
|
4893
4870
|
}
|
|
4871
|
+
async fetchGuildEmojis(guildId, fetcher) {
|
|
4872
|
+
return this.client ? await this.client.fetchGuildEmojis(guildId, fetcher) : await fetcher();
|
|
4873
|
+
}
|
|
4894
4874
|
takeVoiceStateTransition(state) {
|
|
4895
4875
|
return this.voiceStateCache.takeTransition(state);
|
|
4896
4876
|
}
|
|
@@ -5673,7 +5653,6 @@ async function fetchDiscordGatewayMetadataGuarded(input, init, options) {
|
|
|
5673
5653
|
}
|
|
5674
5654
|
//#endregion
|
|
5675
5655
|
//#region extensions/discord/src/monitor/gateway-plugin.ts
|
|
5676
|
-
const DISCORD_GATEWAY_HANDSHAKE_TIMEOUT_MS = 3e4;
|
|
5677
5656
|
const DISCORD_GATEWAY_POLICY_VIOLATION_CLOSE_CODE = 1008;
|
|
5678
5657
|
const DISCORD_GATEWAY_WS_RECEIVER_LIMIT_CODE = "WS_ERR_TOO_MANY_BUFFERED_PARTS";
|
|
5679
5658
|
const DISCORD_GATEWAY_CLOSE_REASON_LOG_MAX_CHARS = 240;
|
|
@@ -5741,7 +5720,7 @@ function resolveDiscordGatewayIntents(params) {
|
|
|
5741
5720
|
const intentsConfig = params?.intentsConfig;
|
|
5742
5721
|
const voiceEnabled = params?.voiceEnabled;
|
|
5743
5722
|
const voiceStatesEnabled = intentsConfig?.voiceStates ?? voiceEnabled ?? false;
|
|
5744
|
-
let intents = GatewayIntents.Guilds | GatewayIntents.GuildMessages | GatewayIntents.DirectMessages | GatewayIntents.GuildMessageReactions | GatewayIntents.DirectMessageReactions;
|
|
5723
|
+
let intents = GatewayIntents.Guilds | GatewayIntents.GuildExpressions | GatewayIntents.GuildMessages | GatewayIntents.DirectMessages | GatewayIntents.GuildMessageReactions | GatewayIntents.DirectMessageReactions;
|
|
5745
5724
|
if (intentsConfig?.messageContent !== false) intents |= GatewayIntents.MessageContent;
|
|
5746
5725
|
if (voiceStatesEnabled) intents |= GatewayIntents.GuildVoiceStates;
|
|
5747
5726
|
if (intentsConfig?.presence) intents |= GatewayIntents.GuildPresences;
|
|
@@ -5790,7 +5769,6 @@ function createGatewayPlugin(params) {
|
|
|
5790
5769
|
const wsFlowId = randomUUID();
|
|
5791
5770
|
const socket = new ((params.testing?.webSocketCtor) ?? ws.default)(url, {
|
|
5792
5771
|
...DISCORD_GATEWAY_WS_CLIENT_OPTIONS,
|
|
5793
|
-
handshakeTimeout: DISCORD_GATEWAY_HANDSHAKE_TIMEOUT_MS,
|
|
5794
5772
|
...params.wsAgent ? { agent: params.wsAgent } : {}
|
|
5795
5773
|
});
|
|
5796
5774
|
let lastTransportError;
|
|
@@ -6518,7 +6496,7 @@ async function runDiscordGatewayLifecycle(params) {
|
|
|
6518
6496
|
gatewayEmitter?.removeListener(DISCORD_GATEWAY_TRANSPORT_ACTIVITY_EVENT, onGatewayTransportActivity);
|
|
6519
6497
|
if (params.voiceManager) {
|
|
6520
6498
|
await params.voiceManager.destroy();
|
|
6521
|
-
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-
|
|
6499
|
+
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-BLEMH_yi.js").then((n) => n.n);
|
|
6522
6500
|
setDiscordTranscriptsVoiceManager({
|
|
6523
6501
|
accountId: params.accountId,
|
|
6524
6502
|
manager: null
|
|
@@ -6533,7 +6511,7 @@ async function runDiscordGatewayLifecycle(params) {
|
|
|
6533
6511
|
let discordVoiceRuntimePromise;
|
|
6534
6512
|
let discordProviderSessionRuntimePromise;
|
|
6535
6513
|
async function loadDiscordVoiceRuntime() {
|
|
6536
|
-
const promise = discordVoiceRuntimePromise ?? import("./voice-runtime-
|
|
6514
|
+
const promise = discordVoiceRuntimePromise ?? import("./voice-runtime-DY6_o73o.js");
|
|
6537
6515
|
discordVoiceRuntimePromise = promise;
|
|
6538
6516
|
try {
|
|
6539
6517
|
return await promise;
|
|
@@ -6543,7 +6521,7 @@ async function loadDiscordVoiceRuntime() {
|
|
|
6543
6521
|
}
|
|
6544
6522
|
}
|
|
6545
6523
|
async function loadDiscordProviderSessionRuntime() {
|
|
6546
|
-
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-
|
|
6524
|
+
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-DSNe7r2W.js");
|
|
6547
6525
|
discordProviderSessionRuntimePromise = promise;
|
|
6548
6526
|
try {
|
|
6549
6527
|
return await promise;
|
|
@@ -7591,9 +7569,6 @@ function formatUsername(user) {
|
|
|
7591
7569
|
if (user.discriminator && user.discriminator !== "0") return `${user.username}#${user.discriminator}`;
|
|
7592
7570
|
return user.username;
|
|
7593
7571
|
}
|
|
7594
|
-
function isThreadChannelType(channelType) {
|
|
7595
|
-
return channelType === ChannelType.PublicThread || channelType === ChannelType.PrivateThread || channelType === ChannelType.AnnouncementThread;
|
|
7596
|
-
}
|
|
7597
7572
|
function resolveAgentComponentRoute(params) {
|
|
7598
7573
|
return resolveAgentRoute({
|
|
7599
7574
|
cfg: params.ctx.cfg,
|
|
@@ -7636,7 +7611,7 @@ function resolveDiscordChannelContext(interaction) {
|
|
|
7636
7611
|
const channelSlug = channelName ? normalizeDiscordSlug(channelName) : "";
|
|
7637
7612
|
const displayChannelSlug = channelName ? normalizeDiscordDisplaySlug(channelName) : "";
|
|
7638
7613
|
const channelType = channelInfo.type;
|
|
7639
|
-
const isThread =
|
|
7614
|
+
const isThread = isDiscordThreadChannelType(channelType);
|
|
7640
7615
|
let parentId;
|
|
7641
7616
|
let parentName;
|
|
7642
7617
|
let parentSlug = "";
|
|
@@ -8311,6 +8286,7 @@ async function deliverDiscordReply(params) {
|
|
|
8311
8286
|
formatting: delivery.formatting,
|
|
8312
8287
|
threadId: delivery.threadId,
|
|
8313
8288
|
identity: delivery.identity,
|
|
8289
|
+
onPlatformSendDispatch: params.onPlatformSendDispatch,
|
|
8314
8290
|
deps: createDiscordDeliveryDeps({
|
|
8315
8291
|
cfg: params.cfg,
|
|
8316
8292
|
token: params.token,
|
|
@@ -8349,7 +8325,7 @@ async function deliverDiscordReply(params) {
|
|
|
8349
8325
|
//#endregion
|
|
8350
8326
|
//#region extensions/discord/src/monitor/agent-components.dispatch.ts
|
|
8351
8327
|
const loadConversationRuntime$1 = createLazyRuntimeModule(() => import("./agent-components.runtime-CEPrf2SY.js"));
|
|
8352
|
-
const loadTypingRuntime = createLazyRuntimeModule(() => import("./typing-
|
|
8328
|
+
const loadTypingRuntime = createLazyRuntimeModule(() => import("./typing-B9snnwMe.js").then((n) => n.n));
|
|
8353
8329
|
function buildDiscordComponentConversationLabel(params) {
|
|
8354
8330
|
if (params.interactionCtx.isDirectMessage) return buildDirectLabel(params.interactionCtx.user);
|
|
8355
8331
|
if (params.interactionCtx.isGroupDm) return `Group DM #${params.channelCtx.channelName ?? params.interactionCtx.channelId} channel id:${params.interactionCtx.channelId}`;
|
|
@@ -8589,7 +8565,8 @@ async function dispatchDiscordComponentEvent(params) {
|
|
|
8589
8565
|
chunkMode: resolveChunkMode(ctx.cfg, "discord", accountId),
|
|
8590
8566
|
mediaLocalRoots,
|
|
8591
8567
|
kind: info.kind,
|
|
8592
|
-
bindPendingFinalDelivery: info.bindPendingFinalDelivery
|
|
8568
|
+
bindPendingFinalDelivery: info.bindPendingFinalDelivery,
|
|
8569
|
+
onPlatformSendDispatch: info.onPlatformSendDispatch
|
|
8593
8570
|
});
|
|
8594
8571
|
if (result.visibleReplySent) replyReference.markSent();
|
|
8595
8572
|
return result;
|
|
@@ -8754,7 +8731,7 @@ async function dispatchPluginDiscordInteractiveEvent(params) {
|
|
|
8754
8731
|
}
|
|
8755
8732
|
//#endregion
|
|
8756
8733
|
//#region extensions/discord/src/monitor/agent-components.handlers.ts
|
|
8757
|
-
const loadComponentsRuntime = createLazyRuntimeModule(() => import("./components-
|
|
8734
|
+
const loadComponentsRuntime = createLazyRuntimeModule(() => import("./components-Dk35LTf_.js").then((n) => n.t));
|
|
8758
8735
|
async function handleDiscordComponentEvent(params) {
|
|
8759
8736
|
const parsed = parseDiscordComponentData(params.data, resolveInteractionCustomId(params.interaction));
|
|
8760
8737
|
if (!parsed) {
|
|
@@ -9400,29 +9377,24 @@ var QuestionButton = class extends Button {
|
|
|
9400
9377
|
try {
|
|
9401
9378
|
await interaction.acknowledge();
|
|
9402
9379
|
} catch {}
|
|
9403
|
-
let
|
|
9380
|
+
let content;
|
|
9404
9381
|
try {
|
|
9405
|
-
|
|
9382
|
+
content = (await this.ctx.resolveQuestion({
|
|
9406
9383
|
cfg: this.ctx.cfg,
|
|
9407
9384
|
questionId: callback.questionId,
|
|
9408
9385
|
optionIndex: callback.optionIndex,
|
|
9409
9386
|
senderId: interaction.userId,
|
|
9410
9387
|
clientDisplayName: `Discord question (${this.ctx.accountId})`
|
|
9411
|
-
});
|
|
9388
|
+
})).status === "answered" ? "Answer submitted." : "This question was already answered.";
|
|
9412
9389
|
} catch {
|
|
9413
|
-
|
|
9414
|
-
await interaction.followUp({
|
|
9415
|
-
content: "Could not submit this answer.",
|
|
9416
|
-
ephemeral: true
|
|
9417
|
-
});
|
|
9418
|
-
} catch {}
|
|
9419
|
-
return;
|
|
9390
|
+
content = "Could not submit this answer.";
|
|
9420
9391
|
}
|
|
9421
9392
|
try {
|
|
9422
|
-
|
|
9423
|
-
content
|
|
9393
|
+
const feedback = {
|
|
9394
|
+
content,
|
|
9424
9395
|
ephemeral: true
|
|
9425
|
-
}
|
|
9396
|
+
};
|
|
9397
|
+
await (interaction.responseState === "unacknowledged" ? interaction.reply(feedback) : interaction.followUp(feedback));
|
|
9426
9398
|
} catch {}
|
|
9427
9399
|
}
|
|
9428
9400
|
};
|
|
@@ -9466,7 +9438,8 @@ function createDiscordProviderInteractionSurface(params) {
|
|
|
9466
9438
|
accountId: params.accountId,
|
|
9467
9439
|
sessionPrefix: params.sessionPrefix,
|
|
9468
9440
|
ephemeralDefault: params.ephemeralDefault,
|
|
9469
|
-
threadBindings: params.threadBindings
|
|
9441
|
+
threadBindings: params.threadBindings,
|
|
9442
|
+
dispatchReplyFromConfig: params.channelRuntime?.reply?.dispatchReplyFromConfig
|
|
9470
9443
|
});
|
|
9471
9444
|
});
|
|
9472
9445
|
const execApprovalsConfig = params.discordConfig.execApprovals ?? {};
|
|
@@ -9511,21 +9484,24 @@ function createDiscordProviderInteractionSurface(params) {
|
|
|
9511
9484
|
discordConfig: params.discordConfig,
|
|
9512
9485
|
accountId: params.accountId,
|
|
9513
9486
|
sessionPrefix: params.sessionPrefix,
|
|
9514
|
-
threadBindings: params.threadBindings
|
|
9487
|
+
threadBindings: params.threadBindings,
|
|
9488
|
+
dispatchReplyFromConfig: params.channelRuntime?.reply?.dispatchReplyFromConfig
|
|
9515
9489
|
}),
|
|
9516
9490
|
createDiscordModelPickerFallbackButton({
|
|
9517
9491
|
cfg: params.cfg,
|
|
9518
9492
|
discordConfig: params.discordConfig,
|
|
9519
9493
|
accountId: params.accountId,
|
|
9520
9494
|
sessionPrefix: params.sessionPrefix,
|
|
9521
|
-
threadBindings: params.threadBindings
|
|
9495
|
+
threadBindings: params.threadBindings,
|
|
9496
|
+
dispatchReplyFromConfig: params.channelRuntime?.reply?.dispatchReplyFromConfig
|
|
9522
9497
|
}),
|
|
9523
9498
|
createDiscordModelPickerFallbackSelect({
|
|
9524
9499
|
cfg: params.cfg,
|
|
9525
9500
|
discordConfig: params.discordConfig,
|
|
9526
9501
|
accountId: params.accountId,
|
|
9527
9502
|
sessionPrefix: params.sessionPrefix,
|
|
9528
|
-
threadBindings: params.threadBindings
|
|
9503
|
+
threadBindings: params.threadBindings,
|
|
9504
|
+
dispatchReplyFromConfig: params.channelRuntime?.reply?.dispatchReplyFromConfig
|
|
9529
9505
|
})
|
|
9530
9506
|
];
|
|
9531
9507
|
const activityButton = createDiscordActivityButton({
|
|
@@ -9605,6 +9581,170 @@ var VoicePlugin = class extends Plugin {
|
|
|
9605
9581
|
}
|
|
9606
9582
|
};
|
|
9607
9583
|
//#endregion
|
|
9584
|
+
//#region extensions/discord/src/monitor/message-handler.preflight-channel-access.ts
|
|
9585
|
+
function resolveDiscordPreflightChannelAccess(params) {
|
|
9586
|
+
if (params.isGuildMessage && params.channelConfig?.enabled === false) {
|
|
9587
|
+
logDebug(`[discord-preflight] drop: channel disabled`);
|
|
9588
|
+
logVerbose(`Blocked discord channel ${params.messageChannelId} (channel disabled, ${params.channelMatchMeta})`);
|
|
9589
|
+
return {
|
|
9590
|
+
allowed: false,
|
|
9591
|
+
channelAllowlistConfigured: false,
|
|
9592
|
+
channelAllowed: false
|
|
9593
|
+
};
|
|
9594
|
+
}
|
|
9595
|
+
const groupDmAllowed = params.isGroupDm && resolveGroupDmAllow({
|
|
9596
|
+
channels: params.groupDmChannels,
|
|
9597
|
+
channelId: params.messageChannelId,
|
|
9598
|
+
channelName: params.displayChannelName,
|
|
9599
|
+
channelSlug: params.displayChannelSlug
|
|
9600
|
+
});
|
|
9601
|
+
if (params.isGroupDm && !groupDmAllowed) return {
|
|
9602
|
+
allowed: false,
|
|
9603
|
+
channelAllowlistConfigured: false,
|
|
9604
|
+
channelAllowed: false
|
|
9605
|
+
};
|
|
9606
|
+
const channelAllowlistConfigured = Boolean(params.guildInfo?.channels) && Object.keys(params.guildInfo?.channels ?? {}).length > 0;
|
|
9607
|
+
const channelAllowed = params.channelConfig?.allowed !== false;
|
|
9608
|
+
if (params.isGuildMessage && !isDiscordGroupAllowedByPolicy({
|
|
9609
|
+
groupPolicy: params.groupPolicy,
|
|
9610
|
+
guildAllowlisted: Boolean(params.guildInfo),
|
|
9611
|
+
channelAllowlistConfigured,
|
|
9612
|
+
channelAllowed
|
|
9613
|
+
})) {
|
|
9614
|
+
if (params.groupPolicy === "disabled") {
|
|
9615
|
+
logDebug(`[discord-preflight] drop: groupPolicy disabled`);
|
|
9616
|
+
logVerbose(`discord: drop guild message (groupPolicy: disabled, ${params.channelMatchMeta})`);
|
|
9617
|
+
} else if (!channelAllowlistConfigured) {
|
|
9618
|
+
logDebug(`[discord-preflight] drop: groupPolicy allowlist, no channel allowlist configured`);
|
|
9619
|
+
logVerbose(`discord: drop guild message (groupPolicy: allowlist, no channel allowlist, ${params.channelMatchMeta})`);
|
|
9620
|
+
} else {
|
|
9621
|
+
logDebug(`[discord] Ignored message from channel ${params.messageChannelId} (not in guild allowlist). Add to guilds.<guildId>.channels to enable.`);
|
|
9622
|
+
logVerbose(`Blocked discord channel ${params.messageChannelId} not in guild channel allowlist (groupPolicy: allowlist, ${params.channelMatchMeta})`);
|
|
9623
|
+
}
|
|
9624
|
+
return {
|
|
9625
|
+
allowed: false,
|
|
9626
|
+
channelAllowlistConfigured,
|
|
9627
|
+
channelAllowed
|
|
9628
|
+
};
|
|
9629
|
+
}
|
|
9630
|
+
if (params.isGuildMessage && params.channelConfig?.allowed === false) {
|
|
9631
|
+
logDebug(`[discord-preflight] drop: channelConfig.allowed===false`);
|
|
9632
|
+
logVerbose(`Blocked discord channel ${params.messageChannelId} not in guild channel allowlist (${params.channelMatchMeta})`);
|
|
9633
|
+
return {
|
|
9634
|
+
allowed: false,
|
|
9635
|
+
channelAllowlistConfigured,
|
|
9636
|
+
channelAllowed
|
|
9637
|
+
};
|
|
9638
|
+
}
|
|
9639
|
+
if (params.isGuildMessage) {
|
|
9640
|
+
logDebug(`[discord-preflight] pass: channel allowed`);
|
|
9641
|
+
logVerbose(`discord: allow channel ${params.messageChannelId} (${params.channelMatchMeta})`);
|
|
9642
|
+
}
|
|
9643
|
+
return {
|
|
9644
|
+
allowed: true,
|
|
9645
|
+
channelAllowlistConfigured,
|
|
9646
|
+
channelAllowed
|
|
9647
|
+
};
|
|
9648
|
+
}
|
|
9649
|
+
//#endregion
|
|
9650
|
+
//#region extensions/discord/src/monitor/listeners.guild-join.ts
|
|
9651
|
+
const DISCORD_GUILD_JOIN_INTRO_MAX_AGE_MS = 300 * 1e3;
|
|
9652
|
+
var DiscordGuildJoinIntroductionListener = class extends GuildCreateListener {
|
|
9653
|
+
constructor(params) {
|
|
9654
|
+
super();
|
|
9655
|
+
this.params = params;
|
|
9656
|
+
}
|
|
9657
|
+
async handle(data, client) {
|
|
9658
|
+
if (!("joined_at" in data) || data.unavailable || !this.params.botUserId) return;
|
|
9659
|
+
const joinAgeMs = Date.now() - Date.parse(data.joined_at);
|
|
9660
|
+
if (!Number.isFinite(joinAgeMs) || joinAgeMs < 0 || joinAgeMs > DISCORD_GUILD_JOIN_INTRO_MAX_AGE_MS) return;
|
|
9661
|
+
const textChannels = data.channels.filter((channel) => channel.type === ChannelType.GuildText);
|
|
9662
|
+
const systemChannel = textChannels.find((channel) => channel.id === data.system_channel_id);
|
|
9663
|
+
const candidateChannels = systemChannel ? [systemChannel, ...textChannels.filter((channel) => channel !== systemChannel)] : textChannels;
|
|
9664
|
+
const discordOptions = {
|
|
9665
|
+
cfg: this.params.cfg,
|
|
9666
|
+
accountId: this.params.accountId,
|
|
9667
|
+
rest: client.rest
|
|
9668
|
+
};
|
|
9669
|
+
const guildInfo = resolveDiscordGuildEntry({
|
|
9670
|
+
guild: new Guild(client, data),
|
|
9671
|
+
guildId: data.id,
|
|
9672
|
+
guildEntries: this.params.guildEntries
|
|
9673
|
+
});
|
|
9674
|
+
const guildConfigured = !this.params.guildEntries || Object.keys(this.params.guildEntries).length === 0 || Boolean(guildInfo);
|
|
9675
|
+
let targetChannel;
|
|
9676
|
+
let roomAllowed = false;
|
|
9677
|
+
for (const channel of candidateChannels) if (await canViewDiscordGuildChannel(data.id, channel.id, this.params.botUserId, discordOptions) && await hasAnyChannelPermissionDiscord(data.id, channel.id, this.params.botUserId, [PermissionFlagsBits.SendMessages], discordOptions)) {
|
|
9678
|
+
targetChannel ??= channel;
|
|
9679
|
+
const channelConfig = resolveDiscordChannelConfig({
|
|
9680
|
+
guildInfo,
|
|
9681
|
+
channelId: channel.id,
|
|
9682
|
+
channelName: channel.name,
|
|
9683
|
+
channelSlug: normalizeDiscordSlug(channel.name)
|
|
9684
|
+
});
|
|
9685
|
+
roomAllowed = guildConfigured && resolveDiscordPreflightChannelAccess({
|
|
9686
|
+
isGuildMessage: true,
|
|
9687
|
+
isGroupDm: false,
|
|
9688
|
+
groupPolicy: this.params.groupPolicy,
|
|
9689
|
+
messageChannelId: channel.id,
|
|
9690
|
+
displayChannelName: channel.name,
|
|
9691
|
+
displayChannelSlug: normalizeDiscordDisplaySlug(channel.name),
|
|
9692
|
+
guildInfo,
|
|
9693
|
+
channelConfig,
|
|
9694
|
+
channelMatchMeta: `guild=${data.id} channel=${channel.id}`
|
|
9695
|
+
}).allowed;
|
|
9696
|
+
if (roomAllowed) {
|
|
9697
|
+
targetChannel = channel;
|
|
9698
|
+
break;
|
|
9699
|
+
}
|
|
9700
|
+
}
|
|
9701
|
+
if (!targetChannel) {
|
|
9702
|
+
this.params.logger?.info("Discord guild join introduction skipped: no writable text channel", {
|
|
9703
|
+
guildId: data.id,
|
|
9704
|
+
accountId: this.params.accountId
|
|
9705
|
+
});
|
|
9706
|
+
return;
|
|
9707
|
+
}
|
|
9708
|
+
const selectedChannel = targetChannel;
|
|
9709
|
+
await reportChannelRoomJoin({
|
|
9710
|
+
cfg: this.params.cfg,
|
|
9711
|
+
channel: "discord",
|
|
9712
|
+
accountId: this.params.accountId,
|
|
9713
|
+
conversationId: data.id,
|
|
9714
|
+
deliverTo: `channel:${selectedChannel.id}`,
|
|
9715
|
+
route: resolveAgentRoute({
|
|
9716
|
+
cfg: this.params.cfg,
|
|
9717
|
+
channel: "discord",
|
|
9718
|
+
accountId: this.params.accountId,
|
|
9719
|
+
guildId: data.id,
|
|
9720
|
+
peer: {
|
|
9721
|
+
kind: "channel",
|
|
9722
|
+
id: selectedChannel.id
|
|
9723
|
+
}
|
|
9724
|
+
}),
|
|
9725
|
+
roomAllowed,
|
|
9726
|
+
resolveRoomContext: async ({ messageLimit }) => {
|
|
9727
|
+
const roomContext = {
|
|
9728
|
+
title: `#${selectedChannel.name}`,
|
|
9729
|
+
purpose: selectedChannel.topic ?? void 0
|
|
9730
|
+
};
|
|
9731
|
+
try {
|
|
9732
|
+
const messages = await readMessagesDiscord(selectedChannel.id, { limit: messageLimit }, discordOptions);
|
|
9733
|
+
return {
|
|
9734
|
+
...roomContext,
|
|
9735
|
+
recentMessages: messages.toReversed().flatMap(({ author, content }) => content.trim() ? [{
|
|
9736
|
+
sender: author.global_name ?? author.username,
|
|
9737
|
+
text: content
|
|
9738
|
+
}] : [])
|
|
9739
|
+
};
|
|
9740
|
+
} catch {
|
|
9741
|
+
return roomContext;
|
|
9742
|
+
}
|
|
9743
|
+
}
|
|
9744
|
+
});
|
|
9745
|
+
}
|
|
9746
|
+
};
|
|
9747
|
+
//#endregion
|
|
9608
9748
|
//#region extensions/discord/src/monitor/provider.startup.ts
|
|
9609
9749
|
function registerLatePlugin(client, plugin) {
|
|
9610
9750
|
plugin.registerClient?.(client);
|
|
@@ -9729,6 +9869,14 @@ async function fetchDiscordBotIdentity(params) {
|
|
|
9729
9869
|
function registerDiscordMonitorListeners(params) {
|
|
9730
9870
|
registerDiscordListener(params.client.listeners, new DiscordInteractionListener(params.logger, params.trackInboundEvent));
|
|
9731
9871
|
registerDiscordListener(params.client.listeners, new DiscordMessageListener(params.messageHandler, params.logger, params.trackInboundEvent));
|
|
9872
|
+
registerDiscordListener(params.client.listeners, new DiscordGuildJoinIntroductionListener({
|
|
9873
|
+
cfg: params.cfg,
|
|
9874
|
+
accountId: params.accountId,
|
|
9875
|
+
botUserId: params.botUserId,
|
|
9876
|
+
groupPolicy: params.groupPolicy,
|
|
9877
|
+
guildEntries: params.guildEntries,
|
|
9878
|
+
logger: params.logger
|
|
9879
|
+
}));
|
|
9732
9880
|
if (shouldRegisterDiscordReactionListeners(params)) {
|
|
9733
9881
|
const reactionListenerOptions = {
|
|
9734
9882
|
cfg: params.cfg,
|
|
@@ -10123,7 +10271,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10123
10271
|
runtime,
|
|
10124
10272
|
botUserId
|
|
10125
10273
|
});
|
|
10126
|
-
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-
|
|
10274
|
+
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-BLEMH_yi.js").then((n) => n.n);
|
|
10127
10275
|
setDiscordTranscriptsVoiceManager({
|
|
10128
10276
|
accountId: account.accountId,
|
|
10129
10277
|
manager: voiceManager
|
|
@@ -10229,4 +10377,4 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10229
10377
|
}
|
|
10230
10378
|
}
|
|
10231
10379
|
//#endregion
|
|
10232
|
-
export {
|
|
10380
|
+
export { resolveDiscordTextCommandAccess as S, handleDiscordDmCommandDecision as _, formatDiscordReplySkip as a, resolveFetchedDiscordThreadLikeChannelContext as b, buildGuildLabel as c, resolveDiscordGatewayIntents as d, waitForDiscordGatewayPluginRegistration as f, createDiscordSupplementalContextAccessChecker as g, buildDiscordInboundAccessContext as h, formatDiscordReplyDeliveryFailure as i, resolveReplyContext as l, buildDiscordGroupSystemPrompt as m, resolveDiscordPreflightChannelAccess as n, sanitizeDiscordFrontChannelReplyPayloads as o, createDiscordNativeCommand as p, deliverDiscordReply as r, buildDirectLabel as s, monitorDiscordProvider as t, createDiscordGatewayPlugin as u, mapGatewayDispatchData as v, resolveDiscordDmCommandAccess as x, registerDiscordListener as y };
|