bitfab 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-CPMT6Y43.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-YN67UB3K.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-3VHHLXEJ.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-42E3SI2N.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.48.0";
54
+ __version__ = "0.50.0";
55
55
  __packageName__ = "bitfab";
56
56
  }
57
57
  });
@@ -3281,6 +3281,7 @@ __export(index_exports, {
3281
3281
  DEFAULT_SERVICE_URL: () => DEFAULT_SERVICE_URL,
3282
3282
  DatasetsClient: () => DatasetsClient,
3283
3283
  DbBranchReplayError: () => DbBranchReplayError,
3284
+ GradersClient: () => GradersClient,
3284
3285
  HttpClient: () => HttpClient,
3285
3286
  LabelsClient: () => LabelsClient,
3286
3287
  MixedTracingError: () => MixedTracingError,
@@ -4576,10 +4577,45 @@ function buildSnapshotRef(config, sdkWallClockBeforeFn) {
4576
4577
 
4577
4578
  // src/client.ts
4578
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
4579
4614
  init_http();
4580
4615
 
4581
4616
  // src/labels.ts
4582
4617
  var LABELS_PATH = "/api/sdk/traces/labels";
4618
+ var HUMAN_LABELS_PATH = "/api/sdk/traces/labels/human";
4583
4619
  var LabelsClient = class {
4584
4620
  constructor(httpClient) {
4585
4621
  this.httpClient = httpClient;
@@ -4598,6 +4634,28 @@ var LabelsClient = class {
4598
4634
  );
4599
4635
  return response.labels;
4600
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
+ }
4601
4659
  };
4602
4660
 
4603
4661
  // src/langgraph.ts
@@ -6375,6 +6433,7 @@ var Bitfab = class {
6375
6433
  this.datasets = new DatasetsClient(this.httpClient);
6376
6434
  this.traces = new TracesClient(this.httpClient);
6377
6435
  this.labels = new LabelsClient(this.httpClient);
6436
+ this.graders = new GradersClient(this.httpClient);
6378
6437
  }
6379
6438
  /**
6380
6439
  * Decorate a class method as an automatically expanded trace root.
@@ -8275,6 +8334,7 @@ function resolveTraceFunctionKey(registration) {
8275
8334
  DEFAULT_SERVICE_URL,
8276
8335
  DatasetsClient,
8277
8336
  DbBranchReplayError,
8337
+ GradersClient,
8278
8338
  HttpClient,
8279
8339
  LabelsClient,
8280
8340
  MixedTracingError,