@bitfab/sdk 0.48.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-OKSCUFJ6.js";
9
+ } from "./chunk-XZDYNFI5.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-MO5ZRPA6.js.map
20
+ //# sourceMappingURL=http-PFP2EQVE.js.map
@@ -6,7 +6,7 @@ import {
6
6
  flushTraces,
7
7
  parseRetryAfterMs,
8
8
  serializePayloadBody
9
- } from "./chunk-I6MWT34L.js";
9
+ } from "./chunk-W5P5JAH7.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-CGTUTKK3.js.map
19
+ //# sourceMappingURL=http-W2YPLY7H.js.map
package/dist/index.cjs CHANGED
@@ -42,7 +42,7 @@ var __version__, __packageName__;
42
42
  var init_version_generated = __esm({
43
43
  "src/version.generated.ts"() {
44
44
  "use strict";
45
- __version__ = "0.48.0";
45
+ __version__ = "0.50.0";
46
46
  __packageName__ = "@bitfab/sdk";
47
47
  }
48
48
  });
@@ -3272,6 +3272,7 @@ __export(index_exports, {
3272
3272
  DEFAULT_SERVICE_URL: () => DEFAULT_SERVICE_URL,
3273
3273
  DatasetsClient: () => DatasetsClient,
3274
3274
  DbBranchReplayError: () => DbBranchReplayError,
3275
+ GradersClient: () => GradersClient,
3275
3276
  HttpClient: () => HttpClient,
3276
3277
  LabelsClient: () => LabelsClient,
3277
3278
  MixedTracingError: () => MixedTracingError,
@@ -4567,10 +4568,45 @@ function buildSnapshotRef(config, sdkWallClockBeforeFn) {
4567
4568
 
4568
4569
  // src/client.ts
4569
4570
  init_errors();
4571
+
4572
+ // src/graders.ts
4573
+ init_errors();
4574
+ var GRADER_LABELS_PATH = "/api/sdk/graderLabels";
4575
+ var GradersClient = class {
4576
+ constructor(httpClient) {
4577
+ this.httpClient = httpClient;
4578
+ }
4579
+ async getLabels(params) {
4580
+ const hasTraceIds = params.traceIds !== void 0 && params.traceIds.length > 0;
4581
+ const hasGraderId = params.graderId !== void 0;
4582
+ if (!hasTraceIds && !hasGraderId) {
4583
+ throw new BitfabError(
4584
+ "Pass traceIds, graderId, or both: there is nothing to read otherwise."
4585
+ );
4586
+ }
4587
+ const query = new URLSearchParams();
4588
+ if (params.traceIds !== void 0 && params.traceIds.length > 0) {
4589
+ query.set("traceIds", params.traceIds.join(","));
4590
+ }
4591
+ if (params.graderId !== void 0) {
4592
+ query.set("graderId", params.graderId);
4593
+ }
4594
+ if (params.limit !== void 0) {
4595
+ query.set("limit", String(params.limit));
4596
+ }
4597
+ const response = await this.httpClient.get(
4598
+ `${GRADER_LABELS_PATH}?${query.toString()}`
4599
+ );
4600
+ return response.labels;
4601
+ }
4602
+ };
4603
+
4604
+ // src/client.ts
4570
4605
  init_http();
4571
4606
 
4572
4607
  // src/labels.ts
4573
4608
  var LABELS_PATH = "/api/sdk/traces/labels";
4609
+ var HUMAN_LABELS_PATH = "/api/sdk/traces/labels/human";
4574
4610
  var LabelsClient = class {
4575
4611
  constructor(httpClient) {
4576
4612
  this.httpClient = httpClient;
@@ -4589,6 +4625,28 @@ var LabelsClient = class {
4589
4625
  );
4590
4626
  return response.labels;
4591
4627
  }
4628
+ async saveHuman(update) {
4629
+ const [outcome] = await this.saveHumanAll([update]);
4630
+ return outcome;
4631
+ }
4632
+ async saveHumanAll(updates) {
4633
+ const response = await this.httpClient.request(HUMAN_LABELS_PATH, { labels: updates });
4634
+ return response.labels;
4635
+ }
4636
+ async get(traceId) {
4637
+ const [labels] = await this.getAll([traceId]);
4638
+ return labels ?? null;
4639
+ }
4640
+ async getAll(traceIds) {
4641
+ if (traceIds.length === 0) {
4642
+ return [];
4643
+ }
4644
+ const query = new URLSearchParams({ traceIds: traceIds.join(",") });
4645
+ const response = await this.httpClient.get(
4646
+ `${LABELS_PATH}?${query.toString()}`
4647
+ );
4648
+ return response.labels;
4649
+ }
4592
4650
  };
4593
4651
 
4594
4652
  // src/langgraph.ts
@@ -6366,6 +6424,7 @@ var Bitfab = class {
6366
6424
  this.datasets = new DatasetsClient(this.httpClient);
6367
6425
  this.traces = new TracesClient(this.httpClient);
6368
6426
  this.labels = new LabelsClient(this.httpClient);
6427
+ this.graders = new GradersClient(this.httpClient);
6369
6428
  }
6370
6429
  /**
6371
6430
  * Decorate a class method as an automatically expanded trace root.
@@ -8266,6 +8325,7 @@ function resolveTraceFunctionKey(registration) {
8266
8325
  DEFAULT_SERVICE_URL,
8267
8326
  DatasetsClient,
8268
8327
  DbBranchReplayError,
8328
+ GradersClient,
8269
8329
  HttpClient,
8270
8330
  LabelsClient,
8271
8331
  MixedTracingError,