bitfab 0.28.7 → 0.28.10
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/{chunk-TIMBGA3A.js → chunk-SK4TNXRC.js} +15 -7
- package/dist/chunk-SK4TNXRC.js.map +1 -0
- package/dist/index.cjs +14 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -7
- package/dist/index.d.ts +9 -7
- package/dist/index.js +1 -1
- package/dist/node.cjs +14 -6
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-TIMBGA3A.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1015,12 +1015,14 @@ interface CurrentTrace {
|
|
|
1015
1015
|
*/
|
|
1016
1016
|
addContext(context: Record<string, unknown>): void;
|
|
1017
1017
|
/**
|
|
1018
|
-
* Flag this trace to be dropped.
|
|
1019
|
-
*
|
|
1020
|
-
*
|
|
1021
|
-
*
|
|
1022
|
-
*
|
|
1023
|
-
*
|
|
1018
|
+
* Flag this trace to be dropped. Once flagged, spans that complete afterward
|
|
1019
|
+
* are not uploaded at all, and when the trace completes the server scrubs any
|
|
1020
|
+
* payloads that already raced out (trace, external trace, and sibling spans),
|
|
1021
|
+
* marking it `dropped` instead of `completed` and retaining only a skeleton
|
|
1022
|
+
* audit record. Use this to discard runs you never want stored (e.g. health
|
|
1023
|
+
* checks, or a run you know contains sensitive data). Takes effect
|
|
1024
|
+
* immediately for later spans; the server-side scrub takes effect at trace
|
|
1025
|
+
* completion, so a trace that is flagged but never completes is not scrubbed.
|
|
1024
1026
|
*/
|
|
1025
1027
|
drop(): void;
|
|
1026
1028
|
}
|
|
@@ -1612,7 +1614,7 @@ declare class BitfabFunction {
|
|
|
1612
1614
|
/**
|
|
1613
1615
|
* SDK version from package.json (injected at build time)
|
|
1614
1616
|
*/
|
|
1615
|
-
declare const __version__ = "0.28.
|
|
1617
|
+
declare const __version__ = "0.28.10";
|
|
1616
1618
|
|
|
1617
1619
|
/**
|
|
1618
1620
|
* Constants for the Bitfab SDK.
|
package/dist/index.d.ts
CHANGED
|
@@ -1015,12 +1015,14 @@ interface CurrentTrace {
|
|
|
1015
1015
|
*/
|
|
1016
1016
|
addContext(context: Record<string, unknown>): void;
|
|
1017
1017
|
/**
|
|
1018
|
-
* Flag this trace to be dropped.
|
|
1019
|
-
*
|
|
1020
|
-
*
|
|
1021
|
-
*
|
|
1022
|
-
*
|
|
1023
|
-
*
|
|
1018
|
+
* Flag this trace to be dropped. Once flagged, spans that complete afterward
|
|
1019
|
+
* are not uploaded at all, and when the trace completes the server scrubs any
|
|
1020
|
+
* payloads that already raced out (trace, external trace, and sibling spans),
|
|
1021
|
+
* marking it `dropped` instead of `completed` and retaining only a skeleton
|
|
1022
|
+
* audit record. Use this to discard runs you never want stored (e.g. health
|
|
1023
|
+
* checks, or a run you know contains sensitive data). Takes effect
|
|
1024
|
+
* immediately for later spans; the server-side scrub takes effect at trace
|
|
1025
|
+
* completion, so a trace that is flagged but never completes is not scrubbed.
|
|
1024
1026
|
*/
|
|
1025
1027
|
drop(): void;
|
|
1026
1028
|
}
|
|
@@ -1612,7 +1614,7 @@ declare class BitfabFunction {
|
|
|
1612
1614
|
/**
|
|
1613
1615
|
* SDK version from package.json (injected at build time)
|
|
1614
1616
|
*/
|
|
1615
|
-
declare const __version__ = "0.28.
|
|
1617
|
+
declare const __version__ = "0.28.10";
|
|
1616
1618
|
|
|
1617
1619
|
/**
|
|
1618
1620
|
* Constants for the Bitfab SDK.
|
package/dist/index.js
CHANGED
package/dist/node.cjs
CHANGED
|
@@ -706,7 +706,7 @@ registerAsyncLocalStorageClass(
|
|
|
706
706
|
);
|
|
707
707
|
|
|
708
708
|
// src/version.generated.ts
|
|
709
|
-
var __version__ = "0.28.
|
|
709
|
+
var __version__ = "0.28.10";
|
|
710
710
|
|
|
711
711
|
// src/constants.ts
|
|
712
712
|
var DEFAULT_SERVICE_URL = "https://bitfab.ai";
|
|
@@ -3152,8 +3152,11 @@ init_warnOnce();
|
|
|
3152
3152
|
var activeTraceStates = /* @__PURE__ */ new Map();
|
|
3153
3153
|
var pendingSpanPromises = /* @__PURE__ */ new Map();
|
|
3154
3154
|
var asyncLocalStorage = null;
|
|
3155
|
+
var initializeAsyncContext = () => {
|
|
3156
|
+
asyncLocalStorage ?? (asyncLocalStorage = createAsyncLocalStorage());
|
|
3157
|
+
};
|
|
3155
3158
|
var asyncLocalStorageReady = asyncStorageReady.then(() => {
|
|
3156
|
-
|
|
3159
|
+
initializeAsyncContext();
|
|
3157
3160
|
});
|
|
3158
3161
|
var browserSpanStack = [];
|
|
3159
3162
|
function getSpanStack() {
|
|
@@ -3922,6 +3925,7 @@ var Bitfab = class {
|
|
|
3922
3925
|
if (!self.isTracingEnabled()) {
|
|
3923
3926
|
return fn.apply(this, args);
|
|
3924
3927
|
}
|
|
3928
|
+
initializeAsyncContext();
|
|
3925
3929
|
if (!asyncLocalStorage && !isAsyncStorageInitDone()) {
|
|
3926
3930
|
return asyncLocalStorageReady.then(
|
|
3927
3931
|
() => wrappedFn.apply(this, args)
|
|
@@ -3985,13 +3989,16 @@ var Bitfab = class {
|
|
|
3985
3989
|
}
|
|
3986
3990
|
try {
|
|
3987
3991
|
const endedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
3988
|
-
const
|
|
3992
|
+
const traceDropped = activeTraceStates.get(traceId)?.dropped === true;
|
|
3993
|
+
const spanPromise = traceDropped ? Promise.resolve() : self.sendWrapperSpan({
|
|
3989
3994
|
...baseSpanParams,
|
|
3990
3995
|
...params,
|
|
3991
3996
|
contexts: newContext.contexts,
|
|
3992
3997
|
prompt: newContext.prompt,
|
|
3993
3998
|
endedAt,
|
|
3994
|
-
...replayCtx?.testRunId && {
|
|
3999
|
+
...replayCtx?.testRunId && {
|
|
4000
|
+
testRunId: replayCtx.testRunId
|
|
4001
|
+
},
|
|
3995
4002
|
...replayCtx?.inputSourceSpanId && {
|
|
3996
4003
|
inputSourceSpanId: replayCtx.inputSourceSpanId
|
|
3997
4004
|
}
|
|
@@ -4079,7 +4086,7 @@ var Bitfab = class {
|
|
|
4079
4086
|
meta: mockSpan.outputMeta
|
|
4080
4087
|
});
|
|
4081
4088
|
}
|
|
4082
|
-
void sendSpan({ result: output });
|
|
4089
|
+
void sendSpan({ result: output, mocked: true });
|
|
4083
4090
|
if (fnReturnsPromise) {
|
|
4084
4091
|
return Promise.resolve(output);
|
|
4085
4092
|
}
|
|
@@ -4331,7 +4338,8 @@ var Bitfab = class {
|
|
|
4331
4338
|
sourceTraceId: params.traceId,
|
|
4332
4339
|
traceFunctionKey: params.traceFunctionKey,
|
|
4333
4340
|
rawSpan: externalSpan,
|
|
4334
|
-
...params.testRunId && { testRunId: params.testRunId }
|
|
4341
|
+
...params.testRunId && { testRunId: params.testRunId },
|
|
4342
|
+
...params.mocked && { mocked: true }
|
|
4335
4343
|
});
|
|
4336
4344
|
}
|
|
4337
4345
|
/**
|