- hooks/status-watcher-hook/HOOK.md — events: ["gateway:startup"], required env vars - hooks/status-watcher-hook/handler.js — checks PID file, spawns watcher-manager.js detached - Deployed hook to /home/node/.openclaw/workspace/hooks/status-watcher-hook/ - make check passes
54 lines
1.3 KiB
Markdown
54 lines
1.3 KiB
Markdown
# status-watcher-hook
|
|
|
|
Auto-starts the Live Status v4 daemon when the OpenClaw gateway starts.
|
|
|
|
## Events
|
|
|
|
```json
|
|
["gateway:startup"]
|
|
```
|
|
|
|
## Description
|
|
|
|
On gateway startup, this hook checks whether the status-watcher daemon is already
|
|
running (via PID file). If not, it spawns `watcher-manager.js start` as a detached
|
|
background process, then exits immediately. The daemon continues running independently
|
|
of this hook handler.
|
|
|
|
## Required Environment Variables
|
|
|
|
The following environment variables must be set for the watcher to function:
|
|
|
|
```
|
|
MM_TOKEN Mattermost bot token
|
|
MM_URL Mattermost base URL (e.g. https://slack.solio.tech)
|
|
TRANSCRIPT_DIR Path to agent sessions directory
|
|
SESSIONS_JSON Path to sessions.json
|
|
```
|
|
|
|
Optional (defaults shown):
|
|
|
|
```
|
|
THROTTLE_MS 500
|
|
IDLE_TIMEOUT_S 60
|
|
MAX_STATUS_LINES 15
|
|
MAX_ACTIVE_SESSIONS 20
|
|
MAX_MESSAGE_CHARS 15000
|
|
HEALTH_PORT 9090
|
|
LOG_LEVEL info
|
|
PID_FILE /tmp/status-watcher.pid
|
|
CIRCUIT_BREAKER_THRESHOLD 5
|
|
CIRCUIT_BREAKER_COOLDOWN_S 30
|
|
```
|
|
|
|
## Installation
|
|
|
|
This hook is deployed automatically by `install.sh` or `deploy-to-agents.sh`.
|
|
To deploy manually:
|
|
|
|
```sh
|
|
cp -r hooks/status-watcher-hook /home/node/.openclaw/workspace/hooks/
|
|
```
|
|
|
|
The hook activates on the next gateway startup.
|