braintrust 3.9.0 → 3.11.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/dev/dist/index.d.mts +157 -3
- package/dev/dist/index.d.ts +157 -3
- package/dev/dist/index.js +10819 -7204
- package/dev/dist/index.mjs +7458 -3843
- package/dist/auto-instrumentations/bundler/esbuild.cjs +686 -1
- package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
- package/dist/auto-instrumentations/bundler/rollup.cjs +686 -1
- package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
- package/dist/auto-instrumentations/bundler/vite.cjs +686 -1
- package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +634 -0
- package/dist/auto-instrumentations/bundler/webpack.cjs +686 -1
- package/dist/auto-instrumentations/bundler/webpack.mjs +2 -2
- package/dist/auto-instrumentations/{chunk-KIMMUFAK.mjs → chunk-DIV5TO4S.mjs} +679 -1
- package/dist/auto-instrumentations/{chunk-G7F6HZGE.mjs → chunk-G6ZWXGZB.mjs} +19 -2
- package/dist/auto-instrumentations/{chunk-ITP7RAUY.mjs → chunk-MWZXZQUO.mjs} +23 -1
- package/dist/auto-instrumentations/hook.mjs +793 -11
- package/dist/auto-instrumentations/index.cjs +774 -7
- package/dist/auto-instrumentations/index.d.mts +18 -1
- package/dist/auto-instrumentations/index.d.ts +18 -1
- package/dist/auto-instrumentations/index.mjs +102 -8
- package/dist/auto-instrumentations/loader/cjs-patch.cjs +26 -1
- package/dist/auto-instrumentations/loader/cjs-patch.mjs +28 -1
- package/dist/auto-instrumentations/loader/esm-hook.mjs +16 -1
- package/dist/browser.d.mts +600 -265
- package/dist/browser.d.ts +600 -265
- package/dist/browser.js +6171 -1851
- package/dist/browser.mjs +6171 -1851
- package/dist/cli.js +6417 -2794
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +6171 -1851
- package/dist/edge-light.mjs +6171 -1851
- package/dist/index.d.mts +613 -278
- package/dist/index.d.ts +613 -278
- package/dist/index.js +6507 -2187
- package/dist/index.mjs +6171 -1851
- package/dist/instrumentation/index.d.mts +19 -0
- package/dist/instrumentation/index.d.ts +19 -0
- package/dist/instrumentation/index.js +10265 -6841
- package/dist/instrumentation/index.mjs +10265 -6841
- package/dist/workerd.d.mts +1 -1
- package/dist/workerd.d.ts +1 -1
- package/dist/workerd.js +6171 -1851
- package/dist/workerd.mjs +6171 -1851
- package/package.json +16 -22
|
@@ -3,13 +3,18 @@ import {
|
|
|
3
3
|
anthropicConfigs,
|
|
4
4
|
claudeAgentSDKConfigs,
|
|
5
5
|
cohereConfigs,
|
|
6
|
+
cursorSDKConfigs,
|
|
7
|
+
genkitConfigs,
|
|
8
|
+
gitHubCopilotConfigs,
|
|
6
9
|
googleGenAIConfigs,
|
|
10
|
+
groqConfigs,
|
|
7
11
|
huggingFaceConfigs,
|
|
8
12
|
mistralConfigs,
|
|
13
|
+
openAICodexConfigs,
|
|
9
14
|
openRouterAgentConfigs,
|
|
10
15
|
openRouterConfigs,
|
|
11
16
|
openaiConfigs
|
|
12
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-DIV5TO4S.mjs";
|
|
13
18
|
|
|
14
19
|
// src/auto-instrumentations/bundler/plugin.ts
|
|
15
20
|
import { createUnplugin } from "unplugin";
|
|
@@ -34,15 +39,20 @@ function getModuleVersion(basedir) {
|
|
|
34
39
|
var unplugin = createUnplugin((options = {}) => {
|
|
35
40
|
const allInstrumentations = [
|
|
36
41
|
...openaiConfigs,
|
|
42
|
+
...openAICodexConfigs,
|
|
37
43
|
...anthropicConfigs,
|
|
38
44
|
...aiSDKConfigs,
|
|
39
45
|
...claudeAgentSDKConfigs,
|
|
46
|
+
...cursorSDKConfigs,
|
|
40
47
|
...googleGenAIConfigs,
|
|
41
48
|
...huggingFaceConfigs,
|
|
42
49
|
...openRouterConfigs,
|
|
43
50
|
...openRouterAgentConfigs,
|
|
44
51
|
...mistralConfigs,
|
|
45
52
|
...cohereConfigs,
|
|
53
|
+
...groqConfigs,
|
|
54
|
+
...genkitConfigs,
|
|
55
|
+
...gitHubCopilotConfigs,
|
|
46
56
|
...options.instrumentations || []
|
|
47
57
|
];
|
|
48
58
|
const dcModule = options.browser === false ? void 0 : "dc-browser";
|
|
@@ -51,6 +61,9 @@ var unplugin = createUnplugin((options = {}) => {
|
|
|
51
61
|
name: "code-transformer",
|
|
52
62
|
enforce: "pre",
|
|
53
63
|
transform(code, id) {
|
|
64
|
+
if (!id) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
54
67
|
const filePath = id.startsWith("file:") ? fileURLToPath(id) : id;
|
|
55
68
|
const ext = extname(filePath);
|
|
56
69
|
let isModule = ext === ".mjs" || ext === ".ts" || ext === ".tsx";
|
|
@@ -82,8 +95,12 @@ var unplugin = createUnplugin((options = {}) => {
|
|
|
82
95
|
try {
|
|
83
96
|
const moduleType = isModule ? "esm" : "cjs";
|
|
84
97
|
const result = transformer.transform(code, moduleType);
|
|
98
|
+
const transformedCode = result.code.replace(
|
|
99
|
+
/const \{tracingChannel: ([A-Za-z_$][\w$]*)\} = ([A-Za-z_$][\w$]*);/g,
|
|
100
|
+
"const $1 = $2.tracingChannel;"
|
|
101
|
+
);
|
|
85
102
|
return {
|
|
86
|
-
code:
|
|
103
|
+
code: transformedCode,
|
|
87
104
|
map: result.map
|
|
88
105
|
};
|
|
89
106
|
} catch (error) {
|
|
@@ -53,7 +53,29 @@ function getPackageName(baseDir) {
|
|
|
53
53
|
return void 0;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
// src/auto-instrumentations/loader/openai-api-promise-patch.ts
|
|
57
|
+
var OPENAI_API_PROMISE_PATCH = `
|
|
58
|
+
;(function __btPatchAPIPromise() {
|
|
59
|
+
if (typeof APIPromise === "undefined" || APIPromise.prototype.__btParsePatched) return;
|
|
60
|
+
APIPromise.prototype.__btParsePatched = true;
|
|
61
|
+
var _origThen = APIPromise.prototype.then;
|
|
62
|
+
APIPromise.prototype.then = function __btThen(onfulfilled, onrejected) {
|
|
63
|
+
if (!this.__btParseWrapped && Object.prototype.hasOwnProperty.call(this, "parseResponse")) {
|
|
64
|
+
this.__btParseWrapped = true;
|
|
65
|
+
var _origParse = this.parseResponse;
|
|
66
|
+
var _cached;
|
|
67
|
+
this.parseResponse = function() {
|
|
68
|
+
if (!_cached) _cached = _origParse.apply(this, arguments);
|
|
69
|
+
return _cached;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
return _origThen.call(this, onfulfilled, onrejected);
|
|
73
|
+
};
|
|
74
|
+
})();
|
|
75
|
+
`;
|
|
76
|
+
|
|
56
77
|
export {
|
|
57
78
|
getPackageVersion,
|
|
58
|
-
getPackageName
|
|
79
|
+
getPackageName,
|
|
80
|
+
OPENAI_API_PROMISE_PATCH
|
|
59
81
|
};
|