second reducer sweep of success

This commit is contained in:
lda
2026-05-17 19:23:12 +07:00 Verified
parent 23dc684c23
commit 8a477081fd
4 changed files with 37 additions and 4 deletions
+14
View File
@@ -78,6 +78,13 @@ def merge_object_reducer(current_value: Any, incoming_value: Any) -> Any:
return current_value | incoming_value
def add_reducer(current_value: Any, incoming_value: Any) -> Any:
"""Add numeric incoming values into a numeric state path."""
if current_value is None:
return incoming_value
return current_value + incoming_value
def set_union_reducer(current_value: Any, incoming_value: Any) -> Any:
"""Merge list values while preserving stable first-seen order."""
if current_value is None:
@@ -126,6 +133,13 @@ DEFAULT_REDUCER_DEFINITIONS: Mapping[str, ReducerDefinition] = {
),
fn=merge_object_reducer,
),
"wf.std.add": ReducerDefinition(
spec=ReducerSpec(
name="wf.std.add",
description="Add numeric incoming values into a numeric state path.",
),
fn=add_reducer,
),
"wf.std.set_union": ReducerDefinition(
spec=ReducerSpec(
name="wf.std.set_union",