@mastra/observability 1.20.0-alpha.0 → 1.20.0

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.
@@ -1,4 +1,7 @@
1
+ import type { MastraModelGatewayInterface } from '@mastra/core/llm';
1
2
  import type { PricingModel } from './pricing-model.js';
3
+ /** The part of a model router gateway that pricing reads. */
4
+ type PricingGateway = Pick<MastraModelGatewayInterface, 'id' | 'getId' | 'fetchProviders'>;
2
5
  export declare class PricingRegistry {
3
6
  private readonly pricingModels;
4
7
  constructor(pricingModels: Map<string, PricingModel>);
@@ -17,4 +20,15 @@ export declare class PricingRegistry {
17
20
  }): PricingModel | null;
18
21
  private find;
19
22
  }
23
+ /**
24
+ * Where to find the model router gateways whose `pricing` fills the gaps in models.dev. Prices
25
+ * load on the first lookup that has no price, so production does not call gateways at startup;
26
+ * under the same switches as the models.dev refresh (`mastra dev`, or
27
+ * `MASTRA_AUTO_REFRESH_PRICING=true`) they also load right away, off the hot path, so the first
28
+ * model call is priced. Each gateway is read once; a failed read is retried at most once an hour.
29
+ */
30
+ export declare function setPricingGateways(source: () => Iterable<PricingGateway>): void;
31
+ /** Load `pricing` from every custom gateway not loaded yet. Off under `MASTRA_OFFLINE`. */
32
+ export declare function loadGatewayPricing(): Promise<void>;
33
+ export {};
20
34
  //# sourceMappingURL=pricing-registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pricing-registry.d.ts","sourceRoot":"","sources":["../../src/metrics/pricing-registry.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA+BpD,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,aAAa;IAA1C,YAA6B,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EAAI;IAEzE,2FAA2F;IAC3F,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAEpD;IAED;;;;;OAKG;IACH,MAAM,CAAC,SAAS,IAAI,eAAe,GAAG,IAAI,CAWzC;IAED,GAAG,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,YAAY,GAAG,IAAI,CAgBlE;IAED,OAAO,CAAC,IAAI;CASb"}
1
+ {"version":3,"file":"pricing-registry.d.ts","sourceRoot":"","sources":["../../src/metrics/pricing-registry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAGpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA0BpD,6DAA6D;AAC7D,KAAK,cAAc,GAAG,IAAI,CAAC,2BAA2B,EAAE,IAAI,GAAG,OAAO,GAAG,gBAAgB,CAAC,CAAC;AAc3F,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,aAAa;IAA1C,YAA6B,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EAAI;IAEzE,2FAA2F;IAC3F,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAEpD;IAED;;;;;OAKG;IACH,MAAM,CAAC,SAAS,IAAI,eAAe,GAAG,IAAI,CAWzC;IAED,GAAG,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,YAAY,GAAG,IAAI,CAqBlE;IAED,OAAO,CAAC,IAAI;CASb;AAYD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,QAAQ,CAAC,cAAc,CAAC,GAAG,IAAI,CAK/E;AAED,2FAA2F;AAC3F,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAoCxD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/observability",
3
- "version": "1.20.0-alpha.0",
3
+ "version": "1.20.0",
4
4
  "description": "Core observability package for Mastra - includes tracing and scoring features",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -32,11 +32,11 @@
32
32
  "typescript": "^7.0.2",
33
33
  "vitest": "4.1.11",
34
34
  "zod": "^4.6.4",
35
- "@internal/types-builder": "0.0.117",
36
- "@internal/ai-sdk-v5": "0.0.89",
37
- "@internal/ai-sdk-v4": "0.0.89",
38
- "@internal/lint": "0.0.142",
39
- "@mastra/core": "1.77.0-alpha.1"
35
+ "@internal/ai-sdk-v4": "0.0.90",
36
+ "@internal/ai-sdk-v5": "0.0.90",
37
+ "@internal/types-builder": "0.0.118",
38
+ "@internal/lint": "0.0.143",
39
+ "@mastra/core": "1.77.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@mastra/core": ">=1.16.0-0 <2.0.0-0",