@openclaw/discord 2026.8.1-beta.2 → 2026.9.1-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 (287) hide show
  1. package/dist/{account-inspect-CqzrH14k.js → account-inspect-BDfKyuvL.js} +1 -1
  2. package/dist/account-inspect-api.js +1 -1
  3. package/dist/{accounts-DJTf1LtA.js → accounts-CfQ-vSyf.js} +34 -1
  4. package/dist/action-runtime-api.js +1 -1
  5. package/dist/{activities-api-DS7vpdtp.js → activities-api-q-9PaaHH.js} +134 -175
  6. package/dist/activities-api.js +1 -1
  7. package/dist/api.js +17 -17
  8. package/dist/{approval-handler.runtime-B6yEV79q.js → approval-handler.runtime-B7qhK3fR.js} +29 -106
  9. package/dist/{audit-Db-rlntl.js → audit-CBEv_ERu.js} +5 -5
  10. package/dist/{channel-CnnbJSt5.js → channel-Dx1tMTfx.js} +72 -50
  11. package/dist/{channel-actions.runtime-CLKrx6tr.js → channel-actions.runtime-CLWWu9nC.js} +28 -43
  12. package/dist/channel-config-api.js +1 -1
  13. package/dist/channel-plugin-api.js +1 -1
  14. package/dist/channel-type-CVLZyGYS.js +7 -0
  15. package/dist/{channel.setup-BFAO-V1P.js → channel.setup-DOzXS2Pk.js} +5 -5
  16. package/dist/{outbound-session-route-DxLkrgKQ.js → components-B9V5o361.js} +8 -70
  17. package/dist/{config-schema-BgEskFAs.js → config-schema-BR13IAx6.js} +33 -7
  18. package/dist/conversation-binding-route-DJYrY2TQ.js +43 -0
  19. package/dist/{directory-config-BVX7Cflc.js → directory-config-BK6eqekJ.js} +2 -2
  20. package/dist/directory-contract-api.js +1 -1
  21. package/dist/{directory-live-DGIGxpIo.js → directory-live-DSAJSrJk.js} +3 -3
  22. package/dist/{doctor-BzC-TLnB.js → doctor-Cm7Y1pJ2.js} +33 -12
  23. package/dist/doctor-contract-api.js +2 -2
  24. package/dist/{handle-action.guild-admin-BNVTUISF.js → handle-action.guild-admin-BdwCRHmm.js} +9 -5
  25. package/dist/index.js +3 -4
  26. package/dist/{message-handler-Unk_f10F.js → message-handler-BXpWZyni.js} +82 -6
  27. package/dist/{message-handler.preflight-C9zecxR9.js → message-handler.preflight-Ba5LAY_X.js} +38 -50
  28. package/dist/{message-handler.process-DWQ6UHHu.js → message-handler.process-3HEzmemS.js} +204 -234
  29. package/dist/{message-utils-BSCPVgy0.js → message-text-aiwO5R2F.js} +41 -40
  30. package/dist/{outbound-adapter-D9nRivT1.js → outbound-adapter-BE4jSq2d.js} +113 -88
  31. package/dist/{outbound-components-cTzwBJ60.js → outbound-components-oLpg8Qzb.js} +3 -3
  32. package/dist/outbound-session-route-Cg15ZFJd.js +625 -0
  33. package/dist/owner-access-UlYi9t0M.js +107 -0
  34. package/dist/{pluralkit-DdiJ9KMK.js → pluralkit-Tiyl70dx.js} +1 -1
  35. package/dist/{probe-Bl-k5_Ku.js → probe-n6ZXxK8V.js} +1 -1
  36. package/dist/{probe.runtime-M9fREKvp.js → probe.runtime-CN4bdPfZ.js} +1 -1
  37. package/dist/{provider-DvSNb-2v.js → provider-B11xwilq.js} +720 -1325
  38. package/dist/{provider-session.runtime-BUEqD0rA.js → provider-session.runtime-B9xe-Qaf.js} +3 -3
  39. package/dist/provider.runtime-DiYaHvOz.js +2 -0
  40. package/dist/{realtime-session.runtime-C7wen-aF.js → realtime-session.runtime-CU8IQUS-.js} +97 -98
  41. package/dist/{resolve-allowlist-common-D04lpEzb.js → resolve-allowlist-common-BLoYaxEG.js} +2 -2
  42. package/dist/{resolve-channels-Dm7jEeg6.js → resolve-channels-C2sT_n67.js} +5 -4
  43. package/dist/{resolve-users-bktrCUUU.js → resolve-users-CzpjLwjy.js} +2 -2
  44. package/dist/{retry-CLpJcXXf.js → retry-Cv4jCU5Z.js} +111 -18
  45. package/dist/{runtime-DGsSyDTS.js → runtime-BHrTlFkf.js} +88 -85
  46. package/dist/{runtime-DoHjckYm.js → runtime-CY4PRMF-.js} +9 -10
  47. package/dist/runtime-api.js +19 -25
  48. package/dist/{sdk-runtime-QpY8PvCh.js → sdk-runtime-4geQHtXc.js} +57 -89
  49. package/dist/{secret-config-contract-B1akrlyY.js → secret-config-contract-B3i6WxV5.js} +53 -25
  50. package/dist/secret-contract-api.js +1 -1
  51. package/dist/security-audit-contract-api.js +1 -1
  52. package/dist/{security-audit.runtime-CPN0xFYz.js → security-audit.runtime-BVKF9VtY.js} +1 -1
  53. package/dist/{send-B7Q6Oc1I.js → send-C49MFF9j.js} +82 -19
  54. package/dist/{send.components-iJyFXw9L.js → send.components-DKKAw5VX.js} +21 -38
  55. package/dist/{send.outbound-DS5tHwfR.js → send.outbound-zam0TrZx.js} +77 -78
  56. package/dist/{send.shared-BmwFjW6T.js → send.shared-JjljcV4O.js} +135 -120
  57. package/dist/{sender-identity-QtalnCYv.js → sender-identity-BJtfyise.js} +1 -1
  58. package/dist/setup-plugin-api.js +1 -1
  59. package/dist/{shared-BIXIX6uJ.js → shared-_5EcP4jW.js} +38 -14
  60. package/dist/subagent-hooks-DQzvOptn.js +49 -0
  61. package/dist/subagent-hooks-api.js +1 -6
  62. package/dist/{system-events-CTqDf6_s.js → system-events-C7yxaHWP.js} +2 -2
  63. package/dist/{target-resolver-maOKSqO0.js → target-resolver-vxIh6O3-.js} +3 -3
  64. package/dist/targets-CtTKvntJ.js +3 -0
  65. package/dist/{thread-bindings-3L8p82GV.js → thread-bindings-DW5F9vat.js} +28 -26
  66. package/dist/{thread-bindings.manager-DCIH6WDC.js → thread-bindings.manager-ByOtwjo_.js} +9 -12
  67. package/dist/{thread-bindings.session-updates-bJ2KQFY6.js → thread-bindings.session-updates-CJb-BpPL.js} +1 -1
  68. package/dist/{thread-bindings.state-aeV8HNgV.js → thread-bindings.state-D8OMdk4O.js} +1 -1
  69. package/dist/threading-agH1T_6s.js +478 -0
  70. package/dist/transcripts-source-BR11iHA4.js +265 -0
  71. package/dist/transcripts-source-api.js +7 -2
  72. package/dist/{typing-CS-nNVoe.js → typing-Dc_YMY2e.js} +1 -1
  73. package/dist/{voice-runtime-BEdqNcST.js → voice-runtime-DIeaa8fJ.js} +230 -148
  74. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/README.md +19 -19
  75. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v1.js +7 -3
  76. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v7.js +5 -2
  77. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v1.js +7 -3
  78. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v7.js +5 -2
  79. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/package.json +4 -3
  80. package/node_modules/@discordjs/voice/node_modules/@types/node/README.md +1 -1
  81. package/node_modules/@discordjs/voice/node_modules/@types/node/child_process.d.ts +0 -1
  82. package/node_modules/@discordjs/voice/node_modules/@types/node/crypto.d.ts +6 -6
  83. package/node_modules/@discordjs/voice/node_modules/@types/node/dns/promises.d.ts +5 -5
  84. package/node_modules/@discordjs/voice/node_modules/@types/node/dns.d.ts +5 -5
  85. package/node_modules/@discordjs/voice/node_modules/@types/node/fs.d.ts +7 -0
  86. package/node_modules/@discordjs/voice/node_modules/@types/node/http.d.ts +30 -0
  87. package/node_modules/@discordjs/voice/node_modules/@types/node/http2.d.ts +4 -4
  88. package/node_modules/@discordjs/voice/node_modules/@types/node/os.d.ts +30 -30
  89. package/node_modules/@discordjs/voice/node_modules/@types/node/package.json +2 -2
  90. package/node_modules/@discordjs/voice/node_modules/@types/node/perf_hooks.d.ts +2 -1
  91. package/node_modules/@discordjs/voice/node_modules/@types/node/process.d.ts +42 -43
  92. package/node_modules/@discordjs/voice/node_modules/@types/node/quic.d.ts +1049 -84
  93. package/node_modules/@discordjs/voice/node_modules/@types/node/sqlite.d.ts +14 -1
  94. package/node_modules/@discordjs/voice/node_modules/@types/node/stream/iter.d.ts +3 -2
  95. package/node_modules/@discordjs/voice/node_modules/@types/node/test.d.ts +61 -0
  96. package/node_modules/@discordjs/voice/node_modules/@types/node/v8.d.ts +20 -23
  97. package/node_modules/discord-api-types/CHANGELOG.md +8 -0
  98. package/node_modules/discord-api-types/package.json +4 -4
  99. package/node_modules/discord-api-types/payloads/v10/channel.d.ts +2 -2
  100. package/node_modules/discord-api-types/payloads/v10/channel.d.ts.map +1 -1
  101. package/node_modules/discord-api-types/payloads/v10/gateway.d.ts +4 -0
  102. package/node_modules/discord-api-types/payloads/v10/gateway.d.ts.map +1 -1
  103. package/node_modules/discord-api-types/payloads/v10/gateway.js.map +1 -1
  104. package/node_modules/discord-api-types/payloads/v10/message.d.ts +4 -1
  105. package/node_modules/discord-api-types/payloads/v10/message.d.ts.map +1 -1
  106. package/node_modules/discord-api-types/payloads/v10/message.js +1 -0
  107. package/node_modules/discord-api-types/payloads/v10/message.js.map +1 -1
  108. package/node_modules/discord-api-types/payloads/v9/channel.d.ts +2 -2
  109. package/node_modules/discord-api-types/payloads/v9/channel.d.ts.map +1 -1
  110. package/node_modules/discord-api-types/payloads/v9/gateway.d.ts +4 -0
  111. package/node_modules/discord-api-types/payloads/v9/gateway.d.ts.map +1 -1
  112. package/node_modules/discord-api-types/payloads/v9/gateway.js.map +1 -1
  113. package/node_modules/discord-api-types/payloads/v9/message.d.ts +4 -1
  114. package/node_modules/discord-api-types/payloads/v9/message.d.ts.map +1 -1
  115. package/node_modules/discord-api-types/payloads/v9/message.js +1 -0
  116. package/node_modules/discord-api-types/payloads/v9/message.js.map +1 -1
  117. package/node_modules/typebox/build/format/date.d.mts +1 -1
  118. package/node_modules/typebox/build/format/date.mjs +1 -1
  119. package/node_modules/typebox/build/format/date_time.d.mts +2 -2
  120. package/node_modules/typebox/build/format/date_time.mjs +3 -3
  121. package/node_modules/typebox/build/format/email.d.mts +1 -1
  122. package/node_modules/typebox/build/format/email.mjs +2 -2
  123. package/node_modules/typebox/build/format/hostname.mjs +2 -10
  124. package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
  125. package/node_modules/typebox/build/format/idn_email.mjs +3 -3
  126. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
  127. package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
  128. package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
  129. package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
  130. package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
  131. package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
  132. package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
  133. package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
  134. package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
  135. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
  136. package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
  137. package/node_modules/typebox/build/format/idna/index.mjs +2 -0
  138. package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
  139. package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
  140. package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
  141. package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
  142. package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
  143. package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
  144. package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
  145. package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
  146. package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
  147. package/node_modules/typebox/build/format/ipv4.mjs +2 -32
  148. package/node_modules/typebox/build/format/ipv6.mjs +2 -61
  149. package/node_modules/typebox/build/format/iri.d.mts +2 -2
  150. package/node_modules/typebox/build/format/iri.mjs +26 -8
  151. package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
  152. package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
  153. package/node_modules/typebox/build/format/regex.d.mts +1 -2
  154. package/node_modules/typebox/build/format/regex.mjs +2 -6
  155. package/node_modules/typebox/build/format/time.d.mts +2 -2
  156. package/node_modules/typebox/build/format/time.mjs +19 -14
  157. package/node_modules/typebox/build/format/uri.d.mts +1 -1
  158. package/node_modules/typebox/build/format/uri.mjs +3 -130
  159. package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
  160. package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
  161. package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
  162. package/node_modules/typebox/build/format/uri_template.mjs +4 -5
  163. package/node_modules/typebox/build/format/url.d.mts +3 -3
  164. package/node_modules/typebox/build/format/url.mjs +4 -5
  165. package/node_modules/typebox/build/guard/emit.d.mts +3 -1
  166. package/node_modules/typebox/build/guard/emit.mjs +12 -5
  167. package/node_modules/typebox/build/guard/guard.d.mts +8 -2
  168. package/node_modules/typebox/build/guard/guard.mjs +25 -4
  169. package/node_modules/typebox/build/guard/string.d.mts +2 -2
  170. package/node_modules/typebox/build/guard/string.mjs +7 -7
  171. package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
  172. package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
  173. package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
  174. package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
  175. package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
  176. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
  177. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
  178. package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
  179. package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
  180. package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
  181. package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
  182. package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
  183. package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
  184. package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
  185. package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
  186. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
  187. package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
  188. package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
  189. package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
  190. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
  191. package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
  192. package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
  193. package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
  194. package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
  195. package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
  196. package/node_modules/typebox/build/schema/types/index.mjs +0 -2
  197. package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
  198. package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
  199. package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
  200. package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
  201. package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
  202. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
  203. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
  204. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
  205. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
  206. package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
  207. package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
  208. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
  209. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
  210. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
  211. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
  212. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
  213. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
  214. package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
  215. package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
  216. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
  217. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
  218. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
  219. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
  220. package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
  221. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
  222. package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
  223. package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
  224. package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
  225. package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
  226. package/node_modules/typebox/build/type/script/parser.mjs +27 -23
  227. package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
  228. package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
  229. package/node_modules/typebox/package.json +27 -27
  230. package/node_modules/typebox/readme.md +79 -82
  231. package/node_modules/undici/docs/docs/api/Client.md +21 -8
  232. package/node_modules/undici/lib/api/readable.js +33 -43
  233. package/node_modules/undici/lib/core/connect.js +16 -2
  234. package/node_modules/undici/lib/core/symbols.js +1 -0
  235. package/node_modules/undici/lib/dispatcher/client-h1.js +3 -3
  236. package/node_modules/undici/lib/dispatcher/client-h2.js +179 -10
  237. package/node_modules/undici/lib/dispatcher/client.js +74 -29
  238. package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +28 -6
  239. package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +15 -1
  240. package/node_modules/undici/lib/handler/retry-handler.js +7 -2
  241. package/node_modules/undici/lib/interceptor/cache.js +5 -2
  242. package/node_modules/undici/lib/interceptor/deduplicate.js +1 -1
  243. package/node_modules/undici/lib/mock/mock-utils.js +213 -24
  244. package/node_modules/undici/lib/util/cache.js +2 -4
  245. package/node_modules/undici/lib/web/websocket/websocket.js +22 -0
  246. package/node_modules/undici/package.json +1 -1
  247. package/node_modules/undici/types/client.d.ts +40 -0
  248. package/node_modules/ws/lib/permessage-deflate.js +3 -1
  249. package/node_modules/ws/package.json +1 -1
  250. package/openclaw.plugin.json +12 -6
  251. package/package.json +8 -10
  252. package/dist/approval-message-safety-AcIxvrf3.js +0 -140
  253. package/dist/audit-core-xwjIczO0.js +0 -105
  254. package/dist/channel-actions-5s_hjYKd.js +0 -208
  255. package/dist/channel-api-CAJ0wMoV.js +0 -21
  256. package/dist/inbound-event-delivery-De2qxTrP.js +0 -39
  257. package/dist/provider.runtime-C9PnJZbZ.js +0 -2
  258. package/dist/runtime-api.actions.js +0 -3
  259. package/dist/runtime-api.lookup.js +0 -7
  260. package/dist/runtime-api.monitor-CHxrFPnW.js +0 -5
  261. package/dist/runtime-api.monitor.js +0 -8
  262. package/dist/runtime-api.send.js +0 -7
  263. package/dist/runtime-api.threads.js +0 -5
  264. package/dist/send.reactions-BAn0iiVQ.js +0 -78
  265. package/dist/send.receipt-IPI1p-SP.js +0 -66
  266. package/dist/subagent-hooks-CTt5KCJr.js +0 -120
  267. package/dist/subagent-progress-DhaE_h8a.js +0 -109
  268. package/dist/targets-yUFTHoAx.js +0 -3
  269. package/dist/transcripts-source-CfFMexGt.js +0 -123
  270. package/node_modules/p-map/index.d.ts +0 -155
  271. package/node_modules/p-map/index.js +0 -285
  272. package/node_modules/p-map/license +0 -9
  273. package/node_modules/p-map/package.json +0 -57
  274. package/node_modules/p-map/readme.md +0 -190
  275. package/node_modules/typebox/build/format/_idna.d.mts +0 -2
  276. package/node_modules/typebox/build/format/_idna.mjs +0 -246
  277. package/node_modules/typebox/build/format/_puny.d.mts +0 -1
  278. package/node_modules/typebox/build/format/_puny.mjs +0 -77
  279. package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
  280. package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
  281. package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
  282. package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
  283. package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
  284. package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
  285. package/dist/{allow-list-DnxIlPP2.js → allow-list-BDMimASD.js} +1 -1
  286. package/dist/{doctor-contract-DLa-BTiU.js → doctor-contract-DsWvKIXF.js} +1 -1
  287. package/dist/{security-audit-jGnJF__m.js → security-audit-BfJhAXZp.js} +1 -1
@@ -1,6 +1,6 @@
1
- import { n as createThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-DCIH6WDC.js";
2
- import { a as reconcileAcpThreadBindingsOnStartup } from "./thread-bindings-3L8p82GV.js";
3
- import { t as createDiscordMessageHandler } from "./message-handler-Unk_f10F.js";
1
+ import { n as createThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-ByOtwjo_.js";
2
+ import { a as reconcileAcpThreadBindingsOnStartup } from "./thread-bindings-DW5F9vat.js";
3
+ import { t as createDiscordMessageHandler } from "./message-handler-BXpWZyni.js";
4
4
  import { resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled } from "openclaw/plugin-sdk/conversation-runtime";
5
5
  import { getAcpSessionManager, isAcpRuntimeError } from "openclaw/plugin-sdk/acp-runtime";
6
6
  export { createDiscordMessageHandler, createNoopThreadBindingManager, createThreadBindingManager, getAcpSessionManager, isAcpRuntimeError, reconcileAcpThreadBindingsOnStartup, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled };
@@ -0,0 +1,2 @@
1
+ import { t as monitorDiscordProvider } from "./provider-B11xwilq.js";
2
+ export { monitorDiscordProvider };
@@ -1,9 +1,11 @@
1
- import { S as formatVoiceLogPreview, b as formatVoiceIngressPrompt, h as createDiscordOpusEncodeStream, m as convertRealtimePcm24kMonoToDiscordPcm48kStereo, p as convertDiscordPcm48kStereoToRealtimePcm24kMono, t as loadDiscordVoiceSdk, u as logVoiceVerbose, x as maybeControlDiscordVoiceAgentRun } from "./sdk-runtime-QpY8PvCh.js";
1
+ import { n as discordRealtimeVoiceSecretOwnerId } from "./secret-config-contract-B3i6WxV5.js";
2
+ import { b as maybeControlDiscordVoiceAgentRun, f as convertDiscordPcm48kStereoToRealtimePcm24kMono, l as logVoiceVerbose, m as createDiscordOpusEncodeStream, p as convertRealtimePcm24kMonoToDiscordPcm48kStereo, t as loadDiscordVoiceSdk, x as formatVoiceLogPreview, y as formatVoiceIngressPrompt } from "./sdk-runtime-4geQHtXc.js";
2
3
  import { asDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
3
4
  import { formatErrorMessage } from "openclaw/plugin-sdk/ssrf-runtime";
4
5
  import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
5
6
  import { sliceUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
6
- import { REALTIME_VOICE_AGENT_CONSULT_TOOL_NAME, REALTIME_VOICE_AGENT_CONTROL_TOOL, REALTIME_VOICE_AGENT_CONTROL_TOOL_NAME, REALTIME_VOICE_AUDIO_FORMAT_PCM16_24KHZ, buildRealtimeVoiceSessionInstructions, buildRealtimeVoiceSpeakExactMessage, classifyRealtimeVoiceConsultToolCall, classifySkippableRealtimeVoiceConsultTranscript, controlRealtimeVoiceAgentRun, createRealtimeVoiceAgentTalkbackQueue, createRealtimeVoiceSessionHarness, createRealtimeVoiceTurnContextTracker, isRealtimeVoiceWakeNameRequired, matchRealtimeVoiceActivationName, matchRealtimeVoiceConsultQuestions, parseRealtimeVoiceAgentControlToolArgs, resolveConfiguredRealtimeVoiceProvider, resolveRealtimeVoiceAgentConsultTools, resolveRealtimeVoiceBargeIn, resolveRealtimeVoiceInterruptResponseOnInputAudio, resolveRealtimeVoiceMinBargeInAudioEndMs, resolveRealtimeVoiceSessionPolicy } from "openclaw/plugin-sdk/realtime-voice";
7
+ import { assertSecretOwnerAvailable, isSecretOwnerAvailable } from "openclaw/plugin-sdk/channel-secret-owner-runtime";
8
+ import { REALTIME_VOICE_AGENT_CONSULT_TOOL_NAME, REALTIME_VOICE_AGENT_CONTROL_TOOL, REALTIME_VOICE_AGENT_CONTROL_TOOL_NAME, REALTIME_VOICE_AUDIO_FORMAT_PCM16_24KHZ, buildRealtimeVoiceSessionInstructions, buildRealtimeVoiceSpeakExactMessage, canonicalizeRealtimeVoiceProviderId, classifyRealtimeVoiceConsultToolCall, classifySkippableRealtimeVoiceConsultTranscript, controlRealtimeVoiceAgentRun, createRealtimeVoiceAgentTalkbackQueue, createRealtimeVoiceSessionHarness, createRealtimeVoiceTurnContextTracker, isRealtimeVoiceWakeNameRequired, matchRealtimeVoiceActivationName, matchRealtimeVoiceConsultQuestions, parseRealtimeVoiceAgentControlToolArgs, realtimeVoiceAudioDurationMs, resolveConfiguredRealtimeVoiceProvider, resolveRealtimeVoiceAgentConsultTools, resolveRealtimeVoiceBargeIn, resolveRealtimeVoiceInterruptResponseOnInputAudio, resolveRealtimeVoiceMinBargeInAudioEndMs, resolveRealtimeVoiceSessionPolicy } from "openclaw/plugin-sdk/realtime-voice";
7
9
  import { PassThrough, pipeline } from "node:stream";
8
10
  //#region extensions/discord/src/voice/realtime-transcript.ts
9
11
  function mergeRealtimePartialTranscript(previous, next) {
@@ -17,7 +19,7 @@ const logger$3 = createSubsystemLogger("discord/voice");
17
19
  const DISCORD_REALTIME_PENDING_SPEAKER_CONTEXT_LIMIT = 32;
18
20
  const DISCORD_REALTIME_IGNORED_WAKE_NAME_CONTEXT_TTL_MS = 1e4;
19
21
  const DISCORD_REALTIME_WAKE_NAME_FOLLOWUP_TTL_MS = 1e4;
20
- const REALTIME_PCM16_BYTES_PER_SAMPLE$1 = 2;
22
+ const REALTIME_PCM16_BYTES_PER_SAMPLE = 2;
21
23
  const DISCORD_REALTIME_TRAILING_SILENCE_MIN_MS = 700;
22
24
  const DISCORD_REALTIME_TRAILING_SILENCE_MAX_MS = 3e3;
23
25
  var DiscordRealtimeTurns = class {
@@ -153,7 +155,7 @@ var DiscordRealtimeTurns = class {
153
155
  const providerId = this.params.providerId() ?? this.params.realtimeConfig()?.provider ?? "openai";
154
156
  const rawSilenceDurationMs = (this.params.realtimeConfig()?.providers?.[providerId])?.silenceDurationMs;
155
157
  const silenceMs = Math.min(DISCORD_REALTIME_TRAILING_SILENCE_MAX_MS, Math.max(DISCORD_REALTIME_TRAILING_SILENCE_MIN_MS, typeof rawSilenceDurationMs === "number" && Number.isFinite(rawSilenceDurationMs) ? rawSilenceDurationMs : 0));
156
- const silenceBytes = Math.ceil(24e3 * silenceMs / 1e3) * REALTIME_PCM16_BYTES_PER_SAMPLE$1;
158
+ const silenceBytes = Math.ceil(24e3 * silenceMs / 1e3) * REALTIME_PCM16_BYTES_PER_SAMPLE;
157
159
  const silence = Buffer.alloc(silenceBytes);
158
160
  bridge.sendAudio(silence);
159
161
  logger$3.info(`discord voice: realtime trailing silence sent guild=${this.params.entry.guildId} channel=${this.params.entry.channelId} user=${turn.context.userId} speaker=${turn.context.speakerLabel} silenceMs=${silenceMs} realtimeBytes=${silence.length}`);
@@ -356,7 +358,9 @@ var DiscordRealtimeConsults = class {
356
358
  await session.submitToolResult(callId, { text });
357
359
  }
358
360
  async handleAcceptedTranscript(acceptedText, forcedSpeakerContext, providerEpoch) {
359
- const pendingForcedConsult = this.params.isAgentProxy && this.params.usesRealtimeAgentHandoff() ? this.prepareForcedAgentProxyConsult(acceptedText, forcedSpeakerContext) : void 0;
361
+ const usesRealtimeAgentHandoff = this.params.usesRealtimeAgentHandoff();
362
+ const fallbackSpeakerContext = this.params.isAgentProxy && !usesRealtimeAgentHandoff ? forcedSpeakerContext ?? this.params.turns.consumePendingSpeakerContext() : void 0;
363
+ const pendingForcedConsult = this.params.isAgentProxy && usesRealtimeAgentHandoff ? this.prepareForcedAgentProxyConsult(acceptedText, forcedSpeakerContext) : void 0;
360
364
  let control;
361
365
  try {
362
366
  control = await maybeControlDiscordVoiceAgentRun({
@@ -376,11 +380,11 @@ var DiscordRealtimeConsults = class {
376
380
  return;
377
381
  }
378
382
  if (!this.params.isAgentProxy) return;
379
- if (this.params.usesRealtimeAgentHandoff()) {
383
+ if (usesRealtimeAgentHandoff) {
380
384
  if (pendingForcedConsult) this.schedulePreparedForcedAgentProxyConsult(pendingForcedConsult);
381
385
  return;
382
386
  }
383
- this.talkback.enqueue(acceptedText, forcedSpeakerContext ?? this.params.turns.consumePendingSpeakerContext());
387
+ this.talkback.enqueue(acceptedText, fallbackSpeakerContext);
384
388
  }
385
389
  createTalkbackQueue() {
386
390
  const providerEpoch = this.params.providerEpoch();
@@ -625,35 +629,27 @@ var DiscordRealtimeConsults = class {
625
629
  //#region extensions/discord/src/voice/realtime-playback.ts
626
630
  const logger$1 = createSubsystemLogger("discord/voice");
627
631
  const DISCORD_REALTIME_CONTROL_SPEECH_DEDUPE_MS = 5e3;
628
- const DISCORD_REALTIME_OUTPUT_PLAYBACK_WATCHDOG_MARGIN_MS = 1500;
632
+ const DISCORD_REALTIME_OUTPUT_PLAYBACK_WATCHDOG_MARGIN_MS = 3e3;
629
633
  const DISCORD_REALTIME_MAX_RETAINED_EXACT_SPEECH_MESSAGES = 32;
630
634
  const DISCORD_REALTIME_MAX_RETAINED_EXACT_SPEECH_BYTES = 32 * 1024;
631
- const DISCORD_REALTIME_CANCELLATION_RACE_DETAIL = "Cancellation failed: no active response found";
632
635
  const DISCORD_REALTIME_WAKE_ACKS = [
633
636
  "Yeah.",
634
637
  "Mm-hmm.",
635
638
  "Got it.",
636
639
  "One sec."
637
640
  ];
638
- const REALTIME_PCM16_BYTES_PER_SAMPLE = 2;
639
641
  const DISCORD_RAW_PCM_FRAME_BYTES = 3840;
640
642
  const DISCORD_REALTIME_OUTPUT_PREROLL_FRAMES = 25;
641
- function isRealtimeResponseCancellationRace(event) {
642
- return event.direction === "server" && event.type === "error" && event.detail === DISCORD_REALTIME_CANCELLATION_RACE_DETAIL;
643
- }
643
+ const DISCORD_REALTIME_MAX_PENDING_OUTPUT_BYTES = DISCORD_RAW_PCM_FRAME_BYTES * 6e3;
644
644
  function normalizeControlSpeechText(text) {
645
645
  return text.toLowerCase().replace(/\s+/g, " ").trim();
646
646
  }
647
- function pcm16MonoDurationMs(audio, sampleRate) {
648
- if (audio.length === 0 || sampleRate <= 0) return 0;
649
- return audio.length / REALTIME_PCM16_BYTES_PER_SAMPLE * 1e3 / sampleRate;
650
- }
651
647
  var DiscordRealtimePlayback = class {
652
648
  constructor(params) {
653
649
  this.params = params;
654
650
  this.outputStream = null;
655
- this.outputPacedBuffer = Buffer.alloc(0);
656
- this.playbackState = { status: "idle" };
651
+ this.outputPacedBuffers = [];
652
+ this.outputPacedBytes = 0;
657
653
  this.queuedExactSpeechMessages = [];
658
654
  this.exactSpeechState = { status: "idle" };
659
655
  this.wakeNameAckIndex = 0;
@@ -668,7 +664,6 @@ var DiscordRealtimePlayback = class {
668
664
  this.params.entry.player.on(voiceSdk.AudioPlayerStatus.Idle, this.playerIdleHandler);
669
665
  }
670
666
  close() {
671
- this.playbackState = { status: "idle" };
672
667
  this.queuedExactSpeechMessages = [];
673
668
  this.exactSpeechState = { status: "idle" };
674
669
  this.clearOutputAudio("session-close");
@@ -703,7 +698,7 @@ var DiscordRealtimePlayback = class {
703
698
  }
704
699
  sendOutputAudio(realtimePcm24kMono) {
705
700
  this.params.markProviderGenerationObserved();
706
- if (this.params.stopped() || this.playbackState.status === "backpressured") return;
701
+ if (this.params.stopped()) return;
707
702
  const discordPcm = convertRealtimePcm24kMonoToDiscordPcm48kStereo(realtimePcm24kMono);
708
703
  if (discordPcm.length === 0) return;
709
704
  this.params.bridge()?.setMediaTimestamp(this.outputAudioMs());
@@ -717,7 +712,7 @@ var DiscordRealtimePlayback = class {
717
712
  audioStarted: true
718
713
  };
719
714
  this.params.harness.recordOutputAudio(realtimePcm24kMono, {
720
- audioMs: pcm16MonoDurationMs(realtimePcm24kMono, 24e3),
715
+ audioMs: realtimeVoiceAudioDurationMs(REALTIME_VOICE_AUDIO_FORMAT_PCM16_24KHZ, realtimePcm24kMono.byteLength),
721
716
  sourceAudioBytes: realtimePcm24kMono.length,
722
717
  sinkAudioBytes: discordPcm.length
723
718
  });
@@ -741,19 +736,10 @@ var DiscordRealtimePlayback = class {
741
736
  this.completeExactSpeechResponse(reason);
742
737
  return;
743
738
  }
744
- stream.end();
745
- }
746
- handleProviderEvent(event) {
747
- if (!(this.playbackState.status === "backpressured" && isRealtimeResponseCancellationRace(event))) return;
748
- const outputBackpressured = this.playbackState.status === "backpressured";
749
- if (outputBackpressured) this.playbackState = { status: "idle" };
750
- if (this.exactSpeechState.status === "active" && (outputBackpressured || !this.exactSpeechState.audioStarted)) this.completeExactSpeechResponse(event.type);
751
- this.finishOutputAudioStream(event.type, { playBuffered: false });
739
+ if (!this.outputDrainHandler) stream.end();
752
740
  }
753
741
  handleResponseDone(outcome) {
754
- const outputBackpressured = this.playbackState.status === "backpressured";
755
- if (outputBackpressured) this.playbackState = { status: "idle" };
756
- if (this.exactSpeechState.status === "active" && (outputBackpressured || !this.exactSpeechState.audioStarted)) this.completeExactSpeechResponse(outcome.status);
742
+ if (this.exactSpeechState.status === "active" && !this.exactSpeechState.audioStarted) this.completeExactSpeechResponse(outcome.status);
757
743
  this.finishOutputAudioStream(outcome.status, { playBuffered: outcome.status === "completed" });
758
744
  }
759
745
  enqueueExactSpeechMessage(text) {
@@ -762,11 +748,7 @@ var DiscordRealtimePlayback = class {
762
748
  const retainedBytes = this.queuedExactSpeechMessages.reduce((total, message) => total + Buffer.byteLength(message, "utf8"), 0) + Buffer.byteLength(this.exactSpeechState.status === "active" ? this.exactSpeechState.message : "", "utf8");
763
749
  const incomingBytes = Buffer.byteLength(text, "utf8");
764
750
  if (retainedMessages >= DISCORD_REALTIME_MAX_RETAINED_EXACT_SPEECH_MESSAGES || retainedBytes + incomingBytes > DISCORD_REALTIME_MAX_RETAINED_EXACT_SPEECH_BYTES) {
765
- this.params.stopTerminally();
766
- this.queuedExactSpeechMessages = [];
767
- this.exactSpeechState = { status: "idle" };
768
- this.clearOutputAudio("exact-speech-overflow");
769
- this.params.onTerminalError(/* @__PURE__ */ new Error(`Discord realtime exact speech overflow: retained=${retainedMessages} retainedBytes=${retainedBytes} incomingBytes=${incomingBytes}`));
751
+ this.stopAfterOverflow("exact-speech-overflow", /* @__PURE__ */ new Error(`Discord realtime exact speech overflow: retained=${retainedMessages} retainedBytes=${retainedBytes} incomingBytes=${incomingBytes}`));
770
752
  return;
771
753
  }
772
754
  if (!this.params.bridgeReady() || this.exactSpeechState.status === "active" || this.hasInterruptibleOutputAudio()) {
@@ -846,84 +828,83 @@ var DiscordRealtimePlayback = class {
846
828
  currentOutputStream() {
847
829
  return this.outputStream;
848
830
  }
831
+ stopAfterOverflow(reason, error) {
832
+ this.params.stopTerminally(reason);
833
+ this.queuedExactSpeechMessages = [];
834
+ this.exactSpeechState = { status: "idle" };
835
+ this.clearOutputAudio(reason);
836
+ this.params.onTerminalError(error);
837
+ }
849
838
  ensureOutputStream() {
850
839
  if (this.outputStream && !this.outputStream.destroyed && !this.outputStream.writableEnded) return this.outputStream;
851
840
  const stream = new PassThrough({ highWaterMark: DISCORD_RAW_PCM_FRAME_BYTES * 128 });
852
841
  this.outputStream = stream;
853
- this.playbackState = {
854
- status: "buffering",
855
- stream
856
- };
857
- this.outputPacedBuffer = Buffer.alloc(0);
842
+ this.outputPacedBuffers = [];
843
+ this.outputPacedBytes = 0;
858
844
  this.params.harness.outputActivity.markStreamOpened();
859
845
  stream.once("close", () => {
860
- if (this.params.harness.outputActivity.snapshot().playbackStarted) return;
861
- this.handleOutputStreamClosed(stream, "stream-close");
846
+ if (this.outputStream !== stream || this.params.harness.outputActivity.snapshot().playbackStarted) return;
847
+ this.resetOutputStream("stream-close");
848
+ this.completeExactSpeechResponse("stream-close");
862
849
  });
863
850
  return stream;
864
851
  }
865
- handleOutputStreamClosed(stream, reason) {
866
- if (this.outputStream !== stream) return;
867
- this.logOutputAudioStopped(reason);
868
- this.clearOutputPlaybackWatchdog();
869
- this.outputStream = null;
870
- if (this.playbackState.status !== "backpressured") this.playbackState = { status: "idle" };
871
- this.outputPacedBuffer = Buffer.alloc(0);
872
- this.params.harness.outputActivity.reset();
873
- this.completeExactSpeechResponse(reason);
874
- }
875
852
  queueOutputAudio(stream, discordPcm) {
876
- if (this.playbackState.status === "playing") {
877
- if (!stream.write(discordPcm)) this.handleOutputBackpressure(stream);
853
+ const pendingBytes = this.outputPacedBytes + stream.writableLength + stream.readableLength;
854
+ if (discordPcm.length > DISCORD_REALTIME_MAX_PENDING_OUTPUT_BYTES - pendingBytes) {
855
+ this.stopAfterOverflow("output-audio-overflow", /* @__PURE__ */ new Error(`Discord realtime audio playback overflow: pendingBytes=${pendingBytes} incomingBytes=${discordPcm.length}`));
878
856
  return;
879
857
  }
880
- this.outputPacedBuffer = this.outputPacedBuffer.length > 0 ? Buffer.concat([this.outputPacedBuffer, discordPcm]) : discordPcm;
881
- if (this.outputPacedBuffer.length >= DISCORD_RAW_PCM_FRAME_BYTES * DISCORD_REALTIME_OUTPUT_PREROLL_FRAMES) this.startOutputPlayback(stream);
882
- }
883
- handleOutputBackpressure(stream) {
884
- if (this.playbackState.status === "backpressured" || this.outputStream !== stream) return;
885
- const token = Symbol("output-backpressure");
886
- this.playbackState = {
887
- status: "backpressured",
888
- stream,
889
- token
858
+ if (this.params.harness.outputActivity.snapshot().playbackStarted && !this.outputDrainHandler) {
859
+ if (!stream.write(discordPcm)) this.waitForOutputDrain(stream);
860
+ return;
861
+ }
862
+ this.outputPacedBuffers.push(discordPcm);
863
+ this.outputPacedBytes += discordPcm.length;
864
+ if (!this.outputDrainHandler && this.outputPacedBytes >= DISCORD_RAW_PCM_FRAME_BYTES * DISCORD_REALTIME_OUTPUT_PREROLL_FRAMES) this.startOutputPlayback(stream);
865
+ }
866
+ waitForOutputDrain(stream) {
867
+ if (this.outputDrainHandler || this.outputStream !== stream) return;
868
+ logger$1.info(`discord voice: realtime audio playback buffering guild=${this.params.entry.guildId} channel=${this.params.entry.channelId} bufferedBytes=${stream.writableLength + stream.readableLength}`);
869
+ this.outputDrainHandler = () => {
870
+ if (this.params.stopped() || this.outputStream !== stream || stream.destroyed) return;
871
+ this.outputDrainHandler = void 0;
872
+ let refreshWatchdog = this.params.harness.outputActivity.snapshot().streamEnding;
873
+ while (this.outputPacedBuffers.length > 0) {
874
+ const buffered = this.outputPacedBuffers.shift();
875
+ if (!buffered) break;
876
+ this.outputPacedBytes -= buffered.length;
877
+ const writable = stream.write(buffered);
878
+ if (refreshWatchdog) {
879
+ this.scheduleOutputPlaybackWatchdog("output-drain", stream);
880
+ refreshWatchdog = false;
881
+ }
882
+ if (!writable) {
883
+ this.waitForOutputDrain(stream);
884
+ return;
885
+ }
886
+ }
887
+ if (this.params.harness.outputActivity.snapshot().streamEnding) stream.end();
890
888
  };
891
- const bufferedBytes = stream.writableLength + stream.readableLength;
892
- logger$1.warn(`discord voice: realtime audio playback backpressured guild=${this.params.entry.guildId} channel=${this.params.entry.channelId} bufferedBytes=${bufferedBytes}`);
893
- this.clearOutputAudio("output-backpressure");
894
- queueMicrotask(() => {
895
- if (this.params.stopped() || this.playbackState.status !== "backpressured" || this.playbackState.token !== token) return;
896
- this.params.harness.handleBargeIn({
897
- audioPlaybackActive: true,
898
- force: true
899
- }, () => {});
900
- });
889
+ stream.once("drain", this.outputDrainHandler);
901
890
  }
902
891
  startOutputPlayback(stream) {
903
892
  if (this.params.harness.outputActivity.snapshot().playbackStarted || stream.destroyed) return;
904
893
  const voiceSdk = loadDiscordVoiceSdk();
905
894
  const opusStream = createDiscordOpusEncodeStream();
906
- opusStream.on("error", (err) => {
907
- logger$1.warn(`discord voice: realtime opus encode failed guild=${this.params.entry.guildId} channel=${this.params.entry.channelId}: ${formatErrorMessage(err)}`);
908
- this.resetOutputStream("opus-encode-error");
909
- });
910
- opusStream.once("close", () => this.handleOutputStreamClosed(stream, "stream-close"));
911
895
  pipeline(stream, opusStream, (err) => {
912
- if (!err) return;
896
+ if (!err || this.outputStream !== stream) return;
913
897
  logger$1.warn(`discord voice: realtime output pipeline failed guild=${this.params.entry.guildId} channel=${this.params.entry.channelId}: ${formatErrorMessage(err)}`);
914
- this.resetOutputStream("output-pipeline-error");
898
+ this.clearOutputAudio("output-pipeline-error");
899
+ this.completeExactSpeechResponse("output-pipeline-error");
915
900
  });
916
- if (this.outputPacedBuffer.length > 0) {
917
- stream.write(this.outputPacedBuffer);
918
- this.outputPacedBuffer = Buffer.alloc(0);
919
- }
901
+ const buffered = Buffer.concat(this.outputPacedBuffers, this.outputPacedBytes);
902
+ this.outputPacedBuffers = [];
903
+ this.outputPacedBytes = 0;
904
+ if (buffered.length > 0 && !stream.write(buffered)) this.waitForOutputDrain(stream);
920
905
  const resource = voiceSdk.createAudioResource(opusStream, { inputType: voiceSdk.StreamType.Opus });
921
906
  this.params.entry.player.play(resource);
922
907
  this.params.harness.outputActivity.markPlaybackStarted();
923
- this.playbackState = {
924
- status: "playing",
925
- stream
926
- };
927
908
  const realtimeConfig = this.params.realtimeConfig();
928
909
  logger$1.info(`discord voice: realtime audio playback started guild=${this.params.entry.guildId} channel=${this.params.entry.channelId} mode=${this.params.mode} model=${realtimeConfig?.model ?? "provider-default"} voice=${realtimeConfig?.speakerVoice ?? realtimeConfig?.speakerVoiceId ?? "provider-default"}`);
929
910
  }
@@ -932,15 +913,22 @@ var DiscordRealtimePlayback = class {
932
913
  this.clearOutputPlaybackWatchdog();
933
914
  this.logOutputAudioStopped(reason);
934
915
  this.outputStream = null;
935
- if (this.playbackState.status !== "backpressured") this.playbackState = { status: "idle" };
936
- this.outputPacedBuffer = Buffer.alloc(0);
916
+ this.outputPacedBuffers = [];
917
+ this.outputPacedBytes = 0;
918
+ if (this.outputDrainHandler) {
919
+ stream?.off("drain", this.outputDrainHandler);
920
+ this.outputDrainHandler = void 0;
921
+ }
937
922
  this.params.harness.outputActivity.reset();
938
923
  stream?.end();
939
924
  stream?.destroy();
940
925
  }
941
926
  scheduleOutputPlaybackWatchdog(reason, stream) {
942
927
  this.clearOutputPlaybackWatchdog();
943
- const timeoutMs = this.params.harness.outputActivity.playbackWatchdogDelayMs({ marginMs: DISCORD_REALTIME_OUTPUT_PLAYBACK_WATCHDOG_MARGIN_MS });
928
+ const timeoutMs = this.params.harness.outputActivity.playbackWatchdogDelayMs({
929
+ marginMs: DISCORD_REALTIME_OUTPUT_PLAYBACK_WATCHDOG_MARGIN_MS,
930
+ minMs: DISCORD_REALTIME_OUTPUT_PLAYBACK_WATCHDOG_MARGIN_MS
931
+ });
944
932
  if (timeoutMs === void 0) return;
945
933
  this.outputPlaybackWatchdog = setTimeout(() => {
946
934
  this.outputPlaybackWatchdog = void 0;
@@ -1072,8 +1060,8 @@ var DiscordRealtimeVoiceSession = class {
1072
1060
  onTerminalError: this.params.onTerminalError,
1073
1061
  providerId: () => this.realtimeProviderId,
1074
1062
  realtimeConfig: () => this.realtimeConfig,
1075
- stopTerminally: () => {
1076
- this.stopLifecycle("exact-speech overflow");
1063
+ stopTerminally: (reason) => {
1064
+ this.stopLifecycle(reason);
1077
1065
  this.consults.close();
1078
1066
  },
1079
1067
  stopped: () => this.isStopped(),
@@ -1118,14 +1106,25 @@ var DiscordRealtimeVoiceSession = class {
1118
1106
  generation: lifecycleGeneration,
1119
1107
  instance: this
1120
1108
  };
1109
+ const configuredProviderId = this.realtimeConfig?.provider?.trim();
1110
+ if (configuredProviderId) {
1111
+ const ownerProviderIds = /* @__PURE__ */ new Set([configuredProviderId]);
1112
+ const canonicalProviderId = canonicalizeRealtimeVoiceProviderId(configuredProviderId, this.params.cfg);
1113
+ if (canonicalProviderId) ownerProviderIds.add(canonicalProviderId);
1114
+ for (const providerId of ownerProviderIds) assertSecretOwnerAvailable("capability", discordRealtimeVoiceSecretOwnerId(this.params.accountId, providerId));
1115
+ }
1121
1116
  const resolved = resolveConfiguredRealtimeVoiceProvider({
1122
1117
  configuredProviderId: this.realtimeConfig?.provider,
1123
1118
  providerConfigs: buildProviderConfigs(this.realtimeConfig),
1124
1119
  providerConfigOverrides: buildProviderConfigOverrides(this.realtimeConfig),
1125
1120
  cfg: this.params.cfg,
1121
+ agentId: this.params.entry.route.agentId,
1126
1122
  defaultModel: this.realtimeConfig?.model,
1123
+ isProviderAvailable: (provider) => isSecretOwnerAvailable("capability", discordRealtimeVoiceSecretOwnerId(this.params.accountId, provider.id)),
1124
+ assertProviderAvailable: (provider) => assertSecretOwnerAvailable("capability", discordRealtimeVoiceSecretOwnerId(this.params.accountId, provider.id)),
1127
1125
  noRegisteredProviderMessage: "No configured realtime voice provider registered"
1128
1126
  });
1127
+ assertSecretOwnerAvailable("capability", discordRealtimeVoiceSecretOwnerId(this.params.accountId, resolved.provider.id));
1129
1128
  this.realtimeProviderId = resolved.provider.id;
1130
1129
  const isAgentProxy = isDiscordAgentProxyVoiceMode(this.params.mode);
1131
1130
  const { toolPolicy, consultToolsAllow, consultPolicy, wakeNamePolicy, wakeNames, autoRespondToAudio } = resolveRealtimeVoiceSessionPolicy({
@@ -1161,6 +1160,7 @@ var DiscordRealtimeVoiceSession = class {
1161
1160
  this.bridge = this.harness.createBridge({
1162
1161
  provider: resolved.provider,
1163
1162
  cfg: this.params.cfg,
1163
+ agentId: this.params.entry.route.agentId,
1164
1164
  providerConfig: resolved.providerConfig,
1165
1165
  audioFormat: REALTIME_VOICE_AUDIO_FORMAT_PCM16_24KHZ,
1166
1166
  instructions,
@@ -1282,7 +1282,6 @@ var DiscordRealtimeVoiceSession = class {
1282
1282
  if (event.direction === "client" && event.type === "session.continuity.reset") this.resetProviderContinuity(event.type);
1283
1283
  if (event.direction === "server" && event.type === "input_audio_buffer.speech_started") this.turns.resetPartialWakeNameTracking();
1284
1284
  if (shouldLogRealtimeVerboseEvent(event)) logVoiceVerbose(`realtime ${event.direction}:${event.type}${detail}`);
1285
- this.playback.handleProviderEvent(event);
1286
1285
  const interruptionLog = formatRealtimeInterruptionLog(event);
1287
1286
  if (interruptionLog) logger.info(interruptionLog);
1288
1287
  const lifecycleLog = formatRealtimeLifecycleLog(event);
@@ -1,6 +1,6 @@
1
- import { p as normalizeDiscordToken } from "./accounts-DJTf1LtA.js";
1
+ import { m as normalizeDiscordToken } from "./accounts-CfQ-vSyf.js";
2
2
  import { r as fetchDiscord } from "./api-DNVbJyEy.js";
3
- import { a as normalizeDiscordSlug } from "./allow-list-DnxIlPP2.js";
3
+ import { a as normalizeDiscordSlug } from "./allow-list-BDMimASD.js";
4
4
  //#region extensions/discord/src/guilds.ts
5
5
  async function listGuilds(token, fetcher, options) {
6
6
  return (await fetchDiscord("/users/@me/guilds", token, fetcher, options)).filter((guild) => typeof guild.id === "string" && typeof guild.name === "string").map((guild) => ({
@@ -1,7 +1,8 @@
1
- import { tn as __exportAll } from "./retry-CLpJcXXf.js";
1
+ import { on as __exportAll } from "./retry-Cv4jCU5Z.js";
2
2
  import { n as DiscordApiError, r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-DNVbJyEy.js";
3
- import { a as normalizeDiscordSlug } from "./allow-list-DnxIlPP2.js";
4
- import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-D04lpEzb.js";
3
+ import { a as normalizeDiscordSlug } from "./allow-list-BDMimASD.js";
4
+ import { t as isDiscordThreadChannelType } from "./channel-type-CVLZyGYS.js";
5
+ import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-BLoYaxEG.js";
5
6
  //#region extensions/discord/src/resolve-channels.ts
6
7
  var resolve_channels_exports = /* @__PURE__ */ __exportAll({ resolveDiscordChannelAllowlist: () => resolveDiscordChannelAllowlist });
7
8
  function parseDiscordChannelInput(raw) {
@@ -79,7 +80,7 @@ async function fetchChannel(token, fetcher, channelId) {
79
80
  function preferActiveMatch(candidates) {
80
81
  if (candidates.length === 0) return;
81
82
  const scored = candidates.map((channel) => {
82
- const isThread = channel.type === 11 || channel.type === 12;
83
+ const isThread = isDiscordThreadChannelType(channel.type);
83
84
  return {
84
85
  channel,
85
86
  score: (Boolean(channel.archived) ? 0 : 2) + (isThread ? 0 : 1)
@@ -1,6 +1,6 @@
1
- import { tn as __exportAll } from "./retry-CLpJcXXf.js";
1
+ import { on as __exportAll } from "./retry-Cv4jCU5Z.js";
2
2
  import { r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-DNVbJyEy.js";
3
- import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-D04lpEzb.js";
3
+ import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-BLoYaxEG.js";
4
4
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  //#region extensions/discord/src/resolve-users.ts
6
6
  var resolve_users_exports = /* @__PURE__ */ __exportAll({ resolveDiscordUserAllowlist: () => resolveDiscordUserAllowlist });