braintrust 0.0.80 → 0.0.82

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.
@@ -3,14 +3,6 @@
3
3
  > run-p build:*
4
4
 
5
5
 
6
- > braintrust@0.0.63 build:browser /Users/ankur/projects/braintrust/sdk/js
7
- > esbuild --bundle src/browser.ts --outfile=dist/browser.js --format=esm
8
-
9
-
10
- > braintrust@0.0.63 build:declarations /Users/ankur/projects/braintrust/sdk/js
11
- > tsc --declaration --emitDeclarationOnly --outDir dist
12
-
13
-
14
6
  > braintrust@0.0.63 build:cli /Users/ankur/projects/braintrust/sdk/js
15
7
  > esbuild --platform=node --bundle src/cli.ts --outfile=dist/cli.js --external:esbuild
16
8
 
@@ -19,14 +11,22 @@
19
11
  > esbuild --platform=node --bundle src/index.ts --outfile=dist/index.js
20
12
 
21
13
 
22
- dist/browser.js 47.5kb
14
+ > braintrust@0.0.63 build:browser /Users/ankur/projects/braintrust/sdk/js
15
+ > esbuild --bundle src/browser.ts --outfile=dist/browser.js --format=esm
16
+
17
+
18
+ > braintrust@0.0.63 build:declarations /Users/ankur/projects/braintrust/sdk/js
19
+ > tsc --declaration --emitDeclarationOnly --outDir dist
20
+
21
+
22
+ dist/browser.js 47.6kb
23
23
 
24
- ⚡ Done in 13ms
24
+ ⚡ Done in 10ms
25
25
 
26
- dist/index.js 309.5kb
26
+ dist/index.js 310.1kb
27
27
 
28
- ⚡ Done in 34ms
28
+ ⚡ Done in 23ms
29
29
 
30
- dist/cli.js 544.6kb
30
+ dist/cli.js 545.4kb
31
31
 
32
- ⚡ Done in 42ms
32
+ ⚡ Done in 32ms
package/dist/browser.js CHANGED
@@ -22,7 +22,7 @@ var iso = {
22
22
  };
23
23
  var isomorph_default = iso;
24
24
 
25
- // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-browser/rng.js
25
+ // ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/rng.js
26
26
  var getRandomValues;
27
27
  var rnds8 = new Uint8Array(16);
28
28
  function rng() {
@@ -35,22 +35,22 @@ function rng() {
35
35
  return getRandomValues(rnds8);
36
36
  }
37
37
 
38
- // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-browser/stringify.js
38
+ // ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/stringify.js
39
39
  var byteToHex = [];
40
40
  for (let i = 0; i < 256; ++i) {
41
41
  byteToHex.push((i + 256).toString(16).slice(1));
42
42
  }
43
43
  function unsafeStringify(arr, offset = 0) {
44
- return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
44
+ return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
45
45
  }
46
46
 
47
- // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-browser/native.js
47
+ // ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/native.js
48
48
  var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
49
49
  var native_default = {
50
50
  randomUUID
51
51
  };
52
52
 
53
- // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-browser/v4.js
53
+ // ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/v4.js
54
54
  function v4(options, buf, offset) {
55
55
  if (native_default.randomUUID && !buf && !options) {
56
56
  return native_default.randomUUID();
@@ -70,58 +70,40 @@ function v4(options, buf, offset) {
70
70
  }
71
71
  var v4_default = v4;
72
72
 
73
- // src/util.ts
73
+ // ../core/js/dist/index.mjs
74
74
  var TRANSACTION_ID_FIELD = "_xact_id";
75
75
  var IS_MERGE_FIELD = "_is_merge";
76
- var GLOBAL_PROJECT = "Global";
77
- function runFinally(f, finallyF) {
78
- let runSyncCleanup = true;
79
- try {
80
- const ret = f();
81
- if (ret instanceof Promise) {
82
- runSyncCleanup = false;
83
- return ret.finally(finallyF);
84
- } else {
85
- return ret;
86
- }
87
- } finally {
88
- if (runSyncCleanup) {
89
- finallyF();
90
- }
91
- }
92
- }
93
76
  function mergeDicts(mergeInto, mergeFrom) {
94
77
  for (const [k, mergeFromV] of Object.entries(mergeFrom)) {
95
78
  const mergeIntoV = mergeInto[k];
96
79
  if (mergeIntoV instanceof Object && !Array.isArray(mergeIntoV) && mergeFrom instanceof Object && !Array.isArray(mergeFromV)) {
97
- mergeDicts(mergeIntoV, mergeFromV);
80
+ mergeDicts(
81
+ mergeIntoV,
82
+ mergeFromV
83
+ );
98
84
  } else {
99
85
  mergeInto[k] = mergeFromV;
100
86
  }
101
87
  }
102
88
  }
103
- function getCurrentUnixTimestamp() {
104
- return (/* @__PURE__ */ new Date()).getTime() / 1e3;
105
- }
106
-
107
- // src/merge_row_batch.ts
108
- var DATA_OBJECT_KEYS = [
109
- "org_id",
110
- "project_id",
111
- "experiment_id",
112
- "dataset_id",
113
- "prompt_session_id",
114
- "log_id"
115
- ];
116
- function generateUniqueRowKey(row) {
117
- const coalesceEmpty = (field) => row[field] ?? "";
118
- return DATA_OBJECT_KEYS.concat(["id"]).map(coalesceEmpty).join(":");
89
+ function generateMergedRowKey(row) {
90
+ return JSON.stringify(
91
+ [
92
+ "org_id",
93
+ "project_id",
94
+ "experiment_id",
95
+ "dataset_id",
96
+ "prompt_session_id",
97
+ "log_id",
98
+ "id"
99
+ ].map((k) => row[k])
100
+ );
119
101
  }
120
102
  function mergeRowBatch(rows) {
121
103
  const out = [];
122
104
  const remainingRows = [];
123
105
  for (const row of rows) {
124
- if (row["id"] === void 0) {
106
+ if (row.id === void 0) {
125
107
  out.push(row);
126
108
  } else {
127
109
  remainingRows.push(row);
@@ -129,7 +111,7 @@ function mergeRowBatch(rows) {
129
111
  }
130
112
  const rowGroups = {};
131
113
  for (const row of remainingRows) {
132
- const key = generateUniqueRowKey(row);
114
+ const key = generateMergedRowKey(row);
133
115
  const existingRow = rowGroups[key];
134
116
  if (existingRow !== void 0 && row[IS_MERGE_FIELD]) {
135
117
  const preserveNoMerge = !existingRow[IS_MERGE_FIELD];
@@ -145,6 +127,28 @@ function mergeRowBatch(rows) {
145
127
  return out;
146
128
  }
147
129
 
130
+ // src/util.ts
131
+ var GLOBAL_PROJECT = "Global";
132
+ function runFinally(f, finallyF) {
133
+ let runSyncCleanup = true;
134
+ try {
135
+ const ret = f();
136
+ if (ret instanceof Promise) {
137
+ runSyncCleanup = false;
138
+ return ret.finally(finallyF);
139
+ } else {
140
+ return ret;
141
+ }
142
+ } finally {
143
+ if (runSyncCleanup) {
144
+ finallyF();
145
+ }
146
+ }
147
+ }
148
+ function getCurrentUnixTimestamp() {
149
+ return (/* @__PURE__ */ new Date()).getTime() / 1e3;
150
+ }
151
+
148
152
  // src/logger.ts
149
153
  var NoopSpan = class {
150
154
  constructor() {
@@ -175,7 +179,9 @@ var BraintrustState = class {
175
179
  this.currentExperiment = isomorph_default.newAsyncLocalStorage();
176
180
  this.currentLogger = isomorph_default.newAsyncLocalStorage();
177
181
  this.currentSpan = isomorph_default.newAsyncLocalStorage();
178
- this.currentSpan.enterWith(noopSpan);
182
+ if (this.currentSpan.enterWith) {
183
+ this.currentSpan.enterWith(noopSpan);
184
+ }
179
185
  this.apiUrl = null;
180
186
  this.loginToken = null;
181
187
  this.orgId = null;
@@ -555,7 +561,8 @@ async function init(project, options = {}) {
555
561
  apiUrl,
556
562
  apiKey,
557
563
  orgName,
558
- disableCache
564
+ disableCache,
565
+ metadata
559
566
  } = options || {};
560
567
  await login({
561
568
  orgName,
@@ -569,7 +576,8 @@ async function init(project, options = {}) {
569
576
  dataset,
570
577
  update,
571
578
  baseExperiment,
572
- isPublic
579
+ isPublic,
580
+ metadata
573
581
  });
574
582
  }
575
583
  async function withExperiment(project, callback, options = {}) {
@@ -723,7 +731,7 @@ function currentLogger() {
723
731
  return _state.currentLogger.getStore();
724
732
  }
725
733
  function currentSpan() {
726
- return _state.currentSpan.getStore();
734
+ return _state.currentSpan.getStore() ?? noopSpan;
727
735
  }
728
736
  function startSpan(args) {
729
737
  const { name: nameOpt, ...argsRest } = args ?? {};
@@ -867,12 +875,14 @@ async function _initExperiment(projectName, {
867
875
  dataset,
868
876
  update,
869
877
  baseExperiment,
870
- isPublic
878
+ isPublic,
879
+ metadata
871
880
  } = {
872
881
  experimentName: void 0,
873
882
  description: void 0,
874
883
  baseExperiment: void 0,
875
- isPublic: false
884
+ isPublic: false,
885
+ metadata: void 0
876
886
  }) {
877
887
  const args = {
878
888
  project_name: projectName,
@@ -903,6 +913,9 @@ async function _initExperiment(projectName, {
903
913
  if (isPublic !== void 0) {
904
914
  args["public"] = isPublic;
905
915
  }
916
+ if (metadata) {
917
+ args["metadata"] = metadata;
918
+ }
906
919
  let response = null;
907
920
  while (true) {
908
921
  try {
package/dist/cli.js CHANGED
@@ -9064,7 +9064,7 @@ var require_package = __commonJS({
9064
9064
  "package.json"(exports2, module2) {
9065
9065
  module2.exports = {
9066
9066
  name: "braintrust",
9067
- version: "0.0.80",
9067
+ version: "0.0.82",
9068
9068
  description: "SDK for integrating Braintrust",
9069
9069
  main: "./dist/index.js",
9070
9070
  browser: {
@@ -9095,28 +9095,28 @@ var require_package = __commonJS({
9095
9095
  license: "MIT",
9096
9096
  devDependencies: {
9097
9097
  "@nodelib/fs.walk": "^1.2.8",
9098
- "@types/argparse": "^2.0.10",
9099
- "@types/cli-progress": "^3.11.0",
9100
- "@types/graceful-fs": "^4.1.6",
9101
- "@types/node": "^20.4.1",
9098
+ "@types/argparse": "^2.0.14",
9099
+ "@types/cli-progress": "^3.11.5",
9100
+ "@types/graceful-fs": "^4.1.9",
9101
+ "@types/node": "^20.10.5",
9102
9102
  "@types/pluralize": "^0.0.30",
9103
- "@types/uuid": "^9.0.2",
9103
+ "@types/uuid": "^9.0.7",
9104
9104
  "npm-run-all": "^4.1.5",
9105
- typedoc: "^0.24.8",
9106
- "typedoc-plugin-markdown": "^3.15.3",
9107
- typescript: "^5.1.6"
9105
+ typedoc: "^0.25.4",
9106
+ "typedoc-plugin-markdown": "^3.17.1",
9107
+ typescript: "^5.3.3"
9108
9108
  },
9109
9109
  dependencies: {
9110
- "@braintrust/core": "^0.0.6",
9110
+ "@braintrust/core": "^0.0.7",
9111
9111
  argparse: "^2.0.1",
9112
9112
  chalk: "^4.1.2",
9113
9113
  "cli-progress": "^3.12.0",
9114
- esbuild: "^0.18.19",
9114
+ esbuild: "^0.18.20",
9115
9115
  "graceful-fs": "^4.2.11",
9116
9116
  minimatch: "^9.0.3",
9117
9117
  pluralize: "^8.0.0",
9118
- "simple-git": "^3.19.1",
9119
- uuid: "^9.0.0"
9118
+ "simple-git": "^3.21.0",
9119
+ uuid: "^9.0.1"
9120
9120
  }
9121
9121
  };
9122
9122
  }
@@ -9127,7 +9127,7 @@ var esbuild = __toESM(require("esbuild"));
9127
9127
  var import_fs = __toESM(require("fs"));
9128
9128
  var import_os = __toESM(require("os"));
9129
9129
  var import_path = __toESM(require("path"));
9130
- var import_util3 = __toESM(require("util"));
9130
+ var import_util2 = __toESM(require("util"));
9131
9131
  var fsWalk = __toESM(require_out3());
9132
9132
 
9133
9133
  // ../../node_modules/.pnpm/minimatch@9.0.3/node_modules/minimatch/dist/mjs/index.js
@@ -10457,7 +10457,7 @@ minimatch.unescape = unescape;
10457
10457
  // src/cli.ts
10458
10458
  var import_argparse = __toESM(require_argparse());
10459
10459
 
10460
- // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/rng.js
10460
+ // ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/rng.js
10461
10461
  var import_crypto = __toESM(require("crypto"));
10462
10462
  var rnds8Pool = new Uint8Array(256);
10463
10463
  var poolPtr = rnds8Pool.length;
@@ -10469,22 +10469,22 @@ function rng() {
10469
10469
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
10470
10470
  }
10471
10471
 
10472
- // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/stringify.js
10472
+ // ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/stringify.js
10473
10473
  var byteToHex = [];
10474
10474
  for (let i = 0; i < 256; ++i) {
10475
10475
  byteToHex.push((i + 256).toString(16).slice(1));
10476
10476
  }
10477
10477
  function unsafeStringify(arr, offset = 0) {
10478
- return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
10478
+ return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
10479
10479
  }
10480
10480
 
10481
- // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/native.js
10481
+ // ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/native.js
10482
10482
  var import_crypto2 = __toESM(require("crypto"));
10483
10483
  var native_default = {
10484
10484
  randomUUID: import_crypto2.default.randomUUID
10485
10485
  };
10486
10486
 
10487
- // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/v4.js
10487
+ // ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/v4.js
10488
10488
  function v4(options, buf, offset) {
10489
10489
  if (native_default.randomUUID && !buf && !options) {
10490
10490
  return native_default.randomUUID();
@@ -10507,6 +10507,63 @@ var v4_default = v4;
10507
10507
  // src/cli.ts
10508
10508
  var import_pluralize2 = __toESM(require_pluralize());
10509
10509
 
10510
+ // ../core/js/dist/index.mjs
10511
+ var TRANSACTION_ID_FIELD = "_xact_id";
10512
+ var IS_MERGE_FIELD = "_is_merge";
10513
+ function mergeDicts(mergeInto, mergeFrom) {
10514
+ for (const [k, mergeFromV] of Object.entries(mergeFrom)) {
10515
+ const mergeIntoV = mergeInto[k];
10516
+ if (mergeIntoV instanceof Object && !Array.isArray(mergeIntoV) && mergeFrom instanceof Object && !Array.isArray(mergeFromV)) {
10517
+ mergeDicts(
10518
+ mergeIntoV,
10519
+ mergeFromV
10520
+ );
10521
+ } else {
10522
+ mergeInto[k] = mergeFromV;
10523
+ }
10524
+ }
10525
+ }
10526
+ function generateMergedRowKey(row) {
10527
+ return JSON.stringify(
10528
+ [
10529
+ "org_id",
10530
+ "project_id",
10531
+ "experiment_id",
10532
+ "dataset_id",
10533
+ "prompt_session_id",
10534
+ "log_id",
10535
+ "id"
10536
+ ].map((k) => row[k])
10537
+ );
10538
+ }
10539
+ function mergeRowBatch(rows) {
10540
+ const out = [];
10541
+ const remainingRows = [];
10542
+ for (const row of rows) {
10543
+ if (row.id === void 0) {
10544
+ out.push(row);
10545
+ } else {
10546
+ remainingRows.push(row);
10547
+ }
10548
+ }
10549
+ const rowGroups = {};
10550
+ for (const row of remainingRows) {
10551
+ const key = generateMergedRowKey(row);
10552
+ const existingRow = rowGroups[key];
10553
+ if (existingRow !== void 0 && row[IS_MERGE_FIELD]) {
10554
+ const preserveNoMerge = !existingRow[IS_MERGE_FIELD];
10555
+ mergeDicts(existingRow, row);
10556
+ if (preserveNoMerge) {
10557
+ delete existingRow[IS_MERGE_FIELD];
10558
+ }
10559
+ } else {
10560
+ rowGroups[key] = row;
10561
+ }
10562
+ }
10563
+ out.push(...Object.values(rowGroups));
10564
+ return out;
10565
+ }
10566
+
10510
10567
  // src/isomorph.ts
10511
10568
  var DefaultAsyncLocalStorage = class {
10512
10569
  constructor() {
@@ -10532,8 +10589,6 @@ var iso = {
10532
10589
  var isomorph_default = iso;
10533
10590
 
10534
10591
  // src/util.ts
10535
- var TRANSACTION_ID_FIELD = "_xact_id";
10536
- var IS_MERGE_FIELD = "_is_merge";
10537
10592
  function runFinally(f, finallyF) {
10538
10593
  let runSyncCleanup = true;
10539
10594
  try {
@@ -10550,61 +10605,10 @@ function runFinally(f, finallyF) {
10550
10605
  }
10551
10606
  }
10552
10607
  }
10553
- function mergeDicts(mergeInto, mergeFrom) {
10554
- for (const [k, mergeFromV] of Object.entries(mergeFrom)) {
10555
- const mergeIntoV = mergeInto[k];
10556
- if (mergeIntoV instanceof Object && !Array.isArray(mergeIntoV) && mergeFrom instanceof Object && !Array.isArray(mergeFromV)) {
10557
- mergeDicts(mergeIntoV, mergeFromV);
10558
- } else {
10559
- mergeInto[k] = mergeFromV;
10560
- }
10561
- }
10562
- }
10563
10608
  function getCurrentUnixTimestamp() {
10564
10609
  return (/* @__PURE__ */ new Date()).getTime() / 1e3;
10565
10610
  }
10566
10611
 
10567
- // src/merge_row_batch.ts
10568
- var DATA_OBJECT_KEYS = [
10569
- "org_id",
10570
- "project_id",
10571
- "experiment_id",
10572
- "dataset_id",
10573
- "prompt_session_id",
10574
- "log_id"
10575
- ];
10576
- function generateUniqueRowKey(row) {
10577
- const coalesceEmpty = (field) => row[field] ?? "";
10578
- return DATA_OBJECT_KEYS.concat(["id"]).map(coalesceEmpty).join(":");
10579
- }
10580
- function mergeRowBatch(rows) {
10581
- const out = [];
10582
- const remainingRows = [];
10583
- for (const row of rows) {
10584
- if (row["id"] === void 0) {
10585
- out.push(row);
10586
- } else {
10587
- remainingRows.push(row);
10588
- }
10589
- }
10590
- const rowGroups = {};
10591
- for (const row of remainingRows) {
10592
- const key = generateUniqueRowKey(row);
10593
- const existingRow = rowGroups[key];
10594
- if (existingRow !== void 0 && row[IS_MERGE_FIELD]) {
10595
- const preserveNoMerge = !existingRow[IS_MERGE_FIELD];
10596
- mergeDicts(existingRow, row);
10597
- if (preserveNoMerge) {
10598
- delete existingRow[IS_MERGE_FIELD];
10599
- }
10600
- } else {
10601
- rowGroups[key] = row;
10602
- }
10603
- }
10604
- out.push(...Object.values(rowGroups));
10605
- return out;
10606
- }
10607
-
10608
10612
  // src/logger.ts
10609
10613
  var NoopSpan = class {
10610
10614
  constructor() {
@@ -10635,7 +10639,9 @@ var BraintrustState = class {
10635
10639
  this.currentExperiment = isomorph_default.newAsyncLocalStorage();
10636
10640
  this.currentLogger = isomorph_default.newAsyncLocalStorage();
10637
10641
  this.currentSpan = isomorph_default.newAsyncLocalStorage();
10638
- this.currentSpan.enterWith(noopSpan);
10642
+ if (this.currentSpan.enterWith) {
10643
+ this.currentSpan.enterWith(noopSpan);
10644
+ }
10639
10645
  this.apiUrl = null;
10640
10646
  this.loginToken = null;
10641
10647
  this.orgId = null;
@@ -10914,7 +10920,8 @@ async function init(project, options = {}) {
10914
10920
  apiUrl,
10915
10921
  apiKey,
10916
10922
  orgName,
10917
- disableCache
10923
+ disableCache,
10924
+ metadata
10918
10925
  } = options || {};
10919
10926
  await login({
10920
10927
  orgName,
@@ -10928,7 +10935,8 @@ async function init(project, options = {}) {
10928
10935
  dataset,
10929
10936
  update,
10930
10937
  baseExperiment,
10931
- isPublic
10938
+ isPublic,
10939
+ metadata
10932
10940
  });
10933
10941
  }
10934
10942
  async function login(options = {}) {
@@ -10984,7 +10992,7 @@ function currentLogger() {
10984
10992
  return _state.currentLogger.getStore();
10985
10993
  }
10986
10994
  function currentSpan() {
10987
- return _state.currentSpan.getStore();
10995
+ return _state.currentSpan.getStore() ?? noopSpan;
10988
10996
  }
10989
10997
  function startSpan(args) {
10990
10998
  const { name: nameOpt, ...argsRest } = args ?? {};
@@ -11128,12 +11136,14 @@ async function _initExperiment(projectName, {
11128
11136
  dataset,
11129
11137
  update,
11130
11138
  baseExperiment,
11131
- isPublic
11139
+ isPublic,
11140
+ metadata
11132
11141
  } = {
11133
11142
  experimentName: void 0,
11134
11143
  description: void 0,
11135
11144
  baseExperiment: void 0,
11136
- isPublic: false
11145
+ isPublic: false,
11146
+ metadata: void 0
11137
11147
  }) {
11138
11148
  const args = {
11139
11149
  project_name: projectName,
@@ -11164,6 +11174,9 @@ async function _initExperiment(projectName, {
11164
11174
  if (isPublic !== void 0) {
11165
11175
  args["public"] = isPublic;
11166
11176
  }
11177
+ if (metadata) {
11178
+ args["metadata"] = metadata;
11179
+ }
11167
11180
  let response = null;
11168
11181
  while (true) {
11169
11182
  try {
@@ -11755,9 +11768,6 @@ var GlobalPaths = findGlobalPaths();
11755
11768
  // src/framework.ts
11756
11769
  var import_chalk = __toESM(require_source());
11757
11770
  var import_pluralize = __toESM(require_pluralize());
11758
- function evalMetadataToInitOptions(metadata) {
11759
- return { experiment: metadata?.experimentName };
11760
- }
11761
11771
  globalThis._evals = {};
11762
11772
  function serializeJSONWithPlainString(v) {
11763
11773
  if (typeof v === "string") {
@@ -11971,7 +11981,7 @@ function reportEvaluatorResult(evaluatorName, evaluatorResult, verbose) {
11971
11981
  // src/node.ts
11972
11982
  var import_node_async_hooks = require("node:async_hooks");
11973
11983
 
11974
- // ../../node_modules/.pnpm/simple-git@3.19.1/node_modules/simple-git/dist/esm/index.js
11984
+ // ../../node_modules/.pnpm/simple-git@3.21.0/node_modules/simple-git/dist/esm/index.js
11975
11985
  var import_file_exists = __toESM(require_dist(), 1);
11976
11986
  var import_debug = __toESM(require_src(), 1);
11977
11987
  var import_child_process = require("child_process");
@@ -12042,6 +12052,11 @@ var __async = (__this, __arguments, generator) => {
12042
12052
  step((generator = generator.apply(__this, __arguments)).next());
12043
12053
  });
12044
12054
  };
12055
+ function pathspec(...paths) {
12056
+ const key = new String(paths);
12057
+ cache.set(key, paths);
12058
+ return key;
12059
+ }
12045
12060
  function isPathSpec(path5) {
12046
12061
  return path5 instanceof String && cache.has(path5);
12047
12062
  }
@@ -13490,6 +13505,19 @@ var init_commit = __esm({
13490
13505
  init_task();
13491
13506
  }
13492
13507
  });
13508
+ function first_commit_default() {
13509
+ return {
13510
+ firstCommit() {
13511
+ return this._runTask(straightThroughStringTask(["rev-list", "--max-parents=0", "HEAD"], true), trailingFunctionArgument(arguments));
13512
+ }
13513
+ };
13514
+ }
13515
+ var init_first_commit = __esm({
13516
+ "src/lib/tasks/first-commit.ts"() {
13517
+ init_utils();
13518
+ init_task();
13519
+ }
13520
+ });
13493
13521
  function hashObjectTask(filePath, write) {
13494
13522
  const commands = ["hash-object", filePath];
13495
13523
  if (write) {
@@ -13823,7 +13851,7 @@ function parseLogOptions(opt = {}, customArgs = []) {
13823
13851
  suffix.push(`${opt.from || ""}${rangeOperator}${opt.to || ""}`);
13824
13852
  }
13825
13853
  if (filterString(opt.file)) {
13826
- suffix.push("--follow", opt.file);
13854
+ command.push("--follow", pathspec(opt.file));
13827
13855
  }
13828
13856
  appendTaskOptions(userOptions(opt), command);
13829
13857
  return {
@@ -13860,6 +13888,7 @@ var excludeOptions;
13860
13888
  var init_log = __esm({
13861
13889
  "src/lib/tasks/log.ts"() {
13862
13890
  init_log_format();
13891
+ init_pathspec();
13863
13892
  init_parse_list_log_summary();
13864
13893
  init_utils();
13865
13894
  init_task();
@@ -14519,6 +14548,7 @@ var init_simple_git_api = __esm({
14519
14548
  init_checkout();
14520
14549
  init_commit();
14521
14550
  init_config();
14551
+ init_first_commit();
14522
14552
  init_grep();
14523
14553
  init_hash_object();
14524
14554
  init_init();
@@ -14592,7 +14622,7 @@ var init_simple_git_api = __esm({
14592
14622
  return this._runTask(statusTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments));
14593
14623
  }
14594
14624
  };
14595
- Object.assign(SimpleGitApi.prototype, checkout_default(), commit_default(), config_default(), grep_default(), log_default(), show_default(), version_default());
14625
+ Object.assign(SimpleGitApi.prototype, checkout_default(), commit_default(), config_default(), first_commit_default(), grep_default(), log_default(), show_default(), version_default());
14596
14626
  }
14597
14627
  });
14598
14628
  var scheduler_exports = {};
@@ -16113,11 +16143,11 @@ function evaluateBuildResults(inFile, buildResult) {
16113
16143
  return { ...globalThis._evals };
16114
16144
  });
16115
16145
  }
16116
- async function initLogger(projectName, metadata) {
16117
- const logger = await init(
16118
- projectName,
16119
- evalMetadataToInitOptions(metadata)
16120
- );
16146
+ async function initLogger(projectName, experimentName, metadata) {
16147
+ const logger = await init(projectName, {
16148
+ experiment: experimentName,
16149
+ metadata
16150
+ });
16121
16151
  const info = await logger.summarize({ summarizeScores: false });
16122
16152
  console.log(`Experiment ${logger.name} is running at ${info.experimentUrl}`);
16123
16153
  return logger;
@@ -16142,7 +16172,11 @@ function buildWatchPluginForEvaluator(inFile, opts) {
16142
16172
  return;
16143
16173
  }
16144
16174
  for (const evaluator of Object.values(evalResult)) {
16145
- const logger = opts.noSendLogs ? null : await initLogger(evaluator.projectName, evaluator.metadata);
16175
+ const logger = opts.noSendLogs ? null : await initLogger(
16176
+ evaluator.projectName,
16177
+ evaluator.experimentName,
16178
+ evaluator.metadata
16179
+ );
16146
16180
  const evaluatorResult = await runEvaluator(
16147
16181
  logger,
16148
16182
  evaluator,
@@ -16244,6 +16278,7 @@ async function runOnce(handles, opts) {
16244
16278
  const resultPromises = Object.values(evaluators).map(async (evaluator) => {
16245
16279
  const logger = opts.noSendLogs ? null : await initLogger(
16246
16280
  evaluator.evaluator.projectName,
16281
+ evaluator.evaluator.experimentName,
16247
16282
  evaluator.evaluator.metadata
16248
16283
  );
16249
16284
  try {
@@ -16314,7 +16349,7 @@ async function collectFiles(inputPath) {
16314
16349
  files.push(inputPath);
16315
16350
  }
16316
16351
  } else {
16317
- const walked = await import_util3.default.promisify(fsWalk.walk)(inputPath, {
16352
+ const walked = await import_util2.default.promisify(fsWalk.walk)(inputPath, {
16318
16353
  deepFilter: (entry) => {
16319
16354
  return checkMatch(entry.path, null, EXCLUDE);
16320
16355
  },