@vrs-soft/wecom-aibot-mcp 2.4.9 → 2.4.11

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/README.md CHANGED
@@ -12,6 +12,44 @@
12
12
 
13
13
  ---
14
14
 
15
+ ## 效果预览
16
+
17
+ <img src="docs/approval-card.png" width="320" alt="微信审批卡片" />
18
+
19
+ 每次 Claude 执行敏感操作(Bash 命令、编辑文件等)时,企业微信会推送审批卡片,点击**允许**或**拒绝**即可实时控制执行权限。超时未响应时,根据配置自动代批(允许项目内操作,拒绝删除命令)。
20
+
21
+ ---
22
+
23
+ ## 使用场景
24
+
25
+ ### 场景一:离开电脑,微信远程监督
26
+
27
+ 出门开会或离开座位时,告诉 Claude「现在开始通过微信联系」,进入微信模式后:
28
+
29
+ - Claude 执行每一步操作前发送审批请求到微信
30
+ - 你在手机上点击**允许 / 拒绝**,Claude 实时响应
31
+ - 设置超时自动审批(`autoApproveTimeout`),无人值守时自动处理项目内操作
32
+
33
+ ### 场景二:微信直接下达任务
34
+
35
+ 不在电脑前,直接在企业微信给机器人发消息:
36
+
37
+ - 「帮我跑一下单元测试,把结果发给我」
38
+ - 「把 src/index.ts 里的 TODO 都处理掉」
39
+ - 「最近有什么错误日志?」
40
+
41
+ Claude 执行完成后自动回复进度和结果到微信。
42
+
43
+ ### 场景三:团队共享机器人,群聊协作
44
+
45
+ 在企业微信群中 @机器人,多个成员可以同时:
46
+
47
+ - 查询项目状态
48
+ - 触发 CI 任务
49
+ - 审批自己负责的操作(审批请求精确路由到对应 Claude 窗口)
50
+
51
+ ---
52
+
15
53
  ## 前置条件
16
54
 
17
55
  企业微信管理后台创建智能机器人,连接方式选「使用长连接」,记录 **Bot ID** 和 **Secret** 以及 **DocURL**(文档url)。
@@ -605,7 +605,7 @@ export async function startChannelServer() {
605
605
  tools: {},
606
606
  },
607
607
  // 告知 Claude 如何处理 channel 事件
608
- instructions: '企业微信消息通过 <channel> 标签推送。属性说明:from=发送者userid, chatid=会话ID(单聊=用户ID,群聊=群ID), chattype=single|group, cc_id=当前会话标识。收到消息后:1) 发送确认 send_message(cc_id, "收到...", target_user=chatid);2) 处理任务;3) 发送结果 send_message(cc_id, "【完成】...", target_user=chatid)。',
608
+ instructions: '企业微信消息通过 <channel> 标签推送。属性说明:from=发送者userid, chatid=会话ID(单聊=用户ID,群聊=群ID), chattype=single|group, cc_id=当前会话标识。【强制规则】收到任何用户消息后,必须先执行步骤1再执行步骤2,禁止跳过:1) 立即发送确认 send_message(cc_id, "收到,正在处理...", target_user=chatid);2) 处理任务;3) 发送结果 send_message(cc_id, "【完成】...", target_user=chatid)。',
609
609
  });
610
610
  // 注册工具
611
611
  registerChannelTools(mcpServer);
@@ -564,7 +564,7 @@ fi
564
564
  log_debug "[$(date)] Waiting for approval, taskId: $TASK_ID"
565
565
 
566
566
  # 轮询审批结果(带超时:从配置读取)
567
- AUTO_APPROVE_TIMEOUT=$(jq -r '.autoApproveTimeout // 600' "$CONFIG_FILE" 2>/dev/null)
567
+ AUTO_APPROVE_TIMEOUT=$(jq -r '.autoApproveTimeout // 300' "$CONFIG_FILE" 2>/dev/null)
568
568
  # 超时时间(秒),转换为轮询次数(每次 sleep 2秒)
569
569
  # 使用向上取整补偿整数截断:MAX_POLL = ceil(timeout/2) = (timeout+1)/2
570
570
  MAX_POLL=$(( (AUTO_APPROVE_TIMEOUT + 1) / 2 ))
@@ -260,7 +260,7 @@ export const STOP_HOOK_SCRIPT_PATH = path.join(CONFIG_DIR, 'stop-hook.sh');
260
260
  */
261
261
  const PERMISSION_HOOK = {
262
262
  matcher: '',
263
- hooks: [{ type: 'command', command: PERMISSION_HOOK_SCRIPT_PATH }],
263
+ hooks: [{ type: 'command', command: PERMISSION_HOOK_SCRIPT_PATH, timeout: 3600 }],
264
264
  };
265
265
  /**
266
266
  * Stop hook 配置
@@ -357,7 +357,7 @@ npx @vrs-soft/wecom-aibot-mcp
357
357
  mode: z.enum(['channel', 'http']).optional().default('http')
358
358
  .describe('运行模式:channel=SSE推送(推荐),http=轮询(兼容)'),
359
359
  auto_approve: z.boolean().optional().default(true).describe('超时自动审批(默认 true)'),
360
- auto_approve_timeout: z.number().optional().default(600).describe('自动审批超时时间(秒,默认 60010 分钟)'),
360
+ auto_approve_timeout: z.number().optional().default(300).describe('自动审批超时时间(秒,默认 3005 分钟)'),
361
361
  }, async ({ agent_name, cc_id, robot_id, project_dir, mode, auto_approve, auto_approve_timeout }, extra) => {
362
362
  // 获取项目目录
363
363
  const projectDir = project_dir || process.cwd();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vrs-soft/wecom-aibot-mcp",
3
- "version": "2.4.9",
3
+ "version": "2.4.11",
4
4
  "description": "企业微信智能机器人 MCP 服务 - Claude Code 审批通道",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",