29namespace neograph::graph {
43 std::string json_pointer;
59 std::string reducer_name =
"overwrite";
68 std::uint64_t retention_limit = 0;
75inline constexpr int kMaxAttemptTimeoutMs = 3'600'000;
90 std::optional<bool> error_text;
96 bool empty() const noexcept {
110 bool operator==(
const FailureEdge&)
const =
default;
118 bool operator==(
const FailureExit&)
const =
default;
130 std::vector<ChannelDef> channel_defs;
131 std::vector<Edge> edges;
132 std::vector<ConditionalEdge> conditional_edges;
136 std::set<std::string> interrupt_before;
137 std::set<std::string> interrupt_after;
138 std::optional<RetryPolicy> retry_policy;
139 int schema_version = 0;
140 std::map<std::string, json> node_defs;
148 std::map<std::string, FailureExit> failure_exits;
150 json to_json()
const;
158 std::optional<TopologySpec> topology;
159 std::vector<CompilerDiagnostic> diagnostics;
161 bool has_errors()
const noexcept;
162 std::string summary()
const;
167 std::vector<CompilerDiagnostic> diagnostics;
169 bool has_errors()
const noexcept;
170 std::string summary()
const;
187 std::vector<ChannelDef> channel_defs;
190 std::map<std::string, std::unique_ptr<GraphNode>> nodes;
191 std::vector<Edge> edges;
192 std::vector<ConditionalEdge> conditional_edges;
195 std::set<std::string> interrupt_before;
196 std::set<std::string> interrupt_after;
213 std::vector<FailureEdge> failure_edges;
214 std::map<std::string, FailureExit> failure_exits;
370 static json
canon(
const json& definition);
NEOGRAPH_API export/import macro for shared-library builds.
Stateless JSON parser and node-instantiation linker.
static RoundTripReport verify_roundtrip_report(const json &definition, const TopologySpec &topology)
Total translation-validation before runtime node instantiation.
static void verify_roundtrip(const json &definition, const TopologySpec &topology)
Translation validation before runtime node instantiation.
static TopologySpec parse(const json &definition, const GraphRegistry ®istry)
Pure parse using a local-first registry for schema metadata.
static CompiledGraph compile(const json &definition, const NodeContext &default_context)
Parse a JSON graph definition into a CompiledGraph.
static json canon(const json &definition)
Canonicalize a topology JSON document for equivalence comparison.
static CompiledGraph link(TopologySpec topology, const NodeContext &default_context, const GraphRegistry ®istry)
Instantiate nodes using a local-first registry overlay.
static CompiledGraph link(TopologySpec topology, const NodeContext &default_context)
Instantiate runtime nodes from an already parsed topology.
static CompiledGraph compile(const json &definition, const NodeContext &default_context, const GraphRegistry ®istry)
Compile with a local-first registry overlay.
static json upgrade_to_latest(const json &definition)
Upgrade a legacy (schema_version 0 / absent) topology document to the current schema version.
static ParseReport parse_local_report(const json &definition, const GraphRegistry ®istry)
Total pure parse requiring every executable in the local registry.
static TopologySpec parse_local(const json &definition, const GraphRegistry ®istry)
Pure parse that rejects every executable absent from the registry instance.
static CompiledGraph link_local(TopologySpec topology, const NodeContext &default_context, const GraphRegistry ®istry)
Instantiate nodes exclusively through the registry instance.
static TopologySpec parse(const json &definition)
Parse JSON into a declarative topology without creating nodes.
static ParseReport parse_report(const json &definition, const GraphRegistry ®istry)
Total pure parse using local-first registry metadata.
static void verify_roundtrip(const json &definition, const CompiledGraph &cg)
Translation validation: assert compile() lost nothing.
static CompiledGraph compile_local(const json &definition, const NodeContext &default_context, const GraphRegistry ®istry)
Parse and link without process-global registry fallback.
Abstract base class for all graph nodes.
Engine-owned registry of custom graph callables.
constexpr int kMinAttemptTimeoutMs
#364 bounds of NodeRetryPolicySpec::attempt_timeout_ms (milliseconds).
constexpr int TOPOLOGY_SCHEMA_VERSION
Latest topology schema accepted by GraphCompiler.
Graph engine type definitions: channels, edges, nodes, events, and control flow.
ChannelRetentionPolicy
Retention policy applied after a channel reducer produces a value.
ReducerType
Strategy for merging values when writing to a channel.
ChannelPersistencePolicy
Whether a channel value is part of serialized checkpoints.
Legacy process-global registries for graph executables.
Pure routing / next-step-planning logic extracted from GraphEngine.
std::map< std::string, JoinSpec > JoinSpecs
Joins with at least one multi-alternative slot, by join node name.
std::map< std::string, std::set< std::string > > BarrierSpecs
Static barrier declarations extracted at graph-compile time.
Declarative configuration for a single state channel.
ChannelPersistencePolicy persistence
Ephemeral values are omitted; checkpoint metadata guards resume.
ChannelRetentionPolicy retention
Retention is applied after reducer combination.
bool has_initial
True iff the JSON channel definition carried an explicit "initial" key.
Parsed graph definition, ready for the engine to run.
int schema_version
Declared "schema_version" from the topology JSON, or 0 when the document did not carry one.
NEOGRAPH_API TopologySpec topology() const
Copy the declarative portion without live GraphNode instances.
NEOGRAPH_API json to_json() const
Re-emit this compiled graph as topology JSON.
std::map< std::string, NodeRetryPolicySpec > node_retry_policies
#364 failure routing keys, carried so to_json() round-trips.
std::optional< RetryPolicy > retry_policy
Present iff the JSON defined a top-level "retry_policy" object.
std::map< std::string, json > node_defs
Verbatim copy of each node's JSON definition (config + "type"), minus the "barrier" key (barriers are...
ToolSet tools
Retains tools referenced by the compiled node instances until link().
json metadata
Graph metadata (#362), carried so to_json() round-trips; null when absent.
One stable, machine-readable compiler finding.
#364: where a node's routable failure goes instead of failing the run.
std::optional< std::string > error_channel
A channel with the built-in append reducer that receives the failure record.
#364: a node whose completion ends the run as failed.
std::string code
An author code; empty means the default, NG.Aborted.
Dependency injection context passed to nodes during construction.
#364: one node's retry fields exactly as the author wrote them.
std::vector< std::string > non_retryable
Sorted, unique, at most 16 codes.
std::optional< int > attempt_timeout_ms
Per-attempt time limit (milliseconds), kMinAttemptTimeoutMs to kMaxAttemptTimeoutMs.
std::optional< int > max_retries
0-10
std::optional< double > backoff_multiplier
1.0-10.0
std::optional< int > max_visits
1-100
std::optional< int > max_delay_ms
initial_delay_ms-300000
std::optional< int > initial_delay_ms
10-60000
Total result of parsing a topology document.
Total result of translation-validation.
Declarative graph topology with no live node instances or runtime state.
std::vector< FailureEdge > failure_edges
Sorted by the UTF-8 bytes of from; at most one per node.
json metadata
Host-readable author claims (#362): a nonempty object, or null when the definition has none.
std::map< std::string, NodeRetryPolicySpec > node_retry_policies
#364 failure routing, read under schema_version >= 1. Absent when unused.
JoinSpecs join_specs
Joins with any_of slots (#363); a legacy-equivalent spec stays in barrier_specs.