braintrust 3.10.0 → 3.12.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 +8 -8
- package/dev/dist/index.d.mts +51 -3
- package/dev/dist/index.d.ts +51 -3
- package/dev/dist/index.js +13138 -8915
- package/dev/dist/index.mjs +13015 -8792
- package/dist/apply-auto-instrumentation.browser.d.mts +2 -0
- package/dist/apply-auto-instrumentation.browser.d.ts +2 -0
- package/dist/apply-auto-instrumentation.browser.js +18 -0
- package/dist/apply-auto-instrumentation.browser.mjs +0 -0
- package/dist/apply-auto-instrumentation.d.mts +2 -0
- package/dist/apply-auto-instrumentation.d.ts +2 -0
- package/dist/apply-auto-instrumentation.js +2534 -0
- package/dist/apply-auto-instrumentation.mjs +2534 -0
- package/dist/auto-instrumentations/bundler/esbuild.cjs +1775 -737
- package/dist/auto-instrumentations/bundler/esbuild.d.mts +9 -5
- package/dist/auto-instrumentations/bundler/esbuild.d.ts +9 -5
- package/dist/auto-instrumentations/bundler/esbuild.mjs +10 -2
- package/dist/auto-instrumentations/bundler/next.cjs +3268 -0
- package/dist/auto-instrumentations/bundler/next.d.mts +3 -0
- package/dist/auto-instrumentations/bundler/next.d.ts +3 -0
- package/dist/auto-instrumentations/bundler/next.mjs +189 -0
- package/dist/auto-instrumentations/bundler/rollup.cjs +1775 -737
- package/dist/auto-instrumentations/bundler/rollup.d.mts +9 -5
- package/dist/auto-instrumentations/bundler/rollup.d.ts +9 -5
- package/dist/auto-instrumentations/bundler/rollup.mjs +10 -2
- package/dist/auto-instrumentations/bundler/vite.cjs +1775 -737
- package/dist/auto-instrumentations/bundler/vite.d.mts +9 -5
- package/dist/auto-instrumentations/bundler/vite.d.ts +9 -5
- package/dist/auto-instrumentations/bundler/vite.mjs +10 -2
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +1713 -690
- package/dist/auto-instrumentations/bundler/webpack-loader.d.ts +3 -3
- package/dist/auto-instrumentations/bundler/webpack.cjs +1775 -737
- package/dist/auto-instrumentations/bundler/webpack.d.mts +9 -5
- package/dist/auto-instrumentations/bundler/webpack.d.ts +9 -5
- package/dist/auto-instrumentations/bundler/webpack.mjs +6 -6
- package/dist/auto-instrumentations/{chunk-GZNXBBPU.mjs → chunk-2DPA74KK.mjs} +856 -5
- package/dist/auto-instrumentations/chunk-73BZUKVI.mjs +300 -0
- package/dist/auto-instrumentations/chunk-AFXRW7I7.mjs +18 -0
- package/dist/auto-instrumentations/{chunk-ITP7RAUY.mjs → chunk-MWZXZQUO.mjs} +23 -1
- package/dist/auto-instrumentations/hook.mjs +1912 -1125
- package/dist/auto-instrumentations/index.cjs +615 -4
- package/dist/auto-instrumentations/index.d.mts +18 -1
- package/dist/auto-instrumentations/index.d.ts +18 -1
- package/dist/auto-instrumentations/index.mjs +12 -247
- 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 +35 -3
- package/dist/auto-instrumentations/plugin-D7nDswtC.d.mts +44 -0
- package/dist/auto-instrumentations/plugin-D7nDswtC.d.ts +44 -0
- package/dist/browser.d.mts +577 -287
- package/dist/browser.d.ts +577 -287
- package/dist/browser.js +10221 -5524
- package/dist/browser.mjs +10221 -5524
- package/dist/chunk-BW4DF4CY.js +816 -0
- package/dist/chunk-MSLBGITU.mjs +816 -0
- package/dist/cli.js +13143 -8892
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +10221 -5524
- package/dist/edge-light.mjs +10221 -5524
- package/dist/index.d.mts +590 -300
- package/dist/index.d.ts +590 -300
- package/dist/index.js +9309 -5371
- package/dist/index.mjs +10340 -6402
- package/dist/instrumentation/index.d.mts +7863 -39
- package/dist/instrumentation/index.d.ts +7863 -39
- package/dist/instrumentation/index.js +10263 -6034
- package/dist/instrumentation/index.mjs +10262 -6034
- package/dist/workerd.d.mts +1 -1
- package/dist/workerd.d.ts +1 -1
- package/dist/workerd.js +10221 -5524
- package/dist/workerd.mjs +10221 -5524
- package/package.json +33 -19
- package/util/dist/index.js +6 -0
- package/util/dist/index.mjs +6 -0
- package/dist/auto-instrumentations/chunk-XWEQQOQH.mjs +0 -106
- package/dist/auto-instrumentations/plugin-Df3qKIl2.d.mts +0 -22
- package/dist/auto-instrumentations/plugin-Df3qKIl2.d.ts +0 -22
|
@@ -0,0 +1,816 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// src/auto-instrumentations/patch-tracing-channel.ts
|
|
8
|
+
function patchTracingChannel(tracingChannelFn) {
|
|
9
|
+
const dummyChannel = tracingChannelFn("__braintrust_probe__");
|
|
10
|
+
const TracingChannel = dummyChannel?.constructor;
|
|
11
|
+
if (!TracingChannel?.prototype) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (!Object.getOwnPropertyDescriptor(TracingChannel.prototype, "hasSubscribers")) {
|
|
15
|
+
Object.defineProperty(TracingChannel.prototype, "hasSubscribers", {
|
|
16
|
+
configurable: true,
|
|
17
|
+
enumerable: false,
|
|
18
|
+
get() {
|
|
19
|
+
return Boolean(
|
|
20
|
+
this.start?.hasSubscribers || this.end?.hasSubscribers || this.asyncStart?.hasSubscribers || this.asyncEnd?.hasSubscribers || this.error?.hasSubscribers
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
if (TracingChannel.prototype.tracePromise) {
|
|
26
|
+
TracingChannel.prototype.tracePromise = function(fn, context = {}, thisArg, ...args) {
|
|
27
|
+
const start = this.start;
|
|
28
|
+
const end = this.end;
|
|
29
|
+
const asyncStart = this.asyncStart;
|
|
30
|
+
const asyncEnd = this.asyncEnd;
|
|
31
|
+
const error = this.error;
|
|
32
|
+
function publishRejected(err) {
|
|
33
|
+
context.error = err;
|
|
34
|
+
error?.publish(context);
|
|
35
|
+
asyncStart?.publish(context);
|
|
36
|
+
asyncEnd?.publish(context);
|
|
37
|
+
}
|
|
38
|
+
function publishResolved(result) {
|
|
39
|
+
context.result = result;
|
|
40
|
+
asyncStart?.publish(context);
|
|
41
|
+
asyncEnd?.publish(context);
|
|
42
|
+
}
|
|
43
|
+
return start.runStores(context, () => {
|
|
44
|
+
try {
|
|
45
|
+
const result = Reflect.apply(fn, thisArg, args);
|
|
46
|
+
end?.publish(context);
|
|
47
|
+
if (result && (typeof result === "object" || typeof result === "function") && typeof result.then === "function") {
|
|
48
|
+
if (result.constructor === Promise) {
|
|
49
|
+
return result.then(
|
|
50
|
+
(res) => {
|
|
51
|
+
publishResolved(res);
|
|
52
|
+
return res;
|
|
53
|
+
},
|
|
54
|
+
(err) => {
|
|
55
|
+
publishRejected(err);
|
|
56
|
+
return Promise.reject(err);
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
void result.then(
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
62
|
+
(resolved) => {
|
|
63
|
+
try {
|
|
64
|
+
publishResolved(resolved);
|
|
65
|
+
} catch {
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
69
|
+
(err) => {
|
|
70
|
+
try {
|
|
71
|
+
publishRejected(err);
|
|
72
|
+
} catch {
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
context.result = result;
|
|
79
|
+
asyncStart?.publish(context);
|
|
80
|
+
asyncEnd?.publish(context);
|
|
81
|
+
return result;
|
|
82
|
+
} catch (err) {
|
|
83
|
+
context.error = err;
|
|
84
|
+
error?.publish(context);
|
|
85
|
+
end?.publish(context);
|
|
86
|
+
throw err;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// src/isomorph.ts
|
|
94
|
+
var DefaultAsyncLocalStorage = class {
|
|
95
|
+
constructor() {
|
|
96
|
+
}
|
|
97
|
+
enterWith(_) {
|
|
98
|
+
}
|
|
99
|
+
run(_, callback) {
|
|
100
|
+
return callback();
|
|
101
|
+
}
|
|
102
|
+
getStore() {
|
|
103
|
+
return void 0;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
var DefaultChannel = class {
|
|
107
|
+
constructor(name) {
|
|
108
|
+
this.name = name;
|
|
109
|
+
}
|
|
110
|
+
hasSubscribers = false;
|
|
111
|
+
subscribe(_subscription) {
|
|
112
|
+
}
|
|
113
|
+
unsubscribe(_subscription) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
bindStore(_store, _transform) {
|
|
117
|
+
}
|
|
118
|
+
unbindStore(_store) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
publish(_message) {
|
|
122
|
+
}
|
|
123
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
124
|
+
runStores(_message, fn, thisArg, ...args) {
|
|
125
|
+
return fn.apply(thisArg, args);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
var DefaultTracingChannel = class {
|
|
129
|
+
start;
|
|
130
|
+
end;
|
|
131
|
+
asyncStart;
|
|
132
|
+
asyncEnd;
|
|
133
|
+
error;
|
|
134
|
+
constructor(nameOrChannels) {
|
|
135
|
+
if (typeof nameOrChannels === "string") {
|
|
136
|
+
this.start = new DefaultChannel(`tracing:${nameOrChannels}:start`);
|
|
137
|
+
this.end = new DefaultChannel(`tracing:${nameOrChannels}:end`);
|
|
138
|
+
this.asyncStart = new DefaultChannel(
|
|
139
|
+
`tracing:${nameOrChannels}:asyncStart`
|
|
140
|
+
);
|
|
141
|
+
this.asyncEnd = new DefaultChannel(`tracing:${nameOrChannels}:asyncEnd`);
|
|
142
|
+
this.error = new DefaultChannel(`tracing:${nameOrChannels}:error`);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
this.start = nameOrChannels.start ?? new DefaultChannel("tracing:start");
|
|
146
|
+
this.end = nameOrChannels.end ?? new DefaultChannel("tracing:end");
|
|
147
|
+
this.asyncStart = nameOrChannels.asyncStart ?? new DefaultChannel("tracing:asyncStart");
|
|
148
|
+
this.asyncEnd = nameOrChannels.asyncEnd ?? new DefaultChannel("tracing:asyncEnd");
|
|
149
|
+
this.error = nameOrChannels.error ?? new DefaultChannel("tracing:error");
|
|
150
|
+
}
|
|
151
|
+
get hasSubscribers() {
|
|
152
|
+
return this.start.hasSubscribers || this.end.hasSubscribers || this.asyncStart.hasSubscribers || this.asyncEnd.hasSubscribers || this.error.hasSubscribers;
|
|
153
|
+
}
|
|
154
|
+
subscribe(_handlers) {
|
|
155
|
+
}
|
|
156
|
+
unsubscribe(_handlers) {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
160
|
+
traceSync(fn, _message, thisArg, ...args) {
|
|
161
|
+
return fn.apply(thisArg, args);
|
|
162
|
+
}
|
|
163
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
164
|
+
tracePromise(fn, _message, thisArg, ...args) {
|
|
165
|
+
return fn.apply(thisArg, args);
|
|
166
|
+
}
|
|
167
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
168
|
+
traceCallback(fn, _position, _message, thisArg, ...args) {
|
|
169
|
+
return fn.apply(thisArg, args);
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
var iso = {
|
|
173
|
+
buildType: "unknown",
|
|
174
|
+
// Will be set by configureBrowser() or configureNode()
|
|
175
|
+
getRepoInfo: async (_settings) => void 0,
|
|
176
|
+
getPastNAncestors: async () => [],
|
|
177
|
+
getEnv: (_name) => void 0,
|
|
178
|
+
getCallerLocation: () => void 0,
|
|
179
|
+
newAsyncLocalStorage: () => new DefaultAsyncLocalStorage(),
|
|
180
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
181
|
+
newTracingChannel: (nameOrChannels) => new DefaultTracingChannel(nameOrChannels),
|
|
182
|
+
processOn: (_0, _1) => {
|
|
183
|
+
},
|
|
184
|
+
basename: (filepath) => filepath.split(/[\\/]/).pop() || filepath,
|
|
185
|
+
// eslint-disable-next-line no-restricted-properties -- preserving intentional console usage.
|
|
186
|
+
writeln: (text) => console.log(text)
|
|
187
|
+
};
|
|
188
|
+
var isomorph_default = iso;
|
|
189
|
+
|
|
190
|
+
// src/instrumentation/core/channel-definitions.ts
|
|
191
|
+
function channel(spec) {
|
|
192
|
+
return spec;
|
|
193
|
+
}
|
|
194
|
+
function defineChannels(pkg, channels) {
|
|
195
|
+
return Object.fromEntries(
|
|
196
|
+
Object.entries(channels).map(([key, spec]) => {
|
|
197
|
+
const fullChannelName = `orchestrion:${pkg}:${spec.channelName}`;
|
|
198
|
+
if (spec.kind === "async") {
|
|
199
|
+
const asyncSpec = spec;
|
|
200
|
+
const tracingChannel2 = () => isomorph_default.newTracingChannel(
|
|
201
|
+
fullChannelName
|
|
202
|
+
);
|
|
203
|
+
return [
|
|
204
|
+
key,
|
|
205
|
+
{
|
|
206
|
+
...asyncSpec,
|
|
207
|
+
tracingChannel: tracingChannel2,
|
|
208
|
+
tracePromise: (fn, context) => tracingChannel2().tracePromise(
|
|
209
|
+
fn,
|
|
210
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
211
|
+
context
|
|
212
|
+
)
|
|
213
|
+
}
|
|
214
|
+
];
|
|
215
|
+
}
|
|
216
|
+
const syncSpec = spec;
|
|
217
|
+
const tracingChannel = () => isomorph_default.newTracingChannel(
|
|
218
|
+
fullChannelName
|
|
219
|
+
);
|
|
220
|
+
return [
|
|
221
|
+
key,
|
|
222
|
+
{
|
|
223
|
+
...syncSpec,
|
|
224
|
+
tracingChannel,
|
|
225
|
+
traceSync: (fn, context) => tracingChannel().traceSync(
|
|
226
|
+
fn,
|
|
227
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
228
|
+
context
|
|
229
|
+
)
|
|
230
|
+
}
|
|
231
|
+
];
|
|
232
|
+
})
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// src/instrumentation/plugins/openai-channels.ts
|
|
237
|
+
var openAIChannels = defineChannels("openai", {
|
|
238
|
+
chatCompletionsCreate: channel({
|
|
239
|
+
channelName: "chat.completions.create",
|
|
240
|
+
kind: "async"
|
|
241
|
+
}),
|
|
242
|
+
embeddingsCreate: channel({
|
|
243
|
+
channelName: "embeddings.create",
|
|
244
|
+
kind: "async"
|
|
245
|
+
}),
|
|
246
|
+
betaChatCompletionsParse: channel({
|
|
247
|
+
channelName: "beta.chat.completions.parse",
|
|
248
|
+
kind: "async"
|
|
249
|
+
}),
|
|
250
|
+
betaChatCompletionsStream: channel({
|
|
251
|
+
channelName: "beta.chat.completions.stream",
|
|
252
|
+
kind: "sync-stream"
|
|
253
|
+
}),
|
|
254
|
+
moderationsCreate: channel({
|
|
255
|
+
channelName: "moderations.create",
|
|
256
|
+
kind: "async"
|
|
257
|
+
}),
|
|
258
|
+
responsesCreate: channel({
|
|
259
|
+
channelName: "responses.create",
|
|
260
|
+
kind: "async"
|
|
261
|
+
}),
|
|
262
|
+
responsesStream: channel({
|
|
263
|
+
channelName: "responses.stream",
|
|
264
|
+
kind: "sync-stream"
|
|
265
|
+
}),
|
|
266
|
+
responsesParse: channel({
|
|
267
|
+
channelName: "responses.parse",
|
|
268
|
+
kind: "async"
|
|
269
|
+
}),
|
|
270
|
+
responsesCompact: channel({
|
|
271
|
+
channelName: "responses.compact",
|
|
272
|
+
kind: "async"
|
|
273
|
+
})
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
// src/instrumentation/plugins/openai-codex-channels.ts
|
|
277
|
+
var openAICodexChannels = defineChannels("@openai/codex-sdk", {
|
|
278
|
+
run: channel({
|
|
279
|
+
channelName: "Thread.run",
|
|
280
|
+
kind: "async"
|
|
281
|
+
}),
|
|
282
|
+
runStreamed: channel({
|
|
283
|
+
channelName: "Thread.runStreamed",
|
|
284
|
+
kind: "async"
|
|
285
|
+
})
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
// src/instrumentation/plugins/anthropic-channels.ts
|
|
289
|
+
var anthropicChannels = defineChannels("@anthropic-ai/sdk", {
|
|
290
|
+
messagesCreate: channel({
|
|
291
|
+
channelName: "messages.create",
|
|
292
|
+
kind: "async"
|
|
293
|
+
}),
|
|
294
|
+
betaMessagesCreate: channel({
|
|
295
|
+
channelName: "beta.messages.create",
|
|
296
|
+
kind: "async"
|
|
297
|
+
}),
|
|
298
|
+
betaMessagesToolRunner: channel({
|
|
299
|
+
channelName: "beta.messages.toolRunner",
|
|
300
|
+
kind: "sync-stream"
|
|
301
|
+
})
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
// src/instrumentation/plugins/ai-sdk-channels.ts
|
|
305
|
+
var aiSDKChannels = defineChannels("ai", {
|
|
306
|
+
generateText: channel({
|
|
307
|
+
channelName: "generateText",
|
|
308
|
+
kind: "async"
|
|
309
|
+
}),
|
|
310
|
+
streamText: channel({
|
|
311
|
+
channelName: "streamText",
|
|
312
|
+
kind: "async"
|
|
313
|
+
}),
|
|
314
|
+
streamTextSync: channel({
|
|
315
|
+
channelName: "streamText.sync",
|
|
316
|
+
kind: "sync-stream"
|
|
317
|
+
}),
|
|
318
|
+
generateObject: channel({
|
|
319
|
+
channelName: "generateObject",
|
|
320
|
+
kind: "async"
|
|
321
|
+
}),
|
|
322
|
+
streamObject: channel({
|
|
323
|
+
channelName: "streamObject",
|
|
324
|
+
kind: "async"
|
|
325
|
+
}),
|
|
326
|
+
streamObjectSync: channel({
|
|
327
|
+
channelName: "streamObject.sync",
|
|
328
|
+
kind: "sync-stream"
|
|
329
|
+
}),
|
|
330
|
+
embed: channel(
|
|
331
|
+
{
|
|
332
|
+
channelName: "embed",
|
|
333
|
+
kind: "async"
|
|
334
|
+
}
|
|
335
|
+
),
|
|
336
|
+
embedMany: channel({
|
|
337
|
+
channelName: "embedMany",
|
|
338
|
+
kind: "async"
|
|
339
|
+
}),
|
|
340
|
+
rerank: channel({
|
|
341
|
+
channelName: "rerank",
|
|
342
|
+
kind: "async"
|
|
343
|
+
}),
|
|
344
|
+
agentGenerate: channel({
|
|
345
|
+
channelName: "Agent.generate",
|
|
346
|
+
kind: "async"
|
|
347
|
+
}),
|
|
348
|
+
agentStream: channel({
|
|
349
|
+
channelName: "Agent.stream",
|
|
350
|
+
kind: "async"
|
|
351
|
+
}),
|
|
352
|
+
agentStreamSync: channel({
|
|
353
|
+
channelName: "Agent.stream.sync",
|
|
354
|
+
kind: "sync-stream"
|
|
355
|
+
}),
|
|
356
|
+
toolLoopAgentGenerate: channel({
|
|
357
|
+
channelName: "ToolLoopAgent.generate",
|
|
358
|
+
kind: "async"
|
|
359
|
+
}),
|
|
360
|
+
toolLoopAgentStream: channel({
|
|
361
|
+
channelName: "ToolLoopAgent.stream",
|
|
362
|
+
kind: "async"
|
|
363
|
+
})
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
// src/instrumentation/plugins/claude-agent-sdk-channels.ts
|
|
367
|
+
var claudeAgentSDKChannels = defineChannels(
|
|
368
|
+
"@anthropic-ai/claude-agent-sdk",
|
|
369
|
+
{
|
|
370
|
+
query: channel({
|
|
371
|
+
channelName: "query",
|
|
372
|
+
kind: "sync-stream"
|
|
373
|
+
})
|
|
374
|
+
}
|
|
375
|
+
);
|
|
376
|
+
|
|
377
|
+
// src/instrumentation/plugins/cursor-sdk-channels.ts
|
|
378
|
+
var cursorSDKChannels = defineChannels("@cursor/sdk", {
|
|
379
|
+
create: channel({
|
|
380
|
+
channelName: "Agent.create",
|
|
381
|
+
kind: "async"
|
|
382
|
+
}),
|
|
383
|
+
resume: channel({
|
|
384
|
+
channelName: "Agent.resume",
|
|
385
|
+
kind: "async"
|
|
386
|
+
}),
|
|
387
|
+
prompt: channel({
|
|
388
|
+
channelName: "Agent.prompt",
|
|
389
|
+
kind: "async"
|
|
390
|
+
}),
|
|
391
|
+
send: channel({
|
|
392
|
+
channelName: "agent.send",
|
|
393
|
+
kind: "async"
|
|
394
|
+
})
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
// src/instrumentation/plugins/google-genai-channels.ts
|
|
398
|
+
var googleGenAIChannels = defineChannels("@google/genai", {
|
|
399
|
+
generateContent: channel({
|
|
400
|
+
channelName: "models.generateContent",
|
|
401
|
+
kind: "async"
|
|
402
|
+
}),
|
|
403
|
+
generateContentStream: channel({
|
|
404
|
+
channelName: "models.generateContentStream",
|
|
405
|
+
kind: "async"
|
|
406
|
+
}),
|
|
407
|
+
embedContent: channel({
|
|
408
|
+
channelName: "models.embedContent",
|
|
409
|
+
kind: "async"
|
|
410
|
+
})
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
// src/instrumentation/plugins/huggingface-channels.ts
|
|
414
|
+
var huggingFaceChannels = defineChannels("@huggingface/inference", {
|
|
415
|
+
chatCompletion: channel({
|
|
416
|
+
channelName: "chatCompletion",
|
|
417
|
+
kind: "async"
|
|
418
|
+
}),
|
|
419
|
+
chatCompletionStream: channel({
|
|
420
|
+
channelName: "chatCompletionStream",
|
|
421
|
+
kind: "sync-stream"
|
|
422
|
+
}),
|
|
423
|
+
textGeneration: channel({
|
|
424
|
+
channelName: "textGeneration",
|
|
425
|
+
kind: "async"
|
|
426
|
+
}),
|
|
427
|
+
textGenerationStream: channel({
|
|
428
|
+
channelName: "textGenerationStream",
|
|
429
|
+
kind: "sync-stream"
|
|
430
|
+
}),
|
|
431
|
+
featureExtraction: channel({
|
|
432
|
+
channelName: "featureExtraction",
|
|
433
|
+
kind: "async"
|
|
434
|
+
})
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
// src/instrumentation/plugins/openrouter-agent-channels.ts
|
|
438
|
+
var openRouterAgentChannels = defineChannels("@openrouter/agent", {
|
|
439
|
+
callModel: channel({
|
|
440
|
+
channelName: "callModel",
|
|
441
|
+
kind: "sync-stream"
|
|
442
|
+
}),
|
|
443
|
+
callModelTurn: channel({
|
|
444
|
+
channelName: "callModel.turn",
|
|
445
|
+
kind: "async"
|
|
446
|
+
}),
|
|
447
|
+
toolExecute: channel({
|
|
448
|
+
channelName: "tool.execute",
|
|
449
|
+
kind: "async"
|
|
450
|
+
})
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
// src/instrumentation/plugins/openrouter-channels.ts
|
|
454
|
+
var openRouterChannels = defineChannels("@openrouter/sdk", {
|
|
455
|
+
chatSend: channel({
|
|
456
|
+
channelName: "chat.send",
|
|
457
|
+
kind: "async"
|
|
458
|
+
}),
|
|
459
|
+
embeddingsGenerate: channel({
|
|
460
|
+
channelName: "embeddings.generate",
|
|
461
|
+
kind: "async"
|
|
462
|
+
}),
|
|
463
|
+
rerankRerank: channel(
|
|
464
|
+
{
|
|
465
|
+
channelName: "rerank.rerank",
|
|
466
|
+
kind: "async"
|
|
467
|
+
}
|
|
468
|
+
),
|
|
469
|
+
betaResponsesSend: channel({
|
|
470
|
+
channelName: "beta.responses.send",
|
|
471
|
+
kind: "async"
|
|
472
|
+
}),
|
|
473
|
+
callModel: channel({
|
|
474
|
+
channelName: "callModel",
|
|
475
|
+
kind: "sync-stream"
|
|
476
|
+
}),
|
|
477
|
+
callModelTurn: channel({
|
|
478
|
+
channelName: "callModel.turn",
|
|
479
|
+
kind: "async"
|
|
480
|
+
}),
|
|
481
|
+
toolExecute: channel({
|
|
482
|
+
channelName: "tool.execute",
|
|
483
|
+
kind: "async"
|
|
484
|
+
})
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
// src/instrumentation/plugins/mistral-channels.ts
|
|
488
|
+
var mistralChannels = defineChannels("@mistralai/mistralai", {
|
|
489
|
+
chatComplete: channel({
|
|
490
|
+
channelName: "chat.complete",
|
|
491
|
+
kind: "async"
|
|
492
|
+
}),
|
|
493
|
+
chatStream: channel({
|
|
494
|
+
channelName: "chat.stream",
|
|
495
|
+
kind: "async"
|
|
496
|
+
}),
|
|
497
|
+
embeddingsCreate: channel({
|
|
498
|
+
channelName: "embeddings.create",
|
|
499
|
+
kind: "async"
|
|
500
|
+
}),
|
|
501
|
+
classifiersModerate: channel({
|
|
502
|
+
channelName: "classifiers.moderate",
|
|
503
|
+
kind: "async"
|
|
504
|
+
}),
|
|
505
|
+
classifiersModerateChat: channel({
|
|
506
|
+
channelName: "classifiers.moderateChat",
|
|
507
|
+
kind: "async"
|
|
508
|
+
}),
|
|
509
|
+
classifiersClassify: channel({
|
|
510
|
+
channelName: "classifiers.classify",
|
|
511
|
+
kind: "async"
|
|
512
|
+
}),
|
|
513
|
+
classifiersClassifyChat: channel({
|
|
514
|
+
channelName: "classifiers.classifyChat",
|
|
515
|
+
kind: "async"
|
|
516
|
+
}),
|
|
517
|
+
fimComplete: channel({
|
|
518
|
+
channelName: "fim.complete",
|
|
519
|
+
kind: "async"
|
|
520
|
+
}),
|
|
521
|
+
fimStream: channel({
|
|
522
|
+
channelName: "fim.stream",
|
|
523
|
+
kind: "async"
|
|
524
|
+
}),
|
|
525
|
+
agentsComplete: channel({
|
|
526
|
+
channelName: "agents.complete",
|
|
527
|
+
kind: "async"
|
|
528
|
+
}),
|
|
529
|
+
agentsStream: channel({
|
|
530
|
+
channelName: "agents.stream",
|
|
531
|
+
kind: "async"
|
|
532
|
+
})
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
// src/instrumentation/plugins/google-adk-channels.ts
|
|
536
|
+
var googleADKChannels = defineChannels("@google/adk", {
|
|
537
|
+
runnerRunAsync: channel({
|
|
538
|
+
channelName: "runner.runAsync",
|
|
539
|
+
kind: "sync-stream"
|
|
540
|
+
}),
|
|
541
|
+
agentRunAsync: channel({
|
|
542
|
+
channelName: "agent.runAsync",
|
|
543
|
+
kind: "sync-stream"
|
|
544
|
+
}),
|
|
545
|
+
toolRunAsync: channel({
|
|
546
|
+
channelName: "tool.runAsync",
|
|
547
|
+
kind: "async"
|
|
548
|
+
})
|
|
549
|
+
});
|
|
550
|
+
|
|
551
|
+
// src/instrumentation/plugins/cohere-channels.ts
|
|
552
|
+
var cohereChannels = defineChannels("cohere-ai", {
|
|
553
|
+
chat: channel({
|
|
554
|
+
channelName: "chat",
|
|
555
|
+
kind: "async"
|
|
556
|
+
}),
|
|
557
|
+
chatStream: channel({
|
|
558
|
+
channelName: "chatStream",
|
|
559
|
+
kind: "async"
|
|
560
|
+
}),
|
|
561
|
+
embed: channel({
|
|
562
|
+
channelName: "embed",
|
|
563
|
+
kind: "async"
|
|
564
|
+
}),
|
|
565
|
+
rerank: channel({
|
|
566
|
+
channelName: "rerank",
|
|
567
|
+
kind: "async"
|
|
568
|
+
})
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
// src/instrumentation/plugins/groq-channels.ts
|
|
572
|
+
var groqChannels = defineChannels("groq-sdk", {
|
|
573
|
+
chatCompletionsCreate: channel({
|
|
574
|
+
channelName: "chat.completions.create",
|
|
575
|
+
kind: "async"
|
|
576
|
+
}),
|
|
577
|
+
embeddingsCreate: channel(
|
|
578
|
+
{
|
|
579
|
+
channelName: "embeddings.create",
|
|
580
|
+
kind: "async"
|
|
581
|
+
}
|
|
582
|
+
)
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
// src/instrumentation/plugins/genkit-channels.ts
|
|
586
|
+
var genkitChannels = defineChannels("@genkit-ai/ai", {
|
|
587
|
+
generate: channel({
|
|
588
|
+
channelName: "generate",
|
|
589
|
+
kind: "async"
|
|
590
|
+
}),
|
|
591
|
+
generateStream: channel({
|
|
592
|
+
channelName: "generateStream",
|
|
593
|
+
kind: "sync-stream"
|
|
594
|
+
}),
|
|
595
|
+
embed: channel({
|
|
596
|
+
channelName: "embed",
|
|
597
|
+
kind: "async"
|
|
598
|
+
}),
|
|
599
|
+
embedMany: channel({
|
|
600
|
+
channelName: "embedMany",
|
|
601
|
+
kind: "async"
|
|
602
|
+
}),
|
|
603
|
+
actionRun: channel({
|
|
604
|
+
channelName: "action.run",
|
|
605
|
+
kind: "async"
|
|
606
|
+
}),
|
|
607
|
+
actionStream: channel({
|
|
608
|
+
channelName: "action.stream",
|
|
609
|
+
kind: "sync-stream"
|
|
610
|
+
})
|
|
611
|
+
});
|
|
612
|
+
var genkitCoreChannels = defineChannels("@genkit-ai/core", {
|
|
613
|
+
actionSpan: channel({
|
|
614
|
+
channelName: "action.span",
|
|
615
|
+
kind: "async"
|
|
616
|
+
})
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
// src/instrumentation/plugins/github-copilot-channels.ts
|
|
620
|
+
var gitHubCopilotChannels = defineChannels("@github/copilot-sdk", {
|
|
621
|
+
createSession: channel({
|
|
622
|
+
channelName: "client.createSession",
|
|
623
|
+
kind: "async"
|
|
624
|
+
}),
|
|
625
|
+
resumeSession: channel({
|
|
626
|
+
channelName: "client.resumeSession",
|
|
627
|
+
kind: "async"
|
|
628
|
+
}),
|
|
629
|
+
sendAndWait: channel({
|
|
630
|
+
channelName: "session.sendAndWait",
|
|
631
|
+
kind: "async"
|
|
632
|
+
})
|
|
633
|
+
});
|
|
634
|
+
|
|
635
|
+
// src/instrumentation/plugins/flue-channels.ts
|
|
636
|
+
var flueChannels = defineChannels("@flue/runtime", {
|
|
637
|
+
createContext: channel({
|
|
638
|
+
channelName: "createFlueContext",
|
|
639
|
+
kind: "sync-stream"
|
|
640
|
+
}),
|
|
641
|
+
openSession: channel({
|
|
642
|
+
channelName: "Harness.openSession",
|
|
643
|
+
kind: "async"
|
|
644
|
+
}),
|
|
645
|
+
contextEvent: channel({
|
|
646
|
+
channelName: "context.event",
|
|
647
|
+
kind: "sync-stream"
|
|
648
|
+
}),
|
|
649
|
+
prompt: channel({
|
|
650
|
+
channelName: "session.prompt",
|
|
651
|
+
kind: "async"
|
|
652
|
+
}),
|
|
653
|
+
skill: channel({
|
|
654
|
+
channelName: "session.skill",
|
|
655
|
+
kind: "async"
|
|
656
|
+
}),
|
|
657
|
+
task: channel({
|
|
658
|
+
channelName: "session.task",
|
|
659
|
+
kind: "async"
|
|
660
|
+
}),
|
|
661
|
+
compact: channel({
|
|
662
|
+
channelName: "session.compact",
|
|
663
|
+
kind: "async"
|
|
664
|
+
})
|
|
665
|
+
});
|
|
666
|
+
|
|
667
|
+
// src/instrumentation/config.ts
|
|
668
|
+
var envIntegrationAliases = {
|
|
669
|
+
openai: "openai",
|
|
670
|
+
"openai-codex": "openaiCodexSDK",
|
|
671
|
+
"openai-codex-sdk": "openaiCodexSDK",
|
|
672
|
+
openaicodexsdk: "openaiCodexSDK",
|
|
673
|
+
codex: "openaiCodexSDK",
|
|
674
|
+
"codex-sdk": "openaiCodexSDK",
|
|
675
|
+
anthropic: "anthropic",
|
|
676
|
+
aisdk: "aisdk",
|
|
677
|
+
"ai-sdk": "aisdk",
|
|
678
|
+
"vercel-ai": "aisdk",
|
|
679
|
+
vercel: "vercel",
|
|
680
|
+
claudeagentsdk: "claudeAgentSDK",
|
|
681
|
+
"claude-agent-sdk": "claudeAgentSDK",
|
|
682
|
+
cursor: "cursor",
|
|
683
|
+
"cursor-sdk": "cursorSDK",
|
|
684
|
+
cursorsdk: "cursorSDK",
|
|
685
|
+
flue: "flue",
|
|
686
|
+
"flue-runtime": "flue",
|
|
687
|
+
"openai-agents": "openAIAgents",
|
|
688
|
+
openaiagents: "openAIAgents",
|
|
689
|
+
"openai-agents-core": "openAIAgents",
|
|
690
|
+
openaiagentscore: "openAIAgents",
|
|
691
|
+
google: "google",
|
|
692
|
+
"google-genai": "googleGenAI",
|
|
693
|
+
googlegenai: "googleGenAI",
|
|
694
|
+
huggingface: "huggingface",
|
|
695
|
+
openrouter: "openrouter",
|
|
696
|
+
openrouteragent: "openrouterAgent",
|
|
697
|
+
"openrouter-agent": "openrouterAgent",
|
|
698
|
+
mistral: "mistral",
|
|
699
|
+
googleadk: "googleADK",
|
|
700
|
+
"google-adk": "googleADK",
|
|
701
|
+
cohere: "cohere",
|
|
702
|
+
groq: "groq",
|
|
703
|
+
"groq-sdk": "groq",
|
|
704
|
+
genkit: "genkit",
|
|
705
|
+
"firebase-genkit": "genkit",
|
|
706
|
+
githubcopilot: "gitHubCopilot",
|
|
707
|
+
"github-copilot": "gitHubCopilot",
|
|
708
|
+
"copilot-sdk": "gitHubCopilot",
|
|
709
|
+
langchain: "langchain",
|
|
710
|
+
"langchain-js": "langchain",
|
|
711
|
+
"@langchain": "langchain",
|
|
712
|
+
langgraph: "langgraph"
|
|
713
|
+
};
|
|
714
|
+
function getDefaultInstrumentationIntegrations() {
|
|
715
|
+
return {
|
|
716
|
+
openai: true,
|
|
717
|
+
openaiCodexSDK: true,
|
|
718
|
+
anthropic: true,
|
|
719
|
+
vercel: true,
|
|
720
|
+
aisdk: true,
|
|
721
|
+
google: true,
|
|
722
|
+
googleGenAI: true,
|
|
723
|
+
googleADK: true,
|
|
724
|
+
huggingface: true,
|
|
725
|
+
claudeAgentSDK: true,
|
|
726
|
+
cursor: true,
|
|
727
|
+
cursorSDK: true,
|
|
728
|
+
flue: true,
|
|
729
|
+
openAIAgents: true,
|
|
730
|
+
openrouter: true,
|
|
731
|
+
openrouterAgent: true,
|
|
732
|
+
mistral: true,
|
|
733
|
+
cohere: true,
|
|
734
|
+
groq: true,
|
|
735
|
+
genkit: true,
|
|
736
|
+
gitHubCopilot: true,
|
|
737
|
+
langchain: true,
|
|
738
|
+
langgraph: true
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
function readDisabledInstrumentationEnvConfig(disabledList) {
|
|
742
|
+
const integrations = {};
|
|
743
|
+
if (disabledList) {
|
|
744
|
+
for (const value of disabledList.split(",")) {
|
|
745
|
+
const sdk = value.trim().toLowerCase();
|
|
746
|
+
if (sdk.length > 0) {
|
|
747
|
+
integrations[envIntegrationAliases[sdk] ?? sdk] = false;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
return { integrations };
|
|
752
|
+
}
|
|
753
|
+
function isInstrumentationIntegrationDisabled(integrations, ...names) {
|
|
754
|
+
return names.some((name) => integrations?.[name] === false);
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
// src/instrumentation/plugins/openai-agents-channels.ts
|
|
758
|
+
var openAIAgentsCoreChannels = defineChannels("@openai/agents-core", {
|
|
759
|
+
onTraceStart: channel({
|
|
760
|
+
channelName: "tracing.processor.onTraceStart",
|
|
761
|
+
kind: "async"
|
|
762
|
+
}),
|
|
763
|
+
onTraceEnd: channel({
|
|
764
|
+
channelName: "tracing.processor.onTraceEnd",
|
|
765
|
+
kind: "async"
|
|
766
|
+
}),
|
|
767
|
+
onSpanStart: channel({
|
|
768
|
+
channelName: "tracing.processor.onSpanStart",
|
|
769
|
+
kind: "async"
|
|
770
|
+
}),
|
|
771
|
+
onSpanEnd: channel({
|
|
772
|
+
channelName: "tracing.processor.onSpanEnd",
|
|
773
|
+
kind: "async"
|
|
774
|
+
})
|
|
775
|
+
});
|
|
776
|
+
|
|
777
|
+
// src/instrumentation/plugins/langchain-channels.ts
|
|
778
|
+
var langChainChannels = defineChannels("@langchain/core", {
|
|
779
|
+
configure: channel({
|
|
780
|
+
channelName: "CallbackManager.configure",
|
|
781
|
+
kind: "sync-stream"
|
|
782
|
+
}),
|
|
783
|
+
configureSync: channel({
|
|
784
|
+
channelName: "CallbackManager._configureSync",
|
|
785
|
+
kind: "sync-stream"
|
|
786
|
+
})
|
|
787
|
+
});
|
|
788
|
+
|
|
789
|
+
export {
|
|
790
|
+
__export,
|
|
791
|
+
patchTracingChannel,
|
|
792
|
+
isomorph_default,
|
|
793
|
+
openAIChannels,
|
|
794
|
+
openAICodexChannels,
|
|
795
|
+
anthropicChannels,
|
|
796
|
+
aiSDKChannels,
|
|
797
|
+
claudeAgentSDKChannels,
|
|
798
|
+
cursorSDKChannels,
|
|
799
|
+
openAIAgentsCoreChannels,
|
|
800
|
+
googleGenAIChannels,
|
|
801
|
+
huggingFaceChannels,
|
|
802
|
+
openRouterAgentChannels,
|
|
803
|
+
openRouterChannels,
|
|
804
|
+
mistralChannels,
|
|
805
|
+
googleADKChannels,
|
|
806
|
+
cohereChannels,
|
|
807
|
+
groqChannels,
|
|
808
|
+
genkitChannels,
|
|
809
|
+
genkitCoreChannels,
|
|
810
|
+
gitHubCopilotChannels,
|
|
811
|
+
flueChannels,
|
|
812
|
+
langChainChannels,
|
|
813
|
+
getDefaultInstrumentationIntegrations,
|
|
814
|
+
readDisabledInstrumentationEnvConfig,
|
|
815
|
+
isInstrumentationIntegrationDisabled
|
|
816
|
+
};
|