weavegraph 0.7.0

Graph-driven, concurrent agent workflow framework with versioned state, deterministic barrier merges, and rich diagnostics.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Reducer that appends [`ErrorEvent`](crate::channels::errors::ErrorEvent) entries to the errors channel.
use super::Reducer;
use crate::{channels::Channel, node::NodePartial, state::VersionedState};

/// Appends each incoming error event onto the state errors channel.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct AddErrors;

impl Reducer for AddErrors {
    fn apply(&self, state: &mut VersionedState, update: &NodePartial) {
        if let Some(errors) = &update.errors
            && !errors.is_empty()
        {
            state.errors.get_mut().extend_from_slice(errors);
        }
    }
}