@bitfab/sdk 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
@@ -14,7 +14,7 @@ import {
14
14
  flushTraces,
15
15
  getCurrentSpan,
16
16
  getCurrentTrace
17
- } from "./chunk-P4YXY7J4.js";
17
+ } from "./chunk-VQ4GMKQ7.js";
18
18
  import {
19
19
  BITFAB_PROGRESS_PREFIX,
20
20
  BitfabError,
package/dist/node.cjs CHANGED
@@ -697,7 +697,7 @@ registerAsyncLocalStorageClass(
697
697
  );
698
698
 
699
699
  // src/version.generated.ts
700
- var __version__ = "0.28.6";
700
+ var __version__ = "0.28.9";
701
701
 
702
702
  // src/constants.ts
703
703
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";
@@ -3348,6 +3348,8 @@ var noOpTrace = {
3348
3348
  setMetadata() {
3349
3349
  },
3350
3350
  addContext() {
3351
+ },
3352
+ drop() {
3351
3353
  }
3352
3354
  };
3353
3355
  function getCurrentSpan() {
@@ -3424,6 +3426,12 @@ function getCurrentTrace() {
3424
3426
  traceState.contexts.push(context);
3425
3427
  } catch {
3426
3428
  }
3429
+ },
3430
+ drop() {
3431
+ try {
3432
+ getOrCreateTraceState().dropped = true;
3433
+ } catch {
3434
+ }
3427
3435
  }
3428
3436
  };
3429
3437
  }
@@ -3968,13 +3976,16 @@ var Bitfab = class {
3968
3976
  }
3969
3977
  try {
3970
3978
  const endedAt = (/* @__PURE__ */ new Date()).toISOString();
3971
- const spanPromise = self.sendWrapperSpan({
3979
+ const traceDropped = activeTraceStates.get(traceId)?.dropped === true;
3980
+ const spanPromise = traceDropped ? Promise.resolve() : self.sendWrapperSpan({
3972
3981
  ...baseSpanParams,
3973
3982
  ...params,
3974
3983
  contexts: newContext.contexts,
3975
3984
  prompt: newContext.prompt,
3976
3985
  endedAt,
3977
- ...replayCtx?.testRunId && { testRunId: replayCtx.testRunId },
3986
+ ...replayCtx?.testRunId && {
3987
+ testRunId: replayCtx.testRunId
3988
+ },
3978
3989
  ...replayCtx?.inputSourceSpanId && {
3979
3990
  inputSourceSpanId: replayCtx.inputSourceSpanId
3980
3991
  }
@@ -4013,6 +4024,7 @@ var Bitfab = class {
4013
4024
  testRunId: traceState?.testRunId,
4014
4025
  inputSourceTraceId: traceState?.inputSourceTraceId,
4015
4026
  dbSnapshotRef: traceState?.dbSnapshotRef,
4027
+ dropped: traceState?.dropped,
4016
4028
  // Built AFTER the wrapped fn finished, so `accessed` reflects
4017
4029
  // whether customer code obtained the branch URL during this
4018
4030
  // item. Omitted entirely when no lease was attached, so the
@@ -4061,7 +4073,7 @@ var Bitfab = class {
4061
4073
  meta: mockSpan.outputMeta
4062
4074
  });
4063
4075
  }
4064
- void sendSpan({ result: output });
4076
+ void sendSpan({ result: output, mocked: true });
4065
4077
  if (fnReturnsPromise) {
4066
4078
  return Promise.resolve(output);
4067
4079
  }
@@ -4258,6 +4270,7 @@ var Bitfab = class {
4258
4270
  traceFunctionKey: params.traceFunctionKey,
4259
4271
  externalTrace: rawTrace,
4260
4272
  completed: true,
4273
+ ...params.dropped && { dropped: true },
4261
4274
  ...params.sessionId && { sessionId: params.sessionId },
4262
4275
  ...params.testRunId && { testRunId: params.testRunId }
4263
4276
  });
@@ -4312,7 +4325,8 @@ var Bitfab = class {
4312
4325
  sourceTraceId: params.traceId,
4313
4326
  traceFunctionKey: params.traceFunctionKey,
4314
4327
  rawSpan: externalSpan,
4315
- ...params.testRunId && { testRunId: params.testRunId }
4328
+ ...params.testRunId && { testRunId: params.testRunId },
4329
+ ...params.mocked && { mocked: true }
4316
4330
  });
4317
4331
  }
4318
4332
  /**