VEYNDO
Handbook
crates/flow-graph/README.mdView source ↗

English source · 2 min

Veyndo Flow Graph

Use this Rust crate to validate the structure of a flow before saving it or resuming a worker. It has no dependencies beyond the standard library. Pin the crate to a reviewed Veyndo Git revision when using it from another workspace. The package name is veyndo-flow-graph.

use veyndo_flow_graph::{Graph, Node};
use veyndo_flow_graph::execution::{Directive, ExecutableNode};

struct Stop(&'static str);

impl Node for Stop {
    fn id(&self) -> &str { self.0 }
    fn successors(&self) -> [Option<&str>; 2] { [None, None] }
}

impl ExecutableNode for Stop {
    type Condition = ();
    type Config = ();
    fn directive(&self) -> Directive<'_, (), ()> { Directive::Stop }
}

let steps = [Stop("finish")];
let graph = Graph::validate("finish", &steps, |id| !id.is_empty(), |_| Ok::<(), ()>(()))?;
assert!(graph.get("finish").is_some());
assert!(matches!(graph.directive("finish"), Some(Directive::Stop)));
# Ok::<(), veyndo_flow_graph::Invalid<()>>(())

The validator rejects oversized graphs, missing entry or successor IDs, duplicate IDs, cycles and unreachable nodes. Supply your host's identifier and node policy as callbacks. Veyndo uses its existing condition and action validators and the verified delay limit. Its worker resolves persisted cursors through the same validated graph. Authorization, event delivery and actual execution belong to the host.

Resolve a step

Implement ExecutableNode to use the same graph for execution. A directive returns the branch condition, the action and its configuration, a delay duration or stop. It borrows from the validated definition. Use Branches::select with the boolean produced by your own rule evaluator. Graph::directive returns None for an unknown ID. Keep persisted cursor admission, deadlines, effect receipts and current permissions in your host. Native example and worker setup.

Built-in events and actions

veyndo_flow_graph::catalog exposes VERSION, EVENTS, PIPELINE_ACTIONS and FLOW_ACTIONS. Use them to validate identifiers or populate an editor. For a connected shop, compare the crate version with flowCatalogVersion from GET /api/automation/catalog or automation.catalog over MCP. Use the shop's discovery response for its installed apps and ask Core to validate any change.

use veyndo_flow_graph::catalog::{EVENTS, PIPELINE_ACTIONS, VERSION};

assert_eq!(VERSION, 1);
assert!(EVENTS.contains(&"order.placed"));
assert!(PIPELINE_ACTIONS.contains(&"action.generate.document"));

Run cargo test --locked -p veyndo-flow-graph from the workspace root. Automation guide.