Task Monitor v0.1
Real-time monitoring dashboard for OpenClaw with web interface.
Features
- - 🌐 Web Dashboard - Beautiful, responsive UI accessible from any device
- 📱 Mobile-First - Optimized for phones and tablets
- 🔄 Auto-Refresh - Updates every 60 seconds
- 🎨 Modern Design - Gradient UI with dark theme
- 📊 Live Data - Main session, Discord, sub-agents, cron jobs
- 🚀 Fast API - JSON endpoint with intelligent caching (30s TTL)
- ⚡ Performance - <100ms response time (cached), ~15s cold cache
Installation
CODEBLOCK0
Usage
Start Web Server
CODEBLOCK1
Server will run on port 3030 (accessible on LAN).
Access URLs:
- - Local: INLINECODE0
- LAN: INLINECODE1
Stop Server
CODEBLOCK2
API Endpoint
CODEBLOCK3
Returns JSON with:
- - Main session stats
- Discord session stats
- Active sub-agents (with descriptions)
- Recent cron job history
Generate Markdown (v0.1)
Legacy markdown generator still available:
CODEBLOCK4
Updates DASHBOARD.md in workspace root.
Automation
CRON job runs every 5 minutes to update markdown dashboard:
*/5 * * * * -> Executes INLINECODE4
Architecture
- - Backend: Node.js + Express
- Frontend: Pure HTML/CSS/JS (no frameworks)
- Data Source:
openclaw sessions list --json + INLINECODE6 - Caching: In-memory cache with 30-second TTL
- Pre-warmed on server startup
- Async background refresh when expired
- Stale-while-revalidate pattern for optimal UX
- - Refresh: Client-side polling (60s interval)
Performance
Without cache:
- - API response time: ~15 seconds (blocking)
- Problem: Each request blocks Node.js event loop
With cache:
- - Cache hit: <100ms (~365x faster)
- Cache miss: ~15s (first request only)
- Stale cache: <100ms while refreshing in background
- Cache TTL: 30 seconds
The caching system ensures:
- - Lightning-fast responses for most requests
- No blocking of concurrent requests
- Graceful degradation when cache expires
Task Monitor v0.1
基于OpenClaw的实时监控仪表盘,配备Web界面。
功能特性
- - 🌐 Web仪表盘 - 精美响应式界面,支持任意设备访问
- 📱 移动优先 - 针对手机和平板优化
- 🔄 自动刷新 - 每60秒自动更新
- 🎨 现代设计 - 暗色主题渐变界面
- 📊 实时数据 - 主会话、Discord、子代理、定时任务
- 🚀 快速API - JSON接口,智能缓存(30秒TTL)
- ⚡ 高性能 - 缓存响应<100ms,冷缓存约15秒
安装
bash
cd skills/task-monitor
npm install
使用方法
启动Web服务器
bash
./scripts/start-server.sh
服务器将在端口3030运行(局域网可访问)。
访问地址:
- - 本地:http://localhost:3030
- 局域网:http://<你的IP地址>:3030
停止服务器
bash
./scripts/stop-server.sh
API接口
bash
curl http://localhost:3030/api/status
返回JSON数据,包含:
- - 主会话统计
- Discord会话统计
- 活跃子代理(含描述)
- 近期定时任务历史
生成Markdown(v0.1)
旧版Markdown生成器仍可使用:
bash
./scripts/generate-dashboard.js
更新工作区根目录下的DASHBOARD.md文件。
自动化
每5分钟执行一次定时任务更新Markdown仪表盘:
/5 * -> 执行 generate-dashboard.js
架构设计
- - 后端: Node.js + Express
- 前端: 纯HTML/CSS/JS(无框架依赖)
- 数据源: openclaw sessions list --json + openclaw cron list --json
- 缓存: 内存缓存,30秒TTL
- 服务器启动时预加载
- 过期后异步后台刷新
- 采用stale-while-revalidate模式优化用户体验
性能表现
无缓存时:
- - API响应时间:约15秒(阻塞)
- 问题:每次请求阻塞Node.js事件循环
有缓存时:
- - 缓存命中:<100ms(快约365倍)
- 缓存未命中:约15秒(仅首次请求)
- 缓存过期:<100ms(后台异步刷新)
- 缓存TTL:30秒
缓存系统确保:
- - 绝大多数请求闪电响应
- 并发请求无阻塞
- 缓存过期时优雅降级