Skip to content

Node and terminal payloads

A presentation payload describes the node currently shown by your application. Its type is either node, with choices in edges, or terminal, with results in outputs. Both variants carry the node’s selected title, description and metadata extras.

This page specifies the standard core payload. EngineResult contains that payload alongside session state; SDK objects and HTTP responses wrap or expose it through their own contracts. See the PHP SDK, JavaScript SDK and HTTP API references for those enclosing structures.

The standard builder emits all fields listed for its variant, including nullable keys. edges belongs only to a node payload; outputs belongs only to a terminal payload.

Field Type Meaning and default
type "node" or "terminal" Selects the payload variant. Use it to recognise completion; an output list may be empty.
node_id Integer Current node ID.
title String Selected metadata title; "" when no metadata is available.
subtitle String or null Selected subtitle; null when absent.
description String or null Selected description; null when absent.
extras JSON object/array or null Selected metadata extras; null when absent.
edges Array of edge records Node variant only. Outgoing choices in graph order, including blocked ones.
outputs Array of output records Terminal variant only. Selected outputs in declaration order; [] is valid.

The default payload does not contain the whole graph, condition operands, session context, navigation history or an HTTP session identifier. Those are different contracts. For the meaning of presentation metadata, see Payloads and presentation.

This complete node payload describes a review screen at node 7. Edge 71 leads to terminal 8, but its context_value condition requires ready: true; the application supplied ready: false. The English label is already selected:

{
"type": "node",
"node_id": 7,
"title": "Review",
"subtitle": null,
"description": "Check the information before confirming.",
"extras": {
"screen": "review"
},
"edges": [
{
"id": 71,
"from": 7,
"to": 8,
"labels": [
{
"text": "Confirm",
"description": null,
"extras": {
"icon": "check"
}
}
],
"enabled": false,
"disabled_reason": "context_value_failed",
"availability": "blocked"
}
]
}

Download the same data as node-en.json.

Field in edges[] Type Contract
id Integer Choice ID to submit to choose().
from, to Integers Origin and destination node IDs.
labels Array of selected label records Normally one label, or [] if none exists. It is not the list of all translations.
enabled Boolean False for blocked; true for available and pending.
disabled_reason String or null Machine-readable blocking reason when blocked; otherwise null.
availability "available", "pending", "blocked" Result of the engine’s read-only availability observation.

Each selected label has three fields:

Field in labels[] Type Meaning
text String Text your application can display for the choice.
description String or null Optional description.
extras JSON object/array or null Application data declared on the selected label.

The label record does not repeat edge_id or lang. The enclosing edge identifies it, and language selection has already happened. Your application can display the review title and choice text directly, then use extras.screen or extras.icon according to its own interface contract.

availability enabled disabled_reason Interpretation
available true null The current read-only checks passed.
pending true null At least one check is deferred, normally a registered custom or external rule. Actual choice must execute it.
blocked false Reason string A known check prevents the choice, such as a false condition, a navigation restriction or session expiry.

enabled: true therefore does not mean every rule has already executed successfully. Conversely, blocked choices remain present so your application can decide how to show them. disabled_reason is a code such as context_value_failed, time_window_blocked or condition_evaluation_error, not a translated message for the screen.

Calling the low-level PayloadBuilder without EdgeAvailability observations yields pending edges; the builder does not evaluate conditions itself. Public engine operations obtain observations before building the payload. On a choice, the engine evaluates again against the actual candidate state and time, so a previously displayed payload does not reserve permission. Condition evaluation and edge availability explains the query/choice distinction.

Inspecting an expired session at a decision node can return blocked choices with session_expired. A terminal has no choices to mark, so an expired terminal inspection is rejected instead of returning its outputs.

For the same review example, choosing edge 71 with validated ready: true reaches terminal 8. The following complete payload returns English content and a language-neutral link:

{
"type": "terminal",
"node_id": 8,
"title": "Confirmed",
"subtitle": null,
"description": null,
"extras": null,
"outputs": [
{
"type": "content",
"url": null,
"label": null,
"open_behavior": null,
"lang": "en",
"content": "Your confirmation is ready."
},
{
"type": "url",
"url": "https://example.org/confirmation",
"label": "Open / Abrir",
"open_behavior": "same_tab",
"lang": null,
"content": null
}
]
}

Download terminal-en.json. The application displays the content and offers the link. same_tab is a preference chosen for this example; it is not an ExecKernel enum or a navigation action performed by the engine.

Field in outputs[] Standard type and presence Meaning
type Required string Built-in or registered output type.
url String or null, always emitted Destination for types that use one.
label String or null, always emitted Optional action text. A declared string must be nonblank.
open_behavior String or null, always emitted Application-defined opening preference. No built-in list of values.
lang String or null, always emitted Output language; null marks a language-neutral output.
content String or null, always emitted Display content for types that use it.

The standard returned output omits its graph-definition node_id; the enclosing terminal already identifies the node.

Built-in type Required nonempty string data Intended application use
content content Display content.
url url Offer a link.
redirect url Navigate when the application chooses to apply that result.
mixed content and url Present content and a related destination together.

Outputs are data. The core does not render their content or follow URLs. Its built-in URL check requires a nonempty string, not a particular URI scheme. Your application’s rendering and navigation policy determines how to use that data. Terminal outputs explains configuration and application behavior.

The engine first checks that the requested language is permitted by the graph and its security policy. Fallback does not bypass this check. Once the request is allowed, presentation is selected as follows:

Data Selection scope Fallback order
Node metadata One metadata record for the current node Requested language, graph default language, first available language, then empty/null presentation.
Edge label One label for each individual edge Requested language, graph default language, first available language, then labels: [].
Terminal outputs One localized group for the terminal Requested-language group, default-language group, first localized group. Language-neutral outputs are included alongside it.

A selected record is used as a whole. A missing subtitle is not filled from another metadata language. Likewise, if a Spanish output group has content but no URL, the engine does not add an English URL to complete it. Include a language-neutral output when it should accompany every selected group.

Output selection preserves original declaration order, including neutral outputs interleaved with localized ones. Metadata and labels do not emit a selected-language field; outputs retain their own lang. The graph’s first available language is based on stored record order, so it is a fallback, not an automatic translation service.

The default NoopPayloadSanitizer leaves presentation unchanged. A supplied PayloadSanitizerInterface receives node title, subtitle, description and the selected label arrays. It does not process the top-level metadata extras or terminal output records. Treat these field boundaries explicitly when implementing a presentation sanitizer.

The standard metadata and label extras fields preserve declarative application data. Registering a new terminal output type adds a validator; it does not add arbitrary storage properties to TerminalOutput. Fields that the model does not store are not automatically copied into the standard output.

An output hook can customize presentation and add declarative extension data. The application and extension must agree on those additional fields. The engine enforces these boundaries after hooks:

  • The payload must retain the actual type and node_id.
  • A terminal cannot contain edges; a decision node cannot receive outputs.
  • Every retained edge must be a distinct real choice with its original from and to.
  • Availability fields are restored from the engine’s observations; a hook cannot make a blocked edge available.
  • Hook-provided terminal outputs must form a list and pass the output registry and field checks.
  • The final payload, including extensions, must fit the size budget.

Hooks may filter or reorder valid edge records; they do not have to retain every displayed edge. The tables above specify the standard builder’s output, while an extension’s extra presentation contract must be documented by that extension. See Plugin manifests and extension contracts.

When debug is requested and a DebugPayloadBuilder is configured, the engine adds debug.edges. This is an observation extension, not a change to the normal availability fields.

Debug edge field Type / meaning
edge_id Integer choice ID.
allowed true for available, false for blocked, null for pending. This nullable field is in debug, not the normal edge record.
availability Same three availability values.
conditions List of observations containing rule, result (pass, fail, pending), and optional reason/ek_code.
blocked Null, or an object with type, rule, reason, ek_code, context.
pending_reason String or null, such as evaluation_deferred.

Default debug strips rule operands and condition contexts. Blocked context is normally empty; session-expiry diagnostics can retain selected operational timestamps and limits. DebugPayloadBuilder(includeContext: true) explicitly enables fuller details for trusted tooling. Error codes and exceptions describes the related diagnostic boundaries.

Payload Maximum encoded size
Node 65,536 bytes (64 KiB)
Terminal 131,072 bytes (128 KiB)

The core counts the bytes of json_encode($payload, JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR). Equality with the limit is accepted; a larger result raises PayloadTooLargeException. The engine checks again after output hooks and debug extension, so their data counts too. It rejects rather than truncating the payload.

These are presentation-payload limits, not limits for a whole HTTP envelope. Language policy, graph/session revision mismatch and invalid extension output can also prevent payload creation. Configuration, defaults and limits and the HTTP endpoint reference describe their own surrounding boundaries.