isol8 0.1.0-alpha.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/LICENSE +21 -0
- package/README.md +379 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +61288 -0
- package/dist/cli.js.map +304 -0
- package/dist/client/remote.d.ts +64 -0
- package/dist/client/remote.d.ts.map +1 -0
- package/dist/config.d.ts +36 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/cpufeatures-8g73ch7n.node +0 -0
- package/dist/docker/Dockerfile +39 -0
- package/dist/docker/proxy.mjs +127 -0
- package/dist/engine/concurrency.d.ts +46 -0
- package/dist/engine/concurrency.d.ts.map +1 -0
- package/dist/engine/docker.d.ts +103 -0
- package/dist/engine/docker.d.ts.map +1 -0
- package/dist/engine/image-builder.d.ts +46 -0
- package/dist/engine/image-builder.d.ts.map +1 -0
- package/dist/engine/pool.d.ts +57 -0
- package/dist/engine/pool.d.ts.map +1 -0
- package/dist/engine/utils.d.ts +62 -0
- package/dist/engine/utils.d.ts.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1357 -0
- package/dist/index.js.map +24 -0
- package/dist/runtime/adapter.d.ts +60 -0
- package/dist/runtime/adapter.d.ts.map +1 -0
- package/dist/runtime/adapters/bash.d.ts +3 -0
- package/dist/runtime/adapters/bash.d.ts.map +1 -0
- package/dist/runtime/adapters/bun.d.ts +4 -0
- package/dist/runtime/adapters/bun.d.ts.map +1 -0
- package/dist/runtime/adapters/deno.d.ts +10 -0
- package/dist/runtime/adapters/deno.d.ts.map +1 -0
- package/dist/runtime/adapters/node.d.ts +4 -0
- package/dist/runtime/adapters/node.d.ts.map +1 -0
- package/dist/runtime/adapters/python.d.ts +4 -0
- package/dist/runtime/adapters/python.d.ts.map +1 -0
- package/dist/runtime/index.d.ts +15 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/server/auth.d.ts +20 -0
- package/dist/server/auth.d.ts.map +1 -0
- package/dist/server/index.d.ts +34 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/sshcrypto-f6atjna1.node +0 -0
- package/dist/types.d.ts +274 -0
- package/dist/types.d.ts.map +1 -0
- package/docker/Dockerfile +39 -0
- package/docker/proxy.mjs +127 -0
- package/package.json +96 -0
- package/schema/isol8.config.schema.json +138 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module client/remote
|
|
3
|
+
*
|
|
4
|
+
* HTTP client for communicating with a remote isol8 server. Implements the
|
|
5
|
+
* {@link Isol8Engine} interface, so it can be used interchangeably with
|
|
6
|
+
* {@link DockerIsol8} for local-vs-remote execution.
|
|
7
|
+
*/
|
|
8
|
+
import type { ExecutionRequest, ExecutionResult, Isol8Engine, Isol8Options, StreamEvent } from "../types";
|
|
9
|
+
/** Connection options for the remote isol8 client. */
|
|
10
|
+
export interface RemoteIsol8Options {
|
|
11
|
+
/** Base URL of the isol8 server (e.g. `"http://localhost:3000"`). */
|
|
12
|
+
host: string;
|
|
13
|
+
/** API key for Bearer token authentication. */
|
|
14
|
+
apiKey: string;
|
|
15
|
+
/** Optional session ID for persistent mode. If set, the server maintains container state across calls. */
|
|
16
|
+
sessionId?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Remote isol8 client that communicates with an isol8 server over HTTP.
|
|
20
|
+
* Implements the {@link Isol8Engine} interface for seamless local/remote switching.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const isol8 = new RemoteIsol8(
|
|
25
|
+
* { host: "http://localhost:3000", apiKey: "secret" },
|
|
26
|
+
* { network: "none" }
|
|
27
|
+
* );
|
|
28
|
+
* await isol8.start();
|
|
29
|
+
* const result = await isol8.execute({ code: "print(1)", runtime: "python" });
|
|
30
|
+
* await isol8.stop();
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare class RemoteIsol8 implements Isol8Engine {
|
|
34
|
+
private readonly host;
|
|
35
|
+
private readonly apiKey;
|
|
36
|
+
private readonly sessionId?;
|
|
37
|
+
private readonly isol8Options?;
|
|
38
|
+
/**
|
|
39
|
+
* @param options - Connection options (host, API key, session ID).
|
|
40
|
+
* @param isol8Options - Isol8 configuration to send to the server.
|
|
41
|
+
*/
|
|
42
|
+
constructor(options: RemoteIsol8Options, isol8Options?: Isol8Options);
|
|
43
|
+
/** Verify the remote server is reachable by hitting the `/health` endpoint. */
|
|
44
|
+
start(): Promise<void>;
|
|
45
|
+
/** Destroy the remote session (if persistent). No-op for ephemeral mode. */
|
|
46
|
+
stop(): Promise<void>;
|
|
47
|
+
/** Execute code on the remote server and return the result. */
|
|
48
|
+
execute(req: ExecutionRequest): Promise<ExecutionResult>;
|
|
49
|
+
/**
|
|
50
|
+
* Execute code on the remote server and stream output chunks via SSE.
|
|
51
|
+
* Yields {@link StreamEvent} objects as they arrive from the server.
|
|
52
|
+
*/
|
|
53
|
+
executeStream(req: ExecutionRequest): AsyncIterable<StreamEvent>;
|
|
54
|
+
/**
|
|
55
|
+
* Upload a file to the remote container (persistent mode only).
|
|
56
|
+
* Content is Base64-encoded for transport.
|
|
57
|
+
*/
|
|
58
|
+
putFile(path: string, content: Buffer | string): Promise<void>;
|
|
59
|
+
/** Download a file from the remote container (persistent mode only). */
|
|
60
|
+
getFile(path: string): Promise<Buffer>;
|
|
61
|
+
/** Internal fetch wrapper that attaches auth and content-type headers. */
|
|
62
|
+
private fetch;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=remote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../src/client/remote.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,YAAY,EACZ,WAAW,EACZ,MAAM,UAAU,CAAC;AAElB,sDAAsD;AACtD,MAAM,WAAW,kBAAkB;IACjC,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,0GAA0G;IAC1G,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,WAAY,YAAW,WAAW;IAC7C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAe;IAE7C;;;OAGG;gBACS,OAAO,EAAE,kBAAkB,EAAE,YAAY,CAAC,EAAE,YAAY;IAOpE,+EAA+E;IACzE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ5B,4EAA4E;IACtE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B,+DAA+D;IACzD,OAAO,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;IAkB9D;;;OAGG;IACI,aAAa,CAAC,GAAG,EAAE,gBAAgB,GAAG,aAAa,CAAC,WAAW,CAAC;IA0DvE;;;OAGG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBpE,wEAAwE;IAClE,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAgB5C,0EAA0E;YAC5D,KAAK;CAUpB"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module config
|
|
3
|
+
*
|
|
4
|
+
* Configuration discovery and loading for isol8. Searches for `isol8.config.json`
|
|
5
|
+
* in the working directory and then in `~/.isol8/config.json`, merging any found
|
|
6
|
+
* config with built-in defaults.
|
|
7
|
+
*/
|
|
8
|
+
import type { Isol8Config } from "./types";
|
|
9
|
+
/**
|
|
10
|
+
* Built-in default configuration. Used as the base for all config merges.
|
|
11
|
+
* All values here are the "safe defaults" — network disabled, conservative limits.
|
|
12
|
+
*/
|
|
13
|
+
declare const DEFAULT_CONFIG: Isol8Config;
|
|
14
|
+
/**
|
|
15
|
+
* Discovers and loads the isol8 configuration file.
|
|
16
|
+
*
|
|
17
|
+
* Search order (first match wins):
|
|
18
|
+
* 1. `isol8.config.json` in CWD (or the provided `cwd` argument)
|
|
19
|
+
* 2. `~/.isol8/config.json`
|
|
20
|
+
*
|
|
21
|
+
* If no config file is found, returns a copy of {@link DEFAULT_CONFIG}.
|
|
22
|
+
* Partial configs are deep-merged with defaults — you only need to specify
|
|
23
|
+
* the fields you want to override.
|
|
24
|
+
*
|
|
25
|
+
* @param cwd - Optional working directory to search from (defaults to `process.cwd()`).
|
|
26
|
+
* @returns The resolved configuration.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* const config = loadConfig();
|
|
31
|
+
* console.log(config.defaults.timeoutMs); // 30000
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function loadConfig(cwd?: string): Isol8Config;
|
|
35
|
+
export { DEFAULT_CONFIG };
|
|
36
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;GAGG;AACH,QAAA,MAAM,cAAc,EAAE,WAmBrB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,WAAW,CAepD;AA6BD,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
Binary file
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# ── Base ──────────────────────────────────────────────────────────────
|
|
2
|
+
FROM alpine:3.21 AS base
|
|
3
|
+
RUN apk add --no-cache tini curl ca-certificates
|
|
4
|
+
COPY proxy.mjs /usr/local/bin/proxy.mjs
|
|
5
|
+
RUN chmod +x /usr/local/bin/proxy.mjs
|
|
6
|
+
WORKDIR /sandbox
|
|
7
|
+
ENTRYPOINT ["/sbin/tini", "--"]
|
|
8
|
+
|
|
9
|
+
# ── Python ────────────────────────────────────────────────────────────
|
|
10
|
+
FROM base AS python
|
|
11
|
+
RUN apk add --no-cache python3 py3-pip
|
|
12
|
+
CMD ["python3"]
|
|
13
|
+
|
|
14
|
+
# ── Node ──────────────────────────────────────────────────────────────
|
|
15
|
+
FROM base AS node
|
|
16
|
+
RUN apk add --no-cache nodejs npm
|
|
17
|
+
CMD ["node"]
|
|
18
|
+
|
|
19
|
+
# ── Bun ───────────────────────────────────────────────────────────────
|
|
20
|
+
FROM base AS bun
|
|
21
|
+
RUN apk add --no-cache bash unzip libstdc++ libgcc \
|
|
22
|
+
&& curl -fsSL https://bun.sh/install | bash \
|
|
23
|
+
&& mv /root/.bun/bin/bun /usr/local/bin/bun \
|
|
24
|
+
&& ln -s /usr/local/bin/bun /usr/local/bin/bunx
|
|
25
|
+
CMD ["bun"]
|
|
26
|
+
|
|
27
|
+
# ── Deno ──────────────────────────────────────────────────────────────
|
|
28
|
+
FROM denoland/deno:alpine AS deno
|
|
29
|
+
RUN apk add --no-cache tini curl ca-certificates
|
|
30
|
+
COPY proxy.mjs /usr/local/bin/proxy.mjs
|
|
31
|
+
RUN chmod +x /usr/local/bin/proxy.mjs
|
|
32
|
+
WORKDIR /sandbox
|
|
33
|
+
ENTRYPOINT ["/sbin/tini", "--"]
|
|
34
|
+
CMD ["deno"]
|
|
35
|
+
|
|
36
|
+
# ── Bash ──────────────────────────────────────────────────────────────
|
|
37
|
+
FROM base AS bash
|
|
38
|
+
RUN apk add --no-cache bash
|
|
39
|
+
CMD ["bash"]
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* isol8 network proxy — lightweight HTTP/HTTPS filtering proxy.
|
|
5
|
+
*
|
|
6
|
+
* Reads whitelist/blacklist regex patterns from env vars and blocks
|
|
7
|
+
* non-matching outbound requests with 403.
|
|
8
|
+
*
|
|
9
|
+
* Env vars:
|
|
10
|
+
* ISOL8_WHITELIST - JSON array of regex strings (allow these)
|
|
11
|
+
* ISOL8_BLACKLIST - JSON array of regex strings (block these)
|
|
12
|
+
* ISOL8_PROXY_PORT - Port to listen on (default: 8118)
|
|
13
|
+
*
|
|
14
|
+
* Logic:
|
|
15
|
+
* 1. If blacklist matches → BLOCK
|
|
16
|
+
* 2. If whitelist is non-empty and hostname doesn't match → BLOCK
|
|
17
|
+
* 3. Otherwise → ALLOW
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import http from "node:http";
|
|
21
|
+
import net from "node:net";
|
|
22
|
+
|
|
23
|
+
const port = Number.parseInt(process.env.ISOL8_PROXY_PORT || "8118", 10);
|
|
24
|
+
|
|
25
|
+
const whitelist = parsePatterns(process.env.ISOL8_WHITELIST);
|
|
26
|
+
const blacklist = parsePatterns(process.env.ISOL8_BLACKLIST);
|
|
27
|
+
|
|
28
|
+
function parsePatterns(envVar) {
|
|
29
|
+
if (!envVar) {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const arr = JSON.parse(envVar);
|
|
34
|
+
return arr.map((p) => new RegExp(p));
|
|
35
|
+
} catch {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function isAllowed(hostname) {
|
|
41
|
+
// Check blacklist first
|
|
42
|
+
for (const re of blacklist) {
|
|
43
|
+
if (re.test(hostname)) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// If whitelist is empty, allow all (only blacklist applies)
|
|
49
|
+
if (whitelist.length === 0) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Otherwise, must match at least one whitelist pattern
|
|
54
|
+
for (const re of whitelist) {
|
|
55
|
+
if (re.test(hostname)) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const server = http.createServer((req, res) => {
|
|
64
|
+
const url = new URL(req.url, `http://${req.headers.host}`);
|
|
65
|
+
const hostname = url.hostname;
|
|
66
|
+
|
|
67
|
+
if (!isAllowed(hostname)) {
|
|
68
|
+
res.writeHead(403, { "Content-Type": "text/plain" });
|
|
69
|
+
res.end(`isol8: request to ${hostname} blocked by network filter`);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Forward HTTP request
|
|
74
|
+
const proxyReq = http.request(
|
|
75
|
+
{
|
|
76
|
+
hostname: url.hostname,
|
|
77
|
+
port: url.port || 80,
|
|
78
|
+
path: url.pathname + url.search,
|
|
79
|
+
method: req.method,
|
|
80
|
+
headers: req.headers,
|
|
81
|
+
},
|
|
82
|
+
(proxyRes) => {
|
|
83
|
+
res.writeHead(proxyRes.statusCode, proxyRes.headers);
|
|
84
|
+
proxyRes.pipe(res);
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
proxyReq.on("error", (err) => {
|
|
89
|
+
res.writeHead(502, { "Content-Type": "text/plain" });
|
|
90
|
+
res.end(`isol8: proxy error: ${err.message}`);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
req.pipe(proxyReq);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// Handle HTTPS CONNECT tunneling
|
|
97
|
+
server.on("connect", (req, clientSocket, head) => {
|
|
98
|
+
const [hostname, port] = req.url.split(":");
|
|
99
|
+
|
|
100
|
+
if (!isAllowed(hostname)) {
|
|
101
|
+
clientSocket.write(
|
|
102
|
+
"HTTP/1.1 403 Forbidden\r\nContent-Type: text/plain\r\n\r\n" +
|
|
103
|
+
`isol8: CONNECT to ${hostname} blocked by network filter`
|
|
104
|
+
);
|
|
105
|
+
clientSocket.end();
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const serverSocket = net.connect(Number.parseInt(port || "443", 10), hostname, () => {
|
|
110
|
+
clientSocket.write("HTTP/1.1 200 Connection Established\r\n\r\n");
|
|
111
|
+
serverSocket.write(head);
|
|
112
|
+
serverSocket.pipe(clientSocket);
|
|
113
|
+
clientSocket.pipe(serverSocket);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
serverSocket.on("error", (err) => {
|
|
117
|
+
clientSocket.write(
|
|
118
|
+
"HTTP/1.1 502 Bad Gateway\r\nContent-Type: text/plain\r\n\r\n" +
|
|
119
|
+
`isol8: tunnel error: ${err.message}`
|
|
120
|
+
);
|
|
121
|
+
clientSocket.end();
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
server.listen(port, "127.0.0.1", () => {
|
|
126
|
+
console.log(`isol8 proxy listening on 127.0.0.1:${port}`);
|
|
127
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module engine/concurrency
|
|
3
|
+
*
|
|
4
|
+
* Async semaphore for limiting the number of concurrent container executions.
|
|
5
|
+
* Used by {@link DockerIsol8} to prevent resource exhaustion.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* A counting semaphore for limiting concurrent async operations.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const sem = new Semaphore(3); // allow 3 concurrent operations
|
|
13
|
+
*
|
|
14
|
+
* await sem.acquire();
|
|
15
|
+
* try {
|
|
16
|
+
* await doWork();
|
|
17
|
+
* } finally {
|
|
18
|
+
* sem.release();
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare class Semaphore {
|
|
23
|
+
private readonly max;
|
|
24
|
+
private current;
|
|
25
|
+
private readonly queue;
|
|
26
|
+
/**
|
|
27
|
+
* @param max - Maximum number of concurrent acquisitions. Must be ≥ 1.
|
|
28
|
+
* @throws {Error} If `max` is less than 1.
|
|
29
|
+
*/
|
|
30
|
+
constructor(max: number);
|
|
31
|
+
/** The number of permits currently available. */
|
|
32
|
+
get available(): number;
|
|
33
|
+
/** The number of callers waiting to acquire a permit. */
|
|
34
|
+
get pending(): number;
|
|
35
|
+
/**
|
|
36
|
+
* Acquire a permit. Resolves immediately if one is available,
|
|
37
|
+
* otherwise queues the caller until a permit is released.
|
|
38
|
+
*/
|
|
39
|
+
acquire(): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Release a permit. If callers are queued, the next one is resolved.
|
|
42
|
+
* Must be called exactly once for each successful `acquire()`.
|
|
43
|
+
*/
|
|
44
|
+
release(): void;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=concurrency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concurrency.d.ts","sourceRoot":"","sources":["../../src/engine/concurrency.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;;;GAcG;AACH,qBAAa,SAAS;IAQR,OAAO,CAAC,QAAQ,CAAC,GAAG;IAPhC,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsB;IAE5C;;;OAGG;gBAC0B,GAAG,EAAE,MAAM;IAMxC,iDAAiD;IACjD,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,yDAAyD;IACzD,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAW9B;;;OAGG;IACH,OAAO,IAAI,IAAI;CAQhB"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module engine/docker
|
|
3
|
+
*
|
|
4
|
+
* The Docker-backed isol8 engine. Creates and manages Docker containers
|
|
5
|
+
* for executing untrusted code with resource limits, network controls, and
|
|
6
|
+
* output sanitization.
|
|
7
|
+
*/
|
|
8
|
+
import Docker from "dockerode";
|
|
9
|
+
import type { ExecutionRequest, ExecutionResult, Isol8Engine, Isol8Options, StreamEvent } from "../types";
|
|
10
|
+
/** Options for constructing a {@link DockerIsol8} instance. Extends {@link Isol8Options} with Docker-specific settings. */
|
|
11
|
+
export interface DockerIsol8Options extends Isol8Options {
|
|
12
|
+
/** Custom dockerode instance. Defaults to connecting to the local Docker socket. */
|
|
13
|
+
docker?: Docker;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Docker-backed isol8 engine that executes code in isolated containers.
|
|
17
|
+
*
|
|
18
|
+
* Supports two modes:
|
|
19
|
+
* - **Ephemeral** — a new container is created and destroyed per `execute()` call.
|
|
20
|
+
* - **Persistent** — a long-lived container is reused across calls, preserving state.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const isol8 = new DockerIsol8({ network: "none", memoryLimit: "256m" });
|
|
25
|
+
* await isol8.start();
|
|
26
|
+
* const result = await isol8.execute({ code: "print(1+1)", runtime: "python" });
|
|
27
|
+
* await isol8.stop();
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare class DockerIsol8 implements Isol8Engine {
|
|
31
|
+
private readonly docker;
|
|
32
|
+
private readonly mode;
|
|
33
|
+
private readonly network;
|
|
34
|
+
private readonly networkFilter?;
|
|
35
|
+
private readonly cpuLimit;
|
|
36
|
+
private readonly memoryLimit;
|
|
37
|
+
private readonly pidsLimit;
|
|
38
|
+
private readonly readonlyRootFs;
|
|
39
|
+
private readonly maxOutputSize;
|
|
40
|
+
private readonly secrets;
|
|
41
|
+
private readonly defaultTimeoutMs;
|
|
42
|
+
private readonly overrideImage?;
|
|
43
|
+
private readonly semaphore;
|
|
44
|
+
private readonly sandboxSize;
|
|
45
|
+
private readonly tmpSize;
|
|
46
|
+
private container;
|
|
47
|
+
private persistentRuntime;
|
|
48
|
+
private pool;
|
|
49
|
+
/**
|
|
50
|
+
* @param options - Sandbox configuration options.
|
|
51
|
+
* @param maxConcurrent - Maximum number of concurrent executions (controls the internal semaphore).
|
|
52
|
+
*/
|
|
53
|
+
constructor(options?: DockerIsol8Options, maxConcurrent?: number);
|
|
54
|
+
/**
|
|
55
|
+
* Initialize isol8. Currently a no-op — containers are created
|
|
56
|
+
* lazily on first `execute()` call.
|
|
57
|
+
*/
|
|
58
|
+
start(): Promise<void>;
|
|
59
|
+
/** Stop and remove the container (if one exists). Safe to call multiple times. */
|
|
60
|
+
stop(): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Execute code in isol8. Acquires a semaphore permit to enforce
|
|
63
|
+
* the concurrency limit, then delegates to ephemeral or persistent execution.
|
|
64
|
+
*/
|
|
65
|
+
execute(req: ExecutionRequest): Promise<ExecutionResult>;
|
|
66
|
+
/**
|
|
67
|
+
* Upload a file into the running container via a tar archive.
|
|
68
|
+
* Only available in persistent mode after at least one `execute()` call.
|
|
69
|
+
*
|
|
70
|
+
* @param path - Absolute path inside the container.
|
|
71
|
+
* @param content - File contents.
|
|
72
|
+
* @throws {Error} If no container is active.
|
|
73
|
+
*/
|
|
74
|
+
putFile(path: string, content: Buffer | string): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Download a file from the running container.
|
|
77
|
+
*
|
|
78
|
+
* @param path - Absolute path inside the container.
|
|
79
|
+
* @returns File contents as a Buffer.
|
|
80
|
+
* @throws {Error} If no container is active.
|
|
81
|
+
*/
|
|
82
|
+
getFile(path: string): Promise<Buffer>;
|
|
83
|
+
/** The Docker container ID, or `null` if no container is active. Used by the server for session tracking. */
|
|
84
|
+
get containerId(): string | null;
|
|
85
|
+
/**
|
|
86
|
+
* Execute code and stream output chunks as they arrive.
|
|
87
|
+
* Yields {@link StreamEvent} objects for stdout, stderr, exit, and error events.
|
|
88
|
+
*/
|
|
89
|
+
executeStream(req: ExecutionRequest): AsyncIterable<StreamEvent>;
|
|
90
|
+
private resolveImage;
|
|
91
|
+
private executeEphemeral;
|
|
92
|
+
private executePersistent;
|
|
93
|
+
private retrieveFiles;
|
|
94
|
+
private getFileFromContainer;
|
|
95
|
+
private startPersistentContainer;
|
|
96
|
+
private getAdapter;
|
|
97
|
+
private buildHostConfig;
|
|
98
|
+
private buildEnv;
|
|
99
|
+
private streamExecOutput;
|
|
100
|
+
private collectExecOutput;
|
|
101
|
+
private postProcessOutput;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=docker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../../src/engine/docker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,MAAM,MAAM,WAAW,CAAC;AAG/B,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,WAAW,EAEX,YAAY,EAGZ,WAAW,EACZ,MAAM,UAAU,CAAC;AAwNlB,2HAA2H;AAC3H,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,oFAAoF;IACpF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,WAAY,YAAW,WAAW;IAC7C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;IACtC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAsB;IACrD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAU;IACzC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;IACjD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAS;IACxC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IACtC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAEjC,OAAO,CAAC,SAAS,CAAiC;IAClD,OAAO,CAAC,iBAAiB,CAA+B;IACxD,OAAO,CAAC,IAAI,CAA8B;IAE1C;;;OAGG;gBACS,OAAO,GAAE,kBAAuB,EAAE,aAAa,SAAK;IAkBhE;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5B,kFAAkF;IAC5E,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAuB3B;;;OAGG;IACG,OAAO,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;IAW9D;;;;;;;OAOG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYpE;;;;;;OAMG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmB5C,6GAA6G;IAC7G,IAAI,WAAW,IAAI,MAAM,GAAG,IAAI,CAE/B;IAED;;;OAGG;IACI,aAAa,CAAC,GAAG,EAAE,gBAAgB,GAAG,aAAa,CAAC,WAAW,CAAC;YA+EzD,YAAY;YAcZ,gBAAgB;YAmGhB,iBAAiB;YA4FjB,aAAa;YAkBb,oBAAoB;YASpB,wBAAwB;IA2BtC,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,eAAe;IAsBvB,OAAO,CAAC,QAAQ;YA+BD,gBAAgB;YA8EjB,iBAAiB;IA8D/B,OAAO,CAAC,iBAAiB;CAW1B"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module engine/image-builder
|
|
3
|
+
*
|
|
4
|
+
* Builds Docker images for each supported runtime. Base images are built from
|
|
5
|
+
* the multi-stage `docker/Dockerfile`. Custom images layer user-specified
|
|
6
|
+
* packages on top of the base images.
|
|
7
|
+
*/
|
|
8
|
+
import type Docker from "dockerode";
|
|
9
|
+
import type { Isol8Config } from "../types";
|
|
10
|
+
/** Progress update emitted during image builds. */
|
|
11
|
+
interface BuildProgress {
|
|
12
|
+
/** Runtime being built (e.g. `"python"`). */
|
|
13
|
+
runtime: string;
|
|
14
|
+
/** Current build status. */
|
|
15
|
+
status: "building" | "done" | "error";
|
|
16
|
+
/** Optional status message (error text, package list, etc). */
|
|
17
|
+
message?: string;
|
|
18
|
+
}
|
|
19
|
+
type ProgressCallback = (progress: BuildProgress) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Builds the base `isol8:<runtime>` images for all registered runtimes.
|
|
22
|
+
* Each image is built from the multi-stage Dockerfile in `docker/`.
|
|
23
|
+
*
|
|
24
|
+
* @param docker - Dockerode instance.
|
|
25
|
+
* @param onProgress - Optional callback for build progress updates.
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildBaseImages(docker: Docker, onProgress?: ProgressCallback): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Builds custom images with user-specified dependencies layered on top of
|
|
30
|
+
* the base images. Reads package lists from the config's `dependencies` field.
|
|
31
|
+
*
|
|
32
|
+
* @param docker - Dockerode instance.
|
|
33
|
+
* @param config - Resolved isol8 configuration.
|
|
34
|
+
* @param onProgress - Optional callback for build progress updates.
|
|
35
|
+
*/
|
|
36
|
+
export declare function buildCustomImages(docker: Docker, config: Isol8Config, onProgress?: ProgressCallback): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Checks if an image exists locally.
|
|
39
|
+
*/
|
|
40
|
+
export declare function imageExists(docker: Docker, imageName: string): Promise<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* Ensures all base images are built.
|
|
43
|
+
*/
|
|
44
|
+
export declare function ensureImages(docker: Docker, onProgress?: ProgressCallback): Promise<void>;
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=image-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-builder.d.ts","sourceRoot":"","sources":["../../src/engine/image-builder.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AAEpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAI5C,mDAAmD;AACnD,UAAU,aAAa;IACrB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,MAAM,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;IACtC,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,KAAK,gBAAgB,GAAG,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;AAE1D;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,gBAAgB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAmCf;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,WAAW,EACnB,UAAU,CAAC,EAAE,gBAAgB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAkBf;AA4DD;;GAEG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOrF;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAa/F"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module engine/pool
|
|
3
|
+
*
|
|
4
|
+
* Warm container pool for fast ephemeral execution. Pre-creates and
|
|
5
|
+
* starts containers so they're ready for immediate use, eliminating
|
|
6
|
+
* the create+start overhead (~100-200ms per execution).
|
|
7
|
+
*
|
|
8
|
+
* After execution, containers are cleaned (sandbox wiped) and returned
|
|
9
|
+
* to the pool for reuse rather than destroyed.
|
|
10
|
+
*/
|
|
11
|
+
import type Docker from "dockerode";
|
|
12
|
+
/** Configuration for the container pool. */
|
|
13
|
+
export interface PoolOptions {
|
|
14
|
+
/** Docker client instance. */
|
|
15
|
+
docker: Docker;
|
|
16
|
+
/** Max containers to keep warm per image. @default 2 */
|
|
17
|
+
poolSize?: number;
|
|
18
|
+
/** Container creation options (HostConfig, Env, etc). */
|
|
19
|
+
createOptions: Omit<Docker.ContainerCreateOptions, "Image">;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A per-image warm container pool. Maintains pre-started containers
|
|
23
|
+
* ready for immediate exec, recycling them after use.
|
|
24
|
+
*/
|
|
25
|
+
export declare class ContainerPool {
|
|
26
|
+
private readonly docker;
|
|
27
|
+
private readonly poolSize;
|
|
28
|
+
private readonly createOptions;
|
|
29
|
+
private readonly pools;
|
|
30
|
+
private readonly replenishing;
|
|
31
|
+
constructor(options: PoolOptions);
|
|
32
|
+
/**
|
|
33
|
+
* Acquire a started container for the given image.
|
|
34
|
+
* Returns a warm container from the pool if available,
|
|
35
|
+
* otherwise creates and starts a new one.
|
|
36
|
+
*/
|
|
37
|
+
acquire(image: string): Promise<Docker.Container>;
|
|
38
|
+
/**
|
|
39
|
+
* Return a container to the pool after use. The container's /sandbox
|
|
40
|
+
* tmpfs is wiped clean so it's ready for the next execution.
|
|
41
|
+
* If the pool is full, the container is destroyed instead.
|
|
42
|
+
*/
|
|
43
|
+
release(container: Docker.Container, image: string): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Pre-warm the pool for a specific image.
|
|
46
|
+
* Creates containers up to poolSize.
|
|
47
|
+
*/
|
|
48
|
+
warm(image: string): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Destroy all pooled containers and clear the pool.
|
|
51
|
+
*/
|
|
52
|
+
drain(): Promise<void>;
|
|
53
|
+
private createContainer;
|
|
54
|
+
/** Replenish the pool in the background (non-blocking). */
|
|
55
|
+
private replenish;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=pool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../src/engine/pool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AAEpC,4CAA4C;AAC5C,MAAM,WAAW,WAAW;IAC1B,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC;CAC7D;AAOD;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA+C;IAC7E,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkC;IACxD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAqB;gBAEtC,OAAO,EAAE,WAAW;IAMhC;;;;OAIG;IACG,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC;IAcvD;;;;OAIG;IACG,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA+BxE;;;OAGG;IACG,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBxC;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAad,eAAe;IAW7B,2DAA2D;IAC3D,OAAO,CAAC,SAAS;CAoClB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module engine/utils
|
|
3
|
+
*
|
|
4
|
+
* Low-level utility functions used by the Docker engine: memory parsing,
|
|
5
|
+
* output truncation, secret masking, and POSIX tar archive creation/extraction.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Parses a human-readable memory limit string into bytes.
|
|
9
|
+
*
|
|
10
|
+
* @param limit - Memory string (e.g. `"512m"`, `"1g"`, `"256k"`, `"1024"`).
|
|
11
|
+
* @returns The limit in bytes.
|
|
12
|
+
* @throws {Error} If the format is invalid.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* parseMemoryLimit("512m"); // 536870912
|
|
17
|
+
* parseMemoryLimit("1g"); // 1073741824
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseMemoryLimit(limit: string): number;
|
|
21
|
+
/**
|
|
22
|
+
* Truncates output to a maximum byte length. If truncated, appends a
|
|
23
|
+
* summary line indicating the original and limit sizes.
|
|
24
|
+
*
|
|
25
|
+
* @param output - The full output string.
|
|
26
|
+
* @param maxBytes - Maximum allowed byte length.
|
|
27
|
+
* @returns Object with the (possibly truncated) text and a truncation flag.
|
|
28
|
+
*/
|
|
29
|
+
export declare function truncateOutput(output: string, maxBytes: number): {
|
|
30
|
+
text: string;
|
|
31
|
+
truncated: boolean;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Replaces all occurrences of secret values in a string with `***`.
|
|
35
|
+
* Empty secret values are skipped.
|
|
36
|
+
*
|
|
37
|
+
* @param text - The text to sanitize.
|
|
38
|
+
* @param secrets - Map of secret names to values.
|
|
39
|
+
* @returns The sanitized text.
|
|
40
|
+
*/
|
|
41
|
+
export declare function maskSecrets(text: string, secrets: Record<string, string>): string;
|
|
42
|
+
/**
|
|
43
|
+
* Creates a POSIX tar archive buffer containing a single file.
|
|
44
|
+
*
|
|
45
|
+
* Uses a minimal tar header (512-byte blocks) followed by data blocks
|
|
46
|
+
* and a 1024-byte end-of-archive marker.
|
|
47
|
+
*
|
|
48
|
+
* @param filePath - Path for the file inside the archive (leading `/` is stripped).
|
|
49
|
+
* @param content - File contents as a string or Buffer.
|
|
50
|
+
* @returns A Buffer containing the complete tar archive.
|
|
51
|
+
*/
|
|
52
|
+
export declare function createTarBuffer(filePath: string, content: Buffer | string): Buffer;
|
|
53
|
+
/**
|
|
54
|
+
* Extracts a single file from a tar archive buffer.
|
|
55
|
+
*
|
|
56
|
+
* @param tarBuffer - The tar archive buffer.
|
|
57
|
+
* @param targetPath - Path of the file to extract (leading `/` is stripped for matching).
|
|
58
|
+
* @returns The extracted file contents as a Buffer.
|
|
59
|
+
* @throws {Error} If the file is not found in the archive.
|
|
60
|
+
*/
|
|
61
|
+
export declare function extractFromTar(tarBuffer: Buffer, targetPath: string): Buffer;
|
|
62
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/engine/utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAiBtD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAetC;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAQjF;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CA8ClF;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAoC5E"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module isol8
|
|
3
|
+
*
|
|
4
|
+
* Public API for the isol8 secure code execution engine.
|
|
5
|
+
* Import from `"isol8"` to access the engine, client, config, runtime registry, and server.
|
|
6
|
+
*/
|
|
7
|
+
export type { RemoteIsol8Options } from "./client/remote";
|
|
8
|
+
export { RemoteIsol8 } from "./client/remote";
|
|
9
|
+
export { loadConfig } from "./config";
|
|
10
|
+
export type { DockerIsol8Options } from "./engine/docker";
|
|
11
|
+
export { DockerIsol8 } from "./engine/docker";
|
|
12
|
+
export { BunAdapter, bashAdapter, DenoAdapter, NodeAdapter, PythonAdapter, RuntimeRegistry, } from "./runtime";
|
|
13
|
+
export type { RuntimeAdapter } from "./runtime/adapter";
|
|
14
|
+
export { createServer } from "./server/index";
|
|
15
|
+
export type { ExecutionRequest, ExecutionResult, Isol8Config, Isol8Engine, Isol8Mode, Isol8Options, NetworkFilterConfig, NetworkMode, Runtime, StreamEvent, } from "./types";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EACL,UAAU,EACV,WAAW,EACX,WAAW,EACX,WAAW,EACX,aAAa,EACb,eAAe,GAChB,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,WAAW,EACX,SAAS,EACT,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,OAAO,EACP,WAAW,GACZ,MAAM,SAAS,CAAC"}
|