@openclaw/discord 2026.11.3 → 2026.11.5-beta.2

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 (220) hide show
  1. package/dist/.setup/{account-inspect-8cCu6uPG.mjs → account-inspect-DGkdWwix.mjs} +1 -1
  2. package/dist/.setup/{accounts-ljrzXBJi.mjs → accounts-C_25wyxC.mjs} +9 -6
  3. package/dist/.setup/{active-turn-thread-route-C4tp9noA.mjs → active-turn-thread-route-KvRTAVE3.mjs} +1 -2
  4. package/dist/.setup/{allow-list-BKqOldGy.mjs → allow-list-BXrS8-R9.mjs} +4 -152
  5. package/dist/.setup/{api-DqmMUZau.mjs → api-BlBD4ism.mjs} +10 -20
  6. package/dist/.setup/{approval-handler.runtime-D0qu1um7.mjs → approval-handler.runtime-BGYjX1t9.mjs} +80 -61
  7. package/dist/.setup/{approval-message-updates-CdurC9Ej.mjs → approval-message-updates-DKsCfxSW.mjs} +2 -2
  8. package/dist/.setup/{audit-ChorIwio.mjs → audit-5b-FXj9R.mjs} +4 -4
  9. package/dist/.setup/{channel-ZilgdF5e.mjs → channel-CWwTHWFo.mjs} +134 -202
  10. package/dist/.setup/channel-access-9cyzozUP.mjs +24 -0
  11. package/dist/.setup/channel.setup-B3MtmBQG.mjs +238 -0
  12. package/dist/.setup/{components-Du9NhD8h.mjs → components-YCvQ6YLS.mjs} +209 -430
  13. package/dist/.setup/components.base-CiS0h_XP.mjs +32 -0
  14. package/dist/.setup/{config-schema-_uBILpQf.mjs → config-schema-BNKN1cu5.mjs} +6 -7
  15. package/dist/.setup/{conversation-binding-route-8Ul1KpGF.mjs → conversation-binding-route-kCTw8cij.mjs} +2 -2
  16. package/dist/.setup/{directory-config-3iVub-3m.mjs → directory-config-Ble81PWH.mjs} +1 -1
  17. package/dist/.setup/{directory-live-BDVl2DoC.mjs → directory-live-DH3tpS3x.mjs} +52 -57
  18. package/dist/.setup/{discord-BMD-JiVS.mjs → discord-DGVSguhx.mjs} +1124 -1710
  19. package/dist/.setup/{doctor-hQKbkNKq.mjs → doctor-eujgbnpZ.mjs} +3 -5
  20. package/dist/.setup/endpoint-runtime-lf4DeLas.mjs +139 -0
  21. package/dist/.setup/guilds-eDq22iSM.mjs +22 -0
  22. package/dist/.setup/{handle-action-B1lmt4ms.mjs → handle-action-CktwmzMz.mjs} +15 -15
  23. package/dist/.setup/{handle-action.guild-admin-B6g31cwt.mjs → handle-action.guild-admin-WLQ7fRqI.mjs} +5 -5
  24. package/dist/.setup/listeners-Df8lx3vK.mjs +47 -0
  25. package/dist/.setup/{live-policy-config-C_Q966Wh.mjs → live-policy-config-DiBVuaU6.mjs} +2 -3
  26. package/dist/.setup/{message-handler-CkI3yMjL.mjs → message-handler-hhNSioxo.mjs} +154 -115
  27. package/dist/.setup/{message-handler.preflight-CEfkFV9U.mjs → message-handler.preflight-BZcZE1o-.mjs} +30 -105
  28. package/dist/.setup/{message-handler.preflight-pluralkit-D5si80_L.mjs → message-handler.preflight-pluralkit-CYZfXXb6.mjs} +9 -22
  29. package/dist/.setup/{message-handler.process-DsMtetRf.mjs → message-handler.process-B0n-mQ99.mjs} +256 -373
  30. package/dist/.setup/outbound-payload-BaZmjewa.mjs +447 -0
  31. package/dist/.setup/{outbound-session-route-BtUpGBTb.mjs → outbound-session-route-Cgx4i9cS.mjs} +139 -86
  32. package/dist/.setup/{preflight-audio-wWgsZG5F.mjs → preflight-audio-C6QtD6HX.mjs} +1 -5
  33. package/dist/.setup/{presence-cache-DCeTsL73.mjs → presence-cache-Dq-3nH7R.mjs} +1 -6
  34. package/dist/.setup/{probe-CBaoCs-c.mjs → probe-DezB-6xz.mjs} +5 -9
  35. package/dist/.setup/{provider-CI_OLfvz.mjs → provider-BN2bCIUp.mjs} +3440 -4308
  36. package/dist/.setup/{provider-session.runtime-TWOo_JZx.mjs → provider-session.runtime-Dr_5X43t.mjs} +3 -3
  37. package/dist/.setup/provider.runtime-BuJpl0Pv.mjs +1 -0
  38. package/dist/.setup/proxy-fetch-BzXwBAXt.mjs +30 -0
  39. package/dist/.setup/{realtime-session.runtime-DvfS4vJj.mjs → realtime-session.runtime-BTDWsV4d.mjs} +44 -81
  40. package/dist/.setup/{receive-recovery-CKvaG2Hf.mjs → receive-recovery-C3Ks4wAQ.mjs} +13 -27
  41. package/dist/.setup/{resolve-allowlist-common-cIjtqh2F.mjs → resolve-allowlist-common-Bk8Fj6Ik.mjs} +3 -13
  42. package/dist/.setup/{resolve-channels-Cj5i7hzj.mjs → resolve-channels-Bp8frXvc.mjs} +7 -8
  43. package/dist/.setup/{resolve-users-BQLbysRB.mjs → resolve-users-Cvcj22sG.mjs} +4 -7
  44. package/dist/.setup/{runtime-RWnuJgWB.mjs → runtime-BJaCvlmq.mjs} +196 -239
  45. package/dist/.setup/{runtime-plifsKg9.mjs → runtime-BMgTyuwg.mjs} +6 -6
  46. package/dist/.setup/{secret-config-contract-z6FhbT8E.mjs → secret-config-contract-B1kE4sDv.mjs} +4 -9
  47. package/dist/.setup/{send-da6ENJ9f.mjs → send-CVW7V-VZ.mjs} +149 -175
  48. package/dist/.setup/{send.components-CWZUuGvA.mjs → send.components-C8YXdnO_.mjs} +59 -71
  49. package/dist/.setup/{send.outbound-qZ3iK3Vq.mjs → send.outbound-Uzcmh3Yd.mjs} +76 -129
  50. package/dist/.setup/{send.receipt-C18khRYH.mjs → send.receipt-NZDOTZBU.mjs} +30 -32
  51. package/dist/.setup/{send.shared-CnlMgoqQ.mjs → send.shared-a_6Oeyg1.mjs} +38 -115
  52. package/dist/.setup/{sender-identity-DgbJykq0.mjs → sender-identity-76HFb8eK.mjs} +3 -9
  53. package/dist/.setup/setup-plugin-api-BExhGEhL.mjs +2 -0
  54. package/dist/.setup/shared-interactive-DmzaoKOM.mjs +316 -0
  55. package/dist/.setup/{shared-CY5vJM48.mjs → shared-yDUSExm2.mjs} +8 -11
  56. package/dist/.setup/{subagent-hooks-CIu2TFz3.mjs → subagent-hooks-CDkdHQyy.mjs} +1 -1
  57. package/dist/.setup/{system-events-DCOLXkwS.mjs → system-events-yfWz150v.mjs} +2 -2
  58. package/dist/.setup/{target-resolver-CApivu3G.mjs → target-resolver-BOOzqxxM.mjs} +3 -3
  59. package/dist/.setup/{thread-bindings-DcvT_JgI.mjs → thread-bindings-zce4cpu_.mjs} +12 -20
  60. package/dist/.setup/{thread-bindings.manager-5Sh7yedN.mjs → thread-bindings.manager-NywKzUtc.mjs} +22 -42
  61. package/dist/.setup/{thread-bindings.session-updates-BMdJeJMc.mjs → thread-bindings.session-updates-D0j7oh8S.mjs} +11 -18
  62. package/dist/.setup/{threading-CzjFeUSe.mjs → threading-DodLYDt-.mjs} +68 -105
  63. package/dist/.setup/{timeouts-CuNARfyw.mjs → timeouts-cIxzatmv.mjs} +1 -1
  64. package/dist/.setup/{transcripts-source-8RDQrSVb.mjs → transcripts-source-ie9GBWaU.mjs} +110 -179
  65. package/dist/.setup/{voice-runtime-BsDILmAv.mjs → voice-runtime-B7V_LTdX.mjs} +231 -452
  66. package/dist/.source-module-urls/d6c089460280c5a04184542d6712e04545caeb1ebb290d3504377b4cc5e22fea.json +1 -0
  67. package/dist/account-inspect-api.js +1 -1
  68. package/dist/action-runtime-api.js +1 -2
  69. package/dist/activities-api.js +286 -341
  70. package/dist/api.js +16 -16
  71. package/dist/channel-config-api.js +1 -2
  72. package/dist/channel-plugin-api.js +1 -2
  73. package/dist/contract-api.js +1 -2
  74. package/dist/directory-contract-api.js +1 -1
  75. package/dist/runtime-api.js +22 -22
  76. package/dist/runtime-setter-api.js +1 -2
  77. package/dist/secret-contract-api.js +1 -2
  78. package/dist/security-audit-contract-api.js +1 -2
  79. package/dist/security-contract-api.js +1 -2
  80. package/dist/session-key-api.js +1 -2
  81. package/dist/setup-entry.js +1 -1
  82. package/dist/setup-plugin-api.js +1 -2
  83. package/dist/src/voice/audio-worker.runtime.js +56 -68
  84. package/dist/subagent-hooks-api.js +1 -1
  85. package/dist/thread-binding-api.js +1 -2
  86. package/dist/transcripts-source-api.js +1 -1
  87. package/node_modules/@napi-rs/wasm-runtime/dist/fs.js +3339 -4021
  88. package/node_modules/@napi-rs/wasm-runtime/package.json +1 -1
  89. package/node_modules/@types/lodash/README.md +1 -1
  90. package/node_modules/@types/lodash/common/function.d.ts +2 -2
  91. package/node_modules/@types/lodash/package.json +2 -2
  92. package/node_modules/@types/node/README.md +1 -1
  93. package/node_modules/@types/node/package.json +2 -2
  94. package/node_modules/@types/node/util.d.ts +6 -3
  95. package/node_modules/discord-api-types/package.json +4 -4
  96. package/node_modules/discord-api-types/rest/v10/index.d.ts +8 -0
  97. package/node_modules/discord-api-types/rest/v10/index.d.ts.map +1 -1
  98. package/node_modules/discord-api-types/rest/v10/index.js +8 -0
  99. package/node_modules/discord-api-types/rest/v10/index.js.map +1 -1
  100. package/node_modules/discord-api-types/rest/v10/oauth2.d.ts +26 -2
  101. package/node_modules/discord-api-types/rest/v10/oauth2.d.ts.map +1 -1
  102. package/node_modules/discord-api-types/rest/v9/index.d.ts +8 -0
  103. package/node_modules/discord-api-types/rest/v9/index.d.ts.map +1 -1
  104. package/node_modules/discord-api-types/rest/v9/index.js +8 -0
  105. package/node_modules/discord-api-types/rest/v9/index.js.map +1 -1
  106. package/node_modules/discord-api-types/rest/v9/oauth2.d.ts +26 -2
  107. package/node_modules/discord-api-types/rest/v9/oauth2.d.ts.map +1 -1
  108. package/node_modules/typebox/build/format/duration.d.mts +2 -2
  109. package/node_modules/typebox/build/format/duration.mjs +2 -2
  110. package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
  111. package/node_modules/typebox/build/format/idn_email.mjs +1 -0
  112. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
  113. package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
  114. package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
  115. package/node_modules/typebox/build/format/ipv4.mjs +2 -2
  116. package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
  117. package/node_modules/typebox/build/format/ipv6.mjs +1 -1
  118. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  119. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  120. package/node_modules/typebox/build/schema/build.mjs +1 -0
  121. package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
  122. package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
  123. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
  124. package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
  125. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
  126. package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
  127. package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
  128. package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
  129. package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
  130. package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
  131. package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
  132. package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
  133. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
  134. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
  135. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
  136. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
  137. package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
  138. package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
  139. package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
  140. package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
  141. package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
  142. package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
  143. package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
  144. package/node_modules/typebox/build/system/memory/create.mjs +18 -13
  145. package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
  146. package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
  147. package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
  148. package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
  149. package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
  150. package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
  151. package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
  152. package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
  153. package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
  154. package/node_modules/typebox/build/system/memory/update.mjs +43 -16
  155. package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
  156. package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
  157. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
  158. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
  159. package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
  160. package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
  161. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
  162. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
  163. package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
  164. package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
  165. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
  166. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
  167. package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
  168. package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
  169. package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
  170. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  171. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
  172. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
  173. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
  174. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
  175. package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
  176. package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
  177. package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
  178. package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
  179. package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
  180. package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
  181. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
  182. package/node_modules/typebox/package.json +1 -1
  183. package/node_modules/typebox/readme.md +1 -1
  184. package/node_modules/undici/docs/docs/api/Interceptors.md +15 -2
  185. package/node_modules/undici/lib/dispatcher/client-h2.js +78 -3
  186. package/node_modules/undici/lib/dispatcher/pool-base.js +20 -3
  187. package/node_modules/undici/package.json +3 -3
  188. package/node_modules/undici/types/api.d.ts +1 -1
  189. package/node_modules/undici/types/utility.d.ts +4 -4
  190. package/node_modules/uuid/package.json +17 -17
  191. package/node_modules/zod/package.json +1 -1
  192. package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
  193. package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
  194. package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
  195. package/node_modules/zod/src/v4/core/compile.ts +9 -0
  196. package/node_modules/zod/src/v4/core/schemas.ts +35 -1
  197. package/node_modules/zod/src/v4/core/util.ts +13 -0
  198. package/node_modules/zod/src/v4/core/versions.ts +1 -1
  199. package/node_modules/zod/v4/core/compile.cjs +8 -0
  200. package/node_modules/zod/v4/core/compile.js +8 -0
  201. package/node_modules/zod/v4/core/schemas.cjs +30 -0
  202. package/node_modules/zod/v4/core/schemas.d.cts +3 -1
  203. package/node_modules/zod/v4/core/schemas.d.ts +3 -1
  204. package/node_modules/zod/v4/core/schemas.js +30 -0
  205. package/node_modules/zod/v4/core/util.cjs +15 -0
  206. package/node_modules/zod/v4/core/util.d.cts +2 -0
  207. package/node_modules/zod/v4/core/util.d.ts +2 -0
  208. package/node_modules/zod/v4/core/util.js +14 -0
  209. package/node_modules/zod/v4/core/versions.cjs +1 -1
  210. package/node_modules/zod/v4/core/versions.js +1 -1
  211. package/openclaw.plugin.json +1 -31
  212. package/package.json +8 -8
  213. package/dist/.setup/channel-access-DasWY_OV.mjs +0 -48
  214. package/dist/.setup/channel.setup-DaDQdctj.mjs +0 -249
  215. package/dist/.setup/outbound-adapter-DfAanoCO.mjs +0 -543
  216. package/dist/.setup/provider.runtime-DnionCyo.mjs +0 -2
  217. package/dist/.setup/setup-plugin-api-D1QuM187.mjs +0 -3
  218. package/dist/.setup/targets-UWWZ6gF7.mjs +0 -3
  219. package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
  220. package/node_modules/typebox/build/system/memory/freeze.mjs +0 -6
@@ -1,10 +1,10 @@
1
- import { c as resolveDefaultDiscordAccountId, f as resolveDiscordAccountDisabledReason, i as listDiscordAccountIds, l as resolveDiscordAccount, p as resolveDiscordAccountDmPolicy, r as isDiscordAccountEnabledForRuntime, s as mergeDiscordAccountConfig, u as resolveDiscordAccountAllowFrom } from "./accounts-ljrzXBJi.mjs";
2
- import { t as inspectDiscordAccount } from "./account-inspect-8cCu6uPG.mjs";
1
+ import { c as resolveDefaultDiscordAccountId, f as resolveDiscordAccountDisabledReason, i as listDiscordAccountIds, l as resolveDiscordAccount, p as resolveDiscordAccountDmPolicy, r as isDiscordAccountEnabledForRuntime, s as mergeDiscordAccountConfig, u as resolveDiscordAccountAllowFrom } from "./accounts-C_25wyxC.mjs";
2
+ import { t as inspectDiscordAccount } from "./account-inspect-DGkdWwix.mjs";
3
3
  import { t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
4
- import { n as discordIngressIdentity, t as selectDiscordLivePolicyConfig } from "./live-policy-config-C_Q966Wh.mjs";
5
- import { t as DiscordChannelConfigSchema } from "./config-schema-_uBILpQf.mjs";
4
+ import { n as discordIngressIdentity, t as selectDiscordLivePolicyConfig } from "./live-policy-config-DiBVuaU6.mjs";
5
+ import { t as DiscordChannelConfigSchema } from "./config-schema-BNKN1cu5.mjs";
6
6
  import { n as normalizeCompatibilityConfig } from "./doctor-contract-Bwv8EuQ_.mjs";
7
- import { r as secretTargetRegistryEntries, t as collectRuntimeConfigAssignments } from "./secret-config-contract-z6FhbT8E.mjs";
7
+ import { r as secretTargetRegistryEntries, t as collectRuntimeConfigAssignments } from "./secret-config-contract-B1kE4sDv.mjs";
8
8
  import { n as unsupportedSecretRefSurfacePatterns, t as collectUnsupportedSecretRefConfigCandidates } from "./security-contract-DNyyjTZZ.mjs";
9
9
  import { t as deriveLegacySessionChatType } from "./session-contract-BO5tlIdl.mjs";
10
10
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
@@ -94,19 +94,16 @@ const discordSetupContract = defineChannelSetupContract({
94
94
  legacyAdapter: discordSetupAdapter
95
95
  });
96
96
  //#endregion
97
- //#region extensions/discord/src/doctor-shared.ts
98
- const DISCORD_LEGACY_CONFIG_RULES = [];
99
- //#endregion
100
97
  //#region extensions/discord/src/shared.ts
101
98
  const DISCORD_CHANNEL = "discord";
102
99
  const livePolicyConfigPrefixes = Object.keys(selectDiscordLivePolicyConfig({})).flatMap((key) => [`channels.discord.${key}`, `channels.discord.accounts.*.${key}`]);
103
- const loadDiscordDoctorModule = createLazyRuntimeModule(() => import("./doctor-hQKbkNKq.mjs"));
100
+ const loadDiscordDoctorModule = createLazyRuntimeModule(() => import("./doctor-eujgbnpZ.mjs"));
104
101
  const discordDoctor = {
105
102
  dmAllowFromMode: "topOnly",
106
103
  groupModel: "route",
107
104
  groupAllowFromFallbackToAllowFrom: false,
108
105
  warnOnEmptyGroupSenderAllowlist: false,
109
- legacyConfigRules: DISCORD_LEGACY_CONFIG_RULES,
106
+ legacyConfigRules: [],
110
107
  normalizeCompatibilityConfig,
111
108
  collectPreviewWarnings: async (params) => (await loadDiscordDoctorModule()).discordDoctor.collectPreviewWarnings?.(params) ?? [],
112
109
  collectMutableAllowlistWarnings: async (params) => (await loadDiscordDoctorModule()).discordDoctor.collectMutableAllowlistWarnings?.(params) ?? [],
@@ -227,4 +224,4 @@ function createDiscordPluginBase(params) {
227
224
  };
228
225
  }
229
226
  //#endregion
230
- export { discordSecurityAdapter as a, discordSetupContract as i, discordConfigAdapter as n, DISCORD_LEGACY_CONFIG_RULES as r, createDiscordPluginBase as t };
227
+ export { discordSecurityAdapter as i, discordConfigAdapter as n, discordSetupContract as r, createDiscordPluginBase as t };
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
- import { d as unbindThreadBindingsBySessionKeyAsync, o as listThreadBindingsBySessionKey, s as listThreadBindingsBySessionKeyAsync } from "./thread-bindings-DcvT_JgI.mjs";
2
+ import { d as unbindThreadBindingsBySessionKeyAsync, o as listThreadBindingsBySessionKey, s as listThreadBindingsBySessionKeyAsync } from "./thread-bindings-zce4cpu_.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
  //#region extensions/discord/src/subagent-hooks.ts
@@ -1,5 +1,5 @@
1
- import { S as formatDiscordUserTag } from "./allow-list-BKqOldGy.mjs";
2
- import { t as discord_exports } from "./discord-BMD-JiVS.mjs";
1
+ import { t as discord_exports } from "./discord-DGVSguhx.mjs";
2
+ import { S as formatDiscordUserTag } from "./allow-list-BXrS8-R9.mjs";
3
3
  //#region 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-B4FMCO8f.mjs";
2
- import { l as resolveDiscordAccount, u as resolveDiscordAccountAllowFrom } from "./accounts-ljrzXBJi.mjs";
3
- import { c as allowFromContainsDiscordUserId } from "./send.receipt-C18khRYH.mjs";
4
- import { o as rememberDiscordDirectoryUser, r as listDiscordDirectoryPeersLive } from "./directory-live-BDVl2DoC.mjs";
2
+ import { l as resolveDiscordAccount, u as resolveDiscordAccountAllowFrom } from "./accounts-C_25wyxC.mjs";
3
+ import { a as allowFromContainsDiscordUserId } from "./send.receipt-NZDOTZBU.mjs";
4
+ import { o as rememberDiscordDirectoryUser, r as listDiscordDirectoryPeersLive } from "./directory-live-DH3tpS3x.mjs";
5
5
  import { t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
6
6
  import { buildMessagingTarget } from "openclaw/plugin-sdk/channel-targets";
7
7
  //#region extensions/discord/src/target-resolver.ts
@@ -1,31 +1,23 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
2
  import { t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
3
- import "./targets-UWWZ6gF7.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-BMdJeJMc.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-5Sh7yedN.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-D0j7oh8S.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-NywKzUtc.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
  //#region 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
  //#endregion
@@ -247,11 +239,11 @@ var thread_bindings_exports = /* @__PURE__ */ __exportAll({
247
239
  reconcileAcpThreadBindingsOnStartup: () => reconcileAcpThreadBindingsOnStartup,
248
240
  resolveDiscordThreadBindingIdleTimeoutMs: () => resolveDiscordThreadBindingIdleTimeoutMs,
249
241
  resolveDiscordThreadBindingMaxAgeMs: () => resolveDiscordThreadBindingMaxAgeMs,
250
- resolveThreadBindingIdleTimeoutMs: () => resolveThreadBindingIdleTimeoutMs$1,
242
+ resolveThreadBindingIdleTimeoutMs: () => resolveThreadBindingIdleTimeoutMs,
251
243
  resolveThreadBindingInactivityExpiresAt: () => resolveThreadBindingInactivityExpiresAt,
252
244
  resolveThreadBindingIntroText: () => resolveThreadBindingIntroText$1,
253
245
  resolveThreadBindingMaxAgeExpiresAt: () => resolveThreadBindingMaxAgeExpiresAt,
254
- resolveThreadBindingMaxAgeMs: () => resolveThreadBindingMaxAgeMs$1,
246
+ resolveThreadBindingMaxAgeMs: () => resolveThreadBindingMaxAgeMs,
255
247
  resolveThreadBindingPersona: () => resolveThreadBindingPersona,
256
248
  resolveThreadBindingPersonaFromRecord: () => resolveThreadBindingPersonaFromRecord,
257
249
  resolveThreadBindingThreadName: () => resolveThreadBindingThreadName$1,
@@ -1,18 +1,18 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
- import { A as isDiscordThreadChannelType } from "./allow-list-BKqOldGy.mjs";
3
- import { P as createDiscordRestClient } from "./send.shared-CnlMgoqQ.mjs";
4
- import { G as withDiscordRequestAuthority, ft as getChannel, nt as createChannelWebhook } from "./discord-BMD-JiVS.mjs";
5
- import { p as canFallbackDiscordWebhookSend } from "./send.receipt-C18khRYH.mjs";
2
+ import { N as createDiscordRestClient } from "./send.shared-a_6Oeyg1.mjs";
3
+ import { O as getChannel, q as withDiscordRequestAuthority, t as discord_exports, z as DiscordError } from "./discord-DGVSguhx.mjs";
4
+ import { w as isDiscordThreadChannelType } from "./allow-list-BXrS8-R9.mjs";
5
+ import { p as canFallbackDiscordWebhookSend } from "./send.receipt-NZDOTZBU.mjs";
6
6
  import { n as resolveDiscordChannelId } from "./target-parsing-C-HyNxcE.mjs";
7
- import { c as sendWebhookMessageDiscord, u as createThreadDiscord } from "./send-da6ENJ9f.mjs";
8
- import { t as sendMessageDiscord } from "./send.outbound-qZ3iK3Vq.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-BMdJeJMc.mjs";
10
- import { n as resolveDiscordChannelInfoSafe, t as resolveDiscordChannelIdSafe } from "./channel-access-DasWY_OV.mjs";
7
+ import { c as sendWebhookMessageDiscord, u as createThreadDiscord } from "./send-CVW7V-VZ.mjs";
8
+ import { t as sendMessageDiscord } from "./send.outbound-Uzcmh3Yd.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-D0j7oh8S.mjs";
10
+ import { t as resolveDiscordChannelInfoSafe } from "./channel-access-9cyzozUP.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";
@@ -51,16 +51,11 @@ function normalizeDiscordBindingChannelId(raw) {
51
51
  }
52
52
  }
53
53
  function summarizeDiscordError(err) {
54
- if (err instanceof Error) return err.message;
55
- if (typeof err === "string" || typeof err === "number" || typeof err === "boolean" || typeof err === "bigint" || typeof err === "symbol") return String(err);
54
+ if (err instanceof Error || err != null && typeof err !== "object" && typeof err !== "function") return coerceErrorMessage(err);
56
55
  return "error";
57
56
  }
58
57
  function isDiscordThreadGoneError(err) {
59
- if (!err || typeof err !== "object") return false;
60
- const candidate = err;
61
- 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;
62
- const status = parseStrictNonNegativeInteger$1(candidate.status) ?? parseStrictNonNegativeInteger$1(candidate.statusCode) ?? parseStrictNonNegativeInteger$1(candidate.response?.status);
63
- return status === 404 || status === 403;
58
+ return err instanceof DiscordError && (err.discordCode === 10003 || err.status === 404 || err.status === 403);
64
59
  }
65
60
  async function maybeSendBindingMessage(params) {
66
61
  const assertCurrent = params.assertCurrent;
@@ -111,12 +106,13 @@ async function createWebhookForChannel(params) {
111
106
  accountId: params.accountId,
112
107
  token: params.token
113
108
  }).rest;
114
- const created = await withDiscordRequestAuthority(assertCreateAllowed, () => {
109
+ const rawCreated = await withDiscordRequestAuthority(assertCreateAllowed, () => {
115
110
  assertCreateAllowed?.();
116
- return createChannelWebhook(rest, params.channelId, { body: { name: "OpenClaw Agents" } });
111
+ return rest.post(discord_exports.Routes.channelWebhooks(params.channelId), { body: { name: "OpenClaw Agents" } });
117
112
  });
118
- const webhookId = normalizeOptionalString(created?.id) ?? "";
119
- const webhookToken = normalizeOptionalString(created?.token) ?? "";
113
+ const created = asNonArrayRecord(rawCreated);
114
+ const webhookId = normalizeOptionalString(created.id) ?? "";
115
+ const webhookToken = normalizeOptionalString(created.token) ?? "";
120
116
  if (!webhookId || !webhookToken) return {};
121
117
  return {
122
118
  webhookId,
@@ -128,21 +124,7 @@ async function createWebhookForChannel(params) {
128
124
  }
129
125
  }
130
126
  function findReusableWebhook(params) {
131
- const reusableKey = toReusableWebhookKey(params);
132
- const cached = REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL.get(reusableKey);
133
- if (cached) return {
134
- webhookId: cached.webhookId,
135
- webhookToken: cached.webhookToken
136
- };
137
- for (const record of BINDINGS_BY_THREAD_ID.values()) {
138
- if (record.accountId !== params.accountId || record.channelId !== params.channelId || !record.webhookId || !record.webhookToken) continue;
139
- rememberReusableWebhook(record);
140
- return {
141
- webhookId: record.webhookId,
142
- webhookToken: record.webhookToken
143
- };
144
- }
145
- return {};
127
+ return REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL.get(toReusableWebhookKey(params)) ?? {};
146
128
  }
147
129
  async function resolveChannelIdForBinding(params) {
148
130
  const explicit = normalizeDiscordBindingChannelId(params.channelId);
@@ -157,7 +139,7 @@ async function resolveChannelIdForBinding(params) {
157
139
  }).rest;
158
140
  const channel = await getChannel(rest, lookupThreadId);
159
141
  const channelInfo = resolveDiscordChannelInfoSafe(channel);
160
- const channelId = normalizeOptionalString(resolveDiscordChannelIdSafe(channel)) ?? "";
142
+ const channelId = normalizeOptionalString(channelInfo.id) ?? "";
161
143
  const type = channelInfo.type;
162
144
  const parentId = normalizeOptionalString(channelInfo.parentId) ?? "";
163
145
  if (parentId && isDiscordThreadChannelType(type)) return parentId;
@@ -320,7 +302,6 @@ function createNoopThreadBindingManager(accountIdRaw) {
320
302
  getIdleTimeoutMs: () => DEFAULT_THREAD_BINDING_IDLE_TIMEOUT_MS,
321
303
  getMaxAgeMs: () => 0,
322
304
  getByThreadId: () => void 0,
323
- getBySessionKey: () => void 0,
324
305
  listBySessionKey: () => [],
325
306
  listBindings: () => [],
326
307
  touchThread: async () => null,
@@ -513,11 +494,11 @@ function createLoadedThreadBindingManager(params) {
513
494
  text: resolveThreadBindingFarewellText({
514
495
  reason: notification.reason,
515
496
  farewellText: notification.farewellText,
516
- idleTimeoutMs: resolveThreadBindingIdleTimeoutMs$1({
497
+ idleTimeoutMs: resolveThreadBindingIdleTimeoutMs({
517
498
  record: removed,
518
499
  defaultIdleTimeoutMs: idleTimeoutMs
519
500
  }),
520
- maxAgeMs: resolveThreadBindingMaxAgeMs$1({
501
+ maxAgeMs: resolveThreadBindingMaxAgeMs({
521
502
  record: removed,
522
503
  defaultMaxAgeMs: maxAgeMs
523
504
  })
@@ -528,7 +509,6 @@ function createLoadedThreadBindingManager(params) {
528
509
  getIdleTimeoutMs: () => idleTimeoutMs,
529
510
  getMaxAgeMs: () => maxAgeMs,
530
511
  getByThreadId: (threadId) => getBinding(threadId)?.record,
531
- getBySessionKey: (targetSessionKey) => manager.listBySessionKey(targetSessionKey)[0],
532
512
  listBySessionKey: (targetSessionKey) => resolveBindingIdsForSession({
533
513
  targetSessionKey,
534
514
  accountId
@@ -760,7 +740,7 @@ function createLoadedThreadBindingManager(params) {
760
740
  sweepPromise = void 0;
761
741
  });
762
742
  }, THREAD_BINDINGS_SWEEP_INTERVAL_MS);
763
- if (shouldDefaultPersist()) sweepTimer.unref?.();
743
+ if (shouldDefaultPersist()) sweepTimer.unref();
764
744
  }
765
745
  const sessionBindingAdapter = createThreadBindingSessionAdapter({
766
746
  accountId,
@@ -1,3 +1,4 @@
1
+ import { J as stripUndefinedFields } from "./discord-DGVSguhx.mjs";
1
2
  import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.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
  //#region 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;
@@ -284,22 +285,15 @@ function snapshotThreadBindingJson(value) {
284
285
  return serialized ? JSON.parse(serialized) : void 0;
285
286
  }
286
287
  function snapshotThreadBindingMetadata(input) {
287
- return asOptionalObjectRecord(snapshotThreadBindingJson(input.metadata ? { ...input.metadata } : void 0));
288
- }
289
- function toPersistedBindingRecord(record) {
290
- return normalizePersistedBinding(record.threadId, snapshotThreadBindingJson(record)) ?? { ...record };
288
+ return asOptionalObjectRecord(snapshotThreadBindingJson(input.metadata));
291
289
  }
292
290
  function runThreadBindingAccountOperation(managers, operation) {
293
291
  if (managers.length === 0) return operation();
294
- const tails = THREAD_BINDINGS_STATE.accountOperationTails;
295
- const predecessors = managers.map((manager) => tails.get(manager) ?? Promise.resolve());
296
- const result = Promise.all(predecessors).then(operation);
297
- const settled = result.then(() => {}, () => {});
298
- for (const manager of managers) tails.set(manager, settled);
299
- settled.then(() => {
300
- for (const manager of managers) if (tails.get(manager) === settled) tails.delete(manager);
292
+ return enqueueKeyedTask({
293
+ tails: THREAD_BINDINGS_STATE.accountOperationTails,
294
+ keys: managers,
295
+ task: operation
301
296
  });
302
- return result;
303
297
  }
304
298
  function drainThreadBindingAccountOperations(manager) {
305
299
  return THREAD_BINDINGS_STATE.accountOperationTails.get(manager) ?? Promise.resolve();
@@ -334,8 +328,7 @@ async function commitBindingRecord(params) {
334
328
  const store = openThreadBindingsStoreAsync();
335
329
  for (const [key, record] of records) {
336
330
  assertCurrent();
337
- const persisted = toPersistedBindingRecord(record);
338
- await store.register(key, persisted, { assertCurrent });
331
+ await store.register(key, stripUndefinedFields(record), { assertCurrent });
339
332
  committedWrites += 1;
340
333
  targetCommitted ||= key === params.bindingKey;
341
334
  }
@@ -384,10 +377,10 @@ function persistBindingsSync(update) {
384
377
  for (const [key, record] of BINDINGS_BY_THREAD_ID) if (key === update?.bindingKey) {
385
378
  if (!store.update) throw new Error("Discord synchronous compatibility requires atomic state update");
386
379
  const next = update.transform(record);
387
- store.update(key, () => toPersistedBindingRecord(next));
380
+ store.update(key, () => stripUndefinedFields(next));
388
381
  updatedRecord = next;
389
382
  if (next !== record) setBindingRecord(next);
390
- } else store.register(key, toPersistedBindingRecord(record));
383
+ } else store.register(key, stripUndefinedFields(record));
391
384
  for (const entry of store.entries()) if (!BINDINGS_BY_THREAD_ID.has(entry.key)) store.delete(entry.key);
392
385
  THREAD_BINDINGS_STATE.loadedPersistentBindings = BINDINGS_BY_THREAD_ID.size > 0;
393
386
  THREAD_BINDINGS_STATE.lastPersistedAtMs = Date.now();
@@ -524,4 +517,4 @@ const setThreadBindingIdleTimeoutBySessionKey = idleSetters.set;
524
517
  /** @deprecated Use setThreadBindingMaxAgeBySessionKeyAsync; compatible through 2026-12-31, removed in the first January 2027 stable. */
525
518
  const setThreadBindingMaxAgeBySessionKey = maxAgeSetters.set;
526
519
  //#endregion
527
- 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 };
520
+ 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-B4FMCO8f.mjs";
2
- import { lt as createThread, pt as getChannelMessage, t as discord_exports } from "./discord-BMD-JiVS.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-8RDQrSVb.mjs";
2
+ import { T as createThread, k as getChannelMessage, t as discord_exports } from "./discord-DGVSguhx.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-ie9GBWaU.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
- //#region extensions/discord/src/monitor/thread-title.ts
11
+ //#region 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,8 +50,6 @@ function normalizeTitleContextField(raw, maxChars) {
81
50
  if (!value) return;
82
51
  return truncateThreadTitleText(value.replace(/\s+/g, " "), maxChars);
83
52
  }
84
- //#endregion
85
- //#region extensions/discord/src/monitor/threading.auto-thread.ts
86
53
  function resolveTrimmedDiscordMessageChannelId(params) {
87
54
  return (params.messageChannelId || resolveDiscordMessageChannelId({ message: params.message })).trim();
88
55
  }
@@ -131,7 +98,6 @@ async function resolveDiscordAutoThreadReplyPlan(params) {
131
98
  }) : null;
132
99
  return {
133
100
  ...deliveryPlan,
134
- createdThreadId,
135
101
  autoThreadContext
136
102
  };
137
103
  }
@@ -143,10 +109,7 @@ async function maybeCreateDiscordAutoThread(params) {
143
109
  const findExistingThread = async () => {
144
110
  try {
145
111
  const existingThreadId = (await getChannelMessage(params.client.rest, messageChannelId, params.message.id))?.thread?.id;
146
- if (existingThreadId) {
147
- logVerbose(`discord: autoThread reusing existing thread ${existingThreadId} on ${messageChannelId}/${params.message.id}`);
148
- return existingThreadId;
149
- }
112
+ if (existingThreadId) return existingThreadId;
150
113
  } catch {}
151
114
  };
152
115
  try {
@@ -163,27 +126,65 @@ async function maybeCreateDiscordAutoThread(params) {
163
126
  name: threadName,
164
127
  auto_archive_duration: archiveDuration
165
128
  } }, params.message.id))?.id || "";
166
- if (createdId && params.channelConfig?.autoThreadName === "generated" && params.cfg && params.agentId) {
167
- const modelRef = resolveDiscordThreadTitleModelRef({
168
- cfg: params.cfg,
169
- channel: params.channel,
170
- agentId: params.agentId,
171
- threadId: createdId,
172
- messageChannelId,
173
- channelName: params.channelName
174
- });
175
- maybeRenameDiscordAutoThread({
176
- client: params.client,
177
- threadId: createdId,
178
- currentName: threadName,
179
- fallbackId: params.message.id,
180
- sourceText: rawThreadSource,
181
- modelRef,
182
- channelName: params.channelName,
183
- channelDescription: params.channelDescription,
184
- cfg: params.cfg,
185
- 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
+ }
186
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
+ })();
187
188
  }
188
189
  return createdId || void 0;
189
190
  } catch (err) {
@@ -191,44 +192,6 @@ async function maybeCreateDiscordAutoThread(params) {
191
192
  return findExistingThread();
192
193
  }
193
194
  }
194
- function resolveDiscordThreadTitleModelRef(params) {
195
- const channel = params.channel?.trim();
196
- if (!channel) return;
197
- const parentSessionKey = buildAgentSessionKey({
198
- agentId: params.agentId,
199
- channel,
200
- peer: {
201
- kind: "channel",
202
- id: params.messageChannelId
203
- }
204
- });
205
- const channelLabel = params.channelName?.trim();
206
- const groupChannel = channelLabel ? `#${channelLabel}` : void 0;
207
- return resolveChannelModelOverride({
208
- cfg: params.cfg,
209
- channel,
210
- groupId: params.threadId,
211
- groupChatType: "channel",
212
- groupChannel,
213
- groupSubject: groupChannel,
214
- parentSessionKey
215
- })?.model;
216
- }
217
- async function maybeRenameDiscordAutoThread(params) {
218
- try {
219
- const fallbackName = sanitizeDiscordThreadName("", params.fallbackId);
220
- const generated = await generateThreadTitle({
221
- ...params,
222
- messageText: params.sourceText
223
- });
224
- if (!generated) return;
225
- const nextName = sanitizeDiscordThreadName(generated, params.fallbackId);
226
- if (!nextName || nextName === params.currentName || nextName === fallbackName) return;
227
- await params.client.rest.patch(Routes.channel(params.threadId), { body: { name: nextName } });
228
- } catch (err) {
229
- logVerbose(`discord: autoThread rename failed for ${params.threadId}: ${String(err)}`);
230
- }
231
- }
232
195
  //#endregion
233
196
  //#region extensions/discord/src/monitor/threading.ts
234
197
  var threading_exports = /* @__PURE__ */ __exportAll({
@@ -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]);