braintrust 3.28.0 → 3.30.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 (54) hide show
  1. package/README.md +1 -1
  2. package/dev/dist/index.d.mts +356 -7
  3. package/dev/dist/index.d.ts +356 -7
  4. package/dev/dist/index.js +2679 -1828
  5. package/dev/dist/index.mjs +1862 -1011
  6. package/dist/apply-auto-instrumentation.js +298 -265
  7. package/dist/apply-auto-instrumentation.mjs +85 -52
  8. package/dist/auto-instrumentations/bundler/esbuild.cjs +56 -6
  9. package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
  10. package/dist/auto-instrumentations/bundler/next.cjs +56 -6
  11. package/dist/auto-instrumentations/bundler/next.mjs +3 -3
  12. package/dist/auto-instrumentations/bundler/rollup.cjs +56 -6
  13. package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
  14. package/dist/auto-instrumentations/bundler/vite.cjs +56 -6
  15. package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
  16. package/dist/auto-instrumentations/bundler/webpack-loader.cjs +56 -6
  17. package/dist/auto-instrumentations/bundler/webpack.cjs +56 -6
  18. package/dist/auto-instrumentations/bundler/webpack.mjs +3 -3
  19. package/dist/auto-instrumentations/{chunk-26PKVUKB.mjs → chunk-LW4HDHXT.mjs} +12 -4
  20. package/dist/auto-instrumentations/{chunk-HD35AM3M.mjs → chunk-OXINGIEZ.mjs} +1 -1
  21. package/dist/auto-instrumentations/{chunk-NP7V4XB2.mjs → chunk-U64OYU4Q.mjs} +45 -3
  22. package/dist/auto-instrumentations/hook.mjs +967 -136
  23. package/dist/auto-instrumentations/index.cjs +45 -3
  24. package/dist/auto-instrumentations/index.mjs +1 -1
  25. package/dist/browser.d.mts +893 -24
  26. package/dist/browser.d.ts +893 -24
  27. package/dist/browser.js +2795 -1136
  28. package/dist/browser.mjs +2795 -1136
  29. package/dist/{chunk-BBE7SNRV.js → chunk-2XDW3UCG.js} +155 -23
  30. package/dist/{chunk-UPFNQCGB.mjs → chunk-BU6SM54N.mjs} +1830 -1045
  31. package/dist/{chunk-ZHUHZWFY.mjs → chunk-N3JKQ3D3.mjs} +152 -20
  32. package/dist/{chunk-OBBWQW6K.js → chunk-TWCDSYJN.js} +2890 -2105
  33. package/dist/cli.js +5976 -1348
  34. package/dist/edge-light.d.mts +1 -1
  35. package/dist/edge-light.d.ts +1 -1
  36. package/dist/edge-light.js +2795 -1136
  37. package/dist/edge-light.mjs +2795 -1136
  38. package/dist/index.d.mts +893 -24
  39. package/dist/index.d.ts +893 -24
  40. package/dist/index.js +1448 -699
  41. package/dist/index.mjs +848 -99
  42. package/dist/instrumentation/index.d.mts +563 -9
  43. package/dist/instrumentation/index.d.ts +563 -9
  44. package/dist/instrumentation/index.js +2794 -989
  45. package/dist/instrumentation/index.mjs +2794 -989
  46. package/dist/vitest-evals-reporter.js +16 -16
  47. package/dist/vitest-evals-reporter.mjs +2 -2
  48. package/dist/workerd.d.mts +1 -1
  49. package/dist/workerd.d.ts +1 -1
  50. package/dist/workerd.js +2795 -1136
  51. package/dist/workerd.mjs +2795 -1136
  52. package/package.json +1 -1
  53. package/util/dist/index.d.mts +42 -0
  54. package/util/dist/index.d.ts +42 -0
@@ -12,6 +12,7 @@ import {
12
12
  cloudflareThinkChannels,
13
13
  cohereChannels,
14
14
  cursorSDKChannels,
15
+ debugLogger,
15
16
  flueChannels,
16
17
  genkitChannels,
17
18
  genkitCoreChannels,
@@ -39,9 +40,9 @@ import {
39
40
  smithyCoreChannels,
40
41
  strandsAgentSDKChannels,
41
42
  voyageAIChannels
42
- } from "./chunk-ZHUHZWFY.mjs";
43
+ } from "./chunk-N3JKQ3D3.mjs";
43
44
 
44
- // src/node/apply-auto-instrumentation-entry.ts
45
+ // src/node/apply-auto-instrumentation.ts
45
46
  import { register } from "node:module";
46
47
  import { pathToFileURL } from "node:url";
47
48
 
@@ -94,6 +95,33 @@ var aiSDKConfigs = [
94
95
  kind: "Async"
95
96
  }
96
97
  },
98
+ // generateImage - stable in v6+, experimental alias in v5
99
+ ...[
100
+ {
101
+ functionName: "generateImage",
102
+ versionRange: ">=6.0.0 <8.0.0",
103
+ isExportAlias: false
104
+ },
105
+ {
106
+ functionName: "experimental_generateImage",
107
+ versionRange: ">=5.0.0 <6.0.0",
108
+ isExportAlias: true
109
+ }
110
+ ].flatMap(
111
+ ({ functionName, versionRange: versionRange2, isExportAlias }) => ["dist/index.mjs", "dist/index.js"].map((filePath) => ({
112
+ channelName: aiSDKChannels.generateImage.channelName,
113
+ module: {
114
+ name: "ai",
115
+ versionRange: versionRange2,
116
+ filePath
117
+ },
118
+ functionQuery: {
119
+ functionName,
120
+ kind: "Async",
121
+ ...isExportAlias ? { isExportAlias } : {}
122
+ }
123
+ }))
124
+ ),
97
125
  // streamText - async function (v3 only, before the sync refactor in v4)
98
126
  {
99
127
  channelName: aiSDKChannels.streamText.channelName,
@@ -2661,7 +2689,7 @@ var openRouterAgentConfigs = [
2661
2689
  ];
2662
2690
 
2663
2691
  // src/auto-instrumentations/configs/pi-coding-agent.ts
2664
- var piCodingAgentVersionRange = ">=0.79.0 <0.82.0";
2692
+ var piCodingAgentVersionRange = ">=0.79.0 <1.0.0";
2665
2693
  var piCodingAgentConfigs = [
2666
2694
  {
2667
2695
  channelName: piCodingAgentChannels.prompt.channelName,
@@ -2876,8 +2904,9 @@ function getDefaultInstrumentationConfigs({
2876
2904
  ...additionalInstrumentations ?? []
2877
2905
  ];
2878
2906
  }
2879
- function getDefaultAutoInstrumentationConfigs() {
2907
+ function getDefaultAutoInstrumentationConfigs(additionalInstrumentations) {
2880
2908
  return getDefaultInstrumentationConfigs({
2909
+ additionalInstrumentations,
2881
2910
  disabledIntegrationConfig: readDisabledInstrumentationEnvConfig(
2882
2911
  process.env.BRAINTRUST_DISABLE_INSTRUMENTATION
2883
2912
  ).integrations
@@ -2905,11 +2934,11 @@ function formatChannelGetter(channelName) {
2905
2934
  return `tr_ch_bt$get_${channelName.replace(CHANNEL_REGEX, "_")}`;
2906
2935
  }
2907
2936
  var transforms = {
2908
- tracingHookDeclaration(state2, node) {
2937
+ tracingHookDeclaration(state, node) {
2909
2938
  const {
2910
2939
  channelName,
2911
2940
  module: { name }
2912
- } = state2;
2941
+ } = state;
2913
2942
  const channelVariable = formatChannelVariable(channelName);
2914
2943
  const channelGetter = formatChannelGetter(channelName);
2915
2944
  const hasSharedHookLookup = node.body.some(
@@ -2971,23 +3000,23 @@ var transforms = {
2971
3000
  tracePromise: traceAny,
2972
3001
  traceSync: traceAny
2973
3002
  };
2974
- function traceAny(state2, node, _parent, ancestry) {
3003
+ function traceAny(state, node, _parent, ancestry) {
2975
3004
  const program = ancestry[ancestry.length - 1];
2976
3005
  if (node.type === "ClassDeclaration" || node.type === "ClassExpression") {
2977
- traceInstanceMethod(state2, node, program);
3006
+ traceInstanceMethod(state, node, program);
2978
3007
  } else {
2979
- traceFunction(state2, node, program);
3008
+ traceFunction(state, node, program);
2980
3009
  }
2981
3010
  }
2982
- function traceFunction(state2, node, program) {
2983
- transforms.tracingHookDeclaration(state2, program, null, []);
2984
- const { functionQuery } = state2;
3011
+ function traceFunction(state, node, program) {
3012
+ transforms.tracingHookDeclaration(state, program, null, []);
3013
+ const { functionQuery } = state;
2985
3014
  const methodName = "methodName" in functionQuery ? functionQuery.methodName : void 0;
2986
3015
  const privateMethodName = "privateMethodName" in functionQuery ? functionQuery.privateMethodName : void 0;
2987
3016
  const functionName = "functionName" in functionQuery ? functionQuery.functionName : void 0;
2988
3017
  const isConstructor = methodName === "constructor" || !methodName && !privateMethodName && !functionName;
2989
3018
  const type = isConstructor ? "ArrowFunctionExpression" : "FunctionExpression";
2990
- node.body = wrap(state2, {
3019
+ node.body = wrap(state, {
2991
3020
  type,
2992
3021
  params: node.params,
2993
3022
  body: node.body,
@@ -2999,8 +3028,8 @@ function traceFunction(state2, node, program) {
2999
3028
  node.async = false;
3000
3029
  wrapSuper(node);
3001
3030
  }
3002
- function traceInstanceMethod(state2, node, program) {
3003
- const { functionQuery, operator } = state2;
3031
+ function traceInstanceMethod(state, node, program) {
3032
+ const { functionQuery, operator } = state;
3004
3033
  const { methodName } = functionQuery;
3005
3034
  if (!methodName) {
3006
3035
  return;
@@ -3010,7 +3039,7 @@ function traceInstanceMethod(state2, node, program) {
3010
3039
  return;
3011
3040
  }
3012
3041
  let ctor = classBody.body.find(({ kind }) => kind === "constructor");
3013
- transforms.tracingHookDeclaration(state2, program, null, []);
3042
+ transforms.tracingHookDeclaration(state, program, null, []);
3014
3043
  if (!ctor) {
3015
3044
  ctor = parse(
3016
3045
  node.superClass ? "class A extends Object { constructor (...args) { super(...args) } }" : "class A { constructor () {} }"
@@ -3023,15 +3052,15 @@ function traceInstanceMethod(state2, node, program) {
3023
3052
  `).body;
3024
3053
  const fn = ctorBody[1].expression.right;
3025
3054
  fn.async = operator === "tracePromise";
3026
- fn.body = wrap(state2, {
3055
+ fn.body = wrap(state, {
3027
3056
  type: "Identifier",
3028
3057
  name: `__bt$${methodName}`
3029
3058
  });
3030
3059
  wrapSuper(fn);
3031
3060
  ctor.value.body.body.push(...ctorBody);
3032
3061
  }
3033
- function wrap(state2, node) {
3034
- const wrapper = wrapInvocation(state2);
3062
+ function wrap(state, node) {
3063
+ const wrapper = wrapInvocation(state);
3035
3064
  const block = wrapper.body[0].body;
3036
3065
  const common = parse(
3037
3066
  node.type === "ArrowFunctionExpression" ? `
@@ -3084,8 +3113,8 @@ function wrapSuper(node) {
3084
3113
  node.body.body.unshift(parse("const __bt$super = {}").body[0]);
3085
3114
  }
3086
3115
  }
3087
- function wrapInvocation(state2) {
3088
- const { channelName, moduleVersion, operator, functionQuery } = state2;
3116
+ function wrapInvocation(state) {
3117
+ const { channelName, moduleVersion, operator, functionQuery } = state;
3089
3118
  const channelGetter = formatChannelGetter(channelName);
3090
3119
  const callbackIndex = functionQuery.callbackIndex ?? -1;
3091
3120
  return parse(`
@@ -3153,7 +3182,7 @@ var Transformer = class {
3153
3182
  aliases
3154
3183
  );
3155
3184
  const query = astQuery || this.fromFunctionQuery(resolvedFunctionQuery);
3156
- const state2 = {
3185
+ const state = {
3157
3186
  ...config,
3158
3187
  moduleVersion: this.version,
3159
3188
  functionQuery: resolvedFunctionQuery,
@@ -3161,7 +3190,7 @@ var Transformer = class {
3161
3190
  };
3162
3191
  esquery2.traverse(ast, esquery2.parse(query), (...args) => {
3163
3192
  injectionCount++;
3164
- this.visit(state2, ...args);
3193
+ this.visit(state, ...args);
3165
3194
  });
3166
3195
  }
3167
3196
  if (injectionCount === 0 && this.configs.length > 0) {
@@ -3191,21 +3220,21 @@ var Transformer = class {
3191
3220
  }
3192
3221
  free() {
3193
3222
  }
3194
- visit(state2, ...args) {
3195
- const transform = transforms[state2.operator];
3196
- const { index = 0 } = state2.functionQuery;
3223
+ visit(state, ...args) {
3224
+ const transform = transforms[state.operator];
3225
+ const { index = 0 } = state.functionQuery;
3197
3226
  const [node] = args;
3198
3227
  const type = node.init?.type || node.type;
3199
3228
  if (type !== "ClassDeclaration" && type !== "ClassExpression") {
3200
3229
  if (node.type === "VariableDeclarator") {
3201
3230
  return;
3202
3231
  }
3203
- state2.functionIndex = state2.functionIndex === void 0 ? 0 : state2.functionIndex + 1;
3204
- if (index !== null && index !== state2.functionIndex) {
3232
+ state.functionIndex = state.functionIndex === void 0 ? 0 : state.functionIndex + 1;
3233
+ if (index !== null && index !== state.functionIndex) {
3205
3234
  return;
3206
3235
  }
3207
3236
  }
3208
- transform(state2, ...args);
3237
+ transform(state, ...args);
3209
3238
  }
3210
3239
  getOperator(kind) {
3211
3240
  switch (kind) {
@@ -3517,26 +3546,27 @@ function resolveModulePrototype() {
3517
3546
  return NodeModule.prototype;
3518
3547
  }
3519
3548
 
3520
- // src/node/apply-auto-instrumentation-entry.ts
3549
+ // src/node/apply-auto-instrumentation.ts
3521
3550
  var stateKey = /* @__PURE__ */ Symbol.for(
3522
3551
  `braintrust.applyAutoInstrumentation.global-hooks.v${GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION}`
3523
3552
  );
3524
- var existingState = Object.getOwnPropertyDescriptor(
3525
- globalThis,
3526
- stateKey
3527
- )?.value;
3528
- var state = isApplyAutoInstrumentationState(
3529
- existingState
3530
- ) ? existingState : {};
3531
- if (state !== existingState) {
3532
- Object.defineProperty(globalThis, stateKey, {
3533
- configurable: false,
3534
- enumerable: false,
3535
- value: state,
3536
- writable: false
3537
- });
3538
- }
3539
- if (!state.applied) {
3553
+ function applyAutoInstrumentation() {
3554
+ const existingState = Object.getOwnPropertyDescriptor(
3555
+ globalThis,
3556
+ stateKey
3557
+ )?.value;
3558
+ const state = typeof existingState === "object" && existingState !== null ? existingState : {};
3559
+ if (state !== existingState) {
3560
+ Object.defineProperty(globalThis, stateKey, {
3561
+ configurable: false,
3562
+ enumerable: false,
3563
+ value: state,
3564
+ writable: false
3565
+ });
3566
+ }
3567
+ if (state.applied) {
3568
+ return;
3569
+ }
3540
3570
  const allConfigs = getDefaultAutoInstrumentationConfigs();
3541
3571
  const currentModuleUrl = getCurrentModuleUrl();
3542
3572
  register("./auto-instrumentations/loader/esm-hook.mjs", {
@@ -3545,14 +3575,14 @@ if (!state.applied) {
3545
3575
  });
3546
3576
  state.applied = true;
3547
3577
  try {
3548
- const patch = new ModulePatch({ instrumentations: allConfigs });
3549
- patch.patch();
3550
- } catch {
3578
+ new ModulePatch({ instrumentations: allConfigs }).patch();
3579
+ } catch (error) {
3580
+ debugLogger.warn(
3581
+ "Failed to enable CommonJS auto-instrumentation; ESM instrumentation remains active:",
3582
+ error
3583
+ );
3551
3584
  }
3552
3585
  }
3553
- function isApplyAutoInstrumentationState(value) {
3554
- return typeof value === "object" && value !== null;
3555
- }
3556
3586
  function getCurrentModuleUrl() {
3557
3587
  if (typeof __filename !== "undefined") {
3558
3588
  return pathToFileURL(__filename).href;
@@ -3564,3 +3594,6 @@ function getCurrentModuleUrl() {
3564
3594
  }
3565
3595
  return pathToFileURL(process.argv[1] ?? process.cwd()).href;
3566
3596
  }
3597
+
3598
+ // src/node/apply-auto-instrumentation-entry.ts
3599
+ applyAutoInstrumentation();
@@ -1244,8 +1244,6 @@ function isInstrumentationIntegrationDisabled(integrations, ...names) {
1244
1244
  var DefaultAsyncLocalStorage = class {
1245
1245
  constructor() {
1246
1246
  }
1247
- enterWith(_) {
1248
- }
1249
1247
  run(_, callback) {
1250
1248
  return callback();
1251
1249
  }
@@ -1353,6 +1351,7 @@ var INSTRUMENTATION_NAMES = {
1353
1351
  CLOUDFLARE_THINK: "cloudflare-think",
1354
1352
  COHERE: "cohere",
1355
1353
  CURSOR_SDK: "cursor-sdk",
1354
+ DEEPSEEK_HARNESS: "deepseek-harness",
1356
1355
  EVE: "eve",
1357
1356
  FLUE: "flue",
1358
1357
  GENKIT: "genkit",
@@ -1384,6 +1383,10 @@ var aiSDKChannels = defineChannels(
1384
1383
  channelName: "generateText",
1385
1384
  kind: "async"
1386
1385
  }),
1386
+ generateImage: channel({
1387
+ channelName: "generateImage",
1388
+ kind: "async"
1389
+ }),
1387
1390
  streamText: channel({
1388
1391
  channelName: "streamText",
1389
1392
  kind: "async"
@@ -1523,6 +1526,33 @@ var aiSDKConfigs = [
1523
1526
  kind: "Async"
1524
1527
  }
1525
1528
  },
1529
+ // generateImage - stable in v6+, experimental alias in v5
1530
+ ...[
1531
+ {
1532
+ functionName: "generateImage",
1533
+ versionRange: ">=6.0.0 <8.0.0",
1534
+ isExportAlias: false
1535
+ },
1536
+ {
1537
+ functionName: "experimental_generateImage",
1538
+ versionRange: ">=5.0.0 <6.0.0",
1539
+ isExportAlias: true
1540
+ }
1541
+ ].flatMap(
1542
+ ({ functionName, versionRange: versionRange2, isExportAlias }) => ["dist/index.mjs", "dist/index.js"].map((filePath) => ({
1543
+ channelName: aiSDKChannels.generateImage.channelName,
1544
+ module: {
1545
+ name: "ai",
1546
+ versionRange: versionRange2,
1547
+ filePath
1548
+ },
1549
+ functionQuery: {
1550
+ functionName,
1551
+ kind: "Async",
1552
+ ...isExportAlias ? { isExportAlias } : {}
1553
+ }
1554
+ }))
1555
+ ),
1526
1556
  // streamText - async function (v3 only, before the sync refactor in v4)
1527
1557
  {
1528
1558
  channelName: aiSDKChannels.streamText.channelName,
@@ -4250,6 +4280,18 @@ var openAIAgentsCoreConfigs = lifecycleMethods.flatMap(
4250
4280
  var openAIChannels = defineChannels(
4251
4281
  "openai",
4252
4282
  {
4283
+ filesCreateTraced: channel({
4284
+ channelName: "files.create-traced",
4285
+ kind: "async"
4286
+ }),
4287
+ batchesRetrieveTraced: channel({
4288
+ channelName: "batches.retrieve-traced",
4289
+ kind: "async"
4290
+ }),
4291
+ batchesCompleteTrace: channel({
4292
+ channelName: "batches.complete-trace",
4293
+ kind: "async"
4294
+ }),
4253
4295
  chatCompletionsCreate: channel({
4254
4296
  channelName: "chat.completions.create",
4255
4297
  kind: "async"
@@ -4683,7 +4725,7 @@ var piCodingAgentChannels = defineChannels(
4683
4725
  );
4684
4726
 
4685
4727
  // src/auto-instrumentations/configs/pi-coding-agent.ts
4686
- var piCodingAgentVersionRange = ">=0.79.0 <0.82.0";
4728
+ var piCodingAgentVersionRange = ">=0.79.0 <1.0.0";
4687
4729
  var piCodingAgentConfigs = [
4688
4730
  {
4689
4731
  channelName: piCodingAgentChannels.prompt.channelName,
@@ -4942,6 +4984,14 @@ function getDefaultInstrumentationConfigs({
4942
4984
  ...additionalInstrumentations ?? []
4943
4985
  ];
4944
4986
  }
4987
+ function getDefaultAutoInstrumentationConfigs(additionalInstrumentations) {
4988
+ return getDefaultInstrumentationConfigs({
4989
+ additionalInstrumentations,
4990
+ disabledIntegrationConfig: readDisabledInstrumentationEnvConfig(
4991
+ process.env.BRAINTRUST_DISABLE_INSTRUMENTATION
4992
+ ).integrations
4993
+ });
4994
+ }
4945
4995
 
4946
4996
  // src/auto-instrumentations/loader/mastra-observability-patch.ts
4947
4997
  var MASTRA_EXPORTER_FACTORY_GLOBAL = "__braintrustMastraExporterFactory";
@@ -5208,9 +5258,9 @@ function getModuleVersion(basedir) {
5208
5258
  }
5209
5259
  var unplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
5210
5260
  const browser = options.browser ?? options.useDiagnosticChannelCompatShim ?? false;
5211
- const allInstrumentations = getDefaultInstrumentationConfigs({
5212
- additionalInstrumentations: options.instrumentations
5213
- });
5261
+ const allInstrumentations = getDefaultAutoInstrumentationConfigs(
5262
+ options.instrumentations
5263
+ );
5214
5264
  const instrumentationMatcher = create(allInstrumentations);
5215
5265
  return {
5216
5266
  name: "code-transformer",
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unplugin
3
- } from "../chunk-26PKVUKB.mjs";
4
- import "../chunk-NP7V4XB2.mjs";
3
+ } from "../chunk-LW4HDHXT.mjs";
4
+ import "../chunk-U64OYU4Q.mjs";
5
5
  import "../chunk-I55G56ZL.mjs";
6
6
  import "../chunk-JPUFNW7X.mjs";
7
7
  import "../chunk-P5YLNB2A.mjs";
@@ -1245,8 +1245,6 @@ function isInstrumentationIntegrationDisabled(integrations, ...names) {
1245
1245
  var DefaultAsyncLocalStorage = class {
1246
1246
  constructor() {
1247
1247
  }
1248
- enterWith(_) {
1249
- }
1250
1248
  run(_, callback) {
1251
1249
  return callback();
1252
1250
  }
@@ -1354,6 +1352,7 @@ var INSTRUMENTATION_NAMES = {
1354
1352
  CLOUDFLARE_THINK: "cloudflare-think",
1355
1353
  COHERE: "cohere",
1356
1354
  CURSOR_SDK: "cursor-sdk",
1355
+ DEEPSEEK_HARNESS: "deepseek-harness",
1357
1356
  EVE: "eve",
1358
1357
  FLUE: "flue",
1359
1358
  GENKIT: "genkit",
@@ -1385,6 +1384,10 @@ var aiSDKChannels = defineChannels(
1385
1384
  channelName: "generateText",
1386
1385
  kind: "async"
1387
1386
  }),
1387
+ generateImage: channel({
1388
+ channelName: "generateImage",
1389
+ kind: "async"
1390
+ }),
1388
1391
  streamText: channel({
1389
1392
  channelName: "streamText",
1390
1393
  kind: "async"
@@ -1524,6 +1527,33 @@ var aiSDKConfigs = [
1524
1527
  kind: "Async"
1525
1528
  }
1526
1529
  },
1530
+ // generateImage - stable in v6+, experimental alias in v5
1531
+ ...[
1532
+ {
1533
+ functionName: "generateImage",
1534
+ versionRange: ">=6.0.0 <8.0.0",
1535
+ isExportAlias: false
1536
+ },
1537
+ {
1538
+ functionName: "experimental_generateImage",
1539
+ versionRange: ">=5.0.0 <6.0.0",
1540
+ isExportAlias: true
1541
+ }
1542
+ ].flatMap(
1543
+ ({ functionName, versionRange: versionRange2, isExportAlias }) => ["dist/index.mjs", "dist/index.js"].map((filePath) => ({
1544
+ channelName: aiSDKChannels.generateImage.channelName,
1545
+ module: {
1546
+ name: "ai",
1547
+ versionRange: versionRange2,
1548
+ filePath
1549
+ },
1550
+ functionQuery: {
1551
+ functionName,
1552
+ kind: "Async",
1553
+ ...isExportAlias ? { isExportAlias } : {}
1554
+ }
1555
+ }))
1556
+ ),
1527
1557
  // streamText - async function (v3 only, before the sync refactor in v4)
1528
1558
  {
1529
1559
  channelName: aiSDKChannels.streamText.channelName,
@@ -4251,6 +4281,18 @@ var openAIAgentsCoreConfigs = lifecycleMethods.flatMap(
4251
4281
  var openAIChannels = defineChannels(
4252
4282
  "openai",
4253
4283
  {
4284
+ filesCreateTraced: channel({
4285
+ channelName: "files.create-traced",
4286
+ kind: "async"
4287
+ }),
4288
+ batchesRetrieveTraced: channel({
4289
+ channelName: "batches.retrieve-traced",
4290
+ kind: "async"
4291
+ }),
4292
+ batchesCompleteTrace: channel({
4293
+ channelName: "batches.complete-trace",
4294
+ kind: "async"
4295
+ }),
4254
4296
  chatCompletionsCreate: channel({
4255
4297
  channelName: "chat.completions.create",
4256
4298
  kind: "async"
@@ -4684,7 +4726,7 @@ var piCodingAgentChannels = defineChannels(
4684
4726
  );
4685
4727
 
4686
4728
  // src/auto-instrumentations/configs/pi-coding-agent.ts
4687
- var piCodingAgentVersionRange = ">=0.79.0 <0.82.0";
4729
+ var piCodingAgentVersionRange = ">=0.79.0 <1.0.0";
4688
4730
  var piCodingAgentConfigs = [
4689
4731
  {
4690
4732
  channelName: piCodingAgentChannels.prompt.channelName,
@@ -4943,6 +4985,14 @@ function getDefaultInstrumentationConfigs({
4943
4985
  ...additionalInstrumentations ?? []
4944
4986
  ];
4945
4987
  }
4988
+ function getDefaultAutoInstrumentationConfigs(additionalInstrumentations) {
4989
+ return getDefaultInstrumentationConfigs({
4990
+ additionalInstrumentations,
4991
+ disabledIntegrationConfig: readDisabledInstrumentationEnvConfig(
4992
+ process.env.BRAINTRUST_DISABLE_INSTRUMENTATION
4993
+ ).integrations
4994
+ });
4995
+ }
4946
4996
 
4947
4997
  // src/auto-instrumentations/loader/mastra-observability-patch.ts
4948
4998
  var MASTRA_EXPORTER_FACTORY_GLOBAL = "__braintrustMastraExporterFactory";
@@ -5209,9 +5259,9 @@ function getModuleVersion(basedir) {
5209
5259
  }
5210
5260
  var unplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
5211
5261
  const browser = options.browser ?? options.useDiagnosticChannelCompatShim ?? false;
5212
- const allInstrumentations = getDefaultInstrumentationConfigs({
5213
- additionalInstrumentations: options.instrumentations
5214
- });
5262
+ const allInstrumentations = getDefaultAutoInstrumentationConfigs(
5263
+ options.instrumentations
5264
+ );
5215
5265
  const instrumentationMatcher = create(allInstrumentations);
5216
5266
  return {
5217
5267
  name: "code-transformer",
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  webpackPlugin
3
- } from "../chunk-HD35AM3M.mjs";
4
- import "../chunk-26PKVUKB.mjs";
5
- import "../chunk-NP7V4XB2.mjs";
3
+ } from "../chunk-OXINGIEZ.mjs";
4
+ import "../chunk-LW4HDHXT.mjs";
5
+ import "../chunk-U64OYU4Q.mjs";
6
6
  import "../chunk-I55G56ZL.mjs";
7
7
  import "../chunk-JPUFNW7X.mjs";
8
8
  import "../chunk-P5YLNB2A.mjs";
@@ -1244,8 +1244,6 @@ function isInstrumentationIntegrationDisabled(integrations, ...names) {
1244
1244
  var DefaultAsyncLocalStorage = class {
1245
1245
  constructor() {
1246
1246
  }
1247
- enterWith(_) {
1248
- }
1249
1247
  run(_, callback) {
1250
1248
  return callback();
1251
1249
  }
@@ -1353,6 +1351,7 @@ var INSTRUMENTATION_NAMES = {
1353
1351
  CLOUDFLARE_THINK: "cloudflare-think",
1354
1352
  COHERE: "cohere",
1355
1353
  CURSOR_SDK: "cursor-sdk",
1354
+ DEEPSEEK_HARNESS: "deepseek-harness",
1356
1355
  EVE: "eve",
1357
1356
  FLUE: "flue",
1358
1357
  GENKIT: "genkit",
@@ -1384,6 +1383,10 @@ var aiSDKChannels = defineChannels(
1384
1383
  channelName: "generateText",
1385
1384
  kind: "async"
1386
1385
  }),
1386
+ generateImage: channel({
1387
+ channelName: "generateImage",
1388
+ kind: "async"
1389
+ }),
1387
1390
  streamText: channel({
1388
1391
  channelName: "streamText",
1389
1392
  kind: "async"
@@ -1523,6 +1526,33 @@ var aiSDKConfigs = [
1523
1526
  kind: "Async"
1524
1527
  }
1525
1528
  },
1529
+ // generateImage - stable in v6+, experimental alias in v5
1530
+ ...[
1531
+ {
1532
+ functionName: "generateImage",
1533
+ versionRange: ">=6.0.0 <8.0.0",
1534
+ isExportAlias: false
1535
+ },
1536
+ {
1537
+ functionName: "experimental_generateImage",
1538
+ versionRange: ">=5.0.0 <6.0.0",
1539
+ isExportAlias: true
1540
+ }
1541
+ ].flatMap(
1542
+ ({ functionName, versionRange: versionRange2, isExportAlias }) => ["dist/index.mjs", "dist/index.js"].map((filePath) => ({
1543
+ channelName: aiSDKChannels.generateImage.channelName,
1544
+ module: {
1545
+ name: "ai",
1546
+ versionRange: versionRange2,
1547
+ filePath
1548
+ },
1549
+ functionQuery: {
1550
+ functionName,
1551
+ kind: "Async",
1552
+ ...isExportAlias ? { isExportAlias } : {}
1553
+ }
1554
+ }))
1555
+ ),
1526
1556
  // streamText - async function (v3 only, before the sync refactor in v4)
1527
1557
  {
1528
1558
  channelName: aiSDKChannels.streamText.channelName,
@@ -4250,6 +4280,18 @@ var openAIAgentsCoreConfigs = lifecycleMethods.flatMap(
4250
4280
  var openAIChannels = defineChannels(
4251
4281
  "openai",
4252
4282
  {
4283
+ filesCreateTraced: channel({
4284
+ channelName: "files.create-traced",
4285
+ kind: "async"
4286
+ }),
4287
+ batchesRetrieveTraced: channel({
4288
+ channelName: "batches.retrieve-traced",
4289
+ kind: "async"
4290
+ }),
4291
+ batchesCompleteTrace: channel({
4292
+ channelName: "batches.complete-trace",
4293
+ kind: "async"
4294
+ }),
4253
4295
  chatCompletionsCreate: channel({
4254
4296
  channelName: "chat.completions.create",
4255
4297
  kind: "async"
@@ -4683,7 +4725,7 @@ var piCodingAgentChannels = defineChannels(
4683
4725
  );
4684
4726
 
4685
4727
  // src/auto-instrumentations/configs/pi-coding-agent.ts
4686
- var piCodingAgentVersionRange = ">=0.79.0 <0.82.0";
4728
+ var piCodingAgentVersionRange = ">=0.79.0 <1.0.0";
4687
4729
  var piCodingAgentConfigs = [
4688
4730
  {
4689
4731
  channelName: piCodingAgentChannels.prompt.channelName,
@@ -4942,6 +4984,14 @@ function getDefaultInstrumentationConfigs({
4942
4984
  ...additionalInstrumentations ?? []
4943
4985
  ];
4944
4986
  }
4987
+ function getDefaultAutoInstrumentationConfigs(additionalInstrumentations) {
4988
+ return getDefaultInstrumentationConfigs({
4989
+ additionalInstrumentations,
4990
+ disabledIntegrationConfig: readDisabledInstrumentationEnvConfig(
4991
+ process.env.BRAINTRUST_DISABLE_INSTRUMENTATION
4992
+ ).integrations
4993
+ });
4994
+ }
4945
4995
 
4946
4996
  // src/auto-instrumentations/loader/mastra-observability-patch.ts
4947
4997
  var MASTRA_EXPORTER_FACTORY_GLOBAL = "__braintrustMastraExporterFactory";
@@ -5208,9 +5258,9 @@ function getModuleVersion(basedir) {
5208
5258
  }
5209
5259
  var unplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
5210
5260
  const browser = options.browser ?? options.useDiagnosticChannelCompatShim ?? false;
5211
- const allInstrumentations = getDefaultInstrumentationConfigs({
5212
- additionalInstrumentations: options.instrumentations
5213
- });
5261
+ const allInstrumentations = getDefaultAutoInstrumentationConfigs(
5262
+ options.instrumentations
5263
+ );
5214
5264
  const instrumentationMatcher = create(allInstrumentations);
5215
5265
  return {
5216
5266
  name: "code-transformer",
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unplugin
3
- } from "../chunk-26PKVUKB.mjs";
4
- import "../chunk-NP7V4XB2.mjs";
3
+ } from "../chunk-LW4HDHXT.mjs";
4
+ import "../chunk-U64OYU4Q.mjs";
5
5
  import "../chunk-I55G56ZL.mjs";
6
6
  import "../chunk-JPUFNW7X.mjs";
7
7
  import "../chunk-P5YLNB2A.mjs";