@bitfab/sdk 0.36.13 → 0.38.0

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.
@@ -314,7 +314,7 @@ function encodeRequestBody(body) {
314
314
  }
315
315
 
316
316
  // src/version.generated.ts
317
- var __version__ = "0.36.13";
317
+ var __version__ = "0.38.0";
318
318
 
319
319
  // src/constants.ts
320
320
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";
@@ -2385,12 +2385,15 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
2385
2385
  let lease = includeDbBranchLease ? serverItem.dbBranchLease : void 0;
2386
2386
  let leaseError = includeDbBranchLease ? serverItem.dbBranchLeaseError : void 0;
2387
2387
  let dbSnapshotRef = serverItem.dbSnapshotRef;
2388
+ let dbBranchTimings = includeDbBranchLease ? serverItem.dbBranchTimings : void 0;
2388
2389
  let inputs = [];
2389
2390
  let originalOutput;
2390
2391
  let result;
2391
2392
  let error = null;
2392
2393
  let traceError = null;
2393
2394
  let replayError = null;
2395
+ let replayDurationMs = null;
2396
+ let replayStarted = null;
2394
2397
  const originalTraceId = serverItem.originalTraceId ?? serverItem.sourceTraceId;
2395
2398
  const originalSpanId = serverItem.originalSpanId ?? serverItem.sourceSpanId;
2396
2399
  try {
@@ -2413,6 +2416,7 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
2413
2416
  lease = resolved.lease ?? void 0;
2414
2417
  leaseError = resolved.leaseError ?? void 0;
2415
2418
  dbSnapshotRef = resolved.dbSnapshotRef ?? dbSnapshotRef;
2419
+ dbBranchTimings = resolved.timings ?? dbBranchTimings;
2416
2420
  }
2417
2421
  if (leaseError) {
2418
2422
  throw new DbBranchReplayError(
@@ -2473,6 +2477,7 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
2473
2477
  return pending;
2474
2478
  } : void 0;
2475
2479
  try {
2480
+ replayStarted = performance.now();
2476
2481
  const maybePromise = runWithReplayContext(
2477
2482
  {
2478
2483
  testRunId,
@@ -2485,16 +2490,24 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
2485
2490
  mockStrategy,
2486
2491
  mockOverrides: hasOverrides ? resolvedOverrides : void 0,
2487
2492
  fetchSpanOutput,
2488
- dbBranchLease: lease
2493
+ dbBranchLease: lease,
2494
+ dbBranchTimings
2489
2495
  },
2490
2496
  () => fn(...inputs)
2491
2497
  );
2492
2498
  result = maybePromise instanceof Promise ? await maybePromise : maybePromise;
2499
+ replayDurationMs = Math.round(performance.now() - replayStarted);
2493
2500
  } catch (e) {
2501
+ if (replayStarted !== null) {
2502
+ replayDurationMs = Math.round(performance.now() - replayStarted);
2503
+ }
2494
2504
  traceError = e;
2495
2505
  error = errorMessage(e);
2496
2506
  }
2497
2507
  } catch (e) {
2508
+ if (replayStarted !== null) {
2509
+ replayDurationMs = Math.round(performance.now() - replayStarted);
2510
+ }
2498
2511
  replayError = e;
2499
2512
  error = replayItemErrorMessage(e);
2500
2513
  } finally {
@@ -2511,6 +2524,8 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
2511
2524
  }
2512
2525
  }
2513
2526
  }
2527
+ const originalDurationMs = serverItem.originalDurationMs ?? serverItem.durationMs ?? null;
2528
+ const originalModel = serverItem.originalModel ?? serverItem.model ?? null;
2514
2529
  return {
2515
2530
  // Written in by replay() from the complete-replay response once the server
2516
2531
  // has minted this replay trace's row. Null until then: the client-side
@@ -2527,13 +2542,17 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
2527
2542
  error,
2528
2543
  traceError,
2529
2544
  replayError,
2530
- durationMs: serverItem.durationMs ?? null,
2545
+ durationMs: replayDurationMs,
2546
+ originalDurationMs,
2547
+ originalTokens: serverItem.originalTokens ?? serverItem.tokens ?? null,
2548
+ originalModel,
2531
2549
  // Filled in by replay() from the complete-replay response once the
2532
2550
  // replay traces are persisted and their spans aggregated server-side.
2533
2551
  // Null here (and on older servers) means "replay tokens not known".
2534
2552
  tokens: null,
2535
- model: serverItem.model ?? null,
2536
- dbSnapshotRef: dbSnapshotRef ?? null
2553
+ model: originalModel,
2554
+ dbSnapshotRef: dbSnapshotRef ?? null,
2555
+ dbBranchTimings: dbBranchTimings ?? null
2537
2556
  };
2538
2557
  }
2539
2558
  async function waitForReplayPersistence(httpClient, testRunId, replayedTraceIds) {
@@ -2760,9 +2779,13 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
2760
2779
  traceError: item.traceError,
2761
2780
  replayError: item.replayError,
2762
2781
  durationMs: item.durationMs,
2782
+ originalDurationMs: item.originalDurationMs,
2783
+ originalTokens: item.originalTokens,
2784
+ originalModel: item.originalModel,
2763
2785
  tokens: item.tokens,
2764
2786
  model: item.model,
2765
- dbSnapshotRef: item.dbSnapshotRef
2787
+ dbSnapshotRef: item.dbSnapshotRef,
2788
+ dbBranchTimings: item.dbBranchTimings
2766
2789
  }
2767
2790
  });
2768
2791
  } catch {
@@ -2930,4 +2953,4 @@ export {
2930
2953
  sleepForReplayPersistence,
2931
2954
  replay
2932
2955
  };
2933
- //# sourceMappingURL=chunk-VOUV7ZTS.js.map
2956
+ //# sourceMappingURL=chunk-SSNTMROV.js.map