@drakonkat/ai-helper 1.2.13 → 1.2.14
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/ARCHITECTURE.md +5 -0
- package/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/utils/process.js +9 -5
package/ARCHITECTURE.md
CHANGED
|
@@ -74,6 +74,11 @@ $ports = Get-NetTCPConnection -State Listen | Select-Object LocalPort, OwningPro
|
|
|
74
74
|
3. Automatically computes uptimes from `CreationDate`.
|
|
75
75
|
4. Maps dynamic ports to Web Dashboard URLs.
|
|
76
76
|
|
|
77
|
+
PowerShell discovery queries have a 10-second deadline so a cold or stalled CIM
|
|
78
|
+
provider cannot block status indefinitely. A failed scan is discarded; persisted
|
|
79
|
+
service PIDs are still checked for liveness and the next status refresh retries
|
|
80
|
+
external-process discovery.
|
|
81
|
+
|
|
77
82
|
### Unix Implementation
|
|
78
83
|
Uses `ps -eo pid,command` to match command line strings and extract active PIDs.
|
|
79
84
|
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,14 @@ All notable changes to **`ai-helper` (`aih`)** are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
## [1.2.14] - 2026-09-30
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- Bound Windows PowerShell/CIM discovery to 10 seconds so a cold or stalled provider cannot hang CLI status or port discovery. Discard failed scans while preserving live service PIDs already recorded in state.
|
|
11
|
+
- Treat subprocess termination without an exit code as failure and add a regression check for command deadlines. This fixes the Windows/Node 20 CI status test failure.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
7
15
|
## [1.2.13] - 2026-09-30
|
|
8
16
|
|
|
9
17
|
### Fixed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drakonkat/ai-helper",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.14",
|
|
4
4
|
"description": "Zero-config background service manager, auto-discovery daemon & dashboard launcher for AI agent ecosystems (pxpipe, ocx, agentmemory, headroom)",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"module": "src/index.js",
|
package/src/utils/process.js
CHANGED
|
@@ -15,14 +15,16 @@ export function sleep(ms) {
|
|
|
15
15
|
* Helper to run a command and return stdout/stderr asynchronously.
|
|
16
16
|
* @param {string} cmd
|
|
17
17
|
* @param {string[]} args
|
|
18
|
+
* @param {number} [timeout=0] Maximum runtime in milliseconds; zero disables the deadline.
|
|
18
19
|
* @returns {Promise<{ exitCode: number; stdout: string; stderr: string }>}
|
|
19
20
|
*/
|
|
20
|
-
export function execCommand(cmd, args) {
|
|
21
|
+
export function execCommand(cmd, args, timeout = 0) {
|
|
21
22
|
return new Promise(resolve => {
|
|
22
23
|
try {
|
|
23
24
|
const proc = spawn(cmd, args, {
|
|
24
25
|
stdio: ["ignore", "pipe", "pipe"],
|
|
25
26
|
windowsHide: true,
|
|
27
|
+
timeout,
|
|
26
28
|
});
|
|
27
29
|
|
|
28
30
|
let stdout = "";
|
|
@@ -32,7 +34,7 @@ export function execCommand(cmd, args) {
|
|
|
32
34
|
proc.stderr?.on("data", d => (stderr += d.toString()));
|
|
33
35
|
|
|
34
36
|
proc.on("close", exitCode => {
|
|
35
|
-
resolve({ exitCode: exitCode ??
|
|
37
|
+
resolve({ exitCode: exitCode ?? 1, stdout, stderr });
|
|
36
38
|
});
|
|
37
39
|
|
|
38
40
|
proc.on("error", err => {
|
|
@@ -107,7 +109,8 @@ export async function findPidsListeningOnPorts(ports) {
|
|
|
107
109
|
try {
|
|
108
110
|
const portList = ports.join(", ");
|
|
109
111
|
const script = `Get-NetTCPConnection -State Listen -ErrorAction SilentlyContinue | Where-Object { $_.LocalPort -in ${portList} } | Select-Object -ExpandProperty OwningProcess`;
|
|
110
|
-
const res = await execCommand("powershell.exe", ["-NoProfile", "-NonInteractive", "-Command", script]);
|
|
112
|
+
const res = await execCommand("powershell.exe", ["-NoProfile", "-NonInteractive", "-Command", script], 10000);
|
|
113
|
+
if (res.exitCode !== 0) return [];
|
|
111
114
|
const lines = res.stdout.trim().split(/\r?\n/);
|
|
112
115
|
for (const line of lines) {
|
|
113
116
|
const pid = parseInt(line.trim(), 10);
|
|
@@ -372,8 +375,9 @@ export async function discoverRunningProcesses({ knownServices = {} } = {}) {
|
|
|
372
375
|
Select-Object LocalPort, OwningProcess
|
|
373
376
|
@{ Procs = $procs; Ports = $ports } | ConvertTo-Json -Depth 3
|
|
374
377
|
`;
|
|
375
|
-
|
|
376
|
-
|
|
378
|
+
// A cold or stalled CIM provider must not hold status and the dashboard indefinitely.
|
|
379
|
+
const res = await execCommand("powershell.exe", ["-NoProfile", "-NonInteractive", "-Command", script], 10000);
|
|
380
|
+
if (res.exitCode === 0 && res.stdout.trim()) return discoverWindowsProcesses(JSON.parse(res.stdout), { knownServices });
|
|
377
381
|
} catch {}
|
|
378
382
|
} else {
|
|
379
383
|
try {
|