@zenning/openai 3.0.19 → 3.0.20

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 3.0.20
4
+
5
+ ### Patch Changes
6
+
7
+ - eriuhgb
8
+
3
9
  ## 3.0.19
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -461,6 +461,7 @@ declare const openaiResponsesProviderOptionsSchema: _zenning_provider_utils.Lazy
461
461
  type: "compaction";
462
462
  encrypted_content: string;
463
463
  }[] | undefined;
464
+ containsApprovalResponses?: boolean | undefined;
464
465
  }>;
465
466
  type OpenAIResponsesProviderOptions = InferSchema<typeof openaiResponsesProviderOptionsSchema>;
466
467
 
package/dist/index.d.ts CHANGED
@@ -461,6 +461,7 @@ declare const openaiResponsesProviderOptionsSchema: _zenning_provider_utils.Lazy
461
461
  type: "compaction";
462
462
  encrypted_content: string;
463
463
  }[] | undefined;
464
+ containsApprovalResponses?: boolean | undefined;
464
465
  }>;
465
466
  type OpenAIResponsesProviderOptions = InferSchema<typeof openaiResponsesProviderOptionsSchema>;
466
467
 
package/dist/index.js CHANGED
@@ -2479,7 +2479,8 @@ async function convertToOpenAIResponsesInput({
2479
2479
  hasShellTool = false,
2480
2480
  hasApplyPatchTool = false,
2481
2481
  compactionInput,
2482
- previousResponseId
2482
+ previousResponseId,
2483
+ containsApprovalResponses
2483
2484
  }) {
2484
2485
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2485
2486
  const input = [];
@@ -2566,13 +2567,10 @@ async function convertToOpenAIResponsesInput({
2566
2567
  switch (part.type) {
2567
2568
  case "text": {
2568
2569
  const id = (_b = (_a = part.providerOptions) == null ? void 0 : _a[providerOptionsName]) == null ? void 0 : _b.itemId;
2569
- if (store && id != null && !previousResponseId) {
2570
+ if (store && id != null) {
2570
2571
  input.push({ type: "item_reference", id });
2571
2572
  break;
2572
2573
  }
2573
- if (store && id != null && previousResponseId) {
2574
- break;
2575
- }
2576
2574
  input.push({
2577
2575
  role: "assistant",
2578
2576
  content: [{ type: "output_text", text: part.text }],
@@ -2583,18 +2581,15 @@ async function convertToOpenAIResponsesInput({
2583
2581
  case "tool-call": {
2584
2582
  const id = (_g = (_d = (_c = part.providerOptions) == null ? void 0 : _c[providerOptionsName]) == null ? void 0 : _d.itemId) != null ? _g : (_f = (_e = part.providerMetadata) == null ? void 0 : _e[providerOptionsName]) == null ? void 0 : _f.itemId;
2585
2583
  if (part.providerExecuted) {
2586
- if (store && id != null && !previousResponseId) {
2584
+ if (store && id != null) {
2587
2585
  input.push({ type: "item_reference", id });
2588
2586
  }
2589
2587
  break;
2590
2588
  }
2591
- if (store && id != null && !previousResponseId) {
2589
+ if (store && id != null) {
2592
2590
  input.push({ type: "item_reference", id });
2593
2591
  break;
2594
2592
  }
2595
- if (store && id != null && previousResponseId) {
2596
- break;
2597
- }
2598
2593
  const resolvedToolName = toolNameMapping.toProviderToolName(
2599
2594
  part.toolName
2600
2595
  );
@@ -2650,10 +2645,9 @@ async function convertToOpenAIResponsesInput({
2650
2645
  if (part.output.type === "execution-denied" || part.output.type === "json" && typeof part.output.value === "object" && part.output.value != null && "type" in part.output.value && part.output.value.type === "execution-denied") {
2651
2646
  break;
2652
2647
  }
2653
- if (store && !previousResponseId) {
2648
+ if (store) {
2654
2649
  const itemId = (_j = (_i = (_h = part.providerMetadata) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
2655
2650
  input.push({ type: "item_reference", id: itemId });
2656
- } else if (store) {
2657
2651
  } else {
2658
2652
  warnings.push({
2659
2653
  type: "other",
@@ -2671,7 +2665,7 @@ async function convertToOpenAIResponsesInput({
2671
2665
  const reasoningId = providerOptions == null ? void 0 : providerOptions.itemId;
2672
2666
  if (reasoningId != null) {
2673
2667
  const reasoningMessage = reasoningMessages[reasoningId];
2674
- if (store && !previousResponseId) {
2668
+ if (store) {
2675
2669
  if (reasoningMessage === void 0) {
2676
2670
  input.push({ type: "item_reference", id: reasoningId });
2677
2671
  reasoningMessages[reasoningId] = {
@@ -2680,14 +2674,6 @@ async function convertToOpenAIResponsesInput({
2680
2674
  summary: []
2681
2675
  };
2682
2676
  }
2683
- } else if (store) {
2684
- if (reasoningMessage === void 0) {
2685
- reasoningMessages[reasoningId] = {
2686
- type: "reasoning",
2687
- id: reasoningId,
2688
- summary: []
2689
- };
2690
- }
2691
2677
  } else {
2692
2678
  const summaryParts = [];
2693
2679
  if (part.text.length > 0) {
@@ -3807,7 +3793,12 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils25.lazySchem
3807
3793
  type: import_v420.z.literal("compaction"),
3808
3794
  encrypted_content: import_v420.z.string()
3809
3795
  })
3810
- ).optional()
3796
+ ).optional(),
3797
+ /**
3798
+ * Whether the request contains tool approval responses.
3799
+ * Defaults to `false`.
3800
+ */
3801
+ containsApprovalResponses: import_v420.z.boolean().optional()
3811
3802
  })
3812
3803
  )
3813
3804
  );
@@ -4038,7 +4029,7 @@ var OpenAIResponsesLanguageModel = class {
4038
4029
  toolChoice,
4039
4030
  responseFormat
4040
4031
  }) {
4041
- var _a, _b, _c, _d, _e, _f, _g;
4032
+ var _a, _b, _c, _d, _e, _f, _g, _h;
4042
4033
  const warnings = [];
4043
4034
  const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
4044
4035
  if (topK != null) {
@@ -4102,10 +4093,11 @@ var OpenAIResponsesLanguageModel = class {
4102
4093
  hasShellTool: hasOpenAITool("openai.shell"),
4103
4094
  hasApplyPatchTool: hasOpenAITool("openai.apply_patch"),
4104
4095
  compactionInput: openaiOptions == null ? void 0 : openaiOptions.compactionInput,
4105
- previousResponseId: (_d = openaiOptions == null ? void 0 : openaiOptions.previousResponseId) != null ? _d : void 0
4096
+ previousResponseId: (_d = openaiOptions == null ? void 0 : openaiOptions.previousResponseId) != null ? _d : void 0,
4097
+ containsApprovalResponses: (_e = openaiOptions == null ? void 0 : openaiOptions.containsApprovalResponses) != null ? _e : false
4106
4098
  });
4107
4099
  warnings.push(...inputWarnings);
4108
- const strictJsonSchema = (_e = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _e : true;
4100
+ const strictJsonSchema = (_f = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _f : true;
4109
4101
  let include = openaiOptions == null ? void 0 : openaiOptions.include;
4110
4102
  function addInclude(key) {
4111
4103
  if (include == null) {
@@ -4121,9 +4113,9 @@ var OpenAIResponsesLanguageModel = class {
4121
4113
  if (topLogprobs) {
4122
4114
  addInclude("message.output_text.logprobs");
4123
4115
  }
4124
- const webSearchToolName = (_f = tools == null ? void 0 : tools.find(
4116
+ const webSearchToolName = (_g = tools == null ? void 0 : tools.find(
4125
4117
  (tool) => tool.type === "provider" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
4126
- )) == null ? void 0 : _f.name;
4118
+ )) == null ? void 0 : _g.name;
4127
4119
  if (webSearchToolName) {
4128
4120
  addInclude("web_search_call.action.sources");
4129
4121
  }
@@ -4146,7 +4138,7 @@ var OpenAIResponsesLanguageModel = class {
4146
4138
  format: responseFormat.schema != null ? {
4147
4139
  type: "json_schema",
4148
4140
  strict: strictJsonSchema,
4149
- name: (_g = responseFormat.name) != null ? _g : "response",
4141
+ name: (_h = responseFormat.name) != null ? _h : "response",
4150
4142
  description: responseFormat.description,
4151
4143
  schema: responseFormat.schema
4152
4144
  } : { type: "json_object" }
@@ -5788,7 +5780,7 @@ var OpenAITranscriptionModel = class {
5788
5780
  };
5789
5781
 
5790
5782
  // src/version.ts
5791
- var VERSION = true ? "3.0.19" : "0.0.0-test";
5783
+ var VERSION = true ? "3.0.20" : "0.0.0-test";
5792
5784
 
5793
5785
  // src/openai-provider.ts
5794
5786
  function createOpenAI(options = {}) {