@ai-sdk/openai 2.0.54 → 2.0.56

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.
@@ -2600,7 +2600,8 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazyValidator)(
2600
2600
  action: import_v414.z.discriminatedUnion("type", [
2601
2601
  import_v414.z.object({
2602
2602
  type: import_v414.z.literal("search"),
2603
- query: import_v414.z.string().nullish()
2603
+ query: import_v414.z.string().nullish(),
2604
+ sources: import_v414.z.array(import_v414.z.object({ type: import_v414.z.literal("url"), url: import_v414.z.string() })).nullish()
2604
2605
  }),
2605
2606
  import_v414.z.object({
2606
2607
  type: import_v414.z.literal("open_page"),
@@ -2786,7 +2787,8 @@ var openaiResponsesResponseSchema = (0, import_provider_utils21.lazyValidator)(
2786
2787
  action: import_v414.z.discriminatedUnion("type", [
2787
2788
  import_v414.z.object({
2788
2789
  type: import_v414.z.literal("search"),
2789
- query: import_v414.z.string().nullish()
2790
+ query: import_v414.z.string().nullish(),
2791
+ sources: import_v414.z.array(import_v414.z.object({ type: import_v414.z.literal("url"), url: import_v414.z.string() })).nullish()
2790
2792
  }),
2791
2793
  import_v414.z.object({
2792
2794
  type: import_v414.z.literal("open_page"),
@@ -3123,7 +3125,8 @@ var webSearchOutputSchema = (0, import_provider_utils25.lazySchema)(
3123
3125
  url: import_v418.z.string(),
3124
3126
  pattern: import_v418.z.string()
3125
3127
  })
3126
- ])
3128
+ ]),
3129
+ sources: import_v418.z.array(import_v418.z.object({ type: import_v418.z.literal("url"), url: import_v418.z.string() })).optional()
3127
3130
  })
3128
3131
  )
3129
3132
  );
@@ -3696,7 +3699,14 @@ var OpenAIResponsesLanguageModel = class {
3696
3699
  id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils29.generateId)(),
3697
3700
  mediaType: "text/plain",
3698
3701
  title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
3699
- filename: (_l = annotation.filename) != null ? _l : annotation.file_id
3702
+ filename: (_l = annotation.filename) != null ? _l : annotation.file_id,
3703
+ ...annotation.file_id ? {
3704
+ providerMetadata: {
3705
+ openai: {
3706
+ fileId: annotation.file_id
3707
+ }
3708
+ }
3709
+ } : {}
3700
3710
  });
3701
3711
  }
3702
3712
  }
@@ -4274,7 +4284,14 @@ var OpenAIResponsesLanguageModel = class {
4274
4284
  id: (_s = (_r = (_q = self.config).generateId) == null ? void 0 : _r.call(_q)) != null ? _s : (0, import_provider_utils29.generateId)(),
4275
4285
  mediaType: "text/plain",
4276
4286
  title: (_u = (_t = value.annotation.quote) != null ? _t : value.annotation.filename) != null ? _u : "Document",
4277
- filename: (_v = value.annotation.filename) != null ? _v : value.annotation.file_id
4287
+ filename: (_v = value.annotation.filename) != null ? _v : value.annotation.file_id,
4288
+ ...value.annotation.file_id ? {
4289
+ providerMetadata: {
4290
+ openai: {
4291
+ fileId: value.annotation.file_id
4292
+ }
4293
+ }
4294
+ } : {}
4278
4295
  });
4279
4296
  }
4280
4297
  } else if (isErrorChunk(value)) {
@@ -4374,7 +4391,11 @@ function mapWebSearchOutput(action) {
4374
4391
  var _a;
4375
4392
  switch (action.type) {
4376
4393
  case "search":
4377
- return { action: { type: "search", query: (_a = action.query) != null ? _a : void 0 } };
4394
+ return {
4395
+ action: { type: "search", query: (_a = action.query) != null ? _a : void 0 },
4396
+ // include sources when provided by the Responses API (behind include flag)
4397
+ ...action.sources != null && { sources: action.sources }
4398
+ };
4378
4399
  case "open_page":
4379
4400
  return { action: { type: "openPage", url: action.url } };
4380
4401
  case "find":