Skip to main content

@enclave-vm/runtime

Building blocks of a runtime worker for EnclaveJS: a worker object that keeps track of sessions, a session executor, and the channels between a worker and a broker.
This package is not a runnable service. It does not execute code, starts no server and opens no port, and it has no authentication. An execute request never runs code: it ends with RuntimeNotImplementedError. To run scripts use @enclave-vm/broker or @enclave-vm/core.

Installation

What It Contains

Runtime Worker

handleRequest(request, channel) takes execute, cancel, tool_result and ping requests from the application that embeds the worker. The caller is trusted: nothing authenticates a request. An execute request never runs the code. The channel receives session_init, then a final event with ok: false and error.code: 'NOT_IMPLEMENTED'; the request rejects with RuntimeNotImplementedError, and no session is left behind. SessionExecutor.execute() ends its session the same way. maxSessions (default 10) must be a positive integer.

Channels

WebSocketChannel connects to a URL. It sends no credentials and does not validate incoming messages against a schema, so authenticate the connection in the server behind the URL and validate messages in the handler. While it is not connected it keeps at most maxBufferedMessages events (default 1000) and drops the rest.

Command Line

The enclave-runtime program does not start a worker. It checks its arguments, prints that a standalone worker is not implemented, and exits with code 1. --help exits with code 0.

Running Scripts

@enclave-vm/broker

Sessions, tools and streaming over HTTP

@enclave-vm/core

The sandbox