@rowger_go/chatu 0.1.3
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/.github/workflows/ci.yml +30 -0
- package/.github/workflows/publish.yml +55 -0
- package/INSTALL.md +285 -0
- package/INSTALL.zh.md +285 -0
- package/LICENSE +21 -0
- package/README.md +293 -0
- package/README.zh.md +293 -0
- package/dist/index.d.ts +96 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1381 -0
- package/dist/index.js.map +1 -0
- package/dist/index.test.d.ts +5 -0
- package/dist/index.test.d.ts.map +1 -0
- package/dist/index.test.js +334 -0
- package/dist/index.test.js.map +1 -0
- package/dist/sdk/adapters/cache.d.ts +94 -0
- package/dist/sdk/adapters/cache.d.ts.map +1 -0
- package/dist/sdk/adapters/cache.js +158 -0
- package/dist/sdk/adapters/cache.js.map +1 -0
- package/dist/sdk/adapters/cache.test.d.ts +14 -0
- package/dist/sdk/adapters/cache.test.d.ts.map +1 -0
- package/dist/sdk/adapters/cache.test.js +178 -0
- package/dist/sdk/adapters/cache.test.js.map +1 -0
- package/dist/sdk/adapters/default.d.ts +24 -0
- package/dist/sdk/adapters/default.d.ts.map +1 -0
- package/dist/sdk/adapters/default.js +151 -0
- package/dist/sdk/adapters/default.js.map +1 -0
- package/dist/sdk/adapters/webhub.d.ts +336 -0
- package/dist/sdk/adapters/webhub.d.ts.map +1 -0
- package/dist/sdk/adapters/webhub.js +663 -0
- package/dist/sdk/adapters/webhub.js.map +1 -0
- package/dist/sdk/adapters/websocket.d.ts +133 -0
- package/dist/sdk/adapters/websocket.d.ts.map +1 -0
- package/dist/sdk/adapters/websocket.js +314 -0
- package/dist/sdk/adapters/websocket.js.map +1 -0
- package/dist/sdk/core/channel.d.ts +104 -0
- package/dist/sdk/core/channel.d.ts.map +1 -0
- package/dist/sdk/core/channel.js +158 -0
- package/dist/sdk/core/channel.js.map +1 -0
- package/dist/sdk/index.d.ts +27 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +33 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/sdk/types/adapters.d.ts +128 -0
- package/dist/sdk/types/adapters.d.ts.map +1 -0
- package/dist/sdk/types/adapters.js +10 -0
- package/dist/sdk/types/adapters.js.map +1 -0
- package/dist/sdk/types/channel.d.ts +270 -0
- package/dist/sdk/types/channel.d.ts.map +1 -0
- package/dist/sdk/types/channel.js +36 -0
- package/dist/sdk/types/channel.js.map +1 -0
- package/docs/channel/01-overview.md +117 -0
- package/docs/channel/02-configuration.md +138 -0
- package/docs/channel/03-capabilities.md +86 -0
- package/docs/channel/04-api-reference.md +394 -0
- package/docs/channel/05-message-protocol.md +194 -0
- package/docs/channel/06-security.md +83 -0
- package/docs/channel/README.md +30 -0
- package/docs/sdk/README.md +13 -0
- package/docs/sdk/v2026.1.29-v2026.2.19.md +630 -0
- package/jest.config.js +19 -0
- package/openclaw.plugin.json +113 -0
- package/package.json +74 -0
- package/run-poll.mjs +209 -0
- package/scripts/reload-plugin.sh +78 -0
- package/src/index.test.ts +432 -0
- package/src/index.ts +1638 -0
- package/src/sdk/adapters/cache.test.ts +205 -0
- package/src/sdk/adapters/cache.ts +193 -0
- package/src/sdk/adapters/default.ts +196 -0
- package/src/sdk/adapters/webhub.ts +857 -0
- package/src/sdk/adapters/websocket.ts +378 -0
- package/src/sdk/core/channel.ts +230 -0
- package/src/sdk/index.ts +36 -0
- package/src/sdk/types/adapters.ts +169 -0
- package/src/sdk/types/channel.ts +346 -0
- package/tsconfig.json +31 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: ["main"]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build-and-test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Setup Node.js
|
|
18
|
+
uses: actions/setup-node@v4
|
|
19
|
+
with:
|
|
20
|
+
node-version: "22"
|
|
21
|
+
cache: "npm"
|
|
22
|
+
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
run: npm install
|
|
25
|
+
|
|
26
|
+
- name: Build
|
|
27
|
+
run: npm run build
|
|
28
|
+
|
|
29
|
+
- name: Test
|
|
30
|
+
run: npm test
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
# Triggered when a version tag is pushed (e.g. v0.1.1, v1.2.3)
|
|
4
|
+
# To publish a new version, run one of:
|
|
5
|
+
# npm run release:patch (0.1.0 → 0.1.1)
|
|
6
|
+
# npm run release:minor (0.1.0 → 0.2.0)
|
|
7
|
+
# npm run release:major (0.1.0 → 1.0.0)
|
|
8
|
+
#
|
|
9
|
+
# These scripts bump package.json, commit the change, create a git tag,
|
|
10
|
+
# and push — which triggers this workflow.
|
|
11
|
+
#
|
|
12
|
+
# Required secret: NPM_TOKEN
|
|
13
|
+
# 1. Create an Automation token at https://www.npmjs.com/settings/<user>/tokens
|
|
14
|
+
# 2. Add it to GitHub: Settings → Secrets and variables → Actions → NPM_TOKEN
|
|
15
|
+
|
|
16
|
+
on:
|
|
17
|
+
push:
|
|
18
|
+
tags:
|
|
19
|
+
- "v*.*.*"
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
publish:
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
permissions:
|
|
25
|
+
contents: write
|
|
26
|
+
|
|
27
|
+
steps:
|
|
28
|
+
- name: Checkout
|
|
29
|
+
uses: actions/checkout@v4
|
|
30
|
+
|
|
31
|
+
- name: Setup Node.js
|
|
32
|
+
uses: actions/setup-node@v4
|
|
33
|
+
with:
|
|
34
|
+
node-version: "22"
|
|
35
|
+
registry-url: "https://registry.npmjs.org"
|
|
36
|
+
cache: "npm"
|
|
37
|
+
|
|
38
|
+
- name: Install dependencies
|
|
39
|
+
run: npm install
|
|
40
|
+
|
|
41
|
+
- name: Build
|
|
42
|
+
run: npm run build
|
|
43
|
+
|
|
44
|
+
- name: Test
|
|
45
|
+
run: npm test
|
|
46
|
+
|
|
47
|
+
- name: Publish to npm
|
|
48
|
+
run: npm publish --access public
|
|
49
|
+
env:
|
|
50
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
51
|
+
|
|
52
|
+
- name: Create GitHub Release
|
|
53
|
+
uses: softprops/action-gh-release@v2
|
|
54
|
+
with:
|
|
55
|
+
generate_release_notes: true
|
package/INSTALL.md
ADDED
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# Chatu Channel Installation Guide
|
|
2
|
+
|
|
3
|
+
**English | [中文](INSTALL.zh.md)**
|
|
4
|
+
|
|
5
|
+
> This guide covers installing the Chatu channel to connect OpenClaw with any Website.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Installation Methods
|
|
10
|
+
|
|
11
|
+
### 1.1 From npm (Recommended)
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Install as OpenClaw plugin
|
|
15
|
+
openclaw plugins install @rowger_go/chatu
|
|
16
|
+
|
|
17
|
+
# Or using npm directly (if publishing to npm)
|
|
18
|
+
npm install -g @rowger_go/chatu
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### 1.2 From Source
|
|
22
|
+
|
|
23
|
+
**Method A: Auto-build Install (Recommended)**
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Clone the repository
|
|
27
|
+
git clone https://github.com/chatu-ai/webhub.git
|
|
28
|
+
cd webhub
|
|
29
|
+
|
|
30
|
+
# Install as plugin (will auto-build via prepare script)
|
|
31
|
+
openclaw plugins install .
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Method B: Manual Build Install**
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Clone the repository
|
|
38
|
+
git clone https://github.com/chatu-ai/webhub.git
|
|
39
|
+
cd webhub
|
|
40
|
+
|
|
41
|
+
# Build the plugin
|
|
42
|
+
npm install
|
|
43
|
+
npm run build
|
|
44
|
+
|
|
45
|
+
# Install locally
|
|
46
|
+
openclaw plugins install .
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 1.3 Development Mode
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Link for development (with hot reload)
|
|
53
|
+
openclaw plugins install -l .
|
|
54
|
+
cd /path/to/webhub
|
|
55
|
+
npm run watch
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 2. Configuration
|
|
61
|
+
|
|
62
|
+
### 2.1 Quick Setup
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Enable the channel
|
|
66
|
+
openclaw config set channels.chatu.enabled true
|
|
67
|
+
|
|
68
|
+
# Set Chatu service API URL (provided by your WebHub backend)
|
|
69
|
+
openclaw config set channels.chatu.apiUrl "https://your-website.com"
|
|
70
|
+
|
|
71
|
+
# Set channel ID (from WebHub admin panel)
|
|
72
|
+
openclaw config set channels.chatu.channelId "wh_ch_xxxxxx"
|
|
73
|
+
|
|
74
|
+
# Set access token (provided by your WebHub backend)
|
|
75
|
+
openclaw config set channels.chatu.accessToken "wh_eyJhbGciOiJIUzI1NiIs..."
|
|
76
|
+
|
|
77
|
+
# Apply changes
|
|
78
|
+
openclaw gateway restart
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 2.2 Full Configuration
|
|
82
|
+
|
|
83
|
+
```json5
|
|
84
|
+
{
|
|
85
|
+
channels: {
|
|
86
|
+
chatu: {
|
|
87
|
+
enabled: true,
|
|
88
|
+
|
|
89
|
+
// WebHub service base URL [Required]
|
|
90
|
+
apiUrl: "https://your-website.com",
|
|
91
|
+
|
|
92
|
+
// Channel ID from WebHub admin panel [Required]
|
|
93
|
+
channelId: "wh_ch_xxxxxx",
|
|
94
|
+
|
|
95
|
+
// Access token [Required unless using secret]
|
|
96
|
+
accessToken: "wh_eyJhbGciOiJIUzI1NiIs...",
|
|
97
|
+
|
|
98
|
+
// Channel secret for registration [Alternative to accessToken]
|
|
99
|
+
// secret: "wh_secret_xxxxxxxxxx",
|
|
100
|
+
|
|
101
|
+
// Request timeout (ms) [Optional]
|
|
102
|
+
timeout: 30000,
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 2.3 Environment Variables (Quick Register)
|
|
109
|
+
|
|
110
|
+
If your WebHub backend supports auto-registration, you can skip manual credential setup:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Set registration key and service URL
|
|
114
|
+
export CHATU_KEY="your-registration-key"
|
|
115
|
+
export CHATU_URL="https://your-website.com"
|
|
116
|
+
|
|
117
|
+
# Restart gateway to trigger auto-registration
|
|
118
|
+
openclaw gateway restart
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The plugin will automatically call `POST /api/channel/quick-register` and save the returned `channelId` and `accessToken` to config.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## 3. Verify Installation
|
|
126
|
+
|
|
127
|
+
### 3.1 Check Plugin Status
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Verify plugin is loaded
|
|
131
|
+
openclaw plugins list | grep chatu
|
|
132
|
+
|
|
133
|
+
# Expected output:
|
|
134
|
+
# │ Chatu │ chatu │ loaded │ .../dist/index.js │ 0.1.0 │
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### 3.2 Check Configuration
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# View current chatu config
|
|
141
|
+
openclaw config get channels.chatu
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### 3.3 View Logs
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Check connection logs
|
|
148
|
+
openclaw logs
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## 4. Uninstall
|
|
154
|
+
|
|
155
|
+
### 4.1 Disable Channel
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# Disable the channel
|
|
159
|
+
openclaw config set channels.chatu.enabled false
|
|
160
|
+
|
|
161
|
+
# Or remove entirely
|
|
162
|
+
openclaw config unset channels.chatu
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### 4.2 Remove Plugin
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# Remove from OpenClaw
|
|
169
|
+
openclaw plugins uninstall @rowger_go/chatu
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## 5. Troubleshooting
|
|
175
|
+
|
|
176
|
+
### 5.1 Common Issues
|
|
177
|
+
|
|
178
|
+
| Issue | Solution |
|
|
179
|
+
|-------|----------|
|
|
180
|
+
| Connection timeout | Check `apiUrl` is correct and accessible |
|
|
181
|
+
| 401 Unauthorized | Verify `accessToken` is valid |
|
|
182
|
+
| Plugin not loading | Run `openclaw plugins list \| grep chatu`; ensure `dist/` exists after build |
|
|
183
|
+
| Messages not arriving | Check WebSocket connection in logs; verify `channelId` is correct |
|
|
184
|
+
| Messages not sending | Confirm `accessToken` and `channelId` are configured |
|
|
185
|
+
|
|
186
|
+
### 5.2 Debug Commands
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
# View gateway logs
|
|
190
|
+
openclaw logs
|
|
191
|
+
|
|
192
|
+
# Check plugin status
|
|
193
|
+
openclaw plugins list | grep chatu
|
|
194
|
+
|
|
195
|
+
# View current config
|
|
196
|
+
openclaw config get channels.chatu
|
|
197
|
+
|
|
198
|
+
# Test backend health
|
|
199
|
+
curl https://your-website.com/health
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### 5.3 Get Help
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# Check OpenClaw documentation
|
|
206
|
+
openclaw help
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## 6. Update
|
|
212
|
+
|
|
213
|
+
### 6.1 Update Plugin
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
# Update to latest version
|
|
217
|
+
openclaw plugins update @rowger_go/chatu
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### 6.2 Check Version
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
# View installed version
|
|
224
|
+
openclaw plugins list | grep chatu
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Related Documentation
|
|
230
|
+
|
|
231
|
+
- [Channel Documentation](docs/channel/README.md) - Architecture, API reference, message protocol
|
|
232
|
+
- [OpenClaw Configuration](https://docs.openclaw.ai/gateway/configuration) - Official docs
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
*Last updated: 2026-02-25*
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## Plugin Version Detection
|
|
241
|
+
|
|
242
|
+
After installing or upgrading the plugin, you can verify the active version without restarting openclaw by querying the service version endpoint:
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
# Check active plugin version
|
|
246
|
+
curl http://localhost:3000/api/channel/version
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Expected response:
|
|
250
|
+
|
|
251
|
+
```json
|
|
252
|
+
{
|
|
253
|
+
"success": true,
|
|
254
|
+
"data": {
|
|
255
|
+
"serviceVersion": "1.0.0",
|
|
256
|
+
"nodeVersion": "20.11.0",
|
|
257
|
+
"pluginVersion": "0.1.0",
|
|
258
|
+
"buildTime": null
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
`pluginVersion` reflects the version reported by the plugin when it last connected. If it shows `null`, the plugin has not yet connected after the most recent service restart.
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Reloading the Plugin After an Upgrade
|
|
268
|
+
|
|
269
|
+
Use the included reload script to rebuild and get guided reload instructions:
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
./scripts/reload-plugin.sh
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
The script will:
|
|
276
|
+
1. Run `npm run build` to compile the plugin
|
|
277
|
+
2. Print the new version
|
|
278
|
+
3. Check the service version endpoint
|
|
279
|
+
4. Show step-by-step instructions for clearing the cached `accessToken` and restarting the openclaw account so the new build takes effect
|
|
280
|
+
|
|
281
|
+
To reload without rebuilding:
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
./scripts/reload-plugin.sh --no-build
|
|
285
|
+
```
|
package/INSTALL.zh.md
ADDED
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# Chatu 频道安装指南
|
|
2
|
+
|
|
3
|
+
**[English](INSTALL.md) | 中文**
|
|
4
|
+
|
|
5
|
+
> 本指南介绍如何安装 Chatu 频道插件,将 OpenClaw 连接到任意网站。
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. 安装方式
|
|
10
|
+
|
|
11
|
+
### 1.1 从 npm 安装(推荐)
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# 作为 OpenClaw 插件安装
|
|
15
|
+
openclaw plugins install @rowger_go/chatu
|
|
16
|
+
|
|
17
|
+
# 或直接使用 npm 全局安装
|
|
18
|
+
npm install -g @rowger_go/chatu
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### 1.2 从源码安装
|
|
22
|
+
|
|
23
|
+
**方式 A:自动构建安装(推荐)**
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# 克隆仓库
|
|
27
|
+
git clone https://github.com/chatu-ai/webhub.git
|
|
28
|
+
cd webhub
|
|
29
|
+
|
|
30
|
+
# 安装为插件(会通过 prepare 脚本自动构建)
|
|
31
|
+
openclaw plugins install .
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**方式 B:手动构建安装**
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# 克隆仓库
|
|
38
|
+
git clone https://github.com/chatu-ai/webhub.git
|
|
39
|
+
cd webhub
|
|
40
|
+
|
|
41
|
+
# 构建插件
|
|
42
|
+
npm install
|
|
43
|
+
npm run build
|
|
44
|
+
|
|
45
|
+
# 本地安装
|
|
46
|
+
openclaw plugins install .
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 1.3 开发模式
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# 以热重载方式链接(开发用)
|
|
53
|
+
openclaw plugins install -l .
|
|
54
|
+
cd /path/to/webhub
|
|
55
|
+
npm run watch
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 2. 配置
|
|
61
|
+
|
|
62
|
+
### 2.1 快速配置
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# 启用频道
|
|
66
|
+
openclaw config set channels.chatu.enabled true
|
|
67
|
+
|
|
68
|
+
# 设置 Chatu 服务 API URL(由 WebHub 后端提供)
|
|
69
|
+
openclaw config set channels.chatu.apiUrl "https://your-website.com"
|
|
70
|
+
|
|
71
|
+
# 设置频道 ID(从 WebHub 管理界面获取)
|
|
72
|
+
openclaw config set channels.chatu.channelId "wh_ch_xxxxxx"
|
|
73
|
+
|
|
74
|
+
# 设置访问凭证(由 WebHub 后端提供)
|
|
75
|
+
openclaw config set channels.chatu.accessToken "wh_eyJhbGciOiJIUzI1NiIs..."
|
|
76
|
+
|
|
77
|
+
# 应用更改
|
|
78
|
+
openclaw gateway restart
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 2.2 完整配置
|
|
82
|
+
|
|
83
|
+
```json5
|
|
84
|
+
{
|
|
85
|
+
channels: {
|
|
86
|
+
chatu: {
|
|
87
|
+
enabled: true,
|
|
88
|
+
|
|
89
|
+
// WebHub 服务基础 URL [必填]
|
|
90
|
+
apiUrl: "https://your-website.com",
|
|
91
|
+
|
|
92
|
+
// 频道 ID,从 WebHub 管理界面获取 [必填]
|
|
93
|
+
channelId: "wh_ch_xxxxxx",
|
|
94
|
+
|
|
95
|
+
// 访问凭证 [必填,与 secret 二选一]
|
|
96
|
+
accessToken: "wh_eyJhbGciOiJIUzI1NiIs...",
|
|
97
|
+
|
|
98
|
+
// 频道密钥,用于注册 [与 accessToken 二选一]
|
|
99
|
+
// secret: "wh_secret_xxxxxxxxxx",
|
|
100
|
+
|
|
101
|
+
// 请求超时时间(毫秒)[可选]
|
|
102
|
+
timeout: 30000,
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 2.3 环境变量(快速注册)
|
|
109
|
+
|
|
110
|
+
如果 WebHub 后端支持自动注册,可以跳过手动凭证配置:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# 设置注册密钥和服务 URL
|
|
114
|
+
export CHATU_KEY="your-registration-key"
|
|
115
|
+
export CHATU_URL="https://your-website.com"
|
|
116
|
+
|
|
117
|
+
# 重启网关触发自动注册
|
|
118
|
+
openclaw gateway restart
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
插件会自动调用 `POST /api/channel/quick-register`,并将返回的 `channelId` 和 `accessToken` 保存到配置中。
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## 3. 验证安装
|
|
126
|
+
|
|
127
|
+
### 3.1 检查插件状态
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# 验证插件已加载
|
|
131
|
+
openclaw plugins list | grep chatu
|
|
132
|
+
|
|
133
|
+
# 预期输出:
|
|
134
|
+
# │ Chatu │ chatu │ loaded │ .../dist/index.js │ 0.1.0 │
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### 3.2 检查配置
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# 查看当前 chatu 配置
|
|
141
|
+
openclaw config get channels.chatu
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### 3.3 查看日志
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# 检查连接日志
|
|
148
|
+
openclaw logs
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## 4. 卸载
|
|
154
|
+
|
|
155
|
+
### 4.1 禁用频道
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# 禁用频道
|
|
159
|
+
openclaw config set channels.chatu.enabled false
|
|
160
|
+
|
|
161
|
+
# 或完全移除配置
|
|
162
|
+
openclaw config unset channels.chatu
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### 4.2 移除插件
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# 从 OpenClaw 中移除
|
|
169
|
+
openclaw plugins uninstall @rowger_go/chatu
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## 5. 故障排除
|
|
175
|
+
|
|
176
|
+
### 5.1 常见问题
|
|
177
|
+
|
|
178
|
+
| 问题 | 解决方案 |
|
|
179
|
+
|------|----------|
|
|
180
|
+
| 连接超时 | 检查 `apiUrl` 是否正确且可访问 |
|
|
181
|
+
| 401 未授权 | 验证 `accessToken` 是否有效 |
|
|
182
|
+
| 插件未加载 | 运行 `openclaw plugins list \| grep chatu`;确认构建后 `dist/` 目录存在 |
|
|
183
|
+
| 消息未到达 | 检查日志中的 WebSocket 连接状态;验证 `channelId` 是否正确 |
|
|
184
|
+
| 消息发送失败 | 确认 `accessToken` 和 `channelId` 已配置 |
|
|
185
|
+
|
|
186
|
+
### 5.2 调试命令
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
# 查看网关日志
|
|
190
|
+
openclaw logs
|
|
191
|
+
|
|
192
|
+
# 检查插件状态
|
|
193
|
+
openclaw plugins list | grep chatu
|
|
194
|
+
|
|
195
|
+
# 查看当前配置
|
|
196
|
+
openclaw config get channels.chatu
|
|
197
|
+
|
|
198
|
+
# 测试后端健康状态
|
|
199
|
+
curl https://your-website.com/health
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### 5.3 获取帮助
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# 查看 OpenClaw 文档
|
|
206
|
+
openclaw help
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## 6. 更新
|
|
212
|
+
|
|
213
|
+
### 6.1 更新插件
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
# 更新到最新版本
|
|
217
|
+
openclaw plugins update @rowger_go/chatu
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### 6.2 检查版本
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
# 查看已安装版本
|
|
224
|
+
openclaw plugins list | grep chatu
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## 相关文档
|
|
230
|
+
|
|
231
|
+
- [频道文档](docs/channel/README.md) - 架构、API 参考、消息协议
|
|
232
|
+
- [OpenClaw 配置文档](https://docs.openclaw.ai/gateway/configuration) - 官方文档
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
*最后更新:2026-02-25*
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## 插件版本检测
|
|
241
|
+
|
|
242
|
+
安装或升级插件后,可通过查询服务版本端点来验证当前运行的版本,无需重启 openclaw:
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
# 检查活跃插件版本
|
|
246
|
+
curl http://localhost:3000/api/channel/version
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
预期响应:
|
|
250
|
+
|
|
251
|
+
```json
|
|
252
|
+
{
|
|
253
|
+
"success": true,
|
|
254
|
+
"data": {
|
|
255
|
+
"serviceVersion": "1.0.0",
|
|
256
|
+
"nodeVersion": "20.11.0",
|
|
257
|
+
"pluginVersion": "0.1.0",
|
|
258
|
+
"buildTime": null
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
`pluginVersion` 反映插件最近一次连接时上报的版本号。如果显示 `null`,表示插件在最近一次服务重启后尚未连接。
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## 升级后重载插件
|
|
268
|
+
|
|
269
|
+
使用内置的重载脚本来重新构建并获取重载引导说明:
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
./scripts/reload-plugin.sh
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
该脚本会:
|
|
276
|
+
1. 运行 `npm run build` 编译插件
|
|
277
|
+
2. 打印新版本号
|
|
278
|
+
3. 检查服务版本端点
|
|
279
|
+
4. 展示清除缓存 `accessToken` 并重启 openclaw 账户以使新构建生效的分步操作说明
|
|
280
|
+
|
|
281
|
+
如需跳过构建直接重载:
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
./scripts/reload-plugin.sh --no-build
|
|
285
|
+
```
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 chatu-ai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|