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.
@@ -13,7 +13,7 @@ import {
13
13
  } from "./chunk-5E4BUIYA.js";
14
14
 
15
15
  // src/version.generated.ts
16
- var __version__ = "0.28.6";
16
+ var __version__ = "0.28.9";
17
17
 
18
18
  // src/constants.ts
19
19
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";
@@ -2641,6 +2641,8 @@ var noOpTrace = {
2641
2641
  setMetadata() {
2642
2642
  },
2643
2643
  addContext() {
2644
+ },
2645
+ drop() {
2644
2646
  }
2645
2647
  };
2646
2648
  function getCurrentSpan() {
@@ -2717,6 +2719,12 @@ function getCurrentTrace() {
2717
2719
  traceState.contexts.push(context);
2718
2720
  } catch {
2719
2721
  }
2722
+ },
2723
+ drop() {
2724
+ try {
2725
+ getOrCreateTraceState().dropped = true;
2726
+ } catch {
2727
+ }
2720
2728
  }
2721
2729
  };
2722
2730
  }
@@ -3261,13 +3269,16 @@ var Bitfab = class {
3261
3269
  }
3262
3270
  try {
3263
3271
  const endedAt = (/* @__PURE__ */ new Date()).toISOString();
3264
- const spanPromise = self.sendWrapperSpan({
3272
+ const traceDropped = activeTraceStates.get(traceId)?.dropped === true;
3273
+ const spanPromise = traceDropped ? Promise.resolve() : self.sendWrapperSpan({
3265
3274
  ...baseSpanParams,
3266
3275
  ...params,
3267
3276
  contexts: newContext.contexts,
3268
3277
  prompt: newContext.prompt,
3269
3278
  endedAt,
3270
- ...replayCtx?.testRunId && { testRunId: replayCtx.testRunId },
3279
+ ...replayCtx?.testRunId && {
3280
+ testRunId: replayCtx.testRunId
3281
+ },
3271
3282
  ...replayCtx?.inputSourceSpanId && {
3272
3283
  inputSourceSpanId: replayCtx.inputSourceSpanId
3273
3284
  }
@@ -3306,6 +3317,7 @@ var Bitfab = class {
3306
3317
  testRunId: traceState?.testRunId,
3307
3318
  inputSourceTraceId: traceState?.inputSourceTraceId,
3308
3319
  dbSnapshotRef: traceState?.dbSnapshotRef,
3320
+ dropped: traceState?.dropped,
3309
3321
  // Built AFTER the wrapped fn finished, so `accessed` reflects
3310
3322
  // whether customer code obtained the branch URL during this
3311
3323
  // item. Omitted entirely when no lease was attached, so the
@@ -3354,7 +3366,7 @@ var Bitfab = class {
3354
3366
  meta: mockSpan.outputMeta
3355
3367
  });
3356
3368
  }
3357
- void sendSpan({ result: output });
3369
+ void sendSpan({ result: output, mocked: true });
3358
3370
  if (fnReturnsPromise) {
3359
3371
  return Promise.resolve(output);
3360
3372
  }
@@ -3551,6 +3563,7 @@ var Bitfab = class {
3551
3563
  traceFunctionKey: params.traceFunctionKey,
3552
3564
  externalTrace: rawTrace,
3553
3565
  completed: true,
3566
+ ...params.dropped && { dropped: true },
3554
3567
  ...params.sessionId && { sessionId: params.sessionId },
3555
3568
  ...params.testRunId && { testRunId: params.testRunId }
3556
3569
  });
@@ -3605,7 +3618,8 @@ var Bitfab = class {
3605
3618
  sourceTraceId: params.traceId,
3606
3619
  traceFunctionKey: params.traceFunctionKey,
3607
3620
  rawSpan: externalSpan,
3608
- ...params.testRunId && { testRunId: params.testRunId }
3621
+ ...params.testRunId && { testRunId: params.testRunId },
3622
+ ...params.mocked && { mocked: true }
3609
3623
  });
3610
3624
  }
3611
3625
  /**
@@ -3867,4 +3881,4 @@ export {
3867
3881
  BitfabFunction,
3868
3882
  finalizers
3869
3883
  };
3870
- //# sourceMappingURL=chunk-P4YXY7J4.js.map
3884
+ //# sourceMappingURL=chunk-VQ4GMKQ7.js.map