@bitfab/sdk 0.76.1 → 0.76.3
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/{babelPlugin-BpEeVvk4.cjs → babelPlugin-C4ERQ8DW.cjs} +118 -69
- package/dist/babelPlugin-C4ERQ8DW.cjs.map +1 -0
- package/dist/{babelPlugin-PgjdBuQe.js → babelPlugin-tupc_WZS.js} +50 -1
- package/dist/babelPlugin-tupc_WZS.js.map +1 -0
- package/dist/baml.cjs +1 -1
- package/dist/baml.js +1 -1
- package/dist/bamlPeer-BxJO7-pm.cjs +169 -0
- package/dist/bamlPeer-BxJO7-pm.cjs.map +1 -0
- package/dist/bamlPeer-CWPgBSlJ.js +109 -0
- package/dist/bamlPeer-CWPgBSlJ.js.map +1 -0
- package/dist/{http-ykHGNcju.cjs → http-7exfDbAK.cjs} +68 -3
- package/dist/{http-DS1QjBvx.js.map → http-7exfDbAK.cjs.map} +1 -1
- package/dist/{http-DS1QjBvx.js → http-BA7vmvuC.js} +56 -3
- package/dist/http-BA7vmvuC.js.map +1 -0
- package/dist/{index-BYv4DSsY.d.cts → index-CmO7Xmwl.d.cts} +1 -1
- package/dist/{index-BYv4DSsY.d.ts → index-CmO7Xmwl.d.ts} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/{loaderRuntime-0huddOOP.d.ts → loaderRuntime-AETv8Pt4.d.ts} +1 -1
- package/dist/{loaderRuntime-CslfDFO7.d.cts → loaderRuntime-BGUu666e.d.cts} +1 -1
- package/dist/node.cjs +2 -2
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +2 -2
- package/dist/{registryCommand-D1VgfJjC.js → registryCommand-M1u4H9PI.js} +30 -14
- package/dist/registryCommand-M1u4H9PI.js.map +1 -0
- package/dist/replayCli.js +1 -1
- package/dist/seedCli.js +1 -1
- package/dist/{src-CLkegn-P.cjs → src-BMMKf1sR.cjs} +35 -34
- package/dist/src-BMMKf1sR.cjs.map +1 -0
- package/dist/{src-BJjbR3Nq.js → src-CYs1uXoX.js} +35 -34
- package/dist/src-CYs1uXoX.js.map +1 -0
- package/dist/transform/babel.cjs +1 -1
- package/dist/transform/babel.d.cts +1 -1
- package/dist/transform/babel.d.ts +1 -1
- package/dist/transform/babel.js +1 -1
- package/dist/transform/bun.d.cts +1 -1
- package/dist/transform/bun.d.ts +1 -1
- package/dist/transform/esbuild.d.cts +1 -1
- package/dist/transform/esbuild.d.ts +1 -1
- package/dist/transform/loaderRuntime.cjs +3 -3
- package/dist/transform/loaderRuntime.d.cts +1 -1
- package/dist/transform/loaderRuntime.d.ts +1 -1
- package/dist/transform/loaderRuntime.js +3 -3
- package/dist/transform/nest.d.cts +1 -1
- package/dist/transform/nest.d.ts +1 -1
- package/dist/transform/next.d.cts +1 -1
- package/dist/transform/next.d.ts +1 -1
- package/dist/transform/nodeLoader.js +56 -2
- package/dist/transform/nodeLoader.js.map +1 -1
- package/dist/transform/rolldown.d.cts +1 -1
- package/dist/transform/rolldown.d.ts +1 -1
- package/dist/transform/rollup.d.cts +1 -1
- package/dist/transform/rollup.d.ts +1 -1
- package/dist/transform/rsbuild.d.cts +1 -1
- package/dist/transform/rsbuild.d.ts +1 -1
- package/dist/transform/rspack.d.cts +1 -1
- package/dist/transform/rspack.d.ts +1 -1
- package/dist/transform/swc.cjs +1 -1
- package/dist/transform/swc.d.cts +1 -1
- package/dist/transform/swc.d.ts +1 -1
- package/dist/transform/swc.js +1 -1
- package/dist/transform/unplugin.cjs +2 -2
- package/dist/transform/unplugin.d.cts +1 -1
- package/dist/transform/unplugin.d.ts +1 -1
- package/dist/transform/unplugin.js +2 -2
- package/dist/transform/vite.d.cts +1 -1
- package/dist/transform/vite.d.ts +1 -1
- package/dist/transform/webpack.d.cts +1 -1
- package/dist/transform/webpack.d.ts +1 -1
- package/dist/{transform-Cdg7CSbP.cjs → transform-CcNCVr8A.cjs} +2 -2
- package/dist/{transform-Cdg7CSbP.cjs.map → transform-CcNCVr8A.cjs.map} +1 -1
- package/dist/{transform-BhazCKOg.js → transform-mb6EwHsJ.js} +2 -2
- package/dist/{transform-BhazCKOg.js.map → transform-mb6EwHsJ.js.map} +1 -1
- package/dist/{transformOptions-BsjCELkh.d.cts → transformOptions-uNuIpBAA.d.cts} +2 -0
- package/dist/{transformOptions-BsjCELkh.d.ts → transformOptions-uNuIpBAA.d.ts} +2 -0
- package/package.json +1 -1
- package/dist/babelPlugin-BpEeVvk4.cjs.map +0 -1
- package/dist/babelPlugin-PgjdBuQe.js.map +0 -1
- package/dist/bamlPeer-5Ohpq8q9.cjs +0 -74
- package/dist/bamlPeer-5Ohpq8q9.cjs.map +0 -1
- package/dist/bamlPeer-Dyeb3e5o.js +0 -20
- package/dist/bamlPeer-Dyeb3e5o.js.map +0 -1
- package/dist/http-ykHGNcju.cjs.map +0 -1
- package/dist/registryCommand-D1VgfJjC.js.map +0 -1
- package/dist/src-BJjbR3Nq.js.map +0 -1
- package/dist/src-CLkegn-P.cjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import { C as BitfabError, E as __version__, S as gitRunner, T as
|
|
2
|
+
import { C as BitfabError, D as readEnv$1, E as serializeError, O as __version__, S as gitRunner, T as describeError, _ as MAX_SPAN_CARRIER_BYTES, b as replayContextReady, 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 byteLength, w as MixedTracingError, x as runWithReplayContext, y as getReplayContext } from "./http-BA7vmvuC.js";
|
|
3
3
|
import { A as recordWatchedClientCall, B as installLangChainRunScopes, C as OPENAI_RESPONSES, D as clientCallStreams, E as clientCallProvider, F as mapOpenAiAgentsTrace, G as isCaptureSuppressed, I as openAiAgentsParentSpanId, J as asyncStorageReady, K as runWithCaptureSuppressed, L as openAiAgentsSpanChain, M as watchClientCall, N as StreamFinalizationError, O as frameworkRecordsClientCall, P as endOpenAiAgentsSpan, R as unmapOpenAiAgentsTrace, S as OPENAI_EMBEDDINGS, T as OPENROUTER, U as warnOnce, V as markLangChainRunRecorded, W as writeOnce, X as isAsyncStorageInitDone, Y as createAsyncLocalStorage, _ as runWithAutoTraceNodeConfiguration, b as GEMINI, d as currentAutoTraceEntries, g as runWithAutoTraceFramesAt, h as runWithAutoTraceEntry, j as sharedClientCallStreamRecording, k as recordAutoTracedClientCall, m as runAsAutoTraceRootFunction, p as invokeThroughAutoTraceEntries, s as __bitfabAutoTraceActive, u as clearAutoTraceNodeConfiguration, v as runWithAutoTraceRootContext, w as OPENAI_TRANSCRIPTIONS, x as OPENAI_CHAT, y as ANTHROPIC, z as forgetLangChainRun } from "./autoTrace-BgN0zCQf.js";
|
|
4
4
|
import { t as importOptionalPeer } from "./optionalPeer-CczrzrXx.js";
|
|
5
|
-
import {
|
|
5
|
+
import { n as loadBamlModule, t as isSharedBamlModule } from "./bamlPeer-CWPgBSlJ.js";
|
|
6
6
|
import superjson from "superjson";
|
|
7
7
|
//#region src/categories.ts
|
|
8
8
|
const CATEGORIES_PATH = "/api/sdk/categories";
|
|
@@ -4022,22 +4022,10 @@ function errorMessage(error) {
|
|
|
4022
4022
|
}
|
|
4023
4023
|
function replayItemErrorMessage(error) {
|
|
4024
4024
|
if (error instanceof DbBranchReplayError) return `Replay requested a database branch for trace ${error.originalTraceId} but it could not be resolved (${error.code}): ${error.message}. The function was not run, because replaying it against the live database would produce a result that looks valid but did not use the historical data you asked for.`;
|
|
4025
|
-
return
|
|
4025
|
+
return describeError(error);
|
|
4026
4026
|
}
|
|
4027
4027
|
function replayJsonReplacer(_key, value) {
|
|
4028
|
-
if (value instanceof Error) {
|
|
4029
|
-
const serialized = {
|
|
4030
|
-
name: value.name,
|
|
4031
|
-
message: value.message,
|
|
4032
|
-
stack: value.stack
|
|
4033
|
-
};
|
|
4034
|
-
if (value instanceof DbBranchReplayError) {
|
|
4035
|
-
serialized.code = value.code;
|
|
4036
|
-
serialized.originalTraceId = value.originalTraceId;
|
|
4037
|
-
if (value.cause !== void 0) serialized.cause = value.cause;
|
|
4038
|
-
}
|
|
4039
|
-
return serialized;
|
|
4040
|
-
}
|
|
4028
|
+
if (value instanceof Error) return serializeError(value, (error) => error instanceof DbBranchReplayError ? { originalTraceId: error.originalTraceId } : {});
|
|
4041
4029
|
return value;
|
|
4042
4030
|
}
|
|
4043
4031
|
function serializeReplayResult(result) {
|
|
@@ -4216,7 +4204,7 @@ async function processItem(httpClient, serverItem, fn, experimentId, mockStrateg
|
|
|
4216
4204
|
} catch (e) {
|
|
4217
4205
|
if (replayStarted !== null) replayDurationMs = Math.round(performance.now() - replayStarted);
|
|
4218
4206
|
traceError = e;
|
|
4219
|
-
error =
|
|
4207
|
+
error = describeError(e);
|
|
4220
4208
|
}
|
|
4221
4209
|
} catch (e) {
|
|
4222
4210
|
if (replayStarted !== null) replayDurationMs = Math.round(performance.now() - replayStarted);
|
|
@@ -5700,7 +5688,7 @@ function wrapAsyncGenerator(source, spanStack, sendSpan, recordYielded) {
|
|
|
5700
5688
|
} else yielded.push(result.value);
|
|
5701
5689
|
return result;
|
|
5702
5690
|
} catch (error) {
|
|
5703
|
-
finalize(
|
|
5691
|
+
finalize(describeError(error));
|
|
5704
5692
|
throw error;
|
|
5705
5693
|
}
|
|
5706
5694
|
};
|
|
@@ -5724,12 +5712,18 @@ function wrapAsyncGenerator(source, spanStack, sendSpan, recordYielded) {
|
|
|
5724
5712
|
return wrapped;
|
|
5725
5713
|
}
|
|
5726
5714
|
let cachedCollectorClass;
|
|
5727
|
-
async function loadCollectorClass() {
|
|
5728
|
-
if (cachedCollectorClass !== void 0) return cachedCollectorClass;
|
|
5729
|
-
const baml = await loadBamlModule();
|
|
5715
|
+
async function loadCollectorClass(options) {
|
|
5716
|
+
if (cachedCollectorClass !== void 0 && (cachedCollectorClass === null || options?.clientRuntime === void 0)) return cachedCollectorClass;
|
|
5717
|
+
const baml = await loadBamlModule(options);
|
|
5730
5718
|
if (!baml) return null;
|
|
5731
|
-
|
|
5732
|
-
|
|
5719
|
+
const CollectorClass = baml.Collector;
|
|
5720
|
+
if (isSharedBamlModule(baml)) cachedCollectorClass = CollectorClass;
|
|
5721
|
+
return CollectorClass;
|
|
5722
|
+
}
|
|
5723
|
+
function bamlRuntimeOf(bamlClient) {
|
|
5724
|
+
if (typeof bamlClient !== "object" || bamlClient === null) return;
|
|
5725
|
+
const runtime = bamlClient.runtime;
|
|
5726
|
+
return typeof runtime === "object" && runtime !== null ? runtime : void 0;
|
|
5733
5727
|
}
|
|
5734
5728
|
function extractPromptFromCollector(collector) {
|
|
5735
5729
|
try {
|
|
@@ -5849,13 +5843,19 @@ function invokeBamlWithCollector(invokeFn, CollectorClass) {
|
|
|
5849
5843
|
settle();
|
|
5850
5844
|
return result;
|
|
5851
5845
|
}
|
|
5846
|
+
function warnIfAutoTracedBamlUntraced(CollectorClass) {
|
|
5847
|
+
if (!CollectorClass) warnOnce("autoTrace-baml-collector-unavailable", `@boundaryml/baml could not be loaded, so BAML calls under a trace root are recorded without their prompt, model, or token usage. If @boundaryml/baml is installed but your bundler hides it, add \`import "@bitfab/sdk/baml"\` once in your server code.`);
|
|
5848
|
+
}
|
|
5852
5849
|
function invokeAutoTracedBaml(invokeFn, isAsync) {
|
|
5853
5850
|
if (cachedCollectorClass) return invokeBamlWithCollector(invokeFn, cachedCollectorClass);
|
|
5854
5851
|
if (cachedCollectorClass === null || !isAsync) {
|
|
5855
|
-
loadCollectorClass();
|
|
5852
|
+
loadCollectorClass().then(warnIfAutoTracedBamlUntraced).catch(() => {});
|
|
5856
5853
|
return invokeFn();
|
|
5857
5854
|
}
|
|
5858
|
-
return loadCollectorClass().then((CollectorClass) =>
|
|
5855
|
+
return loadCollectorClass().then((CollectorClass) => {
|
|
5856
|
+
warnIfAutoTracedBamlUntraced(CollectorClass);
|
|
5857
|
+
return CollectorClass ? invokeBamlWithCollector(invokeFn, CollectorClass) : invokeFn();
|
|
5858
|
+
});
|
|
5859
5859
|
}
|
|
5860
5860
|
function isSpanType(value) {
|
|
5861
5861
|
return SPAN_TYPES.some((spanType) => spanType === value);
|
|
@@ -6130,7 +6130,7 @@ var Bitfab = class {
|
|
|
6130
6130
|
createAutoTraceRoot(traceFunctionKey, name, options, fn, rootFunctionName = "") {
|
|
6131
6131
|
const self = this;
|
|
6132
6132
|
self.simulationPlan.refresh();
|
|
6133
|
-
loadCollectorClass();
|
|
6133
|
+
loadCollectorClass({ searchLoadedModules: false });
|
|
6134
6134
|
installLangChainRunScopes();
|
|
6135
6135
|
const runRootFunction = (receiver, args) => runAsAutoTraceRootFunction(rootFunctionName, () => fn.apply(receiver, args));
|
|
6136
6136
|
const maxDepth = autoTraceLimit(options.maxDepth, DEFAULT_AUTO_TRACE_MAX_DEPTH);
|
|
@@ -6500,11 +6500,12 @@ var Bitfab = class {
|
|
|
6500
6500
|
}
|
|
6501
6501
|
const methodName = method.name;
|
|
6502
6502
|
if (!methodName) throw new BitfabError("wrapBAML requires a named function (e.g., b.ClassifyText).");
|
|
6503
|
-
|
|
6503
|
+
const collectorOptions = { clientRuntime: bamlRuntimeOf(bamlClient) };
|
|
6504
|
+
loadCollectorClass(collectorOptions);
|
|
6504
6505
|
const wrappedFn = async (...args) => {
|
|
6505
|
-
const CollectorClass = await loadCollectorClass();
|
|
6506
|
+
const CollectorClass = await loadCollectorClass(collectorOptions);
|
|
6506
6507
|
if (!CollectorClass) {
|
|
6507
|
-
warnOnce("wrapBAML-collector-unavailable", `@boundaryml/baml could not be loaded, so "${methodName}" and every other wrapBAML call run untraced: no prompt, model, or token usage is recorded and onCollector is not called. If @boundaryml/baml is installed
|
|
6508
|
+
warnOnce("wrapBAML-collector-unavailable", `@boundaryml/baml could not be loaded, so "${methodName}" and every other wrapBAML call run untraced: no prompt, model, or token usage is recorded and onCollector is not called. If @boundaryml/baml is installed but your bundler hides it, add \`import "@bitfab/sdk/baml"\` once in your server code.`);
|
|
6508
6509
|
wrappedFn.collector = null;
|
|
6509
6510
|
return await bamlClient[methodName](...args);
|
|
6510
6511
|
}
|
|
@@ -6796,7 +6797,7 @@ var Bitfab = class {
|
|
|
6796
6797
|
} catch (error) {
|
|
6797
6798
|
sendSpan({
|
|
6798
6799
|
result: void 0,
|
|
6799
|
-
error:
|
|
6800
|
+
error: describeError(error)
|
|
6800
6801
|
});
|
|
6801
6802
|
throw error;
|
|
6802
6803
|
}
|
|
@@ -6806,7 +6807,7 @@ var Bitfab = class {
|
|
|
6806
6807
|
}).catch((error) => {
|
|
6807
6808
|
sendSpan({
|
|
6808
6809
|
result: void 0,
|
|
6809
|
-
error:
|
|
6810
|
+
error: describeError(error)
|
|
6810
6811
|
});
|
|
6811
6812
|
throw error;
|
|
6812
6813
|
});
|
|
@@ -7240,7 +7241,7 @@ var Bitfab = class {
|
|
|
7240
7241
|
await runWithSeedContext({ traceId }, async () => target(...args));
|
|
7241
7242
|
} finally {
|
|
7242
7243
|
try {
|
|
7243
|
-
const { flushTraces } = await import("./http-
|
|
7244
|
+
const { flushTraces } = await import("./http-BA7vmvuC.js").then((n) => n.a);
|
|
7244
7245
|
await flushTraces(3e4);
|
|
7245
7246
|
} finally {
|
|
7246
7247
|
unrecorded = activeTraceStates.delete(traceId);
|
|
@@ -7458,7 +7459,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
|
|
|
7458
7459
|
metadata: seedCase.metadata,
|
|
7459
7460
|
sessionId: seedCase.sessionId
|
|
7460
7461
|
}));
|
|
7461
|
-
const { flushTraces } = await import("./http-
|
|
7462
|
+
const { flushTraces } = await import("./http-BA7vmvuC.js").then((n) => n.a);
|
|
7462
7463
|
await flushTraces(3e4);
|
|
7463
7464
|
return {
|
|
7464
7465
|
pipeline,
|
|
@@ -7475,4 +7476,4 @@ function resolveTraceFunctionKey(registration) {
|
|
|
7475
7476
|
//#endregion
|
|
7476
7477
|
export { VerdictsClient as A, OrganizationMembersClient as C, BitfabLangGraphCallbackHandler as D, BitfabLangGraphIntegration as E, GraderRerunTimeoutError as F, BitfabClaudeAgentHandler as I, DEFAULT_SERVICE_URL as L, SUPPORTED_PROVIDERS as M, DatasetsClient as N, GradersClient as O, GraderRerunError as P, AssertionCategoriesClient as R, BitfabPiIntegration as S, NO_MOCK_OVERRIDE 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, ExperimentsClient as j, LabelsClient 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, BitfabOpenAIAgentHandler as w, serializeReplayResult as x, ReplayError as y, CategoriesClient as z };
|
|
7477
7478
|
|
|
7478
|
-
//# sourceMappingURL=src-
|
|
7479
|
+
//# sourceMappingURL=src-CYs1uXoX.js.map
|