isol8 0.3.1 → 0.4.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,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` | Stream output in real-time | `false` |
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
@@ -61221,8 +61221,14 @@ program2.command("setup").description("Check Docker and build isol8 images").opt
61221
61221
  console.log(`
61222
61222
  [DONE] Setup complete!`);
61223
61223
  });
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", "Stream output in real-time").action(async (file, opts) => {
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("--no-stream", "Disable real-time output streaming").action(async (file, opts) => {
61225
61225
  const { code, runtime, engineOptions, engine, stdinData } = await resolveRunInput(file, opts);
61226
+ const cleanup = async () => {
61227
+ await engine.stop();
61228
+ process.exit(0);
61229
+ };
61230
+ process.on("SIGINT", cleanup);
61231
+ process.on("SIGTERM", cleanup);
61226
61232
  const spinner = ora("Starting execution...").start();
61227
61233
  try {
61228
61234
  await engine.start();
@@ -61234,7 +61240,7 @@ program2.command("run").description("Execute code in isol8").argument("[file]",
61234
61240
  ...stdinData ? { stdin: stdinData } : {},
61235
61241
  ...opts.install.length > 0 ? { installPackages: opts.install } : {}
61236
61242
  };
61237
- if (opts.stream) {
61243
+ if (opts.stream !== false) {
61238
61244
  spinner.stop();
61239
61245
  const stream = engine.executeStream(req);
61240
61246
  for await (const event of stream) {
@@ -61276,6 +61282,8 @@ program2.command("run").description("Execute code in isol8").argument("[file]",
61276
61282
  throw err;
61277
61283
  } finally {
61278
61284
  await engine.stop();
61285
+ process.off("SIGINT", cleanup);
61286
+ process.off("SIGTERM", cleanup);
61279
61287
  }
61280
61288
  });
61281
61289
  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 +61513,4 @@ if (!process.argv.slice(2).length) {
61505
61513
  }
61506
61514
  program2.parse();
61507
61515
 
61508
- //# debugId=32DEDFAE67B3C8B564756E2164756E21
61516
+ //# debugId=D191C9C5DB033D7B64756E2164756E21