@openrouter/ai-sdk-provider 1.5.2 → 1.5.3

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.
@@ -977,10 +977,10 @@ var FileAnnotationSchema = import_v43.z.object({
977
977
  import_v43.z.object({
978
978
  type: import_v43.z.string(),
979
979
  text: import_v43.z.string().optional()
980
- }).passthrough()
980
+ }).catchall(import_v43.z.any())
981
981
  ).optional()
982
- }).passthrough()
983
- });
982
+ }).catchall(import_v43.z.any())
983
+ }).catchall(import_v43.z.any());
984
984
  var OpenRouterProviderMetadataSchema = import_v43.z.object({
985
985
  provider: import_v43.z.string(),
986
986
  reasoning_details: import_v43.z.array(ReasoningDetailUnionSchema).optional(),
@@ -989,18 +989,18 @@ var OpenRouterProviderMetadataSchema = import_v43.z.object({
989
989
  promptTokens: import_v43.z.number(),
990
990
  promptTokensDetails: import_v43.z.object({
991
991
  cachedTokens: import_v43.z.number()
992
- }).passthrough().optional(),
992
+ }).catchall(import_v43.z.any()).optional(),
993
993
  completionTokens: import_v43.z.number(),
994
994
  completionTokensDetails: import_v43.z.object({
995
995
  reasoningTokens: import_v43.z.number()
996
- }).passthrough().optional(),
996
+ }).catchall(import_v43.z.any()).optional(),
997
997
  totalTokens: import_v43.z.number(),
998
998
  cost: import_v43.z.number().optional(),
999
999
  costDetails: import_v43.z.object({
1000
1000
  upstreamInferenceCost: import_v43.z.number()
1001
- }).passthrough().optional()
1002
- }).passthrough()
1003
- }).passthrough();
1001
+ }).catchall(import_v43.z.any()).optional()
1002
+ }).catchall(import_v43.z.any())
1003
+ }).catchall(import_v43.z.any());
1004
1004
  var OpenRouterProviderOptionsSchema = import_v43.z.object({
1005
1005
  openrouter: import_v43.z.object({
1006
1006
  reasoning_details: import_v43.z.array(ReasoningDetailUnionSchema).optional(),
@@ -1918,6 +1918,7 @@ var OpenRouterChatLanguageModel = class {
1918
1918
  };
1919
1919
  const openrouterUsage = {};
1920
1920
  const accumulatedReasoningDetails = [];
1921
+ const accumulatedFileAnnotations = [];
1921
1922
  let textStarted = false;
1922
1923
  let reasoningStarted = false;
1923
1924
  let textId;
@@ -2096,6 +2097,13 @@ var OpenRouterChatLanguageModel = class {
2096
2097
  }
2097
2098
  }
2098
2099
  });
2100
+ } else if (annotation.type === "file") {
2101
+ const file = annotation.file;
2102
+ if (file && typeof file === "object" && "hash" in file && "name" in file) {
2103
+ accumulatedFileAnnotations.push(
2104
+ annotation
2105
+ );
2106
+ }
2099
2107
  }
2100
2108
  }
2101
2109
  }
@@ -2271,6 +2279,9 @@ var OpenRouterChatLanguageModel = class {
2271
2279
  if (accumulatedReasoningDetails.length > 0) {
2272
2280
  openrouterMetadata.reasoning_details = accumulatedReasoningDetails;
2273
2281
  }
2282
+ if (accumulatedFileAnnotations.length > 0) {
2283
+ openrouterMetadata.annotations = accumulatedFileAnnotations;
2284
+ }
2274
2285
  controller.enqueue({
2275
2286
  type: "finish",
2276
2287
  finishReason,