@zenning/openai 3.0.13 → 3.0.15

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,18 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 3.0.15
4
+
5
+ ### Patch Changes
6
+
7
+ - approvals5
8
+
9
+ ## 3.0.14
10
+
11
+ ### Patch Changes
12
+
13
+ - 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.
14
+ - approvals4
15
+
3
16
  ## 3.0.13
4
17
 
5
18
  ### 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,29 +2580,31 @@ 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;
2607
2603
  }
2604
+ if (skipItemReferences) {
2605
+ console.log("[OpenAI Provider] Skipping function_call due to approval continuation flag");
2606
+ break;
2607
+ }
2608
2608
  const resolvedToolName = toolNameMapping.toProviderToolName(
2609
2609
  part.toolName
2610
2610
  );
@@ -5788,7 +5788,7 @@ var OpenAITranscriptionModel = class {
5788
5788
  };
5789
5789
 
5790
5790
  // src/version.ts
5791
- var VERSION = true ? "3.0.12" : "0.0.0-test";
5791
+ var VERSION = true ? "3.0.14" : "0.0.0-test";
5792
5792
 
5793
5793
  // src/openai-provider.ts
5794
5794
  function createOpenAI(options = {}) {