Phase 2 (Session Monitor + Lifecycle): - src/session-monitor.js: polls sessions.json every 2s for new/ended sessions - Detects agents via transcriptDir subdirectory scan - Resolves channelId/rootPostId from session key format - Emits session-added/session-removed events - Handles multi-agent environments - Falls back to defaultChannel for non-MM sessions - src/watcher-manager.js: top-level orchestrator - Starts session-monitor, status-watcher, health-server - Creates/updates Mattermost status posts on session events - Sub-agent linking: children embedded in parent status - Offset persistence (save/restore lastOffset on restart) - Post recovery on restart (search channel history for marker) - SIGTERM/SIGINT graceful shutdown: mark all boxes interrupted - CLI: node watcher-manager.js start|stop|status - MAX_ACTIVE_SESSIONS enforcement Integration tests: - test/integration/session-monitor.test.js: 14 tests - Session detection, removal, multi-agent, malformed JSON handling - test/integration/status-watcher.test.js: 13 tests - JSONL parsing, tool_call/result pairs, idle detection, offset recovery All 86 tests pass (59 unit + 27 integration). make check clean.
23 lines
632 B
JSON
23 lines
632 B
JSON
{
|
|
"name": "mattermost-openclaw-livestatus",
|
|
"version": "4.0.0",
|
|
"private": true,
|
|
"description": "OpenClaw Live Status Tool for Mattermost",
|
|
"main": "src/watcher-manager.js",
|
|
"scripts": {
|
|
"start": "node src/watcher-manager.js start",
|
|
"stop": "node src/watcher-manager.js stop",
|
|
"status": "node src/watcher-manager.js status",
|
|
"test": "node --test test/unit/*.test.js",
|
|
"test-integration": "node --test test/integration/*.test.js"
|
|
},
|
|
"dependencies": {
|
|
"pino": "^9.14.0"
|
|
},
|
|
"devDependencies": {
|
|
"eslint": "^8.57.1",
|
|
"eslint-plugin-security": "^2.1.1",
|
|
"prettier": "^3.2.0"
|
|
}
|
|
}
|