Facepunch.ActionGraphs 1.9.11

dotnet add package Facepunch.ActionGraphs --version 1.9.11                
NuGet\Install-Package Facepunch.ActionGraphs -Version 1.9.11                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Facepunch.ActionGraphs" Version="1.9.11" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Facepunch.ActionGraphs --version 1.9.11                
#r "nuget: Facepunch.ActionGraphs, 1.9.11"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Facepunch.ActionGraphs as a Cake Addin
#addin nuget:?package=Facepunch.ActionGraphs&version=1.9.11

// Install Facepunch.ActionGraphs as a Cake Tool
#tool nuget:?package=Facepunch.ActionGraphs&version=1.9.11                

Facepunch.ActionGraphs

Runtime-composable async methods that can be converted to and from JSON.

Overview

An action graph is made out of nodes, links and variables. Nodes either perform actions or evaluate expressions, and links connect them together to shuttle values or signals around. Variables provide storage local to each invocation of the graph, and are used to capture values at specific points during invocation. Arbitrary user data can be stored on each element, which could be used by a visual editor. Validation is performed to find any errors or warnings, and any errors will mean a graph can't be invoked. Node definitions are stored in a node library, and each graph will belong to exactly one such library to supply its node definitions. Action graphs can be serialized to JSON, and Delegate types created using graphs can also be serialized directly.

Node

Nodes have a definition and a binding. Bindings specify which properties, inputs, and outputs a node has. Inputs and outputs may transmit values or signals. A node with signal inputs / outputs is an Action node, which is invoked when an input signal fires. Nodes without any signal inputs / outputs are Expression nodes, which are lazily evaluated when any of their output values are requested by an Action node.

Nodes

Definition

A node definition describes what the node will do, and provides bindings based on which property values and input types a node currently has. Each definition will belong to exactly one node library, and has a unique name in that library. There are built-in definitions for common nodes like operators, getting / setting variables, and the event node which acts as an entry point.

Binding

Definitions provide bindings, which are specifically typed sets of properties, inputs, and outputs. Depending on the definition, the binding of a node may change as you connect inputs or assign properties. For example, the type of the result output of an op.add addition node depends on the types of the provided inputs.

Property

Properties are constant named values stored in a node, which control its binding. For example: a var.set node, which would set a variable when invoked, has a property specifying which variable it will assign. Changing that property will change the input value type of the node, to match the variable type.

Input

A node input will either receive a signal or a value.

Input values can be provided by another node's output through a Link, or a constant value stored inside the input. Input signals can only be provided by an output signal from another node, and control when the receiving node executes.

If an input value accepts an array type, it may be linked to multiple outputs in a specific order to provide the individual items of an array. Otherwise, inputs link to at most one output.

Output

A node output will emit either a signal or a value.

Output signals may fire mutliple times per invocation of the node, for example the body output of the loop node control.foreach will fire once per element in the items input value. If multiple input signals are connected to the same output signal, the receiving nodes will act as independent concurrent tasks.

Output values of Action nodes may be provided by a specific output signal, and can only be used downstream of that output signal.

Output values of expression nodes are always available, and will be evaluated lazily when requested by an Action node.

Links are the connections between an output and an input. An output signal can only connect to input signals, and an output value can only connect to input values. See input and output for more details.

Variable

Variables are provided as a way to capture values at specific points to be read later on.

Each variable has a specific name and type. They are referenced in var.set and var.get nodes, and must be set before they can be read. They are local to each invocation of an action graph, so if multiple instances of the same graph are running simultaneously they won't share variables.

Node Library

Creating a node library is required to use action graphs. These contain all the node definitions available when building a graph. An ITypeLoader must be provided to wrap any reflection, in case you want to restrict which types can be used in a graph.

There are some built-in special node definitions that are provided by every node library. For example, the event entry point node, var.get and var.set for using variables, and one for each operator like op.add.

Custom Nodes

Custom nodes can be implemented as static C# methods. An [Node( "ident" )] is used for action node methods, and [Node( "ident" ), Pure] for expression node methods. Methods marked with these attributes will be added to a library when calling NodeLibrary.AddAssembly(asm). The parameters of the method will describe the properties, inputs and outputs of the node.

Properties are defined with parameters marked with a [Property] attribute.

Action node methods must return either void or a Task. Expression node methods must return a non-Task, and an output will be generated to emit the return value. Output signals for action nodes are parameters with a delegate type, and they will have corresponding output values based on the delegate parameters. The method can invoke these delegate parameters to emit output signals. If the delegates return Tasks, they will complete when all control flow downstream of the emitted signal has finished.

All other parameters will become inputs for the node. An input with type Input<T> can be evaluated on demand by the method, allowing for input values that change during the invocation of the method. All other input values will be evaluated just before the method is invoked.

Generic methods are largely supported, and will produce a node that can change its binding as input or property types are modified.

User Data

Each main element of an action graph has a UserData property, which can store arbitary named values serialized as JSON nodes. This could be used to record each node's position in a visual editor, for example.

Validation

Each time an action graph is modified, elements will be marked as needing validation. This validation is performed either when attempting to invoke the graph, or when accessing the Messages property. This property will be populated with a list of information, warnings and errors, each describing the context and cause. Any error messages will mean the ActionGraph can't be invoked.

You can also access the messages specific to a particular node / link / property / input / output / variable by using the element.GetMessages() extension method. Accessing this will also cause validation to occur, if any elements have changed since the last validation.

Invocation

After validation succeeds, an action graph can be invoked. Special event nodes act as the entry point during invocation, which can have named parameters that provide output values on the event node. If an action graph is created to match the signature of a particular delegate type, an event node is automatically created with the right output values.

Invocation is asynchronous, and returns a Task that completes when all action nodes have finished acting. If the same action graph instance is invoked multiple times, the separate invocations act in parallel and have their own local variables.

Action graphs can also be converted to delegate instances, as long as they match that delegate's signature. Invoking the delegate will invoke the graph.

Serialization

To be able to serialize action graphs with System.Text.Json, a JsonSerializerOptions instance must have the AddActionGraphConverters() extension method called on it. After that it can convert ActionGraph, ActionGraph<T>, and even delegate instances that are created from action graphs.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.9.11 105 12/13/2024
1.9.10 74 12/13/2024
1.9.9 76 12/13/2024
1.9.8 71 12/13/2024
1.9.7 71 12/13/2024
1.9.6 67 12/13/2024
1.9.5 84 12/12/2024
1.9.4 74 12/12/2024
1.9.3 75 12/12/2024
1.9.2 105 11/11/2024
1.9.1 102 11/11/2024
1.9.0 95 11/8/2024
1.8.54 100 12/2/2024
1.8.53 119 11/6/2024
1.8.52 81 11/6/2024
1.8.51 91 11/5/2024
1.8.50 106 11/5/2024
1.8.49 83 11/5/2024
1.8.48 96 11/4/2024
1.8.47 89 11/4/2024
1.8.46 104 10/31/2024
1.8.45 83 10/31/2024
1.8.44 90 10/31/2024
1.8.43 90 10/30/2024
1.8.42 102 10/25/2024
1.8.41 90 10/25/2024
1.8.40 156 10/18/2024
1.8.39 92 10/8/2024
1.8.38 91 10/8/2024
1.8.37 117 10/8/2024
1.8.36 87 10/7/2024
1.8.35 99 10/7/2024
1.8.34 87 10/7/2024
1.8.33 84 10/7/2024
1.8.32 85 10/7/2024
1.8.31 91 10/7/2024
1.8.30 102 10/7/2024
1.8.29 113 10/3/2024
1.8.28 91 10/2/2024
1.8.27 95 9/30/2024
1.8.26 98 9/26/2024
1.8.25 92 9/26/2024
1.8.24 114 9/26/2024
1.8.23 110 9/25/2024
1.8.22 97 9/25/2024
1.8.21 85 9/25/2024
1.8.20 107 9/23/2024
1.8.19 100 9/20/2024
1.8.18 95 9/20/2024
1.8.17 119 9/20/2024
1.8.16 104 9/19/2024
1.8.15 106 9/18/2024
1.8.14 104 9/18/2024
1.8.13 123 9/18/2024
1.8.12 100 9/18/2024
1.8.11 91 9/17/2024
1.8.10 103 9/17/2024
1.8.9 117 9/17/2024
1.8.8 119 9/17/2024
1.8.7 101 9/17/2024
1.8.6 109 9/16/2024
1.8.5 121 9/13/2024
1.8.4 116 9/13/2024
1.8.3 108 9/13/2024
1.8.2 114 9/13/2024
1.8.1 109 9/13/2024
1.8.0 117 9/13/2024
1.7.18 119 9/12/2024
1.7.17 109 9/12/2024
1.7.16 118 9/11/2024
1.7.15 112 9/11/2024
1.7.14 112 9/11/2024
1.7.13 139 9/10/2024
1.7.12 107 9/6/2024
1.7.11 167 7/2/2024
1.7.10 122 7/2/2024
1.7.9 101 7/1/2024
1.7.8 114 6/10/2024
1.7.7 99 6/10/2024
1.7.6 138 5/25/2024
1.7.5 113 5/25/2024
1.7.4 113 5/25/2024
1.7.3 127 5/21/2024
1.7.2 129 5/16/2024
1.7.1 110 5/3/2024
1.7.0 131 4/30/2024
1.6.21 123 4/22/2024
1.6.20 110 4/20/2024
1.6.19 109 4/20/2024
1.6.18 113 4/18/2024
1.6.17 117 4/18/2024
1.6.16 103 4/18/2024
1.6.15 112 4/17/2024
1.6.14 147 4/10/2024
1.6.13 107 4/10/2024
1.6.12 108 4/10/2024
1.6.11 111 4/8/2024
1.6.10 121 4/2/2024
1.6.9 133 3/20/2024
1.6.8 117 3/19/2024
1.6.7 124 3/18/2024
1.6.6 125 3/16/2024
1.6.5 118 3/16/2024
1.6.4 122 3/16/2024
1.6.3 128 3/16/2024
1.6.2 120 3/16/2024
1.6.1 109 3/16/2024
1.3.103 136 4/8/2024
1.3.102 147 4/3/2024
1.3.101 115 4/3/2024
1.3.100 137 3/22/2024
1.3.99 115 3/22/2024
1.3.98 116 3/22/2024
1.3.97 127 3/22/2024
1.3.96 92 3/22/2024
1.3.95 116 3/22/2024
1.3.94 146 3/11/2024
1.3.93 120 3/11/2024
1.3.92 107 3/11/2024
1.3.91 123 3/11/2024
1.3.90 118 3/8/2024
1.3.89 131 3/7/2024
1.3.88 136 3/5/2024
1.3.87 153 3/1/2024
1.3.86 126 3/1/2024
1.3.85 125 2/29/2024
1.3.84 109 2/29/2024
1.3.83 124 2/29/2024
1.3.82 111 2/29/2024
1.3.81 87 2/29/2024
1.3.80 108 2/29/2024
1.3.79 112 2/28/2024
1.3.78 105 2/28/2024
1.3.77 136 2/28/2024
1.3.76 117 2/28/2024
1.3.75 123 2/28/2024
1.3.74 110 2/27/2024
1.3.73 111 2/27/2024
1.3.72 118 2/26/2024
1.3.71 135 2/26/2024
1.3.70 123 2/26/2024
1.3.69 117 2/26/2024
1.3.68 121 2/26/2024
1.3.67 121 2/23/2024
1.3.66 129 2/22/2024
1.3.65 122 2/20/2024
1.3.64 119 2/20/2024
1.3.63 121 2/20/2024
1.3.62 106 2/19/2024
1.3.61 121 2/19/2024
1.3.60 111 2/16/2024
1.3.59 114 2/16/2024
1.3.58 135 2/15/2024
1.3.57 122 2/15/2024
1.3.56 118 2/15/2024
1.3.55 112 2/15/2024
1.3.54 127 2/14/2024
1.3.53 107 2/14/2024
1.3.52 110 2/14/2024
1.3.51 116 2/14/2024
1.3.50 115 2/14/2024
1.3.49 119 2/13/2024
1.3.48 122 2/11/2024
1.3.47 121 2/10/2024
1.3.46 129 2/10/2024
1.3.45 130 2/9/2024
1.3.44 136 2/9/2024
1.3.43 130 2/8/2024
1.3.42 130 2/8/2024
1.3.41 132 2/8/2024
1.3.40 131 2/7/2024
1.3.39 140 2/7/2024
1.3.38 131 2/7/2024
1.3.37 126 2/6/2024
1.3.36 123 2/6/2024
1.3.35 136 2/6/2024
1.3.34 125 1/31/2024
1.3.33 139 1/30/2024
1.3.32 119 1/30/2024
1.3.31 123 1/30/2024
1.3.30 113 1/30/2024
1.3.29 113 1/30/2024
1.3.28 126 1/29/2024
1.3.27 111 1/29/2024
1.3.26 103 1/29/2024
1.3.25 118 1/27/2024
1.3.24 107 1/26/2024
1.3.23 124 1/26/2024
1.3.22 114 1/26/2024
1.3.21 119 1/26/2024
1.3.20 114 1/25/2024
1.3.19 122 1/25/2024
1.3.18 120 1/25/2024
1.3.17 122 1/25/2024
1.3.16 118 1/24/2024
1.3.15 117 1/24/2024
1.3.14 118 1/24/2024
1.3.13 119 1/23/2024
1.3.12 114 1/23/2024
1.3.11 112 1/23/2024
1.3.10 116 1/23/2024
1.3.9 117 1/23/2024
1.3.8 111 1/23/2024
1.3.7 111 1/23/2024
1.3.6 104 1/22/2024
1.3.5 111 1/22/2024
1.3.4 133 1/19/2024
1.3.3 131 1/19/2024
1.3.2 105 1/19/2024
1.3.1 118 1/19/2024
1.3.0 112 1/19/2024
1.2.10 99 1/19/2024
1.2.9 127 1/18/2024
1.2.8 122 1/18/2024
1.2.7 100 1/18/2024
1.2.6 115 1/18/2024
1.2.5 135 1/17/2024
1.2.4 130 1/16/2024
1.2.3 126 1/16/2024
1.2.2 127 1/16/2024
1.2.1 130 1/16/2024
1.2.0 125 1/16/2024
1.1.37 144 1/13/2024
1.1.36 119 1/13/2024
1.1.35 139 1/12/2024
1.1.34 130 1/12/2024
1.1.33 125 1/12/2024
1.1.32 112 1/12/2024
1.1.31 125 1/12/2024
1.1.30 122 1/11/2024
1.1.29 124 1/11/2024
1.1.28 115 1/11/2024
1.1.27 105 1/11/2024
1.1.26 104 1/11/2024
1.1.25 144 1/11/2024
1.1.24 147 1/9/2024
1.1.23 151 1/8/2024
1.1.22 135 1/8/2024
1.1.21 165 1/5/2024
1.1.20 139 1/4/2024
1.1.19 138 1/4/2024
1.1.18 135 1/4/2024
1.1.17 134 1/4/2024
1.1.16 134 1/4/2024
1.1.15 219 12/7/2023
1.1.14 160 12/7/2023
1.1.13 161 12/6/2023
1.1.12 142 12/4/2023
1.1.11 162 12/2/2023
1.1.10 160 11/27/2023
1.1.9 183 11/24/2023
1.1.8 167 11/24/2023
1.1.7 172 11/22/2023
1.1.6 161 11/22/2023
1.1.5 136 11/21/2023
1.1.4 158 11/21/2023
1.1.3 179 11/17/2023
1.1.2 163 11/16/2023
1.1.1 151 11/16/2023
1.1.0 137 11/15/2023
1.0.17 161 11/8/2023
1.0.16 147 11/8/2023
1.0.15 140 11/7/2023
1.0.14 155 11/6/2023
1.0.13 160 11/1/2023
1.0.12 148 11/1/2023
1.0.11 151 10/31/2023
1.0.10 170 10/31/2023
1.0.9 157 10/31/2023
1.0.8 150 10/30/2023
1.0.7 155 10/27/2023
1.0.6 155 10/27/2023
1.0.5 157 10/27/2023
1.0.4 160 10/27/2023
1.0.3 156 10/25/2023
1.0.2 162 10/24/2023
1.0.1 134 10/24/2023
1.0.0 160 10/24/2023