bitfab 0.47.0 → 0.50.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.
@@ -6,7 +6,7 @@ import {
6
6
  flushTraces,
7
7
  parseRetryAfterMs,
8
8
  serializePayloadBody
9
- } from "./chunk-DGVHJW43.js";
9
+ } from "./chunk-VC3CVN2P.js";
10
10
  export {
11
11
  BitfabError,
12
12
  HttpClient,
@@ -16,4 +16,4 @@ export {
16
16
  parseRetryAfterMs,
17
17
  serializePayloadBody
18
18
  };
19
- //# sourceMappingURL=http-AMWUT3JO.js.map
19
+ //# sourceMappingURL=http-UI4FW2QI.js.map
@@ -6,7 +6,7 @@ import {
6
6
  flushTraces,
7
7
  parseRetryAfterMs,
8
8
  serializePayloadBody
9
- } from "./chunk-2TVORTY7.js";
9
+ } from "./chunk-WKSZSBRQ.js";
10
10
  import "./chunk-H6LZRFMN.js";
11
11
  export {
12
12
  BitfabError,
@@ -17,4 +17,4 @@ export {
17
17
  parseRetryAfterMs,
18
18
  serializePayloadBody
19
19
  };
20
- //# sourceMappingURL=http-4VKISP7F.js.map
20
+ //# sourceMappingURL=http-W7XZFZN3.js.map
package/dist/index.cjs CHANGED
@@ -51,7 +51,7 @@ var __version__, __packageName__;
51
51
  var init_version_generated = __esm({
52
52
  "src/version.generated.ts"() {
53
53
  "use strict";
54
- __version__ = "0.47.0";
54
+ __version__ = "0.50.0";
55
55
  __packageName__ = "bitfab";
56
56
  }
57
57
  });
@@ -1856,7 +1856,7 @@ var init_http = __esm({
1856
1856
  * Start a replay session by fetching historical traces.
1857
1857
  * Blocking call - creates a test run and returns lightweight item references.
1858
1858
  */
1859
- async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetId, graderIds, dbBranchSettings, attempts, includeOriginalMetadata) {
1859
+ async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetId, graderIds, dbBranchSettings, attempts, includeOriginalMetadata, onlyWithAssertions) {
1860
1860
  const payload = { traceFunctionKey };
1861
1861
  if (limit !== void 0) {
1862
1862
  payload.limit = limit;
@@ -1895,6 +1895,9 @@ var init_http = __esm({
1895
1895
  if (includeOriginalMetadata) {
1896
1896
  payload.includeOriginalMetadata = true;
1897
1897
  }
1898
+ if (onlyWithAssertions) {
1899
+ payload.onlyWithAssertions = true;
1900
+ }
1898
1901
  const timeout = includeDbBranchLease ? REPLAY_DB_BRANCH_REQUEST_TIMEOUT_MS : 3e4;
1899
1902
  return this.request("/api/sdk/replay/start", payload, {
1900
1903
  timeout
@@ -2960,7 +2963,8 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
2960
2963
  options?.graderIds,
2961
2964
  resolveDbBranchSettings(options?.dbBranch),
2962
2965
  attempts,
2963
- options?.adaptInputs !== void 0
2966
+ options?.adaptInputs !== void 0,
2967
+ options?.onlyWithAssertions
2964
2968
  );
2965
2969
  if (serverItems.length === 0) {
2966
2970
  try {
@@ -3277,6 +3281,7 @@ __export(index_exports, {
3277
3281
  DEFAULT_SERVICE_URL: () => DEFAULT_SERVICE_URL,
3278
3282
  DatasetsClient: () => DatasetsClient,
3279
3283
  DbBranchReplayError: () => DbBranchReplayError,
3284
+ GradersClient: () => GradersClient,
3280
3285
  HttpClient: () => HttpClient,
3281
3286
  LabelsClient: () => LabelsClient,
3282
3287
  MixedTracingError: () => MixedTracingError,
@@ -4572,10 +4577,45 @@ function buildSnapshotRef(config, sdkWallClockBeforeFn) {
4572
4577
 
4573
4578
  // src/client.ts
4574
4579
  init_errors();
4580
+
4581
+ // src/graders.ts
4582
+ init_errors();
4583
+ var GRADER_LABELS_PATH = "/api/sdk/graderLabels";
4584
+ var GradersClient = class {
4585
+ constructor(httpClient) {
4586
+ this.httpClient = httpClient;
4587
+ }
4588
+ async getLabels(params) {
4589
+ const hasTraceIds = params.traceIds !== void 0 && params.traceIds.length > 0;
4590
+ const hasGraderId = params.graderId !== void 0;
4591
+ if (!hasTraceIds && !hasGraderId) {
4592
+ throw new BitfabError(
4593
+ "Pass traceIds, graderId, or both: there is nothing to read otherwise."
4594
+ );
4595
+ }
4596
+ const query = new URLSearchParams();
4597
+ if (params.traceIds !== void 0 && params.traceIds.length > 0) {
4598
+ query.set("traceIds", params.traceIds.join(","));
4599
+ }
4600
+ if (params.graderId !== void 0) {
4601
+ query.set("graderId", params.graderId);
4602
+ }
4603
+ if (params.limit !== void 0) {
4604
+ query.set("limit", String(params.limit));
4605
+ }
4606
+ const response = await this.httpClient.get(
4607
+ `${GRADER_LABELS_PATH}?${query.toString()}`
4608
+ );
4609
+ return response.labels;
4610
+ }
4611
+ };
4612
+
4613
+ // src/client.ts
4575
4614
  init_http();
4576
4615
 
4577
4616
  // src/labels.ts
4578
4617
  var LABELS_PATH = "/api/sdk/traces/labels";
4618
+ var HUMAN_LABELS_PATH = "/api/sdk/traces/labels/human";
4579
4619
  var LabelsClient = class {
4580
4620
  constructor(httpClient) {
4581
4621
  this.httpClient = httpClient;
@@ -4594,6 +4634,28 @@ var LabelsClient = class {
4594
4634
  );
4595
4635
  return response.labels;
4596
4636
  }
4637
+ async saveHuman(update) {
4638
+ const [outcome] = await this.saveHumanAll([update]);
4639
+ return outcome;
4640
+ }
4641
+ async saveHumanAll(updates) {
4642
+ const response = await this.httpClient.request(HUMAN_LABELS_PATH, { labels: updates });
4643
+ return response.labels;
4644
+ }
4645
+ async get(traceId) {
4646
+ const [labels] = await this.getAll([traceId]);
4647
+ return labels ?? null;
4648
+ }
4649
+ async getAll(traceIds) {
4650
+ if (traceIds.length === 0) {
4651
+ return [];
4652
+ }
4653
+ const query = new URLSearchParams({ traceIds: traceIds.join(",") });
4654
+ const response = await this.httpClient.get(
4655
+ `${LABELS_PATH}?${query.toString()}`
4656
+ );
4657
+ return response.labels;
4658
+ }
4597
4659
  };
4598
4660
 
4599
4661
  // src/langgraph.ts
@@ -6371,6 +6433,7 @@ var Bitfab = class {
6371
6433
  this.datasets = new DatasetsClient(this.httpClient);
6372
6434
  this.traces = new TracesClient(this.httpClient);
6373
6435
  this.labels = new LabelsClient(this.httpClient);
6436
+ this.graders = new GradersClient(this.httpClient);
6374
6437
  }
6375
6438
  /**
6376
6439
  * Decorate a class method as an automatically expanded trace root.
@@ -8271,6 +8334,7 @@ function resolveTraceFunctionKey(registration) {
8271
8334
  DEFAULT_SERVICE_URL,
8272
8335
  DatasetsClient,
8273
8336
  DbBranchReplayError,
8337
+ GradersClient,
8274
8338
  HttpClient,
8275
8339
  LabelsClient,
8276
8340
  MixedTracingError,