feat: Phase 0+1 — repo sync, pino, lint fixes, core components

Phase 0:
- Synced latest live-status.js from workspace (9928 bytes)
- Fixed 43 lint issues: empty catch blocks, console statements
- Added pino dependency
- Created src/tool-labels.json with all known tool mappings
- make check passes

Phase 1 (Core Components):
- src/config.js: env-var config with validation, throws on missing required vars
- src/logger.js: pino singleton with child loggers, level validation
- src/circuit-breaker.js: CLOSED/OPEN/HALF_OPEN state machine with callbacks
- src/tool-labels.js: exact/prefix/regex tool->label resolver with external override
- src/status-box.js: Mattermost post manager (keepAlive, throttle, retry, circuit breaker)
- src/status-formatter.js: pure SessionState->text formatter (nested, compact)
- src/health.js: HTTP health endpoint + metrics
- src/status-watcher.js: JSONL file watcher (inotify, compaction detection, idle detection)

Tests:
- test/unit/config.test.js: 7 tests
- test/unit/circuit-breaker.test.js: 12 tests
- test/unit/logger.test.js: 5 tests
- test/unit/status-formatter.test.js: 20 tests
- test/unit/tool-labels.test.js: 15 tests

All 59 unit tests pass. make check clean.
This commit is contained in:
sol
2026-03-07 17:26:53 +00:00
parent b3ec2c61db
commit 43cfebee96
21 changed files with 2691 additions and 287 deletions

41
src/tool-labels.json Normal file
View File

@@ -0,0 +1,41 @@
{
"_comment": "Tool name to human-readable label mapping. Supports exact match, prefix match (end with *), and regex (start with /).",
"exact": {
"Read": "Reading file...",
"Write": "Writing file...",
"Edit": "Editing file...",
"exec": "Running command...",
"process": "Managing process...",
"web_search": "Searching the web...",
"web_fetch": "Fetching URL...",
"browser": "Controlling browser...",
"canvas": "Drawing canvas...",
"nodes": "Querying nodes...",
"message": "Sending message...",
"tts": "Generating speech...",
"subagents": "Managing sub-agents...",
"image": "Analyzing image...",
"camofox_create_tab": "Opening browser tab...",
"camofox_close_tab": "Closing browser tab...",
"camofox_navigate": "Navigating browser...",
"camofox_click": "Clicking element...",
"camofox_type": "Typing in browser...",
"camofox_scroll": "Scrolling page...",
"camofox_screenshot": "Taking screenshot...",
"camofox_snapshot": "Capturing page snapshot...",
"camofox_list_tabs": "Listing browser tabs...",
"camofox_import_cookies": "Importing cookies...",
"claude_code_start": "Starting Claude Code task...",
"claude_code_status": "Checking Claude Code status...",
"claude_code_output": "Reading Claude Code output...",
"claude_code_cancel": "Cancelling Claude Code task...",
"claude_code_cleanup": "Cleaning up Claude Code sessions...",
"claude_code_sessions": "Listing Claude Code sessions..."
},
"prefix": {
"camofox_": "Using browser...",
"claude_code_": "Running Claude Code...",
"nodes_": "Querying nodes..."
},
"default": "Working..."
}