@zenning/openai 3.0.21 → 3.0.22

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/dist/index.mjs CHANGED
@@ -2554,6 +2554,21 @@ async function convertToOpenAIResponsesInput({
2554
2554
  const input = [];
2555
2555
  const warnings = [];
2556
2556
  const processedApprovalIds = /* @__PURE__ */ new Set();
2557
+ const approvalToolCallIds = /* @__PURE__ */ new Set();
2558
+ if (containsApprovalResponses) {
2559
+ for (const message of prompt) {
2560
+ if (message.role !== "assistant") continue;
2561
+ if (typeof message.content === "string") continue;
2562
+ for (const part of message.content) {
2563
+ if (part.type === "tool-call") {
2564
+ const approval = part.approval;
2565
+ if ((approval == null ? void 0 : approval.approved) != null) {
2566
+ approvalToolCallIds.add(part.toolCallId);
2567
+ }
2568
+ }
2569
+ }
2570
+ }
2571
+ }
2557
2572
  if (compactionInput && compactionInput.length > 0) {
2558
2573
  input.push(...compactionInput);
2559
2574
  }
@@ -2648,17 +2663,18 @@ async function convertToOpenAIResponsesInput({
2648
2663
  }
2649
2664
  case "tool-call": {
2650
2665
  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;
2666
+ const toolHadApproval = containsApprovalResponses && approvalToolCallIds.has(part.toolCallId);
2651
2667
  if (part.providerExecuted) {
2652
- if (store && id != null && !containsApprovalResponses) {
2668
+ if (store && id != null && !toolHadApproval) {
2653
2669
  input.push({ type: "item_reference", id });
2654
2670
  }
2655
2671
  break;
2656
2672
  }
2657
- if (store && id != null && !containsApprovalResponses) {
2673
+ if (store && id != null && !toolHadApproval) {
2658
2674
  input.push({ type: "item_reference", id });
2659
2675
  break;
2660
2676
  }
2661
- if (store && id != null && containsApprovalResponses) {
2677
+ if (store && id != null && toolHadApproval) {
2662
2678
  break;
2663
2679
  }
2664
2680
  const resolvedToolName = toolNameMapping.toProviderToolName(
@@ -5865,7 +5881,7 @@ var OpenAITranscriptionModel = class {
5865
5881
  };
5866
5882
 
5867
5883
  // src/version.ts
5868
- var VERSION = true ? "3.0.21" : "0.0.0-test";
5884
+ var VERSION = true ? "3.0.22" : "0.0.0-test";
5869
5885
 
5870
5886
  // src/openai-provider.ts
5871
5887
  function createOpenAI(options = {}) {