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

+26 -1
View File
@@ -64,7 +64,7 @@ function capabilityOf(
supported: true,
ready: true,
status: 'ready',
capabilities: { text: true, image: true, voice: true },
capabilities: { text: true, image: true, voice: true, file: true },
senderStatus: {} as PersonalWechatSendCapability['senderStatus'],
message: '可以发送',
...overrides
@@ -164,6 +164,31 @@ describe('POST /api/v1/wechat/send', () => {
expect(execute).not.toHaveBeenCalled()
})
it('type=file 时接受 filePath 与可选 fileName,并按 file 动作投递', async () => {
const filePath = path.join(root, '周报.txt')
await fs.writeFile(filePath, 'hello')
const response = await post({
to: 'filehelper',
type: 'file',
filePath,
fileName: '周报.txt'
})
expect(response.status).toBe(200)
expect((await response.json()).success).toBe(true)
const action = lastAction()
expect(action.purpose).toBe('api_file')
expect(action.content).toEqual({ type: 'file', path: filePath, name: '周报.txt' })
})
it('type=file 缺少 filePath 时返回 400,不进入投递', async () => {
const response = await post({ to: 'filehelper', type: 'file' })
expect(response.status).toBe(400)
expect((await response.json()).errorCode).toBe('INVALID_REQUEST')
expect(execute).not.toHaveBeenCalled()
})
it('发送能力未就绪时返回 503', async () => {
capability = capabilityOf({
ready: false,