@xmoxmo/bncr 0.6.4 → 0.6.6
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 +146 -307
- package/package.json +7 -7
- package/scripts/check-pack.mjs +7 -1
- package/scripts/selfcheck.mjs +4 -1
- package/src/core/types.ts +1 -1
- package/src/messaging/inbound/command-owner.ts +33 -0
- package/src/messaging/inbound/commands.ts +427 -252
- package/src/messaging/inbound/conversation-history.ts +26 -5
- package/src/messaging/inbound/dispatch-prep.ts +8 -4
- package/src/messaging/inbound/dispatch.ts +3 -1
- package/src/messaging/inbound/native-command-runtime.ts +4 -0
- package/src/messaging/inbound/native-command.ts +92 -22
- package/src/messaging/inbound/outbound-replay-cache.ts +18 -2
- package/src/messaging/inbound/reply-dispatch.ts +25 -36
- package/src/messaging/inbound/scene-admin.ts +31 -3
- package/src/openclaw/inbound-session-runtime.ts +17 -0
- package/src/openclaw/session-reset-runtime.ts +125 -0
- package/src/plugin/channel-runtime-types.ts +1 -1
- package/src/plugin/inbound-acceptance.ts +18 -7
- package/src/plugin/sqlite-state.ts +59 -18
- package/src/plugin/state-store.ts +81 -20
package/README.md
CHANGED
|
@@ -1,25 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Bncr
|
|
2
2
|
|
|
3
|
-
OpenClaw 的 Bncr
|
|
3
|
+
OpenClaw 的 Bncr 频道插件,用于将 Bncr / 无界客户端接入 OpenClaw,实现消息收发、媒体传输和会话管理。
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
> 当前定位说明:bncr **不是 agent**。它保留既有 **WS 接入链路** 作为 transport / 通信承载,
|
|
8
|
-
> 在 OpenClaw 内部则按 **正式频道插件(channel plugin)** 建模。
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## 1. 这是什么
|
|
13
|
-
|
|
14
|
-
- 一个 OpenClaw 的正式频道插件
|
|
15
|
-
- 负责把 Bncr / 无界客户端接入 OpenClaw
|
|
16
|
-
- 负责消息、媒体、文件与基础状态链路
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## 2. 安装方式
|
|
21
|
-
|
|
22
|
-
### OpenClaw 侧
|
|
5
|
+
## 安装
|
|
23
6
|
|
|
24
7
|
```bash
|
|
25
8
|
openclaw plugins install @xmoxmo/bncr
|
|
@@ -27,366 +10,222 @@ openclaw plugins enable bncr
|
|
|
27
10
|
openclaw gateway restart
|
|
28
11
|
```
|
|
29
12
|
|
|
30
|
-
|
|
13
|
+
升级插件:
|
|
31
14
|
|
|
32
15
|
```bash
|
|
33
16
|
openclaw plugins update bncr
|
|
34
17
|
openclaw gateway restart
|
|
35
18
|
```
|
|
36
19
|
|
|
37
|
-
|
|
38
|
-
>
|
|
39
|
-
> 如果你是从精确版本升级,或本地安装记录仍钉在旧版本,也可以显式执行:
|
|
40
|
-
>
|
|
41
|
-
> ```bash
|
|
42
|
-
> openclaw plugins install @xmoxmo/bncr@latest
|
|
43
|
-
> openclaw gateway restart
|
|
44
|
-
> ```
|
|
45
|
-
|
|
46
|
-
### Bncr / 无界侧
|
|
47
|
-
|
|
48
|
-
安装:
|
|
49
|
-
|
|
50
|
-
- `openclawclient.js`
|
|
20
|
+
当前兼容 `OpenClaw >= 2026.8.1`。
|
|
51
21
|
|
|
52
|
-
|
|
22
|
+
## 客户端接入
|
|
53
23
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
1. 在客户端插件配置中,将 **OpenClaw Token** 填写为 **gateway token**,并正确填写 host / port / ssl 后启用插件。
|
|
59
|
-
2. 启动(或重启)bncr 客户端后,在 OpenClaw 侧执行:
|
|
24
|
+
1. 安装并启用 `openclawclient.js`。
|
|
25
|
+
2. 在客户端填写 OpenClaw 网关地址、端口、SSL 和 gateway token。
|
|
26
|
+
3. 启动客户端,等待设备连接请求。
|
|
27
|
+
4. 在 OpenClaw 上批准设备:
|
|
60
28
|
|
|
61
29
|
```bash
|
|
62
30
|
openclaw devices approve --latest
|
|
63
31
|
```
|
|
64
32
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
---
|
|
33
|
+
设备批准后,客户端会保存授权信息并自动重连。
|
|
68
34
|
|
|
69
|
-
##
|
|
35
|
+
## 基础配置
|
|
70
36
|
|
|
71
|
-
|
|
72
|
-
- 图片
|
|
73
|
-
- 视频
|
|
74
|
-
- 语音
|
|
75
|
-
- 音频
|
|
76
|
-
- 文件
|
|
77
|
-
- 下行推送
|
|
78
|
-
- ACK
|
|
79
|
-
- 离线消息排队
|
|
80
|
-
- 重连后继续发送
|
|
81
|
-
- 状态诊断
|
|
82
|
-
- 文件互传
|
|
37
|
+
配置位于 `channels.bncr`。最小配置:
|
|
83
38
|
|
|
84
|
-
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"channels": {
|
|
42
|
+
"bncr": {
|
|
43
|
+
"enabled": true,
|
|
44
|
+
"allowTool": false,
|
|
45
|
+
"outboundRequireAck": true
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
85
50
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
51
|
+
常用配置:
|
|
52
|
+
|
|
53
|
+
| 配置 | 说明 |
|
|
54
|
+
| --- | --- |
|
|
55
|
+
| `enabled` | 是否启用 Bncr 频道 |
|
|
56
|
+
| `dmPolicy` | 私聊策略:`open`、`allowlist`、`disabled` |
|
|
57
|
+
| `groupPolicy` | 群聊策略:`open`、`allowlist`、`disabled` |
|
|
58
|
+
| `allowFrom` | 私聊允许的用户列表 |
|
|
59
|
+
| `groupAllowFrom` | 群聊允许的用户列表 |
|
|
60
|
+
| `allowTool` | 是否转发工具消息,默认关闭 |
|
|
61
|
+
| `outboundRequireAck` | 出站文本是否等待客户端 ACK,默认开启 |
|
|
62
|
+
| `accounts` | 多账号配置 |
|
|
63
|
+
| `debug.verbose` | 是否输出详细调试日志 |
|
|
64
|
+
|
|
65
|
+
多账号示例:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"channels": {
|
|
70
|
+
"bncr": {
|
|
71
|
+
"accounts": {
|
|
72
|
+
"Primary": { "enabled": true, "name": "主账号" },
|
|
73
|
+
"Secondary": { "enabled": true, "name": "备用账号" }
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
90
79
|
|
|
91
|
-
|
|
80
|
+
也可以使用命令生成最小配置:
|
|
92
81
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
- 群聊非管理员执行场景管理命令(`mode` / `allow` / `deny` / `bind` / `revoke` / `list` / `history-*` / `download-media`)时,统一返回 `Admin permission required.`,不再附带用法提示。
|
|
97
|
-
- 群聊非管理员执行 `/bncr new`、`/bncr reset`、`/bncr verbose` 时仍按静默拒绝处理。
|
|
98
|
-
- `/bncr list pending` 与 `/bncr list scenes` 采用按私聊 / 群聊分组的摘要展示格式,便于现场排查 scene 状态。
|
|
82
|
+
```bash
|
|
83
|
+
openclaw bncr miniconfig
|
|
84
|
+
```
|
|
99
85
|
|
|
100
|
-
|
|
86
|
+
## 支持的能力
|
|
101
87
|
|
|
102
|
-
|
|
88
|
+
- 文本消息
|
|
89
|
+
- 图片、视频、音频和语音
|
|
90
|
+
- 文件传输和媒体附件
|
|
91
|
+
- 消息撤回和删除
|
|
92
|
+
- 离线排队、ACK、重试和重连
|
|
93
|
+
- 多账号、私聊和群聊会话
|
|
94
|
+
- 会话历史上下文
|
|
95
|
+
- 状态和投递诊断
|
|
103
96
|
|
|
104
|
-
|
|
105
|
-
- 私聊非管理员:展示当前可用命令,不展示管理类命令
|
|
106
|
-
- 群聊非管理员:仅展示基础命令,不展示 `mode`、`history-*`、`download-media` 等管理命令
|
|
97
|
+
Agent 可以使用 OpenClaw 标准消息能力发送文本或媒体。需要指定目标会话时,使用 Bncr 目标地址并同时指定 `accountId`。
|
|
107
98
|
|
|
108
|
-
|
|
99
|
+
## 命令
|
|
109
100
|
|
|
110
|
-
|
|
101
|
+
### 基础命令
|
|
111
102
|
|
|
112
103
|
```text
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
• /bncr verbose on|off|full
|
|
121
|
-
|
|
122
|
-
🛡 Scene approval
|
|
123
|
-
• /bncr allow [<SceneId>]
|
|
124
|
-
• /bncr deny [<SceneId>]
|
|
125
|
-
• /bncr bind <agentId> [<SceneId>]
|
|
126
|
-
• /bncr mode help
|
|
127
|
-
• /bncr mode <admin|mention|hybrid|all|clear> [<SceneId>]
|
|
128
|
-
• /bncr revoke [<SceneId>]
|
|
129
|
-
• /bncr list pending [filters...]
|
|
130
|
-
• /bncr list scenes [filters...]
|
|
131
|
-
|
|
132
|
-
📋 Conversation history
|
|
133
|
-
• /bncr history-help
|
|
134
|
-
• /bncr history-limit [<number>|clear] [<SceneId>]
|
|
135
|
-
• /bncr history-force on|off|clear [<SceneId>]
|
|
136
|
-
|
|
137
|
-
🌐 Remote media
|
|
138
|
-
• /bncr download-media on|off|clear|default on|off [<SceneId>]
|
|
104
|
+
/bncr help
|
|
105
|
+
/bncr whoami
|
|
106
|
+
/bncr status
|
|
107
|
+
/bncr new
|
|
108
|
+
/bncr reset
|
|
109
|
+
/bncr verbose on|off|full
|
|
110
|
+
/stop
|
|
139
111
|
```
|
|
140
112
|
|
|
141
|
-
|
|
113
|
+
`/stop` 只支持精确写法,不支持 `/stop@bot`、`/stop extra` 等变体。
|
|
142
114
|
|
|
143
|
-
|
|
144
|
-
🦞 Bncr command usage
|
|
145
|
-
|
|
146
|
-
📌 Bncr builtins
|
|
147
|
-
• /bncr whoami
|
|
148
|
-
• /bncr status
|
|
149
|
-
• /bncr new
|
|
150
|
-
• /bncr reset
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
群聊非管理员:
|
|
115
|
+
### 场景管理
|
|
154
116
|
|
|
155
117
|
```text
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
118
|
+
/bncr allow [<SceneId>]
|
|
119
|
+
/bncr deny [<SceneId>]
|
|
120
|
+
/bncr bind <agentId> [<SceneId>]
|
|
121
|
+
/bncr revoke [<SceneId>]
|
|
122
|
+
/bncr list pending [filters...]
|
|
123
|
+
/bncr list scenes [filters...]
|
|
124
|
+
/bncr mode help
|
|
125
|
+
/bncr mode <admin|mention|hybrid|all|clear> [<SceneId>]
|
|
161
126
|
```
|
|
162
127
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
## 5. 架构定位
|
|
166
|
-
|
|
167
|
-
bncr 当前采用两层模型:
|
|
168
|
-
|
|
169
|
-
1. **WS 承载层**
|
|
170
|
-
- Bncr 客户端通过 WebSocket 接入 OpenClaw 网关
|
|
171
|
-
- 负责连接、推送、ACK、文件分块等 transport 能力
|
|
172
|
-
|
|
173
|
-
2. **OpenClaw 频道插件层**
|
|
174
|
-
- 在 OpenClaw 内部按正式 `channel plugin` 建模
|
|
175
|
-
- 负责入站解析、消息分发、出站适配、状态与治理
|
|
176
|
-
|
|
177
|
-
出站可靠投递的边界:bncr 后面仍有自己的服务框架和 outbox / ACK / retry / deadLetter 体系。对 OpenClaw 宿主来说,消息成功交给 bncr 插件并进入 bncr 自管 outbox,即表示频道 handoff 完成;这不等价于客户端 ACK 或目标平台最终送达。后续可靠投递由 bncr 自身负责。
|
|
178
|
-
|
|
179
|
-
当前已注册生产 `channel.message` 作为 bncr 的频道专用 handoff adapter:`text` / `media` / `payload` 会转换为 bncr outbox entry。原有通用 `message.send` / `channel.actions.send` 发送能力继续保留;`channel.message` 是频道专用入口,不替代通用发送入口。该 adapter 仍不启用 `durableFinal`;进入 outbox 后的客户端 ACK、目标平台送达、retry、deadLetter 继续由 bncr 服务框架负责。
|
|
180
|
-
|
|
181
|
-
当前代码结构:
|
|
128
|
+
### 会话历史
|
|
182
129
|
|
|
183
130
|
```text
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
messaging/
|
|
131
|
+
/bncr history-help
|
|
132
|
+
/bncr history-limit [<number>|clear] [<SceneId>]
|
|
133
|
+
/bncr history-force on|off|clear [<SceneId>]
|
|
188
134
|
```
|
|
189
135
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
## 6. 配置项总览
|
|
193
|
-
|
|
194
|
-
当前主要配置字段:
|
|
195
|
-
|
|
196
|
-
- `enabled`
|
|
197
|
-
- `dmPolicy`
|
|
198
|
-
- `groupPolicy`
|
|
199
|
-
- `allowFrom`
|
|
200
|
-
- `groupAllowFrom`
|
|
201
|
-
- `outboundRequireAck`
|
|
202
|
-
- `requireMention`
|
|
203
|
-
- `accounts`
|
|
204
|
-
|
|
205
|
-
补充:
|
|
206
|
-
|
|
207
|
-
- `dmPolicy` / `groupPolicy` 支持:`open | allowlist | disabled`
|
|
208
|
-
- `outboundRequireAck` 是当前**单账号场景**使用的顶层字段:`channels.bncr.outboundRequireAck`
|
|
209
|
-
- `outboundRequireAck=true` 时,文本外发会等待 `bncr.ack` 再出队;关闭后不再强制等待文本 ACK,超时类错误会显示为 `push-delivery-unconfirmed`
|
|
210
|
-
- `requireMention` 当前仍是保留字段
|
|
211
|
-
|
|
212
|
-
---
|
|
213
|
-
|
|
214
|
-
## 7. 媒体发送(OpenClaw 2026.5.18 验证适用)
|
|
136
|
+
会话历史统一累计用户消息和 Bot 回复,默认窗口为 50 条。达到上限后会在后续消息到达时整理并发送历史上下文。
|
|
215
137
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
### 方式 A:Agent 回复中的 `MEDIA:<path>`
|
|
219
|
-
|
|
220
|
-
适用场景:
|
|
221
|
-
|
|
222
|
-
- agent 在当前会话中直接回附件
|
|
223
|
-
- 由宿主 reply-media / outbound attachment 链统一处理
|
|
224
|
-
|
|
225
|
-
示例:
|
|
138
|
+
### 远程媒体
|
|
226
139
|
|
|
227
140
|
```text
|
|
228
|
-
|
|
141
|
+
/bncr download-media on|off|clear|default on|off [<SceneId>]
|
|
229
142
|
```
|
|
230
143
|
|
|
231
|
-
|
|
144
|
+
## 权限规则
|
|
232
145
|
|
|
233
|
-
|
|
234
|
-
- 本地文件是否允许发送,取决于宿主侧的路径准入与 MIME / 类型白名单
|
|
235
|
-
- 在 `2026.5.18` 口径下,`MEDIA:` 是否成功,**不能直接等价**为 bncr 插件自身的 file-transfer 是否成功
|
|
146
|
+
管理员可以使用全部 Bncr 命令。管理员发送的裸命令优先交给 OpenClaw 原生命令处理,未处理时才允许交给 Agent;`/bncr` 命令由 Bncr 处理。
|
|
236
147
|
|
|
237
|
-
|
|
148
|
+
非管理员的权限按会话类型区分:
|
|
238
149
|
|
|
239
|
-
|
|
150
|
+
- 私聊允许正常对话;`/whoami`、`/status`、`/new`、`/reset`、`/stop`、`/model`、`/verbose` 等受控命令按对应规则执行,不会以提升后的身份转交 Agent。
|
|
151
|
+
- 群聊受当前场景模式控制。未授权场景不会进入正常处理流程。
|
|
152
|
+
- `/bncr` 命令始终由 Bncr 识别;未知或不可用的 Bncr 命令会直接提示,不会转交 Agent。
|
|
153
|
+
- `/bncr help` 会根据当前会话类型和权限,仅展示当前可用的命令。
|
|
154
|
+
- 私聊非管理员使用 `history-*` 或 `download-media` 时,只能操作当前私聊会话,不能通过参数修改其他会话。
|
|
240
155
|
|
|
241
|
-
|
|
242
|
-
- 需要验证 OpenClaw 动作发送接口到 bncr channel 的下行链路
|
|
156
|
+
## 群聊模式
|
|
243
157
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
"accountId": "Primary",
|
|
251
|
-
"idempotencyKey": "bncr-media-demo-1",
|
|
252
|
-
"params": {
|
|
253
|
-
"to": "Bncr:tgBot:-1001:10001",
|
|
254
|
-
"caption": "图片发送测试",
|
|
255
|
-
"path": "/root/.openclaw/workspace/tmp/demo.png"
|
|
256
|
-
}
|
|
257
|
-
}'
|
|
158
|
+
```text
|
|
159
|
+
/bncr mode admin
|
|
160
|
+
/bncr mode mention
|
|
161
|
+
/bncr mode hybrid
|
|
162
|
+
/bncr mode all
|
|
163
|
+
/bncr mode clear
|
|
258
164
|
```
|
|
259
165
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
以下口径已在 OpenClaw `2026.5.18` 上完成验证,当前建议把媒体问题拆成两类看:
|
|
269
|
-
|
|
270
|
-
1. `MEDIA:<path>` 失败:优先检查宿主 reply-media / MIME 白名单 / 本地路径准入
|
|
271
|
-
2. `message.action` 失败:优先检查动作 envelope、目标 `to`、bncr 出站 push/ack 与 file-transfer 日志
|
|
272
|
-
|
|
273
|
-
后续如果在其他 OpenClaw 版本上完成验证,应继续在本节追加对应版本的验证过程与结论,不直接外推复用 `2026.5.18` 的验证口径。
|
|
274
|
-
|
|
275
|
-
### 2026.6.1 验证说明
|
|
276
|
-
|
|
277
|
-
以下口径已在 OpenClaw `2026.6.1` 与 bncr `0.3.2` 上完成基础验证:
|
|
278
|
-
|
|
279
|
-
1. 普通文本入站与 assistant 文本回复正常。
|
|
280
|
-
2. Agent 回复中的图片附件可通过 `MEDIA:<path>` 投递。
|
|
281
|
-
3. Agent 回复中的 `ogg(opus)` voice 附件可通过 `MEDIA:<path>` 搭配 voice 发送提示投递。
|
|
282
|
-
4. 入站 prompt 中只出现 OpenClaw 官方 `Conversation info` / `Sender` untrusted metadata,未重复注入 bncr 自定义 context block。
|
|
283
|
-
|
|
284
|
-
仍需分开判断:
|
|
285
|
-
|
|
286
|
-
- `MEDIA:<path>` 成功代表宿主 reply-media / attachment 链路和 bncr 下行媒体投递在该场景下可用。
|
|
287
|
-
- `message.action` / `send` 仍应作为显式目标发送链单独验证,特别是跨会话、跨账号、文件传输 ACK 与 outbox 重试场景。
|
|
166
|
+
| 模式 | 说明 |
|
|
167
|
+
| --- | --- |
|
|
168
|
+
| `admin` | 仅管理员消息触发 |
|
|
169
|
+
| `mention` | 需要明确提及 Bot |
|
|
170
|
+
| `hybrid` | 按管理员或提及条件处理 |
|
|
171
|
+
| `all` | 处理群内符合接入条件的消息 |
|
|
172
|
+
| `clear` | 清除当前场景的自定义模式 |
|
|
288
173
|
|
|
289
|
-
|
|
174
|
+
新群聊默认需要管理员授权。管理员可以使用 `/bncr allow`、`/bncr deny`、`/bncr bind` 和 `/bncr revoke` 管理场景。
|
|
290
175
|
|
|
291
|
-
##
|
|
292
|
-
|
|
293
|
-
常用检查:
|
|
176
|
+
## 检查状态
|
|
294
177
|
|
|
295
178
|
```bash
|
|
296
179
|
openclaw gateway status
|
|
297
|
-
openclaw health
|
|
180
|
+
openclaw gateway health
|
|
181
|
+
openclaw bncr --help
|
|
298
182
|
```
|
|
299
183
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
- `linked`
|
|
303
|
-
- `pending`
|
|
304
|
-
- `deadLetter`
|
|
305
|
-
- diagnostics / probe / status 摘要
|
|
306
|
-
- diagnostics 里的 `runtimeFlags.outboundRequireAck`
|
|
307
|
-
- diagnostics 里的 `runtimeFlags.ackPolicySource`
|
|
308
|
-
- diagnostics 里的 `waiters.messageAck` / `waiters.fileAck`
|
|
309
|
-
|
|
310
|
-
---
|
|
184
|
+
如需查看 Bncr 运行状态,可使用 `/bncr status`。如需排查连接、ACK、队列或媒体问题,再开启 `channels.bncr.debug.verbose` 后重启网关。
|
|
311
185
|
|
|
312
|
-
##
|
|
186
|
+
## 目标地址
|
|
313
187
|
|
|
314
|
-
|
|
188
|
+
发送到指定会话时使用以下形式:
|
|
315
189
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
- 因而在加载 `openclaw/plugin-sdk/core` 时失败
|
|
190
|
+
```text
|
|
191
|
+
Bncr:<platform>:0:<userId>
|
|
192
|
+
Bncr:<platform>:<groupId>:0
|
|
193
|
+
```
|
|
321
194
|
|
|
322
|
-
|
|
195
|
+
示例:
|
|
323
196
|
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
openclaw gateway restart
|
|
328
|
-
openclaw plugins inspect bncr
|
|
197
|
+
```text
|
|
198
|
+
Bncr:tgBot:0:10001
|
|
199
|
+
Bncr:tgBot:-1001234567890:0
|
|
329
200
|
```
|
|
330
201
|
|
|
331
|
-
|
|
202
|
+
私聊目标使用用户 ID,群聊目标使用群 ID。多账号场景同时指定 `accountId`,避免不同账号之间串用会话或连接。
|
|
332
203
|
|
|
333
|
-
|
|
334
|
-
which openclaw
|
|
335
|
-
npm root -g
|
|
336
|
-
```
|
|
204
|
+
## 常见问题
|
|
337
205
|
|
|
338
|
-
|
|
206
|
+
### 客户端无法连接
|
|
339
207
|
|
|
340
|
-
|
|
208
|
+
确认 gateway token、网关地址、端口和 SSL 配置正确,并执行:
|
|
341
209
|
|
|
342
210
|
```bash
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
npm test
|
|
346
|
-
npm run typecheck
|
|
347
|
-
npm run selfcheck
|
|
348
|
-
npm run check-pack
|
|
349
|
-
npm pack
|
|
211
|
+
openclaw devices approve --latest
|
|
212
|
+
openclaw gateway restart
|
|
350
213
|
```
|
|
351
214
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
- `npm run fullcheck`:运行当前全量门禁(`typecheck + check + test + selfcheck + check-pack + format:check`)
|
|
355
|
-
- `npm test`:跑回归测试
|
|
356
|
-
- `npm run typecheck`:执行 `tsconfig.typecheck.json`,确保类型边界与 OpenClaw surface 对齐
|
|
357
|
-
- `npm run selfcheck`:检查插件骨架是否完整,并验证关键 OpenClaw SDK subpath 可解析
|
|
358
|
-
- `npm run check-pack`:执行 `npm pack --dry-run --json`,确认发布包包含关键入口与 OpenClaw adapter 文件
|
|
359
|
-
- `tests/integrity/source-manifest.test.mjs`:确保 `selfcheck` / `check-pack` 的源文件清单与当前 `src/**/*.ts` 一致,新增源文件不会漏进发布清单
|
|
360
|
-
- `npm run format:check`:执行 Biome `format` 只读检查(不带 `--write`),防止格式漂移混进发布门禁
|
|
361
|
-
- `npm pack`:确认当前版本可正常打包
|
|
362
|
-
- `npm run check-register-drift -- --duration-sec 300 --interval-sec 15`:静置采样 `bncr.diagnostics`,观察 `registerCount / apiGeneration / postWarmupRegisterCount` 是否在 warmup 后继续增长
|
|
215
|
+
### 消息没有发出
|
|
363
216
|
|
|
364
|
-
|
|
217
|
+
检查网关、客户端和 Bncr 状态,确认客户端在线,并查看 ACK 与队列状态。
|
|
365
218
|
|
|
366
|
-
|
|
367
|
-
- `delta.apiGeneration`
|
|
368
|
-
- `delta.postWarmupRegisterCount`
|
|
369
|
-
- `historicalWarmupExternalDrift`
|
|
370
|
-
- `newDriftDuringWindow`
|
|
371
|
-
- `last.postWarmupRegisterCount`
|
|
372
|
-
- `last.unexpectedRegisterAfterWarmup`
|
|
373
|
-
- `driftDetected`
|
|
219
|
+
### 媒体发送失败
|
|
374
220
|
|
|
375
|
-
|
|
221
|
+
确认文件路径可被 OpenClaw 访问,文件类型受宿主和客户端支持,并检查客户端文件传输状态。
|
|
376
222
|
|
|
377
|
-
|
|
223
|
+
### 群聊没有响应
|
|
378
224
|
|
|
379
|
-
|
|
225
|
+
检查场景是否已授权、当前群聊模式以及消息是否满足触发条件:
|
|
380
226
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
- 可以正常打包
|
|
387
|
-
- 本地版本号与 npm / 发布目标一致(版本号修改应优先在工作仓完成,再同步到发布仓)
|
|
388
|
-
- 运行态 `linked / pending / deadLetter` 正常
|
|
389
|
-
|
|
390
|
-
---
|
|
391
|
-
|
|
392
|
-
如果你接触过旧版本,请以当前 README 和当前代码为准。
|
|
227
|
+
```text
|
|
228
|
+
/bncr status
|
|
229
|
+
/bncr list scenes
|
|
230
|
+
/bncr mode
|
|
231
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xmoxmo/bncr",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"check": "biome check ."
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"openclaw": ">=2026.
|
|
41
|
+
"openclaw": ">=2026.8.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@biomejs/biome": "^2.4.16",
|
|
45
45
|
"@types/node": "^24.13.2",
|
|
46
46
|
"esbuild": "^0.28.0",
|
|
47
|
-
"openclaw": ">=2026.
|
|
47
|
+
"openclaw": ">=2026.8.1",
|
|
48
48
|
"typescript": "^6.0.3"
|
|
49
49
|
},
|
|
50
50
|
"openclaw": {
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
"./index.ts"
|
|
53
53
|
],
|
|
54
54
|
"compat": {
|
|
55
|
-
"pluginApi": ">=2026.
|
|
56
|
-
"minGatewayVersion": "2026.
|
|
55
|
+
"pluginApi": ">=2026.8.1",
|
|
56
|
+
"minGatewayVersion": "2026.8.1"
|
|
57
57
|
},
|
|
58
58
|
"build": {
|
|
59
|
-
"openclawVersion": "2026.
|
|
60
|
-
"pluginSdkVersion": "2026.
|
|
59
|
+
"openclawVersion": "2026.8.1",
|
|
60
|
+
"pluginSdkVersion": "2026.8.1"
|
|
61
61
|
},
|
|
62
62
|
"runtimeExtensions": [
|
|
63
63
|
"./dist/index.js"
|
package/scripts/check-pack.mjs
CHANGED
|
@@ -58,6 +58,7 @@ const requiredSourceFiles = [
|
|
|
58
58
|
'src/core/status.ts',
|
|
59
59
|
'src/core/targets.ts',
|
|
60
60
|
'src/core/types.ts',
|
|
61
|
+
'src/messaging/inbound/command-owner.ts',
|
|
61
62
|
'src/messaging/inbound/commands.ts',
|
|
62
63
|
'src/messaging/inbound/context-facts.ts',
|
|
63
64
|
'src/messaging/inbound/dispatch-prep.ts',
|
|
@@ -90,6 +91,7 @@ const requiredSourceFiles = [
|
|
|
90
91
|
'src/messaging/outbound/target-resolver.ts',
|
|
91
92
|
'src/openclaw/config-runtime.ts',
|
|
92
93
|
'src/openclaw/inbound-session-runtime.ts',
|
|
94
|
+
'src/openclaw/session-reset-runtime.ts',
|
|
93
95
|
'src/openclaw/media-runtime.ts',
|
|
94
96
|
'src/openclaw/reply-runtime.ts',
|
|
95
97
|
'src/openclaw/routing-runtime.ts',
|
|
@@ -268,7 +270,11 @@ const channelMessageChecks = {
|
|
|
268
270
|
const channelMessageOk = Object.values(channelMessageChecks).every(Boolean);
|
|
269
271
|
|
|
270
272
|
const result = {
|
|
271
|
-
ok:
|
|
273
|
+
ok:
|
|
274
|
+
missing.length === 0 &&
|
|
275
|
+
pkg.peerDependencies?.openclaw === pkg.devDependencies?.openclaw &&
|
|
276
|
+
pkg.peerDependencies?.openclaw === `>=${pkg.openclaw?.compat?.minGatewayVersion}` &&
|
|
277
|
+
channelMessageOk,
|
|
272
278
|
package: pack?.id,
|
|
273
279
|
entryCount: pack?.entryCount,
|
|
274
280
|
missing,
|
package/scripts/selfcheck.mjs
CHANGED
|
@@ -57,6 +57,7 @@ const requiredSourceFiles = [
|
|
|
57
57
|
'src/core/targets.ts',
|
|
58
58
|
'src/core/types.ts',
|
|
59
59
|
'src/core/value-sanitize.ts',
|
|
60
|
+
'src/messaging/inbound/command-owner.ts',
|
|
60
61
|
'src/messaging/inbound/commands.ts',
|
|
61
62
|
'src/messaging/inbound/context-facts.ts',
|
|
62
63
|
'src/messaging/inbound/contracts.ts',
|
|
@@ -101,6 +102,7 @@ const requiredSourceFiles = [
|
|
|
101
102
|
'src/openclaw/channel-runtime-contracts.ts',
|
|
102
103
|
'src/openclaw/config-runtime.ts',
|
|
103
104
|
'src/openclaw/inbound-session-runtime.ts',
|
|
105
|
+
'src/openclaw/session-reset-runtime.ts',
|
|
104
106
|
'src/openclaw/media-runtime.ts',
|
|
105
107
|
'src/openclaw/reply-runtime.ts',
|
|
106
108
|
'src/openclaw/routing-runtime.ts',
|
|
@@ -232,7 +234,6 @@ const readNpmLatestVersion = (packageName) => {
|
|
|
232
234
|
};
|
|
233
235
|
|
|
234
236
|
const requiredOpenClawSdkSubpaths = [
|
|
235
|
-
'openclaw/plugin-sdk',
|
|
236
237
|
'openclaw/plugin-sdk/channel-outbound',
|
|
237
238
|
'openclaw/plugin-sdk/channel-ingress-runtime',
|
|
238
239
|
'openclaw/plugin-sdk/channel-message',
|
|
@@ -245,6 +246,8 @@ const requiredOpenClawSdkSubpaths = [
|
|
|
245
246
|
'openclaw/plugin-sdk/security-runtime',
|
|
246
247
|
'openclaw/plugin-sdk/status-helpers',
|
|
247
248
|
'openclaw/plugin-sdk/tool-send',
|
|
249
|
+
'openclaw/plugin-sdk/command-auth',
|
|
250
|
+
'openclaw/plugin-sdk/reply-history',
|
|
248
251
|
];
|
|
249
252
|
|
|
250
253
|
const resolveOpenClawSdkSubpaths = () => {
|
package/src/core/types.ts
CHANGED
|
@@ -137,7 +137,7 @@ export type BncrRecentOutboundEntry = {
|
|
|
137
137
|
export type BncrOutboundReplayMediaEntry = {
|
|
138
138
|
path?: string;
|
|
139
139
|
contentType?: string;
|
|
140
|
-
kind?: 'image' | 'video' | 'audio' | 'document' | 'unknown';
|
|
140
|
+
kind?: 'image' | 'video' | 'audio' | 'document' | 'sticker' | 'unknown';
|
|
141
141
|
messageId?: string;
|
|
142
142
|
};
|
|
143
143
|
|