@zenning/openai 3.0.25 → 3.0.27
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 +6 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +15 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -35
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +14 -34
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +14 -34
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/internal/index.mjs
CHANGED
|
@@ -2500,23 +2500,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2500
2500
|
const warnings = [];
|
|
2501
2501
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
2502
2502
|
const approvalToolCallIds = new Set(approvalToolCallIdsArray || []);
|
|
2503
|
-
console.log("CALDEBUG [convertToOpenAIResponsesInput] Starting conversion:", {
|
|
2504
|
-
containsApprovalResponses,
|
|
2505
|
-
approvalToolCallIdsCount: approvalToolCallIds.size,
|
|
2506
|
-
approvalToolCallIds: Array.from(approvalToolCallIds),
|
|
2507
|
-
previousResponseId,
|
|
2508
|
-
promptLength: prompt.length
|
|
2509
|
-
});
|
|
2510
2503
|
if (compactionInput && compactionInput.length > 0) {
|
|
2511
2504
|
input.push(...compactionInput);
|
|
2512
2505
|
}
|
|
2513
2506
|
for (const { role, content } of prompt) {
|
|
2514
|
-
console.log("CALDEBUG [convertToOpenAIResponsesInput] Processing message:", {
|
|
2515
|
-
role,
|
|
2516
|
-
isString: typeof content === "string",
|
|
2517
|
-
partsCount: typeof content === "string" ? 0 : content.length,
|
|
2518
|
-
partTypes: typeof content === "string" ? [] : content.map((p) => p.type)
|
|
2519
|
-
});
|
|
2520
2507
|
switch (role) {
|
|
2521
2508
|
case "system": {
|
|
2522
2509
|
switch (systemMessageMode) {
|
|
@@ -2747,10 +2734,6 @@ async function convertToOpenAIResponsesInput({
|
|
|
2747
2734
|
break;
|
|
2748
2735
|
}
|
|
2749
2736
|
case "tool": {
|
|
2750
|
-
console.log("CALDEBUG [convertToOpenAIResponsesInput] Processing tool role message:", {
|
|
2751
|
-
partsCount: content.length,
|
|
2752
|
-
partTypes: content.map((p) => p.type)
|
|
2753
|
-
});
|
|
2754
2737
|
for (const part of content) {
|
|
2755
2738
|
if (part.type === "tool-approval-response") {
|
|
2756
2739
|
const approvalResponse = part;
|
|
@@ -2774,14 +2757,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2774
2757
|
const output = part.output;
|
|
2775
2758
|
if (output.type === "execution-denied") {
|
|
2776
2759
|
const approvalId = (_l = (_k = output.providerOptions) == null ? void 0 : _k.openai) == null ? void 0 : _l.approvalId;
|
|
2777
|
-
|
|
2778
|
-
toolCallId: part.toolCallId,
|
|
2779
|
-
toolName: part.toolName,
|
|
2780
|
-
hasApprovalId: !!approvalId,
|
|
2781
|
-
approvalId,
|
|
2782
|
-
willSkip: !!approvalId
|
|
2783
|
-
});
|
|
2784
|
-
if (approvalId) {
|
|
2760
|
+
if (approvalId && !previousResponseId) {
|
|
2785
2761
|
continue;
|
|
2786
2762
|
}
|
|
2787
2763
|
}
|
|
@@ -2890,15 +2866,6 @@ async function convertToOpenAIResponsesInput({
|
|
|
2890
2866
|
}
|
|
2891
2867
|
}
|
|
2892
2868
|
}
|
|
2893
|
-
console.log("CALDEBUG [convertToOpenAIResponsesInput] Final input:", {
|
|
2894
|
-
inputLength: input.length,
|
|
2895
|
-
inputTypes: input.map((item) => item.type || item.role),
|
|
2896
|
-
hasItemReferences: input.some((item) => item.type === "item_reference"),
|
|
2897
|
-
itemReferences: input.filter((item) => item.type === "item_reference").map((item) => ({
|
|
2898
|
-
type: item.type,
|
|
2899
|
-
id: typeof item.id === "string" ? item.id.substring(0, 20) + "..." : item.id
|
|
2900
|
-
}))
|
|
2901
|
-
});
|
|
2902
2869
|
return { input, warnings };
|
|
2903
2870
|
}
|
|
2904
2871
|
var openaiResponsesReasoningProviderOptionsSchema = z15.object({
|
|
@@ -3846,6 +3813,18 @@ var openaiResponsesProviderOptionsSchema = lazySchema15(
|
|
|
3846
3813
|
encrypted_content: z17.string()
|
|
3847
3814
|
})
|
|
3848
3815
|
).optional(),
|
|
3816
|
+
/**
|
|
3817
|
+
* Server-side context management configuration.
|
|
3818
|
+
* When enabled with a compaction threshold, the server automatically compacts
|
|
3819
|
+
* the conversation in-stream when the rendered token count crosses the threshold.
|
|
3820
|
+
* @see https://developers.openai.com/api/docs/guides/compaction
|
|
3821
|
+
*/
|
|
3822
|
+
contextManagement: z17.array(
|
|
3823
|
+
z17.object({
|
|
3824
|
+
type: z17.literal("compaction"),
|
|
3825
|
+
compact_threshold: z17.number()
|
|
3826
|
+
})
|
|
3827
|
+
).optional(),
|
|
3849
3828
|
/**
|
|
3850
3829
|
* Whether the request contains tool approval responses.
|
|
3851
3830
|
* Defaults to `false`.
|
|
@@ -4540,6 +4519,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4540
4519
|
safety_identifier: openaiOptions == null ? void 0 : openaiOptions.safetyIdentifier,
|
|
4541
4520
|
top_logprobs: topLogprobs,
|
|
4542
4521
|
truncation: openaiOptions == null ? void 0 : openaiOptions.truncation,
|
|
4522
|
+
context_management: openaiOptions == null ? void 0 : openaiOptions.contextManagement,
|
|
4543
4523
|
// model-specific settings:
|
|
4544
4524
|
...isReasoningModel && ((openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null) && {
|
|
4545
4525
|
reasoning: {
|