@songtonyli/dsh-cli 0.1.56 → 0.1.57

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 (1299) hide show
  1. package/README.md +1 -1
  2. package/bin/dsh.mjs +1 -1
  3. package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/package.json +6 -6
  4. package/node_modules/@aws-sdk/token-providers/package.json +6 -6
  5. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/package.json +2 -2
  6. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
  7. package/node_modules/@deepseek-ai/dsh-client-ui-slots/package.json +2 -2
  8. package/node_modules/@deepseek-ai/dsh-llm-pi-ai/README.i18n.yaml +2 -2
  9. package/node_modules/@deepseek-ai/dsh-llm-pi-ai/README.md +1 -1
  10. package/node_modules/@deepseek-ai/dsh-llm-pi-ai/README.zh.md +1 -1
  11. package/node_modules/@deepseek-ai/dsh-llm-pi-ai/lib/index.js +1 -182
  12. package/node_modules/@deepseek-ai/dsh-llm-pi-ai/package.json +1 -1
  13. package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +1 -1
  14. package/node_modules/@earendil-works/pi-ai/README.md +207 -27
  15. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +6 -0
  16. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +6 -5
  17. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +1 -0
  18. package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-workers-ai-system-one.js +43 -0
  19. package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-workers-ai-system-one.lazy.js +4 -0
  20. package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare.js +2 -0
  21. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +1 -0
  22. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +1 -0
  23. package/node_modules/@earendil-works/pi-ai/dist/api/llama-cpp-classify.js +365 -0
  24. package/node_modules/@earendil-works/pi-ai/dist/api/llama-cpp-classify.lazy.js +4 -0
  25. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +18 -17
  26. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +20 -4
  27. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +4 -4
  28. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +14 -0
  29. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +26 -9
  30. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js +1 -0
  31. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +1 -0
  32. package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js +2 -4
  33. package/node_modules/@earendil-works/pi-ai/dist/api/system-one-shared.js +183 -0
  34. package/node_modules/@earendil-works/pi-ai/dist/api/typesafe-system-one.js +19 -0
  35. package/node_modules/@earendil-works/pi-ai/dist/api/typesafe-system-one.lazy.js +4 -0
  36. package/node_modules/@earendil-works/pi-ai/dist/auth/helpers.js +1 -1
  37. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.js +19 -128
  38. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/callback-server.js +146 -0
  39. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.js +5 -0
  40. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-chatgpt.js +266 -0
  41. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.js +20 -124
  42. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.js +19 -138
  43. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.js +21 -89
  44. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +3 -19
  45. package/node_modules/@earendil-works/pi-ai/dist/bun-oauth.js +2 -0
  46. package/node_modules/@earendil-works/pi-ai/dist/cli.js +3 -1
  47. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +1 -0
  48. package/node_modules/@earendil-works/pi-ai/dist/image-models.js +14 -13
  49. package/node_modules/@earendil-works/pi-ai/dist/images.js +5 -0
  50. package/node_modules/@earendil-works/pi-ai/dist/index.js +0 -1
  51. package/node_modules/@earendil-works/pi-ai/dist/model-catalog.js +14 -2
  52. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +131 -41
  53. package/node_modules/@earendil-works/pi-ai/dist/models.js +157 -30
  54. package/node_modules/@earendil-works/pi-ai/dist/providers/all.js +25 -21
  55. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.js +4 -2
  56. package/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.js +4 -2
  57. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.js +4 -2
  58. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js +4 -2
  59. package/node_modules/@earendil-works/pi-ai/dist/providers/baseten.models.js +4 -2
  60. package/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.js +4 -2
  61. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.js +4 -2
  62. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-stream.js +6 -0
  63. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.js +10 -3
  64. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.js +4 -2
  65. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  66. package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
  67. package/node_modules/@earendil-works/pi-ai/dist/providers/data/ant-ling.json +1 -1
  68. package/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
  69. package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +1 -1
  70. package/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
  71. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cerebras.json +1 -1
  72. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
  73. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.json +1 -1
  74. package/node_modules/@earendil-works/pi-ai/dist/providers/data/deepseek.json +1 -1
  75. package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
  76. package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
  77. package/node_modules/@earendil-works/pi-ai/dist/providers/data/google-vertex.json +1 -1
  78. package/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -1
  79. package/node_modules/@earendil-works/pi-ai/dist/providers/data/groq.json +1 -1
  80. package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
  81. package/node_modules/@earendil-works/pi-ai/dist/providers/data/kimi-coding.json +1 -1
  82. package/node_modules/@earendil-works/pi-ai/dist/providers/data/meta.json +1 -1
  83. package/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax-cn.json +1 -1
  84. package/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax.json +1 -1
  85. package/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -1
  86. package/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai-cn.json +1 -1
  87. package/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai.json +1 -1
  88. package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
  89. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
  90. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
  91. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
  92. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  93. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  94. package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
  95. package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-individual.json +1 -1
  96. package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
  97. package/node_modules/@earendil-works/pi-ai/dist/providers/data/radius.json +1 -1
  98. package/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
  99. package/node_modules/@earendil-works/pi-ai/dist/providers/data/typesafe.json +1 -0
  100. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  101. package/node_modules/@earendil-works/pi-ai/dist/providers/data/xai.json +1 -1
  102. package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-ams.json +1 -1
  103. package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-cn.json +1 -1
  104. package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-sgp.json +1 -1
  105. package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi.json +1 -1
  106. package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
  107. package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
  108. package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.js +4 -2
  109. package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.js +4 -2
  110. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.js +4 -2
  111. package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.js +4 -2
  112. package/node_modules/@earendil-works/pi-ai/dist/providers/google.models.js +4 -2
  113. package/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.js +4 -2
  114. package/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.js +4 -2
  115. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.js +4 -2
  116. package/node_modules/@earendil-works/pi-ai/dist/providers/meta.models.js +4 -2
  117. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.js +4 -2
  118. package/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.js +4 -2
  119. package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.js +4 -2
  120. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.js +4 -2
  121. package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.js +4 -2
  122. package/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.js +4 -2
  123. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.js +1 -1
  124. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.js +4 -2
  125. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.js +11 -2
  126. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.js +4 -2
  127. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.js +4 -2
  128. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.js +5 -2
  129. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.js +4 -2
  130. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js +11 -2
  131. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js +4 -2
  132. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.models.js +4 -2
  133. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.models.js +4 -2
  134. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.models.js +4 -2
  135. package/node_modules/@earendil-works/pi-ai/dist/providers/radius.models.js +4 -2
  136. package/node_modules/@earendil-works/pi-ai/dist/providers/together.models.js +4 -2
  137. package/node_modules/@earendil-works/pi-ai/dist/providers/typesafe.js +18 -0
  138. package/node_modules/@earendil-works/pi-ai/dist/providers/typesafe.models.js +8 -0
  139. package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.js +5 -2
  140. package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.js +4 -2
  141. package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.js +4 -2
  142. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.js +4 -2
  143. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.js +4 -2
  144. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.js +4 -2
  145. package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.js +4 -2
  146. package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.js +4 -2
  147. package/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.js +4 -2
  148. package/node_modules/@earendil-works/pi-ai/dist/utils/headers.js +10 -8
  149. package/node_modules/@earendil-works/pi-ai/dist/utils/model-operations.js +47 -0
  150. package/node_modules/@earendil-works/pi-ai/dist/utils/models-error.js +19 -0
  151. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +7 -0
  152. package/node_modules/@earendil-works/pi-ai/package.json +4 -4
  153. package/node_modules/@earendil-works/pi-telemetry/package.json +2 -2
  154. package/node_modules/openai/CHANGELOG.md +1089 -1
  155. package/node_modules/openai/README.md +201 -102
  156. package/node_modules/openai/_vendor/partial-json-parser/parser.js +55 -38
  157. package/node_modules/openai/_vendor/partial-json-parser/parser.mjs +55 -38
  158. package/node_modules/openai/_vendor/zod-to-json-schema/Options.js +11 -2
  159. package/node_modules/openai/_vendor/zod-to-json-schema/Options.mjs +11 -2
  160. package/node_modules/openai/_vendor/zod-to-json-schema/Refs.js +4 -4
  161. package/node_modules/openai/_vendor/zod-to-json-schema/Refs.mjs +4 -4
  162. package/node_modules/openai/_vendor/zod-to-json-schema/errorMessages.js +2 -1
  163. package/node_modules/openai/_vendor/zod-to-json-schema/errorMessages.mjs +2 -1
  164. package/node_modules/openai/_vendor/zod-to-json-schema/index.js +1 -1
  165. package/node_modules/openai/_vendor/zod-to-json-schema/index.mjs +1 -1
  166. package/node_modules/openai/_vendor/zod-to-json-schema/parseDef.js +139 -54
  167. package/node_modules/openai/_vendor/zod-to-json-schema/parseDef.mjs +139 -54
  168. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/array.js +1 -1
  169. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/array.mjs +1 -1
  170. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/bigint.js +10 -4
  171. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/bigint.mjs +10 -4
  172. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/branded.js +2 -2
  173. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/branded.mjs +2 -2
  174. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.js +1 -3
  175. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.mjs +1 -3
  176. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/date.js +10 -5
  177. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/date.mjs +10 -5
  178. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/default.js +2 -2
  179. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/default.mjs +2 -2
  180. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/intersection.js +6 -5
  181. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/intersection.mjs +6 -5
  182. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/literal.js +5 -0
  183. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/literal.mjs +5 -0
  184. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nativeEnum.js +7 -9
  185. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nativeEnum.mjs +7 -9
  186. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/null.js +3 -2
  187. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/null.mjs +3 -2
  188. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.js +8 -3
  189. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.mjs +8 -3
  190. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/number.js +12 -5
  191. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/number.mjs +12 -5
  192. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/object.js +43 -38
  193. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/object.mjs +43 -38
  194. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.js +11 -12
  195. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.mjs +11 -12
  196. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/pipeline.js +3 -3
  197. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/pipeline.mjs +3 -3
  198. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/promise.js +2 -2
  199. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/promise.mjs +2 -2
  200. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.js +1 -3
  201. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.mjs +1 -3
  202. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/record.js +7 -5
  203. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/record.mjs +7 -5
  204. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/string.js +57 -34
  205. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/string.mjs +57 -34
  206. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/tuple.js +24 -19
  207. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/tuple.mjs +24 -19
  208. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/union.js +46 -24
  209. package/node_modules/openai/_vendor/zod-to-json-schema/parsers/union.mjs +46 -24
  210. package/node_modules/openai/_vendor/zod-to-json-schema/util.js +7 -5
  211. package/node_modules/openai/_vendor/zod-to-json-schema/util.mjs +7 -5
  212. package/node_modules/openai/_vendor/zod-to-json-schema/zodToJsonSchema.js +110 -38
  213. package/node_modules/openai/_vendor/zod-to-json-schema/zodToJsonSchema.mjs +110 -38
  214. package/node_modules/openai/auth/subject-token-providers.js +235 -10
  215. package/node_modules/openai/auth/subject-token-providers.mjs +235 -10
  216. package/node_modules/openai/auth/workload-identity-auth.js +185 -24
  217. package/node_modules/openai/auth/workload-identity-auth.mjs +186 -25
  218. package/node_modules/openai/auth/x509-transport.js +273 -0
  219. package/node_modules/openai/auth/x509-transport.mjs +268 -0
  220. package/node_modules/openai/azure.js +74 -21
  221. package/node_modules/openai/azure.mjs +75 -22
  222. package/node_modules/openai/bedrock.js +174 -0
  223. package/node_modules/openai/bedrock.mjs +169 -0
  224. package/node_modules/openai/beta/realtime/internal-base.js +71 -10
  225. package/node_modules/openai/beta/realtime/internal-base.mjs +70 -10
  226. package/node_modules/openai/beta/realtime/websocket.js +180 -33
  227. package/node_modules/openai/beta/realtime/websocket.mjs +181 -34
  228. package/node_modules/openai/beta/realtime/ws.js +93 -14
  229. package/node_modules/openai/beta/realtime/ws.mjs +94 -15
  230. package/node_modules/openai/client.js +745 -99
  231. package/node_modules/openai/client.mjs +747 -101
  232. package/node_modules/openai/core/EventEmitter.js +127 -16
  233. package/node_modules/openai/core/EventEmitter.mjs +128 -17
  234. package/node_modules/openai/core/api-promise.js +0 -1
  235. package/node_modules/openai/core/api-promise.mjs +0 -1
  236. package/node_modules/openai/core/error.js +5 -5
  237. package/node_modules/openai/core/error.mjs +5 -5
  238. package/node_modules/openai/core/pagination.js +33 -3
  239. package/node_modules/openai/core/pagination.mjs +31 -2
  240. package/node_modules/openai/core/resource.js +0 -1
  241. package/node_modules/openai/core/resource.mjs +0 -1
  242. package/node_modules/openai/core/streaming.js +453 -88
  243. package/node_modules/openai/core/streaming.mjs +454 -89
  244. package/node_modules/openai/core/uploads.js +3 -1
  245. package/node_modules/openai/core/uploads.mjs +1 -0
  246. package/node_modules/openai/helpers/audio.js +198 -28
  247. package/node_modules/openai/helpers/audio.mjs +199 -29
  248. package/node_modules/openai/helpers/live.js +6 -0
  249. package/node_modules/openai/helpers/live.mjs +2 -0
  250. package/node_modules/openai/helpers/standard-schema.js +393 -0
  251. package/node_modules/openai/helpers/standard-schema.mjs +387 -0
  252. package/node_modules/openai/helpers/zod-v3-strict-schema.js +408 -0
  253. package/node_modules/openai/helpers/zod-v3-strict-schema.mjs +404 -0
  254. package/node_modules/openai/helpers/zod.js +221 -24
  255. package/node_modules/openai/helpers/zod.mjs +222 -26
  256. package/node_modules/openai/index.js +8 -7
  257. package/node_modules/openai/index.mjs +2 -2
  258. package/node_modules/openai/internal/assistant-stream-delta.js +316 -0
  259. package/node_modules/openai/internal/assistant-stream-delta.mjs +308 -0
  260. package/node_modules/openai/internal/auth/x509-api-origin.js +28 -0
  261. package/node_modules/openai/internal/auth/x509-api-origin.mjs +24 -0
  262. package/node_modules/openai/internal/auth/x509-credential-options.js +125 -0
  263. package/node_modules/openai/internal/auth/x509-credential-options.mjs +121 -0
  264. package/node_modules/openai/internal/auth/x509-token-exchange.js +248 -0
  265. package/node_modules/openai/internal/auth/x509-token-exchange.mjs +245 -0
  266. package/node_modules/openai/internal/auth/x509-transport-capability.js +171 -0
  267. package/node_modules/openai/internal/auth/x509-transport-capability.mjs +166 -0
  268. package/node_modules/openai/internal/auth/x509-transport-registry.js +53 -0
  269. package/node_modules/openai/internal/auth/x509-transport-registry.mjs +48 -0
  270. package/node_modules/openai/internal/auth/x509-transport-state-browser.js +35 -0
  271. package/node_modules/openai/internal/auth/x509-transport-state-browser.mjs +32 -0
  272. package/node_modules/openai/internal/auth/x509-transport-state.cjs +35 -0
  273. package/node_modules/openai/internal/auth/x509-transport-state.js +36 -0
  274. package/node_modules/openai/internal/auth/x509-transport-state.mjs +20 -0
  275. package/node_modules/openai/internal/auth/x509-workload-identity-auth.js +787 -0
  276. package/node_modules/openai/internal/auth/x509-workload-identity-auth.mjs +778 -0
  277. package/node_modules/openai/internal/bedrock.js +438 -0
  278. package/node_modules/openai/internal/bedrock.mjs +424 -0
  279. package/node_modules/openai/internal/builtin-types.js +0 -1
  280. package/node_modules/openai/internal/builtin-types.mjs +0 -1
  281. package/node_modules/openai/internal/data-residency.js +34 -0
  282. package/node_modules/openai/internal/data-residency.mjs +30 -0
  283. package/node_modules/openai/internal/decoders/line.js +140 -54
  284. package/node_modules/openai/internal/decoders/line.mjs +141 -55
  285. package/node_modules/openai/internal/detect-platform.js +3 -4
  286. package/node_modules/openai/internal/detect-platform.mjs +3 -4
  287. package/node_modules/openai/internal/errors.js +3 -3
  288. package/node_modules/openai/internal/errors.mjs +3 -3
  289. package/node_modules/openai/internal/headers.js +11 -9
  290. package/node_modules/openai/internal/headers.mjs +11 -9
  291. package/node_modules/openai/internal/multipart-encoding.js +51 -0
  292. package/node_modules/openai/internal/multipart-encoding.mjs +48 -0
  293. package/node_modules/openai/internal/parse.js +35 -11
  294. package/node_modules/openai/internal/parse.mjs +35 -11
  295. package/node_modules/openai/internal/provider.js +50 -0
  296. package/node_modules/openai/internal/provider.mjs +46 -0
  297. package/node_modules/openai/internal/qs/formats.js +1 -2
  298. package/node_modules/openai/internal/qs/formats.mjs +1 -1
  299. package/node_modules/openai/internal/qs/stringify.js +60 -51
  300. package/node_modules/openai/internal/qs/stringify.mjs +60 -51
  301. package/node_modules/openai/internal/qs/utils.js +368 -50
  302. package/node_modules/openai/internal/qs/utils.mjs +368 -50
  303. package/node_modules/openai/internal/realtime-credentials.js +23 -0
  304. package/node_modules/openai/internal/realtime-credentials.mjs +19 -0
  305. package/node_modules/openai/internal/request-options.js +43 -2
  306. package/node_modules/openai/internal/request-options.mjs +42 -2
  307. package/node_modules/openai/internal/responses/canonical-output-text.js +123 -0
  308. package/node_modules/openai/internal/responses/canonical-output-text.mjs +115 -0
  309. package/node_modules/openai/internal/responses/output-text-index.js +77 -0
  310. package/node_modules/openai/internal/responses/output-text-index.mjs +73 -0
  311. package/node_modules/openai/internal/responses/response-accumulator.js +942 -0
  312. package/node_modules/openai/internal/responses/response-accumulator.mjs +938 -0
  313. package/node_modules/openai/internal/shim-types.js +6 -1
  314. package/node_modules/openai/internal/shim-types.mjs +6 -1
  315. package/node_modules/openai/internal/shims.js +6 -1
  316. package/node_modules/openai/internal/shims.mjs +6 -1
  317. package/node_modules/openai/internal/stream-utils.js +35 -7
  318. package/node_modules/openai/internal/stream-utils.mjs +35 -7
  319. package/node_modules/openai/internal/to-file.js +47 -24
  320. package/node_modules/openai/internal/to-file.mjs +47 -24
  321. package/node_modules/openai/internal/tslib.js +6 -0
  322. package/node_modules/openai/internal/tslib.mjs +6 -1
  323. package/node_modules/openai/internal/types.js +0 -1
  324. package/node_modules/openai/internal/types.mjs +0 -1
  325. package/node_modules/openai/internal/uploads.js +377 -43
  326. package/node_modules/openai/internal/uploads.mjs +376 -44
  327. package/node_modules/openai/internal/utils/abort.js +94 -0
  328. package/node_modules/openai/internal/utils/abort.mjs +90 -0
  329. package/node_modules/openai/internal/utils/base64.js +3 -1
  330. package/node_modules/openai/internal/utils/base64.mjs +3 -1
  331. package/node_modules/openai/internal/utils/bytes.js +5 -0
  332. package/node_modules/openai/internal/utils/bytes.mjs +5 -0
  333. package/node_modules/openai/internal/utils/env.js +9 -5
  334. package/node_modules/openai/internal/utils/env.mjs +9 -5
  335. package/node_modules/openai/internal/utils/log.js +73 -11
  336. package/node_modules/openai/internal/utils/log.mjs +70 -11
  337. package/node_modules/openai/internal/utils/path.js +50 -30
  338. package/node_modules/openai/internal/utils/path.mjs +50 -30
  339. package/node_modules/openai/internal/utils/query.js +0 -1
  340. package/node_modules/openai/internal/utils/query.mjs +0 -1
  341. package/node_modules/openai/internal/utils/sleep.js +51 -2
  342. package/node_modules/openai/internal/utils/sleep.mjs +51 -2
  343. package/node_modules/openai/internal/utils/uuid.js +0 -1
  344. package/node_modules/openai/internal/utils/uuid.mjs +0 -1
  345. package/node_modules/openai/internal/utils/values.js +0 -1
  346. package/node_modules/openai/internal/utils/values.mjs +0 -1
  347. package/node_modules/openai/internal/utils.js +0 -1
  348. package/node_modules/openai/internal/utils.mjs +0 -1
  349. package/node_modules/openai/internal/ws-adapter-browser.js +66 -21
  350. package/node_modules/openai/internal/ws-adapter-browser.mjs +66 -21
  351. package/node_modules/openai/internal/ws-adapter-node.js +90 -24
  352. package/node_modules/openai/internal/ws-adapter-node.mjs +90 -24
  353. package/node_modules/openai/internal/ws-adapter.js +4 -0
  354. package/node_modules/openai/internal/ws-adapter.mjs +4 -0
  355. package/node_modules/openai/internal/ws.js +193 -48
  356. package/node_modules/openai/internal/ws.mjs +188 -49
  357. package/node_modules/openai/lib/AbstractChatCompletionRunner.js +254 -72
  358. package/node_modules/openai/lib/AbstractChatCompletionRunner.mjs +256 -74
  359. package/node_modules/openai/lib/AssistantStream.js +430 -259
  360. package/node_modules/openai/lib/AssistantStream.mjs +432 -261
  361. package/node_modules/openai/lib/ChatCompletionRunner.js +12 -5
  362. package/node_modules/openai/lib/ChatCompletionRunner.mjs +13 -6
  363. package/node_modules/openai/lib/ChatCompletionStream.js +1430 -189
  364. package/node_modules/openai/lib/ChatCompletionStream.mjs +1433 -193
  365. package/node_modules/openai/lib/ChatCompletionStreamingRunner.js +40 -2
  366. package/node_modules/openai/lib/ChatCompletionStreamingRunner.mjs +41 -3
  367. package/node_modules/openai/lib/EventEmitter.js +124 -16
  368. package/node_modules/openai/lib/EventEmitter.mjs +125 -17
  369. package/node_modules/openai/lib/EventStream.js +1533 -55
  370. package/node_modules/openai/lib/EventStream.mjs +1534 -56
  371. package/node_modules/openai/lib/ResponsesParser.js +68 -29
  372. package/node_modules/openai/lib/ResponsesParser.mjs +69 -30
  373. package/node_modules/openai/lib/RunnableFunction.js +3 -0
  374. package/node_modules/openai/lib/RunnableFunction.mjs +3 -0
  375. package/node_modules/openai/lib/Util.js +7 -4
  376. package/node_modules/openai/lib/Util.mjs +7 -4
  377. package/node_modules/openai/lib/agents/agent-session-stream.js +274 -0
  378. package/node_modules/openai/lib/agents/agent-session-stream.mjs +270 -0
  379. package/node_modules/openai/lib/agents/output-text.js +8 -0
  380. package/node_modules/openai/lib/agents/output-text.mjs +5 -0
  381. package/node_modules/openai/lib/agents/turn-state.js +62 -0
  382. package/node_modules/openai/lib/agents/turn-state.mjs +58 -0
  383. package/node_modules/openai/lib/assistant-run-polling.js +17 -0
  384. package/node_modules/openai/lib/assistant-run-polling.mjs +14 -0
  385. package/node_modules/openai/lib/chatCompletionUtils.js +5 -6
  386. package/node_modules/openai/lib/chatCompletionUtils.mjs +5 -6
  387. package/node_modules/openai/lib/embeddings.js +58 -0
  388. package/node_modules/openai/lib/embeddings.mjs +55 -0
  389. package/node_modules/openai/lib/file-processing.js +31 -0
  390. package/node_modules/openai/lib/file-processing.mjs +28 -0
  391. package/node_modules/openai/lib/live/transcript-grouper.js +229 -0
  392. package/node_modules/openai/lib/live/transcript-grouper.mjs +225 -0
  393. package/node_modules/openai/lib/live/transcript-grouping.js +309 -0
  394. package/node_modules/openai/lib/live/transcript-grouping.mjs +305 -0
  395. package/node_modules/openai/lib/live/webrtc.js +16 -0
  396. package/node_modules/openai/lib/live/webrtc.mjs +10 -0
  397. package/node_modules/openai/lib/parser.js +142 -42
  398. package/node_modules/openai/lib/parser.mjs +140 -42
  399. package/node_modules/openai/lib/polling.js +131 -0
  400. package/node_modules/openai/lib/polling.mjs +128 -0
  401. package/node_modules/openai/lib/realtime/webrtc.js +16 -0
  402. package/node_modules/openai/lib/realtime/webrtc.mjs +10 -0
  403. package/node_modules/openai/lib/responses/ResponseAccumulator.js +15 -0
  404. package/node_modules/openai/lib/responses/ResponseAccumulator.mjs +12 -0
  405. package/node_modules/openai/lib/responses/ResponseInputItems.js +139 -0
  406. package/node_modules/openai/lib/responses/ResponseInputItems.mjs +135 -0
  407. package/node_modules/openai/lib/responses/ResponseStream.js +85 -159
  408. package/node_modules/openai/lib/responses/ResponseStream.mjs +86 -160
  409. package/node_modules/openai/lib/responses/responses-websocket-lane.js +314 -0
  410. package/node_modules/openai/lib/responses/responses-websocket-lane.mjs +309 -0
  411. package/node_modules/openai/lib/responses/responses-websocket-session.js +268 -0
  412. package/node_modules/openai/lib/responses/responses-websocket-session.mjs +263 -0
  413. package/node_modules/openai/lib/transform.js +1608 -82
  414. package/node_modules/openai/lib/transform.mjs +1602 -82
  415. package/node_modules/openai/lib/vector-store-polling.js +24 -0
  416. package/node_modules/openai/lib/vector-store-polling.mjs +20 -0
  417. package/node_modules/openai/lib/vector-store-upload.js +41 -0
  418. package/node_modules/openai/lib/vector-store-upload.mjs +38 -0
  419. package/node_modules/openai/lib/webhook-signature.js +125 -0
  420. package/node_modules/openai/lib/webhook-signature.mjs +121 -0
  421. package/node_modules/openai/lib/webrtc/connection.js +233 -0
  422. package/node_modules/openai/lib/webrtc/connection.mjs +229 -0
  423. package/node_modules/openai/lib/webrtc/data-channel.js +133 -0
  424. package/node_modules/openai/lib/webrtc/data-channel.mjs +129 -0
  425. package/node_modules/openai/lib/webrtc/errors.js +18 -0
  426. package/node_modules/openai/lib/webrtc/errors.mjs +14 -0
  427. package/node_modules/openai/lib/webrtc/subscriptions.js +64 -0
  428. package/node_modules/openai/lib/webrtc/subscriptions.mjs +60 -0
  429. package/node_modules/openai/lib/webrtc/types.js +3 -0
  430. package/node_modules/openai/lib/webrtc/types.mjs +2 -0
  431. package/node_modules/openai/live/webrtc.js +8 -0
  432. package/node_modules/openai/live/webrtc.mjs +2 -0
  433. package/node_modules/openai/package.json +71 -11
  434. package/node_modules/openai/providers/bedrock/aws.js +211 -0
  435. package/node_modules/openai/providers/bedrock/aws.mjs +207 -0
  436. package/node_modules/openai/providers/bedrock.js +43 -0
  437. package/node_modules/openai/providers/bedrock.mjs +39 -0
  438. package/node_modules/openai/realtime/internal-base.js +118 -11
  439. package/node_modules/openai/realtime/internal-base.mjs +116 -11
  440. package/node_modules/openai/realtime/webrtc.js +8 -0
  441. package/node_modules/openai/realtime/webrtc.mjs +2 -0
  442. package/node_modules/openai/realtime/websocket.js +174 -39
  443. package/node_modules/openai/realtime/websocket.mjs +175 -40
  444. package/node_modules/openai/realtime/ws.js +86 -18
  445. package/node_modules/openai/realtime/ws.mjs +87 -19
  446. package/node_modules/openai/resources/admin/admin.js +1 -1
  447. package/node_modules/openai/resources/admin/admin.mjs +1 -1
  448. package/node_modules/openai/resources/admin/index.js +1 -1
  449. package/node_modules/openai/resources/admin/index.mjs +1 -1
  450. package/node_modules/openai/resources/admin/organization/admin-api-keys.js +1 -1
  451. package/node_modules/openai/resources/admin/organization/admin-api-keys.mjs +1 -1
  452. package/node_modules/openai/resources/admin/organization/audit-logs.js +1 -1
  453. package/node_modules/openai/resources/admin/organization/audit-logs.mjs +1 -1
  454. package/node_modules/openai/resources/admin/organization/certificates.js +1 -1
  455. package/node_modules/openai/resources/admin/organization/certificates.mjs +1 -1
  456. package/node_modules/openai/resources/admin/organization/data-retention.js +1 -1
  457. package/node_modules/openai/resources/admin/organization/data-retention.mjs +1 -1
  458. package/node_modules/openai/resources/admin/organization/groups/groups.js +1 -1
  459. package/node_modules/openai/resources/admin/organization/groups/groups.mjs +1 -1
  460. package/node_modules/openai/resources/admin/organization/groups/index.js +1 -1
  461. package/node_modules/openai/resources/admin/organization/groups/index.mjs +1 -1
  462. package/node_modules/openai/resources/admin/organization/groups/roles.js +1 -1
  463. package/node_modules/openai/resources/admin/organization/groups/roles.mjs +1 -1
  464. package/node_modules/openai/resources/admin/organization/groups/users.js +1 -1
  465. package/node_modules/openai/resources/admin/organization/groups/users.mjs +1 -1
  466. package/node_modules/openai/resources/admin/organization/groups.js +1 -1
  467. package/node_modules/openai/resources/admin/organization/groups.mjs +1 -1
  468. package/node_modules/openai/resources/admin/organization/index.js +4 -2
  469. package/node_modules/openai/resources/admin/organization/index.mjs +2 -1
  470. package/node_modules/openai/resources/admin/organization/invites.js +1 -1
  471. package/node_modules/openai/resources/admin/organization/invites.mjs +1 -1
  472. package/node_modules/openai/resources/admin/organization/organization.js +5 -1
  473. package/node_modules/openai/resources/admin/organization/organization.mjs +5 -1
  474. package/node_modules/openai/resources/admin/organization/projects/api-keys.js +1 -1
  475. package/node_modules/openai/resources/admin/organization/projects/api-keys.mjs +1 -1
  476. package/node_modules/openai/resources/admin/organization/projects/certificates.js +1 -1
  477. package/node_modules/openai/resources/admin/organization/projects/certificates.mjs +1 -1
  478. package/node_modules/openai/resources/admin/organization/projects/data-retention.js +1 -1
  479. package/node_modules/openai/resources/admin/organization/projects/data-retention.mjs +1 -1
  480. package/node_modules/openai/resources/admin/organization/projects/groups/groups.js +1 -1
  481. package/node_modules/openai/resources/admin/organization/projects/groups/groups.mjs +1 -1
  482. package/node_modules/openai/resources/admin/organization/projects/groups/index.js +1 -1
  483. package/node_modules/openai/resources/admin/organization/projects/groups/index.mjs +1 -1
  484. package/node_modules/openai/resources/admin/organization/projects/groups/roles.js +1 -1
  485. package/node_modules/openai/resources/admin/organization/projects/groups/roles.mjs +1 -1
  486. package/node_modules/openai/resources/admin/organization/projects/groups.js +1 -1
  487. package/node_modules/openai/resources/admin/organization/projects/groups.mjs +1 -1
  488. package/node_modules/openai/resources/admin/organization/projects/hosted-tool-permissions.js +1 -1
  489. package/node_modules/openai/resources/admin/organization/projects/hosted-tool-permissions.mjs +1 -1
  490. package/node_modules/openai/resources/admin/organization/projects/index.js +8 -6
  491. package/node_modules/openai/resources/admin/organization/projects/index.mjs +3 -2
  492. package/node_modules/openai/resources/admin/organization/projects/model-permissions.js +1 -1
  493. package/node_modules/openai/resources/admin/organization/projects/model-permissions.mjs +1 -1
  494. package/node_modules/openai/resources/admin/organization/projects/projects.js +7 -3
  495. package/node_modules/openai/resources/admin/organization/projects/projects.mjs +7 -3
  496. package/node_modules/openai/resources/admin/organization/projects/rate-limits.js +1 -1
  497. package/node_modules/openai/resources/admin/organization/projects/rate-limits.mjs +1 -1
  498. package/node_modules/openai/resources/admin/organization/projects/roles.js +1 -1
  499. package/node_modules/openai/resources/admin/organization/projects/roles.mjs +1 -1
  500. package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.js +26 -0
  501. package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.mjs +22 -0
  502. package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.js +9 -0
  503. package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.mjs +4 -0
  504. package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.js +109 -0
  505. package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.mjs +104 -0
  506. package/node_modules/openai/resources/admin/organization/projects/service-accounts.js +3 -98
  507. package/node_modules/openai/resources/admin/organization/projects/service-accounts.mjs +2 -96
  508. package/node_modules/openai/resources/admin/organization/projects/spend-alerts.js +20 -1
  509. package/node_modules/openai/resources/admin/organization/projects/spend-alerts.mjs +20 -1
  510. package/node_modules/openai/resources/admin/organization/projects/spend-limit.js +67 -0
  511. package/node_modules/openai/resources/admin/organization/projects/spend-limit.mjs +63 -0
  512. package/node_modules/openai/resources/admin/organization/projects/users/index.js +1 -1
  513. package/node_modules/openai/resources/admin/organization/projects/users/index.mjs +1 -1
  514. package/node_modules/openai/resources/admin/organization/projects/users/roles.js +1 -1
  515. package/node_modules/openai/resources/admin/organization/projects/users/roles.mjs +1 -1
  516. package/node_modules/openai/resources/admin/organization/projects/users/users.js +1 -1
  517. package/node_modules/openai/resources/admin/organization/projects/users/users.mjs +1 -1
  518. package/node_modules/openai/resources/admin/organization/projects/users.js +1 -1
  519. package/node_modules/openai/resources/admin/organization/projects/users.mjs +1 -1
  520. package/node_modules/openai/resources/admin/organization/projects.js +1 -1
  521. package/node_modules/openai/resources/admin/organization/projects.mjs +1 -1
  522. package/node_modules/openai/resources/admin/organization/roles.js +1 -1
  523. package/node_modules/openai/resources/admin/organization/roles.mjs +1 -1
  524. package/node_modules/openai/resources/admin/organization/spend-alerts.js +18 -1
  525. package/node_modules/openai/resources/admin/organization/spend-alerts.mjs +18 -1
  526. package/node_modules/openai/resources/admin/organization/spend-limit.js +59 -0
  527. package/node_modules/openai/resources/admin/organization/spend-limit.mjs +55 -0
  528. package/node_modules/openai/resources/admin/organization/usage.js +1 -1
  529. package/node_modules/openai/resources/admin/organization/usage.mjs +1 -1
  530. package/node_modules/openai/resources/admin/organization/users/index.js +1 -1
  531. package/node_modules/openai/resources/admin/organization/users/index.mjs +1 -1
  532. package/node_modules/openai/resources/admin/organization/users/roles.js +1 -1
  533. package/node_modules/openai/resources/admin/organization/users/roles.mjs +1 -1
  534. package/node_modules/openai/resources/admin/organization/users/users.js +1 -1
  535. package/node_modules/openai/resources/admin/organization/users/users.mjs +1 -1
  536. package/node_modules/openai/resources/admin/organization/users.js +1 -1
  537. package/node_modules/openai/resources/admin/organization/users.mjs +1 -1
  538. package/node_modules/openai/resources/admin/organization.js +1 -1
  539. package/node_modules/openai/resources/admin/organization.mjs +1 -1
  540. package/node_modules/openai/resources/admin.js +1 -1
  541. package/node_modules/openai/resources/admin.mjs +1 -1
  542. package/node_modules/openai/resources/audio/audio.js +1 -1
  543. package/node_modules/openai/resources/audio/audio.mjs +1 -1
  544. package/node_modules/openai/resources/audio/index.js +1 -1
  545. package/node_modules/openai/resources/audio/index.mjs +1 -1
  546. package/node_modules/openai/resources/audio/speech.js +1 -1
  547. package/node_modules/openai/resources/audio/speech.mjs +1 -1
  548. package/node_modules/openai/resources/audio/transcriptions.js +1 -1
  549. package/node_modules/openai/resources/audio/transcriptions.mjs +1 -1
  550. package/node_modules/openai/resources/audio/translations.js +1 -1
  551. package/node_modules/openai/resources/audio/translations.mjs +1 -1
  552. package/node_modules/openai/resources/audio.js +1 -1
  553. package/node_modules/openai/resources/audio.mjs +1 -1
  554. package/node_modules/openai/resources/batches.js +1 -1
  555. package/node_modules/openai/resources/batches.mjs +1 -1
  556. package/node_modules/openai/resources/beta/agents/agents.js +118 -0
  557. package/node_modules/openai/resources/beta/agents/agents.mjs +113 -0
  558. package/node_modules/openai/resources/beta/agents/environments/environments.js +43 -0
  559. package/node_modules/openai/resources/beta/agents/environments/environments.mjs +38 -0
  560. package/node_modules/openai/resources/beta/agents/environments/files.js +61 -0
  561. package/node_modules/openai/resources/beta/agents/environments/files.mjs +57 -0
  562. package/node_modules/openai/resources/beta/agents/environments/index.js +11 -0
  563. package/node_modules/openai/resources/beta/agents/environments/index.mjs +5 -0
  564. package/node_modules/openai/resources/beta/agents/environments/templates.js +112 -0
  565. package/node_modules/openai/resources/beta/agents/environments/templates.mjs +108 -0
  566. package/node_modules/openai/resources/beta/agents/environments.js +6 -0
  567. package/node_modules/openai/resources/beta/agents/environments.mjs +3 -0
  568. package/node_modules/openai/resources/beta/agents/index.js +13 -0
  569. package/node_modules/openai/resources/beta/agents/index.mjs +6 -0
  570. package/node_modules/openai/resources/beta/agents/sessions/artifacts.js +106 -0
  571. package/node_modules/openai/resources/beta/agents/sessions/artifacts.mjs +102 -0
  572. package/node_modules/openai/resources/beta/agents/sessions/events.js +75 -0
  573. package/node_modules/openai/resources/beta/agents/sessions/events.mjs +71 -0
  574. package/node_modules/openai/resources/beta/agents/sessions/index.js +17 -0
  575. package/node_modules/openai/resources/beta/agents/sessions/index.mjs +8 -0
  576. package/node_modules/openai/resources/beta/agents/sessions/items.js +35 -0
  577. package/node_modules/openai/resources/beta/agents/sessions/items.mjs +31 -0
  578. package/node_modules/openai/resources/beta/agents/sessions/sessions.js +127 -0
  579. package/node_modules/openai/resources/beta/agents/sessions/sessions.mjs +122 -0
  580. package/node_modules/openai/resources/beta/agents/sessions/subagents/index.js +11 -0
  581. package/node_modules/openai/resources/beta/agents/sessions/subagents/index.mjs +5 -0
  582. package/node_modules/openai/resources/beta/agents/sessions/subagents/items.js +36 -0
  583. package/node_modules/openai/resources/beta/agents/sessions/subagents/items.mjs +32 -0
  584. package/node_modules/openai/resources/beta/agents/sessions/subagents/subagents.js +67 -0
  585. package/node_modules/openai/resources/beta/agents/sessions/subagents/subagents.mjs +62 -0
  586. package/node_modules/openai/resources/beta/agents/sessions/subagents/turns/index.js +9 -0
  587. package/node_modules/openai/resources/beta/agents/sessions/subagents/turns/index.mjs +4 -0
  588. package/node_modules/openai/resources/beta/agents/sessions/subagents/turns/items.js +36 -0
  589. package/node_modules/openai/resources/beta/agents/sessions/subagents/turns/items.mjs +32 -0
  590. package/node_modules/openai/resources/beta/agents/sessions/subagents/turns/turns.js +68 -0
  591. package/node_modules/openai/resources/beta/agents/sessions/subagents/turns/turns.mjs +63 -0
  592. package/node_modules/openai/resources/beta/agents/sessions/subagents/turns.js +6 -0
  593. package/node_modules/openai/resources/beta/agents/sessions/subagents/turns.mjs +3 -0
  594. package/node_modules/openai/resources/beta/agents/sessions/subagents.js +6 -0
  595. package/node_modules/openai/resources/beta/agents/sessions/subagents.mjs +3 -0
  596. package/node_modules/openai/resources/beta/agents/sessions/turns.js +57 -0
  597. package/node_modules/openai/resources/beta/agents/sessions/turns.mjs +53 -0
  598. package/node_modules/openai/resources/beta/agents/sessions.js +6 -0
  599. package/node_modules/openai/resources/beta/agents/sessions.mjs +3 -0
  600. package/node_modules/openai/resources/beta/agents/vaults/credentials.js +132 -0
  601. package/node_modules/openai/resources/beta/agents/vaults/credentials.mjs +128 -0
  602. package/node_modules/openai/resources/beta/agents/vaults/index.js +9 -0
  603. package/node_modules/openai/resources/beta/agents/vaults/index.mjs +4 -0
  604. package/node_modules/openai/resources/beta/agents/vaults/vaults.js +93 -0
  605. package/node_modules/openai/resources/beta/agents/vaults/vaults.mjs +88 -0
  606. package/node_modules/openai/resources/beta/agents/vaults.js +6 -0
  607. package/node_modules/openai/resources/beta/agents/vaults.mjs +3 -0
  608. package/node_modules/openai/resources/beta/agents.js +6 -0
  609. package/node_modules/openai/resources/beta/agents.mjs +3 -0
  610. package/node_modules/openai/resources/beta/assistants.js +1 -1
  611. package/node_modules/openai/resources/beta/assistants.mjs +1 -1
  612. package/node_modules/openai/resources/beta/beta.js +9 -1
  613. package/node_modules/openai/resources/beta/beta.mjs +9 -1
  614. package/node_modules/openai/resources/beta/chatkit/chatkit.js +1 -1
  615. package/node_modules/openai/resources/beta/chatkit/chatkit.mjs +1 -1
  616. package/node_modules/openai/resources/beta/chatkit/index.js +1 -1
  617. package/node_modules/openai/resources/beta/chatkit/index.mjs +1 -1
  618. package/node_modules/openai/resources/beta/chatkit/sessions.js +1 -1
  619. package/node_modules/openai/resources/beta/chatkit/sessions.mjs +1 -1
  620. package/node_modules/openai/resources/beta/chatkit/threads.js +1 -1
  621. package/node_modules/openai/resources/beta/chatkit/threads.mjs +1 -1
  622. package/node_modules/openai/resources/beta/chatkit.js +1 -1
  623. package/node_modules/openai/resources/beta/chatkit.mjs +1 -1
  624. package/node_modules/openai/resources/beta/index.js +12 -8
  625. package/node_modules/openai/resources/beta/index.mjs +3 -1
  626. package/node_modules/openai/resources/beta/realtime/index.js +0 -1
  627. package/node_modules/openai/resources/beta/realtime/index.mjs +0 -1
  628. package/node_modules/openai/resources/beta/realtime/realtime.js +0 -1
  629. package/node_modules/openai/resources/beta/realtime/realtime.mjs +0 -1
  630. package/node_modules/openai/resources/beta/realtime/sessions.js +0 -1
  631. package/node_modules/openai/resources/beta/realtime/sessions.mjs +0 -1
  632. package/node_modules/openai/resources/beta/realtime/transcription-sessions.js +0 -1
  633. package/node_modules/openai/resources/beta/realtime/transcription-sessions.mjs +0 -1
  634. package/node_modules/openai/resources/beta/realtime.js +0 -1
  635. package/node_modules/openai/resources/beta/realtime.mjs +0 -1
  636. package/node_modules/openai/resources/beta/responses/index.js +11 -0
  637. package/node_modules/openai/resources/beta/responses/index.mjs +5 -0
  638. package/node_modules/openai/resources/beta/responses/input-items.js +37 -0
  639. package/node_modules/openai/resources/beta/responses/input-items.mjs +33 -0
  640. package/node_modules/openai/resources/beta/responses/input-tokens.js +34 -0
  641. package/node_modules/openai/resources/beta/responses/input-tokens.mjs +30 -0
  642. package/node_modules/openai/resources/beta/responses/internal-base.js +66 -0
  643. package/node_modules/openai/resources/beta/responses/internal-base.mjs +60 -0
  644. package/node_modules/openai/resources/beta/responses/responses.js +121 -0
  645. package/node_modules/openai/resources/beta/responses/responses.mjs +116 -0
  646. package/node_modules/openai/resources/beta/responses/ws-base.js +566 -0
  647. package/node_modules/openai/resources/beta/responses/ws-base.mjs +560 -0
  648. package/node_modules/openai/resources/beta/responses/ws.js +47 -0
  649. package/node_modules/openai/resources/beta/responses/ws.mjs +42 -0
  650. package/node_modules/openai/resources/beta/responses.js +6 -0
  651. package/node_modules/openai/resources/beta/responses.mjs +3 -0
  652. package/node_modules/openai/resources/beta/threads/index.js +1 -1
  653. package/node_modules/openai/resources/beta/threads/index.mjs +1 -1
  654. package/node_modules/openai/resources/beta/threads/messages.js +1 -1
  655. package/node_modules/openai/resources/beta/threads/messages.mjs +1 -1
  656. package/node_modules/openai/resources/beta/threads/runs/index.js +1 -1
  657. package/node_modules/openai/resources/beta/threads/runs/index.mjs +1 -1
  658. package/node_modules/openai/resources/beta/threads/runs/runs.js +3 -44
  659. package/node_modules/openai/resources/beta/threads/runs/runs.mjs +3 -44
  660. package/node_modules/openai/resources/beta/threads/runs/steps.js +1 -1
  661. package/node_modules/openai/resources/beta/threads/runs/steps.mjs +1 -1
  662. package/node_modules/openai/resources/beta/threads/runs.js +1 -1
  663. package/node_modules/openai/resources/beta/threads/runs.mjs +1 -1
  664. package/node_modules/openai/resources/beta/threads/threads.js +1 -1
  665. package/node_modules/openai/resources/beta/threads/threads.mjs +1 -1
  666. package/node_modules/openai/resources/beta/threads.js +1 -1
  667. package/node_modules/openai/resources/beta/threads.mjs +1 -1
  668. package/node_modules/openai/resources/beta.js +1 -1
  669. package/node_modules/openai/resources/beta.mjs +1 -1
  670. package/node_modules/openai/resources/chat/chat.js +1 -1
  671. package/node_modules/openai/resources/chat/chat.mjs +1 -1
  672. package/node_modules/openai/resources/chat/completions/completions.js +2 -5
  673. package/node_modules/openai/resources/chat/completions/completions.mjs +2 -5
  674. package/node_modules/openai/resources/chat/completions/index.js +1 -1
  675. package/node_modules/openai/resources/chat/completions/index.mjs +1 -1
  676. package/node_modules/openai/resources/chat/completions/messages.js +1 -1
  677. package/node_modules/openai/resources/chat/completions/messages.mjs +1 -1
  678. package/node_modules/openai/resources/chat/completions.js +1 -1
  679. package/node_modules/openai/resources/chat/completions.mjs +1 -1
  680. package/node_modules/openai/resources/chat/index.js +1 -1
  681. package/node_modules/openai/resources/chat/index.mjs +1 -1
  682. package/node_modules/openai/resources/chat.js +1 -1
  683. package/node_modules/openai/resources/chat.mjs +1 -1
  684. package/node_modules/openai/resources/completions.js +1 -1
  685. package/node_modules/openai/resources/completions.mjs +1 -1
  686. package/node_modules/openai/resources/containers/containers.js +1 -1
  687. package/node_modules/openai/resources/containers/containers.mjs +1 -1
  688. package/node_modules/openai/resources/containers/files/content.js +1 -1
  689. package/node_modules/openai/resources/containers/files/content.mjs +1 -1
  690. package/node_modules/openai/resources/containers/files/files.js +1 -1
  691. package/node_modules/openai/resources/containers/files/files.mjs +1 -1
  692. package/node_modules/openai/resources/containers/files/index.js +1 -1
  693. package/node_modules/openai/resources/containers/files/index.mjs +1 -1
  694. package/node_modules/openai/resources/containers/files.js +1 -1
  695. package/node_modules/openai/resources/containers/files.mjs +1 -1
  696. package/node_modules/openai/resources/containers/index.js +1 -1
  697. package/node_modules/openai/resources/containers/index.mjs +1 -1
  698. package/node_modules/openai/resources/containers.js +1 -1
  699. package/node_modules/openai/resources/containers.mjs +1 -1
  700. package/node_modules/openai/resources/content-provenance-checks.js +24 -0
  701. package/node_modules/openai/resources/content-provenance-checks.mjs +20 -0
  702. package/node_modules/openai/resources/conversations/conversations.js +1 -1
  703. package/node_modules/openai/resources/conversations/conversations.mjs +1 -1
  704. package/node_modules/openai/resources/conversations/index.js +1 -1
  705. package/node_modules/openai/resources/conversations/index.mjs +1 -1
  706. package/node_modules/openai/resources/conversations/items.js +1 -1
  707. package/node_modules/openai/resources/conversations/items.mjs +1 -1
  708. package/node_modules/openai/resources/conversations.js +1 -1
  709. package/node_modules/openai/resources/conversations.mjs +1 -1
  710. package/node_modules/openai/resources/embeddings.js +3 -47
  711. package/node_modules/openai/resources/embeddings.mjs +3 -47
  712. package/node_modules/openai/resources/evals/evals.js +2 -2
  713. package/node_modules/openai/resources/evals/evals.mjs +2 -2
  714. package/node_modules/openai/resources/evals/index.js +1 -1
  715. package/node_modules/openai/resources/evals/index.mjs +1 -1
  716. package/node_modules/openai/resources/evals/runs/index.js +1 -1
  717. package/node_modules/openai/resources/evals/runs/index.mjs +1 -1
  718. package/node_modules/openai/resources/evals/runs/output-items.js +1 -1
  719. package/node_modules/openai/resources/evals/runs/output-items.mjs +1 -1
  720. package/node_modules/openai/resources/evals/runs/runs.js +1 -1
  721. package/node_modules/openai/resources/evals/runs/runs.mjs +1 -1
  722. package/node_modules/openai/resources/evals/runs.js +1 -1
  723. package/node_modules/openai/resources/evals/runs.mjs +1 -1
  724. package/node_modules/openai/resources/evals.js +1 -1
  725. package/node_modules/openai/resources/evals.mjs +1 -1
  726. package/node_modules/openai/resources/files.js +9 -22
  727. package/node_modules/openai/resources/files.mjs +9 -22
  728. package/node_modules/openai/resources/fine-tuning/alpha/alpha.js +1 -1
  729. package/node_modules/openai/resources/fine-tuning/alpha/alpha.mjs +1 -1
  730. package/node_modules/openai/resources/fine-tuning/alpha/graders.js +1 -1
  731. package/node_modules/openai/resources/fine-tuning/alpha/graders.mjs +1 -1
  732. package/node_modules/openai/resources/fine-tuning/alpha/index.js +1 -1
  733. package/node_modules/openai/resources/fine-tuning/alpha/index.mjs +1 -1
  734. package/node_modules/openai/resources/fine-tuning/alpha.js +1 -1
  735. package/node_modules/openai/resources/fine-tuning/alpha.mjs +1 -1
  736. package/node_modules/openai/resources/fine-tuning/checkpoints/checkpoints.js +1 -1
  737. package/node_modules/openai/resources/fine-tuning/checkpoints/checkpoints.mjs +1 -1
  738. package/node_modules/openai/resources/fine-tuning/checkpoints/index.js +1 -1
  739. package/node_modules/openai/resources/fine-tuning/checkpoints/index.mjs +1 -1
  740. package/node_modules/openai/resources/fine-tuning/checkpoints/permissions.js +9 -5
  741. package/node_modules/openai/resources/fine-tuning/checkpoints/permissions.mjs +9 -5
  742. package/node_modules/openai/resources/fine-tuning/checkpoints.js +1 -1
  743. package/node_modules/openai/resources/fine-tuning/checkpoints.mjs +1 -1
  744. package/node_modules/openai/resources/fine-tuning/fine-tuning.js +1 -1
  745. package/node_modules/openai/resources/fine-tuning/fine-tuning.mjs +1 -1
  746. package/node_modules/openai/resources/fine-tuning/index.js +1 -1
  747. package/node_modules/openai/resources/fine-tuning/index.mjs +1 -1
  748. package/node_modules/openai/resources/fine-tuning/jobs/checkpoints.js +1 -1
  749. package/node_modules/openai/resources/fine-tuning/jobs/checkpoints.mjs +1 -1
  750. package/node_modules/openai/resources/fine-tuning/jobs/index.js +1 -1
  751. package/node_modules/openai/resources/fine-tuning/jobs/index.mjs +1 -1
  752. package/node_modules/openai/resources/fine-tuning/jobs/jobs.js +3 -3
  753. package/node_modules/openai/resources/fine-tuning/jobs/jobs.mjs +3 -3
  754. package/node_modules/openai/resources/fine-tuning/jobs.js +1 -1
  755. package/node_modules/openai/resources/fine-tuning/jobs.mjs +1 -1
  756. package/node_modules/openai/resources/fine-tuning/methods.js +1 -1
  757. package/node_modules/openai/resources/fine-tuning/methods.mjs +1 -1
  758. package/node_modules/openai/resources/fine-tuning.js +1 -1
  759. package/node_modules/openai/resources/fine-tuning.mjs +1 -1
  760. package/node_modules/openai/resources/graders/grader-models.js +1 -1
  761. package/node_modules/openai/resources/graders/grader-models.mjs +1 -1
  762. package/node_modules/openai/resources/graders/graders.js +1 -1
  763. package/node_modules/openai/resources/graders/graders.mjs +1 -1
  764. package/node_modules/openai/resources/graders/index.js +1 -1
  765. package/node_modules/openai/resources/graders/index.mjs +1 -1
  766. package/node_modules/openai/resources/graders.js +1 -1
  767. package/node_modules/openai/resources/graders.mjs +1 -1
  768. package/node_modules/openai/resources/images.js +8 -2
  769. package/node_modules/openai/resources/images.mjs +8 -2
  770. package/node_modules/openai/resources/index.js +9 -3
  771. package/node_modules/openai/resources/index.mjs +5 -2
  772. package/node_modules/openai/resources/live/forks/forks.js +9 -0
  773. package/node_modules/openai/resources/live/forks/forks.mjs +5 -0
  774. package/node_modules/openai/resources/live/forks/index.js +7 -0
  775. package/node_modules/openai/resources/live/forks/index.mjs +3 -0
  776. package/node_modules/openai/resources/live/forks/internal-base.js +65 -0
  777. package/node_modules/openai/resources/live/forks/internal-base.mjs +59 -0
  778. package/node_modules/openai/resources/live/forks/ws-base.js +547 -0
  779. package/node_modules/openai/resources/live/forks/ws-base.mjs +543 -0
  780. package/node_modules/openai/resources/live/forks/ws.js +32 -0
  781. package/node_modules/openai/resources/live/forks/ws.mjs +27 -0
  782. package/node_modules/openai/resources/live/forks.js +6 -0
  783. package/node_modules/openai/resources/live/forks.mjs +3 -0
  784. package/node_modules/openai/resources/live/index.js +13 -0
  785. package/node_modules/openai/resources/live/index.mjs +6 -0
  786. package/node_modules/openai/resources/live/internal-base.js +64 -0
  787. package/node_modules/openai/resources/live/internal-base.mjs +58 -0
  788. package/node_modules/openai/resources/live/live.js +40 -0
  789. package/node_modules/openai/resources/live/live.mjs +35 -0
  790. package/node_modules/openai/resources/live/sessions.js +124 -0
  791. package/node_modules/openai/resources/live/sessions.mjs +120 -0
  792. package/node_modules/openai/resources/live/sideband/index.js +7 -0
  793. package/node_modules/openai/resources/live/sideband/index.mjs +3 -0
  794. package/node_modules/openai/resources/live/sideband/internal-base.js +65 -0
  795. package/node_modules/openai/resources/live/sideband/internal-base.mjs +59 -0
  796. package/node_modules/openai/resources/live/sideband/sideband.js +9 -0
  797. package/node_modules/openai/resources/live/sideband/sideband.mjs +5 -0
  798. package/node_modules/openai/resources/live/sideband/ws-base.js +547 -0
  799. package/node_modules/openai/resources/live/sideband/ws-base.mjs +543 -0
  800. package/node_modules/openai/resources/live/sideband/ws.js +32 -0
  801. package/node_modules/openai/resources/live/sideband/ws.mjs +27 -0
  802. package/node_modules/openai/resources/live/sideband.js +6 -0
  803. package/node_modules/openai/resources/live/sideband.mjs +3 -0
  804. package/node_modules/openai/resources/live/ws-base.js +547 -0
  805. package/node_modules/openai/resources/live/ws-base.mjs +543 -0
  806. package/node_modules/openai/resources/live/ws.js +32 -0
  807. package/node_modules/openai/resources/live/ws.mjs +27 -0
  808. package/node_modules/openai/resources/live.js +6 -0
  809. package/node_modules/openai/resources/live.mjs +3 -0
  810. package/node_modules/openai/resources/models.js +1 -1
  811. package/node_modules/openai/resources/models.mjs +1 -1
  812. package/node_modules/openai/resources/moderations.js +3 -2
  813. package/node_modules/openai/resources/moderations.mjs +3 -2
  814. package/node_modules/openai/resources/realtime/calls.js +25 -1
  815. package/node_modules/openai/resources/realtime/calls.mjs +25 -1
  816. package/node_modules/openai/resources/realtime/client-secrets.js +2 -2
  817. package/node_modules/openai/resources/realtime/client-secrets.mjs +2 -2
  818. package/node_modules/openai/resources/realtime/index.js +1 -1
  819. package/node_modules/openai/resources/realtime/index.mjs +2 -2
  820. package/node_modules/openai/resources/realtime/realtime.js +1 -1
  821. package/node_modules/openai/resources/realtime/realtime.mjs +1 -1
  822. package/node_modules/openai/resources/realtime.js +1 -1
  823. package/node_modules/openai/resources/realtime.mjs +1 -1
  824. package/node_modules/openai/resources/responses/index.js +1 -1
  825. package/node_modules/openai/resources/responses/index.mjs +1 -1
  826. package/node_modules/openai/resources/responses/input-items.js +1 -1
  827. package/node_modules/openai/resources/responses/input-items.mjs +1 -1
  828. package/node_modules/openai/resources/responses/input-tokens.js +1 -1
  829. package/node_modules/openai/resources/responses/input-tokens.mjs +1 -1
  830. package/node_modules/openai/resources/responses/internal-base.js +24 -6
  831. package/node_modules/openai/resources/responses/internal-base.mjs +24 -6
  832. package/node_modules/openai/resources/responses/responses.js +5 -5
  833. package/node_modules/openai/resources/responses/responses.mjs +5 -5
  834. package/node_modules/openai/resources/responses/ws-base.js +115 -23
  835. package/node_modules/openai/resources/responses/ws-base.mjs +115 -25
  836. package/node_modules/openai/resources/responses/ws.js +23 -7
  837. package/node_modules/openai/resources/responses/ws.mjs +23 -7
  838. package/node_modules/openai/resources/responses.js +1 -1
  839. package/node_modules/openai/resources/responses.mjs +1 -1
  840. package/node_modules/openai/resources/safety/alerts.js +16 -0
  841. package/node_modules/openai/resources/safety/alerts.mjs +12 -0
  842. package/node_modules/openai/resources/safety/index.js +9 -0
  843. package/node_modules/openai/resources/safety/index.mjs +4 -0
  844. package/node_modules/openai/resources/safety/safety.js +17 -0
  845. package/node_modules/openai/resources/safety/safety.mjs +12 -0
  846. package/node_modules/openai/resources/safety.js +6 -0
  847. package/node_modules/openai/resources/safety.mjs +3 -0
  848. package/node_modules/openai/resources/shared.js +1 -1
  849. package/node_modules/openai/resources/shared.mjs +1 -1
  850. package/node_modules/openai/resources/skills/content.js +1 -1
  851. package/node_modules/openai/resources/skills/content.mjs +1 -1
  852. package/node_modules/openai/resources/skills/index.js +1 -1
  853. package/node_modules/openai/resources/skills/index.mjs +1 -1
  854. package/node_modules/openai/resources/skills/skills.js +4 -2
  855. package/node_modules/openai/resources/skills/skills.mjs +4 -2
  856. package/node_modules/openai/resources/skills/versions/content.js +1 -1
  857. package/node_modules/openai/resources/skills/versions/content.mjs +1 -1
  858. package/node_modules/openai/resources/skills/versions/index.js +1 -1
  859. package/node_modules/openai/resources/skills/versions/index.mjs +1 -1
  860. package/node_modules/openai/resources/skills/versions/versions.js +4 -2
  861. package/node_modules/openai/resources/skills/versions/versions.mjs +4 -2
  862. package/node_modules/openai/resources/skills/versions.js +1 -1
  863. package/node_modules/openai/resources/skills/versions.mjs +1 -1
  864. package/node_modules/openai/resources/skills.js +1 -1
  865. package/node_modules/openai/resources/skills.mjs +1 -1
  866. package/node_modules/openai/resources/uploads/index.js +1 -1
  867. package/node_modules/openai/resources/uploads/index.mjs +1 -1
  868. package/node_modules/openai/resources/uploads/parts.js +6 -5
  869. package/node_modules/openai/resources/uploads/parts.mjs +6 -5
  870. package/node_modules/openai/resources/uploads/uploads.js +10 -10
  871. package/node_modules/openai/resources/uploads/uploads.mjs +10 -10
  872. package/node_modules/openai/resources/uploads.js +1 -1
  873. package/node_modules/openai/resources/uploads.mjs +1 -1
  874. package/node_modules/openai/resources/vector-stores/file-batches.js +6 -63
  875. package/node_modules/openai/resources/vector-stores/file-batches.mjs +6 -63
  876. package/node_modules/openai/resources/vector-stores/files.js +6 -39
  877. package/node_modules/openai/resources/vector-stores/files.mjs +6 -39
  878. package/node_modules/openai/resources/vector-stores/index.js +1 -1
  879. package/node_modules/openai/resources/vector-stores/index.mjs +1 -1
  880. package/node_modules/openai/resources/vector-stores/vector-stores.js +1 -1
  881. package/node_modules/openai/resources/vector-stores/vector-stores.mjs +1 -1
  882. package/node_modules/openai/resources/vector-stores.js +1 -1
  883. package/node_modules/openai/resources/vector-stores.mjs +1 -1
  884. package/node_modules/openai/resources/videos.js +24 -1
  885. package/node_modules/openai/resources/videos.mjs +24 -1
  886. package/node_modules/openai/resources/webhooks/event-types.js +21 -0
  887. package/node_modules/openai/resources/webhooks/event-types.mjs +17 -0
  888. package/node_modules/openai/resources/webhooks/index.js +4 -1
  889. package/node_modules/openai/resources/webhooks/index.mjs +2 -1
  890. package/node_modules/openai/resources/webhooks/webhooks.js +127 -43
  891. package/node_modules/openai/resources/webhooks/webhooks.mjs +127 -43
  892. package/node_modules/openai/resources/webhooks.js +1 -1
  893. package/node_modules/openai/resources/webhooks.mjs +1 -1
  894. package/node_modules/openai/src/_vendor/partial-json-parser/LICENSE +21 -0
  895. package/node_modules/openai/src/_vendor/partial-json-parser/README.md +11 -1
  896. package/node_modules/openai/src/_vendor/partial-json-parser/parser.ts +66 -35
  897. package/node_modules/openai/src/_vendor/zod-to-json-schema/Options.ts +32 -18
  898. package/node_modules/openai/src/_vendor/zod-to-json-schema/Refs.ts +7 -6
  899. package/node_modules/openai/src/_vendor/zod-to-json-schema/errorMessages.ts +5 -3
  900. package/node_modules/openai/src/_vendor/zod-to-json-schema/index.ts +3 -1
  901. package/node_modules/openai/src/_vendor/zod-to-json-schema/parseDef.ts +194 -79
  902. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/array.ts +8 -5
  903. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/bigint.ts +20 -12
  904. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/branded.ts +4 -4
  905. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/catch.ts +4 -5
  906. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/date.ts +16 -10
  907. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/default.ts +10 -5
  908. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/effects.ts +4 -3
  909. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/enum.ts +1 -1
  910. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/intersection.ts +12 -9
  911. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/literal.ts +12 -2
  912. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/map.ts +6 -4
  913. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/nativeEnum.ts +10 -11
  914. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/null.ts +4 -3
  915. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/nullable.ts +25 -10
  916. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/number.ts +17 -8
  917. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/object.ts +57 -54
  918. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/optional.ts +25 -17
  919. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/pipeline.ts +8 -6
  920. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/promise.ts +10 -5
  921. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/readonly.ts +4 -5
  922. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/record.ts +22 -19
  923. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/set.ts +6 -4
  924. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/string.ts +62 -37
  925. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/tuple.ts +32 -25
  926. package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/union.ts +51 -33
  927. package/node_modules/openai/src/_vendor/zod-to-json-schema/util.ts +11 -6
  928. package/node_modules/openai/src/_vendor/zod-to-json-schema/zodToJsonSchema.ts +133 -52
  929. package/node_modules/openai/src/auth/index.ts +7 -1
  930. package/node_modules/openai/src/auth/subject-token-providers.ts +281 -16
  931. package/node_modules/openai/src/auth/types.ts +48 -5
  932. package/node_modules/openai/src/auth/workload-identity-auth.ts +227 -26
  933. package/node_modules/openai/src/auth/x509-transport.ts +369 -0
  934. package/node_modules/openai/src/azure.ts +127 -28
  935. package/node_modules/openai/src/bedrock.ts +294 -0
  936. package/node_modules/openai/src/beta/realtime/internal-base.ts +136 -16
  937. package/node_modules/openai/src/beta/realtime/websocket.ts +264 -48
  938. package/node_modules/openai/src/beta/realtime/ws.ts +138 -25
  939. package/node_modules/openai/src/client.ts +975 -124
  940. package/node_modules/openai/src/core/EventEmitter.ts +162 -26
  941. package/node_modules/openai/src/core/api-promise.ts +0 -2
  942. package/node_modules/openai/src/core/error.ts +6 -8
  943. package/node_modules/openai/src/core/pagination.ts +67 -7
  944. package/node_modules/openai/src/core/resource.ts +0 -2
  945. package/node_modules/openai/src/core/streaming.ts +490 -100
  946. package/node_modules/openai/src/core/uploads.ts +6 -1
  947. package/node_modules/openai/src/helpers/audio.ts +215 -32
  948. package/node_modules/openai/src/helpers/live.ts +8 -0
  949. package/node_modules/openai/src/helpers/standard-schema.ts +819 -0
  950. package/node_modules/openai/src/helpers/zod-v3-strict-schema.ts +520 -0
  951. package/node_modules/openai/src/helpers/zod.ts +418 -56
  952. package/node_modules/openai/src/index.ts +4 -5
  953. package/node_modules/openai/src/internal/assistant-stream-delta.ts +440 -0
  954. package/node_modules/openai/src/internal/auth/x509-api-origin.ts +27 -0
  955. package/node_modules/openai/src/internal/auth/x509-credential-options.ts +149 -0
  956. package/node_modules/openai/src/internal/auth/x509-token-exchange.ts +319 -0
  957. package/node_modules/openai/src/internal/auth/x509-transport-capability.ts +227 -0
  958. package/node_modules/openai/src/internal/auth/x509-transport-registry.ts +127 -0
  959. package/node_modules/openai/src/internal/auth/x509-transport-state-browser.ts +43 -0
  960. package/node_modules/openai/src/internal/auth/x509-transport-state.cts +43 -0
  961. package/node_modules/openai/src/internal/auth/x509-workload-identity-auth.ts +972 -0
  962. package/node_modules/openai/src/internal/bedrock.ts +586 -0
  963. package/node_modules/openai/src/internal/builtin-types.ts +0 -2
  964. package/node_modules/openai/src/internal/data-residency.ts +44 -0
  965. package/node_modules/openai/src/internal/decoders/line.ts +145 -61
  966. package/node_modules/openai/src/internal/detect-platform.ts +3 -5
  967. package/node_modules/openai/src/internal/errors.ts +3 -4
  968. package/node_modules/openai/src/internal/headers.ts +14 -10
  969. package/node_modules/openai/src/internal/multipart-encoding.ts +53 -0
  970. package/node_modules/openai/src/internal/parse.ts +47 -19
  971. package/node_modules/openai/src/internal/provider.ts +92 -0
  972. package/node_modules/openai/src/internal/qs/formats.ts +1 -1
  973. package/node_modules/openai/src/internal/qs/stringify.ts +57 -53
  974. package/node_modules/openai/src/internal/qs/types.ts +1 -1
  975. package/node_modules/openai/src/internal/qs/utils.ts +443 -54
  976. package/node_modules/openai/src/internal/realtime-credentials.ts +27 -0
  977. package/node_modules/openai/src/internal/request-options.ts +52 -3
  978. package/node_modules/openai/src/internal/responses/canonical-output-text.ts +160 -0
  979. package/node_modules/openai/src/internal/responses/output-text-index.ts +84 -0
  980. package/node_modules/openai/src/internal/responses/response-accumulator.ts +1263 -0
  981. package/node_modules/openai/src/internal/shim-types.ts +3 -4
  982. package/node_modules/openai/src/internal/shims.ts +0 -2
  983. package/node_modules/openai/src/internal/stream-utils.ts +37 -5
  984. package/node_modules/openai/src/internal/to-file.ts +90 -35
  985. package/node_modules/openai/src/internal/types.ts +21 -29
  986. package/node_modules/openai/src/internal/uploads.ts +533 -59
  987. package/node_modules/openai/src/internal/utils/abort.ts +116 -0
  988. package/node_modules/openai/src/internal/utils/base64.ts +3 -2
  989. package/node_modules/openai/src/internal/utils/bytes.ts +7 -0
  990. package/node_modules/openai/src/internal/utils/env.ts +9 -7
  991. package/node_modules/openai/src/internal/utils/log.ts +77 -14
  992. package/node_modules/openai/src/internal/utils/path.ts +53 -32
  993. package/node_modules/openai/src/internal/utils/query.ts +0 -2
  994. package/node_modules/openai/src/internal/utils/sleep.ts +51 -2
  995. package/node_modules/openai/src/internal/utils/uuid.ts +0 -2
  996. package/node_modules/openai/src/internal/utils/values.ts +0 -2
  997. package/node_modules/openai/src/internal/utils.ts +0 -2
  998. package/node_modules/openai/src/internal/ws-adapter-browser.ts +83 -24
  999. package/node_modules/openai/src/internal/ws-adapter-node.ts +105 -26
  1000. package/node_modules/openai/src/internal/ws-adapter.ts +23 -0
  1001. package/node_modules/openai/src/internal/ws.ts +250 -51
  1002. package/node_modules/openai/src/lib/.keep +2 -2
  1003. package/node_modules/openai/src/lib/AbstractChatCompletionRunner.ts +349 -102
  1004. package/node_modules/openai/src/lib/AssistantStream.ts +537 -268
  1005. package/node_modules/openai/src/lib/ChatCompletionRunner.ts +75 -22
  1006. package/node_modules/openai/src/lib/ChatCompletionStream.ts +2016 -268
  1007. package/node_modules/openai/src/lib/ChatCompletionStreamingRunner.ts +115 -17
  1008. package/node_modules/openai/src/lib/EventEmitter.ts +171 -26
  1009. package/node_modules/openai/src/lib/EventStream.ts +1979 -64
  1010. package/node_modules/openai/src/lib/ResponsesParser.ts +153 -56
  1011. package/node_modules/openai/src/lib/RunnableFunction.ts +99 -37
  1012. package/node_modules/openai/src/lib/Util.ts +7 -5
  1013. package/node_modules/openai/src/lib/agents/agent-session-stream.ts +328 -0
  1014. package/node_modules/openai/src/lib/agents/output-text.ts +6 -0
  1015. package/node_modules/openai/src/lib/agents/turn-state.ts +61 -0
  1016. package/node_modules/openai/src/lib/assistant-run-polling.ts +27 -0
  1017. package/node_modules/openai/src/lib/chatCompletionUtils.ts +9 -10
  1018. package/node_modules/openai/src/lib/embeddings.ts +73 -0
  1019. package/node_modules/openai/src/lib/file-processing.ts +37 -0
  1020. package/node_modules/openai/src/lib/jsonschema.ts +77 -34
  1021. package/node_modules/openai/src/lib/live/transcript-grouper.ts +307 -0
  1022. package/node_modules/openai/src/lib/live/transcript-grouping.ts +394 -0
  1023. package/node_modules/openai/src/lib/live/webrtc.ts +23 -0
  1024. package/node_modules/openai/src/lib/parser.ts +247 -69
  1025. package/node_modules/openai/src/lib/polling.ts +145 -0
  1026. package/node_modules/openai/src/lib/realtime/webrtc.ts +20 -0
  1027. package/node_modules/openai/src/lib/responses/EventTypes.ts +9 -60
  1028. package/node_modules/openai/src/lib/responses/ResponseAccumulator.ts +27 -0
  1029. package/node_modules/openai/src/lib/responses/ResponseInputItems.ts +167 -0
  1030. package/node_modules/openai/src/lib/responses/ResponseStream.ts +135 -179
  1031. package/node_modules/openai/src/lib/responses/responses-websocket-lane.ts +388 -0
  1032. package/node_modules/openai/src/lib/responses/responses-websocket-session.ts +317 -0
  1033. package/node_modules/openai/src/lib/transform.ts +2015 -100
  1034. package/node_modules/openai/src/lib/vector-store-polling.ts +46 -0
  1035. package/node_modules/openai/src/lib/vector-store-upload.ts +57 -0
  1036. package/node_modules/openai/src/lib/webhook-signature.ts +164 -0
  1037. package/node_modules/openai/src/lib/webrtc/connection.ts +313 -0
  1038. package/node_modules/openai/src/lib/webrtc/data-channel.ts +151 -0
  1039. package/node_modules/openai/src/lib/webrtc/errors.ts +38 -0
  1040. package/node_modules/openai/src/lib/webrtc/subscriptions.ts +65 -0
  1041. package/node_modules/openai/src/lib/webrtc/types.ts +110 -0
  1042. package/node_modules/openai/src/live/webrtc.ts +10 -0
  1043. package/node_modules/openai/src/providers/bedrock/aws.ts +331 -0
  1044. package/node_modules/openai/src/providers/bedrock.ts +51 -0
  1045. package/node_modules/openai/src/realtime/internal-base.ts +265 -17
  1046. package/node_modules/openai/src/realtime/webrtc.ts +10 -0
  1047. package/node_modules/openai/src/realtime/websocket.ts +259 -54
  1048. package/node_modules/openai/src/realtime/ws.ts +135 -29
  1049. package/node_modules/openai/src/resources/admin/admin.ts +1 -1
  1050. package/node_modules/openai/src/resources/admin/index.ts +1 -1
  1051. package/node_modules/openai/src/resources/admin/organization/admin-api-keys.ts +18 -2
  1052. package/node_modules/openai/src/resources/admin/organization/audit-logs.ts +327 -4
  1053. package/node_modules/openai/src/resources/admin/organization/certificates.ts +1 -1
  1054. package/node_modules/openai/src/resources/admin/organization/data-retention.ts +1 -1
  1055. package/node_modules/openai/src/resources/admin/organization/groups/groups.ts +1 -1
  1056. package/node_modules/openai/src/resources/admin/organization/groups/index.ts +1 -1
  1057. package/node_modules/openai/src/resources/admin/organization/groups/roles.ts +1 -1
  1058. package/node_modules/openai/src/resources/admin/organization/groups/users.ts +1 -1
  1059. package/node_modules/openai/src/resources/admin/organization/groups.ts +1 -1
  1060. package/node_modules/openai/src/resources/admin/organization/index.ts +9 -1
  1061. package/node_modules/openai/src/resources/admin/organization/invites.ts +1 -1
  1062. package/node_modules/openai/src/resources/admin/organization/organization.ts +21 -1
  1063. package/node_modules/openai/src/resources/admin/organization/projects/api-keys.ts +22 -2
  1064. package/node_modules/openai/src/resources/admin/organization/projects/certificates.ts +1 -1
  1065. package/node_modules/openai/src/resources/admin/organization/projects/data-retention.ts +1 -1
  1066. package/node_modules/openai/src/resources/admin/organization/projects/groups/groups.ts +1 -1
  1067. package/node_modules/openai/src/resources/admin/organization/projects/groups/index.ts +1 -1
  1068. package/node_modules/openai/src/resources/admin/organization/projects/groups/roles.ts +1 -1
  1069. package/node_modules/openai/src/resources/admin/organization/projects/groups.ts +1 -1
  1070. package/node_modules/openai/src/resources/admin/organization/projects/hosted-tool-permissions.ts +1 -1
  1071. package/node_modules/openai/src/resources/admin/organization/projects/index.ts +10 -2
  1072. package/node_modules/openai/src/resources/admin/organization/projects/model-permissions.ts +1 -1
  1073. package/node_modules/openai/src/resources/admin/organization/projects/projects.ts +70 -19
  1074. package/node_modules/openai/src/resources/admin/organization/projects/rate-limits.ts +1 -1
  1075. package/node_modules/openai/src/resources/admin/organization/projects/roles.ts +1 -1
  1076. package/node_modules/openai/src/resources/admin/organization/projects/service-accounts/api-keys.ts +91 -0
  1077. package/node_modules/openai/src/resources/admin/organization/projects/service-accounts/index.ts +15 -0
  1078. package/node_modules/openai/src/resources/admin/organization/projects/service-accounts/service-accounts.ts +299 -0
  1079. package/node_modules/openai/src/resources/admin/organization/projects/service-accounts.ts +2 -265
  1080. package/node_modules/openai/src/resources/admin/organization/projects/spend-alerts.ts +33 -1
  1081. package/node_modules/openai/src/resources/admin/organization/projects/spend-limit.ts +156 -0
  1082. package/node_modules/openai/src/resources/admin/organization/projects/users/index.ts +1 -1
  1083. package/node_modules/openai/src/resources/admin/organization/projects/users/roles.ts +1 -1
  1084. package/node_modules/openai/src/resources/admin/organization/projects/users/users.ts +1 -1
  1085. package/node_modules/openai/src/resources/admin/organization/projects/users.ts +1 -1
  1086. package/node_modules/openai/src/resources/admin/organization/projects.ts +1 -1
  1087. package/node_modules/openai/src/resources/admin/organization/roles.ts +1 -1
  1088. package/node_modules/openai/src/resources/admin/organization/spend-alerts.ts +19 -1
  1089. package/node_modules/openai/src/resources/admin/organization/spend-limit.ts +144 -0
  1090. package/node_modules/openai/src/resources/admin/organization/usage.ts +706 -89
  1091. package/node_modules/openai/src/resources/admin/organization/users/index.ts +1 -1
  1092. package/node_modules/openai/src/resources/admin/organization/users/roles.ts +1 -1
  1093. package/node_modules/openai/src/resources/admin/organization/users/users.ts +1 -1
  1094. package/node_modules/openai/src/resources/admin/organization/users.ts +1 -1
  1095. package/node_modules/openai/src/resources/admin/organization.ts +1 -1
  1096. package/node_modules/openai/src/resources/admin.ts +1 -1
  1097. package/node_modules/openai/src/resources/audio/audio.ts +4 -1
  1098. package/node_modules/openai/src/resources/audio/index.ts +2 -1
  1099. package/node_modules/openai/src/resources/audio/speech.ts +4 -3
  1100. package/node_modules/openai/src/resources/audio/transcriptions.ts +51 -13
  1101. package/node_modules/openai/src/resources/audio/translations.ts +5 -3
  1102. package/node_modules/openai/src/resources/audio.ts +1 -1
  1103. package/node_modules/openai/src/resources/batches.ts +10 -9
  1104. package/node_modules/openai/src/resources/beta/agents/agents.ts +4627 -0
  1105. package/node_modules/openai/src/resources/beta/agents/environments/environments.ts +111 -0
  1106. package/node_modules/openai/src/resources/beta/agents/environments/files.ts +169 -0
  1107. package/node_modules/openai/src/resources/beta/agents/environments/index.ts +19 -0
  1108. package/node_modules/openai/src/resources/beta/agents/environments/templates.ts +535 -0
  1109. package/node_modules/openai/src/resources/beta/agents/environments.ts +3 -0
  1110. package/node_modules/openai/src/resources/beta/agents/index.ts +127 -0
  1111. package/node_modules/openai/src/resources/beta/agents/sessions/artifacts.ts +249 -0
  1112. package/node_modules/openai/src/resources/beta/agents/sessions/events.ts +94 -0
  1113. package/node_modules/openai/src/resources/beta/agents/sessions/index.ts +24 -0
  1114. package/node_modules/openai/src/resources/beta/agents/sessions/items.ts +59 -0
  1115. package/node_modules/openai/src/resources/beta/agents/sessions/sessions.ts +403 -0
  1116. package/node_modules/openai/src/resources/beta/agents/sessions/subagents/index.ts +5 -0
  1117. package/node_modules/openai/src/resources/beta/agents/sessions/subagents/items.ts +65 -0
  1118. package/node_modules/openai/src/resources/beta/agents/sessions/subagents/subagents.ts +113 -0
  1119. package/node_modules/openai/src/resources/beta/agents/sessions/subagents/turns/index.ts +4 -0
  1120. package/node_modules/openai/src/resources/beta/agents/sessions/subagents/turns/items.ts +70 -0
  1121. package/node_modules/openai/src/resources/beta/agents/sessions/subagents/turns/turns.ts +111 -0
  1122. package/node_modules/openai/src/resources/beta/agents/sessions/subagents/turns.ts +3 -0
  1123. package/node_modules/openai/src/resources/beta/agents/sessions/subagents.ts +3 -0
  1124. package/node_modules/openai/src/resources/beta/agents/sessions/turns.ts +159 -0
  1125. package/node_modules/openai/src/resources/beta/agents/sessions.ts +3 -0
  1126. package/node_modules/openai/src/resources/beta/agents/vaults/credentials.ts +693 -0
  1127. package/node_modules/openai/src/resources/beta/agents/vaults/index.ts +29 -0
  1128. package/node_modules/openai/src/resources/beta/agents/vaults/vaults.ts +243 -0
  1129. package/node_modules/openai/src/resources/beta/agents/vaults.ts +3 -0
  1130. package/node_modules/openai/src/resources/beta/agents.ts +3 -0
  1131. package/node_modules/openai/src/resources/beta/assistants.ts +154 -172
  1132. package/node_modules/openai/src/resources/beta/beta.ts +578 -3
  1133. package/node_modules/openai/src/resources/beta/chatkit/chatkit.ts +1 -1
  1134. package/node_modules/openai/src/resources/beta/chatkit/index.ts +1 -1
  1135. package/node_modules/openai/src/resources/beta/chatkit/sessions.ts +1 -1
  1136. package/node_modules/openai/src/resources/beta/chatkit/threads.ts +1 -1
  1137. package/node_modules/openai/src/resources/beta/chatkit.ts +1 -1
  1138. package/node_modules/openai/src/resources/beta/index.ts +290 -1
  1139. package/node_modules/openai/src/resources/beta/realtime/index.ts +0 -2
  1140. package/node_modules/openai/src/resources/beta/realtime/realtime.ts +0 -2
  1141. package/node_modules/openai/src/resources/beta/realtime/sessions.ts +0 -2
  1142. package/node_modules/openai/src/resources/beta/realtime/transcription-sessions.ts +0 -2
  1143. package/node_modules/openai/src/resources/beta/realtime.ts +0 -2
  1144. package/node_modules/openai/src/resources/beta/responses/index.ts +189 -0
  1145. package/node_modules/openai/src/resources/beta/responses/input-items.ts +105 -0
  1146. package/node_modules/openai/src/resources/beta/responses/input-tokens.ts +249 -0
  1147. package/node_modules/openai/src/resources/beta/responses/internal-base.ts +136 -0
  1148. package/node_modules/openai/src/resources/beta/responses/responses.ts +15060 -0
  1149. package/node_modules/openai/src/resources/beta/responses/ws-base.ts +729 -0
  1150. package/node_modules/openai/src/resources/beta/responses/ws.ts +62 -0
  1151. package/node_modules/openai/src/resources/beta/responses.ts +3 -0
  1152. package/node_modules/openai/src/resources/beta/threads/index.ts +1 -1
  1153. package/node_modules/openai/src/resources/beta/threads/messages.ts +30 -24
  1154. package/node_modules/openai/src/resources/beta/threads/runs/index.ts +2 -2
  1155. package/node_modules/openai/src/resources/beta/threads/runs/runs.ts +47 -93
  1156. package/node_modules/openai/src/resources/beta/threads/runs/steps.ts +15 -16
  1157. package/node_modules/openai/src/resources/beta/threads/runs.ts +1 -1
  1158. package/node_modules/openai/src/resources/beta/threads/threads.ts +54 -51
  1159. package/node_modules/openai/src/resources/beta/threads.ts +1 -1
  1160. package/node_modules/openai/src/resources/beta.ts +1 -1
  1161. package/node_modules/openai/src/resources/chat/chat.ts +1 -1
  1162. package/node_modules/openai/src/resources/chat/completions/completions.ts +762 -108
  1163. package/node_modules/openai/src/resources/chat/completions/index.ts +1 -1
  1164. package/node_modules/openai/src/resources/chat/completions/messages.ts +1 -1
  1165. package/node_modules/openai/src/resources/chat/completions.ts +1 -1
  1166. package/node_modules/openai/src/resources/chat/index.ts +1 -1
  1167. package/node_modules/openai/src/resources/chat.ts +1 -1
  1168. package/node_modules/openai/src/resources/completions.ts +36 -15
  1169. package/node_modules/openai/src/resources/containers/containers.ts +1 -1
  1170. package/node_modules/openai/src/resources/containers/files/content.ts +1 -1
  1171. package/node_modules/openai/src/resources/containers/files/files.ts +1 -1
  1172. package/node_modules/openai/src/resources/containers/files/index.ts +1 -1
  1173. package/node_modules/openai/src/resources/containers/files.ts +1 -1
  1174. package/node_modules/openai/src/resources/containers/index.ts +1 -1
  1175. package/node_modules/openai/src/resources/containers.ts +1 -1
  1176. package/node_modules/openai/src/resources/content-provenance-checks.ts +132 -0
  1177. package/node_modules/openai/src/resources/conversations/conversations.ts +23 -2
  1178. package/node_modules/openai/src/resources/conversations/index.ts +1 -1
  1179. package/node_modules/openai/src/resources/conversations/items.ts +93 -5
  1180. package/node_modules/openai/src/resources/conversations.ts +1 -1
  1181. package/node_modules/openai/src/resources/embeddings.ts +22 -49
  1182. package/node_modules/openai/src/resources/evals/evals.ts +6 -6
  1183. package/node_modules/openai/src/resources/evals/index.ts +1 -1
  1184. package/node_modules/openai/src/resources/evals/runs/index.ts +1 -1
  1185. package/node_modules/openai/src/resources/evals/runs/output-items.ts +1 -1
  1186. package/node_modules/openai/src/resources/evals/runs/runs.ts +119 -191
  1187. package/node_modules/openai/src/resources/evals/runs.ts +1 -1
  1188. package/node_modules/openai/src/resources/evals.ts +1 -1
  1189. package/node_modules/openai/src/resources/files.ts +9 -26
  1190. package/node_modules/openai/src/resources/fine-tuning/alpha/alpha.ts +1 -1
  1191. package/node_modules/openai/src/resources/fine-tuning/alpha/graders.ts +6 -5
  1192. package/node_modules/openai/src/resources/fine-tuning/alpha/index.ts +1 -1
  1193. package/node_modules/openai/src/resources/fine-tuning/alpha.ts +1 -1
  1194. package/node_modules/openai/src/resources/fine-tuning/checkpoints/checkpoints.ts +1 -1
  1195. package/node_modules/openai/src/resources/fine-tuning/checkpoints/index.ts +1 -1
  1196. package/node_modules/openai/src/resources/fine-tuning/checkpoints/permissions.ts +9 -5
  1197. package/node_modules/openai/src/resources/fine-tuning/checkpoints.ts +1 -1
  1198. package/node_modules/openai/src/resources/fine-tuning/fine-tuning.ts +1 -1
  1199. package/node_modules/openai/src/resources/fine-tuning/index.ts +1 -1
  1200. package/node_modules/openai/src/resources/fine-tuning/jobs/checkpoints.ts +1 -1
  1201. package/node_modules/openai/src/resources/fine-tuning/jobs/index.ts +1 -1
  1202. package/node_modules/openai/src/resources/fine-tuning/jobs/jobs.ts +14 -13
  1203. package/node_modules/openai/src/resources/fine-tuning/jobs.ts +1 -1
  1204. package/node_modules/openai/src/resources/fine-tuning/methods.ts +1 -1
  1205. package/node_modules/openai/src/resources/fine-tuning.ts +1 -1
  1206. package/node_modules/openai/src/resources/graders/grader-models.ts +7 -14
  1207. package/node_modules/openai/src/resources/graders/graders.ts +1 -1
  1208. package/node_modules/openai/src/resources/graders/index.ts +1 -1
  1209. package/node_modules/openai/src/resources/graders.ts +1 -1
  1210. package/node_modules/openai/src/resources/images.ts +100 -85
  1211. package/node_modules/openai/src/resources/index.ts +9 -2
  1212. package/node_modules/openai/src/resources/live/api.md +87 -0
  1213. package/node_modules/openai/src/resources/live/forks/forks.ts +169 -0
  1214. package/node_modules/openai/src/resources/live/forks/index.ts +5 -0
  1215. package/node_modules/openai/src/resources/live/forks/internal-base.ts +126 -0
  1216. package/node_modules/openai/src/resources/live/forks/ws-base.ts +700 -0
  1217. package/node_modules/openai/src/resources/live/forks/ws.ts +47 -0
  1218. package/node_modules/openai/src/resources/live/forks.ts +3 -0
  1219. package/node_modules/openai/src/resources/live/index.ts +20 -0
  1220. package/node_modules/openai/src/resources/live/internal-base.ts +123 -0
  1221. package/node_modules/openai/src/resources/live/live.ts +2296 -0
  1222. package/node_modules/openai/src/resources/live/sessions.ts +343 -0
  1223. package/node_modules/openai/src/resources/live/sideband/index.ts +10 -0
  1224. package/node_modules/openai/src/resources/live/sideband/internal-base.ts +126 -0
  1225. package/node_modules/openai/src/resources/live/sideband/sideband.ts +58 -0
  1226. package/node_modules/openai/src/resources/live/sideband/ws-base.ts +710 -0
  1227. package/node_modules/openai/src/resources/live/sideband/ws.ts +47 -0
  1228. package/node_modules/openai/src/resources/live/sideband.ts +3 -0
  1229. package/node_modules/openai/src/resources/live/ws-base.ts +696 -0
  1230. package/node_modules/openai/src/resources/live/ws.ts +43 -0
  1231. package/node_modules/openai/src/resources/live.ts +3 -0
  1232. package/node_modules/openai/src/resources/models.ts +6 -1
  1233. package/node_modules/openai/src/resources/moderations.ts +6 -5
  1234. package/node_modules/openai/src/resources/realtime/api.md +1 -0
  1235. package/node_modules/openai/src/resources/realtime/calls.ts +50 -2
  1236. package/node_modules/openai/src/resources/realtime/client-secrets.ts +27 -10
  1237. package/node_modules/openai/src/resources/realtime/index.ts +8 -2
  1238. package/node_modules/openai/src/resources/realtime/realtime.ts +93 -35
  1239. package/node_modules/openai/src/resources/realtime.ts +1 -1
  1240. package/node_modules/openai/src/resources/responses/api.md +20 -0
  1241. package/node_modules/openai/src/resources/responses/index.ts +1 -1
  1242. package/node_modules/openai/src/resources/responses/input-items.ts +1 -1
  1243. package/node_modules/openai/src/resources/responses/input-tokens.ts +26 -16
  1244. package/node_modules/openai/src/resources/responses/internal-base.ts +33 -14
  1245. package/node_modules/openai/src/resources/responses/responses.ts +4150 -792
  1246. package/node_modules/openai/src/resources/responses/ws-base.ts +147 -31
  1247. package/node_modules/openai/src/resources/responses/ws.ts +33 -9
  1248. package/node_modules/openai/src/resources/responses.ts +1 -1
  1249. package/node_modules/openai/src/resources/safety/alerts.ts +51 -0
  1250. package/node_modules/openai/src/resources/safety/index.ts +4 -0
  1251. package/node_modules/openai/src/resources/safety/safety.ts +15 -0
  1252. package/node_modules/openai/src/resources/safety.ts +3 -0
  1253. package/node_modules/openai/src/resources/shared.ts +98 -41
  1254. package/node_modules/openai/src/resources/skills/content.ts +1 -1
  1255. package/node_modules/openai/src/resources/skills/index.ts +1 -1
  1256. package/node_modules/openai/src/resources/skills/skills.ts +4 -2
  1257. package/node_modules/openai/src/resources/skills/versions/content.ts +1 -1
  1258. package/node_modules/openai/src/resources/skills/versions/index.ts +1 -1
  1259. package/node_modules/openai/src/resources/skills/versions/versions.ts +4 -2
  1260. package/node_modules/openai/src/resources/skills/versions.ts +1 -1
  1261. package/node_modules/openai/src/resources/skills.ts +1 -1
  1262. package/node_modules/openai/src/resources/uploads/index.ts +1 -1
  1263. package/node_modules/openai/src/resources/uploads/parts.ts +6 -5
  1264. package/node_modules/openai/src/resources/uploads/uploads.ts +12 -12
  1265. package/node_modules/openai/src/resources/uploads.ts +1 -1
  1266. package/node_modules/openai/src/resources/vector-stores/file-batches.ts +24 -89
  1267. package/node_modules/openai/src/resources/vector-stores/files.ts +12 -52
  1268. package/node_modules/openai/src/resources/vector-stores/index.ts +1 -1
  1269. package/node_modules/openai/src/resources/vector-stores/vector-stores.ts +4 -4
  1270. package/node_modules/openai/src/resources/vector-stores.ts +1 -1
  1271. package/node_modules/openai/src/resources/videos.ts +63 -2
  1272. package/node_modules/openai/src/resources/webhooks/api.md +40 -17
  1273. package/node_modules/openai/src/resources/webhooks/event-types.ts +21 -0
  1274. package/node_modules/openai/src/resources/webhooks/index.ts +2 -1
  1275. package/node_modules/openai/src/resources/webhooks/webhooks.ts +694 -69
  1276. package/node_modules/openai/src/resources/webhooks.ts +1 -1
  1277. package/node_modules/openai/src/tsconfig.json +6 -3
  1278. package/node_modules/openai/src/version.ts +2 -1
  1279. package/node_modules/openai/version.js +2 -1
  1280. package/node_modules/openai/version.mjs +2 -1
  1281. package/package.json +5 -5
  1282. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +0 -832
  1283. package/node_modules/@earendil-works/pi-ai/dist/images-models.js +0 -143
  1284. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-images.js +0 -22
  1285. /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/LICENSE +0 -0
  1286. /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/README.md +0 -0
  1287. /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +0 -0
  1288. /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/constants.js +0 -0
  1289. /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/fromEnvSigningName.js +0 -0
  1290. /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/fromSso.js +0 -0
  1291. /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/fromStatic.js +0 -0
  1292. /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/getNewSsoOidcToken.js +0 -0
  1293. /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/getSsoOidcClient.js +0 -0
  1294. /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/index.js +0 -0
  1295. /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/nodeProvider.js +0 -0
  1296. /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/validateTokenExpiry.js +0 -0
  1297. /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/validateTokenKey.js +0 -0
  1298. /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/writeSSOTokenToFile.js +0 -0
  1299. /package/node_modules/@earendil-works/pi-ai/dist/{auth/oauth → utils}/oauth-page.js +0 -0
@@ -1,28 +1,548 @@
1
- export function toStrictJsonSchema(schema) {
2
- if (schema.type !== 'object') {
3
- throw new Error(`Root schema must have type: 'object' but got type: ${schema.type ? `'${schema.type}'` : 'undefined'}`);
1
+ import { hasOwn } from "../internal/utils.mjs";
2
+ const JSON_SCHEMA_ANNOTATION_KEYWORDS = new Set([
3
+ '$comment',
4
+ 'default',
5
+ 'description',
6
+ 'examples',
7
+ 'readOnly',
8
+ 'title',
9
+ 'writeOnly',
10
+ ]);
11
+ const JSON_SCHEMA_ROOT_METADATA_KEYWORDS = new Set(['$id', '$schema']);
12
+ const JSON_SCHEMA_OBJECT_KEYWORDS = new Set([
13
+ 'additionalProperties',
14
+ 'dependencies',
15
+ 'maxProperties',
16
+ 'minProperties',
17
+ 'patternProperties',
18
+ 'properties',
19
+ 'propertyNames',
20
+ 'required',
21
+ ]);
22
+ const JSON_SCHEMA_SINGLE_SCHEMA_KEYWORDS = [
23
+ 'additionalItems',
24
+ 'additionalProperties',
25
+ 'contains',
26
+ 'contentSchema',
27
+ 'else',
28
+ 'if',
29
+ 'not',
30
+ 'propertyNames',
31
+ 'then',
32
+ 'unevaluatedItems',
33
+ 'unevaluatedProperties',
34
+ ];
35
+ const JSON_SCHEMA_ARRAY_SCHEMA_KEYWORDS = ['allOf', 'anyOf', 'items', 'oneOf', 'prefixItems'];
36
+ const JSON_SCHEMA_MAP_SCHEMA_KEYWORDS = [
37
+ '$defs',
38
+ 'definitions',
39
+ 'dependentSchemas',
40
+ 'dependencies',
41
+ 'patternProperties',
42
+ 'properties',
43
+ ];
44
+ const JSON_SCHEMA_UNSUPPORTED_SCHEMA_KEYWORDS = new Set([
45
+ '$anchor',
46
+ '$dynamicAnchor',
47
+ '$dynamicRef',
48
+ '$recursiveAnchor',
49
+ '$recursiveRef',
50
+ 'allOf',
51
+ 'contains',
52
+ 'contentEncoding',
53
+ 'contentMediaType',
54
+ 'contentSchema',
55
+ 'dependentRequired',
56
+ 'dependentSchemas',
57
+ 'dependencies',
58
+ 'else',
59
+ 'if',
60
+ 'maxContains',
61
+ 'maxProperties',
62
+ 'minContains',
63
+ 'minProperties',
64
+ 'not',
65
+ 'oneOf',
66
+ 'patternProperties',
67
+ 'prefixItems',
68
+ 'propertyNames',
69
+ 'then',
70
+ 'unevaluatedItems',
71
+ 'unevaluatedProperties',
72
+ 'uniqueItems',
73
+ ]);
74
+ const MERGEABLE_OBJECT_ALL_OF_KEYWORDS = new Set([
75
+ ...JSON_SCHEMA_ANNOTATION_KEYWORDS,
76
+ 'additionalProperties',
77
+ 'properties',
78
+ 'required',
79
+ 'type',
80
+ ]);
81
+ /** Assigns schema keywords without invoking the inherited `__proto__` setter. */
82
+ function assignSchema(target, ...sources) {
83
+ for (const source of sources) {
84
+ if (Object.prototype.propertyIsEnumerable.call(source, '__proto__') && !hasOwn(target, '__proto__')) {
85
+ Object.defineProperty(target, '__proto__', {
86
+ value: undefined,
87
+ writable: true,
88
+ enumerable: true,
89
+ configurable: true,
90
+ });
91
+ }
92
+ Object.assign(target, source);
93
+ }
94
+ return target;
95
+ }
96
+ /**
97
+ * Visits only values carried by JSON Schema keywords that contain schemas.
98
+ * Literal payloads such as enum, const, and default deliberately do not
99
+ * participate.
100
+ */
101
+ export function forEachJSONSchemaChild(schema, path, visit) {
102
+ // 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.
103
+ const record = schema;
104
+ for (const keyword of JSON_SCHEMA_SINGLE_SCHEMA_KEYWORDS) {
105
+ if (keyword in record) {
106
+ visit(record[keyword], [...path, keyword], keyword);
107
+ }
108
+ }
109
+ for (const keyword of JSON_SCHEMA_ARRAY_SCHEMA_KEYWORDS) {
110
+ const children = record[keyword];
111
+ if (Array.isArray(children)) {
112
+ for (const [index, child] of children.entries()) {
113
+ visit(child, [...path, keyword, String(index)], keyword);
114
+ }
115
+ }
116
+ else if (children !== undefined) {
117
+ visit(children, [...path, keyword], keyword);
118
+ }
4
119
  }
120
+ for (const keyword of JSON_SCHEMA_MAP_SCHEMA_KEYWORDS) {
121
+ const children = record[keyword];
122
+ if (!isObject(children)) {
123
+ continue;
124
+ }
125
+ for (const [key, child] of Object.entries(children)) {
126
+ // Draft 7 dependencies also permits property dependency arrays. They
127
+ // are not schemas and must not be traversed as literal JSON payloads.
128
+ if (keyword === 'dependencies' && !isSchemaDefinition(child)) {
129
+ continue;
130
+ }
131
+ visit(child, [...path, keyword, key], keyword);
132
+ }
133
+ }
134
+ }
135
+ /**
136
+ * Returns a cloned schema normalized for strict Structured Outputs.
137
+ *
138
+ * Object properties become required, object schemas are closed to additional
139
+ * properties, and representable local references and intersections are preserved.
140
+ *
141
+ * @throws {Error} If the schema cannot be represented without changing its validation semantics.
142
+ */
143
+ export function toStrictJsonSchema(schema) {
5
144
  const schemaCopy = structuredClone(schema);
6
- return ensureStrictJsonSchema(schemaCopy, [], schemaCopy);
145
+ // JSON serialization omits undefined object properties. Drop optional
146
+ // placeholders before any structural checks so they cannot accidentally
147
+ // look like validation-bearing schema keywords.
148
+ stripUndefinedSchemaKeywords(schemaCopy);
149
+ normalizeSingletonTypeArrays(schemaCopy);
150
+ // Root ref/allOf normalization can promote a nested branch into the root.
151
+ // Reject separate resource scopes while their original nesting is still
152
+ // visible so branch-local definitions cannot be rebound at the root.
153
+ assertNoNestedSchemaIds(schemaCopy);
154
+ normalizeRootRefAndAllOf(schemaCopy);
155
+ if (schemaCopy.type !== 'object') {
156
+ throw new Error(`Root schema must have type: 'object' but got type: ${schemaCopy.type ? `'${schemaCopy.type}'` : 'undefined'}`);
157
+ }
158
+ if (schemaCopy.anyOf !== undefined) {
159
+ throw new Error('Root schema must not use `anyOf` because strict Structured Outputs requires a root object without a union.');
160
+ }
161
+ validateRefSchemas(schemaCopy, [], schemaCopy);
162
+ preserveAllOfRefTargets(schemaCopy);
163
+ validateRefSchemas(schemaCopy, [], schemaCopy);
164
+ rewriteLocalRefsIntoFilteredAnyOfBranches(schemaCopy);
165
+ // Resolve representable object intersections before recursive
166
+ // strictification closes referenced definitions. Otherwise a definition
167
+ // reached through an allOf ref would be closed in isolation before its
168
+ // sibling object properties can be merged.
169
+ normalizeObjectAllOfBranches(schemaCopy, [], schemaCopy);
170
+ const strictSchema = ensureStrictJsonSchema(schemaCopy, [], schemaCopy);
171
+ validateRefSchemas(strictSchema, [], strictSchema);
172
+ return strictSchema;
7
173
  }
8
- function isNullable(schema) {
9
- if (typeof schema === 'boolean') {
174
+ function stripUndefinedSchemaKeywords(schema, visited = new Set()) {
175
+ if (!isObject(schema) || visited.has(schema)) {
176
+ return;
177
+ }
178
+ visited.add(schema);
179
+ // 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.
180
+ const schemaRecord = schema;
181
+ for (const keyword of Object.keys(schemaRecord)) {
182
+ if (schemaRecord[keyword] === undefined) {
183
+ delete schemaRecord[keyword];
184
+ }
185
+ }
186
+ forEachJSONSchemaChild(schema, [], (child) => {
187
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
188
+ stripUndefinedSchemaKeywords(child, visited);
189
+ });
190
+ }
191
+ /**
192
+ * Root ref inlining and singleton allOf flattening can expose each other.
193
+ * Iterate until flattening no longer produces another root ref so every
194
+ * exactly representable chain reaches its final object form before the root
195
+ * type check runs.
196
+ */
197
+ function normalizeRootRefAndAllOf(schema) {
198
+ const seenRefs = new Set();
199
+ while (true) {
200
+ if (typeof schema.$ref === 'string') {
201
+ if (seenRefs.has(schema.$ref)) {
202
+ throw new Error('Cyclic local $ref at `<root>` is not supported: ' + JSON.stringify(schema.$ref));
203
+ }
204
+ seenRefs.add(schema.$ref);
205
+ }
206
+ inlineRootRefObject(schema);
207
+ preserveAllOfRefTargets(schema, true);
208
+ normalizeRootAllOf(schema);
209
+ const normalizedAnyOf = normalizeRootAnyOf(schema);
210
+ if (schema.$ref === undefined && !normalizedAnyOf) {
211
+ return;
212
+ }
213
+ }
214
+ }
215
+ /**
216
+ * Some Standard Schema converters emit the root object through a local ref,
217
+ * with the referenced schema stored in a root definition map. Structured
218
+ * Outputs requires the root itself to be an object, so inline that safe,
219
+ * definition-only form while keeping the root maps available for every local
220
+ * pointer in the schema.
221
+ */
222
+ function inlineRootRefObject(schema) {
223
+ let ref = schema.$ref;
224
+ if (ref === undefined) {
225
+ return;
226
+ }
227
+ assertLocalRootRef(ref);
228
+ if (!hasOnlyRootRefAndDefinitions(schema)) {
229
+ throw new Error('Schema $ref at `<root>` has non-metadata siblings that Draft 7 ignores and cannot be represented in strict Structured Outputs.');
230
+ }
231
+ const seenRefs = new Set();
232
+ // Ref siblings are annotations in Draft 7, so keep them while following
233
+ // aliases. Add outer annotations first so they win over inner aliases and
234
+ // the final target when the effective root is assembled.
235
+ const inheritedAnnotations = Object.fromEntries(Object.entries(schema).filter(([keyword]) => JSON_SCHEMA_ANNOTATION_KEYWORDS.has(keyword)));
236
+ let resolved;
237
+ while (true) {
238
+ if (seenRefs.has(ref)) {
239
+ throw new Error('Cyclic local $ref at `<root>` is not supported: ' + JSON.stringify(ref));
240
+ }
241
+ seenRefs.add(ref);
242
+ const target = resolveLocalRef(schema, ref);
243
+ if (target === undefined) {
244
+ throw new Error('Local $ref at `<root>` does not resolve to an object or boolean schema: ' + JSON.stringify(ref));
245
+ }
246
+ if (typeof target === 'boolean') {
247
+ throw new TypeError('Expected object schema but got boolean; path=<root>');
248
+ }
249
+ const nextRef = target.$ref;
250
+ if (nextRef === undefined) {
251
+ resolved = target;
252
+ break;
253
+ }
254
+ assertLocalRootRef(nextRef);
255
+ if (seenRefs.has(nextRef)) {
256
+ throw new Error('Cyclic local $ref at `<root>` is not supported: ' + JSON.stringify(nextRef));
257
+ }
258
+ if (!hasOnlyRefAndAnnotations(target)) {
259
+ throw new Error('Schema $ref in root chain has non-annotation siblings that Draft 7 ignores and cannot be represented in strict Structured Outputs.');
260
+ }
261
+ for (const keyword of JSON_SCHEMA_ANNOTATION_KEYWORDS) {
262
+ if (!(keyword in inheritedAnnotations) && keyword in target) {
263
+ // 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.
264
+ inheritedAnnotations[keyword] = target[keyword];
265
+ }
266
+ }
267
+ ref = nextRef;
268
+ }
269
+ const rootDefinitions = schema.$defs;
270
+ const legacyDefinitions = schema.definitions;
271
+ const rootMetadata = Object.fromEntries(Object.entries(schema).filter(([keyword]) => JSON_SCHEMA_ANNOTATION_KEYWORDS.has(keyword) || JSON_SCHEMA_ROOT_METADATA_KEYWORDS.has(keyword)));
272
+ const inlined = structuredClone(resolved);
273
+ // A target's definition map lives below the target's original pointer, not
274
+ // at the document root. Keep the outer document map at the root so existing
275
+ // absolute refs retain their meaning; the retained outer map also keeps the
276
+ // target's nested map reachable at its original pointer.
277
+ for (const keyword of ['$defs', 'definitions']) {
278
+ if (schema[keyword] !== undefined && inlined[keyword] !== undefined) {
279
+ delete inlined[keyword];
280
+ }
281
+ }
282
+ // 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.
283
+ const schemaRecord = schema;
284
+ for (const keyword of Object.keys(schema)) {
285
+ delete schemaRecord[keyword];
286
+ }
287
+ assignSchema(schema, inlined, inheritedAnnotations, rootMetadata);
288
+ if (rootDefinitions !== undefined) {
289
+ schema.$defs = rootDefinitions;
290
+ }
291
+ if (legacyDefinitions !== undefined) {
292
+ schema.definitions = legacyDefinitions;
293
+ }
294
+ }
295
+ /**
296
+ * Root object validation runs before recursive strictification, so normalize
297
+ * the same exactly representable allOf forms here that the recursive pass
298
+ * handles for nested schemas.
299
+ */
300
+ function normalizeRootAllOf(schema) {
301
+ while (schema.allOf !== undefined) {
302
+ // Root normalization runs before recursive strictification so the root
303
+ // type check can see an inlined object. Normalize nested intersections in
304
+ // its branches first for the same associative allOf case handled by the
305
+ // later recursive pass.
306
+ if (Array.isArray(schema.allOf)) {
307
+ for (const [index, branch] of schema.allOf.entries()) {
308
+ normalizeObjectAllOfBranches(branch, ['allOf', String(index)], schema);
309
+ }
310
+ }
311
+ if (mergeObjectAllOf(schema, [], schema)) {
312
+ // Removing neutral true branches can leave a singleton allOf behind;
313
+ // keep normalizing until the root reaches its final object form.
314
+ continue;
315
+ }
316
+ const allOf = schema.allOf;
317
+ if (!Array.isArray(allOf) || allOf.length !== 1 || !hasOnlyRootAllOfMetadataSiblings(schema)) {
318
+ return;
319
+ }
320
+ const branch = allOf[0];
321
+ if (!isObject(branch)) {
322
+ return;
323
+ }
324
+ const rootMetadata = { ...schema };
325
+ delete rootMetadata.allOf;
326
+ const normalized = structuredClone(branch);
327
+ // 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.
328
+ const schemaRecord = schema;
329
+ for (const keyword of Object.keys(schema)) {
330
+ delete schemaRecord[keyword];
331
+ }
332
+ assignSchema(schema, normalized, rootMetadata);
333
+ }
334
+ }
335
+ /**
336
+ * A singleton root anyOf with no validating siblings is equivalent to its
337
+ * only branch. Flatten it before the root-union check so converters that
338
+ * retain a redundant object wrapper can still produce a strict root object.
339
+ */
340
+ function normalizeRootAnyOf(schema) {
341
+ const anyOf = schema.anyOf;
342
+ if (!Array.isArray(anyOf) || !hasOnlyRootAnyOfMetadataSiblings(schema)) {
10
343
  return false;
11
344
  }
12
- if (schema.type === 'null') {
13
- return true;
345
+ // `false` contributes no instances to a union. Keep the original array in
346
+ // place until promotion so refs into the surviving branch can be rewritten
347
+ // from their original index, while refs into removed false branches become
348
+ // dangling and remain fail closed after the wrapper disappears.
349
+ const realBranches = anyOf
350
+ .map((branch, index) => ({ branch, index }))
351
+ .filter(({ branch }) => branch !== false);
352
+ if (realBranches.length !== 1) {
353
+ return false;
14
354
  }
15
- for (const oneOfVariant of schema.oneOf ?? []) {
16
- if (isNullable(oneOfVariant)) {
17
- return true;
355
+ const { branch, index: branchIndex } = realBranches[0];
356
+ if (!isObject(branch) || !isObjectOnlySchema(branch, schema)) {
357
+ return false;
358
+ }
359
+ const definitionRenames = planPromotedRootAnyOfDefinitionRenames(schema, branch);
360
+ rewriteLocalRefsIntoPromotedRootAnyOfBranch(schema, branchIndex, definitionRenames);
361
+ const rootMetadata = { ...schema };
362
+ delete rootMetadata.anyOf;
363
+ const normalized = structuredClone(branch);
364
+ for (const keyword of ['$defs', 'definitions']) {
365
+ const rootDefinitions = schema[keyword];
366
+ const branchDefinitions = normalized[keyword];
367
+ if (!isObject(rootDefinitions) || !isObject(branchDefinitions)) {
368
+ continue;
18
369
  }
370
+ const renames = definitionRenames.get(keyword);
371
+ const mergedDefinitions = { ...rootDefinitions };
372
+ for (const [name, definition] of Object.entries(branchDefinitions)) {
373
+ Object.defineProperty(mergedDefinitions, renames?.get(name) ?? name, {
374
+ value: definition,
375
+ writable: true,
376
+ enumerable: true,
377
+ configurable: true,
378
+ });
379
+ }
380
+ normalized[keyword] = mergedDefinitions;
381
+ delete rootMetadata[keyword];
19
382
  }
20
- for (const allOfVariant of schema.anyOf ?? []) {
21
- if (isNullable(allOfVariant)) {
22
- return true;
383
+ // 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.
384
+ const schemaRecord = schema;
385
+ for (const keyword of Object.keys(schema)) {
386
+ delete schemaRecord[keyword];
387
+ }
388
+ assignSchema(schema, normalized, rootMetadata);
389
+ return true;
390
+ }
391
+ /**
392
+ * Root and promoted branch definition maps occupy the same pointer after
393
+ * promotion. Give conflicting branch definitions stable aliases before refs
394
+ * are rewritten so neither original target is rebound.
395
+ */
396
+ function planPromotedRootAnyOfDefinitionRenames(root, branch) {
397
+ const renames = new Map();
398
+ for (const keyword of ['$defs', 'definitions']) {
399
+ const rootDefinitions = root[keyword];
400
+ const branchDefinitions = branch[keyword];
401
+ if (!isObject(rootDefinitions) || !isObject(branchDefinitions)) {
402
+ continue;
403
+ }
404
+ const usedNames = new Set([...Object.keys(rootDefinitions), ...Object.keys(branchDefinitions)]);
405
+ const keywordRenames = new Map();
406
+ let aliasIndex = 0;
407
+ for (const [name, definition] of Object.entries(branchDefinitions)) {
408
+ if (!hasOwn(rootDefinitions, name) || schemasEqual(rootDefinitions[name], definition)) {
409
+ continue;
410
+ }
411
+ let alias = '__openai_strict_anyOf_definition_' + aliasIndex++;
412
+ while (usedNames.has(alias)) {
413
+ alias = '__openai_strict_anyOf_definition_' + aliasIndex++;
414
+ }
415
+ usedNames.add(alias);
416
+ keywordRenames.set(name, alias);
417
+ }
418
+ if (keywordRenames.size > 0) {
419
+ renames.set(keyword, keywordRenames);
23
420
  }
24
421
  }
25
- return false;
422
+ return renames;
423
+ }
424
+ /**
425
+ * Promoting a singleton root anyOf branch removes the original anyOf/index
426
+ * pointer prefix. Rewrite refs through that prefix while the old tree still
427
+ * exists so the promoted schema keeps naming the same targets.
428
+ */
429
+ function rewriteLocalRefsIntoPromotedRootAnyOfBranch(root, branchIndex, definitionRenames) {
430
+ const rewriteRef = (ref) => {
431
+ const parts = parseLocalRef(ref);
432
+ if (parts === undefined || parts[0] !== 'anyOf' || parts[1] !== String(branchIndex)) {
433
+ return ref;
434
+ }
435
+ const promotedParts = parts.slice(2);
436
+ const definitionKeyword = promotedParts[0];
437
+ if (promotedParts.length > 1 && (definitionKeyword === '$defs' || definitionKeyword === 'definitions')) {
438
+ const renamed = definitionRenames.get(definitionKeyword)?.get(promotedParts[1]);
439
+ if (renamed !== undefined) {
440
+ promotedParts[1] = renamed;
441
+ }
442
+ }
443
+ return promotedParts.length === 0
444
+ ? '#'
445
+ : '#/' + promotedParts.map(encodeJSONPointerTokenForURIFragment).join('/');
446
+ };
447
+ const rewriteRefs = (value) => {
448
+ if (!isObject(value)) {
449
+ return;
450
+ }
451
+ if (typeof value.$ref === 'string') {
452
+ value.$ref = rewriteRef(value.$ref);
453
+ }
454
+ forEachJSONSchemaChild(value, [], (child) => {
455
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
456
+ rewriteRefs(child);
457
+ });
458
+ };
459
+ rewriteRefs(root);
460
+ }
461
+ function assertLocalRootRef(ref) {
462
+ if (typeof ref !== 'string') {
463
+ throw new TypeError('Received non-string $ref - ' + String(ref) + '; path=<root>');
464
+ }
465
+ if (!ref.startsWith('#')) {
466
+ throw new Error('External $ref at `<root>` is not supported in strict Structured Outputs: ' + JSON.stringify(ref));
467
+ }
468
+ }
469
+ function hasOnlyRootRefAndDefinitions(schema) {
470
+ return Object.keys(schema).every((keyword) => keyword === '$ref' ||
471
+ keyword === '$defs' ||
472
+ keyword === 'definitions' ||
473
+ JSON_SCHEMA_ROOT_METADATA_KEYWORDS.has(keyword) ||
474
+ JSON_SCHEMA_ANNOTATION_KEYWORDS.has(keyword));
475
+ }
476
+ /**
477
+ * Draft 7 permits `type` to be either a string or an array of strings. A
478
+ * singleton array has exactly the same validation semantics as its scalar
479
+ * form, so canonicalize it before root validation and recursive strictifying.
480
+ * Multi-type arrays carry real union semantics and must remain unchanged.
481
+ */
482
+ function normalizeSingletonTypeArrays(schema) {
483
+ if (!isObject(schema)) {
484
+ return;
485
+ }
486
+ if (Array.isArray(schema.type) && schema.type.length === 1) {
487
+ schema.type = schema.type[0];
488
+ }
489
+ forEachJSONSchemaChild(schema, [], (child) => {
490
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
491
+ normalizeSingletonTypeArrays(child);
492
+ });
493
+ }
494
+ function isNullable(schema, root, seenRefs = new Set()) {
495
+ if (typeof schema === 'boolean') {
496
+ return schema;
497
+ }
498
+ const ref = schema.$ref;
499
+ if (ref !== undefined) {
500
+ // Annotation keywords do not constrain validation, so they are safe beside
501
+ // a local ref. Keep the proof conservative for every other sibling because
502
+ // resolving those correctly would require intersecting the referenced
503
+ // schema and its sibling constraints.
504
+ if (typeof ref !== 'string' || !hasOnlyRefAndAnnotations(schema) || seenRefs.has(ref)) {
505
+ return false;
506
+ }
507
+ const resolved = resolveLocalRef(root, ref);
508
+ if (resolved === undefined) {
509
+ return false;
510
+ }
511
+ return isNullable(resolved, root, new Set([...seenRefs, ref]));
512
+ }
513
+ if (schema.type !== undefined &&
514
+ schema.type !== 'null' &&
515
+ !(Array.isArray(schema.type) && schema.type.includes('null'))) {
516
+ return false;
517
+ }
518
+ if ('const' in schema && schema.const !== null) {
519
+ return false;
520
+ }
521
+ if (schema.enum !== undefined && (!Array.isArray(schema.enum) || !schema.enum.includes(null))) {
522
+ return false;
523
+ }
524
+ if (schema.allOf !== undefined &&
525
+ (!Array.isArray(schema.allOf) || !schema.allOf.every((variant) => isNullable(variant, root)))) {
526
+ return false;
527
+ }
528
+ if (schema.anyOf !== undefined &&
529
+ (!Array.isArray(schema.anyOf) || !schema.anyOf.some((variant) => isNullable(variant, root)))) {
530
+ return false;
531
+ }
532
+ if (schema.oneOf !== undefined &&
533
+ (!Array.isArray(schema.oneOf) || schema.oneOf.filter((variant) => isNullable(variant, root)).length !== 1)) {
534
+ return false;
535
+ }
536
+ // Conditional and negated schemas need a full JSON Schema evaluator to prove
537
+ // that null is allowed. Treat them conservatively instead of accepting an
538
+ // optional field that may not actually accept null.
539
+ if (schema.not !== undefined ||
540
+ schema.if !== undefined ||
541
+ schema.then !== undefined ||
542
+ schema.else !== undefined) {
543
+ return false;
544
+ }
545
+ return true;
26
546
  }
27
547
  /**
28
548
  * Mutates the given JSON schema to ensure it conforms to the `strict` standard
@@ -35,117 +555,1117 @@ function ensureStrictJsonSchema(jsonSchema, path, root) {
35
555
  if (!isObject(jsonSchema)) {
36
556
  throw new TypeError(`Expected ${JSON.stringify(jsonSchema)} to be an object; path=${path.join('/')}`);
37
557
  }
38
- // Handle $defs (non-standard but sometimes used)
39
- const defs = jsonSchema.$defs;
40
- if (isObject(defs)) {
41
- for (const [defName, defSchema] of Object.entries(defs)) {
42
- ensureStrictJsonSchema(defSchema, [...path, '$defs', defName], root);
43
- }
558
+ // Closing each object branch in an allOf independently changes the
559
+ // intersection: sibling branches' properties become forbidden extras. Merge
560
+ // the small object-intersection subset that can be represented exactly before
561
+ // applying strict object closure, and fail closed for the rest.
562
+ if (mergeObjectAllOf(jsonSchema, path, root)) {
563
+ return ensureStrictJsonSchema(jsonSchema, path, root);
44
564
  }
45
- // Handle definitions (draft-04 style, deprecated in draft-07 but still used)
46
- const definitions = jsonSchema.definitions;
47
- if (isObject(definitions)) {
48
- for (const [definitionName, definitionSchema] of Object.entries(definitions)) {
49
- ensureStrictJsonSchema(definitionSchema, [...path, 'definitions', definitionName], root);
565
+ // false is the identity element for a union. Remove it before proving
566
+ // whether an outer object/array wrapper is redundant so an impossible
567
+ // alternative cannot hide the shape of every real branch. Keep all-false
568
+ // and boolean-only unions intact so the existing boolean-schema rejection
569
+ // remains fail closed.
570
+ normalizeAnyOfFalseBranches(jsonSchema);
571
+ // Closing a type: object wrapper around object union branches without any
572
+ // own properties would turn it into an empty object and forbid every branch
573
+ // property. A bare object type is redundant when every branch already proves
574
+ // the value is an object, so remove only that exact constraint; fail closed
575
+ // for wrappers whose object constraints cannot be preserved mechanically.
576
+ normalizeObjectUnionWrapper(jsonSchema, path, root);
577
+ // Add additionalProperties: false to object schemas. Draft 7 permits object
578
+ // keywords without an explicit type, so those implicit object shapes need
579
+ // the same strict handling as type: 'object'. Explicitly open object schemas
580
+ // cannot be represented in Structured Outputs strict mode.
581
+ if (hasObjectConstraints(jsonSchema)) {
582
+ if (!hasOwn(jsonSchema, 'additionalProperties')) {
583
+ jsonSchema.additionalProperties = false;
584
+ }
585
+ else if (jsonSchema.additionalProperties !== false) {
586
+ throw new Error(`Object schema at \`${path.join('/') || '<root>'}\` must set \`additionalProperties: false\` to be compatible with strict Structured Outputs.`);
50
587
  }
51
- }
52
- // Add additionalProperties: false to object types
53
- const typ = jsonSchema.type;
54
- if (typ === 'object' && !('additionalProperties' in jsonSchema)) {
55
- jsonSchema.additionalProperties = false;
56
588
  }
57
589
  const required = jsonSchema.required ?? [];
590
+ if (!Array.isArray(required) || required.some((key) => typeof key !== 'string')) {
591
+ throw new TypeError(`Expected \`required\` to be an array of strings; path=${path.join('/') || '<root>'}`);
592
+ }
58
593
  // Handle object properties
59
594
  const properties = jsonSchema.properties;
595
+ if (hasObjectConstraints(jsonSchema)) {
596
+ for (const key of required) {
597
+ if (!isObject(properties) || !hasOwn(properties, key)) {
598
+ throw new Error(`Object schema at \`${path.join('/') || '<root>'}\` requires property \`${key}\` but does not declare it in \`properties\`.`);
599
+ }
600
+ }
601
+ }
60
602
  if (isObject(properties)) {
61
603
  for (const [key, value] of Object.entries(properties)) {
62
- if (!isNullable(value) && !required.includes(key)) {
63
- throw new Error(`Zod field at \`${[...path, 'properties', key].join('/')}\` uses \`.optional()\` without \`.nullable()\` which is not supported by the API. See: https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses#all-fields-must-be-required`);
604
+ if (!isNullable(value, root) && !required.includes(key)) {
605
+ throw new Error(`Schema field at \`${[...path, 'properties', key].join('/')}\` uses \`.optional()\` without \`.nullable()\` which is not supported by the API. See: https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses#all-fields-must-be-required`);
64
606
  }
65
607
  }
66
608
  jsonSchema.required = Object.keys(properties);
67
- jsonSchema.properties = Object.fromEntries(Object.entries(properties).map(([key, propSchema]) => [
68
- key,
69
- ensureStrictJsonSchema(propSchema, [...path, 'properties', key], root),
70
- ]));
71
609
  }
72
- // Handle arrays
610
+ // Structured Outputs accepts one schema for every array item and does not
611
+ // support Draft 7 tuples or additionalItems. Reject both forms rather than
612
+ // advertising a schema whose array validation the API cannot preserve.
73
613
  const items = jsonSchema.items;
74
- if (isObject(items)) {
75
- jsonSchema.items = ensureStrictJsonSchema(items, [...path, 'items'], root);
614
+ const additionalItems = jsonSchema.additionalItems;
615
+ if (Array.isArray(items)) {
616
+ throw new TypeError(`Schema at \`${path.join('/') || '<root>'}\` uses tuple-form \`items\`, which cannot be represented in strict Structured Outputs.`);
76
617
  }
77
- // Handle unions (anyOf)
78
- const anyOf = jsonSchema.anyOf;
79
- if (Array.isArray(anyOf)) {
80
- jsonSchema.anyOf = anyOf.map((variant, i) => ensureStrictJsonSchema(variant, [...path, 'anyOf', String(i)], root));
618
+ if (additionalItems !== undefined) {
619
+ throw new Error(`Schema at \`${path.join('/') || '<root>'}\` uses unsupported keyword \`additionalItems\` and cannot be represented in strict Structured Outputs.`);
81
620
  }
82
621
  // Handle intersections (allOf)
83
622
  const allOf = jsonSchema.allOf;
84
- if (Array.isArray(allOf)) {
85
- if (allOf.length === 1) {
86
- const resolved = ensureStrictJsonSchema(allOf[0], [...path, 'allOf', '0'], root);
87
- Object.assign(jsonSchema, resolved);
623
+ if (Array.isArray(allOf) && allOf.length === 1 && hasOnlyAnnotationSiblings(jsonSchema, 'allOf')) {
624
+ const branch = allOf[0];
625
+ if (branch === false) {
626
+ throw new Error(`Schema at \`${path.join('/') || '<root>'}\` uses \`allOf: [false]\`, which cannot be represented in strict Structured Outputs.`);
627
+ }
628
+ if (branch === true) {
629
+ // true is the neutral schema for an intersection, so removing this
630
+ // branch preserves validation while retaining the parent annotations.
88
631
  delete jsonSchema.allOf;
89
632
  }
90
633
  else {
91
- jsonSchema.allOf = allOf.map((entry, i) => ensureStrictJsonSchema(entry, [...path, 'allOf', String(i)], root));
634
+ const resolved = ensureStrictJsonSchema(branch, [...path, 'allOf', '0'], root);
635
+ const annotations = { ...jsonSchema };
636
+ delete annotations.allOf;
637
+ assignSchema(jsonSchema, resolved, annotations);
638
+ delete jsonSchema.allOf;
92
639
  }
93
640
  }
641
+ normalizeArrayUnionWrapper(jsonSchema, root);
642
+ // 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.
643
+ const schemaRecord = jsonSchema;
644
+ for (const keyword of JSON_SCHEMA_UNSUPPORTED_SCHEMA_KEYWORDS) {
645
+ // Optional converter output often keeps undefined placeholders on the
646
+ // JavaScript object even though JSON serialization omits them. They carry
647
+ // no validation semantics, so treat only undefined as absent; every
648
+ // defined value remains unsupported.
649
+ if (schemaRecord[keyword] !== undefined) {
650
+ throw new Error(`Schema at \`${path.join('/') || '<root>'}\` uses unsupported keyword \`${keyword}\` and cannot be represented in strict Structured Outputs.`);
651
+ }
652
+ delete schemaRecord[keyword];
653
+ }
654
+ const type = jsonSchema.type;
655
+ const currentItems = jsonSchema.items;
656
+ if ((type === 'array' || (Array.isArray(type) && type.includes('array'))) && currentItems === undefined) {
657
+ throw new Error(`Schema at \`${path.join('/') || '<root>'}\` declares an array without \`items\`, which cannot be represented in strict Structured Outputs.`);
658
+ }
659
+ forEachJSONSchemaChild(jsonSchema, path, (child, childPath, keyword) => {
660
+ // These boolean forms are already handled as parent-keyword semantics:
661
+ // additionalProperties: false closes objects, while boolean
662
+ // additionalItems does not contain a nested schema to strictify.
663
+ if (typeof child === 'boolean' && (keyword === 'additionalProperties' || keyword === 'additionalItems')) {
664
+ return;
665
+ }
666
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
667
+ ensureStrictJsonSchema(child, childPath, root);
668
+ });
94
669
  // Strip `null` defaults as there's no meaningful distinction
95
670
  if (jsonSchema.default === null) {
96
671
  delete jsonSchema.default;
97
672
  }
98
- // Handle $ref with additional properties
99
- const ref = jsonSchema.$ref;
100
- if (ref && hasMoreThanNKeys(jsonSchema, 1)) {
101
- if (typeof ref !== 'string') {
102
- throw new TypeError(`Received non-string $ref - ${ref}; path=${path.join('/')}`);
673
+ return jsonSchema;
674
+ }
675
+ function parseLocalRef(ref) {
676
+ if (!ref.startsWith('#')) {
677
+ return undefined;
678
+ }
679
+ let pointer;
680
+ try {
681
+ // A local $ref is a URI fragment containing a JSON Pointer. RFC 6901
682
+ // decodes the complete fragment before tokenizing the pointer, so an
683
+ // encoded slash is a separator rather than part of a literal key.
684
+ pointer = decodeURIComponent(ref.slice(1));
685
+ }
686
+ catch {
687
+ return undefined;
688
+ }
689
+ if (pointer === '') {
690
+ return [];
691
+ }
692
+ if (!pointer.startsWith('/')) {
693
+ return undefined;
694
+ }
695
+ const parts = [];
696
+ for (const encodedPart of pointer.slice(1).split('/')) {
697
+ // JSON Pointer only defines ~0 and ~1 escapes. Reject malformed escape
698
+ // sequences instead of looking up a different literal key.
699
+ if (/~(?:[^01]|$)/.test(encodedPart)) {
700
+ return undefined;
103
701
  }
104
- const resolved = resolveRef(root, ref);
105
- if (typeof resolved === 'boolean') {
106
- throw new Error(`Expected \`$ref: ${ref}\` to resolve to an object schema but got boolean`);
702
+ parts.push(encodedPart.replace(/~1/g, '/').replace(/~0/g, '~'));
703
+ }
704
+ return parts;
705
+ }
706
+ // 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.
707
+ function resolvePointerPart(resolved, part) {
708
+ if (Array.isArray(resolved)) {
709
+ if (!/^(?:0|[1-9]\d*)$/.test(part)) {
710
+ return undefined;
107
711
  }
108
- if (!isObject(resolved)) {
109
- throw new Error(`Expected \`$ref: ${ref}\` to resolve to an object but got ${JSON.stringify(resolved)}`);
712
+ const index = Number(part);
713
+ if (!hasOwn(resolved, index)) {
714
+ return undefined;
110
715
  }
111
- // Properties from the json schema take priority over the ones on the `$ref`
112
- Object.assign(jsonSchema, { ...resolved, ...jsonSchema });
113
- delete jsonSchema.$ref;
114
- // Since the schema expanded from `$ref` might not have `additionalProperties: false` applied,
115
- // we call `ensureStrictJsonSchema` again to fix the inlined schema and ensure it's valid.
116
- return ensureStrictJsonSchema(jsonSchema, path, root);
716
+ return resolved[index];
117
717
  }
118
- return jsonSchema;
718
+ if (!isObject(resolved) || !hasOwn(resolved, part)) {
719
+ return undefined;
720
+ }
721
+ return resolved[part];
119
722
  }
120
- function resolveRef(root, ref) {
121
- if (!ref.startsWith('#/')) {
122
- throw new Error(`Unexpected $ref format ${JSON.stringify(ref)}; Does not start with #/`);
723
+ /**
724
+ * Resolves a local JSON Pointer through schema-bearing keywords only.
725
+ *
726
+ * Returns `undefined` for external references, malformed pointers, missing
727
+ * targets, and pointers into literal values such as `default` or `enum`.
728
+ */
729
+ export function resolveLocalRef(root, ref) {
730
+ const parts = parseLocalRef(ref);
731
+ if (parts === undefined) {
732
+ return undefined;
123
733
  }
124
- const pathParts = ref.slice(2).split('/');
734
+ // Literal payloads such as `default`, `enum`, and `const` can contain
735
+ // object-shaped values, but they are not schemas and are never traversed by
736
+ // strictification. Resolve only the schema-bearing locations visited by
737
+ // forEachJSONSchemaChild so every accepted target is normalized before we
738
+ // advertise the result as strict.
125
739
  let resolved = root;
126
- for (const key of pathParts) {
740
+ for (let index = 0; index < parts.length;) {
127
741
  if (!isObject(resolved)) {
128
- throw new Error(`encountered non-object entry while resolving ${ref} - ${JSON.stringify(resolved)}`);
742
+ return undefined;
129
743
  }
130
- const value = resolved[key];
131
- if (value === undefined) {
132
- throw new Error(`Key ${key} not found while resolving ${ref}`);
744
+ const keyword = parts[index];
745
+ if (JSON_SCHEMA_SINGLE_SCHEMA_KEYWORDS.includes(keyword)) {
746
+ resolved = resolvePointerPart(resolved, keyword);
747
+ index += 1;
748
+ continue;
133
749
  }
134
- resolved = value;
750
+ if (JSON_SCHEMA_ARRAY_SCHEMA_KEYWORDS.includes(keyword)) {
751
+ resolved = resolvePointerPart(resolved, keyword);
752
+ index += 1;
753
+ if (Array.isArray(resolved)) {
754
+ if (index >= parts.length) {
755
+ return undefined;
756
+ }
757
+ resolved = resolvePointerPart(resolved, parts[index]);
758
+ index += 1;
759
+ }
760
+ continue;
761
+ }
762
+ if (JSON_SCHEMA_MAP_SCHEMA_KEYWORDS.includes(keyword)) {
763
+ const children = resolvePointerPart(resolved, keyword);
764
+ index += 1;
765
+ if (!isObject(children) || index >= parts.length) {
766
+ return undefined;
767
+ }
768
+ resolved = resolvePointerPart(children, parts[index]);
769
+ if (keyword === 'dependencies' && !isSchemaDefinition(resolved)) {
770
+ return undefined;
771
+ }
772
+ index += 1;
773
+ continue;
774
+ }
775
+ return undefined;
135
776
  }
136
- return resolved;
777
+ return isSchemaDefinition(resolved) ? resolved : undefined;
137
778
  }
138
779
  function isObject(obj) {
139
780
  return typeof obj === 'object' && obj !== null && !Array.isArray(obj);
140
781
  }
141
- function hasMoreThanNKeys(obj, n) {
142
- let i = 0;
143
- for (const _ in obj) {
144
- i++;
145
- if (i > n) {
782
+ function isSchemaDefinition(value) {
783
+ return typeof value === 'boolean' || isObject(value);
784
+ }
785
+ function isObjectOnlySchema(schema, root, seenRefs = new Set()) {
786
+ if (!isObject(schema)) {
787
+ return false;
788
+ }
789
+ if (schema.$ref !== undefined) {
790
+ if (typeof schema.$ref !== 'string' || !hasOnlyRefAndAnnotations(schema) || seenRefs.has(schema.$ref)) {
791
+ return false;
792
+ }
793
+ const resolved = resolveLocalRef(root, schema.$ref);
794
+ if (resolved === undefined) {
795
+ return false;
796
+ }
797
+ return isObjectOnlySchema(resolved, root, new Set([...seenRefs, schema.$ref]));
798
+ }
799
+ if (schema.allOf !== undefined) {
800
+ if (!Array.isArray(schema.allOf) ||
801
+ schema.allOf.length !== 1 ||
802
+ !hasOnlyAnnotationSiblings(schema, 'allOf')) {
803
+ return false;
804
+ }
805
+ const branch = schema.allOf[0];
806
+ return branch !== undefined && branch !== true && branch !== false
807
+ ? isObjectOnlySchema(branch, root, seenRefs)
808
+ : false;
809
+ }
810
+ return (schema.type === 'object' ||
811
+ (Array.isArray(schema.type) && schema.type.length === 1 && schema.type[0] === 'object'));
812
+ }
813
+ function isArrayOnlySchema(schema, root, seenRefs = new Set()) {
814
+ if (!isObject(schema)) {
815
+ return false;
816
+ }
817
+ if (schema.$ref !== undefined) {
818
+ if (typeof schema.$ref !== 'string' || !hasOnlyRefAndAnnotations(schema) || seenRefs.has(schema.$ref)) {
819
+ return false;
820
+ }
821
+ const resolved = resolveLocalRef(root, schema.$ref);
822
+ if (resolved === undefined) {
823
+ return false;
824
+ }
825
+ return isArrayOnlySchema(resolved, root, new Set([...seenRefs, schema.$ref]));
826
+ }
827
+ if (schema.allOf !== undefined) {
828
+ if (!Array.isArray(schema.allOf) ||
829
+ schema.allOf.length !== 1 ||
830
+ !hasOnlyAnnotationSiblings(schema, 'allOf')) {
831
+ return false;
832
+ }
833
+ const branch = schema.allOf[0];
834
+ return branch !== undefined && branch !== true && branch !== false
835
+ ? isArrayOnlySchema(branch, root, seenRefs)
836
+ : false;
837
+ }
838
+ return (schema.type === 'array' ||
839
+ (Array.isArray(schema.type) && schema.type.length === 1 && schema.type[0] === 'array'));
840
+ }
841
+ /** Returns whether a schema contains only a reference, reusable definitions, and annotations. */
842
+ export function hasOnlyRefAndAnnotations(schema) {
843
+ return Object.keys(schema).every(
844
+ // Definition maps do not add sibling validation constraints, and keeping
845
+ // them in place preserves local pointers into a nested alias's scope.
846
+ (keyword) => keyword === '$ref' ||
847
+ keyword === '$defs' ||
848
+ keyword === 'definitions' ||
849
+ JSON_SCHEMA_ANNOTATION_KEYWORDS.has(keyword));
850
+ }
851
+ function hasOnlyAnnotationSiblings(schema, keyword) {
852
+ // 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.
853
+ const schemaRecord = schema;
854
+ return Object.keys(schema).every(
855
+ // Definition maps do not add sibling validation constraints. Keep them
856
+ // beside a flattened singleton allOf so refs into this nested scope stay
857
+ // reachable at their original pointers.
858
+ (schemaKeyword) => schemaKeyword === keyword ||
859
+ ((schemaKeyword === '$defs' || schemaKeyword === 'definitions') &&
860
+ isObject(schemaRecord[schemaKeyword])) ||
861
+ JSON_SCHEMA_ANNOTATION_KEYWORDS.has(schemaKeyword));
862
+ }
863
+ function hasOnlyRootAllOfMetadataSiblings(schema) {
864
+ return Object.keys(schema).every((keyword) => keyword === 'allOf' ||
865
+ keyword === '$defs' ||
866
+ keyword === 'definitions' ||
867
+ JSON_SCHEMA_ROOT_METADATA_KEYWORDS.has(keyword) ||
868
+ JSON_SCHEMA_ANNOTATION_KEYWORDS.has(keyword));
869
+ }
870
+ function hasOnlyRootAnyOfMetadataSiblings(schema) {
871
+ return Object.keys(schema).every((keyword) => keyword === 'anyOf' ||
872
+ keyword === '$defs' ||
873
+ keyword === 'definitions' ||
874
+ (keyword === 'type' && schema.type === 'object') ||
875
+ JSON_SCHEMA_ROOT_METADATA_KEYWORDS.has(keyword) ||
876
+ JSON_SCHEMA_ANNOTATION_KEYWORDS.has(keyword));
877
+ }
878
+ function hasObjectKeywords(schema) {
879
+ return Object.keys(schema).some((keyword) => JSON_SCHEMA_OBJECT_KEYWORDS.has(keyword));
880
+ }
881
+ function hasObjectConstraints(schema) {
882
+ const typ = schema.type;
883
+ return (typ === 'object' ||
884
+ (Array.isArray(typ) && typ.includes('object')) ||
885
+ (typ === undefined && hasObjectKeywords(schema)));
886
+ }
887
+ function isRedundantUnionWrapperType(type, branchType) {
888
+ return (type === branchType ||
889
+ (Array.isArray(type) && type.length === 2 && type.includes(branchType) && type.includes('null')));
890
+ }
891
+ function normalizeObjectUnionWrapper(jsonSchema, path, root) {
892
+ if (jsonSchema.anyOf === undefined) {
893
+ return;
894
+ }
895
+ const hasEmptyProperties = isObject(jsonSchema.properties) && Object.keys(jsonSchema.properties).length === 0;
896
+ const hasEmptyRequired = Array.isArray(jsonSchema.required) && jsonSchema.required.length === 0;
897
+ if (hasEmptyProperties) {
898
+ delete jsonSchema.properties;
899
+ }
900
+ if (hasEmptyRequired) {
901
+ delete jsonSchema.required;
902
+ }
903
+ if (!hasObjectConstraints(jsonSchema)) {
904
+ return;
905
+ }
906
+ const hasOwnObjectConstraints = Object.keys(jsonSchema).some((keyword) => JSON_SCHEMA_OBJECT_KEYWORDS.has(keyword));
907
+ if (isRedundantUnionWrapperType(jsonSchema.type, 'object') &&
908
+ !hasOwnObjectConstraints &&
909
+ Array.isArray(jsonSchema.anyOf) &&
910
+ jsonSchema.anyOf.every((branch) => isObjectOnlySchema(branch, root))) {
911
+ // The union already excludes null and every non-object value, so both a
912
+ // scalar object wrapper and a nullable object wrapper are redundant under
913
+ // Draft 7's conjunctive keyword semantics.
914
+ delete jsonSchema.type;
915
+ return;
916
+ }
917
+ throw new Error('Object anyOf schema at `' +
918
+ (path.join('/') || '<root>') +
919
+ '` cannot be represented in strict Structured Outputs without changing Draft 7 validation.');
920
+ }
921
+ function normalizeArrayUnionWrapper(jsonSchema, root) {
922
+ if (isRedundantUnionWrapperType(jsonSchema.type, 'array') &&
923
+ jsonSchema.items === undefined &&
924
+ Array.isArray(jsonSchema.anyOf) &&
925
+ jsonSchema.anyOf.every((branch) => isArrayOnlySchema(branch, root))) {
926
+ // Every union branch already proves the value is an array and excludes
927
+ // null. Keeping either redundant wrapper would require an outer items
928
+ // schema that does not contribute any Draft 7 validation.
929
+ delete jsonSchema.type;
930
+ }
931
+ }
932
+ function normalizeAnyOfFalseBranches(jsonSchema) {
933
+ if (!Array.isArray(jsonSchema.anyOf)) {
934
+ return;
935
+ }
936
+ const realBranches = jsonSchema.anyOf.filter((branch) => branch !== false);
937
+ if (realBranches.length > 0 && realBranches.length !== jsonSchema.anyOf.length) {
938
+ jsonSchema.anyOf = realBranches;
939
+ }
940
+ }
941
+ /**
942
+ * Rejects nested schema resource identifiers that would change local reference scope.
943
+ *
944
+ * @throws {Error} If a nested subschema defines its own `$id`.
945
+ */
946
+ export function assertNoNestedSchemaIds(schema) {
947
+ const visit = (value, path) => {
948
+ if (!isObject(value)) {
949
+ return;
950
+ }
951
+ if (path.length > 0 && value.$id !== undefined) {
952
+ throw new Error('Nested $id at ' +
953
+ JSON.stringify(path.join('/')) +
954
+ ' establishes a separate JSON Schema resource scope and cannot be represented in strict Structured Outputs.');
955
+ }
956
+ forEachJSONSchemaChild(value, path, (child, childPath) => {
957
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
958
+ visit(child, childPath);
959
+ });
960
+ };
961
+ visit(schema, []);
962
+ }
963
+ function refTargetsAllOfBranch(root, ref) {
964
+ const parts = parseLocalRef(ref);
965
+ if (parts === undefined) {
966
+ return false;
967
+ }
968
+ let resolved = root;
969
+ for (const [index, part] of parts.entries()) {
970
+ if (part === 'allOf' &&
971
+ isObject(resolved) &&
972
+ Array.isArray(resolved['allOf']) &&
973
+ index < parts.length - 1) {
146
974
  return true;
147
975
  }
976
+ resolved = resolvePointerPart(resolved, part);
977
+ if (resolved === undefined) {
978
+ return false;
979
+ }
148
980
  }
149
981
  return false;
150
982
  }
983
+ function escapeJSONPointerToken(token) {
984
+ return token.replace(/~/g, '~0').replace(/\//g, '~1');
985
+ }
986
+ function encodeJSONPointerTokenForURIFragment(token) {
987
+ // `$` is a valid URI fragment sub-delimiter and keeping it readable retains
988
+ // the conventional `#/$defs/...` spelling. Everything else that could
989
+ // invalidate or retokenize the fragment (notably `%` and spaces) is encoded
990
+ // after JSON Pointer escaping.
991
+ return encodeURIComponent(escapeJSONPointerToken(token)).replace(/%24/g, '$');
992
+ }
993
+ /**
994
+ * Standard Schema normalization moves representable oneOf branches to anyOf.
995
+ * Rewrite only pointers that traverse an actual oneOf schema array while the
996
+ * original tree is still intact, preserving escaped tokens for every other
997
+ * path segment.
998
+ */
999
+ export function rewriteLocalRefsIntoMovedOneOfBranches(root) {
1000
+ const rewriteRef = (ref) => {
1001
+ const parts = parseLocalRef(ref);
1002
+ if (parts === undefined || parts.length === 0) {
1003
+ return ref;
1004
+ }
1005
+ let resolved = root;
1006
+ let changed = false;
1007
+ for (const [index, part] of parts.entries()) {
1008
+ if (part === 'oneOf' &&
1009
+ index < parts.length - 1 &&
1010
+ isObject(resolved) &&
1011
+ Array.isArray(resolved['oneOf'])) {
1012
+ parts[index] = 'anyOf';
1013
+ changed = true;
1014
+ }
1015
+ resolved = resolvePointerPart(resolved, part);
1016
+ if (resolved === undefined) {
1017
+ return ref;
1018
+ }
1019
+ }
1020
+ return changed ? '#/' + parts.map(encodeJSONPointerTokenForURIFragment).join('/') : ref;
1021
+ };
1022
+ const rewriteRefs = (value) => {
1023
+ if (!isObject(value)) {
1024
+ return;
1025
+ }
1026
+ if (typeof value.$ref === 'string') {
1027
+ value.$ref = rewriteRef(value.$ref);
1028
+ }
1029
+ forEachJSONSchemaChild(value, [], (child) => {
1030
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
1031
+ rewriteRefs(child);
1032
+ });
1033
+ };
1034
+ rewriteRefs(root);
1035
+ }
1036
+ /**
1037
+ * Strictification removes false anyOf alternatives. Rewrite pointers into
1038
+ * surviving alternatives before that filtering happens so each local ref
1039
+ * still names the same schema after earlier indices disappear.
1040
+ */
1041
+ function rewriteLocalRefsIntoFilteredAnyOfBranches(root) {
1042
+ const rewriteRef = (ref) => {
1043
+ const originalParts = parseLocalRef(ref);
1044
+ if (originalParts === undefined || originalParts.length === 0) {
1045
+ return ref;
1046
+ }
1047
+ const rewrittenParts = [...originalParts];
1048
+ let resolved = root;
1049
+ let changed = false;
1050
+ for (const [index, part] of originalParts.entries()) {
1051
+ // 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.
1052
+ const resolvedRecord = isObject(resolved) ? resolved : undefined;
1053
+ if (part === 'anyOf' &&
1054
+ index < originalParts.length - 1 &&
1055
+ resolvedRecord !== undefined &&
1056
+ Array.isArray(resolvedRecord['anyOf'])) {
1057
+ const branches = resolvedRecord['anyOf'];
1058
+ const branchIndexPart = originalParts[index + 1];
1059
+ if (!/^(?:0|[1-9]\d*)$/.test(branchIndexPart)) {
1060
+ return ref;
1061
+ }
1062
+ const branchIndex = Number(branchIndexPart);
1063
+ if (!hasOwn(branches, branchIndex)) {
1064
+ return ref;
1065
+ }
1066
+ const realBranches = branches.filter((branch) => branch !== false);
1067
+ if (realBranches.length > 0 && realBranches.length !== branches.length) {
1068
+ // A ref to a removed false schema is already rejected by the first
1069
+ // ref-validation pass. Leave it untouched so it remains fail closed.
1070
+ if (branches[branchIndex] === false) {
1071
+ return ref;
1072
+ }
1073
+ const rewrittenIndex = branches.slice(0, branchIndex).filter((branch) => branch !== false).length;
1074
+ if (rewrittenIndex !== branchIndex) {
1075
+ rewrittenParts[index + 1] = String(rewrittenIndex);
1076
+ changed = true;
1077
+ }
1078
+ }
1079
+ }
1080
+ // Resolve through the original pointer, not the rewritten one, so a
1081
+ // nested anyOf can also be remapped after its parent index shifts.
1082
+ resolved = resolvePointerPart(resolved, part);
1083
+ if (resolved === undefined) {
1084
+ return ref;
1085
+ }
1086
+ }
1087
+ return changed ? '#/' + rewrittenParts.map(encodeJSONPointerTokenForURIFragment).join('/') : ref;
1088
+ };
1089
+ const rewriteRefs = (value) => {
1090
+ if (!isObject(value)) {
1091
+ return;
1092
+ }
1093
+ if (typeof value.$ref === 'string') {
1094
+ value.$ref = rewriteRef(value.$ref);
1095
+ }
1096
+ forEachJSONSchemaChild(value, [], (child) => {
1097
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
1098
+ rewriteRefs(child);
1099
+ });
1100
+ };
1101
+ rewriteRefs(root);
1102
+ }
1103
+ /**
1104
+ * Strictification removes every representable allOf. Preserve any schema
1105
+ * referenced through an allOf branch under a stable root definition first so
1106
+ * structural flattening cannot leave a dangling local pointer behind.
1107
+ */
1108
+ function preserveAllOfRefTargets(root, rootOnly = false) {
1109
+ const refsToPreserve = new Set();
1110
+ const collectRefs = (value) => {
1111
+ if (!isObject(value)) {
1112
+ return;
1113
+ }
1114
+ if (typeof value.$ref === 'string' && refTargetsAllOfBranch(root, value.$ref)) {
1115
+ const pointerParts = parseLocalRef(value.$ref);
1116
+ if (!rootOnly || pointerParts?.[0] === 'allOf') {
1117
+ refsToPreserve.add(value.$ref);
1118
+ }
1119
+ }
1120
+ forEachJSONSchemaChild(value, [], (child) => {
1121
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
1122
+ collectRefs(child);
1123
+ });
1124
+ };
1125
+ collectRefs(root);
1126
+ if (refsToPreserve.size === 0) {
1127
+ return;
1128
+ }
1129
+ if (root.$defs !== undefined && !isObject(root.$defs)) {
1130
+ throw new Error('Root schema has invalid $defs and cannot preserve local allOf references.');
1131
+ }
1132
+ const definitions = (root.$defs ?? (root.$defs = {}));
1133
+ const rewrittenRefs = new Map();
1134
+ let aliasIndex = 0;
1135
+ for (const ref of refsToPreserve) {
1136
+ const target = resolveLocalRef(root, ref);
1137
+ // oxlint-disable-next-line anti-slop/no-known-value-widening -- Local references require runtime schema validation even when the static return type is narrower.
1138
+ if (!isSchemaDefinition(target)) {
1139
+ if (rootOnly) {
1140
+ continue;
1141
+ }
1142
+ throw new Error('Local $ref cannot be preserved before allOf flattening: ' + JSON.stringify(ref));
1143
+ }
1144
+ let alias = '__openai_strict_allOf_ref_' + aliasIndex++;
1145
+ while (hasOwn(definitions, alias)) {
1146
+ alias = '__openai_strict_allOf_ref_' + aliasIndex++;
1147
+ }
1148
+ definitions[alias] = structuredClone(target);
1149
+ rewrittenRefs.set(ref, '#/$defs/' + escapeJSONPointerToken(alias));
1150
+ }
1151
+ const rewriteRefs = (value) => {
1152
+ if (!isObject(value)) {
1153
+ return;
1154
+ }
1155
+ if (typeof value.$ref === 'string') {
1156
+ value.$ref = rewrittenRefs.get(value.$ref) ?? value.$ref;
1157
+ }
1158
+ forEachJSONSchemaChild(value, [], (child) => {
1159
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
1160
+ rewriteRefs(child);
1161
+ });
1162
+ };
1163
+ rewriteRefs(root);
1164
+ }
1165
+ /**
1166
+ * Closed allOf merges can discard optional property declarations. Preserve
1167
+ * only local refs into declarations that are about to disappear, then rewrite
1168
+ * those refs to stable root definitions before the merge removes their paths.
1169
+ */
1170
+ function preserveDiscardedAllOfPropertyRefTargets(root, discardedPaths) {
1171
+ if (discardedPaths.length === 0) {
1172
+ return;
1173
+ }
1174
+ const refsToPreserve = new Set();
1175
+ const collectRefs = (value) => {
1176
+ if (!isObject(value)) {
1177
+ return;
1178
+ }
1179
+ if (typeof value.$ref === 'string') {
1180
+ const parts = parseLocalRef(value.$ref);
1181
+ if (parts !== undefined &&
1182
+ discardedPaths.some((discardedPath) => parts.length >= discardedPath.length &&
1183
+ discardedPath.every((part, index) => parts[index] === part))) {
1184
+ refsToPreserve.add(value.$ref);
1185
+ }
1186
+ }
1187
+ forEachJSONSchemaChild(value, [], (child) => {
1188
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
1189
+ collectRefs(child);
1190
+ });
1191
+ };
1192
+ collectRefs(root);
1193
+ if (refsToPreserve.size === 0) {
1194
+ return;
1195
+ }
1196
+ if (root.$defs !== undefined && !isObject(root.$defs)) {
1197
+ throw new Error('Root schema has invalid $defs and cannot preserve discarded allOf properties.');
1198
+ }
1199
+ const definitions = (root.$defs ?? (root.$defs = {}));
1200
+ const rewrittenRefs = new Map();
1201
+ let aliasIndex = 0;
1202
+ for (const ref of refsToPreserve) {
1203
+ const target = resolveLocalRef(root, ref);
1204
+ // oxlint-disable-next-line anti-slop/no-known-value-widening -- Validate referenced schema values at runtime before preserving them under generated definitions.
1205
+ if (!isSchemaDefinition(target)) {
1206
+ throw new Error('Local $ref cannot be preserved before allOf property removal: ' + JSON.stringify(ref));
1207
+ }
1208
+ let alias = '__openai_strict_allOf_property_ref_' + aliasIndex++;
1209
+ while (hasOwn(definitions, alias)) {
1210
+ alias = '__openai_strict_allOf_property_ref_' + aliasIndex++;
1211
+ }
1212
+ definitions[alias] = structuredClone(target);
1213
+ rewrittenRefs.set(ref, '#/$defs/' + escapeJSONPointerToken(alias));
1214
+ }
1215
+ const rewriteRefs = (value) => {
1216
+ if (!isObject(value)) {
1217
+ return;
1218
+ }
1219
+ if (typeof value.$ref === 'string') {
1220
+ value.$ref = rewrittenRefs.get(value.$ref) ?? value.$ref;
1221
+ }
1222
+ forEachJSONSchemaChild(value, [], (child) => {
1223
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
1224
+ rewriteRefs(child);
1225
+ });
1226
+ };
1227
+ rewriteRefs(root);
1228
+ }
1229
+ function validateRefSchemas(schema, path, root) {
1230
+ if (!isObject(schema)) {
1231
+ return;
1232
+ }
1233
+ const ref = schema.$ref;
1234
+ if (ref !== undefined) {
1235
+ if (typeof ref !== 'string') {
1236
+ throw new TypeError(`Received non-string $ref - ${ref}; path=${path.join('/')}`);
1237
+ }
1238
+ if (!ref.startsWith('#')) {
1239
+ throw new Error(`External $ref at \`${path.join('/') || '<root>'}\` is not supported in strict Structured Outputs: ${JSON.stringify(ref)}`);
1240
+ }
1241
+ const resolved = resolveLocalRef(root, ref);
1242
+ // oxlint-disable-next-line anti-slop/no-known-value-widening -- Untrusted local references must pass the runtime schema predicate before normalization.
1243
+ if (resolved === undefined || !isSchemaDefinition(resolved)) {
1244
+ throw new Error(`Local $ref at \`${path.join('/') || '<root>'}\` does not resolve to an object or boolean schema: ${JSON.stringify(ref)}`);
1245
+ }
1246
+ if (typeof resolved === 'boolean') {
1247
+ throw new TypeError(`Expected object schema but got boolean; path=${path.join('/')}`);
1248
+ }
1249
+ if (!hasOnlyRefAndAnnotations(schema)) {
1250
+ throw new Error(`Schema $ref at \`${path.join('/') || '<root>'}\` has non-annotation siblings that Draft 7 ignores and cannot be represented in strict Structured Outputs.`);
1251
+ }
1252
+ }
1253
+ forEachJSONSchemaChild(schema, path, (child, childPath) => {
1254
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
1255
+ validateRefSchemas(child, childPath, root);
1256
+ });
1257
+ }
1258
+ /**
1259
+ * Resolve only local aliases whose siblings carry no validation semantics.
1260
+ * Keeping this separate from general ref validation lets allOf merging inspect
1261
+ * the effective object shape without broadening which refs or sibling
1262
+ * constraints are accepted.
1263
+ */
1264
+ function resolveObjectAllOfBranch(schema, root, normalizing) {
1265
+ const refChain = [schema];
1266
+ const seenRefs = new Set();
1267
+ let resolved = schema;
1268
+ let resolvedPath = [];
1269
+ while (true) {
1270
+ while (resolved.$ref !== undefined) {
1271
+ const ref = resolved.$ref;
1272
+ if (typeof ref !== 'string' || !hasOnlyRefAndAnnotations(resolved) || seenRefs.has(ref)) {
1273
+ return undefined;
1274
+ }
1275
+ seenRefs.add(ref);
1276
+ const target = resolveLocalRef(root, ref);
1277
+ if (!isObject(target)) {
1278
+ return undefined;
1279
+ }
1280
+ const targetPath = parseLocalRef(ref);
1281
+ if (targetPath === undefined) {
1282
+ return undefined;
1283
+ }
1284
+ resolved = target;
1285
+ resolvedPath = targetPath;
1286
+ refChain.push(resolved);
1287
+ }
1288
+ // A ref can point forward to a target whose own mergeable allOf has not
1289
+ // been visited yet. Normalize that target before its consumer classifies
1290
+ // the resolved shape, making property order irrelevant. An active target
1291
+ // is a ref/allOf cycle; leave it wrapped so the caller still fails closed.
1292
+ if (resolved.allOf !== undefined && !normalizing.has(resolved)) {
1293
+ const previousAllOf = resolved.allOf;
1294
+ normalizeObjectAllOfBranches(resolved, resolvedPath, root, normalizing);
1295
+ // Singleton flattening can expose another local ref. Follow it through
1296
+ // the same guarded loop before returning the effective branch.
1297
+ if (resolved.$ref !== undefined || resolved.allOf !== previousAllOf) {
1298
+ continue;
1299
+ }
1300
+ }
1301
+ return { schema: resolved, refChain };
1302
+ }
1303
+ }
1304
+ function normalizeObjectAllOfBranches(schema, path, root, normalizing = new Set()) {
1305
+ if (!isObject(schema)) {
1306
+ return;
1307
+ }
1308
+ if (normalizing.has(schema)) {
1309
+ return;
1310
+ }
1311
+ normalizing.add(schema);
1312
+ try {
1313
+ while (true) {
1314
+ forEachJSONSchemaChild(schema, path, (child, childPath) => {
1315
+ // SAFETY: The schema-child visitor supplies only recognized object or boolean schema positions; the recursive helper validates their contents.
1316
+ normalizeObjectAllOfBranches(child, childPath, root, normalizing);
1317
+ });
1318
+ // Intersections are associative, so normalize nested object
1319
+ // intersections before classifying their parents. Otherwise an inner
1320
+ // allOf wrapper has no directly visible object shape and makes an
1321
+ // exactly mergeable outer allOf fail closed.
1322
+ if (!mergeObjectAllOf(schema, path, root, normalizing)) {
1323
+ return;
1324
+ }
1325
+ }
1326
+ }
1327
+ finally {
1328
+ normalizing.delete(schema);
1329
+ }
1330
+ }
1331
+ /**
1332
+ * Standard Schema needs to prove oneOf branches exclusive before it rewrites
1333
+ * them to anyOf. Inspect a cloned branch through the same conservative object
1334
+ * allOf merger without mutating the caller's schema or broadening failures.
1335
+ */
1336
+ export function normalizeObjectAllOfForExclusivity(schema, root) {
1337
+ if (schema.allOf === undefined) {
1338
+ return undefined;
1339
+ }
1340
+ const normalized = structuredClone(schema);
1341
+ try {
1342
+ // Removing neutral branches or flattening a singleton can expose another
1343
+ // mergeable allOf wrapper. Keep applying the recursive merger and safe
1344
+ // singleton flattening until the proof sees the branch's final shape.
1345
+ while (normalized.allOf !== undefined) {
1346
+ normalizeObjectAllOfBranches(normalized, [], root);
1347
+ if (normalized.allOf === undefined) {
1348
+ break;
1349
+ }
1350
+ const allOf = normalized.allOf;
1351
+ if (!Array.isArray(allOf) || allOf.length !== 1 || !hasOnlyAnnotationSiblings(normalized, 'allOf')) {
1352
+ return undefined;
1353
+ }
1354
+ const branch = allOf[0];
1355
+ if (!isObject(branch)) {
1356
+ return undefined;
1357
+ }
1358
+ const siblings = { ...normalized };
1359
+ delete siblings.allOf;
1360
+ const flattened = structuredClone(branch);
1361
+ for (const keyword of Object.keys(normalized)) {
1362
+ // SAFETY: Only an enumerated own keyword is deleted from this mutable schema object before installing its normalized replacement.
1363
+ delete normalized[keyword];
1364
+ }
1365
+ assignSchema(normalized, flattened, siblings);
1366
+ }
1367
+ return normalized;
1368
+ }
1369
+ catch {
1370
+ return undefined;
1371
+ }
1372
+ }
1373
+ function mergeObjectAllOf(jsonSchema, path, root, normalizing = new Set()) {
1374
+ const allOf = jsonSchema.allOf;
1375
+ if (!Array.isArray(allOf) || allOf.length === 0) {
1376
+ return false;
1377
+ }
1378
+ // Intersections are idempotent. Collapse structurally identical branches
1379
+ // before object-shape classification so duplicate scalar and array schemas
1380
+ // can reach the existing safe singleton-flattening path.
1381
+ const uniqueBranches = allOf.filter((branch, index) => !allOf.slice(0, index).some((candidate) => schemasEqual(candidate, branch)));
1382
+ if (uniqueBranches.length !== allOf.length) {
1383
+ jsonSchema.allOf = uniqueBranches;
1384
+ return true;
1385
+ }
1386
+ // `true` is the identity element for Draft 7 intersections. Remove it
1387
+ // before deciding whether the remaining branches are object-mergeable so a
1388
+ // neutral branch cannot make an otherwise exact merge fail closed.
1389
+ const nonNeutralBranches = allOf.filter((entry) => entry !== true);
1390
+ if (nonNeutralBranches.length !== allOf.length) {
1391
+ if (nonNeutralBranches.length === 0) {
1392
+ delete jsonSchema.allOf;
1393
+ }
1394
+ else {
1395
+ jsonSchema.allOf = nonNeutralBranches;
1396
+ }
1397
+ return true;
1398
+ }
1399
+ const parentIsMergeableObject = isMergeableObjectSchema(jsonSchema);
1400
+ const resolvedEntries = allOf.map((entry) => isObject(entry) ? resolveObjectAllOfBranch(entry, root, normalizing) : undefined);
1401
+ const objectBranches = resolvedEntries
1402
+ .map((entry) => entry?.schema)
1403
+ .filter((entry) => entry !== undefined && isMergeableObjectSchema(entry));
1404
+ if (!parentIsMergeableObject && objectBranches.length === 0) {
1405
+ return false;
1406
+ }
1407
+ // A lone object branch with no object-valued parent is handled by the
1408
+ // existing safe single-allOf flattening path below.
1409
+ if (!parentIsMergeableObject && allOf.length === 1) {
1410
+ return false;
1411
+ }
1412
+ const fail = () => {
1413
+ throw new Error(`Object allOf at \`${path.join('/') || '<root>'}\` cannot be merged without changing Draft 7 validation.`);
1414
+ };
1415
+ if (!parentIsMergeableObject &&
1416
+ ['additionalProperties', 'properties', 'required', 'type'].some((keyword) => keyword in jsonSchema)) {
1417
+ fail();
1418
+ }
1419
+ for (const keyword of Object.keys(jsonSchema)) {
1420
+ if (keyword !== 'allOf' &&
1421
+ keyword !== '$defs' &&
1422
+ keyword !== 'definitions' &&
1423
+ !(path.length === 0 && JSON_SCHEMA_ROOT_METADATA_KEYWORDS.has(keyword)) &&
1424
+ !MERGEABLE_OBJECT_ALL_OF_KEYWORDS.has(keyword)) {
1425
+ fail();
1426
+ }
1427
+ }
1428
+ const branches = [];
1429
+ if (parentIsMergeableObject) {
1430
+ branches.push({ schema: jsonSchema, sourcePath: path });
1431
+ }
1432
+ for (const [index, entry] of allOf.entries()) {
1433
+ if (!isObject(entry)) {
1434
+ fail();
1435
+ }
1436
+ const resolvedEntry = resolvedEntries[index];
1437
+ if (resolvedEntry === undefined) {
1438
+ return fail();
1439
+ }
1440
+ const branch = resolvedEntry.schema;
1441
+ // Definition maps do not constrain instances. Any refs into an allOf
1442
+ // branch were preserved under stable root definitions before this merge,
1443
+ // so a valid definitions-only branch can now be discarded like an
1444
+ // annotation-only branch.
1445
+ if (isMergeableObjectSchema(branch)) {
1446
+ branches.push({
1447
+ schema: branch,
1448
+ sourcePath: branch === entry ? [...path, 'allOf', String(index)] : undefined,
1449
+ });
1450
+ }
1451
+ else if (!hasOnlyNeutralAllOfBranchKeywords(branch)) {
1452
+ fail();
1453
+ }
1454
+ }
1455
+ const merged = {};
1456
+ // 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.
1457
+ for (const keyword of ['$defs', 'definitions']) {
1458
+ if (jsonSchema[keyword] !== undefined) {
1459
+ merged[keyword] = jsonSchema[keyword];
1460
+ }
1461
+ }
1462
+ if (path.length === 0) {
1463
+ for (const keyword of JSON_SCHEMA_ROOT_METADATA_KEYWORDS) {
1464
+ if (keyword in jsonSchema) {
1465
+ // SAFETY: Root annotation keywords are copied unchanged between schema objects; the record views preserve their unknown values.
1466
+ // 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.
1467
+ merged[keyword] = jsonSchema[keyword];
1468
+ }
1469
+ }
1470
+ }
1471
+ // SAFETY: This fresh null-prototype dictionary receives only JSON schema definitions while merging the validated property maps.
1472
+ const mergedProperties = Object.create(null);
1473
+ const mergedRequired = new Set();
1474
+ const closedPropertySets = [];
1475
+ const propertyEntries = [];
1476
+ let sawProperties = false;
1477
+ let sawRequired = false;
1478
+ let hasExplicitObjectType = false;
1479
+ let hasExplicitNullableObjectType = false;
1480
+ const mergeAnnotations = (schema) => {
1481
+ for (const keyword of JSON_SCHEMA_ANNOTATION_KEYWORDS) {
1482
+ if (!(keyword in schema)) {
1483
+ continue;
1484
+ }
1485
+ // Annotation keywords do not affect Draft 7 validation. Preserve the
1486
+ // first value (the outer schema, then earlier branches) instead of
1487
+ // rejecting an otherwise exactly mergeable intersection.
1488
+ if (!(keyword in merged)) {
1489
+ // SAFETY: These annotation keywords are copied unchanged from the validated branch; arbitrary values are preserved without narrowing.
1490
+ merged[keyword] = schema[keyword];
1491
+ }
1492
+ }
1493
+ };
1494
+ mergeAnnotations(jsonSchema);
1495
+ for (const resolvedEntry of resolvedEntries) {
1496
+ if (resolvedEntry === undefined) {
1497
+ continue;
1498
+ }
1499
+ for (const entry of resolvedEntry.refChain) {
1500
+ mergeAnnotations(entry);
1501
+ }
1502
+ }
1503
+ for (const { schema: branch, sourcePath } of branches) {
1504
+ for (const keyword of Object.keys(branch)) {
1505
+ if (keyword === 'allOf' && branch === jsonSchema) {
1506
+ continue;
1507
+ }
1508
+ // 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.
1509
+ if ((keyword === '$defs' || keyword === 'definitions') &&
1510
+ isObject(branch[keyword])) {
1511
+ continue;
1512
+ }
1513
+ if (branch === jsonSchema && path.length === 0 && JSON_SCHEMA_ROOT_METADATA_KEYWORDS.has(keyword)) {
1514
+ continue;
1515
+ }
1516
+ if (!MERGEABLE_OBJECT_ALL_OF_KEYWORDS.has(keyword)) {
1517
+ fail();
1518
+ }
1519
+ }
1520
+ if (branch.type !== undefined) {
1521
+ if (!isMergeableObjectType(branch.type)) {
1522
+ fail();
1523
+ }
1524
+ if (branch.type === 'object') {
1525
+ hasExplicitObjectType = true;
1526
+ }
1527
+ else {
1528
+ hasExplicitNullableObjectType = true;
1529
+ }
1530
+ }
1531
+ if (branch.properties !== undefined) {
1532
+ if (!isObject(branch.properties)) {
1533
+ fail();
1534
+ }
1535
+ sawProperties = true;
1536
+ for (const [key, propertySchema] of Object.entries(branch.properties)) {
1537
+ propertyEntries.push({
1538
+ key,
1539
+ propertySchema,
1540
+ sourcePath: sourcePath === undefined ? undefined : [...sourcePath, 'properties', key],
1541
+ });
1542
+ }
1543
+ }
1544
+ if (branch.required !== undefined) {
1545
+ if (!Array.isArray(branch.required) || branch.required.some((key) => typeof key !== 'string')) {
1546
+ fail();
1547
+ }
1548
+ sawRequired = true;
1549
+ for (const key of branch.required) {
1550
+ mergedRequired.add(key);
1551
+ }
1552
+ }
1553
+ if ('additionalProperties' in branch) {
1554
+ if (branch.additionalProperties !== false) {
1555
+ fail();
1556
+ }
1557
+ closedPropertySets.push(new Set(Object.keys(branch.properties ?? {})));
1558
+ }
1559
+ }
1560
+ // A closed branch forbids every property it does not declare. Intersect all
1561
+ // closed property sets before merging schemas so optional declarations
1562
+ // excluded by another closed branch are discarded, while required excluded
1563
+ // properties remain unrepresentable and fail closed.
1564
+ let allowedClosedProperties;
1565
+ if (closedPropertySets.length > 0) {
1566
+ allowedClosedProperties = new Set(closedPropertySets[0]);
1567
+ for (const keys of closedPropertySets.slice(1)) {
1568
+ for (const key of allowedClosedProperties) {
1569
+ if (!keys.has(key)) {
1570
+ allowedClosedProperties.delete(key);
1571
+ }
1572
+ }
1573
+ }
1574
+ }
1575
+ const closedProperties = allowedClosedProperties;
1576
+ const excludesRequiredProperty = closedProperties !== undefined && [...mergedRequired].some((key) => !closedProperties.has(key));
1577
+ const collapsesToNull = excludesRequiredProperty && !hasExplicitObjectType && hasExplicitNullableObjectType;
1578
+ const discardedPropertyPaths = propertyEntries
1579
+ .filter(({ key, sourcePath }) => sourcePath !== undefined &&
1580
+ (collapsesToNull || (allowedClosedProperties !== undefined && !allowedClosedProperties.has(key))))
1581
+ .map(({ sourcePath }) => sourcePath);
1582
+ preserveDiscardedAllOfPropertyRefTargets(root, discardedPropertyPaths);
1583
+ if (jsonSchema === root && root.$defs !== undefined) {
1584
+ merged.$defs = root.$defs;
1585
+ }
1586
+ if (excludesRequiredProperty) {
1587
+ // Object keywords do not constrain null. If every explicit object type
1588
+ // also admits null, the object portion is contradictory but null remains
1589
+ // an exact representation of the intersection.
1590
+ if (collapsesToNull) {
1591
+ merged.type = 'null';
1592
+ for (const keyword of Object.keys(jsonSchema)) {
1593
+ // SAFETY: Only an enumerated own keyword is deleted from this mutable schema object before installing its normalized replacement.
1594
+ delete jsonSchema[keyword];
1595
+ }
1596
+ assignSchema(jsonSchema, merged);
1597
+ return true;
1598
+ }
1599
+ fail();
1600
+ }
1601
+ for (const { key, propertySchema } of propertyEntries) {
1602
+ if (allowedClosedProperties !== undefined && !allowedClosedProperties.has(key)) {
1603
+ continue;
1604
+ }
1605
+ if (hasOwn(mergedProperties, key) && !schemasEqual(mergedProperties[key], propertySchema)) {
1606
+ fail();
1607
+ }
1608
+ mergedProperties[key] = propertySchema;
1609
+ }
1610
+ if (hasExplicitObjectType || hasExplicitNullableObjectType) {
1611
+ merged.type = hasExplicitObjectType ? 'object' : ['object', 'null'];
1612
+ }
1613
+ if (sawProperties) {
1614
+ merged.properties = Object.fromEntries(Object.entries(mergedProperties));
1615
+ }
1616
+ if (sawRequired) {
1617
+ merged.required = [...mergedRequired];
1618
+ }
1619
+ if (closedPropertySets.length > 0) {
1620
+ merged.additionalProperties = false;
1621
+ }
1622
+ for (const keyword of Object.keys(jsonSchema)) {
1623
+ // SAFETY: Only an enumerated own keyword is deleted from this mutable schema object before installing its normalized replacement.
1624
+ delete jsonSchema[keyword];
1625
+ }
1626
+ assignSchema(jsonSchema, merged);
1627
+ return true;
1628
+ }
1629
+ function isMergeableObjectSchema(schema) {
1630
+ if (schema.type !== undefined) {
1631
+ return isMergeableObjectType(schema.type);
1632
+ }
1633
+ return Object.keys(schema).some((keyword) => JSON_SCHEMA_OBJECT_KEYWORDS.has(keyword));
1634
+ }
1635
+ function hasOnlyNeutralAllOfBranchKeywords(schema) {
1636
+ // 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.
1637
+ const schemaRecord = schema;
1638
+ return Object.keys(schema).every((keyword) => JSON_SCHEMA_ANNOTATION_KEYWORDS.has(keyword) ||
1639
+ ((keyword === '$defs' || keyword === 'definitions') && isObject(schemaRecord[keyword])));
1640
+ }
1641
+ function isMergeableObjectType(type) {
1642
+ return (type === 'object' ||
1643
+ (Array.isArray(type) && type.length === 2 && type.includes('object') && type.includes('null')));
1644
+ }
1645
+ function schemasEqual(left, right) {
1646
+ if (left === right) {
1647
+ return true;
1648
+ }
1649
+ if (Array.isArray(left) || Array.isArray(right)) {
1650
+ if (!Array.isArray(left) || !Array.isArray(right) || left.length !== right.length) {
1651
+ return false;
1652
+ }
1653
+ return left.every((value, index) => schemasEqual(value, right[index]));
1654
+ }
1655
+ if (typeof left !== 'object' || left === null || typeof right !== 'object' || right === null) {
1656
+ return false;
1657
+ }
1658
+ // 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.
1659
+ const leftRecord = left;
1660
+ // 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.
1661
+ const rightRecord = right;
1662
+ const leftKeys = Object.keys(leftRecord);
1663
+ const rightKeys = Object.keys(rightRecord);
1664
+ leftKeys.sort();
1665
+ rightKeys.sort();
1666
+ if (leftKeys.length !== rightKeys.length) {
1667
+ return false;
1668
+ }
1669
+ return leftKeys.every((key, index) => key === rightKeys[index] && schemasEqual(leftRecord[key], rightRecord[key]));
1670
+ }
151
1671
  //# sourceMappingURL=transform.mjs.map