@warlock.js/process 0.0.0-stage → 5.33.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/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +59 -2
- package/cjs/index.cjs +1020 -0
- package/cjs/index.cjs.map +1 -0
- package/esm/guardian.mjs +131 -0
- package/esm/guardian.mjs.map +1 -0
- package/esm/identity.d.mts +7 -0
- package/esm/identity.d.mts.map +1 -0
- package/esm/identity.mjs +86 -0
- package/esm/identity.mjs.map +1 -0
- package/esm/index.d.mts +5 -0
- package/esm/index.mjs +5 -0
- package/esm/platform.d.mts +7 -0
- package/esm/platform.d.mts.map +1 -0
- package/esm/platform.mjs +156 -0
- package/esm/platform.mjs.map +1 -0
- package/esm/registry.mjs +118 -0
- package/esm/registry.mjs.map +1 -0
- package/esm/resources.mjs +85 -0
- package/esm/resources.mjs.map +1 -0
- package/esm/supervisor.d.mts +5 -0
- package/esm/supervisor.d.mts.map +1 -0
- package/esm/supervisor.mjs +443 -0
- package/esm/supervisor.mjs.map +1 -0
- package/esm/types.d.mts +84 -0
- package/esm/types.d.mts.map +1 -0
- package/llms-full.txt +135 -0
- package/llms.txt +9 -0
- package/package.json +49 -4
- package/skills/supervise-processes/SKILL.md +125 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog — @warlock.js/process
|
|
2
|
+
|
|
3
|
+
## 5.33.0 - 2026-10-19
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Add application-owned process supervision with random environment tokens, PID/start-time registry identity, safe group stops, label filtering, boot recovery and shutdown cleanup.
|
|
8
|
+
- Expose streamed worker handles, exit reasons and peak memory; lazily load optional `node-pty` for terminals.
|
|
9
|
+
- Support macOS without custom native code: parse `ps` start time under `LC_ALL=C TZ=UTC` and verify the inherited random environment token through a live Node launch guardian.
|
|
10
|
+
- Support Windows with PowerShell/CIM creation identity, the guardian's inherited token, PID-only `taskkill /T /F` tree stops, tree working-set polling, timeouts, recovery and optional node-pty/ConPTY terminals. Job Objects remain a future improvement.
|
|
11
|
+
- Make platform command construction, parsing and launch plans pure and observation injectable for Linux-hosted macOS/Windows specs; reject truly unsupported operating systems with `UnsupportedProcessPlatformError`.
|
|
12
|
+
- Attempt Linux cgroup v2 before user code executes, with inherited rlimit/RSS fallback; document softer macOS rlimit/tree RSS and Windows tree RSS enforcement, guardian memory overhead and POSIX-only CPU limits.
|
|
13
|
+
- Integrate `warlock add process` and a read-only devtools process panel.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Hassan Zohdy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,60 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @warlock.js/process
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
App-owned child process supervision for Linux, macOS and Windows. Ownership uses a random
|
|
4
|
+
environment token, PID, OS start time and a private registry. Stops target verified POSIX process groups or a Windows PID tree; commands are
|
|
5
|
+
never used for identity matching.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npx warlock add process
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { supervisor } from "@warlock.js/process";
|
|
13
|
+
|
|
14
|
+
const processes = supervisor({
|
|
15
|
+
owner: "example-app",
|
|
16
|
+
registry: "storage/processes/registry.json",
|
|
17
|
+
defaults: { timeoutMs: 30_000, memoryBytes: 512 * 1024 * 1024 },
|
|
18
|
+
});
|
|
19
|
+
await processes.recover();
|
|
20
|
+
const worker = await processes.spawn({
|
|
21
|
+
kind: "worker",
|
|
22
|
+
command: process.execPath,
|
|
23
|
+
args: ["-e", 'console.log("ready")'],
|
|
24
|
+
labels: { room: "demo" },
|
|
25
|
+
});
|
|
26
|
+
worker.stdout.pipe(process.stdout);
|
|
27
|
+
worker.stderr.pipe(process.stderr);
|
|
28
|
+
console.log(await worker.exited);
|
|
29
|
+
await processes.stopAll();
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Public methods: `spawn`, `spawnPty`, `list`, `stop`, `stopPid`, `recover`,
|
|
33
|
+
`stopAll`. Handles provide streams, `exited` (reason, exit code, signal, peak
|
|
34
|
+
memory) and idempotent `stop`. Unowned PIDs throw `ProcessNotOwnedError`.
|
|
35
|
+
|
|
36
|
+
| Platform | Identity and enforcement |
|
|
37
|
+
| -------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
38
|
+
| Linux | `/proc` start ticks + boot ID + environment token; cgroup v2 → inherited rlimit/RSS fallback. |
|
|
39
|
+
| macOS | `ps` start time (`LC_ALL=C TZ=UTC`) + environment token; inherited CPU/data rlimits and tree RSS polling. |
|
|
40
|
+
| Windows | PowerShell/CIM creation time + environment token; `taskkill /PID <pid> /T /F` and tree working-set polling (`rss-polling`). |
|
|
41
|
+
|
|
42
|
+
macOS and Windows memory caps are softer than Linux cgroups: polling can miss
|
|
43
|
+
peaks and overshoot. No custom native code or identity-helper setup is required.
|
|
44
|
+
On these platforms the handle PID belongs to a small Node guardian that launches
|
|
45
|
+
the workload after registry persistence. It proves its inherited environment
|
|
46
|
+
token through a live local socket/named pipe; polling includes guardian overhead
|
|
47
|
+
and descendants. Recovery uses the same PID/start-time/token verification.
|
|
48
|
+
Windows needs Windows PowerShell with CIM available. `cpuSeconds` is POSIX-only;
|
|
49
|
+
`virtualMemoryBytes` is Linux-only. Timeouts work on all three platforms.
|
|
50
|
+
Windows stops force the entire PID tree immediately; Job Objects are a future
|
|
51
|
+
improvement for hard containment and memory caps.
|
|
52
|
+
`spawnPty` lazily imports optional peer `node-pty`, including Windows/ConPTY.
|
|
53
|
+
|
|
54
|
+
Use a separate registry per app instance and consume output streams. Recovery
|
|
55
|
+
adopts only identities selected by `keep`; by default it stops verified orphans.
|
|
56
|
+
`stopAll` permanently closes the supervisor. The installer wires recovery on
|
|
57
|
+
startup, shutdown cleanup and a read-only devtools Processes panel.
|
|
58
|
+
|
|
59
|
+
See [the complete documentation](https://warlock.js.org/v/latest/process/) for
|
|
60
|
+
platform limits, delegation, PID reuse limitations, recovery and terminal APIs.
|