@dingxiang-me/openclaw-wechat 1.7.1 → 1.7.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/CHANGELOG.md
CHANGED
|
@@ -52,6 +52,17 @@ All notable changes to this project will be documented in this file.
|
|
|
52
52
|
- 远端 E2E 兼容增强:`test:e2e:remote` 支持 `WECOM_E2E_*` 与 legacy `E2E_WECOM_*` 两套环境变量
|
|
53
53
|
- 语法检查范围增强:`test:syntax` 从仅 `src` 扩展到 `src + scripts + tests`,降低脚本/测试回归漏检风险
|
|
54
54
|
|
|
55
|
+
## [1.7.2] - 2026-03-05
|
|
56
|
+
|
|
57
|
+
### Changed
|
|
58
|
+
- Bot 群聊触发策略收紧:在企业微信官方 Bot 模式下,`groupChat.triggerMode=direct/keyword` 会自动规范为 `mention` 并输出告警,避免“配置可写但平台不回调”的误导
|
|
59
|
+
- Bot `/status` 与 `/help` 文案增强:明确“群聊通常仅 @ 机器人消息触发(平台限制)”
|
|
60
|
+
- 文档更新:README 与 `docs/channels/wecom.md` 明确 Bot 群聊触发限制与配置降级行为
|
|
61
|
+
|
|
62
|
+
### Added
|
|
63
|
+
- 新增回归测试 `tests/wecom-bot-inbound-executor-helpers.test.mjs`,覆盖 Bot 群聊策略规范化
|
|
64
|
+
- 更新命令处理测试,覆盖 Bot 状态文案中的平台限制提示
|
|
65
|
+
|
|
55
66
|
## [1.7.1] - 2026-03-05
|
|
56
67
|
|
|
57
68
|
### Added
|
package/README.md
CHANGED
|
@@ -299,6 +299,9 @@ node ./scripts/wecom-bot-selfcheck.mjs --help
|
|
|
299
299
|
| `lateReplyPollMs` | integer | `2000` | Bot 异步补发轮询间隔(500ms~10s) |
|
|
300
300
|
| `card` | object | 见下方 | Bot 卡片回包策略(`response_url` / `webhook_bot`) |
|
|
301
301
|
|
|
302
|
+
> 重要限制:企业微信官方 Bot 在群聊里通常仅对 `@机器人` 消息触发回调。
|
|
303
|
+
> 因此 Bot 模式下即使配置 `groupChat.triggerMode=direct/keyword`,也会按 `mention` 处理(插件会输出告警)。
|
|
304
|
+
|
|
302
305
|
#### Bot 卡片配置(`channels.wecom.bot.card`)
|
|
303
306
|
|
|
304
307
|
| 键 | 类型 | 默认 | 说明 |
|
|
@@ -340,7 +343,7 @@ node ./scripts/wecom-bot-selfcheck.mjs --help
|
|
|
340
343
|
| 命令白名单 | `commands.enabled` + `commands.allowlist` | 限制 `/` 指令 |
|
|
341
344
|
| 私聊策略 | `dm.mode` + `dm.allowFrom` + `dm.rejectMessage` | 控制私聊开放/白名单/拒绝 |
|
|
342
345
|
| 事件策略 | `events.enabled` + `events.enterAgentWelcomeEnabled` + `events.enterAgentWelcomeText` | 控制事件处理与 enter_agent 欢迎语 |
|
|
343
|
-
| 群聊触发 | `groupChat.enabled` + `triggerMode` + `mentionPatterns` + `triggerKeywords` |
|
|
346
|
+
| 群聊触发 | `groupChat.enabled` + `triggerMode` + `mentionPatterns` + `triggerKeywords` | 控制群消息触发条件(自建应用支持 `direct/mention/keyword`;Bot 模式按平台限制固定 `mention`) |
|
|
344
347
|
| 动态路由 | `dynamicAgent.*`(兼容 `dynamicAgents.*`、`dm.createAgentOnFirstMessage`) | 动态 Agent + workspace bootstrap 播种 |
|
|
345
348
|
|
|
346
349
|
### 吞吐与稳定性
|
|
@@ -633,10 +636,10 @@ npm run wecom:bot:selfcheck -- --all-accounts
|
|
|
633
636
|
|
|
634
637
|
### Q6:自建应用群聊怎么开?为什么群里不 @ 就不触发?
|
|
635
638
|
先区分两种通道能力:
|
|
636
|
-
1. **群机器人(Webhook Bot
|
|
639
|
+
1. **群机器人(Webhook Bot)**:可直接添加到企微群,天然适合群聊收发;但群聊通常仅 `@机器人` 时才会回调。
|
|
637
640
|
2. **自建应用(Agent 回调)**:插件支持处理 `ChatId` 群消息;但是否能收到“普通群消息”取决于企业微信实际下发能力(很多租户里普通群只能加机器人,无法像成员一样加自建应用)。
|
|
638
641
|
|
|
639
|
-
|
|
642
|
+
如果你的场景是“普通群里稳定对话”,优先用 **Webhook Bot 模式**(注意通常仍需 `@机器人` 才触发)。
|
|
640
643
|
如果你确认企业微信会把群消息回调到自建应用(日志里有 `chatId=...`),再配置触发模式:
|
|
641
644
|
|
|
642
645
|
```json
|
package/docs/channels/wecom.md
CHANGED
|
@@ -19,7 +19,7 @@ This channel integrates OpenClaw with WeCom (企业微信) internal apps.
|
|
|
19
19
|
- Bot card replies: supported (`channels.wecom.bot.card`, `markdown/template_card`)
|
|
20
20
|
- Direct-message policy: supported (`channels.wecom.dm.mode=open|allowlist|deny`, account-level override via `accounts.<id>.dm`)
|
|
21
21
|
- Event handling: supported (`channels.wecom.events.*`, supports `enter_agent` welcome reply)
|
|
22
|
-
- Group trigger mode: `direct` / `mention` / `keyword` (
|
|
22
|
+
- Group trigger mode: Agent callback supports `direct` / `mention` / `keyword`; Bot mode is effectively `mention` (WeCom platform callback constraint)
|
|
23
23
|
- Dynamic agent route mode: `deterministic` / `mapping` / `hybrid` (`channels.wecom.dynamicAgent.mode`)
|
|
24
24
|
- Dynamic workspace seeding: supported via `channels.wecom.dynamicAgent.workspaceTemplate`
|
|
25
25
|
- Session queue / stream manager: optional (`channels.wecom.stream.manager`)
|
|
@@ -40,7 +40,7 @@ Named webhook targets (optional):
|
|
|
40
40
|
|
|
41
41
|
WeCom has two different integration shapes:
|
|
42
42
|
|
|
43
|
-
1. **Webhook Bot**: can be added directly to regular group chats.
|
|
43
|
+
1. **Webhook Bot**: can be added directly to regular group chats, but callbacks are typically triggered only when the bot is mentioned (`@机器人`).
|
|
44
44
|
2. **Self-built App callback**: plugin supports group processing when callback payload contains `ChatId`.
|
|
45
45
|
|
|
46
46
|
To enable direct group trigger (`triggerMode=direct`) for self-built app callback, ensure:
|
|
@@ -53,6 +53,8 @@ To enable direct group trigger (`triggerMode=direct`) for self-built app callbac
|
|
|
53
53
|
If logs never show `chatId`, WeCom is not delivering group messages to this callback route.
|
|
54
54
|
In that case, use **Webhook Bot mode** for regular group chat scenarios.
|
|
55
55
|
|
|
56
|
+
Note: In Bot mode, `groupChat.triggerMode=direct/keyword` is normalized to `mention` by the plugin to avoid misleading config.
|
|
57
|
+
|
|
56
58
|
## Selfcheck
|
|
57
59
|
|
|
58
60
|
Run:
|
|
@@ -165,7 +167,7 @@ All new switches are default-off for compatibility.
|
|
|
165
167
|
}
|
|
166
168
|
```
|
|
167
169
|
|
|
168
|
-
## P2 Routing Config (Recommended)
|
|
170
|
+
## P2 Routing Config (Recommended, Agent callback)
|
|
169
171
|
|
|
170
172
|
```json
|
|
171
173
|
{
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -4,6 +4,45 @@ function assertFunction(name, value) {
|
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
const UNSUPPORTED_BOT_GROUP_TRIGGER_WARNED = new Set();
|
|
8
|
+
|
|
9
|
+
function warnUnsupportedBotGroupTriggerOnce(triggerMode, logger) {
|
|
10
|
+
const mode = String(triggerMode ?? "").trim().toLowerCase();
|
|
11
|
+
if (!mode || UNSUPPORTED_BOT_GROUP_TRIGGER_WARNED.has(mode)) return;
|
|
12
|
+
UNSUPPORTED_BOT_GROUP_TRIGGER_WARNED.add(mode);
|
|
13
|
+
logger?.warn?.(
|
|
14
|
+
`wecom(bot): groupChat.triggerMode=${mode} is not supported by WeCom Bot group callbacks; forcing mention mode (@).`,
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function normalizeWecomBotGroupChatPolicy(groupChatPolicy = {}, logger) {
|
|
19
|
+
const policy = groupChatPolicy && typeof groupChatPolicy === "object" ? groupChatPolicy : {};
|
|
20
|
+
const enabled = policy.enabled !== false;
|
|
21
|
+
const mentionPatterns =
|
|
22
|
+
Array.isArray(policy.mentionPatterns) && policy.mentionPatterns.length > 0 ? policy.mentionPatterns : ["@"];
|
|
23
|
+
|
|
24
|
+
if (!enabled) {
|
|
25
|
+
return {
|
|
26
|
+
...policy,
|
|
27
|
+
enabled: false,
|
|
28
|
+
mentionPatterns,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const triggerMode = String(policy.triggerMode ?? "").trim().toLowerCase();
|
|
33
|
+
if (triggerMode && triggerMode !== "mention") {
|
|
34
|
+
warnUnsupportedBotGroupTriggerOnce(triggerMode, logger);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
...policy,
|
|
39
|
+
enabled: true,
|
|
40
|
+
triggerMode: "mention",
|
|
41
|
+
requireMention: true,
|
|
42
|
+
mentionPatterns,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
7
46
|
export function assertWecomBotInboundFlowDeps({ api, ...deps } = {}) {
|
|
8
47
|
if (!api || typeof api !== "object") {
|
|
9
48
|
throw new Error("executeWecomBotInboundFlow: api is required");
|
|
@@ -104,7 +143,7 @@ export function createWecomBotInboundFlowState({
|
|
|
104
143
|
.filter(Boolean),
|
|
105
144
|
),
|
|
106
145
|
),
|
|
107
|
-
groupChatPolicy: resolveWecomGroupChatPolicy(api),
|
|
146
|
+
groupChatPolicy: normalizeWecomBotGroupChatPolicy(resolveWecomGroupChatPolicy(api), api?.logger),
|
|
108
147
|
dynamicAgentPolicy: resolveWecomDynamicAgentPolicy(api),
|
|
109
148
|
isAdminUser: false,
|
|
110
149
|
};
|
|
@@ -180,11 +180,7 @@ export function buildBotStatusText({
|
|
|
180
180
|
const dmPolicyLine = buildDmPolicyStatusLine(dmPolicy);
|
|
181
181
|
const eventPolicyLine = buildEventPolicyStatusLine(eventPolicy);
|
|
182
182
|
const groupPolicyLine = groupPolicy.enabled
|
|
183
|
-
?
|
|
184
|
-
? "✅ 群聊触发:仅 @ 命中后处理"
|
|
185
|
-
: groupPolicy.triggerMode === "keyword"
|
|
186
|
-
? `✅ 群聊触发:关键词模式(${(groupPolicy.triggerKeywords || []).join(" / ") || "未配置关键词"})`
|
|
187
|
-
: "✅ 群聊触发:无需 @(全部处理)"
|
|
183
|
+
? "✅ 群聊触发:仅 @ 机器人后处理(企业微信 Bot 平台限制)"
|
|
188
184
|
: "⚠️ 群聊处理未启用";
|
|
189
185
|
const fallbackPolicyLine = deliveryFallbackPolicy.enabled
|
|
190
186
|
? `✅ 回包兜底链路已启用(${deliveryFallbackPolicy.order.join(" > ")})`
|
|
@@ -237,5 +233,7 @@ export function buildWecomBotHelpText() {
|
|
|
237
233
|
/status - 查看系统状态
|
|
238
234
|
/clear - 重置会话(等价于 /reset)
|
|
239
235
|
|
|
236
|
+
说明:企业微信 Bot 群聊通常仅对 @ 机器人消息触发回调。
|
|
237
|
+
|
|
240
238
|
直接发送消息即可与 AI 对话。`;
|
|
241
239
|
}
|