bitfab 0.53.4 → 0.54.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.
Files changed (31) hide show
  1. package/dist/{chunk-DIYUW2KO.js → chunk-CLYCJGJE.js} +2 -2
  2. package/dist/{chunk-DIYUW2KO.js.map → chunk-CLYCJGJE.js.map} +1 -1
  3. package/dist/{chunk-53RMN23L.js → chunk-JAXMD6AP.js} +65 -16
  4. package/dist/chunk-JAXMD6AP.js.map +1 -0
  5. package/dist/{chunk-JKVR5436.js → chunk-O2OJIGL3.js} +2 -2
  6. package/dist/{chunk-RZC7MYVZ.js → chunk-SEHWHFUY.js} +2 -2
  7. package/dist/{chunk-RZC7MYVZ.js.map → chunk-SEHWHFUY.js.map} +1 -1
  8. package/dist/{chunk-YD5XI5YH.js → chunk-VQB5RCFD.js} +3 -3
  9. package/dist/{http-VRS3FQU3.js → http-G43RIR7E.js} +2 -2
  10. package/dist/{http-7WGJNBGI.js → http-RXH2N5BB.js} +2 -2
  11. package/dist/index.cjs +61 -11
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +40 -6
  14. package/dist/index.d.ts +40 -6
  15. package/dist/index.js +5 -3
  16. package/dist/node.cjs +61 -11
  17. package/dist/node.cjs.map +1 -1
  18. package/dist/node.d.cts +1 -1
  19. package/dist/node.d.ts +1 -1
  20. package/dist/node.js +5 -3
  21. package/dist/node.js.map +1 -1
  22. package/dist/{replay-LRCSZ7IX.js → replay-XQITDIRJ.js} +3 -3
  23. package/dist/replayCli.js +2 -2
  24. package/dist/seedCli.js +2 -2
  25. package/package.json +1 -1
  26. package/dist/chunk-53RMN23L.js.map +0 -1
  27. /package/dist/{chunk-JKVR5436.js.map → chunk-O2OJIGL3.js.map} +0 -0
  28. /package/dist/{chunk-YD5XI5YH.js.map → chunk-VQB5RCFD.js.map} +0 -0
  29. /package/dist/{http-7WGJNBGI.js.map → http-G43RIR7E.js.map} +0 -0
  30. /package/dist/{http-VRS3FQU3.js.map → http-RXH2N5BB.js.map} +0 -0
  31. /package/dist/{replay-LRCSZ7IX.js.map → replay-XQITDIRJ.js.map} +0 -0
@@ -19,7 +19,7 @@ import {
19
19
  serializeValue,
20
20
  toJsonSafe,
21
21
  toJsonSafeReport
22
- } from "./chunk-JKVR5436.js";
22
+ } from "./chunk-O2OJIGL3.js";
23
23
  import {
24
24
  BitfabError,
25
25
  DEFAULT_SERVICE_URL,
@@ -35,7 +35,7 @@ import {
35
35
  recordCallerTraceMetadata,
36
36
  retireTraceMetadata,
37
37
  warnOnce
38
- } from "./chunk-RZC7MYVZ.js";
38
+ } from "./chunk-SEHWHFUY.js";
39
39
  import {
40
40
  __privateAdd,
41
41
  __privateGet,
@@ -46,6 +46,36 @@ import {
46
46
  isCaptureSuppressed
47
47
  } from "./chunk-VCRFFCLY.js";
48
48
 
49
+ // src/assertionCategories.ts
50
+ var CATEGORIES_PATH = "/api/sdk/assertionCategories";
51
+ var AssertionCategoriesClient = class {
52
+ constructor(httpClient) {
53
+ this.httpClient = httpClient;
54
+ }
55
+ /** Create a category, or update it by ID. Omitted descriptions are preserved. */
56
+ async save(params) {
57
+ const response = await this.httpClient.request(CATEGORIES_PATH, params);
58
+ return response.category;
59
+ }
60
+ /** Read one category in the API key's organization. */
61
+ async get(id) {
62
+ const response = await this.httpClient.get(
63
+ `${CATEGORIES_PATH}/${encodeURIComponent(id)}`
64
+ );
65
+ return response.category;
66
+ }
67
+ /** List the organization's categories ordered by title. */
68
+ async list() {
69
+ const response = await this.httpClient.get(CATEGORIES_PATH);
70
+ return response.categories;
71
+ }
72
+ /** Delete a category and clear its assignments, preserving assertions and verdicts. */
73
+ async delete(id) {
74
+ const response = await this.httpClient.request(`${CATEGORIES_PATH}/${encodeURIComponent(id)}`, {}, { method: "DELETE" });
75
+ return response.category;
76
+ }
77
+ };
78
+
49
79
  // src/assertions.ts
50
80
  var ASSERTIONS_PATH = "/api/sdk/traces/assertions";
51
81
  function traceAssertionsPath(traceId, suffix = "") {
@@ -1290,14 +1320,24 @@ var DatasetsClient = class {
1290
1320
  }
1291
1321
  /**
1292
1322
  * List datasets, scoped to one trace function when `traceFunctionKey` is
1293
- * given and organization-wide otherwise.
1323
+ * given and organization-wide otherwise. Fetches all pages automatically.
1294
1324
  */
1295
1325
  async list(params = {}) {
1296
- const query = params.traceFunctionKey === void 0 ? "" : `?traceFunctionKey=${encodeURIComponent(params.traceFunctionKey)}`;
1297
- const response = await this.httpClient.get(
1298
- `/api/sdk/datasets${query}`
1299
- );
1300
- return response.datasets;
1326
+ const datasets = [];
1327
+ let cursor;
1328
+ do {
1329
+ const query = new URLSearchParams({ limit: "100" });
1330
+ if (params.traceFunctionKey !== void 0) {
1331
+ query.set("traceFunctionKey", params.traceFunctionKey);
1332
+ }
1333
+ if (cursor !== void 0) {
1334
+ query.set("cursor", cursor);
1335
+ }
1336
+ const response = await this.httpClient.get(`/api/sdk/datasets?${query}`);
1337
+ datasets.push(...response.datasets);
1338
+ cursor = response.nextCursor ?? void 0;
1339
+ } while (cursor !== void 0);
1340
+ return datasets;
1301
1341
  }
1302
1342
  /** Fetch one dataset by id. Rejects with a 404 `BitfabError` when it is not in this organization. */
1303
1343
  async get(datasetId) {
@@ -1306,11 +1346,18 @@ var DatasetsClient = class {
1306
1346
  );
1307
1347
  return response.dataset;
1308
1348
  }
1309
- /** The ids of every trace in the dataset, the same membership a replay with `datasetId` selects. */
1349
+ /** Fetches all trace-ID pages, the same membership a replay with `datasetId` selects. */
1310
1350
  async listTraces(datasetId) {
1311
- return this.httpClient.get(
1312
- datasetPath(datasetId, "/traces")
1313
- );
1351
+ const traceIds = [];
1352
+ const query = new URLSearchParams({ limit: "100" });
1353
+ for (; ; ) {
1354
+ const page = await this.httpClient.get(`${datasetPath(datasetId, "/traces")}?${query}`);
1355
+ traceIds.push(...page.traceIds);
1356
+ if (page.nextCursor === void 0 || page.nextCursor === null) {
1357
+ return { datasetId: page.datasetId, traceIds };
1358
+ }
1359
+ query.set("cursor", page.nextCursor);
1360
+ }
1314
1361
  }
1315
1362
  /**
1316
1363
  * Add traces to the dataset (1 to 100 ids per call). Traces outside the
@@ -3357,6 +3404,7 @@ var Bitfab = class {
3357
3404
  this.httpClient.releaseHeldExternalSpans = (timeoutMs) => this.simulationPlan.release(timeoutMs);
3358
3405
  this.httpClient.stopSimulationPlan = () => this.simulationPlan.stop();
3359
3406
  this.datasets = new DatasetsClient(this.httpClient);
3407
+ this.assertionCategories = new AssertionCategoriesClient(this.httpClient);
3360
3408
  this.traces = new TracesClient(this.httpClient);
3361
3409
  this.labels = new LabelsClient(this.httpClient);
3362
3410
  this.graders = new GradersClient(this.httpClient);
@@ -5059,7 +5107,7 @@ var Bitfab = class {
5059
5107
  await runWithSeedContext({ traceId }, async () => target(...args));
5060
5108
  } finally {
5061
5109
  try {
5062
- const { flushTraces: flushTraces2 } = await import("./http-7WGJNBGI.js");
5110
+ const { flushTraces: flushTraces2 } = await import("./http-RXH2N5BB.js");
5063
5111
  await flushTraces2(3e4);
5064
5112
  } finally {
5065
5113
  unrecorded = activeTraceStates.delete(traceId);
@@ -5118,7 +5166,7 @@ var Bitfab = class {
5118
5166
  `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.`
5119
5167
  );
5120
5168
  }
5121
- const { replay: doReplay } = await import("./replay-LRCSZ7IX.js");
5169
+ const { replay: doReplay } = await import("./replay-XQITDIRJ.js");
5122
5170
  return doReplay(
5123
5171
  this.httpClient,
5124
5172
  this.serviceUrl,
@@ -5402,7 +5450,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
5402
5450
  sessionId: seedCase.sessionId
5403
5451
  })
5404
5452
  );
5405
- const { flushTraces: flushTraces2 } = await import("./http-7WGJNBGI.js");
5453
+ const { flushTraces: flushTraces2 } = await import("./http-RXH2N5BB.js");
5406
5454
  await flushTraces2(3e4);
5407
5455
  return { pipeline, traceFunctionKey, traceIds };
5408
5456
  }
@@ -5418,6 +5466,7 @@ function resolveTraceFunctionKey(registration) {
5418
5466
  }
5419
5467
 
5420
5468
  export {
5469
+ AssertionCategoriesClient,
5421
5470
  TracesClient,
5422
5471
  BitfabClaudeAgentHandler,
5423
5472
  DatasetsClient,
@@ -5439,4 +5488,4 @@ export {
5439
5488
  reseedFromRegistry,
5440
5489
  seedFromRegistry
5441
5490
  };
5442
- //# sourceMappingURL=chunk-53RMN23L.js.map
5491
+ //# sourceMappingURL=chunk-JAXMD6AP.js.map