jackwener
|
76024901e9
|
feat(meta): expose freshness coverage in query output
|
2026-05-15 22:08:46 +08:00 |
jackwener
|
e9f65ba71b
|
review: preserve wal incremental reuse across restart
|
2026-05-14 19:35:36 +08:00 |
jackwener
|
b032b8be04
|
fix(cache): apply WAL incrementally instead of full re-decrypting on WAL mtime change
DbCache 之前只要 .db 或 .db-wal 任一 mtime 变就 full_decrypt。WeChat 在写消息
时会持续 append WAL(无 checkpoint 时),导致每次 attachments/extract 请求都
重新解密 1.8GB 的 message_0.db(实测 ~120s/次)。
改成三种 hit 路径:
1. db_mt + wal_mt 都不变 → 直接返回 cached path
2. db_mt 不变、wal_mt 变了 → 在 cached 产物上**再 apply 一次 WAL**
(apply_wal 是幂等的:旧帧 redo 同样的 page 写入,新帧追加生效)
3. db_mt 变了 → 全量解密 + apply WAL(旧路径)
效果:典型 WAL(< 10MB)从 ~120s 压到 < 1s;100MB 大 WAL 也只在 ~7s。
SQLite 不会自发"主库不变 + WAL 清空",所以 path 2 的边角不需要特殊处理。
测试覆盖三条路径:
- exact_mtime_hit_skips_decrypt
- wal_only_change_uses_incremental_path
- db_mtime_change_triggers_full_decrypt
区分手段:cached file 大小是否被 full_decrypt 重写到 PAGE_SZ 倍数。
|
2026-05-14 19:24:02 +08:00 |
jackwener
|
2d88c9542d
|
feat(attachment): wire wx attachments / wx extract end-to-end
把 V1 (legacy XOR + V1 fixed-AES) + 平台相关 V2 (macOS / Windows) image 解
密能力一路接到 CLI:
- ipc: 新增 Attachments / Extract 两个 Request variant
- daemon/server: dispatch 路由到 query::q_attachments / q_extract
- daemon/cache: DbCache::db_dir() 公开,让 resolver 推 wxchat_base
- daemon/query: q_attachments 走 Msg_<chat> 表按 (local_type & 0xFFFFFFFF)
IN (...) 过滤、按 ts DESC 全局排序后分页,返回不透明 attachment_id;
q_extract 解码 attachment_id → 查 message_resource.db → 找本地 .dat →
按 magic 分发 v1/v2 解码 → 写盘。bridge 用 ImageKeyMaterial.{aes_key,
xor_key}(codex 实测真实账号 xor_key=0xa2,不能硬编码 0x88)
- cli: 新增 wx attachments / wx extract 两个子命令,flag 风格与现有
history / biz-articles 对齐
- README + SKILL: 加附件提取章节,含三档解码档位与 V2 image key 派生说明
|
2026-05-14 18:40:57 +08:00 |
jackwener
|
6cdc806642
|
chore: Apache-2.0 license, Windows support, install.ps1
|
2026-04-16 22:30:45 +08:00 |
jackwener
|
7f869e7c3b
|
fix: 深度 review 修复 10 个 bug/问题
Critical & High:
- daemon 日志:启动时将 stdout/stderr 重定向到 ~/.wx-cli/daemon.log
而非 /dev/null,使 wx daemon logs 真正可用
- q_history 找不到聊天时改为 bail! 而非 ok:true+error 字段,
避免 CLI 静默返回空输出
- init 写 config.json 默认路径改为 ~/.wx-cli/config.json,
避免写入系统 bin 目录(/usr/local/bin/config.json)
- LIKE 通配符:搜索关键词中的 %/_/\ 现在正确转义
- WAL 路径:改用 OsString.push 拼接 "-wal" 后缀,
避免 display() 在非 UTF-8 路径上失效
- cmd_stop:检查 kill() 返回值,ESRCH 时给出明确提示
Performance & Code quality:
- full_decrypt:改为流式逐页读写,峰值内存从 2×文件大小降为 O(1)
- Regex:msg_table_re() 用 OnceLock 静态编译,避免热路径重复编译
- mtime_nanos:消除 daemon/mod.rs 与 cache.rs 的重复定义
- use super::super::cli::transport → use super::transport
- 删除未使用的 save_config、Request::to_json_line 死代码
|
2026-04-16 17:07:15 +08:00 |
jackwener
|
8bfea8869e
|
fix: 修复全部 medium/low 优先级问题
- cache/daemon: mtime 比较从 f64(secs) 改为 u64(nanos),避免浮点误差丢失变更
- transport: Unix 启动 daemon 前调用 setsid(),使其脱离控制终端防止 SIGHUP
- daemon/mod: 删除对已废弃 watcher 模块的引用
- watcher.rs: 删除全量死代码文件(功能已内联至 daemon/mod.rs)
- query: find_msg_tables 实际按 max_ts 降序排序(原注释有排序但无实现)
- scanner: 移除三平台 scan_memory 中的 dedup_by(search_pattern 已全局去重)
- watch: Windows 平台返回明确错误而非静默失败
- CI: cargo build 增加 --locked 确保使用 Cargo.lock 版本
|
2026-04-16 15:12:33 +08:00 |
jackwener
|
d475f6219b
|
feat: Rust 完整重写 wx-cli(单一二进制,支持 macOS/Linux/Windows)
实现所有核心模块:
- src/crypto/: SQLCipher 4 页解密 + WAL 应用(AES-256-CBC)
- src/scanner/: 三平台内存扫描(macOS Mach VM / Linux /proc/mem / Windows ReadProcessMemory)
- src/daemon/: tokio 异步 daemon,Unix socket IPC,mtime-aware DB 缓存,WAL 监听推送
- src/cli/: clap CLI,自动启动 daemon,完整命令实现
- src/config.rs: 跨平台配置加载,兼容 Python 版 config.json 格式
- src/ipc.rs: 换行符分隔 JSON 协议,与 Python 版兼容
- .github/workflows/release.yml: 四平台自动构建发布
cargo build --release 验证通过,生成 4.8MB macOS arm64 单一二进制
|
2026-04-16 14:37:10 +08:00 |