sandboxedjs 0.2.18 → 0.2.20
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.
- package/README.md +29 -10
- package/bin/sandboxedjs-pack.mjs +4 -0
- package/dist/index.cjs +625 -99
- package/dist/index.js +625 -99
- package/docs/agent/README.md +35 -60
- package/docs/vireo.md +58 -0
- package/package.json +11 -3
package/docs/agent/README.md
CHANGED
|
@@ -1,77 +1,52 @@
|
|
|
1
|
-
# SandboxedJS
|
|
1
|
+
# SandboxedJS for AI Agents
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
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
|
-
|
|
7
|
+
## Why a Real Shell for Agents?
|
|
11
8
|
|
|
12
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
22
|
-
passes or a stop condition requires the user or a stronger model.
|
|
17
|
+
## Integration
|
|
23
18
|
|
|
24
|
-
|
|
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
|
-
|
|
21
|
+
```ts
|
|
22
|
+
import { SandboxedJsBackend, installSandboxSkills } from "sandboxedjs/agent";
|
|
27
23
|
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
43
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
This project owns:
|
|
32
|
+
const agent = createDeepAgent({
|
|
33
|
+
model,
|
|
34
|
+
backend: new SandboxedJsBackend(box, { cwd: "/app" }),
|
|
35
|
+
});
|
|
36
|
+
```
|
|
56
37
|
|
|
57
|
-
|
|
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
|
-
|
|
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
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
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
|
-
##
|
|
46
|
+
## Technical Specification
|
|
74
47
|
|
|
75
|
-
|
|
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.
|
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.
|
|
4
|
-
"description": "A
|
|
3
|
+
"version": "0.2.20",
|
|
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",
|