Engine
The engine node uses the Smartunit Engine Provider to read or change deployed
Node-RED flows.
High-impact node: Update Flows, Create Node, and Update Node change the running flow configuration. Restrict access, validate every payload, and keep a recoverable copy of known-good flows.
Actions
Section titled “Actions”| Action | Current behavior |
|---|---|
| Auto | Requires msg.action for every input. |
| Get tabs | Returns flow-tab definitions. |
| Get flows | Returns flow configuration for the selected scope. |
| Get nodes | Lists nodes, optionally filtered by node type and scope. |
| Update flows | Replaces the complete deployed flow configuration. |
| Create node | Adds a node definition to a flow tab. |
| Get node | Returns one node definition by ID. |
| Update node | Merges a patch into one node and redeploys it. |
Get Flows and Get Nodes support:
- All flows
- Selected tab
- Current tab, meaning the tab containing the Engine node
msg.scope overrides the configured scope. msg.flowId selects a tab when
scope is tab.
Runtime Inputs
Section titled “Runtime Inputs”| Field | Purpose |
|---|---|
msg.action | Selects the action in Auto mode. |
msg.scope | Overrides flow or node-list scope. |
msg.flowId | Tab for selected-scope reads or Create Node. |
msg.nodeType | Optional Get Nodes filter. |
msg.nodeId | Target for Get Node or Update Node. |
msg.payload | Flow array, new node definition, or node patch. |
msg.regenerateIds | Set to "yes" when Update Flows should generate new IDs. |
The current runtime evaluates msg.regenerateIds for Update Flows. Supply it
explicitly when importing a template that must receive new IDs.
Create Node
Section titled “Create Node”msg.payload must be a plain node-definition object. It must include type.
The target tab can come from msg.payload.z, msg.flowId, or the configured
Tab. An ID is generated when omitted.
Update Node
Section titled “Update Node”msg.payload is merged into the target node. The runtime ignores structural
changes to id and type, but other properties can change behavior, position,
wiring-related configuration, or node-specific settings.
Update Flows
Section titled “Update Flows”Update Flows replaces the complete flow configuration with the supplied array. An incomplete payload can remove unrelated tabs or nodes.
Use this action only with trusted, validated data and a recovery procedure. Do not expose Engine actions directly as unrestricted agent tools.
Errors
Section titled “Errors”Invalid IDs, malformed payloads, and provider failures are passed to
done(err). Attach a Catch node and record enough context to recover without
logging sensitive flow credentials.