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

@@ -31,6 +31,7 @@ import path from 'node:path'
import { findResource } from '../resource-paths'
import { isMacNativeRuntimeUnavailable, resolveWcdbConfigHelper } from '../native-runtime-paths'
import { resolveExternalComponent } from './external-component-locator'
import { isReadOnlyMode, logReadOnlySkip } from './read-only-mode'
import type { Wcdb4Client } from '../wcdb4-client'
import {
MSG_INSERT_SWITCHES,
@@ -205,6 +206,16 @@ function runHelper(
request: { key: string; rooms: string[]; myWxid: string },
timeoutMs = HELPER_TIMEOUT_MS
): Promise<HelperRunResult> {
// 只读测试模式:任何 helper 写入(开关 / ensure-rules)都不允许发生。
if (isReadOnlyMode()) {
logReadOnlySkip('MsgInsert helper 写入')
return Promise.resolve({
ok: false,
exitCode: null,
errorCode: 'READ_ONLY_MODE',
message: '只读测试模式:禁止写入微信数据库'
})
}
return new Promise((resolve) => {
let child: ReturnType<typeof spawn>
try {
@@ -730,6 +741,10 @@ export async function applyMsgInsertSwitch(
export async function reconcileMsgInsertRules(
input: MsgInsertScopeInput & { myWxid: string; databaseKey: string; extraRooms?: string[] }
): Promise<{ done: boolean; rooms: number; written: number; errorCode?: MsgInsertErrorCode }> {
if (isReadOnlyMode()) {
logReadOnlySkip('MsgInsert reconciliation')
return { done: false, rooms: 0, written: 0, errorCode: 'READ_ONLY_MODE' }
}
if (isMacNativeRuntimeUnavailable()) {
return { done: false, rooms: 0, written: 0, errorCode: 'HELPER_NOT_FOUND' }
}