@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.
@@ -2479,23 +2479,10 @@ async function convertToOpenAIResponsesInput({
2479
2479
  const warnings = [];
2480
2480
  const processedApprovalIds = /* @__PURE__ */ new Set();
2481
2481
  const approvalToolCallIds = new Set(approvalToolCallIdsArray || []);
2482
- console.log("CALDEBUG [convertToOpenAIResponsesInput] Starting conversion:", {
2483
- containsApprovalResponses,
2484
- approvalToolCallIdsCount: approvalToolCallIds.size,
2485
- approvalToolCallIds: Array.from(approvalToolCallIds),
2486
- previousResponseId,
2487
- promptLength: prompt.length
2488
- });
2489
2482
  if (compactionInput && compactionInput.length > 0) {
2490
2483
  input.push(...compactionInput);
2491
2484
  }
2492
2485
  for (const { role, content } of prompt) {
2493
- console.log("CALDEBUG [convertToOpenAIResponsesInput] Processing message:", {
2494
- role,
2495
- isString: typeof content === "string",
2496
- partsCount: typeof content === "string" ? 0 : content.length,
2497
- partTypes: typeof content === "string" ? [] : content.map((p) => p.type)
2498
- });
2499
2486
  switch (role) {
2500
2487
  case "system": {
2501
2488
  switch (systemMessageMode) {
@@ -2726,10 +2713,6 @@ async function convertToOpenAIResponsesInput({
2726
2713
  break;
2727
2714
  }
2728
2715
  case "tool": {
2729
- console.log("CALDEBUG [convertToOpenAIResponsesInput] Processing tool role message:", {
2730
- partsCount: content.length,
2731
- partTypes: content.map((p) => p.type)
2732
- });
2733
2716
  for (const part of content) {
2734
2717
  if (part.type === "tool-approval-response") {
2735
2718
  const approvalResponse = part;
@@ -2753,14 +2736,7 @@ async function convertToOpenAIResponsesInput({
2753
2736
  const output = part.output;
2754
2737
  if (output.type === "execution-denied") {
2755
2738
  const approvalId = (_l = (_k = output.providerOptions) == null ? void 0 : _k.openai) == null ? void 0 : _l.approvalId;
2756
- console.log("CALDEBUG [convertToOpenAIResponsesInput] Found execution-denied:", {
2757
- toolCallId: part.toolCallId,
2758
- toolName: part.toolName,
2759
- hasApprovalId: !!approvalId,
2760
- approvalId,
2761
- willSkip: !!approvalId
2762
- });
2763
- if (approvalId) {
2739
+ if (approvalId && !previousResponseId) {
2764
2740
  continue;
2765
2741
  }
2766
2742
  }
@@ -2869,15 +2845,6 @@ async function convertToOpenAIResponsesInput({
2869
2845
  }
2870
2846
  }
2871
2847
  }
2872
- console.log("CALDEBUG [convertToOpenAIResponsesInput] Final input:", {
2873
- inputLength: input.length,
2874
- inputTypes: input.map((item) => item.type || item.role),
2875
- hasItemReferences: input.some((item) => item.type === "item_reference"),
2876
- itemReferences: input.filter((item) => item.type === "item_reference").map((item) => ({
2877
- type: item.type,
2878
- id: typeof item.id === "string" ? item.id.substring(0, 20) + "..." : item.id
2879
- }))
2880
- });
2881
2848
  return { input, warnings };
2882
2849
  }
2883
2850
  var openaiResponsesReasoningProviderOptionsSchema = import_v415.z.object({
@@ -3825,6 +3792,18 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils24.lazySchem
3825
3792
  encrypted_content: import_v417.z.string()
3826
3793
  })
3827
3794
  ).optional(),
3795
+ /**
3796
+ * Server-side context management configuration.
3797
+ * When enabled with a compaction threshold, the server automatically compacts
3798
+ * the conversation in-stream when the rendered token count crosses the threshold.
3799
+ * @see https://developers.openai.com/api/docs/guides/compaction
3800
+ */
3801
+ contextManagement: import_v417.z.array(
3802
+ import_v417.z.object({
3803
+ type: import_v417.z.literal("compaction"),
3804
+ compact_threshold: import_v417.z.number()
3805
+ })
3806
+ ).optional(),
3828
3807
  /**
3829
3808
  * Whether the request contains tool approval responses.
3830
3809
  * Defaults to `false`.
@@ -4493,6 +4472,7 @@ var OpenAIResponsesLanguageModel = class {
4493
4472
  safety_identifier: openaiOptions == null ? void 0 : openaiOptions.safetyIdentifier,
4494
4473
  top_logprobs: topLogprobs,
4495
4474
  truncation: openaiOptions == null ? void 0 : openaiOptions.truncation,
4475
+ context_management: openaiOptions == null ? void 0 : openaiOptions.contextManagement,
4496
4476
  // model-specific settings:
4497
4477
  ...isReasoningModel && ((openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null) && {
4498
4478
  reasoning: {