@ricsam/isolate-daemon 0.1.1 → 0.1.4

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
@@ -2,19 +2,23 @@
2
2
 
3
3
  Node.js daemon server that manages isolated-vm runtimes via Unix socket or TCP. Allows non-Node.js runtimes (Bun, Deno, etc.) to use isolated-vm through IPC.
4
4
 
5
+ ## Installation
6
+
5
7
  ```bash
6
8
  npm add @ricsam/isolate-daemon
7
9
  ```
8
10
 
9
- **Features:**
11
+ ## Features
12
+
10
13
  - Unix domain socket and TCP transport
11
14
  - Multiple concurrent connections
12
15
  - Runtime lifecycle management (create, dispose)
13
16
  - Bidirectional callback bridging (console, fetch, fs)
14
- - Test environment and Playwright integration
17
+ - Test environment support (enabled via `testEnvironment: true`)
18
+ - Playwright integration (client owns the browser, daemon invokes callbacks)
15
19
  - Connection-scoped resource cleanup
16
20
 
17
- **Starting the Daemon:**
21
+ ## Starting the Daemon
18
22
 
19
23
  ```typescript
20
24
  import { startDaemon } from "@ricsam/isolate-daemon";
@@ -23,10 +27,10 @@ const daemon = await startDaemon({
23
27
  socketPath: "/tmp/isolate-daemon.sock", // Unix socket
24
28
  // Or TCP: host: "127.0.0.1", port: 47891
25
29
  maxIsolates: 100,
26
- defaultMemoryLimit: 128,
30
+ defaultMemoryLimitMB: 128,
27
31
  });
28
32
 
29
- console.log(`Daemon listening on ${daemon.socketPath}`);
33
+ console.log(`Daemon listening on ${daemon.address}`);
30
34
 
31
35
  // Get stats
32
36
  const stats = daemon.getStats();
@@ -36,7 +40,7 @@ console.log(`Active isolates: ${stats.activeIsolates}`);
36
40
  await daemon.close();
37
41
  ```
38
42
 
39
- **CLI Usage:**
43
+ ## CLI Usage
40
44
 
41
45
  ```bash
42
46
  # Start daemon on default socket
@@ -47,4 +51,31 @@ npx isolate-daemon --socket /var/run/isolate.sock
47
51
 
48
52
  # TCP mode
49
53
  npx isolate-daemon --host 127.0.0.1 --port 47891
50
- ```
54
+ ```
55
+
56
+ ## Options
57
+
58
+ ```typescript
59
+ interface DaemonOptions {
60
+ socketPath?: string; // Unix socket path
61
+ host?: string; // TCP host
62
+ port?: number; // TCP port
63
+ maxIsolates?: number; // Maximum concurrent isolates
64
+ defaultMemoryLimitMB?: number; // Default memory limit in megabytes
65
+ }
66
+ ```
67
+
68
+ ## Statistics
69
+
70
+ ```typescript
71
+ interface DaemonStats {
72
+ activeIsolates: number;
73
+ activeConnections: number;
74
+ totalIsolatesCreated: number;
75
+ totalRequestsProcessed: number;
76
+ }
77
+ ```
78
+
79
+ ## License
80
+
81
+ MIT
package/bin/daemon.js CHANGED
@@ -38,7 +38,7 @@ function parseArgs(args) {
38
38
  options.maxIsolates = parseInt(args[++i], 10);
39
39
  break;
40
40
  case "--memory-limit":
41
- options.defaultMemoryLimit = parseInt(args[++i], 10);
41
+ options.defaultMemoryLimitMB = parseInt(args[++i], 10);
42
42
  break;
43
43
  case "--help":
44
44
  case "-h":