executant 1.4.4 → 1.4.6
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/index.js +16 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1170,6 +1170,7 @@ var StepSchema = z3.object({
|
|
|
1170
1170
|
llm_as_judge: z3.boolean().optional(),
|
|
1171
1171
|
allowed_tools: z3.array(z3.string()).optional(),
|
|
1172
1172
|
forEach: z3.union([z3.array(z3.string()), z3.string()]).optional(),
|
|
1173
|
+
repeat: z3.number().int().positive().optional(),
|
|
1173
1174
|
context: z3.array(z3.string()).optional()
|
|
1174
1175
|
});
|
|
1175
1176
|
var WorkflowSchema = z3.object({
|
|
@@ -1295,6 +1296,13 @@ async function runPass3Judge(description, workflow2) {
|
|
|
1295
1296
|
function isNumericSequence(arr) {
|
|
1296
1297
|
return arr.every((item, i) => item === String(i + 1));
|
|
1297
1298
|
}
|
|
1299
|
+
function isLabeledSequence(arr) {
|
|
1300
|
+
if (arr.length < 2) return null;
|
|
1301
|
+
const m = arr[0].match(/^(.+\s)(\d+)$/);
|
|
1302
|
+
if (!m) return null;
|
|
1303
|
+
const prefix = m[1];
|
|
1304
|
+
return arr.every((item, i) => item === `${prefix}${i + 1}`) ? arr.length : null;
|
|
1305
|
+
}
|
|
1298
1306
|
function parseSeqCommand(cmd) {
|
|
1299
1307
|
const t = cmd.trim();
|
|
1300
1308
|
const shorthand = t.match(/^seq\s+(\d+)$/);
|
|
@@ -1309,9 +1317,14 @@ function extractCountFromName(name) {
|
|
|
1309
1317
|
}
|
|
1310
1318
|
function normalizeWorkflow(workflow2) {
|
|
1311
1319
|
const steps = workflow2.steps.map((step) => {
|
|
1312
|
-
if (Array.isArray(step.forEach)
|
|
1313
|
-
const
|
|
1314
|
-
|
|
1320
|
+
if (Array.isArray(step.forEach)) {
|
|
1321
|
+
const arr = step.forEach;
|
|
1322
|
+
const isNumeric = isNumericSequence(arr);
|
|
1323
|
+
const labeledN = !isNumeric ? isLabeledSequence(arr) : null;
|
|
1324
|
+
if (isNumeric || labeledN !== null) {
|
|
1325
|
+
const { forEach, ...rest } = step;
|
|
1326
|
+
return { ...rest, repeat: isNumeric ? arr.length : labeledN };
|
|
1327
|
+
}
|
|
1315
1328
|
}
|
|
1316
1329
|
if (typeof step.forEach === "string") {
|
|
1317
1330
|
const n = parseSeqCommand(step.forEach);
|