@xuanyue202/wecom 2026.3.21
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/dist/index.d.ts +632 -0
- package/dist/index.js +10993 -0
- package/dist/index.js.map +1 -0
- package/openclaw.plugin.json +72 -0
- package/package.json +123 -0
- package/skills/wecom-doc/SKILL.md +120 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "wecom",
|
|
3
|
+
"name": "WeCom",
|
|
4
|
+
"description": "企业微信消息渠道插件",
|
|
5
|
+
"version": "0.1.3",
|
|
6
|
+
"channels": ["wecom"],
|
|
7
|
+
"skills": ["./skills"],
|
|
8
|
+
"configSchema": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"additionalProperties": false,
|
|
11
|
+
"properties": {
|
|
12
|
+
"enabled": { "type": "boolean" },
|
|
13
|
+
"name": { "type": "string" },
|
|
14
|
+
"mode": { "type": "string", "enum": ["webhook", "ws"], "default": "ws" },
|
|
15
|
+
"webhookPath": { "type": "string" },
|
|
16
|
+
"token": { "type": "string" },
|
|
17
|
+
"encodingAESKey": { "type": "string" },
|
|
18
|
+
"receiveId": { "type": "string" },
|
|
19
|
+
"botId": { "type": "string" },
|
|
20
|
+
"secret": { "type": "string" },
|
|
21
|
+
"wsUrl": { "type": "string" },
|
|
22
|
+
"heartbeatIntervalMs": { "type": "integer", "minimum": 1 },
|
|
23
|
+
"reconnectInitialDelayMs": { "type": "integer", "minimum": 1 },
|
|
24
|
+
"reconnectMaxDelayMs": { "type": "integer", "minimum": 1 },
|
|
25
|
+
"publicBaseUrl": { "type": "string" },
|
|
26
|
+
"wsImageReplyMode": { "type": "string", "enum": ["native", "markdown-url"] },
|
|
27
|
+
"welcomeText": { "type": "string" },
|
|
28
|
+
"dmPolicy": { "type": "string", "enum": ["open", "pairing", "allowlist", "disabled"] },
|
|
29
|
+
"allowFrom": { "type": "array", "items": { "type": "string" } },
|
|
30
|
+
"groupPolicy": { "type": "string", "enum": ["open", "allowlist", "disabled"] },
|
|
31
|
+
"groupAllowFrom": { "type": "array", "items": { "type": "string" } },
|
|
32
|
+
"requireMention": { "type": "boolean" },
|
|
33
|
+
"defaultAccount": { "type": "string" },
|
|
34
|
+
"accounts": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"additionalProperties": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"additionalProperties": false,
|
|
39
|
+
"properties": {
|
|
40
|
+
"name": { "type": "string" },
|
|
41
|
+
"enabled": { "type": "boolean" },
|
|
42
|
+
"mode": { "type": "string", "enum": ["webhook", "ws"], "default": "ws" },
|
|
43
|
+
"webhookPath": { "type": "string" },
|
|
44
|
+
"token": { "type": "string" },
|
|
45
|
+
"encodingAESKey": { "type": "string" },
|
|
46
|
+
"receiveId": { "type": "string" },
|
|
47
|
+
"botId": { "type": "string" },
|
|
48
|
+
"secret": { "type": "string" },
|
|
49
|
+
"wsUrl": { "type": "string" },
|
|
50
|
+
"heartbeatIntervalMs": { "type": "integer", "minimum": 1 },
|
|
51
|
+
"reconnectInitialDelayMs": { "type": "integer", "minimum": 1 },
|
|
52
|
+
"reconnectMaxDelayMs": { "type": "integer", "minimum": 1 },
|
|
53
|
+
"publicBaseUrl": { "type": "string" },
|
|
54
|
+
"wsImageReplyMode": { "type": "string", "enum": ["native", "markdown-url"] },
|
|
55
|
+
"welcomeText": { "type": "string" },
|
|
56
|
+
"dmPolicy": { "type": "string", "enum": ["open", "pairing", "allowlist", "disabled"] },
|
|
57
|
+
"allowFrom": { "type": "array", "items": { "type": "string" } },
|
|
58
|
+
"groupPolicy": { "type": "string", "enum": ["open", "allowlist", "disabled"] },
|
|
59
|
+
"groupAllowFrom": { "type": "array", "items": { "type": "string" } },
|
|
60
|
+
"requireMention": { "type": "boolean" }
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"uiHints": {
|
|
67
|
+
"token": { "label": "Token", "sensitive": true },
|
|
68
|
+
"encodingAESKey": { "label": "EncodingAESKey", "sensitive": true },
|
|
69
|
+
"secret": { "label": "Secret", "sensitive": true },
|
|
70
|
+
"webhookPath": { "label": "Webhook Path" }
|
|
71
|
+
}
|
|
72
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xuanyue202/wecom",
|
|
3
|
+
"version": "2026.3.21",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Moltbot WeCom smart bot channel plugin",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"skills",
|
|
10
|
+
"moltbot.plugin.json",
|
|
11
|
+
"clawdbot.plugin.json",
|
|
12
|
+
"openclaw.plugin.json"
|
|
13
|
+
],
|
|
14
|
+
"openclaw": {
|
|
15
|
+
"extensions": [
|
|
16
|
+
"./dist/index.js"
|
|
17
|
+
],
|
|
18
|
+
"channel": {
|
|
19
|
+
"id": "wecom",
|
|
20
|
+
"label": "WeCom",
|
|
21
|
+
"selectionLabel": "WeCom (企业微信)",
|
|
22
|
+
"docsPath": "/channels/wecom",
|
|
23
|
+
"blurb": "企业微信智能机器人(Webhook / 长连接)",
|
|
24
|
+
"aliases": [
|
|
25
|
+
"wechatwork",
|
|
26
|
+
"wework",
|
|
27
|
+
"qywx"
|
|
28
|
+
],
|
|
29
|
+
"order": 85
|
|
30
|
+
},
|
|
31
|
+
"install": {
|
|
32
|
+
"npmSpec": "@xuanyue202/wecom",
|
|
33
|
+
"localPath": ".",
|
|
34
|
+
"defaultChoice": "npm"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"moltbot": {
|
|
38
|
+
"extensions": [
|
|
39
|
+
"./dist/index.js"
|
|
40
|
+
],
|
|
41
|
+
"channel": {
|
|
42
|
+
"id": "wecom",
|
|
43
|
+
"label": "WeCom",
|
|
44
|
+
"selectionLabel": "WeCom (企业微信)",
|
|
45
|
+
"docsPath": "/channels/wecom",
|
|
46
|
+
"blurb": "企业微信智能机器人(Webhook / 长连接)",
|
|
47
|
+
"aliases": [
|
|
48
|
+
"wechatwork",
|
|
49
|
+
"wework",
|
|
50
|
+
"qywx"
|
|
51
|
+
],
|
|
52
|
+
"order": 85
|
|
53
|
+
},
|
|
54
|
+
"install": {
|
|
55
|
+
"npmSpec": "@xuanyue202/wecom",
|
|
56
|
+
"localPath": ".",
|
|
57
|
+
"defaultChoice": "npm"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"clawdbot": {
|
|
61
|
+
"extensions": [
|
|
62
|
+
"./dist/index.js"
|
|
63
|
+
],
|
|
64
|
+
"channel": {
|
|
65
|
+
"id": "wecom",
|
|
66
|
+
"label": "WeCom",
|
|
67
|
+
"selectionLabel": "WeCom (企业微信)",
|
|
68
|
+
"docsPath": "/channels/wecom",
|
|
69
|
+
"blurb": "企业微信智能机器人(Webhook / 长连接)",
|
|
70
|
+
"aliases": [
|
|
71
|
+
"wechatwork",
|
|
72
|
+
"wework",
|
|
73
|
+
"qywx"
|
|
74
|
+
],
|
|
75
|
+
"order": 85
|
|
76
|
+
},
|
|
77
|
+
"install": {
|
|
78
|
+
"npmSpec": "@xuanyue202/wecom",
|
|
79
|
+
"localPath": ".",
|
|
80
|
+
"defaultChoice": "npm"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"main": "./dist/index.js",
|
|
84
|
+
"types": "./dist/index.d.ts",
|
|
85
|
+
"exports": {
|
|
86
|
+
".": {
|
|
87
|
+
"types": "./dist/index.d.ts",
|
|
88
|
+
"default": "./dist/index.js"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"scripts": {
|
|
92
|
+
"build": "tsup",
|
|
93
|
+
"dev": "tsup --watch",
|
|
94
|
+
"test": "vitest --run",
|
|
95
|
+
"test:watch": "vitest",
|
|
96
|
+
"release": "npm run build && npm publish",
|
|
97
|
+
"release:patch": "npm run build && npm version patch && npm publish",
|
|
98
|
+
"release:minor": "npm run build && npm version minor && npm publish",
|
|
99
|
+
"release:major": "npm run build && npm version major && npm publish"
|
|
100
|
+
},
|
|
101
|
+
"dependencies": {
|
|
102
|
+
"@xuanyue202/shared": "2026.3.21",
|
|
103
|
+
"@wecom/aibot-node-sdk": "^1.0.2",
|
|
104
|
+
"ws": "^8.18.0"
|
|
105
|
+
},
|
|
106
|
+
"devDependencies": {
|
|
107
|
+
"@types/node": "^22.0.0",
|
|
108
|
+
"@types/ws": "^8.5.14",
|
|
109
|
+
"tsup": "^8.2.0",
|
|
110
|
+
"typescript": "^5.7.0",
|
|
111
|
+
"vitest": "^2.1.0",
|
|
112
|
+
"zod": "^3.23.0"
|
|
113
|
+
},
|
|
114
|
+
"peerDependencies": {
|
|
115
|
+
"moltbot": ">=0.1.0"
|
|
116
|
+
},
|
|
117
|
+
"peerDependenciesMeta": {
|
|
118
|
+
"moltbot": {
|
|
119
|
+
"optional": true
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"private": false
|
|
123
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: wecom-doc
|
|
3
|
+
description: 当用户提到企业微信文档、智能表格、创建文档、编辑文档、写文档时启用。优先复用 wecom channel 自动写入的文档 MCP 配置,并通过 mcporter 调用文档能力。
|
|
4
|
+
metadata:
|
|
5
|
+
{
|
|
6
|
+
"openclaw":
|
|
7
|
+
{
|
|
8
|
+
"emoji": "📄",
|
|
9
|
+
"always": true,
|
|
10
|
+
"requires":
|
|
11
|
+
{
|
|
12
|
+
"bins": ["mcporter"],
|
|
13
|
+
},
|
|
14
|
+
"install":
|
|
15
|
+
[
|
|
16
|
+
{
|
|
17
|
+
"id": "mcporter",
|
|
18
|
+
"kind": "node",
|
|
19
|
+
"package": "mcporter",
|
|
20
|
+
"bins": ["mcporter"],
|
|
21
|
+
"label": "Install mcporter (npm)",
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
# 企业微信文档 MCP
|
|
29
|
+
|
|
30
|
+
这个 skill 只负责通过 `mcporter` 调用企业微信文档 MCP,不要直接调用企业微信 Wedoc API。
|
|
31
|
+
|
|
32
|
+
## 使用时机
|
|
33
|
+
|
|
34
|
+
- 用户要创建企业微信文档
|
|
35
|
+
- 用户要创建企业微信智能表格
|
|
36
|
+
- 用户要编辑机器人创建的企微文档或智能表格
|
|
37
|
+
|
|
38
|
+
## 前置检查
|
|
39
|
+
|
|
40
|
+
### 1. 检查 mcporter
|
|
41
|
+
|
|
42
|
+
先确认 `mcporter` 可执行。若未安装,提示用户安装;用户同意后执行:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install -g mcporter
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
安装完成后继续后续步骤,不要停在中间。
|
|
49
|
+
|
|
50
|
+
### 2. 确认 wecom-doc MCP 已配置
|
|
51
|
+
|
|
52
|
+
先执行:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
mcporter list wecom-doc --output json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
如果已经能正常返回 tool 列表,直接进入调用阶段。
|
|
59
|
+
|
|
60
|
+
如果返回 `server not found`、`unknown server` 或类似错误,读取:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
~/.openclaw/wecomConfig/config.json
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
检查是否存在 `mcpConfig.doc.type` 和 `mcpConfig.doc.url`。若存在,执行:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
mcporter config add wecom-doc --type "<type>" --url "<url>"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
添加完成后再次执行 `mcporter list wecom-doc --output json` 进行验证。
|
|
73
|
+
|
|
74
|
+
### 3. 自动配置失败时的引导
|
|
75
|
+
|
|
76
|
+
如果本地没有 `mcpConfig.doc`,说明当前 wecom 长连接还没成功拉到文档 MCP 配置。此时:
|
|
77
|
+
|
|
78
|
+
- 如果能读取到 `channels.wecom.botId`,提示用户去企业微信授权当前机器人文档权限
|
|
79
|
+
- 或让用户直接发送 `StreamableHttp URL` / `JSON Config`
|
|
80
|
+
|
|
81
|
+
当用户提供 URL 或 JSON Config 后,提取 `url` 并执行:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
mcporter config add wecom-doc --type streamable-http --url "<url>"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
配置完成后重新执行 `mcporter list wecom-doc --output json`,然后继续用户原始请求。
|
|
88
|
+
|
|
89
|
+
## 调用规则
|
|
90
|
+
|
|
91
|
+
- 所有请求必须通过 `mcporter call wecom-doc.<tool> --args '{...}' --output json` 执行
|
|
92
|
+
- 先用 `mcporter list wecom-doc --output json` 读取实际 tool 列表,不要硬编码 tool 名称和参数结构
|
|
93
|
+
- `create_doc` 返回的 `docid` 要保存在当前会话里,后续编辑操作依赖它
|
|
94
|
+
- 如果用户要编辑已有文档,但当前会话里没有机器人创建时返回的 `docid`,直接输出:
|
|
95
|
+
|
|
96
|
+
> 仅支持对机器人创建的文档进行编辑
|
|
97
|
+
|
|
98
|
+
## 文档工作流
|
|
99
|
+
|
|
100
|
+
### 新建普通文档
|
|
101
|
+
|
|
102
|
+
1. 调用 `create_doc`,传 `doc_type: 3`
|
|
103
|
+
2. 保存返回的 `docid`
|
|
104
|
+
3. 如需写内容,调用 `edit_doc_content`
|
|
105
|
+
|
|
106
|
+
### 新建智能表格
|
|
107
|
+
|
|
108
|
+
1. 调用 `create_doc`,传 `doc_type: 10`
|
|
109
|
+
2. 保存返回的 `docid`
|
|
110
|
+
3. 根据需要继续调用智能表格相关 tool
|
|
111
|
+
|
|
112
|
+
## 错误处理
|
|
113
|
+
|
|
114
|
+
- 如果 `mcporter call` 返回 `help_message`,优先把其中面向用户的说明直接输出给用户
|
|
115
|
+
- 如果返回 `850001`,说明还需要用户提供配置或授权,按上面的配置引导继续处理
|
|
116
|
+
- 如果返回 `daemon not running` 或 `connection refused`,提示用户先执行:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
mcporter daemon start
|
|
120
|
+
```
|