braintrust 3.32.0 → 3.33.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 (60) hide show
  1. package/README.md +0 -43
  2. package/dev/dist/index.d.mts +31 -0
  3. package/dev/dist/index.d.ts +31 -0
  4. package/dev/dist/index.js +2275 -920
  5. package/dev/dist/index.mjs +1610 -255
  6. package/dist/apply-auto-instrumentation.js +263 -224
  7. package/dist/apply-auto-instrumentation.mjs +45 -6
  8. package/dist/auto-instrumentations/bundler/esbuild.cjs +78 -5
  9. package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
  10. package/dist/auto-instrumentations/bundler/next.cjs +78 -5
  11. package/dist/auto-instrumentations/bundler/next.mjs +3 -3
  12. package/dist/auto-instrumentations/bundler/rollup.cjs +78 -5
  13. package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
  14. package/dist/auto-instrumentations/bundler/vite.cjs +78 -5
  15. package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
  16. package/dist/auto-instrumentations/bundler/webpack-loader.cjs +78 -5
  17. package/dist/auto-instrumentations/bundler/webpack.cjs +78 -5
  18. package/dist/auto-instrumentations/bundler/webpack.mjs +3 -3
  19. package/dist/auto-instrumentations/{chunk-AFND2U7E.mjs → chunk-T2DMPWFI.mjs} +75 -5
  20. package/dist/auto-instrumentations/{chunk-RI4Y55ZF.mjs → chunk-UHJ2DNYJ.mjs} +6 -1
  21. package/dist/auto-instrumentations/{chunk-QEEPRBIS.mjs → chunk-W5QNG3PV.mjs} +1 -1
  22. package/dist/auto-instrumentations/hook.mjs +86 -7
  23. package/dist/auto-instrumentations/index.cjs +76 -5
  24. package/dist/auto-instrumentations/index.d.mts +3 -1
  25. package/dist/auto-instrumentations/index.d.ts +3 -1
  26. package/dist/auto-instrumentations/index.mjs +3 -1
  27. package/dist/browser.d.mts +202 -342
  28. package/dist/browser.d.ts +202 -342
  29. package/dist/browser.js +2586 -623
  30. package/dist/browser.mjs +2586 -623
  31. package/dist/chunk-7P6ASYW6.mjs +9 -0
  32. package/dist/{chunk-BTRLPQG5.js → chunk-AXJTOUOC.js} +2250 -1172
  33. package/dist/{chunk-AW4QECG5.js → chunk-G3VHOHRC.js} +40 -9
  34. package/dist/chunk-MLKGABMK.js +9 -0
  35. package/dist/{chunk-4QSAHP7D.mjs → chunk-MZLBAFVJ.mjs} +1236 -158
  36. package/dist/{chunk-WV6QZI2W.mjs → chunk-TZVZN2JJ.mjs} +39 -8
  37. package/dist/cli.js +1695 -293
  38. package/dist/custom-views.d.mts +112 -0
  39. package/dist/custom-views.d.ts +112 -0
  40. package/dist/custom-views.js +13 -0
  41. package/dist/custom-views.mjs +13 -0
  42. package/dist/edge-light.d.mts +1 -1
  43. package/dist/edge-light.d.ts +1 -1
  44. package/dist/edge-light.js +2586 -623
  45. package/dist/edge-light.mjs +2586 -623
  46. package/dist/index.d.mts +202 -342
  47. package/dist/index.d.ts +202 -342
  48. package/dist/index.js +1842 -986
  49. package/dist/index.mjs +1310 -454
  50. package/dist/instrumentation/index.d.mts +5 -245
  51. package/dist/instrumentation/index.d.ts +5 -245
  52. package/dist/instrumentation/index.js +1694 -254
  53. package/dist/instrumentation/index.mjs +1694 -254
  54. package/dist/vitest-evals-reporter.js +17 -16
  55. package/dist/vitest-evals-reporter.mjs +3 -2
  56. package/dist/workerd.d.mts +1 -1
  57. package/dist/workerd.d.ts +1 -1
  58. package/dist/workerd.js +2586 -623
  59. package/dist/workerd.mjs +2586 -623
  60. package/package.json +10 -2
package/README.md CHANGED
@@ -104,49 +104,6 @@ If you use TypeScript or other transpilation plugins, place the Braintrust plugi
104
104
 
105
105
  For deeper details, see the [auto-instrumentation architecture docs](src/auto-instrumentations/README.md).
106
106
 
107
- ### LangSmith tracing
108
-
109
- Braintrust supports LangSmith `>=0.3.30 <1.0.0`. LangSmith tracing remains authoritative: LangSmith must be enabled, and it continues exporting traces to LangSmith while Braintrust mirrors the same run lifecycle. This integration covers tracing only; LangSmith eval, Jest, and Vitest APIs are not instrumented.
110
-
111
- For automatic Node.js instrumentation, use the standard hook before importing LangSmith:
112
-
113
- ```bash
114
- node --import braintrust/hook.mjs app.js
115
- ```
116
-
117
- The Vite, Webpack, esbuild, and Rollup plugins shown above apply the same automatic instrumentation in bundled applications. To instrument explicit namespaces instead, wrap the three LangSmith entrypoints you use:
118
-
119
- ```typescript
120
- import {
121
- wrapLangSmithClient,
122
- wrapLangSmithRunTrees,
123
- wrapLangSmithTraceable,
124
- } from "braintrust";
125
- import * as clientNamespace from "langsmith/client";
126
- import * as runTreesNamespace from "langsmith/run_trees";
127
- import * as traceableNamespace from "langsmith/traceable";
128
-
129
- const { Client } = wrapLangSmithClient(clientNamespace);
130
- const { RunTree } = wrapLangSmithRunTrees(runTreesNamespace);
131
- const { traceable } = wrapLangSmithTraceable(traceableNamespace);
132
- ```
133
-
134
- The wrappers are composable and idempotent. They preserve LangSmith behavior, including its network export and `on_end` callbacks. Automatic and explicit instrumentation can safely be used together.
135
-
136
- Disable LangSmith instrumentation in code or through the environment:
137
-
138
- ```typescript
139
- import { configureInstrumentation } from "braintrust";
140
-
141
- configureInstrumentation({ integrations: { langsmith: false } });
142
- ```
143
-
144
- ```bash
145
- BRAINTRUST_DISABLE_INSTRUMENTATION=langsmith node --import braintrust/hook.mjs app.js
146
- ```
147
-
148
- When Braintrust LangChain/LangGraph instrumentation is enabled, LangSmith runs serialized by LangChain are ignored to avoid duplicate spans. Set `langchain: false` (and use LangSmith instrumentation) when LangSmith should be the source for those runs instead.
149
-
150
107
  ## Migration Guides
151
108
 
152
109
  ### Upgrading from 2.x to 3.x
@@ -14447,6 +14447,34 @@ interface DatasetSummary {
14447
14447
  dataSummary: DataSummary | undefined;
14448
14448
  }
14449
14449
 
14450
+ /** Inclusive span duration bounds, in seconds. */
14451
+ interface SpanDurationFilter {
14452
+ /** Minimum value of metrics.end - metrics.start. */
14453
+ min?: number;
14454
+ /** Maximum value of metrics.end - metrics.start. */
14455
+ max?: number;
14456
+ }
14457
+ /**
14458
+ * Filters supported by Trace.getSpans(). Different fields combine with AND.
14459
+ *
14460
+ * Empty name/spanType arrays match no spans. Empty metadata/duration objects
14461
+ * add no constraints. Omit a field to leave it unfiltered.
14462
+ */
14463
+ interface SpanFilters {
14464
+ /** Match spans whose span_attributes.type equals any of these. */
14465
+ spanType?: string[];
14466
+ /** Match spans whose span_attributes.name equals any of these. */
14467
+ name?: string[];
14468
+ /** Match spans based on whether they recorded an error. */
14469
+ hasError?: boolean;
14470
+ /**
14471
+ * Match metadata keys at any depth without type coercion. `null` matches a
14472
+ * null or missing path.
14473
+ */
14474
+ metadata?: Record<string, unknown>;
14475
+ /** Bound how long the span took. */
14476
+ duration?: SpanDurationFilter;
14477
+ }
14450
14478
  /**
14451
14479
  * Span data returned by getSpans().
14452
14480
  */
@@ -14475,7 +14503,10 @@ interface GetThreadOptions {
14475
14503
  preprocessor?: string;
14476
14504
  }
14477
14505
  interface GetSpansOptions {
14506
+ /** Optional top-level span type filter. */
14478
14507
  spanType?: string[];
14508
+ /** Filters for span type, name, error state, metadata, and duration. */
14509
+ filters?: SpanFilters;
14479
14510
  includeScorers?: boolean;
14480
14511
  }
14481
14512
  /**
@@ -14447,6 +14447,34 @@ interface DatasetSummary {
14447
14447
  dataSummary: DataSummary | undefined;
14448
14448
  }
14449
14449
 
14450
+ /** Inclusive span duration bounds, in seconds. */
14451
+ interface SpanDurationFilter {
14452
+ /** Minimum value of metrics.end - metrics.start. */
14453
+ min?: number;
14454
+ /** Maximum value of metrics.end - metrics.start. */
14455
+ max?: number;
14456
+ }
14457
+ /**
14458
+ * Filters supported by Trace.getSpans(). Different fields combine with AND.
14459
+ *
14460
+ * Empty name/spanType arrays match no spans. Empty metadata/duration objects
14461
+ * add no constraints. Omit a field to leave it unfiltered.
14462
+ */
14463
+ interface SpanFilters {
14464
+ /** Match spans whose span_attributes.type equals any of these. */
14465
+ spanType?: string[];
14466
+ /** Match spans whose span_attributes.name equals any of these. */
14467
+ name?: string[];
14468
+ /** Match spans based on whether they recorded an error. */
14469
+ hasError?: boolean;
14470
+ /**
14471
+ * Match metadata keys at any depth without type coercion. `null` matches a
14472
+ * null or missing path.
14473
+ */
14474
+ metadata?: Record<string, unknown>;
14475
+ /** Bound how long the span took. */
14476
+ duration?: SpanDurationFilter;
14477
+ }
14450
14478
  /**
14451
14479
  * Span data returned by getSpans().
14452
14480
  */
@@ -14475,7 +14503,10 @@ interface GetThreadOptions {
14475
14503
  preprocessor?: string;
14476
14504
  }
14477
14505
  interface GetSpansOptions {
14506
+ /** Optional top-level span type filter. */
14478
14507
  spanType?: string[];
14508
+ /** Filters for span type, name, error state, metadata, and duration. */
14509
+ filters?: SpanFilters;
14479
14510
  includeScorers?: boolean;
14480
14511
  }
14481
14512
  /**