isol8 0.11.1 → 0.11.2
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 +3 -1
- package/dist/cli.js +109 -7
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -169,11 +169,13 @@ isol8 serve --update # Force re-download the server binary
|
|
|
169
169
|
|
|
170
170
|
| Flag | Description | Default |
|
|
171
171
|
|------|-------------|---------|
|
|
172
|
-
| `-p, --port <port>` | Port to listen on | `3000` |
|
|
172
|
+
| `-p, --port <port>` | Port to listen on | `--port` > `$ISOL8_PORT` > `$PORT` > `3000` |
|
|
173
173
|
| `-k, --key <key>` | API key for Bearer token auth | `$ISOL8_API_KEY` |
|
|
174
174
|
| `--update` | Force re-download the server binary | `false` |
|
|
175
175
|
| `--debug` | Enable debug logging for server operations | `false` |
|
|
176
176
|
|
|
177
|
+
If the selected port is already in use, `isol8 serve` now prompts to enter another port or auto-select an available one. In non-interactive environments, it auto-falls back to a free port.
|
|
178
|
+
|
|
177
179
|
### `isol8 config`
|
|
178
180
|
|
|
179
181
|
Display the resolved configuration (merged defaults + config file). Shows the source file, defaults, network rules, cleanup policy, and dependencies.
|
package/dist/cli.js
CHANGED
|
@@ -57171,7 +57171,7 @@ var package_default;
|
|
|
57171
57171
|
var init_package = __esm(() => {
|
|
57172
57172
|
package_default = {
|
|
57173
57173
|
name: "isol8",
|
|
57174
|
-
version: "0.11.
|
|
57174
|
+
version: "0.11.1",
|
|
57175
57175
|
description: "Secure code execution engine for AI agents",
|
|
57176
57176
|
author: "Illusion47586",
|
|
57177
57177
|
license: "MIT",
|
|
@@ -62747,14 +62747,16 @@ program2.command("run").description("Execute code in isol8").argument("[file]",
|
|
|
62747
62747
|
process.exit(exitCode);
|
|
62748
62748
|
}
|
|
62749
62749
|
});
|
|
62750
|
-
program2.command("serve").description("Start the isol8 remote server").option("-p, --port <port>", "Port to listen on"
|
|
62750
|
+
program2.command("serve").description("Start the isol8 remote server").option("-p, --port <port>", "Port to listen on").option("-k, --key <key>", "API key for authentication").option("--update", "Force re-download the server binary").option("--debug", "Enable debug logging").action(async (opts) => {
|
|
62751
62751
|
const apiKey = opts.key ?? process.env.ISOL8_API_KEY;
|
|
62752
62752
|
if (!apiKey) {
|
|
62753
62753
|
console.error("[ERR] API key required. Use --key or ISOL8_API_KEY env var.");
|
|
62754
62754
|
process.exit(1);
|
|
62755
62755
|
}
|
|
62756
|
-
const
|
|
62757
|
-
|
|
62756
|
+
const requestedPort = resolveServePort(opts.port);
|
|
62757
|
+
const port = await resolveAvailableServePort(requestedPort);
|
|
62758
|
+
logger.debug(`[Serve] Requested port: ${requestedPort}`);
|
|
62759
|
+
logger.debug(`[Serve] Using port: ${port}`);
|
|
62758
62760
|
logger.debug(`[Serve] API key: ${"*".repeat(apiKey.length)}`);
|
|
62759
62761
|
if (typeof globalThis.Bun !== "undefined") {
|
|
62760
62762
|
logger.debug("[Serve] Running under Bun, starting server in-process");
|
|
@@ -62861,6 +62863,11 @@ async function downloadServerBinary(binaryPath) {
|
|
|
62861
62863
|
}
|
|
62862
62864
|
}
|
|
62863
62865
|
async function promptYesNo(question) {
|
|
62866
|
+
const answer = await promptText(question);
|
|
62867
|
+
const normalized = answer.trim().toLowerCase();
|
|
62868
|
+
return normalized === "" || normalized === "y" || normalized === "yes";
|
|
62869
|
+
}
|
|
62870
|
+
async function promptText(question) {
|
|
62864
62871
|
const readline = await import("node:readline");
|
|
62865
62872
|
const rl = readline.createInterface({
|
|
62866
62873
|
input: process.stdin,
|
|
@@ -62870,8 +62877,103 @@ async function promptYesNo(question) {
|
|
|
62870
62877
|
rl.question(question, resolve3);
|
|
62871
62878
|
});
|
|
62872
62879
|
rl.close();
|
|
62873
|
-
|
|
62874
|
-
|
|
62880
|
+
return answer;
|
|
62881
|
+
}
|
|
62882
|
+
function parsePort(raw2, source) {
|
|
62883
|
+
const parsed = Number(raw2);
|
|
62884
|
+
if (!Number.isInteger(parsed) || parsed < 1 || parsed > 65535) {
|
|
62885
|
+
console.error(`[ERR] Invalid port from ${source}: ${raw2}. Expected 1-65535.`);
|
|
62886
|
+
process.exit(1);
|
|
62887
|
+
}
|
|
62888
|
+
return parsed;
|
|
62889
|
+
}
|
|
62890
|
+
function resolveServePort(portFlag) {
|
|
62891
|
+
if (typeof portFlag === "string") {
|
|
62892
|
+
return parsePort(portFlag, "--port");
|
|
62893
|
+
}
|
|
62894
|
+
if (process.env.ISOL8_PORT) {
|
|
62895
|
+
return parsePort(process.env.ISOL8_PORT, "ISOL8_PORT");
|
|
62896
|
+
}
|
|
62897
|
+
if (process.env.PORT) {
|
|
62898
|
+
return parsePort(process.env.PORT, "PORT");
|
|
62899
|
+
}
|
|
62900
|
+
return 3000;
|
|
62901
|
+
}
|
|
62902
|
+
async function isPortAvailable(port) {
|
|
62903
|
+
const { createServer: createServer2 } = await import("node:net");
|
|
62904
|
+
return await new Promise((resolve3) => {
|
|
62905
|
+
const server = createServer2();
|
|
62906
|
+
server.once("error", () => {
|
|
62907
|
+
resolve3(false);
|
|
62908
|
+
});
|
|
62909
|
+
server.once("listening", () => {
|
|
62910
|
+
server.close(() => resolve3(true));
|
|
62911
|
+
});
|
|
62912
|
+
server.listen(port);
|
|
62913
|
+
});
|
|
62914
|
+
}
|
|
62915
|
+
async function findAvailablePort() {
|
|
62916
|
+
const { createServer: createServer2 } = await import("node:net");
|
|
62917
|
+
return await new Promise((resolve3, reject) => {
|
|
62918
|
+
const server = createServer2();
|
|
62919
|
+
server.once("error", reject);
|
|
62920
|
+
server.once("listening", () => {
|
|
62921
|
+
const address = server.address();
|
|
62922
|
+
if (!address || typeof address === "string") {
|
|
62923
|
+
server.close(() => reject(new Error("Failed to determine available port")));
|
|
62924
|
+
return;
|
|
62925
|
+
}
|
|
62926
|
+
server.close((closeErr) => {
|
|
62927
|
+
if (closeErr) {
|
|
62928
|
+
reject(closeErr);
|
|
62929
|
+
return;
|
|
62930
|
+
}
|
|
62931
|
+
resolve3(address.port);
|
|
62932
|
+
});
|
|
62933
|
+
});
|
|
62934
|
+
server.listen(0);
|
|
62935
|
+
});
|
|
62936
|
+
}
|
|
62937
|
+
async function resolveAvailableServePort(port) {
|
|
62938
|
+
if (await isPortAvailable(port)) {
|
|
62939
|
+
return port;
|
|
62940
|
+
}
|
|
62941
|
+
if (!(process.stdin.isTTY && process.stdout.isTTY)) {
|
|
62942
|
+
const autoPort = await findAvailablePort();
|
|
62943
|
+
console.warn(`[WARN] Port ${port} is in use. Falling back to available port ${autoPort}.`);
|
|
62944
|
+
return autoPort;
|
|
62945
|
+
}
|
|
62946
|
+
let candidate = port;
|
|
62947
|
+
while (true) {
|
|
62948
|
+
console.warn(`[WARN] Port ${candidate} is already in use.`);
|
|
62949
|
+
const choice = (await promptText("Choose: [1] Enter another port [2] Find an available port [3] Exit (default: 2): ")).trim().toLowerCase();
|
|
62950
|
+
if (choice === "" || choice === "2") {
|
|
62951
|
+
const autoPort = await findAvailablePort();
|
|
62952
|
+
console.log(`[INFO] Using available port ${autoPort}`);
|
|
62953
|
+
return autoPort;
|
|
62954
|
+
}
|
|
62955
|
+
if (choice === "1") {
|
|
62956
|
+
const rawPort = (await promptText("Enter port (1-65535): ")).trim();
|
|
62957
|
+
if (!rawPort) {
|
|
62958
|
+
continue;
|
|
62959
|
+
}
|
|
62960
|
+
const parsed = Number(rawPort);
|
|
62961
|
+
if (!Number.isInteger(parsed) || parsed < 1 || parsed > 65535) {
|
|
62962
|
+
console.error(`[ERR] Invalid port: ${rawPort}. Expected 1-65535.`);
|
|
62963
|
+
continue;
|
|
62964
|
+
}
|
|
62965
|
+
candidate = parsed;
|
|
62966
|
+
if (await isPortAvailable(candidate)) {
|
|
62967
|
+
return candidate;
|
|
62968
|
+
}
|
|
62969
|
+
continue;
|
|
62970
|
+
}
|
|
62971
|
+
if (choice === "3") {
|
|
62972
|
+
console.error("[ERR] Server startup cancelled.");
|
|
62973
|
+
process.exit(1);
|
|
62974
|
+
}
|
|
62975
|
+
console.error("[ERR] Invalid selection. Enter 1, 2, or 3.");
|
|
62976
|
+
}
|
|
62875
62977
|
}
|
|
62876
62978
|
async function ensureServerBinary(forceUpdate) {
|
|
62877
62979
|
const binDir = join4(homedir2(), ".isol8", "bin");
|
|
@@ -63240,4 +63342,4 @@ if (!process.argv.slice(2).length) {
|
|
|
63240
63342
|
}
|
|
63241
63343
|
program2.parse();
|
|
63242
63344
|
|
|
63243
|
-
//# debugId=
|
|
63345
|
+
//# debugId=33A00A6A263B687D64756E2164756E21
|
package/dist/index.js
CHANGED
|
@@ -2349,7 +2349,7 @@ init_logger();
|
|
|
2349
2349
|
// package.json
|
|
2350
2350
|
var package_default = {
|
|
2351
2351
|
name: "isol8",
|
|
2352
|
-
version: "0.11.
|
|
2352
|
+
version: "0.11.1",
|
|
2353
2353
|
description: "Secure code execution engine for AI agents",
|
|
2354
2354
|
author: "Illusion47586",
|
|
2355
2355
|
license: "MIT",
|
|
@@ -2717,4 +2717,4 @@ export {
|
|
|
2717
2717
|
BunAdapter
|
|
2718
2718
|
};
|
|
2719
2719
|
|
|
2720
|
-
//# debugId=
|
|
2720
|
+
//# debugId=E6910E46B07952A064756E2164756E21
|