@lanmers/wecom-openclaw-plugin-agents 3.0.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 +326 -0
- package/dist/index.cjs.js +3617 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.esm.js +3591 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/src/channel.d.ts +11 -0
- package/dist/src/const.d.ts +74 -0
- package/dist/src/dm-policy.d.ts +29 -0
- package/dist/src/group-policy.d.ts +29 -0
- package/dist/src/interface.d.ts +154 -0
- package/dist/src/mcp/index.d.ts +6 -0
- package/dist/src/mcp/schema.d.ts +11 -0
- package/dist/src/mcp/tool.d.ts +55 -0
- package/dist/src/mcp/transport.d.ts +61 -0
- package/dist/src/mcp-config.d.ts +29 -0
- package/dist/src/media-handler.d.ts +36 -0
- package/dist/src/media-uploader.d.ts +131 -0
- package/dist/src/message-parser.d.ts +72 -0
- package/dist/src/message-sender.d.ts +23 -0
- package/dist/src/monitor.d.ts +27 -0
- package/dist/src/onboarding.d.ts +5 -0
- package/dist/src/openclaw-compat.d.ts +48 -0
- package/dist/src/reqid-store.d.ts +31 -0
- package/dist/src/runtime.d.ts +3 -0
- package/dist/src/state-manager.d.ts +76 -0
- package/dist/src/timeout.d.ts +20 -0
- package/dist/src/utils.d.ts +80 -0
- package/dist/src/version.d.ts +2 -0
- package/openclaw.plugin.json +14 -0
- package/package.json +73 -0
- package/skills/wecom-contact-lookup/SKILL.md +162 -0
- package/skills/wecom-doc/SKILL.md +363 -0
- package/skills/wecom-doc/references/doc-api.md +224 -0
- package/skills/wecom-doc-manager/SKILL.md +64 -0
- package/skills/wecom-doc-manager/references/api-create-doc.md +56 -0
- package/skills/wecom-doc-manager/references/api-edit-doc-content.md +68 -0
- package/skills/wecom-doc-manager/references/api-export-document.md +88 -0
- package/skills/wecom-edit-todo/SKILL.md +249 -0
- package/skills/wecom-get-todo-detail/SKILL.md +143 -0
- package/skills/wecom-get-todo-list/SKILL.md +127 -0
- package/skills/wecom-meeting-create/SKILL.md +158 -0
- package/skills/wecom-meeting-create/references/example-full.md +30 -0
- package/skills/wecom-meeting-create/references/example-reminder.md +46 -0
- package/skills/wecom-meeting-create/references/example-security.md +22 -0
- package/skills/wecom-meeting-manage/SKILL.md +136 -0
- package/skills/wecom-meeting-query/SKILL.md +330 -0
- package/skills/wecom-preflight/SKILL.md +141 -0
- package/skills/wecom-schedule/SKILL.md +159 -0
- package/skills/wecom-schedule/references/api-check-availability.md +56 -0
- package/skills/wecom-schedule/references/api-create-schedule.md +38 -0
- package/skills/wecom-schedule/references/api-get-schedule-detail.md +81 -0
- package/skills/wecom-schedule/references/api-update-schedule.md +30 -0
- package/skills/wecom-schedule/references/ref-reminders.md +24 -0
- package/skills/wecom-smartsheet-data/SKILL.md +71 -0
- package/skills/wecom-smartsheet-data/references/api-get-records.md +61 -0
- package/skills/wecom-smartsheet-data/references/cell-value-formats.md +120 -0
- package/skills/wecom-smartsheet-schema/SKILL.md +92 -0
- package/skills/wecom-smartsheet-schema/references/field-types.md +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
# 🤖 企业微信 OpenClaw 插件
|
|
2
|
+
|
|
3
|
+
**OpenClaw [企业微信](https://github.com/openclaw) 频道插件** — 由腾讯企业微信团队提供。
|
|
4
|
+
|
|
5
|
+
> 基于企业微信 AI 机器人 WebSocket 持久连接构建的机器人插件。支持私信和群聊、流式回复和主动消息推送。
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
📖 [企业微信 AI 机器人官方文档](https://open.work.weixin.qq.com/help?doc_id=21657)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## ✨ 功能特性
|
|
13
|
+
|
|
14
|
+
- 🔗 WebSocket 持久连接,通信稳定
|
|
15
|
+
- 💬 支持私信 (DM) 和群聊
|
|
16
|
+
- 📤 支持主动向指定用户或群组发送消息
|
|
17
|
+
- 🖼️ 接收并自动下载处理图片和文件消息
|
|
18
|
+
- ⏳ 流式回复,支持"思考中"占位消息
|
|
19
|
+
- 📝 支持 Markdown 格式回复
|
|
20
|
+
- 🔒 内置访问控制:私信策略(pairing / open / allowlist / disabled)和群聊策略(open / allowlist / disabled)
|
|
21
|
+
- ⚡ 自动心跳保活和重连(最多 100 次重连尝试)
|
|
22
|
+
- 🧙 交互式 CLI 配置向导
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 🚀 快速开始
|
|
27
|
+
|
|
28
|
+
### 环境要求
|
|
29
|
+
|
|
30
|
+
- OpenClaw `>= 2026.2.13`
|
|
31
|
+
|
|
32
|
+
### 快速安装
|
|
33
|
+
|
|
34
|
+
使用 CLI 工具自动安装插件并完成机器人配置:
|
|
35
|
+
|
|
36
|
+
```shell
|
|
37
|
+
npx -y @lanmers/wecom-openclaw-cli install
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 手动安装
|
|
41
|
+
|
|
42
|
+
```shell
|
|
43
|
+
openclaw plugins install @lanmers/wecom-openclaw-plugin-agents
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 配置
|
|
47
|
+
|
|
48
|
+
#### 方式一:交互式配置(单 Agent)
|
|
49
|
+
|
|
50
|
+
```shell
|
|
51
|
+
openclaw channels add
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
按照提示输入企业微信机器人的 **Bot ID** 和 **Secret**。
|
|
55
|
+
|
|
56
|
+
#### 方式二:交互式配置(多 Agent)
|
|
57
|
+
|
|
58
|
+
```shell
|
|
59
|
+
# 添加第一个 Agent
|
|
60
|
+
openclaw channels add wecom-bot1
|
|
61
|
+
|
|
62
|
+
# 添加更多 Agent
|
|
63
|
+
openclaw channels add wecom-bot2
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
#### 方式三:CLI 快速配置(单 Agent)
|
|
67
|
+
|
|
68
|
+
```shell
|
|
69
|
+
openclaw config set channels.wecom.botId <YOUR_BOT_ID>
|
|
70
|
+
openclaw config set channels.wecom.secret <YOUR_BOT_SECRET>
|
|
71
|
+
openclaw config set channels.wecom.enabled true
|
|
72
|
+
openclaw gateway restart
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### 方式四:CLI 快速配置(多 Agent)
|
|
76
|
+
|
|
77
|
+
```shell
|
|
78
|
+
# 配置第一个 Agent
|
|
79
|
+
openclaw config set channels.wecom-bot1.botId <BOT_ID_1>
|
|
80
|
+
openclaw config set channels.wecom-bot1.secret <SECRET_1>
|
|
81
|
+
openclaw config set channels.wecom-bot1.enabled true
|
|
82
|
+
|
|
83
|
+
# 配置第二个 Agent
|
|
84
|
+
openclaw config set channels.wecom-bot2.botId <BOT_ID_2>
|
|
85
|
+
openclaw config set channels.wecom-bot2.secret <SECRET_2>
|
|
86
|
+
openclaw config set channels.wecom-bot2.enabled true
|
|
87
|
+
|
|
88
|
+
openclaw gateway restart
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 配置参考
|
|
92
|
+
|
|
93
|
+
#### 单账户配置(兼容旧版)
|
|
94
|
+
|
|
95
|
+
| 配置路径 | 说明 | 选项 | 默认值 |
|
|
96
|
+
|----------|------|------|--------|
|
|
97
|
+
| `channels.wecom.botId` | 企业微信机器人 ID | - | - |
|
|
98
|
+
| `channels.wecom.secret` | 企业微信机器人密钥 | - | - |
|
|
99
|
+
| `channels.wecom.enabled` | 启用频道 | `true` / `false` | `false` |
|
|
100
|
+
| `channels.wecom.websocketUrl` | WebSocket 端点 | - | `wss://openws.work.weixin.qq.com` |
|
|
101
|
+
| `channels.wecom.dmPolicy` | 私信访问策略 | `pairing` / `open` / `allowlist` / `disabled` | `open` |
|
|
102
|
+
| `channels.wecom.allowFrom` | 私信白名单(用户 ID) | - | `[]` |
|
|
103
|
+
| `channels.wecom.groupPolicy` | 群聊访问策略 | `open` / `allowlist` / `disabled` | `open` |
|
|
104
|
+
| `channels.wecom.groupAllowFrom` | 群聊白名单(群组 ID) | - | `[]` |
|
|
105
|
+
| `channels.wecom.sendThinkingMessage` | 发送"思考中"占位消息 | `true` / `false` | `true` |
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 🤖 多 Agent 模式(推荐)
|
|
110
|
+
|
|
111
|
+
插件支持为每个企业微信机器人创建独立的 Agent,拥有独立的对话上下文和 MCP 工具配置。
|
|
112
|
+
|
|
113
|
+
### 工作原理
|
|
114
|
+
|
|
115
|
+
- 直接在 `channels` 下配置每个 Agent(格式:`wecom-{name}`)
|
|
116
|
+
- 每个 Agent 独立运行、独立的 WebSocket 连接、独立的对话历史
|
|
117
|
+
- 每个 Agent 拥有独立的访问策略配置
|
|
118
|
+
|
|
119
|
+
### 配置示例
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"channels": {
|
|
124
|
+
"wecom-bot1": {
|
|
125
|
+
"botId": "xxx",
|
|
126
|
+
"secret": "xxx",
|
|
127
|
+
"enabled": true,
|
|
128
|
+
"dmPolicy": "open"
|
|
129
|
+
},
|
|
130
|
+
"wecom-bot2": {
|
|
131
|
+
"botId": "yyy",
|
|
132
|
+
"secret": "yyy",
|
|
133
|
+
"enabled": true,
|
|
134
|
+
"dmPolicy": "pairing"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
| 配置路径 | 说明 | 选项 | 默认值 |
|
|
141
|
+
|----------|------|------|--------|
|
|
142
|
+
| `channels.wecom-{name}.botId` | 企业微信机器人 ID | - | - |
|
|
143
|
+
| `channels.wecom-{name}.secret` | 企业微信机器人密钥 | - | - |
|
|
144
|
+
| `channels.wecom-{name}.enabled` | 启用该 Agent | `true` / `false` | `true` |
|
|
145
|
+
| `channels.wecom-{name}.dmPolicy` | 私信访问策略 | `pairing` / `open` / `allowlist` / `disabled` | `open` |
|
|
146
|
+
| `channels.wecom-{name}.allowFrom` | 私信白名单 | - | - |
|
|
147
|
+
| `channels.wecom-{name}.groupPolicy` | 群聊访问策略 | `open` / `allowlist` / `disabled` | `open` |
|
|
148
|
+
| `channels.wecom-{name}.groupAllowFrom` | 群聊白名单 | - | - |
|
|
149
|
+
| `channels.wecom-{name}.sendThinkingMessage` | 发送思考中消息 | `true` / `false` | `true` |
|
|
150
|
+
|
|
151
|
+
### CLI 命令
|
|
152
|
+
|
|
153
|
+
```shell
|
|
154
|
+
# 查看所有 Agent
|
|
155
|
+
openclaw channels list
|
|
156
|
+
|
|
157
|
+
# 查看特定 Agent 状态
|
|
158
|
+
openclaw channels status wecom-bot1
|
|
159
|
+
|
|
160
|
+
# 添加新 Agent
|
|
161
|
+
openclaw channels add wecom-bot2 --bot-id <id> --secret <secret>
|
|
162
|
+
|
|
163
|
+
# 删除 Agent
|
|
164
|
+
openclaw channels remove wecom-bot1
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
"secret": "xxx",
|
|
169
|
+
"enabled": true,
|
|
170
|
+
"dmPolicy": "open",
|
|
171
|
+
"allowFrom": ["*"],
|
|
172
|
+
"groupPolicy": "open",
|
|
173
|
+
"sendThinkingMessage": true
|
|
174
|
+
},
|
|
175
|
+
"wecom-bot2": {
|
|
176
|
+
"botId": "yyy",
|
|
177
|
+
"secret": "yyy",
|
|
178
|
+
"enabled": true,
|
|
179
|
+
"dmPolicy": "pairing",
|
|
180
|
+
"allowFrom": ["user1", "user2"],
|
|
181
|
+
"groupPolicy": "allowlist",
|
|
182
|
+
"groupAllowFrom": ["group1"],
|
|
183
|
+
"sendThinkingMessage": false
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
| 配置路径 | 说明 | 选项 | 默认值 |
|
|
190
|
+
|----------|------|------|--------|
|
|
191
|
+
| `channels.wecom-{name}.dmPolicy` | 私信访问策略 | `pairing` / `open` / `allowlist` / `disabled` | 继承全局 |
|
|
192
|
+
| `channels.wecom-{name}.allowFrom` | 私信白名单 | - | 继承全局 |
|
|
193
|
+
| `channels.wecom-{name}.groupPolicy` | 群聊访问策略 | `open` / `allowlist` / `disabled` | 继承全局 |
|
|
194
|
+
| `channels.wecom-{name}.groupAllowFrom` | 群聊白名单 | - | 继承全局 |
|
|
195
|
+
| `channels.wecom-{name}.sendThinkingMessage` | 发送思考中消息 | `true` / `false` | `true` |
|
|
196
|
+
|
|
197
|
+
### MCP 工具调用
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
// 调用指定 Agent 的 MCP 服务
|
|
201
|
+
wecom_mcp list contact --accountId bot1
|
|
202
|
+
wecom_mcp call contact getContact '{}' --accountId bot2
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### CLI 命令
|
|
206
|
+
|
|
207
|
+
```shell
|
|
208
|
+
# 查看所有 Agent
|
|
209
|
+
openclaw channels list
|
|
210
|
+
|
|
211
|
+
# 查看特定 Agent 状态
|
|
212
|
+
openclaw channels status wecom-bot1
|
|
213
|
+
|
|
214
|
+
# 添加新 Agent
|
|
215
|
+
openclaw channels add wecom-bot2 --bot-id <id> --secret <secret>
|
|
216
|
+
|
|
217
|
+
# 删除 Agent
|
|
218
|
+
openclaw channels remove wecom-bot1
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## 🔒 访问控制
|
|
224
|
+
|
|
225
|
+
### 私信访问
|
|
226
|
+
|
|
227
|
+
**默认**: `dmPolicy: "open"` — 所有用户都可以发送私信,无需审批。
|
|
228
|
+
|
|
229
|
+
#### 审批配对
|
|
230
|
+
|
|
231
|
+
```shell
|
|
232
|
+
openclaw pairing list wecom # 查看待处理的配对请求
|
|
233
|
+
openclaw pairing approve wecom <CODE> # 审批配对请求
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
#### 白名单模式
|
|
237
|
+
|
|
238
|
+
通过 `channels.wecom.allowFrom` 配置允许的用户 ID:
|
|
239
|
+
|
|
240
|
+
```json
|
|
241
|
+
{
|
|
242
|
+
"channels": {
|
|
243
|
+
"wecom": {
|
|
244
|
+
"dmPolicy": "allowlist",
|
|
245
|
+
"allowFrom": ["user_id_1", "user_id_2"]
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
#### 开放模式
|
|
252
|
+
|
|
253
|
+
设置 `dmPolicy: "open"` 允许所有用户发送私信,无需审批。
|
|
254
|
+
|
|
255
|
+
#### 禁用模式
|
|
256
|
+
|
|
257
|
+
设置 `dmPolicy: "disabled"` 完全屏蔽所有私信。
|
|
258
|
+
|
|
259
|
+
### 群聊访问
|
|
260
|
+
|
|
261
|
+
#### 群聊策略 (`channels.wecom.groupPolicy`)
|
|
262
|
+
|
|
263
|
+
- `"open"` — 允许所有群组的消息(默认)
|
|
264
|
+
- `"allowlist"` — 仅允许 `groupAllowFrom` 中列出的群组
|
|
265
|
+
- `"disabled"` — 禁用所有群组消息
|
|
266
|
+
|
|
267
|
+
### 群聊配置示例
|
|
268
|
+
|
|
269
|
+
#### 允许所有群组(默认行为)
|
|
270
|
+
|
|
271
|
+
```json
|
|
272
|
+
{
|
|
273
|
+
"channels": {
|
|
274
|
+
"wecom": {
|
|
275
|
+
"groupPolicy": "open"
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
#### 仅允许特定群组
|
|
282
|
+
|
|
283
|
+
```json
|
|
284
|
+
{
|
|
285
|
+
"channels": {
|
|
286
|
+
"wecom": {
|
|
287
|
+
"groupPolicy": "allowlist",
|
|
288
|
+
"groupAllowFrom": ["group_id_1", "group_id_2"]
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
#### 允许群组内特定成员(发送者白名单)
|
|
295
|
+
|
|
296
|
+
除了群组白名单外,还可以限制群组内哪些成员可以与机器人交互。只有 `groups.<chatId>.allowFrom` 中列出的用户发送的消息才会被处理;其他成员的消息将被静默忽略。这是一个适用于**所有消息**的发送者级别白名单。
|
|
297
|
+
|
|
298
|
+
```json
|
|
299
|
+
{
|
|
300
|
+
"channels": {
|
|
301
|
+
"wecom": {
|
|
302
|
+
"groupPolicy": "allowlist",
|
|
303
|
+
"groupAllowFrom": ["group_id_1"],
|
|
304
|
+
"groups": {
|
|
305
|
+
"group_id_1": {
|
|
306
|
+
"allowFrom": ["user_id_1", "user_id_2"]
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## 📦 更新
|
|
317
|
+
|
|
318
|
+
```shell
|
|
319
|
+
openclaw plugins update wecom-openclaw-plugin-agents
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## 📄 许可证
|
|
325
|
+
|
|
326
|
+
MIT
|