@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.
@@ -5,7 +5,7 @@ import {
5
5
  replayContextReady,
6
6
  runWithReplayContext,
7
7
  warnOnce
8
- } from "./chunk-OKSCUFJ6.js";
8
+ } from "./chunk-XZDYNFI5.js";
9
9
 
10
10
  // src/codeChange.ts
11
11
  var MAX_FILES = 60;
@@ -1192,4 +1192,4 @@ export {
1192
1192
  sleepForReplayPersistence,
1193
1193
  replay
1194
1194
  };
1195
- //# sourceMappingURL=chunk-LUDC6WMA.js.map
1195
+ //# sourceMappingURL=chunk-6LG3OFIX.js.map
@@ -14,7 +14,7 @@ import {
14
14
  serializeValue,
15
15
  toJsonSafe,
16
16
  toJsonSafeReport
17
- } from "./chunk-LUDC6WMA.js";
17
+ } from "./chunk-6LG3OFIX.js";
18
18
  import {
19
19
  BitfabError,
20
20
  DEFAULT_SERVICE_URL,
@@ -22,7 +22,7 @@ import {
22
22
  MixedTracingError,
23
23
  getReplayContext,
24
24
  warnOnce
25
- } from "./chunk-OKSCUFJ6.js";
25
+ } from "./chunk-XZDYNFI5.js";
26
26
  import {
27
27
  __privateAdd,
28
28
  __privateGet,
@@ -1160,8 +1160,40 @@ function buildSnapshotRef(config, sdkWallClockBeforeFn) {
1160
1160
  };
1161
1161
  }
1162
1162
 
1163
+ // src/graders.ts
1164
+ var GRADER_LABELS_PATH = "/api/sdk/graderLabels";
1165
+ var GradersClient = class {
1166
+ constructor(httpClient) {
1167
+ this.httpClient = httpClient;
1168
+ }
1169
+ async getLabels(params) {
1170
+ const hasTraceIds = params.traceIds !== void 0 && params.traceIds.length > 0;
1171
+ const hasGraderId = params.graderId !== void 0;
1172
+ if (!hasTraceIds && !hasGraderId) {
1173
+ throw new BitfabError(
1174
+ "Pass traceIds, graderId, or both: there is nothing to read otherwise."
1175
+ );
1176
+ }
1177
+ const query = new URLSearchParams();
1178
+ if (params.traceIds !== void 0 && params.traceIds.length > 0) {
1179
+ query.set("traceIds", params.traceIds.join(","));
1180
+ }
1181
+ if (params.graderId !== void 0) {
1182
+ query.set("graderId", params.graderId);
1183
+ }
1184
+ if (params.limit !== void 0) {
1185
+ query.set("limit", String(params.limit));
1186
+ }
1187
+ const response = await this.httpClient.get(
1188
+ `${GRADER_LABELS_PATH}?${query.toString()}`
1189
+ );
1190
+ return response.labels;
1191
+ }
1192
+ };
1193
+
1163
1194
  // src/labels.ts
1164
1195
  var LABELS_PATH = "/api/sdk/traces/labels";
1196
+ var HUMAN_LABELS_PATH = "/api/sdk/traces/labels/human";
1165
1197
  var LabelsClient = class {
1166
1198
  constructor(httpClient) {
1167
1199
  this.httpClient = httpClient;
@@ -1180,6 +1212,28 @@ var LabelsClient = class {
1180
1212
  );
1181
1213
  return response.labels;
1182
1214
  }
1215
+ async saveHuman(update) {
1216
+ const [outcome] = await this.saveHumanAll([update]);
1217
+ return outcome;
1218
+ }
1219
+ async saveHumanAll(updates) {
1220
+ const response = await this.httpClient.request(HUMAN_LABELS_PATH, { labels: updates });
1221
+ return response.labels;
1222
+ }
1223
+ async get(traceId) {
1224
+ const [labels] = await this.getAll([traceId]);
1225
+ return labels ?? null;
1226
+ }
1227
+ async getAll(traceIds) {
1228
+ if (traceIds.length === 0) {
1229
+ return [];
1230
+ }
1231
+ const query = new URLSearchParams({ traceIds: traceIds.join(",") });
1232
+ const response = await this.httpClient.get(
1233
+ `${LABELS_PATH}?${query.toString()}`
1234
+ );
1235
+ return response.labels;
1236
+ }
1183
1237
  };
1184
1238
 
1185
1239
  // src/langgraph.ts
@@ -2934,6 +2988,7 @@ var Bitfab = class {
2934
2988
  this.datasets = new DatasetsClient(this.httpClient);
2935
2989
  this.traces = new TracesClient(this.httpClient);
2936
2990
  this.labels = new LabelsClient(this.httpClient);
2991
+ this.graders = new GradersClient(this.httpClient);
2937
2992
  }
2938
2993
  /**
2939
2994
  * Decorate a class method as an automatically expanded trace root.
@@ -4500,7 +4555,7 @@ var Bitfab = class {
4500
4555
  await runWithSeedContext({ traceId }, async () => target(...args));
4501
4556
  } finally {
4502
4557
  try {
4503
- const { flushTraces: flushTraces2 } = await import("./http-MO5ZRPA6.js");
4558
+ const { flushTraces: flushTraces2 } = await import("./http-PFP2EQVE.js");
4504
4559
  await flushTraces2(3e4);
4505
4560
  } finally {
4506
4561
  unrecorded = activeTraceStates.delete(traceId);
@@ -4528,7 +4583,7 @@ var Bitfab = class {
4528
4583
  `Function is wrapped with trace function key '${wrappedKey}' but replay was called with '${traceFunctionKey}'. Pass matching keys, or pass the unwrapped function to replay it under the explicit key.`
4529
4584
  );
4530
4585
  }
4531
- const { replay: doReplay } = await import("./replay-QFH4XW4T.js");
4586
+ const { replay: doReplay } = await import("./replay-AFX7ENZI.js");
4532
4587
  return doReplay(
4533
4588
  this.httpClient,
4534
4589
  this.serviceUrl,
@@ -4794,7 +4849,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
4794
4849
  sessionId: seedCase.sessionId
4795
4850
  })
4796
4851
  );
4797
- const { flushTraces: flushTraces2 } = await import("./http-MO5ZRPA6.js");
4852
+ const { flushTraces: flushTraces2 } = await import("./http-PFP2EQVE.js");
4798
4853
  await flushTraces2(3e4);
4799
4854
  return { pipeline, traceFunctionKey, traceIds };
4800
4855
  }
@@ -4814,6 +4869,7 @@ export {
4814
4869
  BitfabClaudeAgentHandler,
4815
4870
  DatasetsClient,
4816
4871
  SUPPORTED_PROVIDERS,
4872
+ GradersClient,
4817
4873
  LabelsClient,
4818
4874
  BitfabLangGraphCallbackHandler,
4819
4875
  BitfabLangGraphIntegration,
@@ -4829,4 +4885,4 @@ export {
4829
4885
  defineReplayRegistry,
4830
4886
  seedFromRegistry
4831
4887
  };
4832
- //# sourceMappingURL=chunk-ZIPITG22.js.map
4888
+ //# sourceMappingURL=chunk-BT4RNCQL.js.map