bitfab 0.67.0 → 0.68.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/dist/{autoTrace-CQw0qMBt.cjs → autoTrace-BikML0lX.cjs} +86 -4
- package/dist/autoTrace-BikML0lX.cjs.map +1 -0
- package/dist/{autoTrace-O40k8f5M.js → autoTrace-CVt9EDyo.js} +75 -5
- package/dist/autoTrace-CVt9EDyo.js.map +1 -0
- package/dist/autoTrace.cjs +3 -1
- package/dist/autoTrace.d.cts +21 -0
- package/dist/autoTrace.d.ts +21 -0
- package/dist/autoTrace.js +1 -1
- package/dist/{babelPlugin-CBjx6aJe.js → babelPlugin-a7ofCoOd.js} +56 -2
- package/dist/babelPlugin-a7ofCoOd.js.map +1 -0
- package/dist/{babelPlugin-ZR9ilYct.cjs → babelPlugin-s8EFjT6e.cjs} +56 -2
- package/dist/babelPlugin-s8EFjT6e.cjs.map +1 -0
- package/dist/{http-CcYPHER5.js → http-_cgR_DM2.js} +3 -3
- package/dist/{http-CcYPHER5.js.map → http-_cgR_DM2.js.map} +1 -1
- package/dist/{http-CxT_WDAh.cjs → http-psFF1ptn.cjs} +3 -3
- package/dist/{http-CxT_WDAh.cjs.map → http-psFF1ptn.cjs.map} +1 -1
- package/dist/{index-BFgtvRni.d.cts → index-j7SrvOqe.d.cts} +44 -2
- package/dist/{index-BFgtvRni.d.ts → index-j7SrvOqe.d.ts} +44 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/node.cjs +3 -3
- package/dist/node.d.cts +2 -2
- package/dist/node.d.ts +2 -2
- package/dist/node.js +3 -3
- package/dist/registryCommand-Dk4Y1ZgW.js.map +1 -1
- package/dist/{src-CFDoTgXw.js → src-DyEKM7yn.js} +115 -8
- package/dist/src-DyEKM7yn.js.map +1 -0
- package/dist/{src-DXmdXbOL.cjs → src-Dze8o7iU.cjs} +115 -8
- package/dist/src-Dze8o7iU.cjs.map +1 -0
- package/dist/transform/babel.cjs +1 -1
- package/dist/transform/babel.d.cts +2 -0
- package/dist/transform/babel.d.ts +2 -0
- package/dist/transform/babel.js +1 -1
- package/dist/transform/loaderRuntime.cjs +2 -2
- package/dist/transform/loaderRuntime.js +2 -2
- package/dist/transform/nodeLoader.js +55 -1
- package/dist/transform/nodeLoader.js.map +1 -1
- package/dist/transform/swc.cjs +1 -1
- package/dist/transform/swc.js +1 -1
- package/dist/transform/unplugin.cjs +2 -2
- package/dist/transform/unplugin.js +2 -2
- package/dist/{transform-D_pSvPJc.cjs → transform-BBzrqpVH.cjs} +2 -2
- package/dist/{transform-D_pSvPJc.cjs.map → transform-BBzrqpVH.cjs.map} +1 -1
- package/dist/{transform-DP1qnD8u.js → transform-DkcFn_tg.js} +2 -2
- package/dist/{transform-DP1qnD8u.js.map → transform-DkcFn_tg.js.map} +1 -1
- package/package.json +2 -1
- package/dist/autoTrace-CQw0qMBt.cjs.map +0 -1
- package/dist/autoTrace-O40k8f5M.js.map +0 -1
- package/dist/babelPlugin-CBjx6aJe.js.map +0 -1
- package/dist/babelPlugin-ZR9ilYct.cjs.map +0 -1
- package/dist/src-CFDoTgXw.js.map +0 -1
- package/dist/src-DXmdXbOL.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import { C as readEnv$1, S as MixedTracingError, _ as getReplayContext, b as gitRunner, c as recordCallerTraceMetadata, f as ROOT_TRACE_FUNCTION_KEY_FIELD, g as MAX_COMPRESSIBLE_SPAN_CARRIER_BYTES, h as makeSpanOrigin, i as flushTraces, l as retireTraceMetadata, m as isFrameworkInstrumentation, n as SPAN_TYPES, o as unrefTimer, p as SimulationPlan, r as experimentIdWireFields, s as callerTraceMetadata, t as HttpClient, v as replayContextReady, w as __version__, x as BitfabError, y as runWithReplayContext } from "./http-
|
|
3
|
-
import {
|
|
2
|
+
import { C as readEnv$1, S as MixedTracingError, _ as getReplayContext, b as gitRunner, c as recordCallerTraceMetadata, f as ROOT_TRACE_FUNCTION_KEY_FIELD, g as MAX_COMPRESSIBLE_SPAN_CARRIER_BYTES, h as makeSpanOrigin, i as flushTraces, l as retireTraceMetadata, m as isFrameworkInstrumentation, n as SPAN_TYPES, o as unrefTimer, p as SimulationPlan, r as experimentIdWireFields, s as callerTraceMetadata, t as HttpClient, v as replayContextReady, w as __version__, x as BitfabError, y as runWithReplayContext } from "./http-_cgR_DM2.js";
|
|
3
|
+
import { S as isAsyncStorageInitDone, _ as isCaptureSuppressed, b as asyncStorageReady, d as runWithAutoTraceEntry, f as runWithAutoTraceNodeConfiguration, g as writeOnce, h as warnOnce, l as invokeThroughAutoTraceEntries, o as clearAutoTraceNodeConfiguration, p as runWithAutoTraceRootContext, r as __bitfabAutoTraceActive, s as currentAutoTraceEntries, u as runAsAutoTraceRootFunction, v as runWithCaptureSuppressed, x as createAsyncLocalStorage } from "./autoTrace-CVt9EDyo.js";
|
|
4
4
|
import { r as importOptionalPeer, t as loadBamlModule } from "./bamlPeer-CIVwS68E.js";
|
|
5
5
|
import superjson from "superjson";
|
|
6
6
|
//#region src/categories.ts
|
|
@@ -1407,6 +1407,89 @@ var GradersClient = class {
|
|
|
1407
1407
|
}
|
|
1408
1408
|
};
|
|
1409
1409
|
//#endregion
|
|
1410
|
+
//#region src/jev.ts
|
|
1411
|
+
const JEV_PROVIDER = "typesafe";
|
|
1412
|
+
const JEV_WATCH_STORAGE_SYMBOL = Symbol.for("bitfab.jevWatchStorage");
|
|
1413
|
+
const repliesRecordedByAutoTrace = /* @__PURE__ */ new WeakSet();
|
|
1414
|
+
function isRecord$3(value) {
|
|
1415
|
+
return typeof value === "object" && value !== null;
|
|
1416
|
+
}
|
|
1417
|
+
function isJevReply(value) {
|
|
1418
|
+
return isRecord$3(value) && typeof value.model === "string" && isRecord$3(value.usage);
|
|
1419
|
+
}
|
|
1420
|
+
function tokenCount(usage, key) {
|
|
1421
|
+
const count = usage[key];
|
|
1422
|
+
return typeof count === "number" ? count : null;
|
|
1423
|
+
}
|
|
1424
|
+
function jevContext(reply, durationMs) {
|
|
1425
|
+
if (!isJevReply(reply)) return null;
|
|
1426
|
+
const context = {
|
|
1427
|
+
provider: JEV_PROVIDER,
|
|
1428
|
+
model: reply.model
|
|
1429
|
+
};
|
|
1430
|
+
const inputTokens = tokenCount(reply.usage, "input_tokens");
|
|
1431
|
+
const outputTokens = tokenCount(reply.usage, "output_tokens");
|
|
1432
|
+
if (inputTokens !== null) context.inputTokens = inputTokens;
|
|
1433
|
+
if (outputTokens !== null) context.outputTokens = outputTokens;
|
|
1434
|
+
context.durationMs = durationMs;
|
|
1435
|
+
return context;
|
|
1436
|
+
}
|
|
1437
|
+
function recordJevReply(span, reply, durationMs) {
|
|
1438
|
+
try {
|
|
1439
|
+
const context = jevContext(reply, durationMs);
|
|
1440
|
+
if (context) span.addContext(context);
|
|
1441
|
+
} catch {}
|
|
1442
|
+
}
|
|
1443
|
+
let jevWatchStorage = null;
|
|
1444
|
+
function watchStorage() {
|
|
1445
|
+
if (jevWatchStorage) return jevWatchStorage;
|
|
1446
|
+
const shared = globalThis;
|
|
1447
|
+
const existing = shared[JEV_WATCH_STORAGE_SYMBOL];
|
|
1448
|
+
jevWatchStorage = existing ?? createAsyncLocalStorage();
|
|
1449
|
+
if (jevWatchStorage && !existing) shared[JEV_WATCH_STORAGE_SYMBOL] = jevWatchStorage;
|
|
1450
|
+
return jevWatchStorage;
|
|
1451
|
+
}
|
|
1452
|
+
function watchJevUsage(fn) {
|
|
1453
|
+
const storage = watchStorage();
|
|
1454
|
+
const watch = {
|
|
1455
|
+
recorded: false,
|
|
1456
|
+
parent: storage?.getStore() ?? null
|
|
1457
|
+
};
|
|
1458
|
+
return {
|
|
1459
|
+
watch,
|
|
1460
|
+
result: storage ? storage.run(watch, fn) : fn()
|
|
1461
|
+
};
|
|
1462
|
+
}
|
|
1463
|
+
function markEnclosingWatches(watch) {
|
|
1464
|
+
for (let current = watch.parent; current; current = current.parent) current.recorded = true;
|
|
1465
|
+
}
|
|
1466
|
+
function recordWatchedJevReply(span, watch, reply, durationMs) {
|
|
1467
|
+
if (watch.recorded || isRecordedByAutoTrace(reply)) {
|
|
1468
|
+
markEnclosingWatches(watch);
|
|
1469
|
+
return;
|
|
1470
|
+
}
|
|
1471
|
+
if (!isJevReply(reply)) return;
|
|
1472
|
+
recordJevReply(span, reply, durationMs);
|
|
1473
|
+
repliesRecordedByAutoTrace.add(reply);
|
|
1474
|
+
markEnclosingWatches(watch);
|
|
1475
|
+
}
|
|
1476
|
+
function isRecordedByAutoTrace(reply) {
|
|
1477
|
+
return isRecord$3(reply) && repliesRecordedByAutoTrace.has(reply);
|
|
1478
|
+
}
|
|
1479
|
+
function recordAutoTracedJev(invokeFn, span) {
|
|
1480
|
+
const startedAt = Date.now();
|
|
1481
|
+
const { watch, result } = watchJevUsage(invokeFn);
|
|
1482
|
+
const settle = (reply) => {
|
|
1483
|
+
recordWatchedJevReply(span, watch, reply, Date.now() - startedAt);
|
|
1484
|
+
};
|
|
1485
|
+
if (result instanceof Promise) return result.then((reply) => {
|
|
1486
|
+
settle(reply);
|
|
1487
|
+
return reply;
|
|
1488
|
+
});
|
|
1489
|
+
settle(result);
|
|
1490
|
+
return result;
|
|
1491
|
+
}
|
|
1492
|
+
//#endregion
|
|
1410
1493
|
//#region src/langgraph.ts
|
|
1411
1494
|
const LANGSMITH_HIDDEN_TAG = "langsmith:hidden";
|
|
1412
1495
|
const CHAIN_RUN_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -4715,9 +4798,10 @@ function extractContextFromCollector(collector) {
|
|
|
4715
4798
|
}
|
|
4716
4799
|
const BOUND_FUNCTION_NAME_PREFIX = /^bound /;
|
|
4717
4800
|
function discoveredSpanType(definition, nodeConfiguration) {
|
|
4718
|
-
const
|
|
4801
|
+
const recordsModelCall = definition.baml === true || definition.jev === true;
|
|
4802
|
+
const ownType = recordsModelCall ? "llm" : "function";
|
|
4719
4803
|
if (nodeConfiguration === void 0) return ownType;
|
|
4720
|
-
if (
|
|
4804
|
+
if (recordsModelCall && nodeConfiguration.defaultType === true) return ownType;
|
|
4721
4805
|
return nodeConfiguration.type ?? ownType;
|
|
4722
4806
|
}
|
|
4723
4807
|
const collectorsRecordedByAutoTrace = /* @__PURE__ */ new WeakSet();
|
|
@@ -5115,7 +5199,7 @@ var Bitfab = class {
|
|
|
5115
5199
|
...nodeConfiguration?.finalize !== void 0 && { finalize: nodeConfiguration.finalize }
|
|
5116
5200
|
};
|
|
5117
5201
|
const isAsync = definition.async === true;
|
|
5118
|
-
return openChild(entry, childOptions, inputs, isAsync, definition.baml === true ? () => invokeAutoTracedBaml(invokeFn, isAsync) : invokeFn);
|
|
5202
|
+
return openChild(entry, childOptions, inputs, isAsync, definition.baml === true ? () => invokeAutoTracedBaml(invokeFn, isAsync) : definition.jev === true ? () => recordAutoTracedJev(invokeFn, getCurrentSpan()) : invokeFn);
|
|
5119
5203
|
},
|
|
5120
5204
|
invokeNestedRoot(nestedName, nestedFunctionName, inputs, invokeFn, entry, link, spanDetails) {
|
|
5121
5205
|
if (excluded.has(nestedName) || excluded.has(nestedFunctionName) || !recordsSpan(entry, nestedName, true)) return invokeFn();
|
|
@@ -5399,6 +5483,26 @@ var Bitfab = class {
|
|
|
5399
5483
|
});
|
|
5400
5484
|
return wrappedFn;
|
|
5401
5485
|
}
|
|
5486
|
+
wrapJev(method, options) {
|
|
5487
|
+
const methodName = method.name.replace(BOUND_FUNCTION_NAME_PREFIX, "");
|
|
5488
|
+
if (!methodName) throw new BitfabError("wrapJev requires a named function (e.g., jev.systemOne.bind(jev)).");
|
|
5489
|
+
const wrappedFn = async (...args) => {
|
|
5490
|
+
const span = getCurrentSpan();
|
|
5491
|
+
const startedAt = Date.now();
|
|
5492
|
+
const { watch, result } = watchJevUsage(() => method(...args));
|
|
5493
|
+
const reply = await result;
|
|
5494
|
+
recordWatchedJevReply(span, watch, reply, Date.now() - startedAt);
|
|
5495
|
+
try {
|
|
5496
|
+
options?.onReply?.(reply);
|
|
5497
|
+
} catch {}
|
|
5498
|
+
return reply;
|
|
5499
|
+
};
|
|
5500
|
+
Object.defineProperty(wrappedFn, "name", {
|
|
5501
|
+
configurable: true,
|
|
5502
|
+
value: methodName
|
|
5503
|
+
});
|
|
5504
|
+
return wrappedFn;
|
|
5505
|
+
}
|
|
5402
5506
|
withSpan(traceFunctionKey, optionsOrFn, maybeFn) {
|
|
5403
5507
|
this.simulationPlan.refresh();
|
|
5404
5508
|
const options = typeof optionsOrFn === "function" ? {} : optionsOrFn;
|
|
@@ -6035,7 +6139,7 @@ var Bitfab = class {
|
|
|
6035
6139
|
await runWithSeedContext({ traceId }, async () => target(...args));
|
|
6036
6140
|
} finally {
|
|
6037
6141
|
try {
|
|
6038
|
-
const { flushTraces } = await import("./http-
|
|
6142
|
+
const { flushTraces } = await import("./http-_cgR_DM2.js").then((n) => n.a);
|
|
6039
6143
|
await flushTraces(3e4);
|
|
6040
6144
|
} finally {
|
|
6041
6145
|
unrecorded = activeTraceStates.delete(traceId);
|
|
@@ -6121,6 +6225,9 @@ var BitfabFunction = class {
|
|
|
6121
6225
|
wrapBAML(methodOrClient, maybeMethodOrOptions, maybeOptions) {
|
|
6122
6226
|
return this.client.wrapBAML(methodOrClient, maybeMethodOrOptions, maybeOptions);
|
|
6123
6227
|
}
|
|
6228
|
+
wrapJev(method, options) {
|
|
6229
|
+
return this.client.wrapJev(method, options);
|
|
6230
|
+
}
|
|
6124
6231
|
};
|
|
6125
6232
|
//#endregion
|
|
6126
6233
|
//#region src/finalizers.ts
|
|
@@ -6223,7 +6330,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
|
|
|
6223
6330
|
metadata: seedCase.metadata,
|
|
6224
6331
|
sessionId: seedCase.sessionId
|
|
6225
6332
|
}));
|
|
6226
|
-
const { flushTraces } = await import("./http-
|
|
6333
|
+
const { flushTraces } = await import("./http-_cgR_DM2.js").then((n) => n.a);
|
|
6227
6334
|
await flushTraces(3e4);
|
|
6228
6335
|
return {
|
|
6229
6336
|
pipeline,
|
|
@@ -6240,4 +6347,4 @@ function resolveTraceFunctionKey(registration) {
|
|
|
6240
6347
|
//#endregion
|
|
6241
6348
|
export { ExperimentsClient as A, BitfabOpenAIAgentHandler as C, GradersClient as D, BitfabLangGraphCallbackHandler as E, BitfabClaudeAgentHandler as F, DEFAULT_SERVICE_URL as I, AssertionCategoriesClient as L, DatasetsClient as M, GraderRerunError as N, LabelsClient as O, GraderRerunTimeoutError as P, CategoriesClient as R, OrganizationMembersClient as S, BitfabLangGraphIntegration as T, BITFAB_PROGRESS_PREFIX as _, Bitfab as a, reportReplayProgress as b, getCurrentSpan as c, BitfabOpenAITracingProcessor as d, AssertionGenerationError as f, BitfabRivetIntegration as g, SpansClient as h, finalizers as i, SUPPORTED_PROVIDERS as j, VerdictsClient as k, getCurrentTrace as l, TracesClient as m, reseedFromRegistry as n, BitfabFunction as o, AssertionGenerationTimeoutError as p, seedFromRegistry as r, getCurrentReplayBranch as s, defineReplayRegistry as t, BitfabVercelAiHandler as u, DbBranchReplayError as v, NO_MOCK_OVERRIDE as w, serializeReplayResult as x, ReplayError as y };
|
|
6242
6349
|
|
|
6243
|
-
//# sourceMappingURL=src-
|
|
6350
|
+
//# sourceMappingURL=src-DyEKM7yn.js.map
|