@parcha/agentrun-dsl 0.1.0-beta.289 → 0.1.0-beta.290
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/workflow.js +6 -4
- package/package.json +1 -1
package/dist/workflow.js
CHANGED
|
@@ -921,7 +921,7 @@ export function validateWorkflow(workflow, opts) {
|
|
|
921
921
|
};
|
|
922
922
|
const checkQuestionSchema = (schemaId, label, path) => {
|
|
923
923
|
if (typeof schemaId !== "string" || !Object.hasOwn(workflow.schemas, schemaId)) {
|
|
924
|
-
fail("SCHEMA_UNKNOWN", ptrOf(path), `${path} (${label}):
|
|
924
|
+
fail("SCHEMA_UNKNOWN", ptrOf(path), `${path} (${label}): ${unknownOut(schemaId)}`);
|
|
925
925
|
return null;
|
|
926
926
|
}
|
|
927
927
|
const compiled = compileQuestions(workflow.schemas[schemaId], workflow.schemas);
|
|
@@ -1063,7 +1063,7 @@ export function validateWorkflow(workflow, opts) {
|
|
|
1063
1063
|
if (!node.instructions?.trim())
|
|
1064
1064
|
fail("NODE_FIELD_INVALID", ptrOf(path), `${path} (${node.label}): instructions required`);
|
|
1065
1065
|
if (node.node !== "report" && !Object.hasOwn(workflow.schemas, node.out))
|
|
1066
|
-
fail("SCHEMA_UNKNOWN", ptrOf(path), `${path} (${node.label}):
|
|
1066
|
+
fail("SCHEMA_UNKNOWN", ptrOf(path), `${path} (${node.label}): ${unknownOut(node.out)}`);
|
|
1067
1067
|
if (node.thinking !== undefined && !THINKING_LEVELS.includes(String(node.thinking)))
|
|
1068
1068
|
fail("NODE_FIELD_INVALID", ptrOf(path), `${path} (${node.label}): thinking must be low|medium|high — thinking is never off`);
|
|
1069
1069
|
if (node.tools !== undefined && (!Array.isArray(node.tools) || node.tools.some((t) => typeof t !== "string" || !t.trim())))
|
|
@@ -1437,7 +1437,7 @@ export function validateWorkflow(workflow, opts) {
|
|
|
1437
1437
|
if (typeof node.label !== "string" || !node.label.trim() || typeof node.as !== "string" || !node.as.trim())
|
|
1438
1438
|
fail("NODE_FIELD_INVALID", ptrOf(path), `${path} (${label}): a workflow invocation requires label and as`);
|
|
1439
1439
|
if (!Object.hasOwn(workflow.schemas, node.out))
|
|
1440
|
-
fail("SCHEMA_UNKNOWN", ptrOf(path), `${path} (${label}):
|
|
1440
|
+
fail("SCHEMA_UNKNOWN", ptrOf(path), `${path} (${label}): ${unknownOut(node.out)}`);
|
|
1441
1441
|
if (!isRecord(node.input))
|
|
1442
1442
|
fail("NODE_FIELD_INVALID", ptrOf(path), `${path} (${label}): input must be an object mapping onto the child's initial state`);
|
|
1443
1443
|
else if (Object.hasOwn(node.input, HOST_STATE_KEY))
|
|
@@ -1515,7 +1515,7 @@ export function validateWorkflow(workflow, opts) {
|
|
|
1515
1515
|
if (!node.out)
|
|
1516
1516
|
fail("SCHEMA_UNKNOWN", ptrOf(path), `${path} (${label}): out schema required for a ${node.via} call`);
|
|
1517
1517
|
else if (!Object.hasOwn(workflow.schemas, node.out))
|
|
1518
|
-
fail("SCHEMA_UNKNOWN", ptrOf(path), `${path} (${label}):
|
|
1518
|
+
fail("SCHEMA_UNKNOWN", ptrOf(path), `${path} (${label}): ${unknownOut(node.out)}`);
|
|
1519
1519
|
}
|
|
1520
1520
|
if (!node.as?.trim())
|
|
1521
1521
|
fail("NODE_FIELD_INVALID", ptrOf(path), `${path} (${label}): as required`);
|
|
@@ -3453,6 +3453,8 @@ function sliceSop(sop, section) {
|
|
|
3453
3453
|
const next = rest.search(boundary);
|
|
3454
3454
|
return sop.slice(start, next < 0 ? undefined : start + 3 + next);
|
|
3455
3455
|
}
|
|
3456
|
+
/** A node's `out` that names no schema in workflow.schemas, in words: one not given is required, never "undefined". */
|
|
3457
|
+
const unknownOut = (out) => typeof out === "string" && out ? `out schema "${out}" not in workflow.schemas` : "out schema required (one of workflow.schemas)";
|
|
3456
3458
|
export class WorkflowVerificationError extends Error {
|
|
3457
3459
|
stage;
|
|
3458
3460
|
candidate;
|