braintrust 3.14.0 → 3.15.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 +616 -1026
- package/dev/dist/index.mjs +577 -987
- package/dist/apply-auto-instrumentation.js +176 -186
- package/dist/apply-auto-instrumentation.mjs +6 -16
- package/dist/auto-instrumentations/bundler/esbuild.cjs +5 -39
- package/dist/auto-instrumentations/bundler/esbuild.mjs +1 -1
- package/dist/auto-instrumentations/bundler/next.cjs +5 -39
- package/dist/auto-instrumentations/bundler/next.mjs +2 -2
- package/dist/auto-instrumentations/bundler/rollup.cjs +5 -39
- package/dist/auto-instrumentations/bundler/rollup.mjs +1 -1
- package/dist/auto-instrumentations/bundler/vite.cjs +5 -39
- package/dist/auto-instrumentations/bundler/vite.mjs +1 -1
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +5 -39
- package/dist/auto-instrumentations/bundler/webpack.cjs +5 -39
- package/dist/auto-instrumentations/bundler/webpack.mjs +2 -2
- package/dist/auto-instrumentations/{chunk-OTUQ7KH5.mjs → chunk-CNQ7BUKN.mjs} +1 -1
- package/dist/auto-instrumentations/{chunk-XKAAVWT6.mjs → chunk-VXJONZVX.mjs} +5 -39
- package/dist/auto-instrumentations/hook.mjs +5 -39
- package/dist/browser.d.mts +13 -17
- package/dist/browser.d.ts +13 -17
- package/dist/browser.js +581 -1015
- package/dist/browser.mjs +581 -1015
- package/dist/{chunk-NU2GSPHX.mjs → chunk-O4ZIWXO3.mjs} +0 -24
- package/dist/{chunk-NKD77KGB.js → chunk-VMBQETG3.js} +0 -24
- package/dist/cli.js +578 -988
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +581 -1015
- package/dist/edge-light.mjs +581 -1015
- package/dist/index.d.mts +13 -17
- package/dist/index.d.ts +13 -17
- package/dist/index.js +967 -1377
- package/dist/index.mjs +582 -992
- package/dist/instrumentation/index.d.mts +11 -1
- package/dist/instrumentation/index.d.ts +11 -1
- package/dist/instrumentation/index.js +611 -1015
- package/dist/instrumentation/index.mjs +610 -1015
- package/dist/workerd.d.mts +1 -1
- package/dist/workerd.d.ts +1 -1
- package/dist/workerd.js +581 -1015
- package/dist/workerd.mjs +581 -1015
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
var
|
|
29
|
+
var _chunkVMBQETG3js = require('./chunk-VMBQETG3.js');
|
|
30
30
|
|
|
31
31
|
// src/node/config.ts
|
|
32
32
|
var _nodeasync_hooks = require('node:async_hooks');
|
|
@@ -83,7 +83,7 @@ function parseDebugLogLevelEnv(value) {
|
|
|
83
83
|
return void 0;
|
|
84
84
|
}
|
|
85
85
|
function getEnvDebugLogLevel() {
|
|
86
|
-
return parseDebugLogLevelEnv(
|
|
86
|
+
return parseDebugLogLevelEnv(_chunkVMBQETG3js.isomorph_default.getEnv("BRAINTRUST_DEBUG_LOG_LEVEL"));
|
|
87
87
|
}
|
|
88
88
|
function setGlobalDebugLogLevel(level) {
|
|
89
89
|
globalThis[DEBUG_LOG_LEVEL_SYMBOL] = level;
|
|
@@ -350,9 +350,9 @@ function getCallerLocation() {
|
|
|
350
350
|
const entries = getStackTrace();
|
|
351
351
|
for (const frame of entries) {
|
|
352
352
|
if (thisDir === void 0) {
|
|
353
|
-
thisDir = _optionalChain([
|
|
353
|
+
thisDir = _optionalChain([_chunkVMBQETG3js.isomorph_default, 'access', _12 => _12.pathDirname, 'optionalCall', _13 => _13(frame.fileName)]);
|
|
354
354
|
}
|
|
355
|
-
if (_optionalChain([
|
|
355
|
+
if (_optionalChain([_chunkVMBQETG3js.isomorph_default, 'access', _14 => _14.pathDirname, 'optionalCall', _15 => _15(frame.fileName)]) !== thisDir) {
|
|
356
356
|
return {
|
|
357
357
|
caller_functionname: frame.functionName,
|
|
358
358
|
caller_filename: frame.fileName,
|
|
@@ -3944,7 +3944,7 @@ function devNullWritableStream() {
|
|
|
3944
3944
|
|
|
3945
3945
|
// src/prompt-cache/disk-cache.ts
|
|
3946
3946
|
function canUseDiskCache() {
|
|
3947
|
-
return !!(
|
|
3947
|
+
return !!(_chunkVMBQETG3js.isomorph_default.hash && _chunkVMBQETG3js.isomorph_default.gunzip && _chunkVMBQETG3js.isomorph_default.gzip && _chunkVMBQETG3js.isomorph_default.stat && _chunkVMBQETG3js.isomorph_default.readFile && _chunkVMBQETG3js.isomorph_default.writeFile && _chunkVMBQETG3js.isomorph_default.utimes && _chunkVMBQETG3js.isomorph_default.readdir && _chunkVMBQETG3js.isomorph_default.mkdir && _chunkVMBQETG3js.isomorph_default.unlink && _chunkVMBQETG3js.isomorph_default.homedir);
|
|
3948
3948
|
}
|
|
3949
3949
|
var DiskCache = class {
|
|
3950
3950
|
|
|
@@ -3965,8 +3965,8 @@ var DiskCache = class {
|
|
|
3965
3965
|
this.mkdir = _nullishCoalesce(options.mkdir, () => ( true));
|
|
3966
3966
|
}
|
|
3967
3967
|
getEntryPath(key) {
|
|
3968
|
-
const hashed =
|
|
3969
|
-
return
|
|
3968
|
+
const hashed = _chunkVMBQETG3js.isomorph_default.hash(key);
|
|
3969
|
+
return _chunkVMBQETG3js.isomorph_default.pathJoin(this.dir, hashed);
|
|
3970
3970
|
}
|
|
3971
3971
|
/**
|
|
3972
3972
|
* Retrieves a value from the cache.
|
|
@@ -3978,8 +3978,8 @@ var DiskCache = class {
|
|
|
3978
3978
|
async get(key) {
|
|
3979
3979
|
try {
|
|
3980
3980
|
const filePath = this.getEntryPath(key);
|
|
3981
|
-
const data = await
|
|
3982
|
-
await
|
|
3981
|
+
const data = await _chunkVMBQETG3js.isomorph_default.gunzip(await _chunkVMBQETG3js.isomorph_default.readFile(filePath));
|
|
3982
|
+
await _chunkVMBQETG3js.isomorph_default.utimes(filePath, /* @__PURE__ */ new Date(), /* @__PURE__ */ new Date());
|
|
3983
3983
|
return JSON.parse(data.toString());
|
|
3984
3984
|
} catch (e) {
|
|
3985
3985
|
if (e.code === "ENOENT") {
|
|
@@ -4001,11 +4001,11 @@ var DiskCache = class {
|
|
|
4001
4001
|
async set(key, value) {
|
|
4002
4002
|
try {
|
|
4003
4003
|
if (this.mkdir) {
|
|
4004
|
-
await
|
|
4004
|
+
await _chunkVMBQETG3js.isomorph_default.mkdir(this.dir, { recursive: true });
|
|
4005
4005
|
}
|
|
4006
4006
|
const filePath = this.getEntryPath(key);
|
|
4007
|
-
const data = await
|
|
4008
|
-
await
|
|
4007
|
+
const data = await _chunkVMBQETG3js.isomorph_default.gzip(JSON.stringify(value));
|
|
4008
|
+
await _chunkVMBQETG3js.isomorph_default.writeFile(filePath, data);
|
|
4009
4009
|
await this.evictOldestIfFull();
|
|
4010
4010
|
} catch (e) {
|
|
4011
4011
|
if (this.logWarnings) {
|
|
@@ -4018,14 +4018,14 @@ var DiskCache = class {
|
|
|
4018
4018
|
if (!this.max) {
|
|
4019
4019
|
return;
|
|
4020
4020
|
}
|
|
4021
|
-
const files = await
|
|
4022
|
-
const paths = files.map((file) =>
|
|
4021
|
+
const files = await _chunkVMBQETG3js.isomorph_default.readdir(this.dir);
|
|
4022
|
+
const paths = files.map((file) => _chunkVMBQETG3js.isomorph_default.pathJoin(this.dir, file));
|
|
4023
4023
|
if (paths.length <= this.max) {
|
|
4024
4024
|
return;
|
|
4025
4025
|
}
|
|
4026
4026
|
const stats = await Promise.all(
|
|
4027
4027
|
paths.map(async (path2) => {
|
|
4028
|
-
const stat2 = await
|
|
4028
|
+
const stat2 = await _chunkVMBQETG3js.isomorph_default.stat(path2);
|
|
4029
4029
|
return {
|
|
4030
4030
|
path: path2,
|
|
4031
4031
|
mtime: stat2.mtime.getTime()
|
|
@@ -4034,7 +4034,7 @@ var DiskCache = class {
|
|
|
4034
4034
|
);
|
|
4035
4035
|
stats.sort((a, b) => a.mtime - b.mtime);
|
|
4036
4036
|
const toRemove = stats.slice(0, stats.length - this.max);
|
|
4037
|
-
await Promise.all(toRemove.map((stat2) =>
|
|
4037
|
+
await Promise.all(toRemove.map((stat2) => _chunkVMBQETG3js.isomorph_default.unlink(stat2.path)));
|
|
4038
4038
|
}
|
|
4039
4039
|
};
|
|
4040
4040
|
|
|
@@ -4112,7 +4112,7 @@ function warnUnavailableDiskCache() {
|
|
|
4112
4112
|
);
|
|
4113
4113
|
}
|
|
4114
4114
|
function parseCacheMode() {
|
|
4115
|
-
const value =
|
|
4115
|
+
const value = _chunkVMBQETG3js.isomorph_default.getEnv(CACHE_LOCATION_ENV_VAR);
|
|
4116
4116
|
const normalized = _optionalChain([value, 'optionalAccess', _31 => _31.trim, 'call', _32 => _32(), 'access', _33 => _33.toLowerCase, 'call', _34 => _34()]);
|
|
4117
4117
|
if (!normalized) {
|
|
4118
4118
|
return "mixed";
|
|
@@ -4124,7 +4124,7 @@ function parseCacheMode() {
|
|
|
4124
4124
|
return "mixed";
|
|
4125
4125
|
}
|
|
4126
4126
|
function parsePositiveIntegerEnv(envVar, defaultValue) {
|
|
4127
|
-
const value = Number(
|
|
4127
|
+
const value = Number(_chunkVMBQETG3js.isomorph_default.getEnv(envVar));
|
|
4128
4128
|
return Number.isInteger(value) && value > 0 ? value : defaultValue;
|
|
4129
4129
|
}
|
|
4130
4130
|
function createCacheLayers({
|
|
@@ -4144,7 +4144,7 @@ function createCacheLayers({
|
|
|
4144
4144
|
if (mode === "mixed" || mode === "disk") {
|
|
4145
4145
|
if (canUseDiskCache()) {
|
|
4146
4146
|
diskCache = new DiskCache({
|
|
4147
|
-
cacheDir: _nullishCoalesce(
|
|
4147
|
+
cacheDir: _nullishCoalesce(_chunkVMBQETG3js.isomorph_default.getEnv(diskCacheDirEnvVar), () => ( getDefaultDiskCacheDir())),
|
|
4148
4148
|
max: parsePositiveIntegerEnv(diskMaxEnvVar, DEFAULT_CACHE_DISK_MAX)
|
|
4149
4149
|
});
|
|
4150
4150
|
} else if (mode === "disk") {
|
|
@@ -4269,7 +4269,7 @@ var ParametersCache = class {
|
|
|
4269
4269
|
var activeCaches = /* @__PURE__ */ new Set();
|
|
4270
4270
|
var exitHandlersRegistered = false;
|
|
4271
4271
|
function canUseSpanCache() {
|
|
4272
|
-
return !!(
|
|
4272
|
+
return !!(_chunkVMBQETG3js.isomorph_default.pathJoin && _chunkVMBQETG3js.isomorph_default.tmpdir && _chunkVMBQETG3js.isomorph_default.writeFileSync && _chunkVMBQETG3js.isomorph_default.appendFileSync && _chunkVMBQETG3js.isomorph_default.readFileSync && _chunkVMBQETG3js.isomorph_default.unlinkSync && _chunkVMBQETG3js.isomorph_default.openFile);
|
|
4273
4273
|
}
|
|
4274
4274
|
var SpanCache = (_class5 = class {
|
|
4275
4275
|
__init7() {this.cacheFilePath = null}
|
|
@@ -4334,16 +4334,16 @@ var SpanCache = (_class5 = class {
|
|
|
4334
4334
|
return this.initPromise;
|
|
4335
4335
|
}
|
|
4336
4336
|
this.initPromise = (async () => {
|
|
4337
|
-
if (!
|
|
4337
|
+
if (!_chunkVMBQETG3js.isomorph_default.tmpdir || !_chunkVMBQETG3js.isomorph_default.pathJoin || !_chunkVMBQETG3js.isomorph_default.openFile) {
|
|
4338
4338
|
return;
|
|
4339
4339
|
}
|
|
4340
|
-
const tmpDir =
|
|
4340
|
+
const tmpDir = _chunkVMBQETG3js.isomorph_default.tmpdir();
|
|
4341
4341
|
const uniqueId = `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
4342
|
-
this.cacheFilePath =
|
|
4342
|
+
this.cacheFilePath = _chunkVMBQETG3js.isomorph_default.pathJoin(
|
|
4343
4343
|
tmpDir,
|
|
4344
4344
|
`braintrust-span-cache-${uniqueId}.jsonl`
|
|
4345
4345
|
);
|
|
4346
|
-
this.fileHandle = await
|
|
4346
|
+
this.fileHandle = await _chunkVMBQETG3js.isomorph_default.openFile(this.cacheFilePath, "a+");
|
|
4347
4347
|
this.initialized = true;
|
|
4348
4348
|
this.registerExitHandler();
|
|
4349
4349
|
})();
|
|
@@ -4367,9 +4367,9 @@ var SpanCache = (_class5 = class {
|
|
|
4367
4367
|
} catch (e12) {
|
|
4368
4368
|
}
|
|
4369
4369
|
}
|
|
4370
|
-
if (cache.cacheFilePath && canUseSpanCache() &&
|
|
4370
|
+
if (cache.cacheFilePath && canUseSpanCache() && _chunkVMBQETG3js.isomorph_default.unlinkSync) {
|
|
4371
4371
|
try {
|
|
4372
|
-
|
|
4372
|
+
_chunkVMBQETG3js.isomorph_default.unlinkSync(cache.cacheFilePath);
|
|
4373
4373
|
} catch (e13) {
|
|
4374
4374
|
}
|
|
4375
4375
|
}
|
|
@@ -4448,9 +4448,9 @@ var SpanCache = (_class5 = class {
|
|
|
4448
4448
|
return void 0;
|
|
4449
4449
|
}
|
|
4450
4450
|
const spanMap = /* @__PURE__ */ new Map();
|
|
4451
|
-
if (this.initialized && this.cacheFilePath &&
|
|
4451
|
+
if (this.initialized && this.cacheFilePath && _chunkVMBQETG3js.isomorph_default.readFileSync) {
|
|
4452
4452
|
try {
|
|
4453
|
-
const content =
|
|
4453
|
+
const content = _chunkVMBQETG3js.isomorph_default.readFileSync(this.cacheFilePath, "utf8");
|
|
4454
4454
|
const lines = content.trim().split("\n").filter(Boolean);
|
|
4455
4455
|
for (const line of lines) {
|
|
4456
4456
|
try {
|
|
@@ -4539,9 +4539,9 @@ var SpanCache = (_class5 = class {
|
|
|
4539
4539
|
});
|
|
4540
4540
|
this.fileHandle = null;
|
|
4541
4541
|
}
|
|
4542
|
-
if (this.cacheFilePath && canUseSpanCache() &&
|
|
4542
|
+
if (this.cacheFilePath && canUseSpanCache() && _chunkVMBQETG3js.isomorph_default.unlinkSync) {
|
|
4543
4543
|
try {
|
|
4544
|
-
|
|
4544
|
+
_chunkVMBQETG3js.isomorph_default.unlinkSync(this.cacheFilePath);
|
|
4545
4545
|
} catch (e16) {
|
|
4546
4546
|
}
|
|
4547
4547
|
this.cacheFilePath = null;
|
|
@@ -4654,7 +4654,7 @@ var BraintrustContextManager = class extends ContextManager {
|
|
|
4654
4654
|
|
|
4655
4655
|
constructor() {
|
|
4656
4656
|
super();
|
|
4657
|
-
this._currentSpan =
|
|
4657
|
+
this._currentSpan = _chunkVMBQETG3js.isomorph_default.newAsyncLocalStorage();
|
|
4658
4658
|
this[BRAINTRUST_CURRENT_SPAN_STORE] = this._currentSpan;
|
|
4659
4659
|
}
|
|
4660
4660
|
getParentSpanIds() {
|
|
@@ -4767,8 +4767,8 @@ var BraintrustState = (_class7 = class _BraintrustState {
|
|
|
4767
4767
|
this.id = `${(/* @__PURE__ */ new Date()).toLocaleString()}-${stateNonce++}`;
|
|
4768
4768
|
this.currentExperiment = void 0;
|
|
4769
4769
|
this.currentLogger = void 0;
|
|
4770
|
-
this.currentParent =
|
|
4771
|
-
this.currentSpan =
|
|
4770
|
+
this.currentParent = _chunkVMBQETG3js.isomorph_default.newAsyncLocalStorage();
|
|
4771
|
+
this.currentSpan = _chunkVMBQETG3js.isomorph_default.newAsyncLocalStorage();
|
|
4772
4772
|
if (loginParams.fetch) {
|
|
4773
4773
|
this.fetch = loginParams.fetch;
|
|
4774
4774
|
}
|
|
@@ -4794,7 +4794,7 @@ var BraintrustState = (_class7 = class _BraintrustState {
|
|
|
4794
4794
|
memoryMaxEnvVar: "BRAINTRUST_PROMPT_CACHE_MEMORY_MAX",
|
|
4795
4795
|
diskCacheDirEnvVar: "BRAINTRUST_PROMPT_CACHE_DIR",
|
|
4796
4796
|
diskMaxEnvVar: "BRAINTRUST_PROMPT_CACHE_DISK_MAX",
|
|
4797
|
-
getDefaultDiskCacheDir: () => `${_nullishCoalesce(
|
|
4797
|
+
getDefaultDiskCacheDir: () => `${_nullishCoalesce(_chunkVMBQETG3js.isomorph_default.getEnv("HOME"), () => ( _chunkVMBQETG3js.isomorph_default.homedir()))}/.braintrust/prompt_cache`
|
|
4798
4798
|
});
|
|
4799
4799
|
this.promptCache = new PromptCache({ memoryCache, diskCache });
|
|
4800
4800
|
const {
|
|
@@ -4804,7 +4804,7 @@ var BraintrustState = (_class7 = class _BraintrustState {
|
|
|
4804
4804
|
memoryMaxEnvVar: "BRAINTRUST_PARAMETERS_CACHE_MEMORY_MAX",
|
|
4805
4805
|
diskCacheDirEnvVar: "BRAINTRUST_PARAMETERS_CACHE_DIR",
|
|
4806
4806
|
diskMaxEnvVar: "BRAINTRUST_PARAMETERS_CACHE_DISK_MAX",
|
|
4807
|
-
getDefaultDiskCacheDir: () => `${_nullishCoalesce(
|
|
4807
|
+
getDefaultDiskCacheDir: () => `${_nullishCoalesce(_chunkVMBQETG3js.isomorph_default.getEnv("HOME"), () => ( _chunkVMBQETG3js.isomorph_default.homedir()))}/.braintrust/parameters_cache`
|
|
4808
4808
|
});
|
|
4809
4809
|
this.parametersCache = new ParametersCache({
|
|
4810
4810
|
memoryCache: parametersMemoryCache,
|
|
@@ -5445,7 +5445,7 @@ var Attachment = class extends BaseAttachment {
|
|
|
5445
5445
|
initData(data) {
|
|
5446
5446
|
if (typeof data === "string") {
|
|
5447
5447
|
this.ensureFileReadable(data);
|
|
5448
|
-
const readFile2 =
|
|
5448
|
+
const readFile2 = _chunkVMBQETG3js.isomorph_default.readFile;
|
|
5449
5449
|
if (!readFile2) {
|
|
5450
5450
|
throw new Error(
|
|
5451
5451
|
`This platform does not support reading the filesystem. Construct the Attachment
|
|
@@ -5458,7 +5458,7 @@ with a Blob/ArrayBuffer, or run the program on Node.js.`
|
|
|
5458
5458
|
}
|
|
5459
5459
|
}
|
|
5460
5460
|
ensureFileReadable(data) {
|
|
5461
|
-
const statSync2 =
|
|
5461
|
+
const statSync2 = _chunkVMBQETG3js.isomorph_default.statSync;
|
|
5462
5462
|
if (!statSync2) {
|
|
5463
5463
|
throw new Error(
|
|
5464
5464
|
`This platform does not support reading the filesystem. Construct the Attachment
|
|
@@ -5846,10 +5846,10 @@ function getErrPermlink(msg) {
|
|
|
5846
5846
|
return `${ERR_PERMALINK}?msg=${encodeURIComponent(msg)}`;
|
|
5847
5847
|
}
|
|
5848
5848
|
function _getAppUrl(appUrl) {
|
|
5849
|
-
return appUrl ||
|
|
5849
|
+
return appUrl || _chunkVMBQETG3js.isomorph_default.getEnv("BRAINTRUST_APP_URL") || "https://www.braintrust.dev";
|
|
5850
5850
|
}
|
|
5851
5851
|
function _getOrgName(orgName) {
|
|
5852
|
-
return orgName ||
|
|
5852
|
+
return orgName || _chunkVMBQETG3js.isomorph_default.getEnv("BRAINTRUST_ORG_NAME") || void 0;
|
|
5853
5853
|
}
|
|
5854
5854
|
function _getLinkBaseUrl(state, linkArgs) {
|
|
5855
5855
|
const appUrl = _getAppUrl(state.appUrl || _optionalChain([linkArgs, 'optionalAccess', _69 => _69.app_url]));
|
|
@@ -6333,62 +6333,62 @@ var HTTPBackgroundLogger = (_class10 = class _HTTPBackgroundLogger {
|
|
|
6333
6333
|
constructor(apiConn, opts) {;_class10.prototype.__init38.call(this);_class10.prototype.__init39.call(this);_class10.prototype.__init40.call(this);_class10.prototype.__init41.call(this);_class10.prototype.__init42.call(this);_class10.prototype.__init43.call(this);_class10.prototype.__init44.call(this);_class10.prototype.__init45.call(this);_class10.prototype.__init46.call(this);_class10.prototype.__init47.call(this);_class10.prototype.__init48.call(this);_class10.prototype.__init49.call(this);_class10.prototype.__init50.call(this);_class10.prototype.__init51.call(this);_class10.prototype.__init52.call(this);_class10.prototype.__init53.call(this);_class10.prototype.__init54.call(this);
|
|
6334
6334
|
opts = _nullishCoalesce(opts, () => ( {}));
|
|
6335
6335
|
this.apiConn = apiConn;
|
|
6336
|
-
const syncFlushEnv = Number(
|
|
6336
|
+
const syncFlushEnv = Number(_chunkVMBQETG3js.isomorph_default.getEnv("BRAINTRUST_SYNC_FLUSH"));
|
|
6337
6337
|
if (!isNaN(syncFlushEnv)) {
|
|
6338
6338
|
this.syncFlush = Boolean(syncFlushEnv);
|
|
6339
6339
|
}
|
|
6340
6340
|
const defaultBatchSizeEnv = Number(
|
|
6341
|
-
|
|
6341
|
+
_chunkVMBQETG3js.isomorph_default.getEnv("BRAINTRUST_DEFAULT_BATCH_SIZE")
|
|
6342
6342
|
);
|
|
6343
6343
|
if (!isNaN(defaultBatchSizeEnv)) {
|
|
6344
6344
|
this.defaultBatchSize = defaultBatchSizeEnv;
|
|
6345
6345
|
}
|
|
6346
|
-
const maxRequestSizeEnv = Number(
|
|
6346
|
+
const maxRequestSizeEnv = Number(_chunkVMBQETG3js.isomorph_default.getEnv("BRAINTRUST_MAX_REQUEST_SIZE"));
|
|
6347
6347
|
if (!isNaN(maxRequestSizeEnv)) {
|
|
6348
6348
|
this.maxRequestSizeOverride = maxRequestSizeEnv;
|
|
6349
6349
|
}
|
|
6350
|
-
const numTriesEnv = Number(
|
|
6350
|
+
const numTriesEnv = Number(_chunkVMBQETG3js.isomorph_default.getEnv("BRAINTRUST_NUM_RETRIES"));
|
|
6351
6351
|
if (!isNaN(numTriesEnv)) {
|
|
6352
6352
|
this.numTries = numTriesEnv + 1;
|
|
6353
6353
|
}
|
|
6354
6354
|
const queueDropExceedingMaxsizeEnv = Number(
|
|
6355
|
-
|
|
6355
|
+
_chunkVMBQETG3js.isomorph_default.getEnv("BRAINTRUST_QUEUE_DROP_EXCEEDING_MAXSIZE")
|
|
6356
6356
|
);
|
|
6357
6357
|
if (!isNaN(queueDropExceedingMaxsizeEnv)) {
|
|
6358
6358
|
this.queueDropExceedingMaxsize = queueDropExceedingMaxsizeEnv;
|
|
6359
6359
|
}
|
|
6360
6360
|
this.queue = new Queue(this.queueDropExceedingMaxsize);
|
|
6361
6361
|
const queueDropLoggingPeriodEnv = Number(
|
|
6362
|
-
|
|
6362
|
+
_chunkVMBQETG3js.isomorph_default.getEnv("BRAINTRUST_QUEUE_DROP_LOGGING_PERIOD")
|
|
6363
6363
|
);
|
|
6364
6364
|
if (!isNaN(queueDropLoggingPeriodEnv)) {
|
|
6365
6365
|
this.queueDropLoggingPeriod = queueDropLoggingPeriodEnv;
|
|
6366
6366
|
}
|
|
6367
|
-
if (
|
|
6367
|
+
if (_chunkVMBQETG3js.isomorph_default.getEnv("BRAINTRUST_LOG_FLUSH_CHUNK_SIZE")) {
|
|
6368
6368
|
debugLogger.warn(
|
|
6369
6369
|
"BRAINTRUST_LOG_FLUSH_CHUNK_SIZE is deprecated and no longer has any effect. Log flushing now sends all items at once and batches them automatically. This environment variable will be removed in a future major release."
|
|
6370
6370
|
);
|
|
6371
6371
|
}
|
|
6372
6372
|
const flushBackpressureBytesEnv = Number(
|
|
6373
|
-
|
|
6373
|
+
_chunkVMBQETG3js.isomorph_default.getEnv("BRAINTRUST_FLUSH_BACKPRESSURE_BYTES")
|
|
6374
6374
|
);
|
|
6375
6375
|
if (!isNaN(flushBackpressureBytesEnv) && flushBackpressureBytesEnv > 0) {
|
|
6376
6376
|
this._flushBackpressureBytes = flushBackpressureBytesEnv;
|
|
6377
6377
|
}
|
|
6378
|
-
const failedPublishPayloadsDirEnv =
|
|
6378
|
+
const failedPublishPayloadsDirEnv = _chunkVMBQETG3js.isomorph_default.getEnv(
|
|
6379
6379
|
"BRAINTRUST_FAILED_PUBLISH_PAYLOADS_DIR"
|
|
6380
6380
|
);
|
|
6381
6381
|
if (failedPublishPayloadsDirEnv) {
|
|
6382
6382
|
this.failedPublishPayloadsDir = failedPublishPayloadsDirEnv;
|
|
6383
6383
|
}
|
|
6384
|
-
const allPublishPayloadsDirEnv =
|
|
6384
|
+
const allPublishPayloadsDirEnv = _chunkVMBQETG3js.isomorph_default.getEnv(
|
|
6385
6385
|
"BRAINTRUST_ALL_PUBLISH_PAYLOADS_DIR"
|
|
6386
6386
|
);
|
|
6387
6387
|
if (allPublishPayloadsDirEnv) {
|
|
6388
6388
|
this.allPublishPayloadsDir = allPublishPayloadsDirEnv;
|
|
6389
6389
|
}
|
|
6390
6390
|
if (!opts.noExitFlush) {
|
|
6391
|
-
|
|
6391
|
+
_chunkVMBQETG3js.isomorph_default.processOn("beforeExit", async () => {
|
|
6392
6392
|
await this.flush();
|
|
6393
6393
|
});
|
|
6394
6394
|
}
|
|
@@ -6746,19 +6746,19 @@ Error: ${errorText}`;
|
|
|
6746
6746
|
payloadDir,
|
|
6747
6747
|
payload
|
|
6748
6748
|
}) {
|
|
6749
|
-
if (!(
|
|
6749
|
+
if (!(_chunkVMBQETG3js.isomorph_default.pathJoin && _chunkVMBQETG3js.isomorph_default.mkdir && _chunkVMBQETG3js.isomorph_default.writeFile)) {
|
|
6750
6750
|
debugLogger.warn(
|
|
6751
6751
|
"Cannot dump payloads: filesystem-operations not supported on this platform"
|
|
6752
6752
|
);
|
|
6753
6753
|
return;
|
|
6754
6754
|
}
|
|
6755
|
-
const payloadFile =
|
|
6755
|
+
const payloadFile = _chunkVMBQETG3js.isomorph_default.pathJoin(
|
|
6756
6756
|
payloadDir,
|
|
6757
6757
|
`payload_${getCurrentUnixTimestamp()}_${_uuid.v4.call(void 0, ).slice(0, 8)}.json`
|
|
6758
6758
|
);
|
|
6759
6759
|
try {
|
|
6760
|
-
await
|
|
6761
|
-
await
|
|
6760
|
+
await _chunkVMBQETG3js.isomorph_default.mkdir(payloadDir, { recursive: true });
|
|
6761
|
+
await _chunkVMBQETG3js.isomorph_default.writeFile(payloadFile, payload);
|
|
6762
6762
|
} catch (e) {
|
|
6763
6763
|
debugLogger.error(
|
|
6764
6764
|
`Failed to write failed payload to output file ${payloadFile}:
|
|
@@ -6940,7 +6940,7 @@ function init(projectOrOptions, optionalOptions) {
|
|
|
6940
6940
|
state.gitMetadataSettings,
|
|
6941
6941
|
_nullishCoalesce(gitMetadataSettings, () => ( { collect: "all" }))
|
|
6942
6942
|
);
|
|
6943
|
-
return await
|
|
6943
|
+
return await _chunkVMBQETG3js.isomorph_default.getRepoInfo(mergedGitMetadataSettings);
|
|
6944
6944
|
})();
|
|
6945
6945
|
if (repoInfoArg) {
|
|
6946
6946
|
args["repo_info"] = repoInfoArg;
|
|
@@ -6950,7 +6950,7 @@ function init(projectOrOptions, optionalOptions) {
|
|
|
6950
6950
|
} else if (baseExperiment) {
|
|
6951
6951
|
args["base_experiment"] = baseExperiment;
|
|
6952
6952
|
} else {
|
|
6953
|
-
args["ancestor_commits"] = await
|
|
6953
|
+
args["ancestor_commits"] = await _chunkVMBQETG3js.isomorph_default.getPastNAncestors();
|
|
6954
6954
|
}
|
|
6955
6955
|
if (dataset !== void 0) {
|
|
6956
6956
|
const datasetSelection = await serializeDatasetForExperiment({
|
|
@@ -7662,13 +7662,13 @@ async function login(options = {}) {
|
|
|
7662
7662
|
}
|
|
7663
7663
|
async function loginToState(options = {}) {
|
|
7664
7664
|
const {
|
|
7665
|
-
appUrl =
|
|
7665
|
+
appUrl = _chunkVMBQETG3js.isomorph_default.getEnv("BRAINTRUST_APP_URL") || "https://www.braintrust.dev",
|
|
7666
7666
|
apiKey: apiKeyArg,
|
|
7667
|
-
orgName =
|
|
7667
|
+
orgName = _chunkVMBQETG3js.isomorph_default.getEnv("BRAINTRUST_ORG_NAME"),
|
|
7668
7668
|
fetch: fetch2 = globalThis.fetch
|
|
7669
7669
|
} = options || {};
|
|
7670
|
-
const apiKey = apiKeyArg !== void 0 ? apiKeyArg : await
|
|
7671
|
-
const appPublicUrl =
|
|
7670
|
+
const apiKey = apiKeyArg !== void 0 ? apiKeyArg : await _chunkVMBQETG3js.isomorph_default.getBraintrustApiKey();
|
|
7671
|
+
const appPublicUrl = _chunkVMBQETG3js.isomorph_default.getEnv("BRAINTRUST_APP_PUBLIC_URL") || appUrl;
|
|
7672
7672
|
const state = new BraintrustState(options);
|
|
7673
7673
|
state.resetLoginInfo();
|
|
7674
7674
|
state.appUrl = appUrl;
|
|
@@ -7833,7 +7833,7 @@ function wrapTracedSyncGenerator(fn, spanArgs, noTraceIO) {
|
|
|
7833
7833
|
if (!noTraceIO) {
|
|
7834
7834
|
span.log({ input: fnArgs });
|
|
7835
7835
|
}
|
|
7836
|
-
const envValue =
|
|
7836
|
+
const envValue = _chunkVMBQETG3js.isomorph_default.getEnv("BRAINTRUST_MAX_GENERATOR_ITEMS");
|
|
7837
7837
|
const maxItems = envValue !== void 0 ? Number(envValue) : 1e3;
|
|
7838
7838
|
if (!noTraceIO && maxItems !== 0) {
|
|
7839
7839
|
let collected = [];
|
|
@@ -7882,7 +7882,7 @@ function wrapTracedAsyncGenerator(fn, spanArgs, noTraceIO) {
|
|
|
7882
7882
|
if (!noTraceIO) {
|
|
7883
7883
|
span.log({ input: fnArgs });
|
|
7884
7884
|
}
|
|
7885
|
-
const envValue =
|
|
7885
|
+
const envValue = _chunkVMBQETG3js.isomorph_default.getEnv("BRAINTRUST_MAX_GENERATOR_ITEMS");
|
|
7886
7886
|
const maxItems = envValue !== void 0 ? Number(envValue) : 1e3;
|
|
7887
7887
|
if (!noTraceIO && maxItems !== 0) {
|
|
7888
7888
|
let collected = [];
|
|
@@ -8084,8 +8084,8 @@ function _saveOrgInfo(state, org_info, org_name) {
|
|
|
8084
8084
|
if (org_name === void 0 || org.name === org_name) {
|
|
8085
8085
|
state.orgId = org.id;
|
|
8086
8086
|
state.orgName = org.name;
|
|
8087
|
-
state.apiUrl = _nullishCoalesce(
|
|
8088
|
-
state.proxyUrl = _nullishCoalesce(
|
|
8087
|
+
state.apiUrl = _nullishCoalesce(_chunkVMBQETG3js.isomorph_default.getEnv("BRAINTRUST_API_URL"), () => ( org.api_url));
|
|
8088
|
+
state.proxyUrl = _nullishCoalesce(_chunkVMBQETG3js.isomorph_default.getEnv("BRAINTRUST_PROXY_URL"), () => ( org.proxy_url));
|
|
8089
8089
|
state.gitMetadataSettings = org.git_metadata || void 0;
|
|
8090
8090
|
break;
|
|
8091
8091
|
}
|
|
@@ -8813,7 +8813,7 @@ var SpanImpl = (_class13 = class _SpanImpl {
|
|
|
8813
8813
|
mergeDicts(rawEvent, this.propagatedEvent);
|
|
8814
8814
|
}
|
|
8815
8815
|
const { id: eventId, ...event } = rawEvent;
|
|
8816
|
-
const callerLocation =
|
|
8816
|
+
const callerLocation = _chunkVMBQETG3js.isomorph_default.getCallerLocation();
|
|
8817
8817
|
const name = (() => {
|
|
8818
8818
|
if (args.name) return args.name;
|
|
8819
8819
|
if (!args.parentSpanIds) return "root";
|
|
@@ -10049,7 +10049,7 @@ var _exportsForTestingOnly = {
|
|
|
10049
10049
|
isAsyncGeneratorFunction,
|
|
10050
10050
|
resetIdGenStateForTests,
|
|
10051
10051
|
validateTags,
|
|
10052
|
-
isomorph:
|
|
10052
|
+
isomorph: _chunkVMBQETG3js.isomorph_default
|
|
10053
10053
|
// Expose isomorph for build type detection
|
|
10054
10054
|
};
|
|
10055
10055
|
|
|
@@ -10342,7 +10342,7 @@ var BasePlugin = (_class17 = class {constructor() { _class17.prototype.__init63.
|
|
|
10342
10342
|
* @param handlers - Event handlers
|
|
10343
10343
|
*/
|
|
10344
10344
|
subscribe(channelName, handlers) {
|
|
10345
|
-
const channel =
|
|
10345
|
+
const channel = _chunkVMBQETG3js.isomorph_default.newTracingChannel(channelName);
|
|
10346
10346
|
channel.subscribe(handlers);
|
|
10347
10347
|
}
|
|
10348
10348
|
/**
|
|
@@ -10350,7 +10350,7 @@ var BasePlugin = (_class17 = class {constructor() { _class17.prototype.__init63.
|
|
|
10350
10350
|
* Creates a span and logs input/output/metrics.
|
|
10351
10351
|
*/
|
|
10352
10352
|
subscribeToChannel(channelName, config) {
|
|
10353
|
-
const channel =
|
|
10353
|
+
const channel = _chunkVMBQETG3js.isomorph_default.newTracingChannel(channelName);
|
|
10354
10354
|
const spans = /* @__PURE__ */ new WeakMap();
|
|
10355
10355
|
const handlers = {
|
|
10356
10356
|
start: (event) => {
|
|
@@ -10419,7 +10419,7 @@ var BasePlugin = (_class17 = class {constructor() { _class17.prototype.__init63.
|
|
|
10419
10419
|
* Handles both streaming and non-streaming responses.
|
|
10420
10420
|
*/
|
|
10421
10421
|
subscribeToStreamingChannel(channelName, config) {
|
|
10422
|
-
const channel =
|
|
10422
|
+
const channel = _chunkVMBQETG3js.isomorph_default.newTracingChannel(channelName);
|
|
10423
10423
|
const spans = /* @__PURE__ */ new WeakMap();
|
|
10424
10424
|
const handlers = {
|
|
10425
10425
|
start: (event) => {
|
|
@@ -10546,7 +10546,7 @@ var BasePlugin = (_class17 = class {constructor() { _class17.prototype.__init63.
|
|
|
10546
10546
|
* Used for methods like beta.chat.completions.stream() and responses.stream().
|
|
10547
10547
|
*/
|
|
10548
10548
|
subscribeToSyncStreamChannel(channelName, config) {
|
|
10549
|
-
const channel =
|
|
10549
|
+
const channel = _chunkVMBQETG3js.isomorph_default.newTracingChannel(channelName);
|
|
10550
10550
|
const spans = /* @__PURE__ */ new WeakMap();
|
|
10551
10551
|
const handlers = {
|
|
10552
10552
|
start: (event) => {
|
|
@@ -11320,7 +11320,7 @@ var OpenAIPlugin = class extends BasePlugin {
|
|
|
11320
11320
|
}
|
|
11321
11321
|
onEnable() {
|
|
11322
11322
|
this.unsubscribers.push(
|
|
11323
|
-
traceStreamingChannel(
|
|
11323
|
+
traceStreamingChannel(_chunkVMBQETG3js.openAIChannels.chatCompletionsCreate, {
|
|
11324
11324
|
name: "Chat Completion",
|
|
11325
11325
|
type: "llm" /* LLM */,
|
|
11326
11326
|
extractInput: ([params]) => {
|
|
@@ -11348,7 +11348,7 @@ var OpenAIPlugin = class extends BasePlugin {
|
|
|
11348
11348
|
})
|
|
11349
11349
|
);
|
|
11350
11350
|
this.unsubscribers.push(
|
|
11351
|
-
traceAsyncChannel(
|
|
11351
|
+
traceAsyncChannel(_chunkVMBQETG3js.openAIChannels.embeddingsCreate, {
|
|
11352
11352
|
name: "Embedding",
|
|
11353
11353
|
type: "llm" /* LLM */,
|
|
11354
11354
|
extractInput: ([params]) => {
|
|
@@ -11372,7 +11372,7 @@ var OpenAIPlugin = class extends BasePlugin {
|
|
|
11372
11372
|
})
|
|
11373
11373
|
);
|
|
11374
11374
|
this.unsubscribers.push(
|
|
11375
|
-
traceStreamingChannel(
|
|
11375
|
+
traceStreamingChannel(_chunkVMBQETG3js.openAIChannels.betaChatCompletionsParse, {
|
|
11376
11376
|
name: "Chat Completion",
|
|
11377
11377
|
type: "llm" /* LLM */,
|
|
11378
11378
|
extractInput: ([params]) => {
|
|
@@ -11400,7 +11400,7 @@ var OpenAIPlugin = class extends BasePlugin {
|
|
|
11400
11400
|
})
|
|
11401
11401
|
);
|
|
11402
11402
|
this.unsubscribers.push(
|
|
11403
|
-
traceSyncStreamChannel(
|
|
11403
|
+
traceSyncStreamChannel(_chunkVMBQETG3js.openAIChannels.betaChatCompletionsStream, {
|
|
11404
11404
|
name: "Chat Completion",
|
|
11405
11405
|
type: "llm" /* LLM */,
|
|
11406
11406
|
extractInput: ([params]) => {
|
|
@@ -11413,7 +11413,7 @@ var OpenAIPlugin = class extends BasePlugin {
|
|
|
11413
11413
|
})
|
|
11414
11414
|
);
|
|
11415
11415
|
this.unsubscribers.push(
|
|
11416
|
-
traceAsyncChannel(
|
|
11416
|
+
traceAsyncChannel(_chunkVMBQETG3js.openAIChannels.moderationsCreate, {
|
|
11417
11417
|
name: "Moderation",
|
|
11418
11418
|
type: "llm" /* LLM */,
|
|
11419
11419
|
extractInput: ([params]) => {
|
|
@@ -11436,7 +11436,7 @@ var OpenAIPlugin = class extends BasePlugin {
|
|
|
11436
11436
|
})
|
|
11437
11437
|
);
|
|
11438
11438
|
this.unsubscribers.push(
|
|
11439
|
-
traceStreamingChannel(
|
|
11439
|
+
traceStreamingChannel(_chunkVMBQETG3js.openAIChannels.responsesCreate, {
|
|
11440
11440
|
name: "openai.responses.create",
|
|
11441
11441
|
type: "llm" /* LLM */,
|
|
11442
11442
|
extractInput: ([params]) => {
|
|
@@ -11471,7 +11471,7 @@ var OpenAIPlugin = class extends BasePlugin {
|
|
|
11471
11471
|
})
|
|
11472
11472
|
);
|
|
11473
11473
|
this.unsubscribers.push(
|
|
11474
|
-
traceSyncStreamChannel(
|
|
11474
|
+
traceSyncStreamChannel(_chunkVMBQETG3js.openAIChannels.responsesStream, {
|
|
11475
11475
|
name: "openai.responses.create",
|
|
11476
11476
|
type: "llm" /* LLM */,
|
|
11477
11477
|
extractInput: ([params]) => {
|
|
@@ -11500,7 +11500,7 @@ var OpenAIPlugin = class extends BasePlugin {
|
|
|
11500
11500
|
})
|
|
11501
11501
|
);
|
|
11502
11502
|
this.unsubscribers.push(
|
|
11503
|
-
traceStreamingChannel(
|
|
11503
|
+
traceStreamingChannel(_chunkVMBQETG3js.openAIChannels.responsesParse, {
|
|
11504
11504
|
name: "openai.responses.parse",
|
|
11505
11505
|
type: "llm" /* LLM */,
|
|
11506
11506
|
extractInput: ([params]) => {
|
|
@@ -11535,7 +11535,7 @@ var OpenAIPlugin = class extends BasePlugin {
|
|
|
11535
11535
|
})
|
|
11536
11536
|
);
|
|
11537
11537
|
this.unsubscribers.push(
|
|
11538
|
-
traceAsyncChannel(
|
|
11538
|
+
traceAsyncChannel(_chunkVMBQETG3js.openAIChannels.responsesCompact, {
|
|
11539
11539
|
name: "openai.responses.compact",
|
|
11540
11540
|
type: "llm" /* LLM */,
|
|
11541
11541
|
extractInput: ([params]) => {
|
|
@@ -11786,7 +11786,7 @@ var OpenAICodexPlugin = class extends BasePlugin {
|
|
|
11786
11786
|
this.unsubscribers = [];
|
|
11787
11787
|
}
|
|
11788
11788
|
subscribeToRun() {
|
|
11789
|
-
const channel =
|
|
11789
|
+
const channel = _chunkVMBQETG3js.openAICodexChannels.run.tracingChannel();
|
|
11790
11790
|
const states = /* @__PURE__ */ new WeakMap();
|
|
11791
11791
|
const handlers = {
|
|
11792
11792
|
start: (event) => {
|
|
@@ -11815,7 +11815,7 @@ var OpenAICodexPlugin = class extends BasePlugin {
|
|
|
11815
11815
|
});
|
|
11816
11816
|
}
|
|
11817
11817
|
subscribeToRunStreamed() {
|
|
11818
|
-
const channel =
|
|
11818
|
+
const channel = _chunkVMBQETG3js.openAICodexChannels.runStreamed.tracingChannel();
|
|
11819
11819
|
const states = /* @__PURE__ */ new WeakMap();
|
|
11820
11820
|
const handlers = {
|
|
11821
11821
|
start: (event) => {
|
|
@@ -12466,17 +12466,17 @@ var AnthropicPlugin = class extends BasePlugin {
|
|
|
12466
12466
|
aggregateChunks: (chunks) => aggregateAnthropicStreamChunks(chunks)
|
|
12467
12467
|
};
|
|
12468
12468
|
this.unsubscribers.push(
|
|
12469
|
-
traceStreamingChannel(
|
|
12469
|
+
traceStreamingChannel(_chunkVMBQETG3js.anthropicChannels.messagesCreate, anthropicConfig)
|
|
12470
12470
|
);
|
|
12471
12471
|
this.unsubscribers.push(
|
|
12472
|
-
traceStreamingChannel(
|
|
12472
|
+
traceStreamingChannel(_chunkVMBQETG3js.anthropicChannels.betaMessagesCreate, {
|
|
12473
12473
|
...anthropicConfig,
|
|
12474
12474
|
name: "anthropic.messages.create"
|
|
12475
12475
|
})
|
|
12476
12476
|
);
|
|
12477
12477
|
}
|
|
12478
12478
|
subscribeToAnthropicToolRunner() {
|
|
12479
|
-
const tracingChannel2 =
|
|
12479
|
+
const tracingChannel2 = _chunkVMBQETG3js.anthropicChannels.betaMessagesToolRunner.tracingChannel();
|
|
12480
12480
|
const states = /* @__PURE__ */ new WeakMap();
|
|
12481
12481
|
const handlers = {
|
|
12482
12482
|
start: (event) => {
|
|
@@ -13244,7 +13244,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13244
13244
|
subscribeToAISDK() {
|
|
13245
13245
|
const denyOutputPaths = this.config.denyOutputPaths || DEFAULT_DENY_OUTPUT_PATHS;
|
|
13246
13246
|
this.unsubscribers.push(
|
|
13247
|
-
traceStreamingChannel(
|
|
13247
|
+
traceStreamingChannel(_chunkVMBQETG3js.aiSDKChannels.generateText, {
|
|
13248
13248
|
name: "generateText",
|
|
13249
13249
|
type: "function" /* FUNCTION */,
|
|
13250
13250
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -13260,7 +13260,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13260
13260
|
})
|
|
13261
13261
|
);
|
|
13262
13262
|
this.unsubscribers.push(
|
|
13263
|
-
traceStreamingChannel(
|
|
13263
|
+
traceStreamingChannel(_chunkVMBQETG3js.aiSDKChannels.streamText, {
|
|
13264
13264
|
name: "streamText",
|
|
13265
13265
|
type: "function" /* FUNCTION */,
|
|
13266
13266
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -13280,7 +13280,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13280
13280
|
})
|
|
13281
13281
|
);
|
|
13282
13282
|
this.unsubscribers.push(
|
|
13283
|
-
traceSyncStreamChannel(
|
|
13283
|
+
traceSyncStreamChannel(_chunkVMBQETG3js.aiSDKChannels.streamTextSync, {
|
|
13284
13284
|
name: "streamText",
|
|
13285
13285
|
type: "function" /* FUNCTION */,
|
|
13286
13286
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -13294,7 +13294,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13294
13294
|
})
|
|
13295
13295
|
);
|
|
13296
13296
|
this.unsubscribers.push(
|
|
13297
|
-
traceStreamingChannel(
|
|
13297
|
+
traceStreamingChannel(_chunkVMBQETG3js.aiSDKChannels.generateObject, {
|
|
13298
13298
|
name: "generateObject",
|
|
13299
13299
|
type: "function" /* FUNCTION */,
|
|
13300
13300
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -13310,7 +13310,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13310
13310
|
})
|
|
13311
13311
|
);
|
|
13312
13312
|
this.unsubscribers.push(
|
|
13313
|
-
traceStreamingChannel(
|
|
13313
|
+
traceStreamingChannel(_chunkVMBQETG3js.aiSDKChannels.streamObject, {
|
|
13314
13314
|
name: "streamObject",
|
|
13315
13315
|
type: "function" /* FUNCTION */,
|
|
13316
13316
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -13330,7 +13330,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13330
13330
|
})
|
|
13331
13331
|
);
|
|
13332
13332
|
this.unsubscribers.push(
|
|
13333
|
-
traceSyncStreamChannel(
|
|
13333
|
+
traceSyncStreamChannel(_chunkVMBQETG3js.aiSDKChannels.streamObjectSync, {
|
|
13334
13334
|
name: "streamObject",
|
|
13335
13335
|
type: "function" /* FUNCTION */,
|
|
13336
13336
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -13344,7 +13344,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13344
13344
|
})
|
|
13345
13345
|
);
|
|
13346
13346
|
this.unsubscribers.push(
|
|
13347
|
-
traceAsyncChannel(
|
|
13347
|
+
traceAsyncChannel(_chunkVMBQETG3js.aiSDKChannels.embed, {
|
|
13348
13348
|
name: "embed",
|
|
13349
13349
|
type: "function" /* FUNCTION */,
|
|
13350
13350
|
extractInput: ([params], event) => prepareAISDKEmbedInput(params, event.self),
|
|
@@ -13356,7 +13356,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13356
13356
|
})
|
|
13357
13357
|
);
|
|
13358
13358
|
this.unsubscribers.push(
|
|
13359
|
-
traceAsyncChannel(
|
|
13359
|
+
traceAsyncChannel(_chunkVMBQETG3js.aiSDKChannels.embedMany, {
|
|
13360
13360
|
name: "embedMany",
|
|
13361
13361
|
type: "function" /* FUNCTION */,
|
|
13362
13362
|
extractInput: ([params], event) => prepareAISDKEmbedInput(params, event.self),
|
|
@@ -13368,7 +13368,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13368
13368
|
})
|
|
13369
13369
|
);
|
|
13370
13370
|
this.unsubscribers.push(
|
|
13371
|
-
traceAsyncChannel(
|
|
13371
|
+
traceAsyncChannel(_chunkVMBQETG3js.aiSDKChannels.rerank, {
|
|
13372
13372
|
name: "rerank",
|
|
13373
13373
|
type: "function" /* FUNCTION */,
|
|
13374
13374
|
extractInput: ([params], event) => prepareAISDKRerankInput(params, event.self),
|
|
@@ -13380,7 +13380,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13380
13380
|
})
|
|
13381
13381
|
);
|
|
13382
13382
|
this.unsubscribers.push(
|
|
13383
|
-
traceStreamingChannel(
|
|
13383
|
+
traceStreamingChannel(_chunkVMBQETG3js.aiSDKChannels.agentGenerate, {
|
|
13384
13384
|
name: "Agent.generate",
|
|
13385
13385
|
type: "function" /* FUNCTION */,
|
|
13386
13386
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -13396,7 +13396,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13396
13396
|
})
|
|
13397
13397
|
);
|
|
13398
13398
|
this.unsubscribers.push(
|
|
13399
|
-
traceStreamingChannel(
|
|
13399
|
+
traceStreamingChannel(_chunkVMBQETG3js.aiSDKChannels.agentStream, {
|
|
13400
13400
|
name: "Agent.stream",
|
|
13401
13401
|
type: "function" /* FUNCTION */,
|
|
13402
13402
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -13416,7 +13416,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13416
13416
|
})
|
|
13417
13417
|
);
|
|
13418
13418
|
this.unsubscribers.push(
|
|
13419
|
-
traceSyncStreamChannel(
|
|
13419
|
+
traceSyncStreamChannel(_chunkVMBQETG3js.aiSDKChannels.agentStreamSync, {
|
|
13420
13420
|
name: "Agent.stream",
|
|
13421
13421
|
type: "function" /* FUNCTION */,
|
|
13422
13422
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -13430,7 +13430,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13430
13430
|
})
|
|
13431
13431
|
);
|
|
13432
13432
|
this.unsubscribers.push(
|
|
13433
|
-
traceStreamingChannel(
|
|
13433
|
+
traceStreamingChannel(_chunkVMBQETG3js.aiSDKChannels.toolLoopAgentGenerate, {
|
|
13434
13434
|
name: "ToolLoopAgent.generate",
|
|
13435
13435
|
type: "function" /* FUNCTION */,
|
|
13436
13436
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -13446,7 +13446,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13446
13446
|
})
|
|
13447
13447
|
);
|
|
13448
13448
|
this.unsubscribers.push(
|
|
13449
|
-
traceStreamingChannel(
|
|
13449
|
+
traceStreamingChannel(_chunkVMBQETG3js.aiSDKChannels.toolLoopAgentStream, {
|
|
13450
13450
|
name: "ToolLoopAgent.stream",
|
|
13451
13451
|
type: "function" /* FUNCTION */,
|
|
13452
13452
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -14854,7 +14854,7 @@ var LOCAL_TOOL_CONTEXT_ASYNC_ITERATOR_PATCHED = /* @__PURE__ */ Symbol.for(
|
|
|
14854
14854
|
"braintrust.claude_agent_sdk.local_tool_context_async_iterator_patched"
|
|
14855
14855
|
);
|
|
14856
14856
|
function createLocalToolContextStore() {
|
|
14857
|
-
const maybeIsoWithAsyncLocalStorage =
|
|
14857
|
+
const maybeIsoWithAsyncLocalStorage = _chunkVMBQETG3js.isomorph_default;
|
|
14858
14858
|
if (typeof maybeIsoWithAsyncLocalStorage.newAsyncLocalStorage === "function") {
|
|
14859
14859
|
return maybeIsoWithAsyncLocalStorage.newAsyncLocalStorage();
|
|
14860
14860
|
}
|
|
@@ -16031,7 +16031,7 @@ var ClaudeAgentSDKPlugin = class extends BasePlugin {
|
|
|
16031
16031
|
this.unsubscribers = [];
|
|
16032
16032
|
}
|
|
16033
16033
|
subscribeToQuery() {
|
|
16034
|
-
const channel =
|
|
16034
|
+
const channel = _chunkVMBQETG3js.claudeAgentSDKChannels.query.tracingChannel();
|
|
16035
16035
|
const spans = /* @__PURE__ */ new WeakMap();
|
|
16036
16036
|
const handlers = {
|
|
16037
16037
|
start: (event) => {
|
|
@@ -16264,8 +16264,8 @@ var CursorSDKPlugin = (_class18 = class extends BasePlugin {constructor(...args3
|
|
|
16264
16264
|
this.promptDepth = 0;
|
|
16265
16265
|
}
|
|
16266
16266
|
subscribeToAgentFactories() {
|
|
16267
|
-
this.subscribeToAgentFactory(
|
|
16268
|
-
this.subscribeToAgentFactory(
|
|
16267
|
+
this.subscribeToAgentFactory(_chunkVMBQETG3js.cursorSDKChannels.create);
|
|
16268
|
+
this.subscribeToAgentFactory(_chunkVMBQETG3js.cursorSDKChannels.resume);
|
|
16269
16269
|
}
|
|
16270
16270
|
subscribeToAgentFactory(channel) {
|
|
16271
16271
|
const tracingChannel2 = channel.tracingChannel();
|
|
@@ -16282,7 +16282,7 @@ var CursorSDKPlugin = (_class18 = class extends BasePlugin {constructor(...args3
|
|
|
16282
16282
|
});
|
|
16283
16283
|
}
|
|
16284
16284
|
subscribeToPrompt() {
|
|
16285
|
-
const channel =
|
|
16285
|
+
const channel = _chunkVMBQETG3js.cursorSDKChannels.prompt.tracingChannel();
|
|
16286
16286
|
const states = /* @__PURE__ */ new WeakMap();
|
|
16287
16287
|
const handlers = {
|
|
16288
16288
|
start: (event) => {
|
|
@@ -16343,7 +16343,7 @@ var CursorSDKPlugin = (_class18 = class extends BasePlugin {constructor(...args3
|
|
|
16343
16343
|
});
|
|
16344
16344
|
}
|
|
16345
16345
|
subscribeToSend() {
|
|
16346
|
-
const channel =
|
|
16346
|
+
const channel = _chunkVMBQETG3js.cursorSDKChannels.send.tracingChannel();
|
|
16347
16347
|
const states = /* @__PURE__ */ new WeakMap();
|
|
16348
16348
|
const handlers = {
|
|
16349
16349
|
start: (event) => {
|
|
@@ -16442,7 +16442,7 @@ function patchCursorAgentInPlace(agent) {
|
|
|
16442
16442
|
configurable: true,
|
|
16443
16443
|
value(message, options) {
|
|
16444
16444
|
const args = [message, options];
|
|
16445
|
-
return
|
|
16445
|
+
return _chunkVMBQETG3js.cursorSDKChannels.send.tracePromise(
|
|
16446
16446
|
() => originalSend(...args),
|
|
16447
16447
|
{
|
|
16448
16448
|
agent: agentRecord,
|
|
@@ -17491,7 +17491,7 @@ var OpenAIAgentsPlugin = (_class20 = class extends BasePlugin {constructor(...ar
|
|
|
17491
17491
|
void this.processor.shutdown();
|
|
17492
17492
|
}
|
|
17493
17493
|
subscribeToTraceLifecycle() {
|
|
17494
|
-
const traceStartChannel =
|
|
17494
|
+
const traceStartChannel = _chunkVMBQETG3js.openAIAgentsCoreChannels.onTraceStart.tracingChannel();
|
|
17495
17495
|
const traceStartHandlers = {
|
|
17496
17496
|
start: (event) => {
|
|
17497
17497
|
const trace = firstArgument(event.arguments);
|
|
@@ -17504,7 +17504,7 @@ var OpenAIAgentsPlugin = (_class20 = class extends BasePlugin {constructor(...ar
|
|
|
17504
17504
|
this.unsubscribers.push(
|
|
17505
17505
|
() => traceStartChannel.unsubscribe(traceStartHandlers)
|
|
17506
17506
|
);
|
|
17507
|
-
const traceEndChannel =
|
|
17507
|
+
const traceEndChannel = _chunkVMBQETG3js.openAIAgentsCoreChannels.onTraceEnd.tracingChannel();
|
|
17508
17508
|
const traceEndHandlers = {
|
|
17509
17509
|
start: (event) => {
|
|
17510
17510
|
const trace = firstArgument(event.arguments);
|
|
@@ -17517,7 +17517,7 @@ var OpenAIAgentsPlugin = (_class20 = class extends BasePlugin {constructor(...ar
|
|
|
17517
17517
|
this.unsubscribers.push(
|
|
17518
17518
|
() => traceEndChannel.unsubscribe(traceEndHandlers)
|
|
17519
17519
|
);
|
|
17520
|
-
const spanStartChannel =
|
|
17520
|
+
const spanStartChannel = _chunkVMBQETG3js.openAIAgentsCoreChannels.onSpanStart.tracingChannel();
|
|
17521
17521
|
const spanStartHandlers = {
|
|
17522
17522
|
start: (event) => {
|
|
17523
17523
|
const span = firstArgument(event.arguments);
|
|
@@ -17530,7 +17530,7 @@ var OpenAIAgentsPlugin = (_class20 = class extends BasePlugin {constructor(...ar
|
|
|
17530
17530
|
this.unsubscribers.push(
|
|
17531
17531
|
() => spanStartChannel.unsubscribe(spanStartHandlers)
|
|
17532
17532
|
);
|
|
17533
|
-
const spanEndChannel =
|
|
17533
|
+
const spanEndChannel = _chunkVMBQETG3js.openAIAgentsCoreChannels.onSpanEnd.tracingChannel();
|
|
17534
17534
|
const spanEndHandlers = {
|
|
17535
17535
|
start: (event) => {
|
|
17536
17536
|
const span = firstArgument(event.arguments);
|
|
@@ -17570,7 +17570,7 @@ var GoogleGenAIPlugin = class extends BasePlugin {
|
|
|
17570
17570
|
this.subscribeToEmbedContentChannel();
|
|
17571
17571
|
}
|
|
17572
17572
|
subscribeToGenerateContentChannel() {
|
|
17573
|
-
const tracingChannel2 =
|
|
17573
|
+
const tracingChannel2 = _chunkVMBQETG3js.googleGenAIChannels.generateContent.tracingChannel();
|
|
17574
17574
|
const states = /* @__PURE__ */ new WeakMap();
|
|
17575
17575
|
const unbindCurrentSpanStore = bindCurrentSpanStoreToStart2(
|
|
17576
17576
|
tracingChannel2,
|
|
@@ -17644,7 +17644,7 @@ var GoogleGenAIPlugin = class extends BasePlugin {
|
|
|
17644
17644
|
});
|
|
17645
17645
|
}
|
|
17646
17646
|
subscribeToGenerateContentStreamChannel() {
|
|
17647
|
-
const tracingChannel2 =
|
|
17647
|
+
const tracingChannel2 = _chunkVMBQETG3js.googleGenAIChannels.generateContentStream.tracingChannel();
|
|
17648
17648
|
const handlers = {
|
|
17649
17649
|
start: (event) => {
|
|
17650
17650
|
const streamEvent = event;
|
|
@@ -17671,7 +17671,7 @@ var GoogleGenAIPlugin = class extends BasePlugin {
|
|
|
17671
17671
|
});
|
|
17672
17672
|
}
|
|
17673
17673
|
subscribeToEmbedContentChannel() {
|
|
17674
|
-
const tracingChannel2 =
|
|
17674
|
+
const tracingChannel2 = _chunkVMBQETG3js.googleGenAIChannels.embedContent.tracingChannel();
|
|
17675
17675
|
const states = /* @__PURE__ */ new WeakMap();
|
|
17676
17676
|
const unbindCurrentSpanStore = bindCurrentSpanStoreToStart2(
|
|
17677
17677
|
tracingChannel2,
|
|
@@ -18316,7 +18316,7 @@ var RESPONSE_METADATA_ALLOWLIST = /* @__PURE__ */ new Set([
|
|
|
18316
18316
|
var HuggingFacePlugin = class extends BasePlugin {
|
|
18317
18317
|
onEnable() {
|
|
18318
18318
|
this.unsubscribers.push(
|
|
18319
|
-
traceAsyncChannel(
|
|
18319
|
+
traceAsyncChannel(_chunkVMBQETG3js.huggingFaceChannels.chatCompletion, {
|
|
18320
18320
|
name: "huggingface.chat_completion",
|
|
18321
18321
|
type: "llm" /* LLM */,
|
|
18322
18322
|
extractInput: extractChatInputWithMetadata,
|
|
@@ -18324,7 +18324,7 @@ var HuggingFacePlugin = class extends BasePlugin {
|
|
|
18324
18324
|
extractMetadata: (result) => extractResponseMetadata2(result),
|
|
18325
18325
|
extractMetrics: (result) => parseMetricsFromUsage(_optionalChain([result, 'optionalAccess', _396 => _396.usage]))
|
|
18326
18326
|
}),
|
|
18327
|
-
traceSyncStreamChannel(
|
|
18327
|
+
traceSyncStreamChannel(_chunkVMBQETG3js.huggingFaceChannels.chatCompletionStream, {
|
|
18328
18328
|
name: "huggingface.chat_completion_stream",
|
|
18329
18329
|
type: "llm" /* LLM */,
|
|
18330
18330
|
extractInput: extractChatInputWithMetadata,
|
|
@@ -18334,7 +18334,7 @@ var HuggingFacePlugin = class extends BasePlugin {
|
|
|
18334
18334
|
startTime
|
|
18335
18335
|
})
|
|
18336
18336
|
}),
|
|
18337
|
-
traceAsyncChannel(
|
|
18337
|
+
traceAsyncChannel(_chunkVMBQETG3js.huggingFaceChannels.textGeneration, {
|
|
18338
18338
|
name: "huggingface.text_generation",
|
|
18339
18339
|
type: "llm" /* LLM */,
|
|
18340
18340
|
extractInput: extractTextGenerationInputWithMetadata,
|
|
@@ -18342,7 +18342,7 @@ var HuggingFacePlugin = class extends BasePlugin {
|
|
|
18342
18342
|
extractMetadata: extractTextGenerationMetadata,
|
|
18343
18343
|
extractMetrics: (result) => extractTextGenerationMetrics(_nullishCoalesce(_optionalChain([result, 'optionalAccess', _397 => _397.details]), () => ( null)))
|
|
18344
18344
|
}),
|
|
18345
|
-
traceSyncStreamChannel(
|
|
18345
|
+
traceSyncStreamChannel(_chunkVMBQETG3js.huggingFaceChannels.textGenerationStream, {
|
|
18346
18346
|
name: "huggingface.text_generation_stream",
|
|
18347
18347
|
type: "llm" /* LLM */,
|
|
18348
18348
|
extractInput: extractTextGenerationInputWithMetadata,
|
|
@@ -18352,7 +18352,7 @@ var HuggingFacePlugin = class extends BasePlugin {
|
|
|
18352
18352
|
startTime
|
|
18353
18353
|
})
|
|
18354
18354
|
}),
|
|
18355
|
-
traceAsyncChannel(
|
|
18355
|
+
traceAsyncChannel(_chunkVMBQETG3js.huggingFaceChannels.featureExtraction, {
|
|
18356
18356
|
name: "huggingface.feature_extraction",
|
|
18357
18357
|
type: "llm" /* LLM */,
|
|
18358
18358
|
extractInput: extractFeatureExtractionInputWithMetadata,
|
|
@@ -18725,7 +18725,7 @@ var OpenRouterAgentPlugin = class extends BasePlugin {
|
|
|
18725
18725
|
}
|
|
18726
18726
|
subscribeToOpenRouterAgentChannels() {
|
|
18727
18727
|
this.unsubscribers.push(
|
|
18728
|
-
traceSyncStreamChannel(
|
|
18728
|
+
traceSyncStreamChannel(_chunkVMBQETG3js.openRouterAgentChannels.callModel, {
|
|
18729
18729
|
name: "openrouter.callModel",
|
|
18730
18730
|
type: "task" /* TASK */,
|
|
18731
18731
|
extractInput: (args) => {
|
|
@@ -18745,7 +18745,7 @@ var OpenRouterAgentPlugin = class extends BasePlugin {
|
|
|
18745
18745
|
})
|
|
18746
18746
|
);
|
|
18747
18747
|
this.unsubscribers.push(
|
|
18748
|
-
traceAsyncChannel(
|
|
18748
|
+
traceAsyncChannel(_chunkVMBQETG3js.openRouterAgentChannels.callModelTurn, {
|
|
18749
18749
|
name: "openrouter.beta.responses.send",
|
|
18750
18750
|
type: "llm" /* LLM */,
|
|
18751
18751
|
extractInput: (args, event) => {
|
|
@@ -18781,7 +18781,7 @@ var OpenRouterAgentPlugin = class extends BasePlugin {
|
|
|
18781
18781
|
})
|
|
18782
18782
|
);
|
|
18783
18783
|
this.unsubscribers.push(
|
|
18784
|
-
traceStreamingChannel(
|
|
18784
|
+
traceStreamingChannel(_chunkVMBQETG3js.openRouterAgentChannels.toolExecute, {
|
|
18785
18785
|
name: "openrouter.tool",
|
|
18786
18786
|
type: "tool" /* TOOL */,
|
|
18787
18787
|
extractInput: (args, event) => ({
|
|
@@ -18800,7 +18800,7 @@ var OpenRouterAgentPlugin = class extends BasePlugin {
|
|
|
18800
18800
|
})
|
|
18801
18801
|
})
|
|
18802
18802
|
);
|
|
18803
|
-
const callModelChannel =
|
|
18803
|
+
const callModelChannel = _chunkVMBQETG3js.openRouterAgentChannels.callModel.tracingChannel();
|
|
18804
18804
|
const callModelHandlers = {
|
|
18805
18805
|
start: (event) => {
|
|
18806
18806
|
const request = getOpenRouterCallModelRequestArg(event.arguments);
|
|
@@ -19094,7 +19094,7 @@ function isWrappedTool(tool) {
|
|
|
19094
19094
|
return Boolean(tool[OPENROUTER_WRAPPED_TOOL]);
|
|
19095
19095
|
}
|
|
19096
19096
|
function traceToolExecution(args) {
|
|
19097
|
-
const tracingChannel2 =
|
|
19097
|
+
const tracingChannel2 = _chunkVMBQETG3js.openRouterAgentChannels.toolExecute.tracingChannel();
|
|
19098
19098
|
const input = args.args.length > 0 ? args.args[0] : void 0;
|
|
19099
19099
|
const event = {
|
|
19100
19100
|
arguments: [input],
|
|
@@ -19351,7 +19351,7 @@ async function traceOpenRouterCallModelTurn(args) {
|
|
|
19351
19351
|
};
|
|
19352
19352
|
return await withCurrent(
|
|
19353
19353
|
args.parentSpan,
|
|
19354
|
-
() =>
|
|
19354
|
+
() => _chunkVMBQETG3js.openRouterAgentChannels.callModelTurn.tracePromise(args.fn, context)
|
|
19355
19355
|
);
|
|
19356
19356
|
}
|
|
19357
19357
|
function isWrappedCallModelResult(value) {
|
|
@@ -19494,7 +19494,7 @@ var OpenRouterPlugin = class extends BasePlugin {
|
|
|
19494
19494
|
}
|
|
19495
19495
|
subscribeToOpenRouterChannels() {
|
|
19496
19496
|
this.unsubscribers.push(
|
|
19497
|
-
traceStreamingChannel(
|
|
19497
|
+
traceStreamingChannel(_chunkVMBQETG3js.openRouterChannels.chatSend, {
|
|
19498
19498
|
name: "openrouter.chat.send",
|
|
19499
19499
|
type: "llm" /* LLM */,
|
|
19500
19500
|
extractInput: (args) => {
|
|
@@ -19522,7 +19522,7 @@ var OpenRouterPlugin = class extends BasePlugin {
|
|
|
19522
19522
|
})
|
|
19523
19523
|
);
|
|
19524
19524
|
this.unsubscribers.push(
|
|
19525
|
-
traceAsyncChannel(
|
|
19525
|
+
traceAsyncChannel(_chunkVMBQETG3js.openRouterChannels.embeddingsGenerate, {
|
|
19526
19526
|
name: "openrouter.embeddings.generate",
|
|
19527
19527
|
type: "llm" /* LLM */,
|
|
19528
19528
|
extractInput: (args) => {
|
|
@@ -19559,7 +19559,7 @@ var OpenRouterPlugin = class extends BasePlugin {
|
|
|
19559
19559
|
})
|
|
19560
19560
|
);
|
|
19561
19561
|
this.unsubscribers.push(
|
|
19562
|
-
traceAsyncChannel(
|
|
19562
|
+
traceAsyncChannel(_chunkVMBQETG3js.openRouterChannels.rerankRerank, {
|
|
19563
19563
|
name: "openrouter.rerank.rerank",
|
|
19564
19564
|
type: "llm" /* LLM */,
|
|
19565
19565
|
extractInput: (args) => {
|
|
@@ -19587,7 +19587,7 @@ var OpenRouterPlugin = class extends BasePlugin {
|
|
|
19587
19587
|
})
|
|
19588
19588
|
);
|
|
19589
19589
|
this.unsubscribers.push(
|
|
19590
|
-
traceStreamingChannel(
|
|
19590
|
+
traceStreamingChannel(_chunkVMBQETG3js.openRouterChannels.betaResponsesSend, {
|
|
19591
19591
|
name: "openrouter.beta.responses.send",
|
|
19592
19592
|
type: "llm" /* LLM */,
|
|
19593
19593
|
extractInput: (args) => {
|
|
@@ -19614,7 +19614,7 @@ var OpenRouterPlugin = class extends BasePlugin {
|
|
|
19614
19614
|
})
|
|
19615
19615
|
);
|
|
19616
19616
|
this.unsubscribers.push(
|
|
19617
|
-
traceSyncStreamChannel(
|
|
19617
|
+
traceSyncStreamChannel(_chunkVMBQETG3js.openRouterChannels.callModel, {
|
|
19618
19618
|
name: "openrouter.callModel",
|
|
19619
19619
|
type: "task" /* TASK */,
|
|
19620
19620
|
extractInput: (args) => {
|
|
@@ -19634,7 +19634,7 @@ var OpenRouterPlugin = class extends BasePlugin {
|
|
|
19634
19634
|
})
|
|
19635
19635
|
);
|
|
19636
19636
|
this.unsubscribers.push(
|
|
19637
|
-
traceAsyncChannel(
|
|
19637
|
+
traceAsyncChannel(_chunkVMBQETG3js.openRouterChannels.callModelTurn, {
|
|
19638
19638
|
name: "openrouter.beta.responses.send",
|
|
19639
19639
|
type: "llm" /* LLM */,
|
|
19640
19640
|
extractInput: (args, event) => {
|
|
@@ -19670,7 +19670,7 @@ var OpenRouterPlugin = class extends BasePlugin {
|
|
|
19670
19670
|
})
|
|
19671
19671
|
);
|
|
19672
19672
|
this.unsubscribers.push(
|
|
19673
|
-
traceStreamingChannel(
|
|
19673
|
+
traceStreamingChannel(_chunkVMBQETG3js.openRouterChannels.toolExecute, {
|
|
19674
19674
|
name: "openrouter.tool",
|
|
19675
19675
|
type: "tool" /* TOOL */,
|
|
19676
19676
|
extractInput: (args, event) => ({
|
|
@@ -19689,7 +19689,7 @@ var OpenRouterPlugin = class extends BasePlugin {
|
|
|
19689
19689
|
})
|
|
19690
19690
|
})
|
|
19691
19691
|
);
|
|
19692
|
-
const callModelChannel =
|
|
19692
|
+
const callModelChannel = _chunkVMBQETG3js.openRouterChannels.callModel.tracingChannel();
|
|
19693
19693
|
const callModelHandlers = {
|
|
19694
19694
|
start: (event) => {
|
|
19695
19695
|
const request = getOpenRouterCallModelRequestArg2(event.arguments);
|
|
@@ -20002,7 +20002,7 @@ function isWrappedTool2(tool) {
|
|
|
20002
20002
|
return Boolean(tool[OPENROUTER_WRAPPED_TOOL2]);
|
|
20003
20003
|
}
|
|
20004
20004
|
function traceToolExecution2(args) {
|
|
20005
|
-
const tracingChannel2 =
|
|
20005
|
+
const tracingChannel2 = _chunkVMBQETG3js.openRouterChannels.toolExecute.tracingChannel();
|
|
20006
20006
|
const input = args.args.length > 0 ? args.args[0] : void 0;
|
|
20007
20007
|
const event = {
|
|
20008
20008
|
arguments: [input],
|
|
@@ -20390,7 +20390,7 @@ async function traceOpenRouterCallModelTurn2(args) {
|
|
|
20390
20390
|
};
|
|
20391
20391
|
return await withCurrent(
|
|
20392
20392
|
args.parentSpan,
|
|
20393
|
-
() =>
|
|
20393
|
+
() => _chunkVMBQETG3js.openRouterChannels.callModelTurn.tracePromise(args.fn, context)
|
|
20394
20394
|
);
|
|
20395
20395
|
}
|
|
20396
20396
|
function isWrappedCallModelResult2(value) {
|
|
@@ -20533,7 +20533,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20533
20533
|
}
|
|
20534
20534
|
subscribeToMistralChannels() {
|
|
20535
20535
|
this.unsubscribers.push(
|
|
20536
|
-
traceStreamingChannel(
|
|
20536
|
+
traceStreamingChannel(_chunkVMBQETG3js.mistralChannels.chatComplete, {
|
|
20537
20537
|
name: "mistral.chat.complete",
|
|
20538
20538
|
type: "llm" /* LLM */,
|
|
20539
20539
|
extractInput: extractMessagesInputWithMetadata,
|
|
@@ -20545,7 +20545,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20545
20545
|
})
|
|
20546
20546
|
);
|
|
20547
20547
|
this.unsubscribers.push(
|
|
20548
|
-
traceStreamingChannel(
|
|
20548
|
+
traceStreamingChannel(_chunkVMBQETG3js.mistralChannels.chatStream, {
|
|
20549
20549
|
name: "mistral.chat.stream",
|
|
20550
20550
|
type: "llm" /* LLM */,
|
|
20551
20551
|
extractInput: extractMessagesInputWithMetadata,
|
|
@@ -20556,7 +20556,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20556
20556
|
})
|
|
20557
20557
|
);
|
|
20558
20558
|
this.unsubscribers.push(
|
|
20559
|
-
traceAsyncChannel(
|
|
20559
|
+
traceAsyncChannel(_chunkVMBQETG3js.mistralChannels.embeddingsCreate, {
|
|
20560
20560
|
name: "mistral.embeddings.create",
|
|
20561
20561
|
type: "llm" /* LLM */,
|
|
20562
20562
|
extractInput: extractEmbeddingInputWithMetadata,
|
|
@@ -20569,7 +20569,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20569
20569
|
})
|
|
20570
20570
|
);
|
|
20571
20571
|
this.unsubscribers.push(
|
|
20572
|
-
traceAsyncChannel(
|
|
20572
|
+
traceAsyncChannel(_chunkVMBQETG3js.mistralChannels.classifiersModerate, {
|
|
20573
20573
|
name: "mistral.classifiers.moderate",
|
|
20574
20574
|
type: "llm" /* LLM */,
|
|
20575
20575
|
extractInput: extractClassifierInputWithMetadata,
|
|
@@ -20579,7 +20579,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20579
20579
|
})
|
|
20580
20580
|
);
|
|
20581
20581
|
this.unsubscribers.push(
|
|
20582
|
-
traceAsyncChannel(
|
|
20582
|
+
traceAsyncChannel(_chunkVMBQETG3js.mistralChannels.classifiersModerateChat, {
|
|
20583
20583
|
name: "mistral.classifiers.moderateChat",
|
|
20584
20584
|
type: "llm" /* LLM */,
|
|
20585
20585
|
extractInput: extractClassifierInputWithMetadata,
|
|
@@ -20589,7 +20589,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20589
20589
|
})
|
|
20590
20590
|
);
|
|
20591
20591
|
this.unsubscribers.push(
|
|
20592
|
-
traceAsyncChannel(
|
|
20592
|
+
traceAsyncChannel(_chunkVMBQETG3js.mistralChannels.classifiersClassify, {
|
|
20593
20593
|
name: "mistral.classifiers.classify",
|
|
20594
20594
|
type: "llm" /* LLM */,
|
|
20595
20595
|
extractInput: extractClassifierInputWithMetadata,
|
|
@@ -20599,7 +20599,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20599
20599
|
})
|
|
20600
20600
|
);
|
|
20601
20601
|
this.unsubscribers.push(
|
|
20602
|
-
traceAsyncChannel(
|
|
20602
|
+
traceAsyncChannel(_chunkVMBQETG3js.mistralChannels.classifiersClassifyChat, {
|
|
20603
20603
|
name: "mistral.classifiers.classifyChat",
|
|
20604
20604
|
type: "llm" /* LLM */,
|
|
20605
20605
|
extractInput: extractClassifierInputWithMetadata,
|
|
@@ -20609,7 +20609,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20609
20609
|
})
|
|
20610
20610
|
);
|
|
20611
20611
|
this.unsubscribers.push(
|
|
20612
|
-
traceStreamingChannel(
|
|
20612
|
+
traceStreamingChannel(_chunkVMBQETG3js.mistralChannels.fimComplete, {
|
|
20613
20613
|
name: "mistral.fim.complete",
|
|
20614
20614
|
type: "llm" /* LLM */,
|
|
20615
20615
|
extractInput: extractPromptInputWithMetadata,
|
|
@@ -20621,7 +20621,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20621
20621
|
})
|
|
20622
20622
|
);
|
|
20623
20623
|
this.unsubscribers.push(
|
|
20624
|
-
traceStreamingChannel(
|
|
20624
|
+
traceStreamingChannel(_chunkVMBQETG3js.mistralChannels.fimStream, {
|
|
20625
20625
|
name: "mistral.fim.stream",
|
|
20626
20626
|
type: "llm" /* LLM */,
|
|
20627
20627
|
extractInput: extractPromptInputWithMetadata,
|
|
@@ -20632,7 +20632,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20632
20632
|
})
|
|
20633
20633
|
);
|
|
20634
20634
|
this.unsubscribers.push(
|
|
20635
|
-
traceStreamingChannel(
|
|
20635
|
+
traceStreamingChannel(_chunkVMBQETG3js.mistralChannels.agentsComplete, {
|
|
20636
20636
|
name: "mistral.agents.complete",
|
|
20637
20637
|
type: "llm" /* LLM */,
|
|
20638
20638
|
extractInput: extractMessagesInputWithMetadata,
|
|
@@ -20644,7 +20644,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20644
20644
|
})
|
|
20645
20645
|
);
|
|
20646
20646
|
this.unsubscribers.push(
|
|
20647
|
-
traceStreamingChannel(
|
|
20647
|
+
traceStreamingChannel(_chunkVMBQETG3js.mistralChannels.agentsStream, {
|
|
20648
20648
|
name: "mistral.agents.stream",
|
|
20649
20649
|
type: "llm" /* LLM */,
|
|
20650
20650
|
extractInput: extractMessagesInputWithMetadata,
|
|
@@ -21158,7 +21158,7 @@ var GoogleADKPlugin = (_class21 = class extends BasePlugin {constructor(...args5
|
|
|
21158
21158
|
this.activeAgentSpans.clear();
|
|
21159
21159
|
}
|
|
21160
21160
|
subscribeToRunnerRunAsync() {
|
|
21161
|
-
const tracingChannel2 =
|
|
21161
|
+
const tracingChannel2 = _chunkVMBQETG3js.googleADKChannels.runnerRunAsync.tracingChannel();
|
|
21162
21162
|
const states = /* @__PURE__ */ new WeakMap();
|
|
21163
21163
|
const createState = (event) => {
|
|
21164
21164
|
const params = _nullishCoalesce(event.arguments[0], () => ( {}));
|
|
@@ -21243,7 +21243,7 @@ var GoogleADKPlugin = (_class21 = class extends BasePlugin {constructor(...args5
|
|
|
21243
21243
|
});
|
|
21244
21244
|
}
|
|
21245
21245
|
subscribeToAgentRunAsync() {
|
|
21246
|
-
const tracingChannel2 =
|
|
21246
|
+
const tracingChannel2 = _chunkVMBQETG3js.googleADKChannels.agentRunAsync.tracingChannel();
|
|
21247
21247
|
const states = /* @__PURE__ */ new WeakMap();
|
|
21248
21248
|
const createState = (event) => {
|
|
21249
21249
|
const parentContext = event.arguments[0];
|
|
@@ -21346,7 +21346,7 @@ var GoogleADKPlugin = (_class21 = class extends BasePlugin {constructor(...args5
|
|
|
21346
21346
|
});
|
|
21347
21347
|
}
|
|
21348
21348
|
subscribeToToolRunAsync() {
|
|
21349
|
-
const tracingChannel2 =
|
|
21349
|
+
const tracingChannel2 = _chunkVMBQETG3js.googleADKChannels.toolRunAsync.tracingChannel();
|
|
21350
21350
|
const states = /* @__PURE__ */ new WeakMap();
|
|
21351
21351
|
const handlers = {
|
|
21352
21352
|
start: (event) => {
|
|
@@ -21781,7 +21781,7 @@ var CoherePlugin = class extends BasePlugin {
|
|
|
21781
21781
|
}
|
|
21782
21782
|
subscribeToCohereChannels() {
|
|
21783
21783
|
this.unsubscribers.push(
|
|
21784
|
-
traceStreamingChannel(
|
|
21784
|
+
traceStreamingChannel(_chunkVMBQETG3js.cohereChannels.chat, {
|
|
21785
21785
|
name: "cohere.chat",
|
|
21786
21786
|
type: "llm" /* LLM */,
|
|
21787
21787
|
extractInput: extractChatInputWithMetadata2,
|
|
@@ -21797,7 +21797,7 @@ var CoherePlugin = class extends BasePlugin {
|
|
|
21797
21797
|
})
|
|
21798
21798
|
);
|
|
21799
21799
|
this.unsubscribers.push(
|
|
21800
|
-
traceStreamingChannel(
|
|
21800
|
+
traceStreamingChannel(_chunkVMBQETG3js.cohereChannels.chatStream, {
|
|
21801
21801
|
name: "cohere.chatStream",
|
|
21802
21802
|
type: "llm" /* LLM */,
|
|
21803
21803
|
extractInput: extractChatInputWithMetadata2,
|
|
@@ -21808,7 +21808,7 @@ var CoherePlugin = class extends BasePlugin {
|
|
|
21808
21808
|
})
|
|
21809
21809
|
);
|
|
21810
21810
|
this.unsubscribers.push(
|
|
21811
|
-
traceAsyncChannel(
|
|
21811
|
+
traceAsyncChannel(_chunkVMBQETG3js.cohereChannels.embed, {
|
|
21812
21812
|
name: "cohere.embed",
|
|
21813
21813
|
type: "llm" /* LLM */,
|
|
21814
21814
|
extractInput: extractEmbedInputWithMetadata,
|
|
@@ -21818,7 +21818,7 @@ var CoherePlugin = class extends BasePlugin {
|
|
|
21818
21818
|
})
|
|
21819
21819
|
);
|
|
21820
21820
|
this.unsubscribers.push(
|
|
21821
|
-
traceAsyncChannel(
|
|
21821
|
+
traceAsyncChannel(_chunkVMBQETG3js.cohereChannels.rerank, {
|
|
21822
21822
|
name: "cohere.rerank",
|
|
21823
21823
|
type: "llm" /* LLM */,
|
|
21824
21824
|
extractInput: extractRerankInputWithMetadata,
|
|
@@ -22441,7 +22441,7 @@ function aggregateCohereChatStreamChunks(chunks) {
|
|
|
22441
22441
|
var GroqPlugin = class extends BasePlugin {
|
|
22442
22442
|
onEnable() {
|
|
22443
22443
|
this.unsubscribers.push(
|
|
22444
|
-
traceStreamingChannel(
|
|
22444
|
+
traceStreamingChannel(_chunkVMBQETG3js.groqChannels.chatCompletionsCreate, {
|
|
22445
22445
|
name: "groq.chat.completions.create",
|
|
22446
22446
|
type: "llm" /* LLM */,
|
|
22447
22447
|
extractInput: ([params]) => {
|
|
@@ -22463,7 +22463,7 @@ var GroqPlugin = class extends BasePlugin {
|
|
|
22463
22463
|
})
|
|
22464
22464
|
);
|
|
22465
22465
|
this.unsubscribers.push(
|
|
22466
|
-
traceAsyncChannel(
|
|
22466
|
+
traceAsyncChannel(_chunkVMBQETG3js.groqChannels.embeddingsCreate, {
|
|
22467
22467
|
name: "groq.embeddings.create",
|
|
22468
22468
|
type: "llm" /* LLM */,
|
|
22469
22469
|
extractInput: ([params]) => {
|
|
@@ -22543,7 +22543,7 @@ var GenkitPlugin = class extends BasePlugin {
|
|
|
22543
22543
|
}
|
|
22544
22544
|
subscribeToGenkitChannels() {
|
|
22545
22545
|
this.unsubscribers.push(
|
|
22546
|
-
traceAsyncChannel(
|
|
22546
|
+
traceAsyncChannel(_chunkVMBQETG3js.genkitChannels.generate, {
|
|
22547
22547
|
name: "genkit.generate",
|
|
22548
22548
|
type: "llm" /* LLM */,
|
|
22549
22549
|
extractInput: ([input]) => extractGenerateInput(input),
|
|
@@ -22553,7 +22553,7 @@ var GenkitPlugin = class extends BasePlugin {
|
|
|
22553
22553
|
})
|
|
22554
22554
|
);
|
|
22555
22555
|
this.unsubscribers.push(
|
|
22556
|
-
traceSyncStreamChannel(
|
|
22556
|
+
traceSyncStreamChannel(_chunkVMBQETG3js.genkitChannels.generateStream, {
|
|
22557
22557
|
name: "genkit.generateStream",
|
|
22558
22558
|
type: "llm" /* LLM */,
|
|
22559
22559
|
extractInput: ([input]) => extractGenerateInput(input),
|
|
@@ -22561,7 +22561,7 @@ var GenkitPlugin = class extends BasePlugin {
|
|
|
22561
22561
|
})
|
|
22562
22562
|
);
|
|
22563
22563
|
this.unsubscribers.push(
|
|
22564
|
-
traceAsyncChannel(
|
|
22564
|
+
traceAsyncChannel(_chunkVMBQETG3js.genkitChannels.embed, {
|
|
22565
22565
|
name: "genkit.embed",
|
|
22566
22566
|
type: "function" /* FUNCTION */,
|
|
22567
22567
|
extractInput: ([params]) => extractEmbedInput(params),
|
|
@@ -22571,7 +22571,7 @@ var GenkitPlugin = class extends BasePlugin {
|
|
|
22571
22571
|
})
|
|
22572
22572
|
);
|
|
22573
22573
|
this.unsubscribers.push(
|
|
22574
|
-
traceAsyncChannel(
|
|
22574
|
+
traceAsyncChannel(_chunkVMBQETG3js.genkitChannels.embedMany, {
|
|
22575
22575
|
name: "genkit.embedMany",
|
|
22576
22576
|
type: "function" /* FUNCTION */,
|
|
22577
22577
|
extractInput: ([params]) => extractEmbedManyInput(params),
|
|
@@ -22585,7 +22585,7 @@ var GenkitPlugin = class extends BasePlugin {
|
|
|
22585
22585
|
this.subscribeToActionStream();
|
|
22586
22586
|
}
|
|
22587
22587
|
subscribeToActionRun() {
|
|
22588
|
-
const tracingChannel2 =
|
|
22588
|
+
const tracingChannel2 = _chunkVMBQETG3js.genkitChannels.actionRun.tracingChannel();
|
|
22589
22589
|
const states = /* @__PURE__ */ new WeakMap();
|
|
22590
22590
|
const unbindCurrentSpanStore = bindActionCurrentSpanStoreToStart(
|
|
22591
22591
|
tracingChannel2,
|
|
@@ -22632,7 +22632,7 @@ var GenkitPlugin = class extends BasePlugin {
|
|
|
22632
22632
|
});
|
|
22633
22633
|
}
|
|
22634
22634
|
subscribeToActionSpan() {
|
|
22635
|
-
const tracingChannel2 =
|
|
22635
|
+
const tracingChannel2 = _chunkVMBQETG3js.genkitCoreChannels.actionSpan.tracingChannel();
|
|
22636
22636
|
const states = /* @__PURE__ */ new WeakMap();
|
|
22637
22637
|
const unbindCurrentSpanStore = bindActionCurrentSpanStoreToStart(
|
|
22638
22638
|
tracingChannel2,
|
|
@@ -22681,7 +22681,7 @@ var GenkitPlugin = class extends BasePlugin {
|
|
|
22681
22681
|
}
|
|
22682
22682
|
subscribeToActionStream() {
|
|
22683
22683
|
this.unsubscribers.push(
|
|
22684
|
-
traceSyncStreamChannel(
|
|
22684
|
+
traceSyncStreamChannel(_chunkVMBQETG3js.genkitChannels.actionStream, {
|
|
22685
22685
|
name: "genkit.action.stream",
|
|
22686
22686
|
type: "task" /* TASK */,
|
|
22687
22687
|
extractInput: ([input], event) => ({
|
|
@@ -23572,8 +23572,8 @@ var GitHubCopilotPlugin = class extends BasePlugin {
|
|
|
23572
23572
|
this.unsubscribers = [];
|
|
23573
23573
|
}
|
|
23574
23574
|
subscribeToSessionChannels() {
|
|
23575
|
-
const createChannel =
|
|
23576
|
-
const resumeChannel =
|
|
23575
|
+
const createChannel = _chunkVMBQETG3js.gitHubCopilotChannels.createSession.tracingChannel();
|
|
23576
|
+
const resumeChannel = _chunkVMBQETG3js.gitHubCopilotChannels.resumeSession.tracingChannel();
|
|
23577
23577
|
const sessionStates = /* @__PURE__ */ new WeakMap();
|
|
23578
23578
|
const createHandlers = makeSessionHandlers(
|
|
23579
23579
|
sessionStates,
|
|
@@ -23598,581 +23598,207 @@ var GitHubCopilotPlugin = class extends BasePlugin {
|
|
|
23598
23598
|
}
|
|
23599
23599
|
};
|
|
23600
23600
|
|
|
23601
|
-
// src/
|
|
23602
|
-
var
|
|
23603
|
-
var
|
|
23604
|
-
var
|
|
23605
|
-
|
|
23606
|
-
|
|
23607
|
-
|
|
23608
|
-
|
|
23609
|
-
|
|
23610
|
-
console.warn("Unsupported Flue context. Not wrapping.");
|
|
23611
|
-
return ctx;
|
|
23601
|
+
// src/instrumentation/plugins/flue-plugin.ts
|
|
23602
|
+
var FLUE_AUTO_STATE = /* @__PURE__ */ Symbol.for("braintrust.flue.auto-state");
|
|
23603
|
+
var FLUE_OBSERVE_BRIDGE = /* @__PURE__ */ Symbol.for("braintrust.flue.observe-bridge");
|
|
23604
|
+
var braintrustFlueObserver = (event, ctx) => {
|
|
23605
|
+
getObserveBridge().handle(event, ctx);
|
|
23606
|
+
};
|
|
23607
|
+
var FluePlugin = class extends BasePlugin {
|
|
23608
|
+
onEnable() {
|
|
23609
|
+
this.unsubscribers.push(enableFlueAutoInstrumentation());
|
|
23612
23610
|
}
|
|
23613
|
-
|
|
23614
|
-
|
|
23615
|
-
|
|
23616
|
-
}
|
|
23617
|
-
|
|
23618
|
-
const context = ctx;
|
|
23619
|
-
if (context[WRAPPED_FLUE_CONTEXT]) {
|
|
23620
|
-
return ctx;
|
|
23611
|
+
onDisable() {
|
|
23612
|
+
for (const unsubscribe of this.unsubscribers) {
|
|
23613
|
+
unsubscribe();
|
|
23614
|
+
}
|
|
23615
|
+
this.unsubscribers = [];
|
|
23621
23616
|
}
|
|
23622
|
-
|
|
23623
|
-
|
|
23624
|
-
|
|
23625
|
-
|
|
23626
|
-
|
|
23627
|
-
|
|
23628
|
-
|
|
23629
|
-
|
|
23630
|
-
|
|
23631
|
-
|
|
23632
|
-
|
|
23633
|
-
|
|
23634
|
-
|
|
23635
|
-
|
|
23636
|
-
});
|
|
23637
|
-
} catch (e48) {
|
|
23617
|
+
};
|
|
23618
|
+
function enableFlueAutoInstrumentation() {
|
|
23619
|
+
const state = getAutoState();
|
|
23620
|
+
state.refCount += 1;
|
|
23621
|
+
if (!state.handlers) {
|
|
23622
|
+
const channel = _chunkVMBQETG3js.flueChannels.createContext.tracingChannel();
|
|
23623
|
+
const handlers = {
|
|
23624
|
+
end: (event) => {
|
|
23625
|
+
subscribeToFlueContext(event.result, state);
|
|
23626
|
+
}
|
|
23627
|
+
};
|
|
23628
|
+
channel.subscribe(handlers);
|
|
23629
|
+
state.channel = channel;
|
|
23630
|
+
state.handlers = handlers;
|
|
23638
23631
|
}
|
|
23639
|
-
|
|
23632
|
+
let released = false;
|
|
23633
|
+
return () => {
|
|
23634
|
+
if (released) {
|
|
23635
|
+
return;
|
|
23636
|
+
}
|
|
23637
|
+
released = true;
|
|
23638
|
+
releaseAutoState(state);
|
|
23639
|
+
};
|
|
23640
23640
|
}
|
|
23641
|
-
function
|
|
23642
|
-
|
|
23643
|
-
|
|
23644
|
-
return
|
|
23641
|
+
function getAutoState() {
|
|
23642
|
+
const existing = Reflect.get(globalThis, FLUE_AUTO_STATE);
|
|
23643
|
+
if (isAutoState(existing)) {
|
|
23644
|
+
return existing;
|
|
23645
23645
|
}
|
|
23646
|
-
|
|
23646
|
+
const state = {
|
|
23647
|
+
contexts: /* @__PURE__ */ new WeakSet(),
|
|
23648
|
+
refCount: 0
|
|
23649
|
+
};
|
|
23650
|
+
Reflect.set(globalThis, FLUE_AUTO_STATE, state);
|
|
23651
|
+
return state;
|
|
23647
23652
|
}
|
|
23648
|
-
function
|
|
23649
|
-
|
|
23650
|
-
|
|
23651
|
-
|
|
23652
|
-
const context = ctx;
|
|
23653
|
-
const captureTurnSpans = _nullishCoalesce(options.captureTurnSpans, () => ( true));
|
|
23654
|
-
const existingSubscription = context[SUBSCRIBED_FLUE_CONTEXT_EVENTS];
|
|
23655
|
-
if (existingSubscription) {
|
|
23656
|
-
if (existingSubscription.captureTurnSpans || !captureTurnSpans) {
|
|
23657
|
-
return void 0;
|
|
23658
|
-
}
|
|
23659
|
-
try {
|
|
23660
|
-
existingSubscription.unsubscribe();
|
|
23661
|
-
} catch (e49) {
|
|
23662
|
-
}
|
|
23663
|
-
}
|
|
23664
|
-
try {
|
|
23665
|
-
const unsubscribe = ctx.subscribeEvent((event) => {
|
|
23666
|
-
_chunkNKD77KGBjs.flueChannels.contextEvent.traceSync(() => void 0, {
|
|
23667
|
-
arguments: [event],
|
|
23668
|
-
captureTurnSpans,
|
|
23669
|
-
context: ctx
|
|
23670
|
-
});
|
|
23671
|
-
});
|
|
23672
|
-
if (existingSubscription) {
|
|
23673
|
-
existingSubscription.captureTurnSpans = captureTurnSpans;
|
|
23674
|
-
existingSubscription.unsubscribe = unsubscribe;
|
|
23675
|
-
} else {
|
|
23676
|
-
Object.defineProperty(context, SUBSCRIBED_FLUE_CONTEXT_EVENTS, {
|
|
23677
|
-
configurable: false,
|
|
23678
|
-
enumerable: false,
|
|
23679
|
-
value: {
|
|
23680
|
-
captureTurnSpans,
|
|
23681
|
-
unsubscribe
|
|
23682
|
-
}
|
|
23683
|
-
});
|
|
23684
|
-
}
|
|
23685
|
-
return unsubscribe;
|
|
23686
|
-
} catch (e50) {
|
|
23687
|
-
return void 0;
|
|
23653
|
+
function getObserveBridge() {
|
|
23654
|
+
const existing = Reflect.get(globalThis, FLUE_OBSERVE_BRIDGE);
|
|
23655
|
+
if (isFlueObserveBridge(existing)) {
|
|
23656
|
+
return existing;
|
|
23688
23657
|
}
|
|
23658
|
+
const bridge = new FlueObserveBridge();
|
|
23659
|
+
Reflect.set(globalThis, FLUE_OBSERVE_BRIDGE, bridge);
|
|
23660
|
+
return bridge;
|
|
23689
23661
|
}
|
|
23690
|
-
function
|
|
23691
|
-
|
|
23692
|
-
return harness;
|
|
23693
|
-
}
|
|
23694
|
-
const target = harness;
|
|
23695
|
-
if (target[WRAPPED_FLUE_HARNESS]) {
|
|
23696
|
-
return harness;
|
|
23697
|
-
}
|
|
23698
|
-
const originalSession = target.session.bind(target);
|
|
23699
|
-
try {
|
|
23700
|
-
Object.defineProperty(target, WRAPPED_FLUE_HARNESS, {
|
|
23701
|
-
configurable: false,
|
|
23702
|
-
enumerable: false,
|
|
23703
|
-
value: true
|
|
23704
|
-
});
|
|
23705
|
-
Object.defineProperty(target, "session", {
|
|
23706
|
-
configurable: true,
|
|
23707
|
-
value: async function wrappedFlueHarnessSession(name, options) {
|
|
23708
|
-
const session = await originalSession(name, options);
|
|
23709
|
-
return patchFlueSessionInPlace(session);
|
|
23710
|
-
},
|
|
23711
|
-
writable: true
|
|
23712
|
-
});
|
|
23713
|
-
const sessions = target.sessions;
|
|
23714
|
-
if (sessions && typeof sessions === "object") {
|
|
23715
|
-
patchFlueSessionFactory(sessions, "get");
|
|
23716
|
-
patchFlueSessionFactory(sessions, "create");
|
|
23717
|
-
}
|
|
23718
|
-
} catch (e51) {
|
|
23719
|
-
}
|
|
23720
|
-
return harness;
|
|
23662
|
+
function isFlueObserveBridge(value) {
|
|
23663
|
+
return isObjectLike(value) && typeof Reflect.get(value, "handle") === "function" && typeof Reflect.get(value, "reset") === "function";
|
|
23721
23664
|
}
|
|
23722
|
-
function
|
|
23723
|
-
|
|
23724
|
-
return session;
|
|
23725
|
-
}
|
|
23726
|
-
try {
|
|
23727
|
-
Object.defineProperty(session, WRAPPED_FLUE_SESSION, {
|
|
23728
|
-
configurable: false,
|
|
23729
|
-
enumerable: false,
|
|
23730
|
-
value: true
|
|
23731
|
-
});
|
|
23732
|
-
patchCallHandleMethod(session, "prompt", _chunkNKD77KGBjs.flueChannels.prompt);
|
|
23733
|
-
patchCallHandleMethod(session, "skill", _chunkNKD77KGBjs.flueChannels.skill);
|
|
23734
|
-
patchCallHandleMethod(session, "task", _chunkNKD77KGBjs.flueChannels.task);
|
|
23735
|
-
patchCompact(session);
|
|
23736
|
-
} catch (e52) {
|
|
23737
|
-
}
|
|
23738
|
-
return session;
|
|
23665
|
+
function isAutoState(value) {
|
|
23666
|
+
return isObjectLike(value) && Reflect.get(value, "contexts") instanceof WeakSet && typeof Reflect.get(value, "refCount") === "number";
|
|
23739
23667
|
}
|
|
23740
|
-
function
|
|
23741
|
-
|
|
23742
|
-
if (
|
|
23668
|
+
function releaseAutoState(state) {
|
|
23669
|
+
state.refCount -= 1;
|
|
23670
|
+
if (state.refCount > 0) {
|
|
23743
23671
|
return;
|
|
23744
23672
|
}
|
|
23745
|
-
|
|
23746
|
-
|
|
23747
|
-
|
|
23748
|
-
|
|
23749
|
-
|
|
23750
|
-
|
|
23751
|
-
},
|
|
23752
|
-
writable: true
|
|
23753
|
-
});
|
|
23754
|
-
}
|
|
23755
|
-
function patchCallHandleMethod(session, method, channel) {
|
|
23756
|
-
const original = session[method];
|
|
23757
|
-
if (typeof original !== "function") {
|
|
23758
|
-
return;
|
|
23673
|
+
try {
|
|
23674
|
+
if (state.channel && state.handlers) {
|
|
23675
|
+
state.channel.unsubscribe(state.handlers);
|
|
23676
|
+
}
|
|
23677
|
+
} finally {
|
|
23678
|
+
Reflect.deleteProperty(globalThis, FLUE_AUTO_STATE);
|
|
23759
23679
|
}
|
|
23760
|
-
const bound = original.bind(session);
|
|
23761
|
-
Object.defineProperty(session, method, {
|
|
23762
|
-
configurable: true,
|
|
23763
|
-
value(input, options) {
|
|
23764
|
-
const args = [input, options];
|
|
23765
|
-
const { originalResult, traced: traced2 } = traceFlueOperation(channel, {
|
|
23766
|
-
context: {
|
|
23767
|
-
arguments: args,
|
|
23768
|
-
operation: method,
|
|
23769
|
-
session
|
|
23770
|
-
},
|
|
23771
|
-
run: () => bound(input, options)
|
|
23772
|
-
});
|
|
23773
|
-
return preserveCallHandle(originalResult, traced2);
|
|
23774
|
-
},
|
|
23775
|
-
writable: true
|
|
23776
|
-
});
|
|
23777
23680
|
}
|
|
23778
|
-
function
|
|
23779
|
-
|
|
23780
|
-
if (typeof original !== "function") {
|
|
23681
|
+
function subscribeToFlueContext(value, state) {
|
|
23682
|
+
if (!isObservableFlueContext(value) || state.contexts.has(value)) {
|
|
23781
23683
|
return;
|
|
23782
23684
|
}
|
|
23783
|
-
const
|
|
23784
|
-
|
|
23785
|
-
|
|
23786
|
-
|
|
23787
|
-
|
|
23788
|
-
|
|
23789
|
-
|
|
23790
|
-
|
|
23791
|
-
};
|
|
23792
|
-
return _chunkNKD77KGBjs.flueChannels.compact.tracePromise(() => bound(), context);
|
|
23793
|
-
},
|
|
23794
|
-
writable: true
|
|
23795
|
-
});
|
|
23796
|
-
}
|
|
23797
|
-
function traceFlueOperation(channel, args) {
|
|
23798
|
-
const tracingChannel2 = channel.tracingChannel();
|
|
23799
|
-
const context = args.context;
|
|
23800
|
-
let originalResult;
|
|
23801
|
-
let traced2;
|
|
23802
|
-
const run = () => {
|
|
23685
|
+
const ctx = flueContextFromUnknown(value);
|
|
23686
|
+
let released = false;
|
|
23687
|
+
let unsubscribe;
|
|
23688
|
+
const release = () => {
|
|
23689
|
+
if (released) {
|
|
23690
|
+
return;
|
|
23691
|
+
}
|
|
23692
|
+
released = true;
|
|
23803
23693
|
try {
|
|
23804
|
-
|
|
23805
|
-
_optionalChain([tracingChannel2, 'access', _564 => _564.end, 'optionalAccess', _565 => _565.publish, 'call', _566 => _566(context)]);
|
|
23694
|
+
_optionalChain([unsubscribe, 'optionalCall', _564 => _564()]);
|
|
23806
23695
|
} catch (error) {
|
|
23807
|
-
context
|
|
23808
|
-
_optionalChain([tracingChannel2, 'access', _567 => _567.error, 'optionalAccess', _568 => _568.publish, 'call', _569 => _569(context)]);
|
|
23809
|
-
_optionalChain([tracingChannel2, 'access', _570 => _570.end, 'optionalAccess', _571 => _571.publish, 'call', _572 => _572(context)]);
|
|
23810
|
-
throw error;
|
|
23696
|
+
logInstrumentationError3("Flue context unsubscribe", error);
|
|
23811
23697
|
}
|
|
23812
|
-
traced2 = Promise.resolve(originalResult).then(
|
|
23813
|
-
(result) => {
|
|
23814
|
-
context.result = result;
|
|
23815
|
-
_optionalChain([tracingChannel2, 'access', _573 => _573.asyncStart, 'optionalAccess', _574 => _574.publish, 'call', _575 => _575(context)]);
|
|
23816
|
-
_optionalChain([tracingChannel2, 'access', _576 => _576.asyncEnd, 'optionalAccess', _577 => _577.publish, 'call', _578 => _578(context)]);
|
|
23817
|
-
return result;
|
|
23818
|
-
},
|
|
23819
|
-
(error) => {
|
|
23820
|
-
context.error = normalizeError3(error);
|
|
23821
|
-
_optionalChain([tracingChannel2, 'access', _579 => _579.error, 'optionalAccess', _580 => _580.publish, 'call', _581 => _581(context)]);
|
|
23822
|
-
_optionalChain([tracingChannel2, 'access', _582 => _582.asyncStart, 'optionalAccess', _583 => _583.publish, 'call', _584 => _584(context)]);
|
|
23823
|
-
_optionalChain([tracingChannel2, 'access', _585 => _585.asyncEnd, 'optionalAccess', _586 => _586.publish, 'call', _587 => _587(context)]);
|
|
23824
|
-
throw error;
|
|
23825
|
-
}
|
|
23826
|
-
);
|
|
23827
23698
|
};
|
|
23828
|
-
|
|
23829
|
-
|
|
23830
|
-
|
|
23831
|
-
|
|
23832
|
-
|
|
23699
|
+
try {
|
|
23700
|
+
unsubscribe = value.subscribeEvent((event) => {
|
|
23701
|
+
if (state.refCount <= 0) {
|
|
23702
|
+
release();
|
|
23703
|
+
return;
|
|
23704
|
+
}
|
|
23705
|
+
braintrustFlueObserver(event, ctx);
|
|
23706
|
+
if (isAutoContextTerminalEvent(event, ctx)) {
|
|
23707
|
+
release();
|
|
23708
|
+
}
|
|
23709
|
+
});
|
|
23710
|
+
state.contexts.add(value);
|
|
23711
|
+
} catch (error) {
|
|
23712
|
+
logInstrumentationError3("Flue context subscription", error);
|
|
23833
23713
|
}
|
|
23834
|
-
return { originalResult, traced: traced2 };
|
|
23835
23714
|
}
|
|
23836
|
-
function
|
|
23837
|
-
|
|
23838
|
-
|
|
23839
|
-
function preserveCallHandle(originalHandle, traced2) {
|
|
23840
|
-
if (!isFlueCallHandle(originalHandle)) {
|
|
23841
|
-
return traced2;
|
|
23715
|
+
function isAutoContextTerminalEvent(event, ctx) {
|
|
23716
|
+
if (!isObjectLike(event)) {
|
|
23717
|
+
return false;
|
|
23842
23718
|
}
|
|
23843
|
-
const
|
|
23844
|
-
|
|
23845
|
-
|
|
23846
|
-
|
|
23847
|
-
|
|
23848
|
-
|
|
23849
|
-
|
|
23850
|
-
|
|
23851
|
-
then(onfulfilled, onrejected) {
|
|
23852
|
-
return traced2.then(onfulfilled, onrejected);
|
|
23853
|
-
}
|
|
23854
|
-
};
|
|
23855
|
-
return wrapped;
|
|
23719
|
+
const type = Reflect.get(event, "type");
|
|
23720
|
+
if (type === "run_end") {
|
|
23721
|
+
return true;
|
|
23722
|
+
}
|
|
23723
|
+
if (type !== "operation") {
|
|
23724
|
+
return false;
|
|
23725
|
+
}
|
|
23726
|
+
return !_optionalChain([ctx, 'optionalAccess', _565 => _565.runId]) && typeof Reflect.get(event, "runId") !== "string";
|
|
23856
23727
|
}
|
|
23857
|
-
function
|
|
23858
|
-
return
|
|
23728
|
+
function isObservableFlueContext(value) {
|
|
23729
|
+
return isObjectLike(value) && typeof Reflect.get(value, "subscribeEvent") === "function";
|
|
23859
23730
|
}
|
|
23860
|
-
function
|
|
23861
|
-
|
|
23731
|
+
function isFlueEvent(event) {
|
|
23732
|
+
const type = Reflect.get(event, "type");
|
|
23733
|
+
return type === "run_start" || type === "run_end" || type === "operation_start" || type === "operation" || type === "turn_request" || type === "turn" || type === "tool_start" || type === "tool_call" || type === "task_start" || type === "task" || type === "compaction_start" || type === "compaction";
|
|
23862
23734
|
}
|
|
23863
|
-
function
|
|
23864
|
-
|
|
23735
|
+
function flueContextFromUnknown(ctx) {
|
|
23736
|
+
if (!isObjectLike(ctx)) {
|
|
23737
|
+
return void 0;
|
|
23738
|
+
}
|
|
23739
|
+
const id = Reflect.get(ctx, "id");
|
|
23740
|
+
const runId = Reflect.get(ctx, "runId");
|
|
23741
|
+
return {
|
|
23742
|
+
...typeof id === "string" ? { id } : {},
|
|
23743
|
+
...typeof runId === "string" ? { runId } : {}
|
|
23744
|
+
};
|
|
23865
23745
|
}
|
|
23866
|
-
function
|
|
23867
|
-
return
|
|
23746
|
+
function isObjectLike(value) {
|
|
23747
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23868
23748
|
}
|
|
23869
|
-
|
|
23870
|
-
|
|
23871
|
-
|
|
23872
|
-
|
|
23873
|
-
|
|
23874
|
-
__init74() {this.compactionsByScope = /* @__PURE__ */ new Map()}
|
|
23875
|
-
__init75() {this.pendingOperationsByKey = /* @__PURE__ */ new Map()}
|
|
23749
|
+
var FlueObserveBridge = (_class22 = class {constructor() { _class22.prototype.__init72.call(this);_class22.prototype.__init73.call(this);_class22.prototype.__init74.call(this);_class22.prototype.__init75.call(this);_class22.prototype.__init76.call(this);_class22.prototype.__init77.call(this);_class22.prototype.__init78.call(this); }
|
|
23750
|
+
__init72() {this.compactionsByKey = /* @__PURE__ */ new Map()}
|
|
23751
|
+
__init73() {this.operationsById = /* @__PURE__ */ new Map()}
|
|
23752
|
+
__init74() {this.runsById = /* @__PURE__ */ new Map()}
|
|
23753
|
+
__init75() {this.seenEvents = /* @__PURE__ */ new WeakSet()}
|
|
23876
23754
|
__init76() {this.tasksById = /* @__PURE__ */ new Map()}
|
|
23877
|
-
__init77() {this.
|
|
23878
|
-
__init78() {this.
|
|
23879
|
-
|
|
23880
|
-
|
|
23881
|
-
|
|
23882
|
-
this.subscribeToContextEvents();
|
|
23883
|
-
this.subscribeToSessionOperations();
|
|
23884
|
-
}
|
|
23885
|
-
onDisable() {
|
|
23886
|
-
for (const unsubscribe of this.unsubscribers) {
|
|
23887
|
-
unsubscribe();
|
|
23888
|
-
}
|
|
23889
|
-
this.unsubscribers = [];
|
|
23890
|
-
this.activeOperationsById.clear();
|
|
23891
|
-
this.activeOperationsByScope.clear();
|
|
23892
|
-
this.compactionsByScope.clear();
|
|
23893
|
-
this.pendingOperationsByKey.clear();
|
|
23894
|
-
this.tasksById.clear();
|
|
23895
|
-
this.toolsById.clear();
|
|
23896
|
-
this.turnsByScope.clear();
|
|
23897
|
-
}
|
|
23898
|
-
subscribeToContextCreation() {
|
|
23899
|
-
const channel = _chunkNKD77KGBjs.flueChannels.createContext.tracingChannel();
|
|
23900
|
-
const handlers = {
|
|
23901
|
-
end: (event) => {
|
|
23902
|
-
const ctx = event.result;
|
|
23903
|
-
if (!ctx) {
|
|
23904
|
-
return;
|
|
23905
|
-
}
|
|
23906
|
-
subscribeFlueContextEvents(ctx, { captureTurnSpans: false });
|
|
23907
|
-
patchFlueContextInPlace(ctx);
|
|
23908
|
-
},
|
|
23909
|
-
error: () => {
|
|
23910
|
-
}
|
|
23911
|
-
};
|
|
23912
|
-
channel.subscribe(handlers);
|
|
23913
|
-
this.unsubscribers.push(() => {
|
|
23914
|
-
channel.unsubscribe(handlers);
|
|
23915
|
-
});
|
|
23916
|
-
}
|
|
23917
|
-
subscribeToSessionCreation() {
|
|
23918
|
-
const channel = _chunkNKD77KGBjs.flueChannels.openSession.tracingChannel();
|
|
23919
|
-
const handlers = {
|
|
23920
|
-
asyncEnd: (event) => {
|
|
23921
|
-
if (event.result) {
|
|
23922
|
-
patchFlueSessionInPlace(
|
|
23923
|
-
event.result
|
|
23924
|
-
);
|
|
23925
|
-
}
|
|
23926
|
-
if (event.harness) {
|
|
23927
|
-
wrapFlueHarness(event.harness);
|
|
23928
|
-
}
|
|
23929
|
-
},
|
|
23930
|
-
error: () => {
|
|
23931
|
-
}
|
|
23932
|
-
};
|
|
23933
|
-
channel.subscribe(handlers);
|
|
23934
|
-
this.unsubscribers.push(() => {
|
|
23935
|
-
channel.unsubscribe(handlers);
|
|
23936
|
-
});
|
|
23937
|
-
}
|
|
23938
|
-
subscribeToSessionOperations() {
|
|
23939
|
-
this.subscribeToSessionOperation(_chunkNKD77KGBjs.flueChannels.prompt);
|
|
23940
|
-
this.subscribeToSessionOperation(_chunkNKD77KGBjs.flueChannels.skill);
|
|
23941
|
-
this.subscribeToSessionOperation(_chunkNKD77KGBjs.flueChannels.task);
|
|
23942
|
-
this.subscribeToCompact();
|
|
23943
|
-
}
|
|
23944
|
-
subscribeToSessionOperation(channel) {
|
|
23945
|
-
const tracingChannel2 = channel.tracingChannel();
|
|
23946
|
-
const states = /* @__PURE__ */ new WeakMap();
|
|
23947
|
-
const ensureState2 = (event) => {
|
|
23948
|
-
const existing = states.get(event);
|
|
23949
|
-
if (existing) {
|
|
23950
|
-
return existing;
|
|
23951
|
-
}
|
|
23952
|
-
const state = this.startOperationState({
|
|
23953
|
-
args: event.arguments,
|
|
23954
|
-
moduleVersion: typeof event.moduleVersion === "string" ? event.moduleVersion : void 0,
|
|
23955
|
-
operation: event.operation,
|
|
23956
|
-
session: event.session
|
|
23957
|
-
});
|
|
23958
|
-
states.set(event, state);
|
|
23959
|
-
return state;
|
|
23960
|
-
};
|
|
23961
|
-
const unbindCurrentSpanStore = this.bindCurrentSpanStoreToOperationStart(
|
|
23962
|
-
tracingChannel2,
|
|
23963
|
-
ensureState2
|
|
23964
|
-
);
|
|
23965
|
-
const handlers = {
|
|
23966
|
-
start: (event) => {
|
|
23967
|
-
ensureState2(event);
|
|
23968
|
-
},
|
|
23969
|
-
asyncEnd: (event) => {
|
|
23970
|
-
this.endOperationState(states.get(event), event.result);
|
|
23971
|
-
states.delete(event);
|
|
23972
|
-
},
|
|
23973
|
-
error: (event) => {
|
|
23974
|
-
const state = states.get(event);
|
|
23975
|
-
if (state && event.error) {
|
|
23976
|
-
safeLog3(state.span, { error: errorToString(event.error) });
|
|
23977
|
-
this.finishOperationState(state);
|
|
23978
|
-
}
|
|
23979
|
-
states.delete(event);
|
|
23980
|
-
}
|
|
23981
|
-
};
|
|
23982
|
-
tracingChannel2.subscribe(handlers);
|
|
23983
|
-
this.unsubscribers.push(() => {
|
|
23984
|
-
_optionalChain([unbindCurrentSpanStore, 'optionalCall', _593 => _593()]);
|
|
23985
|
-
tracingChannel2.unsubscribe(handlers);
|
|
23986
|
-
});
|
|
23987
|
-
}
|
|
23988
|
-
subscribeToCompact() {
|
|
23989
|
-
const tracingChannel2 = _chunkNKD77KGBjs.flueChannels.compact.tracingChannel();
|
|
23990
|
-
const states = /* @__PURE__ */ new WeakMap();
|
|
23991
|
-
const ensureState2 = (event) => {
|
|
23992
|
-
const existing = states.get(event);
|
|
23993
|
-
if (existing) {
|
|
23994
|
-
return existing;
|
|
23995
|
-
}
|
|
23996
|
-
const state = this.startOperationState({
|
|
23997
|
-
args: [],
|
|
23998
|
-
moduleVersion: typeof event.moduleVersion === "string" ? event.moduleVersion : void 0,
|
|
23999
|
-
operation: event.operation,
|
|
24000
|
-
session: event.session
|
|
24001
|
-
});
|
|
24002
|
-
states.set(event, state);
|
|
24003
|
-
return state;
|
|
24004
|
-
};
|
|
24005
|
-
const unbindCurrentSpanStore = this.bindCurrentSpanStoreToOperationStart(
|
|
24006
|
-
tracingChannel2,
|
|
24007
|
-
ensureState2
|
|
24008
|
-
);
|
|
24009
|
-
const handlers = {
|
|
24010
|
-
start: (event) => {
|
|
24011
|
-
ensureState2(event);
|
|
24012
|
-
},
|
|
24013
|
-
asyncEnd: (event) => {
|
|
24014
|
-
this.endOperationState(states.get(event), void 0);
|
|
24015
|
-
states.delete(event);
|
|
24016
|
-
},
|
|
24017
|
-
error: (event) => {
|
|
24018
|
-
const state = states.get(event);
|
|
24019
|
-
if (state && event.error) {
|
|
24020
|
-
safeLog3(state.span, { error: errorToString(event.error) });
|
|
24021
|
-
this.finishOperationState(state);
|
|
24022
|
-
}
|
|
24023
|
-
states.delete(event);
|
|
24024
|
-
}
|
|
24025
|
-
};
|
|
24026
|
-
tracingChannel2.subscribe(handlers);
|
|
24027
|
-
this.unsubscribers.push(() => {
|
|
24028
|
-
_optionalChain([unbindCurrentSpanStore, 'optionalCall', _594 => _594()]);
|
|
24029
|
-
tracingChannel2.unsubscribe(handlers);
|
|
24030
|
-
});
|
|
24031
|
-
}
|
|
24032
|
-
subscribeToContextEvents() {
|
|
24033
|
-
const channel = _chunkNKD77KGBjs.flueChannels.contextEvent.tracingChannel();
|
|
24034
|
-
const handlers = {
|
|
24035
|
-
start: (event) => {
|
|
24036
|
-
const flueEvent = event.arguments[0];
|
|
24037
|
-
if (!flueEvent) {
|
|
24038
|
-
return;
|
|
24039
|
-
}
|
|
24040
|
-
try {
|
|
24041
|
-
this.handleFlueEvent(flueEvent, {
|
|
24042
|
-
captureTurnSpans: event.captureTurnSpans !== false
|
|
24043
|
-
});
|
|
24044
|
-
} catch (error) {
|
|
24045
|
-
logInstrumentationError3("Flue event", error);
|
|
24046
|
-
}
|
|
24047
|
-
},
|
|
24048
|
-
error: () => {
|
|
24049
|
-
}
|
|
24050
|
-
};
|
|
24051
|
-
channel.subscribe(handlers);
|
|
24052
|
-
this.unsubscribers.push(() => {
|
|
24053
|
-
channel.unsubscribe(handlers);
|
|
24054
|
-
});
|
|
24055
|
-
}
|
|
24056
|
-
bindCurrentSpanStoreToOperationStart(tracingChannel2, ensureState2) {
|
|
24057
|
-
const state = _internalGetGlobalState();
|
|
24058
|
-
const startChannel = tracingChannel2.start;
|
|
24059
|
-
const contextManager = _optionalChain([state, 'optionalAccess', _595 => _595.contextManager]);
|
|
24060
|
-
const currentSpanStore = contextManager ? contextManager[BRAINTRUST_CURRENT_SPAN_STORE] : void 0;
|
|
24061
|
-
if (!currentSpanStore || !startChannel) {
|
|
24062
|
-
return void 0;
|
|
23755
|
+
__init77() {this.toolsByKey = /* @__PURE__ */ new Map()}
|
|
23756
|
+
__init78() {this.turnsByKey = /* @__PURE__ */ new Map()}
|
|
23757
|
+
handle(event, ctx) {
|
|
23758
|
+
if (!isObjectLike(event) || !isFlueEvent(event)) {
|
|
23759
|
+
return;
|
|
24063
23760
|
}
|
|
24064
|
-
|
|
24065
|
-
const operationState = ensureState2(event);
|
|
24066
|
-
return contextManager.wrapSpanForStore(operationState.span);
|
|
24067
|
-
});
|
|
24068
|
-
return () => {
|
|
24069
|
-
startChannel.unbindStore(currentSpanStore);
|
|
24070
|
-
};
|
|
24071
|
-
}
|
|
24072
|
-
startOperationState(args) {
|
|
24073
|
-
const sessionName = getSessionName(args.session);
|
|
24074
|
-
const metadata = {
|
|
24075
|
-
...extractOperationInputMetadata(args.operation, args.args),
|
|
24076
|
-
...extractSessionMetadata(args.session),
|
|
24077
|
-
"flue.operation": args.operation,
|
|
24078
|
-
provider: "flue",
|
|
24079
|
-
...args.moduleVersion ? { "flue.version": args.moduleVersion } : {}
|
|
24080
|
-
};
|
|
24081
|
-
const span = startSpan({
|
|
24082
|
-
name: `flue.session.${args.operation}`,
|
|
24083
|
-
spanAttributes: { type: "task" /* TASK */ }
|
|
24084
|
-
});
|
|
24085
|
-
const state = {
|
|
24086
|
-
metadata,
|
|
24087
|
-
operation: args.operation,
|
|
24088
|
-
sessionName,
|
|
24089
|
-
span,
|
|
24090
|
-
startTime: getCurrentUnixTimestamp()
|
|
24091
|
-
};
|
|
24092
|
-
safeLog3(span, {
|
|
24093
|
-
input: extractOperationInput(args.operation, args.args),
|
|
24094
|
-
metadata
|
|
24095
|
-
});
|
|
24096
|
-
this.pendingOperationQueue(operationKey(sessionName, args.operation)).push(
|
|
24097
|
-
state
|
|
24098
|
-
);
|
|
24099
|
-
addOperationToScope(
|
|
24100
|
-
this.activeOperationsByScope,
|
|
24101
|
-
_nullishCoalesce(sessionName, () => ( "unknown")),
|
|
24102
|
-
state
|
|
24103
|
-
);
|
|
24104
|
-
return state;
|
|
24105
|
-
}
|
|
24106
|
-
endOperationState(state, result) {
|
|
24107
|
-
if (!state) {
|
|
23761
|
+
if (this.seenEvents.has(event)) {
|
|
24108
23762
|
return;
|
|
24109
23763
|
}
|
|
24110
|
-
|
|
24111
|
-
|
|
24112
|
-
|
|
24113
|
-
}
|
|
24114
|
-
|
|
24115
|
-
...buildDurationMetrics3(state.startTime),
|
|
24116
|
-
...metricsFromUsage(_optionalChain([result, 'optionalAccess', _596 => _596.usage]))
|
|
24117
|
-
};
|
|
24118
|
-
safeLog3(state.span, {
|
|
24119
|
-
metadata,
|
|
24120
|
-
metrics,
|
|
24121
|
-
output: extractOperationOutput(result)
|
|
24122
|
-
});
|
|
24123
|
-
this.finishCompactionsForOperation(state);
|
|
24124
|
-
this.finishOperationState(state);
|
|
24125
|
-
}
|
|
24126
|
-
finishOperationState(state) {
|
|
24127
|
-
removePendingOperation(this.pendingOperationsByKey, state);
|
|
24128
|
-
if (state.operationId) {
|
|
24129
|
-
this.activeOperationsById.delete(state.operationId);
|
|
23764
|
+
this.seenEvents.add(event);
|
|
23765
|
+
try {
|
|
23766
|
+
this.handleEvent(event, flueContextFromUnknown(ctx));
|
|
23767
|
+
} catch (error) {
|
|
23768
|
+
logInstrumentationError3("Flue observe", error);
|
|
24130
23769
|
}
|
|
24131
|
-
removeScopedOperation(this.activeOperationsByScope, state);
|
|
24132
|
-
state.span.end();
|
|
24133
23770
|
}
|
|
24134
|
-
|
|
23771
|
+
reset() {
|
|
23772
|
+
this.compactionsByKey.clear();
|
|
23773
|
+
this.operationsById.clear();
|
|
23774
|
+
this.runsById.clear();
|
|
23775
|
+
this.seenEvents = /* @__PURE__ */ new WeakSet();
|
|
23776
|
+
this.tasksById.clear();
|
|
23777
|
+
this.toolsByKey.clear();
|
|
23778
|
+
this.turnsByKey.clear();
|
|
23779
|
+
}
|
|
23780
|
+
handleEvent(event, ctx) {
|
|
24135
23781
|
switch (event.type) {
|
|
23782
|
+
case "run_start":
|
|
23783
|
+
this.handleRunStart(event, ctx);
|
|
23784
|
+
return;
|
|
23785
|
+
case "run_end":
|
|
23786
|
+
this.handleRunEnd(event);
|
|
23787
|
+
return;
|
|
24136
23788
|
case "operation_start":
|
|
24137
23789
|
this.handleOperationStart(event);
|
|
24138
23790
|
return;
|
|
24139
23791
|
case "operation":
|
|
24140
23792
|
this.handleOperation(event);
|
|
24141
23793
|
return;
|
|
24142
|
-
case "
|
|
24143
|
-
|
|
24144
|
-
return;
|
|
24145
|
-
}
|
|
24146
|
-
this.ensureTurnState(event).text.push(
|
|
24147
|
-
typeof event.text === "string" ? event.text : ""
|
|
24148
|
-
);
|
|
24149
|
-
return;
|
|
24150
|
-
case "thinking_start":
|
|
24151
|
-
if (!options.captureTurnSpans) {
|
|
24152
|
-
return;
|
|
24153
|
-
}
|
|
24154
|
-
this.handleThinkingStart(event);
|
|
24155
|
-
return;
|
|
24156
|
-
case "thinking_delta":
|
|
24157
|
-
if (!options.captureTurnSpans) {
|
|
24158
|
-
return;
|
|
24159
|
-
}
|
|
24160
|
-
this.handleThinkingDelta(event);
|
|
24161
|
-
return;
|
|
24162
|
-
case "thinking_end":
|
|
24163
|
-
if (!options.captureTurnSpans) {
|
|
24164
|
-
return;
|
|
24165
|
-
}
|
|
24166
|
-
this.handleThinkingEnd(event);
|
|
23794
|
+
case "turn_request":
|
|
23795
|
+
this.handleTurnRequest(event);
|
|
24167
23796
|
return;
|
|
24168
23797
|
case "turn":
|
|
24169
|
-
if (!options.captureTurnSpans) {
|
|
24170
|
-
return;
|
|
24171
|
-
}
|
|
24172
23798
|
this.handleTurn(event);
|
|
24173
23799
|
return;
|
|
24174
23800
|
case "tool_start":
|
|
24175
|
-
this.handleToolStart(event
|
|
23801
|
+
this.handleToolStart(event);
|
|
24176
23802
|
return;
|
|
24177
23803
|
case "tool_call":
|
|
24178
23804
|
this.handleToolCall(event);
|
|
@@ -24193,203 +23819,216 @@ var FluePlugin = (_class22 = class extends BasePlugin {constructor(...args6) { s
|
|
|
24193
23819
|
return;
|
|
24194
23820
|
}
|
|
24195
23821
|
}
|
|
24196
|
-
|
|
24197
|
-
if (!
|
|
23822
|
+
handleRunStart(event, ctx) {
|
|
23823
|
+
if (!event.runId) {
|
|
24198
23824
|
return;
|
|
24199
23825
|
}
|
|
24200
|
-
const
|
|
24201
|
-
|
|
23826
|
+
const workflowName = _nullishCoalesce(_nullishCoalesce(event.workflowName, () => ( _optionalChain([event, 'access', _566 => _566.owner, 'optionalAccess', _567 => _567.workflowName]))), () => ( (typeof _optionalChain([ctx, 'optionalAccess', _568 => _568.id]) === "string" ? ctx.id : "unknown")));
|
|
23827
|
+
const metadata = {
|
|
23828
|
+
...extractPayloadMetadata(event.payload),
|
|
23829
|
+
...extractEventMetadata(event, ctx),
|
|
23830
|
+
...workflowName ? { "flue.workflow_name": workflowName } : {},
|
|
23831
|
+
provider: "flue"
|
|
23832
|
+
};
|
|
23833
|
+
const span = startSpan({
|
|
23834
|
+
name: `workflow:${workflowName}`,
|
|
23835
|
+
spanAttributes: { type: "task" /* TASK */ },
|
|
23836
|
+
startTime: eventTime(_nullishCoalesce(event.startedAt, () => ( event.timestamp))),
|
|
23837
|
+
event: {
|
|
23838
|
+
input: event.payload,
|
|
23839
|
+
metadata
|
|
23840
|
+
}
|
|
23841
|
+
});
|
|
23842
|
+
this.runsById.set(event.runId, { metadata, span });
|
|
23843
|
+
}
|
|
23844
|
+
handleRunEnd(event) {
|
|
23845
|
+
const state = this.runsById.get(event.runId);
|
|
23846
|
+
this.finishPendingSpansForRun(event);
|
|
23847
|
+
if (state) {
|
|
23848
|
+
safeLog3(state.span, {
|
|
23849
|
+
...event.isError ? { error: errorToString(event.error) } : {},
|
|
23850
|
+
metadata: {
|
|
23851
|
+
...state.metadata,
|
|
23852
|
+
...extractEventMetadata(event),
|
|
23853
|
+
...event.isError !== void 0 ? { "flue.is_error": event.isError } : {}
|
|
23854
|
+
},
|
|
23855
|
+
metrics: durationMetrics2(event.durationMs),
|
|
23856
|
+
output: event.result
|
|
23857
|
+
});
|
|
23858
|
+
safeEnd(state.span, eventTime(event.timestamp));
|
|
23859
|
+
this.runsById.delete(event.runId);
|
|
23860
|
+
}
|
|
23861
|
+
void flush().catch((error) => {
|
|
23862
|
+
logInstrumentationError3("Flue flush", error);
|
|
23863
|
+
});
|
|
23864
|
+
}
|
|
23865
|
+
handleOperationStart(event) {
|
|
23866
|
+
if (!event.operationId || !isInstrumentedOperation(event.operationKind)) {
|
|
24202
23867
|
return;
|
|
24203
23868
|
}
|
|
24204
|
-
|
|
24205
|
-
this.activeOperationsById.set(event.operationId, state);
|
|
24206
|
-
addScopedOperation(this.activeOperationsByScope, event, state);
|
|
24207
|
-
state.metadata = {
|
|
24208
|
-
...state.metadata,
|
|
23869
|
+
const metadata = {
|
|
24209
23870
|
...extractEventMetadata(event),
|
|
24210
|
-
"flue.
|
|
23871
|
+
"flue.operation": event.operationKind,
|
|
23872
|
+
provider: "flue"
|
|
24211
23873
|
};
|
|
24212
|
-
|
|
23874
|
+
const parent = this.parentSpanForEvent(event);
|
|
23875
|
+
const span = startFlueSpan(parent, {
|
|
23876
|
+
name: `flue.${event.operationKind}`,
|
|
23877
|
+
spanAttributes: { type: "task" /* TASK */ },
|
|
23878
|
+
startTime: eventTime(event.timestamp),
|
|
23879
|
+
event: { metadata }
|
|
23880
|
+
});
|
|
23881
|
+
this.operationsById.set(event.operationId, { metadata, span });
|
|
24213
23882
|
}
|
|
24214
23883
|
handleOperation(event) {
|
|
24215
|
-
|
|
24216
|
-
if (!state) {
|
|
23884
|
+
if (!isInstrumentedOperation(event.operationKind)) {
|
|
24217
23885
|
return;
|
|
24218
23886
|
}
|
|
23887
|
+
const state = _nullishCoalesce(this.operationsById.get(event.operationId), () => ( this.startSyntheticOperation(event)));
|
|
23888
|
+
const output = operationOutput(event);
|
|
24219
23889
|
const metadata = {
|
|
24220
23890
|
...state.metadata,
|
|
24221
23891
|
...extractEventMetadata(event),
|
|
24222
|
-
...
|
|
24223
|
-
...event.
|
|
23892
|
+
...event.isError !== void 0 ? { "flue.is_error": event.isError } : {},
|
|
23893
|
+
...event.usage ? { "flue.usage": event.usage } : {}
|
|
24224
23894
|
};
|
|
24225
|
-
|
|
23895
|
+
this.finishPendingChildrenForOperation(event, output);
|
|
24226
23896
|
safeLog3(state.span, {
|
|
24227
|
-
...event.
|
|
23897
|
+
...event.isError ? { error: errorToString(event.error) } : {},
|
|
24228
23898
|
metadata,
|
|
24229
|
-
|
|
23899
|
+
metrics: durationMetrics2(event.durationMs),
|
|
23900
|
+
output
|
|
24230
23901
|
});
|
|
23902
|
+
safeEnd(state.span, eventTime(event.timestamp));
|
|
23903
|
+
this.operationsById.delete(event.operationId);
|
|
24231
23904
|
}
|
|
24232
|
-
|
|
24233
|
-
const
|
|
24234
|
-
|
|
24235
|
-
|
|
24236
|
-
return existing;
|
|
23905
|
+
handleTurnRequest(event) {
|
|
23906
|
+
const key = turnKey(event);
|
|
23907
|
+
if (!key) {
|
|
23908
|
+
return;
|
|
24237
23909
|
}
|
|
24238
|
-
const parent = this.parentSpanForEvent(event);
|
|
24239
23910
|
const metadata = {
|
|
24240
23911
|
...extractEventMetadata(event),
|
|
24241
|
-
|
|
23912
|
+
...event.api ? { "flue.api": event.api } : {},
|
|
23913
|
+
...event.model ? { model: event.model, "flue.model": event.model } : {},
|
|
23914
|
+
...event.provider ? { provider: event.provider } : { provider: "flue" },
|
|
23915
|
+
...event.provider ? { "flue.provider": event.provider } : {},
|
|
23916
|
+
...event.purpose ? { "flue.turn_purpose": event.purpose } : {},
|
|
23917
|
+
...event.reasoning ? { reasoning: event.reasoning } : {},
|
|
23918
|
+
..._optionalChain([event, 'access', _569 => _569.input, 'optionalAccess', _570 => _570.systemPrompt]) ? { "flue.system_prompt": event.input.systemPrompt } : {},
|
|
23919
|
+
..._optionalChain([event, 'access', _571 => _571.input, 'optionalAccess', _572 => _572.tools]) ? { tools: event.input.tools } : {}
|
|
24242
23920
|
};
|
|
23921
|
+
const parent = this.parentSpanForTurn(event);
|
|
24243
23922
|
const span = startFlueSpan(parent, {
|
|
24244
|
-
name:
|
|
24245
|
-
spanAttributes: { type: "llm" /* LLM */ }
|
|
23923
|
+
name: `llm:${_nullishCoalesce(_nullishCoalesce(event.model, () => ( event.purpose)), () => ( "unknown"))}`,
|
|
23924
|
+
spanAttributes: { type: "llm" /* LLM */ },
|
|
23925
|
+
startTime: eventTime(event.timestamp),
|
|
23926
|
+
event: {
|
|
23927
|
+
input: _optionalChain([event, 'access', _573 => _573.input, 'optionalAccess', _574 => _574.messages]),
|
|
23928
|
+
metadata
|
|
23929
|
+
}
|
|
24246
23930
|
});
|
|
24247
|
-
|
|
24248
|
-
|
|
24249
|
-
|
|
24250
|
-
|
|
24251
|
-
|
|
24252
|
-
text: [],
|
|
24253
|
-
thinking: [],
|
|
24254
|
-
toolCalls: []
|
|
24255
|
-
};
|
|
24256
|
-
safeLog3(span, { metadata });
|
|
24257
|
-
this.turnsByScope.set(scope, state);
|
|
24258
|
-
return state;
|
|
23931
|
+
this.logOperationInput(
|
|
23932
|
+
event.operationId,
|
|
23933
|
+
_nullishCoalesce(_optionalChain([event, 'access', _575 => _575.input, 'optionalAccess', _576 => _576.messages]), () => ( event.input))
|
|
23934
|
+
);
|
|
23935
|
+
this.turnsByKey.set(key, { metadata, span });
|
|
24259
23936
|
}
|
|
24260
23937
|
handleTurn(event) {
|
|
24261
|
-
const
|
|
24262
|
-
|
|
24263
|
-
|
|
24264
|
-
|
|
24265
|
-
const
|
|
23938
|
+
const key = turnKey(event);
|
|
23939
|
+
if (!key) {
|
|
23940
|
+
return;
|
|
23941
|
+
}
|
|
23942
|
+
const state = _nullishCoalesce(this.turnsByKey.get(key), () => ( this.startSyntheticTurn(event)));
|
|
24266
23943
|
const metadata = {
|
|
24267
23944
|
...state.metadata,
|
|
24268
23945
|
...extractEventMetadata(event),
|
|
23946
|
+
...event.api ? { "flue.api": event.api } : {},
|
|
24269
23947
|
...event.model ? { model: event.model, "flue.model": event.model } : {},
|
|
23948
|
+
...event.provider ? { provider: event.provider } : {},
|
|
23949
|
+
...event.provider ? { "flue.provider": event.provider } : {},
|
|
23950
|
+
...event.purpose ? { "flue.turn_purpose": event.purpose } : {},
|
|
24270
23951
|
...event.stopReason ? { "flue.stop_reason": event.stopReason } : {},
|
|
24271
|
-
...event.isError !== void 0 ? { "flue.is_error": event.isError } : {}
|
|
24272
|
-
provider: "flue"
|
|
23952
|
+
...event.isError !== void 0 ? { "flue.is_error": event.isError } : {}
|
|
24273
23953
|
};
|
|
24274
23954
|
safeLog3(state.span, {
|
|
24275
|
-
...event.
|
|
23955
|
+
...event.isError ? { error: errorToString(event.error) } : {},
|
|
24276
23956
|
metadata,
|
|
24277
23957
|
metrics: {
|
|
24278
|
-
...
|
|
23958
|
+
...durationMetrics2(event.durationMs),
|
|
24279
23959
|
...metricsFromUsage(event.usage)
|
|
24280
23960
|
},
|
|
24281
|
-
output:
|
|
24282
|
-
text,
|
|
24283
|
-
event.stopReason,
|
|
24284
|
-
outputReasoning,
|
|
24285
|
-
state.toolCalls
|
|
24286
|
-
)
|
|
23961
|
+
output: event.output
|
|
24287
23962
|
});
|
|
24288
|
-
state.span.
|
|
24289
|
-
this.
|
|
23963
|
+
safeEnd(state.span, eventTime(event.timestamp));
|
|
23964
|
+
this.turnsByKey.delete(key);
|
|
24290
23965
|
}
|
|
24291
|
-
|
|
24292
|
-
|
|
24293
|
-
if (typeof delta !== "string" || !delta) {
|
|
23966
|
+
handleToolStart(event) {
|
|
23967
|
+
if (!event.toolCallId) {
|
|
24294
23968
|
return;
|
|
24295
|
-
}
|
|
24296
|
-
const
|
|
24297
|
-
|
|
24298
|
-
|
|
24299
|
-
|
|
24300
|
-
|
|
24301
|
-
|
|
24302
|
-
const
|
|
24303
|
-
|
|
24304
|
-
|
|
24305
|
-
|
|
24306
|
-
|
|
24307
|
-
|
|
24308
|
-
|
|
24309
|
-
|
|
24310
|
-
|
|
24311
|
-
state.finalThinking = event.content;
|
|
24312
|
-
}
|
|
24313
|
-
}
|
|
24314
|
-
handleToolStart(event, options) {
|
|
24315
|
-
const toolCallId = event.toolCallId;
|
|
24316
|
-
if (!toolCallId) {
|
|
24317
|
-
return;
|
|
24318
|
-
}
|
|
24319
|
-
const parent = this.parentSpanForEvent(event);
|
|
24320
|
-
const scope = scopeKey(event);
|
|
24321
|
-
let turnState = this.turnsByScope.get(scope);
|
|
24322
|
-
if (!turnState && parent && options.captureTurnSpans) {
|
|
24323
|
-
turnState = this.ensureTurnState(event);
|
|
24324
|
-
}
|
|
24325
|
-
const metadata = {
|
|
24326
|
-
...extractEventMetadata(event),
|
|
24327
|
-
...event.toolName ? { "flue.tool_name": event.toolName } : {},
|
|
24328
|
-
"flue.tool_call_id": toolCallId,
|
|
24329
|
-
provider: "flue"
|
|
24330
|
-
};
|
|
24331
|
-
const span = startFlueSpan(parent, {
|
|
24332
|
-
name: `tool: ${_nullishCoalesce(event.toolName, () => ( "unknown"))}`,
|
|
24333
|
-
spanAttributes: { type: "tool" /* TOOL */ }
|
|
24334
|
-
});
|
|
24335
|
-
if (turnState) {
|
|
24336
|
-
turnState.toolCalls.push({
|
|
24337
|
-
args: event.args,
|
|
24338
|
-
toolCallId,
|
|
24339
|
-
toolName: event.toolName
|
|
24340
|
-
});
|
|
24341
|
-
}
|
|
24342
|
-
safeLog3(span, {
|
|
24343
|
-
input: event.args,
|
|
24344
|
-
metadata
|
|
24345
|
-
});
|
|
24346
|
-
this.toolsById.set(toolKey(event), {
|
|
24347
|
-
metadata,
|
|
24348
|
-
span,
|
|
24349
|
-
startTime: getCurrentUnixTimestamp()
|
|
23969
|
+
}
|
|
23970
|
+
const metadata = {
|
|
23971
|
+
...extractEventMetadata(event),
|
|
23972
|
+
...event.toolName ? { "flue.tool_name": event.toolName } : {},
|
|
23973
|
+
"flue.tool_call_id": event.toolCallId,
|
|
23974
|
+
provider: "flue"
|
|
23975
|
+
};
|
|
23976
|
+
const parent = this.parentSpanForTool(event);
|
|
23977
|
+
const span = startFlueSpan(parent, {
|
|
23978
|
+
name: `tool:${_nullishCoalesce(event.toolName, () => ( "unknown"))}`,
|
|
23979
|
+
spanAttributes: { type: "tool" /* TOOL */ },
|
|
23980
|
+
startTime: eventTime(event.timestamp),
|
|
23981
|
+
event: {
|
|
23982
|
+
input: event.args,
|
|
23983
|
+
metadata
|
|
23984
|
+
}
|
|
24350
23985
|
});
|
|
23986
|
+
this.toolsByKey.set(toolKey(event), { metadata, span });
|
|
24351
23987
|
}
|
|
24352
23988
|
handleToolCall(event) {
|
|
23989
|
+
if (!event.toolCallId) {
|
|
23990
|
+
return;
|
|
23991
|
+
}
|
|
24353
23992
|
const key = toolKey(event);
|
|
24354
|
-
const state = _nullishCoalesce(this.
|
|
23993
|
+
const state = _nullishCoalesce(this.toolsByKey.get(key), () => ( this.startSyntheticTool(event)));
|
|
24355
23994
|
const metadata = {
|
|
24356
23995
|
...state.metadata,
|
|
24357
23996
|
...extractEventMetadata(event),
|
|
24358
23997
|
...event.toolName ? { "flue.tool_name": event.toolName } : {},
|
|
24359
|
-
|
|
23998
|
+
"flue.tool_call_id": event.toolCallId,
|
|
24360
23999
|
...event.isError !== void 0 ? { "flue.is_error": event.isError } : {}
|
|
24361
24000
|
};
|
|
24362
24001
|
safeLog3(state.span, {
|
|
24363
24002
|
...event.isError ? { error: errorToString(event.result) } : {},
|
|
24364
24003
|
metadata,
|
|
24365
|
-
metrics:
|
|
24004
|
+
metrics: durationMetrics2(event.durationMs),
|
|
24366
24005
|
output: event.result
|
|
24367
24006
|
});
|
|
24368
|
-
state.span.
|
|
24369
|
-
this.
|
|
24007
|
+
safeEnd(state.span, eventTime(event.timestamp));
|
|
24008
|
+
this.toolsByKey.delete(key);
|
|
24370
24009
|
}
|
|
24371
24010
|
handleTaskStart(event) {
|
|
24372
|
-
|
|
24011
|
+
if (!event.taskId) {
|
|
24012
|
+
return;
|
|
24013
|
+
}
|
|
24373
24014
|
const metadata = {
|
|
24374
24015
|
...extractEventMetadata(event),
|
|
24375
|
-
...event.
|
|
24016
|
+
...event.agent ? { "flue.agent": event.agent } : {},
|
|
24376
24017
|
...event.cwd ? { "flue.cwd": event.cwd } : {},
|
|
24377
24018
|
"flue.task_id": event.taskId,
|
|
24378
24019
|
provider: "flue"
|
|
24379
24020
|
};
|
|
24021
|
+
const parent = this.parentSpanForEvent(event);
|
|
24380
24022
|
const span = startFlueSpan(parent, {
|
|
24381
|
-
name: "flue.task",
|
|
24382
|
-
spanAttributes: { type: "task" /* TASK */ }
|
|
24383
|
-
|
|
24384
|
-
|
|
24385
|
-
|
|
24386
|
-
|
|
24387
|
-
|
|
24388
|
-
this.tasksById.set(event.taskId, {
|
|
24389
|
-
metadata,
|
|
24390
|
-
span,
|
|
24391
|
-
startTime: getCurrentUnixTimestamp()
|
|
24023
|
+
name: event.agent ? `task:${event.agent}` : "flue.task",
|
|
24024
|
+
spanAttributes: { type: "task" /* TASK */ },
|
|
24025
|
+
startTime: eventTime(event.timestamp),
|
|
24026
|
+
event: {
|
|
24027
|
+
input: event.prompt,
|
|
24028
|
+
metadata
|
|
24029
|
+
}
|
|
24392
24030
|
});
|
|
24031
|
+
this.tasksById.set(event.taskId, { metadata, span });
|
|
24393
24032
|
}
|
|
24394
24033
|
handleTask(event) {
|
|
24395
24034
|
const state = this.tasksById.get(event.taskId);
|
|
@@ -24401,426 +24040,372 @@ var FluePlugin = (_class22 = class extends BasePlugin {constructor(...args6) { s
|
|
|
24401
24040
|
metadata: {
|
|
24402
24041
|
...state.metadata,
|
|
24403
24042
|
...extractEventMetadata(event),
|
|
24043
|
+
...event.agent ? { "flue.agent": event.agent } : {},
|
|
24404
24044
|
...event.isError !== void 0 ? { "flue.is_error": event.isError } : {}
|
|
24405
24045
|
},
|
|
24406
|
-
metrics:
|
|
24046
|
+
metrics: durationMetrics2(event.durationMs),
|
|
24407
24047
|
output: event.result
|
|
24408
24048
|
});
|
|
24409
|
-
state.span.
|
|
24049
|
+
safeEnd(state.span, eventTime(event.timestamp));
|
|
24410
24050
|
this.tasksById.delete(event.taskId);
|
|
24411
24051
|
}
|
|
24412
24052
|
handleCompactionStart(event) {
|
|
24413
|
-
const
|
|
24414
|
-
const
|
|
24053
|
+
const key = compactionKey(event);
|
|
24054
|
+
const input = {
|
|
24055
|
+
...event.estimatedTokens !== void 0 ? { estimatedTokens: event.estimatedTokens } : {},
|
|
24056
|
+
...event.reason ? { reason: event.reason } : {}
|
|
24057
|
+
};
|
|
24415
24058
|
const metadata = {
|
|
24416
24059
|
...extractEventMetadata(event),
|
|
24417
24060
|
...event.reason ? { "flue.compaction_reason": event.reason } : {},
|
|
24418
24061
|
provider: "flue"
|
|
24419
24062
|
};
|
|
24420
|
-
const
|
|
24421
|
-
...typeof event.estimatedTokens === "number" ? { estimatedTokens: event.estimatedTokens } : {},
|
|
24422
|
-
...event.reason ? { reason: event.reason } : {}
|
|
24423
|
-
};
|
|
24063
|
+
const parent = this.parentSpanForEvent(event);
|
|
24424
24064
|
const span = startFlueSpan(parent, {
|
|
24425
|
-
name:
|
|
24426
|
-
spanAttributes: { type: "task" /* TASK */ }
|
|
24427
|
-
|
|
24428
|
-
|
|
24429
|
-
|
|
24430
|
-
|
|
24431
|
-
|
|
24432
|
-
this.compactionsByScope.set(scopeKey(event), {
|
|
24433
|
-
input,
|
|
24434
|
-
metadata,
|
|
24435
|
-
operationState,
|
|
24436
|
-
span,
|
|
24437
|
-
startTime: getCurrentUnixTimestamp()
|
|
24065
|
+
name: `compaction:${_nullishCoalesce(event.reason, () => ( "unknown"))}`,
|
|
24066
|
+
spanAttributes: { type: "task" /* TASK */ },
|
|
24067
|
+
startTime: eventTime(event.timestamp),
|
|
24068
|
+
event: {
|
|
24069
|
+
input,
|
|
24070
|
+
metadata
|
|
24071
|
+
}
|
|
24438
24072
|
});
|
|
24073
|
+
this.logOperationInput(event.operationId, input);
|
|
24074
|
+
this.compactionsByKey.set(key, { metadata, span });
|
|
24439
24075
|
}
|
|
24440
24076
|
handleCompaction(event) {
|
|
24441
|
-
const key =
|
|
24442
|
-
const state = _nullishCoalesce(this.
|
|
24443
|
-
|
|
24444
|
-
|
|
24445
|
-
|
|
24077
|
+
const key = compactionKey(event);
|
|
24078
|
+
const state = _nullishCoalesce(this.compactionsByKey.get(key), () => ( this.startSyntheticCompaction(event)));
|
|
24079
|
+
const metadata = {
|
|
24080
|
+
...state.metadata,
|
|
24081
|
+
...extractEventMetadata(event),
|
|
24082
|
+
...event.usage ? { "flue.usage": event.usage } : {}
|
|
24083
|
+
};
|
|
24446
24084
|
safeLog3(state.span, {
|
|
24447
|
-
metadata
|
|
24448
|
-
...state.metadata,
|
|
24449
|
-
...extractEventMetadata(event),
|
|
24450
|
-
...typeof event.messagesBefore === "number" ? { "flue.messages_before": event.messagesBefore } : {},
|
|
24451
|
-
...typeof event.messagesAfter === "number" ? { "flue.messages_after": event.messagesAfter } : {}
|
|
24452
|
-
},
|
|
24085
|
+
metadata,
|
|
24453
24086
|
metrics: {
|
|
24454
|
-
...
|
|
24455
|
-
...
|
|
24087
|
+
...durationMetrics2(event.durationMs),
|
|
24088
|
+
...typeof event.messagesBefore === "number" ? { messages_before: event.messagesBefore } : {},
|
|
24089
|
+
...typeof event.messagesAfter === "number" ? { messages_after: event.messagesAfter } : {}
|
|
24456
24090
|
},
|
|
24457
24091
|
output: {
|
|
24458
24092
|
messagesAfter: event.messagesAfter,
|
|
24459
24093
|
messagesBefore: event.messagesBefore
|
|
24460
24094
|
}
|
|
24461
24095
|
});
|
|
24462
|
-
state.span.
|
|
24463
|
-
this.
|
|
24096
|
+
safeEnd(state.span, eventTime(event.timestamp));
|
|
24097
|
+
this.compactionsByKey.delete(key);
|
|
24464
24098
|
}
|
|
24465
|
-
|
|
24466
|
-
|
|
24467
|
-
|
|
24468
|
-
if (
|
|
24469
|
-
return
|
|
24099
|
+
parentSpanForTurn(event) {
|
|
24100
|
+
if (event.purpose === "compaction" || event.purpose === "compaction_prefix") {
|
|
24101
|
+
const compaction = this.compactionsByKey.get(compactionKey(event));
|
|
24102
|
+
if (compaction) {
|
|
24103
|
+
return compaction.span;
|
|
24470
24104
|
}
|
|
24471
24105
|
}
|
|
24472
|
-
return
|
|
24106
|
+
return this.parentSpanForEvent(event);
|
|
24473
24107
|
}
|
|
24474
|
-
|
|
24475
|
-
|
|
24476
|
-
|
|
24477
|
-
|
|
24108
|
+
parentSpanForEvent(event) {
|
|
24109
|
+
const turn = turnKey(event);
|
|
24110
|
+
if (turn) {
|
|
24111
|
+
const turnState = this.turnsByKey.get(turn);
|
|
24112
|
+
if (turnState) {
|
|
24113
|
+
return turnState.span;
|
|
24478
24114
|
}
|
|
24479
|
-
safeLog3(state.span, {
|
|
24480
|
-
input: state.input,
|
|
24481
|
-
metadata: state.metadata,
|
|
24482
|
-
metrics: {
|
|
24483
|
-
...buildDurationMetrics3(state.startTime)
|
|
24484
|
-
},
|
|
24485
|
-
output: { completed: true }
|
|
24486
|
-
});
|
|
24487
|
-
state.span.end();
|
|
24488
|
-
this.deleteCompactionState(state);
|
|
24489
24115
|
}
|
|
24490
|
-
|
|
24491
|
-
|
|
24492
|
-
|
|
24493
|
-
|
|
24494
|
-
continue;
|
|
24116
|
+
if (event.taskId) {
|
|
24117
|
+
const task = this.tasksById.get(event.taskId);
|
|
24118
|
+
if (task) {
|
|
24119
|
+
return task.span;
|
|
24495
24120
|
}
|
|
24496
|
-
this.compactionsByScope.delete(key);
|
|
24497
|
-
return;
|
|
24498
24121
|
}
|
|
24499
|
-
}
|
|
24500
|
-
startSyntheticToolState(event, toolName) {
|
|
24501
|
-
const parent = this.parentSpanForEvent(event);
|
|
24502
|
-
const metadata = {
|
|
24503
|
-
...extractEventMetadata(event),
|
|
24504
|
-
...event.toolCallId ? { "flue.tool_call_id": event.toolCallId } : {},
|
|
24505
|
-
"flue.tool_name": toolName,
|
|
24506
|
-
provider: "flue"
|
|
24507
|
-
};
|
|
24508
|
-
const span = startFlueSpan(parent, {
|
|
24509
|
-
name: `tool: ${toolName}`,
|
|
24510
|
-
spanAttributes: { type: "tool" /* TOOL */ }
|
|
24511
|
-
});
|
|
24512
|
-
safeLog3(span, { metadata });
|
|
24513
|
-
return { metadata, span, startTime: getCurrentUnixTimestamp() };
|
|
24514
|
-
}
|
|
24515
|
-
operationStateForEvent(event) {
|
|
24516
24122
|
if (event.operationId) {
|
|
24517
|
-
const operation =
|
|
24123
|
+
const operation = this.operationsById.get(event.operationId);
|
|
24518
24124
|
if (operation) {
|
|
24519
|
-
return operation;
|
|
24125
|
+
return operation.span;
|
|
24520
24126
|
}
|
|
24521
24127
|
}
|
|
24522
|
-
|
|
24128
|
+
if (event.runId) {
|
|
24129
|
+
return _optionalChain([this, 'access', _577 => _577.runsById, 'access', _578 => _578.get, 'call', _579 => _579(event.runId), 'optionalAccess', _580 => _580.span]);
|
|
24130
|
+
}
|
|
24131
|
+
return void 0;
|
|
24523
24132
|
}
|
|
24524
|
-
|
|
24133
|
+
parentSpanForTool(event) {
|
|
24134
|
+
if (event.taskId) {
|
|
24135
|
+
const task = this.tasksById.get(event.taskId);
|
|
24136
|
+
if (task) {
|
|
24137
|
+
return task.span;
|
|
24138
|
+
}
|
|
24139
|
+
}
|
|
24525
24140
|
if (event.operationId) {
|
|
24526
|
-
const operation = this.
|
|
24141
|
+
const operation = this.operationsById.get(event.operationId);
|
|
24527
24142
|
if (operation) {
|
|
24528
24143
|
return operation.span;
|
|
24529
24144
|
}
|
|
24530
24145
|
}
|
|
24531
|
-
if (event.
|
|
24532
|
-
return _optionalChain([this, 'access',
|
|
24146
|
+
if (event.runId) {
|
|
24147
|
+
return _optionalChain([this, 'access', _581 => _581.runsById, 'access', _582 => _582.get, 'call', _583 => _583(event.runId), 'optionalAccess', _584 => _584.span]);
|
|
24533
24148
|
}
|
|
24534
|
-
return
|
|
24149
|
+
return void 0;
|
|
24535
24150
|
}
|
|
24536
|
-
|
|
24537
|
-
if (!
|
|
24538
|
-
return
|
|
24151
|
+
logOperationInput(operationId, input) {
|
|
24152
|
+
if (!operationId || input === void 0) {
|
|
24153
|
+
return;
|
|
24154
|
+
}
|
|
24155
|
+
const operation = this.operationsById.get(operationId);
|
|
24156
|
+
if (!operation || operation.loggedInput) {
|
|
24157
|
+
return;
|
|
24158
|
+
}
|
|
24159
|
+
safeLog3(operation.span, { input });
|
|
24160
|
+
operation.loggedInput = true;
|
|
24161
|
+
}
|
|
24162
|
+
startSyntheticOperation(event) {
|
|
24163
|
+
const metadata = {
|
|
24164
|
+
...extractEventMetadata(event),
|
|
24165
|
+
"flue.operation": event.operationKind,
|
|
24166
|
+
provider: "flue"
|
|
24167
|
+
};
|
|
24168
|
+
const span = startFlueSpan(this.parentSpanForEvent(event), {
|
|
24169
|
+
name: `flue.${event.operationKind}`,
|
|
24170
|
+
spanAttributes: { type: "task" /* TASK */ },
|
|
24171
|
+
startTime: eventTime(event.timestamp),
|
|
24172
|
+
event: { metadata }
|
|
24173
|
+
});
|
|
24174
|
+
return { metadata, span };
|
|
24175
|
+
}
|
|
24176
|
+
startSyntheticTurn(event) {
|
|
24177
|
+
const metadata = {
|
|
24178
|
+
...extractEventMetadata(event),
|
|
24179
|
+
...event.api ? { "flue.api": event.api } : {},
|
|
24180
|
+
...event.model ? { model: event.model, "flue.model": event.model } : {},
|
|
24181
|
+
...event.provider ? { provider: event.provider } : { provider: "flue" },
|
|
24182
|
+
...event.provider ? { "flue.provider": event.provider } : {},
|
|
24183
|
+
...event.purpose ? { "flue.turn_purpose": event.purpose } : {}
|
|
24184
|
+
};
|
|
24185
|
+
const span = startFlueSpan(this.parentSpanForEvent(event), {
|
|
24186
|
+
name: `llm:${_nullishCoalesce(_nullishCoalesce(event.model, () => ( event.purpose)), () => ( "unknown"))}`,
|
|
24187
|
+
spanAttributes: { type: "llm" /* LLM */ },
|
|
24188
|
+
startTime: eventTime(event.timestamp),
|
|
24189
|
+
event: { metadata }
|
|
24190
|
+
});
|
|
24191
|
+
return { metadata, span };
|
|
24192
|
+
}
|
|
24193
|
+
startSyntheticTool(event) {
|
|
24194
|
+
const metadata = {
|
|
24195
|
+
...extractEventMetadata(event),
|
|
24196
|
+
...event.toolName ? { "flue.tool_name": event.toolName } : {},
|
|
24197
|
+
"flue.tool_call_id": event.toolCallId,
|
|
24198
|
+
provider: "flue"
|
|
24199
|
+
};
|
|
24200
|
+
const span = startFlueSpan(this.parentSpanForTool(event), {
|
|
24201
|
+
name: `tool:${_nullishCoalesce(event.toolName, () => ( "unknown"))}`,
|
|
24202
|
+
spanAttributes: { type: "tool" /* TOOL */ },
|
|
24203
|
+
startTime: eventTime(event.timestamp),
|
|
24204
|
+
event: { metadata }
|
|
24205
|
+
});
|
|
24206
|
+
return { metadata, span };
|
|
24207
|
+
}
|
|
24208
|
+
startSyntheticCompaction(event) {
|
|
24209
|
+
const metadata = {
|
|
24210
|
+
...extractEventMetadata(event),
|
|
24211
|
+
provider: "flue"
|
|
24212
|
+
};
|
|
24213
|
+
const span = startFlueSpan(this.parentSpanForEvent(event), {
|
|
24214
|
+
name: "compaction:unknown",
|
|
24215
|
+
spanAttributes: { type: "task" /* TASK */ },
|
|
24216
|
+
startTime: eventTime(event.timestamp),
|
|
24217
|
+
event: { metadata }
|
|
24218
|
+
});
|
|
24219
|
+
return { metadata, span };
|
|
24220
|
+
}
|
|
24221
|
+
finishPendingChildrenForOperation(event, operationOutput2) {
|
|
24222
|
+
const endTime = eventTime(event.timestamp);
|
|
24223
|
+
const usage = _nullishCoalesce(event.usage, () => ( usageFromOperationResult(event.result)));
|
|
24224
|
+
const turnEntries = [...this.turnsByKey].filter(
|
|
24225
|
+
([, state]) => stateMatchesOperation(state, event.operationId)
|
|
24226
|
+
);
|
|
24227
|
+
turnEntries.forEach(([key, state], index) => {
|
|
24228
|
+
const shouldLogOperationOutput = (event.operationKind === "prompt" || event.operationKind === "skill") && index === turnEntries.length - 1 && operationOutput2 !== void 0;
|
|
24229
|
+
safeLog3(state.span, {
|
|
24230
|
+
metadata: state.metadata,
|
|
24231
|
+
metrics: metricsFromUsage(usage),
|
|
24232
|
+
...shouldLogOperationOutput ? { output: operationOutput2 } : {}
|
|
24233
|
+
});
|
|
24234
|
+
safeEnd(state.span, endTime);
|
|
24235
|
+
this.turnsByKey.delete(key);
|
|
24236
|
+
});
|
|
24237
|
+
for (const [key, state] of this.toolsByKey) {
|
|
24238
|
+
if (!stateMatchesOperation(state, event.operationId)) {
|
|
24239
|
+
continue;
|
|
24240
|
+
}
|
|
24241
|
+
safeEnd(state.span, endTime);
|
|
24242
|
+
this.toolsByKey.delete(key);
|
|
24539
24243
|
}
|
|
24540
|
-
const
|
|
24541
|
-
|
|
24542
|
-
if (!candidateQueue.length || !operationKeyMatchesScopes(candidateKey, scopePrefixes)) {
|
|
24244
|
+
for (const [key, state] of this.tasksById) {
|
|
24245
|
+
if (!stateMatchesOperation(state, event.operationId)) {
|
|
24543
24246
|
continue;
|
|
24544
24247
|
}
|
|
24545
|
-
|
|
24546
|
-
|
|
24547
|
-
|
|
24248
|
+
safeEnd(state.span, endTime);
|
|
24249
|
+
this.tasksById.delete(key);
|
|
24250
|
+
}
|
|
24251
|
+
for (const [key, state] of this.compactionsByKey) {
|
|
24252
|
+
if (!stateMatchesOperation(state, event.operationId)) {
|
|
24253
|
+
continue;
|
|
24548
24254
|
}
|
|
24549
|
-
state.
|
|
24550
|
-
|
|
24551
|
-
|
|
24552
|
-
|
|
24553
|
-
|
|
24554
|
-
|
|
24555
|
-
|
|
24556
|
-
};
|
|
24557
|
-
safeLog3(state.span, { metadata: state.metadata });
|
|
24558
|
-
return state;
|
|
24255
|
+
safeLog3(state.span, {
|
|
24256
|
+
metadata: state.metadata,
|
|
24257
|
+
metrics: durationMetrics2(event.durationMs),
|
|
24258
|
+
output: { completed: true }
|
|
24259
|
+
});
|
|
24260
|
+
safeEnd(state.span, eventTime(event.timestamp));
|
|
24261
|
+
this.compactionsByKey.delete(key);
|
|
24559
24262
|
}
|
|
24560
|
-
return void 0;
|
|
24561
24263
|
}
|
|
24562
|
-
|
|
24563
|
-
|
|
24564
|
-
|
|
24565
|
-
if (
|
|
24566
|
-
|
|
24264
|
+
finishPendingSpansForRun(event) {
|
|
24265
|
+
const endTime = eventTime(event.timestamp);
|
|
24266
|
+
for (const [key, state] of this.toolsByKey) {
|
|
24267
|
+
if (!stateMatchesRun(state, event.runId)) {
|
|
24268
|
+
continue;
|
|
24567
24269
|
}
|
|
24270
|
+
safeEnd(state.span, endTime);
|
|
24271
|
+
this.toolsByKey.delete(key);
|
|
24568
24272
|
}
|
|
24569
|
-
|
|
24570
|
-
|
|
24571
|
-
pendingOperationForEventScope(event) {
|
|
24572
|
-
const scopePrefixes = operationScopePrefixes(event);
|
|
24573
|
-
for (const [candidateKey, candidateQueue] of this.pendingOperationsByKey) {
|
|
24574
|
-
if (!candidateQueue.length || !operationKeyMatchesScopes(candidateKey, scopePrefixes)) {
|
|
24273
|
+
for (const [key, state] of this.turnsByKey) {
|
|
24274
|
+
if (!stateMatchesRun(state, event.runId)) {
|
|
24575
24275
|
continue;
|
|
24576
24276
|
}
|
|
24577
|
-
|
|
24277
|
+
safeEnd(state.span, endTime);
|
|
24278
|
+
this.turnsByKey.delete(key);
|
|
24578
24279
|
}
|
|
24579
|
-
|
|
24580
|
-
|
|
24581
|
-
|
|
24582
|
-
|
|
24583
|
-
|
|
24584
|
-
|
|
24585
|
-
return queue2.shift();
|
|
24280
|
+
for (const [key, state] of this.tasksById) {
|
|
24281
|
+
if (!stateMatchesRun(state, event.runId)) {
|
|
24282
|
+
continue;
|
|
24283
|
+
}
|
|
24284
|
+
safeEnd(state.span, endTime);
|
|
24285
|
+
this.tasksById.delete(key);
|
|
24586
24286
|
}
|
|
24587
|
-
for (const [
|
|
24588
|
-
if (
|
|
24589
|
-
|
|
24287
|
+
for (const [key, state] of this.compactionsByKey) {
|
|
24288
|
+
if (!stateMatchesRun(state, event.runId)) {
|
|
24289
|
+
continue;
|
|
24590
24290
|
}
|
|
24291
|
+
safeLog3(state.span, {
|
|
24292
|
+
metadata: state.metadata,
|
|
24293
|
+
output: { completed: true }
|
|
24294
|
+
});
|
|
24295
|
+
safeEnd(state.span, endTime);
|
|
24296
|
+
this.compactionsByKey.delete(key);
|
|
24591
24297
|
}
|
|
24592
|
-
|
|
24593
|
-
|
|
24594
|
-
|
|
24595
|
-
|
|
24596
|
-
|
|
24597
|
-
|
|
24298
|
+
for (const [key, state] of this.operationsById) {
|
|
24299
|
+
if (!stateMatchesRun(state, event.runId)) {
|
|
24300
|
+
continue;
|
|
24301
|
+
}
|
|
24302
|
+
safeLog3(state.span, {
|
|
24303
|
+
metadata: state.metadata,
|
|
24304
|
+
...state.metadata["flue.operation"] === "compact" ? { output: { completed: true } } : {}
|
|
24305
|
+
});
|
|
24306
|
+
safeEnd(state.span, endTime);
|
|
24307
|
+
this.operationsById.delete(key);
|
|
24598
24308
|
}
|
|
24599
|
-
const queue2 = [];
|
|
24600
|
-
this.pendingOperationsByKey.set(key, queue2);
|
|
24601
|
-
return queue2;
|
|
24602
24309
|
}
|
|
24603
24310
|
}, _class22);
|
|
24604
24311
|
function isInstrumentedOperation(operation) {
|
|
24605
|
-
return operation === "prompt" || operation === "skill" || operation === "
|
|
24606
|
-
}
|
|
24607
|
-
function getSessionName(session) {
|
|
24608
|
-
return typeof _optionalChain([session, 'optionalAccess', _607 => _607.name]) === "string" ? session.name : void 0;
|
|
24609
|
-
}
|
|
24610
|
-
function operationKey(sessionName, operation) {
|
|
24611
|
-
return `${_nullishCoalesce(sessionName, () => ( "unknown"))}::${operation}`;
|
|
24612
|
-
}
|
|
24613
|
-
function operationScopePrefixes(event) {
|
|
24614
|
-
const scopes = /* @__PURE__ */ new Set();
|
|
24615
|
-
for (const scope of operationScopeNames(event)) {
|
|
24616
|
-
scopes.add(`${scope}::`);
|
|
24617
|
-
}
|
|
24618
|
-
return scopes;
|
|
24619
|
-
}
|
|
24620
|
-
function operationKeyMatchesScopes(key, scopes) {
|
|
24621
|
-
for (const scope of scopes) {
|
|
24622
|
-
if (key.startsWith(scope)) {
|
|
24623
|
-
return true;
|
|
24624
|
-
}
|
|
24625
|
-
}
|
|
24626
|
-
return false;
|
|
24627
|
-
}
|
|
24628
|
-
function operationScopeNames(event) {
|
|
24629
|
-
const scopes = /* @__PURE__ */ new Set();
|
|
24630
|
-
if (event.session) {
|
|
24631
|
-
scopes.add(event.session);
|
|
24632
|
-
}
|
|
24633
|
-
if (event.parentSession) {
|
|
24634
|
-
scopes.add(event.parentSession);
|
|
24635
|
-
}
|
|
24636
|
-
if (!scopes.size) {
|
|
24637
|
-
scopes.add("unknown");
|
|
24638
|
-
}
|
|
24639
|
-
return scopes;
|
|
24640
|
-
}
|
|
24641
|
-
function addScopedOperation(operationsByScope, event, state) {
|
|
24642
|
-
for (const scope of operationScopeNames(event)) {
|
|
24643
|
-
addOperationToScope(operationsByScope, scope, state);
|
|
24644
|
-
}
|
|
24645
|
-
}
|
|
24646
|
-
function addOperationToScope(operationsByScope, scope, state) {
|
|
24647
|
-
const operations = operationsByScope.get(scope);
|
|
24648
|
-
if (operations) {
|
|
24649
|
-
if (!operations.includes(state)) {
|
|
24650
|
-
operations.push(state);
|
|
24651
|
-
}
|
|
24652
|
-
} else {
|
|
24653
|
-
operationsByScope.set(scope, [state]);
|
|
24654
|
-
}
|
|
24655
|
-
}
|
|
24656
|
-
function removeScopedOperation(operationsByScope, state) {
|
|
24657
|
-
for (const [scope, operations] of operationsByScope) {
|
|
24658
|
-
const index = operations.indexOf(state);
|
|
24659
|
-
if (index === -1) {
|
|
24660
|
-
continue;
|
|
24661
|
-
}
|
|
24662
|
-
operations.splice(index, 1);
|
|
24663
|
-
if (operations.length === 0) {
|
|
24664
|
-
operationsByScope.delete(scope);
|
|
24665
|
-
}
|
|
24666
|
-
}
|
|
24667
|
-
}
|
|
24668
|
-
function removePendingOperation(pendingOperationsByKey, state) {
|
|
24669
|
-
for (const [key, queue2] of pendingOperationsByKey) {
|
|
24670
|
-
const index = queue2.indexOf(state);
|
|
24671
|
-
if (index === -1) {
|
|
24672
|
-
continue;
|
|
24673
|
-
}
|
|
24674
|
-
queue2.splice(index, 1);
|
|
24675
|
-
if (queue2.length === 0) {
|
|
24676
|
-
pendingOperationsByKey.delete(key);
|
|
24677
|
-
}
|
|
24678
|
-
return;
|
|
24679
|
-
}
|
|
24680
|
-
}
|
|
24681
|
-
function extractSessionMetadata(session) {
|
|
24682
|
-
const sessionName = getSessionName(session);
|
|
24683
|
-
return sessionName ? { "flue.session": sessionName } : {};
|
|
24312
|
+
return operation === "prompt" || operation === "skill" || operation === "compact";
|
|
24684
24313
|
}
|
|
24685
|
-
function extractEventMetadata(event) {
|
|
24314
|
+
function extractEventMetadata(event, ctx) {
|
|
24686
24315
|
return {
|
|
24687
24316
|
...event.runId ? { "flue.run_id": event.runId } : {},
|
|
24317
|
+
...event.instanceId ? { "flue.instance_id": event.instanceId } : {},
|
|
24318
|
+
...event.dispatchId ? { "flue.dispatch_id": event.dispatchId } : {},
|
|
24688
24319
|
...typeof event.eventIndex === "number" ? { "flue.event_index": event.eventIndex } : {},
|
|
24689
24320
|
...event.session ? { "flue.session": event.session } : {},
|
|
24690
24321
|
...event.parentSession ? { "flue.parent_session": event.parentSession } : {},
|
|
24691
24322
|
...event.harness ? { "flue.harness": event.harness } : {},
|
|
24692
24323
|
...event.taskId ? { "flue.task_id": event.taskId } : {},
|
|
24693
|
-
...event.operationId ? { "flue.operation_id": event.operationId } : {}
|
|
24324
|
+
...event.operationId ? { "flue.operation_id": event.operationId } : {},
|
|
24325
|
+
...event.turnId ? { "flue.turn_id": event.turnId } : {},
|
|
24326
|
+
...typeof _optionalChain([ctx, 'optionalAccess', _585 => _585.id]) === "string" ? { "flue.context_id": ctx.id } : {},
|
|
24327
|
+
...typeof _optionalChain([ctx, 'optionalAccess', _586 => _586.runId]) === "string" ? { "flue.context_run_id": ctx.runId } : {}
|
|
24694
24328
|
};
|
|
24695
24329
|
}
|
|
24696
|
-
function
|
|
24697
|
-
|
|
24698
|
-
|
|
24699
|
-
case "task":
|
|
24700
|
-
return args[0];
|
|
24701
|
-
case "skill":
|
|
24702
|
-
return {
|
|
24703
|
-
args: _optionalChain([getOptionObject, 'call', _608 => _608(args[1]), 'optionalAccess', _609 => _609.args]),
|
|
24704
|
-
name: args[0]
|
|
24705
|
-
};
|
|
24706
|
-
case "compact":
|
|
24707
|
-
return void 0;
|
|
24330
|
+
function extractPayloadMetadata(payload) {
|
|
24331
|
+
if (!isObjectLike(payload)) {
|
|
24332
|
+
return {};
|
|
24708
24333
|
}
|
|
24334
|
+
const metadata = Reflect.get(payload, "metadata");
|
|
24335
|
+
if (!isObjectLike(metadata)) {
|
|
24336
|
+
return {};
|
|
24337
|
+
}
|
|
24338
|
+
return Object.fromEntries(Object.entries(metadata));
|
|
24709
24339
|
}
|
|
24710
|
-
function
|
|
24711
|
-
|
|
24712
|
-
|
|
24713
|
-
|
|
24714
|
-
|
|
24715
|
-
..._optionalChain([options, 'optionalAccess', _611 => _611.role]) ? { "flue.role": options.role } : {},
|
|
24716
|
-
..._optionalChain([options, 'optionalAccess', _612 => _612.thinkingLevel]) ? { "flue.thinking_level": options.thinkingLevel } : {},
|
|
24717
|
-
...typeof _optionalChain([options, 'optionalAccess', _613 => _613.cwd]) === "string" ? { "flue.cwd": options.cwd } : {},
|
|
24718
|
-
...Array.isArray(_optionalChain([options, 'optionalAccess', _614 => _614.tools])) ? {
|
|
24719
|
-
"flue.tools_count": options.tools.length,
|
|
24720
|
-
tools: summarizeTools(options.tools)
|
|
24721
|
-
} : {},
|
|
24722
|
-
...Array.isArray(_optionalChain([options, 'optionalAccess', _615 => _615.images])) ? { "flue.images_count": options.images.length } : {},
|
|
24723
|
-
..._optionalChain([options, 'optionalAccess', _616 => _616.result]) || _optionalChain([options, 'optionalAccess', _617 => _617.schema]) ? { "flue.result_schema": true } : {}
|
|
24724
|
-
};
|
|
24725
|
-
}
|
|
24726
|
-
function getOptionObject(value) {
|
|
24727
|
-
return isObject(value) ? value : void 0;
|
|
24728
|
-
}
|
|
24729
|
-
function summarizeTools(tools) {
|
|
24730
|
-
return tools.flatMap((tool) => {
|
|
24731
|
-
if (!isObject(tool)) {
|
|
24732
|
-
return [];
|
|
24733
|
-
}
|
|
24734
|
-
const name = typeof tool.name === "string" ? tool.name : void 0;
|
|
24735
|
-
if (!name) {
|
|
24736
|
-
return [];
|
|
24737
|
-
}
|
|
24738
|
-
return [
|
|
24739
|
-
{
|
|
24740
|
-
function: {
|
|
24741
|
-
description: typeof tool.description === "string" ? tool.description : void 0,
|
|
24742
|
-
name,
|
|
24743
|
-
parameters: tool.parameters
|
|
24744
|
-
},
|
|
24745
|
-
type: "function"
|
|
24746
|
-
}
|
|
24747
|
-
];
|
|
24748
|
-
});
|
|
24340
|
+
function operationOutput(event) {
|
|
24341
|
+
if (event.operationKind === "prompt" || event.operationKind === "skill") {
|
|
24342
|
+
return llmResultFromOperationResult(event.result);
|
|
24343
|
+
}
|
|
24344
|
+
return _nullishCoalesce(event.result, () => ( (event.operationKind === "compact" ? { completed: true } : void 0)));
|
|
24749
24345
|
}
|
|
24750
|
-
function
|
|
24751
|
-
|
|
24752
|
-
|
|
24753
|
-
|
|
24754
|
-
|
|
24755
|
-
|
|
24346
|
+
function llmResultFromOperationResult(result) {
|
|
24347
|
+
if (!isObjectLike(result)) {
|
|
24348
|
+
return result;
|
|
24349
|
+
}
|
|
24350
|
+
const text = Reflect.get(result, "text");
|
|
24351
|
+
return text === void 0 ? result : text;
|
|
24756
24352
|
}
|
|
24757
|
-
function
|
|
24758
|
-
if (!result) {
|
|
24353
|
+
function usageFromOperationResult(result) {
|
|
24354
|
+
if (!isObjectLike(result)) {
|
|
24759
24355
|
return void 0;
|
|
24760
24356
|
}
|
|
24761
|
-
|
|
24762
|
-
return result.data;
|
|
24763
|
-
}
|
|
24764
|
-
if ("text" in result) {
|
|
24765
|
-
return result.text;
|
|
24766
|
-
}
|
|
24767
|
-
return result;
|
|
24357
|
+
return Reflect.get(result, "usage");
|
|
24768
24358
|
}
|
|
24769
24359
|
function metricsFromUsage(usage) {
|
|
24360
|
+
if (!isObjectLike(usage)) {
|
|
24361
|
+
return {};
|
|
24362
|
+
}
|
|
24363
|
+
const cacheRead = Reflect.get(usage, "cacheRead");
|
|
24364
|
+
const cacheWrite = Reflect.get(usage, "cacheWrite");
|
|
24365
|
+
const cost = Reflect.get(usage, "cost");
|
|
24366
|
+
const input = Reflect.get(usage, "input");
|
|
24367
|
+
const output = Reflect.get(usage, "output");
|
|
24368
|
+
const totalTokens = Reflect.get(usage, "totalTokens");
|
|
24369
|
+
const totalCost = isObjectLike(cost) ? Reflect.get(cost, "total") : void 0;
|
|
24770
24370
|
return {
|
|
24771
|
-
...typeof
|
|
24772
|
-
...typeof
|
|
24773
|
-
...typeof
|
|
24774
|
-
...typeof
|
|
24775
|
-
...typeof
|
|
24776
|
-
...typeof
|
|
24777
|
-
};
|
|
24778
|
-
}
|
|
24779
|
-
function buildDurationMetrics3(startTime) {
|
|
24780
|
-
return {
|
|
24781
|
-
duration_ms: Math.max(0, (getCurrentUnixTimestamp() - startTime) * 1e3)
|
|
24371
|
+
...typeof input === "number" ? { prompt_tokens: input } : {},
|
|
24372
|
+
...typeof output === "number" ? { completion_tokens: output } : {},
|
|
24373
|
+
...typeof cacheRead === "number" ? { prompt_cached_tokens: cacheRead } : {},
|
|
24374
|
+
...typeof cacheWrite === "number" ? { prompt_cache_creation_tokens: cacheWrite } : {},
|
|
24375
|
+
...typeof totalTokens === "number" ? { tokens: totalTokens } : {},
|
|
24376
|
+
...typeof totalCost === "number" ? { estimated_cost: totalCost } : {}
|
|
24782
24377
|
};
|
|
24783
24378
|
}
|
|
24784
|
-
function
|
|
24379
|
+
function durationMetrics2(durationMs) {
|
|
24785
24380
|
return typeof durationMs === "number" ? { duration_ms: durationMs } : {};
|
|
24786
24381
|
}
|
|
24787
|
-
function
|
|
24788
|
-
if (
|
|
24789
|
-
return
|
|
24790
|
-
}
|
|
24791
|
-
if (event.taskId) {
|
|
24792
|
-
return `task:${event.taskId}`;
|
|
24793
|
-
}
|
|
24794
|
-
if (event.session) {
|
|
24795
|
-
return `session:${event.session}`;
|
|
24382
|
+
function eventTime(value) {
|
|
24383
|
+
if (typeof value !== "string") {
|
|
24384
|
+
return void 0;
|
|
24796
24385
|
}
|
|
24797
|
-
|
|
24386
|
+
const timestamp = Date.parse(value);
|
|
24387
|
+
return Number.isFinite(timestamp) ? timestamp / 1e3 : void 0;
|
|
24388
|
+
}
|
|
24389
|
+
function turnKey(event) {
|
|
24390
|
+
return event.turnId;
|
|
24798
24391
|
}
|
|
24799
24392
|
function toolKey(event) {
|
|
24800
|
-
return `${
|
|
24393
|
+
return `${_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(event.turnId, () => ( event.operationId)), () => ( event.taskId)), () => ( event.runId)), () => ( "unknown"))}:${_nullishCoalesce(event.toolCallId, () => ( "unknown"))}`;
|
|
24801
24394
|
}
|
|
24802
|
-
function
|
|
24395
|
+
function compactionKey(event) {
|
|
24803
24396
|
return [
|
|
24804
|
-
|
|
24805
|
-
|
|
24806
|
-
|
|
24807
|
-
|
|
24808
|
-
|
|
24809
|
-
|
|
24810
|
-
|
|
24811
|
-
|
|
24812
|
-
|
|
24813
|
-
|
|
24814
|
-
|
|
24815
|
-
|
|
24816
|
-
},
|
|
24817
|
-
...toolCall.toolCallId ? { id: toolCall.toolCallId } : {},
|
|
24818
|
-
type: "function"
|
|
24819
|
-
}))
|
|
24820
|
-
} : {}
|
|
24821
|
-
}
|
|
24822
|
-
}
|
|
24823
|
-
];
|
|
24397
|
+
_nullishCoalesce(event.instanceId, () => ( "")),
|
|
24398
|
+
_nullishCoalesce(event.runId, () => ( "")),
|
|
24399
|
+
_nullishCoalesce(event.session, () => ( "")),
|
|
24400
|
+
_nullishCoalesce(event.operationId, () => ( "")),
|
|
24401
|
+
_nullishCoalesce(event.taskId, () => ( ""))
|
|
24402
|
+
].join(":");
|
|
24403
|
+
}
|
|
24404
|
+
function stateMatchesOperation(state, operationId) {
|
|
24405
|
+
return state.metadata["flue.operation_id"] === operationId;
|
|
24406
|
+
}
|
|
24407
|
+
function stateMatchesRun(state, runId) {
|
|
24408
|
+
return state.metadata["flue.run_id"] === runId;
|
|
24824
24409
|
}
|
|
24825
24410
|
function startFlueSpan(parent, args) {
|
|
24826
24411
|
return parent ? withCurrent(parent, () => startSpan(args)) : startSpan(args);
|
|
@@ -24832,6 +24417,13 @@ function safeLog3(span, event) {
|
|
|
24832
24417
|
logInstrumentationError3("Flue span log", error);
|
|
24833
24418
|
}
|
|
24834
24419
|
}
|
|
24420
|
+
function safeEnd(span, endTime) {
|
|
24421
|
+
try {
|
|
24422
|
+
span.end(endTime === void 0 ? void 0 : { endTime });
|
|
24423
|
+
} catch (error) {
|
|
24424
|
+
logInstrumentationError3("Flue span end", error);
|
|
24425
|
+
}
|
|
24426
|
+
}
|
|
24835
24427
|
function errorToString(error) {
|
|
24836
24428
|
if (error instanceof Error) {
|
|
24837
24429
|
return error.message;
|
|
@@ -24841,7 +24433,7 @@ function errorToString(error) {
|
|
|
24841
24433
|
}
|
|
24842
24434
|
try {
|
|
24843
24435
|
return JSON.stringify(error);
|
|
24844
|
-
} catch (
|
|
24436
|
+
} catch (e48) {
|
|
24845
24437
|
return String(error);
|
|
24846
24438
|
}
|
|
24847
24439
|
}
|
|
@@ -24862,11 +24454,11 @@ var BraintrustLangChainCallbackHandler = (_class23 = class {
|
|
|
24862
24454
|
__init83() {this.firstTokenTimes = /* @__PURE__ */ new Map()}
|
|
24863
24455
|
__init84() {this.ttftMs = /* @__PURE__ */ new Map()}
|
|
24864
24456
|
constructor(options) {;_class23.prototype.__init79.call(this);_class23.prototype.__init80.call(this);_class23.prototype.__init81.call(this);_class23.prototype.__init82.call(this);_class23.prototype.__init83.call(this);_class23.prototype.__init84.call(this);
|
|
24865
|
-
this.parent = _optionalChain([options, 'optionalAccess',
|
|
24457
|
+
this.parent = _optionalChain([options, 'optionalAccess', _587 => _587.parent]);
|
|
24866
24458
|
this.options = {
|
|
24867
|
-
debug: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
24868
|
-
excludeMetadataProps: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
24869
|
-
logger: _optionalChain([options, 'optionalAccess',
|
|
24459
|
+
debug: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _588 => _588.debug]), () => ( false)),
|
|
24460
|
+
excludeMetadataProps: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _589 => _589.excludeMetadataProps]), () => ( /^(l[sc]_|langgraph_|__pregel_|checkpoint_ns)/)),
|
|
24461
|
+
logger: _optionalChain([options, 'optionalAccess', _590 => _590.logger])
|
|
24870
24462
|
};
|
|
24871
24463
|
}
|
|
24872
24464
|
startSpan({
|
|
@@ -24880,7 +24472,7 @@ var BraintrustLangChainCallbackHandler = (_class23 = class {
|
|
|
24880
24472
|
if (!parentRunId) {
|
|
24881
24473
|
this.rootRunId = runId;
|
|
24882
24474
|
}
|
|
24883
|
-
const tags = _optionalChain([args, 'access',
|
|
24475
|
+
const tags = _optionalChain([args, 'access', _591 => _591.event, 'optionalAccess', _592 => _592.tags]);
|
|
24884
24476
|
const spanAttributes = args.spanAttributes || {};
|
|
24885
24477
|
spanAttributes.type = args.type || spanAttributes.type || "task";
|
|
24886
24478
|
args.type = spanAttributes.type;
|
|
@@ -24900,7 +24492,7 @@ var BraintrustLangChainCallbackHandler = (_class23 = class {
|
|
|
24900
24492
|
tags: void 0,
|
|
24901
24493
|
metadata: {
|
|
24902
24494
|
...tags ? { tags } : {},
|
|
24903
|
-
..._optionalChain([args, 'access',
|
|
24495
|
+
..._optionalChain([args, 'access', _593 => _593.event, 'optionalAccess', _594 => _594.metadata]),
|
|
24904
24496
|
braintrust: {
|
|
24905
24497
|
integration_name: "langchain-js",
|
|
24906
24498
|
sdk_language: "javascript"
|
|
@@ -25002,7 +24594,7 @@ var BraintrustLangChainCallbackHandler = (_class23 = class {
|
|
|
25002
24594
|
});
|
|
25003
24595
|
}
|
|
25004
24596
|
async handleChainStart(chain, inputs, runId, parentRunId, tags, metadata, runType, runName) {
|
|
25005
|
-
if (_optionalChain([tags, 'optionalAccess',
|
|
24597
|
+
if (_optionalChain([tags, 'optionalAccess', _595 => _595.includes, 'call', _596 => _596("langsmith:hidden")])) {
|
|
25006
24598
|
this.skippedRuns.add(runId);
|
|
25007
24599
|
return;
|
|
25008
24600
|
}
|
|
@@ -25112,7 +24704,7 @@ function getSerializedName(serialized) {
|
|
|
25112
24704
|
if (typeof serialized.name === "string") {
|
|
25113
24705
|
return serialized.name;
|
|
25114
24706
|
}
|
|
25115
|
-
const lastIdPart = _optionalChain([serialized, 'access',
|
|
24707
|
+
const lastIdPart = _optionalChain([serialized, 'access', _597 => _597.id, 'optionalAccess', _598 => _598.at, 'call', _599 => _599(-1)]);
|
|
25116
24708
|
return typeof lastIdPart === "string" ? lastIdPart : void 0;
|
|
25117
24709
|
}
|
|
25118
24710
|
function cleanObject(obj) {
|
|
@@ -25190,7 +24782,7 @@ function getMetricsFromResponse(response) {
|
|
|
25190
24782
|
function safeJsonParse(input) {
|
|
25191
24783
|
try {
|
|
25192
24784
|
return JSON.parse(input);
|
|
25193
|
-
} catch (
|
|
24785
|
+
} catch (e49) {
|
|
25194
24786
|
return input;
|
|
25195
24787
|
}
|
|
25196
24788
|
}
|
|
@@ -25199,11 +24791,11 @@ function isRecord(value) {
|
|
|
25199
24791
|
}
|
|
25200
24792
|
|
|
25201
24793
|
// src/instrumentation/plugins/langchain-plugin.ts
|
|
25202
|
-
var LangChainPlugin = (_class24 = class extends BasePlugin {constructor(...
|
|
24794
|
+
var LangChainPlugin = (_class24 = class extends BasePlugin {constructor(...args6) { super(...args6); _class24.prototype.__init85.call(this); }
|
|
25203
24795
|
__init85() {this.injectedManagers = /* @__PURE__ */ new WeakSet()}
|
|
25204
24796
|
onEnable() {
|
|
25205
|
-
this.subscribeToConfigure(
|
|
25206
|
-
this.subscribeToConfigure(
|
|
24797
|
+
this.subscribeToConfigure(_chunkVMBQETG3js.langChainChannels.configure);
|
|
24798
|
+
this.subscribeToConfigure(_chunkVMBQETG3js.langChainChannels.configureSync);
|
|
25207
24799
|
}
|
|
25208
24800
|
onDisable() {
|
|
25209
24801
|
for (const unsubscribe of this.unsubscribers) {
|
|
@@ -25237,7 +24829,7 @@ var LangChainPlugin = (_class24 = class extends BasePlugin {constructor(...args7
|
|
|
25237
24829
|
try {
|
|
25238
24830
|
result.addHandler(new BraintrustLangChainCallbackHandler(), true);
|
|
25239
24831
|
this.injectedManagers.add(result);
|
|
25240
|
-
} catch (
|
|
24832
|
+
} catch (e50) {
|
|
25241
24833
|
}
|
|
25242
24834
|
}
|
|
25243
24835
|
}, _class24);
|
|
@@ -25249,7 +24841,7 @@ function isCallbackManager(value) {
|
|
|
25249
24841
|
return typeof maybeManager.addHandler === "function";
|
|
25250
24842
|
}
|
|
25251
24843
|
function hasBraintrustHandler(manager) {
|
|
25252
|
-
return _nullishCoalesce(_optionalChain([manager, 'access',
|
|
24844
|
+
return _nullishCoalesce(_optionalChain([manager, 'access', _600 => _600.handlers, 'optionalAccess', _601 => _601.some, 'call', _602 => _602((handler) => {
|
|
25253
24845
|
if (typeof handler !== "object" || handler === null) {
|
|
25254
24846
|
return false;
|
|
25255
24847
|
}
|
|
@@ -25549,15 +25141,15 @@ var PluginRegistry = (_class26 = class {constructor() { _class26.prototype.__ini
|
|
|
25549
25141
|
* Get default configuration (all integrations enabled).
|
|
25550
25142
|
*/
|
|
25551
25143
|
getDefaultConfig() {
|
|
25552
|
-
return
|
|
25144
|
+
return _chunkVMBQETG3js.getDefaultInstrumentationIntegrations.call(void 0, );
|
|
25553
25145
|
}
|
|
25554
25146
|
/**
|
|
25555
25147
|
* Read configuration from environment variables.
|
|
25556
25148
|
* Supports: BRAINTRUST_DISABLE_INSTRUMENTATION=openai,anthropic,...
|
|
25557
25149
|
*/
|
|
25558
25150
|
readEnvConfig() {
|
|
25559
|
-
return
|
|
25560
|
-
|
|
25151
|
+
return _chunkVMBQETG3js.readDisabledInstrumentationEnvConfig.call(void 0,
|
|
25152
|
+
_chunkVMBQETG3js.isomorph_default.getEnv("BRAINTRUST_DISABLE_INSTRUMENTATION")
|
|
25561
25153
|
);
|
|
25562
25154
|
}
|
|
25563
25155
|
}, _class26);
|
|
@@ -25764,16 +25356,16 @@ function wrapMastraAgent(agent, _options) {
|
|
|
25764
25356
|
// src/node/config.ts
|
|
25765
25357
|
var BRAINTRUST_ENV_SEARCH_PARENT_LIMIT = 64;
|
|
25766
25358
|
function configureNode() {
|
|
25767
|
-
|
|
25768
|
-
|
|
25769
|
-
|
|
25770
|
-
|
|
25359
|
+
_chunkVMBQETG3js.isomorph_default.buildType = "node";
|
|
25360
|
+
_chunkVMBQETG3js.isomorph_default.getRepoInfo = getRepoInfo;
|
|
25361
|
+
_chunkVMBQETG3js.isomorph_default.getPastNAncestors = getPastNAncestors;
|
|
25362
|
+
_chunkVMBQETG3js.isomorph_default.getEnv = (name) => {
|
|
25771
25363
|
const value = process.env[name];
|
|
25772
|
-
return name === "BRAINTRUST_API_KEY" && !_optionalChain([value, 'optionalAccess',
|
|
25364
|
+
return name === "BRAINTRUST_API_KEY" && !_optionalChain([value, 'optionalAccess', _603 => _603.trim, 'call', _604 => _604()]) ? void 0 : value;
|
|
25773
25365
|
};
|
|
25774
|
-
|
|
25366
|
+
_chunkVMBQETG3js.isomorph_default.getBraintrustApiKey = async () => {
|
|
25775
25367
|
const value = process.env.BRAINTRUST_API_KEY;
|
|
25776
|
-
if (_optionalChain([value, 'optionalAccess',
|
|
25368
|
+
if (_optionalChain([value, 'optionalAccess', _605 => _605.trim, 'call', _606 => _606()])) {
|
|
25777
25369
|
return value;
|
|
25778
25370
|
}
|
|
25779
25371
|
const envPaths = [];
|
|
@@ -25804,7 +25396,7 @@ function configureNode() {
|
|
|
25804
25396
|
if ("contents" in nearestResult) {
|
|
25805
25397
|
const parsed = dotenv.parse(nearestResult.contents);
|
|
25806
25398
|
const apiKey = parsed.BRAINTRUST_API_KEY;
|
|
25807
|
-
return _optionalChain([apiKey, 'optionalAccess',
|
|
25399
|
+
return _optionalChain([apiKey, 'optionalAccess', _607 => _607.trim, 'call', _608 => _608()]) ? apiKey : void 0;
|
|
25808
25400
|
}
|
|
25809
25401
|
const e = nearestResult.error;
|
|
25810
25402
|
if (typeof e === "object" && e !== null && "code" in e && e.code === "ENOENT") {
|
|
@@ -25816,48 +25408,48 @@ function configureNode() {
|
|
|
25816
25408
|
}
|
|
25817
25409
|
return void 0;
|
|
25818
25410
|
};
|
|
25819
|
-
|
|
25820
|
-
|
|
25821
|
-
|
|
25822
|
-
|
|
25823
|
-
|
|
25411
|
+
_chunkVMBQETG3js.isomorph_default.getCallerLocation = getCallerLocation;
|
|
25412
|
+
_chunkVMBQETG3js.isomorph_default.newAsyncLocalStorage = () => new (0, _nodeasync_hooks.AsyncLocalStorage)();
|
|
25413
|
+
_chunkVMBQETG3js.isomorph_default.newTracingChannel = (nameOrChannels) => diagnostics_channel.tracingChannel(nameOrChannels);
|
|
25414
|
+
_chunkVMBQETG3js.patchTracingChannel.call(void 0, diagnostics_channel.tracingChannel);
|
|
25415
|
+
_chunkVMBQETG3js.isomorph_default.processOn = (event, handler) => {
|
|
25824
25416
|
process.on(event, handler);
|
|
25825
25417
|
};
|
|
25826
|
-
|
|
25827
|
-
|
|
25828
|
-
|
|
25829
|
-
|
|
25830
|
-
|
|
25831
|
-
|
|
25832
|
-
|
|
25833
|
-
|
|
25834
|
-
|
|
25835
|
-
|
|
25836
|
-
|
|
25837
|
-
|
|
25838
|
-
|
|
25839
|
-
|
|
25840
|
-
|
|
25841
|
-
|
|
25842
|
-
|
|
25843
|
-
|
|
25844
|
-
|
|
25845
|
-
|
|
25846
|
-
|
|
25847
|
-
|
|
25418
|
+
_chunkVMBQETG3js.isomorph_default.basename = path.basename;
|
|
25419
|
+
_chunkVMBQETG3js.isomorph_default.writeln = (text) => process.stdout.write(text + "\n");
|
|
25420
|
+
_chunkVMBQETG3js.isomorph_default.pathJoin = path.join;
|
|
25421
|
+
_chunkVMBQETG3js.isomorph_default.pathDirname = path.dirname;
|
|
25422
|
+
_chunkVMBQETG3js.isomorph_default.mkdir = fs.mkdir;
|
|
25423
|
+
_chunkVMBQETG3js.isomorph_default.writeFile = fs.writeFile;
|
|
25424
|
+
_chunkVMBQETG3js.isomorph_default.readFile = fs.readFile;
|
|
25425
|
+
_chunkVMBQETG3js.isomorph_default.readdir = fs.readdir;
|
|
25426
|
+
_chunkVMBQETG3js.isomorph_default.stat = fs.stat;
|
|
25427
|
+
_chunkVMBQETG3js.isomorph_default.statSync = fsSync.statSync;
|
|
25428
|
+
_chunkVMBQETG3js.isomorph_default.utimes = fs.utimes;
|
|
25429
|
+
_chunkVMBQETG3js.isomorph_default.unlink = fs.unlink;
|
|
25430
|
+
_chunkVMBQETG3js.isomorph_default.homedir = os.homedir;
|
|
25431
|
+
_chunkVMBQETG3js.isomorph_default.tmpdir = os.tmpdir;
|
|
25432
|
+
_chunkVMBQETG3js.isomorph_default.writeFileSync = fsSync.writeFileSync;
|
|
25433
|
+
_chunkVMBQETG3js.isomorph_default.appendFileSync = fsSync.appendFileSync;
|
|
25434
|
+
_chunkVMBQETG3js.isomorph_default.readFileSync = (filename, encoding) => fsSync.readFileSync(filename, encoding);
|
|
25435
|
+
_chunkVMBQETG3js.isomorph_default.unlinkSync = fsSync.unlinkSync;
|
|
25436
|
+
_chunkVMBQETG3js.isomorph_default.openFile = fs.open;
|
|
25437
|
+
_chunkVMBQETG3js.isomorph_default.gzip = _nodeutil.promisify.call(void 0, zlib.gzip);
|
|
25438
|
+
_chunkVMBQETG3js.isomorph_default.gunzip = _nodeutil.promisify.call(void 0, zlib.gunzip);
|
|
25439
|
+
_chunkVMBQETG3js.isomorph_default.hash = (data) => crypto.createHash("sha256").update(data).digest("hex");
|
|
25848
25440
|
_internalSetInitialState();
|
|
25849
|
-
const disabled =
|
|
25850
|
-
|
|
25441
|
+
const disabled = _chunkVMBQETG3js.readDisabledInstrumentationEnvConfig.call(void 0,
|
|
25442
|
+
_chunkVMBQETG3js.isomorph_default.getEnv("BRAINTRUST_DISABLE_INSTRUMENTATION")
|
|
25851
25443
|
).integrations;
|
|
25852
|
-
if (!
|
|
25853
|
-
|
|
25444
|
+
if (!_chunkVMBQETG3js.isInstrumentationIntegrationDisabled.call(void 0, disabled, "mastra")) {
|
|
25445
|
+
_chunkVMBQETG3js.installMastraExporterFactory.call(void 0, () => new BraintrustObservabilityExporter());
|
|
25854
25446
|
}
|
|
25855
25447
|
registry.enable();
|
|
25856
25448
|
}
|
|
25857
25449
|
|
|
25858
25450
|
// src/exports.ts
|
|
25859
25451
|
var exports_exports = {};
|
|
25860
|
-
|
|
25452
|
+
_chunkVMBQETG3js.__export.call(void 0, exports_exports, {
|
|
25861
25453
|
Attachment: () => Attachment,
|
|
25862
25454
|
AttachmentReference: () => AttachmentReference,
|
|
25863
25455
|
BRAINTRUST_CURRENT_SPAN_STORE: () => BRAINTRUST_CURRENT_SPAN_STORE,
|
|
@@ -25910,9 +25502,10 @@ _chunkNKD77KGBjs.__export.call(void 0, exports_exports, {
|
|
|
25910
25502
|
X_CACHED_HEADER: () => X_CACHED_HEADER,
|
|
25911
25503
|
_exportsForTestingOnly: () => _exportsForTestingOnly,
|
|
25912
25504
|
_internalGetGlobalState: () => _internalGetGlobalState,
|
|
25913
|
-
_internalIso: () =>
|
|
25505
|
+
_internalIso: () => _chunkVMBQETG3js.isomorph_default,
|
|
25914
25506
|
_internalSetInitialState: () => _internalSetInitialState,
|
|
25915
25507
|
addAzureBlobHeaders: () => addAzureBlobHeaders,
|
|
25508
|
+
braintrustFlueObserver: () => braintrustFlueObserver,
|
|
25916
25509
|
braintrustStreamChunkSchema: () => braintrustStreamChunkSchema,
|
|
25917
25510
|
buildLocalSummary: () => buildLocalSummary,
|
|
25918
25511
|
configureInstrumentation: () => configureInstrumentation,
|
|
@@ -25992,8 +25585,6 @@ _chunkNKD77KGBjs.__export.call(void 0, exports_exports, {
|
|
|
25992
25585
|
wrapCohere: () => wrapCohere,
|
|
25993
25586
|
wrapCopilotClient: () => wrapCopilotClient,
|
|
25994
25587
|
wrapCursorSDK: () => wrapCursorSDK,
|
|
25995
|
-
wrapFlueContext: () => wrapFlueContext,
|
|
25996
|
-
wrapFlueSession: () => wrapFlueSession,
|
|
25997
25588
|
wrapGenkit: () => wrapGenkit,
|
|
25998
25589
|
wrapGoogleADK: () => wrapGoogleADK,
|
|
25999
25590
|
wrapGoogleGenAI: () => wrapGoogleGenAI,
|
|
@@ -26189,7 +25780,7 @@ function initFunction({
|
|
|
26189
25780
|
state
|
|
26190
25781
|
}) {
|
|
26191
25782
|
const s = _nullishCoalesce(state, () => ( _internalGetGlobalState()));
|
|
26192
|
-
_optionalChain([s, 'optionalAccess',
|
|
25783
|
+
_optionalChain([s, 'optionalAccess', _609 => _609.spanCache, 'optionalAccess', _610 => _610.disable, 'call', _611 => _611()]);
|
|
26193
25784
|
const f = async (input) => {
|
|
26194
25785
|
return await invoke({
|
|
26195
25786
|
projectName,
|
|
@@ -26266,22 +25857,22 @@ function responsesProxy(openai) {
|
|
|
26266
25857
|
if (name === "create" && typeof target.create === "function") {
|
|
26267
25858
|
return wrapResponsesAsync(
|
|
26268
25859
|
target.create.bind(target),
|
|
26269
|
-
|
|
25860
|
+
_chunkVMBQETG3js.openAIChannels.responsesCreate
|
|
26270
25861
|
);
|
|
26271
25862
|
} else if (name === "stream" && typeof target.stream === "function") {
|
|
26272
25863
|
return wrapResponsesSyncStream(
|
|
26273
25864
|
target.stream.bind(target),
|
|
26274
|
-
|
|
25865
|
+
_chunkVMBQETG3js.openAIChannels.responsesStream
|
|
26275
25866
|
);
|
|
26276
25867
|
} else if (name === "parse" && typeof target.parse === "function") {
|
|
26277
25868
|
return wrapResponsesAsync(
|
|
26278
25869
|
target.parse.bind(target),
|
|
26279
|
-
|
|
25870
|
+
_chunkVMBQETG3js.openAIChannels.responsesParse
|
|
26280
25871
|
);
|
|
26281
25872
|
} else if (name === "compact" && typeof target.compact === "function") {
|
|
26282
25873
|
return wrapResponsesAsync(
|
|
26283
25874
|
target.compact.bind(target),
|
|
26284
|
-
|
|
25875
|
+
_chunkVMBQETG3js.openAIChannels.responsesCompact
|
|
26285
25876
|
);
|
|
26286
25877
|
}
|
|
26287
25878
|
return Reflect.get(target, name, receiver);
|
|
@@ -26354,9 +25945,9 @@ function wrapOpenAIv4(openai) {
|
|
|
26354
25945
|
const embeddingProxy = createEndpointProxy(typedOpenai.embeddings, wrapEmbeddings);
|
|
26355
25946
|
const moderationProxy = createEndpointProxy(typedOpenai.moderations, wrapModerations);
|
|
26356
25947
|
let betaProxy3;
|
|
26357
|
-
if (_optionalChain([typedOpenai, 'access',
|
|
25948
|
+
if (_optionalChain([typedOpenai, 'access', _612 => _612.beta, 'optionalAccess', _613 => _613.chat, 'optionalAccess', _614 => _614.completions, 'optionalAccess', _615 => _615.stream])) {
|
|
26358
25949
|
const betaChatCompletionProxy = new Proxy(
|
|
26359
|
-
_optionalChain([typedOpenai, 'optionalAccess',
|
|
25950
|
+
_optionalChain([typedOpenai, 'optionalAccess', _616 => _616.beta, 'optionalAccess', _617 => _617.chat, 'access', _618 => _618.completions]),
|
|
26360
25951
|
{
|
|
26361
25952
|
get(target, name, receiver) {
|
|
26362
25953
|
const baseVal = Reflect.get(target, name, receiver);
|
|
@@ -26425,7 +26016,7 @@ function wrapBetaChatCompletionParse(completion) {
|
|
|
26425
26016
|
const { span_info, params } = splitSpanInfo(
|
|
26426
26017
|
allParams
|
|
26427
26018
|
);
|
|
26428
|
-
return
|
|
26019
|
+
return _chunkVMBQETG3js.openAIChannels.betaChatCompletionsParse.tracePromise(
|
|
26429
26020
|
async () => await completion(params),
|
|
26430
26021
|
{ arguments: [params], span_info }
|
|
26431
26022
|
);
|
|
@@ -26436,7 +26027,7 @@ function wrapBetaChatCompletionStream(completion) {
|
|
|
26436
26027
|
const { span_info, params } = splitSpanInfo(
|
|
26437
26028
|
allParams
|
|
26438
26029
|
);
|
|
26439
|
-
return
|
|
26030
|
+
return _chunkVMBQETG3js.openAIChannels.betaChatCompletionsStream.traceSync(
|
|
26440
26031
|
() => completion(params),
|
|
26441
26032
|
{ arguments: [params], span_info }
|
|
26442
26033
|
);
|
|
@@ -26452,7 +26043,7 @@ function wrapChatCompletion(completion) {
|
|
|
26452
26043
|
if (!executionPromise) {
|
|
26453
26044
|
executionPromise = (async () => {
|
|
26454
26045
|
const traceContext = createChannelContext(
|
|
26455
|
-
|
|
26046
|
+
_chunkVMBQETG3js.openAIChannels.chatCompletionsCreate,
|
|
26456
26047
|
params,
|
|
26457
26048
|
span_info
|
|
26458
26049
|
);
|
|
@@ -26462,7 +26053,7 @@ function wrapChatCompletion(completion) {
|
|
|
26462
26053
|
options
|
|
26463
26054
|
);
|
|
26464
26055
|
const { data: data2, response: response2 } = await tracePromiseWithResponse(
|
|
26465
|
-
|
|
26056
|
+
_chunkVMBQETG3js.openAIChannels.chatCompletionsCreate,
|
|
26466
26057
|
traceContext,
|
|
26467
26058
|
completionPromise
|
|
26468
26059
|
);
|
|
@@ -26473,7 +26064,7 @@ function wrapChatCompletion(completion) {
|
|
|
26473
26064
|
options
|
|
26474
26065
|
);
|
|
26475
26066
|
const { data, response } = await tracePromiseWithResponse(
|
|
26476
|
-
|
|
26067
|
+
_chunkVMBQETG3js.openAIChannels.chatCompletionsCreate,
|
|
26477
26068
|
traceContext,
|
|
26478
26069
|
completionResponse
|
|
26479
26070
|
);
|
|
@@ -26516,15 +26107,15 @@ function wrapApiCreateWithChannel(create, channel) {
|
|
|
26516
26107
|
return createLazyAPIPromise(ensureExecuted);
|
|
26517
26108
|
};
|
|
26518
26109
|
}
|
|
26519
|
-
var wrapEmbeddings = (create) => wrapApiCreateWithChannel(create,
|
|
26520
|
-
var wrapModerations = (create) => wrapApiCreateWithChannel(create,
|
|
26110
|
+
var wrapEmbeddings = (create) => wrapApiCreateWithChannel(create, _chunkVMBQETG3js.openAIChannels.embeddingsCreate);
|
|
26111
|
+
var wrapModerations = (create) => wrapApiCreateWithChannel(create, _chunkVMBQETG3js.openAIChannels.moderationsCreate);
|
|
26521
26112
|
|
|
26522
26113
|
// src/wrappers/ai-sdk/ai-sdk.ts
|
|
26523
26114
|
function isModuleNamespace(obj) {
|
|
26524
26115
|
if (!obj || typeof obj !== "object") {
|
|
26525
26116
|
return false;
|
|
26526
26117
|
}
|
|
26527
|
-
if (_optionalChain([obj, 'access',
|
|
26118
|
+
if (_optionalChain([obj, 'access', _619 => _619.constructor, 'optionalAccess', _620 => _620.name]) === "Module") {
|
|
26528
26119
|
return true;
|
|
26529
26120
|
}
|
|
26530
26121
|
try {
|
|
@@ -26533,7 +26124,7 @@ function isModuleNamespace(obj) {
|
|
|
26533
26124
|
const firstKey = keys[0];
|
|
26534
26125
|
const descriptor = Object.getOwnPropertyDescriptor(obj, firstKey);
|
|
26535
26126
|
return descriptor ? !descriptor.configurable && !descriptor.writable : false;
|
|
26536
|
-
} catch (
|
|
26127
|
+
} catch (e51) {
|
|
26537
26128
|
return false;
|
|
26538
26129
|
}
|
|
26539
26130
|
}
|
|
@@ -26604,7 +26195,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
|
|
|
26604
26195
|
var wrapAgentGenerate = (generate, instance, options = {}) => {
|
|
26605
26196
|
const defaultName = `${instance.constructor.name}.generate`;
|
|
26606
26197
|
return async (params) => makeGenerateTextWrapper(
|
|
26607
|
-
|
|
26198
|
+
_chunkVMBQETG3js.aiSDKChannels.generateText,
|
|
26608
26199
|
defaultName,
|
|
26609
26200
|
generate.bind(instance),
|
|
26610
26201
|
{
|
|
@@ -26617,7 +26208,7 @@ var wrapAgentGenerate = (generate, instance, options = {}) => {
|
|
|
26617
26208
|
var wrapAgentStream = (stream, instance, options = {}) => {
|
|
26618
26209
|
const defaultName = `${instance.constructor.name}.stream`;
|
|
26619
26210
|
return (params) => makeStreamWrapper(
|
|
26620
|
-
|
|
26211
|
+
_chunkVMBQETG3js.aiSDKChannels.agentStream,
|
|
26621
26212
|
defaultName,
|
|
26622
26213
|
stream.bind(instance),
|
|
26623
26214
|
{
|
|
@@ -26649,7 +26240,7 @@ var makeGenerateTextWrapper = (channel, name, generateText, contextOptions = {},
|
|
|
26649
26240
|
};
|
|
26650
26241
|
var wrapGenerateText = (generateText, options = {}, aiSDK) => {
|
|
26651
26242
|
return makeGenerateTextWrapper(
|
|
26652
|
-
|
|
26243
|
+
_chunkVMBQETG3js.aiSDKChannels.generateText,
|
|
26653
26244
|
"generateText",
|
|
26654
26245
|
generateText,
|
|
26655
26246
|
{ aiSDK },
|
|
@@ -26658,7 +26249,7 @@ var wrapGenerateText = (generateText, options = {}, aiSDK) => {
|
|
|
26658
26249
|
};
|
|
26659
26250
|
var wrapGenerateObject = (generateObject, options = {}, aiSDK) => {
|
|
26660
26251
|
return makeGenerateTextWrapper(
|
|
26661
|
-
|
|
26252
|
+
_chunkVMBQETG3js.aiSDKChannels.generateObject,
|
|
26662
26253
|
"generateObject",
|
|
26663
26254
|
generateObject,
|
|
26664
26255
|
{ aiSDK },
|
|
@@ -26687,7 +26278,7 @@ var makeEmbedWrapper = (channel, name, embed, contextOptions = {}, options = {})
|
|
|
26687
26278
|
};
|
|
26688
26279
|
var wrapEmbed = (embed, options = {}, aiSDK) => {
|
|
26689
26280
|
return makeEmbedWrapper(
|
|
26690
|
-
|
|
26281
|
+
_chunkVMBQETG3js.aiSDKChannels.embed,
|
|
26691
26282
|
"embed",
|
|
26692
26283
|
embed,
|
|
26693
26284
|
{ aiSDK },
|
|
@@ -26696,7 +26287,7 @@ var wrapEmbed = (embed, options = {}, aiSDK) => {
|
|
|
26696
26287
|
};
|
|
26697
26288
|
var wrapEmbedMany = (embedMany, options = {}, aiSDK) => {
|
|
26698
26289
|
return makeEmbedWrapper(
|
|
26699
|
-
|
|
26290
|
+
_chunkVMBQETG3js.aiSDKChannels.embedMany,
|
|
26700
26291
|
"embedMany",
|
|
26701
26292
|
embedMany,
|
|
26702
26293
|
{ aiSDK },
|
|
@@ -26707,7 +26298,7 @@ var makeRerankWrapper = (rerank, contextOptions = {}, options = {}) => {
|
|
|
26707
26298
|
const wrapper = async function(allParams) {
|
|
26708
26299
|
const { span_info, ...params } = allParams;
|
|
26709
26300
|
const tracedParams = { ...params };
|
|
26710
|
-
return
|
|
26301
|
+
return _chunkVMBQETG3js.aiSDKChannels.rerank.tracePromise(
|
|
26711
26302
|
() => rerank(tracedParams),
|
|
26712
26303
|
createAISDKChannelContext(tracedParams, {
|
|
26713
26304
|
aiSDK: contextOptions.aiSDK,
|
|
@@ -26746,7 +26337,7 @@ var makeStreamWrapper = (channel, name, streamText, contextOptions = {}, options
|
|
|
26746
26337
|
};
|
|
26747
26338
|
var wrapStreamText = (streamText, options = {}, aiSDK) => {
|
|
26748
26339
|
return makeStreamWrapper(
|
|
26749
|
-
|
|
26340
|
+
_chunkVMBQETG3js.aiSDKChannels.streamText,
|
|
26750
26341
|
"streamText",
|
|
26751
26342
|
streamText,
|
|
26752
26343
|
{ aiSDK },
|
|
@@ -26755,7 +26346,7 @@ var wrapStreamText = (streamText, options = {}, aiSDK) => {
|
|
|
26755
26346
|
};
|
|
26756
26347
|
var wrapStreamObject = (streamObject, options = {}, aiSDK) => {
|
|
26757
26348
|
return makeStreamWrapper(
|
|
26758
|
-
|
|
26349
|
+
_chunkVMBQETG3js.aiSDKChannels.streamObject,
|
|
26759
26350
|
"streamObject",
|
|
26760
26351
|
streamObject,
|
|
26761
26352
|
{ aiSDK },
|
|
@@ -26768,11 +26359,11 @@ function mergeSpanInfo(spanInfo, defaults) {
|
|
|
26768
26359
|
}
|
|
26769
26360
|
return {
|
|
26770
26361
|
...spanInfo,
|
|
26771
|
-
..._optionalChain([spanInfo, 'optionalAccess',
|
|
26772
|
-
...defaults.spanType !== void 0 || _optionalChain([spanInfo, 'optionalAccess',
|
|
26362
|
+
..._optionalChain([spanInfo, 'optionalAccess', _621 => _621.name]) ? {} : defaults.name ? { name: defaults.name } : {},
|
|
26363
|
+
...defaults.spanType !== void 0 || _optionalChain([spanInfo, 'optionalAccess', _622 => _622.spanAttributes]) ? {
|
|
26773
26364
|
spanAttributes: {
|
|
26774
26365
|
...defaults.spanType !== void 0 ? { type: defaults.spanType } : {},
|
|
26775
|
-
..._nullishCoalesce(_optionalChain([spanInfo, 'optionalAccess',
|
|
26366
|
+
..._nullishCoalesce(_optionalChain([spanInfo, 'optionalAccess', _623 => _623.spanAttributes]), () => ( {}))
|
|
26776
26367
|
}
|
|
26777
26368
|
} : {}
|
|
26778
26369
|
};
|
|
@@ -26790,7 +26381,7 @@ function createAISDKChannelContext(params, context = {}) {
|
|
|
26790
26381
|
// src/wrappers/ai-sdk/deprecated/wrapAISDKModel.ts
|
|
26791
26382
|
function wrapAISDKModel(model) {
|
|
26792
26383
|
const m = model;
|
|
26793
|
-
if (_optionalChain([m, 'optionalAccess',
|
|
26384
|
+
if (_optionalChain([m, 'optionalAccess', _624 => _624.specificationVersion]) === "v1" && typeof _optionalChain([m, 'optionalAccess', _625 => _625.provider]) === "string" && typeof _optionalChain([m, 'optionalAccess', _626 => _626.modelId]) === "string") {
|
|
26794
26385
|
return new BraintrustLanguageModelWrapper(m);
|
|
26795
26386
|
} else {
|
|
26796
26387
|
console.warn("Unsupported AI SDK model. Not wrapping.");
|
|
@@ -26847,10 +26438,10 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
26847
26438
|
metrics: {
|
|
26848
26439
|
time_to_first_token: getCurrentUnixTimestamp() - startTime,
|
|
26849
26440
|
tokens: !isEmpty2(ret.usage) ? ret.usage.promptTokens + ret.usage.completionTokens : void 0,
|
|
26850
|
-
prompt_tokens: _optionalChain([ret, 'access',
|
|
26851
|
-
completion_tokens: _optionalChain([ret, 'access',
|
|
26441
|
+
prompt_tokens: _optionalChain([ret, 'access', _627 => _627.usage, 'optionalAccess', _628 => _628.promptTokens]),
|
|
26442
|
+
completion_tokens: _optionalChain([ret, 'access', _629 => _629.usage, 'optionalAccess', _630 => _630.completionTokens]),
|
|
26852
26443
|
cached: parseCachedHeader(
|
|
26853
|
-
_nullishCoalesce(_optionalChain([ret, 'access',
|
|
26444
|
+
_nullishCoalesce(_optionalChain([ret, 'access', _631 => _631.rawResponse, 'optionalAccess', _632 => _632.headers, 'optionalAccess', _633 => _633[X_CACHED_HEADER]]), () => ( _optionalChain([ret, 'access', _634 => _634.rawResponse, 'optionalAccess', _635 => _635.headers, 'optionalAccess', _636 => _636[LEGACY_CACHED_HEADER]])))
|
|
26854
26445
|
)
|
|
26855
26446
|
}
|
|
26856
26447
|
});
|
|
@@ -26942,10 +26533,10 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
26942
26533
|
metrics: {
|
|
26943
26534
|
time_to_first_token,
|
|
26944
26535
|
tokens: !isEmpty2(usage) ? usage.promptTokens + usage.completionTokens : void 0,
|
|
26945
|
-
prompt_tokens: _optionalChain([usage, 'optionalAccess',
|
|
26946
|
-
completion_tokens: _optionalChain([usage, 'optionalAccess',
|
|
26536
|
+
prompt_tokens: _optionalChain([usage, 'optionalAccess', _637 => _637.promptTokens]),
|
|
26537
|
+
completion_tokens: _optionalChain([usage, 'optionalAccess', _638 => _638.completionTokens]),
|
|
26947
26538
|
cached: parseCachedHeader(
|
|
26948
|
-
_nullishCoalesce(_optionalChain([ret, 'access',
|
|
26539
|
+
_nullishCoalesce(_optionalChain([ret, 'access', _639 => _639.rawResponse, 'optionalAccess', _640 => _640.headers, 'optionalAccess', _641 => _641[X_CACHED_HEADER]]), () => ( _optionalChain([ret, 'access', _642 => _642.rawResponse, 'optionalAccess', _643 => _643.headers, 'optionalAccess', _644 => _644[LEGACY_CACHED_HEADER]])))
|
|
26949
26540
|
)
|
|
26950
26541
|
}
|
|
26951
26542
|
});
|
|
@@ -26989,7 +26580,7 @@ function postProcessPrompt(prompt) {
|
|
|
26989
26580
|
return [
|
|
26990
26581
|
{
|
|
26991
26582
|
role: "assistant",
|
|
26992
|
-
content: _optionalChain([textPart, 'optionalAccess',
|
|
26583
|
+
content: _optionalChain([textPart, 'optionalAccess', _645 => _645.text]),
|
|
26993
26584
|
...toolCallParts.length > 0 ? {
|
|
26994
26585
|
tool_calls: toolCallParts.map((part) => ({
|
|
26995
26586
|
id: part.toolCallId,
|
|
@@ -27062,23 +26653,23 @@ function postProcessOutput(text, toolCalls, finishReason) {
|
|
|
27062
26653
|
|
|
27063
26654
|
// src/wrappers/ai-sdk/deprecated/BraintrustMiddleware.ts
|
|
27064
26655
|
function detectProviderFromResult(result) {
|
|
27065
|
-
if (!_optionalChain([result, 'optionalAccess',
|
|
26656
|
+
if (!_optionalChain([result, 'optionalAccess', _646 => _646.providerMetadata])) {
|
|
27066
26657
|
return void 0;
|
|
27067
26658
|
}
|
|
27068
26659
|
const keys = Object.keys(result.providerMetadata);
|
|
27069
|
-
return _optionalChain([keys, 'optionalAccess',
|
|
26660
|
+
return _optionalChain([keys, 'optionalAccess', _647 => _647.at, 'call', _648 => _648(0)]);
|
|
27070
26661
|
}
|
|
27071
26662
|
function extractModelFromResult(result) {
|
|
27072
|
-
if (_optionalChain([result, 'optionalAccess',
|
|
26663
|
+
if (_optionalChain([result, 'optionalAccess', _649 => _649.response, 'optionalAccess', _650 => _650.modelId])) {
|
|
27073
26664
|
return result.response.modelId;
|
|
27074
26665
|
}
|
|
27075
|
-
if (_optionalChain([result, 'optionalAccess',
|
|
26666
|
+
if (_optionalChain([result, 'optionalAccess', _651 => _651.request, 'optionalAccess', _652 => _652.body, 'optionalAccess', _653 => _653.model])) {
|
|
27076
26667
|
return result.request.body.model;
|
|
27077
26668
|
}
|
|
27078
26669
|
return void 0;
|
|
27079
26670
|
}
|
|
27080
26671
|
function extractModelFromWrapGenerateCallback(model) {
|
|
27081
|
-
return _optionalChain([model, 'optionalAccess',
|
|
26672
|
+
return _optionalChain([model, 'optionalAccess', _654 => _654.modelId]);
|
|
27082
26673
|
}
|
|
27083
26674
|
function camelToSnake4(str) {
|
|
27084
26675
|
return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
|
|
@@ -27123,7 +26714,7 @@ function normalizeUsageMetrics(usage, provider, providerMetadata) {
|
|
|
27123
26714
|
metrics.prompt_cached_tokens = cachedInputTokens;
|
|
27124
26715
|
}
|
|
27125
26716
|
if (provider === "anthropic") {
|
|
27126
|
-
const anthropicMetadata = _optionalChain([providerMetadata, 'optionalAccess',
|
|
26717
|
+
const anthropicMetadata = _optionalChain([providerMetadata, 'optionalAccess', _655 => _655.anthropic]);
|
|
27127
26718
|
if (anthropicMetadata) {
|
|
27128
26719
|
const cacheReadTokens = getNumberProperty3(anthropicMetadata.usage, "cache_read_input_tokens") || 0;
|
|
27129
26720
|
const cacheCreationTokens = getNumberProperty3(
|
|
@@ -27149,7 +26740,7 @@ function buildAssistantOutputWithToolCalls(result, toolCalls) {
|
|
|
27149
26740
|
{
|
|
27150
26741
|
index: 0,
|
|
27151
26742
|
logprobs: null,
|
|
27152
|
-
finish_reason: _nullishCoalesce(normalizeFinishReason(_optionalChain([result, 'optionalAccess',
|
|
26743
|
+
finish_reason: _nullishCoalesce(normalizeFinishReason(_optionalChain([result, 'optionalAccess', _656 => _656.finishReason])), () => ( (toolCalls.length ? "tool_calls" : void 0))),
|
|
27153
26744
|
message: {
|
|
27154
26745
|
role: "assistant",
|
|
27155
26746
|
tool_calls: toolCalls.length > 0 ? toolCalls : void 0
|
|
@@ -27162,7 +26753,7 @@ function extractToolCallsFromSteps(steps) {
|
|
|
27162
26753
|
if (!Array.isArray(steps)) return toolCalls;
|
|
27163
26754
|
let idx = 0;
|
|
27164
26755
|
for (const step of steps) {
|
|
27165
|
-
const blocks = _optionalChain([step, 'optionalAccess',
|
|
26756
|
+
const blocks = _optionalChain([step, 'optionalAccess', _657 => _657.content]);
|
|
27166
26757
|
if (!Array.isArray(blocks)) continue;
|
|
27167
26758
|
for (const block of blocks) {
|
|
27168
26759
|
if (block && typeof block === "object" && block.type === "tool-call") {
|
|
@@ -27185,7 +26776,7 @@ function extractToolCallsFromBlocks(blocks) {
|
|
|
27185
26776
|
return extractToolCallsFromSteps([{ content: blocks }]);
|
|
27186
26777
|
}
|
|
27187
26778
|
function extractInput(params) {
|
|
27188
|
-
return _nullishCoalesce(_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
26779
|
+
return _nullishCoalesce(_nullishCoalesce(_optionalChain([params, 'optionalAccess', _658 => _658.prompt]), () => ( _optionalChain([params, 'optionalAccess', _659 => _659.messages]))), () => ( _optionalChain([params, 'optionalAccess', _660 => _660.system])));
|
|
27189
26780
|
}
|
|
27190
26781
|
var V2_EXCLUDE_KEYS = /* @__PURE__ */ new Set([
|
|
27191
26782
|
"prompt",
|
|
@@ -27209,16 +26800,16 @@ function BraintrustMiddleware(config = {}) {
|
|
|
27209
26800
|
const rawInput = extractInput(params);
|
|
27210
26801
|
const processedInput = processInputAttachments(rawInput);
|
|
27211
26802
|
const spanArgs = {
|
|
27212
|
-
name: _optionalChain([config, 'access',
|
|
26803
|
+
name: _optionalChain([config, 'access', _661 => _661.spanInfo, 'optionalAccess', _662 => _662.name]) || "ai-sdk.doGenerate",
|
|
27213
26804
|
spanAttributes: {
|
|
27214
26805
|
type: "llm" /* LLM */,
|
|
27215
|
-
..._optionalChain([config, 'access',
|
|
26806
|
+
..._optionalChain([config, 'access', _663 => _663.spanInfo, 'optionalAccess', _664 => _664.spanAttributes]) || {}
|
|
27216
26807
|
},
|
|
27217
26808
|
event: {
|
|
27218
26809
|
input: processedInput,
|
|
27219
26810
|
metadata: {
|
|
27220
26811
|
...extractModelParameters(params, V2_EXCLUDE_KEYS),
|
|
27221
|
-
..._optionalChain([config, 'access',
|
|
26812
|
+
..._optionalChain([config, 'access', _665 => _665.spanInfo, 'optionalAccess', _666 => _666.metadata]) || {}
|
|
27222
26813
|
}
|
|
27223
26814
|
}
|
|
27224
26815
|
};
|
|
@@ -27244,12 +26835,12 @@ function BraintrustMiddleware(config = {}) {
|
|
|
27244
26835
|
metadata.model = modelId;
|
|
27245
26836
|
}
|
|
27246
26837
|
}
|
|
27247
|
-
let toolCalls = extractToolCallsFromSteps(_optionalChain([result, 'optionalAccess',
|
|
26838
|
+
let toolCalls = extractToolCallsFromSteps(_optionalChain([result, 'optionalAccess', _667 => _667.steps]));
|
|
27248
26839
|
if (!toolCalls || toolCalls.length === 0) {
|
|
27249
|
-
toolCalls = extractToolCallsFromBlocks(_optionalChain([result, 'optionalAccess',
|
|
26840
|
+
toolCalls = extractToolCallsFromBlocks(_optionalChain([result, 'optionalAccess', _668 => _668.content]));
|
|
27250
26841
|
}
|
|
27251
26842
|
span.log({
|
|
27252
|
-
output: toolCalls.length > 0 ? buildAssistantOutputWithToolCalls(result, toolCalls) : _optionalChain([result, 'optionalAccess',
|
|
26843
|
+
output: toolCalls.length > 0 ? buildAssistantOutputWithToolCalls(result, toolCalls) : _optionalChain([result, 'optionalAccess', _669 => _669.content]),
|
|
27253
26844
|
metadata,
|
|
27254
26845
|
metrics: normalizeUsageMetrics(
|
|
27255
26846
|
result.usage,
|
|
@@ -27271,16 +26862,16 @@ function BraintrustMiddleware(config = {}) {
|
|
|
27271
26862
|
const rawInput = extractInput(params);
|
|
27272
26863
|
const processedInput = processInputAttachments(rawInput);
|
|
27273
26864
|
const spanArgs = {
|
|
27274
|
-
name: _optionalChain([config, 'access',
|
|
26865
|
+
name: _optionalChain([config, 'access', _670 => _670.spanInfo, 'optionalAccess', _671 => _671.name]) || "ai-sdk.doStream",
|
|
27275
26866
|
spanAttributes: {
|
|
27276
26867
|
type: "llm" /* LLM */,
|
|
27277
|
-
..._optionalChain([config, 'access',
|
|
26868
|
+
..._optionalChain([config, 'access', _672 => _672.spanInfo, 'optionalAccess', _673 => _673.spanAttributes]) || {}
|
|
27278
26869
|
},
|
|
27279
26870
|
event: {
|
|
27280
26871
|
input: processedInput,
|
|
27281
26872
|
metadata: {
|
|
27282
26873
|
...extractModelParameters(params, V2_EXCLUDE_KEYS),
|
|
27283
|
-
..._optionalChain([config, 'access',
|
|
26874
|
+
..._optionalChain([config, 'access', _674 => _674.spanInfo, 'optionalAccess', _675 => _675.metadata]) || {}
|
|
27284
26875
|
}
|
|
27285
26876
|
}
|
|
27286
26877
|
};
|
|
@@ -27423,7 +27014,7 @@ function messagesProxy(messages) {
|
|
|
27423
27014
|
return new Proxy(messages, {
|
|
27424
27015
|
get(target, prop, receiver) {
|
|
27425
27016
|
if (prop === "create") {
|
|
27426
|
-
return createProxy(target.create,
|
|
27017
|
+
return createProxy(target.create, _chunkVMBQETG3js.anthropicChannels.messagesCreate);
|
|
27427
27018
|
}
|
|
27428
27019
|
return Reflect.get(target, prop, receiver);
|
|
27429
27020
|
}
|
|
@@ -27433,7 +27024,7 @@ function betaMessagesProxy(messages, anthropic) {
|
|
|
27433
27024
|
return new Proxy(messages, {
|
|
27434
27025
|
get(target, prop, receiver) {
|
|
27435
27026
|
if (prop === "create") {
|
|
27436
|
-
return createProxy(target.create,
|
|
27027
|
+
return createProxy(target.create, _chunkVMBQETG3js.anthropicChannels.betaMessagesCreate);
|
|
27437
27028
|
}
|
|
27438
27029
|
if (prop === "toolRunner") {
|
|
27439
27030
|
if (typeof target.toolRunner !== "function") {
|
|
@@ -27442,7 +27033,7 @@ function betaMessagesProxy(messages, anthropic) {
|
|
|
27442
27033
|
return toolRunnerProxy(
|
|
27443
27034
|
target.toolRunner,
|
|
27444
27035
|
anthropic,
|
|
27445
|
-
|
|
27036
|
+
_chunkVMBQETG3js.anthropicChannels.betaMessagesToolRunner
|
|
27446
27037
|
);
|
|
27447
27038
|
}
|
|
27448
27039
|
return Reflect.get(target, prop, receiver);
|
|
@@ -27503,7 +27094,7 @@ function wrapClaudeAgentQuery(queryFn, defaultThis) {
|
|
|
27503
27094
|
}
|
|
27504
27095
|
};
|
|
27505
27096
|
const invocationTarget = thisArg === proxy || thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
|
|
27506
|
-
return
|
|
27097
|
+
return _chunkVMBQETG3js.claudeAgentSDKChannels.query.traceSync(
|
|
27507
27098
|
() => Reflect.apply(target, invocationTarget, [wrappedParams]),
|
|
27508
27099
|
// The channel carries no extra context fields, but the generated
|
|
27509
27100
|
// StartOf<> type for Record<string, never> is overly strict here.
|
|
@@ -27549,8 +27140,8 @@ function wrapCreateSdkMcpServer(createSdkMcpServerFn, localToolMetadataByTool, d
|
|
|
27549
27140
|
apply(target, thisArg, argArray) {
|
|
27550
27141
|
const invocationTarget = thisArg === proxy || thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
|
|
27551
27142
|
const config = argArray[0];
|
|
27552
|
-
const serverName = _optionalChain([config, 'optionalAccess',
|
|
27553
|
-
if (typeof serverName === "string" && Array.isArray(_optionalChain([config, 'optionalAccess',
|
|
27143
|
+
const serverName = _optionalChain([config, 'optionalAccess', _676 => _676.name]);
|
|
27144
|
+
if (typeof serverName === "string" && Array.isArray(_optionalChain([config, 'optionalAccess', _677 => _677.tools]))) {
|
|
27554
27145
|
for (const tool of config.tools) {
|
|
27555
27146
|
if (!tool || typeof tool !== "object") {
|
|
27556
27147
|
continue;
|
|
@@ -27644,7 +27235,7 @@ function isModuleNamespace2(obj) {
|
|
|
27644
27235
|
if (!obj || typeof obj !== "object") {
|
|
27645
27236
|
return false;
|
|
27646
27237
|
}
|
|
27647
|
-
if (_optionalChain([obj, 'access',
|
|
27238
|
+
if (_optionalChain([obj, 'access', _678 => _678.constructor, 'optionalAccess', _679 => _679.name]) === "Module") {
|
|
27648
27239
|
return true;
|
|
27649
27240
|
}
|
|
27650
27241
|
const keys = Object.keys(obj);
|
|
@@ -27714,7 +27305,7 @@ function wrapCodexThread(thread) {
|
|
|
27714
27305
|
if (prop === "run" && typeof value === "function") {
|
|
27715
27306
|
return function(input, turnOptions) {
|
|
27716
27307
|
const args = [input, turnOptions];
|
|
27717
|
-
return
|
|
27308
|
+
return _chunkVMBQETG3js.openAICodexChannels.run.tracePromise(
|
|
27718
27309
|
() => Reflect.apply(value, target, args),
|
|
27719
27310
|
{
|
|
27720
27311
|
arguments: args,
|
|
@@ -27727,7 +27318,7 @@ function wrapCodexThread(thread) {
|
|
|
27727
27318
|
if (prop === "runStreamed" && typeof value === "function") {
|
|
27728
27319
|
return function(input, turnOptions) {
|
|
27729
27320
|
const args = [input, turnOptions];
|
|
27730
|
-
return
|
|
27321
|
+
return _chunkVMBQETG3js.openAICodexChannels.runStreamed.tracePromise(
|
|
27731
27322
|
() => Reflect.apply(value, target, args),
|
|
27732
27323
|
{
|
|
27733
27324
|
arguments: args,
|
|
@@ -27774,7 +27365,7 @@ function isModuleNamespace3(obj) {
|
|
|
27774
27365
|
if (!obj || typeof obj !== "object") {
|
|
27775
27366
|
return false;
|
|
27776
27367
|
}
|
|
27777
|
-
if (_optionalChain([obj, 'access',
|
|
27368
|
+
if (_optionalChain([obj, 'access', _680 => _680.constructor, 'optionalAccess', _681 => _681.name]) === "Module") {
|
|
27778
27369
|
return true;
|
|
27779
27370
|
}
|
|
27780
27371
|
const keys = Object.keys(obj);
|
|
@@ -27795,7 +27386,7 @@ function wrapCursorAgentClass(Agent) {
|
|
|
27795
27386
|
if (prop === "create" && typeof value === "function") {
|
|
27796
27387
|
const wrapped = async function(options) {
|
|
27797
27388
|
const args = [options];
|
|
27798
|
-
return
|
|
27389
|
+
return _chunkVMBQETG3js.cursorSDKChannels.create.tracePromise(
|
|
27799
27390
|
async () => wrapCursorAgent(await Reflect.apply(value, target, args)),
|
|
27800
27391
|
{ arguments: args }
|
|
27801
27392
|
);
|
|
@@ -27806,7 +27397,7 @@ function wrapCursorAgentClass(Agent) {
|
|
|
27806
27397
|
if (prop === "resume" && typeof value === "function") {
|
|
27807
27398
|
const wrapped = async function(agentId, options) {
|
|
27808
27399
|
const args = [agentId, options];
|
|
27809
|
-
return
|
|
27400
|
+
return _chunkVMBQETG3js.cursorSDKChannels.resume.tracePromise(
|
|
27810
27401
|
async () => wrapCursorAgent(await Reflect.apply(value, target, args)),
|
|
27811
27402
|
{ arguments: args }
|
|
27812
27403
|
);
|
|
@@ -27817,7 +27408,7 @@ function wrapCursorAgentClass(Agent) {
|
|
|
27817
27408
|
if (prop === "prompt" && typeof value === "function") {
|
|
27818
27409
|
const wrapped = async function(message, options) {
|
|
27819
27410
|
const args = [message, options];
|
|
27820
|
-
return
|
|
27411
|
+
return _chunkVMBQETG3js.cursorSDKChannels.prompt.tracePromise(
|
|
27821
27412
|
() => Reflect.apply(value, target, args),
|
|
27822
27413
|
{ arguments: args }
|
|
27823
27414
|
);
|
|
@@ -27850,7 +27441,7 @@ function wrapCursorAgent(agent) {
|
|
|
27850
27441
|
if (prop === "send" && typeof value === "function") {
|
|
27851
27442
|
return function(message, options) {
|
|
27852
27443
|
const args = [message, options];
|
|
27853
|
-
return
|
|
27444
|
+
return _chunkVMBQETG3js.cursorSDKChannels.send.tracePromise(
|
|
27854
27445
|
() => Reflect.apply(value, target, args),
|
|
27855
27446
|
{
|
|
27856
27447
|
agent: target,
|
|
@@ -27939,7 +27530,7 @@ function wrapModels(models) {
|
|
|
27939
27530
|
}
|
|
27940
27531
|
function wrapGenerateContent(original) {
|
|
27941
27532
|
return function(params) {
|
|
27942
|
-
return
|
|
27533
|
+
return _chunkVMBQETG3js.googleGenAIChannels.generateContent.tracePromise(
|
|
27943
27534
|
() => original(params),
|
|
27944
27535
|
{ arguments: [params] }
|
|
27945
27536
|
);
|
|
@@ -27947,7 +27538,7 @@ function wrapGenerateContent(original) {
|
|
|
27947
27538
|
}
|
|
27948
27539
|
function wrapGenerateContentStream(original) {
|
|
27949
27540
|
return function(params) {
|
|
27950
|
-
return
|
|
27541
|
+
return _chunkVMBQETG3js.googleGenAIChannels.generateContentStream.tracePromise(
|
|
27951
27542
|
() => original(params),
|
|
27952
27543
|
{ arguments: [params] }
|
|
27953
27544
|
);
|
|
@@ -27955,7 +27546,7 @@ function wrapGenerateContentStream(original) {
|
|
|
27955
27546
|
}
|
|
27956
27547
|
function wrapEmbedContent(original) {
|
|
27957
27548
|
return function(params) {
|
|
27958
|
-
return
|
|
27549
|
+
return _chunkVMBQETG3js.googleGenAIChannels.embedContent.tracePromise(
|
|
27959
27550
|
() => original(params),
|
|
27960
27551
|
{ arguments: [params] }
|
|
27961
27552
|
);
|
|
@@ -28016,7 +27607,7 @@ function wrapRunnerInstance(runner) {
|
|
|
28016
27607
|
function wrapRunnerRunAsync(runner) {
|
|
28017
27608
|
const original = runner.runAsync.bind(runner);
|
|
28018
27609
|
return function(params) {
|
|
28019
|
-
return
|
|
27610
|
+
return _chunkVMBQETG3js.googleADKChannels.runnerRunAsync.traceSync(() => original(params), {
|
|
28020
27611
|
arguments: [params],
|
|
28021
27612
|
self: runner
|
|
28022
27613
|
});
|
|
@@ -28043,7 +27634,7 @@ function wrapAgentInstance(agent) {
|
|
|
28043
27634
|
function wrapAgentRunAsync(agent) {
|
|
28044
27635
|
const original = agent.runAsync.bind(agent);
|
|
28045
27636
|
return function(parentContext) {
|
|
28046
|
-
return
|
|
27637
|
+
return _chunkVMBQETG3js.googleADKChannels.agentRunAsync.traceSync(
|
|
28047
27638
|
() => original(parentContext),
|
|
28048
27639
|
{ arguments: [parentContext], self: agent }
|
|
28049
27640
|
);
|
|
@@ -28070,7 +27661,7 @@ function wrapToolInstance(tool) {
|
|
|
28070
27661
|
function wrapToolRunAsync(tool) {
|
|
28071
27662
|
const original = tool.runAsync.bind(tool);
|
|
28072
27663
|
return function(req) {
|
|
28073
|
-
return
|
|
27664
|
+
return _chunkVMBQETG3js.googleADKChannels.toolRunAsync.tracePromise(() => original(req), {
|
|
28074
27665
|
arguments: [req],
|
|
28075
27666
|
self: tool
|
|
28076
27667
|
});
|
|
@@ -28182,7 +27773,7 @@ function patchGenkitRegistryLookup(registry2) {
|
|
|
28182
27773
|
Object.defineProperty(registry2, PATCHED_GENKIT_REGISTRY, {
|
|
28183
27774
|
value: true
|
|
28184
27775
|
});
|
|
28185
|
-
} catch (
|
|
27776
|
+
} catch (e52) {
|
|
28186
27777
|
}
|
|
28187
27778
|
}
|
|
28188
27779
|
function patchGenkitRegistryConstructor(registry2) {
|
|
@@ -28213,31 +27804,31 @@ function patchGenkitRegistryConstructor(registry2) {
|
|
|
28213
27804
|
Object.defineProperty(constructor, PATCHED_GENKIT_REGISTRY_CONSTRUCTOR, {
|
|
28214
27805
|
value: true
|
|
28215
27806
|
});
|
|
28216
|
-
} catch (
|
|
27807
|
+
} catch (e53) {
|
|
28217
27808
|
}
|
|
28218
27809
|
}
|
|
28219
27810
|
function wrapGenerate(generate) {
|
|
28220
|
-
return (input) =>
|
|
27811
|
+
return (input) => _chunkVMBQETG3js.genkitChannels.generate.tracePromise(() => generate(input), {
|
|
28221
27812
|
arguments: [input]
|
|
28222
27813
|
});
|
|
28223
27814
|
}
|
|
28224
27815
|
function wrapGenerateStream(generateStream) {
|
|
28225
|
-
return (input) =>
|
|
27816
|
+
return (input) => _chunkVMBQETG3js.genkitChannels.generateStream.traceSync(() => generateStream(input), {
|
|
28226
27817
|
arguments: [input]
|
|
28227
27818
|
});
|
|
28228
27819
|
}
|
|
28229
27820
|
function wrapEmbed2(embed) {
|
|
28230
|
-
return (params) =>
|
|
27821
|
+
return (params) => _chunkVMBQETG3js.genkitChannels.embed.tracePromise(() => embed(params), {
|
|
28231
27822
|
arguments: [params]
|
|
28232
27823
|
});
|
|
28233
27824
|
}
|
|
28234
27825
|
function wrapEmbedMany2(embedMany) {
|
|
28235
|
-
return (params) =>
|
|
27826
|
+
return (params) => _chunkVMBQETG3js.genkitChannels.embedMany.tracePromise(() => embedMany(params), {
|
|
28236
27827
|
arguments: [params]
|
|
28237
27828
|
});
|
|
28238
27829
|
}
|
|
28239
27830
|
function wrapRun(run) {
|
|
28240
|
-
return (name, inputOrFn, maybeFn) =>
|
|
27831
|
+
return (name, inputOrFn, maybeFn) => _chunkVMBQETG3js.genkitChannels.actionRun.tracePromise(() => run(name, inputOrFn, maybeFn), {
|
|
28241
27832
|
arguments: [name, inputOrFn, maybeFn]
|
|
28242
27833
|
});
|
|
28243
27834
|
}
|
|
@@ -28276,13 +27867,13 @@ function isGenkitAction(value) {
|
|
|
28276
27867
|
return typeof value === "function" && "__action" in value;
|
|
28277
27868
|
}
|
|
28278
27869
|
function traceActionRun(action, run) {
|
|
28279
|
-
return (input, options) =>
|
|
27870
|
+
return (input, options) => _chunkVMBQETG3js.genkitChannels.actionRun.tracePromise(() => run(input, options), {
|
|
28280
27871
|
arguments: [input, options],
|
|
28281
27872
|
self: action
|
|
28282
27873
|
});
|
|
28283
27874
|
}
|
|
28284
27875
|
function traceActionStream(action, stream) {
|
|
28285
|
-
return (input, options) =>
|
|
27876
|
+
return (input, options) => _chunkVMBQETG3js.genkitChannels.actionStream.traceSync(() => stream(input, options), {
|
|
28286
27877
|
arguments: [input, options],
|
|
28287
27878
|
self: action
|
|
28288
27879
|
});
|
|
@@ -28439,14 +28030,14 @@ function wrapChatCompletion2(original, endpointUrl) {
|
|
|
28439
28030
|
const context = {
|
|
28440
28031
|
arguments: [traceParams]
|
|
28441
28032
|
};
|
|
28442
|
-
return
|
|
28033
|
+
return _chunkVMBQETG3js.huggingFaceChannels.chatCompletion.tracePromise(
|
|
28443
28034
|
() => original(params, options),
|
|
28444
28035
|
context
|
|
28445
28036
|
);
|
|
28446
28037
|
};
|
|
28447
28038
|
}
|
|
28448
28039
|
function wrapChatCompletionStream(original, endpointUrl) {
|
|
28449
|
-
return (params, options) =>
|
|
28040
|
+
return (params, options) => _chunkVMBQETG3js.huggingFaceChannels.chatCompletionStream.traceSync(
|
|
28450
28041
|
() => original(params, options),
|
|
28451
28042
|
{
|
|
28452
28043
|
arguments: [withEndpointUrl(params, endpointUrl)]
|
|
@@ -28459,14 +28050,14 @@ function wrapTextGeneration(original, endpointUrl) {
|
|
|
28459
28050
|
const context = {
|
|
28460
28051
|
arguments: [traceParams]
|
|
28461
28052
|
};
|
|
28462
|
-
return
|
|
28053
|
+
return _chunkVMBQETG3js.huggingFaceChannels.textGeneration.tracePromise(
|
|
28463
28054
|
() => original(params, options),
|
|
28464
28055
|
context
|
|
28465
28056
|
);
|
|
28466
28057
|
};
|
|
28467
28058
|
}
|
|
28468
28059
|
function wrapTextGenerationStream(original, endpointUrl) {
|
|
28469
|
-
return (params, options) =>
|
|
28060
|
+
return (params, options) => _chunkVMBQETG3js.huggingFaceChannels.textGenerationStream.traceSync(
|
|
28470
28061
|
() => original(params, options),
|
|
28471
28062
|
{
|
|
28472
28063
|
arguments: [withEndpointUrl(params, endpointUrl)]
|
|
@@ -28479,7 +28070,7 @@ function wrapFeatureExtraction(original, endpointUrl) {
|
|
|
28479
28070
|
const context = {
|
|
28480
28071
|
arguments: [traceParams]
|
|
28481
28072
|
};
|
|
28482
|
-
return
|
|
28073
|
+
return _chunkVMBQETG3js.huggingFaceChannels.featureExtraction.tracePromise(
|
|
28483
28074
|
() => original(params, options),
|
|
28484
28075
|
context
|
|
28485
28076
|
);
|
|
@@ -28526,7 +28117,7 @@ function wrapCallModel(callModelFn, defaultThis) {
|
|
|
28526
28117
|
const request = cloneCallModelRequest(argArray[0]);
|
|
28527
28118
|
const options = argArray[1];
|
|
28528
28119
|
const invocationTarget = thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
|
|
28529
|
-
return
|
|
28120
|
+
return _chunkVMBQETG3js.openRouterAgentChannels.callModel.traceSync(
|
|
28530
28121
|
() => Reflect.apply(target, invocationTarget, [request, options]),
|
|
28531
28122
|
{
|
|
28532
28123
|
arguments: [request]
|
|
@@ -28622,24 +28213,24 @@ function rerankProxy(rerank) {
|
|
|
28622
28213
|
});
|
|
28623
28214
|
}
|
|
28624
28215
|
function wrapChatSend(send) {
|
|
28625
|
-
return (request, options) =>
|
|
28216
|
+
return (request, options) => _chunkVMBQETG3js.openRouterChannels.chatSend.tracePromise(() => send(request, options), {
|
|
28626
28217
|
arguments: [request]
|
|
28627
28218
|
});
|
|
28628
28219
|
}
|
|
28629
28220
|
function wrapEmbeddingsGenerate(generate) {
|
|
28630
|
-
return (request, options) =>
|
|
28221
|
+
return (request, options) => _chunkVMBQETG3js.openRouterChannels.embeddingsGenerate.tracePromise(
|
|
28631
28222
|
() => generate(request, options),
|
|
28632
28223
|
{ arguments: [request] }
|
|
28633
28224
|
);
|
|
28634
28225
|
}
|
|
28635
28226
|
function wrapResponsesSend(send) {
|
|
28636
|
-
return (request, options) =>
|
|
28227
|
+
return (request, options) => _chunkVMBQETG3js.openRouterChannels.betaResponsesSend.tracePromise(
|
|
28637
28228
|
() => send(request, options),
|
|
28638
28229
|
{ arguments: [request] }
|
|
28639
28230
|
);
|
|
28640
28231
|
}
|
|
28641
28232
|
function wrapRerank2(rerank) {
|
|
28642
|
-
return (request, options) =>
|
|
28233
|
+
return (request, options) => _chunkVMBQETG3js.openRouterChannels.rerankRerank.tracePromise(
|
|
28643
28234
|
() => rerank(request, options),
|
|
28644
28235
|
{ arguments: [request] }
|
|
28645
28236
|
);
|
|
@@ -28647,7 +28238,7 @@ function wrapRerank2(rerank) {
|
|
|
28647
28238
|
function wrapCallModel2(callModel) {
|
|
28648
28239
|
return (request, options) => {
|
|
28649
28240
|
const tracedRequest = { ...request };
|
|
28650
|
-
return
|
|
28241
|
+
return _chunkVMBQETG3js.openRouterChannels.callModel.traceSync(
|
|
28651
28242
|
() => callModel(tracedRequest, options),
|
|
28652
28243
|
{
|
|
28653
28244
|
arguments: [tracedRequest]
|
|
@@ -28780,7 +28371,7 @@ function classifiersProxy(classifiers) {
|
|
|
28780
28371
|
});
|
|
28781
28372
|
}
|
|
28782
28373
|
function wrapChatComplete(complete) {
|
|
28783
|
-
return (request, options) =>
|
|
28374
|
+
return (request, options) => _chunkVMBQETG3js.mistralChannels.chatComplete.tracePromise(
|
|
28784
28375
|
() => complete(request, options),
|
|
28785
28376
|
{
|
|
28786
28377
|
arguments: [request]
|
|
@@ -28788,52 +28379,52 @@ function wrapChatComplete(complete) {
|
|
|
28788
28379
|
);
|
|
28789
28380
|
}
|
|
28790
28381
|
function wrapChatStream(stream) {
|
|
28791
|
-
return (request, options) =>
|
|
28382
|
+
return (request, options) => _chunkVMBQETG3js.mistralChannels.chatStream.tracePromise(() => stream(request, options), {
|
|
28792
28383
|
arguments: [request]
|
|
28793
28384
|
});
|
|
28794
28385
|
}
|
|
28795
28386
|
function wrapEmbeddingsCreate(create) {
|
|
28796
|
-
return (request, options) =>
|
|
28387
|
+
return (request, options) => _chunkVMBQETG3js.mistralChannels.embeddingsCreate.tracePromise(
|
|
28797
28388
|
() => create(request, options),
|
|
28798
28389
|
{ arguments: [request] }
|
|
28799
28390
|
);
|
|
28800
28391
|
}
|
|
28801
28392
|
function wrapClassifiersModerate(moderate) {
|
|
28802
|
-
return (request, options) =>
|
|
28393
|
+
return (request, options) => _chunkVMBQETG3js.mistralChannels.classifiersModerate.tracePromise(
|
|
28803
28394
|
() => moderate(request, options),
|
|
28804
28395
|
{ arguments: [request] }
|
|
28805
28396
|
);
|
|
28806
28397
|
}
|
|
28807
28398
|
function wrapClassifiersModerateChat(moderateChat) {
|
|
28808
|
-
return (request, options) =>
|
|
28399
|
+
return (request, options) => _chunkVMBQETG3js.mistralChannels.classifiersModerateChat.tracePromise(
|
|
28809
28400
|
() => moderateChat(request, options),
|
|
28810
28401
|
{ arguments: [request] }
|
|
28811
28402
|
);
|
|
28812
28403
|
}
|
|
28813
28404
|
function wrapClassifiersClassify(classify) {
|
|
28814
|
-
return (request, options) =>
|
|
28405
|
+
return (request, options) => _chunkVMBQETG3js.mistralChannels.classifiersClassify.tracePromise(
|
|
28815
28406
|
() => classify(request, options),
|
|
28816
28407
|
{ arguments: [request] }
|
|
28817
28408
|
);
|
|
28818
28409
|
}
|
|
28819
28410
|
function wrapClassifiersClassifyChat(classifyChat) {
|
|
28820
|
-
return (request, options) =>
|
|
28411
|
+
return (request, options) => _chunkVMBQETG3js.mistralChannels.classifiersClassifyChat.tracePromise(
|
|
28821
28412
|
() => classifyChat(request, options),
|
|
28822
28413
|
{ arguments: [request] }
|
|
28823
28414
|
);
|
|
28824
28415
|
}
|
|
28825
28416
|
function wrapFimComplete(complete) {
|
|
28826
|
-
return (request, options) =>
|
|
28417
|
+
return (request, options) => _chunkVMBQETG3js.mistralChannels.fimComplete.tracePromise(() => complete(request, options), {
|
|
28827
28418
|
arguments: [request]
|
|
28828
28419
|
});
|
|
28829
28420
|
}
|
|
28830
28421
|
function wrapFimStream(stream) {
|
|
28831
|
-
return (request, options) =>
|
|
28422
|
+
return (request, options) => _chunkVMBQETG3js.mistralChannels.fimStream.tracePromise(() => stream(request, options), {
|
|
28832
28423
|
arguments: [request]
|
|
28833
28424
|
});
|
|
28834
28425
|
}
|
|
28835
28426
|
function wrapAgentsComplete(complete) {
|
|
28836
|
-
return (request, options) =>
|
|
28427
|
+
return (request, options) => _chunkVMBQETG3js.mistralChannels.agentsComplete.tracePromise(
|
|
28837
28428
|
() => complete(request, options),
|
|
28838
28429
|
{
|
|
28839
28430
|
arguments: [request]
|
|
@@ -28841,7 +28432,7 @@ function wrapAgentsComplete(complete) {
|
|
|
28841
28432
|
);
|
|
28842
28433
|
}
|
|
28843
28434
|
function wrapAgentsStream(stream) {
|
|
28844
|
-
return (request, options) =>
|
|
28435
|
+
return (request, options) => _chunkVMBQETG3js.mistralChannels.agentsStream.tracePromise(() => stream(request, options), {
|
|
28845
28436
|
arguments: [request]
|
|
28846
28437
|
});
|
|
28847
28438
|
}
|
|
@@ -28894,22 +28485,22 @@ function cohereProxy(cohere) {
|
|
|
28894
28485
|
return proxy;
|
|
28895
28486
|
}
|
|
28896
28487
|
function wrapChat(chat) {
|
|
28897
|
-
return (request, options) =>
|
|
28488
|
+
return (request, options) => _chunkVMBQETG3js.cohereChannels.chat.tracePromise(() => chat(request, options), {
|
|
28898
28489
|
arguments: [request]
|
|
28899
28490
|
});
|
|
28900
28491
|
}
|
|
28901
28492
|
function wrapChatStream2(chatStream) {
|
|
28902
|
-
return (request, options) =>
|
|
28493
|
+
return (request, options) => _chunkVMBQETG3js.cohereChannels.chatStream.tracePromise(() => chatStream(request, options), {
|
|
28903
28494
|
arguments: [request]
|
|
28904
28495
|
});
|
|
28905
28496
|
}
|
|
28906
28497
|
function wrapEmbed3(embed) {
|
|
28907
|
-
return (request, options) =>
|
|
28498
|
+
return (request, options) => _chunkVMBQETG3js.cohereChannels.embed.tracePromise(() => embed(request, options), {
|
|
28908
28499
|
arguments: [request]
|
|
28909
28500
|
});
|
|
28910
28501
|
}
|
|
28911
28502
|
function wrapRerank3(rerank) {
|
|
28912
|
-
return (request, options) =>
|
|
28503
|
+
return (request, options) => _chunkVMBQETG3js.cohereChannels.rerank.tracePromise(() => rerank(request, options), {
|
|
28913
28504
|
arguments: [request]
|
|
28914
28505
|
});
|
|
28915
28506
|
}
|
|
@@ -28939,7 +28530,7 @@ function isSupportedGroqClient(value) {
|
|
|
28939
28530
|
}
|
|
28940
28531
|
function groqProxy(groq) {
|
|
28941
28532
|
const privateMethodWorkaroundCache = /* @__PURE__ */ new WeakMap();
|
|
28942
|
-
const completionProxy = _optionalChain([groq, 'access',
|
|
28533
|
+
const completionProxy = _optionalChain([groq, 'access', _682 => _682.chat, 'optionalAccess', _683 => _683.completions]) ? new Proxy(groq.chat.completions, {
|
|
28943
28534
|
get(target, prop, receiver) {
|
|
28944
28535
|
if (prop === "create") {
|
|
28945
28536
|
return wrapChatCompletionsCreate(target.create.bind(target));
|
|
@@ -28991,13 +28582,13 @@ function groqProxy(groq) {
|
|
|
28991
28582
|
return topLevelProxy;
|
|
28992
28583
|
}
|
|
28993
28584
|
function wrapChatCompletionsCreate(create) {
|
|
28994
|
-
return (request, options) =>
|
|
28585
|
+
return (request, options) => _chunkVMBQETG3js.groqChannels.chatCompletionsCreate.tracePromise(
|
|
28995
28586
|
() => create(request, options),
|
|
28996
28587
|
{ arguments: [request] }
|
|
28997
28588
|
);
|
|
28998
28589
|
}
|
|
28999
28590
|
function wrapEmbeddingsCreate2(create) {
|
|
29000
|
-
return (request, options) =>
|
|
28591
|
+
return (request, options) => _chunkVMBQETG3js.groqChannels.embeddingsCreate.tracePromise(() => create(request, options), {
|
|
29001
28592
|
arguments: [request]
|
|
29002
28593
|
});
|
|
29003
28594
|
}
|
|
@@ -29045,13 +28636,13 @@ function copilotClientProxy(client) {
|
|
|
29045
28636
|
return proxy;
|
|
29046
28637
|
}
|
|
29047
28638
|
function wrappedCreateSession(client) {
|
|
29048
|
-
return (config) =>
|
|
28639
|
+
return (config) => _chunkVMBQETG3js.gitHubCopilotChannels.createSession.tracePromise(
|
|
29049
28640
|
() => client.createSession(config),
|
|
29050
28641
|
{ arguments: [config] }
|
|
29051
28642
|
);
|
|
29052
28643
|
}
|
|
29053
28644
|
function wrappedResumeSession(client) {
|
|
29054
|
-
return (sessionId, config) =>
|
|
28645
|
+
return (sessionId, config) => _chunkVMBQETG3js.gitHubCopilotChannels.resumeSession.tracePromise(
|
|
29055
28646
|
() => client.resumeSession(sessionId, config),
|
|
29056
28647
|
{ arguments: [sessionId, config] }
|
|
29057
28648
|
);
|
|
@@ -29065,7 +28656,7 @@ var VitestContextManager = class {
|
|
|
29065
28656
|
*/
|
|
29066
28657
|
|
|
29067
28658
|
constructor() {
|
|
29068
|
-
this.contextStorage =
|
|
28659
|
+
this.contextStorage = _chunkVMBQETG3js.isomorph_default.newAsyncLocalStorage();
|
|
29069
28660
|
}
|
|
29070
28661
|
getCurrentContext() {
|
|
29071
28662
|
return this.contextStorage.getStore();
|
|
@@ -29278,7 +28869,7 @@ function wrapTest(originalTest, config) {
|
|
|
29278
28869
|
const wrapped = function(name, configOrFn, maybeFn) {
|
|
29279
28870
|
const isEnhanced = typeof configOrFn !== "function";
|
|
29280
28871
|
const testConfig = isEnhanced ? configOrFn : void 0;
|
|
29281
|
-
if (isEnhanced && _optionalChain([testConfig, 'optionalAccess',
|
|
28872
|
+
if (isEnhanced && _optionalChain([testConfig, 'optionalAccess', _684 => _684.data]) && Array.isArray(testConfig.data)) {
|
|
29282
28873
|
const dataRecords = testConfig.data;
|
|
29283
28874
|
const testFn2 = maybeFn;
|
|
29284
28875
|
if (!testFn2) {
|
|
@@ -29316,7 +28907,7 @@ function wrapTest(originalTest, config) {
|
|
|
29316
28907
|
const registrationContext = getExperimentContext();
|
|
29317
28908
|
const testImplementation = async (vitestContext) => {
|
|
29318
28909
|
const experimentContext = _nullishCoalesce(getExperimentContext(), () => ( registrationContext));
|
|
29319
|
-
const experiment = _optionalChain([experimentContext, 'optionalAccess',
|
|
28910
|
+
const experiment = _optionalChain([experimentContext, 'optionalAccess', _685 => _685.experiment]);
|
|
29320
28911
|
if (config.onProgress) {
|
|
29321
28912
|
config.onProgress({ type: "test_start", testName: name });
|
|
29322
28913
|
}
|
|
@@ -29348,11 +28939,11 @@ function wrapTest(originalTest, config) {
|
|
|
29348
28939
|
const result = await runTracedEval({
|
|
29349
28940
|
experiment,
|
|
29350
28941
|
spanName: name,
|
|
29351
|
-
input: _optionalChain([testConfig, 'optionalAccess',
|
|
29352
|
-
expected: _optionalChain([testConfig, 'optionalAccess',
|
|
29353
|
-
metadata: _optionalChain([testConfig, 'optionalAccess',
|
|
29354
|
-
tags: _optionalChain([testConfig, 'optionalAccess',
|
|
29355
|
-
scorers: _optionalChain([testConfig, 'optionalAccess',
|
|
28942
|
+
input: _optionalChain([testConfig, 'optionalAccess', _686 => _686.input]),
|
|
28943
|
+
expected: _optionalChain([testConfig, 'optionalAccess', _687 => _687.expected]),
|
|
28944
|
+
metadata: _optionalChain([testConfig, 'optionalAccess', _688 => _688.metadata]),
|
|
28945
|
+
tags: _optionalChain([testConfig, 'optionalAccess', _689 => _689.tags]),
|
|
28946
|
+
scorers: _optionalChain([testConfig, 'optionalAccess', _690 => _690.scorers]),
|
|
29356
28947
|
fn: async () => {
|
|
29357
28948
|
if (testConfig && maybeFn) {
|
|
29358
28949
|
const params = {
|
|
@@ -29467,8 +29058,8 @@ function wrapDescribe(originalDescribe, config, afterAll) {
|
|
|
29467
29058
|
config.onProgress({
|
|
29468
29059
|
type: "suite_complete",
|
|
29469
29060
|
suiteName,
|
|
29470
|
-
passed: _nullishCoalesce(_optionalChain([context, 'optionalAccess',
|
|
29471
|
-
failed: _nullishCoalesce(_optionalChain([context, 'optionalAccess',
|
|
29061
|
+
passed: _nullishCoalesce(_optionalChain([context, 'optionalAccess', _691 => _691.passed]), () => ( 0)),
|
|
29062
|
+
failed: _nullishCoalesce(_optionalChain([context, 'optionalAccess', _692 => _692.failed]), () => ( 0))
|
|
29472
29063
|
});
|
|
29473
29064
|
}
|
|
29474
29065
|
});
|
|
@@ -29600,7 +29191,7 @@ function wrapVitest(vitestMethods, config = {}) {
|
|
|
29600
29191
|
return;
|
|
29601
29192
|
}
|
|
29602
29193
|
await summarizeAndFlush(ctx.experiment, {
|
|
29603
|
-
displaySummary: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29194
|
+
displaySummary: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _693 => _693.displaySummary]), () => ( config.displaySummary))
|
|
29604
29195
|
});
|
|
29605
29196
|
}
|
|
29606
29197
|
};
|
|
@@ -29680,7 +29271,7 @@ function initNodeTestSuite(config) {
|
|
|
29680
29271
|
|
|
29681
29272
|
// src/graph-framework.ts
|
|
29682
29273
|
var graph_framework_exports = {};
|
|
29683
|
-
|
|
29274
|
+
_chunkVMBQETG3js.__export.call(void 0, graph_framework_exports, {
|
|
29684
29275
|
AggregatorNode: () => AggregatorNode,
|
|
29685
29276
|
GateNode: () => GateNode,
|
|
29686
29277
|
GraphBuilder: () => GraphBuilder,
|
|
@@ -31124,7 +30715,7 @@ var CachedSpanFetcher = (_class31 = class {
|
|
|
31124
30715
|
async fetchSpans(spanType) {
|
|
31125
30716
|
const spans = await this.fetchFn(spanType, false);
|
|
31126
30717
|
for (const span of spans) {
|
|
31127
|
-
const type = _nullishCoalesce(_optionalChain([span, 'access',
|
|
30718
|
+
const type = _nullishCoalesce(_optionalChain([span, 'access', _694 => _694.span_attributes, 'optionalAccess', _695 => _695.type]), () => ( ""));
|
|
31128
30719
|
const existing = _nullishCoalesce(this.spanCache.get(type), () => ( []));
|
|
31129
30720
|
existing.push(span);
|
|
31130
30721
|
this.spanCache.set(type, existing);
|
|
@@ -31207,11 +30798,11 @@ var LocalTrace = (_class32 = class {
|
|
|
31207
30798
|
const cachedSpans = this.state.spanCache.getByRootSpanId(this.rootSpanId);
|
|
31208
30799
|
if (cachedSpans && cachedSpans.length > 0) {
|
|
31209
30800
|
let spans = includeScorers ? cachedSpans : cachedSpans.filter(
|
|
31210
|
-
(span) => _optionalChain([span, 'access',
|
|
30801
|
+
(span) => _optionalChain([span, 'access', _696 => _696.span_attributes, 'optionalAccess', _697 => _697.purpose]) !== "scorer"
|
|
31211
30802
|
);
|
|
31212
30803
|
if (spanType && spanType.length > 0) {
|
|
31213
30804
|
spans = spans.filter(
|
|
31214
|
-
(span) => spanType.includes(_nullishCoalesce(_optionalChain([span, 'access',
|
|
30805
|
+
(span) => spanType.includes(_nullishCoalesce(_optionalChain([span, 'access', _698 => _698.span_attributes, 'optionalAccess', _699 => _699.type]), () => ( "")))
|
|
31215
30806
|
);
|
|
31216
30807
|
}
|
|
31217
30808
|
return spans.map((span) => ({
|
|
@@ -31236,7 +30827,7 @@ var LocalTrace = (_class32 = class {
|
|
|
31236
30827
|
* Calls the API with the project_default preprocessor (which falls back to "thread").
|
|
31237
30828
|
*/
|
|
31238
30829
|
async getThread(options) {
|
|
31239
|
-
const cacheKey = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30830
|
+
const cacheKey = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _700 => _700.preprocessor]), () => ( "project_default"));
|
|
31240
30831
|
if (!this.threadCache.has(cacheKey)) {
|
|
31241
30832
|
const promise = this.fetchThread(options);
|
|
31242
30833
|
this.threadCache.set(cacheKey, promise);
|
|
@@ -31247,7 +30838,7 @@ var LocalTrace = (_class32 = class {
|
|
|
31247
30838
|
await this.ensureSpansReady();
|
|
31248
30839
|
await this.state.login({});
|
|
31249
30840
|
const result = await invoke({
|
|
31250
|
-
globalFunction: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30841
|
+
globalFunction: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _701 => _701.preprocessor]), () => ( "project_default")),
|
|
31251
30842
|
functionType: "preprocessor",
|
|
31252
30843
|
input: {
|
|
31253
30844
|
trace_ref: {
|
|
@@ -31423,10 +31014,10 @@ function validateParametersWithJsonSchema(parameters, schema) {
|
|
|
31423
31014
|
const ajv = new (0, _ajv2.default)({ coerceTypes: true, useDefaults: true, strict: false });
|
|
31424
31015
|
const validate = ajv.compile(schema);
|
|
31425
31016
|
if (!validate(parameters)) {
|
|
31426
|
-
const errorMessages = _optionalChain([validate, 'access',
|
|
31017
|
+
const errorMessages = _optionalChain([validate, 'access', _702 => _702.errors, 'optionalAccess', _703 => _703.map, 'call', _704 => _704((err) => {
|
|
31427
31018
|
const path2 = err.instancePath || "root";
|
|
31428
31019
|
return `${path2}: ${err.message}`;
|
|
31429
|
-
}), 'access',
|
|
31020
|
+
}), 'access', _705 => _705.join, 'call', _706 => _706(", ")]);
|
|
31430
31021
|
throw Error(`Invalid parameters: ${errorMessages}`);
|
|
31431
31022
|
}
|
|
31432
31023
|
return rehydrateRemoteParameters(parameters, schema);
|
|
@@ -31788,7 +31379,7 @@ var defaultErrorScoreHandler = ({
|
|
|
31788
31379
|
};
|
|
31789
31380
|
async function runEvaluatorInternal(experiment, evaluator, progressReporter, filters, stream, parameters, collectResults, enableCache) {
|
|
31790
31381
|
if (enableCache) {
|
|
31791
|
-
_optionalChain([(_nullishCoalesce(evaluator.state, () => ( _internalGetGlobalState()))), 'optionalAccess',
|
|
31382
|
+
_optionalChain([(_nullishCoalesce(evaluator.state, () => ( _internalGetGlobalState()))), 'optionalAccess', _707 => _707.spanCache, 'optionalAccess', _708 => _708.start, 'call', _709 => _709()]);
|
|
31792
31383
|
}
|
|
31793
31384
|
try {
|
|
31794
31385
|
if (typeof evaluator.data === "string") {
|
|
@@ -31843,7 +31434,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
31843
31434
|
const experimentIdPromise = experiment ? (async () => {
|
|
31844
31435
|
try {
|
|
31845
31436
|
return await experiment.id;
|
|
31846
|
-
} catch (
|
|
31437
|
+
} catch (e54) {
|
|
31847
31438
|
return void 0;
|
|
31848
31439
|
}
|
|
31849
31440
|
})() : void 0;
|
|
@@ -31899,7 +31490,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
31899
31490
|
objectType: parentComponents ? spanObjectTypeV3ToTypedString(
|
|
31900
31491
|
parentComponents.data.object_type
|
|
31901
31492
|
) : "experiment",
|
|
31902
|
-
objectId: await _asyncNullishCoalesce(await _asyncOptionalChain([parentComponents, 'optionalAccess', async
|
|
31493
|
+
objectId: await _asyncNullishCoalesce(await _asyncOptionalChain([parentComponents, 'optionalAccess', async _710 => _710.data, 'access', async _711 => _711.object_id]), async () => ( (experimentIdPromise ? await _asyncNullishCoalesce(await experimentIdPromise, async () => ( "")) : ""))),
|
|
31903
31494
|
rootSpanId: rootSpan.rootSpanId,
|
|
31904
31495
|
ensureSpansFlushed,
|
|
31905
31496
|
state
|
|
@@ -31929,10 +31520,10 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
31929
31520
|
span,
|
|
31930
31521
|
parameters: _nullishCoalesce(parameters, () => ( {})),
|
|
31931
31522
|
reportProgress: (event) => {
|
|
31932
|
-
_optionalChain([stream, 'optionalCall',
|
|
31523
|
+
_optionalChain([stream, 'optionalCall', _712 => _712({
|
|
31933
31524
|
...event,
|
|
31934
31525
|
id: rootSpan.id,
|
|
31935
|
-
origin: _optionalChain([baseEvent, 'access',
|
|
31526
|
+
origin: _optionalChain([baseEvent, 'access', _713 => _713.event, 'optionalAccess', _714 => _714.origin]),
|
|
31936
31527
|
name: evaluator.evalName,
|
|
31937
31528
|
object_type: "task"
|
|
31938
31529
|
})]);
|
|
@@ -32120,7 +31711,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
32120
31711
|
tags: tags.length ? tags : void 0,
|
|
32121
31712
|
metadata,
|
|
32122
31713
|
error,
|
|
32123
|
-
origin: _optionalChain([baseEvent, 'access',
|
|
31714
|
+
origin: _optionalChain([baseEvent, 'access', _715 => _715.event, 'optionalAccess', _716 => _716.origin])
|
|
32124
31715
|
};
|
|
32125
31716
|
collectedResults.push({
|
|
32126
31717
|
...baseResult,
|
|
@@ -32160,7 +31751,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
32160
31751
|
break;
|
|
32161
31752
|
}
|
|
32162
31753
|
scheduledTrials++;
|
|
32163
|
-
_optionalChain([progressReporter, 'access',
|
|
31754
|
+
_optionalChain([progressReporter, 'access', _717 => _717.setTotal, 'optionalCall', _718 => _718(evaluator.evalName, scheduledTrials)]);
|
|
32164
31755
|
q.pushAsync({ datum, trialIndex }).catch((e) => {
|
|
32165
31756
|
if (queueErrors.length < 5) {
|
|
32166
31757
|
queueErrors.push(e);
|
|
@@ -32222,7 +31813,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
32222
31813
|
} catch (e) {
|
|
32223
31814
|
q.kill();
|
|
32224
31815
|
if (e instanceof InternalAbortError) {
|
|
32225
|
-
if (
|
|
31816
|
+
if (_chunkVMBQETG3js.isomorph_default.getEnv("BRAINTRUST_VERBOSE")) {
|
|
32226
31817
|
debugLogger.forState(evaluator.state).warn("Evaluator cancelled:", e.message);
|
|
32227
31818
|
}
|
|
32228
31819
|
}
|
|
@@ -32245,9 +31836,9 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
32245
31836
|
);
|
|
32246
31837
|
} finally {
|
|
32247
31838
|
if (enableCache) {
|
|
32248
|
-
const spanCache = _optionalChain([(_nullishCoalesce(evaluator.state, () => ( _internalGetGlobalState()))), 'optionalAccess',
|
|
32249
|
-
_optionalChain([spanCache, 'optionalAccess',
|
|
32250
|
-
_optionalChain([spanCache, 'optionalAccess',
|
|
31839
|
+
const spanCache = _optionalChain([(_nullishCoalesce(evaluator.state, () => ( _internalGetGlobalState()))), 'optionalAccess', _719 => _719.spanCache]);
|
|
31840
|
+
_optionalChain([spanCache, 'optionalAccess', _720 => _720.dispose, 'call', _721 => _721()]);
|
|
31841
|
+
_optionalChain([spanCache, 'optionalAccess', _722 => _722.stop, 'call', _723 => _723()]);
|
|
32251
31842
|
}
|
|
32252
31843
|
}
|
|
32253
31844
|
}
|
|
@@ -32340,25 +31931,25 @@ var defaultReporter = {
|
|
|
32340
31931
|
reportFailures(evaluator, failingResults, { verbose, jsonl });
|
|
32341
31932
|
}
|
|
32342
31933
|
if (jsonl) {
|
|
32343
|
-
|
|
31934
|
+
_chunkVMBQETG3js.isomorph_default.writeln(JSON.stringify(summary));
|
|
32344
31935
|
} else {
|
|
32345
|
-
|
|
32346
|
-
|
|
31936
|
+
_chunkVMBQETG3js.isomorph_default.writeln("Experiment summary");
|
|
31937
|
+
_chunkVMBQETG3js.isomorph_default.writeln("==================");
|
|
32347
31938
|
if (summary.comparisonExperimentName) {
|
|
32348
|
-
|
|
31939
|
+
_chunkVMBQETG3js.isomorph_default.writeln(
|
|
32349
31940
|
`${summary.comparisonExperimentName} (baseline) <- ${summary.experimentName} (comparison)`
|
|
32350
31941
|
);
|
|
32351
|
-
|
|
31942
|
+
_chunkVMBQETG3js.isomorph_default.writeln("");
|
|
32352
31943
|
}
|
|
32353
31944
|
const hasScores = Object.keys(summary.scores).length > 0;
|
|
32354
31945
|
const hasMetrics = Object.keys(_nullishCoalesce(summary.metrics, () => ( {}))).length > 0;
|
|
32355
31946
|
const hasComparison = !!summary.comparisonExperimentName;
|
|
32356
31947
|
if (hasScores || hasMetrics) {
|
|
32357
31948
|
if (hasComparison) {
|
|
32358
|
-
|
|
31949
|
+
_chunkVMBQETG3js.isomorph_default.writeln(
|
|
32359
31950
|
"Name Value Change Improvements Regressions"
|
|
32360
31951
|
);
|
|
32361
|
-
|
|
31952
|
+
_chunkVMBQETG3js.isomorph_default.writeln(
|
|
32362
31953
|
"----------------------------------------------------------------"
|
|
32363
31954
|
);
|
|
32364
31955
|
}
|
|
@@ -32374,11 +31965,11 @@ var defaultReporter = {
|
|
|
32374
31965
|
}
|
|
32375
31966
|
const improvements = score.improvements > 0 ? score.improvements.toString() : "-";
|
|
32376
31967
|
const regressions = score.regressions > 0 ? score.regressions.toString() : "-";
|
|
32377
|
-
|
|
31968
|
+
_chunkVMBQETG3js.isomorph_default.writeln(
|
|
32378
31969
|
`${score.name.padEnd(18)} ${scoreValue.padStart(10)} ${diffString.padStart(10)} ${improvements.padStart(12)} ${regressions.padStart(11)}`
|
|
32379
31970
|
);
|
|
32380
31971
|
} else {
|
|
32381
|
-
|
|
31972
|
+
_chunkVMBQETG3js.isomorph_default.writeln(`${score.name.padEnd(20)} ${scoreValue.padStart(15)}`);
|
|
32382
31973
|
}
|
|
32383
31974
|
}
|
|
32384
31975
|
for (const metric of Object.values(_nullishCoalesce(summary.metrics, () => ( {})))) {
|
|
@@ -32394,23 +31985,23 @@ var defaultReporter = {
|
|
|
32394
31985
|
}
|
|
32395
31986
|
const improvements = metric.improvements > 0 ? metric.improvements.toString() : "-";
|
|
32396
31987
|
const regressions = metric.regressions > 0 ? metric.regressions.toString() : "-";
|
|
32397
|
-
|
|
31988
|
+
_chunkVMBQETG3js.isomorph_default.writeln(
|
|
32398
31989
|
`${metric.name.padEnd(18)} ${metricValue.padStart(10)} ${diffString.padStart(10)} ${improvements.padStart(12)} ${regressions.padStart(11)}`
|
|
32399
31990
|
);
|
|
32400
31991
|
} else {
|
|
32401
|
-
|
|
31992
|
+
_chunkVMBQETG3js.isomorph_default.writeln(
|
|
32402
31993
|
`${metric.name.padEnd(20)} ${metricValue.padStart(15)}`
|
|
32403
31994
|
);
|
|
32404
31995
|
}
|
|
32405
31996
|
}
|
|
32406
31997
|
}
|
|
32407
31998
|
if (summary.experimentUrl) {
|
|
32408
|
-
|
|
32409
|
-
|
|
32410
|
-
|
|
31999
|
+
_chunkVMBQETG3js.isomorph_default.writeln("");
|
|
32000
|
+
_chunkVMBQETG3js.isomorph_default.writeln(`View results for ${summary.experimentName}`);
|
|
32001
|
+
_chunkVMBQETG3js.isomorph_default.writeln(`See results at ${summary.experimentUrl}`);
|
|
32411
32002
|
}
|
|
32412
32003
|
}
|
|
32413
|
-
|
|
32004
|
+
_chunkVMBQETG3js.isomorph_default.writeln("");
|
|
32414
32005
|
return failingResults.length === 0;
|
|
32415
32006
|
},
|
|
32416
32007
|
async reportRun(evalReports) {
|
|
@@ -32531,7 +32122,7 @@ var ToolBuilder = (_class34 = class {
|
|
|
32531
32122
|
const { handler, name, slug, parameters, returns, ...rest } = opts;
|
|
32532
32123
|
let resolvedName = _nullishCoalesce(name, () => ( handler.name));
|
|
32533
32124
|
if (resolvedName.trim().length === 0) {
|
|
32534
|
-
resolvedName = `Tool ${
|
|
32125
|
+
resolvedName = `Tool ${_chunkVMBQETG3js.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
|
|
32535
32126
|
}
|
|
32536
32127
|
const tool = new CodeFunction(this.project, {
|
|
32537
32128
|
handler,
|
|
@@ -32560,7 +32151,7 @@ var ScorerBuilder = (_class35 = class {
|
|
|
32560
32151
|
resolvedName = opts.handler.name;
|
|
32561
32152
|
}
|
|
32562
32153
|
if (!resolvedName || resolvedName.trim().length === 0) {
|
|
32563
|
-
resolvedName = `Scorer ${
|
|
32154
|
+
resolvedName = `Scorer ${_chunkVMBQETG3js.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
|
|
32564
32155
|
}
|
|
32565
32156
|
const slug = _nullishCoalesce(opts.slug, () => ( slugify(resolvedName, { lower: true, strict: true })));
|
|
32566
32157
|
if ("handler" in opts) {
|
|
@@ -33118,5 +32709,4 @@ configureNode();
|
|
|
33118
32709
|
|
|
33119
32710
|
|
|
33120
32711
|
|
|
33121
|
-
|
|
33122
|
-
exports.Attachment = Attachment; exports.AttachmentReference = AttachmentReference; exports.BRAINTRUST_CURRENT_SPAN_STORE = BRAINTRUST_CURRENT_SPAN_STORE; exports.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME = BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME; exports.BaseAttachment = BaseAttachment; exports.BaseExperiment = BaseExperiment; exports.BraintrustLangChainCallbackHandler = BraintrustLangChainCallbackHandler; exports.BraintrustMiddleware = BraintrustMiddleware; exports.BraintrustObservabilityExporter = BraintrustObservabilityExporter; exports.BraintrustState = BraintrustState; exports.BraintrustStream = BraintrustStream; exports.CachedSpanFetcher = CachedSpanFetcher; exports.CodeFunction = CodeFunction; exports.CodePrompt = CodePrompt; exports.ContextManager = ContextManager; exports.DEFAULT_FETCH_BATCH_SIZE = DEFAULT_FETCH_BATCH_SIZE; exports.DEFAULT_MAX_REQUEST_SIZE = DEFAULT_MAX_REQUEST_SIZE; exports.Dataset = Dataset2; exports.DatasetPipeline = DatasetPipeline; exports.ERR_PERMALINK = ERR_PERMALINK; exports.Eval = Eval; exports.EvalResultWithSummary = EvalResultWithSummary; exports.Experiment = Experiment2; exports.ExternalAttachment = ExternalAttachment; exports.FailedHTTPResponse = FailedHTTPResponse; exports.IDGenerator = IDGenerator; exports.JSONAttachment = JSONAttachment; exports.LEGACY_CACHED_HEADER = LEGACY_CACHED_HEADER; exports.LOGS3_OVERFLOW_REFERENCE_TYPE = LOGS3_OVERFLOW_REFERENCE_TYPE; exports.LazyValue = LazyValue; exports.Logger = Logger; exports.LoginInvalidOrgError = LoginInvalidOrgError; exports.NOOP_SPAN = NOOP_SPAN; exports.NOOP_SPAN_PERMALINK = NOOP_SPAN_PERMALINK; exports.NoopSpan = NoopSpan; exports.ObjectFetcher = ObjectFetcher; exports.Project = Project2; exports.ProjectNameIdMap = ProjectNameIdMap; exports.Prompt = Prompt2; exports.PromptBuilder = PromptBuilder; exports.ReadonlyAttachment = ReadonlyAttachment; exports.ReadonlyExperiment = ReadonlyExperiment; exports.Reporter = Reporter; exports.ScorerBuilder = ScorerBuilder; exports.SpanFetcher = SpanFetcher; exports.SpanImpl = SpanImpl; exports.TestBackgroundLogger = TestBackgroundLogger; exports.ToolBuilder = ToolBuilder; exports.UUIDGenerator = UUIDGenerator; exports.X_CACHED_HEADER = X_CACHED_HEADER; exports._exportsForTestingOnly = _exportsForTestingOnly; exports._internalGetGlobalState = _internalGetGlobalState; exports._internalIso = _chunkNKD77KGBjs.isomorph_default; exports._internalSetInitialState = _internalSetInitialState; exports.addAzureBlobHeaders = addAzureBlobHeaders; exports.braintrustStreamChunkSchema = braintrustStreamChunkSchema; exports.buildLocalSummary = buildLocalSummary; exports.configureInstrumentation = configureInstrumentation; exports.constructLogs3OverflowRequest = constructLogs3OverflowRequest; exports.createFinalValuePassThroughStream = createFinalValuePassThroughStream; exports.currentExperiment = currentExperiment; exports.currentLogger = currentLogger; exports.currentSpan = currentSpan; exports.deepCopyEvent = deepCopyEvent; exports.default = exports_exports; exports.defaultErrorScoreHandler = defaultErrorScoreHandler; exports.deserializePlainStringAsJSON = deserializePlainStringAsJSON; exports.devNullWritableStream = devNullWritableStream; exports.evaluatorDefinitionSchema = evaluatorDefinitionSchema; exports.evaluatorDefinitionsSchema = evaluatorDefinitionsSchema; exports.flush = flush; exports.getContextManager = getContextManager; exports.getIdGenerator = getIdGenerator; exports.getPromptVersions = getPromptVersions; exports.getSpanParentObject = getSpanParentObject; exports.getTemplateRenderer = getTemplateRenderer; exports.graph = graph_framework_exports; exports.init = init; exports.initDataset = initDataset; exports.initExperiment = initExperiment; exports.initFunction = initFunction; exports.initLogger = initLogger; exports.initNodeTestSuite = initNodeTestSuite; exports.invoke = invoke; exports.isTemplateFormat = isTemplateFormat; exports.loadParameters = loadParameters; exports.loadPrompt = loadPrompt; exports.log = log; exports.logError = logError; exports.login = login; exports.loginToState = loginToState; exports.logs3OverflowUploadSchema = logs3OverflowUploadSchema; exports.newId = newId; exports.parseCachedHeader = parseCachedHeader; exports.parseTemplateFormat = parseTemplateFormat; exports.permalink = permalink; exports.pickLogs3OverflowObjectIds = pickLogs3OverflowObjectIds; exports.projects = projects; exports.promptContentsSchema = promptContentsSchema; exports.promptDefinitionSchema = promptDefinitionSchema; exports.promptDefinitionToPromptData = promptDefinitionToPromptData; exports.promptDefinitionWithToolsSchema = promptDefinitionWithToolsSchema; exports.registerOtelFlush = registerOtelFlush; exports.registerSandbox = registerSandbox; exports.registerTemplatePlugin = registerTemplatePlugin; exports.renderMessage = renderMessage; exports.renderPromptParams = renderPromptParams; exports.renderTemplateContent = renderTemplateContent; exports.reportFailures = reportFailures; exports.runEvaluator = runEvaluator; exports.setFetch = setFetch; exports.setMaskingFunction = setMaskingFunction; exports.spanComponentsToObjectId = spanComponentsToObjectId; exports.startSpan = startSpan; exports.summarize = summarize; exports.templateRegistry = templateRegistry; exports.toolFunctionDefinitionSchema = ToolFunctionDefinition; exports.traceable = traceable; exports.traced = traced; exports.updateSpan = updateSpan; exports.uploadLogs3OverflowPayload = uploadLogs3OverflowPayload; exports.utf8ByteLength = utf8ByteLength; exports.withCurrent = withCurrent; exports.withDataset = withDataset; exports.withExperiment = withExperiment; exports.withLogger = withLogger; exports.withParent = withParent; exports.wrapAISDK = wrapAISDK; exports.wrapAISDKModel = wrapAISDKModel; exports.wrapAgentClass = wrapAgentClass; exports.wrapAnthropic = wrapAnthropic; exports.wrapClaudeAgentSDK = wrapClaudeAgentSDK; exports.wrapCohere = wrapCohere; exports.wrapCopilotClient = wrapCopilotClient; exports.wrapCursorSDK = wrapCursorSDK; exports.wrapFlueContext = wrapFlueContext; exports.wrapFlueSession = wrapFlueSession; exports.wrapGenkit = wrapGenkit; exports.wrapGoogleADK = wrapGoogleADK; exports.wrapGoogleGenAI = wrapGoogleGenAI; exports.wrapGroq = wrapGroq; exports.wrapHuggingFace = wrapHuggingFace; exports.wrapMastraAgent = wrapMastraAgent; exports.wrapMistral = wrapMistral; exports.wrapOpenAI = wrapOpenAI; exports.wrapOpenAICodexSDK = wrapOpenAICodexSDK; exports.wrapOpenAIv4 = wrapOpenAIv4; exports.wrapOpenRouter = wrapOpenRouter; exports.wrapOpenRouterAgent = wrapOpenRouterAgent; exports.wrapTraced = wrapTraced; exports.wrapVitest = wrapVitest;
|
|
32712
|
+
exports.Attachment = Attachment; exports.AttachmentReference = AttachmentReference; exports.BRAINTRUST_CURRENT_SPAN_STORE = BRAINTRUST_CURRENT_SPAN_STORE; exports.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME = BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME; exports.BaseAttachment = BaseAttachment; exports.BaseExperiment = BaseExperiment; exports.BraintrustLangChainCallbackHandler = BraintrustLangChainCallbackHandler; exports.BraintrustMiddleware = BraintrustMiddleware; exports.BraintrustObservabilityExporter = BraintrustObservabilityExporter; exports.BraintrustState = BraintrustState; exports.BraintrustStream = BraintrustStream; exports.CachedSpanFetcher = CachedSpanFetcher; exports.CodeFunction = CodeFunction; exports.CodePrompt = CodePrompt; exports.ContextManager = ContextManager; exports.DEFAULT_FETCH_BATCH_SIZE = DEFAULT_FETCH_BATCH_SIZE; exports.DEFAULT_MAX_REQUEST_SIZE = DEFAULT_MAX_REQUEST_SIZE; exports.Dataset = Dataset2; exports.DatasetPipeline = DatasetPipeline; exports.ERR_PERMALINK = ERR_PERMALINK; exports.Eval = Eval; exports.EvalResultWithSummary = EvalResultWithSummary; exports.Experiment = Experiment2; exports.ExternalAttachment = ExternalAttachment; exports.FailedHTTPResponse = FailedHTTPResponse; exports.IDGenerator = IDGenerator; exports.JSONAttachment = JSONAttachment; exports.LEGACY_CACHED_HEADER = LEGACY_CACHED_HEADER; exports.LOGS3_OVERFLOW_REFERENCE_TYPE = LOGS3_OVERFLOW_REFERENCE_TYPE; exports.LazyValue = LazyValue; exports.Logger = Logger; exports.LoginInvalidOrgError = LoginInvalidOrgError; exports.NOOP_SPAN = NOOP_SPAN; exports.NOOP_SPAN_PERMALINK = NOOP_SPAN_PERMALINK; exports.NoopSpan = NoopSpan; exports.ObjectFetcher = ObjectFetcher; exports.Project = Project2; exports.ProjectNameIdMap = ProjectNameIdMap; exports.Prompt = Prompt2; exports.PromptBuilder = PromptBuilder; exports.ReadonlyAttachment = ReadonlyAttachment; exports.ReadonlyExperiment = ReadonlyExperiment; exports.Reporter = Reporter; exports.ScorerBuilder = ScorerBuilder; exports.SpanFetcher = SpanFetcher; exports.SpanImpl = SpanImpl; exports.TestBackgroundLogger = TestBackgroundLogger; exports.ToolBuilder = ToolBuilder; exports.UUIDGenerator = UUIDGenerator; exports.X_CACHED_HEADER = X_CACHED_HEADER; exports._exportsForTestingOnly = _exportsForTestingOnly; exports._internalGetGlobalState = _internalGetGlobalState; exports._internalIso = _chunkVMBQETG3js.isomorph_default; exports._internalSetInitialState = _internalSetInitialState; exports.addAzureBlobHeaders = addAzureBlobHeaders; exports.braintrustFlueObserver = braintrustFlueObserver; exports.braintrustStreamChunkSchema = braintrustStreamChunkSchema; exports.buildLocalSummary = buildLocalSummary; exports.configureInstrumentation = configureInstrumentation; exports.constructLogs3OverflowRequest = constructLogs3OverflowRequest; exports.createFinalValuePassThroughStream = createFinalValuePassThroughStream; exports.currentExperiment = currentExperiment; exports.currentLogger = currentLogger; exports.currentSpan = currentSpan; exports.deepCopyEvent = deepCopyEvent; exports.default = exports_exports; exports.defaultErrorScoreHandler = defaultErrorScoreHandler; exports.deserializePlainStringAsJSON = deserializePlainStringAsJSON; exports.devNullWritableStream = devNullWritableStream; exports.evaluatorDefinitionSchema = evaluatorDefinitionSchema; exports.evaluatorDefinitionsSchema = evaluatorDefinitionsSchema; exports.flush = flush; exports.getContextManager = getContextManager; exports.getIdGenerator = getIdGenerator; exports.getPromptVersions = getPromptVersions; exports.getSpanParentObject = getSpanParentObject; exports.getTemplateRenderer = getTemplateRenderer; exports.graph = graph_framework_exports; exports.init = init; exports.initDataset = initDataset; exports.initExperiment = initExperiment; exports.initFunction = initFunction; exports.initLogger = initLogger; exports.initNodeTestSuite = initNodeTestSuite; exports.invoke = invoke; exports.isTemplateFormat = isTemplateFormat; exports.loadParameters = loadParameters; exports.loadPrompt = loadPrompt; exports.log = log; exports.logError = logError; exports.login = login; exports.loginToState = loginToState; exports.logs3OverflowUploadSchema = logs3OverflowUploadSchema; exports.newId = newId; exports.parseCachedHeader = parseCachedHeader; exports.parseTemplateFormat = parseTemplateFormat; exports.permalink = permalink; exports.pickLogs3OverflowObjectIds = pickLogs3OverflowObjectIds; exports.projects = projects; exports.promptContentsSchema = promptContentsSchema; exports.promptDefinitionSchema = promptDefinitionSchema; exports.promptDefinitionToPromptData = promptDefinitionToPromptData; exports.promptDefinitionWithToolsSchema = promptDefinitionWithToolsSchema; exports.registerOtelFlush = registerOtelFlush; exports.registerSandbox = registerSandbox; exports.registerTemplatePlugin = registerTemplatePlugin; exports.renderMessage = renderMessage; exports.renderPromptParams = renderPromptParams; exports.renderTemplateContent = renderTemplateContent; exports.reportFailures = reportFailures; exports.runEvaluator = runEvaluator; exports.setFetch = setFetch; exports.setMaskingFunction = setMaskingFunction; exports.spanComponentsToObjectId = spanComponentsToObjectId; exports.startSpan = startSpan; exports.summarize = summarize; exports.templateRegistry = templateRegistry; exports.toolFunctionDefinitionSchema = ToolFunctionDefinition; exports.traceable = traceable; exports.traced = traced; exports.updateSpan = updateSpan; exports.uploadLogs3OverflowPayload = uploadLogs3OverflowPayload; exports.utf8ByteLength = utf8ByteLength; exports.withCurrent = withCurrent; exports.withDataset = withDataset; exports.withExperiment = withExperiment; exports.withLogger = withLogger; exports.withParent = withParent; exports.wrapAISDK = wrapAISDK; exports.wrapAISDKModel = wrapAISDKModel; exports.wrapAgentClass = wrapAgentClass; exports.wrapAnthropic = wrapAnthropic; exports.wrapClaudeAgentSDK = wrapClaudeAgentSDK; exports.wrapCohere = wrapCohere; exports.wrapCopilotClient = wrapCopilotClient; exports.wrapCursorSDK = wrapCursorSDK; exports.wrapGenkit = wrapGenkit; exports.wrapGoogleADK = wrapGoogleADK; exports.wrapGoogleGenAI = wrapGoogleGenAI; exports.wrapGroq = wrapGroq; exports.wrapHuggingFace = wrapHuggingFace; exports.wrapMastraAgent = wrapMastraAgent; exports.wrapMistral = wrapMistral; exports.wrapOpenAI = wrapOpenAI; exports.wrapOpenAICodexSDK = wrapOpenAICodexSDK; exports.wrapOpenAIv4 = wrapOpenAIv4; exports.wrapOpenRouter = wrapOpenRouter; exports.wrapOpenRouterAgent = wrapOpenRouterAgent; exports.wrapTraced = wrapTraced; exports.wrapVitest = wrapVitest;
|