@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.
@@ -2491,7 +2491,8 @@ async function convertToOpenAIResponsesInput({
2491
2491
  hasShellTool = false,
2492
2492
  hasApplyPatchTool = false,
2493
2493
  compactionInput,
2494
- previousResponseId
2494
+ previousResponseId,
2495
+ containsApprovalResponses
2495
2496
  }) {
2496
2497
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2497
2498
  const input = [];
@@ -2578,7 +2579,7 @@ async function convertToOpenAIResponsesInput({
2578
2579
  switch (part.type) {
2579
2580
  case "text": {
2580
2581
  const id = (_b = (_a = part.providerOptions) == null ? void 0 : _a[providerOptionsName]) == null ? void 0 : _b.itemId;
2581
- if (store && id != null && !previousResponseId) {
2582
+ if (store && id != null) {
2582
2583
  input.push({ type: "item_reference", id });
2583
2584
  break;
2584
2585
  }
@@ -2592,12 +2593,12 @@ async function convertToOpenAIResponsesInput({
2592
2593
  case "tool-call": {
2593
2594
  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;
2594
2595
  if (part.providerExecuted) {
2595
- if (store && id != null && !previousResponseId) {
2596
+ if (store && id != null) {
2596
2597
  input.push({ type: "item_reference", id });
2597
2598
  }
2598
2599
  break;
2599
2600
  }
2600
- if (store && id != null && !previousResponseId) {
2601
+ if (store && id != null) {
2601
2602
  input.push({ type: "item_reference", id });
2602
2603
  break;
2603
2604
  }
@@ -2656,10 +2657,9 @@ async function convertToOpenAIResponsesInput({
2656
2657
  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") {
2657
2658
  break;
2658
2659
  }
2659
- if (store && !previousResponseId) {
2660
+ if (store) {
2660
2661
  const itemId = (_j = (_i = (_h = part.providerMetadata) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
2661
2662
  input.push({ type: "item_reference", id: itemId });
2662
- } else if (store) {
2663
2663
  } else {
2664
2664
  warnings.push({
2665
2665
  type: "other",
@@ -2677,7 +2677,7 @@ async function convertToOpenAIResponsesInput({
2677
2677
  const reasoningId = providerOptions == null ? void 0 : providerOptions.itemId;
2678
2678
  if (reasoningId != null) {
2679
2679
  const reasoningMessage = reasoningMessages[reasoningId];
2680
- if (store && !previousResponseId) {
2680
+ if (store) {
2681
2681
  if (reasoningMessage === void 0) {
2682
2682
  input.push({ type: "item_reference", id: reasoningId });
2683
2683
  reasoningMessages[reasoningId] = {
@@ -2686,14 +2686,6 @@ async function convertToOpenAIResponsesInput({
2686
2686
  summary: []
2687
2687
  };
2688
2688
  }
2689
- } else if (store) {
2690
- if (reasoningMessage === void 0) {
2691
- reasoningMessages[reasoningId] = {
2692
- type: "reasoning",
2693
- id: reasoningId,
2694
- summary: []
2695
- };
2696
- }
2697
2689
  } else {
2698
2690
  const summaryParts = [];
2699
2691
  if (part.text.length > 0) {
@@ -3813,7 +3805,12 @@ var openaiResponsesProviderOptionsSchema = lazySchema15(
3813
3805
  type: z17.literal("compaction"),
3814
3806
  encrypted_content: z17.string()
3815
3807
  })
3816
- ).optional()
3808
+ ).optional(),
3809
+ /**
3810
+ * Whether the request contains tool approval responses.
3811
+ * Defaults to `false`.
3812
+ */
3813
+ containsApprovalResponses: z17.boolean().optional()
3817
3814
  })
3818
3815
  )
3819
3816
  );
@@ -4362,7 +4359,7 @@ var OpenAIResponsesLanguageModel = class {
4362
4359
  toolChoice,
4363
4360
  responseFormat
4364
4361
  }) {
4365
- var _a, _b, _c, _d, _e, _f, _g;
4362
+ var _a, _b, _c, _d, _e, _f, _g, _h;
4366
4363
  const warnings = [];
4367
4364
  const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
4368
4365
  if (topK != null) {
@@ -4426,10 +4423,11 @@ var OpenAIResponsesLanguageModel = class {
4426
4423
  hasShellTool: hasOpenAITool("openai.shell"),
4427
4424
  hasApplyPatchTool: hasOpenAITool("openai.apply_patch"),
4428
4425
  compactionInput: openaiOptions == null ? void 0 : openaiOptions.compactionInput,
4429
- previousResponseId: (_d = openaiOptions == null ? void 0 : openaiOptions.previousResponseId) != null ? _d : void 0
4426
+ previousResponseId: (_d = openaiOptions == null ? void 0 : openaiOptions.previousResponseId) != null ? _d : void 0,
4427
+ containsApprovalResponses: (_e = openaiOptions == null ? void 0 : openaiOptions.containsApprovalResponses) != null ? _e : false
4430
4428
  });
4431
4429
  warnings.push(...inputWarnings);
4432
- const strictJsonSchema = (_e = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _e : true;
4430
+ const strictJsonSchema = (_f = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _f : true;
4433
4431
  let include = openaiOptions == null ? void 0 : openaiOptions.include;
4434
4432
  function addInclude(key) {
4435
4433
  if (include == null) {
@@ -4445,9 +4443,9 @@ var OpenAIResponsesLanguageModel = class {
4445
4443
  if (topLogprobs) {
4446
4444
  addInclude("message.output_text.logprobs");
4447
4445
  }
4448
- const webSearchToolName = (_f = tools == null ? void 0 : tools.find(
4446
+ const webSearchToolName = (_g = tools == null ? void 0 : tools.find(
4449
4447
  (tool) => tool.type === "provider" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
4450
- )) == null ? void 0 : _f.name;
4448
+ )) == null ? void 0 : _g.name;
4451
4449
  if (webSearchToolName) {
4452
4450
  addInclude("web_search_call.action.sources");
4453
4451
  }
@@ -4470,7 +4468,7 @@ var OpenAIResponsesLanguageModel = class {
4470
4468
  format: responseFormat.schema != null ? {
4471
4469
  type: "json_schema",
4472
4470
  strict: strictJsonSchema,
4473
- name: (_g = responseFormat.name) != null ? _g : "response",
4471
+ name: (_h = responseFormat.name) != null ? _h : "response",
4474
4472
  description: responseFormat.description,
4475
4473
  schema: responseFormat.schema
4476
4474
  } : { type: "json_object" }