Skip to main content

Installation

Each library in the Enclave monorepo can be installed independently.

Prerequisites

  • Node.js: >= 22.0.0
  • npm: >= 10 (or yarn/pnpm equivalent)

Core Libraries

@enclave-vm/core

Secure AgentScript execution environment with defense-in-depth.
npm install @enclave-vm/core

@enclave-vm/ast

AST-based JavaScript validator with 100% CVE coverage.
npm install @enclave-vm/ast

EnclaveJS Streaming Runtime

The EnclaveJS packages provide a streaming runtime for real-time code execution with tool orchestration. Install all packages needed for a complete streaming setup:
# Server-side
npm install @enclave-vm/broker

# Client-side
npm install @enclave-vm/client @enclave-vm/react

Individual Packages

@enclave-vm/types

Protocol types and Zod schemas (automatically installed as dependency).
npm install @enclave-vm/types

@enclave-vm/stream

Streaming protocol implementation with encryption support.
npm install @enclave-vm/stream

@enclave-vm/broker

Tool broker with session management and HTTP API.
npm install @enclave-vm/broker

@enclave-vm/client

Browser and Node.js client SDK.
npm install @enclave-vm/client

@enclave-vm/react

React hooks and components.
npm install @enclave-vm/react
Peer dependency: React >= 17.0.0

@enclave-vm/runtime

Standalone deployable runtime worker.
npm install @enclave-vm/runtime

Quick Start Examples

Basic Sandbox (@enclave-vm/core)

import { Enclave } from '@enclave-vm/core';

const enclave = new Enclave({ securityLevel: 'SECURE' });
const result = await enclave.execute('return 1 + 1');
console.log(result.value); // 2

Streaming with React

import { EnclaveProvider, useEnclaveSession } from '@enclave-vm/react';

function App() {
  return (
    <EnclaveProvider brokerUrl="http://localhost:3000">
      <CodeRunner />
    </EnclaveProvider>
  );
}

function CodeRunner() {
  const { execute, stdout, result } = useEnclaveSession();

  return (
    <button onClick={() => execute('console.log("Hello!")')}>
      Run
    </button>
  );
}

Development Setup

To work on the Enclave monorepo itself:
# Clone the repository
git clone https://github.com/agentfront/enclave.git
cd enclave

# Install dependencies
yarn install

# Build all libraries
yarn build

# Run tests
yarn test

Package Versions

PackageVersionDescription
@enclave-vm/core2.7.0Secure sandbox runtime
@enclave-vm/ast2.4.0AST security validator
@enclave-vm/types0.1.0Protocol types
@enclave-vm/stream0.1.0Streaming protocol
@enclave-vm/broker0.1.0Tool broker
@enclave-vm/client0.1.0Client SDK
@enclave-vm/react0.1.0React integration
@enclave-vm/runtime0.1.0Runtime worker