@openclaw/discord 2026.8.1-beta.2 → 2026.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. package/dist/{account-inspect-CqzrH14k.js → account-inspect-BDfKyuvL.js} +1 -1
  2. package/dist/account-inspect-api.js +1 -1
  3. package/dist/{accounts-DJTf1LtA.js → accounts-CfQ-vSyf.js} +34 -1
  4. package/dist/action-runtime-api.js +1 -1
  5. package/dist/{activities-api-DS7vpdtp.js → activities-api-Dl-TOyOX.js} +134 -175
  6. package/dist/activities-api.js +1 -1
  7. package/dist/api.js +17 -17
  8. package/dist/{approval-handler.runtime-B6yEV79q.js → approval-handler.runtime-q4Zqo44V.js} +29 -106
  9. package/dist/{audit-Db-rlntl.js → audit-DgrvFPGt.js} +5 -5
  10. package/dist/{channel-CnnbJSt5.js → channel-BsQUalPw.js} +72 -50
  11. package/dist/{channel-actions.runtime-CLKrx6tr.js → channel-actions.runtime-UMGGIfSy.js} +31 -45
  12. package/dist/channel-config-api.js +1 -1
  13. package/dist/channel-plugin-api.js +1 -1
  14. package/dist/channel-type-CVLZyGYS.js +7 -0
  15. package/dist/{channel.setup-BFAO-V1P.js → channel.setup-rPs4dsk_.js} +5 -5
  16. package/dist/{outbound-session-route-DxLkrgKQ.js → components-Dk35LTf_.js} +34 -76
  17. package/dist/{config-schema-BgEskFAs.js → config-schema-CxPqtVI1.js} +46 -14
  18. package/dist/conversation-binding-route-BjvX4e35.js +43 -0
  19. package/dist/{directory-config-BVX7Cflc.js → directory-config-B7DY_pNG.js} +2 -2
  20. package/dist/directory-contract-api.js +1 -1
  21. package/dist/{directory-live-DGIGxpIo.js → directory-live-DuAXKkan.js} +3 -3
  22. package/dist/doctor-contract-api.js +2 -2
  23. package/dist/{doctor-BzC-TLnB.js → doctor-zQTtn6hm.js} +33 -12
  24. package/dist/{handle-action.guild-admin-BNVTUISF.js → handle-action.guild-admin-DZewwLr1.js} +9 -5
  25. package/dist/index.js +3 -4
  26. package/dist/ingress-identity-CzZKcPK8.js +60 -0
  27. package/dist/{message-handler-Unk_f10F.js → message-handler-C5By3yl5.js} +82 -6
  28. package/dist/{message-handler.preflight-C9zecxR9.js → message-handler.preflight-DrszWuHw.js} +44 -118
  29. package/dist/{message-handler.process-DWQ6UHHu.js → message-handler.process-DyFPDLCt.js} +205 -235
  30. package/dist/{message-utils-BSCPVgy0.js → message-text-Ca8M6TU8.js} +43 -42
  31. package/dist/{outbound-adapter-D9nRivT1.js → outbound-adapter-Dif8p481.js} +118 -91
  32. package/dist/{outbound-components-cTzwBJ60.js → outbound-components-wjv7yyAj.js} +5 -4
  33. package/dist/outbound-session-route-Bn4uXaoE.js +665 -0
  34. package/dist/owner-access-UlYi9t0M.js +107 -0
  35. package/dist/{pluralkit-DdiJ9KMK.js → pluralkit-9EuEN4UD.js} +1 -1
  36. package/dist/{probe-Bl-k5_Ku.js → probe-n6ZXxK8V.js} +1 -1
  37. package/dist/{probe.runtime-M9fREKvp.js → probe.runtime-CN4bdPfZ.js} +1 -1
  38. package/dist/{provider-DvSNb-2v.js → provider-LXiOcJrH.js} +887 -1350
  39. package/dist/{provider-session.runtime-BUEqD0rA.js → provider-session.runtime-DSNe7r2W.js} +3 -3
  40. package/dist/provider.runtime-DiInaDXO.js +2 -0
  41. package/dist/{realtime-session.runtime-C7wen-aF.js → realtime-session.runtime-DOViOIjY.js} +129 -134
  42. package/dist/{resolve-allowlist-common-D04lpEzb.js → resolve-allowlist-common-BLoYaxEG.js} +2 -2
  43. package/dist/{resolve-channels-Dm7jEeg6.js → resolve-channels-D2yl_2CN.js} +5 -4
  44. package/dist/{resolve-users-bktrCUUU.js → resolve-users-BLxfqajZ.js} +2 -2
  45. package/dist/{retry-CLpJcXXf.js → retry-DqHCW6PV.js} +187 -19
  46. package/dist/{runtime-DGsSyDTS.js → runtime-BYamRVPN.js} +89 -86
  47. package/dist/{runtime-DoHjckYm.js → runtime-DrxVBTtp.js} +9 -10
  48. package/dist/runtime-api.js +19 -25
  49. package/dist/{sdk-runtime-QpY8PvCh.js → sdk-runtime-6tfgYDjY.js} +57 -89
  50. package/dist/{secret-config-contract-B1akrlyY.js → secret-config-contract-B3i6WxV5.js} +53 -25
  51. package/dist/secret-contract-api.js +1 -1
  52. package/dist/{security-audit-jGnJF__m.js → security-audit-DKfK-iPY.js} +11 -12
  53. package/dist/security-audit-contract-api.js +1 -1
  54. package/dist/{security-audit.runtime-CPN0xFYz.js → security-audit.runtime-sKZyKgpx.js} +1 -1
  55. package/dist/{send-B7Q6Oc1I.js → send-UJHiAm4C.js} +82 -19
  56. package/dist/{send.components-iJyFXw9L.js → send.components-CrBJpGT_.js} +22 -39
  57. package/dist/{send.outbound-DS5tHwfR.js → send.outbound-D7JYmfm9.js} +77 -78
  58. package/dist/{send.shared-BmwFjW6T.js → send.shared-DZJ1akvQ.js} +136 -121
  59. package/dist/{sender-identity-QtalnCYv.js → sender-identity-BJtfyise.js} +1 -1
  60. package/dist/setup-plugin-api.js +1 -1
  61. package/dist/{shared-BIXIX6uJ.js → shared-Dii2HTn7.js} +41 -14
  62. package/dist/subagent-hooks-JyGrtQIl.js +49 -0
  63. package/dist/subagent-hooks-api.js +1 -6
  64. package/dist/{system-events-CTqDf6_s.js → system-events-BEmcj4xJ.js} +2 -2
  65. package/dist/{target-resolver-maOKSqO0.js → target-resolver-V-IYae6s.js} +3 -3
  66. package/dist/targets-CQp53cGj.js +3 -0
  67. package/dist/{thread-bindings-3L8p82GV.js → thread-bindings-DvYP79fy.js} +28 -26
  68. package/dist/{thread-bindings.manager-DCIH6WDC.js → thread-bindings.manager-Clm77DBM.js} +11 -14
  69. package/dist/{thread-bindings.session-updates-bJ2KQFY6.js → thread-bindings.session-updates-CJb-BpPL.js} +1 -1
  70. package/dist/{thread-bindings.state-aeV8HNgV.js → thread-bindings.state-D8OMdk4O.js} +1 -1
  71. package/dist/threading-CXuu_7o9.js +478 -0
  72. package/dist/transcripts-source-BLEMH_yi.js +270 -0
  73. package/dist/transcripts-source-api.js +7 -2
  74. package/dist/{typing-CS-nNVoe.js → typing-B9snnwMe.js} +1 -1
  75. package/dist/{voice-runtime-BEdqNcST.js → voice-runtime-DY6_o73o.js} +250 -150
  76. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/README.md +19 -19
  77. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v1.js +7 -3
  78. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v7.js +5 -2
  79. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v1.js +7 -3
  80. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v7.js +5 -2
  81. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/package.json +4 -3
  82. package/node_modules/@discordjs/voice/node_modules/@types/node/README.md +1 -1
  83. package/node_modules/@discordjs/voice/node_modules/@types/node/child_process.d.ts +0 -1
  84. package/node_modules/@discordjs/voice/node_modules/@types/node/crypto.d.ts +6 -6
  85. package/node_modules/@discordjs/voice/node_modules/@types/node/dns/promises.d.ts +5 -5
  86. package/node_modules/@discordjs/voice/node_modules/@types/node/dns.d.ts +5 -5
  87. package/node_modules/@discordjs/voice/node_modules/@types/node/fs.d.ts +7 -0
  88. package/node_modules/@discordjs/voice/node_modules/@types/node/http.d.ts +30 -0
  89. package/node_modules/@discordjs/voice/node_modules/@types/node/http2.d.ts +4 -4
  90. package/node_modules/@discordjs/voice/node_modules/@types/node/os.d.ts +30 -30
  91. package/node_modules/@discordjs/voice/node_modules/@types/node/package.json +2 -2
  92. package/node_modules/@discordjs/voice/node_modules/@types/node/perf_hooks.d.ts +2 -1
  93. package/node_modules/@discordjs/voice/node_modules/@types/node/process.d.ts +42 -43
  94. package/node_modules/@discordjs/voice/node_modules/@types/node/quic.d.ts +1049 -84
  95. package/node_modules/@discordjs/voice/node_modules/@types/node/sqlite.d.ts +14 -1
  96. package/node_modules/@discordjs/voice/node_modules/@types/node/stream/iter.d.ts +3 -2
  97. package/node_modules/@discordjs/voice/node_modules/@types/node/test.d.ts +61 -0
  98. package/node_modules/@discordjs/voice/node_modules/@types/node/v8.d.ts +20 -23
  99. package/node_modules/discord-api-types/CHANGELOG.md +8 -0
  100. package/node_modules/discord-api-types/package.json +4 -4
  101. package/node_modules/discord-api-types/payloads/v10/channel.d.ts +2 -2
  102. package/node_modules/discord-api-types/payloads/v10/channel.d.ts.map +1 -1
  103. package/node_modules/discord-api-types/payloads/v10/gateway.d.ts +4 -0
  104. package/node_modules/discord-api-types/payloads/v10/gateway.d.ts.map +1 -1
  105. package/node_modules/discord-api-types/payloads/v10/gateway.js.map +1 -1
  106. package/node_modules/discord-api-types/payloads/v10/message.d.ts +4 -1
  107. package/node_modules/discord-api-types/payloads/v10/message.d.ts.map +1 -1
  108. package/node_modules/discord-api-types/payloads/v10/message.js +1 -0
  109. package/node_modules/discord-api-types/payloads/v10/message.js.map +1 -1
  110. package/node_modules/discord-api-types/payloads/v9/channel.d.ts +2 -2
  111. package/node_modules/discord-api-types/payloads/v9/channel.d.ts.map +1 -1
  112. package/node_modules/discord-api-types/payloads/v9/gateway.d.ts +4 -0
  113. package/node_modules/discord-api-types/payloads/v9/gateway.d.ts.map +1 -1
  114. package/node_modules/discord-api-types/payloads/v9/gateway.js.map +1 -1
  115. package/node_modules/discord-api-types/payloads/v9/message.d.ts +4 -1
  116. package/node_modules/discord-api-types/payloads/v9/message.d.ts.map +1 -1
  117. package/node_modules/discord-api-types/payloads/v9/message.js +1 -0
  118. package/node_modules/discord-api-types/payloads/v9/message.js.map +1 -1
  119. package/node_modules/typebox/build/format/date.d.mts +1 -1
  120. package/node_modules/typebox/build/format/date.mjs +1 -1
  121. package/node_modules/typebox/build/format/date_time.d.mts +2 -2
  122. package/node_modules/typebox/build/format/date_time.mjs +3 -3
  123. package/node_modules/typebox/build/format/email.d.mts +1 -1
  124. package/node_modules/typebox/build/format/email.mjs +2 -2
  125. package/node_modules/typebox/build/format/hostname.mjs +2 -10
  126. package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
  127. package/node_modules/typebox/build/format/idn_email.mjs +3 -3
  128. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
  129. package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
  130. package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
  131. package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
  132. package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
  133. package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
  134. package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
  135. package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
  136. package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
  137. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
  138. package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
  139. package/node_modules/typebox/build/format/idna/index.mjs +2 -0
  140. package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
  141. package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
  142. package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
  143. package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
  144. package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
  145. package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
  146. package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
  147. package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
  148. package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
  149. package/node_modules/typebox/build/format/ipv4.mjs +2 -32
  150. package/node_modules/typebox/build/format/ipv6.mjs +2 -61
  151. package/node_modules/typebox/build/format/iri.d.mts +2 -2
  152. package/node_modules/typebox/build/format/iri.mjs +26 -8
  153. package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
  154. package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
  155. package/node_modules/typebox/build/format/regex.d.mts +1 -2
  156. package/node_modules/typebox/build/format/regex.mjs +2 -6
  157. package/node_modules/typebox/build/format/time.d.mts +2 -2
  158. package/node_modules/typebox/build/format/time.mjs +19 -14
  159. package/node_modules/typebox/build/format/uri.d.mts +1 -1
  160. package/node_modules/typebox/build/format/uri.mjs +3 -130
  161. package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
  162. package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
  163. package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
  164. package/node_modules/typebox/build/format/uri_template.mjs +4 -5
  165. package/node_modules/typebox/build/format/url.d.mts +3 -3
  166. package/node_modules/typebox/build/format/url.mjs +4 -5
  167. package/node_modules/typebox/build/guard/emit.d.mts +3 -1
  168. package/node_modules/typebox/build/guard/emit.mjs +12 -5
  169. package/node_modules/typebox/build/guard/guard.d.mts +8 -2
  170. package/node_modules/typebox/build/guard/guard.mjs +25 -4
  171. package/node_modules/typebox/build/guard/string.d.mts +2 -2
  172. package/node_modules/typebox/build/guard/string.mjs +7 -7
  173. package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
  174. package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
  175. package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
  176. package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
  177. package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
  178. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
  179. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
  180. package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
  181. package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
  182. package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
  183. package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
  184. package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
  185. package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
  186. package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
  187. package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
  188. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
  189. package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
  190. package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
  191. package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
  192. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
  193. package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
  194. package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
  195. package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
  196. package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
  197. package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
  198. package/node_modules/typebox/build/schema/types/index.mjs +0 -2
  199. package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
  200. package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
  201. package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
  202. package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
  203. package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
  204. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
  205. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
  206. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
  207. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
  208. package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
  209. package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
  210. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
  211. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
  212. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
  213. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
  214. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
  215. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
  216. package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
  217. package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
  218. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
  219. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
  220. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
  221. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
  222. package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
  223. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
  224. package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
  225. package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
  226. package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
  227. package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
  228. package/node_modules/typebox/build/type/script/parser.mjs +27 -23
  229. package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
  230. package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
  231. package/node_modules/typebox/package.json +27 -27
  232. package/node_modules/typebox/readme.md +79 -82
  233. package/node_modules/undici/docs/docs/api/Client.md +21 -8
  234. package/node_modules/undici/lib/api/readable.js +33 -43
  235. package/node_modules/undici/lib/core/connect.js +16 -2
  236. package/node_modules/undici/lib/core/symbols.js +1 -0
  237. package/node_modules/undici/lib/dispatcher/client-h1.js +3 -3
  238. package/node_modules/undici/lib/dispatcher/client-h2.js +179 -10
  239. package/node_modules/undici/lib/dispatcher/client.js +74 -29
  240. package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +28 -6
  241. package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +15 -1
  242. package/node_modules/undici/lib/handler/retry-handler.js +7 -2
  243. package/node_modules/undici/lib/interceptor/cache.js +5 -2
  244. package/node_modules/undici/lib/interceptor/deduplicate.js +1 -1
  245. package/node_modules/undici/lib/mock/mock-utils.js +213 -24
  246. package/node_modules/undici/lib/util/cache.js +2 -4
  247. package/node_modules/undici/lib/web/websocket/websocket.js +22 -0
  248. package/node_modules/undici/package.json +1 -1
  249. package/node_modules/undici/types/client.d.ts +40 -0
  250. package/node_modules/ws/lib/permessage-deflate.js +3 -1
  251. package/node_modules/ws/package.json +1 -1
  252. package/openclaw.plugin.json +24 -10
  253. package/package.json +8 -10
  254. package/skills/discord/SKILL.md +1 -1
  255. package/dist/approval-message-safety-AcIxvrf3.js +0 -140
  256. package/dist/audit-core-xwjIczO0.js +0 -105
  257. package/dist/channel-actions-5s_hjYKd.js +0 -208
  258. package/dist/channel-api-CAJ0wMoV.js +0 -21
  259. package/dist/inbound-event-delivery-De2qxTrP.js +0 -39
  260. package/dist/provider.runtime-C9PnJZbZ.js +0 -2
  261. package/dist/runtime-api.actions.js +0 -3
  262. package/dist/runtime-api.lookup.js +0 -7
  263. package/dist/runtime-api.monitor-CHxrFPnW.js +0 -5
  264. package/dist/runtime-api.monitor.js +0 -8
  265. package/dist/runtime-api.send.js +0 -7
  266. package/dist/runtime-api.threads.js +0 -5
  267. package/dist/send.reactions-BAn0iiVQ.js +0 -78
  268. package/dist/send.receipt-IPI1p-SP.js +0 -66
  269. package/dist/subagent-hooks-CTt5KCJr.js +0 -120
  270. package/dist/subagent-progress-DhaE_h8a.js +0 -109
  271. package/dist/targets-yUFTHoAx.js +0 -3
  272. package/dist/transcripts-source-CfFMexGt.js +0 -123
  273. package/node_modules/p-map/index.d.ts +0 -155
  274. package/node_modules/p-map/index.js +0 -285
  275. package/node_modules/p-map/license +0 -9
  276. package/node_modules/p-map/package.json +0 -57
  277. package/node_modules/p-map/readme.md +0 -190
  278. package/node_modules/typebox/build/format/_idna.d.mts +0 -2
  279. package/node_modules/typebox/build/format/_idna.mjs +0 -246
  280. package/node_modules/typebox/build/format/_puny.d.mts +0 -1
  281. package/node_modules/typebox/build/format/_puny.mjs +0 -77
  282. package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
  283. package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
  284. package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
  285. package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
  286. package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
  287. package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
  288. package/dist/{allow-list-DnxIlPP2.js → allow-list-BDMimASD.js} +1 -1
  289. package/dist/{doctor-contract-DLa-BTiU.js → doctor-contract-DsWvKIXF.js} +1 -1
@@ -0,0 +1,665 @@
1
+ import { _ as parseDiscordTarget, h as normalizeDiscordMessagingTarget } from "./retry-DqHCW6PV.js";
2
+ import { h as readDiscordComponentSpec, m as coerceDiscordComponentParam } from "./components-Dk35LTf_.js";
3
+ import { c as resolveDiscordAccount, r as listDiscordAccountIds, t as createDiscordActionGate } from "./accounts-CfQ-vSyf.js";
4
+ import { t as inspectDiscordAccount } from "./account-inspect-BDfKyuvL.js";
5
+ import { ChannelType } from "discord-api-types/v10";
6
+ import { Type } from "typebox";
7
+ import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
8
+ import { buildOutboundBaseSessionKey, deriveLastRoutePolicy, isAcpSessionKey, isSubagentSessionKey, parseAgentSessionKey, resolveAgentIdFromSessionKey, resolveAgentRoute } from "openclaw/plugin-sdk/routing";
9
+ import { asOptionalRecord, isRecord, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
10
+ import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
11
+ import { createUnionActionGate } from "openclaw/plugin-sdk/channel-actions";
12
+ import { buildThreadAwareOutboundSessionRoute } from "openclaw/plugin-sdk/channel-core";
13
+ import { createChannelApproverDmTargetResolver, createChannelNativeOriginTargetResolver } from "openclaw/plugin-sdk/approval-native-runtime";
14
+ import { getExecApprovalReplyMetadata, isChannelExecApprovalClientEnabledFromConfig, matchesApprovalRequestFilters } from "openclaw/plugin-sdk/approval-client-runtime";
15
+ import { resolveApprovalApprovers } from "openclaw/plugin-sdk/approval-auth-runtime";
16
+ import { createApproverRestrictedNativeApprovalCapability } from "openclaw/plugin-sdk/approval-delivery-runtime";
17
+ import { extractToolSend } from "openclaw/plugin-sdk/tool-send";
18
+ import { createInboundEventDeliveryCorrelation } from "openclaw/plugin-sdk/inbound-event-delivery";
19
+ //#region extensions/discord/src/exec-approvals.ts
20
+ function normalizeDiscordApproverId(value) {
21
+ const trimmed = value.trim();
22
+ if (!trimmed) return;
23
+ if (/^\d+$/.test(trimmed)) return trimmed;
24
+ try {
25
+ const target = parseDiscordTarget(trimmed);
26
+ return target?.kind === "user" ? target.id : void 0;
27
+ } catch {
28
+ return;
29
+ }
30
+ }
31
+ function resolveDiscordOwnerApprovers(cfg) {
32
+ const ownerAllowFrom = cfg.commands?.ownerAllowFrom;
33
+ if (!Array.isArray(ownerAllowFrom) || ownerAllowFrom.length === 0) return [];
34
+ return resolveApprovalApprovers({
35
+ explicit: ownerAllowFrom,
36
+ normalizeApprover: (value) => normalizeDiscordApproverId(String(value))
37
+ });
38
+ }
39
+ function getDiscordExecApprovalApprovers(params) {
40
+ return resolveApprovalApprovers({
41
+ explicit: params.configOverride?.approvers ?? resolveDiscordAccount(params).config.execApprovals?.approvers ?? resolveDiscordOwnerApprovers(params.cfg),
42
+ normalizeApprover: (value) => normalizeDiscordApproverId(String(value))
43
+ });
44
+ }
45
+ function isDiscordExecApprovalClientEnabled(params) {
46
+ return isChannelExecApprovalClientEnabledFromConfig({
47
+ enabled: (params.configOverride ?? resolveDiscordAccount(params).config.execApprovals)?.enabled,
48
+ approverCount: getDiscordExecApprovalApprovers({
49
+ cfg: params.cfg,
50
+ accountId: params.accountId,
51
+ configOverride: params.configOverride
52
+ }).length
53
+ });
54
+ }
55
+ function isDiscordExecApprovalApprover(params) {
56
+ const senderId = params.senderId?.trim();
57
+ if (!senderId) return false;
58
+ return getDiscordExecApprovalApprovers({
59
+ cfg: params.cfg,
60
+ accountId: params.accountId,
61
+ configOverride: params.configOverride
62
+ }).includes(senderId);
63
+ }
64
+ function shouldSuppressLocalDiscordExecApprovalPrompt(params) {
65
+ const metadata = getExecApprovalReplyMetadata(params.payload);
66
+ const config = resolveDiscordAccount(params).config.execApprovals;
67
+ return params.hint?.kind === "approval-pending" && params.hint.nativeRouteActive === true && isDiscordExecApprovalClientEnabled(params) && metadata !== null && matchesApprovalRequestFilters({
68
+ request: {
69
+ agentId: metadata.agentId,
70
+ sessionKey: metadata.sessionKey
71
+ },
72
+ agentFilter: config?.agentFilter,
73
+ sessionFilter: config?.sessionFilter
74
+ });
75
+ }
76
+ //#endregion
77
+ //#region extensions/discord/src/audit-core.ts
78
+ const REQUIRED_TEXT_CHANNEL_PERMISSIONS = ["ViewChannel", "SendMessages"];
79
+ const REQUIRED_VOICE_CHANNEL_PERMISSIONS = [
80
+ "ViewChannel",
81
+ "Connect",
82
+ "Speak",
83
+ "SendMessages",
84
+ "ReadMessageHistory"
85
+ ];
86
+ function resolveRequiredDiscordChannelPermissions(channelType) {
87
+ if (channelType === ChannelType.GuildVoice || channelType === ChannelType.GuildStageVoice) return [...REQUIRED_VOICE_CHANNEL_PERMISSIONS];
88
+ return [...REQUIRED_TEXT_CHANNEL_PERMISSIONS];
89
+ }
90
+ function shouldAuditChannelConfig(config) {
91
+ if (!config) return true;
92
+ if (config.enabled === false) return false;
93
+ return true;
94
+ }
95
+ function listConfiguredGuildChannelKeys(guilds) {
96
+ if (!guilds) return [];
97
+ const ids = /* @__PURE__ */ new Set();
98
+ for (const entry of Object.values(guilds)) {
99
+ if (!entry || typeof entry !== "object") continue;
100
+ const channelsRaw = entry.channels;
101
+ if (!isRecord(channelsRaw)) continue;
102
+ for (const [key, value] of Object.entries(channelsRaw)) {
103
+ const channelId = normalizeOptionalString(key) ?? "";
104
+ if (!channelId) continue;
105
+ if (channelId === "*") continue;
106
+ if (!shouldAuditChannelConfig(value)) continue;
107
+ ids.add(channelId);
108
+ }
109
+ }
110
+ return [...ids].toSorted((a, b) => a.localeCompare(b));
111
+ }
112
+ function collectDiscordAuditChannelIdsForGuilds(guilds) {
113
+ const keys = listConfiguredGuildChannelKeys(guilds);
114
+ const channelIds = keys.filter((key) => /^\d+$/.test(key));
115
+ return {
116
+ channelIds,
117
+ unresolvedChannels: keys.length - channelIds.length
118
+ };
119
+ }
120
+ function collectDiscordAuditChannelIdsForAccount(config) {
121
+ const collected = collectDiscordAuditChannelIdsForGuilds(config.guilds);
122
+ const channelIds = new Set(collected.channelIds);
123
+ let unresolvedVoiceChannels = 0;
124
+ for (const entry of config.voice?.autoJoin ?? []) {
125
+ const channelId = normalizeOptionalString(entry?.channelId) ?? "";
126
+ if (/^\d+$/.test(channelId)) channelIds.add(channelId);
127
+ else if (channelId) unresolvedVoiceChannels++;
128
+ }
129
+ return {
130
+ channelIds: [...channelIds].toSorted((a, b) => a.localeCompare(b)),
131
+ unresolvedChannels: collected.unresolvedChannels + unresolvedVoiceChannels
132
+ };
133
+ }
134
+ async function auditDiscordChannelPermissionsWithFetcher(params) {
135
+ const started = Date.now();
136
+ const token = normalizeOptionalString(params.token) ?? "";
137
+ if (!token || params.channelIds.length === 0) return {
138
+ ok: true,
139
+ checkedChannels: 0,
140
+ unresolvedChannels: 0,
141
+ channels: [],
142
+ elapsedMs: Date.now() - started
143
+ };
144
+ const channels = [];
145
+ for (const channelId of params.channelIds) try {
146
+ const perms = await params.fetchChannelPermissions(channelId, {
147
+ cfg: params.cfg,
148
+ token,
149
+ accountId: params.accountId ?? void 0
150
+ });
151
+ const missing = resolveRequiredDiscordChannelPermissions(perms.channelType).filter((p) => !perms.permissions.includes(p));
152
+ channels.push({
153
+ channelId,
154
+ ok: missing.length === 0,
155
+ missing: missing.length ? missing : void 0,
156
+ error: null,
157
+ matchKey: channelId,
158
+ matchSource: "id"
159
+ });
160
+ } catch (err) {
161
+ channels.push({
162
+ channelId,
163
+ ok: false,
164
+ error: formatErrorMessage(err),
165
+ matchKey: channelId,
166
+ matchSource: "id"
167
+ });
168
+ }
169
+ return {
170
+ ok: channels.every((c) => c.ok),
171
+ checkedChannels: channels.length,
172
+ unresolvedChannels: 0,
173
+ channels,
174
+ elapsedMs: Date.now() - started
175
+ };
176
+ }
177
+ //#endregion
178
+ //#region extensions/discord/src/inbound-event-delivery.ts
179
+ const DISCORD_INBOUND_EVENT_DELIVERY_KEY = "__openclawInboundEventDelivery";
180
+ function normalizeDiscordDeliveryTarget(value) {
181
+ return value.trim().replace(/^discord:/iu, "").replace(/^channel:/iu, "").toLowerCase();
182
+ }
183
+ const discordInboundEventDelivery = createInboundEventDeliveryCorrelation({ targetsMatch: (expected, actual) => normalizeDiscordDeliveryTarget(expected) === normalizeDiscordDeliveryTarget(actual) });
184
+ function withDiscordInboundEventDeliveryMetadata(payload, params) {
185
+ const sessionKey = params.sessionKey?.trim();
186
+ if (!sessionKey || params.inboundEventKind !== "room_event") return payload;
187
+ const channelData = asOptionalRecord(payload.channelData) ?? {};
188
+ const discordData = asOptionalRecord(channelData.discord) ?? {};
189
+ return {
190
+ ...payload,
191
+ channelData: {
192
+ ...channelData,
193
+ discord: {
194
+ ...discordData,
195
+ [DISCORD_INBOUND_EVENT_DELIVERY_KEY]: {
196
+ sessionKey,
197
+ inboundEventKind: params.inboundEventKind
198
+ }
199
+ }
200
+ }
201
+ };
202
+ }
203
+ function notifyDiscordInboundEventOutboundPayloadSuccess(params) {
204
+ const metadata = asOptionalRecord(asOptionalRecord(asOptionalRecord(params.payload.channelData)?.discord)?.[DISCORD_INBOUND_EVENT_DELIVERY_KEY]);
205
+ if (!metadata) return;
206
+ discordInboundEventDelivery.notify({
207
+ sessionKey: normalizeOptionalString(metadata.sessionKey),
208
+ inboundEventKind: normalizeOptionalString(metadata.inboundEventKind),
209
+ to: params.to,
210
+ accountId: params.accountId
211
+ });
212
+ }
213
+ //#endregion
214
+ //#region extensions/discord/src/trusted-requester-actions.ts
215
+ const trustedRequesterGuildAdminActions = /* @__PURE__ */ new Set([
216
+ "emoji-upload",
217
+ "sticker-upload",
218
+ "role-add",
219
+ "role-remove",
220
+ "channel-create",
221
+ "channel-edit",
222
+ "channel-delete",
223
+ "channel-move",
224
+ "category-create",
225
+ "category-edit",
226
+ "category-delete",
227
+ "event-create",
228
+ "timeout",
229
+ "kick",
230
+ "ban"
231
+ ]);
232
+ function isTrustedRequesterGuildAdminAction(action) {
233
+ return trustedRequesterGuildAdminActions.has(action);
234
+ }
235
+ //#endregion
236
+ //#region extensions/discord/src/channel-actions.ts
237
+ const localExecutionActions = /* @__PURE__ */ new Set([
238
+ "send",
239
+ "poll",
240
+ "upload-file",
241
+ "thread-reply",
242
+ "sticker",
243
+ "emoji-upload",
244
+ "sticker-upload",
245
+ "event-create"
246
+ ]);
247
+ function resolveDiscordActionExecutionMode({ action }) {
248
+ return localExecutionActions.has(action) ? "local" : "gateway";
249
+ }
250
+ function resolveDiscordThreadReplyDeliveryAlias(args) {
251
+ if (normalizeOptionalString(args.target) || normalizeOptionalString(args.to) || normalizeOptionalString(args.channelId)) return;
252
+ const threadId = normalizeOptionalString(args.threadId);
253
+ return threadId ? normalizeDiscordMessagingTarget(`channel:${threadId}`) : void 0;
254
+ }
255
+ function resolveDiscordThreadReplyTarget(args) {
256
+ const threadId = normalizeOptionalString(args.threadId);
257
+ const target = threadId !== void 0 ? `channel:${threadId}` : normalizeOptionalString(args.channelId) ?? normalizeOptionalString(args.to) ?? normalizeOptionalString(args.target);
258
+ return target ? normalizeDiscordMessagingTarget(target) : void 0;
259
+ }
260
+ function matchesCurrentDiscordThread(params) {
261
+ const requestedTarget = resolveDiscordThreadReplyTarget(params.args);
262
+ if (!requestedTarget) return false;
263
+ return [params.toolContext.currentChannelId, params.toolContext.currentMessagingTarget].some((currentTarget) => currentTarget !== void 0 && normalizeDiscordMessagingTarget(currentTarget) === requestedTarget);
264
+ }
265
+ const loadDiscordChannelActionsRuntime = createLazyRuntimeModule(() => import("./channel-actions.runtime-UMGGIfSy.js"));
266
+ function listDiscoverableDiscordAccounts(cfg) {
267
+ return listDiscordAccountIds(cfg).map((accountId) => inspectDiscordAccount({
268
+ cfg,
269
+ accountId
270
+ })).filter((account) => account.enabled && account.configured);
271
+ }
272
+ function resolveDiscordActionDiscovery(cfg) {
273
+ const accounts = listDiscoverableDiscordAccounts(cfg);
274
+ if (accounts.length === 0) return null;
275
+ const unionGate = createUnionActionGate(accounts, (account) => createDiscordActionGate({
276
+ cfg,
277
+ accountId: account.accountId
278
+ }));
279
+ return { isEnabled: (key, defaultValue = true) => unionGate(key, defaultValue) };
280
+ }
281
+ function resolveScopedDiscordActionDiscovery(params) {
282
+ if (!params.accountId) return resolveDiscordActionDiscovery(params.cfg);
283
+ const account = inspectDiscordAccount({
284
+ cfg: params.cfg,
285
+ accountId: params.accountId
286
+ });
287
+ if (!account.enabled || !account.configured) return null;
288
+ const gate = createDiscordActionGate({
289
+ cfg: params.cfg,
290
+ accountId: account.accountId
291
+ });
292
+ return { isEnabled: (key, defaultValue = true) => gate(key, defaultValue) };
293
+ }
294
+ function describeDiscordMessageTool({ cfg, accountId }) {
295
+ const discovery = resolveScopedDiscordActionDiscovery({
296
+ cfg,
297
+ accountId
298
+ });
299
+ if (!discovery) return {
300
+ actions: [],
301
+ capabilities: [],
302
+ schema: null
303
+ };
304
+ const actions = /* @__PURE__ */ new Set(["send"]);
305
+ if (discovery.isEnabled("polls")) actions.add("poll");
306
+ if (discovery.isEnabled("reactions")) {
307
+ actions.add("react");
308
+ actions.add("reactions");
309
+ actions.add("emoji-list");
310
+ }
311
+ if (discovery.isEnabled("messages")) {
312
+ actions.add("upload-file");
313
+ actions.add("read");
314
+ actions.add("edit");
315
+ actions.add("delete");
316
+ }
317
+ if (discovery.isEnabled("pins")) {
318
+ actions.add("pin");
319
+ actions.add("unpin");
320
+ actions.add("list-pins");
321
+ }
322
+ if (discovery.isEnabled("permissions")) actions.add("permissions");
323
+ if (discovery.isEnabled("threads")) {
324
+ actions.add("thread-create");
325
+ actions.add("thread-list");
326
+ actions.add("thread-reply");
327
+ }
328
+ if (discovery.isEnabled("search")) actions.add("search");
329
+ if (discovery.isEnabled("stickers")) actions.add("sticker");
330
+ if (discovery.isEnabled("memberInfo")) actions.add("member-info");
331
+ if (discovery.isEnabled("roleInfo")) actions.add("role-info");
332
+ if (discovery.isEnabled("emojiUploads")) actions.add("emoji-upload");
333
+ if (discovery.isEnabled("stickerUploads")) actions.add("sticker-upload");
334
+ if (discovery.isEnabled("roles", false)) {
335
+ actions.add("role-add");
336
+ actions.add("role-remove");
337
+ }
338
+ if (discovery.isEnabled("channelInfo")) {
339
+ actions.add("channel-info");
340
+ actions.add("channel-list");
341
+ }
342
+ if (discovery.isEnabled("channels")) {
343
+ actions.add("channel-create");
344
+ actions.add("channel-edit");
345
+ actions.add("channel-delete");
346
+ actions.add("channel-move");
347
+ actions.add("category-create");
348
+ actions.add("category-edit");
349
+ actions.add("category-delete");
350
+ }
351
+ if (discovery.isEnabled("voiceStatus")) actions.add("voice-status");
352
+ if (discovery.isEnabled("events")) {
353
+ actions.add("event-list");
354
+ actions.add("event-create");
355
+ }
356
+ if (discovery.isEnabled("moderation", false)) {
357
+ actions.add("timeout");
358
+ actions.add("kick");
359
+ actions.add("ban");
360
+ }
361
+ if (discovery.isEnabled("presence", false)) actions.add("set-presence");
362
+ const schema = [];
363
+ if (actions.has("react")) schema.push({
364
+ actions: ["react", "reactions"],
365
+ properties: { emoji: Type.Optional(Type.String({ description: `Unicode emoji or custom name:id (also <:name:id> / <a:name:id>).${actions.has("emoji-list") ? " Use action:\"emoji-list\" for server emojis." : ""}` })) }
366
+ });
367
+ if (actions.has("send")) schema.push({
368
+ actions: ["send"],
369
+ visibility: "all-configured",
370
+ properties: { components: Type.Optional(Type.Object({
371
+ blocks: Type.Optional(Type.Array(Type.Unknown(), { description: "Discord Components V2 blocks such as text, buttons, selects, media, containers, and separators." })),
372
+ modal: Type.Optional(Type.Object({}, {
373
+ additionalProperties: true,
374
+ description: "Optional Discord modal triggered by generated components."
375
+ }))
376
+ }, {
377
+ additionalProperties: true,
378
+ description: "Discord Components V2 payload for send actions. Accepts the same object consumed by the Discord components adapter."
379
+ })) }
380
+ });
381
+ return {
382
+ actions: Array.from(actions),
383
+ capabilities: ["presentation"],
384
+ schema
385
+ };
386
+ }
387
+ const discordMessageActions = {
388
+ providerOwnedReadGates: true,
389
+ resolveExecutionMode: resolveDiscordActionExecutionMode,
390
+ describeMessageTool: describeDiscordMessageTool,
391
+ supportsAction: ({ action }) => action !== "poll",
392
+ messageActionTargetAliases: { "thread-reply": {
393
+ aliases: ["threadId"],
394
+ deliveryTargetAliases: ["threadId"],
395
+ resolveDeliveryTarget: ({ args }) => resolveDiscordThreadReplyDeliveryAlias(args),
396
+ matchesCurrentConversation: ({ args, toolContext }) => matchesCurrentDiscordThread({
397
+ args,
398
+ toolContext
399
+ })
400
+ } },
401
+ requiresTrustedRequesterSender: ({ action, toolContext }) => Boolean(toolContext) && isTrustedRequesterGuildAdminAction(action),
402
+ extractToolSend: ({ args }) => {
403
+ const action = normalizeOptionalString(args.action) ?? "";
404
+ if (action === "sendMessage") return extractToolSend(args, "sendMessage");
405
+ if (action === "threadReply") {
406
+ const channelId = normalizeOptionalString(args.channelId) ?? "";
407
+ return channelId ? { to: `channel:${channelId}` } : null;
408
+ }
409
+ return null;
410
+ },
411
+ prepareSendPayload: ({ ctx, payload }) => {
412
+ if (ctx.action !== "send") return null;
413
+ const payloadWithDeliveryMetadata = withDiscordInboundEventDeliveryMetadata(payload, {
414
+ sessionKey: ctx.sessionKey,
415
+ inboundEventKind: ctx.inboundEventKind
416
+ });
417
+ const rawComponents = coerceDiscordComponentParam(ctx.params.components);
418
+ if (typeof rawComponents === "function") return null;
419
+ const componentSpec = rawComponents && typeof rawComponents === "object" && !Array.isArray(rawComponents) ? readDiscordComponentSpec(rawComponents) : void 0;
420
+ const nativeComponents = Array.isArray(rawComponents) ? rawComponents : void 0;
421
+ const embeds = Array.isArray(ctx.params.embeds) ? ctx.params.embeds : void 0;
422
+ if ((componentSpec || nativeComponents) && embeds?.length) return null;
423
+ const filename = normalizeOptionalString(ctx.params.filename);
424
+ if (!componentSpec && !nativeComponents && !embeds?.length && !filename) return payloadWithDeliveryMetadata;
425
+ const discordData = payloadWithDeliveryMetadata.channelData?.discord && typeof payloadWithDeliveryMetadata.channelData.discord === "object" && !Array.isArray(payloadWithDeliveryMetadata.channelData.discord) ? payloadWithDeliveryMetadata.channelData.discord : {};
426
+ return {
427
+ ...payloadWithDeliveryMetadata,
428
+ channelData: {
429
+ ...payloadWithDeliveryMetadata.channelData,
430
+ discord: {
431
+ ...discordData,
432
+ ...componentSpec ? { components: componentSpec } : {},
433
+ ...nativeComponents ? { components: nativeComponents } : {},
434
+ ...embeds?.length ? { embeds } : {},
435
+ ...filename ? { filename } : {}
436
+ }
437
+ }
438
+ };
439
+ },
440
+ handleAction: async ({ action, params, cfg, accountId, requesterAccountId, requesterSenderId, senderIsOwner, toolContext, mediaAccess, mediaLocalRoots, mediaReadFile, sessionKey, inboundEventKind, conversationReadOrigin, reply }) => {
441
+ return await (await loadDiscordChannelActionsRuntime()).handleDiscordMessageAction({
442
+ action,
443
+ params,
444
+ cfg,
445
+ accountId,
446
+ requesterSenderId,
447
+ senderIsOwner,
448
+ toolContext,
449
+ mediaAccess,
450
+ mediaLocalRoots,
451
+ mediaReadFile,
452
+ ...sessionKey ? { sessionKey } : {},
453
+ ...inboundEventKind ? { inboundEventKind } : {},
454
+ ...requesterAccountId ? { requesterAccountId } : {},
455
+ ...conversationReadOrigin ? { conversationReadOrigin } : {},
456
+ ...reply ? { reply } : {}
457
+ });
458
+ }
459
+ };
460
+ //#endregion
461
+ //#region extensions/discord/src/conversation-identity.ts
462
+ function normalizeDiscordTarget(raw, defaultKind) {
463
+ const trimmed = normalizeOptionalString(raw);
464
+ if (!trimmed) return;
465
+ return parseDiscordTarget(trimmed, { defaultKind })?.normalized;
466
+ }
467
+ function buildDiscordConversationIdentity(kind, rawId) {
468
+ const trimmed = normalizeOptionalString(rawId);
469
+ return trimmed ? `${kind}:${trimmed}` : void 0;
470
+ }
471
+ function resolveDiscordConversationIdentity(params) {
472
+ return params.isDirectMessage ? buildDiscordConversationIdentity("user", params.userId) : buildDiscordConversationIdentity("channel", params.channelId);
473
+ }
474
+ function resolveDiscordRuntimeBindingConversationId(params) {
475
+ if (params.isDirectMessage && !params.isGroupDm) return buildDiscordConversationIdentity("user", params.userId) ?? params.channelId;
476
+ return params.channelId;
477
+ }
478
+ function resolveDiscordCurrentConversationIdentity(params) {
479
+ if (normalizeOptionalLowercaseString(params.chatType) === "direct") {
480
+ const senderTarget = normalizeDiscordTarget(params.from, "user");
481
+ if (senderTarget?.startsWith("user:")) return senderTarget;
482
+ }
483
+ for (const candidate of [
484
+ params.originatingTo,
485
+ params.commandTo,
486
+ params.fallbackTo
487
+ ]) {
488
+ const target = normalizeDiscordTarget(candidate, "channel");
489
+ if (target) return target;
490
+ }
491
+ }
492
+ //#endregion
493
+ //#region extensions/discord/src/monitor/route-resolution.ts
494
+ function buildDiscordRoutePeer(params) {
495
+ return {
496
+ kind: params.isGroupDm ? "group" : params.isDirectMessage ? "direct" : "channel",
497
+ id: params.isDirectMessage && !params.isGroupDm ? params.directUserId?.trim() || params.conversationId : params.conversationId
498
+ };
499
+ }
500
+ function buildDiscordConversationRouteContext(params) {
501
+ return {
502
+ ConversationRouteContextObserved: true,
503
+ ConversationRoutePeerId: buildDiscordRoutePeer(params).id,
504
+ NativeChannelId: params.conversationId,
505
+ InboundAccessAuthorized: true,
506
+ MessageThreadId: params.isThread ? params.conversationId : void 0,
507
+ ThreadParentId: params.isThread ? params.parentConversationId : void 0
508
+ };
509
+ }
510
+ function resolveDiscordConversationRoute(params) {
511
+ return resolveAgentRoute({
512
+ cfg: params.cfg,
513
+ channel: "discord",
514
+ accountId: params.accountId,
515
+ guildId: params.guildId ?? void 0,
516
+ memberRoleIds: params.memberRoleIds,
517
+ peer: params.peer,
518
+ parentPeer: params.parentConversationId ? {
519
+ kind: "channel",
520
+ id: params.parentConversationId
521
+ } : void 0
522
+ });
523
+ }
524
+ function resolveDiscordBoundConversationRoute(params) {
525
+ return resolveDiscordEffectiveRoute({
526
+ route: resolveDiscordConversationRoute({
527
+ cfg: params.cfg,
528
+ accountId: params.accountId,
529
+ guildId: params.guildId,
530
+ memberRoleIds: params.memberRoleIds,
531
+ peer: buildDiscordRoutePeer({
532
+ isDirectMessage: params.isDirectMessage,
533
+ isGroupDm: params.isGroupDm,
534
+ directUserId: params.directUserId,
535
+ conversationId: params.conversationId
536
+ }),
537
+ parentConversationId: params.parentConversationId
538
+ }),
539
+ boundSessionKey: params.boundSessionKey,
540
+ configuredRoute: params.configuredRoute,
541
+ matchedBy: params.matchedBy
542
+ });
543
+ }
544
+ function resolveDiscordEffectiveRoute(params) {
545
+ const boundSessionKey = params.boundSessionKey?.trim();
546
+ if (!boundSessionKey) return params.configuredRoute?.route ?? params.route;
547
+ return {
548
+ ...params.route,
549
+ sessionKey: boundSessionKey,
550
+ agentId: resolveAgentIdFromSessionKey(boundSessionKey),
551
+ lastRoutePolicy: deriveLastRoutePolicy({
552
+ sessionKey: boundSessionKey,
553
+ mainSessionKey: params.route.mainSessionKey
554
+ }),
555
+ ...params.matchedBy ? { matchedBy: params.matchedBy } : {}
556
+ };
557
+ }
558
+ function hasExplicitRuntimeBindingIntent(record) {
559
+ if (record.targetKind === "subagent") return true;
560
+ if (isAcpSessionKey(record.targetSessionKey) || isSubagentSessionKey(record.targetSessionKey)) return true;
561
+ const metadata = record.metadata;
562
+ if (!metadata || typeof metadata !== "object") return false;
563
+ return typeof metadata.boundBy === "string" || typeof metadata.label === "string" || typeof metadata.threadName === "string" || metadata.pluginBindingOwner === "plugin";
564
+ }
565
+ function shouldIgnoreStaleDiscordRouteBinding(params) {
566
+ const bindingRecord = params.bindingRecord;
567
+ const boundSessionKey = bindingRecord?.targetSessionKey?.trim();
568
+ if (!bindingRecord || !boundSessionKey || hasExplicitRuntimeBindingIntent(bindingRecord)) return false;
569
+ const bound = parseAgentSessionKey(boundSessionKey);
570
+ const routed = parseAgentSessionKey(params.route.sessionKey);
571
+ if (!bound || !routed || bound.rest !== routed.rest) return false;
572
+ return bound.agentId !== params.route.agentId;
573
+ }
574
+ //#endregion
575
+ //#region extensions/discord/src/approval-message-safety.ts
576
+ const DISCORD_APPROVAL_ALLOWED_MENTIONS = { parse: [] };
577
+ const DISCORD_MARKDOWN_META_CHARACTERS = /* @__PURE__ */ new Set([
578
+ "\\",
579
+ "`",
580
+ "*",
581
+ "_",
582
+ "{",
583
+ "}",
584
+ "[",
585
+ "]",
586
+ "(",
587
+ ")",
588
+ "<",
589
+ ">",
590
+ "#",
591
+ "+",
592
+ "-",
593
+ ".",
594
+ "!",
595
+ "|",
596
+ "~"
597
+ ]);
598
+ function escapeDiscordApprovalDisplayCharacter(character) {
599
+ if (character === "\n") return "\\n";
600
+ if (character === "\r") return "\\r";
601
+ if (character === " ") return "\\t";
602
+ const codePoint = character.codePointAt(0) ?? 0;
603
+ if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159 || codePoint === 8232 || codePoint === 8233) return `\\u{${codePoint.toString(16).padStart(4, "0")}}`;
604
+ return DISCORD_MARKDOWN_META_CHARACTERS.has(character) ? `\\${character}` : character;
605
+ }
606
+ /** Keep opaque approval metadata bounded, single-line, and inert in Discord Markdown. */
607
+ function formatDiscordApprovalDisplayValue(value, maxChars = 200) {
608
+ const limit = Number.isFinite(maxChars) ? Math.max(0, Math.trunc(maxChars)) : 200;
609
+ const escapedParts = Array.from(value, escapeDiscordApprovalDisplayCharacter);
610
+ const escaped = escapedParts.join("");
611
+ if (escaped.length <= limit) return escaped;
612
+ if (limit <= 3) return ".".repeat(limit);
613
+ let bounded = "";
614
+ for (const part of escapedParts) {
615
+ if (bounded.length + part.length > limit - 3) break;
616
+ bounded += part;
617
+ }
618
+ return `${bounded}...`;
619
+ }
620
+ //#endregion
621
+ //#region extensions/discord/src/outbound-session-route.ts
622
+ function resolveDiscordOutboundSessionRoute(params) {
623
+ const parsed = parseDiscordTarget(params.target, { defaultKind: resolveDiscordOutboundTargetKindHint(params) });
624
+ if (!parsed) return null;
625
+ const explicitThreadId = params.threadId == null ? void 0 : String(params.threadId).trim();
626
+ const peerId = explicitThreadId || parsed.id;
627
+ const isDm = parsed.kind === "user" && !explicitThreadId;
628
+ const recipientSessionExact = /^\d+$/.test(peerId);
629
+ const peer = {
630
+ kind: isDm ? "direct" : "channel",
631
+ id: peerId
632
+ };
633
+ const baseSessionKey = buildOutboundBaseSessionKey({
634
+ cfg: params.cfg,
635
+ agentId: params.agentId,
636
+ channel: "discord",
637
+ accountId: params.accountId,
638
+ peer
639
+ });
640
+ return buildThreadAwareOutboundSessionRoute({
641
+ route: {
642
+ sessionKey: baseSessionKey,
643
+ baseSessionKey,
644
+ recipientSessionExact,
645
+ peer,
646
+ chatType: isDm ? "direct" : "channel",
647
+ from: isDm ? `discord:${peerId}` : `discord:channel:${peerId}`,
648
+ to: isDm ? `user:${peerId}` : `channel:${peerId}`
649
+ },
650
+ threadId: params.threadId,
651
+ precedence: ["threadId"],
652
+ useSuffix: false
653
+ });
654
+ }
655
+ function resolveDiscordOutboundTargetKindHint(params) {
656
+ const resolvedKind = params.resolvedTarget?.kind;
657
+ if (resolvedKind === "user") return "user";
658
+ if (resolvedKind === "group" || resolvedKind === "channel") return "channel";
659
+ const target = params.target.trim();
660
+ if (/^channel:/i.test(target)) return "channel";
661
+ if (/^(user:|discord:|@|<@!?)/i.test(target)) return "user";
662
+ return "channel";
663
+ }
664
+ //#endregion
665
+ export { shouldSuppressLocalDiscordExecApprovalPrompt as C, isChannelExecApprovalClientEnabledFromConfig as D, createChannelNativeOriginTargetResolver as E, matchesApprovalRequestFilters as O, isDiscordExecApprovalClientEnabled as S, createChannelApproverDmTargetResolver as T, auditDiscordChannelPermissionsWithFetcher as _, buildDiscordRoutePeer as a, getDiscordExecApprovalApprovers as b, resolveDiscordEffectiveRoute as c, resolveDiscordCurrentConversationIdentity as d, resolveDiscordRuntimeBindingConversationId as f, notifyDiscordInboundEventOutboundPayloadSuccess as g, discordInboundEventDelivery as h, buildDiscordConversationRouteContext as i, shouldIgnoreStaleDiscordRouteBinding as l, isTrustedRequesterGuildAdminAction as m, DISCORD_APPROVAL_ALLOWED_MENTIONS as n, resolveDiscordBoundConversationRoute as o, discordMessageActions as p, formatDiscordApprovalDisplayValue as r, resolveDiscordConversationRoute as s, resolveDiscordOutboundSessionRoute as t, resolveDiscordConversationIdentity as u, collectDiscordAuditChannelIdsForAccount as v, createApproverRestrictedNativeApprovalCapability as w, isDiscordExecApprovalApprover as x, resolveRequiredDiscordChannelPermissions as y };