@dhf-openclaw/grix 0.4.9 → 0.4.11
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 +137 -191
- package/dist/index.js +1279 -1
- package/package.json +4 -6
- package/skills/grix-admin/SKILL.md +81 -0
- package/skills/grix-admin/references/api-contract.md +106 -0
- package/skills/grix-admin/scripts/grix_agent_bind.py +587 -0
- package/skills/grix-egg/SKILL.md +170 -0
- package/skills/grix-egg/references/api-contract.md +38 -0
- package/skills/grix-group/SKILL.md +144 -0
- package/skills/grix-group/references/api-contract.md +73 -0
- package/skills/grix-query/SKILL.md +151 -0
- package/skills/grix-register/SKILL.md +80 -0
- package/skills/grix-register/references/api-contract.md +71 -0
- package/skills/grix-register/references/grix-concepts.md +26 -0
- package/skills/grix-register/references/handoff-contract.md +24 -0
- package/skills/grix-register/references/openclaw-setup.md +6 -0
- package/skills/grix-register/references/user-replies.md +25 -0
- package/skills/grix-register/scripts/grix_auth.py +453 -0
package/README.md
CHANGED
|
@@ -1,77 +1,46 @@
|
|
|
1
|
-
# OpenClaw Grix
|
|
1
|
+
# OpenClaw Grix 插件
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
把 OpenClaw 接到 Grix(`grix.dhf.pub`)的统一插件,包含:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- Grix Channel(收发消息、流式回复、`unsend`、`delete`)
|
|
6
|
+
- 管理工具:`grix_query`、`grix_group`、`grix_agent_admin`
|
|
7
|
+
- 运维命令:`openclaw grix doctor`、`openclaw grix create-agent`
|
|
8
|
+
- 内置技能包(`skills/`)
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
## 兼容性
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
- `OpenClaw >= 2026.3.23-1`
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
- receive inbound messages
|
|
13
|
-
- send replies, media, and streaming chunks
|
|
14
|
-
- support native channel actions such as `unsend` / `delete`
|
|
14
|
+
## 5 分钟安装(推荐)
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
For full group-governance and API-agent admin capability, OpenClaw also needs the separate typed admin plugin:
|
|
19
|
-
|
|
20
|
-
- `@dhf-openclaw/grix-admin`
|
|
21
|
-
|
|
22
|
-
If you are reading the admin plugin documentation first, also read the companion Grix admin plugin README.
|
|
23
|
-
|
|
24
|
-
## Which Package Do I Need?
|
|
25
|
-
|
|
26
|
-
- Install only `@dhf-openclaw/grix` when you only need Grix channel transport and bundled helper skills
|
|
27
|
-
- Install both `@dhf-openclaw/grix` and `@dhf-openclaw/grix-admin` when you want OpenClaw agents to use typed group governance or API-agent admin tools
|
|
28
|
-
- Never install only `@dhf-openclaw/grix-admin` without configuring `@dhf-openclaw/grix` first, because the admin plugin reads credentials from `channels.grix`
|
|
29
|
-
|
|
30
|
-
## Install
|
|
31
|
-
|
|
32
|
-
Before install, confirm your local OpenClaw version is greater than or equal to `2026.3.13`.
|
|
33
|
-
|
|
34
|
-
### Base Channel Transport
|
|
16
|
+
### 1) 安装并启用插件
|
|
35
17
|
|
|
36
18
|
```bash
|
|
37
19
|
openclaw plugins install @dhf-openclaw/grix
|
|
38
20
|
openclaw plugins enable grix
|
|
39
|
-
openclaw gateway restart
|
|
40
21
|
```
|
|
41
22
|
|
|
42
|
-
###
|
|
23
|
+
### 2) 绑定 Grix Channel
|
|
43
24
|
|
|
44
|
-
|
|
25
|
+
用你已有的 Grix API agent 信息执行:
|
|
45
26
|
|
|
46
27
|
```bash
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
openclaw plugins install ./grix.ts
|
|
28
|
+
openclaw channels add \
|
|
29
|
+
--channel grix \
|
|
30
|
+
--name grix-main \
|
|
31
|
+
--http-url "wss://grix.dhf.pub/v1/agent-api/ws?agent_id={agent_id}" \
|
|
32
|
+
--user-id "<YOUR_AGENT_ID>" \
|
|
33
|
+
--token "<YOUR_API_KEY>"
|
|
54
34
|
```
|
|
55
35
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
For native group-management capability inside OpenClaw, also install the admin plugin and enable the required tools:
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
openclaw plugins install @dhf-openclaw/grix-admin
|
|
62
|
-
openclaw plugins enable grix-admin
|
|
63
|
-
openclaw gateway restart
|
|
64
|
-
```
|
|
36
|
+
说明:
|
|
65
37
|
|
|
66
|
-
|
|
38
|
+
- `--http-url` 可以带 `agent_id`,也可以不带。不带时会自动按 `--user-id` 补上。
|
|
39
|
+
- `--name` 是本地账户名,可自定义(如 `ops`、`prod`)。
|
|
67
40
|
|
|
68
|
-
|
|
69
|
-
2. Confirm `channels.grix` is healthy
|
|
70
|
-
3. Install and enable `@dhf-openclaw/grix-admin`
|
|
71
|
-
4. Enable the required `tools` block
|
|
72
|
-
5. Restart the OpenClaw gateway
|
|
41
|
+
### 3) 开放工具权限
|
|
73
42
|
|
|
74
|
-
|
|
43
|
+
在 OpenClaw 配置里确保有:
|
|
75
44
|
|
|
76
45
|
```json
|
|
77
46
|
{
|
|
@@ -79,6 +48,7 @@ If you need the detailed admin-side requirements, see the companion Grix admin p
|
|
|
79
48
|
"profile": "coding",
|
|
80
49
|
"alsoAllow": [
|
|
81
50
|
"message",
|
|
51
|
+
"grix_query",
|
|
82
52
|
"grix_group",
|
|
83
53
|
"grix_agent_admin"
|
|
84
54
|
],
|
|
@@ -89,41 +59,31 @@ If you need the detailed admin-side requirements, see the companion Grix admin p
|
|
|
89
59
|
}
|
|
90
60
|
```
|
|
91
61
|
|
|
92
|
-
|
|
62
|
+
### 4) 重启网关
|
|
93
63
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
`egg-install` is bundled in `@dhf-openclaw/grix-admin` so install the admin plugin when you need Shrimp Pond install workflow.
|
|
64
|
+
```bash
|
|
65
|
+
openclaw gateway restart
|
|
66
|
+
```
|
|
98
67
|
|
|
99
|
-
|
|
68
|
+
### 5) 验证安装结果
|
|
100
69
|
|
|
101
70
|
```bash
|
|
71
|
+
openclaw plugins info grix --json
|
|
72
|
+
openclaw grix doctor
|
|
102
73
|
openclaw skills list
|
|
103
74
|
```
|
|
104
75
|
|
|
105
|
-
|
|
76
|
+
预期:
|
|
106
77
|
|
|
107
|
-
|
|
78
|
+
- `grix` 插件已启用
|
|
79
|
+
- `doctor` 能看到可用账户
|
|
80
|
+
- `skills list` 能看到本插件内置技能
|
|
108
81
|
|
|
109
|
-
|
|
82
|
+
## 配置参数说明(完整)
|
|
110
83
|
|
|
111
|
-
|
|
112
|
-
- `agentId`
|
|
113
|
-
- `apiKey`
|
|
84
|
+
`channels.grix` 支持“单账户”或“多账户(accounts)”两种写法。
|
|
114
85
|
|
|
115
|
-
###
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
openclaw channels add \
|
|
119
|
-
--channel grix \
|
|
120
|
-
--name grix-main \
|
|
121
|
-
--http-url 'wss://grix.dhf.pub/v1/agent-api/ws?agent_id=<YOUR_AGENT_ID>' \
|
|
122
|
-
--user-id '<YOUR_AGENT_ID>' \
|
|
123
|
-
--token '<YOUR_API_KEY>'
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### Direct config
|
|
86
|
+
### 最小可用配置(单账户)
|
|
127
87
|
|
|
128
88
|
```json
|
|
129
89
|
{
|
|
@@ -134,68 +94,126 @@ openclaw channels add \
|
|
|
134
94
|
"agentId": "<YOUR_AGENT_ID>",
|
|
135
95
|
"apiKey": "<YOUR_API_KEY>"
|
|
136
96
|
}
|
|
137
|
-
},
|
|
138
|
-
"tools": {
|
|
139
|
-
"profile": "coding",
|
|
140
|
-
"alsoAllow": [
|
|
141
|
-
"message",
|
|
142
|
-
"grix_group",
|
|
143
|
-
"grix_agent_admin"
|
|
144
|
-
],
|
|
145
|
-
"sessions": {
|
|
146
|
-
"visibility": "agent"
|
|
147
|
-
}
|
|
148
97
|
}
|
|
149
98
|
}
|
|
150
99
|
```
|
|
151
100
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
## Exec Approvals
|
|
155
|
-
|
|
156
|
-
Grix can approve OpenClaw host `exec` requests in chat.
|
|
157
|
-
|
|
158
|
-
`exec` approvals only require `@dhf-openclaw/grix`. They do not require `@dhf-openclaw/grix-admin`.
|
|
159
|
-
|
|
160
|
-
### 1. Configure Grix approvers
|
|
161
|
-
|
|
162
|
-
Add the Grix sender ids that are allowed to approve:
|
|
101
|
+
### 多账户配置示例
|
|
163
102
|
|
|
164
103
|
```json
|
|
165
104
|
{
|
|
166
105
|
"channels": {
|
|
167
106
|
"grix": {
|
|
168
|
-
"
|
|
169
|
-
|
|
170
|
-
|
|
107
|
+
"enabled": true,
|
|
108
|
+
"defaultAccount": "ops",
|
|
109
|
+
"accounts": {
|
|
110
|
+
"ops": {
|
|
111
|
+
"enabled": true,
|
|
112
|
+
"name": "Ops",
|
|
113
|
+
"wsUrl": "wss://grix.dhf.pub/v1/agent-api/ws?agent_id=<OPS_AGENT_ID>",
|
|
114
|
+
"agentId": "<OPS_AGENT_ID>",
|
|
115
|
+
"apiKey": "<OPS_API_KEY>"
|
|
116
|
+
},
|
|
117
|
+
"prod": {
|
|
118
|
+
"enabled": true,
|
|
119
|
+
"wsUrl": "wss://grix.dhf.pub/v1/agent-api/ws?agent_id=<PROD_AGENT_ID>",
|
|
120
|
+
"agentId": "<PROD_AGENT_ID>",
|
|
121
|
+
"apiKey": "<PROD_API_KEY>"
|
|
122
|
+
}
|
|
171
123
|
}
|
|
172
124
|
}
|
|
173
125
|
}
|
|
174
126
|
}
|
|
175
127
|
```
|
|
176
128
|
|
|
177
|
-
|
|
129
|
+
### 字段说明
|
|
130
|
+
|
|
131
|
+
| 字段 | 必填 | 默认值 | 说明 |
|
|
132
|
+
| --- | --- | --- | --- |
|
|
133
|
+
| `enabled` | 否 | `true` | 全局开关。设为 `false` 后该通道停用。 |
|
|
134
|
+
| `defaultAccount` | 否 | 自动选择 | 多账户时默认账户 ID。 |
|
|
135
|
+
| `accounts.<id>` | 否 | - | 多账户配置项,`<id>` 自定义(如 `ops`)。 |
|
|
136
|
+
| `name` | 否 | - | 账户显示名。 |
|
|
137
|
+
| `wsUrl` | 是(可用环境变量兜底) | `ws://127.0.0.1:27189/...`(当有 `agentId` 且未填时) | Grix WebSocket 地址。 |
|
|
138
|
+
| `agentId` | 是(可用环境变量兜底) | - | Grix agent ID。 |
|
|
139
|
+
| `apiKey` | 是(可用环境变量兜底) | - | Grix API Key。 |
|
|
140
|
+
| `reconnectMs` | 否 | `2000` | 重连基础延迟(毫秒)。 |
|
|
141
|
+
| `reconnectMaxMs` | 否 | `max(30000, reconnectMs*8)` | 重连最大延迟(毫秒)。 |
|
|
142
|
+
| `reconnectStableMs` | 否 | `30000` | 连接保持多久算“稳定”(毫秒)。 |
|
|
143
|
+
| `connectTimeoutMs` | 否 | `10000` | 建连超时(毫秒)。 |
|
|
144
|
+
| `keepalivePingMs` | 否 | 自动计算 | 心跳发送间隔(毫秒)。 |
|
|
145
|
+
| `keepaliveTimeoutMs` | 否 | 自动计算 | 心跳超时阈值(毫秒)。 |
|
|
146
|
+
| `upstreamRetryMaxAttempts` | 否 | `3` | 上游发送失败重试次数(1-5)。 |
|
|
147
|
+
| `upstreamRetryBaseDelayMs` | 否 | `300` | 上游重试基础延迟(毫秒)。 |
|
|
148
|
+
| `upstreamRetryMaxDelayMs` | 否 | `2000` | 上游重试最大延迟(毫秒)。 |
|
|
149
|
+
| `maxChunkChars` | 否 | `1200` | 普通回复分片长度上限(最大 2000)。 |
|
|
150
|
+
| `streamChunkChars` | 否 | `48` | 流式回复分片长度上限(最大 2000)。 |
|
|
151
|
+
| `streamChunkDelayMs` | 否 | `0` | 流式分片发送间隔(毫秒)。 |
|
|
152
|
+
| `dmPolicy` | 否 | `open` | 私聊策略:`open` / `pairing` / `allowlist` / `disabled`。 |
|
|
153
|
+
| `allowFrom` | 否 | `[]` | 白名单发送者列表(配合 `dmPolicy=allowlist`)。 |
|
|
154
|
+
| `defaultTo` | 否 | - | 默认发送目标会话。 |
|
|
155
|
+
| `execApprovals.enabled` | 否 | `false` | 是否启用聊天内执行审批。 |
|
|
156
|
+
| `execApprovals.approvers` | 条件必填 | `[]` | 审批人 sender ID 列表。启用审批时需填写。 |
|
|
157
|
+
|
|
158
|
+
### 环境变量兜底
|
|
159
|
+
|
|
160
|
+
如果配置文件没填,插件会按下列环境变量读取:
|
|
161
|
+
|
|
162
|
+
- `GRIX_WS_URL`
|
|
163
|
+
- `GRIX_AGENT_ID`
|
|
164
|
+
- `GRIX_API_KEY`
|
|
165
|
+
|
|
166
|
+
## 工具与命令
|
|
167
|
+
|
|
168
|
+
### Agent 可调用工具
|
|
169
|
+
|
|
170
|
+
- `grix_query`:`contact_search`、`session_search`、`message_history`
|
|
171
|
+
- `grix_group`:`create`、`detail`、`add_members`、`remove_members`、`update_member_role`、`update_all_members_muted`、`update_member_speaking`、`dissolve`
|
|
172
|
+
- `grix_agent_admin`:创建 `provider_type=3` 的 Grix API agent(只创建远端 agent,不会直接改本地 `channels.grix`)
|
|
173
|
+
|
|
174
|
+
### 运维命令
|
|
175
|
+
|
|
176
|
+
查看账户:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
openclaw grix doctor
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
创建 API agent:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
openclaw grix create-agent \
|
|
186
|
+
--agent-name ops-assistant \
|
|
187
|
+
--describe-message-tool '{"actions":["unsend","delete"]}'
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
参数说明:
|
|
191
|
+
|
|
192
|
+
- `--agent-name`:必填,小写字母开头,只允许小写字母、数字、`-`,长度 3-32。
|
|
193
|
+
- `--describe-message-tool`:必填,JSON 对象,至少包含 `actions` 数组。
|
|
194
|
+
- `--account-id`:可选,指定用哪个本地 Grix 账户发起创建。
|
|
195
|
+
- `--avatar-url`:可选,给新 agent 设置头像地址。
|
|
196
|
+
|
|
197
|
+
命令输出里会给出一次性 `api_key` 和下一步绑定命令模板。
|
|
198
|
+
|
|
199
|
+
## 聊天内 Exec 审批(可选)
|
|
200
|
+
|
|
201
|
+
先在 Grix 账户里配置审批人:
|
|
178
202
|
|
|
179
203
|
```json
|
|
180
204
|
{
|
|
181
205
|
"channels": {
|
|
182
206
|
"grix": {
|
|
183
|
-
"
|
|
184
|
-
"
|
|
185
|
-
|
|
186
|
-
"enabled": true,
|
|
187
|
-
"approvers": ["<GRIX_SENDER_ID>"]
|
|
188
|
-
}
|
|
189
|
-
}
|
|
207
|
+
"execApprovals": {
|
|
208
|
+
"enabled": true,
|
|
209
|
+
"approvers": ["<GRIX_SENDER_ID>"]
|
|
190
210
|
}
|
|
191
211
|
}
|
|
192
212
|
}
|
|
193
213
|
}
|
|
194
214
|
```
|
|
195
215
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
Minimal OpenClaw config:
|
|
216
|
+
再开启 OpenClaw 的 exec 审批:
|
|
199
217
|
|
|
200
218
|
```json
|
|
201
219
|
{
|
|
@@ -211,90 +229,18 @@ Minimal OpenClaw config:
|
|
|
211
229
|
"enabled": true,
|
|
212
230
|
"mode": "session"
|
|
213
231
|
}
|
|
214
|
-
},
|
|
215
|
-
"channels": {
|
|
216
|
-
"grix": {
|
|
217
|
-
"execApprovals": {
|
|
218
|
-
"enabled": true,
|
|
219
|
-
"approvers": ["<GRIX_SENDER_ID>"]
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
232
|
}
|
|
223
233
|
}
|
|
224
234
|
```
|
|
225
235
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
- `session`: send the approval prompt back to the current Grix chat
|
|
229
|
-
- `targets`: send the approval prompt to the explicit targets configured in `approvals.exec.targets`
|
|
230
|
-
- `both`: send to the current chat and to explicit targets
|
|
231
|
-
|
|
232
|
-
If needed, you can also use OpenClaw's upstream `approvals.exec` fields such as `agentFilter`, `sessionFilter`, and `targets`.
|
|
236
|
+
`mode` 说明:
|
|
233
237
|
|
|
234
|
-
|
|
238
|
+
- `session`:发到当前会话
|
|
239
|
+
- `targets`:发到 `approvals.exec.targets`
|
|
240
|
+
- `both`:两边都发
|
|
235
241
|
|
|
236
|
-
|
|
242
|
+
配置改完后重启:
|
|
237
243
|
|
|
238
244
|
```bash
|
|
239
245
|
openclaw gateway restart
|
|
240
246
|
```
|
|
241
|
-
|
|
242
|
-
### 4. Approve in chat
|
|
243
|
-
|
|
244
|
-
Usage flow:
|
|
245
|
-
|
|
246
|
-
1. Ask OpenClaw to run an `exec` command that requires approval.
|
|
247
|
-
2. OpenClaw sends the approval prompt to Grix according to `approvals.exec.mode`.
|
|
248
|
-
3. An allowed approver can:
|
|
249
|
-
- click `Allow Once`, `Allow Always`, or `Deny`
|
|
250
|
-
- or send `/approve <id> allow-once|allow-always|deny`
|
|
251
|
-
4. OpenClaw continues or denies the `exec` request based on that decision.
|
|
252
|
-
|
|
253
|
-
Notes:
|
|
254
|
-
|
|
255
|
-
- `approvers` must be Grix sender ids, not OpenClaw agent ids
|
|
256
|
-
- put approvers under the Grix account that is actually serving the session
|
|
257
|
-
- approval requests and approval results are shown in chat
|
|
258
|
-
- some OpenClaw lifecycle notices may still appear as normal text
|
|
259
|
-
|
|
260
|
-
### 5. Quick checks
|
|
261
|
-
|
|
262
|
-
```bash
|
|
263
|
-
openclaw plugins info grix --json
|
|
264
|
-
openclaw config get approvals.exec --json
|
|
265
|
-
openclaw config get channels.grix --json
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
Check that:
|
|
269
|
-
|
|
270
|
-
- `plugins info grix` reports `status = "loaded"`
|
|
271
|
-
- `approvals.exec.enabled = true`
|
|
272
|
-
- `approvals.exec.mode` matches your intended delivery path
|
|
273
|
-
- the active Grix account has `execApprovals.enabled = true`
|
|
274
|
-
- the active Grix account has at least one sender id in `execApprovals.approvers`
|
|
275
|
-
|
|
276
|
-
Troubleshooting:
|
|
277
|
-
|
|
278
|
-
- if no approval card appears in the current chat, first confirm `tools.exec.ask = "always"` and `approvals.exec.mode = "session"`
|
|
279
|
-
- if you are forwarding to explicit Grix targets, confirm `approvals.exec.targets` points to the correct `channel = "grix"` target
|
|
280
|
-
- if the chat shows approval text but approvers cannot operate it, check that `approvers` contains the human Grix sender id
|
|
281
|
-
- if `openclaw gateway restart` fails config validation, remove invalid keys under `approvals.exec` and keep approver ids only under `channels.grix.*.execApprovals`
|
|
282
|
-
|
|
283
|
-
For an end-to-end verification checklist, see:
|
|
284
|
-
|
|
285
|
-
- [docs/openclaw_exec_approval_e2e.md](../../docs/openclaw_exec_approval_e2e.md)
|
|
286
|
-
|
|
287
|
-
For multi-account setups, put `execApprovals` under `channels.grix.accounts.<accountId>`.
|
|
288
|
-
|
|
289
|
-
## Native Channel Actions
|
|
290
|
-
|
|
291
|
-
The channel plugin exposes only channel-native message actions:
|
|
292
|
-
|
|
293
|
-
- `unsend`
|
|
294
|
-
- `delete`
|
|
295
|
-
|
|
296
|
-
## Environment Variables
|
|
297
|
-
|
|
298
|
-
- `GRIX_WS_URL`
|
|
299
|
-
- `GRIX_AGENT_ID`
|
|
300
|
-
- `GRIX_API_KEY`
|