@zenning/openai 3.0.13 → 3.0.14

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,12 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 3.0.14
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix duplicate item_reference for approval responses. Skip creating item_reference for all tool-calls when approval responses are detected in the prompt, preventing duplicate item errors with previousResponseId.
8
+ - approvals4
9
+
3
10
  ## 3.0.13
4
11
 
5
12
  ### Patch Changes
package/dist/index.js CHANGED
@@ -2484,10 +2484,8 @@ async function convertToOpenAIResponsesInput({
2484
2484
  const input = [];
2485
2485
  const warnings = [];
2486
2486
  const processedApprovalIds = /* @__PURE__ */ new Set();
2487
- const hasApprovalResponses = prompt.some(
2488
- (message) => message.role === "tool" && message.content.some((part) => part.type === "tool-approval-response")
2489
- );
2490
- console.log("[OpenAI Provider] Approval continuation detected:", hasApprovalResponses);
2487
+ const skipItemReferences = (providerOptionsName && (store == null ? void 0 : store.skipItemReferencesForApproval)) === true;
2488
+ console.log("[OpenAI Provider] Skip item references flag:", skipItemReferences);
2491
2489
  if (compactionInput && compactionInput.length > 0) {
2492
2490
  input.push(...compactionInput);
2493
2491
  }
@@ -2582,25 +2580,23 @@ async function convertToOpenAIResponsesInput({
2582
2580
  }
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
- const skipItemReference = hasApprovalResponses;
2586
2583
  console.log("[OpenAI Provider] Processing tool-call:", {
2587
2584
  toolCallId: part.toolCallId,
2588
2585
  toolName: part.toolName,
2589
2586
  id,
2590
2587
  providerExecuted: part.providerExecuted,
2591
2588
  store,
2592
- hasApprovalResponses,
2593
- skipItemReference,
2594
- willCreateItemReference: store && id != null && !skipItemReference
2589
+ skipItemReferences,
2590
+ willCreateItemReference: store && id != null && !skipItemReferences
2595
2591
  });
2596
2592
  if (part.providerExecuted) {
2597
- if (store && id != null && !skipItemReference) {
2593
+ if (store && id != null && !skipItemReferences) {
2598
2594
  console.log("[OpenAI Provider] Creating item_reference (providerExecuted)");
2599
2595
  input.push({ type: "item_reference", id });
2600
2596
  }
2601
2597
  break;
2602
2598
  }
2603
- if (store && id != null && !skipItemReference) {
2599
+ if (store && id != null && !skipItemReferences) {
2604
2600
  console.log("[OpenAI Provider] Creating item_reference (non-providerExecuted)");
2605
2601
  input.push({ type: "item_reference", id });
2606
2602
  break;
@@ -5788,7 +5784,7 @@ var OpenAITranscriptionModel = class {
5788
5784
  };
5789
5785
 
5790
5786
  // src/version.ts
5791
- var VERSION = true ? "3.0.12" : "0.0.0-test";
5787
+ var VERSION = true ? "3.0.13" : "0.0.0-test";
5792
5788
 
5793
5789
  // src/openai-provider.ts
5794
5790
  function createOpenAI(options = {}) {