@openclaw/discord 2026.7.2-beta.1 → 2026.7.2-beta.3

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 (1710) hide show
  1. package/dist/account-inspect-api.js +1 -1
  2. package/dist/{account-inspect-DDZtT5C8.js → account-inspect-dFV0JrnR.js} +2 -2
  3. package/dist/{accounts-P19jm1lf.js → accounts-CMd4nzLB.js} +8 -4
  4. package/dist/action-runtime-api.js +1 -1
  5. package/dist/activities-api-DS1L7KRY.js +765 -0
  6. package/dist/activities-api.js +2 -0
  7. package/dist/{allow-list-B7qOH5xu.js → allow-list-DzKrtfah.js} +18 -7
  8. package/dist/{api--f62GFaS.js → api-C43z8vUm.js} +6 -4
  9. package/dist/api.js +27 -18
  10. package/dist/{approval-handler.runtime-DeyIiw5I.js → approval-handler.runtime-BbkfPoGc.js} +7 -8
  11. package/dist/{conversation-identity-BpkAzklg.js → approval-message-safety-DrLlgIPz.js} +49 -3
  12. package/dist/assets/embedded-app-sdk.mjs +1 -0
  13. package/dist/{audit-Df2w046a.js → audit-BC6bgPMX.js} +4 -4
  14. package/dist/{channel-nYmJ7FKQ.js → channel-5MfaC2IE.js} +55 -44
  15. package/dist/{channel-actions-ChpBSRcu.js → channel-actions-DicWTbYH.js} +5 -5
  16. package/dist/{channel-actions.runtime-D8V8tyCq.js → channel-actions.runtime-D9Qadn-l.js} +50 -50
  17. package/dist/channel-config-api.js +1 -1
  18. package/dist/channel-plugin-api.js +1 -1
  19. package/dist/{channel.setup-DyihrqHH.js → channel.setup-CJXfFclP.js} +17 -20
  20. package/dist/{send.receipt-aegk69an.js → chunk-CWzmeWf_.js} +312 -401
  21. package/dist/command-deploy-store-DFkBTViB.js +12 -0
  22. package/dist/{config-schema-_bUKcWRm.js → config-schema-BxrgfSMD.js} +31 -2
  23. package/dist/{directory-config-BUe-qq_C.js → directory-config-CmukHSms.js} +2 -2
  24. package/dist/directory-contract-api.js +1 -1
  25. package/dist/{directory-live-DZByMdPO.js → directory-live-BYlCRO__.js} +11 -9
  26. package/dist/{doctor-bMaWXFKu.js → doctor-Ci7USQAW.js} +4 -4
  27. package/dist/{handle-action.guild-admin-C_PQcBEV.js → handle-action.guild-admin-Bsk2YBPs.js} +2 -2
  28. package/dist/index.js +3 -1
  29. package/dist/legacy-state-migrations-api.js +17 -2
  30. package/dist/{manager.runtime-3RVMVkyx.js → manager.runtime-Cc8vS-M7.js} +191 -192
  31. package/dist/message-handler-CWJ-mQvH.js +590 -0
  32. package/dist/{message-handler.preflight-BI86IbHz.js → message-handler.preflight-DK46_qbS.js} +19 -18
  33. package/dist/{message-handler.process-bPS_9_tb.js → message-handler.process-BK0mjFJH.js} +88 -86
  34. package/dist/{message-utils-D4j07taS.js → message-utils-Cfe6CZ6N.js} +9 -7
  35. package/dist/{outbound-adapter-Czny0Fae.js → outbound-adapter-B2_oa-zV.js} +38 -7
  36. package/dist/{outbound-components-oJKLj62G.js → outbound-components-BGhk6HI3.js} +3 -3
  37. package/dist/{components-BVrfRS-F.js → outbound-session-route-M2bEY9tI.js} +171 -53
  38. package/dist/{pluralkit-UXq1OyUI.js → pluralkit-CT0VRsZd.js} +2 -2
  39. package/dist/{probe-DxjMBeVG.js → probe-C3SCKyYU.js} +35 -12
  40. package/dist/{probe.runtime-Bc8Oo6e8.js → probe.runtime-D55QqC9u.js} +1 -1
  41. package/dist/{provider-DWvDNb4J.js → provider-HW0G-2l6.js} +1810 -1513
  42. package/dist/{provider-session.runtime-D5pCGibh.js → provider-session.runtime-cCfGMsF_.js} +3 -3
  43. package/dist/provider.runtime-BWCRsVoT.js +2 -0
  44. package/dist/{resolve-allowlist-common-B9S8LLBd.js → resolve-allowlist-common-CJlqw_nC.js} +3 -3
  45. package/dist/{resolve-channels-BrkWOKdG.js → resolve-channels-9KcG3mLg.js} +4 -4
  46. package/dist/{resolve-users-OjrXXvJP.js → resolve-users-GCGf3oV0.js} +3 -3
  47. package/dist/retry-after-DdLPmPoa.js +12 -0
  48. package/dist/runtime-CD5MRZkD.js +83 -0
  49. package/dist/{runtime-C618lis9.js → runtime-Z2qkKakn.js} +64 -43
  50. package/dist/runtime-api.actions.js +2 -2
  51. package/dist/runtime-api.js +26 -25
  52. package/dist/runtime-api.lookup.js +5 -5
  53. package/dist/runtime-api.monitor-C3EDYJqk.js +6 -0
  54. package/dist/runtime-api.monitor.js +8 -8
  55. package/dist/runtime-api.send.js +6 -5
  56. package/dist/runtime-api.threads.js +6 -6
  57. package/dist/{secret-config-contract-BDNrRWvd.js → secret-config-contract-B1akrlyY.js} +1 -0
  58. package/dist/secret-contract-api.js +1 -1
  59. package/dist/{security-audit-Bh_65L5C.js → security-audit-DtT0SIns.js} +1 -1
  60. package/dist/security-audit-contract-api.js +1 -1
  61. package/dist/{security-audit.runtime-CpPdDNEt.js → security-audit.runtime-DEEywczv.js} +1 -1
  62. package/dist/security-doctor-nGgPm65L.js +5 -0
  63. package/dist/{send-BFpa_DHn.js → send-CSRxNNgq.js} +16 -95
  64. package/dist/{send.components-BaXQJKWT.js → send.components-DLqzOEPJ.js} +47 -38
  65. package/dist/{send.outbound-BlA6VzSE.js → send.outbound-C1SfX20w.js} +7 -6
  66. package/dist/send.reactions-Cj4ugX3F.js +85 -0
  67. package/dist/send.receipt-CuwRrpFz.js +48 -0
  68. package/dist/{send.shared-Xz7IMVpu.js → send.shared-Dber6X57.js} +78 -74
  69. package/dist/{sender-identity-C62lBe18.js → sender-identity-mG_zsdox.js} +1 -1
  70. package/dist/session-binding-contract-api.js +1 -1
  71. package/dist/setup-plugin-api.js +1 -1
  72. package/dist/{shared-BLYBt5SA.js → shared-BEhmAdMY.js} +9 -9
  73. package/dist/{subagent-hooks-DKJ4p-Oy.js → subagent-hooks-Wrk61DwY.js} +3 -3
  74. package/dist/subagent-hooks-api.js +10 -1
  75. package/dist/subagent-progress-B2fpHe3m.js +662 -0
  76. package/dist/{system-events-DKwfE-2z.js → system-events-AhfcKRRb.js} +2 -2
  77. package/dist/{target-resolver-BQyEHyeS.js → target-resolver-vqLA450R.js} +3 -3
  78. package/dist/targets-BjEMIe8t.js +3 -0
  79. package/dist/{thread-bindings-BbzjUuNB.js → thread-bindings-CJQoXuWY.js} +7 -7
  80. package/dist/{thread-bindings.discord-api-DJD3qwIN.js → thread-bindings.discord-api-mNCWlgvM.js} +5 -5
  81. package/dist/{thread-bindings.manager-BIBm6bQd.js → thread-bindings.manager-D1z8mK4b.js} +5 -5
  82. package/dist/{thread-bindings.session-updates-eRcJlzIU.js → thread-bindings.session-updates-DnTpkroM.js} +1 -1
  83. package/dist/{timeouts-ZRc9Lw4y.js → timeouts-B9cy6RvQ.js} +1 -5
  84. package/dist/{transcripts-source-CLZ5X8fh.js → transcripts-source-DjDbt14x.js} +1 -1
  85. package/dist/transcripts-source-api.js +1 -1
  86. package/dist/{typing-BnYT7Szq.js → typing-wxtm1NlF.js} +2 -2
  87. package/node_modules/@discord/embedded-app-sdk/LICENSE.md +9 -0
  88. package/node_modules/@discord/embedded-app-sdk/README.md +74 -0
  89. package/node_modules/@discord/embedded-app-sdk/output/Constants.cjs +100 -0
  90. package/node_modules/@discord/embedded-app-sdk/output/Constants.d.ts +88 -0
  91. package/node_modules/@discord/embedded-app-sdk/output/Constants.mjs +96 -0
  92. package/node_modules/@discord/embedded-app-sdk/output/Discord.cjs +286 -0
  93. package/node_modules/@discord/embedded-app-sdk/output/Discord.d.ts +603 -0
  94. package/node_modules/@discord/embedded-app-sdk/output/Discord.mjs +284 -0
  95. package/node_modules/@discord/embedded-app-sdk/output/_virtual/BigInteger.cjs +11 -0
  96. package/node_modules/@discord/embedded-app-sdk/output/_virtual/BigInteger.mjs +7 -0
  97. package/node_modules/@discord/embedded-app-sdk/output/_virtual/BigInteger2.cjs +5 -0
  98. package/node_modules/@discord/embedded-app-sdk/output/_virtual/BigInteger2.mjs +3 -0
  99. package/node_modules/@discord/embedded-app-sdk/output/_virtual/_commonjsHelpers.cjs +10 -0
  100. package/node_modules/@discord/embedded-app-sdk/output/_virtual/_commonjsHelpers.mjs +7 -0
  101. package/node_modules/@discord/embedded-app-sdk/output/_virtual/index.cjs +11 -0
  102. package/node_modules/@discord/embedded-app-sdk/output/_virtual/index.mjs +7 -0
  103. package/node_modules/@discord/embedded-app-sdk/output/_virtual/index2.cjs +11 -0
  104. package/node_modules/@discord/embedded-app-sdk/output/_virtual/index2.mjs +7 -0
  105. package/node_modules/@discord/embedded-app-sdk/output/_virtual/index3.cjs +5 -0
  106. package/node_modules/@discord/embedded-app-sdk/output/_virtual/index3.mjs +3 -0
  107. package/node_modules/@discord/embedded-app-sdk/output/_virtual/index4.cjs +5 -0
  108. package/node_modules/@discord/embedded-app-sdk/output/_virtual/index4.mjs +3 -0
  109. package/node_modules/@discord/embedded-app-sdk/output/commands/authenticate.cjs +11 -0
  110. package/node_modules/@discord/embedded-app-sdk/output/commands/authenticate.d.ts +25 -0
  111. package/node_modules/@discord/embedded-app-sdk/output/commands/authenticate.mjs +9 -0
  112. package/node_modules/@discord/embedded-app-sdk/output/commands/authorize.cjs +16 -0
  113. package/node_modules/@discord/embedded-app-sdk/output/commands/authorize.d.ts +20 -0
  114. package/node_modules/@discord/embedded-app-sdk/output/commands/authorize.mjs +14 -0
  115. package/node_modules/@discord/embedded-app-sdk/output/commands/captureLog.cjs +12 -0
  116. package/node_modules/@discord/embedded-app-sdk/output/commands/captureLog.d.ts +10 -0
  117. package/node_modules/@discord/embedded-app-sdk/output/commands/captureLog.mjs +10 -0
  118. package/node_modules/@discord/embedded-app-sdk/output/commands/encourageHardwareAcceleration.cjs +12 -0
  119. package/node_modules/@discord/embedded-app-sdk/output/commands/encourageHardwareAcceleration.d.ts +7 -0
  120. package/node_modules/@discord/embedded-app-sdk/output/commands/encourageHardwareAcceleration.mjs +10 -0
  121. package/node_modules/@discord/embedded-app-sdk/output/commands/getActivityInstanceConnectedParticipants.cjs +8 -0
  122. package/node_modules/@discord/embedded-app-sdk/output/commands/getActivityInstanceConnectedParticipants.d.ts +18 -0
  123. package/node_modules/@discord/embedded-app-sdk/output/commands/getActivityInstanceConnectedParticipants.mjs +6 -0
  124. package/node_modules/@discord/embedded-app-sdk/output/commands/getChannel.cjs +29 -0
  125. package/node_modules/@discord/embedded-app-sdk/output/commands/getChannel.d.ts +230 -0
  126. package/node_modules/@discord/embedded-app-sdk/output/commands/getChannel.mjs +27 -0
  127. package/node_modules/@discord/embedded-app-sdk/output/commands/getChannelPermissions.cjs +13 -0
  128. package/node_modules/@discord/embedded-app-sdk/output/commands/getChannelPermissions.d.ts +8 -0
  129. package/node_modules/@discord/embedded-app-sdk/output/commands/getChannelPermissions.mjs +11 -0
  130. package/node_modules/@discord/embedded-app-sdk/output/commands/getEntitlements.cjs +12 -0
  131. package/node_modules/@discord/embedded-app-sdk/output/commands/getEntitlements.d.ts +22 -0
  132. package/node_modules/@discord/embedded-app-sdk/output/commands/getEntitlements.mjs +10 -0
  133. package/node_modules/@discord/embedded-app-sdk/output/commands/getPlatformBehaviors.cjs +16 -0
  134. package/node_modules/@discord/embedded-app-sdk/output/commands/getPlatformBehaviors.d.ts +11 -0
  135. package/node_modules/@discord/embedded-app-sdk/output/commands/getPlatformBehaviors.mjs +14 -0
  136. package/node_modules/@discord/embedded-app-sdk/output/commands/getQuest.cjs +8 -0
  137. package/node_modules/@discord/embedded-app-sdk/output/commands/getQuest.d.ts +6 -0
  138. package/node_modules/@discord/embedded-app-sdk/output/commands/getQuest.mjs +6 -0
  139. package/node_modules/@discord/embedded-app-sdk/output/commands/getQuestEnrollmentStatus.cjs +8 -0
  140. package/node_modules/@discord/embedded-app-sdk/output/commands/getQuestEnrollmentStatus.d.ts +7 -0
  141. package/node_modules/@discord/embedded-app-sdk/output/commands/getQuestEnrollmentStatus.mjs +6 -0
  142. package/node_modules/@discord/embedded-app-sdk/output/commands/getRelationships.cjs +8 -0
  143. package/node_modules/@discord/embedded-app-sdk/output/commands/getRelationships.d.ts +70 -0
  144. package/node_modules/@discord/embedded-app-sdk/output/commands/getRelationships.mjs +6 -0
  145. package/node_modules/@discord/embedded-app-sdk/output/commands/getSkus.cjs +12 -0
  146. package/node_modules/@discord/embedded-app-sdk/output/commands/getSkus.d.ts +15 -0
  147. package/node_modules/@discord/embedded-app-sdk/output/commands/getSkus.mjs +10 -0
  148. package/node_modules/@discord/embedded-app-sdk/output/commands/getUser.cjs +8 -0
  149. package/node_modules/@discord/embedded-app-sdk/output/commands/getUser.d.ts +17 -0
  150. package/node_modules/@discord/embedded-app-sdk/output/commands/getUser.mjs +6 -0
  151. package/node_modules/@discord/embedded-app-sdk/output/commands/index.cjs +76 -0
  152. package/node_modules/@discord/embedded-app-sdk/output/commands/index.d.ts +562 -0
  153. package/node_modules/@discord/embedded-app-sdk/output/commands/index.mjs +68 -0
  154. package/node_modules/@discord/embedded-app-sdk/output/commands/initiateImageUpload.cjs +17 -0
  155. package/node_modules/@discord/embedded-app-sdk/output/commands/initiateImageUpload.d.ts +12 -0
  156. package/node_modules/@discord/embedded-app-sdk/output/commands/initiateImageUpload.mjs +15 -0
  157. package/node_modules/@discord/embedded-app-sdk/output/commands/inviteUserEmbedded.cjs +8 -0
  158. package/node_modules/@discord/embedded-app-sdk/output/commands/inviteUserEmbedded.d.ts +4 -0
  159. package/node_modules/@discord/embedded-app-sdk/output/commands/inviteUserEmbedded.mjs +6 -0
  160. package/node_modules/@discord/embedded-app-sdk/output/commands/openExternalLink.cjs +12 -0
  161. package/node_modules/@discord/embedded-app-sdk/output/commands/openExternalLink.d.ts +10 -0
  162. package/node_modules/@discord/embedded-app-sdk/output/commands/openExternalLink.mjs +10 -0
  163. package/node_modules/@discord/embedded-app-sdk/output/commands/openInviteDialog.cjs +14 -0
  164. package/node_modules/@discord/embedded-app-sdk/output/commands/openInviteDialog.d.ts +7 -0
  165. package/node_modules/@discord/embedded-app-sdk/output/commands/openInviteDialog.mjs +12 -0
  166. package/node_modules/@discord/embedded-app-sdk/output/commands/openShareMomentDialog.cjs +14 -0
  167. package/node_modules/@discord/embedded-app-sdk/output/commands/openShareMomentDialog.d.ts +9 -0
  168. package/node_modules/@discord/embedded-app-sdk/output/commands/openShareMomentDialog.mjs +12 -0
  169. package/node_modules/@discord/embedded-app-sdk/output/commands/questStartTimer.cjs +8 -0
  170. package/node_modules/@discord/embedded-app-sdk/output/commands/questStartTimer.d.ts +5 -0
  171. package/node_modules/@discord/embedded-app-sdk/output/commands/questStartTimer.mjs +6 -0
  172. package/node_modules/@discord/embedded-app-sdk/output/commands/requestProxyTicketRefresh.cjs +8 -0
  173. package/node_modules/@discord/embedded-app-sdk/output/commands/requestProxyTicketRefresh.d.ts +3 -0
  174. package/node_modules/@discord/embedded-app-sdk/output/commands/requestProxyTicketRefresh.mjs +6 -0
  175. package/node_modules/@discord/embedded-app-sdk/output/commands/setActivity.cjs +48 -0
  176. package/node_modules/@discord/embedded-app-sdk/output/commands/setActivity.d.ts +304 -0
  177. package/node_modules/@discord/embedded-app-sdk/output/commands/setActivity.mjs +46 -0
  178. package/node_modules/@discord/embedded-app-sdk/output/commands/setConfig.cjs +12 -0
  179. package/node_modules/@discord/embedded-app-sdk/output/commands/setConfig.d.ts +10 -0
  180. package/node_modules/@discord/embedded-app-sdk/output/commands/setConfig.mjs +10 -0
  181. package/node_modules/@discord/embedded-app-sdk/output/commands/setOrientationLockState.cjs +20 -0
  182. package/node_modules/@discord/embedded-app-sdk/output/commands/setOrientationLockState.d.ts +11 -0
  183. package/node_modules/@discord/embedded-app-sdk/output/commands/setOrientationLockState.mjs +18 -0
  184. package/node_modules/@discord/embedded-app-sdk/output/commands/shareInteraction.cjs +8 -0
  185. package/node_modules/@discord/embedded-app-sdk/output/commands/shareInteraction.d.ts +26 -0
  186. package/node_modules/@discord/embedded-app-sdk/output/commands/shareInteraction.mjs +6 -0
  187. package/node_modules/@discord/embedded-app-sdk/output/commands/shareLink.cjs +16 -0
  188. package/node_modules/@discord/embedded-app-sdk/output/commands/shareLink.d.ts +17 -0
  189. package/node_modules/@discord/embedded-app-sdk/output/commands/shareLink.mjs +14 -0
  190. package/node_modules/@discord/embedded-app-sdk/output/commands/startPurchase.cjs +12 -0
  191. package/node_modules/@discord/embedded-app-sdk/output/commands/startPurchase.d.ts +24 -0
  192. package/node_modules/@discord/embedded-app-sdk/output/commands/startPurchase.mjs +10 -0
  193. package/node_modules/@discord/embedded-app-sdk/output/commands/userSettingsGetLocale.cjs +12 -0
  194. package/node_modules/@discord/embedded-app-sdk/output/commands/userSettingsGetLocale.d.ts +7 -0
  195. package/node_modules/@discord/embedded-app-sdk/output/commands/userSettingsGetLocale.mjs +10 -0
  196. package/node_modules/@discord/embedded-app-sdk/output/error.cjs +12 -0
  197. package/node_modules/@discord/embedded-app-sdk/output/error.d.ts +10 -0
  198. package/node_modules/@discord/embedded-app-sdk/output/error.mjs +10 -0
  199. package/node_modules/@discord/embedded-app-sdk/output/generated/schemas.cjs +408 -0
  200. package/node_modules/@discord/embedded-app-sdk/output/generated/schemas.d.ts +2227 -0
  201. package/node_modules/@discord/embedded-app-sdk/output/generated/schemas.mjs +387 -0
  202. package/node_modules/@discord/embedded-app-sdk/output/index.cjs +44 -0
  203. package/node_modules/@discord/embedded-app-sdk/output/index.d.ts +17 -0
  204. package/node_modules/@discord/embedded-app-sdk/output/index.mjs +14 -0
  205. package/node_modules/@discord/embedded-app-sdk/output/interface.d.ts +35 -0
  206. package/node_modules/@discord/embedded-app-sdk/output/lib/big-integer/BigInteger.cjs +1460 -0
  207. package/node_modules/@discord/embedded-app-sdk/output/lib/big-integer/BigInteger.mjs +1458 -0
  208. package/node_modules/@discord/embedded-app-sdk/output/lib/decimal.js-light/decimal.cjs +1991 -0
  209. package/node_modules/@discord/embedded-app-sdk/output/lib/decimal.js-light/decimal.mjs +1987 -0
  210. package/node_modules/@discord/embedded-app-sdk/output/lib/eventemitter3/index.cjs +10 -0
  211. package/node_modules/@discord/embedded-app-sdk/output/lib/eventemitter3/index.mjs +5 -0
  212. package/node_modules/@discord/embedded-app-sdk/output/lib/eventemitter3/index2.cjs +350 -0
  213. package/node_modules/@discord/embedded-app-sdk/output/lib/eventemitter3/index2.mjs +348 -0
  214. package/node_modules/@discord/embedded-app-sdk/output/lib/lodash.transform/index.cjs +2343 -0
  215. package/node_modules/@discord/embedded-app-sdk/output/lib/lodash.transform/index.mjs +2341 -0
  216. package/node_modules/@discord/embedded-app-sdk/output/lib/tslib/tslib.es6.cjs +37 -0
  217. package/node_modules/@discord/embedded-app-sdk/output/lib/tslib/tslib.es6.mjs +35 -0
  218. package/node_modules/@discord/embedded-app-sdk/output/lib/uuid/dist/esm-browser/native.cjs +8 -0
  219. package/node_modules/@discord/embedded-app-sdk/output/lib/uuid/dist/esm-browser/native.mjs +4 -0
  220. package/node_modules/@discord/embedded-app-sdk/output/lib/uuid/dist/esm-browser/rng.cjs +17 -0
  221. package/node_modules/@discord/embedded-app-sdk/output/lib/uuid/dist/esm-browser/rng.mjs +13 -0
  222. package/node_modules/@discord/embedded-app-sdk/output/lib/uuid/dist/esm-browser/stringify.cjs +30 -0
  223. package/node_modules/@discord/embedded-app-sdk/output/lib/uuid/dist/esm-browser/stringify.mjs +28 -0
  224. package/node_modules/@discord/embedded-app-sdk/output/lib/uuid/dist/esm-browser/v4.cjs +23 -0
  225. package/node_modules/@discord/embedded-app-sdk/output/lib/uuid/dist/esm-browser/v4.mjs +19 -0
  226. package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.cjs +4342 -0
  227. package/node_modules/@discord/embedded-app-sdk/output/lib/zod/lib/index.mjs +4233 -0
  228. package/node_modules/@discord/embedded-app-sdk/output/mock.cjs +181 -0
  229. package/node_modules/@discord/embedded-app-sdk/output/mock.d.ts +579 -0
  230. package/node_modules/@discord/embedded-app-sdk/output/mock.mjs +178 -0
  231. package/node_modules/@discord/embedded-app-sdk/output/package.json.cjs +5 -0
  232. package/node_modules/@discord/embedded-app-sdk/output/package.json.mjs +3 -0
  233. package/node_modules/@discord/embedded-app-sdk/output/schema/common.cjs +587 -0
  234. package/node_modules/@discord/embedded-app-sdk/output/schema/common.d.ts +5141 -0
  235. package/node_modules/@discord/embedded-app-sdk/output/schema/common.mjs +531 -0
  236. package/node_modules/@discord/embedded-app-sdk/output/schema/events.cjs +221 -0
  237. package/node_modules/@discord/embedded-app-sdk/output/schema/events.d.ts +3832 -0
  238. package/node_modules/@discord/embedded-app-sdk/output/schema/events.mjs +213 -0
  239. package/node_modules/@discord/embedded-app-sdk/output/schema/index.cjs +47 -0
  240. package/node_modules/@discord/embedded-app-sdk/output/schema/index.d.ts +59 -0
  241. package/node_modules/@discord/embedded-app-sdk/output/schema/index.mjs +44 -0
  242. package/node_modules/@discord/embedded-app-sdk/output/schema/responses.cjs +189 -0
  243. package/node_modules/@discord/embedded-app-sdk/output/schema/responses.d.ts +7224 -0
  244. package/node_modules/@discord/embedded-app-sdk/output/schema/responses.mjs +163 -0
  245. package/node_modules/@discord/embedded-app-sdk/output/schema/types.d.ts +61 -0
  246. package/node_modules/@discord/embedded-app-sdk/output/utils/BigFlagUtils.cjs +235 -0
  247. package/node_modules/@discord/embedded-app-sdk/output/utils/BigFlagUtils.d.ts +59 -0
  248. package/node_modules/@discord/embedded-app-sdk/output/utils/BigFlagUtils.mjs +231 -0
  249. package/node_modules/@discord/embedded-app-sdk/output/utils/PermissionUtils.cjs +14 -0
  250. package/node_modules/@discord/embedded-app-sdk/output/utils/PermissionUtils.d.ts +6 -0
  251. package/node_modules/@discord/embedded-app-sdk/output/utils/PermissionUtils.mjs +10 -0
  252. package/node_modules/@discord/embedded-app-sdk/output/utils/PriceConstants.cjs +373 -0
  253. package/node_modules/@discord/embedded-app-sdk/output/utils/PriceConstants.d.ts +368 -0
  254. package/node_modules/@discord/embedded-app-sdk/output/utils/PriceConstants.mjs +371 -0
  255. package/node_modules/@discord/embedded-app-sdk/output/utils/PriceUtils.cjs +26 -0
  256. package/node_modules/@discord/embedded-app-sdk/output/utils/PriceUtils.d.ts +8 -0
  257. package/node_modules/@discord/embedded-app-sdk/output/utils/PriceUtils.mjs +22 -0
  258. package/node_modules/@discord/embedded-app-sdk/output/utils/assertUnreachable.cjs +13 -0
  259. package/node_modules/@discord/embedded-app-sdk/output/utils/assertUnreachable.d.ts +5 -0
  260. package/node_modules/@discord/embedded-app-sdk/output/utils/assertUnreachable.mjs +9 -0
  261. package/node_modules/@discord/embedded-app-sdk/output/utils/commandFactory.cjs +37 -0
  262. package/node_modules/@discord/embedded-app-sdk/output/utils/commandFactory.d.ts +9 -0
  263. package/node_modules/@discord/embedded-app-sdk/output/utils/commandFactory.mjs +34 -0
  264. package/node_modules/@discord/embedded-app-sdk/output/utils/compatCommandFactory.cjs +39 -0
  265. package/node_modules/@discord/embedded-app-sdk/output/utils/compatCommandFactory.d.ts +15 -0
  266. package/node_modules/@discord/embedded-app-sdk/output/utils/compatCommandFactory.mjs +35 -0
  267. package/node_modules/@discord/embedded-app-sdk/output/utils/console.cjs +19 -0
  268. package/node_modules/@discord/embedded-app-sdk/output/utils/console.d.ts +3 -0
  269. package/node_modules/@discord/embedded-app-sdk/output/utils/console.mjs +16 -0
  270. package/node_modules/@discord/embedded-app-sdk/output/utils/getDefaultSdkConfiguration.cjs +11 -0
  271. package/node_modules/@discord/embedded-app-sdk/output/utils/getDefaultSdkConfiguration.d.ts +2 -0
  272. package/node_modules/@discord/embedded-app-sdk/output/utils/getDefaultSdkConfiguration.mjs +7 -0
  273. package/node_modules/@discord/embedded-app-sdk/output/utils/patchUrlMappings.cjs +153 -0
  274. package/node_modules/@discord/embedded-app-sdk/output/utils/patchUrlMappings.d.ts +17 -0
  275. package/node_modules/@discord/embedded-app-sdk/output/utils/patchUrlMappings.mjs +150 -0
  276. package/node_modules/@discord/embedded-app-sdk/output/utils/url.cjs +62 -0
  277. package/node_modules/@discord/embedded-app-sdk/output/utils/url.d.ts +17 -0
  278. package/node_modules/@discord/embedded-app-sdk/output/utils/url.mjs +59 -0
  279. package/node_modules/@discord/embedded-app-sdk/output/utils/zodUtils.cjs +44 -0
  280. package/node_modules/@discord/embedded-app-sdk/output/utils/zodUtils.d.ts +28 -0
  281. package/node_modules/@discord/embedded-app-sdk/output/utils/zodUtils.mjs +41 -0
  282. package/node_modules/@discord/embedded-app-sdk/package.json +88 -0
  283. package/node_modules/@types/lodash/LICENSE +21 -0
  284. package/node_modules/@types/lodash/README.md +15 -0
  285. package/node_modules/@types/lodash/add.d.ts +2 -0
  286. package/node_modules/@types/lodash/after.d.ts +2 -0
  287. package/node_modules/@types/lodash/ary.d.ts +2 -0
  288. package/node_modules/@types/lodash/assign.d.ts +2 -0
  289. package/node_modules/@types/lodash/assignIn.d.ts +2 -0
  290. package/node_modules/@types/lodash/assignInWith.d.ts +2 -0
  291. package/node_modules/@types/lodash/assignWith.d.ts +2 -0
  292. package/node_modules/@types/lodash/at.d.ts +2 -0
  293. package/node_modules/@types/lodash/attempt.d.ts +2 -0
  294. package/node_modules/@types/lodash/before.d.ts +2 -0
  295. package/node_modules/@types/lodash/bind.d.ts +2 -0
  296. package/node_modules/@types/lodash/bindAll.d.ts +2 -0
  297. package/node_modules/@types/lodash/bindKey.d.ts +2 -0
  298. package/node_modules/@types/lodash/camelCase.d.ts +2 -0
  299. package/node_modules/@types/lodash/capitalize.d.ts +2 -0
  300. package/node_modules/@types/lodash/castArray.d.ts +2 -0
  301. package/node_modules/@types/lodash/ceil.d.ts +2 -0
  302. package/node_modules/@types/lodash/chain.d.ts +2 -0
  303. package/node_modules/@types/lodash/chunk.d.ts +2 -0
  304. package/node_modules/@types/lodash/clamp.d.ts +2 -0
  305. package/node_modules/@types/lodash/clone.d.ts +2 -0
  306. package/node_modules/@types/lodash/cloneDeep.d.ts +2 -0
  307. package/node_modules/@types/lodash/cloneDeepWith.d.ts +2 -0
  308. package/node_modules/@types/lodash/cloneWith.d.ts +2 -0
  309. package/node_modules/@types/lodash/common/array.d.ts +2160 -0
  310. package/node_modules/@types/lodash/common/collection.d.ts +1938 -0
  311. package/node_modules/@types/lodash/common/common.d.ts +287 -0
  312. package/node_modules/@types/lodash/common/date.d.ts +23 -0
  313. package/node_modules/@types/lodash/common/function.d.ts +1455 -0
  314. package/node_modules/@types/lodash/common/lang.d.ts +1696 -0
  315. package/node_modules/@types/lodash/common/math.d.ts +407 -0
  316. package/node_modules/@types/lodash/common/number.d.ts +131 -0
  317. package/node_modules/@types/lodash/common/object.d.ts +2643 -0
  318. package/node_modules/@types/lodash/common/seq.d.ts +210 -0
  319. package/node_modules/@types/lodash/common/string.d.ts +788 -0
  320. package/node_modules/@types/lodash/common/util.d.ts +1220 -0
  321. package/node_modules/@types/lodash/compact.d.ts +2 -0
  322. package/node_modules/@types/lodash/concat.d.ts +2 -0
  323. package/node_modules/@types/lodash/cond.d.ts +2 -0
  324. package/node_modules/@types/lodash/conformsTo.d.ts +2 -0
  325. package/node_modules/@types/lodash/constant.d.ts +2 -0
  326. package/node_modules/@types/lodash/countBy.d.ts +2 -0
  327. package/node_modules/@types/lodash/create.d.ts +2 -0
  328. package/node_modules/@types/lodash/curry.d.ts +2 -0
  329. package/node_modules/@types/lodash/curryRight.d.ts +2 -0
  330. package/node_modules/@types/lodash/debounce.d.ts +2 -0
  331. package/node_modules/@types/lodash/deburr.d.ts +2 -0
  332. package/node_modules/@types/lodash/defaultTo.d.ts +2 -0
  333. package/node_modules/@types/lodash/defaults.d.ts +2 -0
  334. package/node_modules/@types/lodash/defaultsDeep.d.ts +2 -0
  335. package/node_modules/@types/lodash/defer.d.ts +2 -0
  336. package/node_modules/@types/lodash/delay.d.ts +2 -0
  337. package/node_modules/@types/lodash/difference.d.ts +2 -0
  338. package/node_modules/@types/lodash/differenceBy.d.ts +2 -0
  339. package/node_modules/@types/lodash/differenceWith.d.ts +2 -0
  340. package/node_modules/@types/lodash/divide.d.ts +2 -0
  341. package/node_modules/@types/lodash/drop.d.ts +2 -0
  342. package/node_modules/@types/lodash/dropRight.d.ts +2 -0
  343. package/node_modules/@types/lodash/dropRightWhile.d.ts +2 -0
  344. package/node_modules/@types/lodash/dropWhile.d.ts +2 -0
  345. package/node_modules/@types/lodash/each.d.ts +2 -0
  346. package/node_modules/@types/lodash/eachRight.d.ts +2 -0
  347. package/node_modules/@types/lodash/endsWith.d.ts +2 -0
  348. package/node_modules/@types/lodash/entries.d.ts +2 -0
  349. package/node_modules/@types/lodash/entriesIn.d.ts +2 -0
  350. package/node_modules/@types/lodash/eq.d.ts +2 -0
  351. package/node_modules/@types/lodash/escape.d.ts +2 -0
  352. package/node_modules/@types/lodash/escapeRegExp.d.ts +2 -0
  353. package/node_modules/@types/lodash/every.d.ts +2 -0
  354. package/node_modules/@types/lodash/extend.d.ts +2 -0
  355. package/node_modules/@types/lodash/extendWith.d.ts +2 -0
  356. package/node_modules/@types/lodash/fill.d.ts +2 -0
  357. package/node_modules/@types/lodash/filter.d.ts +2 -0
  358. package/node_modules/@types/lodash/find.d.ts +2 -0
  359. package/node_modules/@types/lodash/findIndex.d.ts +2 -0
  360. package/node_modules/@types/lodash/findKey.d.ts +2 -0
  361. package/node_modules/@types/lodash/findLast.d.ts +2 -0
  362. package/node_modules/@types/lodash/findLastIndex.d.ts +2 -0
  363. package/node_modules/@types/lodash/findLastKey.d.ts +2 -0
  364. package/node_modules/@types/lodash/first.d.ts +2 -0
  365. package/node_modules/@types/lodash/flatMap.d.ts +2 -0
  366. package/node_modules/@types/lodash/flatMapDeep.d.ts +2 -0
  367. package/node_modules/@types/lodash/flatMapDepth.d.ts +2 -0
  368. package/node_modules/@types/lodash/flatten.d.ts +2 -0
  369. package/node_modules/@types/lodash/flattenDeep.d.ts +2 -0
  370. package/node_modules/@types/lodash/flattenDepth.d.ts +2 -0
  371. package/node_modules/@types/lodash/flip.d.ts +2 -0
  372. package/node_modules/@types/lodash/floor.d.ts +2 -0
  373. package/node_modules/@types/lodash/flow.d.ts +2 -0
  374. package/node_modules/@types/lodash/flowRight.d.ts +2 -0
  375. package/node_modules/@types/lodash/forEach.d.ts +2 -0
  376. package/node_modules/@types/lodash/forEachRight.d.ts +2 -0
  377. package/node_modules/@types/lodash/forIn.d.ts +2 -0
  378. package/node_modules/@types/lodash/forInRight.d.ts +2 -0
  379. package/node_modules/@types/lodash/forOwn.d.ts +2 -0
  380. package/node_modules/@types/lodash/forOwnRight.d.ts +2 -0
  381. package/node_modules/@types/lodash/fp/F.d.ts +2 -0
  382. package/node_modules/@types/lodash/fp/T.d.ts +2 -0
  383. package/node_modules/@types/lodash/fp/__.d.ts +3 -0
  384. package/node_modules/@types/lodash/fp/add.d.ts +2 -0
  385. package/node_modules/@types/lodash/fp/after.d.ts +2 -0
  386. package/node_modules/@types/lodash/fp/all.d.ts +2 -0
  387. package/node_modules/@types/lodash/fp/allPass.d.ts +2 -0
  388. package/node_modules/@types/lodash/fp/always.d.ts +2 -0
  389. package/node_modules/@types/lodash/fp/any.d.ts +2 -0
  390. package/node_modules/@types/lodash/fp/anyPass.d.ts +2 -0
  391. package/node_modules/@types/lodash/fp/apply.d.ts +2 -0
  392. package/node_modules/@types/lodash/fp/ary.d.ts +2 -0
  393. package/node_modules/@types/lodash/fp/assign.d.ts +2 -0
  394. package/node_modules/@types/lodash/fp/assignAll.d.ts +2 -0
  395. package/node_modules/@types/lodash/fp/assignAllWith.d.ts +2 -0
  396. package/node_modules/@types/lodash/fp/assignIn.d.ts +2 -0
  397. package/node_modules/@types/lodash/fp/assignInAll.d.ts +2 -0
  398. package/node_modules/@types/lodash/fp/assignInAllWith.d.ts +2 -0
  399. package/node_modules/@types/lodash/fp/assignInWith.d.ts +2 -0
  400. package/node_modules/@types/lodash/fp/assignWith.d.ts +2 -0
  401. package/node_modules/@types/lodash/fp/assoc.d.ts +2 -0
  402. package/node_modules/@types/lodash/fp/assocPath.d.ts +2 -0
  403. package/node_modules/@types/lodash/fp/at.d.ts +2 -0
  404. package/node_modules/@types/lodash/fp/attempt.d.ts +2 -0
  405. package/node_modules/@types/lodash/fp/before.d.ts +2 -0
  406. package/node_modules/@types/lodash/fp/bind.d.ts +2 -0
  407. package/node_modules/@types/lodash/fp/bindAll.d.ts +2 -0
  408. package/node_modules/@types/lodash/fp/bindKey.d.ts +2 -0
  409. package/node_modules/@types/lodash/fp/camelCase.d.ts +2 -0
  410. package/node_modules/@types/lodash/fp/capitalize.d.ts +2 -0
  411. package/node_modules/@types/lodash/fp/castArray.d.ts +2 -0
  412. package/node_modules/@types/lodash/fp/ceil.d.ts +2 -0
  413. package/node_modules/@types/lodash/fp/chunk.d.ts +2 -0
  414. package/node_modules/@types/lodash/fp/clamp.d.ts +2 -0
  415. package/node_modules/@types/lodash/fp/clone.d.ts +2 -0
  416. package/node_modules/@types/lodash/fp/cloneDeep.d.ts +2 -0
  417. package/node_modules/@types/lodash/fp/cloneDeepWith.d.ts +2 -0
  418. package/node_modules/@types/lodash/fp/cloneWith.d.ts +2 -0
  419. package/node_modules/@types/lodash/fp/compact.d.ts +2 -0
  420. package/node_modules/@types/lodash/fp/complement.d.ts +2 -0
  421. package/node_modules/@types/lodash/fp/compose.d.ts +2 -0
  422. package/node_modules/@types/lodash/fp/concat.d.ts +2 -0
  423. package/node_modules/@types/lodash/fp/cond.d.ts +2 -0
  424. package/node_modules/@types/lodash/fp/conforms.d.ts +2 -0
  425. package/node_modules/@types/lodash/fp/conformsTo.d.ts +2 -0
  426. package/node_modules/@types/lodash/fp/constant.d.ts +2 -0
  427. package/node_modules/@types/lodash/fp/contains.d.ts +2 -0
  428. package/node_modules/@types/lodash/fp/convert.d.ts +15 -0
  429. package/node_modules/@types/lodash/fp/countBy.d.ts +2 -0
  430. package/node_modules/@types/lodash/fp/create.d.ts +2 -0
  431. package/node_modules/@types/lodash/fp/curry.d.ts +2 -0
  432. package/node_modules/@types/lodash/fp/curryN.d.ts +2 -0
  433. package/node_modules/@types/lodash/fp/curryRight.d.ts +2 -0
  434. package/node_modules/@types/lodash/fp/curryRightN.d.ts +2 -0
  435. package/node_modules/@types/lodash/fp/debounce.d.ts +2 -0
  436. package/node_modules/@types/lodash/fp/deburr.d.ts +2 -0
  437. package/node_modules/@types/lodash/fp/defaultTo.d.ts +2 -0
  438. package/node_modules/@types/lodash/fp/defaults.d.ts +2 -0
  439. package/node_modules/@types/lodash/fp/defaultsAll.d.ts +2 -0
  440. package/node_modules/@types/lodash/fp/defaultsDeep.d.ts +2 -0
  441. package/node_modules/@types/lodash/fp/defaultsDeepAll.d.ts +2 -0
  442. package/node_modules/@types/lodash/fp/defer.d.ts +2 -0
  443. package/node_modules/@types/lodash/fp/delay.d.ts +2 -0
  444. package/node_modules/@types/lodash/fp/difference.d.ts +2 -0
  445. package/node_modules/@types/lodash/fp/differenceBy.d.ts +2 -0
  446. package/node_modules/@types/lodash/fp/differenceWith.d.ts +2 -0
  447. package/node_modules/@types/lodash/fp/dissoc.d.ts +2 -0
  448. package/node_modules/@types/lodash/fp/dissocPath.d.ts +2 -0
  449. package/node_modules/@types/lodash/fp/divide.d.ts +2 -0
  450. package/node_modules/@types/lodash/fp/drop.d.ts +2 -0
  451. package/node_modules/@types/lodash/fp/dropLast.d.ts +2 -0
  452. package/node_modules/@types/lodash/fp/dropLastWhile.d.ts +2 -0
  453. package/node_modules/@types/lodash/fp/dropRight.d.ts +2 -0
  454. package/node_modules/@types/lodash/fp/dropRightWhile.d.ts +2 -0
  455. package/node_modules/@types/lodash/fp/dropWhile.d.ts +2 -0
  456. package/node_modules/@types/lodash/fp/each.d.ts +2 -0
  457. package/node_modules/@types/lodash/fp/eachRight.d.ts +2 -0
  458. package/node_modules/@types/lodash/fp/endsWith.d.ts +2 -0
  459. package/node_modules/@types/lodash/fp/entries.d.ts +2 -0
  460. package/node_modules/@types/lodash/fp/entriesIn.d.ts +2 -0
  461. package/node_modules/@types/lodash/fp/eq.d.ts +2 -0
  462. package/node_modules/@types/lodash/fp/equals.d.ts +2 -0
  463. package/node_modules/@types/lodash/fp/escape.d.ts +2 -0
  464. package/node_modules/@types/lodash/fp/escapeRegExp.d.ts +2 -0
  465. package/node_modules/@types/lodash/fp/every.d.ts +2 -0
  466. package/node_modules/@types/lodash/fp/extend.d.ts +2 -0
  467. package/node_modules/@types/lodash/fp/extendAll.d.ts +2 -0
  468. package/node_modules/@types/lodash/fp/extendAllWith.d.ts +2 -0
  469. package/node_modules/@types/lodash/fp/extendWith.d.ts +2 -0
  470. package/node_modules/@types/lodash/fp/fill.d.ts +2 -0
  471. package/node_modules/@types/lodash/fp/filter.d.ts +2 -0
  472. package/node_modules/@types/lodash/fp/find.d.ts +2 -0
  473. package/node_modules/@types/lodash/fp/findFrom.d.ts +2 -0
  474. package/node_modules/@types/lodash/fp/findIndex.d.ts +2 -0
  475. package/node_modules/@types/lodash/fp/findIndexFrom.d.ts +2 -0
  476. package/node_modules/@types/lodash/fp/findKey.d.ts +2 -0
  477. package/node_modules/@types/lodash/fp/findLast.d.ts +2 -0
  478. package/node_modules/@types/lodash/fp/findLastFrom.d.ts +2 -0
  479. package/node_modules/@types/lodash/fp/findLastIndex.d.ts +2 -0
  480. package/node_modules/@types/lodash/fp/findLastIndexFrom.d.ts +2 -0
  481. package/node_modules/@types/lodash/fp/findLastKey.d.ts +2 -0
  482. package/node_modules/@types/lodash/fp/first.d.ts +2 -0
  483. package/node_modules/@types/lodash/fp/flatMap.d.ts +2 -0
  484. package/node_modules/@types/lodash/fp/flatMapDeep.d.ts +2 -0
  485. package/node_modules/@types/lodash/fp/flatMapDepth.d.ts +2 -0
  486. package/node_modules/@types/lodash/fp/flatten.d.ts +2 -0
  487. package/node_modules/@types/lodash/fp/flattenDeep.d.ts +2 -0
  488. package/node_modules/@types/lodash/fp/flattenDepth.d.ts +2 -0
  489. package/node_modules/@types/lodash/fp/flip.d.ts +2 -0
  490. package/node_modules/@types/lodash/fp/floor.d.ts +2 -0
  491. package/node_modules/@types/lodash/fp/flow.d.ts +2 -0
  492. package/node_modules/@types/lodash/fp/flowRight.d.ts +2 -0
  493. package/node_modules/@types/lodash/fp/forEach.d.ts +2 -0
  494. package/node_modules/@types/lodash/fp/forEachRight.d.ts +2 -0
  495. package/node_modules/@types/lodash/fp/forIn.d.ts +2 -0
  496. package/node_modules/@types/lodash/fp/forInRight.d.ts +2 -0
  497. package/node_modules/@types/lodash/fp/forOwn.d.ts +2 -0
  498. package/node_modules/@types/lodash/fp/forOwnRight.d.ts +2 -0
  499. package/node_modules/@types/lodash/fp/fromPairs.d.ts +2 -0
  500. package/node_modules/@types/lodash/fp/functions.d.ts +2 -0
  501. package/node_modules/@types/lodash/fp/functionsIn.d.ts +2 -0
  502. package/node_modules/@types/lodash/fp/get.d.ts +2 -0
  503. package/node_modules/@types/lodash/fp/getOr.d.ts +2 -0
  504. package/node_modules/@types/lodash/fp/groupBy.d.ts +2 -0
  505. package/node_modules/@types/lodash/fp/gt.d.ts +2 -0
  506. package/node_modules/@types/lodash/fp/gte.d.ts +2 -0
  507. package/node_modules/@types/lodash/fp/has.d.ts +2 -0
  508. package/node_modules/@types/lodash/fp/hasIn.d.ts +2 -0
  509. package/node_modules/@types/lodash/fp/head.d.ts +2 -0
  510. package/node_modules/@types/lodash/fp/identical.d.ts +2 -0
  511. package/node_modules/@types/lodash/fp/identity.d.ts +2 -0
  512. package/node_modules/@types/lodash/fp/inRange.d.ts +2 -0
  513. package/node_modules/@types/lodash/fp/includes.d.ts +2 -0
  514. package/node_modules/@types/lodash/fp/includesFrom.d.ts +2 -0
  515. package/node_modules/@types/lodash/fp/indexBy.d.ts +2 -0
  516. package/node_modules/@types/lodash/fp/indexOf.d.ts +2 -0
  517. package/node_modules/@types/lodash/fp/indexOfFrom.d.ts +2 -0
  518. package/node_modules/@types/lodash/fp/init.d.ts +2 -0
  519. package/node_modules/@types/lodash/fp/initial.d.ts +2 -0
  520. package/node_modules/@types/lodash/fp/intersection.d.ts +2 -0
  521. package/node_modules/@types/lodash/fp/intersectionBy.d.ts +2 -0
  522. package/node_modules/@types/lodash/fp/intersectionWith.d.ts +2 -0
  523. package/node_modules/@types/lodash/fp/invert.d.ts +2 -0
  524. package/node_modules/@types/lodash/fp/invertBy.d.ts +2 -0
  525. package/node_modules/@types/lodash/fp/invertObj.d.ts +2 -0
  526. package/node_modules/@types/lodash/fp/invoke.d.ts +2 -0
  527. package/node_modules/@types/lodash/fp/invokeArgs.d.ts +2 -0
  528. package/node_modules/@types/lodash/fp/invokeArgsMap.d.ts +2 -0
  529. package/node_modules/@types/lodash/fp/invokeMap.d.ts +2 -0
  530. package/node_modules/@types/lodash/fp/isArguments.d.ts +2 -0
  531. package/node_modules/@types/lodash/fp/isArray.d.ts +2 -0
  532. package/node_modules/@types/lodash/fp/isArrayBuffer.d.ts +2 -0
  533. package/node_modules/@types/lodash/fp/isArrayLike.d.ts +2 -0
  534. package/node_modules/@types/lodash/fp/isArrayLikeObject.d.ts +2 -0
  535. package/node_modules/@types/lodash/fp/isBoolean.d.ts +2 -0
  536. package/node_modules/@types/lodash/fp/isBuffer.d.ts +2 -0
  537. package/node_modules/@types/lodash/fp/isDate.d.ts +2 -0
  538. package/node_modules/@types/lodash/fp/isElement.d.ts +2 -0
  539. package/node_modules/@types/lodash/fp/isEmpty.d.ts +2 -0
  540. package/node_modules/@types/lodash/fp/isEqual.d.ts +2 -0
  541. package/node_modules/@types/lodash/fp/isEqualWith.d.ts +2 -0
  542. package/node_modules/@types/lodash/fp/isError.d.ts +2 -0
  543. package/node_modules/@types/lodash/fp/isFinite.d.ts +2 -0
  544. package/node_modules/@types/lodash/fp/isFunction.d.ts +2 -0
  545. package/node_modules/@types/lodash/fp/isInteger.d.ts +2 -0
  546. package/node_modules/@types/lodash/fp/isLength.d.ts +2 -0
  547. package/node_modules/@types/lodash/fp/isMap.d.ts +2 -0
  548. package/node_modules/@types/lodash/fp/isMatch.d.ts +2 -0
  549. package/node_modules/@types/lodash/fp/isMatchWith.d.ts +2 -0
  550. package/node_modules/@types/lodash/fp/isNaN.d.ts +2 -0
  551. package/node_modules/@types/lodash/fp/isNative.d.ts +2 -0
  552. package/node_modules/@types/lodash/fp/isNil.d.ts +2 -0
  553. package/node_modules/@types/lodash/fp/isNull.d.ts +2 -0
  554. package/node_modules/@types/lodash/fp/isNumber.d.ts +2 -0
  555. package/node_modules/@types/lodash/fp/isObject.d.ts +2 -0
  556. package/node_modules/@types/lodash/fp/isObjectLike.d.ts +2 -0
  557. package/node_modules/@types/lodash/fp/isPlainObject.d.ts +2 -0
  558. package/node_modules/@types/lodash/fp/isRegExp.d.ts +2 -0
  559. package/node_modules/@types/lodash/fp/isSafeInteger.d.ts +2 -0
  560. package/node_modules/@types/lodash/fp/isSet.d.ts +2 -0
  561. package/node_modules/@types/lodash/fp/isString.d.ts +2 -0
  562. package/node_modules/@types/lodash/fp/isSymbol.d.ts +2 -0
  563. package/node_modules/@types/lodash/fp/isTypedArray.d.ts +2 -0
  564. package/node_modules/@types/lodash/fp/isUndefined.d.ts +2 -0
  565. package/node_modules/@types/lodash/fp/isWeakMap.d.ts +2 -0
  566. package/node_modules/@types/lodash/fp/isWeakSet.d.ts +2 -0
  567. package/node_modules/@types/lodash/fp/iteratee.d.ts +2 -0
  568. package/node_modules/@types/lodash/fp/join.d.ts +2 -0
  569. package/node_modules/@types/lodash/fp/juxt.d.ts +2 -0
  570. package/node_modules/@types/lodash/fp/kebabCase.d.ts +2 -0
  571. package/node_modules/@types/lodash/fp/keyBy.d.ts +2 -0
  572. package/node_modules/@types/lodash/fp/keys.d.ts +2 -0
  573. package/node_modules/@types/lodash/fp/keysIn.d.ts +2 -0
  574. package/node_modules/@types/lodash/fp/last.d.ts +2 -0
  575. package/node_modules/@types/lodash/fp/lastIndexOf.d.ts +2 -0
  576. package/node_modules/@types/lodash/fp/lastIndexOfFrom.d.ts +2 -0
  577. package/node_modules/@types/lodash/fp/lowerCase.d.ts +2 -0
  578. package/node_modules/@types/lodash/fp/lowerFirst.d.ts +2 -0
  579. package/node_modules/@types/lodash/fp/lt.d.ts +2 -0
  580. package/node_modules/@types/lodash/fp/lte.d.ts +2 -0
  581. package/node_modules/@types/lodash/fp/map.d.ts +2 -0
  582. package/node_modules/@types/lodash/fp/mapKeys.d.ts +2 -0
  583. package/node_modules/@types/lodash/fp/mapValues.d.ts +2 -0
  584. package/node_modules/@types/lodash/fp/matches.d.ts +2 -0
  585. package/node_modules/@types/lodash/fp/matchesProperty.d.ts +2 -0
  586. package/node_modules/@types/lodash/fp/max.d.ts +2 -0
  587. package/node_modules/@types/lodash/fp/maxBy.d.ts +2 -0
  588. package/node_modules/@types/lodash/fp/mean.d.ts +2 -0
  589. package/node_modules/@types/lodash/fp/meanBy.d.ts +2 -0
  590. package/node_modules/@types/lodash/fp/memoize.d.ts +2 -0
  591. package/node_modules/@types/lodash/fp/merge.d.ts +2 -0
  592. package/node_modules/@types/lodash/fp/mergeAll.d.ts +2 -0
  593. package/node_modules/@types/lodash/fp/mergeAllWith.d.ts +2 -0
  594. package/node_modules/@types/lodash/fp/mergeWith.d.ts +2 -0
  595. package/node_modules/@types/lodash/fp/method.d.ts +2 -0
  596. package/node_modules/@types/lodash/fp/methodOf.d.ts +2 -0
  597. package/node_modules/@types/lodash/fp/min.d.ts +2 -0
  598. package/node_modules/@types/lodash/fp/minBy.d.ts +2 -0
  599. package/node_modules/@types/lodash/fp/multiply.d.ts +2 -0
  600. package/node_modules/@types/lodash/fp/nAry.d.ts +2 -0
  601. package/node_modules/@types/lodash/fp/negate.d.ts +2 -0
  602. package/node_modules/@types/lodash/fp/noConflict.d.ts +2 -0
  603. package/node_modules/@types/lodash/fp/noop.d.ts +2 -0
  604. package/node_modules/@types/lodash/fp/now.d.ts +2 -0
  605. package/node_modules/@types/lodash/fp/nth.d.ts +2 -0
  606. package/node_modules/@types/lodash/fp/nthArg.d.ts +2 -0
  607. package/node_modules/@types/lodash/fp/omit.d.ts +2 -0
  608. package/node_modules/@types/lodash/fp/omitAll.d.ts +2 -0
  609. package/node_modules/@types/lodash/fp/omitBy.d.ts +2 -0
  610. package/node_modules/@types/lodash/fp/once.d.ts +2 -0
  611. package/node_modules/@types/lodash/fp/orderBy.d.ts +2 -0
  612. package/node_modules/@types/lodash/fp/over.d.ts +2 -0
  613. package/node_modules/@types/lodash/fp/overArgs.d.ts +2 -0
  614. package/node_modules/@types/lodash/fp/overEvery.d.ts +2 -0
  615. package/node_modules/@types/lodash/fp/overSome.d.ts +2 -0
  616. package/node_modules/@types/lodash/fp/pad.d.ts +2 -0
  617. package/node_modules/@types/lodash/fp/padChars.d.ts +2 -0
  618. package/node_modules/@types/lodash/fp/padCharsEnd.d.ts +2 -0
  619. package/node_modules/@types/lodash/fp/padCharsStart.d.ts +2 -0
  620. package/node_modules/@types/lodash/fp/padEnd.d.ts +2 -0
  621. package/node_modules/@types/lodash/fp/padStart.d.ts +2 -0
  622. package/node_modules/@types/lodash/fp/parseInt.d.ts +2 -0
  623. package/node_modules/@types/lodash/fp/partial.d.ts +2 -0
  624. package/node_modules/@types/lodash/fp/partialRight.d.ts +2 -0
  625. package/node_modules/@types/lodash/fp/partition.d.ts +2 -0
  626. package/node_modules/@types/lodash/fp/path.d.ts +2 -0
  627. package/node_modules/@types/lodash/fp/pathEq.d.ts +2 -0
  628. package/node_modules/@types/lodash/fp/pathOr.d.ts +2 -0
  629. package/node_modules/@types/lodash/fp/paths.d.ts +2 -0
  630. package/node_modules/@types/lodash/fp/pick.d.ts +2 -0
  631. package/node_modules/@types/lodash/fp/pickAll.d.ts +2 -0
  632. package/node_modules/@types/lodash/fp/pickBy.d.ts +2 -0
  633. package/node_modules/@types/lodash/fp/pipe.d.ts +2 -0
  634. package/node_modules/@types/lodash/fp/placeholder.d.ts +3 -0
  635. package/node_modules/@types/lodash/fp/pluck.d.ts +2 -0
  636. package/node_modules/@types/lodash/fp/prop.d.ts +2 -0
  637. package/node_modules/@types/lodash/fp/propEq.d.ts +2 -0
  638. package/node_modules/@types/lodash/fp/propOr.d.ts +2 -0
  639. package/node_modules/@types/lodash/fp/property.d.ts +2 -0
  640. package/node_modules/@types/lodash/fp/propertyOf.d.ts +2 -0
  641. package/node_modules/@types/lodash/fp/props.d.ts +2 -0
  642. package/node_modules/@types/lodash/fp/pull.d.ts +2 -0
  643. package/node_modules/@types/lodash/fp/pullAll.d.ts +2 -0
  644. package/node_modules/@types/lodash/fp/pullAllBy.d.ts +2 -0
  645. package/node_modules/@types/lodash/fp/pullAllWith.d.ts +2 -0
  646. package/node_modules/@types/lodash/fp/pullAt.d.ts +2 -0
  647. package/node_modules/@types/lodash/fp/random.d.ts +2 -0
  648. package/node_modules/@types/lodash/fp/range.d.ts +2 -0
  649. package/node_modules/@types/lodash/fp/rangeRight.d.ts +2 -0
  650. package/node_modules/@types/lodash/fp/rangeStep.d.ts +2 -0
  651. package/node_modules/@types/lodash/fp/rangeStepRight.d.ts +2 -0
  652. package/node_modules/@types/lodash/fp/rearg.d.ts +2 -0
  653. package/node_modules/@types/lodash/fp/reduce.d.ts +2 -0
  654. package/node_modules/@types/lodash/fp/reduceRight.d.ts +2 -0
  655. package/node_modules/@types/lodash/fp/reject.d.ts +2 -0
  656. package/node_modules/@types/lodash/fp/remove.d.ts +2 -0
  657. package/node_modules/@types/lodash/fp/repeat.d.ts +2 -0
  658. package/node_modules/@types/lodash/fp/replace.d.ts +2 -0
  659. package/node_modules/@types/lodash/fp/rest.d.ts +2 -0
  660. package/node_modules/@types/lodash/fp/restFrom.d.ts +2 -0
  661. package/node_modules/@types/lodash/fp/result.d.ts +2 -0
  662. package/node_modules/@types/lodash/fp/reverse.d.ts +2 -0
  663. package/node_modules/@types/lodash/fp/round.d.ts +2 -0
  664. package/node_modules/@types/lodash/fp/runInContext.d.ts +2 -0
  665. package/node_modules/@types/lodash/fp/sample.d.ts +2 -0
  666. package/node_modules/@types/lodash/fp/sampleSize.d.ts +2 -0
  667. package/node_modules/@types/lodash/fp/set.d.ts +2 -0
  668. package/node_modules/@types/lodash/fp/setWith.d.ts +2 -0
  669. package/node_modules/@types/lodash/fp/shuffle.d.ts +2 -0
  670. package/node_modules/@types/lodash/fp/size.d.ts +2 -0
  671. package/node_modules/@types/lodash/fp/slice.d.ts +2 -0
  672. package/node_modules/@types/lodash/fp/snakeCase.d.ts +2 -0
  673. package/node_modules/@types/lodash/fp/some.d.ts +2 -0
  674. package/node_modules/@types/lodash/fp/sortBy.d.ts +2 -0
  675. package/node_modules/@types/lodash/fp/sortedIndex.d.ts +2 -0
  676. package/node_modules/@types/lodash/fp/sortedIndexBy.d.ts +2 -0
  677. package/node_modules/@types/lodash/fp/sortedIndexOf.d.ts +2 -0
  678. package/node_modules/@types/lodash/fp/sortedLastIndex.d.ts +2 -0
  679. package/node_modules/@types/lodash/fp/sortedLastIndexBy.d.ts +2 -0
  680. package/node_modules/@types/lodash/fp/sortedLastIndexOf.d.ts +2 -0
  681. package/node_modules/@types/lodash/fp/sortedUniq.d.ts +2 -0
  682. package/node_modules/@types/lodash/fp/sortedUniqBy.d.ts +2 -0
  683. package/node_modules/@types/lodash/fp/split.d.ts +2 -0
  684. package/node_modules/@types/lodash/fp/spread.d.ts +2 -0
  685. package/node_modules/@types/lodash/fp/spreadFrom.d.ts +2 -0
  686. package/node_modules/@types/lodash/fp/startCase.d.ts +2 -0
  687. package/node_modules/@types/lodash/fp/startsWith.d.ts +2 -0
  688. package/node_modules/@types/lodash/fp/stubArray.d.ts +2 -0
  689. package/node_modules/@types/lodash/fp/stubFalse.d.ts +2 -0
  690. package/node_modules/@types/lodash/fp/stubObject.d.ts +2 -0
  691. package/node_modules/@types/lodash/fp/stubString.d.ts +2 -0
  692. package/node_modules/@types/lodash/fp/stubTrue.d.ts +2 -0
  693. package/node_modules/@types/lodash/fp/subtract.d.ts +2 -0
  694. package/node_modules/@types/lodash/fp/sum.d.ts +2 -0
  695. package/node_modules/@types/lodash/fp/sumBy.d.ts +2 -0
  696. package/node_modules/@types/lodash/fp/symmetricDifference.d.ts +2 -0
  697. package/node_modules/@types/lodash/fp/symmetricDifferenceBy.d.ts +2 -0
  698. package/node_modules/@types/lodash/fp/symmetricDifferenceWith.d.ts +2 -0
  699. package/node_modules/@types/lodash/fp/tail.d.ts +2 -0
  700. package/node_modules/@types/lodash/fp/take.d.ts +2 -0
  701. package/node_modules/@types/lodash/fp/takeLast.d.ts +2 -0
  702. package/node_modules/@types/lodash/fp/takeLastWhile.d.ts +2 -0
  703. package/node_modules/@types/lodash/fp/takeRight.d.ts +2 -0
  704. package/node_modules/@types/lodash/fp/takeRightWhile.d.ts +2 -0
  705. package/node_modules/@types/lodash/fp/takeWhile.d.ts +2 -0
  706. package/node_modules/@types/lodash/fp/tap.d.ts +2 -0
  707. package/node_modules/@types/lodash/fp/template.d.ts +2 -0
  708. package/node_modules/@types/lodash/fp/throttle.d.ts +2 -0
  709. package/node_modules/@types/lodash/fp/thru.d.ts +2 -0
  710. package/node_modules/@types/lodash/fp/times.d.ts +2 -0
  711. package/node_modules/@types/lodash/fp/toArray.d.ts +2 -0
  712. package/node_modules/@types/lodash/fp/toFinite.d.ts +2 -0
  713. package/node_modules/@types/lodash/fp/toInteger.d.ts +2 -0
  714. package/node_modules/@types/lodash/fp/toLength.d.ts +2 -0
  715. package/node_modules/@types/lodash/fp/toLower.d.ts +2 -0
  716. package/node_modules/@types/lodash/fp/toNumber.d.ts +2 -0
  717. package/node_modules/@types/lodash/fp/toPairs.d.ts +2 -0
  718. package/node_modules/@types/lodash/fp/toPairsIn.d.ts +2 -0
  719. package/node_modules/@types/lodash/fp/toPath.d.ts +2 -0
  720. package/node_modules/@types/lodash/fp/toPlainObject.d.ts +2 -0
  721. package/node_modules/@types/lodash/fp/toSafeInteger.d.ts +2 -0
  722. package/node_modules/@types/lodash/fp/toString.d.ts +2 -0
  723. package/node_modules/@types/lodash/fp/toUpper.d.ts +2 -0
  724. package/node_modules/@types/lodash/fp/transform.d.ts +2 -0
  725. package/node_modules/@types/lodash/fp/trim.d.ts +2 -0
  726. package/node_modules/@types/lodash/fp/trimChars.d.ts +2 -0
  727. package/node_modules/@types/lodash/fp/trimCharsEnd.d.ts +2 -0
  728. package/node_modules/@types/lodash/fp/trimCharsStart.d.ts +2 -0
  729. package/node_modules/@types/lodash/fp/trimEnd.d.ts +2 -0
  730. package/node_modules/@types/lodash/fp/trimStart.d.ts +2 -0
  731. package/node_modules/@types/lodash/fp/truncate.d.ts +2 -0
  732. package/node_modules/@types/lodash/fp/unapply.d.ts +2 -0
  733. package/node_modules/@types/lodash/fp/unary.d.ts +2 -0
  734. package/node_modules/@types/lodash/fp/unescape.d.ts +2 -0
  735. package/node_modules/@types/lodash/fp/union.d.ts +2 -0
  736. package/node_modules/@types/lodash/fp/unionBy.d.ts +2 -0
  737. package/node_modules/@types/lodash/fp/unionWith.d.ts +2 -0
  738. package/node_modules/@types/lodash/fp/uniq.d.ts +2 -0
  739. package/node_modules/@types/lodash/fp/uniqBy.d.ts +2 -0
  740. package/node_modules/@types/lodash/fp/uniqWith.d.ts +2 -0
  741. package/node_modules/@types/lodash/fp/uniqueId.d.ts +2 -0
  742. package/node_modules/@types/lodash/fp/unnest.d.ts +2 -0
  743. package/node_modules/@types/lodash/fp/unset.d.ts +2 -0
  744. package/node_modules/@types/lodash/fp/unzip.d.ts +2 -0
  745. package/node_modules/@types/lodash/fp/unzipWith.d.ts +2 -0
  746. package/node_modules/@types/lodash/fp/update.d.ts +2 -0
  747. package/node_modules/@types/lodash/fp/updateWith.d.ts +2 -0
  748. package/node_modules/@types/lodash/fp/upperCase.d.ts +2 -0
  749. package/node_modules/@types/lodash/fp/upperFirst.d.ts +2 -0
  750. package/node_modules/@types/lodash/fp/useWith.d.ts +2 -0
  751. package/node_modules/@types/lodash/fp/values.d.ts +2 -0
  752. package/node_modules/@types/lodash/fp/valuesIn.d.ts +2 -0
  753. package/node_modules/@types/lodash/fp/where.d.ts +2 -0
  754. package/node_modules/@types/lodash/fp/whereEq.d.ts +2 -0
  755. package/node_modules/@types/lodash/fp/without.d.ts +2 -0
  756. package/node_modules/@types/lodash/fp/words.d.ts +2 -0
  757. package/node_modules/@types/lodash/fp/wrap.d.ts +2 -0
  758. package/node_modules/@types/lodash/fp/xor.d.ts +2 -0
  759. package/node_modules/@types/lodash/fp/xorBy.d.ts +2 -0
  760. package/node_modules/@types/lodash/fp/xorWith.d.ts +2 -0
  761. package/node_modules/@types/lodash/fp/zip.d.ts +2 -0
  762. package/node_modules/@types/lodash/fp/zipAll.d.ts +2 -0
  763. package/node_modules/@types/lodash/fp/zipObj.d.ts +2 -0
  764. package/node_modules/@types/lodash/fp/zipObject.d.ts +2 -0
  765. package/node_modules/@types/lodash/fp/zipObjectDeep.d.ts +2 -0
  766. package/node_modules/@types/lodash/fp/zipWith.d.ts +2 -0
  767. package/node_modules/@types/lodash/fp.d.ts +4962 -0
  768. package/node_modules/@types/lodash/fromPairs.d.ts +2 -0
  769. package/node_modules/@types/lodash/functions.d.ts +2 -0
  770. package/node_modules/@types/lodash/functionsIn.d.ts +2 -0
  771. package/node_modules/@types/lodash/get.d.ts +2 -0
  772. package/node_modules/@types/lodash/groupBy.d.ts +2 -0
  773. package/node_modules/@types/lodash/gt.d.ts +2 -0
  774. package/node_modules/@types/lodash/gte.d.ts +2 -0
  775. package/node_modules/@types/lodash/has.d.ts +2 -0
  776. package/node_modules/@types/lodash/hasIn.d.ts +2 -0
  777. package/node_modules/@types/lodash/head.d.ts +2 -0
  778. package/node_modules/@types/lodash/identity.d.ts +2 -0
  779. package/node_modules/@types/lodash/inRange.d.ts +2 -0
  780. package/node_modules/@types/lodash/includes.d.ts +2 -0
  781. package/node_modules/@types/lodash/index.d.ts +21 -0
  782. package/node_modules/@types/lodash/indexOf.d.ts +2 -0
  783. package/node_modules/@types/lodash/initial.d.ts +2 -0
  784. package/node_modules/@types/lodash/intersection.d.ts +2 -0
  785. package/node_modules/@types/lodash/intersectionBy.d.ts +2 -0
  786. package/node_modules/@types/lodash/intersectionWith.d.ts +2 -0
  787. package/node_modules/@types/lodash/invert.d.ts +2 -0
  788. package/node_modules/@types/lodash/invertBy.d.ts +2 -0
  789. package/node_modules/@types/lodash/invoke.d.ts +2 -0
  790. package/node_modules/@types/lodash/invokeMap.d.ts +2 -0
  791. package/node_modules/@types/lodash/isArguments.d.ts +2 -0
  792. package/node_modules/@types/lodash/isArray.d.ts +2 -0
  793. package/node_modules/@types/lodash/isArrayBuffer.d.ts +2 -0
  794. package/node_modules/@types/lodash/isArrayLike.d.ts +2 -0
  795. package/node_modules/@types/lodash/isArrayLikeObject.d.ts +2 -0
  796. package/node_modules/@types/lodash/isBoolean.d.ts +2 -0
  797. package/node_modules/@types/lodash/isBuffer.d.ts +2 -0
  798. package/node_modules/@types/lodash/isDate.d.ts +2 -0
  799. package/node_modules/@types/lodash/isElement.d.ts +2 -0
  800. package/node_modules/@types/lodash/isEmpty.d.ts +2 -0
  801. package/node_modules/@types/lodash/isEqual.d.ts +2 -0
  802. package/node_modules/@types/lodash/isEqualWith.d.ts +2 -0
  803. package/node_modules/@types/lodash/isError.d.ts +2 -0
  804. package/node_modules/@types/lodash/isFinite.d.ts +2 -0
  805. package/node_modules/@types/lodash/isFunction.d.ts +2 -0
  806. package/node_modules/@types/lodash/isInteger.d.ts +2 -0
  807. package/node_modules/@types/lodash/isLength.d.ts +2 -0
  808. package/node_modules/@types/lodash/isMap.d.ts +2 -0
  809. package/node_modules/@types/lodash/isMatch.d.ts +2 -0
  810. package/node_modules/@types/lodash/isMatchWith.d.ts +2 -0
  811. package/node_modules/@types/lodash/isNaN.d.ts +2 -0
  812. package/node_modules/@types/lodash/isNative.d.ts +2 -0
  813. package/node_modules/@types/lodash/isNil.d.ts +2 -0
  814. package/node_modules/@types/lodash/isNull.d.ts +2 -0
  815. package/node_modules/@types/lodash/isNumber.d.ts +2 -0
  816. package/node_modules/@types/lodash/isObject.d.ts +2 -0
  817. package/node_modules/@types/lodash/isObjectLike.d.ts +2 -0
  818. package/node_modules/@types/lodash/isPlainObject.d.ts +2 -0
  819. package/node_modules/@types/lodash/isRegExp.d.ts +2 -0
  820. package/node_modules/@types/lodash/isSafeInteger.d.ts +2 -0
  821. package/node_modules/@types/lodash/isSet.d.ts +2 -0
  822. package/node_modules/@types/lodash/isString.d.ts +2 -0
  823. package/node_modules/@types/lodash/isSymbol.d.ts +2 -0
  824. package/node_modules/@types/lodash/isTypedArray.d.ts +2 -0
  825. package/node_modules/@types/lodash/isUndefined.d.ts +2 -0
  826. package/node_modules/@types/lodash/isWeakMap.d.ts +2 -0
  827. package/node_modules/@types/lodash/isWeakSet.d.ts +2 -0
  828. package/node_modules/@types/lodash/iteratee.d.ts +2 -0
  829. package/node_modules/@types/lodash/join.d.ts +2 -0
  830. package/node_modules/@types/lodash/kebabCase.d.ts +2 -0
  831. package/node_modules/@types/lodash/keyBy.d.ts +2 -0
  832. package/node_modules/@types/lodash/keys.d.ts +2 -0
  833. package/node_modules/@types/lodash/keysIn.d.ts +2 -0
  834. package/node_modules/@types/lodash/last.d.ts +2 -0
  835. package/node_modules/@types/lodash/lastIndexOf.d.ts +2 -0
  836. package/node_modules/@types/lodash/lowerCase.d.ts +2 -0
  837. package/node_modules/@types/lodash/lowerFirst.d.ts +2 -0
  838. package/node_modules/@types/lodash/lt.d.ts +2 -0
  839. package/node_modules/@types/lodash/lte.d.ts +2 -0
  840. package/node_modules/@types/lodash/map.d.ts +2 -0
  841. package/node_modules/@types/lodash/mapKeys.d.ts +2 -0
  842. package/node_modules/@types/lodash/mapValues.d.ts +2 -0
  843. package/node_modules/@types/lodash/matches.d.ts +2 -0
  844. package/node_modules/@types/lodash/matchesProperty.d.ts +2 -0
  845. package/node_modules/@types/lodash/max.d.ts +2 -0
  846. package/node_modules/@types/lodash/maxBy.d.ts +2 -0
  847. package/node_modules/@types/lodash/mean.d.ts +2 -0
  848. package/node_modules/@types/lodash/meanBy.d.ts +2 -0
  849. package/node_modules/@types/lodash/memoize.d.ts +2 -0
  850. package/node_modules/@types/lodash/merge.d.ts +2 -0
  851. package/node_modules/@types/lodash/mergeWith.d.ts +2 -0
  852. package/node_modules/@types/lodash/method.d.ts +2 -0
  853. package/node_modules/@types/lodash/methodOf.d.ts +2 -0
  854. package/node_modules/@types/lodash/min.d.ts +2 -0
  855. package/node_modules/@types/lodash/minBy.d.ts +2 -0
  856. package/node_modules/@types/lodash/mixin.d.ts +2 -0
  857. package/node_modules/@types/lodash/multiply.d.ts +2 -0
  858. package/node_modules/@types/lodash/negate.d.ts +2 -0
  859. package/node_modules/@types/lodash/noConflict.d.ts +2 -0
  860. package/node_modules/@types/lodash/noop.d.ts +2 -0
  861. package/node_modules/@types/lodash/now.d.ts +2 -0
  862. package/node_modules/@types/lodash/nth.d.ts +2 -0
  863. package/node_modules/@types/lodash/nthArg.d.ts +2 -0
  864. package/node_modules/@types/lodash/omit.d.ts +2 -0
  865. package/node_modules/@types/lodash/omitBy.d.ts +2 -0
  866. package/node_modules/@types/lodash/once.d.ts +2 -0
  867. package/node_modules/@types/lodash/orderBy.d.ts +2 -0
  868. package/node_modules/@types/lodash/over.d.ts +2 -0
  869. package/node_modules/@types/lodash/overArgs.d.ts +2 -0
  870. package/node_modules/@types/lodash/overEvery.d.ts +2 -0
  871. package/node_modules/@types/lodash/overSome.d.ts +2 -0
  872. package/node_modules/@types/lodash/package.json +56 -0
  873. package/node_modules/@types/lodash/pad.d.ts +2 -0
  874. package/node_modules/@types/lodash/padEnd.d.ts +2 -0
  875. package/node_modules/@types/lodash/padStart.d.ts +2 -0
  876. package/node_modules/@types/lodash/parseInt.d.ts +2 -0
  877. package/node_modules/@types/lodash/partial.d.ts +2 -0
  878. package/node_modules/@types/lodash/partialRight.d.ts +2 -0
  879. package/node_modules/@types/lodash/partition.d.ts +2 -0
  880. package/node_modules/@types/lodash/pick.d.ts +2 -0
  881. package/node_modules/@types/lodash/pickBy.d.ts +2 -0
  882. package/node_modules/@types/lodash/property.d.ts +2 -0
  883. package/node_modules/@types/lodash/propertyOf.d.ts +2 -0
  884. package/node_modules/@types/lodash/pull.d.ts +2 -0
  885. package/node_modules/@types/lodash/pullAll.d.ts +2 -0
  886. package/node_modules/@types/lodash/pullAllBy.d.ts +2 -0
  887. package/node_modules/@types/lodash/pullAllWith.d.ts +2 -0
  888. package/node_modules/@types/lodash/pullAt.d.ts +2 -0
  889. package/node_modules/@types/lodash/random.d.ts +2 -0
  890. package/node_modules/@types/lodash/range.d.ts +2 -0
  891. package/node_modules/@types/lodash/rangeRight.d.ts +2 -0
  892. package/node_modules/@types/lodash/rearg.d.ts +2 -0
  893. package/node_modules/@types/lodash/reduce.d.ts +2 -0
  894. package/node_modules/@types/lodash/reduceRight.d.ts +2 -0
  895. package/node_modules/@types/lodash/reject.d.ts +2 -0
  896. package/node_modules/@types/lodash/remove.d.ts +2 -0
  897. package/node_modules/@types/lodash/repeat.d.ts +2 -0
  898. package/node_modules/@types/lodash/replace.d.ts +2 -0
  899. package/node_modules/@types/lodash/rest.d.ts +2 -0
  900. package/node_modules/@types/lodash/result.d.ts +2 -0
  901. package/node_modules/@types/lodash/reverse.d.ts +2 -0
  902. package/node_modules/@types/lodash/round.d.ts +2 -0
  903. package/node_modules/@types/lodash/runInContext.d.ts +2 -0
  904. package/node_modules/@types/lodash/sample.d.ts +2 -0
  905. package/node_modules/@types/lodash/sampleSize.d.ts +2 -0
  906. package/node_modules/@types/lodash/set.d.ts +2 -0
  907. package/node_modules/@types/lodash/setWith.d.ts +2 -0
  908. package/node_modules/@types/lodash/shuffle.d.ts +2 -0
  909. package/node_modules/@types/lodash/size.d.ts +2 -0
  910. package/node_modules/@types/lodash/slice.d.ts +2 -0
  911. package/node_modules/@types/lodash/snakeCase.d.ts +2 -0
  912. package/node_modules/@types/lodash/some.d.ts +2 -0
  913. package/node_modules/@types/lodash/sortBy.d.ts +2 -0
  914. package/node_modules/@types/lodash/sortedIndex.d.ts +2 -0
  915. package/node_modules/@types/lodash/sortedIndexBy.d.ts +2 -0
  916. package/node_modules/@types/lodash/sortedIndexOf.d.ts +2 -0
  917. package/node_modules/@types/lodash/sortedLastIndex.d.ts +2 -0
  918. package/node_modules/@types/lodash/sortedLastIndexBy.d.ts +2 -0
  919. package/node_modules/@types/lodash/sortedLastIndexOf.d.ts +2 -0
  920. package/node_modules/@types/lodash/sortedUniq.d.ts +2 -0
  921. package/node_modules/@types/lodash/sortedUniqBy.d.ts +2 -0
  922. package/node_modules/@types/lodash/split.d.ts +2 -0
  923. package/node_modules/@types/lodash/spread.d.ts +2 -0
  924. package/node_modules/@types/lodash/startCase.d.ts +2 -0
  925. package/node_modules/@types/lodash/startsWith.d.ts +2 -0
  926. package/node_modules/@types/lodash/stubFalse.d.ts +2 -0
  927. package/node_modules/@types/lodash/stubTrue.d.ts +2 -0
  928. package/node_modules/@types/lodash/subtract.d.ts +2 -0
  929. package/node_modules/@types/lodash/sum.d.ts +2 -0
  930. package/node_modules/@types/lodash/sumBy.d.ts +2 -0
  931. package/node_modules/@types/lodash/tail.d.ts +2 -0
  932. package/node_modules/@types/lodash/take.d.ts +2 -0
  933. package/node_modules/@types/lodash/takeRight.d.ts +2 -0
  934. package/node_modules/@types/lodash/takeRightWhile.d.ts +2 -0
  935. package/node_modules/@types/lodash/takeWhile.d.ts +2 -0
  936. package/node_modules/@types/lodash/tap.d.ts +2 -0
  937. package/node_modules/@types/lodash/template.d.ts +2 -0
  938. package/node_modules/@types/lodash/throttle.d.ts +2 -0
  939. package/node_modules/@types/lodash/thru.d.ts +2 -0
  940. package/node_modules/@types/lodash/times.d.ts +2 -0
  941. package/node_modules/@types/lodash/toArray.d.ts +2 -0
  942. package/node_modules/@types/lodash/toFinite.d.ts +2 -0
  943. package/node_modules/@types/lodash/toInteger.d.ts +2 -0
  944. package/node_modules/@types/lodash/toLength.d.ts +2 -0
  945. package/node_modules/@types/lodash/toLower.d.ts +2 -0
  946. package/node_modules/@types/lodash/toNumber.d.ts +2 -0
  947. package/node_modules/@types/lodash/toPairs.d.ts +2 -0
  948. package/node_modules/@types/lodash/toPairsIn.d.ts +2 -0
  949. package/node_modules/@types/lodash/toPath.d.ts +2 -0
  950. package/node_modules/@types/lodash/toPlainObject.d.ts +2 -0
  951. package/node_modules/@types/lodash/toSafeInteger.d.ts +2 -0
  952. package/node_modules/@types/lodash/toString.d.ts +2 -0
  953. package/node_modules/@types/lodash/toUpper.d.ts +2 -0
  954. package/node_modules/@types/lodash/transform.d.ts +2 -0
  955. package/node_modules/@types/lodash/trim.d.ts +2 -0
  956. package/node_modules/@types/lodash/trimEnd.d.ts +2 -0
  957. package/node_modules/@types/lodash/trimStart.d.ts +2 -0
  958. package/node_modules/@types/lodash/truncate.d.ts +2 -0
  959. package/node_modules/@types/lodash/unary.d.ts +2 -0
  960. package/node_modules/@types/lodash/unescape.d.ts +2 -0
  961. package/node_modules/@types/lodash/union.d.ts +2 -0
  962. package/node_modules/@types/lodash/unionBy.d.ts +2 -0
  963. package/node_modules/@types/lodash/unionWith.d.ts +2 -0
  964. package/node_modules/@types/lodash/uniq.d.ts +2 -0
  965. package/node_modules/@types/lodash/uniqBy.d.ts +2 -0
  966. package/node_modules/@types/lodash/uniqWith.d.ts +2 -0
  967. package/node_modules/@types/lodash/uniqueId.d.ts +2 -0
  968. package/node_modules/@types/lodash/unset.d.ts +2 -0
  969. package/node_modules/@types/lodash/unzip.d.ts +2 -0
  970. package/node_modules/@types/lodash/unzipWith.d.ts +2 -0
  971. package/node_modules/@types/lodash/update.d.ts +2 -0
  972. package/node_modules/@types/lodash/updateWith.d.ts +2 -0
  973. package/node_modules/@types/lodash/upperCase.d.ts +2 -0
  974. package/node_modules/@types/lodash/upperFirst.d.ts +2 -0
  975. package/node_modules/@types/lodash/values.d.ts +2 -0
  976. package/node_modules/@types/lodash/valuesIn.d.ts +2 -0
  977. package/node_modules/@types/lodash/without.d.ts +2 -0
  978. package/node_modules/@types/lodash/words.d.ts +2 -0
  979. package/node_modules/@types/lodash/wrap.d.ts +2 -0
  980. package/node_modules/@types/lodash/xor.d.ts +2 -0
  981. package/node_modules/@types/lodash/xorBy.d.ts +2 -0
  982. package/node_modules/@types/lodash/xorWith.d.ts +2 -0
  983. package/node_modules/@types/lodash/zip.d.ts +2 -0
  984. package/node_modules/@types/lodash/zipObject.d.ts +2 -0
  985. package/node_modules/@types/lodash/zipObjectDeep.d.ts +2 -0
  986. package/node_modules/@types/lodash/zipWith.d.ts +2 -0
  987. package/node_modules/@types/lodash.transform/LICENSE +21 -0
  988. package/node_modules/@types/lodash.transform/README.md +23 -0
  989. package/node_modules/@types/lodash.transform/index.d.ts +4 -0
  990. package/node_modules/@types/lodash.transform/package.json +32 -0
  991. package/node_modules/@types/uuid/LICENSE +21 -0
  992. package/node_modules/@types/uuid/README.md +15 -0
  993. package/node_modules/@types/uuid/index.d.mts +19 -0
  994. package/node_modules/@types/uuid/index.d.ts +113 -0
  995. package/node_modules/@types/uuid/package.json +54 -0
  996. package/node_modules/big-integer/BigInteger.d.ts +2393 -0
  997. package/node_modules/big-integer/BigInteger.js +1453 -0
  998. package/node_modules/big-integer/BigInteger.min.js +1 -0
  999. package/node_modules/big-integer/LICENSE +24 -0
  1000. package/node_modules/big-integer/README.md +589 -0
  1001. package/node_modules/big-integer/bower.json +29 -0
  1002. package/node_modules/big-integer/package.json +48 -0
  1003. package/node_modules/big-integer/tsconfig.json +24 -0
  1004. package/node_modules/decimal.js-light/CHANGELOG.md +87 -0
  1005. package/node_modules/decimal.js-light/LICENCE.md +23 -0
  1006. package/node_modules/decimal.js-light/README.md +92 -0
  1007. package/node_modules/decimal.js-light/decimal.d.ts +570 -0
  1008. package/node_modules/decimal.js-light/decimal.js +2014 -0
  1009. package/node_modules/decimal.js-light/decimal.min.js +3 -0
  1010. package/node_modules/decimal.js-light/decimal.mjs +1985 -0
  1011. package/node_modules/decimal.js-light/doc/API.html +1312 -0
  1012. package/node_modules/decimal.js-light/doc/decimal.js.map +1 -0
  1013. package/node_modules/decimal.js-light/package.json +36 -0
  1014. package/node_modules/eventemitter3/LICENSE +21 -0
  1015. package/node_modules/eventemitter3/README.md +85 -0
  1016. package/node_modules/eventemitter3/dist/eventemitter3.esm.js +355 -0
  1017. package/node_modules/eventemitter3/dist/eventemitter3.esm.min.js +1 -0
  1018. package/node_modules/eventemitter3/dist/eventemitter3.esm.min.js.map +1 -0
  1019. package/node_modules/eventemitter3/dist/eventemitter3.umd.js +363 -0
  1020. package/node_modules/eventemitter3/dist/eventemitter3.umd.min.js +1 -0
  1021. package/node_modules/eventemitter3/dist/eventemitter3.umd.min.js.map +1 -0
  1022. package/node_modules/eventemitter3/index.d.ts +135 -0
  1023. package/node_modules/eventemitter3/index.js +336 -0
  1024. package/node_modules/eventemitter3/index.mjs +4 -0
  1025. package/node_modules/eventemitter3/package.json +62 -0
  1026. package/node_modules/lodash.transform/LICENSE +47 -0
  1027. package/node_modules/lodash.transform/README.md +18 -0
  1028. package/node_modules/lodash.transform/index.js +2329 -0
  1029. package/node_modules/lodash.transform/package.json +17 -0
  1030. package/node_modules/uuid/LICENSE.md +9 -0
  1031. package/node_modules/uuid/README.md +491 -0
  1032. package/node_modules/uuid/dist/index.d.ts +15 -0
  1033. package/node_modules/uuid/dist/index.js +14 -0
  1034. package/node_modules/uuid/dist/max.d.ts +2 -0
  1035. package/node_modules/uuid/dist/max.js +1 -0
  1036. package/node_modules/uuid/dist/md5.d.ts +2 -0
  1037. package/node_modules/uuid/dist/md5.js +135 -0
  1038. package/node_modules/uuid/dist/nil.d.ts +2 -0
  1039. package/node_modules/uuid/dist/nil.js +1 -0
  1040. package/node_modules/uuid/dist/parse.d.ts +3 -0
  1041. package/node_modules/uuid/dist/parse.js +9 -0
  1042. package/node_modules/uuid/dist/regex.d.ts +2 -0
  1043. package/node_modules/uuid/dist/regex.js +1 -0
  1044. package/node_modules/uuid/dist/rng.d.ts +1 -0
  1045. package/node_modules/uuid/dist/rng.js +4 -0
  1046. package/node_modules/uuid/dist/sha1.d.ts +2 -0
  1047. package/node_modules/uuid/dist/sha1.js +70 -0
  1048. package/node_modules/uuid/dist/stringify.d.ts +3 -0
  1049. package/node_modules/uuid/dist/stringify.js +35 -0
  1050. package/node_modules/uuid/dist/types.d.ts +22 -0
  1051. package/node_modules/uuid/dist/types.js +1 -0
  1052. package/node_modules/uuid/dist/uuid-bin.d.ts +1 -0
  1053. package/node_modules/uuid/dist/uuid-bin.js +70 -0
  1054. package/node_modules/uuid/dist/v1.d.ts +11 -0
  1055. package/node_modules/uuid/dist/v1.js +83 -0
  1056. package/node_modules/uuid/dist/v1ToV6.d.ts +3 -0
  1057. package/node_modules/uuid/dist/v1ToV6.js +10 -0
  1058. package/node_modules/uuid/dist/v3.d.ts +9 -0
  1059. package/node_modules/uuid/dist/v3.js +9 -0
  1060. package/node_modules/uuid/dist/v35.d.ts +7 -0
  1061. package/node_modules/uuid/dist/v35.js +39 -0
  1062. package/node_modules/uuid/dist/v4.d.ts +4 -0
  1063. package/node_modules/uuid/dist/v4.js +29 -0
  1064. package/node_modules/uuid/dist/v5.d.ts +9 -0
  1065. package/node_modules/uuid/dist/v5.js +9 -0
  1066. package/node_modules/uuid/dist/v6.d.ts +4 -0
  1067. package/node_modules/uuid/dist/v6.js +20 -0
  1068. package/node_modules/uuid/dist/v6ToV1.d.ts +2 -0
  1069. package/node_modules/uuid/dist/v6ToV1.js +10 -0
  1070. package/node_modules/uuid/dist/v7.d.ts +9 -0
  1071. package/node_modules/uuid/dist/v7.js +65 -0
  1072. package/node_modules/uuid/dist/validate.d.ts +2 -0
  1073. package/node_modules/uuid/dist/validate.js +5 -0
  1074. package/node_modules/uuid/dist/version.d.ts +2 -0
  1075. package/node_modules/uuid/dist/version.js +8 -0
  1076. package/node_modules/uuid/dist-node/bin/uuid +2 -0
  1077. package/node_modules/uuid/dist-node/index.js +14 -0
  1078. package/node_modules/uuid/dist-node/max.js +1 -0
  1079. package/node_modules/uuid/dist-node/md5.js +11 -0
  1080. package/node_modules/uuid/dist-node/nil.js +1 -0
  1081. package/node_modules/uuid/dist-node/parse.js +9 -0
  1082. package/node_modules/uuid/dist-node/regex.js +1 -0
  1083. package/node_modules/uuid/dist-node/rng.js +4 -0
  1084. package/node_modules/uuid/dist-node/sha1.js +11 -0
  1085. package/node_modules/uuid/dist-node/stringify.js +35 -0
  1086. package/node_modules/uuid/dist-node/types.js +1 -0
  1087. package/node_modules/uuid/dist-node/uuid-bin.js +70 -0
  1088. package/node_modules/uuid/dist-node/v1.js +83 -0
  1089. package/node_modules/uuid/dist-node/v1ToV6.js +10 -0
  1090. package/node_modules/uuid/dist-node/v3.js +9 -0
  1091. package/node_modules/uuid/dist-node/v35.js +39 -0
  1092. package/node_modules/uuid/dist-node/v4.js +29 -0
  1093. package/node_modules/uuid/dist-node/v5.js +9 -0
  1094. package/node_modules/uuid/dist-node/v6.js +20 -0
  1095. package/node_modules/uuid/dist-node/v6ToV1.js +10 -0
  1096. package/node_modules/uuid/dist-node/v7.js +65 -0
  1097. package/node_modules/uuid/dist-node/validate.js +5 -0
  1098. package/node_modules/uuid/dist-node/version.js +8 -0
  1099. package/node_modules/uuid/package.json +110 -0
  1100. package/node_modules/zod/LICENSE +21 -0
  1101. package/node_modules/zod/README.md +208 -0
  1102. package/node_modules/zod/index.cjs +33 -0
  1103. package/node_modules/zod/index.d.cts +4 -0
  1104. package/node_modules/zod/index.d.ts +4 -0
  1105. package/node_modules/zod/index.js +4 -0
  1106. package/node_modules/zod/package.json +118 -0
  1107. package/node_modules/zod/src/index.ts +4 -0
  1108. package/node_modules/zod/src/v3/ZodError.ts +330 -0
  1109. package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
  1110. package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
  1111. package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
  1112. package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
  1113. package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
  1114. package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
  1115. package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
  1116. package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
  1117. package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
  1118. package/node_modules/zod/src/v3/errors.ts +13 -0
  1119. package/node_modules/zod/src/v3/external.ts +6 -0
  1120. package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
  1121. package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
  1122. package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
  1123. package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
  1124. package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
  1125. package/node_modules/zod/src/v3/helpers/util.ts +224 -0
  1126. package/node_modules/zod/src/v3/index.ts +4 -0
  1127. package/node_modules/zod/src/v3/locales/en.ts +124 -0
  1128. package/node_modules/zod/src/v3/standard-schema.ts +113 -0
  1129. package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
  1130. package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
  1131. package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
  1132. package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
  1133. package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
  1134. package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
  1135. package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
  1136. package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
  1137. package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
  1138. package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
  1139. package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
  1140. package/node_modules/zod/src/v3/tests/complex.test.ts +56 -0
  1141. package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
  1142. package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
  1143. package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
  1144. package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
  1145. package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
  1146. package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
  1147. package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
  1148. package/node_modules/zod/src/v3/tests/error.test.ts +551 -0
  1149. package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
  1150. package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
  1151. package/node_modules/zod/src/v3/tests/function.test.ts +257 -0
  1152. package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
  1153. package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
  1154. package/node_modules/zod/src/v3/tests/intersection.test.ts +110 -0
  1155. package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
  1156. package/node_modules/zod/src/v3/tests/language-server.test.ts +207 -0
  1157. package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
  1158. package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
  1159. package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
  1160. package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
  1161. package/node_modules/zod/src/v3/tests/nan.test.ts +21 -0
  1162. package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
  1163. package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
  1164. package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
  1165. package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
  1166. package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
  1167. package/node_modules/zod/src/v3/tests/object.test.ts +434 -0
  1168. package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
  1169. package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
  1170. package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
  1171. package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
  1172. package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
  1173. package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
  1174. package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
  1175. package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
  1176. package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
  1177. package/node_modules/zod/src/v3/tests/readonly.test.ts +194 -0
  1178. package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
  1179. package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
  1180. package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
  1181. package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
  1182. package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
  1183. package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
  1184. package/node_modules/zod/src/v3/tests/string.test.ts +916 -0
  1185. package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
  1186. package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
  1187. package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
  1188. package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
  1189. package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
  1190. package/node_modules/zod/src/v3/types.ts +5136 -0
  1191. package/node_modules/zod/src/v4/classic/checks.ts +30 -0
  1192. package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
  1193. package/node_modules/zod/src/v4/classic/compat.ts +66 -0
  1194. package/node_modules/zod/src/v4/classic/errors.ts +75 -0
  1195. package/node_modules/zod/src/v4/classic/external.ts +50 -0
  1196. package/node_modules/zod/src/v4/classic/index.ts +5 -0
  1197. package/node_modules/zod/src/v4/classic/iso.ts +90 -0
  1198. package/node_modules/zod/src/v4/classic/parse.ts +33 -0
  1199. package/node_modules/zod/src/v4/classic/schemas.ts +2054 -0
  1200. package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
  1201. package/node_modules/zod/src/v4/classic/tests/array.test.ts +264 -0
  1202. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +210 -0
  1203. package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
  1204. package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
  1205. package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
  1206. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +54 -0
  1207. package/node_modules/zod/src/v4/classic/tests/brand.test.ts +63 -0
  1208. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +252 -0
  1209. package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
  1210. package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
  1211. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +352 -0
  1212. package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
  1213. package/node_modules/zod/src/v4/classic/tests/date.test.ts +31 -0
  1214. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +296 -0
  1215. package/node_modules/zod/src/v4/classic/tests/default.test.ts +313 -0
  1216. package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
  1217. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +619 -0
  1218. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +285 -0
  1219. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +527 -0
  1220. package/node_modules/zod/src/v4/classic/tests/error.test.ts +711 -0
  1221. package/node_modules/zod/src/v4/classic/tests/file.test.ts +91 -0
  1222. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +175 -0
  1223. package/node_modules/zod/src/v4/classic/tests/function.test.ts +268 -0
  1224. package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
  1225. package/node_modules/zod/src/v4/classic/tests/index.test.ts +829 -0
  1226. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +34 -0
  1227. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +171 -0
  1228. package/node_modules/zod/src/v4/classic/tests/json.test.ts +108 -0
  1229. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +227 -0
  1230. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +92 -0
  1231. package/node_modules/zod/src/v4/classic/tests/map.test.ts +196 -0
  1232. package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
  1233. package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
  1234. package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +86 -0
  1235. package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
  1236. package/node_modules/zod/src/v4/classic/tests/number.test.ts +247 -0
  1237. package/node_modules/zod/src/v4/classic/tests/object.test.ts +563 -0
  1238. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +123 -0
  1239. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +147 -0
  1240. package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +127 -0
  1241. package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +81 -0
  1242. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +37 -0
  1243. package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +298 -0
  1244. package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
  1245. package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
  1246. package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
  1247. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +252 -0
  1248. package/node_modules/zod/src/v4/classic/tests/record.test.ts +342 -0
  1249. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +356 -0
  1250. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +532 -0
  1251. package/node_modules/zod/src/v4/classic/tests/registries.test.ts +204 -0
  1252. package/node_modules/zod/src/v4/classic/tests/set.test.ts +179 -0
  1253. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +57 -0
  1254. package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +109 -0
  1255. package/node_modules/zod/src/v4/classic/tests/string.test.ts +881 -0
  1256. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +66 -0
  1257. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +758 -0
  1258. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +2314 -0
  1259. package/node_modules/zod/src/v4/classic/tests/transform.test.ts +250 -0
  1260. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +163 -0
  1261. package/node_modules/zod/src/v4/classic/tests/union.test.ts +94 -0
  1262. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
  1263. package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
  1264. package/node_modules/zod/src/v4/core/api.ts +1594 -0
  1265. package/node_modules/zod/src/v4/core/checks.ts +1283 -0
  1266. package/node_modules/zod/src/v4/core/config.ts +15 -0
  1267. package/node_modules/zod/src/v4/core/core.ts +134 -0
  1268. package/node_modules/zod/src/v4/core/doc.ts +44 -0
  1269. package/node_modules/zod/src/v4/core/errors.ts +424 -0
  1270. package/node_modules/zod/src/v4/core/function.ts +176 -0
  1271. package/node_modules/zod/src/v4/core/index.ts +15 -0
  1272. package/node_modules/zod/src/v4/core/json-schema.ts +143 -0
  1273. package/node_modules/zod/src/v4/core/parse.ts +94 -0
  1274. package/node_modules/zod/src/v4/core/regexes.ts +135 -0
  1275. package/node_modules/zod/src/v4/core/registries.ts +96 -0
  1276. package/node_modules/zod/src/v4/core/schemas.ts +3842 -0
  1277. package/node_modules/zod/src/v4/core/standard-schema.ts +64 -0
  1278. package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
  1279. package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
  1280. package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
  1281. package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
  1282. package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
  1283. package/node_modules/zod/src/v4/core/to-json-schema.ts +977 -0
  1284. package/node_modules/zod/src/v4/core/util.ts +775 -0
  1285. package/node_modules/zod/src/v4/core/versions.ts +5 -0
  1286. package/node_modules/zod/src/v4/core/zsf.ts +323 -0
  1287. package/node_modules/zod/src/v4/index.ts +4 -0
  1288. package/node_modules/zod/src/v4/locales/ar.ts +125 -0
  1289. package/node_modules/zod/src/v4/locales/az.ts +121 -0
  1290. package/node_modules/zod/src/v4/locales/be.ts +184 -0
  1291. package/node_modules/zod/src/v4/locales/ca.ts +127 -0
  1292. package/node_modules/zod/src/v4/locales/cs.ts +142 -0
  1293. package/node_modules/zod/src/v4/locales/de.ts +124 -0
  1294. package/node_modules/zod/src/v4/locales/en.ts +127 -0
  1295. package/node_modules/zod/src/v4/locales/eo.ts +125 -0
  1296. package/node_modules/zod/src/v4/locales/es.ts +125 -0
  1297. package/node_modules/zod/src/v4/locales/fa.ts +134 -0
  1298. package/node_modules/zod/src/v4/locales/fi.ts +131 -0
  1299. package/node_modules/zod/src/v4/locales/fr-CA.ts +126 -0
  1300. package/node_modules/zod/src/v4/locales/fr.ts +124 -0
  1301. package/node_modules/zod/src/v4/locales/he.ts +125 -0
  1302. package/node_modules/zod/src/v4/locales/hu.ts +126 -0
  1303. package/node_modules/zod/src/v4/locales/id.ts +125 -0
  1304. package/node_modules/zod/src/v4/locales/index.ts +39 -0
  1305. package/node_modules/zod/src/v4/locales/it.ts +125 -0
  1306. package/node_modules/zod/src/v4/locales/ja.ts +122 -0
  1307. package/node_modules/zod/src/v4/locales/kh.ts +126 -0
  1308. package/node_modules/zod/src/v4/locales/ko.ts +131 -0
  1309. package/node_modules/zod/src/v4/locales/mk.ts +127 -0
  1310. package/node_modules/zod/src/v4/locales/ms.ts +124 -0
  1311. package/node_modules/zod/src/v4/locales/nl.ts +126 -0
  1312. package/node_modules/zod/src/v4/locales/no.ts +124 -0
  1313. package/node_modules/zod/src/v4/locales/ota.ts +125 -0
  1314. package/node_modules/zod/src/v4/locales/pl.ts +126 -0
  1315. package/node_modules/zod/src/v4/locales/ps.ts +133 -0
  1316. package/node_modules/zod/src/v4/locales/pt.ts +123 -0
  1317. package/node_modules/zod/src/v4/locales/ru.ts +184 -0
  1318. package/node_modules/zod/src/v4/locales/sl.ts +126 -0
  1319. package/node_modules/zod/src/v4/locales/sv.ts +127 -0
  1320. package/node_modules/zod/src/v4/locales/ta.ts +125 -0
  1321. package/node_modules/zod/src/v4/locales/th.ts +126 -0
  1322. package/node_modules/zod/src/v4/locales/tr.ts +121 -0
  1323. package/node_modules/zod/src/v4/locales/ua.ts +126 -0
  1324. package/node_modules/zod/src/v4/locales/ur.ts +126 -0
  1325. package/node_modules/zod/src/v4/locales/vi.ts +125 -0
  1326. package/node_modules/zod/src/v4/locales/zh-CN.ts +123 -0
  1327. package/node_modules/zod/src/v4/locales/zh-TW.ts +125 -0
  1328. package/node_modules/zod/src/v4/mini/checks.ts +32 -0
  1329. package/node_modules/zod/src/v4/mini/coerce.ts +22 -0
  1330. package/node_modules/zod/src/v4/mini/external.ts +40 -0
  1331. package/node_modules/zod/src/v4/mini/index.ts +3 -0
  1332. package/node_modules/zod/src/v4/mini/iso.ts +62 -0
  1333. package/node_modules/zod/src/v4/mini/parse.ts +1 -0
  1334. package/node_modules/zod/src/v4/mini/schemas.ts +1579 -0
  1335. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +129 -0
  1336. package/node_modules/zod/src/v4/mini/tests/brand.test.ts +51 -0
  1337. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +144 -0
  1338. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +36 -0
  1339. package/node_modules/zod/src/v4/mini/tests/error.test.ts +22 -0
  1340. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +43 -0
  1341. package/node_modules/zod/src/v4/mini/tests/index.test.ts +871 -0
  1342. package/node_modules/zod/src/v4/mini/tests/number.test.ts +95 -0
  1343. package/node_modules/zod/src/v4/mini/tests/object.test.ts +185 -0
  1344. package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
  1345. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +275 -0
  1346. package/node_modules/zod/src/v4/mini/tests/string.test.ts +299 -0
  1347. package/node_modules/zod/src/v4-mini/index.ts +1 -0
  1348. package/node_modules/zod/v3/ZodError.cjs +138 -0
  1349. package/node_modules/zod/v3/ZodError.d.cts +164 -0
  1350. package/node_modules/zod/v3/ZodError.d.ts +164 -0
  1351. package/node_modules/zod/v3/ZodError.js +133 -0
  1352. package/node_modules/zod/v3/errors.cjs +17 -0
  1353. package/node_modules/zod/v3/errors.d.cts +5 -0
  1354. package/node_modules/zod/v3/errors.d.ts +5 -0
  1355. package/node_modules/zod/v3/errors.js +9 -0
  1356. package/node_modules/zod/v3/external.cjs +22 -0
  1357. package/node_modules/zod/v3/external.d.cts +6 -0
  1358. package/node_modules/zod/v3/external.d.ts +6 -0
  1359. package/node_modules/zod/v3/external.js +6 -0
  1360. package/node_modules/zod/v3/helpers/enumUtil.cjs +2 -0
  1361. package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
  1362. package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
  1363. package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
  1364. package/node_modules/zod/v3/helpers/errorUtil.cjs +9 -0
  1365. package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
  1366. package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
  1367. package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
  1368. package/node_modules/zod/v3/helpers/parseUtil.cjs +124 -0
  1369. package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
  1370. package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
  1371. package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
  1372. package/node_modules/zod/v3/helpers/partialUtil.cjs +2 -0
  1373. package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
  1374. package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
  1375. package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
  1376. package/node_modules/zod/v3/helpers/typeAliases.cjs +2 -0
  1377. package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
  1378. package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
  1379. package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
  1380. package/node_modules/zod/v3/helpers/util.cjs +137 -0
  1381. package/node_modules/zod/v3/helpers/util.d.cts +85 -0
  1382. package/node_modules/zod/v3/helpers/util.d.ts +85 -0
  1383. package/node_modules/zod/v3/helpers/util.js +133 -0
  1384. package/node_modules/zod/v3/index.cjs +33 -0
  1385. package/node_modules/zod/v3/index.d.cts +4 -0
  1386. package/node_modules/zod/v3/index.d.ts +4 -0
  1387. package/node_modules/zod/v3/index.js +4 -0
  1388. package/node_modules/zod/v3/locales/en.cjs +111 -0
  1389. package/node_modules/zod/v3/locales/en.d.cts +3 -0
  1390. package/node_modules/zod/v3/locales/en.d.ts +3 -0
  1391. package/node_modules/zod/v3/locales/en.js +109 -0
  1392. package/node_modules/zod/v3/standard-schema.cjs +2 -0
  1393. package/node_modules/zod/v3/standard-schema.d.cts +102 -0
  1394. package/node_modules/zod/v3/standard-schema.d.ts +102 -0
  1395. package/node_modules/zod/v3/standard-schema.js +1 -0
  1396. package/node_modules/zod/v3/types.cjs +3775 -0
  1397. package/node_modules/zod/v3/types.d.cts +1031 -0
  1398. package/node_modules/zod/v3/types.d.ts +1031 -0
  1399. package/node_modules/zod/v3/types.js +3693 -0
  1400. package/node_modules/zod/v4/classic/checks.cjs +32 -0
  1401. package/node_modules/zod/v4/classic/checks.d.cts +1 -0
  1402. package/node_modules/zod/v4/classic/checks.d.ts +1 -0
  1403. package/node_modules/zod/v4/classic/checks.js +1 -0
  1404. package/node_modules/zod/v4/classic/coerce.cjs +47 -0
  1405. package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
  1406. package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
  1407. package/node_modules/zod/v4/classic/coerce.js +17 -0
  1408. package/node_modules/zod/v4/classic/compat.cjs +57 -0
  1409. package/node_modules/zod/v4/classic/compat.d.cts +46 -0
  1410. package/node_modules/zod/v4/classic/compat.d.ts +46 -0
  1411. package/node_modules/zod/v4/classic/compat.js +27 -0
  1412. package/node_modules/zod/v4/classic/errors.cjs +67 -0
  1413. package/node_modules/zod/v4/classic/errors.d.cts +30 -0
  1414. package/node_modules/zod/v4/classic/errors.d.ts +30 -0
  1415. package/node_modules/zod/v4/classic/errors.js +41 -0
  1416. package/node_modules/zod/v4/classic/external.cjs +70 -0
  1417. package/node_modules/zod/v4/classic/external.d.cts +13 -0
  1418. package/node_modules/zod/v4/classic/external.d.ts +13 -0
  1419. package/node_modules/zod/v4/classic/external.js +18 -0
  1420. package/node_modules/zod/v4/classic/index.cjs +33 -0
  1421. package/node_modules/zod/v4/classic/index.d.cts +4 -0
  1422. package/node_modules/zod/v4/classic/index.d.ts +4 -0
  1423. package/node_modules/zod/v4/classic/index.js +4 -0
  1424. package/node_modules/zod/v4/classic/iso.cjs +60 -0
  1425. package/node_modules/zod/v4/classic/iso.d.cts +22 -0
  1426. package/node_modules/zod/v4/classic/iso.d.ts +22 -0
  1427. package/node_modules/zod/v4/classic/iso.js +30 -0
  1428. package/node_modules/zod/v4/classic/parse.cjs +32 -0
  1429. package/node_modules/zod/v4/classic/parse.d.cts +23 -0
  1430. package/node_modules/zod/v4/classic/parse.d.ts +23 -0
  1431. package/node_modules/zod/v4/classic/parse.js +6 -0
  1432. package/node_modules/zod/v4/classic/schemas.cjs +1109 -0
  1433. package/node_modules/zod/v4/classic/schemas.d.cts +630 -0
  1434. package/node_modules/zod/v4/classic/schemas.d.ts +630 -0
  1435. package/node_modules/zod/v4/classic/schemas.js +1006 -0
  1436. package/node_modules/zod/v4/core/api.cjs +1039 -0
  1437. package/node_modules/zod/v4/core/api.d.cts +284 -0
  1438. package/node_modules/zod/v4/core/api.d.ts +284 -0
  1439. package/node_modules/zod/v4/core/api.js +906 -0
  1440. package/node_modules/zod/v4/core/checks.cjs +591 -0
  1441. package/node_modules/zod/v4/core/checks.d.cts +278 -0
  1442. package/node_modules/zod/v4/core/checks.d.ts +278 -0
  1443. package/node_modules/zod/v4/core/checks.js +565 -0
  1444. package/node_modules/zod/v4/core/core.cjs +67 -0
  1445. package/node_modules/zod/v4/core/core.d.cts +49 -0
  1446. package/node_modules/zod/v4/core/core.d.ts +49 -0
  1447. package/node_modules/zod/v4/core/core.js +61 -0
  1448. package/node_modules/zod/v4/core/doc.cjs +39 -0
  1449. package/node_modules/zod/v4/core/doc.d.cts +14 -0
  1450. package/node_modules/zod/v4/core/doc.d.ts +14 -0
  1451. package/node_modules/zod/v4/core/doc.js +35 -0
  1452. package/node_modules/zod/v4/core/errors.cjs +226 -0
  1453. package/node_modules/zod/v4/core/errors.d.cts +208 -0
  1454. package/node_modules/zod/v4/core/errors.d.ts +208 -0
  1455. package/node_modules/zod/v4/core/errors.js +195 -0
  1456. package/node_modules/zod/v4/core/function.cjs +102 -0
  1457. package/node_modules/zod/v4/core/function.d.cts +52 -0
  1458. package/node_modules/zod/v4/core/function.d.ts +52 -0
  1459. package/node_modules/zod/v4/core/function.js +75 -0
  1460. package/node_modules/zod/v4/core/index.cjs +44 -0
  1461. package/node_modules/zod/v4/core/index.d.cts +15 -0
  1462. package/node_modules/zod/v4/core/index.d.ts +15 -0
  1463. package/node_modules/zod/v4/core/index.js +15 -0
  1464. package/node_modules/zod/v4/core/json-schema.cjs +2 -0
  1465. package/node_modules/zod/v4/core/json-schema.d.cts +87 -0
  1466. package/node_modules/zod/v4/core/json-schema.d.ts +87 -0
  1467. package/node_modules/zod/v4/core/json-schema.js +1 -0
  1468. package/node_modules/zod/v4/core/parse.cjs +87 -0
  1469. package/node_modules/zod/v4/core/parse.d.cts +25 -0
  1470. package/node_modules/zod/v4/core/parse.d.ts +25 -0
  1471. package/node_modules/zod/v4/core/parse.js +57 -0
  1472. package/node_modules/zod/v4/core/regexes.cjs +103 -0
  1473. package/node_modules/zod/v4/core/regexes.d.cts +62 -0
  1474. package/node_modules/zod/v4/core/regexes.d.ts +62 -0
  1475. package/node_modules/zod/v4/core/regexes.js +95 -0
  1476. package/node_modules/zod/v4/core/registries.cjs +56 -0
  1477. package/node_modules/zod/v4/core/registries.d.cts +35 -0
  1478. package/node_modules/zod/v4/core/registries.d.ts +35 -0
  1479. package/node_modules/zod/v4/core/registries.js +51 -0
  1480. package/node_modules/zod/v4/core/schemas.cjs +1748 -0
  1481. package/node_modules/zod/v4/core/schemas.d.cts +1041 -0
  1482. package/node_modules/zod/v4/core/schemas.d.ts +1041 -0
  1483. package/node_modules/zod/v4/core/schemas.js +1717 -0
  1484. package/node_modules/zod/v4/core/standard-schema.cjs +2 -0
  1485. package/node_modules/zod/v4/core/standard-schema.d.cts +55 -0
  1486. package/node_modules/zod/v4/core/standard-schema.d.ts +55 -0
  1487. package/node_modules/zod/v4/core/standard-schema.js +1 -0
  1488. package/node_modules/zod/v4/core/to-json-schema.cjs +854 -0
  1489. package/node_modules/zod/v4/core/to-json-schema.d.cts +88 -0
  1490. package/node_modules/zod/v4/core/to-json-schema.d.ts +88 -0
  1491. package/node_modules/zod/v4/core/to-json-schema.js +849 -0
  1492. package/node_modules/zod/v4/core/util.cjs +539 -0
  1493. package/node_modules/zod/v4/core/util.d.cts +183 -0
  1494. package/node_modules/zod/v4/core/util.d.ts +183 -0
  1495. package/node_modules/zod/v4/core/util.js +493 -0
  1496. package/node_modules/zod/v4/core/versions.cjs +8 -0
  1497. package/node_modules/zod/v4/core/versions.d.cts +5 -0
  1498. package/node_modules/zod/v4/core/versions.d.ts +5 -0
  1499. package/node_modules/zod/v4/core/versions.js +5 -0
  1500. package/node_modules/zod/v4/index.cjs +22 -0
  1501. package/node_modules/zod/v4/index.d.cts +3 -0
  1502. package/node_modules/zod/v4/index.d.ts +3 -0
  1503. package/node_modules/zod/v4/index.js +3 -0
  1504. package/node_modules/zod/v4/locales/ar.cjs +142 -0
  1505. package/node_modules/zod/v4/locales/ar.d.cts +4 -0
  1506. package/node_modules/zod/v4/locales/ar.d.ts +4 -0
  1507. package/node_modules/zod/v4/locales/ar.js +116 -0
  1508. package/node_modules/zod/v4/locales/az.cjs +141 -0
  1509. package/node_modules/zod/v4/locales/az.d.cts +4 -0
  1510. package/node_modules/zod/v4/locales/az.d.ts +4 -0
  1511. package/node_modules/zod/v4/locales/az.js +115 -0
  1512. package/node_modules/zod/v4/locales/be.cjs +190 -0
  1513. package/node_modules/zod/v4/locales/be.d.cts +4 -0
  1514. package/node_modules/zod/v4/locales/be.d.ts +4 -0
  1515. package/node_modules/zod/v4/locales/be.js +164 -0
  1516. package/node_modules/zod/v4/locales/ca.cjs +144 -0
  1517. package/node_modules/zod/v4/locales/ca.d.cts +4 -0
  1518. package/node_modules/zod/v4/locales/ca.d.ts +4 -0
  1519. package/node_modules/zod/v4/locales/ca.js +118 -0
  1520. package/node_modules/zod/v4/locales/cs.cjs +161 -0
  1521. package/node_modules/zod/v4/locales/cs.d.cts +4 -0
  1522. package/node_modules/zod/v4/locales/cs.d.ts +4 -0
  1523. package/node_modules/zod/v4/locales/cs.js +135 -0
  1524. package/node_modules/zod/v4/locales/de.cjs +142 -0
  1525. package/node_modules/zod/v4/locales/de.d.cts +4 -0
  1526. package/node_modules/zod/v4/locales/de.d.ts +4 -0
  1527. package/node_modules/zod/v4/locales/de.js +116 -0
  1528. package/node_modules/zod/v4/locales/en.cjs +145 -0
  1529. package/node_modules/zod/v4/locales/en.d.cts +5 -0
  1530. package/node_modules/zod/v4/locales/en.d.ts +5 -0
  1531. package/node_modules/zod/v4/locales/en.js +117 -0
  1532. package/node_modules/zod/v4/locales/eo.cjs +144 -0
  1533. package/node_modules/zod/v4/locales/eo.d.cts +5 -0
  1534. package/node_modules/zod/v4/locales/eo.d.ts +5 -0
  1535. package/node_modules/zod/v4/locales/eo.js +116 -0
  1536. package/node_modules/zod/v4/locales/es.cjs +143 -0
  1537. package/node_modules/zod/v4/locales/es.d.cts +4 -0
  1538. package/node_modules/zod/v4/locales/es.d.ts +4 -0
  1539. package/node_modules/zod/v4/locales/es.js +117 -0
  1540. package/node_modules/zod/v4/locales/fa.cjs +148 -0
  1541. package/node_modules/zod/v4/locales/fa.d.cts +4 -0
  1542. package/node_modules/zod/v4/locales/fa.d.ts +4 -0
  1543. package/node_modules/zod/v4/locales/fa.js +122 -0
  1544. package/node_modules/zod/v4/locales/fi.cjs +148 -0
  1545. package/node_modules/zod/v4/locales/fi.d.cts +4 -0
  1546. package/node_modules/zod/v4/locales/fi.d.ts +4 -0
  1547. package/node_modules/zod/v4/locales/fi.js +122 -0
  1548. package/node_modules/zod/v4/locales/fr-CA.cjs +143 -0
  1549. package/node_modules/zod/v4/locales/fr-CA.d.cts +4 -0
  1550. package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
  1551. package/node_modules/zod/v4/locales/fr-CA.js +117 -0
  1552. package/node_modules/zod/v4/locales/fr.cjs +142 -0
  1553. package/node_modules/zod/v4/locales/fr.d.cts +4 -0
  1554. package/node_modules/zod/v4/locales/fr.d.ts +4 -0
  1555. package/node_modules/zod/v4/locales/fr.js +116 -0
  1556. package/node_modules/zod/v4/locales/he.cjs +143 -0
  1557. package/node_modules/zod/v4/locales/he.d.cts +4 -0
  1558. package/node_modules/zod/v4/locales/he.d.ts +4 -0
  1559. package/node_modules/zod/v4/locales/he.js +117 -0
  1560. package/node_modules/zod/v4/locales/hu.cjs +143 -0
  1561. package/node_modules/zod/v4/locales/hu.d.cts +4 -0
  1562. package/node_modules/zod/v4/locales/hu.d.ts +4 -0
  1563. package/node_modules/zod/v4/locales/hu.js +117 -0
  1564. package/node_modules/zod/v4/locales/id.cjs +142 -0
  1565. package/node_modules/zod/v4/locales/id.d.cts +4 -0
  1566. package/node_modules/zod/v4/locales/id.d.ts +4 -0
  1567. package/node_modules/zod/v4/locales/id.js +116 -0
  1568. package/node_modules/zod/v4/locales/index.cjs +84 -0
  1569. package/node_modules/zod/v4/locales/index.d.cts +39 -0
  1570. package/node_modules/zod/v4/locales/index.d.ts +39 -0
  1571. package/node_modules/zod/v4/locales/index.js +39 -0
  1572. package/node_modules/zod/v4/locales/it.cjs +143 -0
  1573. package/node_modules/zod/v4/locales/it.d.cts +4 -0
  1574. package/node_modules/zod/v4/locales/it.d.ts +4 -0
  1575. package/node_modules/zod/v4/locales/it.js +117 -0
  1576. package/node_modules/zod/v4/locales/ja.cjs +141 -0
  1577. package/node_modules/zod/v4/locales/ja.d.cts +4 -0
  1578. package/node_modules/zod/v4/locales/ja.d.ts +4 -0
  1579. package/node_modules/zod/v4/locales/ja.js +115 -0
  1580. package/node_modules/zod/v4/locales/kh.cjs +143 -0
  1581. package/node_modules/zod/v4/locales/kh.d.cts +4 -0
  1582. package/node_modules/zod/v4/locales/kh.d.ts +4 -0
  1583. package/node_modules/zod/v4/locales/kh.js +117 -0
  1584. package/node_modules/zod/v4/locales/ko.cjs +147 -0
  1585. package/node_modules/zod/v4/locales/ko.d.cts +4 -0
  1586. package/node_modules/zod/v4/locales/ko.d.ts +4 -0
  1587. package/node_modules/zod/v4/locales/ko.js +121 -0
  1588. package/node_modules/zod/v4/locales/mk.cjs +144 -0
  1589. package/node_modules/zod/v4/locales/mk.d.cts +4 -0
  1590. package/node_modules/zod/v4/locales/mk.d.ts +4 -0
  1591. package/node_modules/zod/v4/locales/mk.js +118 -0
  1592. package/node_modules/zod/v4/locales/ms.cjs +142 -0
  1593. package/node_modules/zod/v4/locales/ms.d.cts +4 -0
  1594. package/node_modules/zod/v4/locales/ms.d.ts +4 -0
  1595. package/node_modules/zod/v4/locales/ms.js +116 -0
  1596. package/node_modules/zod/v4/locales/nl.cjs +143 -0
  1597. package/node_modules/zod/v4/locales/nl.d.cts +4 -0
  1598. package/node_modules/zod/v4/locales/nl.d.ts +4 -0
  1599. package/node_modules/zod/v4/locales/nl.js +117 -0
  1600. package/node_modules/zod/v4/locales/no.cjs +142 -0
  1601. package/node_modules/zod/v4/locales/no.d.cts +4 -0
  1602. package/node_modules/zod/v4/locales/no.d.ts +4 -0
  1603. package/node_modules/zod/v4/locales/no.js +116 -0
  1604. package/node_modules/zod/v4/locales/ota.cjs +143 -0
  1605. package/node_modules/zod/v4/locales/ota.d.cts +4 -0
  1606. package/node_modules/zod/v4/locales/ota.d.ts +4 -0
  1607. package/node_modules/zod/v4/locales/ota.js +117 -0
  1608. package/node_modules/zod/v4/locales/pl.cjs +143 -0
  1609. package/node_modules/zod/v4/locales/pl.d.cts +4 -0
  1610. package/node_modules/zod/v4/locales/pl.d.ts +4 -0
  1611. package/node_modules/zod/v4/locales/pl.js +117 -0
  1612. package/node_modules/zod/v4/locales/ps.cjs +148 -0
  1613. package/node_modules/zod/v4/locales/ps.d.cts +4 -0
  1614. package/node_modules/zod/v4/locales/ps.d.ts +4 -0
  1615. package/node_modules/zod/v4/locales/ps.js +122 -0
  1616. package/node_modules/zod/v4/locales/pt.cjs +142 -0
  1617. package/node_modules/zod/v4/locales/pt.d.cts +4 -0
  1618. package/node_modules/zod/v4/locales/pt.d.ts +4 -0
  1619. package/node_modules/zod/v4/locales/pt.js +116 -0
  1620. package/node_modules/zod/v4/locales/ru.cjs +190 -0
  1621. package/node_modules/zod/v4/locales/ru.d.cts +4 -0
  1622. package/node_modules/zod/v4/locales/ru.d.ts +4 -0
  1623. package/node_modules/zod/v4/locales/ru.js +164 -0
  1624. package/node_modules/zod/v4/locales/sl.cjs +143 -0
  1625. package/node_modules/zod/v4/locales/sl.d.cts +4 -0
  1626. package/node_modules/zod/v4/locales/sl.d.ts +4 -0
  1627. package/node_modules/zod/v4/locales/sl.js +117 -0
  1628. package/node_modules/zod/v4/locales/sv.cjs +144 -0
  1629. package/node_modules/zod/v4/locales/sv.d.cts +4 -0
  1630. package/node_modules/zod/v4/locales/sv.d.ts +4 -0
  1631. package/node_modules/zod/v4/locales/sv.js +118 -0
  1632. package/node_modules/zod/v4/locales/ta.cjs +143 -0
  1633. package/node_modules/zod/v4/locales/ta.d.cts +4 -0
  1634. package/node_modules/zod/v4/locales/ta.d.ts +4 -0
  1635. package/node_modules/zod/v4/locales/ta.js +117 -0
  1636. package/node_modules/zod/v4/locales/th.cjs +143 -0
  1637. package/node_modules/zod/v4/locales/th.d.cts +4 -0
  1638. package/node_modules/zod/v4/locales/th.d.ts +4 -0
  1639. package/node_modules/zod/v4/locales/th.js +117 -0
  1640. package/node_modules/zod/v4/locales/tr.cjs +143 -0
  1641. package/node_modules/zod/v4/locales/tr.d.cts +5 -0
  1642. package/node_modules/zod/v4/locales/tr.d.ts +5 -0
  1643. package/node_modules/zod/v4/locales/tr.js +115 -0
  1644. package/node_modules/zod/v4/locales/ua.cjs +143 -0
  1645. package/node_modules/zod/v4/locales/ua.d.cts +4 -0
  1646. package/node_modules/zod/v4/locales/ua.d.ts +4 -0
  1647. package/node_modules/zod/v4/locales/ua.js +117 -0
  1648. package/node_modules/zod/v4/locales/ur.cjs +143 -0
  1649. package/node_modules/zod/v4/locales/ur.d.cts +4 -0
  1650. package/node_modules/zod/v4/locales/ur.d.ts +4 -0
  1651. package/node_modules/zod/v4/locales/ur.js +117 -0
  1652. package/node_modules/zod/v4/locales/vi.cjs +142 -0
  1653. package/node_modules/zod/v4/locales/vi.d.cts +4 -0
  1654. package/node_modules/zod/v4/locales/vi.d.ts +4 -0
  1655. package/node_modules/zod/v4/locales/vi.js +116 -0
  1656. package/node_modules/zod/v4/locales/zh-CN.cjs +142 -0
  1657. package/node_modules/zod/v4/locales/zh-CN.d.cts +4 -0
  1658. package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
  1659. package/node_modules/zod/v4/locales/zh-CN.js +116 -0
  1660. package/node_modules/zod/v4/locales/zh-TW.cjs +143 -0
  1661. package/node_modules/zod/v4/locales/zh-TW.d.cts +4 -0
  1662. package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
  1663. package/node_modules/zod/v4/locales/zh-TW.js +117 -0
  1664. package/node_modules/zod/v4/mini/checks.cjs +34 -0
  1665. package/node_modules/zod/v4/mini/checks.d.cts +1 -0
  1666. package/node_modules/zod/v4/mini/checks.d.ts +1 -0
  1667. package/node_modules/zod/v4/mini/checks.js +1 -0
  1668. package/node_modules/zod/v4/mini/coerce.cjs +47 -0
  1669. package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
  1670. package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
  1671. package/node_modules/zod/v4/mini/coerce.js +17 -0
  1672. package/node_modules/zod/v4/mini/external.cjs +62 -0
  1673. package/node_modules/zod/v4/mini/external.d.cts +11 -0
  1674. package/node_modules/zod/v4/mini/external.d.ts +11 -0
  1675. package/node_modules/zod/v4/mini/external.js +13 -0
  1676. package/node_modules/zod/v4/mini/index.cjs +32 -0
  1677. package/node_modules/zod/v4/mini/index.d.cts +3 -0
  1678. package/node_modules/zod/v4/mini/index.d.ts +3 -0
  1679. package/node_modules/zod/v4/mini/index.js +3 -0
  1680. package/node_modules/zod/v4/mini/iso.cjs +60 -0
  1681. package/node_modules/zod/v4/mini/iso.d.cts +22 -0
  1682. package/node_modules/zod/v4/mini/iso.d.ts +22 -0
  1683. package/node_modules/zod/v4/mini/iso.js +30 -0
  1684. package/node_modules/zod/v4/mini/parse.cjs +8 -0
  1685. package/node_modules/zod/v4/mini/parse.d.cts +1 -0
  1686. package/node_modules/zod/v4/mini/parse.d.ts +1 -0
  1687. package/node_modules/zod/v4/mini/parse.js +1 -0
  1688. package/node_modules/zod/v4/mini/schemas.cjs +839 -0
  1689. package/node_modules/zod/v4/mini/schemas.d.cts +356 -0
  1690. package/node_modules/zod/v4/mini/schemas.d.ts +356 -0
  1691. package/node_modules/zod/v4/mini/schemas.js +732 -0
  1692. package/node_modules/zod/v4-mini/index.cjs +17 -0
  1693. package/node_modules/zod/v4-mini/index.d.cts +1 -0
  1694. package/node_modules/zod/v4-mini/index.d.ts +1 -0
  1695. package/node_modules/zod/v4-mini/index.js +1 -0
  1696. package/npm-shrinkwrap.json +90 -3
  1697. package/openclaw.plugin.json +99 -2
  1698. package/package.json +16 -7
  1699. package/dist/approval-custom-id-NYPYj9Po.js +0 -58
  1700. package/dist/approval-message-safety-C-8BL6Kv.js +0 -47
  1701. package/dist/configured-state.js +0 -6
  1702. package/dist/message-handler-CIxWq5Yh.js +0 -532
  1703. package/dist/provider.runtime-C2iIfbTs.js +0 -2
  1704. package/dist/retry-after-D5_VmM-_.js +0 -25
  1705. package/dist/runtime-api.monitor-DSbfGnzS.js +0 -6
  1706. package/dist/security-doctor-uUo8hTD5.js +0 -18
  1707. package/dist/targets-DvItNIvP.js +0 -3
  1708. package/dist/timeouts.js +0 -2
  1709. package/dist/{preflight-audio-DYL2ABgA.js → preflight-audio-DDSZna4F.js} +1 -1
  1710. package/dist/{thread-bindings.state-9VAxhVf6.js → thread-bindings.state-C5afR9TD.js} +1 -1
@@ -1,56 +1,56 @@
1
- import { C as Client, D as RateLimitError, F as Message, I as User, K as Container, M as Command, N as CommandWithSubcommands, P as Guild, Q as Row, V as Modal, W as Button, Xt as __exportAll, _ as MessageReactionRemoveListener, _t as editChannel, at as BaseMessageInteractiveComponent, bt as getChannelMessage, d as discord_exports, et as Separator, f as GuildCreateListener, g as MessageReactionAddListener, h as MessageCreateListener, m as InteractionCreateListener, mt as createThread, nt as TextDisplay, p as GuildDeleteListener, tt as StringSelectMenu, u as chunkDiscordTextWithMode, v as PresenceUpdateListener, w as Plugin, x as ThreadUpdateListener, y as ReadyListener } from "./send.receipt-aegk69an.js";
2
- import { c as resolveDiscordAccountAllowFrom, d as resolveDiscordAccountDmPolicy, f as resolveDiscordMaxLinesPerMessage, p as normalizeDiscordToken, s as resolveDiscordAccount } from "./accounts-P19jm1lf.js";
3
- import { S as encodeCustomIdComponent, _ as parseDiscordComponentCustomId, b as parseDiscordModalCustomIdForInteraction, v as parseDiscordComponentCustomIdForInteraction, x as decodeCustomIdComponent, y as parseDiscordModalCustomId } from "./components-BVrfRS-F.js";
4
- import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-BaXQJKWT.js";
5
- import { i as setPresence, t as clearPresences } from "./presence-cache-z1N8MbJ3.js";
6
- import { B as DISCORD_REST_TIMEOUT_MS, D as canViewDiscordGuildChannel, G as registerGateway, H as withValidatedDiscordProxy, I as createDiscordRestClient, K as unregisterGateway, V as validateDiscordProxyUrl } from "./send.shared-Xz7IMVpu.js";
7
- import { a as isDiscordRateLimitResponseBody, o as summarizeDiscordResponseBody } from "./api--f62GFaS.js";
8
- import { C as resolveTimestampMs, a as normalizeDiscordSlug, b as formatDiscordReactionEmoji, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordCommandOwnerAllowFrom, f as resolveDiscordGuildEntry, g as resolveDiscordOwnerAllowFrom, h as resolveDiscordOwnerAccess, i as normalizeDiscordDisplaySlug, l as resolveDiscordChannelPolicyCommandAuthorizer, m as resolveDiscordMemberAllowed, n as isDiscordGroupAllowedByPolicy, o as resolveDiscordAllowListMatch, p as resolveDiscordMemberAccessState, r as normalizeDiscordAllowList, v as resolveGroupDmAllow, x as formatDiscordUserTag, y as shouldEmitDiscordReactionNotification } from "./allow-list-B7qOH5xu.js";
9
- import { s as sendVoiceMessageDiscord } from "./send-BFpa_DHn.js";
10
- import { a as formatMention, t as sendMessageDiscord } from "./send.outbound-BlA6VzSE.js";
11
- import { d as withAbortTimeout, l as raceWithTimeout } from "./timeouts-ZRc9Lw4y.js";
12
- import { r as parseExecApprovalData } from "./approval-custom-id-NYPYj9Po.js";
1
+ import { C as Client, D as RateLimitError, F as Message, I as User, K as Container, M as Command, N as CommandWithSubcommands, P as Guild, Q as Row, V as Modal, W as Button, Yt as __exportAll, _ as MessageReactionRemoveListener, _t as editChannel, at as BaseMessageInteractiveComponent, bt as getChannelMessage, d as discord_exports, et as Separator, f as GuildCreateListener, g as MessageReactionAddListener, h as MessageCreateListener, m as InteractionCreateListener, mt as createThread, nt as TextDisplay, p as GuildDeleteListener, t as chunkDiscordTextWithMode, tt as StringSelectMenu, v as PresenceUpdateListener, w as Plugin, x as ThreadUpdateListener, y as ReadyListener } from "./chunk-CWzmeWf_.js";
2
+ import { c as resolveDiscordAccountAllowFrom, d as resolveDiscordAccountDmPolicy, f as resolveDiscordMaxLinesPerMessage, p as normalizeDiscordToken, s as resolveDiscordAccount } from "./accounts-CMd4nzLB.js";
3
+ import { n as getDiscordActivitiesRuntime } from "./runtime-CD5MRZkD.js";
4
+ import { C as parseDiscordActivityCustomIdForInteraction, D as parseDiscordModalCustomIdForInteraction, E as parseDiscordModalCustomId, O as decodeCustomIdComponent, T as parseDiscordComponentCustomIdForInteraction, k as encodeCustomIdComponent, l as parseExecApprovalData, s as parseDiscordQuestionData, w as parseDiscordComponentCustomId, y as buildDiscordActivityCustomId } from "./outbound-session-route-M2bEY9tI.js";
5
+ import { D as canViewDiscordGuildChannel, F as createDiscordRestClient, H as registerGateway, K as validateDiscordProxyUrl, U as unregisterGateway, q as withValidatedDiscordProxy, z as DISCORD_REST_TIMEOUT_MS } from "./send.shared-Dber6X57.js";
6
+ import { _ as resolveDiscordModalEntryWithPersistence, g as resolveDiscordComponentEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-DLqzOEPJ.js";
13
7
  import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
14
- import { a as isDiscordExecApprovalClientEnabled, r as getDiscordExecApprovalApprovers, t as resolveDiscordConversationIdentity } from "./conversation-identity-BpkAzklg.js";
15
- import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-BrkWOKdG.js";
16
- import { t as resolveDiscordUserAllowlist } from "./resolve-users-OjrXXvJP.js";
17
- import { _ as formatThreadBindingDurationLabel, a as isThreadArchived, d as resolveDiscordChannelNameSafe, f as resolveDiscordChannelParentIdSafe, l as resolveDiscordChannelIdSafe, m as resolveDiscordChannelTopicSafe, p as resolveDiscordChannelParentSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-DJD3qwIN.js";
18
- import { r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-DxjMBeVG.js";
19
- import { d as resolveDiscordMessageChannelId, n as resolveDiscordForwardedMessagesTextFromSnapshots, t as resolveDiscordEmbedText, u as resolveDiscordChannelInfo } from "./message-utils-D4j07taS.js";
20
- import { t as resolveDiscordSenderIdentity } from "./sender-identity-C62lBe18.js";
21
- import { n as formatDiscordApprovalDisplayValue, t as DISCORD_APPROVAL_ALLOWED_MENTIONS } from "./approval-message-safety-C-8BL6Kv.js";
22
- import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
8
+ import { a as isDiscordRateLimitResponseBody, o as summarizeDiscordResponseBody } from "./api-C43z8vUm.js";
9
+ import { C as resolveTimestampMs, a as normalizeDiscordSlug, b as formatDiscordReactionEmoji, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordCommandOwnerAllowFrom, f as resolveDiscordGuildEntry, g as resolveDiscordOwnerAllowFrom, h as resolveDiscordOwnerAccess, i as normalizeDiscordDisplaySlug, l as resolveDiscordChannelPolicyCommandAuthorizer, m as resolveDiscordMemberAllowed, n as isDiscordGroupAllowedByPolicy, o as resolveDiscordAllowListMatch, p as resolveDiscordMemberAccessState, r as normalizeDiscordAllowList, t as allowListMatches, v as resolveGroupDmAllow, x as formatDiscordUserTag, y as shouldEmitDiscordReactionNotification } from "./allow-list-DzKrtfah.js";
10
+ import { a as formatMention, t as sendMessageDiscord } from "./send.outbound-C1SfX20w.js";
11
+ import { i as setPresence, t as clearPresences } from "./presence-cache-z1N8MbJ3.js";
12
+ import { n as sendVoiceMessageDiscord } from "./send-CSRxNNgq.js";
13
+ import { c as raceWithTimeout, u as withAbortTimeout } from "./timeouts-B9cy6RvQ.js";
14
+ import { a as getDiscordExecApprovalApprovers, n as formatDiscordApprovalDisplayValue, r as resolveDiscordConversationIdentity, s as isDiscordExecApprovalClientEnabled, t as DISCORD_APPROVAL_ALLOWED_MENTIONS } from "./approval-message-safety-DrLlgIPz.js";
15
+ import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-9KcG3mLg.js";
16
+ import { t as resolveDiscordUserAllowlist } from "./resolve-users-GCGf3oV0.js";
17
+ import { _ as formatThreadBindingDurationLabel, a as isThreadArchived, d as resolveDiscordChannelNameSafe, f as resolveDiscordChannelParentIdSafe, l as resolveDiscordChannelIdSafe, m as resolveDiscordChannelTopicSafe, p as resolveDiscordChannelParentSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-mNCWlgvM.js";
18
+ import { r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-C3SCKyYU.js";
19
+ import { d as resolveDiscordMessageChannelId, n as resolveDiscordForwardedMessagesTextFromSnapshots, t as resolveDiscordEmbedText, u as resolveDiscordChannelInfo } from "./message-utils-Cfe6CZ6N.js";
20
+ import { t as resolveDiscordSenderIdentity } from "./sender-identity-mG_zsdox.js";
23
21
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
24
- import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeOptionalStringifiedId, normalizeStringEntries, normalizeStringEntriesLower, summarizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
25
22
  import { buildAgentSessionKey, deriveLastRoutePolicy, isAcpSessionKey, isSubagentSessionKey, parseAgentSessionKey, resolveAgentIdFromSessionKey, resolveAgentRoute } from "openclaw/plugin-sdk/routing";
23
+ import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeOptionalStringifiedId, normalizeStringEntries, normalizeStringEntriesLower, summarizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
26
24
  import { getRuntimeConfig, getRuntimeConfigSnapshot } from "openclaw/plugin-sdk/runtime-config-snapshot";
25
+ import { logDebug, logError } from "openclaw/plugin-sdk/logging-core";
27
26
  import { ApplicationCommandOptionType, ButtonStyle, ChannelType, ComponentType, GatewayCloseCodes, GatewayCloseCodes as GatewayCloseCodes$1, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes } from "discord-api-types/v10";
28
- import { MAX_DATE_TIMESTAMP_MS, asDateTimestampMs, parseFiniteNumber, parseStrictFiniteNumber, parseStrictInteger, parseStrictNonNegativeInteger, parseStrictPositiveInteger, resolveDateTimestampMs, resolveTimestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
29
27
  import { createHash, randomUUID } from "node:crypto";
30
- import path from "node:path";
31
- import { resolvePinnedMainDmOwnerFromAllowlist as resolvePinnedMainDmOwnerFromAllowlist$1 } from "openclaw/plugin-sdk/security-runtime";
28
+ import { MAX_DATE_TIMESTAMP_MS, asDateTimestampMs, parseFiniteNumber, parseStrictFiniteNumber, parseStrictInteger, parseStrictNonNegativeInteger, parseStrictPositiveInteger, resolveDateTimestampMs, resolveTimestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
32
29
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
33
30
  import { Type } from "typebox";
34
31
  import { Check, Errors } from "typebox/value";
35
32
  import { inspect } from "node:util";
36
33
  import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
37
34
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
38
- import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
39
- import { resolveSendableOutboundReplyParts, resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
40
- import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
41
- import { resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-chunking";
35
+ import { fetchWithSsrFGuard, formatErrorMessage as formatErrorMessage$1 } from "openclaw/plugin-sdk/ssrf-runtime";
42
36
  import { createHttp1EnvHttpProxyAgent, createHttp1ProxyAgent, createNodeProxyAgent, resolveEnvHttpProxyAgentOptions, wrapFetchWithAbortSignal } from "openclaw/plugin-sdk/fetch-runtime";
43
- import { createNonExitingRuntime, createSubsystemLogger, danger, formatDurationSeconds, isVerbose, logVerbose, shouldLogVerbose, warn } from "openclaw/plugin-sdk/runtime-env";
37
+ import { createNonExitingRuntime, createSubsystemLogger, danger, formatDurationSeconds, isVerbose, logVerbose, shouldLogVerbose, sleepWithAbort, warn } from "openclaw/plugin-sdk/runtime-env";
44
38
  import { sliceUtf16Safe, truncateUtf16Safe, withTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
45
- import { createReplyReferencePlanner } from "openclaw/plugin-sdk/reply-reference";
39
+ import { addAllowlistUserEntriesFromConfigEntry, buildAllowlistResolutionSummary, canonicalizeAllowlistWithResolvedIds, patchAllowlistUsersInConfigEntries, summarizeMapping } from "openclaw/plugin-sdk/allow-from";
46
40
  import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
41
+ import { resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-chunking";
47
42
  import { chunkItems, sanitizeAssistantVisibleText, sanitizeAssistantVisibleTextWithProfile } from "openclaw/plugin-sdk/text-chunking";
43
+ import { createReplyReferencePlanner } from "openclaw/plugin-sdk/reply-reference";
48
44
  import { buildOutboundSessionContext, createChannelMessageReplyPipeline, resolveChannelStreamingBlockEnabled, sendDurableMessageBatch } from "openclaw/plugin-sdk/channel-outbound";
49
- import { fetchWithSsrFGuard, formatErrorMessage as formatErrorMessage$1 } from "openclaw/plugin-sdk/ssrf-runtime";
45
+ import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
46
+ import { resolveSendableOutboundReplyParts, resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
47
+ import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
48
+ import { createLazyRuntimeModule, createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
49
+ import { resolvePinnedMainDmOwnerFromAllowlist as resolvePinnedMainDmOwnerFromAllowlist$1 } from "openclaw/plugin-sdk/security-runtime";
50
50
  import { GROUP_POLICY_BLOCKED_LABEL, resolveDefaultGroupPolicy, resolveOpenProviderRuntimeGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
51
51
  import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing";
52
52
  import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
53
- import { addAllowlistUserEntriesFromConfigEntry, buildAllowlistResolutionSummary, canonicalizeAllowlistWithResolvedIds, patchAllowlistUsersInConfigEntries, summarizeMapping } from "openclaw/plugin-sdk/allow-from";
53
+ import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
54
54
  import { buildPairingReply, upsertChannelPairingRequest, upsertChannelPairingRequest as upsertChannelPairingRequest$1 } from "openclaw/plugin-sdk/conversation-runtime";
55
55
  import { clearExpiredCooldowns, ensureAuthProfileStore, formatReasoningMessage, isProfileInCooldown, loadModelCatalog, resolveAgentAvatar, resolveDefaultModelForAgent, resolveHumanDelayConfig, resolveProfilesUnavailableReason } from "openclaw/plugin-sdk/agent-runtime";
56
56
  import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
@@ -62,7 +62,7 @@ import { createChannelIngressResolver, defineStableChannelIngressIdentity, readC
62
62
  import { ModelSelectionLockedError, applyModelOverrideToSessionEntry, resolveChannelModelOverride } from "openclaw/plugin-sdk/model-session-runtime";
63
63
  import { completeWithPreparedSimpleCompletionModel, extractAssistantText, prepareSimpleCompletionModelForAgent } from "openclaw/plugin-sdk/simple-completion-runtime";
64
64
  import { getSessionEntry, listSessionEntries, patchSessionEntry, readSessionUpdatedAt as readSessionUpdatedAt$1, resolveStorePath, resolveStorePath as resolveStorePath$1 } from "openclaw/plugin-sdk/session-store-runtime";
65
- import { formatInboundEnvelope, resolveEnvelopeFormatOptions, runChannelInboundEvent } from "openclaw/plugin-sdk/channel-inbound";
65
+ import { formatInboundEnvelope, resolveEnvelopeFormatOptions, resolveInboundSupplementalSenderAllowed, runChannelInboundEvent } from "openclaw/plugin-sdk/channel-inbound";
66
66
  import { buildCommandTextFromArgs, findCommandByNativeName, formatCommandArgMenuTitle, listChatCommands, listNativeCommandSpecsForConfig, listSkillCommandsForAgents, resolveCommandAuthorizedFromAuthorizers, resolveEffectiveAgentRuntime, resolveNativeCommandSessionTargets, resolveStoredModelOverride, serializeCommandArgs } from "openclaw/plugin-sdk/command-auth-native";
67
67
  import { buildCommandTextFromArgs as buildCommandTextFromArgs$1, findCommandByNativeName as findCommandByNativeName$1, parseCommandArgs, resolveCommandArgChoices, resolveCommandArgMenu, serializeCommandArgs as serializeCommandArgs$1 } from "openclaw/plugin-sdk/native-command-registry";
68
68
  import { resolveDirectStatusReplyForSession } from "openclaw/plugin-sdk/command-status-runtime";
@@ -77,10 +77,8 @@ import { Agent } from "node:https";
77
77
  import { captureHttpExchange, captureWsEvent, resolveDebugProxySettings, resolveEffectiveDebugProxyUrl } from "openclaw/plugin-sdk/proxy-capture";
78
78
  import * as dns from "node:dns";
79
79
  import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runtime-context";
80
- import { logDebug, logError } from "openclaw/plugin-sdk/logging-core";
81
80
  import { stripPlainTextToolCallBlocks } from "openclaw/plugin-sdk/tool-payload";
82
81
  import { resolveApprovalOverGateway } from "openclaw/plugin-sdk/approval-gateway-runtime";
83
- import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
84
82
  import { resolveRequestUrl } from "openclaw/plugin-sdk/request-url";
85
83
  import { fetchWithRuntimeDispatcher } from "openclaw/plugin-sdk/runtime-fetch";
86
84
  import { Agent as Agent$1 } from "undici";
@@ -1259,6 +1257,85 @@ function openDiscordPresenceCooldownStore() {
1259
1257
  });
1260
1258
  }
1261
1259
  //#endregion
1260
+ //#region extensions/discord/src/monitor/presence-emission-gate.ts
1261
+ const DISCORD_PRESENCE_RECONNECT_SUPPRESS_MS = 300 * 1e3;
1262
+ const DISCORD_PRESENCE_BURST_LIMIT = 8;
1263
+ const DISCORD_PRESENCE_BURST_WINDOW_MS = 60 * 1e3;
1264
+ function resolveDiscordPresenceGateOptions(config) {
1265
+ return {
1266
+ reconnectSuppressMs: config?.reconnectSuppressSeconds !== void 0 ? config.reconnectSuppressSeconds * 1e3 : DISCORD_PRESENCE_RECONNECT_SUPPRESS_MS,
1267
+ burstLimit: config?.burstLimit ?? DISCORD_PRESENCE_BURST_LIMIT,
1268
+ burstWindowMs: config?.burstWindowSeconds !== void 0 ? config.burstWindowSeconds * 1e3 : DISCORD_PRESENCE_BURST_WINDOW_MS
1269
+ };
1270
+ }
1271
+ /**
1272
+ * Per-account lifecycle gate for online-presence events. Reconnect state belongs to the Gateway
1273
+ * session, while burst state follows the guild-owned configuration that supplies its limits.
1274
+ */
1275
+ var DiscordPresenceEmissionGate = class {
1276
+ constructor() {
1277
+ this.reconnectLogged = false;
1278
+ this.burstByGuild = /* @__PURE__ */ new Map();
1279
+ this.nextReservationId = 0;
1280
+ }
1281
+ noteGatewaySessionReset(nowMs) {
1282
+ this.lastSessionResetAtMs = nowMs;
1283
+ this.reconnectLogged = false;
1284
+ }
1285
+ evaluateReconnectWindow(nowMs, options) {
1286
+ if (this.lastSessionResetAtMs !== void 0 && options.reconnectSuppressMs > 0 && nowMs - this.lastSessionResetAtMs < options.reconnectSuppressMs) {
1287
+ const shouldLog = !this.reconnectLogged;
1288
+ this.reconnectLogged = true;
1289
+ return {
1290
+ allowed: false,
1291
+ reason: "reconnect-window",
1292
+ shouldLog
1293
+ };
1294
+ }
1295
+ return { allowed: true };
1296
+ }
1297
+ reserveBurst(guildId, nowMs, options) {
1298
+ const state = this.burstByGuild.get(guildId) ?? {
1299
+ reservations: [],
1300
+ logged: false
1301
+ };
1302
+ state.reservations = state.reservations.filter((reservation) => !reservation.committed || nowMs - reservation.atMs < options.burstWindowMs);
1303
+ this.burstByGuild.set(guildId, state);
1304
+ if (state.reservations.length >= options.burstLimit) {
1305
+ const shouldLog = !state.logged;
1306
+ state.logged = true;
1307
+ return {
1308
+ allowed: false,
1309
+ reason: state.reservations.some((reservation) => !reservation.committed) ? "burst-pending" : "burst",
1310
+ shouldLog
1311
+ };
1312
+ }
1313
+ state.logged = false;
1314
+ const reservation = {
1315
+ id: this.nextReservationId++,
1316
+ atMs: nowMs,
1317
+ committed: false
1318
+ };
1319
+ state.reservations.push(reservation);
1320
+ return {
1321
+ allowed: true,
1322
+ reservation: reservation.id
1323
+ };
1324
+ }
1325
+ commitBurst(guildId, reservation, nowMs) {
1326
+ const entry = this.burstByGuild.get(guildId)?.reservations.find((candidate) => candidate.id === reservation);
1327
+ if (!entry) return;
1328
+ entry.atMs = nowMs;
1329
+ entry.committed = true;
1330
+ }
1331
+ releaseBurst(guildId, reservation) {
1332
+ const state = this.burstByGuild.get(guildId);
1333
+ if (!state) return;
1334
+ state.reservations = state.reservations.filter((candidate) => candidate.id !== reservation);
1335
+ if (state.reservations.length === 0 && !state.logged) this.burstByGuild.delete(guildId);
1336
+ }
1337
+ };
1338
+ //#endregion
1262
1339
  //#region extensions/discord/src/monitor/presence-transition-cache.ts
1263
1340
  const DEFAULT_PRESENCE_BASELINE_MAX_ENTRIES = 75e3;
1264
1341
  var DiscordPresenceBaselineCache = class {
@@ -1362,9 +1439,11 @@ var DiscordMessageListener = class extends MessageCreateListener {
1362
1439
  }
1363
1440
  async handle(data, client) {
1364
1441
  this.onEvent?.();
1365
- Promise.resolve().then(() => this.handler(data, client)).catch((err) => {
1442
+ try {
1443
+ await this.handler(data, client);
1444
+ } catch (err) {
1366
1445
  (this.logger ?? discordEventQueueLog).error(danger(`discord handler failed: ${String(err)}`));
1367
- });
1446
+ }
1368
1447
  }
1369
1448
  };
1370
1449
  var DiscordInteractionListener = class extends InteractionCreateListener {
@@ -1389,6 +1468,7 @@ var DiscordPresenceListener = class extends PresenceUpdateListener {
1389
1468
  this.gatewayGeneration = 0;
1390
1469
  this.cooldownStore = params.cooldownStore ?? openDiscordPresenceCooldownStore();
1391
1470
  this.presenceBaseline = params.presenceBaseline ?? new DiscordPresenceBaselineCache();
1471
+ this.emissionGate = params.emissionGate ?? new DiscordPresenceEmissionGate();
1392
1472
  }
1393
1473
  seedGuildSnapshot(data) {
1394
1474
  const config = resolveDiscordGuildEntry({
@@ -1436,6 +1516,7 @@ var DiscordPresenceListener = class extends PresenceUpdateListener {
1436
1516
  }
1437
1517
  resetGatewaySession() {
1438
1518
  this.gatewayGeneration += 1;
1519
+ this.emissionGate.noteGatewaySessionReset(this.params.nowMs?.() ?? Date.now());
1439
1520
  this.presenceBaseline.clear();
1440
1521
  this.guildPresenceState.clear();
1441
1522
  this.pendingByGuildUser.clear();
@@ -1477,34 +1558,70 @@ var DiscordPresenceListener = class extends PresenceUpdateListener {
1477
1558
  else if (isDiscordOnlineStatus(data.status)) this.recordPresenceBaseline(data.guild_id, presenceKey, "online");
1478
1559
  return;
1479
1560
  }
1480
- const fetchedUserIsBot = data.user.bot === void 0 && (await client.fetchUser(userId)).bot === true;
1481
- if (!this.isCurrentGeneration(data.guild_id, gatewayGeneration, guildGeneration)) return;
1482
- if (fetchedUserIsBot) {
1561
+ const gateOptions = resolveDiscordPresenceGateOptions(config);
1562
+ const reconnectGate = this.emissionGate.evaluateReconnectWindow(nowMs, gateOptions);
1563
+ if (!reconnectGate.allowed) {
1564
+ if (reconnectGate.shouldLog) (this.params.logger ?? discordEventQueueLog).info("Discord presence events suppressed", {
1565
+ reason: reconnectGate.reason,
1566
+ accountId: this.params.accountId,
1567
+ guildId: data.guild_id
1568
+ });
1483
1569
  this.recordPresenceBaseline(data.guild_id, presenceKey, "online");
1484
1570
  return;
1485
1571
  }
1486
- const route = resolveAgentRoute({
1487
- cfg: this.params.cfg,
1488
- channel: "discord",
1489
- accountId: this.params.accountId,
1490
- guildId: data.guild_id,
1491
- peer: {
1492
- kind: "channel",
1493
- id: presenceEvent.channelId
1494
- }
1495
- });
1572
+ const burstNowMs = this.params.nowMs?.() ?? Date.now();
1573
+ const burstGate = this.emissionGate.reserveBurst(data.guild_id, burstNowMs, gateOptions);
1574
+ if (!burstGate.allowed) {
1575
+ if (burstGate.shouldLog) (this.params.logger ?? discordEventQueueLog).info("Discord presence events suppressed", {
1576
+ reason: burstGate.reason,
1577
+ accountId: this.params.accountId,
1578
+ guildId: data.guild_id
1579
+ });
1580
+ if (burstGate.reason === "burst-pending") return;
1581
+ this.recordPresenceBaseline(data.guild_id, presenceKey, "online");
1582
+ return;
1583
+ }
1584
+ const burstReservation = burstGate.reservation;
1585
+ let burstCommitted = false;
1586
+ let cooldownReserved = false;
1496
1587
  try {
1497
- if (!this.cooldownStore.registerIfAbsent(presenceKey, nowMs, { ttlMs: 288e5 })) {
1588
+ const fetchedUserIsBot = data.user.bot === void 0 && (await client.fetchUser(userId)).bot === true;
1589
+ if (!this.isCurrentGeneration(data.guild_id, gatewayGeneration, guildGeneration)) return;
1590
+ if (fetchedUserIsBot) {
1498
1591
  this.recordPresenceBaseline(data.guild_id, presenceKey, "online");
1499
1592
  return;
1500
1593
  }
1501
- } catch (err) {
1502
- (this.params.logger ?? discordEventQueueLog).warn(danger(`discord presence cooldown persistence failed: ${String(err)}`));
1503
- return;
1504
- }
1505
- let queued;
1506
- try {
1507
- queued = enqueueSystemEvent(presenceEvent.text, {
1594
+ const canViewTargetChannel = await canViewDiscordGuildChannel(data.guild_id, presenceEvent.channelId, userId, {
1595
+ cfg: this.params.cfg,
1596
+ accountId: this.params.accountId,
1597
+ rest: client.rest
1598
+ });
1599
+ if (!this.isCurrentGeneration(data.guild_id, gatewayGeneration, guildGeneration)) return;
1600
+ if (!canViewTargetChannel) {
1601
+ this.recordPresenceBaseline(data.guild_id, presenceKey, "online");
1602
+ return;
1603
+ }
1604
+ const route = resolveAgentRoute({
1605
+ cfg: this.params.cfg,
1606
+ channel: "discord",
1607
+ accountId: this.params.accountId,
1608
+ guildId: data.guild_id,
1609
+ peer: {
1610
+ kind: "channel",
1611
+ id: presenceEvent.channelId
1612
+ }
1613
+ });
1614
+ try {
1615
+ cooldownReserved = this.cooldownStore.registerIfAbsent(presenceKey, nowMs, { ttlMs: DISCORD_PRESENCE_GREETING_COOLDOWN_MS });
1616
+ if (!cooldownReserved) {
1617
+ this.recordPresenceBaseline(data.guild_id, presenceKey, "online");
1618
+ return;
1619
+ }
1620
+ } catch (err) {
1621
+ (this.params.logger ?? discordEventQueueLog).warn(danger(`discord presence cooldown persistence failed: ${String(err)}`));
1622
+ return;
1623
+ }
1624
+ if (!enqueueSystemEvent(presenceEvent.text, {
1508
1625
  sessionKey: route.sessionKey,
1509
1626
  contextKey: `discord:presence-online:${this.params.accountId}:${data.guild_id}:${userId}`,
1510
1627
  deliveryContext: {
@@ -1512,28 +1629,26 @@ var DiscordPresenceListener = class extends PresenceUpdateListener {
1512
1629
  to: `channel:${presenceEvent.channelId}`,
1513
1630
  accountId: this.params.accountId
1514
1631
  }
1632
+ })) return;
1633
+ this.emissionGate.commitBurst(data.guild_id, burstReservation, this.params.nowMs?.() ?? Date.now());
1634
+ burstCommitted = true;
1635
+ this.recordPresenceBaseline(data.guild_id, presenceKey, "online");
1636
+ requestHeartbeat({
1637
+ source: "notifications-event",
1638
+ intent: "immediate",
1639
+ reason: "wake",
1640
+ agentId: route.agentId,
1641
+ sessionKey: route.sessionKey,
1642
+ heartbeat: {
1643
+ target: "discord",
1644
+ to: `channel:${presenceEvent.channelId}`,
1645
+ accountId: this.params.accountId
1646
+ }
1515
1647
  });
1516
- } catch (err) {
1517
- if (this.cooldownStore.lookup(presenceKey) === nowMs) this.cooldownStore.delete(presenceKey);
1518
- throw err;
1519
- }
1520
- if (!queued) {
1521
- if (this.cooldownStore.lookup(presenceKey) === nowMs) this.cooldownStore.delete(presenceKey);
1522
- return;
1648
+ } finally {
1649
+ if (!burstCommitted) this.emissionGate.releaseBurst(data.guild_id, burstReservation);
1650
+ if (cooldownReserved && !burstCommitted && this.cooldownStore.lookup(presenceKey) === nowMs) this.cooldownStore.delete(presenceKey);
1523
1651
  }
1524
- this.recordPresenceBaseline(data.guild_id, presenceKey, "online");
1525
- requestHeartbeat({
1526
- source: "notifications-event",
1527
- intent: "immediate",
1528
- reason: "wake",
1529
- agentId: route.agentId,
1530
- sessionKey: route.sessionKey,
1531
- heartbeat: {
1532
- target: "discord",
1533
- to: `channel:${presenceEvent.channelId}`,
1534
- accountId: this.params.accountId
1535
- }
1536
- });
1537
1652
  }
1538
1653
  isCurrentGeneration(guildId, gatewayGeneration, guildGeneration) {
1539
1654
  return gatewayGeneration === this.gatewayGeneration && guildGeneration === (this.guildPresenceState.get(guildId)?.generation ?? 0);
@@ -1606,6 +1721,62 @@ var DiscordThreadUpdateListener = class extends ThreadUpdateListener {
1606
1721
  }
1607
1722
  };
1608
1723
  //#endregion
1724
+ //#region extensions/discord/src/internal/gateway-dispatch.ts
1725
+ function dispatchVoiceGatewayEvent(client, type, data) {
1726
+ const guildId = readGuildId(data);
1727
+ if (!guildId) return;
1728
+ const adapter = (client.getPlugin("voice")?.adapters)?.get(guildId);
1729
+ const voiceServerUpdate = GatewayDispatchEvents.VoiceServerUpdate;
1730
+ const voiceStateUpdate = GatewayDispatchEvents.VoiceStateUpdate;
1731
+ if (type === voiceServerUpdate) adapter?.onVoiceServerUpdate?.(data);
1732
+ if (type === voiceStateUpdate) adapter?.onVoiceStateUpdate?.(data);
1733
+ }
1734
+ function mapGatewayDispatchData(client, type, data) {
1735
+ const messageCreate = GatewayDispatchEvents.MessageCreate;
1736
+ const reactionAdd = GatewayDispatchEvents.MessageReactionAdd;
1737
+ const reactionRemove = GatewayDispatchEvents.MessageReactionRemove;
1738
+ if (type === messageCreate) return createMessageDispatchData(client, data);
1739
+ if (type === reactionAdd || type === reactionRemove) return createReactionDispatchData(client, data);
1740
+ return data;
1741
+ }
1742
+ function createMessageDispatchData(client, data) {
1743
+ const message = new Message(client, data);
1744
+ return {
1745
+ ...data,
1746
+ id: data.id,
1747
+ channel_id: data.channel_id,
1748
+ channelId: data.channel_id,
1749
+ message,
1750
+ author: message.author ?? (data.author ? new User(client, data.author) : null),
1751
+ member: data.member,
1752
+ rawMember: data.member,
1753
+ guild: data.guild_id ? new Guild(client, data.guild_id) : null
1754
+ };
1755
+ }
1756
+ function createReactionDispatchData(client, data) {
1757
+ const userRaw = data.member?.user && typeof data.member.user === "object" ? {
1758
+ id: data.user_id,
1759
+ username: "",
1760
+ ...data.member.user
1761
+ } : {
1762
+ id: data.user_id,
1763
+ username: ""
1764
+ };
1765
+ return {
1766
+ ...data,
1767
+ user: new User(client, userRaw),
1768
+ rawMember: data.member,
1769
+ guild: data.guild_id ? new Guild(client, data.guild_id) : null,
1770
+ message: new Message(client, {
1771
+ id: data.message_id,
1772
+ channelId: data.channel_id
1773
+ })
1774
+ };
1775
+ }
1776
+ function readGuildId(data) {
1777
+ return data && typeof data === "object" && typeof data.guild_id === "string" ? data.guild_id : void 0;
1778
+ }
1779
+ //#endregion
1609
1780
  //#region extensions/discord/src/monitor/dm-command-decision.ts
1610
1781
  async function handleDiscordDmCommandDecision(params) {
1611
1782
  if (params.senderAccess.decision === "allow") return true;
@@ -2213,16 +2384,23 @@ function shouldBypassConfiguredAcpGuildGuards(commandName) {
2213
2384
  //#endregion
2214
2385
  //#region extensions/discord/src/monitor/inbound-context.ts
2215
2386
  function createDiscordSupplementalContextAccessChecker(params) {
2387
+ const userAllowList = params.channelConfig?.users ?? params.guildInfo?.users ?? [];
2388
+ const roleAllowList = params.channelConfig?.roles ?? params.guildInfo?.roles ?? [];
2389
+ const allowFrom = [...userAllowList, ...roleAllowList];
2216
2390
  return (sender) => {
2217
- if (!params.isGuild) return true;
2218
- return resolveDiscordMemberAllowed({
2219
- userAllowList: params.channelConfig?.users ?? params.guildInfo?.users,
2220
- roleAllowList: params.channelConfig?.roles ?? params.guildInfo?.roles,
2221
- memberRoleIds: sender.memberRoleIds ?? [],
2222
- userId: sender.id ?? "",
2223
- userName: sender.name,
2224
- userTag: sender.tag,
2225
- allowNameMatching: params.allowNameMatching
2391
+ return resolveInboundSupplementalSenderAllowed({
2392
+ isGroup: params.isGuild,
2393
+ groupPolicy: allowFrom.length === 0 ? "open" : "allowlist",
2394
+ allowFrom,
2395
+ isSenderAllowed: () => resolveDiscordMemberAllowed({
2396
+ userAllowList,
2397
+ roleAllowList,
2398
+ memberRoleIds: sender.memberRoleIds ?? [],
2399
+ userId: sender.id ?? "",
2400
+ userName: sender.name,
2401
+ userTag: sender.tag,
2402
+ allowNameMatching: params.allowNameMatching
2403
+ })
2226
2404
  });
2227
2405
  };
2228
2406
  }
@@ -5127,62 +5305,6 @@ function canResumeAfterGatewayClose(code) {
5127
5305
  return !nonResumableGatewayCloseCodes.has(code);
5128
5306
  }
5129
5307
  //#endregion
5130
- //#region extensions/discord/src/internal/gateway-dispatch.ts
5131
- function dispatchVoiceGatewayEvent(client, type, data) {
5132
- const guildId = readGuildId(data);
5133
- if (!guildId) return;
5134
- const adapter = (client.getPlugin("voice")?.adapters)?.get(guildId);
5135
- const voiceServerUpdate = GatewayDispatchEvents.VoiceServerUpdate;
5136
- const voiceStateUpdate = GatewayDispatchEvents.VoiceStateUpdate;
5137
- if (type === voiceServerUpdate) adapter?.onVoiceServerUpdate?.(data);
5138
- if (type === voiceStateUpdate) adapter?.onVoiceStateUpdate?.(data);
5139
- }
5140
- function mapGatewayDispatchData(client, type, data) {
5141
- const messageCreate = GatewayDispatchEvents.MessageCreate;
5142
- const reactionAdd = GatewayDispatchEvents.MessageReactionAdd;
5143
- const reactionRemove = GatewayDispatchEvents.MessageReactionRemove;
5144
- if (type === messageCreate) return createMessageDispatchData(client, data);
5145
- if (type === reactionAdd || type === reactionRemove) return createReactionDispatchData(client, data);
5146
- return data;
5147
- }
5148
- function createMessageDispatchData(client, data) {
5149
- const message = new Message(client, data);
5150
- return {
5151
- ...data,
5152
- id: data.id,
5153
- channel_id: data.channel_id,
5154
- channelId: data.channel_id,
5155
- message,
5156
- author: message.author ?? (data.author ? new User(client, data.author) : null),
5157
- member: data.member,
5158
- rawMember: data.member,
5159
- guild: data.guild_id ? new Guild(client, data.guild_id) : null
5160
- };
5161
- }
5162
- function createReactionDispatchData(client, data) {
5163
- const userRaw = data.member?.user && typeof data.member.user === "object" ? {
5164
- id: data.user_id,
5165
- username: "",
5166
- ...data.member.user
5167
- } : {
5168
- id: data.user_id,
5169
- username: ""
5170
- };
5171
- return {
5172
- ...data,
5173
- user: new User(client, userRaw),
5174
- rawMember: data.member,
5175
- guild: data.guild_id ? new Guild(client, data.guild_id) : null,
5176
- message: new Message(client, {
5177
- id: data.message_id,
5178
- channelId: data.channel_id
5179
- })
5180
- };
5181
- }
5182
- function readGuildId(data) {
5183
- return data && typeof data === "object" && typeof data.guild_id === "string" ? data.guild_id : void 0;
5184
- }
5185
- //#endregion
5186
5308
  //#region extensions/discord/src/internal/gateway-identify-limiter.ts
5187
5309
  const IDENTIFY_WINDOW_MS = 5e3;
5188
5310
  function normalizeMaxConcurrency(value) {
@@ -5397,10 +5519,15 @@ var DiscordGatewayVoiceStateCache = class {
5397
5519
  return;
5398
5520
  }
5399
5521
  const states = /* @__PURE__ */ new Map();
5400
- for (const state of guild.voice_states) if (state.channel_id) states.set(state.user_id, {
5401
- ...state,
5402
- guild_id: guild.id
5403
- });
5522
+ const membersByUserId = new Map((guild.members ?? []).map((member) => [member.user.id, member]));
5523
+ for (const state of guild.voice_states) if (state.channel_id) {
5524
+ const member = state.member ?? membersByUserId.get(state.user_id);
5525
+ states.set(state.user_id, {
5526
+ ...state,
5527
+ ...member ? { member } : {},
5528
+ guild_id: guild.id
5529
+ });
5530
+ }
5404
5531
  this.statesByGuild.set(guild.id, states);
5405
5532
  return;
5406
5533
  }
@@ -5412,6 +5539,7 @@ var DiscordGatewayVoiceStateCache = class {
5412
5539
  const previous = states.get(state.user_id);
5413
5540
  const current = {
5414
5541
  ...state,
5542
+ ...state.member ? {} : previous?.member ? { member: previous.member } : {},
5415
5543
  guild_id: guildId
5416
5544
  };
5417
5545
  this.transitionsByState.set(state, {
@@ -5706,7 +5834,7 @@ var GatewayPlugin = class extends Plugin {
5706
5834
  }
5707
5835
  this.voiceStateCache.apply(payload);
5708
5836
  dispatchVoiceGatewayEvent(this.client, payload.t, payload.d);
5709
- const data = mapGatewayDispatchData(this.client, payload.t, payload.d);
5837
+ const data = payload.t === GatewayDispatchEvents.MessageCreate ? payload.d : mapGatewayDispatchData(this.client, payload.t, payload.d);
5710
5838
  await this.client.dispatchGatewayEvent(payload.t, data);
5711
5839
  if (payload.t === GatewayDispatchEvents.InteractionCreate && this.options.autoInteractions) await this.client.handleInteraction(payload.d);
5712
5840
  }
@@ -6235,9 +6363,12 @@ function resolveGatewayInfoWithFallback(params) {
6235
6363
  };
6236
6364
  }
6237
6365
  async function fetchDiscordGatewayMetadataGuarded(input, init, options) {
6366
+ const requestInit = init;
6367
+ const signal = requestInit?.signal ?? void 0;
6238
6368
  const guarded = await fetchWithSsrFGuard({
6239
6369
  url: resolveFetchInputUrl(input),
6240
- init,
6370
+ init: requestInit,
6371
+ ...signal ? { signal } : {},
6241
6372
  policy: { allowedHostnames: [DISCORD_API_HOST] },
6242
6373
  capture: false,
6243
6374
  auditContext: "discord.gateway.metadata",
@@ -6652,628 +6783,1134 @@ function createDiscordGatewaySupervisor(params) {
6652
6783
  };
6653
6784
  }
6654
6785
  //#endregion
6655
- //#region extensions/discord/src/monitor/provider.acp.ts
6656
- const DISCORD_ACP_STATUS_PROBE_TIMEOUT_MS = 8e3;
6657
- const DISCORD_ACP_STALE_RUNNING_ACTIVITY_MS = 120 * 1e3;
6658
- function isLegacyMissingSessionError(message) {
6659
- return message.includes("Session is not ACP-enabled") || message.includes("ACP session metadata missing");
6660
- }
6661
- function classifyAcpStatusProbeError(params) {
6662
- if (params.isAcpRuntimeError(params.error) && params.error.code === "ACP_SESSION_INIT_FAILED") return {
6663
- status: "stale",
6664
- reason: "session-init-failed"
6665
- };
6666
- if (isLegacyMissingSessionError(formatErrorMessage$1(params.error))) return {
6667
- status: "stale",
6668
- reason: "session-missing"
6786
+ //#region extensions/discord/src/gateway-logging.ts
6787
+ const INFO_DEBUG_MARKERS = [
6788
+ "Gateway websocket closed",
6789
+ "Gateway reconnect scheduled in",
6790
+ "Gateway forcing fresh IDENTIFY after"
6791
+ ];
6792
+ const shouldPromoteGatewayDebug = (message) => INFO_DEBUG_MARKERS.some((marker) => message.includes(marker));
6793
+ const formatGatewayMetrics = (metrics) => {
6794
+ if (metrics === null || metrics === void 0) return String(metrics);
6795
+ if (typeof metrics === "string") return metrics;
6796
+ if (typeof metrics === "number" || typeof metrics === "boolean" || typeof metrics === "bigint") return String(metrics);
6797
+ try {
6798
+ return JSON.stringify(metrics);
6799
+ } catch {
6800
+ return "[unserializable metrics]";
6801
+ }
6802
+ };
6803
+ function attachDiscordGatewayLogging(params) {
6804
+ const { emitter, runtime } = params;
6805
+ if (!emitter) return () => {};
6806
+ const onGatewayDebug = (msg) => {
6807
+ const message = String(msg);
6808
+ logVerbose(`discord gateway: ${message}`);
6809
+ if (shouldPromoteGatewayDebug(message)) runtime.log?.(`discord gateway: ${message}`);
6669
6810
  };
6670
- return params.isStaleRunning ? {
6671
- status: "stale",
6672
- reason: "status-error-running-stale"
6673
- } : {
6674
- status: "uncertain",
6675
- reason: "status-error"
6811
+ const onGatewayWarning = (warning) => {
6812
+ logVerbose(`discord gateway warning: ${String(warning)}`);
6676
6813
  };
6677
- }
6678
- function resolveRunningActivityAgeMs(params) {
6679
- if (params.storedState !== "running") return 0;
6680
- const nowMs = asDateTimestampMs(Date.now());
6681
- if (nowMs === void 0) return 0;
6682
- const activityAtMs = asDateTimestampMs(params.lastActivityAt);
6683
- return Math.max(0, nowMs - (activityAtMs === void 0 ? 0 : Math.max(0, Math.floor(activityAtMs))));
6684
- }
6685
- async function probeDiscordAcpBindingHealth(params) {
6686
- const { getAcpSessionManager, isAcpRuntimeError } = params.providerSessionRuntime;
6687
- const manager = getAcpSessionManager();
6688
- const statusProbeAbortController = new AbortController();
6689
- const result = await raceWithTimeout({
6690
- promise: manager.getSessionStatus({
6691
- cfg: params.cfg,
6692
- sessionKey: params.sessionKey,
6693
- signal: statusProbeAbortController.signal
6694
- }).then((status) => ({
6695
- kind: "status",
6696
- status
6697
- })).catch((error) => ({
6698
- kind: "error",
6699
- error
6700
- })),
6701
- timeoutMs: DISCORD_ACP_STATUS_PROBE_TIMEOUT_MS,
6702
- onTimeout: () => ({ kind: "timeout" })
6703
- });
6704
- if (result.kind === "timeout") statusProbeAbortController.abort();
6705
- const runningForMs = resolveRunningActivityAgeMs(params);
6706
- const isStaleRunning = params.storedState === "running" && runningForMs >= DISCORD_ACP_STALE_RUNNING_ACTIVITY_MS;
6707
- if (result.kind === "timeout") return isStaleRunning ? {
6708
- status: "stale",
6709
- reason: "status-timeout-running-stale"
6710
- } : {
6711
- status: "uncertain",
6712
- reason: "status-timeout"
6814
+ const onGatewayMetrics = (metrics) => {
6815
+ logVerbose(`discord gateway metrics: ${formatGatewayMetrics(metrics)}`);
6713
6816
  };
6714
- if (result.kind === "error") return classifyAcpStatusProbeError({
6715
- error: result.error,
6716
- isStaleRunning,
6717
- isAcpRuntimeError
6718
- });
6719
- if (result.status.state === "error") return {
6720
- status: "uncertain",
6721
- reason: "status-error-state"
6817
+ emitter.on("debug", onGatewayDebug);
6818
+ emitter.on("warning", onGatewayWarning);
6819
+ emitter.on("metrics", onGatewayMetrics);
6820
+ return () => {
6821
+ emitter.removeListener("debug", onGatewayDebug);
6822
+ emitter.removeListener("warning", onGatewayWarning);
6823
+ emitter.removeListener("metrics", onGatewayMetrics);
6722
6824
  };
6723
- return { status: "healthy" };
6724
6825
  }
6725
6826
  //#endregion
6726
- //#region extensions/discord/src/monitor/provider.allowlist.ts
6727
- function formatResolutionLogDetails(base, details) {
6728
- const nonEmpty = details.map((value) => value?.trim()).filter((value) => Boolean(value));
6729
- return nonEmpty.length > 0 ? `${base} (${nonEmpty.join("; ")})` : base;
6730
- }
6731
- function formatResolvedBase(input, target) {
6732
- if (!target) return input;
6733
- return input === target ? input : `${input}→${target}`;
6734
- }
6735
- function formatAliasSummary(aliases) {
6736
- if (aliases.length === 0) return;
6737
- const preview = aliases.slice(0, 3).join(", ");
6738
- if (aliases.length <= 3) return preview;
6739
- return `${preview}, +${aliases.length - 3} more`;
6827
+ //#region extensions/discord/src/monitor.gateway.ts
6828
+ async function waitForDiscordGatewayStop(params) {
6829
+ const { gateway, abortSignal } = params;
6830
+ return await new Promise((resolve, reject) => {
6831
+ let settled = false;
6832
+ const cleanup = () => {
6833
+ abortSignal?.removeEventListener("abort", onAbort);
6834
+ params.gatewaySupervisor?.detachLifecycle();
6835
+ };
6836
+ const finishResolve = () => {
6837
+ if (settled) return;
6838
+ settled = true;
6839
+ try {
6840
+ gateway?.disconnect?.();
6841
+ } finally {
6842
+ cleanup();
6843
+ resolve();
6844
+ }
6845
+ };
6846
+ const finishReject = (err) => {
6847
+ if (settled) return;
6848
+ settled = true;
6849
+ try {
6850
+ gateway?.disconnect?.();
6851
+ } finally {
6852
+ cleanup();
6853
+ reject(toLintErrorObject(err, "Non-Error rejection"));
6854
+ }
6855
+ };
6856
+ const onAbort = () => {
6857
+ finishResolve();
6858
+ };
6859
+ const onGatewayEvent = (event) => {
6860
+ if ((params.onGatewayEvent?.(event) ?? "stop") === "stop") finishReject(new DiscordGatewayLifecycleError(event));
6861
+ };
6862
+ const onForceStop = (err) => {
6863
+ finishReject(err);
6864
+ };
6865
+ if (abortSignal?.aborted) {
6866
+ onAbort();
6867
+ return;
6868
+ }
6869
+ abortSignal?.addEventListener("abort", onAbort, { once: true });
6870
+ params.gatewaySupervisor?.attachLifecycle(onGatewayEvent);
6871
+ params.registerForceStop?.(onForceStop);
6872
+ });
6740
6873
  }
6741
- function formatDiscordChannelResolvedGroup(entry) {
6742
- const aliasSummary = formatAliasSummary(entry.aliases);
6743
- return formatResolutionLogDetails(entry.target, [
6744
- entry.guildName ? `guild:${entry.guildName}` : void 0,
6745
- entry.channelName ? `channel:${entry.channelName}` : void 0,
6746
- entry.note,
6747
- aliasSummary ? `aliases:${aliasSummary}` : void 0
6748
- ]);
6874
+ function toLintErrorObject(value, fallbackMessage) {
6875
+ if (value instanceof Error) return value;
6876
+ if (typeof value === "string") return new Error(value);
6877
+ const error = new Error(fallbackMessage, { cause: value });
6878
+ if (typeof value === "object" && value !== null || typeof value === "function") Object.assign(error, value);
6879
+ return error;
6749
6880
  }
6750
- function formatDiscordChannelUnresolved(entry) {
6751
- return formatResolutionLogDetails(entry.input, [
6752
- entry.guildName ? `guild:${entry.guildName}` : entry.guildId ? `guildId:${entry.guildId}` : void 0,
6753
- entry.channelName ? `channel:${entry.channelName}` : entry.channelId ? `channelId:${entry.channelId}` : void 0,
6754
- entry.note
6755
- ]);
6881
+ //#endregion
6882
+ //#region extensions/discord/src/monitor/provider.lifecycle.ts
6883
+ const DEFAULT_DISCORD_GATEWAY_READY_TIMEOUT_MS = 15e3;
6884
+ const DEFAULT_DISCORD_GATEWAY_RUNTIME_READY_TIMEOUT_MS = 3e4;
6885
+ const MAX_DISCORD_GATEWAY_READY_TIMEOUT_MS = 12e4;
6886
+ const DISCORD_GATEWAY_READY_TIMEOUT_ENV = "OPENCLAW_DISCORD_READY_TIMEOUT_MS";
6887
+ const DISCORD_GATEWAY_RUNTIME_READY_TIMEOUT_ENV = "OPENCLAW_DISCORD_RUNTIME_READY_TIMEOUT_MS";
6888
+ const DISCORD_GATEWAY_READY_POLL_MS = 250;
6889
+ const DISCORD_GATEWAY_READY_RETRY_BACKOFF_MS = 2e3;
6890
+ const DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS = 5e3;
6891
+ const DISCORD_GATEWAY_STARTUP_TERMINATE_CLOSE_TIMEOUT_MS = 1e3;
6892
+ const DISCORD_GATEWAY_TRANSPORT_ACTIVITY_STATUS_MIN_INTERVAL_MS = 3e4;
6893
+ function normalizeGatewayReadyTimeoutMs(value) {
6894
+ const numeric = parseStrictPositiveInteger(value);
6895
+ if (numeric === void 0) return;
6896
+ return Math.min(numeric, MAX_DISCORD_GATEWAY_READY_TIMEOUT_MS);
6756
6897
  }
6757
- function formatDiscordUserResolved(entry) {
6758
- const displayName = entry.name?.trim();
6759
- const target = displayName || entry.id;
6760
- const formatted = formatResolutionLogDetails(formatResolvedBase(entry.input, target), [
6761
- displayName && entry.id && entry.id !== entry.input ? `id:${entry.id}` : void 0,
6762
- entry.guildName ? `guild:${entry.guildName}` : void 0,
6763
- entry.note
6764
- ]);
6765
- return formatted === entry.input ? null : formatted;
6898
+ function resolveDiscordGatewayReadyTimeoutMs(params) {
6899
+ return normalizeGatewayReadyTimeoutMs(params?.configuredTimeoutMs) ?? normalizeGatewayReadyTimeoutMs(params?.env?.[DISCORD_GATEWAY_READY_TIMEOUT_ENV]) ?? DEFAULT_DISCORD_GATEWAY_READY_TIMEOUT_MS;
6766
6900
  }
6767
- function formatDiscordUserUnresolved(entry) {
6768
- return formatResolutionLogDetails(entry.input, [
6769
- entry.name ? `name:${entry.name}` : void 0,
6770
- entry.guildName ? `guild:${entry.guildName}` : void 0,
6771
- entry.note
6772
- ]);
6901
+ function resolveDiscordGatewayRuntimeReadyTimeoutMs(params) {
6902
+ return normalizeGatewayReadyTimeoutMs(params?.configuredTimeoutMs) ?? normalizeGatewayReadyTimeoutMs(params?.env?.[DISCORD_GATEWAY_RUNTIME_READY_TIMEOUT_ENV]) ?? DEFAULT_DISCORD_GATEWAY_RUNTIME_READY_TIMEOUT_MS;
6773
6903
  }
6774
- function toGuildEntries(value) {
6775
- if (!value || typeof value !== "object") return {};
6776
- const out = {};
6777
- for (const [key, entry] of Object.entries(value)) {
6778
- if (!entry || typeof entry !== "object") continue;
6779
- out[key] = entry;
6904
+ async function restartGatewayAfterReadyTimeout(params) {
6905
+ if (!params.gateway || params.abortSignal?.aborted) return;
6906
+ const socket = params.gateway.ws;
6907
+ if (!socket) {
6908
+ params.gateway.disconnect();
6909
+ if (!params.abortSignal?.aborted) params.gateway.connect(false);
6910
+ return;
6780
6911
  }
6781
- return out;
6912
+ await new Promise((resolve, reject) => {
6913
+ let settled = false;
6914
+ let drainTimeout;
6915
+ let terminateCloseTimeout;
6916
+ const ignoreSocketError = () => {};
6917
+ const clearTimers = () => {
6918
+ if (drainTimeout) {
6919
+ clearTimeout(drainTimeout);
6920
+ drainTimeout = void 0;
6921
+ }
6922
+ if (terminateCloseTimeout) {
6923
+ clearTimeout(terminateCloseTimeout);
6924
+ terminateCloseTimeout = void 0;
6925
+ }
6926
+ };
6927
+ const cleanup = () => {
6928
+ clearTimers();
6929
+ socket.removeListener("close", onClose);
6930
+ socket.removeListener("error", ignoreSocketError);
6931
+ };
6932
+ const finishResolve = () => {
6933
+ if (settled) return;
6934
+ settled = true;
6935
+ cleanup();
6936
+ resolve();
6937
+ };
6938
+ const finishReject = (error) => {
6939
+ if (params.abortSignal?.aborted) {
6940
+ finishResolve();
6941
+ return;
6942
+ }
6943
+ if (settled) return;
6944
+ settled = true;
6945
+ cleanup();
6946
+ reject(error);
6947
+ };
6948
+ const onClose = () => {
6949
+ finishResolve();
6950
+ };
6951
+ socket.on("error", ignoreSocketError);
6952
+ socket.on("close", onClose);
6953
+ params.gateway?.disconnect();
6954
+ drainTimeout = setTimeout(() => {
6955
+ if (settled) return;
6956
+ if (typeof socket.terminate !== "function") {
6957
+ finishReject(/* @__PURE__ */ new Error(`discord gateway socket did not close within ${DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS}ms before restart`));
6958
+ return;
6959
+ }
6960
+ params.runtime.error?.(danger(`discord: startup restart waiting on a stale gateway socket for ${DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS}ms; forcing terminate before reconnect`));
6961
+ try {
6962
+ socket.terminate();
6963
+ } catch {
6964
+ finishReject(/* @__PURE__ */ new Error(`discord gateway socket did not close within ${DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS}ms before restart`));
6965
+ return;
6966
+ }
6967
+ terminateCloseTimeout = setTimeout(() => {
6968
+ finishReject(/* @__PURE__ */ new Error(`discord gateway socket did not close within ${DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS}ms before restart`));
6969
+ }, DISCORD_GATEWAY_STARTUP_TERMINATE_CLOSE_TIMEOUT_MS);
6970
+ terminateCloseTimeout.unref?.();
6971
+ }, DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS);
6972
+ drainTimeout.unref?.();
6973
+ });
6974
+ if (!params.abortSignal?.aborted) params.gateway.connect(false);
6782
6975
  }
6783
- function toAllowlistEntries(value) {
6784
- if (!Array.isArray(value)) return;
6785
- return normalizeStringEntries(value);
6976
+ function parseGatewayCloseCode(message) {
6977
+ const match = /Gateway websocket closed:\s*(\d{3,5})/.exec(message);
6978
+ if (!match?.[1]) return;
6979
+ const code = Number.parseInt(match[1], 10);
6980
+ return Number.isFinite(code) ? code : void 0;
6786
6981
  }
6787
- function hasGuildEntries(value) {
6788
- return Object.keys(value).length > 0;
6982
+ function resolveTransportActivityAt(event) {
6983
+ const at = event?.at;
6984
+ const timestampMs = asDateTimestampMs(at);
6985
+ return timestampMs !== void 0 && timestampMs >= 0 ? timestampMs : Date.now();
6789
6986
  }
6790
- function collectChannelResolutionInputs(guildEntries) {
6791
- const entries = [];
6792
- for (const [guildKey, guildCfg] of Object.entries(guildEntries)) {
6793
- if (guildKey === "*") continue;
6794
- const channels = guildCfg?.channels ?? {};
6795
- const channelKeys = Object.keys(channels).filter((key) => key !== "*");
6796
- if (channelKeys.length === 0) {
6797
- const input = /^\d+$/.test(guildKey) ? `guild:${guildKey}` : guildKey;
6798
- entries.push({
6799
- input,
6800
- guildKey
6801
- });
6802
- continue;
6987
+ function createGatewayStatusObserver(params) {
6988
+ let forceStopHandler;
6989
+ let queuedForceStopError;
6990
+ let readyPollId;
6991
+ let readyTimeoutId;
6992
+ const shouldStop = () => params.abortSignal?.aborted || params.isLifecycleStopping();
6993
+ const clearReadyWatch = () => {
6994
+ if (readyPollId) {
6995
+ clearInterval(readyPollId);
6996
+ readyPollId = void 0;
6803
6997
  }
6804
- for (const channelKey of channelKeys) entries.push({
6805
- input: `${guildKey}/${channelKey}`,
6806
- guildKey,
6807
- channelKey
6808
- });
6809
- }
6810
- return entries;
6811
- }
6812
- async function resolveGuildEntriesByChannelAllowlist(params) {
6813
- const entries = collectChannelResolutionInputs(params.guildEntries);
6814
- if (entries.length === 0) return params.guildEntries;
6815
- try {
6816
- const resolved = await resolveDiscordChannelAllowlist({
6817
- token: params.token,
6818
- entries: entries.map((entry) => entry.input),
6819
- fetcher: params.fetcher
6998
+ if (readyTimeoutId) {
6999
+ clearTimeout(readyTimeoutId);
7000
+ readyTimeoutId = void 0;
7001
+ }
7002
+ };
7003
+ const triggerForceStop = (err) => {
7004
+ if (forceStopHandler) {
7005
+ forceStopHandler(err);
7006
+ return;
7007
+ }
7008
+ queuedForceStopError = err;
7009
+ };
7010
+ const pushConnectedStatus = (at) => {
7011
+ params.pushStatus({
7012
+ ...createConnectedChannelStatusPatch(at),
7013
+ lastDisconnect: null,
7014
+ lastError: null
6820
7015
  });
6821
- const sourceByInput = new Map(entries.map((entry) => [entry.input, entry]));
6822
- const nextGuilds = { ...params.guildEntries };
6823
- const mappingByTarget = /* @__PURE__ */ new Map();
6824
- const unresolved = [];
6825
- for (const entry of resolved) {
6826
- const source = sourceByInput.get(entry.input);
6827
- if (!source) continue;
6828
- const sourceGuild = params.guildEntries[source.guildKey] ?? {};
6829
- if (!entry.resolved || !entry.guildId) {
6830
- unresolved.push(formatDiscordChannelUnresolved(entry));
6831
- continue;
7016
+ };
7017
+ const startReadyWatch = () => {
7018
+ clearReadyWatch();
7019
+ const pollConnected = () => {
7020
+ if (shouldStop()) {
7021
+ clearReadyWatch();
7022
+ return;
6832
7023
  }
6833
- const target = entry.channelId ? `${entry.guildId}/${entry.channelId}` : entry.guildId;
6834
- const existingGroup = mappingByTarget.get(target) ?? {
6835
- target,
6836
- aliases: [],
6837
- guildName: entry.guildName,
6838
- channelName: entry.channelName,
6839
- note: entry.note
6840
- };
6841
- if (entry.input !== target && !existingGroup.aliases.includes(entry.input)) existingGroup.aliases.push(entry.input);
6842
- if (!existingGroup.guildName && entry.guildName) existingGroup.guildName = entry.guildName;
6843
- if (!existingGroup.channelName && entry.channelName) existingGroup.channelName = entry.channelName;
6844
- if (!existingGroup.note && entry.note) existingGroup.note = entry.note;
6845
- mappingByTarget.set(target, existingGroup);
6846
- const existing = nextGuilds[entry.guildId] ?? {};
6847
- const mergedChannels = {
6848
- ...sourceGuild.channels,
6849
- ...existing.channels
6850
- };
6851
- const mergedGuild = {
6852
- ...sourceGuild,
6853
- ...existing,
6854
- channels: mergedChannels
6855
- };
6856
- nextGuilds[entry.guildId] = mergedGuild;
6857
- if (source.channelKey && entry.channelId) {
6858
- const sourceChannel = sourceGuild.channels?.[source.channelKey];
6859
- if (sourceChannel) nextGuilds[entry.guildId] = {
6860
- ...mergedGuild,
6861
- channels: {
6862
- ...mergedChannels,
6863
- [entry.channelId]: {
6864
- ...sourceChannel,
6865
- ...mergedChannels[entry.channelId]
6866
- }
6867
- }
6868
- };
7024
+ if (!params.gateway?.isConnected) return;
7025
+ clearReadyWatch();
7026
+ pushConnectedStatus(Date.now());
7027
+ };
7028
+ pollConnected();
7029
+ if (!readyTimeoutId) {
7030
+ readyPollId = setInterval(pollConnected, DISCORD_GATEWAY_READY_POLL_MS);
7031
+ readyPollId.unref?.();
7032
+ readyTimeoutId = setTimeout(() => {
7033
+ clearReadyWatch();
7034
+ if (shouldStop() || params.gateway?.isConnected) return;
7035
+ const at = Date.now();
7036
+ const error = /* @__PURE__ */ new Error(`discord gateway opened but did not reach READY within ${params.runtimeReadyTimeoutMs}ms`);
7037
+ params.pushStatus({
7038
+ connected: false,
7039
+ lastEventAt: at,
7040
+ lastDisconnect: {
7041
+ at,
7042
+ error: "runtime-not-ready"
7043
+ },
7044
+ lastError: "runtime-not-ready"
7045
+ });
7046
+ params.runtime.error?.(danger(error.message));
7047
+ triggerForceStop(error);
7048
+ }, params.runtimeReadyTimeoutMs);
7049
+ readyTimeoutId.unref?.();
7050
+ }
7051
+ };
7052
+ const onGatewayDebug = (msg) => {
7053
+ if (shouldStop()) return;
7054
+ const at = Date.now();
7055
+ const message = String(msg);
7056
+ if (message.includes("Gateway websocket opened")) {
7057
+ params.pushStatus({
7058
+ connected: false,
7059
+ lastEventAt: at
7060
+ });
7061
+ startReadyWatch();
7062
+ return;
7063
+ }
7064
+ if (message.includes("Gateway websocket closed")) {
7065
+ clearReadyWatch();
7066
+ const code = parseGatewayCloseCode(message);
7067
+ params.pushStatus({
7068
+ connected: false,
7069
+ lastEventAt: at,
7070
+ lastDisconnect: {
7071
+ at,
7072
+ ...code !== void 0 ? { status: code } : {}
7073
+ }
7074
+ });
7075
+ return;
7076
+ }
7077
+ if (message.includes("Gateway reconnect scheduled in")) {
7078
+ clearReadyWatch();
7079
+ params.pushStatus({
7080
+ connected: false,
7081
+ lastEventAt: at,
7082
+ lastError: message
7083
+ });
7084
+ }
7085
+ };
7086
+ return {
7087
+ onGatewayDebug,
7088
+ clearReadyWatch,
7089
+ registerForceStop: (handler) => {
7090
+ forceStopHandler = handler;
7091
+ if (queuedForceStopError !== void 0) {
7092
+ const err = queuedForceStopError;
7093
+ queuedForceStopError = void 0;
7094
+ handler(err);
6869
7095
  }
7096
+ },
7097
+ dispose: () => {
7098
+ clearReadyWatch();
7099
+ forceStopHandler = void 0;
7100
+ queuedForceStopError = void 0;
6870
7101
  }
6871
- summarizeMapping("discord channels", [...mappingByTarget.values()].map((group) => formatDiscordChannelResolvedGroup(group)), unresolved, params.runtime);
6872
- return nextGuilds;
6873
- } catch (err) {
6874
- params.runtime.log?.(`discord channel resolve failed; using config entries. ${formatErrorMessage$1(err)}`);
6875
- return params.guildEntries;
6876
- }
7102
+ };
6877
7103
  }
6878
- async function resolveAllowFromByUserAllowlist(params) {
6879
- const allowEntries = normalizeStringEntries(params.allowFrom).filter((entry) => entry !== "*");
6880
- if (allowEntries.length === 0) return params.allowFrom;
6881
- try {
6882
- const { resolvedMap, mapping, unresolved } = buildAllowlistResolutionSummary(await resolveDiscordUserAllowlist({
6883
- token: params.token,
6884
- entries: allowEntries,
6885
- fetcher: params.fetcher
6886
- }), {
6887
- formatResolved: formatDiscordUserResolved,
6888
- formatUnresolved: formatDiscordUserUnresolved
7104
+ async function waitForGatewayReady(params) {
7105
+ const waitUntilReady = async () => {
7106
+ const deadlineAt = Date.now() + params.readyTimeoutMs;
7107
+ while (!params.abortSignal?.aborted) {
7108
+ if (await params.beforePoll?.() === "stop") return "stopped";
7109
+ if (params.gateway?.isConnected === true) {
7110
+ const at = Date.now();
7111
+ params.pushStatus?.({
7112
+ ...createConnectedChannelStatusPatch(at),
7113
+ lastDisconnect: null,
7114
+ lastError: null
7115
+ });
7116
+ return "ready";
7117
+ }
7118
+ if (Date.now() >= deadlineAt) return "timeout";
7119
+ await new Promise((resolve) => {
7120
+ setTimeout(resolve, DISCORD_GATEWAY_READY_POLL_MS).unref?.();
7121
+ });
7122
+ }
7123
+ return "stopped";
7124
+ };
7125
+ if (!params.gateway) {
7126
+ if (await waitUntilReady() === "timeout") throw new Error(`discord gateway did not reach READY within ${params.readyTimeoutMs}ms`);
7127
+ return;
7128
+ }
7129
+ let attempt = 0;
7130
+ while (!params.abortSignal?.aborted) {
7131
+ if (await waitUntilReady() !== "timeout") return;
7132
+ attempt += 1;
7133
+ const restartAt = Date.now();
7134
+ params.runtime.error?.(danger(`discord: gateway READY wait timed out after ${params.readyTimeoutMs}ms; reconnecting with backoff (attempt ${attempt})`));
7135
+ params.pushStatus?.({
7136
+ connected: false,
7137
+ lastEventAt: restartAt,
7138
+ lastDisconnect: {
7139
+ at: restartAt,
7140
+ error: "startup-not-ready"
7141
+ },
7142
+ lastError: "startup-not-ready"
6889
7143
  });
6890
- const allowFrom = canonicalizeAllowlistWithResolvedIds({
6891
- existing: params.allowFrom,
6892
- resolvedMap
7144
+ await params.beforeRestart?.();
7145
+ await restartGatewayAfterReadyTimeout({
7146
+ gateway: params.gateway,
7147
+ abortSignal: params.abortSignal,
7148
+ runtime: params.runtime
6893
7149
  });
6894
- summarizeMapping("discord users", mapping, unresolved, params.runtime);
6895
- return allowFrom;
6896
- } catch (err) {
6897
- params.runtime.log?.(`discord user resolve failed; using config entries. ${formatErrorMessage$1(err)}`);
6898
- return params.allowFrom;
6899
- }
6900
- }
6901
- function collectGuildUserEntries(guildEntries) {
6902
- const userEntries = /* @__PURE__ */ new Set();
6903
- for (const guild of Object.values(guildEntries)) {
6904
- if (!guild || typeof guild !== "object") continue;
6905
- addAllowlistUserEntriesFromConfigEntry(userEntries, guild);
6906
- const channels = guild.channels ?? {};
6907
- for (const channel of Object.values(channels)) addAllowlistUserEntriesFromConfigEntry(userEntries, channel);
6908
- }
6909
- return userEntries;
6910
- }
6911
- async function resolveGuildEntriesByUserAllowlist(params) {
6912
- const userEntries = collectGuildUserEntries(params.guildEntries);
6913
- if (userEntries.size === 0) return params.guildEntries;
6914
- try {
6915
- const { resolvedMap, mapping, unresolved } = buildAllowlistResolutionSummary(await resolveDiscordUserAllowlist({
6916
- token: params.token,
6917
- entries: Array.from(userEntries),
6918
- fetcher: params.fetcher
6919
- }), {
6920
- formatResolved: formatDiscordUserResolved,
6921
- formatUnresolved: formatDiscordUserUnresolved
6922
- });
6923
- const nextGuilds = { ...params.guildEntries };
6924
- for (const [guildKey, guildConfig] of Object.entries(params.guildEntries)) {
6925
- if (!guildConfig || typeof guildConfig !== "object") continue;
6926
- const nextGuild = { ...guildConfig };
6927
- const users = guildConfig.users;
6928
- if (Array.isArray(users) && users.length > 0) nextGuild.users = canonicalizeAllowlistWithResolvedIds({
6929
- existing: users,
6930
- resolvedMap
6931
- });
6932
- const channels = guildConfig.channels ?? {};
6933
- if (channels && typeof channels === "object") nextGuild.channels = patchAllowlistUsersInConfigEntries({
6934
- entries: channels,
6935
- resolvedMap,
6936
- strategy: "canonicalize"
6937
- });
6938
- nextGuilds[guildKey] = nextGuild;
7150
+ if (params.abortSignal?.aborted) return;
7151
+ try {
7152
+ await sleepWithAbort(DISCORD_GATEWAY_READY_RETRY_BACKOFF_MS, params.abortSignal, { ref: false });
7153
+ } catch {
7154
+ return;
6939
7155
  }
6940
- summarizeMapping("discord channel users", mapping, unresolved, params.runtime);
6941
- return nextGuilds;
6942
- } catch (err) {
6943
- params.runtime.log?.(`discord channel user resolve failed; using config entries. ${formatErrorMessage$1(err)}`);
6944
- return params.guildEntries;
6945
7156
  }
6946
7157
  }
6947
- async function resolveDiscordAllowlistConfig(params) {
6948
- let guildEntries = toGuildEntries(params.guildEntries);
6949
- let allowFrom = toAllowlistEntries(params.allowFrom);
6950
- if (hasGuildEntries(guildEntries)) guildEntries = await resolveGuildEntriesByChannelAllowlist({
6951
- token: params.token,
6952
- guildEntries,
6953
- fetcher: params.fetcher,
7158
+ async function runDiscordGatewayLifecycle(params) {
7159
+ const gateway = params.gateway;
7160
+ const gatewayReadyAtLifecycleStart = gateway?.isConnected === true;
7161
+ if (gateway) registerGateway(params.accountId, gateway);
7162
+ const gatewayEmitter = params.gatewaySupervisor.emitter ?? getDiscordGatewayEmitter(gateway);
7163
+ const stopGatewayLogging = attachDiscordGatewayLogging({
7164
+ emitter: gatewayEmitter,
6954
7165
  runtime: params.runtime
6955
7166
  });
6956
- if (isDangerousNameMatchingEnabled(params.discordConfig)) {
6957
- allowFrom = await resolveAllowFromByUserAllowlist({
6958
- token: params.token,
6959
- allowFrom,
6960
- fetcher: params.fetcher,
6961
- runtime: params.runtime
7167
+ let lifecycleStopping = false;
7168
+ const pushStatus = (patch) => {
7169
+ params.statusSink?.(patch);
7170
+ };
7171
+ const gatewayReadyTimeoutMs = resolveDiscordGatewayReadyTimeoutMs({
7172
+ configuredTimeoutMs: params.gatewayReadyTimeoutMs,
7173
+ env: process.env
7174
+ });
7175
+ const gatewayRuntimeReadyTimeoutMs = resolveDiscordGatewayRuntimeReadyTimeoutMs({
7176
+ configuredTimeoutMs: params.gatewayRuntimeReadyTimeoutMs,
7177
+ env: process.env
7178
+ });
7179
+ const statusObserver = createGatewayStatusObserver({
7180
+ gateway,
7181
+ abortSignal: params.abortSignal,
7182
+ runtime: params.runtime,
7183
+ pushStatus,
7184
+ isLifecycleStopping: () => lifecycleStopping,
7185
+ runtimeReadyTimeoutMs: gatewayRuntimeReadyTimeoutMs
7186
+ });
7187
+ gatewayEmitter?.on("debug", statusObserver.onGatewayDebug);
7188
+ let lastTransportActivityStatusAt;
7189
+ const onGatewayTransportActivity = (event) => {
7190
+ if (lifecycleStopping || params.abortSignal?.aborted) return;
7191
+ const at = resolveTransportActivityAt(event);
7192
+ if (lastTransportActivityStatusAt !== void 0 && at - lastTransportActivityStatusAt < DISCORD_GATEWAY_TRANSPORT_ACTIVITY_STATUS_MIN_INTERVAL_MS) return;
7193
+ lastTransportActivityStatusAt = at;
7194
+ pushStatus(createTransportActivityStatusPatch(at));
7195
+ };
7196
+ gatewayEmitter?.on(DISCORD_GATEWAY_TRANSPORT_ACTIVITY_EVENT, onGatewayTransportActivity);
7197
+ let sawDisallowedIntents = false;
7198
+ const handleGatewayEvent = (event) => {
7199
+ if (params.abortSignal?.aborted && event.type === "reconnect-exhausted") {
7200
+ lifecycleStopping = true;
7201
+ params.runtime.log?.(`discord: treating reconnect-exhausted during expected shutdown as clean: ${event.message}`);
7202
+ return "continue";
7203
+ }
7204
+ if (event.type === "disallowed-intents") {
7205
+ lifecycleStopping = true;
7206
+ sawDisallowedIntents = true;
7207
+ params.runtime.error?.(danger("discord: gateway closed with code 4014 (missing privileged gateway intents). Enable the required intents in the Discord Developer Portal or disable them in config."));
7208
+ return "stop";
7209
+ }
7210
+ if (event.shouldStopLifecycle) lifecycleStopping = true;
7211
+ params.runtime.error?.(danger(event.shouldStopLifecycle ? `discord gateway ${event.type}: ${event.message}` : `discord gateway error: ${event.message}`));
7212
+ return event.shouldStopLifecycle ? "stop" : "continue";
7213
+ };
7214
+ const drainPendingGatewayErrors = () => params.gatewaySupervisor.drainPending((event) => {
7215
+ if (handleGatewayEvent(event) !== "stop") return "continue";
7216
+ if (event.type === "disallowed-intents") return "stop";
7217
+ throw new DiscordGatewayLifecycleError(event);
7218
+ });
7219
+ try {
7220
+ if (drainPendingGatewayErrors() === "stop") return;
7221
+ if (gatewayReadyAtLifecycleStart && params.voiceManager) params.voiceManager.autoJoin().catch((err) => params.runtime.error?.(danger(`discord voice: autoJoin failed: ${formatErrorMessage$1(err)}`)));
7222
+ await waitForGatewayReady({
7223
+ gateway,
7224
+ abortSignal: params.abortSignal,
7225
+ beforePoll: drainPendingGatewayErrors,
7226
+ pushStatus,
7227
+ runtime: params.runtime,
7228
+ beforeRestart: statusObserver.clearReadyWatch,
7229
+ readyTimeoutMs: gatewayReadyTimeoutMs
6962
7230
  });
6963
- if (hasGuildEntries(guildEntries)) guildEntries = await resolveGuildEntriesByUserAllowlist({
6964
- token: params.token,
6965
- guildEntries,
6966
- fetcher: params.fetcher,
6967
- runtime: params.runtime
7231
+ if (drainPendingGatewayErrors() === "stop") return;
7232
+ await waitForDiscordGatewayStop({
7233
+ gateway: gateway ? { disconnect: () => gateway.disconnect() } : void 0,
7234
+ abortSignal: params.abortSignal,
7235
+ gatewaySupervisor: params.gatewaySupervisor,
7236
+ onGatewayEvent: handleGatewayEvent,
7237
+ registerForceStop: statusObserver.registerForceStop
6968
7238
  });
6969
- }
6970
- return {
6971
- guildEntries: hasGuildEntries(guildEntries) ? guildEntries : void 0,
6972
- allowFrom
6973
- };
6974
- }
6975
- //#endregion
6976
- //#region extensions/discord/src/monitor/provider.cleanup.ts
6977
- function cleanupDiscordProviderStartup(params) {
6978
- params.deactivateMessageHandler?.();
6979
- params.autoPresenceController?.stop();
6980
- params.setStatus?.({ connected: false });
6981
- if (params.onEarlyGatewayDebug) params.earlyGatewayEmitter?.removeListener("debug", params.onEarlyGatewayDebug);
6982
- if (!params.lifecycleStarted) try {
6983
- params.lifecycleGateway?.disconnect();
6984
7239
  } catch (err) {
6985
- params.runtime.error?.(danger(`discord: failed to disconnect gateway during startup cleanup: ${String(err)}`));
7240
+ if (!sawDisallowedIntents && !params.isDisallowedIntentsError(err)) throw err;
7241
+ } finally {
7242
+ lifecycleStopping = true;
7243
+ params.gatewaySupervisor.detachLifecycle();
7244
+ unregisterGateway(params.accountId);
7245
+ stopGatewayLogging();
7246
+ statusObserver.dispose();
7247
+ gatewayEmitter?.removeListener("debug", statusObserver.onGatewayDebug);
7248
+ gatewayEmitter?.removeListener(DISCORD_GATEWAY_TRANSPORT_ACTIVITY_EVENT, onGatewayTransportActivity);
7249
+ if (params.voiceManager) {
7250
+ await params.voiceManager.destroy();
7251
+ const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-DjDbt14x.js").then((n) => n.n);
7252
+ setDiscordTranscriptsVoiceManager({
7253
+ accountId: params.accountId,
7254
+ manager: null
7255
+ });
7256
+ params.voiceManagerRef.current = null;
7257
+ }
7258
+ params.threadBindings.stop();
6986
7259
  }
6987
- params.gatewaySupervisor?.dispose();
6988
- if (!params.lifecycleStarted) params.threadBindings.stop();
6989
7260
  }
6990
7261
  //#endregion
6991
- //#region extensions/discord/src/monitor/provider.commands.ts
6992
- let pluginRuntimePromise;
6993
- async function loadPluginRuntime() {
6994
- const promise = pluginRuntimePromise ?? import("openclaw/plugin-sdk/plugin-runtime");
6995
- pluginRuntimePromise = promise;
7262
+ //#region extensions/discord/src/monitor/provider-runtime.ts
7263
+ let discordVoiceRuntimePromise;
7264
+ let discordProviderSessionRuntimePromise;
7265
+ async function loadDiscordVoiceRuntime() {
7266
+ const promise = discordVoiceRuntimePromise ?? import("./manager.runtime-Cc8vS-M7.js");
7267
+ discordVoiceRuntimePromise = promise;
6996
7268
  try {
6997
7269
  return await promise;
6998
7270
  } catch (error) {
6999
- if (pluginRuntimePromise === promise) pluginRuntimePromise = void 0;
7271
+ if (discordVoiceRuntimePromise === promise) discordVoiceRuntimePromise = void 0;
7000
7272
  throw error;
7001
7273
  }
7002
7274
  }
7003
- async function appendPluginCommandSpecs(params) {
7004
- const merged = [...params.commandSpecs];
7005
- const existingNames = new Set(normalizeStringEntriesLower(merged.map((spec) => spec.name)));
7006
- const getPluginCommandSpecs = params.getPluginCommandSpecs ?? (await loadPluginRuntime()).getPluginCommandSpecs;
7007
- for (const pluginCommand of getPluginCommandSpecs("discord", { config: params.cfg })) {
7008
- const normalizedName = normalizeLowercaseStringOrEmpty(pluginCommand.name);
7009
- if (!normalizedName) continue;
7010
- if (existingNames.has(normalizedName)) {
7011
- params.runtime.error?.(danger(`discord: plugin command "/${normalizedName}" duplicates an existing native command. Skipping.`));
7012
- continue;
7013
- }
7014
- existingNames.add(normalizedName);
7015
- merged.push({
7016
- name: pluginCommand.name,
7017
- description: pluginCommand.description,
7018
- acceptsArgs: pluginCommand.acceptsArgs
7019
- });
7020
- }
7021
- return merged;
7022
- }
7023
- async function resolveDiscordProviderCommandSpecs(params) {
7024
- const listSkillCommands = params.listSkillCommandsForAgents ?? listSkillCommandsForAgents;
7025
- const listNativeCommandSpecs = params.listNativeCommandSpecsForConfig ?? listNativeCommandSpecsForConfig;
7026
- const maxDiscordCommands = params.maxDiscordCommands ?? 100;
7027
- let skillCommands = params.nativeEnabled && params.nativeSkillsEnabled ? listSkillCommands({ cfg: params.cfg }) : [];
7028
- let commandSpecs = params.nativeEnabled ? listNativeCommandSpecs(params.cfg, {
7029
- skillCommands,
7030
- provider: "discord"
7031
- }) : [];
7032
- if (params.nativeEnabled) commandSpecs = await appendPluginCommandSpecs({
7033
- commandSpecs,
7034
- runtime: params.runtime,
7035
- cfg: params.cfg,
7036
- getPluginCommandSpecs: params.getPluginCommandSpecs
7037
- });
7038
- const initialCommandCount = commandSpecs.length;
7039
- if (params.nativeEnabled && params.nativeSkillsEnabled && commandSpecs.length > maxDiscordCommands) {
7040
- skillCommands = [];
7041
- commandSpecs = listNativeCommandSpecs(params.cfg, {
7042
- skillCommands: [],
7043
- provider: "discord"
7044
- });
7045
- commandSpecs = await appendPluginCommandSpecs({
7046
- commandSpecs,
7047
- runtime: params.runtime,
7048
- cfg: params.cfg,
7049
- getPluginCommandSpecs: params.getPluginCommandSpecs
7050
- });
7051
- params.runtime.log?.(warn(`${initialCommandCount} commands exceed the ${maxDiscordCommands}-command Discord limit; removing per-skill commands and keeping /skill.`));
7275
+ async function loadDiscordProviderSessionRuntime() {
7276
+ const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-cCfGMsF_.js");
7277
+ discordProviderSessionRuntimePromise = promise;
7278
+ try {
7279
+ return await promise;
7280
+ } catch (error) {
7281
+ if (discordProviderSessionRuntimePromise === promise) discordProviderSessionRuntimePromise = void 0;
7282
+ throw error;
7052
7283
  }
7053
- if (params.nativeEnabled && commandSpecs.length > maxDiscordCommands) params.runtime.log?.(warn(`${commandSpecs.length} commands exceed the ${maxDiscordCommands}-command Discord limit; some commands may fail to deploy.`));
7054
- return {
7055
- skillCommands,
7056
- commandSpecs
7057
- };
7058
7284
  }
7285
+ const discordProviderRuntime = {
7286
+ fetchDiscordApplicationId,
7287
+ createDiscordNativeCommand,
7288
+ runDiscordGatewayLifecycle,
7289
+ loadDiscordVoiceRuntime,
7290
+ loadDiscordProviderSessionRuntime,
7291
+ createClient: (...args) => new Client(...args),
7292
+ getPluginCommandSpecs: void 0,
7293
+ resolveDiscordAccount,
7294
+ resolveNativeCommandsEnabled,
7295
+ resolveNativeSkillsEnabled,
7296
+ listNativeCommandSpecsForConfig,
7297
+ listSkillCommandsForAgents,
7298
+ isVerbose,
7299
+ shouldLogVerbose
7300
+ };
7059
7301
  //#endregion
7060
- //#region extensions/discord/src/monitor/provider.config-log.ts
7061
- function formatThreadBindingDurationForConfigLabel(durationMs) {
7062
- const label = formatThreadBindingDurationLabel(durationMs);
7063
- return label === "disabled" ? "off" : label;
7064
- }
7065
- function logDiscordResolvedConfig(params) {
7066
- const allowFromSummary = summarizeStringEntries({
7067
- entries: params.allowFrom ?? [],
7068
- limit: 4,
7069
- emptyText: "any"
7070
- });
7071
- const groupDmChannelSummary = summarizeStringEntries({
7072
- entries: params.groupDmChannels ?? [],
7073
- limit: 4,
7074
- emptyText: "any"
7075
- });
7076
- const guildSummary = summarizeStringEntries({
7077
- entries: Object.keys(params.guildEntries ?? {}),
7078
- limit: 4,
7079
- emptyText: "any"
7080
- });
7081
- logVerbose(`discord: config dm=${params.dmEnabled ? "on" : "off"} dmPolicy=${params.dmPolicy} allowFrom=${allowFromSummary} groupDm=${params.groupDmEnabled ? "on" : "off"} groupDmChannels=${groupDmChannelSummary} groupPolicy=${params.groupPolicy} guilds=${guildSummary} historyLimit=${params.historyLimit} mediaMaxMb=${Math.round(params.mediaMaxBytes / (1024 * 1024))} native=${params.nativeEnabled ? "on" : "off"} nativeSkills=${params.nativeSkillsEnabled ? "on" : "off"} accessGroups=${params.useAccessGroups ? "on" : "off"} threadBindings=${params.threadBindingsEnabled ? "on" : "off"} threadIdleTimeout=${formatThreadBindingDurationForConfigLabel(params.threadBindingIdleTimeoutMs)} threadMaxAge=${formatThreadBindingDurationForConfigLabel(params.threadBindingMaxAgeMs)}`);
7302
+ //#region extensions/discord/src/monitor/provider.acp.ts
7303
+ const DISCORD_ACP_STATUS_PROBE_TIMEOUT_MS = 8e3;
7304
+ const DISCORD_ACP_STALE_RUNNING_ACTIVITY_MS = 120 * 1e3;
7305
+ function isLegacyMissingSessionError(message) {
7306
+ return message.includes("Session is not ACP-enabled") || message.includes("ACP session metadata missing");
7082
7307
  }
7083
- //#endregion
7084
- //#region extensions/discord/src/monitor/provider.deploy-errors.ts
7085
- const DISCORD_DEPLOY_REJECTED_ENTRY_LIMIT = 3;
7086
- function attachDiscordDeployRequestBody(err, body) {
7087
- if (!err || typeof err !== "object" || body === void 0) return;
7088
- const deployErr = err;
7089
- if (deployErr.deployRequestBody === void 0) deployErr.deployRequestBody = body;
7308
+ function classifyAcpStatusProbeError(params) {
7309
+ if (params.isAcpRuntimeError(params.error) && params.error.code === "ACP_SESSION_INIT_FAILED") return {
7310
+ status: "stale",
7311
+ reason: "session-init-failed"
7312
+ };
7313
+ if (isLegacyMissingSessionError(formatErrorMessage$1(params.error))) return {
7314
+ status: "stale",
7315
+ reason: "session-missing"
7316
+ };
7317
+ return params.isStaleRunning ? {
7318
+ status: "stale",
7319
+ reason: "status-error-running-stale"
7320
+ } : {
7321
+ status: "uncertain",
7322
+ reason: "status-error"
7323
+ };
7090
7324
  }
7091
- function attachDiscordDeployRestContext(err, context) {
7092
- if (!err || typeof err !== "object") return;
7093
- const deployErr = err;
7094
- deployErr.deployRestMethod = context.method;
7095
- deployErr.deployRestPath = context.path;
7096
- deployErr.deployRequestMs = context.requestMs;
7097
- if (typeof context.timeoutMs === "number" && Number.isFinite(context.timeoutMs)) deployErr.deployTimeoutMs = context.timeoutMs;
7325
+ function resolveRunningActivityAgeMs(params) {
7326
+ if (params.storedState !== "running") return 0;
7327
+ const nowMs = asDateTimestampMs(Date.now());
7328
+ if (nowMs === void 0) return 0;
7329
+ const activityAtMs = asDateTimestampMs(params.lastActivityAt);
7330
+ return Math.max(0, nowMs - (activityAtMs === void 0 ? 0 : Math.max(0, Math.floor(activityAtMs))));
7098
7331
  }
7099
- function stringifyDiscordDeployField(value) {
7100
- if (typeof value === "string") return JSON.stringify(value);
7101
- try {
7102
- return JSON.stringify(value);
7103
- } catch {
7104
- return inspect(value, {
7105
- depth: 2,
7106
- breakLength: 120
7107
- });
7108
- }
7332
+ async function probeDiscordAcpBindingHealth(params) {
7333
+ const { getAcpSessionManager, isAcpRuntimeError } = params.providerSessionRuntime;
7334
+ const manager = getAcpSessionManager();
7335
+ const statusProbeAbortController = new AbortController();
7336
+ const result = await raceWithTimeout({
7337
+ promise: manager.getSessionStatus({
7338
+ cfg: params.cfg,
7339
+ sessionKey: params.sessionKey,
7340
+ signal: statusProbeAbortController.signal
7341
+ }).then((status) => ({
7342
+ kind: "status",
7343
+ status
7344
+ })).catch((error) => ({
7345
+ kind: "error",
7346
+ error
7347
+ })),
7348
+ timeoutMs: DISCORD_ACP_STATUS_PROBE_TIMEOUT_MS,
7349
+ onTimeout: () => ({ kind: "timeout" })
7350
+ });
7351
+ if (result.kind === "timeout") statusProbeAbortController.abort();
7352
+ const runningForMs = resolveRunningActivityAgeMs(params);
7353
+ const isStaleRunning = params.storedState === "running" && runningForMs >= DISCORD_ACP_STALE_RUNNING_ACTIVITY_MS;
7354
+ if (result.kind === "timeout") return isStaleRunning ? {
7355
+ status: "stale",
7356
+ reason: "status-timeout-running-stale"
7357
+ } : {
7358
+ status: "uncertain",
7359
+ reason: "status-timeout"
7360
+ };
7361
+ if (result.kind === "error") return classifyAcpStatusProbeError({
7362
+ error: result.error,
7363
+ isStaleRunning,
7364
+ isAcpRuntimeError
7365
+ });
7366
+ if (result.status.state === "error") return {
7367
+ status: "uncertain",
7368
+ reason: "status-error-state"
7369
+ };
7370
+ return { status: "healthy" };
7109
7371
  }
7110
- function readDiscordDeployRejectedFields(value) {
7111
- if (Array.isArray(value)) return value.filter((entry) => typeof entry === "string").slice(0, 6);
7112
- if (!value || typeof value !== "object") return [];
7113
- return Object.keys(value).slice(0, 6);
7372
+ //#endregion
7373
+ //#region extensions/discord/src/monitor/provider.allowlist.ts
7374
+ function formatResolutionLogDetails(base, details) {
7375
+ const nonEmpty = details.map((value) => value?.trim()).filter((value) => Boolean(value));
7376
+ return nonEmpty.length > 0 ? `${base} (${nonEmpty.join("; ")})` : base;
7114
7377
  }
7115
- function resolveDiscordRejectedDeployEntriesSource(rawBody) {
7116
- if (!rawBody || typeof rawBody !== "object") return null;
7117
- const payload = rawBody;
7118
- const source = (payload.errors && typeof payload.errors === "object" ? payload.errors : void 0) ?? rawBody;
7119
- return source && typeof source === "object" ? source : null;
7378
+ function formatResolvedBase(input, target) {
7379
+ if (!target) return input;
7380
+ return input === target ? input : `${input}→${target}`;
7120
7381
  }
7121
- function readDiscordDeployObjectField(value, field) {
7122
- return value && typeof value === "object" && field in value ? value[field] : void 0;
7382
+ function formatAliasSummary(aliases) {
7383
+ if (aliases.length === 0) return;
7384
+ const preview = aliases.slice(0, 3).join(", ");
7385
+ if (aliases.length <= 3) return preview;
7386
+ return `${preview}, +${aliases.length - 3} more`;
7123
7387
  }
7124
- function readFiniteNumber(value) {
7125
- if (typeof value === "number" && Number.isFinite(value)) return value;
7126
- if (typeof value === "string" && value.trim().length > 0) return parseStrictFiniteNumber(value);
7388
+ function formatDiscordChannelResolvedGroup(entry) {
7389
+ const aliasSummary = formatAliasSummary(entry.aliases);
7390
+ return formatResolutionLogDetails(entry.target, [
7391
+ entry.guildName ? `guild:${entry.guildName}` : void 0,
7392
+ entry.channelName ? `channel:${entry.channelName}` : void 0,
7393
+ entry.note,
7394
+ aliasSummary ? `aliases:${aliasSummary}` : void 0
7395
+ ]);
7127
7396
  }
7128
- function readNonNegativeInteger(value) {
7129
- return parseStrictNonNegativeInteger(value);
7397
+ function formatDiscordChannelUnresolved(entry) {
7398
+ return formatResolutionLogDetails(entry.input, [
7399
+ entry.guildName ? `guild:${entry.guildName}` : entry.guildId ? `guildId:${entry.guildId}` : void 0,
7400
+ entry.channelName ? `channel:${entry.channelName}` : entry.channelId ? `channelId:${entry.channelId}` : void 0,
7401
+ entry.note
7402
+ ]);
7130
7403
  }
7131
- function isAbortLikeError(err) {
7132
- if (!err || typeof err !== "object") return false;
7133
- const name = "name" in err && typeof err.name === "string" ? err.name : void 0;
7134
- const message = formatErrorMessage$1(err);
7135
- return name === "AbortError" || message === "This operation was aborted" || message === "The operation was aborted" || /\boperation was aborted\b/i.test(message);
7404
+ function formatDiscordUserResolved(entry) {
7405
+ const displayName = entry.name?.trim();
7406
+ const target = displayName || entry.id;
7407
+ const formatted = formatResolutionLogDetails(formatResolvedBase(entry.input, target), [
7408
+ displayName && entry.id && entry.id !== entry.input ? `id:${entry.id}` : void 0,
7409
+ entry.guildName ? `guild:${entry.guildName}` : void 0,
7410
+ entry.note
7411
+ ]);
7412
+ return formatted === entry.input ? null : formatted;
7136
7413
  }
7137
- function formatDiscordDeployRestOperation(err) {
7138
- const method = typeof err.deployRestMethod === "string" && err.deployRestMethod.trim().length > 0 ? err.deployRestMethod.toUpperCase() : void 0;
7139
- const path = typeof err.deployRestPath === "string" && err.deployRestPath.trim().length > 0 ? err.deployRestPath : void 0;
7140
- if (method && path) return `${method} ${path}`;
7141
- if (method) return method;
7142
- if (path) return path;
7143
- return "request";
7414
+ function formatDiscordUserUnresolved(entry) {
7415
+ return formatResolutionLogDetails(entry.input, [
7416
+ entry.name ? `name:${entry.name}` : void 0,
7417
+ entry.guildName ? `guild:${entry.guildName}` : void 0,
7418
+ entry.note
7419
+ ]);
7144
7420
  }
7145
- function formatDiscordDeployErrorMessage(err) {
7146
- if (!isAbortLikeError(err)) return formatErrorMessage$1(err);
7147
- const deployErr = err && typeof err === "object" ? err : {};
7148
- const requestMs = readFiniteNumber(deployErr.deployRequestMs);
7149
- const timeoutMs = readFiniteNumber(deployErr.deployTimeoutMs);
7150
- const operation = formatDiscordDeployRestOperation(deployErr);
7151
- if (!(requestMs !== void 0 || timeoutMs !== void 0 || deployErr.deployRestMethod !== void 0 || deployErr.deployRestPath !== void 0)) return "Discord REST request was aborted";
7152
- const timing = [];
7153
- if (timeoutMs !== void 0) timing.push(`timeout=${formatDurationSeconds(timeoutMs, { decimals: timeoutMs >= 1e3 ? 1 : 0 })}`);
7154
- if (requestMs !== void 0) timing.push(`observed=${formatDurationSeconds(requestMs, { decimals: requestMs >= 1e3 ? 1 : 0 })}`);
7155
- const timingText = timing.length > 0 ? ` (${timing.join(", ")})` : "";
7156
- if (timeoutMs !== void 0 && requestMs !== void 0 && requestMs >= timeoutMs) return `Discord REST ${operation} timed out${timingText}`;
7157
- return `Discord REST ${operation} was aborted${timingText}`;
7421
+ function toGuildEntries(value) {
7422
+ if (!value || typeof value !== "object") return {};
7423
+ const out = {};
7424
+ for (const [key, entry] of Object.entries(value)) {
7425
+ if (!entry || typeof entry !== "object") continue;
7426
+ out[key] = entry;
7427
+ }
7428
+ return out;
7158
7429
  }
7159
- function resolveDiscordDeployRateLimitDetails(err) {
7160
- if (!err || typeof err !== "object") return;
7161
- const deployErr = err;
7162
- const status = readNonNegativeInteger(deployErr.status) ?? readNonNegativeInteger(deployErr.statusCode);
7163
- const retryAfterSeconds = readFiniteNumber(deployErr.retryAfter) ?? readFiniteNumber(readDiscordDeployObjectField(deployErr.rawBody, "retry_after"));
7164
- if (!(err instanceof RateLimitError || status === 429 || retryAfterSeconds !== void 0)) return;
7165
- const rawGlobal = readDiscordDeployObjectField(deployErr.rawBody, "global");
7166
- const scope = typeof deployErr.scope === "string" && deployErr.scope.trim().length > 0 ? deployErr.scope : rawGlobal === true ? "global" : rawGlobal === false ? "route" : void 0;
7167
- const discordCode = typeof deployErr.discordCode === "number" || typeof deployErr.discordCode === "string" ? deployErr.discordCode : void 0;
7168
- return {
7169
- status,
7170
- retryAfterMs: retryAfterSeconds === void 0 ? void 0 : Math.max(0, retryAfterSeconds * 1e3),
7171
- scope,
7172
- discordCode
7173
- };
7430
+ function toAllowlistEntries(value) {
7431
+ if (!Array.isArray(value)) return;
7432
+ return normalizeStringEntries(value);
7174
7433
  }
7175
- function formatDiscordDeployRateLimitDetails(err) {
7176
- const rateLimit = resolveDiscordDeployRateLimitDetails(err);
7177
- if (!rateLimit) return "";
7178
- const details = [];
7179
- if (typeof rateLimit.status === "number") details.push(`status=${rateLimit.status}`);
7180
- if (typeof rateLimit.retryAfterMs === "number") details.push(`retryAfter=${formatDurationSeconds(rateLimit.retryAfterMs, { decimals: 1 })}`);
7181
- if (rateLimit.scope) details.push(`scope=${rateLimit.scope}`);
7182
- if (typeof rateLimit.discordCode === "number" || typeof rateLimit.discordCode === "string") details.push(`code=${rateLimit.discordCode}`);
7183
- return details.length > 0 ? ` (${details.join(", ")})` : "";
7434
+ function hasGuildEntries(value) {
7435
+ return Object.keys(value).length > 0;
7184
7436
  }
7185
- function formatDiscordDeployRateLimitWarning(err, accountId) {
7186
- const rateLimit = resolveDiscordDeployRateLimitDetails(err);
7187
- if (!rateLimit) return;
7188
- const parts = [`[${accountId}] slash command deploy rate limited`];
7189
- if (typeof rateLimit.retryAfterMs === "number") parts.push(`retry after ${formatDurationSeconds(rateLimit.retryAfterMs, { decimals: 1 })}`);
7190
- if (rateLimit.scope) parts.push(`scope=${rateLimit.scope}`);
7191
- if (typeof rateLimit.discordCode === "number" || typeof rateLimit.discordCode === "string") parts.push(`code=${rateLimit.discordCode}`);
7192
- return `${parts.join("; ")}. Existing slash commands stay active. Message send/receive is unaffected.`;
7437
+ function collectChannelResolutionInputs(guildEntries) {
7438
+ const entries = [];
7439
+ for (const [guildKey, guildCfg] of Object.entries(guildEntries)) {
7440
+ if (guildKey === "*") continue;
7441
+ const channels = guildCfg?.channels ?? {};
7442
+ const channelKeys = Object.keys(channels).filter((key) => key !== "*");
7443
+ if (channelKeys.length === 0) {
7444
+ const input = /^\d+$/.test(guildKey) ? `guild:${guildKey}` : guildKey;
7445
+ entries.push({
7446
+ input,
7447
+ guildKey
7448
+ });
7449
+ continue;
7450
+ }
7451
+ for (const channelKey of channelKeys) entries.push({
7452
+ input: `${guildKey}/${channelKey}`,
7453
+ guildKey,
7454
+ channelKey
7455
+ });
7456
+ }
7457
+ return entries;
7193
7458
  }
7194
- function formatDiscordRejectedDeployEntries(params) {
7195
- const requestBody = Array.isArray(params.requestBody) ? params.requestBody : null;
7196
- const rejectedEntriesSource = resolveDiscordRejectedDeployEntriesSource(params.rawBody);
7197
- if (!rejectedEntriesSource || !requestBody || requestBody.length === 0) return [];
7198
- return Object.entries(rejectedEntriesSource).filter(([key]) => /^\d+$/.test(key)).slice(0, DISCORD_DEPLOY_REJECTED_ENTRY_LIMIT).flatMap(([key, value]) => {
7199
- const index = Number.parseInt(key, 10);
7200
- if (!Number.isFinite(index) || index < 0 || index >= requestBody.length) return [];
7201
- const command = requestBody[index];
7202
- if (!command || typeof command !== "object") return [`#${index} fields=${readDiscordDeployRejectedFields(value).join("|") || "unknown"}`];
7203
- const payload = command;
7204
- const parts = [`#${index}`, `fields=${readDiscordDeployRejectedFields(value).join("|") || "unknown"}`];
7205
- if (typeof payload.name === "string" && payload.name.trim().length > 0) parts.push(`name=${payload.name}`);
7206
- if (payload.description !== void 0) parts.push(`description=${stringifyDiscordDeployField(payload.description)}`);
7207
- if (Array.isArray(payload.options) && payload.options.length > 0) parts.push(`options=${payload.options.length}`);
7208
- return [parts.join(" ")];
7209
- });
7459
+ async function resolveGuildEntriesByChannelAllowlist(params) {
7460
+ const entries = collectChannelResolutionInputs(params.guildEntries);
7461
+ if (entries.length === 0) return params.guildEntries;
7462
+ try {
7463
+ const resolved = await resolveDiscordChannelAllowlist({
7464
+ token: params.token,
7465
+ entries: entries.map((entry) => entry.input),
7466
+ fetcher: params.fetcher
7467
+ });
7468
+ const sourceByInput = new Map(entries.map((entry) => [entry.input, entry]));
7469
+ const nextGuilds = { ...params.guildEntries };
7470
+ const mappingByTarget = /* @__PURE__ */ new Map();
7471
+ const unresolved = [];
7472
+ for (const entry of resolved) {
7473
+ const source = sourceByInput.get(entry.input);
7474
+ if (!source) continue;
7475
+ const sourceGuild = params.guildEntries[source.guildKey] ?? {};
7476
+ if (!entry.resolved || !entry.guildId) {
7477
+ unresolved.push(formatDiscordChannelUnresolved(entry));
7478
+ continue;
7479
+ }
7480
+ const target = entry.channelId ? `${entry.guildId}/${entry.channelId}` : entry.guildId;
7481
+ const existingGroup = mappingByTarget.get(target) ?? {
7482
+ target,
7483
+ aliases: [],
7484
+ guildName: entry.guildName,
7485
+ channelName: entry.channelName,
7486
+ note: entry.note
7487
+ };
7488
+ if (entry.input !== target && !existingGroup.aliases.includes(entry.input)) existingGroup.aliases.push(entry.input);
7489
+ if (!existingGroup.guildName && entry.guildName) existingGroup.guildName = entry.guildName;
7490
+ if (!existingGroup.channelName && entry.channelName) existingGroup.channelName = entry.channelName;
7491
+ if (!existingGroup.note && entry.note) existingGroup.note = entry.note;
7492
+ mappingByTarget.set(target, existingGroup);
7493
+ const existing = nextGuilds[entry.guildId] ?? {};
7494
+ const mergedChannels = {
7495
+ ...sourceGuild.channels,
7496
+ ...existing.channels
7497
+ };
7498
+ const mergedGuild = {
7499
+ ...sourceGuild,
7500
+ ...existing,
7501
+ channels: mergedChannels
7502
+ };
7503
+ nextGuilds[entry.guildId] = mergedGuild;
7504
+ if (source.channelKey && entry.channelId) {
7505
+ const sourceChannel = sourceGuild.channels?.[source.channelKey];
7506
+ if (sourceChannel) nextGuilds[entry.guildId] = {
7507
+ ...mergedGuild,
7508
+ channels: {
7509
+ ...mergedChannels,
7510
+ [entry.channelId]: {
7511
+ ...sourceChannel,
7512
+ ...mergedChannels[entry.channelId]
7513
+ }
7514
+ }
7515
+ };
7516
+ }
7517
+ }
7518
+ summarizeMapping("discord channels", [...mappingByTarget.values()].map((group) => formatDiscordChannelResolvedGroup(group)), unresolved, params.runtime);
7519
+ return nextGuilds;
7520
+ } catch (err) {
7521
+ params.runtime.log?.(`discord channel resolve failed; using config entries. ${formatErrorMessage$1(err)}`);
7522
+ return params.guildEntries;
7523
+ }
7210
7524
  }
7211
- function isRedundantDiscordDeployBody(rawBody) {
7212
- if (!rawBody || typeof rawBody !== "object" || Array.isArray(rawBody)) return false;
7213
- const keys = Object.keys(rawBody);
7214
- return keys.length > 0 && keys.every((key) => key === "message" || key === "code");
7525
+ async function resolveAllowFromByUserAllowlist(params) {
7526
+ const allowEntries = normalizeStringEntries(params.allowFrom).filter((entry) => entry !== "*");
7527
+ if (allowEntries.length === 0) return params.allowFrom;
7528
+ try {
7529
+ const { resolvedMap, mapping, unresolved } = buildAllowlistResolutionSummary(await resolveDiscordUserAllowlist({
7530
+ token: params.token,
7531
+ entries: allowEntries,
7532
+ fetcher: params.fetcher
7533
+ }), {
7534
+ formatResolved: formatDiscordUserResolved,
7535
+ formatUnresolved: formatDiscordUserUnresolved
7536
+ });
7537
+ const allowFrom = canonicalizeAllowlistWithResolvedIds({
7538
+ existing: params.allowFrom,
7539
+ resolvedMap
7540
+ });
7541
+ summarizeMapping("discord users", mapping, unresolved, params.runtime);
7542
+ return allowFrom;
7543
+ } catch (err) {
7544
+ params.runtime.log?.(`discord user resolve failed; using config entries. ${formatErrorMessage$1(err)}`);
7545
+ return params.allowFrom;
7546
+ }
7215
7547
  }
7216
- function formatDiscordDeployErrorDetails(err) {
7217
- if (!err || typeof err !== "object") return "";
7218
- const rateLimitDetails = formatDiscordDeployRateLimitDetails(err);
7219
- if (rateLimitDetails) return rateLimitDetails;
7220
- const status = err.status;
7221
- const discordCode = err.discordCode;
7222
- const rawBody = err.rawBody;
7223
- const requestBody = err.deployRequestBody;
7224
- const details = [];
7225
- if (typeof status === "number") details.push(`status=${status}`);
7226
- if (typeof discordCode === "number" || typeof discordCode === "string") details.push(`code=${discordCode}`);
7227
- if (rawBody !== void 0 && !isRedundantDiscordDeployBody(rawBody)) {
7228
- let bodyText;
7229
- try {
7230
- bodyText = JSON.stringify(rawBody);
7231
- } catch {
7232
- bodyText = typeof rawBody === "string" ? rawBody : inspect(rawBody, {
7233
- depth: 3,
7234
- breakLength: 120
7548
+ function collectGuildUserEntries(guildEntries) {
7549
+ const userEntries = /* @__PURE__ */ new Set();
7550
+ for (const guild of Object.values(guildEntries)) {
7551
+ if (!guild || typeof guild !== "object") continue;
7552
+ addAllowlistUserEntriesFromConfigEntry(userEntries, guild);
7553
+ const channels = guild.channels ?? {};
7554
+ for (const channel of Object.values(channels)) addAllowlistUserEntriesFromConfigEntry(userEntries, channel);
7555
+ }
7556
+ return userEntries;
7557
+ }
7558
+ async function resolveGuildEntriesByUserAllowlist(params) {
7559
+ const userEntries = collectGuildUserEntries(params.guildEntries);
7560
+ if (userEntries.size === 0) return params.guildEntries;
7561
+ try {
7562
+ const { resolvedMap, mapping, unresolved } = buildAllowlistResolutionSummary(await resolveDiscordUserAllowlist({
7563
+ token: params.token,
7564
+ entries: Array.from(userEntries),
7565
+ fetcher: params.fetcher
7566
+ }), {
7567
+ formatResolved: formatDiscordUserResolved,
7568
+ formatUnresolved: formatDiscordUserUnresolved
7569
+ });
7570
+ const nextGuilds = { ...params.guildEntries };
7571
+ for (const [guildKey, guildConfig] of Object.entries(params.guildEntries)) {
7572
+ if (!guildConfig || typeof guildConfig !== "object") continue;
7573
+ const nextGuild = { ...guildConfig };
7574
+ const users = guildConfig.users;
7575
+ if (Array.isArray(users) && users.length > 0) nextGuild.users = canonicalizeAllowlistWithResolvedIds({
7576
+ existing: users,
7577
+ resolvedMap
7235
7578
  });
7579
+ const channels = guildConfig.channels ?? {};
7580
+ if (channels && typeof channels === "object") nextGuild.channels = patchAllowlistUsersInConfigEntries({
7581
+ entries: channels,
7582
+ resolvedMap,
7583
+ strategy: "canonicalize"
7584
+ });
7585
+ nextGuilds[guildKey] = nextGuild;
7236
7586
  }
7237
- if (bodyText) {
7238
- const maxLen = 800;
7239
- const trimmed = bodyText.length > maxLen ? `${truncateUtf16Safe(bodyText, maxLen)}...` : bodyText;
7240
- details.push(`body=${trimmed}`);
7241
- }
7587
+ summarizeMapping("discord channel users", mapping, unresolved, params.runtime);
7588
+ return nextGuilds;
7589
+ } catch (err) {
7590
+ params.runtime.log?.(`discord channel user resolve failed; using config entries. ${formatErrorMessage$1(err)}`);
7591
+ return params.guildEntries;
7242
7592
  }
7243
- const rejectedEntries = formatDiscordRejectedDeployEntries({
7244
- rawBody,
7245
- requestBody
7246
- });
7247
- if (rejectedEntries.length > 0) details.push(`rejected=${rejectedEntries.join("; ")}`);
7248
- return details.length > 0 ? ` (${details.join(", ")})` : "";
7249
7593
  }
7250
- function isDiscordDeployDailyCreateLimit(err) {
7251
- if (!err || typeof err !== "object") return false;
7252
- const deployErr = err;
7253
- const discordCode = readNonNegativeInteger(deployErr.discordCode);
7254
- const rawCode = readNonNegativeInteger(readDiscordDeployObjectField(deployErr.rawBody, "code"));
7255
- return (discordCode === 30034 || rawCode === 30034) && /daily application command creates/i.test(formatErrorMessage$1(err));
7594
+ async function resolveDiscordAllowlistConfig(params) {
7595
+ let guildEntries = toGuildEntries(params.guildEntries);
7596
+ let allowFrom = toAllowlistEntries(params.allowFrom);
7597
+ if (hasGuildEntries(guildEntries)) guildEntries = await resolveGuildEntriesByChannelAllowlist({
7598
+ token: params.token,
7599
+ guildEntries,
7600
+ fetcher: params.fetcher,
7601
+ runtime: params.runtime
7602
+ });
7603
+ if (isDangerousNameMatchingEnabled(params.discordConfig)) {
7604
+ allowFrom = await resolveAllowFromByUserAllowlist({
7605
+ token: params.token,
7606
+ allowFrom,
7607
+ fetcher: params.fetcher,
7608
+ runtime: params.runtime
7609
+ });
7610
+ if (hasGuildEntries(guildEntries)) guildEntries = await resolveGuildEntriesByUserAllowlist({
7611
+ token: params.token,
7612
+ guildEntries,
7613
+ fetcher: params.fetcher,
7614
+ runtime: params.runtime
7615
+ });
7616
+ }
7617
+ return {
7618
+ guildEntries: hasGuildEntries(guildEntries) ? guildEntries : void 0,
7619
+ allowFrom
7620
+ };
7256
7621
  }
7257
7622
  //#endregion
7258
- //#region extensions/discord/src/monitor/provider.startup-log.ts
7259
- function formatDiscordStartupGatewayState(gateway) {
7260
- if (!gateway) return "gateway=missing";
7261
- const reconnectAttempts = gateway.reconnectAttempts;
7262
- return `gatewayConnected=${gateway.isConnected ? "true" : "false"} reconnectAttempts=${typeof reconnectAttempts === "number" ? reconnectAttempts : "na"}`;
7263
- }
7264
- function logDiscordStartupPhase$1(params) {
7265
- if (!(params.isVerbose ?? isVerbose)()) return;
7266
- const elapsedMs = Math.max(0, Date.now() - params.startAt);
7267
- const suffix = [params.details, formatDiscordStartupGatewayState(params.gateway)].filter((value) => Boolean(value)).join(" ");
7268
- params.runtime.log?.(`discord startup [${params.accountId}] ${params.phase} ${elapsedMs}ms${suffix ? ` ${suffix}` : ""}`);
7623
+ //#region extensions/discord/src/monitor/provider.cleanup.ts
7624
+ async function cleanupDiscordProviderStartup(params) {
7625
+ await params.deactivateMessageHandler?.();
7626
+ params.autoPresenceController?.stop();
7627
+ params.setStatus?.({ connected: false });
7628
+ if (params.onEarlyGatewayDebug) params.earlyGatewayEmitter?.removeListener("debug", params.onEarlyGatewayDebug);
7629
+ if (!params.lifecycleStarted) try {
7630
+ params.lifecycleGateway?.disconnect();
7631
+ } catch (err) {
7632
+ params.runtime.error?.(danger(`discord: failed to disconnect gateway during startup cleanup: ${String(err)}`));
7633
+ }
7634
+ params.gatewaySupervisor?.dispose();
7635
+ if (!params.lifecycleStarted) params.threadBindings.stop();
7269
7636
  }
7270
7637
  //#endregion
7271
- //#region extensions/discord/src/monitor/provider.deploy.ts
7272
- function readDeployRequestBody(data) {
7273
- return data && typeof data === "object" && "body" in data ? data.body : void 0;
7638
+ //#region extensions/discord/src/monitor/provider.commands.ts
7639
+ const loadPluginCommandSpecs = createLazyRuntimeNamedExport(() => import("openclaw/plugin-sdk/plugin-runtime"), "getPluginCommandSpecs");
7640
+ async function appendPluginCommandSpecs(params) {
7641
+ const merged = [...params.commandSpecs];
7642
+ const existingNames = new Set(normalizeStringEntriesLower(merged.map((spec) => spec.name)));
7643
+ const getPluginCommandSpecs = params.getPluginCommandSpecs ?? await loadPluginCommandSpecs();
7644
+ for (const pluginCommand of getPluginCommandSpecs("discord", { config: params.cfg })) {
7645
+ const normalizedName = normalizeLowercaseStringOrEmpty(pluginCommand.name);
7646
+ if (!normalizedName) continue;
7647
+ if (existingNames.has(normalizedName)) {
7648
+ params.runtime.error?.(danger(`discord: plugin command "/${normalizedName}" duplicates an existing native command. Skipping.`));
7649
+ continue;
7650
+ }
7651
+ existingNames.add(normalizedName);
7652
+ merged.push({
7653
+ name: pluginCommand.name,
7654
+ description: pluginCommand.description,
7655
+ acceptsArgs: pluginCommand.acceptsArgs
7656
+ });
7657
+ }
7658
+ return merged;
7274
7659
  }
7275
- function isDeployCommandsPath(path) {
7276
- return path.startsWith("/applications/") && path.includes("/commands");
7660
+ async function resolveDiscordProviderCommandSpecs(params) {
7661
+ const listSkillCommands = params.listSkillCommandsForAgents ?? listSkillCommandsForAgents;
7662
+ const listNativeCommandSpecs = params.listNativeCommandSpecsForConfig ?? listNativeCommandSpecsForConfig;
7663
+ const maxDiscordCommands = params.maxDiscordCommands ?? 100;
7664
+ let skillCommands = params.nativeEnabled && params.nativeSkillsEnabled ? listSkillCommands({ cfg: params.cfg }) : [];
7665
+ let commandSpecs = params.nativeEnabled ? listNativeCommandSpecs(params.cfg, {
7666
+ skillCommands,
7667
+ provider: "discord"
7668
+ }) : [];
7669
+ if (params.nativeEnabled) commandSpecs = await appendPluginCommandSpecs({
7670
+ commandSpecs,
7671
+ runtime: params.runtime,
7672
+ cfg: params.cfg,
7673
+ getPluginCommandSpecs: params.getPluginCommandSpecs
7674
+ });
7675
+ const initialCommandCount = commandSpecs.length;
7676
+ if (params.nativeEnabled && params.nativeSkillsEnabled && commandSpecs.length > maxDiscordCommands) {
7677
+ skillCommands = [];
7678
+ commandSpecs = listNativeCommandSpecs(params.cfg, {
7679
+ skillCommands: [],
7680
+ provider: "discord"
7681
+ });
7682
+ commandSpecs = await appendPluginCommandSpecs({
7683
+ commandSpecs,
7684
+ runtime: params.runtime,
7685
+ cfg: params.cfg,
7686
+ getPluginCommandSpecs: params.getPluginCommandSpecs
7687
+ });
7688
+ params.runtime.log?.(warn(`${initialCommandCount} commands exceed the ${maxDiscordCommands}-command Discord limit; removing per-skill commands and keeping /skill.`));
7689
+ }
7690
+ if (params.nativeEnabled && commandSpecs.length > maxDiscordCommands) params.runtime.log?.(warn(`${commandSpecs.length} commands exceed the ${maxDiscordCommands}-command Discord limit; some commands may fail to deploy.`));
7691
+ return {
7692
+ skillCommands,
7693
+ commandSpecs
7694
+ };
7695
+ }
7696
+ //#endregion
7697
+ //#region extensions/discord/src/monitor/provider.config-log.ts
7698
+ function formatThreadBindingDurationForConfigLabel(durationMs) {
7699
+ const label = formatThreadBindingDurationLabel(durationMs);
7700
+ return label === "disabled" ? "off" : label;
7701
+ }
7702
+ function logDiscordResolvedConfig(params) {
7703
+ const allowFromSummary = summarizeStringEntries({
7704
+ entries: params.allowFrom ?? [],
7705
+ limit: 4,
7706
+ emptyText: "any"
7707
+ });
7708
+ const groupDmChannelSummary = summarizeStringEntries({
7709
+ entries: params.groupDmChannels ?? [],
7710
+ limit: 4,
7711
+ emptyText: "any"
7712
+ });
7713
+ const guildSummary = summarizeStringEntries({
7714
+ entries: Object.keys(params.guildEntries ?? {}),
7715
+ limit: 4,
7716
+ emptyText: "any"
7717
+ });
7718
+ logVerbose(`discord: config dm=${params.dmEnabled ? "on" : "off"} dmPolicy=${params.dmPolicy} allowFrom=${allowFromSummary} groupDm=${params.groupDmEnabled ? "on" : "off"} groupDmChannels=${groupDmChannelSummary} groupPolicy=${params.groupPolicy} guilds=${guildSummary} historyLimit=${params.historyLimit} mediaMaxMb=${Math.round(params.mediaMaxBytes / (1024 * 1024))} native=${params.nativeEnabled ? "on" : "off"} nativeSkills=${params.nativeSkillsEnabled ? "on" : "off"} accessGroups=${params.useAccessGroups ? "on" : "off"} threadBindings=${params.threadBindingsEnabled ? "on" : "off"} threadIdleTimeout=${formatThreadBindingDurationForConfigLabel(params.threadBindingIdleTimeoutMs)} threadMaxAge=${formatThreadBindingDurationForConfigLabel(params.threadBindingMaxAgeMs)}`);
7719
+ }
7720
+ //#endregion
7721
+ //#region extensions/discord/src/monitor/provider.deploy-errors.ts
7722
+ const DISCORD_DEPLOY_REJECTED_ENTRY_LIMIT = 3;
7723
+ function attachDiscordDeployRequestBody(err, body) {
7724
+ if (!err || typeof err !== "object" || body === void 0) return;
7725
+ const deployErr = err;
7726
+ if (deployErr.deployRequestBody === void 0) deployErr.deployRequestBody = body;
7727
+ }
7728
+ function attachDiscordDeployRestContext(err, context) {
7729
+ if (!err || typeof err !== "object") return;
7730
+ const deployErr = err;
7731
+ deployErr.deployRestMethod = context.method;
7732
+ deployErr.deployRestPath = context.path;
7733
+ deployErr.deployRequestMs = context.requestMs;
7734
+ if (typeof context.timeoutMs === "number" && Number.isFinite(context.timeoutMs)) deployErr.deployTimeoutMs = context.timeoutMs;
7735
+ }
7736
+ function stringifyDiscordDeployField(value) {
7737
+ if (typeof value === "string") return JSON.stringify(value);
7738
+ try {
7739
+ return JSON.stringify(value);
7740
+ } catch {
7741
+ return inspect(value, {
7742
+ depth: 2,
7743
+ breakLength: 120
7744
+ });
7745
+ }
7746
+ }
7747
+ function readDiscordDeployRejectedFields(value) {
7748
+ if (Array.isArray(value)) return value.filter((entry) => typeof entry === "string").slice(0, 6);
7749
+ if (!value || typeof value !== "object") return [];
7750
+ return Object.keys(value).slice(0, 6);
7751
+ }
7752
+ function resolveDiscordRejectedDeployEntriesSource(rawBody) {
7753
+ if (!rawBody || typeof rawBody !== "object") return null;
7754
+ const payload = rawBody;
7755
+ const source = (payload.errors && typeof payload.errors === "object" ? payload.errors : void 0) ?? rawBody;
7756
+ return source && typeof source === "object" ? source : null;
7757
+ }
7758
+ function readDiscordDeployObjectField(value, field) {
7759
+ return value && typeof value === "object" && field in value ? value[field] : void 0;
7760
+ }
7761
+ function readFiniteNumber(value) {
7762
+ if (typeof value === "number" && Number.isFinite(value)) return value;
7763
+ if (typeof value === "string" && value.trim().length > 0) return parseStrictFiniteNumber(value);
7764
+ }
7765
+ function readNonNegativeInteger(value) {
7766
+ return parseStrictNonNegativeInteger(value);
7767
+ }
7768
+ function isAbortLikeError(err) {
7769
+ if (!err || typeof err !== "object") return false;
7770
+ const name = "name" in err && typeof err.name === "string" ? err.name : void 0;
7771
+ const message = formatErrorMessage$1(err);
7772
+ return name === "AbortError" || message === "This operation was aborted" || message === "The operation was aborted" || /\boperation was aborted\b/i.test(message);
7773
+ }
7774
+ function formatDiscordDeployRestOperation(err) {
7775
+ const method = typeof err.deployRestMethod === "string" && err.deployRestMethod.trim().length > 0 ? err.deployRestMethod.toUpperCase() : void 0;
7776
+ const path = typeof err.deployRestPath === "string" && err.deployRestPath.trim().length > 0 ? err.deployRestPath : void 0;
7777
+ if (method && path) return `${method} ${path}`;
7778
+ if (method) return method;
7779
+ if (path) return path;
7780
+ return "request";
7781
+ }
7782
+ function formatDiscordDeployErrorMessage(err) {
7783
+ if (!isAbortLikeError(err)) return formatErrorMessage$1(err);
7784
+ const deployErr = err && typeof err === "object" ? err : {};
7785
+ const requestMs = readFiniteNumber(deployErr.deployRequestMs);
7786
+ const timeoutMs = readFiniteNumber(deployErr.deployTimeoutMs);
7787
+ const operation = formatDiscordDeployRestOperation(deployErr);
7788
+ if (!(requestMs !== void 0 || timeoutMs !== void 0 || deployErr.deployRestMethod !== void 0 || deployErr.deployRestPath !== void 0)) return "Discord REST request was aborted";
7789
+ const timing = [];
7790
+ if (timeoutMs !== void 0) timing.push(`timeout=${formatDurationSeconds(timeoutMs, { decimals: timeoutMs >= 1e3 ? 1 : 0 })}`);
7791
+ if (requestMs !== void 0) timing.push(`observed=${formatDurationSeconds(requestMs, { decimals: requestMs >= 1e3 ? 1 : 0 })}`);
7792
+ const timingText = timing.length > 0 ? ` (${timing.join(", ")})` : "";
7793
+ if (timeoutMs !== void 0 && requestMs !== void 0 && requestMs >= timeoutMs) return `Discord REST ${operation} timed out${timingText}`;
7794
+ return `Discord REST ${operation} was aborted${timingText}`;
7795
+ }
7796
+ function resolveDiscordDeployRateLimitDetails(err) {
7797
+ if (!err || typeof err !== "object") return;
7798
+ const deployErr = err;
7799
+ const status = readNonNegativeInteger(deployErr.status) ?? readNonNegativeInteger(deployErr.statusCode);
7800
+ const retryAfterSeconds = readFiniteNumber(deployErr.retryAfter) ?? readFiniteNumber(readDiscordDeployObjectField(deployErr.rawBody, "retry_after"));
7801
+ if (!(err instanceof RateLimitError || status === 429 || retryAfterSeconds !== void 0)) return;
7802
+ const rawGlobal = readDiscordDeployObjectField(deployErr.rawBody, "global");
7803
+ const scope = typeof deployErr.scope === "string" && deployErr.scope.trim().length > 0 ? deployErr.scope : rawGlobal === true ? "global" : rawGlobal === false ? "route" : void 0;
7804
+ const discordCode = typeof deployErr.discordCode === "number" || typeof deployErr.discordCode === "string" ? deployErr.discordCode : void 0;
7805
+ return {
7806
+ status,
7807
+ retryAfterMs: retryAfterSeconds === void 0 ? void 0 : Math.max(0, retryAfterSeconds * 1e3),
7808
+ scope,
7809
+ discordCode
7810
+ };
7811
+ }
7812
+ function formatDiscordDeployRateLimitDetails(err) {
7813
+ const rateLimit = resolveDiscordDeployRateLimitDetails(err);
7814
+ if (!rateLimit) return "";
7815
+ const details = [];
7816
+ if (typeof rateLimit.status === "number") details.push(`status=${rateLimit.status}`);
7817
+ if (typeof rateLimit.retryAfterMs === "number") details.push(`retryAfter=${formatDurationSeconds(rateLimit.retryAfterMs, { decimals: 1 })}`);
7818
+ if (rateLimit.scope) details.push(`scope=${rateLimit.scope}`);
7819
+ if (typeof rateLimit.discordCode === "number" || typeof rateLimit.discordCode === "string") details.push(`code=${rateLimit.discordCode}`);
7820
+ return details.length > 0 ? ` (${details.join(", ")})` : "";
7821
+ }
7822
+ function formatDiscordDeployRateLimitWarning(err, accountId) {
7823
+ const rateLimit = resolveDiscordDeployRateLimitDetails(err);
7824
+ if (!rateLimit) return;
7825
+ const parts = [`[${accountId}] slash command deploy rate limited`];
7826
+ if (typeof rateLimit.retryAfterMs === "number") parts.push(`retry after ${formatDurationSeconds(rateLimit.retryAfterMs, { decimals: 1 })}`);
7827
+ if (rateLimit.scope) parts.push(`scope=${rateLimit.scope}`);
7828
+ if (typeof rateLimit.discordCode === "number" || typeof rateLimit.discordCode === "string") parts.push(`code=${rateLimit.discordCode}`);
7829
+ return `${parts.join("; ")}. Existing slash commands stay active. Message send/receive is unaffected.`;
7830
+ }
7831
+ function formatDiscordRejectedDeployEntries(params) {
7832
+ const requestBody = Array.isArray(params.requestBody) ? params.requestBody : null;
7833
+ const rejectedEntriesSource = resolveDiscordRejectedDeployEntriesSource(params.rawBody);
7834
+ if (!rejectedEntriesSource || !requestBody || requestBody.length === 0) return [];
7835
+ return Object.entries(rejectedEntriesSource).filter(([key]) => /^\d+$/.test(key)).slice(0, DISCORD_DEPLOY_REJECTED_ENTRY_LIMIT).flatMap(([key, value]) => {
7836
+ const index = Number.parseInt(key, 10);
7837
+ if (!Number.isFinite(index) || index < 0 || index >= requestBody.length) return [];
7838
+ const command = requestBody[index];
7839
+ if (!command || typeof command !== "object") return [`#${index} fields=${readDiscordDeployRejectedFields(value).join("|") || "unknown"}`];
7840
+ const payload = command;
7841
+ const parts = [`#${index}`, `fields=${readDiscordDeployRejectedFields(value).join("|") || "unknown"}`];
7842
+ if (typeof payload.name === "string" && payload.name.trim().length > 0) parts.push(`name=${payload.name}`);
7843
+ if (payload.description !== void 0) parts.push(`description=${stringifyDiscordDeployField(payload.description)}`);
7844
+ if (Array.isArray(payload.options) && payload.options.length > 0) parts.push(`options=${payload.options.length}`);
7845
+ return [parts.join(" ")];
7846
+ });
7847
+ }
7848
+ function isRedundantDiscordDeployBody(rawBody) {
7849
+ if (!rawBody || typeof rawBody !== "object" || Array.isArray(rawBody)) return false;
7850
+ const keys = Object.keys(rawBody);
7851
+ return keys.length > 0 && keys.every((key) => key === "message" || key === "code");
7852
+ }
7853
+ function formatDiscordDeployErrorDetails(err) {
7854
+ if (!err || typeof err !== "object") return "";
7855
+ const rateLimitDetails = formatDiscordDeployRateLimitDetails(err);
7856
+ if (rateLimitDetails) return rateLimitDetails;
7857
+ const status = err.status;
7858
+ const discordCode = err.discordCode;
7859
+ const rawBody = err.rawBody;
7860
+ const requestBody = err.deployRequestBody;
7861
+ const details = [];
7862
+ if (typeof status === "number") details.push(`status=${status}`);
7863
+ if (typeof discordCode === "number" || typeof discordCode === "string") details.push(`code=${discordCode}`);
7864
+ if (rawBody !== void 0 && !isRedundantDiscordDeployBody(rawBody)) {
7865
+ let bodyText;
7866
+ try {
7867
+ bodyText = JSON.stringify(rawBody);
7868
+ } catch {
7869
+ bodyText = typeof rawBody === "string" ? rawBody : inspect(rawBody, {
7870
+ depth: 3,
7871
+ breakLength: 120
7872
+ });
7873
+ }
7874
+ if (bodyText) {
7875
+ const maxLen = 800;
7876
+ const trimmed = bodyText.length > maxLen ? `${truncateUtf16Safe(bodyText, maxLen)}...` : bodyText;
7877
+ details.push(`body=${trimmed}`);
7878
+ }
7879
+ }
7880
+ const rejectedEntries = formatDiscordRejectedDeployEntries({
7881
+ rawBody,
7882
+ requestBody
7883
+ });
7884
+ if (rejectedEntries.length > 0) details.push(`rejected=${rejectedEntries.join("; ")}`);
7885
+ return details.length > 0 ? ` (${details.join(", ")})` : "";
7886
+ }
7887
+ function isDiscordDeployDailyCreateLimit(err) {
7888
+ if (!err || typeof err !== "object") return false;
7889
+ const deployErr = err;
7890
+ const discordCode = readNonNegativeInteger(deployErr.discordCode);
7891
+ const rawCode = readNonNegativeInteger(readDiscordDeployObjectField(deployErr.rawBody, "code"));
7892
+ return (discordCode === 30034 || rawCode === 30034) && /daily application command creates/i.test(formatErrorMessage$1(err));
7893
+ }
7894
+ //#endregion
7895
+ //#region extensions/discord/src/monitor/provider.startup-log.ts
7896
+ function formatDiscordStartupGatewayState(gateway) {
7897
+ if (!gateway) return "gateway=missing";
7898
+ const reconnectAttempts = gateway.reconnectAttempts;
7899
+ return `gatewayConnected=${gateway.isConnected ? "true" : "false"} reconnectAttempts=${typeof reconnectAttempts === "number" ? reconnectAttempts : "na"}`;
7900
+ }
7901
+ function logDiscordStartupPhase$1(params) {
7902
+ if (!(params.isVerbose ?? isVerbose)()) return;
7903
+ const elapsedMs = Math.max(0, Date.now() - params.startAt);
7904
+ const suffix = [params.details, formatDiscordStartupGatewayState(params.gateway)].filter((value) => Boolean(value)).join(" ");
7905
+ params.runtime.log?.(`discord startup [${params.accountId}] ${params.phase} ${elapsedMs}ms${suffix ? ` ${suffix}` : ""}`);
7906
+ }
7907
+ //#endregion
7908
+ //#region extensions/discord/src/monitor/provider.deploy.ts
7909
+ function readDeployRequestBody(data) {
7910
+ return data && typeof data === "object" && "body" in data ? data.body : void 0;
7911
+ }
7912
+ function isDeployCommandsPath(path) {
7913
+ return path.startsWith("/applications/") && path.includes("/commands");
7277
7914
  }
7278
7915
  function wrapDeployRestMethod(params) {
7279
7916
  return async (path, data, query) => {
@@ -7391,8 +8028,75 @@ function runDiscordCommandDeployInBackground(params) {
7391
8028
  });
7392
8029
  }
7393
8030
  //#endregion
7394
- //#region extensions/discord/src/voice/access.ts
7395
- async function authorizeDiscordVoiceIngress(params) {
8031
+ //#region extensions/discord/src/monitor/agent-components-reply.ts
8032
+ async function replySilently(interaction, params) {
8033
+ try {
8034
+ await interaction.reply(params);
8035
+ } catch {}
8036
+ }
8037
+ //#endregion
8038
+ //#region extensions/discord/src/activities/interaction.ts
8039
+ const REGISTRATION_WIDGET_ID = "AAAAAAAAAAAAAAAAAAAAAA";
8040
+ const PENDING_LAUNCH_WRITE_BUDGET_MS = 250;
8041
+ var DiscordActivityButton = class extends Button {
8042
+ constructor(ctx, deps) {
8043
+ super();
8044
+ this.ctx = ctx;
8045
+ this.deps = deps;
8046
+ this.label = "Open widget";
8047
+ this.customId = buildDiscordActivityCustomId(REGISTRATION_WIDGET_ID);
8048
+ this.customIdParser = parseDiscordActivityCustomIdForInteraction;
8049
+ this.pendingLaunchFailureLogged = false;
8050
+ }
8051
+ logPendingLaunchFailure(error) {
8052
+ if (this.pendingLaunchFailureLogged) return;
8053
+ this.pendingLaunchFailureLogged = true;
8054
+ this.deps.logError(`discord activity: failed to record pending launch: ${String(error)}`);
8055
+ }
8056
+ async run(interaction, data) {
8057
+ if (typeof data.widgetId !== "string") {
8058
+ await this.deps.reply(interaction, {
8059
+ content: "This widget is no longer valid.",
8060
+ ephemeral: true
8061
+ });
8062
+ return;
8063
+ }
8064
+ const runtime = getDiscordActivitiesRuntime();
8065
+ const channelId = interaction.rawData.channel_id;
8066
+ const discordUserId = interaction.userId;
8067
+ if (!runtime || !channelId || !discordUserId) this.logPendingLaunchFailure(/* @__PURE__ */ new Error("missing activity runtime or interaction identity"));
8068
+ else {
8069
+ const write = runtime.store.recordPendingLaunch({
8070
+ accountId: this.ctx.accountId,
8071
+ channelId,
8072
+ discordUserId,
8073
+ widgetId: data.widgetId,
8074
+ createdAt: Date.now()
8075
+ }).then(() => "written").catch((error) => {
8076
+ this.logPendingLaunchFailure(error);
8077
+ return "failed";
8078
+ });
8079
+ const timeout = new Promise((resolve) => {
8080
+ setTimeout(() => resolve("timeout"), PENDING_LAUNCH_WRITE_BUDGET_MS).unref?.();
8081
+ });
8082
+ if (await Promise.race([write, timeout]) === "timeout") this.logPendingLaunchFailure(/* @__PURE__ */ new Error(`pending launch write exceeded ${PENDING_LAUNCH_WRITE_BUDGET_MS}ms`));
8083
+ }
8084
+ await interaction.launchActivity();
8085
+ }
8086
+ };
8087
+ function createDiscordActivityButton(ctx, applicationId, deps = {}) {
8088
+ const runtime = getDiscordActivitiesRuntime();
8089
+ if (!runtime || !runtime.isAccountEnabled(ctx.accountId, ctx.cfg)) return null;
8090
+ if (applicationId) runtime.registerApplicationId(ctx.accountId, applicationId);
8091
+ if (!runtime.resolveAccount(ctx.accountId, ctx.cfg)) return null;
8092
+ return new DiscordActivityButton(ctx, {
8093
+ reply: deps.reply ?? replySilently,
8094
+ logError: deps.logError ?? logError
8095
+ });
8096
+ }
8097
+ //#endregion
8098
+ //#region extensions/discord/src/voice/access.ts
8099
+ async function authorizeDiscordVoiceIngress(params) {
7396
8100
  const groupPolicy = params.groupPolicy ?? resolveOpenProviderRuntimeGroupPolicy({
7397
8101
  providerConfigPresent: params.cfg.channels?.discord !== void 0,
7398
8102
  groupPolicy: params.discordConfig.groupPolicy,
@@ -7442,17 +8146,18 @@ async function authorizeDiscordVoiceIngress(params) {
7442
8146
  sender: params.sender,
7443
8147
  allowNameMatching: false
7444
8148
  });
7445
- const { ownerAllowList, ownerAllowed } = resolveDiscordOwnerAccess({
7446
- allowFrom: params.ownerAllowFrom ?? params.discordConfig.allowFrom ?? params.discordConfig.dm?.allowFrom,
7447
- sender: params.sender,
7448
- allowNameMatching: false
7449
- });
8149
+ const admissionAllowList = normalizeDiscordAllowList(params.admissionAllowFrom ?? params.discordConfig.allowFrom ?? params.discordConfig.dm?.allowFrom, [
8150
+ "discord:",
8151
+ "user:",
8152
+ "pk:"
8153
+ ]);
8154
+ const admissionAllowed = admissionAllowList ? allowListMatches(admissionAllowList, params.sender, { allowNameMatching: false }) : false;
7450
8155
  const useAccessGroups = params.useAccessGroups ?? params.cfg.commands?.useAccessGroups !== false;
7451
8156
  return resolveCommandAuthorizedFromAuthorizers({
7452
8157
  useAccessGroups,
7453
8158
  authorizers: useAccessGroups ? [{
7454
- configured: params.ownerAllowAll === true || ownerAllowList != null,
7455
- allowed: params.ownerAllowAll === true || ownerAllowed
8159
+ configured: admissionAllowList != null,
8160
+ allowed: admissionAllowed
7456
8161
  }, {
7457
8162
  configured: hasAccessRestrictions,
7458
8163
  allowed: memberAllowed
@@ -7471,17 +8176,19 @@ async function authorizeDiscordVoiceIngress(params) {
7471
8176
  }
7472
8177
  //#endregion
7473
8178
  //#region extensions/discord/src/voice/owner-access.ts
7474
- function resolveDiscordVoiceOwnerAccess(params) {
8179
+ function resolveDiscordVoiceAccess(params) {
7475
8180
  const commandOwnerAllowFrom = resolveDiscordCommandOwnerAllowFrom(params.cfg);
7476
8181
  if (commandOwnerAllowFrom) return {
8182
+ admissionAllowFrom: commandOwnerAllowFrom,
7477
8183
  ownerAllowFrom: commandOwnerAllowFrom,
7478
8184
  ownerAllowAll: commandOwnerAllowFrom.includes("*")
7479
8185
  };
7480
8186
  return {
7481
- ownerAllowFrom: resolveDiscordAccountAllowFrom({
8187
+ admissionAllowFrom: resolveDiscordAccountAllowFrom({
7482
8188
  cfg: params.cfg,
7483
8189
  accountId: params.accountId
7484
8190
  }) ?? params.discordConfig.allowFrom ?? params.discordConfig.dm?.allowFrom ?? [],
8191
+ ownerAllowFrom: [],
7485
8192
  ownerAllowAll: false
7486
8193
  };
7487
8194
  }
@@ -7512,7 +8219,7 @@ async function authorizeVoiceCommand(interaction, params, options) {
7512
8219
  author: user,
7513
8220
  member: interaction.rawData.member
7514
8221
  });
7515
- const ownerAccess = resolveDiscordVoiceOwnerAccess(params);
8222
+ const voiceAccess = resolveDiscordVoiceAccess(params);
7516
8223
  const access = await authorizeDiscordVoiceIngress({
7517
8224
  cfg: params.cfg,
7518
8225
  discordConfig: params.discordConfig,
@@ -7530,8 +8237,7 @@ async function authorizeVoiceCommand(interaction, params, options) {
7530
8237
  scope: channelContext.isThreadChannel ? "thread" : "channel",
7531
8238
  channelLabel: channelId ? formatMention({ channelId }) : "This channel",
7532
8239
  memberRoleIds,
7533
- ownerAllowFrom: ownerAccess.ownerAllowFrom,
7534
- ownerAllowAll: ownerAccess.ownerAllowAll,
8240
+ admissionAllowFrom: voiceAccess.admissionAllowFrom,
7535
8241
  sender: {
7536
8242
  id: sender.id,
7537
8243
  name: sender.name,
@@ -7822,13 +8528,6 @@ async function resolveComponentInteractionContext(params) {
7822
8528
  };
7823
8529
  }
7824
8530
  //#endregion
7825
- //#region extensions/discord/src/monitor/agent-components-reply.ts
7826
- async function replySilently(interaction, params) {
7827
- try {
7828
- await interaction.reply(params);
7829
- } catch {}
7830
- }
7831
- //#endregion
7832
8531
  //#region extensions/discord/src/monitor/agent-components-dm-auth.ts
7833
8532
  async function ensureDmComponentAuthorized(params) {
7834
8533
  const { ctx, interaction, user, componentLabel, replyOpts } = params;
@@ -8467,7 +9166,7 @@ async function deliverDiscordReply(params) {
8467
9166
  //#endregion
8468
9167
  //#region extensions/discord/src/monitor/agent-components.dispatch.ts
8469
9168
  const loadConversationRuntime$1 = createLazyRuntimeModule(() => import("./agent-components.runtime-CEPrf2SY.js"));
8470
- const loadTypingRuntime = createLazyRuntimeModule(() => import("./typing-BnYT7Szq.js").then((n) => n.n));
9169
+ const loadTypingRuntime = createLazyRuntimeModule(() => import("./typing-wxtm1NlF.js").then((n) => n.n));
8471
9170
  function buildDiscordComponentConversationLabel(params) {
8472
9171
  if (params.interactionCtx.isDirectMessage) return buildDirectLabel(params.interactionCtx.user);
8473
9172
  if (params.interactionCtx.isGroupDm) return `Group DM #${params.channelCtx.channelName ?? params.interactionCtx.channelId} channel id:${params.interactionCtx.channelId}`;
@@ -8576,7 +9275,7 @@ async function dispatchDiscordComponentEvent(params) {
8576
9275
  previousTimestamp,
8577
9276
  envelope: envelopeOptions
8578
9277
  });
8579
- const { createReplyReferencePlanner, dispatchReplyWithBufferedBlockDispatcher, finalizeInboundContext, resolveChunkMode, resolveTextChunkLimit, recordInboundSession } = await (async () => {
9278
+ const { createReplyReferencePlanner, finalizeInboundContext, resolveChunkMode, resolveTextChunkLimit } = await (async () => {
8580
9279
  return { ...await loadConversationRuntime$1() };
8581
9280
  })();
8582
9281
  const ctxPayload = finalizeInboundContext({
@@ -8652,12 +9351,11 @@ async function dispatchDiscordComponentEvent(params) {
8652
9351
  cfg: ctx.cfg,
8653
9352
  channel: "discord",
8654
9353
  accountId,
8655
- agentId,
8656
- routeSessionKey: sessionKey,
8657
- storePath,
9354
+ route: {
9355
+ agentId,
9356
+ sessionKey
9357
+ },
8658
9358
  ctxPayload,
8659
- recordInboundSession,
8660
- dispatchReplyWithBufferedBlockDispatcher,
8661
9359
  record: {
8662
9360
  updateLastRoute: interactionCtx.isDirectMessage ? {
8663
9361
  sessionKey: inboundLastRouteSessionKey,
@@ -8880,7 +9578,7 @@ async function dispatchPluginDiscordInteractiveEvent(params) {
8880
9578
  }
8881
9579
  //#endregion
8882
9580
  //#region extensions/discord/src/monitor/agent-components.handlers.ts
8883
- const loadComponentsRuntime = createLazyRuntimeModule(() => import("./components-BVrfRS-F.js").then((n) => n.t));
9581
+ const loadComponentsRuntime = createLazyRuntimeModule(() => import("./outbound-session-route-M2bEY9tI.js").then((n) => n.n));
8884
9582
  async function handleDiscordComponentEvent(params) {
8885
9583
  const parsed = parseDiscordComponentData(params.data, resolveInteractionCustomId(params.interaction));
8886
9584
  if (!parsed) {
@@ -9372,769 +10070,388 @@ var DiscordComponentSelectControl = class extends BaseMessageInteractiveComponen
9372
10070
  await this.handlers.handleComponentEvent({
9373
10071
  ctx: this.ctx,
9374
10072
  interaction,
9375
- data,
9376
- componentLabel: this.spec.componentLabel,
9377
- label: this.spec.label,
9378
- values: interaction.values ?? []
9379
- });
9380
- }
9381
- };
9382
- var DiscordComponentButton = class extends Button {
9383
- constructor(ctx, handlers) {
9384
- super();
9385
- this.ctx = ctx;
9386
- this.handlers = handlers;
9387
- this.label = "component";
9388
- this.customId = "__openclaw_discord_component_button_wildcard__";
9389
- this.style = ButtonStyle.Primary;
9390
- this.customIdParser = parseDiscordComponentCustomIdForInteraction;
9391
- }
9392
- async run(interaction, data) {
9393
- if (parseDiscordComponentData(data, resolveInteractionCustomId(interaction))?.modalId) {
9394
- await this.handlers.handleModalTrigger({
9395
- ctx: this.ctx,
9396
- interaction,
9397
- data,
9398
- label: "discord component modal"
9399
- });
9400
- return;
9401
- }
9402
- await this.handlers.handleComponentEvent({
9403
- ctx: this.ctx,
9404
- interaction,
9405
- data,
9406
- componentLabel: "button",
9407
- label: "discord component button"
9408
- });
9409
- }
9410
- };
9411
- function createSelectControl(spec, ctx, handlers) {
9412
- return new DiscordComponentSelectControl(spec, ctx, handlers);
9413
- }
9414
- function bindSelectControl(spec) {
9415
- return (ctx, handlers) => createSelectControl(spec, ctx, handlers);
9416
- }
9417
- function createDiscordComponentButtonControl(ctx, handlers) {
9418
- return new DiscordComponentButton(ctx, handlers);
9419
- }
9420
- const createDiscordComponentStringSelectControl = bindSelectControl(SELECT_CONTROLS.string);
9421
- const createDiscordComponentUserSelectControl = bindSelectControl(SELECT_CONTROLS.user);
9422
- const createDiscordComponentRoleSelectControl = bindSelectControl(SELECT_CONTROLS.role);
9423
- const createDiscordComponentMentionableSelectControl = bindSelectControl(SELECT_CONTROLS.mentionable);
9424
- const createDiscordComponentChannelSelectControl = bindSelectControl(SELECT_CONTROLS.channel);
9425
- //#endregion
9426
- //#region extensions/discord/src/monitor/agent-components.ts
9427
- function bindDiscordComponentControl(createControl) {
9428
- return (ctx) => createControl(ctx, discordComponentControlHandlers);
9429
- }
9430
- const createDiscordComponentButton = bindDiscordComponentControl(createDiscordComponentButtonControl);
9431
- const createDiscordComponentStringSelect = bindDiscordComponentControl(createDiscordComponentStringSelectControl);
9432
- const createDiscordComponentUserSelect = bindDiscordComponentControl(createDiscordComponentUserSelectControl);
9433
- const createDiscordComponentRoleSelect = bindDiscordComponentControl(createDiscordComponentRoleSelectControl);
9434
- const createDiscordComponentMentionableSelect = bindDiscordComponentControl(createDiscordComponentMentionableSelectControl);
9435
- const createDiscordComponentChannelSelect = bindDiscordComponentControl(createDiscordComponentChannelSelectControl);
9436
- const createAgentComponentControls = [createAgentComponentButton, createAgentSelectMenu];
9437
- const createDiscordComponentControls = [
9438
- createDiscordComponentButton,
9439
- createDiscordComponentStringSelect,
9440
- createDiscordComponentUserSelect,
9441
- createDiscordComponentRoleSelect,
9442
- createDiscordComponentMentionableSelect,
9443
- createDiscordComponentChannelSelect
9444
- ];
9445
- function createDiscordComponentModal(ctx) {
9446
- return new DiscordComponentModal(ctx);
9447
- }
9448
- //#endregion
9449
- //#region extensions/discord/src/monitor/exec-approvals.ts
9450
- function resolveTerminalLabel(approval) {
9451
- if (approval.status === "allowed") return approval.decision === "allow-always" ? "Allowed always" : "Allowed once";
9452
- if (approval.status === "denied") return "Denied";
9453
- return approval.status === "expired" ? "Expired" : "Cancelled";
9454
- }
9455
- function buildTerminalPayload(params) {
9456
- const { approval } = params;
9457
- const label = resolveTerminalLabel(approval);
9458
- const accentColor = approval.status === "denied" ? "#ED4245" : approval.status === "allowed" ? "#57F287" : "#99AAB5";
9459
- return {
9460
- allowed_mentions: DISCORD_APPROVAL_ALLOWED_MENTIONS,
9461
- components: [new Container([
9462
- new TextDisplay(params.applied ? "## Approval resolved" : "## Approval already resolved"),
9463
- new TextDisplay(`Canonical result: **${label}**`),
9464
- new Separator({
9465
- divider: false,
9466
- spacing: "small"
9467
- }),
9468
- new TextDisplay(`-# ID: ${formatDiscordApprovalDisplayValue(approval.id)}`)
9469
- ], { accentColor })]
9470
- };
9471
- }
9472
- function isStructuredApprovalNotFoundError(err) {
9473
- if (!err || typeof err !== "object") return false;
9474
- const record = err;
9475
- if (record.gatewayCode === "APPROVAL_NOT_FOUND") return true;
9476
- return record.gatewayCode === "INVALID_REQUEST" && record.details?.reason === "APPROVAL_NOT_FOUND";
9477
- }
9478
- var ExecApprovalButton = class extends Button {
9479
- constructor(ctx) {
9480
- super();
9481
- this.ctx = ctx;
9482
- this.label = "execapproval";
9483
- this.customId = "execapproval:seed=1";
9484
- this.style = ButtonStyle.Primary;
9485
- }
9486
- async run(interaction, data) {
9487
- const parsed = parseExecApprovalData(data);
9488
- if (!parsed) {
9489
- try {
9490
- await interaction.reply({
9491
- content: "This approval is no longer valid.",
9492
- ephemeral: true
9493
- });
9494
- } catch {}
9495
- return;
9496
- }
9497
- const approvers = this.ctx.getApprovers();
9498
- const userId = interaction.userId;
9499
- if (!approvers.some((id) => id === userId)) {
9500
- try {
9501
- await interaction.reply({
9502
- content: "⛔ You are not authorized to approve requests.",
9503
- ephemeral: true
9504
- });
9505
- } catch {}
9506
- return;
9507
- }
9508
- const decisionLabel = parsed.action === "allow-once" ? "Allowed (once)" : parsed.action === "allow-always" ? "Allowed (always)" : "Denied";
9509
- try {
9510
- await interaction.acknowledge();
9511
- } catch {}
9512
- const result = await this.ctx.resolveApproval(parsed.approvalId, parsed.approvalKind, parsed.action);
9513
- if (!result.ok) {
9514
- try {
9515
- await interaction.followUp({
9516
- content: result.reason === "not-found" ? `That approval request is no longer pending. It may have expired or already been resolved.` : `Failed to submit approval decision for **${decisionLabel}**. The request may have expired or already been resolved.`,
9517
- ephemeral: true
9518
- });
9519
- } catch {}
9520
- return;
9521
- }
9522
- const terminalLabel = resolveTerminalLabel(result.resolution.approval);
9523
- let terminalized = false;
9524
- try {
9525
- await interaction.editReply(buildTerminalPayload({
9526
- approval: result.resolution.approval,
9527
- applied: result.resolution.applied
9528
- }));
9529
- terminalized = true;
9530
- } catch {}
9531
- if (!terminalized || !result.resolution.applied) try {
9532
- await interaction.followUp({
9533
- content: result.resolution.applied ? `Approval resolved: ${terminalLabel}.` : `This approval was already resolved: ${terminalLabel}.`,
9534
- ephemeral: true
9535
- });
9536
- } catch {}
9537
- }
9538
- };
9539
- function createExecApprovalButton(ctx) {
9540
- return new ExecApprovalButton(ctx);
9541
- }
9542
- function createDiscordExecApprovalButtonContext(params) {
9543
- return {
9544
- getApprovers: () => getDiscordExecApprovalApprovers({
9545
- cfg: params.cfg,
9546
- accountId: params.accountId,
9547
- configOverride: params.config
9548
- }),
9549
- resolveApproval: async (approvalId, approvalKind, decision) => {
9550
- try {
9551
- return {
9552
- ok: true,
9553
- resolution: await resolveApprovalOverGateway({
9554
- cfg: params.cfg,
9555
- approvalId,
9556
- approvalKind,
9557
- decision,
9558
- gatewayUrl: params.gatewayUrl,
9559
- clientDisplayName: `Discord approval (${params.accountId})`
9560
- })
9561
- };
9562
- } catch (err) {
9563
- return {
9564
- ok: false,
9565
- reason: isStructuredApprovalNotFoundError(err) ? "not-found" : "error"
9566
- };
9567
- }
9568
- }
9569
- };
9570
- }
9571
- //#endregion
9572
- //#region extensions/discord/src/monitor/provider.interactions.ts
9573
- function createDiscordProviderInteractionSurface(params) {
9574
- const createNativeCommand = params.createNativeCommand ?? createDiscordNativeCommand;
9575
- const commands = params.commandSpecs.map((spec) => createNativeCommand({
9576
- command: spec,
9577
- cfg: params.cfg,
9578
- discordConfig: params.discordConfig,
9579
- accountId: params.accountId,
9580
- sessionPrefix: params.sessionPrefix,
9581
- ephemeralDefault: params.ephemeralDefault,
9582
- threadBindings: params.threadBindings
9583
- }));
9584
- if (params.nativeEnabled && params.voiceEnabled) commands.push(createDiscordVoiceCommand({
9585
- cfg: params.cfg,
9586
- discordConfig: params.discordConfig,
9587
- accountId: params.accountId,
9588
- groupPolicy: params.groupPolicy,
9589
- useAccessGroups: params.useAccessGroups,
9590
- getManager: () => params.voiceManagerRef.current,
9591
- ephemeralDefault: params.ephemeralDefault
9592
- }));
9593
- const execApprovalsConfig = params.discordConfig.execApprovals ?? {};
9594
- const execApprovalsEnabled = isDiscordExecApprovalClientEnabled({
9595
- cfg: params.cfg,
9596
- accountId: params.accountId,
9597
- configOverride: execApprovalsConfig
9598
- });
9599
- const approvalActionsEnabled = getDiscordExecApprovalApprovers({
9600
- cfg: params.cfg,
9601
- accountId: params.accountId,
9602
- configOverride: execApprovalsConfig
9603
- }).length > 0;
9604
- if (execApprovalsEnabled) registerChannelRuntimeContext({
9605
- channelRuntime: params.channelRuntime,
9606
- channelId: "discord",
9607
- accountId: params.accountId,
9608
- capability: CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY,
9609
- context: {
9610
- token: params.token,
9611
- config: execApprovalsConfig
9612
- },
9613
- abortSignal: params.abortSignal
9614
- });
9615
- const components = [
9616
- createDiscordCommandArgFallbackButton({
9617
- cfg: params.cfg,
9618
- discordConfig: params.discordConfig,
9619
- accountId: params.accountId,
9620
- sessionPrefix: params.sessionPrefix,
9621
- threadBindings: params.threadBindings
9622
- }),
9623
- createDiscordModelPickerFallbackButton({
9624
- cfg: params.cfg,
9625
- discordConfig: params.discordConfig,
9626
- accountId: params.accountId,
9627
- sessionPrefix: params.sessionPrefix,
9628
- threadBindings: params.threadBindings
9629
- }),
9630
- createDiscordModelPickerFallbackSelect({
9631
- cfg: params.cfg,
9632
- discordConfig: params.discordConfig,
9633
- accountId: params.accountId,
9634
- sessionPrefix: params.sessionPrefix,
9635
- threadBindings: params.threadBindings
9636
- })
9637
- ];
9638
- const modals = [];
9639
- if (approvalActionsEnabled) components.push(createExecApprovalButton(createDiscordExecApprovalButtonContext({
9640
- cfg: params.cfg,
9641
- accountId: params.accountId,
9642
- config: execApprovalsConfig
9643
- })));
9644
- if ((params.discordConfig.agentComponents ?? {}).enabled ?? true) {
9645
- const componentContext = {
9646
- cfg: params.cfg,
9647
- discordConfig: params.discordConfig,
9648
- accountId: params.accountId,
9649
- guildEntries: params.guildEntries,
9650
- allowFrom: params.allowFrom,
9651
- dmPolicy: params.dmPolicy,
9652
- runtime: params.runtime,
9653
- token: params.token
9654
- };
9655
- components.push(...createAgentComponentControls.map((create) => create(componentContext)));
9656
- components.push(...createDiscordComponentControls.map((create) => create(componentContext)));
9657
- modals.push(createDiscordComponentModal(componentContext));
9658
- }
9659
- return {
9660
- commands,
9661
- components,
9662
- modals
9663
- };
9664
- }
9665
- //#endregion
9666
- //#region extensions/discord/src/gateway-logging.ts
9667
- const INFO_DEBUG_MARKERS = [
9668
- "Gateway websocket closed",
9669
- "Gateway reconnect scheduled in",
9670
- "Gateway forcing fresh IDENTIFY after"
9671
- ];
9672
- const shouldPromoteGatewayDebug = (message) => INFO_DEBUG_MARKERS.some((marker) => message.includes(marker));
9673
- const formatGatewayMetrics = (metrics) => {
9674
- if (metrics === null || metrics === void 0) return String(metrics);
9675
- if (typeof metrics === "string") return metrics;
9676
- if (typeof metrics === "number" || typeof metrics === "boolean" || typeof metrics === "bigint") return String(metrics);
9677
- try {
9678
- return JSON.stringify(metrics);
9679
- } catch {
9680
- return "[unserializable metrics]";
10073
+ data,
10074
+ componentLabel: this.spec.componentLabel,
10075
+ label: this.spec.label,
10076
+ values: interaction.values ?? []
10077
+ });
9681
10078
  }
9682
10079
  };
9683
- function attachDiscordGatewayLogging(params) {
9684
- const { emitter, runtime } = params;
9685
- if (!emitter) return () => {};
9686
- const onGatewayDebug = (msg) => {
9687
- const message = String(msg);
9688
- logVerbose(`discord gateway: ${message}`);
9689
- if (shouldPromoteGatewayDebug(message)) runtime.log?.(`discord gateway: ${message}`);
9690
- };
9691
- const onGatewayWarning = (warning) => {
9692
- logVerbose(`discord gateway warning: ${String(warning)}`);
9693
- };
9694
- const onGatewayMetrics = (metrics) => {
9695
- logVerbose(`discord gateway metrics: ${formatGatewayMetrics(metrics)}`);
9696
- };
9697
- emitter.on("debug", onGatewayDebug);
9698
- emitter.on("warning", onGatewayWarning);
9699
- emitter.on("metrics", onGatewayMetrics);
9700
- return () => {
9701
- emitter.removeListener("debug", onGatewayDebug);
9702
- emitter.removeListener("warning", onGatewayWarning);
9703
- emitter.removeListener("metrics", onGatewayMetrics);
9704
- };
9705
- }
9706
- //#endregion
9707
- //#region extensions/discord/src/monitor.gateway.ts
9708
- async function waitForDiscordGatewayStop(params) {
9709
- const { gateway, abortSignal } = params;
9710
- return await new Promise((resolve, reject) => {
9711
- let settled = false;
9712
- const cleanup = () => {
9713
- abortSignal?.removeEventListener("abort", onAbort);
9714
- params.gatewaySupervisor?.detachLifecycle();
9715
- };
9716
- const finishResolve = () => {
9717
- if (settled) return;
9718
- settled = true;
9719
- try {
9720
- gateway?.disconnect?.();
9721
- } finally {
9722
- cleanup();
9723
- resolve();
9724
- }
9725
- };
9726
- const finishReject = (err) => {
9727
- if (settled) return;
9728
- settled = true;
9729
- try {
9730
- gateway?.disconnect?.();
9731
- } finally {
9732
- cleanup();
9733
- reject(toLintErrorObject(err, "Non-Error rejection"));
9734
- }
9735
- };
9736
- const onAbort = () => {
9737
- finishResolve();
9738
- };
9739
- const onGatewayEvent = (event) => {
9740
- if ((params.onGatewayEvent?.(event) ?? "stop") === "stop") finishReject(new DiscordGatewayLifecycleError(event));
9741
- };
9742
- const onForceStop = (err) => {
9743
- finishReject(err);
9744
- };
9745
- if (abortSignal?.aborted) {
9746
- onAbort();
10080
+ var DiscordComponentButton = class extends Button {
10081
+ constructor(ctx, handlers) {
10082
+ super();
10083
+ this.ctx = ctx;
10084
+ this.handlers = handlers;
10085
+ this.label = "component";
10086
+ this.customId = "__openclaw_discord_component_button_wildcard__";
10087
+ this.style = ButtonStyle.Primary;
10088
+ this.customIdParser = parseDiscordComponentCustomIdForInteraction;
10089
+ }
10090
+ async run(interaction, data) {
10091
+ if (parseDiscordComponentData(data, resolveInteractionCustomId(interaction))?.modalId) {
10092
+ await this.handlers.handleModalTrigger({
10093
+ ctx: this.ctx,
10094
+ interaction,
10095
+ data,
10096
+ label: "discord component modal"
10097
+ });
9747
10098
  return;
9748
10099
  }
9749
- abortSignal?.addEventListener("abort", onAbort, { once: true });
9750
- params.gatewaySupervisor?.attachLifecycle(onGatewayEvent);
9751
- params.registerForceStop?.(onForceStop);
9752
- });
10100
+ await this.handlers.handleComponentEvent({
10101
+ ctx: this.ctx,
10102
+ interaction,
10103
+ data,
10104
+ componentLabel: "button",
10105
+ label: "discord component button"
10106
+ });
10107
+ }
10108
+ };
10109
+ function createSelectControl(spec, ctx, handlers) {
10110
+ return new DiscordComponentSelectControl(spec, ctx, handlers);
9753
10111
  }
9754
- function toLintErrorObject(value, fallbackMessage) {
9755
- if (value instanceof Error) return value;
9756
- if (typeof value === "string") return new Error(value);
9757
- const error = new Error(fallbackMessage, { cause: value });
9758
- if (typeof value === "object" && value !== null || typeof value === "function") Object.assign(error, value);
9759
- return error;
10112
+ function bindSelectControl(spec) {
10113
+ return (ctx, handlers) => createSelectControl(spec, ctx, handlers);
9760
10114
  }
9761
- //#endregion
9762
- //#region extensions/discord/src/monitor/provider.lifecycle.ts
9763
- const DEFAULT_DISCORD_GATEWAY_READY_TIMEOUT_MS = 15e3;
9764
- const DEFAULT_DISCORD_GATEWAY_RUNTIME_READY_TIMEOUT_MS = 3e4;
9765
- const MAX_DISCORD_GATEWAY_READY_TIMEOUT_MS = 12e4;
9766
- const DISCORD_GATEWAY_READY_TIMEOUT_ENV = "OPENCLAW_DISCORD_READY_TIMEOUT_MS";
9767
- const DISCORD_GATEWAY_RUNTIME_READY_TIMEOUT_ENV = "OPENCLAW_DISCORD_RUNTIME_READY_TIMEOUT_MS";
9768
- const DISCORD_GATEWAY_READY_POLL_MS = 250;
9769
- const DISCORD_GATEWAY_READY_RETRY_BACKOFF_MS = 2e3;
9770
- const DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS = 5e3;
9771
- const DISCORD_GATEWAY_STARTUP_TERMINATE_CLOSE_TIMEOUT_MS = 1e3;
9772
- const DISCORD_GATEWAY_TRANSPORT_ACTIVITY_STATUS_MIN_INTERVAL_MS = 3e4;
9773
- function normalizeGatewayReadyTimeoutMs(value) {
9774
- const numeric = parseStrictPositiveInteger(value);
9775
- if (numeric === void 0) return;
9776
- return Math.min(numeric, MAX_DISCORD_GATEWAY_READY_TIMEOUT_MS);
10115
+ function createDiscordComponentButtonControl(ctx, handlers) {
10116
+ return new DiscordComponentButton(ctx, handlers);
9777
10117
  }
9778
- function resolveDiscordGatewayReadyTimeoutMs(params) {
9779
- return normalizeGatewayReadyTimeoutMs(params?.configuredTimeoutMs) ?? normalizeGatewayReadyTimeoutMs(params?.env?.[DISCORD_GATEWAY_READY_TIMEOUT_ENV]) ?? DEFAULT_DISCORD_GATEWAY_READY_TIMEOUT_MS;
10118
+ const createDiscordComponentStringSelectControl = bindSelectControl(SELECT_CONTROLS.string);
10119
+ const createDiscordComponentUserSelectControl = bindSelectControl(SELECT_CONTROLS.user);
10120
+ const createDiscordComponentRoleSelectControl = bindSelectControl(SELECT_CONTROLS.role);
10121
+ const createDiscordComponentMentionableSelectControl = bindSelectControl(SELECT_CONTROLS.mentionable);
10122
+ const createDiscordComponentChannelSelectControl = bindSelectControl(SELECT_CONTROLS.channel);
10123
+ //#endregion
10124
+ //#region extensions/discord/src/monitor/agent-components.ts
10125
+ function bindDiscordComponentControl(createControl) {
10126
+ return (ctx) => createControl(ctx, discordComponentControlHandlers);
9780
10127
  }
9781
- function resolveDiscordGatewayRuntimeReadyTimeoutMs(params) {
9782
- return normalizeGatewayReadyTimeoutMs(params?.configuredTimeoutMs) ?? normalizeGatewayReadyTimeoutMs(params?.env?.[DISCORD_GATEWAY_RUNTIME_READY_TIMEOUT_ENV]) ?? DEFAULT_DISCORD_GATEWAY_RUNTIME_READY_TIMEOUT_MS;
10128
+ const createDiscordComponentButton = bindDiscordComponentControl(createDiscordComponentButtonControl);
10129
+ const createDiscordComponentStringSelect = bindDiscordComponentControl(createDiscordComponentStringSelectControl);
10130
+ const createDiscordComponentUserSelect = bindDiscordComponentControl(createDiscordComponentUserSelectControl);
10131
+ const createDiscordComponentRoleSelect = bindDiscordComponentControl(createDiscordComponentRoleSelectControl);
10132
+ const createDiscordComponentMentionableSelect = bindDiscordComponentControl(createDiscordComponentMentionableSelectControl);
10133
+ const createDiscordComponentChannelSelect = bindDiscordComponentControl(createDiscordComponentChannelSelectControl);
10134
+ const createAgentComponentControls = [createAgentComponentButton, createAgentSelectMenu];
10135
+ const createDiscordComponentControls = [
10136
+ createDiscordComponentButton,
10137
+ createDiscordComponentStringSelect,
10138
+ createDiscordComponentUserSelect,
10139
+ createDiscordComponentRoleSelect,
10140
+ createDiscordComponentMentionableSelect,
10141
+ createDiscordComponentChannelSelect
10142
+ ];
10143
+ function createDiscordComponentModal(ctx) {
10144
+ return new DiscordComponentModal(ctx);
9783
10145
  }
9784
- async function restartGatewayAfterReadyTimeout(params) {
9785
- if (!params.gateway || params.abortSignal?.aborted) return;
9786
- const socket = params.gateway.ws;
9787
- if (!socket) {
9788
- params.gateway.disconnect();
9789
- if (!params.abortSignal?.aborted) params.gateway.connect(false);
9790
- return;
9791
- }
9792
- await new Promise((resolve, reject) => {
9793
- let settled = false;
9794
- let drainTimeout;
9795
- let terminateCloseTimeout;
9796
- const ignoreSocketError = () => {};
9797
- const clearTimers = () => {
9798
- if (drainTimeout) {
9799
- clearTimeout(drainTimeout);
9800
- drainTimeout = void 0;
9801
- }
9802
- if (terminateCloseTimeout) {
9803
- clearTimeout(terminateCloseTimeout);
9804
- terminateCloseTimeout = void 0;
9805
- }
9806
- };
9807
- const cleanup = () => {
9808
- clearTimers();
9809
- socket.removeListener("close", onClose);
9810
- socket.removeListener("error", ignoreSocketError);
9811
- };
9812
- const finishResolve = () => {
9813
- if (settled) return;
9814
- settled = true;
9815
- cleanup();
9816
- resolve();
9817
- };
9818
- const finishReject = (error) => {
9819
- if (params.abortSignal?.aborted) {
9820
- finishResolve();
9821
- return;
9822
- }
9823
- if (settled) return;
9824
- settled = true;
9825
- cleanup();
9826
- reject(error);
9827
- };
9828
- const onClose = () => {
9829
- finishResolve();
9830
- };
9831
- socket.on("error", ignoreSocketError);
9832
- socket.on("close", onClose);
9833
- params.gateway?.disconnect();
9834
- drainTimeout = setTimeout(() => {
9835
- if (settled) return;
9836
- if (typeof socket.terminate !== "function") {
9837
- finishReject(/* @__PURE__ */ new Error(`discord gateway socket did not close within ${DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS}ms before restart`));
9838
- return;
9839
- }
9840
- params.runtime.error?.(danger(`discord: startup restart waiting on a stale gateway socket for ${DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS}ms; forcing terminate before reconnect`));
9841
- try {
9842
- socket.terminate();
9843
- } catch {
9844
- finishReject(/* @__PURE__ */ new Error(`discord gateway socket did not close within ${DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS}ms before restart`));
9845
- return;
9846
- }
9847
- terminateCloseTimeout = setTimeout(() => {
9848
- finishReject(/* @__PURE__ */ new Error(`discord gateway socket did not close within ${DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS}ms before restart`));
9849
- }, DISCORD_GATEWAY_STARTUP_TERMINATE_CLOSE_TIMEOUT_MS);
9850
- terminateCloseTimeout.unref?.();
9851
- }, DISCORD_GATEWAY_STARTUP_DISCONNECT_DRAIN_TIMEOUT_MS);
9852
- drainTimeout.unref?.();
9853
- });
9854
- if (!params.abortSignal?.aborted) params.gateway.connect(false);
10146
+ //#endregion
10147
+ //#region extensions/discord/src/monitor/exec-approvals.ts
10148
+ function resolveTerminalLabel(approval) {
10149
+ if (approval.status === "allowed") return approval.decision === "allow-always" ? "Allowed always" : "Allowed once";
10150
+ if (approval.status === "denied") return "Denied";
10151
+ return approval.status === "expired" ? "Expired" : "Cancelled";
9855
10152
  }
9856
- function parseGatewayCloseCode(message) {
9857
- const match = /Gateway websocket closed:\s*(\d{3,5})/.exec(message);
9858
- if (!match?.[1]) return;
9859
- const code = Number.parseInt(match[1], 10);
9860
- return Number.isFinite(code) ? code : void 0;
10153
+ function buildTerminalPayload(params) {
10154
+ const { approval } = params;
10155
+ const label = resolveTerminalLabel(approval);
10156
+ const accentColor = approval.status === "denied" ? "#ED4245" : approval.status === "allowed" ? "#57F287" : "#99AAB5";
10157
+ return {
10158
+ allowed_mentions: DISCORD_APPROVAL_ALLOWED_MENTIONS,
10159
+ components: [new Container([
10160
+ new TextDisplay(params.applied ? "## Approval resolved" : "## Approval already resolved"),
10161
+ new TextDisplay(`Canonical result: **${label}**`),
10162
+ new Separator({
10163
+ divider: false,
10164
+ spacing: "small"
10165
+ }),
10166
+ new TextDisplay(`-# ID: ${formatDiscordApprovalDisplayValue(approval.id)}`)
10167
+ ], { accentColor })]
10168
+ };
9861
10169
  }
9862
- function resolveTransportActivityAt(event) {
9863
- const at = event?.at;
9864
- const timestampMs = asDateTimestampMs(at);
9865
- return timestampMs !== void 0 && timestampMs >= 0 ? timestampMs : Date.now();
10170
+ function isStructuredApprovalNotFoundError(err) {
10171
+ if (!err || typeof err !== "object") return false;
10172
+ const record = err;
10173
+ if (record.gatewayCode === "APPROVAL_NOT_FOUND") return true;
10174
+ return record.gatewayCode === "INVALID_REQUEST" && record.details?.reason === "APPROVAL_NOT_FOUND";
9866
10175
  }
9867
- function createGatewayStatusObserver(params) {
9868
- let forceStopHandler;
9869
- let queuedForceStopError;
9870
- let readyPollId;
9871
- let readyTimeoutId;
9872
- const shouldStop = () => params.abortSignal?.aborted || params.isLifecycleStopping();
9873
- const clearReadyWatch = () => {
9874
- if (readyPollId) {
9875
- clearInterval(readyPollId);
9876
- readyPollId = void 0;
9877
- }
9878
- if (readyTimeoutId) {
9879
- clearTimeout(readyTimeoutId);
9880
- readyTimeoutId = void 0;
9881
- }
9882
- };
9883
- const triggerForceStop = (err) => {
9884
- if (forceStopHandler) {
9885
- forceStopHandler(err);
9886
- return;
9887
- }
9888
- queuedForceStopError = err;
9889
- };
9890
- const pushConnectedStatus = (at) => {
9891
- params.pushStatus({
9892
- ...createConnectedChannelStatusPatch(at),
9893
- lastDisconnect: null,
9894
- lastError: null
9895
- });
9896
- };
9897
- const startReadyWatch = () => {
9898
- clearReadyWatch();
9899
- const pollConnected = () => {
9900
- if (shouldStop()) {
9901
- clearReadyWatch();
9902
- return;
9903
- }
9904
- if (!params.gateway?.isConnected) return;
9905
- clearReadyWatch();
9906
- pushConnectedStatus(Date.now());
9907
- };
9908
- pollConnected();
9909
- if (!readyTimeoutId) {
9910
- readyPollId = setInterval(pollConnected, DISCORD_GATEWAY_READY_POLL_MS);
9911
- readyPollId.unref?.();
9912
- readyTimeoutId = setTimeout(() => {
9913
- clearReadyWatch();
9914
- if (shouldStop() || params.gateway?.isConnected) return;
9915
- const at = Date.now();
9916
- const error = /* @__PURE__ */ new Error(`discord gateway opened but did not reach READY within ${params.runtimeReadyTimeoutMs}ms`);
9917
- params.pushStatus({
9918
- connected: false,
9919
- lastEventAt: at,
9920
- lastDisconnect: {
9921
- at,
9922
- error: "runtime-not-ready"
9923
- },
9924
- lastError: "runtime-not-ready"
10176
+ var ExecApprovalButton = class extends Button {
10177
+ constructor(ctx) {
10178
+ super();
10179
+ this.ctx = ctx;
10180
+ this.label = "execapproval";
10181
+ this.customId = "execapproval:seed=1";
10182
+ this.style = ButtonStyle.Primary;
10183
+ }
10184
+ async run(interaction, data) {
10185
+ const parsed = parseExecApprovalData(data);
10186
+ if (!parsed) {
10187
+ try {
10188
+ await interaction.reply({
10189
+ content: "This approval is no longer valid.",
10190
+ ephemeral: true
9925
10191
  });
9926
- params.runtime.error?.(danger(error.message));
9927
- triggerForceStop(error);
9928
- }, params.runtimeReadyTimeoutMs);
9929
- readyTimeoutId.unref?.();
9930
- }
9931
- };
9932
- const onGatewayDebug = (msg) => {
9933
- if (shouldStop()) return;
9934
- const at = Date.now();
9935
- const message = String(msg);
9936
- if (message.includes("Gateway websocket opened")) {
9937
- params.pushStatus({
9938
- connected: false,
9939
- lastEventAt: at
9940
- });
9941
- startReadyWatch();
10192
+ } catch {}
9942
10193
  return;
9943
10194
  }
9944
- if (message.includes("Gateway websocket closed")) {
9945
- clearReadyWatch();
9946
- const code = parseGatewayCloseCode(message);
9947
- params.pushStatus({
9948
- connected: false,
9949
- lastEventAt: at,
9950
- lastDisconnect: {
9951
- at,
9952
- ...code !== void 0 ? { status: code } : {}
9953
- }
9954
- });
10195
+ const approvers = this.ctx.getApprovers();
10196
+ const userId = interaction.userId;
10197
+ if (!approvers.some((id) => id === userId)) {
10198
+ try {
10199
+ await interaction.reply({
10200
+ content: "⛔ You are not authorized to approve requests.",
10201
+ ephemeral: true
10202
+ });
10203
+ } catch {}
9955
10204
  return;
9956
10205
  }
9957
- if (message.includes("Gateway reconnect scheduled in")) {
9958
- clearReadyWatch();
9959
- params.pushStatus({
9960
- connected: false,
9961
- lastEventAt: at,
9962
- lastError: message
9963
- });
9964
- }
9965
- };
9966
- return {
9967
- onGatewayDebug,
9968
- clearReadyWatch,
9969
- registerForceStop: (handler) => {
9970
- forceStopHandler = handler;
9971
- if (queuedForceStopError !== void 0) {
9972
- const err = queuedForceStopError;
9973
- queuedForceStopError = void 0;
9974
- handler(err);
9975
- }
9976
- },
9977
- dispose: () => {
9978
- clearReadyWatch();
9979
- forceStopHandler = void 0;
9980
- queuedForceStopError = void 0;
9981
- }
9982
- };
9983
- }
9984
- async function waitForGatewayReady(params) {
9985
- const waitUntilReady = async () => {
9986
- const deadlineAt = Date.now() + params.readyTimeoutMs;
9987
- while (!params.abortSignal?.aborted) {
9988
- if (await params.beforePoll?.() === "stop") return "stopped";
9989
- if (params.gateway?.isConnected === true) {
9990
- const at = Date.now();
9991
- params.pushStatus?.({
9992
- ...createConnectedChannelStatusPatch(at),
9993
- lastDisconnect: null,
9994
- lastError: null
10206
+ const decisionLabel = parsed.action === "allow-once" ? "Allowed (once)" : parsed.action === "allow-always" ? "Allowed (always)" : "Denied";
10207
+ try {
10208
+ await interaction.acknowledge();
10209
+ } catch {}
10210
+ const result = await this.ctx.resolveApproval(parsed.approvalId, parsed.approvalKind, parsed.action);
10211
+ if (!result.ok) {
10212
+ try {
10213
+ await interaction.followUp({
10214
+ content: result.reason === "not-found" ? `That approval request is no longer pending. It may have expired or already been resolved.` : `Failed to submit approval decision for **${decisionLabel}**. The request may have expired or already been resolved.`,
10215
+ ephemeral: true
9995
10216
  });
9996
- return "ready";
9997
- }
9998
- if (Date.now() >= deadlineAt) return "timeout";
9999
- await new Promise((resolve) => {
10000
- setTimeout(resolve, DISCORD_GATEWAY_READY_POLL_MS).unref?.();
10001
- });
10217
+ } catch {}
10218
+ return;
10219
+ }
10220
+ const terminalLabel = resolveTerminalLabel(result.resolution.approval);
10221
+ let terminalized = false;
10222
+ try {
10223
+ await interaction.editReply(buildTerminalPayload({
10224
+ approval: result.resolution.approval,
10225
+ applied: result.resolution.applied
10226
+ }));
10227
+ terminalized = true;
10228
+ } catch {}
10229
+ if (!terminalized || !result.resolution.applied) try {
10230
+ await interaction.followUp({
10231
+ content: result.resolution.applied ? `Approval resolved: ${terminalLabel}.` : `This approval was already resolved: ${terminalLabel}.`,
10232
+ ephemeral: true
10233
+ });
10234
+ } catch {}
10235
+ }
10236
+ };
10237
+ function createExecApprovalButton(ctx) {
10238
+ return new ExecApprovalButton(ctx);
10239
+ }
10240
+ function createDiscordExecApprovalButtonContext(params) {
10241
+ return {
10242
+ getApprovers: () => getDiscordExecApprovalApprovers({
10243
+ cfg: params.cfg,
10244
+ accountId: params.accountId,
10245
+ configOverride: params.config
10246
+ }),
10247
+ resolveApproval: async (approvalId, approvalKind, decision) => {
10248
+ try {
10249
+ return {
10250
+ ok: true,
10251
+ resolution: await resolveApprovalOverGateway({
10252
+ cfg: params.cfg,
10253
+ approvalId,
10254
+ approvalKind,
10255
+ decision,
10256
+ gatewayUrl: params.gatewayUrl,
10257
+ clientDisplayName: `Discord approval (${params.accountId})`
10258
+ })
10259
+ };
10260
+ } catch (err) {
10261
+ return {
10262
+ ok: false,
10263
+ reason: isStructuredApprovalNotFoundError(err) ? "not-found" : "error"
10264
+ };
10265
+ }
10002
10266
  }
10003
- return "stopped";
10004
- };
10005
- if (!params.gateway) {
10006
- if (await waitUntilReady() === "timeout") throw new Error(`discord gateway did not reach READY within ${params.readyTimeoutMs}ms`);
10007
- return;
10008
- }
10009
- let attempt = 0;
10010
- while (!params.abortSignal?.aborted) {
10011
- if (await waitUntilReady() !== "timeout") return;
10012
- attempt += 1;
10013
- const restartAt = Date.now();
10014
- params.runtime.error?.(danger(`discord: gateway READY wait timed out after ${params.readyTimeoutMs}ms; reconnecting with backoff (attempt ${attempt})`));
10015
- params.pushStatus?.({
10016
- connected: false,
10017
- lastEventAt: restartAt,
10018
- lastDisconnect: {
10019
- at: restartAt,
10020
- error: "startup-not-ready"
10021
- },
10022
- lastError: "startup-not-ready"
10023
- });
10024
- await params.beforeRestart?.();
10025
- await restartGatewayAfterReadyTimeout({
10026
- gateway: params.gateway,
10027
- abortSignal: params.abortSignal,
10028
- runtime: params.runtime
10029
- });
10030
- if (params.abortSignal?.aborted) return;
10031
- await new Promise((resolve) => {
10032
- setTimeout(resolve, DISCORD_GATEWAY_READY_RETRY_BACKOFF_MS).unref?.();
10033
- });
10034
- }
10035
- }
10036
- async function runDiscordGatewayLifecycle(params) {
10037
- const gateway = params.gateway;
10038
- const gatewayReadyAtLifecycleStart = gateway?.isConnected === true;
10039
- if (gateway) registerGateway(params.accountId, gateway);
10040
- const gatewayEmitter = params.gatewaySupervisor.emitter ?? getDiscordGatewayEmitter(gateway);
10041
- const stopGatewayLogging = attachDiscordGatewayLogging({
10042
- emitter: gatewayEmitter,
10043
- runtime: params.runtime
10044
- });
10045
- let lifecycleStopping = false;
10046
- const pushStatus = (patch) => {
10047
- params.statusSink?.(patch);
10048
- };
10049
- const gatewayReadyTimeoutMs = resolveDiscordGatewayReadyTimeoutMs({
10050
- configuredTimeoutMs: params.gatewayReadyTimeoutMs,
10051
- env: process.env
10052
- });
10053
- const gatewayRuntimeReadyTimeoutMs = resolveDiscordGatewayRuntimeReadyTimeoutMs({
10054
- configuredTimeoutMs: params.gatewayRuntimeReadyTimeoutMs,
10055
- env: process.env
10056
- });
10057
- const statusObserver = createGatewayStatusObserver({
10058
- gateway,
10059
- abortSignal: params.abortSignal,
10060
- runtime: params.runtime,
10061
- pushStatus,
10062
- isLifecycleStopping: () => lifecycleStopping,
10063
- runtimeReadyTimeoutMs: gatewayRuntimeReadyTimeoutMs
10064
- });
10065
- gatewayEmitter?.on("debug", statusObserver.onGatewayDebug);
10066
- let lastTransportActivityStatusAt;
10067
- const onGatewayTransportActivity = (event) => {
10068
- if (lifecycleStopping || params.abortSignal?.aborted) return;
10069
- const at = resolveTransportActivityAt(event);
10070
- if (lastTransportActivityStatusAt !== void 0 && at - lastTransportActivityStatusAt < DISCORD_GATEWAY_TRANSPORT_ACTIVITY_STATUS_MIN_INTERVAL_MS) return;
10071
- lastTransportActivityStatusAt = at;
10072
- pushStatus(createTransportActivityStatusPatch(at));
10073
10267
  };
10074
- gatewayEmitter?.on(DISCORD_GATEWAY_TRANSPORT_ACTIVITY_EVENT, onGatewayTransportActivity);
10075
- let sawDisallowedIntents = false;
10076
- const handleGatewayEvent = (event) => {
10077
- if (params.abortSignal?.aborted && event.type === "reconnect-exhausted") {
10078
- lifecycleStopping = true;
10079
- params.runtime.log?.(`discord: treating reconnect-exhausted during expected shutdown as clean: ${event.message}`);
10080
- return "continue";
10268
+ }
10269
+ //#endregion
10270
+ //#region extensions/discord/src/monitor/questions.ts
10271
+ var QuestionButton = class extends Button {
10272
+ constructor(ctx) {
10273
+ super();
10274
+ this.ctx = ctx;
10275
+ this.label = "question";
10276
+ this.customId = "ocq:id=seed;i=0";
10277
+ this.style = ButtonStyle.Primary;
10278
+ }
10279
+ async run(interaction, data) {
10280
+ const callback = parseDiscordQuestionData(data);
10281
+ if (!callback) {
10282
+ await interaction.reply({
10283
+ content: "This question is no longer valid.",
10284
+ ephemeral: true
10285
+ });
10286
+ return;
10081
10287
  }
10082
- if (event.type === "disallowed-intents") {
10083
- lifecycleStopping = true;
10084
- sawDisallowedIntents = true;
10085
- params.runtime.error?.(danger("discord: gateway closed with code 4014 (missing privileged gateway intents). Enable the required intents in the Discord Developer Portal or disable them in config."));
10086
- return "stop";
10288
+ if (!await this.ctx.authorizeQuestion(interaction)) return;
10289
+ try {
10290
+ await interaction.acknowledge();
10291
+ } catch {}
10292
+ let result;
10293
+ try {
10294
+ result = await this.ctx.resolveQuestion({
10295
+ cfg: this.ctx.cfg,
10296
+ questionId: callback.questionId,
10297
+ optionIndex: callback.optionIndex,
10298
+ senderId: interaction.userId,
10299
+ clientDisplayName: `Discord question (${this.ctx.accountId})`
10300
+ });
10301
+ } catch {
10302
+ try {
10303
+ await interaction.followUp({
10304
+ content: "Could not submit this answer.",
10305
+ ephemeral: true
10306
+ });
10307
+ } catch {}
10308
+ return;
10087
10309
  }
10088
- if (event.shouldStopLifecycle) lifecycleStopping = true;
10089
- params.runtime.error?.(danger(event.shouldStopLifecycle ? `discord gateway ${event.type}: ${event.message}` : `discord gateway error: ${event.message}`));
10090
- return event.shouldStopLifecycle ? "stop" : "continue";
10310
+ try {
10311
+ await interaction.followUp({
10312
+ content: result.status === "answered" ? "Answer submitted." : "This question was already answered.",
10313
+ ephemeral: true
10314
+ });
10315
+ } catch {}
10316
+ }
10317
+ };
10318
+ function createDiscordQuestionButton(params) {
10319
+ const authContext = params.authContext ?? {
10320
+ cfg: params.cfg,
10321
+ accountId: params.accountId
10091
10322
  };
10092
- const drainPendingGatewayErrors = () => params.gatewaySupervisor.drainPending((event) => {
10093
- if (handleGatewayEvent(event) !== "stop") return "continue";
10094
- if (event.type === "disallowed-intents") return "stop";
10095
- throw new DiscordGatewayLifecycleError(event);
10323
+ return new QuestionButton({
10324
+ cfg: params.cfg,
10325
+ accountId: params.accountId,
10326
+ resolveQuestion: params.resolveQuestion ?? questionGatewayRuntime.resolveOption,
10327
+ authorizeQuestion: params.authorizeQuestion ?? (async (interaction) => Boolean(await resolveAuthorizedComponentInteraction({
10328
+ ctx: authContext,
10329
+ interaction,
10330
+ label: "discord question",
10331
+ componentLabel: "button",
10332
+ unauthorizedReply: "You are not authorized to answer this question.",
10333
+ defer: false
10334
+ })))
10096
10335
  });
10097
- try {
10098
- if (drainPendingGatewayErrors() === "stop") return;
10099
- if (gatewayReadyAtLifecycleStart && params.voiceManager) params.voiceManager.autoJoin().catch((err) => params.runtime.error?.(danger(`discord voice: autoJoin failed: ${formatErrorMessage$1(err)}`)));
10100
- await waitForGatewayReady({
10101
- gateway,
10102
- abortSignal: params.abortSignal,
10103
- beforePoll: drainPendingGatewayErrors,
10104
- pushStatus,
10105
- runtime: params.runtime,
10106
- beforeRestart: statusObserver.clearReadyWatch,
10107
- readyTimeoutMs: gatewayReadyTimeoutMs
10108
- });
10109
- if (drainPendingGatewayErrors() === "stop") return;
10110
- await waitForDiscordGatewayStop({
10111
- gateway: gateway ? { disconnect: () => gateway.disconnect() } : void 0,
10112
- abortSignal: params.abortSignal,
10113
- gatewaySupervisor: params.gatewaySupervisor,
10114
- onGatewayEvent: handleGatewayEvent,
10115
- registerForceStop: statusObserver.registerForceStop
10116
- });
10117
- } catch (err) {
10118
- if (!sawDisallowedIntents && !params.isDisallowedIntentsError(err)) throw err;
10119
- } finally {
10120
- lifecycleStopping = true;
10121
- params.gatewaySupervisor.detachLifecycle();
10122
- unregisterGateway(params.accountId);
10123
- stopGatewayLogging();
10124
- statusObserver.dispose();
10125
- gatewayEmitter?.removeListener("debug", statusObserver.onGatewayDebug);
10126
- gatewayEmitter?.removeListener(DISCORD_GATEWAY_TRANSPORT_ACTIVITY_EVENT, onGatewayTransportActivity);
10127
- if (params.voiceManager) {
10128
- await params.voiceManager.destroy();
10129
- const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-CLZ5X8fh.js").then((n) => n.n);
10130
- setDiscordTranscriptsVoiceManager({
10336
+ }
10337
+ //#endregion
10338
+ //#region extensions/discord/src/monitor/provider.interactions.ts
10339
+ function createDiscordProviderInteractionSurface(params) {
10340
+ const createNativeCommand = params.createNativeCommand ?? createDiscordNativeCommand;
10341
+ const commands = params.commandSpecs.map((spec) => createNativeCommand({
10342
+ command: spec,
10343
+ cfg: params.cfg,
10344
+ discordConfig: params.discordConfig,
10345
+ accountId: params.accountId,
10346
+ sessionPrefix: params.sessionPrefix,
10347
+ ephemeralDefault: params.ephemeralDefault,
10348
+ threadBindings: params.threadBindings
10349
+ }));
10350
+ if (params.nativeEnabled && params.voiceEnabled) commands.push(createDiscordVoiceCommand({
10351
+ cfg: params.cfg,
10352
+ discordConfig: params.discordConfig,
10353
+ accountId: params.accountId,
10354
+ groupPolicy: params.groupPolicy,
10355
+ useAccessGroups: params.useAccessGroups,
10356
+ getManager: () => params.voiceManagerRef.current,
10357
+ ephemeralDefault: params.ephemeralDefault
10358
+ }));
10359
+ const execApprovalsConfig = params.discordConfig.execApprovals ?? {};
10360
+ const execApprovalsEnabled = isDiscordExecApprovalClientEnabled({
10361
+ cfg: params.cfg,
10362
+ accountId: params.accountId,
10363
+ configOverride: execApprovalsConfig
10364
+ });
10365
+ const approvalActionsEnabled = getDiscordExecApprovalApprovers({
10366
+ cfg: params.cfg,
10367
+ accountId: params.accountId,
10368
+ configOverride: execApprovalsConfig
10369
+ }).length > 0;
10370
+ if (execApprovalsEnabled) registerChannelRuntimeContext({
10371
+ channelRuntime: params.channelRuntime,
10372
+ channelId: "discord",
10373
+ accountId: params.accountId,
10374
+ capability: CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY,
10375
+ context: {
10376
+ token: params.token,
10377
+ config: execApprovalsConfig
10378
+ },
10379
+ abortSignal: params.abortSignal
10380
+ });
10381
+ const components = [
10382
+ createDiscordQuestionButton({
10383
+ cfg: params.cfg,
10384
+ accountId: params.accountId,
10385
+ authContext: {
10386
+ cfg: params.cfg,
10131
10387
  accountId: params.accountId,
10132
- manager: null
10133
- });
10134
- params.voiceManagerRef.current = null;
10135
- }
10136
- params.threadBindings.stop();
10388
+ discordConfig: params.discordConfig,
10389
+ runtime: params.runtime,
10390
+ token: params.token,
10391
+ guildEntries: params.guildEntries,
10392
+ allowFrom: params.allowFrom,
10393
+ dmPolicy: params.dmPolicy
10394
+ }
10395
+ }),
10396
+ createDiscordCommandArgFallbackButton({
10397
+ cfg: params.cfg,
10398
+ discordConfig: params.discordConfig,
10399
+ accountId: params.accountId,
10400
+ sessionPrefix: params.sessionPrefix,
10401
+ threadBindings: params.threadBindings
10402
+ }),
10403
+ createDiscordModelPickerFallbackButton({
10404
+ cfg: params.cfg,
10405
+ discordConfig: params.discordConfig,
10406
+ accountId: params.accountId,
10407
+ sessionPrefix: params.sessionPrefix,
10408
+ threadBindings: params.threadBindings
10409
+ }),
10410
+ createDiscordModelPickerFallbackSelect({
10411
+ cfg: params.cfg,
10412
+ discordConfig: params.discordConfig,
10413
+ accountId: params.accountId,
10414
+ sessionPrefix: params.sessionPrefix,
10415
+ threadBindings: params.threadBindings
10416
+ })
10417
+ ];
10418
+ const activityButton = createDiscordActivityButton({
10419
+ cfg: params.cfg,
10420
+ discordConfig: params.discordConfig,
10421
+ accountId: params.accountId,
10422
+ guildEntries: params.guildEntries,
10423
+ allowFrom: params.allowFrom,
10424
+ dmPolicy: params.dmPolicy,
10425
+ runtime: params.runtime,
10426
+ token: params.token
10427
+ }, params.applicationId);
10428
+ if (activityButton) components.push(activityButton);
10429
+ const modals = [];
10430
+ if (approvalActionsEnabled) components.push(createExecApprovalButton(createDiscordExecApprovalButtonContext({
10431
+ cfg: params.cfg,
10432
+ accountId: params.accountId,
10433
+ config: execApprovalsConfig
10434
+ })));
10435
+ if ((params.discordConfig.agentComponents ?? {}).enabled ?? true) {
10436
+ const componentContext = {
10437
+ cfg: params.cfg,
10438
+ discordConfig: params.discordConfig,
10439
+ accountId: params.accountId,
10440
+ guildEntries: params.guildEntries,
10441
+ allowFrom: params.allowFrom,
10442
+ dmPolicy: params.dmPolicy,
10443
+ runtime: params.runtime,
10444
+ token: params.token
10445
+ };
10446
+ components.push(...createAgentComponentControls.map((create) => create(componentContext)));
10447
+ components.push(...createDiscordComponentControls.map((create) => create(componentContext)));
10448
+ modals.push(createDiscordComponentModal(componentContext));
10137
10449
  }
10450
+ return {
10451
+ commands,
10452
+ components,
10453
+ modals
10454
+ };
10138
10455
  }
10139
10456
  //#endregion
10140
10457
  //#region extensions/discord/src/internal/voice.ts
@@ -10224,7 +10541,7 @@ async function createDiscordMonitorClient(params) {
10224
10541
  publicKey: "a",
10225
10542
  token: params.token,
10226
10543
  autoDeploy: false,
10227
- commandDeployHashStorePath: path.join(resolveStateDir(process.env), "discord", "command-deploy-cache.json"),
10544
+ commandDeployHashStore: params.commandDeployHashStore,
10228
10545
  requestOptions: {
10229
10546
  timeout: DISCORD_REST_TIMEOUT_MS,
10230
10547
  runtimeProfile: "persistent",
@@ -10401,35 +10718,12 @@ function formatDiscordStartupStatusMessage(params) {
10401
10718
  //#endregion
10402
10719
  //#region extensions/discord/src/monitor/provider.ts
10403
10720
  const DEFAULT_DISCORD_MEDIA_MAX_MB = 100;
10404
- let discordVoiceRuntimePromise;
10405
- let discordProviderSessionRuntimePromise;
10406
- let getPluginCommandSpecsForTesting;
10407
10721
  function logDiscordStartupPhase(params) {
10408
10722
  logDiscordStartupPhase$1({
10409
10723
  ...params,
10410
- isVerbose
10724
+ isVerbose: discordProviderRuntime.isVerbose
10411
10725
  });
10412
10726
  }
10413
- async function loadDiscordVoiceRuntime() {
10414
- const promise = discordVoiceRuntimePromise ?? import("./manager.runtime-3RVMVkyx.js");
10415
- discordVoiceRuntimePromise = promise;
10416
- try {
10417
- return await promise;
10418
- } catch (error) {
10419
- if (discordVoiceRuntimePromise === promise) discordVoiceRuntimePromise = void 0;
10420
- throw error;
10421
- }
10422
- }
10423
- async function loadDiscordProviderSessionRuntime() {
10424
- const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-D5pCGibh.js");
10425
- discordProviderSessionRuntimePromise = promise;
10426
- try {
10427
- return await promise;
10428
- } catch (error) {
10429
- if (discordProviderSessionRuntimePromise === promise) discordProviderSessionRuntimePromise = void 0;
10430
- throw error;
10431
- }
10432
- }
10433
10727
  const DISCORD_DISALLOWED_INTENTS_CODE = GatewayCloseCodes$1.DisallowedIntents;
10434
10728
  function isDiscordDisallowedIntentsError(err) {
10435
10729
  if (!err) return false;
@@ -10438,7 +10732,7 @@ function isDiscordDisallowedIntentsError(err) {
10438
10732
  async function monitorDiscordProvider(opts = {}) {
10439
10733
  const startupStartedAt = Date.now();
10440
10734
  const cfg = opts.config ?? getRuntimeConfig();
10441
- const account = resolveDiscordAccount({
10735
+ const account = discordProviderRuntime.resolveDiscordAccount({
10442
10736
  cfg,
10443
10737
  accountId: opts.accountId
10444
10738
  });
@@ -10482,7 +10776,7 @@ async function monitorDiscordProvider(opts = {}) {
10482
10776
  cfg,
10483
10777
  accountId: account.accountId
10484
10778
  }) ?? "pairing";
10485
- const discordProviderSessionRuntime = await loadDiscordProviderSessionRuntime();
10779
+ const discordProviderSessionRuntime = await discordProviderRuntime.loadDiscordProviderSessionRuntime();
10486
10780
  const threadBindingIdleTimeoutMs = discordProviderSessionRuntime.resolveThreadBindingIdleTimeoutMs({
10487
10781
  channelIdleHoursRaw: discordAccountThreadBindings?.idleHours ?? discordRootThreadBindings?.idleHours,
10488
10782
  sessionIdleHoursRaw: cfg.session?.threadBindings?.idleHours
@@ -10497,12 +10791,12 @@ async function monitorDiscordProvider(opts = {}) {
10497
10791
  });
10498
10792
  const groupDmEnabled = dmConfig?.groupEnabled ?? false;
10499
10793
  const groupDmChannels = dmConfig?.groupChannels;
10500
- const nativeEnabled = resolveNativeCommandsEnabled({
10794
+ const nativeEnabled = discordProviderRuntime.resolveNativeCommandsEnabled({
10501
10795
  providerId: "discord",
10502
10796
  providerSetting: discordCfg.commands?.native,
10503
10797
  globalSetting: cfg.commands?.native
10504
10798
  });
10505
- const nativeSkillsEnabled = resolveNativeSkillsEnabled({
10799
+ const nativeSkillsEnabled = discordProviderRuntime.resolveNativeSkillsEnabled({
10506
10800
  providerId: "discord",
10507
10801
  providerSetting: discordCfg.commands?.nativeSkills,
10508
10802
  globalSetting: cfg.commands?.nativeSkills
@@ -10522,7 +10816,7 @@ async function monitorDiscordProvider(opts = {}) {
10522
10816
  });
10523
10817
  guildEntries = allowlistResolved.guildEntries;
10524
10818
  allowFrom = allowlistResolved.allowFrom ?? [];
10525
- if (shouldLogVerbose()) logDiscordResolvedConfig({
10819
+ if (discordProviderRuntime.shouldLogVerbose()) logDiscordResolvedConfig({
10526
10820
  dmEnabled,
10527
10821
  dmPolicy,
10528
10822
  allowFrom,
@@ -10545,7 +10839,7 @@ async function monitorDiscordProvider(opts = {}) {
10545
10839
  phase: "fetch-application-id:start",
10546
10840
  startAt: startupStartedAt
10547
10841
  });
10548
- const applicationId = (typeof discordCfg.applicationId === "string" && discordCfg.applicationId.trim() ? discordCfg.applicationId.trim() : void 0) ?? parseApplicationIdFromToken(token) ?? await fetchDiscordApplicationId(token, 4e3, discordRestFetch);
10842
+ const applicationId = (typeof discordCfg.applicationId === "string" && discordCfg.applicationId.trim() ? discordCfg.applicationId.trim() : void 0) ?? parseApplicationIdFromToken(token) ?? await discordProviderRuntime.fetchDiscordApplicationId(token, 4e3, discordRestFetch);
10549
10843
  if (!applicationId) throw new Error("Failed to resolve Discord application id");
10550
10844
  logDiscordStartupPhase({
10551
10845
  runtime,
@@ -10559,9 +10853,9 @@ async function monitorDiscordProvider(opts = {}) {
10559
10853
  runtime,
10560
10854
  nativeEnabled,
10561
10855
  nativeSkillsEnabled,
10562
- listSkillCommandsForAgents,
10563
- listNativeCommandSpecsForConfig,
10564
- getPluginCommandSpecs: getPluginCommandSpecsForTesting
10856
+ listSkillCommandsForAgents: discordProviderRuntime.listSkillCommandsForAgents,
10857
+ listNativeCommandSpecsForConfig: discordProviderRuntime.listNativeCommandSpecsForConfig,
10858
+ getPluginCommandSpecs: discordProviderRuntime.getPluginCommandSpecs
10565
10859
  });
10566
10860
  const voiceManagerRef = { current: null };
10567
10861
  const threadBindings = threadBindingsEnabled ? discordProviderSessionRuntime.createThreadBindingManager({
@@ -10605,6 +10899,7 @@ async function monitorDiscordProvider(opts = {}) {
10605
10899
  cfg,
10606
10900
  discordConfig: discordCfg,
10607
10901
  accountId: account.accountId,
10902
+ applicationId,
10608
10903
  token,
10609
10904
  commandSpecs,
10610
10905
  nativeEnabled,
@@ -10621,7 +10916,7 @@ async function monitorDiscordProvider(opts = {}) {
10621
10916
  runtime,
10622
10917
  channelRuntime: opts.channelRuntime,
10623
10918
  abortSignal: opts.abortSignal,
10624
- createNativeCommand: createDiscordNativeCommand
10919
+ createNativeCommand: discordProviderRuntime.createDiscordNativeCommand
10625
10920
  });
10626
10921
  const { client, gateway, gatewaySupervisor: createdGatewaySupervisor, autoPresenceController: createdAutoPresenceController } = await createDiscordMonitorClient({
10627
10922
  accountId: account.accountId,
@@ -10634,7 +10929,8 @@ async function monitorDiscordProvider(opts = {}) {
10634
10929
  voiceEnabled,
10635
10930
  discordConfig: discordCfg,
10636
10931
  runtime,
10637
- createClient: ((...args) => new Client(...args)),
10932
+ commandDeployHashStore: opts.commandDeployHashStore,
10933
+ createClient: discordProviderRuntime.createClient,
10638
10934
  createGatewayPlugin: createDiscordGatewayPlugin,
10639
10935
  createGatewaySupervisor: createDiscordGatewaySupervisor,
10640
10936
  createAutoPresenceController: createDiscordAutoPresenceController,
@@ -10645,7 +10941,7 @@ async function monitorDiscordProvider(opts = {}) {
10645
10941
  autoPresenceController = createdAutoPresenceController;
10646
10942
  earlyGatewayEmitter = gatewaySupervisor.emitter;
10647
10943
  onEarlyGatewayDebug = (msg) => {
10648
- if (!isVerbose()) return;
10944
+ if (!discordProviderRuntime.isVerbose()) return;
10649
10945
  runtime.log?.(`discord startup [${account.accountId}] gateway-debug ${Math.max(0, Date.now() - startupStartedAt)}ms ${String(msg)}`);
10650
10946
  };
10651
10947
  earlyGatewayEmitter?.on("debug", onEarlyGatewayDebug);
@@ -10663,8 +10959,8 @@ async function monitorDiscordProvider(opts = {}) {
10663
10959
  enabled: nativeEnabled,
10664
10960
  accountId: account.accountId,
10665
10961
  startupStartedAt,
10666
- shouldLogVerbose,
10667
- isVerbose
10962
+ shouldLogVerbose: discordProviderRuntime.shouldLogVerbose,
10963
+ isVerbose: discordProviderRuntime.isVerbose
10668
10964
  });
10669
10965
  const logger = createSubsystemLogger("discord/monitor");
10670
10966
  const guildHistories = /* @__PURE__ */ new Map();
@@ -10683,7 +10979,7 @@ async function monitorDiscordProvider(opts = {}) {
10683
10979
  });
10684
10980
  let voiceManager = null;
10685
10981
  if (voiceEnabled) {
10686
- const { DiscordVoiceGuildCreateListener, DiscordVoiceManager, DiscordVoiceReadyListener, DiscordVoiceResumedListener, DiscordVoiceStateUpdateListener } = await loadDiscordVoiceRuntime();
10982
+ const { DiscordVoiceGuildCreateListener, DiscordVoiceManager, DiscordVoiceReadyListener, DiscordVoiceResumedListener, DiscordVoiceStateUpdateListener } = await discordProviderRuntime.loadDiscordVoiceRuntime();
10687
10983
  voiceManager = new DiscordVoiceManager({
10688
10984
  client,
10689
10985
  cfg,
@@ -10692,7 +10988,7 @@ async function monitorDiscordProvider(opts = {}) {
10692
10988
  runtime,
10693
10989
  botUserId
10694
10990
  });
10695
- const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-CLZ5X8fh.js").then((n) => n.n);
10991
+ const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-DjDbt14x.js").then((n) => n.n);
10696
10992
  setDiscordTranscriptsVoiceManager({
10697
10993
  accountId: account.accountId,
10698
10994
  manager: voiceManager
@@ -10704,6 +11000,7 @@ async function monitorDiscordProvider(opts = {}) {
10704
11000
  registerDiscordListener(client.listeners, new DiscordVoiceStateUpdateListener(voiceManager));
10705
11001
  }
10706
11002
  const messageHandler = discordProviderSessionRuntime.createDiscordMessageHandler({
11003
+ client,
10707
11004
  cfg,
10708
11005
  discordConfig: discordCfg,
10709
11006
  accountId: account.accountId,
@@ -10768,7 +11065,7 @@ async function monitorDiscordProvider(opts = {}) {
10768
11065
  lifecycleStarted = true;
10769
11066
  earlyGatewayEmitter?.removeListener("debug", onEarlyGatewayDebug);
10770
11067
  onEarlyGatewayDebug = void 0;
10771
- await runDiscordGatewayLifecycle({
11068
+ await discordProviderRuntime.runDiscordGatewayLifecycle({
10772
11069
  accountId: account.accountId,
10773
11070
  gateway: lifecycleGateway,
10774
11071
  runtime,
@@ -10783,7 +11080,7 @@ async function monitorDiscordProvider(opts = {}) {
10783
11080
  gatewayRuntimeReadyTimeoutMs: account.config.gatewayRuntimeReadyTimeoutMs
10784
11081
  });
10785
11082
  } finally {
10786
- cleanupDiscordProviderStartup({
11083
+ await cleanupDiscordProviderStartup({
10787
11084
  deactivateMessageHandler,
10788
11085
  autoPresenceController,
10789
11086
  setStatus: opts.setStatus,
@@ -10798,4 +11095,4 @@ async function monitorDiscordProvider(opts = {}) {
10798
11095
  }
10799
11096
  }
10800
11097
  //#endregion
10801
- export { resolveDiscordTextCommandAccess as A, registerDiscordListener as C, resolveDiscordThreadStarter as D, resolveDiscordReplyTarget as E, sanitizeDiscordThreadName as O, handleDiscordDmCommandDecision as S, resolveDiscordAutoThreadReplyPlan as T, createDiscordSupplementalContextAccessChecker as _, buildDirectLabel as a, resolveDiscordEffectiveRoute as b, resolveDiscordVoiceOwnerAccess as c, resolveDiscordGatewayIntents as d, waitForDiscordGatewayPluginRegistration as f, buildDiscordInboundAccessContext as g, buildDiscordGroupSystemPrompt as h, sanitizeDiscordFrontChannelReplyPayloads as i, resolveDiscordDmCommandAccess as k, authorizeDiscordVoiceIngress as l, createDiscordNativeCommand as m, deliverDiscordReply as n, buildGuildLabel as o, resolveDiscordVoiceEnabled as p, formatDiscordReplyDeliveryFailure as r, resolveReplyContext as s, monitorDiscordProvider as t, createDiscordGatewayPlugin as u, buildDiscordRoutePeer as v, threading_exports as w, shouldIgnoreStaleDiscordRouteBinding as x, resolveDiscordConversationRoute as y };
11098
+ export { resolveDiscordDmCommandAccess as A, mapGatewayDispatchData as C, resolveDiscordReplyTarget as D, resolveDiscordAutoThreadReplyPlan as E, resolveDiscordThreadStarter as O, handleDiscordDmCommandDecision as S, threading_exports as T, createDiscordSupplementalContextAccessChecker as _, buildDirectLabel as a, resolveDiscordEffectiveRoute as b, resolveDiscordVoiceAccess as c, resolveDiscordGatewayIntents as d, waitForDiscordGatewayPluginRegistration as f, buildDiscordInboundAccessContext as g, buildDiscordGroupSystemPrompt as h, sanitizeDiscordFrontChannelReplyPayloads as i, resolveDiscordTextCommandAccess as j, sanitizeDiscordThreadName as k, authorizeDiscordVoiceIngress as l, createDiscordNativeCommand as m, deliverDiscordReply as n, buildGuildLabel as o, resolveDiscordVoiceEnabled as p, formatDiscordReplyDeliveryFailure as r, resolveReplyContext as s, monitorDiscordProvider as t, createDiscordGatewayPlugin as u, buildDiscordRoutePeer as v, registerDiscordListener as w, shouldIgnoreStaleDiscordRouteBinding as x, resolveDiscordConversationRoute as y };