Babel global while maintaining all AgentScript security guarantees.
Overview
The Babel preset provides:- Babel.transform() - Transform TSX/JSX to JavaScript
- Security configs - Per-level limits for input size, output size, timeouts
- Preset whitelist - Only allowed Babel presets can be used
- Full AgentScript validation - All blocked constructs remain blocked
Basic Usage
Security Configurations
The Babel preset defines security limits per security level:Configuration by Security Level
| Level | Max Input | Max Output | Timeout | Allowed Presets |
|---|---|---|---|---|
STRICT | 100 KB | 500 KB | 5s | react |
SECURE | 500 KB | 2 MB | 10s | typescript, react |
STANDARD | 1 MB | 5 MB | 15s | typescript, react |
PERMISSIVE | 5 MB | 25 MB | 30s | typescript, react, env |
Configuration Options
Default Configurations
Allowed Globals
The Babel preset adds these globals to the AgentScript allowlist:| Global | Description |
|---|---|
Babel | The restricted Babel transform API |
__safe_Babel | Internal transformed version |
What’s Blocked
The Babel preset inherits all AgentScript security rules:- Dangerous Babel options -
plugins,sourceMaps,ast,babelrc,configFile - Disallowed presets - Any preset not in the security level’s allowlist
- All AgentScript blocked constructs -
eval,Function,process, etc.
Creating the Preset
Using with Enclave
The enclave automatically uses the Babel preset when configured:API Reference
createBabelPreset(options)
Creates validation rules for the Babel preset.
getBabelConfig(level)
Gets Babel security configuration for a security level.
BABEL_SECURITY_CONFIGS
Direct access to all security configurations.
Related
- AgentScript Preset - Base preset for code validation
- Security Rules - Rule reference
- Babel Transform (enclave-vm) - Using Babel in enclave
- Security Levels - Security profiles