braintrust 0.3.7 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -245,7 +245,7 @@ function getCallerLocation() {
245
245
  }
246
246
 
247
247
  // src/logger.ts
248
- import { v4 as uuidv4 } from "uuid";
248
+ import { v4 as uuidv42 } from "uuid";
249
249
 
250
250
  // src/queue.ts
251
251
  var DEFAULT_QUEUE_SIZE = 15e3;
@@ -303,6 +303,44 @@ var Queue = class {
303
303
  }
304
304
  };
305
305
 
306
+ // src/id-gen.ts
307
+ import { v4 as uuidv4 } from "uuid";
308
+ function generateHexId(bytes) {
309
+ let result = "";
310
+ for (let i = 0; i < bytes; i++) {
311
+ result += Math.floor(Math.random() * 256).toString(16).padStart(2, "0");
312
+ }
313
+ return result;
314
+ }
315
+ var IDGenerator = class {
316
+ };
317
+ var UUIDGenerator = class extends IDGenerator {
318
+ getSpanId() {
319
+ return uuidv4();
320
+ }
321
+ getTraceId() {
322
+ return uuidv4();
323
+ }
324
+ shareRootSpanId() {
325
+ return true;
326
+ }
327
+ };
328
+ var OTELIDGenerator = class extends IDGenerator {
329
+ getSpanId() {
330
+ return generateHexId(8);
331
+ }
332
+ getTraceId() {
333
+ return generateHexId(16);
334
+ }
335
+ shareRootSpanId() {
336
+ return false;
337
+ }
338
+ };
339
+ function getIdGenerator() {
340
+ const useOtel = typeof process !== "undefined" && process.env?.BRAINTRUST_OTEL_COMPAT?.toLowerCase() === "true";
341
+ return useOtel ? new OTELIDGenerator() : new UUIDGenerator();
342
+ }
343
+
306
344
  // util/db_fields.ts
307
345
  var TRANSACTION_ID_FIELD = "_xact_id";
308
346
  var IS_MERGE_FIELD = "_is_merge";
@@ -908,22 +946,6 @@ var SpanComponentsV3 = class _SpanComponentsV3 {
908
946
  return new _SpanComponentsV3(spanComponentsV3Schema.parse(jsonObj));
909
947
  }
910
948
  };
911
- function parseParent(parent) {
912
- return typeof parent === "string" ? parent : parent ? new SpanComponentsV3({
913
- object_type: parent.object_type === "experiment" ? 1 /* EXPERIMENT */ : parent.object_type === "playground_logs" ? 3 /* PLAYGROUND_LOGS */ : 2 /* PROJECT_LOGS */,
914
- object_id: parent.object_id,
915
- ...parent.row_ids ? {
916
- row_id: parent.row_ids.id,
917
- span_id: parent.row_ids.span_id,
918
- root_span_id: parent.row_ids.root_span_id
919
- } : {
920
- row_id: void 0,
921
- span_id: void 0,
922
- root_span_id: void 0
923
- },
924
- propagated_event: parent.propagated_event
925
- }).toStr() : void 0;
926
- }
927
949
 
928
950
  // util/http_headers.ts
929
951
  var BT_FOUND_EXISTING_HEADER = "x-bt-found-existing";
@@ -1270,6 +1292,232 @@ function _urljoin(...parts) {
1270
1292
  ).filter((x) => x.trim() !== "").join("/");
1271
1293
  }
1272
1294
 
1295
+ // util/span_identifier_v4.ts
1296
+ import { z as z4 } from "zod/v3";
1297
+ var ENCODING_VERSION_NUMBER_V4 = 4;
1298
+ function tryMakeHexTraceId(s) {
1299
+ try {
1300
+ if (typeof s === "string" && s.length === 32) {
1301
+ const bytes = new Uint8Array(16);
1302
+ for (let i = 0; i < 16; i++) {
1303
+ const hex = s.substr(i * 2, 2);
1304
+ const byte = parseInt(hex, 16);
1305
+ if (isNaN(byte)) throw new Error();
1306
+ bytes[i] = byte;
1307
+ }
1308
+ return { bytes, isHex: true };
1309
+ }
1310
+ } catch {
1311
+ }
1312
+ return { bytes: void 0, isHex: false };
1313
+ }
1314
+ function tryMakeHexSpanId(s) {
1315
+ try {
1316
+ if (typeof s === "string" && s.length === 16) {
1317
+ const bytes = new Uint8Array(8);
1318
+ for (let i = 0; i < 8; i++) {
1319
+ const hex = s.substr(i * 2, 2);
1320
+ const byte = parseInt(hex, 16);
1321
+ if (isNaN(byte)) throw new Error();
1322
+ bytes[i] = byte;
1323
+ }
1324
+ return { bytes, isHex: true };
1325
+ }
1326
+ } catch {
1327
+ }
1328
+ return { bytes: void 0, isHex: false };
1329
+ }
1330
+ var INVALID_ENCODING_ERRMSG_V4 = `SpanComponents string is not properly encoded. This library only supports encoding versions up to ${ENCODING_VERSION_NUMBER_V4}. Please make sure the SDK library used to decode the SpanComponents is at least as new as any library used to encode it.`;
1331
+ var FIELDS_ID_TO_NAME = {
1332
+ [1 /* OBJECT_ID */]: "object_id",
1333
+ [2 /* ROW_ID */]: "row_id",
1334
+ [3 /* SPAN_ID */]: "span_id",
1335
+ [4 /* ROOT_SPAN_ID */]: "root_span_id"
1336
+ };
1337
+ var spanComponentsV4Schema = z4.object({
1338
+ object_type: spanObjectTypeV3EnumSchema,
1339
+ propagated_event: z4.record(z4.unknown()).nullish()
1340
+ }).and(
1341
+ z4.union([
1342
+ // Must provide one or the other.
1343
+ z4.object({
1344
+ object_id: z4.string().nullish(),
1345
+ compute_object_metadata_args: z4.optional(z4.null())
1346
+ }),
1347
+ z4.object({
1348
+ object_id: z4.optional(z4.null()),
1349
+ compute_object_metadata_args: z4.record(z4.unknown())
1350
+ })
1351
+ ])
1352
+ ).and(
1353
+ z4.union([
1354
+ // Either all of these must be provided or none.
1355
+ z4.object({
1356
+ row_id: z4.string(),
1357
+ span_id: z4.string(),
1358
+ root_span_id: z4.string()
1359
+ }),
1360
+ z4.object({
1361
+ row_id: z4.optional(z4.null()),
1362
+ span_id: z4.optional(z4.null()),
1363
+ root_span_id: z4.optional(z4.null())
1364
+ })
1365
+ ])
1366
+ );
1367
+ var SpanComponentsV4 = class _SpanComponentsV4 {
1368
+ constructor(data) {
1369
+ this.data = data;
1370
+ }
1371
+ toStr() {
1372
+ const jsonObj = {
1373
+ compute_object_metadata_args: this.data.compute_object_metadata_args || void 0,
1374
+ propagated_event: this.data.propagated_event || void 0
1375
+ };
1376
+ Object.keys(jsonObj).forEach((key) => {
1377
+ if (jsonObj[key] === void 0) {
1378
+ delete jsonObj[key];
1379
+ }
1380
+ });
1381
+ const allBuffers = [];
1382
+ allBuffers.push(
1383
+ new Uint8Array([ENCODING_VERSION_NUMBER_V4, this.data.object_type])
1384
+ );
1385
+ const hexEntries = [];
1386
+ function addHexField(origVal, fieldId) {
1387
+ let hexResult;
1388
+ if (fieldId === 3 /* SPAN_ID */) {
1389
+ hexResult = tryMakeHexSpanId(origVal);
1390
+ } else if (fieldId === 4 /* ROOT_SPAN_ID */) {
1391
+ hexResult = tryMakeHexTraceId(origVal);
1392
+ } else {
1393
+ hexResult = { bytes: void 0, isHex: false };
1394
+ }
1395
+ if (hexResult.isHex) {
1396
+ hexEntries.push(
1397
+ concatUint8Arrays(new Uint8Array([fieldId]), hexResult.bytes)
1398
+ );
1399
+ } else {
1400
+ jsonObj[FIELDS_ID_TO_NAME[fieldId]] = origVal;
1401
+ }
1402
+ }
1403
+ if (this.data.object_id) {
1404
+ addHexField(this.data.object_id, 1 /* OBJECT_ID */);
1405
+ }
1406
+ if (this.data.row_id) {
1407
+ addHexField(this.data.row_id, 2 /* ROW_ID */);
1408
+ }
1409
+ if (this.data.span_id) {
1410
+ addHexField(this.data.span_id, 3 /* SPAN_ID */);
1411
+ }
1412
+ if (this.data.root_span_id) {
1413
+ addHexField(this.data.root_span_id, 4 /* ROOT_SPAN_ID */);
1414
+ }
1415
+ if (hexEntries.length > 255) {
1416
+ throw new Error("Impossible: too many hex entries to encode");
1417
+ }
1418
+ allBuffers.push(new Uint8Array([hexEntries.length]));
1419
+ allBuffers.push(...hexEntries);
1420
+ if (Object.keys(jsonObj).length > 0) {
1421
+ allBuffers.push(stringToUint8Array(JSON.stringify(jsonObj)));
1422
+ }
1423
+ return uint8ArrayToBase64(concatUint8Arrays(...allBuffers));
1424
+ }
1425
+ static fromStr(s) {
1426
+ try {
1427
+ const rawBytes = base64ToUint8Array(s);
1428
+ const jsonObj = {};
1429
+ if (rawBytes[0] < ENCODING_VERSION_NUMBER_V4) {
1430
+ const v3Components = SpanComponentsV3.fromStr(s);
1431
+ jsonObj["object_type"] = v3Components.data.object_type;
1432
+ jsonObj["object_id"] = v3Components.data.object_id;
1433
+ jsonObj["compute_object_metadata_args"] = v3Components.data.compute_object_metadata_args;
1434
+ jsonObj["row_id"] = v3Components.data.row_id;
1435
+ jsonObj["span_id"] = v3Components.data.span_id;
1436
+ jsonObj["root_span_id"] = v3Components.data.root_span_id;
1437
+ jsonObj["propagated_event"] = v3Components.data.propagated_event;
1438
+ } else {
1439
+ jsonObj["object_type"] = rawBytes[1];
1440
+ const numHexEntries = rawBytes[2];
1441
+ let byteOffset = 3;
1442
+ for (let i = 0; i < numHexEntries; i++) {
1443
+ const fieldId = rawBytes[byteOffset];
1444
+ if (fieldId === 3 /* SPAN_ID */) {
1445
+ const hexBytes = rawBytes.subarray(byteOffset + 1, byteOffset + 9);
1446
+ byteOffset += 9;
1447
+ jsonObj[FIELDS_ID_TO_NAME[fieldId]] = Array.from(
1448
+ hexBytes,
1449
+ (b) => b.toString(16).padStart(2, "0")
1450
+ ).join("");
1451
+ } else if (fieldId === 4 /* ROOT_SPAN_ID */) {
1452
+ const hexBytes = rawBytes.subarray(byteOffset + 1, byteOffset + 17);
1453
+ byteOffset += 17;
1454
+ jsonObj[FIELDS_ID_TO_NAME[fieldId]] = Array.from(
1455
+ hexBytes,
1456
+ (b) => b.toString(16).padStart(2, "0")
1457
+ ).join("");
1458
+ } else {
1459
+ const hexBytes = rawBytes.subarray(byteOffset + 1, byteOffset + 17);
1460
+ byteOffset += 17;
1461
+ jsonObj[FIELDS_ID_TO_NAME[fieldId]] = Array.from(
1462
+ hexBytes,
1463
+ (b) => b.toString(16).padStart(2, "0")
1464
+ ).join("");
1465
+ }
1466
+ }
1467
+ if (byteOffset < rawBytes.length) {
1468
+ const remainingJsonObj = JSON.parse(
1469
+ uint8ArrayToString(rawBytes.subarray(byteOffset))
1470
+ );
1471
+ Object.assign(jsonObj, remainingJsonObj);
1472
+ }
1473
+ }
1474
+ return _SpanComponentsV4.fromJsonObj(jsonObj);
1475
+ } catch {
1476
+ throw new Error(INVALID_ENCODING_ERRMSG_V4);
1477
+ }
1478
+ }
1479
+ objectIdFields() {
1480
+ if (!this.data.object_id) {
1481
+ throw new Error(
1482
+ "Impossible: cannot invoke `objectIdFields` unless SpanComponentsV4 is initialized with an `object_id`"
1483
+ );
1484
+ }
1485
+ switch (this.data.object_type) {
1486
+ case 1 /* EXPERIMENT */:
1487
+ return { experiment_id: this.data.object_id };
1488
+ case 2 /* PROJECT_LOGS */:
1489
+ return { project_id: this.data.object_id, log_id: "g" };
1490
+ case 3 /* PLAYGROUND_LOGS */:
1491
+ return { prompt_session_id: this.data.object_id, log_id: "x" };
1492
+ default:
1493
+ const _ = this.data.object_type;
1494
+ throw new Error(`Invalid object_type ${this.data.object_type}`);
1495
+ }
1496
+ }
1497
+ async export() {
1498
+ return this.toStr();
1499
+ }
1500
+ static fromJsonObj(jsonObj) {
1501
+ return new _SpanComponentsV4(spanComponentsV4Schema.parse(jsonObj));
1502
+ }
1503
+ };
1504
+ function parseParent(parent) {
1505
+ return typeof parent === "string" ? parent : parent ? new SpanComponentsV4({
1506
+ object_type: parent.object_type === "experiment" ? 1 /* EXPERIMENT */ : parent.object_type === "playground_logs" ? 3 /* PLAYGROUND_LOGS */ : 2 /* PROJECT_LOGS */,
1507
+ object_id: parent.object_id,
1508
+ ...parent.row_ids ? {
1509
+ row_id: parent.row_ids.id,
1510
+ span_id: parent.row_ids.span_id,
1511
+ root_span_id: parent.row_ids.root_span_id
1512
+ } : {
1513
+ row_id: void 0,
1514
+ span_id: void 0,
1515
+ root_span_id: void 0
1516
+ },
1517
+ propagated_event: parent.propagated_event
1518
+ }).toStr() : void 0;
1519
+ }
1520
+
1273
1521
  // util/git_fields.ts
1274
1522
  function mergeGitMetadataSettings(s1, s2) {
1275
1523
  if (s1.collect === "all") {
@@ -1305,12 +1553,12 @@ function loadPrettyXact(encodedHex) {
1305
1553
  }
1306
1554
 
1307
1555
  // util/zod_util.ts
1308
- import { z as z4 } from "zod/v3";
1556
+ import { z as z5 } from "zod/v3";
1309
1557
 
1310
1558
  // src/generated_types.ts
1311
- import { z as z5 } from "zod/v3";
1312
- var AclObjectType = z5.union([
1313
- z5.enum([
1559
+ import { z as z6 } from "zod/v3";
1560
+ var AclObjectType = z6.union([
1561
+ z6.enum([
1314
1562
  "organization",
1315
1563
  "project",
1316
1564
  "experiment",
@@ -1323,9 +1571,9 @@ var AclObjectType = z5.union([
1323
1571
  "project_log",
1324
1572
  "org_project"
1325
1573
  ]),
1326
- z5.null()
1574
+ z6.null()
1327
1575
  ]);
1328
- var Permission = z5.enum([
1576
+ var Permission = z6.enum([
1329
1577
  "create",
1330
1578
  "read",
1331
1579
  "update",
@@ -1335,310 +1583,310 @@ var Permission = z5.enum([
1335
1583
  "update_acls",
1336
1584
  "delete_acls"
1337
1585
  ]);
1338
- var Acl = z5.object({
1339
- id: z5.string().uuid(),
1340
- object_type: AclObjectType.and(z5.string()),
1341
- object_id: z5.string().uuid(),
1342
- user_id: z5.union([z5.string(), z5.null()]).optional(),
1343
- group_id: z5.union([z5.string(), z5.null()]).optional(),
1344
- permission: Permission.and(z5.union([z5.string(), z5.null()])).optional(),
1345
- restrict_object_type: AclObjectType.and(z5.unknown()).optional(),
1346
- role_id: z5.union([z5.string(), z5.null()]).optional(),
1347
- _object_org_id: z5.string().uuid(),
1348
- created: z5.union([z5.string(), z5.null()]).optional()
1586
+ var Acl = z6.object({
1587
+ id: z6.string().uuid(),
1588
+ object_type: AclObjectType.and(z6.string()),
1589
+ object_id: z6.string().uuid(),
1590
+ user_id: z6.union([z6.string(), z6.null()]).optional(),
1591
+ group_id: z6.union([z6.string(), z6.null()]).optional(),
1592
+ permission: Permission.and(z6.union([z6.string(), z6.null()])).optional(),
1593
+ restrict_object_type: AclObjectType.and(z6.unknown()).optional(),
1594
+ role_id: z6.union([z6.string(), z6.null()]).optional(),
1595
+ _object_org_id: z6.string().uuid(),
1596
+ created: z6.union([z6.string(), z6.null()]).optional()
1349
1597
  });
1350
- var AISecret = z5.object({
1351
- id: z5.string().uuid(),
1352
- created: z5.union([z5.string(), z5.null()]).optional(),
1353
- updated_at: z5.union([z5.string(), z5.null()]).optional(),
1354
- org_id: z5.string().uuid(),
1355
- name: z5.string(),
1356
- type: z5.union([z5.string(), z5.null()]).optional(),
1357
- metadata: z5.union([z5.object({}).partial().passthrough(), z5.null()]).optional(),
1358
- preview_secret: z5.union([z5.string(), z5.null()]).optional()
1598
+ var AISecret = z6.object({
1599
+ id: z6.string().uuid(),
1600
+ created: z6.union([z6.string(), z6.null()]).optional(),
1601
+ updated_at: z6.union([z6.string(), z6.null()]).optional(),
1602
+ org_id: z6.string().uuid(),
1603
+ name: z6.string(),
1604
+ type: z6.union([z6.string(), z6.null()]).optional(),
1605
+ metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional(),
1606
+ preview_secret: z6.union([z6.string(), z6.null()]).optional()
1359
1607
  });
1360
- var ResponseFormatJsonSchema = z5.object({
1361
- name: z5.string(),
1362
- description: z5.string().optional(),
1363
- schema: z5.union([z5.object({}).partial().passthrough(), z5.string()]).optional(),
1364
- strict: z5.union([z5.boolean(), z5.null()]).optional()
1608
+ var ResponseFormatJsonSchema = z6.object({
1609
+ name: z6.string(),
1610
+ description: z6.string().optional(),
1611
+ schema: z6.union([z6.object({}).partial().passthrough(), z6.string()]).optional(),
1612
+ strict: z6.union([z6.boolean(), z6.null()]).optional()
1365
1613
  });
1366
- var ResponseFormatNullish = z5.union([
1367
- z5.object({ type: z5.literal("json_object") }),
1368
- z5.object({
1369
- type: z5.literal("json_schema"),
1614
+ var ResponseFormatNullish = z6.union([
1615
+ z6.object({ type: z6.literal("json_object") }),
1616
+ z6.object({
1617
+ type: z6.literal("json_schema"),
1370
1618
  json_schema: ResponseFormatJsonSchema
1371
1619
  }),
1372
- z5.object({ type: z5.literal("text") }),
1373
- z5.null()
1620
+ z6.object({ type: z6.literal("text") }),
1621
+ z6.null()
1374
1622
  ]);
1375
- var AnyModelParams = z5.object({
1376
- temperature: z5.number().optional(),
1377
- top_p: z5.number().optional(),
1378
- max_tokens: z5.number(),
1379
- max_completion_tokens: z5.number().optional(),
1380
- frequency_penalty: z5.number().optional(),
1381
- presence_penalty: z5.number().optional(),
1623
+ var AnyModelParams = z6.object({
1624
+ temperature: z6.number().optional(),
1625
+ top_p: z6.number().optional(),
1626
+ max_tokens: z6.number(),
1627
+ max_completion_tokens: z6.number().optional(),
1628
+ frequency_penalty: z6.number().optional(),
1629
+ presence_penalty: z6.number().optional(),
1382
1630
  response_format: ResponseFormatNullish.optional(),
1383
- tool_choice: z5.union([
1384
- z5.literal("auto"),
1385
- z5.literal("none"),
1386
- z5.literal("required"),
1387
- z5.object({
1388
- type: z5.literal("function"),
1389
- function: z5.object({ name: z5.string() })
1631
+ tool_choice: z6.union([
1632
+ z6.literal("auto"),
1633
+ z6.literal("none"),
1634
+ z6.literal("required"),
1635
+ z6.object({
1636
+ type: z6.literal("function"),
1637
+ function: z6.object({ name: z6.string() })
1390
1638
  })
1391
1639
  ]).optional(),
1392
- function_call: z5.union([
1393
- z5.literal("auto"),
1394
- z5.literal("none"),
1395
- z5.object({ name: z5.string() })
1640
+ function_call: z6.union([
1641
+ z6.literal("auto"),
1642
+ z6.literal("none"),
1643
+ z6.object({ name: z6.string() })
1396
1644
  ]).optional(),
1397
- n: z5.number().optional(),
1398
- stop: z5.array(z5.string()).optional(),
1399
- reasoning_effort: z5.enum(["minimal", "low", "medium", "high"]).optional(),
1400
- verbosity: z5.enum(["low", "medium", "high"]).optional(),
1401
- top_k: z5.number().optional(),
1402
- stop_sequences: z5.array(z5.string()).optional(),
1403
- max_tokens_to_sample: z5.number().optional(),
1404
- maxOutputTokens: z5.number().optional(),
1405
- topP: z5.number().optional(),
1406
- topK: z5.number().optional(),
1407
- use_cache: z5.boolean().optional()
1645
+ n: z6.number().optional(),
1646
+ stop: z6.array(z6.string()).optional(),
1647
+ reasoning_effort: z6.enum(["minimal", "low", "medium", "high"]).optional(),
1648
+ verbosity: z6.enum(["low", "medium", "high"]).optional(),
1649
+ top_k: z6.number().optional(),
1650
+ stop_sequences: z6.array(z6.string()).optional(),
1651
+ max_tokens_to_sample: z6.number().optional(),
1652
+ maxOutputTokens: z6.number().optional(),
1653
+ topP: z6.number().optional(),
1654
+ topK: z6.number().optional(),
1655
+ use_cache: z6.boolean().optional()
1408
1656
  });
1409
- var ApiKey = z5.object({
1410
- id: z5.string().uuid(),
1411
- created: z5.union([z5.string(), z5.null()]).optional(),
1412
- name: z5.string(),
1413
- preview_name: z5.string(),
1414
- user_id: z5.union([z5.string(), z5.null()]).optional(),
1415
- user_email: z5.union([z5.string(), z5.null()]).optional(),
1416
- user_given_name: z5.union([z5.string(), z5.null()]).optional(),
1417
- user_family_name: z5.union([z5.string(), z5.null()]).optional(),
1418
- org_id: z5.union([z5.string(), z5.null()]).optional()
1657
+ var ApiKey = z6.object({
1658
+ id: z6.string().uuid(),
1659
+ created: z6.union([z6.string(), z6.null()]).optional(),
1660
+ name: z6.string(),
1661
+ preview_name: z6.string(),
1662
+ user_id: z6.union([z6.string(), z6.null()]).optional(),
1663
+ user_email: z6.union([z6.string(), z6.null()]).optional(),
1664
+ user_given_name: z6.union([z6.string(), z6.null()]).optional(),
1665
+ user_family_name: z6.union([z6.string(), z6.null()]).optional(),
1666
+ org_id: z6.union([z6.string(), z6.null()]).optional()
1419
1667
  });
1420
- var AsyncScoringState = z5.union([
1421
- z5.object({
1422
- status: z5.literal("enabled"),
1423
- token: z5.string(),
1424
- function_ids: z5.array(z5.unknown()).min(1),
1425
- skip_logging: z5.union([z5.boolean(), z5.null()]).optional()
1668
+ var AsyncScoringState = z6.union([
1669
+ z6.object({
1670
+ status: z6.literal("enabled"),
1671
+ token: z6.string(),
1672
+ function_ids: z6.array(z6.unknown()).min(1),
1673
+ skip_logging: z6.union([z6.boolean(), z6.null()]).optional()
1426
1674
  }),
1427
- z5.object({ status: z5.literal("disabled") }),
1428
- z5.null(),
1429
- z5.null()
1675
+ z6.object({ status: z6.literal("disabled") }),
1676
+ z6.null(),
1677
+ z6.null()
1430
1678
  ]);
1431
- var AsyncScoringControl = z5.union([
1432
- z5.object({ kind: z5.literal("score_update"), token: z5.string() }),
1433
- z5.object({ kind: z5.literal("state_override"), state: AsyncScoringState }),
1434
- z5.object({ kind: z5.literal("state_force_reselect") }),
1435
- z5.object({ kind: z5.literal("state_enabled_force_rescore") })
1679
+ var AsyncScoringControl = z6.union([
1680
+ z6.object({ kind: z6.literal("score_update"), token: z6.string() }),
1681
+ z6.object({ kind: z6.literal("state_override"), state: AsyncScoringState }),
1682
+ z6.object({ kind: z6.literal("state_force_reselect") }),
1683
+ z6.object({ kind: z6.literal("state_enabled_force_rescore") })
1436
1684
  ]);
1437
- var BraintrustAttachmentReference = z5.object({
1438
- type: z5.literal("braintrust_attachment"),
1439
- filename: z5.string().min(1),
1440
- content_type: z5.string().min(1),
1441
- key: z5.string().min(1)
1685
+ var BraintrustAttachmentReference = z6.object({
1686
+ type: z6.literal("braintrust_attachment"),
1687
+ filename: z6.string().min(1),
1688
+ content_type: z6.string().min(1),
1689
+ key: z6.string().min(1)
1442
1690
  });
1443
- var ExternalAttachmentReference = z5.object({
1444
- type: z5.literal("external_attachment"),
1445
- filename: z5.string().min(1),
1446
- content_type: z5.string().min(1),
1447
- url: z5.string().min(1)
1691
+ var ExternalAttachmentReference = z6.object({
1692
+ type: z6.literal("external_attachment"),
1693
+ filename: z6.string().min(1),
1694
+ content_type: z6.string().min(1),
1695
+ url: z6.string().min(1)
1448
1696
  });
1449
- var AttachmentReference = z5.discriminatedUnion("type", [
1697
+ var AttachmentReference = z6.discriminatedUnion("type", [
1450
1698
  BraintrustAttachmentReference,
1451
1699
  ExternalAttachmentReference
1452
1700
  ]);
1453
- var UploadStatus = z5.enum(["uploading", "done", "error"]);
1454
- var AttachmentStatus = z5.object({
1701
+ var UploadStatus = z6.enum(["uploading", "done", "error"]);
1702
+ var AttachmentStatus = z6.object({
1455
1703
  upload_status: UploadStatus,
1456
- error_message: z5.string().optional()
1704
+ error_message: z6.string().optional()
1457
1705
  });
1458
- var BraintrustModelParams = z5.object({ use_cache: z5.boolean() }).partial();
1459
- var CallEvent = z5.union([
1460
- z5.object({
1461
- id: z5.string().optional(),
1462
- data: z5.string(),
1463
- event: z5.literal("text_delta")
1706
+ var BraintrustModelParams = z6.object({ use_cache: z6.boolean() }).partial();
1707
+ var CallEvent = z6.union([
1708
+ z6.object({
1709
+ id: z6.string().optional(),
1710
+ data: z6.string(),
1711
+ event: z6.literal("text_delta")
1464
1712
  }),
1465
- z5.object({
1466
- id: z5.string().optional(),
1467
- data: z5.string(),
1468
- event: z5.literal("reasoning_delta")
1713
+ z6.object({
1714
+ id: z6.string().optional(),
1715
+ data: z6.string(),
1716
+ event: z6.literal("reasoning_delta")
1469
1717
  }),
1470
- z5.object({
1471
- id: z5.string().optional(),
1472
- data: z5.string(),
1473
- event: z5.literal("json_delta")
1718
+ z6.object({
1719
+ id: z6.string().optional(),
1720
+ data: z6.string(),
1721
+ event: z6.literal("json_delta")
1474
1722
  }),
1475
- z5.object({
1476
- id: z5.string().optional(),
1477
- data: z5.string(),
1478
- event: z5.literal("progress")
1723
+ z6.object({
1724
+ id: z6.string().optional(),
1725
+ data: z6.string(),
1726
+ event: z6.literal("progress")
1479
1727
  }),
1480
- z5.object({
1481
- id: z5.string().optional(),
1482
- data: z5.string(),
1483
- event: z5.literal("error")
1728
+ z6.object({
1729
+ id: z6.string().optional(),
1730
+ data: z6.string(),
1731
+ event: z6.literal("error")
1484
1732
  }),
1485
- z5.object({
1486
- id: z5.string().optional(),
1487
- data: z5.string(),
1488
- event: z5.literal("console")
1733
+ z6.object({
1734
+ id: z6.string().optional(),
1735
+ data: z6.string(),
1736
+ event: z6.literal("console")
1489
1737
  }),
1490
- z5.object({
1491
- id: z5.string().optional(),
1492
- event: z5.literal("start"),
1493
- data: z5.literal("")
1738
+ z6.object({
1739
+ id: z6.string().optional(),
1740
+ event: z6.literal("start"),
1741
+ data: z6.literal("")
1494
1742
  }),
1495
- z5.object({
1496
- id: z5.string().optional(),
1497
- event: z5.literal("done"),
1498
- data: z5.literal("")
1743
+ z6.object({
1744
+ id: z6.string().optional(),
1745
+ event: z6.literal("done"),
1746
+ data: z6.literal("")
1499
1747
  })
1500
1748
  ]);
1501
- var ChatCompletionContentPartTextWithTitle = z5.object({
1502
- text: z5.string().default(""),
1503
- type: z5.literal("text"),
1504
- cache_control: z5.object({ type: z5.literal("ephemeral") }).optional()
1749
+ var ChatCompletionContentPartTextWithTitle = z6.object({
1750
+ text: z6.string().default(""),
1751
+ type: z6.literal("text"),
1752
+ cache_control: z6.object({ type: z6.literal("ephemeral") }).optional()
1505
1753
  });
1506
- var ChatCompletionContentPartImageWithTitle = z5.object({
1507
- image_url: z5.object({
1508
- url: z5.string(),
1509
- detail: z5.union([z5.literal("auto"), z5.literal("low"), z5.literal("high")]).optional()
1754
+ var ChatCompletionContentPartImageWithTitle = z6.object({
1755
+ image_url: z6.object({
1756
+ url: z6.string(),
1757
+ detail: z6.union([z6.literal("auto"), z6.literal("low"), z6.literal("high")]).optional()
1510
1758
  }),
1511
- type: z5.literal("image_url")
1759
+ type: z6.literal("image_url")
1512
1760
  });
1513
- var ChatCompletionContentPart = z5.union([
1761
+ var ChatCompletionContentPart = z6.union([
1514
1762
  ChatCompletionContentPartTextWithTitle,
1515
1763
  ChatCompletionContentPartImageWithTitle
1516
1764
  ]);
1517
- var ChatCompletionContentPartText = z5.object({
1518
- text: z5.string().default(""),
1519
- type: z5.literal("text"),
1520
- cache_control: z5.object({ type: z5.literal("ephemeral") }).optional()
1765
+ var ChatCompletionContentPartText = z6.object({
1766
+ text: z6.string().default(""),
1767
+ type: z6.literal("text"),
1768
+ cache_control: z6.object({ type: z6.literal("ephemeral") }).optional()
1521
1769
  });
1522
- var ChatCompletionMessageToolCall = z5.object({
1523
- id: z5.string(),
1524
- function: z5.object({ arguments: z5.string(), name: z5.string() }),
1525
- type: z5.literal("function")
1770
+ var ChatCompletionMessageToolCall = z6.object({
1771
+ id: z6.string(),
1772
+ function: z6.object({ arguments: z6.string(), name: z6.string() }),
1773
+ type: z6.literal("function")
1526
1774
  });
1527
- var ChatCompletionMessageReasoning = z5.object({ id: z5.string(), content: z5.string() }).partial();
1528
- var ChatCompletionMessageParam = z5.union([
1529
- z5.object({
1530
- content: z5.union([z5.string(), z5.array(ChatCompletionContentPartText)]),
1531
- role: z5.literal("system"),
1532
- name: z5.string().optional()
1775
+ var ChatCompletionMessageReasoning = z6.object({ id: z6.string(), content: z6.string() }).partial();
1776
+ var ChatCompletionMessageParam = z6.union([
1777
+ z6.object({
1778
+ content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
1779
+ role: z6.literal("system"),
1780
+ name: z6.string().optional()
1533
1781
  }),
1534
- z5.object({
1535
- content: z5.union([z5.string(), z5.array(ChatCompletionContentPart)]),
1536
- role: z5.literal("user"),
1537
- name: z5.string().optional()
1782
+ z6.object({
1783
+ content: z6.union([z6.string(), z6.array(ChatCompletionContentPart)]),
1784
+ role: z6.literal("user"),
1785
+ name: z6.string().optional()
1538
1786
  }),
1539
- z5.object({
1540
- role: z5.literal("assistant"),
1541
- content: z5.union([z5.string(), z5.array(ChatCompletionContentPartText), z5.null()]).optional(),
1542
- function_call: z5.object({ arguments: z5.string(), name: z5.string() }).optional(),
1543
- name: z5.string().optional(),
1544
- tool_calls: z5.array(ChatCompletionMessageToolCall).optional(),
1545
- reasoning: z5.array(ChatCompletionMessageReasoning).optional()
1787
+ z6.object({
1788
+ role: z6.literal("assistant"),
1789
+ content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText), z6.null()]).optional(),
1790
+ function_call: z6.object({ arguments: z6.string(), name: z6.string() }).optional(),
1791
+ name: z6.string().optional(),
1792
+ tool_calls: z6.array(ChatCompletionMessageToolCall).optional(),
1793
+ reasoning: z6.array(ChatCompletionMessageReasoning).optional()
1546
1794
  }),
1547
- z5.object({
1548
- content: z5.union([z5.string(), z5.array(ChatCompletionContentPartText)]),
1549
- role: z5.literal("tool"),
1550
- tool_call_id: z5.string().default("")
1795
+ z6.object({
1796
+ content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
1797
+ role: z6.literal("tool"),
1798
+ tool_call_id: z6.string().default("")
1551
1799
  }),
1552
- z5.object({
1553
- content: z5.union([z5.string(), z5.null()]),
1554
- name: z5.string(),
1555
- role: z5.literal("function")
1800
+ z6.object({
1801
+ content: z6.union([z6.string(), z6.null()]),
1802
+ name: z6.string(),
1803
+ role: z6.literal("function")
1556
1804
  }),
1557
- z5.object({
1558
- content: z5.union([z5.string(), z5.array(ChatCompletionContentPartText)]),
1559
- role: z5.literal("developer"),
1560
- name: z5.string().optional()
1805
+ z6.object({
1806
+ content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
1807
+ role: z6.literal("developer"),
1808
+ name: z6.string().optional()
1561
1809
  }),
1562
- z5.object({
1563
- role: z5.literal("model"),
1564
- content: z5.union([z5.string(), z5.null()]).optional()
1810
+ z6.object({
1811
+ role: z6.literal("model"),
1812
+ content: z6.union([z6.string(), z6.null()]).optional()
1565
1813
  })
1566
1814
  ]);
1567
- var ChatCompletionOpenAIMessageParam = z5.union([
1568
- z5.object({
1569
- content: z5.union([z5.string(), z5.array(ChatCompletionContentPartText)]),
1570
- role: z5.literal("system"),
1571
- name: z5.string().optional()
1815
+ var ChatCompletionOpenAIMessageParam = z6.union([
1816
+ z6.object({
1817
+ content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
1818
+ role: z6.literal("system"),
1819
+ name: z6.string().optional()
1572
1820
  }),
1573
- z5.object({
1574
- content: z5.union([z5.string(), z5.array(ChatCompletionContentPart)]),
1575
- role: z5.literal("user"),
1576
- name: z5.string().optional()
1821
+ z6.object({
1822
+ content: z6.union([z6.string(), z6.array(ChatCompletionContentPart)]),
1823
+ role: z6.literal("user"),
1824
+ name: z6.string().optional()
1577
1825
  }),
1578
- z5.object({
1579
- role: z5.literal("assistant"),
1580
- content: z5.union([z5.string(), z5.array(ChatCompletionContentPartText), z5.null()]).optional(),
1581
- function_call: z5.object({ arguments: z5.string(), name: z5.string() }).optional(),
1582
- name: z5.string().optional(),
1583
- tool_calls: z5.array(ChatCompletionMessageToolCall).optional(),
1584
- reasoning: z5.array(ChatCompletionMessageReasoning).optional()
1826
+ z6.object({
1827
+ role: z6.literal("assistant"),
1828
+ content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText), z6.null()]).optional(),
1829
+ function_call: z6.object({ arguments: z6.string(), name: z6.string() }).optional(),
1830
+ name: z6.string().optional(),
1831
+ tool_calls: z6.array(ChatCompletionMessageToolCall).optional(),
1832
+ reasoning: z6.array(ChatCompletionMessageReasoning).optional()
1585
1833
  }),
1586
- z5.object({
1587
- content: z5.union([z5.string(), z5.array(ChatCompletionContentPartText)]),
1588
- role: z5.literal("tool"),
1589
- tool_call_id: z5.string().default("")
1834
+ z6.object({
1835
+ content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
1836
+ role: z6.literal("tool"),
1837
+ tool_call_id: z6.string().default("")
1590
1838
  }),
1591
- z5.object({
1592
- content: z5.union([z5.string(), z5.null()]),
1593
- name: z5.string(),
1594
- role: z5.literal("function")
1839
+ z6.object({
1840
+ content: z6.union([z6.string(), z6.null()]),
1841
+ name: z6.string(),
1842
+ role: z6.literal("function")
1595
1843
  }),
1596
- z5.object({
1597
- content: z5.union([z5.string(), z5.array(ChatCompletionContentPartText)]),
1598
- role: z5.literal("developer"),
1599
- name: z5.string().optional()
1844
+ z6.object({
1845
+ content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
1846
+ role: z6.literal("developer"),
1847
+ name: z6.string().optional()
1600
1848
  })
1601
1849
  ]);
1602
- var ChatCompletionTool = z5.object({
1603
- function: z5.object({
1604
- name: z5.string(),
1605
- description: z5.string().optional(),
1606
- parameters: z5.object({}).partial().passthrough().optional()
1850
+ var ChatCompletionTool = z6.object({
1851
+ function: z6.object({
1852
+ name: z6.string(),
1853
+ description: z6.string().optional(),
1854
+ parameters: z6.object({}).partial().passthrough().optional()
1607
1855
  }),
1608
- type: z5.literal("function")
1856
+ type: z6.literal("function")
1609
1857
  });
1610
- var CodeBundle = z5.object({
1611
- runtime_context: z5.object({
1612
- runtime: z5.enum(["node", "python"]),
1613
- version: z5.string()
1858
+ var CodeBundle = z6.object({
1859
+ runtime_context: z6.object({
1860
+ runtime: z6.enum(["node", "python"]),
1861
+ version: z6.string()
1614
1862
  }),
1615
- location: z5.union([
1616
- z5.object({
1617
- type: z5.literal("experiment"),
1618
- eval_name: z5.string(),
1619
- position: z5.union([
1620
- z5.object({ type: z5.literal("task") }),
1621
- z5.object({ type: z5.literal("scorer"), index: z5.number().int().gte(0) })
1863
+ location: z6.union([
1864
+ z6.object({
1865
+ type: z6.literal("experiment"),
1866
+ eval_name: z6.string(),
1867
+ position: z6.union([
1868
+ z6.object({ type: z6.literal("task") }),
1869
+ z6.object({ type: z6.literal("scorer"), index: z6.number().int().gte(0) })
1622
1870
  ])
1623
1871
  }),
1624
- z5.object({ type: z5.literal("function"), index: z5.number().int().gte(0) })
1872
+ z6.object({ type: z6.literal("function"), index: z6.number().int().gte(0) })
1625
1873
  ]),
1626
- bundle_id: z5.string(),
1627
- preview: z5.union([z5.string(), z5.null()]).optional()
1874
+ bundle_id: z6.string(),
1875
+ preview: z6.union([z6.string(), z6.null()]).optional()
1628
1876
  });
1629
- var Dataset = z5.object({
1630
- id: z5.string().uuid(),
1631
- project_id: z5.string().uuid(),
1632
- name: z5.string(),
1633
- description: z5.union([z5.string(), z5.null()]).optional(),
1634
- created: z5.union([z5.string(), z5.null()]).optional(),
1635
- deleted_at: z5.union([z5.string(), z5.null()]).optional(),
1636
- user_id: z5.union([z5.string(), z5.null()]).optional(),
1637
- metadata: z5.union([z5.object({}).partial().passthrough(), z5.null()]).optional()
1877
+ var Dataset = z6.object({
1878
+ id: z6.string().uuid(),
1879
+ project_id: z6.string().uuid(),
1880
+ name: z6.string(),
1881
+ description: z6.union([z6.string(), z6.null()]).optional(),
1882
+ created: z6.union([z6.string(), z6.null()]).optional(),
1883
+ deleted_at: z6.union([z6.string(), z6.null()]).optional(),
1884
+ user_id: z6.union([z6.string(), z6.null()]).optional(),
1885
+ metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional()
1638
1886
  });
1639
- var ObjectReferenceNullish = z5.union([
1640
- z5.object({
1641
- object_type: z5.enum([
1887
+ var ObjectReferenceNullish = z6.union([
1888
+ z6.object({
1889
+ object_type: z6.enum([
1642
1890
  "project_logs",
1643
1891
  "experiment",
1644
1892
  "dataset",
@@ -1646,399 +1894,399 @@ var ObjectReferenceNullish = z5.union([
1646
1894
  "function",
1647
1895
  "prompt_session"
1648
1896
  ]),
1649
- object_id: z5.string().uuid(),
1650
- id: z5.string(),
1651
- _xact_id: z5.union([z5.string(), z5.null()]).optional(),
1652
- created: z5.union([z5.string(), z5.null()]).optional()
1897
+ object_id: z6.string().uuid(),
1898
+ id: z6.string(),
1899
+ _xact_id: z6.union([z6.string(), z6.null()]).optional(),
1900
+ created: z6.union([z6.string(), z6.null()]).optional()
1653
1901
  }),
1654
- z5.null()
1902
+ z6.null()
1655
1903
  ]);
1656
- var DatasetEvent = z5.object({
1657
- id: z5.string(),
1658
- _xact_id: z5.string(),
1659
- created: z5.string().datetime({ offset: true }),
1660
- _pagination_key: z5.union([z5.string(), z5.null()]).optional(),
1661
- project_id: z5.string().uuid(),
1662
- dataset_id: z5.string().uuid(),
1663
- input: z5.unknown().optional(),
1664
- expected: z5.unknown().optional(),
1665
- metadata: z5.union([
1666
- z5.object({ model: z5.union([z5.string(), z5.null()]) }).partial().passthrough(),
1667
- z5.null()
1904
+ var DatasetEvent = z6.object({
1905
+ id: z6.string(),
1906
+ _xact_id: z6.string(),
1907
+ created: z6.string().datetime({ offset: true }),
1908
+ _pagination_key: z6.union([z6.string(), z6.null()]).optional(),
1909
+ project_id: z6.string().uuid(),
1910
+ dataset_id: z6.string().uuid(),
1911
+ input: z6.unknown().optional(),
1912
+ expected: z6.unknown().optional(),
1913
+ metadata: z6.union([
1914
+ z6.object({ model: z6.union([z6.string(), z6.null()]) }).partial().passthrough(),
1915
+ z6.null()
1668
1916
  ]).optional(),
1669
- tags: z5.union([z5.array(z5.string()), z5.null()]).optional(),
1670
- span_id: z5.string(),
1671
- root_span_id: z5.string(),
1672
- is_root: z5.union([z5.boolean(), z5.null()]).optional(),
1917
+ tags: z6.union([z6.array(z6.string()), z6.null()]).optional(),
1918
+ span_id: z6.string(),
1919
+ root_span_id: z6.string(),
1920
+ is_root: z6.union([z6.boolean(), z6.null()]).optional(),
1673
1921
  origin: ObjectReferenceNullish.optional()
1674
1922
  });
1675
- var EnvVar = z5.object({
1676
- id: z5.string().uuid(),
1677
- object_type: z5.enum(["organization", "project", "function"]),
1678
- object_id: z5.string().uuid(),
1679
- name: z5.string(),
1680
- created: z5.union([z5.string(), z5.null()]).optional(),
1681
- used: z5.union([z5.string(), z5.null()]).optional()
1923
+ var EnvVar = z6.object({
1924
+ id: z6.string().uuid(),
1925
+ object_type: z6.enum(["organization", "project", "function"]),
1926
+ object_id: z6.string().uuid(),
1927
+ name: z6.string(),
1928
+ created: z6.union([z6.string(), z6.null()]).optional(),
1929
+ used: z6.union([z6.string(), z6.null()]).optional()
1682
1930
  });
1683
- var RepoInfo = z5.union([
1684
- z5.object({
1685
- commit: z5.union([z5.string(), z5.null()]),
1686
- branch: z5.union([z5.string(), z5.null()]),
1687
- tag: z5.union([z5.string(), z5.null()]),
1688
- dirty: z5.union([z5.boolean(), z5.null()]),
1689
- author_name: z5.union([z5.string(), z5.null()]),
1690
- author_email: z5.union([z5.string(), z5.null()]),
1691
- commit_message: z5.union([z5.string(), z5.null()]),
1692
- commit_time: z5.union([z5.string(), z5.null()]),
1693
- git_diff: z5.union([z5.string(), z5.null()])
1931
+ var RepoInfo = z6.union([
1932
+ z6.object({
1933
+ commit: z6.union([z6.string(), z6.null()]),
1934
+ branch: z6.union([z6.string(), z6.null()]),
1935
+ tag: z6.union([z6.string(), z6.null()]),
1936
+ dirty: z6.union([z6.boolean(), z6.null()]),
1937
+ author_name: z6.union([z6.string(), z6.null()]),
1938
+ author_email: z6.union([z6.string(), z6.null()]),
1939
+ commit_message: z6.union([z6.string(), z6.null()]),
1940
+ commit_time: z6.union([z6.string(), z6.null()]),
1941
+ git_diff: z6.union([z6.string(), z6.null()])
1694
1942
  }).partial(),
1695
- z5.null()
1943
+ z6.null()
1696
1944
  ]);
1697
- var Experiment = z5.object({
1698
- id: z5.string().uuid(),
1699
- project_id: z5.string().uuid(),
1700
- name: z5.string(),
1701
- description: z5.union([z5.string(), z5.null()]).optional(),
1702
- created: z5.union([z5.string(), z5.null()]).optional(),
1945
+ var Experiment = z6.object({
1946
+ id: z6.string().uuid(),
1947
+ project_id: z6.string().uuid(),
1948
+ name: z6.string(),
1949
+ description: z6.union([z6.string(), z6.null()]).optional(),
1950
+ created: z6.union([z6.string(), z6.null()]).optional(),
1703
1951
  repo_info: RepoInfo.optional(),
1704
- commit: z5.union([z5.string(), z5.null()]).optional(),
1705
- base_exp_id: z5.union([z5.string(), z5.null()]).optional(),
1706
- deleted_at: z5.union([z5.string(), z5.null()]).optional(),
1707
- dataset_id: z5.union([z5.string(), z5.null()]).optional(),
1708
- dataset_version: z5.union([z5.string(), z5.null()]).optional(),
1709
- public: z5.boolean(),
1710
- user_id: z5.union([z5.string(), z5.null()]).optional(),
1711
- metadata: z5.union([z5.object({}).partial().passthrough(), z5.null()]).optional(),
1712
- tags: z5.union([z5.array(z5.string()), z5.null()]).optional()
1952
+ commit: z6.union([z6.string(), z6.null()]).optional(),
1953
+ base_exp_id: z6.union([z6.string(), z6.null()]).optional(),
1954
+ deleted_at: z6.union([z6.string(), z6.null()]).optional(),
1955
+ dataset_id: z6.union([z6.string(), z6.null()]).optional(),
1956
+ dataset_version: z6.union([z6.string(), z6.null()]).optional(),
1957
+ public: z6.boolean(),
1958
+ user_id: z6.union([z6.string(), z6.null()]).optional(),
1959
+ metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional(),
1960
+ tags: z6.union([z6.array(z6.string()), z6.null()]).optional()
1713
1961
  });
1714
- var SpanType = z5.union([
1715
- z5.enum(["llm", "score", "function", "eval", "task", "tool"]),
1716
- z5.null()
1962
+ var SpanType = z6.union([
1963
+ z6.enum(["llm", "score", "function", "eval", "task", "tool"]),
1964
+ z6.null()
1717
1965
  ]);
1718
- var SpanAttributes = z5.union([
1719
- z5.object({ name: z5.union([z5.string(), z5.null()]), type: SpanType }).partial().passthrough(),
1720
- z5.null()
1966
+ var SpanAttributes = z6.union([
1967
+ z6.object({ name: z6.union([z6.string(), z6.null()]), type: SpanType }).partial().passthrough(),
1968
+ z6.null()
1721
1969
  ]);
1722
- var ExperimentEvent = z5.object({
1723
- id: z5.string(),
1724
- _xact_id: z5.string(),
1725
- created: z5.string().datetime({ offset: true }),
1726
- _pagination_key: z5.union([z5.string(), z5.null()]).optional(),
1727
- project_id: z5.string().uuid(),
1728
- experiment_id: z5.string().uuid(),
1729
- input: z5.unknown().optional(),
1730
- output: z5.unknown().optional(),
1731
- expected: z5.unknown().optional(),
1732
- error: z5.unknown().optional(),
1733
- scores: z5.union([z5.record(z5.union([z5.number(), z5.null()])), z5.null()]).optional(),
1734
- metadata: z5.union([
1735
- z5.object({ model: z5.union([z5.string(), z5.null()]) }).partial().passthrough(),
1736
- z5.null()
1970
+ var ExperimentEvent = z6.object({
1971
+ id: z6.string(),
1972
+ _xact_id: z6.string(),
1973
+ created: z6.string().datetime({ offset: true }),
1974
+ _pagination_key: z6.union([z6.string(), z6.null()]).optional(),
1975
+ project_id: z6.string().uuid(),
1976
+ experiment_id: z6.string().uuid(),
1977
+ input: z6.unknown().optional(),
1978
+ output: z6.unknown().optional(),
1979
+ expected: z6.unknown().optional(),
1980
+ error: z6.unknown().optional(),
1981
+ scores: z6.union([z6.record(z6.union([z6.number(), z6.null()])), z6.null()]).optional(),
1982
+ metadata: z6.union([
1983
+ z6.object({ model: z6.union([z6.string(), z6.null()]) }).partial().passthrough(),
1984
+ z6.null()
1737
1985
  ]).optional(),
1738
- tags: z5.union([z5.array(z5.string()), z5.null()]).optional(),
1739
- metrics: z5.union([z5.record(z5.number()), z5.null()]).optional(),
1740
- context: z5.union([
1741
- z5.object({
1742
- caller_functionname: z5.union([z5.string(), z5.null()]),
1743
- caller_filename: z5.union([z5.string(), z5.null()]),
1744
- caller_lineno: z5.union([z5.number(), z5.null()])
1986
+ tags: z6.union([z6.array(z6.string()), z6.null()]).optional(),
1987
+ metrics: z6.union([z6.record(z6.number()), z6.null()]).optional(),
1988
+ context: z6.union([
1989
+ z6.object({
1990
+ caller_functionname: z6.union([z6.string(), z6.null()]),
1991
+ caller_filename: z6.union([z6.string(), z6.null()]),
1992
+ caller_lineno: z6.union([z6.number(), z6.null()])
1745
1993
  }).partial().passthrough(),
1746
- z5.null()
1994
+ z6.null()
1747
1995
  ]).optional(),
1748
- span_id: z5.string(),
1749
- span_parents: z5.union([z5.array(z5.string()), z5.null()]).optional(),
1750
- root_span_id: z5.string(),
1996
+ span_id: z6.string(),
1997
+ span_parents: z6.union([z6.array(z6.string()), z6.null()]).optional(),
1998
+ root_span_id: z6.string(),
1751
1999
  span_attributes: SpanAttributes.optional(),
1752
- is_root: z5.union([z5.boolean(), z5.null()]).optional(),
2000
+ is_root: z6.union([z6.boolean(), z6.null()]).optional(),
1753
2001
  origin: ObjectReferenceNullish.optional()
1754
2002
  });
1755
- var ExtendedSavedFunctionId = z5.union([
1756
- z5.object({ type: z5.literal("function"), id: z5.string() }),
1757
- z5.object({ type: z5.literal("global"), name: z5.string() }),
1758
- z5.object({
1759
- type: z5.literal("slug"),
1760
- project_id: z5.string(),
1761
- slug: z5.string()
2003
+ var ExtendedSavedFunctionId = z6.union([
2004
+ z6.object({ type: z6.literal("function"), id: z6.string() }),
2005
+ z6.object({ type: z6.literal("global"), name: z6.string() }),
2006
+ z6.object({
2007
+ type: z6.literal("slug"),
2008
+ project_id: z6.string(),
2009
+ slug: z6.string()
1762
2010
  })
1763
2011
  ]);
1764
- var PromptBlockDataNullish = z5.union([
1765
- z5.object({ type: z5.literal("completion"), content: z5.string() }),
1766
- z5.object({
1767
- type: z5.literal("chat"),
1768
- messages: z5.array(ChatCompletionMessageParam),
1769
- tools: z5.string().optional()
2012
+ var PromptBlockDataNullish = z6.union([
2013
+ z6.object({ type: z6.literal("completion"), content: z6.string() }),
2014
+ z6.object({
2015
+ type: z6.literal("chat"),
2016
+ messages: z6.array(ChatCompletionMessageParam),
2017
+ tools: z6.string().optional()
1770
2018
  }),
1771
- z5.null()
2019
+ z6.null()
1772
2020
  ]);
1773
- var ModelParams = z5.union([
1774
- z5.object({
1775
- use_cache: z5.boolean(),
1776
- temperature: z5.number(),
1777
- top_p: z5.number(),
1778
- max_tokens: z5.number(),
1779
- max_completion_tokens: z5.number(),
1780
- frequency_penalty: z5.number(),
1781
- presence_penalty: z5.number(),
2021
+ var ModelParams = z6.union([
2022
+ z6.object({
2023
+ use_cache: z6.boolean(),
2024
+ temperature: z6.number(),
2025
+ top_p: z6.number(),
2026
+ max_tokens: z6.number(),
2027
+ max_completion_tokens: z6.number(),
2028
+ frequency_penalty: z6.number(),
2029
+ presence_penalty: z6.number(),
1782
2030
  response_format: ResponseFormatNullish,
1783
- tool_choice: z5.union([
1784
- z5.literal("auto"),
1785
- z5.literal("none"),
1786
- z5.literal("required"),
1787
- z5.object({
1788
- type: z5.literal("function"),
1789
- function: z5.object({ name: z5.string() })
2031
+ tool_choice: z6.union([
2032
+ z6.literal("auto"),
2033
+ z6.literal("none"),
2034
+ z6.literal("required"),
2035
+ z6.object({
2036
+ type: z6.literal("function"),
2037
+ function: z6.object({ name: z6.string() })
1790
2038
  })
1791
2039
  ]),
1792
- function_call: z5.union([
1793
- z5.literal("auto"),
1794
- z5.literal("none"),
1795
- z5.object({ name: z5.string() })
2040
+ function_call: z6.union([
2041
+ z6.literal("auto"),
2042
+ z6.literal("none"),
2043
+ z6.object({ name: z6.string() })
1796
2044
  ]),
1797
- n: z5.number(),
1798
- stop: z5.array(z5.string()),
1799
- reasoning_effort: z5.enum(["minimal", "low", "medium", "high"]),
1800
- verbosity: z5.enum(["low", "medium", "high"])
2045
+ n: z6.number(),
2046
+ stop: z6.array(z6.string()),
2047
+ reasoning_effort: z6.enum(["minimal", "low", "medium", "high"]),
2048
+ verbosity: z6.enum(["low", "medium", "high"])
1801
2049
  }).partial().passthrough(),
1802
- z5.object({
1803
- use_cache: z5.boolean().optional(),
1804
- max_tokens: z5.number(),
1805
- temperature: z5.number(),
1806
- top_p: z5.number().optional(),
1807
- top_k: z5.number().optional(),
1808
- stop_sequences: z5.array(z5.string()).optional(),
1809
- max_tokens_to_sample: z5.number().optional()
2050
+ z6.object({
2051
+ use_cache: z6.boolean().optional(),
2052
+ max_tokens: z6.number(),
2053
+ temperature: z6.number(),
2054
+ top_p: z6.number().optional(),
2055
+ top_k: z6.number().optional(),
2056
+ stop_sequences: z6.array(z6.string()).optional(),
2057
+ max_tokens_to_sample: z6.number().optional()
1810
2058
  }).passthrough(),
1811
- z5.object({
1812
- use_cache: z5.boolean(),
1813
- temperature: z5.number(),
1814
- maxOutputTokens: z5.number(),
1815
- topP: z5.number(),
1816
- topK: z5.number()
2059
+ z6.object({
2060
+ use_cache: z6.boolean(),
2061
+ temperature: z6.number(),
2062
+ maxOutputTokens: z6.number(),
2063
+ topP: z6.number(),
2064
+ topK: z6.number()
1817
2065
  }).partial().passthrough(),
1818
- z5.object({
1819
- use_cache: z5.boolean(),
1820
- temperature: z5.number(),
1821
- topK: z5.number()
2066
+ z6.object({
2067
+ use_cache: z6.boolean(),
2068
+ temperature: z6.number(),
2069
+ topK: z6.number()
1822
2070
  }).partial().passthrough(),
1823
- z5.object({ use_cache: z5.boolean() }).partial().passthrough()
2071
+ z6.object({ use_cache: z6.boolean() }).partial().passthrough()
1824
2072
  ]);
1825
- var PromptOptionsNullish = z5.union([
1826
- z5.object({ model: z5.string(), params: ModelParams, position: z5.string() }).partial(),
1827
- z5.null()
2073
+ var PromptOptionsNullish = z6.union([
2074
+ z6.object({ model: z6.string(), params: ModelParams, position: z6.string() }).partial(),
2075
+ z6.null()
1828
2076
  ]);
1829
- var PromptParserNullish = z5.union([
1830
- z5.object({
1831
- type: z5.literal("llm_classifier"),
1832
- use_cot: z5.boolean(),
1833
- choice_scores: z5.record(z5.number().gte(0).lte(1))
2077
+ var PromptParserNullish = z6.union([
2078
+ z6.object({
2079
+ type: z6.literal("llm_classifier"),
2080
+ use_cot: z6.boolean(),
2081
+ choice_scores: z6.record(z6.number().gte(0).lte(1))
1834
2082
  }),
1835
- z5.null()
2083
+ z6.null()
1836
2084
  ]);
1837
- var SavedFunctionId = z5.union([
1838
- z5.object({ type: z5.literal("function"), id: z5.string() }),
1839
- z5.object({ type: z5.literal("global"), name: z5.string() })
2085
+ var SavedFunctionId = z6.union([
2086
+ z6.object({ type: z6.literal("function"), id: z6.string() }),
2087
+ z6.object({ type: z6.literal("global"), name: z6.string() })
1840
2088
  ]);
1841
- var PromptDataNullish = z5.union([
1842
- z5.object({
2089
+ var PromptDataNullish = z6.union([
2090
+ z6.object({
1843
2091
  prompt: PromptBlockDataNullish,
1844
2092
  options: PromptOptionsNullish,
1845
2093
  parser: PromptParserNullish,
1846
- tool_functions: z5.union([z5.array(SavedFunctionId), z5.null()]),
1847
- origin: z5.union([
1848
- z5.object({
1849
- prompt_id: z5.string(),
1850
- project_id: z5.string(),
1851
- prompt_version: z5.string()
2094
+ tool_functions: z6.union([z6.array(SavedFunctionId), z6.null()]),
2095
+ origin: z6.union([
2096
+ z6.object({
2097
+ prompt_id: z6.string(),
2098
+ project_id: z6.string(),
2099
+ prompt_version: z6.string()
1852
2100
  }).partial(),
1853
- z5.null()
2101
+ z6.null()
1854
2102
  ])
1855
2103
  }).partial(),
1856
- z5.null()
2104
+ z6.null()
1857
2105
  ]);
1858
- var FunctionTypeEnumNullish = z5.union([
1859
- z5.enum(["llm", "scorer", "task", "tool"]),
1860
- z5.null()
2106
+ var FunctionTypeEnumNullish = z6.union([
2107
+ z6.enum(["llm", "scorer", "task", "tool"]),
2108
+ z6.null()
1861
2109
  ]);
1862
- var FunctionIdRef = z5.object({}).partial().passthrough();
1863
- var PromptBlockData = z5.union([
1864
- z5.object({ type: z5.literal("completion"), content: z5.string() }),
1865
- z5.object({
1866
- type: z5.literal("chat"),
1867
- messages: z5.array(ChatCompletionMessageParam),
1868
- tools: z5.string().optional()
2110
+ var FunctionIdRef = z6.object({}).partial().passthrough();
2111
+ var PromptBlockData = z6.union([
2112
+ z6.object({ type: z6.literal("completion"), content: z6.string() }),
2113
+ z6.object({
2114
+ type: z6.literal("chat"),
2115
+ messages: z6.array(ChatCompletionMessageParam),
2116
+ tools: z6.string().optional()
1869
2117
  })
1870
2118
  ]);
1871
- var GraphNode = z5.union([
1872
- z5.object({
1873
- description: z5.union([z5.string(), z5.null()]).optional(),
1874
- position: z5.union([z5.object({ x: z5.number(), y: z5.number() }), z5.null()]).optional(),
1875
- type: z5.literal("function"),
2119
+ var GraphNode = z6.union([
2120
+ z6.object({
2121
+ description: z6.union([z6.string(), z6.null()]).optional(),
2122
+ position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
2123
+ type: z6.literal("function"),
1876
2124
  function: FunctionIdRef
1877
2125
  }),
1878
- z5.object({
1879
- description: z5.union([z5.string(), z5.null()]).optional(),
1880
- position: z5.union([z5.object({ x: z5.number(), y: z5.number() }), z5.null()]).optional(),
1881
- type: z5.literal("input")
2126
+ z6.object({
2127
+ description: z6.union([z6.string(), z6.null()]).optional(),
2128
+ position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
2129
+ type: z6.literal("input")
1882
2130
  }),
1883
- z5.object({
1884
- description: z5.union([z5.string(), z5.null()]).optional(),
1885
- position: z5.union([z5.object({ x: z5.number(), y: z5.number() }), z5.null()]).optional(),
1886
- type: z5.literal("output")
2131
+ z6.object({
2132
+ description: z6.union([z6.string(), z6.null()]).optional(),
2133
+ position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
2134
+ type: z6.literal("output")
1887
2135
  }),
1888
- z5.object({
1889
- description: z5.union([z5.string(), z5.null()]).optional(),
1890
- position: z5.union([z5.object({ x: z5.number(), y: z5.number() }), z5.null()]).optional(),
1891
- type: z5.literal("literal"),
1892
- value: z5.unknown().optional()
2136
+ z6.object({
2137
+ description: z6.union([z6.string(), z6.null()]).optional(),
2138
+ position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
2139
+ type: z6.literal("literal"),
2140
+ value: z6.unknown().optional()
1893
2141
  }),
1894
- z5.object({
1895
- description: z5.union([z5.string(), z5.null()]).optional(),
1896
- position: z5.union([z5.object({ x: z5.number(), y: z5.number() }), z5.null()]).optional(),
1897
- type: z5.literal("btql"),
1898
- expr: z5.string()
2142
+ z6.object({
2143
+ description: z6.union([z6.string(), z6.null()]).optional(),
2144
+ position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
2145
+ type: z6.literal("btql"),
2146
+ expr: z6.string()
1899
2147
  }),
1900
- z5.object({
1901
- description: z5.union([z5.string(), z5.null()]).optional(),
1902
- position: z5.union([z5.object({ x: z5.number(), y: z5.number() }), z5.null()]).optional(),
1903
- type: z5.literal("gate"),
1904
- condition: z5.union([z5.string(), z5.null()]).optional()
2148
+ z6.object({
2149
+ description: z6.union([z6.string(), z6.null()]).optional(),
2150
+ position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
2151
+ type: z6.literal("gate"),
2152
+ condition: z6.union([z6.string(), z6.null()]).optional()
1905
2153
  }),
1906
- z5.object({
1907
- description: z5.union([z5.string(), z5.null()]).optional(),
1908
- position: z5.union([z5.object({ x: z5.number(), y: z5.number() }), z5.null()]).optional(),
1909
- type: z5.literal("aggregator")
2154
+ z6.object({
2155
+ description: z6.union([z6.string(), z6.null()]).optional(),
2156
+ position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
2157
+ type: z6.literal("aggregator")
1910
2158
  }),
1911
- z5.object({
1912
- description: z5.union([z5.string(), z5.null()]).optional(),
1913
- position: z5.union([z5.object({ x: z5.number(), y: z5.number() }), z5.null()]).optional(),
1914
- type: z5.literal("prompt_template"),
2159
+ z6.object({
2160
+ description: z6.union([z6.string(), z6.null()]).optional(),
2161
+ position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
2162
+ type: z6.literal("prompt_template"),
1915
2163
  prompt: PromptBlockData
1916
2164
  })
1917
2165
  ]);
1918
- var GraphEdge = z5.object({
1919
- source: z5.object({ node: z5.string().max(1024), variable: z5.string() }),
1920
- target: z5.object({ node: z5.string().max(1024), variable: z5.string() }),
1921
- purpose: z5.enum(["control", "data", "messages"])
2166
+ var GraphEdge = z6.object({
2167
+ source: z6.object({ node: z6.string().max(1024), variable: z6.string() }),
2168
+ target: z6.object({ node: z6.string().max(1024), variable: z6.string() }),
2169
+ purpose: z6.enum(["control", "data", "messages"])
1922
2170
  });
1923
- var GraphData = z5.object({
1924
- type: z5.literal("graph"),
1925
- nodes: z5.record(GraphNode),
1926
- edges: z5.record(GraphEdge)
2171
+ var GraphData = z6.object({
2172
+ type: z6.literal("graph"),
2173
+ nodes: z6.record(GraphNode),
2174
+ edges: z6.record(GraphEdge)
1927
2175
  });
1928
- var FunctionData = z5.union([
1929
- z5.object({ type: z5.literal("prompt") }),
1930
- z5.object({
1931
- type: z5.literal("code"),
1932
- data: z5.union([
1933
- z5.object({ type: z5.literal("bundle") }).and(CodeBundle),
1934
- z5.object({
1935
- type: z5.literal("inline"),
1936
- runtime_context: z5.object({
1937
- runtime: z5.enum(["node", "python"]),
1938
- version: z5.string()
2176
+ var FunctionData = z6.union([
2177
+ z6.object({ type: z6.literal("prompt") }),
2178
+ z6.object({
2179
+ type: z6.literal("code"),
2180
+ data: z6.union([
2181
+ z6.object({ type: z6.literal("bundle") }).and(CodeBundle),
2182
+ z6.object({
2183
+ type: z6.literal("inline"),
2184
+ runtime_context: z6.object({
2185
+ runtime: z6.enum(["node", "python"]),
2186
+ version: z6.string()
1939
2187
  }),
1940
- code: z5.string()
2188
+ code: z6.string()
1941
2189
  })
1942
2190
  ])
1943
2191
  }),
1944
2192
  GraphData,
1945
- z5.object({
1946
- type: z5.literal("remote_eval"),
1947
- endpoint: z5.string(),
1948
- eval_name: z5.string(),
1949
- parameters: z5.object({}).partial().passthrough()
2193
+ z6.object({
2194
+ type: z6.literal("remote_eval"),
2195
+ endpoint: z6.string(),
2196
+ eval_name: z6.string(),
2197
+ parameters: z6.object({}).partial().passthrough()
1950
2198
  }),
1951
- z5.object({ type: z5.literal("global"), name: z5.string() })
2199
+ z6.object({ type: z6.literal("global"), name: z6.string() })
1952
2200
  ]);
1953
- var Function = z5.object({
1954
- id: z5.string().uuid(),
1955
- _xact_id: z5.string(),
1956
- project_id: z5.string().uuid(),
1957
- log_id: z5.literal("p"),
1958
- org_id: z5.string().uuid(),
1959
- name: z5.string(),
1960
- slug: z5.string(),
1961
- description: z5.union([z5.string(), z5.null()]).optional(),
1962
- created: z5.union([z5.string(), z5.null()]).optional(),
2201
+ var Function = z6.object({
2202
+ id: z6.string().uuid(),
2203
+ _xact_id: z6.string(),
2204
+ project_id: z6.string().uuid(),
2205
+ log_id: z6.literal("p"),
2206
+ org_id: z6.string().uuid(),
2207
+ name: z6.string(),
2208
+ slug: z6.string(),
2209
+ description: z6.union([z6.string(), z6.null()]).optional(),
2210
+ created: z6.union([z6.string(), z6.null()]).optional(),
1963
2211
  prompt_data: PromptDataNullish.optional(),
1964
- tags: z5.union([z5.array(z5.string()), z5.null()]).optional(),
1965
- metadata: z5.union([z5.object({}).partial().passthrough(), z5.null()]).optional(),
2212
+ tags: z6.union([z6.array(z6.string()), z6.null()]).optional(),
2213
+ metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional(),
1966
2214
  function_type: FunctionTypeEnumNullish.optional(),
1967
2215
  function_data: FunctionData,
1968
- origin: z5.union([
1969
- z5.object({
1970
- object_type: AclObjectType.and(z5.string()),
1971
- object_id: z5.string().uuid(),
1972
- internal: z5.union([z5.boolean(), z5.null()]).optional()
2216
+ origin: z6.union([
2217
+ z6.object({
2218
+ object_type: AclObjectType.and(z6.string()),
2219
+ object_id: z6.string().uuid(),
2220
+ internal: z6.union([z6.boolean(), z6.null()]).optional()
1973
2221
  }),
1974
- z5.null()
2222
+ z6.null()
1975
2223
  ]).optional(),
1976
- function_schema: z5.union([
1977
- z5.object({ parameters: z5.unknown(), returns: z5.unknown() }).partial(),
1978
- z5.null()
2224
+ function_schema: z6.union([
2225
+ z6.object({ parameters: z6.unknown(), returns: z6.unknown() }).partial(),
2226
+ z6.null()
1979
2227
  ]).optional()
1980
2228
  });
1981
- var FunctionFormat = z5.enum(["llm", "code", "global", "graph"]);
1982
- var PromptData = z5.object({
2229
+ var FunctionFormat = z6.enum(["llm", "code", "global", "graph"]);
2230
+ var PromptData = z6.object({
1983
2231
  prompt: PromptBlockDataNullish,
1984
2232
  options: PromptOptionsNullish,
1985
2233
  parser: PromptParserNullish,
1986
- tool_functions: z5.union([z5.array(SavedFunctionId), z5.null()]),
1987
- origin: z5.union([
1988
- z5.object({
1989
- prompt_id: z5.string(),
1990
- project_id: z5.string(),
1991
- prompt_version: z5.string()
2234
+ tool_functions: z6.union([z6.array(SavedFunctionId), z6.null()]),
2235
+ origin: z6.union([
2236
+ z6.object({
2237
+ prompt_id: z6.string(),
2238
+ project_id: z6.string(),
2239
+ prompt_version: z6.string()
1992
2240
  }).partial(),
1993
- z5.null()
2241
+ z6.null()
1994
2242
  ])
1995
2243
  }).partial();
1996
- var FunctionTypeEnum = z5.enum(["llm", "scorer", "task", "tool"]);
1997
- var FunctionId = z5.union([
1998
- z5.object({ function_id: z5.string(), version: z5.string().optional() }),
1999
- z5.object({
2000
- project_name: z5.string(),
2001
- slug: z5.string(),
2002
- version: z5.string().optional()
2244
+ var FunctionTypeEnum = z6.enum(["llm", "scorer", "task", "tool"]);
2245
+ var FunctionId = z6.union([
2246
+ z6.object({ function_id: z6.string(), version: z6.string().optional() }),
2247
+ z6.object({
2248
+ project_name: z6.string(),
2249
+ slug: z6.string(),
2250
+ version: z6.string().optional()
2003
2251
  }),
2004
- z5.object({ global_function: z5.string() }),
2005
- z5.object({
2006
- prompt_session_id: z5.string(),
2007
- prompt_session_function_id: z5.string(),
2008
- version: z5.string().optional()
2252
+ z6.object({ global_function: z6.string() }),
2253
+ z6.object({
2254
+ prompt_session_id: z6.string(),
2255
+ prompt_session_function_id: z6.string(),
2256
+ version: z6.string().optional()
2009
2257
  }),
2010
- z5.object({
2011
- inline_context: z5.object({
2012
- runtime: z5.enum(["node", "python"]),
2013
- version: z5.string()
2258
+ z6.object({
2259
+ inline_context: z6.object({
2260
+ runtime: z6.enum(["node", "python"]),
2261
+ version: z6.string()
2014
2262
  }),
2015
- code: z5.string(),
2016
- name: z5.union([z5.string(), z5.null()]).optional()
2263
+ code: z6.string(),
2264
+ name: z6.union([z6.string(), z6.null()]).optional()
2017
2265
  }),
2018
- z5.object({
2266
+ z6.object({
2019
2267
  inline_prompt: PromptData.optional(),
2020
- inline_function: z5.object({}).partial().passthrough(),
2268
+ inline_function: z6.object({}).partial().passthrough(),
2021
2269
  function_type: FunctionTypeEnum.optional(),
2022
- name: z5.union([z5.string(), z5.null()]).optional()
2270
+ name: z6.union([z6.string(), z6.null()]).optional()
2023
2271
  }),
2024
- z5.object({
2272
+ z6.object({
2025
2273
  inline_prompt: PromptData,
2026
2274
  function_type: FunctionTypeEnum.optional(),
2027
- name: z5.union([z5.string(), z5.null()]).optional()
2275
+ name: z6.union([z6.string(), z6.null()]).optional()
2028
2276
  })
2029
2277
  ]);
2030
- var FunctionObjectType = z5.enum([
2278
+ var FunctionObjectType = z6.enum([
2031
2279
  "prompt",
2032
2280
  "tool",
2033
2281
  "scorer",
2034
2282
  "task",
2035
2283
  "agent"
2036
2284
  ]);
2037
- var FunctionOutputType = z5.enum(["completion", "score", "any"]);
2038
- var GitMetadataSettings = z5.object({
2039
- collect: z5.enum(["all", "none", "some"]),
2040
- fields: z5.array(
2041
- z5.enum([
2285
+ var FunctionOutputType = z6.enum(["completion", "score", "any"]);
2286
+ var GitMetadataSettings = z6.object({
2287
+ collect: z6.enum(["all", "none", "some"]),
2288
+ fields: z6.array(
2289
+ z6.enum([
2042
2290
  "commit",
2043
2291
  "branch",
2044
2292
  "tag",
@@ -2051,49 +2299,49 @@ var GitMetadataSettings = z5.object({
2051
2299
  ])
2052
2300
  ).optional()
2053
2301
  });
2054
- var Group = z5.object({
2055
- id: z5.string().uuid(),
2056
- org_id: z5.string().uuid(),
2057
- user_id: z5.union([z5.string(), z5.null()]).optional(),
2058
- created: z5.union([z5.string(), z5.null()]).optional(),
2059
- name: z5.string(),
2060
- description: z5.union([z5.string(), z5.null()]).optional(),
2061
- deleted_at: z5.union([z5.string(), z5.null()]).optional(),
2062
- member_users: z5.union([z5.array(z5.string().uuid()), z5.null()]).optional(),
2063
- member_groups: z5.union([z5.array(z5.string().uuid()), z5.null()]).optional()
2302
+ var Group = z6.object({
2303
+ id: z6.string().uuid(),
2304
+ org_id: z6.string().uuid(),
2305
+ user_id: z6.union([z6.string(), z6.null()]).optional(),
2306
+ created: z6.union([z6.string(), z6.null()]).optional(),
2307
+ name: z6.string(),
2308
+ description: z6.union([z6.string(), z6.null()]).optional(),
2309
+ deleted_at: z6.union([z6.string(), z6.null()]).optional(),
2310
+ member_users: z6.union([z6.array(z6.string().uuid()), z6.null()]).optional(),
2311
+ member_groups: z6.union([z6.array(z6.string().uuid()), z6.null()]).optional()
2064
2312
  });
2065
- var IfExists = z5.enum(["error", "ignore", "replace"]);
2066
- var InvokeParent = z5.union([
2067
- z5.object({
2068
- object_type: z5.enum(["project_logs", "experiment", "playground_logs"]),
2069
- object_id: z5.string(),
2070
- row_ids: z5.union([
2071
- z5.object({
2072
- id: z5.string(),
2073
- span_id: z5.string(),
2074
- root_span_id: z5.string()
2313
+ var IfExists = z6.enum(["error", "ignore", "replace"]);
2314
+ var InvokeParent = z6.union([
2315
+ z6.object({
2316
+ object_type: z6.enum(["project_logs", "experiment", "playground_logs"]),
2317
+ object_id: z6.string(),
2318
+ row_ids: z6.union([
2319
+ z6.object({
2320
+ id: z6.string(),
2321
+ span_id: z6.string(),
2322
+ root_span_id: z6.string()
2075
2323
  }),
2076
- z5.null()
2324
+ z6.null()
2077
2325
  ]).optional(),
2078
- propagated_event: z5.union([z5.object({}).partial().passthrough(), z5.null()]).optional()
2326
+ propagated_event: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional()
2079
2327
  }),
2080
- z5.string()
2328
+ z6.string()
2081
2329
  ]);
2082
- var StreamingMode = z5.union([z5.enum(["auto", "parallel"]), z5.null()]);
2330
+ var StreamingMode = z6.union([z6.enum(["auto", "parallel"]), z6.null()]);
2083
2331
  var InvokeFunction = FunctionId.and(
2084
- z5.object({
2085
- input: z5.unknown(),
2086
- expected: z5.unknown(),
2087
- metadata: z5.union([z5.object({}).partial().passthrough(), z5.null()]),
2088
- tags: z5.union([z5.array(z5.string()), z5.null()]),
2089
- messages: z5.array(ChatCompletionMessageParam),
2332
+ z6.object({
2333
+ input: z6.unknown(),
2334
+ expected: z6.unknown(),
2335
+ metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]),
2336
+ tags: z6.union([z6.array(z6.string()), z6.null()]),
2337
+ messages: z6.array(ChatCompletionMessageParam),
2090
2338
  parent: InvokeParent,
2091
- stream: z5.union([z5.boolean(), z5.null()]),
2339
+ stream: z6.union([z6.boolean(), z6.null()]),
2092
2340
  mode: StreamingMode,
2093
- strict: z5.union([z5.boolean(), z5.null()])
2341
+ strict: z6.union([z6.boolean(), z6.null()])
2094
2342
  }).partial()
2095
2343
  );
2096
- var MessageRole = z5.enum([
2344
+ var MessageRole = z6.enum([
2097
2345
  "system",
2098
2346
  "user",
2099
2347
  "assistant",
@@ -2102,8 +2350,8 @@ var MessageRole = z5.enum([
2102
2350
  "model",
2103
2351
  "developer"
2104
2352
  ]);
2105
- var ObjectReference = z5.object({
2106
- object_type: z5.enum([
2353
+ var ObjectReference = z6.object({
2354
+ object_type: z6.enum([
2107
2355
  "project_logs",
2108
2356
  "experiment",
2109
2357
  "dataset",
@@ -2111,146 +2359,146 @@ var ObjectReference = z5.object({
2111
2359
  "function",
2112
2360
  "prompt_session"
2113
2361
  ]),
2114
- object_id: z5.string().uuid(),
2115
- id: z5.string(),
2116
- _xact_id: z5.union([z5.string(), z5.null()]).optional(),
2117
- created: z5.union([z5.string(), z5.null()]).optional()
2362
+ object_id: z6.string().uuid(),
2363
+ id: z6.string(),
2364
+ _xact_id: z6.union([z6.string(), z6.null()]).optional(),
2365
+ created: z6.union([z6.string(), z6.null()]).optional()
2118
2366
  });
2119
- var OnlineScoreConfig = z5.union([
2120
- z5.object({
2121
- sampling_rate: z5.number().gte(0).lte(1),
2122
- scorers: z5.array(SavedFunctionId),
2123
- btql_filter: z5.union([z5.string(), z5.null()]).optional(),
2124
- apply_to_root_span: z5.union([z5.boolean(), z5.null()]).optional(),
2125
- apply_to_span_names: z5.union([z5.array(z5.string()), z5.null()]).optional(),
2126
- skip_logging: z5.union([z5.boolean(), z5.null()]).optional()
2367
+ var OnlineScoreConfig = z6.union([
2368
+ z6.object({
2369
+ sampling_rate: z6.number().gte(0).lte(1),
2370
+ scorers: z6.array(SavedFunctionId),
2371
+ btql_filter: z6.union([z6.string(), z6.null()]).optional(),
2372
+ apply_to_root_span: z6.union([z6.boolean(), z6.null()]).optional(),
2373
+ apply_to_span_names: z6.union([z6.array(z6.string()), z6.null()]).optional(),
2374
+ skip_logging: z6.union([z6.boolean(), z6.null()]).optional()
2127
2375
  }),
2128
- z5.null()
2376
+ z6.null()
2129
2377
  ]);
2130
- var Organization = z5.object({
2131
- id: z5.string().uuid(),
2132
- name: z5.string(),
2133
- api_url: z5.union([z5.string(), z5.null()]).optional(),
2134
- is_universal_api: z5.union([z5.boolean(), z5.null()]).optional(),
2135
- proxy_url: z5.union([z5.string(), z5.null()]).optional(),
2136
- realtime_url: z5.union([z5.string(), z5.null()]).optional(),
2137
- created: z5.union([z5.string(), z5.null()]).optional()
2378
+ var Organization = z6.object({
2379
+ id: z6.string().uuid(),
2380
+ name: z6.string(),
2381
+ api_url: z6.union([z6.string(), z6.null()]).optional(),
2382
+ is_universal_api: z6.union([z6.boolean(), z6.null()]).optional(),
2383
+ proxy_url: z6.union([z6.string(), z6.null()]).optional(),
2384
+ realtime_url: z6.union([z6.string(), z6.null()]).optional(),
2385
+ created: z6.union([z6.string(), z6.null()]).optional()
2138
2386
  });
2139
- var ProjectSettings = z5.union([
2140
- z5.object({
2141
- comparison_key: z5.union([z5.string(), z5.null()]),
2142
- baseline_experiment_id: z5.union([z5.string(), z5.null()]),
2143
- spanFieldOrder: z5.union([
2144
- z5.array(
2145
- z5.object({
2146
- object_type: z5.string(),
2147
- column_id: z5.string(),
2148
- position: z5.string(),
2149
- layout: z5.union([z5.literal("full"), z5.literal("two_column"), z5.null()]).optional()
2387
+ var ProjectSettings = z6.union([
2388
+ z6.object({
2389
+ comparison_key: z6.union([z6.string(), z6.null()]),
2390
+ baseline_experiment_id: z6.union([z6.string(), z6.null()]),
2391
+ spanFieldOrder: z6.union([
2392
+ z6.array(
2393
+ z6.object({
2394
+ object_type: z6.string(),
2395
+ column_id: z6.string(),
2396
+ position: z6.string(),
2397
+ layout: z6.union([z6.literal("full"), z6.literal("two_column"), z6.null()]).optional()
2150
2398
  })
2151
2399
  ),
2152
- z5.null()
2400
+ z6.null()
2153
2401
  ]),
2154
- remote_eval_sources: z5.union([
2155
- z5.array(
2156
- z5.object({
2157
- url: z5.string(),
2158
- name: z5.string(),
2159
- description: z5.union([z5.string(), z5.null()]).optional()
2402
+ remote_eval_sources: z6.union([
2403
+ z6.array(
2404
+ z6.object({
2405
+ url: z6.string(),
2406
+ name: z6.string(),
2407
+ description: z6.union([z6.string(), z6.null()]).optional()
2160
2408
  })
2161
2409
  ),
2162
- z5.null()
2410
+ z6.null()
2163
2411
  ])
2164
2412
  }).partial(),
2165
- z5.null()
2413
+ z6.null()
2166
2414
  ]);
2167
- var Project = z5.object({
2168
- id: z5.string().uuid(),
2169
- org_id: z5.string().uuid(),
2170
- name: z5.string(),
2171
- created: z5.union([z5.string(), z5.null()]).optional(),
2172
- deleted_at: z5.union([z5.string(), z5.null()]).optional(),
2173
- user_id: z5.union([z5.string(), z5.null()]).optional(),
2415
+ var Project = z6.object({
2416
+ id: z6.string().uuid(),
2417
+ org_id: z6.string().uuid(),
2418
+ name: z6.string(),
2419
+ created: z6.union([z6.string(), z6.null()]).optional(),
2420
+ deleted_at: z6.union([z6.string(), z6.null()]).optional(),
2421
+ user_id: z6.union([z6.string(), z6.null()]).optional(),
2174
2422
  settings: ProjectSettings.optional()
2175
2423
  });
2176
- var RetentionObjectType = z5.enum([
2424
+ var RetentionObjectType = z6.enum([
2177
2425
  "project_logs",
2178
2426
  "experiment",
2179
2427
  "dataset"
2180
2428
  ]);
2181
- var ProjectAutomation = z5.object({
2182
- id: z5.string().uuid(),
2183
- project_id: z5.string().uuid(),
2184
- user_id: z5.union([z5.string(), z5.null()]).optional(),
2185
- created: z5.union([z5.string(), z5.null()]).optional(),
2186
- name: z5.string(),
2187
- description: z5.union([z5.string(), z5.null()]).optional(),
2188
- config: z5.union([
2189
- z5.object({
2190
- event_type: z5.literal("logs"),
2191
- btql_filter: z5.string(),
2192
- interval_seconds: z5.number().gte(1).lte(2592e3),
2193
- action: z5.object({ type: z5.literal("webhook"), url: z5.string() })
2429
+ var ProjectAutomation = z6.object({
2430
+ id: z6.string().uuid(),
2431
+ project_id: z6.string().uuid(),
2432
+ user_id: z6.union([z6.string(), z6.null()]).optional(),
2433
+ created: z6.union([z6.string(), z6.null()]).optional(),
2434
+ name: z6.string(),
2435
+ description: z6.union([z6.string(), z6.null()]).optional(),
2436
+ config: z6.union([
2437
+ z6.object({
2438
+ event_type: z6.literal("logs"),
2439
+ btql_filter: z6.string(),
2440
+ interval_seconds: z6.number().gte(1).lte(2592e3),
2441
+ action: z6.object({ type: z6.literal("webhook"), url: z6.string() })
2194
2442
  }),
2195
- z5.object({
2196
- event_type: z5.literal("btql_export"),
2197
- export_definition: z5.union([
2198
- z5.object({ type: z5.literal("log_traces") }),
2199
- z5.object({ type: z5.literal("log_spans") }),
2200
- z5.object({ type: z5.literal("btql_query"), btql_query: z5.string() })
2443
+ z6.object({
2444
+ event_type: z6.literal("btql_export"),
2445
+ export_definition: z6.union([
2446
+ z6.object({ type: z6.literal("log_traces") }),
2447
+ z6.object({ type: z6.literal("log_spans") }),
2448
+ z6.object({ type: z6.literal("btql_query"), btql_query: z6.string() })
2201
2449
  ]),
2202
- export_path: z5.string(),
2203
- format: z5.enum(["jsonl", "parquet"]),
2204
- interval_seconds: z5.number().gte(1).lte(2592e3),
2205
- credentials: z5.object({
2206
- type: z5.literal("aws_iam"),
2207
- role_arn: z5.string(),
2208
- external_id: z5.string()
2450
+ export_path: z6.string(),
2451
+ format: z6.enum(["jsonl", "parquet"]),
2452
+ interval_seconds: z6.number().gte(1).lte(2592e3),
2453
+ credentials: z6.object({
2454
+ type: z6.literal("aws_iam"),
2455
+ role_arn: z6.string(),
2456
+ external_id: z6.string()
2209
2457
  }),
2210
- batch_size: z5.union([z5.number(), z5.null()]).optional()
2458
+ batch_size: z6.union([z6.number(), z6.null()]).optional()
2211
2459
  }),
2212
- z5.object({
2213
- event_type: z5.literal("retention"),
2460
+ z6.object({
2461
+ event_type: z6.literal("retention"),
2214
2462
  object_type: RetentionObjectType,
2215
- retention_days: z5.number().gte(0)
2463
+ retention_days: z6.number().gte(0)
2216
2464
  })
2217
2465
  ])
2218
2466
  });
2219
- var ProjectLogsEvent = z5.object({
2220
- id: z5.string(),
2221
- _xact_id: z5.string(),
2222
- _pagination_key: z5.union([z5.string(), z5.null()]).optional(),
2223
- created: z5.string().datetime({ offset: true }),
2224
- org_id: z5.string().uuid(),
2225
- project_id: z5.string().uuid(),
2226
- log_id: z5.literal("g"),
2227
- input: z5.unknown().optional(),
2228
- output: z5.unknown().optional(),
2229
- expected: z5.unknown().optional(),
2230
- error: z5.unknown().optional(),
2231
- scores: z5.union([z5.record(z5.union([z5.number(), z5.null()])), z5.null()]).optional(),
2232
- metadata: z5.union([
2233
- z5.object({ model: z5.union([z5.string(), z5.null()]) }).partial().passthrough(),
2234
- z5.null()
2467
+ var ProjectLogsEvent = z6.object({
2468
+ id: z6.string(),
2469
+ _xact_id: z6.string(),
2470
+ _pagination_key: z6.union([z6.string(), z6.null()]).optional(),
2471
+ created: z6.string().datetime({ offset: true }),
2472
+ org_id: z6.string().uuid(),
2473
+ project_id: z6.string().uuid(),
2474
+ log_id: z6.literal("g"),
2475
+ input: z6.unknown().optional(),
2476
+ output: z6.unknown().optional(),
2477
+ expected: z6.unknown().optional(),
2478
+ error: z6.unknown().optional(),
2479
+ scores: z6.union([z6.record(z6.union([z6.number(), z6.null()])), z6.null()]).optional(),
2480
+ metadata: z6.union([
2481
+ z6.object({ model: z6.union([z6.string(), z6.null()]) }).partial().passthrough(),
2482
+ z6.null()
2235
2483
  ]).optional(),
2236
- tags: z5.union([z5.array(z5.string()), z5.null()]).optional(),
2237
- metrics: z5.union([z5.record(z5.number()), z5.null()]).optional(),
2238
- context: z5.union([
2239
- z5.object({
2240
- caller_functionname: z5.union([z5.string(), z5.null()]),
2241
- caller_filename: z5.union([z5.string(), z5.null()]),
2242
- caller_lineno: z5.union([z5.number(), z5.null()])
2484
+ tags: z6.union([z6.array(z6.string()), z6.null()]).optional(),
2485
+ metrics: z6.union([z6.record(z6.number()), z6.null()]).optional(),
2486
+ context: z6.union([
2487
+ z6.object({
2488
+ caller_functionname: z6.union([z6.string(), z6.null()]),
2489
+ caller_filename: z6.union([z6.string(), z6.null()]),
2490
+ caller_lineno: z6.union([z6.number(), z6.null()])
2243
2491
  }).partial().passthrough(),
2244
- z5.null()
2492
+ z6.null()
2245
2493
  ]).optional(),
2246
- span_id: z5.string(),
2247
- span_parents: z5.union([z5.array(z5.string()), z5.null()]).optional(),
2248
- root_span_id: z5.string(),
2249
- is_root: z5.union([z5.boolean(), z5.null()]).optional(),
2494
+ span_id: z6.string(),
2495
+ span_parents: z6.union([z6.array(z6.string()), z6.null()]).optional(),
2496
+ root_span_id: z6.string(),
2497
+ is_root: z6.union([z6.boolean(), z6.null()]).optional(),
2250
2498
  span_attributes: SpanAttributes.optional(),
2251
2499
  origin: ObjectReferenceNullish.optional()
2252
2500
  });
2253
- var ProjectScoreType = z5.enum([
2501
+ var ProjectScoreType = z6.enum([
2254
2502
  "slider",
2255
2503
  "categorical",
2256
2504
  "weighted",
@@ -2259,172 +2507,172 @@ var ProjectScoreType = z5.enum([
2259
2507
  "online",
2260
2508
  "free-form"
2261
2509
  ]);
2262
- var ProjectScoreCategory = z5.object({
2263
- name: z5.string(),
2264
- value: z5.number()
2510
+ var ProjectScoreCategory = z6.object({
2511
+ name: z6.string(),
2512
+ value: z6.number()
2265
2513
  });
2266
- var ProjectScoreCategories = z5.union([
2267
- z5.array(ProjectScoreCategory),
2268
- z5.record(z5.number()),
2269
- z5.array(z5.string()),
2270
- z5.null()
2514
+ var ProjectScoreCategories = z6.union([
2515
+ z6.array(ProjectScoreCategory),
2516
+ z6.record(z6.number()),
2517
+ z6.array(z6.string()),
2518
+ z6.null()
2271
2519
  ]);
2272
- var ProjectScoreConfig = z5.union([
2273
- z5.object({
2274
- multi_select: z5.union([z5.boolean(), z5.null()]),
2275
- destination: z5.union([z5.string(), z5.null()]),
2520
+ var ProjectScoreConfig = z6.union([
2521
+ z6.object({
2522
+ multi_select: z6.union([z6.boolean(), z6.null()]),
2523
+ destination: z6.union([z6.string(), z6.null()]),
2276
2524
  online: OnlineScoreConfig
2277
2525
  }).partial(),
2278
- z5.null()
2526
+ z6.null()
2279
2527
  ]);
2280
- var ProjectScore = z5.object({
2281
- id: z5.string().uuid(),
2282
- project_id: z5.string().uuid(),
2283
- user_id: z5.string().uuid(),
2284
- created: z5.union([z5.string(), z5.null()]).optional(),
2285
- name: z5.string(),
2286
- description: z5.union([z5.string(), z5.null()]).optional(),
2528
+ var ProjectScore = z6.object({
2529
+ id: z6.string().uuid(),
2530
+ project_id: z6.string().uuid(),
2531
+ user_id: z6.string().uuid(),
2532
+ created: z6.union([z6.string(), z6.null()]).optional(),
2533
+ name: z6.string(),
2534
+ description: z6.union([z6.string(), z6.null()]).optional(),
2287
2535
  score_type: ProjectScoreType,
2288
2536
  categories: ProjectScoreCategories.optional(),
2289
2537
  config: ProjectScoreConfig.optional(),
2290
- position: z5.union([z5.string(), z5.null()]).optional()
2538
+ position: z6.union([z6.string(), z6.null()]).optional()
2291
2539
  });
2292
- var ProjectTag = z5.object({
2293
- id: z5.string().uuid(),
2294
- project_id: z5.string().uuid(),
2295
- user_id: z5.string().uuid(),
2296
- created: z5.union([z5.string(), z5.null()]).optional(),
2297
- name: z5.string(),
2298
- description: z5.union([z5.string(), z5.null()]).optional(),
2299
- color: z5.union([z5.string(), z5.null()]).optional(),
2300
- position: z5.union([z5.string(), z5.null()]).optional()
2540
+ var ProjectTag = z6.object({
2541
+ id: z6.string().uuid(),
2542
+ project_id: z6.string().uuid(),
2543
+ user_id: z6.string().uuid(),
2544
+ created: z6.union([z6.string(), z6.null()]).optional(),
2545
+ name: z6.string(),
2546
+ description: z6.union([z6.string(), z6.null()]).optional(),
2547
+ color: z6.union([z6.string(), z6.null()]).optional(),
2548
+ position: z6.union([z6.string(), z6.null()]).optional()
2301
2549
  });
2302
- var Prompt = z5.object({
2303
- id: z5.string().uuid(),
2304
- _xact_id: z5.string(),
2305
- project_id: z5.string().uuid(),
2306
- log_id: z5.literal("p"),
2307
- org_id: z5.string().uuid(),
2308
- name: z5.string(),
2309
- slug: z5.string(),
2310
- description: z5.union([z5.string(), z5.null()]).optional(),
2311
- created: z5.union([z5.string(), z5.null()]).optional(),
2550
+ var Prompt = z6.object({
2551
+ id: z6.string().uuid(),
2552
+ _xact_id: z6.string(),
2553
+ project_id: z6.string().uuid(),
2554
+ log_id: z6.literal("p"),
2555
+ org_id: z6.string().uuid(),
2556
+ name: z6.string(),
2557
+ slug: z6.string(),
2558
+ description: z6.union([z6.string(), z6.null()]).optional(),
2559
+ created: z6.union([z6.string(), z6.null()]).optional(),
2312
2560
  prompt_data: PromptDataNullish.optional(),
2313
- tags: z5.union([z5.array(z5.string()), z5.null()]).optional(),
2314
- metadata: z5.union([z5.object({}).partial().passthrough(), z5.null()]).optional(),
2561
+ tags: z6.union([z6.array(z6.string()), z6.null()]).optional(),
2562
+ metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional(),
2315
2563
  function_type: FunctionTypeEnumNullish.optional()
2316
2564
  });
2317
- var PromptOptions = z5.object({ model: z5.string(), params: ModelParams, position: z5.string() }).partial();
2318
- var PromptSessionEvent = z5.object({
2319
- id: z5.string(),
2320
- _xact_id: z5.string(),
2321
- created: z5.string().datetime({ offset: true }),
2322
- _pagination_key: z5.union([z5.string(), z5.null()]).optional(),
2323
- project_id: z5.string().uuid(),
2324
- prompt_session_id: z5.string().uuid(),
2325
- prompt_session_data: z5.unknown().optional(),
2326
- prompt_data: z5.unknown().optional(),
2327
- function_data: z5.unknown().optional(),
2565
+ var PromptOptions = z6.object({ model: z6.string(), params: ModelParams, position: z6.string() }).partial();
2566
+ var PromptSessionEvent = z6.object({
2567
+ id: z6.string(),
2568
+ _xact_id: z6.string(),
2569
+ created: z6.string().datetime({ offset: true }),
2570
+ _pagination_key: z6.union([z6.string(), z6.null()]).optional(),
2571
+ project_id: z6.string().uuid(),
2572
+ prompt_session_id: z6.string().uuid(),
2573
+ prompt_session_data: z6.unknown().optional(),
2574
+ prompt_data: z6.unknown().optional(),
2575
+ function_data: z6.unknown().optional(),
2328
2576
  function_type: FunctionTypeEnumNullish.optional(),
2329
- object_data: z5.unknown().optional(),
2330
- completion: z5.unknown().optional(),
2331
- tags: z5.union([z5.array(z5.string()), z5.null()]).optional()
2577
+ object_data: z6.unknown().optional(),
2578
+ completion: z6.unknown().optional(),
2579
+ tags: z6.union([z6.array(z6.string()), z6.null()]).optional()
2332
2580
  });
2333
- var ResponseFormat = z5.union([
2334
- z5.object({ type: z5.literal("json_object") }),
2335
- z5.object({
2336
- type: z5.literal("json_schema"),
2581
+ var ResponseFormat = z6.union([
2582
+ z6.object({ type: z6.literal("json_object") }),
2583
+ z6.object({
2584
+ type: z6.literal("json_schema"),
2337
2585
  json_schema: ResponseFormatJsonSchema
2338
2586
  }),
2339
- z5.object({ type: z5.literal("text") })
2587
+ z6.object({ type: z6.literal("text") })
2340
2588
  ]);
2341
- var Role = z5.object({
2342
- id: z5.string().uuid(),
2343
- org_id: z5.union([z5.string(), z5.null()]).optional(),
2344
- user_id: z5.union([z5.string(), z5.null()]).optional(),
2345
- created: z5.union([z5.string(), z5.null()]).optional(),
2346
- name: z5.string(),
2347
- description: z5.union([z5.string(), z5.null()]).optional(),
2348
- deleted_at: z5.union([z5.string(), z5.null()]).optional(),
2349
- member_permissions: z5.union([
2350
- z5.array(
2351
- z5.object({
2589
+ var Role = z6.object({
2590
+ id: z6.string().uuid(),
2591
+ org_id: z6.union([z6.string(), z6.null()]).optional(),
2592
+ user_id: z6.union([z6.string(), z6.null()]).optional(),
2593
+ created: z6.union([z6.string(), z6.null()]).optional(),
2594
+ name: z6.string(),
2595
+ description: z6.union([z6.string(), z6.null()]).optional(),
2596
+ deleted_at: z6.union([z6.string(), z6.null()]).optional(),
2597
+ member_permissions: z6.union([
2598
+ z6.array(
2599
+ z6.object({
2352
2600
  permission: Permission,
2353
2601
  restrict_object_type: AclObjectType.optional()
2354
2602
  })
2355
2603
  ),
2356
- z5.null()
2604
+ z6.null()
2357
2605
  ]).optional(),
2358
- member_roles: z5.union([z5.array(z5.string().uuid()), z5.null()]).optional()
2606
+ member_roles: z6.union([z6.array(z6.string().uuid()), z6.null()]).optional()
2359
2607
  });
2360
- var RunEval = z5.object({
2361
- project_id: z5.string(),
2362
- data: z5.union([
2363
- z5.object({
2364
- dataset_id: z5.string(),
2365
- _internal_btql: z5.union([z5.object({}).partial().passthrough(), z5.null()]).optional()
2608
+ var RunEval = z6.object({
2609
+ project_id: z6.string(),
2610
+ data: z6.union([
2611
+ z6.object({
2612
+ dataset_id: z6.string(),
2613
+ _internal_btql: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional()
2366
2614
  }),
2367
- z5.object({
2368
- project_name: z5.string(),
2369
- dataset_name: z5.string(),
2370
- _internal_btql: z5.union([z5.object({}).partial().passthrough(), z5.null()]).optional()
2615
+ z6.object({
2616
+ project_name: z6.string(),
2617
+ dataset_name: z6.string(),
2618
+ _internal_btql: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional()
2371
2619
  }),
2372
- z5.object({ data: z5.array(z5.unknown()) })
2620
+ z6.object({ data: z6.array(z6.unknown()) })
2373
2621
  ]),
2374
- task: FunctionId.and(z5.unknown()),
2375
- scores: z5.array(FunctionId),
2376
- experiment_name: z5.string().optional(),
2377
- metadata: z5.object({}).partial().passthrough().optional(),
2378
- parent: InvokeParent.and(z5.unknown()).optional(),
2379
- stream: z5.boolean().optional(),
2380
- trial_count: z5.union([z5.number(), z5.null()]).optional(),
2381
- is_public: z5.union([z5.boolean(), z5.null()]).optional(),
2382
- timeout: z5.union([z5.number(), z5.null()]).optional(),
2383
- max_concurrency: z5.union([z5.number(), z5.null()]).optional().default(10),
2384
- base_experiment_name: z5.union([z5.string(), z5.null()]).optional(),
2385
- base_experiment_id: z5.union([z5.string(), z5.null()]).optional(),
2622
+ task: FunctionId.and(z6.unknown()),
2623
+ scores: z6.array(FunctionId),
2624
+ experiment_name: z6.string().optional(),
2625
+ metadata: z6.object({}).partial().passthrough().optional(),
2626
+ parent: InvokeParent.and(z6.unknown()).optional(),
2627
+ stream: z6.boolean().optional(),
2628
+ trial_count: z6.union([z6.number(), z6.null()]).optional(),
2629
+ is_public: z6.union([z6.boolean(), z6.null()]).optional(),
2630
+ timeout: z6.union([z6.number(), z6.null()]).optional(),
2631
+ max_concurrency: z6.union([z6.number(), z6.null()]).optional().default(10),
2632
+ base_experiment_name: z6.union([z6.string(), z6.null()]).optional(),
2633
+ base_experiment_id: z6.union([z6.string(), z6.null()]).optional(),
2386
2634
  git_metadata_settings: GitMetadataSettings.and(
2387
- z5.union([z5.object({}).partial(), z5.null()])
2635
+ z6.union([z6.object({}).partial(), z6.null()])
2388
2636
  ).optional(),
2389
- repo_info: RepoInfo.and(z5.unknown()).optional(),
2390
- strict: z5.union([z5.boolean(), z5.null()]).optional(),
2391
- stop_token: z5.union([z5.string(), z5.null()]).optional(),
2392
- extra_messages: z5.string().optional(),
2393
- tags: z5.array(z5.string()).optional()
2637
+ repo_info: RepoInfo.and(z6.unknown()).optional(),
2638
+ strict: z6.union([z6.boolean(), z6.null()]).optional(),
2639
+ stop_token: z6.union([z6.string(), z6.null()]).optional(),
2640
+ extra_messages: z6.string().optional(),
2641
+ tags: z6.array(z6.string()).optional()
2394
2642
  });
2395
- var ServiceToken = z5.object({
2396
- id: z5.string().uuid(),
2397
- created: z5.union([z5.string(), z5.null()]).optional(),
2398
- name: z5.string(),
2399
- preview_name: z5.string(),
2400
- service_account_id: z5.union([z5.string(), z5.null()]).optional(),
2401
- service_account_email: z5.union([z5.string(), z5.null()]).optional(),
2402
- service_account_name: z5.union([z5.string(), z5.null()]).optional(),
2403
- org_id: z5.union([z5.string(), z5.null()]).optional()
2643
+ var ServiceToken = z6.object({
2644
+ id: z6.string().uuid(),
2645
+ created: z6.union([z6.string(), z6.null()]).optional(),
2646
+ name: z6.string(),
2647
+ preview_name: z6.string(),
2648
+ service_account_id: z6.union([z6.string(), z6.null()]).optional(),
2649
+ service_account_email: z6.union([z6.string(), z6.null()]).optional(),
2650
+ service_account_name: z6.union([z6.string(), z6.null()]).optional(),
2651
+ org_id: z6.union([z6.string(), z6.null()]).optional()
2404
2652
  });
2405
- var SpanIFrame = z5.object({
2406
- id: z5.string().uuid(),
2407
- project_id: z5.string().uuid(),
2408
- user_id: z5.union([z5.string(), z5.null()]).optional(),
2409
- created: z5.union([z5.string(), z5.null()]).optional(),
2410
- deleted_at: z5.union([z5.string(), z5.null()]).optional(),
2411
- name: z5.string(),
2412
- description: z5.union([z5.string(), z5.null()]).optional(),
2413
- url: z5.string(),
2414
- post_message: z5.union([z5.boolean(), z5.null()]).optional()
2653
+ var SpanIFrame = z6.object({
2654
+ id: z6.string().uuid(),
2655
+ project_id: z6.string().uuid(),
2656
+ user_id: z6.union([z6.string(), z6.null()]).optional(),
2657
+ created: z6.union([z6.string(), z6.null()]).optional(),
2658
+ deleted_at: z6.union([z6.string(), z6.null()]).optional(),
2659
+ name: z6.string(),
2660
+ description: z6.union([z6.string(), z6.null()]).optional(),
2661
+ url: z6.string(),
2662
+ post_message: z6.union([z6.boolean(), z6.null()]).optional()
2415
2663
  });
2416
- var SSEConsoleEventData = z5.object({
2417
- stream: z5.enum(["stderr", "stdout"]),
2418
- message: z5.string()
2664
+ var SSEConsoleEventData = z6.object({
2665
+ stream: z6.enum(["stderr", "stdout"]),
2666
+ message: z6.string()
2419
2667
  });
2420
- var SSEProgressEventData = z5.object({
2421
- id: z5.string(),
2668
+ var SSEProgressEventData = z6.object({
2669
+ id: z6.string(),
2422
2670
  object_type: FunctionObjectType,
2423
- origin: ObjectReferenceNullish.and(z5.unknown()).optional(),
2671
+ origin: ObjectReferenceNullish.and(z6.unknown()).optional(),
2424
2672
  format: FunctionFormat,
2425
2673
  output_type: FunctionOutputType,
2426
- name: z5.string(),
2427
- event: z5.enum([
2674
+ name: z6.string(),
2675
+ event: z6.enum([
2428
2676
  "reasoning_delta",
2429
2677
  "text_delta",
2430
2678
  "json_delta",
@@ -2434,110 +2682,110 @@ var SSEProgressEventData = z5.object({
2434
2682
  "done",
2435
2683
  "progress"
2436
2684
  ]),
2437
- data: z5.string()
2685
+ data: z6.string()
2438
2686
  });
2439
- var ToolFunctionDefinition = z5.object({
2440
- type: z5.literal("function"),
2441
- function: z5.object({
2442
- name: z5.string(),
2443
- description: z5.string().optional(),
2444
- parameters: z5.object({}).partial().passthrough().optional(),
2445
- strict: z5.union([z5.boolean(), z5.null()]).optional()
2687
+ var ToolFunctionDefinition = z6.object({
2688
+ type: z6.literal("function"),
2689
+ function: z6.object({
2690
+ name: z6.string(),
2691
+ description: z6.string().optional(),
2692
+ parameters: z6.object({}).partial().passthrough().optional(),
2693
+ strict: z6.union([z6.boolean(), z6.null()]).optional()
2446
2694
  })
2447
2695
  });
2448
- var User = z5.object({
2449
- id: z5.string().uuid(),
2450
- given_name: z5.union([z5.string(), z5.null()]).optional(),
2451
- family_name: z5.union([z5.string(), z5.null()]).optional(),
2452
- email: z5.union([z5.string(), z5.null()]).optional(),
2453
- avatar_url: z5.union([z5.string(), z5.null()]).optional(),
2454
- created: z5.union([z5.string(), z5.null()]).optional()
2696
+ var User = z6.object({
2697
+ id: z6.string().uuid(),
2698
+ given_name: z6.union([z6.string(), z6.null()]).optional(),
2699
+ family_name: z6.union([z6.string(), z6.null()]).optional(),
2700
+ email: z6.union([z6.string(), z6.null()]).optional(),
2701
+ avatar_url: z6.union([z6.string(), z6.null()]).optional(),
2702
+ created: z6.union([z6.string(), z6.null()]).optional()
2455
2703
  });
2456
- var ViewDataSearch = z5.union([
2457
- z5.object({
2458
- filter: z5.union([z5.array(z5.unknown()), z5.null()]),
2459
- tag: z5.union([z5.array(z5.unknown()), z5.null()]),
2460
- match: z5.union([z5.array(z5.unknown()), z5.null()]),
2461
- sort: z5.union([z5.array(z5.unknown()), z5.null()])
2704
+ var ViewDataSearch = z6.union([
2705
+ z6.object({
2706
+ filter: z6.union([z6.array(z6.unknown()), z6.null()]),
2707
+ tag: z6.union([z6.array(z6.unknown()), z6.null()]),
2708
+ match: z6.union([z6.array(z6.unknown()), z6.null()]),
2709
+ sort: z6.union([z6.array(z6.unknown()), z6.null()])
2462
2710
  }).partial(),
2463
- z5.null()
2711
+ z6.null()
2464
2712
  ]);
2465
- var ViewData = z5.union([
2466
- z5.object({ search: ViewDataSearch }).partial(),
2467
- z5.null()
2713
+ var ViewData = z6.union([
2714
+ z6.object({ search: ViewDataSearch }).partial(),
2715
+ z6.null()
2468
2716
  ]);
2469
- var ViewOptions = z5.union([
2470
- z5.object({
2471
- viewType: z5.literal("monitor"),
2472
- options: z5.object({
2473
- spanType: z5.union([z5.enum(["range", "frame"]), z5.null()]),
2474
- rangeValue: z5.union([z5.string(), z5.null()]),
2475
- frameStart: z5.union([z5.string(), z5.null()]),
2476
- frameEnd: z5.union([z5.string(), z5.null()]),
2477
- tzUTC: z5.union([z5.boolean(), z5.null()]),
2478
- chartVisibility: z5.union([z5.record(z5.boolean()), z5.null()]),
2479
- projectId: z5.union([z5.string(), z5.null()]),
2480
- type: z5.union([z5.enum(["project", "experiment"]), z5.null()]),
2481
- groupBy: z5.union([z5.string(), z5.null()])
2717
+ var ViewOptions = z6.union([
2718
+ z6.object({
2719
+ viewType: z6.literal("monitor"),
2720
+ options: z6.object({
2721
+ spanType: z6.union([z6.enum(["range", "frame"]), z6.null()]),
2722
+ rangeValue: z6.union([z6.string(), z6.null()]),
2723
+ frameStart: z6.union([z6.string(), z6.null()]),
2724
+ frameEnd: z6.union([z6.string(), z6.null()]),
2725
+ tzUTC: z6.union([z6.boolean(), z6.null()]),
2726
+ chartVisibility: z6.union([z6.record(z6.boolean()), z6.null()]),
2727
+ projectId: z6.union([z6.string(), z6.null()]),
2728
+ type: z6.union([z6.enum(["project", "experiment"]), z6.null()]),
2729
+ groupBy: z6.union([z6.string(), z6.null()])
2482
2730
  }).partial()
2483
2731
  }),
2484
- z5.object({
2485
- columnVisibility: z5.union([z5.record(z5.boolean()), z5.null()]),
2486
- columnOrder: z5.union([z5.array(z5.string()), z5.null()]),
2487
- columnSizing: z5.union([z5.record(z5.number()), z5.null()]),
2488
- grouping: z5.union([z5.string(), z5.null()]),
2489
- rowHeight: z5.union([z5.string(), z5.null()]),
2490
- tallGroupRows: z5.union([z5.boolean(), z5.null()]),
2491
- layout: z5.union([z5.string(), z5.null()]),
2492
- chartHeight: z5.union([z5.number(), z5.null()]),
2493
- excludedMeasures: z5.union([
2494
- z5.array(
2495
- z5.object({
2496
- type: z5.enum(["none", "score", "metric", "metadata"]),
2497
- value: z5.string()
2732
+ z6.object({
2733
+ columnVisibility: z6.union([z6.record(z6.boolean()), z6.null()]),
2734
+ columnOrder: z6.union([z6.array(z6.string()), z6.null()]),
2735
+ columnSizing: z6.union([z6.record(z6.number()), z6.null()]),
2736
+ grouping: z6.union([z6.string(), z6.null()]),
2737
+ rowHeight: z6.union([z6.string(), z6.null()]),
2738
+ tallGroupRows: z6.union([z6.boolean(), z6.null()]),
2739
+ layout: z6.union([z6.string(), z6.null()]),
2740
+ chartHeight: z6.union([z6.number(), z6.null()]),
2741
+ excludedMeasures: z6.union([
2742
+ z6.array(
2743
+ z6.object({
2744
+ type: z6.enum(["none", "score", "metric", "metadata"]),
2745
+ value: z6.string()
2498
2746
  })
2499
2747
  ),
2500
- z5.null()
2748
+ z6.null()
2501
2749
  ]),
2502
- yMetric: z5.union([
2503
- z5.object({
2504
- type: z5.enum(["none", "score", "metric", "metadata"]),
2505
- value: z5.string()
2750
+ yMetric: z6.union([
2751
+ z6.object({
2752
+ type: z6.enum(["none", "score", "metric", "metadata"]),
2753
+ value: z6.string()
2506
2754
  }),
2507
- z5.null()
2755
+ z6.null()
2508
2756
  ]),
2509
- xAxis: z5.union([
2510
- z5.object({
2511
- type: z5.enum(["none", "score", "metric", "metadata"]),
2512
- value: z5.string()
2757
+ xAxis: z6.union([
2758
+ z6.object({
2759
+ type: z6.enum(["none", "score", "metric", "metadata"]),
2760
+ value: z6.string()
2513
2761
  }),
2514
- z5.null()
2762
+ z6.null()
2515
2763
  ]),
2516
- symbolGrouping: z5.union([
2517
- z5.object({
2518
- type: z5.enum(["none", "score", "metric", "metadata"]),
2519
- value: z5.string()
2764
+ symbolGrouping: z6.union([
2765
+ z6.object({
2766
+ type: z6.enum(["none", "score", "metric", "metadata"]),
2767
+ value: z6.string()
2520
2768
  }),
2521
- z5.null()
2769
+ z6.null()
2522
2770
  ]),
2523
- xAxisAggregation: z5.union([z5.string(), z5.null()]),
2524
- chartAnnotations: z5.union([
2525
- z5.array(z5.object({ id: z5.string(), text: z5.string() })),
2526
- z5.null()
2771
+ xAxisAggregation: z6.union([z6.string(), z6.null()]),
2772
+ chartAnnotations: z6.union([
2773
+ z6.array(z6.object({ id: z6.string(), text: z6.string() })),
2774
+ z6.null()
2527
2775
  ]),
2528
- timeRangeFilter: z5.union([
2529
- z5.string(),
2530
- z5.object({ from: z5.string(), to: z5.string() }),
2531
- z5.null()
2776
+ timeRangeFilter: z6.union([
2777
+ z6.string(),
2778
+ z6.object({ from: z6.string(), to: z6.string() }),
2779
+ z6.null()
2532
2780
  ])
2533
2781
  }).partial(),
2534
- z5.null()
2782
+ z6.null()
2535
2783
  ]);
2536
- var View = z5.object({
2537
- id: z5.string().uuid(),
2538
- object_type: AclObjectType.and(z5.string()),
2539
- object_id: z5.string().uuid(),
2540
- view_type: z5.enum([
2784
+ var View = z6.object({
2785
+ id: z6.string().uuid(),
2786
+ object_type: AclObjectType.and(z6.string()),
2787
+ object_id: z6.string().uuid(),
2788
+ view_type: z6.enum([
2541
2789
  "projects",
2542
2790
  "experiments",
2543
2791
  "experiment",
@@ -2552,56 +2800,56 @@ var View = z5.object({
2552
2800
  "agents",
2553
2801
  "monitor"
2554
2802
  ]),
2555
- name: z5.string(),
2556
- created: z5.union([z5.string(), z5.null()]).optional(),
2803
+ name: z6.string(),
2804
+ created: z6.union([z6.string(), z6.null()]).optional(),
2557
2805
  view_data: ViewData.optional(),
2558
2806
  options: ViewOptions.optional(),
2559
- user_id: z5.union([z5.string(), z5.null()]).optional(),
2560
- deleted_at: z5.union([z5.string(), z5.null()]).optional()
2807
+ user_id: z6.union([z6.string(), z6.null()]).optional(),
2808
+ deleted_at: z6.union([z6.string(), z6.null()]).optional()
2561
2809
  });
2562
2810
 
2563
2811
  // src/logger.ts
2564
2812
  import { waitUntil } from "@vercel/functions";
2565
2813
  import Mustache2 from "mustache";
2566
- import { z as z7, ZodError } from "zod";
2814
+ import { z as z8, ZodError } from "zod";
2567
2815
 
2568
2816
  // src/functions/stream.ts
2569
2817
  import {
2570
2818
  createParser
2571
2819
  } from "eventsource-parser";
2572
- import { z as z6 } from "zod/v3";
2573
- var braintrustStreamChunkSchema = z6.union([
2574
- z6.object({
2575
- type: z6.literal("text_delta"),
2576
- data: z6.string()
2820
+ import { z as z7 } from "zod/v3";
2821
+ var braintrustStreamChunkSchema = z7.union([
2822
+ z7.object({
2823
+ type: z7.literal("text_delta"),
2824
+ data: z7.string()
2577
2825
  }),
2578
- z6.object({
2579
- type: z6.literal("reasoning_delta"),
2580
- data: z6.string()
2826
+ z7.object({
2827
+ type: z7.literal("reasoning_delta"),
2828
+ data: z7.string()
2581
2829
  }),
2582
- z6.object({
2583
- type: z6.literal("json_delta"),
2584
- data: z6.string()
2830
+ z7.object({
2831
+ type: z7.literal("json_delta"),
2832
+ data: z7.string()
2585
2833
  }),
2586
- z6.object({
2587
- type: z6.literal("error"),
2588
- data: z6.string()
2834
+ z7.object({
2835
+ type: z7.literal("error"),
2836
+ data: z7.string()
2589
2837
  }),
2590
- z6.object({
2591
- type: z6.literal("console"),
2838
+ z7.object({
2839
+ type: z7.literal("console"),
2592
2840
  data: SSEConsoleEventData
2593
2841
  }),
2594
- z6.object({
2595
- type: z6.literal("progress"),
2842
+ z7.object({
2843
+ type: z7.literal("progress"),
2596
2844
  data: SSEProgressEventData
2597
2845
  }),
2598
- z6.object({
2599
- type: z6.literal("start"),
2600
- data: z6.string()
2846
+ z7.object({
2847
+ type: z7.literal("start"),
2848
+ data: z7.string()
2601
2849
  }),
2602
- z6.object({
2603
- type: z6.literal("done"),
2604
- data: z6.string()
2850
+ z7.object({
2851
+ type: z7.literal("done"),
2852
+ data: z7.string()
2605
2853
  })
2606
2854
  ]);
2607
2855
  var BraintrustStream = class _BraintrustStream {
@@ -3292,17 +3540,31 @@ var NoopSpan = class {
3292
3540
  state() {
3293
3541
  return _internalGetGlobalState();
3294
3542
  }
3543
+ // Custom inspect for Node.js console.log
3544
+ [Symbol.for("nodejs.util.inspect.custom")]() {
3545
+ return `NoopSpan {
3546
+ kind: '${this.kind}',
3547
+ id: '${this.id}',
3548
+ spanId: '${this.spanId}',
3549
+ rootSpanId: '${this.rootSpanId}',
3550
+ spanParents: ${JSON.stringify(this.spanParents)}
3551
+ }`;
3552
+ }
3553
+ // Custom toString
3554
+ toString() {
3555
+ return `NoopSpan(id=${this.id}, spanId=${this.spanId})`;
3556
+ }
3295
3557
  };
3296
3558
  var NOOP_SPAN = new NoopSpan();
3297
3559
  var NOOP_SPAN_PERMALINK = "https://braintrust.dev/noop-span";
3298
- var loginSchema = z7.strictObject({
3299
- appUrl: z7.string(),
3300
- appPublicUrl: z7.string(),
3301
- orgName: z7.string(),
3302
- apiUrl: z7.string(),
3303
- proxyUrl: z7.string(),
3304
- loginToken: z7.string(),
3305
- orgId: z7.string().nullish(),
3560
+ var loginSchema = z8.strictObject({
3561
+ appUrl: z8.string(),
3562
+ appPublicUrl: z8.string(),
3563
+ orgName: z8.string(),
3564
+ apiUrl: z8.string(),
3565
+ proxyUrl: z8.string(),
3566
+ loginToken: z8.string(),
3567
+ orgId: z8.string().nullish(),
3306
3568
  gitMetadataSettings: GitMetadataSettings.nullish()
3307
3569
  });
3308
3570
  var stateNonce = 0;
@@ -3361,6 +3623,7 @@ var BraintrustState = class _BraintrustState {
3361
3623
  _apiConn = null;
3362
3624
  _proxyConn = null;
3363
3625
  promptCache;
3626
+ _idGenerator = null;
3364
3627
  resetLoginInfo() {
3365
3628
  this.appUrl = null;
3366
3629
  this.appPublicUrl = null;
@@ -3375,6 +3638,15 @@ var BraintrustState = class _BraintrustState {
3375
3638
  this._apiConn = null;
3376
3639
  this._proxyConn = null;
3377
3640
  }
3641
+ resetIdGenState() {
3642
+ this._idGenerator = null;
3643
+ }
3644
+ get idGenerator() {
3645
+ if (this._idGenerator === null) {
3646
+ this._idGenerator = getIdGenerator();
3647
+ }
3648
+ return this._idGenerator;
3649
+ }
3378
3650
  copyLoginInfo(other) {
3379
3651
  this.appUrl = other.appUrl;
3380
3652
  this.appPublicUrl = other.appPublicUrl;
@@ -3512,6 +3784,37 @@ var BraintrustState = class _BraintrustState {
3512
3784
  enforceQueueSizeLimit(enforce) {
3513
3785
  this._bgLogger.get().enforceQueueSizeLimit(enforce);
3514
3786
  }
3787
+ // Custom serialization to avoid logging sensitive data
3788
+ toJSON() {
3789
+ return {
3790
+ id: this.id,
3791
+ orgId: this.orgId,
3792
+ orgName: this.orgName,
3793
+ appUrl: this.appUrl,
3794
+ appPublicUrl: this.appPublicUrl,
3795
+ apiUrl: this.apiUrl,
3796
+ proxyUrl: this.proxyUrl,
3797
+ loggedIn: this.loggedIn
3798
+ // Explicitly exclude loginToken, _apiConn, _appConn, _proxyConn and other sensitive fields
3799
+ };
3800
+ }
3801
+ // Custom inspect for Node.js console.log
3802
+ [Symbol.for("nodejs.util.inspect.custom")]() {
3803
+ return `BraintrustState {
3804
+ id: '${this.id}',
3805
+ orgId: ${this.orgId ? `'${this.orgId}'` : "null"},
3806
+ orgName: ${this.orgName ? `'${this.orgName}'` : "null"},
3807
+ appUrl: ${this.appUrl ? `'${this.appUrl}'` : "null"},
3808
+ apiUrl: ${this.apiUrl ? `'${this.apiUrl}'` : "null"},
3809
+ proxyUrl: ${this.proxyUrl ? `'${this.proxyUrl}'` : "null"},
3810
+ loggedIn: ${this.loggedIn},
3811
+ loginToken: '[REDACTED]'
3812
+ }`;
3813
+ }
3814
+ // Custom toString
3815
+ toString() {
3816
+ return `BraintrustState(id=${this.id}, org=${this.orgName || "none"}, loggedIn=${this.loggedIn})`;
3817
+ }
3515
3818
  };
3516
3819
  var _globalState;
3517
3820
  function _internalSetInitialState() {
@@ -3655,6 +3958,17 @@ var HTTPConnection = class _HTTPConnection {
3655
3958
  });
3656
3959
  return await resp.json();
3657
3960
  }
3961
+ // Custom inspect for Node.js console.log
3962
+ [Symbol.for("nodejs.util.inspect.custom")]() {
3963
+ return `HTTPConnection {
3964
+ base_url: '${this.base_url}',
3965
+ token: '[REDACTED]'
3966
+ }`;
3967
+ }
3968
+ // Custom toString
3969
+ toString() {
3970
+ return `HTTPConnection(${this.base_url})`;
3971
+ }
3658
3972
  };
3659
3973
  var BaseAttachment = class {
3660
3974
  reference;
@@ -3755,9 +4069,9 @@ var Attachment = class extends BaseAttachment {
3755
4069
  let signedUrl;
3756
4070
  let headers;
3757
4071
  try {
3758
- ({ signedUrl, headers } = z7.object({
3759
- signedUrl: z7.string().url(),
3760
- headers: z7.record(z7.string())
4072
+ ({ signedUrl, headers } = z8.object({
4073
+ signedUrl: z8.string().url(),
4074
+ headers: z8.record(z8.string())
3761
4075
  }).parse(await metadataResponse.json()));
3762
4076
  } catch (error2) {
3763
4077
  if (error2 instanceof ZodError) {
@@ -3845,8 +4159,8 @@ with a Blob/ArrayBuffer, or run the program on Node.js.`
3845
4159
  }
3846
4160
  }
3847
4161
  };
3848
- var attachmentMetadataSchema = z7.object({
3849
- downloadUrl: z7.string(),
4162
+ var attachmentMetadataSchema = z8.object({
4163
+ downloadUrl: z8.string(),
3850
4164
  status: AttachmentStatus
3851
4165
  });
3852
4166
  var ReadonlyAttachment = class {
@@ -3984,7 +4298,7 @@ function logFeedbackImpl(state, parentObjectType, parentObjectId, {
3984
4298
  if (!isEmpty(comment)) {
3985
4299
  const record = new LazyValue(async () => {
3986
4300
  return {
3987
- id: uuidv4(),
4301
+ id: uuidv42(),
3988
4302
  created: (/* @__PURE__ */ new Date()).toISOString(),
3989
4303
  origin: {
3990
4304
  // NOTE: We do not know (or care?) what the transaction id of the row that
@@ -4702,7 +5016,7 @@ Error: ${errorText}`;
4702
5016
  }
4703
5017
  const payloadFile = isomorph_default.pathJoin(
4704
5018
  payloadDir,
4705
- `payload_${getCurrentUnixTimestamp()}_${uuidv4().slice(0, 8)}.json`
5019
+ `payload_${getCurrentUnixTimestamp()}_${uuidv42().slice(0, 8)}.json`
4706
5020
  );
4707
5021
  try {
4708
5022
  await isomorph_default.mkdir(payloadDir, { recursive: true });
@@ -5334,7 +5648,7 @@ function validateAndSanitizeExperimentLogPartialArgs(event) {
5334
5648
  function deepCopyEvent(event) {
5335
5649
  const attachments = [];
5336
5650
  const IDENTIFIER = "_bt_internal_saved_attachment";
5337
- const savedAttachmentSchema = z7.strictObject({ [IDENTIFIER]: z7.number() });
5651
+ const savedAttachmentSchema = z8.strictObject({ [IDENTIFIER]: z8.number() });
5338
5652
  const serialized = JSON.stringify(event, (_k, v) => {
5339
5653
  if (v instanceof SpanImpl || v instanceof NoopSpan) {
5340
5654
  return `<span>`;
@@ -5837,7 +6151,7 @@ var ReadonlyExperiment = class extends ObjectFetcher {
5837
6151
  };
5838
6152
  var executionCounter = 0;
5839
6153
  function newId() {
5840
- return uuidv4();
6154
+ return uuidv42();
5841
6155
  }
5842
6156
  var SpanImpl = class _SpanImpl {
5843
6157
  _state;
@@ -5893,13 +6207,17 @@ var SpanImpl = class _SpanImpl {
5893
6207
  },
5894
6208
  created: (/* @__PURE__ */ new Date()).toISOString()
5895
6209
  };
5896
- this._id = eventId ?? uuidv4();
5897
- this._spanId = args.spanId ?? uuidv4();
6210
+ this._id = eventId ?? this._state.idGenerator.getSpanId();
6211
+ this._spanId = args.spanId ?? this._state.idGenerator.getSpanId();
5898
6212
  if (args.parentSpanIds) {
5899
6213
  this._rootSpanId = args.parentSpanIds.rootSpanId;
5900
6214
  this._spanParents = "parentSpanIds" in args.parentSpanIds ? args.parentSpanIds.parentSpanIds : [args.parentSpanIds.spanId];
5901
6215
  } else {
5902
- this._rootSpanId = this._spanId;
6216
+ if (this._state.idGenerator.shareRootSpanId()) {
6217
+ this._rootSpanId = this._spanId;
6218
+ } else {
6219
+ this._rootSpanId = this._state.idGenerator.getTraceId();
6220
+ }
5903
6221
  this._spanParents = void 0;
5904
6222
  }
5905
6223
  this.isMerge = false;
@@ -6110,6 +6428,20 @@ var SpanImpl = class _SpanImpl {
6110
6428
  state() {
6111
6429
  return this._state;
6112
6430
  }
6431
+ // Custom inspect for Node.js console.log
6432
+ [Symbol.for("nodejs.util.inspect.custom")]() {
6433
+ return `SpanImpl {
6434
+ kind: '${this.kind}',
6435
+ id: '${this.id}',
6436
+ spanId: '${this.spanId}',
6437
+ rootSpanId: '${this.rootSpanId}',
6438
+ spanParents: ${JSON.stringify(this.spanParents)}
6439
+ }`;
6440
+ }
6441
+ // Custom toString
6442
+ toString() {
6443
+ return `SpanImpl(id=${this.id}, spanId=${this.spanId})`;
6444
+ }
6113
6445
  };
6114
6446
  function splitLoggingData({
6115
6447
  event,
@@ -6261,7 +6593,7 @@ var Dataset2 = class extends ObjectFetcher {
6261
6593
  output
6262
6594
  }) {
6263
6595
  this.validateEvent({ metadata, expected, output, tags });
6264
- const rowId = id || uuidv4();
6596
+ const rowId = id || uuidv42();
6265
6597
  const args = this.createArgs(
6266
6598
  deepCopyEvent({
6267
6599
  id: rowId,
@@ -6339,8 +6671,8 @@ var Dataset2 = class extends ObjectFetcher {
6339
6671
  )}`;
6340
6672
  let dataSummary;
6341
6673
  if (summarizeData) {
6342
- const rawDataSummary = z7.object({
6343
- total_records: z7.number()
6674
+ const rawDataSummary = z8.object({
6675
+ total_records: z8.number()
6344
6676
  }).parse(
6345
6677
  await state.apiConn().get_json(
6346
6678
  "dataset-summary",
@@ -6463,11 +6795,11 @@ function renderTemplatedObject(obj, args, options) {
6463
6795
  return obj;
6464
6796
  }
6465
6797
  function renderPromptParams(params, args, options) {
6466
- const schemaParsed = z7.object({
6467
- response_format: z7.object({
6468
- type: z7.literal("json_schema"),
6798
+ const schemaParsed = z8.object({
6799
+ response_format: z8.object({
6800
+ type: z8.literal("json_schema"),
6469
6801
  json_schema: ResponseFormatJsonSchema.omit({ schema: true }).extend({
6470
- schema: z7.unknown()
6802
+ schema: z8.unknown()
6471
6803
  })
6472
6804
  })
6473
6805
  }).safeParse(params);
@@ -6585,7 +6917,7 @@ var Prompt2 = class _Prompt {
6585
6917
  if (!prompt) {
6586
6918
  throw new Error("Empty prompt");
6587
6919
  }
6588
- const dictArgParsed = z7.record(z7.unknown()).safeParse(buildArgs);
6920
+ const dictArgParsed = z8.record(z8.unknown()).safeParse(buildArgs);
6589
6921
  const variables = {
6590
6922
  input: buildArgs,
6591
6923
  ...dictArgParsed.success ? dictArgParsed.data : {}
@@ -6640,7 +6972,7 @@ var Prompt2 = class _Prompt {
6640
6972
  return JSON.stringify(v);
6641
6973
  }
6642
6974
  };
6643
- const dictArgParsed = z7.record(z7.unknown()).safeParse(buildArgs);
6975
+ const dictArgParsed = z8.record(z8.unknown()).safeParse(buildArgs);
6644
6976
  const variables = {
6645
6977
  input: buildArgs,
6646
6978
  ...dictArgParsed.success ? dictArgParsed.data : {}
@@ -7827,12 +8159,12 @@ var BarProgressReporter = class {
7827
8159
  };
7828
8160
 
7829
8161
  // src/eval-parameters.ts
7830
- import { z as z9 } from "zod/v3";
8162
+ import { z as z10 } from "zod/v3";
7831
8163
 
7832
8164
  // src/framework2.ts
7833
8165
  import path2 from "path";
7834
8166
  import slugifyLib from "slugify";
7835
- import { z as z8 } from "zod/v3";
8167
+ import { z as z9 } from "zod/v3";
7836
8168
  var ProjectBuilder = class {
7837
8169
  create(opts) {
7838
8170
  return new Project2(opts);
@@ -8066,23 +8398,23 @@ var CodePrompt = class {
8066
8398
  };
8067
8399
  }
8068
8400
  };
8069
- var promptContentsSchema = z8.union([
8070
- z8.object({
8071
- prompt: z8.string()
8401
+ var promptContentsSchema = z9.union([
8402
+ z9.object({
8403
+ prompt: z9.string()
8072
8404
  }),
8073
- z8.object({
8074
- messages: z8.array(ChatCompletionMessageParam)
8405
+ z9.object({
8406
+ messages: z9.array(ChatCompletionMessageParam)
8075
8407
  })
8076
8408
  ]);
8077
8409
  var promptDefinitionSchema = promptContentsSchema.and(
8078
- z8.object({
8079
- model: z8.string(),
8410
+ z9.object({
8411
+ model: z9.string(),
8080
8412
  params: ModelParams.optional()
8081
8413
  })
8082
8414
  );
8083
8415
  var promptDefinitionWithToolsSchema = promptDefinitionSchema.and(
8084
- z8.object({
8085
- tools: z8.array(ToolFunctionDefinition).optional()
8416
+ z9.object({
8417
+ tools: z9.array(ToolFunctionDefinition).optional()
8086
8418
  })
8087
8419
  );
8088
8420
  var PromptBuilder = class {
@@ -8150,7 +8482,7 @@ var ProjectNameIdMap = class {
8150
8482
  const response = await _internalGetGlobalState().appConn().post_json("api/project/register", {
8151
8483
  project_name: projectName
8152
8484
  });
8153
- const result = z8.object({
8485
+ const result = z9.object({
8154
8486
  project: Project
8155
8487
  }).parse(response);
8156
8488
  const projectId = result.project.id;
@@ -8164,7 +8496,7 @@ var ProjectNameIdMap = class {
8164
8496
  const response = await _internalGetGlobalState().appConn().post_json("api/project/get", {
8165
8497
  id: projectId
8166
8498
  });
8167
- const result = z8.array(Project).nonempty().parse(response);
8499
+ const result = z9.array(Project).nonempty().parse(response);
8168
8500
  const projectName = result[0].name;
8169
8501
  this.idToName[projectId] = projectName;
8170
8502
  this.nameToId[projectName] = projectId;
@@ -8180,15 +8512,15 @@ var ProjectNameIdMap = class {
8180
8512
  };
8181
8513
 
8182
8514
  // src/eval-parameters.ts
8183
- var evalParametersSchema = z9.record(
8184
- z9.string(),
8185
- z9.union([
8186
- z9.object({
8187
- type: z9.literal("prompt"),
8515
+ var evalParametersSchema = z10.record(
8516
+ z10.string(),
8517
+ z10.union([
8518
+ z10.object({
8519
+ type: z10.literal("prompt"),
8188
8520
  default: promptDefinitionWithToolsSchema.optional(),
8189
- description: z9.string().optional()
8521
+ description: z10.string().optional()
8190
8522
  }),
8191
- z9.instanceof(z9.ZodType)
8523
+ z10.instanceof(z10.ZodType)
8192
8524
  // For Zod schemas
8193
8525
  ])
8194
8526
  );
@@ -8815,7 +9147,7 @@ function formatMetricSummary(summary, longestMetricName) {
8815
9147
  }
8816
9148
 
8817
9149
  // dev/errorHandler.ts
8818
- import { z as z10 } from "zod/v3";
9150
+ import { z as z11 } from "zod/v3";
8819
9151
  var errorHandler = (err, req, res, next) => {
8820
9152
  if ("status" in err) {
8821
9153
  res.status(err.status).json({
@@ -8826,7 +9158,7 @@ var errorHandler = (err, req, res, next) => {
8826
9158
  });
8827
9159
  return;
8828
9160
  }
8829
- if (err instanceof z10.ZodError) {
9161
+ if (err instanceof z11.ZodError) {
8830
9162
  res.status(400).json({
8831
9163
  error: {
8832
9164
  message: "Invalid request",
@@ -8987,49 +9319,49 @@ function serializeSSEEvent(event) {
8987
9319
  }
8988
9320
 
8989
9321
  // dev/types.ts
8990
- import { z as z11 } from "zod/v3";
8991
- var evalBodySchema = z11.object({
8992
- name: z11.string(),
8993
- parameters: z11.record(z11.string(), z11.unknown()).nullish(),
9322
+ import { z as z12 } from "zod/v3";
9323
+ var evalBodySchema = z12.object({
9324
+ name: z12.string(),
9325
+ parameters: z12.record(z12.string(), z12.unknown()).nullish(),
8994
9326
  data: RunEval.shape.data,
8995
- scores: z11.array(
8996
- z11.object({
9327
+ scores: z12.array(
9328
+ z12.object({
8997
9329
  function_id: FunctionId,
8998
- name: z11.string()
9330
+ name: z12.string()
8999
9331
  })
9000
9332
  ).nullish(),
9001
- experiment_name: z11.string().nullish(),
9002
- project_id: z11.string().nullish(),
9333
+ experiment_name: z12.string().nullish(),
9334
+ project_id: z12.string().nullish(),
9003
9335
  parent: InvokeParent.optional(),
9004
- stream: z11.boolean().optional()
9336
+ stream: z12.boolean().optional()
9005
9337
  });
9006
- var evalParametersSerializedSchema = z11.record(
9007
- z11.string(),
9008
- z11.union([
9009
- z11.object({
9010
- type: z11.literal("prompt"),
9338
+ var evalParametersSerializedSchema = z12.record(
9339
+ z12.string(),
9340
+ z12.union([
9341
+ z12.object({
9342
+ type: z12.literal("prompt"),
9011
9343
  default: PromptData.optional(),
9012
- description: z11.string().optional()
9344
+ description: z12.string().optional()
9013
9345
  }),
9014
- z11.object({
9015
- type: z11.literal("data"),
9016
- schema: z11.record(z11.unknown()),
9346
+ z12.object({
9347
+ type: z12.literal("data"),
9348
+ schema: z12.record(z12.unknown()),
9017
9349
  // JSON Schema
9018
- default: z11.unknown().optional(),
9019
- description: z11.string().optional()
9350
+ default: z12.unknown().optional(),
9351
+ description: z12.string().optional()
9020
9352
  })
9021
9353
  ])
9022
9354
  );
9023
- var evaluatorDefinitionSchema = z11.object({
9355
+ var evaluatorDefinitionSchema = z12.object({
9024
9356
  parameters: evalParametersSerializedSchema.optional()
9025
9357
  });
9026
- var evaluatorDefinitionsSchema = z11.record(
9027
- z11.string(),
9358
+ var evaluatorDefinitionsSchema = z12.record(
9359
+ z12.string(),
9028
9360
  evaluatorDefinitionSchema
9029
9361
  );
9030
9362
 
9031
9363
  // dev/server.ts
9032
- import { z as z12 } from "zod/v3";
9364
+ import { z as z13 } from "zod/v3";
9033
9365
  import zodToJsonSchema from "zod-to-json-schema";
9034
9366
  function runDevServer(evaluators, opts) {
9035
9367
  const allEvaluators = Object.fromEntries(
@@ -9114,7 +9446,7 @@ function runDevServer(evaluators, opts) {
9114
9446
  validateParameters(parameters ?? {}, evaluator.parameters);
9115
9447
  } catch (e) {
9116
9448
  console.error("Error validating parameters", e);
9117
- if (e instanceof z12.ZodError || e instanceof Error) {
9449
+ if (e instanceof z13.ZodError || e instanceof Error) {
9118
9450
  res.status(400).json({
9119
9451
  error: e.message
9120
9452
  });
@@ -9258,9 +9590,9 @@ async function getDataset(state, data) {
9258
9590
  return data.data;
9259
9591
  }
9260
9592
  }
9261
- var datasetFetchSchema = z12.object({
9262
- project_id: z12.string(),
9263
- name: z12.string()
9593
+ var datasetFetchSchema = z13.object({
9594
+ project_id: z13.string(),
9595
+ name: z13.string()
9264
9596
  });
9265
9597
  async function getDatasetById({
9266
9598
  state,
@@ -9269,7 +9601,7 @@ async function getDatasetById({
9269
9601
  const dataset = await state.appConn().post_json("api/dataset/get", {
9270
9602
  id: datasetId
9271
9603
  });
9272
- const parsed = z12.array(datasetFetchSchema).parse(dataset);
9604
+ const parsed = z13.array(datasetFetchSchema).parse(dataset);
9273
9605
  if (parsed.length === 0) {
9274
9606
  throw new Error(`Dataset '${datasetId}' not found`);
9275
9607
  }