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.cjs CHANGED
@@ -692,7 +692,7 @@ __export(index_exports, {
692
692
  module.exports = __toCommonJS(index_exports);
693
693
 
694
694
  // src/version.generated.ts
695
- var __version__ = "0.28.6";
695
+ var __version__ = "0.28.9";
696
696
 
697
697
  // src/constants.ts
698
698
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";
@@ -3343,6 +3343,8 @@ var noOpTrace = {
3343
3343
  setMetadata() {
3344
3344
  },
3345
3345
  addContext() {
3346
+ },
3347
+ drop() {
3346
3348
  }
3347
3349
  };
3348
3350
  function getCurrentSpan() {
@@ -3419,6 +3421,12 @@ function getCurrentTrace() {
3419
3421
  traceState.contexts.push(context);
3420
3422
  } catch {
3421
3423
  }
3424
+ },
3425
+ drop() {
3426
+ try {
3427
+ getOrCreateTraceState().dropped = true;
3428
+ } catch {
3429
+ }
3422
3430
  }
3423
3431
  };
3424
3432
  }
@@ -3963,13 +3971,16 @@ var Bitfab = class {
3963
3971
  }
3964
3972
  try {
3965
3973
  const endedAt = (/* @__PURE__ */ new Date()).toISOString();
3966
- const spanPromise = self.sendWrapperSpan({
3974
+ const traceDropped = activeTraceStates.get(traceId)?.dropped === true;
3975
+ const spanPromise = traceDropped ? Promise.resolve() : self.sendWrapperSpan({
3967
3976
  ...baseSpanParams,
3968
3977
  ...params,
3969
3978
  contexts: newContext.contexts,
3970
3979
  prompt: newContext.prompt,
3971
3980
  endedAt,
3972
- ...replayCtx?.testRunId && { testRunId: replayCtx.testRunId },
3981
+ ...replayCtx?.testRunId && {
3982
+ testRunId: replayCtx.testRunId
3983
+ },
3973
3984
  ...replayCtx?.inputSourceSpanId && {
3974
3985
  inputSourceSpanId: replayCtx.inputSourceSpanId
3975
3986
  }
@@ -4008,6 +4019,7 @@ var Bitfab = class {
4008
4019
  testRunId: traceState?.testRunId,
4009
4020
  inputSourceTraceId: traceState?.inputSourceTraceId,
4010
4021
  dbSnapshotRef: traceState?.dbSnapshotRef,
4022
+ dropped: traceState?.dropped,
4011
4023
  // Built AFTER the wrapped fn finished, so `accessed` reflects
4012
4024
  // whether customer code obtained the branch URL during this
4013
4025
  // item. Omitted entirely when no lease was attached, so the
@@ -4056,7 +4068,7 @@ var Bitfab = class {
4056
4068
  meta: mockSpan.outputMeta
4057
4069
  });
4058
4070
  }
4059
- void sendSpan({ result: output });
4071
+ void sendSpan({ result: output, mocked: true });
4060
4072
  if (fnReturnsPromise) {
4061
4073
  return Promise.resolve(output);
4062
4074
  }
@@ -4253,6 +4265,7 @@ var Bitfab = class {
4253
4265
  traceFunctionKey: params.traceFunctionKey,
4254
4266
  externalTrace: rawTrace,
4255
4267
  completed: true,
4268
+ ...params.dropped && { dropped: true },
4256
4269
  ...params.sessionId && { sessionId: params.sessionId },
4257
4270
  ...params.testRunId && { testRunId: params.testRunId }
4258
4271
  });
@@ -4307,7 +4320,8 @@ var Bitfab = class {
4307
4320
  sourceTraceId: params.traceId,
4308
4321
  traceFunctionKey: params.traceFunctionKey,
4309
4322
  rawSpan: externalSpan,
4310
- ...params.testRunId && { testRunId: params.testRunId }
4323
+ ...params.testRunId && { testRunId: params.testRunId },
4324
+ ...params.mocked && { mocked: true }
4311
4325
  });
4312
4326
  }
4313
4327
  /**