feat: 只读验收模式、文件发送类型与消息定位补全

- 只读验收:TRACEMEMO_READ_ONLY=1 时跳过消息写入、自动发送与退群提示
- 微信发送新增 file 类型,文档、能力探测与 Reader Skill 同步
- 消息前后窗口按分片定位,补齐 wcdb4 定位与分片测试
This commit is contained in:
Wxw-Gu committed 2026-11-21 15:26:03 +08:00
1 parent 0edbf60b2e
commit 518a9662a7
25 files changed
+1278 -154

No files matched your search

+10 -3
View File
@@ -87,7 +87,7 @@ Token 由应用生成并保存在本机,**不接受用环境变量覆盖**:A
| 身份 | 你本人当前登录的微信账号 | 已扫码接入的机器人 |
| 用途 | **以你的身份把消息发给别人**(好友 / 群 / 文件传输助手) | **机器人给自己发通知**(测试连通性) |
| 前置条件 | 本机微信已启动,发送能力为 `ready` | 连接器为 `online` |
| 内容类型 | `text` / `image` / `voice`,媒体只接受本地文件 | `text` / `image`(URL 或本地路径) |
| 内容类型 | `text` / `image` / `voice` / `file`,媒体只接受本地文件 | `text` / `image`(URL 或本地路径) |
| 典型失败 | 能力未就绪 `503`、发送失败 `502` | 连接器离线 `503`、凭证过期 `401` |
### 本地发送:`POST /api/v1/wechat/send`
@@ -100,6 +100,12 @@ curl -X POST http://127.0.0.1:6131/api/v1/wechat/send \
-H "Authorization: Bearer $TRACEMEMO_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"to":"filehelper","type":"text","text":"来自 Agent 的一条消息"}'
# 发送本地文件(macOS / Windows 均走本机发送能力)
curl -X POST http://127.0.0.1:6131/api/v1/wechat/send \
-H "Authorization: Bearer $TRACEMEMO_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"to":"filehelper","type":"file","filePath":"/abs/path/report.pdf","fileName":"周报.pdf"}'
```
请求体:
@@ -107,9 +113,10 @@ curl -X POST http://127.0.0.1:6131/api/v1/wechat/send \
| 字段 | 必填 | 说明 |
| --- | --- | --- |
| `to` | 是 | 接收者:好友 wxid、群 id(以 `@chatroom` 结尾),或 `filehelper`(文件传输助手)。**不做昵称解析**,先调 `/api/v1/resolve?q=张三` 换 wxid |
| `type` | 否 | `text`(默认)/ `image` / `voice` |
| `type` | 否 | `text`(默认)/ `image` / `voice` / `file` |
| `text` | `type=text` 时必填 | **最长 2000 字符**,超限返回 `400`,不会截断 |
| `filePath` | `type=image\|voice` 时必填 | 本机**绝对路径**,必须已存在。不接受 URL —— 需要发网络图片时先落盘 |
| `filePath` | `type=image\|voice\|file` 时必填 | 本机**绝对路径**,必须已存在。不接受 URL —— 需要发网络文件时先落盘 |
| `fileName` | 否 | 仅 `type=file`:接收方看到的文件名。macOS 会透传;Windows 当前由 runtime 使用 `filePath` 的 basename,`fileName` 可能被忽略 |
| `isGroup` | 否 | 通常可省略;`to` 以 `@chatroom` 结尾时自动判为群 |
| `idempotencyKey` | 否 | 幂等键。**重试时请原样带上**,避免 Agent 超时重发导致重复消息 |
+4 -3
View File
@@ -1,6 +1,6 @@
---
name: tracememo-reader
version: 1.4.0
version: 1.4.1
description: 本机微信聊天记录的读取入口(TraceMemo 本地 HTTP API,默认 http://127.0.0.1:6131/api/v1)。凡是「看微信内容」的请求都必须先走本 Skill:某个群或某人今天聊了什么、刚刚聊了啥、最近消息、谁说了什么、总结聊天、翻历史记录、撤回的消息、图片内容、语音转文字、查找联系人或群聊、群成员、生成群聊总结、定时日报、给好友或群发微信消息、查看发送记录、查看未读。本 Skill 已处理鉴权、撤回归档、图片媒体、语音转写与压缩编码解码,当用户要求查看微信消息、查找联系人或群聊、总结聊天、查看或理解图片、生成群聊总结、查询或修改定时日报、给好友或群发送微信消息、代发消息、查看发送记录时使用。此 Skill 由本机 TraceMemo 提供数据,不是 MCP Server。
---
@@ -123,9 +123,10 @@ curl -H "Authorization: Bearer $TRACEMEMO_API_TOKEN" \
| 字段 | 必填 | 说明 |
| ---------------- | ------------------ | ------------------------------------------------------------------- |
| `to` | 是 | wxid / `xxx@chatroom` / `filehelper`;以 `@chatroom` 结尾自动判为群 |
| `type` | 否 | `text`(默认)/ `image` / `voice` |
| `type` | 否 | `text`(默认)/ `image` / `voice` / `file` |
| `text` | `type=text` 时必填 | **最多 2000 字符**,超限返回 `400`,不会自动截断 |
| `filePath` | `type=image/voice` | 本机**绝对路径**且文件必须存在;**不接受 URL** |
| `filePath` | `type=image/voice/file` | 本机**绝对路径**且文件必须存在;**不接受 URL** |
| `fileName` | 否 | 仅 `type=file`:macOS 透传名称;Windows 当前可能忽略,按路径 basename 发送 |
| `idempotencyKey` | 否 | 重试时原样带回,避免超时重发产生重复消息 |
几个必须遵守的限制: