@openclaw/discord 2026.8.1-beta.3 → 2026.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (290) hide show
  1. package/dist/account-inspect-BY-ve3yH.js +45 -0
  2. package/dist/account-inspect-api.js +1 -1
  3. package/dist/{accounts-DNl-oCEw.js → accounts-CwJQoLjM.js} +87 -162
  4. package/dist/action-runtime-api.js +1 -1
  5. package/dist/{activities-api-KCBAmWxD.js → activities-api-CkKcHUB6.js} +14 -12
  6. package/dist/activities-api.js +1 -1
  7. package/dist/{allow-list-BDMimASD.js → allow-list-C2JuH-R0.js} +10 -6
  8. package/dist/{api-DNVbJyEy.js → api-BfmEP6wp.js} +6 -5
  9. package/dist/api.js +18 -18
  10. package/dist/{approval-handler.runtime-B12RCYr8.js → approval-handler.runtime-DZM6Kt1Z.js} +30 -106
  11. package/dist/{audit-Yc7eZDd6.js → audit-DIbQA4VT.js} +8 -7
  12. package/dist/{channel-cXYzGc4L.js → channel-CarzU3bg.js} +25 -25
  13. package/dist/{channel-actions.runtime-CODTvo7c.js → channel-actions.runtime-B2wMqeVK.js} +60 -57
  14. package/dist/channel-config-api.js +1 -1
  15. package/dist/channel-plugin-api.js +1 -1
  16. package/dist/channel-type-CVLZyGYS.js +7 -0
  17. package/dist/{channel.setup-CSiwnMgs.js → channel.setup-z_ewMVa9.js} +18 -18
  18. package/dist/{components-ezGKo_Yh.js → components-gvRA0oaI.js} +33 -29
  19. package/dist/{config-schema-DC5kDtQ5.js → config-schema-B797-Spt.js} +21 -14
  20. package/dist/{conversation-binding-route-D6rCQ5S0.js → conversation-binding-route-DPpBRpYI.js} +1 -1
  21. package/dist/{directory-config-XyCfoqLg.js → directory-config-AA8wQx0D.js} +2 -2
  22. package/dist/directory-contract-api.js +1 -1
  23. package/dist/{directory-live-Df0NbFJB.js → directory-live-D_kFz_Fj.js} +4 -4
  24. package/dist/{doctor-DYY31GrO.js → doctor-QQTOkBfW.js} +5 -5
  25. package/dist/{doctor-contract-DsWvKIXF.js → doctor-contract-Co5vRCZ6.js} +9 -6
  26. package/dist/doctor-contract-api.js +4 -3
  27. package/dist/{handle-action.guild-admin-6Tvvinsa.js → handle-action.guild-admin-Cc88ZGon.js} +9 -5
  28. package/dist/index.js +1 -1
  29. package/dist/ingress-identity-BCzfPPYM.js +60 -0
  30. package/dist/{message-handler-B61q5MOF.js → message-handler-CAeEpqWo.js} +14 -10
  31. package/dist/{message-handler.preflight-Bzg_Hawz.js → message-handler.preflight-CoKoE3dY.js} +32 -91
  32. package/dist/{message-handler.process--4_712Ec.js → message-handler.process-cdIJ_fDT.js} +99 -123
  33. package/dist/{message-utils-BXLLnFl6.js → message-text-C0K4-fkg.js} +41 -34
  34. package/dist/{outbound-adapter-DxHTOqiN.js → outbound-adapter-Ch0At5Ra.js} +85 -78
  35. package/dist/{outbound-components-B2PL0ooH.js → outbound-components-Bnt_7x7r.js} +5 -4
  36. package/dist/outbound-session-route-CzzerX2K.js +668 -0
  37. package/dist/{owner-access-Bg41VzAf.js → owner-access-yc1sX7Gx.js} +7 -6
  38. package/dist/{pluralkit-dUl4v1X3.js → pluralkit-B3cUVI7i.js} +2 -2
  39. package/dist/{probe-BTdtVRwU.js → probe-3ovFAp3b.js} +3 -3
  40. package/dist/{probe.runtime-Dq5-PRKT.js → probe.runtime-BckHn3cJ.js} +1 -1
  41. package/dist/{provider-DlK_ynqt.js → provider-CjI8BSzS.js} +511 -342
  42. package/dist/{provider-session.runtime-CvvphHvs.js → provider-session.runtime-DdKRMcE9.js} +3 -3
  43. package/dist/provider.runtime-Bo1WbLLr.js +2 -0
  44. package/dist/{realtime-session.runtime-ysbMG8v7.js → realtime-session.runtime-37IC-p5K.js} +110 -126
  45. package/dist/{resolve-allowlist-common-DIVXbD1P.js → resolve-allowlist-common-BJ5UZNNT.js} +3 -3
  46. package/dist/{resolve-channels-CGeUoIqb.js → resolve-channels-BexR2eUn.js} +6 -5
  47. package/dist/{resolve-users-BtKxLUZv.js → resolve-users-BtXBCH5W.js} +5 -4
  48. package/dist/{retry-after-DdLPmPoa.js → retry-after-BrLjLUJi.js} +2 -1
  49. package/dist/{retry-DNsVTeTo.js → retry-t5RcEsPk.js} +237 -15
  50. package/dist/{runtime-CQovMsH3.js → runtime-BNlDfLwS.js} +2 -2
  51. package/dist/{runtime-D71_VFLr.js → runtime-DydyfxST.js} +182 -131
  52. package/dist/runtime-api.js +19 -26
  53. package/dist/{secret-config-contract-B3i6WxV5.js → secret-config-contract-DFu9hfU8.js} +14 -6
  54. package/dist/secret-contract-api.js +1 -1
  55. package/dist/{security-audit-BfJhAXZp.js → security-audit-DKfK-iPY.js} +10 -11
  56. package/dist/security-audit-contract-api.js +1 -1
  57. package/dist/{security-audit.runtime-BVKF9VtY.js → security-audit.runtime-sKZyKgpx.js} +1 -1
  58. package/dist/{send-rQIffSYu.js → send-mTKSBdmZ.js} +149 -58
  59. package/dist/{send.components-ChK1wS7w.js → send.components-nsPnc7kK.js} +29 -30
  60. package/dist/{send.outbound-HIkgji_7.js → send.outbound-CaOs9Zy1.js} +87 -84
  61. package/dist/{send.shared-B3fpaLWJ.js → send.shared-BJHt0Vyf.js} +55 -33
  62. package/dist/{sender-identity-BJtfyise.js → sender-identity-Dt0imZyY.js} +1 -1
  63. package/dist/setup-plugin-api.js +1 -1
  64. package/dist/{shared-CaAaoksy.js → shared-BNesVA4P.js} +43 -18
  65. package/dist/{subagent-hooks-CNT2ZJTJ.js → subagent-hooks-IeZVPLGj.js} +2 -2
  66. package/dist/subagent-hooks-api.js +1 -6
  67. package/dist/{system-events-Nuwoq_au.js → system-events-Be5EJI3b.js} +2 -2
  68. package/dist/{target-resolver-DIXShHaZ.js → target-resolver-C0MnwEki.js} +6 -5
  69. package/dist/targets-DQSye1Rv.js +3 -0
  70. package/dist/{thread-bindings-VlymUnbz.js → thread-bindings-wECUSIIG.js} +6 -6
  71. package/dist/{thread-bindings.manager-CngsgErq.js → thread-bindings.manager-B-3UHCc1.js} +31 -32
  72. package/dist/{thread-bindings.session-updates-CJb-BpPL.js → thread-bindings.session-updates-CC7HoQvt.js} +2 -1
  73. package/dist/{threading-DU6pgeGm.js → threading-te5ADPQI.js} +51 -27
  74. package/dist/{timeouts-B9cy6RvQ.js → timeouts-D86uWLt_.js} +1 -1
  75. package/dist/{transcripts-source-DeIMNbRh.js → transcripts-source-DkUhR7YK.js} +9 -4
  76. package/dist/transcripts-source-api.js +1 -1
  77. package/dist/{typing-oLiS5Z13.js → typing-DAwJF5VT.js} +2 -2
  78. package/dist/{voice-runtime-CjNFaynA.js → voice-runtime-COyYYTDD.js} +418 -74
  79. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/README.md +1 -1
  80. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/conforms.d.ts +2 -0
  81. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/package.json +3 -3
  82. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubArray.d.ts +2 -0
  83. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubObject.d.ts +2 -0
  84. package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubString.d.ts +2 -0
  85. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/README.md +19 -19
  86. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v1.js +7 -3
  87. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v7.js +5 -2
  88. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v1.js +7 -3
  89. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v7.js +5 -2
  90. package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/package.json +4 -3
  91. package/node_modules/@discordjs/voice/node_modules/@types/node/README.md +1 -1
  92. package/node_modules/@discordjs/voice/node_modules/@types/node/child_process.d.ts +0 -1
  93. package/node_modules/@discordjs/voice/node_modules/@types/node/crypto.d.ts +6 -6
  94. package/node_modules/@discordjs/voice/node_modules/@types/node/dns/promises.d.ts +5 -5
  95. package/node_modules/@discordjs/voice/node_modules/@types/node/dns.d.ts +5 -5
  96. package/node_modules/@discordjs/voice/node_modules/@types/node/fs.d.ts +7 -0
  97. package/node_modules/@discordjs/voice/node_modules/@types/node/http.d.ts +30 -0
  98. package/node_modules/@discordjs/voice/node_modules/@types/node/http2.d.ts +4 -4
  99. package/node_modules/@discordjs/voice/node_modules/@types/node/os.d.ts +30 -30
  100. package/node_modules/@discordjs/voice/node_modules/@types/node/package.json +2 -2
  101. package/node_modules/@discordjs/voice/node_modules/@types/node/perf_hooks.d.ts +2 -1
  102. package/node_modules/@discordjs/voice/node_modules/@types/node/process.d.ts +42 -43
  103. package/node_modules/@discordjs/voice/node_modules/@types/node/quic.d.ts +1049 -84
  104. package/node_modules/@discordjs/voice/node_modules/@types/node/sqlite.d.ts +14 -1
  105. package/node_modules/@discordjs/voice/node_modules/@types/node/stream/iter.d.ts +3 -2
  106. package/node_modules/@discordjs/voice/node_modules/@types/node/test.d.ts +61 -0
  107. package/node_modules/@discordjs/voice/node_modules/@types/node/v8.d.ts +20 -23
  108. package/node_modules/discord-api-types/CHANGELOG.md +8 -0
  109. package/node_modules/discord-api-types/package.json +4 -4
  110. package/node_modules/discord-api-types/payloads/v10/channel.d.ts +2 -2
  111. package/node_modules/discord-api-types/payloads/v10/channel.d.ts.map +1 -1
  112. package/node_modules/discord-api-types/payloads/v10/gateway.d.ts +4 -0
  113. package/node_modules/discord-api-types/payloads/v10/gateway.d.ts.map +1 -1
  114. package/node_modules/discord-api-types/payloads/v10/gateway.js.map +1 -1
  115. package/node_modules/discord-api-types/payloads/v10/message.d.ts +4 -1
  116. package/node_modules/discord-api-types/payloads/v10/message.d.ts.map +1 -1
  117. package/node_modules/discord-api-types/payloads/v10/message.js +1 -0
  118. package/node_modules/discord-api-types/payloads/v10/message.js.map +1 -1
  119. package/node_modules/discord-api-types/payloads/v9/channel.d.ts +2 -2
  120. package/node_modules/discord-api-types/payloads/v9/channel.d.ts.map +1 -1
  121. package/node_modules/discord-api-types/payloads/v9/gateway.d.ts +4 -0
  122. package/node_modules/discord-api-types/payloads/v9/gateway.d.ts.map +1 -1
  123. package/node_modules/discord-api-types/payloads/v9/gateway.js.map +1 -1
  124. package/node_modules/discord-api-types/payloads/v9/message.d.ts +4 -1
  125. package/node_modules/discord-api-types/payloads/v9/message.d.ts.map +1 -1
  126. package/node_modules/discord-api-types/payloads/v9/message.js +1 -0
  127. package/node_modules/discord-api-types/payloads/v9/message.js.map +1 -1
  128. package/node_modules/typebox/build/format/date.d.mts +1 -1
  129. package/node_modules/typebox/build/format/date.mjs +1 -1
  130. package/node_modules/typebox/build/format/date_time.d.mts +2 -2
  131. package/node_modules/typebox/build/format/date_time.mjs +3 -3
  132. package/node_modules/typebox/build/format/email.d.mts +1 -1
  133. package/node_modules/typebox/build/format/email.mjs +2 -2
  134. package/node_modules/typebox/build/format/hostname.mjs +2 -10
  135. package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
  136. package/node_modules/typebox/build/format/idn_email.mjs +3 -3
  137. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
  138. package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
  139. package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
  140. package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
  141. package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
  142. package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
  143. package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
  144. package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
  145. package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
  146. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +41 -0
  147. package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
  148. package/node_modules/typebox/build/format/idna/index.mjs +2 -0
  149. package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
  150. package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
  151. package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
  152. package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
  153. package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
  154. package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
  155. package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
  156. package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
  157. package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
  158. package/node_modules/typebox/build/format/ipv4.mjs +2 -32
  159. package/node_modules/typebox/build/format/ipv6.mjs +2 -61
  160. package/node_modules/typebox/build/format/iri.d.mts +2 -2
  161. package/node_modules/typebox/build/format/iri.mjs +26 -8
  162. package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
  163. package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
  164. package/node_modules/typebox/build/format/regex.d.mts +1 -2
  165. package/node_modules/typebox/build/format/regex.mjs +2 -6
  166. package/node_modules/typebox/build/format/time.d.mts +2 -2
  167. package/node_modules/typebox/build/format/time.mjs +19 -14
  168. package/node_modules/typebox/build/format/uri.d.mts +1 -1
  169. package/node_modules/typebox/build/format/uri.mjs +3 -130
  170. package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
  171. package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
  172. package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
  173. package/node_modules/typebox/build/format/uri_template.mjs +4 -5
  174. package/node_modules/typebox/build/format/url.d.mts +3 -3
  175. package/node_modules/typebox/build/format/url.mjs +4 -5
  176. package/node_modules/typebox/build/guard/emit.d.mts +3 -1
  177. package/node_modules/typebox/build/guard/emit.mjs +12 -5
  178. package/node_modules/typebox/build/guard/guard.d.mts +8 -2
  179. package/node_modules/typebox/build/guard/guard.mjs +25 -4
  180. package/node_modules/typebox/build/guard/string.d.mts +2 -2
  181. package/node_modules/typebox/build/guard/string.mjs +7 -7
  182. package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
  183. package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
  184. package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
  185. package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
  186. package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
  187. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
  188. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
  189. package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
  190. package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
  191. package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
  192. package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
  193. package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
  194. package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
  195. package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
  196. package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
  197. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
  198. package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
  199. package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
  200. package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
  201. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
  202. package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
  203. package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
  204. package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
  205. package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
  206. package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
  207. package/node_modules/typebox/build/schema/types/index.mjs +0 -2
  208. package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
  209. package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
  210. package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
  211. package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
  212. package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
  213. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
  214. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
  215. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
  216. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
  217. package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
  218. package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
  219. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
  220. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
  221. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
  222. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
  223. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
  224. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
  225. package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
  226. package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
  227. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
  228. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
  229. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
  230. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
  231. package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
  232. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
  233. package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
  234. package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
  235. package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
  236. package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
  237. package/node_modules/typebox/build/type/script/parser.mjs +27 -23
  238. package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
  239. package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
  240. package/node_modules/typebox/package.json +27 -27
  241. package/node_modules/typebox/readme.md +79 -82
  242. package/node_modules/undici/docs/docs/api/Client.md +21 -8
  243. package/node_modules/undici/lib/api/readable.js +33 -43
  244. package/node_modules/undici/lib/core/connect.js +16 -2
  245. package/node_modules/undici/lib/core/symbols.js +1 -0
  246. package/node_modules/undici/lib/dispatcher/client-h1.js +3 -3
  247. package/node_modules/undici/lib/dispatcher/client-h2.js +179 -10
  248. package/node_modules/undici/lib/dispatcher/client.js +74 -29
  249. package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +28 -6
  250. package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +15 -1
  251. package/node_modules/undici/lib/handler/retry-handler.js +7 -2
  252. package/node_modules/undici/lib/interceptor/cache.js +5 -2
  253. package/node_modules/undici/lib/interceptor/deduplicate.js +1 -1
  254. package/node_modules/undici/lib/mock/mock-utils.js +213 -24
  255. package/node_modules/undici/lib/util/cache.js +2 -4
  256. package/node_modules/undici/lib/web/websocket/websocket.js +22 -0
  257. package/node_modules/undici/package.json +1 -1
  258. package/node_modules/undici/types/client.d.ts +40 -0
  259. package/node_modules/ws/lib/permessage-deflate.js +3 -1
  260. package/node_modules/ws/package.json +1 -1
  261. package/openclaw.plugin.json +14 -6
  262. package/package.json +8 -8
  263. package/skills/discord/SKILL.md +1 -1
  264. package/dist/account-inspect-D5xmUpnj.js +0 -89
  265. package/dist/approval-message-safety-XGFPbDoI.js +0 -226
  266. package/dist/audit-core-BCX8UeFH.js +0 -105
  267. package/dist/channel-actions-Dr2QI8Bf.js +0 -212
  268. package/dist/inbound-event-delivery-De2qxTrP.js +0 -39
  269. package/dist/provider.runtime-CzKGRiAF.js +0 -2
  270. package/dist/runtime-api.actions.js +0 -3
  271. package/dist/runtime-api.lookup.js +0 -7
  272. package/dist/runtime-api.monitor-CzeTYF32.js +0 -6
  273. package/dist/runtime-api.monitor.js +0 -9
  274. package/dist/runtime-api.send.js +0 -7
  275. package/dist/runtime-api.threads.js +0 -5
  276. package/dist/sdk-runtime-37OU6_Yh.js +0 -369
  277. package/dist/send.reactions-gmJ6yFPo.js +0 -78
  278. package/dist/send.receipt-Cnhoautb.js +0 -76
  279. package/dist/subagent-progress-FPLqBY1s.js +0 -110
  280. package/dist/targets-B2pf49zc.js +0 -3
  281. package/node_modules/typebox/build/format/_idna.d.mts +0 -2
  282. package/node_modules/typebox/build/format/_idna.mjs +0 -246
  283. package/node_modules/typebox/build/format/_puny.d.mts +0 -1
  284. package/node_modules/typebox/build/format/_puny.mjs +0 -77
  285. package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
  286. package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
  287. package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
  288. package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
  289. package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
  290. package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
@@ -91,7 +91,7 @@ const User = Type.Object({ // const User = {
91
91
  // type: 'string',
92
92
  // format: 'email'
93
93
  // }
94
- // }
94
+ // },
95
95
  // required: [
96
96
  // 'id',
97
97
  // 'name',
@@ -111,24 +111,28 @@ type User = Type.Static<typeof User> // type User = {
111
111
 
112
112
  ## Script
113
113
 
114
- [Documentation](https://sinclairzx81.github.io/typebox/#/docs/script/overview) | [Example 1](https://www.typescriptlang.org/play/?target=99&module=7#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgFkIATAVwBtVKBjCAOwDO8BgEMYACzgBeREQB0AZW5RgYGAAoABpThxCaOADVU3GNABM0uAG84ZAFxw+rEMVRQANHCSPnr93AAvjp6REYmZlAAzFa2Dk4ubp7evonuXgBeqf5QQSH66Mam0AAssXbZSV4+CTmZlelwAO4NucGaAJTUdHAAIqhofMyofMIsHFy8gvC2DKgCkoFWyGiKyqoaohJemrr5YcawqGSxIbqQAsAwwPyORZElHmdO0CAi7HcR0FFPurqsADdPsUoOYQsFdAU4ABxVA4VAwKBIU5-OAA9zXbjzT5HMgAbQAur8-sAhsAsQJWoTwfsDFt3MB3ii-iJXMARjBgQ9ibpmMAMBhWAJUFzSjy4AI0NwOCIoKKoCUaZCwnMFszdABzOEgBFIxyw+GIpDit4wBnvRz0lTvGmdbr0ABKrFGoHQDtQGE4phufEoqvEcjA2DQsHZAjkWsNSMDwYxYbk6NDFLkV1QIHDQYgIeu80DEEu134MazcdzZD98wDmez8cjOqNxZrucTmNzqfTjdL4b4r3endDZYrC37OfDdd1SBH8Zb5LbZo71a7ckBU8H-tX4dN5vYG7kfIFQtQu-L68XA83Ym3u9ZxHZo2PQ6rsfPci31p3Z9HcklJhlUAftD0AoMBiOScAAJJ8Bg7gjFilCCnw3r8HAUAjMMUDqDqCyOCsR7AaB3AADwFBAGCMJWAB8HQ2CEWEBuODYzhSeIAAwEnmBY+nI5a6HREbahOCZxsxbFyD2UBvDuPFwHxDHRkx8ysexK7SXxb6Mju+6CsK3G0ZWr6Xu+cg3neMC6bx+nqX2P7Suwsq6YEQA) | [Example 2](https://www.typescriptlang.org/play/?target=99&module=7#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgFkIATAVwBtVKA7AQxFQBnMLwDG6BrxgALOAG9KcOKjKRYcURG6D4ANVSiY0AExwAvIiIA6APLEAVgZgAKOXDIAuS2isA5ViDEqFDOAJQANHBIXsg+-oHBYXAAvqGKyqrQ8Jraek7QAMzm3qi2Dk6u7jHW8UEhEVHVcQF1YZEAXk2ltYmhKWlKKmrZWjpw+obQACzFsaV2joaVniV+Lb2R0as99R1dawm7cADu+ztJqZTJ1HRwACKoaNzMqNzwTGyclDlj+rAqs2sCwqCiUkEEwBgwC0XkkMisEyMUCm4XS3GgIF47FhUmkCPyUAKqKUrAAbjj4YiTFc0j94ABxVA4VAwKBIQE+YFLUFwUnBKHiQT7ACCUCgvCQzj+MBUEXSwGewEFIrFEuccwOrVCaUudMYUmCwCxHPm5W56X4xGArxgFLxVORxLgzGAGAwrEEqDt+MmjvSwgMHF4UG9DqmNO+o3eQlkFg1XJcPIA5kyBKytozmemnZiZVAjdj9XmCxHaPQAEqsN6gdDl1AYTiGaHcSgMGNWMDYNCwa2CKwprNsjtd-m9qx8nuCqyQ1AgPudiDdqFCDsQCFQrTDxejldkVvthdLscDtNDw87vsTgUrmdzrdHlfoqCY9j3i9WPdtwR4889lcnlkzxHP9L1HKdb3nYDlz7Mk3xAj992-ODoKsXNDSxZCxxdN0PVKX8UM-A8oLHND8ww-Cx0ta03kw3dEJ-YiV1IgtaL7ANRCDKBWIQss4AAZRgKQlTgABJbgMGCV5xEod1uCbLQ4CgV4XhCARv32AShNEAAeQg0AgDBGBjAA+PoeTUvEAPTccwKEABtAAGABdVd12bBClAs-tU0ApAbMneznKsJ8Xw8uAvKsocryVQKXNgvdPPbZiMOw91PTCrzktfKibQypKDTI192M4hDkiAA) | [Challenge](test/typescript/readme.md)
114
+ [Documentation](https://sinclairzx81.github.io/typebox/#/docs/script/overview) | [Example 1](https://www.typescriptlang.org/play/?target=99&module=7#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgFkBDGAC0YgBMBXAG1WoBjCADsAzvGZs4AXkREAdAGVBUYGBgAKAAaU4cQmjgA1VIJjQALLLgBvOGQBccEdxDFUUADRwkz1+6ePgBe-m4e3nAA7mGBUHAAvnoGRCZmFlAAzDb2Ti7hQb6xESHFnonJhuim5tAATDkOZZF++XEV2gCU1HRwAOJQTGCswIJiHDz8QqIS-YPDo+NyyGjKqupaUqw+uvpVabCoZDnJ+pBiwDDAos41GZZepy7QIEy8t+nQmY-6+twAbh9alA6skkntUn1UDhUDAoEgTr84P9PFdBKgxB9DmQANoAXR+v2AIk4owxzXxYMqqSknmAb0RvyY7mAqBEMCB90J+lJGAw3DEqE5Vm5cDEaEEfCYUGFUEsVIhRgYGPYclsTwA5tCQLD4c4oTC4UhRa8YHS3s5aWo3lSutR9sqxKr5KslDAWKMADxVCAYOZDEZjHF4R2sPB4gB8+l6DpVjKRCcTSeTKZTvX0WsNerscAUecSotTReLJfTcFN5veObzCgqJfrDeTvQSQA) | [Example 2](https://www.typescriptlang.org/play/?target=99&module=7#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgFkBDGAC0YgBMBXAG1WoBjCADsAzvABqqQTGgAWOAF5ERAHQB5YgCsZMABQBvOGQBcqtGoBy3EMVRR9ASgA0cJOeSWbdh87cAXp7qPvaOrnAA7sHetmHOcAC+TpTC4lJ60ADMyhaomjp6RiYx+aF+ER551nEVgaU1vuFJKWkScNKy0ABMuV75WrqyxWbV5eFuVf2N8U4t1HRwAOJQTGCswIJiHDz8QqLt0rCoZH3qg0WGlHBwkGLAMMCi5p1yUPIu13Ai0CBMvC9MlAsp8btwAG6ArpQbqUZKpA7wJaoHCoGBQJBnSwXYZXG7ghyPQSoMQNACCUFWSH0RxgJ1cX2AIk4mxJ5MpTGp03GzhS8La8GYdKgwH+WIGhVxXyYdmAqBEMChbw+XxZGAw3DEqCVClBcDEaEEfCYUB170+-MRjBJ7BU0xxBjxcAA5iiQGiMeZkaj0Ug9X9haKAYwWA4g3CUpRCGhrWJbdUAMowFibAA80ZRGFjrAAfDd8wXC4sM9nck7CxXK1XqzX84sbq6fZ64MY1G2knra13u1363AA2H-uZW+3El8exPJ3X6IkgA)
115
115
 
116
- TypeBox includes a runtime scripting engine that can transform TypeScript definitions into JSON Schema. The engine is implemented symmetrically at runtime and inside TypeScript's type system. It supports many programmable type-level constructs such as Conditional, Mapped, Indexed, Generic, Distributive Conditional, and more. The engine is designed for TypeScript 7 but is supported in TypeScript 5 and above.
116
+ TypeBox includes a micro TypeScript engine that can transform TypeScript definitions to JSON Schema. The engine is fully type-safe and supports many programmable constructs including Conditional, Mapped, Indexed, Generics, Distributive Generics, and more.
117
117
 
118
118
  ### Example
119
119
 
120
- Syntax highlighting is available via the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=sinclairzx81.typebox-script)
120
+ Syntax highlighting is available via the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=sinclairzx81.typebox-script).
121
121
 
122
122
  ```typescript
123
- // Module
123
+ import Type from 'typebox'
124
+
125
+ // Math Module
126
+
124
127
  const Math = Type.Script(`
125
- type Vector2 = { x: number, y: number }
126
- type Vector3 = { x: number, y: number, z: number }
127
128
  type Vector4 = { x: number, y: number, z: number, w: number }
129
+ type Vector3 = { x: number, y: number, z: number }
130
+ type Vector2 = { x: number, y: number }
128
131
  `)
129
132
 
130
- // Dependent Module
131
- const { Mesh } = Type.Script(Math, `
133
+ // Graphics Module
134
+
135
+ const Graphics = Type.Script(Math, `
132
136
  type Vertex = {
133
137
  position: Vector4,
134
138
  normal: Vector3,
@@ -149,23 +153,10 @@ const { Mesh } = Type.Script(Math, `
149
153
  }
150
154
  `)
151
155
 
152
- // Runtime Reflection
153
- Mesh.properties.geometry.properties.vertices.items.properties.position.properties.x
154
- Mesh.properties.geometry.properties.vertices.items.properties.normal.properties.x
155
- Mesh.properties.geometry.properties.vertices.items.properties.uv.properties.x
156
- Mesh.properties.material.properties.diffuse.properties.x
157
- Mesh.properties.material.properties.ambient.properties.x
158
- Mesh.properties.material.properties.specular.properties.x
159
-
160
- // Static Inference
161
- function render(mesh: Type.Static<typeof Mesh>) {
162
- mesh.geometry.vertices[0].position.x
163
- mesh.geometry.vertices[0].normal.x
164
- mesh.geometry.vertices[0].uv.x
165
- mesh.material.diffuse.x
166
- mesh.material.ambient.x
167
- mesh.material.specular.x
168
- }
156
+ type Mesh = Type.Static<typeof Graphics['Mesh']> // type Mesh = {
157
+ // geometry: { ... },
158
+ // material: { ... }
159
+ // }
169
160
  ```
170
161
 
171
162
  <a name="Schema"></a>
@@ -184,18 +175,21 @@ import Schema from 'typebox/schema'
184
175
 
185
176
  ### Compile
186
177
 
187
- The compiler accepts JSON Schema and returns Validator instances.
178
+ The compiler accepts either TypeBox types or native JSON Schema.
188
179
 
189
180
  ```typescript
190
- const Vector = Schema.Compile(Type.Object({ // const Vector: Validator<TObject<{
181
+
182
+ // Type
183
+
184
+ const VectorA = Schema.Compile(Type.Object({ // const VectorA: Validator<TObject<{
191
185
  x: Type.Number(), // x: TNumber
192
186
  y: Type.Number(), // y: TNumber
193
187
  z: Type.Number() // z: TNumber
194
188
  })) // }>>
195
- ```
196
- With JSON Schema
197
- ```typescript
198
- const Vector = Schema.Compile({ // const Vector: Validator<{
189
+
190
+ // Schema
191
+
192
+ const VectorB = Schema.Compile({ // const VectorB: Validator<{
199
193
  type: 'object', // type: "object";
200
194
  required: ['x', 'y', 'z'], // required: ["x", "y", "z"];
201
195
  properties: { // properties: { ... };
@@ -208,35 +202,36 @@ const Vector = Schema.Compile({ // const Vector: Validator<{
208
202
 
209
203
  ### Validate
210
204
 
211
- Validator instances provide functions to Check and Parse values.
205
+ Compiled validator instances provide functions to Check and Parse values.
212
206
 
213
207
  ```typescript
208
+
209
+ // Compile
210
+
214
211
  const Vector = Schema.Compile(Type.Script(`{
215
212
  x: number
216
213
  y: number
217
214
  z: number
218
215
  }`))
219
216
 
220
- const valid = Vector.Check({ // const valid: boolean
221
- x: 1,
222
- y: 0,
223
- z: 0
224
- })
225
-
226
- const value = Vector.Parse({ // const value: {
227
- x: 1, // x: number
228
- y: 0, // y: number
229
- z: 0 // z: number
230
- }) // }
231
- ```
217
+ // Check
218
+
219
+ const valid = Vector.Check({ x: 1, y: 0, z: 0 }) // const valid: boolean
232
220
 
221
+ // Parse
233
222
 
223
+ const result = Vector.Parse({ x: 1, y: 0, z: 0 }) // const result: {
224
+ // x: number
225
+ // y: number
226
+ // z: number
227
+ // }
228
+ ```
234
229
 
235
230
  ### Coverage
236
231
 
237
- The following table shows specification coverage implemented by TypeBox.
232
+ [JSON Schema Test Suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite) | [JSON Schema Compliance Suite](https://github.com/sinclairzx81/json-schema-compliance-suite)
238
233
 
239
- Ref: [JSON Schema Test Suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite)
234
+ TypeBox supports all major JSON Schema draft versions and tracks compliance against the official JSON Schema Test Suite. It also maintains a separate JavaScript compliance suite to track ecosystem adoption as JSON Schema moves toward the V1 candidate. The following table shows TypeBox specification coverage.
240
235
 
241
236
  | Spec | 3 | 4 | 6 | 7 | 2019-09 | 2020-12 | v1 |
242
237
  |:-----|:--|:--|:--|:--|:--|:--|:--|
@@ -253,7 +248,7 @@ Ref: [JSON Schema Test Suite](https://github.com/json-schema-org/JSON-Schema-Tes
253
248
  | dependencies | 17/18 | ✅ | ✅ | ✅ | - | - | - |
254
249
  | dependentRequired | - | - | - | - | ✅ | ✅ | ✅ |
255
250
  | dependentSchemas | - | - | - | - | ✅ | ✅ | ✅ |
256
- | dynamicRef | - | - | - | - | - | 38/44 | 19/27 |
251
+ | dynamicRef | - | - | - | - | - | 40/44 | 21/27 |
257
252
  | enum | 14/16 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
258
253
  | exclusiveMaximum | - | - | ✅ | ✅ | ✅ | ✅ | ✅ |
259
254
  | exclusiveMinimum | - | - | ✅ | ✅ | ✅ | ✅ | ✅ |
@@ -279,50 +274,52 @@ Ref: [JSON Schema Test Suite](https://github.com/json-schema-org/JSON-Schema-Tes
279
274
  | properties | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
280
275
  | propertyNames | - | - | ✅ | ✅ | ✅ | ✅ | ✅ |
281
276
  | recursiveRef | - | - | - | - | ✅ | - | - |
282
- | ref | 23/27 | 37/45 | 67/70 | 75/78 | 79/81 | 77/79 | 77/79 |
277
+ | ref | 22/27 | 37/45 | 67/70 | 75/78 | 79/81 | 77/79 | 78/79 |
283
278
  | required | 3/4 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
284
279
  | type | 73/80 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
285
- | unevaluatedItems | - | - | - | - | ✅ | 65/71 | 64/71 |
286
- | unevaluatedProperties | - | - | - | - | ✅ | ✅ | 124/125 |
280
+ | unevaluatedItems | - | - | - | - | ✅ | ✅ | 70/71 |
281
+ | unevaluatedProperties | - | - | - | - | ✅ | ✅ | 128/129 |
287
282
  | uniqueItems | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
288
283
 
289
-
290
284
  ### Performance
291
285
 
292
- The following table shows compile performance for various JSON Schema structures using AJV8 as a basis for comparison.
286
+ TypeBox tracks comparative performance against AJV8 as the de facto performance standard. For broader comparative benchmarks, refer to the community maintained projects below.
287
+
288
+ [Runtime Benchmarks](https://moltar.github.io/typescript-runtime-type-benchmarks/) | [Schema Benchmarks](https://schemabenchmarks.dev/)
289
+
290
+ The following table shows compilation performance for various JSON Schema structures. These benchmarks measure the time required to JIT compile schematics, with faster compilation resulting in faster application startup.
293
291
 
294
292
  ```python
295
- ┌──────────────────────┬─────────────┬─────────────┐
296
- │ Compile │ TB1X │ AJV8 │
297
- ├──────────────────────┼─────────────┼─────────────┤
298
- │ Boolean │ 39.7K ops/s │ 6.8K ops/s │
299
- │ Number │ 86.2K ops/s │ 7.5K ops/s │
300
- │ String │ 82.6K ops/s │ 8.2K ops/s │
301
- │ Null │ 62K ops/s │ 7.3K ops/s │
302
- │ Literal_String │ 72.1K ops/s │ 5.7K ops/s │
303
- │ Literal_Number │ 72.7K ops/s │ 6.9K ops/s │
304
- │ Literal_Boolean │ 80.9K ops/s │ 7K ops/s │
305
- │ Pattern │ 38.7K ops/s │ 5.7K ops/s │
306
- │ Object_Open │ 16.3K ops/s │ 1.3K ops/s │
307
- │ Object_Close │ 15.7K ops/s │ 952 ops/s │
308
- │ Object_Vector3 │ 40.2K ops/s │ 3.2K ops/s │
309
- │ Object_Basis3 │ 16.1K ops/s │ 834 ops/s │
310
- │ Intersect_And │ 45.7K ops/s │ 3.5K ops/s │
311
- │ Intersect_Structural │ 21K ops/s │ 1.6K ops/s │
312
- │ Union_Or │ 45.1K ops/s │ 3.4K ops/s │
313
- │ Union_Structural │ 27.6K ops/s │ 2K ops/s │
314
- │ Tuple_Values │ 14.7K ops/s │ 2K ops/s │
315
- │ Tuple_Objects │ 3.7K ops/s │ 380 ops/s │
316
- │ Array_Numbers_4 │ 73.6K ops/s │ 4.3K ops/s │
317
- │ Array_Numbers_8 │ 50.9K ops/s │ 3.8K ops/s │
318
- │ Array_Numbers_16 │ 85K ops/s │ 3.9K ops/s │
319
- │ Array_Objects_Open │ 18.9K ops/s │ 789 ops/s │
320
- │ Array_Objects_Close │ 17.9K ops/s │ 909 ops/s │
321
- └──────────────────────┴─────────────┴─────────────┘
293
+ ┌──────────────────────┬──────────────┬──────────────┐
294
+ │ Compile │ TB1X │ AJV8 │
295
+ ├──────────────────────┼──────────────┼──────────────┤
296
+ │ Boolean │ 50.4K ops/s │ 7.1K ops/s │
297
+ │ Number │ 129.9K ops/s │ 7.9K ops/s │
298
+ │ String │ 128.9K ops/s │ 9.1K ops/s │
299
+ │ Null │ 91.3K ops/s │ 8.4K ops/s │
300
+ │ Literal_String │ 63.1K ops/s │ 7.4K ops/s │
301
+ │ Literal_Number │ 74.5K ops/s │ 7.6K ops/s │
302
+ │ Literal_Boolean │ 143.3K ops/s │ 7.7K ops/s │
303
+ │ Pattern │ 94.2K ops/s │ 6.4K ops/s │
304
+ │ Object_Open │ 19.4K ops/s │ 1.3K ops/s │
305
+ │ Object_Close │ 17.6K ops/s │ 991 ops/s │
306
+ │ Object_Vector3 │ 46.1K ops/s │ 3.3K ops/s │
307
+ │ Object_Basis3 │ 16K ops/s │ 848 ops/s │
308
+ │ Intersect_And │ 41.3K ops/s │ 4.2K ops/s │
309
+ │ Intersect_Structural │ 25.3K ops/s │ 1.5K ops/s │
310
+ │ Union_Or │ 58.6K ops/s │ 2.4K ops/s │
311
+ │ Union_Structural │ 31.5K ops/s │ 1.8K ops/s │
312
+ │ Tuple_Values │ 18.2K ops/s │ 1.9K ops/s │
313
+ │ Tuple_Objects │ 3.9K ops/s │ 437 ops/s │
314
+ │ Array_Numbers_4 │ 114.5K ops/s │ 4.2K ops/s │
315
+ │ Array_Numbers_8 │ 128.3K ops/s │ 3.9K ops/s │
316
+ │ Array_Numbers_16 │ 128.4K ops/s │ 4K ops/s │
317
+ │ Array_Objects_Open │ 22K ops/s │ 780 ops/s │
318
+ │ Array_Objects_Close │ 22K ops/s │ 1K ops/s │
319
+ └──────────────────────┴──────────────┴──────────────┘
322
320
  ```
323
321
 
324
-
325
- The following tables shows validation performance for various JSON Schema structures using AJV8 as a basis for comparison.
322
+ The following tables shows validation performance for various JSON Schema structures. These benchmarks measure overall validation throughput for JIT compiled schematics.
326
323
 
327
324
  ```python
328
325
  ┌──────────────────────┬──────────────┬──────────────┐
@@ -111,22 +111,35 @@ added: v1.0.0
111
111
  `autoSelectFamily` is enabled. **Default:** `250`.
112
112
  * `allowH2` {boolean} Enables HTTP/2 support when the server assigns it a
113
113
  higher priority through ALPN negotiation. **Default:** `true`.
114
- * `useH2c` {boolean} Enforces h2c (HTTP/2 cleartext) for non-HTTPS
115
- connections. **Default:** `false`.
116
- * `maxConcurrentStreams` {number} The maximum number of concurrent HTTP/2
114
+ * `useH2c` {boolean} _Deprecated: use h2Options.useH2c instead_ Enforces h2c (HTTP/2 cleartext) for non-HTTPS
115
+ connections. **Default:** `false`.
116
+ * `maxConcurrentStreams` {number} _Deprecated: use h2Options.useH2c instead_ The maximum number of concurrent HTTP/2
117
117
  streams for a single session. Once h2 is negotiated this — not `pipelining`,
118
118
  which is HTTP/1.1 only — is the ceiling used to dispatch in-flight requests.
119
119
  It may be overridden by the server's `SETTINGS_MAX_CONCURRENT_STREAMS`
120
120
  frame. **Default:** `100`.
121
- * `initialWindowSize` {number} The HTTP/2 stream-level flow-control window
122
- size (`SETTINGS_INITIAL_WINDOW_SIZE`). Must be a positive integer.
123
- **Default:** `262144`.
124
- * `connectionWindowSize` {number} The HTTP/2 connection-level flow-control
121
+ * `connectionWindowSize` {number} _Deprecated: use h2Options.connectionWindowSize instead_ The HTTP/2 connection-level flow-control
125
122
  window size set via `ClientHttp2Session.setLocalWindowSize()`. Must be a
126
123
  positive integer. **Default:** `524288`.
127
- * `pingInterval` {number} The time interval, in milliseconds, between HTTP/2
124
+ * `pingInterval` {number} _Deprecated: use h2Options.pingInterval instead_ The time interval, in milliseconds, between HTTP/2
128
125
  PING frames. Set to `0` to disable PING frames. Applies only to HTTP/2
129
126
  connections and emits a `ping` event on the client. **Default:** `60e3`.
127
+ * `h2Options` {object} Set of options for HTTP/2 sessions
128
+ * `useH2c` {boolean} Enforces h2c (HTTP/2 cleartext) for non-HTTPS
129
+ connections. **Default:** `false`.
130
+ * `maxConcurrentStreams` {number} The maximum number of concurrent HTTP/2
131
+ streams for a single session. Once h2 is negotiated this — not `pipelining`,
132
+ which is HTTP/1.1 only — is the ceiling used to dispatch in-flight requests.
133
+ It may be overridden by the server's `SETTINGS_MAX_CONCURRENT_STREAMS`
134
+ frame. **Default:** `100`.
135
+ * `connectionWindowSize` {number} The HTTP/2 connection-level flow-control
136
+ window size set via `ClientHttp2Session.setLocalWindowSize()`. Must be a
137
+ positive integer. **Default:** `524288`.
138
+ * `pingInterval` {number} The time interval, in milliseconds, between HTTP/2
139
+ PING frames. Set to `0` to disable PING frames. Applies only to HTTP/2
140
+ connections and emits a `ping` event on the client. **Default:** `60e3`.
141
+ * `settings` {object} `SETTINGS` frame options. For full reference, take a
142
+ look to [HTTP/2#Settings Object](https://nodejs.org/api/http2.html#settings-object)
130
143
  * `webSocket` {Object} (optional) WebSocket-specific configuration.
131
144
  * `maxFragments` {number} The maximum number of fragments in a message. Set
132
145
  to `0` to disable the limit. **Default:** `131072`.
@@ -15,7 +15,6 @@ const kContentType = Symbol('kContentType')
15
15
  const kContentLength = Symbol('kContentLength')
16
16
  const kUsed = Symbol('kUsed')
17
17
  const kBytesRead = Symbol('kBytesRead')
18
- const kPreservedBuffer = Symbol('kPreservedBuffer')
19
18
 
20
19
  const noop = () => {}
21
20
 
@@ -326,36 +325,14 @@ class BodyReadable extends Readable {
326
325
  */
327
326
  setEncoding (encoding) {
328
327
  if (Buffer.isEncoding(encoding)) {
329
- // Preserve raw Buffer chunks for the consume path (body.text(),
330
- // body.json(), etc.) before super.setEncoding() replaces them
331
- // with decoded strings. Without this, the consume path would
332
- // lose access to the original bytes — some of which may be held
333
- // by the decoder for incomplete multi-byte sequences, and the
334
- // rest converted to strings that can't be safely concatenated
335
- // byte-wise.
336
- const state = this._readableState
337
- const buffer = state.buffer
338
- if (buffer && state.length > 0) {
339
- const bufferIndex = state.bufferIndex ?? 0
340
- const preserved = []
341
- const source = typeof buffer.slice === 'function'
342
- ? buffer.slice(bufferIndex)
343
- : buffer
344
- for (const data of source) {
345
- if (Buffer.isBuffer(data)) {
346
- preserved.push(data)
347
- }
348
- }
349
- if (preserved.length > 0) {
350
- this[kPreservedBuffer] = (this[kPreservedBuffer] || []).concat(preserved)
351
- }
352
- }
353
-
354
328
  // Delegate to Node.js Readable.setEncoding() which initializes a
355
329
  // StringDecoder and re-encodes already-buffered chunks. This properly
356
330
  // handles multi-byte sequences split at chunk boundaries for the
357
331
  // for-await / on('data') paths. Without this, Node.js uses
358
332
  // buf.toString(encoding) on each chunk, producing U+FFFD for split chars.
333
+ //
334
+ // The consume path (body.text(), body.json(), ...) copes with the
335
+ // decoded strings this leaves in state.buffer, see consumeStart().
359
336
  super.setEncoding(encoding)
360
337
  }
361
338
  return this
@@ -464,17 +441,7 @@ function consumeStart (consume) {
464
441
 
465
442
  const { _readableState: state } = consume.stream
466
443
 
467
- // If setEncoding() was called, state.buffer may contain decoded strings
468
- // (which would break Buffer.concat in chunksDecode). Use the preserved
469
- // raw Buffers (saved before super.setEncoding() in setEncoding()) for
470
- // byte-level accurate consumption. Otherwise read from state.buffer.
471
- const preserved = consume.stream[kPreservedBuffer]
472
- if (preserved && preserved.length > 0) {
473
- for (const chunk of preserved) {
474
- consumePush(consume, chunk)
475
- }
476
- consume.stream[kPreservedBuffer] = null
477
- } else if (state.bufferIndex) {
444
+ if (state.bufferIndex) {
478
445
  const start = state.bufferIndex
479
446
  const end = state.buffer.length
480
447
  for (let n = start; n < end; n++) {
@@ -486,14 +453,29 @@ function consumeStart (consume) {
486
453
  }
487
454
  }
488
455
 
456
+ // If setEncoding() was called, state.buffer holds decoded strings, which
457
+ // consumePush() turns back into bytes. The trailing bytes of a multi-byte
458
+ // sequence split across a chunk boundary are not part of any of those
459
+ // strings, they are held inside the decoder until the rest arrives, so
460
+ // take them from there.
461
+ const decoder = state.decoder
462
+ if (decoder != null && decoder.lastNeed > 0) {
463
+ consumePush(consume, Buffer.from(decoder.lastChar.subarray(0, decoder.lastTotal - decoder.lastNeed)))
464
+ }
465
+
489
466
  if (state.endEmitted) {
490
- consumeEnd(this[kConsume], this._readableState.encoding)
491
- } else {
492
- consume.stream.on('end', function () {
493
- consumeEnd(this[kConsume], this._readableState.encoding)
494
- })
467
+ // No `this` to read the consume off here: consumeStart is a free function, called from
468
+ // the queueMicrotask above. The callback below does have one, because the emitter passes
469
+ // the stream as its receiver. Returning matters too - consumeEnd() clears consume.stream,
470
+ // which the resume() below would then dereference.
471
+ consumeEnd(consume, state.encoding)
472
+ return
495
473
  }
496
474
 
475
+ consume.stream.on('end', function () {
476
+ consumeEnd(this[kConsume], this._readableState.encoding)
477
+ })
478
+
497
479
  consume.stream.resume()
498
480
 
499
481
  while (consume.stream.read() != null) {
@@ -583,7 +565,7 @@ function consumeEnd (consume, encoding) {
583
565
 
584
566
  /**
585
567
  * @param {Consume} consume
586
- * @param {Buffer} chunk
568
+ * @param {Buffer|string} chunk
587
569
  * @returns {void}
588
570
  */
589
571
  function consumePush (consume, chunk) {
@@ -591,6 +573,14 @@ function consumePush (consume, chunk) {
591
573
  return
592
574
  }
593
575
 
576
+ if (typeof chunk === 'string') {
577
+ // Buffered before the consume started, while an encoding was set.
578
+ // consume.length has to stay a byte count and chunksDecode()/chunksConcat()
579
+ // only work on bytes, so re-encode. A string's own length is in UTF-16 code
580
+ // units and Uint8Array.prototype.set() ignores a string argument entirely.
581
+ chunk = Buffer.from(chunk, consume.stream._readableState.encoding)
582
+ }
583
+
594
584
  consume.length += chunk.length
595
585
  consume.body.push(chunk)
596
586
  }
@@ -105,13 +105,27 @@ function buildConnector ({ allowH2, preferH2, useH2c, maxCachedSessions, socketP
105
105
 
106
106
  port = port || 80
107
107
 
108
- socket = net.connect({
108
+ const connectOptions = {
109
109
  highWaterMark: 64 * 1024, // Same as nodejs fs streams.
110
110
  ...options,
111
111
  localAddress,
112
112
  port,
113
113
  host: hostname
114
- })
114
+ }
115
+
116
+ const family = net.isIP(hostname)
117
+ if (family !== 0 && servername && servername !== hostname) {
118
+ connectOptions.host = servername
119
+ connectOptions.lookup = (_hostname, lookupOptions, cb) => {
120
+ if (lookupOptions.all) {
121
+ cb(null, [{ address: hostname, family }])
122
+ } else {
123
+ cb(null, hostname, family)
124
+ }
125
+ }
126
+ }
127
+
128
+ socket = net.connect(connectOptions)
115
129
  if (useH2c === true) {
116
130
  socket.alpnProtocol = 'h2'
117
131
  }
@@ -56,6 +56,7 @@ module.exports = {
56
56
  kCounter: Symbol('socket request counter'),
57
57
  kMaxResponseSize: Symbol('max response size'),
58
58
  kHTTP2Session: Symbol('http2Session'),
59
+ kHTTP2Options: Symbol('http2 options'),
59
60
  kHTTP2SessionState: Symbol('http2Session state'),
60
61
  kRetryHandlerDefaultRetry: Symbol('retry agent default retry'),
61
62
  kConstruct: Symbol('constructable'),
@@ -1052,7 +1052,7 @@ function onSocketClose () {
1052
1052
 
1053
1053
  function clearIdleSocketValidation (socket) {
1054
1054
  if (socket[kIdleSocketValidationTimeout]) {
1055
- clearImmediate(socket[kIdleSocketValidationTimeout])
1055
+ clearTimeout(socket[kIdleSocketValidationTimeout])
1056
1056
  socket[kIdleSocketValidationTimeout] = null
1057
1057
  }
1058
1058
 
@@ -1061,14 +1061,14 @@ function clearIdleSocketValidation (socket) {
1061
1061
 
1062
1062
  function scheduleIdleSocketValidation (client, socket) {
1063
1063
  socket[kIdleSocketValidation] = 1
1064
- socket[kIdleSocketValidationTimeout] = setImmediate(() => {
1064
+ socket[kIdleSocketValidationTimeout] = setTimeout(() => {
1065
1065
  socket[kIdleSocketValidationTimeout] = null
1066
1066
  socket[kIdleSocketValidation] = 2
1067
1067
 
1068
1068
  if (client[kSocket] === socket && !socket.destroyed) {
1069
1069
  client[kResume]()
1070
1070
  }
1071
- })
1071
+ }, 0)
1072
1072
  socket[kIdleSocketValidationTimeout].unref?.()
1073
1073
  }
1074
1074