@openclaw/discord 2026.10.10 → 2026.11.5-beta.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.
Files changed (217) hide show
  1. package/dist/.setup/{account-inspect-X_Xlr42B.mjs → account-inspect-CSz5Qodj.mjs} +1 -1
  2. package/dist/.setup/{accounts-C18HNgge.mjs → accounts-DtjvhJUj.mjs} +9 -6
  3. package/dist/.setup/{active-turn-thread-route-BAc_Xik-.mjs → active-turn-thread-route-DkPnk2x8.mjs} +1 -2
  4. package/dist/.setup/{allow-list-D1ZGfhXh.mjs → allow-list-DahA0Jxh.mjs} +3 -150
  5. package/dist/.setup/{api-Bth1wKF9.mjs → api-Bp0HI4q3.mjs} +10 -20
  6. package/dist/.setup/{approval-handler.runtime-BAoEELJJ.mjs → approval-handler.runtime-Cy53ugTf.mjs} +80 -61
  7. package/dist/.setup/{approval-message-updates-Cks-MSCJ.mjs → approval-message-updates-DqOXxPss.mjs} +2 -2
  8. package/dist/.setup/{audit-Dw_rAZIz.mjs → audit-DoPKOfQE.mjs} +4 -4
  9. package/dist/.setup/{channel-BMpMAeQL.mjs → channel-Ds6iuNdy.mjs} +134 -201
  10. package/dist/.setup/channel-access-DhJhVrdZ.mjs +23 -0
  11. package/dist/.setup/channel.setup-BLt9dkIG.mjs +235 -0
  12. package/dist/.setup/{components-BvOWSPxr.mjs → components-WTfUxead.mjs} +208 -426
  13. package/dist/.setup/components.base-C5sAPHe4.mjs +31 -0
  14. package/dist/.setup/{config-schema-Coyq5wOr.mjs → config-schema-GX2yDgIH.mjs} +6 -7
  15. package/dist/.setup/{conversation-binding-route-DOPUZNYo.mjs → conversation-binding-route-CZdm-X5A.mjs} +2 -2
  16. package/dist/.setup/{directory-config-CIqVnQtn.mjs → directory-config-BXJuh9-J.mjs} +1 -1
  17. package/dist/.setup/{directory-live-DUuPEWub.mjs → directory-live-CEopeb8Q.mjs} +55 -62
  18. package/dist/.setup/{discord-eFlHX1Gn.mjs → discord-r79VFjJp.mjs} +1087 -1664
  19. package/dist/.setup/{doctor-Dty_Ossy.mjs → doctor-UfLW8nye.mjs} +3 -5
  20. package/dist/.setup/endpoint-runtime-BM3x-m6O.mjs +138 -0
  21. package/dist/.setup/guilds-DQucP5Tn.mjs +21 -0
  22. package/dist/.setup/{handle-action-DXY91jF-.mjs → handle-action-BarHOi-v.mjs} +15 -15
  23. package/dist/.setup/{handle-action.guild-admin-BvBCfhXF.mjs → handle-action.guild-admin-oRUb8p_O.mjs} +5 -5
  24. package/dist/.setup/listeners-CHgTENFu.mjs +46 -0
  25. package/dist/.setup/{live-policy-config-DO1Fk2hp.mjs → live-policy-config-EKp4O6zx.mjs} +2 -3
  26. package/dist/.setup/{message-handler-fL1j1NiR.mjs → message-handler-DUeT8Asf.mjs} +154 -113
  27. package/dist/.setup/{message-handler.preflight-DkjwNZAd.mjs → message-handler.preflight-C6TNtKW0.mjs} +30 -104
  28. package/dist/.setup/{message-handler.preflight-pluralkit-DR4BnvMU.mjs → message-handler.preflight-pluralkit-6E9TFmmN.mjs} +9 -22
  29. package/dist/.setup/{message-handler.process-ClOwIPDK.mjs → message-handler.process-D8_oQ5Cp.mjs} +256 -367
  30. package/dist/.setup/outbound-payload-DUsrFICb.mjs +445 -0
  31. package/dist/.setup/{outbound-session-route-TFBPPkoz.mjs → outbound-session-route-Cb8cv4Oi.mjs} +138 -86
  32. package/dist/.setup/{preflight-audio-CwtPIsvk.mjs → preflight-audio-r4BbaJxh.mjs} +1 -5
  33. package/dist/.setup/{presence-cache-CgutE4NN.mjs → presence-cache-B3xj3b0l.mjs} +1 -6
  34. package/dist/.setup/{probe-DNge7OEP.mjs → probe-BUmJyH35.mjs} +5 -9
  35. package/dist/.setup/{provider-BBDuE14w.mjs → provider-Dm2ERSxe.mjs} +3600 -4454
  36. package/dist/.setup/{provider-session.runtime-D8hMXXqJ.mjs → provider-session.runtime-DCIqDsIg.mjs} +3 -3
  37. package/dist/.setup/provider.runtime-DmxPGoUg.mjs +1 -0
  38. package/dist/.setup/proxy-fetch-B8cK6FLQ.mjs +29 -0
  39. package/dist/.setup/{realtime-session.runtime-cetognkp.mjs → realtime-session.runtime-WJL6NdwK.mjs} +43 -81
  40. package/dist/.setup/{receive-recovery-C77CVdGM.mjs → receive-recovery-DV_v5ROf.mjs} +13 -27
  41. package/dist/.setup/{resolve-allowlist-common-CI77288n.mjs → resolve-allowlist-common-C37fgnYG.mjs} +3 -12
  42. package/dist/.setup/{resolve-channels-DYc6-xgV.mjs → resolve-channels-CwpnQ7C2.mjs} +5 -4
  43. package/dist/.setup/{resolve-users-BQT7XWF2.mjs → resolve-users-D6jSwe8R.mjs} +4 -7
  44. package/dist/.setup/{runtime-CcijhTJT.mjs → runtime-B-PgPsGR.mjs} +6 -6
  45. package/dist/.setup/{runtime-CI0UJqeS.mjs → runtime-DhOMlnYS.mjs} +196 -235
  46. package/dist/.setup/{secret-config-contract-BdbCvqnM.mjs → secret-config-contract-CP6teHec.mjs} +4 -9
  47. package/dist/.setup/{send-Cbq-IVsS.mjs → send-DnLL6XoO.mjs} +149 -174
  48. package/dist/.setup/{send.components-BV6ucNpJ.mjs → send.components-xB43CksK.mjs} +61 -71
  49. package/dist/.setup/{send.outbound-CGhBhzjQ.mjs → send.outbound-B11X6TOE.mjs} +75 -129
  50. package/dist/.setup/{send.receipt-Dw-_r5Bx.mjs → send.receipt-CMteCIZS.mjs} +29 -31
  51. package/dist/.setup/{send.shared-D4MioxW_.mjs → send.shared-BcLLZBul.mjs} +38 -112
  52. package/dist/.setup/{sender-identity-DrN5c4ec.mjs → sender-identity-CGNpdJmb.mjs} +3 -9
  53. package/dist/.setup/setup-plugin-api-C6AMx3hu.mjs +2 -0
  54. package/dist/.setup/{shared-Bp0sxD5R.mjs → shared-BEYw16he.mjs} +8 -10
  55. package/dist/.setup/shared-interactive-DKBw4SNV.mjs +311 -0
  56. package/dist/.setup/{subagent-hooks-mQbDkvuD.mjs → subagent-hooks-DlYElpXa.mjs} +1 -1
  57. package/dist/.setup/{system-events-2zc2eGfF.mjs → system-events--Pk6y9aP.mjs} +2 -2
  58. package/dist/.setup/{target-resolver-CAHeVfmZ.mjs → target-resolver-Bo9EpGp_.mjs} +3 -3
  59. package/dist/.setup/{thread-bindings-Dg7X_ZXP.mjs → thread-bindings-BF-hr-bg.mjs} +12 -20
  60. package/dist/.setup/{thread-bindings.manager-DCDYksah.mjs → thread-bindings.manager-CQCkha5r.mjs} +22 -42
  61. package/dist/.setup/{thread-bindings.session-updates-C76plLS3.mjs → thread-bindings.session-updates-C2gJAj_I.mjs} +11 -18
  62. package/dist/.setup/{threading-l0UfrE6x.mjs → threading-HA9C2wYR.mjs} +68 -104
  63. package/dist/.setup/{timeouts-DTrUsJ_W.mjs → timeouts-CT9hnmo4.mjs} +1 -1
  64. package/dist/.setup/{transcripts-source-CGgOaWcu.mjs → transcripts-source-DzpzETZR.mjs} +102 -172
  65. package/dist/.setup/{voice-runtime-DY1EwDfi.mjs → voice-runtime-Bo_nsVvX.mjs} +231 -448
  66. package/dist/.source-module-urls/d6c089460280c5a04184542d6712e04545caeb1ebb290d3504377b4cc5e22fea.json +1 -1
  67. package/dist/account-inspect-api.js +1 -1
  68. package/dist/action-runtime-api.js +1 -1
  69. package/dist/activities-api.js +285 -337
  70. package/dist/api.js +16 -16
  71. package/dist/assets/embedded-app-sdk.mjs +1 -1
  72. package/dist/channel-config-api.js +1 -1
  73. package/dist/channel-plugin-api.js +1 -1
  74. package/dist/directory-contract-api.js +1 -1
  75. package/dist/runtime-api.js +22 -22
  76. package/dist/secret-contract-api.js +1 -1
  77. package/dist/setup-entry.js +1 -1
  78. package/dist/setup-plugin-api.js +1 -1
  79. package/dist/src/voice/audio-worker.runtime.js +56 -68
  80. package/dist/subagent-hooks-api.js +1 -1
  81. package/dist/transcripts-source-api.js +1 -1
  82. package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.cjs +2 -3
  83. package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.mjs +2 -3
  84. package/node_modules/@napi-rs/wasm-runtime/dist/fs.js +3339 -4021
  85. package/node_modules/@napi-rs/wasm-runtime/package.json +1 -1
  86. package/node_modules/@types/lodash/README.md +1 -1
  87. package/node_modules/@types/lodash/common/function.d.ts +2 -2
  88. package/node_modules/@types/lodash/package.json +2 -2
  89. package/node_modules/@types/node/README.md +1 -1
  90. package/node_modules/@types/node/package.json +2 -2
  91. package/node_modules/@types/node/util.d.ts +6 -3
  92. package/node_modules/discord-api-types/package.json +4 -4
  93. package/node_modules/discord-api-types/rest/v10/index.d.ts +8 -0
  94. package/node_modules/discord-api-types/rest/v10/index.d.ts.map +1 -1
  95. package/node_modules/discord-api-types/rest/v10/index.js +8 -0
  96. package/node_modules/discord-api-types/rest/v10/index.js.map +1 -1
  97. package/node_modules/discord-api-types/rest/v10/oauth2.d.ts +26 -2
  98. package/node_modules/discord-api-types/rest/v10/oauth2.d.ts.map +1 -1
  99. package/node_modules/discord-api-types/rest/v9/index.d.ts +8 -0
  100. package/node_modules/discord-api-types/rest/v9/index.d.ts.map +1 -1
  101. package/node_modules/discord-api-types/rest/v9/index.js +8 -0
  102. package/node_modules/discord-api-types/rest/v9/index.js.map +1 -1
  103. package/node_modules/discord-api-types/rest/v9/oauth2.d.ts +26 -2
  104. package/node_modules/discord-api-types/rest/v9/oauth2.d.ts.map +1 -1
  105. package/node_modules/typebox/build/format/duration.d.mts +2 -2
  106. package/node_modules/typebox/build/format/duration.mjs +2 -2
  107. package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
  108. package/node_modules/typebox/build/format/idn_email.mjs +1 -0
  109. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
  110. package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
  111. package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
  112. package/node_modules/typebox/build/format/ipv4.mjs +2 -2
  113. package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
  114. package/node_modules/typebox/build/format/ipv6.mjs +1 -1
  115. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  116. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  117. package/node_modules/typebox/build/schema/build.mjs +1 -0
  118. package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
  119. package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
  120. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
  121. package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
  122. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
  123. package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
  124. package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
  125. package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
  126. package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
  127. package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
  128. package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
  129. package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
  130. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
  131. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
  132. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
  133. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
  134. package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
  135. package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
  136. package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
  137. package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
  138. package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
  139. package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
  140. package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
  141. package/node_modules/typebox/build/system/memory/create.mjs +18 -13
  142. package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
  143. package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
  144. package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
  145. package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
  146. package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
  147. package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
  148. package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
  149. package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
  150. package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
  151. package/node_modules/typebox/build/system/memory/update.mjs +43 -16
  152. package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
  153. package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
  154. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
  155. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
  156. package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
  157. package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
  158. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
  159. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
  160. package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
  161. package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
  162. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
  163. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
  164. package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
  165. package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
  166. package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
  167. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  168. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
  169. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
  170. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
  171. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
  172. package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
  173. package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
  174. package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
  175. package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
  176. package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
  177. package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
  178. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
  179. package/node_modules/typebox/package.json +1 -1
  180. package/node_modules/typebox/readme.md +1 -1
  181. package/node_modules/undici/docs/docs/api/Interceptors.md +15 -2
  182. package/node_modules/undici/lib/dispatcher/client-h2.js +78 -3
  183. package/node_modules/undici/lib/dispatcher/pool-base.js +20 -3
  184. package/node_modules/undici/package.json +3 -3
  185. package/node_modules/undici/types/api.d.ts +1 -1
  186. package/node_modules/undici/types/utility.d.ts +4 -4
  187. package/node_modules/uuid/package.json +17 -17
  188. package/node_modules/zod/package.json +1 -1
  189. package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
  190. package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
  191. package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
  192. package/node_modules/zod/src/v4/core/compile.ts +9 -0
  193. package/node_modules/zod/src/v4/core/schemas.ts +35 -1
  194. package/node_modules/zod/src/v4/core/util.ts +13 -0
  195. package/node_modules/zod/src/v4/core/versions.ts +1 -1
  196. package/node_modules/zod/v4/core/compile.cjs +8 -0
  197. package/node_modules/zod/v4/core/compile.js +8 -0
  198. package/node_modules/zod/v4/core/schemas.cjs +30 -0
  199. package/node_modules/zod/v4/core/schemas.d.cts +3 -1
  200. package/node_modules/zod/v4/core/schemas.d.ts +3 -1
  201. package/node_modules/zod/v4/core/schemas.js +30 -0
  202. package/node_modules/zod/v4/core/util.cjs +15 -0
  203. package/node_modules/zod/v4/core/util.d.cts +2 -0
  204. package/node_modules/zod/v4/core/util.d.ts +2 -0
  205. package/node_modules/zod/v4/core/util.js +14 -0
  206. package/node_modules/zod/v4/core/versions.cjs +1 -1
  207. package/node_modules/zod/v4/core/versions.js +1 -1
  208. package/openclaw.plugin.json +1 -31
  209. package/package.json +8 -8
  210. package/dist/.setup/channel-access-BPrWoEXM.mjs +0 -47
  211. package/dist/.setup/channel.setup-DVe7Y3Jf.mjs +0 -245
  212. package/dist/.setup/outbound-adapter-DWyAWBFh.mjs +0 -537
  213. package/dist/.setup/provider.runtime-BQ1z4Aq1.mjs +0 -1
  214. package/dist/.setup/setup-plugin-api-B4J6wmL1.mjs +0 -2
  215. package/dist/.setup/targets-BaklhOqq.mjs +0 -3
  216. package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
  217. package/node_modules/typebox/build/system/memory/freeze.mjs +0 -6
@@ -1,537 +0,0 @@
1
- import { t as createDiscordActionGate } from "./accounts-C18HNgge.mjs";
2
- import { d as normalizeDiscordMessagingTarget, f as normalizeDiscordOutboundTarget, g as hasDiscordMessageCreateAmbiguity, i as toDiscordOutboundDeliveryResult, n as createDiscordSendReceiptFromResults, p as canFallbackDiscordWebhookSend, s as resolveDiscordReplyReference, t as createDiscordSendReceipt, v as chunkDiscordTextWithMode } from "./send.receipt-Dw-_r5Bx.mjs";
3
- import { t as parseDiscordTarget } from "./target-parsing-BiuhcK9Q.mjs";
4
- import { C as discordInboundEventDelivery, a as resolveDiscordComponentSpec, c as formatDiscordApprovalDisplayValue, n as DISCORD_PRESENTATION_CAPABILITIES, o as sendDiscordComponentMessageLazy, r as buildDiscordPresentationPayload, w as notifyDiscordInboundEventOutboundPayloadSuccess, y as resolveDiscordCurrentConversationIdentity } from "./outbound-session-route-TFBPPkoz.mjs";
5
- import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
6
- import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
7
- import { asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
8
- import { getReplyPayloadTtsSupplement, resolvePayloadMediaUrls, sendPayloadMediaSequenceOrFallback, sendTextMediaPayload } from "openclaw/plugin-sdk/reply-payload";
9
- import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
10
- import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
11
- import { createReplyToFanout, resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-outbound";
12
- import { attachChannelToResult, createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
13
- import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
14
- // extensions/discord/src/channel.conversation.ts
15
- function resolveDiscordAttachedOutboundTarget(params) {
16
- if (params.threadId == null) return params.to;
17
- const threadId = normalizeOptionalStringifiedId(params.threadId) ?? "";
18
- return threadId ? `channel:${threadId}` : params.to;
19
- }
20
- function buildDiscordCrossContextPresentation(params) {
21
- return {
22
- tone: "neutral",
23
- blocks: [...params.message.trim() ? [{
24
- type: "text",
25
- text: params.message
26
- }, { type: "divider" }] : [], {
27
- type: "context",
28
- text: `From ${params.originLabel}`
29
- }]
30
- };
31
- }
32
- function normalizeDiscordAcpConversationId(conversationId) {
33
- const normalized = conversationId.trim();
34
- return normalized ? { conversationId: normalized } : null;
35
- }
36
- function matchDiscordAcpConversation(params) {
37
- if (params.bindingConversationId === params.conversationId) return {
38
- conversationId: params.conversationId,
39
- matchPriority: 2
40
- };
41
- if (params.parentConversationId && params.parentConversationId !== params.conversationId && params.bindingConversationId === params.parentConversationId) return {
42
- conversationId: params.parentConversationId,
43
- matchPriority: 1
44
- };
45
- return null;
46
- }
47
- function resolveDiscordConversationIdFromTargets(targets) {
48
- for (const raw of targets) {
49
- const trimmed = raw?.trim();
50
- if (!trimmed) continue;
51
- try {
52
- const target = parseDiscordTarget(trimmed, { defaultKind: "channel" });
53
- if (target?.normalized) return target.normalized;
54
- } catch {}
55
- }
56
- }
57
- function parseDiscordParentChannelFromSessionKey(raw) {
58
- const match = normalizeLowercaseStringOrEmpty(raw).match(/(?:^|:)channel:([^:]+)$/);
59
- return match?.[1] ? `channel:${match[1]}` : void 0;
60
- }
61
- function resolveDiscordCommandConversation(params) {
62
- const threadConversation = resolveDiscordThreadConversationRef(params);
63
- if (threadConversation) return threadConversation;
64
- const conversationId = resolveDiscordCurrentConversationIdentity({
65
- from: params.from,
66
- chatType: params.chatType,
67
- originatingTo: params.originatingTo,
68
- commandTo: params.commandTo,
69
- fallbackTo: params.fallbackTo
70
- });
71
- return conversationId ? { conversationId } : null;
72
- }
73
- function resolveDiscordThreadConversationRef(params) {
74
- const threadId = normalizeOptionalStringifiedId(params.threadId);
75
- if (!threadId) return null;
76
- const targets = [
77
- params.originatingTo ?? params.to,
78
- params.commandTo,
79
- params.fallbackTo ?? params.conversationId
80
- ];
81
- const parentConversationId = normalizeDiscordMessagingTarget(normalizeOptionalStringifiedId(params.threadParentId) ?? "") || parseDiscordParentChannelFromSessionKey(params.parentSessionKey) || resolveDiscordConversationIdFromTargets(targets);
82
- return {
83
- conversationId: threadId,
84
- ...parentConversationId && parentConversationId !== threadId ? { parentConversationId } : {}
85
- };
86
- }
87
- function resolveDiscordInboundConversation(params) {
88
- const threadConversation = resolveDiscordThreadConversationRef({
89
- to: params.to,
90
- conversationId: params.conversationId,
91
- threadId: params.threadId,
92
- threadParentId: params.threadParentId
93
- });
94
- if (threadConversation) return threadConversation;
95
- const conversationId = resolveDiscordCurrentConversationIdentity({
96
- from: params.from,
97
- chatType: params.isGroup ? "group" : "direct",
98
- originatingTo: params.to,
99
- fallbackTo: params.conversationId
100
- });
101
- return conversationId ? { conversationId } : null;
102
- }
103
- // extensions/discord/src/media-detection.ts
104
- const DISCORD_VIDEO_MEDIA_EXTENSIONS = [
105
- ".avi",
106
- ".m4v",
107
- ".mkv",
108
- ".mov",
109
- ".mp4",
110
- ".webm"
111
- ];
112
- function isLikelyDiscordVideoMedia(mediaUrl) {
113
- const trimmed = mediaUrl.trim();
114
- if (!trimmed) return false;
115
- let path;
116
- try {
117
- const { pathname } = new URL(trimmed);
118
- path = pathname.slice(pathname.lastIndexOf("/") + 1);
119
- try {
120
- path = decodeURIComponent(path);
121
- } catch {}
122
- } catch {
123
- path = trimmed.split(/[?#]/, 1)[0] ?? trimmed;
124
- }
125
- const normalized = normalizeLowercaseStringOrEmpty(path);
126
- return DISCORD_VIDEO_MEDIA_EXTENSIONS.some((ext) => normalized.endsWith(ext));
127
- }
128
- // extensions/discord/src/outbound-approval.ts
129
- function normalizeDiscordApprovalPayload(payload) {
130
- if (!asOptionalRecord(payload.channelData)?.execApproval || !payload.text) return payload;
131
- return {
132
- ...payload,
133
- text: payload.text.replace(/@everyone/gi, "@​everyone").replace(/@here/gi, "@​here").replace(/<@/g, "<@​").replace(/<#/g, "<#​")
134
- };
135
- }
136
- // extensions/discord/src/outbound-send-context.ts
137
- const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-Cbq-IVsS.mjs").then((n) => n.t));
138
- function resolveDiscordFormattingOptions(ctx) {
139
- const formatting = ctx.formatting;
140
- return {
141
- textLimit: formatting?.textLimit,
142
- maxLinesPerMessage: formatting?.maxLinesPerMessage,
143
- tableMode: formatting?.tableMode,
144
- chunkMode: formatting?.chunkMode
145
- };
146
- }
147
- async function createDiscordPayloadSendContext(ctx) {
148
- const runtime = await loadDiscordSendRuntime();
149
- const nextReplyToId = createReplyToFanout(ctx);
150
- return {
151
- target: resolveDiscordAttachedOutboundTarget({
152
- to: ctx.to,
153
- threadId: ctx.threadId
154
- }),
155
- formatting: resolveDiscordFormattingOptions(ctx),
156
- resolveReply: () => resolveDiscordReplyReference({
157
- replyToId: nextReplyToId(),
158
- replyToIdSource: ctx.replyToIdSource,
159
- replyToMode: ctx.replyToMode
160
- }),
161
- send: resolveOutboundSendDep(ctx.deps, "discord") ?? runtime.sendMessageDiscord,
162
- sendVoice: resolveOutboundSendDep(ctx.deps, "discordVoice") ?? runtime.sendVoiceMessageDiscord
163
- };
164
- }
165
- // extensions/discord/src/outbound-payload.ts
166
- const log$1 = createSubsystemLogger("discord/outbound");
167
- function createDiscordUnknownPayloadResult(target) {
168
- return {
169
- messageId: "",
170
- channelId: target,
171
- receipt: createDiscordSendReceipt({
172
- platformMessageIds: [],
173
- channelId: target,
174
- kind: "unknown"
175
- })
176
- };
177
- }
178
- async function sendDiscordOutboundPayload(params) {
179
- const ctx = params.ctx;
180
- const payload = normalizeDiscordApprovalPayload({
181
- ...ctx.payload,
182
- text: ctx.payload.text ?? ""
183
- });
184
- const mediaUrls = resolvePayloadMediaUrls(payload);
185
- const sendContext = await createDiscordPayloadSendContext(ctx);
186
- const deliveryOptions = (reply = sendContext.resolveReply()) => ({
187
- reply,
188
- accountId: ctx.accountId ?? void 0,
189
- silent: ctx.silent ?? void 0,
190
- cfg: ctx.cfg,
191
- onPlatformSendDispatch: ctx.onPlatformSendDispatch,
192
- assertPlatformSendAuthorized: ctx.assertDirectAdapterHandoff
193
- });
194
- const formattedDeliveryOptions = (reply = sendContext.resolveReply()) => ({
195
- ...deliveryOptions(reply),
196
- ...sendContext.formatting
197
- });
198
- const mediaDeliveryOptions = (mediaUrl) => ({
199
- mediaUrl,
200
- mediaAccess: ctx.mediaAccess,
201
- mediaLocalRoots: ctx.mediaLocalRoots,
202
- mediaReadFile: ctx.mediaReadFile,
203
- ...formattedDeliveryOptions()
204
- });
205
- const payloadContext = {
206
- ...ctx,
207
- payload
208
- };
209
- const deliveredResults = [];
210
- let createdThreadId;
211
- payloadContext.onDeliveryResult = async (result) => {
212
- await ctx.onDeliveryResult?.(result);
213
- const threadId = result.receipt?.threadId;
214
- if (threadId && payloadContext.threadId == null) {
215
- payloadContext.threadId = threadId;
216
- sendContext.target = `channel:${threadId}`;
217
- createdThreadId = threadId;
218
- }
219
- if (createdThreadId && result.target?.kind === "channel" && result.receipt) deliveredResults.push({
220
- messageId: result.messageId,
221
- channelId: result.target.id,
222
- receipt: result.receipt
223
- });
224
- };
225
- const completeResult = (result) => createdThreadId ? {
226
- ...result,
227
- receipt: createDiscordSendReceiptFromResults({
228
- results: deliveredResults,
229
- threadId: createdThreadId
230
- })
231
- } : result;
232
- const completeDelivery = (result) => attachChannelToResult("discord", toDiscordOutboundDeliveryResult(completeResult(result)));
233
- const onDeliveryResult = async (result) => await payloadContext.onDeliveryResult?.(attachChannelToResult("discord", toDiscordOutboundDeliveryResult(result)));
234
- if (payload.audioAsVoice && mediaUrls.length > 0) {
235
- const voiceReply = sendContext.resolveReply();
236
- let voiceFailure;
237
- let lastResult = createDiscordUnknownPayloadResult(sendContext.target);
238
- try {
239
- const voiceUrl = expectDefined(mediaUrls.at(0), "non-empty Discord voice media URLs");
240
- lastResult = await sendContext.sendVoice(sendContext.target, voiceUrl, {
241
- ...deliveryOptions(voiceReply),
242
- mediaAccess: ctx.mediaAccess,
243
- mediaLocalRoots: ctx.mediaLocalRoots,
244
- mediaReadFile: ctx.mediaReadFile
245
- });
246
- } catch (err) {
247
- if (hasDiscordMessageCreateAmbiguity(err)) throw err;
248
- const supplement = getReplyPayloadTtsSupplement(payload);
249
- const visibleFallbackText = payload.text?.trim() ? payload.text : void 0;
250
- const hiddenFallbackText = supplement?.visibleTextAlreadyDelivered ? void 0 : supplement?.spokenText;
251
- const fallbackText = visibleFallbackText ?? hiddenFallbackText;
252
- if (!fallbackText && !supplement?.visibleTextAlreadyDelivered) throw err;
253
- log$1.warn("discord voice send failed; continuing without voice", { error: err });
254
- if (fallbackText) await sendContext.send(sendContext.target, fallbackText, {
255
- verbose: false,
256
- ...formattedDeliveryOptions(voiceReply),
257
- onDeliveryResult
258
- });
259
- voiceFailure = { error: err };
260
- }
261
- if (!voiceFailure) {
262
- await onDeliveryResult(lastResult);
263
- if (payload.text?.trim()) lastResult = await sendContext.send(sendContext.target, payload.text, {
264
- verbose: false,
265
- ...formattedDeliveryOptions(),
266
- onDeliveryResult
267
- });
268
- }
269
- for (const mediaUrl of mediaUrls.slice(1)) try {
270
- lastResult = await sendContext.send(sendContext.target, "", {
271
- verbose: false,
272
- ...mediaDeliveryOptions(mediaUrl),
273
- onDeliveryResult
274
- });
275
- } catch (err) {
276
- if (!voiceFailure) throw err;
277
- log$1.warn("discord remaining media send failed after voice failure", { error: err });
278
- }
279
- if (voiceFailure) throw voiceFailure.error;
280
- return completeDelivery(lastResult);
281
- }
282
- const discordData = asOptionalRecord(payload.channelData?.discord) ?? {};
283
- const filename = normalizeOptionalString(discordData.filename);
284
- const componentSpec = await resolveDiscordComponentSpec(payload);
285
- const nativeComponents = !componentSpec && Array.isArray(discordData.components) ? discordData.components : void 0;
286
- const embeds = !componentSpec && Array.isArray(discordData.embeds) ? discordData.embeds : void 0;
287
- if (!componentSpec && !nativeComponents && !embeds?.length && !filename) return completeResult(await sendTextMediaPayload({
288
- channel: "discord",
289
- ctx: payloadContext,
290
- adapter: params.fallbackAdapter
291
- }));
292
- return completeDelivery(await sendPayloadMediaSequenceOrFallback({
293
- text: payload.text ?? "",
294
- mediaUrls,
295
- fallbackResult: createDiscordUnknownPayloadResult(sendContext.target),
296
- sendNoMedia: async () => componentSpec ? await sendDiscordComponentMessageLazy(sendContext.target, componentSpec, {
297
- ...formattedDeliveryOptions(),
298
- filename,
299
- onDeliveryResult
300
- }) : await sendContext.send(sendContext.target, payload.text ?? "", {
301
- verbose: false,
302
- components: nativeComponents,
303
- embeds,
304
- filename,
305
- ...formattedDeliveryOptions(),
306
- onDeliveryResult
307
- }),
308
- send: async ({ text, mediaUrl, isFirst }) => {
309
- if (componentSpec && isFirst) return await sendDiscordComponentMessageLazy(sendContext.target, componentSpec, {
310
- ...mediaDeliveryOptions(mediaUrl),
311
- filename,
312
- onDeliveryResult
313
- });
314
- return await sendContext.send(sendContext.target, text, {
315
- verbose: false,
316
- ...mediaDeliveryOptions(mediaUrl),
317
- ...!componentSpec ? {
318
- components: isFirst ? nativeComponents : void 0,
319
- embeds: isFirst ? embeds : void 0,
320
- filename: isFirst ? filename : void 0
321
- } : {},
322
- onDeliveryResult
323
- });
324
- }
325
- }));
326
- }
327
- // extensions/discord/src/outbound-adapter.ts
328
- const DISCORD_TEXT_CHUNK_LIMIT = 2e3;
329
- const DISCORD_PRECHUNK_MAX_LINES = Number.MAX_SAFE_INTEGER;
330
- const log = createSubsystemLogger("discord/outbound");
331
- const loadDiscordThreadBindings = createLazyRuntimeModule(() => import("./thread-bindings-Dg7X_ZXP.mjs").then((n) => n.i));
332
- const loadDiscordComponentSendRuntime = createLazyRuntimeModule(() => import("./send.components-BV6ucNpJ.mjs").then((n) => n.i));
333
- function resolveDiscordDeliveryOptions(params) {
334
- return {
335
- onPlatformSendDispatch: params.onPlatformSendDispatch,
336
- assertPlatformSendAuthorized: params.assertDirectAdapterHandoff,
337
- onDeliveryResult: params.onDeliveryResult ? async (result) => params.onDeliveryResult?.(attachChannelToResult("discord", toDiscordOutboundDeliveryResult(result))) : void 0
338
- };
339
- }
340
- async function maybeSendDiscordWebhookText(params) {
341
- const threadId = normalizeOptionalStringifiedId(params.threadId) ?? "";
342
- if (!threadId) return null;
343
- const { getThreadBindingManager } = await loadDiscordThreadBindings();
344
- const binding = getThreadBindingManager(params.accountId ?? void 0)?.getByThreadId(threadId);
345
- if (!binding?.webhookId || !binding?.webhookToken) return null;
346
- const username = normalizeOptionalString(params.identity?.name) || normalizeOptionalString(binding.label) || binding.agentId || "";
347
- const { sendWebhookMessageDiscord } = await loadDiscordSendRuntime();
348
- return await sendWebhookMessageDiscord(params.text, {
349
- webhookId: binding.webhookId,
350
- webhookToken: binding.webhookToken,
351
- accountId: binding.accountId,
352
- threadId: binding.threadId,
353
- cfg: params.cfg,
354
- replyTo: resolveDiscordReplyReference(params),
355
- username: truncateUtf16Safe(username, 80) || void 0,
356
- avatarUrl: normalizeOptionalString(params.identity?.avatarUrl),
357
- tableMode: params.formatting?.tableMode,
358
- chunking: {
359
- maxChars: params.formatting?.textLimit,
360
- maxLines: params.formatting?.maxLinesPerMessage
361
- },
362
- ...resolveDiscordDeliveryOptions(params)
363
- });
364
- }
365
- async function resolveDiscordOutboundMessageSend(params) {
366
- const send = resolveOutboundSendDep(params.deps, "discord") ?? (await loadDiscordSendRuntime()).sendMessageDiscord;
367
- const reply = resolveDiscordReplyReference(params);
368
- return {
369
- send,
370
- target: resolveDiscordAttachedOutboundTarget(params),
371
- options: {
372
- verbose: false,
373
- reply,
374
- accountId: params.accountId ?? void 0,
375
- silent: params.silent ?? void 0,
376
- cfg: params.cfg,
377
- ...resolveDiscordFormattingOptions(params),
378
- ...resolveDiscordDeliveryOptions(params)
379
- }
380
- };
381
- }
382
- const discordOutbound = {
383
- deliveryMode: "direct",
384
- chunker: (text, limit, ctx) => chunkDiscordTextWithMode(text, {
385
- maxChars: limit,
386
- maxLines: ctx?.formatting?.maxLinesPerMessage ?? DISCORD_PRECHUNK_MAX_LINES
387
- }),
388
- textChunkLimit: DISCORD_TEXT_CHUNK_LIMIT,
389
- pollMaxOptions: 10,
390
- normalizePayload: ({ payload }) => normalizeDiscordApprovalPayload(payload),
391
- presentationCapabilities: DISCORD_PRESENTATION_CAPABILITIES,
392
- deliveryCapabilities: { durableFinal: {
393
- text: true,
394
- media: true,
395
- poll: true,
396
- payload: true,
397
- silent: true,
398
- replyTo: true,
399
- thread: true,
400
- messageSendingHooks: true
401
- } },
402
- renderPresentation: buildDiscordPresentationPayload,
403
- resolveTarget: ({ to, allowFrom }) => normalizeDiscordOutboundTarget(to, allowFrom),
404
- sendPayload: async (ctx) => await sendDiscordOutboundPayload({
405
- ctx,
406
- fallbackAdapter: discordOutbound
407
- }),
408
- ...createAttachedChannelResultAdapter({
409
- channel: "discord",
410
- sendText: async (ctx) => {
411
- if (!ctx.silent) try {
412
- const webhookResult = await maybeSendDiscordWebhookText(ctx);
413
- if (webhookResult) return toDiscordOutboundDeliveryResult(webhookResult);
414
- } catch (error) {
415
- if (!canFallbackDiscordWebhookSend(error)) throw error;
416
- log.warn("discord webhook persona send failed; falling back to bot send", { error });
417
- }
418
- const { send, target, options } = await resolveDiscordOutboundMessageSend(ctx);
419
- return toDiscordOutboundDeliveryResult(await send(target, ctx.text, options));
420
- },
421
- sendMedia: async (ctx) => {
422
- const { send, target, options } = await resolveDiscordOutboundMessageSend(ctx);
423
- if (ctx.audioAsVoice && ctx.mediaUrl) {
424
- const sendVoice = resolveOutboundSendDep(ctx.deps, "discordVoice") ?? (await loadDiscordSendRuntime()).sendVoiceMessageDiscord;
425
- return toDiscordOutboundDeliveryResult(await sendVoice(target, ctx.mediaUrl, {
426
- cfg: ctx.cfg,
427
- reply: options.reply,
428
- accountId: ctx.accountId ?? void 0,
429
- silent: ctx.silent ?? void 0,
430
- mediaAccess: ctx.mediaAccess,
431
- mediaLocalRoots: ctx.mediaLocalRoots,
432
- mediaReadFile: ctx.mediaReadFile,
433
- onPlatformSendDispatch: ctx.onPlatformSendDispatch,
434
- assertPlatformSendAuthorized: ctx.assertDirectAdapterHandoff
435
- }));
436
- }
437
- const mediaOptions = {
438
- ...options,
439
- mediaUrl: ctx.mediaUrl,
440
- mediaAccess: ctx.mediaAccess,
441
- mediaLocalRoots: ctx.mediaLocalRoots,
442
- mediaReadFile: ctx.mediaReadFile
443
- };
444
- if (ctx.text.trim() && ctx.mediaUrl && isLikelyDiscordVideoMedia(ctx.mediaUrl)) {
445
- const captionResult = await send(target, ctx.text, options);
446
- const mediaResult = await send(captionResult.receipt?.threadId ? `channel:${captionResult.receipt.threadId}` : target, "", {
447
- ...mediaOptions,
448
- reply: options.reply?.scope === "all" ? options.reply : void 0
449
- });
450
- const threadId = captionResult.receipt?.threadId;
451
- return toDiscordOutboundDeliveryResult({
452
- ...threadId ? captionResult : mediaResult,
453
- receipt: createDiscordSendReceiptFromResults({
454
- results: [captionResult, mediaResult],
455
- threadId
456
- })
457
- });
458
- }
459
- return toDiscordOutboundDeliveryResult(await send(target, ctx.text, mediaOptions));
460
- },
461
- sendPoll: async ({ cfg, to, poll, content, accountId, threadId, silent, sessionKey, inboundEventKind, onPlatformSendDispatch, assertDirectAdapterHandoff }) => {
462
- if (!createDiscordActionGate({
463
- cfg,
464
- accountId
465
- })("polls")) throw new Error("Discord polls are disabled.");
466
- const outboundTo = resolveDiscordAttachedOutboundTarget({
467
- to,
468
- threadId
469
- });
470
- const result = await (await loadDiscordSendRuntime()).sendPollDiscord(outboundTo, poll, {
471
- accountId: accountId ?? void 0,
472
- content,
473
- threadId: threadId ?? void 0,
474
- silent: silent ?? void 0,
475
- cfg,
476
- onPlatformSendDispatch,
477
- assertPlatformSendAuthorized: assertDirectAdapterHandoff
478
- });
479
- discordInboundEventDelivery.notify({
480
- sessionKey,
481
- inboundEventKind,
482
- to: outboundTo,
483
- accountId
484
- });
485
- return result;
486
- }
487
- }),
488
- adoptTargetFromDelivery: ({ result }) => {
489
- const threadId = normalizeOptionalStringifiedId(result.receipt?.threadId);
490
- return threadId ? { threadId } : null;
491
- },
492
- afterDeliverPayload: async ({ cfg, target, payload, results }) => {
493
- notifyDiscordInboundEventOutboundPayloadSuccess({
494
- payload,
495
- to: resolveDiscordAttachedOutboundTarget({
496
- to: target.to,
497
- threadId: target.threadId
498
- }),
499
- accountId: target.accountId
500
- });
501
- const questionId = questionGatewayRuntime.readAskUserQuestionId(payload);
502
- const result = results.find((candidate) => candidate.channel === "discord" && candidate.messageId);
503
- const componentSpec = questionId ? await resolveDiscordComponentSpec(payload) : void 0;
504
- if (questionId && result && componentSpec) {
505
- const to = resolveDiscordAttachedOutboundTarget({
506
- to: target.to,
507
- threadId: target.threadId
508
- });
509
- const channelId = result.target?.kind === "channel" ? result.target.id : to;
510
- questionGatewayRuntime.registerChannelDelivery({
511
- questionId,
512
- deliveryId: `discord:${target.accountId ?? "default"}:${channelId}:${result.messageId}`,
513
- finalize: async (statusLine) => {
514
- const { editDiscordComponentMessage } = await loadDiscordComponentSendRuntime();
515
- await editDiscordComponentMessage(to, result.messageId, {
516
- ...componentSpec,
517
- blocks: [...(componentSpec.blocks ?? []).filter((block) => block.type !== "actions"), {
518
- type: "text",
519
- text: `-# ${formatDiscordApprovalDisplayValue(statusLine)}`
520
- }],
521
- modal: void 0
522
- }, {
523
- cfg,
524
- accountId: target.accountId ?? void 0
525
- });
526
- }
527
- });
528
- }
529
- const threadId = normalizeOptionalStringifiedId(target.threadId);
530
- if (!threadId) return;
531
- const { getThreadBindingManager } = await loadDiscordThreadBindings();
532
- const manager = getThreadBindingManager(target.accountId ?? void 0);
533
- if (!manager?.getByThreadId(threadId)) return;
534
- await manager.touchThread({ threadId });
535
- }
536
- };
537
- export { normalizeDiscordAcpConversationId as a, resolveDiscordInboundConversation as c, matchDiscordAcpConversation as i, discordOutbound as n, resolveDiscordAttachedOutboundTarget as o, buildDiscordCrossContextPresentation as r, resolveDiscordCommandConversation as s, DISCORD_TEXT_CHUNK_LIMIT as t };
@@ -1 +0,0 @@
1
- export { t as monitorDiscordProvider } from "./provider-BBDuE14w.mjs";
@@ -1,2 +0,0 @@
1
- export { t as discordSetupPlugin } from "./channel.setup-DVe7Y3Jf.mjs";
2
- import "../setup-plugin-api.js";
@@ -1,3 +0,0 @@
1
- import "./target-parsing-BiuhcK9Q.mjs";
2
- import "./target-resolver-CAHeVfmZ.mjs";
3
- export {};
@@ -1,4 +0,0 @@
1
- type ObjectLike = Record<PropertyKey, any>;
2
- /** Conditionally freezes the value if `immutableTypes` is true, otherwise no action. */
3
- export declare function Freeze(value: ObjectLike): ObjectLike;
4
- export {};
@@ -1,6 +0,0 @@
1
- // deno-lint-ignore-file no-explicit-any
2
- import { Settings } from '../settings/index.mjs';
3
- /** Conditionally freezes the value if `immutableTypes` is true, otherwise no action. */
4
- export function Freeze(value) {
5
- return Settings.Get().immutableTypes ? Object.freeze(value) : value;
6
- }