@bitfab/sdk 0.65.5 → 0.65.7
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-KM9pYqk9.cjs → autoTrace-CQw0qMBt.cjs} +3 -2
- package/dist/autoTrace-CQw0qMBt.cjs.map +1 -0
- package/dist/{autoTrace-CZu0BXhG.js → autoTrace-O40k8f5M.js} +3 -2
- package/dist/autoTrace-O40k8f5M.js.map +1 -0
- package/dist/autoTrace.cjs +1 -1
- package/dist/autoTrace.d.cts +6 -2
- package/dist/autoTrace.d.ts +6 -2
- package/dist/autoTrace.js +1 -1
- package/dist/{http-CG1Irqxx.js → http-BaLzqv9W.js} +16 -7
- package/dist/http-BaLzqv9W.js.map +1 -0
- package/dist/{index-BFkAwvuc.d.cts → index-qVS-HeqB.d.cts} +2 -1
- package/dist/{index-BFkAwvuc.d.ts → index-qVS-HeqB.d.ts} +2 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/node.cjs +2 -2
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +3 -3
- package/dist/registryCommand-Di8x0YoJ.js.map +1 -1
- package/dist/{src-CfFkki5l.js → src-BblbvWfU.js} +25 -15
- package/dist/{src-CfFkki5l.js.map → src-BblbvWfU.js.map} +1 -1
- package/dist/{src-BRKm0P_S.cjs → src-DgkDt32g.cjs} +36 -17
- package/dist/src-DgkDt32g.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/autoTrace-CZu0BXhG.js.map +0 -1
- package/dist/autoTrace-KM9pYqk9.cjs.map +0 -1
- package/dist/http-CG1Irqxx.js.map +0 -1
- package/dist/src-BRKm0P_S.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 { a as clearAutoTraceNodeConfiguration, b as isAsyncStorageInitDone, c as runAsAutoTraceRootFunction, d as runWithAutoTraceRootContext, g as runWithCaptureSuppressed, h as isCaptureSuppressed, l as runWithAutoTraceEntry, m as writeOnce, n as __bitfabAutoTraceActive, o as currentAutoTraceEntries, p as warnOnce, s as invokeThroughAutoTraceEntries, u as runWithAutoTraceNodeConfiguration, v as asyncStorageReady, y as createAsyncLocalStorage } from "./autoTrace-
|
|
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-BaLzqv9W.js";
|
|
3
|
+
import { a as clearAutoTraceNodeConfiguration, b as isAsyncStorageInitDone, c as runAsAutoTraceRootFunction, d as runWithAutoTraceRootContext, g as runWithCaptureSuppressed, h as isCaptureSuppressed, l as runWithAutoTraceEntry, m as writeOnce, n as __bitfabAutoTraceActive, o as currentAutoTraceEntries, p as warnOnce, s as invokeThroughAutoTraceEntries, u as runWithAutoTraceNodeConfiguration, v as asyncStorageReady, y as createAsyncLocalStorage } from "./autoTrace-O40k8f5M.js";
|
|
4
4
|
import superjson from "superjson";
|
|
5
5
|
//#region src/categories.ts
|
|
6
6
|
const CATEGORIES_PATH = "/api/sdk/categories";
|
|
@@ -4576,13 +4576,13 @@ function getCurrentSpan() {
|
|
|
4576
4576
|
addContext(context) {
|
|
4577
4577
|
try {
|
|
4578
4578
|
if (typeof context !== "object" || context === null) return;
|
|
4579
|
-
current.contexts.push(context);
|
|
4579
|
+
current.details.contexts.push(context);
|
|
4580
4580
|
} catch {}
|
|
4581
4581
|
},
|
|
4582
4582
|
setPrompt(prompt) {
|
|
4583
4583
|
try {
|
|
4584
4584
|
if (typeof prompt !== "string") return;
|
|
4585
|
-
current.prompt = prompt;
|
|
4585
|
+
current.details.prompt = prompt;
|
|
4586
4586
|
} catch {}
|
|
4587
4587
|
}
|
|
4588
4588
|
};
|
|
@@ -4709,7 +4709,10 @@ var Bitfab = class {
|
|
|
4709
4709
|
serviceUrl: this.serviceUrl,
|
|
4710
4710
|
timeout: this.timeout
|
|
4711
4711
|
});
|
|
4712
|
-
this.simulationPlan = new SimulationPlan(
|
|
4712
|
+
this.simulationPlan = new SimulationPlan({
|
|
4713
|
+
getSimulationPlan: () => this.httpClient.getSimulationPlan(),
|
|
4714
|
+
canRead: () => this.canReadSimulationPlan()
|
|
4715
|
+
}, config.simulationPlan ?? true);
|
|
4713
4716
|
this.httpClient.externalSpanTransform = (payload, submit, drop) => this.applySimulationPlan(payload, submit, drop);
|
|
4714
4717
|
this.httpClient.externalTraceTransform = (payload, submit) => this.simulationPlan.sendTrace(payload, submit);
|
|
4715
4718
|
this.httpClient.releaseHeldExternalSpans = (timeoutMs) => this.simulationPlan.release(timeoutMs);
|
|
@@ -4863,7 +4866,7 @@ var Bitfab = class {
|
|
|
4863
4866
|
};
|
|
4864
4867
|
const autoTraceContext = {
|
|
4865
4868
|
traceFunctionKey,
|
|
4866
|
-
invoke(definition, inputs, invokeFn, entry, nodeConfiguration) {
|
|
4869
|
+
invoke(definition, inputs, invokeFn, entry, spanDetails, nodeConfiguration) {
|
|
4867
4870
|
const nameParts = definition.name.split(".");
|
|
4868
4871
|
const simpleName = nameParts[nameParts.length - 1];
|
|
4869
4872
|
const invokeWithoutNode = () => nodeConfiguration === void 0 ? invokeFn() : clearAutoTraceNodeConfiguration(invokeFn);
|
|
@@ -4883,6 +4886,7 @@ var Bitfab = class {
|
|
|
4883
4886
|
functionId: definition.id,
|
|
4884
4887
|
captureContent: true,
|
|
4885
4888
|
autoTraceDefinition: definition,
|
|
4889
|
+
spanDetails,
|
|
4886
4890
|
...declaredNode && { declaredNode },
|
|
4887
4891
|
...nodeExperimentId !== void 0 && { experimentId: nodeExperimentId },
|
|
4888
4892
|
...mockOnReplay !== void 0 && { mockOnReplay },
|
|
@@ -4891,7 +4895,7 @@ var Bitfab = class {
|
|
|
4891
4895
|
};
|
|
4892
4896
|
return openChild(entry, childOptions, inputs, definition.async === true, invokeFn);
|
|
4893
4897
|
},
|
|
4894
|
-
invokeNestedRoot(nestedName, nestedFunctionName, inputs, invokeFn, entry, link) {
|
|
4898
|
+
invokeNestedRoot(nestedName, nestedFunctionName, inputs, invokeFn, entry, link, spanDetails) {
|
|
4895
4899
|
if (excluded.has(nestedName) || excluded.has(nestedFunctionName) || !recordsSpan(entry, nestedName, true)) return invokeFn();
|
|
4896
4900
|
const childOptions = {
|
|
4897
4901
|
name: nestedName,
|
|
@@ -4901,6 +4905,7 @@ var Bitfab = class {
|
|
|
4901
4905
|
instrumentation: "trace",
|
|
4902
4906
|
captureContent: true,
|
|
4903
4907
|
declaredNode: true,
|
|
4908
|
+
spanDetails,
|
|
4904
4909
|
...link !== void 0 && { nestedTrace: link }
|
|
4905
4910
|
};
|
|
4906
4911
|
return openChild(entry, childOptions, inputs, false, invokeFn);
|
|
@@ -4919,13 +4924,15 @@ var Bitfab = class {
|
|
|
4919
4924
|
}
|
|
4920
4925
|
const link = getReplayContext() || inSeedScope() ? void 0 : { traceFunctionKey };
|
|
4921
4926
|
const rootName = rootNameFor(this);
|
|
4922
|
-
|
|
4927
|
+
const spanDetails = { contexts: [] };
|
|
4928
|
+
return invokeThroughAutoTraceEntries(enclosing, (entry, next) => entry.context.invokeNestedRoot(rootName, name, args, next, entry, link, spanDetails), () => {
|
|
4923
4929
|
if (link === void 0) return runRootFunction(this, args);
|
|
4924
4930
|
const innermost = enclosing[enclosing.length - 1];
|
|
4925
4931
|
const innermostStack = (currentAutoTraceEntries().find((entry) => entry.context === innermost.context) ?? innermost).spanStack;
|
|
4926
4932
|
const copy = innermostStack[innermostStack.length - 1];
|
|
4927
4933
|
const detachedRoot = buildTracedRoot({
|
|
4928
4934
|
...rootOptions,
|
|
4935
|
+
spanDetails,
|
|
4929
4936
|
...copy !== void 0 && { enclosingTrace: {
|
|
4930
4937
|
traceId: copy.traceId,
|
|
4931
4938
|
spanId: copy.spanId,
|
|
@@ -4977,6 +4984,9 @@ var Bitfab = class {
|
|
|
4977
4984
|
if (!this.isCaptureConfigured() && !getReplayContext() && !inSeedScope()) return false;
|
|
4978
4985
|
return this.resolveApiKey() !== void 0;
|
|
4979
4986
|
}
|
|
4987
|
+
canReadSimulationPlan() {
|
|
4988
|
+
return ((this.captureConfiguredInCode ?? this.captureConfiguredFromEnv ?? readBooleanEnv(CAPTURE_ENABLED_ENV) ?? true) || getReplayContext() !== null || inSeedScope()) && this.findApiKey(true) !== void 0;
|
|
4989
|
+
}
|
|
4980
4990
|
prepareFrameworkIntegration() {
|
|
4981
4991
|
if (this.isCaptureConfigured() && this.strict) this.resolveApiKey();
|
|
4982
4992
|
}
|
|
@@ -5091,7 +5101,7 @@ var Bitfab = class {
|
|
|
5091
5101
|
if (!root) return;
|
|
5092
5102
|
const rootId = `${root.traceId}:${root.spanId}`;
|
|
5093
5103
|
if (recordedRoots.has(rootId)) return;
|
|
5094
|
-
root.contexts.push(context);
|
|
5104
|
+
root.details.contexts.push(context);
|
|
5095
5105
|
recordedRoots.add(rootId);
|
|
5096
5106
|
}
|
|
5097
5107
|
}, options);
|
|
@@ -5232,7 +5242,7 @@ var Bitfab = class {
|
|
|
5232
5242
|
const newContext = {
|
|
5233
5243
|
traceId,
|
|
5234
5244
|
spanId,
|
|
5235
|
-
contexts: [],
|
|
5245
|
+
details: options.spanDetails ?? { contexts: [] },
|
|
5236
5246
|
spanName: options.name ?? options.nameFor?.(this) ?? qualifiedSpanName(this, functionNameAtOpen) ?? traceFunctionKey,
|
|
5237
5247
|
rootTraceFunctionKey: rootTraceFunctionKeyOfTrace(traceId, traceFunctionKey),
|
|
5238
5248
|
instrumentation: options.instrumentation ?? "span",
|
|
@@ -5296,8 +5306,8 @@ var Bitfab = class {
|
|
|
5296
5306
|
if (!(activeTraceStates.get(traceId)?.dropped === true)) self.sendWrapperSpan({
|
|
5297
5307
|
...baseSpanParams,
|
|
5298
5308
|
...params,
|
|
5299
|
-
contexts: newContext.contexts,
|
|
5300
|
-
prompt: newContext.prompt,
|
|
5309
|
+
contexts: newContext.details.contexts,
|
|
5310
|
+
prompt: newContext.details.prompt,
|
|
5301
5311
|
endedAt,
|
|
5302
5312
|
...experimentId !== void 0 && { experimentId },
|
|
5303
5313
|
...replayCtx?.inputSourceSpanId && { inputSourceSpanId: replayCtx.inputSourceSpanId }
|
|
@@ -5803,7 +5813,7 @@ var Bitfab = class {
|
|
|
5803
5813
|
await runWithSeedContext({ traceId }, async () => target(...args));
|
|
5804
5814
|
} finally {
|
|
5805
5815
|
try {
|
|
5806
|
-
const { flushTraces } = await import("./http-
|
|
5816
|
+
const { flushTraces } = await import("./http-BaLzqv9W.js").then((n) => n.a);
|
|
5807
5817
|
await flushTraces(3e4);
|
|
5808
5818
|
} finally {
|
|
5809
5819
|
unrecorded = activeTraceStates.delete(traceId);
|
|
@@ -5991,7 +6001,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
|
|
|
5991
6001
|
metadata: seedCase.metadata,
|
|
5992
6002
|
sessionId: seedCase.sessionId
|
|
5993
6003
|
}));
|
|
5994
|
-
const { flushTraces } = await import("./http-
|
|
6004
|
+
const { flushTraces } = await import("./http-BaLzqv9W.js").then((n) => n.a);
|
|
5995
6005
|
await flushTraces(3e4);
|
|
5996
6006
|
return {
|
|
5997
6007
|
pipeline,
|
|
@@ -6008,4 +6018,4 @@ function resolveTraceFunctionKey(registration) {
|
|
|
6008
6018
|
//#endregion
|
|
6009
6019
|
export { SUPPORTED_PROVIDERS as A, BitfabOpenAIAgentHandler as C, LabelsClient as D, BitfabLangGraphCallbackHandler as E, DEFAULT_SERVICE_URL as F, AssertionCategoriesClient as I, CategoriesClient as L, GraderRerunError as M, GraderRerunTimeoutError as N, GradersClient as O, BitfabClaudeAgentHandler as P, 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, DatasetsClient as j, ExperimentsClient 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 };
|
|
6010
6020
|
|
|
6011
|
-
//# sourceMappingURL=src-
|
|
6021
|
+
//# sourceMappingURL=src-BblbvWfU.js.map
|