sandboxedjs 0.2.19 → 0.2.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21935,7 +21935,7 @@ function f(e2, r2, t2) {
21935
21935
  }
21936
21936
 
21937
21937
  // src/node/commonjs-engine.ts
21938
- var EXTENSIONS = [".js", ".mjs", ".cjs", ".json", ".node"];
21938
+ var EXTENSIONS = [".js", ".mjs", ".cjs", ".json", ".node", ".ts", ".tsx"];
21939
21939
  var PREFIX_ONLY_BUILTINS = /* @__PURE__ */ new Set(["test", "test/reporters", "sea", "sqlite"]);
21940
21940
  var CONDITION_SETS = {
21941
21941
  import: [["node", "import", "module", "default"], ["node", "require", "default"], ["default"]],
@@ -1,77 +1,52 @@
1
- # SandboxedJS native Python package platform
1
+ # SandboxedJS for AI Agents
2
2
 
3
- This folder is an executable work specification for a coding agent. Its goal is
4
- not to port NumPy. Its goal is to make native Python packages a platform
5
- capability of SandboxedJS, with NumPy eventually serving as one demanding
6
- acceptance case.
3
+ SandboxedJS provides a high-fidelity, zero-infrastructure execution environment specifically designed for AI agents. Instead of limiting your agent to a handful of tool-calling functions, SandboxedJS gives your model a real POSIX shell, a virtual filesystem, and full Node.js and Python runtimes.
7
4
 
8
- ## Start here
5
+ Whether you are building a coding assistant, an automated researcher, or a complex agentic workflow, SandboxedJS ensures that the code your agent writes and executes is isolated from your host system while remaining functionally complete.
9
6
 
10
- At the beginning of every turn, read only these files:
7
+ ## Why a Real Shell for Agents?
11
8
 
12
- 1. `README.md` (this file).
13
- 2. `STATE.md`.
14
- 3. The one task file named by `STATE.md`.
9
+ Most agent sandboxes provide a restricted set of APIs (e.g., `read_file`, `write_file`). While safe, this creates a "capability gap" where agents struggle with real-world tasks.
15
10
 
16
- Do not reread every document on every turn. Open `INVARIANTS.md`,
17
- `DECISION-TREE.md`, or `COMMANDS.md` only when the current task points to them
18
- or an observed failure requires them. This is intentional: the folder is also
19
- a context and token budget.
11
+ By providing a full shell, your agent can:
12
+ - **Manage Complex Projects**: Use `mkdir`, `find`, and `grep` to navigate and analyze large codebases.
13
+ - **Install Dependencies**: Use `npm install` or `pip install` to bring in the exact libraries needed for a task.
14
+ - **Execute Pipelines**: Chain commands using pipes (`|`) and redirections (`>`), allowing the agent to use standard Unix tools for data processing.
15
+ - **Run Multi-Language Workflows**: Seamlessly switch between JavaScript for the frontend and Python for data science within the same container.
20
16
 
21
- Then execute the loop in `LOOP.md`. Continue until the current task's exit gate
22
- passes or a stop condition requires the user or a stronger model.
17
+ ## Integration
23
18
 
24
- ## Product objective
19
+ SandboxedJS is designed to plug into modern agent frameworks. It mirrors the `SandboxBackendProtocolV2` used by [LangChain Deep Agents](https://github.com/langchain-ai/deepagents), making it a drop-in replacement for heavier, infra-dependent backends.
25
20
 
26
- The eventual user experience is:
21
+ ```ts
22
+ import { SandboxedJsBackend, installSandboxSkills } from "sandboxedjs/agent";
27
23
 
28
- ```sh
29
- pip install some-package
30
- ```
31
-
32
- The implementation may obtain a pure wheel, install an already-built
33
- SandboxedJS wheel, or ask an external build system to create and cache a wheel.
34
- It must never install a host-native artifact by relabeling it, silently omit a
35
- dependency, or claim support because compilation alone succeeded.
36
-
37
- ## Current baseline
38
-
39
- The working tree already contains staged, uncommitted work produced in an
40
- earlier session:
24
+ const box = await createContainer({
25
+ cwd: "/app",
26
+ network: { allowOutbound: true },
27
+ });
41
28
 
42
- - a generic setuptools cross environment;
43
- - package-owned `setup.py` and `pyproject.toml` builds;
44
- - C and Cython fixtures;
45
- - the existing PyO3 path;
46
- - side-module validation and runtime import tests;
47
- - `docs/python/cross-build.md`, which records ten known assumptions.
29
+ // Equip the container with standard agent skills (ls, read, write, edit, etc.)
30
+ await installSandboxSkills(box);
48
31
 
49
- Preserve those staged changes. Do not unstage, discard, rewrite wholesale, or
50
- commit them unless the user explicitly requests it. First verify them and
51
- record the result in `STATE.md`.
52
-
53
- ## Scope boundary
54
-
55
- This project owns:
32
+ const agent = createDeepAgent({
33
+ model,
34
+ backend: new SandboxedJsBackend(box, { cwd: "/app" }),
35
+ });
36
+ ```
56
37
 
57
- - reproducible cross-build inputs;
58
- - build/host/target dependency separation;
59
- - package build-backend execution;
60
- - ABI-valid wheel construction and metadata;
61
- - wheel indexing, resolution, installation, and runtime verification;
62
- - explicit recipes and patches for irreducibly package-specific behavior;
63
- - compatibility evidence.
38
+ ## Security for Agents
64
39
 
65
- This project does not own, unless the user separately authorizes it:
40
+ Because the container runs entirely in memory (or within a Worker thread), you can spin up a fresh, isolated instance for every single user session or agent task.
66
41
 
67
- - a hosted public build service;
68
- - cloud accounts, deployment, billing, or package signing infrastructure;
69
- - pretending raw sockets, subprocesses, GPU APIs, or unavailable operating
70
- system capabilities exist;
71
- - broad unrelated cleanup of SandboxedJS.
42
+ - **No Host Access**: The agent cannot see your `/Users` directory or environment variables unless you explicitly mount them.
43
+ - **Network Control**: Outbound access is off by default. You decide exactly which APIs the agent can reach.
44
+ - **Instant Disposal**: Once the task is complete, `box.dispose()` wipes the entire environment instantly.
72
45
 
73
- ## Definition of success
46
+ ## Technical Specification
74
47
 
75
- Success is a general pipeline demonstrated by several independent package
76
- shapes, not one famous package. The final gate is described in `ROADMAP.md`.
48
+ For developers contributing to the agent platform or extending the runtime, see the detailed work specifications in this folder.
77
49
 
50
+ - `STATE.md`: Current progress and active tasks.
51
+ - `COMMANDS.md`: Available shell commands and their implementations.
52
+ - `ROADMAP.md`: The path toward a fully compatible native Python package platform.
@@ -0,0 +1,261 @@
1
+ # Agent feature
2
+
3
+ I want `agent` command in the sandbox. it is a seperate app like officesuit and vireo, we have to provide all the dependencies for it to run here in Sandboxedjs module but we don't provide the .sbjs package here, it will be downloaded from sandboxedjswheels.pages.dev site, the code of that site is in /Users/shazi/Projects/sandboxedjswheels.
4
+
5
+ # First Phase
6
+
7
+ ## Objective and scope
8
+
9
+ Provide the runtime dependencies of the future `agent` application and the
10
+ transitive dependencies needed to install and execute them. The application stays
11
+ an independently downloaded `.sbjs` package from `sandboxedjswheels.pages.dev`;
12
+ SandboxedJs provides its execution environment, dependency resolver, and optional
13
+ runtime packs. Model creation, training, publication, and agent implementation are
14
+ separate work. This section is an implementation plan, not a claim of existing
15
+ package support.
16
+
17
+ Required targets:
18
+
19
+ - Transformers.js in the browser using its upstream browser inference backend.
20
+ - Python Transformers and CPU PyTorch using compatible upstream Linux packages.
21
+ - The actual upstream Linux Ollama distribution, including its server and CPU
22
+ runner. A wllama adapter, recompiled replacement, or implementation of only the
23
+ Ollama HTTP API does not satisfy this requirement.
24
+ - Owned, reproducible C/C++, Rust, and supporting build-tool distributions for
25
+ extending package coverage. Ownership means pinned upstream tools, build recipes,
26
+ patches, and release artifacts; it does not require inventing a compiler.
27
+
28
+ ## Execution architecture: prerequisite before package installation
29
+
30
+ The current POSIX command layer, CPython-to-Wasm runtime, WASI host, and ELF
31
+ dispatch hooks are useful foundations. They do not execute arbitrary Linux
32
+ packages. The current original x64 engines only handle a small freestanding
33
+ instruction subset and reject dynamic linking; they cannot run Ollama, a normal
34
+ Linux Python interpreter, or PyTorch. See [browser architecture](../browser-runtime-architecture.md),
35
+ [binary backends](../developer-tool-packs.md), and [original x64 limits](../original-x64.md).
36
+
37
+ Use two explicit execution profiles:
38
+
39
+ | Profile | Runtime | Package ABI | Initial purpose |
40
+ | --- | --- | --- | --- |
41
+ | Browser/Wasm | Existing JS runtime, owned Wasm CPython, compatible WASI tools | Browser JS, exact SandboxedJs Python extension ABI, supported WASI imports | Transformers.js and individually validated scientific Wasm packages |
42
+ | Linux guest | Optional full-system CPU emulator compiled to Wasm, Linux kernel, persistent root filesystem | One selected Linux CPU architecture, glibc and native Python wheel tags | Unmodified Ollama, Python Transformers, CPU PyTorch, native compilers |
43
+
44
+ For the Linux profile, select a **64-bit architecture supported by the exact
45
+ Ollama and PyTorch releases**. Start by evaluating x86-64 with a glibc-based Debian
46
+ root filesystem. An emulator must boot that architecture and execute the CPU
47
+ instructions used by those binaries and their runners. Do not select a 32-bit
48
+ emulator just because it can boot a Linux image. Evaluate a browser-capable
49
+ full-system QEMU-derived build or another suitable engine; no working engine is
50
+ selected or supplied by this document. Its browser build, memory model, licensing,
51
+ and performance must be demonstrated before committing to it.
52
+
53
+ WebAssembly executes the emulator; the emulator executes Linux machine code and
54
+ Linux supplies the kernel ABI. Adding libc, WASI, or a compiler alone cannot make
55
+ an upstream Linux ELF binary execute in the existing Wasm runtime. Extending the
56
+ original translator to that level is a substantial alternative engineering
57
+ project, not a missing dependency that can simply be installed.
58
+
59
+ ## Dependency packs and their dependencies
60
+
61
+ Pack names below are proposed distribution units, not existing npm packages.
62
+ Heavy assets should download on demand rather than become unconditional npm
63
+ dependencies of `sandboxedjs`.
64
+
65
+ | Pack | Direct contents | Dependencies and required capabilities |
66
+ | --- | --- | --- |
67
+ | `agent-runtime` | `.sbjs` loader, dependency manifest/resolver, execution-profile selection, process and service supervision | Existing container APIs; runtime-pack registry; version checks; install progress, cancellation, logs and cleanup |
68
+ | `browser-ml` | Pinned `@huggingface/transformers`, its resolved browser dependencies and matching ONNX Runtime Web assets | Correct browser export resolution; module workers; fetch, streams, typed arrays; Wasm assets; persistent model cache; optional SIMD, threads and WebGPU according to selected backend |
69
+ | `linux-machine` | Wasm CPU emulator, boot assets, Linux kernel, initramfs where required, guest control agent | Worker isolation, virtual CPU/MMU/interrupts/timers, disk and network devices, guest RAM, persistent disk adapter, host/guest RPC and termination |
70
+ | `linux-base` | glibc distribution rootfs, ELF loader, shell, coreutils, `apt`/`dpkg`, repository metadata/keyrings | Matching architecture and kernel; distro-resolved shared libraries; process, filesystem, clock, entropy, networking and certificate support |
71
+ | `linux-downloads` | `curl`, CA certificates, `tar`, `zstd`, gzip/xz/unzip as required | DNS and working TCP/TLS transport, writable temporary storage, trusted artifact metadata and extraction limits |
72
+ | `linux-python-ml` | Native CPython, `venv`, pip, CPU `torch`, `transformers` | Native wheels matching Python, architecture and glibc; full Python dependency closure and ELF library closure described below |
73
+ | `linux-ollama` | Pinned upstream Linux Ollama release, bundled libraries and CPU runners | `linux-machine`, `linux-base`, `linux-downloads`; runner-compatible CPU features; writable model store; local HTTP server access |
74
+ | `linux-build-tools` | Native C/C++ compiler, linker, Rust toolchain and build drivers | Linux profile, development headers, language standard libraries, build-system dependencies and package-specific source recipes |
75
+ | `wasm-build-sdk` | Emscripten/LLVM, supported WASI SDK, Rust Wasm target, owned Python extension SDK | Separate target sysroots and ABI locks; reproducible external build environment initially; compatible Wasm outputs tested in SandboxedJs |
76
+
77
+ Transformers.js uses ONNX Runtime in the browser; provide the assets matching the
78
+ locked package release and resolve browser exports instead of accidentally loading
79
+ native Node addons. WebGPU is optional for this path and does not accelerate the
80
+ Linux guest automatically. [Upstream Transformers.js documentation](https://huggingface.co/docs/transformers.js/en/index)
81
+ and [asset configuration](https://huggingface.co/docs/transformers.js/custom_usage).
82
+
83
+ ## Linux facilities required underneath the packages
84
+
85
+ The Linux machine must supply more than command names:
86
+
87
+ - **CPU and memory:** 64-bit guest execution, virtual memory and page permissions,
88
+ floating point, required SIMD, atomics, and coherent thread behavior. Verify
89
+ CPUID/feature detection against the actual Ollama runner and PyTorch build.
90
+ Guest 64-bit addressing does not remove browser or emulator memory limits.
91
+ - **Processes:** executable loading, dynamic linking, `fork`/`exec`/`wait`, threads,
92
+ futexes, signals, pipes, polling/epoll, timers and service termination. A full
93
+ guest kernel provides these, but the emulator must support their foundations.
94
+ - **Filesystem:** permissions, symlinks, executable bits, atomic rename, locks,
95
+ mmap, large files, `/tmp`, `/proc`, `/sys`, `/dev`, entropy devices and shared
96
+ memory. Mount a persistent writable disk with capacity checks and recovery.
97
+ - **Networking:** guest loopback, DNS, TCP, TLS certificates and correct time;
98
+ downloads, package repositories, Hugging Face and the Ollama registry must work
99
+ through the configured outbound policy.
100
+ - **Host integration:** execute/upload/download APIs, streaming stdout/stderr,
101
+ cancellation, service readiness, and a bridge to guest HTTP ports, including
102
+ Ollama's default port 11434. Keep the guest disk separate from the current VFS
103
+ and transfer files explicitly with documented ownership and consistency.
104
+
105
+ Browsers cannot directly supply arbitrary raw TCP sockets. General Linux package
106
+ managers and native TLS clients require a guest network bridge to an explicitly
107
+ configured WebSocket/TCP relay or equivalent host transport. The current
108
+ fetch-based HTTP egress is not transparent networking for unmodified Linux
109
+ programs. A relay forwards network traffic; model computation still runs locally.
110
+ Document this infrastructure dependency. Offline operation is possible after
111
+ required packages and models are cached; arbitrary live registry access cannot be
112
+ promised on a static host alone.
113
+
114
+ ## Python and scientific/ML dependency closure
115
+
116
+ Use native Python inside the Linux guest for the initial full Transformers/PyTorch
117
+ target. Choose the Python version together with the available CPU wheels, rather
118
+ than inheriting the Wasm interpreter version automatically. Resolve the exact
119
+ dependency tree from the selected releases and extras; the following is the
120
+ coverage inventory, not a substitute for a lockfile:
121
+
122
+ | Layer | Dependencies to resolve and test |
123
+ | --- | --- |
124
+ | Transformers | `transformers`, `huggingface-hub`, `tokenizers`, `safetensors`, NumPy, packaging, filelock, PyYAML, regex, tqdm, and the network/filesystem dependencies declared by the selected versions |
125
+ | PyTorch CPU | CPU-only `torch` wheel and its declared Python dependencies; included or required C/C++ runtime, OpenMP and math libraries; inspect ELF dependencies recursively |
126
+ | Model-dependent extras | SentencePiece/protobuf, Pillow, audio libraries, torchvision/torchaudio, or other processors only when required by the supported model and task |
127
+ | Additional science coverage | NumPy first; SciPy, pandas and scikit-learn as separately validated additions, with matching BLAS/LAPACK, OpenMP and Fortran runtimes where required |
128
+ | Download/cache stack | The selected hub client's HTTP/TLS and filesystem packages, cache locks, resumable downloads, credentials and offline-cache behavior |
129
+
130
+ Rust-based `tokenizers` and `safetensors`, C/C++ extensions, and PyTorch's native
131
+ libraries are transitive runtime artifacts even when a user only installs a
132
+ Python package. Prebuilt compatible wheels avoid compiling them at installation
133
+ time. Pin CPU wheels explicitly so resolution does not pull an unwanted CUDA
134
+ stack. The supported Python/torch combination must follow the chosen releases'
135
+ [Transformers installation requirements](https://huggingface.co/docs/transformers/installation)
136
+ and [PyTorch CPU installation instructions](https://pytorch.org/get-started/locally/).
137
+
138
+ For the existing Wasm Python profile, pure Python packages still need their native
139
+ dependencies ported. Build every compiled extension against this project's exact
140
+ Python/Emscripten/extension ABI; never relabel a manylinux wheel as Wasm. A full
141
+ PyTorch Wasm port is separate work and is not implied by providing Clang or Rust.
142
+ See the [owned Python architecture](../python/architecture.md) and
143
+ `python-runtime/abi/extension-abi.json` for the current ABI contract.
144
+
145
+ ## Real Linux Ollama installation contract
146
+
147
+ Download a pinned upstream archive for the selected guest architecture, verify
148
+ its recorded digest, and install its binary **and required bundled libraries and
149
+ runners** inside the guest. Preserve upstream layout and resolve all additional
150
+ ELF shared-library requirements against the chosen rootfs. Maintain a release
151
+ inventory of loader paths, `DT_NEEDED` dependencies, minimum libc requirements
152
+ and runner CPU features; determine these from the selected artifact rather than
153
+ guessing a permanent list.
154
+
155
+ Support the upstream manual installation path and launch `ollama serve` through
156
+ the guest supervisor. Systemd is not required for this path. Running the upstream
157
+ installer script is a separate compatibility test because its service/user setup
158
+ can require additional distro tools. [Official Linux installation instructions](https://docs.ollama.com/linux).
159
+
160
+ Validate version reporting, server readiness, API access, model download/import,
161
+ persistence, restart and cancellation. These must execute the real upstream
162
+ Linux processes, with backend and version reported to the user. Browser WebGPU
163
+ does not provide CUDA or ROCm to these processes; CPU execution is the first
164
+ target. GPU passthrough/translation is outside this phase.
165
+
166
+ ## Owned compiler and build dependencies
167
+
168
+ Separate the machine **running a compiler** from the architecture it **produces**.
169
+ A Linux `clang` executable needs the Linux guest; emitting Wasm does not make the
170
+ compiler itself browser-executable.
171
+
172
+ - **Native Linux toolchain:** GCC/G++ or Clang/LLVM, linker (GNU ld or LLD),
173
+ binutils/LLVM inspection tools, libc development headers, C++ headers/runtime,
174
+ `make`, CMake, Ninja, pkg-config, Git, patch and archive tools. Add Autoconf,
175
+ Automake and libtool when recipes require them.
176
+ - **Rust:** pinned `rustc`, Cargo, matching standard libraries and target support,
177
+ a working C linker, cached crates and locked dependency resolution. Use maturin
178
+ or setuptools-rust for relevant Python extension recipes. `rustup` may provision
179
+ a toolchain but is not itself the compiler or an inference dependency.
180
+ - **Python builds:** Python development headers, pip/build/setuptools/wheel,
181
+ Cython, meson-python/Meson or scikit-build-core as declared by each package.
182
+ Add OpenSSL, libffi, zlib, other compression headers, BLAS/LAPACK, and Fortran
183
+ compiler/runtime only for recipes that require them.
184
+ - **Wasm builds:** pinned Emscripten, LLVM/LLD, separate WASI sysroot, compatible
185
+ Rust target and the owned CPython extension headers/ABI. Keep Emscripten Python
186
+ side modules distinct from WASI command modules. Begin with reproducible builds
187
+ outside the browser; compiling these tools themselves to browser-compatible
188
+ Wasm is a separately tested capability.
189
+ - **Ollama source builds, if later needed:** derive the Go, C/C++ and build-system
190
+ requirements from the pinned upstream release. Building from source is optional;
191
+ installing its official Linux artifact must work without a compiler.
192
+
193
+ Publish recipes, patches, source hashes and target manifests for these toolchains.
194
+ Prebuilt runtime packs should remain sufficient for normal users; downloading an
195
+ entire compiler stack must not be required merely to load a model.
196
+
197
+ ## Distribution and dependency resolution
198
+
199
+ Define a versioned manifest for each pack and the future agent package containing:
200
+
201
+ - Pack ID/version, execution profile, CPU architecture, OS/libc, Python ABI or
202
+ Wasm ABI as applicable, and minimum runtime capabilities.
203
+ - Direct dependencies plus a resolved transitive lock with versions, artifact
204
+ URLs, hashes, installed paths, compressed/expanded sizes and licenses/notices.
205
+ - Required CPU features, RAM/disk estimates, network endpoints, install recipe,
206
+ readiness checks and supported test matrix.
207
+ - Build-only versus runtime dependencies, optional extras and model assets.
208
+
209
+ The agent manifest requests these capabilities; the resolver chooses only packs
210
+ compatible with its declared profile. Use separate Linux and Wasm package stores,
211
+ and never silently switch execution profiles after an installation failure.
212
+ Provide atomic installs, retry/resume, cache reuse, clean uninstall and rollback
213
+ without deleting user models. Browser asset hosting must support the required
214
+ CORS, worker URLs and cross-origin isolation for SharedArrayBuffer-based paths.
215
+ Record third-party distribution obligations, including kernel/rootfs source and
216
+ notice requirements, before publishing packs through the wheels site.
217
+
218
+ ## Model responsibility and documented limits
219
+
220
+ The user will supply approximately 120M–200M parameter models; creating and
221
+ uploading them is outside this phase. Validate a compatible small model once one
222
+ is available. Parameter count alone does not establish compatibility: model
223
+ architecture, file format, operators, quantization and runner support also matter.
224
+
225
+ There must be no arbitrary parameter-count block. Let users select models and
226
+ show estimated memory, available resources and measured performance. Billion-
227
+ parameter models are outside the initial validation target and may be impractical
228
+ in the emulated Linux profile; this is not a universal claim that every such model
229
+ cannot run. Even 120M–200M models are not guaranteed to run smoothly until measured.
230
+ Weights alone require roughly parameters × bits-per-weight / 8 bytes, with
231
+ additional memory for the kernel, emulator, runtime, activations, KV cache and
232
+ temporary copies. Resource exhaustion and cancellation must fail cleanly.
233
+
234
+ ## Implementation order and acceptance gates
235
+
236
+ 1. **Lock the architecture:** select candidate emulator, guest architecture,
237
+ kernel/rootfs and package versions. Inventory the actual binary dependency
238
+ closure. Stop claiming Linux compatibility until the following gates pass.
239
+ 2. **Prove the Linux foundation:** boot in a real browser, run dynamically linked
240
+ native programs, exercise processes/threads/mmap, install a distro package and
241
+ preserve files across restart. Verify networking through the declared transport.
242
+ 3. **Prove upstream Ollama:** install the official pinned artifact, start its
243
+ server and exercise its API. Separately validate its CPU runner with a small
244
+ compatible model; report memory and performance without making model creation
245
+ part of this phase.
246
+ 4. **Prove native Python ML:** install the locked CPU wheels, import torch and
247
+ Transformers, perform tensor operations and run one small supported inference
248
+ task. Test hub downloads, offline cache and process cleanup.
249
+ 5. **Prove browser ML independently:** load Transformers.js through the browser
250
+ export, load matching backend assets, and run a small ONNX model. Exercise the
251
+ Wasm path and optional WebGPU path separately.
252
+ 6. **Prove toolchains:** compile and run a C/C++ program and Rust program in the
253
+ Linux guest; build/import representative C and Rust Python extensions. Verify
254
+ separate Wasm outputs against the existing runtime ABI.
255
+ 7. **Publish dependency packs:** lock transitive artifacts and document browser,
256
+ CPU, memory, storage, networking and package limitations. Test interrupted
257
+ installs, restart, cancellation, version conflicts and missing capabilities.
258
+
259
+ Phase one is complete when these dependency paths are reproducible and their
260
+ tests pass. The later `.sbjs` agent application can then depend on demonstrated
261
+ capabilities instead of assumed Linux command compatibility.
package/docs/vireo.md ADDED
@@ -0,0 +1,58 @@
1
+ # Vireo browser engine
2
+
3
+ SandboxedJs keeps browser automation APIs in the runtime and distributes the
4
+ browser engine independently. The `chrome` command is a Chrome DevTools
5
+ Protocol compatibility process used by unmodified Node and Python Playwright;
6
+ Vireo is the Rust/WebAssembly document engine behind it.
7
+
8
+ ## Installation
9
+
10
+ Vireo is a signed `.sbjs` application from the standard application registry:
11
+
12
+ ```sh
13
+ pm install vireo
14
+ ```
15
+
16
+ Playwright does not need a separate setup step. Installing `playwright-core`
17
+ or Python `playwright` creates the executable stubs Playwright expects. The
18
+ first launch of one of those stubs installs Vireo if it is absent, verifies its
19
+ registry digest, package manifest, and Ed25519 signature, then loads the WASM
20
+ module from `/opt/vireo`. Set `SBX_VIREO_AUTOINSTALL=0` to prohibit that lazy
21
+ network installation; the compatibility process then retains its minimal
22
+ JavaScript-only fallback.
23
+
24
+ The application registry can still be replaced with `SBX_PM_REGISTRY`, which
25
+ is useful for offline mirrors and tests.
26
+
27
+ ## Package contract
28
+
29
+ Vireo's `app.json` advertises a versioned engine contract:
30
+
31
+ ```json
32
+ {
33
+ "provides": ["browser-engine", "playwright-browser"],
34
+ "browserEngine": {
35
+ "abi": "sandboxedjs-browser-engine-v1",
36
+ "wasm": "engine/vireo.wasm",
37
+ "product": "Vireo/0.1.0"
38
+ }
39
+ }
40
+ ```
41
+
42
+ The v1 WASM ABI transfers a fetched HTML document and its final URL into
43
+ Vireo, and receives a serialized, browser-parsed document tree. Networking
44
+ stays in SandboxedJs so the same outbound policy, proxy, loopback isolation,
45
+ and accounting apply to browser navigation as to `curl` and guest `fetch`.
46
+
47
+ ## Current compatibility
48
+
49
+ Vireo 0.1 supplies standards-based HTML5 parsing, real HTTP navigation,
50
+ redirect handling, document titles, text, attributes, and basic CSS selector
51
+ queries in page evaluation. `page.goto()`, `page.title()`, and direct
52
+ `page.evaluate()` document access work through unmodified Playwright.
53
+
54
+ This is the first engine ABI, not a claim of Chromium parity. External and
55
+ inline page scripts, subresources, complete DOM mutation, cross-world element
56
+ adoption, layout, input actionability, frames, and screenshots remain future
57
+ Vireo engine/runtime capabilities. Unsupported CDP methods continue to return
58
+ `Method not found`; they are not acknowledged with fabricated results.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sandboxedjs",
3
- "version": "0.2.19",
4
- "description": "A Linux-like container that runs entirely inside Node.js — POSIX shell, ~140 coreutils, Node.js and Python runtimes, virtual filesystem and networking. No Docker, no VM, no native modules.",
3
+ "version": "0.2.21",
4
+ "description": "A zero-infra JavaScript and Python sandbox for AI agents and browser IDEs. A lightweight, secure alternative to WebContainers and NodePod for running untrusted code with a full POSIX shell.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "sideEffects": false,
@@ -80,7 +80,15 @@
80
80
  "python",
81
81
  "webcontainer",
82
82
  "virtual-filesystem",
83
- "emulator"
83
+ "emulator",
84
+ "ai-agent-sandbox",
85
+ "javascript-sandboxing",
86
+ "code-execution",
87
+ "webcontainer-alternative",
88
+ "nodepod-alternative",
89
+ "untrusted-code",
90
+ "browser-ide",
91
+ "secure-sandbox"
84
92
  ],
85
93
  "dependencies": {
86
94
  "@noble/hashes": "^1.8.0",
@@ -100,6 +108,7 @@
100
108
  "set-cookie-parser": "^3.1.2",
101
109
  "stream-browserify": "^3.0.0",
102
110
  "string_decoder": "^1.3.0",
111
+ "sucrase": "^3.35.1",
103
112
  "timers-browserify": "^2.0.12",
104
113
  "url": "^0.11.4",
105
114
  "wa-sqlite": "^1.0.0"