@ai-sdk/openai 4.0.40 → 4.0.42

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.
@@ -391,7 +391,7 @@ declare const openaiResponsesComputerCallSchema: z.ZodObject<{
391
391
  }, z.core.$strip>>>>;
392
392
  }, z.core.$strip>;
393
393
  type OpenAIResponsesInput = Array<OpenAIResponsesInputItem>;
394
- type OpenAIResponsesInputItem = OpenAIResponsesSystemMessage | OpenAIResponsesUserMessage | OpenAIResponsesAssistantMessage | OpenAIResponsesFunctionCall | OpenAIResponsesFunctionCallOutput | OpenAIResponsesProgram | OpenAIResponsesProgramOutput | OpenAIResponsesCustomToolCall | OpenAIResponsesCustomToolCallOutput | OpenAIResponsesMcpApprovalResponse | OpenAIResponsesComputerCall | OpenAIResponsesComputerCallOutput | OpenAIResponsesLocalShellCall | OpenAIResponsesLocalShellCallOutput | OpenAIResponsesShellCall | OpenAIResponsesShellCallOutput | OpenAIResponsesApplyPatchCall | OpenAIResponsesApplyPatchCallOutput | OpenAIResponsesToolSearchCall | OpenAIResponsesToolSearchOutput | OpenAIResponsesReasoning | OpenAIResponsesItemReference | OpenAIResponsesCompactionItem;
394
+ type OpenAIResponsesInputItem = OpenAIResponsesSystemMessage | OpenAIResponsesUserMessage | OpenAIResponsesAssistantMessage | OpenAIResponsesFunctionCall | OpenAIResponsesFunctionCallOutput | OpenAIResponsesProgram | OpenAIResponsesProgramOutput | OpenAIResponsesCustomToolCall | OpenAIResponsesCustomToolCallOutput | OpenAIResponsesMcpApprovalResponse | OpenAIResponsesComputerCall | OpenAIResponsesComputerCallOutput | OpenAIResponsesLocalShellCall | OpenAIResponsesLocalShellCallOutput | OpenAIResponsesShellCall | OpenAIResponsesShellCallOutput | OpenAIResponsesApplyPatchCall | OpenAIResponsesApplyPatchCallOutput | OpenAIResponsesToolSearchCall | OpenAIResponsesToolSearchOutput | OpenAIResponsesReasoning | OpenAIResponsesItemReference | OpenAIResponsesCompactionItem | OpenAIResponsesCompactionTrigger;
395
395
  type OpenAIResponsesIncludeValue = 'web_search_call.action.sources' | 'web_search_call.results' | 'code_interpreter_call.outputs' | 'computer_call_output.output.image_url' | 'file_search_call.results' | 'message.input_image.image_url' | 'message.output_text.logprobs' | 'reasoning.encrypted_content';
396
396
  type OpenAIResponsesIncludeOptions = Array<OpenAIResponsesIncludeValue> | undefined | null;
397
397
  type OpenAIResponsesSystemMessage = {
@@ -645,6 +645,9 @@ type OpenAIResponsesCompactionItem = {
645
645
  id: string;
646
646
  encrypted_content: string;
647
647
  };
648
+ type OpenAIResponsesCompactionTrigger = {
649
+ type: 'compaction_trigger';
650
+ };
648
651
  /**
649
652
  * A filter used to compare a specified attribute key to a given value using a defined comparison operation.
650
653
  */
@@ -3708,7 +3708,9 @@ async function convertToOpenAIResponsesInput({
3708
3708
  if (store && id != null) {
3709
3709
  input.push({ type: "item_reference", id });
3710
3710
  }
3711
- break;
3711
+ if (store || !hasShellTool || resolvedToolName !== "shell") {
3712
+ break;
3713
+ }
3712
3714
  }
3713
3715
  const isProviderDefinedToolCall = hasLocalShellTool && resolvedToolName === "local_shell" || hasShellTool && resolvedToolName === "shell" || hasApplyPatchTool && resolvedToolName === "apply_patch" || hasComputerTool && resolvedToolName === "computer" || ((_o = customProviderToolNames == null ? void 0 : customProviderToolNames.has(resolvedToolName)) != null ? _o : false);
3714
3716
  if (hasPreviousResponseId && store && id != null && isProviderDefinedToolCall) {
@@ -5648,6 +5650,11 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
5648
5650
  compactThreshold: z21.number()
5649
5651
  })
5650
5652
  ).nullish(),
5653
+ /**
5654
+ * Request explicit server-side compaction by appending a
5655
+ * `compaction_trigger` item to the Responses input.
5656
+ */
5657
+ compactionTrigger: z21.boolean().optional(),
5651
5658
  /**
5652
5659
  * Restrict the callable tools to a subset while keeping the full tools
5653
5660
  * list intact, so prompt caching is preserved across requests with
@@ -6582,6 +6589,9 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
6582
6589
  outputSchemaToolNames: outputSchemaToolNames.size > 0 ? outputSchemaToolNames : void 0
6583
6590
  });
6584
6591
  warnings.push(...inputWarnings);
6592
+ if (openaiOptions == null ? void 0 : openaiOptions.compactionTrigger) {
6593
+ input.push({ type: "compaction_trigger" });
6594
+ }
6585
6595
  const strictJsonSchema = (_g = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _g : true;
6586
6596
  let include = openaiOptions == null ? void 0 : openaiOptions.include;
6587
6597
  function addInclude(key) {