@agentv/core 4.20.0-next.1 → 4.21.0-next.1
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/{chunk-24ND5HZC.js → chunk-LKX4QW3G.js} +60 -2
- package/dist/{chunk-24ND5HZC.js.map → chunk-LKX4QW3G.js.map} +1 -1
- package/dist/{chunk-ELF6SQAK.js → chunk-WCW3V6QJ.js} +28 -17
- package/dist/chunk-WCW3V6QJ.js.map +1 -0
- package/dist/evaluation/validation/index.cjs +94 -8
- package/dist/evaluation/validation/index.cjs.map +1 -1
- package/dist/evaluation/validation/index.js +40 -10
- package/dist/evaluation/validation/index.js.map +1 -1
- package/dist/index.cjs +104 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -8
- package/dist/index.d.ts +23 -8
- package/dist/index.js +32 -27
- package/dist/index.js.map +1 -1
- package/dist/{ts-eval-loader-32COE32J.js → ts-eval-loader-HPIPE72C.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-ELF6SQAK.js.map +0 -1
- /package/dist/{ts-eval-loader-32COE32J.js.map → ts-eval-loader-HPIPE72C.js.map} +0 -0
|
@@ -1744,7 +1744,7 @@ function interpolateEnv(value, env) {
|
|
|
1744
1744
|
}
|
|
1745
1745
|
|
|
1746
1746
|
// src/evaluation/loaders/case-file-loader.ts
|
|
1747
|
-
import { readFile as readFile2 } from "node:fs/promises";
|
|
1747
|
+
import { readFile as readFile2, readdir, stat } from "node:fs/promises";
|
|
1748
1748
|
import path3 from "node:path";
|
|
1749
1749
|
import fg from "fast-glob";
|
|
1750
1750
|
import { parse as parseYaml } from "yaml";
|
|
@@ -1848,6 +1848,63 @@ async function resolveFileReference2(ref, evalFileDir) {
|
|
|
1848
1848
|
}
|
|
1849
1849
|
return loadCasesFromFile(absolutePattern);
|
|
1850
1850
|
}
|
|
1851
|
+
async function loadCasesFromDirectory(dirPath) {
|
|
1852
|
+
const entries = await readdir(dirPath, { withFileTypes: true });
|
|
1853
|
+
const subdirs = entries.filter((e) => e.isDirectory()).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
1854
|
+
const results = [];
|
|
1855
|
+
for (const subdir of subdirs) {
|
|
1856
|
+
const subdirPath = path3.join(dirPath, subdir.name);
|
|
1857
|
+
let caseFilePath;
|
|
1858
|
+
for (const filename of ["case.yaml", "case.yml"]) {
|
|
1859
|
+
const candidate = path3.join(subdirPath, filename);
|
|
1860
|
+
try {
|
|
1861
|
+
const s = await stat(candidate);
|
|
1862
|
+
if (s.isFile()) {
|
|
1863
|
+
caseFilePath = candidate;
|
|
1864
|
+
break;
|
|
1865
|
+
}
|
|
1866
|
+
} catch {
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
if (!caseFilePath) {
|
|
1870
|
+
console.warn(
|
|
1871
|
+
`${ANSI_YELLOW}Warning: Skipping directory '${subdir.name}' \u2014 no case.yaml found${ANSI_RESET}`
|
|
1872
|
+
);
|
|
1873
|
+
continue;
|
|
1874
|
+
}
|
|
1875
|
+
let content;
|
|
1876
|
+
try {
|
|
1877
|
+
content = await readFile2(caseFilePath, "utf8");
|
|
1878
|
+
} catch (error) {
|
|
1879
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1880
|
+
throw new Error(`Cannot read case file: ${caseFilePath}
|
|
1881
|
+
${message}`);
|
|
1882
|
+
}
|
|
1883
|
+
const raw = parseYaml(content);
|
|
1884
|
+
const parsed = interpolateEnv(raw, process.env);
|
|
1885
|
+
if (!isJsonObject(parsed)) {
|
|
1886
|
+
throw new Error(
|
|
1887
|
+
`Case file must contain a YAML object, got ${typeof parsed}: ${caseFilePath}`
|
|
1888
|
+
);
|
|
1889
|
+
}
|
|
1890
|
+
const caseObj = { ...parsed };
|
|
1891
|
+
if (caseObj.id === void 0 || caseObj.id === null) {
|
|
1892
|
+
caseObj.id = subdir.name;
|
|
1893
|
+
}
|
|
1894
|
+
if (!caseObj.workspace) {
|
|
1895
|
+
const workspaceDirPath = path3.join(subdirPath, "workspace");
|
|
1896
|
+
try {
|
|
1897
|
+
const s = await stat(workspaceDirPath);
|
|
1898
|
+
if (s.isDirectory()) {
|
|
1899
|
+
caseObj.workspace = { template: workspaceDirPath };
|
|
1900
|
+
}
|
|
1901
|
+
} catch {
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
results.push(caseObj);
|
|
1905
|
+
}
|
|
1906
|
+
return results;
|
|
1907
|
+
}
|
|
1851
1908
|
async function expandFileReferences(tests, evalFileDir) {
|
|
1852
1909
|
const expanded = [];
|
|
1853
1910
|
for (const entry of tests) {
|
|
@@ -1873,6 +1930,7 @@ export {
|
|
|
1873
1930
|
isGraderKind,
|
|
1874
1931
|
interpolateEnv,
|
|
1875
1932
|
loadCasesFromFile,
|
|
1933
|
+
loadCasesFromDirectory,
|
|
1876
1934
|
expandFileReferences,
|
|
1877
1935
|
fileExists,
|
|
1878
1936
|
normalizeLineEndings,
|
|
@@ -1893,4 +1951,4 @@ export {
|
|
|
1893
1951
|
resolveDelegatedTargetDefinition,
|
|
1894
1952
|
resolveTargetDefinition
|
|
1895
1953
|
};
|
|
1896
|
-
//# sourceMappingURL=chunk-
|
|
1954
|
+
//# sourceMappingURL=chunk-LKX4QW3G.js.map
|