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