@bitfab/sdk 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
@@ -14,12 +14,12 @@ import {
14
14
  flushTraces,
15
15
  getCurrentSpan,
16
16
  getCurrentTrace
17
- } from "./chunk-2M5AWVVQ.js";
17
+ } from "./chunk-FHCRK2P6.js";
18
18
  import {
19
19
  BITFAB_PROGRESS_PREFIX,
20
20
  BitfabError,
21
21
  reportReplayProgress
22
- } from "./chunk-V3XORTWI.js";
22
+ } from "./chunk-2EFKQLJ7.js";
23
23
  export {
24
24
  BITFAB_PROGRESS_PREFIX,
25
25
  Bitfab,
package/dist/node.cjs CHANGED
@@ -394,23 +394,27 @@ function buildMockTree(rootNode) {
394
394
  }
395
395
  return { spans };
396
396
  }
397
- async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy, resolvedOverrides, environment, adaptInputs) {
397
+ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy, resolvedOverrides, replayedTraceId, environment, adaptInputs) {
398
398
  const lease = environment ? serverItem.dbBranchLease : void 0;
399
399
  let inputs = [];
400
400
  let originalOutput;
401
401
  let result;
402
402
  let error = null;
403
- const replayedTraceId = randomUuid();
404
403
  const pendingPersistence = [];
404
+ const originalTraceId = serverItem.originalTraceId ?? serverItem.sourceTraceId;
405
+ const originalSpanId = serverItem.originalSpanId ?? serverItem.sourceSpanId;
405
406
  try {
406
- const span = await httpClient.getExternalSpan(serverItem.externalSpanId);
407
+ const span = await httpClient.getExternalSpan(originalSpanId);
407
408
  const spanData = span.rawData?.span_data ?? {};
408
409
  inputs = deserializeInputs(spanData);
409
410
  originalOutput = deserializeOutput(spanData);
410
411
  if (adaptInputs) {
411
412
  inputs = adaptInputs(inputs, {
412
- traceId: serverItem.traceId,
413
- sourceSpanId: serverItem.externalSpanId
413
+ originalTraceId,
414
+ originalSpanId,
415
+ // Deprecated aliases for originalTraceId/originalSpanId.
416
+ sourceTraceId: originalTraceId,
417
+ sourceSpanId: originalSpanId
414
418
  });
415
419
  }
416
420
  const hasOverrides = resolvedOverrides.length > 0;
@@ -419,15 +423,14 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
419
423
  let mockTree;
420
424
  if (needTree) {
421
425
  try {
422
- const treeResponse = await httpClient.getSpanTree(
423
- serverItem.externalSpanId,
424
- { includeOutputs }
425
- );
426
+ const treeResponse = await httpClient.getSpanTree(originalSpanId, {
427
+ includeOutputs
428
+ });
426
429
  if (treeResponse.root) {
427
430
  mockTree = buildMockTree(treeResponse.root);
428
431
  } else if (mockStrategy === "all" || hasOverrides) {
429
432
  throw new BitfabError(
430
- `Replay mock strategy "${mockStrategy}"${hasOverrides ? " with overrides" : ""} requires a span tree root for source span ${serverItem.externalSpanId}.`
433
+ `Replay mock strategy "${mockStrategy}"${hasOverrides ? " with overrides" : ""} requires a span tree root for original span ${originalSpanId}.`
431
434
  );
432
435
  } else {
433
436
  mockTree = void 0;
@@ -458,7 +461,7 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
458
461
  traceId: replayedTraceId,
459
462
  inputSourceSpanId: span.id,
460
463
  inputSourceTraceId: span.externalTraceId,
461
- sourceBitfabTraceId: serverItem.traceId,
464
+ sourceBitfabTraceId: originalTraceId,
462
465
  mockTree,
463
466
  callCounters: mockTree ? /* @__PURE__ */ new Map() : void 0,
464
467
  mockStrategy,
@@ -488,7 +491,15 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
488
491
  }
489
492
  }
490
493
  return {
491
- traceId: replayedTraceId,
494
+ // Written in by replay() from the complete-replay response once the server
495
+ // has minted this replay trace's row. Null until then: the client-side
496
+ // correlation id (replayedTraceId) is never surfaced as the item's traceId.
497
+ traceId: null,
498
+ originalTraceId,
499
+ originalSpanId,
500
+ // Deprecated aliases for originalTraceId/originalSpanId.
501
+ sourceTraceId: originalTraceId,
502
+ sourceSpanId: originalSpanId,
492
503
  input: inputs,
493
504
  result,
494
505
  originalOutput,
@@ -556,7 +567,8 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
556
567
  options?.environment !== void 0,
557
568
  // includeDbBranchLease
558
569
  options?.experimentGroupId,
559
- options?.datasetId
570
+ options?.datasetId,
571
+ options?.graderIds
560
572
  );
561
573
  const mockStrategy = options?.mock ?? "marked";
562
574
  const maxConcurrency = options?.maxConcurrency ?? 10;
@@ -564,14 +576,16 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
564
576
  ...normalizeMockOverrides(options?.mockOverride),
565
577
  ...registeredOverrides
566
578
  ];
579
+ const replayedTraceIds = serverItems.map(() => randomUuid());
567
580
  const tasks = serverItems.map(
568
- (serverItem) => () => processItem(
581
+ (serverItem, index) => () => processItem(
569
582
  httpClient,
570
583
  serverItem,
571
584
  fn,
572
585
  testRunId,
573
586
  mockStrategy,
574
587
  resolvedOverrides,
588
+ replayedTraceIds[index],
575
589
  options?.environment,
576
590
  options?.adaptInputs
577
591
  )
@@ -598,11 +612,17 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
598
612
  succeeded,
599
613
  errored,
600
614
  item: {
601
- // Source (historical) trace id, so a UI can identify the trace
602
- // that just settled. The item's own traceId is the new replay
603
- // trace and is assigned later (below), so use the server item.
604
- traceId: serverItems[index]?.traceId ?? null,
605
- replayTraceId: item.traceId,
615
+ // The server replay trace id isn't known until completeReplay
616
+ // runs (below), so it can't be reported mid-run and we never
617
+ // emit the client-side placeholder. originalTraceId (the
618
+ // historical trace) is known now and is what a UI keys on to
619
+ // identify what just settled.
620
+ traceId: null,
621
+ originalTraceId: item.originalTraceId ?? null,
622
+ originalSpanId: item.originalSpanId ?? null,
623
+ // Deprecated aliases for originalTraceId/originalSpanId.
624
+ sourceTraceId: item.originalTraceId ?? null,
625
+ sourceSpanId: item.originalSpanId ?? null,
606
626
  input: item.input,
607
627
  result: item.result,
608
628
  originalOutput: item.originalOutput,
@@ -620,56 +640,58 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
620
640
  const completeResult = await httpClient.completeReplay(testRunId);
621
641
  const serverTraceIds = completeResult.traceIds;
622
642
  const replayTokens = completeResult.tokens;
623
- if (serverTraceIds === void 0) {
624
- try {
625
- console.warn(
626
- "Bitfab: server did not return replay trace IDs; item.traceId will be null (server upgrade required for verdict persistence)"
627
- );
628
- } catch {
629
- }
630
- for (const item of resultItems) {
631
- item.traceId = null;
632
- }
633
- } else {
643
+ if (serverTraceIds !== void 0) {
634
644
  const missing = [];
635
645
  let completedCount = 0;
636
- for (const item of resultItems) {
637
- if (item.traceId) {
638
- const mapped = serverTraceIds[item.traceId];
639
- if (item.error === null) {
640
- completedCount += 1;
641
- if (mapped === void 0) {
642
- missing.push(item.traceId);
643
- }
644
- }
645
- if (mapped !== void 0) {
646
- item.tokens = replayTokens?.[mapped] ?? null;
646
+ for (let index = 0; index < resultItems.length; index += 1) {
647
+ const item = resultItems[index];
648
+ const localId = replayedTraceIds[index];
649
+ const mapped = localId ? serverTraceIds[localId] : void 0;
650
+ item.traceId = mapped ?? null;
651
+ if (item.error === null) {
652
+ completedCount += 1;
653
+ if (mapped === void 0) {
654
+ missing.push(localId ?? item.originalTraceId);
647
655
  }
648
- item.traceId = mapped ?? null;
656
+ }
657
+ if (mapped !== void 0) {
658
+ item.tokens = replayTokens?.[mapped] ?? null;
649
659
  }
650
660
  }
651
- if (missing.length > 0) {
661
+ if (completedCount > 0 && missing.length === completedCount) {
652
662
  const serverCount = completeResult.traceCount !== void 0 ? ` The server persisted ${completeResult.traceCount} trace(s) for this run.` : "";
653
- if (missing.length === completedCount) {
654
- throw new BitfabError(
655
- `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.`
656
- );
657
- }
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
+ }
667
+ if (missing.length > 0) {
658
668
  try {
659
669
  console.error(
660
- `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(", ")}`
670
+ `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.`
661
671
  );
662
672
  } catch {
663
673
  }
664
674
  }
665
675
  }
666
- const replayResult = {
676
+ const result = {
667
677
  items: resultItems,
668
678
  testRunId,
669
679
  testRunUrl: `${serviceUrl}${testRunUrl}`
670
680
  };
671
- await writeReplayResultFile(replayResult);
672
- return replayResult;
681
+ await writeReplayResultFile(result);
682
+ try {
683
+ options?.onProgress?.({
684
+ type: "complete",
685
+ testRunId,
686
+ completed: total,
687
+ total,
688
+ succeeded,
689
+ errored,
690
+ result
691
+ });
692
+ } catch {
693
+ }
694
+ return result;
673
695
  }
674
696
  async function writeReplayResultFile(result) {
675
697
  const resultPath = typeof process !== "undefined" ? process.env?.BITFAB_REPLAY_RESULT_PATH : void 0;
@@ -739,7 +761,7 @@ registerAsyncLocalStorageClass(
739
761
  );
740
762
 
741
763
  // src/version.generated.ts
742
- var __version__ = "0.29.0";
764
+ var __version__ = "0.30.0";
743
765
 
744
766
  // src/constants.ts
745
767
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";
@@ -1098,7 +1120,7 @@ var HttpClient = class {
1098
1120
  * Start a replay session by fetching historical traces.
1099
1121
  * Blocking call - creates a test run and returns lightweight item references.
1100
1122
  */
1101
- async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetId) {
1123
+ async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetId, graderIds) {
1102
1124
  const payload = { traceFunctionKey };
1103
1125
  if (limit !== void 0) {
1104
1126
  payload.limit = limit;
@@ -1124,6 +1146,9 @@ var HttpClient = class {
1124
1146
  if (datasetId !== void 0) {
1125
1147
  payload.datasetId = datasetId;
1126
1148
  }
1149
+ if (graderIds !== void 0) {
1150
+ payload.graderIds = graderIds;
1151
+ }
1127
1152
  const timeout = includeDbBranchLease ? 18e4 : 3e4;
1128
1153
  return this.request("/api/sdk/replay/start", payload, {
1129
1154
  timeout
@@ -4169,7 +4194,7 @@ var Bitfab = class {
4169
4194
  dbSnapshotUsage: {
4170
4195
  neonBranchId: replayCtx.dbBranchLease.neonBranchId,
4171
4196
  snapshotTimestamp: replayCtx.dbBranchLease.snapshotTimestamp,
4172
- sourceTraceId: replayCtx.sourceBitfabTraceId,
4197
+ originalTraceId: replayCtx.sourceBitfabTraceId,
4173
4198
  accessed: replayCtx.dbSnapshotAccessed === true
4174
4199
  }
4175
4200
  }
@@ -4473,8 +4498,11 @@ var Bitfab = class {
4473
4498
  ...params.dbSnapshotUsage.snapshotTimestamp && {
4474
4499
  snapshot_timestamp: params.dbSnapshotUsage.snapshotTimestamp
4475
4500
  },
4476
- ...params.dbSnapshotUsage.sourceTraceId && {
4477
- source_trace_id: params.dbSnapshotUsage.sourceTraceId
4501
+ ...params.dbSnapshotUsage.originalTraceId && {
4502
+ original_trace_id: params.dbSnapshotUsage.originalTraceId,
4503
+ // Deprecated wire alias, kept so this SDK still reports usage
4504
+ // against servers that predate the rename.
4505
+ source_trace_id: params.dbSnapshotUsage.originalTraceId
4478
4506
  },
4479
4507
  accessed: params.dbSnapshotUsage.accessed
4480
4508
  };