weavegraph 0.7.0

Graph-driven, concurrent agent workflow framework with versioned state, deterministic barrier merges, and rich diagnostics.
Documentation
//! Control-flow directives emitted by nodes to shape the next scheduling frontier.

use crate::types::NodeKind;

/// A destination node referenced by a frontier routing command.
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum NodeRoute {
    /// Concrete node in the graph.
    Node(NodeKind),
}

impl NodeRoute {
    /// Borrow the underlying [`NodeKind`].
    #[must_use]
    pub fn kind(&self) -> &NodeKind {
        let Self::Node(k) = self;
        k
    }

    /// Return an owned copy of the underlying [`NodeKind`].
    #[must_use]
    pub fn to_node_kind(&self) -> NodeKind {
        self.kind().clone()
    }
}

impl From<NodeKind> for NodeRoute {
    fn from(k: NodeKind) -> Self {
        Self::Node(k)
    }
}

/// Directive emitted by a node to modify how the barrier builds the next frontier.
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum FrontierCommand {
    /// Add routes alongside those produced by normal edge resolution.
    Append(Vec<NodeRoute>),
    /// Replace normal edge routes with exactly these routes.
    Replace(Vec<NodeRoute>),
}