@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.
package/install.sh ADDED
@@ -0,0 +1,78 @@
1
+ #!/bin/bash
2
+ # 龙虾营地 Agent 插件安装脚本
3
+
4
+ set -e
5
+
6
+ GREEN='\033[0;32m'
7
+ YELLOW='\033[1;33m'
8
+ RED='\033[0;31m'
9
+ NC='\033[0m'
10
+
11
+ log() { echo -e "${GREEN}[INFO]${NC} $1"; }
12
+ warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
13
+ error() { echo -e "${RED}[ERROR]${NC} $1"; exit 1; }
14
+
15
+ # 检查 OpenClaw 是否已安装
16
+ if ! command -v openclaw &> /dev/null; then
17
+ error "OpenClaw 未安装,请先安装 OpenClaw"
18
+ fi
19
+
20
+ # 创建插件目录
21
+ PLUGIN_DIR="$HOME/.openclaw/extensions/claw-camp-agent"
22
+ log "创建插件目录: $PLUGIN_DIR"
23
+ mkdir -p "$PLUGIN_DIR/src"
24
+
25
+ # 下载文件(如果是从远程安装)
26
+ if [ "$1" = "--remote" ]; then
27
+ log "从 GitHub 下载插件文件..."
28
+ BASE_URL="https://raw.githubusercontent.com/PhosAQy/claw-hub/main/src/agent-plugin"
29
+
30
+ curl -fsSL "$BASE_URL/openclaw.plugin.json" -o "$PLUGIN_DIR/openclaw.plugin.json" || error "下载失败"
31
+ curl -fsSL "$BASE_URL/package.json" -o "$PLUGIN_DIR/package.json" || error "下载失败"
32
+ curl -fsSL "$BASE_URL/index.ts" -o "$PLUGIN_DIR/index.ts" || error "下载失败"
33
+ curl -fsSL "$BASE_URL/README.md" -o "$PLUGIN_DIR/README.md" || error "下载失败"
34
+ curl -fsSL "$BASE_URL/src/agent.js" -o "$PLUGIN_DIR/src/agent.js" || error "下载失败"
35
+ else
36
+ log "从本地复制插件文件..."
37
+ # 如果是从本地项目安装
38
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
39
+
40
+ cp "$SCRIPT_DIR/openclaw.plugin.json" "$PLUGIN_DIR/" || error "复制失败"
41
+ cp "$SCRIPT_DIR/package.json" "$PLUGIN_DIR/" || error "复制失败"
42
+ cp "$SCRIPT_DIR/index.ts" "$PLUGIN_DIR/" || error "复制失败"
43
+ cp "$SCRIPT_DIR/README.md" "$PLUGIN_DIR/" || error "复制失败"
44
+ cp "$SCRIPT_DIR/src/agent.js" "$PLUGIN_DIR/src/" || error "复制失败"
45
+ fi
46
+
47
+ log "✅ 插件文件已安装"
48
+
49
+ # 添加到信任列表
50
+ log "添加插件到信任列表..."
51
+ CURRENT_ALLOW=$(openclaw config get plugins.allow 2>/dev/null || echo "[]")
52
+
53
+ if echo "$CURRENT_ALLOW" | grep -q "claw-camp-agent"; then
54
+ log "插件已在信任列表中"
55
+ else
56
+ # 添加到信任列表
57
+ NEW_ALLOW=$(echo "$CURRENT_ALLOW" | jq '. + ["claw-camp-agent"]' | jq -c .)
58
+ openclaw config set plugins.allow "$NEW_ALLOW" || warn "无法自动添加到信任列表,请手动配置"
59
+ log "✅ 插件已添加到信任列表"
60
+ fi
61
+
62
+ # 安装依赖
63
+ log "安装依赖..."
64
+ cd "$PLUGIN_DIR"
65
+ if [ -f "package.json" ]; then
66
+ npm install --production 2>&1 | grep -E "added|removed|changed|audited" || true
67
+ fi
68
+
69
+ log ""
70
+ log "🎉 安装完成!"
71
+ log ""
72
+ log "使用方法:"
73
+ log " 1. 启动 Agent: cd $PLUGIN_DIR && node src/agent.js"
74
+ log " 2. 后台运行: nohup node src/agent.js > /tmp/agent.log 2>&1 &"
75
+ log " 3. 查看日志: tail -f /tmp/agent.log"
76
+ log ""
77
+ log "配置文件: $PLUGIN_DIR/openclaw.plugin.json"
78
+ log "GitHub: https://github.com/PhosAQy/claw-hub"
@@ -0,0 +1,48 @@
1
+ {
2
+ "id": "claw-camp",
3
+ "name": "Claw Camp",
4
+ "description": "龙虾营地 - 连接到 Hub 上报系统状态、接收任务、发送消息",
5
+ "version": "2.0.0",
6
+ "kind": ["tools", "channel"],
7
+ "channels": ["claw-camp"],
8
+ "configSchema": {
9
+ "type": "object",
10
+ "additionalProperties": false,
11
+ "properties": {
12
+ "enabled": {
13
+ "type": "boolean",
14
+ "default": true
15
+ },
16
+ "hubUrl": {
17
+ "type": "string",
18
+ "default": "wss://camp.aigc.sx.cn/ws",
19
+ "description": "Hub WebSocket 地址"
20
+ },
21
+ "token": {
22
+ "type": "string",
23
+ "default": "",
24
+ "description": "Camp Token(用于认证)"
25
+ },
26
+ "agentId": {
27
+ "type": "string",
28
+ "default": "main",
29
+ "description": "Agent 唯一标识"
30
+ },
31
+ "agentName": {
32
+ "type": "string",
33
+ "default": "大龙虾",
34
+ "description": "Agent 显示名称"
35
+ },
36
+ "reportInterval": {
37
+ "type": "number",
38
+ "default": 5000,
39
+ "description": "上报间隔(毫秒)"
40
+ },
41
+ "updateToken": {
42
+ "type": "string",
43
+ "default": "",
44
+ "description": "远程更新令牌(可选)"
45
+ }
46
+ }
47
+ }
48
+ }
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@claw-camp/openclaw-plugin",
3
+ "version": "2.0.0",
4
+ "description": "Claw Camp plugin for OpenClaw - monitor your AI agents in real-time",
5
+ "main": "index.ts",
6
+ "keywords": ["openclaw", "plugin", "monitoring", "agent", "claw-camp"],
7
+ "author": "Phosa <phosa.gao@eclicktech.com.cn>",
8
+ "license": "MIT",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/claw-camp/openclaw-plugin.git"
12
+ },
13
+ "dependencies": {
14
+ "ws": "^8.18.0"
15
+ },
16
+ "openclaw": {
17
+ "extensions": ["./index.ts"],
18
+ "install": {
19
+ "npmSpec": "@claw-camp/openclaw-plugin",
20
+ "localPath": "extensions/claw-camp",
21
+ "defaultChoice": "npm"
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,109 @@
1
+ #!/bin/bash
2
+ # Claw Camp Agent - 快速安装脚本
3
+ # 使用方法: curl -fsSL https://raw.githubusercontent.com/PhosAQy/claw-hub/main/src/agent-plugin/quick-install.sh | bash
4
+
5
+ set -e
6
+
7
+ GREEN='\033[0;32m'
8
+ YELLOW='\033[1;33m'
9
+ RED='\033[0;31m'
10
+ BLUE='\033[0;34m'
11
+ NC='\033[0m'
12
+
13
+ log() { echo -e "${GREEN}[✓]${NC} $1"; }
14
+ info() { echo -e "${BLUE}[i]${NC} $1"; }
15
+ warn() { echo -e "${YELLOW}[!]${NC} $1"; }
16
+ error() { echo -e "${RED}[✗]${NC} $1"; exit 1; }
17
+
18
+ # 检查 OpenClaw
19
+ if ! command -v openclaw &> /dev/null; then
20
+ error "OpenClaw 未安装\n请先安装 OpenClaw: https://openclaw.ai"
21
+ fi
22
+
23
+ # 检查 Node.js
24
+ if ! command -v node &> /dev/null; then
25
+ error "Node.js 未安装\n请先安装 Node.js: https://nodejs.org"
26
+ fi
27
+
28
+ # 检查版本
29
+ NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
30
+ if [ "$NODE_VERSION" -lt 18 ]; then
31
+ error "Node.js 版本过低(需要 18+)\n当前版本: $(node -v)"
32
+ fi
33
+
34
+ log "前置检查通过"
35
+
36
+ # 创建插件目录
37
+ PLUGIN_DIR="$HOME/.openclaw/extensions/claw-camp-agent"
38
+ info "创建插件目录: $PLUGIN_DIR"
39
+ mkdir -p "$PLUGIN_DIR/src"
40
+
41
+ # 下载文件
42
+ info "下载插件文件..."
43
+ BASE_URL="https://raw.githubusercontent.com/PhosAQy/claw-hub/main/src/agent-plugin"
44
+
45
+ curl -fsSL "$BASE_URL/openclaw.plugin.json" -o "$PLUGIN_DIR/openclaw.plugin.json" || error "下载失败"
46
+ curl -fsSL "$BASE_URL/package.json" -o "$PLUGIN_DIR/package.json" || error "下载失败"
47
+ curl -fsSL "$BASE_URL/index.ts" -o "$PLUGIN_DIR/index.ts" || error "下载失败"
48
+ curl -fsSL "$BASE_URL/README.md" -o "$PLUGIN_DIR/README.md" || error "下载失败"
49
+ curl -fsSL "$BASE_URL/src/agent.js" -o "$PLUGIN_DIR/src/agent.js" || error "下载失败"
50
+
51
+ log "插件文件已下载"
52
+
53
+ # 添加到信任列表
54
+ info "添加插件到信任列表..."
55
+ CURRENT_ALLOW=$(openclaw config get plugins.allow 2>/dev/null || echo "[]")
56
+
57
+ if echo "$CURRENT_ALLOW" | grep -q "claw-camp-agent"; then
58
+ log "插件已在信任列表中"
59
+ else
60
+ NEW_ALLOW=$(echo "$CURRENT_ALLOW" | jq '. + ["claw-camp-agent"]' | jq -c .)
61
+ openclaw config set plugins.allow "$NEW_ALLOW" 2>/dev/null || warn "无法自动添加到信任列表"
62
+ log "插件已添加到信任列表"
63
+ fi
64
+
65
+ # 安装依赖
66
+ info "安装依赖..."
67
+ cd "$PLUGIN_DIR"
68
+ npm install --production 2>&1 | grep -E "added|removed|changed|audited" || true
69
+
70
+ log "依赖安装完成"
71
+
72
+ # 验证安装
73
+ info "验证安装..."
74
+ if openclaw plugins list 2>&1 | grep -q "claw-camp-agent"; then
75
+ log "插件已成功加载"
76
+ else
77
+ warn "插件未出现在列表中,请重启 OpenClaw"
78
+ fi
79
+
80
+ # 完成
81
+ echo ""
82
+ echo -e "${GREEN}========================================${NC}"
83
+ echo -e "${GREEN} 🎉 安装成功!${NC}"
84
+ echo -e "${GREEN}========================================${NC}"
85
+ echo ""
86
+ echo -e "插件版本: ${BLUE}v1.5.0${NC}"
87
+ echo -e "插件目录: ${BLUE}$PLUGIN_DIR${NC}"
88
+ echo ""
89
+ echo -e "${YELLOW}使用方法:${NC}"
90
+ echo ""
91
+ echo -e " ${GREEN}1. 启动 Agent:${NC}"
92
+ echo -e " cd $PLUGIN_DIR"
93
+ echo -e " node src/agent.js"
94
+ echo ""
95
+ echo -e " ${GREEN}2. 后台运行:${NC}"
96
+ echo -e " nohup node src/agent.js > /tmp/agent.log 2>&1 &"
97
+ echo ""
98
+ echo -e " ${GREEN}3. 查看日志:${NC}"
99
+ echo -e " tail -f /tmp/agent.log"
100
+ echo ""
101
+ echo -e " ${GREEN}4. 访问监控面板:${NC}"
102
+ echo -e " open https://camp.aigc.sx.cn"
103
+ echo ""
104
+ echo -e "${YELLOW}配置文件:${NC}"
105
+ echo -e " $PLUGIN_DIR/openclaw.plugin.json"
106
+ echo ""
107
+ echo -e "${YELLOW}文档:${NC}"
108
+ echo -e " https://github.com/PhosAQy/claw-hub"
109
+ echo ""