braintrust 3.27.0 → 3.29.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/README.md +1 -1
- package/dev/dist/index.d.mts +879 -197
- package/dev/dist/index.d.ts +879 -197
- package/dev/dist/index.js +2960 -1865
- package/dev/dist/index.mjs +2217 -1122
- package/dist/apply-auto-instrumentation.js +345 -260
- package/dist/apply-auto-instrumentation.mjs +137 -52
- package/dist/auto-instrumentations/bundler/esbuild.cjs +124 -7
- package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
- package/dist/auto-instrumentations/bundler/next.cjs +124 -7
- package/dist/auto-instrumentations/bundler/next.mjs +3 -3
- package/dist/auto-instrumentations/bundler/rollup.cjs +124 -7
- package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
- package/dist/auto-instrumentations/bundler/vite.cjs +124 -7
- package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +124 -7
- package/dist/auto-instrumentations/bundler/webpack.cjs +124 -7
- package/dist/auto-instrumentations/bundler/webpack.mjs +3 -3
- package/dist/auto-instrumentations/{chunk-ZNHTSSGI.mjs → chunk-AOIYCVEL.mjs} +34 -3
- package/dist/auto-instrumentations/{chunk-XEYKUBLY.mjs → chunk-DKTGDNA7.mjs} +91 -5
- package/dist/auto-instrumentations/{chunk-BW33ULMW.mjs → chunk-OMCZ3MV2.mjs} +1 -1
- package/dist/auto-instrumentations/hook.mjs +1186 -161
- package/dist/auto-instrumentations/index.cjs +34 -3
- package/dist/auto-instrumentations/index.mjs +1 -1
- package/dist/browser.d.mts +1388 -75
- package/dist/browser.d.ts +1388 -75
- package/dist/browser.js +3954 -1124
- package/dist/browser.mjs +3954 -1124
- package/dist/{chunk-MF7NU6BT.js → chunk-6Z5S7VOU.js} +175 -25
- package/dist/{chunk-CZM5JIQL.mjs → chunk-7FA6VP2S.mjs} +172 -22
- package/dist/{chunk-YKD22IMR.mjs → chunk-M6XPNJC4.mjs} +2102 -1113
- package/dist/{chunk-QRHGVBKU.js → chunk-XLLGRXGR.js} +3273 -2284
- package/dist/cli.js +6353 -1483
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +3954 -1124
- package/dist/edge-light.mjs +3954 -1124
- package/dist/index.d.mts +1972 -659
- package/dist/index.d.ts +1972 -659
- package/dist/index.js +2453 -676
- package/dist/index.mjs +1973 -196
- package/dist/instrumentation/index.d.mts +738 -15
- package/dist/instrumentation/index.d.ts +738 -15
- package/dist/instrumentation/index.js +2791 -874
- package/dist/instrumentation/index.mjs +2791 -874
- package/dist/vitest-evals-reporter.js +16 -16
- package/dist/vitest-evals-reporter.mjs +2 -2
- package/dist/workerd.d.mts +1 -1
- package/dist/workerd.d.ts +1 -1
- package/dist/workerd.js +3954 -1124
- package/dist/workerd.mjs +3954 -1124
- package/package.json +2 -3
- package/util/dist/index.d.mts +1596 -109
- package/util/dist/index.d.ts +1596 -109
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
cloudflareThinkChannels,
|
|
13
13
|
cohereChannels,
|
|
14
14
|
cursorSDKChannels,
|
|
15
|
+
debugLogger,
|
|
15
16
|
flueChannels,
|
|
16
17
|
genkitChannels,
|
|
17
18
|
genkitCoreChannels,
|
|
@@ -37,10 +38,11 @@ import {
|
|
|
37
38
|
readDisabledInstrumentationEnvConfig,
|
|
38
39
|
smithyClientChannels,
|
|
39
40
|
smithyCoreChannels,
|
|
40
|
-
strandsAgentSDKChannels
|
|
41
|
-
|
|
41
|
+
strandsAgentSDKChannels,
|
|
42
|
+
voyageAIChannels
|
|
43
|
+
} from "./chunk-7FA6VP2S.mjs";
|
|
42
44
|
|
|
43
|
-
// src/node/apply-auto-instrumentation
|
|
45
|
+
// src/node/apply-auto-instrumentation.ts
|
|
44
46
|
import { register } from "node:module";
|
|
45
47
|
import { pathToFileURL } from "node:url";
|
|
46
48
|
|
|
@@ -93,6 +95,33 @@ var aiSDKConfigs = [
|
|
|
93
95
|
kind: "Async"
|
|
94
96
|
}
|
|
95
97
|
},
|
|
98
|
+
// generateImage - stable in v6+, experimental alias in v5
|
|
99
|
+
...[
|
|
100
|
+
{
|
|
101
|
+
functionName: "generateImage",
|
|
102
|
+
versionRange: ">=6.0.0 <8.0.0",
|
|
103
|
+
isExportAlias: false
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
functionName: "experimental_generateImage",
|
|
107
|
+
versionRange: ">=5.0.0 <6.0.0",
|
|
108
|
+
isExportAlias: true
|
|
109
|
+
}
|
|
110
|
+
].flatMap(
|
|
111
|
+
({ functionName, versionRange: versionRange2, isExportAlias }) => ["dist/index.mjs", "dist/index.js"].map((filePath) => ({
|
|
112
|
+
channelName: aiSDKChannels.generateImage.channelName,
|
|
113
|
+
module: {
|
|
114
|
+
name: "ai",
|
|
115
|
+
versionRange: versionRange2,
|
|
116
|
+
filePath
|
|
117
|
+
},
|
|
118
|
+
functionQuery: {
|
|
119
|
+
functionName,
|
|
120
|
+
kind: "Async",
|
|
121
|
+
...isExportAlias ? { isExportAlias } : {}
|
|
122
|
+
}
|
|
123
|
+
}))
|
|
124
|
+
),
|
|
96
125
|
// streamText - async function (v3 only, before the sync refactor in v4)
|
|
97
126
|
{
|
|
98
127
|
channelName: aiSDKChannels.streamText.channelName,
|
|
@@ -2721,6 +2750,53 @@ var strandsAgentSDKConfigs = [
|
|
|
2721
2750
|
}
|
|
2722
2751
|
];
|
|
2723
2752
|
|
|
2753
|
+
// src/auto-instrumentations/configs/voyageai.ts
|
|
2754
|
+
var GENERATED_CLIENT_MODULES = [
|
|
2755
|
+
"dist/cjs/Client.js",
|
|
2756
|
+
"dist/esm/Client.mjs"
|
|
2757
|
+
];
|
|
2758
|
+
var generatedClientOperations = [
|
|
2759
|
+
{
|
|
2760
|
+
channelName: voyageAIChannels.embed.channelName,
|
|
2761
|
+
methodName: "embed",
|
|
2762
|
+
versionRange: ">=0.2.0 <1.0.0"
|
|
2763
|
+
},
|
|
2764
|
+
{
|
|
2765
|
+
channelName: voyageAIChannels.multimodalEmbed.channelName,
|
|
2766
|
+
methodName: "multimodalEmbed",
|
|
2767
|
+
versionRange: ">=0.2.0 <1.0.0"
|
|
2768
|
+
},
|
|
2769
|
+
{
|
|
2770
|
+
channelName: voyageAIChannels.rerank.channelName,
|
|
2771
|
+
methodName: "rerank",
|
|
2772
|
+
versionRange: ">=0.2.0 <1.0.0"
|
|
2773
|
+
},
|
|
2774
|
+
{
|
|
2775
|
+
channelName: voyageAIChannels.contextualizedEmbed.channelName,
|
|
2776
|
+
methodName: "contextualizedEmbed",
|
|
2777
|
+
versionRange: ">=0.2.0 <1.0.0"
|
|
2778
|
+
}
|
|
2779
|
+
];
|
|
2780
|
+
var voyageAIConfigs = [
|
|
2781
|
+
...GENERATED_CLIENT_MODULES.flatMap(
|
|
2782
|
+
(filePath) => generatedClientOperations.map(
|
|
2783
|
+
({ channelName, methodName, versionRange: versionRange2 }) => ({
|
|
2784
|
+
channelName,
|
|
2785
|
+
module: {
|
|
2786
|
+
name: "voyageai",
|
|
2787
|
+
versionRange: versionRange2,
|
|
2788
|
+
filePath
|
|
2789
|
+
},
|
|
2790
|
+
functionQuery: {
|
|
2791
|
+
className: "VoyageAIClient",
|
|
2792
|
+
methodName,
|
|
2793
|
+
kind: "Async"
|
|
2794
|
+
}
|
|
2795
|
+
})
|
|
2796
|
+
)
|
|
2797
|
+
)
|
|
2798
|
+
];
|
|
2799
|
+
|
|
2724
2800
|
// src/auto-instrumentations/configs/all.ts
|
|
2725
2801
|
var defaultInstrumentationConfigGroups = [
|
|
2726
2802
|
{ integrations: ["openai"], configs: openaiConfigs },
|
|
@@ -2800,6 +2876,10 @@ var defaultInstrumentationConfigGroups = [
|
|
|
2800
2876
|
{
|
|
2801
2877
|
integrations: ["flue"],
|
|
2802
2878
|
configs: flueConfigs
|
|
2879
|
+
},
|
|
2880
|
+
{
|
|
2881
|
+
integrations: ["voyageai"],
|
|
2882
|
+
configs: voyageAIConfigs
|
|
2803
2883
|
}
|
|
2804
2884
|
// Note: `@mastra/core` is not listed here because its instrumentation
|
|
2805
2885
|
// doesn't go through the AST `code-transformer` matcher — Mastra's
|
|
@@ -2824,8 +2904,9 @@ function getDefaultInstrumentationConfigs({
|
|
|
2824
2904
|
...additionalInstrumentations ?? []
|
|
2825
2905
|
];
|
|
2826
2906
|
}
|
|
2827
|
-
function getDefaultAutoInstrumentationConfigs() {
|
|
2907
|
+
function getDefaultAutoInstrumentationConfigs(additionalInstrumentations) {
|
|
2828
2908
|
return getDefaultInstrumentationConfigs({
|
|
2909
|
+
additionalInstrumentations,
|
|
2829
2910
|
disabledIntegrationConfig: readDisabledInstrumentationEnvConfig(
|
|
2830
2911
|
process.env.BRAINTRUST_DISABLE_INSTRUMENTATION
|
|
2831
2912
|
).integrations
|
|
@@ -2853,11 +2934,11 @@ function formatChannelGetter(channelName) {
|
|
|
2853
2934
|
return `tr_ch_bt$get_${channelName.replace(CHANNEL_REGEX, "_")}`;
|
|
2854
2935
|
}
|
|
2855
2936
|
var transforms = {
|
|
2856
|
-
tracingHookDeclaration(
|
|
2937
|
+
tracingHookDeclaration(state, node) {
|
|
2857
2938
|
const {
|
|
2858
2939
|
channelName,
|
|
2859
2940
|
module: { name }
|
|
2860
|
-
} =
|
|
2941
|
+
} = state;
|
|
2861
2942
|
const channelVariable = formatChannelVariable(channelName);
|
|
2862
2943
|
const channelGetter = formatChannelGetter(channelName);
|
|
2863
2944
|
const hasSharedHookLookup = node.body.some(
|
|
@@ -2919,23 +3000,23 @@ var transforms = {
|
|
|
2919
3000
|
tracePromise: traceAny,
|
|
2920
3001
|
traceSync: traceAny
|
|
2921
3002
|
};
|
|
2922
|
-
function traceAny(
|
|
3003
|
+
function traceAny(state, node, _parent, ancestry) {
|
|
2923
3004
|
const program = ancestry[ancestry.length - 1];
|
|
2924
3005
|
if (node.type === "ClassDeclaration" || node.type === "ClassExpression") {
|
|
2925
|
-
traceInstanceMethod(
|
|
3006
|
+
traceInstanceMethod(state, node, program);
|
|
2926
3007
|
} else {
|
|
2927
|
-
traceFunction(
|
|
3008
|
+
traceFunction(state, node, program);
|
|
2928
3009
|
}
|
|
2929
3010
|
}
|
|
2930
|
-
function traceFunction(
|
|
2931
|
-
transforms.tracingHookDeclaration(
|
|
2932
|
-
const { functionQuery } =
|
|
3011
|
+
function traceFunction(state, node, program) {
|
|
3012
|
+
transforms.tracingHookDeclaration(state, program, null, []);
|
|
3013
|
+
const { functionQuery } = state;
|
|
2933
3014
|
const methodName = "methodName" in functionQuery ? functionQuery.methodName : void 0;
|
|
2934
3015
|
const privateMethodName = "privateMethodName" in functionQuery ? functionQuery.privateMethodName : void 0;
|
|
2935
3016
|
const functionName = "functionName" in functionQuery ? functionQuery.functionName : void 0;
|
|
2936
3017
|
const isConstructor = methodName === "constructor" || !methodName && !privateMethodName && !functionName;
|
|
2937
3018
|
const type = isConstructor ? "ArrowFunctionExpression" : "FunctionExpression";
|
|
2938
|
-
node.body = wrap(
|
|
3019
|
+
node.body = wrap(state, {
|
|
2939
3020
|
type,
|
|
2940
3021
|
params: node.params,
|
|
2941
3022
|
body: node.body,
|
|
@@ -2947,8 +3028,8 @@ function traceFunction(state2, node, program) {
|
|
|
2947
3028
|
node.async = false;
|
|
2948
3029
|
wrapSuper(node);
|
|
2949
3030
|
}
|
|
2950
|
-
function traceInstanceMethod(
|
|
2951
|
-
const { functionQuery, operator } =
|
|
3031
|
+
function traceInstanceMethod(state, node, program) {
|
|
3032
|
+
const { functionQuery, operator } = state;
|
|
2952
3033
|
const { methodName } = functionQuery;
|
|
2953
3034
|
if (!methodName) {
|
|
2954
3035
|
return;
|
|
@@ -2958,7 +3039,7 @@ function traceInstanceMethod(state2, node, program) {
|
|
|
2958
3039
|
return;
|
|
2959
3040
|
}
|
|
2960
3041
|
let ctor = classBody.body.find(({ kind }) => kind === "constructor");
|
|
2961
|
-
transforms.tracingHookDeclaration(
|
|
3042
|
+
transforms.tracingHookDeclaration(state, program, null, []);
|
|
2962
3043
|
if (!ctor) {
|
|
2963
3044
|
ctor = parse(
|
|
2964
3045
|
node.superClass ? "class A extends Object { constructor (...args) { super(...args) } }" : "class A { constructor () {} }"
|
|
@@ -2971,15 +3052,15 @@ function traceInstanceMethod(state2, node, program) {
|
|
|
2971
3052
|
`).body;
|
|
2972
3053
|
const fn = ctorBody[1].expression.right;
|
|
2973
3054
|
fn.async = operator === "tracePromise";
|
|
2974
|
-
fn.body = wrap(
|
|
3055
|
+
fn.body = wrap(state, {
|
|
2975
3056
|
type: "Identifier",
|
|
2976
3057
|
name: `__bt$${methodName}`
|
|
2977
3058
|
});
|
|
2978
3059
|
wrapSuper(fn);
|
|
2979
3060
|
ctor.value.body.body.push(...ctorBody);
|
|
2980
3061
|
}
|
|
2981
|
-
function wrap(
|
|
2982
|
-
const wrapper = wrapInvocation(
|
|
3062
|
+
function wrap(state, node) {
|
|
3063
|
+
const wrapper = wrapInvocation(state);
|
|
2983
3064
|
const block = wrapper.body[0].body;
|
|
2984
3065
|
const common = parse(
|
|
2985
3066
|
node.type === "ArrowFunctionExpression" ? `
|
|
@@ -3032,8 +3113,8 @@ function wrapSuper(node) {
|
|
|
3032
3113
|
node.body.body.unshift(parse("const __bt$super = {}").body[0]);
|
|
3033
3114
|
}
|
|
3034
3115
|
}
|
|
3035
|
-
function wrapInvocation(
|
|
3036
|
-
const { channelName, moduleVersion, operator, functionQuery } =
|
|
3116
|
+
function wrapInvocation(state) {
|
|
3117
|
+
const { channelName, moduleVersion, operator, functionQuery } = state;
|
|
3037
3118
|
const channelGetter = formatChannelGetter(channelName);
|
|
3038
3119
|
const callbackIndex = functionQuery.callbackIndex ?? -1;
|
|
3039
3120
|
return parse(`
|
|
@@ -3101,7 +3182,7 @@ var Transformer = class {
|
|
|
3101
3182
|
aliases
|
|
3102
3183
|
);
|
|
3103
3184
|
const query = astQuery || this.fromFunctionQuery(resolvedFunctionQuery);
|
|
3104
|
-
const
|
|
3185
|
+
const state = {
|
|
3105
3186
|
...config,
|
|
3106
3187
|
moduleVersion: this.version,
|
|
3107
3188
|
functionQuery: resolvedFunctionQuery,
|
|
@@ -3109,7 +3190,7 @@ var Transformer = class {
|
|
|
3109
3190
|
};
|
|
3110
3191
|
esquery2.traverse(ast, esquery2.parse(query), (...args) => {
|
|
3111
3192
|
injectionCount++;
|
|
3112
|
-
this.visit(
|
|
3193
|
+
this.visit(state, ...args);
|
|
3113
3194
|
});
|
|
3114
3195
|
}
|
|
3115
3196
|
if (injectionCount === 0 && this.configs.length > 0) {
|
|
@@ -3139,21 +3220,21 @@ var Transformer = class {
|
|
|
3139
3220
|
}
|
|
3140
3221
|
free() {
|
|
3141
3222
|
}
|
|
3142
|
-
visit(
|
|
3143
|
-
const transform = transforms[
|
|
3144
|
-
const { index = 0 } =
|
|
3223
|
+
visit(state, ...args) {
|
|
3224
|
+
const transform = transforms[state.operator];
|
|
3225
|
+
const { index = 0 } = state.functionQuery;
|
|
3145
3226
|
const [node] = args;
|
|
3146
3227
|
const type = node.init?.type || node.type;
|
|
3147
3228
|
if (type !== "ClassDeclaration" && type !== "ClassExpression") {
|
|
3148
3229
|
if (node.type === "VariableDeclarator") {
|
|
3149
3230
|
return;
|
|
3150
3231
|
}
|
|
3151
|
-
|
|
3152
|
-
if (index !== null && index !==
|
|
3232
|
+
state.functionIndex = state.functionIndex === void 0 ? 0 : state.functionIndex + 1;
|
|
3233
|
+
if (index !== null && index !== state.functionIndex) {
|
|
3153
3234
|
return;
|
|
3154
3235
|
}
|
|
3155
3236
|
}
|
|
3156
|
-
transform(
|
|
3237
|
+
transform(state, ...args);
|
|
3157
3238
|
}
|
|
3158
3239
|
getOperator(kind) {
|
|
3159
3240
|
switch (kind) {
|
|
@@ -3465,26 +3546,27 @@ function resolveModulePrototype() {
|
|
|
3465
3546
|
return NodeModule.prototype;
|
|
3466
3547
|
}
|
|
3467
3548
|
|
|
3468
|
-
// src/node/apply-auto-instrumentation
|
|
3549
|
+
// src/node/apply-auto-instrumentation.ts
|
|
3469
3550
|
var stateKey = /* @__PURE__ */ Symbol.for(
|
|
3470
3551
|
`braintrust.applyAutoInstrumentation.global-hooks.v${GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION}`
|
|
3471
3552
|
);
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
existingState
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
}
|
|
3486
|
-
|
|
3487
|
-
|
|
3553
|
+
function applyAutoInstrumentation() {
|
|
3554
|
+
const existingState = Object.getOwnPropertyDescriptor(
|
|
3555
|
+
globalThis,
|
|
3556
|
+
stateKey
|
|
3557
|
+
)?.value;
|
|
3558
|
+
const state = typeof existingState === "object" && existingState !== null ? existingState : {};
|
|
3559
|
+
if (state !== existingState) {
|
|
3560
|
+
Object.defineProperty(globalThis, stateKey, {
|
|
3561
|
+
configurable: false,
|
|
3562
|
+
enumerable: false,
|
|
3563
|
+
value: state,
|
|
3564
|
+
writable: false
|
|
3565
|
+
});
|
|
3566
|
+
}
|
|
3567
|
+
if (state.applied) {
|
|
3568
|
+
return;
|
|
3569
|
+
}
|
|
3488
3570
|
const allConfigs = getDefaultAutoInstrumentationConfigs();
|
|
3489
3571
|
const currentModuleUrl = getCurrentModuleUrl();
|
|
3490
3572
|
register("./auto-instrumentations/loader/esm-hook.mjs", {
|
|
@@ -3493,14 +3575,14 @@ if (!state.applied) {
|
|
|
3493
3575
|
});
|
|
3494
3576
|
state.applied = true;
|
|
3495
3577
|
try {
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3578
|
+
new ModulePatch({ instrumentations: allConfigs }).patch();
|
|
3579
|
+
} catch (error) {
|
|
3580
|
+
debugLogger.warn(
|
|
3581
|
+
"Failed to enable CommonJS auto-instrumentation; ESM instrumentation remains active:",
|
|
3582
|
+
error
|
|
3583
|
+
);
|
|
3499
3584
|
}
|
|
3500
3585
|
}
|
|
3501
|
-
function isApplyAutoInstrumentationState(value) {
|
|
3502
|
-
return typeof value === "object" && value !== null;
|
|
3503
|
-
}
|
|
3504
3586
|
function getCurrentModuleUrl() {
|
|
3505
3587
|
if (typeof __filename !== "undefined") {
|
|
3506
3588
|
return pathToFileURL(__filename).href;
|
|
@@ -3512,3 +3594,6 @@ function getCurrentModuleUrl() {
|
|
|
3512
3594
|
}
|
|
3513
3595
|
return pathToFileURL(process.argv[1] ?? process.cwd()).href;
|
|
3514
3596
|
}
|
|
3597
|
+
|
|
3598
|
+
// src/node/apply-auto-instrumentation-entry.ts
|
|
3599
|
+
applyAutoInstrumentation();
|
|
@@ -1218,7 +1218,10 @@ var envIntegrationAliases = {
|
|
|
1218
1218
|
"langchain-js": "langchain",
|
|
1219
1219
|
"@langchain": "langchain",
|
|
1220
1220
|
langgraph: "langgraph",
|
|
1221
|
-
langsmith: "langsmith"
|
|
1221
|
+
langsmith: "langsmith",
|
|
1222
|
+
voyage: "voyageai",
|
|
1223
|
+
"voyage-ai": "voyageai",
|
|
1224
|
+
voyageai: "voyageai"
|
|
1222
1225
|
};
|
|
1223
1226
|
function readDisabledInstrumentationEnvConfig(disabledList) {
|
|
1224
1227
|
const integrations = {};
|
|
@@ -1241,8 +1244,6 @@ function isInstrumentationIntegrationDisabled(integrations, ...names) {
|
|
|
1241
1244
|
var DefaultAsyncLocalStorage = class {
|
|
1242
1245
|
constructor() {
|
|
1243
1246
|
}
|
|
1244
|
-
enterWith(_) {
|
|
1245
|
-
}
|
|
1246
1247
|
run(_, callback) {
|
|
1247
1248
|
return callback();
|
|
1248
1249
|
}
|
|
@@ -1350,6 +1351,7 @@ var INSTRUMENTATION_NAMES = {
|
|
|
1350
1351
|
CLOUDFLARE_THINK: "cloudflare-think",
|
|
1351
1352
|
COHERE: "cohere",
|
|
1352
1353
|
CURSOR_SDK: "cursor-sdk",
|
|
1354
|
+
DEEPSEEK_HARNESS: "deepseek-harness",
|
|
1353
1355
|
EVE: "eve",
|
|
1354
1356
|
FLUE: "flue",
|
|
1355
1357
|
GENKIT: "genkit",
|
|
@@ -1369,7 +1371,8 @@ var INSTRUMENTATION_NAMES = {
|
|
|
1369
1371
|
OPENROUTER: "openrouter",
|
|
1370
1372
|
OPENROUTER_AGENT: "openrouter-agent",
|
|
1371
1373
|
PI_CODING_AGENT: "pi-coding-agent",
|
|
1372
|
-
STRANDS_AGENT_SDK: "strands-agent-sdk"
|
|
1374
|
+
STRANDS_AGENT_SDK: "strands-agent-sdk",
|
|
1375
|
+
VOYAGEAI: "voyageai"
|
|
1373
1376
|
};
|
|
1374
1377
|
|
|
1375
1378
|
// src/instrumentation/plugins/ai-sdk-channels.ts
|
|
@@ -1380,6 +1383,10 @@ var aiSDKChannels = defineChannels(
|
|
|
1380
1383
|
channelName: "generateText",
|
|
1381
1384
|
kind: "async"
|
|
1382
1385
|
}),
|
|
1386
|
+
generateImage: channel({
|
|
1387
|
+
channelName: "generateImage",
|
|
1388
|
+
kind: "async"
|
|
1389
|
+
}),
|
|
1383
1390
|
streamText: channel({
|
|
1384
1391
|
channelName: "streamText",
|
|
1385
1392
|
kind: "async"
|
|
@@ -1519,6 +1526,33 @@ var aiSDKConfigs = [
|
|
|
1519
1526
|
kind: "Async"
|
|
1520
1527
|
}
|
|
1521
1528
|
},
|
|
1529
|
+
// generateImage - stable in v6+, experimental alias in v5
|
|
1530
|
+
...[
|
|
1531
|
+
{
|
|
1532
|
+
functionName: "generateImage",
|
|
1533
|
+
versionRange: ">=6.0.0 <8.0.0",
|
|
1534
|
+
isExportAlias: false
|
|
1535
|
+
},
|
|
1536
|
+
{
|
|
1537
|
+
functionName: "experimental_generateImage",
|
|
1538
|
+
versionRange: ">=5.0.0 <6.0.0",
|
|
1539
|
+
isExportAlias: true
|
|
1540
|
+
}
|
|
1541
|
+
].flatMap(
|
|
1542
|
+
({ functionName, versionRange: versionRange2, isExportAlias }) => ["dist/index.mjs", "dist/index.js"].map((filePath) => ({
|
|
1543
|
+
channelName: aiSDKChannels.generateImage.channelName,
|
|
1544
|
+
module: {
|
|
1545
|
+
name: "ai",
|
|
1546
|
+
versionRange: versionRange2,
|
|
1547
|
+
filePath
|
|
1548
|
+
},
|
|
1549
|
+
functionQuery: {
|
|
1550
|
+
functionName,
|
|
1551
|
+
kind: "Async",
|
|
1552
|
+
...isExportAlias ? { isExportAlias } : {}
|
|
1553
|
+
}
|
|
1554
|
+
}))
|
|
1555
|
+
),
|
|
1522
1556
|
// streamText - async function (v3 only, before the sync refactor in v4)
|
|
1523
1557
|
{
|
|
1524
1558
|
channelName: aiSDKChannels.streamText.channelName,
|
|
@@ -4760,6 +4794,77 @@ var strandsAgentSDKConfigs = [
|
|
|
4760
4794
|
}
|
|
4761
4795
|
];
|
|
4762
4796
|
|
|
4797
|
+
// src/instrumentation/plugins/voyageai-channels.ts
|
|
4798
|
+
var voyageAIChannels = defineChannels(
|
|
4799
|
+
"voyageai",
|
|
4800
|
+
{
|
|
4801
|
+
embed: channel({
|
|
4802
|
+
channelName: "embed",
|
|
4803
|
+
kind: "async"
|
|
4804
|
+
}),
|
|
4805
|
+
multimodalEmbed: channel({
|
|
4806
|
+
channelName: "multimodalEmbed",
|
|
4807
|
+
kind: "async"
|
|
4808
|
+
}),
|
|
4809
|
+
rerank: channel({
|
|
4810
|
+
channelName: "rerank",
|
|
4811
|
+
kind: "async"
|
|
4812
|
+
}),
|
|
4813
|
+
contextualizedEmbed: channel({
|
|
4814
|
+
channelName: "contextualizedEmbed",
|
|
4815
|
+
kind: "async"
|
|
4816
|
+
})
|
|
4817
|
+
},
|
|
4818
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.VOYAGEAI }
|
|
4819
|
+
);
|
|
4820
|
+
|
|
4821
|
+
// src/auto-instrumentations/configs/voyageai.ts
|
|
4822
|
+
var GENERATED_CLIENT_MODULES = [
|
|
4823
|
+
"dist/cjs/Client.js",
|
|
4824
|
+
"dist/esm/Client.mjs"
|
|
4825
|
+
];
|
|
4826
|
+
var generatedClientOperations = [
|
|
4827
|
+
{
|
|
4828
|
+
channelName: voyageAIChannels.embed.channelName,
|
|
4829
|
+
methodName: "embed",
|
|
4830
|
+
versionRange: ">=0.2.0 <1.0.0"
|
|
4831
|
+
},
|
|
4832
|
+
{
|
|
4833
|
+
channelName: voyageAIChannels.multimodalEmbed.channelName,
|
|
4834
|
+
methodName: "multimodalEmbed",
|
|
4835
|
+
versionRange: ">=0.2.0 <1.0.0"
|
|
4836
|
+
},
|
|
4837
|
+
{
|
|
4838
|
+
channelName: voyageAIChannels.rerank.channelName,
|
|
4839
|
+
methodName: "rerank",
|
|
4840
|
+
versionRange: ">=0.2.0 <1.0.0"
|
|
4841
|
+
},
|
|
4842
|
+
{
|
|
4843
|
+
channelName: voyageAIChannels.contextualizedEmbed.channelName,
|
|
4844
|
+
methodName: "contextualizedEmbed",
|
|
4845
|
+
versionRange: ">=0.2.0 <1.0.0"
|
|
4846
|
+
}
|
|
4847
|
+
];
|
|
4848
|
+
var voyageAIConfigs = [
|
|
4849
|
+
...GENERATED_CLIENT_MODULES.flatMap(
|
|
4850
|
+
(filePath) => generatedClientOperations.map(
|
|
4851
|
+
({ channelName, methodName, versionRange: versionRange2 }) => ({
|
|
4852
|
+
channelName,
|
|
4853
|
+
module: {
|
|
4854
|
+
name: "voyageai",
|
|
4855
|
+
versionRange: versionRange2,
|
|
4856
|
+
filePath
|
|
4857
|
+
},
|
|
4858
|
+
functionQuery: {
|
|
4859
|
+
className: "VoyageAIClient",
|
|
4860
|
+
methodName,
|
|
4861
|
+
kind: "Async"
|
|
4862
|
+
}
|
|
4863
|
+
})
|
|
4864
|
+
)
|
|
4865
|
+
)
|
|
4866
|
+
];
|
|
4867
|
+
|
|
4763
4868
|
// src/auto-instrumentations/configs/all.ts
|
|
4764
4869
|
var defaultInstrumentationConfigGroups = [
|
|
4765
4870
|
{ integrations: ["openai"], configs: openaiConfigs },
|
|
@@ -4839,6 +4944,10 @@ var defaultInstrumentationConfigGroups = [
|
|
|
4839
4944
|
{
|
|
4840
4945
|
integrations: ["flue"],
|
|
4841
4946
|
configs: flueConfigs
|
|
4947
|
+
},
|
|
4948
|
+
{
|
|
4949
|
+
integrations: ["voyageai"],
|
|
4950
|
+
configs: voyageAIConfigs
|
|
4842
4951
|
}
|
|
4843
4952
|
// Note: `@mastra/core` is not listed here because its instrumentation
|
|
4844
4953
|
// doesn't go through the AST `code-transformer` matcher — Mastra's
|
|
@@ -4863,6 +4972,14 @@ function getDefaultInstrumentationConfigs({
|
|
|
4863
4972
|
...additionalInstrumentations ?? []
|
|
4864
4973
|
];
|
|
4865
4974
|
}
|
|
4975
|
+
function getDefaultAutoInstrumentationConfigs(additionalInstrumentations) {
|
|
4976
|
+
return getDefaultInstrumentationConfigs({
|
|
4977
|
+
additionalInstrumentations,
|
|
4978
|
+
disabledIntegrationConfig: readDisabledInstrumentationEnvConfig(
|
|
4979
|
+
process.env.BRAINTRUST_DISABLE_INSTRUMENTATION
|
|
4980
|
+
).integrations
|
|
4981
|
+
});
|
|
4982
|
+
}
|
|
4866
4983
|
|
|
4867
4984
|
// src/auto-instrumentations/loader/mastra-observability-patch.ts
|
|
4868
4985
|
var MASTRA_EXPORTER_FACTORY_GLOBAL = "__braintrustMastraExporterFactory";
|
|
@@ -5129,9 +5246,9 @@ function getModuleVersion(basedir) {
|
|
|
5129
5246
|
}
|
|
5130
5247
|
var unplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
|
|
5131
5248
|
const browser = options.browser ?? options.useDiagnosticChannelCompatShim ?? false;
|
|
5132
|
-
const allInstrumentations =
|
|
5133
|
-
|
|
5134
|
-
|
|
5249
|
+
const allInstrumentations = getDefaultAutoInstrumentationConfigs(
|
|
5250
|
+
options.instrumentations
|
|
5251
|
+
);
|
|
5135
5252
|
const instrumentationMatcher = create(allInstrumentations);
|
|
5136
5253
|
return {
|
|
5137
5254
|
name: "code-transformer",
|