braintrust 3.3.0-rc.45 → 3.4.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 +52 -67
- package/dev/dist/index.d.mts +53 -9
- package/dev/dist/index.d.ts +53 -9
- package/dev/dist/index.js +1839 -1298
- package/dev/dist/index.mjs +1503 -962
- package/dist/auto-instrumentations/bundler/esbuild.cjs +270 -23
- package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
- package/dist/auto-instrumentations/bundler/rollup.cjs +270 -23
- package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
- package/dist/auto-instrumentations/bundler/vite.cjs +270 -23
- package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
- package/dist/auto-instrumentations/bundler/webpack.cjs +270 -23
- package/dist/auto-instrumentations/bundler/webpack.mjs +2 -2
- package/dist/auto-instrumentations/{chunk-OLOPGWTJ.mjs → chunk-D5ZPIUEL.mjs} +1 -1
- package/dist/auto-instrumentations/chunk-LVWWLUMN.mjs +535 -0
- package/dist/auto-instrumentations/hook.mjs +306 -23
- package/dist/auto-instrumentations/index.cjs +270 -23
- package/dist/auto-instrumentations/index.d.mts +5 -5
- package/dist/auto-instrumentations/index.d.ts +5 -5
- package/dist/auto-instrumentations/index.mjs +1 -1
- package/dist/auto-instrumentations/loader/esm-hook.mjs +7 -8
- package/dist/browser.d.mts +558 -47
- package/dist/browser.d.ts +558 -47
- package/dist/browser.js +2432 -2174
- package/dist/browser.mjs +2432 -2174
- package/dist/cli.js +1732 -1105
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +2342 -2086
- package/dist/edge-light.mjs +2342 -2086
- package/dist/index.d.mts +558 -47
- package/dist/index.d.ts +558 -47
- package/dist/index.js +2655 -2399
- package/dist/index.mjs +2433 -2177
- package/dist/instrumentation/index.d.mts +16 -22
- package/dist/instrumentation/index.d.ts +16 -22
- package/dist/instrumentation/index.js +1558 -1068
- package/dist/instrumentation/index.mjs +1558 -1068
- package/dist/workerd.d.mts +1 -1
- package/dist/workerd.d.ts +1 -1
- package/dist/workerd.js +2342 -2086
- package/dist/workerd.mjs +2342 -2086
- package/package.json +6 -3
- package/dist/auto-instrumentations/chunk-KVX7OFPD.mjs +0 -288
|
@@ -28,14 +28,146 @@ __export(index_exports, {
|
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(index_exports);
|
|
30
30
|
|
|
31
|
+
// src/isomorph.ts
|
|
32
|
+
var DefaultAsyncLocalStorage = class {
|
|
33
|
+
constructor() {
|
|
34
|
+
}
|
|
35
|
+
enterWith(_) {
|
|
36
|
+
}
|
|
37
|
+
run(_, callback) {
|
|
38
|
+
return callback();
|
|
39
|
+
}
|
|
40
|
+
getStore() {
|
|
41
|
+
return void 0;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
var DefaultTracingChannel = class {
|
|
45
|
+
hasSubscribers = false;
|
|
46
|
+
subscribe(_handlers) {
|
|
47
|
+
}
|
|
48
|
+
unsubscribe(_handlers) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52
|
+
traceSync(fn, _message, thisArg, ...args) {
|
|
53
|
+
return fn.apply(thisArg, args);
|
|
54
|
+
}
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
56
|
+
tracePromise(fn, _message, thisArg, ...args) {
|
|
57
|
+
return Promise.resolve(fn.apply(thisArg, args));
|
|
58
|
+
}
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
60
|
+
traceCallback(fn, _position, _message, thisArg, ...args) {
|
|
61
|
+
return fn.apply(thisArg, args);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var iso = {
|
|
65
|
+
buildType: "unknown",
|
|
66
|
+
// Will be set by configureBrowser() or configureNode()
|
|
67
|
+
getRepoInfo: async (_settings) => void 0,
|
|
68
|
+
getPastNAncestors: async () => [],
|
|
69
|
+
getEnv: (_name) => void 0,
|
|
70
|
+
getCallerLocation: () => void 0,
|
|
71
|
+
newAsyncLocalStorage: () => new DefaultAsyncLocalStorage(),
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
73
|
+
newTracingChannel: (_nameOrChannels) => new DefaultTracingChannel(),
|
|
74
|
+
processOn: (_0, _1) => {
|
|
75
|
+
},
|
|
76
|
+
basename: (filepath) => filepath.split(/[\\/]/).pop() || filepath,
|
|
77
|
+
writeln: (text) => console.log(text)
|
|
78
|
+
};
|
|
79
|
+
var isomorph_default = iso;
|
|
80
|
+
|
|
81
|
+
// src/instrumentation/core/channel-definitions.ts
|
|
82
|
+
function channel(spec) {
|
|
83
|
+
return spec;
|
|
84
|
+
}
|
|
85
|
+
function defineChannels(pkg, channels) {
|
|
86
|
+
return Object.fromEntries(
|
|
87
|
+
Object.entries(channels).map(([key, spec]) => {
|
|
88
|
+
const fullChannelName = `orchestrion:${pkg}:${spec.channelName}`;
|
|
89
|
+
if (spec.kind === "async") {
|
|
90
|
+
const asyncSpec = spec;
|
|
91
|
+
const tracingChannel2 = () => isomorph_default.newTracingChannel(
|
|
92
|
+
fullChannelName
|
|
93
|
+
);
|
|
94
|
+
return [
|
|
95
|
+
key,
|
|
96
|
+
{
|
|
97
|
+
...asyncSpec,
|
|
98
|
+
tracingChannel: tracingChannel2,
|
|
99
|
+
tracePromise: (fn, context) => tracingChannel2().tracePromise(
|
|
100
|
+
fn,
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
102
|
+
context
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
const syncSpec = spec;
|
|
108
|
+
const tracingChannel = () => isomorph_default.newTracingChannel(
|
|
109
|
+
fullChannelName
|
|
110
|
+
);
|
|
111
|
+
return [
|
|
112
|
+
key,
|
|
113
|
+
{
|
|
114
|
+
...syncSpec,
|
|
115
|
+
tracingChannel,
|
|
116
|
+
traceSync: (fn, context) => tracingChannel().traceSync(
|
|
117
|
+
fn,
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
119
|
+
context
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
];
|
|
123
|
+
})
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// src/instrumentation/plugins/openai-channels.ts
|
|
128
|
+
var openAIChannels = defineChannels("openai", {
|
|
129
|
+
chatCompletionsCreate: channel({
|
|
130
|
+
channelName: "chat.completions.create",
|
|
131
|
+
kind: "async"
|
|
132
|
+
}),
|
|
133
|
+
embeddingsCreate: channel({
|
|
134
|
+
channelName: "embeddings.create",
|
|
135
|
+
kind: "async"
|
|
136
|
+
}),
|
|
137
|
+
betaChatCompletionsParse: channel({
|
|
138
|
+
channelName: "beta.chat.completions.parse",
|
|
139
|
+
kind: "async"
|
|
140
|
+
}),
|
|
141
|
+
betaChatCompletionsStream: channel({
|
|
142
|
+
channelName: "beta.chat.completions.stream",
|
|
143
|
+
kind: "sync-stream"
|
|
144
|
+
}),
|
|
145
|
+
moderationsCreate: channel({
|
|
146
|
+
channelName: "moderations.create",
|
|
147
|
+
kind: "async"
|
|
148
|
+
}),
|
|
149
|
+
responsesCreate: channel({
|
|
150
|
+
channelName: "responses.create",
|
|
151
|
+
kind: "async"
|
|
152
|
+
}),
|
|
153
|
+
responsesStream: channel({
|
|
154
|
+
channelName: "responses.stream",
|
|
155
|
+
kind: "sync-stream"
|
|
156
|
+
}),
|
|
157
|
+
responsesParse: channel({
|
|
158
|
+
channelName: "responses.parse",
|
|
159
|
+
kind: "async"
|
|
160
|
+
})
|
|
161
|
+
});
|
|
162
|
+
|
|
31
163
|
// src/auto-instrumentations/configs/openai.ts
|
|
32
164
|
var openaiConfigs = [
|
|
33
165
|
// Chat Completions
|
|
34
166
|
{
|
|
35
|
-
channelName:
|
|
167
|
+
channelName: openAIChannels.chatCompletionsCreate.channelName,
|
|
36
168
|
module: {
|
|
37
169
|
name: "openai",
|
|
38
|
-
versionRange: ">=4.0.0",
|
|
170
|
+
versionRange: ">=4.0.0 <5.0.0",
|
|
39
171
|
filePath: "resources/chat/completions.mjs"
|
|
40
172
|
},
|
|
41
173
|
functionQuery: {
|
|
@@ -44,9 +176,35 @@ var openaiConfigs = [
|
|
|
44
176
|
kind: "Async"
|
|
45
177
|
}
|
|
46
178
|
},
|
|
179
|
+
{
|
|
180
|
+
channelName: openAIChannels.chatCompletionsCreate.channelName,
|
|
181
|
+
module: {
|
|
182
|
+
name: "openai",
|
|
183
|
+
versionRange: ">=4.0.0 <5.0.0",
|
|
184
|
+
filePath: "resources/chat/completions/completions.mjs"
|
|
185
|
+
},
|
|
186
|
+
functionQuery: {
|
|
187
|
+
className: "Completions",
|
|
188
|
+
methodName: "create",
|
|
189
|
+
kind: "Async"
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
channelName: openAIChannels.chatCompletionsCreate.channelName,
|
|
194
|
+
module: {
|
|
195
|
+
name: "openai",
|
|
196
|
+
versionRange: ">=5.0.0",
|
|
197
|
+
filePath: "resources/chat/completions/completions.mjs"
|
|
198
|
+
},
|
|
199
|
+
functionQuery: {
|
|
200
|
+
className: "Completions",
|
|
201
|
+
methodName: "create",
|
|
202
|
+
kind: "Async"
|
|
203
|
+
}
|
|
204
|
+
},
|
|
47
205
|
// Embeddings
|
|
48
206
|
{
|
|
49
|
-
channelName:
|
|
207
|
+
channelName: openAIChannels.embeddingsCreate.channelName,
|
|
50
208
|
module: {
|
|
51
209
|
name: "openai",
|
|
52
210
|
versionRange: ">=4.0.0",
|
|
@@ -60,10 +218,10 @@ var openaiConfigs = [
|
|
|
60
218
|
},
|
|
61
219
|
// Beta Chat Completions Parse
|
|
62
220
|
{
|
|
63
|
-
channelName:
|
|
221
|
+
channelName: openAIChannels.betaChatCompletionsParse.channelName,
|
|
64
222
|
module: {
|
|
65
223
|
name: "openai",
|
|
66
|
-
versionRange: ">=4.0.0",
|
|
224
|
+
versionRange: ">=4.0.0 <5.0.0",
|
|
67
225
|
filePath: "resources/beta/chat/completions.mjs"
|
|
68
226
|
},
|
|
69
227
|
functionQuery: {
|
|
@@ -72,9 +230,22 @@ var openaiConfigs = [
|
|
|
72
230
|
kind: "Async"
|
|
73
231
|
}
|
|
74
232
|
},
|
|
233
|
+
{
|
|
234
|
+
channelName: openAIChannels.betaChatCompletionsParse.channelName,
|
|
235
|
+
module: {
|
|
236
|
+
name: "openai",
|
|
237
|
+
versionRange: ">=5.0.0",
|
|
238
|
+
filePath: "resources/chat/completions/completions.mjs"
|
|
239
|
+
},
|
|
240
|
+
functionQuery: {
|
|
241
|
+
className: "Completions",
|
|
242
|
+
methodName: "parse",
|
|
243
|
+
kind: "Async"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
75
246
|
// Moderations
|
|
76
247
|
{
|
|
77
|
-
channelName:
|
|
248
|
+
channelName: openAIChannels.moderationsCreate.channelName,
|
|
78
249
|
module: {
|
|
79
250
|
name: "openai",
|
|
80
251
|
versionRange: ">=4.0.0",
|
|
@@ -88,10 +259,10 @@ var openaiConfigs = [
|
|
|
88
259
|
},
|
|
89
260
|
// Beta Chat Completions Stream
|
|
90
261
|
{
|
|
91
|
-
channelName:
|
|
262
|
+
channelName: openAIChannels.betaChatCompletionsStream.channelName,
|
|
92
263
|
module: {
|
|
93
264
|
name: "openai",
|
|
94
|
-
versionRange: ">=4.0.0",
|
|
265
|
+
versionRange: ">=4.0.0 <5.0.0",
|
|
95
266
|
filePath: "resources/beta/chat/completions.mjs"
|
|
96
267
|
},
|
|
97
268
|
functionQuery: {
|
|
@@ -100,9 +271,22 @@ var openaiConfigs = [
|
|
|
100
271
|
kind: "Sync"
|
|
101
272
|
}
|
|
102
273
|
},
|
|
274
|
+
{
|
|
275
|
+
channelName: openAIChannels.betaChatCompletionsStream.channelName,
|
|
276
|
+
module: {
|
|
277
|
+
name: "openai",
|
|
278
|
+
versionRange: ">=5.0.0",
|
|
279
|
+
filePath: "resources/chat/completions/completions.mjs"
|
|
280
|
+
},
|
|
281
|
+
functionQuery: {
|
|
282
|
+
className: "Completions",
|
|
283
|
+
methodName: "stream",
|
|
284
|
+
kind: "Sync"
|
|
285
|
+
}
|
|
286
|
+
},
|
|
103
287
|
// Responses API (v4.87.0+)
|
|
104
288
|
{
|
|
105
|
-
channelName:
|
|
289
|
+
channelName: openAIChannels.responsesCreate.channelName,
|
|
106
290
|
module: {
|
|
107
291
|
name: "openai",
|
|
108
292
|
versionRange: ">=4.87.0",
|
|
@@ -115,7 +299,7 @@ var openaiConfigs = [
|
|
|
115
299
|
}
|
|
116
300
|
},
|
|
117
301
|
{
|
|
118
|
-
channelName:
|
|
302
|
+
channelName: openAIChannels.responsesStream.channelName,
|
|
119
303
|
module: {
|
|
120
304
|
name: "openai",
|
|
121
305
|
versionRange: ">=4.87.0",
|
|
@@ -128,7 +312,7 @@ var openaiConfigs = [
|
|
|
128
312
|
}
|
|
129
313
|
},
|
|
130
314
|
{
|
|
131
|
-
channelName:
|
|
315
|
+
channelName: openAIChannels.responsesParse.channelName,
|
|
132
316
|
module: {
|
|
133
317
|
name: "openai",
|
|
134
318
|
versionRange: ">=4.87.0",
|
|
@@ -142,15 +326,27 @@ var openaiConfigs = [
|
|
|
142
326
|
}
|
|
143
327
|
];
|
|
144
328
|
|
|
329
|
+
// src/instrumentation/plugins/anthropic-channels.ts
|
|
330
|
+
var anthropicChannels = defineChannels("@anthropic-ai/sdk", {
|
|
331
|
+
messagesCreate: channel({
|
|
332
|
+
channelName: "messages.create",
|
|
333
|
+
kind: "async"
|
|
334
|
+
}),
|
|
335
|
+
betaMessagesCreate: channel({
|
|
336
|
+
channelName: "beta.messages.create",
|
|
337
|
+
kind: "async"
|
|
338
|
+
})
|
|
339
|
+
});
|
|
340
|
+
|
|
145
341
|
// src/auto-instrumentations/configs/anthropic.ts
|
|
146
342
|
var anthropicConfigs = [
|
|
147
343
|
// Messages API - create (supports streaming via stream=true parameter)
|
|
148
344
|
{
|
|
149
|
-
channelName:
|
|
345
|
+
channelName: anthropicChannels.messagesCreate.channelName,
|
|
150
346
|
module: {
|
|
151
347
|
name: "@anthropic-ai/sdk",
|
|
152
348
|
versionRange: ">=0.60.0",
|
|
153
|
-
filePath: "resources/messages.mjs"
|
|
349
|
+
filePath: "resources/messages/messages.mjs"
|
|
154
350
|
},
|
|
155
351
|
functionQuery: {
|
|
156
352
|
className: "Messages",
|
|
@@ -160,7 +356,7 @@ var anthropicConfigs = [
|
|
|
160
356
|
},
|
|
161
357
|
// Beta Messages API - create (supports streaming via stream=true parameter)
|
|
162
358
|
{
|
|
163
|
-
channelName:
|
|
359
|
+
channelName: anthropicChannels.betaMessagesCreate.channelName,
|
|
164
360
|
module: {
|
|
165
361
|
name: "@anthropic-ai/sdk",
|
|
166
362
|
versionRange: ">=0.60.0",
|
|
@@ -174,11 +370,39 @@ var anthropicConfigs = [
|
|
|
174
370
|
}
|
|
175
371
|
];
|
|
176
372
|
|
|
373
|
+
// src/instrumentation/plugins/ai-sdk-channels.ts
|
|
374
|
+
var aiSDKChannels = defineChannels("ai", {
|
|
375
|
+
generateText: channel({
|
|
376
|
+
channelName: "generateText",
|
|
377
|
+
kind: "async"
|
|
378
|
+
}),
|
|
379
|
+
streamText: channel({
|
|
380
|
+
channelName: "streamText",
|
|
381
|
+
kind: "async"
|
|
382
|
+
}),
|
|
383
|
+
generateObject: channel({
|
|
384
|
+
channelName: "generateObject",
|
|
385
|
+
kind: "async"
|
|
386
|
+
}),
|
|
387
|
+
streamObject: channel({
|
|
388
|
+
channelName: "streamObject",
|
|
389
|
+
kind: "async"
|
|
390
|
+
}),
|
|
391
|
+
agentGenerate: channel({
|
|
392
|
+
channelName: "Agent.generate",
|
|
393
|
+
kind: "async"
|
|
394
|
+
}),
|
|
395
|
+
agentStream: channel({
|
|
396
|
+
channelName: "Agent.stream",
|
|
397
|
+
kind: "async"
|
|
398
|
+
})
|
|
399
|
+
});
|
|
400
|
+
|
|
177
401
|
// src/auto-instrumentations/configs/ai-sdk.ts
|
|
178
402
|
var aiSDKConfigs = [
|
|
179
403
|
// generateText - async function
|
|
180
404
|
{
|
|
181
|
-
channelName:
|
|
405
|
+
channelName: aiSDKChannels.generateText.channelName,
|
|
182
406
|
module: {
|
|
183
407
|
name: "ai",
|
|
184
408
|
versionRange: ">=3.0.0",
|
|
@@ -191,7 +415,7 @@ var aiSDKConfigs = [
|
|
|
191
415
|
},
|
|
192
416
|
// streamText - async function
|
|
193
417
|
{
|
|
194
|
-
channelName:
|
|
418
|
+
channelName: aiSDKChannels.streamText.channelName,
|
|
195
419
|
module: {
|
|
196
420
|
name: "ai",
|
|
197
421
|
versionRange: ">=3.0.0",
|
|
@@ -204,7 +428,7 @@ var aiSDKConfigs = [
|
|
|
204
428
|
},
|
|
205
429
|
// generateObject - async function
|
|
206
430
|
{
|
|
207
|
-
channelName:
|
|
431
|
+
channelName: aiSDKChannels.generateObject.channelName,
|
|
208
432
|
module: {
|
|
209
433
|
name: "ai",
|
|
210
434
|
versionRange: ">=3.0.0",
|
|
@@ -217,7 +441,7 @@ var aiSDKConfigs = [
|
|
|
217
441
|
},
|
|
218
442
|
// streamObject - async function
|
|
219
443
|
{
|
|
220
|
-
channelName:
|
|
444
|
+
channelName: aiSDKChannels.streamObject.channelName,
|
|
221
445
|
module: {
|
|
222
446
|
name: "ai",
|
|
223
447
|
versionRange: ">=3.0.0",
|
|
@@ -230,7 +454,7 @@ var aiSDKConfigs = [
|
|
|
230
454
|
},
|
|
231
455
|
// Agent.generate - async method (v3-v5 only, Agent structure changed in v6)
|
|
232
456
|
{
|
|
233
|
-
channelName:
|
|
457
|
+
channelName: aiSDKChannels.agentGenerate.channelName,
|
|
234
458
|
module: {
|
|
235
459
|
name: "ai",
|
|
236
460
|
versionRange: ">=3.0.0 <6.0.0",
|
|
@@ -244,7 +468,7 @@ var aiSDKConfigs = [
|
|
|
244
468
|
},
|
|
245
469
|
// Agent.stream - async method (v3-v5 only, Agent structure changed in v6)
|
|
246
470
|
{
|
|
247
|
-
channelName:
|
|
471
|
+
channelName: aiSDKChannels.agentStream.channelName,
|
|
248
472
|
module: {
|
|
249
473
|
name: "ai",
|
|
250
474
|
versionRange: ">=3.0.0 <6.0.0",
|
|
@@ -258,11 +482,22 @@ var aiSDKConfigs = [
|
|
|
258
482
|
}
|
|
259
483
|
];
|
|
260
484
|
|
|
485
|
+
// src/instrumentation/plugins/claude-agent-sdk-channels.ts
|
|
486
|
+
var claudeAgentSDKChannels = defineChannels(
|
|
487
|
+
"@anthropic-ai/claude-agent-sdk",
|
|
488
|
+
{
|
|
489
|
+
query: channel({
|
|
490
|
+
channelName: "query",
|
|
491
|
+
kind: "async"
|
|
492
|
+
})
|
|
493
|
+
}
|
|
494
|
+
);
|
|
495
|
+
|
|
261
496
|
// src/auto-instrumentations/configs/claude-agent-sdk.ts
|
|
262
497
|
var claudeAgentSDKConfigs = [
|
|
263
498
|
// query - Main entry point for agent interactions (top-level exported async generator function)
|
|
264
499
|
{
|
|
265
|
-
channelName:
|
|
500
|
+
channelName: claudeAgentSDKChannels.query.channelName,
|
|
266
501
|
module: {
|
|
267
502
|
name: "@anthropic-ai/claude-agent-sdk",
|
|
268
503
|
versionRange: ">=0.1.0",
|
|
@@ -275,12 +510,24 @@ var claudeAgentSDKConfigs = [
|
|
|
275
510
|
}
|
|
276
511
|
];
|
|
277
512
|
|
|
513
|
+
// src/instrumentation/plugins/google-genai-channels.ts
|
|
514
|
+
var googleGenAIChannels = defineChannels("@google/genai", {
|
|
515
|
+
generateContent: channel({
|
|
516
|
+
channelName: "models.generateContent",
|
|
517
|
+
kind: "async"
|
|
518
|
+
}),
|
|
519
|
+
generateContentStream: channel({
|
|
520
|
+
channelName: "models.generateContentStream",
|
|
521
|
+
kind: "async"
|
|
522
|
+
})
|
|
523
|
+
});
|
|
524
|
+
|
|
278
525
|
// src/auto-instrumentations/configs/google-genai.ts
|
|
279
526
|
var googleGenAIConfigs = [
|
|
280
527
|
// Models.generateContentInternal - The actual class method (Node.js entry point)
|
|
281
528
|
// Note: generateContent is an arrow function property that calls this internal method
|
|
282
529
|
{
|
|
283
|
-
channelName:
|
|
530
|
+
channelName: googleGenAIChannels.generateContent.channelName,
|
|
284
531
|
module: {
|
|
285
532
|
name: "@google/genai",
|
|
286
533
|
versionRange: ">=1.0.0",
|
|
@@ -295,7 +542,7 @@ var googleGenAIConfigs = [
|
|
|
295
542
|
// Models.generateContentStreamInternal - The actual class method (Node.js entry point)
|
|
296
543
|
// Note: generateContentStream is an arrow function property that calls this internal method
|
|
297
544
|
{
|
|
298
|
-
channelName:
|
|
545
|
+
channelName: googleGenAIChannels.generateContentStream.channelName,
|
|
299
546
|
module: {
|
|
300
547
|
name: "@google/genai",
|
|
301
548
|
versionRange: ">=1.0.0",
|
|
@@ -8,8 +8,8 @@ export { InstrumentationConfig } from '@apm-js-collab/code-transformer';
|
|
|
8
8
|
* to emit events on. They are used by orchestrion-js to perform AST
|
|
9
9
|
* transformation at build-time or load-time.
|
|
10
10
|
*
|
|
11
|
-
* NOTE: Channel names should NOT include the
|
|
12
|
-
* will prepend "orchestrion:
|
|
11
|
+
* NOTE: Channel names should NOT include the orchestrion: prefix. The code-transformer
|
|
12
|
+
* will prepend "orchestrion:" + module.name + ":" to these names, resulting in final channel names like:
|
|
13
13
|
* "orchestrion:openai:chat.completions.create"
|
|
14
14
|
*/
|
|
15
15
|
declare const openaiConfigs: InstrumentationConfig[];
|
|
@@ -21,9 +21,9 @@ declare const openaiConfigs: InstrumentationConfig[];
|
|
|
21
21
|
* to emit events on. They are used by orchestrion-js to perform AST
|
|
22
22
|
* transformation at build-time or load-time.
|
|
23
23
|
*
|
|
24
|
-
* NOTE: Channel names should NOT include the
|
|
25
|
-
* will prepend "orchestrion:
|
|
26
|
-
* "orchestrion
|
|
24
|
+
* NOTE: Channel names should NOT include the orchestrion: prefix. The code-transformer
|
|
25
|
+
* will prepend "orchestrion:" + module.name + ":" to these names, resulting in final channel names like:
|
|
26
|
+
* "orchestrion:@anthropic-ai/sdk:messages.create"
|
|
27
27
|
*/
|
|
28
28
|
declare const anthropicConfigs: InstrumentationConfig[];
|
|
29
29
|
|
|
@@ -8,8 +8,8 @@ export { InstrumentationConfig } from '@apm-js-collab/code-transformer';
|
|
|
8
8
|
* to emit events on. They are used by orchestrion-js to perform AST
|
|
9
9
|
* transformation at build-time or load-time.
|
|
10
10
|
*
|
|
11
|
-
* NOTE: Channel names should NOT include the
|
|
12
|
-
* will prepend "orchestrion:
|
|
11
|
+
* NOTE: Channel names should NOT include the orchestrion: prefix. The code-transformer
|
|
12
|
+
* will prepend "orchestrion:" + module.name + ":" to these names, resulting in final channel names like:
|
|
13
13
|
* "orchestrion:openai:chat.completions.create"
|
|
14
14
|
*/
|
|
15
15
|
declare const openaiConfigs: InstrumentationConfig[];
|
|
@@ -21,9 +21,9 @@ declare const openaiConfigs: InstrumentationConfig[];
|
|
|
21
21
|
* to emit events on. They are used by orchestrion-js to perform AST
|
|
22
22
|
* transformation at build-time or load-time.
|
|
23
23
|
*
|
|
24
|
-
* NOTE: Channel names should NOT include the
|
|
25
|
-
* will prepend "orchestrion:
|
|
26
|
-
* "orchestrion
|
|
24
|
+
* NOTE: Channel names should NOT include the orchestrion: prefix. The code-transformer
|
|
25
|
+
* will prepend "orchestrion:" + module.name + ":" to these names, resulting in final channel names like:
|
|
26
|
+
* "orchestrion:@anthropic-ai/sdk:messages.create"
|
|
27
27
|
*/
|
|
28
28
|
declare const anthropicConfigs: InstrumentationConfig[];
|
|
29
29
|
|
|
@@ -10,21 +10,20 @@ import {
|
|
|
10
10
|
create
|
|
11
11
|
} from "@apm-js-collab/code-transformer";
|
|
12
12
|
import moduleDetailsFromPath from "module-details-from-path";
|
|
13
|
-
var
|
|
14
|
-
var packages
|
|
15
|
-
var
|
|
13
|
+
var instrumentator;
|
|
14
|
+
var packages;
|
|
15
|
+
var transformers = /* @__PURE__ */ new Map();
|
|
16
16
|
async function initialize(data = {}) {
|
|
17
|
-
const
|
|
18
|
-
instrumentator = create(
|
|
19
|
-
packages = new Set(
|
|
20
|
-
transformers = /* @__PURE__ */ new Map();
|
|
17
|
+
const configs = data.instrumentations || [];
|
|
18
|
+
instrumentator = create(configs);
|
|
19
|
+
packages = new Set(configs.map((i) => i.module.name));
|
|
21
20
|
}
|
|
22
21
|
async function resolve(specifier, context, nextResolve) {
|
|
23
22
|
const url = await nextResolve(specifier, context);
|
|
24
23
|
const filePath = url.url.startsWith("file:") ? fileURLToPath(url.url) : url.url;
|
|
25
24
|
const normalizedForPlatform = filePath.split("/").join(sep);
|
|
26
25
|
const resolvedModule = moduleDetailsFromPath(normalizedForPlatform);
|
|
27
|
-
if (resolvedModule && packages
|
|
26
|
+
if (resolvedModule && packages?.has(resolvedModule.name)) {
|
|
28
27
|
const version = getPackageVersion(resolvedModule.basedir);
|
|
29
28
|
const normalizedModulePath = resolvedModule.path.replace(/\\/g, "/");
|
|
30
29
|
const transformer = instrumentator.getTransformer(
|