@drakonkat/ai-helper 1.0.2 → 1.0.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/CHANGELOG.md +9 -1
- package/package.json +11 -4
- package/src/config.js +1 -2
- package/src/manager.js +17 -9
- package/src/utils/process.js +18 -10
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,15 @@ All notable changes to **`ai-helper` (`aih`)** are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
## [1.0.4] - 2026-08-27
|
|
8
|
+
|
|
9
|
+
### 🐛 Bug Fixes
|
|
10
|
+
- **Self Process CLI Exclusion**: Exclude current CLI process (`process.pid`) and `aih` CLI command patterns from OS process auto-discovery, preventing false-positive "already running" statuses during `aih start <service>`.
|
|
11
|
+
- **Precise Process Matching**: Refine `pxpipe-proxy` matching patterns so general CLI arguments are not mistaken for the active service daemon.
|
|
12
|
+
- **Post-Start Verification**: Verify actual service liveness after the startup grace period in `startService`, reporting startup failures accurately instead of declaring dead processes as running.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
7
16
|
## [1.0.2] - 2026-08-19
|
|
8
17
|
|
|
9
18
|
### 🐛 Bug Fixes
|
|
@@ -31,4 +40,3 @@ All notable changes to **`ai-helper` (`aih`)** are documented in this file.
|
|
|
31
40
|
- **Unified Live Log Streaming**: Real-time log capture and streaming with `aih logs <service> -f`.
|
|
32
41
|
- **Programmatic JSON API**: Added `--json` flag for IDE, agent, and pipeline integration.
|
|
33
42
|
- **Cross-Runtime & NPX Ready**: Universal Node.js (>=18) and Bun support.
|
|
34
|
-
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drakonkat/ai-helper",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Zero-config background service manager, auto-discovery daemon & dashboard launcher for AI agent ecosystems (pxpipe, ocx, agentmemory)",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"bin": {
|
|
9
|
-
"aih": "
|
|
10
|
-
"ai-helper": "
|
|
9
|
+
"aih": "bin/cli.js",
|
|
10
|
+
"ai-helper": "bin/cli.js"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"bin",
|
|
@@ -23,6 +23,14 @@
|
|
|
23
23
|
"publishConfig": {
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/drakonkat/ai-helper.git"
|
|
29
|
+
},
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/drakonkat/ai-helper/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/drakonkat/ai-helper#readme",
|
|
26
34
|
"scripts": {
|
|
27
35
|
"start": "node ./bin/cli.js",
|
|
28
36
|
"dev": "node ./bin/cli.js",
|
|
@@ -46,4 +54,3 @@
|
|
|
46
54
|
"author": "Mauro",
|
|
47
55
|
"license": "MIT"
|
|
48
56
|
}
|
|
49
|
-
|
package/src/config.js
CHANGED
package/src/manager.js
CHANGED
|
@@ -234,19 +234,28 @@ export class ServiceManager {
|
|
|
234
234
|
startedAt: new Date().toISOString(),
|
|
235
235
|
url: def.defaultUrl,
|
|
236
236
|
};
|
|
237
|
-
|
|
237
|
+
this.saveState(state);
|
|
238
|
+
|
|
239
|
+
// Wait a moment for background boot
|
|
240
|
+
await sleep(2000);
|
|
238
241
|
|
|
239
|
-
|
|
240
|
-
await
|
|
242
|
+
// Re-sync with OS
|
|
243
|
+
const updatedState = await this.syncState();
|
|
244
|
+
const updatedSvc = updatedState.services[serviceId];
|
|
241
245
|
|
|
242
|
-
|
|
243
|
-
|
|
246
|
+
if (!updatedSvc || updatedSvc.status !== "running" || !updatedSvc.pid || !isPidRunning(updatedSvc.pid)) {
|
|
247
|
+
return {
|
|
248
|
+
success: false,
|
|
249
|
+
message: `Service '${serviceId}' failed to start or exited immediately. Check logs with 'aih logs ${serviceId}'`,
|
|
250
|
+
pid,
|
|
251
|
+
};
|
|
252
|
+
}
|
|
244
253
|
|
|
245
254
|
return {
|
|
246
255
|
success: true,
|
|
247
|
-
message: `Service '${serviceId}' started successfully (PID: ${pid})`,
|
|
248
|
-
pid,
|
|
249
|
-
url: def.defaultUrl,
|
|
256
|
+
message: `Service '${serviceId}' started successfully (PID: ${updatedSvc.pid})`,
|
|
257
|
+
pid: updatedSvc.pid,
|
|
258
|
+
url: updatedSvc.url || def.defaultUrl,
|
|
250
259
|
};
|
|
251
260
|
}
|
|
252
261
|
|
|
@@ -400,4 +409,3 @@ export class ServiceManager {
|
|
|
400
409
|
}
|
|
401
410
|
|
|
402
411
|
export const manager = new ServiceManager();
|
|
403
|
-
|
package/src/utils/process.js
CHANGED
|
@@ -241,14 +241,16 @@ export function spawnDetachedProcess(command, logFilePath, options) {
|
|
|
241
241
|
*/
|
|
242
242
|
export async function discoverRunningProcesses() {
|
|
243
243
|
const discovered = {};
|
|
244
|
+
const currentPid = process.pid;
|
|
244
245
|
|
|
245
246
|
if (process.platform === "win32") {
|
|
246
247
|
try {
|
|
247
248
|
const script = `
|
|
248
249
|
$procs = Get-CimInstance Win32_Process | Where-Object {
|
|
250
|
+
$_.ProcessId -ne ${currentPid} -and
|
|
249
251
|
$_.CommandLine -and
|
|
250
|
-
($_.CommandLine -match 'pxpipe|ocx|agentmemory|iii') -and
|
|
251
|
-
($_.CommandLine -notmatch 'ai-helper|Get-CimInstance|Where-Object|Select-Object')
|
|
252
|
+
($_.CommandLine -match 'pxpipe-proxy|ocx|agentmemory|iii') -and
|
|
253
|
+
($_.CommandLine -notmatch 'ai-helper|\\baih(\\.exe)?\\b|bin\\\\cli\\.js|Get-CimInstance|Where-Object|Select-Object')
|
|
252
254
|
} | Select-Object ProcessId, ParentProcessId, Name, CommandLine, CreationDate
|
|
253
255
|
|
|
254
256
|
$ports = Get-NetTCPConnection -State Listen -ErrorAction SilentlyContinue | Select-Object LocalPort, OwningProcess
|
|
@@ -280,7 +282,12 @@ export async function discoverRunningProcesses() {
|
|
|
280
282
|
for (const item of procList) {
|
|
281
283
|
const cmd = item.CommandLine || "";
|
|
282
284
|
const pid = item.ProcessId;
|
|
283
|
-
if (!pid || !isPidRunning(pid)) continue;
|
|
285
|
+
if (!pid || pid === currentPid || !isPidRunning(pid)) continue;
|
|
286
|
+
|
|
287
|
+
// Skip any ai-helper / aih CLI executions
|
|
288
|
+
if (cmd.includes("bin/cli.js") || cmd.includes("bin\\cli.js") || /\baih(\.exe)?\b/i.test(cmd)) {
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
284
291
|
|
|
285
292
|
let startedAt;
|
|
286
293
|
if (item.CreationDate) {
|
|
@@ -298,7 +305,7 @@ export async function discoverRunningProcesses() {
|
|
|
298
305
|
const ports = pidToPorts[pid] || [];
|
|
299
306
|
|
|
300
307
|
// 1. pxpipe
|
|
301
|
-
if (cmd.includes("pxpipe-proxy")
|
|
308
|
+
if (cmd.includes("pxpipe-proxy")) {
|
|
302
309
|
if (!discovered.pxpipe || (item.Name && item.Name.toLowerCase() === "node.exe" && cmd.includes("cli.js"))) {
|
|
303
310
|
const webPort = ports.find(p => p > 1000 && p < 65000) || (discovered.pxpipe?.port);
|
|
304
311
|
discovered.pxpipe = {
|
|
@@ -312,7 +319,7 @@ export async function discoverRunningProcesses() {
|
|
|
312
319
|
}
|
|
313
320
|
|
|
314
321
|
// 2. ocx
|
|
315
|
-
if (cmd.includes("ocx.mjs") || cmd.includes("opencodex") || cmd.includes("ocx start")) {
|
|
322
|
+
if (cmd.includes("ocx.mjs") || cmd.includes("opencodex") || (cmd.includes("ocx start") && !cmd.includes("aih "))) {
|
|
316
323
|
const webPort = ports.find(p => p === 10100 || (p > 1000 && p < 65000));
|
|
317
324
|
if (!discovered.ocx || cmd.includes("ocx.mjs start")) {
|
|
318
325
|
discovered.ocx = {
|
|
@@ -335,7 +342,7 @@ export async function discoverRunningProcesses() {
|
|
|
335
342
|
cmd.includes("agentmemory/dist/cli.mjs") ||
|
|
336
343
|
cmd.includes("iii-config.yaml") ||
|
|
337
344
|
cmd.includes("iii.exe") ||
|
|
338
|
-
(cmd.includes("agentmemory") && !cmd.includes("mcp")))
|
|
345
|
+
(cmd.includes("agentmemory") && !cmd.includes("mcp") && !cmd.includes("aih ")))
|
|
339
346
|
) {
|
|
340
347
|
const webPort = ports.find(p => p === 3113 || p === 43210 || (p > 1000 && p < 65000));
|
|
341
348
|
if (!discovered.agentmemory || cmd.includes("agentmemory/agentmemory") || cmd.includes("dist\\cli.mjs")) {
|
|
@@ -372,14 +379,16 @@ export async function discoverRunningProcesses() {
|
|
|
372
379
|
|
|
373
380
|
for (const line of lines) {
|
|
374
381
|
const trimmed = line.trim();
|
|
375
|
-
if (!trimmed || trimmed.includes("ps -eo") || trimmed.includes("ai-helper")) continue;
|
|
382
|
+
if (!trimmed || trimmed.includes("ps -eo") || trimmed.includes("ai-helper") || /\baih\b/.test(trimmed)) continue;
|
|
376
383
|
|
|
377
384
|
const parts = trimmed.split(/\s+/);
|
|
378
385
|
const pid = parseInt(parts[0], 10);
|
|
379
386
|
const cmd = parts.slice(1).join(" ");
|
|
380
|
-
if (!pid || !isPidRunning(pid)) continue;
|
|
387
|
+
if (!pid || pid === currentPid || !isPidRunning(pid)) continue;
|
|
381
388
|
|
|
382
|
-
if (cmd.includes("
|
|
389
|
+
if (cmd.includes("bin/cli.js") || cmd.includes("bin/aih")) continue;
|
|
390
|
+
|
|
391
|
+
if (cmd.includes("pxpipe-proxy")) {
|
|
383
392
|
if (!discovered.pxpipe) discovered.pxpipe = { pid, command: cmd, url: "http://localhost:47821" };
|
|
384
393
|
}
|
|
385
394
|
if (cmd.includes("ocx start") || cmd.includes("ocx.mjs") || cmd.includes("opencodex")) {
|
|
@@ -402,4 +411,3 @@ export async function discoverRunningProcesses() {
|
|
|
402
411
|
|
|
403
412
|
return discovered;
|
|
404
413
|
}
|
|
405
|
-
|