@openrouter/ai-sdk-provider 1.5.2 → 1.5.4

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
@@ -988,10 +988,10 @@ var FileAnnotationSchema = z3.object({
988
988
  z3.object({
989
989
  type: z3.string(),
990
990
  text: z3.string().optional()
991
- }).passthrough()
991
+ }).catchall(z3.any())
992
992
  ).optional()
993
- }).passthrough()
994
- });
993
+ }).catchall(z3.any())
994
+ }).catchall(z3.any());
995
995
  var OpenRouterProviderMetadataSchema = z3.object({
996
996
  provider: z3.string(),
997
997
  reasoning_details: z3.array(ReasoningDetailUnionSchema).optional(),
@@ -1000,18 +1000,18 @@ var OpenRouterProviderMetadataSchema = z3.object({
1000
1000
  promptTokens: z3.number(),
1001
1001
  promptTokensDetails: z3.object({
1002
1002
  cachedTokens: z3.number()
1003
- }).passthrough().optional(),
1003
+ }).catchall(z3.any()).optional(),
1004
1004
  completionTokens: z3.number(),
1005
1005
  completionTokensDetails: z3.object({
1006
1006
  reasoningTokens: z3.number()
1007
- }).passthrough().optional(),
1007
+ }).catchall(z3.any()).optional(),
1008
1008
  totalTokens: z3.number(),
1009
1009
  cost: z3.number().optional(),
1010
1010
  costDetails: z3.object({
1011
1011
  upstreamInferenceCost: z3.number()
1012
- }).passthrough().optional()
1013
- }).passthrough()
1014
- }).passthrough();
1012
+ }).catchall(z3.any()).optional()
1013
+ }).catchall(z3.any())
1014
+ }).catchall(z3.any());
1015
1015
  var OpenRouterProviderOptionsSchema = z3.object({
1016
1016
  openrouter: z3.object({
1017
1017
  reasoning_details: z3.array(ReasoningDetailUnionSchema).optional(),
@@ -1929,6 +1929,7 @@ var OpenRouterChatLanguageModel = class {
1929
1929
  };
1930
1930
  const openrouterUsage = {};
1931
1931
  const accumulatedReasoningDetails = [];
1932
+ const accumulatedFileAnnotations = [];
1932
1933
  let textStarted = false;
1933
1934
  let reasoningStarted = false;
1934
1935
  let textId;
@@ -2107,6 +2108,13 @@ var OpenRouterChatLanguageModel = class {
2107
2108
  }
2108
2109
  }
2109
2110
  });
2111
+ } else if (annotation.type === "file") {
2112
+ const file = annotation.file;
2113
+ if (file && typeof file === "object" && "hash" in file && "name" in file) {
2114
+ accumulatedFileAnnotations.push(
2115
+ annotation
2116
+ );
2117
+ }
2110
2118
  }
2111
2119
  }
2112
2120
  }
@@ -2282,6 +2290,9 @@ var OpenRouterChatLanguageModel = class {
2282
2290
  if (accumulatedReasoningDetails.length > 0) {
2283
2291
  openrouterMetadata.reasoning_details = accumulatedReasoningDetails;
2284
2292
  }
2293
+ if (accumulatedFileAnnotations.length > 0) {
2294
+ openrouterMetadata.annotations = accumulatedFileAnnotations;
2295
+ }
2285
2296
  controller.enqueue({
2286
2297
  type: "finish",
2287
2298
  finishReason,
@@ -2833,7 +2844,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
2833
2844
  }
2834
2845
 
2835
2846
  // src/version.ts
2836
- var VERSION = false ? "0.0.0-test" : "1.5.2";
2847
+ var VERSION = false ? "0.0.0-test" : "1.5.4";
2837
2848
 
2838
2849
  // src/provider.ts
2839
2850
  function createOpenRouter(options = {}) {
@@ -2901,30 +2912,9 @@ var openrouter = createOpenRouter({
2901
2912
  compatibility: "strict"
2902
2913
  // strict for OpenRouter API
2903
2914
  });
2904
-
2905
- // src/toon/index.ts
2906
- async function getToonModule() {
2907
- try {
2908
- return await import("@toon-format/toon");
2909
- } catch (e) {
2910
- throw new Error(
2911
- "The @toon-format/toon package is required for TOON encoding/decoding. Install it with: npm install @toon-format/toon"
2912
- );
2913
- }
2914
- }
2915
- async function encodeToon(value, options) {
2916
- const toon = await getToonModule();
2917
- return toon.encode(value, options);
2918
- }
2919
- async function decodeToon(input, options) {
2920
- const toon = await getToonModule();
2921
- return toon.decode(input, options);
2922
- }
2923
2915
  export {
2924
2916
  OpenRouter,
2925
2917
  createOpenRouter,
2926
- decodeToon,
2927
- encodeToon,
2928
2918
  openrouter
2929
2919
  };
2930
2920
  //# sourceMappingURL=index.mjs.map