@bitfab/sdk 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-YKHZGYAC.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-BUAOWCLI.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-RQEYVHGV.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-224ASOWH.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.47.0";
45
+ __version__ = "0.50.0";
46
46
  __packageName__ = "@bitfab/sdk";
47
47
  }
48
48
  });
@@ -1847,7 +1847,7 @@ var init_http = __esm({
1847
1847
  * Start a replay session by fetching historical traces.
1848
1848
  * Blocking call - creates a test run and returns lightweight item references.
1849
1849
  */
1850
- async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetId, graderIds, dbBranchSettings, attempts, includeOriginalMetadata) {
1850
+ async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetId, graderIds, dbBranchSettings, attempts, includeOriginalMetadata, onlyWithAssertions) {
1851
1851
  const payload = { traceFunctionKey };
1852
1852
  if (limit !== void 0) {
1853
1853
  payload.limit = limit;
@@ -1886,6 +1886,9 @@ var init_http = __esm({
1886
1886
  if (includeOriginalMetadata) {
1887
1887
  payload.includeOriginalMetadata = true;
1888
1888
  }
1889
+ if (onlyWithAssertions) {
1890
+ payload.onlyWithAssertions = true;
1891
+ }
1889
1892
  const timeout = includeDbBranchLease ? REPLAY_DB_BRANCH_REQUEST_TIMEOUT_MS : 3e4;
1890
1893
  return this.request("/api/sdk/replay/start", payload, {
1891
1894
  timeout
@@ -2951,7 +2954,8 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
2951
2954
  options?.graderIds,
2952
2955
  resolveDbBranchSettings(options?.dbBranch),
2953
2956
  attempts,
2954
- options?.adaptInputs !== void 0
2957
+ options?.adaptInputs !== void 0,
2958
+ options?.onlyWithAssertions
2955
2959
  );
2956
2960
  if (serverItems.length === 0) {
2957
2961
  try {
@@ -3268,6 +3272,7 @@ __export(index_exports, {
3268
3272
  DEFAULT_SERVICE_URL: () => DEFAULT_SERVICE_URL,
3269
3273
  DatasetsClient: () => DatasetsClient,
3270
3274
  DbBranchReplayError: () => DbBranchReplayError,
3275
+ GradersClient: () => GradersClient,
3271
3276
  HttpClient: () => HttpClient,
3272
3277
  LabelsClient: () => LabelsClient,
3273
3278
  MixedTracingError: () => MixedTracingError,
@@ -4563,10 +4568,45 @@ function buildSnapshotRef(config, sdkWallClockBeforeFn) {
4563
4568
 
4564
4569
  // src/client.ts
4565
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
4566
4605
  init_http();
4567
4606
 
4568
4607
  // src/labels.ts
4569
4608
  var LABELS_PATH = "/api/sdk/traces/labels";
4609
+ var HUMAN_LABELS_PATH = "/api/sdk/traces/labels/human";
4570
4610
  var LabelsClient = class {
4571
4611
  constructor(httpClient) {
4572
4612
  this.httpClient = httpClient;
@@ -4585,6 +4625,28 @@ var LabelsClient = class {
4585
4625
  );
4586
4626
  return response.labels;
4587
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
+ }
4588
4650
  };
4589
4651
 
4590
4652
  // src/langgraph.ts
@@ -6362,6 +6424,7 @@ var Bitfab = class {
6362
6424
  this.datasets = new DatasetsClient(this.httpClient);
6363
6425
  this.traces = new TracesClient(this.httpClient);
6364
6426
  this.labels = new LabelsClient(this.httpClient);
6427
+ this.graders = new GradersClient(this.httpClient);
6365
6428
  }
6366
6429
  /**
6367
6430
  * Decorate a class method as an automatically expanded trace root.
@@ -8262,6 +8325,7 @@ function resolveTraceFunctionKey(registration) {
8262
8325
  DEFAULT_SERVICE_URL,
8263
8326
  DatasetsClient,
8264
8327
  DbBranchReplayError,
8328
+ GradersClient,
8265
8329
  HttpClient,
8266
8330
  LabelsClient,
8267
8331
  MixedTracingError,