isol8 0.2.0 → 0.3.0

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 CHANGED
@@ -101,6 +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` | Stream output in real-time | `false` |
104
105
  | `--persistent` | Keep container alive between runs | `false` |
105
106
  | `--timeout <ms>` | Execution timeout in milliseconds | `30000` |
106
107
  | `--memory <limit>` | Memory limit (e.g. `512m`, `1g`) | `512m` |
package/dist/cli.js CHANGED
@@ -6929,6 +6929,11 @@ var require_utils2 = __commonJS((exports, module) => {
6929
6929
  };
6930
6930
  });
6931
6931
 
6932
+ // node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node
6933
+ var require_sshcrypto = __commonJS((exports, module) => {
6934
+ module.exports = __require("./sshcrypto-0209sx47.node");
6935
+ });
6936
+
6932
6937
  // node_modules/ssh2/lib/protocol/crypto/poly1305.js
6933
6938
  var require_poly1305 = __commonJS((exports, module) => {
6934
6939
  var __dirname = "/home/runner/work/isol8/isol8/node_modules/ssh2/lib/protocol/crypto", __filename = "/home/runner/work/isol8/isol8/node_modules/ssh2/lib/protocol/crypto/poly1305.js";
@@ -7415,7 +7420,7 @@ var require_crypto = __commonJS((exports, module) => {
7415
7420
  var ChaChaPolyDecipher;
7416
7421
  var GenericDecipher;
7417
7422
  try {
7418
- binding = (()=>{throw new Error("Cannot require module "+"./crypto/build/Release/sshcrypto.node");})();
7423
+ binding = require_sshcrypto();
7419
7424
  ({
7420
7425
  AESGCMCipher,
7421
7426
  ChaChaPolyCipher,
@@ -61218,7 +61223,7 @@ program2.command("setup").description("Check Docker and build isol8 images").opt
61218
61223
  console.log(`
61219
61224
  [DONE] Setup complete!`);
61220
61225
  });
61221
- 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").action(async (file, opts) => {
61226
+ 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", "Stream output in real-time").action(async (file, opts) => {
61222
61227
  const { code, runtime, engineOptions, engine, stdinData } = await resolveRunInput(file, opts);
61223
61228
  const spinner = ora("Starting execution...").start();
61224
61229
  try {
@@ -61231,23 +61236,42 @@ program2.command("run").description("Execute code in isol8").argument("[file]",
61231
61236
  ...stdinData ? { stdin: stdinData } : {},
61232
61237
  ...opts.install.length > 0 ? { installPackages: opts.install } : {}
61233
61238
  };
61234
- const result = await engine.execute(req);
61235
- spinner.stop();
61236
- if (result.stdout) {
61237
- console.log(result.stdout);
61238
- }
61239
- if (result.stderr) {
61240
- console.error(result.stderr);
61241
- }
61242
- if (result.truncated) {
61243
- console.error("[WARN] Output was truncated");
61244
- }
61245
- if (opts.out && result.stdout) {
61246
- writeFileSync(opts.out, result.stdout, "utf-8");
61247
- console.error(`[INFO] Output written to ${opts.out}`);
61248
- }
61249
- if (result.exitCode !== 0) {
61250
- process.exit(result.exitCode);
61239
+ if (opts.stream) {
61240
+ spinner.stop();
61241
+ const stream = engine.executeStream(req);
61242
+ for await (const event of stream) {
61243
+ if (event.type === "stdout") {
61244
+ process.stdout.write(event.data);
61245
+ } else if (event.type === "stderr") {
61246
+ process.stderr.write(event.data);
61247
+ } else if (event.type === "exit") {
61248
+ if (event.data !== "0") {
61249
+ process.exit(Number.parseInt(event.data, 10));
61250
+ }
61251
+ } else if (event.type === "error") {
61252
+ console.error(`[ERR] ${event.data}`);
61253
+ process.exit(1);
61254
+ }
61255
+ }
61256
+ } else {
61257
+ const result = await engine.execute(req);
61258
+ spinner.stop();
61259
+ if (result.stdout) {
61260
+ console.log(result.stdout);
61261
+ }
61262
+ if (result.stderr) {
61263
+ console.error(result.stderr);
61264
+ }
61265
+ if (result.truncated) {
61266
+ console.error("[WARN] Output was truncated");
61267
+ }
61268
+ if (opts.out && result.stdout) {
61269
+ writeFileSync(opts.out, result.stdout, "utf-8");
61270
+ console.error(`[INFO] Output written to ${opts.out}`);
61271
+ }
61272
+ if (result.exitCode !== 0) {
61273
+ process.exit(result.exitCode);
61274
+ }
61251
61275
  }
61252
61276
  } catch (err) {
61253
61277
  spinner.stop();
@@ -61483,4 +61507,4 @@ if (!process.argv.slice(2).length) {
61483
61507
  }
61484
61508
  program2.parse();
61485
61509
 
61486
- //# debugId=420EBE4C8706C16E64756E2164756E21
61510
+ //# debugId=1EC5CA4C4BAF17C964756E2164756E21