braintrust 0.0.113 → 0.0.114

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
@@ -4995,9 +4995,9 @@ var require_pluralize = __commonJS({
4995
4995
  }
4996
4996
  });
4997
4997
 
4998
- // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/lib/zod-is-type.js
4998
+ // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/lib/zod-is-type.js
4999
4999
  var require_zod_is_type = __commonJS({
5000
- "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/lib/zod-is-type.js"(exports2) {
5000
+ "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/lib/zod-is-type.js"(exports2) {
5001
5001
  "use strict";
5002
5002
  Object.defineProperty(exports2, "__esModule", { value: true });
5003
5003
  exports2.isAnyZodType = exports2.isZodType = void 0;
@@ -5013,9 +5013,9 @@ var require_zod_is_type = __commonJS({
5013
5013
  }
5014
5014
  });
5015
5015
 
5016
- // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/zod-extensions.js
5016
+ // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/zod-extensions.js
5017
5017
  var require_zod_extensions = __commonJS({
5018
- "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/zod-extensions.js"(exports2) {
5018
+ "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/zod-extensions.js"(exports2) {
5019
5019
  "use strict";
5020
5020
  var __rest = exports2 && exports2.__rest || function(s, e) {
5021
5021
  var t = {};
@@ -5103,9 +5103,9 @@ var require_zod_extensions = __commonJS({
5103
5103
  }
5104
5104
  });
5105
5105
 
5106
- // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/lib/object-set.js
5106
+ // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/lib/object-set.js
5107
5107
  var require_object_set = __commonJS({
5108
- "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/lib/object-set.js"(exports2) {
5108
+ "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/lib/object-set.js"(exports2) {
5109
5109
  "use strict";
5110
5110
  Object.defineProperty(exports2, "__esModule", { value: true });
5111
5111
  exports2.ObjectSet = exports2.isEqual = void 0;
@@ -5201,12 +5201,12 @@ var require_object_set = __commonJS({
5201
5201
  }
5202
5202
  });
5203
5203
 
5204
- // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/lib/lodash.js
5204
+ // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/lib/lodash.js
5205
5205
  var require_lodash = __commonJS({
5206
- "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/lib/lodash.js"(exports2) {
5206
+ "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/lib/lodash.js"(exports2) {
5207
5207
  "use strict";
5208
5208
  Object.defineProperty(exports2, "__esModule", { value: true });
5209
- exports2.uniq = exports2.objectEquals = exports2.compact = exports2.omitBy = exports2.omit = exports2.mapValues = exports2.isNil = exports2.isUndefined = void 0;
5209
+ exports2.isString = exports2.uniq = exports2.objectEquals = exports2.compact = exports2.omitBy = exports2.omit = exports2.mapValues = exports2.isNil = exports2.isUndefined = void 0;
5210
5210
  var object_set_1 = require_object_set();
5211
5211
  function isUndefined(value) {
5212
5212
  return value === void 0;
@@ -5255,12 +5255,16 @@ var require_lodash = __commonJS({
5255
5255
  return [...set.values()];
5256
5256
  }
5257
5257
  exports2.uniq = uniq;
5258
+ function isString(val) {
5259
+ return typeof val === "string";
5260
+ }
5261
+ exports2.isString = isString;
5258
5262
  }
5259
5263
  });
5260
5264
 
5261
- // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/openapi-metadata.js
5265
+ // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/openapi-metadata.js
5262
5266
  var require_openapi_metadata = __commonJS({
5263
- "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/openapi-metadata.js"(exports2) {
5267
+ "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/openapi-metadata.js"(exports2) {
5264
5268
  "use strict";
5265
5269
  Object.defineProperty(exports2, "__esModule", { value: true });
5266
5270
  exports2.getOpenApiMetadata = void 0;
@@ -5273,9 +5277,9 @@ var require_openapi_metadata = __commonJS({
5273
5277
  }
5274
5278
  });
5275
5279
 
5276
- // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/openapi-registry.js
5280
+ // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/openapi-registry.js
5277
5281
  var require_openapi_registry = __commonJS({
5278
- "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/openapi-registry.js"(exports2) {
5282
+ "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/openapi-registry.js"(exports2) {
5279
5283
  "use strict";
5280
5284
  Object.defineProperty(exports2, "__esModule", { value: true });
5281
5285
  exports2.OpenAPIRegistry = void 0;
@@ -5357,9 +5361,9 @@ var require_openapi_registry = __commonJS({
5357
5361
  }
5358
5362
  });
5359
5363
 
5360
- // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/errors.js
5364
+ // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/errors.js
5361
5365
  var require_errors = __commonJS({
5362
- "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/errors.js"(exports2) {
5366
+ "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/errors.js"(exports2) {
5363
5367
  "use strict";
5364
5368
  Object.defineProperty(exports2, "__esModule", { value: true });
5365
5369
  exports2.UnknownZodTypeError = exports2.MissingParameterDataError = exports2.ConflictError = exports2.ZodToOpenAPIError = void 0;
@@ -5393,9 +5397,9 @@ var require_errors = __commonJS({
5393
5397
  }
5394
5398
  });
5395
5399
 
5396
- // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/lib/enum-info.js
5400
+ // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/lib/enum-info.js
5397
5401
  var require_enum_info = __commonJS({
5398
- "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/lib/enum-info.js"(exports2) {
5402
+ "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/lib/enum-info.js"(exports2) {
5399
5403
  "use strict";
5400
5404
  Object.defineProperty(exports2, "__esModule", { value: true });
5401
5405
  exports2.enumInfo = void 0;
@@ -5410,9 +5414,9 @@ var require_enum_info = __commonJS({
5410
5414
  }
5411
5415
  });
5412
5416
 
5413
- // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/openapi-generator.js
5417
+ // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/openapi-generator.js
5414
5418
  var require_openapi_generator = __commonJS({
5415
- "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/openapi-generator.js"(exports2) {
5419
+ "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/openapi-generator.js"(exports2) {
5416
5420
  "use strict";
5417
5421
  var __rest = exports2 && exports2.__rest || function(s, e) {
5418
5422
  var t = {};
@@ -5753,7 +5757,7 @@ var require_openapi_generator = __commonJS({
5753
5757
  }
5754
5758
  getBodyContent(content) {
5755
5759
  return (0, lodash_1.mapValues)(content, (config) => {
5756
- if (!(0, zod_is_type_1.isAnyZodType)(config.schema)) {
5760
+ if (!config || !(0, zod_is_type_1.isAnyZodType)(config.schema)) {
5757
5761
  return config;
5758
5762
  }
5759
5763
  const { schema: configSchema } = config, rest = __rest(config, ["schema"]);
@@ -5941,7 +5945,14 @@ var require_openapi_generator = __commonJS({
5941
5945
  }
5942
5946
  if ((0, zod_is_type_1.isZodType)(zodSchema, "ZodRecord")) {
5943
5947
  const propertiesType = zodSchema._def.valueType;
5944
- return Object.assign(Object.assign({}, this.mapNullableType("object", isNullable)), { additionalProperties: this.generateSchemaWithRef(propertiesType), default: defaultValue });
5948
+ const keyType = zodSchema._def.keyType;
5949
+ const propertiesSchema = this.generateSchemaWithRef(propertiesType);
5950
+ if ((0, zod_is_type_1.isZodType)(keyType, "ZodEnum") || (0, zod_is_type_1.isZodType)(keyType, "ZodNativeEnum")) {
5951
+ const keys = Object.values(keyType.enum).filter(lodash_1.isString);
5952
+ const properties = keys.reduce((acc, curr) => Object.assign(Object.assign({}, acc), { [curr]: propertiesSchema }), {});
5953
+ return Object.assign(Object.assign({}, this.mapNullableType("object", isNullable)), { properties, default: defaultValue });
5954
+ }
5955
+ return Object.assign(Object.assign({}, this.mapNullableType("object", isNullable)), { additionalProperties: propertiesSchema, default: defaultValue });
5945
5956
  }
5946
5957
  if ((0, zod_is_type_1.isZodType)(zodSchema, "ZodUnknown") || (0, zod_is_type_1.isZodType)(zodSchema, "ZodAny")) {
5947
5958
  return this.mapNullableType(void 0, isNullable);
@@ -6107,9 +6118,9 @@ var require_openapi_generator = __commonJS({
6107
6118
  }
6108
6119
  });
6109
6120
 
6110
- // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/v3.0/specifics.js
6121
+ // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/v3.0/specifics.js
6111
6122
  var require_specifics = __commonJS({
6112
- "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/v3.0/specifics.js"(exports2) {
6123
+ "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/v3.0/specifics.js"(exports2) {
6113
6124
  "use strict";
6114
6125
  Object.defineProperty(exports2, "__esModule", { value: true });
6115
6126
  exports2.OpenApiGeneratorV30Specifics = void 0;
@@ -6143,9 +6154,9 @@ var require_specifics = __commonJS({
6143
6154
  }
6144
6155
  });
6145
6156
 
6146
- // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/v3.0/openapi-generator.js
6157
+ // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/v3.0/openapi-generator.js
6147
6158
  var require_openapi_generator2 = __commonJS({
6148
- "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/v3.0/openapi-generator.js"(exports2) {
6159
+ "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/v3.0/openapi-generator.js"(exports2) {
6149
6160
  "use strict";
6150
6161
  Object.defineProperty(exports2, "__esModule", { value: true });
6151
6162
  exports2.OpenApiGeneratorV3 = void 0;
@@ -6168,9 +6179,9 @@ var require_openapi_generator2 = __commonJS({
6168
6179
  }
6169
6180
  });
6170
6181
 
6171
- // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/v3.1/specifics.js
6182
+ // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/v3.1/specifics.js
6172
6183
  var require_specifics2 = __commonJS({
6173
- "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/v3.1/specifics.js"(exports2) {
6184
+ "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/v3.1/specifics.js"(exports2) {
6174
6185
  "use strict";
6175
6186
  Object.defineProperty(exports2, "__esModule", { value: true });
6176
6187
  exports2.OpenApiGeneratorV31Specifics = void 0;
@@ -6214,9 +6225,9 @@ var require_specifics2 = __commonJS({
6214
6225
  }
6215
6226
  });
6216
6227
 
6217
- // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/v3.1/openapi-generator.js
6228
+ // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/v3.1/openapi-generator.js
6218
6229
  var require_openapi_generator3 = __commonJS({
6219
- "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/v3.1/openapi-generator.js"(exports2) {
6230
+ "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/v3.1/openapi-generator.js"(exports2) {
6220
6231
  "use strict";
6221
6232
  Object.defineProperty(exports2, "__esModule", { value: true });
6222
6233
  exports2.OpenApiGeneratorV31 = void 0;
@@ -6250,9 +6261,9 @@ var require_openapi_generator3 = __commonJS({
6250
6261
  }
6251
6262
  });
6252
6263
 
6253
- // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/index.js
6264
+ // ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/index.js
6254
6265
  var require_dist = __commonJS({
6255
- "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.3.1_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/index.js"(exports2) {
6266
+ "../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@6.4.0_zod@3.22.4/node_modules/@asteasolutions/zod-to-openapi/dist/index.js"(exports2) {
6256
6267
  "use strict";
6257
6268
  var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
6258
6269
  if (k2 === void 0)
@@ -10366,7 +10377,7 @@ var require_package = __commonJS({
10366
10377
  "package.json"(exports2, module2) {
10367
10378
  module2.exports = {
10368
10379
  name: "braintrust",
10369
- version: "0.0.113",
10380
+ version: "0.0.114",
10370
10381
  description: "SDK for integrating Braintrust",
10371
10382
  main: "./dist/index.js",
10372
10383
  browser: {
@@ -11811,7 +11822,7 @@ var v4_default = v4;
11811
11822
  // src/cli.ts
11812
11823
  var import_pluralize2 = __toESM(require_pluralize());
11813
11824
 
11814
- // ../core/js/dist/index.mjs
11825
+ // ../../node_modules/.pnpm/@braintrust+core@0.0.27/node_modules/@braintrust/core/dist/index.mjs
11815
11826
  var TRANSACTION_ID_FIELD = "_xact_id";
11816
11827
  var IS_MERGE_FIELD = "_is_merge";
11817
11828
  var MERGE_PATHS_FIELD = "_merge_paths";
@@ -12085,7 +12096,7 @@ var MOD = BigInt(1) << BigInt(64);
12085
12096
  var COPRIME = BigInt("205891132094649");
12086
12097
  var COPRIME_INVERSE = BigInt("1522336535492693385");
12087
12098
 
12088
- // ../core/js/typespecs/dist/index.mjs
12099
+ // ../../node_modules/.pnpm/@braintrust+core@0.0.27/node_modules/@braintrust/core/typespecs/dist/index.mjs
12089
12100
  var import_zod_to_openapi = __toESM(require_dist(), 1);
12090
12101
 
12091
12102
  // ../../node_modules/.pnpm/zod@3.22.4/node_modules/zod/lib/index.mjs
@@ -15821,7 +15832,7 @@ var z = /* @__PURE__ */ Object.freeze({
15821
15832
  ZodError
15822
15833
  });
15823
15834
 
15824
- // ../core/js/typespecs/dist/index.mjs
15835
+ // ../../node_modules/.pnpm/@braintrust+core@0.0.27/node_modules/@braintrust/core/typespecs/dist/index.mjs
15825
15836
  var import_zod_to_openapi2 = __toESM(require_dist(), 1);
15826
15837
  var import_zod_to_openapi3 = __toESM(require_dist(), 1);
15827
15838
  var literalSchema = z.union([
@@ -15866,12 +15877,12 @@ var modeToTypes = {
15866
15877
  };
15867
15878
  var customTypes = modeToTypes[mode];
15868
15879
  var chatCompletionSystemMessageParamSchema = z.object({
15869
- content: z.string(),
15880
+ content: z.string().default(""),
15870
15881
  role: z.literal("system"),
15871
15882
  name: z.string().optional()
15872
15883
  });
15873
15884
  var chatCompletionContentPartTextSchema = z.object({
15874
- text: z.string(),
15885
+ text: z.string().default(""),
15875
15886
  type: z.literal("text")
15876
15887
  });
15877
15888
  var functionCallSchema = z.object({
@@ -15887,12 +15898,12 @@ var imageURLSchema = z.object({
15887
15898
  detail: z.union([z.literal("auto"), z.literal("low"), z.literal("high")]).optional()
15888
15899
  });
15889
15900
  var chatCompletionToolMessageParamSchema = z.object({
15890
- content: z.string(),
15901
+ content: z.string().default(""),
15891
15902
  role: z.literal("tool"),
15892
15903
  tool_call_id: z.string()
15893
15904
  });
15894
15905
  var chatCompletionFunctionMessageParamSchema = z.object({
15895
- content: z.string().nullable(),
15906
+ content: z.string().default(""),
15896
15907
  name: z.string(),
15897
15908
  role: z.literal("function")
15898
15909
  });
@@ -15911,13 +15922,16 @@ var chatCompletionContentPartSchema = z.union([
15911
15922
  ]);
15912
15923
  var chatCompletionAssistantMessageParamSchema = z.object({
15913
15924
  role: z.literal("assistant"),
15914
- content: z.string().optional().nullable(),
15925
+ content: z.string().nullish(),
15915
15926
  function_call: functionCallSchema.optional(),
15916
15927
  name: z.string().optional(),
15917
15928
  tool_calls: z.array(chatCompletionMessageToolCallSchema).optional()
15918
15929
  });
15919
15930
  var chatCompletionUserMessageParamSchema = z.object({
15920
- content: z.union([z.string(), z.array(chatCompletionContentPartSchema)]),
15931
+ content: z.union([
15932
+ z.string().default(""),
15933
+ z.array(chatCompletionContentPartSchema)
15934
+ ]),
15921
15935
  role: z.literal("user"),
15922
15936
  name: z.string().optional()
15923
15937
  });
@@ -17281,6 +17295,7 @@ var BraintrustState = class {
17281
17295
  currentLogger;
17282
17296
  currentSpan;
17283
17297
  appUrl = null;
17298
+ appPublicUrl = null;
17284
17299
  loginToken = null;
17285
17300
  orgId = null;
17286
17301
  orgName = null;
@@ -17891,8 +17906,10 @@ async function login(options = {}) {
17891
17906
  apiKey = isomorph_default.getEnv("BRAINTRUST_API_KEY"),
17892
17907
  orgName = isomorph_default.getEnv("BRAINTRUST_ORG_NAME")
17893
17908
  } = options || {};
17909
+ const appPublicUrl = isomorph_default.getEnv("BRAINTRUST_APP_PUBLIC_URL") || appUrl;
17894
17910
  _state.resetLoginInfo();
17895
17911
  _state.appUrl = appUrl;
17912
+ _state.appPublicUrl = appPublicUrl;
17896
17913
  let conn = null;
17897
17914
  if (apiKey !== void 0) {
17898
17915
  const resp = await checkResponse(
@@ -18202,12 +18219,13 @@ var Experiment = class extends ObjectFetcher {
18202
18219
  * See `traced` for full details.
18203
18220
  */
18204
18221
  startSpan(args) {
18205
- const { name, ...argsRest } = args ?? {};
18222
+ const { name, type, ...argsRest } = args ?? {};
18206
18223
  return new SpanImpl({
18207
18224
  parentObject: this,
18208
18225
  parentIds: new LazyValue(() => this.lazyParentIds()),
18209
18226
  bgLogger: this.bgLogger,
18210
18227
  name: name ?? "root",
18228
+ type: type ?? SpanTypeAttribute.EVAL,
18211
18229
  ...argsRest
18212
18230
  });
18213
18231
  }
@@ -18243,7 +18261,7 @@ var Experiment = class extends ObjectFetcher {
18243
18261
  let { summarizeScores = true, comparisonExperimentId = void 0 } = options || {};
18244
18262
  await this.bgLogger.flush();
18245
18263
  const state = await this.getState();
18246
- const projectUrl = `${state.appUrl}/app/${encodeURIComponent(
18264
+ const projectUrl = `${state.appPublicUrl}/app/${encodeURIComponent(
18247
18265
  state.orgName
18248
18266
  )}/p/${encodeURIComponent((await this.project).name)}`;
18249
18267
  const experimentUrl = `${projectUrl}/${encodeURIComponent(
@@ -18279,7 +18297,7 @@ var Experiment = class extends ObjectFetcher {
18279
18297
  projectUrl,
18280
18298
  experimentUrl,
18281
18299
  comparisonExperimentName,
18282
- scores,
18300
+ scores: scores ?? {},
18283
18301
  metrics
18284
18302
  };
18285
18303
  }
@@ -18397,6 +18415,7 @@ var SpanImpl = class _SpanImpl {
18397
18415
  },
18398
18416
  context: { ...callerLocation },
18399
18417
  span_attributes: {
18418
+ type: args.type,
18400
18419
  ...args.spanAttributes,
18401
18420
  name,
18402
18421
  exec_counter: executionCounter++
@@ -18640,7 +18659,10 @@ function initExperiment(projectName, options = {}) {
18640
18659
  setCurrent: false
18641
18660
  });
18642
18661
  }
18643
- globalThis._evals = {};
18662
+ globalThis._evals = {
18663
+ evaluators: {},
18664
+ reporters: {}
18665
+ };
18644
18666
  function serializeJSONWithPlainString(v) {
18645
18667
  if (typeof v === "string") {
18646
18668
  return v;
@@ -18759,27 +18781,44 @@ async function runEvaluator(experiment, evaluator, progressReporter, filters) {
18759
18781
  const scoreResults = await Promise.all(
18760
18782
  evaluator.scores.map(async (score, score_idx) => {
18761
18783
  try {
18762
- const result = await rootSpan.traced(
18784
+ const results2 = await rootSpan.traced(
18763
18785
  async (span) => {
18764
18786
  const scoreResult = score(scoringArgs);
18765
18787
  const scoreValue = scoreResult instanceof Promise ? await scoreResult : scoreResult;
18766
18788
  if (scoreValue === null) {
18767
18789
  return null;
18768
18790
  }
18769
- const result2 = typeof scoreValue === "object" ? scoreValue : { name: scorerNames[score_idx], score: scoreValue };
18770
- const {
18771
- metadata: resultMetadata,
18772
- name,
18773
- ...resultRest
18774
- } = result2;
18791
+ const scoreValues = Array.isArray(scoreValue) ? scoreValue : [scoreValue];
18792
+ const results3 = scoreValues.map(
18793
+ (scoreValue2, idx) => typeof scoreValue2 === "object" ? scoreValue2 : {
18794
+ name: scoreValues.length > 1 ? `${scorerNames[score_idx]}_${idx}` : scorerNames[score_idx],
18795
+ score: scoreValue2
18796
+ }
18797
+ );
18798
+ const getOtherFields = (s) => {
18799
+ const { metadata: metadata2, name, ...rest } = s;
18800
+ return rest;
18801
+ };
18802
+ const resultMetadata = results3.length === 1 ? results3[0].metadata : results3.reduce(
18803
+ (prev, s) => mergeDicts(prev, {
18804
+ [s.name]: s.metadata
18805
+ }),
18806
+ {}
18807
+ );
18808
+ const resultOutput = results3.length === 1 ? getOtherFields(results3[0]) : results3.reduce(
18809
+ (prev, s) => mergeDicts(prev, { [s.name]: getOtherFields(s) }),
18810
+ {}
18811
+ );
18812
+ const scores2 = results3.reduce(
18813
+ (prev, s) => mergeDicts(prev, { [s.name]: s.score }),
18814
+ {}
18815
+ );
18775
18816
  span.log({
18776
- output: resultRest,
18817
+ output: resultOutput,
18777
18818
  metadata: resultMetadata,
18778
- scores: {
18779
- [name]: resultRest.score
18780
- }
18819
+ scores: scores2
18781
18820
  });
18782
- return result2;
18821
+ return results3;
18783
18822
  },
18784
18823
  {
18785
18824
  name: scorerNames[score_idx],
@@ -18789,7 +18828,7 @@ async function runEvaluator(experiment, evaluator, progressReporter, filters) {
18789
18828
  event: { input: scoringArgs }
18790
18829
  }
18791
18830
  );
18792
- return { kind: "score", value: result };
18831
+ return { kind: "score", value: results2 };
18793
18832
  } catch (e) {
18794
18833
  return { kind: "error", value: e };
18795
18834
  }
@@ -18797,12 +18836,18 @@ async function runEvaluator(experiment, evaluator, progressReporter, filters) {
18797
18836
  );
18798
18837
  const passingScorersAndResults = [];
18799
18838
  const failingScorersAndResults = [];
18800
- scoreResults.forEach((result, i) => {
18839
+ scoreResults.forEach((results2, i) => {
18801
18840
  const name = scorerNames[i];
18802
- if (result.kind === "score") {
18803
- passingScorersAndResults.push({ name, score: result.value });
18841
+ if (results2.kind === "score") {
18842
+ (results2.value || []).forEach((result) => {
18843
+ passingScorersAndResults.push({
18844
+ name: result.name,
18845
+ score: result
18846
+ });
18847
+ scores[result.name] = result.score;
18848
+ });
18804
18849
  } else {
18805
- failingScorersAndResults.push({ name, error: result.value });
18850
+ failingScorersAndResults.push({ name, error: results2.value });
18806
18851
  }
18807
18852
  });
18808
18853
  if (failingScorersAndResults.length) {
@@ -18827,7 +18872,10 @@ async function runEvaluator(experiment, evaluator, progressReporter, filters) {
18827
18872
  progressReporter.increment(evaluator.evalName);
18828
18873
  }
18829
18874
  return {
18875
+ input: datum.input,
18876
+ ..."expected" in datum ? { expected: datum.expected } : {},
18830
18877
  output,
18878
+ tags: datum.tags,
18831
18879
  metadata,
18832
18880
  scores,
18833
18881
  error: error2
@@ -18850,10 +18898,10 @@ async function runEvaluator(experiment, evaluator, progressReporter, filters) {
18850
18898
  }
18851
18899
  });
18852
18900
  const results = await Promise.all(evals);
18853
- const summary = experiment ? await experiment.summarize() : null;
18901
+ const summary = experiment ? await experiment.summarize() : buildLocalSummary(evaluator, results);
18854
18902
  return {
18855
- results,
18856
- summary
18903
+ summary,
18904
+ results
18857
18905
  };
18858
18906
  }
18859
18907
  var error = import_chalk.default.bold.red;
@@ -18865,28 +18913,46 @@ function logError(e, verbose) {
18865
18913
  console.error(e);
18866
18914
  }
18867
18915
  }
18868
- function reportEvaluatorResult(evaluatorName, evaluatorResult, {
18869
- verbose,
18870
- jsonl
18871
- }) {
18872
- const { results, summary } = evaluatorResult;
18873
- const failingResults = results.filter(
18874
- (r) => r.error !== void 0
18875
- );
18916
+ function buildLocalSummary(evaluator, results) {
18917
+ const scoresByName = {};
18918
+ for (const result of results) {
18919
+ for (const [name, score] of Object.entries(result.scores)) {
18920
+ const { total, count } = scoresByName[name] || { total: 0, count: 0 };
18921
+ if (score === null) {
18922
+ continue;
18923
+ }
18924
+ scoresByName[name] = { total: total + score, count: count + 1 };
18925
+ }
18926
+ }
18927
+ return {
18928
+ projectName: evaluator.projectName,
18929
+ experimentName: evaluator.evalName,
18930
+ scores: Object.fromEntries(
18931
+ Object.entries(scoresByName).map(([name, { total, count }]) => [
18932
+ name,
18933
+ {
18934
+ name,
18935
+ score: total / count
18936
+ }
18937
+ ])
18938
+ )
18939
+ };
18940
+ }
18941
+ function reportFailures(evaluator, failingResults, { verbose, jsonl }) {
18876
18942
  if (failingResults.length > 0) {
18877
18943
  console.error(
18878
18944
  warning(
18879
- `Evaluator ${evaluatorName} failed with ${(0, import_pluralize.default)(
18945
+ `Evaluator ${evaluator.evalName} failed with ${(0, import_pluralize.default)(
18880
18946
  "error",
18881
18947
  failingResults.length,
18882
18948
  true
18883
- )}. This evaluation ("${evaluatorName}") will not be fully logged.`
18949
+ )}. This evaluation ("${evaluator.evalName}") will not be fully logged.`
18884
18950
  )
18885
18951
  );
18886
18952
  if (jsonl) {
18887
18953
  console.log(
18888
18954
  JSON.stringify({
18889
- evaluatorName,
18955
+ evaluatorName: evaluator.evalName,
18890
18956
  errors: failingResults.map(
18891
18957
  (r) => `${r.error instanceof Error ? r.error.stack : r.error}`
18892
18958
  )
@@ -18901,33 +18967,24 @@ function reportEvaluatorResult(evaluatorName, evaluatorResult, {
18901
18967
  console.error(warning("Add --verbose to see full stack traces."));
18902
18968
  }
18903
18969
  }
18904
- if (summary) {
18905
- console.log(jsonl ? JSON.stringify(summary) : summary);
18906
- } else {
18907
- const scoresByName = {};
18908
- for (const result of results) {
18909
- for (const [name, score] of Object.entries(result.scores)) {
18910
- const { total, count } = scoresByName[name] || { total: 0, count: 0 };
18911
- if (score === null) {
18912
- continue;
18913
- }
18914
- scoresByName[name] = { total: total + score, count: count + 1 };
18915
- }
18970
+ }
18971
+ var defaultReporter = {
18972
+ name: "Braintrust default reporter",
18973
+ async reportEval(evaluator, result, { verbose, jsonl }) {
18974
+ const { results, summary } = result;
18975
+ const failingResults = results.filter(
18976
+ (r) => r.error !== void 0
18977
+ );
18978
+ if (failingResults.length > 0) {
18979
+ reportFailures(evaluator, failingResults, { verbose, jsonl });
18916
18980
  }
18917
- const summary2 = {
18918
- scores: Object.fromEntries(
18919
- Object.entries(scoresByName).map(([name, { total, count }]) => [
18920
- name,
18921
- {
18922
- name,
18923
- score: total / count
18924
- }
18925
- ])
18926
- )
18927
- };
18928
- console.log(jsonl ? JSON.stringify(summary2) : summary2);
18981
+ console.log(jsonl ? JSON.stringify(summary) : summary);
18982
+ return failingResults.length === 0;
18983
+ },
18984
+ async reportRun(evalReports) {
18985
+ return evalReports.every((r) => r);
18929
18986
  }
18930
- }
18987
+ };
18931
18988
 
18932
18989
  // src/node.ts
18933
18990
  var import_node_async_hooks = require("node:async_hooks");
@@ -23109,7 +23166,10 @@ function evaluateBuildResults(inFile, buildResult) {
23109
23166
  }
23110
23167
  const moduleText = buildResult.outputFiles[0].text;
23111
23168
  return evalWithModuleContext(inFile, () => {
23112
- globalThis._evals = {};
23169
+ globalThis._evals = {
23170
+ evaluators: {},
23171
+ reporters: {}
23172
+ };
23113
23173
  globalThis._lazy_load = true;
23114
23174
  globalThis.__inherited_braintrust_state = _internalGetGlobalState();
23115
23175
  const __filename = inFile;
@@ -23133,7 +23193,39 @@ async function initLogger(projectName, experimentName, metadata) {
23133
23193
  );
23134
23194
  return logger;
23135
23195
  }
23196
+ function resolveReporter(reporter, reporters) {
23197
+ if (typeof reporter === "string") {
23198
+ if (!reporters[reporter]) {
23199
+ throw new Error(`Reporter ${reporter} not found`);
23200
+ }
23201
+ return reporters[reporter];
23202
+ } else if (!isEmpty(reporter)) {
23203
+ return reporter;
23204
+ } else if (Object.keys(reporters).length === 0) {
23205
+ return defaultReporter;
23206
+ } else if (Object.keys(reporters).length === 1) {
23207
+ return reporters[Object.keys(reporters)[0]];
23208
+ } else {
23209
+ const reporterNames = Object.keys(reporters).join(", ");
23210
+ throw new Error(
23211
+ `Multiple reporters found (${reporterNames}). Please specify a reporter explicitly.`
23212
+ );
23213
+ }
23214
+ }
23215
+ function addReport(evalReports, reporter, report) {
23216
+ if (!evalReports[reporter.name]) {
23217
+ evalReports[reporter.name] = {
23218
+ reporter,
23219
+ results: []
23220
+ };
23221
+ }
23222
+ evalReports[reporter.name].results.push(report);
23223
+ }
23136
23224
  function buildWatchPluginForEvaluator(inFile, opts) {
23225
+ const evaluators = {
23226
+ evaluators: {},
23227
+ reporters: {}
23228
+ };
23137
23229
  const plugin = {
23138
23230
  name: "run-evalutator-on-end",
23139
23231
  setup(build) {
@@ -23152,7 +23244,23 @@ function buildWatchPluginForEvaluator(inFile, opts) {
23152
23244
  if (!evalResult) {
23153
23245
  return;
23154
23246
  }
23155
- for (const evaluator of Object.values(evalResult)) {
23247
+ for (const [evalName, evaluator] of Object.entries(
23248
+ evalResult.evaluators
23249
+ )) {
23250
+ evaluators.evaluators[evalName] = {
23251
+ sourceFile: inFile,
23252
+ evaluator: evaluator.evaluator,
23253
+ reporter: evaluator.reporter
23254
+ };
23255
+ }
23256
+ for (const [reporterName, reporter] of Object.entries(
23257
+ evalResult.reporters
23258
+ )) {
23259
+ evaluators.reporters[reporterName] = reporter;
23260
+ }
23261
+ const evalReports = {};
23262
+ for (const evaluatorDef of Object.values(evalResult.evaluators)) {
23263
+ const { evaluator, reporter } = evaluatorDef;
23156
23264
  const logger = opts.noSendLogs ? null : await initLogger(
23157
23265
  evaluator.projectName,
23158
23266
  evaluator.experimentName,
@@ -23164,10 +23272,28 @@ function buildWatchPluginForEvaluator(inFile, opts) {
23164
23272
  opts.progressReporter,
23165
23273
  opts.filters
23166
23274
  );
23167
- reportEvaluatorResult(evaluator.evalName, evaluatorResult, {
23168
- verbose: true,
23169
- jsonl: opts.jsonl
23170
- });
23275
+ const resolvedReporter = resolveReporter(
23276
+ reporter,
23277
+ evaluators.reporters
23278
+ // Let these accumulate across all files.
23279
+ );
23280
+ const report = resolvedReporter.reportEval(
23281
+ evaluator,
23282
+ evaluatorResult,
23283
+ {
23284
+ verbose: opts.verbose,
23285
+ jsonl: opts.jsonl
23286
+ }
23287
+ );
23288
+ addReport(evalReports, resolvedReporter, report);
23289
+ }
23290
+ for (const [reporterName, { reporter, results }] of Object.entries(
23291
+ evalReports
23292
+ )) {
23293
+ const success = await reporter.reportRun(await Promise.all(results));
23294
+ if (!success) {
23295
+ console.error(error(`Reporter ${reporterName} failed.`));
23296
+ }
23171
23297
  }
23172
23298
  });
23173
23299
  }
@@ -23190,7 +23316,10 @@ async function initFile(inFile, outFile, opts, args) {
23190
23316
  sourceFile: inFile
23191
23317
  };
23192
23318
  }
23193
- const evaluator = evaluateBuildResults(inFile, result) || {};
23319
+ const evaluator = evaluateBuildResults(inFile, result) || {
23320
+ evaluators: {},
23321
+ reporters: {}
23322
+ };
23194
23323
  return { type: "success", result, evaluator, sourceFile: inFile };
23195
23324
  } catch (e) {
23196
23325
  return { type: "failure", error: e, sourceFile: inFile };
@@ -23219,20 +23348,36 @@ function updateEvaluators(evaluators, buildResults, opts) {
23219
23348
  }
23220
23349
  continue;
23221
23350
  }
23222
- for (const [evalName, evaluator] of Object.entries(result.evaluator)) {
23223
- if (evaluators[evalName] && (evaluators[evalName].sourceFile !== result.sourceFile || evaluators[evalName].evaluator !== evaluator)) {
23351
+ for (const [evalName, evaluator] of Object.entries(
23352
+ result.evaluator.evaluators
23353
+ )) {
23354
+ if (evaluators.evaluators[evalName] && (evaluators.evaluators[evalName].sourceFile !== result.sourceFile || evaluators.evaluators[evalName] !== evaluator)) {
23224
23355
  console.warn(
23225
23356
  warning(
23226
- `Evaluator ${evalName} already exists (in ${evaluators[evalName].sourceFile} and ${result.sourceFile}). Will skip ${evalName} in ${result.sourceFile}.`
23357
+ `Evaluator ${evalName} already exists (in ${evaluators.evaluators[evalName].sourceFile} and ${result.sourceFile}). Will skip ${evalName} in ${result.sourceFile}.`
23227
23358
  )
23228
23359
  );
23229
23360
  continue;
23230
23361
  }
23231
- evaluators[evalName] = {
23362
+ evaluators.evaluators[evalName] = {
23232
23363
  sourceFile: result.sourceFile,
23233
- evaluator
23364
+ evaluator: evaluator.evaluator,
23365
+ reporter: evaluator.reporter
23234
23366
  };
23235
23367
  }
23368
+ for (const [reporterName, reporter] of Object.entries(
23369
+ result.evaluator.reporters
23370
+ )) {
23371
+ if (evaluators.reporters[reporterName] && evaluators.reporters[reporterName] !== reporter) {
23372
+ console.warn(
23373
+ warning(
23374
+ `Reporter ${reporterName} already exists. Will skip ${reporterName}.`
23375
+ )
23376
+ );
23377
+ continue;
23378
+ }
23379
+ evaluators.reporters[reporterName] = reporter;
23380
+ }
23236
23381
  }
23237
23382
  }
23238
23383
  async function runAndWatch(handles, opts) {
@@ -23257,40 +23402,63 @@ async function runOnce(handles, opts) {
23257
23402
  (handle) => handle.rebuild()
23258
23403
  );
23259
23404
  const buildResults = await Promise.all(buildPromises);
23260
- const evaluators = {};
23405
+ const evaluators = {
23406
+ evaluators: {},
23407
+ reporters: {}
23408
+ };
23261
23409
  updateEvaluators(evaluators, buildResults, opts);
23262
- const resultPromises = Object.values(evaluators).map(async (evaluator) => {
23263
- const logger = opts.noSendLogs ? null : await initLogger(
23264
- evaluator.evaluator.projectName,
23265
- evaluator.evaluator.experimentName,
23266
- evaluator.evaluator.metadata
23267
- );
23268
- try {
23269
- return await runEvaluator(
23270
- logger,
23271
- evaluator.evaluator,
23272
- opts.progressReporter,
23273
- opts.filters
23410
+ const resultPromises = Object.values(evaluators.evaluators).map(
23411
+ async (evaluator) => {
23412
+ const logger = opts.noSendLogs ? null : await initLogger(
23413
+ evaluator.evaluator.projectName,
23414
+ evaluator.evaluator.experimentName,
23415
+ evaluator.evaluator.metadata
23274
23416
  );
23275
- } finally {
23276
- if (logger) {
23277
- await logger.flush();
23417
+ try {
23418
+ return await runEvaluator(
23419
+ logger,
23420
+ evaluator.evaluator,
23421
+ opts.progressReporter,
23422
+ opts.filters
23423
+ );
23424
+ } finally {
23425
+ if (logger) {
23426
+ await logger.flush();
23427
+ }
23278
23428
  }
23279
23429
  }
23280
- });
23430
+ );
23281
23431
  console.error(`Processing ${resultPromises.length} evaluators...`);
23282
23432
  const allEvalsResults = await Promise.all(resultPromises);
23283
23433
  opts.progressReporter.stop();
23284
23434
  console.error("");
23285
- for (const [evaluator, idx] of Object.keys(evaluators).map((k, i) => [
23286
- k,
23287
- i
23288
- ])) {
23289
- reportEvaluatorResult(evaluator, allEvalsResults[idx], {
23290
- verbose: opts.verbose,
23291
- jsonl: opts.jsonl
23292
- });
23435
+ const evalReports = {};
23436
+ for (const [evaluatorName, idx] of Object.keys(evaluators.evaluators).map(
23437
+ (k, i) => [k, i]
23438
+ )) {
23439
+ const evaluator = evaluators.evaluators[evaluatorName];
23440
+ const resolvedReporter = resolveReporter(
23441
+ evaluator.reporter,
23442
+ evaluators.reporters
23443
+ );
23444
+ const report = resolvedReporter.reportEval(
23445
+ evaluator.evaluator,
23446
+ allEvalsResults[idx],
23447
+ {
23448
+ verbose: opts.verbose,
23449
+ jsonl: opts.jsonl
23450
+ }
23451
+ );
23452
+ addReport(evalReports, resolvedReporter, report);
23453
+ }
23454
+ let allSuccess = true;
23455
+ for (const [reporterName, { reporter, results }] of Object.entries(
23456
+ evalReports
23457
+ )) {
23458
+ const success = await reporter.reportRun(await Promise.all(results));
23459
+ allSuccess = allSuccess && success;
23293
23460
  }
23461
+ return allSuccess;
23294
23462
  }
23295
23463
  function checkMatch(pathInput, include_patterns, exclude_patterns) {
23296
23464
  const p = import_path.default.resolve(pathInput);
@@ -23328,9 +23496,14 @@ async function collectFiles(inputPath) {
23328
23496
  }
23329
23497
  let files = [];
23330
23498
  if (!pathStat.isDirectory()) {
23331
- if (checkMatch(inputPath, INCLUDE, EXCLUDE)) {
23332
- files.push(inputPath);
23499
+ if (!checkMatch(inputPath, INCLUDE, EXCLUDE)) {
23500
+ console.warn(
23501
+ warning(
23502
+ `Reading ${inputPath} because it was specified directly. Rename it to end in .eval.ts or .eval.js to include it automatically when you specify a directory.`
23503
+ )
23504
+ );
23333
23505
  }
23506
+ files.push(inputPath);
23334
23507
  } else {
23335
23508
  const walked = await import_util3.default.promisify(fsWalk.walk)(inputPath, {
23336
23509
  deepFilter: (entry) => {
@@ -23427,6 +23600,7 @@ async function run(args) {
23427
23600
  filters: args.filter ? parseFilters(args.filter) : []
23428
23601
  };
23429
23602
  const handles = await initializeHandles(args, evaluatorOpts);
23603
+ let success = true;
23430
23604
  try {
23431
23605
  if (!evaluatorOpts.noSendLogs) {
23432
23606
  await login({
@@ -23438,13 +23612,16 @@ async function run(args) {
23438
23612
  if (args.watch) {
23439
23613
  await runAndWatch(handles, evaluatorOpts);
23440
23614
  } else {
23441
- runOnce(handles, evaluatorOpts);
23615
+ success = await runOnce(handles, evaluatorOpts);
23442
23616
  }
23443
23617
  } finally {
23444
23618
  for (const handle of Object.values(handles)) {
23445
23619
  await handle.destroy();
23446
23620
  }
23447
23621
  }
23622
+ if (!success) {
23623
+ process.exit(1);
23624
+ }
23448
23625
  }
23449
23626
  async function main() {
23450
23627
  const [, ...args] = process.argv;