@openclaw/discord 2026.10.10-beta.5 → 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 (297) hide show
  1. package/dist/.setup/{account-inspect-8cCu6uPG.mjs → account-inspect-CSz5Qodj.mjs} +2 -3
  2. package/dist/.setup/{accounts-ljrzXBJi.mjs → accounts-DtjvhJUj.mjs} +13 -14
  3. package/dist/.setup/{active-turn-thread-route-C4tp9noA.mjs → active-turn-thread-route-DkPnk2x8.mjs} +2 -4
  4. package/dist/.setup/{allow-list-B_ToXtew.mjs → allow-list-DahA0Jxh.mjs} +7 -159
  5. package/dist/.setup/{api-CtmE1OUN.mjs → api-Bp0HI4q3.mjs} +12 -24
  6. package/dist/.setup/{approval-handler.runtime-Db06VTbO.mjs → approval-handler.runtime-Cy53ugTf.mjs} +81 -63
  7. package/dist/.setup/{approval-message-updates-wbUqLtLI.mjs → approval-message-updates-DqOXxPss.mjs} +3 -4
  8. package/dist/.setup/{audit-BXOSwPCj.mjs → audit-DoPKOfQE.mjs} +6 -7
  9. package/dist/.setup/{channel-D2pO9g6n.mjs → channel-Ds6iuNdy.mjs} +146 -221
  10. package/dist/.setup/channel-access-DhJhVrdZ.mjs +23 -0
  11. package/dist/.setup/channel.setup-BLt9dkIG.mjs +235 -0
  12. package/dist/.setup/{command-deploy-store-DFkBTViB.mjs → command-deploy-store-DPWiBMks.mjs} +1 -2
  13. package/dist/.setup/{command-owners-C7rUdqUX.mjs → command-owners-BzlhNBxA.mjs} +1 -2
  14. package/dist/.setup/{components-C_cuoW1q.mjs → components-WTfUxead.mjs} +213 -440
  15. package/dist/.setup/components.base-C5sAPHe4.mjs +31 -0
  16. package/dist/.setup/{config-schema-_uBILpQf.mjs → config-schema-GX2yDgIH.mjs} +9 -12
  17. package/dist/.setup/{conversation-binding-route-Dcqrf96n.mjs → conversation-binding-route-CZdm-X5A.mjs} +3 -4
  18. package/dist/.setup/{directory-config-3iVub-3m.mjs → directory-config-BXJuh9-J.mjs} +3 -4
  19. package/dist/.setup/{directory-live-DLygQVtW.mjs → directory-live-CEopeb8Q.mjs} +59 -69
  20. package/dist/.setup/{discord-Cl2OPTZ6.mjs → discord-r79VFjJp.mjs} +1105 -1715
  21. package/dist/.setup/{doctor-t9tc4fim.mjs → doctor-UfLW8nye.mjs} +7 -10
  22. package/dist/.setup/{doctor-contract-Bwv8EuQ_.mjs → doctor-contract-Dstl3cMg.mjs} +2 -3
  23. package/dist/.setup/endpoint-runtime-BM3x-m6O.mjs +138 -0
  24. package/dist/.setup/guilds-DQucP5Tn.mjs +21 -0
  25. package/dist/.setup/{handle-action-CRH5-aLm.mjs → handle-action-BarHOi-v.mjs} +17 -18
  26. package/dist/.setup/{handle-action.guild-admin-BCWdfNPn.mjs → handle-action.guild-admin-oRUb8p_O.mjs} +6 -7
  27. package/dist/.setup/listeners-CHgTENFu.mjs +46 -0
  28. package/dist/.setup/{live-policy-config-BPoB3eQi.mjs → live-policy-config-EKp4O6zx.mjs} +4 -7
  29. package/dist/.setup/{message-handler-BvzZOXLT.mjs → message-handler-DUeT8Asf.mjs} +159 -123
  30. package/dist/.setup/{message-handler.preflight-DD0kun2e.mjs → message-handler.preflight-C6TNtKW0.mjs} +37 -119
  31. package/dist/.setup/{message-handler.preflight-pluralkit-DQygfoVJ.mjs → message-handler.preflight-pluralkit-6E9TFmmN.mjs} +14 -31
  32. package/dist/.setup/{message-handler.process-1dRMGRR1.mjs → message-handler.process-D8_oQ5Cp.mjs} +266 -391
  33. package/dist/.setup/outbound-payload-DUsrFICb.mjs +445 -0
  34. package/dist/.setup/{outbound-session-route-D-qWvLfS.mjs → outbound-session-route-Cb8cv4Oi.mjs} +151 -110
  35. package/dist/.setup/{output-activity-uBpMSX75.mjs → output-activity-CDgs2s3O.mjs} +1 -2
  36. package/dist/.setup/{pluralkit-B64dfq_j.mjs → pluralkit-DcXbHTpQ.mjs} +2 -3
  37. package/dist/.setup/{preflight-audio-wWgsZG5F.mjs → preflight-audio-r4BbaJxh.mjs} +2 -7
  38. package/dist/.setup/{presence-cache-DCeTsL73.mjs → presence-cache-B3xj3b0l.mjs} +2 -8
  39. package/dist/.setup/{probe-D3P1x4aN.mjs → probe-BUmJyH35.mjs} +7 -12
  40. package/dist/.setup/{provider-D2gXZbGd.mjs → provider-Dm2ERSxe.mjs} +3643 -4587
  41. package/dist/.setup/{provider-session.runtime-3bl84wqI.mjs → provider-session.runtime-DCIqDsIg.mjs} +3 -3
  42. package/dist/.setup/provider.runtime-DmxPGoUg.mjs +1 -0
  43. package/dist/.setup/proxy-fetch-B8cK6FLQ.mjs +29 -0
  44. package/dist/.setup/{realtime-session.runtime-Cw2Nz11j.mjs → realtime-session.runtime-WJL6NdwK.mjs} +53 -100
  45. package/dist/.setup/{receive-recovery-CKvaG2Hf.mjs → receive-recovery-DV_v5ROf.mjs} +16 -33
  46. package/dist/.setup/{resolve-allowlist-common-DNSsUQRF.mjs → resolve-allowlist-common-C37fgnYG.mjs} +4 -15
  47. package/dist/.setup/{resolve-channels-UdT38DzU.mjs → resolve-channels-CwpnQ7C2.mjs} +7 -7
  48. package/dist/.setup/{resolve-users-DnCsrXZ_.mjs → resolve-users-D6jSwe8R.mjs} +6 -10
  49. package/dist/.setup/{rolldown-runtime-B4FMCO8f.mjs → rolldown-runtime-nwUcYXjP.mjs} +1 -2
  50. package/dist/.setup/{runtime-BRsj76Px.mjs → runtime-B-PgPsGR.mjs} +8 -10
  51. package/dist/.setup/{runtime-DgnVQ7zW.mjs → runtime-DcBvHOm1.mjs} +1 -2
  52. package/dist/.setup/{runtime-By-vo8b-.mjs → runtime-DhOMlnYS.mjs} +204 -255
  53. package/dist/.setup/{runtime-doctor-migrations-BPV-R4G9.mjs → runtime-doctor-migrations-BpV1jKk0.mjs} +5 -9
  54. package/dist/.setup/{secret-config-contract-CIsH7R3B.mjs → secret-config-contract-CP6teHec.mjs} +5 -11
  55. package/dist/.setup/{security-audit-BFT84Uny.mjs → security-audit-CTwisG7c.mjs} +3 -4
  56. package/dist/.setup/{security-contract-DNyyjTZZ.mjs → security-contract-D-o0iWDk.mjs} +1 -2
  57. package/dist/.setup/{security-doctor-nGgPm65L.mjs → security-doctor-4s7omTZd.mjs} +1 -2
  58. package/dist/.setup/{send-Ca810XtV.mjs → send-DnLL6XoO.mjs} +158 -193
  59. package/dist/.setup/{send.components-DxpLdHrr.mjs → send.components-xB43CksK.mjs} +66 -79
  60. package/dist/.setup/{send.outbound-ByYCrfta.mjs → send.outbound-B11X6TOE.mjs} +80 -138
  61. package/dist/.setup/{send.receipt-DkwJ1h9E.mjs → send.receipt-CMteCIZS.mjs} +36 -45
  62. package/dist/.setup/{send.shared-C2J1g_uJ.mjs → send.shared-BcLLZBul.mjs} +44 -127
  63. package/dist/.setup/{sender-identity-BNBvGt1l.mjs → sender-identity-CGNpdJmb.mjs} +4 -11
  64. package/dist/.setup/{session-contract-BO5tlIdl.mjs → session-contract-Bq71MS78.mjs} +1 -2
  65. package/dist/.setup/{session-key-normalization-CCHGNSQw.mjs → session-key-normalization-Cfvze5hd.mjs} +1 -2
  66. package/dist/.setup/setup-plugin-api-C6AMx3hu.mjs +2 -0
  67. package/dist/.setup/{shared-DbNfsfcr.mjs → shared-BEYw16he.mjs} +16 -22
  68. package/dist/.setup/shared-interactive-DKBw4SNV.mjs +311 -0
  69. package/dist/.setup/{subagent-hooks-BhV5ZVej.mjs → subagent-hooks-DlYElpXa.mjs} +3 -4
  70. package/dist/.setup/{system-events-DGsxf-l9.mjs → system-events--Pk6y9aP.mjs} +3 -4
  71. package/dist/.setup/{target-parsing-C-HyNxcE.mjs → target-parsing-BiuhcK9Q.mjs} +1 -2
  72. package/dist/.setup/{target-resolver-BxRZHPL3.mjs → target-resolver-Bo9EpGp_.mjs} +6 -7
  73. package/dist/.setup/{thread-binding-api-BDZJD4na.mjs → thread-binding-api-Drd4Zu-5.mjs} +1 -2
  74. package/dist/.setup/{thread-bindings-c0WwzyHH.mjs → thread-bindings-BF-hr-bg.mjs} +17 -28
  75. package/dist/.setup/{thread-bindings.manager-B7HFHXrI.mjs → thread-bindings.manager-CQCkha5r.mjs} +29 -54
  76. package/dist/.setup/{thread-bindings.session-updates-BMdJeJMc.mjs → thread-bindings.session-updates-C2gJAj_I.mjs} +16 -27
  77. package/dist/.setup/{threading-DJjzMR2f.mjs → threading-HA9C2wYR.mjs} +70 -109
  78. package/dist/.setup/{timeouts-CuNARfyw.mjs → timeouts-CT9hnmo4.mjs} +2 -3
  79. package/dist/.setup/{transcripts-source-MRAZocrc.mjs → transcripts-source-DzpzETZR.mjs} +115 -198
  80. package/dist/.setup/{typing-CNlSKY5S.mjs → typing-DAv4S2fI.mjs} +2 -3
  81. package/dist/.setup/{voice-runtime-_LfZ3Za7.mjs → voice-runtime-Bo_nsVvX.mjs} +250 -489
  82. package/dist/.source-module-urls/d6c089460280c5a04184542d6712e04545caeb1ebb290d3504377b4cc5e22fea.json +1 -1
  83. package/dist/account-inspect-api.js +2 -3
  84. package/dist/action-runtime-api.js +1 -1
  85. package/dist/activities-api.js +288 -347
  86. package/dist/api.js +21 -22
  87. package/dist/assets/embedded-app-sdk.mjs +1 -1
  88. package/dist/channel-config-api.js +1 -1
  89. package/dist/channel-plugin-api.js +1 -1
  90. package/dist/contract-api.js +1 -1
  91. package/dist/directory-contract-api.js +2 -3
  92. package/dist/doctor-contract-api.js +5 -7
  93. package/dist/index.js +1 -2
  94. package/dist/runtime-api.js +23 -23
  95. package/dist/runtime-setter-api.js +1 -1
  96. package/dist/secret-contract-api.js +1 -1
  97. package/dist/security-audit-contract-api.js +1 -1
  98. package/dist/security-contract-api.js +1 -1
  99. package/dist/session-key-api.js +1 -1
  100. package/dist/setup-entry.js +2 -3
  101. package/dist/setup-plugin-api.js +1 -1
  102. package/dist/src/voice/audio-worker.runtime.js +63 -81
  103. package/dist/subagent-hooks-api.js +2 -3
  104. package/dist/thread-binding-api.js +1 -1
  105. package/dist/transcripts-source-api.js +2 -3
  106. package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.cjs +2 -3
  107. package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.mjs +2 -3
  108. package/node_modules/@napi-rs/wasm-runtime/dist/fs.js +3339 -4021
  109. package/node_modules/@napi-rs/wasm-runtime/package.json +1 -1
  110. package/node_modules/@types/lodash/README.md +1 -1
  111. package/node_modules/@types/lodash/common/function.d.ts +2 -2
  112. package/node_modules/@types/lodash/package.json +2 -2
  113. package/node_modules/@types/node/README.md +1 -1
  114. package/node_modules/@types/node/package.json +2 -2
  115. package/node_modules/@types/node/util.d.ts +6 -3
  116. package/node_modules/discord-api-types/package.json +4 -4
  117. package/node_modules/discord-api-types/rest/v10/index.d.ts +8 -0
  118. package/node_modules/discord-api-types/rest/v10/index.d.ts.map +1 -1
  119. package/node_modules/discord-api-types/rest/v10/index.js +8 -0
  120. package/node_modules/discord-api-types/rest/v10/index.js.map +1 -1
  121. package/node_modules/discord-api-types/rest/v10/oauth2.d.ts +26 -2
  122. package/node_modules/discord-api-types/rest/v10/oauth2.d.ts.map +1 -1
  123. package/node_modules/discord-api-types/rest/v9/index.d.ts +8 -0
  124. package/node_modules/discord-api-types/rest/v9/index.d.ts.map +1 -1
  125. package/node_modules/discord-api-types/rest/v9/index.js +8 -0
  126. package/node_modules/discord-api-types/rest/v9/index.js.map +1 -1
  127. package/node_modules/discord-api-types/rest/v9/oauth2.d.ts +26 -2
  128. package/node_modules/discord-api-types/rest/v9/oauth2.d.ts.map +1 -1
  129. package/node_modules/typebox/build/format/duration.d.mts +2 -2
  130. package/node_modules/typebox/build/format/duration.mjs +2 -2
  131. package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
  132. package/node_modules/typebox/build/format/idn_email.mjs +1 -0
  133. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
  134. package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
  135. package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
  136. package/node_modules/typebox/build/format/ipv4.mjs +2 -2
  137. package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
  138. package/node_modules/typebox/build/format/ipv6.mjs +1 -1
  139. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  140. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  141. package/node_modules/typebox/build/schema/build.mjs +1 -0
  142. package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
  143. package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
  144. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
  145. package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
  146. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
  147. package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
  148. package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
  149. package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
  150. package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
  151. package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
  152. package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
  153. package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
  154. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
  155. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
  156. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
  157. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
  158. package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
  159. package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
  160. package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
  161. package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
  162. package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
  163. package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
  164. package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
  165. package/node_modules/typebox/build/system/memory/create.mjs +18 -13
  166. package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
  167. package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
  168. package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
  169. package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
  170. package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
  171. package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
  172. package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
  173. package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
  174. package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
  175. package/node_modules/typebox/build/system/memory/update.mjs +43 -16
  176. package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
  177. package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
  178. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
  179. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
  180. package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
  181. package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
  182. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
  183. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
  184. package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
  185. package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
  186. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
  187. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
  188. package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
  189. package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
  190. package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
  191. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  192. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
  193. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
  194. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
  195. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
  196. package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
  197. package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
  198. package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
  199. package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
  200. package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
  201. package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
  202. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
  203. package/node_modules/typebox/package.json +1 -1
  204. package/node_modules/typebox/readme.md +1 -1
  205. package/node_modules/undici/README.md +25 -3
  206. package/node_modules/undici/docs/docs/api/CacheStore.md +24 -9
  207. package/node_modules/undici/docs/docs/api/Client.md +11 -6
  208. package/node_modules/undici/docs/docs/api/Dispatcher.md +3 -0
  209. package/node_modules/undici/docs/docs/api/Errors.md +76 -1
  210. package/node_modules/undici/docs/docs/api/H2CClient.md +3 -2
  211. package/node_modules/undici/docs/docs/api/Interceptors.md +28 -8
  212. package/node_modules/undici/docs/docs/api/RedirectHandler.md +13 -10
  213. package/node_modules/undici/docs/docs/index.md +12 -12
  214. package/node_modules/undici/docs/docs/type-map.json +66 -66
  215. package/node_modules/undici/lib/cache/memory-cache-store.js +48 -13
  216. package/node_modules/undici/lib/cache/sqlite-cache-store.js +83 -5
  217. package/node_modules/undici/lib/core/connect.js +10 -4
  218. package/node_modules/undici/lib/core/constants.js +12 -1
  219. package/node_modules/undici/lib/core/errors.js +38 -1
  220. package/node_modules/undici/lib/core/request.js +16 -1
  221. package/node_modules/undici/lib/core/symbols.js +2 -0
  222. package/node_modules/undici/lib/core/util.js +26 -1
  223. package/node_modules/undici/lib/dispatcher/agent.js +6 -2
  224. package/node_modules/undici/lib/dispatcher/client-h1.js +116 -80
  225. package/node_modules/undici/lib/dispatcher/client-h2.js +124 -17
  226. package/node_modules/undici/lib/dispatcher/client.js +4 -1
  227. package/node_modules/undici/lib/dispatcher/dispatcher-base.js +3 -2
  228. package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +20 -3
  229. package/node_modules/undici/lib/dispatcher/parser-h1.js +1064 -0
  230. package/node_modules/undici/lib/dispatcher/pool-base.js +85 -31
  231. package/node_modules/undici/lib/dispatcher/pool.js +11 -8
  232. package/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -8
  233. package/node_modules/undici/lib/dispatcher/retry-agent.js +10 -0
  234. package/node_modules/undici/lib/dispatcher/round-robin-pool.js +15 -5
  235. package/node_modules/undici/lib/handler/cache-handler.js +153 -15
  236. package/node_modules/undici/lib/handler/deduplication-handler.js +112 -51
  237. package/node_modules/undici/lib/handler/redirect-handler.js +28 -8
  238. package/node_modules/undici/lib/handler/retry-handler.js +44 -11
  239. package/node_modules/undici/lib/interceptor/cache.js +11 -3
  240. package/node_modules/undici/lib/interceptor/decompress.js +22 -9
  241. package/node_modules/undici/lib/interceptor/dns.js +11 -0
  242. package/node_modules/undici/lib/interceptor/response-error.js +72 -28
  243. package/node_modules/undici/lib/milo/LICENSE.md +7 -0
  244. package/node_modules/undici/lib/milo/no-simd.js +1002 -0
  245. package/node_modules/undici/lib/milo/simd.js +1002 -0
  246. package/node_modules/undici/lib/mock/mock-agent.js +11 -0
  247. package/node_modules/undici/lib/mock/snapshot-recorder.js +3 -2
  248. package/node_modules/undici/lib/mock/snapshot-utils.js +3 -2
  249. package/node_modules/undici/lib/util/cache.js +11 -5
  250. package/node_modules/undici/lib/web/cookies/util.js +19 -2
  251. package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +69 -15
  252. package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -2
  253. package/node_modules/undici/lib/web/fetch/body.js +47 -38
  254. package/node_modules/undici/lib/web/fetch/formdata-parser.js +12 -4
  255. package/node_modules/undici/lib/web/fetch/headers.js +2 -2
  256. package/node_modules/undici/lib/web/fetch/index.js +8 -4
  257. package/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
  258. package/node_modules/undici/lib/web/websocket/receiver.js +25 -4
  259. package/node_modules/undici/package.json +9 -7
  260. package/node_modules/undici/types/api.d.ts +1 -1
  261. package/node_modules/undici/types/cache-interceptor.d.ts +10 -0
  262. package/node_modules/undici/types/client.d.ts +10 -4
  263. package/node_modules/undici/types/errors.d.ts +16 -1
  264. package/node_modules/undici/types/h2c-client.d.ts +1 -1
  265. package/node_modules/undici/types/interceptors.d.ts +6 -1
  266. package/node_modules/undici/types/utility.d.ts +4 -4
  267. package/node_modules/uuid/package.json +17 -17
  268. package/node_modules/zod/package.json +1 -1
  269. package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
  270. package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
  271. package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
  272. package/node_modules/zod/src/v4/core/compile.ts +9 -0
  273. package/node_modules/zod/src/v4/core/schemas.ts +35 -1
  274. package/node_modules/zod/src/v4/core/util.ts +13 -0
  275. package/node_modules/zod/src/v4/core/versions.ts +1 -1
  276. package/node_modules/zod/v4/core/compile.cjs +8 -0
  277. package/node_modules/zod/v4/core/compile.js +8 -0
  278. package/node_modules/zod/v4/core/schemas.cjs +30 -0
  279. package/node_modules/zod/v4/core/schemas.d.cts +3 -1
  280. package/node_modules/zod/v4/core/schemas.d.ts +3 -1
  281. package/node_modules/zod/v4/core/schemas.js +30 -0
  282. package/node_modules/zod/v4/core/util.cjs +15 -0
  283. package/node_modules/zod/v4/core/util.d.cts +2 -0
  284. package/node_modules/zod/v4/core/util.d.ts +2 -0
  285. package/node_modules/zod/v4/core/util.js +14 -0
  286. package/node_modules/zod/v4/core/versions.cjs +1 -1
  287. package/node_modules/zod/v4/core/versions.js +1 -1
  288. package/openclaw.plugin.json +1 -31
  289. package/package.json +8 -8
  290. package/dist/.setup/channel-access-DasWY_OV.mjs +0 -48
  291. package/dist/.setup/channel.setup-5fHTqcKz.mjs +0 -249
  292. package/dist/.setup/outbound-adapter-gpo_85fY.mjs +0 -543
  293. package/dist/.setup/provider.runtime-BI_CV9tI.mjs +0 -1
  294. package/dist/.setup/setup-plugin-api-D5VV8xTN.mjs +0 -2
  295. package/dist/.setup/targets-C0qD28Sz.mjs +0 -3
  296. package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
  297. package/node_modules/typebox/build/system/memory/freeze.mjs +0 -6
@@ -1,7 +1,7 @@
1
- import { i as listDiscordAccountIds, n as inspectDiscordAccountConfig, v as resolveDiscordAccountAvailability } from "./accounts-ljrzXBJi.mjs";
1
+ import { i as listDiscordAccountIds, n as inspectDiscordAccountConfig, v as resolveDiscordAccountAvailability } from "./accounts-DtjvhJUj.mjs";
2
2
  import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
3
3
  import { normalizeSecretInputString } from "openclaw/plugin-sdk/secret-input";
4
- //#region extensions/discord/src/account-inspect.ts
4
+ // extensions/discord/src/account-inspect.ts
5
5
  function inspectDiscordAccountPrimary(params) {
6
6
  return inspectDiscordAccountConfig(params, {
7
7
  includeName: true,
@@ -27,5 +27,4 @@ function inspectDiscordAccount(params) {
27
27
  })
28
28
  };
29
29
  }
30
- //#endregion
31
30
  export { inspectDiscordAccount as t };
@@ -1,20 +1,23 @@
1
1
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
2
- import { hasConfiguredSecretInput, normalizeResolvedSecretInputString, normalizeSecretInputString, resolveSecretInputString } from "openclaw/plugin-sdk/secret-input";
2
+ import { normalizeResolvedSecretInputString, resolveSecretInputString } from "openclaw/plugin-sdk/secret-input";
3
3
  import { createAccountActionGate, createAccountListHelpers } from "openclaw/plugin-sdk/account-helpers";
4
4
  import { mapAllowFromEntries, normalizeChannelDmPolicy } from "openclaw/plugin-sdk/channel-config-helpers";
5
5
  import { resolveConfiguredFromCredentialStatuses } from "openclaw/plugin-sdk/channel-status";
6
6
  import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, normalizeAccountId as normalizeAccountId$1, resolveAccountEntry } from "openclaw/plugin-sdk/routing";
7
7
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
8
8
  import { getRuntimeConfigSnapshot, getRuntimeConfigSourceSnapshot, selectApplicableRuntimeConfig } from "openclaw/plugin-sdk/runtime-config-snapshot";
9
- //#region extensions/discord/src/account-token-inspect.ts
9
+ // extensions/discord/src/account-token-inspect.ts
10
10
  function inspectDiscordConfiguredToken(value) {
11
- const normalized = normalizeSecretInputString(value);
12
- if (normalized || hasConfiguredSecretInput(value)) return {
13
- token: normalized ? normalized.replace(/^Bot\s+/i, "") : "",
11
+ const credential = resolveSecretInputString({
12
+ value,
13
+ path: "Discord token",
14
+ mode: "inspect"
15
+ });
16
+ return credential.status === "missing" ? null : {
17
+ token: credential.value?.replace(/^Bot\s+/i, "") ?? "",
14
18
  tokenSource: "config",
15
- tokenStatus: normalized ? "available" : "configured_unavailable"
19
+ tokenStatus: credential.status
16
20
  };
17
- return null;
18
21
  }
19
22
  function inspectDiscordAccountTokenState(params) {
20
23
  const configuredToken = inspectDiscordConfiguredToken(params.accountToken) ?? (params.hasAccountToken ? null : inspectDiscordConfiguredToken(params.channelToken));
@@ -56,8 +59,7 @@ function resolveDiscordAccountAvailability(params) {
56
59
  stateReason: duplicateOwner ? `duplicate bot token; using account "${duplicateOwner}"` : void 0
57
60
  };
58
61
  }
59
- //#endregion
60
- //#region extensions/discord/src/runtime-config.ts
62
+ // extensions/discord/src/runtime-config.ts
61
63
  function selectDiscordRuntimeConfig(inputConfig) {
62
64
  return selectApplicableRuntimeConfig({
63
65
  inputConfig,
@@ -91,8 +93,7 @@ function selectDiscordActivitiesRuntimeConfig(inputConfig) {
91
93
  }
92
94
  };
93
95
  }
94
- //#endregion
95
- //#region extensions/discord/src/token.ts
96
+ // extensions/discord/src/token.ts
96
97
  function stripDiscordBotPrefix(token) {
97
98
  return token.replace(/^Bot\s+/i, "");
98
99
  }
@@ -159,8 +160,7 @@ function resolveDiscordToken(cfg, opts = {}) {
159
160
  tokenStatus: "missing"
160
161
  };
161
162
  }
162
- //#endregion
163
- //#region extensions/discord/src/accounts.ts
163
+ // extensions/discord/src/accounts.ts
164
164
  const { listAccountIds: listDiscordAccountIds, resolveDefaultAccountId: resolveDefaultDiscordAccountId, resolveAccountConfig: mergeDiscordAccountConfig } = createAccountListHelpers("discord", {
165
165
  implicitDefaultAccount: {
166
166
  channelKeys: ["token"],
@@ -268,5 +268,4 @@ function listDiscordStartupAccountIds(cfg) {
268
268
  if (!startupAccountIds.includes(defaultAccountId)) return startupAccountIds;
269
269
  return [defaultAccountId, ...startupAccountIds.filter((candidateId) => candidateId !== defaultAccountId)];
270
270
  }
271
- //#endregion
272
271
  export { selectDiscordActivitiesRuntimeConfig as _, listDiscordStartupAccountIds as a, resolveDefaultDiscordAccountId as c, resolveDiscordAccountConfig as d, resolveDiscordAccountDisabledReason as f, resolveDiscordToken as g, normalizeDiscordToken as h, listDiscordAccountIds as i, resolveDiscordAccount as l, resolveDiscordMaxLinesPerMessage as m, inspectDiscordAccountConfig as n, listEnabledDiscordAccounts as o, resolveDiscordAccountDmPolicy as p, isDiscordAccountEnabledForRuntime as r, mergeDiscordAccountConfig as s, createDiscordActionGate as t, resolveDiscordAccountAllowFrom as u, resolveDiscordAccountAvailability as v };
@@ -1,5 +1,5 @@
1
1
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
2
- //#region extensions/discord/src/active-turn-thread-route.ts
2
+ // extensions/discord/src/active-turn-thread-route.ts
3
3
  const activeRoutes = /* @__PURE__ */ new Map();
4
4
  function beginDiscordActiveTurnThreadRoute(sessionKey, route) {
5
5
  const key = normalizeOptionalString(sessionKey);
@@ -18,14 +18,13 @@ async function notifyDiscordActiveTurnThreadCreated(params) {
18
18
  const sourceChannelId = normalizeOptionalString(params.sourceChannelId);
19
19
  const sourceMessageId = normalizeOptionalString(params.sourceMessageId);
20
20
  const route = key ? Array.from(activeRoutes.get(key) ?? []).find((candidate) => sourceChannelId === candidate.sourceChannelId && sourceMessageId === candidate.sourceMessageId && (!candidate.accountId || !params.accountId || candidate.accountId === params.accountId)) : void 0;
21
- if (!route || !threadId) return false;
21
+ if (!route || !threadId) return;
22
22
  route.adoptedThreadId = threadId;
23
23
  try {
24
24
  await route.onThreadAdopted(threadId);
25
25
  } catch (error) {
26
26
  route.onThreadAdoptionError?.(error);
27
27
  }
28
- return true;
29
28
  }
30
29
  function notifyDiscordActiveTurnThreadReplyDelivered(params) {
31
30
  const key = normalizeOptionalString(params.sessionKey ?? void 0);
@@ -36,5 +35,4 @@ function notifyDiscordActiveTurnThreadReplyDelivered(params) {
36
35
  route.onThreadReplyDelivered?.(threadId);
37
36
  return true;
38
37
  }
39
- //#endregion
40
38
  export { notifyDiscordActiveTurnThreadCreated as n, notifyDiscordActiveTurnThreadReplyDelivered as r, beginDiscordActiveTurnThreadRoute as t };
@@ -1,152 +1,13 @@
1
1
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
2
2
  import { ChannelType } from "discord-api-types/v10";
3
- import { asFiniteNumberInRange, parseDateStringTimestampMs, parseStrictFiniteNumber } from "openclaw/plugin-sdk/number-runtime";
4
- import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
5
- import { fetchWithSsrFGuard, isBlockedHostnameOrIp, isLoopbackHost } from "openclaw/plugin-sdk/ssrf-runtime";
3
+ import { asFiniteNumberInRange, parseStrictFiniteNumber } from "openclaw/plugin-sdk/number-runtime";
6
4
  import { buildChannelKeyCandidates, normalizeChannelSlug, resolveChannelEntryMatchWithFallback, resolveChannelMatchConfig } from "openclaw/plugin-sdk/channel-targets";
7
5
  import { resolveAllowlistMatchByCandidates } from "openclaw/plugin-sdk/allow-from";
8
- //#region extensions/discord/src/channel-type.ts
6
+ // extensions/discord/src/channel-type.ts
9
7
  function isDiscordThreadChannelType(channelType) {
10
8
  return channelType === ChannelType.AnnouncementThread || channelType === ChannelType.PublicThread || channelType === ChannelType.PrivateThread;
11
9
  }
12
- //#endregion
13
- //#region extensions/discord/src/endpoint-runtime.ts
14
- const DISCORD_ENDPOINT_RESPONSE_MAX_BYTES = 8388608;
15
- const DISCORD_API_URL_ENV = "DISCORD_API_URL";
16
- function parseHttpAnchor(value, label) {
17
- let url;
18
- try {
19
- url = new URL(value);
20
- } catch {
21
- throw new Error(`${label} must be a valid URL`);
22
- }
23
- if (url.protocol !== "https:" && !(url.protocol === "http:" && isLoopbackHost(url.hostname))) throw new Error(`${label} must use HTTPS or loopback HTTP`);
24
- if (url.username || url.password || url.hash) throw new Error(`${label} must not contain credentials or a fragment`);
25
- return url;
26
- }
27
- function normalizeRestApiBaseUrl(value) {
28
- const url = parseHttpAnchor(value, "Discord endpoint REST API base URL");
29
- if (url.search) throw new Error("Discord endpoint REST API base URL must not contain a query");
30
- url.pathname = url.pathname.replace(/\/+$/u, "") || "/";
31
- return url;
32
- }
33
- function resolveDescriptor(apiUrl) {
34
- const restApiBaseUrl = normalizeRestApiBaseUrl(apiUrl);
35
- const gatewayBotUrl = new URL(`${restApiBaseUrl.pathname.replace(/\/+$/u, "")}/gateway/bot`, restApiBaseUrl.origin);
36
- const gatewayOriginUrl = new URL(restApiBaseUrl.origin);
37
- gatewayOriginUrl.protocol = gatewayOriginUrl.protocol === "https:" ? "wss:" : "ws:";
38
- if (gatewayOriginUrl.protocol === "wss:" && isBlockedHostnameOrIp(gatewayOriginUrl.hostname)) throw new Error("Discord endpoint Gateway origin must not target a private/internal/special-use hostname or IP address");
39
- return Object.freeze({
40
- restApiBaseUrl: restApiBaseUrl.toString().replace(/\/$/u, ""),
41
- gatewayBotUrl: gatewayBotUrl.toString(),
42
- gatewayOrigin: gatewayOriginUrl.origin
43
- });
44
- }
45
- function isWithinRestApiBase(target, restApiBaseUrl) {
46
- if (target.origin !== restApiBaseUrl.origin) return false;
47
- const basePath = restApiBaseUrl.pathname.replace(/\/+$/u, "");
48
- return basePath === "" || target.pathname === basePath || target.pathname.startsWith(`${basePath}/`);
49
- }
50
- function assertEndpointHttpTarget(target, descriptor) {
51
- const restApiBaseUrl = new URL(descriptor.restApiBaseUrl);
52
- const gatewayBotUrl = new URL(descriptor.gatewayBotUrl);
53
- if (!isWithinRestApiBase(target, restApiBaseUrl) && target.toString() !== gatewayBotUrl.toString()) throw new Error("Discord endpoint request is outside the configured boundaries");
54
- }
55
- function requestInitFromRequest(request, signal) {
56
- return {
57
- method: request.method,
58
- headers: request.headers,
59
- ...request.body ? {
60
- body: request.body,
61
- duplex: "half"
62
- } : {},
63
- signal,
64
- cache: request.cache,
65
- credentials: request.credentials,
66
- integrity: request.integrity,
67
- keepalive: request.keepalive,
68
- mode: request.mode,
69
- referrer: request.referrer,
70
- referrerPolicy: request.referrerPolicy
71
- };
72
- }
73
- function createEndpointFetch(descriptor) {
74
- const allowedOrigins = Array.from(/* @__PURE__ */ new Set([new URL(descriptor.restApiBaseUrl).origin, new URL(descriptor.gatewayBotUrl).origin]));
75
- return async (input, init, beforeRequest) => {
76
- const request = new Request(input, init);
77
- const target = new URL(request.url);
78
- assertEndpointHttpTarget(target, descriptor);
79
- const guarded = await fetchWithSsrFGuard({
80
- url: target.toString(),
81
- init: requestInitFromRequest(request, request.signal),
82
- signal: request.signal,
83
- requireHttps: target.protocol === "https:",
84
- policy: { allowedOrigins },
85
- maxRedirects: 0,
86
- capture: false,
87
- auditContext: "discord.endpoint-runtime",
88
- beforeRequest
89
- });
90
- try {
91
- const body = await readResponseWithLimit(guarded.response, DISCORD_ENDPOINT_RESPONSE_MAX_BYTES, { onOverflow: ({ size, maxBytes }) => /* @__PURE__ */ new Error(`Discord endpoint response too large: ${size} bytes (limit: ${maxBytes} bytes)`) });
92
- return new Response(body.byteLength > 0 ? new Uint8Array(body) : null, {
93
- status: guarded.response.status,
94
- statusText: guarded.response.statusText,
95
- headers: guarded.response.headers
96
- });
97
- } finally {
98
- await guarded.release();
99
- }
100
- };
101
- }
102
- /** Resolve the process-wide Discord API override using the same env convention as sibling channels. */
103
- function getDiscordEndpointRuntime(env = process.env) {
104
- const apiUrl = env[DISCORD_API_URL_ENV]?.trim();
105
- if (!apiUrl) return;
106
- const descriptor = resolveDescriptor(apiUrl);
107
- return Object.freeze({
108
- descriptor,
109
- fetch: createEndpointFetch(descriptor)
110
- });
111
- }
112
- function resolveDiscordEndpointMediaGuard(url, retainedRuntime) {
113
- const guard = resolveEndpointResourceGuard(url, "media", retainedRuntime);
114
- return guard ? {
115
- maxRedirects: guard.maxRedirects,
116
- ssrfPolicy: guard.policy
117
- } : void 0;
118
- }
119
- function resolveDiscordEndpointAttachmentGuard(url, retainedRuntime) {
120
- return resolveEndpointResourceGuard(url, "attachment upload", retainedRuntime);
121
- }
122
- function resolveEndpointResourceGuard(url, kind, retainedRuntime) {
123
- if (retainedRuntime === null) return;
124
- const runtime = retainedRuntime ?? getDiscordEndpointRuntime();
125
- if (!runtime) return;
126
- const target = parseHttpAnchor(url, `Discord endpoint ${kind} URL`);
127
- const restOrigin = new URL(runtime.descriptor.restApiBaseUrl).origin;
128
- if (target.origin !== restOrigin) throw new Error(`Discord endpoint ${kind} URL is outside the configured REST origin`);
129
- return {
130
- maxRedirects: 0,
131
- policy: {
132
- allowedOrigins: [restOrigin],
133
- hostnameAllowlist: [target.hostname]
134
- },
135
- requireHttps: target.protocol === "https:"
136
- };
137
- }
138
- function assertDiscordEndpointGatewayUrl(url, gatewayOrigin) {
139
- if (!gatewayOrigin) return;
140
- let parsed;
141
- try {
142
- parsed = new URL(url);
143
- } catch {
144
- throw new Error("Discord endpoint returned an invalid Gateway WebSocket URL");
145
- }
146
- if (parsed.origin !== gatewayOrigin || parsed.username || parsed.password || parsed.hash) throw new Error("Discord endpoint Gateway URL is outside the configured WebSocket origin");
147
- }
148
- //#endregion
149
- //#region extensions/discord/src/retry-after.ts
10
+ // extensions/discord/src/retry-after.ts
150
11
  const RETRY_AFTER_BODY_SECONDS_RE = /^(?:\d+\.?\d*|\.\d+)$/;
151
12
  const MAX_SAFE_RETRY_AFTER_SECONDS = Number.MAX_SAFE_INTEGER / 1e3;
152
13
  function parseDiscordRetryAfterBodySeconds(value) {
@@ -156,14 +17,7 @@ function parseDiscordRetryAfterBodySeconds(value) {
156
17
  max: MAX_SAFE_RETRY_AFTER_SECONDS
157
18
  });
158
19
  }
159
- //#endregion
160
- //#region extensions/discord/src/monitor/format.ts
161
- function resolveDiscordSystemLocation(params) {
162
- const { isDirectMessage, isGroupDm, guild, channelName } = params;
163
- if (isDirectMessage) return "DM";
164
- if (isGroupDm) return `Group DM #${channelName}`;
165
- return guild?.name ? `${guild.name} #${channelName}` : `#${channelName}`;
166
- }
20
+ // extensions/discord/src/monitor/format.ts
167
21
  function formatDiscordReactionEmoji(emoji) {
168
22
  if (emoji.id && emoji.name) return `<:${emoji.name}:${emoji.id}>`;
169
23
  if (emoji.id) return `emoji:${emoji.id}`;
@@ -174,11 +28,7 @@ function formatDiscordUserTag(user) {
174
28
  if (discriminator && discriminator !== "0") return `${user.username}#${discriminator}`;
175
29
  return user.username ?? user.id;
176
30
  }
177
- function resolveTimestampMs(timestamp) {
178
- return parseDateStringTimestampMs(timestamp);
179
- }
180
- //#endregion
181
- //#region extensions/discord/src/monitor/allow-list.ts
31
+ // extensions/discord/src/monitor/allow-list.ts
182
32
  const DISCORD_OWNER_ALLOWLIST_PREFIXES = [
183
33
  "discord:",
184
34
  "user:",
@@ -441,10 +291,9 @@ function resolveGroupDmAllow(params) {
441
291
  function shouldEmitDiscordReactionNotification(params) {
442
292
  const mode = params.mode ?? "own";
443
293
  if (mode === "off") return false;
444
- const accessGuildInfo = params.guildInfo ?? (params.allowlist ? { users: params.allowlist } : null);
445
294
  const { hasAccessRestrictions, memberAllowed } = resolveDiscordMemberAccessState({
446
295
  channelConfig: params.channelConfig,
447
- guildInfo: accessGuildInfo,
296
+ guildInfo: params.guildInfo,
448
297
  memberRoleIds: params.memberRoleIds ?? [],
449
298
  sender: {
450
299
  id: params.userId,
@@ -459,5 +308,4 @@ function shouldEmitDiscordReactionNotification(params) {
459
308
  if (mode === "own") return Boolean(params.botId && params.messageAuthorId === params.botId);
460
309
  return false;
461
310
  }
462
- //#endregion
463
- export { isDiscordThreadChannelType as A, resolveDiscordSystemLocation as C, getDiscordEndpointRuntime as D, assertDiscordEndpointGatewayUrl as E, resolveDiscordEndpointAttachmentGuard as O, formatDiscordUserTag as S, parseDiscordRetryAfterBodySeconds as T, resolveDiscordOwnerAllowFrom as _, normalizeDiscordDisplaySlug as a, shouldEmitDiscordReactionNotification as b, resolveDiscordChannelConfig as c, resolveDiscordCommandAuthorized as d, resolveDiscordGuildEntry as f, resolveDiscordOwnerAccess as g, resolveDiscordMentionPolicy as h, normalizeDiscordAllowList as i, resolveDiscordEndpointMediaGuard as k, resolveDiscordChannelConfigWithFallback as l, resolveDiscordMemberAllowed as m, hasConfiguredDiscordChannels as n, normalizeDiscordSlug as o, resolveDiscordMemberAccessState as p, isDiscordGroupAllowedByPolicy as r, resolveDiscordAllowListMatch as s, allowListMatches as t, resolveDiscordChannelPolicyCommandAuthorizer as u, resolveDiscordShouldRequireMention as v, resolveTimestampMs as w, formatDiscordReactionEmoji as x, resolveGroupDmAllow as y };
311
+ export { parseDiscordRetryAfterBodySeconds as C, formatDiscordUserTag as S, resolveDiscordOwnerAllowFrom as _, normalizeDiscordDisplaySlug as a, shouldEmitDiscordReactionNotification as b, resolveDiscordChannelConfig as c, resolveDiscordCommandAuthorized as d, resolveDiscordGuildEntry as f, resolveDiscordOwnerAccess as g, resolveDiscordMentionPolicy as h, normalizeDiscordAllowList as i, resolveDiscordChannelConfigWithFallback as l, resolveDiscordMemberAllowed as m, hasConfiguredDiscordChannels as n, normalizeDiscordSlug as o, resolveDiscordMemberAccessState as p, isDiscordGroupAllowedByPolicy as r, resolveDiscordAllowListMatch as s, allowListMatches as t, resolveDiscordChannelPolicyCommandAuthorizer as u, resolveDiscordShouldRequireMention as v, isDiscordThreadChannelType as w, formatDiscordReactionEmoji as x, resolveGroupDmAllow as y };
@@ -1,4 +1,5 @@
1
- import { D as getDiscordEndpointRuntime, T as parseDiscordRetryAfterBodySeconds } from "./allow-list-B_ToXtew.mjs";
1
+ import { C as parseDiscordRetryAfterBodySeconds } from "./allow-list-DahA0Jxh.mjs";
2
+ import { n as getDiscordEndpointRuntime } from "./endpoint-runtime-BM3x-m6O.mjs";
2
3
  import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
3
4
  import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
4
5
  import { captureChannelReadAuthority, captureEffectAuthority, resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
@@ -7,7 +8,7 @@ import { redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
7
8
  import { parseRetryAfterHeaderSeconds, resolveRetryConfig, retryAsync } from "openclaw/plugin-sdk/retry-runtime";
8
9
  import { readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
9
10
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
10
- //#region extensions/discord/src/error-body.ts
11
+ // extensions/discord/src/error-body.ts
11
12
  const DISCORD_RESPONSE_BODY_SUMMARY_MAX_CHARS = 240;
12
13
  function parseDiscordHttpErrorBody(raw) {
13
14
  if (!raw) return;
@@ -28,8 +29,7 @@ function isDiscordHtmlResponseBody(body, contentType) {
28
29
  function isDiscordRateLimitResponseBody(body) {
29
30
  return /error 1015|cloudflare|rate limit/i.test(body);
30
31
  }
31
- //#endregion
32
- //#region extensions/discord/src/api.ts
32
+ // extensions/discord/src/api.ts
33
33
  const DISCORD_API_BASE = "https://discord.com/api/v10";
34
34
  const DISCORD_API_RETRY_DEFAULTS = {
35
35
  attempts: 3,
@@ -50,22 +50,9 @@ function parseDiscordApiErrorPayload(text) {
50
50
  return null;
51
51
  }
52
52
  }
53
- function parseRetryAfterSeconds(text, response) {
54
- const payload = parseDiscordApiErrorPayload(text);
55
- const retryAfter = parseDiscordRetryAfterBodySeconds(payload?.retry_after);
56
- if (retryAfter !== void 0) return retryAfter;
57
- const header = response.headers.get("Retry-After");
58
- return header ? parseRetryAfterHeaderSeconds(header) : void 0;
59
- }
60
- function formatRetryAfterSeconds(raw) {
61
- const value = parseDiscordRetryAfterBodySeconds(raw);
62
- if (value === void 0) return;
63
- return `${value < 10 ? value.toFixed(1) : Math.round(value).toString()}s`;
64
- }
65
- function formatDiscordApiErrorTextUntrusted(text, response) {
53
+ function formatDiscordApiErrorTextUntrusted(text, response, payload, retryAfter) {
66
54
  const trimmed = text.trim();
67
55
  if (!trimmed) return;
68
- const payload = parseDiscordApiErrorPayload(trimmed);
69
56
  if (!payload) {
70
57
  if (trimmed.startsWith("{") && trimmed.endsWith("}")) return "unknown error";
71
58
  const summary = summarizeDiscordResponseBody(trimmed);
@@ -76,8 +63,8 @@ function formatDiscordApiErrorTextUntrusted(text, response) {
76
63
  return summary;
77
64
  }
78
65
  const message = typeof payload.message === "string" && payload.message.trim() ? payload.message.trim() : "unknown error";
79
- const retryAfter = formatRetryAfterSeconds(payload.retry_after);
80
- return retryAfter ? `${message} (retry after ${retryAfter})` : message;
66
+ if (retryAfter === void 0) return message;
67
+ return `${message} (retry after ${retryAfter < 10 ? retryAfter.toFixed(1) : Math.round(retryAfter).toString()}s)`;
81
68
  }
82
69
  var DiscordApiError = class extends Error {
83
70
  constructor(message, status, retryAfter) {
@@ -98,7 +85,7 @@ function createDiscordRequestSignal(options) {
98
85
  };
99
86
  const controller = new AbortController();
100
87
  const timeout = setTimeout(() => controller.abort(), resolveTimerTimeoutMs(options.timeoutMs, 1));
101
- timeout.unref?.();
88
+ timeout.unref();
102
89
  return {
103
90
  signal: options.signal ? AbortSignal.any([options.signal, controller.signal]) : controller.signal,
104
91
  cleanup: () => clearTimeout(timeout)
@@ -130,10 +117,12 @@ async function requestDiscord(path, token, options) {
130
117
  const res = endpoint ? await effect.run(request) : await effect.initiate(request);
131
118
  if (!res.ok) {
132
119
  const text = await readResponseTextLimited(res, DISCORD_API_ERROR_BODY_LIMIT_BYTES).catch(() => "");
133
- const untrustedDetail = formatDiscordApiErrorTextUntrusted(text, res);
120
+ const errorPayload = parseDiscordApiErrorPayload(text);
121
+ const bodyRetryAfter = parseDiscordRetryAfterBodySeconds(errorPayload?.retry_after);
122
+ const untrustedDetail = formatDiscordApiErrorTextUntrusted(text, res, errorPayload, bodyRetryAfter);
134
123
  const detail = untrustedDetail ? redactToolPayloadText(untrustedDetail) : untrustedDetail;
135
124
  const suffix = detail ? `: ${detail}` : "";
136
- const retryAfter = res.status === 429 ? parseRetryAfterSeconds(text, res) ?? DISCORD_API_429_FALLBACK_RETRY_AFTER_SECONDS : void 0;
125
+ const retryAfter = res.status === 429 ? bodyRetryAfter ?? parseRetryAfterHeaderSeconds(res.headers.get("Retry-After")) ?? DISCORD_API_429_FALLBACK_RETRY_AFTER_SECONDS : void 0;
137
126
  throw new DiscordApiError(`Discord API ${path} failed (${res.status})${suffix}`, res.status, retryAfter);
138
127
  }
139
128
  const responseBody = await readResponseWithLimit(res, DISCORD_API_RESPONSE_BODY_LIMIT_BYTES, { onOverflow: ({ size, maxBytes }) => /* @__PURE__ */ new Error(`Discord API ${path} response body too large: ${size} bytes (limit: ${maxBytes} bytes)`) });
@@ -162,5 +151,4 @@ async function fetchDiscord(path, token, fetcher = fetch, options) {
162
151
  method: "GET"
163
152
  });
164
153
  }
165
- //#endregion
166
154
  export { isDiscordRateLimitResponseBody as a, requestDiscord as i, DiscordApiError as n, parseDiscordHttpErrorBody as o, fetchDiscord as r, summarizeDiscordResponseBody as s, DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS as t };
@@ -1,16 +1,17 @@
1
- import { D as createDiscordMessageNonce, N as createDiscordClient } from "./send.shared-C2J1g_uJ.mjs";
2
- import { D as Row, ct as createChannelMessage, dt as editChannelMessage, j as TextDisplay, k as Separator, q as serializePayload, rt as createUserDmChannel, ut as deleteChannelMessage, x as Container, xt as stripUndefinedFields, y as Button } from "./discord-Cl2OPTZ6.mjs";
3
- import { y as findGraphemeChunkEnd } from "./send.receipt-DkwJ1h9E.mjs";
4
- import { s as buildExecApprovalCustomId } from "./components-C_cuoW1q.mjs";
5
- import { A as isDiscordExecApprovalClientEnabled, c as formatDiscordApprovalDisplayValue, s as DISCORD_APPROVAL_ALLOWED_MENTIONS } from "./outbound-session-route-D-qWvLfS.mjs";
6
- import { a as shouldHandleDiscordApprovalRequest } from "./channel-D2pO9g6n.mjs";
7
- import { t as discordApprovalMessageUpdates } from "./approval-message-updates-wbUqLtLI.mjs";
1
+ import { D as createDiscordMessageNonce, M as createDiscordClient } from "./send.shared-BcLLZBul.mjs";
2
+ import { D as editChannelMessage, E as deleteChannelMessage, J as stripUndefinedFields, f as serializePayload, w as createChannelMessage, y as createUserDmChannel } from "./discord-r79VFjJp.mjs";
3
+ import { y as findGraphemeChunkEnd } from "./send.receipt-CMteCIZS.mjs";
4
+ import { r as colorToNumber } from "./components.base-C5sAPHe4.mjs";
5
+ import { a as DISCORD_APPROVAL_DECISIONS, o as buildExecApprovalCustomId } from "./shared-interactive-DKBw4SNV.mjs";
6
+ import { c as formatDiscordApprovalDisplayValue, k as isDiscordExecApprovalClientEnabled, s as DISCORD_APPROVAL_ALLOWED_MENTIONS } from "./outbound-session-route-Cb8cv4Oi.mjs";
7
+ import { r as shouldHandleDiscordApprovalRequest } from "./channel-Ds6iuNdy.mjs";
8
+ import { t as discordApprovalMessageUpdates } from "./approval-message-updates-DqOXxPss.mjs";
8
9
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
9
- import { ButtonStyle } from "discord-api-types/v10";
10
+ import { ButtonStyle, ComponentType } from "discord-api-types/v10";
10
11
  import { logDebug, logError } from "openclaw/plugin-sdk/logging-core";
11
- import { createChannelApprovalNativeRuntimeAdapterAsync } from "openclaw/plugin-sdk/approval-handler-runtime";
12
12
  import { formatChannelApprovalResolvedLabel } from "openclaw/plugin-sdk/approval-runtime";
13
- //#region extensions/discord/src/approval-handler.runtime.ts
13
+ import { createChannelApprovalNativeRuntimeAdapterAsync } from "openclaw/plugin-sdk/approval-handler-runtime";
14
+ // extensions/discord/src/approval-handler.runtime.ts
14
15
  function resolveHandlerContext(params) {
15
16
  const context = params.context;
16
17
  const accountId = normalizeOptionalString(params.accountId) ?? "";
@@ -20,14 +21,14 @@ function resolveHandlerContext(params) {
20
21
  context
21
22
  };
22
23
  }
23
- var ExecApprovalActionButton = class extends Button {
24
- constructor(view, descriptor) {
25
- super();
26
- this.customId = buildExecApprovalCustomId(view.approvalId, view.approvalKind, descriptor.decision);
27
- this.label = descriptor.label;
28
- this.style = descriptor.style === "success" ? ButtonStyle.Success : descriptor.style === "primary" ? ButtonStyle.Primary : descriptor.style === "danger" ? ButtonStyle.Danger : ButtonStyle.Secondary;
29
- }
30
- };
24
+ function createApprovalActionButton(view, descriptor) {
25
+ return {
26
+ type: ComponentType.Button,
27
+ custom_id: buildExecApprovalCustomId(view.approvalId, view.approvalKind, descriptor.decision),
28
+ label: descriptor.label,
29
+ style: descriptor.style === "success" ? ButtonStyle.Success : descriptor.style === "primary" ? ButtonStyle.Primary : descriptor.style === "danger" ? ButtonStyle.Danger : ButtonStyle.Secondary
30
+ };
31
+ }
31
32
  function buildExecApprovalPayload(container) {
32
33
  return {
33
34
  components: [container],
@@ -46,49 +47,56 @@ function createApprovalContainer(view) {
46
47
  const commandPreview = formatCommandPreview(plugin ? view.title : view.commandText, plugin ? 700 : pending ? 1e3 : 500);
47
48
  const secondaryText = plugin ? view.description : view.commandPreview;
48
49
  const commandSecondaryPreview = secondaryText ? formatCommandPreview(secondaryText, plugin ? 1e3 : pending ? 500 : 300) : null;
49
- const decisionLabel = view.phase === "resolved" ? formatChannelApprovalResolvedLabel(view, (decision) => decision === "allow-once" ? "Allowed (once)" : decision === "allow-always" ? "Allowed (always)" : "Denied") : void 0;
50
+ const decisionLabel = view.phase === "resolved" ? formatChannelApprovalResolvedLabel(view, (decision) => DISCORD_APPROVAL_DECISIONS[decision].label) : void 0;
50
51
  const title = pending ? `${approvalLabel} Approval Required` : `${approvalLabel} Approval: ${view.phase === "expired" ? "Expired" : decisionLabel}`;
51
52
  const description = pending ? plugin ? "A plugin action needs your approval." : systemAgent ? "An OpenClaw change needs your approval." : "A command needs your approval." : view.phase === "expired" ? "This approval request has expired." : view.resolvedBy ? `Resolved by ${formatDiscordApprovalDisplayValue(view.resolvedBy)}` : "Resolved";
52
- const accentColor = view.phase === "expired" ? "#99AAB5" : view.phase === "resolved" ? view.decision === "deny" ? "#ED4245" : view.decision === "allow-always" ? "#5865F2" : "#57F287" : plugin ? view.severity === "critical" ? "#ED4245" : view.severity === "info" ? "#5865F2" : "#FAA61A" : "#FFA500";
53
+ const accentColor = view.phase === "expired" ? "#99AAB5" : view.phase === "resolved" ? DISCORD_APPROVAL_DECISIONS[view.decision].color : plugin ? view.severity === "critical" ? "#ED4245" : view.severity === "info" ? "#5865F2" : "#FAA61A" : "#FFA500";
53
54
  const approvalId = formatDiscordApprovalDisplayValue(view.approvalId);
54
55
  const footer = pending ? `Expires <t:${Math.max(0, Math.floor(view.expiresAtMs / 1e3))}:R> · ID: ${approvalId}` : `ID: ${approvalId}`;
55
56
  const components = [
56
- new TextDisplay(`## ${title}`),
57
- new TextDisplay(description),
58
- new Separator({
57
+ {
58
+ type: ComponentType.TextDisplay,
59
+ content: `## ${title}`
60
+ },
61
+ {
62
+ type: ComponentType.TextDisplay,
63
+ content: description
64
+ },
65
+ {
66
+ type: ComponentType.Separator,
59
67
  divider: true,
60
- spacing: "small"
61
- }),
62
- new TextDisplay(`### ${systemAgent ? "Change" : "Command"}\n\`\`\`\n${commandPreview}\n\`\`\``)
68
+ spacing: 1
69
+ },
70
+ {
71
+ type: ComponentType.TextDisplay,
72
+ content: `### ${systemAgent ? "Change" : "Command"}\n\`\`\`\n${commandPreview}\n\`\`\``
73
+ }
63
74
  ];
64
- if (commandSecondaryPreview) components.push(new TextDisplay(`### Shell Preview\n\`\`\`\n${commandSecondaryPreview}\n\`\`\``));
65
- if (view.metadata.length) components.push(new TextDisplay(view.metadata.map((item) => `- ${item.label}: ${item.value}`).join("\n")));
66
- if (pending) components.push(new Row(view.actions.map((descriptor) => new ExecApprovalActionButton(view, descriptor))));
67
- components.push(new Separator({
75
+ if (commandSecondaryPreview) components.push({
76
+ type: ComponentType.TextDisplay,
77
+ content: `### Shell Preview\n\`\`\`\n${commandSecondaryPreview}\n\`\`\``
78
+ });
79
+ if (view.metadata.length) components.push({
80
+ type: ComponentType.TextDisplay,
81
+ content: view.metadata.map((item) => `- ${item.label}: ${item.value}`).join("\n")
82
+ });
83
+ if (pending) components.push({
84
+ type: ComponentType.ActionRow,
85
+ components: view.actions.map((descriptor) => createApprovalActionButton(view, descriptor))
86
+ });
87
+ components.push({
88
+ type: ComponentType.Separator,
68
89
  divider: false,
69
- spacing: "small"
70
- }), new TextDisplay(`-# ${footer}`));
71
- return new Container(components, { accentColor });
72
- }
73
- async function finalizeMessage(params) {
74
- const operations = params.cleanupAfterResolve ? ["delete", "update"] : ["update"];
75
- for (const operation of operations) try {
76
- const { rest, request: discordRequest } = createDiscordClient({
77
- cfg: params.cfg,
78
- token: params.token,
79
- accountId: params.accountId
80
- });
81
- let request;
82
- if (operation === "delete") request = () => deleteChannelMessage(rest, params.channelId, params.messageId);
83
- else {
84
- const payload = buildExecApprovalPayload(params.container);
85
- request = () => editChannelMessage(rest, params.channelId, params.messageId, { body: stripUndefinedFields(serializePayload(payload)) });
86
- }
87
- await discordApprovalMessageUpdates.enqueue(params.messageId, () => discordRequest(request, `${operation}-approval`));
88
- return;
89
- } catch (err) {
90
- logError(`discord approvals: failed to ${operation} message: ${String(err)}`);
91
- }
90
+ spacing: 1
91
+ }, {
92
+ type: ComponentType.TextDisplay,
93
+ content: `-# ${footer}`
94
+ });
95
+ return {
96
+ type: ComponentType.Container,
97
+ components,
98
+ accent_color: colorToNumber(accentColor)
99
+ };
92
100
  }
93
101
  function buildTerminalApprovalResult(params) {
94
102
  if (!resolveHandlerContext(params)) return { kind: "delete" };
@@ -205,15 +213,26 @@ const discordApprovalNativeRuntime = createChannelApprovalNativeRuntimeAdapterAs
205
213
  });
206
214
  if (!resolved) return;
207
215
  const container = payload;
208
- await finalizeMessage({
209
- cfg,
210
- accountId: resolved.accountId,
211
- token: resolved.context.token,
212
- cleanupAfterResolve: phase === "resolved" ? resolved.context.config.cleanupAfterResolve : false,
213
- channelId: entry.discordChannelId,
214
- messageId: entry.discordMessageId,
215
- container
216
- });
216
+ const { token } = resolved.context;
217
+ const { discordChannelId, discordMessageId } = entry;
218
+ const operations = phase === "resolved" && resolved.context.config.cleanupAfterResolve ? ["delete", "update"] : ["update"];
219
+ for (const operation of operations) try {
220
+ const { rest, request: discordRequest } = createDiscordClient({
221
+ cfg,
222
+ token,
223
+ accountId: resolved.accountId
224
+ });
225
+ let request;
226
+ if (operation === "delete") request = () => deleteChannelMessage(rest, discordChannelId, discordMessageId);
227
+ else {
228
+ const messagePayload = buildExecApprovalPayload(container);
229
+ request = () => editChannelMessage(rest, discordChannelId, discordMessageId, { body: stripUndefinedFields(serializePayload(messagePayload)) });
230
+ }
231
+ await discordApprovalMessageUpdates.enqueue(discordMessageId, () => discordRequest(request, `${operation}-approval`));
232
+ return;
233
+ } catch (err) {
234
+ logError(`discord approvals: failed to ${operation} message: ${String(err)}`);
235
+ }
217
236
  }
218
237
  },
219
238
  observe: {
@@ -236,5 +255,4 @@ const discordApprovalNativeRuntime = createChannelApprovalNativeRuntimeAdapterAs
236
255
  }
237
256
  }
238
257
  });
239
- //#endregion
240
258
  export { discordApprovalNativeRuntime };
@@ -1,7 +1,7 @@
1
- import { tt as parseCustomId } from "./discord-Cl2OPTZ6.mjs";
2
- import { c as parseExecApprovalData } from "./components-C_cuoW1q.mjs";
1
+ import { i as parseCustomId } from "./components.base-C5sAPHe4.mjs";
2
+ import { s as parseExecApprovalData } from "./shared-interactive-DKBw4SNV.mjs";
3
3
  import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
4
- //#region extensions/discord/src/approval-message-updates.ts
4
+ // extensions/discord/src/approval-message-updates.ts
5
5
  const discordApprovalMessageUpdates = new KeyedAsyncQueue();
6
6
  /** Read the current control identity, rather than reconstructing delivery ownership. */
7
7
  function hasDiscordApprovalControl(message, approval) {
@@ -13,5 +13,4 @@ function hasDiscordApprovalControl(message, approval) {
13
13
  }
14
14
  return "components" in message && Array.isArray(message.components) && message.components.some((component) => hasDiscordApprovalControl(component, approval));
15
15
  }
16
- //#endregion
17
16
  export { hasDiscordApprovalControl as n, discordApprovalMessageUpdates as t };
@@ -1,9 +1,9 @@
1
- import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
- import { t as inspectDiscordAccount } from "./account-inspect-8cCu6uPG.mjs";
3
- import { b as fetchChannelPermissionsDiscord } from "./send.shared-C2J1g_uJ.mjs";
4
- import "./send-Ca810XtV.mjs";
5
- import { E as collectDiscordAuditChannelIdsForAccount, T as auditDiscordChannelPermissionsWithFetcher } from "./outbound-session-route-D-qWvLfS.mjs";
6
- //#region extensions/discord/src/audit.ts
1
+ import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
2
+ import { t as inspectDiscordAccount } from "./account-inspect-CSz5Qodj.mjs";
3
+ import { b as fetchChannelPermissionsDiscord } from "./send.shared-BcLLZBul.mjs";
4
+ import "./send-DnLL6XoO.mjs";
5
+ import { T as collectDiscordAuditChannelIdsForAccount, w as auditDiscordChannelPermissionsWithFetcher } from "./outbound-session-route-Cb8cv4Oi.mjs";
6
+ // extensions/discord/src/audit.ts
7
7
  var audit_exports = /* @__PURE__ */ __exportAll({
8
8
  auditDiscordChannelPermissions: () => auditDiscordChannelPermissions,
9
9
  collectDiscordAuditChannelIds: () => collectDiscordAuditChannelIds
@@ -18,5 +18,4 @@ async function auditDiscordChannelPermissions(params) {
18
18
  fetchChannelPermissions: fetchChannelPermissionsDiscord
19
19
  });
20
20
  }
21
- //#endregion
22
21
  export { audit_exports as n, collectDiscordAuditChannelIds as r, auditDiscordChannelPermissions as t };