锁定值与上游实际资产不符(字节数 409719852 vs 409412652,摘要 ae43724a… vs 873cbbb3…),下载在字节锁处失败。上游 LTS 会被原地重传且无不可变资产 URL,摘要硬锁意味着每次重训都要改代码发签名安装包,否则全用户下载失败,这个成本消不掉。 改为锁格式:删字节数常量,总长取响应 Content-Length 并在收完后比对一次(截断检测);新增 ValidateFormat 让引擎读取端自己开一次(魔数 + 双数组边界,不按文件自带长度做堆分配)。摘要不再参与放行,只判断 reviewed 并写入旁挂 .sha256(状态查询要频繁调用,不能每次重算 400MB 哈希)。真实上游字节按 open() 判据复核精确贴边通过:array_size=102353152,收尾正好在 409412652。 kReviewedSha256 保留旧值,摘要不符即 reviewed=false,设置页明示「上游已更新,未经评测」,NOTICE 记录实际摘要与字节数并附差异说明。契约无需重生成:sentence_collocation_model_status 是两个宿主各自拼的 ad-hoc JSON,不在 schema.json 内。 撤下无法验证的宣称:设置页删掉「评测 top1 +6 个百分点」(仓里没有评测工具、没有 docs/research,该数字无法复现),改为描述机制;清掉两处对从未进仓的文档与工具的引用(docs/research、tests/src/gram_reader、eval_lm_compare);修正 octagram_gram.h 里被本次改动失效的「摘要校验在下载侧做」。配置只改注释、未增删键,五件套映射不适用。
Input engine (engine/)
The C++ conversion engine behind Metasequoia IME for Windows: input sessions, candidate lookup, helpcodes, the shared contracts and the voice module.
This directory used to be a submodule of metasequoiaime/MSIME-Engine. It is now a component of this repository, a sibling of server/, ui/, windows/ and installer/. Its upstream commit, and exactly what the Windows specialization removed, are recorded in UPSTREAM.md. Treat it as first-party code: reviewed, formatted and tested like anything else here, no longer merged from upstream.
| Directory | Purpose |
|---|---|
core/, quanpin/, shuangpin/, english/, japanese/ |
Input sessions and candidate lookup |
contracts/ |
The authoritative IPC wire format, dictionary format, punctuation policy and WebView message schema |
helpcode/ |
Helpcode (形码) tables and generators |
local_modes/, providers/, user_dictionary/ |
Local modes, online candidate sources, the user dictionary |
voice/ |
Recording, WAV encoding, recognition and text cleanup; builds independently |
googlepinyinime-rev/, ngram/kenlm/, utfcpp/, voice/third_party/ |
Vendored third-party code, kept in its upstream formatting and licence |
Integration is through <metasequoia/session.h>. See runtime architecture.
Build
The product build does not build this directory on its own: server/CMakeLists.txt pulls it in with add_subdirectory, so CI compiles and exercises the engine through the server and the TSF frontend. After changing something here, run the server's build and tests.
Building it standalone still works and is much faster while working on the engine. Dependencies are CMake 3.25+, a C++17 compiler, Boost, fmt, spdlog and SQLite3.
vcpkg install --triplet x64-windows-static
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static
cmake --build build --config Release --parallel
ctest --test-dir build -C Release --output-on-failure --timeout 20
ctest runs every engine target registered in the root CMakeLists.txt: the segmentation, IPC and punctuation contracts, the platform API, data paths, runtime isolation, dictionary state and the per-mode session tests. tests/ additionally holds a separate Windows-only project that is not part of that build — add new tests to the registered targets so they actually run.
Formatting is driven from the repository root by scripts/format.sh, using the .clang-format in this directory (voice/ has its own with a wider column limit). The vendored third-party trees and the generated headers are excluded.
Contract rules
The IPC wire format, opcodes, voice framing and WebView message definitions live in contracts/ and are the single source of truth. Consumers include the same headers; do not restate them on either side. Dictionary naming is defined by contracts/dictionary/format.json, shared with the repository root's scripts/dictionary_product.py.
Data and licensing
The dictionaries are neither stored nor built here. They arrive as a release pinned by tag and digest in product-lock.json and are downloaded at build time; the pipeline that produced them left with the specialization. Per-source licensing is tracked in NOTICE.md — read it before redistributing the built databases.
Recognition goes through a cloud provider; local Whisper inference was removed. The only committed model is voice/assets/models/silero_vad.onnx, loaded solely by the standalone Windows host that is off by default.
Licence
GPL-3.0. Vendored googlepinyinime-rev, ngram/kenlm (LGPL-2.1-or-later), utfcpp and voice/third_party/miniaudio keep their upstream licences.