bitfab 0.28.6 → 0.28.9

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/index.d.cts CHANGED
@@ -1014,6 +1014,17 @@ interface CurrentTrace {
1014
1014
  * Context entries are stored in rawData.contexts as [{key, value}, ...].
1015
1015
  */
1016
1016
  addContext(context: Record<string, unknown>): void;
1017
+ /**
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.
1026
+ */
1027
+ drop(): void;
1017
1028
  }
1018
1029
  /**
1019
1030
  * Get a handle to the current active span.
@@ -1603,7 +1614,7 @@ declare class BitfabFunction {
1603
1614
  /**
1604
1615
  * SDK version from package.json (injected at build time)
1605
1616
  */
1606
- declare const __version__ = "0.28.6";
1617
+ declare const __version__ = "0.28.9";
1607
1618
 
1608
1619
  /**
1609
1620
  * Constants for the Bitfab SDK.
package/dist/index.d.ts CHANGED
@@ -1014,6 +1014,17 @@ interface CurrentTrace {
1014
1014
  * Context entries are stored in rawData.contexts as [{key, value}, ...].
1015
1015
  */
1016
1016
  addContext(context: Record<string, unknown>): void;
1017
+ /**
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.
1026
+ */
1027
+ drop(): void;
1017
1028
  }
1018
1029
  /**
1019
1030
  * Get a handle to the current active span.
@@ -1603,7 +1614,7 @@ declare class BitfabFunction {
1603
1614
  /**
1604
1615
  * SDK version from package.json (injected at build time)
1605
1616
  */
1606
- declare const __version__ = "0.28.6";
1617
+ declare const __version__ = "0.28.9";
1607
1618
 
1608
1619
  /**
1609
1620
  * Constants for the Bitfab SDK.
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  flushTraces,
24
24
  getCurrentSpan,
25
25
  getCurrentTrace
26
- } from "./chunk-P4YXY7J4.js";
26
+ } from "./chunk-VQ4GMKQ7.js";
27
27
  import {
28
28
  BITFAB_PROGRESS_PREFIX,
29
29
  BitfabError,
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.6";
709
+ var __version__ = "0.28.9";
710
710
 
711
711
  // src/constants.ts
712
712
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";
@@ -3357,6 +3357,8 @@ var noOpTrace = {
3357
3357
  setMetadata() {
3358
3358
  },
3359
3359
  addContext() {
3360
+ },
3361
+ drop() {
3360
3362
  }
3361
3363
  };
3362
3364
  function getCurrentSpan() {
@@ -3433,6 +3435,12 @@ function getCurrentTrace() {
3433
3435
  traceState.contexts.push(context);
3434
3436
  } catch {
3435
3437
  }
3438
+ },
3439
+ drop() {
3440
+ try {
3441
+ getOrCreateTraceState().dropped = true;
3442
+ } catch {
3443
+ }
3436
3444
  }
3437
3445
  };
3438
3446
  }
@@ -3977,13 +3985,16 @@ var Bitfab = class {
3977
3985
  }
3978
3986
  try {
3979
3987
  const endedAt = (/* @__PURE__ */ new Date()).toISOString();
3980
- const spanPromise = self.sendWrapperSpan({
3988
+ const traceDropped = activeTraceStates.get(traceId)?.dropped === true;
3989
+ const spanPromise = traceDropped ? Promise.resolve() : self.sendWrapperSpan({
3981
3990
  ...baseSpanParams,
3982
3991
  ...params,
3983
3992
  contexts: newContext.contexts,
3984
3993
  prompt: newContext.prompt,
3985
3994
  endedAt,
3986
- ...replayCtx?.testRunId && { testRunId: replayCtx.testRunId },
3995
+ ...replayCtx?.testRunId && {
3996
+ testRunId: replayCtx.testRunId
3997
+ },
3987
3998
  ...replayCtx?.inputSourceSpanId && {
3988
3999
  inputSourceSpanId: replayCtx.inputSourceSpanId
3989
4000
  }
@@ -4022,6 +4033,7 @@ var Bitfab = class {
4022
4033
  testRunId: traceState?.testRunId,
4023
4034
  inputSourceTraceId: traceState?.inputSourceTraceId,
4024
4035
  dbSnapshotRef: traceState?.dbSnapshotRef,
4036
+ dropped: traceState?.dropped,
4025
4037
  // Built AFTER the wrapped fn finished, so `accessed` reflects
4026
4038
  // whether customer code obtained the branch URL during this
4027
4039
  // item. Omitted entirely when no lease was attached, so the
@@ -4070,7 +4082,7 @@ var Bitfab = class {
4070
4082
  meta: mockSpan.outputMeta
4071
4083
  });
4072
4084
  }
4073
- void sendSpan({ result: output });
4085
+ void sendSpan({ result: output, mocked: true });
4074
4086
  if (fnReturnsPromise) {
4075
4087
  return Promise.resolve(output);
4076
4088
  }
@@ -4267,6 +4279,7 @@ var Bitfab = class {
4267
4279
  traceFunctionKey: params.traceFunctionKey,
4268
4280
  externalTrace: rawTrace,
4269
4281
  completed: true,
4282
+ ...params.dropped && { dropped: true },
4270
4283
  ...params.sessionId && { sessionId: params.sessionId },
4271
4284
  ...params.testRunId && { testRunId: params.testRunId }
4272
4285
  });
@@ -4321,7 +4334,8 @@ var Bitfab = class {
4321
4334
  sourceTraceId: params.traceId,
4322
4335
  traceFunctionKey: params.traceFunctionKey,
4323
4336
  rawSpan: externalSpan,
4324
- ...params.testRunId && { testRunId: params.testRunId }
4337
+ ...params.testRunId && { testRunId: params.testRunId },
4338
+ ...params.mocked && { mocked: true }
4325
4339
  });
4326
4340
  }
4327
4341
  /**