Siglo v1.0.0 features an internal, declarative Workflow Graph Model. The graph model cleanly separates workflow structure from runtime execution state, providing inspection, static validation, and tooling capabilities without breaking the sequential flow(...) API.
1. Graph Node Hierarchy
All workflow entities are representable as pure JSON-serializableWorkflowNode data structures:
Node Types
-
StepNode(type: 'step')- Represents an atomic unit of execution.
- Contains:
id,name, optionalmetadata(e.g.reducer,isStrict,timeoutMs,cachedLast).
-
SequenceNode(type: 'sequence')- Represents linear steps executed sequentially.
- Contains:
id,name, and an ordered list ofchildren: WorkflowNode[].
-
ParallelNode(type: 'parallel')- Represents concurrent branches.
- Contains:
id,name,branches: WorkflowNode[],mode('fail-fast' | 'allSettled' | 'race'), andmergeStrategy.
-
BranchNode(type: 'branch')- Represents conditional control flow.
- Contains:
id,name,branches: Record<string, WorkflowNode>, selector function, and optionaldefaultBranch.
-
WaitNode(type: 'wait')- Represents an asynchronous pause (timer or external event).
- Contains:
id,name, optionaleventName,correlationKey,durationMs, andtimeoutMs.
-
MapNode(type: 'map')- Represents controlled iteration with bounded concurrency.
- Contains:
id,name,itemNode: WorkflowNode,concurrency,stopOnError, andpreserveOrder.
2. Converting Workflows to Graphs (toGraph)
Any Step, Flow, nested array, function, or combinator can be converted to a WorkflowNode:
@siglo/monitor: Renders real-time execution DAGs, active node highlights, and duration heatmaps.@siglo/cli: Produces terminal and SVG visualizations viasiglo visualize <workflow>.
3. Graph Validation (validateGraph, assertValidGraph)
Graph validation detects structural defects, missing identifiers, empty branches, or cyclic dependencies prior to execution. Note that flow.run() does not validate graphs automatically at runtime; validation is an explicit static check:
Validation Rules
- Every node must possess a valid string
idand recognizedtype. sequencenodes must have at least one child.parallelnodes must have at least one branch.branchnodes must have at least one branch target.waitnodes must declare either a timer duration or aneventNameandcorrelationKey.mapnodes must specify anitemNodeand a positiveconcurrencyvalue ().- Cycles in the graph are detected and rejected.
4. Graph Inspection API (inspectGraph)
For visualization, developer tools, and analytics, inspectGraph produces a flattened summary with nodes, directed edges, entry points, and terminal exits:
inspection.edges specifies from, to, and an optional human-readable label (e.g., 'when:then', 'when:else', 'branch:credit_card').