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,2534 @@
1
+ import {
2
+ aiSDKChannels,
3
+ anthropicChannels,
4
+ claudeAgentSDKChannels,
5
+ cohereChannels,
6
+ cursorSDKChannels,
7
+ flueChannels,
8
+ genkitChannels,
9
+ genkitCoreChannels,
10
+ gitHubCopilotChannels,
11
+ googleADKChannels,
12
+ googleGenAIChannels,
13
+ groqChannels,
14
+ huggingFaceChannels,
15
+ isInstrumentationIntegrationDisabled,
16
+ langChainChannels,
17
+ mistralChannels,
18
+ openAIAgentsCoreChannels,
19
+ openAIChannels,
20
+ openAICodexChannels,
21
+ openRouterAgentChannels,
22
+ openRouterChannels,
23
+ patchTracingChannel,
24
+ readDisabledInstrumentationEnvConfig
25
+ } from "./chunk-MSLBGITU.mjs";
26
+
27
+ // src/node/apply-auto-instrumentation-entry.ts
28
+ import * as diagnostics_channel from "node:diagnostics_channel";
29
+ import { register } from "node:module";
30
+ import { pathToFileURL } from "node:url";
31
+
32
+ // src/auto-instrumentations/configs/ai-sdk.ts
33
+ var aiSDKConfigs = [
34
+ // generateText - async function
35
+ {
36
+ channelName: aiSDKChannels.generateText.channelName,
37
+ module: {
38
+ name: "ai",
39
+ versionRange: ">=3.0.0",
40
+ filePath: "dist/index.mjs"
41
+ },
42
+ functionQuery: {
43
+ functionName: "generateText",
44
+ kind: "Async"
45
+ }
46
+ },
47
+ {
48
+ channelName: aiSDKChannels.generateText.channelName,
49
+ module: {
50
+ name: "ai",
51
+ versionRange: ">=3.0.0",
52
+ filePath: "dist/index.js"
53
+ },
54
+ functionQuery: {
55
+ functionName: "generateText",
56
+ kind: "Async"
57
+ }
58
+ },
59
+ // streamText - async function (v3 only, before the sync refactor in v4)
60
+ {
61
+ channelName: aiSDKChannels.streamText.channelName,
62
+ module: {
63
+ name: "ai",
64
+ versionRange: ">=3.0.0 <4.0.0",
65
+ filePath: "dist/index.mjs"
66
+ },
67
+ functionQuery: {
68
+ functionName: "streamText",
69
+ kind: "Async"
70
+ }
71
+ },
72
+ // streamText - sync function returning stream (v4+)
73
+ {
74
+ channelName: aiSDKChannels.streamTextSync.channelName,
75
+ module: {
76
+ name: "ai",
77
+ versionRange: ">=4.0.0",
78
+ filePath: "dist/index.mjs"
79
+ },
80
+ functionQuery: {
81
+ functionName: "streamText",
82
+ kind: "Sync"
83
+ }
84
+ },
85
+ {
86
+ channelName: aiSDKChannels.streamText.channelName,
87
+ module: {
88
+ name: "ai",
89
+ versionRange: ">=3.0.0 <4.0.0",
90
+ filePath: "dist/index.js"
91
+ },
92
+ functionQuery: {
93
+ functionName: "streamText",
94
+ kind: "Async"
95
+ }
96
+ },
97
+ {
98
+ channelName: aiSDKChannels.streamTextSync.channelName,
99
+ module: {
100
+ name: "ai",
101
+ versionRange: ">=4.0.0",
102
+ filePath: "dist/index.js"
103
+ },
104
+ functionQuery: {
105
+ functionName: "streamText",
106
+ kind: "Sync"
107
+ }
108
+ },
109
+ // generateObject - async function
110
+ {
111
+ channelName: aiSDKChannels.generateObject.channelName,
112
+ module: {
113
+ name: "ai",
114
+ versionRange: ">=3.0.0",
115
+ filePath: "dist/index.mjs"
116
+ },
117
+ functionQuery: {
118
+ functionName: "generateObject",
119
+ kind: "Async"
120
+ }
121
+ },
122
+ {
123
+ channelName: aiSDKChannels.generateObject.channelName,
124
+ module: {
125
+ name: "ai",
126
+ versionRange: ">=3.0.0",
127
+ filePath: "dist/index.js"
128
+ },
129
+ functionQuery: {
130
+ functionName: "generateObject",
131
+ kind: "Async"
132
+ }
133
+ },
134
+ // embed - async function
135
+ {
136
+ channelName: aiSDKChannels.embed.channelName,
137
+ module: {
138
+ name: "ai",
139
+ versionRange: ">=3.0.0",
140
+ filePath: "dist/index.mjs"
141
+ },
142
+ functionQuery: {
143
+ functionName: "embed",
144
+ kind: "Async"
145
+ }
146
+ },
147
+ {
148
+ channelName: aiSDKChannels.embed.channelName,
149
+ module: {
150
+ name: "ai",
151
+ versionRange: ">=3.0.0",
152
+ filePath: "dist/index.js"
153
+ },
154
+ functionQuery: {
155
+ functionName: "embed",
156
+ kind: "Async"
157
+ }
158
+ },
159
+ // embedMany - async function
160
+ {
161
+ channelName: aiSDKChannels.embedMany.channelName,
162
+ module: {
163
+ name: "ai",
164
+ versionRange: ">=3.0.0",
165
+ filePath: "dist/index.mjs"
166
+ },
167
+ functionQuery: {
168
+ functionName: "embedMany",
169
+ kind: "Async"
170
+ }
171
+ },
172
+ {
173
+ channelName: aiSDKChannels.embedMany.channelName,
174
+ module: {
175
+ name: "ai",
176
+ versionRange: ">=3.0.0",
177
+ filePath: "dist/index.js"
178
+ },
179
+ functionQuery: {
180
+ functionName: "embedMany",
181
+ kind: "Async"
182
+ }
183
+ },
184
+ // rerank - async function
185
+ {
186
+ channelName: aiSDKChannels.rerank.channelName,
187
+ module: {
188
+ name: "ai",
189
+ versionRange: ">=5.0.0",
190
+ filePath: "dist/index.mjs"
191
+ },
192
+ functionQuery: {
193
+ functionName: "rerank",
194
+ kind: "Async"
195
+ }
196
+ },
197
+ {
198
+ channelName: aiSDKChannels.rerank.channelName,
199
+ module: {
200
+ name: "ai",
201
+ versionRange: ">=5.0.0",
202
+ filePath: "dist/index.js"
203
+ },
204
+ functionQuery: {
205
+ functionName: "rerank",
206
+ kind: "Async"
207
+ }
208
+ },
209
+ // streamObject - async function (v3 only, before the sync refactor in v4)
210
+ {
211
+ channelName: aiSDKChannels.streamObject.channelName,
212
+ module: {
213
+ name: "ai",
214
+ versionRange: ">=3.0.0 <4.0.0",
215
+ filePath: "dist/index.mjs"
216
+ },
217
+ functionQuery: {
218
+ functionName: "streamObject",
219
+ kind: "Async"
220
+ }
221
+ },
222
+ // streamObject - sync function returning stream (v4+)
223
+ {
224
+ channelName: aiSDKChannels.streamObjectSync.channelName,
225
+ module: {
226
+ name: "ai",
227
+ versionRange: ">=4.0.0",
228
+ filePath: "dist/index.mjs"
229
+ },
230
+ functionQuery: {
231
+ functionName: "streamObject",
232
+ kind: "Sync"
233
+ }
234
+ },
235
+ {
236
+ channelName: aiSDKChannels.streamObject.channelName,
237
+ module: {
238
+ name: "ai",
239
+ versionRange: ">=3.0.0 <4.0.0",
240
+ filePath: "dist/index.js"
241
+ },
242
+ functionQuery: {
243
+ functionName: "streamObject",
244
+ kind: "Async"
245
+ }
246
+ },
247
+ {
248
+ channelName: aiSDKChannels.streamObjectSync.channelName,
249
+ module: {
250
+ name: "ai",
251
+ versionRange: ">=4.0.0",
252
+ filePath: "dist/index.js"
253
+ },
254
+ functionQuery: {
255
+ functionName: "streamObject",
256
+ kind: "Sync"
257
+ }
258
+ },
259
+ // Agent.generate - async method (v5 only)
260
+ // The compiled AI SDK bundle emits this as an anonymous class method, so we
261
+ // target the first async `generate` method in the file instead of a class name.
262
+ {
263
+ channelName: aiSDKChannels.agentGenerate.channelName,
264
+ module: {
265
+ name: "ai",
266
+ versionRange: ">=5.0.0 <6.0.0",
267
+ filePath: "dist/index.mjs"
268
+ },
269
+ functionQuery: {
270
+ methodName: "generate",
271
+ kind: "Async",
272
+ index: 0
273
+ }
274
+ },
275
+ {
276
+ channelName: aiSDKChannels.agentGenerate.channelName,
277
+ module: {
278
+ name: "ai",
279
+ versionRange: ">=5.0.0 <6.0.0",
280
+ filePath: "dist/index.js"
281
+ },
282
+ functionQuery: {
283
+ methodName: "generate",
284
+ kind: "Async",
285
+ index: 0
286
+ }
287
+ },
288
+ // Agent.stream - sync method (v5 only)
289
+ // The compiled AI SDK bundle emits this as an anonymous class method, so we
290
+ // target the first sync `stream` method in the file instead of a class name.
291
+ {
292
+ channelName: aiSDKChannels.agentStreamSync.channelName,
293
+ module: {
294
+ name: "ai",
295
+ versionRange: ">=5.0.0 <6.0.0",
296
+ filePath: "dist/index.mjs"
297
+ },
298
+ functionQuery: {
299
+ methodName: "stream",
300
+ kind: "Sync",
301
+ index: 0
302
+ }
303
+ },
304
+ {
305
+ channelName: aiSDKChannels.agentStreamSync.channelName,
306
+ module: {
307
+ name: "ai",
308
+ versionRange: ">=5.0.0 <6.0.0",
309
+ filePath: "dist/index.js"
310
+ },
311
+ functionQuery: {
312
+ methodName: "stream",
313
+ kind: "Sync",
314
+ index: 0
315
+ }
316
+ },
317
+ // ToolLoopAgent.generate - async method (v6 only, Experimental_Agent is an alias)
318
+ // The compiled AI SDK bundle emits this as an anonymous class method, so we
319
+ // target the first async `generate` method in the file instead of a class name.
320
+ {
321
+ channelName: aiSDKChannels.toolLoopAgentGenerate.channelName,
322
+ module: {
323
+ name: "ai",
324
+ versionRange: ">=6.0.0 <7.0.0",
325
+ filePath: "dist/index.mjs"
326
+ },
327
+ functionQuery: {
328
+ methodName: "generate",
329
+ kind: "Async",
330
+ index: 0
331
+ }
332
+ },
333
+ {
334
+ channelName: aiSDKChannels.toolLoopAgentGenerate.channelName,
335
+ module: {
336
+ name: "ai",
337
+ versionRange: ">=6.0.0 <7.0.0",
338
+ filePath: "dist/index.js"
339
+ },
340
+ functionQuery: {
341
+ methodName: "generate",
342
+ kind: "Async",
343
+ index: 0
344
+ }
345
+ },
346
+ // ToolLoopAgent.stream - async method (v6 only, Experimental_Agent is an alias)
347
+ // The compiled AI SDK bundle emits this as an anonymous class method, so we
348
+ // target the first async `stream` method in the file instead of a class name.
349
+ {
350
+ channelName: aiSDKChannels.toolLoopAgentStream.channelName,
351
+ module: {
352
+ name: "ai",
353
+ versionRange: ">=6.0.0 <7.0.0",
354
+ filePath: "dist/index.mjs"
355
+ },
356
+ functionQuery: {
357
+ methodName: "stream",
358
+ kind: "Async",
359
+ index: 0
360
+ }
361
+ },
362
+ {
363
+ channelName: aiSDKChannels.toolLoopAgentStream.channelName,
364
+ module: {
365
+ name: "ai",
366
+ versionRange: ">=6.0.0 <7.0.0",
367
+ filePath: "dist/index.js"
368
+ },
369
+ functionQuery: {
370
+ methodName: "stream",
371
+ kind: "Async",
372
+ index: 0
373
+ }
374
+ }
375
+ ];
376
+
377
+ // src/auto-instrumentations/configs/anthropic.ts
378
+ var anthropicConfigs = [
379
+ // Messages API - create in older SDK layouts (supports streaming via stream=true parameter)
380
+ {
381
+ channelName: anthropicChannels.messagesCreate.channelName,
382
+ module: {
383
+ name: "@anthropic-ai/sdk",
384
+ versionRange: ">=0.27.0 <0.39.0",
385
+ filePath: "resources/messages.mjs"
386
+ },
387
+ functionQuery: {
388
+ className: "Messages",
389
+ methodName: "create",
390
+ kind: "Async"
391
+ }
392
+ },
393
+ // Messages API - create (supports streaming via stream=true parameter)
394
+ {
395
+ channelName: anthropicChannels.messagesCreate.channelName,
396
+ module: {
397
+ name: "@anthropic-ai/sdk",
398
+ versionRange: ">=0.39.0",
399
+ filePath: "resources/messages/messages.mjs"
400
+ },
401
+ functionQuery: {
402
+ className: "Messages",
403
+ methodName: "create",
404
+ kind: "Async"
405
+ }
406
+ },
407
+ // Beta Messages API - create (supports streaming via stream=true parameter)
408
+ {
409
+ channelName: anthropicChannels.betaMessagesCreate.channelName,
410
+ module: {
411
+ name: "@anthropic-ai/sdk",
412
+ versionRange: ">=0.39.0",
413
+ filePath: "resources/beta/messages/messages.mjs"
414
+ },
415
+ functionQuery: {
416
+ className: "Messages",
417
+ methodName: "create",
418
+ kind: "Async"
419
+ }
420
+ },
421
+ // Beta Messages API - toolRunner (sync helper returning async iterable/thenable)
422
+ {
423
+ channelName: anthropicChannels.betaMessagesToolRunner.channelName,
424
+ module: {
425
+ name: "@anthropic-ai/sdk",
426
+ versionRange: ">=0.39.0",
427
+ filePath: "resources/beta/messages/messages.mjs"
428
+ },
429
+ functionQuery: {
430
+ className: "Messages",
431
+ methodName: "toolRunner",
432
+ kind: "Sync"
433
+ }
434
+ }
435
+ ];
436
+
437
+ // src/auto-instrumentations/configs/claude-agent-sdk.ts
438
+ var claudeAgentSDKConfigs = [
439
+ // query - Main entry point for agent interactions. The SDK returns an async
440
+ // iterable, but the exported query function itself is synchronous.
441
+ {
442
+ channelName: claudeAgentSDKChannels.query.channelName,
443
+ module: {
444
+ name: "@anthropic-ai/claude-agent-sdk",
445
+ versionRange: ">=0.1.0 <0.2.0",
446
+ filePath: "sdk.mjs"
447
+ },
448
+ functionQuery: {
449
+ functionName: "query",
450
+ kind: "Sync"
451
+ }
452
+ },
453
+ {
454
+ channelName: claudeAgentSDKChannels.query.channelName,
455
+ module: {
456
+ name: "@anthropic-ai/claude-agent-sdk",
457
+ versionRange: ">=0.2.0",
458
+ filePath: "sdk.mjs"
459
+ },
460
+ functionQuery: {
461
+ functionName: "query",
462
+ kind: "Sync",
463
+ isExportAlias: true
464
+ }
465
+ }
466
+ ];
467
+
468
+ // src/auto-instrumentations/configs/cohere.ts
469
+ var cohereConfigs = [
470
+ {
471
+ channelName: cohereChannels.chat.channelName,
472
+ module: {
473
+ name: "cohere-ai",
474
+ versionRange: ">=7.0.0 <8.0.0",
475
+ filePath: "Client.js"
476
+ },
477
+ functionQuery: {
478
+ className: "CohereClient",
479
+ methodName: "chat",
480
+ kind: "Async"
481
+ }
482
+ },
483
+ {
484
+ channelName: cohereChannels.chat.channelName,
485
+ module: {
486
+ name: "cohere-ai",
487
+ versionRange: ">=7.0.0 <7.21.0",
488
+ filePath: "api/resources/v2/client/Client.js"
489
+ },
490
+ functionQuery: {
491
+ className: "V2",
492
+ methodName: "chat",
493
+ kind: "Async"
494
+ }
495
+ },
496
+ {
497
+ channelName: cohereChannels.chat.channelName,
498
+ module: {
499
+ name: "cohere-ai",
500
+ versionRange: ">=7.21.0 <8.0.0",
501
+ filePath: "api/resources/v2/client/Client.js"
502
+ },
503
+ functionQuery: {
504
+ className: "V2Client",
505
+ methodName: "chat",
506
+ kind: "Async"
507
+ }
508
+ },
509
+ {
510
+ channelName: cohereChannels.chat.channelName,
511
+ module: {
512
+ name: "cohere-ai",
513
+ versionRange: ">=8.0.0 <9.0.0",
514
+ filePath: "Client.js"
515
+ },
516
+ functionQuery: {
517
+ className: "CohereClient",
518
+ methodName: "chat",
519
+ kind: "Async"
520
+ }
521
+ },
522
+ {
523
+ channelName: cohereChannels.chat.channelName,
524
+ module: {
525
+ name: "cohere-ai",
526
+ versionRange: ">=8.0.0 <9.0.0",
527
+ filePath: "api/resources/v2/client/Client.js"
528
+ },
529
+ functionQuery: {
530
+ className: "V2Client",
531
+ methodName: "chat",
532
+ kind: "Async"
533
+ }
534
+ },
535
+ {
536
+ channelName: cohereChannels.chatStream.channelName,
537
+ module: {
538
+ name: "cohere-ai",
539
+ versionRange: ">=7.0.0 <8.0.0",
540
+ filePath: "Client.js"
541
+ },
542
+ functionQuery: {
543
+ className: "CohereClient",
544
+ methodName: "chatStream",
545
+ kind: "Async"
546
+ }
547
+ },
548
+ {
549
+ channelName: cohereChannels.chatStream.channelName,
550
+ module: {
551
+ name: "cohere-ai",
552
+ versionRange: ">=7.0.0 <7.21.0",
553
+ filePath: "api/resources/v2/client/Client.js"
554
+ },
555
+ functionQuery: {
556
+ className: "V2",
557
+ methodName: "chatStream",
558
+ kind: "Async"
559
+ }
560
+ },
561
+ {
562
+ channelName: cohereChannels.chatStream.channelName,
563
+ module: {
564
+ name: "cohere-ai",
565
+ versionRange: ">=7.21.0 <8.0.0",
566
+ filePath: "api/resources/v2/client/Client.js"
567
+ },
568
+ functionQuery: {
569
+ className: "V2Client",
570
+ methodName: "chatStream",
571
+ kind: "Async"
572
+ }
573
+ },
574
+ {
575
+ channelName: cohereChannels.chatStream.channelName,
576
+ module: {
577
+ name: "cohere-ai",
578
+ versionRange: ">=8.0.0 <9.0.0",
579
+ filePath: "Client.js"
580
+ },
581
+ functionQuery: {
582
+ className: "CohereClient",
583
+ methodName: "chatStream",
584
+ kind: "Async"
585
+ }
586
+ },
587
+ {
588
+ channelName: cohereChannels.chatStream.channelName,
589
+ module: {
590
+ name: "cohere-ai",
591
+ versionRange: ">=8.0.0 <9.0.0",
592
+ filePath: "api/resources/v2/client/Client.js"
593
+ },
594
+ functionQuery: {
595
+ className: "V2Client",
596
+ methodName: "chatStream",
597
+ kind: "Async"
598
+ }
599
+ },
600
+ {
601
+ channelName: cohereChannels.embed.channelName,
602
+ module: {
603
+ name: "cohere-ai",
604
+ versionRange: ">=7.0.0 <8.0.0",
605
+ filePath: "Client.js"
606
+ },
607
+ functionQuery: {
608
+ className: "CohereClient",
609
+ methodName: "embed",
610
+ kind: "Async"
611
+ }
612
+ },
613
+ {
614
+ channelName: cohereChannels.embed.channelName,
615
+ module: {
616
+ name: "cohere-ai",
617
+ versionRange: ">=7.0.0 <7.21.0",
618
+ filePath: "api/resources/v2/client/Client.js"
619
+ },
620
+ functionQuery: {
621
+ className: "V2",
622
+ methodName: "embed",
623
+ kind: "Async"
624
+ }
625
+ },
626
+ {
627
+ channelName: cohereChannels.embed.channelName,
628
+ module: {
629
+ name: "cohere-ai",
630
+ versionRange: ">=7.21.0 <8.0.0",
631
+ filePath: "api/resources/v2/client/Client.js"
632
+ },
633
+ functionQuery: {
634
+ className: "V2Client",
635
+ methodName: "embed",
636
+ kind: "Async"
637
+ }
638
+ },
639
+ {
640
+ channelName: cohereChannels.embed.channelName,
641
+ module: {
642
+ name: "cohere-ai",
643
+ versionRange: ">=8.0.0 <9.0.0",
644
+ filePath: "Client.js"
645
+ },
646
+ functionQuery: {
647
+ className: "CohereClient",
648
+ methodName: "embed",
649
+ kind: "Async"
650
+ }
651
+ },
652
+ {
653
+ channelName: cohereChannels.embed.channelName,
654
+ module: {
655
+ name: "cohere-ai",
656
+ versionRange: ">=8.0.0 <9.0.0",
657
+ filePath: "api/resources/v2/client/Client.js"
658
+ },
659
+ functionQuery: {
660
+ className: "V2Client",
661
+ methodName: "embed",
662
+ kind: "Async"
663
+ }
664
+ },
665
+ {
666
+ channelName: cohereChannels.rerank.channelName,
667
+ module: {
668
+ name: "cohere-ai",
669
+ versionRange: ">=7.0.0 <8.0.0",
670
+ filePath: "Client.js"
671
+ },
672
+ functionQuery: {
673
+ className: "CohereClient",
674
+ methodName: "rerank",
675
+ kind: "Async"
676
+ }
677
+ },
678
+ {
679
+ channelName: cohereChannels.rerank.channelName,
680
+ module: {
681
+ name: "cohere-ai",
682
+ versionRange: ">=7.0.0 <7.21.0",
683
+ filePath: "api/resources/v2/client/Client.js"
684
+ },
685
+ functionQuery: {
686
+ className: "V2",
687
+ methodName: "rerank",
688
+ kind: "Async"
689
+ }
690
+ },
691
+ {
692
+ channelName: cohereChannels.rerank.channelName,
693
+ module: {
694
+ name: "cohere-ai",
695
+ versionRange: ">=7.21.0 <8.0.0",
696
+ filePath: "api/resources/v2/client/Client.js"
697
+ },
698
+ functionQuery: {
699
+ className: "V2Client",
700
+ methodName: "rerank",
701
+ kind: "Async"
702
+ }
703
+ },
704
+ {
705
+ channelName: cohereChannels.rerank.channelName,
706
+ module: {
707
+ name: "cohere-ai",
708
+ versionRange: ">=8.0.0 <9.0.0",
709
+ filePath: "Client.js"
710
+ },
711
+ functionQuery: {
712
+ className: "CohereClient",
713
+ methodName: "rerank",
714
+ kind: "Async"
715
+ }
716
+ },
717
+ {
718
+ channelName: cohereChannels.rerank.channelName,
719
+ module: {
720
+ name: "cohere-ai",
721
+ versionRange: ">=8.0.0 <9.0.0",
722
+ filePath: "api/resources/v2/client/Client.js"
723
+ },
724
+ functionQuery: {
725
+ className: "V2Client",
726
+ methodName: "rerank",
727
+ kind: "Async"
728
+ }
729
+ }
730
+ ];
731
+
732
+ // src/auto-instrumentations/configs/cursor-sdk.ts
733
+ var cursorSDKVersionRange = ">=1.0.7 <2.0.0";
734
+ var cursorSDKEntrypoints = ["dist/esm/index.js", "dist/cjs/index.js"];
735
+ var cursorSDKConfigs = cursorSDKEntrypoints.flatMap((filePath) => [
736
+ {
737
+ channelName: cursorSDKChannels.create.channelName,
738
+ module: {
739
+ name: "@cursor/sdk",
740
+ versionRange: cursorSDKVersionRange,
741
+ filePath
742
+ },
743
+ functionQuery: {
744
+ className: "Agent",
745
+ methodName: "create",
746
+ kind: "Async"
747
+ }
748
+ },
749
+ {
750
+ channelName: cursorSDKChannels.resume.channelName,
751
+ module: {
752
+ name: "@cursor/sdk",
753
+ versionRange: cursorSDKVersionRange,
754
+ filePath
755
+ },
756
+ functionQuery: {
757
+ className: "Agent",
758
+ methodName: "resume",
759
+ kind: "Async"
760
+ }
761
+ },
762
+ {
763
+ channelName: cursorSDKChannels.prompt.channelName,
764
+ module: {
765
+ name: "@cursor/sdk",
766
+ versionRange: cursorSDKVersionRange,
767
+ filePath
768
+ },
769
+ functionQuery: {
770
+ className: "Agent",
771
+ methodName: "prompt",
772
+ kind: "Async"
773
+ }
774
+ }
775
+ ]);
776
+
777
+ // src/auto-instrumentations/configs/flue.ts
778
+ var flueVersionRange = ">=0.7.0 <0.8.0";
779
+ var flueConfigs = [
780
+ {
781
+ channelName: flueChannels.createContext.channelName,
782
+ module: {
783
+ name: "@flue/runtime",
784
+ versionRange: flueVersionRange,
785
+ filePath: "dist/internal.mjs"
786
+ },
787
+ functionQuery: {
788
+ functionName: "createFlueContext",
789
+ kind: "Sync"
790
+ }
791
+ },
792
+ {
793
+ channelName: flueChannels.openSession.channelName,
794
+ module: {
795
+ name: "@flue/runtime",
796
+ versionRange: flueVersionRange,
797
+ filePath: "dist/internal.mjs"
798
+ },
799
+ functionQuery: {
800
+ className: "Harness",
801
+ methodName: "openSession",
802
+ kind: "Async"
803
+ }
804
+ }
805
+ ];
806
+
807
+ // src/auto-instrumentations/configs/genkit.ts
808
+ var genkitVersionRange = ">=1.0.0 <2.0.0";
809
+ var genkitConfigs = [
810
+ {
811
+ channelName: genkitChannels.generate.channelName,
812
+ module: {
813
+ name: "@genkit-ai/ai",
814
+ versionRange: genkitVersionRange,
815
+ filePath: "lib/genkit-ai.mjs"
816
+ },
817
+ functionQuery: {
818
+ className: "GenkitAI",
819
+ methodName: "generate",
820
+ kind: "Async"
821
+ }
822
+ },
823
+ {
824
+ channelName: genkitChannels.generate.channelName,
825
+ module: {
826
+ name: "@genkit-ai/ai",
827
+ versionRange: genkitVersionRange,
828
+ filePath: "lib/genkit-ai.js"
829
+ },
830
+ functionQuery: {
831
+ className: "GenkitAI",
832
+ methodName: "generate",
833
+ kind: "Async"
834
+ }
835
+ },
836
+ {
837
+ channelName: genkitChannels.generateStream.channelName,
838
+ module: {
839
+ name: "@genkit-ai/ai",
840
+ versionRange: genkitVersionRange,
841
+ filePath: "lib/genkit-ai.mjs"
842
+ },
843
+ functionQuery: {
844
+ className: "GenkitAI",
845
+ methodName: "generateStream",
846
+ kind: "Sync"
847
+ }
848
+ },
849
+ {
850
+ channelName: genkitChannels.generateStream.channelName,
851
+ module: {
852
+ name: "@genkit-ai/ai",
853
+ versionRange: genkitVersionRange,
854
+ filePath: "lib/genkit-ai.js"
855
+ },
856
+ functionQuery: {
857
+ className: "GenkitAI",
858
+ methodName: "generateStream",
859
+ kind: "Sync"
860
+ }
861
+ },
862
+ {
863
+ channelName: genkitChannels.embed.channelName,
864
+ module: {
865
+ name: "@genkit-ai/ai",
866
+ versionRange: genkitVersionRange,
867
+ filePath: "lib/genkit-ai.mjs"
868
+ },
869
+ functionQuery: {
870
+ className: "GenkitAI",
871
+ methodName: "embed",
872
+ kind: "Async"
873
+ }
874
+ },
875
+ {
876
+ channelName: genkitChannels.embed.channelName,
877
+ module: {
878
+ name: "@genkit-ai/ai",
879
+ versionRange: genkitVersionRange,
880
+ filePath: "lib/genkit-ai.js"
881
+ },
882
+ functionQuery: {
883
+ className: "GenkitAI",
884
+ methodName: "embed",
885
+ kind: "Async"
886
+ }
887
+ },
888
+ {
889
+ channelName: genkitChannels.embedMany.channelName,
890
+ module: {
891
+ name: "@genkit-ai/ai",
892
+ versionRange: genkitVersionRange,
893
+ filePath: "lib/genkit-ai.mjs"
894
+ },
895
+ functionQuery: {
896
+ className: "GenkitAI",
897
+ methodName: "embedMany",
898
+ kind: "Async"
899
+ }
900
+ },
901
+ {
902
+ channelName: genkitChannels.embedMany.channelName,
903
+ module: {
904
+ name: "@genkit-ai/ai",
905
+ versionRange: genkitVersionRange,
906
+ filePath: "lib/genkit-ai.js"
907
+ },
908
+ functionQuery: {
909
+ className: "GenkitAI",
910
+ methodName: "embedMany",
911
+ kind: "Async"
912
+ }
913
+ },
914
+ {
915
+ channelName: genkitChannels.actionRun.channelName,
916
+ module: {
917
+ name: "@genkit-ai/ai",
918
+ versionRange: genkitVersionRange,
919
+ filePath: "lib/genkit-ai.mjs"
920
+ },
921
+ functionQuery: {
922
+ className: "GenkitAI",
923
+ methodName: "run",
924
+ kind: "Async"
925
+ }
926
+ },
927
+ {
928
+ channelName: genkitChannels.actionRun.channelName,
929
+ module: {
930
+ name: "@genkit-ai/ai",
931
+ versionRange: genkitVersionRange,
932
+ filePath: "lib/genkit-ai.js"
933
+ },
934
+ functionQuery: {
935
+ className: "GenkitAI",
936
+ methodName: "run",
937
+ kind: "Async"
938
+ }
939
+ },
940
+ {
941
+ channelName: genkitCoreChannels.actionSpan.channelName,
942
+ module: {
943
+ name: "@genkit-ai/core",
944
+ versionRange: genkitVersionRange,
945
+ filePath: "lib/tracing/instrumentation.mjs"
946
+ },
947
+ functionQuery: {
948
+ functionName: "runInNewSpan",
949
+ kind: "Async"
950
+ }
951
+ },
952
+ {
953
+ channelName: genkitCoreChannels.actionSpan.channelName,
954
+ module: {
955
+ name: "@genkit-ai/core",
956
+ versionRange: genkitVersionRange,
957
+ filePath: "lib/tracing/instrumentation.js"
958
+ },
959
+ functionQuery: {
960
+ functionName: "runInNewSpan",
961
+ kind: "Async"
962
+ }
963
+ }
964
+ ];
965
+
966
+ // src/auto-instrumentations/configs/github-copilot.ts
967
+ var gitHubCopilotConfigs = [
968
+ // ESM: CopilotClient.createSession
969
+ {
970
+ channelName: gitHubCopilotChannels.createSession.channelName,
971
+ module: {
972
+ name: "@github/copilot-sdk",
973
+ versionRange: ">=0.3.0",
974
+ filePath: "dist/client.js"
975
+ },
976
+ functionQuery: {
977
+ className: "CopilotClient",
978
+ methodName: "createSession",
979
+ kind: "Async"
980
+ }
981
+ },
982
+ // CJS: CopilotClient.createSession
983
+ {
984
+ channelName: gitHubCopilotChannels.createSession.channelName,
985
+ module: {
986
+ name: "@github/copilot-sdk",
987
+ versionRange: ">=0.3.0",
988
+ filePath: "dist/cjs/client.js"
989
+ },
990
+ functionQuery: {
991
+ className: "CopilotClient",
992
+ methodName: "createSession",
993
+ kind: "Async"
994
+ }
995
+ },
996
+ // ESM: CopilotClient.resumeSession
997
+ {
998
+ channelName: gitHubCopilotChannels.resumeSession.channelName,
999
+ module: {
1000
+ name: "@github/copilot-sdk",
1001
+ versionRange: ">=0.3.0",
1002
+ filePath: "dist/client.js"
1003
+ },
1004
+ functionQuery: {
1005
+ className: "CopilotClient",
1006
+ methodName: "resumeSession",
1007
+ kind: "Async"
1008
+ }
1009
+ },
1010
+ // CJS: CopilotClient.resumeSession
1011
+ {
1012
+ channelName: gitHubCopilotChannels.resumeSession.channelName,
1013
+ module: {
1014
+ name: "@github/copilot-sdk",
1015
+ versionRange: ">=0.3.0",
1016
+ filePath: "dist/cjs/client.js"
1017
+ },
1018
+ functionQuery: {
1019
+ className: "CopilotClient",
1020
+ methodName: "resumeSession",
1021
+ kind: "Async"
1022
+ }
1023
+ },
1024
+ // ESM: CopilotSession.sendAndWait
1025
+ {
1026
+ channelName: gitHubCopilotChannels.sendAndWait.channelName,
1027
+ module: {
1028
+ name: "@github/copilot-sdk",
1029
+ versionRange: ">=0.3.0",
1030
+ filePath: "dist/session.js"
1031
+ },
1032
+ functionQuery: {
1033
+ className: "CopilotSession",
1034
+ methodName: "sendAndWait",
1035
+ kind: "Async"
1036
+ }
1037
+ },
1038
+ // CJS: CopilotSession.sendAndWait
1039
+ {
1040
+ channelName: gitHubCopilotChannels.sendAndWait.channelName,
1041
+ module: {
1042
+ name: "@github/copilot-sdk",
1043
+ versionRange: ">=0.3.0",
1044
+ filePath: "dist/cjs/session.js"
1045
+ },
1046
+ functionQuery: {
1047
+ className: "CopilotSession",
1048
+ methodName: "sendAndWait",
1049
+ kind: "Async"
1050
+ }
1051
+ }
1052
+ ];
1053
+
1054
+ // src/auto-instrumentations/configs/google-adk.ts
1055
+ var googleADKVersionRange = ">=0.1.0";
1056
+ var googleADKBundledIndexV06VersionRange = ">=0.6.1 <0.7.0";
1057
+ var googleADKBundledIndexV1VersionRange = ">=1.0.0 <2.0.0";
1058
+ var googleADKConfigs = [
1059
+ // --- Runner.runAsync --- async generator, kind "Sync" + sync-stream channel
1060
+ // Runner.runAsync — ESM individual module file
1061
+ {
1062
+ channelName: googleADKChannels.runnerRunAsync.channelName,
1063
+ module: {
1064
+ name: "@google/adk",
1065
+ versionRange: googleADKVersionRange,
1066
+ filePath: "dist/esm/runner/runner.js"
1067
+ },
1068
+ functionQuery: {
1069
+ className: "Runner",
1070
+ methodName: "runAsync",
1071
+ kind: "Sync"
1072
+ }
1073
+ },
1074
+ // Runner.runAsync — bundled CJS/ESM indexes
1075
+ // The bundled entrypoints minify class names, so target the 12th sync
1076
+ // `runAsync` method in file order rather than a class name. This mapping is
1077
+ // only validated against the current 0.6.x bundle layout, so keep the range
1078
+ // tight until we verify newer bundled outputs.
1079
+ {
1080
+ channelName: googleADKChannels.runnerRunAsync.channelName,
1081
+ module: {
1082
+ name: "@google/adk",
1083
+ versionRange: googleADKBundledIndexV06VersionRange,
1084
+ filePath: "dist/cjs/index.js"
1085
+ },
1086
+ functionQuery: {
1087
+ methodName: "runAsync",
1088
+ kind: "Sync",
1089
+ index: 11
1090
+ }
1091
+ },
1092
+ {
1093
+ channelName: googleADKChannels.runnerRunAsync.channelName,
1094
+ module: {
1095
+ name: "@google/adk",
1096
+ versionRange: googleADKBundledIndexV06VersionRange,
1097
+ filePath: "dist/esm/index.js"
1098
+ },
1099
+ functionQuery: {
1100
+ methodName: "runAsync",
1101
+ kind: "Sync",
1102
+ index: 11
1103
+ }
1104
+ },
1105
+ // The 1.x bundled entrypoints still inline the runtime into index.js, but
1106
+ // the minified method order changed. These indices are verified against 1.0.0.
1107
+ {
1108
+ channelName: googleADKChannels.runnerRunAsync.channelName,
1109
+ module: {
1110
+ name: "@google/adk",
1111
+ versionRange: googleADKBundledIndexV1VersionRange,
1112
+ filePath: "dist/cjs/index.js"
1113
+ },
1114
+ functionQuery: {
1115
+ methodName: "runAsync",
1116
+ kind: "Sync",
1117
+ index: 12
1118
+ }
1119
+ },
1120
+ {
1121
+ channelName: googleADKChannels.runnerRunAsync.channelName,
1122
+ module: {
1123
+ name: "@google/adk",
1124
+ versionRange: googleADKBundledIndexV1VersionRange,
1125
+ filePath: "dist/esm/index.js"
1126
+ },
1127
+ functionQuery: {
1128
+ methodName: "runAsync",
1129
+ kind: "Sync",
1130
+ index: 12
1131
+ }
1132
+ },
1133
+ // --- BaseAgent.runAsync --- async generator, kind "Sync" + sync-stream channel
1134
+ // BaseAgent.runAsync — ESM individual module file
1135
+ {
1136
+ channelName: googleADKChannels.agentRunAsync.channelName,
1137
+ module: {
1138
+ name: "@google/adk",
1139
+ versionRange: googleADKVersionRange,
1140
+ filePath: "dist/esm/agents/base_agent.js"
1141
+ },
1142
+ functionQuery: {
1143
+ className: "BaseAgent",
1144
+ methodName: "runAsync",
1145
+ kind: "Sync"
1146
+ }
1147
+ },
1148
+ // BaseAgent.runAsync — bundled CJS/ESM indexes
1149
+ // The bundled entrypoints minify class names, so target the first sync
1150
+ // `runAsync` method in file order rather than a class name. This mapping is
1151
+ // only validated against the current 0.6.x bundle layout, so keep the range
1152
+ // tight until we verify newer bundled outputs.
1153
+ {
1154
+ channelName: googleADKChannels.agentRunAsync.channelName,
1155
+ module: {
1156
+ name: "@google/adk",
1157
+ versionRange: googleADKBundledIndexV06VersionRange,
1158
+ filePath: "dist/cjs/index.js"
1159
+ },
1160
+ functionQuery: {
1161
+ methodName: "runAsync",
1162
+ kind: "Sync",
1163
+ index: 0
1164
+ }
1165
+ },
1166
+ {
1167
+ channelName: googleADKChannels.agentRunAsync.channelName,
1168
+ module: {
1169
+ name: "@google/adk",
1170
+ versionRange: googleADKBundledIndexV06VersionRange,
1171
+ filePath: "dist/esm/index.js"
1172
+ },
1173
+ functionQuery: {
1174
+ methodName: "runAsync",
1175
+ kind: "Sync",
1176
+ index: 0
1177
+ }
1178
+ },
1179
+ // The 1.x bundled entrypoints keep BaseAgent.runAsync as the first bundled
1180
+ // async-generator runAsync method in file order.
1181
+ {
1182
+ channelName: googleADKChannels.agentRunAsync.channelName,
1183
+ module: {
1184
+ name: "@google/adk",
1185
+ versionRange: googleADKBundledIndexV1VersionRange,
1186
+ filePath: "dist/cjs/index.js"
1187
+ },
1188
+ functionQuery: {
1189
+ methodName: "runAsync",
1190
+ kind: "Sync",
1191
+ index: 0
1192
+ }
1193
+ },
1194
+ {
1195
+ channelName: googleADKChannels.agentRunAsync.channelName,
1196
+ module: {
1197
+ name: "@google/adk",
1198
+ versionRange: googleADKBundledIndexV1VersionRange,
1199
+ filePath: "dist/esm/index.js"
1200
+ },
1201
+ functionQuery: {
1202
+ methodName: "runAsync",
1203
+ kind: "Sync",
1204
+ index: 0
1205
+ }
1206
+ },
1207
+ // --- FunctionTool.runAsync --- regular async, kind "Async"
1208
+ // FunctionTool.runAsync — ESM individual module file
1209
+ {
1210
+ channelName: googleADKChannels.toolRunAsync.channelName,
1211
+ module: {
1212
+ name: "@google/adk",
1213
+ versionRange: googleADKVersionRange,
1214
+ filePath: "dist/esm/tools/function_tool.js"
1215
+ },
1216
+ functionQuery: {
1217
+ className: "FunctionTool",
1218
+ methodName: "runAsync",
1219
+ kind: "Async"
1220
+ }
1221
+ },
1222
+ // FunctionTool.runAsync — bundled CJS/ESM indexes
1223
+ // The bundled entrypoints minify class names, so target the first async
1224
+ // `runAsync` method in file order rather than a class name. This mapping is
1225
+ // only validated against the current 0.6.x bundle layout, so keep the range
1226
+ // tight until we verify newer bundled outputs.
1227
+ {
1228
+ channelName: googleADKChannels.toolRunAsync.channelName,
1229
+ module: {
1230
+ name: "@google/adk",
1231
+ versionRange: googleADKBundledIndexV06VersionRange,
1232
+ filePath: "dist/cjs/index.js"
1233
+ },
1234
+ functionQuery: {
1235
+ methodName: "runAsync",
1236
+ kind: "Async",
1237
+ index: 1
1238
+ }
1239
+ },
1240
+ {
1241
+ channelName: googleADKChannels.toolRunAsync.channelName,
1242
+ module: {
1243
+ name: "@google/adk",
1244
+ versionRange: googleADKBundledIndexV06VersionRange,
1245
+ filePath: "dist/esm/index.js"
1246
+ },
1247
+ functionQuery: {
1248
+ methodName: "runAsync",
1249
+ kind: "Async",
1250
+ index: 1
1251
+ }
1252
+ },
1253
+ // The 1.x bundle moves FunctionTool.runAsync behind one helper method.
1254
+ {
1255
+ channelName: googleADKChannels.toolRunAsync.channelName,
1256
+ module: {
1257
+ name: "@google/adk",
1258
+ versionRange: googleADKBundledIndexV1VersionRange,
1259
+ filePath: "dist/cjs/index.js"
1260
+ },
1261
+ functionQuery: {
1262
+ methodName: "runAsync",
1263
+ kind: "Async",
1264
+ index: 1
1265
+ }
1266
+ },
1267
+ {
1268
+ channelName: googleADKChannels.toolRunAsync.channelName,
1269
+ module: {
1270
+ name: "@google/adk",
1271
+ versionRange: googleADKBundledIndexV1VersionRange,
1272
+ filePath: "dist/esm/index.js"
1273
+ },
1274
+ functionQuery: {
1275
+ methodName: "runAsync",
1276
+ kind: "Async",
1277
+ index: 1
1278
+ }
1279
+ }
1280
+ ];
1281
+
1282
+ // src/auto-instrumentations/configs/google-genai.ts
1283
+ var googleGenAIConfigs = [
1284
+ // Models.generateContentInternal - The actual class method (Node.js entry point)
1285
+ // Note: generateContent is an arrow function property that calls this internal method
1286
+ {
1287
+ channelName: googleGenAIChannels.generateContent.channelName,
1288
+ module: {
1289
+ name: "@google/genai",
1290
+ versionRange: ">=1.0.0",
1291
+ filePath: "dist/node/index.mjs"
1292
+ },
1293
+ functionQuery: {
1294
+ className: "Models",
1295
+ methodName: "generateContentInternal",
1296
+ kind: "Async"
1297
+ }
1298
+ },
1299
+ // Models.generateContentStreamInternal - The actual class method (Node.js entry point)
1300
+ // Note: generateContentStream is an arrow function property that calls this internal method
1301
+ {
1302
+ channelName: googleGenAIChannels.generateContentStream.channelName,
1303
+ module: {
1304
+ name: "@google/genai",
1305
+ versionRange: ">=1.0.0",
1306
+ filePath: "dist/node/index.mjs"
1307
+ },
1308
+ functionQuery: {
1309
+ className: "Models",
1310
+ methodName: "generateContentStreamInternal",
1311
+ kind: "Async"
1312
+ }
1313
+ },
1314
+ // Models.embedContent - class method in older SDK versions
1315
+ {
1316
+ channelName: googleGenAIChannels.embedContent.channelName,
1317
+ module: {
1318
+ name: "@google/genai",
1319
+ versionRange: ">=1.0.0 <1.44.0",
1320
+ filePath: "dist/node/index.mjs"
1321
+ },
1322
+ functionQuery: {
1323
+ className: "Models",
1324
+ methodName: "embedContent",
1325
+ kind: "Async"
1326
+ }
1327
+ },
1328
+ // Models.embedContentInternal - class method in newer SDK versions
1329
+ // Note: embedContent is an arrow function property that calls this method
1330
+ {
1331
+ channelName: googleGenAIChannels.embedContent.channelName,
1332
+ module: {
1333
+ name: "@google/genai",
1334
+ versionRange: ">=1.44.0",
1335
+ filePath: "dist/node/index.mjs"
1336
+ },
1337
+ functionQuery: {
1338
+ className: "Models",
1339
+ methodName: "embedContentInternal",
1340
+ kind: "Async"
1341
+ }
1342
+ }
1343
+ ];
1344
+
1345
+ // src/auto-instrumentations/configs/groq.ts
1346
+ var groqConfigs = [
1347
+ {
1348
+ channelName: groqChannels.chatCompletionsCreate.channelName,
1349
+ module: {
1350
+ name: "groq-sdk",
1351
+ versionRange: ">=1.0.0",
1352
+ filePath: "resources/chat/completions.mjs"
1353
+ },
1354
+ functionQuery: {
1355
+ className: "Completions",
1356
+ methodName: "create",
1357
+ kind: "Async"
1358
+ }
1359
+ },
1360
+ {
1361
+ channelName: groqChannels.embeddingsCreate.channelName,
1362
+ module: {
1363
+ name: "groq-sdk",
1364
+ versionRange: ">=1.0.0",
1365
+ filePath: "resources/embeddings.mjs"
1366
+ },
1367
+ functionQuery: {
1368
+ className: "Embeddings",
1369
+ methodName: "create",
1370
+ kind: "Async"
1371
+ }
1372
+ }
1373
+ ];
1374
+
1375
+ // src/auto-instrumentations/configs/huggingface.ts
1376
+ var huggingFaceConfigs = [
1377
+ {
1378
+ channelName: huggingFaceChannels.chatCompletion.channelName,
1379
+ module: {
1380
+ name: "@huggingface/inference",
1381
+ versionRange: ">=2.0.0 <3.0.0",
1382
+ filePath: "dist/index.js"
1383
+ },
1384
+ functionQuery: {
1385
+ functionName: "chatCompletion",
1386
+ kind: "Async"
1387
+ }
1388
+ },
1389
+ {
1390
+ channelName: huggingFaceChannels.chatCompletion.channelName,
1391
+ module: {
1392
+ name: "@huggingface/inference",
1393
+ versionRange: ">=2.0.0 <3.0.0",
1394
+ filePath: "dist/index.cjs"
1395
+ },
1396
+ functionQuery: {
1397
+ functionName: "chatCompletion",
1398
+ kind: "Async"
1399
+ }
1400
+ },
1401
+ {
1402
+ channelName: huggingFaceChannels.chatCompletionStream.channelName,
1403
+ module: {
1404
+ name: "@huggingface/inference",
1405
+ versionRange: ">=2.0.0 <3.0.0",
1406
+ filePath: "dist/index.js"
1407
+ },
1408
+ functionQuery: {
1409
+ functionName: "chatCompletionStream",
1410
+ kind: "Sync"
1411
+ }
1412
+ },
1413
+ {
1414
+ channelName: huggingFaceChannels.chatCompletionStream.channelName,
1415
+ module: {
1416
+ name: "@huggingface/inference",
1417
+ versionRange: ">=2.0.0 <3.0.0",
1418
+ filePath: "dist/index.cjs"
1419
+ },
1420
+ functionQuery: {
1421
+ functionName: "chatCompletionStream",
1422
+ kind: "Sync"
1423
+ }
1424
+ },
1425
+ {
1426
+ channelName: huggingFaceChannels.textGeneration.channelName,
1427
+ module: {
1428
+ name: "@huggingface/inference",
1429
+ versionRange: ">=2.0.0 <3.0.0",
1430
+ filePath: "dist/index.js"
1431
+ },
1432
+ functionQuery: {
1433
+ functionName: "textGeneration",
1434
+ kind: "Async"
1435
+ }
1436
+ },
1437
+ {
1438
+ channelName: huggingFaceChannels.textGeneration.channelName,
1439
+ module: {
1440
+ name: "@huggingface/inference",
1441
+ versionRange: ">=2.0.0 <3.0.0",
1442
+ filePath: "dist/index.cjs"
1443
+ },
1444
+ functionQuery: {
1445
+ functionName: "textGeneration",
1446
+ kind: "Async"
1447
+ }
1448
+ },
1449
+ {
1450
+ channelName: huggingFaceChannels.textGenerationStream.channelName,
1451
+ module: {
1452
+ name: "@huggingface/inference",
1453
+ versionRange: ">=2.0.0 <3.0.0",
1454
+ filePath: "dist/index.js"
1455
+ },
1456
+ functionQuery: {
1457
+ functionName: "textGenerationStream",
1458
+ kind: "Sync"
1459
+ }
1460
+ },
1461
+ {
1462
+ channelName: huggingFaceChannels.textGenerationStream.channelName,
1463
+ module: {
1464
+ name: "@huggingface/inference",
1465
+ versionRange: ">=2.0.0 <3.0.0",
1466
+ filePath: "dist/index.cjs"
1467
+ },
1468
+ functionQuery: {
1469
+ functionName: "textGenerationStream",
1470
+ kind: "Sync"
1471
+ }
1472
+ },
1473
+ {
1474
+ channelName: huggingFaceChannels.featureExtraction.channelName,
1475
+ module: {
1476
+ name: "@huggingface/inference",
1477
+ versionRange: ">=2.0.0 <3.0.0",
1478
+ filePath: "dist/index.js"
1479
+ },
1480
+ functionQuery: {
1481
+ functionName: "featureExtraction",
1482
+ kind: "Async"
1483
+ }
1484
+ },
1485
+ {
1486
+ channelName: huggingFaceChannels.featureExtraction.channelName,
1487
+ module: {
1488
+ name: "@huggingface/inference",
1489
+ versionRange: ">=2.0.0 <3.0.0",
1490
+ filePath: "dist/index.cjs"
1491
+ },
1492
+ functionQuery: {
1493
+ functionName: "featureExtraction",
1494
+ kind: "Async"
1495
+ }
1496
+ },
1497
+ {
1498
+ channelName: huggingFaceChannels.chatCompletion.channelName,
1499
+ module: {
1500
+ name: "@huggingface/inference",
1501
+ versionRange: ">=3.0.0 <5.0.0",
1502
+ filePath: "dist/esm/tasks/nlp/chatCompletion.js"
1503
+ },
1504
+ functionQuery: {
1505
+ functionName: "chatCompletion",
1506
+ kind: "Async"
1507
+ }
1508
+ },
1509
+ {
1510
+ channelName: huggingFaceChannels.chatCompletion.channelName,
1511
+ module: {
1512
+ name: "@huggingface/inference",
1513
+ versionRange: ">=3.0.0 <5.0.0",
1514
+ filePath: "dist/commonjs/tasks/nlp/chatCompletion.js"
1515
+ },
1516
+ functionQuery: {
1517
+ functionName: "chatCompletion",
1518
+ kind: "Async"
1519
+ }
1520
+ },
1521
+ {
1522
+ channelName: huggingFaceChannels.chatCompletionStream.channelName,
1523
+ module: {
1524
+ name: "@huggingface/inference",
1525
+ versionRange: ">=3.0.0 <5.0.0",
1526
+ filePath: "dist/esm/tasks/nlp/chatCompletionStream.js"
1527
+ },
1528
+ functionQuery: {
1529
+ functionName: "chatCompletionStream",
1530
+ kind: "Sync"
1531
+ }
1532
+ },
1533
+ {
1534
+ channelName: huggingFaceChannels.chatCompletionStream.channelName,
1535
+ module: {
1536
+ name: "@huggingface/inference",
1537
+ versionRange: ">=3.0.0 <5.0.0",
1538
+ filePath: "dist/commonjs/tasks/nlp/chatCompletionStream.js"
1539
+ },
1540
+ functionQuery: {
1541
+ functionName: "chatCompletionStream",
1542
+ kind: "Sync"
1543
+ }
1544
+ },
1545
+ {
1546
+ channelName: huggingFaceChannels.textGeneration.channelName,
1547
+ module: {
1548
+ name: "@huggingface/inference",
1549
+ versionRange: ">=3.0.0 <5.0.0",
1550
+ filePath: "dist/esm/tasks/nlp/textGeneration.js"
1551
+ },
1552
+ functionQuery: {
1553
+ functionName: "textGeneration",
1554
+ kind: "Async"
1555
+ }
1556
+ },
1557
+ {
1558
+ channelName: huggingFaceChannels.textGeneration.channelName,
1559
+ module: {
1560
+ name: "@huggingface/inference",
1561
+ versionRange: ">=3.0.0 <5.0.0",
1562
+ filePath: "dist/commonjs/tasks/nlp/textGeneration.js"
1563
+ },
1564
+ functionQuery: {
1565
+ functionName: "textGeneration",
1566
+ kind: "Async"
1567
+ }
1568
+ },
1569
+ {
1570
+ channelName: huggingFaceChannels.textGenerationStream.channelName,
1571
+ module: {
1572
+ name: "@huggingface/inference",
1573
+ versionRange: ">=3.0.0 <5.0.0",
1574
+ filePath: "dist/esm/tasks/nlp/textGenerationStream.js"
1575
+ },
1576
+ functionQuery: {
1577
+ functionName: "textGenerationStream",
1578
+ kind: "Sync"
1579
+ }
1580
+ },
1581
+ {
1582
+ channelName: huggingFaceChannels.textGenerationStream.channelName,
1583
+ module: {
1584
+ name: "@huggingface/inference",
1585
+ versionRange: ">=3.0.0 <5.0.0",
1586
+ filePath: "dist/commonjs/tasks/nlp/textGenerationStream.js"
1587
+ },
1588
+ functionQuery: {
1589
+ functionName: "textGenerationStream",
1590
+ kind: "Sync"
1591
+ }
1592
+ },
1593
+ {
1594
+ channelName: huggingFaceChannels.featureExtraction.channelName,
1595
+ module: {
1596
+ name: "@huggingface/inference",
1597
+ versionRange: ">=3.0.0 <5.0.0",
1598
+ filePath: "dist/esm/tasks/nlp/featureExtraction.js"
1599
+ },
1600
+ functionQuery: {
1601
+ functionName: "featureExtraction",
1602
+ kind: "Async"
1603
+ }
1604
+ },
1605
+ {
1606
+ channelName: huggingFaceChannels.featureExtraction.channelName,
1607
+ module: {
1608
+ name: "@huggingface/inference",
1609
+ versionRange: ">=3.0.0 <5.0.0",
1610
+ filePath: "dist/commonjs/tasks/nlp/featureExtraction.js"
1611
+ },
1612
+ functionQuery: {
1613
+ functionName: "featureExtraction",
1614
+ kind: "Async"
1615
+ }
1616
+ }
1617
+ ];
1618
+
1619
+ // src/auto-instrumentations/configs/langchain.ts
1620
+ var langChainCoreVersionRange = ">=0.3.42";
1621
+ var langChainCallbackManagerFilePath = "dist/callbacks/manager.js";
1622
+ var langchainConfigs = [
1623
+ {
1624
+ channelName: langChainChannels.configure.channelName,
1625
+ module: {
1626
+ name: "@langchain/core",
1627
+ versionRange: langChainCoreVersionRange,
1628
+ filePath: langChainCallbackManagerFilePath
1629
+ },
1630
+ functionQuery: {
1631
+ className: "CallbackManager",
1632
+ methodName: "configure",
1633
+ kind: "Sync"
1634
+ }
1635
+ },
1636
+ {
1637
+ channelName: langChainChannels.configureSync.channelName,
1638
+ module: {
1639
+ name: "@langchain/core",
1640
+ versionRange: langChainCoreVersionRange,
1641
+ filePath: langChainCallbackManagerFilePath
1642
+ },
1643
+ functionQuery: {
1644
+ className: "CallbackManager",
1645
+ methodName: "_configureSync",
1646
+ kind: "Sync"
1647
+ }
1648
+ }
1649
+ ];
1650
+
1651
+ // src/auto-instrumentations/configs/mistral.ts
1652
+ var mistralConfigs = [
1653
+ {
1654
+ channelName: mistralChannels.chatComplete.channelName,
1655
+ module: {
1656
+ name: "@mistralai/mistralai",
1657
+ versionRange: ">=1.0.0 <2.0.0",
1658
+ filePath: "sdk/chat.js"
1659
+ },
1660
+ functionQuery: {
1661
+ className: "Chat",
1662
+ methodName: "complete",
1663
+ kind: "Async"
1664
+ }
1665
+ },
1666
+ {
1667
+ channelName: mistralChannels.chatComplete.channelName,
1668
+ module: {
1669
+ name: "@mistralai/mistralai",
1670
+ versionRange: ">=2.0.0 <3.0.0",
1671
+ filePath: "esm/sdk/chat.js"
1672
+ },
1673
+ functionQuery: {
1674
+ className: "Chat",
1675
+ methodName: "complete",
1676
+ kind: "Async"
1677
+ }
1678
+ },
1679
+ {
1680
+ channelName: mistralChannels.chatStream.channelName,
1681
+ module: {
1682
+ name: "@mistralai/mistralai",
1683
+ versionRange: ">=1.0.0 <2.0.0",
1684
+ filePath: "sdk/chat.js"
1685
+ },
1686
+ functionQuery: {
1687
+ className: "Chat",
1688
+ methodName: "stream",
1689
+ kind: "Async"
1690
+ }
1691
+ },
1692
+ {
1693
+ channelName: mistralChannels.chatStream.channelName,
1694
+ module: {
1695
+ name: "@mistralai/mistralai",
1696
+ versionRange: ">=2.0.0 <3.0.0",
1697
+ filePath: "esm/sdk/chat.js"
1698
+ },
1699
+ functionQuery: {
1700
+ className: "Chat",
1701
+ methodName: "stream",
1702
+ kind: "Async"
1703
+ }
1704
+ },
1705
+ {
1706
+ channelName: mistralChannels.embeddingsCreate.channelName,
1707
+ module: {
1708
+ name: "@mistralai/mistralai",
1709
+ versionRange: ">=1.0.0 <2.0.0",
1710
+ filePath: "sdk/embeddings.js"
1711
+ },
1712
+ functionQuery: {
1713
+ className: "Embeddings",
1714
+ methodName: "create",
1715
+ kind: "Async"
1716
+ }
1717
+ },
1718
+ {
1719
+ channelName: mistralChannels.embeddingsCreate.channelName,
1720
+ module: {
1721
+ name: "@mistralai/mistralai",
1722
+ versionRange: ">=2.0.0 <3.0.0",
1723
+ filePath: "esm/sdk/embeddings.js"
1724
+ },
1725
+ functionQuery: {
1726
+ className: "Embeddings",
1727
+ methodName: "create",
1728
+ kind: "Async"
1729
+ }
1730
+ },
1731
+ {
1732
+ channelName: mistralChannels.classifiersModerate.channelName,
1733
+ module: {
1734
+ name: "@mistralai/mistralai",
1735
+ versionRange: ">=1.0.0 <2.0.0",
1736
+ filePath: "sdk/classifiers.js"
1737
+ },
1738
+ functionQuery: {
1739
+ className: "Classifiers",
1740
+ methodName: "moderate",
1741
+ kind: "Async"
1742
+ }
1743
+ },
1744
+ {
1745
+ channelName: mistralChannels.classifiersModerate.channelName,
1746
+ module: {
1747
+ name: "@mistralai/mistralai",
1748
+ versionRange: ">=2.0.0 <3.0.0",
1749
+ filePath: "esm/sdk/classifiers.js"
1750
+ },
1751
+ functionQuery: {
1752
+ className: "Classifiers",
1753
+ methodName: "moderate",
1754
+ kind: "Async"
1755
+ }
1756
+ },
1757
+ {
1758
+ channelName: mistralChannels.classifiersModerateChat.channelName,
1759
+ module: {
1760
+ name: "@mistralai/mistralai",
1761
+ versionRange: ">=1.0.0 <2.0.0",
1762
+ filePath: "sdk/classifiers.js"
1763
+ },
1764
+ functionQuery: {
1765
+ className: "Classifiers",
1766
+ methodName: "moderateChat",
1767
+ kind: "Async"
1768
+ }
1769
+ },
1770
+ {
1771
+ channelName: mistralChannels.classifiersModerateChat.channelName,
1772
+ module: {
1773
+ name: "@mistralai/mistralai",
1774
+ versionRange: ">=2.0.0 <3.0.0",
1775
+ filePath: "esm/sdk/classifiers.js"
1776
+ },
1777
+ functionQuery: {
1778
+ className: "Classifiers",
1779
+ methodName: "moderateChat",
1780
+ kind: "Async"
1781
+ }
1782
+ },
1783
+ {
1784
+ channelName: mistralChannels.classifiersClassify.channelName,
1785
+ module: {
1786
+ name: "@mistralai/mistralai",
1787
+ versionRange: ">=1.10.0 <2.0.0",
1788
+ filePath: "sdk/classifiers.js"
1789
+ },
1790
+ functionQuery: {
1791
+ className: "Classifiers",
1792
+ methodName: "classify",
1793
+ kind: "Async"
1794
+ }
1795
+ },
1796
+ {
1797
+ channelName: mistralChannels.classifiersClassify.channelName,
1798
+ module: {
1799
+ name: "@mistralai/mistralai",
1800
+ versionRange: ">=2.0.0 <3.0.0",
1801
+ filePath: "esm/sdk/classifiers.js"
1802
+ },
1803
+ functionQuery: {
1804
+ className: "Classifiers",
1805
+ methodName: "classify",
1806
+ kind: "Async"
1807
+ }
1808
+ },
1809
+ {
1810
+ channelName: mistralChannels.classifiersClassifyChat.channelName,
1811
+ module: {
1812
+ name: "@mistralai/mistralai",
1813
+ versionRange: ">=1.10.0 <2.0.0",
1814
+ filePath: "sdk/classifiers.js"
1815
+ },
1816
+ functionQuery: {
1817
+ className: "Classifiers",
1818
+ methodName: "classifyChat",
1819
+ kind: "Async"
1820
+ }
1821
+ },
1822
+ {
1823
+ channelName: mistralChannels.classifiersClassifyChat.channelName,
1824
+ module: {
1825
+ name: "@mistralai/mistralai",
1826
+ versionRange: ">=2.0.0 <3.0.0",
1827
+ filePath: "esm/sdk/classifiers.js"
1828
+ },
1829
+ functionQuery: {
1830
+ className: "Classifiers",
1831
+ methodName: "classifyChat",
1832
+ kind: "Async"
1833
+ }
1834
+ },
1835
+ {
1836
+ channelName: mistralChannels.fimComplete.channelName,
1837
+ module: {
1838
+ name: "@mistralai/mistralai",
1839
+ versionRange: ">=1.0.0 <2.0.0",
1840
+ filePath: "sdk/fim.js"
1841
+ },
1842
+ functionQuery: {
1843
+ className: "Fim",
1844
+ methodName: "complete",
1845
+ kind: "Async"
1846
+ }
1847
+ },
1848
+ {
1849
+ channelName: mistralChannels.fimComplete.channelName,
1850
+ module: {
1851
+ name: "@mistralai/mistralai",
1852
+ versionRange: ">=2.0.0 <3.0.0",
1853
+ filePath: "esm/sdk/fim.js"
1854
+ },
1855
+ functionQuery: {
1856
+ className: "Fim",
1857
+ methodName: "complete",
1858
+ kind: "Async"
1859
+ }
1860
+ },
1861
+ {
1862
+ channelName: mistralChannels.fimStream.channelName,
1863
+ module: {
1864
+ name: "@mistralai/mistralai",
1865
+ versionRange: ">=1.0.0 <2.0.0",
1866
+ filePath: "sdk/fim.js"
1867
+ },
1868
+ functionQuery: {
1869
+ className: "Fim",
1870
+ methodName: "stream",
1871
+ kind: "Async"
1872
+ }
1873
+ },
1874
+ {
1875
+ channelName: mistralChannels.fimStream.channelName,
1876
+ module: {
1877
+ name: "@mistralai/mistralai",
1878
+ versionRange: ">=2.0.0 <3.0.0",
1879
+ filePath: "esm/sdk/fim.js"
1880
+ },
1881
+ functionQuery: {
1882
+ className: "Fim",
1883
+ methodName: "stream",
1884
+ kind: "Async"
1885
+ }
1886
+ },
1887
+ {
1888
+ channelName: mistralChannels.agentsComplete.channelName,
1889
+ module: {
1890
+ name: "@mistralai/mistralai",
1891
+ versionRange: ">=1.0.0 <2.0.0",
1892
+ filePath: "sdk/agents.js"
1893
+ },
1894
+ functionQuery: {
1895
+ className: "Agents",
1896
+ methodName: "complete",
1897
+ kind: "Async"
1898
+ }
1899
+ },
1900
+ {
1901
+ channelName: mistralChannels.agentsComplete.channelName,
1902
+ module: {
1903
+ name: "@mistralai/mistralai",
1904
+ versionRange: ">=2.0.0 <3.0.0",
1905
+ filePath: "esm/sdk/agents.js"
1906
+ },
1907
+ functionQuery: {
1908
+ className: "Agents",
1909
+ methodName: "complete",
1910
+ kind: "Async"
1911
+ }
1912
+ },
1913
+ {
1914
+ channelName: mistralChannels.agentsStream.channelName,
1915
+ module: {
1916
+ name: "@mistralai/mistralai",
1917
+ versionRange: ">=1.0.0 <2.0.0",
1918
+ filePath: "sdk/agents.js"
1919
+ },
1920
+ functionQuery: {
1921
+ className: "Agents",
1922
+ methodName: "stream",
1923
+ kind: "Async"
1924
+ }
1925
+ },
1926
+ {
1927
+ channelName: mistralChannels.agentsStream.channelName,
1928
+ module: {
1929
+ name: "@mistralai/mistralai",
1930
+ versionRange: ">=2.0.0 <3.0.0",
1931
+ filePath: "esm/sdk/agents.js"
1932
+ },
1933
+ functionQuery: {
1934
+ className: "Agents",
1935
+ methodName: "stream",
1936
+ kind: "Async"
1937
+ }
1938
+ }
1939
+ ];
1940
+
1941
+ // src/auto-instrumentations/configs/openai-agents.ts
1942
+ var lifecycleMethods = [
1943
+ ["onTraceStart", openAIAgentsCoreChannels.onTraceStart.channelName],
1944
+ ["onTraceEnd", openAIAgentsCoreChannels.onTraceEnd.channelName],
1945
+ ["onSpanStart", openAIAgentsCoreChannels.onSpanStart.channelName],
1946
+ ["onSpanEnd", openAIAgentsCoreChannels.onSpanEnd.channelName]
1947
+ ];
1948
+ var openAIAgentsCoreConfigs = lifecycleMethods.flatMap(
1949
+ ([methodName, channelName]) => ["dist/tracing/processor.mjs", "dist/tracing/processor.js"].map(
1950
+ (filePath) => ({
1951
+ channelName,
1952
+ module: {
1953
+ name: "@openai/agents-core",
1954
+ versionRange: ">=0.0.14",
1955
+ filePath
1956
+ },
1957
+ functionQuery: {
1958
+ className: "MultiTracingProcessor",
1959
+ methodName,
1960
+ kind: "Async"
1961
+ }
1962
+ })
1963
+ )
1964
+ );
1965
+
1966
+ // src/auto-instrumentations/configs/openai.ts
1967
+ var openaiConfigs = [
1968
+ // Chat Completions
1969
+ {
1970
+ channelName: openAIChannels.chatCompletionsCreate.channelName,
1971
+ module: {
1972
+ name: "openai",
1973
+ versionRange: ">=4.0.0 <5.0.0",
1974
+ filePath: "resources/chat/completions.mjs"
1975
+ },
1976
+ functionQuery: {
1977
+ className: "Completions",
1978
+ methodName: "create",
1979
+ kind: "Async"
1980
+ }
1981
+ },
1982
+ {
1983
+ channelName: openAIChannels.chatCompletionsCreate.channelName,
1984
+ module: {
1985
+ name: "openai",
1986
+ versionRange: ">=4.0.0 <5.0.0",
1987
+ filePath: "resources/chat/completions/completions.mjs"
1988
+ },
1989
+ functionQuery: {
1990
+ className: "Completions",
1991
+ methodName: "create",
1992
+ kind: "Async"
1993
+ }
1994
+ },
1995
+ {
1996
+ channelName: openAIChannels.chatCompletionsCreate.channelName,
1997
+ module: {
1998
+ name: "openai",
1999
+ versionRange: ">=5.0.0",
2000
+ filePath: "resources/chat/completions/completions.mjs"
2001
+ },
2002
+ functionQuery: {
2003
+ className: "Completions",
2004
+ methodName: "create",
2005
+ kind: "Async"
2006
+ }
2007
+ },
2008
+ // Embeddings
2009
+ {
2010
+ channelName: openAIChannels.embeddingsCreate.channelName,
2011
+ module: {
2012
+ name: "openai",
2013
+ versionRange: ">=4.0.0",
2014
+ filePath: "resources/embeddings.mjs"
2015
+ },
2016
+ functionQuery: {
2017
+ className: "Embeddings",
2018
+ methodName: "create",
2019
+ kind: "Async"
2020
+ }
2021
+ },
2022
+ // Beta Chat Completions Parse
2023
+ {
2024
+ channelName: openAIChannels.betaChatCompletionsParse.channelName,
2025
+ module: {
2026
+ name: "openai",
2027
+ versionRange: ">=4.0.0 <5.0.0",
2028
+ filePath: "resources/beta/chat/completions.mjs"
2029
+ },
2030
+ functionQuery: {
2031
+ className: "Completions",
2032
+ methodName: "parse",
2033
+ kind: "Async"
2034
+ }
2035
+ },
2036
+ {
2037
+ channelName: openAIChannels.betaChatCompletionsParse.channelName,
2038
+ module: {
2039
+ name: "openai",
2040
+ versionRange: ">=5.0.0",
2041
+ filePath: "resources/chat/completions/completions.mjs"
2042
+ },
2043
+ functionQuery: {
2044
+ className: "Completions",
2045
+ methodName: "parse",
2046
+ kind: "Async"
2047
+ }
2048
+ },
2049
+ // Moderations
2050
+ {
2051
+ channelName: openAIChannels.moderationsCreate.channelName,
2052
+ module: {
2053
+ name: "openai",
2054
+ versionRange: ">=4.0.0",
2055
+ filePath: "resources/moderations.mjs"
2056
+ },
2057
+ functionQuery: {
2058
+ className: "Moderations",
2059
+ methodName: "create",
2060
+ kind: "Async"
2061
+ }
2062
+ },
2063
+ // Beta Chat Completions Stream
2064
+ {
2065
+ channelName: openAIChannels.betaChatCompletionsStream.channelName,
2066
+ module: {
2067
+ name: "openai",
2068
+ versionRange: ">=4.0.0 <5.0.0",
2069
+ filePath: "resources/beta/chat/completions.mjs"
2070
+ },
2071
+ functionQuery: {
2072
+ className: "Completions",
2073
+ methodName: "stream",
2074
+ kind: "Sync"
2075
+ }
2076
+ },
2077
+ {
2078
+ channelName: openAIChannels.betaChatCompletionsStream.channelName,
2079
+ module: {
2080
+ name: "openai",
2081
+ versionRange: ">=5.0.0",
2082
+ filePath: "resources/chat/completions/completions.mjs"
2083
+ },
2084
+ functionQuery: {
2085
+ className: "Completions",
2086
+ methodName: "stream",
2087
+ kind: "Sync"
2088
+ }
2089
+ },
2090
+ // Responses API (v4.87.0+)
2091
+ {
2092
+ channelName: openAIChannels.responsesCreate.channelName,
2093
+ module: {
2094
+ name: "openai",
2095
+ versionRange: ">=4.87.0",
2096
+ filePath: "resources/responses/responses.mjs"
2097
+ },
2098
+ functionQuery: {
2099
+ className: "Responses",
2100
+ methodName: "create",
2101
+ kind: "Async"
2102
+ }
2103
+ },
2104
+ {
2105
+ channelName: openAIChannels.responsesStream.channelName,
2106
+ module: {
2107
+ name: "openai",
2108
+ versionRange: ">=4.87.0",
2109
+ filePath: "resources/responses/responses.mjs"
2110
+ },
2111
+ functionQuery: {
2112
+ className: "Responses",
2113
+ methodName: "stream",
2114
+ kind: "Sync"
2115
+ }
2116
+ },
2117
+ {
2118
+ channelName: openAIChannels.responsesParse.channelName,
2119
+ module: {
2120
+ name: "openai",
2121
+ versionRange: ">=4.87.0",
2122
+ filePath: "resources/responses/responses.mjs"
2123
+ },
2124
+ functionQuery: {
2125
+ className: "Responses",
2126
+ methodName: "parse",
2127
+ kind: "Async"
2128
+ }
2129
+ },
2130
+ {
2131
+ channelName: openAIChannels.responsesCompact.channelName,
2132
+ module: {
2133
+ name: "openai",
2134
+ versionRange: ">=6.10.0",
2135
+ filePath: "resources/responses/responses.mjs"
2136
+ },
2137
+ functionQuery: {
2138
+ className: "Responses",
2139
+ methodName: "compact",
2140
+ kind: "Async"
2141
+ }
2142
+ }
2143
+ ];
2144
+
2145
+ // src/auto-instrumentations/configs/openai-codex.ts
2146
+ var openAICodexVersionRange = ">=0.128.0 <1.0.0";
2147
+ var openAICodexConfigs = [
2148
+ {
2149
+ channelName: openAICodexChannels.run.channelName,
2150
+ module: {
2151
+ name: "@openai/codex-sdk",
2152
+ versionRange: openAICodexVersionRange,
2153
+ filePath: "dist/index.js"
2154
+ },
2155
+ functionQuery: {
2156
+ className: "Thread",
2157
+ methodName: "run",
2158
+ kind: "Async"
2159
+ }
2160
+ },
2161
+ {
2162
+ channelName: openAICodexChannels.runStreamed.channelName,
2163
+ module: {
2164
+ name: "@openai/codex-sdk",
2165
+ versionRange: openAICodexVersionRange,
2166
+ filePath: "dist/index.js"
2167
+ },
2168
+ functionQuery: {
2169
+ className: "Thread",
2170
+ methodName: "runStreamed",
2171
+ kind: "Async"
2172
+ }
2173
+ }
2174
+ ];
2175
+
2176
+ // src/auto-instrumentations/configs/openrouter.ts
2177
+ var openRouterConfigs = [
2178
+ {
2179
+ channelName: openRouterChannels.chatSend.channelName,
2180
+ module: {
2181
+ name: "@openrouter/sdk",
2182
+ versionRange: ">=0.9.11 <1.0.0",
2183
+ filePath: "esm/sdk/chat.js"
2184
+ },
2185
+ functionQuery: {
2186
+ className: "Chat",
2187
+ methodName: "send",
2188
+ kind: "Async"
2189
+ }
2190
+ },
2191
+ {
2192
+ channelName: openRouterChannels.embeddingsGenerate.channelName,
2193
+ module: {
2194
+ name: "@openrouter/sdk",
2195
+ versionRange: ">=0.9.11 <1.0.0",
2196
+ filePath: "esm/sdk/embeddings.js"
2197
+ },
2198
+ functionQuery: {
2199
+ className: "Embeddings",
2200
+ methodName: "generate",
2201
+ kind: "Async"
2202
+ }
2203
+ },
2204
+ {
2205
+ channelName: openRouterChannels.rerankRerank.channelName,
2206
+ module: {
2207
+ name: "@openrouter/sdk",
2208
+ versionRange: ">=0.12.0 <1.0.0",
2209
+ filePath: "esm/sdk/rerank.js"
2210
+ },
2211
+ functionQuery: {
2212
+ className: "Rerank",
2213
+ methodName: "rerank",
2214
+ kind: "Async"
2215
+ }
2216
+ },
2217
+ {
2218
+ channelName: openRouterChannels.betaResponsesSend.channelName,
2219
+ module: {
2220
+ name: "@openrouter/sdk",
2221
+ versionRange: ">=0.9.11 <1.0.0",
2222
+ filePath: "esm/sdk/responses.js"
2223
+ },
2224
+ functionQuery: {
2225
+ className: "Responses",
2226
+ methodName: "send",
2227
+ kind: "Async"
2228
+ }
2229
+ },
2230
+ {
2231
+ channelName: openRouterChannels.callModel.channelName,
2232
+ module: {
2233
+ name: "@openrouter/sdk",
2234
+ versionRange: ">=0.9.11 <1.0.0",
2235
+ filePath: "esm/sdk/sdk.js"
2236
+ },
2237
+ functionQuery: {
2238
+ className: "OpenRouter",
2239
+ methodName: "callModel",
2240
+ kind: "Sync"
2241
+ }
2242
+ }
2243
+ ];
2244
+
2245
+ // src/auto-instrumentations/configs/openrouter-agent.ts
2246
+ var openRouterAgentConfigs = [
2247
+ {
2248
+ channelName: openRouterAgentChannels.callModel.channelName,
2249
+ module: {
2250
+ name: "@openrouter/agent",
2251
+ versionRange: ">=0.1.2",
2252
+ filePath: "esm/inner-loop/call-model.js"
2253
+ },
2254
+ functionQuery: {
2255
+ functionName: "callModel",
2256
+ kind: "Sync"
2257
+ }
2258
+ }
2259
+ ];
2260
+
2261
+ // src/auto-instrumentations/configs/all.ts
2262
+ var defaultInstrumentationConfigGroups = [
2263
+ { integrations: ["openai"], configs: openaiConfigs },
2264
+ {
2265
+ integrations: ["openaiCodexSDK"],
2266
+ configs: openAICodexConfigs
2267
+ },
2268
+ { integrations: ["anthropic"], configs: anthropicConfigs },
2269
+ {
2270
+ integrations: ["aisdk", "vercel"],
2271
+ configs: aiSDKConfigs
2272
+ },
2273
+ {
2274
+ integrations: ["claudeAgentSDK"],
2275
+ configs: claudeAgentSDKConfigs
2276
+ },
2277
+ { integrations: ["cursor", "cursorSDK"], configs: cursorSDKConfigs },
2278
+ { integrations: ["flue"], configs: flueConfigs },
2279
+ {
2280
+ integrations: ["openAIAgents"],
2281
+ configs: openAIAgentsCoreConfigs
2282
+ },
2283
+ {
2284
+ integrations: ["google", "googleGenAI"],
2285
+ configs: googleGenAIConfigs
2286
+ },
2287
+ { integrations: ["huggingface"], configs: huggingFaceConfigs },
2288
+ {
2289
+ integrations: ["langchain", "langgraph"],
2290
+ configs: langchainConfigs
2291
+ },
2292
+ { integrations: ["openrouter"], configs: openRouterConfigs },
2293
+ {
2294
+ integrations: ["openrouterAgent"],
2295
+ configs: openRouterAgentConfigs
2296
+ },
2297
+ { integrations: ["mistral"], configs: mistralConfigs },
2298
+ { integrations: ["googleADK"], configs: googleADKConfigs },
2299
+ { integrations: ["cohere"], configs: cohereConfigs },
2300
+ { integrations: ["groq"], configs: groqConfigs },
2301
+ {
2302
+ integrations: ["genkit"],
2303
+ configs: genkitConfigs
2304
+ },
2305
+ {
2306
+ integrations: ["gitHubCopilot"],
2307
+ configs: gitHubCopilotConfigs
2308
+ }
2309
+ ];
2310
+ function getDefaultInstrumentationConfigs({
2311
+ additionalInstrumentations,
2312
+ disabledIntegrationConfig,
2313
+ disabledIntegrations
2314
+ } = {}) {
2315
+ const disabledConfig = disabledIntegrationConfig ?? (disabledIntegrations ? readDisabledInstrumentationEnvConfig(
2316
+ [...disabledIntegrations].join(",")
2317
+ ).integrations : void 0);
2318
+ return [
2319
+ ...defaultInstrumentationConfigGroups.flatMap(
2320
+ ({ configs, integrations }) => isInstrumentationIntegrationDisabled(disabledConfig, ...integrations) ? [] : configs
2321
+ ),
2322
+ ...additionalInstrumentations ?? []
2323
+ ];
2324
+ }
2325
+ function getDefaultAutoInstrumentationConfigs() {
2326
+ return getDefaultInstrumentationConfigs({
2327
+ disabledIntegrationConfig: readDisabledInstrumentationEnvConfig(
2328
+ process.env.BRAINTRUST_DISABLE_INSTRUMENTATION
2329
+ ).integrations
2330
+ });
2331
+ }
2332
+
2333
+ // src/auto-instrumentations/loader/cjs-patch.ts
2334
+ import {
2335
+ create
2336
+ } from "@apm-js-collab/code-transformer";
2337
+ import * as NodeModule from "node:module";
2338
+ import { sep } from "node:path";
2339
+ import moduleDetailsFromPath from "module-details-from-path";
2340
+
2341
+ // src/auto-instrumentations/loader/get-package-version.ts
2342
+ import { readFileSync, realpathSync } from "node:fs";
2343
+ import { join } from "node:path";
2344
+ var packageVersions = /* @__PURE__ */ new Map();
2345
+ var packageNames = /* @__PURE__ */ new Map();
2346
+ function readPackageJson(baseDir) {
2347
+ try {
2348
+ const packageJsonPath = join(baseDir, "package.json");
2349
+ const jsonFile = readFileSync(packageJsonPath, "utf8");
2350
+ return JSON.parse(jsonFile);
2351
+ } catch {
2352
+ return void 0;
2353
+ }
2354
+ }
2355
+ function resolvePackageBaseDir(baseDir) {
2356
+ try {
2357
+ return realpathSync(baseDir);
2358
+ } catch {
2359
+ return baseDir;
2360
+ }
2361
+ }
2362
+ function readPackageJsonWithFallback(baseDir) {
2363
+ const packageJson = readPackageJson(baseDir);
2364
+ if (packageJson) {
2365
+ return packageJson;
2366
+ }
2367
+ const resolvedBaseDir = resolvePackageBaseDir(baseDir);
2368
+ if (resolvedBaseDir === baseDir) {
2369
+ return void 0;
2370
+ }
2371
+ return readPackageJson(resolvedBaseDir);
2372
+ }
2373
+ function getPackageVersion(baseDir) {
2374
+ if (packageVersions.has(baseDir)) {
2375
+ return packageVersions.get(baseDir);
2376
+ }
2377
+ const packageJson = readPackageJsonWithFallback(baseDir);
2378
+ if (typeof packageJson?.version === "string") {
2379
+ packageVersions.set(baseDir, packageJson.version);
2380
+ return packageJson.version;
2381
+ }
2382
+ return process.version.slice(1);
2383
+ }
2384
+ function getPackageName(baseDir) {
2385
+ if (packageNames.has(baseDir)) {
2386
+ return packageNames.get(baseDir);
2387
+ }
2388
+ const packageJson = readPackageJsonWithFallback(baseDir);
2389
+ if (typeof packageJson?.name === "string") {
2390
+ packageNames.set(baseDir, packageJson.name);
2391
+ return packageJson.name;
2392
+ }
2393
+ return void 0;
2394
+ }
2395
+
2396
+ // src/auto-instrumentations/loader/openai-api-promise-patch.ts
2397
+ var OPENAI_API_PROMISE_PATCH = `
2398
+ ;(function __btPatchAPIPromise() {
2399
+ if (typeof APIPromise === "undefined" || APIPromise.prototype.__btParsePatched) return;
2400
+ APIPromise.prototype.__btParsePatched = true;
2401
+ var _origThen = APIPromise.prototype.then;
2402
+ APIPromise.prototype.then = function __btThen(onfulfilled, onrejected) {
2403
+ if (!this.__btParseWrapped && Object.prototype.hasOwnProperty.call(this, "parseResponse")) {
2404
+ this.__btParseWrapped = true;
2405
+ var _origParse = this.parseResponse;
2406
+ var _cached;
2407
+ this.parseResponse = function() {
2408
+ if (!_cached) _cached = _origParse.apply(this, arguments);
2409
+ return _cached;
2410
+ };
2411
+ }
2412
+ return _origThen.call(this, onfulfilled, onrejected);
2413
+ };
2414
+ })();
2415
+ `;
2416
+
2417
+ // src/auto-instrumentations/loader/cjs-patch.ts
2418
+ var ModulePatch = class {
2419
+ packages;
2420
+ instrumentator;
2421
+ modulePrototype;
2422
+ originalCompile;
2423
+ constructor({
2424
+ instrumentations = []
2425
+ } = {}) {
2426
+ const modulePrototype = resolveModulePrototype();
2427
+ this.packages = new Set(instrumentations.map((i) => i.module.name));
2428
+ this.instrumentator = create(instrumentations);
2429
+ this.modulePrototype = modulePrototype;
2430
+ this.originalCompile = modulePrototype._compile;
2431
+ }
2432
+ /**
2433
+ * Patches the Node.js module class method that is responsible for compiling code.
2434
+ * If a module is found that has an instrumentator, it will transform the code before compiling it
2435
+ * with tracing channel methods.
2436
+ */
2437
+ patch() {
2438
+ const self = this;
2439
+ this.modulePrototype._compile = function wrappedCompile(...args) {
2440
+ const [content, filename] = args;
2441
+ const normalizedForPlatform = filename.split("/").join(sep);
2442
+ const resolvedModule = moduleDetailsFromPath(normalizedForPlatform);
2443
+ if (resolvedModule) {
2444
+ const packageName = getPackageName(resolvedModule.basedir) ?? resolvedModule.name;
2445
+ if (!self.packages.has(packageName)) {
2446
+ return self.originalCompile.apply(this, args);
2447
+ }
2448
+ const normalizedModulePath = resolvedModule.path.replace(/\\/g, "/");
2449
+ if (packageName === "openai" && normalizedModulePath.includes("api-promise")) {
2450
+ args[0] = content + OPENAI_API_PROMISE_PATCH;
2451
+ return self.originalCompile.apply(this, args);
2452
+ }
2453
+ const version = getPackageVersion(resolvedModule.basedir);
2454
+ const transformer = self.instrumentator.getTransformer(
2455
+ packageName,
2456
+ version,
2457
+ normalizedModulePath
2458
+ );
2459
+ if (transformer) {
2460
+ try {
2461
+ const transformedCode = transformer.transform(content, "unknown");
2462
+ args[0] = transformedCode?.code;
2463
+ } catch (error) {
2464
+ console.warn(`Error transforming module ${filename}:`, error);
2465
+ } finally {
2466
+ transformer.free();
2467
+ }
2468
+ }
2469
+ }
2470
+ return self.originalCompile.apply(this, args);
2471
+ };
2472
+ }
2473
+ /**
2474
+ * Restores the original Module.prototype._compile method
2475
+ * **Note**: This is intended to be used in testing only.
2476
+ */
2477
+ unpatch() {
2478
+ this.modulePrototype._compile = this.originalCompile;
2479
+ }
2480
+ };
2481
+ function resolveModulePrototype() {
2482
+ const moduleCtor = NodeModule.Module;
2483
+ if (moduleCtor && typeof moduleCtor === "function") {
2484
+ return moduleCtor.prototype;
2485
+ }
2486
+ return NodeModule.prototype;
2487
+ }
2488
+
2489
+ // src/node/apply-auto-instrumentation-entry.ts
2490
+ var stateKey = /* @__PURE__ */ Symbol.for("braintrust.applyAutoInstrumentation");
2491
+ var existingState = Object.getOwnPropertyDescriptor(
2492
+ globalThis,
2493
+ stateKey
2494
+ )?.value;
2495
+ var state = isApplyAutoInstrumentationState(
2496
+ existingState
2497
+ ) ? existingState : {};
2498
+ if (state !== existingState) {
2499
+ Object.defineProperty(globalThis, stateKey, {
2500
+ configurable: false,
2501
+ enumerable: false,
2502
+ value: state,
2503
+ writable: false
2504
+ });
2505
+ }
2506
+ if (!state.applied) {
2507
+ patchTracingChannel(diagnostics_channel.tracingChannel);
2508
+ const allConfigs = getDefaultAutoInstrumentationConfigs();
2509
+ const currentModuleUrl = getCurrentModuleUrl();
2510
+ register("./auto-instrumentations/loader/esm-hook.mjs", {
2511
+ parentURL: currentModuleUrl,
2512
+ data: { instrumentations: allConfigs }
2513
+ });
2514
+ state.applied = true;
2515
+ try {
2516
+ const patch = new ModulePatch({ instrumentations: allConfigs });
2517
+ patch.patch();
2518
+ } catch {
2519
+ }
2520
+ }
2521
+ function isApplyAutoInstrumentationState(value) {
2522
+ return typeof value === "object" && value !== null;
2523
+ }
2524
+ function getCurrentModuleUrl() {
2525
+ if (typeof __filename !== "undefined") {
2526
+ return pathToFileURL(__filename).href;
2527
+ }
2528
+ const stack = new Error().stack ?? "";
2529
+ const match = stack.match(/\((file:\/\/[^)]+)\)/) ?? stack.match(/\s(file:\/\/\S+)/);
2530
+ if (match) {
2531
+ return match[1].replace(/:\d+:\d+$/, "");
2532
+ }
2533
+ return pathToFileURL(process.argv[1] ?? process.cwd()).href;
2534
+ }