@sunnoy/wecom 1.2.0 → 1.3.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.
@@ -0,0 +1,165 @@
1
+ import { copyFileSync, existsSync, mkdirSync, readdirSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { logger } from "../logger.js";
4
+ import { BOOTSTRAP_FILENAMES } from "./constants.js";
5
+ import {
6
+ getEnsureDynamicAgentWriteQueue,
7
+ getEnsuredDynamicAgentIds,
8
+ getOpenclawConfig,
9
+ getRuntime,
10
+ setEnsureDynamicAgentWriteQueue,
11
+ setOpenclawConfig,
12
+ } from "./state.js";
13
+
14
+ /**
15
+ * Resolve the agent workspace directory for a given agentId.
16
+ * Mirrors openclaw core's resolveAgentWorkspaceDir logic for non-default agents:
17
+ * stateDir/workspace-{agentId}
18
+ */
19
+ export function resolveAgentWorkspaceDirLocal(agentId) {
20
+ const stateDir =
21
+ process.env.OPENCLAW_STATE_DIR?.trim() ||
22
+ process.env.CLAWDBOT_STATE_DIR?.trim() ||
23
+ join(process.env.HOME || "/root", ".openclaw");
24
+ return join(stateDir, `workspace-${agentId}`);
25
+ }
26
+
27
+ /**
28
+ * Read the workspace template dir from plugin config.
29
+ * Config key: channels.wecom.workspaceTemplate
30
+ */
31
+ export function getWorkspaceTemplateDir(config) {
32
+ return config?.channels?.wecom?.workspaceTemplate?.trim() || null;
33
+ }
34
+
35
+ /**
36
+ * Copy template files into a newly created agent's workspace directory.
37
+ * Only copies files that don't already exist (writeFileIfMissing semantics).
38
+ * Silently skips if workspaceTemplate is not configured or directory is missing.
39
+ */
40
+ export function seedAgentWorkspace(agentId, config) {
41
+ const templateDir = getWorkspaceTemplateDir(config);
42
+ if (!templateDir) {
43
+ return;
44
+ }
45
+
46
+ if (!existsSync(templateDir)) {
47
+ logger.warn("WeCom: workspace template dir not found, skipping seed", { templateDir });
48
+ return;
49
+ }
50
+
51
+ const workspaceDir = resolveAgentWorkspaceDirLocal(agentId);
52
+
53
+ try {
54
+ mkdirSync(workspaceDir, { recursive: true });
55
+
56
+ const files = readdirSync(templateDir);
57
+ for (const file of files) {
58
+ if (!BOOTSTRAP_FILENAMES.has(file)) {
59
+ continue;
60
+ }
61
+ const dest = join(workspaceDir, file);
62
+ if (existsSync(dest)) {
63
+ continue;
64
+ }
65
+ copyFileSync(join(templateDir, file), dest);
66
+ logger.info("WeCom: seeded workspace file", { agentId, file });
67
+ }
68
+ } catch (err) {
69
+ logger.warn("WeCom: failed to seed agent workspace", {
70
+ agentId,
71
+ error: err?.message || String(err),
72
+ });
73
+ }
74
+ }
75
+
76
+ export function upsertAgentIdOnlyEntry(cfg, agentId) {
77
+ const normalizedId = String(agentId || "")
78
+ .trim()
79
+ .toLowerCase();
80
+ if (!normalizedId) {
81
+ return false;
82
+ }
83
+
84
+ if (!cfg.agents || typeof cfg.agents !== "object") {
85
+ cfg.agents = {};
86
+ }
87
+
88
+ const currentList = Array.isArray(cfg.agents.list) ? cfg.agents.list : [];
89
+ const existingIds = new Set(
90
+ currentList
91
+ .map((entry) => (entry && typeof entry.id === "string" ? entry.id.trim().toLowerCase() : ""))
92
+ .filter(Boolean),
93
+ );
94
+
95
+ let changed = false;
96
+ const nextList = [...currentList];
97
+
98
+ // Keep "main" as the explicit default when creating agents.list for the first time.
99
+ if (nextList.length === 0) {
100
+ nextList.push({ id: "main" });
101
+ existingIds.add("main");
102
+ changed = true;
103
+ }
104
+
105
+ if (!existingIds.has(normalizedId)) {
106
+ nextList.push({ id: normalizedId });
107
+ changed = true;
108
+ }
109
+
110
+ if (changed) {
111
+ cfg.agents.list = nextList;
112
+ }
113
+
114
+ return changed;
115
+ }
116
+
117
+ export async function ensureDynamicAgentListed(agentId) {
118
+ const normalizedId = String(agentId || "")
119
+ .trim()
120
+ .toLowerCase();
121
+ if (!normalizedId) {
122
+ return;
123
+ }
124
+
125
+ const runtime = getRuntime();
126
+ const configRuntime = runtime?.config;
127
+ if (!configRuntime?.loadConfig || !configRuntime?.writeConfigFile) {
128
+ return;
129
+ }
130
+
131
+ const queue = getEnsureDynamicAgentWriteQueue()
132
+ .then(async () => {
133
+ const latestConfig = configRuntime.loadConfig();
134
+ if (!latestConfig || typeof latestConfig !== "object") {
135
+ return;
136
+ }
137
+
138
+ const changed = upsertAgentIdOnlyEntry(latestConfig, normalizedId);
139
+ if (changed) {
140
+ await configRuntime.writeConfigFile(latestConfig);
141
+ logger.info("WeCom: dynamic agent added to agents.list", { agentId: normalizedId });
142
+ }
143
+ // Always attempt seeding so recreated/cleaned dynamic agents can recover
144
+ // template files even when the id already exists in agents.list.
145
+ seedAgentWorkspace(normalizedId, latestConfig);
146
+
147
+ // Keep runtime in-memory config aligned to avoid stale reads in this process.
148
+ const openclawConfig = getOpenclawConfig();
149
+ if (openclawConfig && typeof openclawConfig === "object") {
150
+ upsertAgentIdOnlyEntry(openclawConfig, normalizedId);
151
+ setOpenclawConfig(openclawConfig);
152
+ }
153
+
154
+ getEnsuredDynamicAgentIds().add(normalizedId);
155
+ })
156
+ .catch((err) => {
157
+ logger.warn("WeCom: failed to sync dynamic agent into agents.list", {
158
+ agentId: normalizedId,
159
+ error: err?.message || String(err),
160
+ });
161
+ });
162
+
163
+ setEnsureDynamicAgentWriteQueue(queue);
164
+ await queue;
165
+ }
@@ -0,0 +1,126 @@
1
+ /**
2
+ * WeCom XML Parser
3
+ *
4
+ * Simple regex-based parser for Agent mode XML callbacks.
5
+ * No external dependencies — WeCom XML has a flat, predictable structure.
6
+ *
7
+ * Typical decrypted XML:
8
+ * <xml>
9
+ * <ToUserName><![CDATA[corpId]]></ToUserName>
10
+ * <FromUserName><![CDATA[zhangsan]]></FromUserName>
11
+ * <CreateTime>1348831860</CreateTime>
12
+ * <MsgType><![CDATA[text]]></MsgType>
13
+ * <Content><![CDATA[hello]]></Content>
14
+ * <MsgId>1234567890123456</MsgId>
15
+ * <AgentID>1000002</AgentID>
16
+ * </xml>
17
+ */
18
+
19
+ /**
20
+ * Extract the <Encrypt> field from the outer XML envelope.
21
+ * Supports both CDATA and plain text formats.
22
+ *
23
+ * @param {string} xml - Raw XML string from WeCom POST body
24
+ * @returns {string} The encrypted payload
25
+ */
26
+ export function extractEncryptFromXml(xml) {
27
+ const cdataMatch = /<Encrypt><!\[CDATA\[(.*?)\]\]><\/Encrypt>/s.exec(xml);
28
+ if (cdataMatch?.[1]) return cdataMatch[1];
29
+
30
+ const plainMatch = /<Encrypt>(.*?)<\/Encrypt>/s.exec(xml);
31
+ if (plainMatch?.[1]) return plainMatch[1];
32
+
33
+ throw new Error("Invalid XML: missing Encrypt field");
34
+ }
35
+
36
+ /**
37
+ * Parse a decrypted WeCom XML message into a flat key-value object.
38
+ * Handles both CDATA-wrapped and plain text values.
39
+ *
40
+ * @param {string} xml - Decrypted XML string
41
+ * @returns {Record<string, string>}
42
+ */
43
+ export function parseXml(xml) {
44
+ const result = {};
45
+
46
+ // Match <TagName><![CDATA[value]]></TagName> (CDATA)
47
+ const cdataRegex = /<(\w+)><!\[CDATA\[([\s\S]*?)\]\]><\/\1>/g;
48
+ let match;
49
+ while ((match = cdataRegex.exec(xml)) !== null) {
50
+ result[match[1]] = match[2];
51
+ }
52
+
53
+ // Match <TagName>value</TagName> (plain text, skip already-captured CDATA fields)
54
+ const plainRegex = /<(\w+)>([^<]+)<\/\1>/g;
55
+ while ((match = plainRegex.exec(xml)) !== null) {
56
+ if (!(match[1] in result)) {
57
+ result[match[1]] = match[2].trim();
58
+ }
59
+ }
60
+
61
+ return result;
62
+ }
63
+
64
+ /** Extract message type (lowercase). */
65
+ export function extractMsgType(msg) {
66
+ return String(msg.MsgType ?? "").toLowerCase();
67
+ }
68
+
69
+ /** Extract sender user ID. */
70
+ export function extractFromUser(msg) {
71
+ return String(msg.FromUserName ?? "");
72
+ }
73
+
74
+ /** Extract group chat ID (undefined for DMs). */
75
+ export function extractChatId(msg) {
76
+ return msg.ChatId ? String(msg.ChatId) : undefined;
77
+ }
78
+
79
+ /** Extract message ID for deduplication. */
80
+ export function extractMsgId(msg) {
81
+ const raw = msg.MsgId ?? msg.MsgID ?? msg.msgid ?? msg.msgId;
82
+ return raw != null ? String(raw) : undefined;
83
+ }
84
+
85
+ /** Extract file name (for file messages). */
86
+ export function extractFileName(msg) {
87
+ const raw = msg.FileName ?? msg.Filename ?? msg.fileName ?? msg.filename;
88
+ return raw != null ? String(raw).trim() || undefined : undefined;
89
+ }
90
+
91
+ /** Extract media ID (for image/voice/video/file messages). */
92
+ export function extractMediaId(msg) {
93
+ const raw = msg.MediaId ?? msg.MediaID ?? msg.mediaid ?? msg.mediaId;
94
+ return raw != null ? String(raw).trim() || undefined : undefined;
95
+ }
96
+
97
+ /**
98
+ * Extract human-readable content from a parsed message.
99
+ *
100
+ * @param {Record<string, string>} msg - Parsed XML message
101
+ * @returns {string}
102
+ */
103
+ export function extractContent(msg) {
104
+ const msgType = extractMsgType(msg);
105
+
106
+ switch (msgType) {
107
+ case "text":
108
+ return String(msg.Content ?? "");
109
+ case "voice":
110
+ return String(msg.Recognition ?? "") || "[语音消息]";
111
+ case "image":
112
+ return `[图片] ${msg.PicUrl ?? ""}`;
113
+ case "file":
114
+ return "[文件消息]";
115
+ case "video":
116
+ return "[视频消息]";
117
+ case "location":
118
+ return `[位置] ${msg.Label ?? ""} (${msg.Location_X ?? ""}, ${msg.Location_Y ?? ""})`;
119
+ case "link":
120
+ return `[链接] ${msg.Title ?? ""}\n${msg.Description ?? ""}\n${msg.Url ?? ""}`;
121
+ case "event":
122
+ return `[事件] ${msg.Event ?? ""} - ${msg.EventKey ?? ""}`;
123
+ default:
124
+ return `[${msgType || "未知消息类型"}]`;
125
+ }
126
+ }
package/README_ZH.md DELETED
@@ -1,303 +0,0 @@
1
- # OpenClaw 企业微信 (WeCom) AI 机器人插件
2
-
3
- [简体中文](https://github.com/sunnoy/openclaw-plugin-wecom/blob/main/README_ZH.md) | [English](https://github.com/sunnoy/openclaw-plugin-wecom/blob/main/README.md)
4
-
5
- `openclaw-plugin-wecom` 是一个专为 [OpenClaw](https://github.com/openclaw/openclaw) 框架开发的企业微信(WeCom)集成插件。它允许你将强大的 AI 能力无缝接入企业微信,并支持多项高级功能。
6
-
7
- ## 核心特性
8
-
9
- - **流式输出 (Streaming)**: 基于企业微信最新的 AI 机器人流式分片机制,实现流畅的打字机式回复体验。
10
- - **动态 Agent 管理**: 默认按"每个私聊用户 / 每个群聊"自动创建独立 Agent。每个 Agent 拥有独立的工作区与对话上下文,实现更强的数据隔离。
11
- - **群聊深度集成**: 支持群聊消息解析,可通过 @提及(At-mention)精准触发机器人响应。
12
- - **丰富消息类型**: 支持文本、图片、语音、图文混排、文件、位置、链接等消息类型。
13
- - **入站图片解密**: 自动解密企业微信 AES-256-CBC 加密的图片,用于 AI 视觉分析。
14
- - **出站图片发送**: 自动将本地图片(截图、生成的图像)进行 base64 编码,通过 `msg_item` API 发送。
15
- - **消息防抖合并**: 同一用户在短时间内(2 秒内)连续发送的多条消息会自动合并为一次 AI 请求。
16
- - **管理员用户**: 可配置管理员列表,绕过指令白名单和动态 Agent 路由限制。
17
- - **指令白名单**: 内置常用指令支持(如 `/new`、`/status`),并提供指令白名单配置功能。
18
- - **安全与认证**: 完整支持企业微信消息加解密、URL 验证及发送者身份校验。
19
- - **高性能异步处理**: 采用异步消息处理架构,确保即使在长耗时 AI 推理过程中,企业微信网关也能保持高响应性。
20
-
21
- ## 前置要求
22
-
23
- - 已安装 [OpenClaw](https://github.com/openclaw/openclaw) (版本 2026.1.30+)
24
- - 企业微信管理后台权限,可创建智能机器人应用
25
- - 可从企业微信访问的服务器地址(HTTP/HTTPS)
26
-
27
- ## 安装
28
-
29
- ```bash
30
- openclaw plugins install @sunnoy/wecom
31
- ```
32
-
33
- 此命令会自动:
34
- - 从 npm 下载插件
35
- - 安装到 `~/.openclaw/extensions/` 目录
36
- - 更新 OpenClaw 配置
37
- - 注册插件
38
-
39
- ## 配置
40
-
41
- 在 OpenClaw 配置文件(`~/.openclaw/openclaw.json`)中添加:
42
-
43
- ```json
44
- {
45
- "plugins": {
46
- "entries": {
47
- "wecom": {
48
- "enabled": true
49
- }
50
- }
51
- },
52
- "channels": {
53
- "wecom": {
54
- "enabled": true,
55
- "token": "你的 Token",
56
- "encodingAesKey": "你的 EncodingAESKey",
57
- "adminUsers": ["管理员userid"],
58
- "commands": {
59
- "enabled": true,
60
- "allowlist": ["/new", "/status", "/help", "/compact"]
61
- }
62
- }
63
- }
64
- }
65
- ```
66
-
67
- ### 配置说明
68
-
69
- | 配置项 | 类型 | 必填 | 说明 |
70
- |--------|------|------|------|
71
- | `plugins.entries.wecom.enabled` | boolean | 是 | 启用插件 |
72
- | `channels.wecom.token` | string | 是 | 企业微信机器人 Token |
73
- | `channels.wecom.encodingAesKey` | string | 是 | 企业微信消息加密密钥(43 位) |
74
- | `channels.wecom.adminUsers` | array | 否 | 管理员用户 ID 列表(绕过指令白名单和动态路由) |
75
- | `channels.wecom.commands.allowlist` | array | 否 | 允许的指令白名单 |
76
-
77
- ## 企业微信后台配置
78
-
79
- 1. 登录[企业微信管理后台](https://work.weixin.qq.com/)
80
- 2. 进入"应用管理" > "应用" > "创建应用" > 选择"智能机器人"
81
- 3. 在"接收消息配置"中设置:
82
- - **URL**: `https://your-domain.com/webhooks/wecom`
83
- - **Token**: 与 `channels.wecom.token` 一致
84
- - **EncodingAESKey**: 与 `channels.wecom.encodingAesKey` 一致
85
- 4. 保存配置并启用消息接收
86
-
87
- ## 支持的消息类型
88
-
89
- | 类型 | 方向 | 说明 |
90
- |------|------|------|
91
- | 文本 (text) | 收/发 | 纯文本消息 |
92
- | 图片 (image) | 收/发 | 入站图片自动解密;出站通过 `msg_item` base64 发送 |
93
- | 语音 (voice) | 收 | 企业微信自动转文字后处理(仅限私聊) |
94
- | 图文混排 (mixed) | 收 | 文本 + 图片混合消息 |
95
- | 文件 (file) | 收 | 文件附件(下载后传给 AI 分析) |
96
- | 位置 (location) | 收 | 位置分享(转换为文本描述) |
97
- | 链接 (link) | 收 | 分享链接(提取标题、描述、URL 为文本) |
98
-
99
- ## 管理员用户
100
-
101
- 管理员用户可以绕过指令白名单限制,并跳过动态 Agent 路由(直接路由到主 Agent)。
102
-
103
- ```json
104
- {
105
- "channels": {
106
- "wecom": {
107
- "adminUsers": ["user1", "user2"]
108
- }
109
- }
110
- }
111
- ```
112
-
113
- 管理员用户 ID 不区分大小写,匹配企业微信的 `userid` 字段。
114
-
115
- ## 动态 Agent 路由
116
-
117
- 本插件实现"按人/按群隔离"的 Agent 管理:
118
-
119
- ### 工作原理
120
-
121
- 1. 企业微信消息到达后,插件生成确定性的 `agentId`:
122
- - **私聊**: `wecom-dm-<userId>`
123
- - **群聊**: `wecom-group-<chatId>`
124
- 2. OpenClaw 自动创建/复用对应的 Agent 工作区
125
- 3. 每个用户/群聊拥有独立的对话历史和上下文
126
- 4. **管理员用户**跳过动态路由,直接使用主 Agent
127
-
128
- ### 高级配置
129
-
130
- 配置在 `channels.wecom` 下:
131
-
132
- ```json
133
- {
134
- "channels": {
135
- "wecom": {
136
- "dynamicAgents": {
137
- "enabled": true
138
- },
139
- "dm": {
140
- "createAgentOnFirstMessage": true
141
- },
142
- "groupChat": {
143
- "enabled": true,
144
- "requireMention": true
145
- }
146
- }
147
- }
148
- }
149
- ```
150
-
151
- | 配置项 | 类型 | 默认值 | 说明 |
152
- |--------|------|--------|------|
153
- | `dynamicAgents.enabled` | boolean | `true` | 是否启用动态 Agent |
154
- | `dm.createAgentOnFirstMessage` | boolean | `true` | 私聊使用动态 Agent |
155
- | `groupChat.enabled` | boolean | `true` | 启用群聊处理 |
156
- | `groupChat.requireMention` | boolean | `true` | 群聊必须 @ 提及才响应 |
157
-
158
- ### 禁用动态 Agent
159
-
160
- 如果需要所有消息进入默认 Agent:
161
-
162
- ```json
163
- {
164
- "channels": {
165
- "wecom": {
166
- "dynamicAgents": { "enabled": false }
167
- }
168
- }
169
- }
170
- ```
171
-
172
- ## 指令白名单
173
-
174
- 为防止普通用户通过企业微信消息执行敏感的 Gateway 管理指令,本插件支持**指令白名单**机制。
175
-
176
- ```json
177
- {
178
- "channels": {
179
- "wecom": {
180
- "commands": {
181
- "enabled": true,
182
- "allowlist": ["/new", "/status", "/help", "/compact"]
183
- }
184
- }
185
- }
186
- }
187
- ```
188
-
189
- ### 推荐白名单指令
190
-
191
- | 指令 | 说明 | 安全级别 |
192
- |------|------|----------|
193
- | `/new` | 重置当前对话,开启全新会话 | 用户级 |
194
- | `/compact` | 压缩当前会话上下文 | 用户级 |
195
- | `/help` | 查看帮助信息 | 用户级 |
196
- | `/status` | 查看当前 Agent 状态 | 用户级 |
197
-
198
- > **安全提示**:不要将 `/gateway`、`/plugins` 等管理指令添加到白名单,避免普通用户获得 Gateway 实例的管理权限。配置在 `adminUsers` 中的管理员不受此限制。
199
-
200
- ## 消息防抖合并
201
-
202
- 当用户在短时间内(2 秒内)连续发送多条消息时,插件会自动将它们合并为一次 AI 请求。这样可以避免同一用户触发多个并发的 LLM 调用,提供更连贯的回复。
203
-
204
- - 第一条消息的流式通道接收 AI 回复
205
- - 后续被合并的消息会显示已合并的提示
206
- - 指令消息(以 `/` 开头)不参与防抖,会立即处理
207
-
208
- ## 常见问题 (FAQ)
209
-
210
- ### Q: 入站图片是怎么处理的?
211
-
212
- **A:** 企业微信使用 AES-256-CBC 加密用户发送的图片。插件会自动:
213
- 1. 从企业微信的 URL 下载加密图片
214
- 2. 使用配置的 `encodingAesKey` 解密
215
- 3. 保存到本地并传给 AI 进行视觉分析
216
-
217
- 图文混排消息也完全支持——文本和图片会一起提取并发送给 AI。
218
-
219
- ### Q: 出站图片发送是如何工作的?
220
-
221
- **A:** 插件会自动处理 OpenClaw 生成的图片(如浏览器截图):
222
-
223
- - **本地图片**(来自 `~/.openclaw/media/`)会自动进行 base64 编码,通过企业微信 `msg_item` API 发送
224
- - **图片限制**:单张图片最大 2MB,支持 JPG 和 PNG 格式,每条消息最多 10 张图片
225
- - **无需配置**:开箱即用,配合浏览器截图等工具自动生效
226
- - 图片会在 AI 完成回复后显示(流式输出不支持增量发送图片)
227
-
228
- 如果图片处理失败(超出大小限制、格式不支持等),文本回复仍会正常发送,错误信息会记录在日志中。
229
-
230
- ### Q: 机器人支持语音消息吗?
231
-
232
- **A:** 支持!私聊中的语音消息会被企业微信自动转录为文字并作为文本处理,无需额外配置。
233
-
234
- ### Q: 机器人支持文件消息吗?
235
-
236
- **A:** 支持。用户发送的文件会被下载并作为附件传给 AI。AI 可以分析文件内容(如读取 PDF 或解析代码文件)。MIME 类型根据文件扩展名自动检测。
237
-
238
- ### Q: OpenClaw 开放公网需要 auth token,企业微信回调如何配置?
239
-
240
- **A:** 企业微信机器人**不需要**配置 OpenClaw 的 Gateway Auth Token。
241
-
242
- - **Gateway Auth Token** (`gateway.auth.token`) 主要用于:
243
- - WebUI 访问认证
244
- - WebSocket 连接认证
245
- - CLI 远程连接认证
246
-
247
- - **企业微信 Webhook** (`/webhooks/wecom`) 的认证机制:
248
- - 使用企业微信自己的签名验证(Token + EncodingAESKey)
249
- - 不需要 Gateway Auth Token
250
- - OpenClaw 插件系统会自动处理 webhook 路由
251
-
252
- **部署建议:**
253
- 1. 如果使用反向代理(如 Nginx),可以为 `/webhooks/wecom` 路径配置豁免认证
254
- 2. 或者将 webhook 端点暴露在独立端口,不经过 Gateway Auth
255
-
256
- ### Q: EncodingAESKey 长度验证失败怎么办?
257
-
258
- **A:** 常见原因和解决方法:
259
-
260
- 1. **检查配置键名**:确保使用正确的键名 `encodingAesKey`(注意大小写)
261
- ```json
262
- {
263
- "channels": {
264
- "wecom": {
265
- "encodingAesKey": "..."
266
- }
267
- }
268
- }
269
- ```
270
-
271
- 2. **检查密钥长度**:EncodingAESKey 必须是 43 位字符
272
- ```bash
273
- # 检查长度
274
- echo -n "你的密钥" | wc -c
275
- ```
276
-
277
- 3. **检查是否有多余空格/换行**:确保密钥字符串前后没有空格或换行符
278
-
279
- ## 项目结构
280
-
281
- ```
282
- openclaw-plugin-wecom/
283
- ├── index.js # 插件入口
284
- ├── webhook.js # 企业微信 HTTP 通信处理
285
- ├── dynamic-agent.js # 动态 Agent 分配逻辑
286
- ├── stream-manager.js # 流式回复管理
287
- ├── image-processor.js # 图片编码/校验(msg_item)
288
- ├── crypto.js # 企业微信加密算法(消息 + 媒体)
289
- ├── logger.js # 日志模块
290
- ├── utils.js # 工具函数(TTL 缓存、消息去重)
291
- ├── package.json # npm 包配置
292
- └── openclaw.plugin.json # OpenClaw 插件清单
293
- ```
294
-
295
- ## 贡献规范
296
-
297
- 我们非常欢迎开发者参与贡献!如果你发现了 Bug 或有更好的功能建议,请提交 Issue 或 Pull Request。
298
-
299
- 详见 [CONTRIBUTING.md](./CONTRIBUTING.md)
300
-
301
- ## 开源协议
302
-
303
- 本项目采用 [ISC License](./LICENSE) 协议。