@zenning/openai 3.0.12 → 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 +13 -0
- package/dist/index.js +7 -60
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -60
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +6 -59
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +6 -59
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2552,44 +2552,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
2552
2552
|
const input = [];
|
|
2553
2553
|
const warnings = [];
|
|
2554
2554
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
2555
|
-
const
|
|
2556
|
-
|
|
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
|
|
2592
|
-
);
|
|
2555
|
+
const skipItemReferences = (providerOptionsName && (store == null ? void 0 : store.skipItemReferencesForApproval)) === true;
|
|
2556
|
+
console.log("[OpenAI Provider] Skip item references flag:", skipItemReferences);
|
|
2593
2557
|
if (compactionInput && compactionInput.length > 0) {
|
|
2594
2558
|
input.push(...compactionInput);
|
|
2595
2559
|
}
|
|
@@ -2667,14 +2631,6 @@ async function convertToOpenAIResponsesInput({
|
|
|
2667
2631
|
}
|
|
2668
2632
|
case "assistant": {
|
|
2669
2633
|
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
2634
|
for (const part of content) {
|
|
2679
2635
|
switch (part.type) {
|
|
2680
2636
|
case "text": {
|
|
@@ -2692,32 +2648,23 @@ async function convertToOpenAIResponsesInput({
|
|
|
2692
2648
|
}
|
|
2693
2649
|
case "tool-call": {
|
|
2694
2650
|
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;
|
|
2702
2651
|
console.log("[OpenAI Provider] Processing tool-call:", {
|
|
2703
2652
|
toolCallId: part.toolCallId,
|
|
2704
2653
|
toolName: part.toolName,
|
|
2705
2654
|
id,
|
|
2706
2655
|
providerExecuted: part.providerExecuted,
|
|
2707
2656
|
store,
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
skipItemReference,
|
|
2711
|
-
willCreateItemReference: store && id != null && !skipItemReference
|
|
2657
|
+
skipItemReferences,
|
|
2658
|
+
willCreateItemReference: store && id != null && !skipItemReferences
|
|
2712
2659
|
});
|
|
2713
2660
|
if (part.providerExecuted) {
|
|
2714
|
-
if (store && id != null && !
|
|
2661
|
+
if (store && id != null && !skipItemReferences) {
|
|
2715
2662
|
console.log("[OpenAI Provider] Creating item_reference (providerExecuted)");
|
|
2716
2663
|
input.push({ type: "item_reference", id });
|
|
2717
2664
|
}
|
|
2718
2665
|
break;
|
|
2719
2666
|
}
|
|
2720
|
-
if (store && id != null && !
|
|
2667
|
+
if (store && id != null && !skipItemReferences) {
|
|
2721
2668
|
console.log("[OpenAI Provider] Creating item_reference (non-providerExecuted)");
|
|
2722
2669
|
input.push({ type: "item_reference", id });
|
|
2723
2670
|
break;
|
|
@@ -5919,7 +5866,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5919
5866
|
};
|
|
5920
5867
|
|
|
5921
5868
|
// src/version.ts
|
|
5922
|
-
var VERSION = true ? "3.0.
|
|
5869
|
+
var VERSION = true ? "3.0.13" : "0.0.0-test";
|
|
5923
5870
|
|
|
5924
5871
|
// src/openai-provider.ts
|
|
5925
5872
|
function createOpenAI(options = {}) {
|