braintrust 3.13.0 → 3.15.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.
Files changed (50) hide show
  1. package/dev/dist/index.d.mts +6 -8
  2. package/dev/dist/index.d.ts +6 -8
  3. package/dev/dist/index.js +1399 -1466
  4. package/dev/dist/index.mjs +971 -1038
  5. package/dist/apply-auto-instrumentation.js +208 -188
  6. package/dist/apply-auto-instrumentation.mjs +40 -20
  7. package/dist/auto-instrumentations/bundler/esbuild.cjs +230 -40
  8. package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -1
  9. package/dist/auto-instrumentations/bundler/next.cjs +230 -40
  10. package/dist/auto-instrumentations/bundler/next.mjs +3 -2
  11. package/dist/auto-instrumentations/bundler/rollup.cjs +230 -40
  12. package/dist/auto-instrumentations/bundler/rollup.mjs +2 -1
  13. package/dist/auto-instrumentations/bundler/vite.cjs +230 -40
  14. package/dist/auto-instrumentations/bundler/vite.mjs +2 -1
  15. package/dist/auto-instrumentations/bundler/webpack-loader.cjs +13 -39
  16. package/dist/auto-instrumentations/bundler/webpack.cjs +230 -40
  17. package/dist/auto-instrumentations/bundler/webpack.mjs +3 -2
  18. package/dist/auto-instrumentations/{chunk-WFEUJACP.mjs → chunk-CNQ7BUKN.mjs} +1 -1
  19. package/dist/auto-instrumentations/chunk-J57YF7WS.mjs +208 -0
  20. package/dist/auto-instrumentations/chunk-QFMACSOL.mjs +280 -0
  21. package/dist/auto-instrumentations/{chunk-GJOO4ESL.mjs → chunk-VXJONZVX.mjs} +28 -40
  22. package/dist/auto-instrumentations/hook.mjs +7985 -46
  23. package/dist/auto-instrumentations/loader/cjs-patch.cjs +194 -4
  24. package/dist/auto-instrumentations/loader/cjs-patch.mjs +13 -27
  25. package/dist/auto-instrumentations/loader/esm-hook.mjs +24 -10
  26. package/dist/browser.d.mts +138 -26
  27. package/dist/browser.d.ts +138 -26
  28. package/dist/browser.js +898 -1063
  29. package/dist/browser.mjs +898 -1063
  30. package/dist/{chunk-75IQCUB2.mjs → chunk-O4ZIWXO3.mjs} +179 -25
  31. package/dist/{chunk-26JGOELH.js → chunk-VMBQETG3.js} +179 -25
  32. package/dist/cli.js +990 -1077
  33. package/dist/edge-light.d.mts +1 -1
  34. package/dist/edge-light.d.ts +1 -1
  35. package/dist/edge-light.js +898 -1063
  36. package/dist/edge-light.mjs +898 -1063
  37. package/dist/index.d.mts +138 -26
  38. package/dist/index.d.ts +138 -26
  39. package/dist/index.js +1690 -1825
  40. package/dist/index.mjs +918 -1053
  41. package/dist/instrumentation/index.d.mts +18 -9
  42. package/dist/instrumentation/index.d.ts +18 -9
  43. package/dist/instrumentation/index.js +711 -1038
  44. package/dist/instrumentation/index.mjs +710 -1038
  45. package/dist/workerd.d.mts +1 -1
  46. package/dist/workerd.d.ts +1 -1
  47. package/dist/workerd.js +898 -1063
  48. package/dist/workerd.mjs +898 -1063
  49. package/package.json +1 -7
  50. package/dist/auto-instrumentations/chunk-MWZXZQUO.mjs +0 -81
@@ -6137,6 +6137,7 @@ interface InstrumentationIntegrationsConfig {
6137
6137
  cursor?: boolean;
6138
6138
  cursorSDK?: boolean;
6139
6139
  flue?: boolean;
6140
+ mastra?: boolean;
6140
6141
  openAIAgents?: boolean;
6141
6142
  openrouter?: boolean;
6142
6143
  openrouterAgent?: boolean;
@@ -6737,17 +6738,15 @@ interface PromptKey {
6737
6738
  id?: string;
6738
6739
  }
6739
6740
  /**
6740
- * A two-layer cache for Braintrust prompts with both in-memory and filesystem storage.
6741
+ * A configurable cache for Braintrust prompts with optional in-memory and filesystem storage.
6741
6742
  *
6742
- * This cache implements either a one or two-layer caching strategy:
6743
- * 1. A fast in-memory LRU cache for frequently accessed prompts.
6744
- * 2. An optional persistent filesystem-based cache that serves as a backing store.
6743
+ * This cache can use either layer independently, both layers together, or no layers.
6745
6744
  */
6746
6745
  declare class PromptCache {
6747
- private readonly memoryCache;
6746
+ private readonly memoryCache?;
6748
6747
  private readonly diskCache?;
6749
6748
  constructor(options: {
6750
- memoryCache: LRUCache<string, Prompt>;
6749
+ memoryCache?: LRUCache<string, Prompt>;
6751
6750
  diskCache?: DiskCache<Prompt>;
6752
6751
  });
6753
6752
  /**
@@ -6774,10 +6773,10 @@ interface ParametersKey {
6774
6773
  id?: string;
6775
6774
  }
6776
6775
  declare class ParametersCache {
6777
- private readonly memoryCache;
6776
+ private readonly memoryCache?;
6778
6777
  private readonly diskCache?;
6779
6778
  constructor(options: {
6780
- memoryCache: LRUCache<string, RemoteEvalParameters>;
6779
+ memoryCache?: LRUCache<string, RemoteEvalParameters>;
6781
6780
  diskCache?: DiskCache<RemoteEvalParameters>;
6782
6781
  });
6783
6782
  get(key: ParametersKey): Promise<RemoteEvalParameters | undefined>;
@@ -8166,6 +8165,16 @@ declare class OpenAIAgentsTraceProcessor {
8166
8165
  private omitKeys;
8167
8166
  }
8168
8167
 
8168
+ type FlueObserver = (event: unknown, ctx?: unknown) => void;
8169
+ /**
8170
+ * Braintrust's Flue observe subscriber.
8171
+ *
8172
+ * Pass this directly to @flue/runtime/app.observe:
8173
+ *
8174
+ * const unsubscribe = observe(braintrustFlueObserver);
8175
+ */
8176
+ declare const braintrustFlueObserver: FlueObserver;
8177
+
8169
8178
  /**
8170
8179
  * Plugin registry and configuration for auto-instrumentation.
8171
8180
  *
@@ -8202,4 +8211,4 @@ declare class OpenAIAgentsTraceProcessor {
8202
8211
  */
8203
8212
  declare function configureInstrumentation(config: InstrumentationConfig): void;
8204
8213
 
8205
- export { type AsyncEndEvent, type AsyncStartEvent, type BaseContext, BasePlugin, BraintrustPlugin, type BraintrustPluginConfig, type ChannelHandlers, type EndEvent, type ErrorEvent, type InstrumentationConfig, OpenAIAgentsTraceProcessor, type OpenAIAgentsTraceProcessorOptions, type StartEvent, configureInstrumentation, createChannelName, isValidChannelName, parseChannelName };
8214
+ export { type AsyncEndEvent, type AsyncStartEvent, type BaseContext, BasePlugin, BraintrustPlugin, type BraintrustPluginConfig, type ChannelHandlers, type EndEvent, type ErrorEvent, type InstrumentationConfig, OpenAIAgentsTraceProcessor, type OpenAIAgentsTraceProcessorOptions, type StartEvent, braintrustFlueObserver, configureInstrumentation, createChannelName, isValidChannelName, parseChannelName };
@@ -6137,6 +6137,7 @@ interface InstrumentationIntegrationsConfig {
6137
6137
  cursor?: boolean;
6138
6138
  cursorSDK?: boolean;
6139
6139
  flue?: boolean;
6140
+ mastra?: boolean;
6140
6141
  openAIAgents?: boolean;
6141
6142
  openrouter?: boolean;
6142
6143
  openrouterAgent?: boolean;
@@ -6737,17 +6738,15 @@ interface PromptKey {
6737
6738
  id?: string;
6738
6739
  }
6739
6740
  /**
6740
- * A two-layer cache for Braintrust prompts with both in-memory and filesystem storage.
6741
+ * A configurable cache for Braintrust prompts with optional in-memory and filesystem storage.
6741
6742
  *
6742
- * This cache implements either a one or two-layer caching strategy:
6743
- * 1. A fast in-memory LRU cache for frequently accessed prompts.
6744
- * 2. An optional persistent filesystem-based cache that serves as a backing store.
6743
+ * This cache can use either layer independently, both layers together, or no layers.
6745
6744
  */
6746
6745
  declare class PromptCache {
6747
- private readonly memoryCache;
6746
+ private readonly memoryCache?;
6748
6747
  private readonly diskCache?;
6749
6748
  constructor(options: {
6750
- memoryCache: LRUCache<string, Prompt>;
6749
+ memoryCache?: LRUCache<string, Prompt>;
6751
6750
  diskCache?: DiskCache<Prompt>;
6752
6751
  });
6753
6752
  /**
@@ -6774,10 +6773,10 @@ interface ParametersKey {
6774
6773
  id?: string;
6775
6774
  }
6776
6775
  declare class ParametersCache {
6777
- private readonly memoryCache;
6776
+ private readonly memoryCache?;
6778
6777
  private readonly diskCache?;
6779
6778
  constructor(options: {
6780
- memoryCache: LRUCache<string, RemoteEvalParameters>;
6779
+ memoryCache?: LRUCache<string, RemoteEvalParameters>;
6781
6780
  diskCache?: DiskCache<RemoteEvalParameters>;
6782
6781
  });
6783
6782
  get(key: ParametersKey): Promise<RemoteEvalParameters | undefined>;
@@ -8166,6 +8165,16 @@ declare class OpenAIAgentsTraceProcessor {
8166
8165
  private omitKeys;
8167
8166
  }
8168
8167
 
8168
+ type FlueObserver = (event: unknown, ctx?: unknown) => void;
8169
+ /**
8170
+ * Braintrust's Flue observe subscriber.
8171
+ *
8172
+ * Pass this directly to @flue/runtime/app.observe:
8173
+ *
8174
+ * const unsubscribe = observe(braintrustFlueObserver);
8175
+ */
8176
+ declare const braintrustFlueObserver: FlueObserver;
8177
+
8169
8178
  /**
8170
8179
  * Plugin registry and configuration for auto-instrumentation.
8171
8180
  *
@@ -8202,4 +8211,4 @@ declare class OpenAIAgentsTraceProcessor {
8202
8211
  */
8203
8212
  declare function configureInstrumentation(config: InstrumentationConfig): void;
8204
8213
 
8205
- export { type AsyncEndEvent, type AsyncStartEvent, type BaseContext, BasePlugin, BraintrustPlugin, type BraintrustPluginConfig, type ChannelHandlers, type EndEvent, type ErrorEvent, type InstrumentationConfig, OpenAIAgentsTraceProcessor, type OpenAIAgentsTraceProcessorOptions, type StartEvent, configureInstrumentation, createChannelName, isValidChannelName, parseChannelName };
8214
+ export { type AsyncEndEvent, type AsyncStartEvent, type BaseContext, BasePlugin, BraintrustPlugin, type BraintrustPluginConfig, type ChannelHandlers, type EndEvent, type ErrorEvent, type InstrumentationConfig, OpenAIAgentsTraceProcessor, type OpenAIAgentsTraceProcessorOptions, type StartEvent, braintrustFlueObserver, configureInstrumentation, createChannelName, isValidChannelName, parseChannelName };