@dhfpub/clawpool 0.1.1 → 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 +29 -100
- package/dist/index.js +17 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,144 +1,73 @@
|
|
|
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
|
|
42
22
|
openclaw plugins enable clawpool
|
|
23
|
+
openclaw gateway restart
|
|
43
24
|
```
|
|
44
25
|
|
|
45
|
-
|
|
26
|
+
## Configure
|
|
46
27
|
|
|
47
|
-
|
|
48
|
-
openclaw plugins list
|
|
49
|
-
openclaw plugins doctor
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
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:
|
|
28
|
+
### `openclaw onboard`
|
|
53
29
|
|
|
54
|
-
|
|
55
|
-
{
|
|
56
|
-
"plugins": {
|
|
57
|
-
"load": {
|
|
58
|
-
"paths": ["/path/to/repo/openclaw_plugins/clawpool/index.ts"]
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
If you prefer a packaged install instead of source debugging, build first and then install the plugin directory:
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
npm install
|
|
68
|
-
npm run build
|
|
69
|
-
openclaw plugins install -l /path/to/repo/openclaw_plugins/clawpool
|
|
70
|
-
openclaw plugins enable clawpool
|
|
71
|
-
```
|
|
30
|
+
Choose `Clawpool` in channel setup and enter:
|
|
72
31
|
|
|
73
|
-
|
|
32
|
+
- `wsUrl`
|
|
33
|
+
- `agentId`
|
|
34
|
+
- `apiKey`
|
|
74
35
|
|
|
75
|
-
###
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
openclaw onboard
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
In `Channel setup`, choose `Clawpool` and enter `wsUrl`, `agentId`, and `apiKey`.
|
|
82
|
-
|
|
83
|
-
### Option 2: Configure with the CLI
|
|
36
|
+
### `openclaw channels add`
|
|
84
37
|
|
|
85
38
|
```bash
|
|
86
39
|
openclaw channels add \
|
|
87
40
|
--channel clawpool \
|
|
88
41
|
--name clawpool-main \
|
|
89
|
-
--http-url '
|
|
90
|
-
--user-id
|
|
91
|
-
--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>'
|
|
92
45
|
```
|
|
93
46
|
|
|
94
|
-
###
|
|
95
|
-
|
|
96
|
-
You can configure it in `~/.openclaw/openclaw.json`:
|
|
47
|
+
### Direct config
|
|
97
48
|
|
|
98
49
|
```json
|
|
99
50
|
{
|
|
100
51
|
"channels": {
|
|
101
52
|
"clawpool": {
|
|
102
53
|
"enabled": true,
|
|
103
|
-
"wsUrl": "
|
|
104
|
-
"agentId": "
|
|
105
|
-
"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>"
|
|
106
57
|
}
|
|
107
58
|
}
|
|
108
59
|
}
|
|
109
60
|
```
|
|
110
61
|
|
|
111
|
-
##
|
|
112
|
-
|
|
113
|
-
- `wsUrl`: ClawPool agent WebSocket endpoint
|
|
114
|
-
- `agentId`: ClawPool agent ID
|
|
115
|
-
- `apiKey`: ClawPool agent API key
|
|
116
|
-
- `streamChunkChars`: number of characters per streaming chunk
|
|
117
|
-
- `streamChunkDelayMs`: delay between streaming chunks
|
|
62
|
+
## Native Channel Actions
|
|
118
63
|
|
|
119
|
-
|
|
64
|
+
The channel plugin exposes only channel-native message actions:
|
|
120
65
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
"channels": {
|
|
124
|
-
"clawpool": {
|
|
125
|
-
"streamChunkChars": 8,
|
|
126
|
-
"streamChunkDelayMs": 90
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
```
|
|
66
|
+
- `unsend`
|
|
67
|
+
- `delete`
|
|
131
68
|
|
|
132
69
|
## Environment Variables
|
|
133
70
|
|
|
134
|
-
If you want to provide the default account through environment variables, use:
|
|
135
|
-
|
|
136
71
|
- `CLAWPOOL_WS_URL`
|
|
137
72
|
- `CLAWPOOL_AGENT_ID`
|
|
138
73
|
- `CLAWPOOL_API_KEY`
|
|
139
|
-
|
|
140
|
-
## Recommended After Installation
|
|
141
|
-
|
|
142
|
-
- Run `openclaw plugins doctor` once after the first installation
|
|
143
|
-
- Send at least one real message to confirm the account and network setup are correct
|
|
144
|
-
- If you change ClawPool channel settings, restart the OpenClaw gateway to apply them
|
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
|
});
|