openai 6.32.0 → 6.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +96 -0
  3. package/auth/index.d.mts +4 -0
  4. package/auth/index.d.mts.map +1 -0
  5. package/auth/index.d.ts +4 -0
  6. package/auth/index.d.ts.map +1 -0
  7. package/auth/index.js +11 -0
  8. package/auth/index.js.map +1 -0
  9. package/auth/index.mjs +3 -0
  10. package/auth/index.mjs.map +1 -0
  11. package/auth/subject-token-providers.d.mts +20 -0
  12. package/auth/subject-token-providers.d.mts.map +1 -0
  13. package/auth/subject-token-providers.d.ts +20 -0
  14. package/auth/subject-token-providers.d.ts.map +1 -0
  15. package/auth/subject-token-providers.js +127 -0
  16. package/auth/subject-token-providers.js.map +1 -0
  17. package/auth/subject-token-providers.mjs +121 -0
  18. package/auth/subject-token-providers.mjs.map +1 -0
  19. package/auth/types.d.mts +23 -0
  20. package/auth/types.d.mts.map +1 -0
  21. package/auth/types.d.ts +23 -0
  22. package/auth/types.d.ts.map +1 -0
  23. package/auth/types.js +3 -0
  24. package/auth/types.js.map +1 -0
  25. package/auth/types.mjs +2 -0
  26. package/auth/types.mjs.map +1 -0
  27. package/auth/workload-identity-auth.d.mts +16 -0
  28. package/auth/workload-identity-auth.d.mts.map +1 -0
  29. package/auth/workload-identity-auth.d.ts +16 -0
  30. package/auth/workload-identity-auth.d.ts.map +1 -0
  31. package/auth/workload-identity-auth.js +92 -0
  32. package/auth/workload-identity-auth.js.map +1 -0
  33. package/auth/workload-identity-auth.mjs +87 -0
  34. package/auth/workload-identity-auth.mjs.map +1 -0
  35. package/azure.d.mts +2 -1
  36. package/azure.d.mts.map +1 -1
  37. package/azure.d.ts +2 -1
  38. package/azure.d.ts.map +1 -1
  39. package/azure.js.map +1 -1
  40. package/azure.mjs.map +1 -1
  41. package/client.d.mts +11 -1
  42. package/client.d.mts.map +1 -1
  43. package/client.d.ts +11 -1
  44. package/client.d.ts.map +1 -1
  45. package/client.js +73 -10
  46. package/client.js.map +1 -1
  47. package/client.mjs +73 -10
  48. package/client.mjs.map +1 -1
  49. package/core/error.d.mts +15 -0
  50. package/core/error.d.mts.map +1 -1
  51. package/core/error.d.ts +15 -0
  52. package/core/error.d.ts.map +1 -1
  53. package/core/error.js +34 -1
  54. package/core/error.js.map +1 -1
  55. package/core/error.mjs +31 -0
  56. package/core/error.mjs.map +1 -1
  57. package/index.d.mts +1 -1
  58. package/index.d.mts.map +1 -1
  59. package/index.d.ts +1 -1
  60. package/index.d.ts.map +1 -1
  61. package/index.js +3 -1
  62. package/index.js.map +1 -1
  63. package/index.mjs +1 -1
  64. package/index.mjs.map +1 -1
  65. package/package.json +11 -1
  66. package/resources/conversations/conversations.d.mts +7 -0
  67. package/resources/conversations/conversations.d.mts.map +1 -1
  68. package/resources/conversations/conversations.d.ts +7 -0
  69. package/resources/conversations/conversations.d.ts.map +1 -1
  70. package/resources/conversations/conversations.js.map +1 -1
  71. package/resources/conversations/conversations.mjs.map +1 -1
  72. package/resources/conversations/items.d.mts +1 -1
  73. package/resources/conversations/items.d.mts.map +1 -1
  74. package/resources/conversations/items.d.ts +1 -1
  75. package/resources/conversations/items.d.ts.map +1 -1
  76. package/resources/realtime/calls.d.mts +3 -2
  77. package/resources/realtime/calls.d.mts.map +1 -1
  78. package/resources/realtime/calls.d.ts +3 -2
  79. package/resources/realtime/calls.d.ts.map +1 -1
  80. package/resources/realtime/client-secrets.d.mts +3 -2
  81. package/resources/realtime/client-secrets.d.mts.map +1 -1
  82. package/resources/realtime/client-secrets.d.ts +3 -2
  83. package/resources/realtime/client-secrets.d.ts.map +1 -1
  84. package/resources/realtime/realtime.d.mts +6 -4
  85. package/resources/realtime/realtime.d.mts.map +1 -1
  86. package/resources/realtime/realtime.d.ts +6 -4
  87. package/resources/realtime/realtime.d.ts.map +1 -1
  88. package/resources/realtime/realtime.js.map +1 -1
  89. package/resources/realtime/realtime.mjs.map +1 -1
  90. package/resources/responses/internal-base.d.mts +9 -0
  91. package/resources/responses/internal-base.d.mts.map +1 -1
  92. package/resources/responses/internal-base.d.ts +9 -0
  93. package/resources/responses/internal-base.d.ts.map +1 -1
  94. package/resources/responses/internal-base.js.map +1 -1
  95. package/resources/responses/internal-base.mjs.map +1 -1
  96. package/resources/responses/responses.d.mts +153 -14
  97. package/resources/responses/responses.d.mts.map +1 -1
  98. package/resources/responses/responses.d.ts +153 -14
  99. package/resources/responses/responses.d.ts.map +1 -1
  100. package/resources/responses/responses.js.map +1 -1
  101. package/resources/responses/responses.mjs.map +1 -1
  102. package/resources/responses/ws.d.mts +26 -1
  103. package/resources/responses/ws.d.mts.map +1 -1
  104. package/resources/responses/ws.d.ts +26 -1
  105. package/resources/responses/ws.d.ts.map +1 -1
  106. package/resources/responses/ws.js +118 -0
  107. package/resources/responses/ws.js.map +1 -1
  108. package/resources/responses/ws.mjs +118 -0
  109. package/resources/responses/ws.mjs.map +1 -1
  110. package/resources/shared.d.mts +1 -0
  111. package/resources/shared.d.mts.map +1 -1
  112. package/resources/shared.d.ts +1 -0
  113. package/resources/shared.d.ts.map +1 -1
  114. package/resources/vector-stores/file-batches.d.mts +9 -5
  115. package/resources/vector-stores/file-batches.d.mts.map +1 -1
  116. package/resources/vector-stores/file-batches.d.ts +9 -5
  117. package/resources/vector-stores/file-batches.d.ts.map +1 -1
  118. package/resources/vector-stores/files.d.mts +3 -1
  119. package/resources/vector-stores/files.d.mts.map +1 -1
  120. package/resources/vector-stores/files.d.ts +3 -1
  121. package/resources/vector-stores/files.d.ts.map +1 -1
  122. package/src/auth/index.ts +9 -0
  123. package/src/auth/subject-token-providers.ts +185 -0
  124. package/src/auth/types.ts +28 -0
  125. package/src/auth/workload-identity-auth.ts +118 -0
  126. package/src/azure.ts +2 -1
  127. package/src/client.ts +112 -9
  128. package/src/core/error.ts +40 -0
  129. package/src/index.ts +2 -0
  130. package/src/resources/conversations/conversations.ts +8 -0
  131. package/src/resources/conversations/items.ts +1 -0
  132. package/src/resources/realtime/calls.ts +3 -2
  133. package/src/resources/realtime/client-secrets.ts +3 -2
  134. package/src/resources/realtime/realtime.ts +6 -4
  135. package/src/resources/responses/api.md +2 -0
  136. package/src/resources/responses/internal-base.ts +5 -1
  137. package/src/resources/responses/responses.ts +198 -14
  138. package/src/resources/responses/ws.ts +130 -1
  139. package/src/resources/shared.ts +2 -0
  140. package/src/resources/vector-stores/file-batches.ts +9 -5
  141. package/src/resources/vector-stores/files.ts +3 -1
  142. package/src/version.ts +1 -1
  143. package/version.d.mts +1 -1
  144. package/version.d.ts +1 -1
  145. package/version.js +1 -1
  146. package/version.mjs +1 -1
@@ -39,8 +39,10 @@ export type ParsedResponseOutputItem<ParsedT> =
39
39
  | ParsedResponseOutputMessage<ParsedT>
40
40
  | ParsedResponseFunctionToolCall
41
41
  | ResponseFileSearchToolCall
42
+ | ResponseFunctionToolCallOutputItem
42
43
  | ResponseFunctionWebSearch
43
44
  | ResponseComputerToolCall
45
+ | ResponseComputerToolCallOutputItem
44
46
  | ResponseToolSearchCall
45
47
  | ResponseToolSearchOutputItem
46
48
  | ResponseReasoningItem
@@ -48,6 +50,7 @@ export type ParsedResponseOutputItem<ParsedT> =
48
50
  | ResponseOutputItem.ImageGenerationCall
49
51
  | ResponseCodeInterpreterToolCall
50
52
  | ResponseOutputItem.LocalShellCall
53
+ | ResponseOutputItem.LocalShellCallOutput
51
54
  | ResponseFunctionShellToolCall
52
55
  | ResponseFunctionShellToolCallOutput
53
56
  | ResponseApplyPatchToolCall
@@ -55,7 +58,9 @@ export type ParsedResponseOutputItem<ParsedT> =
55
58
  | ResponseOutputItem.McpCall
56
59
  | ResponseOutputItem.McpListTools
57
60
  | ResponseOutputItem.McpApprovalRequest
58
- | ResponseCustomToolCall;
61
+ | ResponseOutputItem.McpApprovalResponse
62
+ | ResponseCustomToolCall
63
+ | ResponseCustomToolCallOutputItem;
59
64
 
60
65
  export interface ParsedResponse<ParsedT> extends Response {
61
66
  output: Array<ParsedResponseOutputItem<ParsedT>>;
@@ -310,12 +315,22 @@ export namespace ComputerAction {
310
315
  * The y-coordinate where the click occurred.
311
316
  */
312
317
  y: number;
318
+
319
+ /**
320
+ * The keys being held while clicking.
321
+ */
322
+ keys?: Array<string> | null;
313
323
  }
314
324
 
315
325
  /**
316
326
  * A double click action.
317
327
  */
318
328
  export interface DoubleClick {
329
+ /**
330
+ * The keys being held while double-clicking.
331
+ */
332
+ keys: Array<string> | null;
333
+
319
334
  /**
320
335
  * Specifies the event type. For a double click action, this property is always set
321
336
  * to `double_click`.
@@ -355,6 +370,11 @@ export namespace ComputerAction {
355
370
  * `drag`.
356
371
  */
357
372
  type: 'drag';
373
+
374
+ /**
375
+ * The keys being held while dragging the mouse.
376
+ */
377
+ keys?: Array<string> | null;
358
378
  }
359
379
 
360
380
  export namespace Drag {
@@ -410,6 +430,11 @@ export namespace ComputerAction {
410
430
  * The y-coordinate to move to.
411
431
  */
412
432
  y: number;
433
+
434
+ /**
435
+ * The keys being held while moving the mouse.
436
+ */
437
+ keys?: Array<string> | null;
413
438
  }
414
439
 
415
440
  /**
@@ -452,6 +477,11 @@ export namespace ComputerAction {
452
477
  * The y-coordinate where the scroll occurred.
453
478
  */
454
479
  y: number;
480
+
481
+ /**
482
+ * The keys being held while scrolling.
483
+ */
484
+ keys?: Array<string> | null;
455
485
  }
456
486
 
457
487
  /**
@@ -1771,12 +1801,22 @@ export namespace ResponseComputerToolCall {
1771
1801
  * The y-coordinate where the click occurred.
1772
1802
  */
1773
1803
  y: number;
1804
+
1805
+ /**
1806
+ * The keys being held while clicking.
1807
+ */
1808
+ keys?: Array<string> | null;
1774
1809
  }
1775
1810
 
1776
1811
  /**
1777
1812
  * A double click action.
1778
1813
  */
1779
1814
  export interface DoubleClick {
1815
+ /**
1816
+ * The keys being held while double-clicking.
1817
+ */
1818
+ keys: Array<string> | null;
1819
+
1780
1820
  /**
1781
1821
  * Specifies the event type. For a double click action, this property is always set
1782
1822
  * to `double_click`.
@@ -1816,6 +1856,11 @@ export namespace ResponseComputerToolCall {
1816
1856
  * `drag`.
1817
1857
  */
1818
1858
  type: 'drag';
1859
+
1860
+ /**
1861
+ * The keys being held while dragging the mouse.
1862
+ */
1863
+ keys?: Array<string> | null;
1819
1864
  }
1820
1865
 
1821
1866
  export namespace Drag {
@@ -1871,6 +1916,11 @@ export namespace ResponseComputerToolCall {
1871
1916
  * The y-coordinate to move to.
1872
1917
  */
1873
1918
  y: number;
1919
+
1920
+ /**
1921
+ * The keys being held while moving the mouse.
1922
+ */
1923
+ keys?: Array<string> | null;
1874
1924
  }
1875
1925
 
1876
1926
  /**
@@ -1913,6 +1963,11 @@ export namespace ResponseComputerToolCall {
1913
1963
  * The y-coordinate where the scroll occurred.
1914
1964
  */
1915
1965
  y: number;
1966
+
1967
+ /**
1968
+ * The keys being held while scrolling.
1969
+ */
1970
+ keys?: Array<string> | null;
1916
1971
  }
1917
1972
 
1918
1973
  /**
@@ -1959,6 +2014,12 @@ export interface ResponseComputerToolCallOutputItem {
1959
2014
  */
1960
2015
  output: ResponseComputerToolCallOutputScreenshot;
1961
2016
 
2017
+ /**
2018
+ * The status of the message input. One of `in_progress`, `completed`, or
2019
+ * `incomplete`. Populated when input items are returned via API.
2020
+ */
2021
+ status: 'completed' | 'incomplete' | 'failed' | 'in_progress';
2022
+
1962
2023
  /**
1963
2024
  * The type of the computer tool call output. Always `computer_call_output`.
1964
2025
  */
@@ -1971,10 +2032,9 @@ export interface ResponseComputerToolCallOutputItem {
1971
2032
  acknowledged_safety_checks?: Array<ResponseComputerToolCallOutputItem.AcknowledgedSafetyCheck>;
1972
2033
 
1973
2034
  /**
1974
- * The status of the message input. One of `in_progress`, `completed`, or
1975
- * `incomplete`. Populated when input items are returned via API.
2035
+ * The identifier of the actor that created the item.
1976
2036
  */
1977
- status?: 'in_progress' | 'completed' | 'incomplete';
2037
+ created_by?: string;
1978
2038
  }
1979
2039
 
1980
2040
  export namespace ResponseComputerToolCallOutputItem {
@@ -2289,6 +2349,27 @@ export interface ResponseCustomToolCallInputDoneEvent {
2289
2349
  type: 'response.custom_tool_call_input.done';
2290
2350
  }
2291
2351
 
2352
+ /**
2353
+ * A call to a custom tool created by the model.
2354
+ */
2355
+ export interface ResponseCustomToolCallItem extends ResponseCustomToolCall {
2356
+ /**
2357
+ * The unique ID of the custom tool call item.
2358
+ */
2359
+ id: string;
2360
+
2361
+ /**
2362
+ * The status of the item. One of `in_progress`, `completed`, or `incomplete`.
2363
+ * Populated when items are returned via API.
2364
+ */
2365
+ status: 'in_progress' | 'completed' | 'incomplete';
2366
+
2367
+ /**
2368
+ * The identifier of the actor that created the item.
2369
+ */
2370
+ created_by?: string;
2371
+ }
2372
+
2292
2373
  /**
2293
2374
  * The output of a custom tool call from your code, being sent back to the model.
2294
2375
  */
@@ -2315,6 +2396,27 @@ export interface ResponseCustomToolCallOutput {
2315
2396
  id?: string;
2316
2397
  }
2317
2398
 
2399
+ /**
2400
+ * The output of a custom tool call from your code, being sent back to the model.
2401
+ */
2402
+ export interface ResponseCustomToolCallOutputItem extends ResponseCustomToolCallOutput {
2403
+ /**
2404
+ * The unique ID of the custom tool call output item.
2405
+ */
2406
+ id: string;
2407
+
2408
+ /**
2409
+ * The status of the item. One of `in_progress`, `completed`, or `incomplete`.
2410
+ * Populated when items are returned via API.
2411
+ */
2412
+ status: 'in_progress' | 'completed' | 'incomplete';
2413
+
2414
+ /**
2415
+ * The identifier of the actor that created the item.
2416
+ */
2417
+ created_by?: string;
2418
+ }
2419
+
2318
2420
  /**
2319
2421
  * An error object returned when the model fails to generate a Response.
2320
2422
  */
@@ -2932,6 +3034,17 @@ export interface ResponseFunctionToolCallItem extends ResponseFunctionToolCall {
2932
3034
  * The unique ID of the function tool call.
2933
3035
  */
2934
3036
  id: string;
3037
+
3038
+ /**
3039
+ * The status of the item. One of `in_progress`, `completed`, or `incomplete`.
3040
+ * Populated when items are returned via API.
3041
+ */
3042
+ status: 'in_progress' | 'completed' | 'incomplete';
3043
+
3044
+ /**
3045
+ * The identifier of the actor that created the item.
3046
+ */
3047
+ created_by?: string;
2935
3048
  }
2936
3049
 
2937
3050
  export interface ResponseFunctionToolCallOutputItem {
@@ -2951,16 +3064,21 @@ export interface ResponseFunctionToolCallOutputItem {
2951
3064
  */
2952
3065
  output: string | Array<ResponseInputText | ResponseInputImage | ResponseInputFile>;
2953
3066
 
3067
+ /**
3068
+ * The status of the item. One of `in_progress`, `completed`, or `incomplete`.
3069
+ * Populated when items are returned via API.
3070
+ */
3071
+ status: 'in_progress' | 'completed' | 'incomplete';
3072
+
2954
3073
  /**
2955
3074
  * The type of the function tool call output. Always `function_call_output`.
2956
3075
  */
2957
3076
  type: 'function_call_output';
2958
3077
 
2959
3078
  /**
2960
- * The status of the item. One of `in_progress`, `completed`, or `incomplete`.
2961
- * Populated when items are returned via API.
3079
+ * The identifier of the actor that created the item.
2962
3080
  */
2963
- status?: 'in_progress' | 'completed' | 'incomplete';
3081
+ created_by?: string;
2964
3082
  }
2965
3083
 
2966
3084
  /**
@@ -4149,15 +4267,15 @@ export interface ResponseInputMessageItem {
4149
4267
  role: 'user' | 'system' | 'developer';
4150
4268
 
4151
4269
  /**
4152
- * The status of item. One of `in_progress`, `completed`, or `incomplete`.
4153
- * Populated when items are returned via API.
4270
+ * The type of the message input. Always set to `message`.
4154
4271
  */
4155
- status?: 'in_progress' | 'completed' | 'incomplete';
4272
+ type: 'message';
4156
4273
 
4157
4274
  /**
4158
- * The type of the message input. Always set to `message`.
4275
+ * The status of item. One of `in_progress`, `completed`, or `incomplete`.
4276
+ * Populated when items are returned via API.
4159
4277
  */
4160
- type?: 'message';
4278
+ status?: 'in_progress' | 'completed' | 'incomplete';
4161
4279
  }
4162
4280
 
4163
4281
  /**
@@ -4204,6 +4322,8 @@ export type ResponseItem =
4204
4322
  | ResponseFunctionToolCallOutputItem
4205
4323
  | ResponseToolSearchCall
4206
4324
  | ResponseToolSearchOutputItem
4325
+ | ResponseReasoningItem
4326
+ | ResponseCompactionItem
4207
4327
  | ResponseItem.ImageGenerationCall
4208
4328
  | ResponseCodeInterpreterToolCall
4209
4329
  | ResponseItem.LocalShellCall
@@ -4215,7 +4335,9 @@ export type ResponseItem =
4215
4335
  | ResponseItem.McpListTools
4216
4336
  | ResponseItem.McpApprovalRequest
4217
4337
  | ResponseItem.McpApprovalResponse
4218
- | ResponseItem.McpCall;
4338
+ | ResponseItem.McpCall
4339
+ | ResponseCustomToolCallItem
4340
+ | ResponseCustomToolCallOutputItem;
4219
4341
 
4220
4342
  export namespace ResponseItem {
4221
4343
  /**
@@ -4756,8 +4878,10 @@ export type ResponseOutputItem =
4756
4878
  | ResponseOutputMessage
4757
4879
  | ResponseFileSearchToolCall
4758
4880
  | ResponseFunctionToolCall
4881
+ | ResponseFunctionToolCallOutputItem
4759
4882
  | ResponseFunctionWebSearch
4760
4883
  | ResponseComputerToolCall
4884
+ | ResponseComputerToolCallOutputItem
4761
4885
  | ResponseReasoningItem
4762
4886
  | ResponseToolSearchCall
4763
4887
  | ResponseToolSearchOutputItem
@@ -4765,6 +4889,7 @@ export type ResponseOutputItem =
4765
4889
  | ResponseOutputItem.ImageGenerationCall
4766
4890
  | ResponseCodeInterpreterToolCall
4767
4891
  | ResponseOutputItem.LocalShellCall
4892
+ | ResponseOutputItem.LocalShellCallOutput
4768
4893
  | ResponseFunctionShellToolCall
4769
4894
  | ResponseFunctionShellToolCallOutput
4770
4895
  | ResponseApplyPatchToolCall
@@ -4772,7 +4897,9 @@ export type ResponseOutputItem =
4772
4897
  | ResponseOutputItem.McpCall
4773
4898
  | ResponseOutputItem.McpListTools
4774
4899
  | ResponseOutputItem.McpApprovalRequest
4775
- | ResponseCustomToolCall;
4900
+ | ResponseOutputItem.McpApprovalResponse
4901
+ | ResponseCustomToolCall
4902
+ | ResponseCustomToolCallOutputItem;
4776
4903
 
4777
4904
  export namespace ResponseOutputItem {
4778
4905
  /**
@@ -4867,6 +4994,31 @@ export namespace ResponseOutputItem {
4867
4994
  }
4868
4995
  }
4869
4996
 
4997
+ /**
4998
+ * The output of a local shell tool call.
4999
+ */
5000
+ export interface LocalShellCallOutput {
5001
+ /**
5002
+ * The unique ID of the local shell tool call generated by the model.
5003
+ */
5004
+ id: string;
5005
+
5006
+ /**
5007
+ * A JSON string of the output of the local shell tool call.
5008
+ */
5009
+ output: string;
5010
+
5011
+ /**
5012
+ * The type of the local shell tool call output. Always `local_shell_call_output`.
5013
+ */
5014
+ type: 'local_shell_call_output';
5015
+
5016
+ /**
5017
+ * The status of the item. One of `in_progress`, `completed`, or `incomplete`.
5018
+ */
5019
+ status?: 'in_progress' | 'completed' | 'incomplete' | null;
5020
+ }
5021
+
4870
5022
  /**
4871
5023
  * An invocation of a tool on an MCP server.
4872
5024
  */
@@ -5006,6 +5158,36 @@ export namespace ResponseOutputItem {
5006
5158
  */
5007
5159
  type: 'mcp_approval_request';
5008
5160
  }
5161
+
5162
+ /**
5163
+ * A response to an MCP approval request.
5164
+ */
5165
+ export interface McpApprovalResponse {
5166
+ /**
5167
+ * The unique ID of the approval response
5168
+ */
5169
+ id: string;
5170
+
5171
+ /**
5172
+ * The ID of the approval request being answered.
5173
+ */
5174
+ approval_request_id: string;
5175
+
5176
+ /**
5177
+ * Whether the request was approved.
5178
+ */
5179
+ approve: boolean;
5180
+
5181
+ /**
5182
+ * The type of the item. Always `mcp_approval_response`.
5183
+ */
5184
+ type: 'mcp_approval_response';
5185
+
5186
+ /**
5187
+ * Optional reason for the decision.
5188
+ */
5189
+ reason?: string | null;
5190
+ }
5009
5191
  }
5010
5192
 
5011
5193
  /**
@@ -7839,7 +8021,9 @@ export declare namespace Responses {
7839
8021
  type ResponseCustomToolCall as ResponseCustomToolCall,
7840
8022
  type ResponseCustomToolCallInputDeltaEvent as ResponseCustomToolCallInputDeltaEvent,
7841
8023
  type ResponseCustomToolCallInputDoneEvent as ResponseCustomToolCallInputDoneEvent,
8024
+ type ResponseCustomToolCallItem as ResponseCustomToolCallItem,
7842
8025
  type ResponseCustomToolCallOutput as ResponseCustomToolCallOutput,
8026
+ type ResponseCustomToolCallOutputItem as ResponseCustomToolCallOutputItem,
7843
8027
  type ResponseError as ResponseError,
7844
8028
  type ResponseErrorEvent as ResponseErrorEvent,
7845
8029
  type ResponseFailedEvent as ResponseFailedEvent,
@@ -1,7 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import * as WS from 'ws';
4
- import { ResponsesEmitter, buildURL } from './internal-base';
4
+ import { ResponsesEmitter, ResponsesStreamMessage, WebSocketError, buildURL } from './internal-base';
5
5
  import * as ResponsesAPI from './responses';
6
6
  import { OpenAI } from '../../client';
7
7
 
@@ -65,6 +65,135 @@ export class ResponsesWS extends ResponsesEmitter {
65
65
  }
66
66
  }
67
67
 
68
+ /**
69
+ * Returns an async iterator over WebSocket lifecycle and message events,
70
+ * providing an alternative to the event-based `.on()` API.
71
+ * The iterator will exit if the socket closes but breaking out of the iterator
72
+ * does not close the socket.
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * for await (const event of connection.stream()) {
77
+ * switch (event.type) {
78
+ * case 'message':
79
+ * console.log('received:', event.message);
80
+ * break;
81
+ * case 'error':
82
+ * console.error(event.error);
83
+ * break;
84
+ * case 'close':
85
+ * console.log('connection closed');
86
+ * break;
87
+ * }
88
+ * }
89
+ * ```
90
+ */
91
+ stream(): AsyncIterableIterator<ResponsesStreamMessage> {
92
+ return this[Symbol.asyncIterator]();
93
+ }
94
+
95
+ [Symbol.asyncIterator](): AsyncIterableIterator<ResponsesStreamMessage> {
96
+ // Two-queue async iterator: `queue` buffers incoming messages,
97
+ // `resolvers` buffers waiting next() calls. A push wakes the
98
+ // oldest next(); a next() drains the oldest message.
99
+ const queue: ResponsesStreamMessage[] = [];
100
+ const resolvers: (() => void)[] = [];
101
+ let done = false;
102
+
103
+ const push = (msg: ResponsesStreamMessage) => {
104
+ queue.push(msg);
105
+ resolvers.shift()?.();
106
+ };
107
+
108
+ const onEvent = (event: ResponsesAPI.ResponsesServerEvent) => {
109
+ if (event.type === 'error') return; // handled by onEmitterError
110
+ push({ type: 'message', message: event });
111
+ };
112
+
113
+ // Catches both API-level and socket-level errors via _onError → _emit('error')
114
+ const onEmitterError = (err: WebSocketError) => {
115
+ push({ type: 'error', error: err });
116
+ };
117
+
118
+ const onOpen = () => {
119
+ push({ type: 'open' });
120
+ };
121
+
122
+ const flushResolvers = () => {
123
+ for (let resolver = resolvers.shift(); resolver; resolver = resolvers.shift()) {
124
+ resolver();
125
+ }
126
+ };
127
+
128
+ const onClose = () => {
129
+ push({ type: 'close' });
130
+ done = true;
131
+ flushResolvers();
132
+ cleanup();
133
+ };
134
+
135
+ const cleanup = () => {
136
+ this.off('event', onEvent);
137
+ this.off('error', onEmitterError);
138
+ this.socket.off('open', onOpen);
139
+ this.socket.off('close', onClose);
140
+ };
141
+
142
+ this.on('event', onEvent);
143
+ this.on('error', onEmitterError);
144
+ this.socket.on('open', onOpen);
145
+ this.socket.on('close', onClose);
146
+
147
+ switch (this.socket.readyState) {
148
+ case WS.WebSocket.CONNECTING:
149
+ push({ type: 'connecting' });
150
+ break;
151
+ case WS.WebSocket.OPEN:
152
+ push({ type: 'open' });
153
+ break;
154
+ case WS.WebSocket.CLOSING:
155
+ push({ type: 'closing' });
156
+ break;
157
+ case WS.WebSocket.CLOSED:
158
+ push({ type: 'close' });
159
+ done = true;
160
+ cleanup();
161
+ break;
162
+ }
163
+
164
+ const resolve = (res: (value: IteratorResult<ResponsesStreamMessage>) => void) => {
165
+ if (queue.length > 0) {
166
+ res({ value: queue.shift()!, done: false });
167
+ } else if (done) {
168
+ res({ value: undefined, done: true });
169
+ } else {
170
+ return false;
171
+ }
172
+ return true;
173
+ };
174
+
175
+ const next = (): Promise<IteratorResult<ResponsesStreamMessage>> =>
176
+ new Promise((res) => {
177
+ if (resolve(res)) return;
178
+ resolvers.push(() => {
179
+ resolve(res);
180
+ });
181
+ });
182
+
183
+ return {
184
+ next,
185
+ return: (): Promise<IteratorReturnResult<undefined>> => {
186
+ done = true;
187
+ cleanup();
188
+ flushResolvers();
189
+ return Promise.resolve({ value: undefined, done: true });
190
+ },
191
+ [Symbol.asyncIterator]() {
192
+ return this;
193
+ },
194
+ };
195
+ }
196
+
68
197
  private authHeaders(): Record<string, string> {
69
198
  return { Authorization: `Bearer ${this.client.apiKey}` };
70
199
  return {};
@@ -248,6 +248,8 @@ export type FunctionParameters = { [key: string]: unknown };
248
248
  */
249
249
  export type Metadata = { [key: string]: string };
250
250
 
251
+ export type OAuthErrorCode = 'invalid_grant' | 'invalid_subject_token' | (string & {});
252
+
251
253
  /**
252
254
  * **gpt-5 and o-series models only**
253
255
  *
@@ -274,8 +274,9 @@ export interface FileBatchCreateParams {
274
274
  * A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
275
275
  * the vector store should use. Useful for tools like `file_search` that can access
276
276
  * files. If `attributes` or `chunking_strategy` are provided, they will be applied
277
- * to all files in the batch. The maximum batch size is 2000 files. Mutually
278
- * exclusive with `files`.
277
+ * to all files in the batch. The maximum batch size is 2000 files. This endpoint
278
+ * is recommended for multi-file ingestion and helps reduce per-vector-store write
279
+ * request pressure. Mutually exclusive with `files`.
279
280
  */
280
281
  file_ids?: Array<string>;
281
282
 
@@ -283,8 +284,9 @@ export interface FileBatchCreateParams {
283
284
  * A list of objects that each include a `file_id` plus optional `attributes` or
284
285
  * `chunking_strategy`. Use this when you need to override metadata for specific
285
286
  * files. The global `attributes` or `chunking_strategy` will be ignored and must
286
- * be specified for each file. The maximum batch size is 2000 files. Mutually
287
- * exclusive with `file_ids`.
287
+ * be specified for each file. The maximum batch size is 2000 files. This endpoint
288
+ * is recommended for multi-file ingestion and helps reduce per-vector-store write
289
+ * request pressure. Mutually exclusive with `file_ids`.
288
290
  */
289
291
  files?: Array<FileBatchCreateParams.File>;
290
292
  }
@@ -294,7 +296,9 @@ export namespace FileBatchCreateParams {
294
296
  /**
295
297
  * A [File](https://platform.openai.com/docs/api-reference/files) ID that the
296
298
  * vector store should use. Useful for tools like `file_search` that can access
297
- * files.
299
+ * files. For multi-file ingestion, we recommend
300
+ * [`file_batches`](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch)
301
+ * to minimize per-vector-store write requests.
298
302
  */
299
303
  file_id: string;
300
304
 
@@ -299,7 +299,9 @@ export interface FileCreateParams {
299
299
  /**
300
300
  * A [File](https://platform.openai.com/docs/api-reference/files) ID that the
301
301
  * vector store should use. Useful for tools like `file_search` that can access
302
- * files.
302
+ * files. For multi-file ingestion, we recommend
303
+ * [`file_batches`](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch)
304
+ * to minimize per-vector-store write requests.
303
305
  */
304
306
  file_id: string;
305
307
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '6.32.0'; // x-release-please-version
1
+ export const VERSION = '6.34.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "6.32.0";
1
+ export declare const VERSION = "6.34.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "6.32.0";
1
+ export declare const VERSION = "6.34.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '6.32.0'; // x-release-please-version
4
+ exports.VERSION = '6.34.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '6.32.0'; // x-release-please-version
1
+ export const VERSION = '6.34.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map