bitfab 0.64.7 → 0.64.9

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/cloudReplay.py +121 -12
  2. package/dist/{chunk-FZ7SSJ7S.js → chunk-7J3XIMC3.js} +3 -3
  3. package/dist/{chunk-TAGNRN6F.js → chunk-CPRLBQ2W.js} +2 -2
  4. package/dist/{chunk-TAGNRN6F.js.map → chunk-CPRLBQ2W.js.map} +1 -1
  5. package/dist/{chunk-DIOPUOV3.js → chunk-EJVBVUH4.js} +32 -8
  6. package/dist/chunk-EJVBVUH4.js.map +1 -0
  7. package/dist/{chunk-SZVZU3F6.js → chunk-L3LFRGPX.js} +2 -2
  8. package/dist/{chunk-RYZO7Q3P.js → chunk-NFMXJT4W.js} +2 -2
  9. package/dist/{chunk-RYZO7Q3P.js.map → chunk-NFMXJT4W.js.map} +1 -1
  10. package/dist/{http-YUNQFRQY.js → http-47AVLP6D.js} +2 -2
  11. package/dist/{http-QVLMJVZT.js → http-UOFHA334.js} +2 -2
  12. package/dist/index.cjs +28 -3
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +13 -11
  15. package/dist/index.d.ts +13 -11
  16. package/dist/index.js +3 -3
  17. package/dist/node.cjs +28 -3
  18. package/dist/node.cjs.map +1 -1
  19. package/dist/node.d.cts +1 -1
  20. package/dist/node.d.ts +1 -1
  21. package/dist/node.js +3 -3
  22. package/dist/{replay-PN6MNLGK.js → replay-WLGXE5GZ.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-DIOPUOV3.js.map +0 -1
  27. /package/dist/{chunk-FZ7SSJ7S.js.map → chunk-7J3XIMC3.js.map} +0 -0
  28. /package/dist/{chunk-SZVZU3F6.js.map → chunk-L3LFRGPX.js.map} +0 -0
  29. /package/dist/{http-QVLMJVZT.js.map → http-47AVLP6D.js.map} +0 -0
  30. /package/dist/{http-YUNQFRQY.js.map → http-UOFHA334.js.map} +0 -0
  31. /package/dist/{replay-PN6MNLGK.js.map → replay-WLGXE5GZ.js.map} +0 -0
@@ -7,7 +7,7 @@ import {
7
7
  flushTraces,
8
8
  parseRetryAfterMs,
9
9
  serializePayloadBody
10
- } from "./chunk-TAGNRN6F.js";
10
+ } from "./chunk-CPRLBQ2W.js";
11
11
  import "./chunk-MT36GJMW.js";
12
12
  export {
13
13
  BitfabError,
@@ -19,4 +19,4 @@ export {
19
19
  parseRetryAfterMs,
20
20
  serializePayloadBody
21
21
  };
22
- //# sourceMappingURL=http-YUNQFRQY.js.map
22
+ //# sourceMappingURL=http-47AVLP6D.js.map
@@ -7,7 +7,7 @@ import {
7
7
  flushTraces,
8
8
  parseRetryAfterMs,
9
9
  serializePayloadBody
10
- } from "./chunk-RYZO7Q3P.js";
10
+ } from "./chunk-NFMXJT4W.js";
11
11
  export {
12
12
  BitfabError,
13
13
  HttpClient,
@@ -18,4 +18,4 @@ export {
18
18
  parseRetryAfterMs,
19
19
  serializePayloadBody
20
20
  };
21
- //# sourceMappingURL=http-QVLMJVZT.js.map
21
+ //# sourceMappingURL=http-UOFHA334.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.64.7";
54
+ __version__ = "0.64.9";
55
55
  __packageName__ = "bitfab";
56
56
  }
57
57
  });
@@ -7055,9 +7055,34 @@ var GradersClient = class {
7055
7055
  init_http();
7056
7056
 
7057
7057
  // src/labels.ts
7058
+ init_errors();
7058
7059
  init_http();
7059
7060
  var LABELS_PATH = "/api/sdk/traces/labels";
7060
7061
  var HUMAN_LABELS_PATH = "/api/sdk/traces/labels/human";
7062
+ function assertEveryVerdictNamesAnAssertion(updates) {
7063
+ const unscoped = updates.filter(
7064
+ (update) => !("archive" in update && update.archive === true) && (typeof update.assertionId !== "string" || update.assertionId === "")
7065
+ );
7066
+ if (unscoped.length > 0) {
7067
+ const targets = unscoped.map(
7068
+ (update) => update.traceId ?? update.originalTraceId
7069
+ );
7070
+ throw new BitfabError(
7071
+ `Agent verdicts must name an assertion: ${targets.join(", ")}. Pass the assertionId of the assertion each verdict scores to labels.save, saveAll, and skip. Only archive may omit it, to clear an old whole-trace verdict.`
7072
+ );
7073
+ }
7074
+ }
7075
+ function assertEveryHumanVerdictNamesAnAssertion(updates) {
7076
+ const unscoped = updates.filter(
7077
+ (update) => typeof update.assertionId !== "string" || update.assertionId === ""
7078
+ );
7079
+ if (unscoped.length > 0) {
7080
+ const targets = unscoped.map((update) => update.traceId);
7081
+ throw new BitfabError(
7082
+ `Human verdicts must name an assertion: ${targets.join(", ")}. Pass the assertionId of the assertion each verdict scores to labels.saveHuman and saveHumanAll.`
7083
+ );
7084
+ }
7085
+ }
7061
7086
  function labelEvidencePath(traceId, assertionId) {
7062
7087
  return `/api/sdk/traces/${encodeURIComponent(traceId)}/assertions/${encodeURIComponent(assertionId)}/evidence`;
7063
7088
  }
@@ -7070,6 +7095,7 @@ var LabelsClient = class {
7070
7095
  return outcome;
7071
7096
  }
7072
7097
  async saveAll(updates, experimentId) {
7098
+ assertEveryVerdictNamesAnAssertion(updates);
7073
7099
  const response = await this.httpClient.request(
7074
7100
  LABELS_PATH,
7075
7101
  {
@@ -7079,11 +7105,9 @@ var LabelsClient = class {
7079
7105
  );
7080
7106
  return response.labels;
7081
7107
  }
7082
- /** Withhold a verdict for a trace or replay attempt whose check did not run. */
7083
7108
  async skip(target, experimentId) {
7084
7109
  return this.save({ ...target, skip: true }, experimentId);
7085
7110
  }
7086
- /** Clear a previous verdict for a trace, replay attempt, or assertion. */
7087
7111
  async archive(target, experimentId) {
7088
7112
  return this.save({ ...target, archive: true }, experimentId);
7089
7113
  }
@@ -7092,6 +7116,7 @@ var LabelsClient = class {
7092
7116
  return outcome;
7093
7117
  }
7094
7118
  async saveHumanAll(updates) {
7119
+ assertEveryHumanVerdictNamesAnAssertion(updates);
7095
7120
  const response = await this.httpClient.request(HUMAN_LABELS_PATH, { labels: updates });
7096
7121
  return response.labels;
7097
7122
  }