openclaw-bridge 0.2.2 → 0.3.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/README.md +141 -0
- package/openclaw.plugin.json +31 -1
- package/package.json +4 -1
- package/src/cli.ts +842 -0
- package/src/config.ts +9 -0
- package/src/heartbeat.ts +26 -0
- package/src/index.ts +36 -1
- package/src/manager/hub-client.ts +114 -0
- package/src/manager/local-manager.ts +121 -0
- package/src/manager/pm2-bridge.ts +125 -0
- package/src/message-relay.ts +60 -31
- package/src/types.ts +12 -0
- package/_inbox/main/bridge-test.md +0 -1
- package/_inbox/pm/bridge-test.md +0 -1
- package/output/bridge-test.md +0 -1
package/README.md
CHANGED
|
@@ -61,6 +61,72 @@ Add to `openclaw.json` under `plugins.entries` (replace the API key and server U
|
|
|
61
61
|
}
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
+
### New Config Fields
|
|
65
|
+
|
|
66
|
+
| Field | Type | Description |
|
|
67
|
+
|-------|------|-------------|
|
|
68
|
+
| `description` | string | Short description shown on the Hub dashboard agent card |
|
|
69
|
+
| `supportsVision` | boolean | Whether this agent accepts image inputs. Auto-detected from the gateway model config if not set. |
|
|
70
|
+
| `localManager` | object | Local Manager settings — see [Local Manager](#local-manager) section below |
|
|
71
|
+
|
|
72
|
+
Example with all new fields:
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"plugins": {
|
|
77
|
+
"entries": {
|
|
78
|
+
"openclaw-bridge": {
|
|
79
|
+
"config": {
|
|
80
|
+
"role": "normal",
|
|
81
|
+
"agentId": "my-agent",
|
|
82
|
+
"agentName": "My Agent",
|
|
83
|
+
"description": "Handles project management tasks and sprint planning",
|
|
84
|
+
"supportsVision": false,
|
|
85
|
+
"registry": {
|
|
86
|
+
"baseUrl": "http://your-server:3080",
|
|
87
|
+
"apiKey": "your-hub-api-key"
|
|
88
|
+
},
|
|
89
|
+
"fileRelay": {
|
|
90
|
+
"baseUrl": "http://your-server:3080",
|
|
91
|
+
"apiKey": "your-hub-api-key"
|
|
92
|
+
},
|
|
93
|
+
"localManager": {
|
|
94
|
+
"enabled": true,
|
|
95
|
+
"hubUrl": "http://your-server:3080",
|
|
96
|
+
"managerPass": "your-manager-password"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Local Manager
|
|
106
|
+
|
|
107
|
+
Installing `openclaw-bridge` now bundles a **Local Manager** that handles PM2 process management for your gateway instances on your local machine. It connects to the Hub via WebSocket so the Hub dashboard can remotely start, stop, and restart individual gateways.
|
|
108
|
+
|
|
109
|
+
**Requirements:**
|
|
110
|
+
|
|
111
|
+
- PM2 installed globally: `npm install -g pm2`
|
|
112
|
+
- A running `openclaw-bridge-hub` server
|
|
113
|
+
|
|
114
|
+
**How it works:**
|
|
115
|
+
|
|
116
|
+
- On startup, the plugin checks if `localManager.enabled` is `true`
|
|
117
|
+
- Only one Local Manager process runs per machine (enforced via a lock file)
|
|
118
|
+
- It connects to Hub at `localManager.hubUrl` over `/ws/manager` and authenticates with `localManager.managerPass`
|
|
119
|
+
- The Hub dashboard can then send `start`, `stop`, and `restart` commands for any gateway on that machine
|
|
120
|
+
- PM2 reports process status (running state, memory, uptime) back to the Hub every heartbeat cycle
|
|
121
|
+
|
|
122
|
+
**Config fields:**
|
|
123
|
+
|
|
124
|
+
| Field | Type | Default | Description |
|
|
125
|
+
|-------|------|---------|-------------|
|
|
126
|
+
| `localManager.enabled` | boolean | `false` | Enable Local Manager on this machine |
|
|
127
|
+
| `localManager.hubUrl` | string | (required) | Full URL of the Hub server, e.g. `http://your-server:3080` |
|
|
128
|
+
| `localManager.managerPass` | string | (required) | Password set via `openclaw-bridge-hub manager-pass` |
|
|
129
|
+
|
|
64
130
|
### Auto-configured settings
|
|
65
131
|
|
|
66
132
|
On first startup, the plugin automatically adds these if missing:
|
|
@@ -109,6 +175,81 @@ User ←→ Discord DM ←→ Main Gateway
|
|
|
109
175
|
- Messages and handoffs route through Hub WebSocket (`/ws`)
|
|
110
176
|
- File transfers use local filesystem (same machine) or Hub relay (cross-machine)
|
|
111
177
|
|
|
178
|
+
## CLI Commands
|
|
179
|
+
|
|
180
|
+
After installing globally (`npm install -g openclaw-bridge`), the `openclaw-bridge` command is available:
|
|
181
|
+
|
|
182
|
+
| Command | Description |
|
|
183
|
+
|---------|-------------|
|
|
184
|
+
| `setup` | Interactive setup — configure Hub URL, API key, and manager password |
|
|
185
|
+
| `status` | Show PM2 process status and Hub connection |
|
|
186
|
+
| `start` | Find and start all openclaw instances via PM2 ecosystem |
|
|
187
|
+
| `stop` | Stop all openclaw instances |
|
|
188
|
+
| `restart [agent]` | Restart a specific agent or all |
|
|
189
|
+
| `logs [agent]` | View PM2 logs for an agent (last 100 lines) |
|
|
190
|
+
| `backup` | Create encrypted backup of openclaw-instances |
|
|
191
|
+
| `clean-sessions` | Remove old/deleted session files to free disk space |
|
|
192
|
+
| `add-agent` | Wizard to create a new agent instance |
|
|
193
|
+
| `doctor` | Diagnose environment issues (PM2, Node, ports, Hub) |
|
|
194
|
+
|
|
195
|
+
### Quick Start
|
|
196
|
+
|
|
197
|
+
1. Install the plugin: `npm install -g openclaw-bridge`
|
|
198
|
+
2. Run setup: `openclaw-bridge setup`
|
|
199
|
+
3. Check environment: `openclaw-bridge doctor`
|
|
200
|
+
4. Start all agents: `openclaw-bridge start`
|
|
201
|
+
5. Check status: `openclaw-bridge status`
|
|
202
|
+
|
|
203
|
+
### Adding a New Agent
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
openclaw-bridge add-agent
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
The wizard will prompt for:
|
|
210
|
+
- Agent name and ID
|
|
211
|
+
- Description
|
|
212
|
+
- AI model selection
|
|
213
|
+
- Automatically assigns the next available port
|
|
214
|
+
- Creates directory, config files, and updates PM2 ecosystem
|
|
215
|
+
|
|
216
|
+
### Backup & Restore
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
openclaw-bridge backup
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Creates an encrypted backup archive. Config files are encrypted with AES-256-CBC. Excludes node_modules, state, workspace, and logs.
|
|
223
|
+
|
|
224
|
+
## CLI 命令说明
|
|
225
|
+
|
|
226
|
+
安装后 (`npm install -g openclaw-bridge`),可使用 `openclaw-bridge` 命令:
|
|
227
|
+
|
|
228
|
+
| 命令 | 说明 |
|
|
229
|
+
|------|------|
|
|
230
|
+
| `setup` | 交互式设置 — 配置 Hub 地址、API 密钥和管理密码 |
|
|
231
|
+
| `status` | 查看 PM2 进程状态和 Hub 连接情况 |
|
|
232
|
+
| `start` | 查找并启动所有 openclaw 实例 |
|
|
233
|
+
| `stop` | 停止所有实例 |
|
|
234
|
+
| `restart [agent]` | 重启指定或全部 agent |
|
|
235
|
+
| `logs [agent]` | 查看 agent 日志(最近100行) |
|
|
236
|
+
| `backup` | 创建加密备份 |
|
|
237
|
+
| `clean-sessions` | 清理旧会话文件释放磁盘空间 |
|
|
238
|
+
| `add-agent` | 向导式创建新 agent 实例 |
|
|
239
|
+
| `doctor` | 环境诊断(PM2、Node、端口、Hub 连接) |
|
|
240
|
+
|
|
241
|
+
### 快速开始
|
|
242
|
+
|
|
243
|
+
1. 安装插件:`npm install -g openclaw-bridge`
|
|
244
|
+
2. 运行设置:`openclaw-bridge setup`
|
|
245
|
+
3. 检查环境:`openclaw-bridge doctor`
|
|
246
|
+
4. 启动所有 agent:`openclaw-bridge start`
|
|
247
|
+
5. 查看状态:`openclaw-bridge status`
|
|
248
|
+
|
|
249
|
+
## Mac Compatibility
|
|
250
|
+
|
|
251
|
+
The same plugin code runs on both **Windows** and **macOS** without modification. The Local Manager and orphan process cleanup routines use cross-platform detection — on Windows they use `taskkill`, on macOS/Linux they use `kill` signals. PM2 itself is cross-platform, so the full feature set (start/stop/restart, log streaming, process metrics) works identically on both platforms.
|
|
252
|
+
|
|
112
253
|
## Requirements
|
|
113
254
|
|
|
114
255
|
- [openclaw-bridge-hub](https://www.npmjs.com/package/openclaw-bridge-hub) v0.2.4+ running on a reachable server
|
package/openclaw.plugin.json
CHANGED
|
@@ -31,6 +31,26 @@
|
|
|
31
31
|
"fileRelay.apiKey": {
|
|
32
32
|
"label": "FileRelay API Key",
|
|
33
33
|
"sensitive": true
|
|
34
|
+
},
|
|
35
|
+
"description": {
|
|
36
|
+
"label": "Agent Description",
|
|
37
|
+
"help": "Short description of what this agent does (shown on Hub dashboard)"
|
|
38
|
+
},
|
|
39
|
+
"supportsVision": {
|
|
40
|
+
"label": "Supports Vision",
|
|
41
|
+
"help": "Whether the agent's model can process images (auto-detected if not set)"
|
|
42
|
+
},
|
|
43
|
+
"localManager.enabled": {
|
|
44
|
+
"label": "Enable Local Manager",
|
|
45
|
+
"help": "Start PM2 process manager for this machine"
|
|
46
|
+
},
|
|
47
|
+
"localManager.hubUrl": {
|
|
48
|
+
"label": "Hub URL for Local Manager",
|
|
49
|
+
"placeholder": "http://your-server:3080"
|
|
50
|
+
},
|
|
51
|
+
"localManager.managerPass": {
|
|
52
|
+
"label": "Manager Password",
|
|
53
|
+
"sensitive": true
|
|
34
54
|
}
|
|
35
55
|
},
|
|
36
56
|
"configSchema": {
|
|
@@ -65,7 +85,17 @@
|
|
|
65
85
|
}
|
|
66
86
|
},
|
|
67
87
|
"heartbeatIntervalMs": { "type": "number" },
|
|
68
|
-
"offlineThresholdMs": { "type": "number" }
|
|
88
|
+
"offlineThresholdMs": { "type": "number" },
|
|
89
|
+
"description": { "type": "string" },
|
|
90
|
+
"supportsVision": { "type": "boolean" },
|
|
91
|
+
"localManager": {
|
|
92
|
+
"type": "object",
|
|
93
|
+
"properties": {
|
|
94
|
+
"enabled": { "type": "boolean" },
|
|
95
|
+
"hubUrl": { "type": "string" },
|
|
96
|
+
"managerPass": { "type": "string" }
|
|
97
|
+
}
|
|
98
|
+
}
|
|
69
99
|
}
|
|
70
100
|
}
|
|
71
101
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-bridge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"author": "Bill Zhao (https://www.linkedin.com/in/billzhaodi/)",
|
|
5
5
|
"description": "Cross-gateway communication plugin for OpenClaw — agent discovery, file transfer, real-time messaging, and session handoff",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "src/index.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"openclaw-bridge": "src/cli.ts"
|
|
10
|
+
},
|
|
8
11
|
"openclaw": {
|
|
9
12
|
"extensions": [
|
|
10
13
|
"./src/index.ts"
|