Skip to main content
The Node Runtime and Multi-Node Networking subsystem manages the lifecycle, connectivity, and security of external devices (nodes) that contribute capabilities to the Palyra ecosystem. This system enables a distributed architecture where the central daemon (palyrad) orchestrates tasks executed by remote nodes over mTLS-secured gRPC channels.

Node Runtime Management

The NodeRuntimeState is the central coordinator for tracking registered nodes, pending pairing codes, and in-flight capability dispatches. It persists its state to a JSON file named node-runtime.v1.json within the daemon’s state root crates/palyra-daemon/src/node_runtime.rs#19-20.

Key Data Structures

Capability Dispatch Flow

Capabilities are dispatched to nodes via a queue-based system. When a capability is requested, it is added to CapabilityRuntimeState.queued_by_device crates/palyra-daemon/src/node_runtime.rs#166-170. The node retrieves these tasks via a long-polling or streaming gRPC call, executes them locally, and returns a CapabilityExecutionResult crates/palyra-daemon/src/node_runtime.rs#159-163. Sources: crates/palyra-daemon/src/node_runtime.rs#177-207

Node RPC Service and Security

The NodeRpcServiceImpl provides the gRPC interface for nodes to interact with the daemon. It enforces strict security through Mutual TLS (mTLS) and device-to-certificate binding.

mTLS Enforcement and Identity

The service extracts the peer certificate fingerprint from the TLS connection metadata crates/palyra-daemon/src/node_rpc.rs#60-85.

Node Registration

Nodes call RegisterNode to announce their presence and capabilities. The daemon validates the device_id and records the node’s platform and available tools crates/palyra-daemon/src/node_rpc.rs#210-240. Sources: crates/palyra-daemon/src/node_rpc.rs#38-54, crates/palyra-daemon/src/node_rpc.rs#56-129

mTLS-Enforced Node Pairing

Pairing is the process of establishing a trust relationship between a new node and the daemon. It follows a multi-step handshake that results in the issuance of a client certificate.

Pairing Sequence

  1. Code Minting: An operator generates a PIN or QR code via the console or CLI crates/palyra-daemon/src/node_runtime.rs#240-260.
  2. Initial Hello: The node sends a DevicePairingHello containing its device_id and a proof derived from the pairing code crates/palyra-daemon/src/node_rpc.rs#250-280.
  3. Approval Workflow: The daemon creates an ApprovalPromptRecord of type DevicePairing crates/palyra-daemon/src/node_rpc.rs#194-205.
  4. Material Issuance: Once approved, the daemon generates a client certificate for the node. The node retrieves this “pairing material” (certificate and CA PEM) to configure its local mTLS transport crates/palyra-daemon/src/node_runtime.rs#79-87.

Node Pairing Flow Diagram

The following diagram illustrates the transition from a pairing code to a secured mTLS connection. Sources: crates/palyra-daemon/src/node_rpc.rs#187-208, crates/palyra-identity/src/pairing/manager.rs#14-39, crates/palyra-daemon/src/node_runtime.rs#79-103

Console Inventory and Device Management

The Web Console provides a unified view of all connected hardware and virtual instances through the Inventory Section.

Inventory Surface

The InventorySection in the React frontend aggregates data from multiple daemon endpoints to show:

Administrative Actions

Operators can perform lifecycle operations on devices: Sources: apps/web/src/console/sections/InventorySection.tsx#39-69, crates/palyra-daemon/src/transport/http/handlers/console/inventory.rs#75-110, crates/palyra-daemon/src/transport/http/handlers/console/devices.rs#11-33

CLI Node Commands

The palyra CLI includes a node subcommand group for managing local node instances and performing headless pairing.

Primary Commands

Node Lifecycle Implementation

The CLI manages the node process using platform-specific logic. On Windows, it uses DETACHED_PROCESS and CREATE_NO_WINDOW flags to run the node without a terminal window crates/palyra-cli/src/commands/node.rs#42-45. It redirects logs to node-host.stdout.log and node-host.stderr.log for troubleshooting crates/palyra-cli/src/commands/node.rs#36-37.

Node Runtime Entity Mapping

The following diagram maps CLI concepts to the underlying daemon and identity entities. Sources: crates/palyra-cli/src/commands/node.rs#48-73, crates/palyra-cli/src/commands/node.rs#173-204, crates/palyra-daemon/src/node_rpc.rs#38-54