@lanmers/wecom-openclaw-plugin 1.0.12

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.
Files changed (59) hide show
  1. package/README.md +220 -0
  2. package/dist/index.cjs.js +3591 -0
  3. package/dist/index.cjs.js.map +1 -0
  4. package/dist/index.d.ts +11 -0
  5. package/dist/index.esm.js +3565 -0
  6. package/dist/index.esm.js.map +1 -0
  7. package/dist/src/channel.d.ts +3 -0
  8. package/dist/src/const.d.ts +64 -0
  9. package/dist/src/dm-policy.d.ts +29 -0
  10. package/dist/src/group-policy.d.ts +29 -0
  11. package/dist/src/interface.d.ts +154 -0
  12. package/dist/src/mcp/index.d.ts +6 -0
  13. package/dist/src/mcp/schema.d.ts +11 -0
  14. package/dist/src/mcp/tool.d.ts +55 -0
  15. package/dist/src/mcp/transport.d.ts +61 -0
  16. package/dist/src/mcp-config.d.ts +29 -0
  17. package/dist/src/media-handler.d.ts +36 -0
  18. package/dist/src/media-uploader.d.ts +131 -0
  19. package/dist/src/message-parser.d.ts +72 -0
  20. package/dist/src/message-sender.d.ts +23 -0
  21. package/dist/src/monitor.d.ts +27 -0
  22. package/dist/src/onboarding.d.ts +5 -0
  23. package/dist/src/openclaw-compat.d.ts +48 -0
  24. package/dist/src/reqid-store.d.ts +31 -0
  25. package/dist/src/runtime.d.ts +3 -0
  26. package/dist/src/state-manager.d.ts +76 -0
  27. package/dist/src/timeout.d.ts +20 -0
  28. package/dist/src/utils.d.ts +96 -0
  29. package/dist/src/version.d.ts +2 -0
  30. package/openclaw.plugin.json +14 -0
  31. package/package.json +73 -0
  32. package/skills/wecom-contact-lookup/SKILL.md +162 -0
  33. package/skills/wecom-doc/SKILL.md +363 -0
  34. package/skills/wecom-doc/references/doc-api.md +224 -0
  35. package/skills/wecom-doc-manager/SKILL.md +64 -0
  36. package/skills/wecom-doc-manager/references/api-create-doc.md +56 -0
  37. package/skills/wecom-doc-manager/references/api-edit-doc-content.md +68 -0
  38. package/skills/wecom-doc-manager/references/api-export-document.md +88 -0
  39. package/skills/wecom-edit-todo/SKILL.md +249 -0
  40. package/skills/wecom-get-todo-detail/SKILL.md +143 -0
  41. package/skills/wecom-get-todo-list/SKILL.md +127 -0
  42. package/skills/wecom-meeting-create/SKILL.md +158 -0
  43. package/skills/wecom-meeting-create/references/example-full.md +30 -0
  44. package/skills/wecom-meeting-create/references/example-reminder.md +46 -0
  45. package/skills/wecom-meeting-create/references/example-security.md +22 -0
  46. package/skills/wecom-meeting-manage/SKILL.md +136 -0
  47. package/skills/wecom-meeting-query/SKILL.md +330 -0
  48. package/skills/wecom-preflight/SKILL.md +141 -0
  49. package/skills/wecom-schedule/SKILL.md +159 -0
  50. package/skills/wecom-schedule/references/api-check-availability.md +56 -0
  51. package/skills/wecom-schedule/references/api-create-schedule.md +38 -0
  52. package/skills/wecom-schedule/references/api-get-schedule-detail.md +81 -0
  53. package/skills/wecom-schedule/references/api-update-schedule.md +30 -0
  54. package/skills/wecom-schedule/references/ref-reminders.md +24 -0
  55. package/skills/wecom-smartsheet-data/SKILL.md +71 -0
  56. package/skills/wecom-smartsheet-data/references/api-get-records.md +61 -0
  57. package/skills/wecom-smartsheet-data/references/cell-value-formats.md +120 -0
  58. package/skills/wecom-smartsheet-schema/SKILL.md +92 -0
  59. package/skills/wecom-smartsheet-schema/references/field-types.md +43 -0
package/README.md ADDED
@@ -0,0 +1,220 @@
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 @wecom/wecom-openclaw-cli install
38
+ ```
39
+
40
+ ### 手动安装
41
+
42
+ ```shell
43
+ openclaw plugins install @wecom/wecom-openclaw-plugin
44
+ ```
45
+
46
+ ### 配置
47
+
48
+ #### 方式一:交互式配置
49
+
50
+ ```shell
51
+ openclaw channels add
52
+ ```
53
+
54
+ 按照提示输入企业微信机器人的 **Bot ID** 和 **Secret**。
55
+
56
+ #### 方式二:CLI 快速配置
57
+
58
+ ```shell
59
+ openclaw config set channels.wecom.botId <YOUR_BOT_ID>
60
+ openclaw config set channels.wecom.secret <YOUR_BOT_SECRET>
61
+ openclaw config set channels.wecom.enabled true
62
+ openclaw gateway restart
63
+ ```
64
+
65
+ ### 配置参考
66
+
67
+ #### 单账户配置(兼容旧版)
68
+
69
+ | 配置路径 | 说明 | 选项 | 默认值 |
70
+ |----------|------|------|--------|
71
+ | `channels.wecom.botId` | 企业微信机器人 ID | - | - |
72
+ | `channels.wecom.secret` | 企业微信机器人密钥 | - | - |
73
+ | `channels.wecom.enabled` | 启用频道 | `true` / `false` | `false` |
74
+ | `channels.wecom.websocketUrl` | WebSocket 端点 | - | `wss://openws.work.weixin.qq.com` |
75
+ | `channels.wecom.dmPolicy` | 私信访问策略 | `pairing` / `open` / `allowlist` / `disabled` | `open` |
76
+ | `channels.wecom.allowFrom` | 私信白名单(用户 ID) | - | `[]` |
77
+ | `channels.wecom.groupPolicy` | 群聊访问策略 | `open` / `allowlist` / `disabled` | `open` |
78
+ | `channels.wecom.groupAllowFrom` | 群聊白名单(群组 ID) | - | `[]` |
79
+ | `channels.wecom.sendThinkingMessage` | 发送"思考中"占位消息 | `true` / `false` | `true` |
80
+
81
+ #### 多账户配置(推荐)
82
+
83
+ ```json
84
+ {
85
+ "channels": {
86
+ "wecom": {
87
+ "enabled": true,
88
+ "accounts": [
89
+ {
90
+ "name": "bot1",
91
+ "botId": "xxx",
92
+ "secret": "xxx",
93
+ "enabled": true
94
+ },
95
+ {
96
+ "name": "bot2",
97
+ "botId": "yyy",
98
+ "secret": "yyy",
99
+ "enabled": false
100
+ }
101
+ ]
102
+ }
103
+ }
104
+ }
105
+ ```
106
+
107
+ | 配置路径 | 说明 | 选项 | 默认值 |
108
+ |----------|------|------|--------|
109
+ | `channels.wecom.accounts[].name` | 账户唯一标识 | - | - |
110
+ | `channels.wecom.accounts[].botId` | 企业微信机器人 ID | - | - |
111
+ | `channels.wecom.accounts[].secret` | 企业微信机器人密钥 | - | - |
112
+ | `channels.wecom.accounts[].enabled` | 启用该账户 | `true` / `false` | `true` |
113
+ | `channels.wecom.accounts[].websocketUrl` | WebSocket 端点(可选,覆盖全局配置) | - | - |
114
+
115
+ ---
116
+
117
+ ## 🔒 访问控制
118
+
119
+ ### 私信访问
120
+
121
+ **默认**: `dmPolicy: "open"` — 所有用户都可以发送私信,无需审批。
122
+
123
+ #### 审批配对
124
+
125
+ ```shell
126
+ openclaw pairing list wecom # 查看待处理的配对请求
127
+ openclaw pairing approve wecom <CODE> # 审批配对请求
128
+ ```
129
+
130
+ #### 白名单模式
131
+
132
+ 通过 `channels.wecom.allowFrom` 配置允许的用户 ID:
133
+
134
+ ```json
135
+ {
136
+ "channels": {
137
+ "wecom": {
138
+ "dmPolicy": "allowlist",
139
+ "allowFrom": ["user_id_1", "user_id_2"]
140
+ }
141
+ }
142
+ }
143
+ ```
144
+
145
+ #### 开放模式
146
+
147
+ 设置 `dmPolicy: "open"` 允许所有用户发送私信,无需审批。
148
+
149
+ #### 禁用模式
150
+
151
+ 设置 `dmPolicy: "disabled"` 完全屏蔽所有私信。
152
+
153
+ ### 群聊访问
154
+
155
+ #### 群聊策略 (`channels.wecom.groupPolicy`)
156
+
157
+ - `"open"` — 允许所有群组的消息(默认)
158
+ - `"allowlist"` — 仅允许 `groupAllowFrom` 中列出的群组
159
+ - `"disabled"` — 禁用所有群组消息
160
+
161
+ ### 群聊配置示例
162
+
163
+ #### 允许所有群组(默认行为)
164
+
165
+ ```json
166
+ {
167
+ "channels": {
168
+ "wecom": {
169
+ "groupPolicy": "open"
170
+ }
171
+ }
172
+ }
173
+ ```
174
+
175
+ #### 仅允许特定群组
176
+
177
+ ```json
178
+ {
179
+ "channels": {
180
+ "wecom": {
181
+ "groupPolicy": "allowlist",
182
+ "groupAllowFrom": ["group_id_1", "group_id_2"]
183
+ }
184
+ }
185
+ }
186
+ ```
187
+
188
+ #### 允许群组内特定成员(发送者白名单)
189
+
190
+ 除了群组白名单外,还可以限制群组内哪些成员可以与机器人交互。只有 `groups.<chatId>.allowFrom` 中列出的用户发送的消息才会被处理;其他成员的消息将被静默忽略。这是一个适用于**所有消息**的发送者级别白名单。
191
+
192
+ ```json
193
+ {
194
+ "channels": {
195
+ "wecom": {
196
+ "groupPolicy": "allowlist",
197
+ "groupAllowFrom": ["group_id_1"],
198
+ "groups": {
199
+ "group_id_1": {
200
+ "allowFrom": ["user_id_1", "user_id_2"]
201
+ }
202
+ }
203
+ }
204
+ }
205
+ }
206
+ ```
207
+
208
+ ---
209
+
210
+ ## 📦 更新
211
+
212
+ ```shell
213
+ openclaw plugins update wecom-openclaw-plugin
214
+ ```
215
+
216
+ ---
217
+
218
+ ## 📄 许可证
219
+
220
+ MIT