braintrust 3.24.0 → 3.26.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 (80) hide show
  1. package/NOTICE +6 -0
  2. package/dev/dist/index.d.mts +135 -2
  3. package/dev/dist/index.d.ts +135 -2
  4. package/dev/dist/index.js +4426 -2040
  5. package/dev/dist/index.mjs +3594 -1208
  6. package/dist/apply-auto-instrumentation.js +445 -403
  7. package/dist/apply-auto-instrumentation.mjs +249 -207
  8. package/dist/auto-instrumentations/bundler/esbuild.cjs +1449 -799
  9. package/dist/auto-instrumentations/bundler/esbuild.d.mts +4 -4
  10. package/dist/auto-instrumentations/bundler/esbuild.d.ts +4 -4
  11. package/dist/auto-instrumentations/bundler/esbuild.mjs +5 -8
  12. package/dist/auto-instrumentations/bundler/next.cjs +1448 -818
  13. package/dist/auto-instrumentations/bundler/next.mjs +6 -29
  14. package/dist/auto-instrumentations/bundler/rollup.cjs +1449 -799
  15. package/dist/auto-instrumentations/bundler/rollup.d.mts +4 -4
  16. package/dist/auto-instrumentations/bundler/rollup.d.ts +4 -4
  17. package/dist/auto-instrumentations/bundler/rollup.mjs +5 -8
  18. package/dist/auto-instrumentations/bundler/vite.cjs +1449 -799
  19. package/dist/auto-instrumentations/bundler/vite.d.mts +4 -4
  20. package/dist/auto-instrumentations/bundler/vite.d.ts +4 -4
  21. package/dist/auto-instrumentations/bundler/vite.mjs +5 -8
  22. package/dist/auto-instrumentations/bundler/webpack-loader.cjs +1602 -728
  23. package/dist/auto-instrumentations/bundler/webpack-loader.d.ts +20 -12
  24. package/dist/auto-instrumentations/bundler/webpack.cjs +1449 -799
  25. package/dist/auto-instrumentations/bundler/webpack.d.mts +4 -4
  26. package/dist/auto-instrumentations/bundler/webpack.d.ts +4 -4
  27. package/dist/auto-instrumentations/bundler/webpack.mjs +5 -4
  28. package/dist/auto-instrumentations/{chunk-GSZHTAQW.mjs → chunk-6E22MYSW.mjs} +194 -93
  29. package/dist/auto-instrumentations/{chunk-VT6DDNKM.mjs → chunk-AKKPLXTP.mjs} +631 -194
  30. package/dist/auto-instrumentations/chunk-NRE4QUQR.mjs +509 -0
  31. package/dist/auto-instrumentations/{chunk-BURMPO7L.mjs → chunk-V5LEODRX.mjs} +2 -6
  32. package/dist/auto-instrumentations/{chunk-M6DLIJ2Z.mjs → chunk-XYN63IG5.mjs} +124 -194
  33. package/dist/auto-instrumentations/{chunk-F43DNLPD.mjs → chunk-XZHHE4Y3.mjs} +646 -510
  34. package/dist/auto-instrumentations/hook.mjs +894 -657
  35. package/dist/auto-instrumentations/index.cjs +1125 -490
  36. package/dist/auto-instrumentations/index.d.mts +6 -2
  37. package/dist/auto-instrumentations/index.d.ts +6 -2
  38. package/dist/auto-instrumentations/index.mjs +6 -1
  39. package/dist/auto-instrumentations/loader/cjs-patch.cjs +492 -195
  40. package/dist/auto-instrumentations/loader/cjs-patch.d.mts +2 -2
  41. package/dist/auto-instrumentations/loader/cjs-patch.d.ts +2 -2
  42. package/dist/auto-instrumentations/loader/cjs-patch.mjs +3 -2
  43. package/dist/auto-instrumentations/loader/esm-hook.mjs +1 -1
  44. package/dist/auto-instrumentations/plugin-B-aZh7EP.d.ts +30 -0
  45. package/dist/auto-instrumentations/plugin-Bnj4E_6B.d.mts +30 -0
  46. package/dist/auto-instrumentations/{types-RNPaKi9o.d.mts → types-C1fVeiCp.d.mts} +1 -1
  47. package/dist/auto-instrumentations/{types-RNPaKi9o.d.ts → types-C1fVeiCp.d.ts} +1 -1
  48. package/dist/browser.d.mts +824 -197
  49. package/dist/browser.d.ts +824 -197
  50. package/dist/browser.js +3897 -1228
  51. package/dist/browser.mjs +3897 -1228
  52. package/dist/chunk-PN7EWK66.mjs +1784 -0
  53. package/dist/{chunk-SU6EHKJV.js → chunk-VRZZQPAA.js} +3289 -1577
  54. package/dist/chunk-VYNNEKSA.js +1784 -0
  55. package/dist/{chunk-XE5FS7QY.mjs → chunk-XIZOM2HO.mjs} +2470 -758
  56. package/dist/cli.js +3596 -1211
  57. package/dist/edge-light.d.mts +1 -1
  58. package/dist/edge-light.d.ts +1 -1
  59. package/dist/edge-light.js +3897 -1231
  60. package/dist/edge-light.mjs +3897 -1231
  61. package/dist/index.d.mts +824 -197
  62. package/dist/index.d.ts +824 -197
  63. package/dist/index.js +750 -445
  64. package/dist/index.mjs +334 -29
  65. package/dist/instrumentation/index.d.mts +135 -6
  66. package/dist/instrumentation/index.d.ts +135 -6
  67. package/dist/instrumentation/index.js +3696 -1257
  68. package/dist/instrumentation/index.mjs +3696 -1257
  69. package/dist/vitest-evals-reporter.js +16 -16
  70. package/dist/vitest-evals-reporter.mjs +2 -2
  71. package/dist/workerd.d.mts +1 -1
  72. package/dist/workerd.d.ts +1 -1
  73. package/dist/workerd.js +3897 -1231
  74. package/dist/workerd.mjs +3897 -1231
  75. package/licenses/node-diagnostics-channel/LICENSE +19 -0
  76. package/package.json +34 -35
  77. package/dist/auto-instrumentations/plugin-D0KHwSJv.d.mts +0 -44
  78. package/dist/auto-instrumentations/plugin-G6fgxk1b.d.ts +0 -44
  79. package/dist/chunk-7AUY2XWX.js +0 -1090
  80. package/dist/chunk-7F6GCRHH.mjs +0 -1090
@@ -0,0 +1,1784 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // src/global-instrumentation-hooks.ts
8
+ var GLOBAL_INSTRUMENTATION_HOOKS_KEY = "__braintrust_instrumentation_hooks";
9
+ var GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION = 1;
10
+ var GLOBAL_INSTRUMENTATION_HOOKS_REGISTRY_BRAND = "braintrust.global-instrumentation-hooks.registry";
11
+ var GLOBAL_INSTRUMENTATION_HOOK_BRAND = "braintrust.global-instrumentation-hooks.hook";
12
+ var registryBrand = Symbol.for(GLOBAL_INSTRUMENTATION_HOOKS_REGISTRY_BRAND);
13
+ var hookBrand = Symbol.for(GLOBAL_INSTRUMENTATION_HOOK_BRAND);
14
+ var errorReporter;
15
+ function setGlobalHookErrorReporter(reporter) {
16
+ const previousReporter = errorReporter;
17
+ errorReporter = reporter;
18
+ return () => {
19
+ if (errorReporter === reporter) {
20
+ errorReporter = previousReporter;
21
+ }
22
+ };
23
+ }
24
+ function reportError(error) {
25
+ try {
26
+ errorReporter?.(error);
27
+ } catch {
28
+ }
29
+ }
30
+ function setContextValue(context, key, value) {
31
+ try {
32
+ context[key] = value;
33
+ } catch (error) {
34
+ reportError(error);
35
+ }
36
+ }
37
+ function wrapStoreRun(store, message, next, transform) {
38
+ return () => {
39
+ let context;
40
+ try {
41
+ context = transform ? transform(message) : message;
42
+ } catch (error) {
43
+ reportError(error);
44
+ return next();
45
+ }
46
+ let called = false;
47
+ let result;
48
+ let providerError;
49
+ let providerThrew = false;
50
+ const runNext = () => {
51
+ if (called) {
52
+ reportError(
53
+ new Error(
54
+ "Instrumentation store invoked its callback more than once"
55
+ )
56
+ );
57
+ if (providerThrew) {
58
+ throw providerError;
59
+ }
60
+ return result;
61
+ }
62
+ called = true;
63
+ try {
64
+ result = next();
65
+ return result;
66
+ } catch (error) {
67
+ providerThrew = true;
68
+ providerError = error;
69
+ throw error;
70
+ }
71
+ };
72
+ try {
73
+ store.run(context, runNext);
74
+ } catch (error) {
75
+ if (!providerThrew || error !== providerError) {
76
+ reportError(error);
77
+ }
78
+ }
79
+ if (!called) {
80
+ reportError(
81
+ new Error("Instrumentation store did not invoke its callback")
82
+ );
83
+ return runNext();
84
+ }
85
+ if (providerThrew) {
86
+ throw providerError;
87
+ }
88
+ return result;
89
+ };
90
+ }
91
+ var HookChannel = class {
92
+ constructor(name) {
93
+ this.name = name;
94
+ }
95
+ name;
96
+ subscribers = [];
97
+ stores = /* @__PURE__ */ new Map();
98
+ get hasSubscribers() {
99
+ return this.subscribers.length > 0 || this.stores.size > 0;
100
+ }
101
+ subscribe(subscription) {
102
+ if (typeof subscription !== "function") {
103
+ throw new TypeError("subscription must be a function");
104
+ }
105
+ this.subscribers = [...this.subscribers, subscription];
106
+ }
107
+ unsubscribe(subscription) {
108
+ const index = this.subscribers.indexOf(subscription);
109
+ if (index === -1) {
110
+ return false;
111
+ }
112
+ this.subscribers = [
113
+ ...this.subscribers.slice(0, index),
114
+ ...this.subscribers.slice(index + 1)
115
+ ];
116
+ return true;
117
+ }
118
+ bindStore(store, transform) {
119
+ if (!store || typeof store.run !== "function") {
120
+ throw new TypeError("store must have a run method");
121
+ }
122
+ this.stores.set(
123
+ store,
124
+ transform
125
+ );
126
+ }
127
+ unbindStore(store) {
128
+ return this.stores.delete(store);
129
+ }
130
+ publish(message) {
131
+ const subscribers = this.subscribers;
132
+ for (const subscriber of subscribers) {
133
+ try {
134
+ subscriber(message, this.name);
135
+ } catch (error) {
136
+ reportError(error);
137
+ }
138
+ }
139
+ }
140
+ runStores(message, fn, thisArg, ...args) {
141
+ let run = () => {
142
+ this.publish(message);
143
+ return Reflect.apply(fn, thisArg, args);
144
+ };
145
+ for (const [store, transform] of this.stores.entries()) {
146
+ run = wrapStoreRun(store, message, run, transform);
147
+ }
148
+ return run();
149
+ }
150
+ };
151
+ var traceEvents = [
152
+ "start",
153
+ "end",
154
+ "asyncStart",
155
+ "asyncEnd",
156
+ "error"
157
+ ];
158
+ var TracingHook = class {
159
+ start;
160
+ end;
161
+ asyncStart;
162
+ asyncEnd;
163
+ error;
164
+ constructor(nameOrChannels) {
165
+ Object.defineProperty(this, hookBrand, {
166
+ configurable: false,
167
+ enumerable: false,
168
+ value: GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION,
169
+ writable: false
170
+ });
171
+ if (typeof nameOrChannels === "string") {
172
+ this.start = new HookChannel(`tracing:${nameOrChannels}:start`);
173
+ this.end = new HookChannel(`tracing:${nameOrChannels}:end`);
174
+ this.asyncStart = new HookChannel(`tracing:${nameOrChannels}:asyncStart`);
175
+ this.asyncEnd = new HookChannel(`tracing:${nameOrChannels}:asyncEnd`);
176
+ this.error = new HookChannel(`tracing:${nameOrChannels}:error`);
177
+ return;
178
+ }
179
+ this.start = nameOrChannels.start ?? new HookChannel("tracing:start");
180
+ this.end = nameOrChannels.end ?? new HookChannel("tracing:end");
181
+ this.asyncStart = nameOrChannels.asyncStart ?? new HookChannel("tracing:asyncStart");
182
+ this.asyncEnd = nameOrChannels.asyncEnd ?? new HookChannel("tracing:asyncEnd");
183
+ this.error = nameOrChannels.error ?? new HookChannel("tracing:error");
184
+ }
185
+ get hasSubscribers() {
186
+ return this.start.hasSubscribers || this.end.hasSubscribers || this.asyncStart.hasSubscribers || this.asyncEnd.hasSubscribers || this.error.hasSubscribers;
187
+ }
188
+ subscribe(handlers) {
189
+ for (const eventName of traceEvents) {
190
+ const handler = handlers[eventName];
191
+ if (handler) {
192
+ this[eventName].subscribe(handler);
193
+ }
194
+ }
195
+ }
196
+ unsubscribe(handlers) {
197
+ let done = true;
198
+ for (const eventName of traceEvents) {
199
+ const handler = handlers[eventName];
200
+ if (handler && !this[eventName].unsubscribe(handler)) {
201
+ done = false;
202
+ }
203
+ }
204
+ return done;
205
+ }
206
+ traceSync(fn, message = {}, thisArg, ...args) {
207
+ if (!this.hasSubscribers) {
208
+ return Reflect.apply(fn, thisArg, args);
209
+ }
210
+ const context = message;
211
+ return this.start.runStores(message, () => {
212
+ try {
213
+ const result = Reflect.apply(fn, thisArg, args);
214
+ setContextValue(context, "result", result);
215
+ return result;
216
+ } catch (error) {
217
+ setContextValue(context, "error", error);
218
+ this.error.publish(message);
219
+ throw error;
220
+ } finally {
221
+ this.end.publish(message);
222
+ }
223
+ });
224
+ }
225
+ tracePromise(fn, message = {}, thisArg, ...args) {
226
+ if (!this.hasSubscribers) {
227
+ return Reflect.apply(fn, thisArg, args);
228
+ }
229
+ const context = message;
230
+ return this.start.runStores(message, () => {
231
+ let result;
232
+ try {
233
+ result = Reflect.apply(fn, thisArg, args);
234
+ } catch (error) {
235
+ setContextValue(context, "error", error);
236
+ this.error.publish(message);
237
+ this.end.publish(message);
238
+ throw error;
239
+ }
240
+ this.end.publish(message);
241
+ if (!result || typeof result !== "object" && typeof result !== "function") {
242
+ setContextValue(context, "result", result);
243
+ this.asyncStart.publish(message);
244
+ this.asyncEnd.publish(message);
245
+ return result;
246
+ }
247
+ let terminalPublished = false;
248
+ const finishUnobservedResult = (error) => {
249
+ reportError(error);
250
+ if (!terminalPublished) {
251
+ terminalPublished = true;
252
+ setContextValue(context, "result", result);
253
+ this.asyncStart.publish(message);
254
+ this.asyncEnd.publish(message);
255
+ }
256
+ return result;
257
+ };
258
+ let then;
259
+ try {
260
+ then = result.then;
261
+ } catch (error) {
262
+ return finishUnobservedResult(error);
263
+ }
264
+ if (typeof then !== "function") {
265
+ setContextValue(context, "result", result);
266
+ this.asyncStart.publish(message);
267
+ this.asyncEnd.publish(message);
268
+ return result;
269
+ }
270
+ const resolve = (resolved) => {
271
+ if (!terminalPublished) {
272
+ terminalPublished = true;
273
+ setContextValue(context, "result", resolved);
274
+ this.asyncStart.publish(message);
275
+ this.asyncEnd.publish(message);
276
+ }
277
+ return resolved;
278
+ };
279
+ let rejectionThrown = false;
280
+ let rejectionError;
281
+ const reject = (error) => {
282
+ if (!terminalPublished) {
283
+ terminalPublished = true;
284
+ setContextValue(context, "error", error);
285
+ this.error.publish(message);
286
+ this.asyncStart.publish(message);
287
+ this.asyncEnd.publish(message);
288
+ }
289
+ rejectionThrown = true;
290
+ rejectionError = error;
291
+ throw error;
292
+ };
293
+ let isPlainPromise;
294
+ try {
295
+ isPlainPromise = result instanceof Promise && result.constructor === Promise;
296
+ } catch (error) {
297
+ return finishUnobservedResult(error);
298
+ }
299
+ try {
300
+ if (isPlainPromise) {
301
+ return Reflect.apply(then, result, [resolve, reject]);
302
+ }
303
+ Reflect.apply(then, result, [
304
+ resolve,
305
+ (error) => {
306
+ try {
307
+ reject(error);
308
+ } catch {
309
+ }
310
+ }
311
+ ]);
312
+ } catch (error) {
313
+ if (rejectionThrown && error === rejectionError) {
314
+ return result;
315
+ }
316
+ return finishUnobservedResult(error);
317
+ }
318
+ return result;
319
+ });
320
+ }
321
+ traceCallback(fn, position = -1, message = {}, thisArg, ...args) {
322
+ if (!this.hasSubscribers) {
323
+ return Reflect.apply(fn, thisArg, args);
324
+ }
325
+ const context = message;
326
+ const callArgs = args.length > 0 ? args : context.arguments ?? args;
327
+ const callback = Array.prototype.at.call(callArgs, position);
328
+ if (typeof callback !== "function") {
329
+ return Reflect.apply(fn, thisArg, args);
330
+ }
331
+ const { asyncStart, asyncEnd, error: errorChannel } = this;
332
+ function wrappedCallback(error, result) {
333
+ if (error) {
334
+ setContextValue(context, "error", error);
335
+ errorChannel.publish(message);
336
+ } else {
337
+ setContextValue(context, "result", result);
338
+ }
339
+ return asyncStart.runStores(message, () => {
340
+ try {
341
+ return Reflect.apply(callback, this, arguments);
342
+ } finally {
343
+ asyncEnd.publish(message);
344
+ }
345
+ });
346
+ }
347
+ Array.prototype.splice.call(callArgs, position, 1, wrappedCallback);
348
+ return this.start.runStores(message, () => {
349
+ try {
350
+ return Reflect.apply(fn, thisArg, args);
351
+ } catch (error) {
352
+ setContextValue(context, "error", error);
353
+ this.error.publish(message);
354
+ throw error;
355
+ } finally {
356
+ this.end.publish(message);
357
+ }
358
+ });
359
+ }
360
+ };
361
+ var inertChannel = Object.freeze({
362
+ name: "braintrust:inert",
363
+ hasSubscribers: false,
364
+ subscribe() {
365
+ },
366
+ unsubscribe() {
367
+ return false;
368
+ },
369
+ bindStore() {
370
+ },
371
+ unbindStore() {
372
+ return false;
373
+ },
374
+ publish() {
375
+ },
376
+ runStores(_message, fn, thisArg, ...args) {
377
+ return Reflect.apply(fn, thisArg, args);
378
+ }
379
+ });
380
+ var inertTracingHook = new TracingHook({
381
+ start: inertChannel,
382
+ end: inertChannel,
383
+ asyncStart: inertChannel,
384
+ asyncEnd: inertChannel,
385
+ error: inertChannel
386
+ });
387
+ function isHookChannel(value) {
388
+ if (typeof value !== "object" && typeof value !== "function" || value === null) {
389
+ return false;
390
+ }
391
+ try {
392
+ const channel2 = value;
393
+ return typeof channel2.hasSubscribers === "boolean" && typeof channel2.subscribe === "function" && typeof channel2.unsubscribe === "function" && typeof channel2.bindStore === "function" && typeof channel2.unbindStore === "function" && typeof channel2.publish === "function" && typeof channel2.runStores === "function";
394
+ } catch {
395
+ return false;
396
+ }
397
+ }
398
+ function hasTracingHookShape(value) {
399
+ if (typeof value !== "object" && typeof value !== "function" || value === null) {
400
+ return false;
401
+ }
402
+ try {
403
+ const hook = value;
404
+ return typeof hook.hasSubscribers === "boolean" && typeof hook.subscribe === "function" && typeof hook.unsubscribe === "function" && typeof hook.traceSync === "function" && typeof hook.tracePromise === "function" && typeof hook.traceCallback === "function" && isHookChannel(hook.start) && isHookChannel(hook.end) && isHookChannel(hook.asyncStart) && isHookChannel(hook.asyncEnd) && isHookChannel(hook.error);
405
+ } catch {
406
+ return false;
407
+ }
408
+ }
409
+ function isCompatibleTracingHook(value) {
410
+ try {
411
+ return value[hookBrand] === GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION && hasTracingHookShape(value);
412
+ } catch {
413
+ return false;
414
+ }
415
+ }
416
+ function isCompatibleHookRegistry(value) {
417
+ try {
418
+ return value instanceof Map && value[registryBrand] === GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION;
419
+ } catch {
420
+ return false;
421
+ }
422
+ }
423
+ function getHookRegistry() {
424
+ let descriptor;
425
+ try {
426
+ descriptor = Object.getOwnPropertyDescriptor(
427
+ globalThis,
428
+ GLOBAL_INSTRUMENTATION_HOOKS_KEY
429
+ );
430
+ } catch (error) {
431
+ reportError(error);
432
+ return void 0;
433
+ }
434
+ if (descriptor && "value" in descriptor && isCompatibleHookRegistry(descriptor.value) && (descriptor.configurable || descriptor.enumerable === false)) {
435
+ if (descriptor.configurable || descriptor.writable) {
436
+ try {
437
+ Object.defineProperty(globalThis, GLOBAL_INSTRUMENTATION_HOOKS_KEY, {
438
+ configurable: false,
439
+ enumerable: false,
440
+ value: descriptor.value,
441
+ writable: false
442
+ });
443
+ } catch (error) {
444
+ reportError(error);
445
+ return void 0;
446
+ }
447
+ }
448
+ return descriptor.value;
449
+ }
450
+ if (descriptor && !descriptor.configurable) {
451
+ reportError(new Error("Incompatible global instrumentation hook registry"));
452
+ return void 0;
453
+ }
454
+ const registry = /* @__PURE__ */ new Map();
455
+ try {
456
+ Object.defineProperty(registry, registryBrand, {
457
+ configurable: false,
458
+ enumerable: false,
459
+ value: GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION,
460
+ writable: false
461
+ });
462
+ } catch (error) {
463
+ reportError(error);
464
+ return void 0;
465
+ }
466
+ try {
467
+ Object.defineProperty(globalThis, GLOBAL_INSTRUMENTATION_HOOKS_KEY, {
468
+ configurable: false,
469
+ enumerable: false,
470
+ value: registry,
471
+ writable: false
472
+ });
473
+ return registry;
474
+ } catch (error) {
475
+ reportError(error);
476
+ return void 0;
477
+ }
478
+ }
479
+ function newGlobalTracingChannel(nameOrChannels) {
480
+ if (typeof nameOrChannels !== "string") {
481
+ return new TracingHook(nameOrChannels);
482
+ }
483
+ const registry = getHookRegistry();
484
+ if (!registry) {
485
+ return inertTracingHook;
486
+ }
487
+ let existing;
488
+ try {
489
+ existing = Map.prototype.get.call(registry, nameOrChannels);
490
+ } catch (error) {
491
+ reportError(error);
492
+ return inertTracingHook;
493
+ }
494
+ if (isCompatibleTracingHook(existing)) {
495
+ return existing;
496
+ }
497
+ if (existing !== void 0) {
498
+ reportError(
499
+ new Error(`Invalid global instrumentation hook: ${nameOrChannels}`)
500
+ );
501
+ try {
502
+ Map.prototype.delete.call(registry, nameOrChannels);
503
+ } catch (error) {
504
+ reportError(error);
505
+ return inertTracingHook;
506
+ }
507
+ }
508
+ const hook = new TracingHook(nameOrChannels);
509
+ try {
510
+ Map.prototype.set.call(registry, nameOrChannels, hook);
511
+ } catch (error) {
512
+ reportError(error);
513
+ return inertTracingHook;
514
+ }
515
+ return hook;
516
+ }
517
+
518
+ // src/isomorph.ts
519
+ var DefaultAsyncLocalStorage = class {
520
+ constructor() {
521
+ }
522
+ enterWith(_) {
523
+ }
524
+ run(_, callback) {
525
+ return callback();
526
+ }
527
+ getStore() {
528
+ return void 0;
529
+ }
530
+ };
531
+ var iso = {
532
+ buildType: "unknown",
533
+ // Will be set by configureBrowser() or configureNode()
534
+ getRepoInfo: async (_settings) => void 0,
535
+ getPastNAncestors: async () => [],
536
+ getEnv: (_name) => void 0,
537
+ getBraintrustApiKey: async () => void 0,
538
+ getCallerLocation: () => void 0,
539
+ newAsyncLocalStorage: () => new DefaultAsyncLocalStorage(),
540
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
541
+ newTracingChannel: (nameOrChannels) => newGlobalTracingChannel(nameOrChannels),
542
+ processOn: (_0, _1) => {
543
+ },
544
+ basename: (filepath) => filepath.split(/[\\/]/).pop() || filepath,
545
+ // eslint-disable-next-line no-restricted-properties -- preserving intentional console usage.
546
+ writeln: (text) => console.log(text)
547
+ };
548
+ var isomorph_default = iso;
549
+
550
+ // src/span-origin.ts
551
+ var INSTRUMENTATION_NAMES = {
552
+ AI_SDK: "ai-sdk",
553
+ ANTHROPIC: "anthropic",
554
+ BEDROCK_RUNTIME: "bedrock-runtime",
555
+ BRAINTRUST_JS_LOGGER: "braintrust-js-logger",
556
+ CLAUDE_AGENT_SDK: "claude-agent-sdk",
557
+ CLOUDFLARE_AI_CHAT: "cloudflare-ai-chat",
558
+ CLOUDFLARE_AGENTS: "cloudflare-agents",
559
+ COHERE: "cohere",
560
+ CURSOR_SDK: "cursor-sdk",
561
+ EVE: "eve",
562
+ FLUE: "flue",
563
+ GENKIT: "genkit",
564
+ GITHUB_COPILOT: "github-copilot",
565
+ GOOGLE_ADK: "google-adk",
566
+ GOOGLE_GENAI: "google-genai",
567
+ GROQ: "groq",
568
+ HUGGINGFACE: "huggingface",
569
+ LANGCHAIN: "langchain",
570
+ LANGSMITH: "langsmith",
571
+ MASTRA: "mastra",
572
+ MISTRAL: "mistral",
573
+ OPENAI: "openai",
574
+ OPENAI_AGENTS: "openai-agents",
575
+ OPENAI_CODEX: "openai-codex",
576
+ OPENROUTER: "openrouter",
577
+ OPENROUTER_AGENT: "openrouter-agent",
578
+ PI_CODING_AGENT: "pi-coding-agent",
579
+ STRANDS_AGENT_SDK: "strands-agent-sdk"
580
+ };
581
+ var INTERNAL_SPAN_INSTRUMENTATION_NAME = /* @__PURE__ */ Symbol.for(
582
+ "braintrust.spanInstrumentationName"
583
+ );
584
+ var SDK_VERSION = true ? "3.26.0" : "0.0.0";
585
+ function withSpanInstrumentationName(args, instrumentationName) {
586
+ return {
587
+ ...args,
588
+ [INTERNAL_SPAN_INSTRUMENTATION_NAME]: instrumentationName
589
+ };
590
+ }
591
+ function getSpanInstrumentationName(args) {
592
+ if (typeof args !== "object" || args === null) {
593
+ return void 0;
594
+ }
595
+ const value = args[INTERNAL_SPAN_INSTRUMENTATION_NAME];
596
+ return isSpanInstrumentationName(value) ? value : void 0;
597
+ }
598
+ function detectSpanOriginEnvironment(explicit) {
599
+ if (explicit) return explicit;
600
+ const envType = isomorph_default.getEnv("BRAINTRUST_ENVIRONMENT_TYPE");
601
+ const envName = isomorph_default.getEnv("BRAINTRUST_ENVIRONMENT_NAME");
602
+ if (envType || envName) {
603
+ return {
604
+ ...envType ? { type: envType } : {},
605
+ ...envName ? { name: envName } : {}
606
+ };
607
+ }
608
+ const ci = firstPresent([
609
+ ["GITHUB_ACTIONS", "github_actions"],
610
+ ["GITLAB_CI", "gitlab_ci"],
611
+ ["CIRCLECI", "circleci"],
612
+ ["BUILDKITE", "buildkite"],
613
+ ["JENKINS_URL", "jenkins"],
614
+ ["JENKINS_HOME", "jenkins"],
615
+ ["TF_BUILD", "azure_pipelines"],
616
+ ["TEAMCITY_VERSION", "teamcity"],
617
+ ["TRAVIS", "travis"],
618
+ ["BITBUCKET_BUILD_NUMBER", "bitbucket"]
619
+ ]);
620
+ if (ci) return { type: "ci", name: ci };
621
+ if (isomorph_default.getEnv("CI")) return { type: "ci", name: "ci" };
622
+ const earlyServer = firstPresent([
623
+ ["VERCEL", "vercel"],
624
+ ["NETLIFY", "netlify"]
625
+ ]);
626
+ if (earlyServer) return { type: "server", name: earlyServer };
627
+ if (isomorph_default.getEnv("ECS_CONTAINER_METADATA_URI") || isomorph_default.getEnv("ECS_CONTAINER_METADATA_URI_V4")) {
628
+ return { type: "server", name: "ecs" };
629
+ }
630
+ const awsExecutionEnv = isomorph_default.getEnv("AWS_EXECUTION_ENV");
631
+ if (awsExecutionEnv?.startsWith("AWS_ECS_")) {
632
+ return { type: "server", name: "ecs" };
633
+ }
634
+ if (awsExecutionEnv?.startsWith("AWS_Lambda_")) {
635
+ return { type: "server", name: "aws_lambda" };
636
+ }
637
+ if (isomorph_default.getEnv("AWS_LAMBDA_FUNCTION_NAME")) {
638
+ return { type: "server", name: "aws_lambda" };
639
+ }
640
+ const server = firstPresent([
641
+ ["K_SERVICE", "cloud_run"],
642
+ ["FUNCTION_TARGET", "gcp_functions"],
643
+ ["KUBERNETES_SERVICE_HOST", "kubernetes"],
644
+ ["DYNO", "heroku"],
645
+ ["FLY_APP_NAME", "fly"],
646
+ ["RAILWAY_ENVIRONMENT", "railway"],
647
+ ["RENDER_SERVICE_NAME", "render"]
648
+ ]);
649
+ if (server) return { type: "server", name: server };
650
+ return deploymentModeEnvironment("NODE_ENV", isomorph_default.getEnv("NODE_ENV"));
651
+ }
652
+ function makeSpanOrigin(instrumentationName, environment) {
653
+ return {
654
+ name: "braintrust.sdk.javascript",
655
+ version: SDK_VERSION,
656
+ instrumentation: { name: instrumentationName },
657
+ ...environment ? { environment } : {}
658
+ };
659
+ }
660
+ function mergeSpanOriginContext(context, instrumentationName, environment) {
661
+ const next = { ...context ?? {} };
662
+ const current = isObject(next.span_origin) ? { ...next.span_origin } : {};
663
+ next.span_origin = {
664
+ ...makeSpanOrigin(instrumentationName, environment),
665
+ ...current
666
+ };
667
+ return next;
668
+ }
669
+ function isSpanInstrumentationName(value) {
670
+ return Object.values(INSTRUMENTATION_NAMES).some((name) => name === value);
671
+ }
672
+ function firstPresent(entries) {
673
+ return entries.find(([key]) => Boolean(isomorph_default.getEnv(key)))?.[1];
674
+ }
675
+ function deploymentModeEnvironment(_key, value) {
676
+ if (!value) return void 0;
677
+ const normalized = value.toLowerCase();
678
+ if (normalized === "production" || normalized === "staging") {
679
+ return { type: "server", name: normalized };
680
+ }
681
+ if (normalized === "development" || normalized === "local") {
682
+ return { type: "local", name: normalized };
683
+ }
684
+ return { name: value };
685
+ }
686
+ function isObject(value) {
687
+ return typeof value === "object" && value !== null && !Array.isArray(value);
688
+ }
689
+
690
+ // src/instrumentation/core/channel-definitions.ts
691
+ function channel(spec) {
692
+ return spec;
693
+ }
694
+ function defineChannels(pkg, channels, options) {
695
+ const { instrumentationName } = options;
696
+ return Object.fromEntries(
697
+ Object.entries(channels).map(([key, spec]) => {
698
+ const fullChannelName = `orchestrion:${pkg}:${spec.channelName}`;
699
+ if (spec.kind === "async") {
700
+ const asyncSpec = spec;
701
+ const tracingChannel2 = () => isomorph_default.newTracingChannel(
702
+ fullChannelName
703
+ );
704
+ return [
705
+ key,
706
+ {
707
+ ...asyncSpec,
708
+ instrumentationName,
709
+ tracingChannel: tracingChannel2,
710
+ tracePromise: (fn, context) => tracingChannel2().tracePromise(
711
+ fn,
712
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
713
+ context
714
+ )
715
+ }
716
+ ];
717
+ }
718
+ const syncSpec = spec;
719
+ const tracingChannel = () => isomorph_default.newTracingChannel(
720
+ fullChannelName
721
+ );
722
+ return [
723
+ key,
724
+ {
725
+ ...syncSpec,
726
+ instrumentationName,
727
+ tracingChannel,
728
+ traceSync: (fn, context) => tracingChannel().traceSync(
729
+ fn,
730
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
731
+ context
732
+ )
733
+ }
734
+ ];
735
+ })
736
+ );
737
+ }
738
+
739
+ // src/instrumentation/plugins/openai-channels.ts
740
+ var openAIChannels = defineChannels(
741
+ "openai",
742
+ {
743
+ chatCompletionsCreate: channel({
744
+ channelName: "chat.completions.create",
745
+ kind: "async"
746
+ }),
747
+ embeddingsCreate: channel({
748
+ channelName: "embeddings.create",
749
+ kind: "async"
750
+ }),
751
+ betaChatCompletionsParse: channel({
752
+ channelName: "beta.chat.completions.parse",
753
+ kind: "async"
754
+ }),
755
+ betaChatCompletionsStream: channel({
756
+ channelName: "beta.chat.completions.stream",
757
+ kind: "sync-stream"
758
+ }),
759
+ moderationsCreate: channel({
760
+ channelName: "moderations.create",
761
+ kind: "async"
762
+ }),
763
+ responsesCreate: channel({
764
+ channelName: "responses.create",
765
+ kind: "async"
766
+ }),
767
+ responsesStream: channel({
768
+ channelName: "responses.stream",
769
+ kind: "sync-stream"
770
+ }),
771
+ responsesParse: channel({
772
+ channelName: "responses.parse",
773
+ kind: "async"
774
+ }),
775
+ responsesCompact: channel({
776
+ channelName: "responses.compact",
777
+ kind: "async"
778
+ })
779
+ },
780
+ { instrumentationName: INSTRUMENTATION_NAMES.OPENAI }
781
+ );
782
+
783
+ // src/instrumentation/plugins/openai-codex-channels.ts
784
+ var openAICodexChannels = defineChannels(
785
+ "@openai/codex-sdk",
786
+ {
787
+ run: channel({
788
+ channelName: "Thread.run",
789
+ kind: "async"
790
+ }),
791
+ runStreamed: channel({
792
+ channelName: "Thread.runStreamed",
793
+ kind: "async"
794
+ })
795
+ },
796
+ { instrumentationName: INSTRUMENTATION_NAMES.OPENAI_CODEX }
797
+ );
798
+
799
+ // src/instrumentation/plugins/anthropic-channels.ts
800
+ var anthropicChannels = defineChannels(
801
+ "@anthropic-ai/sdk",
802
+ {
803
+ messagesCreate: channel({
804
+ channelName: "messages.create",
805
+ kind: "async"
806
+ }),
807
+ betaMessagesCreate: channel({
808
+ channelName: "beta.messages.create",
809
+ kind: "async"
810
+ }),
811
+ betaMessagesToolRunner: channel({
812
+ channelName: "beta.messages.toolRunner",
813
+ kind: "sync-stream"
814
+ })
815
+ },
816
+ { instrumentationName: INSTRUMENTATION_NAMES.ANTHROPIC }
817
+ );
818
+
819
+ // src/instrumentation/plugins/ai-sdk-channels.ts
820
+ var aiSDKChannels = defineChannels(
821
+ "ai",
822
+ {
823
+ generateText: channel({
824
+ channelName: "generateText",
825
+ kind: "async"
826
+ }),
827
+ streamText: channel({
828
+ channelName: "streamText",
829
+ kind: "async"
830
+ }),
831
+ streamTextSync: channel({
832
+ channelName: "streamText.sync",
833
+ kind: "sync-stream"
834
+ }),
835
+ generateObject: channel({
836
+ channelName: "generateObject",
837
+ kind: "async"
838
+ }),
839
+ streamObject: channel({
840
+ channelName: "streamObject",
841
+ kind: "async"
842
+ }),
843
+ streamObjectSync: channel({
844
+ channelName: "streamObject.sync",
845
+ kind: "sync-stream"
846
+ }),
847
+ embed: channel({
848
+ channelName: "embed",
849
+ kind: "async"
850
+ }),
851
+ embedMany: channel({
852
+ channelName: "embedMany",
853
+ kind: "async"
854
+ }),
855
+ rerank: channel({
856
+ channelName: "rerank",
857
+ kind: "async"
858
+ }),
859
+ agentGenerate: channel({
860
+ channelName: "Agent.generate",
861
+ kind: "async"
862
+ }),
863
+ agentStream: channel({
864
+ channelName: "Agent.stream",
865
+ kind: "async"
866
+ }),
867
+ agentStreamSync: channel({
868
+ channelName: "Agent.stream.sync",
869
+ kind: "sync-stream"
870
+ }),
871
+ toolLoopAgentGenerate: channel({
872
+ channelName: "ToolLoopAgent.generate",
873
+ kind: "async"
874
+ }),
875
+ toolLoopAgentStream: channel({
876
+ channelName: "ToolLoopAgent.stream",
877
+ kind: "async"
878
+ }),
879
+ workflowAgentStream: channel({
880
+ channelName: "WorkflowAgent.stream",
881
+ kind: "async"
882
+ }),
883
+ v7CreateTelemetryDispatcher: channel({
884
+ channelName: "createTelemetryDispatcher",
885
+ kind: "sync-stream"
886
+ })
887
+ },
888
+ { instrumentationName: INSTRUMENTATION_NAMES.AI_SDK }
889
+ );
890
+ var harnessAgentChannels = defineChannels(
891
+ "@ai-sdk/harness",
892
+ {
893
+ createSession: channel({
894
+ channelName: "HarnessAgent.createSession",
895
+ kind: "async"
896
+ }),
897
+ generate: channel({
898
+ channelName: "HarnessAgent.generate",
899
+ kind: "async"
900
+ }),
901
+ stream: channel({
902
+ channelName: "HarnessAgent.stream",
903
+ kind: "async"
904
+ }),
905
+ continueGenerate: channel({
906
+ channelName: "HarnessAgent.continueGenerate",
907
+ kind: "async"
908
+ }),
909
+ continueStream: channel({
910
+ channelName: "HarnessAgent.continueStream",
911
+ kind: "async"
912
+ })
913
+ },
914
+ { instrumentationName: INSTRUMENTATION_NAMES.AI_SDK }
915
+ );
916
+
917
+ // src/instrumentation/plugins/claude-agent-sdk-channels.ts
918
+ var claudeAgentSDKChannels = defineChannels(
919
+ "@anthropic-ai/claude-agent-sdk",
920
+ {
921
+ query: channel({
922
+ channelName: "query",
923
+ kind: "sync-stream"
924
+ })
925
+ },
926
+ { instrumentationName: INSTRUMENTATION_NAMES.CLAUDE_AGENT_SDK }
927
+ );
928
+
929
+ // src/instrumentation/plugins/cursor-sdk-channels.ts
930
+ var cursorSDKChannels = defineChannels(
931
+ "@cursor/sdk",
932
+ {
933
+ create: channel({
934
+ channelName: "Agent.create",
935
+ kind: "async"
936
+ }),
937
+ resume: channel({
938
+ channelName: "Agent.resume",
939
+ kind: "async"
940
+ }),
941
+ prompt: channel({
942
+ channelName: "Agent.prompt",
943
+ kind: "async"
944
+ }),
945
+ send: channel({
946
+ channelName: "agent.send",
947
+ kind: "async"
948
+ })
949
+ },
950
+ { instrumentationName: INSTRUMENTATION_NAMES.CURSOR_SDK }
951
+ );
952
+
953
+ // src/instrumentation/plugins/google-genai-channels.ts
954
+ var googleGenAIChannels = defineChannels(
955
+ "@google/genai",
956
+ {
957
+ generateContent: channel({
958
+ channelName: "models.generateContent",
959
+ kind: "async"
960
+ }),
961
+ generateContentStream: channel({
962
+ channelName: "models.generateContentStream",
963
+ kind: "async"
964
+ }),
965
+ embedContent: channel({
966
+ channelName: "models.embedContent",
967
+ kind: "async"
968
+ }),
969
+ interactionsCreate: channel({
970
+ channelName: "interactions.create",
971
+ kind: "async"
972
+ })
973
+ },
974
+ { instrumentationName: INSTRUMENTATION_NAMES.GOOGLE_GENAI }
975
+ );
976
+
977
+ // src/instrumentation/plugins/huggingface-channels.ts
978
+ var huggingFaceChannels = defineChannels(
979
+ "@huggingface/inference",
980
+ {
981
+ chatCompletion: channel({
982
+ channelName: "chatCompletion",
983
+ kind: "async"
984
+ }),
985
+ chatCompletionStream: channel({
986
+ channelName: "chatCompletionStream",
987
+ kind: "sync-stream"
988
+ }),
989
+ textGeneration: channel({
990
+ channelName: "textGeneration",
991
+ kind: "async"
992
+ }),
993
+ textGenerationStream: channel({
994
+ channelName: "textGenerationStream",
995
+ kind: "sync-stream"
996
+ }),
997
+ featureExtraction: channel({
998
+ channelName: "featureExtraction",
999
+ kind: "async"
1000
+ })
1001
+ },
1002
+ { instrumentationName: INSTRUMENTATION_NAMES.HUGGINGFACE }
1003
+ );
1004
+
1005
+ // src/instrumentation/plugins/huggingface-transformers-channels.ts
1006
+ var SUPPORTED_TASKS = /* @__PURE__ */ new Set([
1007
+ "text-generation",
1008
+ "text2text-generation",
1009
+ "summarization",
1010
+ "feature-extraction",
1011
+ "question-answering"
1012
+ ]);
1013
+ var pipelineInfo = /* @__PURE__ */ new WeakMap();
1014
+ function isSupportedHuggingFaceTransformersTask(task) {
1015
+ return typeof task === "string" && SUPPORTED_TASKS.has(task);
1016
+ }
1017
+ function registerHuggingFaceTransformersPipeline(pipeline, task, model) {
1018
+ if (typeof task !== "string") {
1019
+ return;
1020
+ }
1021
+ const info = { task };
1022
+ if (typeof model === "string") {
1023
+ info.model = model;
1024
+ }
1025
+ pipelineInfo.set(pipeline, info);
1026
+ }
1027
+ function getHuggingFaceTransformersPipelineInfo(pipeline) {
1028
+ return pipeline ? pipelineInfo.get(pipeline) : void 0;
1029
+ }
1030
+ var huggingFaceTransformersChannels = defineChannels(
1031
+ "@huggingface/transformers",
1032
+ {
1033
+ pipeline: channel({
1034
+ channelName: "pipeline",
1035
+ kind: "async"
1036
+ }),
1037
+ pipelineCall: channel({
1038
+ channelName: "pipeline.call",
1039
+ kind: "async"
1040
+ })
1041
+ },
1042
+ { instrumentationName: INSTRUMENTATION_NAMES.HUGGINGFACE }
1043
+ );
1044
+
1045
+ // src/instrumentation/plugins/openrouter-agent-channels.ts
1046
+ var openRouterAgentChannels = defineChannels(
1047
+ "@openrouter/agent",
1048
+ {
1049
+ callModel: channel({
1050
+ channelName: "callModel",
1051
+ kind: "sync-stream"
1052
+ }),
1053
+ callModelTurn: channel({
1054
+ channelName: "callModel.turn",
1055
+ kind: "async"
1056
+ }),
1057
+ toolExecute: channel({
1058
+ channelName: "tool.execute",
1059
+ kind: "async"
1060
+ })
1061
+ },
1062
+ { instrumentationName: INSTRUMENTATION_NAMES.OPENROUTER_AGENT }
1063
+ );
1064
+
1065
+ // src/instrumentation/plugins/openrouter-channels.ts
1066
+ var openRouterChannels = defineChannels(
1067
+ "@openrouter/sdk",
1068
+ {
1069
+ chatSend: channel({
1070
+ channelName: "chat.send",
1071
+ kind: "async"
1072
+ }),
1073
+ embeddingsGenerate: channel({
1074
+ channelName: "embeddings.generate",
1075
+ kind: "async"
1076
+ }),
1077
+ rerankRerank: channel({
1078
+ channelName: "rerank.rerank",
1079
+ kind: "async"
1080
+ }),
1081
+ betaResponsesSend: channel({
1082
+ channelName: "beta.responses.send",
1083
+ kind: "async"
1084
+ }),
1085
+ callModel: channel({
1086
+ channelName: "callModel",
1087
+ kind: "sync-stream"
1088
+ }),
1089
+ callModelTurn: channel({
1090
+ channelName: "callModel.turn",
1091
+ kind: "async"
1092
+ }),
1093
+ toolExecute: channel({
1094
+ channelName: "tool.execute",
1095
+ kind: "async"
1096
+ })
1097
+ },
1098
+ { instrumentationName: INSTRUMENTATION_NAMES.OPENROUTER }
1099
+ );
1100
+
1101
+ // src/instrumentation/plugins/mistral-channels.ts
1102
+ var mistralChannels = defineChannels(
1103
+ "@mistralai/mistralai",
1104
+ {
1105
+ chatComplete: channel({
1106
+ channelName: "chat.complete",
1107
+ kind: "async"
1108
+ }),
1109
+ chatStream: channel({
1110
+ channelName: "chat.stream",
1111
+ kind: "async"
1112
+ }),
1113
+ embeddingsCreate: channel({
1114
+ channelName: "embeddings.create",
1115
+ kind: "async"
1116
+ }),
1117
+ classifiersModerate: channel({
1118
+ channelName: "classifiers.moderate",
1119
+ kind: "async"
1120
+ }),
1121
+ classifiersModerateChat: channel({
1122
+ channelName: "classifiers.moderateChat",
1123
+ kind: "async"
1124
+ }),
1125
+ classifiersClassify: channel({
1126
+ channelName: "classifiers.classify",
1127
+ kind: "async"
1128
+ }),
1129
+ classifiersClassifyChat: channel({
1130
+ channelName: "classifiers.classifyChat",
1131
+ kind: "async"
1132
+ }),
1133
+ fimComplete: channel({
1134
+ channelName: "fim.complete",
1135
+ kind: "async"
1136
+ }),
1137
+ fimStream: channel({
1138
+ channelName: "fim.stream",
1139
+ kind: "async"
1140
+ }),
1141
+ agentsComplete: channel({
1142
+ channelName: "agents.complete",
1143
+ kind: "async"
1144
+ }),
1145
+ agentsStream: channel({
1146
+ channelName: "agents.stream",
1147
+ kind: "async"
1148
+ })
1149
+ },
1150
+ { instrumentationName: INSTRUMENTATION_NAMES.MISTRAL }
1151
+ );
1152
+
1153
+ // src/instrumentation/plugins/google-adk-channels.ts
1154
+ var googleADKChannels = defineChannels(
1155
+ "@google/adk",
1156
+ {
1157
+ runnerRunAsync: channel({
1158
+ channelName: "runner.runAsync",
1159
+ kind: "sync-stream"
1160
+ }),
1161
+ agentRunAsync: channel({
1162
+ channelName: "agent.runAsync",
1163
+ kind: "sync-stream"
1164
+ }),
1165
+ toolRunAsync: channel({
1166
+ channelName: "tool.runAsync",
1167
+ kind: "async"
1168
+ })
1169
+ },
1170
+ { instrumentationName: INSTRUMENTATION_NAMES.GOOGLE_ADK }
1171
+ );
1172
+
1173
+ // src/instrumentation/plugins/cohere-channels.ts
1174
+ var cohereChannels = defineChannels(
1175
+ "cohere-ai",
1176
+ {
1177
+ chat: channel({
1178
+ channelName: "chat",
1179
+ kind: "async"
1180
+ }),
1181
+ chatStream: channel({
1182
+ channelName: "chatStream",
1183
+ kind: "async"
1184
+ }),
1185
+ embed: channel({
1186
+ channelName: "embed",
1187
+ kind: "async"
1188
+ }),
1189
+ rerank: channel({
1190
+ channelName: "rerank",
1191
+ kind: "async"
1192
+ })
1193
+ },
1194
+ { instrumentationName: INSTRUMENTATION_NAMES.COHERE }
1195
+ );
1196
+
1197
+ // src/instrumentation/plugins/groq-channels.ts
1198
+ var groqChannels = defineChannels(
1199
+ "groq-sdk",
1200
+ {
1201
+ chatCompletionsCreate: channel({
1202
+ channelName: "chat.completions.create",
1203
+ kind: "async"
1204
+ }),
1205
+ embeddingsCreate: channel({
1206
+ channelName: "embeddings.create",
1207
+ kind: "async"
1208
+ })
1209
+ },
1210
+ { instrumentationName: INSTRUMENTATION_NAMES.GROQ }
1211
+ );
1212
+
1213
+ // src/instrumentation/plugins/bedrock-runtime-channels.ts
1214
+ var clientSendChannel = channel({
1215
+ channelName: "client.send",
1216
+ kind: "async"
1217
+ });
1218
+ var bedrockRuntimeChannels = defineChannels(
1219
+ "aws-bedrock-runtime",
1220
+ {
1221
+ clientSend: clientSendChannel
1222
+ },
1223
+ { instrumentationName: INSTRUMENTATION_NAMES.BEDROCK_RUNTIME }
1224
+ );
1225
+ var smithyCoreChannels = defineChannels(
1226
+ "@smithy/core",
1227
+ {
1228
+ clientSend: clientSendChannel
1229
+ },
1230
+ { instrumentationName: INSTRUMENTATION_NAMES.BEDROCK_RUNTIME }
1231
+ );
1232
+ var smithyClientChannels = defineChannels(
1233
+ "@smithy/smithy-client",
1234
+ {
1235
+ clientSend: clientSendChannel
1236
+ },
1237
+ { instrumentationName: INSTRUMENTATION_NAMES.BEDROCK_RUNTIME }
1238
+ );
1239
+
1240
+ // src/instrumentation/plugins/genkit-channels.ts
1241
+ var genkitChannels = defineChannels(
1242
+ "@genkit-ai/ai",
1243
+ {
1244
+ generate: channel({
1245
+ channelName: "generate",
1246
+ kind: "async"
1247
+ }),
1248
+ generateStream: channel({
1249
+ channelName: "generateStream",
1250
+ kind: "sync-stream"
1251
+ }),
1252
+ embed: channel({
1253
+ channelName: "embed",
1254
+ kind: "async"
1255
+ }),
1256
+ embedMany: channel({
1257
+ channelName: "embedMany",
1258
+ kind: "async"
1259
+ }),
1260
+ actionRun: channel({
1261
+ channelName: "action.run",
1262
+ kind: "async"
1263
+ }),
1264
+ actionStream: channel({
1265
+ channelName: "action.stream",
1266
+ kind: "sync-stream"
1267
+ })
1268
+ },
1269
+ { instrumentationName: INSTRUMENTATION_NAMES.GENKIT }
1270
+ );
1271
+ var genkitCoreChannels = defineChannels(
1272
+ "@genkit-ai/core",
1273
+ {
1274
+ actionSpan: channel({
1275
+ channelName: "action.span",
1276
+ kind: "async"
1277
+ })
1278
+ },
1279
+ { instrumentationName: INSTRUMENTATION_NAMES.GENKIT }
1280
+ );
1281
+
1282
+ // src/instrumentation/plugins/github-copilot-channels.ts
1283
+ var gitHubCopilotChannels = defineChannels(
1284
+ "@github/copilot-sdk",
1285
+ {
1286
+ createSession: channel({
1287
+ channelName: "client.createSession",
1288
+ kind: "async"
1289
+ }),
1290
+ resumeSession: channel({
1291
+ channelName: "client.resumeSession",
1292
+ kind: "async"
1293
+ }),
1294
+ sendAndWait: channel({
1295
+ channelName: "session.sendAndWait",
1296
+ kind: "async"
1297
+ })
1298
+ },
1299
+ { instrumentationName: INSTRUMENTATION_NAMES.GITHUB_COPILOT }
1300
+ );
1301
+
1302
+ // src/instrumentation/plugins/flue-channels.ts
1303
+ var flueChannels = defineChannels(
1304
+ "@flue/runtime",
1305
+ {
1306
+ createContext: channel({
1307
+ channelName: "createFlueContext",
1308
+ kind: "sync-stream"
1309
+ })
1310
+ },
1311
+ { instrumentationName: INSTRUMENTATION_NAMES.FLUE }
1312
+ );
1313
+
1314
+ // src/instrumentation/plugins/langsmith-channels.ts
1315
+ var langSmithChannels = defineChannels(
1316
+ "langsmith",
1317
+ {
1318
+ createRun: channel({
1319
+ channelName: "Client.createRun",
1320
+ kind: "async"
1321
+ }),
1322
+ updateRun: channel({
1323
+ channelName: "Client.updateRun",
1324
+ kind: "async"
1325
+ }),
1326
+ batchIngestRuns: channel({
1327
+ channelName: "Client.batchIngestRuns",
1328
+ kind: "async"
1329
+ })
1330
+ },
1331
+ { instrumentationName: INSTRUMENTATION_NAMES.LANGSMITH }
1332
+ );
1333
+
1334
+ // src/instrumentation/plugins/pi-coding-agent-channels.ts
1335
+ var piCodingAgentChannels = defineChannels(
1336
+ "@earendil-works/pi-coding-agent",
1337
+ {
1338
+ prompt: channel({
1339
+ channelName: "AgentSession.prompt",
1340
+ kind: "async"
1341
+ })
1342
+ },
1343
+ { instrumentationName: INSTRUMENTATION_NAMES.PI_CODING_AGENT }
1344
+ );
1345
+
1346
+ // src/instrumentation/plugins/strands-agent-sdk-channels.ts
1347
+ var strandsAgentSDKChannels = defineChannels(
1348
+ "@strands-agents/sdk",
1349
+ {
1350
+ agentStream: channel({
1351
+ channelName: "Agent.stream",
1352
+ kind: "sync-stream"
1353
+ }),
1354
+ graphStream: channel({
1355
+ channelName: "Graph.stream",
1356
+ kind: "sync-stream"
1357
+ }),
1358
+ swarmStream: channel({
1359
+ channelName: "Swarm.stream",
1360
+ kind: "sync-stream"
1361
+ })
1362
+ },
1363
+ { instrumentationName: INSTRUMENTATION_NAMES.STRANDS_AGENT_SDK }
1364
+ );
1365
+
1366
+ // src/instrumentation/plugins/cloudflare-agents-channels.ts
1367
+ var cloudflareAgentsChannels = defineChannels(
1368
+ "agents",
1369
+ {
1370
+ runAgentTool: channel({
1371
+ channelName: "Agent.runAgentTool",
1372
+ kind: "async"
1373
+ })
1374
+ },
1375
+ { instrumentationName: INSTRUMENTATION_NAMES.CLOUDFLARE_AGENTS }
1376
+ );
1377
+
1378
+ // src/instrumentation/config.ts
1379
+ var envIntegrationAliases = {
1380
+ openai: "openai",
1381
+ "openai-codex": "openaiCodexSDK",
1382
+ "openai-codex-sdk": "openaiCodexSDK",
1383
+ openaicodexsdk: "openaiCodexSDK",
1384
+ codex: "openaiCodexSDK",
1385
+ "codex-sdk": "openaiCodexSDK",
1386
+ "pi-coding-agent": "piCodingAgent",
1387
+ "pi-coding-agent-sdk": "piCodingAgent",
1388
+ picodingagent: "piCodingAgent",
1389
+ picodingagentsdk: "piCodingAgent",
1390
+ "@earendil-works/pi-coding-agent": "piCodingAgent",
1391
+ strandsAgentSDK: "strandsAgentSDK",
1392
+ strandsagentsdk: "strandsAgentSDK",
1393
+ "strands-agent-sdk": "strandsAgentSDK",
1394
+ "@strands-agents/sdk": "strandsAgentSDK",
1395
+ agents: "cloudflareAgents",
1396
+ "cloudflare-agents": "cloudflareAgents",
1397
+ cloudflareagents: "cloudflareAgents",
1398
+ anthropic: "anthropic",
1399
+ aisdk: "aisdk",
1400
+ "ai-sdk": "aisdk",
1401
+ "vercel-ai": "aisdk",
1402
+ vercel: "vercel",
1403
+ claudeagentsdk: "claudeAgentSDK",
1404
+ "claude-agent-sdk": "claudeAgentSDK",
1405
+ cloudflareaichat: "cloudflareAIChat",
1406
+ "cloudflare-ai-chat": "cloudflareAIChat",
1407
+ "@cloudflare/ai-chat": "cloudflareAIChat",
1408
+ cursor: "cursor",
1409
+ "cursor-sdk": "cursorSDK",
1410
+ cursorsdk: "cursorSDK",
1411
+ flue: "flue",
1412
+ "flue-runtime": "flue",
1413
+ mastra: "mastra",
1414
+ "openai-agents": "openAIAgents",
1415
+ openaiagents: "openAIAgents",
1416
+ "openai-agents-core": "openAIAgents",
1417
+ openaiagentscore: "openAIAgents",
1418
+ google: "google",
1419
+ "google-genai": "googleGenAI",
1420
+ googlegenai: "googleGenAI",
1421
+ huggingface: "huggingface",
1422
+ "@huggingface/transformers": "huggingface",
1423
+ transformers: "huggingface",
1424
+ openrouter: "openrouter",
1425
+ openrouteragent: "openrouterAgent",
1426
+ "openrouter-agent": "openrouterAgent",
1427
+ mistral: "mistral",
1428
+ googleadk: "googleADK",
1429
+ "google-adk": "googleADK",
1430
+ cohere: "cohere",
1431
+ groq: "groq",
1432
+ "groq-sdk": "groq",
1433
+ bedrock: "bedrock",
1434
+ "aws-bedrock": "awsBedrock",
1435
+ awsbedrock: "awsBedrock",
1436
+ "aws-bedrock-runtime": "awsBedrockRuntime",
1437
+ awsbedrockruntime: "awsBedrockRuntime",
1438
+ "@aws-sdk/client-bedrock-runtime": "awsBedrockRuntime",
1439
+ genkit: "genkit",
1440
+ "firebase-genkit": "genkit",
1441
+ githubcopilot: "gitHubCopilot",
1442
+ "github-copilot": "gitHubCopilot",
1443
+ "copilot-sdk": "gitHubCopilot",
1444
+ langchain: "langchain",
1445
+ "langchain-js": "langchain",
1446
+ "@langchain": "langchain",
1447
+ langgraph: "langgraph",
1448
+ langsmith: "langsmith"
1449
+ };
1450
+ function getDefaultInstrumentationIntegrations() {
1451
+ return {
1452
+ openai: true,
1453
+ openaiCodexSDK: true,
1454
+ anthropic: true,
1455
+ vercel: true,
1456
+ aisdk: true,
1457
+ google: true,
1458
+ googleGenAI: true,
1459
+ googleADK: true,
1460
+ huggingface: true,
1461
+ claudeAgentSDK: true,
1462
+ cloudflareAIChat: true,
1463
+ cursor: true,
1464
+ cursorSDK: true,
1465
+ flue: true,
1466
+ mastra: true,
1467
+ openAIAgents: true,
1468
+ openrouter: true,
1469
+ openrouterAgent: true,
1470
+ mistral: true,
1471
+ cohere: true,
1472
+ groq: true,
1473
+ bedrock: true,
1474
+ awsBedrock: true,
1475
+ awsBedrockRuntime: true,
1476
+ genkit: true,
1477
+ gitHubCopilot: true,
1478
+ langchain: true,
1479
+ langgraph: true,
1480
+ langsmith: true,
1481
+ piCodingAgent: true,
1482
+ strandsAgentSDK: true,
1483
+ cloudflareAgents: true
1484
+ };
1485
+ }
1486
+ function readDisabledInstrumentationEnvConfig(disabledList) {
1487
+ const integrations = {};
1488
+ if (disabledList) {
1489
+ for (const value of disabledList.split(",")) {
1490
+ const rawSdk = value.trim();
1491
+ const sdk = rawSdk.toLowerCase();
1492
+ if (sdk.length > 0) {
1493
+ integrations[envIntegrationAliases[rawSdk] ?? envIntegrationAliases[sdk] ?? sdk] = false;
1494
+ }
1495
+ }
1496
+ }
1497
+ return { integrations };
1498
+ }
1499
+ function isInstrumentationIntegrationDisabled(integrations, ...names) {
1500
+ return names.some((name) => integrations?.[name] === false);
1501
+ }
1502
+
1503
+ // src/auto-instrumentations/loader/mastra-observability-patch.ts
1504
+ var MASTRA_EXPORTER_FACTORY_GLOBAL = "__braintrustMastraExporterFactory";
1505
+ function installMastraExporterFactory(factory) {
1506
+ const globals = globalThis;
1507
+ globals[MASTRA_EXPORTER_FACTORY_GLOBAL] ??= factory;
1508
+ }
1509
+ var MASTRA_CORE_PACKAGE = "@mastra/core";
1510
+ var MASTRA_OBSERVABILITY_PACKAGE = "@mastra/observability";
1511
+ var MASTRA_CORE_ENTRY_PATHS = /* @__PURE__ */ new Set([
1512
+ "dist/index.js",
1513
+ "dist/index.cjs",
1514
+ "dist/mastra/index.js",
1515
+ "dist/mastra/index.cjs"
1516
+ ]);
1517
+ var MASTRA_OBSERVABILITY_ENTRY_PATHS = /* @__PURE__ */ new Set([
1518
+ "dist/index.js",
1519
+ "dist/index.cjs"
1520
+ ]);
1521
+ function classifyMastraTarget(packageName, modulePath) {
1522
+ if (packageName === MASTRA_CORE_PACKAGE && MASTRA_CORE_ENTRY_PATHS.has(modulePath)) {
1523
+ return "core";
1524
+ }
1525
+ if (packageName === MASTRA_OBSERVABILITY_PACKAGE && MASTRA_OBSERVABILITY_ENTRY_PATHS.has(modulePath)) {
1526
+ return "observability";
1527
+ }
1528
+ return null;
1529
+ }
1530
+ function extractChunkPath(source) {
1531
+ const esmMatch = source.match(
1532
+ /export\s*\{\s*Mastra(?:\s+as\s+\w+)?\s*\}\s*from\s*['"]([^'"]+)['"]/
1533
+ );
1534
+ if (esmMatch) return esmMatch[1];
1535
+ const cjsMatch = source.match(
1536
+ /require\s*\(\s*['"]([^'"]+chunk-[^'"]+)['"]\s*\)/
1537
+ );
1538
+ if (cjsMatch) return cjsMatch[1];
1539
+ return null;
1540
+ }
1541
+ var EXPORTER_FACTORY_KEY = JSON.stringify(MASTRA_EXPORTER_FACTORY_GLOBAL);
1542
+ var MASTRA_PROXY_HANDLER_BODY = `
1543
+ {
1544
+ construct(target, args, newTarget) {
1545
+ var firstArg = args[0];
1546
+ if (
1547
+ (!firstArg || typeof firstArg !== "object" || !firstArg.observability) &&
1548
+ __braintrustObservabilityClass
1549
+ ) {
1550
+ try {
1551
+ // serviceName is required by Mastra's Observability validator; pass
1552
+ // something sensible by default. Users who want a different name
1553
+ // should construct Observability themselves.
1554
+ var observability = new __braintrustObservabilityClass({
1555
+ configs: { default: { serviceName: "mastra" } },
1556
+ });
1557
+ args = args.slice();
1558
+ args[0] = Object.assign({}, firstArg, { observability: observability });
1559
+ } catch (e) {
1560
+ // Fall through. Mastra will use its own NoOp; user code still works,
1561
+ // just without auto-instrumentation.
1562
+ }
1563
+ }
1564
+ return Reflect.construct(target, args, newTarget);
1565
+ },
1566
+ }`;
1567
+ function buildMastraEsmWrapper(chunkPath) {
1568
+ const chunk = JSON.stringify(chunkPath);
1569
+ return `import { Mastra as __braintrustOrigMastra } from ${chunk};
1570
+ import { createRequire as __braintrustCreateRequire } from "node:module";
1571
+
1572
+ let __braintrustObservabilityClass = null;
1573
+ try {
1574
+ // Resolve @mastra/observability relative to this module (the Mastra entry),
1575
+ // so it's looked up from the user's node_modules tree.
1576
+ const __braintrustRequire = __braintrustCreateRequire(import.meta.url);
1577
+ __braintrustObservabilityClass =
1578
+ __braintrustRequire("@mastra/observability").Observability;
1579
+ } catch (e) {
1580
+ // @mastra/observability isn't installed; the construct trap will skip the
1581
+ // auto-construct branch and Mastra falls back to its own NoOp.
1582
+ }
1583
+ const Mastra = new Proxy(__braintrustOrigMastra, ${MASTRA_PROXY_HANDLER_BODY});
1584
+ export { Mastra };
1585
+ `;
1586
+ }
1587
+ function buildMastraCjsWrapper(chunkPath) {
1588
+ const chunk = JSON.stringify(chunkPath);
1589
+ return `'use strict';
1590
+ const __braintrustChunk = require(${chunk});
1591
+
1592
+ let __braintrustObservabilityClass = null;
1593
+ try {
1594
+ __braintrustObservabilityClass = require("@mastra/observability").Observability;
1595
+ } catch (e) {
1596
+ // @mastra/observability isn't installed; same fallback as the ESM wrapper.
1597
+ }
1598
+
1599
+ const __braintrustWrappedMastra = new Proxy(
1600
+ __braintrustChunk.Mastra,
1601
+ ${MASTRA_PROXY_HANDLER_BODY},
1602
+ );
1603
+ Object.defineProperty(exports, "Mastra", {
1604
+ enumerable: true,
1605
+ configurable: true,
1606
+ get: function () { return __braintrustWrappedMastra; }
1607
+ });
1608
+ `;
1609
+ }
1610
+ var OBSERVABILITY_APPEND_BODY = `
1611
+ ;(function __braintrustWrapObservability() {
1612
+ // Top-level so we can both read and reassign the var binding the original
1613
+ // entry declared.
1614
+ if (typeof Observability === "undefined") return;
1615
+ if (Observability.__braintrustWrapped) return;
1616
+ function __braintrustEnsureExporter(rawConfig) {
1617
+ try {
1618
+ var factory = globalThis[${EXPORTER_FACTORY_KEY}];
1619
+ if (typeof factory !== "function") return rawConfig;
1620
+ var config = rawConfig && typeof rawConfig === "object" ? rawConfig : {};
1621
+ var configsIn = config.configs && typeof config.configs === "object" ? config.configs : null;
1622
+ var configsOut = {};
1623
+ var hadEntries = false;
1624
+ if (configsIn) {
1625
+ for (var name in configsIn) {
1626
+ if (!Object.prototype.hasOwnProperty.call(configsIn, name)) continue;
1627
+ hadEntries = true;
1628
+ var inst = configsIn[name] || {};
1629
+ var existing = Array.isArray(inst.exporters) ? inst.exporters : [];
1630
+ var hasOurs = existing.some(function (e) { return e && e.name === "braintrust"; });
1631
+ configsOut[name] = Object.assign({}, inst, {
1632
+ exporters: hasOurs ? existing : existing.concat([factory()]),
1633
+ });
1634
+ }
1635
+ }
1636
+ if (!hadEntries) {
1637
+ configsOut.default = {
1638
+ serviceName: "mastra",
1639
+ exporters: [factory()],
1640
+ };
1641
+ }
1642
+ return Object.assign({}, config, { configs: configsOut });
1643
+ } catch (e) {
1644
+ return rawConfig;
1645
+ }
1646
+ }
1647
+ var __OriginalObservability = Observability;
1648
+ Observability = new Proxy(__OriginalObservability, {
1649
+ construct: function (target, args, newTarget) {
1650
+ var nextArgs = args.slice();
1651
+ nextArgs[0] = __braintrustEnsureExporter(nextArgs[0]);
1652
+ return Reflect.construct(target, nextArgs, newTarget);
1653
+ },
1654
+ });
1655
+ Observability.__braintrustWrapped = true;
1656
+ if (typeof exports !== "undefined" && exports && typeof exports === "object") {
1657
+ try {
1658
+ Object.defineProperty(exports, "Observability", {
1659
+ enumerable: true,
1660
+ configurable: true,
1661
+ get: function () { return Observability; },
1662
+ });
1663
+ } catch (e) {}
1664
+ }
1665
+ })();
1666
+ `;
1667
+ function patchMastraSource(source, target, format) {
1668
+ if (target === "core") {
1669
+ const chunkPath = extractChunkPath(source);
1670
+ if (!chunkPath) return source;
1671
+ return format === "esm" ? buildMastraEsmWrapper(chunkPath) : buildMastraCjsWrapper(chunkPath);
1672
+ }
1673
+ return source + OBSERVABILITY_APPEND_BODY;
1674
+ }
1675
+
1676
+ // src/instrumentation/plugins/openai-agents-channels.ts
1677
+ var openAIAgentsCoreChannels = defineChannels(
1678
+ "@openai/agents-core",
1679
+ {
1680
+ onTraceStart: channel({
1681
+ channelName: "tracing.processor.onTraceStart",
1682
+ kind: "async"
1683
+ }),
1684
+ onTraceEnd: channel({
1685
+ channelName: "tracing.processor.onTraceEnd",
1686
+ kind: "async"
1687
+ }),
1688
+ onSpanStart: channel({
1689
+ channelName: "tracing.processor.onSpanStart",
1690
+ kind: "async"
1691
+ }),
1692
+ onSpanEnd: channel({
1693
+ channelName: "tracing.processor.onSpanEnd",
1694
+ kind: "async"
1695
+ })
1696
+ },
1697
+ { instrumentationName: INSTRUMENTATION_NAMES.OPENAI_AGENTS }
1698
+ );
1699
+
1700
+ // src/instrumentation/plugins/langchain-channels.ts
1701
+ var langChainChannels = defineChannels(
1702
+ "@langchain/core",
1703
+ {
1704
+ configure: channel({
1705
+ channelName: "CallbackManager.configure",
1706
+ kind: "sync-stream"
1707
+ }),
1708
+ configureSync: channel({
1709
+ channelName: "CallbackManager._configureSync",
1710
+ kind: "sync-stream"
1711
+ })
1712
+ },
1713
+ { instrumentationName: INSTRUMENTATION_NAMES.LANGCHAIN }
1714
+ );
1715
+
1716
+ // src/instrumentation/plugins/cloudflare-ai-chat-channels.ts
1717
+ var cloudflareAIChatChannels = defineChannels(
1718
+ "@cloudflare/ai-chat",
1719
+ {
1720
+ runExclusiveChatTurn: channel({
1721
+ channelName: "AIChatAgent._runExclusiveChatTurn",
1722
+ kind: "async"
1723
+ }),
1724
+ onChatResponse: channel({
1725
+ channelName: "AIChatAgent.onChatResponse",
1726
+ kind: "sync-stream"
1727
+ })
1728
+ },
1729
+ { instrumentationName: INSTRUMENTATION_NAMES.CLOUDFLARE_AI_CHAT }
1730
+ );
1731
+
1732
+ export {
1733
+ __export,
1734
+ GLOBAL_INSTRUMENTATION_HOOKS_KEY,
1735
+ GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION,
1736
+ GLOBAL_INSTRUMENTATION_HOOKS_REGISTRY_BRAND,
1737
+ GLOBAL_INSTRUMENTATION_HOOK_BRAND,
1738
+ setGlobalHookErrorReporter,
1739
+ isomorph_default,
1740
+ INSTRUMENTATION_NAMES,
1741
+ withSpanInstrumentationName,
1742
+ getSpanInstrumentationName,
1743
+ detectSpanOriginEnvironment,
1744
+ mergeSpanOriginContext,
1745
+ openAIChannels,
1746
+ openAICodexChannels,
1747
+ anthropicChannels,
1748
+ aiSDKChannels,
1749
+ harnessAgentChannels,
1750
+ claudeAgentSDKChannels,
1751
+ cursorSDKChannels,
1752
+ openAIAgentsCoreChannels,
1753
+ googleGenAIChannels,
1754
+ huggingFaceChannels,
1755
+ isSupportedHuggingFaceTransformersTask,
1756
+ registerHuggingFaceTransformersPipeline,
1757
+ getHuggingFaceTransformersPipelineInfo,
1758
+ huggingFaceTransformersChannels,
1759
+ openRouterAgentChannels,
1760
+ openRouterChannels,
1761
+ mistralChannels,
1762
+ googleADKChannels,
1763
+ cohereChannels,
1764
+ groqChannels,
1765
+ bedrockRuntimeChannels,
1766
+ smithyCoreChannels,
1767
+ smithyClientChannels,
1768
+ genkitChannels,
1769
+ genkitCoreChannels,
1770
+ gitHubCopilotChannels,
1771
+ flueChannels,
1772
+ langChainChannels,
1773
+ langSmithChannels,
1774
+ piCodingAgentChannels,
1775
+ strandsAgentSDKChannels,
1776
+ cloudflareAIChatChannels,
1777
+ cloudflareAgentsChannels,
1778
+ getDefaultInstrumentationIntegrations,
1779
+ readDisabledInstrumentationEnvConfig,
1780
+ isInstrumentationIntegrationDisabled,
1781
+ installMastraExporterFactory,
1782
+ classifyMastraTarget,
1783
+ patchMastraSource
1784
+ };