braintrust 3.8.0 → 3.9.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 +84 -3
  2. package/dev/dist/index.d.ts +84 -3
  3. package/dev/dist/index.js +3687 -691
  4. package/dev/dist/index.mjs +3399 -403
  5. package/dist/auto-instrumentations/bundler/esbuild.cjs +575 -2
  6. package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
  7. package/dist/auto-instrumentations/bundler/rollup.cjs +575 -2
  8. package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
  9. package/dist/auto-instrumentations/bundler/vite.cjs +575 -2
  10. package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
  11. package/dist/auto-instrumentations/bundler/webpack-loader.cjs +575 -2
  12. package/dist/auto-instrumentations/bundler/webpack.cjs +575 -2
  13. package/dist/auto-instrumentations/bundler/webpack.mjs +2 -2
  14. package/dist/auto-instrumentations/{chunk-MD7W27YH.mjs → chunk-G7F6HZGE.mjs} +5 -1
  15. package/dist/auto-instrumentations/{chunk-OLBMPZXE.mjs → chunk-KIMMUFAK.mjs} +578 -3
  16. package/dist/auto-instrumentations/hook.mjs +757 -10
  17. package/dist/auto-instrumentations/index.cjs +739 -2
  18. package/dist/auto-instrumentations/index.d.mts +18 -1
  19. package/dist/auto-instrumentations/index.d.ts +18 -1
  20. package/dist/auto-instrumentations/index.mjs +168 -1
  21. package/dist/auto-instrumentations/loader/esm-hook.mjs +2 -1
  22. package/dist/browser.d.mts +312 -6
  23. package/dist/browser.d.ts +312 -6
  24. package/dist/browser.js +5335 -1892
  25. package/dist/browser.mjs +5335 -1892
  26. package/dist/cli.js +3514 -489
  27. package/dist/edge-light.d.mts +1 -1
  28. package/dist/edge-light.d.ts +1 -1
  29. package/dist/edge-light.js +5335 -1892
  30. package/dist/edge-light.mjs +5335 -1892
  31. package/dist/index.d.mts +312 -6
  32. package/dist/index.d.ts +312 -6
  33. package/dist/index.js +4244 -801
  34. package/dist/index.mjs +5335 -1892
  35. package/dist/instrumentation/index.d.mts +10 -0
  36. package/dist/instrumentation/index.d.ts +10 -0
  37. package/dist/instrumentation/index.js +3160 -286
  38. package/dist/instrumentation/index.mjs +3160 -286
  39. package/dist/workerd.d.mts +1 -1
  40. package/dist/workerd.d.ts +1 -1
  41. package/dist/workerd.js +5335 -1892
  42. package/dist/workerd.mjs +5335 -1892
  43. package/package.json +52 -47
  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
@@ -66,10 +66,27 @@ declare const claudeAgentSDKConfigs: InstrumentationConfig[];
66
66
  */
67
67
  declare const googleGenAIConfigs: InstrumentationConfig[];
68
68
 
69
+ declare const huggingFaceConfigs: InstrumentationConfig[];
70
+
69
71
  declare const openRouterAgentConfigs: InstrumentationConfig[];
70
72
 
71
73
  declare const openRouterConfigs: InstrumentationConfig[];
72
74
 
73
75
  declare const mistralConfigs: InstrumentationConfig[];
74
76
 
75
- export { aiSDKConfigs, anthropicConfigs, claudeAgentSDKConfigs, googleGenAIConfigs, mistralConfigs, openRouterAgentConfigs, openRouterConfigs, openaiConfigs };
77
+ /**
78
+ * Instrumentation configurations for the Google ADK (@google/adk).
79
+ *
80
+ * Runner.runAsync and BaseAgent.runAsync are async generators (`async *`).
81
+ * They synchronously return an AsyncGenerator object, so we use kind "Sync"
82
+ * paired with "sync-stream" channels — the same pattern used by the
83
+ * Claude Agent SDK's `query` function.
84
+ *
85
+ * FunctionTool.runAsync is a regular async method (returns Promise<unknown>)
86
+ * and uses kind "Async".
87
+ */
88
+ declare const googleADKConfigs: InstrumentationConfig[];
89
+
90
+ declare const cohereConfigs: InstrumentationConfig[];
91
+
92
+ export { aiSDKConfigs, anthropicConfigs, claudeAgentSDKConfigs, cohereConfigs, googleADKConfigs, googleGenAIConfigs, huggingFaceConfigs, mistralConfigs, openRouterAgentConfigs, openRouterConfigs, openaiConfigs };
@@ -66,10 +66,27 @@ declare const claudeAgentSDKConfigs: InstrumentationConfig[];
66
66
  */
67
67
  declare const googleGenAIConfigs: InstrumentationConfig[];
68
68
 
69
+ declare const huggingFaceConfigs: InstrumentationConfig[];
70
+
69
71
  declare const openRouterAgentConfigs: InstrumentationConfig[];
70
72
 
71
73
  declare const openRouterConfigs: InstrumentationConfig[];
72
74
 
73
75
  declare const mistralConfigs: InstrumentationConfig[];
74
76
 
75
- export { aiSDKConfigs, anthropicConfigs, claudeAgentSDKConfigs, googleGenAIConfigs, mistralConfigs, openRouterAgentConfigs, openRouterConfigs, openaiConfigs };
77
+ /**
78
+ * Instrumentation configurations for the Google ADK (@google/adk).
79
+ *
80
+ * Runner.runAsync and BaseAgent.runAsync are async generators (`async *`).
81
+ * They synchronously return an AsyncGenerator object, so we use kind "Sync"
82
+ * paired with "sync-stream" channels — the same pattern used by the
83
+ * Claude Agent SDK's `query` function.
84
+ *
85
+ * FunctionTool.runAsync is a regular async method (returns Promise<unknown>)
86
+ * and uses kind "Async".
87
+ */
88
+ declare const googleADKConfigs: InstrumentationConfig[];
89
+
90
+ declare const cohereConfigs: InstrumentationConfig[];
91
+
92
+ export { aiSDKConfigs, anthropicConfigs, claudeAgentSDKConfigs, cohereConfigs, googleADKConfigs, googleGenAIConfigs, huggingFaceConfigs, mistralConfigs, openRouterAgentConfigs, openRouterConfigs, openaiConfigs };
@@ -1,18 +1,185 @@
1
1
  import {
2
2
  aiSDKConfigs,
3
3
  anthropicConfigs,
4
+ channel,
4
5
  claudeAgentSDKConfigs,
6
+ cohereConfigs,
7
+ defineChannels,
5
8
  googleGenAIConfigs,
9
+ huggingFaceConfigs,
6
10
  mistralConfigs,
7
11
  openRouterAgentConfigs,
8
12
  openRouterConfigs,
9
13
  openaiConfigs
10
- } from "./chunk-OLBMPZXE.mjs";
14
+ } from "./chunk-KIMMUFAK.mjs";
15
+
16
+ // src/instrumentation/plugins/google-adk-channels.ts
17
+ var googleADKChannels = defineChannels("@google/adk", {
18
+ runnerRunAsync: channel({
19
+ channelName: "runner.runAsync",
20
+ kind: "sync-stream"
21
+ }),
22
+ agentRunAsync: channel({
23
+ channelName: "agent.runAsync",
24
+ kind: "sync-stream"
25
+ }),
26
+ toolRunAsync: channel({
27
+ channelName: "tool.runAsync",
28
+ kind: "async"
29
+ })
30
+ });
31
+
32
+ // src/auto-instrumentations/configs/google-adk.ts
33
+ var googleADKVersionRange = ">=0.1.0";
34
+ var googleADKBundledIndexVersionRange = ">=0.6.1 <0.7.0";
35
+ var googleADKConfigs = [
36
+ // --- Runner.runAsync --- async generator, kind "Sync" + sync-stream channel
37
+ // Runner.runAsync — ESM individual module file
38
+ {
39
+ channelName: googleADKChannels.runnerRunAsync.channelName,
40
+ module: {
41
+ name: "@google/adk",
42
+ versionRange: googleADKVersionRange,
43
+ filePath: "dist/esm/runner/runner.js"
44
+ },
45
+ functionQuery: {
46
+ className: "Runner",
47
+ methodName: "runAsync",
48
+ kind: "Sync"
49
+ }
50
+ },
51
+ // Runner.runAsync — bundled CJS/ESM indexes
52
+ // The bundled entrypoints minify class names, so target the 12th sync
53
+ // `runAsync` method in file order rather than a class name. This mapping is
54
+ // only validated against the current 0.6.x bundle layout, so keep the range
55
+ // tight until we verify newer bundled outputs.
56
+ {
57
+ channelName: googleADKChannels.runnerRunAsync.channelName,
58
+ module: {
59
+ name: "@google/adk",
60
+ versionRange: googleADKBundledIndexVersionRange,
61
+ filePath: "dist/cjs/index.js"
62
+ },
63
+ functionQuery: {
64
+ methodName: "runAsync",
65
+ kind: "Sync",
66
+ index: 11
67
+ }
68
+ },
69
+ {
70
+ channelName: googleADKChannels.runnerRunAsync.channelName,
71
+ module: {
72
+ name: "@google/adk",
73
+ versionRange: googleADKBundledIndexVersionRange,
74
+ filePath: "dist/esm/index.js"
75
+ },
76
+ functionQuery: {
77
+ methodName: "runAsync",
78
+ kind: "Sync",
79
+ index: 11
80
+ }
81
+ },
82
+ // --- BaseAgent.runAsync --- async generator, kind "Sync" + sync-stream channel
83
+ // BaseAgent.runAsync — ESM individual module file
84
+ {
85
+ channelName: googleADKChannels.agentRunAsync.channelName,
86
+ module: {
87
+ name: "@google/adk",
88
+ versionRange: googleADKVersionRange,
89
+ filePath: "dist/esm/agents/base_agent.js"
90
+ },
91
+ functionQuery: {
92
+ className: "BaseAgent",
93
+ methodName: "runAsync",
94
+ kind: "Sync"
95
+ }
96
+ },
97
+ // BaseAgent.runAsync — bundled CJS/ESM indexes
98
+ // The bundled entrypoints minify class names, so target the first sync
99
+ // `runAsync` method in file order rather than a class name. This mapping is
100
+ // only validated against the current 0.6.x bundle layout, so keep the range
101
+ // tight until we verify newer bundled outputs.
102
+ {
103
+ channelName: googleADKChannels.agentRunAsync.channelName,
104
+ module: {
105
+ name: "@google/adk",
106
+ versionRange: googleADKBundledIndexVersionRange,
107
+ filePath: "dist/cjs/index.js"
108
+ },
109
+ functionQuery: {
110
+ methodName: "runAsync",
111
+ kind: "Sync",
112
+ index: 0
113
+ }
114
+ },
115
+ {
116
+ channelName: googleADKChannels.agentRunAsync.channelName,
117
+ module: {
118
+ name: "@google/adk",
119
+ versionRange: googleADKBundledIndexVersionRange,
120
+ filePath: "dist/esm/index.js"
121
+ },
122
+ functionQuery: {
123
+ methodName: "runAsync",
124
+ kind: "Sync",
125
+ index: 0
126
+ }
127
+ },
128
+ // --- FunctionTool.runAsync --- regular async, kind "Async"
129
+ // FunctionTool.runAsync — ESM individual module file
130
+ {
131
+ channelName: googleADKChannels.toolRunAsync.channelName,
132
+ module: {
133
+ name: "@google/adk",
134
+ versionRange: googleADKVersionRange,
135
+ filePath: "dist/esm/tools/function_tool.js"
136
+ },
137
+ functionQuery: {
138
+ className: "FunctionTool",
139
+ methodName: "runAsync",
140
+ kind: "Async"
141
+ }
142
+ },
143
+ // FunctionTool.runAsync — bundled CJS/ESM indexes
144
+ // The bundled entrypoints minify class names, so target the first async
145
+ // `runAsync` method in file order rather than a class name. This mapping is
146
+ // only validated against the current 0.6.x bundle layout, so keep the range
147
+ // tight until we verify newer bundled outputs.
148
+ {
149
+ channelName: googleADKChannels.toolRunAsync.channelName,
150
+ module: {
151
+ name: "@google/adk",
152
+ versionRange: googleADKBundledIndexVersionRange,
153
+ filePath: "dist/cjs/index.js"
154
+ },
155
+ functionQuery: {
156
+ methodName: "runAsync",
157
+ kind: "Async",
158
+ index: 1
159
+ }
160
+ },
161
+ {
162
+ channelName: googleADKChannels.toolRunAsync.channelName,
163
+ module: {
164
+ name: "@google/adk",
165
+ versionRange: googleADKBundledIndexVersionRange,
166
+ filePath: "dist/esm/index.js"
167
+ },
168
+ functionQuery: {
169
+ methodName: "runAsync",
170
+ kind: "Async",
171
+ index: 1
172
+ }
173
+ }
174
+ ];
11
175
  export {
12
176
  aiSDKConfigs,
13
177
  anthropicConfigs,
14
178
  claudeAgentSDKConfigs,
179
+ cohereConfigs,
180
+ googleADKConfigs,
15
181
  googleGenAIConfigs,
182
+ huggingFaceConfigs,
16
183
  mistralConfigs,
17
184
  openRouterAgentConfigs,
18
185
  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;