@zenning/openai 3.0.12 → 3.0.13

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
@@ -2552,44 +2552,10 @@ async function convertToOpenAIResponsesInput({
2552
2552
  const input = [];
2553
2553
  const warnings = [];
2554
2554
  const processedApprovalIds = /* @__PURE__ */ new Set();
2555
- const approvalIdToToolCallId = /* @__PURE__ */ new Map();
2556
- for (const message of prompt) {
2557
- if (message.role === "assistant") {
2558
- console.log("[OpenAI Provider] Assistant message content type:", typeof message.content, "isArray:", Array.isArray(message.content));
2559
- if (Array.isArray(message.content)) {
2560
- console.log("[OpenAI Provider] Assistant content parts:", message.content.map((p) => p.type));
2561
- const approvalRequests = message.content.filter(
2562
- (p) => p.type === "tool-approval-request"
2563
- );
2564
- console.log("[OpenAI Provider] Found approval requests:", approvalRequests.length);
2565
- for (const req of approvalRequests) {
2566
- approvalIdToToolCallId.set(req.approvalId, req.toolCallId);
2567
- }
2568
- }
2569
- }
2570
- }
2571
- console.log("[OpenAI Provider] approvalIdToToolCallId:", approvalIdToToolCallId);
2572
- const toolCallsWithApprovalResponses = /* @__PURE__ */ new Set();
2573
- for (const message of prompt) {
2574
- if (message.role === "tool") {
2575
- for (const part of message.content) {
2576
- if (part.type === "tool-approval-response") {
2577
- const toolCallId = approvalIdToToolCallId.get(part.approvalId);
2578
- console.log("[OpenAI Provider] Found approval response:", {
2579
- approvalId: part.approvalId,
2580
- toolCallId
2581
- });
2582
- if (toolCallId) {
2583
- toolCallsWithApprovalResponses.add(toolCallId);
2584
- }
2585
- }
2586
- }
2587
- }
2588
- }
2589
- console.log(
2590
- "[OpenAI Provider] toolCallsWithApprovalResponses:",
2591
- toolCallsWithApprovalResponses
2555
+ const hasApprovalResponses = prompt.some(
2556
+ (message) => message.role === "tool" && message.content.some((part) => part.type === "tool-approval-response")
2592
2557
  );
2558
+ console.log("[OpenAI Provider] Approval continuation detected:", hasApprovalResponses);
2593
2559
  if (compactionInput && compactionInput.length > 0) {
2594
2560
  input.push(...compactionInput);
2595
2561
  }
@@ -2667,14 +2633,6 @@ async function convertToOpenAIResponsesInput({
2667
2633
  }
2668
2634
  case "assistant": {
2669
2635
  const reasoningMessages = {};
2670
- const toolCallsWithApprovalRequest = /* @__PURE__ */ new Set();
2671
- if (Array.isArray(content)) {
2672
- for (const part of content) {
2673
- if (part.type === "tool-approval-request") {
2674
- toolCallsWithApprovalRequest.add(part.toolCallId);
2675
- }
2676
- }
2677
- }
2678
2636
  for (const part of content) {
2679
2637
  switch (part.type) {
2680
2638
  case "text": {
@@ -2692,21 +2650,14 @@ async function convertToOpenAIResponsesInput({
2692
2650
  }
2693
2651
  case "tool-call": {
2694
2652
  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;
2695
- const hasApprovalResponse = toolCallsWithApprovalResponses.has(
2696
- part.toolCallId
2697
- );
2698
- const hasApprovalRequest = toolCallsWithApprovalRequest.has(
2699
- part.toolCallId
2700
- );
2701
- const skipItemReference = hasApprovalResponse || hasApprovalRequest && toolCallsWithApprovalResponses.size > 0;
2653
+ const skipItemReference = hasApprovalResponses;
2702
2654
  console.log("[OpenAI Provider] Processing tool-call:", {
2703
2655
  toolCallId: part.toolCallId,
2704
2656
  toolName: part.toolName,
2705
2657
  id,
2706
2658
  providerExecuted: part.providerExecuted,
2707
2659
  store,
2708
- hasApprovalResponse,
2709
- hasApprovalRequest,
2660
+ hasApprovalResponses,
2710
2661
  skipItemReference,
2711
2662
  willCreateItemReference: store && id != null && !skipItemReference
2712
2663
  });
@@ -5919,7 +5870,7 @@ var OpenAITranscriptionModel = class {
5919
5870
  };
5920
5871
 
5921
5872
  // src/version.ts
5922
- var VERSION = true ? "3.0.11" : "0.0.0-test";
5873
+ var VERSION = true ? "3.0.12" : "0.0.0-test";
5923
5874
 
5924
5875
  // src/openai-provider.ts
5925
5876
  function createOpenAI(options = {}) {