@claw-camp/openclaw-plugin 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,223 @@
1
+ # Claw Camp Agent
2
+
3
+ <div align="center">
4
+
5
+ 🦞 **龙虾营地监控 Agent**
6
+
7
+ [![Version](https://img.shields.io/badge/version-1.5.0-blue.svg)](https://github.com/PhosAQy/claw-hub)
8
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
9
+ [![OpenClaw](https://img.shields.io/badge/OpenClaw-plugin-orange.svg)](https://openclaw.ai)
10
+
11
+ **OpenClaw 插件 - 连接到 Hub 上报系统状态、会话信息和 Token 消耗**
12
+
13
+ [安装指南](#安装) • [使用方法](#使用) • [配置](#配置) • [文档](#文档)
14
+
15
+ </div>
16
+
17
+ ---
18
+
19
+ ## ✨ 功能特性
20
+
21
+ - ✅ **实时监控** - 采集系统资源(CPU、内存)、Gateway 状态
22
+ - ✅ **会话追踪** - 上报会话列表和状态
23
+ - ✅ **Token 统计** - 精确解析 .jsonl 文件,按半小时槽聚合
24
+ - ✅ **插件管理** - 上报已加载的插件列表和版本
25
+ - ✅ **远程更新** - 支持通过 Hub 远程更新 Agent
26
+ - ✅ **WebSocket 通信** - 实时双向通信,每 5 秒上报一次
27
+
28
+ ## 📦 安装
29
+
30
+ ### 快速安装(推荐)
31
+
32
+ ```bash
33
+ # One-line 安装
34
+ curl -fsSL https://raw.githubusercontent.com/PhosAQy/claw-hub/main/src/agent-plugin/install.sh | bash -s -- --remote
35
+ ```
36
+
37
+ ### 手动安装
38
+
39
+ ```bash
40
+ # 1. 创建插件目录
41
+ mkdir -p ~/.openclaw/extensions/claw-camp-agent/src
42
+
43
+ # 2. 下载文件
44
+ cd ~/.openclaw/extensions/claw-camp-agent
45
+ curl -fsSL https://raw.githubusercontent.com/PhosAQy/claw-hub/main/src/agent-plugin/openclaw.plugin.json -o openclaw.plugin.json
46
+ curl -fsSL https://raw.githubusercontent.com/PhosAQy/claw-hub/main/src/agent-plugin/package.json -o package.json
47
+ curl -fsSL https://raw.githubusercontent.com/PhosAQy/claw-hub/main/src/agent-plugin/index.ts -o index.ts
48
+ curl -fsSL https://raw.githubusercontent.com/PhosAQy/claw-hub/main/src/agent-plugin/src/agent.js -o src/agent.js
49
+
50
+ # 3. 添加到信任列表
51
+ openclaw config set plugins.allow '["claw-camp-agent"]'
52
+
53
+ # 4. 安装依赖
54
+ npm install --production
55
+ ```
56
+
57
+ ## 🚀 使用
58
+
59
+ ### 启动 Agent
60
+
61
+ ```bash
62
+ # 前台运行(调试)
63
+ cd ~/.openclaw/extensions/claw-camp-agent
64
+ node src/agent.js
65
+
66
+ # 后台运行(生产)
67
+ nohup node src/agent.js > /tmp/agent.log 2>&1 &
68
+
69
+ # 查看日志
70
+ tail -f /tmp/agent.log
71
+ ```
72
+
73
+ ### 停止 Agent
74
+
75
+ ```bash
76
+ pkill -f "node.*agent.js"
77
+ ```
78
+
79
+ ## ⚙️ 配置
80
+
81
+ 编辑 `~/.openclaw/extensions/claw-camp-agent/openclaw.plugin.json`:
82
+
83
+ ```json
84
+ {
85
+ "hubUrl": "ws://server.aigc.sx.cn:8889",
86
+ "agentId": "my-agent",
87
+ "agentName": "我的 Agent",
88
+ "reportInterval": 5000,
89
+ "updateToken": ""
90
+ }
91
+ ```
92
+
93
+ **配置说明**:
94
+
95
+ | 字段 | 类型 | 默认值 | 说明 |
96
+ |------|------|--------|------|
97
+ | `hubUrl` | string | `ws://server.aigc.sx.cn:8889` | Hub WebSocket 地址 |
98
+ | `agentId` | string | `main` | Agent 唯一标识 |
99
+ | `agentName` | string | `大龙虾` | Agent 显示名称 |
100
+ | `reportInterval` | number | `5000` | 上报间隔(毫秒) |
101
+ | `updateToken` | string | `""` | 远程更新令牌(可选) |
102
+
103
+ ## 🎯 提供的工具
104
+
105
+ 插件提供 4 个工具:
106
+
107
+ | 工具名称 | 功能 |
108
+ |---------|------|
109
+ | `start_claw_camp_agent` | 启动 Agent |
110
+ | `check_claw_camp_agent` | 查看 Agent 状态 |
111
+ | `stop_claw_camp_agent` | 停止 Agent |
112
+ | `check_claw_camp_hub` | 查看 Hub 状态 |
113
+
114
+ ## ✅ 验证安装
115
+
116
+ ```bash
117
+ # 1. 检查插件是否加载
118
+ openclaw plugins list | grep -i "claw camp"
119
+
120
+ # 2. 检查 Agent 是否运行
121
+ pgrep -f "node.*agent.js"
122
+
123
+ # 3. 访问监控面板
124
+ open https://camp.aigc.sx.cn
125
+ ```
126
+
127
+ ## 📊 监控面板
128
+
129
+ 访问 **https://camp.aigc.sx.cn** 查看你的 Agent 状态:
130
+
131
+ - 📈 **实时数据** - CPU、内存、会话数、Token 消耗
132
+ - 📊 **Token 柱状图** - 最近 6 小时的 Token 消耗(半小时粒度)
133
+ - 🧩 **插件列表** - 已加载的插件名称和版本
134
+ - 🔄 **远程更新** - 点击按钮即可更新 Agent
135
+
136
+ ## 🔄 更新
137
+
138
+ ```bash
139
+ # 停止 Agent
140
+ pkill -f "node.*agent.js"
141
+
142
+ # 更新代码
143
+ cd ~/.openclaw/extensions/claw-camp-agent
144
+ curl -fsSL https://raw.githubusercontent.com/PhosAQy/claw-hub/main/src/agent-plugin/src/agent.js -o src/agent.js
145
+
146
+ # 重启 Agent
147
+ nohup node src/agent.js > /tmp/agent.log 2>&1 &
148
+ ```
149
+
150
+ ## 🗑️ 卸载
151
+
152
+ ```bash
153
+ cd ~/.openclaw/extensions/claw-camp-agent
154
+ ./uninstall.sh
155
+ ```
156
+
157
+ ## 🐛 故障排查
158
+
159
+ <details>
160
+ <summary>点击展开</summary>
161
+
162
+ ### 插件未出现在列表中
163
+
164
+ ```bash
165
+ openclaw config set plugins.allow '["claw-camp-agent"]'
166
+ ```
167
+
168
+ ### Agent 无法连接到 Hub
169
+
170
+ ```bash
171
+ # 检查 Hub 状态
172
+ curl -s https://camp.aigc.sx.cn/api/version
173
+
174
+ # 查看日志
175
+ tail -f /tmp/agent.log
176
+ ```
177
+
178
+ ### Agent 启动后立即退出
179
+
180
+ ```bash
181
+ # 前台运行查看错误
182
+ cd ~/.openclaw/extensions/claw-camp-agent
183
+ node src/agent.js
184
+ ```
185
+
186
+ </details>
187
+
188
+ ## 📚 文档
189
+
190
+ - **安装指南**: [INSTALL_GUIDE.md](INSTALL_GUIDE.md)
191
+ - **完整文档**: [README.md](README.md)
192
+ - **GitHub**: https://github.com/PhosAQy/claw-hub
193
+ - **问题反馈**: https://github.com/PhosAQy/claw-hub/issues
194
+
195
+ ## 🤝 贡献
196
+
197
+ 欢迎贡献代码!
198
+
199
+ 1. Fork 本仓库
200
+ 2. 创建特性分支 (`git checkout -b feature/AmazingFeature`)
201
+ 3. 提交更改 (`git commit -m 'Add some AmazingFeature'`)
202
+ 4. 推送到分支 (`git push origin feature/AmazingFeature`)
203
+ 5. 开启 Pull Request
204
+
205
+ ## 📄 许可证
206
+
207
+ 本项目采用 MIT 许可证 - 详见 [LICENSE](LICENSE) 文件
208
+
209
+ ## 👤 作者
210
+
211
+ **Phosa**
212
+
213
+ - GitHub: [@PhosAQy](https://github.com/PhosAQy)
214
+
215
+ ---
216
+
217
+ <div align="center">
218
+
219
+ **[⬆ 返回顶部](#claw-camp-agent)**
220
+
221
+ Made with ❤️ by Phosa
222
+
223
+ </div>