@agentv/core 3.0.0-next.1 → 3.2.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/evaluation/validation/index.cjs +36 -4
- package/dist/evaluation/validation/index.cjs.map +1 -1
- package/dist/evaluation/validation/index.js +36 -4
- package/dist/evaluation/validation/index.js.map +1 -1
- package/dist/index.cjs +9 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -511,18 +511,33 @@ function validateAssertArray(assertField, parentLocation, filePath, errors) {
|
|
|
511
511
|
});
|
|
512
512
|
return;
|
|
513
513
|
}
|
|
514
|
+
const objectItems = [];
|
|
514
515
|
for (let i = 0; i < assertField.length; i++) {
|
|
515
516
|
const item = assertField[i];
|
|
516
|
-
|
|
517
|
+
if (typeof item === "string") {
|
|
518
|
+
if (item.trim().length === 0) {
|
|
519
|
+
errors.push({
|
|
520
|
+
severity: "warning",
|
|
521
|
+
filePath,
|
|
522
|
+
location: `${parentLocation}.assertions[${i}]`,
|
|
523
|
+
message: "Empty string assertion item will be ignored."
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
continue;
|
|
527
|
+
}
|
|
517
528
|
if (!isObject(item)) {
|
|
518
529
|
errors.push({
|
|
519
530
|
severity: "warning",
|
|
520
531
|
filePath,
|
|
521
|
-
location
|
|
522
|
-
message: "Assertion item must be an object with a type field."
|
|
532
|
+
location: `${parentLocation}.assertions[${i}]`,
|
|
533
|
+
message: "Assertion item must be a string or an object with a type field."
|
|
523
534
|
});
|
|
524
535
|
continue;
|
|
525
536
|
}
|
|
537
|
+
objectItems.push({ item, index: i });
|
|
538
|
+
}
|
|
539
|
+
for (const { item, index } of objectItems) {
|
|
540
|
+
const location = `${parentLocation}.assertions[${index}]`;
|
|
526
541
|
const rawTypeValue = item.type;
|
|
527
542
|
if (rawTypeValue === void 0 || typeof rawTypeValue !== "string") {
|
|
528
543
|
errors.push({
|
|
@@ -1281,7 +1296,24 @@ async function validateConfigFile(filePath) {
|
|
|
1281
1296
|
});
|
|
1282
1297
|
}
|
|
1283
1298
|
}
|
|
1284
|
-
const
|
|
1299
|
+
const requiredVersion = config.required_version;
|
|
1300
|
+
if (requiredVersion !== void 0) {
|
|
1301
|
+
if (typeof requiredVersion !== "string" || requiredVersion.trim().length === 0) {
|
|
1302
|
+
errors.push({
|
|
1303
|
+
severity: "error",
|
|
1304
|
+
filePath,
|
|
1305
|
+
location: "required_version",
|
|
1306
|
+
message: `Field 'required_version' must be a non-empty string (e.g. ">=3.1.0")`
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
const allowedFields = /* @__PURE__ */ new Set([
|
|
1311
|
+
"$schema",
|
|
1312
|
+
"guideline_patterns",
|
|
1313
|
+
"eval_patterns",
|
|
1314
|
+
"required_version",
|
|
1315
|
+
"execution"
|
|
1316
|
+
]);
|
|
1285
1317
|
const unexpectedFields = Object.keys(config).filter((key) => !allowedFields.has(key));
|
|
1286
1318
|
if (unexpectedFields.length > 0) {
|
|
1287
1319
|
errors.push({
|