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
//! Reducer that appends messages from a [`NodePartial`] to the messages channel.
use super::Reducer;
use crate::{channels::Channel, node::NodePartial, state::VersionedState};

/// Appends each incoming message onto the state messages channel.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct AddMessages;

impl Reducer for AddMessages {
    fn apply(&self, state: &mut VersionedState, update: &NodePartial) {
        if let Some(msgs) = &update.messages {
            state.messages.get_mut().extend_from_slice(msgs);
        }
    }
}