braintrust 3.11.0 → 3.12.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 (75) hide show
  1. package/README.md +8 -8
  2. package/dev/dist/index.d.mts +1 -1
  3. package/dev/dist/index.d.ts +1 -1
  4. package/dev/dist/index.js +2607 -316
  5. package/dev/dist/index.mjs +2388 -97
  6. package/dist/apply-auto-instrumentation.browser.d.mts +2 -0
  7. package/dist/apply-auto-instrumentation.browser.d.ts +2 -0
  8. package/dist/apply-auto-instrumentation.browser.js +18 -0
  9. package/dist/apply-auto-instrumentation.browser.mjs +0 -0
  10. package/dist/apply-auto-instrumentation.d.mts +2 -0
  11. package/dist/apply-auto-instrumentation.d.ts +2 -0
  12. package/dist/apply-auto-instrumentation.js +2534 -0
  13. package/dist/apply-auto-instrumentation.mjs +2534 -0
  14. package/dist/auto-instrumentations/bundler/esbuild.cjs +1802 -1283
  15. package/dist/auto-instrumentations/bundler/esbuild.d.mts +9 -5
  16. package/dist/auto-instrumentations/bundler/esbuild.d.ts +9 -5
  17. package/dist/auto-instrumentations/bundler/esbuild.mjs +10 -2
  18. package/dist/auto-instrumentations/bundler/next.cjs +3268 -0
  19. package/dist/auto-instrumentations/bundler/next.d.mts +3 -0
  20. package/dist/auto-instrumentations/bundler/next.d.ts +3 -0
  21. package/dist/auto-instrumentations/bundler/next.mjs +189 -0
  22. package/dist/auto-instrumentations/bundler/rollup.cjs +1802 -1283
  23. package/dist/auto-instrumentations/bundler/rollup.d.mts +9 -5
  24. package/dist/auto-instrumentations/bundler/rollup.d.ts +9 -5
  25. package/dist/auto-instrumentations/bundler/rollup.mjs +10 -2
  26. package/dist/auto-instrumentations/bundler/vite.cjs +1802 -1283
  27. package/dist/auto-instrumentations/bundler/vite.d.mts +9 -5
  28. package/dist/auto-instrumentations/bundler/vite.d.ts +9 -5
  29. package/dist/auto-instrumentations/bundler/vite.mjs +10 -2
  30. package/dist/auto-instrumentations/bundler/webpack-loader.cjs +1860 -1308
  31. package/dist/auto-instrumentations/bundler/webpack-loader.d.ts +3 -3
  32. package/dist/auto-instrumentations/bundler/webpack.cjs +1802 -1283
  33. package/dist/auto-instrumentations/bundler/webpack.d.mts +9 -5
  34. package/dist/auto-instrumentations/bundler/webpack.d.ts +9 -5
  35. package/dist/auto-instrumentations/bundler/webpack.mjs +6 -6
  36. package/dist/auto-instrumentations/{chunk-DIV5TO4S.mjs → chunk-2DPA74KK.mjs} +337 -1
  37. package/dist/auto-instrumentations/chunk-73BZUKVI.mjs +300 -0
  38. package/dist/auto-instrumentations/chunk-AFXRW7I7.mjs +18 -0
  39. package/dist/auto-instrumentations/hook.mjs +1712 -1460
  40. package/dist/auto-instrumentations/index.cjs +93 -0
  41. package/dist/auto-instrumentations/index.d.mts +5 -1
  42. package/dist/auto-instrumentations/index.d.ts +5 -1
  43. package/dist/auto-instrumentations/index.mjs +6 -247
  44. package/dist/auto-instrumentations/loader/esm-hook.mjs +19 -2
  45. package/dist/auto-instrumentations/plugin-D7nDswtC.d.mts +44 -0
  46. package/dist/auto-instrumentations/plugin-D7nDswtC.d.ts +44 -0
  47. package/dist/browser.d.mts +120 -31
  48. package/dist/browser.d.ts +120 -31
  49. package/dist/browser.js +2395 -123
  50. package/dist/browser.mjs +2395 -123
  51. package/dist/chunk-BW4DF4CY.js +816 -0
  52. package/dist/chunk-MSLBGITU.mjs +816 -0
  53. package/dist/cli.js +2407 -96
  54. package/dist/edge-light.d.mts +1 -1
  55. package/dist/edge-light.d.ts +1 -1
  56. package/dist/edge-light.js +2395 -123
  57. package/dist/edge-light.mjs +2395 -123
  58. package/dist/index.d.mts +120 -31
  59. package/dist/index.d.ts +120 -31
  60. package/dist/index.js +3362 -1849
  61. package/dist/index.mjs +2505 -992
  62. package/dist/instrumentation/index.d.mts +7860 -48
  63. package/dist/instrumentation/index.d.ts +7860 -48
  64. package/dist/instrumentation/index.js +2395 -95
  65. package/dist/instrumentation/index.mjs +2394 -95
  66. package/dist/workerd.d.mts +1 -1
  67. package/dist/workerd.d.ts +1 -1
  68. package/dist/workerd.js +2395 -123
  69. package/dist/workerd.mjs +2395 -123
  70. package/package.json +23 -3
  71. package/util/dist/index.js +6 -0
  72. package/util/dist/index.mjs +6 -0
  73. package/dist/auto-instrumentations/chunk-G6ZWXGZB.mjs +0 -116
  74. package/dist/auto-instrumentations/plugin-Df3qKIl2.d.mts +0 -22
  75. package/dist/auto-instrumentations/plugin-Df3qKIl2.d.ts +0 -22
@@ -0,0 +1,816 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;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/auto-instrumentations/patch-tracing-channel.ts
8
+ function patchTracingChannel(tracingChannelFn) {
9
+ const dummyChannel = tracingChannelFn("__braintrust_probe__");
10
+ const TracingChannel = _optionalChain([dummyChannel, 'optionalAccess', _2 => _2.constructor]);
11
+ if (!_optionalChain([TracingChannel, 'optionalAccess', _3 => _3.prototype])) {
12
+ return;
13
+ }
14
+ if (!Object.getOwnPropertyDescriptor(TracingChannel.prototype, "hasSubscribers")) {
15
+ Object.defineProperty(TracingChannel.prototype, "hasSubscribers", {
16
+ configurable: true,
17
+ enumerable: false,
18
+ get() {
19
+ return Boolean(
20
+ _optionalChain([this, 'access', _4 => _4.start, 'optionalAccess', _5 => _5.hasSubscribers]) || _optionalChain([this, 'access', _6 => _6.end, 'optionalAccess', _7 => _7.hasSubscribers]) || _optionalChain([this, 'access', _8 => _8.asyncStart, 'optionalAccess', _9 => _9.hasSubscribers]) || _optionalChain([this, 'access', _10 => _10.asyncEnd, 'optionalAccess', _11 => _11.hasSubscribers]) || _optionalChain([this, 'access', _12 => _12.error, 'optionalAccess', _13 => _13.hasSubscribers])
21
+ );
22
+ }
23
+ });
24
+ }
25
+ if (TracingChannel.prototype.tracePromise) {
26
+ TracingChannel.prototype.tracePromise = function(fn, context = {}, thisArg, ...args) {
27
+ const start = this.start;
28
+ const end = this.end;
29
+ const asyncStart = this.asyncStart;
30
+ const asyncEnd = this.asyncEnd;
31
+ const error = this.error;
32
+ function publishRejected(err) {
33
+ context.error = err;
34
+ _optionalChain([error, 'optionalAccess', _14 => _14.publish, 'call', _15 => _15(context)]);
35
+ _optionalChain([asyncStart, 'optionalAccess', _16 => _16.publish, 'call', _17 => _17(context)]);
36
+ _optionalChain([asyncEnd, 'optionalAccess', _18 => _18.publish, 'call', _19 => _19(context)]);
37
+ }
38
+ function publishResolved(result) {
39
+ context.result = result;
40
+ _optionalChain([asyncStart, 'optionalAccess', _20 => _20.publish, 'call', _21 => _21(context)]);
41
+ _optionalChain([asyncEnd, 'optionalAccess', _22 => _22.publish, 'call', _23 => _23(context)]);
42
+ }
43
+ return start.runStores(context, () => {
44
+ try {
45
+ const result = Reflect.apply(fn, thisArg, args);
46
+ _optionalChain([end, 'optionalAccess', _24 => _24.publish, 'call', _25 => _25(context)]);
47
+ if (result && (typeof result === "object" || typeof result === "function") && typeof result.then === "function") {
48
+ if (result.constructor === Promise) {
49
+ return result.then(
50
+ (res) => {
51
+ publishResolved(res);
52
+ return res;
53
+ },
54
+ (err) => {
55
+ publishRejected(err);
56
+ return Promise.reject(err);
57
+ }
58
+ );
59
+ }
60
+ void result.then(
61
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
62
+ (resolved) => {
63
+ try {
64
+ publishResolved(resolved);
65
+ } catch (e) {
66
+ }
67
+ },
68
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
69
+ (err) => {
70
+ try {
71
+ publishRejected(err);
72
+ } catch (e2) {
73
+ }
74
+ }
75
+ );
76
+ return result;
77
+ }
78
+ context.result = result;
79
+ _optionalChain([asyncStart, 'optionalAccess', _26 => _26.publish, 'call', _27 => _27(context)]);
80
+ _optionalChain([asyncEnd, 'optionalAccess', _28 => _28.publish, 'call', _29 => _29(context)]);
81
+ return result;
82
+ } catch (err) {
83
+ context.error = err;
84
+ _optionalChain([error, 'optionalAccess', _30 => _30.publish, 'call', _31 => _31(context)]);
85
+ _optionalChain([end, 'optionalAccess', _32 => _32.publish, 'call', _33 => _33(context)]);
86
+ throw err;
87
+ }
88
+ });
89
+ };
90
+ }
91
+ }
92
+
93
+ // src/isomorph.ts
94
+ var DefaultAsyncLocalStorage = class {
95
+ constructor() {
96
+ }
97
+ enterWith(_) {
98
+ }
99
+ run(_, callback) {
100
+ return callback();
101
+ }
102
+ getStore() {
103
+ return void 0;
104
+ }
105
+ };
106
+ var DefaultChannel = (_class = class {
107
+ constructor(name) {;_class.prototype.__init.call(this);
108
+ this.name = name;
109
+ }
110
+ __init() {this.hasSubscribers = false}
111
+ subscribe(_subscription) {
112
+ }
113
+ unsubscribe(_subscription) {
114
+ return false;
115
+ }
116
+ bindStore(_store, _transform) {
117
+ }
118
+ unbindStore(_store) {
119
+ return false;
120
+ }
121
+ publish(_message) {
122
+ }
123
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
124
+ runStores(_message, fn, thisArg, ...args) {
125
+ return fn.apply(thisArg, args);
126
+ }
127
+ }, _class);
128
+ var DefaultTracingChannel = class {
129
+
130
+
131
+
132
+
133
+
134
+ constructor(nameOrChannels) {
135
+ if (typeof nameOrChannels === "string") {
136
+ this.start = new DefaultChannel(`tracing:${nameOrChannels}:start`);
137
+ this.end = new DefaultChannel(`tracing:${nameOrChannels}:end`);
138
+ this.asyncStart = new DefaultChannel(
139
+ `tracing:${nameOrChannels}:asyncStart`
140
+ );
141
+ this.asyncEnd = new DefaultChannel(`tracing:${nameOrChannels}:asyncEnd`);
142
+ this.error = new DefaultChannel(`tracing:${nameOrChannels}:error`);
143
+ return;
144
+ }
145
+ this.start = _nullishCoalesce(nameOrChannels.start, () => ( new DefaultChannel("tracing:start")));
146
+ this.end = _nullishCoalesce(nameOrChannels.end, () => ( new DefaultChannel("tracing:end")));
147
+ this.asyncStart = _nullishCoalesce(nameOrChannels.asyncStart, () => ( new DefaultChannel("tracing:asyncStart")));
148
+ this.asyncEnd = _nullishCoalesce(nameOrChannels.asyncEnd, () => ( new DefaultChannel("tracing:asyncEnd")));
149
+ this.error = _nullishCoalesce(nameOrChannels.error, () => ( new DefaultChannel("tracing:error")));
150
+ }
151
+ get hasSubscribers() {
152
+ return this.start.hasSubscribers || this.end.hasSubscribers || this.asyncStart.hasSubscribers || this.asyncEnd.hasSubscribers || this.error.hasSubscribers;
153
+ }
154
+ subscribe(_handlers) {
155
+ }
156
+ unsubscribe(_handlers) {
157
+ return false;
158
+ }
159
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
160
+ traceSync(fn, _message, thisArg, ...args) {
161
+ return fn.apply(thisArg, args);
162
+ }
163
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
164
+ tracePromise(fn, _message, thisArg, ...args) {
165
+ return fn.apply(thisArg, args);
166
+ }
167
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
168
+ traceCallback(fn, _position, _message, thisArg, ...args) {
169
+ return fn.apply(thisArg, args);
170
+ }
171
+ };
172
+ var iso = {
173
+ buildType: "unknown",
174
+ // Will be set by configureBrowser() or configureNode()
175
+ getRepoInfo: async (_settings) => void 0,
176
+ getPastNAncestors: async () => [],
177
+ getEnv: (_name) => void 0,
178
+ getCallerLocation: () => void 0,
179
+ newAsyncLocalStorage: () => new DefaultAsyncLocalStorage(),
180
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
181
+ newTracingChannel: (nameOrChannels) => new DefaultTracingChannel(nameOrChannels),
182
+ processOn: (_0, _1) => {
183
+ },
184
+ basename: (filepath) => filepath.split(/[\\/]/).pop() || filepath,
185
+ // eslint-disable-next-line no-restricted-properties -- preserving intentional console usage.
186
+ writeln: (text) => console.log(text)
187
+ };
188
+ var isomorph_default = iso;
189
+
190
+ // src/instrumentation/core/channel-definitions.ts
191
+ function channel(spec) {
192
+ return spec;
193
+ }
194
+ function defineChannels(pkg, channels) {
195
+ return Object.fromEntries(
196
+ Object.entries(channels).map(([key, spec]) => {
197
+ const fullChannelName = `orchestrion:${pkg}:${spec.channelName}`;
198
+ if (spec.kind === "async") {
199
+ const asyncSpec = spec;
200
+ const tracingChannel2 = () => isomorph_default.newTracingChannel(
201
+ fullChannelName
202
+ );
203
+ return [
204
+ key,
205
+ {
206
+ ...asyncSpec,
207
+ tracingChannel: tracingChannel2,
208
+ tracePromise: (fn, context) => tracingChannel2().tracePromise(
209
+ fn,
210
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
211
+ context
212
+ )
213
+ }
214
+ ];
215
+ }
216
+ const syncSpec = spec;
217
+ const tracingChannel = () => isomorph_default.newTracingChannel(
218
+ fullChannelName
219
+ );
220
+ return [
221
+ key,
222
+ {
223
+ ...syncSpec,
224
+ tracingChannel,
225
+ traceSync: (fn, context) => tracingChannel().traceSync(
226
+ fn,
227
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
228
+ context
229
+ )
230
+ }
231
+ ];
232
+ })
233
+ );
234
+ }
235
+
236
+ // src/instrumentation/plugins/openai-channels.ts
237
+ var openAIChannels = defineChannels("openai", {
238
+ chatCompletionsCreate: channel({
239
+ channelName: "chat.completions.create",
240
+ kind: "async"
241
+ }),
242
+ embeddingsCreate: channel({
243
+ channelName: "embeddings.create",
244
+ kind: "async"
245
+ }),
246
+ betaChatCompletionsParse: channel({
247
+ channelName: "beta.chat.completions.parse",
248
+ kind: "async"
249
+ }),
250
+ betaChatCompletionsStream: channel({
251
+ channelName: "beta.chat.completions.stream",
252
+ kind: "sync-stream"
253
+ }),
254
+ moderationsCreate: channel({
255
+ channelName: "moderations.create",
256
+ kind: "async"
257
+ }),
258
+ responsesCreate: channel({
259
+ channelName: "responses.create",
260
+ kind: "async"
261
+ }),
262
+ responsesStream: channel({
263
+ channelName: "responses.stream",
264
+ kind: "sync-stream"
265
+ }),
266
+ responsesParse: channel({
267
+ channelName: "responses.parse",
268
+ kind: "async"
269
+ }),
270
+ responsesCompact: channel({
271
+ channelName: "responses.compact",
272
+ kind: "async"
273
+ })
274
+ });
275
+
276
+ // src/instrumentation/plugins/openai-codex-channels.ts
277
+ var openAICodexChannels = defineChannels("@openai/codex-sdk", {
278
+ run: channel({
279
+ channelName: "Thread.run",
280
+ kind: "async"
281
+ }),
282
+ runStreamed: channel({
283
+ channelName: "Thread.runStreamed",
284
+ kind: "async"
285
+ })
286
+ });
287
+
288
+ // src/instrumentation/plugins/anthropic-channels.ts
289
+ var anthropicChannels = defineChannels("@anthropic-ai/sdk", {
290
+ messagesCreate: channel({
291
+ channelName: "messages.create",
292
+ kind: "async"
293
+ }),
294
+ betaMessagesCreate: channel({
295
+ channelName: "beta.messages.create",
296
+ kind: "async"
297
+ }),
298
+ betaMessagesToolRunner: channel({
299
+ channelName: "beta.messages.toolRunner",
300
+ kind: "sync-stream"
301
+ })
302
+ });
303
+
304
+ // src/instrumentation/plugins/ai-sdk-channels.ts
305
+ var aiSDKChannels = defineChannels("ai", {
306
+ generateText: channel({
307
+ channelName: "generateText",
308
+ kind: "async"
309
+ }),
310
+ streamText: channel({
311
+ channelName: "streamText",
312
+ kind: "async"
313
+ }),
314
+ streamTextSync: channel({
315
+ channelName: "streamText.sync",
316
+ kind: "sync-stream"
317
+ }),
318
+ generateObject: channel({
319
+ channelName: "generateObject",
320
+ kind: "async"
321
+ }),
322
+ streamObject: channel({
323
+ channelName: "streamObject",
324
+ kind: "async"
325
+ }),
326
+ streamObjectSync: channel({
327
+ channelName: "streamObject.sync",
328
+ kind: "sync-stream"
329
+ }),
330
+ embed: channel(
331
+ {
332
+ channelName: "embed",
333
+ kind: "async"
334
+ }
335
+ ),
336
+ embedMany: channel({
337
+ channelName: "embedMany",
338
+ kind: "async"
339
+ }),
340
+ rerank: channel({
341
+ channelName: "rerank",
342
+ kind: "async"
343
+ }),
344
+ agentGenerate: channel({
345
+ channelName: "Agent.generate",
346
+ kind: "async"
347
+ }),
348
+ agentStream: channel({
349
+ channelName: "Agent.stream",
350
+ kind: "async"
351
+ }),
352
+ agentStreamSync: channel({
353
+ channelName: "Agent.stream.sync",
354
+ kind: "sync-stream"
355
+ }),
356
+ toolLoopAgentGenerate: channel({
357
+ channelName: "ToolLoopAgent.generate",
358
+ kind: "async"
359
+ }),
360
+ toolLoopAgentStream: channel({
361
+ channelName: "ToolLoopAgent.stream",
362
+ kind: "async"
363
+ })
364
+ });
365
+
366
+ // src/instrumentation/plugins/claude-agent-sdk-channels.ts
367
+ var claudeAgentSDKChannels = defineChannels(
368
+ "@anthropic-ai/claude-agent-sdk",
369
+ {
370
+ query: channel({
371
+ channelName: "query",
372
+ kind: "sync-stream"
373
+ })
374
+ }
375
+ );
376
+
377
+ // src/instrumentation/plugins/cursor-sdk-channels.ts
378
+ var cursorSDKChannels = defineChannels("@cursor/sdk", {
379
+ create: channel({
380
+ channelName: "Agent.create",
381
+ kind: "async"
382
+ }),
383
+ resume: channel({
384
+ channelName: "Agent.resume",
385
+ kind: "async"
386
+ }),
387
+ prompt: channel({
388
+ channelName: "Agent.prompt",
389
+ kind: "async"
390
+ }),
391
+ send: channel({
392
+ channelName: "agent.send",
393
+ kind: "async"
394
+ })
395
+ });
396
+
397
+ // src/instrumentation/plugins/google-genai-channels.ts
398
+ var googleGenAIChannels = defineChannels("@google/genai", {
399
+ generateContent: channel({
400
+ channelName: "models.generateContent",
401
+ kind: "async"
402
+ }),
403
+ generateContentStream: channel({
404
+ channelName: "models.generateContentStream",
405
+ kind: "async"
406
+ }),
407
+ embedContent: channel({
408
+ channelName: "models.embedContent",
409
+ kind: "async"
410
+ })
411
+ });
412
+
413
+ // src/instrumentation/plugins/huggingface-channels.ts
414
+ var huggingFaceChannels = defineChannels("@huggingface/inference", {
415
+ chatCompletion: channel({
416
+ channelName: "chatCompletion",
417
+ kind: "async"
418
+ }),
419
+ chatCompletionStream: channel({
420
+ channelName: "chatCompletionStream",
421
+ kind: "sync-stream"
422
+ }),
423
+ textGeneration: channel({
424
+ channelName: "textGeneration",
425
+ kind: "async"
426
+ }),
427
+ textGenerationStream: channel({
428
+ channelName: "textGenerationStream",
429
+ kind: "sync-stream"
430
+ }),
431
+ featureExtraction: channel({
432
+ channelName: "featureExtraction",
433
+ kind: "async"
434
+ })
435
+ });
436
+
437
+ // src/instrumentation/plugins/openrouter-agent-channels.ts
438
+ var openRouterAgentChannels = defineChannels("@openrouter/agent", {
439
+ callModel: channel({
440
+ channelName: "callModel",
441
+ kind: "sync-stream"
442
+ }),
443
+ callModelTurn: channel({
444
+ channelName: "callModel.turn",
445
+ kind: "async"
446
+ }),
447
+ toolExecute: channel({
448
+ channelName: "tool.execute",
449
+ kind: "async"
450
+ })
451
+ });
452
+
453
+ // src/instrumentation/plugins/openrouter-channels.ts
454
+ var openRouterChannels = defineChannels("@openrouter/sdk", {
455
+ chatSend: channel({
456
+ channelName: "chat.send",
457
+ kind: "async"
458
+ }),
459
+ embeddingsGenerate: channel({
460
+ channelName: "embeddings.generate",
461
+ kind: "async"
462
+ }),
463
+ rerankRerank: channel(
464
+ {
465
+ channelName: "rerank.rerank",
466
+ kind: "async"
467
+ }
468
+ ),
469
+ betaResponsesSend: channel({
470
+ channelName: "beta.responses.send",
471
+ kind: "async"
472
+ }),
473
+ callModel: channel({
474
+ channelName: "callModel",
475
+ kind: "sync-stream"
476
+ }),
477
+ callModelTurn: channel({
478
+ channelName: "callModel.turn",
479
+ kind: "async"
480
+ }),
481
+ toolExecute: channel({
482
+ channelName: "tool.execute",
483
+ kind: "async"
484
+ })
485
+ });
486
+
487
+ // src/instrumentation/plugins/mistral-channels.ts
488
+ var mistralChannels = defineChannels("@mistralai/mistralai", {
489
+ chatComplete: channel({
490
+ channelName: "chat.complete",
491
+ kind: "async"
492
+ }),
493
+ chatStream: channel({
494
+ channelName: "chat.stream",
495
+ kind: "async"
496
+ }),
497
+ embeddingsCreate: channel({
498
+ channelName: "embeddings.create",
499
+ kind: "async"
500
+ }),
501
+ classifiersModerate: channel({
502
+ channelName: "classifiers.moderate",
503
+ kind: "async"
504
+ }),
505
+ classifiersModerateChat: channel({
506
+ channelName: "classifiers.moderateChat",
507
+ kind: "async"
508
+ }),
509
+ classifiersClassify: channel({
510
+ channelName: "classifiers.classify",
511
+ kind: "async"
512
+ }),
513
+ classifiersClassifyChat: channel({
514
+ channelName: "classifiers.classifyChat",
515
+ kind: "async"
516
+ }),
517
+ fimComplete: channel({
518
+ channelName: "fim.complete",
519
+ kind: "async"
520
+ }),
521
+ fimStream: channel({
522
+ channelName: "fim.stream",
523
+ kind: "async"
524
+ }),
525
+ agentsComplete: channel({
526
+ channelName: "agents.complete",
527
+ kind: "async"
528
+ }),
529
+ agentsStream: channel({
530
+ channelName: "agents.stream",
531
+ kind: "async"
532
+ })
533
+ });
534
+
535
+ // src/instrumentation/plugins/google-adk-channels.ts
536
+ var googleADKChannels = defineChannels("@google/adk", {
537
+ runnerRunAsync: channel({
538
+ channelName: "runner.runAsync",
539
+ kind: "sync-stream"
540
+ }),
541
+ agentRunAsync: channel({
542
+ channelName: "agent.runAsync",
543
+ kind: "sync-stream"
544
+ }),
545
+ toolRunAsync: channel({
546
+ channelName: "tool.runAsync",
547
+ kind: "async"
548
+ })
549
+ });
550
+
551
+ // src/instrumentation/plugins/cohere-channels.ts
552
+ var cohereChannels = defineChannels("cohere-ai", {
553
+ chat: channel({
554
+ channelName: "chat",
555
+ kind: "async"
556
+ }),
557
+ chatStream: channel({
558
+ channelName: "chatStream",
559
+ kind: "async"
560
+ }),
561
+ embed: channel({
562
+ channelName: "embed",
563
+ kind: "async"
564
+ }),
565
+ rerank: channel({
566
+ channelName: "rerank",
567
+ kind: "async"
568
+ })
569
+ });
570
+
571
+ // src/instrumentation/plugins/groq-channels.ts
572
+ var groqChannels = defineChannels("groq-sdk", {
573
+ chatCompletionsCreate: channel({
574
+ channelName: "chat.completions.create",
575
+ kind: "async"
576
+ }),
577
+ embeddingsCreate: channel(
578
+ {
579
+ channelName: "embeddings.create",
580
+ kind: "async"
581
+ }
582
+ )
583
+ });
584
+
585
+ // src/instrumentation/plugins/genkit-channels.ts
586
+ var genkitChannels = defineChannels("@genkit-ai/ai", {
587
+ generate: channel({
588
+ channelName: "generate",
589
+ kind: "async"
590
+ }),
591
+ generateStream: channel({
592
+ channelName: "generateStream",
593
+ kind: "sync-stream"
594
+ }),
595
+ embed: channel({
596
+ channelName: "embed",
597
+ kind: "async"
598
+ }),
599
+ embedMany: channel({
600
+ channelName: "embedMany",
601
+ kind: "async"
602
+ }),
603
+ actionRun: channel({
604
+ channelName: "action.run",
605
+ kind: "async"
606
+ }),
607
+ actionStream: channel({
608
+ channelName: "action.stream",
609
+ kind: "sync-stream"
610
+ })
611
+ });
612
+ var genkitCoreChannels = defineChannels("@genkit-ai/core", {
613
+ actionSpan: channel({
614
+ channelName: "action.span",
615
+ kind: "async"
616
+ })
617
+ });
618
+
619
+ // src/instrumentation/plugins/github-copilot-channels.ts
620
+ var gitHubCopilotChannels = defineChannels("@github/copilot-sdk", {
621
+ createSession: channel({
622
+ channelName: "client.createSession",
623
+ kind: "async"
624
+ }),
625
+ resumeSession: channel({
626
+ channelName: "client.resumeSession",
627
+ kind: "async"
628
+ }),
629
+ sendAndWait: channel({
630
+ channelName: "session.sendAndWait",
631
+ kind: "async"
632
+ })
633
+ });
634
+
635
+ // src/instrumentation/plugins/flue-channels.ts
636
+ var flueChannels = defineChannels("@flue/runtime", {
637
+ createContext: channel({
638
+ channelName: "createFlueContext",
639
+ kind: "sync-stream"
640
+ }),
641
+ openSession: channel({
642
+ channelName: "Harness.openSession",
643
+ kind: "async"
644
+ }),
645
+ contextEvent: channel({
646
+ channelName: "context.event",
647
+ kind: "sync-stream"
648
+ }),
649
+ prompt: channel({
650
+ channelName: "session.prompt",
651
+ kind: "async"
652
+ }),
653
+ skill: channel({
654
+ channelName: "session.skill",
655
+ kind: "async"
656
+ }),
657
+ task: channel({
658
+ channelName: "session.task",
659
+ kind: "async"
660
+ }),
661
+ compact: channel({
662
+ channelName: "session.compact",
663
+ kind: "async"
664
+ })
665
+ });
666
+
667
+ // src/instrumentation/config.ts
668
+ var envIntegrationAliases = {
669
+ openai: "openai",
670
+ "openai-codex": "openaiCodexSDK",
671
+ "openai-codex-sdk": "openaiCodexSDK",
672
+ openaicodexsdk: "openaiCodexSDK",
673
+ codex: "openaiCodexSDK",
674
+ "codex-sdk": "openaiCodexSDK",
675
+ anthropic: "anthropic",
676
+ aisdk: "aisdk",
677
+ "ai-sdk": "aisdk",
678
+ "vercel-ai": "aisdk",
679
+ vercel: "vercel",
680
+ claudeagentsdk: "claudeAgentSDK",
681
+ "claude-agent-sdk": "claudeAgentSDK",
682
+ cursor: "cursor",
683
+ "cursor-sdk": "cursorSDK",
684
+ cursorsdk: "cursorSDK",
685
+ flue: "flue",
686
+ "flue-runtime": "flue",
687
+ "openai-agents": "openAIAgents",
688
+ openaiagents: "openAIAgents",
689
+ "openai-agents-core": "openAIAgents",
690
+ openaiagentscore: "openAIAgents",
691
+ google: "google",
692
+ "google-genai": "googleGenAI",
693
+ googlegenai: "googleGenAI",
694
+ huggingface: "huggingface",
695
+ openrouter: "openrouter",
696
+ openrouteragent: "openrouterAgent",
697
+ "openrouter-agent": "openrouterAgent",
698
+ mistral: "mistral",
699
+ googleadk: "googleADK",
700
+ "google-adk": "googleADK",
701
+ cohere: "cohere",
702
+ groq: "groq",
703
+ "groq-sdk": "groq",
704
+ genkit: "genkit",
705
+ "firebase-genkit": "genkit",
706
+ githubcopilot: "gitHubCopilot",
707
+ "github-copilot": "gitHubCopilot",
708
+ "copilot-sdk": "gitHubCopilot",
709
+ langchain: "langchain",
710
+ "langchain-js": "langchain",
711
+ "@langchain": "langchain",
712
+ langgraph: "langgraph"
713
+ };
714
+ function getDefaultInstrumentationIntegrations() {
715
+ return {
716
+ openai: true,
717
+ openaiCodexSDK: true,
718
+ anthropic: true,
719
+ vercel: true,
720
+ aisdk: true,
721
+ google: true,
722
+ googleGenAI: true,
723
+ googleADK: true,
724
+ huggingface: true,
725
+ claudeAgentSDK: true,
726
+ cursor: true,
727
+ cursorSDK: true,
728
+ flue: true,
729
+ openAIAgents: true,
730
+ openrouter: true,
731
+ openrouterAgent: true,
732
+ mistral: true,
733
+ cohere: true,
734
+ groq: true,
735
+ genkit: true,
736
+ gitHubCopilot: true,
737
+ langchain: true,
738
+ langgraph: true
739
+ };
740
+ }
741
+ function readDisabledInstrumentationEnvConfig(disabledList) {
742
+ const integrations = {};
743
+ if (disabledList) {
744
+ for (const value of disabledList.split(",")) {
745
+ const sdk = value.trim().toLowerCase();
746
+ if (sdk.length > 0) {
747
+ integrations[_nullishCoalesce(envIntegrationAliases[sdk], () => ( sdk))] = false;
748
+ }
749
+ }
750
+ }
751
+ return { integrations };
752
+ }
753
+ function isInstrumentationIntegrationDisabled(integrations, ...names) {
754
+ return names.some((name) => _optionalChain([integrations, 'optionalAccess', _34 => _34[name]]) === false);
755
+ }
756
+
757
+ // src/instrumentation/plugins/openai-agents-channels.ts
758
+ var openAIAgentsCoreChannels = defineChannels("@openai/agents-core", {
759
+ onTraceStart: channel({
760
+ channelName: "tracing.processor.onTraceStart",
761
+ kind: "async"
762
+ }),
763
+ onTraceEnd: channel({
764
+ channelName: "tracing.processor.onTraceEnd",
765
+ kind: "async"
766
+ }),
767
+ onSpanStart: channel({
768
+ channelName: "tracing.processor.onSpanStart",
769
+ kind: "async"
770
+ }),
771
+ onSpanEnd: channel({
772
+ channelName: "tracing.processor.onSpanEnd",
773
+ kind: "async"
774
+ })
775
+ });
776
+
777
+ // src/instrumentation/plugins/langchain-channels.ts
778
+ var langChainChannels = defineChannels("@langchain/core", {
779
+ configure: channel({
780
+ channelName: "CallbackManager.configure",
781
+ kind: "sync-stream"
782
+ }),
783
+ configureSync: channel({
784
+ channelName: "CallbackManager._configureSync",
785
+ kind: "sync-stream"
786
+ })
787
+ });
788
+
789
+
790
+
791
+
792
+
793
+
794
+
795
+
796
+
797
+
798
+
799
+
800
+
801
+
802
+
803
+
804
+
805
+
806
+
807
+
808
+
809
+
810
+
811
+
812
+
813
+
814
+
815
+
816
+ exports.__export = __export; exports.patchTracingChannel = patchTracingChannel; exports.isomorph_default = isomorph_default; exports.openAIChannels = openAIChannels; exports.openAICodexChannels = openAICodexChannels; exports.anthropicChannels = anthropicChannels; exports.aiSDKChannels = aiSDKChannels; exports.claudeAgentSDKChannels = claudeAgentSDKChannels; exports.cursorSDKChannels = cursorSDKChannels; exports.openAIAgentsCoreChannels = openAIAgentsCoreChannels; exports.googleGenAIChannels = googleGenAIChannels; exports.huggingFaceChannels = huggingFaceChannels; exports.openRouterAgentChannels = openRouterAgentChannels; exports.openRouterChannels = openRouterChannels; exports.mistralChannels = mistralChannels; exports.googleADKChannels = googleADKChannels; exports.cohereChannels = cohereChannels; exports.groqChannels = groqChannels; exports.genkitChannels = genkitChannels; exports.genkitCoreChannels = genkitCoreChannels; exports.gitHubCopilotChannels = gitHubCopilotChannels; exports.flueChannels = flueChannels; exports.langChainChannels = langChainChannels; exports.getDefaultInstrumentationIntegrations = getDefaultInstrumentationIntegrations; exports.readDisabledInstrumentationEnvConfig = readDisabledInstrumentationEnvConfig; exports.isInstrumentationIntegrationDisabled = isInstrumentationIntegrationDisabled;