openai 7.16.0 → 7.17.0

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 (631) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/_vendor/zod-to-json-schema/Options.d.mts.map +1 -1
  3. package/_vendor/zod-to-json-schema/Options.d.ts.map +1 -1
  4. package/_vendor/zod-to-json-schema/Options.js +2 -0
  5. package/_vendor/zod-to-json-schema/Options.js.map +1 -1
  6. package/_vendor/zod-to-json-schema/Options.mjs +2 -0
  7. package/_vendor/zod-to-json-schema/Options.mjs.map +1 -1
  8. package/_vendor/zod-to-json-schema/parseDef.d.mts.map +1 -1
  9. package/_vendor/zod-to-json-schema/parseDef.d.ts.map +1 -1
  10. package/_vendor/zod-to-json-schema/parseDef.js +1 -0
  11. package/_vendor/zod-to-json-schema/parseDef.js.map +1 -1
  12. package/_vendor/zod-to-json-schema/parseDef.mjs +1 -0
  13. package/_vendor/zod-to-json-schema/parseDef.mjs.map +1 -1
  14. package/_vendor/zod-to-json-schema/parsers/bigint.d.mts.map +1 -1
  15. package/_vendor/zod-to-json-schema/parsers/bigint.d.ts.map +1 -1
  16. package/_vendor/zod-to-json-schema/parsers/bigint.js +2 -0
  17. package/_vendor/zod-to-json-schema/parsers/bigint.js.map +1 -1
  18. package/_vendor/zod-to-json-schema/parsers/bigint.mjs +2 -0
  19. package/_vendor/zod-to-json-schema/parsers/bigint.mjs.map +1 -1
  20. package/_vendor/zod-to-json-schema/parsers/literal.d.mts.map +1 -1
  21. package/_vendor/zod-to-json-schema/parsers/literal.d.ts.map +1 -1
  22. package/_vendor/zod-to-json-schema/parsers/literal.js +1 -0
  23. package/_vendor/zod-to-json-schema/parsers/literal.js.map +1 -1
  24. package/_vendor/zod-to-json-schema/parsers/literal.mjs +1 -0
  25. package/_vendor/zod-to-json-schema/parsers/literal.mjs.map +1 -1
  26. package/_vendor/zod-to-json-schema/parsers/null.d.mts.map +1 -1
  27. package/_vendor/zod-to-json-schema/parsers/null.d.ts.map +1 -1
  28. package/_vendor/zod-to-json-schema/parsers/null.js +1 -0
  29. package/_vendor/zod-to-json-schema/parsers/null.js.map +1 -1
  30. package/_vendor/zod-to-json-schema/parsers/null.mjs +1 -0
  31. package/_vendor/zod-to-json-schema/parsers/null.mjs.map +1 -1
  32. package/_vendor/zod-to-json-schema/parsers/nullable.d.mts.map +1 -1
  33. package/_vendor/zod-to-json-schema/parsers/nullable.d.ts.map +1 -1
  34. package/_vendor/zod-to-json-schema/parsers/nullable.js +4 -0
  35. package/_vendor/zod-to-json-schema/parsers/nullable.js.map +1 -1
  36. package/_vendor/zod-to-json-schema/parsers/nullable.mjs +4 -0
  37. package/_vendor/zod-to-json-schema/parsers/nullable.mjs.map +1 -1
  38. package/_vendor/zod-to-json-schema/parsers/number.d.mts.map +1 -1
  39. package/_vendor/zod-to-json-schema/parsers/number.d.ts.map +1 -1
  40. package/_vendor/zod-to-json-schema/parsers/number.js +2 -0
  41. package/_vendor/zod-to-json-schema/parsers/number.js.map +1 -1
  42. package/_vendor/zod-to-json-schema/parsers/number.mjs +2 -0
  43. package/_vendor/zod-to-json-schema/parsers/number.mjs.map +1 -1
  44. package/_vendor/zod-to-json-schema/parsers/optional.d.mts.map +1 -1
  45. package/_vendor/zod-to-json-schema/parsers/optional.d.ts.map +1 -1
  46. package/_vendor/zod-to-json-schema/parsers/optional.js +6 -7
  47. package/_vendor/zod-to-json-schema/parsers/optional.js.map +1 -1
  48. package/_vendor/zod-to-json-schema/parsers/optional.mjs +6 -7
  49. package/_vendor/zod-to-json-schema/parsers/optional.mjs.map +1 -1
  50. package/_vendor/zod-to-json-schema/parsers/record.d.mts.map +1 -1
  51. package/_vendor/zod-to-json-schema/parsers/record.d.ts.map +1 -1
  52. package/_vendor/zod-to-json-schema/parsers/record.js +2 -0
  53. package/_vendor/zod-to-json-schema/parsers/record.js.map +1 -1
  54. package/_vendor/zod-to-json-schema/parsers/record.mjs +2 -0
  55. package/_vendor/zod-to-json-schema/parsers/record.mjs.map +1 -1
  56. package/_vendor/zod-to-json-schema/parsers/string.d.mts.map +1 -1
  57. package/_vendor/zod-to-json-schema/parsers/string.d.ts.map +1 -1
  58. package/_vendor/zod-to-json-schema/parsers/string.js +1 -0
  59. package/_vendor/zod-to-json-schema/parsers/string.js.map +1 -1
  60. package/_vendor/zod-to-json-schema/parsers/string.mjs +1 -0
  61. package/_vendor/zod-to-json-schema/parsers/string.mjs.map +1 -1
  62. package/_vendor/zod-to-json-schema/parsers/union.d.mts.map +1 -1
  63. package/_vendor/zod-to-json-schema/parsers/union.d.ts.map +1 -1
  64. package/_vendor/zod-to-json-schema/parsers/union.js +3 -0
  65. package/_vendor/zod-to-json-schema/parsers/union.js.map +1 -1
  66. package/_vendor/zod-to-json-schema/parsers/union.mjs +3 -0
  67. package/_vendor/zod-to-json-schema/parsers/union.mjs.map +1 -1
  68. package/_vendor/zod-to-json-schema/util.d.mts.map +1 -1
  69. package/_vendor/zod-to-json-schema/util.d.ts.map +1 -1
  70. package/_vendor/zod-to-json-schema/util.js +1 -0
  71. package/_vendor/zod-to-json-schema/util.js.map +1 -1
  72. package/_vendor/zod-to-json-schema/util.mjs +1 -0
  73. package/_vendor/zod-to-json-schema/util.mjs.map +1 -1
  74. package/_vendor/zod-to-json-schema/zodToJsonSchema.d.mts.map +1 -1
  75. package/_vendor/zod-to-json-schema/zodToJsonSchema.d.ts.map +1 -1
  76. package/_vendor/zod-to-json-schema/zodToJsonSchema.js +2 -0
  77. package/_vendor/zod-to-json-schema/zodToJsonSchema.js.map +1 -1
  78. package/_vendor/zod-to-json-schema/zodToJsonSchema.mjs +2 -0
  79. package/_vendor/zod-to-json-schema/zodToJsonSchema.mjs.map +1 -1
  80. package/auth/subject-token-providers.d.mts.map +1 -1
  81. package/auth/subject-token-providers.d.ts.map +1 -1
  82. package/auth/subject-token-providers.js +6 -1
  83. package/auth/subject-token-providers.js.map +1 -1
  84. package/auth/subject-token-providers.mjs +6 -1
  85. package/auth/subject-token-providers.mjs.map +1 -1
  86. package/auth/workload-identity-auth.d.mts.map +1 -1
  87. package/auth/workload-identity-auth.d.ts.map +1 -1
  88. package/auth/workload-identity-auth.js +9 -0
  89. package/auth/workload-identity-auth.js.map +1 -1
  90. package/auth/workload-identity-auth.mjs +9 -0
  91. package/auth/workload-identity-auth.mjs.map +1 -1
  92. package/auth/x509-transport.d.mts.map +1 -1
  93. package/auth/x509-transport.d.ts.map +1 -1
  94. package/auth/x509-transport.js +11 -0
  95. package/auth/x509-transport.js.map +1 -1
  96. package/auth/x509-transport.mjs +11 -0
  97. package/auth/x509-transport.mjs.map +1 -1
  98. package/azure.d.mts.map +1 -1
  99. package/azure.d.ts.map +1 -1
  100. package/azure.js +3 -0
  101. package/azure.js.map +1 -1
  102. package/azure.mjs +3 -0
  103. package/azure.mjs.map +1 -1
  104. package/bedrock.d.mts.map +1 -1
  105. package/bedrock.d.ts.map +1 -1
  106. package/bedrock.js +5 -0
  107. package/bedrock.js.map +1 -1
  108. package/bedrock.mjs +5 -0
  109. package/bedrock.mjs.map +1 -1
  110. package/beta/realtime/internal-base.d.mts.map +1 -1
  111. package/beta/realtime/internal-base.d.ts.map +1 -1
  112. package/beta/realtime/internal-base.js +1 -0
  113. package/beta/realtime/internal-base.js.map +1 -1
  114. package/beta/realtime/internal-base.mjs +1 -0
  115. package/beta/realtime/internal-base.mjs.map +1 -1
  116. package/beta/realtime/websocket.d.mts.map +1 -1
  117. package/beta/realtime/websocket.d.ts.map +1 -1
  118. package/beta/realtime/websocket.js +9 -1
  119. package/beta/realtime/websocket.js.map +1 -1
  120. package/beta/realtime/websocket.mjs +9 -1
  121. package/beta/realtime/websocket.mjs.map +1 -1
  122. package/beta/realtime/ws.d.mts.map +1 -1
  123. package/beta/realtime/ws.d.ts.map +1 -1
  124. package/beta/realtime/ws.js +3 -0
  125. package/beta/realtime/ws.js.map +1 -1
  126. package/beta/realtime/ws.mjs +3 -0
  127. package/beta/realtime/ws.mjs.map +1 -1
  128. package/client.d.mts +1 -0
  129. package/client.d.mts.map +1 -1
  130. package/client.d.ts +1 -0
  131. package/client.d.ts.map +1 -1
  132. package/client.js +27 -6
  133. package/client.js.map +1 -1
  134. package/client.mjs +27 -6
  135. package/client.mjs.map +1 -1
  136. package/core/EventEmitter.d.mts.map +1 -1
  137. package/core/EventEmitter.d.ts.map +1 -1
  138. package/core/EventEmitter.js +15 -0
  139. package/core/EventEmitter.js.map +1 -1
  140. package/core/EventEmitter.mjs +15 -0
  141. package/core/EventEmitter.mjs.map +1 -1
  142. package/core/streaming.d.mts +1 -0
  143. package/core/streaming.d.mts.map +1 -1
  144. package/core/streaming.d.ts +1 -0
  145. package/core/streaming.d.ts.map +1 -1
  146. package/core/streaming.js +28 -1
  147. package/core/streaming.js.map +1 -1
  148. package/core/streaming.mjs +28 -1
  149. package/core/streaming.mjs.map +1 -1
  150. package/helpers/audio.d.mts.map +1 -1
  151. package/helpers/audio.d.ts.map +1 -1
  152. package/helpers/audio.js +2 -0
  153. package/helpers/audio.js.map +1 -1
  154. package/helpers/audio.mjs +2 -0
  155. package/helpers/audio.mjs.map +1 -1
  156. package/helpers/standard-schema.d.mts.map +1 -1
  157. package/helpers/standard-schema.d.ts.map +1 -1
  158. package/helpers/standard-schema.js +28 -18
  159. package/helpers/standard-schema.js.map +1 -1
  160. package/helpers/standard-schema.mjs +28 -18
  161. package/helpers/standard-schema.mjs.map +1 -1
  162. package/helpers/zod-v3-strict-schema.d.mts.map +1 -1
  163. package/helpers/zod-v3-strict-schema.d.ts.map +1 -1
  164. package/helpers/zod-v3-strict-schema.js +5 -0
  165. package/helpers/zod-v3-strict-schema.js.map +1 -1
  166. package/helpers/zod-v3-strict-schema.mjs +5 -0
  167. package/helpers/zod-v3-strict-schema.mjs.map +1 -1
  168. package/helpers/zod.d.mts.map +1 -1
  169. package/helpers/zod.d.ts.map +1 -1
  170. package/helpers/zod.js +16 -1
  171. package/helpers/zod.js.map +1 -1
  172. package/helpers/zod.mjs +17 -2
  173. package/helpers/zod.mjs.map +1 -1
  174. package/internal/assistant-stream-delta.d.mts.map +1 -1
  175. package/internal/assistant-stream-delta.d.ts.map +1 -1
  176. package/internal/assistant-stream-delta.js +8 -1
  177. package/internal/assistant-stream-delta.js.map +1 -1
  178. package/internal/assistant-stream-delta.mjs +8 -1
  179. package/internal/assistant-stream-delta.mjs.map +1 -1
  180. package/internal/auth/x509-credential-options.d.mts.map +1 -1
  181. package/internal/auth/x509-credential-options.d.ts.map +1 -1
  182. package/internal/auth/x509-credential-options.js +3 -0
  183. package/internal/auth/x509-credential-options.js.map +1 -1
  184. package/internal/auth/x509-credential-options.mjs +3 -0
  185. package/internal/auth/x509-credential-options.mjs.map +1 -1
  186. package/internal/auth/x509-token-exchange.d.mts.map +1 -1
  187. package/internal/auth/x509-token-exchange.d.ts.map +1 -1
  188. package/internal/auth/x509-token-exchange.js +2 -0
  189. package/internal/auth/x509-token-exchange.js.map +1 -1
  190. package/internal/auth/x509-token-exchange.mjs +2 -0
  191. package/internal/auth/x509-token-exchange.mjs.map +1 -1
  192. package/internal/auth/x509-transport-capability.d.mts.map +1 -1
  193. package/internal/auth/x509-transport-capability.d.ts.map +1 -1
  194. package/internal/auth/x509-transport-capability.js +1 -0
  195. package/internal/auth/x509-transport-capability.js.map +1 -1
  196. package/internal/auth/x509-transport-capability.mjs +1 -0
  197. package/internal/auth/x509-transport-capability.mjs.map +1 -1
  198. package/internal/auth/x509-transport-state.mjs +1 -0
  199. package/internal/auth/x509-workload-identity-auth.d.mts.map +1 -1
  200. package/internal/auth/x509-workload-identity-auth.d.ts.map +1 -1
  201. package/internal/auth/x509-workload-identity-auth.js +11 -0
  202. package/internal/auth/x509-workload-identity-auth.js.map +1 -1
  203. package/internal/auth/x509-workload-identity-auth.mjs +11 -0
  204. package/internal/auth/x509-workload-identity-auth.mjs.map +1 -1
  205. package/internal/bedrock.d.mts.map +1 -1
  206. package/internal/bedrock.d.ts.map +1 -1
  207. package/internal/bedrock.js +17 -1
  208. package/internal/bedrock.js.map +1 -1
  209. package/internal/bedrock.mjs +17 -1
  210. package/internal/bedrock.mjs.map +1 -1
  211. package/internal/decoders/line.d.mts.map +1 -1
  212. package/internal/decoders/line.d.ts.map +1 -1
  213. package/internal/decoders/line.js +1 -0
  214. package/internal/decoders/line.js.map +1 -1
  215. package/internal/decoders/line.mjs +1 -0
  216. package/internal/decoders/line.mjs.map +1 -1
  217. package/internal/parse.d.mts +1 -0
  218. package/internal/parse.d.mts.map +1 -1
  219. package/internal/parse.d.ts +1 -0
  220. package/internal/parse.d.ts.map +1 -1
  221. package/internal/parse.js.map +1 -1
  222. package/internal/parse.mjs.map +1 -1
  223. package/internal/provider.d.mts.map +1 -1
  224. package/internal/provider.d.ts.map +1 -1
  225. package/internal/provider.js +3 -0
  226. package/internal/provider.js.map +1 -1
  227. package/internal/provider.mjs +3 -0
  228. package/internal/provider.mjs.map +1 -1
  229. package/internal/qs/stringify.d.mts.map +1 -1
  230. package/internal/qs/stringify.d.ts.map +1 -1
  231. package/internal/qs/stringify.js +3 -0
  232. package/internal/qs/stringify.js.map +1 -1
  233. package/internal/qs/stringify.mjs +3 -0
  234. package/internal/qs/stringify.mjs.map +1 -1
  235. package/internal/qs/utils.d.mts.map +1 -1
  236. package/internal/qs/utils.d.ts.map +1 -1
  237. package/internal/qs/utils.js +15 -3
  238. package/internal/qs/utils.js.map +1 -1
  239. package/internal/qs/utils.mjs +15 -3
  240. package/internal/qs/utils.mjs.map +1 -1
  241. package/internal/responses/response-accumulator.d.mts.map +1 -1
  242. package/internal/responses/response-accumulator.d.ts.map +1 -1
  243. package/internal/responses/response-accumulator.js +20 -4
  244. package/internal/responses/response-accumulator.js.map +1 -1
  245. package/internal/responses/response-accumulator.mjs +20 -4
  246. package/internal/responses/response-accumulator.mjs.map +1 -1
  247. package/internal/to-file.js.map +1 -1
  248. package/internal/to-file.mjs.map +1 -1
  249. package/internal/uploads.d.mts.map +1 -1
  250. package/internal/uploads.d.ts.map +1 -1
  251. package/internal/uploads.js +10 -0
  252. package/internal/uploads.js.map +1 -1
  253. package/internal/uploads.mjs +10 -0
  254. package/internal/uploads.mjs.map +1 -1
  255. package/internal/utils/abort.d.mts.map +1 -1
  256. package/internal/utils/abort.d.ts.map +1 -1
  257. package/internal/utils/abort.js +9 -2
  258. package/internal/utils/abort.js.map +1 -1
  259. package/internal/utils/abort.mjs +9 -2
  260. package/internal/utils/abort.mjs.map +1 -1
  261. package/internal/utils/bytes.d.mts.map +1 -1
  262. package/internal/utils/bytes.d.ts.map +1 -1
  263. package/internal/utils/bytes.js +2 -0
  264. package/internal/utils/bytes.js.map +1 -1
  265. package/internal/utils/bytes.mjs +2 -0
  266. package/internal/utils/bytes.mjs.map +1 -1
  267. package/internal/utils/path.d.mts.map +1 -1
  268. package/internal/utils/path.d.ts.map +1 -1
  269. package/internal/utils/path.js +2 -0
  270. package/internal/utils/path.js.map +1 -1
  271. package/internal/utils/path.mjs +2 -0
  272. package/internal/utils/path.mjs.map +1 -1
  273. package/internal/utils/sleep.d.mts +1 -1
  274. package/internal/utils/sleep.d.mts.map +1 -1
  275. package/internal/utils/sleep.d.ts +1 -1
  276. package/internal/utils/sleep.d.ts.map +1 -1
  277. package/internal/utils/sleep.js +51 -1
  278. package/internal/utils/sleep.js.map +1 -1
  279. package/internal/utils/sleep.mjs +51 -1
  280. package/internal/utils/sleep.mjs.map +1 -1
  281. package/internal/ws-adapter-browser.d.mts.map +1 -1
  282. package/internal/ws-adapter-browser.d.ts.map +1 -1
  283. package/internal/ws-adapter-browser.js +2 -0
  284. package/internal/ws-adapter-browser.js.map +1 -1
  285. package/internal/ws-adapter-browser.mjs +2 -0
  286. package/internal/ws-adapter-browser.mjs.map +1 -1
  287. package/internal/ws.d.mts +9 -0
  288. package/internal/ws.d.mts.map +1 -1
  289. package/internal/ws.d.ts +9 -0
  290. package/internal/ws.d.ts.map +1 -1
  291. package/internal/ws.js +36 -4
  292. package/internal/ws.js.map +1 -1
  293. package/internal/ws.mjs +35 -4
  294. package/internal/ws.mjs.map +1 -1
  295. package/lib/AbstractChatCompletionRunner.d.mts.map +1 -1
  296. package/lib/AbstractChatCompletionRunner.d.ts.map +1 -1
  297. package/lib/AbstractChatCompletionRunner.js +41 -16
  298. package/lib/AbstractChatCompletionRunner.js.map +1 -1
  299. package/lib/AbstractChatCompletionRunner.mjs +42 -17
  300. package/lib/AbstractChatCompletionRunner.mjs.map +1 -1
  301. package/lib/AssistantStream.d.mts.map +1 -1
  302. package/lib/AssistantStream.d.ts.map +1 -1
  303. package/lib/AssistantStream.js +19 -5
  304. package/lib/AssistantStream.js.map +1 -1
  305. package/lib/AssistantStream.mjs +20 -6
  306. package/lib/AssistantStream.mjs.map +1 -1
  307. package/lib/ChatCompletionRunner.d.mts.map +1 -1
  308. package/lib/ChatCompletionRunner.d.ts.map +1 -1
  309. package/lib/ChatCompletionRunner.js +1 -0
  310. package/lib/ChatCompletionRunner.js.map +1 -1
  311. package/lib/ChatCompletionRunner.mjs +1 -0
  312. package/lib/ChatCompletionRunner.mjs.map +1 -1
  313. package/lib/ChatCompletionStream.d.mts +6 -1
  314. package/lib/ChatCompletionStream.d.mts.map +1 -1
  315. package/lib/ChatCompletionStream.d.ts +6 -1
  316. package/lib/ChatCompletionStream.d.ts.map +1 -1
  317. package/lib/ChatCompletionStream.js +63 -7
  318. package/lib/ChatCompletionStream.js.map +1 -1
  319. package/lib/ChatCompletionStream.mjs +64 -8
  320. package/lib/ChatCompletionStream.mjs.map +1 -1
  321. package/lib/EventEmitter.d.mts.map +1 -1
  322. package/lib/EventEmitter.d.ts.map +1 -1
  323. package/lib/EventEmitter.js +15 -0
  324. package/lib/EventEmitter.js.map +1 -1
  325. package/lib/EventEmitter.mjs +15 -0
  326. package/lib/EventEmitter.mjs.map +1 -1
  327. package/lib/EventStream.d.mts +2 -0
  328. package/lib/EventStream.d.mts.map +1 -1
  329. package/lib/EventStream.d.ts +2 -0
  330. package/lib/EventStream.d.ts.map +1 -1
  331. package/lib/EventStream.js +111 -14
  332. package/lib/EventStream.js.map +1 -1
  333. package/lib/EventStream.mjs +111 -14
  334. package/lib/EventStream.mjs.map +1 -1
  335. package/lib/ResponsesParser.d.mts.map +1 -1
  336. package/lib/ResponsesParser.d.ts.map +1 -1
  337. package/lib/ResponsesParser.js +4 -0
  338. package/lib/ResponsesParser.js.map +1 -1
  339. package/lib/ResponsesParser.mjs +4 -0
  340. package/lib/ResponsesParser.mjs.map +1 -1
  341. package/lib/RunnableFunction.d.mts.map +1 -1
  342. package/lib/RunnableFunction.d.ts.map +1 -1
  343. package/lib/RunnableFunction.js.map +1 -1
  344. package/lib/RunnableFunction.mjs.map +1 -1
  345. package/lib/agents/agent-session-stream.d.mts.map +1 -1
  346. package/lib/agents/agent-session-stream.d.ts.map +1 -1
  347. package/lib/agents/agent-session-stream.js +5 -2
  348. package/lib/agents/agent-session-stream.js.map +1 -1
  349. package/lib/agents/agent-session-stream.mjs +5 -2
  350. package/lib/agents/agent-session-stream.mjs.map +1 -1
  351. package/lib/embeddings.d.mts.map +1 -1
  352. package/lib/embeddings.d.ts.map +1 -1
  353. package/lib/embeddings.js +2 -0
  354. package/lib/embeddings.js.map +1 -1
  355. package/lib/embeddings.mjs +2 -0
  356. package/lib/embeddings.mjs.map +1 -1
  357. package/lib/live/transcript-grouper.d.mts.map +1 -1
  358. package/lib/live/transcript-grouper.d.ts.map +1 -1
  359. package/lib/live/transcript-grouper.js +8 -2
  360. package/lib/live/transcript-grouper.js.map +1 -1
  361. package/lib/live/transcript-grouper.mjs +8 -2
  362. package/lib/live/transcript-grouper.mjs.map +1 -1
  363. package/lib/parser.d.mts.map +1 -1
  364. package/lib/parser.d.ts.map +1 -1
  365. package/lib/parser.js +13 -0
  366. package/lib/parser.js.map +1 -1
  367. package/lib/parser.mjs +13 -0
  368. package/lib/parser.mjs.map +1 -1
  369. package/lib/responses/ResponseInputItems.d.mts.map +1 -1
  370. package/lib/responses/ResponseInputItems.d.ts.map +1 -1
  371. package/lib/responses/ResponseInputItems.js +11 -0
  372. package/lib/responses/ResponseInputItems.js.map +1 -1
  373. package/lib/responses/ResponseInputItems.mjs +11 -0
  374. package/lib/responses/ResponseInputItems.mjs.map +1 -1
  375. package/lib/responses/ResponseStream.d.mts.map +1 -1
  376. package/lib/responses/ResponseStream.d.ts.map +1 -1
  377. package/lib/responses/ResponseStream.js +7 -3
  378. package/lib/responses/ResponseStream.js.map +1 -1
  379. package/lib/responses/ResponseStream.mjs +8 -4
  380. package/lib/responses/ResponseStream.mjs.map +1 -1
  381. package/lib/transform.d.mts.map +1 -1
  382. package/lib/transform.d.ts.map +1 -1
  383. package/lib/transform.js +69 -33
  384. package/lib/transform.js.map +1 -1
  385. package/lib/transform.mjs +69 -33
  386. package/lib/transform.mjs.map +1 -1
  387. package/lib/webrtc/connection.d.mts.map +1 -1
  388. package/lib/webrtc/connection.d.ts.map +1 -1
  389. package/lib/webrtc/connection.js +6 -1
  390. package/lib/webrtc/connection.js.map +1 -1
  391. package/lib/webrtc/connection.mjs +6 -1
  392. package/lib/webrtc/connection.mjs.map +1 -1
  393. package/lib/webrtc/data-channel.d.mts.map +1 -1
  394. package/lib/webrtc/data-channel.d.ts.map +1 -1
  395. package/lib/webrtc/data-channel.js +9 -1
  396. package/lib/webrtc/data-channel.js.map +1 -1
  397. package/lib/webrtc/data-channel.mjs +9 -1
  398. package/lib/webrtc/data-channel.mjs.map +1 -1
  399. package/lib/webrtc/subscriptions.d.mts.map +1 -1
  400. package/lib/webrtc/subscriptions.d.ts.map +1 -1
  401. package/lib/webrtc/subscriptions.js +2 -0
  402. package/lib/webrtc/subscriptions.js.map +1 -1
  403. package/lib/webrtc/subscriptions.mjs +2 -0
  404. package/lib/webrtc/subscriptions.mjs.map +1 -1
  405. package/lib/webrtc/types.d.mts.map +1 -1
  406. package/lib/webrtc/types.d.ts.map +1 -1
  407. package/package.json +1 -1
  408. package/providers/bedrock/aws.d.mts.map +1 -1
  409. package/providers/bedrock/aws.d.ts.map +1 -1
  410. package/providers/bedrock/aws.js +4 -0
  411. package/providers/bedrock/aws.js.map +1 -1
  412. package/providers/bedrock/aws.mjs +4 -0
  413. package/providers/bedrock/aws.mjs.map +1 -1
  414. package/realtime/internal-base.d.mts.map +1 -1
  415. package/realtime/internal-base.d.ts.map +1 -1
  416. package/realtime/internal-base.js +1 -0
  417. package/realtime/internal-base.js.map +1 -1
  418. package/realtime/internal-base.mjs +1 -0
  419. package/realtime/internal-base.mjs.map +1 -1
  420. package/realtime/websocket.d.mts.map +1 -1
  421. package/realtime/websocket.d.ts.map +1 -1
  422. package/realtime/websocket.js +9 -1
  423. package/realtime/websocket.js.map +1 -1
  424. package/realtime/websocket.mjs +9 -1
  425. package/realtime/websocket.mjs.map +1 -1
  426. package/realtime/ws.d.mts.map +1 -1
  427. package/realtime/ws.d.ts.map +1 -1
  428. package/realtime/ws.js +3 -0
  429. package/realtime/ws.js.map +1 -1
  430. package/realtime/ws.mjs +3 -0
  431. package/realtime/ws.mjs.map +1 -1
  432. package/resources/beta/agents/agents.d.mts +2 -1
  433. package/resources/beta/agents/agents.d.mts.map +1 -1
  434. package/resources/beta/agents/agents.d.ts +2 -1
  435. package/resources/beta/agents/agents.d.ts.map +1 -1
  436. package/resources/beta/agents/agents.js.map +1 -1
  437. package/resources/beta/agents/agents.mjs.map +1 -1
  438. package/resources/beta/beta.d.mts +2 -2
  439. package/resources/beta/beta.d.mts.map +1 -1
  440. package/resources/beta/beta.d.ts +2 -2
  441. package/resources/beta/beta.d.ts.map +1 -1
  442. package/resources/beta/beta.js.map +1 -1
  443. package/resources/beta/beta.mjs.map +1 -1
  444. package/resources/beta/index.d.mts +1 -1
  445. package/resources/beta/index.d.mts.map +1 -1
  446. package/resources/beta/index.d.ts +1 -1
  447. package/resources/beta/index.d.ts.map +1 -1
  448. package/resources/beta/index.js.map +1 -1
  449. package/resources/beta/index.mjs.map +1 -1
  450. package/resources/beta/responses/index.d.mts +1 -1
  451. package/resources/beta/responses/index.d.mts.map +1 -1
  452. package/resources/beta/responses/index.d.ts +1 -1
  453. package/resources/beta/responses/index.d.ts.map +1 -1
  454. package/resources/beta/responses/index.js.map +1 -1
  455. package/resources/beta/responses/index.mjs.map +1 -1
  456. package/resources/beta/responses/internal-base.d.mts +3 -0
  457. package/resources/beta/responses/internal-base.d.mts.map +1 -1
  458. package/resources/beta/responses/internal-base.d.ts +3 -0
  459. package/resources/beta/responses/internal-base.d.ts.map +1 -1
  460. package/resources/beta/responses/internal-base.js +21 -12
  461. package/resources/beta/responses/internal-base.js.map +1 -1
  462. package/resources/beta/responses/internal-base.mjs +21 -12
  463. package/resources/beta/responses/internal-base.mjs.map +1 -1
  464. package/resources/beta/responses/responses.d.mts +51 -3
  465. package/resources/beta/responses/responses.d.mts.map +1 -1
  466. package/resources/beta/responses/responses.d.ts +51 -3
  467. package/resources/beta/responses/responses.d.ts.map +1 -1
  468. package/resources/beta/responses/responses.js.map +1 -1
  469. package/resources/beta/responses/responses.mjs.map +1 -1
  470. package/resources/beta/responses/ws-base.d.mts +5 -1
  471. package/resources/beta/responses/ws-base.d.mts.map +1 -1
  472. package/resources/beta/responses/ws-base.d.ts +5 -1
  473. package/resources/beta/responses/ws-base.d.ts.map +1 -1
  474. package/resources/beta/responses/ws-base.js +2 -4
  475. package/resources/beta/responses/ws-base.js.map +1 -1
  476. package/resources/beta/responses/ws-base.mjs +2 -4
  477. package/resources/beta/responses/ws-base.mjs.map +1 -1
  478. package/resources/beta/responses/ws.d.mts +2 -0
  479. package/resources/beta/responses/ws.d.mts.map +1 -1
  480. package/resources/beta/responses/ws.d.ts +2 -0
  481. package/resources/beta/responses/ws.d.ts.map +1 -1
  482. package/resources/beta/responses/ws.js +12 -3
  483. package/resources/beta/responses/ws.js.map +1 -1
  484. package/resources/beta/responses/ws.mjs +12 -3
  485. package/resources/beta/responses/ws.mjs.map +1 -1
  486. package/resources/live/forks/internal-base.d.mts +3 -0
  487. package/resources/live/forks/internal-base.d.mts.map +1 -1
  488. package/resources/live/forks/internal-base.d.ts +3 -0
  489. package/resources/live/forks/internal-base.d.ts.map +1 -1
  490. package/resources/live/forks/internal-base.js +21 -5
  491. package/resources/live/forks/internal-base.js.map +1 -1
  492. package/resources/live/forks/internal-base.mjs +21 -5
  493. package/resources/live/forks/internal-base.mjs.map +1 -1
  494. package/resources/live/internal-base.d.mts +3 -0
  495. package/resources/live/internal-base.d.mts.map +1 -1
  496. package/resources/live/internal-base.d.ts +3 -0
  497. package/resources/live/internal-base.d.ts.map +1 -1
  498. package/resources/live/internal-base.js +21 -5
  499. package/resources/live/internal-base.js.map +1 -1
  500. package/resources/live/internal-base.mjs +21 -5
  501. package/resources/live/internal-base.mjs.map +1 -1
  502. package/resources/live/sideband/internal-base.d.mts +3 -0
  503. package/resources/live/sideband/internal-base.d.mts.map +1 -1
  504. package/resources/live/sideband/internal-base.d.ts +3 -0
  505. package/resources/live/sideband/internal-base.d.ts.map +1 -1
  506. package/resources/live/sideband/internal-base.js +21 -5
  507. package/resources/live/sideband/internal-base.js.map +1 -1
  508. package/resources/live/sideband/internal-base.mjs +21 -5
  509. package/resources/live/sideband/internal-base.mjs.map +1 -1
  510. package/resources/responses/internal-base.d.mts +3 -0
  511. package/resources/responses/internal-base.d.mts.map +1 -1
  512. package/resources/responses/internal-base.d.ts +3 -0
  513. package/resources/responses/internal-base.d.ts.map +1 -1
  514. package/resources/responses/internal-base.js +21 -12
  515. package/resources/responses/internal-base.js.map +1 -1
  516. package/resources/responses/internal-base.mjs +21 -12
  517. package/resources/responses/internal-base.mjs.map +1 -1
  518. package/resources/responses/responses.d.mts +36 -3
  519. package/resources/responses/responses.d.mts.map +1 -1
  520. package/resources/responses/responses.d.ts +36 -3
  521. package/resources/responses/responses.d.ts.map +1 -1
  522. package/resources/responses/responses.js.map +1 -1
  523. package/resources/responses/responses.mjs.map +1 -1
  524. package/resources/responses/ws-base.d.mts +5 -1
  525. package/resources/responses/ws-base.d.mts.map +1 -1
  526. package/resources/responses/ws-base.d.ts +5 -1
  527. package/resources/responses/ws-base.d.ts.map +1 -1
  528. package/resources/responses/ws-base.js +2 -4
  529. package/resources/responses/ws-base.js.map +1 -1
  530. package/resources/responses/ws-base.mjs +2 -4
  531. package/resources/responses/ws-base.mjs.map +1 -1
  532. package/resources/responses/ws.d.mts +2 -0
  533. package/resources/responses/ws.d.mts.map +1 -1
  534. package/resources/responses/ws.d.ts +2 -0
  535. package/resources/responses/ws.d.ts.map +1 -1
  536. package/resources/responses/ws.js +12 -3
  537. package/resources/responses/ws.js.map +1 -1
  538. package/resources/responses/ws.mjs +12 -3
  539. package/resources/responses/ws.mjs.map +1 -1
  540. package/src/_vendor/zod-to-json-schema/Options.ts +2 -0
  541. package/src/_vendor/zod-to-json-schema/parseDef.ts +1 -0
  542. package/src/_vendor/zod-to-json-schema/parsers/bigint.ts +2 -0
  543. package/src/_vendor/zod-to-json-schema/parsers/literal.ts +1 -0
  544. package/src/_vendor/zod-to-json-schema/parsers/null.ts +1 -0
  545. package/src/_vendor/zod-to-json-schema/parsers/nullable.ts +4 -0
  546. package/src/_vendor/zod-to-json-schema/parsers/number.ts +2 -0
  547. package/src/_vendor/zod-to-json-schema/parsers/optional.ts +6 -7
  548. package/src/_vendor/zod-to-json-schema/parsers/record.ts +2 -0
  549. package/src/_vendor/zod-to-json-schema/parsers/string.ts +1 -0
  550. package/src/_vendor/zod-to-json-schema/parsers/union.ts +3 -0
  551. package/src/_vendor/zod-to-json-schema/util.ts +1 -0
  552. package/src/_vendor/zod-to-json-schema/zodToJsonSchema.ts +3 -1
  553. package/src/auth/subject-token-providers.ts +6 -1
  554. package/src/auth/workload-identity-auth.ts +10 -1
  555. package/src/auth/x509-transport.ts +13 -2
  556. package/src/azure.ts +3 -0
  557. package/src/bedrock.ts +5 -0
  558. package/src/beta/realtime/internal-base.ts +2 -0
  559. package/src/beta/realtime/websocket.ts +11 -1
  560. package/src/beta/realtime/ws.ts +3 -0
  561. package/src/client.ts +35 -3
  562. package/src/core/EventEmitter.ts +15 -0
  563. package/src/core/streaming.ts +30 -2
  564. package/src/helpers/audio.ts +2 -0
  565. package/src/helpers/standard-schema.ts +31 -19
  566. package/src/helpers/zod-v3-strict-schema.ts +8 -2
  567. package/src/helpers/zod.ts +32 -13
  568. package/src/internal/assistant-stream-delta.ts +7 -1
  569. package/src/internal/auth/x509-credential-options.ts +3 -0
  570. package/src/internal/auth/x509-token-exchange.ts +10 -1
  571. package/src/internal/auth/x509-transport-capability.ts +2 -1
  572. package/src/internal/auth/x509-workload-identity-auth.ts +13 -8
  573. package/src/internal/bedrock.ts +15 -0
  574. package/src/internal/decoders/line.ts +1 -0
  575. package/src/internal/parse.ts +1 -0
  576. package/src/internal/provider.ts +3 -0
  577. package/src/internal/qs/stringify.ts +3 -0
  578. package/src/internal/qs/utils.ts +14 -3
  579. package/src/internal/responses/response-accumulator.ts +34 -4
  580. package/src/internal/to-file.ts +1 -1
  581. package/src/internal/uploads.ts +11 -1
  582. package/src/internal/utils/abort.ts +7 -2
  583. package/src/internal/utils/bytes.ts +2 -0
  584. package/src/internal/utils/path.ts +2 -0
  585. package/src/internal/utils/sleep.ts +52 -1
  586. package/src/internal/ws-adapter-browser.ts +2 -0
  587. package/src/internal/ws.ts +44 -4
  588. package/src/lib/AbstractChatCompletionRunner.ts +40 -17
  589. package/src/lib/AssistantStream.ts +31 -20
  590. package/src/lib/ChatCompletionRunner.ts +1 -0
  591. package/src/lib/ChatCompletionStream.ts +81 -14
  592. package/src/lib/EventEmitter.ts +15 -0
  593. package/src/lib/EventStream.ts +93 -3
  594. package/src/lib/ResponsesParser.ts +5 -0
  595. package/src/lib/RunnableFunction.ts +4 -1
  596. package/src/lib/agents/agent-session-stream.ts +5 -3
  597. package/src/lib/embeddings.ts +3 -1
  598. package/src/lib/live/transcript-grouper.ts +4 -0
  599. package/src/lib/parser.ts +16 -2
  600. package/src/lib/responses/ResponseInputItems.ts +11 -0
  601. package/src/lib/responses/ResponseStream.ts +6 -3
  602. package/src/lib/transform.ts +70 -35
  603. package/src/lib/webrtc/connection.ts +5 -1
  604. package/src/lib/webrtc/data-channel.ts +7 -0
  605. package/src/lib/webrtc/subscriptions.ts +3 -0
  606. package/src/lib/webrtc/types.ts +1 -0
  607. package/src/providers/bedrock/aws.ts +5 -1
  608. package/src/realtime/internal-base.ts +2 -0
  609. package/src/realtime/websocket.ts +11 -1
  610. package/src/realtime/ws.ts +3 -0
  611. package/src/resources/beta/agents/agents.ts +2 -0
  612. package/src/resources/beta/beta.ts +2 -0
  613. package/src/resources/beta/index.ts +1 -0
  614. package/src/resources/beta/responses/index.ts +1 -0
  615. package/src/resources/beta/responses/internal-base.ts +24 -11
  616. package/src/resources/beta/responses/responses.ts +58 -0
  617. package/src/resources/beta/responses/ws-base.ts +7 -5
  618. package/src/resources/beta/responses/ws.ts +21 -6
  619. package/src/resources/live/forks/internal-base.ts +24 -5
  620. package/src/resources/live/internal-base.ts +24 -5
  621. package/src/resources/live/sideband/internal-base.ts +24 -5
  622. package/src/resources/responses/api.md +1 -0
  623. package/src/resources/responses/internal-base.ts +24 -11
  624. package/src/resources/responses/responses.ts +41 -0
  625. package/src/resources/responses/ws-base.ts +7 -5
  626. package/src/resources/responses/ws.ts +21 -6
  627. package/src/version.ts +1 -1
  628. package/version.d.mts +1 -1
  629. package/version.d.ts +1 -1
  630. package/version.js +1 -1
  631. package/version.mjs +1 -1
@@ -119,6 +119,7 @@ export function forEachJSONSchemaChild(
119
119
  path: string[],
120
120
  visit: JSONSchemaChildVisitor,
121
121
  ): void {
122
+ // SAFETY: This is an object schema at this traversal point; the record view permits dynamic keyword access while individual values remain subject to schema checks.
122
123
  const record = schema as Record<string, unknown>;
123
124
 
124
125
  for (const keyword of JSON_SCHEMA_SINGLE_SCHEMA_KEYWORDS) {
@@ -204,11 +205,12 @@ export function toStrictJsonSchema(schema: JSONSchema): JSONSchema {
204
205
  }
205
206
 
206
207
  function stripUndefinedSchemaKeywords(schema: JSONSchemaDefinition, visited = new Set<JSONSchema>()): void {
207
- if (typeof schema === 'boolean' || !isObject(schema) || visited.has(schema)) {
208
+ if (!isObject(schema) || visited.has(schema)) {
208
209
  return;
209
210
  }
210
211
  visited.add(schema);
211
212
 
213
+ // SAFETY: This is an object schema at this traversal point; the record view permits dynamic keyword access while individual values remain subject to schema checks.
212
214
  const schemaRecord = schema as Record<string, unknown>;
213
215
  for (const keyword of Object.keys(schemaRecord)) {
214
216
  if (schemaRecord[keyword] === undefined) {
@@ -217,6 +219,7 @@ function stripUndefinedSchemaKeywords(schema: JSONSchemaDefinition, visited = ne
217
219
  }
218
220
 
219
221
  forEachJSONSchemaChild(schema, [], (child) => {
222
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
220
223
  stripUndefinedSchemaKeywords(child as JSONSchemaDefinition, visited);
221
224
  });
222
225
  }
@@ -308,6 +311,7 @@ function inlineRootRefObject(schema: JSONSchema): void {
308
311
  }
309
312
  for (const keyword of JSON_SCHEMA_ANNOTATION_KEYWORDS) {
310
313
  if (!(keyword in inheritedAnnotations) && keyword in target) {
314
+ // SAFETY: This is an object schema at this traversal point; the record view permits dynamic keyword access while individual values remain subject to schema checks.
311
315
  inheritedAnnotations[keyword] = (target as Record<string, unknown>)[keyword];
312
316
  }
313
317
  }
@@ -332,6 +336,7 @@ function inlineRootRefObject(schema: JSONSchema): void {
332
336
  delete inlined[keyword];
333
337
  }
334
338
  }
339
+ // SAFETY: This is an object schema at this traversal point; the record view permits dynamic keyword access while individual values remain subject to schema checks.
335
340
  const schemaRecord = schema as Record<string, unknown>;
336
341
 
337
342
  for (const keyword of Object.keys(schema)) {
@@ -375,13 +380,14 @@ function normalizeRootAllOf(schema: JSONSchema): void {
375
380
  }
376
381
 
377
382
  const branch = allOf[0];
378
- if (typeof branch === 'boolean' || !isObject(branch)) {
383
+ if (!isObject(branch)) {
379
384
  return;
380
385
  }
381
386
 
382
387
  const rootMetadata = { ...schema };
383
388
  delete rootMetadata.allOf;
384
389
  const normalized = structuredClone(branch);
390
+ // SAFETY: This is an object schema at this traversal point; the record view permits dynamic keyword access while individual values remain subject to schema checks.
385
391
  const schemaRecord = schema as Record<string, unknown>;
386
392
 
387
393
  for (const keyword of Object.keys(schema)) {
@@ -414,7 +420,7 @@ function normalizeRootAnyOf(schema: JSONSchema): boolean {
414
420
  }
415
421
 
416
422
  const { branch, index: branchIndex } = realBranches[0]!;
417
- if (typeof branch === 'boolean' || !isObject(branch) || !isObjectOnlySchema(branch, schema)) {
423
+ if (!isObject(branch) || !isObjectOnlySchema(branch, schema)) {
418
424
  return false;
419
425
  }
420
426
 
@@ -432,7 +438,7 @@ function normalizeRootAnyOf(schema: JSONSchema): boolean {
432
438
  }
433
439
 
434
440
  const renames = definitionRenames.get(keyword);
435
- const mergedDefinitions: Record<string, JSONSchemaDefinition> = { ...rootDefinitions };
441
+ const mergedDefinitions = { ...rootDefinitions };
436
442
  for (const [name, definition] of Object.entries(branchDefinitions)) {
437
443
  Object.defineProperty(mergedDefinitions, renames?.get(name) ?? name, {
438
444
  value: definition,
@@ -445,6 +451,7 @@ function normalizeRootAnyOf(schema: JSONSchema): boolean {
445
451
  delete rootMetadata[keyword];
446
452
  }
447
453
 
454
+ // SAFETY: This is an object schema at this traversal point; the record view permits dynamic keyword access while individual values remain subject to schema checks.
448
455
  const schemaRecord = schema as Record<string, unknown>;
449
456
 
450
457
  for (const keyword of Object.keys(schema)) {
@@ -531,7 +538,7 @@ function rewriteLocalRefsIntoPromotedRootAnyOfBranch(
531
538
  };
532
539
 
533
540
  const rewriteRefs = (value: JSONSchemaDefinition): void => {
534
- if (typeof value === 'boolean' || !isObject(value)) {
541
+ if (!isObject(value)) {
535
542
  return;
536
543
  }
537
544
 
@@ -540,6 +547,7 @@ function rewriteLocalRefsIntoPromotedRootAnyOfBranch(
540
547
  }
541
548
 
542
549
  forEachJSONSchemaChild(value, [], (child) => {
550
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
543
551
  rewriteRefs(child as JSONSchemaDefinition);
544
552
  });
545
553
  };
@@ -576,7 +584,7 @@ function hasOnlyRootRefAndDefinitions(schema: JSONSchema): boolean {
576
584
  * Multi-type arrays carry real union semantics and must remain unchanged.
577
585
  */
578
586
  function normalizeSingletonTypeArrays(schema: JSONSchemaDefinition): void {
579
- if (typeof schema === 'boolean' || !isObject(schema)) {
587
+ if (!isObject(schema)) {
580
588
  return;
581
589
  }
582
590
 
@@ -585,6 +593,7 @@ function normalizeSingletonTypeArrays(schema: JSONSchemaDefinition): void {
585
593
  }
586
594
 
587
595
  forEachJSONSchemaChild(schema, [], (child) => {
596
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
588
597
  normalizeSingletonTypeArrays(child as JSONSchemaDefinition);
589
598
  });
590
599
  }
@@ -707,7 +716,7 @@ function ensureStrictJsonSchema(
707
716
  // keywords without an explicit type, so those implicit object shapes need
708
717
  // the same strict handling as type: 'object'. Explicitly open object schemas
709
718
  // cannot be represented in Structured Outputs strict mode.
710
- if (hasObjectShape(jsonSchema)) {
719
+ if (hasObjectConstraints(jsonSchema)) {
711
720
  if (!hasOwn(jsonSchema, 'additionalProperties')) {
712
721
  jsonSchema.additionalProperties = false;
713
722
  } else if (jsonSchema.additionalProperties !== false) {
@@ -728,7 +737,7 @@ function ensureStrictJsonSchema(
728
737
 
729
738
  // Handle object properties
730
739
  const properties = jsonSchema.properties;
731
- if (hasObjectShape(jsonSchema)) {
740
+ if (hasObjectConstraints(jsonSchema)) {
732
741
  for (const key of required) {
733
742
  if (!isObject(properties) || !hasOwn(properties, key)) {
734
743
  throw new Error(
@@ -798,6 +807,7 @@ function ensureStrictJsonSchema(
798
807
 
799
808
  normalizeArrayUnionWrapper(jsonSchema, root);
800
809
 
810
+ // SAFETY: This is an object schema at this traversal point; the record view permits dynamic keyword access while individual values remain subject to schema checks.
801
811
  const schemaRecord = jsonSchema as Record<string, unknown>;
802
812
  for (const keyword of JSON_SCHEMA_UNSUPPORTED_SCHEMA_KEYWORDS) {
803
813
  // Optional converter output often keeps undefined placeholders on the
@@ -832,6 +842,7 @@ function ensureStrictJsonSchema(
832
842
  return;
833
843
  }
834
844
 
845
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
835
846
  ensureStrictJsonSchema(child as JSONSchemaDefinition, childPath, root);
836
847
  });
837
848
 
@@ -878,6 +889,7 @@ function parseLocalRef(ref: string): string[] | undefined {
878
889
  return parts;
879
890
  }
880
891
 
892
+ // oxlint-disable-next-line anti-slop/no-unknown-returns -- Resolving untrusted schema references may produce any value; callers perform the schema checks. JSON Schema traversal accepts arbitrary keyword values and validates each node before interpreting it.
881
893
  function resolvePointerPart(resolved: unknown, part: string): unknown | undefined {
882
894
  if (Array.isArray(resolved)) {
883
895
  if (!/^(?:0|[1-9]\d*)$/.test(part)) {
@@ -974,7 +986,7 @@ function isObjectOnlySchema(
974
986
  root: JSONSchema,
975
987
  seenRefs = new Set<string>(),
976
988
  ): boolean {
977
- if (typeof schema === 'boolean' || !isObject(schema)) {
989
+ if (!isObject(schema)) {
978
990
  return false;
979
991
  }
980
992
 
@@ -1017,7 +1029,7 @@ function isArrayOnlySchema(
1017
1029
  root: JSONSchema,
1018
1030
  seenRefs = new Set<string>(),
1019
1031
  ): boolean {
1020
- if (typeof schema === 'boolean' || !isObject(schema)) {
1032
+ if (!isObject(schema)) {
1021
1033
  return false;
1022
1034
  }
1023
1035
 
@@ -1069,6 +1081,7 @@ export function hasOnlyRefAndAnnotations(schema: JSONSchema): boolean {
1069
1081
  }
1070
1082
 
1071
1083
  function hasOnlyAnnotationSiblings(schema: JSONSchema, keyword: string): boolean {
1084
+ // SAFETY: This is an object schema at this traversal point; the record view permits dynamic keyword access while individual values remain subject to schema checks.
1072
1085
  const schemaRecord = schema as Record<string, unknown>;
1073
1086
  return Object.keys(schema).every(
1074
1087
  // Definition maps do not add sibling validation constraints. Keep them
@@ -1109,7 +1122,7 @@ function hasObjectKeywords(schema: JSONSchema): boolean {
1109
1122
  return Object.keys(schema).some((keyword) => JSON_SCHEMA_OBJECT_KEYWORDS.has(keyword));
1110
1123
  }
1111
1124
 
1112
- function hasObjectShape(schema: JSONSchema): boolean {
1125
+ function hasObjectConstraints(schema: JSONSchema): boolean {
1113
1126
  const typ = schema.type;
1114
1127
  return (
1115
1128
  typ === 'object' ||
@@ -1140,7 +1153,7 @@ function normalizeObjectUnionWrapper(jsonSchema: JSONSchema, path: string[], roo
1140
1153
  delete jsonSchema.required;
1141
1154
  }
1142
1155
 
1143
- if (!hasObjectShape(jsonSchema)) {
1156
+ if (!hasObjectConstraints(jsonSchema)) {
1144
1157
  return;
1145
1158
  }
1146
1159
 
@@ -1199,7 +1212,7 @@ function normalizeAnyOfFalseBranches(jsonSchema: JSONSchema): void {
1199
1212
  */
1200
1213
  export function assertNoNestedSchemaIds(schema: JSONSchema): void {
1201
1214
  const visit = (value: JSONSchemaDefinition, path: string[]): void => {
1202
- if (typeof value === 'boolean' || !isObject(value)) {
1215
+ if (!isObject(value)) {
1203
1216
  return;
1204
1217
  }
1205
1218
 
@@ -1212,6 +1225,7 @@ export function assertNoNestedSchemaIds(schema: JSONSchema): void {
1212
1225
  }
1213
1226
 
1214
1227
  forEachJSONSchemaChild(value, path, (child, childPath) => {
1228
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
1215
1229
  visit(child as JSONSchemaDefinition, childPath);
1216
1230
  });
1217
1231
  };
@@ -1293,7 +1307,7 @@ export function rewriteLocalRefsIntoMovedOneOfBranches(root: JSONSchema): void {
1293
1307
  };
1294
1308
 
1295
1309
  const rewriteRefs = (value: JSONSchemaDefinition): void => {
1296
- if (typeof value === 'boolean' || !isObject(value)) {
1310
+ if (!isObject(value)) {
1297
1311
  return;
1298
1312
  }
1299
1313
 
@@ -1302,6 +1316,7 @@ export function rewriteLocalRefsIntoMovedOneOfBranches(root: JSONSchema): void {
1302
1316
  }
1303
1317
 
1304
1318
  forEachJSONSchemaChild(value, [], (child) => {
1319
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
1305
1320
  rewriteRefs(child as JSONSchemaDefinition);
1306
1321
  });
1307
1322
  };
@@ -1326,10 +1341,8 @@ function rewriteLocalRefsIntoFilteredAnyOfBranches(root: JSONSchema): void {
1326
1341
  let changed = false;
1327
1342
 
1328
1343
  for (const [index, part] of originalParts.entries()) {
1329
- const resolvedRecord =
1330
- typeof resolved === 'object' && resolved !== null && !Array.isArray(resolved)
1331
- ? (resolved as Record<string, unknown>)
1332
- : undefined;
1344
+ // SAFETY: This is an object schema at this traversal point; the record view permits dynamic keyword access while individual values remain subject to schema checks.
1345
+ const resolvedRecord = isObject(resolved) ? (resolved as Record<string, unknown>) : undefined;
1333
1346
  if (
1334
1347
  part === 'anyOf' &&
1335
1348
  index < originalParts.length - 1 &&
@@ -1375,7 +1388,7 @@ function rewriteLocalRefsIntoFilteredAnyOfBranches(root: JSONSchema): void {
1375
1388
  };
1376
1389
 
1377
1390
  const rewriteRefs = (value: JSONSchemaDefinition): void => {
1378
- if (typeof value === 'boolean' || !isObject(value)) {
1391
+ if (!isObject(value)) {
1379
1392
  return;
1380
1393
  }
1381
1394
 
@@ -1384,6 +1397,7 @@ function rewriteLocalRefsIntoFilteredAnyOfBranches(root: JSONSchema): void {
1384
1397
  }
1385
1398
 
1386
1399
  forEachJSONSchemaChild(value, [], (child) => {
1400
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
1387
1401
  rewriteRefs(child as JSONSchemaDefinition);
1388
1402
  });
1389
1403
  };
@@ -1399,7 +1413,7 @@ function rewriteLocalRefsIntoFilteredAnyOfBranches(root: JSONSchema): void {
1399
1413
  function preserveAllOfRefTargets(root: JSONSchema, rootOnly = false): void {
1400
1414
  const refsToPreserve = new Set<string>();
1401
1415
  const collectRefs = (value: JSONSchemaDefinition): void => {
1402
- if (typeof value === 'boolean' || !isObject(value)) {
1416
+ if (!isObject(value)) {
1403
1417
  return;
1404
1418
  }
1405
1419
 
@@ -1411,6 +1425,7 @@ function preserveAllOfRefTargets(root: JSONSchema, rootOnly = false): void {
1411
1425
  }
1412
1426
 
1413
1427
  forEachJSONSchemaChild(value, [], (child) => {
1428
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
1414
1429
  collectRefs(child as JSONSchemaDefinition);
1415
1430
  });
1416
1431
  };
@@ -1429,6 +1444,7 @@ function preserveAllOfRefTargets(root: JSONSchema, rootOnly = false): void {
1429
1444
 
1430
1445
  for (const ref of refsToPreserve) {
1431
1446
  const target = resolveLocalRef(root, ref);
1447
+ // oxlint-disable-next-line anti-slop/no-known-value-widening -- Local references require runtime schema validation even when the static return type is narrower.
1432
1448
  if (!isSchemaDefinition(target)) {
1433
1449
  if (rootOnly) {
1434
1450
  continue;
@@ -1445,7 +1461,7 @@ function preserveAllOfRefTargets(root: JSONSchema, rootOnly = false): void {
1445
1461
  }
1446
1462
 
1447
1463
  const rewriteRefs = (value: JSONSchemaDefinition): void => {
1448
- if (typeof value === 'boolean' || !isObject(value)) {
1464
+ if (!isObject(value)) {
1449
1465
  return;
1450
1466
  }
1451
1467
 
@@ -1454,6 +1470,7 @@ function preserveAllOfRefTargets(root: JSONSchema, rootOnly = false): void {
1454
1470
  }
1455
1471
 
1456
1472
  forEachJSONSchemaChild(value, [], (child) => {
1473
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
1457
1474
  rewriteRefs(child as JSONSchemaDefinition);
1458
1475
  });
1459
1476
  };
@@ -1472,7 +1489,7 @@ function preserveDiscardedAllOfPropertyRefTargets(root: JSONSchema, discardedPat
1472
1489
 
1473
1490
  const refsToPreserve = new Set<string>();
1474
1491
  const collectRefs = (value: JSONSchemaDefinition): void => {
1475
- if (typeof value === 'boolean' || !isObject(value)) {
1492
+ if (!isObject(value)) {
1476
1493
  return;
1477
1494
  }
1478
1495
 
@@ -1491,6 +1508,7 @@ function preserveDiscardedAllOfPropertyRefTargets(root: JSONSchema, discardedPat
1491
1508
  }
1492
1509
 
1493
1510
  forEachJSONSchemaChild(value, [], (child) => {
1511
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
1494
1512
  collectRefs(child as JSONSchemaDefinition);
1495
1513
  });
1496
1514
  };
@@ -1509,6 +1527,7 @@ function preserveDiscardedAllOfPropertyRefTargets(root: JSONSchema, discardedPat
1509
1527
 
1510
1528
  for (const ref of refsToPreserve) {
1511
1529
  const target = resolveLocalRef(root, ref);
1530
+ // oxlint-disable-next-line anti-slop/no-known-value-widening -- Validate referenced schema values at runtime before preserving them under generated definitions.
1512
1531
  if (!isSchemaDefinition(target)) {
1513
1532
  throw new Error('Local $ref cannot be preserved before allOf property removal: ' + JSON.stringify(ref));
1514
1533
  }
@@ -1522,7 +1541,7 @@ function preserveDiscardedAllOfPropertyRefTargets(root: JSONSchema, discardedPat
1522
1541
  }
1523
1542
 
1524
1543
  const rewriteRefs = (value: JSONSchemaDefinition): void => {
1525
- if (typeof value === 'boolean' || !isObject(value)) {
1544
+ if (!isObject(value)) {
1526
1545
  return;
1527
1546
  }
1528
1547
 
@@ -1531,6 +1550,7 @@ function preserveDiscardedAllOfPropertyRefTargets(root: JSONSchema, discardedPat
1531
1550
  }
1532
1551
 
1533
1552
  forEachJSONSchemaChild(value, [], (child) => {
1553
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
1534
1554
  rewriteRefs(child as JSONSchemaDefinition);
1535
1555
  });
1536
1556
  };
@@ -1538,7 +1558,7 @@ function preserveDiscardedAllOfPropertyRefTargets(root: JSONSchema, discardedPat
1538
1558
  }
1539
1559
 
1540
1560
  function validateRefSchemas(schema: JSONSchemaDefinition, path: string[], root: JSONSchema): void {
1541
- if (typeof schema === 'boolean' || !isObject(schema)) {
1561
+ if (!isObject(schema)) {
1542
1562
  return;
1543
1563
  }
1544
1564
 
@@ -1555,6 +1575,7 @@ function validateRefSchemas(schema: JSONSchemaDefinition, path: string[], root:
1555
1575
  );
1556
1576
  }
1557
1577
  const resolved = resolveLocalRef(root, ref);
1578
+ // oxlint-disable-next-line anti-slop/no-known-value-widening -- Untrusted local references must pass the runtime schema predicate before normalization.
1558
1579
  if (resolved === undefined || !isSchemaDefinition(resolved)) {
1559
1580
  throw new Error(
1560
1581
  `Local $ref at \`${
@@ -1575,6 +1596,7 @@ function validateRefSchemas(schema: JSONSchemaDefinition, path: string[], root:
1575
1596
  }
1576
1597
 
1577
1598
  forEachJSONSchemaChild(schema, path, (child, childPath) => {
1599
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
1578
1600
  validateRefSchemas(child as JSONSchemaDefinition, childPath, root);
1579
1601
  });
1580
1602
  }
@@ -1609,7 +1631,7 @@ function resolveObjectAllOfBranch(
1609
1631
  seenRefs.add(ref);
1610
1632
 
1611
1633
  const target = resolveLocalRef(root, ref);
1612
- if (typeof target === 'boolean' || !isObject(target)) {
1634
+ if (!isObject(target)) {
1613
1635
  return undefined;
1614
1636
  }
1615
1637
  const targetPath = parseLocalRef(ref);
@@ -1646,7 +1668,7 @@ function normalizeObjectAllOfBranches(
1646
1668
  root: JSONSchema,
1647
1669
  normalizing = new Set<JSONSchema>(),
1648
1670
  ): void {
1649
- if (typeof schema === 'boolean' || !isObject(schema)) {
1671
+ if (!isObject(schema)) {
1650
1672
  return;
1651
1673
  }
1652
1674
  if (normalizing.has(schema)) {
@@ -1657,6 +1679,7 @@ function normalizeObjectAllOfBranches(
1657
1679
  try {
1658
1680
  while (true) {
1659
1681
  forEachJSONSchemaChild(schema, path, (child, childPath) => {
1682
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
1660
1683
  normalizeObjectAllOfBranches(child as JSONSchemaDefinition, childPath, root, normalizing);
1661
1684
  });
1662
1685
 
@@ -1703,7 +1726,7 @@ export function normalizeObjectAllOfForExclusivity(
1703
1726
  }
1704
1727
 
1705
1728
  const branch = allOf[0];
1706
- if (typeof branch === 'boolean' || !isObject(branch)) {
1729
+ if (!isObject(branch)) {
1707
1730
  return undefined;
1708
1731
  }
1709
1732
 
@@ -1711,6 +1734,7 @@ export function normalizeObjectAllOfForExclusivity(
1711
1734
  delete siblings.allOf;
1712
1735
  const flattened = structuredClone(branch);
1713
1736
  for (const keyword of Object.keys(normalized)) {
1737
+ // SAFETY: Only an enumerated own keyword is deleted from this mutable schema object before installing its normalized replacement.
1714
1738
  delete (normalized as Record<string, unknown>)[keyword];
1715
1739
  }
1716
1740
  assignSchema(normalized, flattened, siblings);
@@ -1757,19 +1781,19 @@ function mergeObjectAllOf(
1757
1781
  return true;
1758
1782
  }
1759
1783
 
1760
- const parentHasObjectShape = hasObjectShapeWithoutAllOf(jsonSchema);
1784
+ const parentIsMergeableObject = isMergeableObjectSchema(jsonSchema);
1761
1785
  const resolvedEntries = allOf.map((entry) =>
1762
1786
  isObject(entry) ? resolveObjectAllOfBranch(entry, root, normalizing) : undefined,
1763
1787
  );
1764
1788
  const objectBranches = resolvedEntries
1765
1789
  .map((entry) => entry?.schema)
1766
- .filter((entry): entry is JSONSchema => entry !== undefined && hasObjectShapeWithoutAllOf(entry));
1767
- if (!parentHasObjectShape && objectBranches.length === 0) {
1790
+ .filter((entry): entry is JSONSchema => entry !== undefined && isMergeableObjectSchema(entry));
1791
+ if (!parentIsMergeableObject && objectBranches.length === 0) {
1768
1792
  return false;
1769
1793
  }
1770
1794
  // A lone object branch with no object-valued parent is handled by the
1771
1795
  // existing safe single-allOf flattening path below.
1772
- if (!parentHasObjectShape && allOf.length === 1) {
1796
+ if (!parentIsMergeableObject && allOf.length === 1) {
1773
1797
  return false;
1774
1798
  }
1775
1799
 
@@ -1782,7 +1806,7 @@ function mergeObjectAllOf(
1782
1806
  };
1783
1807
 
1784
1808
  if (
1785
- !parentHasObjectShape &&
1809
+ !parentIsMergeableObject &&
1786
1810
  ['additionalProperties', 'properties', 'required', 'type'].some((keyword) => keyword in jsonSchema)
1787
1811
  ) {
1788
1812
  fail();
@@ -1801,7 +1825,7 @@ function mergeObjectAllOf(
1801
1825
  }
1802
1826
 
1803
1827
  const branches: { schema: JSONSchema; sourcePath: string[] | undefined }[] = [];
1804
- if (parentHasObjectShape) {
1828
+ if (parentIsMergeableObject) {
1805
1829
  branches.push({ schema: jsonSchema, sourcePath: path });
1806
1830
  }
1807
1831
  for (const [index, entry] of allOf.entries()) {
@@ -1817,7 +1841,7 @@ function mergeObjectAllOf(
1817
1841
  // branch were preserved under stable root definitions before this merge,
1818
1842
  // so a valid definitions-only branch can now be discarded like an
1819
1843
  // annotation-only branch.
1820
- if (hasObjectShapeWithoutAllOf(branch)) {
1844
+ if (isMergeableObjectSchema(branch)) {
1821
1845
  branches.push({
1822
1846
  schema: branch,
1823
1847
  sourcePath: branch === entry ? [...path, 'allOf', String(index)] : undefined,
@@ -1828,6 +1852,7 @@ function mergeObjectAllOf(
1828
1852
  }
1829
1853
 
1830
1854
  const merged: JSONSchema = {};
1855
+ // SAFETY: This is an object schema at this traversal point; the record view permits dynamic keyword access while individual values remain subject to schema checks.
1831
1856
  for (const keyword of ['$defs', 'definitions'] as const) {
1832
1857
  if (jsonSchema[keyword] !== undefined) {
1833
1858
  merged[keyword] = jsonSchema[keyword];
@@ -1836,11 +1861,14 @@ function mergeObjectAllOf(
1836
1861
  if (path.length === 0) {
1837
1862
  for (const keyword of JSON_SCHEMA_ROOT_METADATA_KEYWORDS) {
1838
1863
  if (keyword in jsonSchema) {
1864
+ // SAFETY: Root annotation keywords are copied unchanged between schema objects; the record views preserve their unknown values.
1865
+ // oxlint-disable-next-line anti-slop/no-known-value-widening -- Root annotation keywords are copied dynamically; JSONSchema has no index signature for extension fields. Metadata merging preserves arbitrary annotation/default values under the selected schema keywords.
1839
1866
  (merged as Record<string, unknown>)[keyword] = (jsonSchema as Record<string, unknown>)[keyword];
1840
1867
  }
1841
1868
  }
1842
1869
  }
1843
1870
 
1871
+ // SAFETY: This fresh null-prototype dictionary receives only JSON schema definitions while merging the validated property maps.
1844
1872
  const mergedProperties = Object.create(null) as Record<string, JSONSchemaDefinition>;
1845
1873
  const mergedRequired = new Set<string>();
1846
1874
  const closedPropertySets: Set<string>[] = [];
@@ -1863,6 +1891,7 @@ function mergeObjectAllOf(
1863
1891
  // first value (the outer schema, then earlier branches) instead of
1864
1892
  // rejecting an otherwise exactly mergeable intersection.
1865
1893
  if (!(keyword in merged)) {
1894
+ // SAFETY: These annotation keywords are copied unchanged from the validated branch; arbitrary values are preserved without narrowing.
1866
1895
  (merged as any)[keyword] = (schema as any)[keyword];
1867
1896
  }
1868
1897
  }
@@ -1883,6 +1912,7 @@ function mergeObjectAllOf(
1883
1912
  if (keyword === 'allOf' && branch === jsonSchema) {
1884
1913
  continue;
1885
1914
  }
1915
+ // SAFETY: This is an object schema at this traversal point; the record view permits dynamic keyword access while individual values remain subject to schema checks.
1886
1916
  if (
1887
1917
  (keyword === '$defs' || keyword === 'definitions') &&
1888
1918
  isObject((branch as Record<string, unknown>)[keyword])
@@ -1978,6 +2008,7 @@ function mergeObjectAllOf(
1978
2008
  if (collapsesToNull) {
1979
2009
  merged.type = 'null';
1980
2010
  for (const keyword of Object.keys(jsonSchema)) {
2011
+ // SAFETY: Only an enumerated own keyword is deleted from this mutable schema object before installing its normalized replacement.
1981
2012
  delete (jsonSchema as any)[keyword];
1982
2013
  }
1983
2014
  assignSchema(jsonSchema, merged);
@@ -2010,13 +2041,14 @@ function mergeObjectAllOf(
2010
2041
  }
2011
2042
 
2012
2043
  for (const keyword of Object.keys(jsonSchema)) {
2044
+ // SAFETY: Only an enumerated own keyword is deleted from this mutable schema object before installing its normalized replacement.
2013
2045
  delete (jsonSchema as any)[keyword];
2014
2046
  }
2015
2047
  assignSchema(jsonSchema, merged);
2016
2048
  return true;
2017
2049
  }
2018
2050
 
2019
- function hasObjectShapeWithoutAllOf(schema: JSONSchema): boolean {
2051
+ function isMergeableObjectSchema(schema: JSONSchema): boolean {
2020
2052
  if (schema.type !== undefined) {
2021
2053
  return isMergeableObjectType(schema.type);
2022
2054
  }
@@ -2024,6 +2056,7 @@ function hasObjectShapeWithoutAllOf(schema: JSONSchema): boolean {
2024
2056
  }
2025
2057
 
2026
2058
  function hasOnlyNeutralAllOfBranchKeywords(schema: JSONSchema): boolean {
2059
+ // SAFETY: This is an object schema at this traversal point; the record view permits dynamic keyword access while individual values remain subject to schema checks.
2027
2060
  const schemaRecord = schema as Record<string, unknown>;
2028
2061
  return Object.keys(schema).every(
2029
2062
  (keyword) =>
@@ -2056,7 +2089,9 @@ function schemasEqual(left: unknown, right: unknown): boolean {
2056
2089
  return false;
2057
2090
  }
2058
2091
 
2092
+ // SAFETY: This is an object schema at this traversal point; the record view permits dynamic keyword access while individual values remain subject to schema checks.
2059
2093
  const leftRecord = left as Record<string, unknown>;
2094
+ // SAFETY: This is an object schema at this traversal point; the record view permits dynamic keyword access while individual values remain subject to schema checks.
2060
2095
  const rightRecord = right as Record<string, unknown>;
2061
2096
  const leftKeys = Object.keys(leftRecord);
2062
2097
  const rightKeys = Object.keys(rightRecord);
@@ -36,6 +36,7 @@ export class WebRTCConnection<ClientEvent, ServerEvent extends { type: string }>
36
36
 
37
37
  /** Creates native resources, but does not request media, contact a server, or begin negotiation. */
38
38
  constructor(configuration?: WebRTCConfiguration) {
39
+ // SAFETY: RTCPeerConnection is an optional runtime constructor checked before resource creation; the view keeps browser ambient types optional.
39
40
  const host = globalThis as typeof globalThis & {
40
41
  RTCPeerConnection?: new (configuration?: WebRTCConfiguration) => WebRTCPeerConnection;
41
42
  };
@@ -59,7 +60,7 @@ export class WebRTCConnection<ClientEvent, ServerEvent extends { type: string }>
59
60
  );
60
61
  }
61
62
  this.peer = peer;
62
- this.peerConnection = peer as BrowserPeerConnection;
63
+ this.peerConnection = peer;
63
64
  this.dataChannel = this.adapter.dataChannel;
64
65
  peer.addEventListener('connectionstatechange', this.onPeerState);
65
66
  this.adapter.onConnectionEvent(this.onChannelEvent);
@@ -73,17 +74,20 @@ export class WebRTCConnection<ClientEvent, ServerEvent extends { type: string }>
73
74
  /** Subscribes to one server event type with its generated payload; returns an independent unsubscribe function. */
74
75
  on<Type extends ServerEvent['type']>(
75
76
  type: Type,
77
+ // oxlint-disable-next-line anti-slop/no-unknown-returns -- The existing public listener contract accepts any callback result; subscriptions discard it.
76
78
  handler: (event: Extract<ServerEvent, { type: Type }>) => unknown,
77
79
  ): () => void {
78
80
  return this.adapter.on(type, handler);
79
81
  }
80
82
 
81
83
  /** Subscribes before connecting so initial server events are observable. API errors remain protocol data. */
84
+ // oxlint-disable-next-line anti-slop/no-unknown-returns -- The existing public listener contract accepts any callback result; subscriptions discard it.
82
85
  onEvent(handler: (event: ServerEvent) => unknown): () => void {
83
86
  return this.adapter.onEvent(handler);
84
87
  }
85
88
 
86
89
  /** Subscribes to local diagnostics and lifecycle. Setup failures reject connect() instead of emitting errors here. */
90
+ // oxlint-disable-next-line anti-slop/no-unknown-returns -- The existing public listener contract accepts any callback result; subscriptions discard it.
87
91
  onConnectionEvent(handler: (event: WebRTCConnectionEvent) => unknown): () => void {
88
92
  if (this.currentState === 'closed') {
89
93
  throw new WebRTCError('invalid_state', 'transport', 'The WebRTC connection is closed.');
@@ -14,6 +14,7 @@ export class DataChannel<ClientEvent, ServerEvent extends { type: string }> {
14
14
  /** Attaches listeners without negotiating, opening, or taking ownership of the channel. */
15
15
  constructor(channel: WebRTCDataChannel) {
16
16
  this.channel = channel;
17
+ // SAFETY: Expose the supplied channel unchanged through the public alias, which uses native browser typings when DOM globals are present.
17
18
  this.dataChannel = channel as BrowserDataChannel;
18
19
  channel.addEventListener('message', this.onMessage);
19
20
  channel.addEventListener('error', this.onError);
@@ -24,20 +25,24 @@ export class DataChannel<ClientEvent, ServerEvent extends { type: string }> {
24
25
  /** Subscribes to one server event type with its generated payload; returns an independent unsubscribe function. */
25
26
  on<Type extends ServerEvent['type']>(
26
27
  type: Type,
28
+ // oxlint-disable-next-line anti-slop/no-unknown-returns -- The existing public listener contract accepts any callback result; subscriptions discard it.
27
29
  handler: (event: Extract<ServerEvent, { type: Type }>) => unknown,
28
30
  ): () => void {
29
31
  this.assertActive();
30
32
  // The shared dispatcher matches the original discriminator before invoking this callback.
33
+ // SAFETY: The dispatcher checks the event discriminator against type before invoking this handler, preserving the corresponding union member.
31
34
  return this.events.add((event) => handler(event as Extract<ServerEvent, { type: Type }>), type);
32
35
  }
33
36
 
34
37
  /** Subscribes to future server events, including raw API errors; returns an unsubscribe function. */
38
+ // oxlint-disable-next-line anti-slop/no-unknown-returns -- The existing public listener contract accepts any callback result; subscriptions discard it.
35
39
  onEvent(handler: (event: ServerEvent) => unknown): () => void {
36
40
  this.assertActive();
37
41
  return this.events.add(handler);
38
42
  }
39
43
 
40
44
  /** Observes only this channel's local errors and lifecycle, not its owning peer connection. */
45
+ // oxlint-disable-next-line anti-slop/no-unknown-returns -- The existing public listener contract accepts any callback result; subscriptions discard it.
41
46
  onConnectionEvent(handler: (event: WebRTCConnectionEvent) => unknown): () => void {
42
47
  this.assertActive();
43
48
  return this.connectionEvents.add(handler);
@@ -86,6 +91,7 @@ export class DataChannel<ClientEvent, ServerEvent extends { type: string }> {
86
91
  }
87
92
  let event: unknown;
88
93
  try {
94
+ // SAFETY: The message event boundary reads only optional data and then checks it is a string before parsing.
89
95
  const { data } = message as { data?: unknown };
90
96
  if (typeof data !== 'string') {
91
97
  throw new TypeError('Invalid protocol message.');
@@ -109,6 +115,7 @@ export class DataChannel<ClientEvent, ServerEvent extends { type: string }> {
109
115
  return;
110
116
  }
111
117
  // Like the generated SDK, accept future event types without a runtime schema registry.
118
+ // SAFETY: The parsed event passed the object and string-discriminator checks; future server event types remain intentionally accepted.
112
119
  this.events.emit(event as ServerEvent);
113
120
  };
114
121
 
@@ -1,4 +1,5 @@
1
1
  function reportApplicationError(error: unknown): void {
2
+ // SAFETY: reportError is an optional host facility and is checked to be callable before forwarding an application error.
2
3
  const host = globalThis as typeof globalThis & { reportError?: (error: unknown) => void };
3
4
  if (typeof host.reportError === 'function') {
4
5
  host.reportError(error);
@@ -20,11 +21,13 @@ async function observeResult(result: unknown): Promise<void> {
20
21
  /** Internal callback subscriptions with optional discriminator filters; no buffering or replay. */
21
22
  export class Subscriptions<Event extends { type: string }> {
22
23
  private readonly listeners = new Set<{
24
+ // oxlint-disable-next-line anti-slop/no-unknown-returns -- The existing public listener contract accepts any callback result; subscriptions discard it.
23
25
  listener: (event: Event) => unknown;
24
26
  type: Event['type'] | undefined;
25
27
  }>();
26
28
 
27
29
  /** Registers independently, including when the same function is supplied twice. */
30
+ // oxlint-disable-next-line anti-slop/no-unknown-returns -- The existing public listener contract accepts any callback result; subscriptions discard it.
28
31
  add(listener: (event: Event) => unknown, type?: Event['type']): () => void {
29
32
  const registration = { listener, type };
30
33
  this.listeners.add(registration);
@@ -55,6 +55,7 @@ export type BrowserDataChannel = typeof globalThis extends {
55
55
 
56
56
  /** Standard RTCConfiguration in a browser project; no runtime polyfill is installed. */
57
57
  export type WebRTCConfiguration = typeof globalThis extends {
58
+ // oxlint-disable-next-line anti-slop/no-unknown-returns -- This public conditional type extracts browser constructor parameters without constraining the instance type.
58
59
  RTCPeerConnection: new (configuration?: infer Configuration) => unknown;
59
60
  }
60
61
  ? Configuration