@zenning/openai 3.0.20 → 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/CHANGELOG.md +14 -0
- package/dist/index.js +22 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -3
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +21 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +21 -2
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
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,16 +2663,20 @@ 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) {
|
|
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) {
|
|
2673
|
+
if (store && id != null && !toolHadApproval) {
|
|
2658
2674
|
input.push({ type: "item_reference", id });
|
|
2659
2675
|
break;
|
|
2660
2676
|
}
|
|
2677
|
+
if (store && id != null && toolHadApproval) {
|
|
2678
|
+
break;
|
|
2679
|
+
}
|
|
2661
2680
|
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2662
2681
|
part.toolName
|
|
2663
2682
|
);
|
|
@@ -5862,7 +5881,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5862
5881
|
};
|
|
5863
5882
|
|
|
5864
5883
|
// src/version.ts
|
|
5865
|
-
var VERSION = true ? "3.0.
|
|
5884
|
+
var VERSION = true ? "3.0.22" : "0.0.0-test";
|
|
5866
5885
|
|
|
5867
5886
|
// src/openai-provider.ts
|
|
5868
5887
|
function createOpenAI(options = {}) {
|