Skip to main content
The Node Runtime and QUIC Transport layer facilitate secure, low-latency communication between the Palyra daemon (control plane) and remote execution nodes. This system enables the daemon to dispatch capabilities (tools) to physical devices or remote environments while maintaining strict security via mTLS and a custom QUIC-based framing protocol.

Node Runtime Architecture

The NodeRuntimeState manages the lifecycle of registered nodes, pairing requests, and the dispatching of capabilities. It persists state to a JSON file defined by NODE_RUNTIME_STATE_FILE_NAME crates/palyra-daemon/src/node_runtime.rs#20-20.

Key Components

Capability Execution Flow

When the daemon needs to execute a tool on a node, it uses the CapabilityDispatchRecord crates/palyra-daemon/src/node_runtime.rs#154-159. The runtime uses oneshot channels to bridge the asynchronous gRPC/QUIC stream with the internal tool execution logic crates/palyra-daemon/src/node_runtime.rs#200-200.
EntityRole
NodeRuntimeStateCentral coordinator for node metadata and task queues.
CapabilityRequestRecordPersisted record of a tool execution attempt and its outcome.
DeviceCapabilityViewSnapshot of what a specific node is capable of (e.g., desktop.open_url).
Sources: crates/palyra-daemon/src/node_runtime.rs#20-213.

QUIC Transport Layer

Palyra utilizes a custom transport layer built on quinn and rustls to provide a multiplexed, secure alternative to standard gRPC for node-to-daemon communication.

Protocol Framing

The transport uses a frame-based approach where each message is prefixed with its length. The maximum frame size is governed by DEFAULT_MAX_FRAME_BYTES crates/palyra-transport-quic/src/lib.rs.

Connection Lifecycle

  1. Binding: The server binds to a SocketAddr using build_server_endpoint crates/palyra-daemon/src/quic_runtime.rs#67-77.
  2. Handshake: Requires TLS material (QuicRuntimeTlsMaterial) including CA, Certificate, and Private Key crates/palyra-daemon/src/quic_runtime.rs#19-25.
  3. Serving: The serve_with_connection_limit function manages a semaphore-based limit on concurrent connections (default 256) crates/palyra-daemon/src/quic_runtime.rs#86-91.

Supported Methods

The QUIC runtime currently handles:

QUIC Transport Data Flow

Node Runtime to Transport mapping: Sources: crates/palyra-daemon/src/quic_runtime.rs#1-142, crates/palyra-daemon/src/node_runtime.rs#181-194.

mTLS-Secured Node RPC

While QUIC is used for performance, a gRPC interface (NodeRpcServiceImpl) provides the primary control plane for node registration and pairing, secured by mandatory mTLS.

Identity and Authentication

The NodeRpcServiceImpl enforces certificate-bound identity. It extracts the client certificate fingerprint and validates it against the IdentityManager crates/palyra-daemon/src/node_rpc.rs#56-85.

Node RPC Implementation

The service implements the node.v1 Protobuf schema, handling:

Node to Daemon Interaction

This diagram bridges the CLI node runner to the Daemon’s RPC implementation. Sources: crates/palyra-daemon/src/node_rpc.rs#38-129, crates/palyra-cli/src/commands/node.rs#187-213.

Control Plane Client

The ControlPlaneClient is the primary library used by nodes and the CLI to communicate with the daemon’s HTTP/gRPC interfaces.

Key Client Methods

Sources: crates/palyra-control-plane/src/client.rs#15-184.