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.
28 lines
460 B
Makefile
28 lines
460 B
Makefile
export NODE_ENV := development
|
|
export NODE_PATH := /usr/local/lib/node_modules
|
|
|
|
.PHONY: check install test test-integration lint fmt fmt-check secret-scan
|
|
|
|
check: install lint fmt-check secret-scan test test-integration
|
|
|
|
install:
|
|
npm install
|
|
|
|
test:
|
|
node --test test/unit/*.test.js
|
|
|
|
test-integration:
|
|
node --test test/integration/*.test.js
|
|
|
|
lint:
|
|
eslint .
|
|
|
|
fmt:
|
|
prettier --write .
|
|
|
|
fmt-check:
|
|
prettier --check .
|
|
|
|
secret-scan:
|
|
bash tools/secret-scan.sh .
|