bitfab 0.29.0 → 0.30.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.
package/dist/index.d.cts CHANGED
@@ -749,6 +749,15 @@ interface ReplayOptions {
749
749
  * reconstructed. Validated server-side against the org.
750
750
  */
751
751
  datasetId?: string;
752
+ /**
753
+ * Graders to attach directly to this experiment (test run), independent of any
754
+ * graders already on the dataset. The resulting experiment is graded by the
755
+ * union of these and the dataset's runnable graders at completion, so use this
756
+ * to grade a single run with a check you don't want to add to the dataset
757
+ * permanently. Each id must be an active/live grader belonging to the same
758
+ * organization and trace function, otherwise the server rejects the replay.
759
+ */
760
+ graderIds?: string[];
752
761
  /**
753
762
  * Reshape recorded inputs before they are spread into `fn`.
754
763
  *
@@ -785,6 +794,21 @@ interface ReplayOptions {
785
794
  }
786
795
  /** Running totals reported to {@link ReplayOptions.onProgress} as replay proceeds. */
787
796
  interface ReplayProgress {
797
+ /**
798
+ * Event kind. Omitted (or `"item"`) for the per-trace settle events streamed
799
+ * during the run. `"complete"` marks the single terminal event emitted once
800
+ * the run has settled and been enriched server-side; it carries the full
801
+ * {@link ReplayProgress.result} and has no `item`. The Bitfab plugin reads
802
+ * that terminal event to build the run's final result without parsing stdout.
803
+ */
804
+ type?: "item" | "complete";
805
+ /**
806
+ * The full {@link ReplayResult}, present only on the terminal `"complete"`
807
+ * event. Lets the plugin ingest the enriched result (server-aggregated tokens,
808
+ * server trace ids) over the same channel as progress, so a dependency logging
809
+ * to stdout can never block it.
810
+ */
811
+ result?: ReplayResult<unknown>;
788
812
  /** Test run ID created for this replay. */
789
813
  testRunId?: string;
790
814
  /** Items that have finished so far, whether they succeeded or errored. */
@@ -796,18 +820,25 @@ interface ReplayProgress {
796
820
  /** Of the completed items, how many threw (their `item.error` is set). */
797
821
  errored: number;
798
822
  /**
799
- * The single item that just settled to produce this event. `traceId` is the
800
- * source (historical) trace that was replayed (so a UI can identify or link
801
- * it); `error` is its replay error, or null when it ran ok; `durationMs` is how
802
- * long this one trace took to replay. Lets a progress UI show per-trace
803
- * pass/fail and timing as the run streams, without waiting for the full
804
- * {@link ReplayResult}.
823
+ * The single item that just settled to produce this event. `traceId` is null
824
+ * at this stage (the server replay id isn't known until the run completes);
825
+ * `originalTraceId` is the original (historical) trace that was replayed (so
826
+ * a UI can identify or link it); `error` is its replay error, or null when it
827
+ * ran ok; `durationMs` is how long this one trace took to replay. Lets a
828
+ * progress UI show per-trace pass/fail and timing as the run streams, without
829
+ * waiting for the full {@link ReplayResult}.
805
830
  */
806
831
  item?: {
807
- /** Source (historical) trace ID being replayed. */
808
- traceId: string | null;
809
- /** Local SDK replay trace ID, before the server maps it to a row ID. */
810
- replayTraceId?: string | null;
832
+ /** Trace ID of the new replay trace (null during the run; the server id arrives at completion). */
833
+ traceId?: string | null;
834
+ /** Bitfab trace ID of the original (historical) trace being replayed. */
835
+ originalTraceId: string | null;
836
+ /** External span ID the recorded inputs were read from (the original root span). */
837
+ originalSpanId?: string | null;
838
+ /** @deprecated alias for `originalTraceId`. */
839
+ sourceTraceId: string | null;
840
+ /** @deprecated alias for `originalSpanId`. */
841
+ sourceSpanId?: string | null;
811
842
  /** Deserialized inputs from the original trace. */
812
843
  input?: unknown[];
813
844
  /** The result returned by the replayed function, or undefined on error. */
@@ -847,9 +878,13 @@ declare const BITFAB_PROGRESS_PREFIX = "@@bitfab:progress ";
847
878
  declare function reportReplayProgress(progress: ReplayProgress): void;
848
879
  /** Per-trace context passed to {@link ReplayOptions.adaptInputs}. */
849
880
  interface AdaptContext {
850
- /** Bitfab trace ID of the historical trace being replayed. */
851
- traceId: string;
881
+ /** Bitfab trace ID of the original (historical) trace being replayed. */
882
+ originalTraceId: string;
852
883
  /** External span ID the recorded inputs were read from. */
884
+ originalSpanId: string;
885
+ /** @deprecated alias for {@link AdaptContext.originalTraceId}. */
886
+ sourceTraceId: string;
887
+ /** @deprecated alias for {@link AdaptContext.originalSpanId}. */
853
888
  sourceSpanId: string;
854
889
  }
855
890
  /**
@@ -865,8 +900,23 @@ interface AdaptContext {
865
900
  */
866
901
  type AdaptInputsFn = (inputs: unknown[], ctx: AdaptContext) => unknown[];
867
902
  interface ReplayItem<T> {
868
- /** Trace ID of the new trace created during replay. */
903
+ /**
904
+ * Server trace ID of the new replay trace this item produced. Written in by
905
+ * `replay()` from the complete-replay response once the server has minted the
906
+ * trace row; the client-side id used to correlate spans during the run is
907
+ * never surfaced here. Null until completion, on older servers that omit the
908
+ * mapping, or if the item produced no trace. Not the verdict-persistence key:
909
+ * that is the original-trace lineage (`originalTraceId` + `testRunId`).
910
+ */
869
911
  traceId: string | null;
912
+ /** Bitfab trace ID of the original (historical) trace being replayed. */
913
+ originalTraceId: string;
914
+ /** External span ID the recorded inputs were read from (the original root span). */
915
+ originalSpanId: string;
916
+ /** @deprecated alias for {@link ReplayItem.originalTraceId}. */
917
+ sourceTraceId: string;
918
+ /** @deprecated alias for {@link ReplayItem.originalSpanId}. */
919
+ sourceSpanId: string;
870
920
  /** Deserialized inputs from the original trace. */
871
921
  input: unknown[];
872
922
  /** The result returned by the function during replay, or undefined on error. */
@@ -1758,7 +1808,7 @@ declare class BitfabFunction {
1758
1808
  /**
1759
1809
  * SDK version from package.json (injected at build time)
1760
1810
  */
1761
- declare const __version__ = "0.29.0";
1811
+ declare const __version__ = "0.30.0";
1762
1812
 
1763
1813
  /**
1764
1814
  * Constants for the Bitfab SDK.
package/dist/index.d.ts CHANGED
@@ -749,6 +749,15 @@ interface ReplayOptions {
749
749
  * reconstructed. Validated server-side against the org.
750
750
  */
751
751
  datasetId?: string;
752
+ /**
753
+ * Graders to attach directly to this experiment (test run), independent of any
754
+ * graders already on the dataset. The resulting experiment is graded by the
755
+ * union of these and the dataset's runnable graders at completion, so use this
756
+ * to grade a single run with a check you don't want to add to the dataset
757
+ * permanently. Each id must be an active/live grader belonging to the same
758
+ * organization and trace function, otherwise the server rejects the replay.
759
+ */
760
+ graderIds?: string[];
752
761
  /**
753
762
  * Reshape recorded inputs before they are spread into `fn`.
754
763
  *
@@ -785,6 +794,21 @@ interface ReplayOptions {
785
794
  }
786
795
  /** Running totals reported to {@link ReplayOptions.onProgress} as replay proceeds. */
787
796
  interface ReplayProgress {
797
+ /**
798
+ * Event kind. Omitted (or `"item"`) for the per-trace settle events streamed
799
+ * during the run. `"complete"` marks the single terminal event emitted once
800
+ * the run has settled and been enriched server-side; it carries the full
801
+ * {@link ReplayProgress.result} and has no `item`. The Bitfab plugin reads
802
+ * that terminal event to build the run's final result without parsing stdout.
803
+ */
804
+ type?: "item" | "complete";
805
+ /**
806
+ * The full {@link ReplayResult}, present only on the terminal `"complete"`
807
+ * event. Lets the plugin ingest the enriched result (server-aggregated tokens,
808
+ * server trace ids) over the same channel as progress, so a dependency logging
809
+ * to stdout can never block it.
810
+ */
811
+ result?: ReplayResult<unknown>;
788
812
  /** Test run ID created for this replay. */
789
813
  testRunId?: string;
790
814
  /** Items that have finished so far, whether they succeeded or errored. */
@@ -796,18 +820,25 @@ interface ReplayProgress {
796
820
  /** Of the completed items, how many threw (their `item.error` is set). */
797
821
  errored: number;
798
822
  /**
799
- * The single item that just settled to produce this event. `traceId` is the
800
- * source (historical) trace that was replayed (so a UI can identify or link
801
- * it); `error` is its replay error, or null when it ran ok; `durationMs` is how
802
- * long this one trace took to replay. Lets a progress UI show per-trace
803
- * pass/fail and timing as the run streams, without waiting for the full
804
- * {@link ReplayResult}.
823
+ * The single item that just settled to produce this event. `traceId` is null
824
+ * at this stage (the server replay id isn't known until the run completes);
825
+ * `originalTraceId` is the original (historical) trace that was replayed (so
826
+ * a UI can identify or link it); `error` is its replay error, or null when it
827
+ * ran ok; `durationMs` is how long this one trace took to replay. Lets a
828
+ * progress UI show per-trace pass/fail and timing as the run streams, without
829
+ * waiting for the full {@link ReplayResult}.
805
830
  */
806
831
  item?: {
807
- /** Source (historical) trace ID being replayed. */
808
- traceId: string | null;
809
- /** Local SDK replay trace ID, before the server maps it to a row ID. */
810
- replayTraceId?: string | null;
832
+ /** Trace ID of the new replay trace (null during the run; the server id arrives at completion). */
833
+ traceId?: string | null;
834
+ /** Bitfab trace ID of the original (historical) trace being replayed. */
835
+ originalTraceId: string | null;
836
+ /** External span ID the recorded inputs were read from (the original root span). */
837
+ originalSpanId?: string | null;
838
+ /** @deprecated alias for `originalTraceId`. */
839
+ sourceTraceId: string | null;
840
+ /** @deprecated alias for `originalSpanId`. */
841
+ sourceSpanId?: string | null;
811
842
  /** Deserialized inputs from the original trace. */
812
843
  input?: unknown[];
813
844
  /** The result returned by the replayed function, or undefined on error. */
@@ -847,9 +878,13 @@ declare const BITFAB_PROGRESS_PREFIX = "@@bitfab:progress ";
847
878
  declare function reportReplayProgress(progress: ReplayProgress): void;
848
879
  /** Per-trace context passed to {@link ReplayOptions.adaptInputs}. */
849
880
  interface AdaptContext {
850
- /** Bitfab trace ID of the historical trace being replayed. */
851
- traceId: string;
881
+ /** Bitfab trace ID of the original (historical) trace being replayed. */
882
+ originalTraceId: string;
852
883
  /** External span ID the recorded inputs were read from. */
884
+ originalSpanId: string;
885
+ /** @deprecated alias for {@link AdaptContext.originalTraceId}. */
886
+ sourceTraceId: string;
887
+ /** @deprecated alias for {@link AdaptContext.originalSpanId}. */
853
888
  sourceSpanId: string;
854
889
  }
855
890
  /**
@@ -865,8 +900,23 @@ interface AdaptContext {
865
900
  */
866
901
  type AdaptInputsFn = (inputs: unknown[], ctx: AdaptContext) => unknown[];
867
902
  interface ReplayItem<T> {
868
- /** Trace ID of the new trace created during replay. */
903
+ /**
904
+ * Server trace ID of the new replay trace this item produced. Written in by
905
+ * `replay()` from the complete-replay response once the server has minted the
906
+ * trace row; the client-side id used to correlate spans during the run is
907
+ * never surfaced here. Null until completion, on older servers that omit the
908
+ * mapping, or if the item produced no trace. Not the verdict-persistence key:
909
+ * that is the original-trace lineage (`originalTraceId` + `testRunId`).
910
+ */
869
911
  traceId: string | null;
912
+ /** Bitfab trace ID of the original (historical) trace being replayed. */
913
+ originalTraceId: string;
914
+ /** External span ID the recorded inputs were read from (the original root span). */
915
+ originalSpanId: string;
916
+ /** @deprecated alias for {@link ReplayItem.originalTraceId}. */
917
+ sourceTraceId: string;
918
+ /** @deprecated alias for {@link ReplayItem.originalSpanId}. */
919
+ sourceSpanId: string;
870
920
  /** Deserialized inputs from the original trace. */
871
921
  input: unknown[];
872
922
  /** The result returned by the function during replay, or undefined on error. */
@@ -1758,7 +1808,7 @@ declare class BitfabFunction {
1758
1808
  /**
1759
1809
  * SDK version from package.json (injected at build time)
1760
1810
  */
1761
- declare const __version__ = "0.29.0";
1811
+ declare const __version__ = "0.30.0";
1762
1812
 
1763
1813
  /**
1764
1814
  * Constants for the Bitfab SDK.
package/dist/index.js CHANGED
@@ -23,12 +23,12 @@ import {
23
23
  flushTraces,
24
24
  getCurrentSpan,
25
25
  getCurrentTrace
26
- } from "./chunk-2M5AWVVQ.js";
26
+ } from "./chunk-FHCRK2P6.js";
27
27
  import {
28
28
  BITFAB_PROGRESS_PREFIX,
29
29
  BitfabError,
30
30
  reportReplayProgress
31
- } from "./chunk-V3XORTWI.js";
31
+ } from "./chunk-2EFKQLJ7.js";
32
32
  export {
33
33
  BITFAB_PROGRESS_PREFIX,
34
34
  Bitfab,
package/dist/node.cjs CHANGED
@@ -403,23 +403,27 @@ function buildMockTree(rootNode) {
403
403
  }
404
404
  return { spans };
405
405
  }
406
- async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy, resolvedOverrides, environment, adaptInputs) {
406
+ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy, resolvedOverrides, replayedTraceId, environment, adaptInputs) {
407
407
  const lease = environment ? serverItem.dbBranchLease : void 0;
408
408
  let inputs = [];
409
409
  let originalOutput;
410
410
  let result;
411
411
  let error = null;
412
- const replayedTraceId = randomUuid();
413
412
  const pendingPersistence = [];
413
+ const originalTraceId = serverItem.originalTraceId ?? serverItem.sourceTraceId;
414
+ const originalSpanId = serverItem.originalSpanId ?? serverItem.sourceSpanId;
414
415
  try {
415
- const span = await httpClient.getExternalSpan(serverItem.externalSpanId);
416
+ const span = await httpClient.getExternalSpan(originalSpanId);
416
417
  const spanData = span.rawData?.span_data ?? {};
417
418
  inputs = deserializeInputs(spanData);
418
419
  originalOutput = deserializeOutput(spanData);
419
420
  if (adaptInputs) {
420
421
  inputs = adaptInputs(inputs, {
421
- traceId: serverItem.traceId,
422
- sourceSpanId: serverItem.externalSpanId
422
+ originalTraceId,
423
+ originalSpanId,
424
+ // Deprecated aliases for originalTraceId/originalSpanId.
425
+ sourceTraceId: originalTraceId,
426
+ sourceSpanId: originalSpanId
423
427
  });
424
428
  }
425
429
  const hasOverrides = resolvedOverrides.length > 0;
@@ -428,15 +432,14 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
428
432
  let mockTree;
429
433
  if (needTree) {
430
434
  try {
431
- const treeResponse = await httpClient.getSpanTree(
432
- serverItem.externalSpanId,
433
- { includeOutputs }
434
- );
435
+ const treeResponse = await httpClient.getSpanTree(originalSpanId, {
436
+ includeOutputs
437
+ });
435
438
  if (treeResponse.root) {
436
439
  mockTree = buildMockTree(treeResponse.root);
437
440
  } else if (mockStrategy === "all" || hasOverrides) {
438
441
  throw new BitfabError(
439
- `Replay mock strategy "${mockStrategy}"${hasOverrides ? " with overrides" : ""} requires a span tree root for source span ${serverItem.externalSpanId}.`
442
+ `Replay mock strategy "${mockStrategy}"${hasOverrides ? " with overrides" : ""} requires a span tree root for original span ${originalSpanId}.`
440
443
  );
441
444
  } else {
442
445
  mockTree = void 0;
@@ -467,7 +470,7 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
467
470
  traceId: replayedTraceId,
468
471
  inputSourceSpanId: span.id,
469
472
  inputSourceTraceId: span.externalTraceId,
470
- sourceBitfabTraceId: serverItem.traceId,
473
+ sourceBitfabTraceId: originalTraceId,
471
474
  mockTree,
472
475
  callCounters: mockTree ? /* @__PURE__ */ new Map() : void 0,
473
476
  mockStrategy,
@@ -497,7 +500,15 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
497
500
  }
498
501
  }
499
502
  return {
500
- traceId: replayedTraceId,
503
+ // Written in by replay() from the complete-replay response once the server
504
+ // has minted this replay trace's row. Null until then: the client-side
505
+ // correlation id (replayedTraceId) is never surfaced as the item's traceId.
506
+ traceId: null,
507
+ originalTraceId,
508
+ originalSpanId,
509
+ // Deprecated aliases for originalTraceId/originalSpanId.
510
+ sourceTraceId: originalTraceId,
511
+ sourceSpanId: originalSpanId,
501
512
  input: inputs,
502
513
  result,
503
514
  originalOutput,
@@ -565,7 +576,8 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
565
576
  options?.environment !== void 0,
566
577
  // includeDbBranchLease
567
578
  options?.experimentGroupId,
568
- options?.datasetId
579
+ options?.datasetId,
580
+ options?.graderIds
569
581
  );
570
582
  const mockStrategy = options?.mock ?? "marked";
571
583
  const maxConcurrency = options?.maxConcurrency ?? 10;
@@ -573,14 +585,16 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
573
585
  ...normalizeMockOverrides(options?.mockOverride),
574
586
  ...registeredOverrides
575
587
  ];
588
+ const replayedTraceIds = serverItems.map(() => randomUuid());
576
589
  const tasks = serverItems.map(
577
- (serverItem) => () => processItem(
590
+ (serverItem, index) => () => processItem(
578
591
  httpClient,
579
592
  serverItem,
580
593
  fn,
581
594
  testRunId,
582
595
  mockStrategy,
583
596
  resolvedOverrides,
597
+ replayedTraceIds[index],
584
598
  options?.environment,
585
599
  options?.adaptInputs
586
600
  )
@@ -607,11 +621,17 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
607
621
  succeeded,
608
622
  errored,
609
623
  item: {
610
- // Source (historical) trace id, so a UI can identify the trace
611
- // that just settled. The item's own traceId is the new replay
612
- // trace and is assigned later (below), so use the server item.
613
- traceId: serverItems[index]?.traceId ?? null,
614
- replayTraceId: item.traceId,
624
+ // The server replay trace id isn't known until completeReplay
625
+ // runs (below), so it can't be reported mid-run and we never
626
+ // emit the client-side placeholder. originalTraceId (the
627
+ // historical trace) is known now and is what a UI keys on to
628
+ // identify what just settled.
629
+ traceId: null,
630
+ originalTraceId: item.originalTraceId ?? null,
631
+ originalSpanId: item.originalSpanId ?? null,
632
+ // Deprecated aliases for originalTraceId/originalSpanId.
633
+ sourceTraceId: item.originalTraceId ?? null,
634
+ sourceSpanId: item.originalSpanId ?? null,
615
635
  input: item.input,
616
636
  result: item.result,
617
637
  originalOutput: item.originalOutput,
@@ -629,56 +649,58 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
629
649
  const completeResult = await httpClient.completeReplay(testRunId);
630
650
  const serverTraceIds = completeResult.traceIds;
631
651
  const replayTokens = completeResult.tokens;
632
- if (serverTraceIds === void 0) {
633
- try {
634
- console.warn(
635
- "Bitfab: server did not return replay trace IDs; item.traceId will be null (server upgrade required for verdict persistence)"
636
- );
637
- } catch {
638
- }
639
- for (const item of resultItems) {
640
- item.traceId = null;
641
- }
642
- } else {
652
+ if (serverTraceIds !== void 0) {
643
653
  const missing = [];
644
654
  let completedCount = 0;
645
- for (const item of resultItems) {
646
- if (item.traceId) {
647
- const mapped = serverTraceIds[item.traceId];
648
- if (item.error === null) {
649
- completedCount += 1;
650
- if (mapped === void 0) {
651
- missing.push(item.traceId);
652
- }
653
- }
654
- if (mapped !== void 0) {
655
- item.tokens = replayTokens?.[mapped] ?? null;
655
+ for (let index = 0; index < resultItems.length; index += 1) {
656
+ const item = resultItems[index];
657
+ const localId = replayedTraceIds[index];
658
+ const mapped = localId ? serverTraceIds[localId] : void 0;
659
+ item.traceId = mapped ?? null;
660
+ if (item.error === null) {
661
+ completedCount += 1;
662
+ if (mapped === void 0) {
663
+ missing.push(localId ?? item.originalTraceId);
656
664
  }
657
- item.traceId = mapped ?? null;
665
+ }
666
+ if (mapped !== void 0) {
667
+ item.tokens = replayTokens?.[mapped] ?? null;
658
668
  }
659
669
  }
660
- if (missing.length > 0) {
670
+ if (completedCount > 0 && missing.length === completedCount) {
661
671
  const serverCount = completeResult.traceCount !== void 0 ? ` The server persisted ${completeResult.traceCount} trace(s) for this run.` : "";
662
- if (missing.length === completedCount) {
663
- throw new BitfabError(
664
- `Replay completed but the server has no persisted trace for any of the ${completedCount} completed item(s) (testRunId ${testRunId}).${serverCount} Trace uploads were awaited, so either the uploads failed (check for "Bitfab: Failed to create" errors above) or the replayed function is not wrapped with withSpan.`
665
- );
666
- }
672
+ throw new BitfabError(
673
+ `Replay completed but the server has no persisted trace for any of the ${completedCount} completed item(s) (testRunId ${testRunId}).${serverCount} Trace uploads were awaited, so either the uploads failed (check for "Bitfab: Failed to create" errors above) or the replayed function is not wrapped with withSpan.`
674
+ );
675
+ }
676
+ if (missing.length > 0) {
667
677
  try {
668
678
  console.error(
669
- `Bitfab: server has no persisted trace for ${missing.length} of ${completedCount} completed replay item(s) (testRunId ${testRunId}).${serverCount} Their traceId is null and verdicts cannot be persisted for them. Missing: ${missing.join(", ")}`
679
+ `Bitfab: server has no persisted trace for ${missing.length} of ${completedCount} completed replay item(s) (testRunId ${testRunId}). Their replay token usage is unavailable and they cannot be labeled.`
670
680
  );
671
681
  } catch {
672
682
  }
673
683
  }
674
684
  }
675
- const replayResult = {
685
+ const result = {
676
686
  items: resultItems,
677
687
  testRunId,
678
688
  testRunUrl: `${serviceUrl}${testRunUrl}`
679
689
  };
680
- await writeReplayResultFile(replayResult);
681
- return replayResult;
690
+ await writeReplayResultFile(result);
691
+ try {
692
+ options?.onProgress?.({
693
+ type: "complete",
694
+ testRunId,
695
+ completed: total,
696
+ total,
697
+ succeeded,
698
+ errored,
699
+ result
700
+ });
701
+ } catch {
702
+ }
703
+ return result;
682
704
  }
683
705
  async function writeReplayResultFile(result) {
684
706
  const resultPath = typeof process !== "undefined" ? process.env?.BITFAB_REPLAY_RESULT_PATH : void 0;
@@ -748,7 +770,7 @@ registerAsyncLocalStorageClass(
748
770
  );
749
771
 
750
772
  // src/version.generated.ts
751
- var __version__ = "0.29.0";
773
+ var __version__ = "0.30.0";
752
774
 
753
775
  // src/constants.ts
754
776
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";
@@ -1107,7 +1129,7 @@ var HttpClient = class {
1107
1129
  * Start a replay session by fetching historical traces.
1108
1130
  * Blocking call - creates a test run and returns lightweight item references.
1109
1131
  */
1110
- async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetId) {
1132
+ async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetId, graderIds) {
1111
1133
  const payload = { traceFunctionKey };
1112
1134
  if (limit !== void 0) {
1113
1135
  payload.limit = limit;
@@ -1133,6 +1155,9 @@ var HttpClient = class {
1133
1155
  if (datasetId !== void 0) {
1134
1156
  payload.datasetId = datasetId;
1135
1157
  }
1158
+ if (graderIds !== void 0) {
1159
+ payload.graderIds = graderIds;
1160
+ }
1136
1161
  const timeout = includeDbBranchLease ? 18e4 : 3e4;
1137
1162
  return this.request("/api/sdk/replay/start", payload, {
1138
1163
  timeout
@@ -4178,7 +4203,7 @@ var Bitfab = class {
4178
4203
  dbSnapshotUsage: {
4179
4204
  neonBranchId: replayCtx.dbBranchLease.neonBranchId,
4180
4205
  snapshotTimestamp: replayCtx.dbBranchLease.snapshotTimestamp,
4181
- sourceTraceId: replayCtx.sourceBitfabTraceId,
4206
+ originalTraceId: replayCtx.sourceBitfabTraceId,
4182
4207
  accessed: replayCtx.dbSnapshotAccessed === true
4183
4208
  }
4184
4209
  }
@@ -4482,8 +4507,11 @@ var Bitfab = class {
4482
4507
  ...params.dbSnapshotUsage.snapshotTimestamp && {
4483
4508
  snapshot_timestamp: params.dbSnapshotUsage.snapshotTimestamp
4484
4509
  },
4485
- ...params.dbSnapshotUsage.sourceTraceId && {
4486
- source_trace_id: params.dbSnapshotUsage.sourceTraceId
4510
+ ...params.dbSnapshotUsage.originalTraceId && {
4511
+ original_trace_id: params.dbSnapshotUsage.originalTraceId,
4512
+ // Deprecated wire alias, kept so this SDK still reports usage
4513
+ // against servers that predate the rename.
4514
+ source_trace_id: params.dbSnapshotUsage.originalTraceId
4487
4515
  },
4488
4516
  accessed: params.dbSnapshotUsage.accessed
4489
4517
  };