isol8 0.3.1 → 0.4.1
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 +1 -1
- package/dist/cli.js +16 -4
- package/dist/cli.js.map +4 -4
- package/dist/index.js +7 -3
- package/dist/index.js.map +3 -3
- package/dist/src/engine/docker.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -101,7 +101,7 @@ isol8 run script.py --host http://server:3000 --key my-api-key
|
|
|
101
101
|
| `--allow <regex>` | Whitelist regex (repeatable, for `filtered`) | — |
|
|
102
102
|
| `--deny <regex>` | Blacklist regex (repeatable, for `filtered`) | — |
|
|
103
103
|
| `--out <file>` | Write stdout to file | — |
|
|
104
|
-
| `--stream` |
|
|
104
|
+
| `--no-stream` | Disable real-time output streaming | `false` |
|
|
105
105
|
| `--persistent` | Keep container alive between runs | `false` |
|
|
106
106
|
| `--timeout <ms>` | Execution timeout in milliseconds | `30000` |
|
|
107
107
|
| `--memory <limit>` | Memory limit (e.g. `512m`, `1g`) | `512m` |
|
package/dist/cli.js
CHANGED
|
@@ -55293,7 +55293,7 @@ function getInstallCommand(runtime, packages) {
|
|
|
55293
55293
|
case "python":
|
|
55294
55294
|
return ["pip", "install", "--user", "--no-cache-dir", "--break-system-packages", ...packages];
|
|
55295
55295
|
case "node":
|
|
55296
|
-
return ["npm", "install", "
|
|
55296
|
+
return ["npm", "install", "--prefix", "/sandbox", ...packages];
|
|
55297
55297
|
case "bun":
|
|
55298
55298
|
return ["bun", "install", "-g", "--global-dir=/sandbox/.bun-global", ...packages];
|
|
55299
55299
|
case "deno":
|
|
@@ -55316,6 +55316,10 @@ async function installPackages(container, runtime, packages) {
|
|
|
55316
55316
|
env2.push("NPM_CONFIG_PREFIX=/sandbox/.npm-global");
|
|
55317
55317
|
env2.push("NPM_CONFIG_CACHE=/sandbox/.npm-cache");
|
|
55318
55318
|
env2.push("npm_config_cache=/sandbox/.npm-cache");
|
|
55319
|
+
} else if (runtime === "bun") {
|
|
55320
|
+
env2.push("BUN_INSTALL_GLOBAL_DIR=/sandbox/.bun-global");
|
|
55321
|
+
env2.push("BUN_INSTALL_CACHE_DIR=/sandbox/.bun-cache");
|
|
55322
|
+
env2.push("BUN_INSTALL_BIN=/sandbox/.bun-global/bin");
|
|
55319
55323
|
} else if (runtime === "deno") {
|
|
55320
55324
|
env2.push("DENO_DIR=/sandbox/.deno");
|
|
55321
55325
|
}
|
|
@@ -61221,8 +61225,14 @@ program2.command("setup").description("Check Docker and build isol8 images").opt
|
|
|
61221
61225
|
console.log(`
|
|
61222
61226
|
[DONE] Setup complete!`);
|
|
61223
61227
|
});
|
|
61224
|
-
program2.command("run").description("Execute code in isol8").argument("[file]", "Script file to execute").option("-e, --eval <code>", "Execute inline code string").option("-r, --runtime <name>", "Force runtime (python, node, bun, deno, bash)").option("--net <mode>", "Network mode: none, host, filtered", "none").option("--allow <regex>", "Whitelist regex for filtered mode (repeatable)", collect, []).option("--deny <regex>", "Blacklist regex for filtered mode (repeatable)", collect, []).option("--out <file>", "Write output to file").option("--persistent", "Use persistent container").option("--timeout <ms>", "Execution timeout in milliseconds").option("--memory <limit>", "Memory limit (e.g. 512m, 1g)").option("--cpu <limit>", "CPU limit as fraction (e.g. 0.5, 2.0)").option("--image <name>", "Override Docker image").option("--pids-limit <n>", "Maximum number of processes").option("--writable", "Disable read-only root filesystem").option("--max-output <bytes>", "Maximum output size in bytes").option("--secret <KEY=VALUE>", "Secret env var (repeatable, values masked)", collect, []).option("--sandbox-size <size>", "Sandbox tmpfs size (e.g. 128m)").option("--tmp-size <size>", "Tmp tmpfs size (e.g. 256m, 512m)").option("--stdin <data>", "Data to pipe to stdin").option("--install <package>", "Install package for runtime (repeatable)", collect, []).option("--host <url>", "Execute on remote server").option("--key <key>", "API key for remote server").option("--stream", "
|
|
61228
|
+
program2.command("run").description("Execute code in isol8").argument("[file]", "Script file to execute").option("-e, --eval <code>", "Execute inline code string").option("-r, --runtime <name>", "Force runtime (python, node, bun, deno, bash)").option("--net <mode>", "Network mode: none, host, filtered", "none").option("--allow <regex>", "Whitelist regex for filtered mode (repeatable)", collect, []).option("--deny <regex>", "Blacklist regex for filtered mode (repeatable)", collect, []).option("--out <file>", "Write output to file").option("--persistent", "Use persistent container").option("--timeout <ms>", "Execution timeout in milliseconds").option("--memory <limit>", "Memory limit (e.g. 512m, 1g)").option("--cpu <limit>", "CPU limit as fraction (e.g. 0.5, 2.0)").option("--image <name>", "Override Docker image").option("--pids-limit <n>", "Maximum number of processes").option("--writable", "Disable read-only root filesystem").option("--max-output <bytes>", "Maximum output size in bytes").option("--secret <KEY=VALUE>", "Secret env var (repeatable, values masked)", collect, []).option("--sandbox-size <size>", "Sandbox tmpfs size (e.g. 128m)").option("--tmp-size <size>", "Tmp tmpfs size (e.g. 256m, 512m)").option("--stdin <data>", "Data to pipe to stdin").option("--install <package>", "Install package for runtime (repeatable)", collect, []).option("--host <url>", "Execute on remote server").option("--key <key>", "API key for remote server").option("--no-stream", "Disable real-time output streaming").action(async (file, opts) => {
|
|
61225
61229
|
const { code, runtime, engineOptions, engine, stdinData } = await resolveRunInput(file, opts);
|
|
61230
|
+
const cleanup = async () => {
|
|
61231
|
+
await engine.stop();
|
|
61232
|
+
process.exit(0);
|
|
61233
|
+
};
|
|
61234
|
+
process.on("SIGINT", cleanup);
|
|
61235
|
+
process.on("SIGTERM", cleanup);
|
|
61226
61236
|
const spinner = ora("Starting execution...").start();
|
|
61227
61237
|
try {
|
|
61228
61238
|
await engine.start();
|
|
@@ -61234,7 +61244,7 @@ program2.command("run").description("Execute code in isol8").argument("[file]",
|
|
|
61234
61244
|
...stdinData ? { stdin: stdinData } : {},
|
|
61235
61245
|
...opts.install.length > 0 ? { installPackages: opts.install } : {}
|
|
61236
61246
|
};
|
|
61237
|
-
if (opts.stream) {
|
|
61247
|
+
if (opts.stream !== false) {
|
|
61238
61248
|
spinner.stop();
|
|
61239
61249
|
const stream = engine.executeStream(req);
|
|
61240
61250
|
for await (const event of stream) {
|
|
@@ -61276,6 +61286,8 @@ program2.command("run").description("Execute code in isol8").argument("[file]",
|
|
|
61276
61286
|
throw err;
|
|
61277
61287
|
} finally {
|
|
61278
61288
|
await engine.stop();
|
|
61289
|
+
process.off("SIGINT", cleanup);
|
|
61290
|
+
process.off("SIGTERM", cleanup);
|
|
61279
61291
|
}
|
|
61280
61292
|
});
|
|
61281
61293
|
program2.command("serve").description("Start the isol8 remote server").option("-p, --port <port>", "Port to listen on", "3000").option("-k, --key <key>", "API key for authentication").action(async (opts) => {
|
|
@@ -61505,4 +61517,4 @@ if (!process.argv.slice(2).length) {
|
|
|
61505
61517
|
}
|
|
61506
61518
|
program2.parse();
|
|
61507
61519
|
|
|
61508
|
-
//# debugId=
|
|
61520
|
+
//# debugId=AF05A942A56C65F664756E2164756E21
|