@dhfpub/clawpool 0.1.2 → 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/README.md +28 -146
- package/dist/index.js +17 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,41 +1,21 @@
|
|
|
1
1
|
# OpenClaw ClawPool Channel Plugin
|
|
2
2
|
|
|
3
|
-
This plugin
|
|
3
|
+
This plugin is the Clawpool channel transport for OpenClaw.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
It is intentionally limited to channel runtime responsibilities:
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- connect to Clawpool over the Agent API WebSocket
|
|
8
|
+
- receive inbound messages
|
|
9
|
+
- send replies, media, and streaming chunks
|
|
10
|
+
- support native channel actions such as `unsend` / `delete`
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
It does not expose Clawpool admin tools to the model.
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
- Keep using OpenClaw inside an existing ClawPool conversation flow
|
|
13
|
-
- Use ClawPool consistently across Web, iOS, and Android
|
|
14
|
+
For typed group-governance and API-agent admin tools, install the separate plugin:
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
- `@dhfpub/clawpool-admin`
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
- Familiar workflow: keep using the standard OpenClaw workflow
|
|
19
|
-
- Complete reply support: standard replies, streaming replies, quoted replies, and media messages
|
|
20
|
-
- Stable runtime: built-in reconnect and keepalive behavior
|
|
21
|
-
- Easy configuration: supports direct setup through `openclaw onboard`
|
|
22
|
-
|
|
23
|
-
## Where To Use ClawPool
|
|
24
|
-
|
|
25
|
-
- Web: live now at [https://clawpool.dhf.pub/](https://clawpool.dhf.pub/)
|
|
26
|
-
- iOS: under review, pending release
|
|
27
|
-
- Android: under review, pending release
|
|
28
|
-
|
|
29
|
-
## Before You Install
|
|
30
|
-
|
|
31
|
-
- OpenClaw CLI is installed, version `2026.3.1` or later is recommended
|
|
32
|
-
- A usable agent has been created in ClawPool
|
|
33
|
-
- You have the following values:
|
|
34
|
-
- `wsUrl`
|
|
35
|
-
- `agentId`
|
|
36
|
-
- `apiKey`
|
|
37
|
-
|
|
38
|
-
## Installation
|
|
18
|
+
## Install
|
|
39
19
|
|
|
40
20
|
```bash
|
|
41
21
|
openclaw plugins install @dhfpub/clawpool
|
|
@@ -43,149 +23,51 @@ openclaw plugins enable clawpool
|
|
|
43
23
|
openclaw gateway restart
|
|
44
24
|
```
|
|
45
25
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
openclaw plugins list
|
|
50
|
-
openclaw plugins doctor
|
|
51
|
-
openclaw gateway status
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
For source-level local development from this repository, use the repo debug scripts or merge this fragment into `~/.openclaw/openclaw.json` so source edits take effect after a gateway restart. This path intentionally points to the source entry `index.ts`, not the built artifact:
|
|
55
|
-
|
|
56
|
-
```json
|
|
57
|
-
{
|
|
58
|
-
"plugins": {
|
|
59
|
-
"load": {
|
|
60
|
-
"paths": ["/path/to/repo/openclaw_plugins/clawpool/index.ts"]
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Apply source-entry changes with:
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
openclaw gateway restart
|
|
70
|
-
openclaw gateway status
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
If you want parity with the published npm package, build first and then install the plugin directory. In this mode OpenClaw loads `dist/index.js` through the package manifest:
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
npm install
|
|
77
|
-
npm run build
|
|
78
|
-
openclaw plugins install -l /path/to/repo/openclaw_plugins/clawpool
|
|
79
|
-
openclaw plugins enable clawpool
|
|
80
|
-
openclaw gateway restart
|
|
81
|
-
openclaw gateway status
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
If you prefer to point `plugins.load.paths` at the compiled file directly, use:
|
|
85
|
-
|
|
86
|
-
```json
|
|
87
|
-
{
|
|
88
|
-
"plugins": {
|
|
89
|
-
"load": {
|
|
90
|
-
"paths": ["/path/to/repo/openclaw_plugins/clawpool/dist/index.js"]
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## Updating
|
|
97
|
-
|
|
98
|
-
If you installed from npm, update the plugin with:
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
openclaw plugins update clawpool
|
|
102
|
-
openclaw gateway restart
|
|
103
|
-
openclaw plugins list
|
|
104
|
-
openclaw plugins doctor
|
|
105
|
-
openclaw gateway status
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
If you installed with `openclaw plugins install -l` from this repository, rebuild the plugin and then restart the gateway:
|
|
26
|
+
## Configure
|
|
109
27
|
|
|
110
|
-
|
|
111
|
-
npm install
|
|
112
|
-
npm run build
|
|
113
|
-
openclaw gateway restart
|
|
114
|
-
openclaw plugins list
|
|
115
|
-
openclaw plugins doctor
|
|
116
|
-
openclaw gateway status
|
|
117
|
-
```
|
|
28
|
+
### `openclaw onboard`
|
|
118
29
|
|
|
119
|
-
|
|
30
|
+
Choose `Clawpool` in channel setup and enter:
|
|
120
31
|
|
|
121
|
-
|
|
32
|
+
- `wsUrl`
|
|
33
|
+
- `agentId`
|
|
34
|
+
- `apiKey`
|
|
122
35
|
|
|
123
|
-
|
|
124
|
-
openclaw onboard
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
In `Channel setup`, choose `Clawpool` and enter `wsUrl`, `agentId`, and `apiKey`.
|
|
128
|
-
|
|
129
|
-
### Option 2: Configure with the CLI
|
|
36
|
+
### `openclaw channels add`
|
|
130
37
|
|
|
131
38
|
```bash
|
|
132
39
|
openclaw channels add \
|
|
133
40
|
--channel clawpool \
|
|
134
41
|
--name clawpool-main \
|
|
135
|
-
--http-url '
|
|
136
|
-
--user-id
|
|
137
|
-
--token '
|
|
42
|
+
--http-url 'wss://clawpool.dhf.pub/v1/agent-api/ws?agent_id=<YOUR_AGENT_ID>' \
|
|
43
|
+
--user-id '<YOUR_AGENT_ID>' \
|
|
44
|
+
--token '<YOUR_API_KEY>'
|
|
138
45
|
```
|
|
139
46
|
|
|
140
|
-
###
|
|
141
|
-
|
|
142
|
-
You can configure it in `~/.openclaw/openclaw.json`:
|
|
47
|
+
### Direct config
|
|
143
48
|
|
|
144
49
|
```json
|
|
145
50
|
{
|
|
146
51
|
"channels": {
|
|
147
52
|
"clawpool": {
|
|
148
53
|
"enabled": true,
|
|
149
|
-
"wsUrl": "
|
|
150
|
-
"agentId": "
|
|
151
|
-
"apiKey": "
|
|
54
|
+
"wsUrl": "wss://clawpool.dhf.pub/v1/agent-api/ws?agent_id=<YOUR_AGENT_ID>",
|
|
55
|
+
"agentId": "<YOUR_AGENT_ID>",
|
|
56
|
+
"apiKey": "<YOUR_API_KEY>"
|
|
152
57
|
}
|
|
153
58
|
}
|
|
154
59
|
}
|
|
155
60
|
```
|
|
156
61
|
|
|
157
|
-
##
|
|
62
|
+
## Native Channel Actions
|
|
158
63
|
|
|
159
|
-
|
|
160
|
-
- `agentId`: ClawPool agent ID
|
|
161
|
-
- `apiKey`: ClawPool agent API key
|
|
162
|
-
- `streamChunkChars`: number of characters per streaming chunk
|
|
163
|
-
- `streamChunkDelayMs`: delay between streaming chunks
|
|
64
|
+
The channel plugin exposes only channel-native message actions:
|
|
164
65
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
```json
|
|
168
|
-
{
|
|
169
|
-
"channels": {
|
|
170
|
-
"clawpool": {
|
|
171
|
-
"streamChunkChars": 8,
|
|
172
|
-
"streamChunkDelayMs": 90
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
```
|
|
66
|
+
- `unsend`
|
|
67
|
+
- `delete`
|
|
177
68
|
|
|
178
69
|
## Environment Variables
|
|
179
70
|
|
|
180
|
-
If you want to provide the default account through environment variables, use:
|
|
181
|
-
|
|
182
71
|
- `CLAWPOOL_WS_URL`
|
|
183
72
|
- `CLAWPOOL_AGENT_ID`
|
|
184
73
|
- `CLAWPOOL_API_KEY`
|
|
185
|
-
|
|
186
|
-
## Recommended After Installation
|
|
187
|
-
|
|
188
|
-
- Run `openclaw plugins doctor` once after the first installation
|
|
189
|
-
- Send at least one real message to confirm the account and network setup are correct
|
|
190
|
-
- After `install` / `enable` / `update` or changes under `plugins.load.paths`, run `openclaw gateway restart`
|
|
191
|
-
- If the gateway is not running yet, start it with `openclaw gateway start`
|
package/dist/index.js
CHANGED
|
@@ -1259,7 +1259,8 @@ async function resolveAibotDeleteTarget(params) {
|
|
|
1259
1259
|
}
|
|
1260
1260
|
|
|
1261
1261
|
// src/actions.ts
|
|
1262
|
-
var
|
|
1262
|
+
var WS_ACTIONS = /* @__PURE__ */ new Set(["unsend", "delete"]);
|
|
1263
|
+
var DISCOVERABLE_ACTIONS = ["unsend", "delete"];
|
|
1263
1264
|
function toSnakeCaseKey(key) {
|
|
1264
1265
|
return key.replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2").replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase();
|
|
1265
1266
|
}
|
|
@@ -1281,14 +1282,24 @@ var aibotMessageActions = {
|
|
|
1281
1282
|
if (!hasConfiguredAccount) {
|
|
1282
1283
|
return [];
|
|
1283
1284
|
}
|
|
1284
|
-
return
|
|
1285
|
+
return DISCOVERABLE_ACTIONS;
|
|
1286
|
+
},
|
|
1287
|
+
supportsAction: ({ action }) => {
|
|
1288
|
+
const normalizedAction = String(action ?? "").trim();
|
|
1289
|
+
return WS_ACTIONS.has(normalizedAction);
|
|
1285
1290
|
},
|
|
1286
|
-
supportsAction: ({ action }) => SUPPORTED_AIBOT_MESSAGE_ACTIONS.has(action),
|
|
1287
1291
|
handleAction: async ({ action, params, cfg, accountId, toolContext }) => {
|
|
1288
|
-
|
|
1289
|
-
|
|
1292
|
+
const normalizedAction = String(action ?? "").trim();
|
|
1293
|
+
if (!WS_ACTIONS.has(normalizedAction)) {
|
|
1294
|
+
throw new Error(`Clawpool action ${normalizedAction} is not supported`);
|
|
1290
1295
|
}
|
|
1291
1296
|
const account = resolveAibotAccount({ cfg, accountId });
|
|
1297
|
+
if (!account.enabled) {
|
|
1298
|
+
throw new Error(`Clawpool account "${account.accountId}" is disabled.`);
|
|
1299
|
+
}
|
|
1300
|
+
if (!account.configured) {
|
|
1301
|
+
throw new Error(`Clawpool account "${account.accountId}" is not configured.`);
|
|
1302
|
+
}
|
|
1292
1303
|
const client = requireActiveAibotClient(account.accountId);
|
|
1293
1304
|
const messageId = readStringishParam(params, "messageId") ?? readStringishParam(params, "msgId");
|
|
1294
1305
|
if (!messageId) {
|
|
@@ -1311,7 +1322,7 @@ var aibotMessageActions = {
|
|
|
1311
1322
|
return jsonResult({
|
|
1312
1323
|
ok: true,
|
|
1313
1324
|
deleted: true,
|
|
1314
|
-
unsent:
|
|
1325
|
+
unsent: normalizedAction === "unsend",
|
|
1315
1326
|
messageId: String(ack.msg_id ?? messageId),
|
|
1316
1327
|
sessionId: String(ack.session_id ?? sessionId)
|
|
1317
1328
|
});
|