@drakonkat/ai-helper 1.0.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/ARCHITECTURE.md +100 -0
- package/CHANGELOG.md +22 -0
- package/LICENSE +21 -0
- package/README.md +287 -0
- package/bin/cli.js +3 -0
- package/package.json +49 -0
- package/src/config.js +39 -0
- package/src/index.js +326 -0
- package/src/manager.js +380 -0
- package/src/utils/format.js +160 -0
- package/src/utils/path.js +63 -0
- package/src/utils/process.js +369 -0
package/ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# 🏗️ Architecture & Internal Design
|
|
2
|
+
|
|
3
|
+
This document details the architectural principles, process lifecycles, auto-discovery mechanisms, and cross-platform designs implemented in **`ai-helper` (`aih`)**.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. High-Level Architecture
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
┌────────────────────────────────────────────────────────┐
|
|
11
|
+
│ CLI / NPX │
|
|
12
|
+
│ bin/cli.js ───► src/index.js (Router & Flags) │
|
|
13
|
+
└───────────────────────────┬────────────────────────────┘
|
|
14
|
+
│
|
|
15
|
+
┌───────────────────────────▼────────────────────────────┐
|
|
16
|
+
│ ServiceManager │
|
|
17
|
+
│ src/manager.js (State Machine & Process Manager) │
|
|
18
|
+
└──────────────┬──────────────────────────┬──────────────┘
|
|
19
|
+
│ │
|
|
20
|
+
┌──────────────▼──────────────┐ ┌─────────▼──────────────┐
|
|
21
|
+
│ Auto-Discovery Engine │ │ Process Lifecycle │
|
|
22
|
+
│ - Win32_Process (WMI/CIM) │ │ - Spawn Detached │
|
|
23
|
+
│ - Get-NetTCPConnection │ │ - Tree Kill (taskkill) │
|
|
24
|
+
│ - ps / pgrep (Unix) │ │ - Log Redirection │
|
|
25
|
+
└──────────────┬──────────────┘ └─────────┬──────────────┘
|
|
26
|
+
│ │
|
|
27
|
+
┌──────────────▼──────────────────────────▼──────────────┐
|
|
28
|
+
│ Persistence Layer │
|
|
29
|
+
│ ~/.aih/state.json │ ~/.aih/logs/<service>.log │
|
|
30
|
+
└────────────────────────────────────────────────────────┘
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 2. Process Tree Management
|
|
36
|
+
|
|
37
|
+
### The Orphan Process Problem
|
|
38
|
+
When background daemons are spawned via npm or shell wrappers (`npx pxpipe-proxy`, `ocx start`, `npx @agentmemory/agentmemory`), the spawned process hierarchy often looks like:
|
|
39
|
+
|
|
40
|
+
```text
|
|
41
|
+
cmd.exe (or sh)
|
|
42
|
+
└─► node.exe (npx-cli wrapper)
|
|
43
|
+
└─► node.exe (actual worker / proxy server)
|
|
44
|
+
└─► iii.exe (sub-process engine / binary)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
If a process manager kills only the parent PID, the child `node.exe` and `iii.exe` processes remain running as orphans in the background, keeping network ports locked.
|
|
48
|
+
|
|
49
|
+
### Solution in ai-helper
|
|
50
|
+
1. **Windows**: Uses `taskkill.exe /pid <PID> /T /F`:
|
|
51
|
+
- `/T`: Recursively terminates the specified process and any child processes started by it.
|
|
52
|
+
- `/F`: Forcefully terminates the processes.
|
|
53
|
+
2. **Unix (Linux & macOS)**:
|
|
54
|
+
- Signals the entire process group (`process.kill(-pid, "SIGTERM")`).
|
|
55
|
+
- If processes remain alive after 500ms, sends `SIGKILL`.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 3. Real-Time Auto-Discovery Engine
|
|
60
|
+
|
|
61
|
+
Even if services are started outside `aih` (e.g. from separate PowerShell tabs, IDE terminal windows, or boot scripts), `aih` dynamically discovers them:
|
|
62
|
+
|
|
63
|
+
### Windows Implementation
|
|
64
|
+
In a single fast PowerShell CIM query:
|
|
65
|
+
```powershell
|
|
66
|
+
$procs = Get-CimInstance Win32_Process | Where-Object {
|
|
67
|
+
$_.CommandLine -and ($_.CommandLine -match 'pxpipe|ocx|agentmemory|iii')
|
|
68
|
+
} | Select-Object ProcessId, ParentProcessId, Name, CommandLine, CreationDate
|
|
69
|
+
|
|
70
|
+
$ports = Get-NetTCPConnection -State Listen | Select-Object LocalPort, OwningProcess
|
|
71
|
+
```
|
|
72
|
+
1. Matches active processes against service signatures.
|
|
73
|
+
2. Correlates TCP listening ports with the process tree PIDs.
|
|
74
|
+
3. Automatically computes uptimes from `CreationDate`.
|
|
75
|
+
4. Maps dynamic ports to Web Dashboard URLs.
|
|
76
|
+
|
|
77
|
+
### Unix Implementation
|
|
78
|
+
Uses `ps -eo pid,command` to match command line strings and extract active PIDs.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 4. State Synchronization
|
|
83
|
+
|
|
84
|
+
- **Storage Location**: `~/.aih/state.json` (overridable via `$AIH_HOME`).
|
|
85
|
+
- **Audit Cycle**:
|
|
86
|
+
1. Reads existing state file.
|
|
87
|
+
2. Verifies PID liveness with non-destructive signals (`process.kill(pid, 0)`).
|
|
88
|
+
3. Discovers active external processes.
|
|
89
|
+
4. Resolves listening URLs.
|
|
90
|
+
5. Atomically saves updated state.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## 5. Zero-Dependency & Cross-Runtime Design
|
|
95
|
+
|
|
96
|
+
`ai-helper` relies solely on standard built-in modules:
|
|
97
|
+
- `node:child_process` & `node:fs`
|
|
98
|
+
- Works out of the box on **Node.js (>= 18.0.0)** and **Bun (>= 1.0.0)**.
|
|
99
|
+
- Standalone binaries can be generated with `bun build --compile`.
|
|
100
|
+
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# 📋 Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to **`ai-helper` (`aih`)** are documented in this file.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## [1.0.0] - 2026-08-19
|
|
8
|
+
|
|
9
|
+
### 🚀 Initial Release
|
|
10
|
+
- **Managed Services**: Support for background lifecycle management of:
|
|
11
|
+
- `pxpipe` (`npx pxpipe-proxy`)
|
|
12
|
+
- `ocx` (`ocx start`)
|
|
13
|
+
- `agentmemory` (`npx @agentmemory/agentmemory`)
|
|
14
|
+
- **Auto-Discovery Engine**: Detects running service instances started from external terminal windows via OS process table queries (`Win32_Process` and `ps`).
|
|
15
|
+
- **TCP Port & Dashboard Mapping**: Dynamically detects listening web ports and exposes clickable dashboard URLs.
|
|
16
|
+
- **One-Click Browser Dashboard Launcher**: Added `aih open [service]` to launch active dashboards directly in the user's default browser.
|
|
17
|
+
- **Safe Process Tree Termination**: Tree-killing on Windows via `taskkill /pid <PID> /T /F` and process group termination on Unix.
|
|
18
|
+
- **Unified Live Log Streaming**: Real-time log capture and streaming with `aih logs <service> -f`.
|
|
19
|
+
- **Programmatic JSON API**: Added `--json` flag for IDE, agent, and pipeline integration.
|
|
20
|
+
- **Cross-Runtime & NPX Ready**: Universal Node.js (>=18) and Bun support, publishable directly to npm for instant `npx ai-helper` execution.
|
|
21
|
+
- **Standalone Binary Compilation**: Optional compilation to standalone `aih.exe` via `bun run install-bin`.
|
|
22
|
+
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mauro
|
|
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
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
# ⚡ ai-helper (`aih`)
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>Zero-config background service manager, auto-discovery daemon & web dashboard launcher for AI agent ecosystems.</strong>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/@drakonkat/ai-helper"><img src="https://img.shields.io/npm/v/@drakonkat/ai-helper.svg?color=blue&style=flat-square" alt="NPM Version" /></a>
|
|
9
|
+
<a href="https://nodejs.org/"><img src="https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg?style=flat-square" alt="Node Version" /></a>
|
|
10
|
+
<a href="https://bun.sh/"><img src="https://img.shields.io/badge/bun-compatible-f472b6.svg?style=flat-square" alt="Bun Compatible" /></a>
|
|
11
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat-square" alt="License: MIT" /></a>
|
|
12
|
+
<img src="https://img.shields.io/badge/platform-windows%20%7C%20macos%20%7C%20linux-lightgrey.svg?style=flat-square" alt="Platforms" />
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 📖 Table of Contents
|
|
18
|
+
- [Why ai-helper?](#-why-ai-helper)
|
|
19
|
+
- [Quick Start](#-quick-start)
|
|
20
|
+
- [Managed Services & Dashboards](#-managed-services--dashboards)
|
|
21
|
+
- [Key Features](#-key-features)
|
|
22
|
+
- [CLI Reference](#-cli-reference)
|
|
23
|
+
- [Programmatic JSON API](#-programmatic-json-api)
|
|
24
|
+
- [Architecture & Documentation](#-architecture--documentation)
|
|
25
|
+
- [Configuration & State](#-configuration--state)
|
|
26
|
+
- [Contributing](#-contributing)
|
|
27
|
+
- [License](#-license)
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 💡 Why ai-helper?
|
|
32
|
+
|
|
33
|
+
When building, testing, and collaborating with local AI agents, coding assistants, and MCP servers, multiple background services must run simultaneously:
|
|
34
|
+
1. **`pxpipe`**: LLM & MCP protocol reverse proxy bridge (`npx pxpipe-proxy`).
|
|
35
|
+
2. **`ocx`**: OpenCode interpreter and execution daemon (`ocx start`).
|
|
36
|
+
3. **`agentmemory`**: Persistent long-term agent memory server (`npx @agentmemory/agentmemory`).
|
|
37
|
+
|
|
38
|
+
Manually opening separate terminal tabs for each service is messy, clutters your workspace, and easily leads to orphaned background processes and blocked ports.
|
|
39
|
+
|
|
40
|
+
**`aih`** solves this with a lightweight, zero-dependency CLI that:
|
|
41
|
+
- **Spawns and backgrounds** all services independently.
|
|
42
|
+
- **Auto-discovers** existing instances already running in external PowerShell / CMD / terminal windows.
|
|
43
|
+
- **Terminates process trees cleanly** (`taskkill /T /F` on Windows, process groups on Unix) so no child workers or ports remain trapped.
|
|
44
|
+
- **Opens web dashboards in your browser** with a single command (`aih open`).
|
|
45
|
+
- **Streams live unified logs** (`aih logs <service> -f`).
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 🚀 Quick Start
|
|
50
|
+
|
|
51
|
+
You can run `ai-helper` immediately using **`npx`** without cloning or installing anything:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# View services status and active dashboards
|
|
55
|
+
npx @drakonkat/ai-helper status
|
|
56
|
+
|
|
57
|
+
# Open all active web dashboards in your default browser
|
|
58
|
+
npx @drakonkat/ai-helper open
|
|
59
|
+
|
|
60
|
+
# Start all background services
|
|
61
|
+
npx @drakonkat/ai-helper start
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Global Installation
|
|
65
|
+
|
|
66
|
+
To use the compact `aih` command globally anywhere in your terminal:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Install globally via npm
|
|
70
|
+
npm install -g @drakonkat/ai-helper
|
|
71
|
+
|
|
72
|
+
# Or via bun
|
|
73
|
+
bun add -g @drakonkat/ai-helper
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 📦 Managed Services & Dashboards
|
|
79
|
+
|
|
80
|
+
| Service | Background Command | Default Port / URL | Description |
|
|
81
|
+
| :--- | :--- | :--- | :--- |
|
|
82
|
+
| **`pxpipe`** | `npx pxpipe-proxy` | [`http://localhost:47821`](http://localhost:47821) | AI LLM & MCP protocol reverse proxy bridge |
|
|
83
|
+
| **`ocx`** | `ocx start` | [`http://localhost:10100`](http://localhost:10100) | OpenCode interpreter execution daemon |
|
|
84
|
+
| **`agentmemory`** | `npx @agentmemory/agentmemory` | [`http://localhost:3113`](http://localhost:3113) | Persistent agent long-term memory server & viewer |
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## ✨ Key Features
|
|
89
|
+
|
|
90
|
+
- 🔍 **Real-Time Auto-Discovery**: Automatically queries OS process tables (`Win32_Process` and TCP listening connections on Windows, `ps` on Unix) to discover and manage processes started from external terminal windows.
|
|
91
|
+
- 🌐 **One-Click Dashboard Launcher**: Run `aih open` to launch all active service dashboards in your browser in separate tabs.
|
|
92
|
+
- 🛡️ **Clean Process Tree Termination**: Kills parent and all nested child worker processes (`node.exe`, `iii.exe`, etc.) ensuring no ports remain locked.
|
|
93
|
+
- 📜 **Live Log Streaming**: Unified stdout/stderr log capture per service with live real-time tailing (`aih logs <service> -f`).
|
|
94
|
+
- 🤖 **Agent & Automation Friendly**: Native `--json` output format for IDE integrations, subagents, and automated workflows.
|
|
95
|
+
- ⚡ **Zero Runtime Dependencies**: Built entirely on standard Node.js & Bun built-ins with instant startup time.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## 💻 CLI Reference
|
|
100
|
+
|
|
101
|
+
### 1. Status Overview
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
aih status
|
|
105
|
+
# or simply
|
|
106
|
+
aih
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
*Output:*
|
|
110
|
+
```text
|
|
111
|
+
ai-helper v1.0.0 — Background AI Ecosystem Service Manager
|
|
112
|
+
|
|
113
|
+
SERVICE STATUS PID UPTIME DASHBOARD / URL COMMAND
|
|
114
|
+
─────────── ───────── ───── ────── ────────────────────── ────────────────────────────
|
|
115
|
+
pxpipe ● RUNNING 36212 1h 42m http://localhost:47821 npx pxpipe-proxy
|
|
116
|
+
ocx ● RUNNING 31540 54s http://localhost:10100 ocx start
|
|
117
|
+
agentmemory ● RUNNING 44600 1h 32m http://localhost:3113 npx @agentmemory/agentmemory
|
|
118
|
+
|
|
119
|
+
Use 'aih open [service]' to open dashboards in browser or 'aih start' to launch.
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
### 2. Open Dashboards in Browser
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Open all currently running service dashboards
|
|
128
|
+
aih open
|
|
129
|
+
|
|
130
|
+
# Open only a specific dashboard
|
|
131
|
+
aih open agentmemory # Opens http://localhost:3113
|
|
132
|
+
aih open ocx # Opens http://localhost:10100
|
|
133
|
+
aih open pxpipe # Opens http://localhost:47821
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
### 3. Start Services
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Start all configured services
|
|
142
|
+
aih start
|
|
143
|
+
|
|
144
|
+
# Start a specific service
|
|
145
|
+
aih start pxpipe
|
|
146
|
+
aih start agentmemory
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
### 4. Stop Services
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Stop all running services (terminates process trees cleanly)
|
|
155
|
+
aih stop
|
|
156
|
+
|
|
157
|
+
# Stop a specific service
|
|
158
|
+
aih stop ocx
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
### 5. Restart Services
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Restart all services
|
|
167
|
+
aih restart
|
|
168
|
+
|
|
169
|
+
# Restart a specific service
|
|
170
|
+
aih restart pxpipe
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
### 6. View & Follow Logs
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# View last 50 lines of logs
|
|
179
|
+
aih logs pxpipe
|
|
180
|
+
|
|
181
|
+
# View last 100 lines
|
|
182
|
+
aih logs agentmemory -n 100
|
|
183
|
+
|
|
184
|
+
# Stream logs in real-time (like tail -f)
|
|
185
|
+
aih logs ocx -f
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 🤖 Programmatic JSON API
|
|
191
|
+
|
|
192
|
+
For AI agents, scripts, and CI/CD pipelines, use the `--json` flag:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
aih status --json
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
*Response:*
|
|
199
|
+
```json
|
|
200
|
+
[
|
|
201
|
+
{
|
|
202
|
+
"id": "pxpipe",
|
|
203
|
+
"name": "pxpipe",
|
|
204
|
+
"command": "npx pxpipe-proxy",
|
|
205
|
+
"status": "running",
|
|
206
|
+
"pid": 36212,
|
|
207
|
+
"uptime": "1h 42m",
|
|
208
|
+
"url": "http://localhost:47821",
|
|
209
|
+
"description": "AI LLM / MCP reverse proxy bridge (pxpipe-proxy)",
|
|
210
|
+
"logPath": "C:\Users\user\.aih\logs\pxpipe.log",
|
|
211
|
+
"logSize": 48392
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"id": "ocx",
|
|
215
|
+
"name": "ocx",
|
|
216
|
+
"command": "ocx start",
|
|
217
|
+
"status": "running",
|
|
218
|
+
"pid": 31540,
|
|
219
|
+
"uptime": "54s",
|
|
220
|
+
"url": "http://localhost:10100",
|
|
221
|
+
"description": "OpenCode Interpreter daemon service (ocx start)",
|
|
222
|
+
"logPath": "C:\Users\user\.aih\logs\ocx.log",
|
|
223
|
+
"logSize": 12480
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"id": "agentmemory",
|
|
227
|
+
"name": "agentmemory",
|
|
228
|
+
"command": "npx @agentmemory/agentmemory",
|
|
229
|
+
"status": "running",
|
|
230
|
+
"pid": 44600,
|
|
231
|
+
"uptime": "1h 32m",
|
|
232
|
+
"url": "http://localhost:3113",
|
|
233
|
+
"description": "Long-term persistent agent memory service (@agentmemory/agentmemory)",
|
|
234
|
+
"logPath": "C:\Users\user\.aih\logs\agentmemory.log",
|
|
235
|
+
"logSize": 85190
|
|
236
|
+
}
|
|
237
|
+
]
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## 📁 Configuration & State
|
|
243
|
+
|
|
244
|
+
State and log files are stored in the user's home directory under `~/.aih`:
|
|
245
|
+
- **State File**: `~/.aih/state.json` (records active PIDs, start timestamps, URLs, and status).
|
|
246
|
+
- **Log Directory**: `~/.aih/logs/<service>.log` (stdout and stderr captured with startup banners).
|
|
247
|
+
|
|
248
|
+
You can override the storage directory by setting the `AIH_HOME` environment variable:
|
|
249
|
+
```bash
|
|
250
|
+
export AIH_HOME=/custom/path/.aih
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## 📚 Architecture & Documentation
|
|
256
|
+
|
|
257
|
+
- [ARCHITECTURE.md](ARCHITECTURE.md) - Deep dive into process tree management, auto-discovery engine, and TCP port mapping.
|
|
258
|
+
- [CONTRIBUTING.md](CONTRIBUTING.md) - Guidelines for development, local testing, and pull requests.
|
|
259
|
+
- [CHANGELOG.md](CHANGELOG.md) - Version release history and updates.
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## 🛠️ Development & Testing
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
# Clone the repo
|
|
267
|
+
git clone https://github.com/drakonkat/ai-helper.git
|
|
268
|
+
cd ai-helper
|
|
269
|
+
|
|
270
|
+
# Run CLI directly
|
|
271
|
+
node bin/cli.js status
|
|
272
|
+
# or with bun
|
|
273
|
+
bun dev status
|
|
274
|
+
|
|
275
|
+
# Run test suite
|
|
276
|
+
bun test
|
|
277
|
+
|
|
278
|
+
# Optional: compile standalone binary (Windows/macOS/Linux)
|
|
279
|
+
bun run build
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## 📄 License
|
|
285
|
+
|
|
286
|
+
Distributed under the **MIT License**. See [LICENSE](LICENSE) for more information.
|
|
287
|
+
|
package/bin/cli.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@drakonkat/ai-helper",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Zero-config background service manager, auto-discovery daemon & dashboard launcher for AI agent ecosystems (pxpipe, ocx, agentmemory)",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"module": "src/index.js",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"bin": {
|
|
9
|
+
"aih": "./bin/cli.js",
|
|
10
|
+
"ai-helper": "./bin/cli.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"bin",
|
|
14
|
+
"src",
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE",
|
|
17
|
+
"ARCHITECTURE.md",
|
|
18
|
+
"CHANGELOG.md"
|
|
19
|
+
],
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=18.0.0"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"start": "node ./bin/cli.js",
|
|
28
|
+
"dev": "node ./bin/cli.js",
|
|
29
|
+
"test": "bun test",
|
|
30
|
+
"build": "bun build --compile --minify --outfile dist/aih.exe src/index.js",
|
|
31
|
+
"install-bin": "bun run scripts/install-bin.js"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"cli",
|
|
35
|
+
"ai",
|
|
36
|
+
"agent",
|
|
37
|
+
"pxpipe",
|
|
38
|
+
"ocx",
|
|
39
|
+
"agentmemory",
|
|
40
|
+
"mcp",
|
|
41
|
+
"npx",
|
|
42
|
+
"service-manager",
|
|
43
|
+
"dashboard",
|
|
44
|
+
"developer-tools"
|
|
45
|
+
],
|
|
46
|
+
"author": "Mauro",
|
|
47
|
+
"license": "MIT"
|
|
48
|
+
}
|
|
49
|
+
|
package/src/config.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Pre-configured AI ecosystem services managed by aih
|
|
6
|
+
*/
|
|
7
|
+
export const SERVICES = {
|
|
8
|
+
pxpipe: {
|
|
9
|
+
id: "pxpipe",
|
|
10
|
+
name: "pxpipe",
|
|
11
|
+
command: "npx pxpipe-proxy",
|
|
12
|
+
description: "AI LLM / MCP reverse proxy bridge (pxpipe-proxy)",
|
|
13
|
+
defaultPort: 47821,
|
|
14
|
+
defaultUrl: "http://localhost:47821",
|
|
15
|
+
},
|
|
16
|
+
ocx: {
|
|
17
|
+
id: "ocx",
|
|
18
|
+
name: "ocx",
|
|
19
|
+
command: "ocx start",
|
|
20
|
+
description: "OpenCode Interpreter daemon service (ocx start)",
|
|
21
|
+
defaultPort: 10100,
|
|
22
|
+
defaultUrl: "http://localhost:10100",
|
|
23
|
+
},
|
|
24
|
+
agentmemory: {
|
|
25
|
+
id: "agentmemory",
|
|
26
|
+
name: "agentmemory",
|
|
27
|
+
command: "npx @agentmemory/agentmemory",
|
|
28
|
+
description: "Long-term persistent agent memory service (@agentmemory/agentmemory)",
|
|
29
|
+
defaultPort: 3113,
|
|
30
|
+
defaultUrl: "http://localhost:3113",
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const SERVICE_IDS = Object.keys(SERVICES);
|
|
35
|
+
|
|
36
|
+
export const APP_NAME = "ai-helper";
|
|
37
|
+
export const CLI_NAME = "aih";
|
|
38
|
+
export const VERSION = "1.0.0";
|
|
39
|
+
|