braintrust 3.8.0 → 3.10.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 (48) hide show
  1. package/dev/dist/index.d.mts +191 -4
  2. package/dev/dist/index.d.ts +191 -4
  3. package/dev/dist/index.js +7269 -2590
  4. package/dev/dist/index.mjs +7281 -2602
  5. package/dist/auto-instrumentations/bundler/esbuild.cjs +741 -2
  6. package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
  7. package/dist/auto-instrumentations/bundler/rollup.cjs +741 -2
  8. package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
  9. package/dist/auto-instrumentations/bundler/vite.cjs +741 -2
  10. package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
  11. package/dist/auto-instrumentations/bundler/webpack-loader.cjs +738 -2
  12. package/dist/auto-instrumentations/bundler/webpack.cjs +741 -2
  13. package/dist/auto-instrumentations/bundler/webpack.mjs +2 -2
  14. package/dist/auto-instrumentations/{chunk-OLBMPZXE.mjs → chunk-GZNXBBPU.mjs} +741 -3
  15. package/dist/auto-instrumentations/{chunk-MD7W27YH.mjs → chunk-XWEQQOQH.mjs} +12 -1
  16. package/dist/auto-instrumentations/hook.mjs +1193 -199
  17. package/dist/auto-instrumentations/index.cjs +1173 -187
  18. package/dist/auto-instrumentations/index.d.mts +22 -1
  19. package/dist/auto-instrumentations/index.d.ts +22 -1
  20. package/dist/auto-instrumentations/index.mjs +256 -1
  21. package/dist/auto-instrumentations/loader/esm-hook.mjs +2 -1
  22. package/dist/browser.d.mts +451 -11
  23. package/dist/browser.d.ts +451 -11
  24. package/dist/browser.js +7659 -2321
  25. package/dist/browser.mjs +7659 -2321
  26. package/dist/cli.js +7143 -2435
  27. package/dist/edge-light.d.mts +1 -1
  28. package/dist/edge-light.d.ts +1 -1
  29. package/dist/edge-light.js +7659 -2321
  30. package/dist/edge-light.mjs +7659 -2321
  31. package/dist/index.d.mts +451 -11
  32. package/dist/index.d.ts +451 -11
  33. package/dist/index.js +8054 -2716
  34. package/dist/index.mjs +7659 -2321
  35. package/dist/instrumentation/index.d.mts +17 -0
  36. package/dist/instrumentation/index.d.ts +17 -0
  37. package/dist/instrumentation/index.js +6420 -2051
  38. package/dist/instrumentation/index.mjs +6420 -2051
  39. package/dist/workerd.d.mts +1 -1
  40. package/dist/workerd.d.ts +1 -1
  41. package/dist/workerd.js +7659 -2321
  42. package/dist/workerd.mjs +7659 -2321
  43. package/package.json +56 -51
  44. package/util/dist/index.d.mts +42 -1
  45. package/util/dist/index.d.ts +42 -1
  46. package/util/dist/index.js +5 -1
  47. package/util/dist/index.mjs +4 -0
  48. package/LICENSE +0 -201
@@ -53,6 +53,8 @@ declare const aiSDKConfigs: InstrumentationConfig[];
53
53
  */
54
54
  declare const claudeAgentSDKConfigs: InstrumentationConfig[];
55
55
 
56
+ declare const cursorSDKConfigs: InstrumentationConfig[];
57
+
56
58
  /**
57
59
  * Instrumentation configurations for the Google GenAI SDK.
58
60
  *
@@ -66,10 +68,29 @@ declare const claudeAgentSDKConfigs: InstrumentationConfig[];
66
68
  */
67
69
  declare const googleGenAIConfigs: InstrumentationConfig[];
68
70
 
71
+ declare const huggingFaceConfigs: InstrumentationConfig[];
72
+
69
73
  declare const openRouterAgentConfigs: InstrumentationConfig[];
70
74
 
71
75
  declare const openRouterConfigs: InstrumentationConfig[];
72
76
 
73
77
  declare const mistralConfigs: InstrumentationConfig[];
74
78
 
75
- export { aiSDKConfigs, anthropicConfigs, claudeAgentSDKConfigs, googleGenAIConfigs, mistralConfigs, openRouterAgentConfigs, openRouterConfigs, openaiConfigs };
79
+ /**
80
+ * Instrumentation configurations for the Google ADK (@google/adk).
81
+ *
82
+ * Runner.runAsync and BaseAgent.runAsync are async generators (`async *`).
83
+ * They synchronously return an AsyncGenerator object, so we use kind "Sync"
84
+ * paired with "sync-stream" channels — the same pattern used by the
85
+ * Claude Agent SDK's `query` function.
86
+ *
87
+ * FunctionTool.runAsync is a regular async method (returns Promise<unknown>)
88
+ * and uses kind "Async".
89
+ */
90
+ declare const googleADKConfigs: InstrumentationConfig[];
91
+
92
+ declare const cohereConfigs: InstrumentationConfig[];
93
+
94
+ declare const groqConfigs: InstrumentationConfig[];
95
+
96
+ export { aiSDKConfigs, anthropicConfigs, claudeAgentSDKConfigs, cohereConfigs, cursorSDKConfigs, googleADKConfigs, googleGenAIConfigs, groqConfigs, huggingFaceConfigs, mistralConfigs, openRouterAgentConfigs, openRouterConfigs, openaiConfigs };
@@ -53,6 +53,8 @@ declare const aiSDKConfigs: InstrumentationConfig[];
53
53
  */
54
54
  declare const claudeAgentSDKConfigs: InstrumentationConfig[];
55
55
 
56
+ declare const cursorSDKConfigs: InstrumentationConfig[];
57
+
56
58
  /**
57
59
  * Instrumentation configurations for the Google GenAI SDK.
58
60
  *
@@ -66,10 +68,29 @@ declare const claudeAgentSDKConfigs: InstrumentationConfig[];
66
68
  */
67
69
  declare const googleGenAIConfigs: InstrumentationConfig[];
68
70
 
71
+ declare const huggingFaceConfigs: InstrumentationConfig[];
72
+
69
73
  declare const openRouterAgentConfigs: InstrumentationConfig[];
70
74
 
71
75
  declare const openRouterConfigs: InstrumentationConfig[];
72
76
 
73
77
  declare const mistralConfigs: InstrumentationConfig[];
74
78
 
75
- export { aiSDKConfigs, anthropicConfigs, claudeAgentSDKConfigs, googleGenAIConfigs, mistralConfigs, openRouterAgentConfigs, openRouterConfigs, openaiConfigs };
79
+ /**
80
+ * Instrumentation configurations for the Google ADK (@google/adk).
81
+ *
82
+ * Runner.runAsync and BaseAgent.runAsync are async generators (`async *`).
83
+ * They synchronously return an AsyncGenerator object, so we use kind "Sync"
84
+ * paired with "sync-stream" channels — the same pattern used by the
85
+ * Claude Agent SDK's `query` function.
86
+ *
87
+ * FunctionTool.runAsync is a regular async method (returns Promise<unknown>)
88
+ * and uses kind "Async".
89
+ */
90
+ declare const googleADKConfigs: InstrumentationConfig[];
91
+
92
+ declare const cohereConfigs: InstrumentationConfig[];
93
+
94
+ declare const groqConfigs: InstrumentationConfig[];
95
+
96
+ export { aiSDKConfigs, anthropicConfigs, claudeAgentSDKConfigs, cohereConfigs, cursorSDKConfigs, googleADKConfigs, googleGenAIConfigs, groqConfigs, huggingFaceConfigs, mistralConfigs, openRouterAgentConfigs, openRouterConfigs, openaiConfigs };
@@ -1,18 +1,273 @@
1
1
  import {
2
2
  aiSDKConfigs,
3
3
  anthropicConfigs,
4
+ channel,
4
5
  claudeAgentSDKConfigs,
6
+ cohereConfigs,
7
+ cursorSDKConfigs,
8
+ defineChannels,
5
9
  googleGenAIConfigs,
10
+ groqConfigs,
11
+ huggingFaceConfigs,
6
12
  mistralConfigs,
7
13
  openRouterAgentConfigs,
8
14
  openRouterConfigs,
9
15
  openaiConfigs
10
- } from "./chunk-OLBMPZXE.mjs";
16
+ } from "./chunk-GZNXBBPU.mjs";
17
+
18
+ // src/instrumentation/plugins/google-adk-channels.ts
19
+ var googleADKChannels = defineChannels("@google/adk", {
20
+ runnerRunAsync: channel({
21
+ channelName: "runner.runAsync",
22
+ kind: "sync-stream"
23
+ }),
24
+ agentRunAsync: channel({
25
+ channelName: "agent.runAsync",
26
+ kind: "sync-stream"
27
+ }),
28
+ toolRunAsync: channel({
29
+ channelName: "tool.runAsync",
30
+ kind: "async"
31
+ })
32
+ });
33
+
34
+ // src/auto-instrumentations/configs/google-adk.ts
35
+ var googleADKVersionRange = ">=0.1.0";
36
+ var googleADKBundledIndexV06VersionRange = ">=0.6.1 <0.7.0";
37
+ var googleADKBundledIndexV1VersionRange = ">=1.0.0 <2.0.0";
38
+ var googleADKConfigs = [
39
+ // --- Runner.runAsync --- async generator, kind "Sync" + sync-stream channel
40
+ // Runner.runAsync — ESM individual module file
41
+ {
42
+ channelName: googleADKChannels.runnerRunAsync.channelName,
43
+ module: {
44
+ name: "@google/adk",
45
+ versionRange: googleADKVersionRange,
46
+ filePath: "dist/esm/runner/runner.js"
47
+ },
48
+ functionQuery: {
49
+ className: "Runner",
50
+ methodName: "runAsync",
51
+ kind: "Sync"
52
+ }
53
+ },
54
+ // Runner.runAsync — bundled CJS/ESM indexes
55
+ // The bundled entrypoints minify class names, so target the 12th sync
56
+ // `runAsync` method in file order rather than a class name. This mapping is
57
+ // only validated against the current 0.6.x bundle layout, so keep the range
58
+ // tight until we verify newer bundled outputs.
59
+ {
60
+ channelName: googleADKChannels.runnerRunAsync.channelName,
61
+ module: {
62
+ name: "@google/adk",
63
+ versionRange: googleADKBundledIndexV06VersionRange,
64
+ filePath: "dist/cjs/index.js"
65
+ },
66
+ functionQuery: {
67
+ methodName: "runAsync",
68
+ kind: "Sync",
69
+ index: 11
70
+ }
71
+ },
72
+ {
73
+ channelName: googleADKChannels.runnerRunAsync.channelName,
74
+ module: {
75
+ name: "@google/adk",
76
+ versionRange: googleADKBundledIndexV06VersionRange,
77
+ filePath: "dist/esm/index.js"
78
+ },
79
+ functionQuery: {
80
+ methodName: "runAsync",
81
+ kind: "Sync",
82
+ index: 11
83
+ }
84
+ },
85
+ // The 1.x bundled entrypoints still inline the runtime into index.js, but
86
+ // the minified method order changed. These indices are verified against 1.0.0.
87
+ {
88
+ channelName: googleADKChannels.runnerRunAsync.channelName,
89
+ module: {
90
+ name: "@google/adk",
91
+ versionRange: googleADKBundledIndexV1VersionRange,
92
+ filePath: "dist/cjs/index.js"
93
+ },
94
+ functionQuery: {
95
+ methodName: "runAsync",
96
+ kind: "Sync",
97
+ index: 12
98
+ }
99
+ },
100
+ {
101
+ channelName: googleADKChannels.runnerRunAsync.channelName,
102
+ module: {
103
+ name: "@google/adk",
104
+ versionRange: googleADKBundledIndexV1VersionRange,
105
+ filePath: "dist/esm/index.js"
106
+ },
107
+ functionQuery: {
108
+ methodName: "runAsync",
109
+ kind: "Sync",
110
+ index: 12
111
+ }
112
+ },
113
+ // --- BaseAgent.runAsync --- async generator, kind "Sync" + sync-stream channel
114
+ // BaseAgent.runAsync — ESM individual module file
115
+ {
116
+ channelName: googleADKChannels.agentRunAsync.channelName,
117
+ module: {
118
+ name: "@google/adk",
119
+ versionRange: googleADKVersionRange,
120
+ filePath: "dist/esm/agents/base_agent.js"
121
+ },
122
+ functionQuery: {
123
+ className: "BaseAgent",
124
+ methodName: "runAsync",
125
+ kind: "Sync"
126
+ }
127
+ },
128
+ // BaseAgent.runAsync — bundled CJS/ESM indexes
129
+ // The bundled entrypoints minify class names, so target the first sync
130
+ // `runAsync` method in file order rather than a class name. This mapping is
131
+ // only validated against the current 0.6.x bundle layout, so keep the range
132
+ // tight until we verify newer bundled outputs.
133
+ {
134
+ channelName: googleADKChannels.agentRunAsync.channelName,
135
+ module: {
136
+ name: "@google/adk",
137
+ versionRange: googleADKBundledIndexV06VersionRange,
138
+ filePath: "dist/cjs/index.js"
139
+ },
140
+ functionQuery: {
141
+ methodName: "runAsync",
142
+ kind: "Sync",
143
+ index: 0
144
+ }
145
+ },
146
+ {
147
+ channelName: googleADKChannels.agentRunAsync.channelName,
148
+ module: {
149
+ name: "@google/adk",
150
+ versionRange: googleADKBundledIndexV06VersionRange,
151
+ filePath: "dist/esm/index.js"
152
+ },
153
+ functionQuery: {
154
+ methodName: "runAsync",
155
+ kind: "Sync",
156
+ index: 0
157
+ }
158
+ },
159
+ // The 1.x bundled entrypoints keep BaseAgent.runAsync as the first bundled
160
+ // async-generator runAsync method in file order.
161
+ {
162
+ channelName: googleADKChannels.agentRunAsync.channelName,
163
+ module: {
164
+ name: "@google/adk",
165
+ versionRange: googleADKBundledIndexV1VersionRange,
166
+ filePath: "dist/cjs/index.js"
167
+ },
168
+ functionQuery: {
169
+ methodName: "runAsync",
170
+ kind: "Sync",
171
+ index: 0
172
+ }
173
+ },
174
+ {
175
+ channelName: googleADKChannels.agentRunAsync.channelName,
176
+ module: {
177
+ name: "@google/adk",
178
+ versionRange: googleADKBundledIndexV1VersionRange,
179
+ filePath: "dist/esm/index.js"
180
+ },
181
+ functionQuery: {
182
+ methodName: "runAsync",
183
+ kind: "Sync",
184
+ index: 0
185
+ }
186
+ },
187
+ // --- FunctionTool.runAsync --- regular async, kind "Async"
188
+ // FunctionTool.runAsync — ESM individual module file
189
+ {
190
+ channelName: googleADKChannels.toolRunAsync.channelName,
191
+ module: {
192
+ name: "@google/adk",
193
+ versionRange: googleADKVersionRange,
194
+ filePath: "dist/esm/tools/function_tool.js"
195
+ },
196
+ functionQuery: {
197
+ className: "FunctionTool",
198
+ methodName: "runAsync",
199
+ kind: "Async"
200
+ }
201
+ },
202
+ // FunctionTool.runAsync — bundled CJS/ESM indexes
203
+ // The bundled entrypoints minify class names, so target the first async
204
+ // `runAsync` method in file order rather than a class name. This mapping is
205
+ // only validated against the current 0.6.x bundle layout, so keep the range
206
+ // tight until we verify newer bundled outputs.
207
+ {
208
+ channelName: googleADKChannels.toolRunAsync.channelName,
209
+ module: {
210
+ name: "@google/adk",
211
+ versionRange: googleADKBundledIndexV06VersionRange,
212
+ filePath: "dist/cjs/index.js"
213
+ },
214
+ functionQuery: {
215
+ methodName: "runAsync",
216
+ kind: "Async",
217
+ index: 1
218
+ }
219
+ },
220
+ {
221
+ channelName: googleADKChannels.toolRunAsync.channelName,
222
+ module: {
223
+ name: "@google/adk",
224
+ versionRange: googleADKBundledIndexV06VersionRange,
225
+ filePath: "dist/esm/index.js"
226
+ },
227
+ functionQuery: {
228
+ methodName: "runAsync",
229
+ kind: "Async",
230
+ index: 1
231
+ }
232
+ },
233
+ // The 1.x bundle moves FunctionTool.runAsync behind one helper method.
234
+ {
235
+ channelName: googleADKChannels.toolRunAsync.channelName,
236
+ module: {
237
+ name: "@google/adk",
238
+ versionRange: googleADKBundledIndexV1VersionRange,
239
+ filePath: "dist/cjs/index.js"
240
+ },
241
+ functionQuery: {
242
+ methodName: "runAsync",
243
+ kind: "Async",
244
+ index: 1
245
+ }
246
+ },
247
+ {
248
+ channelName: googleADKChannels.toolRunAsync.channelName,
249
+ module: {
250
+ name: "@google/adk",
251
+ versionRange: googleADKBundledIndexV1VersionRange,
252
+ filePath: "dist/esm/index.js"
253
+ },
254
+ functionQuery: {
255
+ methodName: "runAsync",
256
+ kind: "Async",
257
+ index: 1
258
+ }
259
+ }
260
+ ];
11
261
  export {
12
262
  aiSDKConfigs,
13
263
  anthropicConfigs,
14
264
  claudeAgentSDKConfigs,
265
+ cohereConfigs,
266
+ cursorSDKConfigs,
267
+ googleADKConfigs,
15
268
  googleGenAIConfigs,
269
+ groqConfigs,
270
+ huggingFaceConfigs,
16
271
  mistralConfigs,
17
272
  openRouterAgentConfigs,
18
273
  openRouterConfigs,
@@ -55,9 +55,10 @@ async function load(url, context, nextLoad) {
55
55
  if (code) {
56
56
  const transformer = transformers.get(url);
57
57
  try {
58
+ const moduleType = result.format === "module" ? "esm" : result.format === "commonjs" ? "cjs" : "unknown";
58
59
  const transformedCode = transformer.transform(
59
60
  code.toString("utf8"),
60
- "unknown"
61
+ moduleType
61
62
  );
62
63
  result.source = transformedCode?.code;
63
64
  result.shortCircuit = true;