Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ On failure:

## v0.5.0: Node.js Ecosystem Compatibility Extended

**Status:** 🗓️ Planned
**Status:** 🗓️ In Progress

**Goal:** Enable natural Node.js development patterns and improve npm package compatibility in WASM.

**Polyfills needed:**

- [ ] **path:** Use `path-browserify` and alias `import path from 'path'`.
- [ ] **os:** Custom minimal polyfill for `import os from 'os'`.
- [x] **path:** Use `path-browserify` and alias `import path from 'path'`.
- [x] **os:** Custom minimal polyfill for `import os from 'os'`.
- [ ] **Global process:** Comprehensive `process` polyfill (env, argv, cwd, exit, nextTick) injected as a global via esbuild.
- [ ] **url:** Alias Node's `import { URL } from 'url'` to native Web `URL` class.
- [ ] **buffer:** Use `buffer` package to polyfill Node.js `Buffer` class → `Uint8Array`.
Expand All @@ -106,5 +106,4 @@ On failure:
- `fs.readFile()` → Capsule's `readText()`/`readBytes()`
- `fs.writeFile()` → Capsule's `writeText()`/`writeBytes()`
- `fs.readdir()` → Capsule's `list()`
- Document supported subset vs. full Node.js `fs` API
---
4 changes: 2 additions & 2 deletions crates/capsule-cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/capsule-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "capsule-run"
version = "0.4.2"
version = "0.5.0"
edition = "2024"
description = "Secure WASM runtime to isolate and manage AI agent tasks"
license = "Apache-2.0"
Expand All @@ -16,7 +16,7 @@ path = "src/main.rs"

[dependencies]
clap = { version = "4.5.53", features = ["derive"] }
capsule-core = { version= "0.4.2", path = "../capsule-core" }
capsule-core = { version= "0.5.0", path = "../capsule-core" }
tokio = { version = "1.48.0", features = ["rt", "rt-multi-thread", "macros"] }
serde_json = "1"
dotenvy = "0.15.7"
10 changes: 5 additions & 5 deletions crates/capsule-cli/npm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@capsule-run/cli",
"version": "0.4.2",
"version": "0.5.0",
"description": "Secure WASM runtime to isolate and manage AI agent tasks",
"bin": {
"capsule": "./bin/capsule.js"
Expand Down Expand Up @@ -29,9 +29,9 @@
"node": ">=18"
},
"optionalDependencies": {
"@capsule-run/cli-darwin-arm64": "0.4.2",
"@capsule-run/cli-darwin-x64": "0.4.2",
"@capsule-run/cli-linux-x64": "0.4.2",
"@capsule-run/cli-win32-x64": "0.4.2"
"@capsule-run/cli-darwin-arm64": "0.5.0",
"@capsule-run/cli-darwin-x64": "0.5.0",
"@capsule-run/cli-linux-x64": "0.5.0",
"@capsule-run/cli-win32-x64": "0.5.0"
}
}
2 changes: 1 addition & 1 deletion crates/capsule-cli/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "capsule-run"
version = "0.4.2"
version = "0.5.0"
description = "Secure WASM runtime to isolate and manage AI agent tasks"
readme = "docs/README-pypi.md"
license = {text = "Apache-2.0"}
Expand Down
2 changes: 1 addition & 1 deletion crates/capsule-core/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/capsule-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "capsule-core"
version = "0.4.2"
version = "0.5.0"
edition = "2024"
description = "Core library for Capsule - WASM runtime for AI agent isolation"
license = "Apache-2.0"
Expand Down
11 changes: 11 additions & 0 deletions crates/capsule-core/src/wasm/compiler/javascript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ export const taskRunner = exports;
let sdk_path_normalized = Self::normalize_path_for_command(&sdk_path);
let output_wasm_normalized = Self::normalize_path_for_command(&self.output_wasm);

let sdk_node_modules = sdk_path_normalized.join("node_modules");
let path_browserify_path = sdk_node_modules.join("path-browserify");
let os_polyfill_path = sdk_path_normalized.join("dist/polyfills/os.js");

let esbuild_output = Self::npx_command()
.arg("esbuild")
.arg(&wrapper_path_normalized)
Expand All @@ -168,6 +172,13 @@ export const taskRunner = exports;
.arg("--external:capsule:host/api")
.arg("--external:wasi:filesystem/*")
.arg("--external:wasi:cli/*")
.arg(format!("--alias:path={}", path_browserify_path.display()))
.arg(format!(
"--alias:node:path={}",
path_browserify_path.display()
))
.arg(format!("--alias:os={}", os_polyfill_path.display()))
.arg(format!("--alias:node:os={}", os_polyfill_path.display()))
.arg(format!("--outfile={}", bundled_path_normalized.display()))
.current_dir(&sdk_path_normalized)
.stdout(Stdio::piped())
Expand Down
21 changes: 19 additions & 2 deletions crates/capsule-sdk/javascript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion crates/capsule-sdk/javascript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@capsule-run/sdk",
"version": "0.4.2",
"version": "0.5.0",
"description": "Capsule JavaScript SDK - run AI agent tasks in secure WASM sandboxes",
"type": "module",
"main": "./dist/index.js",
Expand Down Expand Up @@ -40,6 +40,18 @@
"dependencies": {
"@bytecodealliance/jco": "^1.0.0",
"esbuild": "^0.27.2",
"path-browserify": "^1.0.1",
"typescript": "^5.9.3"
},
"devDependencies": {
"@types/path-browserify": "^1.0.3"
},
"peerDependencies": {
"@types/node": ">=18"
},
"peerDependenciesMeta": {
"@types/node": {
"optional": true
}
}
}
2 changes: 2 additions & 0 deletions crates/capsule-sdk/javascript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ export { TaskRunner, exports, type TaskConfig } from "./app.js";
export * as files from "./files.js";
export * as env from "./env.js";
export { isWasmMode } from "./hostApi.js";
export { default as path } from "./polyfills/path.js";
export { default as os } from "./polyfills/os.js";

Loading