@exaudeus/workrail 1.12.1 → 1.13.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/application/services/validation-engine.js +6 -5
- package/dist/application/services/workflow-interpreter.js +1 -7
- package/dist/manifest.json +10 -10
- package/dist/types/workflow-definition.d.ts +1 -0
- package/dist/types/workflow-definition.js +4 -0
- package/dist/v2/durable-core/schemas/artifacts/loop-control.js +2 -1
- package/package.json +1 -1
- package/spec/workflow.schema.json +92 -3
|
@@ -413,9 +413,9 @@ let ValidationEngine = ValidationEngine_1 = class ValidationEngine {
|
|
|
413
413
|
issues.push(`Inline step '${inlineStep.id || 'unknown'}' must have a title`);
|
|
414
414
|
suggestions.push('Add a title to all inline steps');
|
|
415
415
|
}
|
|
416
|
-
if (!
|
|
417
|
-
issues.push(`Inline step '${inlineStep.id || 'unknown'}' must have
|
|
418
|
-
suggestions.push('Add a prompt to all inline steps');
|
|
416
|
+
if (!(0, workflow_definition_1.stepHasPromptSource)(inlineStep)) {
|
|
417
|
+
issues.push(`Inline step '${inlineStep.id || 'unknown'}' must have prompt, promptBlocks, or templateCall`);
|
|
418
|
+
suggestions.push('Add a prompt string, structured promptBlocks, or a templateCall to all inline steps');
|
|
419
419
|
}
|
|
420
420
|
if ((0, workflow_definition_1.isLoopStepDefinition)(inlineStep)) {
|
|
421
421
|
issues.push(`Nested loops are not currently supported. Inline step '${inlineStep.id}' is a loop`);
|
|
@@ -486,8 +486,9 @@ let ValidationEngine = ValidationEngine_1 = class ValidationEngine {
|
|
|
486
486
|
if (!step.title) {
|
|
487
487
|
issues.push(`Step '${step.id}' missing required title`);
|
|
488
488
|
}
|
|
489
|
-
if (!
|
|
490
|
-
issues.push(`Step '${step.id}'
|
|
489
|
+
if (!(0, workflow_definition_1.stepHasPromptSource)(step)) {
|
|
490
|
+
issues.push(`Step '${step.id}' must have prompt, promptBlocks, or templateCall`);
|
|
491
|
+
suggestions.push('Add a prompt string, structured promptBlocks, or a templateCall to each step');
|
|
491
492
|
}
|
|
492
493
|
this.collectQuotedJsonValidationMessageWarnings(step, `Step '${step.id}'`, warnings);
|
|
493
494
|
const callValidation = this.validateStepFunctionCalls(step, workflow.definition.functionDefinitions || []);
|
|
@@ -322,13 +322,7 @@ let WorkflowInterpreter = class WorkflowInterpreter {
|
|
|
322
322
|
if (result.kind === 'found') {
|
|
323
323
|
return (0, neverthrow_1.ok)(result.decision === 'continue');
|
|
324
324
|
}
|
|
325
|
-
return (0, neverthrow_1.
|
|
326
|
-
code: 'LOOP_MISSING_CONTEXT',
|
|
327
|
-
loopId: loopCompiled.loop.id,
|
|
328
|
-
message: result.kind === 'not_found'
|
|
329
|
-
? `Loop '${source.loopId}' requires a wr.loop_control artifact but none was provided`
|
|
330
|
-
: `Loop '${source.loopId}' has an invalid loop control artifact: ${result.reason}`,
|
|
331
|
-
});
|
|
325
|
+
return (0, neverthrow_1.ok)(true);
|
|
332
326
|
}
|
|
333
327
|
case 'context_variable': {
|
|
334
328
|
const raw = (0, condition_evaluator_1.evaluateCondition)(source.condition, this.projectLoopContextAtIteration(loopCompiled.loop, iteration, context));
|
package/dist/manifest.json
CHANGED
|
@@ -94,8 +94,8 @@
|
|
|
94
94
|
"bytes": 2030
|
|
95
95
|
},
|
|
96
96
|
"application/services/validation-engine.js": {
|
|
97
|
-
"sha256": "
|
|
98
|
-
"bytes":
|
|
97
|
+
"sha256": "a2ad656656b8d2554d0a08f6e230c190c72939d11cdba329b8de268d9ad52584",
|
|
98
|
+
"bytes": 31342
|
|
99
99
|
},
|
|
100
100
|
"application/services/workflow-compiler.d.ts": {
|
|
101
101
|
"sha256": "41d0643ae2f07e5ce77a6e02344b5ca5b3c26bde828fbb307528a2ae097ac9d5",
|
|
@@ -110,8 +110,8 @@
|
|
|
110
110
|
"bytes": 1507
|
|
111
111
|
},
|
|
112
112
|
"application/services/workflow-interpreter.js": {
|
|
113
|
-
"sha256": "
|
|
114
|
-
"bytes":
|
|
113
|
+
"sha256": "e6ea1bc6f3881bc46a901b78720dee584090f86809bfa1979f04efa4c8a35613",
|
|
114
|
+
"bytes": 21011
|
|
115
115
|
},
|
|
116
116
|
"application/services/workflow-service.d.ts": {
|
|
117
117
|
"sha256": "b92da17c6d91c90758ec42b4ee3bc448e5d5b1dfe7351f2fe0f5e1d10a715ec6",
|
|
@@ -1114,12 +1114,12 @@
|
|
|
1114
1114
|
"bytes": 395
|
|
1115
1115
|
},
|
|
1116
1116
|
"types/workflow-definition.d.ts": {
|
|
1117
|
-
"sha256": "
|
|
1118
|
-
"bytes":
|
|
1117
|
+
"sha256": "19c5588e038d0d703def5ad59809bd9f7bbf4402999e56e664725cfeb9a0e18c",
|
|
1118
|
+
"bytes": 4035
|
|
1119
1119
|
},
|
|
1120
1120
|
"types/workflow-definition.js": {
|
|
1121
|
-
"sha256": "
|
|
1122
|
-
"bytes":
|
|
1121
|
+
"sha256": "293e18cc856c8b0f4d48858873c5832f7b9d2dc3896256bf19e59c92a222056d",
|
|
1122
|
+
"bytes": 1749
|
|
1123
1123
|
},
|
|
1124
1124
|
"types/workflow-source.d.ts": {
|
|
1125
1125
|
"sha256": "ee439c36ac3002780837ff393120d08a1c21ef2641421cdf72f0e1449d0211eb",
|
|
@@ -1542,8 +1542,8 @@
|
|
|
1542
1542
|
"bytes": 2743
|
|
1543
1543
|
},
|
|
1544
1544
|
"v2/durable-core/schemas/artifacts/loop-control.js": {
|
|
1545
|
-
"sha256": "
|
|
1546
|
-
"bytes":
|
|
1545
|
+
"sha256": "1e0b70991023554e0ea3c858517aee7ffd050ab695a2f31768c4ec3d8de1cf92",
|
|
1546
|
+
"bytes": 2152
|
|
1547
1547
|
},
|
|
1548
1548
|
"v2/durable-core/schemas/compiled-workflow/index.d.ts": {
|
|
1549
1549
|
"sha256": "d909c13d0d46bba1dcd411a0c53e767cf7e4c8bc5206581344ca1e7315552d95",
|
|
@@ -88,5 +88,6 @@ export interface WorkflowDefinition {
|
|
|
88
88
|
}
|
|
89
89
|
export declare function isLoopStepDefinition(step: WorkflowStepDefinition | LoopStepDefinition): step is LoopStepDefinition;
|
|
90
90
|
export declare function isWorkflowStepDefinition(step: WorkflowStepDefinition | LoopStepDefinition): step is WorkflowStepDefinition;
|
|
91
|
+
export declare function stepHasPromptSource(step: WorkflowStepDefinition): boolean;
|
|
91
92
|
export declare function hasWorkflowDefinitionShape(obj: unknown): obj is WorkflowDefinition;
|
|
92
93
|
export declare function createWorkflowDefinition(definition: WorkflowDefinition): WorkflowDefinition;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isLoopStepDefinition = isLoopStepDefinition;
|
|
4
4
|
exports.isWorkflowStepDefinition = isWorkflowStepDefinition;
|
|
5
|
+
exports.stepHasPromptSource = stepHasPromptSource;
|
|
5
6
|
exports.hasWorkflowDefinitionShape = hasWorkflowDefinitionShape;
|
|
6
7
|
exports.createWorkflowDefinition = createWorkflowDefinition;
|
|
7
8
|
function isLoopStepDefinition(step) {
|
|
@@ -10,6 +11,9 @@ function isLoopStepDefinition(step) {
|
|
|
10
11
|
function isWorkflowStepDefinition(step) {
|
|
11
12
|
return !isLoopStepDefinition(step);
|
|
12
13
|
}
|
|
14
|
+
function stepHasPromptSource(step) {
|
|
15
|
+
return Boolean(step.prompt || step.promptBlocks || step.templateCall);
|
|
16
|
+
}
|
|
13
17
|
function hasWorkflowDefinitionShape(obj) {
|
|
14
18
|
if (!obj || typeof obj !== 'object')
|
|
15
19
|
return false;
|
|
@@ -36,7 +36,8 @@ function parseLoopControlArtifact(artifact) {
|
|
|
36
36
|
return result.success ? result.data : null;
|
|
37
37
|
}
|
|
38
38
|
function findLoopControlArtifact(artifacts, loopId) {
|
|
39
|
-
for (
|
|
39
|
+
for (let i = artifacts.length - 1; i >= 0; i--) {
|
|
40
|
+
const artifact = artifacts[i];
|
|
40
41
|
if (!isLoopControlArtifact(artifact))
|
|
41
42
|
continue;
|
|
42
43
|
const parsed = parseLoopControlArtifact(artifact);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://workflowlookup.io/schemas/workflow/v0.
|
|
3
|
+
"$id": "https://workflowlookup.io/schemas/workflow/v0.3.0",
|
|
4
4
|
"title": "Workflow Schema",
|
|
5
5
|
"description": "Schema for defining workflows in the Workflow Orchestration System",
|
|
6
6
|
"type": "object",
|
|
@@ -124,6 +124,16 @@
|
|
|
124
124
|
}
|
|
125
125
|
},
|
|
126
126
|
"additionalProperties": false
|
|
127
|
+
},
|
|
128
|
+
"features": {
|
|
129
|
+
"type": "array",
|
|
130
|
+
"description": "Compiler features to apply to this workflow (e.g. wr.features.memory_context). Features inject content into promptBlocks at compile time.",
|
|
131
|
+
"items": {
|
|
132
|
+
"type": "string",
|
|
133
|
+
"minLength": 1,
|
|
134
|
+
"maxLength": 128
|
|
135
|
+
},
|
|
136
|
+
"uniqueItems": true
|
|
127
137
|
}
|
|
128
138
|
},
|
|
129
139
|
"required": [
|
|
@@ -179,6 +189,7 @@
|
|
|
179
189
|
"id": { "$ref": "#/$defs/stepId", "description": "Unique identifier for the step" },
|
|
180
190
|
"title": { "type": "string", "minLength": 1, "maxLength": 128 },
|
|
181
191
|
"prompt": { "type": "string", "minLength": 1, "maxLength": 8192 },
|
|
192
|
+
"promptBlocks": { "$ref": "#/$defs/promptBlocks" },
|
|
182
193
|
"agentRole": { "type": "string", "minLength": 10, "maxLength": 1024 },
|
|
183
194
|
"guidance": { "type": "array", "items": { "type": "string" } },
|
|
184
195
|
"askForFiles": { "type": "boolean", "default": false },
|
|
@@ -190,9 +201,10 @@
|
|
|
190
201
|
"notesOptional": { "type": "boolean", "description": "When true, output.notesMarkdown is not required for this step. Steps with outputContract are automatically exempt. Use sparingly for mechanical steps with no substantive work to document." },
|
|
191
202
|
"functionDefinitions": { "type": "array", "items": { "$ref": "#/$defs/functionDefinition" } },
|
|
192
203
|
"functionCalls": { "type": "array", "items": { "$ref": "#/$defs/functionCall" } },
|
|
193
|
-
"functionReferences": { "type": "array", "items": { "type": "string", "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*\\(\\)$" } }
|
|
204
|
+
"functionReferences": { "type": "array", "items": { "type": "string", "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*\\(\\)$" } },
|
|
205
|
+
"templateCall": { "$ref": "#/$defs/templateCall" }
|
|
194
206
|
},
|
|
195
|
-
"required": ["id", "title"
|
|
207
|
+
"required": ["id", "title"],
|
|
196
208
|
"additionalProperties": false
|
|
197
209
|
},
|
|
198
210
|
"loopStep": {
|
|
@@ -589,6 +601,83 @@
|
|
|
589
601
|
},
|
|
590
602
|
"required": ["name", "args"],
|
|
591
603
|
"additionalProperties": false
|
|
604
|
+
},
|
|
605
|
+
"promptBlocks": {
|
|
606
|
+
"type": "object",
|
|
607
|
+
"description": "Structured prompt blocks. Alternative to raw prompt string. Rendered into prompt during compilation in deterministic order: goal, constraints, procedure, outputRequired, verify.",
|
|
608
|
+
"properties": {
|
|
609
|
+
"goal": { "$ref": "#/$defs/promptValue" },
|
|
610
|
+
"constraints": {
|
|
611
|
+
"type": "array",
|
|
612
|
+
"items": { "$ref": "#/$defs/promptValue" }
|
|
613
|
+
},
|
|
614
|
+
"procedure": {
|
|
615
|
+
"type": "array",
|
|
616
|
+
"items": { "$ref": "#/$defs/promptValue" }
|
|
617
|
+
},
|
|
618
|
+
"outputRequired": {
|
|
619
|
+
"type": "object",
|
|
620
|
+
"description": "Key-value pairs describing required outputs",
|
|
621
|
+
"additionalProperties": { "type": "string" }
|
|
622
|
+
},
|
|
623
|
+
"verify": {
|
|
624
|
+
"type": "array",
|
|
625
|
+
"items": { "$ref": "#/$defs/promptValue" }
|
|
626
|
+
}
|
|
627
|
+
},
|
|
628
|
+
"additionalProperties": false
|
|
629
|
+
},
|
|
630
|
+
"promptValue": {
|
|
631
|
+
"description": "A prompt value: either a plain string or an array of prompt parts (text and refs).",
|
|
632
|
+
"oneOf": [
|
|
633
|
+
{ "type": "string" },
|
|
634
|
+
{
|
|
635
|
+
"type": "array",
|
|
636
|
+
"items": { "$ref": "#/$defs/promptPart" }
|
|
637
|
+
}
|
|
638
|
+
]
|
|
639
|
+
},
|
|
640
|
+
"promptPart": {
|
|
641
|
+
"description": "A single part of a prompt value: literal text or a reference to a canonical WorkRail snippet.",
|
|
642
|
+
"oneOf": [
|
|
643
|
+
{
|
|
644
|
+
"type": "object",
|
|
645
|
+
"properties": {
|
|
646
|
+
"kind": { "const": "text" },
|
|
647
|
+
"text": { "type": "string" }
|
|
648
|
+
},
|
|
649
|
+
"required": ["kind", "text"],
|
|
650
|
+
"additionalProperties": false
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
"type": "object",
|
|
654
|
+
"properties": {
|
|
655
|
+
"kind": { "const": "ref" },
|
|
656
|
+
"refId": { "type": "string", "minLength": 1 }
|
|
657
|
+
},
|
|
658
|
+
"required": ["kind", "refId"],
|
|
659
|
+
"additionalProperties": false
|
|
660
|
+
}
|
|
661
|
+
]
|
|
662
|
+
},
|
|
663
|
+
"templateCall": {
|
|
664
|
+
"type": "object",
|
|
665
|
+
"description": "Template call: expands this step into one or more steps at compile time.",
|
|
666
|
+
"properties": {
|
|
667
|
+
"templateId": {
|
|
668
|
+
"type": "string",
|
|
669
|
+
"description": "The template ID to expand (e.g. wr.templates.capability_probe)",
|
|
670
|
+
"minLength": 1,
|
|
671
|
+
"maxLength": 128
|
|
672
|
+
},
|
|
673
|
+
"args": {
|
|
674
|
+
"type": "object",
|
|
675
|
+
"description": "Arguments to pass to the template",
|
|
676
|
+
"additionalProperties": true
|
|
677
|
+
}
|
|
678
|
+
},
|
|
679
|
+
"required": ["templateId"],
|
|
680
|
+
"additionalProperties": false
|
|
592
681
|
}
|
|
593
682
|
}
|
|
594
683
|
}
|