firegoat 0.31.0 → 0.32.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 (2) hide show
  1. package/dist/cli.js +31 -1
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -6947,7 +6947,7 @@ var require_public_api = __commonJS(function(exports) {
6947
6947
  // package.json
6948
6948
  var package_default = {
6949
6949
  name: "firegoat",
6950
- version: "0.31.0",
6950
+ version: "0.32.0",
6951
6951
  repository: {
6952
6952
  type: "git",
6953
6953
  url: "git+https://github.com/firegoat-ai/firegoat-cli.git"
@@ -10716,6 +10716,30 @@ function runModel(r) {
10716
10716
  reported: label(r.reportedModel, "Reported model")
10717
10717
  };
10718
10718
  }
10719
+ var MAX_INT = 2147483647;
10720
+ function count(v, what) {
10721
+ if (v === null)
10722
+ return null;
10723
+ if (!Number.isInteger(v) || v < 0 || v > MAX_INT)
10724
+ throw new Error(`${what} is ${v}, the upload takes an integer from 0 to ${MAX_INT}`);
10725
+ return v;
10726
+ }
10727
+ function runTokens(t) {
10728
+ return {
10729
+ input: count(t.input, "Input tokens"),
10730
+ output: count(t.output, "Output tokens"),
10731
+ cacheRead: count(t.cacheRead, "Cache read tokens"),
10732
+ cacheWrite: count(t.cacheWrite, "Cache write tokens"),
10733
+ total: count(t.total, "Total tokens")
10734
+ };
10735
+ }
10736
+ function runPoints(r) {
10737
+ const rewardPoints = count(r.rewardPoints, "Reward points");
10738
+ const rewardPointsMax = count(r.rewardPointsMax, "Reward points max");
10739
+ if (rewardPoints !== null && rewardPointsMax !== null && rewardPoints > rewardPointsMax)
10740
+ throw new Error(`Reward points ${rewardPoints} are over the run's max ${rewardPointsMax}`);
10741
+ return { rewardPoints, rewardPointsMax };
10742
+ }
10719
10743
  function runGit(g) {
10720
10744
  if (g.commit !== null && !COMMIT.test(g.commit))
10721
10745
  throw new Error(`Git commit ${printable(g.commit, 80)} is not 4-64 lowercase hex characters`);
@@ -10780,9 +10804,13 @@ async function uploadRun(t, r) {
10780
10804
  let project;
10781
10805
  let model;
10782
10806
  let git;
10807
+ let tokens;
10808
+ let points;
10783
10809
  try {
10784
10810
  project = projectName(t.project);
10785
10811
  model = runModel(r);
10812
+ tokens = runTokens(r.tokens);
10813
+ points = runPoints(r);
10786
10814
  git = t.git ? runGit(t.git) : undefined;
10787
10815
  } catch (e) {
10788
10816
  return { status: "failed", error: e.message };
@@ -10806,6 +10834,8 @@ async function uploadRun(t, r) {
10806
10834
  duration_ms: r.durationMs,
10807
10835
  harness: r.harness,
10808
10836
  model,
10837
+ tokens,
10838
+ ...points,
10809
10839
  ...git && { git }
10810
10840
  },
10811
10841
  files: Object.fromEntries(FILES.map((f) => [f, bytes[f].byteLength]))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firegoat",
3
- "version": "0.31.0",
3
+ "version": "0.32.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/firegoat-ai/firegoat-cli.git"