braintrust 0.0.141-dev1 → 0.0.141

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.
package/dist/cli.js CHANGED
@@ -27,9 +27,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // ../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/async.js
30
+ // ../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/async.js
31
31
  var require_async = __commonJS({
32
- "../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/async.js"(exports2) {
32
+ "../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/async.js"(exports2) {
33
33
  "use strict";
34
34
  Object.defineProperty(exports2, "__esModule", { value: true });
35
35
  exports2.read = void 0;
@@ -69,9 +69,9 @@ var require_async = __commonJS({
69
69
  }
70
70
  });
71
71
 
72
- // ../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/sync.js
72
+ // ../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/sync.js
73
73
  var require_sync = __commonJS({
74
- "../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/sync.js"(exports2) {
74
+ "../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/sync.js"(exports2) {
75
75
  "use strict";
76
76
  Object.defineProperty(exports2, "__esModule", { value: true });
77
77
  exports2.read = void 0;
@@ -97,9 +97,9 @@ var require_sync = __commonJS({
97
97
  }
98
98
  });
99
99
 
100
- // ../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/adapters/fs.js
100
+ // ../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/adapters/fs.js
101
101
  var require_fs = __commonJS({
102
- "../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/adapters/fs.js"(exports2) {
102
+ "../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/adapters/fs.js"(exports2) {
103
103
  "use strict";
104
104
  Object.defineProperty(exports2, "__esModule", { value: true });
105
105
  exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
@@ -120,9 +120,9 @@ var require_fs = __commonJS({
120
120
  }
121
121
  });
122
122
 
123
- // ../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js
123
+ // ../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js
124
124
  var require_settings = __commonJS({
125
- "../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js"(exports2) {
125
+ "../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js"(exports2) {
126
126
  "use strict";
127
127
  Object.defineProperty(exports2, "__esModule", { value: true });
128
128
  var fs4 = require_fs();
@@ -142,9 +142,9 @@ var require_settings = __commonJS({
142
142
  }
143
143
  });
144
144
 
145
- // ../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/index.js
145
+ // ../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/index.js
146
146
  var require_out = __commonJS({
147
- "../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/index.js"(exports2) {
147
+ "../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/index.js"(exports2) {
148
148
  "use strict";
149
149
  Object.defineProperty(exports2, "__esModule", { value: true });
150
150
  exports2.statSync = exports2.stat = exports2.Settings = void 0;
@@ -174,9 +174,9 @@ var require_out = __commonJS({
174
174
  }
175
175
  });
176
176
 
177
- // ../node_modules/.pnpm/queue-microtask@1.2.3/node_modules/queue-microtask/index.js
177
+ // ../../node_modules/.pnpm/queue-microtask@1.2.3/node_modules/queue-microtask/index.js
178
178
  var require_queue_microtask = __commonJS({
179
- "../node_modules/.pnpm/queue-microtask@1.2.3/node_modules/queue-microtask/index.js"(exports2, module2) {
179
+ "../../node_modules/.pnpm/queue-microtask@1.2.3/node_modules/queue-microtask/index.js"(exports2, module2) {
180
180
  "use strict";
181
181
  var promise;
182
182
  module2.exports = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : global) : (cb) => (promise || (promise = Promise.resolve())).then(cb).catch((err) => setTimeout(() => {
@@ -185,9 +185,9 @@ var require_queue_microtask = __commonJS({
185
185
  }
186
186
  });
187
187
 
188
- // ../node_modules/.pnpm/run-parallel@1.2.0/node_modules/run-parallel/index.js
188
+ // ../../node_modules/.pnpm/run-parallel@1.2.0/node_modules/run-parallel/index.js
189
189
  var require_run_parallel = __commonJS({
190
- "../node_modules/.pnpm/run-parallel@1.2.0/node_modules/run-parallel/index.js"(exports2, module2) {
190
+ "../../node_modules/.pnpm/run-parallel@1.2.0/node_modules/run-parallel/index.js"(exports2, module2) {
191
191
  "use strict";
192
192
  module2.exports = runParallel;
193
193
  var queueMicrotask2 = require_queue_microtask();
@@ -239,9 +239,9 @@ var require_run_parallel = __commonJS({
239
239
  }
240
240
  });
241
241
 
242
- // ../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/constants.js
242
+ // ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/constants.js
243
243
  var require_constants = __commonJS({
244
- "../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/constants.js"(exports2) {
244
+ "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/constants.js"(exports2) {
245
245
  "use strict";
246
246
  Object.defineProperty(exports2, "__esModule", { value: true });
247
247
  exports2.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0;
@@ -259,9 +259,9 @@ var require_constants = __commonJS({
259
259
  }
260
260
  });
261
261
 
262
- // ../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/utils/fs.js
262
+ // ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/utils/fs.js
263
263
  var require_fs2 = __commonJS({
264
- "../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/utils/fs.js"(exports2) {
264
+ "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/utils/fs.js"(exports2) {
265
265
  "use strict";
266
266
  Object.defineProperty(exports2, "__esModule", { value: true });
267
267
  exports2.createDirentFromStats = void 0;
@@ -284,9 +284,9 @@ var require_fs2 = __commonJS({
284
284
  }
285
285
  });
286
286
 
287
- // ../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/utils/index.js
287
+ // ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/utils/index.js
288
288
  var require_utils = __commonJS({
289
- "../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/utils/index.js"(exports2) {
289
+ "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/utils/index.js"(exports2) {
290
290
  "use strict";
291
291
  Object.defineProperty(exports2, "__esModule", { value: true });
292
292
  exports2.fs = void 0;
@@ -295,9 +295,9 @@ var require_utils = __commonJS({
295
295
  }
296
296
  });
297
297
 
298
- // ../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/common.js
298
+ // ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/common.js
299
299
  var require_common = __commonJS({
300
- "../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/common.js"(exports2) {
300
+ "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/common.js"(exports2) {
301
301
  "use strict";
302
302
  Object.defineProperty(exports2, "__esModule", { value: true });
303
303
  exports2.joinPathSegments = void 0;
@@ -311,9 +311,9 @@ var require_common = __commonJS({
311
311
  }
312
312
  });
313
313
 
314
- // ../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/async.js
314
+ // ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/async.js
315
315
  var require_async2 = __commonJS({
316
- "../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/async.js"(exports2) {
316
+ "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/async.js"(exports2) {
317
317
  "use strict";
318
318
  Object.defineProperty(exports2, "__esModule", { value: true });
319
319
  exports2.readdir = exports2.readdirWithFileTypes = exports2.read = void 0;
@@ -421,9 +421,9 @@ var require_async2 = __commonJS({
421
421
  }
422
422
  });
423
423
 
424
- // ../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/sync.js
424
+ // ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/sync.js
425
425
  var require_sync2 = __commonJS({
426
- "../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/sync.js"(exports2) {
426
+ "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/sync.js"(exports2) {
427
427
  "use strict";
428
428
  Object.defineProperty(exports2, "__esModule", { value: true });
429
429
  exports2.readdir = exports2.readdirWithFileTypes = exports2.read = void 0;
@@ -480,9 +480,9 @@ var require_sync2 = __commonJS({
480
480
  }
481
481
  });
482
482
 
483
- // ../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/adapters/fs.js
483
+ // ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/adapters/fs.js
484
484
  var require_fs3 = __commonJS({
485
- "../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/adapters/fs.js"(exports2) {
485
+ "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/adapters/fs.js"(exports2) {
486
486
  "use strict";
487
487
  Object.defineProperty(exports2, "__esModule", { value: true });
488
488
  exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
@@ -505,9 +505,9 @@ var require_fs3 = __commonJS({
505
505
  }
506
506
  });
507
507
 
508
- // ../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/settings.js
508
+ // ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/settings.js
509
509
  var require_settings2 = __commonJS({
510
- "../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/settings.js"(exports2) {
510
+ "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/settings.js"(exports2) {
511
511
  "use strict";
512
512
  Object.defineProperty(exports2, "__esModule", { value: true });
513
513
  var path5 = require("path");
@@ -535,9 +535,9 @@ var require_settings2 = __commonJS({
535
535
  }
536
536
  });
537
537
 
538
- // ../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/index.js
538
+ // ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/index.js
539
539
  var require_out2 = __commonJS({
540
- "../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/index.js"(exports2) {
540
+ "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/index.js"(exports2) {
541
541
  "use strict";
542
542
  Object.defineProperty(exports2, "__esModule", { value: true });
543
543
  exports2.Settings = exports2.scandirSync = exports2.scandir = void 0;
@@ -567,9 +567,9 @@ var require_out2 = __commonJS({
567
567
  }
568
568
  });
569
569
 
570
- // ../node_modules/.pnpm/reusify@1.0.4/node_modules/reusify/reusify.js
570
+ // ../../node_modules/.pnpm/reusify@1.0.4/node_modules/reusify/reusify.js
571
571
  var require_reusify = __commonJS({
572
- "../node_modules/.pnpm/reusify@1.0.4/node_modules/reusify/reusify.js"(exports2, module2) {
572
+ "../../node_modules/.pnpm/reusify@1.0.4/node_modules/reusify/reusify.js"(exports2, module2) {
573
573
  "use strict";
574
574
  function reusify(Constructor) {
575
575
  var head = new Constructor();
@@ -598,9 +598,9 @@ var require_reusify = __commonJS({
598
598
  }
599
599
  });
600
600
 
601
- // ../node_modules/.pnpm/fastq@1.16.0/node_modules/fastq/queue.js
601
+ // ../../node_modules/.pnpm/fastq@1.16.0/node_modules/fastq/queue.js
602
602
  var require_queue = __commonJS({
603
- "../node_modules/.pnpm/fastq@1.16.0/node_modules/fastq/queue.js"(exports2, module2) {
603
+ "../../node_modules/.pnpm/fastq@1.16.0/node_modules/fastq/queue.js"(exports2, module2) {
604
604
  "use strict";
605
605
  var reusify = require_reusify();
606
606
  function fastqueue(context2, worker, concurrency) {
@@ -840,9 +840,9 @@ var require_queue = __commonJS({
840
840
  }
841
841
  });
842
842
 
843
- // ../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/common.js
843
+ // ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/common.js
844
844
  var require_common2 = __commonJS({
845
- "../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/common.js"(exports2) {
845
+ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/common.js"(exports2) {
846
846
  "use strict";
847
847
  Object.defineProperty(exports2, "__esModule", { value: true });
848
848
  exports2.joinPathSegments = exports2.replacePathSegmentSeparator = exports2.isAppliedFilter = exports2.isFatalError = void 0;
@@ -874,9 +874,9 @@ var require_common2 = __commonJS({
874
874
  }
875
875
  });
876
876
 
877
- // ../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/reader.js
877
+ // ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/reader.js
878
878
  var require_reader = __commonJS({
879
- "../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/reader.js"(exports2) {
879
+ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/reader.js"(exports2) {
880
880
  "use strict";
881
881
  Object.defineProperty(exports2, "__esModule", { value: true });
882
882
  var common = require_common2();
@@ -891,9 +891,9 @@ var require_reader = __commonJS({
891
891
  }
892
892
  });
893
893
 
894
- // ../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/async.js
894
+ // ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/async.js
895
895
  var require_async3 = __commonJS({
896
- "../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/async.js"(exports2) {
896
+ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/async.js"(exports2) {
897
897
  "use strict";
898
898
  Object.defineProperty(exports2, "__esModule", { value: true });
899
899
  var events_1 = require("events");
@@ -994,9 +994,9 @@ var require_async3 = __commonJS({
994
994
  }
995
995
  });
996
996
 
997
- // ../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/async.js
997
+ // ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/async.js
998
998
  var require_async4 = __commonJS({
999
- "../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/async.js"(exports2) {
999
+ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/async.js"(exports2) {
1000
1000
  "use strict";
1001
1001
  Object.defineProperty(exports2, "__esModule", { value: true });
1002
1002
  var async_1 = require_async3();
@@ -1030,9 +1030,9 @@ var require_async4 = __commonJS({
1030
1030
  }
1031
1031
  });
1032
1032
 
1033
- // ../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/stream.js
1033
+ // ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/stream.js
1034
1034
  var require_stream = __commonJS({
1035
- "../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/stream.js"(exports2) {
1035
+ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/stream.js"(exports2) {
1036
1036
  "use strict";
1037
1037
  Object.defineProperty(exports2, "__esModule", { value: true });
1038
1038
  var stream_1 = require("stream");
@@ -1071,9 +1071,9 @@ var require_stream = __commonJS({
1071
1071
  }
1072
1072
  });
1073
1073
 
1074
- // ../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/sync.js
1074
+ // ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/sync.js
1075
1075
  var require_sync3 = __commonJS({
1076
- "../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/sync.js"(exports2) {
1076
+ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/sync.js"(exports2) {
1077
1077
  "use strict";
1078
1078
  Object.defineProperty(exports2, "__esModule", { value: true });
1079
1079
  var fsScandir = require_out2();
@@ -1135,9 +1135,9 @@ var require_sync3 = __commonJS({
1135
1135
  }
1136
1136
  });
1137
1137
 
1138
- // ../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/sync.js
1138
+ // ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/sync.js
1139
1139
  var require_sync4 = __commonJS({
1140
- "../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/sync.js"(exports2) {
1140
+ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/sync.js"(exports2) {
1141
1141
  "use strict";
1142
1142
  Object.defineProperty(exports2, "__esModule", { value: true });
1143
1143
  var sync_1 = require_sync3();
@@ -1155,9 +1155,9 @@ var require_sync4 = __commonJS({
1155
1155
  }
1156
1156
  });
1157
1157
 
1158
- // ../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/settings.js
1158
+ // ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/settings.js
1159
1159
  var require_settings3 = __commonJS({
1160
- "../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/settings.js"(exports2) {
1160
+ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/settings.js"(exports2) {
1161
1161
  "use strict";
1162
1162
  Object.defineProperty(exports2, "__esModule", { value: true });
1163
1163
  var path5 = require("path");
@@ -1187,9 +1187,9 @@ var require_settings3 = __commonJS({
1187
1187
  }
1188
1188
  });
1189
1189
 
1190
- // ../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/index.js
1190
+ // ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/index.js
1191
1191
  var require_out3 = __commonJS({
1192
- "../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/index.js"(exports2) {
1192
+ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/index.js"(exports2) {
1193
1193
  "use strict";
1194
1194
  Object.defineProperty(exports2, "__esModule", { value: true });
1195
1195
  exports2.Settings = exports2.walkStream = exports2.walkSync = exports2.walk = void 0;
@@ -1232,7 +1232,7 @@ var require_package = __commonJS({
1232
1232
  "package.json"(exports2, module2) {
1233
1233
  module2.exports = {
1234
1234
  name: "braintrust",
1235
- version: "0.0.141-dev1",
1235
+ version: "0.0.141",
1236
1236
  description: "SDK for integrating Braintrust",
1237
1237
  main: "./dist/index.js",
1238
1238
  module: "./dist/index.mjs",
@@ -1266,7 +1266,9 @@ var require_package = __commonJS({
1266
1266
  watch: "tsup --watch",
1267
1267
  clean: "rm -r dist/*",
1268
1268
  docs: "npx typedoc --options typedoc.json src/index.ts",
1269
- test: "vitest run"
1269
+ test: "vitest run",
1270
+ prepublishOnly: "../../scripts/node_prepublish_sdk.py",
1271
+ postpublish: "../../scripts/node_postpublish_sdk.py"
1270
1272
  },
1271
1273
  author: "",
1272
1274
  license: "MIT",
@@ -1294,7 +1296,7 @@ var require_package = __commonJS({
1294
1296
  },
1295
1297
  dependencies: {
1296
1298
  "@ai-sdk/provider": "^0.0.11",
1297
- "@braintrust/core": "workspace:*",
1299
+ "@braintrust/core": "0.0.45",
1298
1300
  "@next/env": "^14.2.3",
1299
1301
  "@vercel/functions": "^1.0.2",
1300
1302
  ai: "^3.2.16",
@@ -1406,27 +1408,79 @@ var LazyValue = class {
1406
1408
  return this.value.hasComputed;
1407
1409
  }
1408
1410
  };
1411
+ function _urljoin(...parts) {
1412
+ return parts.map(
1413
+ (x, i) => x.replace(/^\//, "").replace(i < parts.length - 1 ? /\/$/ : "", "")
1414
+ ).filter((x) => x.trim() !== "").join("/");
1415
+ }
1409
1416
 
1410
1417
  // src/logger.ts
1411
1418
  var import_mustache = __toESM(require("mustache"));
1412
- var import_zod = require("zod");
1419
+ var import_zod2 = require("zod");
1413
1420
 
1414
- // src/stream.ts
1421
+ // src/functions/stream.ts
1415
1422
  var import_typespecs = require("@braintrust/core/typespecs");
1416
1423
  var import_eventsource_parser = require("eventsource-parser");
1424
+ var import_zod = require("zod");
1425
+ var braintrustStreamChunkSchema = import_zod.z.union([
1426
+ import_zod.z.object({
1427
+ type: import_zod.z.literal("text_delta"),
1428
+ data: import_zod.z.string()
1429
+ }),
1430
+ import_zod.z.object({
1431
+ type: import_zod.z.literal("json_delta"),
1432
+ data: import_zod.z.string()
1433
+ })
1434
+ ]);
1417
1435
  var BraintrustStream = class _BraintrustStream {
1418
1436
  stream;
1437
+ memoizedFinalValue;
1419
1438
  constructor(baseStream) {
1420
1439
  this.stream = baseStream.pipeThrough(btStreamParser());
1421
1440
  }
1441
+ /**
1442
+ * Copy the stream. This returns a new stream that shares the same underlying
1443
+ * stream (via `tee`). Since streams are consumed in Javascript, use `copy()` if you
1444
+ * need to use the stream multiple times.
1445
+ *
1446
+ * @returns A new stream that you can independently consume.
1447
+ */
1422
1448
  copy() {
1423
1449
  const [newStream, copyStream] = this.stream.tee();
1424
1450
  this.stream = copyStream;
1425
1451
  return new _BraintrustStream(newStream);
1426
1452
  }
1453
+ /**
1454
+ * Get the underlying ReadableStream.
1455
+ *
1456
+ * @returns The underlying ReadableStream<BraintrustStreamChunk>.
1457
+ */
1427
1458
  toReadableStream() {
1428
1459
  return this.stream;
1429
1460
  }
1461
+ /**
1462
+ * Get the final value of the stream. The final value is the concatenation of all
1463
+ * the chunks in the stream, deserialized into a string or JSON object, depending on
1464
+ * the value's type.
1465
+ *
1466
+ * This function returns a promise that resolves when the stream is closed, and
1467
+ * contains the final value. Multiple calls to `finalValue()` will return the same
1468
+ * promise, so it is safe to call this multiple times.
1469
+ *
1470
+ * This function consumes the stream, so if you need to use the stream multiple
1471
+ * times, you should call `copy()` first.
1472
+ *
1473
+ * @returns A promise that resolves with the final value of the stream or `undefined` if the stream is empty.
1474
+ */
1475
+ finalValue() {
1476
+ if (this.memoizedFinalValue) {
1477
+ return this.memoizedFinalValue;
1478
+ }
1479
+ this.memoizedFinalValue = new Promise((resolve2, reject2) => {
1480
+ const stream = this.stream.pipeThrough(createFinalValuePassThroughStream(resolve2)).pipeTo(devNullWritableStream());
1481
+ });
1482
+ return this.memoizedFinalValue;
1483
+ }
1430
1484
  };
1431
1485
  function btStreamParser() {
1432
1486
  const decoder = new TextDecoder();
@@ -1481,9 +1535,17 @@ function createFinalValuePassThroughStream(onFinal) {
1481
1535
  transform(chunk, controller) {
1482
1536
  if (typeof chunk === "string") {
1483
1537
  textChunks.push(chunk);
1538
+ controller.enqueue({
1539
+ type: "text_delta",
1540
+ data: chunk
1541
+ });
1484
1542
  } else if (chunk instanceof Uint8Array) {
1485
1543
  textChunks.push(decoder.decode(chunk));
1486
- } else {
1544
+ controller.enqueue({
1545
+ type: "text_delta",
1546
+ data: decoder.decode(chunk)
1547
+ });
1548
+ } else if (braintrustStreamChunkSchema.safeParse(chunk).success) {
1487
1549
  const chunkType = chunk.type;
1488
1550
  switch (chunkType) {
1489
1551
  case "text_delta":
@@ -1497,6 +1559,8 @@ function createFinalValuePassThroughStream(onFinal) {
1497
1559
  throw new Error(`Unknown chunk type ${_type}`);
1498
1560
  }
1499
1561
  controller.enqueue(chunk);
1562
+ } else {
1563
+ throw new Error(`Unknown chunk type ${chunk}`);
1500
1564
  }
1501
1565
  },
1502
1566
  flush(controller) {
@@ -1558,14 +1622,14 @@ var NoopSpan = class {
1558
1622
  }
1559
1623
  };
1560
1624
  var NOOP_SPAN = new NoopSpan();
1561
- var loginSchema = import_zod.z.strictObject({
1562
- appUrl: import_zod.z.string(),
1563
- appPublicUrl: import_zod.z.string(),
1564
- orgName: import_zod.z.string(),
1565
- logUrl: import_zod.z.string(),
1566
- proxyUrl: import_zod.z.string(),
1567
- loginToken: import_zod.z.string(),
1568
- orgId: import_zod.z.string().nullish(),
1625
+ var loginSchema = import_zod2.z.strictObject({
1626
+ appUrl: import_zod2.z.string(),
1627
+ appPublicUrl: import_zod2.z.string(),
1628
+ orgName: import_zod2.z.string(),
1629
+ apiUrl: import_zod2.z.string(),
1630
+ proxyUrl: import_zod2.z.string(),
1631
+ loginToken: import_zod2.z.string(),
1632
+ orgId: import_zod2.z.string().nullish(),
1569
1633
  gitMetadataSettings: import_core.gitMetadataSettingsSchema.nullish()
1570
1634
  });
1571
1635
  var BraintrustState = class _BraintrustState {
@@ -1580,7 +1644,7 @@ var BraintrustState = class _BraintrustState {
1580
1644
  }
1581
1645
  const defaultGetLogConn = async () => {
1582
1646
  await this.login({});
1583
- return this.logConn();
1647
+ return this.apiConn();
1584
1648
  };
1585
1649
  this._bgLogger = new BackgroundLogger(new LazyValue(defaultGetLogConn));
1586
1650
  this.resetLoginInfo();
@@ -1591,7 +1655,7 @@ var BraintrustState = class _BraintrustState {
1591
1655
  // (safely) dynamically cast it whenever retrieving the logger.
1592
1656
  currentLogger;
1593
1657
  currentSpan;
1594
- // Any time we re-log in, we directly update the logConn inside the logger.
1658
+ // Any time we re-log in, we directly update the apiConn inside the logger.
1595
1659
  // This is preferable to replacing the whole logger, which would create the
1596
1660
  // possibility of multiple loggers floating around, which may not log in a
1597
1661
  // deterministic order.
@@ -1601,13 +1665,13 @@ var BraintrustState = class _BraintrustState {
1601
1665
  loginToken = null;
1602
1666
  orgId = null;
1603
1667
  orgName = null;
1604
- logUrl = null;
1668
+ apiUrl = null;
1605
1669
  proxyUrl = null;
1606
1670
  loggedIn = false;
1607
1671
  gitMetadataSettings;
1608
1672
  fetch = globalThis.fetch;
1673
+ _appConn = null;
1609
1674
  _apiConn = null;
1610
- _logConn = null;
1611
1675
  _proxyConn = null;
1612
1676
  resetLoginInfo() {
1613
1677
  this.appUrl = null;
@@ -1615,12 +1679,12 @@ var BraintrustState = class _BraintrustState {
1615
1679
  this.loginToken = null;
1616
1680
  this.orgId = null;
1617
1681
  this.orgName = null;
1618
- this.logUrl = null;
1682
+ this.apiUrl = null;
1619
1683
  this.proxyUrl = null;
1620
1684
  this.loggedIn = false;
1621
1685
  this.gitMetadataSettings = void 0;
1686
+ this._appConn = null;
1622
1687
  this._apiConn = null;
1623
- this._logConn = null;
1624
1688
  this._proxyConn = null;
1625
1689
  }
1626
1690
  copyLoginInfo(other) {
@@ -1629,12 +1693,12 @@ var BraintrustState = class _BraintrustState {
1629
1693
  this.loginToken = other.loginToken;
1630
1694
  this.orgId = other.orgId;
1631
1695
  this.orgName = other.orgName;
1632
- this.logUrl = other.logUrl;
1696
+ this.apiUrl = other.apiUrl;
1633
1697
  this.proxyUrl = other.proxyUrl;
1634
1698
  this.loggedIn = other.loggedIn;
1635
1699
  this.gitMetadataSettings = other.gitMetadataSettings;
1700
+ this._appConn = other._appConn;
1636
1701
  this._apiConn = other._apiConn;
1637
- this._logConn = other._logConn;
1638
1702
  this._proxyConn = other._proxyConn;
1639
1703
  }
1640
1704
  serialize() {
@@ -1643,7 +1707,7 @@ var BraintrustState = class _BraintrustState {
1643
1707
  "Cannot serialize BraintrustState without being logged in"
1644
1708
  );
1645
1709
  }
1646
- if (!this.appUrl || !this.appPublicUrl || !this.logUrl || !this.proxyUrl || !this.orgName || !this.loginToken || !this.loggedIn) {
1710
+ if (!this.appUrl || !this.appPublicUrl || !this.apiUrl || !this.proxyUrl || !this.orgName || !this.loginToken || !this.loggedIn) {
1647
1711
  throw new Error(
1648
1712
  "Cannot serialize BraintrustState without all login attributes"
1649
1713
  );
@@ -1654,7 +1718,7 @@ var BraintrustState = class _BraintrustState {
1654
1718
  loginToken: this.loginToken,
1655
1719
  orgId: this.orgId,
1656
1720
  orgName: this.orgName,
1657
- logUrl: this.logUrl,
1721
+ apiUrl: this.apiUrl,
1658
1722
  proxyUrl: this.proxyUrl,
1659
1723
  gitMetadataSettings: this.gitMetadataSettings
1660
1724
  };
@@ -1675,22 +1739,23 @@ var BraintrustState = class _BraintrustState {
1675
1739
  "Cannot deserialize BraintrustState without a login token"
1676
1740
  );
1677
1741
  }
1678
- state.logConn().set_token(state.loginToken);
1679
- state.logConn().make_long_lived();
1680
1742
  state.apiConn().set_token(state.loginToken);
1743
+ state.apiConn().make_long_lived();
1744
+ state.appConn().set_token(state.loginToken);
1745
+ state.proxyConn().make_long_lived();
1681
1746
  state.proxyConn().set_token(state.loginToken);
1682
1747
  state.loggedIn = true;
1683
- state.loginReplaceLogConn(state.logConn());
1748
+ state.loginReplaceApiConn(state.apiConn());
1684
1749
  return state;
1685
1750
  }
1686
1751
  setFetch(fetch2) {
1687
1752
  this.loginParams.fetch = fetch2;
1688
1753
  this.fetch = fetch2;
1689
- this._logConn?.setFetch(fetch2);
1690
1754
  this._apiConn?.setFetch(fetch2);
1755
+ this._appConn?.setFetch(fetch2);
1691
1756
  }
1692
1757
  async login(loginParams) {
1693
- if (this.logUrl && !loginParams.forceLogin) {
1758
+ if (this.apiUrl && !loginParams.forceLogin) {
1694
1759
  return;
1695
1760
  }
1696
1761
  const newState = await loginToState({
@@ -1699,23 +1764,23 @@ var BraintrustState = class _BraintrustState {
1699
1764
  });
1700
1765
  this.copyLoginInfo(newState);
1701
1766
  }
1702
- apiConn() {
1703
- if (!this._apiConn) {
1767
+ appConn() {
1768
+ if (!this._appConn) {
1704
1769
  if (!this.appUrl) {
1705
- throw new Error("Must initialize appUrl before requesting apiConn");
1770
+ throw new Error("Must initialize appUrl before requesting appConn");
1706
1771
  }
1707
- this._apiConn = new HTTPConnection(this.appUrl, this.fetch);
1772
+ this._appConn = new HTTPConnection(this.appUrl, this.fetch);
1708
1773
  }
1709
- return this._apiConn;
1774
+ return this._appConn;
1710
1775
  }
1711
- logConn() {
1712
- if (!this._logConn) {
1713
- if (!this.logUrl) {
1714
- throw new Error("Must initialize logUrl before requesting logConn");
1776
+ apiConn() {
1777
+ if (!this._apiConn) {
1778
+ if (!this.apiUrl) {
1779
+ throw new Error("Must initialize apiUrl before requesting apiConn");
1715
1780
  }
1716
- this._logConn = new HTTPConnection(this.logUrl, this.fetch);
1781
+ this._apiConn = new HTTPConnection(this.apiUrl, this.fetch);
1717
1782
  }
1718
- return this._logConn;
1783
+ return this._apiConn;
1719
1784
  }
1720
1785
  proxyConn() {
1721
1786
  if (!this._proxyConn) {
@@ -1730,8 +1795,8 @@ var BraintrustState = class _BraintrustState {
1730
1795
  return this._bgLogger;
1731
1796
  }
1732
1797
  // Should only be called by the login function.
1733
- loginReplaceLogConn(logConn) {
1734
- this._bgLogger.internalReplaceLogConn(logConn);
1798
+ loginReplaceApiConn(apiConn) {
1799
+ this._bgLogger.internalReplaceApiConn(apiConn);
1735
1800
  }
1736
1801
  };
1737
1802
  var _globalState;
@@ -2038,11 +2103,6 @@ var Logger = class {
2038
2103
  parentObjectType() {
2039
2104
  return import_core.SpanObjectTypeV2.PROJECT_LOGS;
2040
2105
  }
2041
- triggerWaitUntilFlush() {
2042
- if (!this.state.bgLogger().syncFlush) {
2043
- return (0, import_functions.waitUntil)(this.state.bgLogger().flush());
2044
- }
2045
- }
2046
2106
  /**
2047
2107
  * Log a single event. The event will be batched and uploaded behind the scenes if `logOptions.asyncFlush` is true.
2048
2108
  *
@@ -2068,7 +2128,6 @@ var Logger = class {
2068
2128
  this.lastStartTime = span.end();
2069
2129
  const ret = span.id;
2070
2130
  if (this.asyncFlush === true) {
2071
- this.triggerWaitUntilFlush();
2072
2131
  return ret;
2073
2132
  } else {
2074
2133
  return (async () => {
@@ -2096,7 +2155,6 @@ var Logger = class {
2096
2155
  () => span.end()
2097
2156
  );
2098
2157
  if (this.asyncFlush) {
2099
- this.triggerWaitUntilFlush();
2100
2158
  return ret;
2101
2159
  } else {
2102
2160
  return (async () => {
@@ -2180,7 +2238,7 @@ function now() {
2180
2238
  return (/* @__PURE__ */ new Date()).getTime();
2181
2239
  }
2182
2240
  var BackgroundLogger = class _BackgroundLogger {
2183
- logConn;
2241
+ apiConn;
2184
2242
  items = [];
2185
2243
  activeFlush = Promise.resolve();
2186
2244
  activeFlushResolved = true;
@@ -2198,8 +2256,8 @@ var BackgroundLogger = class _BackgroundLogger {
2198
2256
  numDropped: 0,
2199
2257
  lastLoggedTimestamp: 0
2200
2258
  };
2201
- constructor(logConn) {
2202
- this.logConn = logConn;
2259
+ constructor(apiConn) {
2260
+ this.apiConn = apiConn;
2203
2261
  const syncFlushEnv = Number(isomorph_default.getEnv("BRAINTRUST_SYNC_FLUSH"));
2204
2262
  if (!isNaN(syncFlushEnv)) {
2205
2263
  this.syncFlush = Boolean(syncFlushEnv);
@@ -2345,7 +2403,7 @@ var BackgroundLogger = class _BackgroundLogger {
2345
2403
  return [];
2346
2404
  }
2347
2405
  async submitLogsRequest(items) {
2348
- const conn = await this.logConn.get();
2406
+ const conn = await this.apiConn.get();
2349
2407
  const dataStr = constructLogs3Data(items);
2350
2408
  if (this.allPublishPayloadsDir) {
2351
2409
  await _BackgroundLogger.writePayloadToDir({
@@ -2483,14 +2541,15 @@ Error: ${errorText}`;
2483
2541
  this.activeFlushResolved = true;
2484
2542
  }
2485
2543
  })();
2544
+ (0, import_functions.waitUntil)(this.activeFlush);
2486
2545
  }
2487
2546
  }
2488
2547
  logFailedPayloadsDir() {
2489
2548
  console.warn(`Logging failed payloads to ${this.failedPublishPayloadsDir}`);
2490
2549
  }
2491
2550
  // Should only be called by BraintrustState.
2492
- internalReplaceLogConn(logConn) {
2493
- this.logConn = new LazyValue(async () => logConn);
2551
+ internalReplaceApiConn(apiConn) {
2552
+ this.apiConn = new LazyValue(async () => apiConn);
2494
2553
  }
2495
2554
  };
2496
2555
  function init(projectOrOptions, optionalOptions) {
@@ -2544,7 +2603,7 @@ function init(projectOrOptions, optionalOptions) {
2544
2603
  org_name: state.orgName,
2545
2604
  experiment_name: experiment
2546
2605
  };
2547
- const response = await state.apiConn().post_json("api/experiment/get", args);
2606
+ const response = await state.appConn().post_json("api/experiment/get", args);
2548
2607
  if (response.length === 0) {
2549
2608
  throw new Error(
2550
2609
  `Experiment ${experiment} not found in project ${projectId ?? project}.`
@@ -2625,7 +2684,7 @@ function init(projectOrOptions, optionalOptions) {
2625
2684
  let response = null;
2626
2685
  while (true) {
2627
2686
  try {
2628
- response = await state.apiConn().post_json("api/experiment/register", args);
2687
+ response = await state.appConn().post_json("api/experiment/register", args);
2629
2688
  break;
2630
2689
  } catch (e) {
2631
2690
  if (args["base_experiment"] && `${"data" in e && e.data}`.includes("base experiment")) {
@@ -2664,7 +2723,7 @@ async function computeLoggerMetadata(state, {
2664
2723
  }) {
2665
2724
  const org_id = state.orgId;
2666
2725
  if (isEmpty(project_id)) {
2667
- const response = await state.apiConn().post_json("api/project/register", {
2726
+ const response = await state.appConn().post_json("api/project/register", {
2668
2727
  project_name: project_name || GLOBAL_PROJECT,
2669
2728
  org_id
2670
2729
  });
@@ -2677,7 +2736,7 @@ async function computeLoggerMetadata(state, {
2677
2736
  }
2678
2737
  };
2679
2738
  } else if (isEmpty(project_name)) {
2680
- const response = await state.apiConn().get_json("api/project", {
2739
+ const response = await state.appConn().get_json("api/project", {
2681
2740
  id: project_id
2682
2741
  });
2683
2742
  return {
@@ -2744,7 +2803,7 @@ async function loginToState(options = {}) {
2744
2803
  );
2745
2804
  const info = await resp.json();
2746
2805
  _check_org_info(state, info.org_info, orgName);
2747
- conn = state.logConn();
2806
+ conn = state.apiConn();
2748
2807
  conn.set_token(apiKey);
2749
2808
  } else {
2750
2809
  throw new Error(
@@ -2755,11 +2814,11 @@ async function loginToState(options = {}) {
2755
2814
  throw new Error("Conn should be set at this point (a bug)");
2756
2815
  }
2757
2816
  conn.make_long_lived();
2758
- state.apiConn().set_token(apiKey);
2817
+ state.appConn().set_token(apiKey);
2759
2818
  state.proxyConn().set_token(apiKey);
2760
2819
  state.loginToken = conn.token;
2761
2820
  state.loggedIn = true;
2762
- state.loginReplaceLogConn(conn);
2821
+ state.loginReplaceApiConn(conn);
2763
2822
  return state;
2764
2823
  }
2765
2824
  function withCurrent(span, callback, state = _globalState) {
@@ -2773,13 +2832,8 @@ function _check_org_info(state, org_info, org_name) {
2773
2832
  if (org_name === void 0 || org.name === org_name) {
2774
2833
  state.orgId = org.id;
2775
2834
  state.orgName = org.name;
2776
- state.logUrl = isomorph_default.getEnv("BRAINTRUST_API_URL") ?? org.api_url;
2835
+ state.apiUrl = isomorph_default.getEnv("BRAINTRUST_API_URL") ?? org.api_url;
2777
2836
  state.proxyUrl = isomorph_default.getEnv("BRAINTRUST_PROXY_URL") ?? org.proxy_url;
2778
- if (state.proxyUrl) {
2779
- const url = new URL(state.proxyUrl);
2780
- url.pathname = "";
2781
- state.proxyUrl = url.toString();
2782
- }
2783
2837
  state.gitMetadataSettings = org.git_metadata || void 0;
2784
2838
  break;
2785
2839
  }
@@ -2790,11 +2844,6 @@ function _check_org_info(state, org_info, org_name) {
2790
2844
  );
2791
2845
  }
2792
2846
  }
2793
- function _urljoin(...parts) {
2794
- return parts.map(
2795
- (x, i) => x.replace(/^\//, "").replace(i < parts.length - 1 ? /\/$/ : "", "")
2796
- ).join("/");
2797
- }
2798
2847
  function validateTags(tags) {
2799
2848
  const seen = /* @__PURE__ */ new Set();
2800
2849
  for (const tag of tags) {
@@ -2908,7 +2957,7 @@ var ObjectFetcher = class {
2908
2957
  async fetchedData() {
2909
2958
  if (this._fetchedData === void 0) {
2910
2959
  const state = await this.getState();
2911
- const resp = await state.logConn().get(
2960
+ const resp = await state.apiConn().get(
2912
2961
  `v1/${this.objectType}/${await this.id}/fetch`,
2913
2962
  {
2914
2963
  version: this.pinnedVersion
@@ -3054,7 +3103,7 @@ var Experiment = class extends ObjectFetcher {
3054
3103
  }
3055
3104
  async fetchBaseExperiment() {
3056
3105
  const state = await this.getState();
3057
- const conn = state.apiConn();
3106
+ const conn = state.appConn();
3058
3107
  try {
3059
3108
  const resp = await conn.post("/api/base_experiment/get_id", {
3060
3109
  id: await this.id
@@ -3101,7 +3150,7 @@ var Experiment = class extends ObjectFetcher {
3101
3150
  comparisonExperimentName = baseExperiment.name;
3102
3151
  }
3103
3152
  }
3104
- const results = await state.logConn().get_json(
3153
+ const results = await state.apiConn().get_json(
3105
3154
  "/experiment-comparison2",
3106
3155
  {
3107
3156
  experiment_id: await this.id,
@@ -3286,29 +3335,10 @@ var SpanImpl = class _SpanImpl {
3286
3335
  event,
3287
3336
  internalData
3288
3337
  }) {
3289
- const sanitized = validateAndSanitizeExperimentLogPartialArgs(event ?? {});
3290
- let sanitizedAndInternalData = { ...internalData };
3291
- (0, import_core.mergeDicts)(sanitizedAndInternalData, sanitized);
3292
- const serializableInternalData = {};
3293
- const lazyInternalData = {};
3294
- for (const [key, value] of Object.entries(sanitizedAndInternalData)) {
3295
- if (value instanceof BraintrustStream) {
3296
- const streamCopy = value.copy();
3297
- lazyInternalData[key] = new LazyValue(async () => {
3298
- return await new Promise((resolve2) => {
3299
- streamCopy.toReadableStream().pipeThrough(createFinalValuePassThroughStream(resolve2)).pipeTo(devNullWritableStream());
3300
- });
3301
- });
3302
- } else if (value instanceof ReadableStream) {
3303
- lazyInternalData[key] = new LazyValue(async () => {
3304
- return await new Promise((resolve2) => {
3305
- value.pipeThrough(createFinalValuePassThroughStream(resolve2)).pipeTo(devNullWritableStream());
3306
- });
3307
- });
3308
- } else {
3309
- serializableInternalData[key] = value;
3310
- }
3311
- }
3338
+ const [serializableInternalData, lazyInternalData] = splitLoggingData({
3339
+ event,
3340
+ internalData
3341
+ });
3312
3342
  let partialRecord = {
3313
3343
  id: this.id,
3314
3344
  span_id: this.spanId,
@@ -3426,6 +3456,36 @@ var SpanImpl = class _SpanImpl {
3426
3456
  return this.end(args);
3427
3457
  }
3428
3458
  };
3459
+ function splitLoggingData({
3460
+ event,
3461
+ internalData
3462
+ }) {
3463
+ const sanitized = validateAndSanitizeExperimentLogPartialArgs(event ?? {});
3464
+ const sanitizedAndInternalData = {};
3465
+ (0, import_core.mergeDicts)(sanitizedAndInternalData, internalData || {});
3466
+ (0, import_core.mergeDicts)(sanitizedAndInternalData, sanitized);
3467
+ const serializableInternalData = {};
3468
+ const lazyInternalData = {};
3469
+ for (const [key, value] of Object.entries(sanitizedAndInternalData)) {
3470
+ if (value instanceof BraintrustStream) {
3471
+ const streamCopy = value.copy();
3472
+ lazyInternalData[key] = new LazyValue(async () => {
3473
+ return await new Promise((resolve2) => {
3474
+ streamCopy.toReadableStream().pipeThrough(createFinalValuePassThroughStream(resolve2)).pipeTo(devNullWritableStream());
3475
+ });
3476
+ });
3477
+ } else if (value instanceof ReadableStream) {
3478
+ lazyInternalData[key] = new LazyValue(async () => {
3479
+ return await new Promise((resolve2) => {
3480
+ value.pipeThrough(createFinalValuePassThroughStream(resolve2)).pipeTo(devNullWritableStream());
3481
+ });
3482
+ });
3483
+ } else {
3484
+ serializableInternalData[key] = value;
3485
+ }
3486
+ }
3487
+ return [serializableInternalData, lazyInternalData];
3488
+ }
3429
3489
  var Dataset = class extends ObjectFetcher {
3430
3490
  constructor(state, lazyMetadata, pinnedVersion, legacy) {
3431
3491
  const isLegacyDataset = legacy ?? import_core.DEFAULT_IS_LEGACY_DATASET;
@@ -3542,7 +3602,7 @@ var Dataset = class extends ObjectFetcher {
3542
3602
  )}`;
3543
3603
  let dataSummary = void 0;
3544
3604
  if (summarizeData) {
3545
- dataSummary = await state.logConn().get_json(
3605
+ dataSummary = await state.apiConn().get_json(
3546
3606
  "dataset-summary",
3547
3607
  {
3548
3608
  dataset_id: await this.id
@@ -3693,7 +3753,7 @@ var import_chalk = __toESM(require("chalk"));
3693
3753
  var import_core2 = require("@braintrust/core");
3694
3754
  var import_pluralize = __toESM(require("pluralize"));
3695
3755
 
3696
- // ../node_modules/.pnpm/async@3.2.5/node_modules/async/dist/async.mjs
3756
+ // ../../node_modules/.pnpm/async@3.2.5/node_modules/async/dist/async.mjs
3697
3757
  function initialParams(fn) {
3698
3758
  return function(...args) {
3699
3759
  var callback = args.pop();
@@ -5446,10 +5506,10 @@ var import_env = require("@next/env");
5446
5506
  var import_fs = __toESM(require("fs"));
5447
5507
  var import_path = __toESM(require("path"));
5448
5508
  var import_zlib = require("zlib");
5449
- var import_zod2 = require("zod");
5450
- var pathInfoSchema = import_zod2.z.strictObject({
5451
- url: import_zod2.z.string(),
5452
- bundleId: import_zod2.z.string()
5509
+ var import_zod3 = require("zod");
5510
+ var pathInfoSchema = import_zod3.z.strictObject({
5511
+ url: import_zod3.z.string(),
5512
+ bundleId: import_zod3.z.string()
5453
5513
  }).strip();
5454
5514
  async function uploadEvalBundles({
5455
5515
  experimentIdToEvaluator,
@@ -5507,7 +5567,7 @@ async function uploadEvalBundles({
5507
5567
  })
5508
5568
  ];
5509
5569
  }
5510
- const loggerConn = _internalGetGlobalState().logConn();
5570
+ const loggerConn = _internalGetGlobalState().apiConn();
5511
5571
  let uploaded = 0;
5512
5572
  const runtime_context = {
5513
5573
  runtime: "node",
@@ -5582,7 +5642,7 @@ async function uploadEvalBundles({
5582
5642
  }
5583
5643
  }
5584
5644
  }));
5585
- const logPromise = _internalGetGlobalState().logConn().post_json("function/insert", {
5645
+ const logPromise = _internalGetGlobalState().apiConn().post_json("function/insert", {
5586
5646
  functions: functionEntries
5587
5647
  });
5588
5648
  await Promise.all([uploadPromise, logPromise]);