weavegraph 0.7.0

Graph-driven, concurrent agent workflow framework with versioned state, deterministic barrier merges, and rich diagnostics.
Documentation
//! Step execution types for workflow runs.

use crate::app::BarrierOutcome;
use crate::node::NodePartial;
use crate::runtimes::session::{SessionState, StateVersions};
use crate::types::NodeKind;

/// Result of executing one superstep.
///
/// The embedded [`BarrierOutcome`] carries the canonical ordering of
/// updates and errors so callers can persist and resume without drift.
#[derive(Debug, Clone)]
pub struct StepReport {
    /// Step index that was executed.
    pub step: u64,
    /// Nodes that ran during this step.
    pub ran_nodes: Vec<NodeKind>,
    /// Nodes that were skipped (version-gated or End nodes).
    pub skipped_nodes: Vec<NodeKind>,
    /// Outcome from applying the barrier.
    pub barrier_outcome: BarrierOutcome,
    /// Frontier for the next step.
    pub next_frontier: Vec<NodeKind>,
    /// Channel versions after this step completed.
    pub state_versions: StateVersions,
    /// Whether the workflow has completed (reached End or empty frontier).
    pub completed: bool,
}

/// Controls which nodes or steps trigger an execution pause.
#[derive(Debug, Clone, Default)]
pub struct StepOptions {
    /// Pause before executing these nodes.
    pub interrupt_before: Vec<NodeKind>,
    /// Pause after executing these nodes.
    pub interrupt_after: Vec<NodeKind>,
    /// Pause after every step (debugging mode).
    pub interrupt_each_step: bool,
}

/// Reason why execution was paused mid-run.
#[derive(Debug, Clone)]
pub enum PausedReason {
    /// Paused before the specified node ran.
    BeforeNode(NodeKind),
    /// Paused after the specified node ran.
    AfterNode(NodeKind),
    /// Paused after the specified step completed.
    AfterStep(u64),
}

/// Snapshot returned when execution is paused rather than completed.
#[derive(Debug, Clone)]
pub struct PausedReport {
    /// Session state at the pause point.
    pub session_state: SessionState,
    /// Why execution was paused.
    pub reason: PausedReason,
}

/// Outcome of a single step attempt.
#[derive(Debug, Clone)]
pub enum StepResult {
    /// Step ran to completion; execution can continue.
    Completed(StepReport),
    /// Execution was paused before the step finished.
    Paused(PausedReport),
}

/// Normalized scheduler output, ready for barrier application.
pub(crate) struct SchedulerOutcome {
    pub ran_nodes: Vec<NodeKind>,
    pub skipped_nodes: Vec<NodeKind>,
    pub partials: Vec<NodePartial>,
}