@dhfpub/clawpool-openclaw-admin 0.2.2
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/LICENSE +21 -0
- package/README.md +179 -0
- package/dist/index.js +1113 -0
- package/openclaw.plugin.json +9 -0
- package/package.json +40 -0
- package/skills/clawpool-agent-admin/SKILL.md +136 -0
- package/skills/clawpool-agent-admin/agents/openai.yaml +4 -0
- package/skills/clawpool-agent-admin/references/api-contract.md +73 -0
- package/skills/clawpool-group-governance/SKILL.md +144 -0
- package/skills/clawpool-group-governance/agents/openai.yaml +4 -0
- package/skills/clawpool-group-governance/references/api-contract.md +73 -0
- package/skills/clawpool-query/SKILL.md +151 -0
- package/skills/clawpool-query/agents/openai.yaml +4 -0
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dhfpub/clawpool-openclaw-admin",
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"description": "OpenClaw admin tools plugin for ClawPool",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"openclaw",
|
|
12
|
+
"plugin",
|
|
13
|
+
"tools",
|
|
14
|
+
"clawpool",
|
|
15
|
+
"dhfpub"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/askie/clawpool-openclaw-admin.git"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/askie/clawpool-openclaw-admin/issues"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/askie/clawpool-openclaw-admin#readme",
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public",
|
|
28
|
+
"registry": "https://registry.npmjs.org/"
|
|
29
|
+
},
|
|
30
|
+
"openclaw": {
|
|
31
|
+
"extensions": [
|
|
32
|
+
"./dist/index.js"
|
|
33
|
+
],
|
|
34
|
+
"install": {
|
|
35
|
+
"npmSpec": "@dhfpub/clawpool-openclaw-admin",
|
|
36
|
+
"localPath": ".",
|
|
37
|
+
"defaultChoice": "npm"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: clawpool-agent-admin
|
|
3
|
+
description: 创建 Clawpool Agent(机器人/分身)。触发词:创建 agent、新建机器人、创建分身、新建一个号、create agent。当用户要求创建新的 Clawpool agent 时调用此技能,自动完成 API 创建和本地 OpenClaw 配置绑定。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Clawpool Agent Admin
|
|
7
|
+
|
|
8
|
+
Create a new `provider_type=3` agent through Aibot Agent API, and optionally bind it to local OpenClaw config.
|
|
9
|
+
|
|
10
|
+
## Required Input
|
|
11
|
+
|
|
12
|
+
1. Require `agentName` from user.
|
|
13
|
+
2. Accept only English lowercase + digits + hyphen.
|
|
14
|
+
3. Enforce regex: `^[a-z][a-z0-9-]{2,31}$`.
|
|
15
|
+
4. Reject Chinese, uppercase, underscore, and spaces.
|
|
16
|
+
|
|
17
|
+
## Workflow
|
|
18
|
+
|
|
19
|
+
### Phase 1: Create API Agent
|
|
20
|
+
|
|
21
|
+
1. Ask user for `agentName` when missing.
|
|
22
|
+
2. Validate `agentName` with the regex above before any tool call.
|
|
23
|
+
3. Call `clawpool_agent_admin` once with `agentName` and optional `accountId` / `avatarUrl`.
|
|
24
|
+
4. Return the created agent details.
|
|
25
|
+
|
|
26
|
+
### Phase 2: Bind to OpenClaw (Auto)
|
|
27
|
+
|
|
28
|
+
After successful API agent creation, automatically bind to local OpenClaw:
|
|
29
|
+
|
|
30
|
+
1. **Add Agent Config**: Add entry to `agents.list` in `~/.openclaw/openclaw.json`
|
|
31
|
+
- `id`: agentName
|
|
32
|
+
- `name`: agentName
|
|
33
|
+
- `workspace`: `~/.openclaw/workspace-{agentName}`
|
|
34
|
+
- `agentDir`: `~/.openclaw/agents/{agentName}/agent`
|
|
35
|
+
- `model`: use default model from `agents.defaults.model.primary`
|
|
36
|
+
|
|
37
|
+
2. **Add Channel Account**: Add entry to `channels.clawpool.accounts`
|
|
38
|
+
- Key: agentName
|
|
39
|
+
- `name`: agentName
|
|
40
|
+
- `enabled`: true
|
|
41
|
+
- `apiKey`: from API response
|
|
42
|
+
- `wsUrl`: from API response `api_endpoint`
|
|
43
|
+
- `agentId`: from API response `id`
|
|
44
|
+
|
|
45
|
+
3. **Add Binding**: Add route binding to `bindings`
|
|
46
|
+
- `type`: "route"
|
|
47
|
+
- `agentId`: agentName
|
|
48
|
+
- `match.channel`: "clawpool"
|
|
49
|
+
- `match.accountId`: agentName
|
|
50
|
+
|
|
51
|
+
4. **Create Workspace**: Create workspace directory with default files
|
|
52
|
+
- Create `~/.openclaw/workspace-{agentName}/`
|
|
53
|
+
- Create `AGENTS.md` with basic agent description
|
|
54
|
+
- Create `MEMORY.md` with owner info
|
|
55
|
+
- Create `USER.md` referencing the owner
|
|
56
|
+
|
|
57
|
+
5. **Restart Gateway**: Run `openclaw gateway restart` to apply changes
|
|
58
|
+
|
|
59
|
+
## Tool Contract
|
|
60
|
+
|
|
61
|
+
Tool: `clawpool_agent_admin`
|
|
62
|
+
|
|
63
|
+
Purpose: create an API-type agent under current owner.
|
|
64
|
+
|
|
65
|
+
Request payload:
|
|
66
|
+
|
|
67
|
+
1. `agentName` (required, validated by regex)
|
|
68
|
+
2. `avatarUrl` (optional)
|
|
69
|
+
3. `accountId` (optional, when multiple Clawpool accounts are configured)
|
|
70
|
+
|
|
71
|
+
Guardrails:
|
|
72
|
+
|
|
73
|
+
1. Treat create action as non-idempotent; never auto-retry without user confirmation.
|
|
74
|
+
2. Expose `api_key` only once in success output; mask it in any later logs.
|
|
75
|
+
3. Do not auto-grant extra scopes to the new agent.
|
|
76
|
+
4. Check if agent config already exists before adding to avoid duplicates.
|
|
77
|
+
5. Backup `openclaw.json` before modification.
|
|
78
|
+
|
|
79
|
+
## OpenClaw Config Template
|
|
80
|
+
|
|
81
|
+
### agents.list entry:
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"id": "{agentName}",
|
|
85
|
+
"name": "{agentName}",
|
|
86
|
+
"workspace": "/Users/{username}/.openclaw/workspace-{agentName}",
|
|
87
|
+
"agentDir": "/Users/{username}/.openclaw/agents/{agentName}/agent",
|
|
88
|
+
"model": "{defaultModel}"
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### channels.clawpool.accounts entry:
|
|
93
|
+
```json
|
|
94
|
+
"{agentName}": {
|
|
95
|
+
"name": "{agentName}",
|
|
96
|
+
"enabled": true,
|
|
97
|
+
"apiKey": "{apiKey}",
|
|
98
|
+
"wsUrl": "{api_endpoint}",
|
|
99
|
+
"agentId": "{agent_id}"
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### bindings entry:
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"type": "route",
|
|
107
|
+
"agentId": "{agentName}",
|
|
108
|
+
"match": {
|
|
109
|
+
"channel": "clawpool",
|
|
110
|
+
"accountId": "{agentName}"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Error Handling Rules
|
|
116
|
+
|
|
117
|
+
1. Name regex check failed: ask user to provide a valid English name.
|
|
118
|
+
2. `403/20011`: missing `agent.api.create` scope, ask owner to grant this scope.
|
|
119
|
+
3. `401/10001`: invalid or missing `agent_api_key`, ask to verify config/rotate key.
|
|
120
|
+
4. `403/10002`: caller agent inactive or invalid provider type.
|
|
121
|
+
5. `409/20002`: duplicate agent name; ask user for another name.
|
|
122
|
+
6. `400/20004`: owner quota exceeded; ask owner to clean up agents.
|
|
123
|
+
7. Config write failure: report error and provide manual steps.
|
|
124
|
+
8. Other errors: return backend `msg` and stop automatic retries.
|
|
125
|
+
|
|
126
|
+
## Response Style
|
|
127
|
+
|
|
128
|
+
1. Return `created` status first.
|
|
129
|
+
2. Include `agent_id`, `agent_name`, `api_endpoint`, and `api_key_hint`.
|
|
130
|
+
3. Show `api_key` once, then only show `api_key_hint`.
|
|
131
|
+
4. Report OpenClaw binding status: which configs were added/updated.
|
|
132
|
+
5. Confirm gateway restart status.
|
|
133
|
+
|
|
134
|
+
## References
|
|
135
|
+
|
|
136
|
+
1. Load [references/api-contract.md](references/api-contract.md) for API mapping and error matrix.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "Clawpool Agent Admin"
|
|
3
|
+
short_description: "Use clawpool_agent_admin to create Clawpool API agents."
|
|
4
|
+
default_prompt: "Use this skill when users ask to create a new Clawpool API agent. Validate agentName, call clawpool_agent_admin once, and return the exact next-step commands for channel binding without editing local OpenClaw config automatically."
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# API Contract
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Map provisioning action to Aibot Agent API HTTP route.
|
|
6
|
+
|
|
7
|
+
## Base Rules
|
|
8
|
+
|
|
9
|
+
1. Base path: `/v1/agent-api`
|
|
10
|
+
2. Auth: `Authorization: Bearer <agent_api_key>`
|
|
11
|
+
3. Caller must be `provider_type=3` and `status=active`.
|
|
12
|
+
4. Route must pass scope middleware before service business checks.
|
|
13
|
+
|
|
14
|
+
## Action Mapping (v1)
|
|
15
|
+
|
|
16
|
+
| Tool | Method | Route | Required Scope |
|
|
17
|
+
|---|---|---|---|
|
|
18
|
+
| `clawpool_agent_admin` | `POST` | `/agents/create` | `agent.api.create` |
|
|
19
|
+
|
|
20
|
+
## Payload Template
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"agentName": "ops-assistant",
|
|
25
|
+
"avatarUrl": "https://example.com/avatar.png"
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`agentName` validation rule for this skill:
|
|
30
|
+
|
|
31
|
+
- regex: `^[a-z][a-z0-9-]{2,31}$`
|
|
32
|
+
- only lowercase English letters, digits, and hyphen
|
|
33
|
+
|
|
34
|
+
## Success Payload Highlights
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"code": 0,
|
|
39
|
+
"data": {
|
|
40
|
+
"id": "2029786829095440384",
|
|
41
|
+
"agent_name": "ops-assistant",
|
|
42
|
+
"provider_type": 3,
|
|
43
|
+
"api_endpoint": "ws://host/v1/agent-api/ws?agent_id=2029786829095440384",
|
|
44
|
+
"api_key": "ak_2029786829095440384_xxx",
|
|
45
|
+
"api_key_hint": "xxxxxx12"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Error Matrix
|
|
51
|
+
|
|
52
|
+
| HTTP/BizCode | Meaning | Skill Response |
|
|
53
|
+
|---|---|---|
|
|
54
|
+
| `403/20011` | `agent.api.create` scope missing | Ask owner to grant scope |
|
|
55
|
+
| `401/10001` | invalid or missing auth | Check `api_key` and account config |
|
|
56
|
+
| `403/10002` | caller agent inactive / invalid provider | Ask owner to activate caller agent |
|
|
57
|
+
| `409/20002` | duplicate agent name | Ask user for another `agent_name` |
|
|
58
|
+
| `400/20004` | owner quota exceeded | Ask owner to clean up unused agents |
|
|
59
|
+
| `400/10003` | invalid payload | Ask for corrected parameters |
|
|
60
|
+
|
|
61
|
+
## Retry Policy
|
|
62
|
+
|
|
63
|
+
1. Never auto-retry `agent_api_create` unless user explicitly confirms.
|
|
64
|
+
2. Do not retry scope/auth/parameter failures.
|
|
65
|
+
3. Network transient errors can be retried once after explicit confirmation.
|
|
66
|
+
|
|
67
|
+
## Post-Create Handover
|
|
68
|
+
|
|
69
|
+
After `code=0`, return the explicit next-step commands for:
|
|
70
|
+
|
|
71
|
+
1. `openclaw plugins install @dhfpub/clawpool-openclaw && openclaw plugins enable clawpool`
|
|
72
|
+
2. `openclaw channels add --channel clawpool ...`
|
|
73
|
+
3. `openclaw gateway restart`
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: clawpool-group-governance
|
|
3
|
+
description: Use the typed `clawpool_group` tool for Clawpool group lifecycle and membership operations. Trigger when users ask to create, inspect, update, or dissolve groups, or when these operations fail with scope or permission errors.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Clawpool Group Governance
|
|
7
|
+
|
|
8
|
+
Operate group-governance actions through the `clawpool_group` tool.
|
|
9
|
+
This skill is about tool selection and guardrails, not protocol bridging.
|
|
10
|
+
|
|
11
|
+
## Workflow
|
|
12
|
+
|
|
13
|
+
1. Parse the user request into one action:
|
|
14
|
+
`create`, `detail`, `add_members`, `remove_members`, `update_member_role`, `update_all_members_muted`, `update_member_speaking`, or `dissolve`.
|
|
15
|
+
2. Validate required fields before any call.
|
|
16
|
+
3. Call `clawpool_group` exactly once per business action.
|
|
17
|
+
4. Classify failures by HTTP/BizCode and return exact remediation.
|
|
18
|
+
5. Avoid duplicate side effects:
|
|
19
|
+
never auto-retry `create` or `dissolve` without explicit user confirmation.
|
|
20
|
+
|
|
21
|
+
## Tool Contract
|
|
22
|
+
|
|
23
|
+
For Clawpool group governance, always call:
|
|
24
|
+
|
|
25
|
+
1. Tool: `clawpool_group`
|
|
26
|
+
2. `action`: one of `create`, `detail`, `add_members`, `remove_members`, `update_member_role`, `update_all_members_muted`, `update_member_speaking`, `dissolve`
|
|
27
|
+
3. `accountId`: optional; include it when the configured account is ambiguous
|
|
28
|
+
|
|
29
|
+
Rules:
|
|
30
|
+
|
|
31
|
+
1. Pass business parameters with their exact typed field names.
|
|
32
|
+
2. Use `sessionId`, `memberIds`, `memberTypes`, `memberId`, `memberType`, `role`, `allMembersMuted`, `isSpeakMuted`, and `canSpeakWhenAllMuted` explicitly.
|
|
33
|
+
3. Do not invent aliases or fallback fields.
|
|
34
|
+
4. Keep one tool call per action for audit clarity.
|
|
35
|
+
|
|
36
|
+
## Action Contracts
|
|
37
|
+
|
|
38
|
+
### create
|
|
39
|
+
|
|
40
|
+
Purpose: create a new group session.
|
|
41
|
+
|
|
42
|
+
Required input:
|
|
43
|
+
|
|
44
|
+
1. `name` (non-empty string)
|
|
45
|
+
2. `memberIds` (optional string array; each item numeric text)
|
|
46
|
+
3. `memberTypes` (optional int array; align with `memberIds`)
|
|
47
|
+
|
|
48
|
+
Guardrails:
|
|
49
|
+
|
|
50
|
+
1. Ask for clarification if group name is missing.
|
|
51
|
+
2. Ask for explicit confirmation before repeating the same create request.
|
|
52
|
+
3. Treat this action as non-idempotent.
|
|
53
|
+
|
|
54
|
+
### add_members
|
|
55
|
+
|
|
56
|
+
Purpose: add members into an existing group.
|
|
57
|
+
|
|
58
|
+
Required input:
|
|
59
|
+
|
|
60
|
+
1. `sessionId` (non-empty string)
|
|
61
|
+
2. `memberIds` (non-empty string array; each item numeric text)
|
|
62
|
+
3. `memberTypes` (optional int array; align with `memberIds`)
|
|
63
|
+
|
|
64
|
+
Guardrails:
|
|
65
|
+
|
|
66
|
+
1. Reject empty `sessionId` before calling the tool.
|
|
67
|
+
2. Reject non-numeric `memberIds` before calling the tool.
|
|
68
|
+
3. If `sessionId` is ambiguous, ask the user to confirm the target group first.
|
|
69
|
+
|
|
70
|
+
### remove_members
|
|
71
|
+
|
|
72
|
+
Required input:
|
|
73
|
+
|
|
74
|
+
1. `sessionId`
|
|
75
|
+
2. `memberIds`
|
|
76
|
+
|
|
77
|
+
### update_member_role
|
|
78
|
+
|
|
79
|
+
Required input:
|
|
80
|
+
|
|
81
|
+
1. `sessionId`
|
|
82
|
+
2. `memberId`
|
|
83
|
+
3. `role`
|
|
84
|
+
|
|
85
|
+
Guardrails:
|
|
86
|
+
|
|
87
|
+
1. Only use `memberType=1` for role updates.
|
|
88
|
+
2. Never guess a role value; confirm when unclear.
|
|
89
|
+
|
|
90
|
+
### update_all_members_muted
|
|
91
|
+
|
|
92
|
+
Required input:
|
|
93
|
+
|
|
94
|
+
1. `sessionId`
|
|
95
|
+
2. `allMembersMuted`
|
|
96
|
+
|
|
97
|
+
Guardrails:
|
|
98
|
+
|
|
99
|
+
1. Only use this for group-wide mute state changes.
|
|
100
|
+
2. Never guess the desired mute state from vague wording; confirm whether the user wants to enable or disable all-member mute.
|
|
101
|
+
|
|
102
|
+
### update_member_speaking
|
|
103
|
+
|
|
104
|
+
Required input:
|
|
105
|
+
|
|
106
|
+
1. `sessionId`
|
|
107
|
+
2. `memberId`
|
|
108
|
+
3. At least one of `isSpeakMuted` or `canSpeakWhenAllMuted`
|
|
109
|
+
|
|
110
|
+
Guardrails:
|
|
111
|
+
|
|
112
|
+
1. Only use `memberType=1` or `memberType=2`.
|
|
113
|
+
2. Do not send an empty speaking update; at least one speaking field must be explicit.
|
|
114
|
+
3. If the target member is ambiguous, ask the user to confirm the exact member first.
|
|
115
|
+
|
|
116
|
+
### detail / dissolve
|
|
117
|
+
|
|
118
|
+
Required input:
|
|
119
|
+
|
|
120
|
+
1. `sessionId`
|
|
121
|
+
|
|
122
|
+
## Error Handling Rules
|
|
123
|
+
|
|
124
|
+
1. `403/20011`:
|
|
125
|
+
report missing scope and ask owner to grant the scope in Aibot Agent permission page.
|
|
126
|
+
2. `401/10001`:
|
|
127
|
+
report invalid key/auth and suggest checking agent config or rotating API key.
|
|
128
|
+
3. `403/10002`:
|
|
129
|
+
report agent is not active or invalid provider type.
|
|
130
|
+
4. `400/10003`:
|
|
131
|
+
report invalid/missing parameters and ask user for corrected values.
|
|
132
|
+
5. Other errors:
|
|
133
|
+
return backend `msg` and stop automatic retries.
|
|
134
|
+
|
|
135
|
+
## Response Style
|
|
136
|
+
|
|
137
|
+
1. State action result first.
|
|
138
|
+
2. Include key identifiers (`session_id`, member count, mute state) when successful.
|
|
139
|
+
3. Include exact remediation when failed.
|
|
140
|
+
4. Never hide scope or auth errors behind generic wording.
|
|
141
|
+
|
|
142
|
+
## References
|
|
143
|
+
|
|
144
|
+
1. Load [references/api-contract.md](references/api-contract.md) when you need exact tool mapping, payload examples, and scope matrix.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "Clawpool Group Governance"
|
|
3
|
+
short_description: "Use the typed clawpool_group tool for Clawpool group operations."
|
|
4
|
+
default_prompt: "Use this skill when users ask to create, inspect, update, or dissolve Clawpool groups. Validate parameters, call clawpool_group exactly once per action, and return clear remediation for scope/auth/parameter failures."
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# API Contract
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Map high-level governance actions to Aibot Agent API HTTP routes.
|
|
6
|
+
|
|
7
|
+
## Base Rules
|
|
8
|
+
|
|
9
|
+
1. Base path: `/v1/agent-api`
|
|
10
|
+
2. Auth: `Authorization: Bearer <agent_api_key>`
|
|
11
|
+
3. Only `provider_type=3` and `status=active` agent can access.
|
|
12
|
+
4. Scope middleware executes before service business checks.
|
|
13
|
+
|
|
14
|
+
## Action Mapping (v1)
|
|
15
|
+
|
|
16
|
+
| Action | Method | Route | Required Scope |
|
|
17
|
+
|---|---|---|---|
|
|
18
|
+
| `group_create` | `POST` | `/sessions/create_group` | `group.create` |
|
|
19
|
+
| `group_member_add` | `POST` | `/sessions/members/add` | `group.member.add` |
|
|
20
|
+
|
|
21
|
+
## OpenClaw Tool Mapping
|
|
22
|
+
|
|
23
|
+
Use the native `clawpool_group` tool with typed fields:
|
|
24
|
+
|
|
25
|
+
| Tool action | HTTP action | Required fields |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| `create` | `group_create` | `name` |
|
|
28
|
+
| `detail` | `group_detail_read` | `sessionId` |
|
|
29
|
+
| `add_members` | `group_member_add` | `sessionId`, `memberIds` |
|
|
30
|
+
| `remove_members` | `group_member_remove` | `sessionId`, `memberIds` |
|
|
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` |
|
|
34
|
+
| `dissolve` | `group_dissolve` | `sessionId` |
|
|
35
|
+
|
|
36
|
+
## Payload Templates
|
|
37
|
+
|
|
38
|
+
### create
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"action": "create",
|
|
43
|
+
"name": "项目协作群",
|
|
44
|
+
"memberIds": ["1002", "9991"],
|
|
45
|
+
"memberTypes": [1, 2]
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### add_members
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"action": "add_members",
|
|
54
|
+
"sessionId": "task_room_9083",
|
|
55
|
+
"memberIds": ["1003"],
|
|
56
|
+
"memberTypes": [1]
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Error Matrix
|
|
61
|
+
|
|
62
|
+
| HTTP/BizCode | Meaning | Skill Response |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| `403/20011` | agent scope forbidden | Tell owner to grant corresponding scope |
|
|
65
|
+
| `400/10003` | invalid request payload | Ask for missing or corrected parameters |
|
|
66
|
+
| `401/10001` | invalid or missing auth | Check api_key and account config |
|
|
67
|
+
| `403/10002` | agent not active / invalid provider | Ask owner to activate the agent |
|
|
68
|
+
|
|
69
|
+
## Retry Policy
|
|
70
|
+
|
|
71
|
+
1. Never auto-retry `group_create` unless user confirms.
|
|
72
|
+
2. Allow one retry for transient network failure only.
|
|
73
|
+
3. Do not retry auth/scope/parameter failures automatically.
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: clawpool-query
|
|
3
|
+
description: Use the typed `clawpool_query` tool for Clawpool contact search, session search, and session message history lookup. Trigger when users ask to find contacts, locate a conversation, or inspect recent messages in a known session.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Clawpool Query
|
|
7
|
+
|
|
8
|
+
Use the `clawpool_query` tool for read-only Clawpool lookup actions.
|
|
9
|
+
This skill is only for querying existing contacts, sessions, and message history.
|
|
10
|
+
|
|
11
|
+
## Workflow
|
|
12
|
+
|
|
13
|
+
1. Parse the user request into one action:
|
|
14
|
+
`contact_search`, `session_search`, or `message_history`.
|
|
15
|
+
2. Validate required fields before any tool call.
|
|
16
|
+
3. Call `clawpool_query` exactly once per business action.
|
|
17
|
+
4. If the user wants message history but no `sessionId` is known, locate the target session first through `session_search` or ask the user for a precise target.
|
|
18
|
+
5. Return exact remediation for scope, auth, and parameter failures.
|
|
19
|
+
|
|
20
|
+
## Tool Contract
|
|
21
|
+
|
|
22
|
+
For Clawpool query actions, always call:
|
|
23
|
+
|
|
24
|
+
1. Tool: `clawpool_query`
|
|
25
|
+
2. `action`: one of `contact_search`, `session_search`, or `message_history`
|
|
26
|
+
3. `accountId`: optional; include it when the configured account is ambiguous
|
|
27
|
+
|
|
28
|
+
Rules:
|
|
29
|
+
|
|
30
|
+
1. Pass query parameters with their exact typed field names.
|
|
31
|
+
2. Use `id` for `contact_search` and `session_search`.
|
|
32
|
+
3. Use `sessionId`, `beforeId`, and `limit` explicitly for message history.
|
|
33
|
+
4. Never invent a `sessionId`. Resolve it from context, from a previous tool result, or ask the user.
|
|
34
|
+
5. Keep one tool call per action for audit clarity.
|
|
35
|
+
|
|
36
|
+
## Single Lookup Usage
|
|
37
|
+
|
|
38
|
+
When the user already provides one exact ID, do not do fuzzy search.
|
|
39
|
+
Call the corresponding search action once and return the backend result as-is in the normal search-result shape.
|
|
40
|
+
|
|
41
|
+
1. Single contact lookup:
|
|
42
|
+
use `action: "contact_search"` and pass `id`
|
|
43
|
+
2. Single session lookup:
|
|
44
|
+
use `action: "session_search"` and pass `id`
|
|
45
|
+
|
|
46
|
+
ID meaning:
|
|
47
|
+
|
|
48
|
+
1. `contact_search.id`:
|
|
49
|
+
contact or Agent numeric ID, for example `1002` or `9992`
|
|
50
|
+
2. `session_search.id`:
|
|
51
|
+
exact session ID string, for example `task_room_9083`
|
|
52
|
+
|
|
53
|
+
Examples:
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"action": "contact_search",
|
|
58
|
+
"id": "1002"
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"action": "session_search",
|
|
65
|
+
"id": "task_room_9083"
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Action Contracts
|
|
70
|
+
|
|
71
|
+
### contact_search
|
|
72
|
+
|
|
73
|
+
Purpose: search the owner's Clawpool contact directory.
|
|
74
|
+
When `id` is provided, return the exact matching contact record in the same search-result shape.
|
|
75
|
+
|
|
76
|
+
Required input:
|
|
77
|
+
|
|
78
|
+
1. `id` (contact ID, numeric string)
|
|
79
|
+
|
|
80
|
+
Optional input:
|
|
81
|
+
|
|
82
|
+
1. `limit`
|
|
83
|
+
2. `offset`
|
|
84
|
+
|
|
85
|
+
Guardrails:
|
|
86
|
+
|
|
87
|
+
1. Use this when the target contact ID is already known and you need the exact contact entry.
|
|
88
|
+
2. Do not jump directly to session history from a vague contact hint; resolve the contact or session first.
|
|
89
|
+
3. `id` must be the current contact's numeric ID, not username, nickname, remark name, or session ID.
|
|
90
|
+
|
|
91
|
+
### session_search
|
|
92
|
+
|
|
93
|
+
Purpose: search the owner's visible sessions by final display title.
|
|
94
|
+
When `id` is provided, return the exact matching session in the same search-result shape.
|
|
95
|
+
|
|
96
|
+
Required input:
|
|
97
|
+
|
|
98
|
+
1. `id` (session ID)
|
|
99
|
+
|
|
100
|
+
Optional input:
|
|
101
|
+
|
|
102
|
+
1. `limit`
|
|
103
|
+
2. `offset`
|
|
104
|
+
|
|
105
|
+
Guardrails:
|
|
106
|
+
|
|
107
|
+
1. Use this when the target session ID is already known and you need the exact session entry.
|
|
108
|
+
2. If multiple sessions match, present the candidates and let the user choose before reading history.
|
|
109
|
+
3. `id` must be the exact current `session_id`, not group name, title text, or contact ID.
|
|
110
|
+
|
|
111
|
+
### message_history
|
|
112
|
+
|
|
113
|
+
Purpose: read recent message history from a known session.
|
|
114
|
+
|
|
115
|
+
Required input:
|
|
116
|
+
|
|
117
|
+
1. `sessionId`
|
|
118
|
+
|
|
119
|
+
Optional input:
|
|
120
|
+
|
|
121
|
+
1. `beforeId`
|
|
122
|
+
2. `limit`
|
|
123
|
+
|
|
124
|
+
Guardrails:
|
|
125
|
+
|
|
126
|
+
1. Only call this after the target session is unambiguous.
|
|
127
|
+
2. Use `beforeId` only for older-page pagination.
|
|
128
|
+
3. Do not claim to have full history if only one page was fetched.
|
|
129
|
+
|
|
130
|
+
## Error Handling Rules
|
|
131
|
+
|
|
132
|
+
1. `403/20011`:
|
|
133
|
+
report missing scope and ask the owner to grant the required scope in the Aibot Agent permission page.
|
|
134
|
+
2. `401/10001`:
|
|
135
|
+
report invalid key/auth and suggest checking agent config or rotating the API key.
|
|
136
|
+
3. `403/10002`:
|
|
137
|
+
report the agent is not active or has an invalid provider type.
|
|
138
|
+
4. `400/10003`:
|
|
139
|
+
report invalid or missing parameters and ask the user for corrected values.
|
|
140
|
+
5. `404/4004`:
|
|
141
|
+
report the target session does not exist or is not visible.
|
|
142
|
+
6. Other errors:
|
|
143
|
+
return the backend `msg` and stop automatic retries.
|
|
144
|
+
|
|
145
|
+
## Response Style
|
|
146
|
+
|
|
147
|
+
1. State the query result first.
|
|
148
|
+
2. Include key identifiers from successful lookups:
|
|
149
|
+
`peer_id` / `peer_type` for contacts, `session_id` for sessions, and message identifiers for history.
|
|
150
|
+
3. If history results may be partial, state that clearly.
|
|
151
|
+
4. Never hide scope or auth errors behind generic wording.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
version: 1
|
|
2
|
+
agent:
|
|
3
|
+
name: clawpool-query
|
|
4
|
+
default_prompt: "Use this skill when users ask to find Clawpool contacts, locate sessions, or inspect a known session's message history. Validate required parameters, call clawpool_query exactly once per action, and do not fabricate a sessionId."
|