@dhfpub/clawpool-admin 0.1.1 → 0.2.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
CHANGED
|
@@ -7,6 +7,16 @@ It is intentionally separate from the channel transport plugin:
|
|
|
7
7
|
- `@dhfpub/clawpool`: channel transport only
|
|
8
8
|
- `@dhfpub/clawpool-admin`: admin tools and CLI only
|
|
9
9
|
|
|
10
|
+
If you are reading the channel plugin documentation first, also read:
|
|
11
|
+
|
|
12
|
+
- `openclaw_plugins/clawpool/README.md`
|
|
13
|
+
|
|
14
|
+
## Which Package Do I Need?
|
|
15
|
+
|
|
16
|
+
- Install only `@dhfpub/clawpool` when you only need ClawPool channel transport, website onboarding, and the bundled onboarding skill
|
|
17
|
+
- Install both `@dhfpub/clawpool` and `@dhfpub/clawpool-admin` when you want typed group governance or typed API-agent admin actions inside OpenClaw
|
|
18
|
+
- Do not install only `@dhfpub/clawpool-admin` and expect it to work alone, because it depends on the `channels.clawpool` credentials managed by `@dhfpub/clawpool`
|
|
19
|
+
|
|
10
20
|
## Install
|
|
11
21
|
|
|
12
22
|
```bash
|
|
@@ -17,6 +27,18 @@ openclaw gateway restart
|
|
|
17
27
|
|
|
18
28
|
The admin plugin reads credentials from the configured `channels.clawpool` account. Install and configure `@dhfpub/clawpool` first.
|
|
19
29
|
|
|
30
|
+
Recommended order:
|
|
31
|
+
|
|
32
|
+
1. Install and configure `@dhfpub/clawpool`
|
|
33
|
+
2. Confirm `channels.clawpool` is healthy
|
|
34
|
+
3. Install and enable `@dhfpub/clawpool-admin`
|
|
35
|
+
4. Enable the required `tools` block
|
|
36
|
+
5. Restart the OpenClaw gateway
|
|
37
|
+
|
|
38
|
+
For the channel-side setup flow, see:
|
|
39
|
+
|
|
40
|
+
- `openclaw_plugins/clawpool/README.md`
|
|
41
|
+
|
|
20
42
|
## Required OpenClaw Setup
|
|
21
43
|
|
|
22
44
|
`@dhfpub/clawpool-admin` is not enough by itself. For the tools to be callable inside OpenClaw, you must complete all of these steps:
|
|
@@ -126,6 +148,8 @@ Typed group governance tool with these actions:
|
|
|
126
148
|
- `add_members`
|
|
127
149
|
- `remove_members`
|
|
128
150
|
- `update_member_role`
|
|
151
|
+
- `update_all_members_muted`
|
|
152
|
+
- `update_member_speaking`
|
|
129
153
|
- `dissolve`
|
|
130
154
|
|
|
131
155
|
### `clawpool_agent_admin`
|
package/dist/index.js
CHANGED
|
@@ -87,6 +87,32 @@ function readRequiredInt(params, key) {
|
|
|
87
87
|
}
|
|
88
88
|
return value;
|
|
89
89
|
}
|
|
90
|
+
function readOptionalBool(params, key) {
|
|
91
|
+
const raw = readRawParam(params, key);
|
|
92
|
+
if (raw == null) {
|
|
93
|
+
return void 0;
|
|
94
|
+
}
|
|
95
|
+
if (typeof raw === "boolean") {
|
|
96
|
+
return raw;
|
|
97
|
+
}
|
|
98
|
+
if (typeof raw === "number") {
|
|
99
|
+
if (raw === 1) return true;
|
|
100
|
+
if (raw === 0) return false;
|
|
101
|
+
}
|
|
102
|
+
if (typeof raw === "string") {
|
|
103
|
+
const normalized = raw.trim().toLowerCase();
|
|
104
|
+
if (normalized === "true" || normalized === "1") return true;
|
|
105
|
+
if (normalized === "false" || normalized === "0") return false;
|
|
106
|
+
}
|
|
107
|
+
throw new Error(`Clawpool action ${key} must be a boolean.`);
|
|
108
|
+
}
|
|
109
|
+
function readRequiredBool(params, key) {
|
|
110
|
+
const value = readOptionalBool(params, key);
|
|
111
|
+
if (value == null) {
|
|
112
|
+
throw new Error(`Clawpool action requires ${key}.`);
|
|
113
|
+
}
|
|
114
|
+
return value;
|
|
115
|
+
}
|
|
90
116
|
function ensureMemberTypes(types) {
|
|
91
117
|
for (const memberType of types) {
|
|
92
118
|
if (memberType !== 1 && memberType !== 2) {
|
|
@@ -99,6 +125,11 @@ function ensureMemberType(memberType) {
|
|
|
99
125
|
throw new Error("Clawpool action member_type only supports 1 for role update.");
|
|
100
126
|
}
|
|
101
127
|
}
|
|
128
|
+
function ensureSpeakingMemberType(memberType) {
|
|
129
|
+
if (memberType !== 1 && memberType !== 2) {
|
|
130
|
+
throw new Error("Clawpool action member_type only supports 1 (human) or 2 (agent).");
|
|
131
|
+
}
|
|
132
|
+
}
|
|
102
133
|
function buildGroupCreateRequest(params) {
|
|
103
134
|
const name = readRequiredStringParam(params, "name");
|
|
104
135
|
const memberIDs = readNumericIDArray(params, "memberIds", false);
|
|
@@ -206,6 +237,52 @@ function buildGroupDissolveRequest(params) {
|
|
|
206
237
|
}
|
|
207
238
|
};
|
|
208
239
|
}
|
|
240
|
+
function buildGroupAllMembersMutedUpdateRequest(params) {
|
|
241
|
+
const sessionID = readRequiredStringParam(params, "sessionId");
|
|
242
|
+
const allMembersMuted = readRequiredBool(params, "allMembersMuted");
|
|
243
|
+
return {
|
|
244
|
+
actionName: "group_all_members_muted_update",
|
|
245
|
+
method: "POST",
|
|
246
|
+
path: "/sessions/speaking/all_muted",
|
|
247
|
+
body: {
|
|
248
|
+
session_id: sessionID,
|
|
249
|
+
all_members_muted: allMembersMuted
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
function buildGroupMemberSpeakingUpdateRequest(params) {
|
|
254
|
+
const sessionID = readRequiredStringParam(params, "sessionId");
|
|
255
|
+
const memberID = readRequiredStringParam(params, "memberId");
|
|
256
|
+
if (!/^\d+$/.test(memberID)) {
|
|
257
|
+
throw new Error("Clawpool action memberId must be numeric.");
|
|
258
|
+
}
|
|
259
|
+
const memberType = readOptionalInt(params, "memberType") ?? 1;
|
|
260
|
+
ensureSpeakingMemberType(memberType);
|
|
261
|
+
const isSpeakMuted = readOptionalBool(params, "isSpeakMuted");
|
|
262
|
+
const canSpeakWhenAllMuted = readOptionalBool(params, "canSpeakWhenAllMuted");
|
|
263
|
+
if (isSpeakMuted == null && canSpeakWhenAllMuted == null) {
|
|
264
|
+
throw new Error(
|
|
265
|
+
"Clawpool action update_member_speaking requires isSpeakMuted or canSpeakWhenAllMuted."
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
const body = {
|
|
269
|
+
session_id: sessionID,
|
|
270
|
+
member_id: memberID,
|
|
271
|
+
member_type: memberType
|
|
272
|
+
};
|
|
273
|
+
if (isSpeakMuted != null) {
|
|
274
|
+
body.is_speak_muted = isSpeakMuted;
|
|
275
|
+
}
|
|
276
|
+
if (canSpeakWhenAllMuted != null) {
|
|
277
|
+
body.can_speak_when_all_muted = canSpeakWhenAllMuted;
|
|
278
|
+
}
|
|
279
|
+
return {
|
|
280
|
+
actionName: "group_member_speaking_update",
|
|
281
|
+
method: "POST",
|
|
282
|
+
path: "/sessions/members/speaking",
|
|
283
|
+
body
|
|
284
|
+
};
|
|
285
|
+
}
|
|
209
286
|
function buildGroupDetailReadRequest(params) {
|
|
210
287
|
const sessionID = readRequiredStringParam(params, "sessionId");
|
|
211
288
|
return {
|
|
@@ -246,6 +323,10 @@ function buildAgentHTTPRequest(action, params) {
|
|
|
246
323
|
return buildGroupMemberRemoveRequest(params);
|
|
247
324
|
case "group_member_role_update":
|
|
248
325
|
return buildGroupMemberRoleUpdateRequest(params);
|
|
326
|
+
case "group_all_members_muted_update":
|
|
327
|
+
return buildGroupAllMembersMutedUpdateRequest(params);
|
|
328
|
+
case "group_member_speaking_update":
|
|
329
|
+
return buildGroupMemberSpeakingUpdateRequest(params);
|
|
249
330
|
case "group_dissolve":
|
|
250
331
|
return buildGroupDissolveRequest(params);
|
|
251
332
|
case "group_detail_read":
|
|
@@ -668,6 +749,10 @@ function mapGroupActionToRequestAction(action) {
|
|
|
668
749
|
return "group_member_remove";
|
|
669
750
|
case "update_member_role":
|
|
670
751
|
return "group_member_role_update";
|
|
752
|
+
case "update_all_members_muted":
|
|
753
|
+
return "group_all_members_muted_update";
|
|
754
|
+
case "update_member_speaking":
|
|
755
|
+
return "group_member_speaking_update";
|
|
671
756
|
case "dissolve":
|
|
672
757
|
return "group_dissolve";
|
|
673
758
|
default:
|
|
@@ -770,6 +855,35 @@ var ClawpoolGroupToolSchema = {
|
|
|
770
855
|
},
|
|
771
856
|
required: ["action", "sessionId", "memberId", "role"]
|
|
772
857
|
},
|
|
858
|
+
{
|
|
859
|
+
type: "object",
|
|
860
|
+
additionalProperties: false,
|
|
861
|
+
properties: {
|
|
862
|
+
action: { const: "update_all_members_muted" },
|
|
863
|
+
accountId: { type: "string", minLength: 1 },
|
|
864
|
+
sessionId: { type: "string", minLength: 1 },
|
|
865
|
+
allMembersMuted: { type: "boolean" }
|
|
866
|
+
},
|
|
867
|
+
required: ["action", "sessionId", "allMembersMuted"]
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
type: "object",
|
|
871
|
+
additionalProperties: false,
|
|
872
|
+
properties: {
|
|
873
|
+
action: { const: "update_member_speaking" },
|
|
874
|
+
accountId: { type: "string", minLength: 1 },
|
|
875
|
+
sessionId: { type: "string", minLength: 1 },
|
|
876
|
+
memberId: numericIdSchema,
|
|
877
|
+
memberType: { type: "integer", enum: [1, 2] },
|
|
878
|
+
isSpeakMuted: { type: "boolean" },
|
|
879
|
+
canSpeakWhenAllMuted: { type: "boolean" }
|
|
880
|
+
},
|
|
881
|
+
required: ["action", "sessionId", "memberId"],
|
|
882
|
+
anyOf: [
|
|
883
|
+
{ required: ["isSpeakMuted"] },
|
|
884
|
+
{ required: ["canSpeakWhenAllMuted"] }
|
|
885
|
+
]
|
|
886
|
+
},
|
|
773
887
|
{
|
|
774
888
|
type: "object",
|
|
775
889
|
additionalProperties: false,
|
package/package.json
CHANGED
|
@@ -29,6 +29,8 @@ Use the native `clawpool_group` tool with typed fields:
|
|
|
29
29
|
| `add_members` | `group_member_add` | `sessionId`, `memberIds` |
|
|
30
30
|
| `remove_members` | `group_member_remove` | `sessionId`, `memberIds` |
|
|
31
31
|
| `update_member_role` | `group_member_role_update` | `sessionId`, `memberId`, `role` |
|
|
32
|
+
| `update_all_members_muted` | `group_all_members_muted_update` | `sessionId`, `allMembersMuted` |
|
|
33
|
+
| `update_member_speaking` | `group_member_speaking_update` | `sessionId`, `memberId`, `isSpeakMuted` or `canSpeakWhenAllMuted` |
|
|
32
34
|
| `dissolve` | `group_dissolve` | `sessionId` |
|
|
33
35
|
|
|
34
36
|
## Payload Templates
|