@zenning/openai 3.0.6 → 3.0.7

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.
@@ -2489,12 +2489,16 @@ async function convertToOpenAIResponsesInput({
2489
2489
  store,
2490
2490
  hasLocalShellTool = false,
2491
2491
  hasShellTool = false,
2492
- hasApplyPatchTool = false
2492
+ hasApplyPatchTool = false,
2493
+ compactionInput
2493
2494
  }) {
2494
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
2495
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2495
2496
  const input = [];
2496
2497
  const warnings = [];
2497
2498
  const processedApprovalIds = /* @__PURE__ */ new Set();
2499
+ if (compactionInput && compactionInput.length > 0) {
2500
+ input.push(...compactionInput);
2501
+ }
2498
2502
  for (const { role, content } of prompt) {
2499
2503
  switch (role) {
2500
2504
  case "system": {
@@ -2584,17 +2588,8 @@ async function convertToOpenAIResponsesInput({
2584
2588
  });
2585
2589
  break;
2586
2590
  }
2587
- case "compaction": {
2588
- const id = (_d = (_c = part.providerOptions) == null ? void 0 : _c[providerOptionsName]) == null ? void 0 : _d.itemId;
2589
- input.push({
2590
- role: "assistant",
2591
- content: [{ type: "compaction", encrypted_content: part.encrypted_content }],
2592
- id
2593
- });
2594
- break;
2595
- }
2596
2591
  case "tool-call": {
2597
- const id = (_i = (_f = (_e = part.providerOptions) == null ? void 0 : _e[providerOptionsName]) == null ? void 0 : _f.itemId) != null ? _i : (_h = (_g = part.providerMetadata) == null ? void 0 : _g[providerOptionsName]) == null ? void 0 : _h.itemId;
2592
+ 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;
2598
2593
  if (part.providerExecuted) {
2599
2594
  if (store && id != null) {
2600
2595
  input.push({ type: "item_reference", id });
@@ -2661,7 +2656,7 @@ async function convertToOpenAIResponsesInput({
2661
2656
  break;
2662
2657
  }
2663
2658
  if (store) {
2664
- const itemId = (_l = (_k = (_j = part.providerMetadata) == null ? void 0 : _j[providerOptionsName]) == null ? void 0 : _k.itemId) != null ? _l : part.toolCallId;
2659
+ const itemId = (_j = (_i = (_h = part.providerMetadata) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
2665
2660
  input.push({ type: "item_reference", id: itemId });
2666
2661
  } else {
2667
2662
  warnings.push({
@@ -2752,7 +2747,7 @@ async function convertToOpenAIResponsesInput({
2752
2747
  }
2753
2748
  const output = part.output;
2754
2749
  if (output.type === "execution-denied") {
2755
- const approvalId = (_n = (_m = output.providerOptions) == null ? void 0 : _m.openai) == null ? void 0 : _n.approvalId;
2750
+ const approvalId = (_l = (_k = output.providerOptions) == null ? void 0 : _k.openai) == null ? void 0 : _l.approvalId;
2756
2751
  if (approvalId) {
2757
2752
  continue;
2758
2753
  }
@@ -2811,7 +2806,7 @@ async function convertToOpenAIResponsesInput({
2811
2806
  contentValue = output.value;
2812
2807
  break;
2813
2808
  case "execution-denied":
2814
- contentValue = (_o = output.reason) != null ? _o : "Tool execution denied.";
2809
+ contentValue = (_m = output.reason) != null ? _m : "Tool execution denied.";
2815
2810
  break;
2816
2811
  case "json":
2817
2812
  case "error-json":
@@ -3797,7 +3792,18 @@ var openaiResponsesProviderOptionsSchema = lazySchema15(
3797
3792
  * When enabled, the SDK applies reasoning-model parameter compatibility rules
3798
3793
  * and defaults `systemMessageMode` to `developer` unless overridden.
3799
3794
  */
3800
- forceReasoning: z17.boolean().optional()
3795
+ forceReasoning: z17.boolean().optional(),
3796
+ /**
3797
+ * Compaction input items to inject into the request.
3798
+ * These are standalone items from the /responses/compact endpoint that contain
3799
+ * encrypted conversation history for context window management.
3800
+ */
3801
+ compactionInput: z17.array(
3802
+ z17.object({
3803
+ type: z17.literal("compaction"),
3804
+ encrypted_content: z17.string()
3805
+ })
3806
+ ).optional()
3801
3807
  })
3802
3808
  )
3803
3809
  );
@@ -4408,7 +4414,8 @@ var OpenAIResponsesLanguageModel = class {
4408
4414
  store: (_c = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _c : true,
4409
4415
  hasLocalShellTool: hasOpenAITool("openai.local_shell"),
4410
4416
  hasShellTool: hasOpenAITool("openai.shell"),
4411
- hasApplyPatchTool: hasOpenAITool("openai.apply_patch")
4417
+ hasApplyPatchTool: hasOpenAITool("openai.apply_patch"),
4418
+ compactionInput: openaiOptions == null ? void 0 : openaiOptions.compactionInput
4412
4419
  });
4413
4420
  warnings.push(...inputWarnings);
4414
4421
  const strictJsonSchema = (_d = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _d : true;