用户反映更新后 API token 被清空、需要重填。根因不在安装器(它早已用 onlyifdoesntexist 且清理时保留 config.toml / config.base.toml,从不覆盖用户 配置),而在 Server 启动时的合并路径 SyncConfigWithInstalledTemplate:当 config.toml 存在、非空但解析不过(上次写入被打断留下半截文件,或 token 里混入 破坏 TOML 的字符)时,旧逻辑直接拿出厂模板覆盖,等于把用户全部配置——尤其是 凭证——清零。 配置升级本质上已经是「逐条把用户值重放到新模板」(MergeTomlIntoTemplate),因此 不另建配置操作日志,而是把「逐条重放」精准用在最难重填的凭证上,并堵掉硬重置: - ReapplyRealCredentials:合并结束时把用户填过真值的凭证逐条重放回去,有键改值、 无键则在其分节插入。覆盖 token / api_key / apikey / secret_id / secret_key / app_id / asr_app_key 及所有 per-provider 槽位(token_* / asr_token[_*] / polish_token[_*]),真值判定复用 VoiceInput::IsPlaceholderToken。这样模板漂移 漏掉某个 token 键也不会静默丢失;占位符不粘住,新默认值照常生效。 - SyncConfigWithInstalledTemplate 的 unparseable 分支:先把坏文件备份成 config.toml.corrupt-<时间戳> 留证,再逐行抢救可识别赋值重放到新模板;即便整体 抢救结果仍解析不过,也只回退到「模板 + 重放凭证」,而非纯模板。 新增回归测试:模板漏键时真 token 被写回、未填的占位符跟随新默认、损坏配置能捞回 真 token,以及读安装器真正分发的 config.default.toml 逐分节确认所有凭证键挺过升级。
Metasequoia IME Server(水杉输入法 Server 端)
This is the server end of MSIME-Windows.
How to build
Prerequisites
- Visual Studio 2026
- CMake
- vcpkg
- Python3.10+
- Boost
- Node.js and pnpm 10 (settings page build)
Make sure vcpkg and Boost are installed by Scoop.
Build steps(For Dev)
Clone the product and provision the reviewed dictionary release from its root:
git clone --recursive https://github.com/metasequoiaime/MSIME-Windows.git
cd MSIME-Windows
python scripts/product_lock.py fetch-dictionaries --staging-root .
if ($LASTEXITCODE -ne 0) { throw 'Dictionary verification failed' }
$devLocalData = Join-Path $PWD 'build/dev-local'
$devData = Join-Path $devLocalData 'metasequoiaime'
New-Item -ItemType Directory -Force $devData | Out-Null
Copy-Item MetasequoiaImeDict/out/* $devData -Force
Copy-Item engine/helpcode/helpcodes $devData -Recurse -Force
Copy-Item server/assets/tables/* $devData -Force
Copy-Item server/assets/config/config.toml $devData -Force
Push-Location ui-html/webview2/settings/ime-settings
try {
pnpm install --frozen-lockfile
if ($LASTEXITCODE -ne 0) { throw 'Settings dependencies failed' }
pnpm build
if ($LASTEXITCODE -ne 0) { throw 'Settings page build failed' }
} finally { Pop-Location }
$devWebview = Join-Path $devData 'html/webview2'
New-Item -ItemType Directory -Force $devWebview | Out-Null
foreach ($part in @('shared', 'candwnd', 'ftb', 'menu')) {
Copy-Item "ui-html/webview2/$part" $devWebview -Recurse -Force
}
$devSettings = Join-Path $devWebview 'settings/ime-settings'
New-Item -ItemType Directory -Force $devSettings | Out-Null
Copy-Item ui-html/webview2/settings/ime-settings/dist $devSettings -Recurse -Force
python server/scripts/prepare_env.py
if ($LASTEXITCODE -ne 0) { throw 'Server environment setup failed' }
$env:LOCALAPPDATA = $devLocalData
$env:METASEQUOIA_IME_DATA_DIR = $devData
cd server
Use a dedicated PowerShell terminal. These steps stage the same locked data as CI
and the current product pages in a separate development directory. Both
LOCALAPPDATA (Windows config/pages) and METASEQUOIA_IME_DATA_DIR (Engine data)
are set for that terminal; setting only the latter would still use installed
Windows configuration and pages. Close the terminal after development.
Dictionary source changes belong in Engine's dictionary/; use its root build_profile.py
to build data instead of calling internal stages in the archived Dict repository.
Then, build and run,
.\scripts\lcompile.ps1
.\scripts\lrun.ps1
If you want to build and run in one step, run the following command,
.\scripts\llaunch.ps1
Watchdog
MetasequoiaImeWatchdog.exe is built next to the server. Starting the server directly also starts the watchdog,
which monitors the server from the same directory and restarts it after an unexpected exit. Repeated early crashes use
an exponential restart delay (up to 30 seconds) to avoid a restart storm.
The developer terminate shortcut stops both processes. The restart shortcut asks the watchdog to start a fresh server after the current process exits.
English prefix candidates
Place english.db next to msime.db in %LOCALAPPDATA%\metasequoiaime. Set
general.cn_en_mixed_input = true in config.toml to enable asynchronous English prefix candidates for Quanpin and
Shuangpin.
Developer Shortcuts
The server process includes a few built-in global shortcuts that are useful during development:
Ctrl + Shift + Alt + T- terminate
MetasequoiaImeServerimmediately
- terminate
Ctrl + Shift + Alt + R- restart
MetasequoiaImeServer - Settings exposes the same restart under 外观 → 重启输入法进程; it reaches the server over the Aux pipe because Settings runs in its own process
- restart
Ctrl + Shift + Alt + C- clear IME engine cache
Ctrl + Shift + Alt + 1toCtrl + Shift + Alt + 8- delete candidate
1to8from the current candidate window - this only works while the candidate window is visible
- delete candidate
Screenshots
Shared voice providers
The server links Engine VoiceCapture and Voice. WAV encoding and batch transcription/polish codecs come from the public library; Windows keeps provider configuration, SiliconFlow padding/retry behavior and Doubao streaming. Batch uploads are bounded to 20 MiB and responses to 1 MiB. Failed or empty polish responses retain the original transcript.
本地 Release 构建脚本可通过 -ManifestTool <mt.exe 路径> 使用其他 Windows SDK;未指定时沿用现有 SDK 路径。配置、编译或 manifest 嵌入失败都会中止,避免安装器收集旧产物。






