kimi-work: show the Windows credentials path when importing

This commit is contained in:
antior
2026-11-20 10:48:17 +08:00
parent 0b3b89ab03
commit e7488730d7
3 changed files with 10 additions and 5 deletions
+2
View File
@@ -11,6 +11,8 @@ Open Kimi desktop and sign in to Work on the same computer first. Choose **使
Version **0.1.18** adds two credential-import routes in Magpie. The provider's sign-in menu now offers **导入 Kimi Work 凭据(粘贴 config.json)** beside local sign-in; **Import accounts from a file…** in the accounts area chooses a file directly. Both take `daimon/config.json` from a trusted computer signed in to Kimi Work. Unlike local sign-in, they explicitly import both the Work key and membership credentials, so the computer running Magpie does not need Kimi installed or the desktop data folder mounted. The file's `credentials.kimiCode`, `credentials.kimiWeb` and exact official Work origin are checked, then the Work key is verified with `/models` before the account is saved. Existing local/reference accounts are unchanged and are not migrated. The file-import hook is Magpie-only; OpenCode ignores it, while the paste sign-in method uses the standard provider auth hooks.
On Windows, the paste sign-in prompt shows the Explorer-ready default `%APPDATA%\kimi-desktop\daimon-share\daimon\config.json`. If Kimi's storage was moved in its settings, the real folder is the `shareDir` in `%APPDATA%\kimi-desktop\daimon-storage.json`.
The imported file contains sensitive Work and membership credentials, which are saved in Magpie's private plaintext `plugin-auth.json` (mode `0600`, not an encrypted vault). Import only into a trusted Magpie instance. Membership renewal continues as below, but it cannot renew the Work key: a Work 401 asks for a fresh `config.json` import. No desktop device ID or `kimi-code-key.json` is needed for an imported account.
Version **0.1.15** adds membership renewal and a single shared monthly meter to upstream 0.1.14. It retains the storage-pointer and sign-in diagnostics fixes (#425/#444), distinct account IDs and per-user Work keys (#440), and spent-quota 403→429 handling (#465), alongside the earlier menu/header fixes. **Existing reference-only accounts through 0.1.14 continue to read quota without reconnecting.** They do not silently migrate or spend the desktop refresh token. Explicitly reconnect only to opt into host-managed renewal when a desktop refresh token is available. Accounts already saved with a pair keep their format.
+3
View File
@@ -28,6 +28,9 @@ test('magpie offers a guided config.json import in every window language',async(
expect(p.auth.methods).toHaveLength(2);
expect(p.auth.methods[1]).toMatchObject({type:'oauth',label:'导入 Kimi Work 凭据(粘贴 config.json)'});
expect(p.auth.methods[1].prompts[0]).toMatchObject({type:'password',key:'config'});
expect(p.auth.methods[1].prompts[0].message).toContain('%APPDATA%\\kimi-desktop\\daimon-share\\daimon\\config.json');
expect(p.auth.methods[1].prompts[0].message).toContain('%APPDATA%\\kimi-desktop\\daimon-storage.json');
expect(p.auth.methods[1].prompts[0].message).toContain('shareDir');
expect(p.auth.methods[1].prompts[0].validate('')).toBeTruthy();
expect(p.auth.methods[1].prompts[0].validate(file())).toBeUndefined();
});
+5 -5
View File
@@ -102,12 +102,12 @@ const IMPORT_METHOD = {
ja:'Kimi Work 認証情報をインポート(config.json を貼り付け)',
de:'Kimi-Work-Zugangsdaten importieren (config.json einfügen)',
},
message:'粘贴 daimon/config.json 的完整 JSON 内容',
message:'粘贴 daimon/config.json 的完整 JSON 内容。Windows 默认路径:%APPDATA%\\kimi-desktop\\daimon-share\\daimon\\config.json;如果移动过 Kimi 存储位置,真实路径以 %APPDATA%\\kimi-desktop\\daimon-storage.json 中的 shareDir 为准。',
messages:{
en:'Paste the complete JSON contents of daimon/config.json',
'zh-TW':'貼上 daimon/config.json 的完整 JSON 內容',
ja:'daimon/config.json の完全な JSON 内容を貼り付けてください',
de:'Füge den vollständigen JSON-Inhalt von daimon/config.json ein',
en:'Paste the complete JSON contents of daimon/config.json. Windows default: %APPDATA%\\kimi-desktop\\daimon-share\\daimon\\config.json; if you moved Kimi storage, use shareDir from %APPDATA%\\kimi-desktop\\daimon-storage.json.',
'zh-TW':'貼上 daimon/config.json 的完整 JSON 內容。Windows 預設路徑:%APPDATA%\\kimi-desktop\\daimon-share\\daimon\\config.json;如果移動過 Kimi 儲存位置,真實路徑以 %APPDATA%\\kimi-desktop\\daimon-storage.json 中的 shareDir 為準。',
ja:'daimon/config.json の完全な JSON 内容を貼り付けてください。Windows のデフォルト: %APPDATA%\\kimi-desktop\\daimon-share\\daimon\\config.json。Kimi の保存場所を移動した場合は、%APPDATA%\\kimi-desktop\\daimon-storage.json の shareDir を参照してください。',
de:'Füge den vollständigen JSON-Inhalt von daimon/config.json ein. Windows-Standard: %APPDATA%\\kimi-desktop\\daimon-share\\daimon\\config.json; bei verschobenem Kimi-Speicher gilt shareDir aus %APPDATA%\\kimi-desktop\\daimon-storage.json.',
},
};
// spentQuota is a 403 body saying the account's allowance is used up, not