@openclaw/discord 2026.10.10 → 2026.11.5-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/dist/.setup/{account-inspect-X_Xlr42B.mjs → account-inspect-CSz5Qodj.mjs} +1 -1
  2. package/dist/.setup/{accounts-C18HNgge.mjs → accounts-DtjvhJUj.mjs} +9 -6
  3. package/dist/.setup/{active-turn-thread-route-BAc_Xik-.mjs → active-turn-thread-route-DkPnk2x8.mjs} +1 -2
  4. package/dist/.setup/{allow-list-D1ZGfhXh.mjs → allow-list-DahA0Jxh.mjs} +3 -150
  5. package/dist/.setup/{api-Bth1wKF9.mjs → api-Bp0HI4q3.mjs} +10 -20
  6. package/dist/.setup/{approval-handler.runtime-BAoEELJJ.mjs → approval-handler.runtime-Cy53ugTf.mjs} +80 -61
  7. package/dist/.setup/{approval-message-updates-Cks-MSCJ.mjs → approval-message-updates-DqOXxPss.mjs} +2 -2
  8. package/dist/.setup/{audit-Dw_rAZIz.mjs → audit-DoPKOfQE.mjs} +4 -4
  9. package/dist/.setup/{channel-BMpMAeQL.mjs → channel-Ds6iuNdy.mjs} +134 -201
  10. package/dist/.setup/channel-access-DhJhVrdZ.mjs +23 -0
  11. package/dist/.setup/channel.setup-BLt9dkIG.mjs +235 -0
  12. package/dist/.setup/{components-BvOWSPxr.mjs → components-WTfUxead.mjs} +208 -426
  13. package/dist/.setup/components.base-C5sAPHe4.mjs +31 -0
  14. package/dist/.setup/{config-schema-Coyq5wOr.mjs → config-schema-GX2yDgIH.mjs} +6 -7
  15. package/dist/.setup/{conversation-binding-route-DOPUZNYo.mjs → conversation-binding-route-CZdm-X5A.mjs} +2 -2
  16. package/dist/.setup/{directory-config-CIqVnQtn.mjs → directory-config-BXJuh9-J.mjs} +1 -1
  17. package/dist/.setup/{directory-live-DUuPEWub.mjs → directory-live-CEopeb8Q.mjs} +55 -62
  18. package/dist/.setup/{discord-eFlHX1Gn.mjs → discord-r79VFjJp.mjs} +1087 -1664
  19. package/dist/.setup/{doctor-Dty_Ossy.mjs → doctor-UfLW8nye.mjs} +3 -5
  20. package/dist/.setup/endpoint-runtime-BM3x-m6O.mjs +138 -0
  21. package/dist/.setup/guilds-DQucP5Tn.mjs +21 -0
  22. package/dist/.setup/{handle-action-DXY91jF-.mjs → handle-action-BarHOi-v.mjs} +15 -15
  23. package/dist/.setup/{handle-action.guild-admin-BvBCfhXF.mjs → handle-action.guild-admin-oRUb8p_O.mjs} +5 -5
  24. package/dist/.setup/listeners-CHgTENFu.mjs +46 -0
  25. package/dist/.setup/{live-policy-config-DO1Fk2hp.mjs → live-policy-config-EKp4O6zx.mjs} +2 -3
  26. package/dist/.setup/{message-handler-fL1j1NiR.mjs → message-handler-DUeT8Asf.mjs} +154 -113
  27. package/dist/.setup/{message-handler.preflight-DkjwNZAd.mjs → message-handler.preflight-C6TNtKW0.mjs} +30 -104
  28. package/dist/.setup/{message-handler.preflight-pluralkit-DR4BnvMU.mjs → message-handler.preflight-pluralkit-6E9TFmmN.mjs} +9 -22
  29. package/dist/.setup/{message-handler.process-ClOwIPDK.mjs → message-handler.process-D8_oQ5Cp.mjs} +256 -367
  30. package/dist/.setup/outbound-payload-DUsrFICb.mjs +445 -0
  31. package/dist/.setup/{outbound-session-route-TFBPPkoz.mjs → outbound-session-route-Cb8cv4Oi.mjs} +138 -86
  32. package/dist/.setup/{preflight-audio-CwtPIsvk.mjs → preflight-audio-r4BbaJxh.mjs} +1 -5
  33. package/dist/.setup/{presence-cache-CgutE4NN.mjs → presence-cache-B3xj3b0l.mjs} +1 -6
  34. package/dist/.setup/{probe-DNge7OEP.mjs → probe-BUmJyH35.mjs} +5 -9
  35. package/dist/.setup/{provider-BBDuE14w.mjs → provider-Dm2ERSxe.mjs} +3600 -4454
  36. package/dist/.setup/{provider-session.runtime-D8hMXXqJ.mjs → provider-session.runtime-DCIqDsIg.mjs} +3 -3
  37. package/dist/.setup/provider.runtime-DmxPGoUg.mjs +1 -0
  38. package/dist/.setup/proxy-fetch-B8cK6FLQ.mjs +29 -0
  39. package/dist/.setup/{realtime-session.runtime-cetognkp.mjs → realtime-session.runtime-WJL6NdwK.mjs} +43 -81
  40. package/dist/.setup/{receive-recovery-C77CVdGM.mjs → receive-recovery-DV_v5ROf.mjs} +13 -27
  41. package/dist/.setup/{resolve-allowlist-common-CI77288n.mjs → resolve-allowlist-common-C37fgnYG.mjs} +3 -12
  42. package/dist/.setup/{resolve-channels-DYc6-xgV.mjs → resolve-channels-CwpnQ7C2.mjs} +5 -4
  43. package/dist/.setup/{resolve-users-BQT7XWF2.mjs → resolve-users-D6jSwe8R.mjs} +4 -7
  44. package/dist/.setup/{runtime-CcijhTJT.mjs → runtime-B-PgPsGR.mjs} +6 -6
  45. package/dist/.setup/{runtime-CI0UJqeS.mjs → runtime-DhOMlnYS.mjs} +196 -235
  46. package/dist/.setup/{secret-config-contract-BdbCvqnM.mjs → secret-config-contract-CP6teHec.mjs} +4 -9
  47. package/dist/.setup/{send-Cbq-IVsS.mjs → send-DnLL6XoO.mjs} +149 -174
  48. package/dist/.setup/{send.components-BV6ucNpJ.mjs → send.components-xB43CksK.mjs} +61 -71
  49. package/dist/.setup/{send.outbound-CGhBhzjQ.mjs → send.outbound-B11X6TOE.mjs} +75 -129
  50. package/dist/.setup/{send.receipt-Dw-_r5Bx.mjs → send.receipt-CMteCIZS.mjs} +29 -31
  51. package/dist/.setup/{send.shared-D4MioxW_.mjs → send.shared-BcLLZBul.mjs} +38 -112
  52. package/dist/.setup/{sender-identity-DrN5c4ec.mjs → sender-identity-CGNpdJmb.mjs} +3 -9
  53. package/dist/.setup/setup-plugin-api-C6AMx3hu.mjs +2 -0
  54. package/dist/.setup/{shared-Bp0sxD5R.mjs → shared-BEYw16he.mjs} +8 -10
  55. package/dist/.setup/shared-interactive-DKBw4SNV.mjs +311 -0
  56. package/dist/.setup/{subagent-hooks-mQbDkvuD.mjs → subagent-hooks-DlYElpXa.mjs} +1 -1
  57. package/dist/.setup/{system-events-2zc2eGfF.mjs → system-events--Pk6y9aP.mjs} +2 -2
  58. package/dist/.setup/{target-resolver-CAHeVfmZ.mjs → target-resolver-Bo9EpGp_.mjs} +3 -3
  59. package/dist/.setup/{thread-bindings-Dg7X_ZXP.mjs → thread-bindings-BF-hr-bg.mjs} +12 -20
  60. package/dist/.setup/{thread-bindings.manager-DCDYksah.mjs → thread-bindings.manager-CQCkha5r.mjs} +22 -42
  61. package/dist/.setup/{thread-bindings.session-updates-C76plLS3.mjs → thread-bindings.session-updates-C2gJAj_I.mjs} +11 -18
  62. package/dist/.setup/{threading-l0UfrE6x.mjs → threading-HA9C2wYR.mjs} +68 -104
  63. package/dist/.setup/{timeouts-DTrUsJ_W.mjs → timeouts-CT9hnmo4.mjs} +1 -1
  64. package/dist/.setup/{transcripts-source-CGgOaWcu.mjs → transcripts-source-DzpzETZR.mjs} +102 -172
  65. package/dist/.setup/{voice-runtime-DY1EwDfi.mjs → voice-runtime-Bo_nsVvX.mjs} +231 -448
  66. package/dist/.source-module-urls/d6c089460280c5a04184542d6712e04545caeb1ebb290d3504377b4cc5e22fea.json +1 -1
  67. package/dist/account-inspect-api.js +1 -1
  68. package/dist/action-runtime-api.js +1 -1
  69. package/dist/activities-api.js +285 -337
  70. package/dist/api.js +16 -16
  71. package/dist/assets/embedded-app-sdk.mjs +1 -1
  72. package/dist/channel-config-api.js +1 -1
  73. package/dist/channel-plugin-api.js +1 -1
  74. package/dist/directory-contract-api.js +1 -1
  75. package/dist/runtime-api.js +22 -22
  76. package/dist/secret-contract-api.js +1 -1
  77. package/dist/setup-entry.js +1 -1
  78. package/dist/setup-plugin-api.js +1 -1
  79. package/dist/src/voice/audio-worker.runtime.js +56 -68
  80. package/dist/subagent-hooks-api.js +1 -1
  81. package/dist/transcripts-source-api.js +1 -1
  82. package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.cjs +2 -3
  83. package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.mjs +2 -3
  84. package/node_modules/@napi-rs/wasm-runtime/dist/fs.js +3339 -4021
  85. package/node_modules/@napi-rs/wasm-runtime/package.json +1 -1
  86. package/node_modules/@types/lodash/README.md +1 -1
  87. package/node_modules/@types/lodash/common/function.d.ts +2 -2
  88. package/node_modules/@types/lodash/package.json +2 -2
  89. package/node_modules/@types/node/README.md +1 -1
  90. package/node_modules/@types/node/package.json +2 -2
  91. package/node_modules/@types/node/util.d.ts +6 -3
  92. package/node_modules/discord-api-types/package.json +4 -4
  93. package/node_modules/discord-api-types/rest/v10/index.d.ts +8 -0
  94. package/node_modules/discord-api-types/rest/v10/index.d.ts.map +1 -1
  95. package/node_modules/discord-api-types/rest/v10/index.js +8 -0
  96. package/node_modules/discord-api-types/rest/v10/index.js.map +1 -1
  97. package/node_modules/discord-api-types/rest/v10/oauth2.d.ts +26 -2
  98. package/node_modules/discord-api-types/rest/v10/oauth2.d.ts.map +1 -1
  99. package/node_modules/discord-api-types/rest/v9/index.d.ts +8 -0
  100. package/node_modules/discord-api-types/rest/v9/index.d.ts.map +1 -1
  101. package/node_modules/discord-api-types/rest/v9/index.js +8 -0
  102. package/node_modules/discord-api-types/rest/v9/index.js.map +1 -1
  103. package/node_modules/discord-api-types/rest/v9/oauth2.d.ts +26 -2
  104. package/node_modules/discord-api-types/rest/v9/oauth2.d.ts.map +1 -1
  105. package/node_modules/typebox/build/format/duration.d.mts +2 -2
  106. package/node_modules/typebox/build/format/duration.mjs +2 -2
  107. package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
  108. package/node_modules/typebox/build/format/idn_email.mjs +1 -0
  109. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
  110. package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
  111. package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
  112. package/node_modules/typebox/build/format/ipv4.mjs +2 -2
  113. package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
  114. package/node_modules/typebox/build/format/ipv6.mjs +1 -1
  115. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  116. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  117. package/node_modules/typebox/build/schema/build.mjs +1 -0
  118. package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
  119. package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
  120. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
  121. package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
  122. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
  123. package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
  124. package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
  125. package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
  126. package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
  127. package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
  128. package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
  129. package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
  130. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
  131. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
  132. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
  133. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
  134. package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
  135. package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
  136. package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
  137. package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
  138. package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
  139. package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
  140. package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
  141. package/node_modules/typebox/build/system/memory/create.mjs +18 -13
  142. package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
  143. package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
  144. package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
  145. package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
  146. package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
  147. package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
  148. package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
  149. package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
  150. package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
  151. package/node_modules/typebox/build/system/memory/update.mjs +43 -16
  152. package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
  153. package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
  154. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
  155. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
  156. package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
  157. package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
  158. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
  159. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
  160. package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
  161. package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
  162. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
  163. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
  164. package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
  165. package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
  166. package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
  167. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  168. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
  169. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
  170. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
  171. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
  172. package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
  173. package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
  174. package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
  175. package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
  176. package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
  177. package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
  178. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
  179. package/node_modules/typebox/package.json +1 -1
  180. package/node_modules/typebox/readme.md +1 -1
  181. package/node_modules/undici/docs/docs/api/Interceptors.md +15 -2
  182. package/node_modules/undici/lib/dispatcher/client-h2.js +78 -3
  183. package/node_modules/undici/lib/dispatcher/pool-base.js +20 -3
  184. package/node_modules/undici/package.json +3 -3
  185. package/node_modules/undici/types/api.d.ts +1 -1
  186. package/node_modules/undici/types/utility.d.ts +4 -4
  187. package/node_modules/uuid/package.json +17 -17
  188. package/node_modules/zod/package.json +1 -1
  189. package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
  190. package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
  191. package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
  192. package/node_modules/zod/src/v4/core/compile.ts +9 -0
  193. package/node_modules/zod/src/v4/core/schemas.ts +35 -1
  194. package/node_modules/zod/src/v4/core/util.ts +13 -0
  195. package/node_modules/zod/src/v4/core/versions.ts +1 -1
  196. package/node_modules/zod/v4/core/compile.cjs +8 -0
  197. package/node_modules/zod/v4/core/compile.js +8 -0
  198. package/node_modules/zod/v4/core/schemas.cjs +30 -0
  199. package/node_modules/zod/v4/core/schemas.d.cts +3 -1
  200. package/node_modules/zod/v4/core/schemas.d.ts +3 -1
  201. package/node_modules/zod/v4/core/schemas.js +30 -0
  202. package/node_modules/zod/v4/core/util.cjs +15 -0
  203. package/node_modules/zod/v4/core/util.d.cts +2 -0
  204. package/node_modules/zod/v4/core/util.d.ts +2 -0
  205. package/node_modules/zod/v4/core/util.js +14 -0
  206. package/node_modules/zod/v4/core/versions.cjs +1 -1
  207. package/node_modules/zod/v4/core/versions.js +1 -1
  208. package/openclaw.plugin.json +1 -31
  209. package/package.json +8 -8
  210. package/dist/.setup/channel-access-BPrWoEXM.mjs +0 -47
  211. package/dist/.setup/channel.setup-DVe7Y3Jf.mjs +0 -245
  212. package/dist/.setup/outbound-adapter-DWyAWBFh.mjs +0 -537
  213. package/dist/.setup/provider.runtime-BQ1z4Aq1.mjs +0 -1
  214. package/dist/.setup/setup-plugin-api-B4J6wmL1.mjs +0 -2
  215. package/dist/.setup/targets-BaklhOqq.mjs +0 -3
  216. package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
  217. package/node_modules/typebox/build/system/memory/freeze.mjs +0 -6
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
2
- import { d as unbindThreadBindingsBySessionKeyAsync, o as listThreadBindingsBySessionKey, s as listThreadBindingsBySessionKeyAsync } from "./thread-bindings-Dg7X_ZXP.mjs";
2
+ import { d as unbindThreadBindingsBySessionKeyAsync, o as listThreadBindingsBySessionKey, s as listThreadBindingsBySessionKeyAsync } from "./thread-bindings-BF-hr-bg.mjs";
3
3
  import { normalizeOptionalLowercaseString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  import { warnPluginSdkDeprecation } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
5
5
  // extensions/discord/src/subagent-hooks.ts
@@ -1,5 +1,5 @@
1
- import { S as formatDiscordUserTag } from "./allow-list-D1ZGfhXh.mjs";
2
- import { t as discord_exports } from "./discord-eFlHX1Gn.mjs";
1
+ import { t as discord_exports } from "./discord-r79VFjJp.mjs";
2
+ import { S as formatDiscordUserTag } from "./allow-list-DahA0Jxh.mjs";
3
3
  // extensions/discord/src/monitor/system-events.ts
4
4
  const SYSTEM_EVENT_ACTIONS = /* @__PURE__ */ new Map([
5
5
  [discord_exports.MessageType.ChannelPinnedMessage, "pinned a message"],
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
2
- import { l as resolveDiscordAccount, u as resolveDiscordAccountAllowFrom } from "./accounts-C18HNgge.mjs";
3
- import { c as allowFromContainsDiscordUserId } from "./send.receipt-Dw-_r5Bx.mjs";
4
- import { o as rememberDiscordDirectoryUser, r as listDiscordDirectoryPeersLive } from "./directory-live-DUuPEWub.mjs";
2
+ import { l as resolveDiscordAccount, u as resolveDiscordAccountAllowFrom } from "./accounts-DtjvhJUj.mjs";
3
+ import { a as allowFromContainsDiscordUserId } from "./send.receipt-CMteCIZS.mjs";
4
+ import { o as rememberDiscordDirectoryUser, r as listDiscordDirectoryPeersLive } from "./directory-live-CEopeb8Q.mjs";
5
5
  import { t as parseDiscordTarget } from "./target-parsing-BiuhcK9Q.mjs";
6
6
  import { buildMessagingTarget } from "openclaw/plugin-sdk/channel-targets";
7
7
  // extensions/discord/src/target-resolver.ts
@@ -1,31 +1,23 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
2
2
  import { t as parseDiscordTarget } from "./target-parsing-BiuhcK9Q.mjs";
3
- import "./targets-BaklhOqq.mjs";
4
- import { D as refreshUnboundThreadWebhookIdentity, F as resolveThreadBindingMaxAgeExpiresAt, I as resolveThreadBindingMaxAgeMs$1, N as resolveThreadBindingIdleTimeoutMs$1, P as resolveThreadBindingInactivityExpiresAt, S as ensureBindingsLoadedAsync, _ as MANAGERS_BY_ACCOUNT_ID, a as mutateBindingsForTargetSession, g as BINDINGS_BY_THREAD_ID, i as setThreadBindingMaxAgeBySessionKeyAsync, n as setThreadBindingIdleTimeoutBySessionKeyAsync, o as resolveBindingIdsForTargetSession, r as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey, u as removeBindingRecordSync, w as getThreadBindingToken, x as ensureBindingsLoaded } from "./thread-bindings.session-updates-C76plLS3.mjs";
5
- import { c as resolveThreadBindingPersonaFromRecord, i as createNoopThreadBindingManager, n as getThreadBindingManager, o as resolveChannelIdForBinding, s as resolveThreadBindingPersona, t as createThreadBindingManager } from "./thread-bindings.manager-DCDYksah.mjs";
6
- import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
3
+ import { D as refreshUnboundThreadWebhookIdentity, F as resolveThreadBindingMaxAgeMs, M as resolveThreadBindingIdleTimeoutMs, N as resolveThreadBindingInactivityExpiresAt, P as resolveThreadBindingMaxAgeExpiresAt, S as ensureBindingsLoadedAsync, _ as MANAGERS_BY_ACCOUNT_ID, a as mutateBindingsForTargetSession, g as BINDINGS_BY_THREAD_ID, i as setThreadBindingMaxAgeBySessionKeyAsync, n as setThreadBindingIdleTimeoutBySessionKeyAsync, o as resolveBindingIdsForTargetSession, r as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey, u as removeBindingRecordSync, w as getThreadBindingToken, x as ensureBindingsLoaded } from "./thread-bindings.session-updates-C2gJAj_I.mjs";
4
+ import { c as resolveThreadBindingPersonaFromRecord, i as createNoopThreadBindingManager, n as getThreadBindingManager, o as resolveChannelIdForBinding, s as resolveThreadBindingPersona, t as createThreadBindingManager } from "./thread-bindings.manager-CQCkha5r.mjs";
7
5
  import { normalizeOptionalLowercaseString, normalizeOptionalString, normalizeOptionalStringifiedId, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
8
- import { formatThreadBindingDurationLabel as formatThreadBindingDurationLabel$1, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingIntroText, resolveThreadBindingIntroText as resolveThreadBindingIntroText$1, resolveThreadBindingMaxAgeMs, resolveThreadBindingThreadName, resolveThreadBindingThreadName as resolveThreadBindingThreadName$1, resolveThreadBindingsEnabled } from "openclaw/plugin-sdk/conversation-runtime";
6
+ import { runTasksWithConcurrency } from "openclaw/plugin-sdk/concurrency-runtime";
7
+ import { formatThreadBindingDurationLabel as formatThreadBindingDurationLabel$1, resolveThreadBindingIdleTimeoutMsForChannel, resolveThreadBindingIntroText, resolveThreadBindingIntroText as resolveThreadBindingIntroText$1, resolveThreadBindingMaxAgeMsForChannel, resolveThreadBindingThreadName, resolveThreadBindingThreadName as resolveThreadBindingThreadName$1, resolveThreadBindingsEnabled } from "openclaw/plugin-sdk/conversation-runtime";
9
8
  import { warnPluginSdkDeprecation } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
10
9
  import { prepareAcpSessionEntryRead, readAcpSessionEntryAsync, rethrowIncognitoSessionError } from "openclaw/plugin-sdk/acp-runtime";
11
- import { runTasksWithConcurrency } from "openclaw/plugin-sdk/concurrency-runtime";
12
10
  // extensions/discord/src/monitor/thread-bindings.config.ts
13
11
  function resolveDiscordThreadBindingIdleTimeoutMs(params) {
14
- const accountId = normalizeAccountId(params.accountId);
15
- const root = params.cfg.channels?.discord?.threadBindings;
16
- const account = params.cfg.channels?.discord?.accounts?.[accountId]?.threadBindings;
17
- return resolveThreadBindingIdleTimeoutMs({
18
- channelIdleHoursRaw: account?.idleHours ?? root?.idleHours,
19
- sessionIdleHoursRaw: params.cfg.session?.threadBindings?.idleHours
12
+ return resolveThreadBindingIdleTimeoutMsForChannel({
13
+ ...params,
14
+ channel: "discord"
20
15
  });
21
16
  }
22
17
  function resolveDiscordThreadBindingMaxAgeMs(params) {
23
- const accountId = normalizeAccountId(params.accountId);
24
- const root = params.cfg.channels?.discord?.threadBindings;
25
- const account = params.cfg.channels?.discord?.accounts?.[accountId]?.threadBindings;
26
- return resolveThreadBindingMaxAgeMs({
27
- channelMaxAgeHoursRaw: account?.maxAgeHours ?? root?.maxAgeHours,
28
- sessionMaxAgeHoursRaw: params.cfg.session?.threadBindings?.maxAgeHours
18
+ return resolveThreadBindingMaxAgeMsForChannel({
19
+ ...params,
20
+ channel: "discord"
29
21
  });
30
22
  }
31
23
  // extensions/discord/src/monitor/thread-bindings.lifecycle.ts
@@ -245,11 +237,11 @@ var thread_bindings_exports = /* @__PURE__ */ __exportAll({
245
237
  reconcileAcpThreadBindingsOnStartup: () => reconcileAcpThreadBindingsOnStartup,
246
238
  resolveDiscordThreadBindingIdleTimeoutMs: () => resolveDiscordThreadBindingIdleTimeoutMs,
247
239
  resolveDiscordThreadBindingMaxAgeMs: () => resolveDiscordThreadBindingMaxAgeMs,
248
- resolveThreadBindingIdleTimeoutMs: () => resolveThreadBindingIdleTimeoutMs$1,
240
+ resolveThreadBindingIdleTimeoutMs: () => resolveThreadBindingIdleTimeoutMs,
249
241
  resolveThreadBindingInactivityExpiresAt: () => resolveThreadBindingInactivityExpiresAt,
250
242
  resolveThreadBindingIntroText: () => resolveThreadBindingIntroText$1,
251
243
  resolveThreadBindingMaxAgeExpiresAt: () => resolveThreadBindingMaxAgeExpiresAt,
252
- resolveThreadBindingMaxAgeMs: () => resolveThreadBindingMaxAgeMs$1,
244
+ resolveThreadBindingMaxAgeMs: () => resolveThreadBindingMaxAgeMs,
253
245
  resolveThreadBindingPersona: () => resolveThreadBindingPersona,
254
246
  resolveThreadBindingPersonaFromRecord: () => resolveThreadBindingPersonaFromRecord,
255
247
  resolveThreadBindingThreadName: () => resolveThreadBindingThreadName$1,
@@ -1,18 +1,18 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
2
- import { A as isDiscordThreadChannelType } from "./allow-list-D1ZGfhXh.mjs";
3
- import { P as createDiscordRestClient } from "./send.shared-D4MioxW_.mjs";
4
- import { G as withDiscordRequestAuthority, ft as getChannel, nt as createChannelWebhook } from "./discord-eFlHX1Gn.mjs";
5
- import { p as canFallbackDiscordWebhookSend } from "./send.receipt-Dw-_r5Bx.mjs";
2
+ import { N as createDiscordRestClient } from "./send.shared-BcLLZBul.mjs";
3
+ import { O as getChannel, q as withDiscordRequestAuthority, t as discord_exports, z as DiscordError } from "./discord-r79VFjJp.mjs";
4
+ import { w as isDiscordThreadChannelType } from "./allow-list-DahA0Jxh.mjs";
5
+ import { p as canFallbackDiscordWebhookSend } from "./send.receipt-CMteCIZS.mjs";
6
6
  import { n as resolveDiscordChannelId } from "./target-parsing-BiuhcK9Q.mjs";
7
- import { c as sendWebhookMessageDiscord, u as createThreadDiscord } from "./send-Cbq-IVsS.mjs";
8
- import { t as sendMessageDiscord } from "./send.outbound-CGhBhzjQ.mjs";
9
- import { A as resolveBindingIdsForSession, C as forgetThreadBindingToken, D as refreshUnboundThreadWebhookIdentity, E as normalizeThreadBindingDurationMs, I as resolveThreadBindingMaxAgeMs$1, L as shouldDefaultPersist, M as resolvePreparedThreadBindingLifecycle, N as resolveThreadBindingIdleTimeoutMs$1, O as rememberReusableWebhook, R as toBindingRecordKey, S as ensureBindingsLoadedAsync, T as normalizeTargetKind, _ as MANAGERS_BY_ACCOUNT_ID, b as THREAD_BINDING_TOUCH_PERSIST_MIN_INTERVAL_MS, c as drainThreadBindingAccountOperations, d as runThreadBindingAccountOperation, f as runThreadBindingMutation, g as BINDINGS_BY_THREAD_ID, h as updateBindingRecordSync, j as resolveBindingRecordKey, k as rememberThreadBindingToken, l as drainThreadBindingMutations, m as snapshotThreadBindingMetadata, p as shouldPersistAnyBindingState, s as commitBindingRecord, v as PERSIST_BY_ACCOUNT_ID, w as getThreadBindingToken, y as REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL, z as toReusableWebhookKey } from "./thread-bindings.session-updates-C76plLS3.mjs";
10
- import { n as resolveDiscordChannelInfoSafe, t as resolveDiscordChannelIdSafe } from "./channel-access-BPrWoEXM.mjs";
7
+ import { c as sendWebhookMessageDiscord, u as createThreadDiscord } from "./send-DnLL6XoO.mjs";
8
+ import { t as sendMessageDiscord } from "./send.outbound-B11X6TOE.mjs";
9
+ import { A as resolveBindingRecordKey, C as forgetThreadBindingToken, D as refreshUnboundThreadWebhookIdentity, E as normalizeThreadBindingDurationMs, F as resolveThreadBindingMaxAgeMs, I as shouldDefaultPersist, L as toBindingRecordKey, M as resolveThreadBindingIdleTimeoutMs, O as rememberThreadBindingToken, R as toReusableWebhookKey, S as ensureBindingsLoadedAsync, T as normalizeTargetKind, _ as MANAGERS_BY_ACCOUNT_ID, b as THREAD_BINDING_TOUCH_PERSIST_MIN_INTERVAL_MS, c as drainThreadBindingAccountOperations, d as runThreadBindingAccountOperation, f as runThreadBindingMutation, g as BINDINGS_BY_THREAD_ID, h as updateBindingRecordSync, j as resolvePreparedThreadBindingLifecycle, k as resolveBindingIdsForSession, l as drainThreadBindingMutations, m as snapshotThreadBindingMetadata, p as shouldPersistAnyBindingState, s as commitBindingRecord, v as PERSIST_BY_ACCOUNT_ID, w as getThreadBindingToken, y as REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL } from "./thread-bindings.session-updates-C2gJAj_I.mjs";
10
+ import { t as resolveDiscordChannelInfoSafe } from "./channel-access-DhJhVrdZ.mjs";
11
+ import { coerceErrorMessage } from "openclaw/plugin-sdk/error-runtime";
11
12
  import { createSubsystemLogger, logVerbose } from "openclaw/plugin-sdk/runtime-env";
12
13
  import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
13
- import { normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
14
+ import { asNonArrayRecord, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
14
15
  import { getRuntimeConfigSnapshot } from "openclaw/plugin-sdk/runtime-config-snapshot";
15
- import { parseStrictNonNegativeInteger as parseStrictNonNegativeInteger$1 } from "openclaw/plugin-sdk/number-runtime";
16
16
  import { SYSTEM_MARK } from "openclaw/plugin-sdk/text-chunking";
17
17
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
18
18
  import { resolveThreadBindingFarewellText, resolveThreadBindingThreadName, unregisterSessionBindingAdapter } from "openclaw/plugin-sdk/conversation-runtime";
@@ -49,16 +49,11 @@ function normalizeDiscordBindingChannelId(raw) {
49
49
  }
50
50
  }
51
51
  function summarizeDiscordError(err) {
52
- if (err instanceof Error) return err.message;
53
- if (typeof err === "string" || typeof err === "number" || typeof err === "boolean" || typeof err === "bigint" || typeof err === "symbol") return String(err);
52
+ if (err instanceof Error || err != null && typeof err !== "object" && typeof err !== "function") return coerceErrorMessage(err);
54
53
  return "error";
55
54
  }
56
55
  function isDiscordThreadGoneError(err) {
57
- if (!err || typeof err !== "object") return false;
58
- const candidate = err;
59
- if ((parseStrictNonNegativeInteger$1(candidate.code) ?? parseStrictNonNegativeInteger$1(candidate.rawError?.code) ?? parseStrictNonNegativeInteger$1(candidate.body?.code) ?? parseStrictNonNegativeInteger$1(candidate.response?.body?.code) ?? parseStrictNonNegativeInteger$1(candidate.response?.data?.code)) === 10003) return true;
60
- const status = parseStrictNonNegativeInteger$1(candidate.status) ?? parseStrictNonNegativeInteger$1(candidate.statusCode) ?? parseStrictNonNegativeInteger$1(candidate.response?.status);
61
- return status === 404 || status === 403;
56
+ return err instanceof DiscordError && (err.discordCode === 10003 || err.status === 404 || err.status === 403);
62
57
  }
63
58
  async function maybeSendBindingMessage(params) {
64
59
  const assertCurrent = params.assertCurrent;
@@ -109,12 +104,13 @@ async function createWebhookForChannel(params) {
109
104
  accountId: params.accountId,
110
105
  token: params.token
111
106
  }).rest;
112
- const created = await withDiscordRequestAuthority(assertCreateAllowed, () => {
107
+ const rawCreated = await withDiscordRequestAuthority(assertCreateAllowed, () => {
113
108
  assertCreateAllowed?.();
114
- return createChannelWebhook(rest, params.channelId, { body: { name: "OpenClaw Agents" } });
109
+ return rest.post(discord_exports.Routes.channelWebhooks(params.channelId), { body: { name: "OpenClaw Agents" } });
115
110
  });
116
- const webhookId = normalizeOptionalString(created?.id) ?? "";
117
- const webhookToken = normalizeOptionalString(created?.token) ?? "";
111
+ const created = asNonArrayRecord(rawCreated);
112
+ const webhookId = normalizeOptionalString(created.id) ?? "";
113
+ const webhookToken = normalizeOptionalString(created.token) ?? "";
118
114
  if (!webhookId || !webhookToken) return {};
119
115
  return {
120
116
  webhookId,
@@ -126,21 +122,7 @@ async function createWebhookForChannel(params) {
126
122
  }
127
123
  }
128
124
  function findReusableWebhook(params) {
129
- const reusableKey = toReusableWebhookKey(params);
130
- const cached = REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL.get(reusableKey);
131
- if (cached) return {
132
- webhookId: cached.webhookId,
133
- webhookToken: cached.webhookToken
134
- };
135
- for (const record of BINDINGS_BY_THREAD_ID.values()) {
136
- if (record.accountId !== params.accountId || record.channelId !== params.channelId || !record.webhookId || !record.webhookToken) continue;
137
- rememberReusableWebhook(record);
138
- return {
139
- webhookId: record.webhookId,
140
- webhookToken: record.webhookToken
141
- };
142
- }
143
- return {};
125
+ return REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL.get(toReusableWebhookKey(params)) ?? {};
144
126
  }
145
127
  async function resolveChannelIdForBinding(params) {
146
128
  const explicit = normalizeDiscordBindingChannelId(params.channelId);
@@ -155,7 +137,7 @@ async function resolveChannelIdForBinding(params) {
155
137
  }).rest;
156
138
  const channel = await getChannel(rest, lookupThreadId);
157
139
  const channelInfo = resolveDiscordChannelInfoSafe(channel);
158
- const channelId = normalizeOptionalString(resolveDiscordChannelIdSafe(channel)) ?? "";
140
+ const channelId = normalizeOptionalString(channelInfo.id) ?? "";
159
141
  const type = channelInfo.type;
160
142
  const parentId = normalizeOptionalString(channelInfo.parentId) ?? "";
161
143
  if (parentId && isDiscordThreadChannelType(type)) return parentId;
@@ -317,7 +299,6 @@ function createNoopThreadBindingManager(accountIdRaw) {
317
299
  getIdleTimeoutMs: () => DEFAULT_THREAD_BINDING_IDLE_TIMEOUT_MS,
318
300
  getMaxAgeMs: () => 0,
319
301
  getByThreadId: () => void 0,
320
- getBySessionKey: () => void 0,
321
302
  listBySessionKey: () => [],
322
303
  listBindings: () => [],
323
304
  touchThread: async () => null,
@@ -509,11 +490,11 @@ function createLoadedThreadBindingManager(params) {
509
490
  text: resolveThreadBindingFarewellText({
510
491
  reason: notification.reason,
511
492
  farewellText: notification.farewellText,
512
- idleTimeoutMs: resolveThreadBindingIdleTimeoutMs$1({
493
+ idleTimeoutMs: resolveThreadBindingIdleTimeoutMs({
513
494
  record: removed,
514
495
  defaultIdleTimeoutMs: idleTimeoutMs
515
496
  }),
516
- maxAgeMs: resolveThreadBindingMaxAgeMs$1({
497
+ maxAgeMs: resolveThreadBindingMaxAgeMs({
517
498
  record: removed,
518
499
  defaultMaxAgeMs: maxAgeMs
519
500
  })
@@ -524,7 +505,6 @@ function createLoadedThreadBindingManager(params) {
524
505
  getIdleTimeoutMs: () => idleTimeoutMs,
525
506
  getMaxAgeMs: () => maxAgeMs,
526
507
  getByThreadId: (threadId) => getBinding(threadId)?.record,
527
- getBySessionKey: (targetSessionKey) => manager.listBySessionKey(targetSessionKey)[0],
528
508
  listBySessionKey: (targetSessionKey) => resolveBindingIdsForSession({
529
509
  targetSessionKey,
530
510
  accountId
@@ -756,7 +736,7 @@ function createLoadedThreadBindingManager(params) {
756
736
  sweepPromise = void 0;
757
737
  });
758
738
  }, THREAD_BINDINGS_SWEEP_INTERVAL_MS);
759
- if (shouldDefaultPersist()) sweepTimer.unref?.();
739
+ if (shouldDefaultPersist()) sweepTimer.unref();
760
740
  }
761
741
  const sessionBindingAdapter = createThreadBindingSessionAdapter({
762
742
  accountId,
@@ -1,3 +1,4 @@
1
+ import { J as stripUndefinedFields } from "./discord-r79VFjJp.mjs";
1
2
  import { t as getDiscordRuntime } from "./runtime-DcBvHOm1.mjs";
2
3
  import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
3
4
  import { normalizeAccountId, resolveAgentIdFromSessionKey } from "openclaw/plugin-sdk/routing";
@@ -6,6 +7,7 @@ import { resolveNonNegativeIntegerOption, resolveOptionalIntegerOption } from "o
6
7
  import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
7
8
  import { createPluginStateErrorReporter } from "openclaw/plugin-sdk/plugin-state-runtime";
8
9
  import { resolveThreadBindingExpiry, warnPluginSdkDeprecation } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
10
+ import { enqueueKeyedTask } from "openclaw/plugin-sdk/keyed-async-queue";
9
11
  import { recordOutboundMessageIdentity } from "openclaw/plugin-sdk/outbound-echo-runtime";
10
12
  // extensions/discord/src/monitor/thread-bindings.state.ts
11
13
  const THREAD_BINDINGS_STATE_KEY = Symbol.for("openclaw.discordThreadBindingsState");
@@ -26,7 +28,6 @@ function createThreadBindingsGlobalState() {
26
28
  };
27
29
  }
28
30
  const THREAD_BINDINGS_STATE = resolveGlobalSingleton(THREAD_BINDINGS_STATE_KEY, createThreadBindingsGlobalState);
29
- THREAD_BINDINGS_STATE.accountOperationTails ??= /* @__PURE__ */ new WeakMap();
30
31
  const MANAGERS_BY_ACCOUNT_ID = THREAD_BINDINGS_STATE.managersByAccountId;
31
32
  const BINDINGS_BY_THREAD_ID = THREAD_BINDINGS_STATE.bindingsByThreadId;
32
33
  const BINDINGS_BY_SESSION_KEY = THREAD_BINDINGS_STATE.bindingsBySessionKey;
@@ -283,22 +284,15 @@ function snapshotThreadBindingJson(value) {
283
284
  return serialized ? JSON.parse(serialized) : void 0;
284
285
  }
285
286
  function snapshotThreadBindingMetadata(input) {
286
- return asOptionalObjectRecord(snapshotThreadBindingJson(input.metadata ? { ...input.metadata } : void 0));
287
- }
288
- function toPersistedBindingRecord(record) {
289
- return normalizePersistedBinding(record.threadId, snapshotThreadBindingJson(record)) ?? { ...record };
287
+ return asOptionalObjectRecord(snapshotThreadBindingJson(input.metadata));
290
288
  }
291
289
  function runThreadBindingAccountOperation(managers, operation) {
292
290
  if (managers.length === 0) return operation();
293
- const tails = THREAD_BINDINGS_STATE.accountOperationTails;
294
- const predecessors = managers.map((manager) => tails.get(manager) ?? Promise.resolve());
295
- const result = Promise.all(predecessors).then(operation);
296
- const settled = result.then(() => {}, () => {});
297
- for (const manager of managers) tails.set(manager, settled);
298
- settled.then(() => {
299
- for (const manager of managers) if (tails.get(manager) === settled) tails.delete(manager);
291
+ return enqueueKeyedTask({
292
+ tails: THREAD_BINDINGS_STATE.accountOperationTails,
293
+ keys: managers,
294
+ task: operation
300
295
  });
301
- return result;
302
296
  }
303
297
  function drainThreadBindingAccountOperations(manager) {
304
298
  return THREAD_BINDINGS_STATE.accountOperationTails.get(manager) ?? Promise.resolve();
@@ -333,8 +327,7 @@ async function commitBindingRecord(params) {
333
327
  const store = openThreadBindingsStoreAsync();
334
328
  for (const [key, record] of records) {
335
329
  assertCurrent();
336
- const persisted = toPersistedBindingRecord(record);
337
- await store.register(key, persisted, { assertCurrent });
330
+ await store.register(key, stripUndefinedFields(record), { assertCurrent });
338
331
  committedWrites += 1;
339
332
  targetCommitted ||= key === params.bindingKey;
340
333
  }
@@ -383,10 +376,10 @@ function persistBindingsSync(update) {
383
376
  for (const [key, record] of BINDINGS_BY_THREAD_ID) if (key === update?.bindingKey) {
384
377
  if (!store.update) throw new Error("Discord synchronous compatibility requires atomic state update");
385
378
  const next = update.transform(record);
386
- store.update(key, () => toPersistedBindingRecord(next));
379
+ store.update(key, () => stripUndefinedFields(next));
387
380
  updatedRecord = next;
388
381
  if (next !== record) setBindingRecord(next);
389
- } else store.register(key, toPersistedBindingRecord(record));
382
+ } else store.register(key, stripUndefinedFields(record));
390
383
  for (const entry of store.entries()) if (!BINDINGS_BY_THREAD_ID.has(entry.key)) store.delete(entry.key);
391
384
  THREAD_BINDINGS_STATE.loadedPersistentBindings = BINDINGS_BY_THREAD_ID.size > 0;
392
385
  THREAD_BINDINGS_STATE.lastPersistedAtMs = Date.now();
@@ -520,4 +513,4 @@ const setThreadBindingMaxAgeBySessionKeyAsync = maxAgeSetters.setAsync;
520
513
  const setThreadBindingIdleTimeoutBySessionKey = idleSetters.set;
521
514
  /** @deprecated Use setThreadBindingMaxAgeBySessionKeyAsync; compatible through 2026-12-31, removed in the first January 2027 stable. */
522
515
  const setThreadBindingMaxAgeBySessionKey = maxAgeSetters.set;
523
- export { resolveBindingIdsForSession as A, forgetThreadBindingToken as C, refreshUnboundThreadWebhookIdentity as D, normalizeThreadBindingDurationMs as E, resolveThreadBindingMaxAgeExpiresAt as F, resolveThreadBindingMaxAgeMs as I, shouldDefaultPersist as L, resolvePreparedThreadBindingLifecycle as M, resolveThreadBindingIdleTimeoutMs as N, rememberReusableWebhook as O, resolveThreadBindingInactivityExpiresAt as P, toBindingRecordKey as R, ensureBindingsLoadedAsync as S, normalizeTargetKind as T, MANAGERS_BY_ACCOUNT_ID as _, mutateBindingsForTargetSession as a, THREAD_BINDING_TOUCH_PERSIST_MIN_INTERVAL_MS as b, drainThreadBindingAccountOperations as c, runThreadBindingAccountOperation as d, runThreadBindingMutation as f, BINDINGS_BY_THREAD_ID as g, updateBindingRecordSync as h, setThreadBindingMaxAgeBySessionKeyAsync as i, resolveBindingRecordKey as j, rememberThreadBindingToken as k, drainThreadBindingMutations as l, snapshotThreadBindingMetadata as m, setThreadBindingIdleTimeoutBySessionKeyAsync as n, resolveBindingIdsForTargetSession as o, shouldPersistAnyBindingState as p, setThreadBindingMaxAgeBySessionKey as r, commitBindingRecord as s, setThreadBindingIdleTimeoutBySessionKey as t, removeBindingRecordSync as u, PERSIST_BY_ACCOUNT_ID as v, getThreadBindingToken as w, ensureBindingsLoaded as x, REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL as y, toReusableWebhookKey as z };
516
+ export { resolveBindingRecordKey as A, forgetThreadBindingToken as C, refreshUnboundThreadWebhookIdentity as D, normalizeThreadBindingDurationMs as E, resolveThreadBindingMaxAgeMs as F, shouldDefaultPersist as I, toBindingRecordKey as L, resolveThreadBindingIdleTimeoutMs as M, resolveThreadBindingInactivityExpiresAt as N, rememberThreadBindingToken as O, resolveThreadBindingMaxAgeExpiresAt as P, toReusableWebhookKey as R, ensureBindingsLoadedAsync as S, normalizeTargetKind as T, MANAGERS_BY_ACCOUNT_ID as _, mutateBindingsForTargetSession as a, THREAD_BINDING_TOUCH_PERSIST_MIN_INTERVAL_MS as b, drainThreadBindingAccountOperations as c, runThreadBindingAccountOperation as d, runThreadBindingMutation as f, BINDINGS_BY_THREAD_ID as g, updateBindingRecordSync as h, setThreadBindingMaxAgeBySessionKeyAsync as i, resolvePreparedThreadBindingLifecycle as j, resolveBindingIdsForSession as k, drainThreadBindingMutations as l, snapshotThreadBindingMetadata as m, setThreadBindingIdleTimeoutBySessionKeyAsync as n, resolveBindingIdsForTargetSession as o, shouldPersistAnyBindingState as p, setThreadBindingMaxAgeBySessionKey as r, commitBindingRecord as s, setThreadBindingIdleTimeoutBySessionKey as t, removeBindingRecordSync as u, PERSIST_BY_ACCOUNT_ID as v, getThreadBindingToken as w, ensureBindingsLoaded as x, REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL as y };
@@ -1,56 +1,25 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.mjs";
2
- import { lt as createThread, pt as getChannelMessage, t as discord_exports } from "./discord-eFlHX1Gn.mjs";
3
- import { d as resolveDiscordReplyDeliveryPlan, f as resolveDiscordReplyTarget, g as sanitizeDiscordThreadName, h as resolveDiscordThreadStarter, j as resolveDiscordMessageChannelId, m as resolveDiscordThreadParentInfo, p as resolveDiscordThreadChannel } from "./transcripts-source-CGgOaWcu.mjs";
2
+ import { T as createThread, k as getChannelMessage, t as discord_exports } from "./discord-r79VFjJp.mjs";
3
+ import { d as resolveDiscordReplyDeliveryPlan, f as resolveDiscordReplyTarget, g as sanitizeDiscordThreadName, h as resolveDiscordThreadStarter, j as resolveDiscordMessageChannelId, m as resolveDiscordThreadParentInfo, p as resolveDiscordThreadChannel } from "./transcripts-source-DzpzETZR.mjs";
4
4
  import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
5
5
  import { buildAgentSessionKey } from "openclaw/plugin-sdk/routing";
6
6
  import { normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
7
7
  import { Routes } from "discord-api-types/v10";
8
- import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
8
+ import { truncateWithMarker } from "openclaw/plugin-sdk/string-normalization-runtime";
9
9
  import { resolveChannelModelOverride } from "openclaw/plugin-sdk/model-session-runtime";
10
10
  import { generateConversationLabel } from "openclaw/plugin-sdk/reply-dispatch-runtime";
11
- // extensions/discord/src/monitor/thread-title.ts
11
+ // extensions/discord/src/monitor/threading.auto-thread.ts
12
12
  const DEFAULT_THREAD_TITLE_TIMEOUT_MS = 6e4;
13
13
  const MAX_THREAD_TITLE_SOURCE_CHARS = 600;
14
14
  const MAX_THREAD_TITLE_CHANNEL_NAME_CHARS = 120;
15
15
  const MAX_THREAD_TITLE_CHANNEL_DESCRIPTION_CHARS = 320;
16
16
  const DISCORD_THREAD_TITLE_SYSTEM_PROMPT = "Generate a concise Discord thread title (3-6 words) in sentence case: capitalize only the first word and words that are always capitalized. Return only the title. Use channel context when provided and avoid redundant channel-name words unless needed for clarity.";
17
- async function generateThreadTitle(params) {
18
- const sourceText = params.messageText.trim();
19
- if (!sourceText) return null;
20
- try {
21
- const userMessage = buildThreadTitleCompletionUserMessage({
22
- sourceText,
23
- channelName: params.channelName,
24
- channelDescription: params.channelDescription
25
- });
26
- const generated = await generateConversationLabel({
27
- cfg: params.cfg,
28
- agentId: params.agentId,
29
- userMessage,
30
- prompt: DISCORD_THREAD_TITLE_SYSTEM_PROMPT,
31
- ...params.modelRef ? { modelRef: params.modelRef } : {},
32
- timeoutMs: Math.max(100, Math.floor(params.timeoutMs ?? DEFAULT_THREAD_TITLE_TIMEOUT_MS)),
33
- maxLength: MAX_THREAD_TITLE_SOURCE_CHARS
34
- });
35
- return generated ? normalizeGeneratedThreadTitle(generated) : null;
36
- } catch (err) {
37
- logVerbose(`thread-title: title generation failed for agent ${params.agentId}: ${String(err)}`);
38
- return null;
39
- }
40
- }
41
- function buildThreadTitleCompletionUserMessage(params) {
42
- const sourceText = truncateThreadTitleText(params.sourceText, MAX_THREAD_TITLE_SOURCE_CHARS);
43
- const channelName = normalizeTitleContextField(params.channelName, MAX_THREAD_TITLE_CHANNEL_NAME_CHARS);
44
- const channelDescription = normalizeTitleContextField(params.channelDescription, MAX_THREAD_TITLE_CHANNEL_DESCRIPTION_CHARS);
45
- return [
46
- channelName ? `Channel: ${channelName}` : void 0,
47
- channelDescription ? `Channel description: ${channelDescription}` : void 0,
48
- `Message:\n${sourceText}`
49
- ].filter(Boolean).join("\n\n");
50
- }
51
17
  function truncateThreadTitleText(text, maxChars) {
52
- if (text.length <= maxChars) return text;
53
- return `${truncateUtf16Safe(text, maxChars)}...`;
18
+ return truncateWithMarker(text, maxChars, {
19
+ marker: "...",
20
+ reserve: 0,
21
+ trimEnd: false
22
+ });
54
23
  }
55
24
  function normalizeGeneratedThreadTitle(raw) {
56
25
  return stripThreadTitleWrappers(raw.replace(/\r/g, "").split("\n").find((line) => line.trim() && !line.trim().startsWith("```")) ?? "");
@@ -81,7 +50,6 @@ function normalizeTitleContextField(raw, maxChars) {
81
50
  if (!value) return;
82
51
  return truncateThreadTitleText(value.replace(/\s+/g, " "), maxChars);
83
52
  }
84
- // extensions/discord/src/monitor/threading.auto-thread.ts
85
53
  function resolveTrimmedDiscordMessageChannelId(params) {
86
54
  return (params.messageChannelId || resolveDiscordMessageChannelId({ message: params.message })).trim();
87
55
  }
@@ -130,7 +98,6 @@ async function resolveDiscordAutoThreadReplyPlan(params) {
130
98
  }) : null;
131
99
  return {
132
100
  ...deliveryPlan,
133
- createdThreadId,
134
101
  autoThreadContext
135
102
  };
136
103
  }
@@ -142,10 +109,7 @@ async function maybeCreateDiscordAutoThread(params) {
142
109
  const findExistingThread = async () => {
143
110
  try {
144
111
  const existingThreadId = (await getChannelMessage(params.client.rest, messageChannelId, params.message.id))?.thread?.id;
145
- if (existingThreadId) {
146
- logVerbose(`discord: autoThread reusing existing thread ${existingThreadId} on ${messageChannelId}/${params.message.id}`);
147
- return existingThreadId;
148
- }
112
+ if (existingThreadId) return existingThreadId;
149
113
  } catch {}
150
114
  };
151
115
  try {
@@ -162,27 +126,65 @@ async function maybeCreateDiscordAutoThread(params) {
162
126
  name: threadName,
163
127
  auto_archive_duration: archiveDuration
164
128
  } }, params.message.id))?.id || "";
165
- if (createdId && params.channelConfig?.autoThreadName === "generated" && params.cfg && params.agentId) {
166
- const modelRef = resolveDiscordThreadTitleModelRef({
167
- cfg: params.cfg,
168
- channel: params.channel,
169
- agentId: params.agentId,
170
- threadId: createdId,
171
- messageChannelId,
172
- channelName: params.channelName
173
- });
174
- maybeRenameDiscordAutoThread({
175
- client: params.client,
176
- threadId: createdId,
177
- currentName: threadName,
178
- fallbackId: params.message.id,
179
- sourceText: rawThreadSource,
180
- modelRef,
181
- channelName: params.channelName,
182
- channelDescription: params.channelDescription,
183
- cfg: params.cfg,
184
- agentId: params.agentId
129
+ if (createdId && params.channelConfig?.autoThreadName === "generated") {
130
+ const { client, channelName, channelDescription, cfg, agentId, channel } = params;
131
+ const parentSessionKey = buildAgentSessionKey({
132
+ agentId,
133
+ channel,
134
+ peer: {
135
+ kind: "channel",
136
+ id: messageChannelId
137
+ }
185
138
  });
139
+ const channelLabel = channelName?.trim();
140
+ const groupChannel = channelLabel ? `#${channelLabel}` : void 0;
141
+ const modelRef = resolveChannelModelOverride({
142
+ cfg,
143
+ channel,
144
+ groupId: createdId,
145
+ groupChatType: "channel",
146
+ groupChannel,
147
+ groupSubject: groupChannel,
148
+ parentSessionKey
149
+ })?.model;
150
+ const fallbackId = params.message.id;
151
+ (async () => {
152
+ try {
153
+ const fallbackName = sanitizeDiscordThreadName("", fallbackId);
154
+ const sourceText = rawThreadSource.trim();
155
+ const rawChannelName = channelName;
156
+ const rawChannelDescription = channelDescription;
157
+ let generated = null;
158
+ if (sourceText) try {
159
+ const titleSourceText = truncateThreadTitleText(sourceText, MAX_THREAD_TITLE_SOURCE_CHARS);
160
+ const titleChannelName = normalizeTitleContextField(rawChannelName, MAX_THREAD_TITLE_CHANNEL_NAME_CHARS);
161
+ const titleChannelDescription = normalizeTitleContextField(rawChannelDescription, MAX_THREAD_TITLE_CHANNEL_DESCRIPTION_CHARS);
162
+ const userMessage = [
163
+ titleChannelName ? `Channel: ${titleChannelName}` : void 0,
164
+ titleChannelDescription ? `Channel description: ${titleChannelDescription}` : void 0,
165
+ `Message:\n${titleSourceText}`
166
+ ].filter(Boolean).join("\n\n");
167
+ const label = await generateConversationLabel({
168
+ cfg,
169
+ agentId,
170
+ userMessage,
171
+ prompt: DISCORD_THREAD_TITLE_SYSTEM_PROMPT,
172
+ ...modelRef ? { modelRef } : {},
173
+ timeoutMs: DEFAULT_THREAD_TITLE_TIMEOUT_MS,
174
+ maxLength: MAX_THREAD_TITLE_SOURCE_CHARS
175
+ });
176
+ generated = label ? normalizeGeneratedThreadTitle(label) : null;
177
+ } catch (err) {
178
+ logVerbose(`thread-title: title generation failed for agent ${agentId}: ${String(err)}`);
179
+ }
180
+ if (!generated) return;
181
+ const nextName = sanitizeDiscordThreadName(generated, fallbackId);
182
+ if (!nextName || nextName === threadName || nextName === fallbackName) return;
183
+ await client.rest.patch(Routes.channel(createdId), { body: { name: nextName } });
184
+ } catch (err) {
185
+ logVerbose(`discord: autoThread rename failed for ${createdId}: ${String(err)}`);
186
+ }
187
+ })();
186
188
  }
187
189
  return createdId || void 0;
188
190
  } catch (err) {
@@ -190,44 +192,6 @@ async function maybeCreateDiscordAutoThread(params) {
190
192
  return findExistingThread();
191
193
  }
192
194
  }
193
- function resolveDiscordThreadTitleModelRef(params) {
194
- const channel = params.channel?.trim();
195
- if (!channel) return;
196
- const parentSessionKey = buildAgentSessionKey({
197
- agentId: params.agentId,
198
- channel,
199
- peer: {
200
- kind: "channel",
201
- id: params.messageChannelId
202
- }
203
- });
204
- const channelLabel = params.channelName?.trim();
205
- const groupChannel = channelLabel ? `#${channelLabel}` : void 0;
206
- return resolveChannelModelOverride({
207
- cfg: params.cfg,
208
- channel,
209
- groupId: params.threadId,
210
- groupChatType: "channel",
211
- groupChannel,
212
- groupSubject: groupChannel,
213
- parentSessionKey
214
- })?.model;
215
- }
216
- async function maybeRenameDiscordAutoThread(params) {
217
- try {
218
- const fallbackName = sanitizeDiscordThreadName("", params.fallbackId);
219
- const generated = await generateThreadTitle({
220
- ...params,
221
- messageText: params.sourceText
222
- });
223
- if (!generated) return;
224
- const nextName = sanitizeDiscordThreadName(generated, params.fallbackId);
225
- if (!nextName || nextName === params.currentName || nextName === fallbackName) return;
226
- await params.client.rest.patch(Routes.channel(params.threadId), { body: { name: nextName } });
227
- } catch (err) {
228
- logVerbose(`discord: autoThread rename failed for ${params.threadId}: ${String(err)}`);
229
- }
230
- }
231
195
  // extensions/discord/src/monitor/threading.ts
232
196
  var threading_exports = /* @__PURE__ */ __exportAll({
233
197
  maybeCreateDiscordAutoThread: () => maybeCreateDiscordAutoThread,
@@ -57,7 +57,7 @@ async function withAbortTimeout(params) {
57
57
  reject(params.createTimeoutError());
58
58
  controller.abort();
59
59
  }, timeoutMs);
60
- timeoutTimer.unref?.();
60
+ timeoutTimer.unref();
61
61
  });
62
62
  try {
63
63
  return await Promise.race([params.run(controller.signal), timeoutPromise]);