@vrs-soft/wecom-aibot-mcp 3.2.4 → 3.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.
- package/dist/channel-server.js +2 -1
- package/package.json +1 -1
package/dist/channel-server.js
CHANGED
|
@@ -95,6 +95,7 @@ async function sendWecomMediaFromFile(args) {
|
|
|
95
95
|
'X-Target-User': args.target_user,
|
|
96
96
|
'X-Media-Type': args.media_type,
|
|
97
97
|
'X-Filename': encodeURIComponent(filename),
|
|
98
|
+
'X-Cc-Id': args.cc_id, // v3.2.5: daemon 用 ccId 查 registry 找到正确的 robot(群聊必须用 CC 自己的机器人)
|
|
98
99
|
};
|
|
99
100
|
if (MCP_AUTH_TOKEN)
|
|
100
101
|
headers['Authorization'] = `Bearer ${MCP_AUTH_TOKEN}`;
|
|
@@ -1080,7 +1081,7 @@ export async function startChannelServer() {
|
|
|
1080
1081
|
tools: {},
|
|
1081
1082
|
},
|
|
1082
1083
|
// 告知 Claude 如何处理 channel 事件
|
|
1083
|
-
instructions: '企业微信消息通过 <channel> 标签推送。属性说明:from=发送者userid, chatid=会话ID(单聊=用户ID,群聊=群ID), chattype=single|group, cc_id=当前会话标识。【强制规则1·用户消息】daemon 已经代你给用户发了"💭 收到/听到了,正在处理..."回执,agent 不需要再发送 ack,**直接处理任务**,处理完后用 send_message(cc_id, "【完成】...", target_user=chatid) 报结果即可。【强制规则2·CC 间文档】收到 <channel kind="document"> 通知(cc_document_notify)时,禁止擅自落盘:1) 立即 send_message 告知用户("CC <from_cc> 想发送文件「<title>」(<size>, <mime_type>),是否接收?"),target_user 取当前 cc 的 chatid;2) 等用户明确肯定回复(是/接受/yes/同意等);3) 同意后调 download_document_to_path(cc_id, doc_id, save_path) 落盘(save_path 推荐 {projectDir}/received-file/<title>,目录会自动创建);4) 发送完成消息并附 saved_path;拒绝则忽略 doc_id 不调任何下载工具。共享池 share_file_from_path/download_shared_file_to_path 为 pull 模型,agent
|
|
1084
|
+
instructions: '企业微信消息通过 <channel> 标签推送。属性说明:from=发送者userid, chatid=会话ID(单聊=用户ID,群聊=群ID), chattype=single|group, cc_id=当前会话标识。【强制规则1·用户消息】daemon 已经代你给用户发了"💭 收到/听到了,正在处理..."回执,agent 不需要再发送 ack,**直接处理任务**,处理完后用 send_message(cc_id, "【完成】...", target_user=chatid) 报结果即可。【强制规则2·CC 间文档】收到 <channel kind="document"> 通知(cc_document_notify)时,禁止擅自落盘:1) 立即 send_message 告知用户("CC <from_cc> 想发送文件「<title>」(<size>, <mime_type>),是否接收?"),target_user 取当前 cc 的 chatid;2) 等用户明确肯定回复(是/接受/yes/同意等);3) 同意后调 download_document_to_path(cc_id, doc_id, save_path) 落盘(save_path 推荐 {projectDir}/received-file/<title>,目录会自动创建);4) 发送完成消息并附 saved_path;拒绝则忽略 doc_id 不调任何下载工具。共享池 share_file_from_path/download_shared_file_to_path 为 pull 模型,agent 主动决定,无需询问。【强制规则3·撤回消息】收到内容以 "⚠️ 用户撤回了" 开头的 channel 消息时:说明用户在企微撤回了刚才的指令,可能是发错了。立即**停止当前任务**,不要继续已发起的工具调用,发送 send_message(cc_id, "已收到撤回信号,当前任务已暂停,等待新指令。", target_user=chatid) 然后等待用户。【重要】发送/接收文件请用 *_from_file / *_to_path 系列(文件字节走 channel-server 本地 fs + HTTP,不进 LLM context);旧的 upload_document/fetch_document/accept_document 仍可用但仅适合小内容(< 16KB),远端 daemon 部署下 accept_* 与 file_path 模式不可用。',
|
|
1084
1085
|
});
|
|
1085
1086
|
// 注册工具
|
|
1086
1087
|
registerChannelTools(mcpServer);
|