Facepunch.ActionGraphs
1.3.27
See the version list below for details.
dotnet add package Facepunch.ActionGraphs --version 1.3.27
NuGet\Install-Package Facepunch.ActionGraphs -Version 1.3.27
<PackageReference Include="Facepunch.ActionGraphs" Version="1.3.27" />
paket add Facepunch.ActionGraphs --version 1.3.27
#r "nuget: Facepunch.ActionGraphs, 1.3.27"
// Install Facepunch.ActionGraphs as a Cake Addin #addin nuget:?package=Facepunch.ActionGraphs&version=1.3.27 // Install Facepunch.ActionGraphs as a Cake Tool #tool nuget:?package=Facepunch.ActionGraphs&version=1.3.27
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.
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.
Link
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 Task
s, 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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- No dependencies.
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.2 | 72 | 11/11/2024 |
1.9.1 | 75 | 11/11/2024 |
1.9.0 | 73 | 11/8/2024 |
1.8.53 | 93 | 11/6/2024 |
1.8.52 | 62 | 11/6/2024 |
1.8.51 | 69 | 11/5/2024 |
1.8.50 | 86 | 11/5/2024 |
1.8.49 | 64 | 11/5/2024 |
1.8.48 | 73 | 11/4/2024 |
1.8.47 | 67 | 11/4/2024 |
1.8.46 | 84 | 10/31/2024 |
1.8.45 | 62 | 10/31/2024 |
1.8.44 | 73 | 10/31/2024 |
1.8.43 | 71 | 10/30/2024 |
1.8.42 | 84 | 10/25/2024 |
1.8.41 | 76 | 10/25/2024 |
1.8.40 | 140 | 10/18/2024 |
1.8.39 | 78 | 10/8/2024 |
1.8.38 | 79 | 10/8/2024 |
1.8.37 | 101 | 10/8/2024 |
1.8.36 | 72 | 10/7/2024 |
1.8.35 | 81 | 10/7/2024 |
1.8.34 | 73 | 10/7/2024 |
1.8.33 | 68 | 10/7/2024 |
1.8.32 | 67 | 10/7/2024 |
1.8.31 | 71 | 10/7/2024 |
1.8.30 | 88 | 10/7/2024 |
1.8.29 | 100 | 10/3/2024 |
1.8.28 | 77 | 10/2/2024 |
1.8.27 | 84 | 9/30/2024 |
1.8.26 | 87 | 9/26/2024 |
1.8.25 | 78 | 9/26/2024 |
1.8.24 | 99 | 9/26/2024 |
1.8.23 | 93 | 9/25/2024 |
1.8.22 | 78 | 9/25/2024 |
1.8.21 | 74 | 9/25/2024 |
1.8.20 | 96 | 9/23/2024 |
1.8.19 | 90 | 9/20/2024 |
1.8.18 | 84 | 9/20/2024 |
1.8.17 | 108 | 9/20/2024 |
1.8.16 | 94 | 9/19/2024 |
1.8.15 | 95 | 9/18/2024 |
1.8.14 | 93 | 9/18/2024 |
1.8.13 | 112 | 9/18/2024 |
1.8.12 | 87 | 9/18/2024 |
1.8.11 | 80 | 9/17/2024 |
1.8.10 | 90 | 9/17/2024 |
1.8.9 | 103 | 9/17/2024 |
1.8.8 | 108 | 9/17/2024 |
1.8.7 | 90 | 9/17/2024 |
1.8.6 | 98 | 9/16/2024 |
1.8.5 | 108 | 9/13/2024 |
1.8.4 | 101 | 9/13/2024 |
1.8.3 | 97 | 9/13/2024 |
1.8.2 | 104 | 9/13/2024 |
1.8.1 | 96 | 9/13/2024 |
1.8.0 | 103 | 9/13/2024 |
1.7.18 | 108 | 9/12/2024 |
1.7.17 | 97 | 9/12/2024 |
1.7.16 | 105 | 9/11/2024 |
1.7.15 | 97 | 9/11/2024 |
1.7.14 | 101 | 9/11/2024 |
1.7.13 | 124 | 9/10/2024 |
1.7.12 | 96 | 9/6/2024 |
1.7.11 | 155 | 7/2/2024 |
1.7.10 | 111 | 7/2/2024 |
1.7.9 | 90 | 7/1/2024 |
1.7.8 | 105 | 6/10/2024 |
1.7.7 | 87 | 6/10/2024 |
1.7.6 | 123 | 5/25/2024 |
1.7.5 | 101 | 5/25/2024 |
1.7.4 | 100 | 5/25/2024 |
1.7.3 | 115 | 5/21/2024 |
1.7.2 | 118 | 5/16/2024 |
1.7.1 | 97 | 5/3/2024 |
1.7.0 | 121 | 4/30/2024 |
1.6.21 | 113 | 4/22/2024 |
1.6.20 | 97 | 4/20/2024 |
1.6.19 | 100 | 4/20/2024 |
1.6.18 | 104 | 4/18/2024 |
1.6.17 | 106 | 4/18/2024 |
1.6.16 | 94 | 4/18/2024 |
1.6.15 | 101 | 4/17/2024 |
1.6.14 | 134 | 4/10/2024 |
1.6.13 | 95 | 4/10/2024 |
1.6.12 | 99 | 4/10/2024 |
1.6.11 | 102 | 4/8/2024 |
1.6.10 | 108 | 4/2/2024 |
1.6.9 | 121 | 3/20/2024 |
1.6.8 | 106 | 3/19/2024 |
1.6.7 | 114 | 3/18/2024 |
1.6.6 | 111 | 3/16/2024 |
1.6.5 | 108 | 3/16/2024 |
1.6.4 | 112 | 3/16/2024 |
1.6.3 | 112 | 3/16/2024 |
1.6.2 | 111 | 3/16/2024 |
1.6.1 | 99 | 3/16/2024 |
1.3.103 | 127 | 4/8/2024 |
1.3.102 | 137 | 4/3/2024 |
1.3.101 | 103 | 4/3/2024 |
1.3.100 | 128 | 3/22/2024 |
1.3.99 | 105 | 3/22/2024 |
1.3.98 | 107 | 3/22/2024 |
1.3.97 | 115 | 3/22/2024 |
1.3.96 | 78 | 3/22/2024 |
1.3.95 | 103 | 3/22/2024 |
1.3.94 | 137 | 3/11/2024 |
1.3.93 | 111 | 3/11/2024 |
1.3.92 | 98 | 3/11/2024 |
1.3.91 | 114 | 3/11/2024 |
1.3.90 | 107 | 3/8/2024 |
1.3.89 | 117 | 3/7/2024 |
1.3.88 | 127 | 3/5/2024 |
1.3.87 | 143 | 3/1/2024 |
1.3.86 | 113 | 3/1/2024 |
1.3.85 | 114 | 2/29/2024 |
1.3.84 | 98 | 2/29/2024 |
1.3.83 | 115 | 2/29/2024 |
1.3.82 | 97 | 2/29/2024 |
1.3.81 | 78 | 2/29/2024 |
1.3.80 | 99 | 2/29/2024 |
1.3.79 | 101 | 2/28/2024 |
1.3.78 | 95 | 2/28/2024 |
1.3.77 | 118 | 2/28/2024 |
1.3.76 | 105 | 2/28/2024 |
1.3.75 | 112 | 2/28/2024 |
1.3.74 | 101 | 2/27/2024 |
1.3.73 | 97 | 2/27/2024 |
1.3.72 | 105 | 2/26/2024 |
1.3.71 | 122 | 2/26/2024 |
1.3.70 | 112 | 2/26/2024 |
1.3.69 | 106 | 2/26/2024 |
1.3.68 | 110 | 2/26/2024 |
1.3.67 | 112 | 2/23/2024 |
1.3.66 | 118 | 2/22/2024 |
1.3.65 | 111 | 2/20/2024 |
1.3.64 | 110 | 2/20/2024 |
1.3.63 | 111 | 2/20/2024 |
1.3.62 | 96 | 2/19/2024 |
1.3.61 | 106 | 2/19/2024 |
1.3.60 | 101 | 2/16/2024 |
1.3.59 | 104 | 2/16/2024 |
1.3.58 | 125 | 2/15/2024 |
1.3.57 | 111 | 2/15/2024 |
1.3.56 | 107 | 2/15/2024 |
1.3.55 | 99 | 2/15/2024 |
1.3.54 | 116 | 2/14/2024 |
1.3.53 | 98 | 2/14/2024 |
1.3.52 | 99 | 2/14/2024 |
1.3.51 | 103 | 2/14/2024 |
1.3.50 | 105 | 2/14/2024 |
1.3.49 | 108 | 2/13/2024 |
1.3.48 | 109 | 2/11/2024 |
1.3.47 | 108 | 2/10/2024 |
1.3.46 | 116 | 2/10/2024 |
1.3.45 | 115 | 2/9/2024 |
1.3.44 | 121 | 2/9/2024 |
1.3.43 | 116 | 2/8/2024 |
1.3.42 | 117 | 2/8/2024 |
1.3.41 | 113 | 2/8/2024 |
1.3.40 | 122 | 2/7/2024 |
1.3.39 | 131 | 2/7/2024 |
1.3.38 | 122 | 2/7/2024 |
1.3.37 | 113 | 2/6/2024 |
1.3.36 | 114 | 2/6/2024 |
1.3.35 | 123 | 2/6/2024 |
1.3.34 | 114 | 1/31/2024 |
1.3.33 | 128 | 1/30/2024 |
1.3.32 | 110 | 1/30/2024 |
1.3.31 | 110 | 1/30/2024 |
1.3.30 | 100 | 1/30/2024 |
1.3.29 | 101 | 1/30/2024 |
1.3.28 | 113 | 1/29/2024 |
1.3.27 | 100 | 1/29/2024 |
1.3.26 | 94 | 1/29/2024 |
1.3.25 | 109 | 1/27/2024 |
1.3.24 | 98 | 1/26/2024 |
1.3.23 | 115 | 1/26/2024 |
1.3.22 | 105 | 1/26/2024 |
1.3.21 | 110 | 1/26/2024 |
1.3.20 | 105 | 1/25/2024 |
1.3.19 | 111 | 1/25/2024 |
1.3.18 | 107 | 1/25/2024 |
1.3.17 | 109 | 1/25/2024 |
1.3.16 | 107 | 1/24/2024 |
1.3.15 | 104 | 1/24/2024 |
1.3.14 | 109 | 1/24/2024 |
1.3.13 | 110 | 1/23/2024 |
1.3.12 | 105 | 1/23/2024 |
1.3.11 | 103 | 1/23/2024 |
1.3.10 | 105 | 1/23/2024 |
1.3.9 | 108 | 1/23/2024 |
1.3.8 | 102 | 1/23/2024 |
1.3.7 | 102 | 1/23/2024 |
1.3.6 | 95 | 1/22/2024 |
1.3.5 | 102 | 1/22/2024 |
1.3.4 | 124 | 1/19/2024 |
1.3.3 | 122 | 1/19/2024 |
1.3.2 | 91 | 1/19/2024 |
1.3.1 | 105 | 1/19/2024 |
1.3.0 | 103 | 1/19/2024 |
1.2.10 | 88 | 1/19/2024 |
1.2.9 | 116 | 1/18/2024 |
1.2.8 | 113 | 1/18/2024 |
1.2.7 | 91 | 1/18/2024 |
1.2.6 | 104 | 1/18/2024 |
1.2.5 | 124 | 1/17/2024 |
1.2.4 | 121 | 1/16/2024 |
1.2.3 | 117 | 1/16/2024 |
1.2.2 | 116 | 1/16/2024 |
1.2.1 | 117 | 1/16/2024 |
1.2.0 | 111 | 1/16/2024 |
1.1.37 | 135 | 1/13/2024 |
1.1.36 | 110 | 1/13/2024 |
1.1.35 | 130 | 1/12/2024 |
1.1.34 | 121 | 1/12/2024 |
1.1.33 | 114 | 1/12/2024 |
1.1.32 | 99 | 1/12/2024 |
1.1.31 | 114 | 1/12/2024 |
1.1.30 | 113 | 1/11/2024 |
1.1.29 | 115 | 1/11/2024 |
1.1.28 | 104 | 1/11/2024 |
1.1.27 | 96 | 1/11/2024 |
1.1.26 | 95 | 1/11/2024 |
1.1.25 | 133 | 1/11/2024 |
1.1.24 | 138 | 1/9/2024 |
1.1.23 | 142 | 1/8/2024 |
1.1.22 | 126 | 1/8/2024 |
1.1.21 | 152 | 1/5/2024 |
1.1.20 | 130 | 1/4/2024 |
1.1.19 | 127 | 1/4/2024 |
1.1.18 | 126 | 1/4/2024 |
1.1.17 | 125 | 1/4/2024 |
1.1.16 | 125 | 1/4/2024 |
1.1.15 | 209 | 12/7/2023 |
1.1.14 | 151 | 12/7/2023 |
1.1.13 | 152 | 12/6/2023 |
1.1.12 | 133 | 12/4/2023 |
1.1.11 | 153 | 12/2/2023 |
1.1.10 | 149 | 11/27/2023 |
1.1.9 | 171 | 11/24/2023 |
1.1.8 | 157 | 11/24/2023 |
1.1.7 | 163 | 11/22/2023 |
1.1.6 | 150 | 11/22/2023 |
1.1.5 | 127 | 11/21/2023 |
1.1.4 | 144 | 11/21/2023 |
1.1.3 | 169 | 11/17/2023 |
1.1.2 | 154 | 11/16/2023 |
1.1.1 | 142 | 11/16/2023 |
1.1.0 | 126 | 11/15/2023 |
1.0.17 | 152 | 11/8/2023 |
1.0.16 | 136 | 11/8/2023 |
1.0.15 | 131 | 11/7/2023 |
1.0.14 | 144 | 11/6/2023 |
1.0.13 | 151 | 11/1/2023 |
1.0.12 | 137 | 11/1/2023 |
1.0.11 | 138 | 10/31/2023 |
1.0.10 | 161 | 10/31/2023 |
1.0.9 | 146 | 10/31/2023 |
1.0.8 | 141 | 10/30/2023 |
1.0.7 | 144 | 10/27/2023 |
1.0.6 | 146 | 10/27/2023 |
1.0.5 | 146 | 10/27/2023 |
1.0.4 | 151 | 10/27/2023 |
1.0.3 | 147 | 10/25/2023 |
1.0.2 | 153 | 10/24/2023 |
1.0.1 | 125 | 10/24/2023 |
1.0.0 | 151 | 10/24/2023 |