@bitfab/sdk 0.76.2 → 0.76.4
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-wadCG_ec.js → http-CQFVgQ4S.js} +2 -2
- package/dist/{http-wadCG_ec.js.map → http-CQFVgQ4S.js.map} +1 -1
- package/dist/{http-DscPFMlr.cjs → http-Dw6XzN7P.cjs} +3 -3
- package/dist/{http-DscPFMlr.cjs.map → http-Dw6XzN7P.cjs.map} +1 -1
- package/dist/{index-D5NpBqF3.d.cts → index-DCLbAcum.d.cts} +30 -62
- package/dist/{index-D5NpBqF3.d.ts → index-DCLbAcum.d.ts} +30 -62
- 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/{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 +2 -2
- package/dist/node.d.ts +2 -2
- package/dist/node.js +2 -2
- package/dist/registryCommand-M1u4H9PI.js.map +1 -1
- package/dist/{src-B6zSnPpb.cjs → src-C9V1wPM_.cjs} +30 -21
- package/dist/src-C9V1wPM_.cjs.map +1 -0
- package/dist/{src-CcYVtNMw.js → src-CFUOdE8n.js} +30 -21
- package/dist/{src-CcYVtNMw.js.map → src-CFUOdE8n.js.map} +1 -1
- 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/src-B6zSnPpb.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, 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-
|
|
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-CQFVgQ4S.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";
|
|
@@ -5067,7 +5067,6 @@ var SpansClient = class {
|
|
|
5067
5067
|
//#region src/traces.ts
|
|
5068
5068
|
const ASSERTIONS_PATH = "/api/sdk/traces/assertions";
|
|
5069
5069
|
const SEARCH_PATH = "/api/sdk/traces/search";
|
|
5070
|
-
const CODE_DRAFT_SAVE_TIMEOUT_MS = 3e5;
|
|
5071
5070
|
const DEFAULT_GENERATION_TIMEOUT_MS = 6e5;
|
|
5072
5071
|
const GENERATION_POLL_INTERVAL_MS = 2e3;
|
|
5073
5072
|
var AssertionGenerationError = class extends Error {
|
|
@@ -5117,9 +5116,6 @@ function toWireAssertion({ category_assertion_id, ...assertion }) {
|
|
|
5117
5116
|
category_id: categoryId
|
|
5118
5117
|
};
|
|
5119
5118
|
}
|
|
5120
|
-
function asksBitfabToWriteCode(assertion) {
|
|
5121
|
-
return (assertion.kind === "code" || assertion.kind === "hybrid") && assertion.code === void 0;
|
|
5122
|
-
}
|
|
5123
5119
|
function traceAssertionsPath(traceId, suffix = "") {
|
|
5124
5120
|
return `/api/sdk/traces/${encodeURIComponent(traceId)}/assertions${suffix}`;
|
|
5125
5121
|
}
|
|
@@ -5160,7 +5156,7 @@ var TracesClient = class {
|
|
|
5160
5156
|
source: params.source ?? "agent",
|
|
5161
5157
|
guidedRewrite: params.skipGuidedRewrite !== true
|
|
5162
5158
|
};
|
|
5163
|
-
return withCategoryIds((
|
|
5159
|
+
return withCategoryIds((await this.httpClient.request(ASSERTIONS_PATH, body)).assertions);
|
|
5164
5160
|
}
|
|
5165
5161
|
async generateAssertions(traceId, options = {}) {
|
|
5166
5162
|
const started = await this.httpClient.request(traceAssertionsPath(traceId, "/generate"), {
|
|
@@ -5712,12 +5708,18 @@ function wrapAsyncGenerator(source, spanStack, sendSpan, recordYielded) {
|
|
|
5712
5708
|
return wrapped;
|
|
5713
5709
|
}
|
|
5714
5710
|
let cachedCollectorClass;
|
|
5715
|
-
async function loadCollectorClass() {
|
|
5716
|
-
if (cachedCollectorClass !== void 0) return cachedCollectorClass;
|
|
5717
|
-
const baml = await loadBamlModule();
|
|
5711
|
+
async function loadCollectorClass(options) {
|
|
5712
|
+
if (cachedCollectorClass !== void 0 && (cachedCollectorClass === null || options?.clientRuntime === void 0)) return cachedCollectorClass;
|
|
5713
|
+
const baml = await loadBamlModule(options);
|
|
5718
5714
|
if (!baml) return null;
|
|
5719
|
-
|
|
5720
|
-
|
|
5715
|
+
const CollectorClass = baml.Collector;
|
|
5716
|
+
if (isSharedBamlModule(baml)) cachedCollectorClass = CollectorClass;
|
|
5717
|
+
return CollectorClass;
|
|
5718
|
+
}
|
|
5719
|
+
function bamlRuntimeOf(bamlClient) {
|
|
5720
|
+
if (typeof bamlClient !== "object" || bamlClient === null) return;
|
|
5721
|
+
const runtime = bamlClient.runtime;
|
|
5722
|
+
return typeof runtime === "object" && runtime !== null ? runtime : void 0;
|
|
5721
5723
|
}
|
|
5722
5724
|
function extractPromptFromCollector(collector) {
|
|
5723
5725
|
try {
|
|
@@ -5837,13 +5839,19 @@ function invokeBamlWithCollector(invokeFn, CollectorClass) {
|
|
|
5837
5839
|
settle();
|
|
5838
5840
|
return result;
|
|
5839
5841
|
}
|
|
5842
|
+
function warnIfAutoTracedBamlUntraced(CollectorClass) {
|
|
5843
|
+
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.`);
|
|
5844
|
+
}
|
|
5840
5845
|
function invokeAutoTracedBaml(invokeFn, isAsync) {
|
|
5841
5846
|
if (cachedCollectorClass) return invokeBamlWithCollector(invokeFn, cachedCollectorClass);
|
|
5842
5847
|
if (cachedCollectorClass === null || !isAsync) {
|
|
5843
|
-
loadCollectorClass();
|
|
5848
|
+
loadCollectorClass().then(warnIfAutoTracedBamlUntraced).catch(() => {});
|
|
5844
5849
|
return invokeFn();
|
|
5845
5850
|
}
|
|
5846
|
-
return loadCollectorClass().then((CollectorClass) =>
|
|
5851
|
+
return loadCollectorClass().then((CollectorClass) => {
|
|
5852
|
+
warnIfAutoTracedBamlUntraced(CollectorClass);
|
|
5853
|
+
return CollectorClass ? invokeBamlWithCollector(invokeFn, CollectorClass) : invokeFn();
|
|
5854
|
+
});
|
|
5847
5855
|
}
|
|
5848
5856
|
function isSpanType(value) {
|
|
5849
5857
|
return SPAN_TYPES.some((spanType) => spanType === value);
|
|
@@ -6118,7 +6126,7 @@ var Bitfab = class {
|
|
|
6118
6126
|
createAutoTraceRoot(traceFunctionKey, name, options, fn, rootFunctionName = "") {
|
|
6119
6127
|
const self = this;
|
|
6120
6128
|
self.simulationPlan.refresh();
|
|
6121
|
-
loadCollectorClass();
|
|
6129
|
+
loadCollectorClass({ searchLoadedModules: false });
|
|
6122
6130
|
installLangChainRunScopes();
|
|
6123
6131
|
const runRootFunction = (receiver, args) => runAsAutoTraceRootFunction(rootFunctionName, () => fn.apply(receiver, args));
|
|
6124
6132
|
const maxDepth = autoTraceLimit(options.maxDepth, DEFAULT_AUTO_TRACE_MAX_DEPTH);
|
|
@@ -6488,11 +6496,12 @@ var Bitfab = class {
|
|
|
6488
6496
|
}
|
|
6489
6497
|
const methodName = method.name;
|
|
6490
6498
|
if (!methodName) throw new BitfabError("wrapBAML requires a named function (e.g., b.ClassifyText).");
|
|
6491
|
-
|
|
6499
|
+
const collectorOptions = { clientRuntime: bamlRuntimeOf(bamlClient) };
|
|
6500
|
+
loadCollectorClass(collectorOptions);
|
|
6492
6501
|
const wrappedFn = async (...args) => {
|
|
6493
|
-
const CollectorClass = await loadCollectorClass();
|
|
6502
|
+
const CollectorClass = await loadCollectorClass(collectorOptions);
|
|
6494
6503
|
if (!CollectorClass) {
|
|
6495
|
-
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
|
|
6504
|
+
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.`);
|
|
6496
6505
|
wrappedFn.collector = null;
|
|
6497
6506
|
return await bamlClient[methodName](...args);
|
|
6498
6507
|
}
|
|
@@ -7228,7 +7237,7 @@ var Bitfab = class {
|
|
|
7228
7237
|
await runWithSeedContext({ traceId }, async () => target(...args));
|
|
7229
7238
|
} finally {
|
|
7230
7239
|
try {
|
|
7231
|
-
const { flushTraces } = await import("./http-
|
|
7240
|
+
const { flushTraces } = await import("./http-CQFVgQ4S.js").then((n) => n.a);
|
|
7232
7241
|
await flushTraces(3e4);
|
|
7233
7242
|
} finally {
|
|
7234
7243
|
unrecorded = activeTraceStates.delete(traceId);
|
|
@@ -7446,7 +7455,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
|
|
|
7446
7455
|
metadata: seedCase.metadata,
|
|
7447
7456
|
sessionId: seedCase.sessionId
|
|
7448
7457
|
}));
|
|
7449
|
-
const { flushTraces } = await import("./http-
|
|
7458
|
+
const { flushTraces } = await import("./http-CQFVgQ4S.js").then((n) => n.a);
|
|
7450
7459
|
await flushTraces(3e4);
|
|
7451
7460
|
return {
|
|
7452
7461
|
pipeline,
|
|
@@ -7463,4 +7472,4 @@ function resolveTraceFunctionKey(registration) {
|
|
|
7463
7472
|
//#endregion
|
|
7464
7473
|
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 };
|
|
7465
7474
|
|
|
7466
|
-
//# sourceMappingURL=src-
|
|
7475
|
+
//# sourceMappingURL=src-CFUOdE8n.js.map
|