pub struct FoldNode {
pub id: String,
pub name: Option<String>,
pub body: FoldBody,
pub max_iterations: u32,
pub stop_when: String,
pub join: FoldJoin,
pub accumulator_schema: Option<Value>,
}Expand description
A fold node: bounded iteration that accumulates across passes.
Models an adversarial refine loop as one node: a body is run up to
max_iterations times, each pass folding into an accumulated value, and the
loop stops when stop_when holds over that value (or the bound is reached).
The join rule then selects the value the node produces. Every field is
author-time data; this crate never runs the loop.
Grounded in the AARG tailor loop the graph wiring models: bounded revisions
(max_iterations), a stop predicate over the accumulated score
(stop_when, an expression in the same language a branch case uses), and an
argmax winner (join = FoldJoin::BestBy over the score). See the
crate-level docs and the graph wiring plan.
Fields§
§id: StringThe node’s stable id, unique within the document.
name: Option<String>Optional short display label for this node. See the module docs’ “The
optional node display name” section for the bound and the deliberate
hash-inclusion contrast with the agent name field. Additive: absent
on the wire when unset.
body: FoldBodyWhat each pass runs: a node already in this document, or an embedded
sub-graph. Not implemented exactly as MapBody’s subgraph form is not —
the shape is legal, but no engine runs it yet.
max_iterations: u32The iteration bound: the most passes the loop may run. Must be at least
1; [crate::validate] reports a zero bound by node id.
stop_when: StringA boolean expression over the accumulated value that stops the loop when
it holds. Written in the crate::expr condition language, the same one
a BranchCondition::Expression uses, and validated at submit so a
malformed predicate is a node-precise error, never a run-time failure.
join: FoldJoinHow the passes are folded into the value the node produces.
accumulator_schema: Option<Value>Optional JSON Schema for the accumulated value the loop carries and
produces. Data only, like an AgentNode’s output_schema: recorded
for authoring and tooling, never wired into the edge type-compatibility
check (a fold’s produced-value semantics are not implemented with
its execution). Additive: absent on the wire when unset.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FoldNode
impl<'de> Deserialize<'de> for FoldNode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for FoldNode
impl JsonSchema for FoldNode
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more