braintrust 3.26.0 → 3.27.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.js +2440 -1067
- package/dev/dist/index.mjs +1644 -271
- package/dist/apply-auto-instrumentation.js +320 -261
- package/dist/apply-auto-instrumentation.mjs +118 -59
- package/dist/auto-instrumentations/bundler/esbuild.cjs +377 -59
- package/dist/auto-instrumentations/bundler/esbuild.mjs +5 -4
- package/dist/auto-instrumentations/bundler/next.cjs +379 -61
- package/dist/auto-instrumentations/bundler/next.mjs +6 -5
- package/dist/auto-instrumentations/bundler/rollup.cjs +377 -59
- package/dist/auto-instrumentations/bundler/rollup.mjs +5 -4
- package/dist/auto-instrumentations/bundler/vite.cjs +406 -60
- package/dist/auto-instrumentations/bundler/vite.mjs +34 -5
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +363 -59
- package/dist/auto-instrumentations/bundler/webpack.cjs +377 -59
- package/dist/auto-instrumentations/bundler/webpack.mjs +6 -5
- package/dist/auto-instrumentations/{chunk-AKKPLXTP.mjs → chunk-2AMDGD65.mjs} +160 -57
- package/dist/auto-instrumentations/{chunk-V5LEODRX.mjs → chunk-BW33ULMW.mjs} +1 -1
- package/dist/auto-instrumentations/{chunk-XYN63IG5.mjs → chunk-I55G56ZL.mjs} +21 -58
- package/dist/auto-instrumentations/{chunk-NRE4QUQR.mjs → chunk-JPUFNW7X.mjs} +140 -0
- package/dist/auto-instrumentations/{chunk-6E22MYSW.mjs → chunk-XEYKUBLY.mjs} +30 -4
- package/dist/auto-instrumentations/{chunk-XZHHE4Y3.mjs → chunk-ZNHTSSGI.mjs} +155 -2
- package/dist/auto-instrumentations/hook.mjs +161 -3
- package/dist/auto-instrumentations/index.cjs +296 -1
- package/dist/auto-instrumentations/index.d.mts +5 -1
- package/dist/auto-instrumentations/index.d.ts +5 -1
- package/dist/auto-instrumentations/index.mjs +6 -2
- package/dist/auto-instrumentations/loader/cjs-patch.cjs +105 -57
- package/dist/auto-instrumentations/loader/cjs-patch.mjs +2 -2
- package/dist/auto-instrumentations/loader/esm-hook.mjs +1 -1
- package/dist/browser.d.mts +57 -5
- package/dist/browser.d.ts +57 -5
- package/dist/browser.js +1855 -285
- package/dist/browser.mjs +1855 -285
- package/dist/{chunk-PN7EWK66.mjs → chunk-CZM5JIQL.mjs} +209 -1
- package/dist/{chunk-VYNNEKSA.js → chunk-MF7NU6BT.js} +216 -8
- package/dist/{chunk-VRZZQPAA.js → chunk-QRHGVBKU.js} +2403 -1220
- package/dist/{chunk-XIZOM2HO.mjs → chunk-YKD22IMR.mjs} +1454 -271
- package/dist/cli.js +1645 -272
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +1855 -285
- package/dist/edge-light.mjs +1855 -285
- package/dist/index.d.mts +57 -5
- package/dist/index.d.ts +57 -5
- package/dist/index.js +600 -413
- package/dist/index.mjs +201 -14
- package/dist/instrumentation/index.d.mts +8 -0
- package/dist/instrumentation/index.d.ts +8 -0
- package/dist/instrumentation/index.js +1839 -466
- package/dist/instrumentation/index.mjs +1839 -466
- package/dist/vitest-evals-reporter.js +45 -43
- package/dist/vitest-evals-reporter.mjs +5 -3
- package/dist/workerd.d.mts +1 -1
- package/dist/workerd.d.ts +1 -1
- package/dist/workerd.js +1855 -285
- package/dist/workerd.mjs +1855 -285
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
claudeAgentSDKConfigs,
|
|
8
8
|
cloudflareAIChatConfigs,
|
|
9
9
|
cloudflareAgentsConfigs,
|
|
10
|
+
cloudflareThinkConfigs,
|
|
10
11
|
cohereConfigs,
|
|
11
12
|
cursorSDKConfigs,
|
|
12
13
|
defineChannels,
|
|
@@ -19,21 +20,25 @@ import {
|
|
|
19
20
|
langSmithConfigs,
|
|
20
21
|
langchainConfigs,
|
|
21
22
|
mistralConfigs,
|
|
23
|
+
ollamaConfigs,
|
|
22
24
|
openAIAgentsCoreConfigs,
|
|
23
25
|
openAICodexConfigs,
|
|
24
26
|
openRouterAgentConfigs,
|
|
25
27
|
openRouterConfigs,
|
|
26
28
|
openaiConfigs,
|
|
27
29
|
piCodingAgentConfigs
|
|
28
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-ZNHTSSGI.mjs";
|
|
29
31
|
import {
|
|
30
32
|
applySpecialCasePatch,
|
|
31
33
|
create
|
|
32
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-I55G56ZL.mjs";
|
|
35
|
+
import {
|
|
36
|
+
getPackageName
|
|
37
|
+
} from "./chunk-P5YLNB2A.mjs";
|
|
33
38
|
|
|
34
39
|
// src/auto-instrumentations/bundler/plugin.ts
|
|
35
40
|
import { createUnplugin } from "unplugin";
|
|
36
|
-
import { extname, join, sep } from "path";
|
|
41
|
+
import { extname, isAbsolute, join, sep } from "path";
|
|
37
42
|
import { readFileSync } from "fs";
|
|
38
43
|
import { fileURLToPath } from "url";
|
|
39
44
|
import moduleDetailsFromPath from "module-details-from-path";
|
|
@@ -68,6 +73,7 @@ var envIntegrationAliases = {
|
|
|
68
73
|
cloudflareaichat: "cloudflareAIChat",
|
|
69
74
|
"cloudflare-ai-chat": "cloudflareAIChat",
|
|
70
75
|
"@cloudflare/ai-chat": "cloudflareAIChat",
|
|
76
|
+
cloudflarethink: "cloudflareThink",
|
|
71
77
|
cursor: "cursor",
|
|
72
78
|
"cursor-sdk": "cursorSDK",
|
|
73
79
|
cursorsdk: "cursorSDK",
|
|
@@ -88,6 +94,7 @@ var envIntegrationAliases = {
|
|
|
88
94
|
openrouteragent: "openrouterAgent",
|
|
89
95
|
"openrouter-agent": "openrouterAgent",
|
|
90
96
|
mistral: "mistral",
|
|
97
|
+
ollama: "ollama",
|
|
91
98
|
googleadk: "googleADK",
|
|
92
99
|
"google-adk": "googleADK",
|
|
93
100
|
cohere: "cohere",
|
|
@@ -325,6 +332,10 @@ var defaultInstrumentationConfigGroups = [
|
|
|
325
332
|
integrations: ["cloudflareAgents"],
|
|
326
333
|
configs: cloudflareAgentsConfigs
|
|
327
334
|
},
|
|
335
|
+
{
|
|
336
|
+
integrations: ["cloudflareThink"],
|
|
337
|
+
configs: cloudflareThinkConfigs
|
|
338
|
+
},
|
|
328
339
|
{ integrations: ["cursor", "cursorSDK"], configs: cursorSDKConfigs },
|
|
329
340
|
{
|
|
330
341
|
integrations: ["openAIAgents"],
|
|
@@ -349,6 +360,7 @@ var defaultInstrumentationConfigGroups = [
|
|
|
349
360
|
configs: openRouterAgentConfigs
|
|
350
361
|
},
|
|
351
362
|
{ integrations: ["mistral"], configs: mistralConfigs },
|
|
363
|
+
{ integrations: ["ollama"], configs: ollamaConfigs },
|
|
352
364
|
{ integrations: ["googleADK"], configs: googleADKConfigs },
|
|
353
365
|
{ integrations: ["cohere"], configs: cohereConfigs },
|
|
354
366
|
{ integrations: ["groq"], configs: groqConfigs },
|
|
@@ -417,6 +429,20 @@ var unplugin = createUnplugin((options = {}) => {
|
|
|
417
429
|
return {
|
|
418
430
|
name: "code-transformer",
|
|
419
431
|
enforce: "pre",
|
|
432
|
+
transformInclude(id) {
|
|
433
|
+
const pathWithoutQuery = id.split("?", 1)[0];
|
|
434
|
+
if (!pathWithoutQuery) {
|
|
435
|
+
return false;
|
|
436
|
+
}
|
|
437
|
+
if (pathWithoutQuery.startsWith("file:")) {
|
|
438
|
+
try {
|
|
439
|
+
return isAbsolute(fileURLToPath(pathWithoutQuery));
|
|
440
|
+
} catch {
|
|
441
|
+
return false;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
return isAbsolute(pathWithoutQuery);
|
|
445
|
+
},
|
|
420
446
|
transform(code, id) {
|
|
421
447
|
if (!id) {
|
|
422
448
|
return null;
|
|
@@ -433,7 +459,7 @@ var unplugin = createUnplugin((options = {}) => {
|
|
|
433
459
|
if (!moduleDetails) {
|
|
434
460
|
return null;
|
|
435
461
|
}
|
|
436
|
-
const moduleName = moduleDetails.name;
|
|
462
|
+
const moduleName = getPackageName(moduleDetails.basedir) ?? moduleDetails.name;
|
|
437
463
|
const normalizedModulePath = moduleDetails.path.replace(/\\/g, "/");
|
|
438
464
|
const moduleVersion = getModuleVersion(moduleDetails.basedir);
|
|
439
465
|
const patched = applySpecialCasePatch({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
newGlobalTracingChannel
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JPUFNW7X.mjs";
|
|
4
4
|
|
|
5
5
|
// src/isomorph.ts
|
|
6
6
|
var DefaultAsyncLocalStorage = class {
|
|
@@ -48,11 +48,21 @@ function defineChannels(pkg, channels, options) {
|
|
|
48
48
|
const tracingChannel2 = () => isomorph_default.newTracingChannel(
|
|
49
49
|
fullChannelName
|
|
50
50
|
);
|
|
51
|
+
const intercept2 = (interceptor) => {
|
|
52
|
+
const hook = tracingChannel2();
|
|
53
|
+
return typeof hook.intercept === "function" ? hook.intercept(interceptor) : () => {
|
|
54
|
+
};
|
|
55
|
+
};
|
|
51
56
|
return [
|
|
52
57
|
key,
|
|
53
58
|
{
|
|
54
59
|
...asyncSpec,
|
|
55
60
|
instrumentationName,
|
|
61
|
+
intercept: intercept2,
|
|
62
|
+
invoke: (target, thisArg, args, additional) => {
|
|
63
|
+
const hook = tracingChannel2();
|
|
64
|
+
return typeof hook.invoke === "function" ? hook.invoke(target, thisArg, args, additional) : Reflect.apply(target, thisArg, args);
|
|
65
|
+
},
|
|
56
66
|
tracingChannel: tracingChannel2,
|
|
57
67
|
tracePromise: (fn, context) => tracingChannel2().tracePromise(
|
|
58
68
|
fn,
|
|
@@ -66,11 +76,21 @@ function defineChannels(pkg, channels, options) {
|
|
|
66
76
|
const tracingChannel = () => isomorph_default.newTracingChannel(
|
|
67
77
|
fullChannelName
|
|
68
78
|
);
|
|
79
|
+
const intercept = (interceptor) => {
|
|
80
|
+
const hook = tracingChannel();
|
|
81
|
+
return typeof hook.intercept === "function" ? hook.intercept(interceptor) : () => {
|
|
82
|
+
};
|
|
83
|
+
};
|
|
69
84
|
return [
|
|
70
85
|
key,
|
|
71
86
|
{
|
|
72
87
|
...syncSpec,
|
|
73
88
|
instrumentationName,
|
|
89
|
+
intercept,
|
|
90
|
+
invoke: (target, thisArg, args, additional) => {
|
|
91
|
+
const hook = tracingChannel();
|
|
92
|
+
return typeof hook.invoke === "function" ? hook.invoke(target, thisArg, args, additional) : Reflect.apply(target, thisArg, args);
|
|
93
|
+
},
|
|
74
94
|
tracingChannel,
|
|
75
95
|
traceSync: (fn, context) => tracingChannel().traceSync(
|
|
76
96
|
fn,
|
|
@@ -92,6 +112,7 @@ var INSTRUMENTATION_NAMES = {
|
|
|
92
112
|
CLAUDE_AGENT_SDK: "claude-agent-sdk",
|
|
93
113
|
CLOUDFLARE_AI_CHAT: "cloudflare-ai-chat",
|
|
94
114
|
CLOUDFLARE_AGENTS: "cloudflare-agents",
|
|
115
|
+
CLOUDFLARE_THINK: "cloudflare-think",
|
|
95
116
|
COHERE: "cohere",
|
|
96
117
|
CURSOR_SDK: "cursor-sdk",
|
|
97
118
|
EVE: "eve",
|
|
@@ -106,6 +127,7 @@ var INSTRUMENTATION_NAMES = {
|
|
|
106
127
|
LANGSMITH: "langsmith",
|
|
107
128
|
MASTRA: "mastra",
|
|
108
129
|
MISTRAL: "mistral",
|
|
130
|
+
OLLAMA: "ollama",
|
|
109
131
|
OPENAI: "openai",
|
|
110
132
|
OPENAI_AGENTS: "openai-agents",
|
|
111
133
|
OPENAI_CODEX: "openai-codex",
|
|
@@ -400,6 +422,14 @@ var anthropicChannels = defineChannels(
|
|
|
400
422
|
betaMessagesToolRunner: channel({
|
|
401
423
|
channelName: "beta.messages.toolRunner",
|
|
402
424
|
kind: "sync-stream"
|
|
425
|
+
}),
|
|
426
|
+
betaSessionsEventsStream: channel({
|
|
427
|
+
channelName: "beta.sessions.events.stream",
|
|
428
|
+
kind: "async"
|
|
429
|
+
}),
|
|
430
|
+
betaSessionsThreadsEventsStream: channel({
|
|
431
|
+
channelName: "beta.sessions.threads.events.stream",
|
|
432
|
+
kind: "async"
|
|
403
433
|
})
|
|
404
434
|
},
|
|
405
435
|
{ instrumentationName: INSTRUMENTATION_NAMES.ANTHROPIC }
|
|
@@ -518,7 +548,40 @@ var anthropicConfigs = [
|
|
|
518
548
|
methodName: "toolRunner",
|
|
519
549
|
kind: "Sync"
|
|
520
550
|
}
|
|
521
|
-
}
|
|
551
|
+
},
|
|
552
|
+
// Managed Agents Sessions event streams are discovered automatically, but
|
|
553
|
+
// remain passive until the user calls collectAnthropicSession() on the
|
|
554
|
+
// returned stream.
|
|
555
|
+
...["mjs", "js"].map(
|
|
556
|
+
(extension) => ({
|
|
557
|
+
channelName: anthropicChannels.betaSessionsEventsStream.channelName,
|
|
558
|
+
module: {
|
|
559
|
+
name: "@anthropic-ai/sdk",
|
|
560
|
+
versionRange: ">=0.86.0",
|
|
561
|
+
filePath: `resources/beta/sessions/events.${extension}`
|
|
562
|
+
},
|
|
563
|
+
functionQuery: {
|
|
564
|
+
className: "Events",
|
|
565
|
+
methodName: "stream",
|
|
566
|
+
kind: "Async"
|
|
567
|
+
}
|
|
568
|
+
})
|
|
569
|
+
),
|
|
570
|
+
...["mjs", "js"].map(
|
|
571
|
+
(extension) => ({
|
|
572
|
+
channelName: anthropicChannels.betaSessionsThreadsEventsStream.channelName,
|
|
573
|
+
module: {
|
|
574
|
+
name: "@anthropic-ai/sdk",
|
|
575
|
+
versionRange: ">=0.86.0",
|
|
576
|
+
filePath: `resources/beta/sessions/threads/events.${extension}`
|
|
577
|
+
},
|
|
578
|
+
functionQuery: {
|
|
579
|
+
className: "Events",
|
|
580
|
+
methodName: "stream",
|
|
581
|
+
kind: "Async"
|
|
582
|
+
}
|
|
583
|
+
})
|
|
584
|
+
)
|
|
522
585
|
];
|
|
523
586
|
|
|
524
587
|
// src/instrumentation/plugins/bedrock-runtime-channels.ts
|
|
@@ -1169,6 +1232,36 @@ var cloudflareAgentsConfigs = [
|
|
|
1169
1232
|
}
|
|
1170
1233
|
];
|
|
1171
1234
|
|
|
1235
|
+
// src/instrumentation/plugins/cloudflare-think-channels.ts
|
|
1236
|
+
var cloudflareThinkChannels = defineChannels(
|
|
1237
|
+
"@cloudflare/think",
|
|
1238
|
+
{
|
|
1239
|
+
runInferenceLoop: channel({
|
|
1240
|
+
channelName: "Think.runInferenceLoop",
|
|
1241
|
+
kind: "async"
|
|
1242
|
+
})
|
|
1243
|
+
},
|
|
1244
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.CLOUDFLARE_THINK }
|
|
1245
|
+
);
|
|
1246
|
+
|
|
1247
|
+
// src/auto-instrumentations/configs/cloudflare-think.ts
|
|
1248
|
+
var cloudflareThinkVersionRange = ">=0.13.0 <0.14.0";
|
|
1249
|
+
var cloudflareThinkConfigs = [
|
|
1250
|
+
{
|
|
1251
|
+
channelName: cloudflareThinkChannels.runInferenceLoop.channelName,
|
|
1252
|
+
module: {
|
|
1253
|
+
name: "@cloudflare/think",
|
|
1254
|
+
versionRange: cloudflareThinkVersionRange,
|
|
1255
|
+
filePath: "dist/think.js"
|
|
1256
|
+
},
|
|
1257
|
+
functionQuery: {
|
|
1258
|
+
className: "Think",
|
|
1259
|
+
methodName: "_runInferenceLoop",
|
|
1260
|
+
kind: "Async"
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
];
|
|
1264
|
+
|
|
1172
1265
|
// src/instrumentation/plugins/cursor-sdk-channels.ts
|
|
1173
1266
|
var cursorSDKChannels = defineChannels(
|
|
1174
1267
|
"@cursor/sdk",
|
|
@@ -1786,6 +1879,19 @@ var openRouterConfigs = [
|
|
|
1786
1879
|
kind: "Async"
|
|
1787
1880
|
}
|
|
1788
1881
|
},
|
|
1882
|
+
{
|
|
1883
|
+
channelName: openRouterChannels.betaResponsesSend.channelName,
|
|
1884
|
+
module: {
|
|
1885
|
+
name: "@openrouter/sdk",
|
|
1886
|
+
versionRange: ">=1.1.2 <2.0.0",
|
|
1887
|
+
filePath: "esm/sdk/betaresponses.js"
|
|
1888
|
+
},
|
|
1889
|
+
functionQuery: {
|
|
1890
|
+
className: "BetaResponses",
|
|
1891
|
+
methodName: "send",
|
|
1892
|
+
kind: "Async"
|
|
1893
|
+
}
|
|
1894
|
+
},
|
|
1789
1895
|
{
|
|
1790
1896
|
channelName: openRouterChannels.callModel.channelName,
|
|
1791
1897
|
module: {
|
|
@@ -2143,6 +2249,51 @@ var mistralConfigs = [
|
|
|
2143
2249
|
}
|
|
2144
2250
|
];
|
|
2145
2251
|
|
|
2252
|
+
// src/instrumentation/plugins/ollama-channels.ts
|
|
2253
|
+
var ollamaChannels = defineChannels(
|
|
2254
|
+
"ollama",
|
|
2255
|
+
{
|
|
2256
|
+
chat: channel({
|
|
2257
|
+
channelName: "chat",
|
|
2258
|
+
kind: "async"
|
|
2259
|
+
}),
|
|
2260
|
+
generate: channel({
|
|
2261
|
+
channelName: "generate",
|
|
2262
|
+
kind: "async"
|
|
2263
|
+
}),
|
|
2264
|
+
embed: channel({
|
|
2265
|
+
channelName: "embed",
|
|
2266
|
+
kind: "async"
|
|
2267
|
+
})
|
|
2268
|
+
},
|
|
2269
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.OLLAMA }
|
|
2270
|
+
);
|
|
2271
|
+
|
|
2272
|
+
// src/auto-instrumentations/configs/ollama.ts
|
|
2273
|
+
var methods = [
|
|
2274
|
+
["chat", ollamaChannels.chat.channelName],
|
|
2275
|
+
["generate", ollamaChannels.generate.channelName],
|
|
2276
|
+
["embed", ollamaChannels.embed.channelName]
|
|
2277
|
+
];
|
|
2278
|
+
var implementationFiles = ["dist/browser.mjs", "dist/browser.cjs"];
|
|
2279
|
+
var ollamaConfigs = [
|
|
2280
|
+
...implementationFiles.flatMap(
|
|
2281
|
+
(filePath) => methods.map(([methodName, channelName]) => ({
|
|
2282
|
+
channelName,
|
|
2283
|
+
module: {
|
|
2284
|
+
name: "ollama",
|
|
2285
|
+
versionRange: ">=0.6.0 <0.7.0",
|
|
2286
|
+
filePath
|
|
2287
|
+
},
|
|
2288
|
+
functionQuery: {
|
|
2289
|
+
className: "Ollama",
|
|
2290
|
+
methodName,
|
|
2291
|
+
kind: "Async"
|
|
2292
|
+
}
|
|
2293
|
+
}))
|
|
2294
|
+
)
|
|
2295
|
+
];
|
|
2296
|
+
|
|
2146
2297
|
// src/instrumentation/plugins/google-adk-channels.ts
|
|
2147
2298
|
var googleADKChannels = defineChannels(
|
|
2148
2299
|
"@google/adk",
|
|
@@ -3215,6 +3366,7 @@ export {
|
|
|
3215
3366
|
aiSDKConfigs,
|
|
3216
3367
|
claudeAgentSDKConfigs,
|
|
3217
3368
|
cloudflareAgentsConfigs,
|
|
3369
|
+
cloudflareThinkConfigs,
|
|
3218
3370
|
cursorSDKConfigs,
|
|
3219
3371
|
openAIAgentsCoreConfigs,
|
|
3220
3372
|
googleGenAIConfigs,
|
|
@@ -3222,6 +3374,7 @@ export {
|
|
|
3222
3374
|
openRouterAgentConfigs,
|
|
3223
3375
|
openRouterConfigs,
|
|
3224
3376
|
mistralConfigs,
|
|
3377
|
+
ollamaConfigs,
|
|
3225
3378
|
googleADKConfigs,
|
|
3226
3379
|
cloudflareAIChatConfigs,
|
|
3227
3380
|
cohereConfigs,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
installMastraExporterFactory,
|
|
8
8
|
newGlobalTracingChannel,
|
|
9
9
|
setGlobalHookErrorReporter
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-2AMDGD65.mjs";
|
|
11
11
|
|
|
12
12
|
// src/auto-instrumentations/hook.mts
|
|
13
13
|
import { register } from "module";
|
|
@@ -42,6 +42,7 @@ var envIntegrationAliases = {
|
|
|
42
42
|
cloudflareaichat: "cloudflareAIChat",
|
|
43
43
|
"cloudflare-ai-chat": "cloudflareAIChat",
|
|
44
44
|
"@cloudflare/ai-chat": "cloudflareAIChat",
|
|
45
|
+
cloudflarethink: "cloudflareThink",
|
|
45
46
|
cursor: "cursor",
|
|
46
47
|
"cursor-sdk": "cursorSDK",
|
|
47
48
|
cursorsdk: "cursorSDK",
|
|
@@ -62,6 +63,7 @@ var envIntegrationAliases = {
|
|
|
62
63
|
openrouteragent: "openrouterAgent",
|
|
63
64
|
"openrouter-agent": "openrouterAgent",
|
|
64
65
|
mistral: "mistral",
|
|
66
|
+
ollama: "ollama",
|
|
65
67
|
googleadk: "googleADK",
|
|
66
68
|
"google-adk": "googleADK",
|
|
67
69
|
cohere: "cohere",
|
|
@@ -4738,6 +4740,7 @@ var INSTRUMENTATION_NAMES = {
|
|
|
4738
4740
|
CLAUDE_AGENT_SDK: "claude-agent-sdk",
|
|
4739
4741
|
CLOUDFLARE_AI_CHAT: "cloudflare-ai-chat",
|
|
4740
4742
|
CLOUDFLARE_AGENTS: "cloudflare-agents",
|
|
4743
|
+
CLOUDFLARE_THINK: "cloudflare-think",
|
|
4741
4744
|
COHERE: "cohere",
|
|
4742
4745
|
CURSOR_SDK: "cursor-sdk",
|
|
4743
4746
|
EVE: "eve",
|
|
@@ -4752,6 +4755,7 @@ var INSTRUMENTATION_NAMES = {
|
|
|
4752
4755
|
LANGSMITH: "langsmith",
|
|
4753
4756
|
MASTRA: "mastra",
|
|
4754
4757
|
MISTRAL: "mistral",
|
|
4758
|
+
OLLAMA: "ollama",
|
|
4755
4759
|
OPENAI: "openai",
|
|
4756
4760
|
OPENAI_AGENTS: "openai-agents",
|
|
4757
4761
|
OPENAI_CODEX: "openai-codex",
|
|
@@ -4763,7 +4767,7 @@ var INSTRUMENTATION_NAMES = {
|
|
|
4763
4767
|
var INTERNAL_SPAN_INSTRUMENTATION_NAME = /* @__PURE__ */ Symbol.for(
|
|
4764
4768
|
"braintrust.spanInstrumentationName"
|
|
4765
4769
|
);
|
|
4766
|
-
var SDK_VERSION = true ? "3.
|
|
4770
|
+
var SDK_VERSION = true ? "3.27.0" : "0.0.0";
|
|
4767
4771
|
function withSpanInstrumentationName(args, instrumentationName) {
|
|
4768
4772
|
return {
|
|
4769
4773
|
...args,
|
|
@@ -9182,11 +9186,21 @@ function defineChannels(pkg, channels, options) {
|
|
|
9182
9186
|
const tracingChannel2 = () => isomorph_default.newTracingChannel(
|
|
9183
9187
|
fullChannelName
|
|
9184
9188
|
);
|
|
9189
|
+
const intercept2 = (interceptor) => {
|
|
9190
|
+
const hook = tracingChannel2();
|
|
9191
|
+
return typeof hook.intercept === "function" ? hook.intercept(interceptor) : () => {
|
|
9192
|
+
};
|
|
9193
|
+
};
|
|
9185
9194
|
return [
|
|
9186
9195
|
key,
|
|
9187
9196
|
{
|
|
9188
9197
|
...asyncSpec,
|
|
9189
9198
|
instrumentationName,
|
|
9199
|
+
intercept: intercept2,
|
|
9200
|
+
invoke: (target, thisArg, args, additional) => {
|
|
9201
|
+
const hook = tracingChannel2();
|
|
9202
|
+
return typeof hook.invoke === "function" ? hook.invoke(target, thisArg, args, additional) : Reflect.apply(target, thisArg, args);
|
|
9203
|
+
},
|
|
9190
9204
|
tracingChannel: tracingChannel2,
|
|
9191
9205
|
tracePromise: (fn, context) => tracingChannel2().tracePromise(
|
|
9192
9206
|
fn,
|
|
@@ -9200,11 +9214,21 @@ function defineChannels(pkg, channels, options) {
|
|
|
9200
9214
|
const tracingChannel = () => isomorph_default.newTracingChannel(
|
|
9201
9215
|
fullChannelName
|
|
9202
9216
|
);
|
|
9217
|
+
const intercept = (interceptor) => {
|
|
9218
|
+
const hook = tracingChannel();
|
|
9219
|
+
return typeof hook.intercept === "function" ? hook.intercept(interceptor) : () => {
|
|
9220
|
+
};
|
|
9221
|
+
};
|
|
9203
9222
|
return [
|
|
9204
9223
|
key,
|
|
9205
9224
|
{
|
|
9206
9225
|
...syncSpec,
|
|
9207
9226
|
instrumentationName,
|
|
9227
|
+
intercept,
|
|
9228
|
+
invoke: (target, thisArg, args, additional) => {
|
|
9229
|
+
const hook = tracingChannel();
|
|
9230
|
+
return typeof hook.invoke === "function" ? hook.invoke(target, thisArg, args, additional) : Reflect.apply(target, thisArg, args);
|
|
9231
|
+
},
|
|
9208
9232
|
tracingChannel,
|
|
9209
9233
|
traceSync: (fn, context) => tracingChannel().traceSync(
|
|
9210
9234
|
fn,
|
|
@@ -9724,6 +9748,14 @@ var anthropicChannels = defineChannels(
|
|
|
9724
9748
|
betaMessagesToolRunner: channel({
|
|
9725
9749
|
channelName: "beta.messages.toolRunner",
|
|
9726
9750
|
kind: "sync-stream"
|
|
9751
|
+
}),
|
|
9752
|
+
betaSessionsEventsStream: channel({
|
|
9753
|
+
channelName: "beta.sessions.events.stream",
|
|
9754
|
+
kind: "async"
|
|
9755
|
+
}),
|
|
9756
|
+
betaSessionsThreadsEventsStream: channel({
|
|
9757
|
+
channelName: "beta.sessions.threads.events.stream",
|
|
9758
|
+
kind: "async"
|
|
9727
9759
|
})
|
|
9728
9760
|
},
|
|
9729
9761
|
{ instrumentationName: INSTRUMENTATION_NAMES.ANTHROPIC }
|
|
@@ -9842,7 +9874,40 @@ var anthropicConfigs = [
|
|
|
9842
9874
|
methodName: "toolRunner",
|
|
9843
9875
|
kind: "Sync"
|
|
9844
9876
|
}
|
|
9845
|
-
}
|
|
9877
|
+
},
|
|
9878
|
+
// Managed Agents Sessions event streams are discovered automatically, but
|
|
9879
|
+
// remain passive until the user calls collectAnthropicSession() on the
|
|
9880
|
+
// returned stream.
|
|
9881
|
+
...["mjs", "js"].map(
|
|
9882
|
+
(extension) => ({
|
|
9883
|
+
channelName: anthropicChannels.betaSessionsEventsStream.channelName,
|
|
9884
|
+
module: {
|
|
9885
|
+
name: "@anthropic-ai/sdk",
|
|
9886
|
+
versionRange: ">=0.86.0",
|
|
9887
|
+
filePath: `resources/beta/sessions/events.${extension}`
|
|
9888
|
+
},
|
|
9889
|
+
functionQuery: {
|
|
9890
|
+
className: "Events",
|
|
9891
|
+
methodName: "stream",
|
|
9892
|
+
kind: "Async"
|
|
9893
|
+
}
|
|
9894
|
+
})
|
|
9895
|
+
),
|
|
9896
|
+
...["mjs", "js"].map(
|
|
9897
|
+
(extension) => ({
|
|
9898
|
+
channelName: anthropicChannels.betaSessionsThreadsEventsStream.channelName,
|
|
9899
|
+
module: {
|
|
9900
|
+
name: "@anthropic-ai/sdk",
|
|
9901
|
+
versionRange: ">=0.86.0",
|
|
9902
|
+
filePath: `resources/beta/sessions/threads/events.${extension}`
|
|
9903
|
+
},
|
|
9904
|
+
functionQuery: {
|
|
9905
|
+
className: "Events",
|
|
9906
|
+
methodName: "stream",
|
|
9907
|
+
kind: "Async"
|
|
9908
|
+
}
|
|
9909
|
+
})
|
|
9910
|
+
)
|
|
9846
9911
|
];
|
|
9847
9912
|
|
|
9848
9913
|
// src/instrumentation/plugins/bedrock-runtime-channels.ts
|
|
@@ -10039,6 +10104,36 @@ var cloudflareAgentsConfigs = [
|
|
|
10039
10104
|
}
|
|
10040
10105
|
];
|
|
10041
10106
|
|
|
10107
|
+
// src/instrumentation/plugins/cloudflare-think-channels.ts
|
|
10108
|
+
var cloudflareThinkChannels = defineChannels(
|
|
10109
|
+
"@cloudflare/think",
|
|
10110
|
+
{
|
|
10111
|
+
runInferenceLoop: channel({
|
|
10112
|
+
channelName: "Think.runInferenceLoop",
|
|
10113
|
+
kind: "async"
|
|
10114
|
+
})
|
|
10115
|
+
},
|
|
10116
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.CLOUDFLARE_THINK }
|
|
10117
|
+
);
|
|
10118
|
+
|
|
10119
|
+
// src/auto-instrumentations/configs/cloudflare-think.ts
|
|
10120
|
+
var cloudflareThinkVersionRange = ">=0.13.0 <0.14.0";
|
|
10121
|
+
var cloudflareThinkConfigs = [
|
|
10122
|
+
{
|
|
10123
|
+
channelName: cloudflareThinkChannels.runInferenceLoop.channelName,
|
|
10124
|
+
module: {
|
|
10125
|
+
name: "@cloudflare/think",
|
|
10126
|
+
versionRange: cloudflareThinkVersionRange,
|
|
10127
|
+
filePath: "dist/think.js"
|
|
10128
|
+
},
|
|
10129
|
+
functionQuery: {
|
|
10130
|
+
className: "Think",
|
|
10131
|
+
methodName: "_runInferenceLoop",
|
|
10132
|
+
kind: "Async"
|
|
10133
|
+
}
|
|
10134
|
+
}
|
|
10135
|
+
];
|
|
10136
|
+
|
|
10042
10137
|
// src/instrumentation/plugins/cohere-channels.ts
|
|
10043
10138
|
var cohereChannels = defineChannels(
|
|
10044
10139
|
"cohere-ai",
|
|
@@ -11922,6 +12017,51 @@ var mistralConfigs = [
|
|
|
11922
12017
|
}
|
|
11923
12018
|
];
|
|
11924
12019
|
|
|
12020
|
+
// src/instrumentation/plugins/ollama-channels.ts
|
|
12021
|
+
var ollamaChannels = defineChannels(
|
|
12022
|
+
"ollama",
|
|
12023
|
+
{
|
|
12024
|
+
chat: channel({
|
|
12025
|
+
channelName: "chat",
|
|
12026
|
+
kind: "async"
|
|
12027
|
+
}),
|
|
12028
|
+
generate: channel({
|
|
12029
|
+
channelName: "generate",
|
|
12030
|
+
kind: "async"
|
|
12031
|
+
}),
|
|
12032
|
+
embed: channel({
|
|
12033
|
+
channelName: "embed",
|
|
12034
|
+
kind: "async"
|
|
12035
|
+
})
|
|
12036
|
+
},
|
|
12037
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.OLLAMA }
|
|
12038
|
+
);
|
|
12039
|
+
|
|
12040
|
+
// src/auto-instrumentations/configs/ollama.ts
|
|
12041
|
+
var methods = [
|
|
12042
|
+
["chat", ollamaChannels.chat.channelName],
|
|
12043
|
+
["generate", ollamaChannels.generate.channelName],
|
|
12044
|
+
["embed", ollamaChannels.embed.channelName]
|
|
12045
|
+
];
|
|
12046
|
+
var implementationFiles = ["dist/browser.mjs", "dist/browser.cjs"];
|
|
12047
|
+
var ollamaConfigs = [
|
|
12048
|
+
...implementationFiles.flatMap(
|
|
12049
|
+
(filePath) => methods.map(([methodName, channelName]) => ({
|
|
12050
|
+
channelName,
|
|
12051
|
+
module: {
|
|
12052
|
+
name: "ollama",
|
|
12053
|
+
versionRange: ">=0.6.0 <0.7.0",
|
|
12054
|
+
filePath
|
|
12055
|
+
},
|
|
12056
|
+
functionQuery: {
|
|
12057
|
+
className: "Ollama",
|
|
12058
|
+
methodName,
|
|
12059
|
+
kind: "Async"
|
|
12060
|
+
}
|
|
12061
|
+
}))
|
|
12062
|
+
)
|
|
12063
|
+
];
|
|
12064
|
+
|
|
11925
12065
|
// src/instrumentation/plugins/openai-agents-channels.ts
|
|
11926
12066
|
var openAIAgentsCoreChannels = defineChannels(
|
|
11927
12067
|
"@openai/agents-core",
|
|
@@ -12331,6 +12471,19 @@ var openRouterConfigs = [
|
|
|
12331
12471
|
kind: "Async"
|
|
12332
12472
|
}
|
|
12333
12473
|
},
|
|
12474
|
+
{
|
|
12475
|
+
channelName: openRouterChannels.betaResponsesSend.channelName,
|
|
12476
|
+
module: {
|
|
12477
|
+
name: "@openrouter/sdk",
|
|
12478
|
+
versionRange: ">=1.1.2 <2.0.0",
|
|
12479
|
+
filePath: "esm/sdk/betaresponses.js"
|
|
12480
|
+
},
|
|
12481
|
+
functionQuery: {
|
|
12482
|
+
className: "BetaResponses",
|
|
12483
|
+
methodName: "send",
|
|
12484
|
+
kind: "Async"
|
|
12485
|
+
}
|
|
12486
|
+
},
|
|
12334
12487
|
{
|
|
12335
12488
|
channelName: openRouterChannels.callModel.channelName,
|
|
12336
12489
|
module: {
|
|
@@ -12504,6 +12657,10 @@ var defaultInstrumentationConfigGroups = [
|
|
|
12504
12657
|
integrations: ["cloudflareAgents"],
|
|
12505
12658
|
configs: cloudflareAgentsConfigs
|
|
12506
12659
|
},
|
|
12660
|
+
{
|
|
12661
|
+
integrations: ["cloudflareThink"],
|
|
12662
|
+
configs: cloudflareThinkConfigs
|
|
12663
|
+
},
|
|
12507
12664
|
{ integrations: ["cursor", "cursorSDK"], configs: cursorSDKConfigs },
|
|
12508
12665
|
{
|
|
12509
12666
|
integrations: ["openAIAgents"],
|
|
@@ -12528,6 +12685,7 @@ var defaultInstrumentationConfigGroups = [
|
|
|
12528
12685
|
configs: openRouterAgentConfigs
|
|
12529
12686
|
},
|
|
12530
12687
|
{ integrations: ["mistral"], configs: mistralConfigs },
|
|
12688
|
+
{ integrations: ["ollama"], configs: ollamaConfigs },
|
|
12531
12689
|
{ integrations: ["googleADK"], configs: googleADKConfigs },
|
|
12532
12690
|
{ integrations: ["cohere"], configs: cohereConfigs },
|
|
12533
12691
|
{ integrations: ["groq"], configs: groqConfigs },
|