@zenning/openai 3.0.18 → 3.0.20

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/dist/index.mjs CHANGED
@@ -2547,7 +2547,8 @@ async function convertToOpenAIResponsesInput({
2547
2547
  hasShellTool = false,
2548
2548
  hasApplyPatchTool = false,
2549
2549
  compactionInput,
2550
- previousResponseId
2550
+ previousResponseId,
2551
+ containsApprovalResponses
2551
2552
  }) {
2552
2553
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2553
2554
  const input = [];
@@ -2634,7 +2635,7 @@ async function convertToOpenAIResponsesInput({
2634
2635
  switch (part.type) {
2635
2636
  case "text": {
2636
2637
  const id = (_b = (_a = part.providerOptions) == null ? void 0 : _a[providerOptionsName]) == null ? void 0 : _b.itemId;
2637
- if (store && id != null && !previousResponseId) {
2638
+ if (store && id != null) {
2638
2639
  input.push({ type: "item_reference", id });
2639
2640
  break;
2640
2641
  }
@@ -2648,12 +2649,12 @@ async function convertToOpenAIResponsesInput({
2648
2649
  case "tool-call": {
2649
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;
2650
2651
  if (part.providerExecuted) {
2651
- if (store && id != null && !previousResponseId) {
2652
+ if (store && id != null) {
2652
2653
  input.push({ type: "item_reference", id });
2653
2654
  }
2654
2655
  break;
2655
2656
  }
2656
- if (store && id != null && !previousResponseId) {
2657
+ if (store && id != null) {
2657
2658
  input.push({ type: "item_reference", id });
2658
2659
  break;
2659
2660
  }
@@ -2712,10 +2713,9 @@ async function convertToOpenAIResponsesInput({
2712
2713
  if (part.output.type === "execution-denied" || part.output.type === "json" && typeof part.output.value === "object" && part.output.value != null && "type" in part.output.value && part.output.value.type === "execution-denied") {
2713
2714
  break;
2714
2715
  }
2715
- if (store && !previousResponseId) {
2716
+ if (store) {
2716
2717
  const itemId = (_j = (_i = (_h = part.providerMetadata) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
2717
2718
  input.push({ type: "item_reference", id: itemId });
2718
- } else if (store) {
2719
2719
  } else {
2720
2720
  warnings.push({
2721
2721
  type: "other",
@@ -2733,7 +2733,7 @@ async function convertToOpenAIResponsesInput({
2733
2733
  const reasoningId = providerOptions == null ? void 0 : providerOptions.itemId;
2734
2734
  if (reasoningId != null) {
2735
2735
  const reasoningMessage = reasoningMessages[reasoningId];
2736
- if (store && !previousResponseId) {
2736
+ if (store) {
2737
2737
  if (reasoningMessage === void 0) {
2738
2738
  input.push({ type: "item_reference", id: reasoningId });
2739
2739
  reasoningMessages[reasoningId] = {
@@ -2742,14 +2742,6 @@ async function convertToOpenAIResponsesInput({
2742
2742
  summary: []
2743
2743
  };
2744
2744
  }
2745
- } else if (store) {
2746
- if (reasoningMessage === void 0) {
2747
- reasoningMessages[reasoningId] = {
2748
- type: "reasoning",
2749
- id: reasoningId,
2750
- summary: []
2751
- };
2752
- }
2753
2745
  } else {
2754
2746
  const summaryParts = [];
2755
2747
  if (part.text.length > 0) {
@@ -3869,7 +3861,12 @@ var openaiResponsesProviderOptionsSchema = lazySchema18(
3869
3861
  type: z20.literal("compaction"),
3870
3862
  encrypted_content: z20.string()
3871
3863
  })
3872
- ).optional()
3864
+ ).optional(),
3865
+ /**
3866
+ * Whether the request contains tool approval responses.
3867
+ * Defaults to `false`.
3868
+ */
3869
+ containsApprovalResponses: z20.boolean().optional()
3873
3870
  })
3874
3871
  )
3875
3872
  );
@@ -4102,7 +4099,7 @@ var OpenAIResponsesLanguageModel = class {
4102
4099
  toolChoice,
4103
4100
  responseFormat
4104
4101
  }) {
4105
- var _a, _b, _c, _d, _e, _f, _g;
4102
+ var _a, _b, _c, _d, _e, _f, _g, _h;
4106
4103
  const warnings = [];
4107
4104
  const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
4108
4105
  if (topK != null) {
@@ -4166,10 +4163,11 @@ var OpenAIResponsesLanguageModel = class {
4166
4163
  hasShellTool: hasOpenAITool("openai.shell"),
4167
4164
  hasApplyPatchTool: hasOpenAITool("openai.apply_patch"),
4168
4165
  compactionInput: openaiOptions == null ? void 0 : openaiOptions.compactionInput,
4169
- previousResponseId: (_d = openaiOptions == null ? void 0 : openaiOptions.previousResponseId) != null ? _d : void 0
4166
+ previousResponseId: (_d = openaiOptions == null ? void 0 : openaiOptions.previousResponseId) != null ? _d : void 0,
4167
+ containsApprovalResponses: (_e = openaiOptions == null ? void 0 : openaiOptions.containsApprovalResponses) != null ? _e : false
4170
4168
  });
4171
4169
  warnings.push(...inputWarnings);
4172
- const strictJsonSchema = (_e = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _e : true;
4170
+ const strictJsonSchema = (_f = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _f : true;
4173
4171
  let include = openaiOptions == null ? void 0 : openaiOptions.include;
4174
4172
  function addInclude(key) {
4175
4173
  if (include == null) {
@@ -4185,9 +4183,9 @@ var OpenAIResponsesLanguageModel = class {
4185
4183
  if (topLogprobs) {
4186
4184
  addInclude("message.output_text.logprobs");
4187
4185
  }
4188
- const webSearchToolName = (_f = tools == null ? void 0 : tools.find(
4186
+ const webSearchToolName = (_g = tools == null ? void 0 : tools.find(
4189
4187
  (tool) => tool.type === "provider" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
4190
- )) == null ? void 0 : _f.name;
4188
+ )) == null ? void 0 : _g.name;
4191
4189
  if (webSearchToolName) {
4192
4190
  addInclude("web_search_call.action.sources");
4193
4191
  }
@@ -4210,7 +4208,7 @@ var OpenAIResponsesLanguageModel = class {
4210
4208
  format: responseFormat.schema != null ? {
4211
4209
  type: "json_schema",
4212
4210
  strict: strictJsonSchema,
4213
- name: (_g = responseFormat.name) != null ? _g : "response",
4211
+ name: (_h = responseFormat.name) != null ? _h : "response",
4214
4212
  description: responseFormat.description,
4215
4213
  schema: responseFormat.schema
4216
4214
  } : { type: "json_object" }
@@ -5864,7 +5862,7 @@ var OpenAITranscriptionModel = class {
5864
5862
  };
5865
5863
 
5866
5864
  // src/version.ts
5867
- var VERSION = true ? "3.0.17" : "0.0.0-test";
5865
+ var VERSION = true ? "3.0.20" : "0.0.0-test";
5868
5866
 
5869
5867
  // src/openai-provider.ts
5870
5868
  function createOpenAI(options = {}) {