braintrust 3.13.0 → 3.14.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.d.mts +6 -8
- package/dev/dist/index.d.ts +6 -8
- package/dev/dist/index.js +809 -466
- package/dev/dist/index.mjs +367 -24
- package/dist/apply-auto-instrumentation.js +204 -174
- package/dist/apply-auto-instrumentation.mjs +35 -5
- package/dist/auto-instrumentations/bundler/esbuild.cjs +225 -1
- package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -1
- package/dist/auto-instrumentations/bundler/next.cjs +225 -1
- package/dist/auto-instrumentations/bundler/next.mjs +3 -2
- package/dist/auto-instrumentations/bundler/rollup.cjs +225 -1
- package/dist/auto-instrumentations/bundler/rollup.mjs +2 -1
- package/dist/auto-instrumentations/bundler/vite.cjs +225 -1
- package/dist/auto-instrumentations/bundler/vite.mjs +2 -1
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +8 -0
- package/dist/auto-instrumentations/bundler/webpack.cjs +225 -1
- package/dist/auto-instrumentations/bundler/webpack.mjs +3 -2
- package/dist/auto-instrumentations/chunk-J57YF7WS.mjs +208 -0
- package/dist/auto-instrumentations/{chunk-WFEUJACP.mjs → chunk-OTUQ7KH5.mjs} +1 -1
- package/dist/auto-instrumentations/chunk-QFMACSOL.mjs +280 -0
- package/dist/auto-instrumentations/{chunk-GJOO4ESL.mjs → chunk-XKAAVWT6.mjs} +23 -1
- package/dist/auto-instrumentations/hook.mjs +7980 -7
- package/dist/auto-instrumentations/loader/cjs-patch.cjs +194 -4
- package/dist/auto-instrumentations/loader/cjs-patch.mjs +13 -27
- package/dist/auto-instrumentations/loader/esm-hook.mjs +24 -10
- package/dist/browser.d.mts +127 -11
- package/dist/browser.d.ts +127 -11
- package/dist/browser.js +293 -24
- package/dist/browser.mjs +293 -24
- package/dist/{chunk-26JGOELH.js → chunk-NKD77KGB.js} +179 -1
- package/dist/{chunk-75IQCUB2.mjs → chunk-NU2GSPHX.mjs} +179 -1
- package/dist/cli.js +374 -51
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +293 -24
- package/dist/edge-light.mjs +293 -24
- package/dist/index.d.mts +127 -11
- package/dist/index.d.ts +127 -11
- package/dist/index.js +1113 -838
- package/dist/index.mjs +305 -30
- package/dist/instrumentation/index.d.mts +7 -8
- package/dist/instrumentation/index.d.ts +7 -8
- package/dist/instrumentation/index.js +101 -24
- package/dist/instrumentation/index.mjs +101 -24
- package/dist/workerd.d.mts +1 -1
- package/dist/workerd.d.ts +1 -1
- package/dist/workerd.js +293 -24
- package/dist/workerd.mjs +293 -24
- package/package.json +1 -7
- package/dist/auto-instrumentations/chunk-MWZXZQUO.mjs +0 -81
package/dist/cli.js
CHANGED
|
@@ -1232,7 +1232,7 @@ var require_package = __commonJS({
|
|
|
1232
1232
|
"package.json"(exports2, module2) {
|
|
1233
1233
|
module2.exports = {
|
|
1234
1234
|
name: "braintrust",
|
|
1235
|
-
version: "3.
|
|
1235
|
+
version: "3.14.0",
|
|
1236
1236
|
description: "SDK for integrating Braintrust",
|
|
1237
1237
|
repository: {
|
|
1238
1238
|
type: "git",
|
|
@@ -1394,17 +1394,13 @@ var require_package = __commonJS({
|
|
|
1394
1394
|
author: "",
|
|
1395
1395
|
license: "MIT",
|
|
1396
1396
|
devDependencies: {
|
|
1397
|
-
"@ai-sdk/anthropic": "2.0.37",
|
|
1398
1397
|
"@anthropic-ai/sdk": "^0.60.0",
|
|
1399
|
-
"@google/adk": "^0.6.1",
|
|
1400
|
-
"@google/genai": "^1.25.0",
|
|
1401
1398
|
"@nodelib/fs.walk": "^1.2.8",
|
|
1402
1399
|
"@types/argparse": "^2.0.14",
|
|
1403
1400
|
"@types/async": "^3.2.24",
|
|
1404
1401
|
"@types/cli-progress": "^3.11.5",
|
|
1405
1402
|
"@types/cors": "^2.8.17",
|
|
1406
1403
|
"@types/express": "^5.0.0",
|
|
1407
|
-
"@types/graceful-fs": "^4.1.9",
|
|
1408
1404
|
"@types/http-errors": "^2.0.4",
|
|
1409
1405
|
"@types/mustache": "^4.2.5",
|
|
1410
1406
|
"@types/node": "^20.10.5",
|
|
@@ -1414,7 +1410,6 @@ var require_package = __commonJS({
|
|
|
1414
1410
|
"@typescript-eslint/parser": "^8.49.0",
|
|
1415
1411
|
ai: "^6.0.0",
|
|
1416
1412
|
async: "^3.2.5",
|
|
1417
|
-
autoevals: "^0.0.131",
|
|
1418
1413
|
"cross-env": "^7.0.3",
|
|
1419
1414
|
"eslint-plugin-node-import": "^1.0.5",
|
|
1420
1415
|
openai: "6.25.0",
|
|
@@ -1446,7 +1441,6 @@ var require_package = __commonJS({
|
|
|
1446
1441
|
esbuild: "0.28.0",
|
|
1447
1442
|
"eventsource-parser": "^1.1.2",
|
|
1448
1443
|
express: "^5.2.1",
|
|
1449
|
-
"graceful-fs": "^4.2.11",
|
|
1450
1444
|
"http-errors": "^2.0.0",
|
|
1451
1445
|
minimatch: "^10.2.5",
|
|
1452
1446
|
"module-details-from-path": "^1.0.4",
|
|
@@ -1481,7 +1475,7 @@ __export(cli_exports, {
|
|
|
1481
1475
|
module.exports = __toCommonJS(cli_exports);
|
|
1482
1476
|
var esbuild = __toESM(require("esbuild"));
|
|
1483
1477
|
var dotenv3 = __toESM(require("dotenv"));
|
|
1484
|
-
var
|
|
1478
|
+
var import_node_fs3 = __toESM(require("node:fs"));
|
|
1485
1479
|
var import_node_os = __toESM(require("node:os"));
|
|
1486
1480
|
var import_node_path5 = __toESM(require("node:path"));
|
|
1487
1481
|
var import_node_util5 = __toESM(require("node:util"));
|
|
@@ -5443,6 +5437,76 @@ var LRUCache = class {
|
|
|
5443
5437
|
}
|
|
5444
5438
|
};
|
|
5445
5439
|
|
|
5440
|
+
// src/prompt-cache/cache-config.ts
|
|
5441
|
+
var CACHE_LOCATION_ENV_VAR = "BRAINTRUST_CACHE_LOCATION";
|
|
5442
|
+
var DEFAULT_CACHE_MEMORY_MAX = 1 << 10;
|
|
5443
|
+
var DEFAULT_CACHE_DISK_MAX = 1 << 20;
|
|
5444
|
+
var warnedInvalidCacheModeEnvValue = false;
|
|
5445
|
+
var warnedUnavailableDiskCacheMode = false;
|
|
5446
|
+
function warnInvalidCacheMode(value) {
|
|
5447
|
+
if (warnedInvalidCacheModeEnvValue) {
|
|
5448
|
+
return;
|
|
5449
|
+
}
|
|
5450
|
+
warnedInvalidCacheModeEnvValue = true;
|
|
5451
|
+
debugLogger.warn(
|
|
5452
|
+
`Invalid ${CACHE_LOCATION_ENV_VAR} value "${value}". Expected "mixed", "memory", "disk", or "none". Falling back to "mixed".`
|
|
5453
|
+
);
|
|
5454
|
+
}
|
|
5455
|
+
function warnUnavailableDiskCache() {
|
|
5456
|
+
if (warnedUnavailableDiskCacheMode) {
|
|
5457
|
+
return;
|
|
5458
|
+
}
|
|
5459
|
+
warnedUnavailableDiskCacheMode = true;
|
|
5460
|
+
debugLogger.warn(
|
|
5461
|
+
`Disk cache is not supported on this platform, so ${CACHE_LOCATION_ENV_VAR}="disk" disables prompt and parameters caching.`
|
|
5462
|
+
);
|
|
5463
|
+
}
|
|
5464
|
+
function parseCacheMode() {
|
|
5465
|
+
const value = isomorph_default.getEnv(CACHE_LOCATION_ENV_VAR);
|
|
5466
|
+
const normalized = value?.trim().toLowerCase();
|
|
5467
|
+
if (!normalized) {
|
|
5468
|
+
return "mixed";
|
|
5469
|
+
}
|
|
5470
|
+
if (normalized === "mixed" || normalized === "memory" || normalized === "disk" || normalized === "none") {
|
|
5471
|
+
return normalized;
|
|
5472
|
+
}
|
|
5473
|
+
warnInvalidCacheMode(value ?? "");
|
|
5474
|
+
return "mixed";
|
|
5475
|
+
}
|
|
5476
|
+
function parsePositiveIntegerEnv(envVar, defaultValue) {
|
|
5477
|
+
const value = Number(isomorph_default.getEnv(envVar));
|
|
5478
|
+
return Number.isInteger(value) && value > 0 ? value : defaultValue;
|
|
5479
|
+
}
|
|
5480
|
+
function createCacheLayers({
|
|
5481
|
+
memoryMaxEnvVar,
|
|
5482
|
+
diskCacheDirEnvVar,
|
|
5483
|
+
diskMaxEnvVar,
|
|
5484
|
+
getDefaultDiskCacheDir
|
|
5485
|
+
}) {
|
|
5486
|
+
const mode = parseCacheMode();
|
|
5487
|
+
const memoryCache = mode === "mixed" || mode === "memory" ? new LRUCache({
|
|
5488
|
+
max: parsePositiveIntegerEnv(
|
|
5489
|
+
memoryMaxEnvVar,
|
|
5490
|
+
DEFAULT_CACHE_MEMORY_MAX
|
|
5491
|
+
)
|
|
5492
|
+
}) : void 0;
|
|
5493
|
+
let diskCache;
|
|
5494
|
+
if (mode === "mixed" || mode === "disk") {
|
|
5495
|
+
if (canUseDiskCache()) {
|
|
5496
|
+
diskCache = new DiskCache({
|
|
5497
|
+
cacheDir: isomorph_default.getEnv(diskCacheDirEnvVar) ?? getDefaultDiskCacheDir(),
|
|
5498
|
+
max: parsePositiveIntegerEnv(diskMaxEnvVar, DEFAULT_CACHE_DISK_MAX)
|
|
5499
|
+
});
|
|
5500
|
+
} else if (mode === "disk") {
|
|
5501
|
+
warnUnavailableDiskCache();
|
|
5502
|
+
}
|
|
5503
|
+
}
|
|
5504
|
+
if (diskCache) {
|
|
5505
|
+
return { memoryCache, diskCache };
|
|
5506
|
+
}
|
|
5507
|
+
return { memoryCache };
|
|
5508
|
+
}
|
|
5509
|
+
|
|
5446
5510
|
// src/prompt-cache/prompt-cache.ts
|
|
5447
5511
|
function createCacheKey(key) {
|
|
5448
5512
|
if (key.id) {
|
|
@@ -5470,16 +5534,18 @@ var PromptCache = class {
|
|
|
5470
5534
|
*/
|
|
5471
5535
|
async get(key) {
|
|
5472
5536
|
const cacheKey = createCacheKey(key);
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5537
|
+
if (this.memoryCache) {
|
|
5538
|
+
const memoryPrompt = this.memoryCache.get(cacheKey);
|
|
5539
|
+
if (memoryPrompt !== void 0) {
|
|
5540
|
+
return memoryPrompt;
|
|
5541
|
+
}
|
|
5476
5542
|
}
|
|
5477
5543
|
if (this.diskCache) {
|
|
5478
5544
|
const diskPrompt = await this.diskCache.get(cacheKey);
|
|
5479
5545
|
if (!diskPrompt) {
|
|
5480
5546
|
return void 0;
|
|
5481
5547
|
}
|
|
5482
|
-
this.memoryCache
|
|
5548
|
+
this.memoryCache?.set(cacheKey, diskPrompt);
|
|
5483
5549
|
return diskPrompt;
|
|
5484
5550
|
}
|
|
5485
5551
|
return void 0;
|
|
@@ -5494,7 +5560,7 @@ var PromptCache = class {
|
|
|
5494
5560
|
*/
|
|
5495
5561
|
async set(key, value) {
|
|
5496
5562
|
const cacheKey = createCacheKey(key);
|
|
5497
|
-
this.memoryCache
|
|
5563
|
+
this.memoryCache?.set(cacheKey, value);
|
|
5498
5564
|
if (this.diskCache) {
|
|
5499
5565
|
await this.diskCache.set(cacheKey, value);
|
|
5500
5566
|
}
|
|
@@ -5524,23 +5590,25 @@ var ParametersCache = class {
|
|
|
5524
5590
|
}
|
|
5525
5591
|
async get(key) {
|
|
5526
5592
|
const cacheKey = createCacheKey2(key);
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5593
|
+
if (this.memoryCache) {
|
|
5594
|
+
const memoryParams = this.memoryCache.get(cacheKey);
|
|
5595
|
+
if (memoryParams !== void 0) {
|
|
5596
|
+
return memoryParams;
|
|
5597
|
+
}
|
|
5530
5598
|
}
|
|
5531
5599
|
if (this.diskCache) {
|
|
5532
5600
|
const diskParams = await this.diskCache.get(cacheKey);
|
|
5533
5601
|
if (!diskParams) {
|
|
5534
5602
|
return void 0;
|
|
5535
5603
|
}
|
|
5536
|
-
this.memoryCache
|
|
5604
|
+
this.memoryCache?.set(cacheKey, diskParams);
|
|
5537
5605
|
return diskParams;
|
|
5538
5606
|
}
|
|
5539
5607
|
return void 0;
|
|
5540
5608
|
}
|
|
5541
5609
|
async set(key, value) {
|
|
5542
5610
|
const cacheKey = createCacheKey2(key);
|
|
5543
|
-
this.memoryCache
|
|
5611
|
+
this.memoryCache?.set(cacheKey, value);
|
|
5544
5612
|
if (this.diskCache) {
|
|
5545
5613
|
await this.diskCache.set(cacheKey, value);
|
|
5546
5614
|
}
|
|
@@ -6072,21 +6140,22 @@ var BraintrustState = class _BraintrustState {
|
|
|
6072
6140
|
setGlobalDebugLogLevel(void 0);
|
|
6073
6141
|
}
|
|
6074
6142
|
this.resetLoginInfo();
|
|
6075
|
-
const memoryCache =
|
|
6076
|
-
|
|
6143
|
+
const { memoryCache, diskCache } = createCacheLayers({
|
|
6144
|
+
memoryMaxEnvVar: "BRAINTRUST_PROMPT_CACHE_MEMORY_MAX",
|
|
6145
|
+
diskCacheDirEnvVar: "BRAINTRUST_PROMPT_CACHE_DIR",
|
|
6146
|
+
diskMaxEnvVar: "BRAINTRUST_PROMPT_CACHE_DISK_MAX",
|
|
6147
|
+
getDefaultDiskCacheDir: () => `${isomorph_default.getEnv("HOME") ?? isomorph_default.homedir()}/.braintrust/prompt_cache`
|
|
6077
6148
|
});
|
|
6078
|
-
const diskCache = canUseDiskCache() ? new DiskCache({
|
|
6079
|
-
cacheDir: isomorph_default.getEnv("BRAINTRUST_PROMPT_CACHE_DIR") ?? `${isomorph_default.getEnv("HOME") ?? isomorph_default.homedir()}/.braintrust/prompt_cache`,
|
|
6080
|
-
max: Number(isomorph_default.getEnv("BRAINTRUST_PROMPT_CACHE_DISK_MAX")) ?? 1 << 20
|
|
6081
|
-
}) : void 0;
|
|
6082
6149
|
this.promptCache = new PromptCache({ memoryCache, diskCache });
|
|
6083
|
-
const
|
|
6084
|
-
|
|
6150
|
+
const {
|
|
6151
|
+
memoryCache: parametersMemoryCache,
|
|
6152
|
+
diskCache: parametersDiskCache
|
|
6153
|
+
} = createCacheLayers({
|
|
6154
|
+
memoryMaxEnvVar: "BRAINTRUST_PARAMETERS_CACHE_MEMORY_MAX",
|
|
6155
|
+
diskCacheDirEnvVar: "BRAINTRUST_PARAMETERS_CACHE_DIR",
|
|
6156
|
+
diskMaxEnvVar: "BRAINTRUST_PARAMETERS_CACHE_DISK_MAX",
|
|
6157
|
+
getDefaultDiskCacheDir: () => `${isomorph_default.getEnv("HOME") ?? isomorph_default.homedir()}/.braintrust/parameters_cache`
|
|
6085
6158
|
});
|
|
6086
|
-
const parametersDiskCache = canUseDiskCache() ? new DiskCache({
|
|
6087
|
-
cacheDir: isomorph_default.getEnv("BRAINTRUST_PARAMETERS_CACHE_DIR") ?? `${isomorph_default.getEnv("HOME") ?? isomorph_default.homedir()}/.braintrust/parameters_cache`,
|
|
6088
|
-
max: Number(isomorph_default.getEnv("BRAINTRUST_PARAMETERS_CACHE_DISK_MAX")) ?? 1 << 20
|
|
6089
|
-
}) : void 0;
|
|
6090
6159
|
this.parametersCache = new ParametersCache({
|
|
6091
6160
|
memoryCache: parametersMemoryCache,
|
|
6092
6161
|
diskCache: parametersDiskCache
|
|
@@ -29343,7 +29412,7 @@ var BraintrustPlugin = class extends BasePlugin {
|
|
|
29343
29412
|
this.config = config3;
|
|
29344
29413
|
}
|
|
29345
29414
|
onEnable() {
|
|
29346
|
-
const integrations = this.config.integrations
|
|
29415
|
+
const integrations = this.config.integrations ?? {};
|
|
29347
29416
|
if (integrations.openai !== false) {
|
|
29348
29417
|
this.openaiPlugin = new OpenAIPlugin();
|
|
29349
29418
|
this.openaiPlugin.enable();
|
|
@@ -29408,7 +29477,7 @@ var BraintrustPlugin = class extends BasePlugin {
|
|
|
29408
29477
|
this.genkitPlugin = new GenkitPlugin();
|
|
29409
29478
|
this.genkitPlugin.enable();
|
|
29410
29479
|
}
|
|
29411
|
-
if (
|
|
29480
|
+
if (integrations.gitHubCopilot !== false) {
|
|
29412
29481
|
this.gitHubCopilotPlugin = new GitHubCopilotPlugin();
|
|
29413
29482
|
this.gitHubCopilotPlugin.enable();
|
|
29414
29483
|
}
|
|
@@ -29521,6 +29590,7 @@ var envIntegrationAliases = {
|
|
|
29521
29590
|
cursorsdk: "cursorSDK",
|
|
29522
29591
|
flue: "flue",
|
|
29523
29592
|
"flue-runtime": "flue",
|
|
29593
|
+
mastra: "mastra",
|
|
29524
29594
|
"openai-agents": "openAIAgents",
|
|
29525
29595
|
openaiagents: "openAIAgents",
|
|
29526
29596
|
"openai-agents-core": "openAIAgents",
|
|
@@ -29563,6 +29633,7 @@ function getDefaultInstrumentationIntegrations() {
|
|
|
29563
29633
|
cursor: true,
|
|
29564
29634
|
cursorSDK: true,
|
|
29565
29635
|
flue: true,
|
|
29636
|
+
mastra: true,
|
|
29566
29637
|
openAIAgents: true,
|
|
29567
29638
|
openrouter: true,
|
|
29568
29639
|
openrouterAgent: true,
|
|
@@ -29587,6 +29658,9 @@ function readDisabledInstrumentationEnvConfig(disabledList) {
|
|
|
29587
29658
|
}
|
|
29588
29659
|
return { integrations };
|
|
29589
29660
|
}
|
|
29661
|
+
function isInstrumentationIntegrationDisabled(integrations, ...names) {
|
|
29662
|
+
return names.some((name) => integrations?.[name] === false);
|
|
29663
|
+
}
|
|
29590
29664
|
|
|
29591
29665
|
// src/instrumentation/registry.ts
|
|
29592
29666
|
var REGISTRY_STATE_KEY = /* @__PURE__ */ Symbol.for("braintrust.registry");
|
|
@@ -29680,6 +29754,263 @@ var PluginRegistry = class {
|
|
|
29680
29754
|
};
|
|
29681
29755
|
var registry = new PluginRegistry();
|
|
29682
29756
|
|
|
29757
|
+
// src/auto-instrumentations/loader/mastra-observability-patch.ts
|
|
29758
|
+
var MASTRA_EXPORTER_FACTORY_GLOBAL = "__braintrustMastraExporterFactory";
|
|
29759
|
+
function installMastraExporterFactory(factory) {
|
|
29760
|
+
const globals = globalThis;
|
|
29761
|
+
globals[MASTRA_EXPORTER_FACTORY_GLOBAL] ??= factory;
|
|
29762
|
+
}
|
|
29763
|
+
var EXPORTER_FACTORY_KEY = JSON.stringify(MASTRA_EXPORTER_FACTORY_GLOBAL);
|
|
29764
|
+
var OBSERVABILITY_APPEND_BODY = `
|
|
29765
|
+
;(function __braintrustWrapObservability() {
|
|
29766
|
+
// Top-level so we can both read and reassign the var binding the original
|
|
29767
|
+
// entry declared.
|
|
29768
|
+
if (typeof Observability === "undefined") return;
|
|
29769
|
+
if (Observability.__braintrustWrapped) return;
|
|
29770
|
+
function __braintrustEnsureExporter(rawConfig) {
|
|
29771
|
+
try {
|
|
29772
|
+
var factory = globalThis[${EXPORTER_FACTORY_KEY}];
|
|
29773
|
+
if (typeof factory !== "function") return rawConfig;
|
|
29774
|
+
var config = rawConfig && typeof rawConfig === "object" ? rawConfig : {};
|
|
29775
|
+
var configsIn = config.configs && typeof config.configs === "object" ? config.configs : null;
|
|
29776
|
+
var configsOut = {};
|
|
29777
|
+
var hadEntries = false;
|
|
29778
|
+
if (configsIn) {
|
|
29779
|
+
for (var name in configsIn) {
|
|
29780
|
+
if (!Object.prototype.hasOwnProperty.call(configsIn, name)) continue;
|
|
29781
|
+
hadEntries = true;
|
|
29782
|
+
var inst = configsIn[name] || {};
|
|
29783
|
+
var existing = Array.isArray(inst.exporters) ? inst.exporters : [];
|
|
29784
|
+
var hasOurs = existing.some(function (e) { return e && e.name === "braintrust"; });
|
|
29785
|
+
configsOut[name] = Object.assign({}, inst, {
|
|
29786
|
+
exporters: hasOurs ? existing : existing.concat([factory()]),
|
|
29787
|
+
});
|
|
29788
|
+
}
|
|
29789
|
+
}
|
|
29790
|
+
if (!hadEntries) {
|
|
29791
|
+
configsOut.default = {
|
|
29792
|
+
serviceName: "mastra",
|
|
29793
|
+
exporters: [factory()],
|
|
29794
|
+
};
|
|
29795
|
+
}
|
|
29796
|
+
return Object.assign({}, config, { configs: configsOut });
|
|
29797
|
+
} catch (e) {
|
|
29798
|
+
return rawConfig;
|
|
29799
|
+
}
|
|
29800
|
+
}
|
|
29801
|
+
var __OriginalObservability = Observability;
|
|
29802
|
+
Observability = new Proxy(__OriginalObservability, {
|
|
29803
|
+
construct: function (target, args, newTarget) {
|
|
29804
|
+
var nextArgs = args.slice();
|
|
29805
|
+
nextArgs[0] = __braintrustEnsureExporter(nextArgs[0]);
|
|
29806
|
+
return Reflect.construct(target, nextArgs, newTarget);
|
|
29807
|
+
},
|
|
29808
|
+
});
|
|
29809
|
+
Observability.__braintrustWrapped = true;
|
|
29810
|
+
if (typeof exports !== "undefined" && exports && typeof exports === "object") {
|
|
29811
|
+
try {
|
|
29812
|
+
Object.defineProperty(exports, "Observability", {
|
|
29813
|
+
enumerable: true,
|
|
29814
|
+
configurable: true,
|
|
29815
|
+
get: function () { return Observability; },
|
|
29816
|
+
});
|
|
29817
|
+
} catch (e) {}
|
|
29818
|
+
}
|
|
29819
|
+
})();
|
|
29820
|
+
`;
|
|
29821
|
+
|
|
29822
|
+
// src/wrappers/mastra.ts
|
|
29823
|
+
var MASTRA_BRAINTRUST_EXPORTER_NAME = "braintrust";
|
|
29824
|
+
var SPAN_TYPE_MAP = {
|
|
29825
|
+
agent_run: "task" /* TASK */,
|
|
29826
|
+
model_generation: "llm" /* LLM */,
|
|
29827
|
+
model_step: "llm" /* LLM */,
|
|
29828
|
+
model_chunk: "llm" /* LLM */,
|
|
29829
|
+
tool_call: "tool" /* TOOL */,
|
|
29830
|
+
mcp_tool_call: "tool" /* TOOL */,
|
|
29831
|
+
workflow_run: "task" /* TASK */,
|
|
29832
|
+
workflow_step: "function" /* FUNCTION */,
|
|
29833
|
+
workflow_conditional: "function" /* FUNCTION */,
|
|
29834
|
+
workflow_conditional_eval: "function" /* FUNCTION */,
|
|
29835
|
+
workflow_parallel: "function" /* FUNCTION */,
|
|
29836
|
+
workflow_loop: "function" /* FUNCTION */,
|
|
29837
|
+
workflow_sleep: "function" /* FUNCTION */,
|
|
29838
|
+
workflow_wait_event: "function" /* FUNCTION */,
|
|
29839
|
+
memory_operation: "function" /* FUNCTION */,
|
|
29840
|
+
workspace_action: "function" /* FUNCTION */,
|
|
29841
|
+
rag_ingestion: "task" /* TASK */,
|
|
29842
|
+
rag_embedding: "llm" /* LLM */,
|
|
29843
|
+
rag_vector_operation: "function" /* FUNCTION */,
|
|
29844
|
+
rag_action: "function" /* FUNCTION */,
|
|
29845
|
+
graph_action: "function" /* FUNCTION */,
|
|
29846
|
+
scorer_run: "score" /* SCORE */,
|
|
29847
|
+
scorer_step: "score" /* SCORE */,
|
|
29848
|
+
processor_run: "function" /* FUNCTION */,
|
|
29849
|
+
generic: "function" /* FUNCTION */
|
|
29850
|
+
};
|
|
29851
|
+
function spanTypeFor(mastraType) {
|
|
29852
|
+
return SPAN_TYPE_MAP[mastraType] ?? "function" /* FUNCTION */;
|
|
29853
|
+
}
|
|
29854
|
+
function epochSeconds(value) {
|
|
29855
|
+
if (value === void 0) return void 0;
|
|
29856
|
+
const ms = value instanceof Date ? value.getTime() : typeof value === "number" ? value : Date.parse(value);
|
|
29857
|
+
return Number.isFinite(ms) ? ms / 1e3 : void 0;
|
|
29858
|
+
}
|
|
29859
|
+
function modelMetrics(attributes) {
|
|
29860
|
+
if (!isObject(attributes)) return void 0;
|
|
29861
|
+
const usage = isObject(attributes.usage) ? attributes.usage : void 0;
|
|
29862
|
+
if (!usage) return void 0;
|
|
29863
|
+
const out = {};
|
|
29864
|
+
if (typeof usage.inputTokens === "number")
|
|
29865
|
+
out.prompt_tokens = usage.inputTokens;
|
|
29866
|
+
if (typeof usage.outputTokens === "number")
|
|
29867
|
+
out.completion_tokens = usage.outputTokens;
|
|
29868
|
+
if (typeof usage.inputTokens === "number" && typeof usage.outputTokens === "number") {
|
|
29869
|
+
out.tokens = usage.inputTokens + usage.outputTokens;
|
|
29870
|
+
}
|
|
29871
|
+
const inputDetails = isObject(usage.inputDetails) ? usage.inputDetails : void 0;
|
|
29872
|
+
const outputDetails = isObject(usage.outputDetails) ? usage.outputDetails : void 0;
|
|
29873
|
+
if (inputDetails && typeof inputDetails.cacheRead === "number") {
|
|
29874
|
+
out.prompt_cached_tokens = inputDetails.cacheRead;
|
|
29875
|
+
}
|
|
29876
|
+
if (inputDetails && typeof inputDetails.cacheWrite === "number") {
|
|
29877
|
+
out.prompt_cache_creation_tokens = inputDetails.cacheWrite;
|
|
29878
|
+
}
|
|
29879
|
+
if (outputDetails && typeof outputDetails.reasoning === "number") {
|
|
29880
|
+
out.completion_reasoning_tokens = outputDetails.reasoning;
|
|
29881
|
+
}
|
|
29882
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
29883
|
+
}
|
|
29884
|
+
function buildMetadata(exported) {
|
|
29885
|
+
const out = {};
|
|
29886
|
+
if (exported.entityId !== void 0) out.entity_id = exported.entityId;
|
|
29887
|
+
if (exported.entityName !== void 0) out.entity_name = exported.entityName;
|
|
29888
|
+
if (exported.entityType !== void 0) out.entity_type = exported.entityType;
|
|
29889
|
+
if (exported.metadata && isObject(exported.metadata)) {
|
|
29890
|
+
Object.assign(out, exported.metadata);
|
|
29891
|
+
}
|
|
29892
|
+
if (exported.attributes && isObject(exported.attributes)) {
|
|
29893
|
+
for (const [key, value] of Object.entries(exported.attributes)) {
|
|
29894
|
+
if (key === "usage") continue;
|
|
29895
|
+
if (value !== void 0) out[key] = value;
|
|
29896
|
+
}
|
|
29897
|
+
}
|
|
29898
|
+
if (exported.tags && exported.tags.length > 0) {
|
|
29899
|
+
out.tags = exported.tags;
|
|
29900
|
+
}
|
|
29901
|
+
if (exported.requestContext && isObject(exported.requestContext)) {
|
|
29902
|
+
out.request_context = exported.requestContext;
|
|
29903
|
+
}
|
|
29904
|
+
return out;
|
|
29905
|
+
}
|
|
29906
|
+
var BraintrustObservabilityExporter = class {
|
|
29907
|
+
name = MASTRA_BRAINTRUST_EXPORTER_NAME;
|
|
29908
|
+
spans = /* @__PURE__ */ new Map();
|
|
29909
|
+
// Captured at the first SPAN_STARTED event. Mastra's observability bus may
|
|
29910
|
+
// dispatch later events outside the user's AsyncLocalStorage context, where
|
|
29911
|
+
// `currentSpan()` returns NOOP_SPAN — which would make our `startSpan()`
|
|
29912
|
+
// calls go to a no-op logger and silently drop. Anchoring on the parent
|
|
29913
|
+
// we observe while still in-context keeps the whole Mastra subtree under
|
|
29914
|
+
// the user's traced scenario.
|
|
29915
|
+
capturedParent;
|
|
29916
|
+
constructor() {
|
|
29917
|
+
_internalSetInitialState();
|
|
29918
|
+
}
|
|
29919
|
+
async exportTracingEvent(event) {
|
|
29920
|
+
const exported = event.exportedSpan;
|
|
29921
|
+
if (exported.isInternal === true) return;
|
|
29922
|
+
try {
|
|
29923
|
+
switch (event.type) {
|
|
29924
|
+
case "span_started":
|
|
29925
|
+
this.onStart(exported);
|
|
29926
|
+
break;
|
|
29927
|
+
case "span_updated":
|
|
29928
|
+
this.onUpdate(exported);
|
|
29929
|
+
break;
|
|
29930
|
+
case "span_ended":
|
|
29931
|
+
this.onEnd(exported);
|
|
29932
|
+
break;
|
|
29933
|
+
}
|
|
29934
|
+
} catch (err) {
|
|
29935
|
+
logExporterError(err);
|
|
29936
|
+
}
|
|
29937
|
+
}
|
|
29938
|
+
async flush() {
|
|
29939
|
+
const state = _internalGetGlobalState();
|
|
29940
|
+
if (state) {
|
|
29941
|
+
await state.bgLogger().flush();
|
|
29942
|
+
}
|
|
29943
|
+
}
|
|
29944
|
+
async shutdown() {
|
|
29945
|
+
await this.flush();
|
|
29946
|
+
this.spans.clear();
|
|
29947
|
+
}
|
|
29948
|
+
onStart(exported) {
|
|
29949
|
+
if (this.spans.has(exported.id)) return;
|
|
29950
|
+
const args = {
|
|
29951
|
+
name: exported.name,
|
|
29952
|
+
spanAttributes: { type: spanTypeFor(exported.type) },
|
|
29953
|
+
startTime: epochSeconds(exported.startTime)
|
|
29954
|
+
};
|
|
29955
|
+
const parentRecord = exported.parentSpanId ? this.spans.get(exported.parentSpanId) : void 0;
|
|
29956
|
+
if (!this.capturedParent) {
|
|
29957
|
+
const probe = currentSpan();
|
|
29958
|
+
if (probe && probe.spanId) {
|
|
29959
|
+
this.capturedParent = probe;
|
|
29960
|
+
}
|
|
29961
|
+
}
|
|
29962
|
+
const span = parentRecord ? parentRecord.span.startSpan(args) : this.capturedParent ? this.capturedParent.startSpan(args) : startSpan(args);
|
|
29963
|
+
const record = { span, hasLoggedInput: false };
|
|
29964
|
+
this.logPayload(record, exported);
|
|
29965
|
+
this.spans.set(exported.id, record);
|
|
29966
|
+
if (exported.isEvent === true) {
|
|
29967
|
+
span.end({ endTime: args.startTime });
|
|
29968
|
+
this.spans.delete(exported.id);
|
|
29969
|
+
}
|
|
29970
|
+
}
|
|
29971
|
+
onUpdate(exported) {
|
|
29972
|
+
const record = this.spans.get(exported.id);
|
|
29973
|
+
if (!record) return;
|
|
29974
|
+
this.logPayload(record, exported);
|
|
29975
|
+
}
|
|
29976
|
+
onEnd(exported) {
|
|
29977
|
+
const record = this.spans.get(exported.id);
|
|
29978
|
+
if (!record) return;
|
|
29979
|
+
this.logPayload(record, exported);
|
|
29980
|
+
if (exported.errorInfo) {
|
|
29981
|
+
record.span.log({
|
|
29982
|
+
error: exported.errorInfo.message || exported.errorInfo.name || "Unknown Mastra error"
|
|
29983
|
+
});
|
|
29984
|
+
}
|
|
29985
|
+
record.span.end({ endTime: epochSeconds(exported.endTime) });
|
|
29986
|
+
this.spans.delete(exported.id);
|
|
29987
|
+
}
|
|
29988
|
+
logPayload(record, exported) {
|
|
29989
|
+
const event = {};
|
|
29990
|
+
if (exported.input !== void 0) {
|
|
29991
|
+
event.input = exported.input;
|
|
29992
|
+
record.hasLoggedInput = true;
|
|
29993
|
+
}
|
|
29994
|
+
if (exported.output !== void 0) {
|
|
29995
|
+
event.output = exported.output;
|
|
29996
|
+
}
|
|
29997
|
+
const metadata = buildMetadata(exported);
|
|
29998
|
+
if (Object.keys(metadata).length > 0) {
|
|
29999
|
+
event.metadata = metadata;
|
|
30000
|
+
}
|
|
30001
|
+
const metrics = modelMetrics(exported.attributes);
|
|
30002
|
+
if (metrics) {
|
|
30003
|
+
event.metrics = metrics;
|
|
30004
|
+
}
|
|
30005
|
+
if (Object.keys(event).length > 0) {
|
|
30006
|
+
record.span.log(event);
|
|
30007
|
+
}
|
|
30008
|
+
}
|
|
30009
|
+
};
|
|
30010
|
+
function logExporterError(err) {
|
|
30011
|
+
debugLogger.warn("Mastra exporter failure:", err);
|
|
30012
|
+
}
|
|
30013
|
+
|
|
29683
30014
|
// src/node/config.ts
|
|
29684
30015
|
var BRAINTRUST_ENV_SEARCH_PARENT_LIMIT = 64;
|
|
29685
30016
|
function configureNode() {
|
|
@@ -29765,6 +30096,12 @@ function configureNode() {
|
|
|
29765
30096
|
isomorph_default.gunzip = (0, import_node_util3.promisify)(zlib.gunzip);
|
|
29766
30097
|
isomorph_default.hash = (data) => crypto.createHash("sha256").update(data).digest("hex");
|
|
29767
30098
|
_internalSetInitialState();
|
|
30099
|
+
const disabled = readDisabledInstrumentationEnvConfig(
|
|
30100
|
+
isomorph_default.getEnv("BRAINTRUST_DISABLE_INSTRUMENTATION")
|
|
30101
|
+
).integrations;
|
|
30102
|
+
if (!isInstrumentationIntegrationDisabled(disabled, "mastra")) {
|
|
30103
|
+
installMastraExporterFactory(() => new BraintrustObservabilityExporter());
|
|
30104
|
+
}
|
|
29768
30105
|
registry.enable();
|
|
29769
30106
|
}
|
|
29770
30107
|
|
|
@@ -29772,7 +30109,7 @@ function configureNode() {
|
|
|
29772
30109
|
var import_env2 = require("@next/env");
|
|
29773
30110
|
|
|
29774
30111
|
// src/cli/functions/upload.ts
|
|
29775
|
-
var
|
|
30112
|
+
var import_node_fs2 = __toESM(require("node:fs"));
|
|
29776
30113
|
var import_node_path3 = __toESM(require("node:path"));
|
|
29777
30114
|
var import_node_zlib = require("node:zlib");
|
|
29778
30115
|
var import_v312 = require("zod/v3");
|
|
@@ -29783,21 +30120,7 @@ var fs2 = __toESM(require("node:fs/promises"));
|
|
|
29783
30120
|
|
|
29784
30121
|
// src/cli/jest/nodeModulesPaths.ts
|
|
29785
30122
|
var path2 = __toESM(require("node:path"));
|
|
29786
|
-
|
|
29787
|
-
// src/cli/jest/tryRealpath.ts
|
|
29788
|
-
var import_graceful_fs = require("graceful-fs");
|
|
29789
|
-
function tryRealpath(path8) {
|
|
29790
|
-
try {
|
|
29791
|
-
path8 = import_graceful_fs.realpathSync.native(path8);
|
|
29792
|
-
} catch (error2) {
|
|
29793
|
-
if (error2.code !== "ENOENT" && error2.code !== "EISDIR") {
|
|
29794
|
-
throw error2;
|
|
29795
|
-
}
|
|
29796
|
-
}
|
|
29797
|
-
return path8;
|
|
29798
|
-
}
|
|
29799
|
-
|
|
29800
|
-
// src/cli/jest/nodeModulesPaths.ts
|
|
30123
|
+
var import_node_fs = require("node:fs");
|
|
29801
30124
|
function nodeModulesPaths(basedir, options) {
|
|
29802
30125
|
const modules = options && options.moduleDirectory ? Array.from(options.moduleDirectory) : ["node_modules"];
|
|
29803
30126
|
const basedirAbs = path2.resolve(basedir);
|
|
@@ -29809,7 +30132,7 @@ function nodeModulesPaths(basedir, options) {
|
|
|
29809
30132
|
}
|
|
29810
30133
|
let physicalBasedir;
|
|
29811
30134
|
try {
|
|
29812
|
-
physicalBasedir =
|
|
30135
|
+
physicalBasedir = import_node_fs.realpathSync.native(basedirAbs);
|
|
29813
30136
|
} catch {
|
|
29814
30137
|
physicalBasedir = basedirAbs;
|
|
29815
30138
|
}
|
|
@@ -30786,7 +31109,7 @@ async function uploadBundles({
|
|
|
30786
31109
|
if (!pathInfo) {
|
|
30787
31110
|
return true;
|
|
30788
31111
|
}
|
|
30789
|
-
const bundleStream =
|
|
31112
|
+
const bundleStream = import_node_fs2.default.createReadStream(bundleFile).pipe((0, import_node_zlib.createGzip)());
|
|
30790
31113
|
const bundleData = await new Promise((resolve2, reject2) => {
|
|
30791
31114
|
const chunks = [];
|
|
30792
31115
|
bundleStream.on("data", (chunk) => {
|
|
@@ -32299,7 +32622,7 @@ function checkMatch(pathInput, include_patterns, exclude_patterns) {
|
|
|
32299
32622
|
async function collectFiles(inputPath, mode) {
|
|
32300
32623
|
let pathStat = null;
|
|
32301
32624
|
try {
|
|
32302
|
-
pathStat =
|
|
32625
|
+
pathStat = import_node_fs3.default.lstatSync(inputPath);
|
|
32303
32626
|
} catch (e) {
|
|
32304
32627
|
console.error(error(`Error reading ${inputPath}: ${e}`));
|
|
32305
32628
|
process.exit(1);
|
package/dist/edge-light.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { AnyDataset, Attachment, AttachmentParams, AttachmentReference, BRAINTRUST_CURRENT_SPAN_STORE, BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME, BackgroundLoggerOpts, BaseAttachment, BaseExperiment, BaseMetadata, BraintrustLangChainCallbackHandler, BraintrustMiddleware, BraintrustState, BraintrustStream, BraintrustStreamChunk, CachedSpanFetcher, ChatPrompt, CodeFunction, CodeOpts, CodePrompt, CommentEvent, CompiledPrompt, CompiledPromptParams, CompletionPrompt, ContextManager, ContextParentSpanIds, CreateProjectOpts, CurrentSpanStore, DEFAULT_FETCH_BATCH_SIZE, DEFAULT_MAX_REQUEST_SIZE, DataSummary, Dataset, DatasetPipeline, DatasetRecord, DatasetRestorePreviewResult, DatasetRestoreResult, DatasetSnapshot, DatasetSummary, DefaultMetadataType, DefaultPromptArgs, ERR_PERMALINK, EndSpanArgs, Eval, EvalCase, EvalClassifier, EvalHooks, EvalParameterSerializedSchema, EvalParameters, EvalResult, EvalResultWithSummary, EvalScorer, EvalScorerArgs, EvalTask, Evaluator, EvaluatorDef, EvaluatorDefinition, EvaluatorDefinitions, EvaluatorFile, EvaluatorManifest, Experiment, ExperimentLogFullArgs, ExperimentLogPartialArgs, ExperimentSummary, Exportable, ExternalAttachment, ExternalAttachmentParams, FailedHTTPResponse, FullInitDatasetOptions, FullInitOptions, FullLoginOptions, FunctionEvent, GetThreadOptions, IDGenerator, IdField, InitDatasetOptions, InitLoggerOptions, InitOptions, InputField, InstrumentationConfig, InvokeFunctionArgs, InvokeReturn, JSONAttachment, LEGACY_CACHED_HEADER, LOGS3_OVERFLOW_REFERENCE_TYPE, LangChainCallbackHandlerOptions, LazyValue, LoadPromptOptions, LogCommentFullArgs, LogFeedbackFullArgs, LogOptions, Logger, LoginInvalidOrgError, LoginOptions, Logs3OverflowInputRow, Logs3OverflowUpload, MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, ObjectFetcher, ObjectMetadata, OtherExperimentLogFields, ParametersSource, ParentExperimentIds, ParentProjectLogIds, Project, ProjectNameIdMap, PromiseUnless, Prompt, PromptBuilder, PromptContents, PromptDefinition, PromptDefinitionWithTools, PromptOpts, PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, RegisterSandboxOptions, RegisterSandboxResult, Reporter, ReporterBody, SandboxConfig, ScoreSummary, ScorerBuilder, ScorerOpts, SerializedBraintrustState, SetCurrentArg, Span, SpanContext, SpanData, SpanFetcher, SpanImpl, StartSpanArgs, TemplateFormat, TemplateRenderer, TemplateRendererPlugin, TestBackgroundLogger, ToolBuilder, Trace, UUIDGenerator, WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalIso, _internalSetInitialState, addAzureBlobHeaders, braintrustStreamChunkSchema, buildLocalSummary, configureInstrumentation, constructLogs3OverflowRequest, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, default, defaultErrorScoreHandler, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getContextManager, getIdGenerator, getPromptVersions, getSpanParentObject, getTemplateRenderer, graph, init, initDataset, initExperiment, initFunction, initLogger, initNodeTestSuite, invoke, isTemplateFormat, loadParameters, loadPrompt, log, logError, login, loginToState, logs3OverflowUploadSchema, newId, parseCachedHeader, parseTemplateFormat, permalink, pickLogs3OverflowObjectIds, projects, promptContentsSchema, promptDefinitionSchema, promptDefinitionToPromptData, promptDefinitionWithToolsSchema, registerOtelFlush, registerSandbox, registerTemplatePlugin, renderMessage, renderPromptParams, renderTemplateContent, reportFailures, runEvaluator, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, templateRegistry, toolFunctionDefinitionSchema, traceable, traced, updateSpan, uploadLogs3OverflowPayload, utf8ByteLength, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAISDKModel, wrapAgentClass, wrapAnthropic, wrapClaudeAgentSDK, wrapCohere, wrapCopilotClient, wrapCursorSDK, wrapFlueContext, wrapFlueSession, wrapGenkit, wrapGoogleADK, wrapGoogleGenAI, wrapGroq, wrapHuggingFace, wrapMastraAgent, wrapMistral, wrapOpenAI, wrapOpenAICodexSDK, wrapOpenAIv4, wrapOpenRouter, wrapOpenRouterAgent, wrapTraced, wrapVitest } from './browser.mjs';
|
|
1
|
+
export { AnyDataset, Attachment, AttachmentParams, AttachmentReference, BRAINTRUST_CURRENT_SPAN_STORE, BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME, BackgroundLoggerOpts, BaseAttachment, BaseExperiment, BaseMetadata, BraintrustLangChainCallbackHandler, BraintrustMiddleware, BraintrustObservabilityExporter, BraintrustState, BraintrustStream, BraintrustStreamChunk, CachedSpanFetcher, ChatPrompt, CodeFunction, CodeOpts, CodePrompt, CommentEvent, CompiledPrompt, CompiledPromptParams, CompletionPrompt, ContextManager, ContextParentSpanIds, CreateProjectOpts, CurrentSpanStore, DEFAULT_FETCH_BATCH_SIZE, DEFAULT_MAX_REQUEST_SIZE, DataSummary, Dataset, DatasetPipeline, DatasetRecord, DatasetRestorePreviewResult, DatasetRestoreResult, DatasetSnapshot, DatasetSummary, DefaultMetadataType, DefaultPromptArgs, ERR_PERMALINK, EndSpanArgs, Eval, EvalCase, EvalClassifier, EvalHooks, EvalParameterSerializedSchema, EvalParameters, EvalResult, EvalResultWithSummary, EvalScorer, EvalScorerArgs, EvalTask, Evaluator, EvaluatorDef, EvaluatorDefinition, EvaluatorDefinitions, EvaluatorFile, EvaluatorManifest, Experiment, ExperimentLogFullArgs, ExperimentLogPartialArgs, ExperimentSummary, Exportable, ExternalAttachment, ExternalAttachmentParams, FailedHTTPResponse, FullInitDatasetOptions, FullInitOptions, FullLoginOptions, FunctionEvent, GetThreadOptions, IDGenerator, IdField, InitDatasetOptions, InitLoggerOptions, InitOptions, InputField, InstrumentationConfig, InvokeFunctionArgs, InvokeReturn, JSONAttachment, LEGACY_CACHED_HEADER, LOGS3_OVERFLOW_REFERENCE_TYPE, LangChainCallbackHandlerOptions, LazyValue, LoadPromptOptions, LogCommentFullArgs, LogFeedbackFullArgs, LogOptions, Logger, LoginInvalidOrgError, LoginOptions, Logs3OverflowInputRow, Logs3OverflowUpload, MastraObservabilityExporter, MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, ObjectFetcher, ObjectMetadata, OtherExperimentLogFields, ParametersSource, ParentExperimentIds, ParentProjectLogIds, Project, ProjectNameIdMap, PromiseUnless, Prompt, PromptBuilder, PromptContents, PromptDefinition, PromptDefinitionWithTools, PromptOpts, PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, RegisterSandboxOptions, RegisterSandboxResult, Reporter, ReporterBody, SandboxConfig, ScoreSummary, ScorerBuilder, ScorerOpts, SerializedBraintrustState, SetCurrentArg, Span, SpanContext, SpanData, SpanFetcher, SpanImpl, StartSpanArgs, TemplateFormat, TemplateRenderer, TemplateRendererPlugin, TestBackgroundLogger, ToolBuilder, Trace, UUIDGenerator, WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalIso, _internalSetInitialState, addAzureBlobHeaders, braintrustStreamChunkSchema, buildLocalSummary, configureInstrumentation, constructLogs3OverflowRequest, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, default, defaultErrorScoreHandler, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getContextManager, getIdGenerator, getPromptVersions, getSpanParentObject, getTemplateRenderer, graph, init, initDataset, initExperiment, initFunction, initLogger, initNodeTestSuite, invoke, isTemplateFormat, loadParameters, loadPrompt, log, logError, login, loginToState, logs3OverflowUploadSchema, newId, parseCachedHeader, parseTemplateFormat, permalink, pickLogs3OverflowObjectIds, projects, promptContentsSchema, promptDefinitionSchema, promptDefinitionToPromptData, promptDefinitionWithToolsSchema, registerOtelFlush, registerSandbox, registerTemplatePlugin, renderMessage, renderPromptParams, renderTemplateContent, reportFailures, runEvaluator, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, templateRegistry, toolFunctionDefinitionSchema, traceable, traced, updateSpan, uploadLogs3OverflowPayload, utf8ByteLength, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAISDKModel, wrapAgentClass, wrapAnthropic, wrapClaudeAgentSDK, wrapCohere, wrapCopilotClient, wrapCursorSDK, wrapFlueContext, wrapFlueSession, wrapGenkit, wrapGoogleADK, wrapGoogleGenAI, wrapGroq, wrapHuggingFace, wrapMastraAgent, wrapMistral, wrapOpenAI, wrapOpenAICodexSDK, wrapOpenAIv4, wrapOpenRouter, wrapOpenRouterAgent, wrapTraced, wrapVitest } from './browser.mjs';
|
|
2
2
|
import 'zod/v3';
|
package/dist/edge-light.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { AnyDataset, Attachment, AttachmentParams, AttachmentReference, BRAINTRUST_CURRENT_SPAN_STORE, BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME, BackgroundLoggerOpts, BaseAttachment, BaseExperiment, BaseMetadata, BraintrustLangChainCallbackHandler, BraintrustMiddleware, BraintrustState, BraintrustStream, BraintrustStreamChunk, CachedSpanFetcher, ChatPrompt, CodeFunction, CodeOpts, CodePrompt, CommentEvent, CompiledPrompt, CompiledPromptParams, CompletionPrompt, ContextManager, ContextParentSpanIds, CreateProjectOpts, CurrentSpanStore, DEFAULT_FETCH_BATCH_SIZE, DEFAULT_MAX_REQUEST_SIZE, DataSummary, Dataset, DatasetPipeline, DatasetRecord, DatasetRestorePreviewResult, DatasetRestoreResult, DatasetSnapshot, DatasetSummary, DefaultMetadataType, DefaultPromptArgs, ERR_PERMALINK, EndSpanArgs, Eval, EvalCase, EvalClassifier, EvalHooks, EvalParameterSerializedSchema, EvalParameters, EvalResult, EvalResultWithSummary, EvalScorer, EvalScorerArgs, EvalTask, Evaluator, EvaluatorDef, EvaluatorDefinition, EvaluatorDefinitions, EvaluatorFile, EvaluatorManifest, Experiment, ExperimentLogFullArgs, ExperimentLogPartialArgs, ExperimentSummary, Exportable, ExternalAttachment, ExternalAttachmentParams, FailedHTTPResponse, FullInitDatasetOptions, FullInitOptions, FullLoginOptions, FunctionEvent, GetThreadOptions, IDGenerator, IdField, InitDatasetOptions, InitLoggerOptions, InitOptions, InputField, InstrumentationConfig, InvokeFunctionArgs, InvokeReturn, JSONAttachment, LEGACY_CACHED_HEADER, LOGS3_OVERFLOW_REFERENCE_TYPE, LangChainCallbackHandlerOptions, LazyValue, LoadPromptOptions, LogCommentFullArgs, LogFeedbackFullArgs, LogOptions, Logger, LoginInvalidOrgError, LoginOptions, Logs3OverflowInputRow, Logs3OverflowUpload, MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, ObjectFetcher, ObjectMetadata, OtherExperimentLogFields, ParametersSource, ParentExperimentIds, ParentProjectLogIds, Project, ProjectNameIdMap, PromiseUnless, Prompt, PromptBuilder, PromptContents, PromptDefinition, PromptDefinitionWithTools, PromptOpts, PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, RegisterSandboxOptions, RegisterSandboxResult, Reporter, ReporterBody, SandboxConfig, ScoreSummary, ScorerBuilder, ScorerOpts, SerializedBraintrustState, SetCurrentArg, Span, SpanContext, SpanData, SpanFetcher, SpanImpl, StartSpanArgs, TemplateFormat, TemplateRenderer, TemplateRendererPlugin, TestBackgroundLogger, ToolBuilder, Trace, UUIDGenerator, WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalIso, _internalSetInitialState, addAzureBlobHeaders, braintrustStreamChunkSchema, buildLocalSummary, configureInstrumentation, constructLogs3OverflowRequest, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, default, defaultErrorScoreHandler, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getContextManager, getIdGenerator, getPromptVersions, getSpanParentObject, getTemplateRenderer, graph, init, initDataset, initExperiment, initFunction, initLogger, initNodeTestSuite, invoke, isTemplateFormat, loadParameters, loadPrompt, log, logError, login, loginToState, logs3OverflowUploadSchema, newId, parseCachedHeader, parseTemplateFormat, permalink, pickLogs3OverflowObjectIds, projects, promptContentsSchema, promptDefinitionSchema, promptDefinitionToPromptData, promptDefinitionWithToolsSchema, registerOtelFlush, registerSandbox, registerTemplatePlugin, renderMessage, renderPromptParams, renderTemplateContent, reportFailures, runEvaluator, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, templateRegistry, toolFunctionDefinitionSchema, traceable, traced, updateSpan, uploadLogs3OverflowPayload, utf8ByteLength, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAISDKModel, wrapAgentClass, wrapAnthropic, wrapClaudeAgentSDK, wrapCohere, wrapCopilotClient, wrapCursorSDK, wrapFlueContext, wrapFlueSession, wrapGenkit, wrapGoogleADK, wrapGoogleGenAI, wrapGroq, wrapHuggingFace, wrapMastraAgent, wrapMistral, wrapOpenAI, wrapOpenAICodexSDK, wrapOpenAIv4, wrapOpenRouter, wrapOpenRouterAgent, wrapTraced, wrapVitest } from './browser.js';
|
|
1
|
+
export { AnyDataset, Attachment, AttachmentParams, AttachmentReference, BRAINTRUST_CURRENT_SPAN_STORE, BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME, BackgroundLoggerOpts, BaseAttachment, BaseExperiment, BaseMetadata, BraintrustLangChainCallbackHandler, BraintrustMiddleware, BraintrustObservabilityExporter, BraintrustState, BraintrustStream, BraintrustStreamChunk, CachedSpanFetcher, ChatPrompt, CodeFunction, CodeOpts, CodePrompt, CommentEvent, CompiledPrompt, CompiledPromptParams, CompletionPrompt, ContextManager, ContextParentSpanIds, CreateProjectOpts, CurrentSpanStore, DEFAULT_FETCH_BATCH_SIZE, DEFAULT_MAX_REQUEST_SIZE, DataSummary, Dataset, DatasetPipeline, DatasetRecord, DatasetRestorePreviewResult, DatasetRestoreResult, DatasetSnapshot, DatasetSummary, DefaultMetadataType, DefaultPromptArgs, ERR_PERMALINK, EndSpanArgs, Eval, EvalCase, EvalClassifier, EvalHooks, EvalParameterSerializedSchema, EvalParameters, EvalResult, EvalResultWithSummary, EvalScorer, EvalScorerArgs, EvalTask, Evaluator, EvaluatorDef, EvaluatorDefinition, EvaluatorDefinitions, EvaluatorFile, EvaluatorManifest, Experiment, ExperimentLogFullArgs, ExperimentLogPartialArgs, ExperimentSummary, Exportable, ExternalAttachment, ExternalAttachmentParams, FailedHTTPResponse, FullInitDatasetOptions, FullInitOptions, FullLoginOptions, FunctionEvent, GetThreadOptions, IDGenerator, IdField, InitDatasetOptions, InitLoggerOptions, InitOptions, InputField, InstrumentationConfig, InvokeFunctionArgs, InvokeReturn, JSONAttachment, LEGACY_CACHED_HEADER, LOGS3_OVERFLOW_REFERENCE_TYPE, LangChainCallbackHandlerOptions, LazyValue, LoadPromptOptions, LogCommentFullArgs, LogFeedbackFullArgs, LogOptions, Logger, LoginInvalidOrgError, LoginOptions, Logs3OverflowInputRow, Logs3OverflowUpload, MastraObservabilityExporter, MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, ObjectFetcher, ObjectMetadata, OtherExperimentLogFields, ParametersSource, ParentExperimentIds, ParentProjectLogIds, Project, ProjectNameIdMap, PromiseUnless, Prompt, PromptBuilder, PromptContents, PromptDefinition, PromptDefinitionWithTools, PromptOpts, PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, RegisterSandboxOptions, RegisterSandboxResult, Reporter, ReporterBody, SandboxConfig, ScoreSummary, ScorerBuilder, ScorerOpts, SerializedBraintrustState, SetCurrentArg, Span, SpanContext, SpanData, SpanFetcher, SpanImpl, StartSpanArgs, TemplateFormat, TemplateRenderer, TemplateRendererPlugin, TestBackgroundLogger, ToolBuilder, Trace, UUIDGenerator, WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalIso, _internalSetInitialState, addAzureBlobHeaders, braintrustStreamChunkSchema, buildLocalSummary, configureInstrumentation, constructLogs3OverflowRequest, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, default, defaultErrorScoreHandler, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getContextManager, getIdGenerator, getPromptVersions, getSpanParentObject, getTemplateRenderer, graph, init, initDataset, initExperiment, initFunction, initLogger, initNodeTestSuite, invoke, isTemplateFormat, loadParameters, loadPrompt, log, logError, login, loginToState, logs3OverflowUploadSchema, newId, parseCachedHeader, parseTemplateFormat, permalink, pickLogs3OverflowObjectIds, projects, promptContentsSchema, promptDefinitionSchema, promptDefinitionToPromptData, promptDefinitionWithToolsSchema, registerOtelFlush, registerSandbox, registerTemplatePlugin, renderMessage, renderPromptParams, renderTemplateContent, reportFailures, runEvaluator, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, templateRegistry, toolFunctionDefinitionSchema, traceable, traced, updateSpan, uploadLogs3OverflowPayload, utf8ByteLength, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAISDKModel, wrapAgentClass, wrapAnthropic, wrapClaudeAgentSDK, wrapCohere, wrapCopilotClient, wrapCursorSDK, wrapFlueContext, wrapFlueSession, wrapGenkit, wrapGoogleADK, wrapGoogleGenAI, wrapGroq, wrapHuggingFace, wrapMastraAgent, wrapMistral, wrapOpenAI, wrapOpenAICodexSDK, wrapOpenAIv4, wrapOpenRouter, wrapOpenRouterAgent, wrapTraced, wrapVitest } from './browser.js';
|
|
2
2
|
import 'zod/v3';
|