@openclaw/discord 2026.8.1-beta.3 → 2026.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (274) hide show
  1. package/dist/{account-inspect-D5xmUpnj.js → account-inspect-BDfKyuvL.js} +1 -1
  2. package/dist/account-inspect-api.js +1 -1
  3. package/dist/{accounts-DNl-oCEw.js → accounts-CfQ-vSyf.js} +5 -124
  4. package/dist/action-runtime-api.js +1 -1
  5. package/dist/{activities-api-KCBAmWxD.js → activities-api-Dl-TOyOX.js} +5 -4
  6. package/dist/activities-api.js +1 -1
  7. package/dist/api.js +16 -16
  8. package/dist/{approval-handler.runtime-B12RCYr8.js → approval-handler.runtime-q4Zqo44V.js} +28 -105
  9. package/dist/{audit-Yc7eZDd6.js → audit-DgrvFPGt.js} +5 -5
  10. package/dist/{channel-cXYzGc4L.js → channel-BsQUalPw.js} +18 -20
  11. package/dist/{channel-actions.runtime-CODTvo7c.js → channel-actions.runtime-UMGGIfSy.js} +59 -58
  12. package/dist/channel-config-api.js +1 -1
  13. package/dist/channel-plugin-api.js +1 -1
  14. package/dist/channel-type-CVLZyGYS.js +7 -0
  15. package/dist/{channel.setup-CSiwnMgs.js → channel.setup-rPs4dsk_.js} +5 -5
  16. package/dist/{components-ezGKo_Yh.js → components-Dk35LTf_.js} +33 -29
  17. package/dist/{config-schema-DC5kDtQ5.js → config-schema-CxPqtVI1.js} +16 -10
  18. package/dist/{conversation-binding-route-D6rCQ5S0.js → conversation-binding-route-BjvX4e35.js} +1 -1
  19. package/dist/{directory-config-XyCfoqLg.js → directory-config-B7DY_pNG.js} +2 -2
  20. package/dist/directory-contract-api.js +1 -1
  21. package/dist/{directory-live-Df0NbFJB.js → directory-live-DuAXKkan.js} +2 -2
  22. package/dist/doctor-contract-api.js +1 -1
  23. package/dist/{doctor-DYY31GrO.js → doctor-zQTtn6hm.js} +4 -4
  24. package/dist/{handle-action.guild-admin-6Tvvinsa.js → handle-action.guild-admin-DZewwLr1.js} +9 -5
  25. package/dist/index.js +1 -1
  26. package/dist/ingress-identity-CzZKcPK8.js +60 -0
  27. package/dist/{message-handler-B61q5MOF.js → message-handler-C5By3yl5.js} +5 -5
  28. package/dist/{message-handler.preflight-Bzg_Hawz.js → message-handler.preflight-DrszWuHw.js} +20 -84
  29. package/dist/{message-handler.process--4_712Ec.js → message-handler.process-DyFPDLCt.js} +60 -66
  30. package/dist/{message-utils-BXLLnFl6.js → message-text-Ca8M6TU8.js} +34 -32
  31. package/dist/{outbound-adapter-DxHTOqiN.js → outbound-adapter-Dif8p481.js} +58 -61
  32. package/dist/{outbound-components-B2PL0ooH.js → outbound-components-wjv7yyAj.js} +5 -4
  33. package/dist/outbound-session-route-Bn4uXaoE.js +665 -0
  34. package/dist/{owner-access-Bg41VzAf.js → owner-access-UlYi9t0M.js} +1 -1
  35. package/dist/{pluralkit-dUl4v1X3.js → pluralkit-9EuEN4UD.js} +1 -1
  36. package/dist/{probe-BTdtVRwU.js → probe-n6ZXxK8V.js} +1 -1
  37. package/dist/{probe.runtime-Dq5-PRKT.js → probe.runtime-CN4bdPfZ.js} +1 -1
  38. package/dist/{provider-DlK_ynqt.js → provider-LXiOcJrH.js} +443 -295
  39. package/dist/{provider-session.runtime-CvvphHvs.js → provider-session.runtime-DSNe7r2W.js} +3 -3
  40. package/dist/provider.runtime-DiInaDXO.js +2 -0
  41. package/dist/{realtime-session.runtime-ysbMG8v7.js → realtime-session.runtime-DOViOIjY.js} +106 -122
  42. package/dist/{resolve-allowlist-common-DIVXbD1P.js → resolve-allowlist-common-BLoYaxEG.js} +1 -1
  43. package/dist/{resolve-channels-CGeUoIqb.js → resolve-channels-D2yl_2CN.js} +4 -3
  44. package/dist/{resolve-users-BtKxLUZv.js → resolve-users-BLxfqajZ.js} +2 -2
  45. package/dist/{retry-DNsVTeTo.js → retry-DqHCW6PV.js} +220 -6
  46. package/dist/{runtime-D71_VFLr.js → runtime-BYamRVPN.js} +73 -56
  47. package/dist/{runtime-CQovMsH3.js → runtime-DrxVBTtp.js} +2 -2
  48. package/dist/runtime-api.js +16 -23
  49. package/dist/{sdk-runtime-37OU6_Yh.js → sdk-runtime-6tfgYDjY.js} +55 -86
  50. package/dist/{security-audit-BfJhAXZp.js → security-audit-DKfK-iPY.js} +10 -11
  51. package/dist/security-audit-contract-api.js +1 -1
  52. package/dist/{security-audit.runtime-BVKF9VtY.js → security-audit.runtime-sKZyKgpx.js} +1 -1
  53. package/dist/{send-rQIffSYu.js → send-UJHiAm4C.js} +78 -15
  54. package/dist/{send.components-ChK1wS7w.js → send.components-CrBJpGT_.js} +15 -22
  55. package/dist/{send.outbound-HIkgji_7.js → send.outbound-D7JYmfm9.js} +58 -69
  56. package/dist/{send.shared-B3fpaLWJ.js → send.shared-DZJ1akvQ.js} +36 -21
  57. package/dist/setup-plugin-api.js +1 -1
  58. package/dist/{shared-CaAaoksy.js → shared-Dii2HTn7.js} +31 -9
  59. package/dist/{subagent-hooks-CNT2ZJTJ.js → subagent-hooks-JyGrtQIl.js} +2 -2
  60. package/dist/subagent-hooks-api.js +1 -6
  61. package/dist/{system-events-Nuwoq_au.js → system-events-BEmcj4xJ.js} +1 -1
  62. package/dist/{target-resolver-DIXShHaZ.js → target-resolver-V-IYae6s.js} +3 -3
  63. package/dist/targets-CQp53cGj.js +3 -0
  64. package/dist/{thread-bindings-VlymUnbz.js → thread-bindings-DvYP79fy.js} +3 -4
  65. package/dist/{thread-bindings.manager-CngsgErq.js → thread-bindings.manager-Clm77DBM.js} +8 -12
  66. package/dist/{threading-DU6pgeGm.js → threading-CXuu_7o9.js} +47 -25
  67. package/dist/{transcripts-source-DeIMNbRh.js → transcripts-source-BLEMH_yi.js} +9 -4
  68. package/dist/transcripts-source-api.js +1 -1
  69. package/dist/{typing-oLiS5Z13.js → typing-B9snnwMe.js} +1 -1
  70. package/dist/{voice-runtime-CjNFaynA.js → voice-runtime-DY6_o73o.js} +76 -66
  71. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/README.md +19 -19
  72. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v1.js +7 -3
  73. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v7.js +5 -2
  74. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v1.js +7 -3
  75. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v7.js +5 -2
  76. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/package.json +4 -3
  77. package/node_modules/@discordjs/voice/node_modules/@types/node/README.md +1 -1
  78. package/node_modules/@discordjs/voice/node_modules/@types/node/child_process.d.ts +0 -1
  79. package/node_modules/@discordjs/voice/node_modules/@types/node/crypto.d.ts +6 -6
  80. package/node_modules/@discordjs/voice/node_modules/@types/node/dns/promises.d.ts +5 -5
  81. package/node_modules/@discordjs/voice/node_modules/@types/node/dns.d.ts +5 -5
  82. package/node_modules/@discordjs/voice/node_modules/@types/node/fs.d.ts +7 -0
  83. package/node_modules/@discordjs/voice/node_modules/@types/node/http.d.ts +30 -0
  84. package/node_modules/@discordjs/voice/node_modules/@types/node/http2.d.ts +4 -4
  85. package/node_modules/@discordjs/voice/node_modules/@types/node/os.d.ts +30 -30
  86. package/node_modules/@discordjs/voice/node_modules/@types/node/package.json +2 -2
  87. package/node_modules/@discordjs/voice/node_modules/@types/node/perf_hooks.d.ts +2 -1
  88. package/node_modules/@discordjs/voice/node_modules/@types/node/process.d.ts +42 -43
  89. package/node_modules/@discordjs/voice/node_modules/@types/node/quic.d.ts +1049 -84
  90. package/node_modules/@discordjs/voice/node_modules/@types/node/sqlite.d.ts +14 -1
  91. package/node_modules/@discordjs/voice/node_modules/@types/node/stream/iter.d.ts +3 -2
  92. package/node_modules/@discordjs/voice/node_modules/@types/node/test.d.ts +61 -0
  93. package/node_modules/@discordjs/voice/node_modules/@types/node/v8.d.ts +20 -23
  94. package/node_modules/discord-api-types/CHANGELOG.md +8 -0
  95. package/node_modules/discord-api-types/package.json +4 -4
  96. package/node_modules/discord-api-types/payloads/v10/channel.d.ts +2 -2
  97. package/node_modules/discord-api-types/payloads/v10/channel.d.ts.map +1 -1
  98. package/node_modules/discord-api-types/payloads/v10/gateway.d.ts +4 -0
  99. package/node_modules/discord-api-types/payloads/v10/gateway.d.ts.map +1 -1
  100. package/node_modules/discord-api-types/payloads/v10/gateway.js.map +1 -1
  101. package/node_modules/discord-api-types/payloads/v10/message.d.ts +4 -1
  102. package/node_modules/discord-api-types/payloads/v10/message.d.ts.map +1 -1
  103. package/node_modules/discord-api-types/payloads/v10/message.js +1 -0
  104. package/node_modules/discord-api-types/payloads/v10/message.js.map +1 -1
  105. package/node_modules/discord-api-types/payloads/v9/channel.d.ts +2 -2
  106. package/node_modules/discord-api-types/payloads/v9/channel.d.ts.map +1 -1
  107. package/node_modules/discord-api-types/payloads/v9/gateway.d.ts +4 -0
  108. package/node_modules/discord-api-types/payloads/v9/gateway.d.ts.map +1 -1
  109. package/node_modules/discord-api-types/payloads/v9/gateway.js.map +1 -1
  110. package/node_modules/discord-api-types/payloads/v9/message.d.ts +4 -1
  111. package/node_modules/discord-api-types/payloads/v9/message.d.ts.map +1 -1
  112. package/node_modules/discord-api-types/payloads/v9/message.js +1 -0
  113. package/node_modules/discord-api-types/payloads/v9/message.js.map +1 -1
  114. package/node_modules/typebox/build/format/date.d.mts +1 -1
  115. package/node_modules/typebox/build/format/date.mjs +1 -1
  116. package/node_modules/typebox/build/format/date_time.d.mts +2 -2
  117. package/node_modules/typebox/build/format/date_time.mjs +3 -3
  118. package/node_modules/typebox/build/format/email.d.mts +1 -1
  119. package/node_modules/typebox/build/format/email.mjs +2 -2
  120. package/node_modules/typebox/build/format/hostname.mjs +2 -10
  121. package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
  122. package/node_modules/typebox/build/format/idn_email.mjs +3 -3
  123. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
  124. package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
  125. package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
  126. package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
  127. package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
  128. package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
  129. package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
  130. package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
  131. package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
  132. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
  133. package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
  134. package/node_modules/typebox/build/format/idna/index.mjs +2 -0
  135. package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
  136. package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
  137. package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
  138. package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
  139. package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
  140. package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
  141. package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
  142. package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
  143. package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
  144. package/node_modules/typebox/build/format/ipv4.mjs +2 -32
  145. package/node_modules/typebox/build/format/ipv6.mjs +2 -61
  146. package/node_modules/typebox/build/format/iri.d.mts +2 -2
  147. package/node_modules/typebox/build/format/iri.mjs +26 -8
  148. package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
  149. package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
  150. package/node_modules/typebox/build/format/regex.d.mts +1 -2
  151. package/node_modules/typebox/build/format/regex.mjs +2 -6
  152. package/node_modules/typebox/build/format/time.d.mts +2 -2
  153. package/node_modules/typebox/build/format/time.mjs +19 -14
  154. package/node_modules/typebox/build/format/uri.d.mts +1 -1
  155. package/node_modules/typebox/build/format/uri.mjs +3 -130
  156. package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
  157. package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
  158. package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
  159. package/node_modules/typebox/build/format/uri_template.mjs +4 -5
  160. package/node_modules/typebox/build/format/url.d.mts +3 -3
  161. package/node_modules/typebox/build/format/url.mjs +4 -5
  162. package/node_modules/typebox/build/guard/emit.d.mts +3 -1
  163. package/node_modules/typebox/build/guard/emit.mjs +12 -5
  164. package/node_modules/typebox/build/guard/guard.d.mts +8 -2
  165. package/node_modules/typebox/build/guard/guard.mjs +25 -4
  166. package/node_modules/typebox/build/guard/string.d.mts +2 -2
  167. package/node_modules/typebox/build/guard/string.mjs +7 -7
  168. package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
  169. package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
  170. package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
  171. package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
  172. package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
  173. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
  174. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
  175. package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
  176. package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
  177. package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
  178. package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
  179. package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
  180. package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
  181. package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
  182. package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
  183. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
  184. package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
  185. package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
  186. package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
  187. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
  188. package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
  189. package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
  190. package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
  191. package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
  192. package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
  193. package/node_modules/typebox/build/schema/types/index.mjs +0 -2
  194. package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
  195. package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
  196. package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
  197. package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
  198. package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
  199. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
  200. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
  201. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
  202. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
  203. package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
  204. package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
  205. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
  206. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
  207. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
  208. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
  209. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
  210. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
  211. package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
  212. package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
  213. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
  214. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
  215. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
  216. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
  217. package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
  218. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
  219. package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
  220. package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
  221. package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
  222. package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
  223. package/node_modules/typebox/build/type/script/parser.mjs +27 -23
  224. package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
  225. package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
  226. package/node_modules/typebox/package.json +27 -27
  227. package/node_modules/typebox/readme.md +79 -82
  228. package/node_modules/undici/docs/docs/api/Client.md +21 -8
  229. package/node_modules/undici/lib/api/readable.js +33 -43
  230. package/node_modules/undici/lib/core/connect.js +16 -2
  231. package/node_modules/undici/lib/core/symbols.js +1 -0
  232. package/node_modules/undici/lib/dispatcher/client-h1.js +3 -3
  233. package/node_modules/undici/lib/dispatcher/client-h2.js +179 -10
  234. package/node_modules/undici/lib/dispatcher/client.js +74 -29
  235. package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +28 -6
  236. package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +15 -1
  237. package/node_modules/undici/lib/handler/retry-handler.js +7 -2
  238. package/node_modules/undici/lib/interceptor/cache.js +5 -2
  239. package/node_modules/undici/lib/interceptor/deduplicate.js +1 -1
  240. package/node_modules/undici/lib/mock/mock-utils.js +213 -24
  241. package/node_modules/undici/lib/util/cache.js +2 -4
  242. package/node_modules/undici/lib/web/websocket/websocket.js +22 -0
  243. package/node_modules/undici/package.json +1 -1
  244. package/node_modules/undici/types/client.d.ts +40 -0
  245. package/node_modules/ws/lib/permessage-deflate.js +3 -1
  246. package/node_modules/ws/package.json +1 -1
  247. package/openclaw.plugin.json +12 -4
  248. package/package.json +8 -8
  249. package/skills/discord/SKILL.md +1 -1
  250. package/dist/approval-message-safety-XGFPbDoI.js +0 -226
  251. package/dist/audit-core-BCX8UeFH.js +0 -105
  252. package/dist/channel-actions-Dr2QI8Bf.js +0 -212
  253. package/dist/inbound-event-delivery-De2qxTrP.js +0 -39
  254. package/dist/provider.runtime-CzKGRiAF.js +0 -2
  255. package/dist/runtime-api.actions.js +0 -3
  256. package/dist/runtime-api.lookup.js +0 -7
  257. package/dist/runtime-api.monitor-CzeTYF32.js +0 -6
  258. package/dist/runtime-api.monitor.js +0 -9
  259. package/dist/runtime-api.send.js +0 -7
  260. package/dist/runtime-api.threads.js +0 -5
  261. package/dist/send.reactions-gmJ6yFPo.js +0 -78
  262. package/dist/send.receipt-Cnhoautb.js +0 -76
  263. package/dist/subagent-progress-FPLqBY1s.js +0 -110
  264. package/dist/targets-B2pf49zc.js +0 -3
  265. package/node_modules/typebox/build/format/_idna.d.mts +0 -2
  266. package/node_modules/typebox/build/format/_idna.mjs +0 -246
  267. package/node_modules/typebox/build/format/_puny.d.mts +0 -1
  268. package/node_modules/typebox/build/format/_puny.mjs +0 -77
  269. package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
  270. package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
  271. package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
  272. package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
  273. package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
  274. package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
@@ -1,78 +0,0 @@
1
- import { Tt as getChannelMessage, _t as listMessageReactionUsers, gt as deleteOwnMessageReaction, ht as createOwnMessageReaction } from "./retry-DNsVTeTo.js";
2
- import { P as createDiscordClient, i as formatReactionEmoji, r as buildReactionIdentifier, s as normalizeReactionEmoji } from "./send.shared-B3fpaLWJ.js";
3
- import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
4
- //#region extensions/discord/src/send.reactions.ts
5
- function createDiscordReactionRuntimeClient(opts) {
6
- return createDiscordClient(opts);
7
- }
8
- function resolveDiscordReactionClient(opts) {
9
- if (!opts.cfg) throw new Error("Discord reactions requires a resolved runtime config. Load and resolve config at the command or gateway boundary, then pass cfg through the runtime path.");
10
- const cfg = requireRuntimeConfig(opts.cfg, "Discord reactions");
11
- return createDiscordClient({
12
- ...opts,
13
- cfg
14
- });
15
- }
16
- function isDiscordReactionRuntimeContext(opts) {
17
- return Boolean(opts.rest && opts.cfg && opts.accountId);
18
- }
19
- async function reactMessageDiscord(channelId, messageId, emoji, opts) {
20
- const { rest, request } = isDiscordReactionRuntimeContext(opts) ? createDiscordReactionRuntimeClient(opts) : resolveDiscordReactionClient(opts);
21
- const encoded = normalizeReactionEmoji(emoji);
22
- await request(() => createOwnMessageReaction(rest, channelId, messageId, encoded), "react");
23
- return { ok: true };
24
- }
25
- async function removeReactionDiscord(channelId, messageId, emoji, opts) {
26
- const { rest, request } = isDiscordReactionRuntimeContext(opts) ? createDiscordReactionRuntimeClient(opts) : resolveDiscordReactionClient(opts);
27
- const encoded = normalizeReactionEmoji(emoji);
28
- await request(() => deleteOwnMessageReaction(rest, channelId, messageId, encoded), "reaction-remove");
29
- return { ok: true };
30
- }
31
- async function removeOwnReactionsDiscord(channelId, messageId, opts) {
32
- const { rest, request } = isDiscordReactionRuntimeContext(opts) ? createDiscordReactionRuntimeClient(opts) : resolveDiscordReactionClient(opts);
33
- const message = await request(() => getChannelMessage(rest, channelId, messageId), "reaction-list");
34
- const identifiers = /* @__PURE__ */ new Set();
35
- for (const reaction of message.reactions ?? []) {
36
- const identifier = reaction.me ? buildReactionIdentifier(reaction.emoji) : void 0;
37
- if (identifier) identifiers.add(identifier);
38
- }
39
- if (identifiers.size === 0) return {
40
- ok: true,
41
- removed: []
42
- };
43
- const removed = Array.from(identifiers);
44
- await Promise.all(removed.map((identifier) => request(() => deleteOwnMessageReaction(rest, channelId, messageId, normalizeReactionEmoji(identifier)), "reaction-remove")));
45
- return {
46
- ok: true,
47
- removed
48
- };
49
- }
50
- async function fetchReactionsDiscord(channelId, messageId, opts) {
51
- const { rest, request } = isDiscordReactionRuntimeContext(opts) ? createDiscordReactionRuntimeClient(opts) : resolveDiscordReactionClient(opts);
52
- const reactions = (await request(() => getChannelMessage(rest, channelId, messageId), "reaction-list")).reactions ?? [];
53
- if (reactions.length === 0) return [];
54
- const limit = typeof opts.limit === "number" && Number.isFinite(opts.limit) ? Math.min(Math.max(Math.floor(opts.limit), 1), 100) : 100;
55
- const summaries = [];
56
- for (const reaction of reactions) {
57
- const identifier = buildReactionIdentifier(reaction.emoji);
58
- if (!identifier) continue;
59
- const encoded = encodeURIComponent(identifier);
60
- const users = await request(() => listMessageReactionUsers(rest, channelId, messageId, encoded, { limit }), "reaction-users");
61
- summaries.push({
62
- emoji: {
63
- id: reaction.emoji.id ?? null,
64
- name: reaction.emoji.name ?? null,
65
- raw: formatReactionEmoji(reaction.emoji)
66
- },
67
- count: reaction.count,
68
- users: users.map((user) => ({
69
- id: user.id,
70
- username: user.username,
71
- tag: user.username && user.discriminator ? `${user.username}#${user.discriminator}` : user.username
72
- }))
73
- });
74
- }
75
- return summaries;
76
- }
77
- //#endregion
78
- export { removeReactionDiscord as i, reactMessageDiscord as n, removeOwnReactionsDiscord as r, fetchReactionsDiscord as t };
@@ -1,76 +0,0 @@
1
- import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
2
- import { attachChannelToResults } from "openclaw/plugin-sdk/channel-send-result";
3
- //#region extensions/discord/src/send.receipt.ts
4
- function toDiscordOutboundDeliveryResult(result) {
5
- const { channelId, ...delivery } = result;
6
- return {
7
- ...delivery,
8
- target: {
9
- kind: "channel",
10
- id: channelId
11
- }
12
- };
13
- }
14
- function createDiscordSendReceiptFromResults(params) {
15
- const receipt = createMessageReceiptFromOutboundResults({
16
- results: attachChannelToResults("discord", params.results),
17
- threadId: params.threadId
18
- });
19
- return {
20
- ...receipt,
21
- parts: receipt.parts.map(({ platformMessageId, kind, threadId, replyToId, raw }, index) => ({
22
- platformMessageId,
23
- kind,
24
- index,
25
- threadId,
26
- replyToId,
27
- raw
28
- }))
29
- };
30
- }
31
- function createDiscordSendReceipt(params) {
32
- return createMessageReceiptFromOutboundResults({
33
- results: params.platformMessageIds.map((messageId) => messageId.trim()).filter((messageId) => messageId && messageId !== "unknown").map((messageId, index) => {
34
- const result = {
35
- channel: "discord",
36
- messageId
37
- };
38
- if (params.channelId) result.channelId = params.channelId;
39
- if (params.reply?.scope === "first" && index === 0) {
40
- const rawResult = {
41
- channel: "discord",
42
- messageId
43
- };
44
- if (params.channelId) rawResult.channelId = params.channelId;
45
- result.receipt = createMessageReceiptFromOutboundResults({
46
- results: [rawResult],
47
- kind: params.kind,
48
- threadId: params.threadId,
49
- replyToId: params.reply.messageId
50
- });
51
- }
52
- return result;
53
- }),
54
- kind: params.kind,
55
- threadId: params.threadId,
56
- replyToId: params.reply?.scope === "all" ? params.reply.messageId : void 0
57
- });
58
- }
59
- function createDiscordSendResult(params) {
60
- const messageId = params.result.id || "unknown";
61
- const channelId = params.result.channel_id ?? params.fallbackChannelId;
62
- const receiptParams = {
63
- platformMessageIds: params.result.platformMessageIds?.length ? params.result.platformMessageIds : [messageId],
64
- channelId,
65
- kind: params.kind
66
- };
67
- if (params.threadId != null) receiptParams.threadId = String(params.threadId);
68
- if (params.reply) receiptParams.reply = params.reply;
69
- return {
70
- messageId,
71
- channelId,
72
- receipt: createDiscordSendReceipt(receiptParams)
73
- };
74
- }
75
- //#endregion
76
- export { toDiscordOutboundDeliveryResult as i, createDiscordSendReceiptFromResults as n, createDiscordSendResult as r, createDiscordSendReceipt as t };
@@ -1,110 +0,0 @@
1
- import { c as resolveDiscordAccount, u as resolveDiscordAccountConfig } from "./accounts-DNl-oCEw.js";
2
- import { i as removeReactionDiscord } from "./send.reactions-gmJ6yFPo.js";
3
- import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/routing";
4
- import { listAgentIds, resolveAgentConfig } from "openclaw/plugin-sdk/agent-scope-runtime";
5
- import { DEFAULT_EMOJIS } from "openclaw/plugin-sdk/channel-feedback";
6
- //#region extensions/discord/src/subagent-progress.ts
7
- const PROGRESS_STORE_TTL_MS = 10080 * 6e4;
8
- const MAX_TRACKED_RUNS = 4096;
9
- const RETRY_BASE_DELAY_MS = 1e3;
10
- const RETRY_MAX_DELAY_MS = 60 * 6e4;
11
- const RETRY_MAX_ATTEMPTS = 12;
12
- const HISTORICAL_RUNNING_EMOJIS = /* @__PURE__ */ new Set([
13
- "1️⃣",
14
- "2️⃣",
15
- "3️⃣",
16
- "4️⃣",
17
- "5️⃣",
18
- "6️⃣",
19
- "7️⃣",
20
- "8️⃣",
21
- "9️⃣",
22
- "🔟"
23
- ]);
24
- const recoveryRetries = /* @__PURE__ */ new Map();
25
- function logFailure(api, action, error) {
26
- const message = error instanceof Error ? error.message : String(error);
27
- api.logger.debug?.(`discord retired subagent progress ${action} failed: ${message}`);
28
- }
29
- function reservedReactionEmojis(api, accountAckReaction) {
30
- const reserved = new Set(Object.values(DEFAULT_EMOJIS));
31
- for (const emoji of [api.config.messages?.ackReaction, accountAckReaction]) if (emoji?.trim()) reserved.add(emoji.trim());
32
- for (const agentId of listAgentIds(api.config)) {
33
- const emoji = resolveAgentConfig(api.config, agentId)?.identity?.emoji?.trim();
34
- if (emoji) reserved.add(emoji);
35
- }
36
- return reserved;
37
- }
38
- function clearRecoveryRetry(api) {
39
- const retry = recoveryRetries.get(api);
40
- if (retry?.timer) clearTimeout(retry.timer);
41
- recoveryRetries.delete(api);
42
- }
43
- function scheduleRecoveryRetry(api) {
44
- const retry = recoveryRetries.get(api) ?? { attempts: 0 };
45
- if (retry.timer || retry.attempts >= RETRY_MAX_ATTEMPTS) return;
46
- const delayMs = Math.min(RETRY_BASE_DELAY_MS * 2 ** retry.attempts, RETRY_MAX_DELAY_MS);
47
- retry.attempts += 1;
48
- retry.timer = setTimeout(() => {
49
- retry.timer = void 0;
50
- recoverDiscordSubagentProgress(api);
51
- }, delayMs);
52
- retry.timer.unref?.();
53
- recoveryRetries.set(api, retry);
54
- }
55
- async function cleanPersistedReaction(api, store, entry) {
56
- try {
57
- if (entry.value.accountId !== DEFAULT_ACCOUNT_ID && !resolveDiscordAccountConfig(api.config, entry.value.accountId)) return false;
58
- const account = resolveDiscordAccount({
59
- cfg: api.config,
60
- accountId: entry.value.accountId
61
- });
62
- if (!account.enabled || account.tokenStatus !== "available") return false;
63
- const emoji = entry.value.runningEmoji;
64
- if (emoji && HISTORICAL_RUNNING_EMOJIS.has(emoji) && !reservedReactionEmojis(api, account.config.ackReaction).has(emoji)) await removeReactionDiscord(entry.value.channelId, entry.value.messageId, emoji, {
65
- cfg: api.config,
66
- accountId: entry.value.accountId
67
- });
68
- await store.consume(entry.key);
69
- return true;
70
- } catch (error) {
71
- logFailure(api, "startup cleanup", error);
72
- return false;
73
- }
74
- }
75
- async function recoverDiscordSubagentProgressImpl(api) {
76
- let store;
77
- try {
78
- store = api.runtime.state.openKeyedStore({
79
- namespace: "subagent-progress",
80
- maxEntries: MAX_TRACKED_RUNS,
81
- overflowPolicy: "reject-new",
82
- defaultTtlMs: PROGRESS_STORE_TTL_MS
83
- });
84
- } catch (error) {
85
- logFailure(api, "state store open", error);
86
- scheduleRecoveryRetry(api);
87
- return;
88
- }
89
- let entries;
90
- try {
91
- entries = await store.entries();
92
- } catch (error) {
93
- logFailure(api, "startup recovery list", error);
94
- scheduleRecoveryRetry(api);
95
- return;
96
- }
97
- let retryNeeded = false;
98
- for (const entry of entries) if (!await cleanPersistedReaction(api, store, entry)) retryNeeded = true;
99
- if (retryNeeded) scheduleRecoveryRetry(api);
100
- else clearRecoveryRetry(api);
101
- }
102
- function resetDiscordSubagentProgressForTest() {
103
- for (const [api, retry] of recoveryRetries) {
104
- if (retry.timer) clearTimeout(retry.timer);
105
- recoveryRetries.delete(api);
106
- }
107
- }
108
- const recoverDiscordSubagentProgress = Object.assign(recoverDiscordSubagentProgressImpl, { resetForTest: resetDiscordSubagentProgressForTest });
109
- //#endregion
110
- export { recoverDiscordSubagentProgress };
@@ -1,3 +0,0 @@
1
- import "./accounts-DNl-oCEw.js";
2
- import "./target-resolver-DIXShHaZ.js";
3
- export {};
@@ -1,2 +0,0 @@
1
- export declare function IsIdnLabel(value: string): boolean;
2
- export declare function IsLabel(value: string): boolean;
@@ -1,246 +0,0 @@
1
- import { Unreachable } from '../system/unreachable/index.mjs';
2
- import * as Puny from './_puny.mjs';
3
- // ------------------------------------------------------------------
4
- // Unicode General Category Helper (RFC 5892)
5
- // ------------------------------------------------------------------
6
- function IsNonspacingMark(cp) {
7
- return /\p{Mn}/u.test(String.fromCodePoint(cp));
8
- }
9
- function IsSpacingCombiningMark(cp) {
10
- return /\p{Mc}/u.test(String.fromCodePoint(cp));
11
- }
12
- function IsEnclosingMark(cp) {
13
- return /\p{Me}/u.test(String.fromCodePoint(cp));
14
- }
15
- function IsCombiningMark(cp) {
16
- return IsNonspacingMark(cp) || IsSpacingCombiningMark(cp) || IsEnclosingMark(cp);
17
- }
18
- // ------------------------------------------------------------------
19
- // RFC 5892 §2.6 DISALLOWED exceptions
20
- //
21
- // https://tools.ietf.org/html/rfc5892#section-2.6
22
- // ------------------------------------------------------------------
23
- const RFC5892_DISALLOWED = new Set([
24
- 0x0640, // ARABIC TATWEEL
25
- 0x07fa, // NKO LAJANYALAN
26
- 0x302e, // HANGUL SINGLE DOT TONE MARK
27
- 0x302f, // HANGUL DOUBLE DOT TONE MARK
28
- 0x3031, // VERTICAL KANA REPEAT MARK
29
- 0x3032, // VERTICAL KANA REPEAT WITH VOICED ITERATION MARK
30
- 0x3033, // VERTICAL KANA REPEAT MARK UPPER HALF
31
- 0x3034, // VERTICAL KANA REPEAT WITH VOICED ITERATION MARK UPPER HALF
32
- 0x3035, // VERTICAL KANA REPEAT MARK LOWER HALF
33
- 0x303b // VERTICAL IDEOGRAPHIC ITERATION MARK
34
- ]);
35
- // ------------------------------------------------------------------
36
- // A set of Virama (halant) code points used to validate CONTEXTJ
37
- // rules (RFC 5892 Appendix A.1). These characters allow a subsequent
38
- // Zero Width Non-Joiner (U+200C) or Zero Width Joiner (U+200D) to
39
- // be valid in a label.
40
- // ------------------------------------------------------------------
41
- const VIRAMA_CPS = new Set([
42
- 0x094d,
43
- 0x09cd,
44
- 0x0a4d,
45
- 0x0acd,
46
- 0x0b4d,
47
- 0x0bcd,
48
- 0x0c4d,
49
- 0x0ccd,
50
- 0x0d3b,
51
- 0x0d3c,
52
- 0x0d4d,
53
- 0x0dca,
54
- 0x1b44,
55
- 0x1baa,
56
- 0x1bab,
57
- 0xa9c0,
58
- 0x11046,
59
- 0x1107f,
60
- 0x110b9,
61
- 0x11133,
62
- 0x11134,
63
- 0x111c0,
64
- 0x11235,
65
- 0x1134d,
66
- 0x11442,
67
- 0x114c2,
68
- 0x115bf,
69
- 0x1163f,
70
- 0x116b6,
71
- 0x11c3f,
72
- 0x11d44,
73
- 0x11d45
74
- ]);
75
- // ------------------------------------------------------------------
76
- // Guards for CONTEXTO rules (RFC 5892 Appendix A)
77
- // ------------------------------------------------------------------
78
- function IsGreek(cp) {
79
- return /\p{Script=Greek}/u.test(String.fromCodePoint(cp));
80
- }
81
- function IsHebrew(cp) {
82
- return /\p{Script=Hebrew}/u.test(String.fromCodePoint(cp));
83
- }
84
- function IsHiragana(cp) {
85
- return /\p{Script=Hiragana}/u.test(String.fromCodePoint(cp));
86
- }
87
- function IsKatakana(cp) {
88
- return /\p{Script=Katakana}/u.test(String.fromCodePoint(cp));
89
- }
90
- function IsHan(cp) {
91
- return /\p{Script=Han}/u.test(String.fromCodePoint(cp));
92
- }
93
- function IsArabicIndicDigit(cp) {
94
- return cp >= 0x0660 && cp <= 0x0669;
95
- }
96
- function IsExtendedArabicIndicDigit(cp) {
97
- return cp >= 0x06f0 && cp <= 0x06f9;
98
- }
99
- function IsVirama(cp) {
100
- return VIRAMA_CPS.has(cp);
101
- }
102
- // ------------------------------------------------------------------
103
- // IsUnicodeLabel
104
- // ------------------------------------------------------------------
105
- function IsUnicodeLabel(value) {
106
- // deno-coverage-ignore-start - unable to reach via format guards
107
- if (value.length === 0)
108
- return Unreachable(); // false
109
- // deno-coverage-ignore-stop
110
- // Use spread to handle surrogate pairs and provide O(1) neighbor access
111
- const cps = [...value].map((c) => c.codePointAt(0));
112
- const len = cps.length;
113
- // RFC 5891 §4.2.3.2: Hyphen rules
114
- if (cps[0] === 0x2d || cps[len - 1] === 0x2d)
115
- return false;
116
- if (len >= 4 && cps[2] === 0x2d && cps[3] === 0x2d)
117
- return false;
118
- // RFC 5891 §4.2.3.2 - Must not begin with a combining mark
119
- if (IsCombiningMark(cps[0]))
120
- return false;
121
- let hasJapanese = false;
122
- let hasArabicIndic = false;
123
- let hasExtendedArabicIndic = false;
124
- for (let i = 0; i < len; i++) {
125
- const cp = cps[i];
126
- // 1. DISALLOWED exceptions
127
- if (RFC5892_DISALLOWED.has(cp))
128
- return false;
129
- // 2. Collect Flags
130
- if (IsHiragana(cp) || IsKatakana(cp) || IsHan(cp))
131
- hasJapanese = true;
132
- if (IsArabicIndicDigit(cp))
133
- hasArabicIndic = true;
134
- if (IsExtendedArabicIndicDigit(cp))
135
- hasExtendedArabicIndic = true;
136
- // 3. CONTEXTO / CONTEXTJ Neighbor Rules
137
- const prev = cps[i - 1], next = cps[i + 1];
138
- switch (cp) {
139
- case 0x00b7:
140
- if (prev !== 0x006c || next !== 0x006c)
141
- return false;
142
- break; // MIDDLE DOT (Catalan)
143
- case 0x0375:
144
- if (next === undefined || !IsGreek(next))
145
- return false;
146
- break; // Greek KERAIA
147
- case 0x05f3:
148
- case 0x05f4:
149
- if (prev === undefined || !IsHebrew(prev))
150
- return false;
151
- break; // Hebrew GERESH
152
- case 0x200c: // ZWNJ - RFC 5892 Appendix A.1
153
- // Note: Full validation requires a Unicode joining type table. We reject
154
- // only when preceded by ASCII (U+0000-U+007F), which can never satisfy
155
- // the Virama or cursive-joining rules.
156
- if (prev === undefined || (prev < 0x0080 && !IsVirama(prev)))
157
- return false;
158
- break;
159
- case 0x200d: // ZWJ - RFC 5892 Appendix A.2
160
- if (prev === undefined || !IsVirama(prev))
161
- return false;
162
- break;
163
- case 0x30fb: /* Checked at end via hasJapanese */
164
- break; // KATAKANA MIDDLE DOT
165
- }
166
- }
167
- // 4. Global Context Validations (Post-loop)
168
- // RFC 5892 Appendix A.7 - Katakana Middle Dot requirement
169
- if (value.includes('\u30fb') && !hasJapanese)
170
- return false;
171
- // RFC 5892 Appendix A.8/A.9 - Mixing Arabic Digits
172
- if (hasArabicIndic && hasExtendedArabicIndic)
173
- return false;
174
- return true;
175
- }
176
- // ------------------------------------------------------------------
177
- // IsAsciiLabel
178
- // ------------------------------------------------------------------
179
- function IsAsciiLabel(value) {
180
- // Must not start or end with a hyphen
181
- if (value.charCodeAt(0) === 45 || value.charCodeAt(value.length - 1) === 45)
182
- return false;
183
- // RFC 5891 §4.2.3.1 : "--" at positions 3-4 is reserved for A-labels only
184
- if (value.length >= 4 && value.charCodeAt(2) === 45 && value.charCodeAt(3) === 45)
185
- return false;
186
- // All characters must be alphanumeric or hyphen
187
- for (let i = 0; i < value.length; i++) {
188
- const ch = value.charCodeAt(i);
189
- if (!((ch >= 97 && ch <= 122) || // a-z
190
- (ch >= 65 && ch <= 90) || // A-Z
191
- (ch >= 48 && ch <= 57) || // 0-9
192
- ch === 45 // '-'
193
- ))
194
- return false;
195
- }
196
- return true;
197
- }
198
- // ------------------------------------------------------------------
199
- // IsPunyLabel
200
- // ------------------------------------------------------------------
201
- function IsPuny(value) {
202
- return value.toLowerCase().startsWith('xn--');
203
- }
204
- function IsPunyLabel(value) {
205
- try {
206
- const payload = value.slice(4).toLowerCase();
207
- // 1. Structural Validation (RFC 3492 syntax)
208
- //
209
- // If the payload contains a hyphen, it MUST be a delimiter separating basic
210
- // ASCII characters from the variable-length integers. A payload consisting
211
- // of ONLY a hyphen or starting with multiple hyphens without basic ASCII
212
- // characters (like "-9uc") is fundamentally malformed.
213
- //
214
- const lastHyphen = payload.lastIndexOf('-');
215
- if (lastHyphen === 0) {
216
- // Catches "-9uc" right here because the delimiter is at index 0, meaning 0
217
- // basic ASCII characters preceded it, which is non-canonical.
218
- return false;
219
- }
220
- // 2. Decode the payload
221
- const decoded = Puny.Decode(payload);
222
- if (!decoded)
223
- return false;
224
- // 3. Validate the output rules against RFC 5892
225
- return IsUnicodeLabel(decoded);
226
- }
227
- catch {
228
- return false;
229
- }
230
- }
231
- // ------------------------------------------------------------------
232
- // IsIdnLabel
233
- // ------------------------------------------------------------------
234
- export function IsIdnLabel(value) {
235
- if (value.length === 0 || value.length > 63)
236
- return false;
237
- return IsPuny(value) ? IsPunyLabel(value) : IsUnicodeLabel(value);
238
- }
239
- // ------------------------------------------------------------------
240
- // IsLabel
241
- // ------------------------------------------------------------------
242
- export function IsLabel(value) {
243
- if (value.length === 0 || value.length > 63)
244
- return false;
245
- return IsPuny(value) ? IsPunyLabel(value) : IsAsciiLabel(value);
246
- }
@@ -1 +0,0 @@
1
- export declare function Decode(value: string): string;
@@ -1,77 +0,0 @@
1
- import { Unreachable } from '../system/unreachable/index.mjs';
2
- // ------------------------------------------------------------------
3
- // PunyCode (RFC 3492)
4
- // ------------------------------------------------------------------
5
- const PUNYCODE_BASE = 36;
6
- const PUNYCODE_TMIN = 1;
7
- const PUNYCODE_TMAX = 26;
8
- const PUNYCODE_SKEW = 38;
9
- const PUNYCODE_DAMP = 700;
10
- const PUNYCODE_INITIAL_BIAS = 72;
11
- const PUNYCODE_INITIAL_N = 128;
12
- // ------------------------------------------------------------------
13
- // Adapt
14
- // ------------------------------------------------------------------
15
- function Adapt(delta, numPoints, firstTime) {
16
- delta = firstTime ? Math.floor(delta / PUNYCODE_DAMP) : delta >> 1;
17
- delta += Math.floor(delta / numPoints);
18
- let k = 0;
19
- while (delta > (((PUNYCODE_BASE - PUNYCODE_TMIN) * PUNYCODE_TMAX) >> 1)) {
20
- delta = Math.floor(delta / (PUNYCODE_BASE - PUNYCODE_TMIN));
21
- k += PUNYCODE_BASE;
22
- }
23
- return k + Math.floor(((PUNYCODE_BASE - PUNYCODE_TMIN + 1) * delta) / (delta + PUNYCODE_SKEW));
24
- }
25
- // ------------------------------------------------------------------
26
- // Decode
27
- // ------------------------------------------------------------------
28
- export function Decode(value) {
29
- const output = [];
30
- let n = PUNYCODE_INITIAL_N;
31
- let i = 0;
32
- let bias = PUNYCODE_INITIAL_BIAS;
33
- const delimIdx = value.lastIndexOf('-');
34
- if (delimIdx > 0) {
35
- for (let j = 0; j < delimIdx; j++) {
36
- const cp = value.charCodeAt(j);
37
- if (cp >= 128)
38
- throw new Error('Invalid punycode: non-basic before delimiter');
39
- output.push(cp);
40
- }
41
- }
42
- let inIdx = delimIdx < 0 ? 0 : delimIdx + 1;
43
- while (inIdx < value.length) {
44
- const oldi = i;
45
- let w = 1;
46
- let k = PUNYCODE_BASE;
47
- while (true) {
48
- if (inIdx >= value.length)
49
- throw new Error('Invalid punycode: unexpected end of input');
50
- const ch = value.charCodeAt(inIdx++);
51
- let digit;
52
- if (ch >= 0x61 && ch <= 0x7a)
53
- digit = ch - 0x61; // a-z => 0-25
54
- else if (ch >= 0x30 && ch <= 0x39)
55
- digit = ch - 0x30 + 26; // 0-9 => 26-35
56
- // deno-coverage-ignore-start - _idna.ts maps input to lowercase, so we can't reach here
57
- else if (ch >= 0x41 && ch <= 0x5a)
58
- Unreachable(); // digit = ch - 0x41 // A-Z => 0-25
59
- // deno-coverage-ignore-stop
60
- else
61
- throw new Error('Invalid punycode: bad digit character');
62
- i += digit * w;
63
- const t = k <= bias ? PUNYCODE_TMIN : k >= bias + PUNYCODE_TMAX ? PUNYCODE_TMAX : k - bias;
64
- if (digit < t)
65
- break;
66
- w *= PUNYCODE_BASE - t;
67
- k += PUNYCODE_BASE;
68
- }
69
- const outLen = output.length + 1;
70
- bias = Adapt(i - oldi, outLen, oldi === 0);
71
- n += Math.floor(i / outLen);
72
- i %= outLen;
73
- output.splice(i, 0, n);
74
- i++;
75
- }
76
- return globalThis.String.fromCodePoint(...output);
77
- }
@@ -1,3 +0,0 @@
1
- import * as Schema from '../types/index.mjs';
2
- export declare function Ref(schema: Schema.XSchemaObject, ref: string): Schema.XSchema | undefined;
3
- export declare function DynamicRef(root: Schema.XSchemaObject, base: Schema.XSchemaObject, dynamicRef: Schema.XDynamicRef, dynamicAnchors: Schema.XDynamicAnchor[]): Schema.XSchema | undefined;