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.
package/dist/browser.mjs CHANGED
@@ -29,7 +29,7 @@ var iso = {
29
29
  var isomorph_default = iso;
30
30
 
31
31
  // src/logger.ts
32
- import { v4 as uuidv4 } from "uuid";
32
+ import { v4 as uuidv42 } from "uuid";
33
33
 
34
34
  // src/queue.ts
35
35
  var DEFAULT_QUEUE_SIZE = 15e3;
@@ -87,6 +87,44 @@ var Queue = class {
87
87
  }
88
88
  };
89
89
 
90
+ // src/id-gen.ts
91
+ import { v4 as uuidv4 } from "uuid";
92
+ function generateHexId(bytes) {
93
+ let result = "";
94
+ for (let i = 0; i < bytes; i++) {
95
+ result += Math.floor(Math.random() * 256).toString(16).padStart(2, "0");
96
+ }
97
+ return result;
98
+ }
99
+ var IDGenerator = class {
100
+ };
101
+ var UUIDGenerator = class extends IDGenerator {
102
+ getSpanId() {
103
+ return uuidv4();
104
+ }
105
+ getTraceId() {
106
+ return uuidv4();
107
+ }
108
+ shareRootSpanId() {
109
+ return true;
110
+ }
111
+ };
112
+ var OTELIDGenerator = class extends IDGenerator {
113
+ getSpanId() {
114
+ return generateHexId(8);
115
+ }
116
+ getTraceId() {
117
+ return generateHexId(16);
118
+ }
119
+ shareRootSpanId() {
120
+ return false;
121
+ }
122
+ };
123
+ function getIdGenerator() {
124
+ const useOtel = typeof process !== "undefined" && process.env?.BRAINTRUST_OTEL_COMPAT?.toLowerCase() === "true";
125
+ return useOtel ? new OTELIDGenerator() : new UUIDGenerator();
126
+ }
127
+
90
128
  // util/db_fields.ts
91
129
  var TRANSACTION_ID_FIELD = "_xact_id";
92
130
  var IS_MERGE_FIELD = "_is_merge";
@@ -1034,6 +1072,41 @@ function _urljoin(...parts) {
1034
1072
  ).filter((x) => x.trim() !== "").join("/");
1035
1073
  }
1036
1074
 
1075
+ // util/span_identifier_v4.ts
1076
+ import { z as z4 } from "zod/v3";
1077
+ var ENCODING_VERSION_NUMBER_V4 = 4;
1078
+ 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.`;
1079
+ var spanComponentsV4Schema = z4.object({
1080
+ object_type: spanObjectTypeV3EnumSchema,
1081
+ propagated_event: z4.record(z4.unknown()).nullish()
1082
+ }).and(
1083
+ z4.union([
1084
+ // Must provide one or the other.
1085
+ z4.object({
1086
+ object_id: z4.string().nullish(),
1087
+ compute_object_metadata_args: z4.optional(z4.null())
1088
+ }),
1089
+ z4.object({
1090
+ object_id: z4.optional(z4.null()),
1091
+ compute_object_metadata_args: z4.record(z4.unknown())
1092
+ })
1093
+ ])
1094
+ ).and(
1095
+ z4.union([
1096
+ // Either all of these must be provided or none.
1097
+ z4.object({
1098
+ row_id: z4.string(),
1099
+ span_id: z4.string(),
1100
+ root_span_id: z4.string()
1101
+ }),
1102
+ z4.object({
1103
+ row_id: z4.optional(z4.null()),
1104
+ span_id: z4.optional(z4.null()),
1105
+ root_span_id: z4.optional(z4.null())
1106
+ })
1107
+ ])
1108
+ );
1109
+
1037
1110
  // util/git_fields.ts
1038
1111
  function mergeGitMetadataSettings(s1, s2) {
1039
1112
  if (s1.collect === "all") {
@@ -1065,12 +1138,12 @@ function prettifyXact(valueString) {
1065
1138
  }
1066
1139
 
1067
1140
  // util/zod_util.ts
1068
- import { z as z4 } from "zod/v3";
1141
+ import { z as z5 } from "zod/v3";
1069
1142
 
1070
1143
  // src/generated_types.ts
1071
- import { z as z5 } from "zod/v3";
1072
- var AclObjectType = z5.union([
1073
- z5.enum([
1144
+ import { z as z6 } from "zod/v3";
1145
+ var AclObjectType = z6.union([
1146
+ z6.enum([
1074
1147
  "organization",
1075
1148
  "project",
1076
1149
  "experiment",
@@ -1083,9 +1156,9 @@ var AclObjectType = z5.union([
1083
1156
  "project_log",
1084
1157
  "org_project"
1085
1158
  ]),
1086
- z5.null()
1159
+ z6.null()
1087
1160
  ]);
1088
- var Permission = z5.enum([
1161
+ var Permission = z6.enum([
1089
1162
  "create",
1090
1163
  "read",
1091
1164
  "update",
@@ -1095,310 +1168,310 @@ var Permission = z5.enum([
1095
1168
  "update_acls",
1096
1169
  "delete_acls"
1097
1170
  ]);
1098
- var Acl = z5.object({
1099
- id: z5.string().uuid(),
1100
- object_type: AclObjectType.and(z5.string()),
1101
- object_id: z5.string().uuid(),
1102
- user_id: z5.union([z5.string(), z5.null()]).optional(),
1103
- group_id: z5.union([z5.string(), z5.null()]).optional(),
1104
- permission: Permission.and(z5.union([z5.string(), z5.null()])).optional(),
1105
- restrict_object_type: AclObjectType.and(z5.unknown()).optional(),
1106
- role_id: z5.union([z5.string(), z5.null()]).optional(),
1107
- _object_org_id: z5.string().uuid(),
1108
- created: z5.union([z5.string(), z5.null()]).optional()
1171
+ var Acl = z6.object({
1172
+ id: z6.string().uuid(),
1173
+ object_type: AclObjectType.and(z6.string()),
1174
+ object_id: z6.string().uuid(),
1175
+ user_id: z6.union([z6.string(), z6.null()]).optional(),
1176
+ group_id: z6.union([z6.string(), z6.null()]).optional(),
1177
+ permission: Permission.and(z6.union([z6.string(), z6.null()])).optional(),
1178
+ restrict_object_type: AclObjectType.and(z6.unknown()).optional(),
1179
+ role_id: z6.union([z6.string(), z6.null()]).optional(),
1180
+ _object_org_id: z6.string().uuid(),
1181
+ created: z6.union([z6.string(), z6.null()]).optional()
1109
1182
  });
1110
- var AISecret = z5.object({
1111
- id: z5.string().uuid(),
1112
- created: z5.union([z5.string(), z5.null()]).optional(),
1113
- updated_at: z5.union([z5.string(), z5.null()]).optional(),
1114
- org_id: z5.string().uuid(),
1115
- name: z5.string(),
1116
- type: z5.union([z5.string(), z5.null()]).optional(),
1117
- metadata: z5.union([z5.object({}).partial().passthrough(), z5.null()]).optional(),
1118
- preview_secret: z5.union([z5.string(), z5.null()]).optional()
1183
+ var AISecret = z6.object({
1184
+ id: z6.string().uuid(),
1185
+ created: z6.union([z6.string(), z6.null()]).optional(),
1186
+ updated_at: z6.union([z6.string(), z6.null()]).optional(),
1187
+ org_id: z6.string().uuid(),
1188
+ name: z6.string(),
1189
+ type: z6.union([z6.string(), z6.null()]).optional(),
1190
+ metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional(),
1191
+ preview_secret: z6.union([z6.string(), z6.null()]).optional()
1119
1192
  });
1120
- var ResponseFormatJsonSchema = z5.object({
1121
- name: z5.string(),
1122
- description: z5.string().optional(),
1123
- schema: z5.union([z5.object({}).partial().passthrough(), z5.string()]).optional(),
1124
- strict: z5.union([z5.boolean(), z5.null()]).optional()
1193
+ var ResponseFormatJsonSchema = z6.object({
1194
+ name: z6.string(),
1195
+ description: z6.string().optional(),
1196
+ schema: z6.union([z6.object({}).partial().passthrough(), z6.string()]).optional(),
1197
+ strict: z6.union([z6.boolean(), z6.null()]).optional()
1125
1198
  });
1126
- var ResponseFormatNullish = z5.union([
1127
- z5.object({ type: z5.literal("json_object") }),
1128
- z5.object({
1129
- type: z5.literal("json_schema"),
1199
+ var ResponseFormatNullish = z6.union([
1200
+ z6.object({ type: z6.literal("json_object") }),
1201
+ z6.object({
1202
+ type: z6.literal("json_schema"),
1130
1203
  json_schema: ResponseFormatJsonSchema
1131
1204
  }),
1132
- z5.object({ type: z5.literal("text") }),
1133
- z5.null()
1205
+ z6.object({ type: z6.literal("text") }),
1206
+ z6.null()
1134
1207
  ]);
1135
- var AnyModelParams = z5.object({
1136
- temperature: z5.number().optional(),
1137
- top_p: z5.number().optional(),
1138
- max_tokens: z5.number(),
1139
- max_completion_tokens: z5.number().optional(),
1140
- frequency_penalty: z5.number().optional(),
1141
- presence_penalty: z5.number().optional(),
1208
+ var AnyModelParams = z6.object({
1209
+ temperature: z6.number().optional(),
1210
+ top_p: z6.number().optional(),
1211
+ max_tokens: z6.number(),
1212
+ max_completion_tokens: z6.number().optional(),
1213
+ frequency_penalty: z6.number().optional(),
1214
+ presence_penalty: z6.number().optional(),
1142
1215
  response_format: ResponseFormatNullish.optional(),
1143
- tool_choice: z5.union([
1144
- z5.literal("auto"),
1145
- z5.literal("none"),
1146
- z5.literal("required"),
1147
- z5.object({
1148
- type: z5.literal("function"),
1149
- function: z5.object({ name: z5.string() })
1216
+ tool_choice: z6.union([
1217
+ z6.literal("auto"),
1218
+ z6.literal("none"),
1219
+ z6.literal("required"),
1220
+ z6.object({
1221
+ type: z6.literal("function"),
1222
+ function: z6.object({ name: z6.string() })
1150
1223
  })
1151
1224
  ]).optional(),
1152
- function_call: z5.union([
1153
- z5.literal("auto"),
1154
- z5.literal("none"),
1155
- z5.object({ name: z5.string() })
1225
+ function_call: z6.union([
1226
+ z6.literal("auto"),
1227
+ z6.literal("none"),
1228
+ z6.object({ name: z6.string() })
1156
1229
  ]).optional(),
1157
- n: z5.number().optional(),
1158
- stop: z5.array(z5.string()).optional(),
1159
- reasoning_effort: z5.enum(["minimal", "low", "medium", "high"]).optional(),
1160
- verbosity: z5.enum(["low", "medium", "high"]).optional(),
1161
- top_k: z5.number().optional(),
1162
- stop_sequences: z5.array(z5.string()).optional(),
1163
- max_tokens_to_sample: z5.number().optional(),
1164
- maxOutputTokens: z5.number().optional(),
1165
- topP: z5.number().optional(),
1166
- topK: z5.number().optional(),
1167
- use_cache: z5.boolean().optional()
1230
+ n: z6.number().optional(),
1231
+ stop: z6.array(z6.string()).optional(),
1232
+ reasoning_effort: z6.enum(["minimal", "low", "medium", "high"]).optional(),
1233
+ verbosity: z6.enum(["low", "medium", "high"]).optional(),
1234
+ top_k: z6.number().optional(),
1235
+ stop_sequences: z6.array(z6.string()).optional(),
1236
+ max_tokens_to_sample: z6.number().optional(),
1237
+ maxOutputTokens: z6.number().optional(),
1238
+ topP: z6.number().optional(),
1239
+ topK: z6.number().optional(),
1240
+ use_cache: z6.boolean().optional()
1168
1241
  });
1169
- var ApiKey = z5.object({
1170
- id: z5.string().uuid(),
1171
- created: z5.union([z5.string(), z5.null()]).optional(),
1172
- name: z5.string(),
1173
- preview_name: z5.string(),
1174
- user_id: z5.union([z5.string(), z5.null()]).optional(),
1175
- user_email: z5.union([z5.string(), z5.null()]).optional(),
1176
- user_given_name: z5.union([z5.string(), z5.null()]).optional(),
1177
- user_family_name: z5.union([z5.string(), z5.null()]).optional(),
1178
- org_id: z5.union([z5.string(), z5.null()]).optional()
1242
+ var ApiKey = z6.object({
1243
+ id: z6.string().uuid(),
1244
+ created: z6.union([z6.string(), z6.null()]).optional(),
1245
+ name: z6.string(),
1246
+ preview_name: z6.string(),
1247
+ user_id: z6.union([z6.string(), z6.null()]).optional(),
1248
+ user_email: z6.union([z6.string(), z6.null()]).optional(),
1249
+ user_given_name: z6.union([z6.string(), z6.null()]).optional(),
1250
+ user_family_name: z6.union([z6.string(), z6.null()]).optional(),
1251
+ org_id: z6.union([z6.string(), z6.null()]).optional()
1179
1252
  });
1180
- var AsyncScoringState = z5.union([
1181
- z5.object({
1182
- status: z5.literal("enabled"),
1183
- token: z5.string(),
1184
- function_ids: z5.array(z5.unknown()).min(1),
1185
- skip_logging: z5.union([z5.boolean(), z5.null()]).optional()
1253
+ var AsyncScoringState = z6.union([
1254
+ z6.object({
1255
+ status: z6.literal("enabled"),
1256
+ token: z6.string(),
1257
+ function_ids: z6.array(z6.unknown()).min(1),
1258
+ skip_logging: z6.union([z6.boolean(), z6.null()]).optional()
1186
1259
  }),
1187
- z5.object({ status: z5.literal("disabled") }),
1188
- z5.null(),
1189
- z5.null()
1260
+ z6.object({ status: z6.literal("disabled") }),
1261
+ z6.null(),
1262
+ z6.null()
1190
1263
  ]);
1191
- var AsyncScoringControl = z5.union([
1192
- z5.object({ kind: z5.literal("score_update"), token: z5.string() }),
1193
- z5.object({ kind: z5.literal("state_override"), state: AsyncScoringState }),
1194
- z5.object({ kind: z5.literal("state_force_reselect") }),
1195
- z5.object({ kind: z5.literal("state_enabled_force_rescore") })
1264
+ var AsyncScoringControl = z6.union([
1265
+ z6.object({ kind: z6.literal("score_update"), token: z6.string() }),
1266
+ z6.object({ kind: z6.literal("state_override"), state: AsyncScoringState }),
1267
+ z6.object({ kind: z6.literal("state_force_reselect") }),
1268
+ z6.object({ kind: z6.literal("state_enabled_force_rescore") })
1196
1269
  ]);
1197
- var BraintrustAttachmentReference = z5.object({
1198
- type: z5.literal("braintrust_attachment"),
1199
- filename: z5.string().min(1),
1200
- content_type: z5.string().min(1),
1201
- key: z5.string().min(1)
1270
+ var BraintrustAttachmentReference = z6.object({
1271
+ type: z6.literal("braintrust_attachment"),
1272
+ filename: z6.string().min(1),
1273
+ content_type: z6.string().min(1),
1274
+ key: z6.string().min(1)
1202
1275
  });
1203
- var ExternalAttachmentReference = z5.object({
1204
- type: z5.literal("external_attachment"),
1205
- filename: z5.string().min(1),
1206
- content_type: z5.string().min(1),
1207
- url: z5.string().min(1)
1276
+ var ExternalAttachmentReference = z6.object({
1277
+ type: z6.literal("external_attachment"),
1278
+ filename: z6.string().min(1),
1279
+ content_type: z6.string().min(1),
1280
+ url: z6.string().min(1)
1208
1281
  });
1209
- var AttachmentReference = z5.discriminatedUnion("type", [
1282
+ var AttachmentReference = z6.discriminatedUnion("type", [
1210
1283
  BraintrustAttachmentReference,
1211
1284
  ExternalAttachmentReference
1212
1285
  ]);
1213
- var UploadStatus = z5.enum(["uploading", "done", "error"]);
1214
- var AttachmentStatus = z5.object({
1286
+ var UploadStatus = z6.enum(["uploading", "done", "error"]);
1287
+ var AttachmentStatus = z6.object({
1215
1288
  upload_status: UploadStatus,
1216
- error_message: z5.string().optional()
1289
+ error_message: z6.string().optional()
1217
1290
  });
1218
- var BraintrustModelParams = z5.object({ use_cache: z5.boolean() }).partial();
1219
- var CallEvent = z5.union([
1220
- z5.object({
1221
- id: z5.string().optional(),
1222
- data: z5.string(),
1223
- event: z5.literal("text_delta")
1291
+ var BraintrustModelParams = z6.object({ use_cache: z6.boolean() }).partial();
1292
+ var CallEvent = z6.union([
1293
+ z6.object({
1294
+ id: z6.string().optional(),
1295
+ data: z6.string(),
1296
+ event: z6.literal("text_delta")
1224
1297
  }),
1225
- z5.object({
1226
- id: z5.string().optional(),
1227
- data: z5.string(),
1228
- event: z5.literal("reasoning_delta")
1298
+ z6.object({
1299
+ id: z6.string().optional(),
1300
+ data: z6.string(),
1301
+ event: z6.literal("reasoning_delta")
1229
1302
  }),
1230
- z5.object({
1231
- id: z5.string().optional(),
1232
- data: z5.string(),
1233
- event: z5.literal("json_delta")
1303
+ z6.object({
1304
+ id: z6.string().optional(),
1305
+ data: z6.string(),
1306
+ event: z6.literal("json_delta")
1234
1307
  }),
1235
- z5.object({
1236
- id: z5.string().optional(),
1237
- data: z5.string(),
1238
- event: z5.literal("progress")
1308
+ z6.object({
1309
+ id: z6.string().optional(),
1310
+ data: z6.string(),
1311
+ event: z6.literal("progress")
1239
1312
  }),
1240
- z5.object({
1241
- id: z5.string().optional(),
1242
- data: z5.string(),
1243
- event: z5.literal("error")
1313
+ z6.object({
1314
+ id: z6.string().optional(),
1315
+ data: z6.string(),
1316
+ event: z6.literal("error")
1244
1317
  }),
1245
- z5.object({
1246
- id: z5.string().optional(),
1247
- data: z5.string(),
1248
- event: z5.literal("console")
1318
+ z6.object({
1319
+ id: z6.string().optional(),
1320
+ data: z6.string(),
1321
+ event: z6.literal("console")
1249
1322
  }),
1250
- z5.object({
1251
- id: z5.string().optional(),
1252
- event: z5.literal("start"),
1253
- data: z5.literal("")
1323
+ z6.object({
1324
+ id: z6.string().optional(),
1325
+ event: z6.literal("start"),
1326
+ data: z6.literal("")
1254
1327
  }),
1255
- z5.object({
1256
- id: z5.string().optional(),
1257
- event: z5.literal("done"),
1258
- data: z5.literal("")
1328
+ z6.object({
1329
+ id: z6.string().optional(),
1330
+ event: z6.literal("done"),
1331
+ data: z6.literal("")
1259
1332
  })
1260
1333
  ]);
1261
- var ChatCompletionContentPartTextWithTitle = z5.object({
1262
- text: z5.string().default(""),
1263
- type: z5.literal("text"),
1264
- cache_control: z5.object({ type: z5.literal("ephemeral") }).optional()
1334
+ var ChatCompletionContentPartTextWithTitle = z6.object({
1335
+ text: z6.string().default(""),
1336
+ type: z6.literal("text"),
1337
+ cache_control: z6.object({ type: z6.literal("ephemeral") }).optional()
1265
1338
  });
1266
- var ChatCompletionContentPartImageWithTitle = z5.object({
1267
- image_url: z5.object({
1268
- url: z5.string(),
1269
- detail: z5.union([z5.literal("auto"), z5.literal("low"), z5.literal("high")]).optional()
1339
+ var ChatCompletionContentPartImageWithTitle = z6.object({
1340
+ image_url: z6.object({
1341
+ url: z6.string(),
1342
+ detail: z6.union([z6.literal("auto"), z6.literal("low"), z6.literal("high")]).optional()
1270
1343
  }),
1271
- type: z5.literal("image_url")
1344
+ type: z6.literal("image_url")
1272
1345
  });
1273
- var ChatCompletionContentPart = z5.union([
1346
+ var ChatCompletionContentPart = z6.union([
1274
1347
  ChatCompletionContentPartTextWithTitle,
1275
1348
  ChatCompletionContentPartImageWithTitle
1276
1349
  ]);
1277
- var ChatCompletionContentPartText = z5.object({
1278
- text: z5.string().default(""),
1279
- type: z5.literal("text"),
1280
- cache_control: z5.object({ type: z5.literal("ephemeral") }).optional()
1350
+ var ChatCompletionContentPartText = z6.object({
1351
+ text: z6.string().default(""),
1352
+ type: z6.literal("text"),
1353
+ cache_control: z6.object({ type: z6.literal("ephemeral") }).optional()
1281
1354
  });
1282
- var ChatCompletionMessageToolCall = z5.object({
1283
- id: z5.string(),
1284
- function: z5.object({ arguments: z5.string(), name: z5.string() }),
1285
- type: z5.literal("function")
1355
+ var ChatCompletionMessageToolCall = z6.object({
1356
+ id: z6.string(),
1357
+ function: z6.object({ arguments: z6.string(), name: z6.string() }),
1358
+ type: z6.literal("function")
1286
1359
  });
1287
- var ChatCompletionMessageReasoning = z5.object({ id: z5.string(), content: z5.string() }).partial();
1288
- var ChatCompletionMessageParam = z5.union([
1289
- z5.object({
1290
- content: z5.union([z5.string(), z5.array(ChatCompletionContentPartText)]),
1291
- role: z5.literal("system"),
1292
- name: z5.string().optional()
1360
+ var ChatCompletionMessageReasoning = z6.object({ id: z6.string(), content: z6.string() }).partial();
1361
+ var ChatCompletionMessageParam = z6.union([
1362
+ z6.object({
1363
+ content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
1364
+ role: z6.literal("system"),
1365
+ name: z6.string().optional()
1293
1366
  }),
1294
- z5.object({
1295
- content: z5.union([z5.string(), z5.array(ChatCompletionContentPart)]),
1296
- role: z5.literal("user"),
1297
- name: z5.string().optional()
1367
+ z6.object({
1368
+ content: z6.union([z6.string(), z6.array(ChatCompletionContentPart)]),
1369
+ role: z6.literal("user"),
1370
+ name: z6.string().optional()
1298
1371
  }),
1299
- z5.object({
1300
- role: z5.literal("assistant"),
1301
- content: z5.union([z5.string(), z5.array(ChatCompletionContentPartText), z5.null()]).optional(),
1302
- function_call: z5.object({ arguments: z5.string(), name: z5.string() }).optional(),
1303
- name: z5.string().optional(),
1304
- tool_calls: z5.array(ChatCompletionMessageToolCall).optional(),
1305
- reasoning: z5.array(ChatCompletionMessageReasoning).optional()
1372
+ z6.object({
1373
+ role: z6.literal("assistant"),
1374
+ content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText), z6.null()]).optional(),
1375
+ function_call: z6.object({ arguments: z6.string(), name: z6.string() }).optional(),
1376
+ name: z6.string().optional(),
1377
+ tool_calls: z6.array(ChatCompletionMessageToolCall).optional(),
1378
+ reasoning: z6.array(ChatCompletionMessageReasoning).optional()
1306
1379
  }),
1307
- z5.object({
1308
- content: z5.union([z5.string(), z5.array(ChatCompletionContentPartText)]),
1309
- role: z5.literal("tool"),
1310
- tool_call_id: z5.string().default("")
1380
+ z6.object({
1381
+ content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
1382
+ role: z6.literal("tool"),
1383
+ tool_call_id: z6.string().default("")
1311
1384
  }),
1312
- z5.object({
1313
- content: z5.union([z5.string(), z5.null()]),
1314
- name: z5.string(),
1315
- role: z5.literal("function")
1385
+ z6.object({
1386
+ content: z6.union([z6.string(), z6.null()]),
1387
+ name: z6.string(),
1388
+ role: z6.literal("function")
1316
1389
  }),
1317
- z5.object({
1318
- content: z5.union([z5.string(), z5.array(ChatCompletionContentPartText)]),
1319
- role: z5.literal("developer"),
1320
- name: z5.string().optional()
1390
+ z6.object({
1391
+ content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
1392
+ role: z6.literal("developer"),
1393
+ name: z6.string().optional()
1321
1394
  }),
1322
- z5.object({
1323
- role: z5.literal("model"),
1324
- content: z5.union([z5.string(), z5.null()]).optional()
1395
+ z6.object({
1396
+ role: z6.literal("model"),
1397
+ content: z6.union([z6.string(), z6.null()]).optional()
1325
1398
  })
1326
1399
  ]);
1327
- var ChatCompletionOpenAIMessageParam = z5.union([
1328
- z5.object({
1329
- content: z5.union([z5.string(), z5.array(ChatCompletionContentPartText)]),
1330
- role: z5.literal("system"),
1331
- name: z5.string().optional()
1400
+ var ChatCompletionOpenAIMessageParam = z6.union([
1401
+ z6.object({
1402
+ content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
1403
+ role: z6.literal("system"),
1404
+ name: z6.string().optional()
1332
1405
  }),
1333
- z5.object({
1334
- content: z5.union([z5.string(), z5.array(ChatCompletionContentPart)]),
1335
- role: z5.literal("user"),
1336
- name: z5.string().optional()
1406
+ z6.object({
1407
+ content: z6.union([z6.string(), z6.array(ChatCompletionContentPart)]),
1408
+ role: z6.literal("user"),
1409
+ name: z6.string().optional()
1337
1410
  }),
1338
- z5.object({
1339
- role: z5.literal("assistant"),
1340
- content: z5.union([z5.string(), z5.array(ChatCompletionContentPartText), z5.null()]).optional(),
1341
- function_call: z5.object({ arguments: z5.string(), name: z5.string() }).optional(),
1342
- name: z5.string().optional(),
1343
- tool_calls: z5.array(ChatCompletionMessageToolCall).optional(),
1344
- reasoning: z5.array(ChatCompletionMessageReasoning).optional()
1411
+ z6.object({
1412
+ role: z6.literal("assistant"),
1413
+ content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText), z6.null()]).optional(),
1414
+ function_call: z6.object({ arguments: z6.string(), name: z6.string() }).optional(),
1415
+ name: z6.string().optional(),
1416
+ tool_calls: z6.array(ChatCompletionMessageToolCall).optional(),
1417
+ reasoning: z6.array(ChatCompletionMessageReasoning).optional()
1345
1418
  }),
1346
- z5.object({
1347
- content: z5.union([z5.string(), z5.array(ChatCompletionContentPartText)]),
1348
- role: z5.literal("tool"),
1349
- tool_call_id: z5.string().default("")
1419
+ z6.object({
1420
+ content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
1421
+ role: z6.literal("tool"),
1422
+ tool_call_id: z6.string().default("")
1350
1423
  }),
1351
- z5.object({
1352
- content: z5.union([z5.string(), z5.null()]),
1353
- name: z5.string(),
1354
- role: z5.literal("function")
1424
+ z6.object({
1425
+ content: z6.union([z6.string(), z6.null()]),
1426
+ name: z6.string(),
1427
+ role: z6.literal("function")
1355
1428
  }),
1356
- z5.object({
1357
- content: z5.union([z5.string(), z5.array(ChatCompletionContentPartText)]),
1358
- role: z5.literal("developer"),
1359
- name: z5.string().optional()
1429
+ z6.object({
1430
+ content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
1431
+ role: z6.literal("developer"),
1432
+ name: z6.string().optional()
1360
1433
  })
1361
1434
  ]);
1362
- var ChatCompletionTool = z5.object({
1363
- function: z5.object({
1364
- name: z5.string(),
1365
- description: z5.string().optional(),
1366
- parameters: z5.object({}).partial().passthrough().optional()
1435
+ var ChatCompletionTool = z6.object({
1436
+ function: z6.object({
1437
+ name: z6.string(),
1438
+ description: z6.string().optional(),
1439
+ parameters: z6.object({}).partial().passthrough().optional()
1367
1440
  }),
1368
- type: z5.literal("function")
1441
+ type: z6.literal("function")
1369
1442
  });
1370
- var CodeBundle = z5.object({
1371
- runtime_context: z5.object({
1372
- runtime: z5.enum(["node", "python"]),
1373
- version: z5.string()
1443
+ var CodeBundle = z6.object({
1444
+ runtime_context: z6.object({
1445
+ runtime: z6.enum(["node", "python"]),
1446
+ version: z6.string()
1374
1447
  }),
1375
- location: z5.union([
1376
- z5.object({
1377
- type: z5.literal("experiment"),
1378
- eval_name: z5.string(),
1379
- position: z5.union([
1380
- z5.object({ type: z5.literal("task") }),
1381
- z5.object({ type: z5.literal("scorer"), index: z5.number().int().gte(0) })
1448
+ location: z6.union([
1449
+ z6.object({
1450
+ type: z6.literal("experiment"),
1451
+ eval_name: z6.string(),
1452
+ position: z6.union([
1453
+ z6.object({ type: z6.literal("task") }),
1454
+ z6.object({ type: z6.literal("scorer"), index: z6.number().int().gte(0) })
1382
1455
  ])
1383
1456
  }),
1384
- z5.object({ type: z5.literal("function"), index: z5.number().int().gte(0) })
1457
+ z6.object({ type: z6.literal("function"), index: z6.number().int().gte(0) })
1385
1458
  ]),
1386
- bundle_id: z5.string(),
1387
- preview: z5.union([z5.string(), z5.null()]).optional()
1459
+ bundle_id: z6.string(),
1460
+ preview: z6.union([z6.string(), z6.null()]).optional()
1388
1461
  });
1389
- var Dataset = z5.object({
1390
- id: z5.string().uuid(),
1391
- project_id: z5.string().uuid(),
1392
- name: z5.string(),
1393
- description: z5.union([z5.string(), z5.null()]).optional(),
1394
- created: z5.union([z5.string(), z5.null()]).optional(),
1395
- deleted_at: z5.union([z5.string(), z5.null()]).optional(),
1396
- user_id: z5.union([z5.string(), z5.null()]).optional(),
1397
- metadata: z5.union([z5.object({}).partial().passthrough(), z5.null()]).optional()
1462
+ var Dataset = z6.object({
1463
+ id: z6.string().uuid(),
1464
+ project_id: z6.string().uuid(),
1465
+ name: z6.string(),
1466
+ description: z6.union([z6.string(), z6.null()]).optional(),
1467
+ created: z6.union([z6.string(), z6.null()]).optional(),
1468
+ deleted_at: z6.union([z6.string(), z6.null()]).optional(),
1469
+ user_id: z6.union([z6.string(), z6.null()]).optional(),
1470
+ metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional()
1398
1471
  });
1399
- var ObjectReferenceNullish = z5.union([
1400
- z5.object({
1401
- object_type: z5.enum([
1472
+ var ObjectReferenceNullish = z6.union([
1473
+ z6.object({
1474
+ object_type: z6.enum([
1402
1475
  "project_logs",
1403
1476
  "experiment",
1404
1477
  "dataset",
@@ -1406,399 +1479,399 @@ var ObjectReferenceNullish = z5.union([
1406
1479
  "function",
1407
1480
  "prompt_session"
1408
1481
  ]),
1409
- object_id: z5.string().uuid(),
1410
- id: z5.string(),
1411
- _xact_id: z5.union([z5.string(), z5.null()]).optional(),
1412
- created: z5.union([z5.string(), z5.null()]).optional()
1482
+ object_id: z6.string().uuid(),
1483
+ id: z6.string(),
1484
+ _xact_id: z6.union([z6.string(), z6.null()]).optional(),
1485
+ created: z6.union([z6.string(), z6.null()]).optional()
1413
1486
  }),
1414
- z5.null()
1487
+ z6.null()
1415
1488
  ]);
1416
- var DatasetEvent = z5.object({
1417
- id: z5.string(),
1418
- _xact_id: z5.string(),
1419
- created: z5.string().datetime({ offset: true }),
1420
- _pagination_key: z5.union([z5.string(), z5.null()]).optional(),
1421
- project_id: z5.string().uuid(),
1422
- dataset_id: z5.string().uuid(),
1423
- input: z5.unknown().optional(),
1424
- expected: z5.unknown().optional(),
1425
- metadata: z5.union([
1426
- z5.object({ model: z5.union([z5.string(), z5.null()]) }).partial().passthrough(),
1427
- z5.null()
1489
+ var DatasetEvent = z6.object({
1490
+ id: z6.string(),
1491
+ _xact_id: z6.string(),
1492
+ created: z6.string().datetime({ offset: true }),
1493
+ _pagination_key: z6.union([z6.string(), z6.null()]).optional(),
1494
+ project_id: z6.string().uuid(),
1495
+ dataset_id: z6.string().uuid(),
1496
+ input: z6.unknown().optional(),
1497
+ expected: z6.unknown().optional(),
1498
+ metadata: z6.union([
1499
+ z6.object({ model: z6.union([z6.string(), z6.null()]) }).partial().passthrough(),
1500
+ z6.null()
1428
1501
  ]).optional(),
1429
- tags: z5.union([z5.array(z5.string()), z5.null()]).optional(),
1430
- span_id: z5.string(),
1431
- root_span_id: z5.string(),
1432
- is_root: z5.union([z5.boolean(), z5.null()]).optional(),
1502
+ tags: z6.union([z6.array(z6.string()), z6.null()]).optional(),
1503
+ span_id: z6.string(),
1504
+ root_span_id: z6.string(),
1505
+ is_root: z6.union([z6.boolean(), z6.null()]).optional(),
1433
1506
  origin: ObjectReferenceNullish.optional()
1434
1507
  });
1435
- var EnvVar = z5.object({
1436
- id: z5.string().uuid(),
1437
- object_type: z5.enum(["organization", "project", "function"]),
1438
- object_id: z5.string().uuid(),
1439
- name: z5.string(),
1440
- created: z5.union([z5.string(), z5.null()]).optional(),
1441
- used: z5.union([z5.string(), z5.null()]).optional()
1508
+ var EnvVar = z6.object({
1509
+ id: z6.string().uuid(),
1510
+ object_type: z6.enum(["organization", "project", "function"]),
1511
+ object_id: z6.string().uuid(),
1512
+ name: z6.string(),
1513
+ created: z6.union([z6.string(), z6.null()]).optional(),
1514
+ used: z6.union([z6.string(), z6.null()]).optional()
1442
1515
  });
1443
- var RepoInfo = z5.union([
1444
- z5.object({
1445
- commit: z5.union([z5.string(), z5.null()]),
1446
- branch: z5.union([z5.string(), z5.null()]),
1447
- tag: z5.union([z5.string(), z5.null()]),
1448
- dirty: z5.union([z5.boolean(), z5.null()]),
1449
- author_name: z5.union([z5.string(), z5.null()]),
1450
- author_email: z5.union([z5.string(), z5.null()]),
1451
- commit_message: z5.union([z5.string(), z5.null()]),
1452
- commit_time: z5.union([z5.string(), z5.null()]),
1453
- git_diff: z5.union([z5.string(), z5.null()])
1516
+ var RepoInfo = z6.union([
1517
+ z6.object({
1518
+ commit: z6.union([z6.string(), z6.null()]),
1519
+ branch: z6.union([z6.string(), z6.null()]),
1520
+ tag: z6.union([z6.string(), z6.null()]),
1521
+ dirty: z6.union([z6.boolean(), z6.null()]),
1522
+ author_name: z6.union([z6.string(), z6.null()]),
1523
+ author_email: z6.union([z6.string(), z6.null()]),
1524
+ commit_message: z6.union([z6.string(), z6.null()]),
1525
+ commit_time: z6.union([z6.string(), z6.null()]),
1526
+ git_diff: z6.union([z6.string(), z6.null()])
1454
1527
  }).partial(),
1455
- z5.null()
1528
+ z6.null()
1456
1529
  ]);
1457
- var Experiment = z5.object({
1458
- id: z5.string().uuid(),
1459
- project_id: z5.string().uuid(),
1460
- name: z5.string(),
1461
- description: z5.union([z5.string(), z5.null()]).optional(),
1462
- created: z5.union([z5.string(), z5.null()]).optional(),
1530
+ var Experiment = z6.object({
1531
+ id: z6.string().uuid(),
1532
+ project_id: z6.string().uuid(),
1533
+ name: z6.string(),
1534
+ description: z6.union([z6.string(), z6.null()]).optional(),
1535
+ created: z6.union([z6.string(), z6.null()]).optional(),
1463
1536
  repo_info: RepoInfo.optional(),
1464
- commit: z5.union([z5.string(), z5.null()]).optional(),
1465
- base_exp_id: z5.union([z5.string(), z5.null()]).optional(),
1466
- deleted_at: z5.union([z5.string(), z5.null()]).optional(),
1467
- dataset_id: z5.union([z5.string(), z5.null()]).optional(),
1468
- dataset_version: z5.union([z5.string(), z5.null()]).optional(),
1469
- public: z5.boolean(),
1470
- user_id: z5.union([z5.string(), z5.null()]).optional(),
1471
- metadata: z5.union([z5.object({}).partial().passthrough(), z5.null()]).optional(),
1472
- tags: z5.union([z5.array(z5.string()), z5.null()]).optional()
1537
+ commit: z6.union([z6.string(), z6.null()]).optional(),
1538
+ base_exp_id: z6.union([z6.string(), z6.null()]).optional(),
1539
+ deleted_at: z6.union([z6.string(), z6.null()]).optional(),
1540
+ dataset_id: z6.union([z6.string(), z6.null()]).optional(),
1541
+ dataset_version: z6.union([z6.string(), z6.null()]).optional(),
1542
+ public: z6.boolean(),
1543
+ user_id: z6.union([z6.string(), z6.null()]).optional(),
1544
+ metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional(),
1545
+ tags: z6.union([z6.array(z6.string()), z6.null()]).optional()
1473
1546
  });
1474
- var SpanType = z5.union([
1475
- z5.enum(["llm", "score", "function", "eval", "task", "tool"]),
1476
- z5.null()
1547
+ var SpanType = z6.union([
1548
+ z6.enum(["llm", "score", "function", "eval", "task", "tool"]),
1549
+ z6.null()
1477
1550
  ]);
1478
- var SpanAttributes = z5.union([
1479
- z5.object({ name: z5.union([z5.string(), z5.null()]), type: SpanType }).partial().passthrough(),
1480
- z5.null()
1551
+ var SpanAttributes = z6.union([
1552
+ z6.object({ name: z6.union([z6.string(), z6.null()]), type: SpanType }).partial().passthrough(),
1553
+ z6.null()
1481
1554
  ]);
1482
- var ExperimentEvent = z5.object({
1483
- id: z5.string(),
1484
- _xact_id: z5.string(),
1485
- created: z5.string().datetime({ offset: true }),
1486
- _pagination_key: z5.union([z5.string(), z5.null()]).optional(),
1487
- project_id: z5.string().uuid(),
1488
- experiment_id: z5.string().uuid(),
1489
- input: z5.unknown().optional(),
1490
- output: z5.unknown().optional(),
1491
- expected: z5.unknown().optional(),
1492
- error: z5.unknown().optional(),
1493
- scores: z5.union([z5.record(z5.union([z5.number(), z5.null()])), z5.null()]).optional(),
1494
- metadata: z5.union([
1495
- z5.object({ model: z5.union([z5.string(), z5.null()]) }).partial().passthrough(),
1496
- z5.null()
1555
+ var ExperimentEvent = z6.object({
1556
+ id: z6.string(),
1557
+ _xact_id: z6.string(),
1558
+ created: z6.string().datetime({ offset: true }),
1559
+ _pagination_key: z6.union([z6.string(), z6.null()]).optional(),
1560
+ project_id: z6.string().uuid(),
1561
+ experiment_id: z6.string().uuid(),
1562
+ input: z6.unknown().optional(),
1563
+ output: z6.unknown().optional(),
1564
+ expected: z6.unknown().optional(),
1565
+ error: z6.unknown().optional(),
1566
+ scores: z6.union([z6.record(z6.union([z6.number(), z6.null()])), z6.null()]).optional(),
1567
+ metadata: z6.union([
1568
+ z6.object({ model: z6.union([z6.string(), z6.null()]) }).partial().passthrough(),
1569
+ z6.null()
1497
1570
  ]).optional(),
1498
- tags: z5.union([z5.array(z5.string()), z5.null()]).optional(),
1499
- metrics: z5.union([z5.record(z5.number()), z5.null()]).optional(),
1500
- context: z5.union([
1501
- z5.object({
1502
- caller_functionname: z5.union([z5.string(), z5.null()]),
1503
- caller_filename: z5.union([z5.string(), z5.null()]),
1504
- caller_lineno: z5.union([z5.number(), z5.null()])
1571
+ tags: z6.union([z6.array(z6.string()), z6.null()]).optional(),
1572
+ metrics: z6.union([z6.record(z6.number()), z6.null()]).optional(),
1573
+ context: z6.union([
1574
+ z6.object({
1575
+ caller_functionname: z6.union([z6.string(), z6.null()]),
1576
+ caller_filename: z6.union([z6.string(), z6.null()]),
1577
+ caller_lineno: z6.union([z6.number(), z6.null()])
1505
1578
  }).partial().passthrough(),
1506
- z5.null()
1579
+ z6.null()
1507
1580
  ]).optional(),
1508
- span_id: z5.string(),
1509
- span_parents: z5.union([z5.array(z5.string()), z5.null()]).optional(),
1510
- root_span_id: z5.string(),
1581
+ span_id: z6.string(),
1582
+ span_parents: z6.union([z6.array(z6.string()), z6.null()]).optional(),
1583
+ root_span_id: z6.string(),
1511
1584
  span_attributes: SpanAttributes.optional(),
1512
- is_root: z5.union([z5.boolean(), z5.null()]).optional(),
1585
+ is_root: z6.union([z6.boolean(), z6.null()]).optional(),
1513
1586
  origin: ObjectReferenceNullish.optional()
1514
1587
  });
1515
- var ExtendedSavedFunctionId = z5.union([
1516
- z5.object({ type: z5.literal("function"), id: z5.string() }),
1517
- z5.object({ type: z5.literal("global"), name: z5.string() }),
1518
- z5.object({
1519
- type: z5.literal("slug"),
1520
- project_id: z5.string(),
1521
- slug: z5.string()
1588
+ var ExtendedSavedFunctionId = z6.union([
1589
+ z6.object({ type: z6.literal("function"), id: z6.string() }),
1590
+ z6.object({ type: z6.literal("global"), name: z6.string() }),
1591
+ z6.object({
1592
+ type: z6.literal("slug"),
1593
+ project_id: z6.string(),
1594
+ slug: z6.string()
1522
1595
  })
1523
1596
  ]);
1524
- var PromptBlockDataNullish = z5.union([
1525
- z5.object({ type: z5.literal("completion"), content: z5.string() }),
1526
- z5.object({
1527
- type: z5.literal("chat"),
1528
- messages: z5.array(ChatCompletionMessageParam),
1529
- tools: z5.string().optional()
1597
+ var PromptBlockDataNullish = z6.union([
1598
+ z6.object({ type: z6.literal("completion"), content: z6.string() }),
1599
+ z6.object({
1600
+ type: z6.literal("chat"),
1601
+ messages: z6.array(ChatCompletionMessageParam),
1602
+ tools: z6.string().optional()
1530
1603
  }),
1531
- z5.null()
1604
+ z6.null()
1532
1605
  ]);
1533
- var ModelParams = z5.union([
1534
- z5.object({
1535
- use_cache: z5.boolean(),
1536
- temperature: z5.number(),
1537
- top_p: z5.number(),
1538
- max_tokens: z5.number(),
1539
- max_completion_tokens: z5.number(),
1540
- frequency_penalty: z5.number(),
1541
- presence_penalty: z5.number(),
1606
+ var ModelParams = z6.union([
1607
+ z6.object({
1608
+ use_cache: z6.boolean(),
1609
+ temperature: z6.number(),
1610
+ top_p: z6.number(),
1611
+ max_tokens: z6.number(),
1612
+ max_completion_tokens: z6.number(),
1613
+ frequency_penalty: z6.number(),
1614
+ presence_penalty: z6.number(),
1542
1615
  response_format: ResponseFormatNullish,
1543
- tool_choice: z5.union([
1544
- z5.literal("auto"),
1545
- z5.literal("none"),
1546
- z5.literal("required"),
1547
- z5.object({
1548
- type: z5.literal("function"),
1549
- function: z5.object({ name: z5.string() })
1616
+ tool_choice: z6.union([
1617
+ z6.literal("auto"),
1618
+ z6.literal("none"),
1619
+ z6.literal("required"),
1620
+ z6.object({
1621
+ type: z6.literal("function"),
1622
+ function: z6.object({ name: z6.string() })
1550
1623
  })
1551
1624
  ]),
1552
- function_call: z5.union([
1553
- z5.literal("auto"),
1554
- z5.literal("none"),
1555
- z5.object({ name: z5.string() })
1625
+ function_call: z6.union([
1626
+ z6.literal("auto"),
1627
+ z6.literal("none"),
1628
+ z6.object({ name: z6.string() })
1556
1629
  ]),
1557
- n: z5.number(),
1558
- stop: z5.array(z5.string()),
1559
- reasoning_effort: z5.enum(["minimal", "low", "medium", "high"]),
1560
- verbosity: z5.enum(["low", "medium", "high"])
1630
+ n: z6.number(),
1631
+ stop: z6.array(z6.string()),
1632
+ reasoning_effort: z6.enum(["minimal", "low", "medium", "high"]),
1633
+ verbosity: z6.enum(["low", "medium", "high"])
1561
1634
  }).partial().passthrough(),
1562
- z5.object({
1563
- use_cache: z5.boolean().optional(),
1564
- max_tokens: z5.number(),
1565
- temperature: z5.number(),
1566
- top_p: z5.number().optional(),
1567
- top_k: z5.number().optional(),
1568
- stop_sequences: z5.array(z5.string()).optional(),
1569
- max_tokens_to_sample: z5.number().optional()
1635
+ z6.object({
1636
+ use_cache: z6.boolean().optional(),
1637
+ max_tokens: z6.number(),
1638
+ temperature: z6.number(),
1639
+ top_p: z6.number().optional(),
1640
+ top_k: z6.number().optional(),
1641
+ stop_sequences: z6.array(z6.string()).optional(),
1642
+ max_tokens_to_sample: z6.number().optional()
1570
1643
  }).passthrough(),
1571
- z5.object({
1572
- use_cache: z5.boolean(),
1573
- temperature: z5.number(),
1574
- maxOutputTokens: z5.number(),
1575
- topP: z5.number(),
1576
- topK: z5.number()
1644
+ z6.object({
1645
+ use_cache: z6.boolean(),
1646
+ temperature: z6.number(),
1647
+ maxOutputTokens: z6.number(),
1648
+ topP: z6.number(),
1649
+ topK: z6.number()
1577
1650
  }).partial().passthrough(),
1578
- z5.object({
1579
- use_cache: z5.boolean(),
1580
- temperature: z5.number(),
1581
- topK: z5.number()
1651
+ z6.object({
1652
+ use_cache: z6.boolean(),
1653
+ temperature: z6.number(),
1654
+ topK: z6.number()
1582
1655
  }).partial().passthrough(),
1583
- z5.object({ use_cache: z5.boolean() }).partial().passthrough()
1656
+ z6.object({ use_cache: z6.boolean() }).partial().passthrough()
1584
1657
  ]);
1585
- var PromptOptionsNullish = z5.union([
1586
- z5.object({ model: z5.string(), params: ModelParams, position: z5.string() }).partial(),
1587
- z5.null()
1658
+ var PromptOptionsNullish = z6.union([
1659
+ z6.object({ model: z6.string(), params: ModelParams, position: z6.string() }).partial(),
1660
+ z6.null()
1588
1661
  ]);
1589
- var PromptParserNullish = z5.union([
1590
- z5.object({
1591
- type: z5.literal("llm_classifier"),
1592
- use_cot: z5.boolean(),
1593
- choice_scores: z5.record(z5.number().gte(0).lte(1))
1662
+ var PromptParserNullish = z6.union([
1663
+ z6.object({
1664
+ type: z6.literal("llm_classifier"),
1665
+ use_cot: z6.boolean(),
1666
+ choice_scores: z6.record(z6.number().gte(0).lte(1))
1594
1667
  }),
1595
- z5.null()
1668
+ z6.null()
1596
1669
  ]);
1597
- var SavedFunctionId = z5.union([
1598
- z5.object({ type: z5.literal("function"), id: z5.string() }),
1599
- z5.object({ type: z5.literal("global"), name: z5.string() })
1670
+ var SavedFunctionId = z6.union([
1671
+ z6.object({ type: z6.literal("function"), id: z6.string() }),
1672
+ z6.object({ type: z6.literal("global"), name: z6.string() })
1600
1673
  ]);
1601
- var PromptDataNullish = z5.union([
1602
- z5.object({
1674
+ var PromptDataNullish = z6.union([
1675
+ z6.object({
1603
1676
  prompt: PromptBlockDataNullish,
1604
1677
  options: PromptOptionsNullish,
1605
1678
  parser: PromptParserNullish,
1606
- tool_functions: z5.union([z5.array(SavedFunctionId), z5.null()]),
1607
- origin: z5.union([
1608
- z5.object({
1609
- prompt_id: z5.string(),
1610
- project_id: z5.string(),
1611
- prompt_version: z5.string()
1679
+ tool_functions: z6.union([z6.array(SavedFunctionId), z6.null()]),
1680
+ origin: z6.union([
1681
+ z6.object({
1682
+ prompt_id: z6.string(),
1683
+ project_id: z6.string(),
1684
+ prompt_version: z6.string()
1612
1685
  }).partial(),
1613
- z5.null()
1686
+ z6.null()
1614
1687
  ])
1615
1688
  }).partial(),
1616
- z5.null()
1689
+ z6.null()
1617
1690
  ]);
1618
- var FunctionTypeEnumNullish = z5.union([
1619
- z5.enum(["llm", "scorer", "task", "tool"]),
1620
- z5.null()
1691
+ var FunctionTypeEnumNullish = z6.union([
1692
+ z6.enum(["llm", "scorer", "task", "tool"]),
1693
+ z6.null()
1621
1694
  ]);
1622
- var FunctionIdRef = z5.object({}).partial().passthrough();
1623
- var PromptBlockData = z5.union([
1624
- z5.object({ type: z5.literal("completion"), content: z5.string() }),
1625
- z5.object({
1626
- type: z5.literal("chat"),
1627
- messages: z5.array(ChatCompletionMessageParam),
1628
- tools: z5.string().optional()
1695
+ var FunctionIdRef = z6.object({}).partial().passthrough();
1696
+ var PromptBlockData = z6.union([
1697
+ z6.object({ type: z6.literal("completion"), content: z6.string() }),
1698
+ z6.object({
1699
+ type: z6.literal("chat"),
1700
+ messages: z6.array(ChatCompletionMessageParam),
1701
+ tools: z6.string().optional()
1629
1702
  })
1630
1703
  ]);
1631
- var GraphNode = z5.union([
1632
- z5.object({
1633
- description: z5.union([z5.string(), z5.null()]).optional(),
1634
- position: z5.union([z5.object({ x: z5.number(), y: z5.number() }), z5.null()]).optional(),
1635
- type: z5.literal("function"),
1704
+ var GraphNode = z6.union([
1705
+ z6.object({
1706
+ description: z6.union([z6.string(), z6.null()]).optional(),
1707
+ position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
1708
+ type: z6.literal("function"),
1636
1709
  function: FunctionIdRef
1637
1710
  }),
1638
- z5.object({
1639
- description: z5.union([z5.string(), z5.null()]).optional(),
1640
- position: z5.union([z5.object({ x: z5.number(), y: z5.number() }), z5.null()]).optional(),
1641
- type: z5.literal("input")
1711
+ z6.object({
1712
+ description: z6.union([z6.string(), z6.null()]).optional(),
1713
+ position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
1714
+ type: z6.literal("input")
1642
1715
  }),
1643
- z5.object({
1644
- description: z5.union([z5.string(), z5.null()]).optional(),
1645
- position: z5.union([z5.object({ x: z5.number(), y: z5.number() }), z5.null()]).optional(),
1646
- type: z5.literal("output")
1716
+ z6.object({
1717
+ description: z6.union([z6.string(), z6.null()]).optional(),
1718
+ position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
1719
+ type: z6.literal("output")
1647
1720
  }),
1648
- z5.object({
1649
- description: z5.union([z5.string(), z5.null()]).optional(),
1650
- position: z5.union([z5.object({ x: z5.number(), y: z5.number() }), z5.null()]).optional(),
1651
- type: z5.literal("literal"),
1652
- value: z5.unknown().optional()
1721
+ z6.object({
1722
+ description: z6.union([z6.string(), z6.null()]).optional(),
1723
+ position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
1724
+ type: z6.literal("literal"),
1725
+ value: z6.unknown().optional()
1653
1726
  }),
1654
- z5.object({
1655
- description: z5.union([z5.string(), z5.null()]).optional(),
1656
- position: z5.union([z5.object({ x: z5.number(), y: z5.number() }), z5.null()]).optional(),
1657
- type: z5.literal("btql"),
1658
- expr: z5.string()
1727
+ z6.object({
1728
+ description: z6.union([z6.string(), z6.null()]).optional(),
1729
+ position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
1730
+ type: z6.literal("btql"),
1731
+ expr: z6.string()
1659
1732
  }),
1660
- z5.object({
1661
- description: z5.union([z5.string(), z5.null()]).optional(),
1662
- position: z5.union([z5.object({ x: z5.number(), y: z5.number() }), z5.null()]).optional(),
1663
- type: z5.literal("gate"),
1664
- condition: z5.union([z5.string(), z5.null()]).optional()
1733
+ z6.object({
1734
+ description: z6.union([z6.string(), z6.null()]).optional(),
1735
+ position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
1736
+ type: z6.literal("gate"),
1737
+ condition: z6.union([z6.string(), z6.null()]).optional()
1665
1738
  }),
1666
- z5.object({
1667
- description: z5.union([z5.string(), z5.null()]).optional(),
1668
- position: z5.union([z5.object({ x: z5.number(), y: z5.number() }), z5.null()]).optional(),
1669
- type: z5.literal("aggregator")
1739
+ z6.object({
1740
+ description: z6.union([z6.string(), z6.null()]).optional(),
1741
+ position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
1742
+ type: z6.literal("aggregator")
1670
1743
  }),
1671
- z5.object({
1672
- description: z5.union([z5.string(), z5.null()]).optional(),
1673
- position: z5.union([z5.object({ x: z5.number(), y: z5.number() }), z5.null()]).optional(),
1674
- type: z5.literal("prompt_template"),
1744
+ z6.object({
1745
+ description: z6.union([z6.string(), z6.null()]).optional(),
1746
+ position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
1747
+ type: z6.literal("prompt_template"),
1675
1748
  prompt: PromptBlockData
1676
1749
  })
1677
1750
  ]);
1678
- var GraphEdge = z5.object({
1679
- source: z5.object({ node: z5.string().max(1024), variable: z5.string() }),
1680
- target: z5.object({ node: z5.string().max(1024), variable: z5.string() }),
1681
- purpose: z5.enum(["control", "data", "messages"])
1751
+ var GraphEdge = z6.object({
1752
+ source: z6.object({ node: z6.string().max(1024), variable: z6.string() }),
1753
+ target: z6.object({ node: z6.string().max(1024), variable: z6.string() }),
1754
+ purpose: z6.enum(["control", "data", "messages"])
1682
1755
  });
1683
- var GraphData = z5.object({
1684
- type: z5.literal("graph"),
1685
- nodes: z5.record(GraphNode),
1686
- edges: z5.record(GraphEdge)
1756
+ var GraphData = z6.object({
1757
+ type: z6.literal("graph"),
1758
+ nodes: z6.record(GraphNode),
1759
+ edges: z6.record(GraphEdge)
1687
1760
  });
1688
- var FunctionData = z5.union([
1689
- z5.object({ type: z5.literal("prompt") }),
1690
- z5.object({
1691
- type: z5.literal("code"),
1692
- data: z5.union([
1693
- z5.object({ type: z5.literal("bundle") }).and(CodeBundle),
1694
- z5.object({
1695
- type: z5.literal("inline"),
1696
- runtime_context: z5.object({
1697
- runtime: z5.enum(["node", "python"]),
1698
- version: z5.string()
1761
+ var FunctionData = z6.union([
1762
+ z6.object({ type: z6.literal("prompt") }),
1763
+ z6.object({
1764
+ type: z6.literal("code"),
1765
+ data: z6.union([
1766
+ z6.object({ type: z6.literal("bundle") }).and(CodeBundle),
1767
+ z6.object({
1768
+ type: z6.literal("inline"),
1769
+ runtime_context: z6.object({
1770
+ runtime: z6.enum(["node", "python"]),
1771
+ version: z6.string()
1699
1772
  }),
1700
- code: z5.string()
1773
+ code: z6.string()
1701
1774
  })
1702
1775
  ])
1703
1776
  }),
1704
1777
  GraphData,
1705
- z5.object({
1706
- type: z5.literal("remote_eval"),
1707
- endpoint: z5.string(),
1708
- eval_name: z5.string(),
1709
- parameters: z5.object({}).partial().passthrough()
1778
+ z6.object({
1779
+ type: z6.literal("remote_eval"),
1780
+ endpoint: z6.string(),
1781
+ eval_name: z6.string(),
1782
+ parameters: z6.object({}).partial().passthrough()
1710
1783
  }),
1711
- z5.object({ type: z5.literal("global"), name: z5.string() })
1784
+ z6.object({ type: z6.literal("global"), name: z6.string() })
1712
1785
  ]);
1713
- var Function = z5.object({
1714
- id: z5.string().uuid(),
1715
- _xact_id: z5.string(),
1716
- project_id: z5.string().uuid(),
1717
- log_id: z5.literal("p"),
1718
- org_id: z5.string().uuid(),
1719
- name: z5.string(),
1720
- slug: z5.string(),
1721
- description: z5.union([z5.string(), z5.null()]).optional(),
1722
- created: z5.union([z5.string(), z5.null()]).optional(),
1786
+ var Function = z6.object({
1787
+ id: z6.string().uuid(),
1788
+ _xact_id: z6.string(),
1789
+ project_id: z6.string().uuid(),
1790
+ log_id: z6.literal("p"),
1791
+ org_id: z6.string().uuid(),
1792
+ name: z6.string(),
1793
+ slug: z6.string(),
1794
+ description: z6.union([z6.string(), z6.null()]).optional(),
1795
+ created: z6.union([z6.string(), z6.null()]).optional(),
1723
1796
  prompt_data: PromptDataNullish.optional(),
1724
- tags: z5.union([z5.array(z5.string()), z5.null()]).optional(),
1725
- metadata: z5.union([z5.object({}).partial().passthrough(), z5.null()]).optional(),
1797
+ tags: z6.union([z6.array(z6.string()), z6.null()]).optional(),
1798
+ metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional(),
1726
1799
  function_type: FunctionTypeEnumNullish.optional(),
1727
1800
  function_data: FunctionData,
1728
- origin: z5.union([
1729
- z5.object({
1730
- object_type: AclObjectType.and(z5.string()),
1731
- object_id: z5.string().uuid(),
1732
- internal: z5.union([z5.boolean(), z5.null()]).optional()
1801
+ origin: z6.union([
1802
+ z6.object({
1803
+ object_type: AclObjectType.and(z6.string()),
1804
+ object_id: z6.string().uuid(),
1805
+ internal: z6.union([z6.boolean(), z6.null()]).optional()
1733
1806
  }),
1734
- z5.null()
1807
+ z6.null()
1735
1808
  ]).optional(),
1736
- function_schema: z5.union([
1737
- z5.object({ parameters: z5.unknown(), returns: z5.unknown() }).partial(),
1738
- z5.null()
1809
+ function_schema: z6.union([
1810
+ z6.object({ parameters: z6.unknown(), returns: z6.unknown() }).partial(),
1811
+ z6.null()
1739
1812
  ]).optional()
1740
1813
  });
1741
- var FunctionFormat = z5.enum(["llm", "code", "global", "graph"]);
1742
- var PromptData = z5.object({
1814
+ var FunctionFormat = z6.enum(["llm", "code", "global", "graph"]);
1815
+ var PromptData = z6.object({
1743
1816
  prompt: PromptBlockDataNullish,
1744
1817
  options: PromptOptionsNullish,
1745
1818
  parser: PromptParserNullish,
1746
- tool_functions: z5.union([z5.array(SavedFunctionId), z5.null()]),
1747
- origin: z5.union([
1748
- z5.object({
1749
- prompt_id: z5.string(),
1750
- project_id: z5.string(),
1751
- prompt_version: z5.string()
1819
+ tool_functions: z6.union([z6.array(SavedFunctionId), z6.null()]),
1820
+ origin: z6.union([
1821
+ z6.object({
1822
+ prompt_id: z6.string(),
1823
+ project_id: z6.string(),
1824
+ prompt_version: z6.string()
1752
1825
  }).partial(),
1753
- z5.null()
1826
+ z6.null()
1754
1827
  ])
1755
1828
  }).partial();
1756
- var FunctionTypeEnum = z5.enum(["llm", "scorer", "task", "tool"]);
1757
- var FunctionId = z5.union([
1758
- z5.object({ function_id: z5.string(), version: z5.string().optional() }),
1759
- z5.object({
1760
- project_name: z5.string(),
1761
- slug: z5.string(),
1762
- version: z5.string().optional()
1829
+ var FunctionTypeEnum = z6.enum(["llm", "scorer", "task", "tool"]);
1830
+ var FunctionId = z6.union([
1831
+ z6.object({ function_id: z6.string(), version: z6.string().optional() }),
1832
+ z6.object({
1833
+ project_name: z6.string(),
1834
+ slug: z6.string(),
1835
+ version: z6.string().optional()
1763
1836
  }),
1764
- z5.object({ global_function: z5.string() }),
1765
- z5.object({
1766
- prompt_session_id: z5.string(),
1767
- prompt_session_function_id: z5.string(),
1768
- version: z5.string().optional()
1837
+ z6.object({ global_function: z6.string() }),
1838
+ z6.object({
1839
+ prompt_session_id: z6.string(),
1840
+ prompt_session_function_id: z6.string(),
1841
+ version: z6.string().optional()
1769
1842
  }),
1770
- z5.object({
1771
- inline_context: z5.object({
1772
- runtime: z5.enum(["node", "python"]),
1773
- version: z5.string()
1843
+ z6.object({
1844
+ inline_context: z6.object({
1845
+ runtime: z6.enum(["node", "python"]),
1846
+ version: z6.string()
1774
1847
  }),
1775
- code: z5.string(),
1776
- name: z5.union([z5.string(), z5.null()]).optional()
1848
+ code: z6.string(),
1849
+ name: z6.union([z6.string(), z6.null()]).optional()
1777
1850
  }),
1778
- z5.object({
1851
+ z6.object({
1779
1852
  inline_prompt: PromptData.optional(),
1780
- inline_function: z5.object({}).partial().passthrough(),
1853
+ inline_function: z6.object({}).partial().passthrough(),
1781
1854
  function_type: FunctionTypeEnum.optional(),
1782
- name: z5.union([z5.string(), z5.null()]).optional()
1855
+ name: z6.union([z6.string(), z6.null()]).optional()
1783
1856
  }),
1784
- z5.object({
1857
+ z6.object({
1785
1858
  inline_prompt: PromptData,
1786
1859
  function_type: FunctionTypeEnum.optional(),
1787
- name: z5.union([z5.string(), z5.null()]).optional()
1860
+ name: z6.union([z6.string(), z6.null()]).optional()
1788
1861
  })
1789
1862
  ]);
1790
- var FunctionObjectType = z5.enum([
1863
+ var FunctionObjectType = z6.enum([
1791
1864
  "prompt",
1792
1865
  "tool",
1793
1866
  "scorer",
1794
1867
  "task",
1795
1868
  "agent"
1796
1869
  ]);
1797
- var FunctionOutputType = z5.enum(["completion", "score", "any"]);
1798
- var GitMetadataSettings = z5.object({
1799
- collect: z5.enum(["all", "none", "some"]),
1800
- fields: z5.array(
1801
- z5.enum([
1870
+ var FunctionOutputType = z6.enum(["completion", "score", "any"]);
1871
+ var GitMetadataSettings = z6.object({
1872
+ collect: z6.enum(["all", "none", "some"]),
1873
+ fields: z6.array(
1874
+ z6.enum([
1802
1875
  "commit",
1803
1876
  "branch",
1804
1877
  "tag",
@@ -1811,49 +1884,49 @@ var GitMetadataSettings = z5.object({
1811
1884
  ])
1812
1885
  ).optional()
1813
1886
  });
1814
- var Group = z5.object({
1815
- id: z5.string().uuid(),
1816
- org_id: z5.string().uuid(),
1817
- user_id: z5.union([z5.string(), z5.null()]).optional(),
1818
- created: z5.union([z5.string(), z5.null()]).optional(),
1819
- name: z5.string(),
1820
- description: z5.union([z5.string(), z5.null()]).optional(),
1821
- deleted_at: z5.union([z5.string(), z5.null()]).optional(),
1822
- member_users: z5.union([z5.array(z5.string().uuid()), z5.null()]).optional(),
1823
- member_groups: z5.union([z5.array(z5.string().uuid()), z5.null()]).optional()
1887
+ var Group = z6.object({
1888
+ id: z6.string().uuid(),
1889
+ org_id: z6.string().uuid(),
1890
+ user_id: z6.union([z6.string(), z6.null()]).optional(),
1891
+ created: z6.union([z6.string(), z6.null()]).optional(),
1892
+ name: z6.string(),
1893
+ description: z6.union([z6.string(), z6.null()]).optional(),
1894
+ deleted_at: z6.union([z6.string(), z6.null()]).optional(),
1895
+ member_users: z6.union([z6.array(z6.string().uuid()), z6.null()]).optional(),
1896
+ member_groups: z6.union([z6.array(z6.string().uuid()), z6.null()]).optional()
1824
1897
  });
1825
- var IfExists = z5.enum(["error", "ignore", "replace"]);
1826
- var InvokeParent = z5.union([
1827
- z5.object({
1828
- object_type: z5.enum(["project_logs", "experiment", "playground_logs"]),
1829
- object_id: z5.string(),
1830
- row_ids: z5.union([
1831
- z5.object({
1832
- id: z5.string(),
1833
- span_id: z5.string(),
1834
- root_span_id: z5.string()
1898
+ var IfExists = z6.enum(["error", "ignore", "replace"]);
1899
+ var InvokeParent = z6.union([
1900
+ z6.object({
1901
+ object_type: z6.enum(["project_logs", "experiment", "playground_logs"]),
1902
+ object_id: z6.string(),
1903
+ row_ids: z6.union([
1904
+ z6.object({
1905
+ id: z6.string(),
1906
+ span_id: z6.string(),
1907
+ root_span_id: z6.string()
1835
1908
  }),
1836
- z5.null()
1909
+ z6.null()
1837
1910
  ]).optional(),
1838
- propagated_event: z5.union([z5.object({}).partial().passthrough(), z5.null()]).optional()
1911
+ propagated_event: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional()
1839
1912
  }),
1840
- z5.string()
1913
+ z6.string()
1841
1914
  ]);
1842
- var StreamingMode = z5.union([z5.enum(["auto", "parallel"]), z5.null()]);
1915
+ var StreamingMode = z6.union([z6.enum(["auto", "parallel"]), z6.null()]);
1843
1916
  var InvokeFunction = FunctionId.and(
1844
- z5.object({
1845
- input: z5.unknown(),
1846
- expected: z5.unknown(),
1847
- metadata: z5.union([z5.object({}).partial().passthrough(), z5.null()]),
1848
- tags: z5.union([z5.array(z5.string()), z5.null()]),
1849
- messages: z5.array(ChatCompletionMessageParam),
1917
+ z6.object({
1918
+ input: z6.unknown(),
1919
+ expected: z6.unknown(),
1920
+ metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]),
1921
+ tags: z6.union([z6.array(z6.string()), z6.null()]),
1922
+ messages: z6.array(ChatCompletionMessageParam),
1850
1923
  parent: InvokeParent,
1851
- stream: z5.union([z5.boolean(), z5.null()]),
1924
+ stream: z6.union([z6.boolean(), z6.null()]),
1852
1925
  mode: StreamingMode,
1853
- strict: z5.union([z5.boolean(), z5.null()])
1926
+ strict: z6.union([z6.boolean(), z6.null()])
1854
1927
  }).partial()
1855
1928
  );
1856
- var MessageRole = z5.enum([
1929
+ var MessageRole = z6.enum([
1857
1930
  "system",
1858
1931
  "user",
1859
1932
  "assistant",
@@ -1862,8 +1935,8 @@ var MessageRole = z5.enum([
1862
1935
  "model",
1863
1936
  "developer"
1864
1937
  ]);
1865
- var ObjectReference = z5.object({
1866
- object_type: z5.enum([
1938
+ var ObjectReference = z6.object({
1939
+ object_type: z6.enum([
1867
1940
  "project_logs",
1868
1941
  "experiment",
1869
1942
  "dataset",
@@ -1871,146 +1944,146 @@ var ObjectReference = z5.object({
1871
1944
  "function",
1872
1945
  "prompt_session"
1873
1946
  ]),
1874
- object_id: z5.string().uuid(),
1875
- id: z5.string(),
1876
- _xact_id: z5.union([z5.string(), z5.null()]).optional(),
1877
- created: z5.union([z5.string(), z5.null()]).optional()
1947
+ object_id: z6.string().uuid(),
1948
+ id: z6.string(),
1949
+ _xact_id: z6.union([z6.string(), z6.null()]).optional(),
1950
+ created: z6.union([z6.string(), z6.null()]).optional()
1878
1951
  });
1879
- var OnlineScoreConfig = z5.union([
1880
- z5.object({
1881
- sampling_rate: z5.number().gte(0).lte(1),
1882
- scorers: z5.array(SavedFunctionId),
1883
- btql_filter: z5.union([z5.string(), z5.null()]).optional(),
1884
- apply_to_root_span: z5.union([z5.boolean(), z5.null()]).optional(),
1885
- apply_to_span_names: z5.union([z5.array(z5.string()), z5.null()]).optional(),
1886
- skip_logging: z5.union([z5.boolean(), z5.null()]).optional()
1952
+ var OnlineScoreConfig = z6.union([
1953
+ z6.object({
1954
+ sampling_rate: z6.number().gte(0).lte(1),
1955
+ scorers: z6.array(SavedFunctionId),
1956
+ btql_filter: z6.union([z6.string(), z6.null()]).optional(),
1957
+ apply_to_root_span: z6.union([z6.boolean(), z6.null()]).optional(),
1958
+ apply_to_span_names: z6.union([z6.array(z6.string()), z6.null()]).optional(),
1959
+ skip_logging: z6.union([z6.boolean(), z6.null()]).optional()
1887
1960
  }),
1888
- z5.null()
1961
+ z6.null()
1889
1962
  ]);
1890
- var Organization = z5.object({
1891
- id: z5.string().uuid(),
1892
- name: z5.string(),
1893
- api_url: z5.union([z5.string(), z5.null()]).optional(),
1894
- is_universal_api: z5.union([z5.boolean(), z5.null()]).optional(),
1895
- proxy_url: z5.union([z5.string(), z5.null()]).optional(),
1896
- realtime_url: z5.union([z5.string(), z5.null()]).optional(),
1897
- created: z5.union([z5.string(), z5.null()]).optional()
1963
+ var Organization = z6.object({
1964
+ id: z6.string().uuid(),
1965
+ name: z6.string(),
1966
+ api_url: z6.union([z6.string(), z6.null()]).optional(),
1967
+ is_universal_api: z6.union([z6.boolean(), z6.null()]).optional(),
1968
+ proxy_url: z6.union([z6.string(), z6.null()]).optional(),
1969
+ realtime_url: z6.union([z6.string(), z6.null()]).optional(),
1970
+ created: z6.union([z6.string(), z6.null()]).optional()
1898
1971
  });
1899
- var ProjectSettings = z5.union([
1900
- z5.object({
1901
- comparison_key: z5.union([z5.string(), z5.null()]),
1902
- baseline_experiment_id: z5.union([z5.string(), z5.null()]),
1903
- spanFieldOrder: z5.union([
1904
- z5.array(
1905
- z5.object({
1906
- object_type: z5.string(),
1907
- column_id: z5.string(),
1908
- position: z5.string(),
1909
- layout: z5.union([z5.literal("full"), z5.literal("two_column"), z5.null()]).optional()
1972
+ var ProjectSettings = z6.union([
1973
+ z6.object({
1974
+ comparison_key: z6.union([z6.string(), z6.null()]),
1975
+ baseline_experiment_id: z6.union([z6.string(), z6.null()]),
1976
+ spanFieldOrder: z6.union([
1977
+ z6.array(
1978
+ z6.object({
1979
+ object_type: z6.string(),
1980
+ column_id: z6.string(),
1981
+ position: z6.string(),
1982
+ layout: z6.union([z6.literal("full"), z6.literal("two_column"), z6.null()]).optional()
1910
1983
  })
1911
1984
  ),
1912
- z5.null()
1985
+ z6.null()
1913
1986
  ]),
1914
- remote_eval_sources: z5.union([
1915
- z5.array(
1916
- z5.object({
1917
- url: z5.string(),
1918
- name: z5.string(),
1919
- description: z5.union([z5.string(), z5.null()]).optional()
1987
+ remote_eval_sources: z6.union([
1988
+ z6.array(
1989
+ z6.object({
1990
+ url: z6.string(),
1991
+ name: z6.string(),
1992
+ description: z6.union([z6.string(), z6.null()]).optional()
1920
1993
  })
1921
1994
  ),
1922
- z5.null()
1995
+ z6.null()
1923
1996
  ])
1924
1997
  }).partial(),
1925
- z5.null()
1998
+ z6.null()
1926
1999
  ]);
1927
- var Project = z5.object({
1928
- id: z5.string().uuid(),
1929
- org_id: z5.string().uuid(),
1930
- name: z5.string(),
1931
- created: z5.union([z5.string(), z5.null()]).optional(),
1932
- deleted_at: z5.union([z5.string(), z5.null()]).optional(),
1933
- user_id: z5.union([z5.string(), z5.null()]).optional(),
2000
+ var Project = z6.object({
2001
+ id: z6.string().uuid(),
2002
+ org_id: z6.string().uuid(),
2003
+ name: z6.string(),
2004
+ created: z6.union([z6.string(), z6.null()]).optional(),
2005
+ deleted_at: z6.union([z6.string(), z6.null()]).optional(),
2006
+ user_id: z6.union([z6.string(), z6.null()]).optional(),
1934
2007
  settings: ProjectSettings.optional()
1935
2008
  });
1936
- var RetentionObjectType = z5.enum([
2009
+ var RetentionObjectType = z6.enum([
1937
2010
  "project_logs",
1938
2011
  "experiment",
1939
2012
  "dataset"
1940
2013
  ]);
1941
- var ProjectAutomation = z5.object({
1942
- id: z5.string().uuid(),
1943
- project_id: z5.string().uuid(),
1944
- user_id: z5.union([z5.string(), z5.null()]).optional(),
1945
- created: z5.union([z5.string(), z5.null()]).optional(),
1946
- name: z5.string(),
1947
- description: z5.union([z5.string(), z5.null()]).optional(),
1948
- config: z5.union([
1949
- z5.object({
1950
- event_type: z5.literal("logs"),
1951
- btql_filter: z5.string(),
1952
- interval_seconds: z5.number().gte(1).lte(2592e3),
1953
- action: z5.object({ type: z5.literal("webhook"), url: z5.string() })
2014
+ var ProjectAutomation = z6.object({
2015
+ id: z6.string().uuid(),
2016
+ project_id: z6.string().uuid(),
2017
+ user_id: z6.union([z6.string(), z6.null()]).optional(),
2018
+ created: z6.union([z6.string(), z6.null()]).optional(),
2019
+ name: z6.string(),
2020
+ description: z6.union([z6.string(), z6.null()]).optional(),
2021
+ config: z6.union([
2022
+ z6.object({
2023
+ event_type: z6.literal("logs"),
2024
+ btql_filter: z6.string(),
2025
+ interval_seconds: z6.number().gte(1).lte(2592e3),
2026
+ action: z6.object({ type: z6.literal("webhook"), url: z6.string() })
1954
2027
  }),
1955
- z5.object({
1956
- event_type: z5.literal("btql_export"),
1957
- export_definition: z5.union([
1958
- z5.object({ type: z5.literal("log_traces") }),
1959
- z5.object({ type: z5.literal("log_spans") }),
1960
- z5.object({ type: z5.literal("btql_query"), btql_query: z5.string() })
2028
+ z6.object({
2029
+ event_type: z6.literal("btql_export"),
2030
+ export_definition: z6.union([
2031
+ z6.object({ type: z6.literal("log_traces") }),
2032
+ z6.object({ type: z6.literal("log_spans") }),
2033
+ z6.object({ type: z6.literal("btql_query"), btql_query: z6.string() })
1961
2034
  ]),
1962
- export_path: z5.string(),
1963
- format: z5.enum(["jsonl", "parquet"]),
1964
- interval_seconds: z5.number().gte(1).lte(2592e3),
1965
- credentials: z5.object({
1966
- type: z5.literal("aws_iam"),
1967
- role_arn: z5.string(),
1968
- external_id: z5.string()
2035
+ export_path: z6.string(),
2036
+ format: z6.enum(["jsonl", "parquet"]),
2037
+ interval_seconds: z6.number().gte(1).lte(2592e3),
2038
+ credentials: z6.object({
2039
+ type: z6.literal("aws_iam"),
2040
+ role_arn: z6.string(),
2041
+ external_id: z6.string()
1969
2042
  }),
1970
- batch_size: z5.union([z5.number(), z5.null()]).optional()
2043
+ batch_size: z6.union([z6.number(), z6.null()]).optional()
1971
2044
  }),
1972
- z5.object({
1973
- event_type: z5.literal("retention"),
2045
+ z6.object({
2046
+ event_type: z6.literal("retention"),
1974
2047
  object_type: RetentionObjectType,
1975
- retention_days: z5.number().gte(0)
2048
+ retention_days: z6.number().gte(0)
1976
2049
  })
1977
2050
  ])
1978
2051
  });
1979
- var ProjectLogsEvent = z5.object({
1980
- id: z5.string(),
1981
- _xact_id: z5.string(),
1982
- _pagination_key: z5.union([z5.string(), z5.null()]).optional(),
1983
- created: z5.string().datetime({ offset: true }),
1984
- org_id: z5.string().uuid(),
1985
- project_id: z5.string().uuid(),
1986
- log_id: z5.literal("g"),
1987
- input: z5.unknown().optional(),
1988
- output: z5.unknown().optional(),
1989
- expected: z5.unknown().optional(),
1990
- error: z5.unknown().optional(),
1991
- scores: z5.union([z5.record(z5.union([z5.number(), z5.null()])), z5.null()]).optional(),
1992
- metadata: z5.union([
1993
- z5.object({ model: z5.union([z5.string(), z5.null()]) }).partial().passthrough(),
1994
- z5.null()
2052
+ var ProjectLogsEvent = z6.object({
2053
+ id: z6.string(),
2054
+ _xact_id: z6.string(),
2055
+ _pagination_key: z6.union([z6.string(), z6.null()]).optional(),
2056
+ created: z6.string().datetime({ offset: true }),
2057
+ org_id: z6.string().uuid(),
2058
+ project_id: z6.string().uuid(),
2059
+ log_id: z6.literal("g"),
2060
+ input: z6.unknown().optional(),
2061
+ output: z6.unknown().optional(),
2062
+ expected: z6.unknown().optional(),
2063
+ error: z6.unknown().optional(),
2064
+ scores: z6.union([z6.record(z6.union([z6.number(), z6.null()])), z6.null()]).optional(),
2065
+ metadata: z6.union([
2066
+ z6.object({ model: z6.union([z6.string(), z6.null()]) }).partial().passthrough(),
2067
+ z6.null()
1995
2068
  ]).optional(),
1996
- tags: z5.union([z5.array(z5.string()), z5.null()]).optional(),
1997
- metrics: z5.union([z5.record(z5.number()), z5.null()]).optional(),
1998
- context: z5.union([
1999
- z5.object({
2000
- caller_functionname: z5.union([z5.string(), z5.null()]),
2001
- caller_filename: z5.union([z5.string(), z5.null()]),
2002
- caller_lineno: z5.union([z5.number(), z5.null()])
2069
+ tags: z6.union([z6.array(z6.string()), z6.null()]).optional(),
2070
+ metrics: z6.union([z6.record(z6.number()), z6.null()]).optional(),
2071
+ context: z6.union([
2072
+ z6.object({
2073
+ caller_functionname: z6.union([z6.string(), z6.null()]),
2074
+ caller_filename: z6.union([z6.string(), z6.null()]),
2075
+ caller_lineno: z6.union([z6.number(), z6.null()])
2003
2076
  }).partial().passthrough(),
2004
- z5.null()
2077
+ z6.null()
2005
2078
  ]).optional(),
2006
- span_id: z5.string(),
2007
- span_parents: z5.union([z5.array(z5.string()), z5.null()]).optional(),
2008
- root_span_id: z5.string(),
2009
- is_root: z5.union([z5.boolean(), z5.null()]).optional(),
2079
+ span_id: z6.string(),
2080
+ span_parents: z6.union([z6.array(z6.string()), z6.null()]).optional(),
2081
+ root_span_id: z6.string(),
2082
+ is_root: z6.union([z6.boolean(), z6.null()]).optional(),
2010
2083
  span_attributes: SpanAttributes.optional(),
2011
2084
  origin: ObjectReferenceNullish.optional()
2012
2085
  });
2013
- var ProjectScoreType = z5.enum([
2086
+ var ProjectScoreType = z6.enum([
2014
2087
  "slider",
2015
2088
  "categorical",
2016
2089
  "weighted",
@@ -2019,172 +2092,172 @@ var ProjectScoreType = z5.enum([
2019
2092
  "online",
2020
2093
  "free-form"
2021
2094
  ]);
2022
- var ProjectScoreCategory = z5.object({
2023
- name: z5.string(),
2024
- value: z5.number()
2095
+ var ProjectScoreCategory = z6.object({
2096
+ name: z6.string(),
2097
+ value: z6.number()
2025
2098
  });
2026
- var ProjectScoreCategories = z5.union([
2027
- z5.array(ProjectScoreCategory),
2028
- z5.record(z5.number()),
2029
- z5.array(z5.string()),
2030
- z5.null()
2099
+ var ProjectScoreCategories = z6.union([
2100
+ z6.array(ProjectScoreCategory),
2101
+ z6.record(z6.number()),
2102
+ z6.array(z6.string()),
2103
+ z6.null()
2031
2104
  ]);
2032
- var ProjectScoreConfig = z5.union([
2033
- z5.object({
2034
- multi_select: z5.union([z5.boolean(), z5.null()]),
2035
- destination: z5.union([z5.string(), z5.null()]),
2105
+ var ProjectScoreConfig = z6.union([
2106
+ z6.object({
2107
+ multi_select: z6.union([z6.boolean(), z6.null()]),
2108
+ destination: z6.union([z6.string(), z6.null()]),
2036
2109
  online: OnlineScoreConfig
2037
2110
  }).partial(),
2038
- z5.null()
2111
+ z6.null()
2039
2112
  ]);
2040
- var ProjectScore = z5.object({
2041
- id: z5.string().uuid(),
2042
- project_id: z5.string().uuid(),
2043
- user_id: z5.string().uuid(),
2044
- created: z5.union([z5.string(), z5.null()]).optional(),
2045
- name: z5.string(),
2046
- description: z5.union([z5.string(), z5.null()]).optional(),
2113
+ var ProjectScore = z6.object({
2114
+ id: z6.string().uuid(),
2115
+ project_id: z6.string().uuid(),
2116
+ user_id: z6.string().uuid(),
2117
+ created: z6.union([z6.string(), z6.null()]).optional(),
2118
+ name: z6.string(),
2119
+ description: z6.union([z6.string(), z6.null()]).optional(),
2047
2120
  score_type: ProjectScoreType,
2048
2121
  categories: ProjectScoreCategories.optional(),
2049
2122
  config: ProjectScoreConfig.optional(),
2050
- position: z5.union([z5.string(), z5.null()]).optional()
2123
+ position: z6.union([z6.string(), z6.null()]).optional()
2051
2124
  });
2052
- var ProjectTag = z5.object({
2053
- id: z5.string().uuid(),
2054
- project_id: z5.string().uuid(),
2055
- user_id: z5.string().uuid(),
2056
- created: z5.union([z5.string(), z5.null()]).optional(),
2057
- name: z5.string(),
2058
- description: z5.union([z5.string(), z5.null()]).optional(),
2059
- color: z5.union([z5.string(), z5.null()]).optional(),
2060
- position: z5.union([z5.string(), z5.null()]).optional()
2125
+ var ProjectTag = z6.object({
2126
+ id: z6.string().uuid(),
2127
+ project_id: z6.string().uuid(),
2128
+ user_id: z6.string().uuid(),
2129
+ created: z6.union([z6.string(), z6.null()]).optional(),
2130
+ name: z6.string(),
2131
+ description: z6.union([z6.string(), z6.null()]).optional(),
2132
+ color: z6.union([z6.string(), z6.null()]).optional(),
2133
+ position: z6.union([z6.string(), z6.null()]).optional()
2061
2134
  });
2062
- var Prompt = z5.object({
2063
- id: z5.string().uuid(),
2064
- _xact_id: z5.string(),
2065
- project_id: z5.string().uuid(),
2066
- log_id: z5.literal("p"),
2067
- org_id: z5.string().uuid(),
2068
- name: z5.string(),
2069
- slug: z5.string(),
2070
- description: z5.union([z5.string(), z5.null()]).optional(),
2071
- created: z5.union([z5.string(), z5.null()]).optional(),
2135
+ var Prompt = z6.object({
2136
+ id: z6.string().uuid(),
2137
+ _xact_id: z6.string(),
2138
+ project_id: z6.string().uuid(),
2139
+ log_id: z6.literal("p"),
2140
+ org_id: z6.string().uuid(),
2141
+ name: z6.string(),
2142
+ slug: z6.string(),
2143
+ description: z6.union([z6.string(), z6.null()]).optional(),
2144
+ created: z6.union([z6.string(), z6.null()]).optional(),
2072
2145
  prompt_data: PromptDataNullish.optional(),
2073
- tags: z5.union([z5.array(z5.string()), z5.null()]).optional(),
2074
- metadata: z5.union([z5.object({}).partial().passthrough(), z5.null()]).optional(),
2146
+ tags: z6.union([z6.array(z6.string()), z6.null()]).optional(),
2147
+ metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional(),
2075
2148
  function_type: FunctionTypeEnumNullish.optional()
2076
2149
  });
2077
- var PromptOptions = z5.object({ model: z5.string(), params: ModelParams, position: z5.string() }).partial();
2078
- var PromptSessionEvent = z5.object({
2079
- id: z5.string(),
2080
- _xact_id: z5.string(),
2081
- created: z5.string().datetime({ offset: true }),
2082
- _pagination_key: z5.union([z5.string(), z5.null()]).optional(),
2083
- project_id: z5.string().uuid(),
2084
- prompt_session_id: z5.string().uuid(),
2085
- prompt_session_data: z5.unknown().optional(),
2086
- prompt_data: z5.unknown().optional(),
2087
- function_data: z5.unknown().optional(),
2150
+ var PromptOptions = z6.object({ model: z6.string(), params: ModelParams, position: z6.string() }).partial();
2151
+ var PromptSessionEvent = z6.object({
2152
+ id: z6.string(),
2153
+ _xact_id: z6.string(),
2154
+ created: z6.string().datetime({ offset: true }),
2155
+ _pagination_key: z6.union([z6.string(), z6.null()]).optional(),
2156
+ project_id: z6.string().uuid(),
2157
+ prompt_session_id: z6.string().uuid(),
2158
+ prompt_session_data: z6.unknown().optional(),
2159
+ prompt_data: z6.unknown().optional(),
2160
+ function_data: z6.unknown().optional(),
2088
2161
  function_type: FunctionTypeEnumNullish.optional(),
2089
- object_data: z5.unknown().optional(),
2090
- completion: z5.unknown().optional(),
2091
- tags: z5.union([z5.array(z5.string()), z5.null()]).optional()
2162
+ object_data: z6.unknown().optional(),
2163
+ completion: z6.unknown().optional(),
2164
+ tags: z6.union([z6.array(z6.string()), z6.null()]).optional()
2092
2165
  });
2093
- var ResponseFormat = z5.union([
2094
- z5.object({ type: z5.literal("json_object") }),
2095
- z5.object({
2096
- type: z5.literal("json_schema"),
2166
+ var ResponseFormat = z6.union([
2167
+ z6.object({ type: z6.literal("json_object") }),
2168
+ z6.object({
2169
+ type: z6.literal("json_schema"),
2097
2170
  json_schema: ResponseFormatJsonSchema
2098
2171
  }),
2099
- z5.object({ type: z5.literal("text") })
2172
+ z6.object({ type: z6.literal("text") })
2100
2173
  ]);
2101
- var Role = z5.object({
2102
- id: z5.string().uuid(),
2103
- org_id: z5.union([z5.string(), z5.null()]).optional(),
2104
- user_id: z5.union([z5.string(), z5.null()]).optional(),
2105
- created: z5.union([z5.string(), z5.null()]).optional(),
2106
- name: z5.string(),
2107
- description: z5.union([z5.string(), z5.null()]).optional(),
2108
- deleted_at: z5.union([z5.string(), z5.null()]).optional(),
2109
- member_permissions: z5.union([
2110
- z5.array(
2111
- z5.object({
2174
+ var Role = z6.object({
2175
+ id: z6.string().uuid(),
2176
+ org_id: z6.union([z6.string(), z6.null()]).optional(),
2177
+ user_id: z6.union([z6.string(), z6.null()]).optional(),
2178
+ created: z6.union([z6.string(), z6.null()]).optional(),
2179
+ name: z6.string(),
2180
+ description: z6.union([z6.string(), z6.null()]).optional(),
2181
+ deleted_at: z6.union([z6.string(), z6.null()]).optional(),
2182
+ member_permissions: z6.union([
2183
+ z6.array(
2184
+ z6.object({
2112
2185
  permission: Permission,
2113
2186
  restrict_object_type: AclObjectType.optional()
2114
2187
  })
2115
2188
  ),
2116
- z5.null()
2189
+ z6.null()
2117
2190
  ]).optional(),
2118
- member_roles: z5.union([z5.array(z5.string().uuid()), z5.null()]).optional()
2191
+ member_roles: z6.union([z6.array(z6.string().uuid()), z6.null()]).optional()
2119
2192
  });
2120
- var RunEval = z5.object({
2121
- project_id: z5.string(),
2122
- data: z5.union([
2123
- z5.object({
2124
- dataset_id: z5.string(),
2125
- _internal_btql: z5.union([z5.object({}).partial().passthrough(), z5.null()]).optional()
2193
+ var RunEval = z6.object({
2194
+ project_id: z6.string(),
2195
+ data: z6.union([
2196
+ z6.object({
2197
+ dataset_id: z6.string(),
2198
+ _internal_btql: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional()
2126
2199
  }),
2127
- z5.object({
2128
- project_name: z5.string(),
2129
- dataset_name: z5.string(),
2130
- _internal_btql: z5.union([z5.object({}).partial().passthrough(), z5.null()]).optional()
2200
+ z6.object({
2201
+ project_name: z6.string(),
2202
+ dataset_name: z6.string(),
2203
+ _internal_btql: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional()
2131
2204
  }),
2132
- z5.object({ data: z5.array(z5.unknown()) })
2205
+ z6.object({ data: z6.array(z6.unknown()) })
2133
2206
  ]),
2134
- task: FunctionId.and(z5.unknown()),
2135
- scores: z5.array(FunctionId),
2136
- experiment_name: z5.string().optional(),
2137
- metadata: z5.object({}).partial().passthrough().optional(),
2138
- parent: InvokeParent.and(z5.unknown()).optional(),
2139
- stream: z5.boolean().optional(),
2140
- trial_count: z5.union([z5.number(), z5.null()]).optional(),
2141
- is_public: z5.union([z5.boolean(), z5.null()]).optional(),
2142
- timeout: z5.union([z5.number(), z5.null()]).optional(),
2143
- max_concurrency: z5.union([z5.number(), z5.null()]).optional().default(10),
2144
- base_experiment_name: z5.union([z5.string(), z5.null()]).optional(),
2145
- base_experiment_id: z5.union([z5.string(), z5.null()]).optional(),
2207
+ task: FunctionId.and(z6.unknown()),
2208
+ scores: z6.array(FunctionId),
2209
+ experiment_name: z6.string().optional(),
2210
+ metadata: z6.object({}).partial().passthrough().optional(),
2211
+ parent: InvokeParent.and(z6.unknown()).optional(),
2212
+ stream: z6.boolean().optional(),
2213
+ trial_count: z6.union([z6.number(), z6.null()]).optional(),
2214
+ is_public: z6.union([z6.boolean(), z6.null()]).optional(),
2215
+ timeout: z6.union([z6.number(), z6.null()]).optional(),
2216
+ max_concurrency: z6.union([z6.number(), z6.null()]).optional().default(10),
2217
+ base_experiment_name: z6.union([z6.string(), z6.null()]).optional(),
2218
+ base_experiment_id: z6.union([z6.string(), z6.null()]).optional(),
2146
2219
  git_metadata_settings: GitMetadataSettings.and(
2147
- z5.union([z5.object({}).partial(), z5.null()])
2220
+ z6.union([z6.object({}).partial(), z6.null()])
2148
2221
  ).optional(),
2149
- repo_info: RepoInfo.and(z5.unknown()).optional(),
2150
- strict: z5.union([z5.boolean(), z5.null()]).optional(),
2151
- stop_token: z5.union([z5.string(), z5.null()]).optional(),
2152
- extra_messages: z5.string().optional(),
2153
- tags: z5.array(z5.string()).optional()
2222
+ repo_info: RepoInfo.and(z6.unknown()).optional(),
2223
+ strict: z6.union([z6.boolean(), z6.null()]).optional(),
2224
+ stop_token: z6.union([z6.string(), z6.null()]).optional(),
2225
+ extra_messages: z6.string().optional(),
2226
+ tags: z6.array(z6.string()).optional()
2154
2227
  });
2155
- var ServiceToken = z5.object({
2156
- id: z5.string().uuid(),
2157
- created: z5.union([z5.string(), z5.null()]).optional(),
2158
- name: z5.string(),
2159
- preview_name: z5.string(),
2160
- service_account_id: z5.union([z5.string(), z5.null()]).optional(),
2161
- service_account_email: z5.union([z5.string(), z5.null()]).optional(),
2162
- service_account_name: z5.union([z5.string(), z5.null()]).optional(),
2163
- org_id: z5.union([z5.string(), z5.null()]).optional()
2228
+ var ServiceToken = z6.object({
2229
+ id: z6.string().uuid(),
2230
+ created: z6.union([z6.string(), z6.null()]).optional(),
2231
+ name: z6.string(),
2232
+ preview_name: z6.string(),
2233
+ service_account_id: z6.union([z6.string(), z6.null()]).optional(),
2234
+ service_account_email: z6.union([z6.string(), z6.null()]).optional(),
2235
+ service_account_name: z6.union([z6.string(), z6.null()]).optional(),
2236
+ org_id: z6.union([z6.string(), z6.null()]).optional()
2164
2237
  });
2165
- var SpanIFrame = z5.object({
2166
- id: z5.string().uuid(),
2167
- project_id: z5.string().uuid(),
2168
- user_id: z5.union([z5.string(), z5.null()]).optional(),
2169
- created: z5.union([z5.string(), z5.null()]).optional(),
2170
- deleted_at: z5.union([z5.string(), z5.null()]).optional(),
2171
- name: z5.string(),
2172
- description: z5.union([z5.string(), z5.null()]).optional(),
2173
- url: z5.string(),
2174
- post_message: z5.union([z5.boolean(), z5.null()]).optional()
2238
+ var SpanIFrame = z6.object({
2239
+ id: z6.string().uuid(),
2240
+ project_id: z6.string().uuid(),
2241
+ user_id: z6.union([z6.string(), z6.null()]).optional(),
2242
+ created: z6.union([z6.string(), z6.null()]).optional(),
2243
+ deleted_at: z6.union([z6.string(), z6.null()]).optional(),
2244
+ name: z6.string(),
2245
+ description: z6.union([z6.string(), z6.null()]).optional(),
2246
+ url: z6.string(),
2247
+ post_message: z6.union([z6.boolean(), z6.null()]).optional()
2175
2248
  });
2176
- var SSEConsoleEventData = z5.object({
2177
- stream: z5.enum(["stderr", "stdout"]),
2178
- message: z5.string()
2249
+ var SSEConsoleEventData = z6.object({
2250
+ stream: z6.enum(["stderr", "stdout"]),
2251
+ message: z6.string()
2179
2252
  });
2180
- var SSEProgressEventData = z5.object({
2181
- id: z5.string(),
2253
+ var SSEProgressEventData = z6.object({
2254
+ id: z6.string(),
2182
2255
  object_type: FunctionObjectType,
2183
- origin: ObjectReferenceNullish.and(z5.unknown()).optional(),
2256
+ origin: ObjectReferenceNullish.and(z6.unknown()).optional(),
2184
2257
  format: FunctionFormat,
2185
2258
  output_type: FunctionOutputType,
2186
- name: z5.string(),
2187
- event: z5.enum([
2259
+ name: z6.string(),
2260
+ event: z6.enum([
2188
2261
  "reasoning_delta",
2189
2262
  "text_delta",
2190
2263
  "json_delta",
@@ -2194,110 +2267,110 @@ var SSEProgressEventData = z5.object({
2194
2267
  "done",
2195
2268
  "progress"
2196
2269
  ]),
2197
- data: z5.string()
2270
+ data: z6.string()
2198
2271
  });
2199
- var ToolFunctionDefinition = z5.object({
2200
- type: z5.literal("function"),
2201
- function: z5.object({
2202
- name: z5.string(),
2203
- description: z5.string().optional(),
2204
- parameters: z5.object({}).partial().passthrough().optional(),
2205
- strict: z5.union([z5.boolean(), z5.null()]).optional()
2272
+ var ToolFunctionDefinition = z6.object({
2273
+ type: z6.literal("function"),
2274
+ function: z6.object({
2275
+ name: z6.string(),
2276
+ description: z6.string().optional(),
2277
+ parameters: z6.object({}).partial().passthrough().optional(),
2278
+ strict: z6.union([z6.boolean(), z6.null()]).optional()
2206
2279
  })
2207
2280
  });
2208
- var User = z5.object({
2209
- id: z5.string().uuid(),
2210
- given_name: z5.union([z5.string(), z5.null()]).optional(),
2211
- family_name: z5.union([z5.string(), z5.null()]).optional(),
2212
- email: z5.union([z5.string(), z5.null()]).optional(),
2213
- avatar_url: z5.union([z5.string(), z5.null()]).optional(),
2214
- created: z5.union([z5.string(), z5.null()]).optional()
2281
+ var User = z6.object({
2282
+ id: z6.string().uuid(),
2283
+ given_name: z6.union([z6.string(), z6.null()]).optional(),
2284
+ family_name: z6.union([z6.string(), z6.null()]).optional(),
2285
+ email: z6.union([z6.string(), z6.null()]).optional(),
2286
+ avatar_url: z6.union([z6.string(), z6.null()]).optional(),
2287
+ created: z6.union([z6.string(), z6.null()]).optional()
2215
2288
  });
2216
- var ViewDataSearch = z5.union([
2217
- z5.object({
2218
- filter: z5.union([z5.array(z5.unknown()), z5.null()]),
2219
- tag: z5.union([z5.array(z5.unknown()), z5.null()]),
2220
- match: z5.union([z5.array(z5.unknown()), z5.null()]),
2221
- sort: z5.union([z5.array(z5.unknown()), z5.null()])
2289
+ var ViewDataSearch = z6.union([
2290
+ z6.object({
2291
+ filter: z6.union([z6.array(z6.unknown()), z6.null()]),
2292
+ tag: z6.union([z6.array(z6.unknown()), z6.null()]),
2293
+ match: z6.union([z6.array(z6.unknown()), z6.null()]),
2294
+ sort: z6.union([z6.array(z6.unknown()), z6.null()])
2222
2295
  }).partial(),
2223
- z5.null()
2296
+ z6.null()
2224
2297
  ]);
2225
- var ViewData = z5.union([
2226
- z5.object({ search: ViewDataSearch }).partial(),
2227
- z5.null()
2298
+ var ViewData = z6.union([
2299
+ z6.object({ search: ViewDataSearch }).partial(),
2300
+ z6.null()
2228
2301
  ]);
2229
- var ViewOptions = z5.union([
2230
- z5.object({
2231
- viewType: z5.literal("monitor"),
2232
- options: z5.object({
2233
- spanType: z5.union([z5.enum(["range", "frame"]), z5.null()]),
2234
- rangeValue: z5.union([z5.string(), z5.null()]),
2235
- frameStart: z5.union([z5.string(), z5.null()]),
2236
- frameEnd: z5.union([z5.string(), z5.null()]),
2237
- tzUTC: z5.union([z5.boolean(), z5.null()]),
2238
- chartVisibility: z5.union([z5.record(z5.boolean()), z5.null()]),
2239
- projectId: z5.union([z5.string(), z5.null()]),
2240
- type: z5.union([z5.enum(["project", "experiment"]), z5.null()]),
2241
- groupBy: z5.union([z5.string(), z5.null()])
2302
+ var ViewOptions = z6.union([
2303
+ z6.object({
2304
+ viewType: z6.literal("monitor"),
2305
+ options: z6.object({
2306
+ spanType: z6.union([z6.enum(["range", "frame"]), z6.null()]),
2307
+ rangeValue: z6.union([z6.string(), z6.null()]),
2308
+ frameStart: z6.union([z6.string(), z6.null()]),
2309
+ frameEnd: z6.union([z6.string(), z6.null()]),
2310
+ tzUTC: z6.union([z6.boolean(), z6.null()]),
2311
+ chartVisibility: z6.union([z6.record(z6.boolean()), z6.null()]),
2312
+ projectId: z6.union([z6.string(), z6.null()]),
2313
+ type: z6.union([z6.enum(["project", "experiment"]), z6.null()]),
2314
+ groupBy: z6.union([z6.string(), z6.null()])
2242
2315
  }).partial()
2243
2316
  }),
2244
- z5.object({
2245
- columnVisibility: z5.union([z5.record(z5.boolean()), z5.null()]),
2246
- columnOrder: z5.union([z5.array(z5.string()), z5.null()]),
2247
- columnSizing: z5.union([z5.record(z5.number()), z5.null()]),
2248
- grouping: z5.union([z5.string(), z5.null()]),
2249
- rowHeight: z5.union([z5.string(), z5.null()]),
2250
- tallGroupRows: z5.union([z5.boolean(), z5.null()]),
2251
- layout: z5.union([z5.string(), z5.null()]),
2252
- chartHeight: z5.union([z5.number(), z5.null()]),
2253
- excludedMeasures: z5.union([
2254
- z5.array(
2255
- z5.object({
2256
- type: z5.enum(["none", "score", "metric", "metadata"]),
2257
- value: z5.string()
2317
+ z6.object({
2318
+ columnVisibility: z6.union([z6.record(z6.boolean()), z6.null()]),
2319
+ columnOrder: z6.union([z6.array(z6.string()), z6.null()]),
2320
+ columnSizing: z6.union([z6.record(z6.number()), z6.null()]),
2321
+ grouping: z6.union([z6.string(), z6.null()]),
2322
+ rowHeight: z6.union([z6.string(), z6.null()]),
2323
+ tallGroupRows: z6.union([z6.boolean(), z6.null()]),
2324
+ layout: z6.union([z6.string(), z6.null()]),
2325
+ chartHeight: z6.union([z6.number(), z6.null()]),
2326
+ excludedMeasures: z6.union([
2327
+ z6.array(
2328
+ z6.object({
2329
+ type: z6.enum(["none", "score", "metric", "metadata"]),
2330
+ value: z6.string()
2258
2331
  })
2259
2332
  ),
2260
- z5.null()
2333
+ z6.null()
2261
2334
  ]),
2262
- yMetric: z5.union([
2263
- z5.object({
2264
- type: z5.enum(["none", "score", "metric", "metadata"]),
2265
- value: z5.string()
2335
+ yMetric: z6.union([
2336
+ z6.object({
2337
+ type: z6.enum(["none", "score", "metric", "metadata"]),
2338
+ value: z6.string()
2266
2339
  }),
2267
- z5.null()
2340
+ z6.null()
2268
2341
  ]),
2269
- xAxis: z5.union([
2270
- z5.object({
2271
- type: z5.enum(["none", "score", "metric", "metadata"]),
2272
- value: z5.string()
2342
+ xAxis: z6.union([
2343
+ z6.object({
2344
+ type: z6.enum(["none", "score", "metric", "metadata"]),
2345
+ value: z6.string()
2273
2346
  }),
2274
- z5.null()
2347
+ z6.null()
2275
2348
  ]),
2276
- symbolGrouping: z5.union([
2277
- z5.object({
2278
- type: z5.enum(["none", "score", "metric", "metadata"]),
2279
- value: z5.string()
2349
+ symbolGrouping: z6.union([
2350
+ z6.object({
2351
+ type: z6.enum(["none", "score", "metric", "metadata"]),
2352
+ value: z6.string()
2280
2353
  }),
2281
- z5.null()
2354
+ z6.null()
2282
2355
  ]),
2283
- xAxisAggregation: z5.union([z5.string(), z5.null()]),
2284
- chartAnnotations: z5.union([
2285
- z5.array(z5.object({ id: z5.string(), text: z5.string() })),
2286
- z5.null()
2356
+ xAxisAggregation: z6.union([z6.string(), z6.null()]),
2357
+ chartAnnotations: z6.union([
2358
+ z6.array(z6.object({ id: z6.string(), text: z6.string() })),
2359
+ z6.null()
2287
2360
  ]),
2288
- timeRangeFilter: z5.union([
2289
- z5.string(),
2290
- z5.object({ from: z5.string(), to: z5.string() }),
2291
- z5.null()
2361
+ timeRangeFilter: z6.union([
2362
+ z6.string(),
2363
+ z6.object({ from: z6.string(), to: z6.string() }),
2364
+ z6.null()
2292
2365
  ])
2293
2366
  }).partial(),
2294
- z5.null()
2367
+ z6.null()
2295
2368
  ]);
2296
- var View = z5.object({
2297
- id: z5.string().uuid(),
2298
- object_type: AclObjectType.and(z5.string()),
2299
- object_id: z5.string().uuid(),
2300
- view_type: z5.enum([
2369
+ var View = z6.object({
2370
+ id: z6.string().uuid(),
2371
+ object_type: AclObjectType.and(z6.string()),
2372
+ object_id: z6.string().uuid(),
2373
+ view_type: z6.enum([
2301
2374
  "projects",
2302
2375
  "experiments",
2303
2376
  "experiment",
@@ -2312,56 +2385,56 @@ var View = z5.object({
2312
2385
  "agents",
2313
2386
  "monitor"
2314
2387
  ]),
2315
- name: z5.string(),
2316
- created: z5.union([z5.string(), z5.null()]).optional(),
2388
+ name: z6.string(),
2389
+ created: z6.union([z6.string(), z6.null()]).optional(),
2317
2390
  view_data: ViewData.optional(),
2318
2391
  options: ViewOptions.optional(),
2319
- user_id: z5.union([z5.string(), z5.null()]).optional(),
2320
- deleted_at: z5.union([z5.string(), z5.null()]).optional()
2392
+ user_id: z6.union([z6.string(), z6.null()]).optional(),
2393
+ deleted_at: z6.union([z6.string(), z6.null()]).optional()
2321
2394
  });
2322
2395
 
2323
2396
  // src/logger.ts
2324
2397
  import { waitUntil } from "@vercel/functions";
2325
2398
  import Mustache2 from "mustache";
2326
- import { z as z7, ZodError } from "zod";
2399
+ import { z as z8, ZodError } from "zod";
2327
2400
 
2328
2401
  // src/functions/stream.ts
2329
2402
  import {
2330
2403
  createParser
2331
2404
  } from "eventsource-parser";
2332
- import { z as z6 } from "zod/v3";
2333
- var braintrustStreamChunkSchema = z6.union([
2334
- z6.object({
2335
- type: z6.literal("text_delta"),
2336
- data: z6.string()
2405
+ import { z as z7 } from "zod/v3";
2406
+ var braintrustStreamChunkSchema = z7.union([
2407
+ z7.object({
2408
+ type: z7.literal("text_delta"),
2409
+ data: z7.string()
2337
2410
  }),
2338
- z6.object({
2339
- type: z6.literal("reasoning_delta"),
2340
- data: z6.string()
2411
+ z7.object({
2412
+ type: z7.literal("reasoning_delta"),
2413
+ data: z7.string()
2341
2414
  }),
2342
- z6.object({
2343
- type: z6.literal("json_delta"),
2344
- data: z6.string()
2415
+ z7.object({
2416
+ type: z7.literal("json_delta"),
2417
+ data: z7.string()
2345
2418
  }),
2346
- z6.object({
2347
- type: z6.literal("error"),
2348
- data: z6.string()
2419
+ z7.object({
2420
+ type: z7.literal("error"),
2421
+ data: z7.string()
2349
2422
  }),
2350
- z6.object({
2351
- type: z6.literal("console"),
2423
+ z7.object({
2424
+ type: z7.literal("console"),
2352
2425
  data: SSEConsoleEventData
2353
2426
  }),
2354
- z6.object({
2355
- type: z6.literal("progress"),
2427
+ z7.object({
2428
+ type: z7.literal("progress"),
2356
2429
  data: SSEProgressEventData
2357
2430
  }),
2358
- z6.object({
2359
- type: z6.literal("start"),
2360
- data: z6.string()
2431
+ z7.object({
2432
+ type: z7.literal("start"),
2433
+ data: z7.string()
2361
2434
  }),
2362
- z6.object({
2363
- type: z6.literal("done"),
2364
- data: z6.string()
2435
+ z7.object({
2436
+ type: z7.literal("done"),
2437
+ data: z7.string()
2365
2438
  })
2366
2439
  ]);
2367
2440
  var BraintrustStream = class _BraintrustStream {
@@ -3058,17 +3131,31 @@ var NoopSpan = class {
3058
3131
  state() {
3059
3132
  return _internalGetGlobalState();
3060
3133
  }
3134
+ // Custom inspect for Node.js console.log
3135
+ [Symbol.for("nodejs.util.inspect.custom")]() {
3136
+ return `NoopSpan {
3137
+ kind: '${this.kind}',
3138
+ id: '${this.id}',
3139
+ spanId: '${this.spanId}',
3140
+ rootSpanId: '${this.rootSpanId}',
3141
+ spanParents: ${JSON.stringify(this.spanParents)}
3142
+ }`;
3143
+ }
3144
+ // Custom toString
3145
+ toString() {
3146
+ return `NoopSpan(id=${this.id}, spanId=${this.spanId})`;
3147
+ }
3061
3148
  };
3062
3149
  var NOOP_SPAN = new NoopSpan();
3063
3150
  var NOOP_SPAN_PERMALINK = "https://braintrust.dev/noop-span";
3064
- var loginSchema = z7.strictObject({
3065
- appUrl: z7.string(),
3066
- appPublicUrl: z7.string(),
3067
- orgName: z7.string(),
3068
- apiUrl: z7.string(),
3069
- proxyUrl: z7.string(),
3070
- loginToken: z7.string(),
3071
- orgId: z7.string().nullish(),
3151
+ var loginSchema = z8.strictObject({
3152
+ appUrl: z8.string(),
3153
+ appPublicUrl: z8.string(),
3154
+ orgName: z8.string(),
3155
+ apiUrl: z8.string(),
3156
+ proxyUrl: z8.string(),
3157
+ loginToken: z8.string(),
3158
+ orgId: z8.string().nullish(),
3072
3159
  gitMetadataSettings: GitMetadataSettings.nullish()
3073
3160
  });
3074
3161
  var stateNonce = 0;
@@ -3127,6 +3214,7 @@ var BraintrustState = class _BraintrustState {
3127
3214
  _apiConn = null;
3128
3215
  _proxyConn = null;
3129
3216
  promptCache;
3217
+ _idGenerator = null;
3130
3218
  resetLoginInfo() {
3131
3219
  this.appUrl = null;
3132
3220
  this.appPublicUrl = null;
@@ -3141,6 +3229,15 @@ var BraintrustState = class _BraintrustState {
3141
3229
  this._apiConn = null;
3142
3230
  this._proxyConn = null;
3143
3231
  }
3232
+ resetIdGenState() {
3233
+ this._idGenerator = null;
3234
+ }
3235
+ get idGenerator() {
3236
+ if (this._idGenerator === null) {
3237
+ this._idGenerator = getIdGenerator();
3238
+ }
3239
+ return this._idGenerator;
3240
+ }
3144
3241
  copyLoginInfo(other) {
3145
3242
  this.appUrl = other.appUrl;
3146
3243
  this.appPublicUrl = other.appPublicUrl;
@@ -3278,6 +3375,37 @@ var BraintrustState = class _BraintrustState {
3278
3375
  enforceQueueSizeLimit(enforce) {
3279
3376
  this._bgLogger.get().enforceQueueSizeLimit(enforce);
3280
3377
  }
3378
+ // Custom serialization to avoid logging sensitive data
3379
+ toJSON() {
3380
+ return {
3381
+ id: this.id,
3382
+ orgId: this.orgId,
3383
+ orgName: this.orgName,
3384
+ appUrl: this.appUrl,
3385
+ appPublicUrl: this.appPublicUrl,
3386
+ apiUrl: this.apiUrl,
3387
+ proxyUrl: this.proxyUrl,
3388
+ loggedIn: this.loggedIn
3389
+ // Explicitly exclude loginToken, _apiConn, _appConn, _proxyConn and other sensitive fields
3390
+ };
3391
+ }
3392
+ // Custom inspect for Node.js console.log
3393
+ [Symbol.for("nodejs.util.inspect.custom")]() {
3394
+ return `BraintrustState {
3395
+ id: '${this.id}',
3396
+ orgId: ${this.orgId ? `'${this.orgId}'` : "null"},
3397
+ orgName: ${this.orgName ? `'${this.orgName}'` : "null"},
3398
+ appUrl: ${this.appUrl ? `'${this.appUrl}'` : "null"},
3399
+ apiUrl: ${this.apiUrl ? `'${this.apiUrl}'` : "null"},
3400
+ proxyUrl: ${this.proxyUrl ? `'${this.proxyUrl}'` : "null"},
3401
+ loggedIn: ${this.loggedIn},
3402
+ loginToken: '[REDACTED]'
3403
+ }`;
3404
+ }
3405
+ // Custom toString
3406
+ toString() {
3407
+ return `BraintrustState(id=${this.id}, org=${this.orgName || "none"}, loggedIn=${this.loggedIn})`;
3408
+ }
3281
3409
  };
3282
3410
  var _globalState;
3283
3411
  function useTestBackgroundLogger() {
@@ -3445,6 +3573,17 @@ var HTTPConnection = class _HTTPConnection {
3445
3573
  });
3446
3574
  return await resp.json();
3447
3575
  }
3576
+ // Custom inspect for Node.js console.log
3577
+ [Symbol.for("nodejs.util.inspect.custom")]() {
3578
+ return `HTTPConnection {
3579
+ base_url: '${this.base_url}',
3580
+ token: '[REDACTED]'
3581
+ }`;
3582
+ }
3583
+ // Custom toString
3584
+ toString() {
3585
+ return `HTTPConnection(${this.base_url})`;
3586
+ }
3448
3587
  };
3449
3588
  var BaseAttachment = class {
3450
3589
  reference;
@@ -3545,9 +3684,9 @@ var Attachment = class extends BaseAttachment {
3545
3684
  let signedUrl;
3546
3685
  let headers;
3547
3686
  try {
3548
- ({ signedUrl, headers } = z7.object({
3549
- signedUrl: z7.string().url(),
3550
- headers: z7.record(z7.string())
3687
+ ({ signedUrl, headers } = z8.object({
3688
+ signedUrl: z8.string().url(),
3689
+ headers: z8.record(z8.string())
3551
3690
  }).parse(await metadataResponse.json()));
3552
3691
  } catch (error) {
3553
3692
  if (error instanceof ZodError) {
@@ -3702,8 +3841,8 @@ var ExternalAttachment = class extends BaseAttachment {
3702
3841
  });
3703
3842
  }
3704
3843
  };
3705
- var attachmentMetadataSchema = z7.object({
3706
- downloadUrl: z7.string(),
3844
+ var attachmentMetadataSchema = z8.object({
3845
+ downloadUrl: z8.string(),
3707
3846
  status: AttachmentStatus
3708
3847
  });
3709
3848
  var ReadonlyAttachment = class {
@@ -3841,7 +3980,7 @@ function logFeedbackImpl(state, parentObjectType, parentObjectId, {
3841
3980
  if (!isEmpty(comment)) {
3842
3981
  const record = new LazyValue(async () => {
3843
3982
  return {
3844
- id: uuidv4(),
3983
+ id: uuidv42(),
3845
3984
  created: (/* @__PURE__ */ new Date()).toISOString(),
3846
3985
  origin: {
3847
3986
  // NOTE: We do not know (or care?) what the transaction id of the row that
@@ -4631,7 +4770,7 @@ Error: ${errorText}`;
4631
4770
  }
4632
4771
  const payloadFile = isomorph_default.pathJoin(
4633
4772
  payloadDir,
4634
- `payload_${getCurrentUnixTimestamp()}_${uuidv4().slice(0, 8)}.json`
4773
+ `payload_${getCurrentUnixTimestamp()}_${uuidv42().slice(0, 8)}.json`
4635
4774
  );
4636
4775
  try {
4637
4776
  await isomorph_default.mkdir(payloadDir, { recursive: true });
@@ -5683,7 +5822,7 @@ function validateAndSanitizeExperimentLogPartialArgs(event) {
5683
5822
  function deepCopyEvent(event) {
5684
5823
  const attachments = [];
5685
5824
  const IDENTIFIER = "_bt_internal_saved_attachment";
5686
- const savedAttachmentSchema = z7.strictObject({ [IDENTIFIER]: z7.number() });
5825
+ const savedAttachmentSchema = z8.strictObject({ [IDENTIFIER]: z8.number() });
5687
5826
  const serialized = JSON.stringify(event, (_k, v) => {
5688
5827
  if (v instanceof SpanImpl || v instanceof NoopSpan) {
5689
5828
  return `<span>`;
@@ -6186,7 +6325,7 @@ var ReadonlyExperiment = class extends ObjectFetcher {
6186
6325
  };
6187
6326
  var executionCounter = 0;
6188
6327
  function newId() {
6189
- return uuidv4();
6328
+ return uuidv42();
6190
6329
  }
6191
6330
  var SpanImpl = class _SpanImpl {
6192
6331
  _state;
@@ -6242,13 +6381,17 @@ var SpanImpl = class _SpanImpl {
6242
6381
  },
6243
6382
  created: (/* @__PURE__ */ new Date()).toISOString()
6244
6383
  };
6245
- this._id = eventId ?? uuidv4();
6246
- this._spanId = args.spanId ?? uuidv4();
6384
+ this._id = eventId ?? this._state.idGenerator.getSpanId();
6385
+ this._spanId = args.spanId ?? this._state.idGenerator.getSpanId();
6247
6386
  if (args.parentSpanIds) {
6248
6387
  this._rootSpanId = args.parentSpanIds.rootSpanId;
6249
6388
  this._spanParents = "parentSpanIds" in args.parentSpanIds ? args.parentSpanIds.parentSpanIds : [args.parentSpanIds.spanId];
6250
6389
  } else {
6251
- this._rootSpanId = this._spanId;
6390
+ if (this._state.idGenerator.shareRootSpanId()) {
6391
+ this._rootSpanId = this._spanId;
6392
+ } else {
6393
+ this._rootSpanId = this._state.idGenerator.getTraceId();
6394
+ }
6252
6395
  this._spanParents = void 0;
6253
6396
  }
6254
6397
  this.isMerge = false;
@@ -6459,6 +6602,20 @@ var SpanImpl = class _SpanImpl {
6459
6602
  state() {
6460
6603
  return this._state;
6461
6604
  }
6605
+ // Custom inspect for Node.js console.log
6606
+ [Symbol.for("nodejs.util.inspect.custom")]() {
6607
+ return `SpanImpl {
6608
+ kind: '${this.kind}',
6609
+ id: '${this.id}',
6610
+ spanId: '${this.spanId}',
6611
+ rootSpanId: '${this.rootSpanId}',
6612
+ spanParents: ${JSON.stringify(this.spanParents)}
6613
+ }`;
6614
+ }
6615
+ // Custom toString
6616
+ toString() {
6617
+ return `SpanImpl(id=${this.id}, spanId=${this.spanId})`;
6618
+ }
6462
6619
  };
6463
6620
  function splitLoggingData({
6464
6621
  event,
@@ -6610,7 +6767,7 @@ var Dataset2 = class extends ObjectFetcher {
6610
6767
  output
6611
6768
  }) {
6612
6769
  this.validateEvent({ metadata, expected, output, tags });
6613
- const rowId = id || uuidv4();
6770
+ const rowId = id || uuidv42();
6614
6771
  const args = this.createArgs(
6615
6772
  deepCopyEvent({
6616
6773
  id: rowId,
@@ -6688,8 +6845,8 @@ var Dataset2 = class extends ObjectFetcher {
6688
6845
  )}`;
6689
6846
  let dataSummary;
6690
6847
  if (summarizeData) {
6691
- const rawDataSummary = z7.object({
6692
- total_records: z7.number()
6848
+ const rawDataSummary = z8.object({
6849
+ total_records: z8.number()
6693
6850
  }).parse(
6694
6851
  await state.apiConn().get_json(
6695
6852
  "dataset-summary",
@@ -6812,11 +6969,11 @@ function renderTemplatedObject(obj, args, options) {
6812
6969
  return obj;
6813
6970
  }
6814
6971
  function renderPromptParams(params, args, options) {
6815
- const schemaParsed = z7.object({
6816
- response_format: z7.object({
6817
- type: z7.literal("json_schema"),
6972
+ const schemaParsed = z8.object({
6973
+ response_format: z8.object({
6974
+ type: z8.literal("json_schema"),
6818
6975
  json_schema: ResponseFormatJsonSchema.omit({ schema: true }).extend({
6819
- schema: z7.unknown()
6976
+ schema: z8.unknown()
6820
6977
  })
6821
6978
  })
6822
6979
  }).safeParse(params);
@@ -6934,7 +7091,7 @@ var Prompt2 = class _Prompt {
6934
7091
  if (!prompt) {
6935
7092
  throw new Error("Empty prompt");
6936
7093
  }
6937
- const dictArgParsed = z7.record(z7.unknown()).safeParse(buildArgs);
7094
+ const dictArgParsed = z8.record(z8.unknown()).safeParse(buildArgs);
6938
7095
  const variables = {
6939
7096
  input: buildArgs,
6940
7097
  ...dictArgParsed.success ? dictArgParsed.data : {}
@@ -6989,7 +7146,7 @@ var Prompt2 = class _Prompt {
6989
7146
  return JSON.stringify(v);
6990
7147
  }
6991
7148
  };
6992
- const dictArgParsed = z7.record(z7.unknown()).safeParse(buildArgs);
7149
+ const dictArgParsed = z8.record(z8.unknown()).safeParse(buildArgs);
6993
7150
  const variables = {
6994
7151
  input: buildArgs,
6995
7152
  ...dictArgParsed.success ? dictArgParsed.data : {}
@@ -7130,6 +7287,12 @@ async function getPromptVersions(projectId, promptId) {
7130
7287
  (entry) => ["upsert", "merge"].includes(entry.audit_data?.action)
7131
7288
  ).map((entry) => prettifyXact(entry._xact_id)) || [];
7132
7289
  }
7290
+ function resetIdGenStateForTests() {
7291
+ const state = _internalGetGlobalState();
7292
+ if (state) {
7293
+ state.resetIdGenState();
7294
+ }
7295
+ }
7133
7296
  var _exportsForTestingOnly = {
7134
7297
  extractAttachments,
7135
7298
  deepCopyEvent,
@@ -7140,7 +7303,8 @@ var _exportsForTestingOnly = {
7140
7303
  setInitialTestState,
7141
7304
  initTestExperiment,
7142
7305
  isGeneratorFunction,
7143
- isAsyncGeneratorFunction
7306
+ isAsyncGeneratorFunction,
7307
+ resetIdGenStateForTests
7144
7308
  };
7145
7309
 
7146
7310
  // src/browser-config.ts
@@ -7208,6 +7372,7 @@ __export(exports_browser_exports, {
7208
7372
  currentExperiment: () => currentExperiment,
7209
7373
  currentLogger: () => currentLogger,
7210
7374
  currentSpan: () => currentSpan,
7375
+ deepCopyEvent: () => deepCopyEvent,
7211
7376
  deserializePlainStringAsJSON: () => deserializePlainStringAsJSON,
7212
7377
  devNullWritableStream: () => devNullWritableStream,
7213
7378
  evaluatorDefinitionSchema: () => evaluatorDefinitionSchema,
@@ -7387,7 +7552,7 @@ function parseSpanFromResponseCreateParams(params) {
7387
7552
  function parseEventFromResponseCreateResult(result) {
7388
7553
  const data = {};
7389
7554
  if (result?.output !== void 0) {
7390
- data.output = result.output;
7555
+ data.output = processImagesInOutput(result.output);
7391
7556
  }
7392
7557
  if (result) {
7393
7558
  const { output, usage, ...metadata } = result;
@@ -7398,6 +7563,35 @@ function parseEventFromResponseCreateResult(result) {
7398
7563
  data.metrics = parseMetricsFromUsage(result?.usage);
7399
7564
  return data;
7400
7565
  }
7566
+ function processImagesInOutput(output) {
7567
+ if (Array.isArray(output)) {
7568
+ return output.map(processImagesInOutput);
7569
+ }
7570
+ if (isObject(output)) {
7571
+ if (output.type === "image_generation_call" && output.result && typeof output.result === "string") {
7572
+ const fileExtension = output.output_format || "png";
7573
+ const contentType = `image/${fileExtension}`;
7574
+ const baseFilename = output.revised_prompt && typeof output.revised_prompt === "string" ? output.revised_prompt.slice(0, 50).replace(/[^a-zA-Z0-9]/g, "_") : "generated_image";
7575
+ const filename = `${baseFilename}.${fileExtension}`;
7576
+ const binaryString = atob(output.result);
7577
+ const bytes = new Uint8Array(binaryString.length);
7578
+ for (let i = 0; i < binaryString.length; i++) {
7579
+ bytes[i] = binaryString.charCodeAt(i);
7580
+ }
7581
+ const blob = new Blob([bytes], { type: contentType });
7582
+ const attachment = new Attachment({
7583
+ data: blob,
7584
+ filename,
7585
+ contentType
7586
+ });
7587
+ return {
7588
+ ...output,
7589
+ result: attachment
7590
+ };
7591
+ }
7592
+ }
7593
+ return output;
7594
+ }
7401
7595
  function parseSpanFromResponseParseParams(params) {
7402
7596
  const spanArgs = {
7403
7597
  name: "openai.responses.parse",
@@ -7421,7 +7615,7 @@ function parseSpanFromResponseParseParams(params) {
7421
7615
  function parseEventFromResponseParseResult(result) {
7422
7616
  const data = {};
7423
7617
  if (result?.output !== void 0) {
7424
- data.output = result.output;
7618
+ data.output = processImagesInOutput(result.output);
7425
7619
  }
7426
7620
  if (result) {
7427
7621
  const { output, usage, ...metadata } = result;
@@ -7465,7 +7659,7 @@ function parseLogFromItem(item) {
7465
7659
  case "response.completed":
7466
7660
  const data = {};
7467
7661
  if (response?.output !== void 0) {
7468
- data.output = response.output;
7662
+ data.output = processImagesInOutput(response.output);
7469
7663
  }
7470
7664
  if (response) {
7471
7665
  const { usage, output, ...metadata } = response;
@@ -8050,44 +8244,44 @@ var WrapperStream = class {
8050
8244
  };
8051
8245
 
8052
8246
  // dev/types.ts
8053
- import { z as z8 } from "zod/v3";
8054
- var evalBodySchema = z8.object({
8055
- name: z8.string(),
8056
- parameters: z8.record(z8.string(), z8.unknown()).nullish(),
8247
+ import { z as z9 } from "zod/v3";
8248
+ var evalBodySchema = z9.object({
8249
+ name: z9.string(),
8250
+ parameters: z9.record(z9.string(), z9.unknown()).nullish(),
8057
8251
  data: RunEval.shape.data,
8058
- scores: z8.array(
8059
- z8.object({
8252
+ scores: z9.array(
8253
+ z9.object({
8060
8254
  function_id: FunctionId,
8061
- name: z8.string()
8255
+ name: z9.string()
8062
8256
  })
8063
8257
  ).nullish(),
8064
- experiment_name: z8.string().nullish(),
8065
- project_id: z8.string().nullish(),
8258
+ experiment_name: z9.string().nullish(),
8259
+ project_id: z9.string().nullish(),
8066
8260
  parent: InvokeParent.optional(),
8067
- stream: z8.boolean().optional()
8261
+ stream: z9.boolean().optional()
8068
8262
  });
8069
- var evalParametersSerializedSchema = z8.record(
8070
- z8.string(),
8071
- z8.union([
8072
- z8.object({
8073
- type: z8.literal("prompt"),
8263
+ var evalParametersSerializedSchema = z9.record(
8264
+ z9.string(),
8265
+ z9.union([
8266
+ z9.object({
8267
+ type: z9.literal("prompt"),
8074
8268
  default: PromptData.optional(),
8075
- description: z8.string().optional()
8269
+ description: z9.string().optional()
8076
8270
  }),
8077
- z8.object({
8078
- type: z8.literal("data"),
8079
- schema: z8.record(z8.unknown()),
8271
+ z9.object({
8272
+ type: z9.literal("data"),
8273
+ schema: z9.record(z9.unknown()),
8080
8274
  // JSON Schema
8081
- default: z8.unknown().optional(),
8082
- description: z8.string().optional()
8275
+ default: z9.unknown().optional(),
8276
+ description: z9.string().optional()
8083
8277
  })
8084
8278
  ])
8085
8279
  );
8086
- var evaluatorDefinitionSchema = z8.object({
8280
+ var evaluatorDefinitionSchema = z9.object({
8087
8281
  parameters: evalParametersSerializedSchema.optional()
8088
8282
  });
8089
- var evaluatorDefinitionsSchema = z8.record(
8090
- z8.string(),
8283
+ var evaluatorDefinitionsSchema = z9.record(
8284
+ z9.string(),
8091
8285
  evaluatorDefinitionSchema
8092
8286
  );
8093
8287
 
@@ -8125,6 +8319,7 @@ export {
8125
8319
  currentExperiment,
8126
8320
  currentLogger,
8127
8321
  currentSpan,
8322
+ deepCopyEvent,
8128
8323
  browser_default as default,
8129
8324
  deserializePlainStringAsJSON,
8130
8325
  devNullWritableStream,