@rezti/dsh-rez-wechat 0.1.2 → 0.1.4
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/lib/index.d.ts +1 -1
- package/lib/index.js +22 -12
- package/package.json +3 -2
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { startMcpWhenSecret } from '@rezti/dsh-rez-sso';
|
|
1
2
|
import { WeixinChannel } from './channel.js';
|
|
2
3
|
export const name = 'rez-wechat';
|
|
3
|
-
export const inject = ['systemPrompt'];
|
|
4
|
+
export const inject = ['systemPrompt', 'webServer', 'rezSso'];
|
|
4
5
|
const GUIDANCE = [
|
|
5
|
-
'企业微信群发送走官方 dsh-mcp-client + wecom-mcp(mcp__wechat__*),密钥 REZ_WECHAT_WEBHOOK。',
|
|
6
|
+
'企业微信群发送走官方 dsh-mcp-client + wecom-mcp(mcp__wechat__*),密钥 REZ_WECHAT_WEBHOOK。未配置时不拉起 wecom-mcp。',
|
|
6
7
|
'个人微信是 QClaw 同款 ClawBot 通道:在 Rez 面板「微信」页扫码一次,然后直接在微信里说话,dsh 会自动回。不要再跑 npx weixin-mcp login,也不要调用 mcp__weixin__*。',
|
|
7
8
|
'这是 ClawBot 客服会话,不是用个人微信号管好友/群。对外发消息必须先征得用户批准。',
|
|
8
9
|
].join('');
|
|
@@ -94,7 +95,7 @@ function weixinRoutes(channel) {
|
|
|
94
95
|
},
|
|
95
96
|
];
|
|
96
97
|
}
|
|
97
|
-
export function apply(ctx) {
|
|
98
|
+
export async function apply(ctx) {
|
|
98
99
|
const channel = new WeixinChannel();
|
|
99
100
|
channel.startIfLoggedIn();
|
|
100
101
|
ctx.effect(() => ctx.systemPrompt.section({
|
|
@@ -102,14 +103,23 @@ export function apply(ctx) {
|
|
|
102
103
|
order: 162,
|
|
103
104
|
text: GUIDANCE,
|
|
104
105
|
}), 'dsh-rez-wechat: prompt');
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
dispose(); };
|
|
112
|
-
}, 'dsh-rez-wechat: weixin routes');
|
|
113
|
-
}
|
|
106
|
+
const routes = weixinRoutes(channel);
|
|
107
|
+
ctx.effect(() => {
|
|
108
|
+
const disposers = routes.map(route => ctx.webServer.register(route));
|
|
109
|
+
return () => { for (const dispose of disposers)
|
|
110
|
+
dispose(); };
|
|
111
|
+
}, 'dsh-rez-wechat: weixin routes');
|
|
114
112
|
ctx.effect(() => () => { channel.dispose(); }, 'dsh-rez-wechat: weixin channel');
|
|
113
|
+
await startMcpWhenSecret(ctx, {
|
|
114
|
+
system: 'wechat',
|
|
115
|
+
label: '企业微信',
|
|
116
|
+
config: (secret) => ({
|
|
117
|
+
serverName: 'wechat',
|
|
118
|
+
transport: 'stdio',
|
|
119
|
+
command: 'npx',
|
|
120
|
+
args: ['-y', 'wecom-mcp'],
|
|
121
|
+
env: { WECOM_WEBHOOK_URL: secret },
|
|
122
|
+
failOnStartupError: false,
|
|
123
|
+
}),
|
|
124
|
+
});
|
|
115
125
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rezti/dsh-rez-wechat",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "ReZ-TI WeChat/WeCom bridges. Personal WeChat is QClaw/ClawBot scan-and-chat via dsh-wechat-bridge; WeCom group send uses wecom-mcp.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
],
|
|
22
22
|
"license": "Apache-2.0",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"qrcode": "^1.5.4"
|
|
24
|
+
"qrcode": "^1.5.4",
|
|
25
|
+
"@rezti/dsh-rez-sso": "0.1.4"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
28
|
"@deepseek-ai/cordis": "^4.0.1",
|