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
|
const require_bamlPeer = require("./bamlPeer-BUoZgNxZ.cjs");
|
|
2
|
-
const require_http = require("./http-
|
|
3
|
-
const require_autoTrace = require("./autoTrace-
|
|
2
|
+
const require_http = require("./http-r1r6injY.cjs");
|
|
3
|
+
const require_autoTrace = require("./autoTrace-D3-OZcmR.cjs");
|
|
4
4
|
let superjson = require("superjson");
|
|
5
5
|
superjson = require_bamlPeer.__toESM(superjson, 1);
|
|
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 ? () => require_autoTrace.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 require_http.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 } = require_autoTrace.watchOpenRouterUsage(() => method(...args));
|
|
5513
|
+
const response = await result;
|
|
5514
|
+
require_autoTrace.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 Promise.resolve().then(() => require("./http-
|
|
6162
|
+
const { flushTraces } = await Promise.resolve().then(() => require("./http-r1r6injY.cjs")).then((n) => n.http_exports);
|
|
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 Promise.resolve().then(() => require("./http-
|
|
6356
|
+
const { flushTraces } = await Promise.resolve().then(() => require("./http-r1r6injY.cjs")).then((n) => n.http_exports);
|
|
6334
6357
|
await flushTraces(3e4);
|
|
6335
6358
|
return {
|
|
6336
6359
|
pipeline,
|
|
@@ -6574,4 +6597,4 @@ Object.defineProperty(exports, "serializeReplayResult", {
|
|
|
6574
6597
|
}
|
|
6575
6598
|
});
|
|
6576
6599
|
|
|
6577
|
-
//# sourceMappingURL=src-
|
|
6600
|
+
//# sourceMappingURL=src-BYXxPnpE.cjs.map
|