braintrust 3.7.0 → 3.8.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.
- package/LICENSE +201 -0
- package/dev/dist/index.d.mts +144 -2
- package/dev/dist/index.d.ts +144 -2
- package/dev/dist/index.js +3322 -799
- package/dev/dist/index.mjs +3214 -691
- package/dist/auto-instrumentations/bundler/esbuild.cjs +377 -13
- package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
- package/dist/auto-instrumentations/bundler/rollup.cjs +377 -13
- package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
- package/dist/auto-instrumentations/bundler/vite.cjs +377 -13
- package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +377 -13
- package/dist/auto-instrumentations/bundler/webpack-loader.d.ts +11 -9
- package/dist/auto-instrumentations/bundler/webpack.cjs +377 -13
- package/dist/auto-instrumentations/bundler/webpack.mjs +2 -2
- package/dist/auto-instrumentations/{chunk-EVUKFMHG.mjs → chunk-ITP7RAUY.mjs} +21 -3
- package/dist/auto-instrumentations/{chunk-ZK2IYER2.mjs → chunk-MD7W27YH.mjs} +5 -1
- package/dist/auto-instrumentations/{chunk-AKEXR4AL.mjs → chunk-OLBMPZXE.mjs} +378 -14
- package/dist/auto-instrumentations/{chunk-VLEJ5AEK.mjs → chunk-P5YLNB2A.mjs} +21 -3
- package/dist/auto-instrumentations/hook.mjs +393 -19
- package/dist/auto-instrumentations/index.cjs +379 -13
- package/dist/auto-instrumentations/index.d.mts +5 -1
- package/dist/auto-instrumentations/index.d.ts +5 -1
- package/dist/auto-instrumentations/index.mjs +5 -1
- package/dist/auto-instrumentations/loader/cjs-patch.cjs +34 -6
- package/dist/auto-instrumentations/loader/cjs-patch.d.mts +1 -0
- package/dist/auto-instrumentations/loader/cjs-patch.d.ts +1 -0
- package/dist/auto-instrumentations/loader/cjs-patch.mjs +15 -5
- package/dist/auto-instrumentations/loader/esm-hook.mjs +8 -3
- package/dist/auto-instrumentations/loader/get-package-version.cjs +20 -2
- package/dist/auto-instrumentations/loader/get-package-version.mjs +1 -1
- package/dist/browser.d.mts +199 -44
- package/dist/browser.d.ts +199 -44
- package/dist/browser.js +7086 -6747
- package/dist/browser.mjs +7086 -6747
- package/dist/cli.js +3200 -677
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +12645 -12215
- package/dist/edge-light.mjs +12645 -12215
- package/dist/index.d.mts +199 -44
- package/dist/index.d.ts +199 -44
- package/dist/index.js +7173 -6834
- package/dist/index.mjs +7022 -6683
- package/dist/instrumentation/index.d.mts +7 -0
- package/dist/instrumentation/index.d.ts +7 -0
- package/dist/instrumentation/index.js +3170 -669
- package/dist/instrumentation/index.mjs +3170 -669
- package/dist/workerd.d.mts +1 -1
- package/dist/workerd.d.ts +1 -1
- package/dist/workerd.js +12645 -12215
- package/dist/workerd.mjs +12645 -12215
- package/package.json +45 -45
|
@@ -24,6 +24,8 @@ __export(index_exports, {
|
|
|
24
24
|
anthropicConfigs: () => anthropicConfigs,
|
|
25
25
|
claudeAgentSDKConfigs: () => claudeAgentSDKConfigs,
|
|
26
26
|
googleGenAIConfigs: () => googleGenAIConfigs,
|
|
27
|
+
mistralConfigs: () => mistralConfigs,
|
|
28
|
+
openRouterAgentConfigs: () => openRouterAgentConfigs,
|
|
27
29
|
openRouterConfigs: () => openRouterConfigs,
|
|
28
30
|
openaiConfigs: () => openaiConfigs
|
|
29
31
|
});
|
|
@@ -101,7 +103,7 @@ var DefaultTracingChannel = class {
|
|
|
101
103
|
}
|
|
102
104
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
103
105
|
tracePromise(fn, _message, thisArg, ...args) {
|
|
104
|
-
return
|
|
106
|
+
return fn.apply(thisArg, args);
|
|
105
107
|
}
|
|
106
108
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
107
109
|
traceCallback(fn, _position, _message, thisArg, ...args) {
|
|
@@ -121,6 +123,7 @@ var iso = {
|
|
|
121
123
|
processOn: (_0, _1) => {
|
|
122
124
|
},
|
|
123
125
|
basename: (filepath) => filepath.split(/[\\/]/).pop() || filepath,
|
|
126
|
+
// eslint-disable-next-line no-restricted-properties -- preserving intentional console usage.
|
|
124
127
|
writeln: (text) => console.log(text)
|
|
125
128
|
};
|
|
126
129
|
var isomorph_default = iso;
|
|
@@ -204,6 +207,10 @@ var openAIChannels = defineChannels("openai", {
|
|
|
204
207
|
responsesParse: channel({
|
|
205
208
|
channelName: "responses.parse",
|
|
206
209
|
kind: "async"
|
|
210
|
+
}),
|
|
211
|
+
responsesCompact: channel({
|
|
212
|
+
channelName: "responses.compact",
|
|
213
|
+
kind: "async"
|
|
207
214
|
})
|
|
208
215
|
});
|
|
209
216
|
|
|
@@ -370,6 +377,19 @@ var openaiConfigs = [
|
|
|
370
377
|
methodName: "parse",
|
|
371
378
|
kind: "Async"
|
|
372
379
|
}
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
channelName: openAIChannels.responsesCompact.channelName,
|
|
383
|
+
module: {
|
|
384
|
+
name: "openai",
|
|
385
|
+
versionRange: ">=6.10.0",
|
|
386
|
+
filePath: "resources/responses/responses.mjs"
|
|
387
|
+
},
|
|
388
|
+
functionQuery: {
|
|
389
|
+
className: "Responses",
|
|
390
|
+
methodName: "compact",
|
|
391
|
+
kind: "Async"
|
|
392
|
+
}
|
|
373
393
|
}
|
|
374
394
|
];
|
|
375
395
|
|
|
@@ -457,6 +477,16 @@ var aiSDKChannels = defineChannels("ai", {
|
|
|
457
477
|
channelName: "streamObject.sync",
|
|
458
478
|
kind: "sync-stream"
|
|
459
479
|
}),
|
|
480
|
+
embed: channel(
|
|
481
|
+
{
|
|
482
|
+
channelName: "embed",
|
|
483
|
+
kind: "async"
|
|
484
|
+
}
|
|
485
|
+
),
|
|
486
|
+
embedMany: channel({
|
|
487
|
+
channelName: "embedMany",
|
|
488
|
+
kind: "async"
|
|
489
|
+
}),
|
|
460
490
|
agentGenerate: channel({
|
|
461
491
|
channelName: "Agent.generate",
|
|
462
492
|
kind: "async"
|
|
@@ -465,6 +495,10 @@ var aiSDKChannels = defineChannels("ai", {
|
|
|
465
495
|
channelName: "Agent.stream",
|
|
466
496
|
kind: "async"
|
|
467
497
|
}),
|
|
498
|
+
agentStreamSync: channel({
|
|
499
|
+
channelName: "Agent.stream.sync",
|
|
500
|
+
kind: "sync-stream"
|
|
501
|
+
}),
|
|
468
502
|
toolLoopAgentGenerate: channel({
|
|
469
503
|
channelName: "ToolLoopAgent.generate",
|
|
470
504
|
kind: "async"
|
|
@@ -502,12 +536,12 @@ var aiSDKConfigs = [
|
|
|
502
536
|
kind: "Async"
|
|
503
537
|
}
|
|
504
538
|
},
|
|
505
|
-
// streamText - async function
|
|
539
|
+
// streamText - async function (v3 only, before the sync refactor in v4)
|
|
506
540
|
{
|
|
507
541
|
channelName: aiSDKChannels.streamText.channelName,
|
|
508
542
|
module: {
|
|
509
543
|
name: "ai",
|
|
510
|
-
versionRange: ">=3.0.0",
|
|
544
|
+
versionRange: ">=3.0.0 <4.0.0",
|
|
511
545
|
filePath: "dist/index.mjs"
|
|
512
546
|
},
|
|
513
547
|
functionQuery: {
|
|
@@ -515,8 +549,21 @@ var aiSDKConfigs = [
|
|
|
515
549
|
kind: "Async"
|
|
516
550
|
}
|
|
517
551
|
},
|
|
552
|
+
// streamText - sync function returning stream (v4+)
|
|
518
553
|
{
|
|
519
554
|
channelName: aiSDKChannels.streamTextSync.channelName,
|
|
555
|
+
module: {
|
|
556
|
+
name: "ai",
|
|
557
|
+
versionRange: ">=4.0.0",
|
|
558
|
+
filePath: "dist/index.mjs"
|
|
559
|
+
},
|
|
560
|
+
functionQuery: {
|
|
561
|
+
functionName: "streamText",
|
|
562
|
+
kind: "Sync"
|
|
563
|
+
}
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
channelName: aiSDKChannels.streamText.channelName,
|
|
520
567
|
module: {
|
|
521
568
|
name: "ai",
|
|
522
569
|
versionRange: ">=3.0.0",
|
|
@@ -524,7 +571,7 @@ var aiSDKConfigs = [
|
|
|
524
571
|
},
|
|
525
572
|
functionQuery: {
|
|
526
573
|
functionName: "streamText",
|
|
527
|
-
kind: "
|
|
574
|
+
kind: "Async"
|
|
528
575
|
}
|
|
529
576
|
},
|
|
530
577
|
// generateObject - async function
|
|
@@ -552,12 +599,62 @@ var aiSDKConfigs = [
|
|
|
552
599
|
kind: "Async"
|
|
553
600
|
}
|
|
554
601
|
},
|
|
555
|
-
//
|
|
602
|
+
// embed - async function
|
|
556
603
|
{
|
|
557
|
-
channelName: aiSDKChannels.
|
|
604
|
+
channelName: aiSDKChannels.embed.channelName,
|
|
605
|
+
module: {
|
|
606
|
+
name: "ai",
|
|
607
|
+
versionRange: ">=3.0.0",
|
|
608
|
+
filePath: "dist/index.mjs"
|
|
609
|
+
},
|
|
610
|
+
functionQuery: {
|
|
611
|
+
functionName: "embed",
|
|
612
|
+
kind: "Async"
|
|
613
|
+
}
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
channelName: aiSDKChannels.embed.channelName,
|
|
617
|
+
module: {
|
|
618
|
+
name: "ai",
|
|
619
|
+
versionRange: ">=3.0.0",
|
|
620
|
+
filePath: "dist/index.js"
|
|
621
|
+
},
|
|
622
|
+
functionQuery: {
|
|
623
|
+
functionName: "embed",
|
|
624
|
+
kind: "Async"
|
|
625
|
+
}
|
|
626
|
+
},
|
|
627
|
+
// embedMany - async function
|
|
628
|
+
{
|
|
629
|
+
channelName: aiSDKChannels.embedMany.channelName,
|
|
630
|
+
module: {
|
|
631
|
+
name: "ai",
|
|
632
|
+
versionRange: ">=3.0.0",
|
|
633
|
+
filePath: "dist/index.mjs"
|
|
634
|
+
},
|
|
635
|
+
functionQuery: {
|
|
636
|
+
functionName: "embedMany",
|
|
637
|
+
kind: "Async"
|
|
638
|
+
}
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
channelName: aiSDKChannels.embedMany.channelName,
|
|
558
642
|
module: {
|
|
559
643
|
name: "ai",
|
|
560
644
|
versionRange: ">=3.0.0",
|
|
645
|
+
filePath: "dist/index.js"
|
|
646
|
+
},
|
|
647
|
+
functionQuery: {
|
|
648
|
+
functionName: "embedMany",
|
|
649
|
+
kind: "Async"
|
|
650
|
+
}
|
|
651
|
+
},
|
|
652
|
+
// streamObject - async function (v3 only, before the sync refactor in v4)
|
|
653
|
+
{
|
|
654
|
+
channelName: aiSDKChannels.streamObject.channelName,
|
|
655
|
+
module: {
|
|
656
|
+
name: "ai",
|
|
657
|
+
versionRange: ">=3.0.0 <4.0.0",
|
|
561
658
|
filePath: "dist/index.mjs"
|
|
562
659
|
},
|
|
563
660
|
functionQuery: {
|
|
@@ -565,8 +662,21 @@ var aiSDKConfigs = [
|
|
|
565
662
|
kind: "Async"
|
|
566
663
|
}
|
|
567
664
|
},
|
|
665
|
+
// streamObject - sync function returning stream (v4+)
|
|
568
666
|
{
|
|
569
667
|
channelName: aiSDKChannels.streamObjectSync.channelName,
|
|
668
|
+
module: {
|
|
669
|
+
name: "ai",
|
|
670
|
+
versionRange: ">=4.0.0",
|
|
671
|
+
filePath: "dist/index.mjs"
|
|
672
|
+
},
|
|
673
|
+
functionQuery: {
|
|
674
|
+
functionName: "streamObject",
|
|
675
|
+
kind: "Sync"
|
|
676
|
+
}
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
channelName: aiSDKChannels.streamObject.channelName,
|
|
570
680
|
module: {
|
|
571
681
|
name: "ai",
|
|
572
682
|
versionRange: ">=3.0.0",
|
|
@@ -574,7 +684,7 @@ var aiSDKConfigs = [
|
|
|
574
684
|
},
|
|
575
685
|
functionQuery: {
|
|
576
686
|
functionName: "streamObject",
|
|
577
|
-
kind: "
|
|
687
|
+
kind: "Async"
|
|
578
688
|
}
|
|
579
689
|
},
|
|
580
690
|
// Agent.generate - async method (v5 only)
|
|
@@ -606,11 +716,11 @@ var aiSDKConfigs = [
|
|
|
606
716
|
index: 0
|
|
607
717
|
}
|
|
608
718
|
},
|
|
609
|
-
// Agent.stream -
|
|
719
|
+
// Agent.stream - sync method (v5 only)
|
|
610
720
|
// The compiled AI SDK bundle emits this as an anonymous class method, so we
|
|
611
|
-
// target the first
|
|
721
|
+
// target the first sync `stream` method in the file instead of a class name.
|
|
612
722
|
{
|
|
613
|
-
channelName: aiSDKChannels.
|
|
723
|
+
channelName: aiSDKChannels.agentStreamSync.channelName,
|
|
614
724
|
module: {
|
|
615
725
|
name: "ai",
|
|
616
726
|
versionRange: ">=5.0.0 <6.0.0",
|
|
@@ -618,12 +728,12 @@ var aiSDKConfigs = [
|
|
|
618
728
|
},
|
|
619
729
|
functionQuery: {
|
|
620
730
|
methodName: "stream",
|
|
621
|
-
kind: "
|
|
731
|
+
kind: "Sync",
|
|
622
732
|
index: 0
|
|
623
733
|
}
|
|
624
734
|
},
|
|
625
735
|
{
|
|
626
|
-
channelName: aiSDKChannels.
|
|
736
|
+
channelName: aiSDKChannels.agentStreamSync.channelName,
|
|
627
737
|
module: {
|
|
628
738
|
name: "ai",
|
|
629
739
|
versionRange: ">=5.0.0 <6.0.0",
|
|
@@ -631,7 +741,7 @@ var aiSDKConfigs = [
|
|
|
631
741
|
},
|
|
632
742
|
functionQuery: {
|
|
633
743
|
methodName: "stream",
|
|
634
|
-
kind: "
|
|
744
|
+
kind: "Sync",
|
|
635
745
|
index: 0
|
|
636
746
|
}
|
|
637
747
|
},
|
|
@@ -783,6 +893,38 @@ var googleGenAIConfigs = [
|
|
|
783
893
|
}
|
|
784
894
|
];
|
|
785
895
|
|
|
896
|
+
// src/instrumentation/plugins/openrouter-agent-channels.ts
|
|
897
|
+
var openRouterAgentChannels = defineChannels("@openrouter/agent", {
|
|
898
|
+
callModel: channel({
|
|
899
|
+
channelName: "callModel",
|
|
900
|
+
kind: "sync-stream"
|
|
901
|
+
}),
|
|
902
|
+
callModelTurn: channel({
|
|
903
|
+
channelName: "callModel.turn",
|
|
904
|
+
kind: "async"
|
|
905
|
+
}),
|
|
906
|
+
toolExecute: channel({
|
|
907
|
+
channelName: "tool.execute",
|
|
908
|
+
kind: "async"
|
|
909
|
+
})
|
|
910
|
+
});
|
|
911
|
+
|
|
912
|
+
// src/auto-instrumentations/configs/openrouter-agent.ts
|
|
913
|
+
var openRouterAgentConfigs = [
|
|
914
|
+
{
|
|
915
|
+
channelName: openRouterAgentChannels.callModel.channelName,
|
|
916
|
+
module: {
|
|
917
|
+
name: "@openrouter/agent",
|
|
918
|
+
versionRange: ">=0.1.2",
|
|
919
|
+
filePath: "esm/inner-loop/call-model.js"
|
|
920
|
+
},
|
|
921
|
+
functionQuery: {
|
|
922
|
+
functionName: "callModel",
|
|
923
|
+
kind: "Sync"
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
];
|
|
927
|
+
|
|
786
928
|
// src/instrumentation/plugins/openrouter-channels.ts
|
|
787
929
|
var openRouterChannels = defineChannels("@openrouter/sdk", {
|
|
788
930
|
chatSend: channel({
|
|
@@ -801,6 +943,10 @@ var openRouterChannels = defineChannels("@openrouter/sdk", {
|
|
|
801
943
|
channelName: "callModel",
|
|
802
944
|
kind: "sync-stream"
|
|
803
945
|
}),
|
|
946
|
+
callModelTurn: channel({
|
|
947
|
+
channelName: "callModel.turn",
|
|
948
|
+
kind: "async"
|
|
949
|
+
}),
|
|
804
950
|
toolExecute: channel({
|
|
805
951
|
channelName: "tool.execute",
|
|
806
952
|
kind: "async"
|
|
@@ -862,12 +1008,232 @@ var openRouterConfigs = [
|
|
|
862
1008
|
}
|
|
863
1009
|
}
|
|
864
1010
|
];
|
|
1011
|
+
|
|
1012
|
+
// src/instrumentation/plugins/mistral-channels.ts
|
|
1013
|
+
var mistralChannels = defineChannels("@mistralai/mistralai", {
|
|
1014
|
+
chatComplete: channel({
|
|
1015
|
+
channelName: "chat.complete",
|
|
1016
|
+
kind: "async"
|
|
1017
|
+
}),
|
|
1018
|
+
chatStream: channel({
|
|
1019
|
+
channelName: "chat.stream",
|
|
1020
|
+
kind: "async"
|
|
1021
|
+
}),
|
|
1022
|
+
embeddingsCreate: channel({
|
|
1023
|
+
channelName: "embeddings.create",
|
|
1024
|
+
kind: "async"
|
|
1025
|
+
}),
|
|
1026
|
+
fimComplete: channel({
|
|
1027
|
+
channelName: "fim.complete",
|
|
1028
|
+
kind: "async"
|
|
1029
|
+
}),
|
|
1030
|
+
fimStream: channel({
|
|
1031
|
+
channelName: "fim.stream",
|
|
1032
|
+
kind: "async"
|
|
1033
|
+
}),
|
|
1034
|
+
agentsComplete: channel({
|
|
1035
|
+
channelName: "agents.complete",
|
|
1036
|
+
kind: "async"
|
|
1037
|
+
}),
|
|
1038
|
+
agentsStream: channel({
|
|
1039
|
+
channelName: "agents.stream",
|
|
1040
|
+
kind: "async"
|
|
1041
|
+
})
|
|
1042
|
+
});
|
|
1043
|
+
|
|
1044
|
+
// src/auto-instrumentations/configs/mistral.ts
|
|
1045
|
+
var mistralConfigs = [
|
|
1046
|
+
{
|
|
1047
|
+
channelName: mistralChannels.chatComplete.channelName,
|
|
1048
|
+
module: {
|
|
1049
|
+
name: "@mistralai/mistralai",
|
|
1050
|
+
versionRange: ">=1.0.0 <2.0.0",
|
|
1051
|
+
filePath: "sdk/chat.js"
|
|
1052
|
+
},
|
|
1053
|
+
functionQuery: {
|
|
1054
|
+
className: "Chat",
|
|
1055
|
+
methodName: "complete",
|
|
1056
|
+
kind: "Async"
|
|
1057
|
+
}
|
|
1058
|
+
},
|
|
1059
|
+
{
|
|
1060
|
+
channelName: mistralChannels.chatComplete.channelName,
|
|
1061
|
+
module: {
|
|
1062
|
+
name: "@mistralai/mistralai",
|
|
1063
|
+
versionRange: ">=2.0.0 <3.0.0",
|
|
1064
|
+
filePath: "esm/sdk/chat.js"
|
|
1065
|
+
},
|
|
1066
|
+
functionQuery: {
|
|
1067
|
+
className: "Chat",
|
|
1068
|
+
methodName: "complete",
|
|
1069
|
+
kind: "Async"
|
|
1070
|
+
}
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
channelName: mistralChannels.chatStream.channelName,
|
|
1074
|
+
module: {
|
|
1075
|
+
name: "@mistralai/mistralai",
|
|
1076
|
+
versionRange: ">=1.0.0 <2.0.0",
|
|
1077
|
+
filePath: "sdk/chat.js"
|
|
1078
|
+
},
|
|
1079
|
+
functionQuery: {
|
|
1080
|
+
className: "Chat",
|
|
1081
|
+
methodName: "stream",
|
|
1082
|
+
kind: "Async"
|
|
1083
|
+
}
|
|
1084
|
+
},
|
|
1085
|
+
{
|
|
1086
|
+
channelName: mistralChannels.chatStream.channelName,
|
|
1087
|
+
module: {
|
|
1088
|
+
name: "@mistralai/mistralai",
|
|
1089
|
+
versionRange: ">=2.0.0 <3.0.0",
|
|
1090
|
+
filePath: "esm/sdk/chat.js"
|
|
1091
|
+
},
|
|
1092
|
+
functionQuery: {
|
|
1093
|
+
className: "Chat",
|
|
1094
|
+
methodName: "stream",
|
|
1095
|
+
kind: "Async"
|
|
1096
|
+
}
|
|
1097
|
+
},
|
|
1098
|
+
{
|
|
1099
|
+
channelName: mistralChannels.embeddingsCreate.channelName,
|
|
1100
|
+
module: {
|
|
1101
|
+
name: "@mistralai/mistralai",
|
|
1102
|
+
versionRange: ">=1.0.0 <2.0.0",
|
|
1103
|
+
filePath: "sdk/embeddings.js"
|
|
1104
|
+
},
|
|
1105
|
+
functionQuery: {
|
|
1106
|
+
className: "Embeddings",
|
|
1107
|
+
methodName: "create",
|
|
1108
|
+
kind: "Async"
|
|
1109
|
+
}
|
|
1110
|
+
},
|
|
1111
|
+
{
|
|
1112
|
+
channelName: mistralChannels.embeddingsCreate.channelName,
|
|
1113
|
+
module: {
|
|
1114
|
+
name: "@mistralai/mistralai",
|
|
1115
|
+
versionRange: ">=2.0.0 <3.0.0",
|
|
1116
|
+
filePath: "esm/sdk/embeddings.js"
|
|
1117
|
+
},
|
|
1118
|
+
functionQuery: {
|
|
1119
|
+
className: "Embeddings",
|
|
1120
|
+
methodName: "create",
|
|
1121
|
+
kind: "Async"
|
|
1122
|
+
}
|
|
1123
|
+
},
|
|
1124
|
+
{
|
|
1125
|
+
channelName: mistralChannels.fimComplete.channelName,
|
|
1126
|
+
module: {
|
|
1127
|
+
name: "@mistralai/mistralai",
|
|
1128
|
+
versionRange: ">=1.0.0 <2.0.0",
|
|
1129
|
+
filePath: "sdk/fim.js"
|
|
1130
|
+
},
|
|
1131
|
+
functionQuery: {
|
|
1132
|
+
className: "Fim",
|
|
1133
|
+
methodName: "complete",
|
|
1134
|
+
kind: "Async"
|
|
1135
|
+
}
|
|
1136
|
+
},
|
|
1137
|
+
{
|
|
1138
|
+
channelName: mistralChannels.fimComplete.channelName,
|
|
1139
|
+
module: {
|
|
1140
|
+
name: "@mistralai/mistralai",
|
|
1141
|
+
versionRange: ">=2.0.0 <3.0.0",
|
|
1142
|
+
filePath: "esm/sdk/fim.js"
|
|
1143
|
+
},
|
|
1144
|
+
functionQuery: {
|
|
1145
|
+
className: "Fim",
|
|
1146
|
+
methodName: "complete",
|
|
1147
|
+
kind: "Async"
|
|
1148
|
+
}
|
|
1149
|
+
},
|
|
1150
|
+
{
|
|
1151
|
+
channelName: mistralChannels.fimStream.channelName,
|
|
1152
|
+
module: {
|
|
1153
|
+
name: "@mistralai/mistralai",
|
|
1154
|
+
versionRange: ">=1.0.0 <2.0.0",
|
|
1155
|
+
filePath: "sdk/fim.js"
|
|
1156
|
+
},
|
|
1157
|
+
functionQuery: {
|
|
1158
|
+
className: "Fim",
|
|
1159
|
+
methodName: "stream",
|
|
1160
|
+
kind: "Async"
|
|
1161
|
+
}
|
|
1162
|
+
},
|
|
1163
|
+
{
|
|
1164
|
+
channelName: mistralChannels.fimStream.channelName,
|
|
1165
|
+
module: {
|
|
1166
|
+
name: "@mistralai/mistralai",
|
|
1167
|
+
versionRange: ">=2.0.0 <3.0.0",
|
|
1168
|
+
filePath: "esm/sdk/fim.js"
|
|
1169
|
+
},
|
|
1170
|
+
functionQuery: {
|
|
1171
|
+
className: "Fim",
|
|
1172
|
+
methodName: "stream",
|
|
1173
|
+
kind: "Async"
|
|
1174
|
+
}
|
|
1175
|
+
},
|
|
1176
|
+
{
|
|
1177
|
+
channelName: mistralChannels.agentsComplete.channelName,
|
|
1178
|
+
module: {
|
|
1179
|
+
name: "@mistralai/mistralai",
|
|
1180
|
+
versionRange: ">=1.0.0 <2.0.0",
|
|
1181
|
+
filePath: "sdk/agents.js"
|
|
1182
|
+
},
|
|
1183
|
+
functionQuery: {
|
|
1184
|
+
className: "Agents",
|
|
1185
|
+
methodName: "complete",
|
|
1186
|
+
kind: "Async"
|
|
1187
|
+
}
|
|
1188
|
+
},
|
|
1189
|
+
{
|
|
1190
|
+
channelName: mistralChannels.agentsComplete.channelName,
|
|
1191
|
+
module: {
|
|
1192
|
+
name: "@mistralai/mistralai",
|
|
1193
|
+
versionRange: ">=2.0.0 <3.0.0",
|
|
1194
|
+
filePath: "esm/sdk/agents.js"
|
|
1195
|
+
},
|
|
1196
|
+
functionQuery: {
|
|
1197
|
+
className: "Agents",
|
|
1198
|
+
methodName: "complete",
|
|
1199
|
+
kind: "Async"
|
|
1200
|
+
}
|
|
1201
|
+
},
|
|
1202
|
+
{
|
|
1203
|
+
channelName: mistralChannels.agentsStream.channelName,
|
|
1204
|
+
module: {
|
|
1205
|
+
name: "@mistralai/mistralai",
|
|
1206
|
+
versionRange: ">=1.0.0 <2.0.0",
|
|
1207
|
+
filePath: "sdk/agents.js"
|
|
1208
|
+
},
|
|
1209
|
+
functionQuery: {
|
|
1210
|
+
className: "Agents",
|
|
1211
|
+
methodName: "stream",
|
|
1212
|
+
kind: "Async"
|
|
1213
|
+
}
|
|
1214
|
+
},
|
|
1215
|
+
{
|
|
1216
|
+
channelName: mistralChannels.agentsStream.channelName,
|
|
1217
|
+
module: {
|
|
1218
|
+
name: "@mistralai/mistralai",
|
|
1219
|
+
versionRange: ">=2.0.0 <3.0.0",
|
|
1220
|
+
filePath: "esm/sdk/agents.js"
|
|
1221
|
+
},
|
|
1222
|
+
functionQuery: {
|
|
1223
|
+
className: "Agents",
|
|
1224
|
+
methodName: "stream",
|
|
1225
|
+
kind: "Async"
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
];
|
|
865
1229
|
// Annotate the CommonJS export names for ESM import in node:
|
|
866
1230
|
0 && (module.exports = {
|
|
867
1231
|
aiSDKConfigs,
|
|
868
1232
|
anthropicConfigs,
|
|
869
1233
|
claudeAgentSDKConfigs,
|
|
870
1234
|
googleGenAIConfigs,
|
|
1235
|
+
mistralConfigs,
|
|
1236
|
+
openRouterAgentConfigs,
|
|
871
1237
|
openRouterConfigs,
|
|
872
1238
|
openaiConfigs
|
|
873
1239
|
});
|
|
@@ -66,6 +66,10 @@ declare const claudeAgentSDKConfigs: InstrumentationConfig[];
|
|
|
66
66
|
*/
|
|
67
67
|
declare const googleGenAIConfigs: InstrumentationConfig[];
|
|
68
68
|
|
|
69
|
+
declare const openRouterAgentConfigs: InstrumentationConfig[];
|
|
70
|
+
|
|
69
71
|
declare const openRouterConfigs: InstrumentationConfig[];
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
declare const mistralConfigs: InstrumentationConfig[];
|
|
74
|
+
|
|
75
|
+
export { aiSDKConfigs, anthropicConfigs, claudeAgentSDKConfigs, googleGenAIConfigs, mistralConfigs, openRouterAgentConfigs, openRouterConfigs, openaiConfigs };
|
|
@@ -66,6 +66,10 @@ declare const claudeAgentSDKConfigs: InstrumentationConfig[];
|
|
|
66
66
|
*/
|
|
67
67
|
declare const googleGenAIConfigs: InstrumentationConfig[];
|
|
68
68
|
|
|
69
|
+
declare const openRouterAgentConfigs: InstrumentationConfig[];
|
|
70
|
+
|
|
69
71
|
declare const openRouterConfigs: InstrumentationConfig[];
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
declare const mistralConfigs: InstrumentationConfig[];
|
|
74
|
+
|
|
75
|
+
export { aiSDKConfigs, anthropicConfigs, claudeAgentSDKConfigs, googleGenAIConfigs, mistralConfigs, openRouterAgentConfigs, openRouterConfigs, openaiConfigs };
|
|
@@ -3,14 +3,18 @@ import {
|
|
|
3
3
|
anthropicConfigs,
|
|
4
4
|
claudeAgentSDKConfigs,
|
|
5
5
|
googleGenAIConfigs,
|
|
6
|
+
mistralConfigs,
|
|
7
|
+
openRouterAgentConfigs,
|
|
6
8
|
openRouterConfigs,
|
|
7
9
|
openaiConfigs
|
|
8
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-OLBMPZXE.mjs";
|
|
9
11
|
export {
|
|
10
12
|
aiSDKConfigs,
|
|
11
13
|
anthropicConfigs,
|
|
12
14
|
claudeAgentSDKConfigs,
|
|
13
15
|
googleGenAIConfigs,
|
|
16
|
+
mistralConfigs,
|
|
17
|
+
openRouterAgentConfigs,
|
|
14
18
|
openRouterConfigs,
|
|
15
19
|
openaiConfigs
|
|
16
20
|
};
|
|
@@ -34,7 +34,7 @@ __export(cjs_patch_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(cjs_patch_exports);
|
|
36
36
|
var import_code_transformer = require("@apm-js-collab/code-transformer");
|
|
37
|
-
var
|
|
37
|
+
var NodeModule = __toESM(require("module"));
|
|
38
38
|
var import_node_path2 = require("path");
|
|
39
39
|
var import_module_details_from_path = __toESM(require("module-details-from-path"));
|
|
40
40
|
|
|
@@ -52,11 +52,29 @@ function readPackageJson(baseDir) {
|
|
|
52
52
|
return void 0;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
+
function resolvePackageBaseDir(baseDir) {
|
|
56
|
+
try {
|
|
57
|
+
return (0, import_node_fs.realpathSync)(baseDir);
|
|
58
|
+
} catch {
|
|
59
|
+
return baseDir;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function readPackageJsonWithFallback(baseDir) {
|
|
63
|
+
const packageJson = readPackageJson(baseDir);
|
|
64
|
+
if (packageJson) {
|
|
65
|
+
return packageJson;
|
|
66
|
+
}
|
|
67
|
+
const resolvedBaseDir = resolvePackageBaseDir(baseDir);
|
|
68
|
+
if (resolvedBaseDir === baseDir) {
|
|
69
|
+
return void 0;
|
|
70
|
+
}
|
|
71
|
+
return readPackageJson(resolvedBaseDir);
|
|
72
|
+
}
|
|
55
73
|
function getPackageVersion(baseDir) {
|
|
56
74
|
if (packageVersions.has(baseDir)) {
|
|
57
75
|
return packageVersions.get(baseDir);
|
|
58
76
|
}
|
|
59
|
-
const packageJson =
|
|
77
|
+
const packageJson = readPackageJsonWithFallback(baseDir);
|
|
60
78
|
if (typeof packageJson?.version === "string") {
|
|
61
79
|
packageVersions.set(baseDir, packageJson.version);
|
|
62
80
|
return packageJson.version;
|
|
@@ -67,7 +85,7 @@ function getPackageName(baseDir) {
|
|
|
67
85
|
if (packageNames.has(baseDir)) {
|
|
68
86
|
return packageNames.get(baseDir);
|
|
69
87
|
}
|
|
70
|
-
const packageJson =
|
|
88
|
+
const packageJson = readPackageJsonWithFallback(baseDir);
|
|
71
89
|
if (typeof packageJson?.name === "string") {
|
|
72
90
|
packageNames.set(baseDir, packageJson.name);
|
|
73
91
|
return packageJson.name;
|
|
@@ -79,13 +97,16 @@ function getPackageName(baseDir) {
|
|
|
79
97
|
var ModulePatch = class {
|
|
80
98
|
packages;
|
|
81
99
|
instrumentator;
|
|
100
|
+
modulePrototype;
|
|
82
101
|
originalCompile;
|
|
83
102
|
constructor({
|
|
84
103
|
instrumentations = []
|
|
85
104
|
} = {}) {
|
|
105
|
+
const modulePrototype = resolveModulePrototype();
|
|
86
106
|
this.packages = new Set(instrumentations.map((i) => i.module.name));
|
|
87
107
|
this.instrumentator = (0, import_code_transformer.create)(instrumentations);
|
|
88
|
-
this.
|
|
108
|
+
this.modulePrototype = modulePrototype;
|
|
109
|
+
this.originalCompile = modulePrototype._compile;
|
|
89
110
|
}
|
|
90
111
|
/**
|
|
91
112
|
* Patches the Node.js module class method that is responsible for compiling code.
|
|
@@ -94,7 +115,7 @@ var ModulePatch = class {
|
|
|
94
115
|
*/
|
|
95
116
|
patch() {
|
|
96
117
|
const self = this;
|
|
97
|
-
|
|
118
|
+
this.modulePrototype._compile = function wrappedCompile(...args) {
|
|
98
119
|
const [content, filename] = args;
|
|
99
120
|
const normalizedForPlatform = filename.split("/").join(import_node_path2.sep);
|
|
100
121
|
const resolvedModule = (0, import_module_details_from_path.default)(normalizedForPlatform);
|
|
@@ -129,9 +150,16 @@ var ModulePatch = class {
|
|
|
129
150
|
* **Note**: This is intended to be used in testing only.
|
|
130
151
|
*/
|
|
131
152
|
unpatch() {
|
|
132
|
-
|
|
153
|
+
this.modulePrototype._compile = this.originalCompile;
|
|
133
154
|
}
|
|
134
155
|
};
|
|
156
|
+
function resolveModulePrototype() {
|
|
157
|
+
const moduleCtor = NodeModule.Module;
|
|
158
|
+
if (moduleCtor && typeof moduleCtor === "function") {
|
|
159
|
+
return moduleCtor.prototype;
|
|
160
|
+
}
|
|
161
|
+
return NodeModule.prototype;
|
|
162
|
+
}
|
|
135
163
|
// Annotate the CommonJS export names for ESM import in node:
|
|
136
164
|
0 && (module.exports = {
|
|
137
165
|
ModulePatch
|
|
@@ -8,6 +8,7 @@ import { InstrumentationConfig } from '@apm-js-collab/code-transformer';
|
|
|
8
8
|
declare class ModulePatch {
|
|
9
9
|
private packages;
|
|
10
10
|
private instrumentator;
|
|
11
|
+
private modulePrototype;
|
|
11
12
|
private originalCompile;
|
|
12
13
|
constructor({ instrumentations, }?: {
|
|
13
14
|
instrumentations?: InstrumentationConfig[];
|
|
@@ -8,6 +8,7 @@ import { InstrumentationConfig } from '@apm-js-collab/code-transformer';
|
|
|
8
8
|
declare class ModulePatch {
|
|
9
9
|
private packages;
|
|
10
10
|
private instrumentator;
|
|
11
|
+
private modulePrototype;
|
|
11
12
|
private originalCompile;
|
|
12
13
|
constructor({ instrumentations, }?: {
|
|
13
14
|
instrumentations?: InstrumentationConfig[];
|