@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.cjs CHANGED
@@ -683,7 +683,7 @@ __export(index_exports, {
683
683
  module.exports = __toCommonJS(index_exports);
684
684
 
685
685
  // src/version.generated.ts
686
- var __version__ = "0.28.6";
686
+ var __version__ = "0.28.9";
687
687
 
688
688
  // src/constants.ts
689
689
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";
@@ -3334,6 +3334,8 @@ var noOpTrace = {
3334
3334
  setMetadata() {
3335
3335
  },
3336
3336
  addContext() {
3337
+ },
3338
+ drop() {
3337
3339
  }
3338
3340
  };
3339
3341
  function getCurrentSpan() {
@@ -3410,6 +3412,12 @@ function getCurrentTrace() {
3410
3412
  traceState.contexts.push(context);
3411
3413
  } catch {
3412
3414
  }
3415
+ },
3416
+ drop() {
3417
+ try {
3418
+ getOrCreateTraceState().dropped = true;
3419
+ } catch {
3420
+ }
3413
3421
  }
3414
3422
  };
3415
3423
  }
@@ -3954,13 +3962,16 @@ var Bitfab = class {
3954
3962
  }
3955
3963
  try {
3956
3964
  const endedAt = (/* @__PURE__ */ new Date()).toISOString();
3957
- const spanPromise = self.sendWrapperSpan({
3965
+ const traceDropped = activeTraceStates.get(traceId)?.dropped === true;
3966
+ const spanPromise = traceDropped ? Promise.resolve() : self.sendWrapperSpan({
3958
3967
  ...baseSpanParams,
3959
3968
  ...params,
3960
3969
  contexts: newContext.contexts,
3961
3970
  prompt: newContext.prompt,
3962
3971
  endedAt,
3963
- ...replayCtx?.testRunId && { testRunId: replayCtx.testRunId },
3972
+ ...replayCtx?.testRunId && {
3973
+ testRunId: replayCtx.testRunId
3974
+ },
3964
3975
  ...replayCtx?.inputSourceSpanId && {
3965
3976
  inputSourceSpanId: replayCtx.inputSourceSpanId
3966
3977
  }
@@ -3999,6 +4010,7 @@ var Bitfab = class {
3999
4010
  testRunId: traceState?.testRunId,
4000
4011
  inputSourceTraceId: traceState?.inputSourceTraceId,
4001
4012
  dbSnapshotRef: traceState?.dbSnapshotRef,
4013
+ dropped: traceState?.dropped,
4002
4014
  // Built AFTER the wrapped fn finished, so `accessed` reflects
4003
4015
  // whether customer code obtained the branch URL during this
4004
4016
  // item. Omitted entirely when no lease was attached, so the
@@ -4047,7 +4059,7 @@ var Bitfab = class {
4047
4059
  meta: mockSpan.outputMeta
4048
4060
  });
4049
4061
  }
4050
- void sendSpan({ result: output });
4062
+ void sendSpan({ result: output, mocked: true });
4051
4063
  if (fnReturnsPromise) {
4052
4064
  return Promise.resolve(output);
4053
4065
  }
@@ -4244,6 +4256,7 @@ var Bitfab = class {
4244
4256
  traceFunctionKey: params.traceFunctionKey,
4245
4257
  externalTrace: rawTrace,
4246
4258
  completed: true,
4259
+ ...params.dropped && { dropped: true },
4247
4260
  ...params.sessionId && { sessionId: params.sessionId },
4248
4261
  ...params.testRunId && { testRunId: params.testRunId }
4249
4262
  });
@@ -4298,7 +4311,8 @@ var Bitfab = class {
4298
4311
  sourceTraceId: params.traceId,
4299
4312
  traceFunctionKey: params.traceFunctionKey,
4300
4313
  rawSpan: externalSpan,
4301
- ...params.testRunId && { testRunId: params.testRunId }
4314
+ ...params.testRunId && { testRunId: params.testRunId },
4315
+ ...params.mocked && { mocked: true }
4302
4316
  });
4303
4317
  }
4304
4318
  /**