@vrs-soft/wecom-aibot-mcp 2.4.6 → 2.4.7
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/channel-server.js +5 -0
- package/dist/config-wizard.js +10 -11
- package/package.json +1 -1
package/dist/channel-server.js
CHANGED
|
@@ -16,6 +16,7 @@ import * as fs from 'fs';
|
|
|
16
16
|
import * as path from 'path';
|
|
17
17
|
import * as os from 'os';
|
|
18
18
|
import { VERSION } from './config-wizard.js';
|
|
19
|
+
import { addPermissionHook } from './project-config.js';
|
|
19
20
|
const MCP_URL = process.env.MCP_URL || 'http://127.0.0.1:18963';
|
|
20
21
|
const MCP_AUTH_TOKEN = process.env.MCP_AUTH_TOKEN;
|
|
21
22
|
// 构建带 auth 的 fetch headers
|
|
@@ -419,6 +420,10 @@ function registerChannelTools(server) {
|
|
|
419
420
|
if (parsed.ccId) {
|
|
420
421
|
logChannel('Got ccId, connecting SSE', { ccId: parsed.ccId, mode });
|
|
421
422
|
connectSSE(parsed.ccId);
|
|
423
|
+
// Channel 模式:在本地项目写入 PermissionRequest hook
|
|
424
|
+
const localProjectDir = project_dir || process.cwd();
|
|
425
|
+
const hookResult = addPermissionHook(localProjectDir);
|
|
426
|
+
logChannel('本地 PermissionRequest hook 已写入', { path: hookResult.path, success: hookResult.success });
|
|
422
427
|
// Channel 模式:过滤 heartbeat 信息,简化消息
|
|
423
428
|
if (mode === 'channel' || parsed.mode === 'channel') {
|
|
424
429
|
delete parsed.heartbeat; // Channel 模式不需要 heartbeat loop
|
package/dist/config-wizard.js
CHANGED
|
@@ -1020,19 +1020,18 @@ function writeMcpPermissions() {
|
|
|
1020
1020
|
if (!existingPerms.has(perm))
|
|
1021
1021
|
settings.permissions.allow.push(perm);
|
|
1022
1022
|
}
|
|
1023
|
-
//
|
|
1024
|
-
if (settings.hooks
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
}
|
|
1023
|
+
// 注册全局 PermissionRequest hook(支持 channel 模式,hook 内部有 wechatMode 检查)
|
|
1024
|
+
if (!settings.hooks)
|
|
1025
|
+
settings.hooks = {};
|
|
1026
|
+
if (!settings.hooks['PermissionRequest'])
|
|
1027
|
+
settings.hooks['PermissionRequest'] = [];
|
|
1028
|
+
const hookCommand = HOOK_SCRIPT_PATH;
|
|
1029
|
+
const alreadyRegistered = settings.hooks['PermissionRequest'].some((entry) => entry.hooks?.some?.((h) => h.command === hookCommand));
|
|
1030
|
+
if (!alreadyRegistered) {
|
|
1031
|
+
settings.hooks['PermissionRequest'].push({ hooks: [{ type: 'command', command: hookCommand }] });
|
|
1033
1032
|
}
|
|
1034
1033
|
fs.writeFileSync(CLAUDE_SETTINGS_FILE, JSON.stringify(settings, null, 2));
|
|
1035
|
-
// 确保 hook
|
|
1034
|
+
// 确保 hook 脚本文件存在
|
|
1036
1035
|
writeHookScript();
|
|
1037
1036
|
}
|
|
1038
1037
|
catch (err) {
|