bitfab 0.68.0 → 0.68.1
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-BikML0lX.cjs → autoTrace-D3-OZcmR.cjs} +196 -17
- package/dist/autoTrace-D3-OZcmR.cjs.map +1 -0
- package/dist/{autoTrace-CVt9EDyo.js → autoTrace-ghnojSj9.js} +173 -18
- package/dist/autoTrace-ghnojSj9.js.map +1 -0
- package/dist/autoTrace.cjs +2 -1
- package/dist/autoTrace.d.cts +15 -0
- package/dist/autoTrace.d.ts +15 -0
- package/dist/autoTrace.js +1 -1
- package/dist/{babelPlugin-s8EFjT6e.cjs → babelPlugin-0uOq-j1Q.cjs} +48 -18
- package/dist/babelPlugin-0uOq-j1Q.cjs.map +1 -0
- package/dist/{babelPlugin-a7ofCoOd.js → babelPlugin-Muq0uuuu.js} +48 -18
- package/dist/babelPlugin-Muq0uuuu.js.map +1 -0
- package/dist/{http-_cgR_DM2.js → http-f8Rl8oRa.js} +3 -3
- package/dist/{http-_cgR_DM2.js.map → http-f8Rl8oRa.js.map} +1 -1
- package/dist/{http-psFF1ptn.cjs → http-r1r6injY.cjs} +3 -3
- package/dist/{http-psFF1ptn.cjs.map → http-r1r6injY.cjs.map} +1 -1
- package/dist/{index-j7SrvOqe.d.cts → index-BQV7zzJx.d.cts} +56 -2
- package/dist/{index-j7SrvOqe.d.ts → index-BQV7zzJx.d.ts} +56 -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-Dze8o7iU.cjs → src-BYXxPnpE.cjs} +30 -7
- package/dist/src-BYXxPnpE.cjs.map +1 -0
- package/dist/{src-DyEKM7yn.js → src-Cps3Xs_J.js} +30 -7
- package/dist/{src-DyEKM7yn.js.map → src-Cps3Xs_J.js.map} +1 -1
- package/dist/transform/babel.cjs +1 -1
- package/dist/transform/babel.d.cts +9 -2
- package/dist/transform/babel.d.ts +9 -2
- 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 +47 -17
- 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-DkcFn_tg.js → transform-CAJyLLe2.js} +2 -2
- package/dist/{transform-DkcFn_tg.js.map → transform-CAJyLLe2.js.map} +1 -1
- package/dist/{transform-BBzrqpVH.cjs → transform-ClCOpCZ2.cjs} +2 -2
- package/dist/{transform-BBzrqpVH.cjs.map → transform-ClCOpCZ2.cjs.map} +1 -1
- package/package.json +2 -1
- package/dist/autoTrace-BikML0lX.cjs.map +0 -1
- package/dist/autoTrace-CVt9EDyo.js.map +0 -1
- package/dist/babelPlugin-a7ofCoOd.js.map +0 -1
- package/dist/babelPlugin-s8EFjT6e.cjs.map +0 -1
- package/dist/src-Dze8o7iU.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-f8Rl8oRa.js";
|
|
3
|
+
import { E as isAsyncStorageInitDone, S as runWithCaptureSuppressed, T as createAsyncLocalStorage, _ as watchOpenRouterUsage, b as writeOnce, c as currentAutoTraceEntries, d as runAsAutoTraceRootFunction, f as runWithAutoTraceEntry, g as recordWatchedOpenRouterCompletion, h as recordAutoTracedOpenRouter, i as __bitfabAutoTraceActive, m as runWithAutoTraceRootContext, p as runWithAutoTraceNodeConfiguration, s as clearAutoTraceNodeConfiguration, u as invokeThroughAutoTraceEntries, w as asyncStorageReady, x as isCaptureSuppressed, y as warnOnce } from "./autoTrace-ghnojSj9.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
|
|
@@ -4798,7 +4798,7 @@ function extractContextFromCollector(collector) {
|
|
|
4798
4798
|
}
|
|
4799
4799
|
const BOUND_FUNCTION_NAME_PREFIX = /^bound /;
|
|
4800
4800
|
function discoveredSpanType(definition, nodeConfiguration) {
|
|
4801
|
-
const recordsModelCall = definition.baml === true || definition.jev === true;
|
|
4801
|
+
const recordsModelCall = definition.baml === true || definition.jev === true || definition.openrouter === true;
|
|
4802
4802
|
const ownType = recordsModelCall ? "llm" : "function";
|
|
4803
4803
|
if (nodeConfiguration === void 0) return ownType;
|
|
4804
4804
|
if (recordsModelCall && nodeConfiguration.defaultType === true) return ownType;
|
|
@@ -5199,7 +5199,7 @@ var Bitfab = class {
|
|
|
5199
5199
|
...nodeConfiguration?.finalize !== void 0 && { finalize: nodeConfiguration.finalize }
|
|
5200
5200
|
};
|
|
5201
5201
|
const isAsync = definition.async === true;
|
|
5202
|
-
return openChild(entry, childOptions, inputs, isAsync, definition.baml === true ? () => invokeAutoTracedBaml(invokeFn, isAsync) : definition.jev === true ? () => recordAutoTracedJev(invokeFn, getCurrentSpan()) : invokeFn);
|
|
5202
|
+
return openChild(entry, childOptions, inputs, isAsync, definition.baml === true ? () => invokeAutoTracedBaml(invokeFn, isAsync) : definition.jev === true ? () => recordAutoTracedJev(invokeFn, getCurrentSpan()) : definition.openrouter === true ? () => recordAutoTracedOpenRouter(invokeFn, inputs[0], getCurrentSpan()) : invokeFn);
|
|
5203
5203
|
},
|
|
5204
5204
|
invokeNestedRoot(nestedName, nestedFunctionName, inputs, invokeFn, entry, link, spanDetails) {
|
|
5205
5205
|
if (excluded.has(nestedName) || excluded.has(nestedFunctionName) || !recordsSpan(entry, nestedName, true)) return invokeFn();
|
|
@@ -5503,6 +5503,26 @@ var Bitfab = class {
|
|
|
5503
5503
|
});
|
|
5504
5504
|
return wrappedFn;
|
|
5505
5505
|
}
|
|
5506
|
+
wrapOpenRouter(method, options) {
|
|
5507
|
+
const methodName = method.name.replace(BOUND_FUNCTION_NAME_PREFIX, "");
|
|
5508
|
+
if (!methodName) throw new BitfabError("wrapOpenRouter requires a named function (e.g., openai.chat.completions.create.bind(openai.chat.completions)).");
|
|
5509
|
+
const wrappedFn = async (...args) => {
|
|
5510
|
+
const span = getCurrentSpan();
|
|
5511
|
+
const startedAt = Date.now();
|
|
5512
|
+
const { watch, result } = watchOpenRouterUsage(() => method(...args));
|
|
5513
|
+
const response = await result;
|
|
5514
|
+
recordWatchedOpenRouterCompletion(span, watch, args[0], response, Date.now() - startedAt);
|
|
5515
|
+
try {
|
|
5516
|
+
options?.onResponse?.(response);
|
|
5517
|
+
} catch {}
|
|
5518
|
+
return response;
|
|
5519
|
+
};
|
|
5520
|
+
Object.defineProperty(wrappedFn, "name", {
|
|
5521
|
+
configurable: true,
|
|
5522
|
+
value: methodName
|
|
5523
|
+
});
|
|
5524
|
+
return wrappedFn;
|
|
5525
|
+
}
|
|
5506
5526
|
withSpan(traceFunctionKey, optionsOrFn, maybeFn) {
|
|
5507
5527
|
this.simulationPlan.refresh();
|
|
5508
5528
|
const options = typeof optionsOrFn === "function" ? {} : optionsOrFn;
|
|
@@ -6139,7 +6159,7 @@ var Bitfab = class {
|
|
|
6139
6159
|
await runWithSeedContext({ traceId }, async () => target(...args));
|
|
6140
6160
|
} finally {
|
|
6141
6161
|
try {
|
|
6142
|
-
const { flushTraces } = await import("./http-
|
|
6162
|
+
const { flushTraces } = await import("./http-f8Rl8oRa.js").then((n) => n.a);
|
|
6143
6163
|
await flushTraces(3e4);
|
|
6144
6164
|
} finally {
|
|
6145
6165
|
unrecorded = activeTraceStates.delete(traceId);
|
|
@@ -6228,6 +6248,9 @@ var BitfabFunction = class {
|
|
|
6228
6248
|
wrapJev(method, options) {
|
|
6229
6249
|
return this.client.wrapJev(method, options);
|
|
6230
6250
|
}
|
|
6251
|
+
wrapOpenRouter(method, options) {
|
|
6252
|
+
return this.client.wrapOpenRouter(method, options);
|
|
6253
|
+
}
|
|
6231
6254
|
};
|
|
6232
6255
|
//#endregion
|
|
6233
6256
|
//#region src/finalizers.ts
|
|
@@ -6330,7 +6353,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
|
|
|
6330
6353
|
metadata: seedCase.metadata,
|
|
6331
6354
|
sessionId: seedCase.sessionId
|
|
6332
6355
|
}));
|
|
6333
|
-
const { flushTraces } = await import("./http-
|
|
6356
|
+
const { flushTraces } = await import("./http-f8Rl8oRa.js").then((n) => n.a);
|
|
6334
6357
|
await flushTraces(3e4);
|
|
6335
6358
|
return {
|
|
6336
6359
|
pipeline,
|
|
@@ -6347,4 +6370,4 @@ function resolveTraceFunctionKey(registration) {
|
|
|
6347
6370
|
//#endregion
|
|
6348
6371
|
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 };
|
|
6349
6372
|
|
|
6350
|
-
//# sourceMappingURL=src-
|
|
6373
|
+
//# sourceMappingURL=src-Cps3Xs_J.js.map
|