kern-sandbox 0.1.30 → 0.1.32

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.
Files changed (3) hide show
  1. package/README.md +14 -2
  2. package/index.js +11 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -33,8 +33,14 @@ import { runCode, withSandbox, Sandbox } from "kern-sandbox";
33
33
  npm install kern-sandbox
34
34
  ```
35
35
 
36
- You also need the `kern` binary on `PATH` (or point `$KERN_BIN` at it). Build it on Linux (no
37
- prebuilt binaries are published yet):
36
+ You also need the `kern` binary on `PATH` (or point `$KERN_BIN` at it). The quickest route is the
37
+ released static binary, whose checksum the script verifies:
38
+
39
+ ```sh
40
+ curl -fsSL https://raw.githubusercontent.com/getkern/kern/main/install.sh | sh
41
+ ```
42
+
43
+ From source instead, if you would rather not trust a published artifact:
38
44
 
39
45
  ```sh
40
46
  cargo install --git https://github.com/getkern/kern getkern --locked
@@ -43,6 +49,12 @@ cargo install --git https://github.com/getkern/kern getkern --locked
43
49
  kern needs a Linux kernel with unprivileged user namespaces + cgroup v2. On Windows it runs under WSL2.
44
50
  Node 18+.
45
51
 
52
+ **On a Mac this package installs but cannot run**, and it says so rather than sending you after a
53
+ download that does not exist: kern is Linux-only, because macOS has no namespaces and no cgroups. Run
54
+ inside a Linux VM (colima, Lima, OrbStack, UTM), install `kern` and this package there, and it behaves
55
+ as on Linux. Verified on Apple Silicon with an Ubuntu 24.04 guest.
56
+ [Install notes for macOS](https://github.com/getkern/kern/blob/main/docs/INSTALL.md).
57
+
46
58
  ## A session: files persist, processes are ephemeral
47
59
 
48
60
  File state lives in a workspace directory on the host, bind-mounted into every box. Each `runCode`/`run`
package/index.js CHANGED
@@ -36,7 +36,7 @@ const crypto = require("crypto");
36
36
  const zlib = require("zlib");
37
37
  const { spawn, spawnSync } = require("child_process");
38
38
 
39
- const VERSION = "0.1.29";
39
+ const VERSION = "0.1.32";
40
40
 
41
41
  const DEFAULT_IMAGE = "python:3.12-slim";
42
42
  const WORKSPACE = "/workspace"; // where the persistent workspace is mounted inside every box
@@ -499,6 +499,16 @@ function findKern() {
499
499
  }
500
500
  }
501
501
  }
502
+ // On macOS the generic "install it" is a dead end: there is no macOS build to install. kern needs
503
+ // a Linux kernel, so the answer is a VM, and the error says which one rather than leaving the
504
+ // reader hunting for a download that does not exist.
505
+ if (process.platform === "darwin")
506
+ throw new SandboxError(
507
+ "the `kern` binary was not found on PATH, and this is macOS: kern is Linux-only " +
508
+ "(no namespaces, no cgroups on a Mac), so there is no macOS build to find. " +
509
+ "Run inside a Linux VM (colima, Lima, OrbStack, UTM), where kern installs normally, " +
510
+ "or set $KERN_BIN to a kern reachable from here. https://github.com/getkern/kern",
511
+ );
502
512
  throw new SandboxError(
503
513
  "the `kern` binary was not found on PATH - install it " +
504
514
  "(https://github.com/getkern/kern) or set $KERN_BIN",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kern-sandbox",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "description": "kern is a fast, rootless sandbox and virtual resource runtime for any workload, including untrusted and AI-generated code; kern-sandbox is its Node/TypeScript binding. Run untrusted or agent-generated code (Python/JS/Bash) in a real, kernel-enforced box in single-digit milliseconds, with no cloud, no account and no VM.",
5
5
  "keywords": [
6
6
  "sandbox",