@agentv/core 4.29.2-next.1 → 4.30.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-YFXMMBUG.js → chunk-5RQMJZDJ.js} +57 -1
- package/dist/{chunk-YFXMMBUG.js.map → chunk-5RQMJZDJ.js.map} +1 -1
- package/dist/{chunk-SCC35F3L.js → chunk-Z2BBOGE4.js} +69 -30
- package/dist/{chunk-SCC35F3L.js.map → chunk-Z2BBOGE4.js.map} +1 -1
- package/dist/evaluation/validation/index.cjs +1 -0
- package/dist/evaluation/validation/index.cjs.map +1 -1
- package/dist/evaluation/validation/index.js +2 -1
- package/dist/evaluation/validation/index.js.map +1 -1
- package/dist/index.cjs +122 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/{ts-eval-loader-EMSGL2BQ.js → ts-eval-loader-JL5DGTJL.js} +3 -3
- package/package.json +1 -1
- /package/dist/{ts-eval-loader-EMSGL2BQ.js.map → ts-eval-loader-JL5DGTJL.js.map} +0 -0
|
@@ -1735,6 +1735,8 @@ function resolveOptionalNumberArray(source, description) {
|
|
|
1735
1735
|
|
|
1736
1736
|
// src/evaluation/interpolation.ts
|
|
1737
1737
|
var ENV_VAR_PATTERN = /\$\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}/g;
|
|
1738
|
+
var TEMPLATE_VAR_PATTERN = /\{\{\s*([A-Za-z_][A-Za-z0-9_.]*)\s*\}\}/g;
|
|
1739
|
+
var WHOLE_TEMPLATE_VAR_PATTERN = /^\{\{\s*([A-Za-z_][A-Za-z0-9_.]*)\s*\}\}$/;
|
|
1738
1740
|
var WHOLE_VAR_PATTERN = /^\$\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}$/;
|
|
1739
1741
|
var PLAIN_NUMBER_PATTERN = /^-?(?:0|[1-9]\d*)(?:\.\d+)?$/;
|
|
1740
1742
|
function coercePrimitive(value) {
|
|
@@ -1743,6 +1745,35 @@ function coercePrimitive(value) {
|
|
|
1743
1745
|
if (PLAIN_NUMBER_PATTERN.test(value)) return Number(value);
|
|
1744
1746
|
return value;
|
|
1745
1747
|
}
|
|
1748
|
+
function isPlainObject(value) {
|
|
1749
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1750
|
+
}
|
|
1751
|
+
function cloneTemplateValue(value) {
|
|
1752
|
+
if (Array.isArray(value)) {
|
|
1753
|
+
return value.map((item) => cloneTemplateValue(item));
|
|
1754
|
+
}
|
|
1755
|
+
if (isPlainObject(value)) {
|
|
1756
|
+
const result = {};
|
|
1757
|
+
for (const [key, nested] of Object.entries(value)) {
|
|
1758
|
+
result[key] = cloneTemplateValue(nested);
|
|
1759
|
+
}
|
|
1760
|
+
return result;
|
|
1761
|
+
}
|
|
1762
|
+
return value;
|
|
1763
|
+
}
|
|
1764
|
+
function stringifyTemplateValue(value) {
|
|
1765
|
+
if (typeof value === "string") return value;
|
|
1766
|
+
return JSON.stringify(value);
|
|
1767
|
+
}
|
|
1768
|
+
function lookupTemplateVar(vars, expression) {
|
|
1769
|
+
if (!expression) return void 0;
|
|
1770
|
+
return expression.split(".").reduce((current, segment) => {
|
|
1771
|
+
if (!isPlainObject(current)) {
|
|
1772
|
+
return void 0;
|
|
1773
|
+
}
|
|
1774
|
+
return current[segment];
|
|
1775
|
+
}, vars);
|
|
1776
|
+
}
|
|
1746
1777
|
function interpolateEnv(value, env) {
|
|
1747
1778
|
if (typeof value === "string") {
|
|
1748
1779
|
const wholeMatch = WHOLE_VAR_PATTERN.exec(value);
|
|
@@ -1764,6 +1795,30 @@ function interpolateEnv(value, env) {
|
|
|
1764
1795
|
}
|
|
1765
1796
|
return value;
|
|
1766
1797
|
}
|
|
1798
|
+
function interpolateTemplateVars(value, vars) {
|
|
1799
|
+
if (typeof value === "string") {
|
|
1800
|
+
const wholeMatch = WHOLE_TEMPLATE_VAR_PATTERN.exec(value);
|
|
1801
|
+
if (wholeMatch) {
|
|
1802
|
+
const resolved = lookupTemplateVar(vars, wholeMatch[1]);
|
|
1803
|
+
return resolved === void 0 ? value : cloneTemplateValue(resolved);
|
|
1804
|
+
}
|
|
1805
|
+
return value.replace(TEMPLATE_VAR_PATTERN, (match, expression) => {
|
|
1806
|
+
const resolved = lookupTemplateVar(vars, expression);
|
|
1807
|
+
return resolved === void 0 ? match : stringifyTemplateValue(resolved);
|
|
1808
|
+
});
|
|
1809
|
+
}
|
|
1810
|
+
if (Array.isArray(value)) {
|
|
1811
|
+
return value.map((item) => interpolateTemplateVars(item, vars));
|
|
1812
|
+
}
|
|
1813
|
+
if (isPlainObject(value)) {
|
|
1814
|
+
const result = {};
|
|
1815
|
+
for (const [key, nested] of Object.entries(value)) {
|
|
1816
|
+
result[key] = interpolateTemplateVars(nested, vars);
|
|
1817
|
+
}
|
|
1818
|
+
return result;
|
|
1819
|
+
}
|
|
1820
|
+
return value;
|
|
1821
|
+
}
|
|
1767
1822
|
|
|
1768
1823
|
// src/evaluation/loaders/case-file-loader.ts
|
|
1769
1824
|
import { readFile as readFile2, readdir, stat } from "node:fs/promises";
|
|
@@ -1951,6 +2006,7 @@ export {
|
|
|
1951
2006
|
isGraderKind,
|
|
1952
2007
|
parseYamlValue,
|
|
1953
2008
|
interpolateEnv,
|
|
2009
|
+
interpolateTemplateVars,
|
|
1954
2010
|
loadCasesFromFile,
|
|
1955
2011
|
loadCasesFromDirectory,
|
|
1956
2012
|
expandFileReferences,
|
|
@@ -1973,4 +2029,4 @@ export {
|
|
|
1973
2029
|
resolveDelegatedTargetDefinition,
|
|
1974
2030
|
resolveTargetDefinition
|
|
1975
2031
|
};
|
|
1976
|
-
//# sourceMappingURL=chunk-
|
|
2032
|
+
//# sourceMappingURL=chunk-5RQMJZDJ.js.map
|