@enclave-vm/core package.
Installation
Enclave Class
The main class for secure code execution.Constructor
EnclaveOptions
| Property | Type | Default | Description |
|---|---|---|---|
securityLevel | SecurityLevel | 'STANDARD' | Security preset |
timeout | number | 30000 | Execution timeout in ms |
maxToolCalls | number | 100 | Maximum tool calls per execution |
maxIterations | number | 10000 | Maximum loop iterations |
memoryLimit | number | 67108864 | Memory limit in bytes (64MB) |
toolHandler | ToolHandler | undefined | Tool execution function |
globals | Record<string, unknown> | {} | Custom globals |
scoringGate | ScoringGateOptions | undefined | AI scoring configuration |
adapter | EnclaveAdapter | undefined | Execution adapter |
verboseErrors | boolean | false | Include detailed error info |
Methods
run(code, options?)
Execute code in the sandbox.code- JavaScript code to executeoptions- Optional execution options
ExecutionResult
validate(code)
Validate code without executing.ValidationResult
dispose()
Clean up resources.Types
SecurityLevel
| Level | Description |
|---|---|
STRICT | Maximum security for untrusted code |
SECURE | High security for semi-trusted code |
STANDARD | Balanced security for internal tools |
PERMISSIVE | Minimal restrictions (testing only) |
ToolHandler
ExecutionError
ExecutionStats
ScoringGateOptions
Factory Functions
createWorkerPoolAdapter(options)
Create a worker pool adapter for OS-level isolation.createDoubleVmAdapter(options)
Create a double-VM adapter for nested isolation.RuleBasedScorer Class
Semantic pattern detection scorer.Methods
score(code)
Reference Sidecar
Handle large tool responses.SidecarOptions
Complete Example
Related
- Overview - Feature overview
- Configuration - All options
- Security Levels - Security details