kern-sandbox 0.2.34 → 0.2.35

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 +3 -1
  2. package/index.js +11 -2
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -10,7 +10,9 @@ runtime's own are in [BENCHMARKS.md](https://github.com/getkern/kern/blob/main/B
10
10
  `kern-sandbox` is the Node and TypeScript binding for **[kern](https://getkern.dev)**: a rootless,
11
11
  kernel-enforced sandbox out of one static binary, with no daemon, no VM and no cloud. An agent's
12
12
  tool-call, a model's generated snippet, a CI step: code that runs before anyone reads it gets its own
13
- box, and the box is thrown away after.
13
+ box, and the box is thrown away after. A hundred calls are a hundred boxes and 1.4 s in total, with
14
+ nothing left behind, and when state has to carry across them there is
15
+ [a session](#a-session-files-persist-processes-are-ephemeral) and a warm interpreter.
14
16
 
15
17
  Network off, memory and PID caps the kernel enforces **where your host delegates them**,
16
18
  capabilities dropped, a deny-by-default seccomp allowlist, and a wall-clock deadline the binding
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.2.34";
39
+ const VERSION = "0.2.35";
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
@@ -1070,6 +1070,15 @@ function isKernDiagnostic(line) {
1070
1070
  return KERN_DIAGNOSTICS.some((p) => s.startsWith(p));
1071
1071
  }
1072
1072
 
1073
+ /** Why the box did not start: kern's stderr with its warning and note lines dropped, capped at 500.
1074
+ * kern writes those BEFORE the error, and inside a container (the shape Google Colab has) a ~430-
1075
+ * character warning pushed `error: sandbox: unprivileged user namespaces are unavailable` to character
1076
+ * 557, past a plain first-500 cut. Mirrors `_startup_failure_message` in the Python binding. */
1077
+ function startupFailureMessage(stderr) {
1078
+ const kept = stderr.split("\n").filter((l) => !isKernDiagnostic(l)).join("\n").trim();
1079
+ return (kept || stderr.trim()).slice(0, 500);
1080
+ }
1081
+
1073
1082
  /** The sentence kern prints when it has READ the kernel's OOM counter for this box's own cgroup. A
1074
1083
  * contract between two programs: if kern rewords it, this stops recognising a real OOM and starts
1075
1084
  * reporting `killed` - wrong in the safe direction, still wrong. Mirrors `_KERN_OOM_MARKER`. */
@@ -2061,7 +2070,7 @@ class Sandbox {
2061
2070
  // exits 125 ITSELF (the code ran and chose 125) is NOT mislabeled. `finish` REJECTS only on rc===125;
2062
2071
  // a non-125 startup_failed (an older kern's 127, or a forged marker) is returned as DATA, not thrown.
2063
2072
  if (rc !== 0 && looksLikeStartupFailure(stderr))
2064
- return sandboxFault("startup_failed", stderr.trim().slice(0, 500));
2073
+ return sandboxFault("startup_failed", startupFailureMessage(stderr));
2065
2074
  // Any other non-zero exit (incl. 139 SIGSEGV) is the USER's code failing - a normal Result.
2066
2075
  return null;
2067
2076
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kern-sandbox",
3
- "version": "0.2.34",
4
- "description": "Run LLM-generated code in a real Linux container, one per call, on your own machine. No daemon, no VM, no cloud, no account. A kernel boundary, not a microVM: for deliberately hostile code, use one.",
3
+ "version": "0.2.35",
4
+ "description": "Your model writes the code. This runs it where it can't touch your machine: a rootless Linux container, no daemon, no VM, no cloud, no account. A kernel boundary, not a microVM: for deliberately hostile code, use one.",
5
5
  "keywords": [
6
6
  "sandbox",
7
7
  "kern",