@3leaps/sysprims 0.1.7

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 ADDED
@@ -0,0 +1,6 @@
1
+ MIT OR Apache-2.0
2
+
3
+ This package is part of the sysprims repository.
4
+ See the repository root for full license texts:
5
+ - LICENSE-MIT
6
+ - LICENSE-APACHE
package/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # sysprims (TypeScript bindings)
2
+
3
+ TypeScript/Node.js bindings for sysprims using a Node-API (N-API) native addon (napi-rs).
4
+
5
+ ## Platform support
6
+
7
+ Supported:
8
+ - macOS: arm64
9
+ - Linux: glibc and musl (Alpine)
10
+ - Windows: x64, arm64 (msvc)
11
+
12
+ ## Local development
13
+
14
+ The native addon is built from Rust:
15
+
16
+ ```bash
17
+ npm install
18
+ npm run build
19
+ npm run build:native
20
+ npm run test:ci
21
+ ```
22
+
23
+ ## API (minimal)
24
+
25
+ - `procGet(pid)` → returns parsed JSON from `sysprims_proc_get`
26
+ - `selfPGID()` → calls `sysprims_self_getpgid`
27
+ - `selfSID()` → calls `sysprims_self_getsid`
28
+
29
+ ## Safety
30
+
31
+ These bindings call into a process-control library. Do not use dangerous PIDs.
@@ -0,0 +1,19 @@
1
+ export declare const SysprimsErrorCode: {
2
+ readonly Ok: 0;
3
+ readonly InvalidArgument: 1;
4
+ readonly SpawnFailed: 2;
5
+ readonly Timeout: 3;
6
+ readonly PermissionDenied: 4;
7
+ readonly NotFound: 5;
8
+ readonly NotSupported: 6;
9
+ readonly GroupCreationFailed: 7;
10
+ readonly System: 8;
11
+ readonly Internal: 99;
12
+ };
13
+ export type SysprimsErrorCode = (typeof SysprimsErrorCode)[keyof typeof SysprimsErrorCode];
14
+ export declare class SysprimsError extends Error {
15
+ readonly code: SysprimsErrorCode;
16
+ readonly codeName: string;
17
+ constructor(code: SysprimsErrorCode, message: string);
18
+ }
19
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB;;;;;;;;;;;CAWpB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAM3F,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAgB,IAAI,EAAE,iBAAiB,CAAC;IACxC,SAAgB,QAAQ,EAAE,MAAM,CAAC;gBAErB,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM;CAMrD"}
package/dist/errors.js ADDED
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SysprimsError = exports.SysprimsErrorCode = void 0;
4
+ exports.SysprimsErrorCode = {
5
+ Ok: 0,
6
+ InvalidArgument: 1,
7
+ SpawnFailed: 2,
8
+ Timeout: 3,
9
+ PermissionDenied: 4,
10
+ NotFound: 5,
11
+ NotSupported: 6,
12
+ GroupCreationFailed: 7,
13
+ System: 8,
14
+ Internal: 99,
15
+ };
16
+ const errorCodeNames = Object.fromEntries(Object.entries(exports.SysprimsErrorCode).map(([k, v]) => [v, k]));
17
+ class SysprimsError extends Error {
18
+ code;
19
+ codeName;
20
+ constructor(code, message) {
21
+ super(message);
22
+ this.name = "SysprimsError";
23
+ this.code = code;
24
+ this.codeName = errorCodeNames[code] ?? `Unknown(${code})`;
25
+ }
26
+ }
27
+ exports.SysprimsError = SysprimsError;
28
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG;IAC/B,EAAE,EAAE,CAAC;IACL,eAAe,EAAE,CAAC;IAClB,WAAW,EAAE,CAAC;IACd,OAAO,EAAE,CAAC;IACV,gBAAgB,EAAE,CAAC;IACnB,QAAQ,EAAE,CAAC;IACX,YAAY,EAAE,CAAC;IACf,mBAAmB,EAAE,CAAC;IACtB,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,EAAE;CACJ,CAAC;AAIX,MAAM,cAAc,GAA2B,MAAM,CAAC,WAAW,CAC/D,MAAM,CAAC,OAAO,CAAC,yBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAC1D,CAAC;AAEF,MAAa,aAAc,SAAQ,KAAK;IACtB,IAAI,CAAoB;IACxB,QAAQ,CAAS;IAEjC,YAAY,IAAuB,EAAE,OAAe;QAClD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,WAAW,IAAI,GAAG,CAAC;IAC7D,CAAC;CACF;AAVD,sCAUC"}
package/dist/ffi.d.ts ADDED
@@ -0,0 +1,34 @@
1
+ export declare function loadSysprims(): SysprimsLib;
2
+ export type SysprimsCallJsonResult = {
3
+ code: number;
4
+ json?: string;
5
+ message?: string;
6
+ };
7
+ export type SysprimsCallU32Result = {
8
+ code: number;
9
+ value?: number;
10
+ message?: string;
11
+ };
12
+ export type SysprimsCallVoidResult = {
13
+ code: number;
14
+ message?: string;
15
+ };
16
+ export type SysprimsLib = {
17
+ sysprimsAbiVersion: () => number;
18
+ sysprimsProcGet: (pid: number) => SysprimsCallJsonResult;
19
+ sysprimsProcList: (filterJson: string) => SysprimsCallJsonResult;
20
+ sysprimsProcListeningPorts: (filterJson: string) => SysprimsCallJsonResult;
21
+ sysprimsProcWaitPid: (pid: number, timeoutMs: number) => SysprimsCallJsonResult;
22
+ sysprimsSelfGetpgid: () => SysprimsCallU32Result;
23
+ sysprimsSelfGetsid: () => SysprimsCallU32Result;
24
+ sysprimsSignalSend: (pid: number, signal: number) => SysprimsCallVoidResult;
25
+ sysprimsSignalSendGroup: (pgid: number, signal: number) => SysprimsCallVoidResult;
26
+ sysprimsTerminate: (pid: number) => SysprimsCallVoidResult;
27
+ sysprimsForceKill: (pid: number) => SysprimsCallVoidResult;
28
+ sysprimsTerminateTree: (pid: number, configJson: string) => SysprimsCallJsonResult;
29
+ sysprimsSpawnInGroup: (configJson: string) => SysprimsCallJsonResult;
30
+ };
31
+ export declare function callJsonReturn(fn: () => SysprimsCallJsonResult): unknown;
32
+ export declare function callU32Out(fn: () => SysprimsCallU32Result): number;
33
+ export declare function callVoid(fn: () => SysprimsCallVoidResult): void;
34
+ //# sourceMappingURL=ffi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ffi.d.ts","sourceRoot":"","sources":["../src/ffi.ts"],"names":[],"mappings":"AASA,wBAAgB,YAAY,IAAI,WAAW,CAQ1C;AAcD,MAAM,MAAM,sBAAsB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AACvF,MAAM,MAAM,qBAAqB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AACvF,MAAM,MAAM,sBAAsB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,MAAM,MAAM,WAAW,GAAG;IACxB,kBAAkB,EAAE,MAAM,MAAM,CAAC;IAGjC,eAAe,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,sBAAsB,CAAC;IACzD,gBAAgB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,sBAAsB,CAAC;IACjE,0BAA0B,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,sBAAsB,CAAC;IAC3E,mBAAmB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,sBAAsB,CAAC;IAGhF,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;IACjD,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;IAGhD,kBAAkB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,sBAAsB,CAAC;IAC5E,uBAAuB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,sBAAsB,CAAC;IAClF,iBAAiB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,sBAAsB,CAAC;IAC3D,iBAAiB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,sBAAsB,CAAC;IAG3D,qBAAqB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,sBAAsB,CAAC;IAGnF,oBAAoB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,sBAAsB,CAAC;CACtE,CAAC;AAUF,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,sBAAsB,GAAG,OAAO,CAMxE;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,qBAAqB,GAAG,MAAM,CAMlE;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,sBAAsB,GAAG,IAAI,CAK/D"}
package/dist/ffi.js ADDED
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.loadSysprims = loadSysprims;
7
+ exports.callJsonReturn = callJsonReturn;
8
+ exports.callU32Out = callU32Out;
9
+ exports.callVoid = callVoid;
10
+ const errors_1 = require("./errors");
11
+ const node_fs_1 = __importDefault(require("node:fs"));
12
+ const node_path_1 = __importDefault(require("node:path"));
13
+ const native_1 = require("./native");
14
+ let cached = null;
15
+ function loadSysprims() {
16
+ if (cached)
17
+ return cached;
18
+ const packageRoot = findPackageRoot(__dirname);
19
+ const api = (0, native_1.loadNativeBinding)(packageRoot);
20
+ cached = api;
21
+ return cached;
22
+ }
23
+ function findPackageRoot(startDir) {
24
+ let current = startDir;
25
+ for (let i = 0; i < 8; i++) {
26
+ const candidate = node_path_1.default.join(current, "package.json");
27
+ if (node_fs_1.default.existsSync(candidate))
28
+ return current;
29
+ const parent = node_path_1.default.dirname(current);
30
+ if (parent === current)
31
+ break;
32
+ current = parent;
33
+ }
34
+ throw new Error("Could not locate package root (package.json not found)");
35
+ }
36
+ function raiseSysprimsError(code, message) {
37
+ const codeNameSuffix = ` (code=${code})`;
38
+ throw new errors_1.SysprimsError(code, message && message.length > 0 ? message : `sysprims error${codeNameSuffix}`);
39
+ }
40
+ function callJsonReturn(fn) {
41
+ const r = fn();
42
+ if (r.code !== errors_1.SysprimsErrorCode.Ok) {
43
+ raiseSysprimsError(r.code, r.message);
44
+ }
45
+ return JSON.parse(r.json);
46
+ }
47
+ function callU32Out(fn) {
48
+ const r = fn();
49
+ if (r.code !== errors_1.SysprimsErrorCode.Ok) {
50
+ raiseSysprimsError(r.code, r.message);
51
+ }
52
+ return r.value >>> 0;
53
+ }
54
+ function callVoid(fn) {
55
+ const r = fn();
56
+ if (r.code !== errors_1.SysprimsErrorCode.Ok) {
57
+ raiseSysprimsError(r.code, r.message);
58
+ }
59
+ }
60
+ //# sourceMappingURL=ffi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ffi.js","sourceRoot":"","sources":["../src/ffi.ts"],"names":[],"mappings":";;;;;AASA,oCAQC;AAoDD,wCAMC;AAED,gCAMC;AAED,4BAKC;AA1FD,qCAA4D;AAE5D,sDAAyB;AACzB,0DAA6B;AAE7B,qCAA6C;AAE7C,IAAI,MAAM,GAAuB,IAAI,CAAC;AAEtC,SAAgB,YAAY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CAAC,CAAC;IACxC,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAc,CAAC,CAAC;AACtC,CAAC;AAED,SAAgB,UAAU,CAAC,EAA+B;IACxD,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC;IACf,IAAI,CAAC,CAAC,IAAI,KAAK,0BAAiB,CAAC,EAAE,EAAE,CAAC;QACpC,kBAAkB,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IACD,OAAQ,CAAC,CAAC,KAAgB,KAAK,CAAC,CAAC;AACnC,CAAC;AAED,SAAgB,QAAQ,CAAC,EAAgC;IACvD,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC;IACf,IAAI,CAAC,CAAC,IAAI,KAAK,0BAAiB,CAAC,EAAE,EAAE,CAAC;QACpC,kBAAkB,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;AACH,CAAC"}
@@ -0,0 +1,158 @@
1
+ import { SysprimsError, SysprimsErrorCode } from "./errors";
2
+ import type { PortBindingsSnapshot, PortFilter, ProcessFilter, ProcessInfo, ProcessSnapshot, WaitPidResult, TerminateTreeConfig, TerminateTreeResult, SpawnInGroupConfig, SpawnInGroupResult } from "./types";
3
+ export { SysprimsError, SysprimsErrorCode };
4
+ export type { PortBinding, PortBindingsSnapshot, PortFilter, ProcessFilter, ProcessInfo, ProcessSnapshot, ProcessState, Protocol, WaitPidResult, TerminateTreeConfig, TerminateTreeResult, SpawnInGroupConfig, SpawnInGroupResult, } from "./types";
5
+ /**
6
+ * Get information about a specific process by PID.
7
+ *
8
+ * @param pid - Process ID to query
9
+ * @returns Process information including name, state, CPU, memory usage
10
+ * @throws {SysprimsError} NotFound if process does not exist
11
+ * @throws {SysprimsError} PermissionDenied if access is denied
12
+ */
13
+ export declare function procGet(pid: number): ProcessInfo;
14
+ /**
15
+ * List running processes with optional filtering.
16
+ *
17
+ * Filter fields use snake_case to match FFI/schema conventions:
18
+ * - `name_contains`: substring match (case-insensitive)
19
+ * - `name_equals`: exact name match
20
+ * - `user_equals`: exact username match
21
+ * - `pid_in`: array of PIDs to include
22
+ * - `state_in`: array of states to include
23
+ * - `cpu_above`: minimum CPU percentage (0-100)
24
+ * - `memory_above_kb`: minimum memory in KB
25
+ *
26
+ * @param filter - Optional filter criteria (all fields are AND-ed)
27
+ * @returns Snapshot of matching processes
28
+ *
29
+ * @example
30
+ * // List all processes
31
+ * const all = processList();
32
+ *
33
+ * @example
34
+ * // Filter by name substring
35
+ * const nginx = processList({ name_contains: "nginx" });
36
+ *
37
+ * @example
38
+ * // Filter by multiple criteria
39
+ * const heavy = processList({ cpu_above: 50, memory_above_kb: 100000 });
40
+ */
41
+ export declare function processList(filter?: ProcessFilter): ProcessSnapshot;
42
+ /**
43
+ * List listening network ports with optional filtering.
44
+ *
45
+ * Results are best-effort: some platforms may not provide full process attribution,
46
+ * and elevated privileges may be required for complete visibility. Check the
47
+ * `warnings` array in the result for any limitations encountered.
48
+ *
49
+ * Filter fields use snake_case to match FFI/schema conventions:
50
+ * - `protocol`: "tcp" or "udp"
51
+ * - `local_port`: specific port number
52
+ *
53
+ * @param filter - Optional filter criteria
54
+ * @returns Snapshot of listening ports (may be empty if no ports are listening)
55
+ *
56
+ * @example
57
+ * // List all listening ports
58
+ * const ports = listeningPorts();
59
+ *
60
+ * @example
61
+ * // Filter by protocol
62
+ * const tcpPorts = listeningPorts({ protocol: "tcp" });
63
+ *
64
+ * @example
65
+ * // Find specific port
66
+ * const http = listeningPorts({ local_port: 8080 });
67
+ */
68
+ export declare function listeningPorts(filter?: PortFilter): PortBindingsSnapshot;
69
+ /**
70
+ * Wait for a PID to exit up to the provided timeout (milliseconds).
71
+ *
72
+ * Best-effort behavior:
73
+ * - Unix: polling strategy (we are not necessarily the parent)
74
+ * - Windows: process wait APIs when available
75
+ */
76
+ export declare function waitPID(pid: number, timeoutMs: number): WaitPidResult;
77
+ /**
78
+ * Get the process group ID of the current process.
79
+ *
80
+ * @returns Process group ID (PGID)
81
+ * @throws {SysprimsError} NotSupported on Windows (POSIX concept)
82
+ */
83
+ export declare function selfPGID(): number;
84
+ /**
85
+ * Get the session ID of the current process.
86
+ *
87
+ * @returns Session ID (SID)
88
+ * @throws {SysprimsError} NotSupported on Windows (POSIX concept)
89
+ */
90
+ export declare function selfSID(): number;
91
+ /**
92
+ * Send a signal to a process.
93
+ *
94
+ * On Unix: sends the specified POSIX signal (e.g., 15=SIGTERM, 9=SIGKILL).
95
+ * On Windows: only signal 0 (existence check) and termination signals are
96
+ * meaningful; other signals may return NotSupported.
97
+ *
98
+ * @param pid - Target process ID
99
+ * @param signal - Signal number (Unix semantics)
100
+ * @throws {SysprimsError} NotFound if process does not exist
101
+ * @throws {SysprimsError} PermissionDenied if access is denied
102
+ * @throws {SysprimsError} NotSupported if signal is not supported on this platform
103
+ *
104
+ * @example
105
+ * // Check if process exists (signal 0)
106
+ * signalSend(1234, 0);
107
+ *
108
+ * @example
109
+ * // Send SIGTERM
110
+ * signalSend(1234, 15);
111
+ */
112
+ export declare function signalSend(pid: number, signal: number): void;
113
+ /**
114
+ * Send a signal to a process group.
115
+ *
116
+ * On Unix: sends the signal to all processes in the group.
117
+ * On Windows: NotSupported (no process group concept).
118
+ *
119
+ * @param pgid - Target process group ID
120
+ * @param signal - Signal number (Unix semantics)
121
+ * @throws {SysprimsError} NotFound if process group does not exist
122
+ * @throws {SysprimsError} PermissionDenied if access is denied
123
+ * @throws {SysprimsError} NotSupported on Windows
124
+ */
125
+ export declare function signalSendGroup(pgid: number, signal: number): void;
126
+ /**
127
+ * Terminate a process gracefully.
128
+ *
129
+ * On Unix: sends SIGTERM.
130
+ * On Windows: calls TerminateProcess.
131
+ *
132
+ * @param pid - Target process ID
133
+ * @throws {SysprimsError} NotFound if process does not exist
134
+ * @throws {SysprimsError} PermissionDenied if access is denied
135
+ */
136
+ export declare function terminate(pid: number): void;
137
+ /**
138
+ * Force kill a process immediately.
139
+ *
140
+ * On Unix: sends SIGKILL (cannot be caught or ignored).
141
+ * On Windows: calls TerminateProcess.
142
+ *
143
+ * @param pid - Target process ID
144
+ * @throws {SysprimsError} NotFound if process does not exist
145
+ * @throws {SysprimsError} PermissionDenied if access is denied
146
+ */
147
+ export declare function forceKill(pid: number): void;
148
+ /**
149
+ * Terminate a process with escalation (TERM -> wait -> KILL).
150
+ *
151
+ * This is intended for supervisor stop flows.
152
+ *
153
+ * Note: this is a PID-only API. On Unix, if `pid` is a process group leader,
154
+ * sysprims may use group kill for better coverage.
155
+ */
156
+ export declare function terminateTree(pid: number, config?: TerminateTreeConfig): TerminateTreeResult;
157
+ export declare function spawnInGroup(config: SpawnInGroupConfig): SpawnInGroupResult;
158
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE5D,OAAO,KAAK,EACV,oBAAoB,EACpB,UAAU,EACV,aAAa,EACb,WAAW,EACX,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAC;AAC5C,YAAY,EACV,WAAW,EACX,oBAAoB,EACpB,UAAU,EACV,aAAa,EACb,WAAW,EACX,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,SAAS,CAAC;AAMjB;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAIhD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,WAAW,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG,eAAe,CAKnE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,oBAAoB,CAKxE;AAMD;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,aAAa,CAIrE;AAMD;;;;;GAKG;AACH,wBAAgB,QAAQ,IAAI,MAAM,CAGjC;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,IAAI,MAAM,CAGhC;AAMD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAG5D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAGlE;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAG3C;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAG3C;AAMD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,mBAAmB,GAAG,mBAAmB,CAiB5F;AAMD,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAS3E"}
package/dist/index.js ADDED
@@ -0,0 +1,246 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SysprimsErrorCode = exports.SysprimsError = void 0;
4
+ exports.procGet = procGet;
5
+ exports.processList = processList;
6
+ exports.listeningPorts = listeningPorts;
7
+ exports.waitPID = waitPID;
8
+ exports.selfPGID = selfPGID;
9
+ exports.selfSID = selfSID;
10
+ exports.signalSend = signalSend;
11
+ exports.signalSendGroup = signalSendGroup;
12
+ exports.terminate = terminate;
13
+ exports.forceKill = forceKill;
14
+ exports.terminateTree = terminateTree;
15
+ exports.spawnInGroup = spawnInGroup;
16
+ const errors_1 = require("./errors");
17
+ Object.defineProperty(exports, "SysprimsError", { enumerable: true, get: function () { return errors_1.SysprimsError; } });
18
+ Object.defineProperty(exports, "SysprimsErrorCode", { enumerable: true, get: function () { return errors_1.SysprimsErrorCode; } });
19
+ const ffi_1 = require("./ffi");
20
+ // -----------------------------------------------------------------------------
21
+ // Process Inspection
22
+ // -----------------------------------------------------------------------------
23
+ /**
24
+ * Get information about a specific process by PID.
25
+ *
26
+ * @param pid - Process ID to query
27
+ * @returns Process information including name, state, CPU, memory usage
28
+ * @throws {SysprimsError} NotFound if process does not exist
29
+ * @throws {SysprimsError} PermissionDenied if access is denied
30
+ */
31
+ function procGet(pid) {
32
+ const lib = (0, ffi_1.loadSysprims)();
33
+ const result = (0, ffi_1.callJsonReturn)(() => lib.sysprimsProcGet(pid >>> 0));
34
+ return result;
35
+ }
36
+ /**
37
+ * List running processes with optional filtering.
38
+ *
39
+ * Filter fields use snake_case to match FFI/schema conventions:
40
+ * - `name_contains`: substring match (case-insensitive)
41
+ * - `name_equals`: exact name match
42
+ * - `user_equals`: exact username match
43
+ * - `pid_in`: array of PIDs to include
44
+ * - `state_in`: array of states to include
45
+ * - `cpu_above`: minimum CPU percentage (0-100)
46
+ * - `memory_above_kb`: minimum memory in KB
47
+ *
48
+ * @param filter - Optional filter criteria (all fields are AND-ed)
49
+ * @returns Snapshot of matching processes
50
+ *
51
+ * @example
52
+ * // List all processes
53
+ * const all = processList();
54
+ *
55
+ * @example
56
+ * // Filter by name substring
57
+ * const nginx = processList({ name_contains: "nginx" });
58
+ *
59
+ * @example
60
+ * // Filter by multiple criteria
61
+ * const heavy = processList({ cpu_above: 50, memory_above_kb: 100000 });
62
+ */
63
+ function processList(filter) {
64
+ const lib = (0, ffi_1.loadSysprims)();
65
+ const filterJson = filter ? JSON.stringify(filter) : "";
66
+ const result = (0, ffi_1.callJsonReturn)(() => lib.sysprimsProcList(filterJson));
67
+ return result;
68
+ }
69
+ /**
70
+ * List listening network ports with optional filtering.
71
+ *
72
+ * Results are best-effort: some platforms may not provide full process attribution,
73
+ * and elevated privileges may be required for complete visibility. Check the
74
+ * `warnings` array in the result for any limitations encountered.
75
+ *
76
+ * Filter fields use snake_case to match FFI/schema conventions:
77
+ * - `protocol`: "tcp" or "udp"
78
+ * - `local_port`: specific port number
79
+ *
80
+ * @param filter - Optional filter criteria
81
+ * @returns Snapshot of listening ports (may be empty if no ports are listening)
82
+ *
83
+ * @example
84
+ * // List all listening ports
85
+ * const ports = listeningPorts();
86
+ *
87
+ * @example
88
+ * // Filter by protocol
89
+ * const tcpPorts = listeningPorts({ protocol: "tcp" });
90
+ *
91
+ * @example
92
+ * // Find specific port
93
+ * const http = listeningPorts({ local_port: 8080 });
94
+ */
95
+ function listeningPorts(filter) {
96
+ const lib = (0, ffi_1.loadSysprims)();
97
+ const filterJson = filter ? JSON.stringify(filter) : "";
98
+ const result = (0, ffi_1.callJsonReturn)(() => lib.sysprimsProcListeningPorts(filterJson));
99
+ return result;
100
+ }
101
+ // -----------------------------------------------------------------------------
102
+ // Wait
103
+ // -----------------------------------------------------------------------------
104
+ /**
105
+ * Wait for a PID to exit up to the provided timeout (milliseconds).
106
+ *
107
+ * Best-effort behavior:
108
+ * - Unix: polling strategy (we are not necessarily the parent)
109
+ * - Windows: process wait APIs when available
110
+ */
111
+ function waitPID(pid, timeoutMs) {
112
+ const lib = (0, ffi_1.loadSysprims)();
113
+ const result = (0, ffi_1.callJsonReturn)(() => lib.sysprimsProcWaitPid(pid >>> 0, timeoutMs));
114
+ return result;
115
+ }
116
+ // -----------------------------------------------------------------------------
117
+ // Self Introspection
118
+ // -----------------------------------------------------------------------------
119
+ /**
120
+ * Get the process group ID of the current process.
121
+ *
122
+ * @returns Process group ID (PGID)
123
+ * @throws {SysprimsError} NotSupported on Windows (POSIX concept)
124
+ */
125
+ function selfPGID() {
126
+ const lib = (0, ffi_1.loadSysprims)();
127
+ return (0, ffi_1.callU32Out)(() => lib.sysprimsSelfGetpgid());
128
+ }
129
+ /**
130
+ * Get the session ID of the current process.
131
+ *
132
+ * @returns Session ID (SID)
133
+ * @throws {SysprimsError} NotSupported on Windows (POSIX concept)
134
+ */
135
+ function selfSID() {
136
+ const lib = (0, ffi_1.loadSysprims)();
137
+ return (0, ffi_1.callU32Out)(() => lib.sysprimsSelfGetsid());
138
+ }
139
+ // -----------------------------------------------------------------------------
140
+ // Signal Operations
141
+ // -----------------------------------------------------------------------------
142
+ /**
143
+ * Send a signal to a process.
144
+ *
145
+ * On Unix: sends the specified POSIX signal (e.g., 15=SIGTERM, 9=SIGKILL).
146
+ * On Windows: only signal 0 (existence check) and termination signals are
147
+ * meaningful; other signals may return NotSupported.
148
+ *
149
+ * @param pid - Target process ID
150
+ * @param signal - Signal number (Unix semantics)
151
+ * @throws {SysprimsError} NotFound if process does not exist
152
+ * @throws {SysprimsError} PermissionDenied if access is denied
153
+ * @throws {SysprimsError} NotSupported if signal is not supported on this platform
154
+ *
155
+ * @example
156
+ * // Check if process exists (signal 0)
157
+ * signalSend(1234, 0);
158
+ *
159
+ * @example
160
+ * // Send SIGTERM
161
+ * signalSend(1234, 15);
162
+ */
163
+ function signalSend(pid, signal) {
164
+ const lib = (0, ffi_1.loadSysprims)();
165
+ (0, ffi_1.callVoid)(() => lib.sysprimsSignalSend(pid >>> 0, signal | 0));
166
+ }
167
+ /**
168
+ * Send a signal to a process group.
169
+ *
170
+ * On Unix: sends the signal to all processes in the group.
171
+ * On Windows: NotSupported (no process group concept).
172
+ *
173
+ * @param pgid - Target process group ID
174
+ * @param signal - Signal number (Unix semantics)
175
+ * @throws {SysprimsError} NotFound if process group does not exist
176
+ * @throws {SysprimsError} PermissionDenied if access is denied
177
+ * @throws {SysprimsError} NotSupported on Windows
178
+ */
179
+ function signalSendGroup(pgid, signal) {
180
+ const lib = (0, ffi_1.loadSysprims)();
181
+ (0, ffi_1.callVoid)(() => lib.sysprimsSignalSendGroup(pgid >>> 0, signal | 0));
182
+ }
183
+ /**
184
+ * Terminate a process gracefully.
185
+ *
186
+ * On Unix: sends SIGTERM.
187
+ * On Windows: calls TerminateProcess.
188
+ *
189
+ * @param pid - Target process ID
190
+ * @throws {SysprimsError} NotFound if process does not exist
191
+ * @throws {SysprimsError} PermissionDenied if access is denied
192
+ */
193
+ function terminate(pid) {
194
+ const lib = (0, ffi_1.loadSysprims)();
195
+ (0, ffi_1.callVoid)(() => lib.sysprimsTerminate(pid >>> 0));
196
+ }
197
+ /**
198
+ * Force kill a process immediately.
199
+ *
200
+ * On Unix: sends SIGKILL (cannot be caught or ignored).
201
+ * On Windows: calls TerminateProcess.
202
+ *
203
+ * @param pid - Target process ID
204
+ * @throws {SysprimsError} NotFound if process does not exist
205
+ * @throws {SysprimsError} PermissionDenied if access is denied
206
+ */
207
+ function forceKill(pid) {
208
+ const lib = (0, ffi_1.loadSysprims)();
209
+ (0, ffi_1.callVoid)(() => lib.sysprimsForceKill(pid >>> 0));
210
+ }
211
+ // -----------------------------------------------------------------------------
212
+ // Terminate Tree
213
+ // -----------------------------------------------------------------------------
214
+ /**
215
+ * Terminate a process with escalation (TERM -> wait -> KILL).
216
+ *
217
+ * This is intended for supervisor stop flows.
218
+ *
219
+ * Note: this is a PID-only API. On Unix, if `pid` is a process group leader,
220
+ * sysprims may use group kill for better coverage.
221
+ */
222
+ function terminateTree(pid, config) {
223
+ const lib = (0, ffi_1.loadSysprims)();
224
+ if (!config) {
225
+ return (0, ffi_1.callJsonReturn)(() => lib.sysprimsTerminateTree(pid >>> 0, ""));
226
+ }
227
+ const cfg = {
228
+ schema_id: config.schema_id ||
229
+ "https://schemas.3leaps.dev/sysprims/process/v1.0.0/terminate-tree-config.schema.json",
230
+ ...config,
231
+ };
232
+ return (0, ffi_1.callJsonReturn)(() => lib.sysprimsTerminateTree(pid >>> 0, JSON.stringify(cfg)));
233
+ }
234
+ // -----------------------------------------------------------------------------
235
+ // Spawn In Group
236
+ // -----------------------------------------------------------------------------
237
+ function spawnInGroup(config) {
238
+ const lib = (0, ffi_1.loadSysprims)();
239
+ const cfg = {
240
+ schema_id: config.schema_id ||
241
+ "https://schemas.3leaps.dev/sysprims/process/v1.0.0/spawn-in-group-config.schema.json",
242
+ ...config,
243
+ };
244
+ return (0, ffi_1.callJsonReturn)(() => lib.sysprimsSpawnInGroup(JSON.stringify(cfg)));
245
+ }
246
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AA4CA,0BAIC;AA6BD,kCAKC;AA4BD,wCAKC;AAaD,0BAIC;AAYD,4BAGC;AAQD,0BAGC;AA2BD,gCAGC;AAcD,0CAGC;AAYD,8BAGC;AAYD,8BAGC;AAcD,sCAiBC;AAMD,oCASC;AAzRD,qCAA4D;AAenD,8FAfA,sBAAa,OAeA;AAAE,kGAfA,0BAAiB,OAeA;AAdzC,+BAA2E;AA+B3E,gFAAgF;AAChF,qBAAqB;AACrB,gFAAgF;AAEhF;;;;;;;GAOG;AACH,SAAgB,OAAO,CAAC,GAAW;IACjC,MAAM,GAAG,GAAG,IAAA,kBAAY,GAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,IAAA,oBAAc,EAAC,GAAG,EAAE,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACpE,OAAO,MAAqB,CAAC;AAC/B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAgB,WAAW,CAAC,MAAsB;IAChD,MAAM,GAAG,GAAG,IAAA,kBAAY,GAAE,CAAC;IAC3B,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACxD,MAAM,MAAM,GAAG,IAA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,oBAAc,EAAC,GAAG,EAAE,CAAC,GAAG,CAAC,qBAAqB,CAAC,GAAG,KAAK,CAAC,EAAE,EAAE,CAAC,CAAwB,CAAC;IAC/F,CAAC;IAED,MAAM,GAAG,GAAwB;QAC/B,SAAS,EACP,MAAM,CAAC,SAAS;YAChB,sFAAsF;QACxF,GAAG,MAAM;KACV,CAAC;IAEF,OAAO,IAAA,oBAAc,EACnB,GAAG,EAAE,CAAC,GAAG,CAAC,qBAAqB,CAAC,GAAG,KAAK,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CACzC,CAAC;AAC3B,CAAC;AAED,gFAAgF;AAChF,iBAAiB;AACjB,gFAAgF;AAEhF,SAAgB,YAAY,CAAC,MAA0B;IACrD,MAAM,GAAG,GAAG,IAAA,kBAAY,GAAE,CAAC;IAC3B,MAAM,GAAG,GAAuB;QAC9B,SAAS,EACP,MAAM,CAAC,SAAS;YAChB,sFAAsF;QACxF,GAAG,MAAM;KACV,CAAC;IACF,OAAO,IAAA,oBAAc,EAAC,GAAG,EAAE,CAAC,GAAG,CAAC,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAuB,CAAC;AACnG,CAAC"}
@@ -0,0 +1,32 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /* auto-generated by NAPI-RS */
5
+
6
+ export interface SysprimsCallJsonResult {
7
+ code: number
8
+ json?: string
9
+ message?: string
10
+ }
11
+ export interface SysprimsCallU32Result {
12
+ code: number
13
+ value?: number
14
+ message?: string
15
+ }
16
+ export interface SysprimsCallVoidResult {
17
+ code: number
18
+ message?: string
19
+ }
20
+ export declare function sysprimsAbiVersion(): number
21
+ export declare function sysprimsProcGet(pid: number): SysprimsCallJsonResult
22
+ export declare function sysprimsProcList(filterJson: string): SysprimsCallJsonResult
23
+ export declare function sysprimsProcListeningPorts(filterJson: string): SysprimsCallJsonResult
24
+ export declare function sysprimsProcWaitPid(pid: number, timeoutMs: number): SysprimsCallJsonResult
25
+ export declare function sysprimsSelfGetpgid(): SysprimsCallU32Result
26
+ export declare function sysprimsSelfGetsid(): SysprimsCallU32Result
27
+ export declare function sysprimsSignalSend(pid: number, signal: number): SysprimsCallVoidResult
28
+ export declare function sysprimsSignalSendGroup(pgid: number, signal: number): SysprimsCallVoidResult
29
+ export declare function sysprimsTerminate(pid: number): SysprimsCallVoidResult
30
+ export declare function sysprimsForceKill(pid: number): SysprimsCallVoidResult
31
+ export declare function sysprimsTerminateTree(pid: number, configJson: string): SysprimsCallJsonResult
32
+ export declare function sysprimsSpawnInGroup(configJson: string): SysprimsCallJsonResult