@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,315 @@
1
+ # Claw Camp Agent - 安装指南
2
+
3
+ ## 📦 插件信息
4
+
5
+ - **插件名称**: Claw Camp Agent
6
+ - **插件 ID**: `claw-camp-agent`
7
+ - **版本**: v1.5.0
8
+ - **描述**: 龙虾营地监控 Agent - 连接到 Hub 上报系统状态、会话信息和 Token 消耗
9
+ - **GitHub**: https://github.com/PhosAQy/claw-hub
10
+
11
+ ## 📋 前置要求
12
+
13
+ - ✅ OpenClaw 已安装(v0.4.0+)
14
+ - ✅ Node.js 18+
15
+ - ✅ 网络连接(访问 Hub)
16
+
17
+ ## 🚀 安装方法
18
+
19
+ ### 方法一:从 GitHub 安装(推荐)
20
+
21
+ ```bash
22
+ # 1. 下载插件
23
+ cd ~/.openclaw/extensions
24
+ git clone https://github.com/PhosAQy/claw-hub.git claw-camp-agent-temp
25
+ cd claw-camp-agent-temp/src/agent-plugin
26
+
27
+ # 2. 运行安装脚本
28
+ ./install.sh --remote
29
+
30
+ # 3. 清理临时文件
31
+ cd ..
32
+ rm -rf claw-camp-agent-temp
33
+ ```
34
+
35
+ ### 方法二:从本地安装
36
+
37
+ ```bash
38
+ # 1. 下载插件压缩包
39
+ # 从 https://github.com/PhosAQy/claw-hub/releases 下载 claw-camp-agent-1.5.0.tar.gz
40
+
41
+ # 2. 解压到插件目录
42
+ mkdir -p ~/.openclaw/extensions/claw-camp-agent
43
+ tar -xzf claw-camp-agent-1.5.0.tar.gz -C ~/.openclaw/extensions/claw-camp-agent
44
+
45
+ # 3. 运行安装脚本
46
+ cd ~/.openclaw/extensions/claw-camp-agent
47
+ ./install.sh
48
+ ```
49
+
50
+ ### 方法三:手动安装
51
+
52
+ ```bash
53
+ # 1. 创建插件目录
54
+ mkdir -p ~/.openclaw/extensions/claw-camp-agent/src
55
+
56
+ # 2. 下载文件(从 GitHub)
57
+ cd ~/.openclaw/extensions/claw-camp-agent
58
+ curl -fsSL https://raw.githubusercontent.com/PhosAQy/claw-hub/main/src/agent-plugin/openclaw.plugin.json -o openclaw.plugin.json
59
+ curl -fsSL https://raw.githubusercontent.com/PhosAQy/claw-hub/main/src/agent-plugin/package.json -o package.json
60
+ curl -fsSL https://raw.githubusercontent.com/PhosAQy/claw-hub/main/src/agent-plugin/index.ts -o index.ts
61
+ curl -fsSL https://raw.githubusercontent.com/PhosAQy/claw-hub/main/src/agent-plugin/README.md -o README.md
62
+ curl -fsSL https://raw.githubusercontent.com/PhosAQy/claw-hub/main/src/agent-plugin/src/agent.js -o src/agent.js
63
+ curl -fsSL https://raw.githubusercontent.com/PhosAQy/claw-hub/main/src/agent-plugin/install.sh -o install.sh
64
+ curl -fsSL https://raw.githubusercontent.com/PhosAQy/claw-hub/main/src/agent-plugin/uninstall.sh -o uninstall.sh
65
+
66
+ # 3. 添加执行权限
67
+ chmod +x install.sh uninstall.sh
68
+
69
+ # 4. 添加到信任列表
70
+ openclaw config set plugins.allow '["claw-camp-agent"]'
71
+
72
+ # 5. 安装依赖
73
+ npm install --production
74
+ ```
75
+
76
+ ## ⚙️ 配置
77
+
78
+ ### 1. 基本配置
79
+
80
+ 编辑 `~/.openclaw/extensions/claw-camp-agent/openclaw.plugin.json`:
81
+
82
+ ```json
83
+ {
84
+ "hubUrl": "ws://server.aigc.sx.cn:8889", // Hub WebSocket 地址
85
+ "agentId": "my-agent", // Agent 唯一标识(修改这里)
86
+ "agentName": "我的 Agent", // Agent 显示名称(修改这里)
87
+ "reportInterval": 5000, // 上报间隔(毫秒)
88
+ "updateToken": "" // 远程更新令牌(可选)
89
+ }
90
+ ```
91
+
92
+ ### 2. 环境变量配置(可选)
93
+
94
+ 也可以通过环境变量配置:
95
+
96
+ ```bash
97
+ export CLAW_HUB_URL="ws://server.aigc.sx.cn:8889"
98
+ export CLAW_AGENT_ID="my-agent"
99
+ export CLAW_AGENT_NAME="我的 Agent"
100
+ export CLAW_UPDATE_TOKEN="your-token"
101
+ ```
102
+
103
+ ## 🎯 使用方法
104
+
105
+ ### 1. 启动 Agent
106
+
107
+ ```bash
108
+ # 前台运行(调试用)
109
+ cd ~/.openclaw/extensions/claw-camp-agent
110
+ node src/agent.js
111
+
112
+ # 后台运行(生产环境)
113
+ nohup node src/agent.js > /tmp/agent.log 2>&1 &
114
+
115
+ # 查看日志
116
+ tail -f /tmp/agent.log
117
+ ```
118
+
119
+ ### 2. 停止 Agent
120
+
121
+ ```bash
122
+ pkill -f "node.*agent.js"
123
+ ```
124
+
125
+ ### 3. 重启 Agent
126
+
127
+ ```bash
128
+ pkill -f "node.*agent.js"
129
+ sleep 2
130
+ cd ~/.openclaw/extensions/claw-camp-agent
131
+ nohup node src/agent.js > /tmp/agent.log 2>&1 &
132
+ ```
133
+
134
+ ## ✅ 验证安装
135
+
136
+ ### 1. 检查插件是否加载
137
+
138
+ ```bash
139
+ openclaw plugins list | grep -i "claw camp"
140
+ ```
141
+
142
+ **预期输出**:
143
+ ```
144
+ │ Claw Camp │ claw-camp-agent │ loaded │ global:claw-camp-agent/index.ts │ 1.5.0 │
145
+ ```
146
+
147
+ ### 2. 检查 Agent 是否运行
148
+
149
+ ```bash
150
+ pgrep -f "node.*agent.js"
151
+ ```
152
+
153
+ **预期输出**:
154
+ ```
155
+ 12345 # Agent 进程 ID
156
+ ```
157
+
158
+ ### 3. 查看日志
159
+
160
+ ```bash
161
+ tail -20 /tmp/agent.log
162
+ ```
163
+
164
+ **预期输出**:
165
+ ```
166
+ 🦞 龙虾营地 Agent v1.5.0
167
+ Agent: 我的 Agent (my-agent)
168
+ Hub: ws://server.aigc.sx.cn:8889
169
+
170
+ [Agent] 连接 Hub: ws://server.aigc.sx.cn:8889
171
+ [Agent] 已连接到 Hub
172
+ [Agent] 注册成功: my-agent
173
+ ```
174
+
175
+ ### 4. 访问监控面板
176
+
177
+ 打开浏览器访问:https://camp.aigc.sx.cn
178
+
179
+ 应该能看到你的 Agent 出现在列表中。
180
+
181
+ ## 🔧 提供的工具
182
+
183
+ 插件安装后,提供以下工具(可在 OpenClaw 中使用):
184
+
185
+ ### 1. `start_claw_camp_agent`
186
+ 启动 Agent(返回启动命令)
187
+
188
+ ### 2. `check_claw_camp_agent`
189
+ 查看 Agent 运行状态
190
+
191
+ ### 3. `stop_claw_camp_agent`
192
+ 停止 Agent
193
+
194
+ ### 4. `check_claw_camp_hub`
195
+ 查看 Hub 状态
196
+
197
+ ## 🔄 更新插件
198
+
199
+ ```bash
200
+ # 1. 停止 Agent
201
+ pkill -f "node.*agent.js"
202
+
203
+ # 2. 更新代码
204
+ cd ~/.openclaw/extensions/claw-camp-agent
205
+ git pull # 如果是从 git 安装的
206
+
207
+ # 或者重新下载最新版本
208
+ # curl -fsSL https://raw.githubusercontent.com/PhosAQy/claw-hub/main/src/agent-plugin/src/agent.js -o src/agent.js
209
+
210
+ # 3. 重启 Agent
211
+ nohup node src/agent.js > /tmp/agent.log 2>&1 &
212
+ ```
213
+
214
+ ## 🗑️ 卸载
215
+
216
+ ### 方法一:使用卸载脚本
217
+
218
+ ```bash
219
+ cd ~/.openclaw/extensions/claw-camp-agent
220
+ ./uninstall.sh
221
+ ```
222
+
223
+ ### 方法二:手动卸载
224
+
225
+ ```bash
226
+ # 1. 停止 Agent
227
+ pkill -f "node.*agent.js"
228
+
229
+ # 2. 从信任列表移除
230
+ openclaw config set plugins.allow '[]'
231
+
232
+ # 3. 删除插件目录
233
+ rm -rf ~/.openclaw/extensions/claw-camp-agent
234
+ ```
235
+
236
+ ## 🐛 故障排查
237
+
238
+ ### 问题 1: 插件未出现在列表中
239
+
240
+ **解决方案**:
241
+ ```bash
242
+ # 检查信任列表
243
+ openclaw config get plugins.allow
244
+
245
+ # 添加到信任列表
246
+ openclaw config set plugins.allow '["claw-camp-agent"]'
247
+
248
+ # 重启 OpenClaw
249
+ ```
250
+
251
+ ### 问题 2: Agent 无法连接到 Hub
252
+
253
+ **解决方案**:
254
+ ```bash
255
+ # 检查 Hub 是否运行
256
+ curl -s https://camp.aigc.sx.cn/api/version
257
+
258
+ # 检查网络连接
259
+ ping server.aigc.sx.cn
260
+
261
+ # 查看日志
262
+ tail -f /tmp/agent.log
263
+ ```
264
+
265
+ ### 问题 3: Agent 启动后立即退出
266
+
267
+ **解决方案**:
268
+ ```bash
269
+ # 前台运行查看错误
270
+ cd ~/.openclaw/extensions/claw-camp-agent
271
+ node src/agent.js
272
+
273
+ # 检查依赖是否安装
274
+ npm install
275
+ ```
276
+
277
+ ## 📊 监控数据
278
+
279
+ Agent 会每 5 秒上报以下数据:
280
+
281
+ - **系统状态**: CPU 使用率、内存使用率
282
+ - **Gateway 状态**: 运行状态
283
+ - **会话列表**: 会话数量、会话详情(最多 50 个)
284
+ - **Token 消耗**: 从 .jsonl 文件解析的精确数据(按半小时槽聚合)
285
+ - **插件列表**: 已加载的插件名称和版本
286
+
287
+ ## 🌐 架构
288
+
289
+ ```
290
+ 本地机器 (你的电脑)
291
+ └─ agent.js v1.5.0
292
+ ↓ WebSocket (每 5 秒)
293
+ 线上服务器 (119.91.123.2)
294
+ └─ hub.js v1.5.0
295
+
296
+ Dashboard UI (https://camp.aigc.sx.cn)
297
+ ```
298
+
299
+ ## 📚 相关链接
300
+
301
+ - **GitHub**: https://github.com/PhosAQy/claw-hub
302
+ - **监控面板**: https://camp.aigc.sx.cn
303
+ - **问题反馈**: https://github.com/PhosAQy/claw-hub/issues
304
+
305
+ ## 📄 许可证
306
+
307
+ MIT
308
+
309
+ ## 👤 作者
310
+
311
+ Phosa
312
+
313
+ ---
314
+
315
+ **需要帮助?** 在 GitHub Issues 中提问:https://github.com/PhosAQy/claw-hub/issues
package/Makefile ADDED
@@ -0,0 +1,91 @@
1
+ # Claw Camp Agent - Makefile
2
+
3
+ PLUGIN_DIR := $(HOME)/.openclaw/extensions/claw-camp-agent
4
+ AGENT_LOG := /tmp/agent.log
5
+
6
+ .PHONY: install uninstall start stop restart status logs clean
7
+
8
+ # 安装插件
9
+ install:
10
+ @echo "📦 安装 Claw Camp Agent..."
11
+ @./install.sh
12
+
13
+ # 卸载插件
14
+ uninstall:
15
+ @echo "🗑️ 卸载 Claw Camp Agent..."
16
+ @./uninstall.sh
17
+
18
+ # 启动 Agent(前台)
19
+ start:
20
+ @echo "🚀 启动 Agent(前台模式)..."
21
+ @cd $(PLUGIN_DIR) && node src/agent.js
22
+
23
+ # 启动 Agent(后台)
24
+ start-daemon:
25
+ @echo "🚀 启动 Agent(后台模式)..."
26
+ @cd $(PLUGIN_DIR) && nohup node src/agent.js > $(AGENT_LOG) 2>&1 &
27
+ @sleep 2
28
+ @pgrep -f "node.*agent.js" > /dev/null && echo "✅ Agent 已启动" || echo "❌ Agent 启动失败"
29
+
30
+ # 停止 Agent
31
+ stop:
32
+ @echo "🛑 停止 Agent..."
33
+ @pkill -f "node.*agent.js" 2>/dev/null || true
34
+ @sleep 1
35
+ @pgrep -f "node.*agent.js" > /dev/null && echo "❌ Agent 仍在运行" || echo "✅ Agent 已停止"
36
+
37
+ # 重启 Agent
38
+ restart: stop start-daemon
39
+ @echo "🔄 Agent 已重启"
40
+
41
+ # 查看 Agent 状态
42
+ status:
43
+ @echo "📊 Agent 状态:"
44
+ @pgrep -f "node.*agent.js" > /dev/null && echo " ✅ 运行中 (PID: $$(pgrep -f 'node.*agent.js'))" || echo " ❌ 未运行"
45
+
46
+ # 查看日志
47
+ logs:
48
+ @echo "📜 Agent 日志 (最后 50 行):"
49
+ @tail -50 $(AGENT_LOG)
50
+
51
+ # 实时查看日志
52
+ logs-follow:
53
+ @echo "📜 实时日志:"
54
+ @tail -f $(AGENT_LOG)
55
+
56
+ # 清理日志
57
+ clean:
58
+ @echo "🧹 清理日志..."
59
+ @rm -f $(AGENT_LOG)
60
+ @echo "✅ 日志已清理"
61
+
62
+ # 检查插件
63
+ check:
64
+ @echo "🔍 检查插件状态..."
65
+ @openclaw plugins list 2>&1 | grep -i "claw camp" || echo "❌ 插件未加载"
66
+
67
+ # 更新插件
68
+ update:
69
+ @echo "🔄 更新插件..."
70
+ @cd $(PLUGIN_DIR)
71
+ @curl -fsSL https://raw.githubusercontent.com/PhosAQy/claw-hub/main/src/agent-plugin/src/agent.js -o src/agent.js
72
+ @echo "✅ 插件已更新"
73
+
74
+ # 帮助
75
+ help:
76
+ @echo "Claw Camp Agent - Makefile"
77
+ @echo ""
78
+ @echo "使用方法:"
79
+ @echo " make install - 安装插件"
80
+ @echo " make uninstall - 卸载插件"
81
+ @echo " make start - 启动 Agent(前台)"
82
+ @echo " make start-daemon - 启动 Agent(后台)"
83
+ @echo " make stop - 停止 Agent"
84
+ @echo " make restart - 重启 Agent"
85
+ @echo " make status - 查看 Agent 状态"
86
+ @echo " make logs - 查看日志(最后 50 行)"
87
+ @echo " make logs-follow - 实时查看日志"
88
+ @echo " make clean - 清理日志"
89
+ @echo " make check - 检查插件状态"
90
+ @echo " make update - 更新插件"
91
+ @echo " make help - 显示帮助信息"
package/QUICKSTART.md ADDED
@@ -0,0 +1,67 @@
1
+ # Claw Camp Agent - 快速开始
2
+
3
+ ## 🚀 一键安装
4
+
5
+ ```bash
6
+ curl -fsSL https://raw.githubusercontent.com/PhosAQy/claw-hub/main/src/agent-plugin/quick-install.sh | bash
7
+ ```
8
+
9
+ ## 📋 前置要求
10
+
11
+ - OpenClaw v0.4.0+
12
+ - Node.js 18+
13
+ - 网络连接
14
+
15
+ ## ⚙️ 配置
16
+
17
+ 安装后,编辑 `~/.openclaw/extensions/claw-camp-agent/openclaw.plugin.json`:
18
+
19
+ ```json
20
+ {
21
+ "agentId": "my-agent", // 修改为你的唯一标识
22
+ "agentName": "我的 Agent" // 修改为你的显示名称
23
+ }
24
+ ```
25
+
26
+ ## 🎯 启动
27
+
28
+ ```bash
29
+ # 后台运行
30
+ cd ~/.openclaw/extensions/claw-camp-agent
31
+ nohup node src/agent.js > /tmp/agent.log 2>&1 &
32
+
33
+ # 查看日志
34
+ tail -f /tmp/agent.log
35
+ ```
36
+
37
+ ## 📊 监控面板
38
+
39
+ 访问: https://camp.aigc.sx.cn
40
+
41
+ ## 📚 完整文档
42
+
43
+ - [安装指南](INSTALL_GUIDE.md)
44
+ - [使用文档](README.md)
45
+ - [GitHub](https://github.com/PhosAQy/claw-hub)
46
+
47
+ ## 🔧 使用 Makefile
48
+
49
+ ```bash
50
+ make install # 安装插件
51
+ make start-daemon # 启动 Agent(后台)
52
+ make logs-follow # 查看日志
53
+ make status # 查看状态
54
+ make stop # 停止 Agent
55
+ ```
56
+
57
+ ## 🗑️ 卸载
58
+
59
+ ```bash
60
+ cd ~/.openclaw/extensions/claw-camp-agent
61
+ ./uninstall.sh
62
+ ```
63
+
64
+ ## ❓ 需要帮助?
65
+
66
+ - GitHub Issues: https://github.com/PhosAQy/claw-hub/issues
67
+ - 文档: https://github.com/PhosAQy/claw-hub#readme
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # 🦞 Claw Camp - OpenClaw Plugin
2
+
3
+ 实时监控你的 OpenClaw Agent 状态、Token 消耗、Gateway 健康度。
4
+
5
+ Dashboard:[camp.aigc.sx.cn](https://camp.aigc.sx.cn)
6
+
7
+ ---
8
+
9
+ ## 安装
10
+
11
+ ```bash
12
+ openclaw plugins install openclaw-plugin-claw-camp
13
+ ```
14
+
15
+ 安装完成后重启 Gateway:
16
+
17
+ ```bash
18
+ openclaw gateway restart
19
+ ```
20
+
21
+ ---
22
+
23
+ ## 配置
24
+
25
+ 安装后在 OpenClaw 配置文件中添加:
26
+
27
+ ```json
28
+ {
29
+ "channels": {
30
+ "claw-camp": {
31
+ "enabled": true,
32
+ "accounts": {
33
+ "default": {
34
+ "botId": "your-bot-id",
35
+ "botToken": "your-bot-token"
36
+ }
37
+ }
38
+ }
39
+ },
40
+ "plugins": {
41
+ "allow": ["claw-camp"]
42
+ }
43
+ }
44
+ ```
45
+
46
+ > `botId` 和 `botToken` 从 [camp.aigc.sx.cn](https://camp.aigc.sx.cn) 注册获取。
47
+
48
+ ---
49
+
50
+ ## 验证
51
+
52
+ ```bash
53
+ openclaw plugins list | grep claw-camp
54
+ ```
55
+
56
+ 看到 `loaded` 状态即成功。访问 [camp.aigc.sx.cn](https://camp.aigc.sx.cn) 查看你的 Agent 上线。
57
+
58
+ ---
59
+
60
+ ## 监控内容
61
+
62
+ - Gateway 运行状态
63
+ - 会话列表 & Token 消耗
64
+ - 系统资源(CPU / 内存)
65
+ - 已加载插件列表
66
+
67
+ ---
68
+
69
+ ## 相关项目
70
+
71
+ - [claw-camp/claw-hub](https://github.com/claw-camp/claw-hub) — Hub 服务端(自建用)
72
+
73
+ ## License
74
+
75
+ MIT