process-watchdog
v1.2.0
Published
Modular PC health agent for the aidev.com.au ecosystem
Readme
Process Watchdog
Modular PC health agent for the aidev.com.au ecosystem.
Features
- 5 built-in plugins:
process-guard,memory-monitor,disk-health,startup-optimizer,cpu-monitor - REST API on port 3400 (
/api/v1) watchdogCLI tool- Windows service support via
node-windows - aidev.com.au dashboard integration (totalRecall, mah)
Quick Start
npm install -g process-watchdog
watchdog status # one-shot health check
watchdog start # run continuously with schedulerCLI Commands
| Command | Description |
|----------------------------|----------------------------------------------------|
| watchdog start | Load config, start scheduler, watch continuously |
| watchdog stop | Stop the running watchdog process |
| watchdog status | Run check() on each plugin and print a summary |
| watchdog check [plugin] | Detailed metrics for all or a specific plugin |
| watchdog fix [plugin] | Run fix() for all or a specific plugin |
| watchdog api start | Start the HTTP REST API server |
| watchdog install-service | Install watchdog as a Windows system service |
| watchdog uninstall-service | Uninstall the Windows system service |
Plugins
| Plugin | Description | Default Interval | Auto-Fix |
|---------------------|----------------------------------------------|-----------------|----------|
| process-guard | Kills runaway node/cmd/bash processes | 5 min | Yes |
| memory-monitor | Alerts on high RAM usage | 2 min | No |
| disk-health | Checks disk usage and cleans temp files | 30 min | Yes |
| startup-optimizer | Audits startup programs | On demand | No |
| cpu-monitor | Alerts on sustained high CPU usage | 2 min | No |
API Endpoints
All routes are prefixed with /api/v1.
| Method | Endpoint | Description |
|--------|------------------------|------------------------------------------------------|
| GET | /health | Overall service health and per-plugin status |
| GET | /plugins | List all plugins with config and last check time |
| GET | /plugins/:name | Plugin details and last 50 history entries |
| POST | /plugins/:name/run | Run check or fix on a plugin ({ action } body) |
| GET | /history | Check/fix history (query: plugin, limit) |
| GET | /config | Current active configuration |
Configuration
Default config — config/default.json in the package.
User override — ~/.aidev/watchdog.json (merged over defaults at startup).
Key options:
{
"port": 3400,
"logLevel": "info",
"historyRetentionDays": 30,
"plugins": {
"process-guard": { "enabled": true, "interval": 300000, "autoFix": true },
"memory-monitor": { "enabled": true, "interval": 120000, "autoFix": false }
// ...
}
}History and the SQLite database are stored at ~/.aidev/watchdog.db.
Dashboard
Open dashboard/watchdog.html in a browser while the API server is running to view a live health overview compatible with aidev.com.au.
Development
npm run build # compile TypeScript → dist/
npm test # run tests with vitest
npm run dev # run from source with tsx (no build step)License
MIT
