braintrust 3.28.0 → 3.30.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 +356 -7
- package/dev/dist/index.d.ts +356 -7
- package/dev/dist/index.js +2679 -1828
- package/dev/dist/index.mjs +1862 -1011
- package/dist/apply-auto-instrumentation.js +298 -265
- package/dist/apply-auto-instrumentation.mjs +85 -52
- package/dist/auto-instrumentations/bundler/esbuild.cjs +56 -6
- package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
- package/dist/auto-instrumentations/bundler/next.cjs +56 -6
- package/dist/auto-instrumentations/bundler/next.mjs +3 -3
- package/dist/auto-instrumentations/bundler/rollup.cjs +56 -6
- package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
- package/dist/auto-instrumentations/bundler/vite.cjs +56 -6
- package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +56 -6
- package/dist/auto-instrumentations/bundler/webpack.cjs +56 -6
- package/dist/auto-instrumentations/bundler/webpack.mjs +3 -3
- package/dist/auto-instrumentations/{chunk-26PKVUKB.mjs → chunk-LW4HDHXT.mjs} +12 -4
- package/dist/auto-instrumentations/{chunk-HD35AM3M.mjs → chunk-OXINGIEZ.mjs} +1 -1
- package/dist/auto-instrumentations/{chunk-NP7V4XB2.mjs → chunk-U64OYU4Q.mjs} +45 -3
- package/dist/auto-instrumentations/hook.mjs +967 -136
- package/dist/auto-instrumentations/index.cjs +45 -3
- package/dist/auto-instrumentations/index.mjs +1 -1
- package/dist/browser.d.mts +893 -24
- package/dist/browser.d.ts +893 -24
- package/dist/browser.js +2795 -1136
- package/dist/browser.mjs +2795 -1136
- package/dist/{chunk-BBE7SNRV.js → chunk-2XDW3UCG.js} +155 -23
- package/dist/{chunk-UPFNQCGB.mjs → chunk-BU6SM54N.mjs} +1830 -1045
- package/dist/{chunk-ZHUHZWFY.mjs → chunk-N3JKQ3D3.mjs} +152 -20
- package/dist/{chunk-OBBWQW6K.js → chunk-TWCDSYJN.js} +2890 -2105
- package/dist/cli.js +5976 -1348
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +2795 -1136
- package/dist/edge-light.mjs +2795 -1136
- package/dist/index.d.mts +893 -24
- package/dist/index.d.ts +893 -24
- package/dist/index.js +1448 -699
- package/dist/index.mjs +848 -99
- package/dist/instrumentation/index.d.mts +563 -9
- package/dist/instrumentation/index.d.ts +563 -9
- package/dist/instrumentation/index.js +2794 -989
- package/dist/instrumentation/index.mjs +2794 -989
- 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 +2795 -1136
- package/dist/workerd.mjs +2795 -1136
- package/package.json +1 -1
- package/util/dist/index.d.mts +42 -0
- package/util/dist/index.d.ts +42 -0
|
@@ -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,
|
|
@@ -39,9 +40,9 @@ import {
|
|
|
39
40
|
smithyCoreChannels,
|
|
40
41
|
strandsAgentSDKChannels,
|
|
41
42
|
voyageAIChannels
|
|
42
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-N3JKQ3D3.mjs";
|
|
43
44
|
|
|
44
|
-
// src/node/apply-auto-instrumentation
|
|
45
|
+
// src/node/apply-auto-instrumentation.ts
|
|
45
46
|
import { register } from "node:module";
|
|
46
47
|
import { pathToFileURL } from "node:url";
|
|
47
48
|
|
|
@@ -94,6 +95,33 @@ var aiSDKConfigs = [
|
|
|
94
95
|
kind: "Async"
|
|
95
96
|
}
|
|
96
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
|
+
),
|
|
97
125
|
// streamText - async function (v3 only, before the sync refactor in v4)
|
|
98
126
|
{
|
|
99
127
|
channelName: aiSDKChannels.streamText.channelName,
|
|
@@ -2661,7 +2689,7 @@ var openRouterAgentConfigs = [
|
|
|
2661
2689
|
];
|
|
2662
2690
|
|
|
2663
2691
|
// src/auto-instrumentations/configs/pi-coding-agent.ts
|
|
2664
|
-
var piCodingAgentVersionRange = ">=0.79.0 <0.
|
|
2692
|
+
var piCodingAgentVersionRange = ">=0.79.0 <1.0.0";
|
|
2665
2693
|
var piCodingAgentConfigs = [
|
|
2666
2694
|
{
|
|
2667
2695
|
channelName: piCodingAgentChannels.prompt.channelName,
|
|
@@ -2876,8 +2904,9 @@ function getDefaultInstrumentationConfigs({
|
|
|
2876
2904
|
...additionalInstrumentations ?? []
|
|
2877
2905
|
];
|
|
2878
2906
|
}
|
|
2879
|
-
function getDefaultAutoInstrumentationConfigs() {
|
|
2907
|
+
function getDefaultAutoInstrumentationConfigs(additionalInstrumentations) {
|
|
2880
2908
|
return getDefaultInstrumentationConfigs({
|
|
2909
|
+
additionalInstrumentations,
|
|
2881
2910
|
disabledIntegrationConfig: readDisabledInstrumentationEnvConfig(
|
|
2882
2911
|
process.env.BRAINTRUST_DISABLE_INSTRUMENTATION
|
|
2883
2912
|
).integrations
|
|
@@ -2905,11 +2934,11 @@ function formatChannelGetter(channelName) {
|
|
|
2905
2934
|
return `tr_ch_bt$get_${channelName.replace(CHANNEL_REGEX, "_")}`;
|
|
2906
2935
|
}
|
|
2907
2936
|
var transforms = {
|
|
2908
|
-
tracingHookDeclaration(
|
|
2937
|
+
tracingHookDeclaration(state, node) {
|
|
2909
2938
|
const {
|
|
2910
2939
|
channelName,
|
|
2911
2940
|
module: { name }
|
|
2912
|
-
} =
|
|
2941
|
+
} = state;
|
|
2913
2942
|
const channelVariable = formatChannelVariable(channelName);
|
|
2914
2943
|
const channelGetter = formatChannelGetter(channelName);
|
|
2915
2944
|
const hasSharedHookLookup = node.body.some(
|
|
@@ -2971,23 +3000,23 @@ var transforms = {
|
|
|
2971
3000
|
tracePromise: traceAny,
|
|
2972
3001
|
traceSync: traceAny
|
|
2973
3002
|
};
|
|
2974
|
-
function traceAny(
|
|
3003
|
+
function traceAny(state, node, _parent, ancestry) {
|
|
2975
3004
|
const program = ancestry[ancestry.length - 1];
|
|
2976
3005
|
if (node.type === "ClassDeclaration" || node.type === "ClassExpression") {
|
|
2977
|
-
traceInstanceMethod(
|
|
3006
|
+
traceInstanceMethod(state, node, program);
|
|
2978
3007
|
} else {
|
|
2979
|
-
traceFunction(
|
|
3008
|
+
traceFunction(state, node, program);
|
|
2980
3009
|
}
|
|
2981
3010
|
}
|
|
2982
|
-
function traceFunction(
|
|
2983
|
-
transforms.tracingHookDeclaration(
|
|
2984
|
-
const { functionQuery } =
|
|
3011
|
+
function traceFunction(state, node, program) {
|
|
3012
|
+
transforms.tracingHookDeclaration(state, program, null, []);
|
|
3013
|
+
const { functionQuery } = state;
|
|
2985
3014
|
const methodName = "methodName" in functionQuery ? functionQuery.methodName : void 0;
|
|
2986
3015
|
const privateMethodName = "privateMethodName" in functionQuery ? functionQuery.privateMethodName : void 0;
|
|
2987
3016
|
const functionName = "functionName" in functionQuery ? functionQuery.functionName : void 0;
|
|
2988
3017
|
const isConstructor = methodName === "constructor" || !methodName && !privateMethodName && !functionName;
|
|
2989
3018
|
const type = isConstructor ? "ArrowFunctionExpression" : "FunctionExpression";
|
|
2990
|
-
node.body = wrap(
|
|
3019
|
+
node.body = wrap(state, {
|
|
2991
3020
|
type,
|
|
2992
3021
|
params: node.params,
|
|
2993
3022
|
body: node.body,
|
|
@@ -2999,8 +3028,8 @@ function traceFunction(state2, node, program) {
|
|
|
2999
3028
|
node.async = false;
|
|
3000
3029
|
wrapSuper(node);
|
|
3001
3030
|
}
|
|
3002
|
-
function traceInstanceMethod(
|
|
3003
|
-
const { functionQuery, operator } =
|
|
3031
|
+
function traceInstanceMethod(state, node, program) {
|
|
3032
|
+
const { functionQuery, operator } = state;
|
|
3004
3033
|
const { methodName } = functionQuery;
|
|
3005
3034
|
if (!methodName) {
|
|
3006
3035
|
return;
|
|
@@ -3010,7 +3039,7 @@ function traceInstanceMethod(state2, node, program) {
|
|
|
3010
3039
|
return;
|
|
3011
3040
|
}
|
|
3012
3041
|
let ctor = classBody.body.find(({ kind }) => kind === "constructor");
|
|
3013
|
-
transforms.tracingHookDeclaration(
|
|
3042
|
+
transforms.tracingHookDeclaration(state, program, null, []);
|
|
3014
3043
|
if (!ctor) {
|
|
3015
3044
|
ctor = parse(
|
|
3016
3045
|
node.superClass ? "class A extends Object { constructor (...args) { super(...args) } }" : "class A { constructor () {} }"
|
|
@@ -3023,15 +3052,15 @@ function traceInstanceMethod(state2, node, program) {
|
|
|
3023
3052
|
`).body;
|
|
3024
3053
|
const fn = ctorBody[1].expression.right;
|
|
3025
3054
|
fn.async = operator === "tracePromise";
|
|
3026
|
-
fn.body = wrap(
|
|
3055
|
+
fn.body = wrap(state, {
|
|
3027
3056
|
type: "Identifier",
|
|
3028
3057
|
name: `__bt$${methodName}`
|
|
3029
3058
|
});
|
|
3030
3059
|
wrapSuper(fn);
|
|
3031
3060
|
ctor.value.body.body.push(...ctorBody);
|
|
3032
3061
|
}
|
|
3033
|
-
function wrap(
|
|
3034
|
-
const wrapper = wrapInvocation(
|
|
3062
|
+
function wrap(state, node) {
|
|
3063
|
+
const wrapper = wrapInvocation(state);
|
|
3035
3064
|
const block = wrapper.body[0].body;
|
|
3036
3065
|
const common = parse(
|
|
3037
3066
|
node.type === "ArrowFunctionExpression" ? `
|
|
@@ -3084,8 +3113,8 @@ function wrapSuper(node) {
|
|
|
3084
3113
|
node.body.body.unshift(parse("const __bt$super = {}").body[0]);
|
|
3085
3114
|
}
|
|
3086
3115
|
}
|
|
3087
|
-
function wrapInvocation(
|
|
3088
|
-
const { channelName, moduleVersion, operator, functionQuery } =
|
|
3116
|
+
function wrapInvocation(state) {
|
|
3117
|
+
const { channelName, moduleVersion, operator, functionQuery } = state;
|
|
3089
3118
|
const channelGetter = formatChannelGetter(channelName);
|
|
3090
3119
|
const callbackIndex = functionQuery.callbackIndex ?? -1;
|
|
3091
3120
|
return parse(`
|
|
@@ -3153,7 +3182,7 @@ var Transformer = class {
|
|
|
3153
3182
|
aliases
|
|
3154
3183
|
);
|
|
3155
3184
|
const query = astQuery || this.fromFunctionQuery(resolvedFunctionQuery);
|
|
3156
|
-
const
|
|
3185
|
+
const state = {
|
|
3157
3186
|
...config,
|
|
3158
3187
|
moduleVersion: this.version,
|
|
3159
3188
|
functionQuery: resolvedFunctionQuery,
|
|
@@ -3161,7 +3190,7 @@ var Transformer = class {
|
|
|
3161
3190
|
};
|
|
3162
3191
|
esquery2.traverse(ast, esquery2.parse(query), (...args) => {
|
|
3163
3192
|
injectionCount++;
|
|
3164
|
-
this.visit(
|
|
3193
|
+
this.visit(state, ...args);
|
|
3165
3194
|
});
|
|
3166
3195
|
}
|
|
3167
3196
|
if (injectionCount === 0 && this.configs.length > 0) {
|
|
@@ -3191,21 +3220,21 @@ var Transformer = class {
|
|
|
3191
3220
|
}
|
|
3192
3221
|
free() {
|
|
3193
3222
|
}
|
|
3194
|
-
visit(
|
|
3195
|
-
const transform = transforms[
|
|
3196
|
-
const { index = 0 } =
|
|
3223
|
+
visit(state, ...args) {
|
|
3224
|
+
const transform = transforms[state.operator];
|
|
3225
|
+
const { index = 0 } = state.functionQuery;
|
|
3197
3226
|
const [node] = args;
|
|
3198
3227
|
const type = node.init?.type || node.type;
|
|
3199
3228
|
if (type !== "ClassDeclaration" && type !== "ClassExpression") {
|
|
3200
3229
|
if (node.type === "VariableDeclarator") {
|
|
3201
3230
|
return;
|
|
3202
3231
|
}
|
|
3203
|
-
|
|
3204
|
-
if (index !== null && index !==
|
|
3232
|
+
state.functionIndex = state.functionIndex === void 0 ? 0 : state.functionIndex + 1;
|
|
3233
|
+
if (index !== null && index !== state.functionIndex) {
|
|
3205
3234
|
return;
|
|
3206
3235
|
}
|
|
3207
3236
|
}
|
|
3208
|
-
transform(
|
|
3237
|
+
transform(state, ...args);
|
|
3209
3238
|
}
|
|
3210
3239
|
getOperator(kind) {
|
|
3211
3240
|
switch (kind) {
|
|
@@ -3517,26 +3546,27 @@ function resolveModulePrototype() {
|
|
|
3517
3546
|
return NodeModule.prototype;
|
|
3518
3547
|
}
|
|
3519
3548
|
|
|
3520
|
-
// src/node/apply-auto-instrumentation
|
|
3549
|
+
// src/node/apply-auto-instrumentation.ts
|
|
3521
3550
|
var stateKey = /* @__PURE__ */ Symbol.for(
|
|
3522
3551
|
`braintrust.applyAutoInstrumentation.global-hooks.v${GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION}`
|
|
3523
3552
|
);
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
existingState
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
}
|
|
3538
|
-
|
|
3539
|
-
|
|
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
|
+
}
|
|
3540
3570
|
const allConfigs = getDefaultAutoInstrumentationConfigs();
|
|
3541
3571
|
const currentModuleUrl = getCurrentModuleUrl();
|
|
3542
3572
|
register("./auto-instrumentations/loader/esm-hook.mjs", {
|
|
@@ -3545,14 +3575,14 @@ if (!state.applied) {
|
|
|
3545
3575
|
});
|
|
3546
3576
|
state.applied = true;
|
|
3547
3577
|
try {
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
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
|
+
);
|
|
3551
3584
|
}
|
|
3552
3585
|
}
|
|
3553
|
-
function isApplyAutoInstrumentationState(value) {
|
|
3554
|
-
return typeof value === "object" && value !== null;
|
|
3555
|
-
}
|
|
3556
3586
|
function getCurrentModuleUrl() {
|
|
3557
3587
|
if (typeof __filename !== "undefined") {
|
|
3558
3588
|
return pathToFileURL(__filename).href;
|
|
@@ -3564,3 +3594,6 @@ function getCurrentModuleUrl() {
|
|
|
3564
3594
|
}
|
|
3565
3595
|
return pathToFileURL(process.argv[1] ?? process.cwd()).href;
|
|
3566
3596
|
}
|
|
3597
|
+
|
|
3598
|
+
// src/node/apply-auto-instrumentation-entry.ts
|
|
3599
|
+
applyAutoInstrumentation();
|
|
@@ -1244,8 +1244,6 @@ function isInstrumentationIntegrationDisabled(integrations, ...names) {
|
|
|
1244
1244
|
var DefaultAsyncLocalStorage = class {
|
|
1245
1245
|
constructor() {
|
|
1246
1246
|
}
|
|
1247
|
-
enterWith(_) {
|
|
1248
|
-
}
|
|
1249
1247
|
run(_, callback) {
|
|
1250
1248
|
return callback();
|
|
1251
1249
|
}
|
|
@@ -1353,6 +1351,7 @@ var INSTRUMENTATION_NAMES = {
|
|
|
1353
1351
|
CLOUDFLARE_THINK: "cloudflare-think",
|
|
1354
1352
|
COHERE: "cohere",
|
|
1355
1353
|
CURSOR_SDK: "cursor-sdk",
|
|
1354
|
+
DEEPSEEK_HARNESS: "deepseek-harness",
|
|
1356
1355
|
EVE: "eve",
|
|
1357
1356
|
FLUE: "flue",
|
|
1358
1357
|
GENKIT: "genkit",
|
|
@@ -1384,6 +1383,10 @@ var aiSDKChannels = defineChannels(
|
|
|
1384
1383
|
channelName: "generateText",
|
|
1385
1384
|
kind: "async"
|
|
1386
1385
|
}),
|
|
1386
|
+
generateImage: channel({
|
|
1387
|
+
channelName: "generateImage",
|
|
1388
|
+
kind: "async"
|
|
1389
|
+
}),
|
|
1387
1390
|
streamText: channel({
|
|
1388
1391
|
channelName: "streamText",
|
|
1389
1392
|
kind: "async"
|
|
@@ -1523,6 +1526,33 @@ var aiSDKConfigs = [
|
|
|
1523
1526
|
kind: "Async"
|
|
1524
1527
|
}
|
|
1525
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
|
+
),
|
|
1526
1556
|
// streamText - async function (v3 only, before the sync refactor in v4)
|
|
1527
1557
|
{
|
|
1528
1558
|
channelName: aiSDKChannels.streamText.channelName,
|
|
@@ -4250,6 +4280,18 @@ var openAIAgentsCoreConfigs = lifecycleMethods.flatMap(
|
|
|
4250
4280
|
var openAIChannels = defineChannels(
|
|
4251
4281
|
"openai",
|
|
4252
4282
|
{
|
|
4283
|
+
filesCreateTraced: channel({
|
|
4284
|
+
channelName: "files.create-traced",
|
|
4285
|
+
kind: "async"
|
|
4286
|
+
}),
|
|
4287
|
+
batchesRetrieveTraced: channel({
|
|
4288
|
+
channelName: "batches.retrieve-traced",
|
|
4289
|
+
kind: "async"
|
|
4290
|
+
}),
|
|
4291
|
+
batchesCompleteTrace: channel({
|
|
4292
|
+
channelName: "batches.complete-trace",
|
|
4293
|
+
kind: "async"
|
|
4294
|
+
}),
|
|
4253
4295
|
chatCompletionsCreate: channel({
|
|
4254
4296
|
channelName: "chat.completions.create",
|
|
4255
4297
|
kind: "async"
|
|
@@ -4683,7 +4725,7 @@ var piCodingAgentChannels = defineChannels(
|
|
|
4683
4725
|
);
|
|
4684
4726
|
|
|
4685
4727
|
// src/auto-instrumentations/configs/pi-coding-agent.ts
|
|
4686
|
-
var piCodingAgentVersionRange = ">=0.79.0 <0.
|
|
4728
|
+
var piCodingAgentVersionRange = ">=0.79.0 <1.0.0";
|
|
4687
4729
|
var piCodingAgentConfigs = [
|
|
4688
4730
|
{
|
|
4689
4731
|
channelName: piCodingAgentChannels.prompt.channelName,
|
|
@@ -4942,6 +4984,14 @@ function getDefaultInstrumentationConfigs({
|
|
|
4942
4984
|
...additionalInstrumentations ?? []
|
|
4943
4985
|
];
|
|
4944
4986
|
}
|
|
4987
|
+
function getDefaultAutoInstrumentationConfigs(additionalInstrumentations) {
|
|
4988
|
+
return getDefaultInstrumentationConfigs({
|
|
4989
|
+
additionalInstrumentations,
|
|
4990
|
+
disabledIntegrationConfig: readDisabledInstrumentationEnvConfig(
|
|
4991
|
+
process.env.BRAINTRUST_DISABLE_INSTRUMENTATION
|
|
4992
|
+
).integrations
|
|
4993
|
+
});
|
|
4994
|
+
}
|
|
4945
4995
|
|
|
4946
4996
|
// src/auto-instrumentations/loader/mastra-observability-patch.ts
|
|
4947
4997
|
var MASTRA_EXPORTER_FACTORY_GLOBAL = "__braintrustMastraExporterFactory";
|
|
@@ -5208,9 +5258,9 @@ function getModuleVersion(basedir) {
|
|
|
5208
5258
|
}
|
|
5209
5259
|
var unplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
|
|
5210
5260
|
const browser = options.browser ?? options.useDiagnosticChannelCompatShim ?? false;
|
|
5211
|
-
const allInstrumentations =
|
|
5212
|
-
|
|
5213
|
-
|
|
5261
|
+
const allInstrumentations = getDefaultAutoInstrumentationConfigs(
|
|
5262
|
+
options.instrumentations
|
|
5263
|
+
);
|
|
5214
5264
|
const instrumentationMatcher = create(allInstrumentations);
|
|
5215
5265
|
return {
|
|
5216
5266
|
name: "code-transformer",
|
|
@@ -1245,8 +1245,6 @@ function isInstrumentationIntegrationDisabled(integrations, ...names) {
|
|
|
1245
1245
|
var DefaultAsyncLocalStorage = class {
|
|
1246
1246
|
constructor() {
|
|
1247
1247
|
}
|
|
1248
|
-
enterWith(_) {
|
|
1249
|
-
}
|
|
1250
1248
|
run(_, callback) {
|
|
1251
1249
|
return callback();
|
|
1252
1250
|
}
|
|
@@ -1354,6 +1352,7 @@ var INSTRUMENTATION_NAMES = {
|
|
|
1354
1352
|
CLOUDFLARE_THINK: "cloudflare-think",
|
|
1355
1353
|
COHERE: "cohere",
|
|
1356
1354
|
CURSOR_SDK: "cursor-sdk",
|
|
1355
|
+
DEEPSEEK_HARNESS: "deepseek-harness",
|
|
1357
1356
|
EVE: "eve",
|
|
1358
1357
|
FLUE: "flue",
|
|
1359
1358
|
GENKIT: "genkit",
|
|
@@ -1385,6 +1384,10 @@ var aiSDKChannels = defineChannels(
|
|
|
1385
1384
|
channelName: "generateText",
|
|
1386
1385
|
kind: "async"
|
|
1387
1386
|
}),
|
|
1387
|
+
generateImage: channel({
|
|
1388
|
+
channelName: "generateImage",
|
|
1389
|
+
kind: "async"
|
|
1390
|
+
}),
|
|
1388
1391
|
streamText: channel({
|
|
1389
1392
|
channelName: "streamText",
|
|
1390
1393
|
kind: "async"
|
|
@@ -1524,6 +1527,33 @@ var aiSDKConfigs = [
|
|
|
1524
1527
|
kind: "Async"
|
|
1525
1528
|
}
|
|
1526
1529
|
},
|
|
1530
|
+
// generateImage - stable in v6+, experimental alias in v5
|
|
1531
|
+
...[
|
|
1532
|
+
{
|
|
1533
|
+
functionName: "generateImage",
|
|
1534
|
+
versionRange: ">=6.0.0 <8.0.0",
|
|
1535
|
+
isExportAlias: false
|
|
1536
|
+
},
|
|
1537
|
+
{
|
|
1538
|
+
functionName: "experimental_generateImage",
|
|
1539
|
+
versionRange: ">=5.0.0 <6.0.0",
|
|
1540
|
+
isExportAlias: true
|
|
1541
|
+
}
|
|
1542
|
+
].flatMap(
|
|
1543
|
+
({ functionName, versionRange: versionRange2, isExportAlias }) => ["dist/index.mjs", "dist/index.js"].map((filePath) => ({
|
|
1544
|
+
channelName: aiSDKChannels.generateImage.channelName,
|
|
1545
|
+
module: {
|
|
1546
|
+
name: "ai",
|
|
1547
|
+
versionRange: versionRange2,
|
|
1548
|
+
filePath
|
|
1549
|
+
},
|
|
1550
|
+
functionQuery: {
|
|
1551
|
+
functionName,
|
|
1552
|
+
kind: "Async",
|
|
1553
|
+
...isExportAlias ? { isExportAlias } : {}
|
|
1554
|
+
}
|
|
1555
|
+
}))
|
|
1556
|
+
),
|
|
1527
1557
|
// streamText - async function (v3 only, before the sync refactor in v4)
|
|
1528
1558
|
{
|
|
1529
1559
|
channelName: aiSDKChannels.streamText.channelName,
|
|
@@ -4251,6 +4281,18 @@ var openAIAgentsCoreConfigs = lifecycleMethods.flatMap(
|
|
|
4251
4281
|
var openAIChannels = defineChannels(
|
|
4252
4282
|
"openai",
|
|
4253
4283
|
{
|
|
4284
|
+
filesCreateTraced: channel({
|
|
4285
|
+
channelName: "files.create-traced",
|
|
4286
|
+
kind: "async"
|
|
4287
|
+
}),
|
|
4288
|
+
batchesRetrieveTraced: channel({
|
|
4289
|
+
channelName: "batches.retrieve-traced",
|
|
4290
|
+
kind: "async"
|
|
4291
|
+
}),
|
|
4292
|
+
batchesCompleteTrace: channel({
|
|
4293
|
+
channelName: "batches.complete-trace",
|
|
4294
|
+
kind: "async"
|
|
4295
|
+
}),
|
|
4254
4296
|
chatCompletionsCreate: channel({
|
|
4255
4297
|
channelName: "chat.completions.create",
|
|
4256
4298
|
kind: "async"
|
|
@@ -4684,7 +4726,7 @@ var piCodingAgentChannels = defineChannels(
|
|
|
4684
4726
|
);
|
|
4685
4727
|
|
|
4686
4728
|
// src/auto-instrumentations/configs/pi-coding-agent.ts
|
|
4687
|
-
var piCodingAgentVersionRange = ">=0.79.0 <0.
|
|
4729
|
+
var piCodingAgentVersionRange = ">=0.79.0 <1.0.0";
|
|
4688
4730
|
var piCodingAgentConfigs = [
|
|
4689
4731
|
{
|
|
4690
4732
|
channelName: piCodingAgentChannels.prompt.channelName,
|
|
@@ -4943,6 +4985,14 @@ function getDefaultInstrumentationConfigs({
|
|
|
4943
4985
|
...additionalInstrumentations ?? []
|
|
4944
4986
|
];
|
|
4945
4987
|
}
|
|
4988
|
+
function getDefaultAutoInstrumentationConfigs(additionalInstrumentations) {
|
|
4989
|
+
return getDefaultInstrumentationConfigs({
|
|
4990
|
+
additionalInstrumentations,
|
|
4991
|
+
disabledIntegrationConfig: readDisabledInstrumentationEnvConfig(
|
|
4992
|
+
process.env.BRAINTRUST_DISABLE_INSTRUMENTATION
|
|
4993
|
+
).integrations
|
|
4994
|
+
});
|
|
4995
|
+
}
|
|
4946
4996
|
|
|
4947
4997
|
// src/auto-instrumentations/loader/mastra-observability-patch.ts
|
|
4948
4998
|
var MASTRA_EXPORTER_FACTORY_GLOBAL = "__braintrustMastraExporterFactory";
|
|
@@ -5209,9 +5259,9 @@ function getModuleVersion(basedir) {
|
|
|
5209
5259
|
}
|
|
5210
5260
|
var unplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
|
|
5211
5261
|
const browser = options.browser ?? options.useDiagnosticChannelCompatShim ?? false;
|
|
5212
|
-
const allInstrumentations =
|
|
5213
|
-
|
|
5214
|
-
|
|
5262
|
+
const allInstrumentations = getDefaultAutoInstrumentationConfigs(
|
|
5263
|
+
options.instrumentations
|
|
5264
|
+
);
|
|
5215
5265
|
const instrumentationMatcher = create(allInstrumentations);
|
|
5216
5266
|
return {
|
|
5217
5267
|
name: "code-transformer",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
webpackPlugin
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-OXINGIEZ.mjs";
|
|
4
|
+
import "../chunk-LW4HDHXT.mjs";
|
|
5
|
+
import "../chunk-U64OYU4Q.mjs";
|
|
6
6
|
import "../chunk-I55G56ZL.mjs";
|
|
7
7
|
import "../chunk-JPUFNW7X.mjs";
|
|
8
8
|
import "../chunk-P5YLNB2A.mjs";
|
|
@@ -1244,8 +1244,6 @@ function isInstrumentationIntegrationDisabled(integrations, ...names) {
|
|
|
1244
1244
|
var DefaultAsyncLocalStorage = class {
|
|
1245
1245
|
constructor() {
|
|
1246
1246
|
}
|
|
1247
|
-
enterWith(_) {
|
|
1248
|
-
}
|
|
1249
1247
|
run(_, callback) {
|
|
1250
1248
|
return callback();
|
|
1251
1249
|
}
|
|
@@ -1353,6 +1351,7 @@ var INSTRUMENTATION_NAMES = {
|
|
|
1353
1351
|
CLOUDFLARE_THINK: "cloudflare-think",
|
|
1354
1352
|
COHERE: "cohere",
|
|
1355
1353
|
CURSOR_SDK: "cursor-sdk",
|
|
1354
|
+
DEEPSEEK_HARNESS: "deepseek-harness",
|
|
1356
1355
|
EVE: "eve",
|
|
1357
1356
|
FLUE: "flue",
|
|
1358
1357
|
GENKIT: "genkit",
|
|
@@ -1384,6 +1383,10 @@ var aiSDKChannels = defineChannels(
|
|
|
1384
1383
|
channelName: "generateText",
|
|
1385
1384
|
kind: "async"
|
|
1386
1385
|
}),
|
|
1386
|
+
generateImage: channel({
|
|
1387
|
+
channelName: "generateImage",
|
|
1388
|
+
kind: "async"
|
|
1389
|
+
}),
|
|
1387
1390
|
streamText: channel({
|
|
1388
1391
|
channelName: "streamText",
|
|
1389
1392
|
kind: "async"
|
|
@@ -1523,6 +1526,33 @@ var aiSDKConfigs = [
|
|
|
1523
1526
|
kind: "Async"
|
|
1524
1527
|
}
|
|
1525
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
|
+
),
|
|
1526
1556
|
// streamText - async function (v3 only, before the sync refactor in v4)
|
|
1527
1557
|
{
|
|
1528
1558
|
channelName: aiSDKChannels.streamText.channelName,
|
|
@@ -4250,6 +4280,18 @@ var openAIAgentsCoreConfigs = lifecycleMethods.flatMap(
|
|
|
4250
4280
|
var openAIChannels = defineChannels(
|
|
4251
4281
|
"openai",
|
|
4252
4282
|
{
|
|
4283
|
+
filesCreateTraced: channel({
|
|
4284
|
+
channelName: "files.create-traced",
|
|
4285
|
+
kind: "async"
|
|
4286
|
+
}),
|
|
4287
|
+
batchesRetrieveTraced: channel({
|
|
4288
|
+
channelName: "batches.retrieve-traced",
|
|
4289
|
+
kind: "async"
|
|
4290
|
+
}),
|
|
4291
|
+
batchesCompleteTrace: channel({
|
|
4292
|
+
channelName: "batches.complete-trace",
|
|
4293
|
+
kind: "async"
|
|
4294
|
+
}),
|
|
4253
4295
|
chatCompletionsCreate: channel({
|
|
4254
4296
|
channelName: "chat.completions.create",
|
|
4255
4297
|
kind: "async"
|
|
@@ -4683,7 +4725,7 @@ var piCodingAgentChannels = defineChannels(
|
|
|
4683
4725
|
);
|
|
4684
4726
|
|
|
4685
4727
|
// src/auto-instrumentations/configs/pi-coding-agent.ts
|
|
4686
|
-
var piCodingAgentVersionRange = ">=0.79.0 <0.
|
|
4728
|
+
var piCodingAgentVersionRange = ">=0.79.0 <1.0.0";
|
|
4687
4729
|
var piCodingAgentConfigs = [
|
|
4688
4730
|
{
|
|
4689
4731
|
channelName: piCodingAgentChannels.prompt.channelName,
|
|
@@ -4942,6 +4984,14 @@ function getDefaultInstrumentationConfigs({
|
|
|
4942
4984
|
...additionalInstrumentations ?? []
|
|
4943
4985
|
];
|
|
4944
4986
|
}
|
|
4987
|
+
function getDefaultAutoInstrumentationConfigs(additionalInstrumentations) {
|
|
4988
|
+
return getDefaultInstrumentationConfigs({
|
|
4989
|
+
additionalInstrumentations,
|
|
4990
|
+
disabledIntegrationConfig: readDisabledInstrumentationEnvConfig(
|
|
4991
|
+
process.env.BRAINTRUST_DISABLE_INSTRUMENTATION
|
|
4992
|
+
).integrations
|
|
4993
|
+
});
|
|
4994
|
+
}
|
|
4945
4995
|
|
|
4946
4996
|
// src/auto-instrumentations/loader/mastra-observability-patch.ts
|
|
4947
4997
|
var MASTRA_EXPORTER_FACTORY_GLOBAL = "__braintrustMastraExporterFactory";
|
|
@@ -5208,9 +5258,9 @@ function getModuleVersion(basedir) {
|
|
|
5208
5258
|
}
|
|
5209
5259
|
var unplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
|
|
5210
5260
|
const browser = options.browser ?? options.useDiagnosticChannelCompatShim ?? false;
|
|
5211
|
-
const allInstrumentations =
|
|
5212
|
-
|
|
5213
|
-
|
|
5261
|
+
const allInstrumentations = getDefaultAutoInstrumentationConfigs(
|
|
5262
|
+
options.instrumentations
|
|
5263
|
+
);
|
|
5214
5264
|
const instrumentationMatcher = create(allInstrumentations);
|
|
5215
5265
|
return {
|
|
5216
5266
|
name: "code-transformer",
|