> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentfront.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> How to install Enclave libraries

# 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.

```bash theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
npm install @enclave-vm/core
```

### @enclave-vm/ast

AST-based JavaScript validator with 100% CVE coverage.

```bash theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
npm install @enclave-vm/ast
```

## EnclaveJS Streaming Runtime

The EnclaveJS packages provide a streaming runtime for real-time code execution with tool orchestration.

### Full Stack (Recommended)

Install all packages needed for a complete streaming setup:

```bash theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
# 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).

```bash theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
npm install @enclave-vm/types
```

#### @enclave-vm/stream

Streaming protocol implementation with encryption support.

```bash theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
npm install @enclave-vm/stream
```

#### @enclave-vm/broker

Tool broker with session management and HTTP API.

```bash theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
npm install @enclave-vm/broker
```

#### @enclave-vm/client

Browser and Node.js client SDK.

```bash theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
npm install @enclave-vm/client
```

#### @enclave-vm/react

React hooks and components.

```bash theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
npm install @enclave-vm/react
```

**Peer dependency:** React >= 17.0.0

#### @enclave-vm/runtime

Standalone deployable runtime worker.

```bash theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
npm install @enclave-vm/runtime
```

## Quick Start Examples

### Basic Sandbox (@enclave-vm/core)

```typescript theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
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

```tsx theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
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:

```bash theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
# 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

| Package | Version | Description |
| - | - | - |
| @enclave-vm/core | 2.7.0 | Secure sandbox runtime |
| @enclave-vm/ast | 2.4.0 | AST security validator |
| @enclave-vm/types | 0.1.0 | Protocol types |
| @enclave-vm/stream | 0.1.0 | Streaming protocol |
| @enclave-vm/broker | 0.1.0 | Tool broker |
| @enclave-vm/client | 0.1.0 | Client SDK |
| @enclave-vm/react | 0.1.0 | React integration |
| @enclave-vm/runtime | 0.1.0 | Runtime worker |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.