ai 7.0.57 → 7.0.59

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.
@@ -92,7 +92,7 @@ import {
92
92
  } from "@ai-sdk/provider-utils";
93
93
 
94
94
  // src/version.ts
95
- var VERSION = true ? "7.0.57" : "0.0.0-test";
95
+ var VERSION = true ? "7.0.59" : "0.0.0-test";
96
96
 
97
97
  // src/util/download/download.ts
98
98
  var download = async ({
@@ -1099,8 +1099,8 @@ import {
1099
1099
  } from "@ai-sdk/provider-utils";
1100
1100
 
1101
1101
  // src/util/is-non-empty-object.ts
1102
- function isNonEmptyObject(object) {
1103
- return object != null && Object.keys(object).length > 0;
1102
+ function isNonEmptyObject(object2) {
1103
+ return object2 != null && Object.keys(object2).length > 0;
1104
1104
  }
1105
1105
 
1106
1106
  // src/prompt/prepare-tools.ts
@@ -1189,16 +1189,48 @@ import {
1189
1189
  asArray as asArray2,
1190
1190
  safeValidateTypes
1191
1191
  } from "@ai-sdk/provider-utils";
1192
- import { z as z5 } from "zod/v4";
1193
1192
 
1194
- // src/prompt/message.ts
1195
- import { z as z4 } from "zod/v4";
1196
-
1197
- // src/types/provider-metadata.ts
1198
- import { z as z2 } from "zod/v4";
1193
+ // src/util/zod.ts
1194
+ import {
1195
+ array,
1196
+ boolean,
1197
+ custom,
1198
+ discriminatedUnion,
1199
+ enum as enumType,
1200
+ instanceof as instanceOf,
1201
+ lazy,
1202
+ literal,
1203
+ looseObject,
1204
+ never,
1205
+ null as nullType,
1206
+ number,
1207
+ object,
1208
+ record,
1209
+ string,
1210
+ union,
1211
+ unknown
1212
+ } from "zod/v4";
1213
+ var z = {
1214
+ array,
1215
+ boolean,
1216
+ custom,
1217
+ discriminatedUnion,
1218
+ enum: enumType,
1219
+ instanceof: instanceOf,
1220
+ lazy,
1221
+ literal,
1222
+ looseObject,
1223
+ never,
1224
+ null: nullType,
1225
+ number,
1226
+ object,
1227
+ record,
1228
+ string,
1229
+ union,
1230
+ unknown
1231
+ };
1199
1232
 
1200
1233
  // src/types/json-value.ts
1201
- import { z } from "zod/v4";
1202
1234
  var jsonValueSchema = z.lazy(
1203
1235
  () => z.union([
1204
1236
  z.null(),
@@ -1211,189 +1243,188 @@ var jsonValueSchema = z.lazy(
1211
1243
  );
1212
1244
 
1213
1245
  // src/types/provider-metadata.ts
1214
- var providerMetadataSchema = z2.record(
1215
- z2.string(),
1216
- z2.record(z2.string(), jsonValueSchema.optional())
1246
+ var providerMetadataSchema = z.record(
1247
+ z.string(),
1248
+ z.record(z.string(), jsonValueSchema.optional())
1217
1249
  );
1218
1250
 
1219
1251
  // src/prompt/content-part.ts
1220
1252
  import {
1221
1253
  isBuffer as isBuffer2
1222
1254
  } from "@ai-sdk/provider-utils";
1223
- import { z as z3 } from "zod/v4";
1224
- var fileInlineDataSchema = z3.union([
1225
- z3.string(),
1226
- z3.instanceof(Uint8Array),
1227
- z3.instanceof(ArrayBuffer),
1228
- z3.custom(isBuffer2, { message: "Must be a Buffer" })
1255
+ var fileInlineDataSchema = z.union([
1256
+ z.string(),
1257
+ z.instanceof(Uint8Array),
1258
+ z.instanceof(ArrayBuffer),
1259
+ z.custom(isBuffer2, { message: "Must be a Buffer" })
1229
1260
  ]);
1230
- var providerReferenceSchema = z3.record(z3.string(), z3.string());
1231
- var textPartSchema = z3.object({
1232
- type: z3.literal("text"),
1233
- text: z3.string(),
1261
+ var providerReferenceSchema = z.record(z.string(), z.string());
1262
+ var textPartSchema = z.object({
1263
+ type: z.literal("text"),
1264
+ text: z.string(),
1234
1265
  providerOptions: providerMetadataSchema.optional()
1235
1266
  });
1236
- var imagePartSchema = z3.object({
1237
- type: z3.literal("image"),
1238
- image: z3.union([
1267
+ var imagePartSchema = z.object({
1268
+ type: z.literal("image"),
1269
+ image: z.union([
1239
1270
  fileInlineDataSchema,
1240
- z3.instanceof(URL),
1271
+ z.instanceof(URL),
1241
1272
  providerReferenceSchema
1242
1273
  ]),
1243
- mediaType: z3.string().optional(),
1274
+ mediaType: z.string().optional(),
1244
1275
  providerOptions: providerMetadataSchema.optional()
1245
1276
  });
1246
- var taggedFileDataSchema = z3.discriminatedUnion("type", [
1247
- z3.object({ type: z3.literal("data"), data: fileInlineDataSchema }),
1248
- z3.object({ type: z3.literal("url"), url: z3.instanceof(URL) }),
1249
- z3.object({
1250
- type: z3.literal("reference"),
1277
+ var taggedFileDataSchema = z.discriminatedUnion("type", [
1278
+ z.object({ type: z.literal("data"), data: fileInlineDataSchema }),
1279
+ z.object({ type: z.literal("url"), url: z.instanceof(URL) }),
1280
+ z.object({
1281
+ type: z.literal("reference"),
1251
1282
  reference: providerReferenceSchema
1252
1283
  }),
1253
- z3.object({ type: z3.literal("text"), text: z3.string() })
1284
+ z.object({ type: z.literal("text"), text: z.string() })
1254
1285
  ]);
1255
- var taggedReasoningFileDataSchema = z3.discriminatedUnion("type", [
1256
- z3.object({ type: z3.literal("data"), data: fileInlineDataSchema }),
1257
- z3.object({ type: z3.literal("url"), url: z3.instanceof(URL) })
1286
+ var taggedReasoningFileDataSchema = z.discriminatedUnion("type", [
1287
+ z.object({ type: z.literal("data"), data: fileInlineDataSchema }),
1288
+ z.object({ type: z.literal("url"), url: z.instanceof(URL) })
1258
1289
  ]);
1259
- var filePartSchema = z3.object({
1260
- type: z3.literal("file"),
1261
- data: z3.union([
1290
+ var filePartSchema = z.object({
1291
+ type: z.literal("file"),
1292
+ data: z.union([
1262
1293
  taggedFileDataSchema,
1263
1294
  fileInlineDataSchema,
1264
- z3.instanceof(URL),
1295
+ z.instanceof(URL),
1265
1296
  providerReferenceSchema
1266
1297
  ]),
1267
- filename: z3.string().optional(),
1268
- mediaType: z3.string(),
1298
+ filename: z.string().optional(),
1299
+ mediaType: z.string(),
1269
1300
  providerOptions: providerMetadataSchema.optional()
1270
1301
  });
1271
- var reasoningPartSchema = z3.object({
1272
- type: z3.literal("reasoning"),
1273
- text: z3.string(),
1302
+ var reasoningPartSchema = z.object({
1303
+ type: z.literal("reasoning"),
1304
+ text: z.string(),
1274
1305
  providerOptions: providerMetadataSchema.optional()
1275
1306
  });
1276
- var customPartSchema = z3.object({
1277
- type: z3.literal("custom"),
1278
- kind: z3.string().transform((value) => value),
1307
+ var customPartSchema = z.object({
1308
+ type: z.literal("custom"),
1309
+ kind: z.string().transform((value) => value),
1279
1310
  providerOptions: providerMetadataSchema.optional()
1280
1311
  });
1281
- var reasoningFilePartSchema = z3.object({
1282
- type: z3.literal("reasoning-file"),
1283
- data: z3.union([
1312
+ var reasoningFilePartSchema = z.object({
1313
+ type: z.literal("reasoning-file"),
1314
+ data: z.union([
1284
1315
  taggedReasoningFileDataSchema,
1285
1316
  fileInlineDataSchema,
1286
- z3.instanceof(URL)
1317
+ z.instanceof(URL)
1287
1318
  ]),
1288
- mediaType: z3.string(),
1319
+ mediaType: z.string(),
1289
1320
  providerOptions: providerMetadataSchema.optional()
1290
1321
  });
1291
- var toolCallPartSchema = z3.object({
1292
- type: z3.literal("tool-call"),
1293
- toolCallId: z3.string(),
1294
- toolName: z3.string(),
1295
- input: z3.unknown(),
1322
+ var toolCallPartSchema = z.object({
1323
+ type: z.literal("tool-call"),
1324
+ toolCallId: z.string(),
1325
+ toolName: z.string(),
1326
+ input: z.unknown(),
1296
1327
  providerOptions: providerMetadataSchema.optional(),
1297
- providerExecuted: z3.boolean().optional()
1328
+ providerExecuted: z.boolean().optional()
1298
1329
  });
1299
- var outputSchema = z3.discriminatedUnion(
1330
+ var outputSchema = z.discriminatedUnion(
1300
1331
  "type",
1301
1332
  [
1302
- z3.object({
1303
- type: z3.literal("text"),
1304
- value: z3.string(),
1333
+ z.object({
1334
+ type: z.literal("text"),
1335
+ value: z.string(),
1305
1336
  providerOptions: providerMetadataSchema.optional()
1306
1337
  }),
1307
- z3.object({
1308
- type: z3.literal("json"),
1338
+ z.object({
1339
+ type: z.literal("json"),
1309
1340
  value: jsonValueSchema,
1310
1341
  providerOptions: providerMetadataSchema.optional()
1311
1342
  }),
1312
- z3.object({
1313
- type: z3.literal("execution-denied"),
1314
- reason: z3.string().optional(),
1343
+ z.object({
1344
+ type: z.literal("execution-denied"),
1345
+ reason: z.string().optional(),
1315
1346
  providerOptions: providerMetadataSchema.optional()
1316
1347
  }),
1317
- z3.object({
1318
- type: z3.literal("error-text"),
1319
- value: z3.string(),
1348
+ z.object({
1349
+ type: z.literal("error-text"),
1350
+ value: z.string(),
1320
1351
  providerOptions: providerMetadataSchema.optional()
1321
1352
  }),
1322
- z3.object({
1323
- type: z3.literal("error-json"),
1353
+ z.object({
1354
+ type: z.literal("error-json"),
1324
1355
  value: jsonValueSchema,
1325
1356
  providerOptions: providerMetadataSchema.optional()
1326
1357
  }),
1327
- z3.object({
1328
- type: z3.literal("content"),
1329
- value: z3.array(
1330
- z3.union([
1331
- z3.object({
1332
- type: z3.literal("text"),
1333
- text: z3.string(),
1358
+ z.object({
1359
+ type: z.literal("content"),
1360
+ value: z.array(
1361
+ z.union([
1362
+ z.object({
1363
+ type: z.literal("text"),
1364
+ text: z.string(),
1334
1365
  providerOptions: providerMetadataSchema.optional()
1335
1366
  }),
1336
- z3.object({
1337
- type: z3.literal("file"),
1367
+ z.object({
1368
+ type: z.literal("file"),
1338
1369
  data: taggedFileDataSchema,
1339
- mediaType: z3.string(),
1340
- filename: z3.string().optional(),
1370
+ mediaType: z.string(),
1371
+ filename: z.string().optional(),
1341
1372
  providerOptions: providerMetadataSchema.optional()
1342
1373
  }),
1343
- z3.object({
1374
+ z.object({
1344
1375
  // Deprecated.
1345
- type: z3.literal("file-data"),
1346
- data: z3.string(),
1347
- mediaType: z3.string(),
1348
- filename: z3.string().optional(),
1376
+ type: z.literal("file-data"),
1377
+ data: z.string(),
1378
+ mediaType: z.string(),
1379
+ filename: z.string().optional(),
1349
1380
  providerOptions: providerMetadataSchema.optional()
1350
1381
  }),
1351
- z3.object({
1382
+ z.object({
1352
1383
  // Deprecated.
1353
- type: z3.literal("file-url"),
1354
- url: z3.string(),
1355
- mediaType: z3.string().optional(),
1384
+ type: z.literal("file-url"),
1385
+ url: z.string(),
1386
+ mediaType: z.string().optional(),
1356
1387
  providerOptions: providerMetadataSchema.optional()
1357
1388
  }),
1358
- z3.object({
1389
+ z.object({
1359
1390
  // Deprecated.
1360
- type: z3.literal("file-id"),
1361
- fileId: z3.union([z3.string(), z3.record(z3.string(), z3.string())]),
1391
+ type: z.literal("file-id"),
1392
+ fileId: z.union([z.string(), z.record(z.string(), z.string())]),
1362
1393
  providerOptions: providerMetadataSchema.optional()
1363
1394
  }),
1364
- z3.object({
1395
+ z.object({
1365
1396
  // Deprecated.
1366
- type: z3.literal("file-reference"),
1367
- providerReference: z3.record(z3.string(), z3.string()),
1397
+ type: z.literal("file-reference"),
1398
+ providerReference: z.record(z.string(), z.string()),
1368
1399
  providerOptions: providerMetadataSchema.optional()
1369
1400
  }),
1370
- z3.object({
1401
+ z.object({
1371
1402
  // Deprecated.
1372
- type: z3.literal("image-data"),
1373
- data: z3.string(),
1374
- mediaType: z3.string(),
1403
+ type: z.literal("image-data"),
1404
+ data: z.string(),
1405
+ mediaType: z.string(),
1375
1406
  providerOptions: providerMetadataSchema.optional()
1376
1407
  }),
1377
- z3.object({
1408
+ z.object({
1378
1409
  // Deprecated.
1379
- type: z3.literal("image-url"),
1380
- url: z3.string(),
1410
+ type: z.literal("image-url"),
1411
+ url: z.string(),
1381
1412
  providerOptions: providerMetadataSchema.optional()
1382
1413
  }),
1383
- z3.object({
1414
+ z.object({
1384
1415
  // Deprecated.
1385
- type: z3.literal("image-file-id"),
1386
- fileId: z3.union([z3.string(), z3.record(z3.string(), z3.string())]),
1416
+ type: z.literal("image-file-id"),
1417
+ fileId: z.union([z.string(), z.record(z.string(), z.string())]),
1387
1418
  providerOptions: providerMetadataSchema.optional()
1388
1419
  }),
1389
- z3.object({
1420
+ z.object({
1390
1421
  // Deprecated.
1391
- type: z3.literal("image-file-reference"),
1392
- providerReference: z3.record(z3.string(), z3.string()),
1422
+ type: z.literal("image-file-reference"),
1423
+ providerReference: z.record(z.string(), z.string()),
1393
1424
  providerOptions: providerMetadataSchema.optional()
1394
1425
  }),
1395
- z3.object({
1396
- type: z3.literal("custom"),
1426
+ z.object({
1427
+ type: z.literal("custom"),
1397
1428
  providerOptions: providerMetadataSchema.optional()
1398
1429
  })
1399
1430
  ])
@@ -1401,47 +1432,47 @@ var outputSchema = z3.discriminatedUnion(
1401
1432
  })
1402
1433
  ]
1403
1434
  );
1404
- var toolResultPartSchema = z3.object({
1405
- type: z3.literal("tool-result"),
1406
- toolCallId: z3.string(),
1407
- toolName: z3.string(),
1435
+ var toolResultPartSchema = z.object({
1436
+ type: z.literal("tool-result"),
1437
+ toolCallId: z.string(),
1438
+ toolName: z.string(),
1408
1439
  output: outputSchema,
1409
1440
  providerOptions: providerMetadataSchema.optional()
1410
1441
  });
1411
- var toolApprovalRequestSchema = z3.object({
1412
- type: z3.literal("tool-approval-request"),
1413
- approvalId: z3.string(),
1414
- toolCallId: z3.string()
1415
- });
1416
- var toolApprovalResponseSchema = z3.object({
1417
- type: z3.literal("tool-approval-response"),
1418
- approvalId: z3.string(),
1419
- approved: z3.boolean(),
1420
- reason: z3.string().optional()
1421
- });
1422
-
1423
- // src/prompt/message.ts
1424
- var systemModelMessageSchema = z4.object(
1442
+ var toolApprovalRequestSchema = z.object(
1425
1443
  {
1426
- role: z4.literal("system"),
1427
- content: z4.string(),
1428
- providerOptions: providerMetadataSchema.optional()
1444
+ type: z.literal("tool-approval-request"),
1445
+ approvalId: z.string(),
1446
+ toolCallId: z.string()
1429
1447
  }
1430
1448
  );
1431
- var userModelMessageSchema = z4.object({
1432
- role: z4.literal("user"),
1433
- content: z4.union([
1434
- z4.string(),
1435
- z4.array(z4.union([textPartSchema, imagePartSchema, filePartSchema]))
1449
+ var toolApprovalResponseSchema = z.object({
1450
+ type: z.literal("tool-approval-response"),
1451
+ approvalId: z.string(),
1452
+ approved: z.boolean(),
1453
+ reason: z.string().optional()
1454
+ });
1455
+
1456
+ // src/prompt/message.ts
1457
+ var systemModelMessageSchema = z.object({
1458
+ role: z.literal("system"),
1459
+ content: z.string(),
1460
+ providerOptions: providerMetadataSchema.optional()
1461
+ });
1462
+ var userModelMessageSchema = z.object({
1463
+ role: z.literal("user"),
1464
+ content: z.union([
1465
+ z.string(),
1466
+ z.array(z.union([textPartSchema, imagePartSchema, filePartSchema]))
1436
1467
  ]),
1437
1468
  providerOptions: providerMetadataSchema.optional()
1438
1469
  });
1439
- var assistantModelMessageSchema = z4.object({
1440
- role: z4.literal("assistant"),
1441
- content: z4.union([
1442
- z4.string(),
1443
- z4.array(
1444
- z4.union([
1470
+ var assistantModelMessageSchema = z.object({
1471
+ role: z.literal("assistant"),
1472
+ content: z.union([
1473
+ z.string(),
1474
+ z.array(
1475
+ z.union([
1445
1476
  textPartSchema,
1446
1477
  customPartSchema,
1447
1478
  filePartSchema,
@@ -1455,12 +1486,12 @@ var assistantModelMessageSchema = z4.object({
1455
1486
  ]),
1456
1487
  providerOptions: providerMetadataSchema.optional()
1457
1488
  });
1458
- var toolModelMessageSchema = z4.object({
1459
- role: z4.literal("tool"),
1460
- content: z4.array(z4.union([toolResultPartSchema, toolApprovalResponseSchema])),
1489
+ var toolModelMessageSchema = z.object({
1490
+ role: z.literal("tool"),
1491
+ content: z.array(z.union([toolResultPartSchema, toolApprovalResponseSchema])),
1461
1492
  providerOptions: providerMetadataSchema.optional()
1462
1493
  });
1463
- var modelMessageSchema = z4.union([
1494
+ var modelMessageSchema = z.union([
1464
1495
  systemModelMessageSchema,
1465
1496
  userModelMessageSchema,
1466
1497
  assistantModelMessageSchema,
@@ -1517,7 +1548,7 @@ async function standardizePrompt({
1517
1548
  }
1518
1549
  const validationResult = await safeValidateTypes({
1519
1550
  value: messages,
1520
- schema: z5.array(modelMessageSchema)
1551
+ schema: z.array(modelMessageSchema)
1521
1552
  });
1522
1553
  if (!validationResult.success) {
1523
1554
  throw new InvalidPromptError({