@synergenius/flow-weaver 0.32.2 → 0.33.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/README.md CHANGED
@@ -58,6 +58,8 @@ Breaking changes may still occur between minor versions during beta. Pin your ve
58
58
 
59
59
  **Extensible pack system:** Node types, deploy targets, CLI commands, and MCP tools are contributed by npm packages. Install community packs or build and publish your own.
60
60
 
61
+ **OpenClaw integration:** Use Flow Weaver inside [OpenClaw](https://openclaw.ai) with the native plugin. Build deterministic workflows through conversation. [Plugin](https://clawhub.ai/plugins/%40synergenius%2Fflow-weaver-openclaw) | [npm](https://www.npmjs.com/package/@synergenius/flow-weaver-openclaw) 🦞
62
+
61
63
  ## Quick Start
62
64
 
63
65
  ```bash
@@ -21,6 +21,8 @@ export interface CompileOptions {
21
21
  write?: boolean;
22
22
  /** Whether to save AST alongside the generated file (default: false) */
23
23
  saveAST?: boolean;
24
+ /** Validation mode: 'draft' suppresses STUB_NODE errors */
25
+ validationMode?: 'strict' | 'draft';
24
26
  }
25
27
  /**
26
28
  * Result of workflow compilation
@@ -38,7 +38,8 @@ export async function compileWorkflow(filePath, options = {}) {
38
38
  }
39
39
  // Validate before generating
40
40
  const { validateWorkflow } = await import('./validate.js');
41
- const validationResult = validateWorkflow(parseResult.ast);
41
+ const validationMode = options.validationMode;
42
+ const validationResult = validateWorkflow(parseResult.ast, validationMode ? { mode: validationMode } : undefined);
42
43
  if (validationResult.errors.length > 0) {
43
44
  const errorMessages = validationResult.errors.map((e) => typeof e === 'string' ? e : e.message);
44
45
  throw new Error(`Validation errors:\n${errorMessages.join('\n')}`);
@@ -5,8 +5,10 @@
5
5
  *
6
6
  * Syntax:
7
7
  * @path Start -> validator:ok -> classifier -> urgencyRouter:fail -> escalate -> Exit
8
+ * @path Start -> A -> C -> Exit, Start -> B -> C
8
9
  *
9
- * Steps separated by ->, each is NodeName optionally followed by :ok or :fail
10
+ * Steps separated by ->, each is NodeName optionally followed by :ok or :fail.
11
+ * Multiple paths can be comma-separated within a single @path tag.
10
12
  */
11
13
  export interface PathStep {
12
14
  node: string;
@@ -17,10 +19,12 @@ export interface PathParseResult {
17
19
  steps: PathStep[];
18
20
  }
19
21
  /**
20
- * Parse a @path line and return structured result.
22
+ * Parse a @path line and return structured results.
23
+ * Supports comma-separated parallel paths in a single @path tag:
24
+ * @path Start -> A -> C -> Exit, Start -> B -> C
21
25
  * Returns null if the line is not a valid @path declaration.
22
26
  */
23
- export declare function parsePathLine(input: string, warnings: string[]): PathParseResult | null;
27
+ export declare function parsePathLine(input: string, warnings: string[]): PathParseResult[] | null;
24
28
  /**
25
29
  * Get serialized grammar for documentation/diagram generation.
26
30
  */
@@ -5,11 +5,13 @@
5
5
  *
6
6
  * Syntax:
7
7
  * @path Start -> validator:ok -> classifier -> urgencyRouter:fail -> escalate -> Exit
8
+ * @path Start -> A -> C -> Exit, Start -> B -> C
8
9
  *
9
- * Steps separated by ->, each is NodeName optionally followed by :ok or :fail
10
+ * Steps separated by ->, each is NodeName optionally followed by :ok or :fail.
11
+ * Multiple paths can be comma-separated within a single @path tag.
10
12
  */
11
13
  import { CstParser } from 'chevrotain';
12
- import { JSDocLexer, PathTag, Identifier, Arrow, Colon, allTokens, } from './tokens.js';
14
+ import { JSDocLexer, PathTag, Identifier, Arrow, Colon, Comma, allTokens, } from './tokens.js';
13
15
  // =============================================================================
14
16
  // Parser Definition
15
17
  // =============================================================================
@@ -18,9 +20,17 @@ class PathParser extends CstParser {
18
20
  super(allTokens);
19
21
  this.performSelfAnalysis();
20
22
  }
21
- // Entry rule: @path pathStep (Arrow pathStep)+
23
+ // Entry rule: @path pathSequence (Comma pathSequence)*
22
24
  pathLine = this.RULE('pathLine', () => {
23
25
  this.CONSUME(PathTag);
26
+ this.SUBRULE(this.pathSequence, { LABEL: 'firstSequence' });
27
+ this.MANY(() => {
28
+ this.CONSUME(Comma);
29
+ this.SUBRULE2(this.pathSequence, { LABEL: 'nextSequence' });
30
+ });
31
+ });
32
+ // pathSequence: pathStep (Arrow pathStep)+
33
+ pathSequence = this.RULE('pathSequence', () => {
24
34
  this.SUBRULE(this.pathStep, { LABEL: 'firstStep' });
25
35
  this.AT_LEAST_ONE(() => {
26
36
  this.CONSUME(Arrow);
@@ -54,6 +64,16 @@ class PathVisitor extends BaseVisitor {
54
64
  this.warnings = warnings;
55
65
  }
56
66
  pathLine(ctx) {
67
+ const results = [];
68
+ results.push(this.pathSequence(ctx.firstSequence[0].children));
69
+ if (ctx.nextSequence) {
70
+ for (const seqCst of ctx.nextSequence) {
71
+ results.push(this.pathSequence(seqCst.children));
72
+ }
73
+ }
74
+ return results;
75
+ }
76
+ pathSequence(ctx) {
57
77
  const steps = [];
58
78
  steps.push(this.pathStep(ctx.firstStep[0].children));
59
79
  for (const stepCst of ctx.nextStep) {
@@ -81,7 +101,9 @@ const visitorInstance = new PathVisitor();
81
101
  // Public API
82
102
  // =============================================================================
83
103
  /**
84
- * Parse a @path line and return structured result.
104
+ * Parse a @path line and return structured results.
105
+ * Supports comma-separated parallel paths in a single @path tag:
106
+ * @path Start -> A -> C -> Exit, Start -> B -> C
85
107
  * Returns null if the line is not a valid @path declaration.
86
108
  */
87
109
  export function parsePathLine(input, warnings) {